@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
|
@@ -33,6 +33,25 @@ export interface PurgeQueuedCustomMessagesResult {
|
|
|
33
33
|
displayFollowUp: number;
|
|
34
34
|
totalExecutable: number;
|
|
35
35
|
}
|
|
36
|
+
export type AbortOutcome = {
|
|
37
|
+
kind: "settled";
|
|
38
|
+
} | {
|
|
39
|
+
kind: "timeout";
|
|
40
|
+
} | {
|
|
41
|
+
kind: "error";
|
|
42
|
+
cause: unknown;
|
|
43
|
+
};
|
|
44
|
+
export type CancelAndSubmitOutcome = {
|
|
45
|
+
kind: "submitted";
|
|
46
|
+
} | {
|
|
47
|
+
kind: "refused";
|
|
48
|
+
reason: "duplicate" | "compaction";
|
|
49
|
+
} | {
|
|
50
|
+
kind: "rolled_back";
|
|
51
|
+
outcome: Extract<AbortOutcome, {
|
|
52
|
+
kind: "timeout" | "error";
|
|
53
|
+
}>;
|
|
54
|
+
};
|
|
36
55
|
export interface ForkContextSeed {
|
|
37
56
|
messages: Message[];
|
|
38
57
|
agentMessages: AgentMessage[];
|
|
@@ -43,6 +62,7 @@ export interface ForkContextSeed {
|
|
|
43
62
|
export interface ForkContextSeedOptions {
|
|
44
63
|
maxMessages: number;
|
|
45
64
|
maxTokens: number;
|
|
65
|
+
preserveLatestUser?: boolean;
|
|
46
66
|
cacheIdentity?: string;
|
|
47
67
|
signal?: AbortSignal;
|
|
48
68
|
}
|
|
@@ -68,7 +88,6 @@ import type { HindsightSessionState } from "../hindsight/state";
|
|
|
68
88
|
import { type WorkflowGateEmitter } from "../modes/shared/agent-wire/workflow-gate-broker";
|
|
69
89
|
import type { PlanModeState } from "../plan-mode/state";
|
|
70
90
|
import { type AgentRegistry } from "../registry/agent-registry";
|
|
71
|
-
import { type DiscoverableMCPSearchIndex, type DiscoverableMCPTool } from "../runtime-mcp/discoverable-tool-metadata";
|
|
72
91
|
import { MCPManager } from "../runtime-mcp/manager";
|
|
73
92
|
import type { NotificationSessionController } from "../sdk/bus/session-control";
|
|
74
93
|
import { type SecretObfuscator } from "../secrets/obfuscator";
|
|
@@ -181,6 +200,10 @@ export interface AgentSessionConfig {
|
|
|
181
200
|
slashCommands?: FileSlashCommand[];
|
|
182
201
|
/** Extension runner (created in main.ts with wrapped tools) */
|
|
183
202
|
extensionRunner?: ExtensionRunner;
|
|
203
|
+
/** Override first-party worker integration dispatch for embedded hosts and deterministic lifecycle tests. */
|
|
204
|
+
workerIntegrationRequest?: (signal: AbortSignal) => Promise<void>;
|
|
205
|
+
/** Bound terminal worker-integration settlement for embedded hosts and deterministic lifecycle tests. */
|
|
206
|
+
workerIntegrationTimeoutMs?: number;
|
|
184
207
|
/** Loaded skills (already discovered by SDK) */
|
|
185
208
|
skills?: Skill[];
|
|
186
209
|
/** Skill loading warnings (already captured by SDK) */
|
|
@@ -219,15 +242,12 @@ export interface AgentSessionConfig {
|
|
|
219
242
|
requestedToolNames?: ReadonlySet<string>;
|
|
220
243
|
/** Optional per-session allowlist for tools exposed through search_tool_bm25. */
|
|
221
244
|
discoverableToolAllowedNames?: readonly string[];
|
|
222
|
-
/**
|
|
223
|
-
* Optional accessor for live MCP server instructions. Read by the session's
|
|
224
|
-
* `rebuildSystemPrompt`-skip optimization to detect server-side instruction
|
|
225
|
-
* changes (e.g. an MCP server upgrade) that would otherwise pass the tool-set
|
|
226
|
-
* signature comparison and silently keep a stale prompt cached.
|
|
227
|
-
*/
|
|
245
|
+
/** Optional accessor for live MCP server instructions, injected as untrusted user-role request data. */
|
|
228
246
|
getMcpServerInstructions?: () => Map<string, string> | undefined;
|
|
229
247
|
/** Enable hidden-by-default MCP tool discovery for this session. */
|
|
230
248
|
mcpDiscoveryEnabled?: boolean;
|
|
249
|
+
/** Effective discovery mode normalized by the session factory. */
|
|
250
|
+
discoveryMode?: "off" | "mcp-only" | "all";
|
|
231
251
|
/** MCP tool names to activate for the current session when discovery mode is enabled. */
|
|
232
252
|
initialSelectedMCPToolNames?: string[];
|
|
233
253
|
/** Whether constructor-provided MCP defaults should be persisted immediately. */
|
|
@@ -348,6 +368,36 @@ export interface SessionStats {
|
|
|
348
368
|
cost: number;
|
|
349
369
|
costBreakdown?: Usage["cost"];
|
|
350
370
|
}
|
|
371
|
+
export type EphemeralTurnPurpose = "btw" | "background";
|
|
372
|
+
interface EphemeralTurnBaseArgs {
|
|
373
|
+
promptText: string;
|
|
374
|
+
onTextDelta?: (delta: string) => void;
|
|
375
|
+
signal?: AbortSignal;
|
|
376
|
+
}
|
|
377
|
+
export type EphemeralTurnArgs = (EphemeralTurnBaseArgs & {
|
|
378
|
+
purpose: "btw";
|
|
379
|
+
}) | (EphemeralTurnBaseArgs & {
|
|
380
|
+
purpose?: "background";
|
|
381
|
+
/** Internal caller-supplied, non-persistent context such as the IRC roster. */
|
|
382
|
+
prependMessages?: AgentMessage[];
|
|
383
|
+
/** Revalidates optional caller context after asynchronous boundaries. */
|
|
384
|
+
prependMessagesValid?: () => boolean;
|
|
385
|
+
/**
|
|
386
|
+
* An existing IRC roster claim owned by the caller. `undefined` makes this
|
|
387
|
+
* turn claim and commit its own roster candidate; `null` opts out.
|
|
388
|
+
*/
|
|
389
|
+
ircRosterClaim?: IrcRosterClaim | null;
|
|
390
|
+
});
|
|
391
|
+
interface EphemeralTurnResult {
|
|
392
|
+
replyText: string;
|
|
393
|
+
assistantMessage: AssistantMessage;
|
|
394
|
+
}
|
|
395
|
+
type IrcRosterClaim = {
|
|
396
|
+
token: symbol;
|
|
397
|
+
signature: string;
|
|
398
|
+
epoch: number;
|
|
399
|
+
message: CustomMessage;
|
|
400
|
+
};
|
|
351
401
|
export type QueuedMessageEditMode = "steer" | "followUp";
|
|
352
402
|
export interface QueuedMessageEditEntry {
|
|
353
403
|
id: string;
|
|
@@ -369,8 +419,9 @@ export type BeforeAgentStartContributor = (event: {
|
|
|
369
419
|
}) => Promise<BeforeAgentStartInternalMessage | undefined>;
|
|
370
420
|
export declare class WorkerIntegrationRequestScheduler {
|
|
371
421
|
#private;
|
|
372
|
-
readonly request: () => Promise<void>;
|
|
373
|
-
|
|
422
|
+
readonly request: (signal: AbortSignal) => Promise<void>;
|
|
423
|
+
readonly timeoutMs: number;
|
|
424
|
+
constructor(request: (signal: AbortSignal) => Promise<void>, timeoutMs?: number);
|
|
374
425
|
enqueue(): void;
|
|
375
426
|
flush(): Promise<void>;
|
|
376
427
|
}
|
|
@@ -448,6 +499,7 @@ export declare class AgentSession {
|
|
|
448
499
|
peekQueueInvoker(): ((input: unknown) => Promise<unknown> | unknown) | undefined;
|
|
449
500
|
peekStandingResolveHandler(): ((input: unknown) => Promise<unknown> | unknown) | undefined;
|
|
450
501
|
setStandingResolveHandler(handler: ((input: unknown) => Promise<unknown> | unknown) | null): void;
|
|
502
|
+
setSdkPlanModeHandler(handler: ((on: boolean) => Promise<PlanModeState | undefined>) | null): void;
|
|
451
503
|
/** Provider-scoped mutable state store for transport/session caches. */
|
|
452
504
|
get providerSessionState(): Map<string, ProviderSessionState>;
|
|
453
505
|
/** Suspend provider state without closing it while a temporary model is active. */
|
|
@@ -499,6 +551,8 @@ export declare class AgentSession {
|
|
|
499
551
|
* react to (e.g. background queue flush failures).
|
|
500
552
|
*/
|
|
501
553
|
emitNotice(level: "info" | "warning" | "error", message: string, source?: string): void;
|
|
554
|
+
/** Await all transformations queued by externally emitted tool results. */
|
|
555
|
+
awaitPendingContextTransformations(): Promise<void>;
|
|
502
556
|
/**
|
|
503
557
|
* Subscribe to agent events.
|
|
504
558
|
* Session persistence is handled internally (saves messages on message_end).
|
|
@@ -541,7 +595,7 @@ export declare class AgentSession {
|
|
|
541
595
|
get serviceTier(): ServiceTier | undefined;
|
|
542
596
|
/** Whether agent is currently streaming a response */
|
|
543
597
|
get isStreaming(): boolean;
|
|
544
|
-
/** Wait until streaming and
|
|
598
|
+
/** Wait until streaming and session settlement work are fully settled. */
|
|
545
599
|
waitForIdle(): Promise<void>;
|
|
546
600
|
drainAsyncJobDeliveriesForAcp(options?: {
|
|
547
601
|
timeoutMs?: number;
|
|
@@ -603,15 +657,7 @@ export declare class AgentSession {
|
|
|
603
657
|
* Get all configured tool names (built-in via --tools or default, plus custom tools).
|
|
604
658
|
*/
|
|
605
659
|
getAllToolNames(): string[];
|
|
606
|
-
isMCPDiscoveryEnabled(): boolean;
|
|
607
|
-
/** @deprecated Use {@link getDiscoverableTools} with `{ source: "mcp" }` instead.
|
|
608
|
-
* Preserves the legacy `description`-bearing MCP shape for back-compat callers. */
|
|
609
|
-
getDiscoverableMCPTools(): DiscoverableMCPTool[];
|
|
610
|
-
/** @deprecated Use {@link getDiscoverableToolSearchIndex} instead.
|
|
611
|
-
* Returns the legacy MCP search index whose documents expose `tool.description`. */
|
|
612
|
-
getDiscoverableMCPSearchIndex(): DiscoverableMCPSearchIndex;
|
|
613
660
|
getSelectedMCPToolNames(): string[];
|
|
614
|
-
activateDiscoveredMCPTools(toolNames: string[]): Promise<string[]>;
|
|
615
661
|
isToolDiscoveryEnabled(): boolean;
|
|
616
662
|
getDiscoverableTools(filter?: {
|
|
617
663
|
source?: DiscoverableTool["source"];
|
|
@@ -657,6 +703,7 @@ export declare class AgentSession {
|
|
|
657
703
|
get hasPostPromptWork(): boolean;
|
|
658
704
|
/** All messages including custom types like BashExecutionMessage */
|
|
659
705
|
get messages(): AgentMessage[];
|
|
706
|
+
get transcriptPromptGeneration(): number;
|
|
660
707
|
/** Main startup calls this exactly once, after a strict open returned `kind: "opened"`. */
|
|
661
708
|
continuePersistedHistory(): Promise<void>;
|
|
662
709
|
buildDisplaySessionContext(): SessionContext;
|
|
@@ -689,7 +736,7 @@ export declare class AgentSession {
|
|
|
689
736
|
args?: string;
|
|
690
737
|
lineCount?: number;
|
|
691
738
|
}>;
|
|
692
|
-
setSdkPlanMode(on: boolean): PlanModeState | undefined
|
|
739
|
+
setSdkPlanMode(on: boolean): Promise<PlanModeState | undefined>;
|
|
693
740
|
operateGoal(op: "create" | "get" | "resume" | "pause" | "complete" | "drop", objective?: string): Promise<unknown>;
|
|
694
741
|
getTranscript(): Array<{
|
|
695
742
|
id: string;
|
|
@@ -755,6 +802,10 @@ export declare class AgentSession {
|
|
|
755
802
|
followUp(text: string, images?: ImageContent[], options?: Pick<PromptOptions, "followUpQueuePolicy">): Promise<void>;
|
|
756
803
|
queueDeferredMessage(message: CustomMessage): void;
|
|
757
804
|
queueDeferredMessageForTests(message: CustomMessage, triggerTurn?: boolean): void;
|
|
805
|
+
/** Read-only test seam for the hidden next-turn context queue. */
|
|
806
|
+
getPendingNextTurnMessagesForTests(): readonly CustomMessage[];
|
|
807
|
+
/** Test-only abort outcome override; undefined retains the production abort race. */
|
|
808
|
+
setCancelAndSubmitAbortOutcomeProviderForTests(provider: (() => Promise<AbortOutcome>) | undefined): void;
|
|
758
809
|
/**
|
|
759
810
|
* Send a custom message to the session. Creates a CustomMessageEntry.
|
|
760
811
|
*
|
|
@@ -835,19 +886,17 @@ export declare class AgentSession {
|
|
|
835
886
|
runMidRunMaintenanceForTests(context: AgentContext, lifecycle?: MidRunMaintenanceLifecycle): Promise<MidRunMaintenanceOutcome>;
|
|
836
887
|
/** Test seam: estimate mid-run context tokens for a given context view. */
|
|
837
888
|
estimateMidRunContextTokensForTests(messages: readonly AgentMessage[]): number;
|
|
838
|
-
/**
|
|
839
|
-
* Abort current operation and wait for agent to become idle.
|
|
840
|
-
*/
|
|
889
|
+
/** Abort current operation and preserve the established void/rethrow contract. */
|
|
841
890
|
abort(options?: {
|
|
842
891
|
goalReason?: "interrupted" | "internal";
|
|
843
892
|
timeoutMs?: number;
|
|
844
893
|
cause?: "user_interrupt" | "new_session" | "session_switch" | "compaction" | "handoff" | "tool_abort" | "internal";
|
|
845
|
-
/** Suppress the "Operation aborted" line on the resulting aborted message
|
|
846
|
-
* by stamping `SILENT_ABORT_MARKER`. Used when Esc consumes a queued steer
|
|
847
|
-
* and resumes via steer-on-interrupt, so the interrupt reads as a quiet
|
|
848
|
-
* hand-off rather than a failure. */
|
|
849
894
|
silent?: boolean;
|
|
850
895
|
}): Promise<void>;
|
|
896
|
+
/** Atomically interrupt the active run and make text the next prompt. */
|
|
897
|
+
cancelAndSubmit(text: string, options?: {
|
|
898
|
+
queuedEntryId?: string;
|
|
899
|
+
}): Promise<CancelAndSubmitOutcome>;
|
|
851
900
|
/**
|
|
852
901
|
* Start a new session, optionally with initial messages and parent tracking.
|
|
853
902
|
* Clears all messages and starts a new session.
|
|
@@ -948,6 +997,8 @@ export declare class AgentSession {
|
|
|
948
997
|
* @returns The new model info, or undefined if only one model available
|
|
949
998
|
*/
|
|
950
999
|
cycleModel(direction?: "forward" | "backward"): Promise<ModelCycleResult | undefined>;
|
|
1000
|
+
/** Number of configured role-model candidates that can be cycled. */
|
|
1001
|
+
getRoleModelCycleCandidateCount(roleOrder?: readonly string[]): number;
|
|
951
1002
|
/**
|
|
952
1003
|
* Cycle through configured role models in a fixed order.
|
|
953
1004
|
* Skips missing roles.
|
|
@@ -1193,27 +1244,11 @@ export declare class AgentSession {
|
|
|
1193
1244
|
emitSubagentSteerRelayObservation(record: CustomMessage): void;
|
|
1194
1245
|
/**
|
|
1195
1246
|
* Run a single ephemeral side-channel turn against this session's current
|
|
1196
|
-
* model + system prompt + history.
|
|
1197
|
-
*
|
|
1198
|
-
*
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
* the snapshot + stream pipeline. The snapshot includes any in-flight
|
|
1202
|
-
* streaming assistant text so the model sees the half-finished response
|
|
1203
|
-
* rather than missing context.
|
|
1204
|
-
*/
|
|
1205
|
-
runEphemeralTurn(args: {
|
|
1206
|
-
promptText: string;
|
|
1207
|
-
onTextDelta?: (delta: string) => void;
|
|
1208
|
-
signal?: AbortSignal;
|
|
1209
|
-
/** Defer the successful roster-claim commit until the caller accepts its exchange. */
|
|
1210
|
-
deferRosterCommit?: boolean;
|
|
1211
|
-
}): Promise<{
|
|
1212
|
-
replyText: string;
|
|
1213
|
-
assistantMessage: AssistantMessage;
|
|
1214
|
-
commitRosterClaim?: () => void;
|
|
1215
|
-
releaseRosterClaim?: () => void;
|
|
1216
|
-
}>;
|
|
1247
|
+
* model + system prompt + history. No tools are used and session history is
|
|
1248
|
+
* not modified. Background turns retain the IRC/session behavior used by
|
|
1249
|
+
* autoreplies; `/btw` turns use an isolated committed-context policy.
|
|
1250
|
+
*/
|
|
1251
|
+
runEphemeralTurn(args: EphemeralTurnArgs): Promise<EphemeralTurnResult>;
|
|
1217
1252
|
/**
|
|
1218
1253
|
* Reload the current session from disk.
|
|
1219
1254
|
*
|
|
@@ -98,4 +98,11 @@ export declare class AgentStorage {
|
|
|
98
98
|
* Deletes expired cache entries. Call periodically for cleanup.
|
|
99
99
|
*/
|
|
100
100
|
cleanExpiredCache(): void;
|
|
101
|
+
/**
|
|
102
|
+
* Release prepared statements and the shared SQLite handle.
|
|
103
|
+
*
|
|
104
|
+
* AgentStorage instances are cached by path, so closing also evicts this
|
|
105
|
+
* instance and allows a later open() to create a fresh handle.
|
|
106
|
+
*/
|
|
107
|
+
close(): void;
|
|
101
108
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import type { FallbackTriggerClass } from "@gajae-code/ai/utils/fallback-transport";
|
|
2
2
|
/** Immutable configured fallback intent. Transient attempt state never belongs here. */
|
|
3
3
|
export interface ConfiguredFallbackChain {
|
|
4
4
|
role: string;
|
|
@@ -30,11 +30,14 @@ export declare class FallbackChainController {
|
|
|
30
30
|
}>;
|
|
31
31
|
exhaustedForTurn: boolean;
|
|
32
32
|
constructor(chain: ConfiguredFallbackChain, maxAttempts: number);
|
|
33
|
+
get totalAttemptsUsed(): number;
|
|
33
34
|
currentSelector(): string | undefined;
|
|
34
35
|
onResolutionSkip(reason: string): boolean;
|
|
35
36
|
/** Charge an upstream request at its concrete transport boundary. */
|
|
36
37
|
onAttemptStarted(): void;
|
|
37
|
-
/**
|
|
38
|
+
/** Remove the current started request from fallback-policy accounting without erasing prior failures. */
|
|
39
|
+
discardStartedAttempt(): void;
|
|
40
|
+
/** Start a logically new request with a fresh fallback-chain budget. */
|
|
38
41
|
resetAttemptBudget(): void;
|
|
39
42
|
/** Seed a controller from auth-aware resolution without charging requests. */
|
|
40
43
|
seedResolution(activeIndex: number, skips: Array<{
|
|
@@ -43,6 +46,11 @@ export declare class FallbackChainController {
|
|
|
43
46
|
}>): void;
|
|
44
47
|
onAttemptFailure(triggerClass: FallbackTriggerClass, reason: string): FallbackFailureResult;
|
|
45
48
|
advance(): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Restore the entry that just advanced when credential rotation permits a retry.
|
|
51
|
+
* The chain-wide budget and failure history remain charged.
|
|
52
|
+
*/
|
|
53
|
+
restorePreviousEntryForRetry(): boolean;
|
|
46
54
|
isExhausted(): boolean;
|
|
47
55
|
resetForNewTurn(): void;
|
|
48
56
|
resetSticky(): void;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { ResumeSessionIdentity } from "../session-manager";
|
|
2
|
+
export declare const MANAGED_SESSION_LAYOUT_VERSION: 2;
|
|
3
|
+
export declare const MANAGED_SESSION_IDENTITY_VERSION: 1;
|
|
4
|
+
export declare const MANAGED_SESSION_BINDING_FILE = ".gjc-managed-session-scope.v2.json";
|
|
5
|
+
export interface ManagedScope {
|
|
6
|
+
apiVersion: 1;
|
|
7
|
+
layoutVersion: 2;
|
|
8
|
+
identityVersion: 1;
|
|
9
|
+
agentDir: string;
|
|
10
|
+
sessionsRoot: string;
|
|
11
|
+
canonicalCwd: string;
|
|
12
|
+
legacyLexicalCwd: string;
|
|
13
|
+
directoryName: string;
|
|
14
|
+
directoryPath: string;
|
|
15
|
+
platform: "posix" | "win32";
|
|
16
|
+
}
|
|
17
|
+
export type ManagedMigrationPolicy = "copy-retain" | "disabled";
|
|
18
|
+
export type ManagedScopeErrorCode = "cwd_missing" | "cwd_not_directory" | "identity_unavailable" | "network_unsupported" | "sessions_root_unavailable" | "binding_conflict" | "binding_invalid";
|
|
19
|
+
export type ManagedScopeResolution = {
|
|
20
|
+
kind: "resolved";
|
|
21
|
+
scope: ManagedScope;
|
|
22
|
+
} | {
|
|
23
|
+
kind: "error";
|
|
24
|
+
code: ManagedScopeErrorCode;
|
|
25
|
+
message: string;
|
|
26
|
+
};
|
|
27
|
+
export interface ManagedCandidate {
|
|
28
|
+
sessionId: string;
|
|
29
|
+
path: string;
|
|
30
|
+
cwd: string;
|
|
31
|
+
provenance: "v2" | "legacy";
|
|
32
|
+
identity: ResumeSessionIdentity;
|
|
33
|
+
migrationState: "native_v2" | "legacy_unmigrated" | "migrated_v2";
|
|
34
|
+
}
|
|
35
|
+
export type ManagedCandidateListing = {
|
|
36
|
+
kind: "complete";
|
|
37
|
+
scope: ManagedScope;
|
|
38
|
+
owned: readonly ManagedCandidate[];
|
|
39
|
+
foreignCount: number;
|
|
40
|
+
invalid: readonly {
|
|
41
|
+
code: string;
|
|
42
|
+
}[];
|
|
43
|
+
} | {
|
|
44
|
+
kind: "error";
|
|
45
|
+
code: "scan_failed" | "unsafe_root" | "invalid_candidate";
|
|
46
|
+
message: string;
|
|
47
|
+
};
|
|
48
|
+
export type ManagedOpenFailure = "migration_busy" | "binding_conflict" | "binding_invalid" | "destination_conflict" | "source_changed" | "unsafe_artifacts" | "durability_failed" | "migration_retired" | "legacy_migration_disabled" | "managed_storage_unsupported";
|
|
49
|
+
export type ManagedOpenCandidateResult = {
|
|
50
|
+
kind: "opened";
|
|
51
|
+
path: string;
|
|
52
|
+
candidate: ManagedCandidate;
|
|
53
|
+
migrated: boolean;
|
|
54
|
+
} | {
|
|
55
|
+
kind: "error";
|
|
56
|
+
code: ManagedOpenFailure;
|
|
57
|
+
message: string;
|
|
58
|
+
};
|
|
59
|
+
export type ManagedDeleteCandidateResult = {
|
|
60
|
+
kind: "deleted";
|
|
61
|
+
tombstonePath: string;
|
|
62
|
+
} | {
|
|
63
|
+
kind: "already_deleted";
|
|
64
|
+
tombstonePath: string;
|
|
65
|
+
} | {
|
|
66
|
+
kind: "error";
|
|
67
|
+
code: ManagedOpenFailure;
|
|
68
|
+
message: string;
|
|
69
|
+
};
|
|
70
|
+
declare function scopeDigest(platform: "posix" | "win32", canonicalPath: string): string;
|
|
71
|
+
export declare const computeManagedScopeDigest: typeof scopeDigest;
|
|
72
|
+
/**
|
|
73
|
+
* Resolve benign symlinks in the deepest existing ancestor of a trusted storage
|
|
74
|
+
* root (e.g. macOS `/var -> /private/var`, or a symlinked `$HOME`) while keeping
|
|
75
|
+
* any not-yet-created tail verbatim. The native owner-only primitive and the
|
|
76
|
+
* session-storage reparse guard traverse with `O_NOFOLLOW` and reject every
|
|
77
|
+
* symlink component, so the trusted root must be canonical before it reaches
|
|
78
|
+
* them; canonicalizing only the existing prefix never follows an
|
|
79
|
+
* attacker-plantable component below the root.
|
|
80
|
+
*/
|
|
81
|
+
export declare function canonicalizeTrustedPath(target: string): string;
|
|
82
|
+
export declare function resolveManagedScope(input: {
|
|
83
|
+
cwd: string;
|
|
84
|
+
agentDir: string;
|
|
85
|
+
sessionsRoot: string;
|
|
86
|
+
}): ManagedScopeResolution;
|
|
87
|
+
export declare function ensureManagedScope(scope: ManagedScope): Promise<ManagedScopeResolution>;
|
|
88
|
+
/** Synchronously create and validate the v2 binding before a default session writer exists. */
|
|
89
|
+
export declare function prepareManagedSessionScopeForWriteSync(scope: ManagedScope): ManagedScopeResolution;
|
|
90
|
+
export declare function listManagedCandidates(scope: ManagedScope): ManagedCandidateListing;
|
|
91
|
+
/** Resume tombstoned cleanup under its original operation lease without restoring retired candidates. */
|
|
92
|
+
export declare function reconcileManagedTombstones(scope: ManagedScope): Promise<void>;
|
|
93
|
+
/** Create the v2 binding and private write protocol directories before managed writes. */
|
|
94
|
+
export declare function prepareManagedSessionScopeForWrite(scope: ManagedScope): Promise<ManagedScopeResolution>;
|
|
95
|
+
/**
|
|
96
|
+
* Open a validated candidate for mutation. Legacy transcripts are copied exactly once
|
|
97
|
+
* into v2 and retained at their original location; no transcript data is merged.
|
|
98
|
+
*/
|
|
99
|
+
export declare function openManagedCandidateForWrite(scope: ManagedScope, candidate: ManagedCandidate, migrationPolicy?: ManagedMigrationPolicy): Promise<ManagedOpenCandidateResult>;
|
|
100
|
+
/** Tombstone a verified managed candidate before exact-identity deletion. */
|
|
101
|
+
export declare function deleteManagedSessionCandidate(scope: ManagedScope, candidate: ManagedCandidate): Promise<ManagedDeleteCandidateResult>;
|
|
102
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export declare const MANAGED_ARTIFACT_MAX_DEPTH = 32;
|
|
2
|
+
export declare const MANAGED_ARTIFACT_MAX_FILES = 10000;
|
|
3
|
+
export declare const MANAGED_ARTIFACT_MAX_FILE_BYTES: number;
|
|
4
|
+
export declare const MANAGED_ARTIFACT_MAX_TOTAL_BYTES: number;
|
|
5
|
+
export type ManagedStorageFailure = "migration_busy" | "binding_conflict" | "binding_invalid" | "destination_conflict" | "source_changed" | "unsafe_artifacts" | "durability_failed" | "migration_retired" | "managed_storage_unsupported";
|
|
6
|
+
export interface ManagedStorageLock {
|
|
7
|
+
path: string;
|
|
8
|
+
attemptId: string;
|
|
9
|
+
assertOwned(): void;
|
|
10
|
+
release(): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export interface ManagedFileSnapshot {
|
|
13
|
+
bytes: Buffer;
|
|
14
|
+
identity: {
|
|
15
|
+
dev: bigint;
|
|
16
|
+
ino: bigint;
|
|
17
|
+
size: number;
|
|
18
|
+
mtimeNs: bigint;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export declare function shouldFsyncManagedDirectory(platform?: NodeJS.Platform): boolean;
|
|
22
|
+
/** Create a managed directory and fail closed unless its owner-only mode/ACL verifies. */
|
|
23
|
+
export declare function ensureManagedDirectory(pathname: string): void;
|
|
24
|
+
/** Captures header/hash/copy input from one no-follow descriptor and rechecks the pathname before use. */
|
|
25
|
+
export declare function captureManagedFileNoFollow(pathname: string): ManagedFileSnapshot;
|
|
26
|
+
/** Atomically publishes bytes without replacing an existing destination. */
|
|
27
|
+
export declare function publishManagedFileNoReplace(destination: string, bytes: Uint8Array, assertOwned?: () => void): Promise<void>;
|
|
28
|
+
export declare function publishManagedFileNoReplaceSync(destination: string, bytes: Uint8Array): void;
|
|
29
|
+
/** Copy the exact bytes captured from one no-follow source descriptor. */
|
|
30
|
+
export declare function copyManagedFileNoReplace(source: string, destination: string, snapshot?: ManagedFileSnapshot): Promise<void>;
|
|
31
|
+
/** Acquire a lease lock with bounded wait, heartbeats, conservative stale reclaim, and fencing. */
|
|
32
|
+
export declare function acquireManagedLock(locksDirectory: string, name: string): Promise<ManagedStorageLock>;
|
|
33
|
+
/** Bounds a no-follow artifact tree before it can be copied or deleted. */
|
|
34
|
+
export declare function validateManagedArtifactTree(root: string): void;
|
|
35
|
+
/** Flush a copied managed artifact tree, including empty directories, before publishing its receipt. */
|
|
36
|
+
export declare function fsyncManagedArtifactTree(root: string): void;
|
|
37
|
+
export declare function publishManagedTombstone(destination: string, record: Record<string, unknown>, assertOwned?: () => void): Promise<void>;
|
|
38
|
+
export declare function unlinkManagedFileVerified(pathname: string, expected: ManagedFileSnapshot["identity"]): Promise<void>;
|
|
@@ -10,6 +10,14 @@ import type { AssistantMessage, ImageContent, Message, MessageAttribution, TextC
|
|
|
10
10
|
export { type BranchSummaryMessage, type CompactionSummaryMessage, createBranchSummaryMessage, createCompactionSummaryMessage, } from "@gajae-code/agent-core/compaction/messages";
|
|
11
11
|
import type { LoadedSubskillActivation } from "../extensibility/gjc-plugins";
|
|
12
12
|
import type { OutputMeta } from "../tools/output-meta";
|
|
13
|
+
/**
|
|
14
|
+
* Encode untrusted values embedded in prompt markup. Control and bidi characters become visible
|
|
15
|
+
* escape sequences so they cannot alter markup structure or display. Isolated UTF-16 surrogates
|
|
16
|
+
* are also escaped; valid Unicode pairs remain intact.
|
|
17
|
+
*/
|
|
18
|
+
export declare function escapePromptMetadata(value: string, options?: {
|
|
19
|
+
preserveNewlines?: boolean;
|
|
20
|
+
}): string;
|
|
13
21
|
export declare const SKILL_PROMPT_MESSAGE_TYPE = "skill-prompt";
|
|
14
22
|
export interface SkillPromptDetails {
|
|
15
23
|
name: string;
|
|
@@ -58,6 +66,14 @@ export declare const INTERNAL_DETAILS_FIELDS: readonly ["__pendingDisplayTag"];
|
|
|
58
66
|
* (null/non-object, or no listed fields present) so callers don't pay a
|
|
59
67
|
* clone cost on the common path. */
|
|
60
68
|
export declare function stripInternalDetailsFields<T>(details: T | undefined): T | undefined;
|
|
69
|
+
export declare const PRE_ADMISSION_ARTIFACT_SPILL_HEAD_BYTES = 4096;
|
|
70
|
+
export declare const PRE_ADMISSION_ARTIFACT_SPILL_TAIL_BYTES = 4096;
|
|
71
|
+
/**
|
|
72
|
+
* Build the deterministic inline receipt for a tool result saved before the
|
|
73
|
+
* next provider context is constructed. Byte boundaries never split UTF-8
|
|
74
|
+
* code points, so head/tail recovery remains readable for emoji and CJK text.
|
|
75
|
+
*/
|
|
76
|
+
export declare function createPreAdmissionArtifactSpillPreview(fullText: string, artifactId: string, digest: string): string;
|
|
61
77
|
/**
|
|
62
78
|
* Message type for bash executions via the ! command.
|
|
63
79
|
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SessionContext, SessionEntry, SessionManager, SessionTreeNode } from "./session-manager";
|
|
2
|
+
/**
|
|
3
|
+
* Opaque capability for zero-copy session snapshots. This module is deliberately
|
|
4
|
+
* excluded from package exports; only trusted in-package readers may use it.
|
|
5
|
+
*/
|
|
6
|
+
export declare const sessionManagerReadCapability: unique symbol;
|
|
7
|
+
export interface SessionManagerReadAccess {
|
|
8
|
+
getEntries(): readonly SessionEntry[];
|
|
9
|
+
getSessionContext(): Readonly<SessionContext>;
|
|
10
|
+
getTree(): SessionTreeNode[];
|
|
11
|
+
}
|
|
12
|
+
export declare function getEntriesForInternalRead(manager: SessionManager): readonly SessionEntry[];
|
|
13
|
+
export declare function getSessionContextForInternalRead(manager: SessionManager): Readonly<SessionContext>;
|
|
14
|
+
export declare function getTreeForInternalRead(manager: SessionManager): SessionTreeNode[];
|