@gajae-code/coding-agent 0.11.1 → 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 +54 -0
- 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-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/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 +19 -17
- 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 +20 -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 +20 -13
- 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/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/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 +46 -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/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 +34 -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 +49 -6
- 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 +29 -5
- package/src/gjc-runtime/ultragoal-pipeline.ts +306 -0
- package/src/gjc-runtime/ultragoal-runtime.ts +84 -1311
- 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/event-controller.ts +3 -2
- package/src/modes/controllers/extension-ui-controller.ts +24 -1
- 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 +289 -1150
- 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 +71 -16
- 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 +45 -18
- 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 +1 -1
- package/src/sdk/broker/ensure.ts +3 -1
- 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 +10 -2
- 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/html-format.ts +20 -3
- package/src/sdk/bus/index.ts +778 -93
- package/src/sdk/bus/lifecycle-control-runtime.ts +91 -33
- 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 +1389 -237
- 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 +1700 -583
- 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 +36 -21
- 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/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,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[];
|
|
@@ -4,9 +4,11 @@ import type { ImageContent, Message, MessageAttribution, ServiceTier, TextConten
|
|
|
4
4
|
import type { TtsrInjectionRecord } from "../export/ttsr";
|
|
5
5
|
import { ArtifactManager } from "./artifacts";
|
|
6
6
|
import { type BlobPutResult, BlobStore } from "./blob-store";
|
|
7
|
+
import { type ManagedMigrationPolicy } from "./internal/managed-session-scope";
|
|
7
8
|
import { type BashExecutionMessage, type CustomMessage, type FileMentionMessage, type HookMessage, type PythonExecutionMessage } from "./messages";
|
|
9
|
+
import { type SessionManagerReadAccess, sessionManagerReadCapability } from "./session-manager-internal";
|
|
8
10
|
import type { SessionStorage, SessionStorageStat, VerifiedSessionDeleteResult, VerifiedSessionDeleteTarget } from "./session-storage";
|
|
9
|
-
export declare const CURRENT_SESSION_VERSION =
|
|
11
|
+
export declare const CURRENT_SESSION_VERSION = 4;
|
|
10
12
|
export interface SessionHeader {
|
|
11
13
|
type: "session";
|
|
12
14
|
version?: number;
|
|
@@ -80,6 +82,8 @@ export declare function associateSessionMessageObservationId(message: AgentMessa
|
|
|
80
82
|
export declare function getSessionMessageObservationId(message: AgentMessage): string | undefined;
|
|
81
83
|
export declare function associateSessionMessageViewportAnchorId(message: AgentMessage, anchorId: string): void;
|
|
82
84
|
export declare function getSessionMessageViewportAnchorId(message: AgentMessage): string | undefined;
|
|
85
|
+
/** Returns registered viewport anchors for durable user messages in session order. */
|
|
86
|
+
export declare function getUserMessageViewportAnchorIds(messages: readonly AgentMessage[]): string[];
|
|
83
87
|
export declare function transferSessionMessageIdentity(source: AgentMessage[], target: AgentMessage[]): void;
|
|
84
88
|
export interface ThinkingLevelChangeEntry extends SessionEntryBase {
|
|
85
89
|
type: "thinking_level_change";
|
|
@@ -211,7 +215,19 @@ export interface CustomMessageEntry<T = unknown> extends SessionEntryBase {
|
|
|
211
215
|
}
|
|
212
216
|
/** Session entry - has id/parentId for tree structure (returned by "read" methods in SessionManager) */
|
|
213
217
|
export type SessionEntry = SessionMessageEntry | ThinkingLevelChangeEntry | ModelChangeEntry | ServiceTierChangeEntry | CompactionEntry | BranchSummaryEntry | CustomEntry | CustomMessageEntry | LabelEntry | TtsrInjectionEntry | MCPToolSelectionEntry | SessionInitEntry | ModeChangeEntry | ConfiguredModelChainEntry;
|
|
214
|
-
/**
|
|
218
|
+
/** Append-only replacement for mutable fields on the session header. */
|
|
219
|
+
export interface HeaderPatchRecord {
|
|
220
|
+
type: "header_patch";
|
|
221
|
+
patch: Partial<Pick<SessionHeader, "title" | "titleSource" | "cwd">>;
|
|
222
|
+
}
|
|
223
|
+
/** Append-only replacement for replay metadata on one existing session entry. */
|
|
224
|
+
export interface EntryPatchRecord {
|
|
225
|
+
type: "entry_patch";
|
|
226
|
+
entryId: string;
|
|
227
|
+
patch: Partial<Pick<SessionMessageEntry, "message">>;
|
|
228
|
+
}
|
|
229
|
+
export type SessionPatchRecord = HeaderPatchRecord | EntryPatchRecord;
|
|
230
|
+
/** Resolved file entries; patch records are applied by parseSessionEntries(). */
|
|
215
231
|
export type FileEntry = SessionHeader | SessionEntry;
|
|
216
232
|
export type DefaultModelSelectionStage = {
|
|
217
233
|
readonly entryRevision: number;
|
|
@@ -282,7 +298,16 @@ export interface ResumeTailTerminal {
|
|
|
282
298
|
}
|
|
283
299
|
export interface ResumeTailError {
|
|
284
300
|
kind: "error";
|
|
285
|
-
reason: "missing" | "malformed" | "unstable" | "read-failed";
|
|
301
|
+
reason: "missing" | "malformed" | "unstable" | "read-failed" | "legacy_migration_disabled";
|
|
302
|
+
}
|
|
303
|
+
export type SessionDirectoryMigrationPolicy = ManagedMigrationPolicy;
|
|
304
|
+
export declare class SessionManagedStorageError extends Error {
|
|
305
|
+
readonly code = "managed_storage_unsupported";
|
|
306
|
+
constructor();
|
|
307
|
+
}
|
|
308
|
+
export declare class SessionMigrationPolicyError extends Error {
|
|
309
|
+
readonly code = "legacy_migration_disabled";
|
|
310
|
+
constructor();
|
|
286
311
|
}
|
|
287
312
|
export type ResumeTailInspection = ResumeTailResumable | ResumeTailTerminal | ResumeTailError;
|
|
288
313
|
export interface StrictSessionOpenSuccess {
|
|
@@ -321,6 +346,8 @@ export interface SessionInfo {
|
|
|
321
346
|
created: Date;
|
|
322
347
|
modified: Date;
|
|
323
348
|
messageCount: number;
|
|
349
|
+
/** True when messageCount was counted from only the bounded list prefix. */
|
|
350
|
+
messageCountIsEstimate?: boolean;
|
|
324
351
|
/** File size in bytes on disk; used for compact list rendering. */
|
|
325
352
|
size: number;
|
|
326
353
|
firstMessage: string;
|
|
@@ -367,7 +394,35 @@ export type SessionManagerCloseOutcome = {
|
|
|
367
394
|
kind: "close_unknown";
|
|
368
395
|
error: Error;
|
|
369
396
|
};
|
|
370
|
-
|
|
397
|
+
/** Read-only session state made available to extensions and custom tools. */
|
|
398
|
+
/** Frozen read-only session facade made available to extensions and custom tools. */
|
|
399
|
+
export interface ReadonlySessionManager {
|
|
400
|
+
getCwd(): string;
|
|
401
|
+
getSessionDir(): string;
|
|
402
|
+
getSessionId(): string;
|
|
403
|
+
getSessionFile(): string | undefined;
|
|
404
|
+
getSessionName(): string | undefined;
|
|
405
|
+
getArtifactsDir(): string | null;
|
|
406
|
+
getArtifactPath(id: string): Promise<string | null>;
|
|
407
|
+
getLeafId(): string | null;
|
|
408
|
+
getLeafEntry(): SessionEntry | undefined;
|
|
409
|
+
getEntry(id: string): SessionEntry | undefined;
|
|
410
|
+
getLabel(id: string): string | undefined;
|
|
411
|
+
getBranch(fromId?: string): SessionEntry[];
|
|
412
|
+
getHeader(): SessionHeader | null;
|
|
413
|
+
getEntries(): SessionEntry[];
|
|
414
|
+
getTree(): SessionTreeNode[];
|
|
415
|
+
getUsageStatistics(): UsageStatistics;
|
|
416
|
+
}
|
|
417
|
+
/** Creates an immutable facade that never exposes SessionManager mutation authority. */
|
|
418
|
+
export declare function createReadonlySessionManager(manager: SessionManager): ReadonlySessionManager;
|
|
419
|
+
/** Internal artifact-writing capability. Read-only facades expose it only through a private weak-map lookup. */
|
|
420
|
+
export type SessionArtifactCapability = Readonly<Pick<SessionManager, "allocateArtifactPath" | "saveArtifact" | "putBlob">>;
|
|
421
|
+
/**
|
|
422
|
+
* Returns the artifact capability for a concrete persistence owner or one of its
|
|
423
|
+
* immutable read-only facades. Structural lookalikes remain unauthorized.
|
|
424
|
+
*/
|
|
425
|
+
export declare function sessionArtifactCapability(value: unknown): SessionArtifactCapability | undefined;
|
|
371
426
|
/** Exported for testing */
|
|
372
427
|
export declare function migrateSessionEntries(entries: FileEntry[]): void;
|
|
373
428
|
/** Exported for compaction.test.ts */
|
|
@@ -408,6 +463,11 @@ declare class RecentSessionInfo {
|
|
|
408
463
|
export declare function recoverOrphanedBackups(sessionDir: string, storage: SessionStorage): Promise<void>;
|
|
409
464
|
/** Exported for testing */
|
|
410
465
|
export declare function findMostRecentSession(sessionDir: string, storage?: SessionStorage): Promise<string | null>;
|
|
466
|
+
interface SessionMoveDirectoryHandle {
|
|
467
|
+
sync(): Promise<void>;
|
|
468
|
+
close(): Promise<void>;
|
|
469
|
+
}
|
|
470
|
+
export declare function syncSessionMoveDirectory(directory: string, platform?: NodeJS.Platform, openDirectory?: (directory: string) => Promise<SessionMoveDirectoryHandle>): Promise<void>;
|
|
411
471
|
declare const RESIDENT_BLOB_SENTINEL_KEY = "__gjcResidentBlob";
|
|
412
472
|
type ResidentBlobKind = "text" | "imageUrl" | "imageData";
|
|
413
473
|
interface ResidentBlobSentinel {
|
|
@@ -481,7 +541,7 @@ export declare class SessionManager {
|
|
|
481
541
|
setSessionFile(sessionFile: string): Promise<void>;
|
|
482
542
|
/** Start a new session. Closes any existing writer first. */
|
|
483
543
|
newSession(options?: NewSessionOptions): Promise<string | undefined>;
|
|
484
|
-
/**
|
|
544
|
+
/** Tombstone and exact-delete managed transcripts, detaching the active transcript first. */
|
|
485
545
|
dropSession(sessionPath: string): Promise<void>;
|
|
486
546
|
/**
|
|
487
547
|
* Fork the current session, creating a new session file with the same entries.
|
|
@@ -639,6 +699,8 @@ export declare class SessionManager {
|
|
|
639
699
|
* the canonical store. This applies such mutations for real.
|
|
640
700
|
*/
|
|
641
701
|
applyEntryMessageUpdates(entries: readonly SessionMessageEntry[]): void;
|
|
702
|
+
/** Write mutated custom-message entries back into the canonical entry store by id. */
|
|
703
|
+
applyCustomMessageEntryUpdates(entries: readonly CustomMessageEntry[]): void;
|
|
642
704
|
/**
|
|
643
705
|
* Rewrite the session file after in-place entry updates.
|
|
644
706
|
* Use sparingly (e.g., pruning old tool outputs).
|
|
@@ -717,8 +779,11 @@ export declare class SessionManager {
|
|
|
717
779
|
* Build the session context (what gets sent to the LLM).
|
|
718
780
|
* Uses tree traversal from current leaf.
|
|
719
781
|
*/
|
|
782
|
+
/**
|
|
783
|
+
* Return a defensive context snapshot for public consumers.
|
|
784
|
+
*/
|
|
720
785
|
buildSessionContext(): SessionContext;
|
|
721
|
-
/** Strip stale OpenAI Responses assistant replay metadata from loaded in-memory entries. */
|
|
786
|
+
/** Strip stale OpenAI Responses assistant replay metadata from loaded in-memory entries without persisting it. */
|
|
722
787
|
sanitizeLoadedOpenAIResponsesReplayMetadata(): boolean;
|
|
723
788
|
/**
|
|
724
789
|
* Get session header.
|
|
@@ -726,11 +791,12 @@ export declare class SessionManager {
|
|
|
726
791
|
getHeader(): SessionHeader | null;
|
|
727
792
|
getEntries(): SessionEntry[];
|
|
728
793
|
/**
|
|
729
|
-
* Get the session as a tree structure. Returns
|
|
794
|
+
* Get the session as a tree structure. Returns defensive copies of all entries.
|
|
730
795
|
* A well-formed session has exactly one root (first entry with parentId === null).
|
|
731
796
|
* Orphaned entries (broken parent chain) are also returned as roots.
|
|
732
797
|
*/
|
|
733
798
|
getTree(): SessionTreeNode[];
|
|
799
|
+
[sessionManagerReadCapability](): SessionManagerReadAccess;
|
|
734
800
|
/**
|
|
735
801
|
* Start a new branch from an earlier entry.
|
|
736
802
|
* Moves the leaf pointer to the specified entry. The next appendXXX() call
|
|
@@ -768,21 +834,25 @@ export declare class SessionManager {
|
|
|
768
834
|
* @param sessionDir Optional session directory. If omitted, uses default (~/.gjc/agent/sessions/<encoded-cwd>/).
|
|
769
835
|
*/
|
|
770
836
|
static create(cwd: string, sessionDir?: string, storage?: SessionStorage): SessionManager;
|
|
837
|
+
/** Resolve a default-managed candidate through binding validation and copy-retain migration before mutation. */
|
|
838
|
+
static prepareManagedCandidateForWrite(filePath: string, migrationPolicy: SessionDirectoryMigrationPolicy): Promise<string>;
|
|
771
839
|
/**
|
|
772
840
|
* Fork a session into the current project directory.
|
|
773
841
|
* Copies history from another session file while creating a new session file in the current sessionDir.
|
|
774
842
|
*/
|
|
775
|
-
static forkFrom(sourcePath: string, cwd: string, sessionDir?: string, storage?: SessionStorage): Promise<SessionManager>;
|
|
843
|
+
static forkFrom(sourcePath: string, cwd: string, sessionDir?: string, storage?: SessionStorage, migrationPolicy?: SessionDirectoryMigrationPolicy): Promise<SessionManager>;
|
|
776
844
|
/**
|
|
777
845
|
* Open a specific session file.
|
|
778
846
|
* @param path Path to session file
|
|
779
847
|
* @param sessionDir Optional session directory for /new or /branch. If omitted, derives from file's parent.
|
|
780
848
|
*/
|
|
781
|
-
static open(filePath: string, sessionDir?: string, storage?: SessionStorage): Promise<SessionManager>;
|
|
849
|
+
static open(filePath: string, sessionDir?: string, storage?: SessionStorage, migrationPolicy?: SessionDirectoryMigrationPolicy): Promise<SessionManager>;
|
|
782
850
|
/**
|
|
783
851
|
* List sessions for the resume picker without recovery or other maintenance writes.
|
|
784
852
|
*/
|
|
785
853
|
static listForResumePickerReadOnly(cwd: string, sessionDir?: string, storage?: SessionStorage): Promise<SessionInfo[]>;
|
|
854
|
+
/** Tombstone and exact-delete a default-managed candidate. */
|
|
855
|
+
static deleteManagedCandidate(sessionPath: string): Promise<void>;
|
|
786
856
|
/** Capture exact source content for a strict fork without granting write ownership. */
|
|
787
857
|
static captureTranscriptStrict(filePath: string, storage?: SessionStorage): StrictSessionCaptureResult;
|
|
788
858
|
/**
|
|
@@ -790,7 +860,7 @@ export declare class SessionManager {
|
|
|
790
860
|
* revalidate captured authority before destination initialization and transcript
|
|
791
861
|
* persistence; destination history always comes from the captured bytes.
|
|
792
862
|
*/
|
|
793
|
-
static forkFromCaptured(snapshot: CapturedSessionTranscriptSnapshot, cwd: string, sessionDir?: string): Promise<StrictSessionForkResult>;
|
|
863
|
+
static forkFromCaptured(snapshot: CapturedSessionTranscriptSnapshot, cwd: string, sessionDir?: string, _migrationPolicy?: SessionDirectoryMigrationPolicy): Promise<StrictSessionForkResult>;
|
|
794
864
|
/** Inspect a selected session without acquiring write-capable ownership. */
|
|
795
865
|
static inspectSessionTailReadOnly(filePath: string, storage?: SessionStorage): Promise<ResumeTailInspection>;
|
|
796
866
|
/**
|
|
@@ -798,13 +868,13 @@ export declare class SessionManager {
|
|
|
798
868
|
* the returned discriminant; an error result never creates, rewrites, or adopts
|
|
799
869
|
* the selected path. Breadcrumb ownership begins only after `kind: "opened"`.
|
|
800
870
|
*/
|
|
801
|
-
static openExistingStrict(identity: ResumeSessionIdentity, sessionDir?: string, storage?: SessionStorage): Promise<StrictSessionOpenResult>;
|
|
871
|
+
static openExistingStrict(identity: ResumeSessionIdentity, sessionDir?: string, storage?: SessionStorage, migrationPolicy?: SessionDirectoryMigrationPolicy): Promise<StrictSessionOpenResult>;
|
|
802
872
|
/**
|
|
803
873
|
* Continue the most recent session, or create new if none.
|
|
804
874
|
* @param cwd Working directory
|
|
805
875
|
* @param sessionDir Optional session directory. If omitted, uses default (~/.gjc/agent/sessions/<encoded-cwd>/).
|
|
806
876
|
*/
|
|
807
|
-
static continueRecent(cwd: string, sessionDir?: string, storage?: SessionStorage): Promise<SessionManager>;
|
|
877
|
+
static continueRecent(cwd: string, sessionDir?: string, storage?: SessionStorage, migrationPolicy?: SessionDirectoryMigrationPolicy): Promise<SessionManager>;
|
|
808
878
|
/** Create an in-memory session (no file persistence) */
|
|
809
879
|
static inMemory(cwd?: string, storage?: SessionStorage): SessionManager;
|
|
810
880
|
/**
|
|
@@ -109,10 +109,13 @@ export interface SessionStorage {
|
|
|
109
109
|
deleteSessionVerified?(target: VerifiedSessionDeleteTarget): Promise<VerifiedSessionDeleteResult>;
|
|
110
110
|
openWriter(path: string, options?: SessionStorageWriterOpenOptions): SessionStorageWriter;
|
|
111
111
|
}
|
|
112
|
-
/** Exact
|
|
112
|
+
/** Exact authorization evidence for a transcript or artifact path. */
|
|
113
113
|
export interface SessionStorageFileIdentity {
|
|
114
114
|
dev: bigint;
|
|
115
115
|
ino: bigint;
|
|
116
|
+
size: number;
|
|
117
|
+
mtimeNs: bigint;
|
|
118
|
+
sha256: string;
|
|
116
119
|
}
|
|
117
120
|
/** Kind of verification failure surfaced by {@link deleteSessionVerified}. */
|
|
118
121
|
export type VerifiedDeleteFailureKind = "containment" | "symlink" | "stat" | "identity" | "header" | "cwd" | "artifacts";
|
|
@@ -149,6 +152,18 @@ export interface VerifiedSessionDeleteTarget {
|
|
|
149
152
|
* fails closed. Omit on first attempt or to accept recorded absence.
|
|
150
153
|
*/
|
|
151
154
|
expectedArtifactsIdentity?: SessionStorageFileIdentity;
|
|
155
|
+
/** Stable native recursive-tree evidence captured before artifact detachment. */
|
|
156
|
+
expectedArtifactsTree?: NativeDirectoryTreeSnapshot;
|
|
157
|
+
/** Identity-bound quarantine path retained when recursive artifact cleanup failed. */
|
|
158
|
+
detachedArtifactsPath?: string;
|
|
159
|
+
/** Identity-bound quarantine path retained when transcript unlink deferred cleanup. */
|
|
160
|
+
detachedTranscriptPath?: string;
|
|
161
|
+
/** Caller-published, no-replace quarantine pathname for the next artifact detach. */
|
|
162
|
+
plannedArtifactsPath?: string;
|
|
163
|
+
/** Caller-published, no-replace quarantine pathname for the next transcript detach. */
|
|
164
|
+
plannedTranscriptPath?: string;
|
|
165
|
+
/** Set only after a durable caller receipt records successful artifact removal. */
|
|
166
|
+
artifactsRemoved?: true;
|
|
152
167
|
}
|
|
153
168
|
/**
|
|
154
169
|
* Outcome of a verified hard delete. Artifact removal happens first; only after
|
|
@@ -157,6 +172,10 @@ export interface VerifiedSessionDeleteTarget {
|
|
|
157
172
|
* `deleted` and never `{}`.
|
|
158
173
|
*/
|
|
159
174
|
export type VerifiedSessionDeleteResult = {
|
|
175
|
+
kind: "artifacts_removed";
|
|
176
|
+
phase: "artifacts";
|
|
177
|
+
transcriptIdentity: SessionStorageFileIdentity;
|
|
178
|
+
} | {
|
|
160
179
|
kind: "deleted";
|
|
161
180
|
} | {
|
|
162
181
|
kind: "cleanup_pending";
|
|
@@ -164,6 +183,10 @@ export type VerifiedSessionDeleteResult = {
|
|
|
164
183
|
error: Error;
|
|
165
184
|
/** Artifact directory identity at failure time; undefined when absent. */
|
|
166
185
|
artifactsIdentity: SessionStorageFileIdentity | undefined;
|
|
186
|
+
/** Identity-bound quarantine path retained when recursive cleanup failed. */
|
|
187
|
+
detachedArtifactsPath: string;
|
|
188
|
+
/** Native snapshot required for an identity-bound recursive retry. */
|
|
189
|
+
artifactsTree: NativeDirectoryTreeSnapshot;
|
|
167
190
|
/** Transcript identity (unchanged) for retry binding. */
|
|
168
191
|
transcriptIdentity: SessionStorageFileIdentity;
|
|
169
192
|
} | {
|
|
@@ -172,6 +195,22 @@ export type VerifiedSessionDeleteResult = {
|
|
|
172
195
|
error: Error;
|
|
173
196
|
/** Transcript identity at failure time for retry binding. */
|
|
174
197
|
transcriptIdentity: SessionStorageFileIdentity;
|
|
198
|
+
/** Optional identity-bound transcript quarantine path for restart cleanup. */
|
|
199
|
+
detachedTranscriptPath?: string;
|
|
200
|
+
};
|
|
201
|
+
type NativeDirectoryTreeEntry = {
|
|
202
|
+
relativePath: string;
|
|
203
|
+
kind: string;
|
|
204
|
+
dev: string;
|
|
205
|
+
ino: string;
|
|
206
|
+
size: string;
|
|
207
|
+
mtimeNs: string;
|
|
208
|
+
sha256?: string;
|
|
209
|
+
};
|
|
210
|
+
export type NativeDirectoryTreeSnapshot = {
|
|
211
|
+
rootDev: string;
|
|
212
|
+
rootIno: string;
|
|
213
|
+
entries: NativeDirectoryTreeEntry[];
|
|
175
214
|
};
|
|
176
215
|
export declare class FileSessionStorage implements SessionStorage {
|
|
177
216
|
#private;
|
|
@@ -194,8 +233,8 @@ export declare class FileSessionStorage implements SessionStorage {
|
|
|
194
233
|
unlinkSync(path: string): void;
|
|
195
234
|
openWriter(path: string, options?: SessionStorageWriterOpenOptions): SessionStorageWriter;
|
|
196
235
|
/**
|
|
197
|
-
* Delete a session
|
|
198
|
-
*
|
|
236
|
+
* Delete a session and sibling artifacts in an operator-selected explicit directory.
|
|
237
|
+
* Default managed roots use deleteSessionVerified and never call this path.
|
|
199
238
|
*/
|
|
200
239
|
deleteSessionWithArtifacts(sessionPath: string): Promise<void>;
|
|
201
240
|
/**
|
|
@@ -228,3 +267,4 @@ export declare class MemorySessionStorage implements SessionStorage {
|
|
|
228
267
|
deleteSessionVerified(target: VerifiedSessionDeleteTarget): Promise<VerifiedSessionDeleteResult>;
|
|
229
268
|
openWriter(path: string, options?: SessionStorageWriterOpenOptions): SessionStorageWriter;
|
|
230
269
|
}
|
|
270
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CustomMessageEntry, SessionEntry } from "./session-manager";
|
|
2
|
+
/**
|
|
3
|
+
* Volatile context is refreshed for every prompt. Only its newest copy is useful;
|
|
4
|
+
* replacing older copies at a maintenance boundary preserves the audit trail
|
|
5
|
+
* without repeatedly charging the model for stale workspace snapshots.
|
|
6
|
+
*/
|
|
7
|
+
export declare function pruneSupersededVolatileProjectContext(entries: readonly SessionEntry[]): {
|
|
8
|
+
changed: CustomMessageEntry[];
|
|
9
|
+
bytesSaved: number;
|
|
10
|
+
};
|
|
11
|
+
/** Retire superseded known singleton maintenance reminders without touching ordinary user context. */
|
|
12
|
+
export declare function pruneSupersededMaintenanceReminders(entries: readonly SessionEntry[]): {
|
|
13
|
+
changed: CustomMessageEntry[];
|
|
14
|
+
bytesSaved: number;
|
|
15
|
+
};
|
package/dist/types/skill-state/{deep-interview-mutation-guard.d.ts → workflow-mutation-guard.d.ts}
RENAMED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AgentTool } from "@gajae-code/agent-core";
|
|
2
|
+
import { readVisibleSkillActiveState } from "./active-state";
|
|
2
3
|
export declare const DEEP_INTERVIEW_MUTATION_BLOCK_MESSAGE = "Deep-interview phase boundary: continue gathering context/questions/risks and emit a handoff/spec before code edits. Mutation tools and patch execution are blocked while deep-interview is active; finalize specs through `gjc deep-interview --write --stage final` or hand off to an execution phase.";
|
|
3
4
|
export declare const WORKFLOW_STATE_MUTATION_BLOCK_MESSAGE = ".gjc workflow state and artifacts are runtime-owned. Agent mutation tools cannot edit `.gjc/**`; use the sanctioned `gjc` CLI instead.";
|
|
4
5
|
export declare const RALPLAN_MUTATION_BLOCK_MESSAGE = "Ralplan planning phase boundary: keep refining the consensus plan and persist plan artifacts through `gjc ralplan --write` (stage scratch files under a temp dir if needed). Product-code mutation tools and patch execution are blocked while ralplan is active; mutate only after the plan is approved and execution begins.";
|
|
@@ -7,7 +8,7 @@ type ToolWithEditMode = AgentTool & {
|
|
|
7
8
|
mode?: unknown;
|
|
8
9
|
customWireName?: unknown;
|
|
9
10
|
};
|
|
10
|
-
export interface
|
|
11
|
+
export interface WorkflowMutationGuardInput {
|
|
11
12
|
cwd: string;
|
|
12
13
|
sessionId?: string;
|
|
13
14
|
threadId?: string;
|
|
@@ -15,24 +16,39 @@ export interface DeepInterviewMutationGuardInput {
|
|
|
15
16
|
args: unknown;
|
|
16
17
|
forceOverride?: boolean;
|
|
17
18
|
enforceWorkflowState?: boolean;
|
|
19
|
+
guardContext?: WorkflowGuardContext;
|
|
18
20
|
}
|
|
19
|
-
export interface
|
|
21
|
+
export interface WorkflowMutationDecision {
|
|
20
22
|
blocked: boolean;
|
|
21
23
|
message?: string;
|
|
22
24
|
targets: string[];
|
|
23
25
|
reason?: string;
|
|
24
26
|
command?: string;
|
|
25
27
|
}
|
|
26
|
-
export
|
|
28
|
+
export interface WorkflowGuardContext {
|
|
29
|
+
sessionId: string | null;
|
|
30
|
+
activeState: Awaited<ReturnType<typeof readVisibleSkillActiveState>>;
|
|
31
|
+
modeStates: ReadonlyMap<string, ModeState | null>;
|
|
32
|
+
}
|
|
33
|
+
interface ModeState {
|
|
34
|
+
active?: boolean;
|
|
35
|
+
current_phase?: string;
|
|
36
|
+
session_id?: string;
|
|
37
|
+
thread_id?: string;
|
|
38
|
+
[key: string]: unknown;
|
|
39
|
+
}
|
|
40
|
+
export declare function readWorkflowGuardContext(cwd: string, options?: {
|
|
41
|
+
sessionId?: string;
|
|
42
|
+
threadId?: string;
|
|
43
|
+
}): Promise<WorkflowGuardContext>;
|
|
44
|
+
export declare function assertWorkflowMutationRawPathsAllowed(input: {
|
|
27
45
|
cwd: string;
|
|
28
46
|
sessionId?: string;
|
|
29
47
|
threadId?: string;
|
|
30
48
|
rawPaths: string[];
|
|
31
49
|
forceOverride?: boolean;
|
|
50
|
+
guardContext?: WorkflowGuardContext;
|
|
32
51
|
}): Promise<void>;
|
|
33
|
-
export declare function
|
|
34
|
-
export declare function
|
|
35
|
-
export declare const getWorkflowMutationDecision: typeof getDeepInterviewMutationDecision;
|
|
36
|
-
export declare const assertWorkflowMutationAllowed: typeof assertDeepInterviewMutationAllowed;
|
|
37
|
-
export declare const assertWorkflowMutationRawPathsAllowed: typeof assertDeepInterviewMutationRawPathsAllowed;
|
|
52
|
+
export declare function getWorkflowMutationDecision(input: WorkflowMutationGuardInput): Promise<WorkflowMutationDecision>;
|
|
53
|
+
export declare function assertWorkflowMutationAllowed(input: WorkflowMutationGuardInput): Promise<void>;
|
|
38
54
|
export {};
|
|
@@ -40,14 +40,12 @@ export interface AuditEntry {
|
|
|
40
40
|
paths: string[];
|
|
41
41
|
}
|
|
42
42
|
export declare function workflowModeStateFileName(skill: CanonicalGjcWorkflowSkill): string;
|
|
43
|
-
export declare function workflowStateStoragePath(cwd: string, skill: CanonicalGjcWorkflowSkill, sessionId?: string): string;
|
|
44
|
-
export declare function workflowActiveStatePath(cwd: string, sessionId?: string): string;
|
|
45
43
|
export declare function buildWorkflowStateReceipt(input: {
|
|
46
44
|
cwd: string;
|
|
47
45
|
skill: CanonicalGjcWorkflowSkill;
|
|
48
46
|
owner: WorkflowStateMutationOwner;
|
|
49
47
|
command: string;
|
|
50
|
-
sessionId
|
|
48
|
+
sessionId: string;
|
|
51
49
|
nowIso?: string;
|
|
52
50
|
mutationId?: string;
|
|
53
51
|
}): WorkflowStateReceipt;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { type ComposerSubmissionOptions } from "../modes/types";
|
|
1
2
|
import type { BuiltinSlashCommand, ParsedSlashCommand, SlashCommandResult, SlashCommandRuntime, SlashCommandSpec, TuiSlashCommandRuntime } from "./types";
|
|
2
3
|
export type { BuiltinSlashCommand, SubcommandDef } from "./types";
|
|
3
4
|
/** TUI-specific runtime accepted by `executeBuiltinSlashCommand`. */
|
|
4
|
-
export type BuiltinSlashCommandRuntime = TuiSlashCommandRuntime
|
|
5
|
+
export type BuiltinSlashCommandRuntime = TuiSlashCommandRuntime & {
|
|
6
|
+
composer?: ComposerSubmissionOptions;
|
|
7
|
+
};
|
|
5
8
|
export declare function formatUnknownBuiltinSlashCommandDiagnostic(commandName: string): string | undefined;
|
|
6
9
|
/** Builtin command metadata used for slash-command autocomplete and help text. */
|
|
7
10
|
export declare const BUILTIN_SLASH_COMMAND_DEFS: ReadonlyArray<BuiltinSlashCommand>;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { AgentTool } from "@gajae-code/agent-core";
|
|
5
5
|
import type { SkillsSettings } from "./config/settings";
|
|
6
|
-
import {
|
|
6
|
+
import type { Skill } from "./extensibility/skills";
|
|
7
7
|
import { type WorkspaceTree } from "./workspace-tree";
|
|
8
8
|
interface AlwaysApplyRule {
|
|
9
9
|
name: string;
|
|
@@ -75,17 +75,8 @@ export interface BuildSystemPromptOptions {
|
|
|
75
75
|
}>;
|
|
76
76
|
/** Intent field name injected into every tool schema. If set, explains the field in the prompt. */
|
|
77
77
|
intentField?: string;
|
|
78
|
-
/** Whether
|
|
79
|
-
mcpDiscoveryMode?: boolean;
|
|
80
|
-
/** Discoverable MCP server summaries to advertise when discovery mode is active. */
|
|
81
|
-
mcpDiscoveryServerSummaries?: string[];
|
|
82
|
-
/** Whether built-in tool discovery ("all" mode) is active; enables the tool-discovery prompt block. */
|
|
78
|
+
/** Whether built-in tool discovery is active; enables the tool-discovery prompt block. */
|
|
83
79
|
toolDiscoveryActive?: boolean;
|
|
84
|
-
/** Hidden discoverable tools to advertise (name + one-line summary) when tool discovery is active. */
|
|
85
|
-
discoverableTools?: Array<{
|
|
86
|
-
name: string;
|
|
87
|
-
summary: string;
|
|
88
|
-
}>;
|
|
89
80
|
/** Encourage the agent to delegate via tasks unless changes are trivial. */
|
|
90
81
|
eagerTasks?: boolean;
|
|
91
82
|
/** Rules with alwaysApply=true — their full content is injected into the prompt. */
|