@gajae-code/coding-agent 0.11.0 → 0.11.2
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 +63 -1
- package/dist/types/async/job-manager.d.ts +46 -7
- package/dist/types/cli/config-cli.d.ts +11 -1
- package/dist/types/cli/notify-cli.d.ts +1 -0
- package/dist/types/cli/session-picker.d.ts +2 -1
- package/dist/types/cli/setup-cli.d.ts +1 -1
- package/dist/types/commands/mcp-serve.d.ts +33 -0
- package/dist/types/commands/mcp.d.ts +1 -1
- package/dist/types/commands/notify.d.ts +0 -2
- package/dist/types/commands/sdk.d.ts +1 -1
- package/dist/types/config/atomic-yaml-patch.d.ts +18 -0
- package/dist/types/config/file-lock.d.ts +14 -4
- package/dist/types/config/keybindings.d.ts +42 -1
- package/dist/types/config/model-auth.d.ts +3 -0
- package/dist/types/config/model-bindings-applier.d.ts +13 -0
- package/dist/types/config/model-discovery-manager.d.ts +49 -0
- package/dist/types/config/model-equivalence.d.ts +20 -0
- package/dist/types/config/model-registry.d.ts +16 -15
- package/dist/types/config/model-resolver.d.ts +28 -18
- package/dist/types/config/models-config-schema.d.ts +11 -0
- package/dist/types/config/settings-schema.d.ts +56 -1
- package/dist/types/config/settings.d.ts +14 -11
- package/dist/types/coordinator-mcp/policy.d.ts +5 -0
- package/dist/types/coordinator-mcp/question-gate-codec.d.ts +129 -0
- package/dist/types/coordinator-mcp/question-state.d.ts +356 -0
- package/dist/types/coordinator-mcp/server.d.ts +4 -0
- package/dist/types/discovery/helpers.d.ts +0 -6
- package/dist/types/edit/index.d.ts +3 -0
- package/dist/types/eval/py/env.d.ts +9 -0
- package/dist/types/extensibility/extensions/loader.d.ts +2 -1
- package/dist/types/extensibility/extensions/runner.d.ts +2 -2
- package/dist/types/extensibility/extensions/types.d.ts +34 -3
- package/dist/types/extensibility/hooks/runner.d.ts +1 -1
- package/dist/types/extensibility/shared-events.d.ts +2 -0
- package/dist/types/gjc-runtime/deep-interview-recorder.d.ts +10 -1
- package/dist/types/gjc-runtime/deep-interview-state.d.ts +44 -0
- package/dist/types/gjc-runtime/goal-mode-request.d.ts +11 -1
- package/dist/types/gjc-runtime/launch-worktree.d.ts +4 -2
- package/dist/types/gjc-runtime/linux-proc.d.ts +29 -0
- package/dist/types/gjc-runtime/session-resolution.d.ts +2 -2
- package/dist/types/gjc-runtime/state-migrations.d.ts +1 -1
- package/dist/types/gjc-runtime/state-writer.d.ts +2 -1
- package/dist/types/gjc-runtime/team-launch.d.ts +59 -0
- package/dist/types/gjc-runtime/team-notify.d.ts +45 -0
- package/dist/types/gjc-runtime/team-runtime.d.ts +29 -121
- package/dist/types/gjc-runtime/team-store.d.ts +160 -0
- package/dist/types/gjc-runtime/team-workers.d.ts +78 -0
- package/dist/types/gjc-runtime/tmux-owner-isolation.d.ts +8 -0
- package/dist/types/gjc-runtime/ultragoal-change-set.d.ts +13 -0
- package/dist/types/gjc-runtime/ultragoal-evidence.d.ts +38 -0
- package/dist/types/gjc-runtime/ultragoal-guard.d.ts +7 -0
- package/dist/types/gjc-runtime/ultragoal-pipeline.d.ts +23 -0
- package/dist/types/gjc-runtime/ultragoal-receipt-freshness.d.ts +11 -0
- package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +55 -33
- package/dist/types/gjc-runtime/workflow-cli-common.d.ts +8 -0
- package/dist/types/gjc-runtime/workflow-manifest.d.ts +3 -0
- package/dist/types/goals/continuation-timeout-guard.d.ts +22 -0
- package/dist/types/goals/runtime.d.ts +1 -0
- package/dist/types/goals/state.d.ts +8 -0
- package/dist/types/harness-control-plane/lifecycle-reconciliation.d.ts +17 -0
- package/dist/types/harness-control-plane/phase-rollup.d.ts +4 -7
- package/dist/types/harness-control-plane/receipt-ingest.d.ts +5 -0
- package/dist/types/harness-control-plane/receipt-spool.d.ts +4 -0
- package/dist/types/hindsight/state.d.ts +11 -4
- package/dist/types/lsp/lspmux.d.ts +5 -3
- package/dist/types/lsp/path-trust.d.ts +1 -0
- package/dist/types/main.d.ts +3 -2
- package/dist/types/memories/storage.d.ts +1 -0
- package/dist/types/modes/action-registry.d.ts +29 -0
- package/dist/types/modes/components/chrome.d.ts +14 -0
- package/dist/types/modes/components/command-palette.d.ts +27 -0
- package/dist/types/modes/components/custom-provider-wizard.d.ts +1 -0
- package/dist/types/modes/components/index.d.ts +2 -1
- package/dist/types/modes/components/pet-selector.d.ts +1 -1
- package/dist/types/modes/components/plan-preview-overlay.d.ts +43 -0
- package/dist/types/modes/components/queue-mode-selector.d.ts +1 -1
- package/dist/types/modes/components/queue-pane.d.ts +12 -0
- package/dist/types/modes/components/read-tool-group.d.ts +6 -0
- package/dist/types/modes/components/session-observer-overlay.d.ts +3 -4
- package/dist/types/modes/components/sessions-dashboard.d.ts +32 -0
- package/dist/types/modes/components/settings-selector.d.ts +1 -1
- package/dist/types/modes/components/show-images-selector.d.ts +1 -1
- package/dist/types/modes/components/status-line/types.d.ts +1 -1
- package/dist/types/modes/components/status-line.d.ts +1 -94
- package/dist/types/modes/components/tasks-pane.d.ts +15 -0
- package/dist/types/modes/components/theme-selector.d.ts +1 -1
- package/dist/types/modes/components/tool-execution.d.ts +15 -0
- package/dist/types/modes/components/tool-status-header.d.ts +111 -0
- package/dist/types/modes/components/transcript-viewer-overlay.d.ts +42 -0
- package/dist/types/modes/controllers/command-controller.d.ts +2 -2
- package/dist/types/modes/controllers/extension-ui-controller.d.ts +1 -0
- package/dist/types/modes/controllers/goal-mode-controller.d.ts +62 -0
- package/dist/types/modes/controllers/input-controller.d.ts +8 -1
- package/dist/types/modes/controllers/mode-gate.d.ts +8 -0
- package/dist/types/modes/controllers/plan-mode-controller.d.ts +65 -0
- package/dist/types/modes/controllers/selector-controller.d.ts +15 -3
- package/dist/types/modes/controllers/stt-controller.d.ts +26 -0
- package/dist/types/modes/interactive-mode.d.ts +21 -19
- package/dist/types/modes/jobs-observer.d.ts +2 -0
- package/dist/types/modes/shared/agent-wire/deep-interview-gate.d.ts +4 -11
- package/dist/types/modes/shared/agent-wire/workflow-gate-broker.d.ts +21 -2
- package/dist/types/modes/shared/agent-wire/workflow-gate-types.d.ts +31 -0
- package/dist/types/modes/tasks-aggregator.d.ts +39 -0
- package/dist/types/modes/transcript-item-registry.d.ts +60 -0
- package/dist/types/modes/types.d.ts +22 -15
- package/dist/types/modes/utils/ui-helpers.d.ts +2 -2
- package/dist/types/runtime-mcp/manager.d.ts +1 -1
- package/dist/types/sdk/broker/broker.d.ts +78 -12
- package/dist/types/sdk/broker/ensure.d.ts +9 -0
- package/dist/types/sdk/broker/lifecycle-codec.d.ts +4 -0
- package/dist/types/sdk/broker/lifecycle-ledger.d.ts +15 -1
- package/dist/types/sdk/broker/lifecycle.d.ts +6 -2
- package/dist/types/sdk/broker/process-incarnation.d.ts +2 -0
- package/dist/types/sdk/broker/session-index.d.ts +0 -1
- package/dist/types/sdk/broker/state-version.d.ts +2 -0
- package/dist/types/sdk/bus/chat-effect-journal.d.ts +1 -0
- package/dist/types/sdk/bus/config-commands.d.ts +1 -1
- package/dist/types/sdk/bus/config.d.ts +11 -0
- package/dist/types/sdk/bus/daemon-paths.d.ts +1 -0
- package/dist/types/sdk/bus/discord-daemon.d.ts +5 -0
- package/dist/types/sdk/bus/html-format.d.ts +3 -2
- package/dist/types/sdk/bus/index.d.ts +27 -0
- package/dist/types/sdk/bus/lifecycle-control-runtime.d.ts +4 -0
- package/dist/types/sdk/bus/notification-service.d.ts +20 -0
- package/dist/types/sdk/bus/rate-limit-pool.d.ts +13 -2
- package/dist/types/sdk/bus/recent-activity.d.ts +21 -12
- package/dist/types/sdk/bus/rich-document.d.ts +7 -0
- package/dist/types/sdk/bus/rich-render.d.ts +18 -41
- package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +9 -4
- package/dist/types/sdk/bus/telegram-daemon.d.ts +69 -3
- package/dist/types/sdk/bus/threaded-inbound.d.ts +1 -1
- package/dist/types/sdk/bus/threaded-render.d.ts +13 -0
- package/dist/types/sdk/bus/topic-registry.d.ts +24 -2
- 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/index.d.ts +1 -0
- package/dist/types/sdk/session-directory.d.ts +56 -0
- package/dist/types/session/agent-session.d.ts +82 -47
- package/dist/types/session/agent-storage.d.ts +7 -0
- package/dist/types/session/fallback-chain-controller.d.ts +10 -2
- package/dist/types/session/internal/managed-session-scope.d.ts +102 -0
- package/dist/types/session/internal/managed-session-storage.d.ts +38 -0
- package/dist/types/session/messages.d.ts +16 -0
- package/dist/types/session/session-manager-internal.d.ts +14 -0
- package/dist/types/session/session-manager.d.ts +82 -12
- package/dist/types/session/session-storage.d.ts +43 -3
- package/dist/types/session/volatile-context-pruning.d.ts +15 -0
- package/dist/types/skill-state/{deep-interview-mutation-guard.d.ts → workflow-mutation-guard.d.ts} +24 -8
- package/dist/types/skill-state/workflow-state-contract.d.ts +1 -3
- package/dist/types/slash-commands/builtin-registry.d.ts +4 -1
- package/dist/types/system-prompt.d.ts +2 -11
- package/dist/types/task/executor.d.ts +3 -1
- package/dist/types/thinking.d.ts +7 -0
- package/dist/types/tool-discovery/tool-index.d.ts +1 -50
- package/dist/types/tools/ask.d.ts +64 -2
- package/dist/types/tools/bash.d.ts +3 -0
- package/dist/types/tools/browser/dead-tab-recovery.d.ts +24 -0
- package/dist/types/tools/browser/tab-supervisor.d.ts +21 -0
- package/dist/types/tools/cron.d.ts +2 -0
- package/dist/types/tools/fetch.d.ts +1 -0
- package/dist/types/tools/index.d.ts +30 -15
- package/dist/types/tools/output-meta.d.ts +1 -0
- package/dist/types/tools/read.d.ts +3 -0
- package/dist/types/tools/search-tool-bm25.d.ts +3 -4
- package/dist/types/tools/subagent-render.d.ts +1 -0
- package/dist/types/tools/subagent.d.ts +6 -1
- package/dist/types/utils/event-bus.d.ts +1 -1
- package/dist/types/web/search/index.d.ts +3 -1
- package/package.json +21 -9
- package/scripts/build-sdk-package-smoke.ts +39 -1
- package/scripts/generate-hotkeys-docs.ts +74 -0
- package/scripts/generate-sdk-operation-inventory.ts +64 -20
- package/scripts/verify-gjc-sdk-canonicalization.ts +182 -2
- package/src/async/job-manager.ts +455 -69
- package/src/cli/config-cli.ts +75 -2
- package/src/cli/notify-cli.ts +92 -26
- package/src/cli/session-picker.ts +20 -3
- package/src/cli/setup-cli.ts +1 -1
- package/src/cli.ts +1 -1
- package/src/commands/config.ts +1 -1
- package/src/commands/harness.ts +34 -106
- package/src/commands/launch.ts +6 -4
- package/src/commands/mcp-serve.ts +85 -8
- package/src/commands/mcp.ts +2 -2
- package/src/commands/notify.ts +8 -4
- package/src/commands/sdk.ts +61 -40
- package/src/commands/ultragoal.ts +4 -1
- package/src/config/atomic-yaml-patch.ts +80 -13
- package/src/config/file-lock.ts +105 -43
- package/src/config/keybindings.ts +64 -20
- package/src/config/model-auth.ts +9 -0
- package/src/config/model-bindings-applier.ts +139 -0
- package/src/config/model-discovery-manager.ts +224 -0
- package/src/config/model-equivalence.ts +66 -0
- package/src/config/model-registry.ts +169 -302
- package/src/config/model-resolver.ts +361 -369
- package/src/config/models-config-schema.ts +5 -4
- package/src/config/settings-schema.ts +159 -2
- package/src/config/settings.ts +458 -482
- package/src/coordinator-mcp/policy.ts +76 -11
- package/src/coordinator-mcp/question-gate-codec.ts +274 -0
- package/src/coordinator-mcp/question-state.ts +778 -0
- package/src/coordinator-mcp/server.ts +1702 -238
- package/src/debug/index.ts +1 -1
- package/src/defaults/gjc/skills/deep-interview/SKILL.md +13 -1
- package/src/defaults/gjc/skills/team/SKILL.md +16 -0
- package/src/discovery/helpers.ts +1 -50
- package/src/edit/index.ts +64 -0
- package/src/eval/py/env.ts +26 -0
- package/src/eval/py/kernel.ts +5 -3
- package/src/extensibility/extensions/loader.ts +9 -1
- package/src/extensibility/extensions/runner.ts +12 -3
- package/src/extensibility/extensions/types.ts +39 -1
- package/src/extensibility/gjc-plugins/installer.ts +16 -16
- package/src/extensibility/hooks/runner.ts +2 -2
- package/src/extensibility/runtime-skill-discovery.ts +33 -13
- package/src/extensibility/shared-events.ts +2 -0
- package/src/gjc-runtime/deep-interview-recorder.ts +63 -3
- package/src/gjc-runtime/deep-interview-runtime.ts +76 -27
- package/src/gjc-runtime/deep-interview-state.ts +317 -5
- package/src/gjc-runtime/goal-mode-request.ts +55 -8
- package/src/gjc-runtime/launch-tmux.ts +2 -5
- package/src/gjc-runtime/launch-worktree.ts +5 -5
- package/src/gjc-runtime/linux-proc.ts +71 -0
- package/src/gjc-runtime/ralplan-runtime.ts +74 -90
- package/src/gjc-runtime/session-resolution.ts +18 -3
- package/src/gjc-runtime/session-state-sidecar.ts +6 -107
- package/src/gjc-runtime/state-migrations.ts +1 -1
- package/src/gjc-runtime/state-runtime.ts +320 -249
- package/src/gjc-runtime/state-writer.ts +36 -40
- package/src/gjc-runtime/team-launch.ts +319 -0
- package/src/gjc-runtime/team-notify.ts +326 -0
- package/src/gjc-runtime/team-runtime.ts +1099 -1482
- package/src/gjc-runtime/team-store.ts +828 -0
- package/src/gjc-runtime/team-workers.ts +962 -0
- package/src/gjc-runtime/tmux-owner-isolation-cli.ts +2 -11
- package/src/gjc-runtime/tmux-owner-isolation.ts +14 -9
- package/src/gjc-runtime/tmux-sessions.ts +4 -21
- package/src/gjc-runtime/ultragoal-change-set.ts +172 -0
- package/src/gjc-runtime/ultragoal-evidence.ts +874 -0
- package/src/gjc-runtime/ultragoal-guard.ts +83 -12
- package/src/gjc-runtime/ultragoal-pipeline.ts +306 -0
- package/src/gjc-runtime/ultragoal-receipt-freshness.ts +102 -1
- package/src/gjc-runtime/ultragoal-runtime.ts +156 -1319
- package/src/gjc-runtime/workflow-cli-common.ts +30 -0
- package/src/gjc-runtime/workflow-manifest.generated.json +58 -0
- package/src/gjc-runtime/workflow-manifest.ts +18 -0
- package/src/goals/continuation-timeout-guard.ts +79 -0
- package/src/goals/runtime.ts +7 -5
- package/src/goals/state.ts +18 -0
- package/src/harness-control-plane/lifecycle-reconciliation.ts +64 -0
- package/src/harness-control-plane/phase-rollup.ts +4 -7
- package/src/harness-control-plane/receipt-ingest.ts +5 -0
- package/src/harness-control-plane/receipt-spool.ts +51 -7
- package/src/harness-control-plane/session-lease.ts +12 -130
- package/src/hindsight/backend.ts +26 -27
- package/src/hindsight/state.ts +101 -32
- package/src/hooks/skill-state.ts +17 -11
- package/src/internal-urls/docs-index.generated.ts +21 -18
- package/src/lsp/client.ts +1 -1
- package/src/lsp/config.ts +145 -26
- package/src/lsp/index.ts +1 -1
- package/src/lsp/lspmux.ts +39 -10
- package/src/lsp/path-trust.ts +81 -0
- package/src/main.ts +28 -8
- package/src/memories/index.ts +1 -0
- package/src/memories/storage.ts +6 -2
- package/src/modes/action-registry.ts +165 -0
- package/src/modes/components/chrome.ts +40 -0
- package/src/modes/components/command-palette.ts +168 -0
- package/src/modes/components/custom-editor.ts +1 -1
- package/src/modes/components/custom-provider-wizard.ts +51 -14
- package/src/modes/components/index.ts +2 -1
- package/src/modes/components/pet-selector.ts +11 -17
- package/src/modes/components/plan-preview-overlay.ts +295 -0
- package/src/modes/components/queue-mode-selector.ts +10 -27
- package/src/modes/components/queue-pane.ts +79 -0
- package/src/modes/components/read-tool-group.ts +13 -0
- package/src/modes/components/session-observer-overlay.ts +207 -772
- package/src/modes/components/sessions-dashboard.ts +181 -0
- package/src/modes/components/settings-selector.ts +1 -1
- package/src/modes/components/show-images-selector.ts +10 -24
- package/src/modes/components/status-line/types.ts +1 -1
- package/src/modes/components/status-line.ts +1 -969
- package/src/modes/components/tasks-pane.ts +73 -0
- package/src/modes/components/theme-selector.ts +11 -31
- package/src/modes/components/tool-execution.ts +22 -0
- package/src/modes/components/tool-status-header.ts +1056 -0
- package/src/modes/components/transcript-viewer-overlay.ts +384 -0
- package/src/modes/controllers/btw-controller.ts +1 -0
- package/src/modes/controllers/command-controller.ts +9 -15
- package/src/modes/controllers/event-controller.ts +3 -2
- package/src/modes/controllers/extension-ui-controller.ts +72 -25
- package/src/modes/controllers/goal-mode-controller.ts +474 -0
- package/src/modes/controllers/input-controller.ts +764 -229
- package/src/modes/controllers/mode-gate.ts +24 -0
- package/src/modes/controllers/plan-mode-controller.ts +517 -0
- package/src/modes/controllers/selector-controller.ts +225 -10
- package/src/modes/controllers/stt-controller.ts +125 -0
- package/src/modes/interactive-mode.ts +302 -1151
- package/src/modes/jobs-observer.ts +3 -0
- package/src/modes/runtime-init.ts +8 -0
- package/src/modes/shared/agent-wire/deep-interview-gate.ts +31 -106
- package/src/modes/shared/agent-wire/workflow-gate-broker.ts +78 -19
- package/src/modes/shared/agent-wire/workflow-gate-types.ts +177 -0
- package/src/modes/tasks-aggregator.ts +199 -0
- package/src/modes/transcript-item-registry.ts +229 -0
- package/src/modes/types.ts +47 -20
- package/src/modes/utils/ui-helpers.ts +17 -9
- package/src/prompts/agent-fragments/ralplan-persistence.md +6 -0
- package/src/prompts/agent-fragments/restricted-bash.md +1 -0
- package/src/prompts/agents/architect.md +2 -8
- package/src/prompts/agents/critic.md +2 -8
- package/src/prompts/agents/executor.md +3 -0
- package/src/prompts/agents/planner.md +4 -12
- package/src/prompts/system/custom-system-prompt.md +1 -23
- package/src/prompts/system/plan-mode-approved.md +8 -0
- package/src/prompts/system/system-prompt.md +17 -96
- package/src/prompts/tools/bash.md +4 -4
- package/src/prompts/tools/browser.md +15 -52
- package/src/prompts/tools/find.md +2 -2
- package/src/prompts/tools/hashline.md +13 -55
- package/src/prompts/tools/read.md +3 -6
- package/src/prompts/tools/search-tool-bm25.md +0 -2
- package/src/prompts/tools/search.md +2 -4
- package/src/prompts/tools/skill-discovery.md +1 -2
- package/src/prompts/tools/task.md +1 -1
- package/src/runtime-mcp/manager.ts +1 -1
- package/src/sdk/broker/broker.ts +206 -78
- package/src/sdk/broker/discovery.ts +21 -2
- package/src/sdk/broker/ensure.ts +85 -25
- package/src/sdk/broker/lifecycle-codec.ts +11 -0
- package/src/sdk/broker/lifecycle-ledger.ts +371 -74
- package/src/sdk/broker/lifecycle.ts +1399 -142
- package/src/sdk/broker/process-incarnation.ts +5 -13
- package/src/sdk/broker/session-index.ts +145 -56
- package/src/sdk/broker/state-version.ts +21 -0
- package/src/sdk/broker/transport.ts +1 -1
- package/src/sdk/bus/chat-daemon-cli.ts +2 -0
- package/src/sdk/bus/chat-daemon-control.ts +8 -28
- package/src/sdk/bus/chat-effect-journal.ts +14 -4
- package/src/sdk/bus/config-commands.ts +5 -4
- package/src/sdk/bus/config.ts +98 -0
- package/src/sdk/bus/conversation-store.ts +5 -29
- package/src/sdk/bus/daemon-paths.ts +2 -0
- package/src/sdk/bus/discord-daemon.ts +25 -8
- package/src/sdk/bus/html-format.ts +20 -3
- package/src/sdk/bus/index.ts +834 -113
- package/src/sdk/bus/lifecycle-control-runtime.ts +91 -33
- package/src/sdk/bus/native-runtime-compatibility.ts +1 -1
- package/src/sdk/bus/natives-augment.d.ts +26 -1
- package/src/sdk/bus/notification-service.ts +168 -20
- package/src/sdk/bus/rate-limit-pool.ts +58 -14
- package/src/sdk/bus/recent-activity.ts +188 -74
- package/src/sdk/bus/rich-document.ts +258 -0
- package/src/sdk/bus/rich-render.ts +62 -70
- package/src/sdk/bus/telegram-daemon-cli.ts +15 -59
- package/src/sdk/bus/telegram-daemon-contract.ts +9 -4
- package/src/sdk/bus/telegram-daemon.ts +1491 -247
- package/src/sdk/bus/threaded-inbound.ts +8 -3
- package/src/sdk/bus/threaded-render.ts +57 -1
- package/src/sdk/bus/topic-registry.ts +120 -13
- package/src/sdk/host/control/dispatch.ts +14 -2
- package/src/sdk/host/control/operations.ts +6 -1
- package/src/sdk/host/host.ts +31 -1
- package/src/sdk/host/query/handlers.ts +20 -22
- package/src/sdk/host/query/revision-store.ts +80 -57
- package/src/sdk/index.ts +1 -0
- package/src/sdk/protocol/operation-inventory.generated.json +943 -1907
- package/src/sdk/session-directory.ts +141 -0
- package/src/sdk/session.ts +458 -479
- package/src/session/agent-session.ts +1901 -637
- package/src/session/agent-storage.ts +18 -0
- package/src/session/cache-economics.ts +25 -8
- package/src/session/fallback-chain-controller.ts +53 -3
- package/src/session/internal/managed-session-scope.ts +2226 -0
- package/src/session/internal/managed-session-storage.ts +453 -0
- package/src/session/messages.ts +91 -2
- package/src/session/session-manager-internal.ts +33 -0
- package/src/session/session-manager.ts +1112 -333
- package/src/session/session-storage.ts +444 -39
- package/src/session/volatile-context-pruning.ts +78 -0
- package/src/setup/credential-auto-import.ts +2 -1
- package/src/setup/hermes/templates/operator-instructions.v1.md +1 -1
- package/src/setup/provider-onboarding.ts +36 -61
- package/src/setup/provider-presets.json +5 -0
- package/src/skill-state/active-state.ts +3 -13
- package/src/skill-state/{deep-interview-mutation-guard.ts → workflow-mutation-guard.ts} +47 -29
- package/src/skill-state/workflow-state-contract.ts +6 -41
- package/src/slash-commands/builtin-registry.ts +46 -11
- package/src/system-prompt.ts +37 -44
- package/src/task/agents.ts +19 -1
- package/src/task/executor.ts +90 -6
- package/src/task/index.ts +62 -37
- package/src/thinking.ts +21 -6
- package/src/tool-discovery/tool-index.ts +2 -134
- package/src/tools/ask.ts +157 -21
- package/src/tools/ast-edit.ts +1 -1
- package/src/tools/bash.ts +38 -0
- package/src/tools/browser/dead-tab-recovery.ts +78 -0
- package/src/tools/browser/tab-supervisor.ts +282 -36
- package/src/tools/computer.ts +10 -3
- package/src/tools/cron.ts +30 -16
- package/src/tools/eval.ts +1 -2
- package/src/tools/fetch.ts +11 -4
- package/src/tools/index.ts +76 -24
- package/src/tools/output-meta.ts +13 -5
- package/src/tools/read.ts +37 -1
- package/src/tools/resource-gc.ts +2 -2
- package/src/tools/search-tool-bm25.ts +11 -74
- package/src/tools/subagent-render.ts +19 -8
- package/src/tools/subagent.ts +84 -32
- package/src/utils/event-bus.ts +9 -4
- package/src/web/search/index.ts +3 -3
- package/dist/types/discovery/plugin-dir-roots.d.ts +0 -15
- package/dist/types/runtime-mcp/discoverable-tool-metadata.d.ts +0 -7
- package/src/discovery/plugin-dir-roots.ts +0 -28
- package/src/runtime-mcp/discoverable-tool-metadata.ts +0 -25
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type DeadTabRecoveryConsumeStatus = "consumed" | "expired_or_missing" | "owner_mismatch";
|
|
2
|
+
export interface DeadTabRecoveryConsumeResult<T> {
|
|
3
|
+
status: DeadTabRecoveryConsumeStatus;
|
|
4
|
+
descriptor?: T;
|
|
5
|
+
}
|
|
6
|
+
interface DeadTabRecoveryDeps {
|
|
7
|
+
now(): number;
|
|
8
|
+
onPeek(): void;
|
|
9
|
+
}
|
|
10
|
+
/** Store a short-lived immutable recovery descriptor for a dead tab worker. */
|
|
11
|
+
export declare function registerDeadTabRecovery<T extends object>(name: string, ownerId: string | undefined, descriptor: T, ttlMs?: number): void;
|
|
12
|
+
/**
|
|
13
|
+
* Check whether a recovery descriptor may be consumed by this owner. The test hook is
|
|
14
|
+
* intentionally synchronous: recovery must not yield between this check and consume.
|
|
15
|
+
*/
|
|
16
|
+
export declare function peekDeadTabRecovery<T>(name: string, ownerId: string | undefined): DeadTabRecoveryConsumeResult<T>;
|
|
17
|
+
/** Consume only a live descriptor belonging to the expected owner. */
|
|
18
|
+
export declare function consumeDeadTabRecovery<T>(name: string, ownerId: string | undefined): DeadTabRecoveryConsumeResult<T>;
|
|
19
|
+
export declare function discardDeadTabRecovery(name: string): void;
|
|
20
|
+
/** Whether an unconsumed descriptor remains live at the supplied policy clock. */
|
|
21
|
+
export declare function isDeadTabRecoveryLive(name: string, now: number): boolean;
|
|
22
|
+
export declare function __setDeadTabRecoveryDepsForTest(overrides: Partial<DeadTabRecoveryDeps>): void;
|
|
23
|
+
export declare function __resetDeadTabRecoveryForTest(): void;
|
|
24
|
+
export {};
|
|
@@ -26,6 +26,8 @@ export interface TabSession {
|
|
|
26
26
|
pending: Map<string, PendingRun>;
|
|
27
27
|
dialogPolicy?: DialogPolicy;
|
|
28
28
|
kindTag: BrowserKindTag;
|
|
29
|
+
/** Immutable inputs needed to recreate this worker after an unexpected exit. */
|
|
30
|
+
recoveryOpts: AcquireTabOptions;
|
|
29
31
|
/** Session that acquired this tab; used for session-scoped teardown (F13). */
|
|
30
32
|
ownerId?: string;
|
|
31
33
|
/** Unix-ms timestamp of the last acquire/run activity; drives GC idle + LRU ordering. */
|
|
@@ -47,6 +49,10 @@ export interface AcquireTabOptions {
|
|
|
47
49
|
dialogs?: DialogPolicy;
|
|
48
50
|
/** Owning session id so dispose can release only this session's tabs (F13). */
|
|
49
51
|
ownerId?: string;
|
|
52
|
+
/** Internal recovery-only target id; makes a headless replacement attach, not open a page. */
|
|
53
|
+
recoveryTargetId?: string;
|
|
54
|
+
/** Recovery fence: replacement must not overwrite a tab installed after dead teardown. */
|
|
55
|
+
requireVacantName?: boolean;
|
|
50
56
|
}
|
|
51
57
|
export interface AcquireTabResult {
|
|
52
58
|
tab: TabSession;
|
|
@@ -68,6 +74,13 @@ export interface ReleaseTabOptions {
|
|
|
68
74
|
deadlineAt?: number;
|
|
69
75
|
}
|
|
70
76
|
export declare function getTab(name: string): TabSession | undefined;
|
|
77
|
+
/** Test-only: exercise the same hold-transfer primitive used by replacement recovery. */
|
|
78
|
+
export declare function withTemporaryBrowserHoldForTest<T>(browser: BrowserHandle, work: () => Promise<T>): Promise<T>;
|
|
79
|
+
/** Test-only: close exactly the target belonging to the supplied dead session. */
|
|
80
|
+
export declare function closeOrphanTargetForTest(tab: TabSession): Promise<void>;
|
|
81
|
+
/** Test-only: install an in-flight recovery and observe owner isolation. */
|
|
82
|
+
export declare function __setRecoveringTabForTest(name: string, ownerId: string | undefined, promise: Promise<TabSession>): void;
|
|
83
|
+
export declare function recoveryPromiseForOwnerForTest(name: string, ownerId: string | undefined): Promise<TabSession> | undefined;
|
|
71
84
|
/** Read-only, GC-facing projection of a live tab. Never exposes the mutable `tabs` map. */
|
|
72
85
|
export interface TabGcSnapshot {
|
|
73
86
|
name: string;
|
|
@@ -95,8 +108,15 @@ export declare function releaseTabIfGcEligible(name: string, policy: BrowserGcEl
|
|
|
95
108
|
export declare function setTabForTest(tab: TabSession): void;
|
|
96
109
|
/** Test-only: clear the tab registry between cases. */
|
|
97
110
|
export declare function clearTabsForTest(): void;
|
|
111
|
+
export declare function __setAfterWorkerInitializationForTest(callback: ((name: string) => void) | undefined): void;
|
|
112
|
+
export declare function __setAcquireTabWorkerDepsForTest(factory: (() => Promise<WorkerHandle>) | undefined, initializer: ((worker: WorkerHandle, payload: WorkerInitPayload, timeoutMs: number) => Promise<ReadyInfo>) | undefined): void;
|
|
98
113
|
export declare function acquireTab(name: string, browser: BrowserHandle, opts: AcquireTabOptions): Promise<AcquireTabResult>;
|
|
99
114
|
export declare function runInTab(name: string, opts: RunInTabOptions): Promise<RunResultOk>;
|
|
115
|
+
/**
|
|
116
|
+
* Claim and release exactly the dead tab that produced a recovery descriptor. Every
|
|
117
|
+
* predicate and the release election run synchronously before teardown can await.
|
|
118
|
+
*/
|
|
119
|
+
export declare function releaseDeadTabForRecovery(name: string, expected: TabSession, ownerId: string | undefined, preserveHeadlessTarget?: boolean): Promise<boolean>;
|
|
100
120
|
export declare function releaseTab(name: string, opts?: ReleaseTabOptions): Promise<boolean>;
|
|
101
121
|
export declare function releaseAllTabs(opts?: ReleaseTabOptions): Promise<number>;
|
|
102
122
|
/**
|
|
@@ -105,5 +125,6 @@ export declare function releaseAllTabs(opts?: ReleaseTabOptions): Promise<number
|
|
|
105
125
|
*/
|
|
106
126
|
export declare function releaseTabsForOwner(ownerId: string | null | undefined, opts?: ReleaseTabOptions): Promise<number>;
|
|
107
127
|
export declare function dropHeadlessTabs(): Promise<void>;
|
|
128
|
+
export declare function buildInitPayloadForTest(browser: BrowserHandle, opts: AcquireTabOptions): Promise<WorkerInitPayload>;
|
|
108
129
|
export declare function initializeTabWorkerForTest(worker: WorkerHandle, payload: WorkerInitPayload, timeoutMs: number): Promise<ReadyInfo>;
|
|
109
130
|
export {};
|
|
@@ -62,6 +62,7 @@ export declare function loadReadUrlCacheEntry(session: ToolSession, params: {
|
|
|
62
62
|
ensureArtifact?: boolean;
|
|
63
63
|
preferCached?: boolean;
|
|
64
64
|
}): Promise<ReadUrlCacheEntry>;
|
|
65
|
+
export declare function wrapUntrustedContent(content: string): string;
|
|
65
66
|
export declare function executeReadUrl(session: ToolSession, params: {
|
|
66
67
|
path: string;
|
|
67
68
|
raw?: boolean;
|
|
@@ -68,7 +68,6 @@ export type ContextFileEntry = {
|
|
|
68
68
|
content: string;
|
|
69
69
|
depth?: number;
|
|
70
70
|
};
|
|
71
|
-
export type { DiscoverableMCPTool } from "../runtime-mcp/discoverable-tool-metadata";
|
|
72
71
|
export type { DiscoverableTool, DiscoverableToolSearchIndex, DiscoverableToolSearchResult, DiscoverableToolSource, } from "../tool-discovery/tool-index";
|
|
73
72
|
/** A typed remote action available to an ask answer source. */
|
|
74
73
|
export type AskRemoteControlId = "navigation_forward";
|
|
@@ -202,6 +201,8 @@ export interface ToolSession {
|
|
|
202
201
|
bashRestrictionProfile?: BashRestrictionProfile;
|
|
203
202
|
/** Optional per-session allowlist for tools exposed through search_tool_bm25. */
|
|
204
203
|
discoverableToolAllowedNames?: readonly string[];
|
|
204
|
+
/** Throw instead of warn when toolNames contains an unknown name. */
|
|
205
|
+
strictToolNames?: boolean;
|
|
205
206
|
/** Get artifacts directory for artifact:// URLs */
|
|
206
207
|
getArtifactsDir?: () => string | null;
|
|
207
208
|
/** Get the ArtifactManager backing this session (shared across parent + subagents). */
|
|
@@ -253,18 +254,6 @@ export interface ToolSession {
|
|
|
253
254
|
getTodoPhases?: () => TodoPhase[];
|
|
254
255
|
/** Replace cached todo phases for this session. */
|
|
255
256
|
setTodoPhases?: (phases: TodoPhase[]) => void;
|
|
256
|
-
/** Whether MCP tool discovery is active for this session. */
|
|
257
|
-
isMCPDiscoveryEnabled?: () => boolean;
|
|
258
|
-
/** Get hidden-but-discoverable MCP tools for search_tool_bm25 prompts and fallbacks.
|
|
259
|
-
* @deprecated Use getDiscoverableTools with source filter instead. */
|
|
260
|
-
getDiscoverableMCPTools?: () => import("../runtime-mcp/discoverable-tool-metadata").DiscoverableMCPTool[];
|
|
261
|
-
/** Get the cached discoverable MCP search index for search_tool_bm25 execution.
|
|
262
|
-
* @deprecated Use getDiscoverableToolSearchIndex instead. */
|
|
263
|
-
getDiscoverableMCPSearchIndex?: () => import("../tool-discovery/tool-index").DiscoverableMCPSearchIndex;
|
|
264
|
-
/** Get MCP tools activated by prior search_tool_bm25 calls. */
|
|
265
|
-
getSelectedMCPToolNames?: () => string[];
|
|
266
|
-
/** Merge MCP tool selections into the active session tool set. */
|
|
267
|
-
activateDiscoveredMCPTools?: (toolNames: string[]) => Promise<string[]>;
|
|
268
257
|
/** Whether any form of tool discovery is active (tools.discoveryMode !== "off" or mcp.discoveryMode). */
|
|
269
258
|
isToolDiscoveryEnabled?: () => boolean;
|
|
270
259
|
/** Get all hidden-but-discoverable tools for search_tool_bm25 prompts. */
|
|
@@ -358,13 +347,39 @@ export interface EvalBackendsAllowance {
|
|
|
358
347
|
python: boolean;
|
|
359
348
|
js: boolean;
|
|
360
349
|
}
|
|
350
|
+
/**
|
|
351
|
+
* Parse the `GJC_PY` multi-value token into per-backend booleans.
|
|
352
|
+
*
|
|
353
|
+
* Tokens (case-insensitive):
|
|
354
|
+
* - `0` / `bash` → JavaScript only (`{ py: false, js: true }`)
|
|
355
|
+
* - `1` / `py` → Python only (`{ py: true, js: false }`)
|
|
356
|
+
* - `js` → JavaScript only (`{ py: false, js: true }`)
|
|
357
|
+
* - `mix` / `both` → both backends (`{ py: true, js: true }`)
|
|
358
|
+
*
|
|
359
|
+
* Returns `null` when `GJC_PY` is unset, empty, or holds an unrecognized
|
|
360
|
+
* token, so the caller can fall back to the legacy `PI_PY` / `PI_JS` flags or
|
|
361
|
+
* per-key settings. This matches the documented contract that invalid values
|
|
362
|
+
* are ignored.
|
|
363
|
+
*/
|
|
364
|
+
export declare function parseGjcPy(env: Record<string, string | undefined>): {
|
|
365
|
+
py: boolean;
|
|
366
|
+
js: boolean;
|
|
367
|
+
} | null;
|
|
368
|
+
/**
|
|
369
|
+
* Resolve eval-backend allowance from environment only. `GJC_PY` wins when set
|
|
370
|
+
* to a recognized token; otherwise the legacy `PI_PY` / `PI_JS` flags apply.
|
|
371
|
+
* Returns `null` when no env override is set so the caller can defer to settings.
|
|
372
|
+
*/
|
|
373
|
+
export declare function resolveEvalBackendsFromEnv(env: Record<string, string | undefined>): EvalBackendsAllowance | null;
|
|
361
374
|
/** Read per-backend allowance from settings (defaults true). */
|
|
362
375
|
export declare function readEvalBackendsAllowance(session: ToolSession): EvalBackendsAllowance;
|
|
363
376
|
/**
|
|
364
|
-
* Materialize the active eval backend allowance
|
|
365
|
-
*
|
|
377
|
+
* Materialize the active eval backend allowance. `GJC_PY` takes precedence
|
|
378
|
+
* over the legacy `PI_PY` / `PI_JS` env flags, which in turn override the
|
|
379
|
+
* per-key settings (defaults true). When no env override is set, settings win.
|
|
366
380
|
*/
|
|
367
381
|
export declare function resolveEvalBackends(session: ToolSession): EvalBackendsAllowance;
|
|
382
|
+
export { resolvePythonIntegrationGate, resolvePythonIpcTrace, resolvePythonSkipCheck, } from "../eval/py/env";
|
|
368
383
|
/**
|
|
369
384
|
* Create tools from BUILTIN_TOOLS registry.
|
|
370
385
|
*/
|
|
@@ -10,6 +10,8 @@ declare const readSchema: z.ZodObject<{
|
|
|
10
10
|
path: z.ZodString;
|
|
11
11
|
}, z.core.$strict>;
|
|
12
12
|
export type ReadToolInput = z.infer<typeof readSchema>;
|
|
13
|
+
/** Project paths and output sizes without exposing read content or remote URLs. */
|
|
14
|
+
export declare function summarizeReadToolActivity(kind: "args" | "result", value: unknown): string | undefined;
|
|
13
15
|
export interface ReadToolDetails {
|
|
14
16
|
kind?: "file" | "url";
|
|
15
17
|
truncation?: TruncationResult;
|
|
@@ -59,6 +61,7 @@ export declare class ReadTool implements AgentTool<typeof readSchema, ReadToolDe
|
|
|
59
61
|
}, z.core.$strict>;
|
|
60
62
|
readonly nonAbortable = true;
|
|
61
63
|
readonly strict = true;
|
|
64
|
+
readonly safeSummary: typeof summarizeReadToolActivity;
|
|
62
65
|
constructor(session: ToolSession);
|
|
63
66
|
execute(_toolCallId: string, params: ReadParams, signal?: AbortSignal, _onUpdate?: AgentToolUpdateCallback<ReadToolDetails>, _toolContext?: AgentToolContext): Promise<AgentToolResult<ReadToolDetails>>;
|
|
64
67
|
}
|
|
@@ -3,9 +3,7 @@ import type { Component } from "@gajae-code/tui";
|
|
|
3
3
|
import * as z from "zod/v4";
|
|
4
4
|
import type { RenderResultOptions } from "../extensibility/custom-tools/types";
|
|
5
5
|
import type { Theme } from "../modes/theme/theme";
|
|
6
|
-
import { type DiscoverableTool } from "../tool-discovery/tool-index";
|
|
7
6
|
import type { ToolSession } from ".";
|
|
8
|
-
export type { DiscoverableMCPSearchIndex, DiscoverableMCPTool, } from "../runtime-mcp/discoverable-tool-metadata";
|
|
9
7
|
declare const searchToolBm25Schema: z.ZodObject<{
|
|
10
8
|
query: z.ZodString;
|
|
11
9
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
@@ -28,7 +26,7 @@ export interface SearchToolBm25Details {
|
|
|
28
26
|
active_selected_tools: string[];
|
|
29
27
|
tools: SearchToolBm25Match[];
|
|
30
28
|
}
|
|
31
|
-
export declare function renderSearchToolBm25Description(
|
|
29
|
+
export declare function renderSearchToolBm25Description(): string;
|
|
32
30
|
/**
|
|
33
31
|
* SearchToolsTool — wire name `search_tool_bm25` (preserved for persisted session back-compat).
|
|
34
32
|
*
|
|
@@ -40,7 +38,7 @@ export declare class SearchToolBm25Tool implements AgentTool<typeof searchToolBm
|
|
|
40
38
|
readonly name = "search_tool_bm25";
|
|
41
39
|
readonly label = "SearchTools";
|
|
42
40
|
readonly loadMode = "essential";
|
|
43
|
-
|
|
41
|
+
readonly description: string;
|
|
44
42
|
readonly parameters: z.ZodObject<{
|
|
45
43
|
query: z.ZodString;
|
|
46
44
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
@@ -63,3 +61,4 @@ export declare const searchToolBm25Renderer: {
|
|
|
63
61
|
mergeCallAndResult: boolean;
|
|
64
62
|
inline: boolean;
|
|
65
63
|
};
|
|
64
|
+
export {};
|
|
@@ -11,6 +11,7 @@ import type { Component } from "@gajae-code/tui";
|
|
|
11
11
|
import type { RenderResultOptions } from "../extensibility/custom-tools/types";
|
|
12
12
|
import type { Theme } from "../modes/theme/theme";
|
|
13
13
|
import { type SubagentToolDetails } from "./subagent";
|
|
14
|
+
export { subagentAwaitRenderedStateSignature } from "./subagent";
|
|
14
15
|
/** Test-only seam (PR3 deterministic cache-hit assertions). */
|
|
15
16
|
export declare const subagentBodyCacheTestHooks: {
|
|
16
17
|
readonly bodyRenders: number;
|
|
@@ -56,8 +56,13 @@ export interface SubagentSnapshot {
|
|
|
56
56
|
/** True when the requested model lacked credentials and fell back to the parent model. */
|
|
57
57
|
modelFellBack?: boolean;
|
|
58
58
|
}
|
|
59
|
+
export type SubagentAwaitOutcome = "completed" | "timed_out" | "interrupted";
|
|
59
60
|
export interface SubagentToolDetails {
|
|
60
61
|
subagents: SubagentSnapshot[];
|
|
62
|
+
/** Await outcome for a live await receipt; omitted when no wait was started. */
|
|
63
|
+
awaitOutcome?: SubagentAwaitOutcome;
|
|
64
|
+
/** True only when the parent await was interrupted; the child was not cancelled. */
|
|
65
|
+
interrupted?: true;
|
|
61
66
|
}
|
|
62
67
|
export declare class SubagentTool implements AgentTool<typeof subagentSchema, SubagentToolDetails> {
|
|
63
68
|
#private;
|
|
@@ -113,5 +118,5 @@ export declare class SubagentTool implements AgentTool<typeof subagentSchema, Su
|
|
|
113
118
|
* countdown ticking is sacrificed by design; every real transition still changes
|
|
114
119
|
* the signature.
|
|
115
120
|
*/
|
|
116
|
-
export declare function subagentAwaitRenderedStateSignature(subagents: readonly SubagentSnapshot[]): string;
|
|
121
|
+
export declare function subagentAwaitRenderedStateSignature(subagents: readonly SubagentSnapshot[], receipt?: Pick<SubagentToolDetails, "awaitOutcome" | "interrupted">): string;
|
|
117
122
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare class EventBus {
|
|
2
2
|
#private;
|
|
3
3
|
emit(channel: string, data: unknown): void;
|
|
4
|
-
on(channel: string, handler: (data: unknown) => void): () => void;
|
|
4
|
+
on(channel: string, handler: (data: unknown) => void | PromiseLike<void>): () => void;
|
|
5
5
|
clear(): void;
|
|
6
6
|
}
|
|
@@ -10,7 +10,7 @@ import * as z from "zod/v4";
|
|
|
10
10
|
import type { CustomTool } from "../../extensibility/custom-tools/types";
|
|
11
11
|
import type { ToolSession } from "../../tools";
|
|
12
12
|
import { type SearchRenderDetails } from "./render";
|
|
13
|
-
import type { ActiveSearchModelContext, SearchProviderId } from "./types";
|
|
13
|
+
import type { ActiveSearchModelContext, SearchProviderId, SearchResponse } from "./types";
|
|
14
14
|
/** Web search tool parameters schema */
|
|
15
15
|
export declare const webSearchSchema: z.ZodObject<{
|
|
16
16
|
query: z.ZodString;
|
|
@@ -44,6 +44,8 @@ export type SearchToolParams = z.infer<typeof webSearchSchema>;
|
|
|
44
44
|
export interface SearchQueryParams extends SearchToolParams {
|
|
45
45
|
provider?: SearchProviderId | "auto";
|
|
46
46
|
}
|
|
47
|
+
/** Format response for LLM consumption */
|
|
48
|
+
export declare function formatSearchResponseForLlm(response: SearchResponse): string;
|
|
47
49
|
/** Override the hedge delay (tests). Non-finite/non-positive resets to default. */
|
|
48
50
|
export declare function setDdgHedgeDelayMs(ms: number | undefined): void;
|
|
49
51
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@gajae-code/coding-agent",
|
|
4
|
-
"version": "0.11.
|
|
4
|
+
"version": "0.11.2",
|
|
5
5
|
"description": "Gajae Code CLI with read, bash, edit, write tools and session management",
|
|
6
6
|
"homepage": "https://gajae-code.com",
|
|
7
7
|
"author": "Yeachan-Heo and Gajae Code Contributors",
|
|
@@ -29,10 +29,12 @@
|
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
31
|
"build": "bun scripts/build-binary.ts",
|
|
32
|
-
"check": "biome check . && bun run
|
|
32
|
+
"check": "biome check . && bun run check:types",
|
|
33
|
+
"check:runtime": "bun run generate-hotkeys-docs --check && bun run verify:sdk-canonicalization",
|
|
33
34
|
"check:types": "tsc -p tsconfig.json --noEmit",
|
|
34
35
|
"lint": "biome lint .",
|
|
35
36
|
"test": "bun test",
|
|
37
|
+
"generate-hotkeys-docs": "bun scripts/generate-hotkeys-docs.ts",
|
|
36
38
|
"bench:context": "bun run bench/context-optimization.bench.ts",
|
|
37
39
|
"generate-schemas": "bun ../../scripts/generate-json-schemas.ts",
|
|
38
40
|
"check:schemas": "bun ../../scripts/generate-json-schemas.ts --check",
|
|
@@ -51,13 +53,13 @@
|
|
|
51
53
|
"@agentclientprotocol/sdk": "1.2.1",
|
|
52
54
|
"@babel/parser": "^7.29.3",
|
|
53
55
|
"@mozilla/readability": "^0.6.0",
|
|
54
|
-
"@gajae-code/stats": "0.11.
|
|
55
|
-
"@gajae-code/agent-core": "0.11.
|
|
56
|
-
"@gajae-code/ai": "0.11.
|
|
57
|
-
"@gajae-code/bridge-client": "0.11.
|
|
58
|
-
"@gajae-code/natives": "0.11.
|
|
59
|
-
"@gajae-code/tui": "0.11.
|
|
60
|
-
"@gajae-code/utils": "0.11.
|
|
56
|
+
"@gajae-code/stats": "0.11.2",
|
|
57
|
+
"@gajae-code/agent-core": "0.11.2",
|
|
58
|
+
"@gajae-code/ai": "0.11.2",
|
|
59
|
+
"@gajae-code/bridge-client": "0.11.2",
|
|
60
|
+
"@gajae-code/natives": "0.11.2",
|
|
61
|
+
"@gajae-code/tui": "0.11.2",
|
|
62
|
+
"@gajae-code/utils": "0.11.2",
|
|
61
63
|
"@puppeteer/browsers": "^2.13.0",
|
|
62
64
|
"@types/turndown": "5.0.6",
|
|
63
65
|
"@xterm/headless": "^6.0.0",
|
|
@@ -68,6 +70,7 @@
|
|
|
68
70
|
"linkedom": "^0.18.12",
|
|
69
71
|
"lru-cache": "11.3.6",
|
|
70
72
|
"markit-ai": "0.5.3",
|
|
73
|
+
"marked": "18.0.6",
|
|
71
74
|
"puppeteer-core": "^24.42.0",
|
|
72
75
|
"turndown": "7.2.4",
|
|
73
76
|
"turndown-plugin-gfm": "1.0.2",
|
|
@@ -121,6 +124,8 @@
|
|
|
121
124
|
"./modes/components/runtime-mcp-add-wizard": null,
|
|
122
125
|
"./modes/controllers/runtime-mcp-command-controller": null,
|
|
123
126
|
"./slash-commands/helpers/mcp": null,
|
|
127
|
+
"./session/session-manager-internal": null,
|
|
128
|
+
"./session/session-manager-internal.js": null,
|
|
124
129
|
"./sdk": {
|
|
125
130
|
"types": "./dist/types/sdk/index.d.ts",
|
|
126
131
|
"import": "./src/sdk/index.ts"
|
|
@@ -139,6 +144,13 @@
|
|
|
139
144
|
"types": "./dist/types/sdk/bus/*.d.ts",
|
|
140
145
|
"import": "./src/sdk/bus/*.ts"
|
|
141
146
|
},
|
|
147
|
+
"./session/internal/*": null,
|
|
148
|
+
"./config/model-auth": null,
|
|
149
|
+
"./config/model-auth.js": null,
|
|
150
|
+
"./config/model-bindings-applier": null,
|
|
151
|
+
"./config/model-bindings-applier.js": null,
|
|
152
|
+
"./config/model-discovery-manager": null,
|
|
153
|
+
"./config/model-discovery-manager.js": null,
|
|
142
154
|
"./*": {
|
|
143
155
|
"types": "./dist/types/*.d.ts",
|
|
144
156
|
"import": "./src/*.ts"
|
|
@@ -8,6 +8,9 @@ const packageDir = path.resolve(import.meta.dir, "..");
|
|
|
8
8
|
const packageName = "@gajae-code/coding-agent";
|
|
9
9
|
const aiPackageDir = path.resolve(packageDir, "../ai");
|
|
10
10
|
const bridgeClientPackageDir = path.resolve(packageDir, "../bridge-client");
|
|
11
|
+
const tuiPackageDir = path.resolve(packageDir, "../tui");
|
|
12
|
+
const nativesPackageDir = path.resolve(packageDir, "../natives");
|
|
13
|
+
const linuxX64PackageDir = path.resolve(packageDir, "../natives-linux-x64");
|
|
11
14
|
const manifestsDir = path.join(packageDir, "test/manifests");
|
|
12
15
|
const baselinePath = path.join(manifestsDir, "sdk-public-surface-v1.json");
|
|
13
16
|
const generatedPath = path.join(manifestsDir, "sdk-public-surface.generated.json");
|
|
@@ -29,16 +32,35 @@ function assertExport(module: Record<string, unknown>, name: string, subpath: st
|
|
|
29
32
|
async function runSmoke(): Promise<Surface> {
|
|
30
33
|
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "gjc-sdk-package-smoke-"));
|
|
31
34
|
try {
|
|
35
|
+
const stagedLinuxX64Dir = path.join(tempDir, "natives-linux-x64");
|
|
36
|
+
await fs.cp(linuxX64PackageDir, stagedLinuxX64Dir, { recursive: true });
|
|
37
|
+
const stagedNativeDir = path.join(stagedLinuxX64Dir, "native");
|
|
38
|
+
await fs.mkdir(stagedNativeDir, { recursive: true });
|
|
39
|
+
for (const entry of await fs.readdir(path.join(nativesPackageDir, "native"))) {
|
|
40
|
+
if (entry.startsWith("pi_natives.linux-x64") && entry.endsWith(".node")) {
|
|
41
|
+
await fs.copyFile(path.join(nativesPackageDir, "native", entry), path.join(stagedNativeDir, entry));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
32
44
|
const aiTarball = run(["bun", "pm", "pack", "--destination", tempDir, "--quiet"], aiPackageDir);
|
|
33
45
|
const bridgeClientTarball = run(
|
|
34
46
|
["bun", "pm", "pack", "--destination", tempDir, "--quiet"],
|
|
35
47
|
bridgeClientPackageDir,
|
|
36
48
|
);
|
|
49
|
+
const tuiTarball = run(["bun", "pm", "pack", "--destination", tempDir, "--quiet"], tuiPackageDir);
|
|
50
|
+
const nativesTarball = run(["bun", "pm", "pack", "--destination", tempDir, "--quiet"], nativesPackageDir);
|
|
51
|
+
const linuxX64Tarball = run(["bun", "pm", "pack", "--destination", tempDir, "--quiet"], stagedLinuxX64Dir);
|
|
37
52
|
const codingAgentTarball = run(["bun", "pm", "pack", "--destination", tempDir, "--quiet"], packageDir);
|
|
38
53
|
const aiTarballPath = path.isAbsolute(aiTarball) ? aiTarball : path.join(aiPackageDir, aiTarball);
|
|
39
54
|
const bridgeClientTarballPath = path.isAbsolute(bridgeClientTarball)
|
|
40
55
|
? bridgeClientTarball
|
|
41
56
|
: path.join(bridgeClientPackageDir, bridgeClientTarball);
|
|
57
|
+
const tuiTarballPath = path.isAbsolute(tuiTarball) ? tuiTarball : path.join(tuiPackageDir, tuiTarball);
|
|
58
|
+
const nativesTarballPath = path.isAbsolute(nativesTarball)
|
|
59
|
+
? nativesTarball
|
|
60
|
+
: path.join(nativesPackageDir, nativesTarball);
|
|
61
|
+
const linuxX64TarballPath = path.isAbsolute(linuxX64Tarball)
|
|
62
|
+
? linuxX64Tarball
|
|
63
|
+
: path.join(stagedLinuxX64Dir, linuxX64Tarball);
|
|
42
64
|
const codingAgentTarballPath = path.isAbsolute(codingAgentTarball)
|
|
43
65
|
? codingAgentTarball
|
|
44
66
|
: path.join(packageDir, codingAgentTarball);
|
|
@@ -52,10 +74,16 @@ async function runSmoke(): Promise<Surface> {
|
|
|
52
74
|
"@gajae-code/ai": `file:${aiTarballPath}`,
|
|
53
75
|
"@gajae-code/bridge-client": `file:${bridgeClientTarballPath}`,
|
|
54
76
|
[packageName]: `file:${codingAgentTarballPath}`,
|
|
77
|
+
"@gajae-code/tui": `file:${tuiTarballPath}`,
|
|
78
|
+
"@gajae-code/natives": `file:${nativesTarballPath}`,
|
|
79
|
+
"@gajae-code/natives-linux-x64": `file:${linuxX64TarballPath}`,
|
|
55
80
|
},
|
|
56
81
|
overrides: {
|
|
57
82
|
"@gajae-code/ai": `file:${aiTarballPath}`,
|
|
58
83
|
"@gajae-code/bridge-client": `file:${bridgeClientTarballPath}`,
|
|
84
|
+
"@gajae-code/tui": `file:${tuiTarballPath}`,
|
|
85
|
+
"@gajae-code/natives": `file:${nativesTarballPath}`,
|
|
86
|
+
"@gajae-code/natives-linux-x64": `file:${linuxX64TarballPath}`,
|
|
59
87
|
},
|
|
60
88
|
},
|
|
61
89
|
null,
|
|
@@ -65,10 +93,20 @@ async function runSmoke(): Promise<Surface> {
|
|
|
65
93
|
// Install the matching packed workspace artifacts so the smoke test exercises the
|
|
66
94
|
// release dependency boundary without falling back to an older registry package.
|
|
67
95
|
run(["bun", "install", "--ignore-scripts"], tempDir);
|
|
96
|
+
const installedPackage = JSON.parse(
|
|
97
|
+
await fs.readFile(path.join(tempDir, "node_modules", packageName, "package.json"), "utf8"),
|
|
98
|
+
) as { exports?: Record<string, unknown> };
|
|
99
|
+
if (installedPackage.exports?.["./session/internal/*"] !== null) {
|
|
100
|
+
throw new Error("packed package must explicitly block ./session/internal/*");
|
|
101
|
+
}
|
|
68
102
|
const probePath = path.join(tempDir, "probe.ts");
|
|
69
103
|
await fs.writeFile(
|
|
70
104
|
probePath,
|
|
71
|
-
`import * as root from ${JSON.stringify(packageName)};\nimport * as sdk from ${JSON.stringify(`${packageName}/sdk`)};\nimport * as bus from ${JSON.stringify(`${packageName}/sdk/bus`)};\
|
|
105
|
+
`import * as fs from "node:fs/promises";\nimport * as path from "node:path";\nimport * as root from ${JSON.stringify(packageName)};\nimport * as sdk from ${JSON.stringify(`${packageName}/sdk`)};\nimport * as bus from ${JSON.stringify(`${packageName}/sdk/bus`)};\nconst required = [[root, "createAgentSession", "root"], [root, "SESSION_DIRECTORY_API_VERSION", "root"], [root, "resolveManagedSessionScope", "root"], [root, "listManagedSessionCandidates", "root"], [sdk, "createAgentSession", "sdk"], [bus, "createNotificationsExtension", "sdk/bus"], [sdk, "SdkClient", "sdk"], [sdk, "SESSION_DIRECTORY_API_VERSION", "sdk"], [sdk, "resolveManagedSessionScope", "sdk"], [sdk, "listManagedSessionCandidates", "sdk"]] as const;\nfor (const [module, name, subpath] of required) if (!(name in module)) throw new Error(subpath + " missing " + name);\nconst sandbox = path.join(process.cwd(), "managed-listing-smoke");\nconst cwd = path.join(sandbox, "workspace", "a-b", "c");\nconst agentDir = path.join(sandbox, "agent");\nconst sessionsRoot = path.join(agentDir, "sessions");\nawait fs.mkdir(cwd, { recursive: true });\nconst resolved = await sdk.resolveManagedSessionScope({ cwd, agentDir, sessionsRoot });\nif (resolved.kind !== "resolved") throw new Error("packed resolver failed: " + resolved.message);\nawait fs.mkdir(resolved.scope.directoryPath, { recursive: true, mode: 0o700 });\nawait fs.chmod(sessionsRoot, 0o700);\nawait fs.chmod(resolved.scope.directoryPath, 0o700);\nawait fs.writeFile(path.join(resolved.scope.directoryPath, ".gjc-managed-session-scope.v2.json"), JSON.stringify({ schemaVersion: 1, layoutVersion: 2, identityVersion: 1, platform: process.platform === "win32" ? "win32" : "posix", canonicalPath: resolved.scope.canonicalCwd, identityDigest: resolved.scope.directoryName.slice(3) }) + "\\n", { mode: 0o600 });\nconst transcriptPath = path.join(resolved.scope.directoryPath, "packed-session.jsonl");\nawait fs.writeFile(transcriptPath, JSON.stringify({ type: "session", id: "packed-session", cwd }) + "\\n", { mode: 0o600 });\nconst snapshot = async () => Promise.all((await fs.readdir(sandbox, { recursive: true })).sort().map(async name => { const pathname = path.join(sandbox, name); const stat = await fs.lstat(pathname); return [name, stat.mode, stat.size, stat.mtimeMs, stat.isFile() ? await fs.readFile(pathname, "utf8") : null]; }));\nconst before = JSON.stringify(await snapshot());\nconst listing = await sdk.listManagedSessionCandidates({ scope: resolved.scope });\nif (listing.kind !== "complete" || listing.owned.length !== 1 || listing.owned[0]?.sessionId !== "packed-session") throw new Error("packed readonly listing failed: " + JSON.stringify(listing));\nconst after = JSON.stringify(await snapshot());\nif (after !== before) throw new Error("packed readonly listing mutated the filesystem");\nconst privateSubpath = ${JSON.stringify(`${packageName}/session/internal/managed-session-scope`)};\ntry { await import(privateSubpath); throw new Error("private managed-session scope subpath resolved"); } catch (error) {\n\tif (error instanceof Error && error.message === "private managed-session scope subpath resolved") throw error;\n\tconst message = String(error);\n\tconst exportsRejected = /Package subpath .* is not defined by "exports"/.test(message);\n\tconst bunRejected = message.startsWith("ResolveMessage: Cannot find module '" + privateSubpath + "' from '") && message.endsWith("/probe.ts'");\n\tif (!exportsRejected && !bunRejected) throw new Error("private managed-session scope failed for an unexpected reason: " + message);\n}\nprocess.stdout.write(JSON.stringify({ root: Object.keys(root).sort(), sdk: Object.keys(sdk).sort() }));\n`,
|
|
106
|
+
);
|
|
107
|
+
await fs.appendFile(
|
|
108
|
+
probePath,
|
|
109
|
+
`\nconst rootBefore = JSON.stringify(await snapshot());\nconst rootListing = await root.listManagedSessionCandidates({ scope: resolved.scope });\nif (rootListing.kind !== "complete" || rootListing.owned.length !== listing.owned.length || rootListing.owned[0]?.sessionId !== listing.owned[0]?.sessionId || rootListing.owned[0]?.path !== listing.owned[0]?.path) throw new Error("packed root readonly listing diverged from SDK listing");\nconst rootAfter = JSON.stringify(await snapshot());\nif (rootAfter !== rootBefore) throw new Error("packed root readonly listing mutated the filesystem");\nconst bridgeClient = await import("@gajae-code/bridge-client");\nif (sdk.SdkClient !== bridgeClient.SdkClient) throw new Error("SdkClient class identity differs between sdk and bridge-client");\n`,
|
|
72
110
|
);
|
|
73
111
|
const surface = JSON.parse(run(["bun", "run", probePath], tempDir)) as Surface;
|
|
74
112
|
assertExport(Object.fromEntries(surface.root.map(name => [name, true])), "createAgentSession", "root");
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import {
|
|
4
|
+
defaultClipboardPasteImageKeysForPlatform,
|
|
5
|
+
defaultMessageQueueKeysForPlatform,
|
|
6
|
+
KEYBINDINGS,
|
|
7
|
+
} from "../src/config/keybindings";
|
|
8
|
+
|
|
9
|
+
import { APP_ACTION_METADATA } from "../src/modes/action-registry";
|
|
10
|
+
|
|
11
|
+
const DOC_PATH = path.resolve(import.meta.dir, "../../../docs/keybindings.md");
|
|
12
|
+
const SECTION_START = "### Application context (`app.*`)";
|
|
13
|
+
const SECTION_END = "### Global engine context (`tui.global.*`)";
|
|
14
|
+
|
|
15
|
+
const DOCUMENTATION_PLATFORMS = ["darwin", "win32", "linux"] as const;
|
|
16
|
+
|
|
17
|
+
function defaultKeys(
|
|
18
|
+
value: (typeof KEYBINDINGS)[keyof typeof KEYBINDINGS],
|
|
19
|
+
bindingId: keyof typeof KEYBINDINGS,
|
|
20
|
+
): string {
|
|
21
|
+
const defaultsByPlatform = DOCUMENTATION_PLATFORMS.map(platform => {
|
|
22
|
+
switch (bindingId) {
|
|
23
|
+
case "app.message.queue":
|
|
24
|
+
return defaultMessageQueueKeysForPlatform(platform);
|
|
25
|
+
case "app.clipboard.pasteImage":
|
|
26
|
+
return defaultClipboardPasteImageKeysForPlatform(platform);
|
|
27
|
+
default: {
|
|
28
|
+
const keys = value.defaultKeys;
|
|
29
|
+
return (Array.isArray(keys) ? keys : [keys]).join(", ") || "_(none)_";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
const groups = new Map<string, string[]>();
|
|
34
|
+
for (const [index, keys] of defaultsByPlatform.entries()) {
|
|
35
|
+
const platform = DOCUMENTATION_PLATFORMS[index]!;
|
|
36
|
+
groups.set(keys, [...(groups.get(keys) ?? []), platform]);
|
|
37
|
+
}
|
|
38
|
+
return groups.size === 1
|
|
39
|
+
? defaultsByPlatform[0]!
|
|
40
|
+
: [...groups].map(([keys, platforms]) => `${keys} (${platforms.join("/")})`).join(" / ");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Canonical application-action table shared by docs and drift tests. */
|
|
44
|
+
export function generateHotkeysDocsTable(): string {
|
|
45
|
+
return [
|
|
46
|
+
"| Action ID | Default | Domains |",
|
|
47
|
+
"| --- | --- | --- |",
|
|
48
|
+
...APP_ACTION_METADATA.map(action => {
|
|
49
|
+
const binding = KEYBINDINGS[action.bindingId ?? action.id];
|
|
50
|
+
return `| \`${action.id}\` | ${defaultKeys(binding, action.bindingId ?? action.id)} | ${action.domains.join(", ")} |`;
|
|
51
|
+
}),
|
|
52
|
+
].join("\n");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function generateKeybindingsDocument(source = readFileSync(DOC_PATH, "utf8")): string {
|
|
56
|
+
const start = source.indexOf(SECTION_START);
|
|
57
|
+
const end = source.indexOf(SECTION_END);
|
|
58
|
+
if (start < 0 || end < 0 || end <= start) throw new Error("Application keybinding section not found");
|
|
59
|
+
return `${source.slice(0, start)}${SECTION_START}\n\n${generateHotkeysDocsTable()}\n\n${source.slice(end)}`;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (import.meta.main) {
|
|
63
|
+
const expected = generateKeybindingsDocument();
|
|
64
|
+
if (process.argv.includes("--check")) {
|
|
65
|
+
if (readFileSync(DOC_PATH, "utf8") !== expected) {
|
|
66
|
+
console.error(
|
|
67
|
+
`${path.relative(process.cwd(), DOC_PATH)} is out of date; run bun scripts/generate-hotkeys-docs.ts`,
|
|
68
|
+
);
|
|
69
|
+
process.exitCode = 1;
|
|
70
|
+
}
|
|
71
|
+
} else {
|
|
72
|
+
writeFileSync(DOC_PATH, expected);
|
|
73
|
+
}
|
|
74
|
+
}
|