jeo-code 0.8.11 → 0.8.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.ja.md +1 -1
- package/README.ko.md +1 -1
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/package.json +1 -1
- package/src/agent/memory.ts +43 -2
- package/src/agent/tool-output.ts +9 -6
- package/src/ai/model-catalog.ts +39 -1
- package/src/ai/model-discovery.ts +5 -1
- package/src/ai/model-manager.ts +7 -6
- package/src/ai/providers/antigravity.ts +40 -7
- package/src/ai/providers/errors.ts +6 -2
- package/src/ai/providers/gemini.ts +29 -2
- package/src/commands/launch/model-slash.ts +5 -1
- package/src/skills/catalog.ts +61 -31
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
The README mirrors the latest 5 entries — regenerate with `bun run changelog:sync`.
|
|
8
8
|
|
|
9
|
+
## [0.8.12] - 2026-07-08
|
|
10
|
+
_"제오코드에서 oauth 지피티 모델 연결이 안되는데 원인파악해서 개선해" — root-caused a structural drift bug: OpenAI's live Codex models endpoint (`chatgpt.com/backend-api/codex/models`, the SAME endpoint the `/model` picker discovers from) had shipped `gpt-5.4-mini` alongside `gpt-5.5`/`gpt-5.4`, but jeo's static OAuth allow-list (`CODEX_MODELS`) hadn't caught up — the picker correctly listed the model (straight from that live endpoint), but selecting or calling it then hit a hard-coded `CODEX_MODELS.includes(...)` gate that rejected it with "OpenAI OAuth credential only supports Codex models", even though the account's own OAuth token genuinely serves it. This is a whole class of bug: it recurs every time OpenAI ships a new Codex model between jeo releases, and previously required a jeo update to fix each time._
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- **Added the missing `gpt-5.4-mini` to the OAuth allow-list** (`src/ai/model-catalog.ts`) — immediate fix for the exact reported failure, with a full capability row (272K context, 128K max output, full thinking support, image input) added to `MODEL_CATALOG`.
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
- **Self-healing live Codex model gate** (`src/ai/model-catalog.ts`, `src/ai/model-discovery.ts`, `src/ai/model-manager.ts`, `src/commands/launch/model-slash.ts`) — new `isCodexModel()` checks the maintained `CODEX_MODELS` list PLUS any model id this session's OWN OAuth discovery call already observed live (`recordLiveCodexModels`, additive-only, session-lifetime). `listProviderModels` now records every `oauth`-sourced OpenAI model list on a successful call (picker open, `jeo doctor`, or any model resolution) — an `api_key`-sourced result never widens the gate, since it says nothing about what OAuth can serve. `oauthServesModel` (the gate behind `resolveCall`, `effectiveCredentialForProvider`, and `modelServableWithConfig`) and the `/model` pin-warning now both consult `isCodexModel` instead of the raw static list — closes this bug class permanently: any future Codex model OpenAI ships becomes usable the moment the account's own endpoint confirms it, with zero release lag. The OAuth-rejection error message is now built dynamically from `CODEX_MODELS` instead of a hard-coded two-model string.
|
|
17
|
+
|
|
18
|
+
### Verified
|
|
19
|
+
- Independently mutation-tested (5 mutations across all 4 touched files): all 5 caught by tests; found and closed 1 genuine gap in `recordLiveCodexModels`'s additive-across-separate-calls contract (a clear-then-add REPLACE implementation was indistinguishable from ADD until a test called it twice with disjoint id lists).
|
|
20
|
+
- Live-verified: `jeo --model gpt-5.4-mini -p "hello"` failed with the OAuth-rejection error before the fix, succeeds after.
|
|
21
|
+
- Full suite 2802/2802 pass, typecheck clean.
|
|
22
|
+
|
|
9
23
|
## [0.8.11] - 2026-07-08
|
|
10
24
|
_"프롬프트 라우팅 동작이 Error: Unable to connect. Is the computer able to access the url? Error: Was there a typo in the url or port? 와 같은 메시지 남기고 동작안하는데 원인을 파악하고 근본문제해결하자" — traced the raw, provider-less connection error to two compounding gaps. (1) `describeProvider` reports local providers (ollama/lmstudio) as `ready: true` UNCONDITIONALLY — "keyless" only means no credential is required, never that the server is actually reachable — so the routing veto gate (which exists precisely to keep a misconfigured routing target from making a turn worse than routing being off) had no way to catch a `routing.tiers`/`roles` pin to a downed local server. (2) Bun's fetch/undici throws a bare `Error("Unable to connect. Is the computer able to access the url?")` with `.code === "ConnectionRefused"` for BOTH a refused connection and an unresolvable host — no HTTP status, no provider name, no URL — and this fell through every existing error classifier (`defaultRetryable`, `friendlyProviderError`) to reach the user completely unfiltered._
|
|
11
25
|
|
package/README.ja.md
CHANGED
|
@@ -262,11 +262,11 @@ CI は `.github/workflows/npm-publish.yml` で公開します — GitHub リリ
|
|
|
262
262
|
## 変更履歴 (Changelog)
|
|
263
263
|
|
|
264
264
|
<!-- CHANGELOG:START (auto-generated from CHANGELOG.md — run `bun run changelog:sync`) -->
|
|
265
|
+
- **[0.8.12]** (2026-07-08) — "제오코드에서 oauth 지피티 모델 연결이 안되는데 원인파악해서 개선해" — root-caused a structural drift bug: OpenAI's live Codex models endpoint (`chatgpt.com/backend-api/codex/models`, the SAME endpoint the `/model` picker discovers from) had shipped `gpt-5.4-mini` alongside `gpt-5.5`/`gpt-5.4`, but jeo's static OAuth allow-list (`CODEX_MODELS`) hadn't caught up — the picker correctly listed the model (straight from that live endpoint), but selecting or calling it then hit a hard-coded `CODEX_MODELS.includes(...)` gate that rejected it with "OpenAI OAuth credential only supports Codex models", even though the account's own OAuth token genuinely serves it. This is a whole class of bug: it recurs every time OpenAI ships a new Codex model between jeo releases, and previously required a jeo update to fix each time.
|
|
265
266
|
- **[0.8.11]** (2026-07-08) — "프롬프트 라우팅 동작이 Error: Unable to connect. Is the computer able to access the url? Error: Was there a typo in the url or port? 와 같은 메시지 남기고 동작안하는데 원인을 파악하고 근본문제해결하자" — traced the raw, provider-less connection error to two compounding gaps. (1) `describeProvider` reports local providers (ollama/lmstudio) as `ready: true` UNCONDITIONALLY — "keyless" only means no credential is required, never that the server is actually reachable — so the routing veto gate (which exists precisely to keep a misconfigured routing target from making a turn worse than routing being off) had no way to catch a `routing.tiers`/`roles` pin to a downed local server. (2) Bun's fetch/undici throws a bare `Error("Unable to connect. Is the computer able to access the url?")` with `.code === "ConnectionRefused"` for BOTH a refused connection and an unresolvable host — no HTTP status, no provider name, no URL — and this fell through every existing error classifier (`defaultRetryable`, `friendlyProviderError`) to reach the user completely unfiltered.
|
|
266
267
|
- **[0.8.10]** (2026-07-08) — "지피티 모델 연결이 안되는데 원인파악해서 개선해" — OpenAI's Codex/Responses backend (used by every `gpt-5.5`/`gpt-5.4` OAuth call, and by API-key reasoning models) can emit an in-band `response.failed`/`error` SSE EVENT on an otherwise-200 stream (documented codes: `server_error`, `rate_limit_exceeded` — OpenAI's own guidance is "retry with exponential backoff"). This was thrown as an unclassified bare `Error`, which propagated straight out of the engine's model call with NO retry — a transient OpenAI backend hiccup killed the whole turn outright, surfacing as "GPT doesn't connect" during real interactive use even though `jeo doctor` and a fresh one-shot call both looked healthy (the failure only manifests mid-stream, after the connection has already succeeded).
|
|
267
268
|
- **[0.8.9]** (2026-07-08) — "프롬프트 라우팅 속도 문제가 있는거같은데 근본원인 알려줘" — prompt routing incurred significant latency due to a design oversight in LLM-based escalation: when heuristic confidence falls below threshold (standard conceptual questions with no code blocks/file paths conflict-trigger 0.35 confidence), it makes a blocking, synchronous LLM classifier call. If the user's global `thinkingLevel` is enabled (medium/high/xhigh), the cheap classifier model (Haiku 4.5 / GPT-4o-mini) also ran with reasoning enabled, wasting 500ms–1500ms on internal thoughts for a simple 1-word JSON response. The same reasoning-latency leak existed on all other background/internal LLM calls (compaction summarizer, goal verifier, memory distiller), blocking user turns on compaction boundaries.
|
|
268
269
|
- **[0.8.8]** (2026-07-08) — "실동작검증을 통해서 유효성 평가하고 개선해줘" — live-verified the v0.8.5 fallback mechanism using active Claude Code OAuth credentials on this machine (confirmed 200 OK for both Fable 5 and Opus 4.8 via the proxy). Identified two critical improvement vectors during verification: (1) server-side fallback was previously scoped strictly to API-key credentials, leaving OAuth users (who also hit `reasoning_extraction` refusals) with today's reactive-only recovery; (2) the sequential `postAnthropic` retry ladder could throw immediately on a combination of different error types (e.g. temperature error first, then fallback error, then success).
|
|
269
|
-
- **[0.8.7]** (2026-07-08) — Fix-forward for a CI-caught release failure in v0.8.6 (this same session): `test/launch-prompt-routing.test.ts` shipped with a dropped closing brace (a git 3-way merge misaligned on a duplicate `});` line during this session's own working-tree isolation, then a subsequent `git stash push --keep-index` silently reset the working tree to the pre-fix staged content — the fix was applied once, verified once, then invisibly reverted before the commit that actually shipped). The v0.8.6 GitHub Actions release workflow correctly caught the syntax error at `bun test` and failed BEFORE the npm publish step ran; `npm view jeo-code version` confirmed 0.8.5 remained latest throughout — nothing broken ever reached the registry. Per this repo's established pattern for a same-day CI-caught regression (v0.8.0 → v0.8.1), shipping forward rather than retargeting the already-publicly-failed v0.8.6 tag.
|
|
270
270
|
|
|
271
271
|
See [CHANGELOG.md](CHANGELOG.md) for the full history.
|
|
272
272
|
<!-- CHANGELOG:END -->
|
package/README.ko.md
CHANGED
|
@@ -263,11 +263,11 @@ CI는 `.github/workflows/npm-publish.yml`로 배포합니다 — GitHub 릴리
|
|
|
263
263
|
## 변경 이력 (Changelog)
|
|
264
264
|
|
|
265
265
|
<!-- CHANGELOG:START (auto-generated from CHANGELOG.md — run `bun run changelog:sync`) -->
|
|
266
|
+
- **[0.8.12]** (2026-07-08) — "제오코드에서 oauth 지피티 모델 연결이 안되는데 원인파악해서 개선해" — root-caused a structural drift bug: OpenAI's live Codex models endpoint (`chatgpt.com/backend-api/codex/models`, the SAME endpoint the `/model` picker discovers from) had shipped `gpt-5.4-mini` alongside `gpt-5.5`/`gpt-5.4`, but jeo's static OAuth allow-list (`CODEX_MODELS`) hadn't caught up — the picker correctly listed the model (straight from that live endpoint), but selecting or calling it then hit a hard-coded `CODEX_MODELS.includes(...)` gate that rejected it with "OpenAI OAuth credential only supports Codex models", even though the account's own OAuth token genuinely serves it. This is a whole class of bug: it recurs every time OpenAI ships a new Codex model between jeo releases, and previously required a jeo update to fix each time.
|
|
266
267
|
- **[0.8.11]** (2026-07-08) — "프롬프트 라우팅 동작이 Error: Unable to connect. Is the computer able to access the url? Error: Was there a typo in the url or port? 와 같은 메시지 남기고 동작안하는데 원인을 파악하고 근본문제해결하자" — traced the raw, provider-less connection error to two compounding gaps. (1) `describeProvider` reports local providers (ollama/lmstudio) as `ready: true` UNCONDITIONALLY — "keyless" only means no credential is required, never that the server is actually reachable — so the routing veto gate (which exists precisely to keep a misconfigured routing target from making a turn worse than routing being off) had no way to catch a `routing.tiers`/`roles` pin to a downed local server. (2) Bun's fetch/undici throws a bare `Error("Unable to connect. Is the computer able to access the url?")` with `.code === "ConnectionRefused"` for BOTH a refused connection and an unresolvable host — no HTTP status, no provider name, no URL — and this fell through every existing error classifier (`defaultRetryable`, `friendlyProviderError`) to reach the user completely unfiltered.
|
|
267
268
|
- **[0.8.10]** (2026-07-08) — "지피티 모델 연결이 안되는데 원인파악해서 개선해" — OpenAI's Codex/Responses backend (used by every `gpt-5.5`/`gpt-5.4` OAuth call, and by API-key reasoning models) can emit an in-band `response.failed`/`error` SSE EVENT on an otherwise-200 stream (documented codes: `server_error`, `rate_limit_exceeded` — OpenAI's own guidance is "retry with exponential backoff"). This was thrown as an unclassified bare `Error`, which propagated straight out of the engine's model call with NO retry — a transient OpenAI backend hiccup killed the whole turn outright, surfacing as "GPT doesn't connect" during real interactive use even though `jeo doctor` and a fresh one-shot call both looked healthy (the failure only manifests mid-stream, after the connection has already succeeded).
|
|
268
269
|
- **[0.8.9]** (2026-07-08) — "프롬프트 라우팅 속도 문제가 있는거같은데 근본원인 알려줘" — prompt routing incurred significant latency due to a design oversight in LLM-based escalation: when heuristic confidence falls below threshold (standard conceptual questions with no code blocks/file paths conflict-trigger 0.35 confidence), it makes a blocking, synchronous LLM classifier call. If the user's global `thinkingLevel` is enabled (medium/high/xhigh), the cheap classifier model (Haiku 4.5 / GPT-4o-mini) also ran with reasoning enabled, wasting 500ms–1500ms on internal thoughts for a simple 1-word JSON response. The same reasoning-latency leak existed on all other background/internal LLM calls (compaction summarizer, goal verifier, memory distiller), blocking user turns on compaction boundaries.
|
|
269
270
|
- **[0.8.8]** (2026-07-08) — "실동작검증을 통해서 유효성 평가하고 개선해줘" — live-verified the v0.8.5 fallback mechanism using active Claude Code OAuth credentials on this machine (confirmed 200 OK for both Fable 5 and Opus 4.8 via the proxy). Identified two critical improvement vectors during verification: (1) server-side fallback was previously scoped strictly to API-key credentials, leaving OAuth users (who also hit `reasoning_extraction` refusals) with today's reactive-only recovery; (2) the sequential `postAnthropic` retry ladder could throw immediately on a combination of different error types (e.g. temperature error first, then fallback error, then success).
|
|
270
|
-
- **[0.8.7]** (2026-07-08) — Fix-forward for a CI-caught release failure in v0.8.6 (this same session): `test/launch-prompt-routing.test.ts` shipped with a dropped closing brace (a git 3-way merge misaligned on a duplicate `});` line during this session's own working-tree isolation, then a subsequent `git stash push --keep-index` silently reset the working tree to the pre-fix staged content — the fix was applied once, verified once, then invisibly reverted before the commit that actually shipped). The v0.8.6 GitHub Actions release workflow correctly caught the syntax error at `bun test` and failed BEFORE the npm publish step ran; `npm view jeo-code version` confirmed 0.8.5 remained latest throughout — nothing broken ever reached the registry. Per this repo's established pattern for a same-day CI-caught regression (v0.8.0 → v0.8.1), shipping forward rather than retargeting the already-publicly-failed v0.8.6 tag.
|
|
271
271
|
|
|
272
272
|
See [CHANGELOG.md](CHANGELOG.md) for the full history.
|
|
273
273
|
<!-- CHANGELOG:END -->
|
package/README.md
CHANGED
|
@@ -265,11 +265,11 @@ Huge thanks to [gajae-code](https://github.com/Yeachan-Heo/gajae-code) for the i
|
|
|
265
265
|
## Changelog
|
|
266
266
|
|
|
267
267
|
<!-- CHANGELOG:START (auto-generated from CHANGELOG.md — run `bun run changelog:sync`) -->
|
|
268
|
+
- **[0.8.12]** (2026-07-08) — "제오코드에서 oauth 지피티 모델 연결이 안되는데 원인파악해서 개선해" — root-caused a structural drift bug: OpenAI's live Codex models endpoint (`chatgpt.com/backend-api/codex/models`, the SAME endpoint the `/model` picker discovers from) had shipped `gpt-5.4-mini` alongside `gpt-5.5`/`gpt-5.4`, but jeo's static OAuth allow-list (`CODEX_MODELS`) hadn't caught up — the picker correctly listed the model (straight from that live endpoint), but selecting or calling it then hit a hard-coded `CODEX_MODELS.includes(...)` gate that rejected it with "OpenAI OAuth credential only supports Codex models", even though the account's own OAuth token genuinely serves it. This is a whole class of bug: it recurs every time OpenAI ships a new Codex model between jeo releases, and previously required a jeo update to fix each time.
|
|
268
269
|
- **[0.8.11]** (2026-07-08) — "프롬프트 라우팅 동작이 Error: Unable to connect. Is the computer able to access the url? Error: Was there a typo in the url or port? 와 같은 메시지 남기고 동작안하는데 원인을 파악하고 근본문제해결하자" — traced the raw, provider-less connection error to two compounding gaps. (1) `describeProvider` reports local providers (ollama/lmstudio) as `ready: true` UNCONDITIONALLY — "keyless" only means no credential is required, never that the server is actually reachable — so the routing veto gate (which exists precisely to keep a misconfigured routing target from making a turn worse than routing being off) had no way to catch a `routing.tiers`/`roles` pin to a downed local server. (2) Bun's fetch/undici throws a bare `Error("Unable to connect. Is the computer able to access the url?")` with `.code === "ConnectionRefused"` for BOTH a refused connection and an unresolvable host — no HTTP status, no provider name, no URL — and this fell through every existing error classifier (`defaultRetryable`, `friendlyProviderError`) to reach the user completely unfiltered.
|
|
269
270
|
- **[0.8.10]** (2026-07-08) — "지피티 모델 연결이 안되는데 원인파악해서 개선해" — OpenAI's Codex/Responses backend (used by every `gpt-5.5`/`gpt-5.4` OAuth call, and by API-key reasoning models) can emit an in-band `response.failed`/`error` SSE EVENT on an otherwise-200 stream (documented codes: `server_error`, `rate_limit_exceeded` — OpenAI's own guidance is "retry with exponential backoff"). This was thrown as an unclassified bare `Error`, which propagated straight out of the engine's model call with NO retry — a transient OpenAI backend hiccup killed the whole turn outright, surfacing as "GPT doesn't connect" during real interactive use even though `jeo doctor` and a fresh one-shot call both looked healthy (the failure only manifests mid-stream, after the connection has already succeeded).
|
|
270
271
|
- **[0.8.9]** (2026-07-08) — "프롬프트 라우팅 속도 문제가 있는거같은데 근본원인 알려줘" — prompt routing incurred significant latency due to a design oversight in LLM-based escalation: when heuristic confidence falls below threshold (standard conceptual questions with no code blocks/file paths conflict-trigger 0.35 confidence), it makes a blocking, synchronous LLM classifier call. If the user's global `thinkingLevel` is enabled (medium/high/xhigh), the cheap classifier model (Haiku 4.5 / GPT-4o-mini) also ran with reasoning enabled, wasting 500ms–1500ms on internal thoughts for a simple 1-word JSON response. The same reasoning-latency leak existed on all other background/internal LLM calls (compaction summarizer, goal verifier, memory distiller), blocking user turns on compaction boundaries.
|
|
271
272
|
- **[0.8.8]** (2026-07-08) — "실동작검증을 통해서 유효성 평가하고 개선해줘" — live-verified the v0.8.5 fallback mechanism using active Claude Code OAuth credentials on this machine (confirmed 200 OK for both Fable 5 and Opus 4.8 via the proxy). Identified two critical improvement vectors during verification: (1) server-side fallback was previously scoped strictly to API-key credentials, leaving OAuth users (who also hit `reasoning_extraction` refusals) with today's reactive-only recovery; (2) the sequential `postAnthropic` retry ladder could throw immediately on a combination of different error types (e.g. temperature error first, then fallback error, then success).
|
|
272
|
-
- **[0.8.7]** (2026-07-08) — Fix-forward for a CI-caught release failure in v0.8.6 (this same session): `test/launch-prompt-routing.test.ts` shipped with a dropped closing brace (a git 3-way merge misaligned on a duplicate `});` line during this session's own working-tree isolation, then a subsequent `git stash push --keep-index` silently reset the working tree to the pre-fix staged content — the fix was applied once, verified once, then invisibly reverted before the commit that actually shipped). The v0.8.6 GitHub Actions release workflow correctly caught the syntax error at `bun test` and failed BEFORE the npm publish step ran; `npm view jeo-code version` confirmed 0.8.5 remained latest throughout — nothing broken ever reached the registry. Per this repo's established pattern for a same-day CI-caught regression (v0.8.0 → v0.8.1), shipping forward rather than retargeting the already-publicly-failed v0.8.6 tag.
|
|
273
273
|
|
|
274
274
|
See [CHANGELOG.md](CHANGELOG.md) for the full history.
|
|
275
275
|
<!-- CHANGELOG:END -->
|
package/README.zh.md
CHANGED
|
@@ -262,11 +262,11 @@ CI 通过 `.github/workflows/npm-publish.yml` 发布 — GitHub 发布 release
|
|
|
262
262
|
## 更新日志 (Changelog)
|
|
263
263
|
|
|
264
264
|
<!-- CHANGELOG:START (auto-generated from CHANGELOG.md — run `bun run changelog:sync`) -->
|
|
265
|
+
- **[0.8.12]** (2026-07-08) — "제오코드에서 oauth 지피티 모델 연결이 안되는데 원인파악해서 개선해" — root-caused a structural drift bug: OpenAI's live Codex models endpoint (`chatgpt.com/backend-api/codex/models`, the SAME endpoint the `/model` picker discovers from) had shipped `gpt-5.4-mini` alongside `gpt-5.5`/`gpt-5.4`, but jeo's static OAuth allow-list (`CODEX_MODELS`) hadn't caught up — the picker correctly listed the model (straight from that live endpoint), but selecting or calling it then hit a hard-coded `CODEX_MODELS.includes(...)` gate that rejected it with "OpenAI OAuth credential only supports Codex models", even though the account's own OAuth token genuinely serves it. This is a whole class of bug: it recurs every time OpenAI ships a new Codex model between jeo releases, and previously required a jeo update to fix each time.
|
|
265
266
|
- **[0.8.11]** (2026-07-08) — "프롬프트 라우팅 동작이 Error: Unable to connect. Is the computer able to access the url? Error: Was there a typo in the url or port? 와 같은 메시지 남기고 동작안하는데 원인을 파악하고 근본문제해결하자" — traced the raw, provider-less connection error to two compounding gaps. (1) `describeProvider` reports local providers (ollama/lmstudio) as `ready: true` UNCONDITIONALLY — "keyless" only means no credential is required, never that the server is actually reachable — so the routing veto gate (which exists precisely to keep a misconfigured routing target from making a turn worse than routing being off) had no way to catch a `routing.tiers`/`roles` pin to a downed local server. (2) Bun's fetch/undici throws a bare `Error("Unable to connect. Is the computer able to access the url?")` with `.code === "ConnectionRefused"` for BOTH a refused connection and an unresolvable host — no HTTP status, no provider name, no URL — and this fell through every existing error classifier (`defaultRetryable`, `friendlyProviderError`) to reach the user completely unfiltered.
|
|
266
267
|
- **[0.8.10]** (2026-07-08) — "지피티 모델 연결이 안되는데 원인파악해서 개선해" — OpenAI's Codex/Responses backend (used by every `gpt-5.5`/`gpt-5.4` OAuth call, and by API-key reasoning models) can emit an in-band `response.failed`/`error` SSE EVENT on an otherwise-200 stream (documented codes: `server_error`, `rate_limit_exceeded` — OpenAI's own guidance is "retry with exponential backoff"). This was thrown as an unclassified bare `Error`, which propagated straight out of the engine's model call with NO retry — a transient OpenAI backend hiccup killed the whole turn outright, surfacing as "GPT doesn't connect" during real interactive use even though `jeo doctor` and a fresh one-shot call both looked healthy (the failure only manifests mid-stream, after the connection has already succeeded).
|
|
267
268
|
- **[0.8.9]** (2026-07-08) — "프롬프트 라우팅 속도 문제가 있는거같은데 근본원인 알려줘" — prompt routing incurred significant latency due to a design oversight in LLM-based escalation: when heuristic confidence falls below threshold (standard conceptual questions with no code blocks/file paths conflict-trigger 0.35 confidence), it makes a blocking, synchronous LLM classifier call. If the user's global `thinkingLevel` is enabled (medium/high/xhigh), the cheap classifier model (Haiku 4.5 / GPT-4o-mini) also ran with reasoning enabled, wasting 500ms–1500ms on internal thoughts for a simple 1-word JSON response. The same reasoning-latency leak existed on all other background/internal LLM calls (compaction summarizer, goal verifier, memory distiller), blocking user turns on compaction boundaries.
|
|
268
269
|
- **[0.8.8]** (2026-07-08) — "실동작검증을 통해서 유효성 평가하고 개선해줘" — live-verified the v0.8.5 fallback mechanism using active Claude Code OAuth credentials on this machine (confirmed 200 OK for both Fable 5 and Opus 4.8 via the proxy). Identified two critical improvement vectors during verification: (1) server-side fallback was previously scoped strictly to API-key credentials, leaving OAuth users (who also hit `reasoning_extraction` refusals) with today's reactive-only recovery; (2) the sequential `postAnthropic` retry ladder could throw immediately on a combination of different error types (e.g. temperature error first, then fallback error, then success).
|
|
269
|
-
- **[0.8.7]** (2026-07-08) — Fix-forward for a CI-caught release failure in v0.8.6 (this same session): `test/launch-prompt-routing.test.ts` shipped with a dropped closing brace (a git 3-way merge misaligned on a duplicate `});` line during this session's own working-tree isolation, then a subsequent `git stash push --keep-index` silently reset the working tree to the pre-fix staged content — the fix was applied once, verified once, then invisibly reverted before the commit that actually shipped). The v0.8.6 GitHub Actions release workflow correctly caught the syntax error at `bun test` and failed BEFORE the npm publish step ran; `npm view jeo-code version` confirmed 0.8.5 remained latest throughout — nothing broken ever reached the registry. Per this repo's established pattern for a same-day CI-caught regression (v0.8.0 → v0.8.1), shipping forward rather than retargeting the already-publicly-failed v0.8.6 tag.
|
|
270
270
|
|
|
271
271
|
See [CHANGELOG.md](CHANGELOG.md) for the full history.
|
|
272
272
|
<!-- CHANGELOG:END -->
|
package/package.json
CHANGED
package/src/agent/memory.ts
CHANGED
|
@@ -229,11 +229,53 @@ interface ParsedConceptEntry { sig: string; concept: Concept | null }
|
|
|
229
229
|
const parsedConceptCache = new Map<string, ParsedConceptEntry>();
|
|
230
230
|
const PARSED_CONCEPT_CACHE_CAP = 512;
|
|
231
231
|
|
|
232
|
+
/** Single-slot cache for `buildCorpusStats`/`buildConceptGraph` over the LAST
|
|
233
|
+
* `concepts` array seen, keyed by reference identity. `memoryPromptSection` runs
|
|
234
|
+
* `selectWithinBudget` once per interactive turn (`refreshSessionMemory`) and once
|
|
235
|
+
* per subagent spawn (team/ralph/autopilot) — each call re-tokenized every concept's
|
|
236
|
+
* searchable text and re-scanned every body for cross-links, even when NOTHING in the
|
|
237
|
+
* bundle changed between calls. `loadConcepts` already returns the same cached `Concept`
|
|
238
|
+
* OBJECTS when a file's mtime/size is unchanged (see `parsedConceptCache` above), so an
|
|
239
|
+
* identical (same length + same object references) `concepts` array is the common case
|
|
240
|
+
* across consecutive calls in one session — this hits that case with a cheap O(n)
|
|
241
|
+
* reference-equality scan instead of paying the O(n · text length) rebuild. A genuinely
|
|
242
|
+
* changed bundle (new/edited/deleted concept) always produces a different array — either
|
|
243
|
+
* a different length or at least one different object reference — so correctness never
|
|
244
|
+
* depends on this cache; it only skips work that would reach the same answer. */
|
|
245
|
+
let statsGraphCacheConcepts: Concept[] | null = null;
|
|
246
|
+
let statsGraphCacheStats: CorpusStats | null = null;
|
|
247
|
+
let statsGraphCacheGraph: ConceptGraph | null = null;
|
|
248
|
+
|
|
249
|
+
function sameConceptsArray(a: Concept[], b: Concept[]): boolean {
|
|
250
|
+
if (a.length !== b.length) return false;
|
|
251
|
+
for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;
|
|
252
|
+
return true;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/** Corpus stats + link graph for `concepts`, memoized against the last call (see above). */
|
|
256
|
+
function statsAndGraphFor(concepts: Concept[]): { stats: CorpusStats; graph: ConceptGraph } {
|
|
257
|
+
if (
|
|
258
|
+
statsGraphCacheConcepts && statsGraphCacheStats && statsGraphCacheGraph &&
|
|
259
|
+
sameConceptsArray(statsGraphCacheConcepts, concepts)
|
|
260
|
+
) {
|
|
261
|
+
return { stats: statsGraphCacheStats, graph: statsGraphCacheGraph };
|
|
262
|
+
}
|
|
263
|
+
const stats = buildCorpusStats(concepts);
|
|
264
|
+
const graph = buildConceptGraph(concepts);
|
|
265
|
+
statsGraphCacheConcepts = concepts;
|
|
266
|
+
statsGraphCacheStats = stats;
|
|
267
|
+
statsGraphCacheGraph = graph;
|
|
268
|
+
return { stats, graph };
|
|
269
|
+
}
|
|
270
|
+
|
|
232
271
|
/** Drop the per-file concept parse cache so the next loadConcepts re-reads disk.
|
|
233
272
|
* The cache is already mtime/size self-invalidating; this is a hard reset for
|
|
234
273
|
* tests and callers that mutate files without changing their stat signature. */
|
|
235
274
|
export function invalidateConceptCache(): void {
|
|
236
275
|
parsedConceptCache.clear();
|
|
276
|
+
statsGraphCacheConcepts = null;
|
|
277
|
+
statsGraphCacheStats = null;
|
|
278
|
+
statsGraphCacheGraph = null;
|
|
237
279
|
}
|
|
238
280
|
|
|
239
281
|
/** Read every concept document in the bundle into structured `Concept`s. Reserved
|
|
@@ -572,8 +614,7 @@ function selectWithinBudget(concepts: Concept[], query: string | undefined, budg
|
|
|
572
614
|
const sectionLenByType = new Map<string, number>(); // type -> rendered length of that type's section so far
|
|
573
615
|
let total = 0; // rendered length of `selected` under renderConcepts
|
|
574
616
|
|
|
575
|
-
const stats =
|
|
576
|
-
const graph = buildConceptGraph(concepts);
|
|
617
|
+
const { stats, graph } = statsAndGraphFor(concepts);
|
|
577
618
|
|
|
578
619
|
const take = (pool: Concept[]) => {
|
|
579
620
|
for (const c of priorityOrder(pool, query, stats, graph)) {
|
package/src/agent/tool-output.ts
CHANGED
|
@@ -60,15 +60,18 @@ export const TOOL_SPILL_THRESHOLD = TOOL_OUTPUT_MAX;
|
|
|
60
60
|
/** Most recent tool-result artifacts to keep; older ones are pruned on each spill. */
|
|
61
61
|
export const MAX_TOOL_ARTIFACTS = 50;
|
|
62
62
|
|
|
63
|
-
/** Best-effort retention: keep the newest `MAX_TOOL_ARTIFACTS` files in `dir`, delete the
|
|
63
|
+
/** Best-effort retention: keep the newest `MAX_TOOL_ARTIFACTS` files in `dir`, delete the
|
|
64
|
+
* rest. Filenames are always `${Date.now()}-${rand}-${tool}.txt` (spillToolResult is the
|
|
65
|
+
* sole writer into this directory) — the leading 13-digit millisecond timestamp is fixed-
|
|
66
|
+
* width until year 2286, so a plain lexicographic sort of the FILENAMES reproduces mtime
|
|
67
|
+
* order exactly. This replaces an `fs.stat` per file (up to MAX_TOOL_ARTIFACTS syscalls,
|
|
68
|
+
* paid on every spill once a long session's artifact dir sits at/near the cap) with a pure
|
|
69
|
+
* in-memory string sort — zero syscalls beyond the single `readdir` every call already paid. */
|
|
64
70
|
async function pruneToolArtifacts(dir: string): Promise<void> {
|
|
65
71
|
const files = await fs.readdir(dir).catch(() => [] as string[]);
|
|
66
72
|
if (files.length <= MAX_TOOL_ARTIFACTS) return;
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
);
|
|
70
|
-
stamped.sort((a, b) => b.m - a.m); // newest first
|
|
71
|
-
for (const { f } of stamped.slice(MAX_TOOL_ARTIFACTS)) {
|
|
73
|
+
const newestFirst = [...files].sort((a, b) => (a < b ? 1 : a > b ? -1 : 0));
|
|
74
|
+
for (const f of newestFirst.slice(MAX_TOOL_ARTIFACTS)) {
|
|
72
75
|
await fs.rm(path.join(dir, f), { force: true }).catch(() => {});
|
|
73
76
|
}
|
|
74
77
|
}
|
package/src/ai/model-catalog.ts
CHANGED
|
@@ -101,6 +101,7 @@ export const MODEL_CATALOG: readonly CatalogModel[] = [
|
|
|
101
101
|
// OpenAI (newest first: gpt-5.5 > gpt-5.4 > o4-mini/o3/gpt-4.1 > o3-mini > gpt-4o-mini > gpt-4o)
|
|
102
102
|
{ canonical: "gpt-5.5", provider: "openai", providerModel: "gpt-5.5", contextTokens: 400_000, maxOutputTokens: 128_000, thinking: FULL, images: true, releaseDate: "2026-04" },
|
|
103
103
|
{ canonical: "gpt-5.4", provider: "openai", providerModel: "gpt-5.4", contextTokens: 400_000, maxOutputTokens: 128_000, thinking: FULL, images: true, releaseDate: "2026-03" },
|
|
104
|
+
{ canonical: "gpt-5.4-mini", provider: "openai", providerModel: "gpt-5.4-mini", contextTokens: 272_000, maxOutputTokens: 128_000, thinking: FULL, images: true, releaseDate: "2026-03" },
|
|
104
105
|
{ canonical: "o4-mini", provider: "openai", providerModel: "o4-mini", contextTokens: 200_000, maxOutputTokens: 100_000, thinking: STD, images: true, releaseDate: "2025-04" },
|
|
105
106
|
{ canonical: "o3", provider: "openai", providerModel: "o3", contextTokens: 200_000, maxOutputTokens: 100_000, thinking: STD, images: true, releaseDate: "2025-04" },
|
|
106
107
|
{ canonical: "gpt-4.1", provider: "openai", providerModel: "gpt-4.1", contextTokens: 1_000_000, maxOutputTokens: 32_768, thinking: [], images: true, releaseDate: "2025-04" },
|
|
@@ -182,7 +183,44 @@ export const MODEL_CATALOG: readonly CatalogModel[] = [
|
|
|
182
183
|
* usable list endpoint, so an OAuth-only OpenAI login surfaces exactly these instead
|
|
183
184
|
* of the full chat-completions catalog. Verified live against a ChatGPT account.
|
|
184
185
|
*/
|
|
185
|
-
export const CODEX_MODELS: readonly string[] = ["gpt-5.5", "gpt-5.4"];
|
|
186
|
+
export const CODEX_MODELS: readonly string[] = ["gpt-5.5", "gpt-5.4", "gpt-5.4-mini"];
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Session-lifetime cache of OpenAI Codex model ids OBSERVED live from the account's
|
|
190
|
+
* own `codex/models` response (see `listProviderModels` in model-discovery.ts, which
|
|
191
|
+
* calls `recordLiveCodexModels` on every successful OAuth discovery). `CODEX_MODELS`
|
|
192
|
+
* above is a maintained snapshot that WILL drift the moment OpenAI ships a new Codex
|
|
193
|
+
* model — that drift is exactly the bug class this closes: the picker shows a model
|
|
194
|
+
* (from the SAME live endpoint) that the static gate then hard-rejects at call time
|
|
195
|
+
* ("OAuth doesn't support this model") even though the account can serve it. Any
|
|
196
|
+
* successful discovery this session widens the gate immediately, no release needed;
|
|
197
|
+
* a fresh process starts empty and falls back to the static list until the first
|
|
198
|
+
* discovery call (picker open, `jeo doctor`, or model resolution) populates it.
|
|
199
|
+
*/
|
|
200
|
+
const liveCodexModels = new Set<string>();
|
|
201
|
+
|
|
202
|
+
/** Record model ids OpenAI's live Codex endpoint returned for the current account
|
|
203
|
+
* this session. Additive only — never removes a previously-observed id (a transient
|
|
204
|
+
* discovery hiccup should never narrow what a call is allowed to reach). */
|
|
205
|
+
export function recordLiveCodexModels(ids: readonly string[]): void {
|
|
206
|
+
for (const id of ids) liveCodexModels.add(id);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/** True when `model` is a Codex-servable id — either in the maintained static list,
|
|
210
|
+
* or observed live this session (see `recordLiveCodexModels`). Accepts a bare or
|
|
211
|
+
* `openai/`-qualified id. */
|
|
212
|
+
export function isCodexModel(model: string): boolean {
|
|
213
|
+
const wire = model.startsWith("openai/") ? model.slice(7) : model;
|
|
214
|
+
return CODEX_MODELS.includes(wire) || liveCodexModels.has(wire);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** Test-only: clear the live-observed Codex model cache (mirrors `resetPromptRouterWarnings`
|
|
218
|
+
* / `resetAppearanceCache`). Bun runs test files in one process, so this module-level Set
|
|
219
|
+
* would otherwise leak an `oauth`-source `listProviderModels("openai", …)` call's observed
|
|
220
|
+
* ids into unrelated tests in the same run. */
|
|
221
|
+
export function resetLiveCodexModels(): void {
|
|
222
|
+
liveCodexModels.clear();
|
|
223
|
+
}
|
|
186
224
|
|
|
187
225
|
/**
|
|
188
226
|
* Model ids the Kimi Code OAuth backend (api.kimi.com/coding, Anthropic Messages
|
|
@@ -11,7 +11,7 @@ import { readGlobalConfig, type Config } from "../agent/state";
|
|
|
11
11
|
import { resolveCredential, type AuthProvider, type Credential } from "../auth";
|
|
12
12
|
import type { ProviderName } from "./types";
|
|
13
13
|
import { PROVIDER_NAMES } from "./provider-status";
|
|
14
|
-
import { catalogByProvider, CODEX_MODELS, KIMI_CODE_MODELS } from "./model-catalog";
|
|
14
|
+
import { catalogByProvider, CODEX_MODELS, KIMI_CODE_MODELS, recordLiveCodexModels } from "./model-catalog";
|
|
15
15
|
import { extractChatgptAccountId } from "./providers/openai-responses";
|
|
16
16
|
import { openaiCompatDef } from "./providers/openai-compatible-catalog";
|
|
17
17
|
|
|
@@ -405,6 +405,10 @@ export async function listProviderModels(
|
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
407
|
const models = [...new Set(ids)].sort().slice(0, limit);
|
|
408
|
+
// Widen the self-healing Codex gate (model-catalog.ts) the moment the account's
|
|
409
|
+
// OWN live endpoint confirms a model — closes the "picker shows it, call-time
|
|
410
|
+
// gate rejects it" drift window without waiting for a jeo release.
|
|
411
|
+
if (provider === "openai" && source === "oauth") recordLiveCodexModels(models);
|
|
408
412
|
return { provider, models, ok: true, source };
|
|
409
413
|
} catch (err) {
|
|
410
414
|
const msg = (err as Error)?.name === "TimeoutError" || (err as Error)?.name === "AbortError" ? "timeout" : "unreachable";
|
package/src/ai/model-manager.ts
CHANGED
|
@@ -6,7 +6,7 @@ import "./register-providers"; // side-effect: registers built-in adapters into
|
|
|
6
6
|
import type { CallOptions, Message, ProviderAdapter, ProviderName } from "./types";
|
|
7
7
|
import { expandAlias, resolveModelId, effectiveAliasesFor, BUILTIN_ALIASES } from "./model-registry";
|
|
8
8
|
import { findCatalogEntry, type ModelCatalogEntry } from "./model-catalog-compat";
|
|
9
|
-
import { toProviderModel, CODEX_MODELS, KIMI_CODE_MODELS, findCatalogModel } from "./model-catalog";
|
|
9
|
+
import { toProviderModel, CODEX_MODELS, KIMI_CODE_MODELS, findCatalogModel, isCodexModel } from "./model-catalog";
|
|
10
10
|
import { xaiCredential } from "./providers/xai";
|
|
11
11
|
import { OPENAI_COMPAT_NAMES, isOpenAICompatProvider } from "./providers/openai-compatible-catalog";
|
|
12
12
|
import { withRetry, defaultRetryable, withConnectionContext, isConnectionError, ConnectionContextError, type RetryOptions } from "../util/retry";
|
|
@@ -307,10 +307,11 @@ export function resolveRetryOptions(retry: Config["retry"], kind: "request" | "s
|
|
|
307
307
|
*/
|
|
308
308
|
function oauthServesModel(provider: AuthProvider, model: string): boolean {
|
|
309
309
|
if (provider === "openai") {
|
|
310
|
-
//
|
|
311
|
-
//
|
|
312
|
-
|
|
313
|
-
|
|
310
|
+
// `isCodexModel` checks the maintained CODEX_MODELS list PLUS any id observed
|
|
311
|
+
// live this session (model-catalog.ts) — closes the "picker shows a model the
|
|
312
|
+
// account's own endpoint just confirmed, call-time gate rejects it anyway" drift
|
|
313
|
+
// window that opens every time OpenAI ships a new Codex model between releases.
|
|
314
|
+
return isCodexModel(model);
|
|
314
315
|
}
|
|
315
316
|
if (provider === "kimi") {
|
|
316
317
|
const wire = model.startsWith("kimi/") ? model.slice(5) : model;
|
|
@@ -487,7 +488,7 @@ export async function resolveCall(options: Partial<CallOptions>, kind: "request"
|
|
|
487
488
|
const isLocalOpenAi = provider === "openai" && !!baseUrl;
|
|
488
489
|
if (provider === "openai" && effective.kind === "oauth" && !isLocalOpenAi && !oauthServesModel("openai", model)) {
|
|
489
490
|
throw new Error(
|
|
490
|
-
|
|
491
|
+
`OpenAI OAuth 자격증명은 Codex 모델(${CODEX_MODELS.join("/")})만 지원. OPENAI_API_KEY를 설정하거나 모델을 변경하세요`
|
|
491
492
|
);
|
|
492
493
|
}
|
|
493
494
|
if (provider === "kimi" && effective.kind === "oauth" && !oauthServesModel("kimi", model)) {
|
|
@@ -2,10 +2,10 @@ import { randomUUID } from "node:crypto";
|
|
|
2
2
|
import type { Credential } from "../../auth";
|
|
3
3
|
import type { CallOptions, Message, ProviderAdapter } from "../types";
|
|
4
4
|
import { readSse } from "../sse";
|
|
5
|
-
import { providerHttpError } from "./errors";
|
|
5
|
+
import { providerHttpError, ProviderStreamError } from "./errors";
|
|
6
6
|
import { serializeToolCalls } from "../../agent/tool-schemas";
|
|
7
7
|
import { sanitizeJsonStrings } from "../../util/sanitize-json";
|
|
8
|
-
import { geminiThinkingConfig,
|
|
8
|
+
import { geminiThinkingConfig, type GeminiThinkingConfig } from "./gemini";
|
|
9
9
|
|
|
10
10
|
const ANTIGRAVITY_DAILY_ENDPOINT = "https://daily-cloudcode-pa.googleapis.com";
|
|
11
11
|
const ANTIGRAVITY_SANDBOX_ENDPOINT = "https://daily-cloudcode-pa.sandbox.googleapis.com";
|
|
@@ -95,11 +95,31 @@ export async function resolveAntigravityProjectId(
|
|
|
95
95
|
|
|
96
96
|
const discover = opts.discover ?? (async (token: string) => {
|
|
97
97
|
const { discoverGoogleProjectId, ANTIGRAVITY_DISCOVERY_METADATA } = await import("../../auth/flows/google-project");
|
|
98
|
-
//
|
|
99
|
-
//
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
98
|
+
// This function's SOLE callers are fetchAntigravity/ccaTurn — every discovery
|
|
99
|
+
// it performs exists to serve an Antigravity/Cloud-Code-Assist turn, so it must
|
|
100
|
+
// ALWAYS identify itself to Google as Antigravity (metadata + User-Agent),
|
|
101
|
+
// regardless of which OAuth STORAGE SLOT the token came from (a dedicated
|
|
102
|
+
// antigravity login vs a plain gemini-cli token used as fallback — the common
|
|
103
|
+
// case for users who only ran `jeo auth login gemini`, the documented default).
|
|
104
|
+
// Previously this branched on `credential.provider === "antigravity"` and sent
|
|
105
|
+
// gemini-cli identity (User-Agent `GeminiCLI/…`, metadata `pluginType: GEMINI`)
|
|
106
|
+
// for the fallback case. Root-caused live: Google's `loadCodeAssist` now REJECTS
|
|
107
|
+
// that identity for gemini-cli-individual accounts it has migrated to Antigravity
|
|
108
|
+
// (`ineligibleTiers[].reasonCode: "UNSUPPORTED_CLIENT"`, message "please migrate
|
|
109
|
+
// to the Antigravity suite of products") — the response omits `currentTier`/
|
|
110
|
+
// `cloudaicompanionProject` entirely, so discovery falls through into onboarding,
|
|
111
|
+
// which then fails after 5 polls with "did not return a provisioned project id"
|
|
112
|
+
// even though the SAME account resolves its EXISTING project instantly (0 polls)
|
|
113
|
+
// once the request honestly identifies as Antigravity. This was the actual
|
|
114
|
+
// observed "stops/hangs on Antigravity Gemini" symptom for any account without a
|
|
115
|
+
// dedicated antigravity OAuth login: a deterministic, fast-failing (not literally
|
|
116
|
+
// infinite) but 100%-reproducible discovery break, not a timeout/network hang.
|
|
117
|
+
return discoverGoogleProjectId(token, {
|
|
118
|
+
metadata: { ...ANTIGRAVITY_DISCOVERY_METADATA },
|
|
119
|
+
extraHeaders: { "User-Agent": getAntigravityUserAgent() },
|
|
120
|
+
alwaysOnboard: true,
|
|
121
|
+
signal: opts.signal,
|
|
122
|
+
});
|
|
103
123
|
});
|
|
104
124
|
let projectId: string;
|
|
105
125
|
try {
|
|
@@ -232,6 +252,17 @@ interface CcaChunk {
|
|
|
232
252
|
candidates?: { content?: { parts?: { text?: string; thought?: boolean; functionCall?: { name?: string; args?: Record<string, unknown> } }[] }; finishReason?: string }[];
|
|
233
253
|
usageMetadata?: CcaUsage;
|
|
234
254
|
};
|
|
255
|
+
/** A `google.rpc.Status`-shaped in-band error line, sibling of `response` — see
|
|
256
|
+
* `gemini.ts`'s identical field for the full rationale (silently swallowed here
|
|
257
|
+
* before this fix, which for a turn that had already streamed some text meant an
|
|
258
|
+
* early, error-free, TRUNCATED stop: "안티그라비티 모델이 중간에 멈추는" report). */
|
|
259
|
+
error?: { code?: number; message?: string; status?: string };
|
|
260
|
+
}
|
|
261
|
+
/** Throw a {@link ProviderStreamError} for an in-band error line — no-op when absent. */
|
|
262
|
+
function throwIfGoogleStreamError(chunk: CcaChunk): void {
|
|
263
|
+
const err = chunk.error;
|
|
264
|
+
if (!err) return;
|
|
265
|
+
throw new ProviderStreamError("Antigravity", err.message ?? "unknown error", err.status, err.code);
|
|
235
266
|
}
|
|
236
267
|
/** When Antigravity (Cloud Code Assist) returns HTTP 200 with no text, surface the
|
|
237
268
|
* real cause (safety block / RECITATION / etc.) instead of a silent, reason-free
|
|
@@ -293,6 +324,7 @@ export const antigravityAdapter: ProviderAdapter = {
|
|
|
293
324
|
for await (const data of readSse(response.body)) {
|
|
294
325
|
let chunk: CcaChunk;
|
|
295
326
|
try { chunk = JSON.parse(data); } catch { continue; }
|
|
327
|
+
throwIfGoogleStreamError(chunk);
|
|
296
328
|
const thought = thoughtOf(chunk);
|
|
297
329
|
if (thought) options.onReasoning?.(thought);
|
|
298
330
|
const delta = textOf(chunk);
|
|
@@ -321,6 +353,7 @@ export const antigravityAdapter: ProviderAdapter = {
|
|
|
321
353
|
for await (const data of readSse(response.body, options.onStreamActivity)) {
|
|
322
354
|
let chunk: CcaChunk;
|
|
323
355
|
try { chunk = JSON.parse(data); } catch { continue; }
|
|
356
|
+
throwIfGoogleStreamError(chunk);
|
|
324
357
|
const thought = thoughtOf(chunk);
|
|
325
358
|
if (thought) options.onReasoning?.(thought);
|
|
326
359
|
const delta = textOf(chunk);
|
|
@@ -39,10 +39,14 @@ export class ProviderStreamError extends Error {
|
|
|
39
39
|
readonly status: number;
|
|
40
40
|
readonly provider: string;
|
|
41
41
|
readonly code?: string;
|
|
42
|
-
|
|
42
|
+
/** `explicitStatus` lets a caller pass an ALREADY-numeric provider status (e.g. Google's
|
|
43
|
+
* `error.code` on a `google.rpc.Status` envelope — 429/500/503) instead of relying on the
|
|
44
|
+
* OpenAI-specific `code === "rate_limit_exceeded"` string heuristic below, which only
|
|
45
|
+
* recognizes that one literal and defaults everything else to 500. */
|
|
46
|
+
constructor(provider: string, message: string, code?: string, explicitStatus?: number) {
|
|
43
47
|
super(`${provider} stream failed${code ? ` (${code})` : ""}: ${message}`);
|
|
44
48
|
this.name = "ProviderStreamError";
|
|
45
|
-
this.status = code === "rate_limit_exceeded" ? 429 : 500;
|
|
49
|
+
this.status = explicitStatus ?? (code === "rate_limit_exceeded" ? 429 : 500);
|
|
46
50
|
this.provider = provider;
|
|
47
51
|
this.code = code;
|
|
48
52
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Credential } from "../../auth";
|
|
2
2
|
import type { CallOptions, Message, ProviderAdapter } from "../types";
|
|
3
3
|
import { readSse } from "../sse";
|
|
4
|
-
import { providerHttpError, fetchWithArtifactFailSafe } from "./errors";
|
|
4
|
+
import { providerHttpError, fetchWithArtifactFailSafe, ProviderStreamError } from "./errors";
|
|
5
5
|
import { jeoEnv } from "../../util/env";
|
|
6
6
|
import { serializeToolCalls } from "../../agent/tool-schemas";
|
|
7
7
|
import { sanitizeJsonStrings } from "../../util/sanitize-json";
|
|
@@ -258,11 +258,22 @@ interface GeminiChunk {
|
|
|
258
258
|
candidates?: { content?: { parts?: { text?: string; thought?: boolean; thoughtSignature?: string; functionCall?: { name?: string; args?: Record<string, unknown> } }[] }; finishReason?: string }[];
|
|
259
259
|
promptFeedback?: { blockReason?: string };
|
|
260
260
|
usageMetadata?: { promptTokenCount?: number; candidatesTokenCount?: number; thoughtsTokenCount?: number };
|
|
261
|
+
/** A `google.rpc.Status`-shaped in-band error line: Google's streaming endpoints can emit
|
|
262
|
+
* this as its own SSE `data:` event on an otherwise-live 200 connection (the codebase
|
|
263
|
+
* already knows this envelope shape from `parseRetryFromBody`'s `"retryDelay"` parsing on
|
|
264
|
+
* the equivalent non-stream error body) instead of terminating the HTTP response with a
|
|
265
|
+
* non-2xx status. Previously silently ignored — neither `candidates` nor `promptFeedback`
|
|
266
|
+
* matches it, so it fell through every existing check with no error and no text, which for
|
|
267
|
+
* a turn that had already streamed SOME text meant the turn just ended early with a
|
|
268
|
+
* truncated reply and no error at all: the "모델이 중간에 멈추는" (model stops mid-way) report. */
|
|
269
|
+
error?: { code?: number; message?: string; status?: string };
|
|
261
270
|
}
|
|
262
271
|
|
|
263
|
-
/** Cloud Code Assist wraps each standard chunk under `response
|
|
272
|
+
/** Cloud Code Assist wraps each standard chunk under `response`; an in-band error (see
|
|
273
|
+
* `GeminiChunk.error`) arrives as a SIBLING of `response`, not nested inside it. */
|
|
264
274
|
interface CcaChunk {
|
|
265
275
|
response?: GeminiChunk;
|
|
276
|
+
error?: { code?: number; message?: string; status?: string };
|
|
266
277
|
}
|
|
267
278
|
|
|
268
279
|
function textOf(chunk: GeminiChunk): string {
|
|
@@ -317,6 +328,20 @@ function blockedReason(chunk: GeminiChunk): string | undefined {
|
|
|
317
328
|
return undefined;
|
|
318
329
|
}
|
|
319
330
|
|
|
331
|
+
/** Throw a {@link ProviderStreamError} for an in-band `google.rpc.Status` error line (see
|
|
332
|
+
* `GeminiChunk.error`/`CcaChunk.error`) — a no-op when the chunk carries none. Mirrors the
|
|
333
|
+
* OpenAI Responses `response.failed`/`error` fix: `error.status` (a string enum, e.g.
|
|
334
|
+
* `"RESOURCE_EXHAUSTED"`/`"UNAVAILABLE"`/`"INTERNAL"`) plays the same "classifier" role our
|
|
335
|
+
* `code` param plays for OpenAI, and `error.code` (Google's own numeric HTTP-equivalent) is
|
|
336
|
+
* passed straight through as the explicit status instead of re-derived from a string match. */
|
|
337
|
+
function throwIfGoogleStreamError(
|
|
338
|
+
provider: string,
|
|
339
|
+
err: { code?: number; message?: string; status?: string } | undefined,
|
|
340
|
+
): void {
|
|
341
|
+
if (!err) return;
|
|
342
|
+
throw new ProviderStreamError(provider, err.message ?? "unknown error", err.status, err.code);
|
|
343
|
+
}
|
|
344
|
+
|
|
320
345
|
/**
|
|
321
346
|
* Cloud Code Assist SSE turn for a Google OAuth credential: resolves the
|
|
322
347
|
* projectId (stored → env → lazy loadCodeAssist/onboardUser discovery), POSTs
|
|
@@ -343,6 +368,7 @@ async function* ccaTurn(messages: Message[], options: CallOptions, credential: C
|
|
|
343
368
|
} catch {
|
|
344
369
|
continue;
|
|
345
370
|
}
|
|
371
|
+
throwIfGoogleStreamError("Gemini (Cloud Code Assist)", chunk.error);
|
|
346
372
|
const inner = chunk.response;
|
|
347
373
|
if (!inner) continue;
|
|
348
374
|
const thought = thoughtOf(inner);
|
|
@@ -419,6 +445,7 @@ export const geminiAdapter: ProviderAdapter = {
|
|
|
419
445
|
} catch {
|
|
420
446
|
continue;
|
|
421
447
|
}
|
|
448
|
+
throwIfGoogleStreamError("Gemini", chunk.error);
|
|
422
449
|
const thought = thoughtOf(chunk);
|
|
423
450
|
if (thought) options.onReasoning?.(thought);
|
|
424
451
|
captureGeminiSignatures(chunk, options, seenSigs);
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
resolveSelection,
|
|
22
22
|
catalogMetadata,
|
|
23
23
|
CODEX_MODELS,
|
|
24
|
+
isCodexModel,
|
|
24
25
|
qualifyModelId,
|
|
25
26
|
} from "../../ai";
|
|
26
27
|
import type { ProviderModelsResult, PickEntry, ProviderName, ThinkLevel } from "../../ai";
|
|
@@ -287,7 +288,10 @@ export async function runModelSlash(input: string, ctx: ModelSlashCtx): Promise<
|
|
|
287
288
|
if (st && !st.ready) console.log(` ! ${provider} is not ready (${st.label}) — set ${st.envVar ?? "the provider key"} or run 'jeo setup'.`);
|
|
288
289
|
// ChatGPT OAuth only serves the Codex models; warn before the turn fails if the user
|
|
289
290
|
// pins a non-Codex id with no local base URL to fall back to (gjc-parity readiness guard).
|
|
290
|
-
|
|
291
|
+
// `isCodexModel` also accepts any id this session's OWN live discovery already
|
|
292
|
+
// confirmed (see model-catalog.ts) — a static-list-only check here would falsely
|
|
293
|
+
// warn about a model /model's own live picker just showed as valid.
|
|
294
|
+
if (arg && provider === "openai" && st?.kind === "oauth" && !isCodexModel(resolved)) {
|
|
291
295
|
const hasLocalBase = !!((await readGlobalConfig()).openaiBaseUrl || process.env.OPENAI_BASE_URL);
|
|
292
296
|
if (!hasLocalBase) {
|
|
293
297
|
console.log(` ! ChatGPT OAuth serves only Codex models (${CODEX_MODELS.join(", ")}); '${resolved}' will be rejected at runtime — pick one of those, or set OPENAI_API_KEY / OPENAI_BASE_URL.`);
|
package/src/skills/catalog.ts
CHANGED
|
@@ -188,6 +188,7 @@ export function skillsPromptSection(skills: SkillDoc[] = SKILLS): string {
|
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
import * as fs from "node:fs/promises";
|
|
191
|
+
import type { Dirent } from "node:fs";
|
|
191
192
|
import * as path from "node:path";
|
|
192
193
|
import * as os from "node:os";
|
|
193
194
|
|
|
@@ -411,6 +412,54 @@ function isSupportedExternalSkill(doc: SkillDoc): boolean {
|
|
|
411
412
|
return !RESERVED_SKILL_NAMES.has(nameLower);
|
|
412
413
|
}
|
|
413
414
|
|
|
415
|
+
/** Resolve ONE directory entry from {@link skillDirs} to its `SkillDoc`, or `null`
|
|
416
|
+
* when the entry is not a skill (dotfile, non-`.md` file, directory with no
|
|
417
|
+
* `SKILL.md`, unreadable/broken symlink). Pure I/O + parse — no shared-state
|
|
418
|
+
* writes — so callers can run many of these concurrently. */
|
|
419
|
+
async function resolveSkillEntry(dir: string, entry: Dirent): Promise<SkillDoc | null> {
|
|
420
|
+
if (entry.name.startsWith(".")) return null;
|
|
421
|
+
let isFile = entry.isFile();
|
|
422
|
+
let isDir = entry.isDirectory();
|
|
423
|
+
// Vercel `npx skills add` links agent dirs (.claude/skills/x) to its canonical
|
|
424
|
+
// store — a symlinked skill reports NEITHER isFile nor isDirectory on the
|
|
425
|
+
// Dirent, which silently dropped every linked skill. Follow the link.
|
|
426
|
+
if (entry.isSymbolicLink()) {
|
|
427
|
+
try {
|
|
428
|
+
const st = await fs.stat(path.join(dir, entry.name));
|
|
429
|
+
isFile = st.isFile();
|
|
430
|
+
isDir = st.isDirectory();
|
|
431
|
+
} catch { return null; /* broken symlink */ }
|
|
432
|
+
}
|
|
433
|
+
if (isFile && entry.name.endsWith(".md")) {
|
|
434
|
+
const nm = entry.name.slice(0, -3);
|
|
435
|
+
const filePath = path.join(dir, entry.name);
|
|
436
|
+
try {
|
|
437
|
+
const parsed = parseSkillMarkdown(nm, await fs.readFile(filePath, "utf-8"), { preferMetaName: true });
|
|
438
|
+
parsed.sourcePath = filePath;
|
|
439
|
+
return isSupportedExternalSkill(parsed) ? parsed : null;
|
|
440
|
+
} catch { return null; /* unreadable file */ }
|
|
441
|
+
}
|
|
442
|
+
if (isDir) {
|
|
443
|
+
const skillPath = path.join(dir, entry.name, "SKILL.md");
|
|
444
|
+
try {
|
|
445
|
+
const parsed = parseSkillMarkdown(entry.name, await fs.readFile(skillPath, "utf-8"), { preferMetaName: true });
|
|
446
|
+
parsed.sourcePath = skillPath;
|
|
447
|
+
return isSupportedExternalSkill(parsed) ? parsed : null;
|
|
448
|
+
} catch { return null; /* dir without SKILL.md, or unreadable */ }
|
|
449
|
+
}
|
|
450
|
+
return null;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/** Concurrency cap for {@link resolveSkillEntry} within one directory: high enough
|
|
454
|
+
* that a large skill directory (hundreds of entries — a real field case: `npx skills
|
|
455
|
+
* add`-style installs commonly accumulate 500+) resolves in one or two batches
|
|
456
|
+
* instead of paying per-file `fs` round-trip latency SEQUENTIALLY (534 entries at
|
|
457
|
+
* ~0.4ms/syscall was a measured ~220ms — a visible stall on every session start and
|
|
458
|
+
* every `/skill` listing), while staying well under the lowest realistic per-process
|
|
459
|
+
* file-descriptor ulimit (macOS defaults to 256) even with several directories'
|
|
460
|
+
* batches racing across the `skillDirs` loop below. */
|
|
461
|
+
const SKILL_ENTRY_LOAD_BATCH = 32;
|
|
462
|
+
|
|
414
463
|
/** Bundled skills merged with user skill docs from {@link skillDirs} (user overrides by name). */
|
|
415
464
|
export async function loadSkills(cwd: string = process.cwd()): Promise<SkillDoc[]> {
|
|
416
465
|
try {
|
|
@@ -424,39 +473,20 @@ export async function loadSkills(cwd: string = process.cwd()): Promise<SkillDoc[
|
|
|
424
473
|
}
|
|
425
474
|
} catch {}
|
|
426
475
|
const byName = new Map<string, SkillDoc>(SKILLS.map(s => [s.name.toLowerCase(), s]));
|
|
476
|
+
// Directories are walked in their documented lowest→highest precedence order
|
|
477
|
+
// (a later dir's skill overrides an earlier one with the same name) — that
|
|
478
|
+
// cross-directory override MUST stay sequential. Entries WITHIN one directory
|
|
479
|
+
// have no such contract (readdir order is not a precedence guarantee anyone
|
|
480
|
+
// depends on), so they resolve concurrently in bounded batches, then apply to
|
|
481
|
+
// `byName` in their original readdir order for a fully deterministic result.
|
|
427
482
|
for (const dir of skillDirs(cwd)) {
|
|
428
|
-
let entries:
|
|
483
|
+
let entries: Dirent[] = [];
|
|
429
484
|
try { entries = await fs.readdir(dir, { withFileTypes: true }); } catch { continue; }
|
|
430
|
-
for (
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
// store — a symlinked skill reports NEITHER isFile nor isDirectory on the
|
|
436
|
-
// Dirent, which silently dropped every linked skill. Follow the link.
|
|
437
|
-
if (entry.isSymbolicLink()) {
|
|
438
|
-
try {
|
|
439
|
-
const st = await fs.stat(path.join(dir, entry.name));
|
|
440
|
-
isFile = st.isFile();
|
|
441
|
-
isDir = st.isDirectory();
|
|
442
|
-
} catch { continue; /* broken symlink */ }
|
|
443
|
-
}
|
|
444
|
-
if (isFile && entry.name.endsWith(".md")) {
|
|
445
|
-
const nm = entry.name.slice(0, -3);
|
|
446
|
-
try {
|
|
447
|
-
const parsed = parseSkillMarkdown(nm, await fs.readFile(path.join(dir, entry.name), "utf-8"), { preferMetaName: true });
|
|
448
|
-
parsed.sourcePath = path.join(dir, entry.name);
|
|
449
|
-
if (isSupportedExternalSkill(parsed)) byName.set(parsed.name.toLowerCase(), parsed);
|
|
450
|
-
} catch { /* skip unreadable file */ }
|
|
451
|
-
continue;
|
|
452
|
-
}
|
|
453
|
-
if (isDir) {
|
|
454
|
-
const skillPath = path.join(dir, entry.name, "SKILL.md");
|
|
455
|
-
try {
|
|
456
|
-
const parsed = parseSkillMarkdown(entry.name, await fs.readFile(skillPath, "utf-8"), { preferMetaName: true });
|
|
457
|
-
parsed.sourcePath = skillPath;
|
|
458
|
-
if (isSupportedExternalSkill(parsed)) byName.set(parsed.name.toLowerCase(), parsed);
|
|
459
|
-
} catch { /* skip dirs without SKILL.md or unreadable files */ }
|
|
485
|
+
for (let i = 0; i < entries.length; i += SKILL_ENTRY_LOAD_BATCH) {
|
|
486
|
+
const batch = entries.slice(i, i + SKILL_ENTRY_LOAD_BATCH);
|
|
487
|
+
const resolved = await Promise.all(batch.map(entry => resolveSkillEntry(dir, entry)));
|
|
488
|
+
for (const parsed of resolved) {
|
|
489
|
+
if (parsed) byName.set(parsed.name.toLowerCase(), parsed);
|
|
460
490
|
}
|
|
461
491
|
}
|
|
462
492
|
}
|