@gajae-code/coding-agent 0.17.1 → 0.17.4
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 +266 -0
- package/dist/types/async/job-manager.d.ts +7 -6
- package/dist/types/cli/daemon-cli.d.ts +3 -1
- package/dist/types/cli/github-release.d.ts +17 -0
- package/dist/types/cli/public-command-entry.d.ts +56 -0
- package/dist/types/cli/public-command-errors.d.ts +126 -0
- package/dist/types/cli/public-command-evidence.d.ts +99 -0
- package/dist/types/cli/public-command-help.d.ts +65 -0
- package/dist/types/cli/public-command-registry.d.ts +69 -0
- package/dist/types/cli/session-picker.d.ts +1 -1
- package/dist/types/cli/setup-cli.d.ts +1 -0
- package/dist/types/cli/skills-cli.d.ts +5 -0
- package/dist/types/cli.d.ts +3 -0
- package/dist/types/commands/daemon.d.ts +4 -50
- package/dist/types/commands/sdk.d.ts +20 -37
- package/dist/types/commands/setup.d.ts +3 -0
- package/dist/types/commands/skills.d.ts +9 -0
- package/dist/types/config/autorouting-tier-map.d.ts +24 -0
- package/dist/types/config/file-lock.d.ts +10 -1
- package/dist/types/config/model-profile-activation.d.ts +63 -4
- package/dist/types/config/model-registry.d.ts +20 -2
- package/dist/types/config/settings-schema.d.ts +11 -0
- package/dist/types/coordinator-mcp/question-state.d.ts +6 -1
- package/dist/types/coordinator-mcp/server.d.ts +3 -0
- package/dist/types/daemon/operator-contract.d.ts +5 -1
- package/dist/types/eval/js/worker-protocol.d.ts +2 -0
- package/dist/types/extensibility/extensions/types.d.ts +12 -0
- package/dist/types/extensibility/gjc-plugins/registry.d.ts +4 -0
- package/dist/types/extensibility/runtime-skill-discovery.d.ts +18 -0
- package/dist/types/extensibility/shared-events.d.ts +3 -1
- package/dist/types/gjc-runtime/session-state-lock.d.ts +61 -0
- package/dist/types/internal-urls/embedded-protocol.d.ts +9 -0
- package/dist/types/internal-urls/index.d.ts +1 -0
- package/dist/types/internal-urls/parse.d.ts +9 -1
- package/dist/types/main.d.ts +22 -0
- package/dist/types/modes/acp/acp-agent.d.ts +94 -1
- package/dist/types/modes/acp/startup-provenance.d.ts +16 -0
- package/dist/types/modes/components/custom-provider-wizard.d.ts +19 -1
- package/dist/types/modes/components/session-selector.d.ts +5 -2
- package/dist/types/modes/components/thinking-selector.d.ts +2 -1
- package/dist/types/modes/components/user-message-selector.d.ts +5 -2
- package/dist/types/modes/controllers/command-controller.d.ts +1 -1
- package/dist/types/modes/controllers/selector-controller.d.ts +1 -1
- package/dist/types/modes/interactive-mode.d.ts +1 -1
- package/dist/types/modes/shared/agent-wire/workflow-gate-broker.d.ts +11 -1
- package/dist/types/modes/shared/agent-wire/workflow-gate-types.d.ts +14 -1
- package/dist/types/modes/types.d.ts +2 -2
- package/dist/types/runtime/process-lifecycle.d.ts +2 -0
- package/dist/types/runtime-mcp/manager.d.ts +56 -0
- package/dist/types/runtime-mcp/pool.d.ts +17 -0
- package/dist/types/runtime-mcp/redaction.d.ts +20 -0
- package/dist/types/runtime-mcp/startup-policy.d.ts +6 -0
- package/dist/types/runtime-mcp/tool-bridge.d.ts +9 -0
- package/dist/types/runtime-mcp/transports/http.d.ts +11 -0
- package/dist/types/sdk/acp/adapter.d.ts +27 -0
- package/dist/types/sdk/acp/final-text.d.ts +8 -0
- package/dist/types/sdk/broker/broker.d.ts +13 -2
- package/dist/types/sdk/broker/ensure.d.ts +46 -1
- package/dist/types/sdk/broker/identity.d.ts +3 -1
- package/dist/types/sdk/broker/lifecycle-ledger.d.ts +23 -3
- package/dist/types/sdk/broker/lifecycle.d.ts +15 -8
- package/dist/types/sdk/broker/runtime.d.ts +1 -1
- package/dist/types/sdk/broker/session-index.d.ts +22 -3
- package/dist/types/sdk/broker/spawn-authority.d.ts +4 -0
- package/dist/types/sdk/broker/stderr-drainer.d.ts +13 -0
- package/dist/types/sdk/bus/index.d.ts +19 -0
- package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +3 -1
- package/dist/types/sdk/bus/telegram-daemon.d.ts +5 -0
- package/dist/types/sdk/cli/master-cli.d.ts +6 -10
- package/dist/types/sdk/cli/rows.d.ts +19 -1
- package/dist/types/sdk/cli/session-cli.d.ts +22 -5
- package/dist/types/sdk/client/client.d.ts +2 -0
- package/dist/types/sdk/guides/cli.d.ts +3 -4
- package/dist/types/sdk/guides/verify.d.ts +2 -0
- package/dist/types/sdk/host/host.d.ts +9 -0
- package/dist/types/sdk/host/session-runtime.d.ts +31 -0
- package/dist/types/sdk/host/types.d.ts +10 -0
- package/dist/types/sdk/index.d.ts +1 -0
- package/dist/types/sdk/prompt-deadline-flush.d.ts +83 -0
- package/dist/types/sdk/prompt-deadline-manager.d.ts +38 -1
- package/dist/types/sdk/prompt-failure.d.ts +30 -1
- package/dist/types/sdk/prompt-status.d.ts +8 -0
- package/dist/types/sdk/prompt-tool-boundary.d.ts +73 -0
- package/dist/types/sdk/router/replay-retention-gap-cache.d.ts +13 -0
- package/dist/types/sdk/router/session-router.d.ts +2 -0
- package/dist/types/sdk/startup-capability.d.ts +2 -0
- package/dist/types/sdk/transport/relay.d.ts +1 -0
- package/dist/types/sdk/transport/serve-cli.d.ts +73 -2
- package/dist/types/sdk/transport/stdio.d.ts +5 -1
- package/dist/types/session/agent-session.d.ts +168 -21
- package/dist/types/session/fallback-chain-controller.d.ts +6 -6
- package/dist/types/session/fold-coordinator.d.ts +17 -3
- package/dist/types/session/internal/managed-session-storage.d.ts +7 -1
- package/dist/types/session/session-manager.d.ts +64 -1
- package/dist/types/session/session-work-lease.d.ts +14 -0
- package/dist/types/setup/model-onboarding-guidance.d.ts +1 -1
- package/dist/types/setup/provider-onboarding.d.ts +81 -1
- package/dist/types/thinking.d.ts +3 -1
- package/dist/types/tools/bash.d.ts +37 -11
- package/dist/types/tools/job.d.ts +1 -1
- package/dist/types/tools/steer-fold.d.ts +31 -0
- package/dist/types/utils/git.d.ts +28 -2
- package/dist/types/utils/mupdf-embedded.d.ts +2 -0
- package/dist/types/utils/mupdf-wasm-embedded.d.ts +2 -0
- package/dist/types/utils/mupdf.d.ts +4 -0
- package/dist/types/utils/session-title-generation.d.ts +6 -0
- package/dist/types/utils/title-generator.d.ts +11 -2
- package/dist/types/web/scrapers/types.d.ts +3 -0
- package/package.json +18 -10
- package/scripts/build-binary.ts +9 -3
- package/scripts/compile-args.ts +0 -9
- package/scripts/embed-mupdf.ts +52 -0
- package/scripts/generate-sdk-operation-inventory.ts +31 -1
- package/scripts/vendor-markit.ts +196 -0
- package/src/async/job-manager.ts +60 -9
- package/src/cli/daemon-cli.ts +53 -18
- package/src/cli/github-release.ts +87 -5
- package/src/cli/mcp-cli.ts +38 -4
- package/src/cli/public-command-entry.ts +450 -0
- package/src/cli/public-command-errors.ts +581 -0
- package/src/cli/public-command-evidence.ts +717 -0
- package/src/cli/public-command-help.ts +360 -0
- package/src/cli/public-command-registry.ts +535 -0
- package/src/cli/session-picker.ts +2 -1
- package/src/cli/setup-cli.ts +9 -1
- package/src/cli/skills-cli.ts +46 -2
- package/src/cli.ts +61 -1
- package/src/commands/daemon.ts +65 -69
- package/src/commands/sdk.ts +232 -100
- package/src/commands/setup.ts +2 -0
- package/src/commands/skills.ts +11 -0
- package/src/config/autorouting-tier-map.ts +16 -0
- package/src/config/file-lock.ts +199 -68
- package/src/config/model-profile-activation.ts +406 -53
- package/src/config/model-registry.ts +204 -25
- package/src/config/settings-schema.ts +26 -2
- package/src/coordinator-mcp/policy.ts +10 -5
- package/src/coordinator-mcp/question-gate-codec.ts +17 -0
- package/src/coordinator-mcp/question-state.ts +175 -8
- package/src/coordinator-mcp/server.ts +528 -87
- package/src/coordinator-mcp/session-reaper.ts +6 -4
- package/src/crash/record-loader.ts +6 -2
- package/src/daemon/operator-contract.ts +26 -12
- package/src/debug/report-bundle.ts +114 -24
- package/src/defaults/gjc/skills/ultragoal/SKILL.md +1 -1
- package/src/eval/js/context-manager.ts +8 -8
- package/src/eval/js/worker-core.ts +9 -4
- package/src/eval/js/worker-protocol.ts +2 -0
- package/src/extensibility/extensions/runner.ts +52 -4
- package/src/extensibility/extensions/types.ts +10 -0
- package/src/extensibility/gjc-plugins/registry.ts +196 -37
- package/src/extensibility/runtime-skill-discovery.ts +61 -3
- package/src/extensibility/shared-events.ts +3 -1
- package/src/gjc-runtime/managed-owner-admission.ts +67 -50
- package/src/gjc-runtime/session-state-lock.ts +165 -24
- package/src/gjc-runtime/ultragoal-succession.ts +31 -3
- package/src/internal-urls/docs-index.generated.ts +21 -19
- package/src/internal-urls/embedded-protocol.ts +83 -0
- package/src/internal-urls/index.ts +1 -0
- package/src/internal-urls/parse.ts +21 -1
- package/src/internal-urls/router.ts +4 -2
- package/src/main.ts +123 -55
- package/src/modes/acp/acp-agent.ts +593 -47
- package/src/modes/acp/acp-event-mapper.ts +9 -0
- package/src/modes/acp/startup-provenance.ts +59 -0
- package/src/modes/components/custom-provider-wizard.ts +308 -7
- package/src/modes/components/model-selector.ts +31 -15
- package/src/modes/components/oauth-selector.ts +9 -0
- package/src/modes/components/session-selector.ts +47 -4
- package/src/modes/components/status-line/segments.ts +6 -1
- package/src/modes/components/thinking-selector.ts +7 -3
- package/src/modes/components/user-message-selector.ts +57 -15
- package/src/modes/controllers/command-controller.ts +58 -32
- package/src/modes/controllers/extension-ui-controller.ts +33 -7
- package/src/modes/controllers/input-controller.ts +4 -0
- package/src/modes/controllers/selector-controller.ts +177 -18
- package/src/modes/interactive-mode.ts +21 -7
- package/src/modes/runtime-init.ts +1 -0
- package/src/modes/shared/agent-wire/workflow-gate-broker.ts +124 -7
- package/src/modes/shared/agent-wire/workflow-gate-types.ts +16 -2
- package/src/modes/types.ts +2 -2
- package/src/prompts/agent-fragments/browser-aside.md +1 -0
- package/src/prompts/system/title-system.md +1 -1
- package/src/prompts/tools/bash.md +1 -1
- package/src/prompts/tools/job.md +1 -1
- package/src/prompts/tools/read.md +2 -0
- package/src/runtime/network-prewarm-service.test.ts +36 -1
- package/src/runtime/network-prewarm-service.ts +28 -3
- package/src/runtime/process-lifecycle.ts +22 -11
- package/src/runtime-mcp/config.ts +16 -1
- package/src/runtime-mcp/manager.ts +689 -55
- package/src/runtime-mcp/pool.test.ts +31 -0
- package/src/runtime-mcp/pool.ts +304 -28
- package/src/runtime-mcp/redaction.ts +42 -0
- package/src/runtime-mcp/startup-policy.ts +7 -0
- package/src/runtime-mcp/tool-bridge.ts +71 -0
- package/src/runtime-mcp/transports/http.ts +108 -25
- package/src/sdk/acp/adapter.ts +90 -9
- package/src/sdk/acp/final-text.ts +19 -2
- package/src/sdk/broker/broker.ts +378 -52
- package/src/sdk/broker/ensure.ts +97 -19
- package/src/sdk/broker/identity.ts +9 -1
- package/src/sdk/broker/lifecycle-ledger.ts +95 -31
- package/src/sdk/broker/lifecycle.ts +690 -141
- package/src/sdk/broker/runtime.ts +1 -1
- package/src/sdk/broker/session-index.ts +97 -4
- package/src/sdk/broker/spawn-authority.ts +35 -7
- package/src/sdk/broker/stderr-drainer.ts +59 -0
- package/src/sdk/bus/chat-daemon-control.ts +2 -2
- package/src/sdk/bus/chat-daemon-runtime.ts +1 -0
- package/src/sdk/bus/index.ts +721 -84
- package/src/sdk/bus/telegram-daemon-cli.ts +31 -2
- package/src/sdk/bus/telegram-daemon-contract.ts +3 -1
- package/src/sdk/bus/telegram-daemon.ts +10 -3
- package/src/sdk/cli/master-cli.ts +47 -36
- package/src/sdk/cli/rows.ts +30 -7
- package/src/sdk/cli/session-cli.ts +687 -184
- package/src/sdk/client/client.ts +18 -0
- package/src/sdk/guides/catalog.ts +2 -2
- package/src/sdk/guides/cli.ts +20 -62
- package/src/sdk/guides/verify.ts +14 -0
- package/src/sdk/host/host.ts +49 -5
- package/src/sdk/host/session-runtime.test.ts +636 -9
- package/src/sdk/host/session-runtime.ts +499 -118
- package/src/sdk/host/types.ts +12 -1
- package/src/sdk/host/websocket-transport.lifecycle.test.ts +84 -0
- package/src/sdk/host/websocket-transport.ts +40 -6
- package/src/sdk/index.ts +11 -0
- package/src/sdk/prompt-deadline-flush.ts +334 -0
- package/src/sdk/prompt-deadline-manager.ts +136 -4
- package/src/sdk/prompt-failure.ts +43 -1
- package/src/sdk/prompt-status.ts +8 -0
- package/src/sdk/prompt-tool-boundary.ts +121 -0
- package/src/sdk/protocol/operation-inventory.generated.json +106 -0
- package/src/sdk/router/replay-retention-gap-cache.ts +27 -0
- package/src/sdk/router/session-router.ts +31 -4
- package/src/sdk/session.ts +194 -16
- package/src/sdk/startup-capability.ts +1 -1
- package/src/sdk/transport/relay.ts +71 -6
- package/src/sdk/transport/serve-cli.ts +494 -49
- package/src/sdk/transport/socket.ts +12 -11
- package/src/sdk/transport/stdio.ts +7 -3
- package/src/session/agent-session.ts +2437 -400
- package/src/session/fallback-chain-controller.ts +6 -7
- package/src/session/fold-coordinator.ts +24 -5
- package/src/session/internal/managed-session-scope.ts +58 -18
- package/src/session/internal/managed-session-storage.ts +304 -11
- package/src/session/session-manager.ts +382 -44
- package/src/session/session-work-lease.ts +34 -0
- package/src/session-import/codex.ts +12 -3
- package/src/setup/model-onboarding-guidance.ts +1 -1
- package/src/setup/provider-onboarding.ts +397 -24
- package/src/slash-commands/builtin-registry.ts +258 -14
- package/src/task/index.ts +14 -2
- package/src/thinking.ts +21 -2
- package/src/tools/bash.ts +98 -78
- package/src/tools/fetch.ts +119 -20
- package/src/tools/job.ts +151 -25
- package/src/tools/output-meta.ts +15 -2
- package/src/tools/path-utils.ts +27 -3
- package/src/tools/read.ts +3 -3
- package/src/tools/steer-fold.ts +107 -0
- package/src/tools/tool-catalog.generated.ts +29 -2
- package/src/tools/tool-errors.ts +4 -0
- package/src/utils/git.ts +53 -3
- package/src/utils/markit.ts +55 -41
- package/src/utils/mupdf-assets.d.ts +4 -0
- package/src/utils/mupdf-embedded.ts +4 -0
- package/src/utils/mupdf-wasm-embedded.ts +3 -0
- package/src/utils/mupdf-wasm.ts +24 -2
- package/src/utils/mupdf.ts +129 -0
- package/src/utils/session-title-generation.ts +29 -0
- package/src/utils/title-generator.ts +46 -2
- package/src/web/scrapers/types.ts +24 -3
- package/vendor/markit-ai/LICENSE +21 -0
- package/vendor/markit-ai/MANIFEST.json +412 -0
- package/vendor/markit-ai/dist/commands/config.d.ts +4 -0
- package/vendor/markit-ai/dist/commands/config.js +139 -0
- package/vendor/markit-ai/dist/commands/convert.d.ts +6 -0
- package/vendor/markit-ai/dist/commands/convert.js +113 -0
- package/vendor/markit-ai/dist/commands/formats.d.ts +2 -0
- package/vendor/markit-ai/dist/commands/formats.js +92 -0
- package/vendor/markit-ai/dist/commands/init.d.ts +2 -0
- package/vendor/markit-ai/dist/commands/init.js +29 -0
- package/vendor/markit-ai/dist/commands/onboard.d.ts +2 -0
- package/vendor/markit-ai/dist/commands/onboard.js +61 -0
- package/vendor/markit-ai/dist/commands/plugin.d.ts +4 -0
- package/vendor/markit-ai/dist/commands/plugin.js +58 -0
- package/vendor/markit-ai/dist/config.d.ts +26 -0
- package/vendor/markit-ai/dist/config.js +42 -0
- package/vendor/markit-ai/dist/converters/audio.d.ts +7 -0
- package/vendor/markit-ai/dist/converters/audio.js +104 -0
- package/vendor/markit-ai/dist/converters/csv.d.ts +7 -0
- package/vendor/markit-ai/dist/converters/csv.js +83 -0
- package/vendor/markit-ai/dist/converters/docx.d.ts +6 -0
- package/vendor/markit-ai/dist/converters/docx.js +57 -0
- package/vendor/markit-ai/dist/converters/epub.d.ts +8 -0
- package/vendor/markit-ai/dist/converters/epub.js +128 -0
- package/vendor/markit-ai/dist/converters/github.d.ts +18 -0
- package/vendor/markit-ai/dist/converters/github.js +148 -0
- package/vendor/markit-ai/dist/converters/html.d.ts +6 -0
- package/vendor/markit-ai/dist/converters/html.js +30 -0
- package/vendor/markit-ai/dist/converters/image.d.ts +6 -0
- package/vendor/markit-ai/dist/converters/image.js +124 -0
- package/vendor/markit-ai/dist/converters/ipynb.d.ts +6 -0
- package/vendor/markit-ai/dist/converters/ipynb.js +75 -0
- package/vendor/markit-ai/dist/converters/iwork.d.ts +20 -0
- package/vendor/markit-ai/dist/converters/iwork.js +391 -0
- package/vendor/markit-ai/dist/converters/json.d.ts +6 -0
- package/vendor/markit-ai/dist/converters/json.js +21 -0
- package/vendor/markit-ai/dist/converters/pdf/columns.d.ts +35 -0
- package/vendor/markit-ai/dist/converters/pdf/columns.js +93 -0
- package/vendor/markit-ai/dist/converters/pdf/extract.d.ts +19 -0
- package/vendor/markit-ai/dist/converters/pdf/extract.js +514 -0
- package/vendor/markit-ai/dist/converters/pdf/grid.d.ts +25 -0
- package/vendor/markit-ai/dist/converters/pdf/grid.js +795 -0
- package/vendor/markit-ai/dist/converters/pdf/headers.d.ts +24 -0
- package/vendor/markit-ai/dist/converters/pdf/headers.js +108 -0
- package/vendor/markit-ai/dist/converters/pdf/index.d.ts +19 -0
- package/vendor/markit-ai/dist/converters/pdf/index.js +136 -0
- package/vendor/markit-ai/dist/converters/pdf/mupdf-loader.js +9 -0
- package/vendor/markit-ai/dist/converters/pdf/render.d.ts +24 -0
- package/vendor/markit-ai/dist/converters/pdf/render.js +513 -0
- package/vendor/markit-ai/dist/converters/pdf/types.d.ts +75 -0
- package/vendor/markit-ai/dist/converters/pdf/types.js +1 -0
- package/vendor/markit-ai/dist/converters/plain-text.d.ts +6 -0
- package/vendor/markit-ai/dist/converters/plain-text.js +87 -0
- package/vendor/markit-ai/dist/converters/pptx.d.ts +8 -0
- package/vendor/markit-ai/dist/converters/pptx.js +289 -0
- package/vendor/markit-ai/dist/converters/rss.d.ts +11 -0
- package/vendor/markit-ai/dist/converters/rss.js +138 -0
- package/vendor/markit-ai/dist/converters/wikipedia.d.ts +6 -0
- package/vendor/markit-ai/dist/converters/wikipedia.js +33 -0
- package/vendor/markit-ai/dist/converters/xlsx.d.ts +8 -0
- package/vendor/markit-ai/dist/converters/xlsx.js +147 -0
- package/vendor/markit-ai/dist/converters/xml.d.ts +6 -0
- package/vendor/markit-ai/dist/converters/xml.js +18 -0
- package/vendor/markit-ai/dist/converters/yaml.d.ts +6 -0
- package/vendor/markit-ai/dist/converters/yaml.js +17 -0
- package/vendor/markit-ai/dist/converters/zip.d.ts +8 -0
- package/vendor/markit-ai/dist/converters/zip.js +57 -0
- package/vendor/markit-ai/dist/index.d.ts +30 -0
- package/vendor/markit-ai/dist/index.js +26 -0
- package/vendor/markit-ai/dist/main.d.ts +2 -0
- package/vendor/markit-ai/dist/main.js +191 -0
- package/vendor/markit-ai/dist/markit.d.ts +45 -0
- package/vendor/markit-ai/dist/markit.js +267 -0
- package/vendor/markit-ai/dist/plugins/api.d.ts +7 -0
- package/vendor/markit-ai/dist/plugins/api.js +42 -0
- package/vendor/markit-ai/dist/plugins/index.d.ts +4 -0
- package/vendor/markit-ai/dist/plugins/index.js +3 -0
- package/vendor/markit-ai/dist/plugins/installer.d.ts +25 -0
- package/vendor/markit-ai/dist/plugins/installer.js +176 -0
- package/vendor/markit-ai/dist/plugins/loader.d.ts +6 -0
- package/vendor/markit-ai/dist/plugins/loader.js +61 -0
- package/vendor/markit-ai/dist/plugins/types.d.ts +25 -0
- package/vendor/markit-ai/dist/plugins/types.js +1 -0
- package/vendor/markit-ai/dist/providers/anthropic.d.ts +2 -0
- package/vendor/markit-ai/dist/providers/anthropic.js +47 -0
- package/vendor/markit-ai/dist/providers/index.d.ts +21 -0
- package/vendor/markit-ai/dist/providers/index.js +56 -0
- package/vendor/markit-ai/dist/providers/openai.d.ts +2 -0
- package/vendor/markit-ai/dist/providers/openai.js +76 -0
- package/vendor/markit-ai/dist/providers/types.d.ts +26 -0
- package/vendor/markit-ai/dist/providers/types.js +1 -0
- package/vendor/markit-ai/dist/types.d.ts +36 -0
- package/vendor/markit-ai/dist/types.js +1 -0
- package/vendor/markit-ai/dist/utils/exit-codes.d.ts +4 -0
- package/vendor/markit-ai/dist/utils/exit-codes.js +4 -0
- package/vendor/markit-ai/dist/utils/output.d.ts +22 -0
- package/vendor/markit-ai/dist/utils/output.js +31 -0
- package/vendor/markit-ai/dist/utils/turndown.d.ts +8 -0
- package/vendor/markit-ai/dist/utils/turndown.js +70 -0
- package/vendor/markit-ai/package.json +74 -0
- package/vendor/markit-ai.patch +49 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Provider error text is retained only in the local diagnostic log; wire and
|
|
4
4
|
* persisted reconciliation details expose a fixed redacted message.
|
|
5
5
|
*/
|
|
6
|
-
import type { SdkPromptFailureCategory, SdkPromptFailurePhase, SdkPromptTerminalOutcome } from "./prompt-status";
|
|
6
|
+
import type { SdkPromptFailureCategory, SdkPromptFailurePhase, SdkPromptFailureRetryability, SdkPromptTerminalOutcome } from "./prompt-status";
|
|
7
7
|
export declare const PROMPT_FAILURE_CODE_MAX = 64;
|
|
8
8
|
export declare const PROMPT_FAILURE_MESSAGE_SUBMISSION = "Prompt submission failed.";
|
|
9
9
|
export declare const PROMPT_FAILURE_MESSAGE_POST_START_PROVIDER = "Provider failure after execution started.";
|
|
@@ -23,6 +23,35 @@ export declare function promptFailurePhase(evidence: PromptFailureEvidence): Sdk
|
|
|
23
23
|
export declare function isSdkPromptFailurePhase(value: unknown): value is SdkPromptFailurePhase;
|
|
24
24
|
/** Allowlisted origin category for a bounded safe classifier + provenance. */
|
|
25
25
|
export declare function promptFailureCategory(code: string | undefined, provenance: "agent_failed" | "deadline"): SdkPromptFailureCategory;
|
|
26
|
+
/**
|
|
27
|
+
* Whether the bounded category says an identical re-submission could still
|
|
28
|
+
* succeed. Read off the category alone, so it cannot drift from the sets above.
|
|
29
|
+
*
|
|
30
|
+
* `provider_transport` is the only transient class: every classifier in
|
|
31
|
+
* `PROVIDER_TRANSPORT_CODES` (and the 5xx range) describes the link to the
|
|
32
|
+
* provider failing, never a judgement about the request, so the same bytes may
|
|
33
|
+
* well succeed on a second attempt. That is exactly the class the shipped
|
|
34
|
+
* first-turn gate (`isStartupReadinessFailure`, issue #5574) already treats as
|
|
35
|
+
* re-submittable, so the wire signal and the internal gate stay in agreement.
|
|
36
|
+
*
|
|
37
|
+
* Everything else is terminal for this turn: `provider_rejected` is the provider
|
|
38
|
+
* judging this request (quota, refusal, 4xx) and re-sending it reproduces the
|
|
39
|
+
* rejection; `deadline` means the turn's budget is spent, which a re-submit does
|
|
40
|
+
* not restore; `agent_runtime` is a local fault that re-running the same prompt
|
|
41
|
+
* re-enters. `unknown` stays `unknown` — the module's standing contract is to
|
|
42
|
+
* preserve uncertain attribution rather than guess a recovery for it.
|
|
43
|
+
*
|
|
44
|
+
* This is advisory classification for the caller, not a retry gate: nothing in
|
|
45
|
+
* this repo's retry paths consults it.
|
|
46
|
+
*/
|
|
47
|
+
export declare function promptFailureRetryability(category: SdkPromptFailureCategory): SdkPromptFailureRetryability;
|
|
48
|
+
/**
|
|
49
|
+
* Whether a value is a safe bounded classifier token — the same rule
|
|
50
|
+
* `sanitizePromptFailure` and `assistantFailureCode` apply before retaining one.
|
|
51
|
+
* Anything else is provider text rather than a classifier and must not be
|
|
52
|
+
* forwarded to a caller.
|
|
53
|
+
*/
|
|
54
|
+
export declare function isSafePromptFailureCode(value: unknown): value is string;
|
|
26
55
|
/**
|
|
27
56
|
* Phase- and category-aware safe wording. A post-start failure is never
|
|
28
57
|
* described as a submission rejection; the wording says only what the bounded
|
|
@@ -65,6 +65,14 @@ export type SdkPromptFailurePhase = "submission" | "post_start";
|
|
|
65
65
|
* attribution is uncertain instead of guessing.
|
|
66
66
|
*/
|
|
67
67
|
export type SdkPromptFailureCategory = "provider_transport" | "provider_rejected" | "agent_runtime" | "deadline" | "unknown";
|
|
68
|
+
/**
|
|
69
|
+
* Whether the failure class says an identical re-submission could still succeed.
|
|
70
|
+
* Derived from `SdkPromptFailureCategory` alone (see `promptFailureRetryability`)
|
|
71
|
+
* so a consumer never has to re-implement the category matrix or parse a message.
|
|
72
|
+
* `unknown` is preserved rather than collapsed into `terminal`: an uncertain
|
|
73
|
+
* attribution is not evidence that the turn is unrecoverable.
|
|
74
|
+
*/
|
|
75
|
+
export type SdkPromptFailureRetryability = "transient" | "terminal" | "unknown";
|
|
68
76
|
export type SdkPromptTerminalOutcome = {
|
|
69
77
|
kind: "stopped";
|
|
70
78
|
reason: SdkPromptStopReason;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounded wait for an in-flight dispatched tool call to reach its boundary
|
|
3
|
+
* before an expired prompt deadline force-terminates the run (#5637).
|
|
4
|
+
*
|
|
5
|
+
* Terminal fencing aborts the run's cancellation domain FIRST and only proves
|
|
6
|
+
* settlement afterwards (`RunResourceLedger.waitForSettlement` resolves once the
|
|
7
|
+
* run is sealed and its tracked `kind: "tool"` resources have settled), so a
|
|
8
|
+
* tool that was mid-write when the deadline expired observes the aborted signal
|
|
9
|
+
* DURING its write and leaves a torn artifact behind. Waiting for that call's
|
|
10
|
+
* own `tool_execution_end` — under a short, finite grace — turns the kill into a
|
|
11
|
+
* boundary abort. When the grace is exhausted the run is force-terminated
|
|
12
|
+
* exactly as before, and the fact that a tool was still executing is returned as
|
|
13
|
+
* structured evidence rather than dropped.
|
|
14
|
+
*
|
|
15
|
+
* Deliberately dependency-light and clock-injectable: the contended bus module
|
|
16
|
+
* takes only a call, and the behaviour is testable without a live transport.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Hard bound on how long deadline expiry will wait for an in-flight tool call to
|
|
20
|
+
* reach its boundary before force-terminating. This guards a real subprocess, so
|
|
21
|
+
* it is a real timer rather than the lease clock — and a parameter rather than a
|
|
22
|
+
* bare module constant, so a test may shorten it explicitly instead of a fake
|
|
23
|
+
* clock silently shortening it for production code too.
|
|
24
|
+
*/
|
|
25
|
+
export declare const TOOL_CALL_BOUNDARY_GRACE_MS = 5000;
|
|
26
|
+
/**
|
|
27
|
+
* Re-check interval for the pending set while the grace runs.
|
|
28
|
+
*
|
|
29
|
+
* The authoritative source of "is a tool running?" is the run resource ledger,
|
|
30
|
+
* a SYNCHRONOUS snapshot with no completion signal of its own, so the wait has
|
|
31
|
+
* to look again rather than being told. `whenIdle` only wakes the check early
|
|
32
|
+
* when the event-derived view happens to drain first. Bounded by the grace, so
|
|
33
|
+
* this costs at most `graceMs / pollMs` array reads on the rare expiry-with-a-
|
|
34
|
+
* tool-running path and nothing at all on the idle path.
|
|
35
|
+
*/
|
|
36
|
+
export declare const TOOL_CALL_BOUNDARY_POLL_MS = 25;
|
|
37
|
+
export type ToolBoundaryOutcome = "idle" | "settled" | "forced";
|
|
38
|
+
export interface ToolBoundaryWaitResult {
|
|
39
|
+
outcome: ToolBoundaryOutcome;
|
|
40
|
+
waitedMs: number;
|
|
41
|
+
/**
|
|
42
|
+
* Non-empty ONLY for "forced": the dispatched tool calls still running when
|
|
43
|
+
* the grace expired. Ids only — never tool arguments, output or paths.
|
|
44
|
+
*/
|
|
45
|
+
pendingToolCallIds: string[];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Shared result for the common case of no dispatched tool running at expiry.
|
|
49
|
+
* Frozen because it is handed to every idle caller: the deadline path must stay
|
|
50
|
+
* byte-identical to its pre-#5637 behaviour, which includes allocating nothing
|
|
51
|
+
* and arming no timer.
|
|
52
|
+
*/
|
|
53
|
+
export declare const IDLE_TOOL_BOUNDARY_RESULT: ToolBoundaryWaitResult;
|
|
54
|
+
/**
|
|
55
|
+
* Wait for the pending dispatched tool calls to drain, bounded by `graceMs`.
|
|
56
|
+
*
|
|
57
|
+
* Never composed with an abort signal: at the only call site nothing has been
|
|
58
|
+
* aborted yet, and a signal that was already aborted would make this wait
|
|
59
|
+
* unreachable — which is precisely the mid-tool kill being fixed.
|
|
60
|
+
*/
|
|
61
|
+
export declare function waitForToolCallBoundary(input: {
|
|
62
|
+
pending: () => readonly string[];
|
|
63
|
+
/**
|
|
64
|
+
* Resolves when the event-derived view of the pending set drains. A wake-up
|
|
65
|
+
* HINT only: `pending()` is re-read before the wait is allowed to settle,
|
|
66
|
+
* because the authoritative source may still hold a call this signal knows
|
|
67
|
+
* nothing about. Expected never to reject.
|
|
68
|
+
*/
|
|
69
|
+
whenIdle: () => Promise<void>;
|
|
70
|
+
graceMs?: number;
|
|
71
|
+
pollMs?: number;
|
|
72
|
+
now?: () => number;
|
|
73
|
+
}): Promise<ToolBoundaryWaitResult>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retention-gap concessions are durable stream facts, but a Router can observe
|
|
3
|
+
* many streams over its lifetime. Keep the warning memo bounded while retaining
|
|
4
|
+
* enough recent coordinates to suppress reconnect/poll duplicates.
|
|
5
|
+
*/
|
|
6
|
+
export declare const REPLAY_CONCESSION_CACHE_LIMIT = 1024;
|
|
7
|
+
/**
|
|
8
|
+
* Records one stream/gap coordinate in an LRU memo.
|
|
9
|
+
*
|
|
10
|
+
* `undefined` means this is the first observation; a number is the duplicate
|
|
11
|
+
* count after the coordinate was already observed.
|
|
12
|
+
*/
|
|
13
|
+
export declare function rememberReplayRetentionGap(cache: Map<string, number>, key: string): number | undefined;
|
|
@@ -177,6 +177,8 @@ export interface SessionRouterOptions {
|
|
|
177
177
|
agentDir: string;
|
|
178
178
|
/** Limits attachment to exact ids selected by a Broker-scoped operation. */
|
|
179
179
|
sessionIds?: readonly string[];
|
|
180
|
+
/** Marks default SDK clients as notification-only observers; demanding by default. */
|
|
181
|
+
observer?: boolean;
|
|
180
182
|
deps?: SessionRouterDeps;
|
|
181
183
|
/** Runtime-specific identity validation; Router supplies a conservative fallback. */
|
|
182
184
|
correlateFrame?: SessionRouterFrameCorrelator;
|
|
@@ -44,6 +44,8 @@ export declare class SdkStartupRollbackTracker {
|
|
|
44
44
|
export declare function sanitizeSdkStartupMessage(value: unknown, knownSecrets?: Iterable<unknown>): string;
|
|
45
45
|
/** Convert every lifecycle bootstrap outcome to the public, bounded failure shape. */
|
|
46
46
|
export declare function normalizeSdkStartupFailure(phase: SdkStartupPhase, reason: SdkStartupReason, error?: unknown, knownSecrets?: Iterable<unknown>): SdkStartupFailure;
|
|
47
|
+
/** Collect process-scoped credentials without exposing a raw-secret API. */
|
|
48
|
+
export declare function lifecycleKnownSecrets(): string[];
|
|
47
49
|
/** Session-owned, exactly-once lifecycle bootstrap completion. */
|
|
48
50
|
export declare class SdkStartupCapability {
|
|
49
51
|
#private;
|
|
@@ -2,6 +2,7 @@ import type { Readable, Writable } from "node:stream";
|
|
|
2
2
|
export declare const REQUEST_FRAME_BYTES: number;
|
|
3
3
|
export declare const DEFAULT_PENDING_CEILING_BYTES: number;
|
|
4
4
|
export declare const MIN_PENDING_CEILING_BYTES: number;
|
|
5
|
+
export declare const DEFAULT_UPSTREAM_HELLO_TIMEOUT_MS = 10000;
|
|
5
6
|
export type RelayDirection = "downstream->ws" | "ws->downstream";
|
|
6
7
|
export type TransportError = {
|
|
7
8
|
type: "transport_error";
|
|
@@ -1,20 +1,91 @@
|
|
|
1
|
+
import { PublicCommandFailure } from "../../cli/public-command-errors";
|
|
1
2
|
import { SdkClient } from "../client";
|
|
3
|
+
import type { ServeHandle } from "./index";
|
|
4
|
+
import { startSocketServe, startStdioServe } from "./index";
|
|
5
|
+
/**
|
|
6
|
+
* A `gjc sdk serve` operational failure with a stable machine-readable code and a
|
|
7
|
+
* documented exit code, mirroring `SdkSessionCliError`. Usage errors keep their own
|
|
8
|
+
* public failure envelope; this type covers only failures an embedder must branch on.
|
|
9
|
+
*/
|
|
10
|
+
export declare class SdkServeError extends PublicCommandFailure {
|
|
11
|
+
readonly code: string;
|
|
12
|
+
readonly exitCode: 1;
|
|
13
|
+
readonly details?: unknown;
|
|
14
|
+
/**
|
|
15
|
+
* Diagnostics for a broker-teardown failure that happened alongside this primary
|
|
16
|
+
* failure. It rides beside `details` rather than inside it because `details`
|
|
17
|
+
* carries the broker's own error payload verbatim and embedders already read it.
|
|
18
|
+
*/
|
|
19
|
+
cleanupError?: {
|
|
20
|
+
code: string;
|
|
21
|
+
message: string;
|
|
22
|
+
};
|
|
23
|
+
constructor(code: string, message: string, exitCode: 1, details?: unknown);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Combines the serve body's failure with the broker-teardown failure. The primary
|
|
27
|
+
* failure always wins — a rejected teardown only ever rides along as diagnostics, it
|
|
28
|
+
* never replaces the error an embedder branches on — and a teardown that fails on its
|
|
29
|
+
* own still leaves typed. Exported for tests.
|
|
30
|
+
*/
|
|
31
|
+
export declare function resolveServeOutcome(primary: Error | undefined, cleanup: Error | undefined): Error | undefined;
|
|
2
32
|
/** Resolves the pending ceiling with flag > env > default precedence; exported for tests. */
|
|
3
33
|
export declare function resolveServePendingCeiling(flagValue: string | undefined, envValue: string | undefined): number;
|
|
34
|
+
type BrokerTranscriptIdentity = {
|
|
35
|
+
dev: string;
|
|
36
|
+
ino: string;
|
|
37
|
+
size: number;
|
|
38
|
+
mtimeMs: number;
|
|
39
|
+
mtimeNs: string;
|
|
40
|
+
sha256: string;
|
|
41
|
+
};
|
|
42
|
+
type BrokerSavedSession = {
|
|
43
|
+
id: string;
|
|
44
|
+
path: string;
|
|
45
|
+
identity: BrokerTranscriptIdentity;
|
|
46
|
+
};
|
|
47
|
+
type BrokerSessionLocator = {
|
|
48
|
+
cwd: string;
|
|
49
|
+
worktreeRoot: string | null;
|
|
50
|
+
stateRoot: string;
|
|
51
|
+
};
|
|
4
52
|
type BrokerSessionRow = {
|
|
5
53
|
sessionId: string;
|
|
6
54
|
live: boolean;
|
|
7
55
|
ambiguous: boolean;
|
|
56
|
+
terminal?: boolean;
|
|
57
|
+
hostUnregisteredReason?: "process_exited" | "detached_idle";
|
|
58
|
+
terminalUncertain?: boolean;
|
|
59
|
+
locator?: BrokerSessionLocator;
|
|
60
|
+
savedSession?: BrokerSavedSession;
|
|
8
61
|
};
|
|
9
62
|
/** Exhausts strict broker `session.list` pages into one full session snapshot. */
|
|
10
|
-
export declare function listBrokerSessions(broker: SdkClient, explicitSessionId?: string): Promise<BrokerSessionRow[]>;
|
|
63
|
+
export declare function listBrokerSessions(broker: Pick<SdkClient, "global">, explicitSessionId?: string, cwd?: string): Promise<BrokerSessionRow[]>;
|
|
64
|
+
/** Resolves an explicit or automatic serve target, reattaching one stale explicit session at most once. */
|
|
65
|
+
export declare function resolveServeSession(broker: SdkClient, explicitSessionId?: string): Promise<string>;
|
|
11
66
|
/** Selects the session to serve through broker `session.list` truth (C10); exported for tests. */
|
|
12
67
|
export declare function selectBrokerSession(sessions: BrokerSessionRow[], explicitSessionId: string | undefined): string;
|
|
68
|
+
/** Bounded dependency seam for preflight tests; production keeps the same transport factories. */
|
|
69
|
+
export interface SdkServeDependencies {
|
|
70
|
+
readDiscovery: (agentDir: string) => Promise<{
|
|
71
|
+
url: string;
|
|
72
|
+
token: string;
|
|
73
|
+
} | null>;
|
|
74
|
+
connect: (url: string, token: string) => Promise<Pick<SdkClient, "global" | "close">>;
|
|
75
|
+
startStdio: typeof startStdioServe;
|
|
76
|
+
startSocket: typeof startSocketServe;
|
|
77
|
+
}
|
|
13
78
|
/**
|
|
14
79
|
* Attaches a stdio or Unix-socket relay to one live SDK session endpoint.
|
|
15
80
|
* Session targeting is broker-bound (C10): `session.list` resolves the session
|
|
16
81
|
* and `session.get_endpoint` mints the exact credential — never a direct
|
|
17
82
|
* endpoint-file read. A missing or unreachable broker fails closed.
|
|
18
83
|
*/
|
|
19
|
-
export declare function runSdkServe(argv: string[]): Promise<void>;
|
|
84
|
+
export declare function runSdkServe(argv: string[], dependencies?: SdkServeDependencies): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Acquiring a ServeHandle transfers output/termination ownership to transport.
|
|
87
|
+
* This boundary never rejects into the ordinary public command writer, even
|
|
88
|
+
* when no frame has been written. Raw relay framing remains transport-owned.
|
|
89
|
+
*/
|
|
90
|
+
export declare function ownSdkServeTransport(handle: ServeHandle, closeBroker: () => Promise<void>): Promise<void>;
|
|
20
91
|
export {};
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import type { Readable, Writable } from "node:stream";
|
|
1
2
|
import type { ServeHandle, ServeOptions } from "./index";
|
|
2
3
|
/** Serves one parent-owned JSONL connection over the process standard streams. */
|
|
3
|
-
export declare function startStdioServe(options: ServeOptions
|
|
4
|
+
export declare function startStdioServe(options: ServeOptions, streams?: {
|
|
5
|
+
readonly input?: Readable;
|
|
6
|
+
readonly output?: Writable;
|
|
7
|
+
}): Promise<ServeHandle>;
|
|
@@ -17,6 +17,7 @@ import type { AttemptScope } from "@gajae-code/agent-core/attempt-scope";
|
|
|
17
17
|
import { type CompactionResult, type EmergencyCompactionSample } from "@gajae-code/agent-core/compaction";
|
|
18
18
|
import type { AssistantMessage, AttemptScopeRef, Effort, ImageContent, Message, MessageAttribution, Model, ProviderSessionState, ServiceTier, SimpleStreamOptions, TextContent, ToolCall, ToolChoice, Usage, UsageReport } from "@gajae-code/ai/core";
|
|
19
19
|
import { type BtwTextExchange } from "./btw-contract";
|
|
20
|
+
import { type SessionWorkLease } from "./session-work-lease";
|
|
20
21
|
export interface ForkContextSeedMetadata {
|
|
21
22
|
sourceSessionId: string;
|
|
22
23
|
parentMessageCount: number;
|
|
@@ -96,7 +97,7 @@ import { type AgentRegistry } from "../registry/agent-registry";
|
|
|
96
97
|
import type { LazyService } from "../runtime/lazy-service";
|
|
97
98
|
import type { NetworkPrewarmRuntime } from "../runtime/network-prewarm-service";
|
|
98
99
|
import type { WorkspaceTreeRuntime } from "../runtime/workspace-tree-service";
|
|
99
|
-
import { MCPManager } from "../runtime-mcp/manager";
|
|
100
|
+
import { type ExactMcpServerControlResult, MCPManager } from "../runtime-mcp/manager";
|
|
100
101
|
import type { NotificationSessionController } from "../sdk/bus/session-control";
|
|
101
102
|
import type { SecretObfuscator } from "../secrets/obfuscator";
|
|
102
103
|
import { type DiscoverableTool, type DiscoverableToolSearchIndex } from "../tool-discovery/tool-index";
|
|
@@ -196,6 +197,47 @@ export type AgentSessionEvent = AgentEvent | {
|
|
|
196
197
|
goal: Goal | null;
|
|
197
198
|
state?: GoalModeState;
|
|
198
199
|
};
|
|
200
|
+
export type QueuedInputDelivery = "steer" | "followUp";
|
|
201
|
+
export type QueuedInputQueuePolicy = "respect-mode" | "sequential";
|
|
202
|
+
export type QueuedInputRemovalReason = "cancelled" | "removed";
|
|
203
|
+
export interface QueuedInputAdmission {
|
|
204
|
+
submissionId: string;
|
|
205
|
+
delivery: QueuedInputDelivery;
|
|
206
|
+
queuePolicy: QueuedInputQueuePolicy;
|
|
207
|
+
}
|
|
208
|
+
export type QueuedInputExecution = {
|
|
209
|
+
submissionId: string;
|
|
210
|
+
delivery: QueuedInputDelivery;
|
|
211
|
+
disposition: "joined-current-run" | "promoted-to-run";
|
|
212
|
+
attemptScope: AttemptScopeRef;
|
|
213
|
+
} | {
|
|
214
|
+
submissionId: string;
|
|
215
|
+
delivery: QueuedInputDelivery;
|
|
216
|
+
disposition: "removed";
|
|
217
|
+
reason: QueuedInputRemovalReason;
|
|
218
|
+
};
|
|
219
|
+
export type QueuedInputTerminal = {
|
|
220
|
+
submissionId: string;
|
|
221
|
+
delivery: QueuedInputDelivery;
|
|
222
|
+
disposition: "completed";
|
|
223
|
+
attemptScope: AttemptScopeRef;
|
|
224
|
+
} | {
|
|
225
|
+
submissionId: string;
|
|
226
|
+
delivery: QueuedInputDelivery;
|
|
227
|
+
disposition: "removed";
|
|
228
|
+
reason: QueuedInputRemovalReason;
|
|
229
|
+
};
|
|
230
|
+
/**
|
|
231
|
+
* Lifecycle receipt for one explicitly queued `submitUserMessage` submission.
|
|
232
|
+
*/
|
|
233
|
+
export interface QueuedInputSubmission {
|
|
234
|
+
readonly submissionId: string;
|
|
235
|
+
readonly admitted: Promise<QueuedInputAdmission>;
|
|
236
|
+
readonly execution: Promise<QueuedInputExecution>;
|
|
237
|
+
readonly terminal: Promise<QueuedInputTerminal>;
|
|
238
|
+
/** Remove the submission if it is still queued. Returns false after execution or removal. */
|
|
239
|
+
readonly cancel: () => boolean;
|
|
240
|
+
}
|
|
199
241
|
/** Listener function for agent session events */
|
|
200
242
|
export type AgentSessionEventListener = (event: AgentSessionEvent) => void;
|
|
201
243
|
export type AsyncJobSnapshotItem = Pick<AsyncJob, "id" | "type" | "status" | "label" | "startTime" | "endTime" | "metadata">;
|
|
@@ -439,6 +481,30 @@ export interface PromptOptions {
|
|
|
439
481
|
/** Internal host capability; ordinary package callers cannot construct the branded value. */
|
|
440
482
|
sdkRunCapability?: unknown;
|
|
441
483
|
}
|
|
484
|
+
export interface SendUserMessageOptions {
|
|
485
|
+
deliverAs?: QueuedInputDelivery;
|
|
486
|
+
/** Preserve a busy SDK dispatch as queued work across an admission fence. */
|
|
487
|
+
queuedAtDispatch?: boolean;
|
|
488
|
+
/** Delivery ordering for a tracked or SDK-queued submission. */
|
|
489
|
+
queuePolicy?: QueuedInputQueuePolicy;
|
|
490
|
+
onPreflightAccepted?: () => void;
|
|
491
|
+
onPreflightAcceptCommit?: () => void | Promise<void>;
|
|
492
|
+
/** Internal SDK ownership callback. */
|
|
493
|
+
onQueuedPromoted?: (promotion: {
|
|
494
|
+
startsOwnRun?: boolean;
|
|
495
|
+
removed?: boolean;
|
|
496
|
+
}) => void;
|
|
497
|
+
/** Internal dispatch disposition used before actual queue consumption. */
|
|
498
|
+
onDispatchDisposition?: (promotion: {
|
|
499
|
+
startsOwnRun: boolean;
|
|
500
|
+
}) => void;
|
|
501
|
+
preflightSignal?: AbortSignal;
|
|
502
|
+
sdkRunCapability?: unknown;
|
|
503
|
+
}
|
|
504
|
+
export interface TrackedSendUserMessageOptions extends SendUserMessageOptions {
|
|
505
|
+
deliverAs: QueuedInputDelivery;
|
|
506
|
+
trackSubmission: true;
|
|
507
|
+
}
|
|
442
508
|
/** Result from a handoff operation. */
|
|
443
509
|
export interface HandoffResult {
|
|
444
510
|
document: string;
|
|
@@ -614,11 +680,58 @@ export declare class StreamingEditFileCache {
|
|
|
614
680
|
has(path: string): boolean;
|
|
615
681
|
get totalBytes(): number;
|
|
616
682
|
}
|
|
683
|
+
/**
|
|
684
|
+
* Startup phase of the session-owned exact-config MCP manager.
|
|
685
|
+
*
|
|
686
|
+
* `not-started` and `no-servers-declared` are distinguishable only because the
|
|
687
|
+
* snapshot reads the declared server list from the exact config; the manager
|
|
688
|
+
* alone reports an empty name list in both cases.
|
|
689
|
+
*/
|
|
690
|
+
export type ExactMcpStartupState = "not-started" | "no-servers-declared" | "in-flight" | "settled";
|
|
691
|
+
/**
|
|
692
|
+
* Per-server state.
|
|
693
|
+
*
|
|
694
|
+
* `unavailable` covers a server the config declares that the manager has no
|
|
695
|
+
* live record of. A tools-only manager erases a server from its own bookkeeping
|
|
696
|
+
* when the connection fails, so a failed server and one whose startup has not
|
|
697
|
+
* reached it are indistinguishable from here; both surface as `unavailable`
|
|
698
|
+
* rather than being dropped from the table.
|
|
699
|
+
*/
|
|
700
|
+
export type ExactMcpServerState = "connecting" | "connected" | "disconnected" | "unavailable";
|
|
701
|
+
export type ExactMcpServerDisplayState = ExactMcpServerState | "suspended";
|
|
702
|
+
/**
|
|
703
|
+
* Transport a server is declared with. Taken from the config's own
|
|
704
|
+
* discriminator, never from a live connection: `getConnection` throws on a
|
|
705
|
+
* tools-only manager, so the declaration is the only source available here.
|
|
706
|
+
*/
|
|
707
|
+
export type ExactMcpTransport = "stdio" | "http" | "sse" | "unknown";
|
|
708
|
+
export interface ExactMcpServerStatus {
|
|
709
|
+
readonly name: string;
|
|
710
|
+
readonly transport: ExactMcpTransport;
|
|
711
|
+
readonly state: ExactMcpServerDisplayState;
|
|
712
|
+
readonly toolCount: number;
|
|
713
|
+
}
|
|
714
|
+
/**
|
|
715
|
+
* Whitelisted status shape for the TUI `/mcp` command. Every field here is
|
|
716
|
+
* either a server name the operator already supplied or a derived enum/count;
|
|
717
|
+
* pool keys, endpoints, commands, env, headers, tokens, and raw exception text
|
|
718
|
+
* have no field to travel in.
|
|
719
|
+
*/
|
|
720
|
+
export interface ExactMcpStatusSnapshot {
|
|
721
|
+
readonly startup: ExactMcpStartupState;
|
|
722
|
+
readonly servers: readonly ExactMcpServerStatus[];
|
|
723
|
+
}
|
|
724
|
+
export type ExactMcpControlAction = "suspend" | "resume" | "reconnect";
|
|
725
|
+
export interface ExactMcpControlResult extends ExactMcpServerControlResult {
|
|
726
|
+
readonly action: ExactMcpControlAction;
|
|
727
|
+
}
|
|
617
728
|
export interface DefaultFallbackRuntimeState {
|
|
618
729
|
chain: ConfiguredFallbackChain;
|
|
619
730
|
controller: FallbackChainRuntimeState;
|
|
620
731
|
exhaustedLastTurn: boolean;
|
|
621
732
|
}
|
|
733
|
+
/** A lost continuation may only settle the emitter/session pair that opened it. */
|
|
734
|
+
export declare function isCurrentWorkflowGateContinuation(currentSessionId: string, expectedSessionId: string, currentEmitter: WorkflowGateEmitter | undefined, expectedEmitter: WorkflowGateEmitter): boolean;
|
|
622
735
|
export declare class AgentSession {
|
|
623
736
|
#private;
|
|
624
737
|
readonly agent: Agent;
|
|
@@ -760,7 +873,9 @@ export declare class AgentSession {
|
|
|
760
873
|
* Remove all listeners, flush pending writes, and disconnect from agent.
|
|
761
874
|
* Call this when completely done with the session.
|
|
762
875
|
*/
|
|
763
|
-
dispose(
|
|
876
|
+
dispose(options?: {
|
|
877
|
+
sessionShutdownReason?: "detached_idle";
|
|
878
|
+
}): Promise<void>;
|
|
764
879
|
/** Join the retained teardown owner without allocating another public deadline. */
|
|
765
880
|
awaitDisposeCompletion(): Promise<void>;
|
|
766
881
|
setDisposeTimeoutForTests(timeoutMs: number): void;
|
|
@@ -919,6 +1034,21 @@ export declare class AgentSession {
|
|
|
919
1034
|
* Get all configured tool names (built-in via --tools or default, plus custom tools).
|
|
920
1035
|
*/
|
|
921
1036
|
getAllToolNames(): string[];
|
|
1037
|
+
get hasExactMcpControls(): boolean;
|
|
1038
|
+
/**
|
|
1039
|
+
* Exact-config MCP status for the TUI `/mcp` command.
|
|
1040
|
+
*
|
|
1041
|
+
* Returns `undefined` unless this session holds the exact-config capability,
|
|
1042
|
+
* so a session built outside the root interactive entry point cannot read MCP
|
|
1043
|
+
* state through it. Data comes only from the session-owned tools-only manager
|
|
1044
|
+
* and the call never starts a deferred MCP startup or mutates connections.
|
|
1045
|
+
*/
|
|
1046
|
+
getExactMcpStatusSnapshot(): Promise<ExactMcpStatusSnapshot | undefined>;
|
|
1047
|
+
/**
|
|
1048
|
+
* Apply one session-local exact-config control. Selection persistence is
|
|
1049
|
+
* deliberately bypassed: suppression is runtime state, not user authority.
|
|
1050
|
+
*/
|
|
1051
|
+
controlExactMcpServer(action: ExactMcpControlAction, name: string): Promise<ExactMcpControlResult | undefined>;
|
|
922
1052
|
getSelectedMCPToolNames(): string[];
|
|
923
1053
|
isToolDiscoveryEnabled(): boolean;
|
|
924
1054
|
getDiscoverableTools(filter?: {
|
|
@@ -947,7 +1077,11 @@ export declare class AgentSession {
|
|
|
947
1077
|
* Replace MCP tools in the registry and recompute the visible MCP tool set immediately.
|
|
948
1078
|
* This allows /mcp add/remove/reauth to take effect without restarting the session.
|
|
949
1079
|
*/
|
|
950
|
-
refreshMCPTools(mcpTools: CustomTool[]
|
|
1080
|
+
refreshMCPTools(mcpTools: CustomTool[], options?: {
|
|
1081
|
+
selectedMCPToolNames?: string[];
|
|
1082
|
+
activeMCPToolNames?: string[];
|
|
1083
|
+
persistMCPSelection?: boolean;
|
|
1084
|
+
}): Promise<void>;
|
|
951
1085
|
/**
|
|
952
1086
|
* Refresh plugin sub-skill tools after workflow/sub-skill activation or phase changes.
|
|
953
1087
|
*/
|
|
@@ -963,6 +1097,8 @@ export declare class AgentSession {
|
|
|
963
1097
|
* to avoid racing against the delivery turn.
|
|
964
1098
|
*/
|
|
965
1099
|
get hasPostPromptWork(): boolean;
|
|
1100
|
+
/** The host-liveness lease shared by admission, execution, and recovery work. */
|
|
1101
|
+
get sessionWorkLease(): SessionWorkLease;
|
|
966
1102
|
/** Stable resource ownership identifier for the active prompt run. */
|
|
967
1103
|
get activePromptHandle(): string | undefined;
|
|
968
1104
|
/** All messages including custom types like BashExecutionMessage */
|
|
@@ -1107,24 +1243,14 @@ export declare class AgentSession {
|
|
|
1107
1243
|
* @param content User message content (string or content array)
|
|
1108
1244
|
* @param options.deliverAs Delivery mode: "steer" or "followUp"
|
|
1109
1245
|
*/
|
|
1110
|
-
sendUserMessage(content: string | (TextContent | ImageContent)[], options?:
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
startsOwnRun?: boolean;
|
|
1119
|
-
removed?: boolean;
|
|
1120
|
-
}) => void;
|
|
1121
|
-
/** Internal dispatch disposition used before actual queue consumption. */
|
|
1122
|
-
onDispatchDisposition?: (promotion: {
|
|
1123
|
-
startsOwnRun: boolean;
|
|
1124
|
-
}) => void;
|
|
1125
|
-
preflightSignal?: AbortSignal;
|
|
1126
|
-
sdkRunCapability?: unknown;
|
|
1127
|
-
}): Promise<void>;
|
|
1246
|
+
sendUserMessage(content: string | (TextContent | ImageContent)[], options?: SendUserMessageOptions): Promise<void>;
|
|
1247
|
+
/**
|
|
1248
|
+
* Queue one steer or follow-up and return a stable lifecycle handle for that
|
|
1249
|
+
* exact submission. Unlike `sendUserMessage`, this method resolves when the
|
|
1250
|
+
* queue admission receipt is available; use the returned promises to await
|
|
1251
|
+
* execution and the owning terminal boundary.
|
|
1252
|
+
*/
|
|
1253
|
+
submitUserMessage(content: string | (TextContent | ImageContent)[], options: TrackedSendUserMessageOptions): Promise<QueuedInputSubmission>;
|
|
1128
1254
|
/**
|
|
1129
1255
|
* Clear queued messages and return them.
|
|
1130
1256
|
* Useful for restoring to editor when user aborts.
|
|
@@ -1257,6 +1383,18 @@ export declare class AgentSession {
|
|
|
1257
1383
|
rebindTerminalAbortSteeringSnapshot(token: number): void;
|
|
1258
1384
|
discardTerminalAbortSteeringSnapshot(token: number): void;
|
|
1259
1385
|
getTerminalTurnEpoch(): number | undefined;
|
|
1386
|
+
/**
|
|
1387
|
+
* Tool call ids the run resource ledger currently holds for `handle` (#5637).
|
|
1388
|
+
*
|
|
1389
|
+
* The authoritative answer to "is a tool running?": AgentLoop reserves the
|
|
1390
|
+
* `kind: "tool"` lease SYNCHRONOUSLY inside its dispatch loop, before the
|
|
1391
|
+
* tool's `execute` is invoked, and the lease settles when the call really
|
|
1392
|
+
* ends — whereas `tool_execution_start` only reaches an extension after an
|
|
1393
|
+
* asynchronous fanout. Strictly read-only: it takes a snapshot and never
|
|
1394
|
+
* claims, reserves, seals or quarantines. An unknown run reads as empty,
|
|
1395
|
+
* matching `RunResourceLedger.pending`.
|
|
1396
|
+
*/
|
|
1397
|
+
pendingToolExecutions(handle: string): readonly string[];
|
|
1260
1398
|
abortPromptAndWait(handle: string, options: {
|
|
1261
1399
|
graceMs: number;
|
|
1262
1400
|
terminal?: {
|
|
@@ -1386,6 +1524,15 @@ export declare class AgentSession {
|
|
|
1386
1524
|
* must not mutate the persisted configured intent.
|
|
1387
1525
|
*/
|
|
1388
1526
|
setDefaultFallbackRuntimeModel(selector: string): void;
|
|
1527
|
+
/** Install a runtime-only durable fallback without changing saved session intent. */
|
|
1528
|
+
installRecoveredDefaultFallbackChain(entries: readonly string[], identity: string | undefined, activeIndex: number, skips: Array<{
|
|
1529
|
+
selector: string;
|
|
1530
|
+
reason: string;
|
|
1531
|
+
}>, options?: {
|
|
1532
|
+
emitResolutionEvent?: boolean;
|
|
1533
|
+
}): void;
|
|
1534
|
+
markStartupRecoveryBindingsRequired(): void;
|
|
1535
|
+
hasRecoveredDefaultFallbackChain(): boolean;
|
|
1389
1536
|
/**
|
|
1390
1537
|
* Seed default fallback state after guarded auth-aware model resolution skips chain entries.
|
|
1391
1538
|
* The configured chain's role, origin, and identity are retained by the controller.
|
|
@@ -97,15 +97,15 @@ export interface CompactionCandidateFailure {
|
|
|
97
97
|
readonly model: string;
|
|
98
98
|
readonly message: string;
|
|
99
99
|
}
|
|
100
|
+
export declare function sanitizeCompactionCandidateFailureMessage(message: string): string;
|
|
100
101
|
/**
|
|
101
102
|
* Error for an auto-compaction run whose every candidate failed.
|
|
102
103
|
*
|
|
103
|
-
* The candidate chain starts at the session model and
|
|
104
|
-
*
|
|
105
|
-
* the user
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
* is the final error so callers that classify by type keep the same object.
|
|
104
|
+
* The candidate chain starts at the session model and includes only explicitly
|
|
105
|
+
* configured role candidates. The message leads with the first failure (the
|
|
106
|
+
* one the user can act on), then lists every candidate that was tried with its
|
|
107
|
+
* own error. `cause` is the final error so callers that classify by type keep
|
|
108
|
+
* the same object.
|
|
109
109
|
*/
|
|
110
110
|
export declare function describeCompactionCandidateFailures(failures: readonly CompactionCandidateFailure[], lastError: unknown): Error;
|
|
111
111
|
export declare function effectiveFallbackDelay(baseDelayMs: number, maxDelayMs: number, attemptK: number, random?: () => number): number;
|
|
@@ -35,7 +35,17 @@ import type { AsyncJob, FoldReason } from "../async/job-manager";
|
|
|
35
35
|
*/
|
|
36
36
|
export declare const FOLD_WAKE_MERGE_WINDOW_MS = 800;
|
|
37
37
|
/** The wait kinds that can be folded. `task`/`subagent` awaits are a non-goal. */
|
|
38
|
-
export type FoldWaitKind = "bash-managed" | "client-terminal" | "bash-pty";
|
|
38
|
+
export type FoldWaitKind = "bash-managed" | "client-terminal" | "bash-pty" | "job-await";
|
|
39
|
+
/**
|
|
40
|
+
* Whether a wait may be picked as the implicit fold target by the chord and
|
|
41
|
+
* the SDK `bash.background` control. A `job-await` watches jobs that are
|
|
42
|
+
* already in the background, so "move the foreground bash into a background
|
|
43
|
+
* job" has nothing to move; it folds only when the `job` tool's own steer
|
|
44
|
+
* watcher names it explicitly. Keeping it out of implicit targeting also stops
|
|
45
|
+
* a `job poll` registered after a foreground bash from taking the chord away
|
|
46
|
+
* from the command the user is actually watching.
|
|
47
|
+
*/
|
|
48
|
+
export declare function isImplicitFoldTarget(adapter: FoldAdapter): boolean;
|
|
39
49
|
/** Outcome of settling the foreground caller. Exactly one party may settle it. */
|
|
40
50
|
export type ForegroundSettleOutcome = "resolved" | "already-settled";
|
|
41
51
|
/**
|
|
@@ -178,9 +188,13 @@ export declare class FoldCoordinator {
|
|
|
178
188
|
constructor(deps: FoldCoordinatorDeps);
|
|
179
189
|
/** Register a foldable wait. The most recently registered wait is the default target. */
|
|
180
190
|
registerParticipant(adapter: FoldAdapter): () => void;
|
|
181
|
-
/** Whether any wait is currently foldable, for the key-availability gate. */
|
|
191
|
+
/** Whether any implicitly targetable wait is currently foldable, for the key-availability gate. */
|
|
182
192
|
hasFoldableParticipant(): boolean;
|
|
183
|
-
/**
|
|
193
|
+
/**
|
|
194
|
+
* Deterministic implicit target: newest implicitly targetable registration
|
|
195
|
+
* wins, so the chord folds what the user is watching. `job-await` waits are
|
|
196
|
+
* skipped; they fold only through an explicit adapter.
|
|
197
|
+
*/
|
|
184
198
|
resolveTarget(): FoldAdapter | undefined;
|
|
185
199
|
/**
|
|
186
200
|
* T1. Synchronous prologue then async durability tail.
|
|
@@ -117,12 +117,18 @@ export interface ScrubbedProtocolRemnantReapResult {
|
|
|
117
117
|
* or detached receipts retained as evidence) are never touched. A proven
|
|
118
118
|
* concurrent disappearance (ENOENT) is benign; all other I/O failures are
|
|
119
119
|
* returned and logged once without aborting scope preparation.
|
|
120
|
+
*
|
|
121
|
+
* Stranded replacement staging that aliases its own published destination is
|
|
122
|
+
* reaped by the same pass. That entry is neither zero-length nor single-link,
|
|
123
|
+
* so the terminal-remnant filters above can never reach it, yet leaving it in
|
|
124
|
+
* place bricks resume for the session it aliases.
|
|
120
125
|
*/
|
|
121
126
|
export declare function reapScrubbedProtocolRemnantsSync(directory: string, minAgeMs?: number): ScrubbedProtocolRemnantReapResult;
|
|
122
127
|
/**
|
|
123
128
|
* Async twin of {@link reapScrubbedProtocolRemnantsSync} with the same safety
|
|
124
129
|
* filters (terminal remnant prefix, zero-length, single-link, non-symlink,
|
|
125
|
-
* older than the age gate
|
|
130
|
+
* older than the age gate, plus stranded staging that aliases its own
|
|
131
|
+
* published destination), yielding between bounded batches. Long-lived
|
|
126
132
|
* processes reap per-session descendant directories through this path so a
|
|
127
133
|
* legacy oversized directory cannot starve timers or sibling subagents while
|
|
128
134
|
* it is being drained (issue #4394).
|