Commit graph

508 commits

Author SHA1 Message Date
musi
d29f2176e8 Merge dev/3.1 for 3.0.9 release 2026-07-07 21:36:59 +08:00
musistudio
bc872a29b3 fix fusion error 2026-07-07 20:34:11 +08:00
musistudio
c8cbc09b96 add new api probe 2026-07-07 20:29:32 +08:00
musistudio
52a6371600 add preset providers 2026-07-07 19:25:25 +08:00
musistudio
027826fd13 Refactor router context handling and update integrations 2026-07-07 18:56:28 +08:00
musi
7216b9dcfa Split configuration docs into main and settings pages 2026-07-07 07:39:02 +08:00
musi
300096e39e build: slim docker runtime image
Some checks are pending
Docs / Build (push) Waiting to run
Docs / Deploy (push) Blocked by required conditions
2026-07-06 22:54:46 +08:00
musi
07fd47ad65 fix: set linux executable name for AppImage 2026-07-06 22:32:57 +08:00
musi
4d7c1990ba Merge dev/3.1 for 3.0.8 release 2026-07-06 22:23:30 +08:00
musi
8cf350e041 chore: prepare 3.0.8 desktop release 2026-07-06 22:22:52 +08:00
musi
7faf59276a update ai-gateway version 2026-07-06 22:19:54 +08:00
musi
a4f5cc9172 Simplify Docker networking and external URL handling 2026-07-06 22:16:30 +08:00
musi
ad0d9db795 Scope ToolHub resolve cache by task 2026-07-06 21:56:55 +08:00
musistudio
1da1723530 Merge remote-tracking branch 'origin/dev/3.1' into dev/3.1 2026-07-06 20:23:45 +08:00
musistudio
d4ff6706f4 Refactor router flow and update provider integrations 2026-07-06 20:23:14 +08:00
musi
fce80a0c3a Merge branch 'main' into dev/3.1 2026-07-06 09:05:45 +08:00
musi
9af987d224 update readme badge 2026-07-06 08:48:09 +08:00
musi
61108ed6e3
Merge pull request #1489 from jesieleo/fix/gateway-crashes
Fix/gateway crashes
2026-07-06 08:41:25 +08:00
musistudio
c409797bc5 fix provider icon 2026-07-06 07:36:15 +08:00
musistudio
964d1dbf23 Add protocol detection details tooltip 2026-07-06 07:25:09 +08:00
musistudio
5f92120114 Bundle bot gateway SDK and simplify CLI delegation 2026-07-05 22:38:09 +08:00
musistudio
528a8e0efa Refactor routing and provider integration 2026-07-05 19:57:39 +08:00
jesieleo
daf745ac3f fix(codex-middleware): stop forcing sandbox_mode=workspace-write to avoid repeated COM+ setup failures
When Codex runs through the ccr middleware, every command execution
fails with three repeated Windows error dialogs:

  codex-windows-sandbox-setup.exe
  COM+ 注册表数据库检测到一个系统错误
  (COM+ registry database system error)

Root cause: the middleware's config/read handler hard-coded
`sandbox_mode: "workspace-write"` in the virtual config returned to
Codex (codex-cli-middleware-runtime.ts configRead). Unlike the
`elevated` mode Codex reads from its own config.toml when run directly
(or via tools that only swap config like cc-switch), `workspace-write`
triggers `codex-windows-sandbox-setup.exe` setup refresh on every
command. On systems where the COM+ catalog is unavailable (COMSysApp
stopped or the catalog itself misbehaves — see openai/codex#29332),
that refresh fails and surfaces as the repeated error dialogs.

Empirically verified across the three legal sandbox_mode values:

  - read-only          : does not trigger setup, but cannot write files
  - workspace-write    : triggers setup refresh every command -> fails
                         on affected systems (this bug)
  - danger-full-access : does not trigger setup, can write files, but
                         has no isolation

Forcing workspace-write therefore both overrides the user's own
config.toml preference AND guarantees the failure on affected systems.

Fix: omit sandbox_mode from the virtual config entirely, letting Codex
read it from its own config.toml ([windows] sandbox / sandbox_mode) —
matching the behavior of config-only tools like cc-switch. The user
keeps full control: those who want isolation set workspace-write (and
must ensure their COM+ works); those on affected systems set
danger-full-access.

This is a one-line removal plus an explanatory comment; configValues
was already empty ({}), so Codex now falls back to its config file
exactly as it does without any middleware.

Refs: openai/codex#29332
2026-07-04 18:52:04 +08:00
jesieleo
ee44357a34 fix(gateway): prevent three crashes from non-ASCII names, client disconnect, and immutable headers
Three independent crashes in src/server/gateway/service.ts, each surfacing
as either a 502 or an Electron Uncaught Exception dialog.

== 1. Non-ASCII provider/model names -> 502 ByteString error ==

When a provider name or model selector contains non-ASCII characters
(CJK, emoji, accented Latin — e.g. "小米mimo/mimo-v2.5-pro-ultraspeed"),
every routed request fails with:

  Unexpected status 502 Bad Gateway: Cannot convert argument to a
  ByteString because the character at index 0 has a value of 23567
  which is greater than 255.

Several observability headers derived their values from raw,
unsanitized user-facing strings (x-ccr-logical-provider, x-ccr-routed-
model, x-ccr-route-reason, the model-discovery/app-rewrite/codex-patch
diagnostics, x-ccr-fallback-model). Node/undici enforces the HTTP
ByteString contract (code point <= 255), so any non-ASCII char throws a
TypeError that bubbles to the catch-all as 502.

Fix: add sanitizeHeaderValue() that replaces characters outside the
printable ASCII range with "-", and wrap all ten affected assignments.
The core gateway (@the-next-ai/ai-gateway) does not read any x-ccr-*
header (verified), so values stay observability-only.

== 2. Client disconnect mid-stream -> Uncaught Exception ==

When a client closes the SSE connection mid-stream — normal during
local tool execution (file creation) — the gateway emitted an Uncaught
Exception that crashed the Electron main process:

  Uncaught Exception:
  Error: Client connection closed before response completed.

Two gaps let the error escape:
  - responseBody.once("error", ...) consumes only the FIRST error, but
    a disconnect triggers several in quick succession (abort, destroy,
    EPIPE). Remaining errors re-throw as unhandled.
  - The destination ServerResponse had NO "error" listener, so write
    failures on a closed socket bubbled up directly.

Fix: once("error") -> on("error") on the response body so every error
is logged via writeStreamLog; add response.on("error") that marks the
disconnect and aborts upstream. Only the spurious crash is removed —
disconnects are still recorded and upstream still aborted.

== 3. Codex apply_patch -> 502 "immutable" ==

Creating a file via Codex (apply_patch) fails with:

  Unexpected status 502 Bad Gateway: immutable

Undici's fetch Response.headers can be immutable; mergeFallbackResponse
Headers returns it as-is when no fallback occurred, and the codex patch
bridge then calls responseHeaders.delete("content-length"), which
throws TypeError: immutable.

Fix: wrap the merged headers in new Headers(...) to guarantee a mutable
copy regardless of upstream immutability or merge early-return.

== Verification ==

- sanitizeHeaderValue: "小米mimo/mimo-v2.5-pro-ultraspeed" ->
  "mimo/mimo-v2.5-pro-ultraspeed" (ASCII-safe); real repro confirmed.
- Disconnect crash: previously fired on every file-creating tool call;
  after fix, no crash, model continues normally.
- immutable 502: previously fired on every apply_patch; after fix,
  files are created successfully.
- ASCII-only configs unaffected (sanitization is a no-op; error
  handlers only affect the failure path).
2026-07-04 18:52:03 +08:00
musi
87a666df21 chore: release 3.0.7
Some checks failed
Docs / Build (push) Has been cancelled
Docs / Deploy (push) Has been cancelled
2026-07-03 23:04:05 +08:00
musistudio
d41dae4e4a feat: update ai-gateway version 2026-07-03 22:58:16 +08:00
musistudio
3983322519 feat: update ai-gateway version 2026-07-03 22:57:08 +08:00
musistudio
2929903bdc Merge branch 'main' into dev/3.1 2026-07-03 22:56:26 +08:00
musistudio
7130e1e632 Add TeamoRouter provider preset and docs 2026-07-03 22:53:10 +08:00
musistudio
6bfb2e1901 Merge remote-tracking branch 'origin/dev/3.1' into dev/3.1 2026-07-03 21:30:52 +08:00
musi
46fa7e2181 Remove stale generated bin backups 2026-07-03 21:29:10 +08:00
musistudio
2410530450 Fix Claude app launch on macOS 2026-07-03 15:35:07 +08:00
musistudio
6118d52df5 Improve reset credit label localization 2026-07-03 15:16:14 +08:00
musistudio
43948b4c2a Refactor router configuration and expand provider support 2026-07-03 15:11:52 +08:00
musi
b6f8bb3c52 Add Codex manual reset account metrics 2026-07-03 13:58:05 +08:00
musistudio
15fcaaecf5 Document in-app browser search provider 2026-07-03 11:58:49 +08:00
musistudio
0d51897d18 Add Gemini interactions protocol support 2026-07-03 11:44:47 +08:00
musistudio
89d2d2394c Add launch-at-login support and route merge handling 2026-07-03 11:12:14 +08:00
musistudio
d45e88387a Refine protocol probe filtering for Gemini 2026-07-03 10:31:39 +08:00
musi
f13e3b4598 fix: avoid false protocol detection for Gemini 2026-07-03 10:01:48 +08:00
musi
7e44650008
Merge pull request #1482 from 810senpai114514/fix-proxy-passthrough
fix(gateway): 代理透传改用 globalThis.fetch,修复 NO_PROXY 解析缺陷
2026-07-03 08:44:54 +08:00
810senpai114514
5f7345fdc8 fix(gateway): proxy passthrough via globalThis.fetch and fix NO_PROXY parsing
Replace setGlobalDispatcher with globalThis.fetch wrapper to work around
bundled undici instance isolation in ai-gateway subprocess. Also:

- Extract shared readEnvProxyUrl() to eliminate duplicated env proxy logic
- Fix IPv6 loopback detection (URL.hostname returns [::1] with brackets)
- Fix URL object handling in preload bypass check
- Fix *.domain wildcard and host:port NO_PROXY matching
- Fix inverted fail-safe: bypass on parse error instead of proxying
- Add writable guard for globalThis.fetch assignment
2026-07-03 00:20:26 +08:00
musi
0f54b7d7a3 Merge branch 'dev/3.1'
Some checks are pending
Docs / Build (push) Waiting to run
Docs / Deploy (push) Blocked by required conditions
2026-07-02 22:09:01 +08:00
musi
ec99720037 chore: release 3.0.6 2026-07-02 22:08:17 +08:00
musistudio
01b3c3bc3b Add router support for multi-provider model handling 2026-07-02 20:28:25 +08:00
musistudio
ccd2694d43 Open main window from tray and hide it on close 2026-07-02 18:30:24 +08:00
musistudio
109b83bd80 Refactor router and add model fallback handling 2026-07-02 18:23:58 +08:00
musistudio
32db838b0b Merge remote-tracking branch 'origin/dev/3.1' into dev/3.1 2026-07-02 11:46:30 +08:00
musistudio
1adfbbf006 Sort subagent model descriptions deterministically 2026-07-02 11:44:13 +08:00
musi
ffc6318dee Revise overview dashboard docs and nav links 2026-07-02 09:22:28 +08:00