@gajae-code/coding-agent 0.4.5 → 0.5.1
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 +62 -0
- package/dist/types/async/job-manager.d.ts +26 -0
- package/dist/types/cli/args.d.ts +1 -0
- package/dist/types/cli/list-models.d.ts +6 -0
- package/dist/types/commands/gc.d.ts +26 -0
- package/dist/types/commands/harness.d.ts +3 -0
- package/dist/types/config/file-lock-gc.d.ts +5 -0
- package/dist/types/config/file-lock.d.ts +7 -0
- package/dist/types/config/model-profile-activation.d.ts +11 -2
- package/dist/types/config/model-profiles.d.ts +7 -0
- package/dist/types/config/model-registry.d.ts +3 -0
- package/dist/types/config/model-resolver.d.ts +2 -0
- package/dist/types/config/models-config-schema.d.ts +30 -0
- package/dist/types/config/settings-schema.d.ts +4 -3
- package/dist/types/coordinator/contract.d.ts +1 -1
- package/dist/types/defaults/gjc/extensions/grok-build/index.d.ts +1 -0
- package/dist/types/defaults/gjc/extensions/grok-cli-vendor/src/index.d.ts +1 -0
- package/dist/types/defaults/gjc/extensions/grok-cli-vendor/src/models/catalog.d.ts +25 -0
- package/dist/types/defaults/gjc/extensions/grok-cli-vendor/src/payload/sanitize.d.ts +27 -0
- package/dist/types/defaults/gjc/extensions/grok-cli-vendor/src/provider/billing.d.ts +8 -0
- package/dist/types/defaults/gjc/extensions/grok-cli-vendor/src/provider/register.d.ts +5 -0
- package/dist/types/defaults/gjc/extensions/grok-cli-vendor/src/provider/stream.d.ts +10 -0
- package/dist/types/defaults/gjc/extensions/grok-cli-vendor/src/provider/usage.d.ts +2 -0
- package/dist/types/defaults/gjc/extensions/grok-cli-vendor/src/shared/base-url.d.ts +2 -0
- package/dist/types/defaults/gjc/extensions/grok-cli-vendor/src/shared/errors.d.ts +38 -0
- package/dist/types/defaults/gjc-grok-cli.d.ts +5 -0
- package/dist/types/extensibility/extensions/index.d.ts +1 -0
- package/dist/types/extensibility/extensions/prefix-command-bridge.d.ts +35 -0
- package/dist/types/gjc-runtime/deep-interview-recorder.d.ts +103 -0
- package/dist/types/gjc-runtime/deep-interview-runtime.d.ts +2 -0
- package/dist/types/gjc-runtime/deep-interview-state.d.ts +112 -0
- package/dist/types/gjc-runtime/gc-render.d.ts +6 -0
- package/dist/types/gjc-runtime/gc-runtime.d.ts +134 -0
- package/dist/types/gjc-runtime/ledger-event-renderer.d.ts +68 -0
- package/dist/types/gjc-runtime/team-gc.d.ts +7 -0
- package/dist/types/gjc-runtime/team-runtime.d.ts +5 -1
- package/dist/types/gjc-runtime/tmux-common.d.ts +14 -0
- package/dist/types/gjc-runtime/tmux-gc.d.ts +7 -0
- package/dist/types/gjc-runtime/tmux-sessions.d.ts +13 -0
- package/dist/types/harness-control-plane/gc-adapter.d.ts +3 -0
- package/dist/types/harness-control-plane/owner.d.ts +8 -1
- package/dist/types/harness-control-plane/receipt-spool.d.ts +19 -0
- package/dist/types/harness-control-plane/state-machine.d.ts +6 -1
- package/dist/types/harness-control-plane/storage.d.ts +20 -0
- package/dist/types/harness-control-plane/types.d.ts +4 -0
- package/dist/types/hindsight/mental-models.d.ts +5 -5
- package/dist/types/modes/components/hook-selector.d.ts +7 -1
- package/dist/types/modes/components/model-selector.d.ts +1 -12
- package/dist/types/modes/controllers/command-controller.d.ts +1 -0
- package/dist/types/modes/rpc/rpc-client.d.ts +2 -2
- package/dist/types/modes/rpc/rpc-mode.d.ts +16 -1
- package/dist/types/modes/rpc/rpc-types.d.ts +4 -1
- package/dist/types/modes/shared/agent-wire/deep-interview-gate.d.ts +13 -0
- package/dist/types/modes/shared/agent-wire/session-registry.d.ts +25 -0
- package/dist/types/modes/shared/agent-wire/unattended-action-policy.d.ts +2 -0
- package/dist/types/sdk.d.ts +5 -0
- package/dist/types/session/agent-session.d.ts +3 -1
- package/dist/types/session/blob-store.d.ts +59 -4
- package/dist/types/session/session-manager.d.ts +24 -6
- package/dist/types/session/streaming-output.d.ts +3 -2
- package/dist/types/session/tool-choice-queue.d.ts +6 -0
- package/dist/types/skill-state/workflow-hud.d.ts +14 -0
- package/dist/types/task/receipt.d.ts +1 -0
- package/dist/types/task/types.d.ts +7 -0
- package/dist/types/thinking-metadata.d.ts +16 -0
- package/dist/types/thinking.d.ts +3 -12
- package/dist/types/tools/ask.d.ts +15 -1
- package/dist/types/tools/index.d.ts +2 -0
- package/dist/types/tools/resolve.d.ts +0 -10
- package/dist/types/tools/subagent.d.ts +6 -0
- package/dist/types/utils/tool-choice.d.ts +14 -1
- package/package.json +7 -7
- package/src/async/job-manager.ts +52 -0
- package/src/cli/args.ts +3 -0
- package/src/cli/auth-broker-cli.ts +1 -0
- package/src/cli/list-models.ts +13 -1
- package/src/cli.ts +9 -4
- package/src/commands/gc.ts +22 -0
- package/src/commands/harness.ts +43 -5
- package/src/commands/launch.ts +2 -2
- package/src/commands/session.ts +3 -1
- package/src/config/file-lock-gc.ts +181 -0
- package/src/config/file-lock.ts +14 -0
- package/src/config/model-profile-activation.ts +15 -3
- package/src/config/model-profiles.ts +264 -56
- package/src/config/model-resolver.ts +9 -6
- package/src/config/models-config-schema.ts +1 -0
- package/src/config/settings-schema.ts +6 -3
- package/src/coordinator/contract.ts +1 -0
- package/src/coordinator-mcp/server.ts +513 -26
- package/src/cursor.ts +16 -2
- package/src/defaults/gjc/agent.models.grok-cli.yml +36 -0
- package/src/defaults/gjc/extensions/grok-build/index.ts +1 -0
- package/src/defaults/gjc/extensions/grok-build/package.json +7 -0
- package/src/defaults/gjc/extensions/grok-cli-vendor/biome.json +39 -0
- package/src/defaults/gjc/extensions/grok-cli-vendor/package.json +8 -0
- package/src/defaults/gjc/extensions/grok-cli-vendor/src/index.ts +1 -0
- package/src/defaults/gjc/extensions/grok-cli-vendor/src/models/catalog.ts +155 -0
- package/src/defaults/gjc/extensions/grok-cli-vendor/src/payload/sanitize.ts +361 -0
- package/src/defaults/gjc/extensions/grok-cli-vendor/src/provider/billing.ts +57 -0
- package/src/defaults/gjc/extensions/grok-cli-vendor/src/provider/register.ts +99 -0
- package/src/defaults/gjc/extensions/grok-cli-vendor/src/provider/stream.ts +50 -0
- package/src/defaults/gjc/extensions/grok-cli-vendor/src/provider/usage.ts +56 -0
- package/src/defaults/gjc/extensions/grok-cli-vendor/src/shared/base-url.ts +36 -0
- package/src/defaults/gjc/extensions/grok-cli-vendor/src/shared/errors.ts +44 -0
- package/src/defaults/gjc/skills/deep-interview/SKILL.md +131 -113
- package/src/defaults/gjc/skills/deep-interview/lateral-review-panel.md +49 -0
- package/src/defaults/gjc/skills/team/SKILL.md +3 -2
- package/src/defaults/gjc/skills/ultragoal/SKILL.md +8 -2
- package/src/defaults/gjc-defaults.ts +7 -0
- package/src/defaults/gjc-grok-cli.ts +22 -0
- package/src/export/html/index.ts +13 -9
- package/src/extensibility/extensions/index.ts +1 -0
- package/src/extensibility/extensions/prefix-command-bridge.ts +128 -0
- package/src/gjc-runtime/deep-interview-recorder.ts +417 -0
- package/src/gjc-runtime/deep-interview-runtime.ts +18 -26
- package/src/gjc-runtime/deep-interview-state.ts +324 -0
- package/src/gjc-runtime/gc-render.ts +70 -0
- package/src/gjc-runtime/gc-runtime.ts +403 -0
- package/src/gjc-runtime/ledger-event-renderer.ts +164 -0
- package/src/gjc-runtime/ralplan-runtime.ts +58 -7
- package/src/gjc-runtime/state-renderer.ts +12 -3
- package/src/gjc-runtime/state-runtime.ts +46 -29
- package/src/gjc-runtime/team-gc.ts +49 -0
- package/src/gjc-runtime/team-runtime.ts +211 -8
- package/src/gjc-runtime/tmux-common.ts +29 -0
- package/src/gjc-runtime/tmux-gc.ts +176 -0
- package/src/gjc-runtime/tmux-sessions.ts +68 -12
- package/src/gjc-runtime/ultragoal-runtime.ts +517 -41
- package/src/gjc-runtime/workflow-manifest.generated.json +27 -1
- package/src/gjc-runtime/workflow-manifest.ts +16 -1
- package/src/harness-control-plane/gc-adapter.ts +184 -0
- package/src/harness-control-plane/owner.ts +89 -27
- package/src/harness-control-plane/receipt-spool.ts +128 -0
- package/src/harness-control-plane/state-machine.ts +27 -6
- package/src/harness-control-plane/storage.ts +93 -0
- package/src/harness-control-plane/types.ts +4 -0
- package/src/hindsight/mental-models.ts +17 -16
- package/src/internal-urls/docs-index.generated.ts +14 -8
- package/src/main.ts +7 -2
- package/src/modes/components/assistant-message.ts +26 -14
- package/src/modes/components/diff.ts +97 -0
- package/src/modes/components/hook-selector.ts +19 -0
- package/src/modes/components/model-selector.ts +370 -181
- package/src/modes/components/status-line/segments.ts +1 -1
- package/src/modes/components/tool-execution.ts +30 -13
- package/src/modes/controllers/command-controller.ts +25 -6
- package/src/modes/controllers/extension-ui-controller.ts +3 -0
- package/src/modes/controllers/selector-controller.ts +34 -42
- package/src/modes/rpc/rpc-client.ts +3 -2
- package/src/modes/rpc/rpc-mode.ts +187 -39
- package/src/modes/rpc/rpc-types.ts +5 -2
- package/src/modes/shared/agent-wire/command-dispatch.ts +279 -257
- package/src/modes/shared/agent-wire/command-validation.ts +11 -0
- package/src/modes/shared/agent-wire/deep-interview-gate.ts +30 -1
- package/src/modes/shared/agent-wire/session-registry.ts +109 -0
- package/src/modes/shared/agent-wire/unattended-action-policy.ts +24 -0
- package/src/modes/shared/agent-wire/unattended-run-controller.ts +23 -3
- package/src/modes/shared/agent-wire/unattended-session.ts +16 -1
- package/src/sdk.ts +46 -5
- package/src/secrets/obfuscator.ts +102 -27
- package/src/session/agent-session.ts +179 -25
- package/src/session/blob-store.ts +148 -6
- package/src/session/session-manager.ts +311 -60
- package/src/session/streaming-output.ts +185 -122
- package/src/session/tool-choice-queue.ts +23 -0
- package/src/setup/hermes/templates/operator-instructions.v1.md +7 -1
- package/src/skill-state/workflow-hud.ts +106 -10
- package/src/slash-commands/builtin-registry.ts +3 -2
- package/src/task/executor.ts +78 -6
- package/src/task/receipt.ts +5 -0
- package/src/task/render.ts +21 -1
- package/src/task/types.ts +8 -0
- package/src/thinking-metadata.ts +51 -0
- package/src/thinking.ts +26 -46
- package/src/tools/ask.ts +56 -1
- package/src/tools/bash.ts +1 -1
- package/src/tools/index.ts +2 -0
- package/src/tools/job.ts +3 -2
- package/src/tools/monitor.ts +36 -1
- package/src/tools/resolve.ts +93 -18
- package/src/tools/subagent-render.ts +9 -0
- package/src/tools/subagent.ts +26 -2
- package/src/utils/edit-mode.ts +1 -1
- package/src/utils/tool-choice.ts +45 -16
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,67 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.5.1] - 2026-06-14
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- `gjc --mode rpc` registers each live session in a cross-process registry (`<agent-dir>/rpc-sessions/<id>.json`) on start and removes it on shutdown, so other processes can enumerate running RPC sessions. The Python `gjc_rpc` client exposes `list_sessions()` / `RpcClient.list_sessions()` returning typed `SessionHandle`s and reaps records whose owning process is gone (issue 10; foundation for reattach/issue 09).
|
|
10
|
+
- `gjc --mode rpc --listen <socket-path>` runs a persistent Unix-domain-socket RPC server: the `AgentSession` outlives client disconnects (no stdin-EOF teardown) and a client can disconnect and reconnect to the same live session over the socket. The session is registered with `transport: "socket"` and the socket path as its `endpoint`, so it is discoverable/attachable via the registry. The stdio path is unchanged (frame output routes through a swappable sink shared by both transports) (issue 09).
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Subagent/job status panels now freeze a job's elapsed timer the moment it stops running (`completed`/`failed`/`cancelled`/`paused`) instead of counting up against `Date.now()` forever. `AsyncJob` records an `endTime` on the first terminal/pause transition and a shared `jobElapsedMs` helper backs the `subagent` panel, the `job` tool, `/jobs`, and the command-controller job line, so a finished subagent stops at its real duration while siblings keep ticking.
|
|
15
|
+
- RPC control-plane hardening (from dogfooding `gjc --mode rpc`): `dispatchRpcCommand` now wraps the command switch so failures return a correlated response carrying the request `id` and the real command name, instead of dropping the id and mislabeling handler exceptions as `parse`; `set_thinking_level`/`set_steering_mode`/`set_follow_up_mode`/`set_interrupt_mode` validate their inputs and reject out-of-contract values instead of silently corrupting session state; `negotiate_unattended` rejects unknown scopes/action classes with `invalid_unattended_declaration` and merges the mandatory `prompt` scope plus its `command.prompt` action floor into the accepted grant (so prompt/`workflow_gate_response` are never locked out); and read-only/control RPC commands no longer consume the unattended `max_tool_calls` budget while wall-time enforcement is preserved. `docs/rpc.md`'s first `workflow_gate` example now matches the canonical `RpcWorkflowGate` shape.
|
|
16
|
+
- RPC mode no longer head-of-line-blocks control/cancellation commands behind a long-running command: the stdin loop now dispatches ordered commands through a serial chain (so causal order is preserved — e.g. `get_state` after `bash` still observes the bash result) without blocking the reader, and routes `abort`/`abort_bash`/`abort_retry` on an immediate fast lane so they reach in-flight work. `abort_bash` can now cancel a running `bash`, and a slow `compact`/`handoff`/`login` no longer freezes the whole control plane. Shutdown drains in-flight commands (bounded) so their responses are still emitted on stdin EOF.
|
|
17
|
+
- Counted active prompts and agent-initiated custom messages in pre-prompt context maintenance so background task notifications trigger compaction before they can overflow the next model request.
|
|
18
|
+
- Bounded monitor task-notification payloads to a compact tail window while preserving full background job output for job inspection.
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Expanded coordinator MCP coordination status into a canonical polling snapshot for sessions, session states, turns, questions, reports, and bounded event summaries, and documented that Hermes/coordinator consumption is polling/await rather than push subscription.
|
|
23
|
+
|
|
24
|
+
## [0.5.0] - 2026-06-13
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- Fixed forced `tool_choice` 400s ("tool_choice forces tool use is not compatible with this model") looping after `ast_edit` previews: named queue directives (resolve protocol, eager `todo_write` enforcement, subagent `yield` reminders) now enqueue only when the model supports exact named forcing; otherwise they degrade silently to the existing steer reminder without a forced `tool_choice`, and a runtime-discovered incapability drops the in-flight directive instead of requeueing it.
|
|
29
|
+
- `models.yml` compat blocks now accept the `toolChoiceSupport` enum (`none`/`auto`/`required`/`named`) alongside the legacy `supportsToolChoice`/`supportsForcedToolChoice` booleans, mirrored in the generated JSON schema.
|
|
30
|
+
### Added
|
|
31
|
+
|
|
32
|
+
- Made `/model` open to a preset-first landing view: provider-grouped presets with live auth checkmarks, highlight-to-expand tiers, a full clamped role→model preview before applying, and a session/default apply scope choice; typing still jumps straight to model search, "Browse all models" opens the classic tabbed selector, and temporary-only quick-switch bypasses the landing entirely.
|
|
33
|
+
- Rebuilt the builtin model profile catalog as 25 profiles: `codex-{eco,medium,pro}` on `gpt-5.5` effort spreads, a single `opencodego` preset, `claude-opus`, `{glm,kimi-coding-plan,mimo,grok,cursor,minimax}-{eco,medium,pro}` trios with thinking levels clamped to provider support, and `opus-codex`/`codex-opencodego` combos. Legacy profile names (including the `*-standard` family and retired Fable presets) were removed clean-break and now fail with the available-profile listing.
|
|
34
|
+
- Added a post-`/login` smart preset recommendation: when login succeeds and no profile is active, prompts "Apply <preset> now?" (session-only on confirm); when a profile is active, prints a one-line hint instead. The active profile is tracked in-memory on the session with rollback-safe activation.
|
|
35
|
+
- Bundled `kimi-code/kimi-k2.7-code` and `minimax-code/minimax-v3` model entries; MiniMax presets use the canonical `minimax-code` provider id throughout.
|
|
36
|
+
- Added a harness receipt JSONL spool exporter for gajae receipt-runtime interop: configured `gjc harness --receipt-spool-dir <dir>` / `GJC_RECEIPT_SPOOL_DIR` now appends persisted native `ReceiptEnvelope` records as `{cursor,envelope}` lines to `spool.jsonl`, with restart-safe 12-digit cursors and installed-package smoke coverage (#545).
|
|
37
|
+
- Added Gajae Trinity compatibility golden fixtures and tests that pin ReceiptEnvelope hash basis, validator compatibility, and replayable RPC exchange shape for downstream receipt-runtime interop.
|
|
38
|
+
- Optimization Suite v3 Lane 1 (RSS): large resident text in persisted sessions is now backed by an ephemeral session-scoped disk cache (`EphemeralBlobStore`) instead of being pinned in JS heap for the whole session lifetime; canonical JSONL persistence, reload, and export semantics are byte-identical (resident refs never persist). Missing resident text cache blobs now surface a typed `ResidentBlobMissingError` instead of silently leaking `blob:sha256:` refs into provider payloads, UI, or exports. `getEntries()`/`buildSessionContext()` are served from revision-keyed WeakRef caches below the public ownership boundary (callers still receive caller-owned copies). Fixture retained heap −82%, RSS −55%, warm `getEntries()` p95 −80% on 10k-entry sessions; one-shot `exportFromFile()` now closes its session manager.
|
|
39
|
+
- Added process-isolated deterministic TUI render-golden capture and fixtures for interactive editor overlays, rich-text resizing, multiplexer viewport repaint, sixel image line preservation, Termux height diffs, and transcript shrink/clear regressions.
|
|
40
|
+
|
|
41
|
+
### Removed
|
|
42
|
+
|
|
43
|
+
- Removed the hardcoded OpenAI Codex role-preset action from the model selector; builtin model profiles are now the only preset concept.
|
|
44
|
+
- Removed retired Fable model profiles (`claude-fable`, `fable-codex`) after `claude-fable-5` was removed upstream.
|
|
45
|
+
|
|
46
|
+
### Changed
|
|
47
|
+
|
|
48
|
+
- Optimization Suite v3 Lane 3 (serialization): session-switch message comparison now uses per-message cached source strings + xxHash64 as an accelerator (source-string compare remains the authority; collision fallback tested) — unchanged-session compares −95% median. The secret obfuscator precomputes a longest-first combined regex (single-pass replace, −70% median/−77% p95 on 100 secrets × 1MiB) with a conservative sequential fallback whenever secrets overlap each other or any replacement/placeholder contains a secret — output bytes are identical in all cases. Intra-line diff rendering gains byte-identical fast paths for identical lines and whitespace-token-aligned prefix/suffix spans (identical −67%, single-token −60%; long lines skip the scan). Mental-model LCS keeps legacy dense-DP tie-break semantics (a Hunt-Szymanski variant was rejected for changing rendered bytes). Provider-visible fork-context seeds use JSON-semantic cloning instead of structuredClone.
|
|
49
|
+
- Tightened tool-block rendering to remove vertical padding and rely on Spacer-only separation, reducing transcript noise while preserving stable render-golden output.
|
|
50
|
+
- Improved the Bun runtime version guard diagnostic: when the Bun running `gjc` is older than the required version, the error now names the exact detected Bun runtime path and prints a platform-specific upgrade and PATH fix (Windows gets the `irm bun.sh/install.ps1|iex` reinstall plus a `%USERPROFILE%\.bun\bin` PATH hint) instead of a bare `bun upgrade` (#525).
|
|
51
|
+
- Aligned the `codex-standard` and `codex-pro` model profiles on the `openai-codex/gpt-5.5` baseline so they no longer default to stale mixed model generations (`gpt-5.4`, `gpt-5.2-codex`, `gpt-5.1-codex-max`, `gpt-5.3-codex-spark`); the profiles now differentiate purely by per-role reasoning effort (#532).
|
|
52
|
+
- Reduced the default RPC `get_state` payload by omitting static `dumpTools` and `systemPrompt` fields unless requested via `include: ["tools", "systemPrompt"]` (#539).
|
|
53
|
+
- Updated `/model` documentation and generated docs index for the rebuilt preset catalog and preset-first selector.
|
|
54
|
+
|
|
55
|
+
### Fixed
|
|
56
|
+
|
|
57
|
+
- Tightened the Windows/psmux tmux provider boundary: `gjc team` now honors `GJC_TMUX_COMMAND` (not just `GJC_TEAM_TMUX_COMMAND`) so the team leader resolves the same multiplexer as `gjc session`/`gjc --tmux`; and when a multiplexer lists a session that lacks GJC's `@gjc-profile` ownership tag, `gjc session status` now returns `gjc_tmux_session_untagged` with a `detail` hint and `gjc team` reports the same cause, instead of a bare `gjc_tmux_session_not_found` / `unmanaged_tmux_session`. Documented that alternative multiplexers such as psmux on Windows are not fully supported because they do not round-trip tmux user options (#531).
|
|
58
|
+
- Hardened RPC stdio lifecycle behavior: `gjc --mode rpc` now reports malformed JSONL frames as parse-error responses without killing the session, flushes durable session state before exiting on EOF/shutdown, and has red-team coverage for attached persistence, reload, malformed-frame recovery, and concurrent child-session isolation.
|
|
59
|
+
- Hardened the harness RPC submit/router contract so `submit` is no longer advertised or accepted during finalizing/non-idle lifecycle windows, non-idle RPC state reports `submitted:false` with a retryable gate, and degraded owner endpoints fall back to `owner-not-live` without false acceptance (#544).
|
|
60
|
+
- Ran estimated context maintenance before sending a new prompt, including tool-output pruning and threshold compaction, so large tool results appended after the last assistant turn cannot push the next model request over the context window.
|
|
61
|
+
- `gjc team` now self-heals a missing `@gjc-profile` ownership tag when the current leader pane was genuinely launched by `gjc --tmux` (detected via `GJC_TMUX_LAUNCHED=1`): the session is re-tagged with `set-option` and startup proceeds, instead of hard-failing with `unmanaged_tmux_session` after a mid-startup attach failure or registry race stripped the tag. Sessions without the GJC launch marker are still rejected unchanged, so foreign tmux sessions cannot be hijacked.
|
|
62
|
+
- Subagent task receipts and live render output now warn when requested role-agent models are substituted by auth fallback or provider-reported assistant model mismatch, including session model-change annotations for server-side substitutions (#559).
|
|
63
|
+
- Converted Cursor wire shell timeouts from millisecond values to bash-tool seconds so delegated Cursor-native shell calls honor the expected timeout units.
|
|
64
|
+
- Fixed pi-shell bash fixups on multibyte UTF-8 commands by converting parser source indexes to byte offsets before stripping `head`/`tail` pipelines.
|
|
65
|
+
|
|
5
66
|
## [0.4.5] - 2026-06-12
|
|
6
67
|
|
|
7
68
|
### Added
|
|
@@ -17,6 +78,7 @@
|
|
|
17
78
|
- Reduced compiled CLI startup and native bundle pressure with default-small grammar loading, tokenizer tiering, and compiled fast-help paths.
|
|
18
79
|
- Preserved dev/main release metadata and changelog consistency for the 0.4.5 lockstep release.
|
|
19
80
|
|
|
81
|
+
- Added native `gjc ultragoal steer --kind` support for documented steering mutations beyond `add_subgoal`, including split, reorder, wording revision, ledger annotation, and blocked-goal supersession contracts with structured audit expectations.
|
|
20
82
|
### Fixed
|
|
21
83
|
|
|
22
84
|
- Kept the unified `goal` tool registered and active by default whenever `goal.enabled` is true, including explicit tool subsets and `gjc ultragoal create-goals` arming flows.
|
|
@@ -4,6 +4,13 @@ export interface AsyncJob {
|
|
|
4
4
|
type: "bash" | "task";
|
|
5
5
|
status: "running" | "completed" | "failed" | "cancelled" | "paused";
|
|
6
6
|
startTime: number;
|
|
7
|
+
/**
|
|
8
|
+
* Wall-clock ms when the job left the `running` state (completed, failed,
|
|
9
|
+
* cancelled, or paused). Undefined while running. Frozen on the first
|
|
10
|
+
* terminal/pause transition so elapsed-time renderers stop counting once a
|
|
11
|
+
* job is no longer active instead of growing forever against `Date.now()`.
|
|
12
|
+
*/
|
|
13
|
+
endTime?: number;
|
|
7
14
|
label: string;
|
|
8
15
|
abortController: AbortController;
|
|
9
16
|
promise: Promise<void>;
|
|
@@ -18,6 +25,13 @@ export interface AsyncJob {
|
|
|
18
25
|
*/
|
|
19
26
|
ownerId?: string;
|
|
20
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Elapsed wall-clock ms for a job, frozen once it stops running. While the job
|
|
30
|
+
* is active (`endTime` undefined) this counts against `now`; after it stops it
|
|
31
|
+
* returns the fixed `endTime - startTime` span so status renderers do not keep
|
|
32
|
+
* incrementing a completed job's timer.
|
|
33
|
+
*/
|
|
34
|
+
export declare function jobElapsedMs(job: Pick<AsyncJob, "startTime" | "endTime">, now?: number): number;
|
|
21
35
|
export interface AsyncJobMetadata {
|
|
22
36
|
subagent?: {
|
|
23
37
|
id: string;
|
|
@@ -77,6 +91,12 @@ export interface SubagentRecord {
|
|
|
77
91
|
message?: string;
|
|
78
92
|
createdAt: number;
|
|
79
93
|
};
|
|
94
|
+
/** Resolved model the subagent was asked to use, e.g. "openai-codex/gpt-5.5". */
|
|
95
|
+
requestedModel?: string;
|
|
96
|
+
/** Model actually used after auth fallback (#985); equals requestedModel when no fallback. */
|
|
97
|
+
effectiveModel?: string;
|
|
98
|
+
/** True when the requested model lacked credentials and the subagent fell back to the parent model. */
|
|
99
|
+
modelFellBack?: boolean;
|
|
80
100
|
}
|
|
81
101
|
/** Lightweight, manager-owned resume payload. The async layer treats `data` as opaque. */
|
|
82
102
|
export interface ResumeDescriptor {
|
|
@@ -184,6 +204,12 @@ export declare class AsyncJobManager {
|
|
|
184
204
|
};
|
|
185
205
|
/** Register or replace the canonical record for a subagent. */
|
|
186
206
|
registerSubagentRecord(record: SubagentRecord): void;
|
|
207
|
+
/** Patch model metadata onto an existing subagent record (best-effort; no-op if unknown). */
|
|
208
|
+
updateSubagentModel(subagentId: string, model: {
|
|
209
|
+
requestedModel?: string;
|
|
210
|
+
effectiveModel?: string;
|
|
211
|
+
modelFellBack?: boolean;
|
|
212
|
+
}): void;
|
|
187
213
|
getSubagentRecord(subagentId: string, filter?: AsyncJobFilter): SubagentRecord | undefined;
|
|
188
214
|
getSubagentRecords(filter?: AsyncJobFilter): SubagentRecord[];
|
|
189
215
|
registerLiveHandle(subagentId: string, handle: SubagentLiveHandle): void;
|
package/dist/types/cli/args.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ModelRegistry } from "../config/model-registry";
|
|
2
|
+
import { type ExtensionFactory } from "../extensibility/extensions";
|
|
2
3
|
/**
|
|
3
4
|
* List available models, optionally filtered by search pattern
|
|
4
5
|
*/
|
|
@@ -11,6 +12,11 @@ export interface RunListModelsOptions {
|
|
|
11
12
|
cwd: string;
|
|
12
13
|
/** CLI-supplied extension paths (e.g. from `-e <path>`). */
|
|
13
14
|
additionalExtensionPaths?: string[];
|
|
15
|
+
/** In-process extension factories to load without filesystem discovery. */
|
|
16
|
+
extensionFactories?: Array<{
|
|
17
|
+
factory: ExtensionFactory;
|
|
18
|
+
name: string;
|
|
19
|
+
}>;
|
|
14
20
|
/** Extension paths configured under `extensions:` in user settings. */
|
|
15
21
|
settingsExtensions?: string[];
|
|
16
22
|
/** Disabled extension ids from settings (`disabledExtensions`). */
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Command } from "@gajae-code/utils/cli";
|
|
2
|
+
export default class Gc extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static strict: boolean;
|
|
5
|
+
static flags: {
|
|
6
|
+
json: import("@gajae-code/utils/cli").FlagDescriptor<"boolean"> & {
|
|
7
|
+
char: string;
|
|
8
|
+
description: string;
|
|
9
|
+
default: boolean;
|
|
10
|
+
};
|
|
11
|
+
prune: import("@gajae-code/utils/cli").FlagDescriptor<"boolean"> & {
|
|
12
|
+
description: string;
|
|
13
|
+
default: boolean;
|
|
14
|
+
};
|
|
15
|
+
force: import("@gajae-code/utils/cli").FlagDescriptor<"boolean"> & {
|
|
16
|
+
description: string;
|
|
17
|
+
default: boolean;
|
|
18
|
+
};
|
|
19
|
+
"dry-run": import("@gajae-code/utils/cli").FlagDescriptor<"boolean"> & {
|
|
20
|
+
description: string;
|
|
21
|
+
default: boolean;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
static examples: string[];
|
|
25
|
+
run(): Promise<void>;
|
|
26
|
+
}
|
|
@@ -34,6 +34,9 @@ export default class Harness extends Command {
|
|
|
34
34
|
description: string;
|
|
35
35
|
default: boolean;
|
|
36
36
|
};
|
|
37
|
+
"receipt-spool-dir": import("@gajae-code/utils/cli").FlagDescriptor<"string"> & {
|
|
38
|
+
description: string;
|
|
39
|
+
};
|
|
37
40
|
};
|
|
38
41
|
static examples: string[];
|
|
39
42
|
run(): Promise<void>;
|
|
@@ -3,4 +3,11 @@ export interface FileLockOptions {
|
|
|
3
3
|
retries?: number;
|
|
4
4
|
retryDelayMs?: number;
|
|
5
5
|
}
|
|
6
|
+
/** @internal */
|
|
7
|
+
export declare function readFileLockInfoForGc(lockDir: string): Promise<{
|
|
8
|
+
pid: number;
|
|
9
|
+
timestamp: number;
|
|
10
|
+
} | null>;
|
|
11
|
+
/** @internal */
|
|
12
|
+
export declare function removeFileLockDirForGc(lockDir: string): Promise<void>;
|
|
6
13
|
export declare function withFileLock<T>(filePath: string, fn: () => Promise<T>, options?: FileLockOptions): Promise<T>;
|
|
@@ -3,15 +3,22 @@ import type { Api, Model } from "@gajae-code/ai";
|
|
|
3
3
|
import type { AgentSession } from "../session/agent-session";
|
|
4
4
|
import { type ModelRegistry } from "./model-registry";
|
|
5
5
|
import type { Settings } from "./settings";
|
|
6
|
+
type ModelProfileActivationSession = Pick<AgentSession, "model" | "thinkingLevel" | "sessionId"> & {
|
|
7
|
+
setModelTemporary?: AgentSession["setModelTemporary"];
|
|
8
|
+
setActiveModelProfile?: (name: string | undefined) => void;
|
|
9
|
+
getActiveModelProfile?: () => string | undefined;
|
|
10
|
+
};
|
|
6
11
|
export interface PrepareModelProfileActivationOptions {
|
|
7
|
-
session:
|
|
12
|
+
session: ModelProfileActivationSession;
|
|
8
13
|
modelRegistry: Pick<ModelRegistry, "getModelProfile" | "getModelProfiles" | "getAvailableModelProfileNames" | "getApiKeyForProvider" | "getAll" | "resolveCanonicalModel" | "getCanonicalVariants" | "getCanonicalId">;
|
|
9
14
|
settings: Pick<Settings, "get">;
|
|
10
15
|
profileName: string;
|
|
11
16
|
}
|
|
12
17
|
export interface PreparedModelProfileActivation {
|
|
13
18
|
profileName: string;
|
|
14
|
-
session:
|
|
19
|
+
session: ModelProfileActivationSession & {
|
|
20
|
+
setModelTemporary: AgentSession["setModelTemporary"];
|
|
21
|
+
};
|
|
15
22
|
settings: Pick<Settings, "get" | "override" | "set" | "flush">;
|
|
16
23
|
previousModel: Model<Api> | undefined;
|
|
17
24
|
previousThinkingLevel: ThinkingLevel | undefined;
|
|
@@ -19,6 +26,7 @@ export interface PreparedModelProfileActivation {
|
|
|
19
26
|
defaultModel: Model<Api> | undefined;
|
|
20
27
|
defaultThinkingLevel: ThinkingLevel | undefined;
|
|
21
28
|
agentModelOverrides: Record<string, string>;
|
|
29
|
+
previousActiveModelProfile: string | undefined;
|
|
22
30
|
}
|
|
23
31
|
export declare function formatModelProfileCredentialError(profileName: string, providers: readonly string[]): string;
|
|
24
32
|
export declare function prepareModelProfileActivation(options: PrepareModelProfileActivationOptions): Promise<PreparedModelProfileActivation>;
|
|
@@ -28,3 +36,4 @@ export declare function applyPreparedModelProfileActivation(prepared: PreparedMo
|
|
|
28
36
|
export declare function activateModelProfile(options: PrepareModelProfileActivationOptions, applyOptions?: {
|
|
29
37
|
persistDefault?: boolean;
|
|
30
38
|
}): Promise<void>;
|
|
39
|
+
export {};
|
|
@@ -14,6 +14,13 @@ export interface ResolvedProfileBinding {
|
|
|
14
14
|
export declare function deriveModelProfileMappedProviders(definition: Pick<ModelProfileDefinition, "modelMapping">): string[];
|
|
15
15
|
export declare function aggregateModelProfileRequiredProviders(requiredProviders: readonly string[], definition: Pick<ModelProfileDefinition, "modelMapping">): string[];
|
|
16
16
|
export declare const BUILTIN_MODEL_PROFILES: readonly ModelProfileDefinition[];
|
|
17
|
+
export interface ModelProfilePresentation {
|
|
18
|
+
displayName: string;
|
|
19
|
+
providerGroup: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function getModelProfilePresentation(name: string): ModelProfilePresentation;
|
|
22
|
+
export declare function groupModelProfilesForPresetLanding(profiles: ReadonlyMap<string, ModelProfileDefinition>): Map<string, ModelProfileDefinition[]>;
|
|
23
|
+
export declare function recommendModelProfileForProvider(providerId: string, profiles: ReadonlyMap<string, ModelProfileDefinition>): ModelProfileDefinition | undefined;
|
|
17
24
|
export declare function mergeModelProfiles(userProfiles?: ModelsConfig["profiles"]): Map<string, ModelProfileDefinition>;
|
|
18
25
|
export declare function resolveProfileBindings(definition: ModelProfileDefinition): ResolvedProfileBinding;
|
|
19
26
|
export declare function formatAvailableProfileNames(profiles: ReadonlyMap<string, ModelProfileDefinition>): string;
|
|
@@ -71,6 +71,7 @@ export declare const ModelsConfigFile: ConfigFile<{
|
|
|
71
71
|
requiresAssistantContentForToolCalls?: boolean | undefined;
|
|
72
72
|
supportsToolChoice?: boolean | undefined;
|
|
73
73
|
supportsForcedToolChoice?: boolean | undefined;
|
|
74
|
+
toolChoiceSupport?: "auto" | "named" | "none" | "required" | undefined;
|
|
74
75
|
disableReasoningOnForcedToolChoice?: boolean | undefined;
|
|
75
76
|
disableReasoningOnToolChoice?: boolean | undefined;
|
|
76
77
|
thinkingFormat?: "openai" | "openrouter" | "qwen" | "qwen-chat-template" | "zai" | undefined;
|
|
@@ -147,6 +148,7 @@ export declare const ModelsConfigFile: ConfigFile<{
|
|
|
147
148
|
requiresAssistantContentForToolCalls?: boolean | undefined;
|
|
148
149
|
supportsToolChoice?: boolean | undefined;
|
|
149
150
|
supportsForcedToolChoice?: boolean | undefined;
|
|
151
|
+
toolChoiceSupport?: "auto" | "named" | "none" | "required" | undefined;
|
|
150
152
|
disableReasoningOnForcedToolChoice?: boolean | undefined;
|
|
151
153
|
disableReasoningOnToolChoice?: boolean | undefined;
|
|
152
154
|
thinkingFormat?: "openai" | "openrouter" | "qwen" | "qwen-chat-template" | "zai" | undefined;
|
|
@@ -219,6 +221,7 @@ export declare const ModelsConfigFile: ConfigFile<{
|
|
|
219
221
|
requiresAssistantContentForToolCalls?: boolean | undefined;
|
|
220
222
|
supportsToolChoice?: boolean | undefined;
|
|
221
223
|
supportsForcedToolChoice?: boolean | undefined;
|
|
224
|
+
toolChoiceSupport?: "auto" | "named" | "none" | "required" | undefined;
|
|
222
225
|
disableReasoningOnForcedToolChoice?: boolean | undefined;
|
|
223
226
|
disableReasoningOnToolChoice?: boolean | undefined;
|
|
224
227
|
thinkingFormat?: "openai" | "openrouter" | "qwen" | "qwen-chat-template" | "zai" | undefined;
|
|
@@ -133,6 +133,8 @@ export declare function resolveModelOverrideWithAuthFallback(modelPatterns: stri
|
|
|
133
133
|
thinkingLevel?: ThinkingLevel;
|
|
134
134
|
explicitThinkingLevel: boolean;
|
|
135
135
|
authFallbackUsed: boolean;
|
|
136
|
+
requestedModel?: Model<Api>;
|
|
137
|
+
fallbackReason?: "auth_unavailable";
|
|
136
138
|
}>;
|
|
137
139
|
/**
|
|
138
140
|
* Resolve a list of role patterns to the first matching model.
|
|
@@ -31,6 +31,12 @@ export declare const OpenAICompatSchema: z.ZodObject<{
|
|
|
31
31
|
requiresAssistantContentForToolCalls: z.ZodOptional<z.ZodBoolean>;
|
|
32
32
|
supportsToolChoice: z.ZodOptional<z.ZodBoolean>;
|
|
33
33
|
supportsForcedToolChoice: z.ZodOptional<z.ZodBoolean>;
|
|
34
|
+
toolChoiceSupport: z.ZodOptional<z.ZodEnum<{
|
|
35
|
+
auto: "auto";
|
|
36
|
+
named: "named";
|
|
37
|
+
none: "none";
|
|
38
|
+
required: "required";
|
|
39
|
+
}>>;
|
|
34
40
|
disableReasoningOnForcedToolChoice: z.ZodOptional<z.ZodBoolean>;
|
|
35
41
|
disableReasoningOnToolChoice: z.ZodOptional<z.ZodBoolean>;
|
|
36
42
|
thinkingFormat: z.ZodOptional<z.ZodEnum<{
|
|
@@ -184,6 +190,12 @@ export declare const ModelOverrideSchema: z.ZodObject<{
|
|
|
184
190
|
requiresAssistantContentForToolCalls: z.ZodOptional<z.ZodBoolean>;
|
|
185
191
|
supportsToolChoice: z.ZodOptional<z.ZodBoolean>;
|
|
186
192
|
supportsForcedToolChoice: z.ZodOptional<z.ZodBoolean>;
|
|
193
|
+
toolChoiceSupport: z.ZodOptional<z.ZodEnum<{
|
|
194
|
+
auto: "auto";
|
|
195
|
+
named: "named";
|
|
196
|
+
none: "none";
|
|
197
|
+
required: "required";
|
|
198
|
+
}>>;
|
|
187
199
|
disableReasoningOnForcedToolChoice: z.ZodOptional<z.ZodBoolean>;
|
|
188
200
|
disableReasoningOnToolChoice: z.ZodOptional<z.ZodBoolean>;
|
|
189
201
|
thinkingFormat: z.ZodOptional<z.ZodEnum<{
|
|
@@ -291,6 +303,12 @@ export declare const ModelsConfigSchema: z.ZodObject<{
|
|
|
291
303
|
requiresAssistantContentForToolCalls: z.ZodOptional<z.ZodBoolean>;
|
|
292
304
|
supportsToolChoice: z.ZodOptional<z.ZodBoolean>;
|
|
293
305
|
supportsForcedToolChoice: z.ZodOptional<z.ZodBoolean>;
|
|
306
|
+
toolChoiceSupport: z.ZodOptional<z.ZodEnum<{
|
|
307
|
+
auto: "auto";
|
|
308
|
+
named: "named";
|
|
309
|
+
none: "none";
|
|
310
|
+
required: "required";
|
|
311
|
+
}>>;
|
|
294
312
|
disableReasoningOnForcedToolChoice: z.ZodOptional<z.ZodBoolean>;
|
|
295
313
|
disableReasoningOnToolChoice: z.ZodOptional<z.ZodBoolean>;
|
|
296
314
|
thinkingFormat: z.ZodOptional<z.ZodEnum<{
|
|
@@ -446,6 +464,12 @@ export declare const ModelsConfigSchema: z.ZodObject<{
|
|
|
446
464
|
requiresAssistantContentForToolCalls: z.ZodOptional<z.ZodBoolean>;
|
|
447
465
|
supportsToolChoice: z.ZodOptional<z.ZodBoolean>;
|
|
448
466
|
supportsForcedToolChoice: z.ZodOptional<z.ZodBoolean>;
|
|
467
|
+
toolChoiceSupport: z.ZodOptional<z.ZodEnum<{
|
|
468
|
+
auto: "auto";
|
|
469
|
+
named: "named";
|
|
470
|
+
none: "none";
|
|
471
|
+
required: "required";
|
|
472
|
+
}>>;
|
|
449
473
|
disableReasoningOnForcedToolChoice: z.ZodOptional<z.ZodBoolean>;
|
|
450
474
|
disableReasoningOnToolChoice: z.ZodOptional<z.ZodBoolean>;
|
|
451
475
|
thinkingFormat: z.ZodOptional<z.ZodEnum<{
|
|
@@ -580,6 +604,12 @@ export declare const ModelsConfigSchema: z.ZodObject<{
|
|
|
580
604
|
requiresAssistantContentForToolCalls: z.ZodOptional<z.ZodBoolean>;
|
|
581
605
|
supportsToolChoice: z.ZodOptional<z.ZodBoolean>;
|
|
582
606
|
supportsForcedToolChoice: z.ZodOptional<z.ZodBoolean>;
|
|
607
|
+
toolChoiceSupport: z.ZodOptional<z.ZodEnum<{
|
|
608
|
+
auto: "auto";
|
|
609
|
+
named: "named";
|
|
610
|
+
none: "none";
|
|
611
|
+
required: "required";
|
|
612
|
+
}>>;
|
|
583
613
|
disableReasoningOnForcedToolChoice: z.ZodOptional<z.ZodBoolean>;
|
|
584
614
|
disableReasoningOnToolChoice: z.ZodOptional<z.ZodBoolean>;
|
|
585
615
|
thinkingFormat: z.ZodOptional<z.ZodEnum<{
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Effort } from "@gajae-code/ai/model-thinking";
|
|
1
2
|
import { type SkillDiscoverySettings } from "./skill-settings-defaults";
|
|
2
3
|
/** Unified settings schema - single source of truth for all settings.
|
|
3
4
|
*
|
|
@@ -697,13 +698,13 @@ export declare const SETTINGS_SCHEMA: {
|
|
|
697
698
|
};
|
|
698
699
|
readonly defaultThinkingLevel: {
|
|
699
700
|
readonly type: "enum";
|
|
700
|
-
readonly values: readonly
|
|
701
|
-
readonly default:
|
|
701
|
+
readonly values: readonly Effort[];
|
|
702
|
+
readonly default: Effort;
|
|
702
703
|
readonly ui: {
|
|
703
704
|
readonly tab: "model";
|
|
704
705
|
readonly label: "Thinking Level";
|
|
705
706
|
readonly description: "Reasoning depth for thinking-capable models";
|
|
706
|
-
readonly options: readonly import("../thinking").ThinkingLevelMetadata[];
|
|
707
|
+
readonly options: readonly import("../thinking-metadata").ThinkingLevelMetadata[];
|
|
707
708
|
};
|
|
708
709
|
};
|
|
709
710
|
readonly hideThinkingBlock: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const COORDINATOR_MCP_PROTOCOL_VERSION = "2024-11-05";
|
|
2
2
|
export declare const COORDINATOR_MCP_SERVER_NAME = "gjc-coordinator-mcp";
|
|
3
|
-
export declare const COORDINATOR_MCP_TOOL_NAMES: readonly ["gjc_coordinator_list_sessions", "gjc_coordinator_read_status", "gjc_coordinator_read_tail", "gjc_coordinator_list_questions", "gjc_coordinator_list_artifacts", "gjc_coordinator_read_artifact", "gjc_coordinator_read_coordination_status", "gjc_coordinator_register_session", "gjc_coordinator_start_session", "gjc_coordinator_send_prompt", "gjc_coordinator_submit_question_answer", "gjc_coordinator_read_turn", "gjc_coordinator_await_turn", "gjc_coordinator_report_status"];
|
|
3
|
+
export declare const COORDINATOR_MCP_TOOL_NAMES: readonly ["gjc_coordinator_list_sessions", "gjc_coordinator_read_status", "gjc_coordinator_read_tail", "gjc_coordinator_list_questions", "gjc_coordinator_list_artifacts", "gjc_coordinator_read_artifact", "gjc_coordinator_read_coordination_status", "gjc_coordinator_watch_events", "gjc_coordinator_register_session", "gjc_coordinator_start_session", "gjc_coordinator_send_prompt", "gjc_coordinator_submit_question_answer", "gjc_coordinator_read_turn", "gjc_coordinator_await_turn", "gjc_coordinator_report_status"];
|
|
4
4
|
export type CoordinatorToolName = (typeof COORDINATOR_MCP_TOOL_NAMES)[number];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "../grok-cli-vendor/src/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './provider/register.js';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model definitions for Grok CLI's API.
|
|
3
|
+
*/
|
|
4
|
+
export interface GrokCliModelConfig {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
reasoning: boolean;
|
|
8
|
+
input: ('text' | 'image')[];
|
|
9
|
+
cost: {
|
|
10
|
+
input: number;
|
|
11
|
+
output: number;
|
|
12
|
+
cacheRead: number;
|
|
13
|
+
cacheWrite: number;
|
|
14
|
+
};
|
|
15
|
+
contextWindow: number;
|
|
16
|
+
maxTokens: number;
|
|
17
|
+
/** Models that don't support reasoning.effort get a thinkingLevelMap. */
|
|
18
|
+
thinkingLevelMap?: Record<string, string | null>;
|
|
19
|
+
}
|
|
20
|
+
export declare function supportsReasoningEffort(modelId: string): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Resolve the active model list. If `GJC_GROK_CLI_MODELS` is set,
|
|
23
|
+
* it filters/reorders the fallback list; unknown IDs get sensible defaults.
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveModels(): GrokCliModelConfig[];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Payload sanitization for xAI's Responses API via cli-chat-proxy.grok.com.
|
|
3
|
+
*
|
|
4
|
+
* xAI's endpoint has quirks compared to stock OpenAI:
|
|
5
|
+
* - Replayed or encrypted `reasoning` items in input cause 400 errors.
|
|
6
|
+
* - `reasoning.effort` is only supported on a subset of models.
|
|
7
|
+
* - Empty-string content items cause validation failures.
|
|
8
|
+
* - `function_call_output.output` cannot contain image arrays.
|
|
9
|
+
* - `image_url` parts must be normalized to `input_image` with data URIs.
|
|
10
|
+
* - Local image paths must be resolved to base64 data URIs.
|
|
11
|
+
* - xAI rejects `role: "developer"` and `role: "system"` in the input
|
|
12
|
+
* array; these must be moved to top-level `instructions`.
|
|
13
|
+
* - xAI uses `text.format` instead of OpenAI's `response_format`.
|
|
14
|
+
* - xAI uses `prompt_cache_key` for conversation caching.
|
|
15
|
+
* - xAI doesn't support `prompt_cache_retention`.
|
|
16
|
+
*
|
|
17
|
+
* Additional Grok CLI-specific behavior:
|
|
18
|
+
* - Adds x-grok-* headers for client identification
|
|
19
|
+
* - Uses prompt_cache_key for session affinity
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Sanitize a provider request payload for xAI's Responses API via
|
|
23
|
+
* cli-chat-proxy.grok.com.
|
|
24
|
+
*
|
|
25
|
+
* Returns the modified payload. Mutates the input in place for efficiency.
|
|
26
|
+
*/
|
|
27
|
+
export declare function sanitizePayload(params: Record<string, unknown>, modelId: string, sessionId: string | undefined, cwd: string): Record<string, unknown>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface BillingUsage {
|
|
2
|
+
monthlyLimit: number;
|
|
3
|
+
used: number;
|
|
4
|
+
billingPeriodEnd: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function fetchBillingUsage(token: string): Promise<BillingUsage>;
|
|
7
|
+
export declare function formatQuota(usage: BillingUsage | undefined): string[];
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Api, AssistantMessageEventStream, Context, Model, SimpleStreamOptions } from '@gajae-code/ai';
|
|
2
|
+
/**
|
|
3
|
+
* Stream function that adds Grok CLI-specific headers to requests.
|
|
4
|
+
*
|
|
5
|
+
* GJC Grok Build extension sends cli-chat-proxy headers (see agent.models.grok-cli.yml):
|
|
6
|
+
* - x-grok-conv-id: <session/conversation ID>
|
|
7
|
+
* - x-grok-model-override: <model ID>
|
|
8
|
+
* - x-xai-token-auth: xai-grok-cli
|
|
9
|
+
*/
|
|
10
|
+
export declare function streamGrokCli(model: Model<Api>, context: Context, options?: SimpleStreamOptions): AssistantMessageEventStream;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed error for xAI OAuth failures.
|
|
3
|
+
*
|
|
4
|
+
* Codes allow the login flow and stream handlers to distinguish
|
|
5
|
+
* retryable failures (network) from fatal ones (revoked refresh token).
|
|
6
|
+
*/
|
|
7
|
+
export declare class XaiOAuthError extends Error {
|
|
8
|
+
readonly code: string;
|
|
9
|
+
readonly reloginRequired: boolean;
|
|
10
|
+
constructor(message: string, code: string, reloginRequired?: boolean);
|
|
11
|
+
}
|
|
12
|
+
/** Well-known error codes. */
|
|
13
|
+
export declare const XaiErrorCode: {
|
|
14
|
+
/** OIDC discovery failed (network, invalid response). */
|
|
15
|
+
readonly DISCOVERY_FAILED: 'discovery_failed';
|
|
16
|
+
/** Discovery endpoint returned a non-xAI origin. */
|
|
17
|
+
readonly DISCOVERY_INVALID_ORIGIN: 'discovery_invalid_origin';
|
|
18
|
+
/** Authorization was denied or errored in the browser. */
|
|
19
|
+
readonly AUTHORIZATION_FAILED: 'authorization_failed';
|
|
20
|
+
/** CSRF state mismatch between request and callback. */
|
|
21
|
+
readonly STATE_MISMATCH: 'state_mismatch';
|
|
22
|
+
/** Callback did not include an authorization code. */
|
|
23
|
+
readonly CODE_MISSING: 'code_missing';
|
|
24
|
+
/** Token exchange failed (network, invalid response). */
|
|
25
|
+
readonly TOKEN_EXCHANGE_FAILED: 'token_exchange_failed';
|
|
26
|
+
/** Token exchange returned an invalid payload. */
|
|
27
|
+
readonly TOKEN_EXCHANGE_INVALID: 'token_exchange_invalid';
|
|
28
|
+
/** Refresh token is missing or empty. */
|
|
29
|
+
readonly REFRESH_MISSING: 'refresh_missing';
|
|
30
|
+
/** Token refresh failed (expired, revoked). */
|
|
31
|
+
readonly REFRESH_FAILED: 'refresh_failed';
|
|
32
|
+
/** No credentials stored. */
|
|
33
|
+
readonly AUTH_MISSING: 'auth_missing';
|
|
34
|
+
/** Loopback callback server could not bind. */
|
|
35
|
+
readonly CALLBACK_BIND_FAILED: 'callback_bind_failed';
|
|
36
|
+
/** Loopback callback timed out. */
|
|
37
|
+
readonly CALLBACK_TIMEOUT: 'callback_timeout';
|
|
38
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ExtensionFactory } from "../extensibility/extensions/types";
|
|
2
|
+
export declare const BUNDLED_GROK_BUILD_EXTENSION_ID = "bundled:grok-build";
|
|
3
|
+
export declare function getBundledGrokBuildExtensionFactory(): ExtensionFactory;
|
|
4
|
+
export declare function getBundledGrokCliModelDefaults(): string;
|
|
5
|
+
export declare function assertBundledGrokCliDefaults(): Promise<void>;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export type { SlashCommandInfo, SlashCommandLocation, SlashCommandSource } from "../slash-commands";
|
|
5
5
|
export { discoverAndLoadExtensions, ExtensionRuntimeNotInitializedError, loadExtensionFromFactory, loadExtensions, } from "./loader";
|
|
6
|
+
export * from "./prefix-command-bridge";
|
|
6
7
|
export * from "./runner";
|
|
7
8
|
export * from "./types";
|
|
8
9
|
export * from "./wrapper";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ExecResult } from "../../exec/exec";
|
|
2
|
+
import type { ExtensionContext, InputEvent, InputEventResult } from "./types";
|
|
3
|
+
export declare const OOO_BRIDGE_RECURSION_ENV = "_OUROBOROS_GJC_BRIDGE_DEPTH";
|
|
4
|
+
export declare const OOO_BRIDGE_CONTINUE_EXIT_CODE = 78;
|
|
5
|
+
export declare const OOO_BRIDGE_TIMEOUT_ENV = "OUROBOROS_GJC_BRIDGE_TIMEOUT_MS";
|
|
6
|
+
export interface ExactPrefixCommandBridgeOptions {
|
|
7
|
+
/** Bare command prefix to intercept, without trailing whitespace. */
|
|
8
|
+
prefix: string;
|
|
9
|
+
/** Command executable to run when the prefix matches. */
|
|
10
|
+
command: string;
|
|
11
|
+
/** Arguments inserted before the intercepted input text. */
|
|
12
|
+
args?: string[];
|
|
13
|
+
/** Environment variable used as the recursion-depth guard. */
|
|
14
|
+
recursionEnv?: string;
|
|
15
|
+
/** Exit code that maps to extension pass-through instead of handled input. */
|
|
16
|
+
continueExitCode?: number;
|
|
17
|
+
/** Optional dispatch timeout in milliseconds. */
|
|
18
|
+
timeout?: number;
|
|
19
|
+
/** Dispatch implementation. Defaults to the shared command executor in the extension context cwd. */
|
|
20
|
+
dispatch?: (command: string, args: string[], ctx: ExtensionContext, options: {
|
|
21
|
+
timeout?: number;
|
|
22
|
+
}) => Promise<ExecResult>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Build an extension `input` handler for an exact-prefix command bridge.
|
|
26
|
+
*
|
|
27
|
+
* Matching input is passed to `command` as `args + [event.text]`. A zero exit code
|
|
28
|
+
* handles the input, `continueExitCode` returns pass-through, and any other
|
|
29
|
+
* non-zero exit code surfaces an error and handles the input so the failed
|
|
30
|
+
* command is not forwarded to the model. The recursion
|
|
31
|
+
* guard prevents extension-originated or nested dispatch from re-entering the
|
|
32
|
+
* bridge while the child command runs.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createExactPrefixCommandBridge(options: ExactPrefixCommandBridgeOptions): (event: InputEvent, ctx: ExtensionContext) => Promise<InputEventResult>;
|
|
35
|
+
export declare function createOuroborosOooBridge(): (event: InputEvent, ctx: ExtensionContext) => Promise<InputEventResult>;
|