@gajae-code/coding-agent 0.11.11 → 0.12.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 +131 -4
- package/dist/types/async/job-manager.d.ts +17 -3
- package/dist/types/cli/read-cli.d.ts +1 -0
- package/dist/types/commands/deep-interview.d.ts +9 -0
- package/dist/types/commands/harness.d.ts +22 -0
- package/dist/types/commands/read.d.ts +6 -0
- package/dist/types/config/model-registry.d.ts +4 -0
- package/dist/types/config/provider-auth-health.d.ts +14 -0
- package/dist/types/config/provider-ranking.d.ts +59 -0
- package/dist/types/config/settings-schema.d.ts +83 -1
- package/dist/types/config/settings.d.ts +2 -0
- package/dist/types/exa/mcp-client.d.ts +10 -1
- package/dist/types/exec/bash-executor.d.ts +45 -12
- package/dist/types/extensibility/extensions/types.d.ts +38 -4
- package/dist/types/extensibility/gjc-plugins/index.d.ts +12 -2
- package/dist/types/extensibility/gjc-plugins/installer.d.ts +63 -7
- package/dist/types/extensibility/gjc-plugins/lifecycle-reconciliation.d.ts +55 -0
- package/dist/types/extensibility/gjc-plugins/lifecycle.d.ts +64 -0
- package/dist/types/extensibility/gjc-plugins/runtime-quarantine.d.ts +67 -0
- package/dist/types/extensibility/gjc-plugins/session-validation.d.ts +3 -1
- package/dist/types/extensibility/gjc-plugins/types.d.ts +124 -0
- package/dist/types/extensibility/shared-events.d.ts +6 -0
- package/dist/types/gjc-runtime/deep-interview-ambiguity.d.ts +5 -12
- package/dist/types/gjc-runtime/deep-interview-recorder.d.ts +17 -32
- package/dist/types/gjc-runtime/deep-interview-stage.d.ts +37 -0
- package/dist/types/gjc-runtime/deep-interview-state.d.ts +4 -135
- package/dist/types/gjc-runtime/gc-runtime.d.ts +1 -1
- package/dist/types/gjc-runtime/launch-tmux.d.ts +1 -0
- package/dist/types/gjc-runtime/memory-guard-owner-claims.d.ts +47 -0
- package/dist/types/gjc-runtime/ralplan-runtime.d.ts +70 -1
- package/dist/types/gjc-runtime/state-writer.d.ts +5 -46
- package/dist/types/gjc-runtime/team-launch.d.ts +1 -1
- package/dist/types/gjc-runtime/team-runtime.d.ts +27 -1
- package/dist/types/gjc-runtime/team-store.d.ts +12 -0
- package/dist/types/gjc-runtime/team-worker-heartbeat.d.ts +43 -0
- package/dist/types/gjc-runtime/team-worker-memory-guard.d.ts +92 -0
- package/dist/types/gjc-runtime/tmux-owner-isolation.d.ts +17 -0
- package/dist/types/gjc-runtime/ultragoal-receipt-freshness.d.ts +8 -0
- package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +31 -80
- package/dist/types/gjc-runtime/workflow-manifest.d.ts +3 -5
- package/dist/types/internal-urls/local-root-gc.d.ts +2 -0
- package/dist/types/main.d.ts +1 -1
- package/dist/types/memories/index.d.ts +2 -0
- package/dist/types/modes/acp/acp-agent.d.ts +10 -19
- package/dist/types/modes/components/assistant-message.d.ts +3 -1
- package/dist/types/modes/components/gjc-bundle-settings.d.ts +34 -0
- package/dist/types/modes/components/irc-sidebar.d.ts +41 -0
- package/dist/types/modes/components/notifications-settings-editor.d.ts +1 -0
- package/dist/types/modes/components/read-tool-group.d.ts +4 -4
- package/dist/types/modes/components/session-observer-overlay.d.ts +22 -0
- package/dist/types/modes/components/settings-selector.d.ts +11 -0
- package/dist/types/modes/components/status-line/gh.d.ts +5 -0
- package/dist/types/modes/components/tool-execution.d.ts +8 -0
- package/dist/types/modes/components/transcript-viewer-overlay.d.ts +18 -1
- package/dist/types/modes/controllers/event-controller.d.ts +3 -0
- package/dist/types/modes/interactive-mode.d.ts +2 -0
- package/dist/types/modes/irc-observation-ledger.d.ts +17 -1
- package/dist/types/modes/types.d.ts +2 -0
- package/dist/types/modes/utils/ui-helpers.d.ts +16 -0
- package/dist/types/reminders/star-reminder.d.ts +3 -13
- package/dist/types/runtime-mcp/manager.d.ts +1 -0
- package/dist/types/runtime-mcp/smithery-auth.d.ts +5 -0
- package/dist/types/sdk/acp/adapter.d.ts +3 -1
- package/dist/types/sdk/broker/lifecycle.d.ts +5 -0
- package/dist/types/sdk/broker/transport.d.ts +2 -0
- package/dist/types/sdk/bus/attachment-registry.d.ts +1 -0
- package/dist/types/sdk/bus/chat-daemon-control.d.ts +4 -1
- package/dist/types/sdk/bus/config.d.ts +6 -2
- package/dist/types/sdk/bus/control-drain-lease.d.ts +52 -0
- package/dist/types/sdk/bus/index.d.ts +44 -1
- package/dist/types/sdk/bus/kind-aware-reconciliation.d.ts +44 -0
- package/dist/types/sdk/bus/lifecycle-control-runtime.d.ts +4 -0
- package/dist/types/sdk/bus/prompt-reconciliation.d.ts +2 -1
- package/dist/types/sdk/bus/reconciliation-store.d.ts +69 -0
- package/dist/types/sdk/bus/rich-draft.d.ts +1 -0
- package/dist/types/sdk/bus/rich-render.d.ts +2 -0
- package/dist/types/sdk/bus/telegram-adoption-intent.d.ts +165 -0
- package/dist/types/sdk/bus/telegram-cli.d.ts +12 -0
- package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +11 -4
- package/dist/types/sdk/bus/telegram-daemon.d.ts +25 -1
- package/dist/types/sdk/bus/telegram-reference.d.ts +11 -1
- package/dist/types/sdk/bus/threaded-render.d.ts +3 -2
- package/dist/types/sdk/bus/topic-registry.d.ts +11 -1
- package/dist/types/sdk/host/control/operations.d.ts +1 -1
- package/dist/types/sdk/host/host.d.ts +2 -0
- package/dist/types/sdk/host/query/handlers.d.ts +5 -0
- package/dist/types/sdk/host/query/revision-store.d.ts +2 -0
- package/dist/types/sdk/host/reverse-leases.d.ts +1 -1
- package/dist/types/sdk/prompt-status.d.ts +23 -3
- package/dist/types/sdk/session.d.ts +6 -0
- package/dist/types/session/agent-session.d.ts +82 -12
- package/dist/types/session/artifacts.d.ts +8 -0
- package/dist/types/session/blob-store.d.ts +57 -4
- package/dist/types/session/internal/managed-session-storage.d.ts +8 -1
- package/dist/types/session/memory-guard-checkpoint-participant.d.ts +69 -0
- package/dist/types/session/session-manager.d.ts +48 -19
- package/dist/types/session/session-storage.d.ts +4 -0
- package/dist/types/session/streaming-output.d.ts +96 -12
- package/dist/types/setup/credential-import.d.ts +12 -0
- package/dist/types/skill-state/active-state.d.ts +12 -4
- package/dist/types/skill-state/workflow-hud.d.ts +9 -0
- package/dist/types/task/executor.d.ts +3 -2
- package/dist/types/task/index.d.ts +3 -1
- package/dist/types/task/provider-retry-status.d.ts +8 -0
- package/dist/types/task/receipt.d.ts +7 -1
- package/dist/types/task/types.d.ts +23 -0
- package/dist/types/tools/ask-answer-registry.d.ts +2 -2
- package/dist/types/tools/bash-interactive.d.ts +4 -1
- package/dist/types/tools/bash.d.ts +3 -1
- package/dist/types/tools/browser/launch.d.ts +7 -0
- package/dist/types/tools/fetch.d.ts +17 -1
- package/dist/types/tools/image-gen.d.ts +4 -0
- package/dist/types/tools/index.d.ts +4 -0
- package/dist/types/tools/output-meta.d.ts +44 -3
- package/dist/types/tools/path-utils.d.ts +1 -0
- package/dist/types/tools/read-internals.d.ts +12 -0
- package/dist/types/tools/read.d.ts +45 -7
- package/dist/types/tools/resource-gc.d.ts +4 -0
- package/dist/types/tools/review.d.ts +5 -7
- package/dist/types/tools/subagent.d.ts +2 -0
- package/dist/types/tools/tool-result.d.ts +7 -1
- package/dist/types/utils/gh.d.ts +13 -0
- package/dist/types/utils/image-resize.d.ts +1 -0
- package/dist/types/web/search/providers/kimi.d.ts +2 -0
- package/dist/types/web/search/providers/searxng.d.ts +7 -0
- package/dist/types/web/search/providers/xai.d.ts +2 -0
- package/package.json +11 -13
- package/scripts/acp-conformance-agent.ts +218 -0
- package/scripts/benchmark-sticky-viewport-pr1.ts +239 -0
- package/scripts/capture-gjc-bundle-settings.ts +306 -0
- package/scripts/capture-sticky-viewport-showcase.ts +292 -0
- package/scripts/generate-sdk-operation-inventory.ts +5 -0
- package/scripts/resident-memory-bench.ts +1341 -0
- package/scripts/run-acp-conformance.ts +285 -0
- package/scripts/verify-gjc-sdk-canonicalization.ts +122 -18
- package/scripts/verify-sticky-viewport-showcase.ts +611 -0
- package/src/async/job-manager.ts +78 -20
- package/src/capability/index.ts +8 -0
- package/src/cli/fast-help.ts +1 -1
- package/src/cli/plugin-cli.ts +176 -18
- package/src/cli/read-cli.ts +2 -1
- package/src/cli.ts +1 -0
- package/src/commands/deep-interview.ts +29 -9
- package/src/commands/harness.ts +35 -12
- package/src/commands/read.ts +11 -2
- package/src/commands/team.ts +20 -2
- package/src/config/file-lock.ts +11 -2
- package/src/config/model-registry.ts +21 -2
- package/src/config/provider-auth-health.ts +42 -0
- package/src/config/provider-ranking.ts +119 -0
- package/src/config/settings-schema.ts +74 -1
- package/src/config/settings.ts +246 -108
- package/src/coordinator-mcp/question-gate-codec.ts +1 -1
- package/src/coordinator-mcp/server.ts +5 -12
- package/src/defaults/gjc/skills/deep-interview/SKILL.md +230 -82
- package/src/defaults/gjc/skills/ralplan/SKILL.md +77 -41
- package/src/defaults/gjc/skills/team/SKILL.md +3 -1
- package/src/defaults/gjc/skills/ultragoal/SKILL.md +62 -39
- package/src/defaults/gjc/skills/ultragoal/validation-batch-contracts.md +12 -0
- package/src/defaults/gjc-defaults.ts +4 -4
- package/src/eval/py/executor.ts +7 -2
- package/src/exa/mcp-client.ts +12 -3
- package/src/exec/bash-executor.ts +144 -27
- package/src/extensibility/extensions/runner.ts +15 -0
- package/src/extensibility/extensions/types.ts +46 -5
- package/src/extensibility/gjc-plugins/constrained-hooks.ts +8 -2
- package/src/extensibility/gjc-plugins/index.ts +19 -2
- package/src/extensibility/gjc-plugins/installer.ts +189 -50
- package/src/extensibility/gjc-plugins/lifecycle-reconciliation.ts +199 -0
- package/src/extensibility/gjc-plugins/lifecycle.ts +626 -0
- package/src/extensibility/gjc-plugins/observability.ts +3 -3
- package/src/extensibility/gjc-plugins/prompt-appendix.ts +5 -1
- package/src/extensibility/gjc-plugins/runtime-adapters.ts +12 -2
- package/src/extensibility/gjc-plugins/runtime-quarantine.ts +121 -0
- package/src/extensibility/gjc-plugins/schema.ts +84 -12
- package/src/extensibility/gjc-plugins/session-validation.ts +9 -3
- package/src/extensibility/gjc-plugins/types.ts +141 -0
- package/src/extensibility/gjc-plugins/validation.ts +9 -0
- package/src/extensibility/shared-events.ts +5 -0
- package/src/gjc-runtime/deep-interview-ambiguity.ts +47 -82
- package/src/gjc-runtime/deep-interview-recorder.ts +227 -310
- package/src/gjc-runtime/deep-interview-runtime.ts +109 -270
- package/src/gjc-runtime/deep-interview-stage.ts +1016 -0
- package/src/gjc-runtime/deep-interview-state.ts +12 -943
- package/src/gjc-runtime/gc-render.ts +1 -0
- package/src/gjc-runtime/gc-runtime.ts +11 -1
- package/src/gjc-runtime/launch-tmux.ts +25 -6
- package/src/gjc-runtime/managed-owner-admission.ts +1 -1
- package/src/gjc-runtime/memory-guard-owner-claims.ts +389 -0
- package/src/gjc-runtime/ralplan-runtime.ts +1149 -98
- package/src/gjc-runtime/state-runtime.ts +2 -1
- package/src/gjc-runtime/state-writer.ts +70 -222
- package/src/gjc-runtime/team-launch.ts +42 -5
- package/src/gjc-runtime/team-runtime.ts +1085 -40
- package/src/gjc-runtime/team-store.ts +32 -0
- package/src/gjc-runtime/team-worker-heartbeat.ts +149 -0
- package/src/gjc-runtime/team-worker-memory-guard.ts +363 -0
- package/src/gjc-runtime/team-workers.ts +1 -0
- package/src/gjc-runtime/tmux-owner-isolation.ts +28 -0
- package/src/gjc-runtime/tmux-sessions.ts +58 -13
- package/src/gjc-runtime/ultragoal-receipt-freshness.ts +20 -0
- package/src/gjc-runtime/ultragoal-runtime.ts +414 -618
- package/src/gjc-runtime/workflow-manifest.generated.json +105 -449
- package/src/gjc-runtime/workflow-manifest.ts +38 -247
- package/src/hooks/native-skill-hook.ts +17 -4
- package/src/hooks/skill-state.ts +1 -23
- package/src/internal-urls/docs-index.generated.ts +21 -22
- package/src/internal-urls/local-root-gc.ts +127 -0
- package/src/main.ts +9 -5
- package/src/memories/index.ts +10 -0
- package/src/modes/DESIGN.md +98 -0
- package/src/modes/acp/acp-agent.ts +339 -191
- package/src/modes/acp/acp-event-mapper.ts +14 -7
- package/src/modes/acp/acp-mode.ts +39 -3
- package/src/modes/components/assistant-message.ts +123 -22
- package/src/modes/components/gjc-bundle-settings.ts +508 -0
- package/src/modes/components/irc-sidebar.ts +176 -62
- package/src/modes/components/model-selector.ts +61 -4
- package/src/modes/components/notifications-settings-editor.ts +12 -1
- package/src/modes/components/oauth-selector.ts +96 -28
- package/src/modes/components/read-tool-group.ts +82 -14
- package/src/modes/components/session-observer-overlay.ts +457 -83
- package/src/modes/components/settings-selector.ts +116 -23
- package/src/modes/components/status-line/gh.ts +16 -0
- package/src/modes/components/tool-execution.ts +138 -27
- package/src/modes/components/tool-status-header.ts +3 -14
- package/src/modes/components/transcript-viewer-overlay.ts +99 -24
- package/src/modes/controllers/command-controller.ts +4 -0
- package/src/modes/controllers/event-controller.ts +109 -27
- package/src/modes/controllers/extension-ui-controller.ts +26 -2
- package/src/modes/controllers/input-controller.ts +18 -3
- package/src/modes/controllers/selector-controller.ts +127 -36
- package/src/modes/interactive-mode.ts +62 -3
- package/src/modes/irc-observation-ledger.ts +71 -15
- package/src/modes/runtime-init.ts +22 -2
- package/src/modes/types.ts +2 -0
- package/src/modes/utils/ui-helpers.ts +94 -1
- package/src/prompts/agent-fragments/ralplan-persistence.md +4 -3
- package/src/prompts/agents/architect.md +9 -1
- package/src/prompts/agents/critic.md +9 -0
- package/src/prompts/system/eager-todo.md +8 -4
- package/src/prompts/system/system-prompt.md +11 -5
- package/src/prompts/tools/bash.md +5 -5
- package/src/prompts/tools/read.md +4 -2
- package/src/prompts/tools/search-tool-bm25.md +5 -0
- package/src/prompts/tools/task.md +1 -1
- package/src/reminders/star-reminder.ts +4 -42
- package/src/runtime-mcp/manager.ts +19 -4
- package/src/runtime-mcp/smithery-auth.ts +17 -2
- package/src/runtime-mcp/smithery-connect.ts +11 -1
- package/src/sdk/acp/adapter.ts +22 -6
- package/src/sdk/broker/lifecycle.ts +25 -6
- package/src/sdk/broker/transport.ts +35 -3
- package/src/sdk/bus/attachment-registry.ts +5 -1
- package/src/sdk/bus/chat-daemon-cli.ts +4 -39
- package/src/sdk/bus/chat-daemon-control.ts +6 -3
- package/src/sdk/bus/config.ts +18 -2
- package/src/sdk/bus/control-drain-lease.ts +104 -0
- package/src/sdk/bus/index.ts +984 -146
- package/src/sdk/bus/kind-aware-reconciliation.ts +317 -0
- package/src/sdk/bus/lifecycle-commands.ts +4 -1
- package/src/sdk/bus/lifecycle-control-runtime.ts +403 -88
- package/src/sdk/bus/prompt-reconciliation.ts +2 -1
- package/src/sdk/bus/reconciliation-store.ts +303 -0
- package/src/sdk/bus/rich-draft.ts +1 -1
- package/src/sdk/bus/rich-render.ts +2 -2
- package/src/sdk/bus/telegram-adoption-intent.ts +574 -0
- package/src/sdk/bus/telegram-cli.ts +33 -8
- package/src/sdk/bus/telegram-daemon-cli.ts +1 -0
- package/src/sdk/bus/telegram-daemon-contract.ts +11 -4
- package/src/sdk/bus/telegram-daemon.ts +916 -23
- package/src/sdk/bus/telegram-reference.ts +40 -3
- package/src/sdk/bus/threaded-render.ts +48 -3
- package/src/sdk/bus/topic-registry.ts +20 -0
- package/src/sdk/host/control/dispatch.ts +5 -1
- package/src/sdk/host/control/operations.ts +1 -1
- package/src/sdk/host/host.ts +23 -1
- package/src/sdk/host/query/handlers.ts +55 -0
- package/src/sdk/host/query/revision-store.ts +36 -2
- package/src/sdk/host/reverse-leases.ts +44 -7
- package/src/sdk/mcp/server.ts +46 -18
- package/src/sdk/prompt-status.ts +16 -3
- package/src/sdk/protocol/operation-inventory.generated.json +51 -0
- package/src/sdk/protocol/operation-registry.ts +7 -2
- package/src/sdk/session.ts +101 -10
- package/src/session/agent-session.ts +1286 -220
- package/src/session/artifacts.ts +22 -0
- package/src/session/auth-broker-config.ts +10 -3
- package/src/session/blob-store.ts +915 -24
- package/src/session/internal/managed-session-scope.ts +44 -6
- package/src/session/internal/managed-session-storage.ts +48 -6
- package/src/session/memory-guard-checkpoint-participant.ts +131 -0
- package/src/session/session-manager.ts +2364 -438
- package/src/session/session-storage.ts +9 -1
- package/src/session/streaming-output.ts +500 -111
- package/src/setup/credential-import.ts +75 -13
- package/src/setup/provider-onboarding.ts +19 -4
- package/src/skill-state/active-state.ts +32 -10
- package/src/skill-state/workflow-hud.ts +42 -2
- package/src/skill-state/workflow-mutation-guard.ts +560 -8
- package/src/task/executor.ts +122 -39
- package/src/task/index.ts +23 -14
- package/src/task/provider-retry-status.ts +16 -0
- package/src/task/receipt.ts +23 -7
- package/src/task/render.ts +6 -2
- package/src/task/types.ts +108 -0
- package/src/tools/ask-answer-registry.ts +12 -6
- package/src/tools/ask.ts +169 -118
- package/src/tools/ast-edit.ts +1 -0
- package/src/tools/ast-grep.ts +1 -0
- package/src/tools/bash-interactive.ts +8 -3
- package/src/tools/bash.ts +503 -60
- package/src/tools/browser/launch.ts +41 -6
- package/src/tools/fetch.ts +114 -23
- package/src/tools/find.ts +1 -0
- package/src/tools/image-gen.ts +29 -5
- package/src/tools/index.ts +4 -0
- package/src/tools/output-meta.ts +281 -20
- package/src/tools/path-utils.ts +8 -3
- package/src/tools/read-internals.ts +44 -0
- package/src/tools/read.ts +1560 -310
- package/src/tools/resource-gc.ts +182 -18
- package/src/tools/review.ts +5 -7
- package/src/tools/search.ts +1 -0
- package/src/tools/subagent-render.ts +6 -2
- package/src/tools/subagent.ts +6 -0
- package/src/tools/telegram-send.ts +6 -3
- package/src/tools/tool-result.ts +14 -1
- package/src/utils/gh.ts +39 -0
- package/src/utils/image-resize.ts +3 -0
- package/src/web/search/providers/anthropic.ts +4 -4
- package/src/web/search/providers/codex.ts +1 -1
- package/src/web/search/providers/kimi.ts +15 -5
- package/src/web/search/providers/searxng.ts +47 -4
- package/src/web/search/providers/xai.ts +7 -2
- package/dist/types/gjc-runtime/deep-interview-draft.d.ts +0 -8
- package/dist/types/gjc-runtime/deep-interview-payload.d.ts +0 -41
- package/dist/types/gjc-runtime/deep-interview-repair.d.ts +0 -17
- package/dist/types/gjc-runtime/ultragoal-pipeline.d.ts +0 -23
- package/src/defaults/gjc/skills/ultragoal/pipeline-validation-contracts.md +0 -30
- package/src/gjc-runtime/deep-interview-draft.ts +0 -843
- package/src/gjc-runtime/deep-interview-payload.ts +0 -262
- package/src/gjc-runtime/deep-interview-repair.ts +0 -1674
- package/src/gjc-runtime/ultragoal-pipeline.ts +0 -306
|
@@ -7,16 +7,17 @@
|
|
|
7
7
|
* {@link AuthCredential} payloads that go straight into the store.
|
|
8
8
|
*
|
|
9
9
|
* Sources:
|
|
10
|
-
* - Claude Code:
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* - Claude Code: `$CLAUDE_CONFIG_DIR/.credentials.json` (defaults to
|
|
11
|
+
* `~/.claude/.credentials.json`) on Linux/WSL/Windows native, the macOS
|
|
12
|
+
* Keychain (`Claude Code-credentials`), and env vars.
|
|
13
|
+
* - Codex CLI: `$CODEX_HOME/auth.json` (defaults to `~/.codex/auth.json`;
|
|
14
|
+
* OAuth `tokens` block or stored `OPENAI_API_KEY`), and env vars.
|
|
14
15
|
*/
|
|
15
16
|
import * as fs from "node:fs/promises";
|
|
16
17
|
import * as os from "node:os";
|
|
17
18
|
import * as path from "node:path";
|
|
18
19
|
import type { AuthCredential, OAuthCredential } from "@gajae-code/ai";
|
|
19
|
-
import { isEnoent } from "@gajae-code/utils";
|
|
20
|
+
import { $credentialEnv, isEnoent } from "@gajae-code/utils";
|
|
20
21
|
import { redactSecret } from "./provider-onboarding";
|
|
21
22
|
|
|
22
23
|
/** gjc provider ids that external credentials map onto. */
|
|
@@ -79,6 +80,18 @@ export interface DiscoveryOptions {
|
|
|
79
80
|
env?: Record<string, string | undefined>;
|
|
80
81
|
/** Override the platform (defaults to `process.platform`). */
|
|
81
82
|
platform?: NodeJS.Platform;
|
|
83
|
+
/**
|
|
84
|
+
* Claude Code config directory holding `.credentials.json`.
|
|
85
|
+
*
|
|
86
|
+
* Defaults to the trusted `CLAUDE_CONFIG_DIR` value, else `<homeDir>/.claude`.
|
|
87
|
+
*/
|
|
88
|
+
claudeConfigDir?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Codex CLI home directory holding `auth.json`.
|
|
91
|
+
*
|
|
92
|
+
* Defaults to the trusted `CODEX_HOME` value, else `<homeDir>/.codex`.
|
|
93
|
+
*/
|
|
94
|
+
codexHome?: string;
|
|
82
95
|
/**
|
|
83
96
|
* Reader for the macOS Keychain `Claude Code-credentials` entry. Defaults to
|
|
84
97
|
* shelling out to `security`; injected in tests. Returns the raw JSON string,
|
|
@@ -206,12 +219,24 @@ function parseClaudeCredentials(
|
|
|
206
219
|
};
|
|
207
220
|
}
|
|
208
221
|
|
|
222
|
+
/**
|
|
223
|
+
* A discovery root plus the leak-free label used in redacted summaries.
|
|
224
|
+
*
|
|
225
|
+
* `display` never contains a resolved filesystem path: it is either the
|
|
226
|
+
* home-relative default or the env-var spelling that redirected the lookup.
|
|
227
|
+
*/
|
|
228
|
+
interface ResolvedExternalDir {
|
|
229
|
+
dir: string;
|
|
230
|
+
display: string;
|
|
231
|
+
}
|
|
232
|
+
|
|
209
233
|
async function discoverClaudeCode(
|
|
210
|
-
opts: Required<Pick<DiscoveryOptions, "
|
|
234
|
+
opts: Required<Pick<DiscoveryOptions, "platform">> &
|
|
235
|
+
Pick<DiscoveryOptions, "readClaudeKeychain"> & { configDir: ResolvedExternalDir },
|
|
211
236
|
result: CredentialDiscoveryResult,
|
|
212
237
|
): Promise<void> {
|
|
213
|
-
const filePath = path.join(opts.
|
|
214
|
-
const displayPath =
|
|
238
|
+
const filePath = path.join(opts.configDir.dir, ".credentials.json");
|
|
239
|
+
const displayPath = `${opts.configDir.display}/.credentials.json`;
|
|
215
240
|
let fileRaw: string | null = null;
|
|
216
241
|
try {
|
|
217
242
|
fileRaw = await fs.readFile(filePath, "utf-8");
|
|
@@ -324,9 +349,9 @@ function parseCodexAuth(raw: string, source: string): ImportableCredential | Ski
|
|
|
324
349
|
return { origin: "codex-file", source, reason: "no OAuth tokens or OPENAI_API_KEY present (unsupported shape)" };
|
|
325
350
|
}
|
|
326
351
|
|
|
327
|
-
async function discoverCodex(
|
|
328
|
-
const filePath = path.join(
|
|
329
|
-
const displayPath =
|
|
352
|
+
async function discoverCodex(home: ResolvedExternalDir, result: CredentialDiscoveryResult): Promise<void> {
|
|
353
|
+
const filePath = path.join(home.dir, "auth.json");
|
|
354
|
+
const displayPath = `${home.display}/auth.json`;
|
|
330
355
|
let raw: string | null = null;
|
|
331
356
|
try {
|
|
332
357
|
raw = await fs.readFile(filePath, "utf-8");
|
|
@@ -367,6 +392,34 @@ function pushOutcome(result: CredentialDiscoveryResult, outcome: ImportableCrede
|
|
|
367
392
|
else result.importable.push(outcome);
|
|
368
393
|
}
|
|
369
394
|
|
|
395
|
+
/**
|
|
396
|
+
* Resolve a discovery root that the external CLI itself relocates through the
|
|
397
|
+
* environment (`CLAUDE_CONFIG_DIR`, `CODEX_HOME`).
|
|
398
|
+
*
|
|
399
|
+
* Both variables are read through `$credentialEnv`, so the caller's project
|
|
400
|
+
* `.env` cannot redirect discovery at a credential file a repository ships —
|
|
401
|
+
* the same boundary provider authentication already uses.
|
|
402
|
+
*
|
|
403
|
+
* Relative values are rejected. Claude Code and Codex resolve them against the
|
|
404
|
+
* process cwd, which for gjc is the user's project directory; honouring that
|
|
405
|
+
* would reintroduce the project-controlled redirect the trust boundary exists
|
|
406
|
+
* to prevent. An explicit `options.env` (tests, embedders) is consulted verbatim
|
|
407
|
+
* instead of the ambient environment.
|
|
408
|
+
*/
|
|
409
|
+
function resolveExternalDir(
|
|
410
|
+
name: "CLAUDE_CONFIG_DIR" | "CODEX_HOME",
|
|
411
|
+
envOverride: Record<string, string | undefined> | undefined,
|
|
412
|
+
fallbackDir: string,
|
|
413
|
+
fallbackDisplay: string,
|
|
414
|
+
): ResolvedExternalDir {
|
|
415
|
+
const raw = envOverride ? envOverride[name] : $credentialEnv(name);
|
|
416
|
+
const trimmed = raw?.trim();
|
|
417
|
+
if (trimmed && path.isAbsolute(trimmed)) {
|
|
418
|
+
return { dir: trimmed, display: `$${name}` };
|
|
419
|
+
}
|
|
420
|
+
return { dir: fallbackDir, display: fallbackDisplay };
|
|
421
|
+
}
|
|
422
|
+
|
|
370
423
|
/**
|
|
371
424
|
* Discover Claude Code and Codex CLI credentials across files, the macOS
|
|
372
425
|
* Keychain, and environment variables. Never throws for individual unreadable or
|
|
@@ -376,9 +429,18 @@ export async function discoverExternalCredentials(options: DiscoveryOptions = {}
|
|
|
376
429
|
const homeDir = options.homeDir ?? os.homedir();
|
|
377
430
|
const env = options.env ?? process.env;
|
|
378
431
|
const platform = options.platform ?? process.platform;
|
|
432
|
+
const claudeConfigDir: ResolvedExternalDir = options.claudeConfigDir
|
|
433
|
+
? { dir: options.claudeConfigDir, display: "$CLAUDE_CONFIG_DIR" }
|
|
434
|
+
: resolveExternalDir("CLAUDE_CONFIG_DIR", options.env, path.join(homeDir, ".claude"), "~/.claude");
|
|
435
|
+
const codexHome: ResolvedExternalDir = options.codexHome
|
|
436
|
+
? { dir: options.codexHome, display: "$CODEX_HOME" }
|
|
437
|
+
: resolveExternalDir("CODEX_HOME", options.env, path.join(homeDir, ".codex"), "~/.codex");
|
|
379
438
|
const result: CredentialDiscoveryResult = { importable: [], skipped: [], environment: [] };
|
|
380
|
-
await discoverClaudeCode(
|
|
381
|
-
|
|
439
|
+
await discoverClaudeCode(
|
|
440
|
+
{ configDir: claudeConfigDir, platform, readClaudeKeychain: options.readClaudeKeychain },
|
|
441
|
+
result,
|
|
442
|
+
);
|
|
443
|
+
await discoverCodex(codexHome, result);
|
|
382
444
|
discoverEnvironment(env, result);
|
|
383
445
|
return result;
|
|
384
446
|
}
|
|
@@ -4,6 +4,7 @@ import * as path from "node:path";
|
|
|
4
4
|
import { getAgentDbPath, getAgentDir } from "@gajae-code/utils";
|
|
5
5
|
import { YAML } from "bun";
|
|
6
6
|
import { type ModelsConfig, ModelsConfigSchema } from "../config/models-config-schema";
|
|
7
|
+
import { compareRankedProviders, famousProviderIndex } from "../config/provider-ranking";
|
|
7
8
|
import { AuthStorage } from "../session/auth-storage";
|
|
8
9
|
import providerPresets from "./provider-presets.json";
|
|
9
10
|
|
|
@@ -81,11 +82,25 @@ export function findProviderPreset(value: string | undefined): ProviderPreset |
|
|
|
81
82
|
return PROVIDER_PRESETS.find(preset => preset.id === normalized || preset.aliases.includes(normalized));
|
|
82
83
|
}
|
|
83
84
|
|
|
85
|
+
function providerPresetRankingId(preset: ProviderPreset): string {
|
|
86
|
+
return (
|
|
87
|
+
[preset.providerId, preset.id, ...preset.aliases].find(id => famousProviderIndex(id) !== undefined) ?? preset.id
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
84
91
|
export function formatProviderPresetList(): string {
|
|
85
|
-
return PROVIDER_PRESETS
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
92
|
+
return [...PROVIDER_PRESETS]
|
|
93
|
+
.sort((left, right) =>
|
|
94
|
+
compareRankedProviders(
|
|
95
|
+
{ id: providerPresetRankingId(left), label: left.name, authState: "none" },
|
|
96
|
+
{ id: providerPresetRankingId(right), label: right.name, authState: "none" },
|
|
97
|
+
),
|
|
98
|
+
)
|
|
99
|
+
.map(preset => {
|
|
100
|
+
const aliases = preset.aliases.length > 0 ? ` (aliases: ${preset.aliases.join(", ")})` : "";
|
|
101
|
+
return `${preset.id}${aliases}: ${preset.description}`;
|
|
102
|
+
})
|
|
103
|
+
.join("\n");
|
|
89
104
|
}
|
|
90
105
|
|
|
91
106
|
export function parseModelList(values: readonly string[]): string[] {
|
|
@@ -71,8 +71,6 @@ export interface SkillActiveEntry {
|
|
|
71
71
|
handoff_at?: string;
|
|
72
72
|
active_subskills?: ActiveSubskillEntry[];
|
|
73
73
|
source_state_revision?: number;
|
|
74
|
-
/** Durable ordering token from the source workflow mode-state, not this cache file's revision. */
|
|
75
|
-
committed_mode_state_revision?: number;
|
|
76
74
|
}
|
|
77
75
|
|
|
78
76
|
export interface SkillActiveState {
|
|
@@ -116,8 +114,6 @@ export interface SyncSkillActiveStateOptions {
|
|
|
116
114
|
handoff_at?: string;
|
|
117
115
|
active_subskills?: ActiveSubskillEntry[];
|
|
118
116
|
sourceRevision?: number;
|
|
119
|
-
/** Durable ordering token from the source workflow mode-state, not this cache file's revision. */
|
|
120
|
-
committedModeRevision?: number;
|
|
121
117
|
}
|
|
122
118
|
|
|
123
119
|
const HUD_TEXT_LIMIT = 80;
|
|
@@ -306,6 +302,32 @@ export function isCanonicalGjcWorkflowSkill(skill: string): skill is CanonicalGj
|
|
|
306
302
|
return (CANONICAL_GJC_WORKFLOW_SKILLS as readonly string[]).includes(skill);
|
|
307
303
|
}
|
|
308
304
|
|
|
305
|
+
/**
|
|
306
|
+
* Nonterminal phases that intentionally await workflow-specific integration
|
|
307
|
+
* rather than a generic synthetic compaction continuation.
|
|
308
|
+
*/
|
|
309
|
+
const CONTINUATION_INERT_WORKFLOW_PHASES: Readonly<Partial<Record<CanonicalGjcWorkflowSkill, ReadonlySet<string>>>> = {
|
|
310
|
+
team: new Set(["awaiting_integration"]),
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Continuation inertness for compaction auto-continue, derived from each
|
|
315
|
+
* workflow's manifest contract: manifest-terminal and explicitly inert phases
|
|
316
|
+
* are inert; unknown skills or phases unknown to the skill's manifest are
|
|
317
|
+
* conservatively inert so a synthetic continuation never wakes an unrecognized
|
|
318
|
+
* workflow. Generic Ultragoal `blocked` remains continuation-active because its
|
|
319
|
+
* blocker may be autonomously resolvable; verified human pauses are represented
|
|
320
|
+
* by the inline goal's `paused` status instead.
|
|
321
|
+
*/
|
|
322
|
+
export function isWorkflowContinuationInert(skill: string, phase: string): boolean {
|
|
323
|
+
const normalizedPhase = phase.trim().toLowerCase();
|
|
324
|
+
if (!isCanonicalGjcWorkflowSkill(skill)) return true;
|
|
325
|
+
const manifest = getSkillManifest(skill);
|
|
326
|
+
if (manifest.terminalStates.some(terminal => terminal.toLowerCase() === normalizedPhase)) return true;
|
|
327
|
+
if (CONTINUATION_INERT_WORKFLOW_PHASES[skill]?.has(normalizedPhase)) return true;
|
|
328
|
+
return !manifest.states.some(state => state.id.toLowerCase() === normalizedPhase);
|
|
329
|
+
}
|
|
330
|
+
|
|
309
331
|
export function listActiveSkills(raw: unknown): SkillActiveEntry[] {
|
|
310
332
|
if (!raw || typeof raw !== "object") return [];
|
|
311
333
|
const state = raw as SkillActiveState;
|
|
@@ -619,6 +641,8 @@ async function mergeVisibleEntries(
|
|
|
619
641
|
export type VisibleSkillActiveStateCacheTier = "security" | "hud";
|
|
620
642
|
export interface ReadVisibleSkillActiveStateOptions {
|
|
621
643
|
tier?: VisibleSkillActiveStateCacheTier;
|
|
644
|
+
/** Bypass all signature/TTL caches for authorization decisions. */
|
|
645
|
+
bypassCache?: boolean;
|
|
622
646
|
}
|
|
623
647
|
|
|
624
648
|
interface ActiveStateStatSignature {
|
|
@@ -751,6 +775,10 @@ export async function readVisibleSkillActiveState(
|
|
|
751
775
|
}
|
|
752
776
|
const resolvedCwd = path.resolve(cwd);
|
|
753
777
|
const cacheKey = visibleActiveStateCacheKey(resolvedCwd, resolvedSessionId);
|
|
778
|
+
if (opts?.bypassCache) {
|
|
779
|
+
visibleSkillActiveStateCache.delete(cacheKey);
|
|
780
|
+
return await readVisibleSkillActiveStateUncached(resolvedCwd, resolvedSessionId);
|
|
781
|
+
}
|
|
754
782
|
const tier = opts?.tier ?? "security";
|
|
755
783
|
const now = Date.now();
|
|
756
784
|
const cached = visibleSkillActiveStateCache.get(cacheKey);
|
|
@@ -789,9 +817,6 @@ async function persistActiveEntry(
|
|
|
789
817
|
await writeActiveEntry(cwd, sessionScope, entry.skill, entry, {
|
|
790
818
|
cwd,
|
|
791
819
|
audit: activeStateWriterAudit("write-active-entry", sessionScope),
|
|
792
|
-
...(typeof entry.committed_mode_state_revision === "number"
|
|
793
|
-
? { orderingRevision: entry.committed_mode_state_revision }
|
|
794
|
-
: {}),
|
|
795
820
|
});
|
|
796
821
|
}
|
|
797
822
|
}
|
|
@@ -870,9 +895,6 @@ export async function syncSkillActiveState(options: SyncSkillActiveStateOptions)
|
|
|
870
895
|
? { active_subskills: preservedActiveSubskills }
|
|
871
896
|
: {}),
|
|
872
897
|
...(typeof options.sourceRevision === "number" ? { source_state_revision: options.sourceRevision } : {}),
|
|
873
|
-
...(typeof options.committedModeRevision === "number"
|
|
874
|
-
? { committed_mode_state_revision: options.committedModeRevision }
|
|
875
|
-
: {}),
|
|
876
898
|
};
|
|
877
899
|
const sessionScope = { sessionId: options.sessionId };
|
|
878
900
|
await removeSupersededPlanningPipelineEntries(options.cwd, sessionScope, entry);
|
|
@@ -23,9 +23,18 @@ interface RalplanHudState extends WorkflowGateHudState {
|
|
|
23
23
|
iteration?: number;
|
|
24
24
|
iterationFromIndex?: number;
|
|
25
25
|
stages?: string;
|
|
26
|
+
architectPasses?: number;
|
|
27
|
+
criticPasses?: number;
|
|
28
|
+
reviewPassBudget?: number;
|
|
26
29
|
verdict?: string;
|
|
27
30
|
latestSummary?: string;
|
|
28
31
|
pendingApproval?: boolean;
|
|
32
|
+
autoHandoff?: {
|
|
33
|
+
configuredTarget: string;
|
|
34
|
+
effectiveTarget: string;
|
|
35
|
+
degradationReason: string | null;
|
|
36
|
+
};
|
|
37
|
+
planningStuck?: boolean;
|
|
29
38
|
updatedAt?: string;
|
|
30
39
|
}
|
|
31
40
|
|
|
@@ -194,13 +203,41 @@ export function deriveDeepInterviewHud(
|
|
|
194
203
|
export function buildRalplanHudSummary(state: RalplanHudState): WorkflowHudSummary {
|
|
195
204
|
const verdict = state.verdict?.toUpperCase();
|
|
196
205
|
const verdictSeverity =
|
|
197
|
-
verdict === "BLOCK"
|
|
206
|
+
verdict === "BLOCK" || verdict === "REJECT"
|
|
198
207
|
? "blocked"
|
|
199
208
|
: verdict === "ITERATE" || verdict === "WATCH"
|
|
200
209
|
? "warning"
|
|
201
|
-
: verdict === "APPROVE" || verdict === "CLEAR"
|
|
210
|
+
: verdict === "APPROVE" || verdict === "CLEAR" || verdict === "OKAY"
|
|
202
211
|
? "success"
|
|
203
212
|
: undefined;
|
|
213
|
+
const reviewPassChip = (
|
|
214
|
+
label: "arch" | "crit",
|
|
215
|
+
passes: number | undefined,
|
|
216
|
+
priority: number,
|
|
217
|
+
): WorkflowHudChip | null => {
|
|
218
|
+
if (
|
|
219
|
+
state.pendingApproval ||
|
|
220
|
+
typeof passes !== "number" ||
|
|
221
|
+
!Number.isFinite(passes) ||
|
|
222
|
+
passes <= 0 ||
|
|
223
|
+
typeof state.reviewPassBudget !== "number" ||
|
|
224
|
+
!Number.isFinite(state.reviewPassBudget) ||
|
|
225
|
+
state.reviewPassBudget <= 0
|
|
226
|
+
) {
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
return chip(label, `${passes}/${state.reviewPassBudget}`, priority);
|
|
230
|
+
};
|
|
231
|
+
const handoffValue = state.autoHandoff
|
|
232
|
+
? `${state.autoHandoff.configuredTarget}→${state.autoHandoff.effectiveTarget}${
|
|
233
|
+
state.autoHandoff.degradationReason ? `:${state.autoHandoff.degradationReason}` : ""
|
|
234
|
+
}`
|
|
235
|
+
: undefined;
|
|
236
|
+
const handoffSeverity = state.planningStuck
|
|
237
|
+
? "blocked"
|
|
238
|
+
: state.autoHandoff?.degradationReason
|
|
239
|
+
? "warning"
|
|
240
|
+
: undefined;
|
|
204
241
|
return {
|
|
205
242
|
version: 1,
|
|
206
243
|
summary: state.latestSummary,
|
|
@@ -217,7 +254,10 @@ export function buildRalplanHudSummary(state: RalplanHudState): WorkflowHudSumma
|
|
|
217
254
|
30,
|
|
218
255
|
),
|
|
219
256
|
chip("stages", state.stages, 35),
|
|
257
|
+
reviewPassChip("arch", state.architectPasses, 36),
|
|
258
|
+
reviewPassChip("crit", state.criticPasses, 38),
|
|
220
259
|
chip("verdict", verdict, 40, verdictSeverity),
|
|
260
|
+
chip("handoff", handoffValue, 45, handoffSeverity),
|
|
221
261
|
]),
|
|
222
262
|
...(state.updatedAt ? { updated_at: state.updatedAt } : {}),
|
|
223
263
|
};
|