@ai-agent-forge/agent-forge 0.85.0
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 +5969 -0
- package/README.md +629 -0
- package/dist/artifacts/artifact-store.d.ts +51 -0
- package/dist/artifacts/artifact-store.d.ts.map +1 -0
- package/dist/artifacts/artifact-store.js +87 -0
- package/dist/artifacts/artifact-store.js.map +1 -0
- package/dist/artifacts/paged-read.d.ts +51 -0
- package/dist/artifacts/paged-read.d.ts.map +1 -0
- package/dist/artifacts/paged-read.js +55 -0
- package/dist/artifacts/paged-read.js.map +1 -0
- package/dist/bun/cli.d.ts +3 -0
- package/dist/bun/cli.d.ts.map +1 -0
- package/dist/bun/cli.js +11 -0
- package/dist/bun/cli.js.map +1 -0
- package/dist/bun/register-bedrock.d.ts +2 -0
- package/dist/bun/register-bedrock.d.ts.map +1 -0
- package/dist/bun/register-bedrock.js +4 -0
- package/dist/bun/register-bedrock.js.map +1 -0
- package/dist/bun/restore-sandbox-env.d.ts +17 -0
- package/dist/bun/restore-sandbox-env.d.ts.map +1 -0
- package/dist/bun/restore-sandbox-env.js +36 -0
- package/dist/bun/restore-sandbox-env.js.map +1 -0
- package/dist/bundle/.build-manifest.json +3566 -0
- package/dist/bundle/chunks/anthropic-messages-RJYU4TCY.js +6 -0
- package/dist/bundle/chunks/anthropic.js +75 -0
- package/dist/bundle/chunks/azure-openai-responses-LESTCUL7.js +2 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +78 -0
- package/dist/bundle/chunks/chunk-3QKHSPQL.js +8 -0
- package/dist/bundle/chunks/chunk-4L3WN2XY.js +2 -0
- package/dist/bundle/chunks/chunk-4NKZMFSZ.js +1579 -0
- package/dist/bundle/chunks/chunk-6CYCI3EJ.js +12 -0
- package/dist/bundle/chunks/chunk-6R7UI4IY.js +2 -0
- package/dist/bundle/chunks/chunk-7ZC4UXSL.js +2 -0
- package/dist/bundle/chunks/chunk-7ZY7IXZD.js +4 -0
- package/dist/bundle/chunks/chunk-DRQDKNXA.js +2 -0
- package/dist/bundle/chunks/chunk-DTD7JQ7Y.js +42 -0
- package/dist/bundle/chunks/chunk-EWXX34QG.js +2 -0
- package/dist/bundle/chunks/chunk-GMWCTUPB.js +2 -0
- package/dist/bundle/chunks/chunk-JUUC5AZY.js +2 -0
- package/dist/bundle/chunks/chunk-KQEGUM34.js +2 -0
- package/dist/bundle/chunks/chunk-L2ZPNLYD.js +2 -0
- package/dist/bundle/chunks/chunk-MDOTREMR.js +11 -0
- package/dist/bundle/chunks/chunk-NUHFSC37.js +25 -0
- package/dist/bundle/chunks/chunk-PGXDEOVV.js +2 -0
- package/dist/bundle/chunks/chunk-PJACZCIR.js +2 -0
- package/dist/bundle/chunks/chunk-PRRNXB7S.js +2 -0
- package/dist/bundle/chunks/chunk-SER2HCLE.js +38 -0
- package/dist/bundle/chunks/chunk-TEPMHNKQ.js +2 -0
- package/dist/bundle/chunks/chunk-V46XUTK3.js +2 -0
- package/dist/bundle/chunks/chunk-WGLBM2BP.js +2 -0
- package/dist/bundle/chunks/chunk-WW3LMV3F.js +2 -0
- package/dist/bundle/chunks/chunk-XDUWOHPL.js +6 -0
- package/dist/bundle/chunks/github-copilot.js +2 -0
- package/dist/bundle/chunks/google-generative-ai-NZ66X6K7.js +2 -0
- package/dist/bundle/chunks/google-vertex-2ZZOFBNQ.js +2 -0
- package/dist/bundle/chunks/https-proxy-agent-UDEHOBGS.js +13 -0
- package/dist/bundle/chunks/image-resize-worker.js +2 -0
- package/dist/bundle/chunks/kimi-coding.js +2 -0
- package/dist/bundle/chunks/lib-HGQMNYVT.js +9 -0
- package/dist/bundle/chunks/mistral-conversations-B6DZRMEK.js +5 -0
- package/dist/bundle/chunks/multipart-parser-SQ6GDJL7.js +3 -0
- package/dist/bundle/chunks/node-O3RIBJRH.js +16 -0
- package/dist/bundle/chunks/node-TWVVAGPO.js +2 -0
- package/dist/bundle/chunks/openai-codex-responses-UFH6O5K6.js +10 -0
- package/dist/bundle/chunks/openai-codex.js +75 -0
- package/dist/bundle/chunks/openai-completions-A55GHA4O.js +7 -0
- package/dist/bundle/chunks/openai-responses-TJLXRAXR.js +2 -0
- package/dist/bundle/chunks/openrouter-images-G3GT5BVT.js +2 -0
- package/dist/bundle/chunks/openrouter.js +75 -0
- package/dist/bundle/chunks/pi-messages-SLF355GF.js +8 -0
- package/dist/bundle/chunks/radius.js +75 -0
- package/dist/bundle/chunks/src-UK77SYZE.js +4 -0
- package/dist/bundle/chunks/xai.js +2 -0
- package/dist/bundle/cli.js +3 -0
- package/dist/bundle/client.js +2 -0
- package/dist/bundle/index.js +8 -0
- package/dist/bundle/rpc-entry.js +3 -0
- package/dist/capabilities/builtin.d.ts +46 -0
- package/dist/capabilities/builtin.d.ts.map +1 -0
- package/dist/capabilities/builtin.js +68 -0
- package/dist/capabilities/builtin.js.map +1 -0
- package/dist/cli/args.d.ts +102 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +712 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/auth-check.d.ts +19 -0
- package/dist/cli/auth-check.d.ts.map +1 -0
- package/dist/cli/auth-check.js +50 -0
- package/dist/cli/auth-check.js.map +1 -0
- package/dist/cli/auth-command.d.ts +24 -0
- package/dist/cli/auth-command.d.ts.map +1 -0
- package/dist/cli/auth-command.js +102 -0
- package/dist/cli/auth-command.js.map +1 -0
- package/dist/cli/config-selector.d.ts +23 -0
- package/dist/cli/config-selector.d.ts.map +1 -0
- package/dist/cli/config-selector.js +51 -0
- package/dist/cli/config-selector.js.map +1 -0
- package/dist/cli/credential-print.d.ts +13 -0
- package/dist/cli/credential-print.d.ts.map +1 -0
- package/dist/cli/credential-print.js +76 -0
- package/dist/cli/credential-print.js.map +1 -0
- package/dist/cli/experimental/auth.d.ts +16 -0
- package/dist/cli/experimental/auth.d.ts.map +1 -0
- package/dist/cli/experimental/auth.js +13 -0
- package/dist/cli/experimental/auth.js.map +1 -0
- package/dist/cli/experimental/cli.d.ts +6 -0
- package/dist/cli/experimental/cli.d.ts.map +1 -0
- package/dist/cli/experimental/cli.js +5 -0
- package/dist/cli/experimental/cli.js.map +1 -0
- package/dist/cli/experimental/command-options.d.ts +17 -0
- package/dist/cli/experimental/command-options.d.ts.map +1 -0
- package/dist/cli/experimental/command-options.js +35 -0
- package/dist/cli/experimental/command-options.js.map +1 -0
- package/dist/cli/experimental/command.d.ts +63 -0
- package/dist/cli/experimental/command.d.ts.map +1 -0
- package/dist/cli/experimental/command.js +130 -0
- package/dist/cli/experimental/command.js.map +1 -0
- package/dist/cli/experimental/commands/client.d.ts +13 -0
- package/dist/cli/experimental/commands/client.d.ts.map +1 -0
- package/dist/cli/experimental/commands/client.js +25 -0
- package/dist/cli/experimental/commands/client.js.map +1 -0
- package/dist/cli/experimental/commands/pi.d.ts +15 -0
- package/dist/cli/experimental/commands/pi.d.ts.map +1 -0
- package/dist/cli/experimental/commands/pi.js +26 -0
- package/dist/cli/experimental/commands/pi.js.map +1 -0
- package/dist/cli/experimental/commands/server.d.ts +13 -0
- package/dist/cli/experimental/commands/server.d.ts.map +1 -0
- package/dist/cli/experimental/commands/server.js +25 -0
- package/dist/cli/experimental/commands/server.js.map +1 -0
- package/dist/cli/experimental/transport-address.d.ts +10 -0
- package/dist/cli/experimental/transport-address.d.ts.map +1 -0
- package/dist/cli/experimental/transport-address.js +38 -0
- package/dist/cli/experimental/transport-address.js.map +1 -0
- package/dist/cli/file-processor.d.ts +15 -0
- package/dist/cli/file-processor.d.ts.map +1 -0
- package/dist/cli/file-processor.js +71 -0
- package/dist/cli/file-processor.js.map +1 -0
- package/dist/cli/initial-message.d.ts +18 -0
- package/dist/cli/initial-message.d.ts.map +1 -0
- package/dist/cli/initial-message.js +22 -0
- package/dist/cli/initial-message.js.map +1 -0
- package/dist/cli/list-models.d.ts +9 -0
- package/dist/cli/list-models.d.ts.map +1 -0
- package/dist/cli/list-models.js +98 -0
- package/dist/cli/list-models.js.map +1 -0
- package/dist/cli/plugin-command.d.ts +50 -0
- package/dist/cli/plugin-command.d.ts.map +1 -0
- package/dist/cli/plugin-command.js +85 -0
- package/dist/cli/plugin-command.js.map +1 -0
- package/dist/cli/plugin-manager-controller.d.ts +59 -0
- package/dist/cli/plugin-manager-controller.d.ts.map +1 -0
- package/dist/cli/plugin-manager-controller.js +183 -0
- package/dist/cli/plugin-manager-controller.js.map +1 -0
- package/dist/cli/plugin-selection-controller.d.ts +57 -0
- package/dist/cli/plugin-selection-controller.d.ts.map +1 -0
- package/dist/cli/plugin-selection-controller.js +159 -0
- package/dist/cli/plugin-selection-controller.js.map +1 -0
- package/dist/cli/serve.d.ts +39 -0
- package/dist/cli/serve.d.ts.map +1 -0
- package/dist/cli/serve.js +124 -0
- package/dist/cli/serve.js.map +1 -0
- package/dist/cli/session-picker.d.ts +30 -0
- package/dist/cli/session-picker.d.ts.map +1 -0
- package/dist/cli/session-picker.js +62 -0
- package/dist/cli/session-picker.js.map +1 -0
- package/dist/cli/startup-ui.d.ts +20 -0
- package/dist/cli/startup-ui.d.ts.map +1 -0
- package/dist/cli/startup-ui.js +185 -0
- package/dist/cli/startup-ui.js.map +1 -0
- package/dist/cli/trace-view.d.ts +86 -0
- package/dist/cli/trace-view.d.ts.map +1 -0
- package/dist/cli/trace-view.js +263 -0
- package/dist/cli/trace-view.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +19 -0
- package/dist/cli.js.map +1 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +3 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/remote-session.d.ts +53 -0
- package/dist/client/remote-session.d.ts.map +1 -0
- package/dist/client/remote-session.js +340 -0
- package/dist/client/remote-session.js.map +1 -0
- package/dist/client/transcript.d.ts +12 -0
- package/dist/client/transcript.d.ts.map +1 -0
- package/dist/client/transcript.js +98 -0
- package/dist/client/transcript.js.map +1 -0
- package/dist/config.d.ts +95 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +459 -0
- package/dist/config.js.map +1 -0
- package/dist/core/agent-capability-contract.d.ts +322 -0
- package/dist/core/agent-capability-contract.d.ts.map +1 -0
- package/dist/core/agent-capability-contract.js +1154 -0
- package/dist/core/agent-capability-contract.js.map +1 -0
- package/dist/core/agent-session-bash.d.ts +51 -0
- package/dist/core/agent-session-bash.d.ts.map +1 -0
- package/dist/core/agent-session-bash.js +138 -0
- package/dist/core/agent-session-bash.js.map +1 -0
- package/dist/core/agent-session-compaction.d.ts +188 -0
- package/dist/core/agent-session-compaction.d.ts.map +1 -0
- package/dist/core/agent-session-compaction.js +1071 -0
- package/dist/core/agent-session-compaction.js.map +1 -0
- package/dist/core/agent-session-context.d.ts +43 -0
- package/dist/core/agent-session-context.d.ts.map +1 -0
- package/dist/core/agent-session-context.js +170 -0
- package/dist/core/agent-session-context.js.map +1 -0
- package/dist/core/agent-session-extensions.d.ts +30 -0
- package/dist/core/agent-session-extensions.d.ts.map +1 -0
- package/dist/core/agent-session-extensions.js +74 -0
- package/dist/core/agent-session-extensions.js.map +1 -0
- package/dist/core/agent-session-internal.d.ts +290 -0
- package/dist/core/agent-session-internal.d.ts.map +1 -0
- package/dist/core/agent-session-internal.js +40 -0
- package/dist/core/agent-session-internal.js.map +1 -0
- package/dist/core/agent-session-lifecycle.d.ts +242 -0
- package/dist/core/agent-session-lifecycle.d.ts.map +1 -0
- package/dist/core/agent-session-lifecycle.js +699 -0
- package/dist/core/agent-session-lifecycle.js.map +1 -0
- package/dist/core/agent-session-loop-runner.d.ts +52 -0
- package/dist/core/agent-session-loop-runner.d.ts.map +1 -0
- package/dist/core/agent-session-loop-runner.js +168 -0
- package/dist/core/agent-session-loop-runner.js.map +1 -0
- package/dist/core/agent-session-loop.d.ts +39 -0
- package/dist/core/agent-session-loop.d.ts.map +1 -0
- package/dist/core/agent-session-loop.js +155 -0
- package/dist/core/agent-session-loop.js.map +1 -0
- package/dist/core/agent-session-model.d.ts +49 -0
- package/dist/core/agent-session-model.d.ts.map +1 -0
- package/dist/core/agent-session-model.js +155 -0
- package/dist/core/agent-session-model.js.map +1 -0
- package/dist/core/agent-session-paths.d.ts +3 -0
- package/dist/core/agent-session-paths.d.ts.map +1 -0
- package/dist/core/agent-session-paths.js +14 -0
- package/dist/core/agent-session-paths.js.map +1 -0
- package/dist/core/agent-session-projection.d.ts +53 -0
- package/dist/core/agent-session-projection.d.ts.map +1 -0
- package/dist/core/agent-session-projection.js +195 -0
- package/dist/core/agent-session-projection.js.map +1 -0
- package/dist/core/agent-session-retry.d.ts +28 -0
- package/dist/core/agent-session-retry.d.ts.map +1 -0
- package/dist/core/agent-session-retry.js +141 -0
- package/dist/core/agent-session-retry.js.map +1 -0
- package/dist/core/agent-session-runtime.d.ts +181 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -0
- package/dist/core/agent-session-runtime.js +297 -0
- package/dist/core/agent-session-runtime.js.map +1 -0
- package/dist/core/agent-session-services.d.ts +281 -0
- package/dist/core/agent-session-services.d.ts.map +1 -0
- package/dist/core/agent-session-services.js +680 -0
- package/dist/core/agent-session-services.js.map +1 -0
- package/dist/core/agent-session-store.d.ts +47 -0
- package/dist/core/agent-session-store.d.ts.map +1 -0
- package/dist/core/agent-session-store.js +155 -0
- package/dist/core/agent-session-store.js.map +1 -0
- package/dist/core/agent-session-tools.d.ts +36 -0
- package/dist/core/agent-session-tools.d.ts.map +1 -0
- package/dist/core/agent-session-tools.js +305 -0
- package/dist/core/agent-session-tools.js.map +1 -0
- package/dist/core/agent-session.d.ts +1156 -0
- package/dist/core/agent-session.d.ts.map +1 -0
- package/dist/core/agent-session.js +2550 -0
- package/dist/core/agent-session.js.map +1 -0
- package/dist/core/auth-guidance.d.ts +5 -0
- package/dist/core/auth-guidance.d.ts.map +1 -0
- package/dist/core/auth-guidance.js +21 -0
- package/dist/core/auth-guidance.js.map +1 -0
- package/dist/core/auth-storage.d.ts +72 -0
- package/dist/core/auth-storage.d.ts.map +1 -0
- package/dist/core/auth-storage.js +426 -0
- package/dist/core/auth-storage.js.map +1 -0
- package/dist/core/bash-executor.d.ts +32 -0
- package/dist/core/bash-executor.d.ts.map +1 -0
- package/dist/core/bash-executor.js +111 -0
- package/dist/core/bash-executor.js.map +1 -0
- package/dist/core/cache-stats.d.ts +49 -0
- package/dist/core/cache-stats.d.ts.map +1 -0
- package/dist/core/cache-stats.js +101 -0
- package/dist/core/cache-stats.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts +88 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -0
- package/dist/core/compaction/branch-summarization.js +220 -0
- package/dist/core/compaction/branch-summarization.js.map +1 -0
- package/dist/core/compaction/compaction.d.ts +178 -0
- package/dist/core/compaction/compaction.d.ts.map +1 -0
- package/dist/core/compaction/compaction.js +608 -0
- package/dist/core/compaction/compaction.js.map +1 -0
- package/dist/core/compaction/index.d.ts +7 -0
- package/dist/core/compaction/index.d.ts.map +1 -0
- package/dist/core/compaction/index.js +7 -0
- package/dist/core/compaction/index.js.map +1 -0
- package/dist/core/compaction/utils.d.ts +49 -0
- package/dist/core/compaction/utils.d.ts.map +1 -0
- package/dist/core/compaction/utils.js +170 -0
- package/dist/core/compaction/utils.js.map +1 -0
- package/dist/core/defaults.d.ts +4 -0
- package/dist/core/defaults.d.ts.map +1 -0
- package/dist/core/defaults.js +11 -0
- package/dist/core/defaults.js.map +1 -0
- package/dist/core/diagnostics.d.ts +15 -0
- package/dist/core/diagnostics.d.ts.map +1 -0
- package/dist/core/diagnostics.js +2 -0
- package/dist/core/diagnostics.js.map +1 -0
- package/dist/core/embedded-sdk.d.ts +96 -0
- package/dist/core/embedded-sdk.d.ts.map +1 -0
- package/dist/core/embedded-sdk.js +395 -0
- package/dist/core/embedded-sdk.js.map +1 -0
- package/dist/core/event-bus.d.ts +9 -0
- package/dist/core/event-bus.d.ts.map +1 -0
- package/dist/core/event-bus.js +25 -0
- package/dist/core/event-bus.js.map +1 -0
- package/dist/core/exec.d.ts +29 -0
- package/dist/core/exec.d.ts.map +1 -0
- package/dist/core/exec.js +75 -0
- package/dist/core/exec.js.map +1 -0
- package/dist/core/experimental.d.ts +2 -0
- package/dist/core/experimental.d.ts.map +1 -0
- package/dist/core/experimental.js +6 -0
- package/dist/core/experimental.js.map +1 -0
- package/dist/core/export-html/ansi-to-html.d.ts +22 -0
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
- package/dist/core/export-html/ansi-to-html.js +249 -0
- package/dist/core/export-html/ansi-to-html.js.map +1 -0
- package/dist/core/export-html/index.d.ts +37 -0
- package/dist/core/export-html/index.d.ts.map +1 -0
- package/dist/core/export-html/index.js +226 -0
- package/dist/core/export-html/index.js.map +1 -0
- package/dist/core/export-html/template.css +1066 -0
- package/dist/core/export-html/template.html +55 -0
- package/dist/core/export-html/template.js +1864 -0
- package/dist/core/export-html/tool-renderer.d.ts +34 -0
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -0
- package/dist/core/export-html/tool-renderer.js +108 -0
- package/dist/core/export-html/tool-renderer.js.map +1 -0
- package/dist/core/export-html/vendor/highlight.min.js +1213 -0
- package/dist/core/export-html/vendor/marked.min.js +78 -0
- package/dist/core/extensions/agent-composition.d.ts +67 -0
- package/dist/core/extensions/agent-composition.d.ts.map +1 -0
- package/dist/core/extensions/agent-composition.js +785 -0
- package/dist/core/extensions/agent-composition.js.map +1 -0
- package/dist/core/extensions/bootstrap-agent-loop.d.ts +203 -0
- package/dist/core/extensions/bootstrap-agent-loop.d.ts.map +1 -0
- package/dist/core/extensions/bootstrap-agent-loop.js +565 -0
- package/dist/core/extensions/bootstrap-agent-loop.js.map +1 -0
- package/dist/core/extensions/bootstrap-branch-summary-policy.d.ts +7 -0
- package/dist/core/extensions/bootstrap-branch-summary-policy.d.ts.map +1 -0
- package/dist/core/extensions/bootstrap-branch-summary-policy.js +28 -0
- package/dist/core/extensions/bootstrap-branch-summary-policy.js.map +1 -0
- package/dist/core/extensions/bootstrap-compaction-policy.d.ts +7 -0
- package/dist/core/extensions/bootstrap-compaction-policy.d.ts.map +1 -0
- package/dist/core/extensions/bootstrap-compaction-policy.js +81 -0
- package/dist/core/extensions/bootstrap-compaction-policy.js.map +1 -0
- package/dist/core/extensions/bootstrap-lifecycle.d.ts +26 -0
- package/dist/core/extensions/bootstrap-lifecycle.d.ts.map +1 -0
- package/dist/core/extensions/bootstrap-lifecycle.js +181 -0
- package/dist/core/extensions/bootstrap-lifecycle.js.map +1 -0
- package/dist/core/extensions/bootstrap-overflow-policy.d.ts +7 -0
- package/dist/core/extensions/bootstrap-overflow-policy.d.ts.map +1 -0
- package/dist/core/extensions/bootstrap-overflow-policy.js +29 -0
- package/dist/core/extensions/bootstrap-overflow-policy.js.map +1 -0
- package/dist/core/extensions/bootstrap-retry-policy.d.ts +7 -0
- package/dist/core/extensions/bootstrap-retry-policy.d.ts.map +1 -0
- package/dist/core/extensions/bootstrap-retry-policy.js +28 -0
- package/dist/core/extensions/bootstrap-retry-policy.js.map +1 -0
- package/dist/core/extensions/bootstrap-skills.d.ts +16 -0
- package/dist/core/extensions/bootstrap-skills.d.ts.map +1 -0
- package/dist/core/extensions/bootstrap-skills.js +119 -0
- package/dist/core/extensions/bootstrap-skills.js.map +1 -0
- package/dist/core/extensions/bootstrap-tools.d.ts +20 -0
- package/dist/core/extensions/bootstrap-tools.d.ts.map +1 -0
- package/dist/core/extensions/bootstrap-tools.js +35 -0
- package/dist/core/extensions/bootstrap-tools.js.map +1 -0
- package/dist/core/extensions/capability-exports.d.ts +5 -0
- package/dist/core/extensions/capability-exports.d.ts.map +1 -0
- package/dist/core/extensions/capability-exports.js +4 -0
- package/dist/core/extensions/capability-exports.js.map +1 -0
- package/dist/core/extensions/capability-plugin.d.ts +69 -0
- package/dist/core/extensions/capability-plugin.d.ts.map +1 -0
- package/dist/core/extensions/capability-plugin.js +485 -0
- package/dist/core/extensions/capability-plugin.js.map +1 -0
- package/dist/core/extensions/capability-runtime-events.d.ts +22 -0
- package/dist/core/extensions/capability-runtime-events.d.ts.map +1 -0
- package/dist/core/extensions/capability-runtime-events.js +381 -0
- package/dist/core/extensions/capability-runtime-events.js.map +1 -0
- package/dist/core/extensions/capability-runtime-guards.d.ts +93 -0
- package/dist/core/extensions/capability-runtime-guards.d.ts.map +1 -0
- package/dist/core/extensions/capability-runtime-guards.js +800 -0
- package/dist/core/extensions/capability-runtime-guards.js.map +1 -0
- package/dist/core/extensions/capability-runtime-inspect.d.ts +12 -0
- package/dist/core/extensions/capability-runtime-inspect.d.ts.map +1 -0
- package/dist/core/extensions/capability-runtime-inspect.js +106 -0
- package/dist/core/extensions/capability-runtime-inspect.js.map +1 -0
- package/dist/core/extensions/capability-runtime-manifest.d.ts +19 -0
- package/dist/core/extensions/capability-runtime-manifest.d.ts.map +1 -0
- package/dist/core/extensions/capability-runtime-manifest.js +218 -0
- package/dist/core/extensions/capability-runtime-manifest.js.map +1 -0
- package/dist/core/extensions/capability-runtime-operation.d.ts +26 -0
- package/dist/core/extensions/capability-runtime-operation.d.ts.map +1 -0
- package/dist/core/extensions/capability-runtime-operation.js +88 -0
- package/dist/core/extensions/capability-runtime-operation.js.map +1 -0
- package/dist/core/extensions/capability-runtime-snapshot.d.ts +11 -0
- package/dist/core/extensions/capability-runtime-snapshot.d.ts.map +1 -0
- package/dist/core/extensions/capability-runtime-snapshot.js +81 -0
- package/dist/core/extensions/capability-runtime-snapshot.js.map +1 -0
- package/dist/core/extensions/capability-runtime-store.d.ts +34 -0
- package/dist/core/extensions/capability-runtime-store.d.ts.map +1 -0
- package/dist/core/extensions/capability-runtime-store.js +153 -0
- package/dist/core/extensions/capability-runtime-store.js.map +1 -0
- package/dist/core/extensions/capability-runtime-tool.d.ts +10 -0
- package/dist/core/extensions/capability-runtime-tool.d.ts.map +1 -0
- package/dist/core/extensions/capability-runtime-tool.js +10 -0
- package/dist/core/extensions/capability-runtime-tool.js.map +1 -0
- package/dist/core/extensions/capability-runtime-types.d.ts +303 -0
- package/dist/core/extensions/capability-runtime-types.d.ts.map +1 -0
- package/dist/core/extensions/capability-runtime-types.js +2 -0
- package/dist/core/extensions/capability-runtime-types.js.map +1 -0
- package/dist/core/extensions/capability-runtime-validation.d.ts +35 -0
- package/dist/core/extensions/capability-runtime-validation.d.ts.map +1 -0
- package/dist/core/extensions/capability-runtime-validation.js +380 -0
- package/dist/core/extensions/capability-runtime-validation.js.map +1 -0
- package/dist/core/extensions/capability-runtime.d.ts +7 -0
- package/dist/core/extensions/capability-runtime.d.ts.map +1 -0
- package/dist/core/extensions/capability-runtime.js +2170 -0
- package/dist/core/extensions/capability-runtime.js.map +1 -0
- package/dist/core/extensions/compaction-memory-failure-mode.d.ts +43 -0
- package/dist/core/extensions/compaction-memory-failure-mode.d.ts.map +1 -0
- package/dist/core/extensions/compaction-memory-failure-mode.js +31 -0
- package/dist/core/extensions/compaction-memory-failure-mode.js.map +1 -0
- package/dist/core/extensions/context-strategy-binding.d.ts +12 -0
- package/dist/core/extensions/context-strategy-binding.d.ts.map +1 -0
- package/dist/core/extensions/context-strategy-binding.js +54 -0
- package/dist/core/extensions/context-strategy-binding.js.map +1 -0
- package/dist/core/extensions/index.d.ts +19 -0
- package/dist/core/extensions/index.d.ts.map +1 -0
- package/dist/core/extensions/index.js +18 -0
- package/dist/core/extensions/index.js.map +1 -0
- package/dist/core/extensions/lifecycle-catalog.d.ts +584 -0
- package/dist/core/extensions/lifecycle-catalog.d.ts.map +1 -0
- package/dist/core/extensions/lifecycle-catalog.js +1903 -0
- package/dist/core/extensions/lifecycle-catalog.js.map +1 -0
- package/dist/core/extensions/lifecycle-delivery-queue.d.ts +48 -0
- package/dist/core/extensions/lifecycle-delivery-queue.d.ts.map +1 -0
- package/dist/core/extensions/lifecycle-delivery-queue.js +164 -0
- package/dist/core/extensions/lifecycle-delivery-queue.js.map +1 -0
- package/dist/core/extensions/microcompact.d.ts +71 -0
- package/dist/core/extensions/microcompact.d.ts.map +1 -0
- package/dist/core/extensions/microcompact.js +123 -0
- package/dist/core/extensions/microcompact.js.map +1 -0
- package/dist/core/extensions/public-api.d.ts +10 -0
- package/dist/core/extensions/public-api.d.ts.map +1 -0
- package/dist/core/extensions/public-api.js +9 -0
- package/dist/core/extensions/public-api.js.map +1 -0
- package/dist/core/facade/coding-agent-facade.d.ts +338 -0
- package/dist/core/facade/coding-agent-facade.d.ts.map +1 -0
- package/dist/core/facade/coding-agent-facade.js +115 -0
- package/dist/core/facade/coding-agent-facade.js.map +1 -0
- package/dist/core/facade/coding-agent-runtime-facade.d.ts +115 -0
- package/dist/core/facade/coding-agent-runtime-facade.d.ts.map +1 -0
- package/dist/core/facade/coding-agent-runtime-facade.js +63 -0
- package/dist/core/facade/coding-agent-runtime-facade.js.map +1 -0
- package/dist/core/facade/index.d.ts +6 -0
- package/dist/core/facade/index.d.ts.map +1 -0
- package/dist/core/facade/index.js +3 -0
- package/dist/core/facade/index.js.map +1 -0
- package/dist/core/footer-data-provider.d.ts +57 -0
- package/dist/core/footer-data-provider.d.ts.map +1 -0
- package/dist/core/footer-data-provider.js +323 -0
- package/dist/core/footer-data-provider.js.map +1 -0
- package/dist/core/http-dispatcher.d.ts +22 -0
- package/dist/core/http-dispatcher.d.ts.map +1 -0
- package/dist/core/http-dispatcher.js +98 -0
- package/dist/core/http-dispatcher.js.map +1 -0
- package/dist/core/index.d.ts +19 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +13 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/input-source.d.ts +9 -0
- package/dist/core/input-source.d.ts.map +1 -0
- package/dist/core/input-source.js +2 -0
- package/dist/core/input-source.js.map +1 -0
- package/dist/core/keybindings.d.ts +442 -0
- package/dist/core/keybindings.d.ts.map +1 -0
- package/dist/core/keybindings.js +329 -0
- package/dist/core/keybindings.js.map +1 -0
- package/dist/core/logger.d.ts +107 -0
- package/dist/core/logger.d.ts.map +1 -0
- package/dist/core/logger.js +246 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/messages.d.ts +85 -0
- package/dist/core/messages.d.ts.map +1 -0
- package/dist/core/messages.js +146 -0
- package/dist/core/messages.js.map +1 -0
- package/dist/core/model-config.d.ts +586 -0
- package/dist/core/model-config.d.ts.map +1 -0
- package/dist/core/model-config.js +258 -0
- package/dist/core/model-config.js.map +1 -0
- package/dist/core/model-registry.d.ts +49 -0
- package/dist/core/model-registry.d.ts.map +1 -0
- package/dist/core/model-registry.js +115 -0
- package/dist/core/model-registry.js.map +1 -0
- package/dist/core/model-resolver.d.ts +124 -0
- package/dist/core/model-resolver.d.ts.map +1 -0
- package/dist/core/model-resolver.js +590 -0
- package/dist/core/model-resolver.js.map +1 -0
- package/dist/core/model-runtime.d.ts +100 -0
- package/dist/core/model-runtime.d.ts.map +1 -0
- package/dist/core/model-runtime.js +598 -0
- package/dist/core/model-runtime.js.map +1 -0
- package/dist/core/models-store.d.ts +22 -0
- package/dist/core/models-store.d.ts.map +1 -0
- package/dist/core/models-store.js +115 -0
- package/dist/core/models-store.js.map +1 -0
- package/dist/core/output-guard.d.ts +7 -0
- package/dist/core/output-guard.d.ts.map +1 -0
- package/dist/core/output-guard.js +90 -0
- package/dist/core/output-guard.js.map +1 -0
- package/dist/core/package-install-host.d.ts +23 -0
- package/dist/core/package-install-host.d.ts.map +1 -0
- package/dist/core/package-install-host.js +202 -0
- package/dist/core/package-install-host.js.map +1 -0
- package/dist/core/package-manager.d.ts +93 -0
- package/dist/core/package-manager.d.ts.map +1 -0
- package/dist/core/package-manager.js +947 -0
- package/dist/core/package-manager.js.map +1 -0
- package/dist/core/package-process-runner.d.ts +4 -0
- package/dist/core/package-process-runner.d.ts.map +1 -0
- package/dist/core/package-process-runner.js +47 -0
- package/dist/core/package-process-runner.js.map +1 -0
- package/dist/core/package-resource-collection.d.ts +16 -0
- package/dist/core/package-resource-collection.d.ts.map +1 -0
- package/dist/core/package-resource-collection.js +300 -0
- package/dist/core/package-resource-collection.js.map +1 -0
- package/dist/core/package-resource-discovery.d.ts +33 -0
- package/dist/core/package-resource-discovery.d.ts.map +1 -0
- package/dist/core/package-resource-discovery.js +449 -0
- package/dist/core/package-resource-discovery.js.map +1 -0
- package/dist/core/package-source.d.ts +157 -0
- package/dist/core/package-source.d.ts.map +1 -0
- package/dist/core/package-source.js +179 -0
- package/dist/core/package-source.js.map +1 -0
- package/dist/core/pi-manifest.d.ts +7 -0
- package/dist/core/pi-manifest.d.ts.map +1 -0
- package/dist/core/pi-manifest.js +26 -0
- package/dist/core/pi-manifest.js.map +1 -0
- package/dist/core/prompt-templates.d.ts +54 -0
- package/dist/core/prompt-templates.d.ts.map +1 -0
- package/dist/core/prompt-templates.js +236 -0
- package/dist/core/prompt-templates.js.map +1 -0
- package/dist/core/provider-composer.d.ts +58 -0
- package/dist/core/provider-composer.d.ts.map +1 -0
- package/dist/core/provider-composer.js +403 -0
- package/dist/core/provider-composer.js.map +1 -0
- package/dist/core/radius.d.ts +2 -0
- package/dist/core/radius.d.ts.map +1 -0
- package/dist/core/radius.js +2 -0
- package/dist/core/radius.js.map +1 -0
- package/dist/core/remote-catalog-provider.d.ts +5 -0
- package/dist/core/remote-catalog-provider.d.ts.map +1 -0
- package/dist/core/remote-catalog-provider.js +121 -0
- package/dist/core/remote-catalog-provider.js.map +1 -0
- package/dist/core/resolve-config-value.d.ts +30 -0
- package/dist/core/resolve-config-value.d.ts.map +1 -0
- package/dist/core/resolve-config-value.js +247 -0
- package/dist/core/resolve-config-value.js.map +1 -0
- package/dist/core/resource-loader.d.ts +211 -0
- package/dist/core/resource-loader.d.ts.map +1 -0
- package/dist/core/resource-loader.js +687 -0
- package/dist/core/resource-loader.js.map +1 -0
- package/dist/core/runtime-credentials.d.ts +15 -0
- package/dist/core/runtime-credentials.d.ts.map +1 -0
- package/dist/core/runtime-credentials.js +39 -0
- package/dist/core/runtime-credentials.js.map +1 -0
- package/dist/core/sdk.d.ts +395 -0
- package/dist/core/sdk.d.ts.map +1 -0
- package/dist/core/sdk.js +1112 -0
- package/dist/core/sdk.js.map +1 -0
- package/dist/core/session-cwd.d.ts +19 -0
- package/dist/core/session-cwd.d.ts.map +1 -0
- package/dist/core/session-cwd.js +38 -0
- package/dist/core/session-cwd.js.map +1 -0
- package/dist/core/session-export.d.ts +7 -0
- package/dist/core/session-export.d.ts.map +1 -0
- package/dist/core/session-export.js +48 -0
- package/dist/core/session-export.js.map +1 -0
- package/dist/core/session-manager.d.ts +463 -0
- package/dist/core/session-manager.d.ts.map +1 -0
- package/dist/core/session-manager.js +1583 -0
- package/dist/core/session-manager.js.map +1 -0
- package/dist/core/session-start.d.ts +12 -0
- package/dist/core/session-start.d.ts.map +1 -0
- package/dist/core/session-start.js +2 -0
- package/dist/core/session-start.js.map +1 -0
- package/dist/core/session-storage.d.ts +130 -0
- package/dist/core/session-storage.d.ts.map +1 -0
- package/dist/core/session-storage.js +386 -0
- package/dist/core/session-storage.js.map +1 -0
- package/dist/core/settings-diagnostics.d.ts +9 -0
- package/dist/core/settings-diagnostics.d.ts.map +1 -0
- package/dist/core/settings-diagnostics.js +21 -0
- package/dist/core/settings-diagnostics.js.map +1 -0
- package/dist/core/settings-manager.d.ts +352 -0
- package/dist/core/settings-manager.d.ts.map +1 -0
- package/dist/core/settings-manager.js +987 -0
- package/dist/core/settings-manager.js.map +1 -0
- package/dist/core/skills.d.ts +60 -0
- package/dist/core/skills.d.ts.map +1 -0
- package/dist/core/skills.js +382 -0
- package/dist/core/skills.js.map +1 -0
- package/dist/core/slash-commands.d.ts +15 -0
- package/dist/core/slash-commands.d.ts.map +1 -0
- package/dist/core/slash-commands.js +33 -0
- package/dist/core/slash-commands.js.map +1 -0
- package/dist/core/source-info.d.ts +18 -0
- package/dist/core/source-info.d.ts.map +1 -0
- package/dist/core/source-info.js +19 -0
- package/dist/core/source-info.js.map +1 -0
- package/dist/core/system-prompt.d.ts +8 -0
- package/dist/core/system-prompt.d.ts.map +1 -0
- package/dist/core/system-prompt.js +137 -0
- package/dist/core/system-prompt.js.map +1 -0
- package/dist/core/timings.d.ts +11 -0
- package/dist/core/timings.d.ts.map +1 -0
- package/dist/core/timings.js +46 -0
- package/dist/core/timings.js.map +1 -0
- package/dist/core/tools/bash.d.ts +87 -0
- package/dist/core/tools/bash.d.ts.map +1 -0
- package/dist/core/tools/bash.js +409 -0
- package/dist/core/tools/bash.js.map +1 -0
- package/dist/core/tools/edit-diff.d.ts +110 -0
- package/dist/core/tools/edit-diff.d.ts.map +1 -0
- package/dist/core/tools/edit-diff.js +425 -0
- package/dist/core/tools/edit-diff.js.map +1 -0
- package/dist/core/tools/edit.d.ts +55 -0
- package/dist/core/tools/edit.d.ts.map +1 -0
- package/dist/core/tools/edit.js +305 -0
- package/dist/core/tools/edit.js.map +1 -0
- package/dist/core/tools/file-mutation-queue.d.ts +6 -0
- package/dist/core/tools/file-mutation-queue.d.ts.map +1 -0
- package/dist/core/tools/file-mutation-queue.js +52 -0
- package/dist/core/tools/file-mutation-queue.js.map +1 -0
- package/dist/core/tools/find.d.ts +42 -0
- package/dist/core/tools/find.d.ts.map +1 -0
- package/dist/core/tools/find.js +303 -0
- package/dist/core/tools/find.js.map +1 -0
- package/dist/core/tools/grep.d.ts +41 -0
- package/dist/core/tools/grep.d.ts.map +1 -0
- package/dist/core/tools/grep.js +309 -0
- package/dist/core/tools/grep.js.map +1 -0
- package/dist/core/tools/index.d.ts +44 -0
- package/dist/core/tools/index.d.ts.map +1 -0
- package/dist/core/tools/index.js +129 -0
- package/dist/core/tools/index.js.map +1 -0
- package/dist/core/tools/ls.d.ts +41 -0
- package/dist/core/tools/ls.d.ts.map +1 -0
- package/dist/core/tools/ls.js +173 -0
- package/dist/core/tools/ls.js.map +1 -0
- package/dist/core/tools/output-accumulator.d.ts +52 -0
- package/dist/core/tools/output-accumulator.d.ts.map +1 -0
- package/dist/core/tools/output-accumulator.js +184 -0
- package/dist/core/tools/output-accumulator.js.map +1 -0
- package/dist/core/tools/path-utils.d.ts +10 -0
- package/dist/core/tools/path-utils.d.ts.map +1 -0
- package/dist/core/tools/path-utils.js +99 -0
- package/dist/core/tools/path-utils.js.map +1 -0
- package/dist/core/tools/powershell.d.ts +16 -0
- package/dist/core/tools/powershell.d.ts.map +1 -0
- package/dist/core/tools/powershell.js +39 -0
- package/dist/core/tools/powershell.js.map +1 -0
- package/dist/core/tools/read.d.ts +39 -0
- package/dist/core/tools/read.d.ts.map +1 -0
- package/dist/core/tools/read.js +282 -0
- package/dist/core/tools/read.js.map +1 -0
- package/dist/core/tools/render-utils.d.ts +24 -0
- package/dist/core/tools/render-utils.d.ts.map +1 -0
- package/dist/core/tools/render-utils.js +65 -0
- package/dist/core/tools/render-utils.js.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts +15 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.js +36 -0
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -0
- package/dist/core/tools/tool-definition.d.ts +123 -0
- package/dist/core/tools/tool-definition.d.ts.map +1 -0
- package/dist/core/tools/tool-definition.js +20 -0
- package/dist/core/tools/tool-definition.js.map +1 -0
- package/dist/core/tools/tool-search.d.ts +30 -0
- package/dist/core/tools/tool-search.d.ts.map +1 -0
- package/dist/core/tools/tool-search.js +99 -0
- package/dist/core/tools/tool-search.js.map +1 -0
- package/dist/core/tools/truncate.d.ts +70 -0
- package/dist/core/tools/truncate.d.ts.map +1 -0
- package/dist/core/tools/truncate.js +215 -0
- package/dist/core/tools/truncate.js.map +1 -0
- package/dist/core/tools/write.d.ts +30 -0
- package/dist/core/tools/write.d.ts.map +1 -0
- package/dist/core/tools/write.js +202 -0
- package/dist/core/tools/write.js.map +1 -0
- package/dist/core/trace-retention.d.ts +19 -0
- package/dist/core/trace-retention.d.ts.map +1 -0
- package/dist/core/trace-retention.js +91 -0
- package/dist/core/trace-retention.js.map +1 -0
- package/dist/core/usage-totals.d.ts +21 -0
- package/dist/core/usage-totals.d.ts.map +1 -0
- package/dist/core/usage-totals.js +53 -0
- package/dist/core/usage-totals.js.map +1 -0
- package/dist/durable/durable-service.d.ts +136 -0
- package/dist/durable/durable-service.d.ts.map +1 -0
- package/dist/durable/durable-service.js +710 -0
- package/dist/durable/durable-service.js.map +1 -0
- package/dist/e2e/stdio-launcher.d.ts +25 -0
- package/dist/e2e/stdio-launcher.d.ts.map +1 -0
- package/dist/e2e/stdio-launcher.js +244 -0
- package/dist/e2e/stdio-launcher.js.map +1 -0
- package/dist/host/agent-retry-scheduler.d.ts +65 -0
- package/dist/host/agent-retry-scheduler.d.ts.map +1 -0
- package/dist/host/agent-retry-scheduler.js +52 -0
- package/dist/host/agent-retry-scheduler.js.map +1 -0
- package/dist/host/auto-compaction.d.ts +56 -0
- package/dist/host/auto-compaction.d.ts.map +1 -0
- package/dist/host/auto-compaction.js +62 -0
- package/dist/host/auto-compaction.js.map +1 -0
- package/dist/host/branch-reload.d.ts +56 -0
- package/dist/host/branch-reload.d.ts.map +1 -0
- package/dist/host/branch-reload.js +39 -0
- package/dist/host/branch-reload.js.map +1 -0
- package/dist/host/channel-adapter.d.ts +25 -0
- package/dist/host/channel-adapter.d.ts.map +1 -0
- package/dist/host/channel-adapter.js +45 -0
- package/dist/host/channel-adapter.js.map +1 -0
- package/dist/host/checkpoint-commit.d.ts +74 -0
- package/dist/host/checkpoint-commit.d.ts.map +1 -0
- package/dist/host/checkpoint-commit.js +76 -0
- package/dist/host/checkpoint-commit.js.map +1 -0
- package/dist/host/manual-compaction.d.ts +43 -0
- package/dist/host/manual-compaction.d.ts.map +1 -0
- package/dist/host/manual-compaction.js +63 -0
- package/dist/host/manual-compaction.js.map +1 -0
- package/dist/host/output-projection.d.ts +61 -0
- package/dist/host/output-projection.d.ts.map +1 -0
- package/dist/host/output-projection.js +74 -0
- package/dist/host/output-projection.js.map +1 -0
- package/dist/host/output-reducer.d.ts +43 -0
- package/dist/host/output-reducer.d.ts.map +1 -0
- package/dist/host/output-reducer.js +77 -0
- package/dist/host/output-reducer.js.map +1 -0
- package/dist/host/output-serializer.d.ts +31 -0
- package/dist/host/output-serializer.d.ts.map +1 -0
- package/dist/host/output-serializer.js +120 -0
- package/dist/host/output-serializer.js.map +1 -0
- package/dist/host/overflow-recovery.d.ts +55 -0
- package/dist/host/overflow-recovery.d.ts.map +1 -0
- package/dist/host/overflow-recovery.js +89 -0
- package/dist/host/overflow-recovery.js.map +1 -0
- package/dist/host/retry-common.d.ts +29 -0
- package/dist/host/retry-common.d.ts.map +1 -0
- package/dist/host/retry-common.js +12 -0
- package/dist/host/retry-common.js.map +1 -0
- package/dist/host/session-event-translation.d.ts +26 -0
- package/dist/host/session-event-translation.d.ts.map +1 -0
- package/dist/host/session-event-translation.js +61 -0
- package/dist/host/session-event-translation.js.map +1 -0
- package/dist/host/summary-retry.d.ts +54 -0
- package/dist/host/summary-retry.d.ts.map +1 -0
- package/dist/host/summary-retry.js +66 -0
- package/dist/host/summary-retry.js.map +1 -0
- package/dist/index.d.ts +105 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +176 -0
- package/dist/index.js.map +1 -0
- package/dist/main.d.ts +36 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +1630 -0
- package/dist/main.js.map +1 -0
- package/dist/migration/migration-tool.d.ts +56 -0
- package/dist/migration/migration-tool.d.ts.map +1 -0
- package/dist/migration/migration-tool.js +72 -0
- package/dist/migration/migration-tool.js.map +1 -0
- package/dist/migrations.d.ts +33 -0
- package/dist/migrations.d.ts.map +1 -0
- package/dist/migrations.js +272 -0
- package/dist/migrations.js.map +1 -0
- package/dist/modes/index.d.ts +10 -0
- package/dist/modes/index.d.ts.map +1 -0
- package/dist/modes/index.js +8 -0
- package/dist/modes/index.js.map +1 -0
- package/dist/modes/interactive/assets/clankolas.png +0 -0
- package/dist/modes/interactive/components/armin.d.ts +34 -0
- package/dist/modes/interactive/components/armin.d.ts.map +1 -0
- package/dist/modes/interactive/components/armin.js +336 -0
- package/dist/modes/interactive/components/armin.js.map +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +25 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/assistant-message.js +151 -0
- package/dist/modes/interactive/components/assistant-message.js.map +1 -0
- package/dist/modes/interactive/components/bash-execution.d.ts +34 -0
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/bash-execution.js +176 -0
- package/dist/modes/interactive/components/bash-execution.js.map +1 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts +16 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -0
- package/dist/modes/interactive/components/bordered-loader.js +56 -0
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts +16 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/branch-summary-message.js +44 -0
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +16 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/compaction-summary-message.js +45 -0
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -0
- package/dist/modes/interactive/components/config-selector.d.ts +113 -0
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/config-selector.js +857 -0
- package/dist/modes/interactive/components/config-selector.js.map +1 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -0
- package/dist/modes/interactive/components/countdown-timer.js +33 -0
- package/dist/modes/interactive/components/countdown-timer.js.map +1 -0
- package/dist/modes/interactive/components/custom-editor.d.ts +19 -0
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-editor.js +71 -0
- package/dist/modes/interactive/components/custom-editor.js.map +1 -0
- package/dist/modes/interactive/components/custom-entry.d.ts +19 -0
- package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-entry.js +52 -0
- package/dist/modes/interactive/components/custom-entry.js.map +1 -0
- package/dist/modes/interactive/components/custom-message.d.ts +22 -0
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-message.js +87 -0
- package/dist/modes/interactive/components/custom-message.js.map +1 -0
- package/dist/modes/interactive/components/daxnuts.d.ts +23 -0
- package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -0
- package/dist/modes/interactive/components/daxnuts.js +141 -0
- package/dist/modes/interactive/components/daxnuts.js.map +1 -0
- package/dist/modes/interactive/components/dialog-editor.d.ts +21 -0
- package/dist/modes/interactive/components/dialog-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/dialog-editor.js +98 -0
- package/dist/modes/interactive/components/dialog-editor.js.map +1 -0
- package/dist/modes/interactive/components/dialog-input.d.ts +23 -0
- package/dist/modes/interactive/components/dialog-input.d.ts.map +1 -0
- package/dist/modes/interactive/components/dialog-input.js +61 -0
- package/dist/modes/interactive/components/dialog-input.js.map +1 -0
- package/dist/modes/interactive/components/dialog-selector.d.ts +26 -0
- package/dist/modes/interactive/components/dialog-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/dialog-selector.js +83 -0
- package/dist/modes/interactive/components/dialog-selector.js.map +1 -0
- package/dist/modes/interactive/components/diff.d.ts +12 -0
- package/dist/modes/interactive/components/diff.d.ts.map +1 -0
- package/dist/modes/interactive/components/diff.js +133 -0
- package/dist/modes/interactive/components/diff.js.map +1 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -0
- package/dist/modes/interactive/components/dynamic-border.js +21 -0
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -0
- package/dist/modes/interactive/components/first-time-setup.d.ts +25 -0
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -0
- package/dist/modes/interactive/components/first-time-setup.js +103 -0
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -0
- package/dist/modes/interactive/components/footer.d.ts +33 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -0
- package/dist/modes/interactive/components/footer.js +248 -0
- package/dist/modes/interactive/components/footer.js.map +1 -0
- package/dist/modes/interactive/components/index.d.ts +34 -0
- package/dist/modes/interactive/components/index.d.ts.map +1 -0
- package/dist/modes/interactive/components/index.js +35 -0
- package/dist/modes/interactive/components/index.js.map +1 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts +13 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -0
- package/dist/modes/interactive/components/keybinding-hints.js +36 -0
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -0
- package/dist/modes/interactive/components/login-dialog.d.ts +52 -0
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
- package/dist/modes/interactive/components/login-dialog.js +188 -0
- package/dist/modes/interactive/components/login-dialog.js.map +1 -0
- package/dist/modes/interactive/components/markdown-transform.d.ts +3 -0
- package/dist/modes/interactive/components/markdown-transform.d.ts.map +1 -0
- package/dist/modes/interactive/components/markdown-transform.js +19 -0
- package/dist/modes/interactive/components/markdown-transform.js.map +1 -0
- package/dist/modes/interactive/components/mermaid.d.ts +11 -0
- package/dist/modes/interactive/components/mermaid.d.ts.map +1 -0
- package/dist/modes/interactive/components/mermaid.js +75 -0
- package/dist/modes/interactive/components/mermaid.js.map +1 -0
- package/dist/modes/interactive/components/model-selector.d.ts +67 -0
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/model-selector.js +381 -0
- package/dist/modes/interactive/components/model-selector.js.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts +33 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.js +165 -0
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -0
- package/dist/modes/interactive/components/plugin-manager-entry.d.ts +62 -0
- package/dist/modes/interactive/components/plugin-manager-entry.d.ts.map +1 -0
- package/dist/modes/interactive/components/plugin-manager-entry.js +294 -0
- package/dist/modes/interactive/components/plugin-manager-entry.js.map +1 -0
- package/dist/modes/interactive/components/plugin-selection-entry.d.ts +82 -0
- package/dist/modes/interactive/components/plugin-selection-entry.d.ts.map +1 -0
- package/dist/modes/interactive/components/plugin-selection-entry.js +228 -0
- package/dist/modes/interactive/components/plugin-selection-entry.js.map +1 -0
- package/dist/modes/interactive/components/render-types.d.ts +26 -0
- package/dist/modes/interactive/components/render-types.d.ts.map +1 -0
- package/dist/modes/interactive/components/render-types.js +7 -0
- package/dist/modes/interactive/components/render-types.js.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +46 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.js +328 -0
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts +23 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector-search.js +158 -0
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -0
- package/dist/modes/interactive/components/session-selector.d.ts +143 -0
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector.js +1053 -0
- package/dist/modes/interactive/components/session-selector.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +88 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-selector.js +677 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -0
- package/dist/modes/interactive/components/settings-submenu.d.ts +72 -0
- package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-submenu.js +165 -0
- package/dist/modes/interactive/components/settings-submenu.js.map +1 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/show-images-selector.js +39 -0
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +17 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/skill-invocation-message.js +47 -0
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -0
- package/dist/modes/interactive/components/status-indicator.d.ts +34 -0
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -0
- package/dist/modes/interactive/components/status-indicator.js +60 -0
- package/dist/modes/interactive/components/status-indicator.js.map +1 -0
- package/dist/modes/interactive/components/theme-selector.d.ts +11 -0
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/theme-selector.js +50 -0
- package/dist/modes/interactive/components/theme-selector.js.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts +23 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.js +109 -0
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -0
- package/dist/modes/interactive/components/tool-execution.d.ts +59 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/tool-execution.js +335 -0
- package/dist/modes/interactive/components/tool-execution.js.map +1 -0
- package/dist/modes/interactive/components/tree-list.d.ts +67 -0
- package/dist/modes/interactive/components/tree-list.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-list.js +710 -0
- package/dist/modes/interactive/components/tree-list.js.map +1 -0
- package/dist/modes/interactive/components/tree-render.d.ts +17 -0
- package/dist/modes/interactive/components/tree-render.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-render.js +316 -0
- package/dist/modes/interactive/components/tree-render.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector.d.ts +25 -0
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector.js +235 -0
- package/dist/modes/interactive/components/tree-selector.js.map +1 -0
- package/dist/modes/interactive/components/tree-types.d.ts +35 -0
- package/dist/modes/interactive/components/tree-types.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-types.js +2 -0
- package/dist/modes/interactive/components/tree-types.js.map +1 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message-selector.js +114 -0
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message.d.ts +16 -0
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message.js +49 -0
- package/dist/modes/interactive/components/user-message.js.map +1 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -0
- package/dist/modes/interactive/components/visual-truncate.js +33 -0
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -0
- package/dist/modes/interactive/external-editor.d.ts +12 -0
- package/dist/modes/interactive/external-editor.d.ts.map +1 -0
- package/dist/modes/interactive/external-editor.js +38 -0
- package/dist/modes/interactive/external-editor.js.map +1 -0
- package/dist/modes/interactive/interactive-auth.d.ts +90 -0
- package/dist/modes/interactive/interactive-auth.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-auth.js +492 -0
- package/dist/modes/interactive/interactive-auth.js.map +1 -0
- package/dist/modes/interactive/interactive-commands.d.ts +68 -0
- package/dist/modes/interactive/interactive-commands.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-commands.js +157 -0
- package/dist/modes/interactive/interactive-commands.js.map +1 -0
- package/dist/modes/interactive/interactive-dialog-ui.d.ts +73 -0
- package/dist/modes/interactive/interactive-dialog-ui.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-dialog-ui.js +189 -0
- package/dist/modes/interactive/interactive-dialog-ui.js.map +1 -0
- package/dist/modes/interactive/interactive-format.d.ts +65 -0
- package/dist/modes/interactive/interactive-format.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-format.js +268 -0
- package/dist/modes/interactive/interactive-format.js.map +1 -0
- package/dist/modes/interactive/interactive-helpers.d.ts +25 -0
- package/dist/modes/interactive/interactive-helpers.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-helpers.js +73 -0
- package/dist/modes/interactive/interactive-helpers.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +640 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-mode.js +4107 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -0
- package/dist/modes/interactive/interactive-selectors.d.ts +95 -0
- package/dist/modes/interactive/interactive-selectors.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-selectors.js +356 -0
- package/dist/modes/interactive/interactive-selectors.js.map +1 -0
- package/dist/modes/interactive/model-catalog-refresh.d.ts +11 -0
- package/dist/modes/interactive/model-catalog-refresh.d.ts.map +1 -0
- package/dist/modes/interactive/model-catalog-refresh.js +35 -0
- package/dist/modes/interactive/model-catalog-refresh.js.map +1 -0
- package/dist/modes/interactive/model-search.d.ts +12 -0
- package/dist/modes/interactive/model-search.d.ts.map +1 -0
- package/dist/modes/interactive/model-search.js +15 -0
- package/dist/modes/interactive/model-search.js.map +1 -0
- package/dist/modes/interactive/theme/dark.json +90 -0
- package/dist/modes/interactive/theme/light.json +89 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts +40 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-controller.js +126 -0
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.json +352 -0
- package/dist/modes/interactive/theme/theme.d.ts +122 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme.js +1093 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -0
- package/dist/modes/json-event.d.ts +34 -0
- package/dist/modes/json-event.d.ts.map +1 -0
- package/dist/modes/json-event.js +29 -0
- package/dist/modes/json-event.js.map +1 -0
- package/dist/modes/print-mode.d.ts +32 -0
- package/dist/modes/print-mode.d.ts.map +1 -0
- package/dist/modes/print-mode.js +205 -0
- package/dist/modes/print-mode.js.map +1 -0
- package/dist/modes/rpc/jsonl.d.ts +17 -0
- package/dist/modes/rpc/jsonl.d.ts.map +1 -0
- package/dist/modes/rpc/jsonl.js +49 -0
- package/dist/modes/rpc/jsonl.js.map +1 -0
- package/dist/modes/rpc/rpc-client.d.ts +254 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-client.js +496 -0
- package/dist/modes/rpc/rpc-client.js.map +1 -0
- package/dist/modes/rpc/rpc-mode.d.ts +53 -0
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-mode.js +540 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -0
- package/dist/modes/rpc/rpc-types.d.ts +486 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-types.js +8 -0
- package/dist/modes/rpc/rpc-types.js.map +1 -0
- package/dist/package-manager-cli.d.ts +18 -0
- package/dist/package-manager-cli.d.ts.map +1 -0
- package/dist/package-manager-cli.js +944 -0
- package/dist/package-manager-cli.js.map +1 -0
- package/dist/plugins/ecosystem/active-bindings.d.ts +92 -0
- package/dist/plugins/ecosystem/active-bindings.d.ts.map +1 -0
- package/dist/plugins/ecosystem/active-bindings.js +198 -0
- package/dist/plugins/ecosystem/active-bindings.js.map +1 -0
- package/dist/plugins/ecosystem/bootstrap-factory-manifest.d.ts +32 -0
- package/dist/plugins/ecosystem/bootstrap-factory-manifest.d.ts.map +1 -0
- package/dist/plugins/ecosystem/bootstrap-factory-manifest.js +32 -0
- package/dist/plugins/ecosystem/bootstrap-factory-manifest.js.map +1 -0
- package/dist/plugins/ecosystem/catalog.d.ts +38 -0
- package/dist/plugins/ecosystem/catalog.d.ts.map +1 -0
- package/dist/plugins/ecosystem/catalog.js +90 -0
- package/dist/plugins/ecosystem/catalog.js.map +1 -0
- package/dist/plugins/ecosystem/cli.d.ts +102 -0
- package/dist/plugins/ecosystem/cli.d.ts.map +1 -0
- package/dist/plugins/ecosystem/cli.js +970 -0
- package/dist/plugins/ecosystem/cli.js.map +1 -0
- package/dist/plugins/ecosystem/default-active-bindings.d.ts +33 -0
- package/dist/plugins/ecosystem/default-active-bindings.d.ts.map +1 -0
- package/dist/plugins/ecosystem/default-active-bindings.js +105 -0
- package/dist/plugins/ecosystem/default-active-bindings.js.map +1 -0
- package/dist/plugins/ecosystem/default-plugin-market.d.ts +68 -0
- package/dist/plugins/ecosystem/default-plugin-market.d.ts.map +1 -0
- package/dist/plugins/ecosystem/default-plugin-market.js +146 -0
- package/dist/plugins/ecosystem/default-plugin-market.js.map +1 -0
- package/dist/plugins/ecosystem/distribution.d.ts +113 -0
- package/dist/plugins/ecosystem/distribution.d.ts.map +1 -0
- package/dist/plugins/ecosystem/distribution.js +371 -0
- package/dist/plugins/ecosystem/distribution.js.map +1 -0
- package/dist/plugins/ecosystem/index.d.ts +56 -0
- package/dist/plugins/ecosystem/index.d.ts.map +1 -0
- package/dist/plugins/ecosystem/index.js +31 -0
- package/dist/plugins/ecosystem/index.js.map +1 -0
- package/dist/plugins/ecosystem/installer.d.ts +130 -0
- package/dist/plugins/ecosystem/installer.d.ts.map +1 -0
- package/dist/plugins/ecosystem/installer.js +316 -0
- package/dist/plugins/ecosystem/installer.js.map +1 -0
- package/dist/plugins/ecosystem/node-disk-registry-source.d.ts +47 -0
- package/dist/plugins/ecosystem/node-disk-registry-source.d.ts.map +1 -0
- package/dist/plugins/ecosystem/node-disk-registry-source.js +208 -0
- package/dist/plugins/ecosystem/node-disk-registry-source.js.map +1 -0
- package/dist/plugins/ecosystem/node-distribution-host.d.ts +55 -0
- package/dist/plugins/ecosystem/node-distribution-host.d.ts.map +1 -0
- package/dist/plugins/ecosystem/node-distribution-host.js +423 -0
- package/dist/plugins/ecosystem/node-distribution-host.js.map +1 -0
- package/dist/plugins/ecosystem/node-local-package-source.d.ts +10 -0
- package/dist/plugins/ecosystem/node-local-package-source.d.ts.map +1 -0
- package/dist/plugins/ecosystem/node-local-package-source.js +97 -0
- package/dist/plugins/ecosystem/node-local-package-source.js.map +1 -0
- package/dist/plugins/ecosystem/node-npm-registry-source.d.ts +58 -0
- package/dist/plugins/ecosystem/node-npm-registry-source.d.ts.map +1 -0
- package/dist/plugins/ecosystem/node-npm-registry-source.js +326 -0
- package/dist/plugins/ecosystem/node-npm-registry-source.js.map +1 -0
- package/dist/plugins/ecosystem/node-package-install-host.d.ts +91 -0
- package/dist/plugins/ecosystem/node-package-install-host.d.ts.map +1 -0
- package/dist/plugins/ecosystem/node-package-install-host.js +857 -0
- package/dist/plugins/ecosystem/node-package-install-host.js.map +1 -0
- package/dist/plugins/ecosystem/node-package-install-persistence.d.ts +34 -0
- package/dist/plugins/ecosystem/node-package-install-persistence.d.ts.map +1 -0
- package/dist/plugins/ecosystem/node-package-install-persistence.js +221 -0
- package/dist/plugins/ecosystem/node-package-install-persistence.js.map +1 -0
- package/dist/plugins/ecosystem/node-package-install-stack.d.ts +28 -0
- package/dist/plugins/ecosystem/node-package-install-stack.d.ts.map +1 -0
- package/dist/plugins/ecosystem/node-package-install-stack.js +65 -0
- package/dist/plugins/ecosystem/node-package-install-stack.js.map +1 -0
- package/dist/plugins/ecosystem/node-package-media.d.ts +14 -0
- package/dist/plugins/ecosystem/node-package-media.d.ts.map +1 -0
- package/dist/plugins/ecosystem/node-package-media.js +36 -0
- package/dist/plugins/ecosystem/node-package-media.js.map +1 -0
- package/dist/plugins/ecosystem/node-plugin-acquisition-host.d.ts +83 -0
- package/dist/plugins/ecosystem/node-plugin-acquisition-host.d.ts.map +1 -0
- package/dist/plugins/ecosystem/node-plugin-acquisition-host.js +423 -0
- package/dist/plugins/ecosystem/node-plugin-acquisition-host.js.map +1 -0
- package/dist/plugins/ecosystem/node-plugin-bootstrap.d.ts +48 -0
- package/dist/plugins/ecosystem/node-plugin-bootstrap.d.ts.map +1 -0
- package/dist/plugins/ecosystem/node-plugin-bootstrap.js +191 -0
- package/dist/plugins/ecosystem/node-plugin-bootstrap.js.map +1 -0
- package/dist/plugins/ecosystem/node-plugin-trust-root.d.ts +26 -0
- package/dist/plugins/ecosystem/node-plugin-trust-root.d.ts.map +1 -0
- package/dist/plugins/ecosystem/node-plugin-trust-root.js +120 -0
- package/dist/plugins/ecosystem/node-plugin-trust-root.js.map +1 -0
- package/dist/plugins/ecosystem/node-registry-source.d.ts +35 -0
- package/dist/plugins/ecosystem/node-registry-source.d.ts.map +1 -0
- package/dist/plugins/ecosystem/node-registry-source.js +286 -0
- package/dist/plugins/ecosystem/node-registry-source.js.map +1 -0
- package/dist/plugins/ecosystem/node-release-package-source.d.ts +47 -0
- package/dist/plugins/ecosystem/node-release-package-source.d.ts.map +1 -0
- package/dist/plugins/ecosystem/node-release-package-source.js +336 -0
- package/dist/plugins/ecosystem/node-release-package-source.js.map +1 -0
- package/dist/plugins/ecosystem/node-tar-package.d.ts +11 -0
- package/dist/plugins/ecosystem/node-tar-package.d.ts.map +1 -0
- package/dist/plugins/ecosystem/node-tar-package.js +294 -0
- package/dist/plugins/ecosystem/node-tar-package.js.map +1 -0
- package/dist/plugins/ecosystem/node-tar-writer.d.ts +16 -0
- package/dist/plugins/ecosystem/node-tar-writer.d.ts.map +1 -0
- package/dist/plugins/ecosystem/node-tar-writer.js +134 -0
- package/dist/plugins/ecosystem/node-tar-writer.js.map +1 -0
- package/dist/plugins/ecosystem/node-url-package-source.d.ts +31 -0
- package/dist/plugins/ecosystem/node-url-package-source.d.ts.map +1 -0
- package/dist/plugins/ecosystem/node-url-package-source.js +159 -0
- package/dist/plugins/ecosystem/node-url-package-source.js.map +1 -0
- package/dist/plugins/ecosystem/plugin-acquisition.d.ts +88 -0
- package/dist/plugins/ecosystem/plugin-acquisition.d.ts.map +1 -0
- package/dist/plugins/ecosystem/plugin-acquisition.js +197 -0
- package/dist/plugins/ecosystem/plugin-acquisition.js.map +1 -0
- package/dist/plugins/ecosystem/plugin-bootstrap.d.ts +87 -0
- package/dist/plugins/ecosystem/plugin-bootstrap.d.ts.map +1 -0
- package/dist/plugins/ecosystem/plugin-bootstrap.js +134 -0
- package/dist/plugins/ecosystem/plugin-bootstrap.js.map +1 -0
- package/dist/plugins/ecosystem/registry-cli-adapter.d.ts +8 -0
- package/dist/plugins/ecosystem/registry-cli-adapter.d.ts.map +1 -0
- package/dist/plugins/ecosystem/registry-cli-adapter.js +16 -0
- package/dist/plugins/ecosystem/registry-cli-adapter.js.map +1 -0
- package/dist/plugins/ecosystem/registry.d.ts +121 -0
- package/dist/plugins/ecosystem/registry.d.ts.map +1 -0
- package/dist/plugins/ecosystem/registry.js +324 -0
- package/dist/plugins/ecosystem/registry.js.map +1 -0
- package/dist/plugins/ecosystem/resolver.d.ts +32 -0
- package/dist/plugins/ecosystem/resolver.d.ts.map +1 -0
- package/dist/plugins/ecosystem/resolver.js +325 -0
- package/dist/plugins/ecosystem/resolver.js.map +1 -0
- package/dist/plugins/ecosystem/selection-store.d.ts +66 -0
- package/dist/plugins/ecosystem/selection-store.d.ts.map +1 -0
- package/dist/plugins/ecosystem/selection-store.js +241 -0
- package/dist/plugins/ecosystem/selection-store.js.map +1 -0
- package/dist/plugins/ecosystem/selection.d.ts +54 -0
- package/dist/plugins/ecosystem/selection.d.ts.map +1 -0
- package/dist/plugins/ecosystem/selection.js +116 -0
- package/dist/plugins/ecosystem/selection.js.map +1 -0
- package/dist/plugins/ecosystem/state.d.ts +96 -0
- package/dist/plugins/ecosystem/state.d.ts.map +1 -0
- package/dist/plugins/ecosystem/state.js +346 -0
- package/dist/plugins/ecosystem/state.js.map +1 -0
- package/dist/plugins/ecosystem/types.d.ts +90 -0
- package/dist/plugins/ecosystem/types.d.ts.map +1 -0
- package/dist/plugins/ecosystem/types.js +8 -0
- package/dist/plugins/ecosystem/types.js.map +1 -0
- package/dist/plugins/ecosystem/updates.d.ts +30 -0
- package/dist/plugins/ecosystem/updates.d.ts.map +1 -0
- package/dist/plugins/ecosystem/updates.js +148 -0
- package/dist/plugins/ecosystem/updates.js.map +1 -0
- package/dist/plugins/integrity-adapter.d.ts +58 -0
- package/dist/plugins/integrity-adapter.d.ts.map +1 -0
- package/dist/plugins/integrity-adapter.js +70 -0
- package/dist/plugins/integrity-adapter.js.map +1 -0
- package/dist/plugins/mcp-http.d.ts +78 -0
- package/dist/plugins/mcp-http.d.ts.map +1 -0
- package/dist/plugins/mcp-http.js +176 -0
- package/dist/plugins/mcp-http.js.map +1 -0
- package/dist/plugins/observability-types.d.ts +9 -0
- package/dist/plugins/observability-types.d.ts.map +1 -0
- package/dist/plugins/observability-types.js +9 -0
- package/dist/plugins/observability-types.js.map +1 -0
- package/dist/plugins/plugin-host.d.ts +46 -0
- package/dist/plugins/plugin-host.d.ts.map +1 -0
- package/dist/plugins/plugin-host.js +80 -0
- package/dist/plugins/plugin-host.js.map +1 -0
- package/dist/plugins/plugin-supervisor.d.ts +77 -0
- package/dist/plugins/plugin-supervisor.d.ts.map +1 -0
- package/dist/plugins/plugin-supervisor.js +82 -0
- package/dist/plugins/plugin-supervisor.js.map +1 -0
- package/dist/plugins/subagent-task/runner-entry.d.ts +35 -0
- package/dist/plugins/subagent-task/runner-entry.d.ts.map +1 -0
- package/dist/plugins/subagent-task/runner-entry.js +39 -0
- package/dist/plugins/subagent-task/runner-entry.js.map +1 -0
- package/dist/plugins/subagent-task/session-factory.d.ts +57 -0
- package/dist/plugins/subagent-task/session-factory.d.ts.map +1 -0
- package/dist/plugins/subagent-task/session-factory.js +51 -0
- package/dist/plugins/subagent-task/session-factory.js.map +1 -0
- package/dist/profile/child-facade.d.ts +44 -0
- package/dist/profile/child-facade.d.ts.map +1 -0
- package/dist/profile/child-facade.js +56 -0
- package/dist/profile/child-facade.js.map +1 -0
- package/dist/profile/dependency-wiring.d.ts +48 -0
- package/dist/profile/dependency-wiring.d.ts.map +1 -0
- package/dist/profile/dependency-wiring.js +56 -0
- package/dist/profile/dependency-wiring.js.map +1 -0
- package/dist/profile/domain-recovery.d.ts +60 -0
- package/dist/profile/domain-recovery.d.ts.map +1 -0
- package/dist/profile/domain-recovery.js +94 -0
- package/dist/profile/domain-recovery.js.map +1 -0
- package/dist/profile/first-roles.d.ts +30 -0
- package/dist/profile/first-roles.d.ts.map +1 -0
- package/dist/profile/first-roles.js +74 -0
- package/dist/profile/first-roles.js.map +1 -0
- package/dist/profile/goal-plugin.d.ts +38 -0
- package/dist/profile/goal-plugin.d.ts.map +1 -0
- package/dist/profile/goal-plugin.js +113 -0
- package/dist/profile/goal-plugin.js.map +1 -0
- package/dist/profile/identity.d.ts +58 -0
- package/dist/profile/identity.d.ts.map +1 -0
- package/dist/profile/identity.js +100 -0
- package/dist/profile/identity.js.map +1 -0
- package/dist/profile/lock.d.ts +59 -0
- package/dist/profile/lock.d.ts.map +1 -0
- package/dist/profile/lock.js +59 -0
- package/dist/profile/lock.js.map +1 -0
- package/dist/profile/plan-plugin.d.ts +44 -0
- package/dist/profile/plan-plugin.d.ts.map +1 -0
- package/dist/profile/plan-plugin.js +144 -0
- package/dist/profile/plan-plugin.js.map +1 -0
- package/dist/profile/plugin-profiles.d.ts +56 -0
- package/dist/profile/plugin-profiles.d.ts.map +1 -0
- package/dist/profile/plugin-profiles.js +192 -0
- package/dist/profile/plugin-profiles.js.map +1 -0
- package/dist/profile/policy-manifest.d.ts +53 -0
- package/dist/profile/policy-manifest.d.ts.map +1 -0
- package/dist/profile/policy-manifest.js +52 -0
- package/dist/profile/policy-manifest.js.map +1 -0
- package/dist/profile/profile-assembly.d.ts +74 -0
- package/dist/profile/profile-assembly.d.ts.map +1 -0
- package/dist/profile/profile-assembly.js +90 -0
- package/dist/profile/profile-assembly.js.map +1 -0
- package/dist/profile/profile-migration.d.ts +56 -0
- package/dist/profile/profile-migration.d.ts.map +1 -0
- package/dist/profile/profile-migration.js +60 -0
- package/dist/profile/profile-migration.js.map +1 -0
- package/dist/profile/profile-registry.d.ts +58 -0
- package/dist/profile/profile-registry.d.ts.map +1 -0
- package/dist/profile/profile-registry.js +74 -0
- package/dist/profile/profile-registry.js.map +1 -0
- package/dist/profile/role-assembly.d.ts +47 -0
- package/dist/profile/role-assembly.d.ts.map +1 -0
- package/dist/profile/role-assembly.js +31 -0
- package/dist/profile/role-assembly.js.map +1 -0
- package/dist/profile/role-catalog.d.ts +44 -0
- package/dist/profile/role-catalog.d.ts.map +1 -0
- package/dist/profile/role-catalog.js +130 -0
- package/dist/profile/role-catalog.js.map +1 -0
- package/dist/profile/role-orchestrator.d.ts +123 -0
- package/dist/profile/role-orchestrator.d.ts.map +1 -0
- package/dist/profile/role-orchestrator.js +194 -0
- package/dist/profile/role-orchestrator.js.map +1 -0
- package/dist/profile/role-runner.d.ts +99 -0
- package/dist/profile/role-runner.d.ts.map +1 -0
- package/dist/profile/role-runner.js +78 -0
- package/dist/profile/role-runner.js.map +1 -0
- package/dist/profile/root-facade.d.ts +36 -0
- package/dist/profile/root-facade.d.ts.map +1 -0
- package/dist/profile/root-facade.js +48 -0
- package/dist/profile/root-facade.js.map +1 -0
- package/dist/profile/skill-discovery-wiring.d.ts +58 -0
- package/dist/profile/skill-discovery-wiring.d.ts.map +1 -0
- package/dist/profile/skill-discovery-wiring.js +75 -0
- package/dist/profile/skill-discovery-wiring.js.map +1 -0
- package/dist/profile/state-store.d.ts +62 -0
- package/dist/profile/state-store.d.ts.map +1 -0
- package/dist/profile/state-store.js +140 -0
- package/dist/profile/state-store.js.map +1 -0
- package/dist/profile/todo-plugin.d.ts +37 -0
- package/dist/profile/todo-plugin.d.ts.map +1 -0
- package/dist/profile/todo-plugin.js +132 -0
- package/dist/profile/todo-plugin.js.map +1 -0
- package/dist/profiles/builtin-suites.d.ts +142 -0
- package/dist/profiles/builtin-suites.d.ts.map +1 -0
- package/dist/profiles/builtin-suites.js +395 -0
- package/dist/profiles/builtin-suites.js.map +1 -0
- package/dist/profiles/resolved-agent-profile.d.ts +83 -0
- package/dist/profiles/resolved-agent-profile.d.ts.map +1 -0
- package/dist/profiles/resolved-agent-profile.js +75 -0
- package/dist/profiles/resolved-agent-profile.js.map +1 -0
- package/dist/profiles/suite-lifecycle.d.ts +158 -0
- package/dist/profiles/suite-lifecycle.d.ts.map +1 -0
- package/dist/profiles/suite-lifecycle.js +447 -0
- package/dist/profiles/suite-lifecycle.js.map +1 -0
- package/dist/profiles/suite-loader.d.ts +410 -0
- package/dist/profiles/suite-loader.d.ts.map +1 -0
- package/dist/profiles/suite-loader.js +823 -0
- package/dist/profiles/suite-loader.js.map +1 -0
- package/dist/remote/server-assembly.d.ts +230 -0
- package/dist/remote/server-assembly.d.ts.map +1 -0
- package/dist/remote/server-assembly.js +1189 -0
- package/dist/remote/server-assembly.js.map +1 -0
- package/dist/remote/server-entry.d.ts +112 -0
- package/dist/remote/server-entry.d.ts.map +1 -0
- package/dist/remote/server-entry.js +239 -0
- package/dist/remote/server-entry.js.map +1 -0
- package/dist/remote/session-source.d.ts +101 -0
- package/dist/remote/session-source.d.ts.map +1 -0
- package/dist/remote/session-source.js +173 -0
- package/dist/remote/session-source.js.map +1 -0
- package/dist/rpc-entry.d.ts +3 -0
- package/dist/rpc-entry.d.ts.map +1 -0
- package/dist/rpc-entry.js +11 -0
- package/dist/rpc-entry.js.map +1 -0
- package/dist/server/create-harness.d.ts +26 -0
- package/dist/server/create-harness.d.ts.map +1 -0
- package/dist/server/create-harness.js +106 -0
- package/dist/server/create-harness.js.map +1 -0
- package/dist/share/session-share.d.ts +98 -0
- package/dist/share/session-share.d.ts.map +1 -0
- package/dist/share/session-share.js +89 -0
- package/dist/share/session-share.js.map +1 -0
- package/dist/share/share-viewer.d.ts +43 -0
- package/dist/share/share-viewer.d.ts.map +1 -0
- package/dist/share/share-viewer.js +103 -0
- package/dist/share/share-viewer.js.map +1 -0
- package/dist/testing/index.d.ts +4 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +6 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/mock-ai-server.d.ts +77 -0
- package/dist/testing/mock-ai-server.d.ts.map +1 -0
- package/dist/testing/mock-ai-server.js +69 -0
- package/dist/testing/mock-ai-server.js.map +1 -0
- package/dist/testing/plugin-testkit.d.ts +148 -0
- package/dist/testing/plugin-testkit.d.ts.map +1 -0
- package/dist/testing/plugin-testkit.js +493 -0
- package/dist/testing/plugin-testkit.js.map +1 -0
- package/dist/testing/runtime-delivery-queue.d.ts +47 -0
- package/dist/testing/runtime-delivery-queue.d.ts.map +1 -0
- package/dist/testing/runtime-delivery-queue.js +158 -0
- package/dist/testing/runtime-delivery-queue.js.map +1 -0
- package/dist/testing/session-plugin-testkit.d.ts +144 -0
- package/dist/testing/session-plugin-testkit.d.ts.map +1 -0
- package/dist/testing/session-plugin-testkit.js +444 -0
- package/dist/testing/session-plugin-testkit.js.map +1 -0
- package/dist/utils/abort.d.ts +5 -0
- package/dist/utils/abort.d.ts.map +1 -0
- package/dist/utils/abort.js +53 -0
- package/dist/utils/abort.js.map +1 -0
- package/dist/utils/agent-forge-user-agent.d.ts +2 -0
- package/dist/utils/agent-forge-user-agent.d.ts.map +1 -0
- package/dist/utils/agent-forge-user-agent.js +5 -0
- package/dist/utils/agent-forge-user-agent.js.map +1 -0
- package/dist/utils/ansi.d.ts +2 -0
- package/dist/utils/ansi.d.ts.map +1 -0
- package/dist/utils/ansi.js +53 -0
- package/dist/utils/ansi.js.map +1 -0
- package/dist/utils/changelog.d.ts +22 -0
- package/dist/utils/changelog.d.ts.map +1 -0
- package/dist/utils/changelog.js +165 -0
- package/dist/utils/changelog.js.map +1 -0
- package/dist/utils/child-process.d.ts +18 -0
- package/dist/utils/child-process.d.ts.map +1 -0
- package/dist/utils/child-process.js +107 -0
- package/dist/utils/child-process.js.map +1 -0
- package/dist/utils/clipboard-image.d.ts +11 -0
- package/dist/utils/clipboard-image.d.ts.map +1 -0
- package/dist/utils/clipboard-image.js +246 -0
- package/dist/utils/clipboard-image.js.map +1 -0
- package/dist/utils/clipboard-native.d.ts +11 -0
- package/dist/utils/clipboard-native.d.ts.map +1 -0
- package/dist/utils/clipboard-native.js +22 -0
- package/dist/utils/clipboard-native.js.map +1 -0
- package/dist/utils/clipboard.d.ts +4 -0
- package/dist/utils/clipboard.d.ts.map +1 -0
- package/dist/utils/clipboard.js +161 -0
- package/dist/utils/clipboard.js.map +1 -0
- package/dist/utils/deprecation.d.ts +4 -0
- package/dist/utils/deprecation.d.ts.map +1 -0
- package/dist/utils/deprecation.js +13 -0
- package/dist/utils/deprecation.js.map +1 -0
- package/dist/utils/exif-orientation.d.ts +5 -0
- package/dist/utils/exif-orientation.d.ts.map +1 -0
- package/dist/utils/exif-orientation.js +158 -0
- package/dist/utils/exif-orientation.js.map +1 -0
- package/dist/utils/frontmatter.d.ts +8 -0
- package/dist/utils/frontmatter.d.ts.map +1 -0
- package/dist/utils/frontmatter.js +27 -0
- package/dist/utils/frontmatter.js.map +1 -0
- package/dist/utils/fs-watch.d.ts +5 -0
- package/dist/utils/fs-watch.d.ts.map +1 -0
- package/dist/utils/fs-watch.js +25 -0
- package/dist/utils/fs-watch.js.map +1 -0
- package/dist/utils/git.d.ts +26 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +201 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/html.d.ts +7 -0
- package/dist/utils/html.d.ts.map +1 -0
- package/dist/utils/html.js +40 -0
- package/dist/utils/html.js.map +1 -0
- package/dist/utils/image-convert.d.ts +10 -0
- package/dist/utils/image-convert.d.ts.map +1 -0
- package/dist/utils/image-convert.js +45 -0
- package/dist/utils/image-convert.js.map +1 -0
- package/dist/utils/image-process.d.ts +18 -0
- package/dist/utils/image-process.d.ts.map +1 -0
- package/dist/utils/image-process.js +84 -0
- package/dist/utils/image-process.js.map +1 -0
- package/dist/utils/image-resize-core.d.ts +30 -0
- package/dist/utils/image-resize-core.d.ts.map +1 -0
- package/dist/utils/image-resize-core.js +125 -0
- package/dist/utils/image-resize-core.js.map +1 -0
- package/dist/utils/image-resize-worker.d.ts +2 -0
- package/dist/utils/image-resize-worker.d.ts.map +1 -0
- package/dist/utils/image-resize-worker.js +31 -0
- package/dist/utils/image-resize-worker.js.map +1 -0
- package/dist/utils/image-resize.d.ts +16 -0
- package/dist/utils/image-resize.d.ts.map +1 -0
- package/dist/utils/image-resize.js +100 -0
- package/dist/utils/image-resize.js.map +1 -0
- package/dist/utils/json.d.ts +3 -0
- package/dist/utils/json.d.ts.map +1 -0
- package/dist/utils/json.js +8 -0
- package/dist/utils/json.js.map +1 -0
- package/dist/utils/management-http.d.ts +25 -0
- package/dist/utils/management-http.d.ts.map +1 -0
- package/dist/utils/management-http.js +54 -0
- package/dist/utils/management-http.js.map +1 -0
- package/dist/utils/mime.d.ts +3 -0
- package/dist/utils/mime.d.ts.map +1 -0
- package/dist/utils/mime.js +115 -0
- package/dist/utils/mime.js.map +1 -0
- package/dist/utils/open-browser.d.ts +9 -0
- package/dist/utils/open-browser.d.ts.map +1 -0
- package/dist/utils/open-browser.js +22 -0
- package/dist/utils/open-browser.js.map +1 -0
- package/dist/utils/paths.d.ts +34 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +114 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/photon.d.ts +21 -0
- package/dist/utils/photon.d.ts.map +1 -0
- package/dist/utils/photon.js +124 -0
- package/dist/utils/photon.js.map +1 -0
- package/dist/utils/shell.d.ts +34 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +216 -0
- package/dist/utils/shell.js.map +1 -0
- package/dist/utils/sleep.d.ts +5 -0
- package/dist/utils/sleep.d.ts.map +1 -0
- package/dist/utils/sleep.js +17 -0
- package/dist/utils/sleep.js.map +1 -0
- package/dist/utils/sync-sleep.d.ts +2 -0
- package/dist/utils/sync-sleep.d.ts.map +1 -0
- package/dist/utils/sync-sleep.js +11 -0
- package/dist/utils/sync-sleep.js.map +1 -0
- package/dist/utils/syntax-highlight.d.ts +13 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -0
- package/dist/utils/syntax-highlight.js +177 -0
- package/dist/utils/syntax-highlight.js.map +1 -0
- package/dist/utils/text.d.ts +8 -0
- package/dist/utils/text.d.ts.map +1 -0
- package/dist/utils/text.js +9 -0
- package/dist/utils/text.js.map +1 -0
- package/dist/utils/tool-result-images.d.ts +19 -0
- package/dist/utils/tool-result-images.d.ts.map +1 -0
- package/dist/utils/tool-result-images.js +45 -0
- package/dist/utils/tool-result-images.js.map +1 -0
- package/dist/utils/tools-manager.d.ts +24 -0
- package/dist/utils/tools-manager.d.ts.map +1 -0
- package/dist/utils/tools-manager.js +437 -0
- package/dist/utils/tools-manager.js.map +1 -0
- package/dist/utils/version-check.d.ts +21 -0
- package/dist/utils/version-check.d.ts.map +1 -0
- package/dist/utils/version-check.js +86 -0
- package/dist/utils/version-check.js.map +1 -0
- package/dist/utils/windows-self-update.d.ts +3 -0
- package/dist/utils/windows-self-update.d.ts.map +1 -0
- package/dist/utils/windows-self-update.js +77 -0
- package/dist/utils/windows-self-update.js.map +1 -0
- package/docs/compaction.md +348 -0
- package/docs/containerization.md +114 -0
- package/docs/development.md +71 -0
- package/docs/docs.json +148 -0
- package/docs/environment-variables.md +96 -0
- package/docs/images/exy.png +0 -0
- package/docs/images/interactive-mode.png +0 -0
- package/docs/images/tree-view.png +0 -0
- package/docs/index.md +76 -0
- package/docs/json.md +98 -0
- package/docs/keybindings.md +245 -0
- package/docs/llama-cpp.md +101 -0
- package/docs/models.md +576 -0
- package/docs/packages.md +205 -0
- package/docs/prompt-templates.md +96 -0
- package/docs/providers.md +317 -0
- package/docs/quickstart.md +167 -0
- package/docs/rpc.md +1487 -0
- package/docs/sdk.md +1146 -0
- package/docs/security.md +24 -0
- package/docs/session-format.md +438 -0
- package/docs/sessions.md +145 -0
- package/docs/settings.md +355 -0
- package/docs/shell-aliases.md +13 -0
- package/docs/skills.md +231 -0
- package/docs/terminal-setup.md +192 -0
- package/docs/termux.md +127 -0
- package/docs/themes.md +320 -0
- package/docs/tmux.md +63 -0
- package/docs/tui.md +478 -0
- package/docs/usage.md +291 -0
- package/docs/windows.md +39 -0
- package/examples/README.md +21 -0
- package/examples/extensions/README.md +163 -0
- package/examples/extensions/bash-spawn-hook/index.ts +37 -0
- package/examples/extensions/bash-spawn-hook/plugin.json +10 -0
- package/examples/extensions/bookmark/index.ts +67 -0
- package/examples/extensions/bookmark/plugin.json +11 -0
- package/examples/extensions/built-in-tool-renderer/index.ts +262 -0
- package/examples/extensions/built-in-tool-renderer/plugin.json +10 -0
- package/examples/extensions/claude-rules/index.ts +119 -0
- package/examples/extensions/claude-rules/plugin.json +8 -0
- package/examples/extensions/cli-bridge/README.md +27 -0
- package/examples/extensions/cli-bridge/index.ts +320 -0
- package/examples/extensions/cli-bridge/plugin.json +10 -0
- package/examples/extensions/dynamic-resources/SKILL.md +8 -0
- package/examples/extensions/dynamic-resources/dynamic.json +79 -0
- package/examples/extensions/dynamic-resources/dynamic.md +5 -0
- package/examples/extensions/dynamic-resources/index.ts +53 -0
- package/examples/extensions/dynamic-resources/plugin.json +8 -0
- package/examples/extensions/dynamic-tools/index.ts +102 -0
- package/examples/extensions/dynamic-tools/plugin.json +14 -0
- package/examples/extensions/event-bus/index.ts +75 -0
- package/examples/extensions/event-bus/plugin.json +13 -0
- package/examples/extensions/file-trigger/index.ts +65 -0
- package/examples/extensions/file-trigger/plugin.json +13 -0
- package/examples/extensions/goal/README.md +16 -0
- package/examples/extensions/goal/index.ts +134 -0
- package/examples/extensions/goal/plugin.json +12 -0
- package/examples/extensions/hello/index.ts +29 -0
- package/examples/extensions/hello/plugin.json +10 -0
- package/examples/extensions/kimi-deferred-tools/index.ts +93 -0
- package/examples/extensions/kimi-deferred-tools/plugin.json +11 -0
- package/examples/extensions/mcp-stdio/README.md +19 -0
- package/examples/extensions/mcp-stdio/index.d.ts +64 -0
- package/examples/extensions/mcp-stdio/index.d.ts.map +1 -0
- package/examples/extensions/mcp-stdio/index.js +292 -0
- package/examples/extensions/mcp-stdio/index.js.map +1 -0
- package/examples/extensions/mcp-stdio/index.ts +381 -0
- package/examples/extensions/mcp-stdio/plugin.json +10 -0
- package/examples/extensions/memory-backend/index.ts +120 -0
- package/examples/extensions/memory-backend/plugin.json +10 -0
- package/examples/extensions/minimal-mode/index.ts +447 -0
- package/examples/extensions/minimal-mode/plugin.json +10 -0
- package/examples/extensions/multi-agent/README.md +7 -0
- package/examples/extensions/multi-agent/index.ts +592 -0
- package/examples/extensions/multi-agent/plugin.json +13 -0
- package/examples/extensions/notify/index.ts +70 -0
- package/examples/extensions/notify/plugin.json +8 -0
- package/examples/extensions/permission-gate/index.ts +55 -0
- package/examples/extensions/permission-gate/plugin.json +11 -0
- package/examples/extensions/pirate/index.ts +75 -0
- package/examples/extensions/pirate/plugin.json +8 -0
- package/examples/extensions/plan/README.md +16 -0
- package/examples/extensions/plan/index.ts +136 -0
- package/examples/extensions/plan/plugin.json +12 -0
- package/examples/extensions/prompt-customizer/index.ts +117 -0
- package/examples/extensions/prompt-customizer/plugin.json +8 -0
- package/examples/extensions/protected-paths/index.ts +44 -0
- package/examples/extensions/protected-paths/plugin.json +11 -0
- package/examples/extensions/provider-attribution/README.md +12 -0
- package/examples/extensions/provider-attribution/index.ts +86 -0
- package/examples/extensions/provider-attribution/plugin.json +10 -0
- package/examples/extensions/send-user-message/index.ts +118 -0
- package/examples/extensions/send-user-message/plugin.json +11 -0
- package/examples/extensions/session-name/index.ts +31 -0
- package/examples/extensions/session-name/plugin.json +11 -0
- package/examples/extensions/session-share/README.md +15 -0
- package/examples/extensions/session-share/index.ts +170 -0
- package/examples/extensions/session-share/plugin.json +15 -0
- package/examples/extensions/structured-output/index.ts +68 -0
- package/examples/extensions/structured-output/plugin.json +10 -0
- package/examples/extensions/subagent/README.md +177 -0
- package/examples/extensions/subagent/agents/planner.md +37 -0
- package/examples/extensions/subagent/agents/reviewer.md +35 -0
- package/examples/extensions/subagent/agents/scout.md +50 -0
- package/examples/extensions/subagent/agents/worker.md +24 -0
- package/examples/extensions/subagent/agents.ts +157 -0
- package/examples/extensions/subagent/index.ts +1057 -0
- package/examples/extensions/subagent/plugin.json +13 -0
- package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
- package/examples/extensions/subagent/prompts/implement.md +10 -0
- package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
- package/examples/extensions/suite-manager/README.md +45 -0
- package/examples/extensions/suite-manager/index.ts +182 -0
- package/examples/extensions/suite-manager/plugin.json +13 -0
- package/examples/extensions/timed-confirm/index.ts +93 -0
- package/examples/extensions/timed-confirm/plugin.json +13 -0
- package/examples/extensions/todo-set/README.md +18 -0
- package/examples/extensions/todo-set/index.ts +133 -0
- package/examples/extensions/todo-set/plugin.json +12 -0
- package/examples/extensions/tool-override/index.ts +159 -0
- package/examples/extensions/tool-override/plugin.json +11 -0
- package/examples/extensions/trigger-compact/index.ts +76 -0
- package/examples/extensions/trigger-compact/plugin.json +14 -0
- package/examples/extensions/truncated-tool/index.ts +204 -0
- package/examples/extensions/truncated-tool/plugin.json +10 -0
- package/examples/extensions/with-deps/index.ts +42 -0
- package/examples/extensions/with-deps/package-lock.json +31 -0
- package/examples/extensions/with-deps/package.json +22 -0
- package/examples/extensions/with-deps/plugin.json +10 -0
- package/examples/remote-client.ts +66 -0
- package/examples/rpc-extension-ui.ts +641 -0
- package/examples/sdk/01-minimal.ts +26 -0
- package/examples/sdk/02-custom-model.ts +49 -0
- package/examples/sdk/03-custom-prompt.ts +70 -0
- package/examples/sdk/04-skills.ts +55 -0
- package/examples/sdk/05-tools.ts +48 -0
- package/examples/sdk/07-context-files.ts +42 -0
- package/examples/sdk/08-prompt-templates.ts +51 -0
- package/examples/sdk/09-api-keys-and-oauth.ts +34 -0
- package/examples/sdk/10-settings.ts +53 -0
- package/examples/sdk/11-sessions.ts +52 -0
- package/examples/sdk/12-full-control.ts +72 -0
- package/examples/sdk/13-session-runtime.ts +71 -0
- package/examples/sdk/14-custom-session-storage.ts +132 -0
- package/examples/sdk/README.md +139 -0
- package/package.json +111 -0
|
@@ -0,0 +1,2550 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentSession - Core abstraction for agent lifecycle and session management.
|
|
3
|
+
*
|
|
4
|
+
* This class is shared between all run modes (interactive, print, rpc).
|
|
5
|
+
* It encapsulates:
|
|
6
|
+
* - Agent state access
|
|
7
|
+
* - Event subscription with automatic session persistence
|
|
8
|
+
* - Model and thinking level management
|
|
9
|
+
* - Compaction (manual and auto)
|
|
10
|
+
* - Bash execution
|
|
11
|
+
* - Session switching and branching
|
|
12
|
+
*
|
|
13
|
+
* Modes use this class and add their own I/O layer on top.
|
|
14
|
+
*/
|
|
15
|
+
import { readFileSync } from "node:fs";
|
|
16
|
+
import { resolve } from "node:path";
|
|
17
|
+
import { contentText } from "@agent-forge/ai";
|
|
18
|
+
import { clampThinkingLevel, cleanupSessionResources, getSupportedThinkingLevels, streamSimple, } from "@agent-forge/ai/compat";
|
|
19
|
+
import { stripFrontmatter } from "../utils/frontmatter.js";
|
|
20
|
+
import { abortBash, captureBashEpoch, emitUserBash, executeBash, flushPendingBashMessages, isBashEpochCurrent, recordBashResult, } from "./agent-session-bash.js";
|
|
21
|
+
import { checkCompaction, compactBeforeNextAssistantResponse, compactInternal, enqueueCompaction, navigateTree, runAutoCompaction, } from "./agent-session-compaction.js";
|
|
22
|
+
import { applyContextTransition, assertContextTransitionCurrent, beginContextTransitionFence, copyContextMessages, enqueueContextTransition, isContextTransitionCurrent, replaceContext, requireContextStrategy, requireIdleContextOperation, restoreContext, restoreContextTransition, snapshotContext, } from "./agent-session-context.js";
|
|
23
|
+
import { buildExtensionResourcePaths, collectCommandInfos, extendResourcesFromExtensions, getExtensionSourceLabel, } from "./agent-session-extensions.js";
|
|
24
|
+
import { detachedSessionSnapshot, } from "./agent-session-internal.js";
|
|
25
|
+
import { dispatchAgentEndLifecycle, dispatchAgentSettledLifecycle, dispatchAgentStartLifecycle, dispatchAgentTaskSettledLifecycle, dispatchBeforeAgentStartLifecycle, dispatchBeforeAgentStartV2Lifecycle, dispatchContextReplacedLifecycle, dispatchInputGateBlockedLifecycle, dispatchInputReceivedLifecycle, dispatchMessageEndLifecycle, dispatchMessageStartLifecycle, dispatchModelResponseLifecycle, dispatchModelStreamLifecycle, dispatchSessionEndLifecycle, dispatchSessionEntryAppendedLifecycle, dispatchSessionInfoChangedLifecycle, dispatchSessionReloadLifecycle, dispatchSessionStartLifecycle, dispatchThinkingLevelSelectLifecycle, dispatchToolCommitLifecycle, dispatchToolExecutionStartLifecycle, dispatchToolResultLifecycle, dispatchTurnEndLifecycle, dispatchTurnStartLifecycle, observeLifecycleDeliveryError, } from "./agent-session-lifecycle.js";
|
|
26
|
+
import { createLoopWiring, wireDefaultLoop } from "./agent-session-loop.js";
|
|
27
|
+
import { postAgentRun, runPromptLoop } from "./agent-session-loop-runner.js";
|
|
28
|
+
import { addPersistedDefaultToNonEmptyScope, cycleAvailableModel, cycleModel, cycleScopedModel, emitModelSelect, getScopedModels, getThinkingLevelForModelSwitch, modelFactsView, setModel, setScopedModels, } from "./agent-session-model.js";
|
|
29
|
+
import { exportToHtml, exportToJsonl, getContextUsage, getLastAssistantText, getSessionStats, getUserMessagesForForking, } from "./agent-session-projection.js";
|
|
30
|
+
import { isRetryableError, prepareRetry, willRetryAfterAgentEnd } from "./agent-session-retry.js";
|
|
31
|
+
import { getAllTools, getCapabilitySkills, getToolDefinition, normalizePromptGuidelines, normalizePromptSnippet, rebuildSystemPrompt, refreshBootstrapSkills, refreshToolRegistry, setActiveToolsByName, syncCapabilityTools, validateCapabilitySkillConflicts, } from "./agent-session-tools.js";
|
|
32
|
+
import { formatNoApiKeyFoundMessage, formatNoModelSelectedMessage } from "./auth-guidance.js";
|
|
33
|
+
import { THINKING_LEVEL_OPTIONS } from "./defaults.js";
|
|
34
|
+
import { definitionSnapshot, detachedSnapshot } from "./extensions/capability-runtime-snapshot.js";
|
|
35
|
+
import { BOOTSTRAP_AGENT_LOOP_PLUGIN_ID, BOOTSTRAP_BRANCH_SUMMARY_PLUGIN_ID, BOOTSTRAP_COMPACTION_PLUGIN_ID, BOOTSTRAP_LIFECYCLE_PLUGIN_ID, BOOTSTRAP_OVERFLOW_PLUGIN_ID, BOOTSTRAP_RETRY_PLUGIN_ID, BOOTSTRAP_SKILLS_PLUGIN_ID, BOOTSTRAP_TOOLS_PLUGIN_ID, createCapabilityRuntime, DEFAULT_BRANCH_SUMMARY_POLICY_NAME, DEFAULT_COMPACTION_POLICY_NAME, DEFAULT_OVERFLOW_POLICY_NAME, DEFAULT_RETRY_POLICY_NAME, DEFAULT_RUN_LOOP_STRATEGY_NAME, EXPERIMENTAL_PUBLIC_API_VERSION, installBootstrapAgentLoop, installBootstrapBranchSummaryPolicy, installBootstrapCompactionPolicy, installBootstrapLifecycle, installBootstrapOverflowPolicy, installBootstrapRetryPolicy, installSessionBootstrapSkills, installSessionBootstrapTools, loadCapabilityPluginFromManifest, loadCapabilityPlugin as loadCapabilityPluginRuntime, } from "./extensions/index.js";
|
|
36
|
+
import { expandPromptTemplate } from "./prompt-templates.js";
|
|
37
|
+
import { createSessionJsonlArtifact } from "./session-export.js";
|
|
38
|
+
import { createToolSearchTool } from "./tools/tool-search.js";
|
|
39
|
+
/**
|
|
40
|
+
* Parse a skill block from message text.
|
|
41
|
+
* Returns null if the text doesn't contain a skill block.
|
|
42
|
+
*/
|
|
43
|
+
export function parseSkillBlock(text) {
|
|
44
|
+
const match = text.match(/^<skill name="([^"]+)" location="([^"]+)">\n([\s\S]*?)\n<\/skill>(?:\n\n([\s\S]+))?$/);
|
|
45
|
+
if (!match)
|
|
46
|
+
return null;
|
|
47
|
+
return {
|
|
48
|
+
name: match[1],
|
|
49
|
+
location: match[2],
|
|
50
|
+
content: match[3],
|
|
51
|
+
userMessage: match[4]?.trim() || undefined,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Custom entry type marking a cross-suite resume (设计 §10.1 最小可用版): the
|
|
56
|
+
* session was created under one suite but its context was reassembled under
|
|
57
|
+
* another. Entry data: `{ originalSuiteId, currentSuiteId }`.
|
|
58
|
+
*/
|
|
59
|
+
export const SUITE_MISMATCH_SESSION_ENTRY_TYPE = "suite_mismatch";
|
|
60
|
+
// ============================================================================
|
|
61
|
+
// Constants
|
|
62
|
+
// ============================================================================
|
|
63
|
+
// ============================================================================
|
|
64
|
+
// AgentSession Class
|
|
65
|
+
// ============================================================================
|
|
66
|
+
/**
|
|
67
|
+
* Core session orchestration adapter.
|
|
68
|
+
*
|
|
69
|
+
* The stable facade `CodingAgentFacadeV1` (docs/design/稳定门面统一入口设计.md)
|
|
70
|
+
* is the only supported consumption surface for product hosts. Direct
|
|
71
|
+
* consumption of this class is limited to registered carve-outs
|
|
72
|
+
* (tui-private-path-contract.test.ts allowlists and the §2.7/§2.9 deferred
|
|
73
|
+
* registrations in the design doc).
|
|
74
|
+
*
|
|
75
|
+
* @internal
|
|
76
|
+
*/
|
|
77
|
+
export class AgentSession {
|
|
78
|
+
agent;
|
|
79
|
+
sessionManager;
|
|
80
|
+
settingsManager;
|
|
81
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
82
|
+
_scopedModels;
|
|
83
|
+
// Event subscription state
|
|
84
|
+
_unsubscribeAgent;
|
|
85
|
+
_eventListeners = [];
|
|
86
|
+
_isAgentRunActive = false;
|
|
87
|
+
_idleWaitPromise;
|
|
88
|
+
_resolveIdleWait;
|
|
89
|
+
/** Tracks pending steering messages for UI display. Removed when delivered. */
|
|
90
|
+
_steeringMessages = [];
|
|
91
|
+
/** Tracks pending follow-up messages for UI display. Removed when delivered. */
|
|
92
|
+
_followUpMessages = [];
|
|
93
|
+
/** Messages queued to be included with the next user prompt as context ("asides"). */
|
|
94
|
+
_pendingNextTurnMessages = [];
|
|
95
|
+
/** Context-only custom messages queued during a run, flushed once the current turn's tool results are in. */
|
|
96
|
+
_pendingCustomMessages = [];
|
|
97
|
+
// Compaction state
|
|
98
|
+
/** Serializes manual and automatic compaction, including their projections. */
|
|
99
|
+
_compactionQueue = Promise.resolve();
|
|
100
|
+
_compactionAbortController = undefined;
|
|
101
|
+
_autoCompactionAbortController = undefined;
|
|
102
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
103
|
+
_overflowRecoveryAttempted = false;
|
|
104
|
+
// Branch summarization state
|
|
105
|
+
_branchSummaryAbortController = undefined;
|
|
106
|
+
_branchSummaryPromise = undefined;
|
|
107
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
108
|
+
_resolveBranchSummaryPromise = undefined;
|
|
109
|
+
// Retry state
|
|
110
|
+
_retryAbortController = undefined;
|
|
111
|
+
/** Cancellation boundary for retry/overflow policy decisions in the active agent loop. */
|
|
112
|
+
_policyDecisionAbortController = undefined;
|
|
113
|
+
_retryAttempt = 0;
|
|
114
|
+
/** Cancellation signal for the capability command currently executing through prompt(). */
|
|
115
|
+
_commandAbortController = undefined;
|
|
116
|
+
/**
|
|
117
|
+
* Parent-session cancel fence for agent tasks (D-044 §4.2). Consumed once
|
|
118
|
+
* per task creation through the runtime's `parentSignal` getter; replaced
|
|
119
|
+
* after every abort/runtime rebuild so later tasks bind to a fresh signal.
|
|
120
|
+
*/
|
|
121
|
+
_agentTaskScopeAbortController = new AbortController();
|
|
122
|
+
_activeCapabilityCommand;
|
|
123
|
+
_activeCompactionPromise;
|
|
124
|
+
/** Prevents new mutable work from entering while the session is being replaced. */
|
|
125
|
+
_reloadInProgress = false;
|
|
126
|
+
/** Monotonic committed reload generation, distinct from disposal and bash fences. */
|
|
127
|
+
_reloadGeneration = 0;
|
|
128
|
+
/** Generation fence for context projections that may outlive a runtime replacement. */
|
|
129
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
130
|
+
_contextEpoch = 0;
|
|
131
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
132
|
+
_contextTransitionAbortController = new AbortController();
|
|
133
|
+
/** Serializes context transitions and lets reload/dispose drain them before teardown. */
|
|
134
|
+
_activeContextTransition;
|
|
135
|
+
/** Monotonic revision for the public context snapshot/commit facade. */
|
|
136
|
+
_contextRevision = 0;
|
|
137
|
+
/** Serializes public context commits so expectedRevision is a real CAS fence. */
|
|
138
|
+
_contextCommitQueue = Promise.resolve();
|
|
139
|
+
// Bash execution state
|
|
140
|
+
_bashAbortControllers = new Set();
|
|
141
|
+
/** Whole bash operations, including their final session-history write. */
|
|
142
|
+
_activeBashPromises = new Set();
|
|
143
|
+
/** Fences mode-level bash results captured before a runtime replacement. */
|
|
144
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
145
|
+
_bashEpoch = 0;
|
|
146
|
+
_pendingBashMessages = [];
|
|
147
|
+
_turnIndex = 0;
|
|
148
|
+
_resourceLoader;
|
|
149
|
+
_customTools;
|
|
150
|
+
_deferredToolPluginIds;
|
|
151
|
+
/** Abort reason supplied to the in-flight abort(); consumed by the interruption marker. */
|
|
152
|
+
_pendingAbortReason;
|
|
153
|
+
/** Set when the in-flight prompt run produced an aborted terminal assistant turn. */
|
|
154
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
155
|
+
_currentRunAborted = false;
|
|
156
|
+
/** Most recent abort reason; persists after abort() returns so prompt() can report it. */
|
|
157
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
158
|
+
_lastAbortReason;
|
|
159
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
160
|
+
_baseToolDefinitions = new Map();
|
|
161
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
162
|
+
_baseToolSources = new Map();
|
|
163
|
+
_capabilityRuntime;
|
|
164
|
+
/** Output-artifact commit listeners registered through {@link onOutputArtifactCommit}. */
|
|
165
|
+
_outputArtifactCommitListeners = new Set();
|
|
166
|
+
/**
|
|
167
|
+
* Stable commit dispatcher handed to every CapabilityRuntime this session
|
|
168
|
+
* builds; listeners registered on the session survive runtime rebuilds.
|
|
169
|
+
*/
|
|
170
|
+
_dispatchOutputArtifactCommit = (artifact) => {
|
|
171
|
+
for (const listener of [...this._outputArtifactCommitListeners])
|
|
172
|
+
listener(artifact);
|
|
173
|
+
};
|
|
174
|
+
_bootstrapToolsHandle;
|
|
175
|
+
_bootstrapSkillsHandle;
|
|
176
|
+
_bootstrapRetryHandle;
|
|
177
|
+
_bootstrapCompactionHandle;
|
|
178
|
+
_bootstrapBranchSummaryHandle;
|
|
179
|
+
_bootstrapOverflowHandle;
|
|
180
|
+
_bootstrapAgentLoopHandle;
|
|
181
|
+
_bootstrapLifecycleHandle;
|
|
182
|
+
_capabilityPlugins = new Map();
|
|
183
|
+
_inlineCapabilityPlugins = new Map();
|
|
184
|
+
_isDisposingCapabilityPlugins = false;
|
|
185
|
+
/**
|
|
186
|
+
* 工具表变更钩子的两道门(见 _buildRuntime 的 onToolRegistryChange):
|
|
187
|
+
* - `_toolRegistryHookReady`:构造期门。_buildRuntime 求值阶段 bootstrap 插件
|
|
188
|
+
* 注册即触发 notify,而此时内部状态未就绪(观察回调会抛),构造完成后既有
|
|
189
|
+
* 边界(_buildRuntime 尾部的显式 sync + refresh)已兜底,跳过不丢状态。
|
|
190
|
+
* - `_suspendToolRegistryHookRefresh`:插件卸载恢复链的中间态挂起位。恢复过程
|
|
191
|
+
* 会先删新注册、后恢复被替换者,中间 notify 的工具表是暂态(活跃名暂时缺
|
|
192
|
+
* 席);该窗口内刷新会把缺席名从活动集永久剔除。装卸边界在 dispose 完成后
|
|
193
|
+
* 自行兜底刷新。
|
|
194
|
+
*/
|
|
195
|
+
_suspendToolRegistryHookRefresh = false;
|
|
196
|
+
_toolRegistryHookReady = false;
|
|
197
|
+
_disposePromise;
|
|
198
|
+
_cwd;
|
|
199
|
+
_initialActiveToolNames;
|
|
200
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
201
|
+
_allowedToolNames;
|
|
202
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
203
|
+
_excludedToolNames;
|
|
204
|
+
_baseToolsOverride;
|
|
205
|
+
_disabledBootstrapPlugins;
|
|
206
|
+
_sessionStartEvent;
|
|
207
|
+
_capabilityMode;
|
|
208
|
+
_contextStrategyName;
|
|
209
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
210
|
+
_retryPolicyName;
|
|
211
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
212
|
+
_compactionPolicyName;
|
|
213
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
214
|
+
_branchSummaryPolicyName;
|
|
215
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
216
|
+
_overflowPolicyName;
|
|
217
|
+
/** Post-run continuation strategy name; missing registrations fall back to the host candidate. */
|
|
218
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
219
|
+
_runLoopStrategyName;
|
|
220
|
+
/**
|
|
221
|
+
* Internal loop-executor seam (D-043 G3); no public config, distinct from
|
|
222
|
+
* runLoopStrategyName (a per-continuation veto policy).
|
|
223
|
+
*/
|
|
224
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
225
|
+
_loopExecutor;
|
|
226
|
+
/** The agent's construction-time prepare adapter, captured once by the loop wiring. */
|
|
227
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
228
|
+
_initialPrepareNextTurn;
|
|
229
|
+
_agentTaskAdapter;
|
|
230
|
+
_agentTaskResults;
|
|
231
|
+
_agentSessionReader;
|
|
232
|
+
_agentSessionLister;
|
|
233
|
+
_agentComposition;
|
|
234
|
+
_interactionHost;
|
|
235
|
+
_modelRuntime;
|
|
236
|
+
_modelStreamCounter = 0;
|
|
237
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
238
|
+
_modelStreamState;
|
|
239
|
+
/** Correlation id shared by every in-turn lifecycle dispatch of the active prompt run. */
|
|
240
|
+
_turnCorrelationId;
|
|
241
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
242
|
+
_turnCorrelationCounter = 0;
|
|
243
|
+
// Tool registry for extension getTools/setTools
|
|
244
|
+
_toolRegistry = new Map();
|
|
245
|
+
_toolDefinitions = new Map();
|
|
246
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
247
|
+
_toolPromptSnippets = new Map();
|
|
248
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
249
|
+
_toolPromptGuidelines = new Map();
|
|
250
|
+
// Base system prompt (without extension appends) - used to apply fresh appends each turn
|
|
251
|
+
_baseSystemPrompt = "";
|
|
252
|
+
_baseSystemPromptOptions;
|
|
253
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
254
|
+
_systemPromptOverride;
|
|
255
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
256
|
+
_orientationPrompt;
|
|
257
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
258
|
+
_preferenceCard;
|
|
259
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
260
|
+
_capabilitySkillsFilter;
|
|
261
|
+
_hostLogger;
|
|
262
|
+
_logRecordMirrorRef;
|
|
263
|
+
_observabilityGetMetricsRef;
|
|
264
|
+
_agentDir;
|
|
265
|
+
_communication;
|
|
266
|
+
_turnContext;
|
|
267
|
+
_roleAssociations;
|
|
268
|
+
_memoryStorage;
|
|
269
|
+
_traceService;
|
|
270
|
+
constructor(config) {
|
|
271
|
+
this.agent = config.agent;
|
|
272
|
+
this.sessionManager = config.sessionManager;
|
|
273
|
+
this._contextRevision = this.sessionManager.getRevision().sequence;
|
|
274
|
+
this.settingsManager = config.settingsManager;
|
|
275
|
+
this._scopedModels = config.scopedModels ?? [];
|
|
276
|
+
this._resourceLoader = config.resourceLoader;
|
|
277
|
+
this._customTools = config.customTools ?? [];
|
|
278
|
+
this._deferredToolPluginIds = new Set(config.deferredToolPluginIds ?? []);
|
|
279
|
+
if (this._deferredToolPluginIds.size > 0) {
|
|
280
|
+
this._customTools.push(createToolSearchTool({
|
|
281
|
+
listAllToolNames: () => Array.from(this._toolRegistry.keys()),
|
|
282
|
+
getToolInfo: (name) => {
|
|
283
|
+
const definition = this._toolDefinitions.get(name)?.definition;
|
|
284
|
+
return definition ? { name: definition.name, description: definition.description } : undefined;
|
|
285
|
+
},
|
|
286
|
+
getActiveToolNames: () => this.getActiveToolNames(),
|
|
287
|
+
setActiveToolsByName: (toolNames) => this.setActiveToolsByName(toolNames),
|
|
288
|
+
}));
|
|
289
|
+
}
|
|
290
|
+
this._cwd = config.cwd;
|
|
291
|
+
this._modelRuntime = config.modelRuntime;
|
|
292
|
+
this._initialActiveToolNames = config.initialActiveToolNames;
|
|
293
|
+
this._allowedToolNames = config.allowedToolNames ? new Set(config.allowedToolNames) : undefined;
|
|
294
|
+
this._excludedToolNames = config.excludedToolNames ? new Set(config.excludedToolNames) : undefined;
|
|
295
|
+
this._baseToolsOverride = config.baseToolsOverride;
|
|
296
|
+
this._disabledBootstrapPlugins = config.disabledBootstrapPlugins;
|
|
297
|
+
this._sessionStartEvent = config.sessionStartEvent ?? { reason: "startup" };
|
|
298
|
+
this._capabilityMode = config.capabilityMode ?? "full-control";
|
|
299
|
+
this._contextStrategyName = config.contextStrategyName;
|
|
300
|
+
this._retryPolicyName = config.retryPolicyName ?? DEFAULT_RETRY_POLICY_NAME;
|
|
301
|
+
this._compactionPolicyName = config.compactionPolicyName ?? DEFAULT_COMPACTION_POLICY_NAME;
|
|
302
|
+
this._branchSummaryPolicyName = config.branchSummaryPolicyName ?? DEFAULT_BRANCH_SUMMARY_POLICY_NAME;
|
|
303
|
+
this._overflowPolicyName = config.overflowPolicyName ?? DEFAULT_OVERFLOW_POLICY_NAME;
|
|
304
|
+
this._runLoopStrategyName = config.runLoopStrategyName ?? DEFAULT_RUN_LOOP_STRATEGY_NAME;
|
|
305
|
+
this._agentTaskAdapter = config.agentTaskAdapter;
|
|
306
|
+
this._agentTaskResults = config.agentTaskResults;
|
|
307
|
+
this._agentSessionReader = config.agentSessionReader;
|
|
308
|
+
this._agentSessionLister = config.agentSessionLister;
|
|
309
|
+
this._agentComposition = config.agentComposition;
|
|
310
|
+
this._interactionHost = config.interactionHost;
|
|
311
|
+
this._orientationPrompt = config.orientationPrompt;
|
|
312
|
+
this._preferenceCard = config.preferenceCard;
|
|
313
|
+
this._capabilitySkillsFilter = config.capabilitySkillsFilter;
|
|
314
|
+
this._hostLogger = config.hostLogger;
|
|
315
|
+
this._logRecordMirrorRef = config.logRecordMirrorRef;
|
|
316
|
+
this._observabilityGetMetricsRef = config.observabilityGetMetricsRef;
|
|
317
|
+
this._agentDir = config.agentDir;
|
|
318
|
+
this._communication = config.communication;
|
|
319
|
+
this._turnContext = config.turnContext;
|
|
320
|
+
this._roleAssociations = config.roleAssociations;
|
|
321
|
+
this._memoryStorage = config.memoryStorage;
|
|
322
|
+
this._traceService = config.traceService;
|
|
323
|
+
// Always subscribe to agent events for internal handling
|
|
324
|
+
// (session persistence, extensions, auto-compaction, retry logic)
|
|
325
|
+
this._unsubscribeAgent = this.agent.subscribe(this._handleAgentEvent);
|
|
326
|
+
this._buildRuntime({
|
|
327
|
+
activeToolNames: this._initialActiveToolNames,
|
|
328
|
+
includeAllExtensionTools: true,
|
|
329
|
+
});
|
|
330
|
+
this._wireDefaultLoop();
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* 当前回合的 correlation id(会话轨迹设计 §4.2):活跃 prompt 回合内所有
|
|
334
|
+
* lifecycle 信封携带的同一 correlationId(与信封同源:loop-runner 在回合
|
|
335
|
+
* 开始写入 `_turnCorrelationId`、回合结束清除);空闲时为 undefined。只读
|
|
336
|
+
* 事实,供宿主适配器做回合级关联(如 observability 的 llm.request traceId)。
|
|
337
|
+
*/
|
|
338
|
+
getTurnCorrelationId() {
|
|
339
|
+
return this._turnCorrelationId;
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* 宿主 digest sink 面(第 4 期轨迹闭合):把一条后台委派结算行投递为
|
|
343
|
+
* agent.task.settled@1(父会话 sessionId 由派发助手补)。派发是非致命
|
|
344
|
+
* fire-and-forget;dispose 后 runtime 已 revoke,助手 no-op。
|
|
345
|
+
*/
|
|
346
|
+
dispatchAgentTaskSettled(facts) {
|
|
347
|
+
void dispatchAgentTaskSettledLifecycle(this._internal, facts);
|
|
348
|
+
}
|
|
349
|
+
get modelRuntime() {
|
|
350
|
+
return this._modelRuntime;
|
|
351
|
+
}
|
|
352
|
+
/** Internal facade passed to the agent-session-* submodule functions. */
|
|
353
|
+
get _internal() {
|
|
354
|
+
return this;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Wire the default main loop onto the Agent instance.
|
|
358
|
+
*
|
|
359
|
+
* The four hook positions are composed from the runtime's loop-hook chains.
|
|
360
|
+
* Chains are read at execution time, so extension reload swaps in the new
|
|
361
|
+
* runtime without reinstalling the wiring. The legacy extension gate and the
|
|
362
|
+
* agent's construction-time context transform stay as chain heads (host
|
|
363
|
+
* wiring, not plugin capabilities); the default links come from the
|
|
364
|
+
* bootstrap agent-loop plugin and third-party links chain after them in
|
|
365
|
+
* registration order.
|
|
366
|
+
*/
|
|
367
|
+
_wireDefaultLoop() {
|
|
368
|
+
wireDefaultLoop(this._internal);
|
|
369
|
+
}
|
|
370
|
+
/** Session-bound host state the default loop links read at execution time. */
|
|
371
|
+
_createLoopWiring() {
|
|
372
|
+
return createLoopWiring(this._internal);
|
|
373
|
+
}
|
|
374
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
375
|
+
_compactBeforeNextAssistantResponse(context, signal) {
|
|
376
|
+
return compactBeforeNextAssistantResponse(this._internal, context, signal);
|
|
377
|
+
}
|
|
378
|
+
// =========================================================================
|
|
379
|
+
// Event Subscription
|
|
380
|
+
// =========================================================================
|
|
381
|
+
/** Emit an event to all listeners */
|
|
382
|
+
_emit(event) {
|
|
383
|
+
for (const l of this._eventListeners) {
|
|
384
|
+
l(event);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
_emitQueueUpdate() {
|
|
388
|
+
this._emit({
|
|
389
|
+
type: "queue_update",
|
|
390
|
+
steering: [...this._steeringMessages],
|
|
391
|
+
followUp: [...this._followUpMessages],
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
_getIdleWaitPromise() {
|
|
395
|
+
if (!this._idleWaitPromise) {
|
|
396
|
+
this._idleWaitPromise = new Promise((resolve) => {
|
|
397
|
+
this._resolveIdleWait = resolve;
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
return this._idleWaitPromise;
|
|
401
|
+
}
|
|
402
|
+
_resolveIdleWaitIfIdle() {
|
|
403
|
+
if (!this.isIdle || !this._resolveIdleWait) {
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
const resolve = this._resolveIdleWait;
|
|
407
|
+
this._idleWaitPromise = undefined;
|
|
408
|
+
this._resolveIdleWait = undefined;
|
|
409
|
+
resolve();
|
|
410
|
+
}
|
|
411
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
412
|
+
async _emitAgentSettled() {
|
|
413
|
+
this._isAgentRunActive = false;
|
|
414
|
+
try {
|
|
415
|
+
this._emit({ type: "agent_settled" });
|
|
416
|
+
await dispatchAgentSettledLifecycle(this._internal);
|
|
417
|
+
}
|
|
418
|
+
finally {
|
|
419
|
+
this._resolveIdleWaitIfIdle();
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
// Track last assistant message for auto-compaction check
|
|
423
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
424
|
+
_lastAssistantMessage = undefined;
|
|
425
|
+
// The agent_end event and post-run handler both need the retry decision. Cache it
|
|
426
|
+
// so policy plugins are evaluated once per assistant turn (and mock queues remain
|
|
427
|
+
// strict/deterministic).
|
|
428
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
429
|
+
_pendingRetryDecision = undefined;
|
|
430
|
+
/** Internal handler for agent events - shared by subscribe and reconnect */
|
|
431
|
+
_handleAgentEvent = async (event) => {
|
|
432
|
+
if (event.type === "message_start" && event.message.role === "assistant") {
|
|
433
|
+
this._modelStreamState = {
|
|
434
|
+
streamId: `model-stream:${++this._modelStreamCounter}`,
|
|
435
|
+
sequence: 0,
|
|
436
|
+
};
|
|
437
|
+
await this._dispatchModelStreamLifecycle(event.message, "start", "raw");
|
|
438
|
+
}
|
|
439
|
+
// When a user message starts, check if it's from either queue and remove it BEFORE emitting
|
|
440
|
+
// This ensures the UI sees the updated queue state
|
|
441
|
+
if (event.type === "message_start" && event.message.role === "user") {
|
|
442
|
+
this._overflowRecoveryAttempted = false;
|
|
443
|
+
const messageText = contentText(event.message.content, "");
|
|
444
|
+
if (messageText) {
|
|
445
|
+
// Check steering queue first
|
|
446
|
+
const steeringIndex = this._steeringMessages.indexOf(messageText);
|
|
447
|
+
if (steeringIndex !== -1) {
|
|
448
|
+
this._steeringMessages.splice(steeringIndex, 1);
|
|
449
|
+
this._emitQueueUpdate();
|
|
450
|
+
}
|
|
451
|
+
else {
|
|
452
|
+
// Check follow-up queue
|
|
453
|
+
const followUpIndex = this._followUpMessages.indexOf(messageText);
|
|
454
|
+
if (followUpIndex !== -1) {
|
|
455
|
+
this._followUpMessages.splice(followUpIndex, 1);
|
|
456
|
+
this._emitQueueUpdate();
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
await this._emitLifecycleEvents(event);
|
|
462
|
+
if (event.type === "message_update" && event.message.role === "assistant") {
|
|
463
|
+
await this._dispatchModelStreamLifecycle(event.message, event.assistantMessageEvent.type, "candidate");
|
|
464
|
+
}
|
|
465
|
+
// Notify all listeners
|
|
466
|
+
this._emit(event.type === "agent_end"
|
|
467
|
+
? {
|
|
468
|
+
...event,
|
|
469
|
+
willRetry: await this._willRetryAfterAgentEnd(event, this._policyDecisionAbortController?.signal),
|
|
470
|
+
}
|
|
471
|
+
: event);
|
|
472
|
+
// Handle session persistence
|
|
473
|
+
if (event.type === "message_end") {
|
|
474
|
+
// Check if this is a custom message from extensions
|
|
475
|
+
if (event.message.role === "custom") {
|
|
476
|
+
// Persist as CustomMessageEntry
|
|
477
|
+
this.sessionManager.appendCustomMessageEntry(event.message.customType, event.message.content, event.message.display, event.message.details);
|
|
478
|
+
}
|
|
479
|
+
else if (event.message.role === "user" ||
|
|
480
|
+
event.message.role === "assistant" ||
|
|
481
|
+
event.message.role === "toolResult") {
|
|
482
|
+
// Regular LLM message - persist as SessionMessageEntry
|
|
483
|
+
const entryId = this.sessionManager.appendMessage(event.message);
|
|
484
|
+
if (event.message.role === "assistant") {
|
|
485
|
+
if (event.message.stopReason === "aborted") {
|
|
486
|
+
this._currentRunAborted = true;
|
|
487
|
+
}
|
|
488
|
+
await this._dispatchModelStreamLifecycle(event.message, event.message.stopReason === "error" || event.message.stopReason === "aborted" ? "error" : "done", "committed");
|
|
489
|
+
this._modelStreamState = undefined;
|
|
490
|
+
await this._dispatchModelResponseLifecycle(event.message, entryId);
|
|
491
|
+
}
|
|
492
|
+
else if (event.message.role === "toolResult") {
|
|
493
|
+
await this._dispatchToolCommitLifecycle(event.message, entryId);
|
|
494
|
+
await this._dispatchToolResultLifecycle(event.message, entryId);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
// Other message types (bashExecution, compactionSummary, branchSummary) are persisted elsewhere
|
|
498
|
+
// Track assistant message for auto-compaction (checked on agent_end)
|
|
499
|
+
if (event.message.role === "assistant") {
|
|
500
|
+
this._lastAssistantMessage = event.message;
|
|
501
|
+
const assistantMsg = event.message;
|
|
502
|
+
if (assistantMsg.stopReason !== "error" && assistantMsg.stopReason !== "length") {
|
|
503
|
+
this._overflowRecoveryAttempted = false;
|
|
504
|
+
}
|
|
505
|
+
// Reset retry counter immediately on successful assistant response
|
|
506
|
+
// This prevents accumulation across multiple LLM calls within a turn
|
|
507
|
+
if (assistantMsg.stopReason !== "error" && this._retryAttempt > 0) {
|
|
508
|
+
this._emit({
|
|
509
|
+
type: "auto_retry_end",
|
|
510
|
+
success: true,
|
|
511
|
+
attempt: this._retryAttempt,
|
|
512
|
+
});
|
|
513
|
+
this._retryAttempt = 0;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
// A turn ends after its assistant message and every tool result has been appended,
|
|
518
|
+
// so this is the first point in the run where a context-only custom message can be
|
|
519
|
+
// inserted without landing between a tool call and its result. Flushing after the
|
|
520
|
+
// extension and listener dispatch above also picks up messages that turn_end
|
|
521
|
+
// handlers queued.
|
|
522
|
+
if (event.type === "turn_end") {
|
|
523
|
+
this._flushPendingCustomMessages();
|
|
524
|
+
}
|
|
525
|
+
};
|
|
526
|
+
async _dispatchModelStreamLifecycle(message, eventName, phase) {
|
|
527
|
+
await dispatchModelStreamLifecycle(this._internal, message, eventName, phase);
|
|
528
|
+
}
|
|
529
|
+
_willRetryAfterAgentEnd(event, signal) {
|
|
530
|
+
return willRetryAfterAgentEnd(this._internal, event, signal);
|
|
531
|
+
}
|
|
532
|
+
/** Find the last assistant message in agent state (including aborted ones) */
|
|
533
|
+
_findLastAssistantMessage() {
|
|
534
|
+
const messages = this.agent.state.messages;
|
|
535
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
536
|
+
const msg = messages[i];
|
|
537
|
+
if (msg.role === "assistant") {
|
|
538
|
+
return msg;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
return undefined;
|
|
542
|
+
}
|
|
543
|
+
/** Deliver capability lifecycle events derived from one agent event. */
|
|
544
|
+
async _emitLifecycleEvents(event) {
|
|
545
|
+
if (event.type === "agent_start") {
|
|
546
|
+
this._turnIndex = 0;
|
|
547
|
+
await dispatchAgentStartLifecycle(this._internal);
|
|
548
|
+
}
|
|
549
|
+
else if (event.type === "agent_end") {
|
|
550
|
+
await dispatchAgentEndLifecycle(this._internal);
|
|
551
|
+
}
|
|
552
|
+
else if (event.type === "turn_start") {
|
|
553
|
+
await dispatchTurnStartLifecycle(this._internal, this._turnIndex);
|
|
554
|
+
}
|
|
555
|
+
else if (event.type === "turn_end") {
|
|
556
|
+
this._turnIndex++;
|
|
557
|
+
// turn 级 outcome 判定(复审 M2):取 turn_end 事件自带 assistant message
|
|
558
|
+
// 的 stopReason(provider 层 signal.aborted 优先返回 "aborted",取值互斥
|
|
559
|
+
// 精确)。禁用 run 级 `_currentRunAborted`——abort 后 drain 排队消息的
|
|
560
|
+
// 正常回合会被误标;completed 回合不传,缺席省键。
|
|
561
|
+
const turnMessage = event.message;
|
|
562
|
+
const outcome = turnMessage.role === "assistant" &&
|
|
563
|
+
(turnMessage.stopReason === "aborted" || turnMessage.stopReason === "error")
|
|
564
|
+
? turnMessage.stopReason
|
|
565
|
+
: undefined;
|
|
566
|
+
await dispatchTurnEndLifecycle(this._internal, this._turnIndex, this.agent.state.messages.length, outcome);
|
|
567
|
+
}
|
|
568
|
+
else if (event.type === "message_start") {
|
|
569
|
+
await dispatchMessageStartLifecycle(this._internal, event.message.role);
|
|
570
|
+
}
|
|
571
|
+
else if (event.type === "message_end") {
|
|
572
|
+
await dispatchMessageEndLifecycle(this._internal, event.message.role);
|
|
573
|
+
}
|
|
574
|
+
else if (event.type === "tool_execution_start") {
|
|
575
|
+
await dispatchToolExecutionStartLifecycle(this._internal, event.toolCallId, event.toolName);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* Subscribe to agent events.
|
|
580
|
+
* Session persistence is handled internally (saves messages on message_end).
|
|
581
|
+
* Multiple listeners can be added. Returns unsubscribe function for this listener.
|
|
582
|
+
*/
|
|
583
|
+
subscribe(listener) {
|
|
584
|
+
this._eventListeners.push(listener);
|
|
585
|
+
// Return unsubscribe function for this specific listener
|
|
586
|
+
return () => {
|
|
587
|
+
const index = this._eventListeners.indexOf(listener);
|
|
588
|
+
if (index !== -1) {
|
|
589
|
+
this._eventListeners.splice(index, 1);
|
|
590
|
+
}
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
/** Disconnect from agent events during disposal. */
|
|
594
|
+
_disconnectFromAgent() {
|
|
595
|
+
if (this._unsubscribeAgent) {
|
|
596
|
+
this._unsubscribeAgent();
|
|
597
|
+
this._unsubscribeAgent = undefined;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* Remove all listeners and disconnect from agent.
|
|
602
|
+
* Call this when completely done with the session.
|
|
603
|
+
*/
|
|
604
|
+
dispose() {
|
|
605
|
+
if (this._disposePromise)
|
|
606
|
+
return this._disposePromise;
|
|
607
|
+
this._disposePromise = (async () => {
|
|
608
|
+
const errors = [];
|
|
609
|
+
this._beginContextTransitionFence();
|
|
610
|
+
// Fence mode-level and legacy extension bash work before async cleanup.
|
|
611
|
+
this._bashEpoch += 1;
|
|
612
|
+
for (const abort of [
|
|
613
|
+
() => this._abortActiveCapabilityCommand("session disposed"),
|
|
614
|
+
() => this.abortRetry(),
|
|
615
|
+
() => this.abortCompaction(),
|
|
616
|
+
() => this.abortBranchSummary(),
|
|
617
|
+
() => this.abortBash(),
|
|
618
|
+
() => this._agentTaskScopeAbortController.abort("session disposed"),
|
|
619
|
+
() => this.agent.abort(),
|
|
620
|
+
]) {
|
|
621
|
+
try {
|
|
622
|
+
await abort();
|
|
623
|
+
}
|
|
624
|
+
catch (error) {
|
|
625
|
+
errors.push(error);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
await Promise.allSettled([this._activeContextTransition, ...this._activeBashPromises, this.waitForIdle()].filter((operation) => operation !== undefined));
|
|
629
|
+
this._disconnectFromAgent();
|
|
630
|
+
this._eventListeners = [];
|
|
631
|
+
// 会话终态(第 4 期轨迹闭合):capability plugins dispose 之前派发
|
|
632
|
+
// session.end@1——runtime 仍存活、observability 插件此时尚未 dispose,
|
|
633
|
+
// 能写入最后一行轨迹。dispose 幂等(_disposePromise 重入即返回同一
|
|
634
|
+
// promise),派发天然只发生一次;reload 不经过 dispose,不派发。
|
|
635
|
+
await dispatchSessionEndLifecycle(this._internal);
|
|
636
|
+
const disposals = [
|
|
637
|
+
() => this._disposeCapabilityPlugins(),
|
|
638
|
+
() => this._capabilityRuntime?.disposeAll(),
|
|
639
|
+
() => {
|
|
640
|
+
const adapter = this._agentTaskAdapter;
|
|
641
|
+
return adapter?.dispose?.();
|
|
642
|
+
},
|
|
643
|
+
() => {
|
|
644
|
+
const interactionHost = this._interactionHost;
|
|
645
|
+
return interactionHost?.dispose?.();
|
|
646
|
+
},
|
|
647
|
+
() => this._bootstrapToolsHandle?.dispose(),
|
|
648
|
+
() => this._bootstrapSkillsHandle?.dispose(),
|
|
649
|
+
() => this._bootstrapRetryHandle?.dispose(),
|
|
650
|
+
() => this._bootstrapCompactionHandle?.dispose(),
|
|
651
|
+
() => this._bootstrapOverflowHandle?.dispose(),
|
|
652
|
+
() => this._bootstrapBranchSummaryHandle?.dispose(),
|
|
653
|
+
() => this._bootstrapAgentLoopHandle?.dispose(),
|
|
654
|
+
() => this._bootstrapLifecycleHandle?.dispose(),
|
|
655
|
+
];
|
|
656
|
+
for (const dispose of disposals) {
|
|
657
|
+
try {
|
|
658
|
+
await dispose();
|
|
659
|
+
}
|
|
660
|
+
catch (error) {
|
|
661
|
+
errors.push(error);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
this._capabilityRuntime?.revokeAllAPIs();
|
|
665
|
+
this._capabilityPlugins.clear();
|
|
666
|
+
this._inlineCapabilityPlugins.clear();
|
|
667
|
+
this._bootstrapToolsHandle = undefined;
|
|
668
|
+
this._bootstrapSkillsHandle = undefined;
|
|
669
|
+
this._bootstrapRetryHandle = undefined;
|
|
670
|
+
this._bootstrapCompactionHandle = undefined;
|
|
671
|
+
this._bootstrapOverflowHandle = undefined;
|
|
672
|
+
this._bootstrapBranchSummaryHandle = undefined;
|
|
673
|
+
this._bootstrapAgentLoopHandle = undefined;
|
|
674
|
+
this._bootstrapLifecycleHandle = undefined;
|
|
675
|
+
cleanupSessionResources(this.sessionId);
|
|
676
|
+
if (errors.length === 1)
|
|
677
|
+
throw errors[0];
|
|
678
|
+
if (errors.length > 1)
|
|
679
|
+
throw new AggregateError(errors, `Agent session disposal failed: ${this.sessionId}`);
|
|
680
|
+
})();
|
|
681
|
+
return this._disposePromise;
|
|
682
|
+
}
|
|
683
|
+
// =========================================================================
|
|
684
|
+
// Read-only State Access
|
|
685
|
+
// =========================================================================
|
|
686
|
+
/** Full agent state */
|
|
687
|
+
get state() {
|
|
688
|
+
return this.agent.state;
|
|
689
|
+
}
|
|
690
|
+
/** Current model (may be undefined if not yet selected) */
|
|
691
|
+
get model() {
|
|
692
|
+
return this.agent.state.model;
|
|
693
|
+
}
|
|
694
|
+
/** Current thinking level */
|
|
695
|
+
get thinkingLevel() {
|
|
696
|
+
return this.agent.state.thinkingLevel;
|
|
697
|
+
}
|
|
698
|
+
/** Whether the session is currently processing an agent run or post-run continuation. */
|
|
699
|
+
get isStreaming() {
|
|
700
|
+
return this._isAgentRunActive;
|
|
701
|
+
}
|
|
702
|
+
/** Whether the session has no active agent run, retry, compaction, branch summarization, or queued continuation. */
|
|
703
|
+
get isIdle() {
|
|
704
|
+
return !this._isAgentRunActive && !this.isCompacting;
|
|
705
|
+
}
|
|
706
|
+
/** Current effective system prompt (includes any per-turn extension modifications) */
|
|
707
|
+
get systemPrompt() {
|
|
708
|
+
return this.agent.state.systemPrompt;
|
|
709
|
+
}
|
|
710
|
+
/** Current retry attempt (0 if not retrying) */
|
|
711
|
+
get retryAttempt() {
|
|
712
|
+
return this._retryAttempt;
|
|
713
|
+
}
|
|
714
|
+
/**
|
|
715
|
+
* Get the names of currently active tools.
|
|
716
|
+
* Returns the names of tools currently set on the agent.
|
|
717
|
+
*/
|
|
718
|
+
getActiveToolNames() {
|
|
719
|
+
return this.agent.state.tools.map((t) => t.name);
|
|
720
|
+
}
|
|
721
|
+
/** Public capability runtime for external orchestration and plugin composition. */
|
|
722
|
+
getCapabilityRuntime() {
|
|
723
|
+
if (!this._capabilityRuntime)
|
|
724
|
+
throw new Error("Capability runtime is not available");
|
|
725
|
+
return this._capabilityRuntime;
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* Observes every output artifact committed through this session's capability
|
|
729
|
+
* runtime. Host adapters mirror the payload into durable storage; the runtime
|
|
730
|
+
* itself carries no durable dependency. The registration survives runtime
|
|
731
|
+
* rebuilds (reload) because the session owns the dispatcher. Returns an
|
|
732
|
+
* unsubscribe function.
|
|
733
|
+
*/
|
|
734
|
+
onOutputArtifactCommit(listener) {
|
|
735
|
+
this._outputArtifactCommitListeners.add(listener);
|
|
736
|
+
return () => {
|
|
737
|
+
this._outputArtifactCommitListeners.delete(listener);
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
get isDisposed() {
|
|
741
|
+
return this._disposePromise !== undefined;
|
|
742
|
+
}
|
|
743
|
+
/** Public session facade for host adapters. It never exposes SessionManager internals. */
|
|
744
|
+
getSessionAPI() {
|
|
745
|
+
return {
|
|
746
|
+
getSessionId: () => this.sessionManager.getSessionId(),
|
|
747
|
+
getRevision: () => this.sessionManager.getRevision(),
|
|
748
|
+
registerEntryProjection: (projection) =>
|
|
749
|
+
// 公共投影契约是松类型(unknown 列表);此处是宿主信任边界,
|
|
750
|
+
// 投影实现错误会在上下文投影时显式失败,不在此静默防御。
|
|
751
|
+
this.sessionManager.registerEntryProjection(projection),
|
|
752
|
+
getContextSnapshot: () => ({
|
|
753
|
+
version: 1,
|
|
754
|
+
revision: this._contextRevision,
|
|
755
|
+
value: detachedSessionSnapshot(this.agent.state.messages),
|
|
756
|
+
}),
|
|
757
|
+
commitContext: async (request) => {
|
|
758
|
+
const commit = this._contextCommitQueue.then(async () => {
|
|
759
|
+
if (request.signal?.aborted)
|
|
760
|
+
throw new Error("Context commit cancelled");
|
|
761
|
+
const currentRevision = this._contextRevision;
|
|
762
|
+
if (request.operationId.trim() === "")
|
|
763
|
+
throw new Error("Context commit operationId is required");
|
|
764
|
+
if (request.expectedRevision !== currentRevision) {
|
|
765
|
+
throw new Error(`Context revision conflict: expected ${request.expectedRevision}, current ${currentRevision}`);
|
|
766
|
+
}
|
|
767
|
+
if (!Array.isArray(request.value))
|
|
768
|
+
throw new Error("Session context commit requires a message array");
|
|
769
|
+
await this.replaceContext(request.value);
|
|
770
|
+
if (request.signal?.aborted)
|
|
771
|
+
throw new Error("Context commit cancelled");
|
|
772
|
+
return {
|
|
773
|
+
version: 1,
|
|
774
|
+
status: "committed",
|
|
775
|
+
revision: this._contextRevision,
|
|
776
|
+
value: detachedSessionSnapshot(this.agent.state.messages),
|
|
777
|
+
};
|
|
778
|
+
});
|
|
779
|
+
this._contextCommitQueue = commit.then(() => undefined, () => undefined);
|
|
780
|
+
return commit;
|
|
781
|
+
},
|
|
782
|
+
getMessages: () => detachedSessionSnapshot(this.agent.state.messages),
|
|
783
|
+
isIdle: () => this.isIdle,
|
|
784
|
+
prompt: (text) => this.prompt(text),
|
|
785
|
+
steer: (text) => this.steer(text),
|
|
786
|
+
queueFollowUp: (text) => this.sendUserMessage(text, { deliverAs: "followUp" }),
|
|
787
|
+
abort: () => this.abort(),
|
|
788
|
+
waitForIdle: () => this.waitForIdle(),
|
|
789
|
+
getActiveTools: () => this.getActiveToolNames(),
|
|
790
|
+
// readonly 会话不暴露能力面变更口(只读就是只读:能在只读会话上改工具面的
|
|
791
|
+
// 消费方等于拿到了放大权限的口子)。成员缺席即不可用,调用方按可选处理。
|
|
792
|
+
...(this._capabilityMode === "readonly"
|
|
793
|
+
? {}
|
|
794
|
+
: { setActiveTools: (toolNames) => this.setActiveToolsByName(toolNames) }),
|
|
795
|
+
compact: (customInstructions) => this.compact(customInstructions),
|
|
796
|
+
navigateTree: (targetId, options) => this.navigateTree(targetId, options),
|
|
797
|
+
appendEntry: (customType, data) => {
|
|
798
|
+
const entryId = this.sessionManager.appendCustomEntry(customType, data === undefined ? undefined : detachedSessionSnapshot(data));
|
|
799
|
+
const entry = this.sessionManager.getEntry(entryId);
|
|
800
|
+
if (entry) {
|
|
801
|
+
this._emit({ type: "entry_appended", entry });
|
|
802
|
+
void dispatchSessionEntryAppendedLifecycle(this._internal, entryId, entry.type);
|
|
803
|
+
}
|
|
804
|
+
return entryId;
|
|
805
|
+
},
|
|
806
|
+
setSessionName: (name) => this.setSessionName(name),
|
|
807
|
+
getSessionName: () => this.sessionManager.getSessionName(),
|
|
808
|
+
setLabel: (entryId, label) => this.sessionManager.appendLabelChange(entryId, label),
|
|
809
|
+
getLabel: (entryId) => this.sessionManager.getLabel(entryId),
|
|
810
|
+
getAllTools: () => definitionSnapshot(this.getAllTools()),
|
|
811
|
+
getCommands: () => collectCommandInfos(this._internal),
|
|
812
|
+
getModel: () => (this.model ? detachedSnapshot(modelFactsView(this.model)) : undefined),
|
|
813
|
+
getScopedModels: () => detachedSnapshot(this.scopedModels.map((entry) => ({
|
|
814
|
+
model: modelFactsView(entry.model),
|
|
815
|
+
...(entry.thinkingLevel === undefined ? {} : { thinkingLevel: entry.thinkingLevel }),
|
|
816
|
+
}))),
|
|
817
|
+
getThinkingLevel: () => this.thinkingLevel,
|
|
818
|
+
...(this._capabilityMode === "readonly" ? {} : { setThinkingLevel: (level) => this.setThinkingLevel(level) }),
|
|
819
|
+
...(this._capabilityMode === "readonly"
|
|
820
|
+
? {}
|
|
821
|
+
: {
|
|
822
|
+
setModel: async (modelId) => {
|
|
823
|
+
const scoped = this.scopedModels.find((entry) => entry.model.id === modelId);
|
|
824
|
+
if (!scoped)
|
|
825
|
+
return false;
|
|
826
|
+
if (!this._modelRuntime.hasConfiguredAuth(scoped.model.provider))
|
|
827
|
+
return false;
|
|
828
|
+
await this.setModel(scoped.model);
|
|
829
|
+
return true;
|
|
830
|
+
},
|
|
831
|
+
}),
|
|
832
|
+
getSystemPrompt: () => this.systemPrompt,
|
|
833
|
+
getSystemPromptOptions: () => detachedSnapshot(this._baseSystemPromptOptions),
|
|
834
|
+
getContextUsage: () => getContextUsage(this._internal),
|
|
835
|
+
sendMessage: (message, options) => this.sendCustomMessage(message, options),
|
|
836
|
+
getBranchEntries: () => detachedSessionSnapshot(this.sessionManager.getBranch().map((entry) => ({
|
|
837
|
+
id: entry.id,
|
|
838
|
+
parentId: entry.parentId,
|
|
839
|
+
timestamp: entry.timestamp,
|
|
840
|
+
type: entry.type,
|
|
841
|
+
...(entry.type === "message"
|
|
842
|
+
? {
|
|
843
|
+
message: {
|
|
844
|
+
role: entry.message.role,
|
|
845
|
+
...("content" in entry.message ? { content: entry.message.content } : {}),
|
|
846
|
+
},
|
|
847
|
+
}
|
|
848
|
+
: {}),
|
|
849
|
+
...(entry.type === "custom" ? { customType: entry.customType, data: entry.data } : {}),
|
|
850
|
+
}))),
|
|
851
|
+
exportArtifact: (request) => {
|
|
852
|
+
if (request.format !== "jsonl")
|
|
853
|
+
throw new Error(`Unsupported session export format: ${request.format}`);
|
|
854
|
+
return createSessionJsonlArtifact(this.sessionManager);
|
|
855
|
+
},
|
|
856
|
+
};
|
|
857
|
+
}
|
|
858
|
+
/** Return all currently loaded capability plugins without exposing private session state. */
|
|
859
|
+
getCapabilityPlugins() {
|
|
860
|
+
const handles = Array.from(this._capabilityPlugins.values());
|
|
861
|
+
for (const handle of [
|
|
862
|
+
this._bootstrapToolsHandle,
|
|
863
|
+
this._bootstrapSkillsHandle,
|
|
864
|
+
this._bootstrapRetryHandle,
|
|
865
|
+
this._bootstrapCompactionHandle,
|
|
866
|
+
this._bootstrapOverflowHandle,
|
|
867
|
+
this._bootstrapBranchSummaryHandle,
|
|
868
|
+
this._bootstrapLifecycleHandle,
|
|
869
|
+
]) {
|
|
870
|
+
if (handle)
|
|
871
|
+
handles.push(handle);
|
|
872
|
+
}
|
|
873
|
+
return handles;
|
|
874
|
+
}
|
|
875
|
+
/** Name of the externally selected context strategy, when configured. */
|
|
876
|
+
get contextStrategyName() {
|
|
877
|
+
return this._contextStrategyName;
|
|
878
|
+
}
|
|
879
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
880
|
+
_requireContextStrategy() {
|
|
881
|
+
return requireContextStrategy(this._internal);
|
|
882
|
+
}
|
|
883
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
884
|
+
_requireIdleContextOperation(operation) {
|
|
885
|
+
requireIdleContextOperation(this._internal, operation);
|
|
886
|
+
}
|
|
887
|
+
_beginContextTransitionFence() {
|
|
888
|
+
beginContextTransitionFence(this._internal);
|
|
889
|
+
}
|
|
890
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
891
|
+
_isContextTransitionCurrent(epoch, allowReload) {
|
|
892
|
+
return isContextTransitionCurrent(this._internal, epoch, allowReload);
|
|
893
|
+
}
|
|
894
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
895
|
+
_assertContextTransitionCurrent(epoch, allowReload) {
|
|
896
|
+
assertContextTransitionCurrent(this._internal, epoch, allowReload);
|
|
897
|
+
}
|
|
898
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
899
|
+
_enqueueContextTransition(operation, options) {
|
|
900
|
+
return enqueueContextTransition(this._internal, operation, options);
|
|
901
|
+
}
|
|
902
|
+
_copyContextMessages(value, strategyName, direction) {
|
|
903
|
+
return copyContextMessages(value, strategyName, direction);
|
|
904
|
+
}
|
|
905
|
+
/** Apply a persisted-context transition, including strategy-owned projections. */
|
|
906
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
907
|
+
async _applyContextTransition(messages, reason = "session_replace", signal, options) {
|
|
908
|
+
return applyContextTransition(this._internal, messages, reason, signal, options);
|
|
909
|
+
}
|
|
910
|
+
/** Notify observers only after the runtime context projection has been committed. */
|
|
911
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
912
|
+
async _dispatchContextReplacedLifecycle(reason, strategyName) {
|
|
913
|
+
await dispatchContextReplacedLifecycle(this._internal, reason, strategyName);
|
|
914
|
+
}
|
|
915
|
+
/** Deliver the finalized assistant response only after its session entry is committed. */
|
|
916
|
+
async _dispatchModelResponseLifecycle(message, entryId) {
|
|
917
|
+
await dispatchModelResponseLifecycle(this._internal, message, entryId);
|
|
918
|
+
}
|
|
919
|
+
/** Deliver the finalized tool result only after its session entry is committed. */
|
|
920
|
+
async _dispatchToolCommitLifecycle(message, entryId) {
|
|
921
|
+
await dispatchToolCommitLifecycle(this._internal, message, entryId);
|
|
922
|
+
}
|
|
923
|
+
/** Deliver the finalized tool result only after its session entry is committed. */
|
|
924
|
+
async _dispatchToolResultLifecycle(message, entryId) {
|
|
925
|
+
await dispatchToolResultLifecycle(this._internal, message, entryId);
|
|
926
|
+
}
|
|
927
|
+
/** Notify the rebuilt runtime only after all reload work has committed. */
|
|
928
|
+
async _dispatchSessionReloadLifecycle(generation) {
|
|
929
|
+
await dispatchSessionReloadLifecycle(this._internal, generation);
|
|
930
|
+
}
|
|
931
|
+
/** Snapshot the current session messages with the configured context strategy. */
|
|
932
|
+
async snapshotContext() {
|
|
933
|
+
return snapshotContext(this._internal);
|
|
934
|
+
}
|
|
935
|
+
/** Restore session messages from a strategy snapshot. */
|
|
936
|
+
async restoreContext(snapshot) {
|
|
937
|
+
return restoreContext(this._internal, snapshot);
|
|
938
|
+
}
|
|
939
|
+
/** Replace session messages through the configured context strategy. */
|
|
940
|
+
async replaceContext(context) {
|
|
941
|
+
return replaceContext(this._internal, context);
|
|
942
|
+
}
|
|
943
|
+
_restoreContextTransition(snapshot, reason, options) {
|
|
944
|
+
return restoreContextTransition(this._internal, snapshot, reason, options);
|
|
945
|
+
}
|
|
946
|
+
async _trackCapabilityPlugin(key, loaded, previousToolNames) {
|
|
947
|
+
try {
|
|
948
|
+
this._validateCapabilitySkillConflicts();
|
|
949
|
+
}
|
|
950
|
+
catch (error) {
|
|
951
|
+
await loaded.dispose();
|
|
952
|
+
throw error;
|
|
953
|
+
}
|
|
954
|
+
let disposed = false;
|
|
955
|
+
const handle = {
|
|
956
|
+
manifest: loaded.manifest,
|
|
957
|
+
api: loaded.api,
|
|
958
|
+
ready: loaded.ready,
|
|
959
|
+
dispose: async () => {
|
|
960
|
+
if (disposed)
|
|
961
|
+
return;
|
|
962
|
+
disposed = true;
|
|
963
|
+
// 卸载恢复链的中间 notify 是暂态(活跃名暂时缺席),挂起钩子内的可见
|
|
964
|
+
// 注册表刷新;恢复完成后在此按装卸边界语义兜底刷新一次。
|
|
965
|
+
this._suspendToolRegistryHookRefresh = true;
|
|
966
|
+
try {
|
|
967
|
+
await loaded.dispose();
|
|
968
|
+
}
|
|
969
|
+
finally {
|
|
970
|
+
this._suspendToolRegistryHookRefresh = false;
|
|
971
|
+
}
|
|
972
|
+
this._capabilityPlugins.delete(key);
|
|
973
|
+
this._inlineCapabilityPlugins.delete(key);
|
|
974
|
+
if (!this._isDisposingCapabilityPlugins) {
|
|
975
|
+
this._syncCapabilityTools();
|
|
976
|
+
this._refreshToolRegistry({ activeToolNames: this.getActiveToolNames() });
|
|
977
|
+
}
|
|
978
|
+
},
|
|
979
|
+
};
|
|
980
|
+
this._capabilityPlugins.set(key, handle);
|
|
981
|
+
this._syncCapabilityTools();
|
|
982
|
+
const newToolNames = this._capabilityRuntime.listTools()
|
|
983
|
+
// First-party domain tools (the S4 split moved every capability to
|
|
984
|
+
// `agent-forge.plugin.*`; `agent-forge.builtin.*` is the retired
|
|
985
|
+
// embedded id era) join the active surface under the same readonly
|
|
986
|
+
// narrowing as runtime-built tools: non-readonlySafe declarations
|
|
987
|
+
// stay off a readonly session (宪法 §6). Third-party plugins decide
|
|
988
|
+
// their own mode semantics.
|
|
989
|
+
.filter((tool) => this._capabilityMode !== "readonly" ||
|
|
990
|
+
(!tool.source.startsWith("agent-forge.builtin.") && !tool.source.startsWith("agent-forge.plugin.")) ||
|
|
991
|
+
tool.readonlySafe === true)
|
|
992
|
+
.map((tool) => tool.name)
|
|
993
|
+
.filter((name) => !previousToolNames.has(name));
|
|
994
|
+
this._refreshToolRegistry({
|
|
995
|
+
activeToolNames: [...this.getActiveToolNames(), ...newToolNames],
|
|
996
|
+
});
|
|
997
|
+
return handle;
|
|
998
|
+
}
|
|
999
|
+
/** Load an external capability manifest through the same runtime as first-party plugins. */
|
|
1000
|
+
async loadCapabilityPluginManifest(manifestPath, options) {
|
|
1001
|
+
const runtime = this._capabilityRuntime;
|
|
1002
|
+
// v8 ignore next -- capability runtime 恒由 _buildRuntime 创建,dispose 后不再调用,运行期恒存在
|
|
1003
|
+
if (!runtime)
|
|
1004
|
+
throw new Error("Capability runtime is not available");
|
|
1005
|
+
const resolvedManifestPath = resolve(this._cwd, manifestPath);
|
|
1006
|
+
if (this._capabilityPlugins.has(resolvedManifestPath)) {
|
|
1007
|
+
throw new Error(`Capability plugin manifest is already loaded: ${resolvedManifestPath}`);
|
|
1008
|
+
}
|
|
1009
|
+
const previousToolNames = new Set(runtime.listTools().map((tool) => tool.name));
|
|
1010
|
+
const loaded = await loadCapabilityPluginFromManifest(runtime, resolvedManifestPath, options);
|
|
1011
|
+
return this._trackCapabilityPlugin(resolvedManifestPath, loaded, previousToolNames);
|
|
1012
|
+
}
|
|
1013
|
+
/**
|
|
1014
|
+
* Load an in-memory capability plugin and attach its handle to this session.
|
|
1015
|
+
* This is useful for embedders and deterministic fixtures that already own a
|
|
1016
|
+
* validated manifest/factory pair; reload and dispose will release the handle.
|
|
1017
|
+
*/
|
|
1018
|
+
async loadCapabilityPlugin(manifest, factory) {
|
|
1019
|
+
const runtime = this._capabilityRuntime;
|
|
1020
|
+
// v8 ignore next -- capability runtime 恒由 _buildRuntime 创建,dispose 后不再调用,运行期恒存在
|
|
1021
|
+
if (!runtime)
|
|
1022
|
+
throw new Error("Capability runtime is not available");
|
|
1023
|
+
const key = `inline:${manifest.id}`;
|
|
1024
|
+
if (this._capabilityPlugins.has(key)) {
|
|
1025
|
+
throw new Error(`Capability plugin is already loaded in this session: ${manifest.id}`);
|
|
1026
|
+
}
|
|
1027
|
+
const previousToolNames = new Set(runtime.listTools().map((tool) => tool.name));
|
|
1028
|
+
const loaded = await loadCapabilityPluginRuntime(runtime, manifest, factory);
|
|
1029
|
+
this._inlineCapabilityPlugins.set(key, { manifest, factory });
|
|
1030
|
+
try {
|
|
1031
|
+
return await this._trackCapabilityPlugin(key, loaded, previousToolNames);
|
|
1032
|
+
}
|
|
1033
|
+
catch (error) {
|
|
1034
|
+
this._inlineCapabilityPlugins.delete(key);
|
|
1035
|
+
throw error;
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
/**
|
|
1039
|
+
* Get all configured tools with name, description, parameter schema, prompt guidelines, and source metadata.
|
|
1040
|
+
*/
|
|
1041
|
+
getAllTools() {
|
|
1042
|
+
return getAllTools(this._internal);
|
|
1043
|
+
}
|
|
1044
|
+
getToolDefinition(name) {
|
|
1045
|
+
return getToolDefinition(this._internal, name);
|
|
1046
|
+
}
|
|
1047
|
+
/**
|
|
1048
|
+
* Set active tools by name.
|
|
1049
|
+
* Only tools in the registry can be enabled. Unknown tool names are ignored.
|
|
1050
|
+
* Also rebuilds the system prompt to reflect the new tool set.
|
|
1051
|
+
* Changes take effect on the next agent turn.
|
|
1052
|
+
*/
|
|
1053
|
+
setActiveToolsByName(toolNames) {
|
|
1054
|
+
setActiveToolsByName(this._internal, toolNames);
|
|
1055
|
+
}
|
|
1056
|
+
/** Whether compaction or branch summarization is currently running */
|
|
1057
|
+
get isCompacting() {
|
|
1058
|
+
return (this._autoCompactionAbortController !== undefined ||
|
|
1059
|
+
this._compactionAbortController !== undefined ||
|
|
1060
|
+
this._branchSummaryAbortController !== undefined);
|
|
1061
|
+
}
|
|
1062
|
+
/** All messages including custom types like BashExecutionMessage */
|
|
1063
|
+
get messages() {
|
|
1064
|
+
return this.agent.state.messages;
|
|
1065
|
+
}
|
|
1066
|
+
/** Current steering mode */
|
|
1067
|
+
get steeringMode() {
|
|
1068
|
+
return this.agent.steeringMode;
|
|
1069
|
+
}
|
|
1070
|
+
/** Current follow-up mode */
|
|
1071
|
+
get followUpMode() {
|
|
1072
|
+
return this.agent.followUpMode;
|
|
1073
|
+
}
|
|
1074
|
+
/** Current session file path, or undefined if sessions are disabled */
|
|
1075
|
+
get sessionFile() {
|
|
1076
|
+
return this.sessionManager.getSessionFile();
|
|
1077
|
+
}
|
|
1078
|
+
/** Current session ID */
|
|
1079
|
+
get sessionId() {
|
|
1080
|
+
return this.sessionManager.getSessionId();
|
|
1081
|
+
}
|
|
1082
|
+
/**
|
|
1083
|
+
* /metrics 数据源共享 ref(config 原样透出;observability 插件工厂挂载时写入
|
|
1084
|
+
* plugin.getMetrics、dispose 时置空)。宿主(TUI/RPC)经它惰性解引用接进
|
|
1085
|
+
* 命令 options——空 = 插件未挂载。
|
|
1086
|
+
*/
|
|
1087
|
+
get observabilityGetMetricsRef() {
|
|
1088
|
+
return this._observabilityGetMetricsRef;
|
|
1089
|
+
}
|
|
1090
|
+
/** Current session display name, if set */
|
|
1091
|
+
get sessionName() {
|
|
1092
|
+
return this.sessionManager.getSessionName();
|
|
1093
|
+
}
|
|
1094
|
+
/** Durable revision host fact (SessionManager entry sequence) for session boundaries. */
|
|
1095
|
+
getRevision() {
|
|
1096
|
+
return this.sessionManager.getRevision();
|
|
1097
|
+
}
|
|
1098
|
+
/** Scoped models for cycling (from --models flag) */
|
|
1099
|
+
get scopedModels() {
|
|
1100
|
+
return getScopedModels(this._internal);
|
|
1101
|
+
}
|
|
1102
|
+
/** Update scoped models for cycling */
|
|
1103
|
+
setScopedModels(scopedModels) {
|
|
1104
|
+
setScopedModels(this._internal, scopedModels);
|
|
1105
|
+
}
|
|
1106
|
+
/** File-based prompt templates */
|
|
1107
|
+
get promptTemplates() {
|
|
1108
|
+
return this._resourceLoader.getPrompts().prompts;
|
|
1109
|
+
}
|
|
1110
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
1111
|
+
_normalizePromptSnippet(text) {
|
|
1112
|
+
return normalizePromptSnippet(text);
|
|
1113
|
+
}
|
|
1114
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
1115
|
+
_normalizePromptGuidelines(guidelines) {
|
|
1116
|
+
return normalizePromptGuidelines(guidelines);
|
|
1117
|
+
}
|
|
1118
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
1119
|
+
_rebuildSystemPrompt(toolNames) {
|
|
1120
|
+
return rebuildSystemPrompt(this._internal, toolNames);
|
|
1121
|
+
}
|
|
1122
|
+
// =========================================================================
|
|
1123
|
+
// Prompting
|
|
1124
|
+
// =========================================================================
|
|
1125
|
+
async _runAgentPrompt(messages) {
|
|
1126
|
+
return runPromptLoop(this._internal, messages);
|
|
1127
|
+
}
|
|
1128
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: called from test/coverage-branch-core3-agent-session-misc.test.ts via the private cast
|
|
1129
|
+
_handlePostAgentRun() {
|
|
1130
|
+
return postAgentRun(this._internal);
|
|
1131
|
+
}
|
|
1132
|
+
async _runInputHandlers(text, images, source) {
|
|
1133
|
+
// 输入门(扩展位盘点 A3,对称于工具门 beforeToolCall):先于
|
|
1134
|
+
// input.received@1——门决定输入是否被接受,received 是"已接受"输入的
|
|
1135
|
+
// 观察事实,被拒输入不派发。链序 = 注册序;改写喂给下一环与后续展开;
|
|
1136
|
+
// block 短路:派发 input.gate.blocked@1(facts only,文本不入信封)后
|
|
1137
|
+
// 以 reason 拒绝本次提交。无钩子时零开销直通(默认行为零变化)。
|
|
1138
|
+
const gateChain = this._capabilityRuntime?.getLoopHookChain("beforeInput") ?? [];
|
|
1139
|
+
let currentText = text;
|
|
1140
|
+
for (const link of gateChain) {
|
|
1141
|
+
const result = await link({ text: currentText, source });
|
|
1142
|
+
if (!result)
|
|
1143
|
+
continue;
|
|
1144
|
+
if (result.block === true) {
|
|
1145
|
+
const reason = typeof result.reason === "string" && result.reason.trim() !== "" ? result.reason : undefined;
|
|
1146
|
+
await dispatchInputGateBlockedLifecycle(this._internal, {
|
|
1147
|
+
source,
|
|
1148
|
+
textLength: currentText.length,
|
|
1149
|
+
reason,
|
|
1150
|
+
});
|
|
1151
|
+
throw new Error(reason === undefined ? "Input rejected by an input gate" : `Input rejected by an input gate: ${reason}`);
|
|
1152
|
+
}
|
|
1153
|
+
if ("text" in result && typeof result.text === "string") {
|
|
1154
|
+
currentText = result.text;
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
// input.received@1 is an after-commit observe event: the input text and
|
|
1158
|
+
// images never enter the envelope, and no interception result exists.
|
|
1159
|
+
void dispatchInputReceivedLifecycle(this._internal, { source, textLength: currentText.length });
|
|
1160
|
+
return { text: currentText, images };
|
|
1161
|
+
}
|
|
1162
|
+
/**
|
|
1163
|
+
* Send a prompt to the agent.
|
|
1164
|
+
* - Handles legacy and capability plugin commands immediately, even during streaming
|
|
1165
|
+
* - Expands file-based prompt templates by default
|
|
1166
|
+
* - During streaming, queues via steer() or followUp() based on streamingBehavior option
|
|
1167
|
+
* - Validates model and API key before sending (when not streaming)
|
|
1168
|
+
* @throws Error if streaming and no streamingBehavior specified
|
|
1169
|
+
* @throws Error if no model selected or no API key available (when not streaming)
|
|
1170
|
+
*/
|
|
1171
|
+
async prompt(text, options) {
|
|
1172
|
+
if (this._reloadInProgress) {
|
|
1173
|
+
throw new Error("Session reload in progress; prompts are unavailable");
|
|
1174
|
+
}
|
|
1175
|
+
const expandPromptTemplates = options?.expandPromptTemplates ?? true;
|
|
1176
|
+
const preflightResult = options?.preflightResult;
|
|
1177
|
+
let messages;
|
|
1178
|
+
try {
|
|
1179
|
+
// Handle plugin commands first (execute immediately, even during streaming).
|
|
1180
|
+
if (expandPromptTemplates && text.startsWith("/")) {
|
|
1181
|
+
const handled = await this._tryExecuteExtensionCommand(text);
|
|
1182
|
+
if (handled) {
|
|
1183
|
+
// Extension command executed, no prompt to send
|
|
1184
|
+
preflightResult?.(true);
|
|
1185
|
+
return { status: "done" };
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
if (this._compactionAbortController !== undefined) {
|
|
1189
|
+
throw new Error("Cannot submit a prompt while compaction is in progress. Wait for compaction to finish and retry.");
|
|
1190
|
+
}
|
|
1191
|
+
// Dispatch the input.gate chain, then the input.received facts (both
|
|
1192
|
+
// before skill/template expansion)
|
|
1193
|
+
const { text: currentText, images: currentImages } = await this._runInputHandlers(text, options?.images, options?.source ?? "interactive");
|
|
1194
|
+
// Expand skill commands (/skill:name args) and prompt templates (/template args)
|
|
1195
|
+
let expandedText = currentText;
|
|
1196
|
+
if (expandPromptTemplates) {
|
|
1197
|
+
expandedText = this._expandSkillCommand(expandedText);
|
|
1198
|
+
expandedText = expandPromptTemplate(expandedText, [...this.promptTemplates]);
|
|
1199
|
+
}
|
|
1200
|
+
// If streaming, queue via steer() or followUp() based on option
|
|
1201
|
+
if (this.isStreaming) {
|
|
1202
|
+
if (!options?.streamingBehavior) {
|
|
1203
|
+
throw new Error("Agent is already processing. Specify streamingBehavior ('steer' or 'followUp') to queue the message.");
|
|
1204
|
+
}
|
|
1205
|
+
if (options.streamingBehavior === "followUp") {
|
|
1206
|
+
await this._queueFollowUp(expandedText, currentImages);
|
|
1207
|
+
}
|
|
1208
|
+
else {
|
|
1209
|
+
await this._queueSteer(expandedText, currentImages);
|
|
1210
|
+
}
|
|
1211
|
+
preflightResult?.(true);
|
|
1212
|
+
return { status: "done" };
|
|
1213
|
+
}
|
|
1214
|
+
// Flush any pending bash and custom messages before the new prompt
|
|
1215
|
+
this._flushPendingBashMessages();
|
|
1216
|
+
this._flushPendingCustomMessages();
|
|
1217
|
+
// Validate model
|
|
1218
|
+
if (!this.model) {
|
|
1219
|
+
throw new Error(formatNoModelSelectedMessage());
|
|
1220
|
+
}
|
|
1221
|
+
const hasConfiguredAuth = this.agent.streamFunction !== streamSimple ||
|
|
1222
|
+
this._modelRuntime.hasConfiguredAuth(this.model.provider) ||
|
|
1223
|
+
(await this._modelRuntime.checkAuth(this.model.provider)) !== undefined;
|
|
1224
|
+
if (!hasConfiguredAuth) {
|
|
1225
|
+
const isOAuth = this._modelRuntime.isUsingOAuth(this.model.provider);
|
|
1226
|
+
if (isOAuth) {
|
|
1227
|
+
throw new Error(`Authentication failed for "${this.model.provider}". ` +
|
|
1228
|
+
`Credentials may have expired or network is unavailable. ` +
|
|
1229
|
+
`Run '/login ${this.model.provider}' to re-authenticate.`);
|
|
1230
|
+
}
|
|
1231
|
+
throw new Error(formatNoApiKeyFoundMessage(this.model.provider));
|
|
1232
|
+
}
|
|
1233
|
+
// Check if we need to compact before sending (catches aborted responses).
|
|
1234
|
+
// The user's new prompt is sent below, so do not call agent.continue() here.
|
|
1235
|
+
const lastAssistant = this._findLastAssistantMessage();
|
|
1236
|
+
if (lastAssistant) {
|
|
1237
|
+
await this._checkCompaction(lastAssistant, false);
|
|
1238
|
+
}
|
|
1239
|
+
// Build messages array (custom message if any, then user message)
|
|
1240
|
+
messages = [];
|
|
1241
|
+
// Add user message
|
|
1242
|
+
const userContent = [{ type: "text", text: expandedText }];
|
|
1243
|
+
if (currentImages) {
|
|
1244
|
+
userContent.push(...currentImages);
|
|
1245
|
+
}
|
|
1246
|
+
messages.push({
|
|
1247
|
+
role: "user",
|
|
1248
|
+
content: userContent,
|
|
1249
|
+
timestamp: Date.now(),
|
|
1250
|
+
});
|
|
1251
|
+
// Inject any pending "nextTurn" messages as context alongside the user message
|
|
1252
|
+
for (const msg of this._pendingNextTurnMessages) {
|
|
1253
|
+
messages.push(msg);
|
|
1254
|
+
}
|
|
1255
|
+
this._pendingNextTurnMessages = [];
|
|
1256
|
+
await dispatchBeforeAgentStartLifecycle(this._internal, (currentImages?.length ?? 0) > 0);
|
|
1257
|
+
// Reset to the base prompt (in case a previous turn had an override),
|
|
1258
|
+
// then apply the before.agent.start@2 candidate transform (capability
|
|
1259
|
+
// channel). A transform yielding a different systemPrompt is the later
|
|
1260
|
+
// writer and wins; a missing registration, a verbatim result, or a
|
|
1261
|
+
// failed delivery keeps the base prompt.
|
|
1262
|
+
this._systemPromptOverride = undefined;
|
|
1263
|
+
this.agent.state.systemPrompt = this._baseSystemPrompt;
|
|
1264
|
+
const capabilitySystemPrompt = await dispatchBeforeAgentStartV2Lifecycle(this._internal, this._baseSystemPrompt, this._baseSystemPromptOptions);
|
|
1265
|
+
if (capabilitySystemPrompt !== undefined) {
|
|
1266
|
+
this._systemPromptOverride = capabilitySystemPrompt;
|
|
1267
|
+
this.agent.state.systemPrompt = capabilitySystemPrompt;
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
catch (error) {
|
|
1271
|
+
preflightResult?.(false);
|
|
1272
|
+
throw error;
|
|
1273
|
+
}
|
|
1274
|
+
// v8 ignore next -- try 块内所有不发送路径均已提前 return,messages 必然已赋值
|
|
1275
|
+
if (!messages) {
|
|
1276
|
+
return { status: "done" };
|
|
1277
|
+
}
|
|
1278
|
+
preflightResult?.(true);
|
|
1279
|
+
return this._runAgentPrompt(messages);
|
|
1280
|
+
}
|
|
1281
|
+
/**
|
|
1282
|
+
* Try to execute a capability command. A cross-system name collision with a
|
|
1283
|
+
* prompt template or skill is always an explicit error.
|
|
1284
|
+
*/
|
|
1285
|
+
async _tryExecuteExtensionCommand(text) {
|
|
1286
|
+
// Parse command name and args
|
|
1287
|
+
const spaceIndex = text.indexOf(" ");
|
|
1288
|
+
const commandName = spaceIndex === -1 ? text.slice(1) : text.slice(1, spaceIndex);
|
|
1289
|
+
const args = spaceIndex === -1 ? "" : text.slice(spaceIndex + 1);
|
|
1290
|
+
const runtime = this._capabilityRuntime;
|
|
1291
|
+
if (runtime?.hasCommand(commandName)) {
|
|
1292
|
+
const templateConflict = this.promptTemplates.some((template) => template.name === commandName);
|
|
1293
|
+
const skillName = commandName.startsWith("skill:") ? commandName.slice("skill:".length) : undefined;
|
|
1294
|
+
const skillConflict = skillName !== undefined && this._getAvailableSkills().some((skill) => skill.name === skillName);
|
|
1295
|
+
if (templateConflict || skillConflict) {
|
|
1296
|
+
const source = templateConflict ? "prompt template" : "skill";
|
|
1297
|
+
throw new Error(`Command is registered by both CapabilityAPI and ${source}: ${commandName}`);
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
else {
|
|
1301
|
+
return false;
|
|
1302
|
+
}
|
|
1303
|
+
const source = runtime.listCommands().find(({ definition }) => definition.name === commandName)?.source ?? "unknown";
|
|
1304
|
+
const abortController = new AbortController();
|
|
1305
|
+
this._commandAbortController = abortController;
|
|
1306
|
+
const execute = async () => {
|
|
1307
|
+
const result = await runtime.invokeCommand(commandName, args, {
|
|
1308
|
+
signal: abortController.signal,
|
|
1309
|
+
cwd: this._cwd,
|
|
1310
|
+
});
|
|
1311
|
+
if (result !== undefined) {
|
|
1312
|
+
this._emit({
|
|
1313
|
+
type: "capability_command_result",
|
|
1314
|
+
command: commandName,
|
|
1315
|
+
source,
|
|
1316
|
+
result,
|
|
1317
|
+
});
|
|
1318
|
+
}
|
|
1319
|
+
};
|
|
1320
|
+
const commandExecution = execute();
|
|
1321
|
+
this._activeCapabilityCommand = commandExecution;
|
|
1322
|
+
try {
|
|
1323
|
+
await commandExecution;
|
|
1324
|
+
}
|
|
1325
|
+
finally {
|
|
1326
|
+
if (this._commandAbortController === abortController)
|
|
1327
|
+
this._commandAbortController = undefined;
|
|
1328
|
+
if (this._activeCapabilityCommand === commandExecution)
|
|
1329
|
+
this._activeCapabilityCommand = undefined;
|
|
1330
|
+
}
|
|
1331
|
+
return true;
|
|
1332
|
+
}
|
|
1333
|
+
/**
|
|
1334
|
+
* Expand skill commands (/skill:name args) to their full content.
|
|
1335
|
+
* Returns the expanded text, or the original text if not a skill command or skill not found.
|
|
1336
|
+
* Emits errors via extension runner if file read fails.
|
|
1337
|
+
*/
|
|
1338
|
+
_expandSkillCommand(text) {
|
|
1339
|
+
if (!text.startsWith("/skill:"))
|
|
1340
|
+
return text;
|
|
1341
|
+
const spaceIndex = text.indexOf(" ");
|
|
1342
|
+
const skillName = spaceIndex === -1 ? text.slice(7) : text.slice(7, spaceIndex);
|
|
1343
|
+
const args = spaceIndex === -1 ? "" : text.slice(spaceIndex + 1).trim();
|
|
1344
|
+
const skill = this._getAvailableSkills().find((s) => s.name === skillName);
|
|
1345
|
+
if (!skill)
|
|
1346
|
+
return text; // Unknown skill, pass through
|
|
1347
|
+
try {
|
|
1348
|
+
const content = readFileSync(skill.filePath, "utf-8");
|
|
1349
|
+
const body = stripFrontmatter(content).trim();
|
|
1350
|
+
const skillBlock = `<skill name="${skill.name}" location="${skill.filePath}">\nReferences are relative to ${skill.baseDir}.\n\n${body}\n</skill>`;
|
|
1351
|
+
return args ? `${skillBlock}\n\n${args}` : skillBlock;
|
|
1352
|
+
}
|
|
1353
|
+
catch (err) {
|
|
1354
|
+
// Report like command errors do: process log, non-fatal, original text kept.
|
|
1355
|
+
this._hostLogger?.error("session", "skill expansion failed", {
|
|
1356
|
+
...(this.sessionId === undefined ? {} : { sessionId: this.sessionId }),
|
|
1357
|
+
fields: { skill: skill.name, path: skill.filePath },
|
|
1358
|
+
cause: err,
|
|
1359
|
+
});
|
|
1360
|
+
return text; // Return original on error
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
async _queueUserInput(text, images, behavior, source) {
|
|
1364
|
+
const processedInput = await this._runInputHandlers(text, images, source);
|
|
1365
|
+
let expandedText = this._expandSkillCommand(processedInput.text);
|
|
1366
|
+
expandedText = expandPromptTemplate(expandedText, [...this.promptTemplates]);
|
|
1367
|
+
if (behavior === "steer") {
|
|
1368
|
+
await this._queueSteer(expandedText, processedInput.images);
|
|
1369
|
+
}
|
|
1370
|
+
else {
|
|
1371
|
+
await this._queueFollowUp(expandedText, processedInput.images);
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
/**
|
|
1375
|
+
* Queue a steering message while the agent is running.
|
|
1376
|
+
* Delivered after the current assistant turn finishes executing its tool calls,
|
|
1377
|
+
* before the next LLM call.
|
|
1378
|
+
* Expands skill commands and prompt templates. Errors on extension commands.
|
|
1379
|
+
* @param images Optional image attachments to include with the message
|
|
1380
|
+
* @param options Input source; defaults to interactive
|
|
1381
|
+
* @throws Error if text is an extension command
|
|
1382
|
+
*/
|
|
1383
|
+
async steer(text, images, options) {
|
|
1384
|
+
await this._queueUserInput(text, images, "steer", options?.source ?? "interactive");
|
|
1385
|
+
}
|
|
1386
|
+
/**
|
|
1387
|
+
* Queue a follow-up message to be processed after the agent finishes.
|
|
1388
|
+
* Delivered only when agent has no more tool calls or steering messages.
|
|
1389
|
+
* Expands skill commands and prompt templates. Errors on extension commands.
|
|
1390
|
+
* @param images Optional image attachments to include with the message
|
|
1391
|
+
* @param options Input source; defaults to interactive
|
|
1392
|
+
* @throws Error if text is an extension command
|
|
1393
|
+
*/
|
|
1394
|
+
async followUp(text, images, options) {
|
|
1395
|
+
await this._queueUserInput(text, images, "followUp", options?.source ?? "interactive");
|
|
1396
|
+
}
|
|
1397
|
+
/**
|
|
1398
|
+
* Internal: Queue a steering message (already expanded, no extension command check).
|
|
1399
|
+
*/
|
|
1400
|
+
async _queueSteer(text, images) {
|
|
1401
|
+
this._steeringMessages.push(text);
|
|
1402
|
+
this._emitQueueUpdate();
|
|
1403
|
+
const content = [{ type: "text", text }];
|
|
1404
|
+
if (images) {
|
|
1405
|
+
content.push(...images);
|
|
1406
|
+
}
|
|
1407
|
+
this.agent.steer({
|
|
1408
|
+
role: "user",
|
|
1409
|
+
content,
|
|
1410
|
+
timestamp: Date.now(),
|
|
1411
|
+
});
|
|
1412
|
+
}
|
|
1413
|
+
/**
|
|
1414
|
+
* Internal: Queue a follow-up message (already expanded, no extension command check).
|
|
1415
|
+
*/
|
|
1416
|
+
async _queueFollowUp(text, images) {
|
|
1417
|
+
this._followUpMessages.push(text);
|
|
1418
|
+
this._emitQueueUpdate();
|
|
1419
|
+
const content = [{ type: "text", text }];
|
|
1420
|
+
if (images) {
|
|
1421
|
+
content.push(...images);
|
|
1422
|
+
}
|
|
1423
|
+
this.agent.followUp({
|
|
1424
|
+
role: "user",
|
|
1425
|
+
content,
|
|
1426
|
+
timestamp: Date.now(),
|
|
1427
|
+
});
|
|
1428
|
+
}
|
|
1429
|
+
/**
|
|
1430
|
+
* Send a custom message to the session. Creates a CustomMessageEntry.
|
|
1431
|
+
*
|
|
1432
|
+
* Handles four cases:
|
|
1433
|
+
* - Streaming: queues message, processed when loop pulls from queue
|
|
1434
|
+
* - Streaming + triggerTurn false: appended to state/session once the current turn ends
|
|
1435
|
+
* - Not streaming + triggerTurn: appends to state/session, starts new turn
|
|
1436
|
+
* - Not streaming + no trigger: appends to state/session, no turn
|
|
1437
|
+
*
|
|
1438
|
+
* @param message Custom message with customType, content, display, details
|
|
1439
|
+
* @param options.triggerTurn If true and not streaming, triggers a new LLM turn
|
|
1440
|
+
* @param options.deliverAs Delivery mode: "steer", "followUp", or "nextTurn"
|
|
1441
|
+
*/
|
|
1442
|
+
async sendCustomMessage(message, options) {
|
|
1443
|
+
const appMessage = {
|
|
1444
|
+
role: "custom",
|
|
1445
|
+
customType: message.customType,
|
|
1446
|
+
// Untyped extensions can pass null/missing content; normalize at ingestion.
|
|
1447
|
+
content: message.content ?? [],
|
|
1448
|
+
display: message.display,
|
|
1449
|
+
details: message.details,
|
|
1450
|
+
timestamp: Date.now(),
|
|
1451
|
+
};
|
|
1452
|
+
if (options?.deliverAs === "nextTurn") {
|
|
1453
|
+
this._pendingNextTurnMessages.push(appMessage);
|
|
1454
|
+
}
|
|
1455
|
+
else if (this.isStreaming && options?.triggerTurn !== false) {
|
|
1456
|
+
if (options?.deliverAs === "followUp") {
|
|
1457
|
+
this.agent.followUp(appMessage);
|
|
1458
|
+
}
|
|
1459
|
+
else {
|
|
1460
|
+
this.agent.steer(appMessage);
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
else if (options?.triggerTurn) {
|
|
1464
|
+
await this._runAgentPrompt(appMessage);
|
|
1465
|
+
}
|
|
1466
|
+
else if (this.isStreaming) {
|
|
1467
|
+
// Appending now would put the message between an assistant tool call and its
|
|
1468
|
+
// result, which providers that validate message order reject on replay. Defer
|
|
1469
|
+
// to the end of the turn. Nothing is emitted yet: message events must not
|
|
1470
|
+
// describe messages the session tree does not contain.
|
|
1471
|
+
this._pendingCustomMessages.push(appMessage);
|
|
1472
|
+
}
|
|
1473
|
+
else {
|
|
1474
|
+
this._appendCustomMessage(appMessage);
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
_appendCustomMessage(appMessage) {
|
|
1478
|
+
this.agent.state.messages.push(appMessage);
|
|
1479
|
+
this.sessionManager.appendCustomMessageEntry(appMessage.customType, appMessage.content, appMessage.display, appMessage.details);
|
|
1480
|
+
this._emit({ type: "message_start", message: appMessage });
|
|
1481
|
+
this._emit({ type: "message_end", message: appMessage });
|
|
1482
|
+
}
|
|
1483
|
+
/**
|
|
1484
|
+
* Append custom messages queued while the agent was running.
|
|
1485
|
+
* Called once the current turn's tool results are in agent state and session history.
|
|
1486
|
+
*/
|
|
1487
|
+
_flushPendingCustomMessages() {
|
|
1488
|
+
if (this._pendingCustomMessages.length === 0)
|
|
1489
|
+
return;
|
|
1490
|
+
const pending = this._pendingCustomMessages;
|
|
1491
|
+
this._pendingCustomMessages = [];
|
|
1492
|
+
for (const appMessage of pending) {
|
|
1493
|
+
this._appendCustomMessage(appMessage);
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
/**
|
|
1497
|
+
* Send a user message to the agent. Always triggers a turn.
|
|
1498
|
+
* When the agent is streaming, use deliverAs to specify how to queue the message.
|
|
1499
|
+
*
|
|
1500
|
+
* @param content User message content (string or content array)
|
|
1501
|
+
* @param options.deliverAs Delivery mode when streaming: "steer" or "followUp"
|
|
1502
|
+
* @param options.expandPromptTemplates Whether to dispatch extension commands and expand skill commands and prompt templates. Default: false.
|
|
1503
|
+
*/
|
|
1504
|
+
async sendUserMessage(content, options) {
|
|
1505
|
+
// Normalize content to text string + optional images
|
|
1506
|
+
let text;
|
|
1507
|
+
let images;
|
|
1508
|
+
if (typeof content === "string") {
|
|
1509
|
+
text = content;
|
|
1510
|
+
}
|
|
1511
|
+
else {
|
|
1512
|
+
const textParts = [];
|
|
1513
|
+
images = [];
|
|
1514
|
+
for (const part of content) {
|
|
1515
|
+
if (part.type === "text") {
|
|
1516
|
+
textParts.push(part.text);
|
|
1517
|
+
}
|
|
1518
|
+
else {
|
|
1519
|
+
images.push(part);
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
text = textParts.join("\n");
|
|
1523
|
+
if (images.length === 0)
|
|
1524
|
+
images = undefined;
|
|
1525
|
+
}
|
|
1526
|
+
await this.prompt(text, {
|
|
1527
|
+
expandPromptTemplates: options?.expandPromptTemplates ?? false,
|
|
1528
|
+
streamingBehavior: options?.deliverAs,
|
|
1529
|
+
images,
|
|
1530
|
+
source: "extension",
|
|
1531
|
+
});
|
|
1532
|
+
}
|
|
1533
|
+
/**
|
|
1534
|
+
* Clear all queued messages and return them.
|
|
1535
|
+
* Useful for restoring to editor when user aborts.
|
|
1536
|
+
* @returns Object with steering and followUp arrays
|
|
1537
|
+
*/
|
|
1538
|
+
clearQueue() {
|
|
1539
|
+
const steering = [...this._steeringMessages];
|
|
1540
|
+
const followUp = [...this._followUpMessages];
|
|
1541
|
+
this._steeringMessages = [];
|
|
1542
|
+
this._followUpMessages = [];
|
|
1543
|
+
this.agent.clearAllQueues();
|
|
1544
|
+
this._emitQueueUpdate();
|
|
1545
|
+
return { steering, followUp };
|
|
1546
|
+
}
|
|
1547
|
+
/** Number of pending messages (includes both steering and follow-up) */
|
|
1548
|
+
get pendingMessageCount() {
|
|
1549
|
+
return this._steeringMessages.length + this._followUpMessages.length;
|
|
1550
|
+
}
|
|
1551
|
+
/** Get pending steering messages (read-only) */
|
|
1552
|
+
getSteeringMessages() {
|
|
1553
|
+
return this._steeringMessages;
|
|
1554
|
+
}
|
|
1555
|
+
/** Get pending follow-up messages (read-only) */
|
|
1556
|
+
getFollowUpMessages() {
|
|
1557
|
+
return this._followUpMessages;
|
|
1558
|
+
}
|
|
1559
|
+
get resourceLoader() {
|
|
1560
|
+
return this._resourceLoader;
|
|
1561
|
+
}
|
|
1562
|
+
/**
|
|
1563
|
+
* Why the active turn was aborted, following codex's TurnAbortReason
|
|
1564
|
+
* (protocol.rs:4173). The interruption marker's visible text stays fixed;
|
|
1565
|
+
* the reason rides the marker `details` for hosts and plugins.
|
|
1566
|
+
*/
|
|
1567
|
+
async abort(reason) {
|
|
1568
|
+
this._pendingAbortReason = reason ?? "interrupted";
|
|
1569
|
+
this._lastAbortReason = this._pendingAbortReason;
|
|
1570
|
+
// 级联取消子 agent 任务(D-044 §4.2):fire-and-forget,不阻塞父会话自身的 abort。
|
|
1571
|
+
this._agentTaskScopeAbortController.abort(reason ?? "interrupted");
|
|
1572
|
+
try {
|
|
1573
|
+
await this._abortInternal();
|
|
1574
|
+
this._appendTurnInterruptedMarker();
|
|
1575
|
+
}
|
|
1576
|
+
finally {
|
|
1577
|
+
this._pendingAbortReason = undefined;
|
|
1578
|
+
// epoch 刷新:旧 signal 已 spent,刷新后后续回合提交的任务绑到新信号,不会被立即取消。
|
|
1579
|
+
this._agentTaskScopeAbortController = new AbortController();
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
/**
|
|
1583
|
+
* Abort without the interruption marker; used by internal flows (compaction,
|
|
1584
|
+
* teardown) that abort for their own bookkeeping. Takes no reason: the abort
|
|
1585
|
+
* reason only exists where the marker is written.
|
|
1586
|
+
*/
|
|
1587
|
+
async _abortInternal() {
|
|
1588
|
+
this.abortRetry();
|
|
1589
|
+
this._policyDecisionAbortController?.abort("session aborted");
|
|
1590
|
+
this._commandAbortController?.abort("session aborted");
|
|
1591
|
+
this.abortCompaction();
|
|
1592
|
+
this.abortBranchSummary();
|
|
1593
|
+
this.abortBash();
|
|
1594
|
+
this.agent.abort();
|
|
1595
|
+
await this.waitForIdle();
|
|
1596
|
+
}
|
|
1597
|
+
/**
|
|
1598
|
+
* Append a model-visible marker after an abort that actually cut a turn
|
|
1599
|
+
* short. transform-messages drops the aborted assistant message on replay,
|
|
1600
|
+
* so without this marker the model has no way to learn that the
|
|
1601
|
+
* interruption happened. Tool calls skipped mid-batch already carry their
|
|
1602
|
+
* own persisted error results; this covers the streaming-interrupt case.
|
|
1603
|
+
* The text is intentionally fixed (codex keeps INTERRUPTED_GUIDANCE stable
|
|
1604
|
+
* across reasons); the abort reason rides `details` for host consumers.
|
|
1605
|
+
*/
|
|
1606
|
+
_appendTurnInterruptedMarker() {
|
|
1607
|
+
const messages = this.agent.state.messages;
|
|
1608
|
+
const last = messages[messages.length - 1];
|
|
1609
|
+
if (last?.role === "custom" && last.customType === "turn-interrupted") {
|
|
1610
|
+
return;
|
|
1611
|
+
}
|
|
1612
|
+
let lastAssistantAborted = false;
|
|
1613
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
1614
|
+
const message = messages[i];
|
|
1615
|
+
if (message.role === "assistant") {
|
|
1616
|
+
lastAssistantAborted = message.stopReason === "aborted";
|
|
1617
|
+
break;
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
if (!lastAssistantAborted) {
|
|
1621
|
+
return;
|
|
1622
|
+
}
|
|
1623
|
+
this._appendCustomMessage({
|
|
1624
|
+
role: "custom",
|
|
1625
|
+
customType: "turn-interrupted",
|
|
1626
|
+
content: "The previous turn was interrupted by the user before it completed.",
|
|
1627
|
+
display: false,
|
|
1628
|
+
details: this._pendingAbortReason === undefined ? undefined : { reason: this._pendingAbortReason },
|
|
1629
|
+
timestamp: Date.now(),
|
|
1630
|
+
});
|
|
1631
|
+
}
|
|
1632
|
+
async _abortActiveCapabilityCommand(reason) {
|
|
1633
|
+
this._commandAbortController?.abort(reason);
|
|
1634
|
+
await this._activeCapabilityCommand;
|
|
1635
|
+
}
|
|
1636
|
+
/**
|
|
1637
|
+
* Stop every operation that can still mutate session state before a reload
|
|
1638
|
+
* replaces the runtime. This deliberately does not call `abort()`: reload
|
|
1639
|
+
* must also wait for queued compaction and branch-summary work, while a
|
|
1640
|
+
* compaction itself calls `abort()` as part of its normal entry path.
|
|
1641
|
+
*/
|
|
1642
|
+
async _cancelAndDrainForReload() {
|
|
1643
|
+
this.abortRetry();
|
|
1644
|
+
this._policyDecisionAbortController?.abort("session reloaded");
|
|
1645
|
+
this._commandAbortController?.abort("session reloaded");
|
|
1646
|
+
this.abortCompaction();
|
|
1647
|
+
this.abortBranchSummary();
|
|
1648
|
+
this.abortBash();
|
|
1649
|
+
this.agent.abort();
|
|
1650
|
+
await Promise.allSettled([
|
|
1651
|
+
this._activeCapabilityCommand,
|
|
1652
|
+
this._activeCompactionPromise,
|
|
1653
|
+
this._branchSummaryPromise,
|
|
1654
|
+
this._activeContextTransition,
|
|
1655
|
+
...this._activeBashPromises,
|
|
1656
|
+
this.waitForIdle(),
|
|
1657
|
+
].filter((operation) => operation !== undefined));
|
|
1658
|
+
// The tail includes compactions that were enqueued just before the reload
|
|
1659
|
+
// barrier. They must settle before the old runtime is revoked.
|
|
1660
|
+
await this._compactionQueue.catch(() => undefined);
|
|
1661
|
+
}
|
|
1662
|
+
async waitForIdle() {
|
|
1663
|
+
if (this.isIdle) {
|
|
1664
|
+
return;
|
|
1665
|
+
}
|
|
1666
|
+
await this._getIdleWaitPromise();
|
|
1667
|
+
}
|
|
1668
|
+
// =========================================================================
|
|
1669
|
+
// Model Management
|
|
1670
|
+
// =========================================================================
|
|
1671
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
1672
|
+
async _emitModelSelect(nextModel, previousModel, source) {
|
|
1673
|
+
return emitModelSelect(this._internal, nextModel, previousModel, source);
|
|
1674
|
+
}
|
|
1675
|
+
/**
|
|
1676
|
+
* Set model directly.
|
|
1677
|
+
* Validates that auth is configured and saves to the session transcript.
|
|
1678
|
+
* Persists to global defaults only when options.persist is true.
|
|
1679
|
+
* @throws Error if no auth is configured for the model
|
|
1680
|
+
*/
|
|
1681
|
+
async setModel(model, options = {}) {
|
|
1682
|
+
return setModel(this._internal, model, options);
|
|
1683
|
+
}
|
|
1684
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
1685
|
+
_addPersistedDefaultToNonEmptyScope(model) {
|
|
1686
|
+
addPersistedDefaultToNonEmptyScope(this._internal, model);
|
|
1687
|
+
}
|
|
1688
|
+
/**
|
|
1689
|
+
* Cycle to next/previous model.
|
|
1690
|
+
* Uses scoped models (from --models flag) if available, otherwise all available models.
|
|
1691
|
+
* @param direction - "forward" (default) or "backward"
|
|
1692
|
+
* @returns The new model info, or undefined if only one model available
|
|
1693
|
+
*/
|
|
1694
|
+
async cycleModel(direction = "forward", options = {}) {
|
|
1695
|
+
return cycleModel(this._internal, direction, options);
|
|
1696
|
+
}
|
|
1697
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
1698
|
+
async _cycleScopedModel(direction, options) {
|
|
1699
|
+
return cycleScopedModel(this._internal, direction, options);
|
|
1700
|
+
}
|
|
1701
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
1702
|
+
async _cycleAvailableModel(direction, options) {
|
|
1703
|
+
return cycleAvailableModel(this._internal, direction, options);
|
|
1704
|
+
}
|
|
1705
|
+
// =========================================================================
|
|
1706
|
+
// Thinking Level Management
|
|
1707
|
+
// =========================================================================
|
|
1708
|
+
/**
|
|
1709
|
+
* Set thinking level.
|
|
1710
|
+
* Clamps to model capabilities based on available thinking levels.
|
|
1711
|
+
* Saves the clamped level to the session transcript only if the level actually changes.
|
|
1712
|
+
* Persists the requested level to global defaults only when options.persist is true.
|
|
1713
|
+
*/
|
|
1714
|
+
setThinkingLevel(level, options = {}) {
|
|
1715
|
+
const availableLevels = this.getAvailableThinkingLevels();
|
|
1716
|
+
const effectiveLevel = availableLevels.includes(level) ? level : this._clampThinkingLevel(level, availableLevels);
|
|
1717
|
+
// Only persist if actually changing
|
|
1718
|
+
const previousLevel = this.agent.state.thinkingLevel;
|
|
1719
|
+
const isChanging = effectiveLevel !== previousLevel;
|
|
1720
|
+
this.agent.state.thinkingLevel = effectiveLevel;
|
|
1721
|
+
if (options.persist) {
|
|
1722
|
+
this.settingsManager.setDefaultThinkingLevel(level);
|
|
1723
|
+
}
|
|
1724
|
+
if (isChanging) {
|
|
1725
|
+
this.sessionManager.appendThinkingLevelChange(effectiveLevel);
|
|
1726
|
+
this._emit({ type: "thinking_level_changed", level: effectiveLevel });
|
|
1727
|
+
void dispatchThinkingLevelSelectLifecycle(this._internal, effectiveLevel, previousLevel);
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
/**
|
|
1731
|
+
* Cycle to next thinking level.
|
|
1732
|
+
* @returns New level, or undefined if model doesn't support thinking
|
|
1733
|
+
*/
|
|
1734
|
+
cycleThinkingLevel(options = {}) {
|
|
1735
|
+
if (!this.supportsThinking())
|
|
1736
|
+
return undefined;
|
|
1737
|
+
const levels = this.getAvailableThinkingLevels();
|
|
1738
|
+
const currentIndex = levels.indexOf(this.thinkingLevel);
|
|
1739
|
+
const nextIndex = (currentIndex + 1) % levels.length;
|
|
1740
|
+
const nextLevel = levels[nextIndex];
|
|
1741
|
+
this.setThinkingLevel(nextLevel, options);
|
|
1742
|
+
return nextLevel;
|
|
1743
|
+
}
|
|
1744
|
+
/**
|
|
1745
|
+
* Get available thinking levels for current model.
|
|
1746
|
+
* The provider will clamp to what the specific model supports internally.
|
|
1747
|
+
*/
|
|
1748
|
+
getAvailableThinkingLevels() {
|
|
1749
|
+
if (!this.model)
|
|
1750
|
+
return [...THINKING_LEVEL_OPTIONS];
|
|
1751
|
+
return getSupportedThinkingLevels(this.model);
|
|
1752
|
+
}
|
|
1753
|
+
/**
|
|
1754
|
+
* Check if current model supports thinking/reasoning.
|
|
1755
|
+
*/
|
|
1756
|
+
supportsThinking() {
|
|
1757
|
+
return !!this.model?.reasoning;
|
|
1758
|
+
}
|
|
1759
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
1760
|
+
_getThinkingLevelForModelSwitch(targetModel, explicitLevel) {
|
|
1761
|
+
return getThinkingLevelForModelSwitch(this._internal, targetModel, explicitLevel);
|
|
1762
|
+
}
|
|
1763
|
+
_clampThinkingLevel(level, _availableLevels) {
|
|
1764
|
+
return this.model ? clampThinkingLevel(this.model, level) : "off";
|
|
1765
|
+
}
|
|
1766
|
+
// =========================================================================
|
|
1767
|
+
// Queue Mode Management
|
|
1768
|
+
// =========================================================================
|
|
1769
|
+
syncQueueModesFromSettings() {
|
|
1770
|
+
this.agent.steeringMode = this.settingsManager.getSteeringMode();
|
|
1771
|
+
this.agent.followUpMode = this.settingsManager.getFollowUpMode();
|
|
1772
|
+
}
|
|
1773
|
+
/**
|
|
1774
|
+
* Set steering message mode.
|
|
1775
|
+
* Saves to settings.
|
|
1776
|
+
*/
|
|
1777
|
+
setSteeringMode(mode) {
|
|
1778
|
+
this.agent.steeringMode = mode;
|
|
1779
|
+
this.settingsManager.setSteeringMode(mode);
|
|
1780
|
+
}
|
|
1781
|
+
/**
|
|
1782
|
+
* Set follow-up message mode.
|
|
1783
|
+
* Saves to settings.
|
|
1784
|
+
*/
|
|
1785
|
+
setFollowUpMode(mode) {
|
|
1786
|
+
this.agent.followUpMode = mode;
|
|
1787
|
+
this.settingsManager.setFollowUpMode(mode);
|
|
1788
|
+
}
|
|
1789
|
+
// =========================================================================
|
|
1790
|
+
// Compaction
|
|
1791
|
+
// =========================================================================
|
|
1792
|
+
/** Queue compaction work so canonical commit and runtime projection stay ordered. */
|
|
1793
|
+
_enqueueCompaction(operation) {
|
|
1794
|
+
return enqueueCompaction(this._internal, operation);
|
|
1795
|
+
}
|
|
1796
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
1797
|
+
_observeLifecycleDeliveryError(error, extensionPath, event) {
|
|
1798
|
+
observeLifecycleDeliveryError(this._internal, error, extensionPath, event);
|
|
1799
|
+
}
|
|
1800
|
+
/**
|
|
1801
|
+
* Manually compact the session context.
|
|
1802
|
+
*
|
|
1803
|
+
* This is the manual entry point used by `/compact`, RPC, and extensions. It is
|
|
1804
|
+
* separate from automatic threshold/overflow compaction, which enters through
|
|
1805
|
+
* `_checkCompaction()` and `_runAutoCompaction()`. After preparation and the
|
|
1806
|
+
* `session_before_compact` hook, both paths use the selected compaction policy
|
|
1807
|
+
* unless the hook cancels or supplies a custom result, then commit the result
|
|
1808
|
+
* against the revision captured for that branch.
|
|
1809
|
+
*
|
|
1810
|
+
* Aborts the current agent operation first. Manual compaction never retries or
|
|
1811
|
+
* continues the interrupted agent turn.
|
|
1812
|
+
*
|
|
1813
|
+
* @param customInstructions Optional instructions for the compaction summary
|
|
1814
|
+
*/
|
|
1815
|
+
async compact(customInstructions) {
|
|
1816
|
+
if (this._reloadInProgress) {
|
|
1817
|
+
throw new Error("Session reload in progress; compaction is unavailable");
|
|
1818
|
+
}
|
|
1819
|
+
return this._enqueueCompaction(() => this._compactInternal(customInstructions));
|
|
1820
|
+
}
|
|
1821
|
+
_compactInternal(customInstructions) {
|
|
1822
|
+
return compactInternal(this._internal, customInstructions);
|
|
1823
|
+
}
|
|
1824
|
+
/**
|
|
1825
|
+
* Cancel in-progress compaction (manual or auto).
|
|
1826
|
+
*/
|
|
1827
|
+
abortCompaction() {
|
|
1828
|
+
this._compactionAbortController?.abort();
|
|
1829
|
+
this._autoCompactionAbortController?.abort();
|
|
1830
|
+
}
|
|
1831
|
+
/**
|
|
1832
|
+
* Cancel in-progress branch summarization.
|
|
1833
|
+
*/
|
|
1834
|
+
abortBranchSummary() {
|
|
1835
|
+
this._branchSummaryAbortController?.abort();
|
|
1836
|
+
}
|
|
1837
|
+
/**
|
|
1838
|
+
* Dispatch automatic compaction after `agent_end` or before prompt submission.
|
|
1839
|
+
* Manual compaction does not call this method; it enters through `compact()`.
|
|
1840
|
+
*
|
|
1841
|
+
* Automatic cases:
|
|
1842
|
+
* 1. Overflow with retry: a context-overflow error or recoverable length stop;
|
|
1843
|
+
* remove the failed assistant message, compact, and retry the turn once.
|
|
1844
|
+
* 2. Overflow without retry: a successful response exceeded the configured
|
|
1845
|
+
* context window; compact but preserve the completed response.
|
|
1846
|
+
* 3. Threshold without retry: valid or estimated context usage crossed the
|
|
1847
|
+
* configured threshold; compact without retrying the completed response.
|
|
1848
|
+
*
|
|
1849
|
+
* Each case calls `_runAutoCompaction()`. After preparation and the
|
|
1850
|
+
* `session_before_compact` hook, that method calls the lower-level `compact()`
|
|
1851
|
+
* function imported from `./compaction/index.ts`, unless the hook cancels or
|
|
1852
|
+
* supplies a custom result.
|
|
1853
|
+
*
|
|
1854
|
+
* @param assistantMessage The assistant message to check
|
|
1855
|
+
* @param skipAbortedCheck If false, include aborted messages (for pre-prompt check). Default: true
|
|
1856
|
+
* @returns Whether the post-run loop should call `agent.continue()` for overflow recovery or queued messages
|
|
1857
|
+
*/
|
|
1858
|
+
_checkCompaction(assistantMessage, skipAbortedCheck = true, signal) {
|
|
1859
|
+
return checkCompaction(this._internal, assistantMessage, skipAbortedCheck, signal);
|
|
1860
|
+
}
|
|
1861
|
+
/**
|
|
1862
|
+
* Execute threshold or overflow compaction. Manual compaction uses
|
|
1863
|
+
* `AgentSession.compact()` instead. Both paths use the selected compaction
|
|
1864
|
+
* policy after preparation and extension interception, then commit against the
|
|
1865
|
+
* branch revision captured before asynchronous work.
|
|
1866
|
+
*
|
|
1867
|
+
* @param reason Automatic trigger selected by `_checkCompaction()`
|
|
1868
|
+
* @param willRetry Whether to continue the interrupted turn after overflow compaction
|
|
1869
|
+
* @returns Whether the post-run loop should call `agent.continue()`
|
|
1870
|
+
*/
|
|
1871
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
1872
|
+
_runAutoCompaction(reason, willRetry) {
|
|
1873
|
+
return runAutoCompaction(this._internal, reason, willRetry);
|
|
1874
|
+
}
|
|
1875
|
+
/**
|
|
1876
|
+
* Toggle auto-compaction setting.
|
|
1877
|
+
*/
|
|
1878
|
+
setAutoCompactionEnabled(enabled) {
|
|
1879
|
+
this.settingsManager.setCompactionEnabled(enabled);
|
|
1880
|
+
}
|
|
1881
|
+
/** Whether auto-compaction is enabled */
|
|
1882
|
+
get autoCompactionEnabled() {
|
|
1883
|
+
return this.settingsManager.getCompactionEnabled();
|
|
1884
|
+
}
|
|
1885
|
+
/**
|
|
1886
|
+
* Run the session-start boundary: dispatch session.start@1 to the capability
|
|
1887
|
+
* runtime and run the resource discovery pass (contributed skills/prompts/
|
|
1888
|
+
* themes). Hosts await this once after constructing (or rebinding to) a
|
|
1889
|
+
* session, before the first prompt.
|
|
1890
|
+
*/
|
|
1891
|
+
async startSession() {
|
|
1892
|
+
await dispatchSessionStartLifecycle(this._internal, this._sessionStartEvent.reason, this._sessionStartEvent.previousSessionFile);
|
|
1893
|
+
await this.extendResourcesFromExtensions(this._sessionStartEvent.reason === "reload" ? "reload" : "startup");
|
|
1894
|
+
}
|
|
1895
|
+
async extendResourcesFromExtensions(reason) {
|
|
1896
|
+
return extendResourcesFromExtensions(this._internal, reason);
|
|
1897
|
+
}
|
|
1898
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
1899
|
+
buildExtensionResourcePaths(entries) {
|
|
1900
|
+
return buildExtensionResourcePaths(this._internal, entries);
|
|
1901
|
+
}
|
|
1902
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
1903
|
+
getExtensionSourceLabel(extensionPath) {
|
|
1904
|
+
return getExtensionSourceLabel(extensionPath);
|
|
1905
|
+
}
|
|
1906
|
+
_refreshToolRegistry(options) {
|
|
1907
|
+
refreshToolRegistry(this._internal, options);
|
|
1908
|
+
}
|
|
1909
|
+
_syncCapabilityTools() {
|
|
1910
|
+
syncCapabilityTools(this._internal);
|
|
1911
|
+
}
|
|
1912
|
+
_getCapabilitySkills() {
|
|
1913
|
+
return getCapabilitySkills(this._internal);
|
|
1914
|
+
}
|
|
1915
|
+
_getAvailableSkills() {
|
|
1916
|
+
const capabilitySkills = this._getCapabilitySkills();
|
|
1917
|
+
return capabilitySkills.length > 0 ? capabilitySkills : this._resourceLoader.getSkills().skills;
|
|
1918
|
+
}
|
|
1919
|
+
_validateCapabilitySkillConflicts() {
|
|
1920
|
+
validateCapabilitySkillConflicts(this._internal);
|
|
1921
|
+
}
|
|
1922
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
1923
|
+
_refreshBootstrapSkills() {
|
|
1924
|
+
return refreshBootstrapSkills(this._internal);
|
|
1925
|
+
}
|
|
1926
|
+
async _disposeCapabilityPlugins() {
|
|
1927
|
+
const handles = Array.from(this._capabilityPlugins.values());
|
|
1928
|
+
this._isDisposingCapabilityPlugins = true;
|
|
1929
|
+
const errors = [];
|
|
1930
|
+
try {
|
|
1931
|
+
for (const handle of handles) {
|
|
1932
|
+
try {
|
|
1933
|
+
await handle.dispose();
|
|
1934
|
+
}
|
|
1935
|
+
catch (error) {
|
|
1936
|
+
errors.push(error);
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
finally {
|
|
1941
|
+
this._isDisposingCapabilityPlugins = false;
|
|
1942
|
+
}
|
|
1943
|
+
if (errors.length === 1)
|
|
1944
|
+
throw errors[0];
|
|
1945
|
+
if (errors.length > 1)
|
|
1946
|
+
throw new AggregateError(errors, "Capability plugin disposal failed");
|
|
1947
|
+
}
|
|
1948
|
+
/**
|
|
1949
|
+
* 插件日志记录 → 宿主进程日志(会话轨迹第 2 期,设计 §7.2):HostLogger 是
|
|
1950
|
+
* debug/info/warn/error 四方法(无泛用 log),按记录级别映射调用;级别门槛由
|
|
1951
|
+
* logger 自身过滤("级别沿用宿主日志级别门槛")。src 用 pluginId(宿主日志的
|
|
1952
|
+
* 来源标记位);sessionId 随行。LoggerRecord 当前无已填充的 correlationId
|
|
1953
|
+
* (recordLog 不写该字段),不编造 traceId。
|
|
1954
|
+
*/
|
|
1955
|
+
_forwardLogRecordToHost(record) {
|
|
1956
|
+
const hostLogger = this._hostLogger;
|
|
1957
|
+
if (!hostLogger)
|
|
1958
|
+
return;
|
|
1959
|
+
const context = {
|
|
1960
|
+
...(record.sessionId === undefined ? {} : { sessionId: record.sessionId }),
|
|
1961
|
+
...(record.fields === undefined ? {} : { fields: record.fields }),
|
|
1962
|
+
...(record.cause === undefined ? {} : { cause: record.cause }),
|
|
1963
|
+
};
|
|
1964
|
+
switch (record.level) {
|
|
1965
|
+
case "debug":
|
|
1966
|
+
hostLogger.debug(record.pluginId, record.message, context);
|
|
1967
|
+
break;
|
|
1968
|
+
case "info":
|
|
1969
|
+
hostLogger.info(record.pluginId, record.message, context);
|
|
1970
|
+
break;
|
|
1971
|
+
case "warn":
|
|
1972
|
+
hostLogger.warn(record.pluginId, record.message, context);
|
|
1973
|
+
break;
|
|
1974
|
+
case "error":
|
|
1975
|
+
hostLogger.error(record.pluginId, record.message, context);
|
|
1976
|
+
break;
|
|
1977
|
+
}
|
|
1978
|
+
}
|
|
1979
|
+
_buildRuntime(options) {
|
|
1980
|
+
// 对齐 context transition 控制器的替换模式:runtime 重建时刷新 parent
|
|
1981
|
+
// 取消栅栏,防止 reload 后新 runtime 的任务绑到旧 spent 信号被立即取消。
|
|
1982
|
+
this._agentTaskScopeAbortController = new AbortController();
|
|
1983
|
+
const autoResizeImages = this.settingsManager.getImageAutoResize();
|
|
1984
|
+
const shellCommandPrefix = this.settingsManager.getShellCommandPrefix();
|
|
1985
|
+
const shellPath = this.settingsManager.getShellPath();
|
|
1986
|
+
this._capabilityRuntime = createCapabilityRuntime({
|
|
1987
|
+
apiVersion: EXPERIMENTAL_PUBLIC_API_VERSION,
|
|
1988
|
+
mode: this._capabilityMode,
|
|
1989
|
+
// D-075 S4 second batch: the host agent dir rides the public
|
|
1990
|
+
// HostCapabilities so disk-state plugins resolve their config files.
|
|
1991
|
+
...(this._agentDir === undefined ? {} : { agentDir: this._agentDir }),
|
|
1992
|
+
// D-075 S4 third batch: the subagent delegation host services ride
|
|
1993
|
+
// the public HostCapabilities (communication wiring, turn-scoped
|
|
1994
|
+
// digest/correlation context, suite role associations) — the same
|
|
1995
|
+
// facts the embedded builtin used to receive as constructor options.
|
|
1996
|
+
...(this._communication === undefined ? {} : { communication: this._communication }),
|
|
1997
|
+
...(this._turnContext === undefined ? {} : { turnContext: this._turnContext }),
|
|
1998
|
+
...(this._roleAssociations === undefined ? {} : { roleAssociations: this._roleAssociations }),
|
|
1999
|
+
// D-075 S4 fourth batch: the memory storage injection face rides
|
|
2000
|
+
// the public HostCapabilities — the first-party memory plugin
|
|
2001
|
+
// binds these components in place of its built-in defaults.
|
|
2002
|
+
...(this._memoryStorage === undefined ? {} : { memoryStorage: this._memoryStorage }),
|
|
2003
|
+
features: [
|
|
2004
|
+
"tools",
|
|
2005
|
+
"skills",
|
|
2006
|
+
"logger-v1",
|
|
2007
|
+
"diagnostics-v1",
|
|
2008
|
+
"plugin-state-v1",
|
|
2009
|
+
"runtime-inspector-v1",
|
|
2010
|
+
"retry-policy",
|
|
2011
|
+
"compaction-policy",
|
|
2012
|
+
"overflow-policy",
|
|
2013
|
+
"events",
|
|
2014
|
+
"operations",
|
|
2015
|
+
"rpc",
|
|
2016
|
+
"context",
|
|
2017
|
+
"provider-headers",
|
|
2018
|
+
"credentials",
|
|
2019
|
+
"commands",
|
|
2020
|
+
"session",
|
|
2021
|
+
"session-revision-v1",
|
|
2022
|
+
"session-export",
|
|
2023
|
+
"output-artifacts",
|
|
2024
|
+
...(this._agentTaskAdapter || this._agentSessionReader || this._agentSessionLister ? ["agents"] : []),
|
|
2025
|
+
...(this._agentTaskResults ? ["agent-result-replay-v1"] : []),
|
|
2026
|
+
...(this._agentComposition ? ["agent-composition-v1"] : []),
|
|
2027
|
+
...(this._interactionHost ? ["interaction"] : []),
|
|
2028
|
+
],
|
|
2029
|
+
transports: ["in-process"],
|
|
2030
|
+
}, {
|
|
2031
|
+
...(this._agentTaskAdapter ? { agents: this._agentTaskAdapter } : {}),
|
|
2032
|
+
...(this._agentTaskResults ? { agentResults: this._agentTaskResults } : {}),
|
|
2033
|
+
...(this._agentSessionReader ? { agentSessionReader: this._agentSessionReader } : {}),
|
|
2034
|
+
...(this._agentSessionLister ? { agentSessionLister: this._agentSessionLister } : {}),
|
|
2035
|
+
...(this._agentComposition ? { composition: this._agentComposition } : {}),
|
|
2036
|
+
...(this._interactionHost ? { interaction: this._interactionHost } : {}),
|
|
2037
|
+
parentSignal: () => this._agentTaskScopeAbortController.signal,
|
|
2038
|
+
...(this._traceService === undefined ? {} : { trace: this._traceService }),
|
|
2039
|
+
...(this._modelRuntime
|
|
2040
|
+
? {
|
|
2041
|
+
modelRuntime: {
|
|
2042
|
+
getModelFacts: () => {
|
|
2043
|
+
const model = this.agent.state.model;
|
|
2044
|
+
if (!model)
|
|
2045
|
+
return undefined;
|
|
2046
|
+
return {
|
|
2047
|
+
provider: model.provider,
|
|
2048
|
+
id: model.id,
|
|
2049
|
+
contextWindow: model.contextWindow ?? 0,
|
|
2050
|
+
maxTokens: model.maxTokens ?? 0,
|
|
2051
|
+
reasoning: model.reasoning ?? false,
|
|
2052
|
+
};
|
|
2053
|
+
},
|
|
2054
|
+
invoke: async (input, options) => {
|
|
2055
|
+
const model = this.agent.state.model;
|
|
2056
|
+
if (!model)
|
|
2057
|
+
throw new Error("No model is set on this session's agent");
|
|
2058
|
+
const authResult = await this._modelRuntime.getAuth(model, {
|
|
2059
|
+
...(options?.signal === undefined ? {} : { signal: options.signal }),
|
|
2060
|
+
});
|
|
2061
|
+
const requestModel = authResult?.auth.baseUrl
|
|
2062
|
+
? { ...model, baseUrl: authResult.auth.baseUrl }
|
|
2063
|
+
: model;
|
|
2064
|
+
const context = {
|
|
2065
|
+
...(input.systemPrompt === undefined ? {} : { systemPrompt: input.systemPrompt }),
|
|
2066
|
+
messages: [
|
|
2067
|
+
{
|
|
2068
|
+
role: "user",
|
|
2069
|
+
content: [{ type: "text", text: input.prompt }],
|
|
2070
|
+
timestamp: Date.now(),
|
|
2071
|
+
},
|
|
2072
|
+
],
|
|
2073
|
+
};
|
|
2074
|
+
const requestOptions = {
|
|
2075
|
+
...(input.maxTokens === undefined ? {} : { maxTokens: input.maxTokens }),
|
|
2076
|
+
...(input.thinkingLevel && input.thinkingLevel !== "off" && model.reasoning
|
|
2077
|
+
? { reasoning: input.thinkingLevel }
|
|
2078
|
+
: {}),
|
|
2079
|
+
...(authResult?.auth.apiKey === undefined ? {} : { apiKey: authResult.auth.apiKey }),
|
|
2080
|
+
...(authResult?.auth.headers === undefined ? {} : { headers: authResult.auth.headers }),
|
|
2081
|
+
...(authResult?.env === undefined ? {} : { env: authResult.env }),
|
|
2082
|
+
...(options?.signal === undefined ? {} : { signal: options.signal }),
|
|
2083
|
+
};
|
|
2084
|
+
const stream = await this.agent.streamFunction(requestModel, context, requestOptions);
|
|
2085
|
+
const response = await stream.result();
|
|
2086
|
+
if (response.stopReason === "aborted")
|
|
2087
|
+
return { version: 1, status: "aborted" };
|
|
2088
|
+
if (response.stopReason === "error")
|
|
2089
|
+
return {
|
|
2090
|
+
version: 1,
|
|
2091
|
+
status: "failed",
|
|
2092
|
+
error: {
|
|
2093
|
+
code: "summary_provider_error",
|
|
2094
|
+
message: response.errorMessage ?? "Unknown error",
|
|
2095
|
+
},
|
|
2096
|
+
};
|
|
2097
|
+
if (response.stopReason === "length")
|
|
2098
|
+
return {
|
|
2099
|
+
version: 1,
|
|
2100
|
+
status: "failed",
|
|
2101
|
+
error: { code: "summary_length_cap", message: "generation hit the token cap" },
|
|
2102
|
+
};
|
|
2103
|
+
const text = response.content
|
|
2104
|
+
.filter((block) => block.type === "text")
|
|
2105
|
+
.map((block) => block.text)
|
|
2106
|
+
.join("");
|
|
2107
|
+
return { version: 1, status: "completed", text, usage: response.usage };
|
|
2108
|
+
},
|
|
2109
|
+
},
|
|
2110
|
+
}
|
|
2111
|
+
: {}),
|
|
2112
|
+
onOutputArtifactCommit: this._dispatchOutputArtifactCommit,
|
|
2113
|
+
// 工具表变更钩子:runtime 侧任何工具表变更(含同名替换/恢复)后,先重
|
|
2114
|
+
// 同步会话基础工具定义,再刷新可见注册表——运行期注册/替换/恢复随即
|
|
2115
|
+
// 对 getToolDefinition 与模型面可见、可被 setActiveToolsByName 激活;
|
|
2116
|
+
// 不自动加入活动集(激活权留给调用方)。两道门(见
|
|
2117
|
+
// _suspendToolRegistryHookRefresh/_toolRegistryHookReady 的注释)内
|
|
2118
|
+
// 整体跳过,由构造尾部与装卸边界兜底。
|
|
2119
|
+
onToolRegistryChange: () => {
|
|
2120
|
+
if (this._suspendToolRegistryHookRefresh || !this._toolRegistryHookReady)
|
|
2121
|
+
return;
|
|
2122
|
+
this._syncCapabilityTools();
|
|
2123
|
+
this._refreshToolRegistry({ activeToolNames: this.getActiveToolNames() });
|
|
2124
|
+
},
|
|
2125
|
+
// 运行时 invoke 面传给工具 execute 的第二参上下文(cwd 与命令面同源)。
|
|
2126
|
+
toolExecutionContext: { cwd: this._cwd },
|
|
2127
|
+
// 插件日志宿主 sink(会话轨迹第 2 期,设计 §7.2):先经装配域共享 ref
|
|
2128
|
+
// 镜像进轨迹(observability 插件工厂写入,空 = 无镜像),再按级别落
|
|
2129
|
+
// 宿主进程日志(无 hostLogger 时为 no-op)。runtime 侧对回调抛错自吞,
|
|
2130
|
+
// 这里不再叠加容错。
|
|
2131
|
+
...(this._hostLogger === undefined && this._logRecordMirrorRef === undefined
|
|
2132
|
+
? {}
|
|
2133
|
+
: {
|
|
2134
|
+
onLogRecord: (record) => {
|
|
2135
|
+
this._logRecordMirrorRef?.current?.(record);
|
|
2136
|
+
this._forwardLogRecordToHost(record);
|
|
2137
|
+
},
|
|
2138
|
+
}),
|
|
2139
|
+
credentials: {
|
|
2140
|
+
resolve: async ({ providerId, minValidityMs, signal }) => {
|
|
2141
|
+
const result = await this._modelRuntime.getAuth(providerId, {
|
|
2142
|
+
signal,
|
|
2143
|
+
...(minValidityMs === undefined ? {} : { minOAuthValidityMs: minValidityMs }),
|
|
2144
|
+
});
|
|
2145
|
+
if (!result)
|
|
2146
|
+
return undefined;
|
|
2147
|
+
return {
|
|
2148
|
+
...(result.auth.apiKey === undefined ? {} : { apiKey: result.auth.apiKey }),
|
|
2149
|
+
headers: { ...(result.auth.headers ?? {}) },
|
|
2150
|
+
...(result.auth.baseUrl === undefined ? {} : { baseUrl: result.auth.baseUrl }),
|
|
2151
|
+
...(result.source === undefined ? {} : { source: result.source }),
|
|
2152
|
+
};
|
|
2153
|
+
},
|
|
2154
|
+
},
|
|
2155
|
+
session: this.getSessionAPI(),
|
|
2156
|
+
});
|
|
2157
|
+
// Bootstrap 插件家族(宪法 §1/§7):随产品内嵌、默认安装,但必须可禁用且
|
|
2158
|
+
// 独立失败——任一件装载抛错走 D-028 结构化 rejection + 进程日志,不阻断
|
|
2159
|
+
// 会话构造,也不伪装成内核失败。
|
|
2160
|
+
const disabledBootstrap = this._disabledBootstrapPlugins;
|
|
2161
|
+
const capabilityRuntime = this._capabilityRuntime;
|
|
2162
|
+
const installBootstrap = (pluginId, install) => {
|
|
2163
|
+
if (disabledBootstrap?.includes(pluginId))
|
|
2164
|
+
return;
|
|
2165
|
+
try {
|
|
2166
|
+
install();
|
|
2167
|
+
}
|
|
2168
|
+
catch (error) {
|
|
2169
|
+
this._hostLogger?.error("session", "bootstrap plugin load failed", {
|
|
2170
|
+
fields: { pluginId },
|
|
2171
|
+
cause: error,
|
|
2172
|
+
});
|
|
2173
|
+
void capabilityRuntime
|
|
2174
|
+
.recordPluginRejection(Object.freeze({
|
|
2175
|
+
code: "plugin_load_failed",
|
|
2176
|
+
manifestPath: "<embedded>",
|
|
2177
|
+
pluginId,
|
|
2178
|
+
message: error instanceof Error ? error.message : String(error),
|
|
2179
|
+
}))
|
|
2180
|
+
.catch(() => {
|
|
2181
|
+
// Rejection visibility must never fail the remaining startup path.
|
|
2182
|
+
});
|
|
2183
|
+
}
|
|
2184
|
+
};
|
|
2185
|
+
installBootstrap(BOOTSTRAP_LIFECYCLE_PLUGIN_ID, () => installBootstrapLifecycle(capabilityRuntime));
|
|
2186
|
+
installBootstrap(BOOTSTRAP_AGENT_LOOP_PLUGIN_ID, () => installBootstrapAgentLoop(capabilityRuntime, this._createLoopWiring()));
|
|
2187
|
+
installBootstrap(BOOTSTRAP_TOOLS_PLUGIN_ID, () => installSessionBootstrapTools(capabilityRuntime, this._cwd, {
|
|
2188
|
+
read: { autoResizeImages },
|
|
2189
|
+
bash: { commandPrefix: shellCommandPrefix, shellPath },
|
|
2190
|
+
mode: this._capabilityMode,
|
|
2191
|
+
}, this._baseToolsOverride));
|
|
2192
|
+
this._syncCapabilityTools();
|
|
2193
|
+
installBootstrap(BOOTSTRAP_SKILLS_PLUGIN_ID, () => {
|
|
2194
|
+
// refreshBootstrapSkills keys off this handle to decide refresh vs
|
|
2195
|
+
// install; dropping it would double-install on the first refresh.
|
|
2196
|
+
this._bootstrapSkillsHandle = installSessionBootstrapSkills(capabilityRuntime, this._resourceLoader.getSkills().skills);
|
|
2197
|
+
return this._bootstrapSkillsHandle;
|
|
2198
|
+
});
|
|
2199
|
+
installBootstrap(BOOTSTRAP_RETRY_PLUGIN_ID, () => installBootstrapRetryPolicy(capabilityRuntime));
|
|
2200
|
+
installBootstrap(BOOTSTRAP_OVERFLOW_PLUGIN_ID, () => installBootstrapOverflowPolicy(capabilityRuntime));
|
|
2201
|
+
installBootstrap(BOOTSTRAP_COMPACTION_PLUGIN_ID, () => installBootstrapCompactionPolicy(capabilityRuntime));
|
|
2202
|
+
installBootstrap(BOOTSTRAP_BRANCH_SUMMARY_PLUGIN_ID, () => installBootstrapBranchSummaryPolicy(capabilityRuntime));
|
|
2203
|
+
// The embedded builtin capability channel (方案系统 M3) is retired: the
|
|
2204
|
+
// last embedded capability (memory) moved to its own package in D-075
|
|
2205
|
+
// S4 fourth batch, so every suite capability now assembles through the
|
|
2206
|
+
// installed-plugin path (session.loadCapabilityPluginManifest) and
|
|
2207
|
+
// nothing loads here.
|
|
2208
|
+
this._syncCapabilityTools();
|
|
2209
|
+
// First-party capability activation (统一修复轮 B): readonly capabilityMode
|
|
2210
|
+
// narrows the first-party tool face by the OWNING PLUGIN's declaration
|
|
2211
|
+
// (宪法 §6): first-party tools stay on the active surface only when their
|
|
2212
|
+
// definition declares `readonlySafe`. The first-party domain covers both
|
|
2213
|
+
// naming eras — the retired embedded `agent-forge.builtin.*` ids and the
|
|
2214
|
+
// `agent-forge.plugin.*` package ids every capability moved to in the S4
|
|
2215
|
+
// split (D-075). The plugins stay installed — protocol entries, RPC
|
|
2216
|
+
// methods, and events are untouched; only the model tool face is narrowed.
|
|
2217
|
+
// Third-party plugin tools keep their existing semantics: whether they
|
|
2218
|
+
// respect the mode is the plugin's own declaration and the user's choice.
|
|
2219
|
+
const builtinToolNames = this._capabilityRuntime
|
|
2220
|
+
.listTools()
|
|
2221
|
+
.filter((tool) => this._capabilityMode !== "readonly" ||
|
|
2222
|
+
!tool.source.startsWith("agent-forge.builtin.") ||
|
|
2223
|
+
tool.readonlySafe === true)
|
|
2224
|
+
.filter((tool) => this._capabilityMode !== "readonly" ||
|
|
2225
|
+
!tool.source.startsWith("agent-forge.plugin.") ||
|
|
2226
|
+
tool.readonlySafe === true)
|
|
2227
|
+
.map((tool) => tool.name);
|
|
2228
|
+
const defaultActiveToolNames = this._baseToolsOverride
|
|
2229
|
+
? Object.keys(this._baseToolsOverride)
|
|
2230
|
+
: this._capabilityMode === "readonly"
|
|
2231
|
+
? // Derive from declarations: the readonly install path registers
|
|
2232
|
+
// exactly the declared-safe definitions, so the kernel carries no
|
|
2233
|
+
// per-tool name knowledge for the readonly face.
|
|
2234
|
+
this._capabilityRuntime
|
|
2235
|
+
.listTools()
|
|
2236
|
+
.filter((tool) => tool.readonlySafe)
|
|
2237
|
+
.map((tool) => tool.name)
|
|
2238
|
+
: ["read", "bash", "edit", "write"];
|
|
2239
|
+
// Builtin capability tools join the active surface like externally
|
|
2240
|
+
// loaded plugin tools do (_trackCapabilityPlugin); the allowlist /
|
|
2241
|
+
// denylist filters below still gate them.
|
|
2242
|
+
const baseActiveToolNames = [...(options.activeToolNames ?? defaultActiveToolNames), ...builtinToolNames];
|
|
2243
|
+
this._refreshToolRegistry({
|
|
2244
|
+
activeToolNames: baseActiveToolNames,
|
|
2245
|
+
includeAllExtensionTools: options.includeAllExtensionTools,
|
|
2246
|
+
});
|
|
2247
|
+
// Runtime 装配与首次同步(上方显式 sync + refresh)完成后,工具表变更钩子
|
|
2248
|
+
// 才开始驱动会话侧同步;构造期通知全部跳过(见 _toolRegistryHookReady)。
|
|
2249
|
+
this._toolRegistryHookReady = true;
|
|
2250
|
+
}
|
|
2251
|
+
async reload(options) {
|
|
2252
|
+
if (this._reloadInProgress)
|
|
2253
|
+
throw new Error("Session reload is already in progress");
|
|
2254
|
+
this._reloadInProgress = true;
|
|
2255
|
+
this._beginContextTransitionFence();
|
|
2256
|
+
this._bashEpoch += 1;
|
|
2257
|
+
let committedGeneration;
|
|
2258
|
+
try {
|
|
2259
|
+
await this._cancelAndDrainForReload();
|
|
2260
|
+
const oldCapabilityRuntime = this._capabilityRuntime;
|
|
2261
|
+
const contextStrategyName = this._contextStrategyName;
|
|
2262
|
+
let contextSnapshot;
|
|
2263
|
+
let hasContextSnapshot = false;
|
|
2264
|
+
if (contextStrategyName) {
|
|
2265
|
+
if (!oldCapabilityRuntime?.hasContextStrategy(contextStrategyName)) {
|
|
2266
|
+
throw new Error(`Configured context strategy is not registered: ${contextStrategyName}`);
|
|
2267
|
+
}
|
|
2268
|
+
contextSnapshot = await oldCapabilityRuntime.snapshotContext(contextStrategyName, this._copyContextMessages(this.agent.state.messages, contextStrategyName, "input"), { reason: "reload", sessionId: this.sessionId });
|
|
2269
|
+
hasContextSnapshot = true;
|
|
2270
|
+
}
|
|
2271
|
+
const capabilityPluginPaths = Array.from(this._capabilityPlugins.keys()).filter((key) => !this._inlineCapabilityPlugins.has(key));
|
|
2272
|
+
const inlineCapabilityPlugins = Array.from(this._inlineCapabilityPlugins.values());
|
|
2273
|
+
await this._disposeCapabilityPlugins();
|
|
2274
|
+
oldCapabilityRuntime?.revokeAllAPIs();
|
|
2275
|
+
await oldCapabilityRuntime?.disposeAll();
|
|
2276
|
+
const agentTaskAdapter = this._agentTaskAdapter;
|
|
2277
|
+
await agentTaskAdapter?.dispose?.();
|
|
2278
|
+
const interactionHost = this._interactionHost;
|
|
2279
|
+
await interactionHost?.dispose?.();
|
|
2280
|
+
await this._bootstrapToolsHandle?.dispose();
|
|
2281
|
+
this._bootstrapToolsHandle = undefined;
|
|
2282
|
+
await this._bootstrapSkillsHandle?.dispose();
|
|
2283
|
+
this._bootstrapSkillsHandle = undefined;
|
|
2284
|
+
await this._bootstrapRetryHandle?.dispose();
|
|
2285
|
+
this._bootstrapRetryHandle = undefined;
|
|
2286
|
+
await this._bootstrapOverflowHandle?.dispose();
|
|
2287
|
+
this._bootstrapOverflowHandle = undefined;
|
|
2288
|
+
await this._bootstrapCompactionHandle?.dispose();
|
|
2289
|
+
this._bootstrapCompactionHandle = undefined;
|
|
2290
|
+
await this._bootstrapBranchSummaryHandle?.dispose();
|
|
2291
|
+
this._bootstrapBranchSummaryHandle = undefined;
|
|
2292
|
+
await this._bootstrapAgentLoopHandle?.dispose();
|
|
2293
|
+
this._bootstrapAgentLoopHandle = undefined;
|
|
2294
|
+
await this._bootstrapLifecycleHandle?.dispose();
|
|
2295
|
+
this._bootstrapLifecycleHandle = undefined;
|
|
2296
|
+
await this.settingsManager.reload();
|
|
2297
|
+
this.syncQueueModesFromSettings();
|
|
2298
|
+
// NOTE: reload must not call resetApiProviders(). The API provider
|
|
2299
|
+
// registry is process-global shared state; one session reloading must
|
|
2300
|
+
// never silently unregister providers owned by other sessions or hosts.
|
|
2301
|
+
await this._resourceLoader.reload();
|
|
2302
|
+
this._buildRuntime({
|
|
2303
|
+
activeToolNames: this.getActiveToolNames(),
|
|
2304
|
+
includeAllExtensionTools: true,
|
|
2305
|
+
});
|
|
2306
|
+
for (const manifestPath of capabilityPluginPaths) {
|
|
2307
|
+
await this.loadCapabilityPluginManifest(manifestPath);
|
|
2308
|
+
}
|
|
2309
|
+
for (const { manifest, factory } of inlineCapabilityPlugins) {
|
|
2310
|
+
await this.loadCapabilityPlugin(manifest, factory);
|
|
2311
|
+
}
|
|
2312
|
+
if (contextStrategyName && hasContextSnapshot) {
|
|
2313
|
+
const runtime = this._capabilityRuntime;
|
|
2314
|
+
if (!runtime?.hasContextStrategy(contextStrategyName)) {
|
|
2315
|
+
throw new Error(`Configured context strategy is not registered after reload: ${contextStrategyName}`);
|
|
2316
|
+
}
|
|
2317
|
+
await this._restoreContextTransition(contextSnapshot, "reload", { allowReload: true });
|
|
2318
|
+
}
|
|
2319
|
+
await options?.beforeSessionStart?.();
|
|
2320
|
+
await dispatchSessionStartLifecycle(this._internal, "reload");
|
|
2321
|
+
await this.extendResourcesFromExtensions("reload");
|
|
2322
|
+
committedGeneration = this._reloadGeneration + 1;
|
|
2323
|
+
this._reloadGeneration = committedGeneration;
|
|
2324
|
+
}
|
|
2325
|
+
finally {
|
|
2326
|
+
this._reloadInProgress = false;
|
|
2327
|
+
}
|
|
2328
|
+
if (committedGeneration === undefined)
|
|
2329
|
+
throw new Error("Session reload did not commit a generation");
|
|
2330
|
+
await this._dispatchSessionReloadLifecycle(committedGeneration);
|
|
2331
|
+
}
|
|
2332
|
+
// =========================================================================
|
|
2333
|
+
// Auto-Retry
|
|
2334
|
+
// =========================================================================
|
|
2335
|
+
/**
|
|
2336
|
+
* Check if an error is retryable (overloaded, rate limit, server errors).
|
|
2337
|
+
* Context overflow errors are NOT retryable (handled by compaction instead).
|
|
2338
|
+
*/
|
|
2339
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
2340
|
+
_isRetryableError(message, execution, signal) {
|
|
2341
|
+
return isRetryableError(this._internal, message, execution, signal);
|
|
2342
|
+
}
|
|
2343
|
+
/**
|
|
2344
|
+
* Prepare a retryable error for continuation with exponential backoff.
|
|
2345
|
+
* @returns true if the caller should continue the agent, false otherwise
|
|
2346
|
+
*/
|
|
2347
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: read and written via the agent-session-* submodule facade
|
|
2348
|
+
_prepareRetry(message, precomputedDecision) {
|
|
2349
|
+
return prepareRetry(this._internal, message, precomputedDecision);
|
|
2350
|
+
}
|
|
2351
|
+
/**
|
|
2352
|
+
* Cancel in-progress retry.
|
|
2353
|
+
*/
|
|
2354
|
+
abortRetry() {
|
|
2355
|
+
this._retryAbortController?.abort();
|
|
2356
|
+
}
|
|
2357
|
+
/** Whether auto-retry is currently in progress */
|
|
2358
|
+
get isRetrying() {
|
|
2359
|
+
return this._retryAbortController !== undefined;
|
|
2360
|
+
}
|
|
2361
|
+
/** Whether auto-retry is enabled */
|
|
2362
|
+
get autoRetryEnabled() {
|
|
2363
|
+
return this.settingsManager.getRetryEnabled();
|
|
2364
|
+
}
|
|
2365
|
+
/**
|
|
2366
|
+
* Toggle auto-retry setting.
|
|
2367
|
+
*/
|
|
2368
|
+
setAutoRetryEnabled(enabled) {
|
|
2369
|
+
this.settingsManager.setRetryEnabled(enabled);
|
|
2370
|
+
}
|
|
2371
|
+
// =========================================================================
|
|
2372
|
+
// Bash Execution
|
|
2373
|
+
// =========================================================================
|
|
2374
|
+
/** Capture a mode-level bash epoch for an intercepted user_bash result. */
|
|
2375
|
+
captureBashEpoch() {
|
|
2376
|
+
return captureBashEpoch(this._internal);
|
|
2377
|
+
}
|
|
2378
|
+
/** Return whether a mode-level bash result still belongs to this runtime epoch. */
|
|
2379
|
+
isBashEpochCurrent(epoch) {
|
|
2380
|
+
return isBashEpochCurrent(this._internal, epoch);
|
|
2381
|
+
}
|
|
2382
|
+
/** Dispatch the user.bash lifecycle facts for a `!`/`!!` user bash command. */
|
|
2383
|
+
emitUserBash(excludeFromContext) {
|
|
2384
|
+
emitUserBash(this._internal, excludeFromContext);
|
|
2385
|
+
}
|
|
2386
|
+
/**
|
|
2387
|
+
* Execute a bash command.
|
|
2388
|
+
* Adds result to agent context and session.
|
|
2389
|
+
* @param command The bash command to execute
|
|
2390
|
+
* @param onChunk Optional streaming callback for output
|
|
2391
|
+
* @param options.excludeFromContext If true, command output won't be sent to LLM (!! prefix)
|
|
2392
|
+
* @param options.id Optional identifier included in bash execution update events
|
|
2393
|
+
* @param options.operations Custom BashOperations for remote execution
|
|
2394
|
+
*/
|
|
2395
|
+
async executeBash(command, onChunk, options) {
|
|
2396
|
+
return executeBash(this._internal, command, onChunk, options);
|
|
2397
|
+
}
|
|
2398
|
+
/**
|
|
2399
|
+
* Record a bash execution result in session history.
|
|
2400
|
+
* Used by executeBash and by extensions that handle bash execution themselves.
|
|
2401
|
+
*/
|
|
2402
|
+
recordBashResult(command, result, options) {
|
|
2403
|
+
recordBashResult(this._internal, command, result, options);
|
|
2404
|
+
}
|
|
2405
|
+
/**
|
|
2406
|
+
* Cancel running bash command.
|
|
2407
|
+
*/
|
|
2408
|
+
abortBash() {
|
|
2409
|
+
abortBash(this._internal);
|
|
2410
|
+
}
|
|
2411
|
+
/** Whether a bash command is currently running */
|
|
2412
|
+
get isBashRunning() {
|
|
2413
|
+
return this._bashAbortControllers.size > 0;
|
|
2414
|
+
}
|
|
2415
|
+
/** Whether there are pending bash messages waiting to be flushed */
|
|
2416
|
+
get hasPendingBashMessages() {
|
|
2417
|
+
return this._pendingBashMessages.length > 0;
|
|
2418
|
+
}
|
|
2419
|
+
/**
|
|
2420
|
+
* Flush pending bash messages to agent state and session.
|
|
2421
|
+
* Called after agent turn completes to maintain proper message ordering.
|
|
2422
|
+
*/
|
|
2423
|
+
_flushPendingBashMessages() {
|
|
2424
|
+
flushPendingBashMessages(this._internal);
|
|
2425
|
+
}
|
|
2426
|
+
// =========================================================================
|
|
2427
|
+
// Session Management
|
|
2428
|
+
// =========================================================================
|
|
2429
|
+
/**
|
|
2430
|
+
* Set a display name for the current session.
|
|
2431
|
+
*/
|
|
2432
|
+
setSessionName(name) {
|
|
2433
|
+
this.sessionManager.appendSessionInfo(name);
|
|
2434
|
+
const event = { type: "session_info_changed", name: this.sessionManager.getSessionName() };
|
|
2435
|
+
this._emit(event);
|
|
2436
|
+
void dispatchSessionInfoChangedLifecycle(this._internal, event.name);
|
|
2437
|
+
}
|
|
2438
|
+
/**
|
|
2439
|
+
* Record a cross-suite resume (设计 §10.1 最小可用版): the session was created
|
|
2440
|
+
* under `originalSuiteId` but its context is being reassembled under
|
|
2441
|
+
* `currentSuiteId` (assembly happens at session creation, so reassembly is
|
|
2442
|
+
* the existing behavior). Appends a `suite_mismatch` custom entry as session
|
|
2443
|
+
* protocol data so later debugging can trace the switch; context
|
|
2444
|
+
* serialization/conversion is explicitly out of scope.
|
|
2445
|
+
*/
|
|
2446
|
+
recordSuiteMismatch(originalSuiteId, currentSuiteId) {
|
|
2447
|
+
this.sessionManager.appendCustomEntry(SUITE_MISMATCH_SESSION_ENTRY_TYPE, {
|
|
2448
|
+
originalSuiteId,
|
|
2449
|
+
currentSuiteId,
|
|
2450
|
+
});
|
|
2451
|
+
}
|
|
2452
|
+
// =========================================================================
|
|
2453
|
+
// Tree Navigation
|
|
2454
|
+
// =========================================================================
|
|
2455
|
+
/**
|
|
2456
|
+
* Navigate to a different node in the session tree.
|
|
2457
|
+
* Unlike fork() which creates a new session file, this stays in the same file.
|
|
2458
|
+
*
|
|
2459
|
+
* @param targetId The entry ID to navigate to
|
|
2460
|
+
* @param options.summarize Whether user wants to summarize abandoned branch
|
|
2461
|
+
* @param options.customInstructions Custom instructions for summarizer
|
|
2462
|
+
* @param options.replaceInstructions If true, customInstructions replaces the default prompt
|
|
2463
|
+
* @param options.label Label to attach to the branch summary entry
|
|
2464
|
+
* @returns Result with editorText (if user message) and cancelled status
|
|
2465
|
+
*/
|
|
2466
|
+
async navigateTree(targetId, options = {}) {
|
|
2467
|
+
return navigateTree(this._internal, targetId, options);
|
|
2468
|
+
}
|
|
2469
|
+
/**
|
|
2470
|
+
* Get all user messages from session for fork selector.
|
|
2471
|
+
*/
|
|
2472
|
+
getUserMessagesForForking() {
|
|
2473
|
+
return getUserMessagesForForking(this._internal);
|
|
2474
|
+
}
|
|
2475
|
+
/**
|
|
2476
|
+
* Get session statistics. Aggregates over ALL session entries (including
|
|
2477
|
+
* history that was compacted away), so token/cost totals reflect what was
|
|
2478
|
+
* actually billed across the session.
|
|
2479
|
+
*/
|
|
2480
|
+
getSessionStats() {
|
|
2481
|
+
return getSessionStats(this._internal);
|
|
2482
|
+
}
|
|
2483
|
+
getContextUsage() {
|
|
2484
|
+
return getContextUsage(this._internal);
|
|
2485
|
+
}
|
|
2486
|
+
/**
|
|
2487
|
+
* Export session to HTML.
|
|
2488
|
+
* @param outputPath Optional output path (defaults to session directory)
|
|
2489
|
+
* @param options Optional export presentation settings
|
|
2490
|
+
* @returns Path to exported file
|
|
2491
|
+
*/
|
|
2492
|
+
async exportToHtml(outputPath, options = {}) {
|
|
2493
|
+
return await exportToHtml(this._internal, outputPath, options);
|
|
2494
|
+
}
|
|
2495
|
+
/**
|
|
2496
|
+
* Export the current session branch to a JSONL file.
|
|
2497
|
+
* Writes the session header followed by all entries on the current branch path.
|
|
2498
|
+
* @param outputPath Target file path. If omitted, generates a timestamped file in cwd.
|
|
2499
|
+
* @returns The resolved output file path.
|
|
2500
|
+
*/
|
|
2501
|
+
exportToJsonl(outputPath) {
|
|
2502
|
+
return exportToJsonl(this._internal, outputPath);
|
|
2503
|
+
}
|
|
2504
|
+
// =========================================================================
|
|
2505
|
+
// Utilities
|
|
2506
|
+
// =========================================================================
|
|
2507
|
+
/**
|
|
2508
|
+
* Get text content of last assistant message.
|
|
2509
|
+
* Useful for /copy command.
|
|
2510
|
+
* @returns Text content, or undefined if no assistant message exists
|
|
2511
|
+
*/
|
|
2512
|
+
getLastAssistantText() {
|
|
2513
|
+
return getLastAssistantText(this._internal);
|
|
2514
|
+
}
|
|
2515
|
+
// =========================================================================
|
|
2516
|
+
// Extension System
|
|
2517
|
+
// =========================================================================
|
|
2518
|
+
createReplacedSessionContext() {
|
|
2519
|
+
return {
|
|
2520
|
+
sendMessage: (message, options) => this.sendCustomMessage(message, options),
|
|
2521
|
+
sendUserMessage: (content, options) => this.sendUserMessage(content, options),
|
|
2522
|
+
};
|
|
2523
|
+
}
|
|
2524
|
+
/** Curated host surface (1B.7c): the only supported raw-integration point for product hosts. */
|
|
2525
|
+
get host() {
|
|
2526
|
+
const agent = this.agent;
|
|
2527
|
+
const sessionManager = this.sessionManager;
|
|
2528
|
+
return {
|
|
2529
|
+
get abortSignal() {
|
|
2530
|
+
return agent.signal;
|
|
2531
|
+
},
|
|
2532
|
+
get cwd() {
|
|
2533
|
+
return sessionManager.getCwd();
|
|
2534
|
+
},
|
|
2535
|
+
get sessionName() {
|
|
2536
|
+
return sessionManager.getSessionName();
|
|
2537
|
+
},
|
|
2538
|
+
get entries() {
|
|
2539
|
+
return sessionManager.getEntries();
|
|
2540
|
+
},
|
|
2541
|
+
setTransport: (transport) => {
|
|
2542
|
+
agent.transport = transport;
|
|
2543
|
+
},
|
|
2544
|
+
abortAgent: () => {
|
|
2545
|
+
agent.abort();
|
|
2546
|
+
},
|
|
2547
|
+
};
|
|
2548
|
+
}
|
|
2549
|
+
}
|
|
2550
|
+
//# sourceMappingURL=agent-session.js.map
|