@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 @@
|
|
|
1
|
+
{"version":3,"file":"suite-loader.js","sourceRoot":"","sources":["../../src/profiles/suite-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC1F,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAI/C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAElF,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAM1E,OAAO,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAG9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,wBAAwB,EACxB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EAEpB,kBAAkB,GAClB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAC;AACxC,MAAM,CAAC,MAAM,uBAAuB,GAAG,YAAY,CAAC;AACpD,MAAM,CAAC,MAAM,wBAAwB,GAAG,WAAW,CAAC;AACpD,MAAM,CA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AAC,OAAO,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;SAC1D,CAAC,CAAC;IACJ,OAAO;QACN,QAAQ;QACR,IAAI;QACJ,GAAG,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC;QACvD,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC;KACvC,CAAC;AAAA,CACF","sourcesContent":["/**\n * Suite workspace location, lazy provisioning, and assembly (方案系统设计.md v2\n * §4/§5/§8/§9/§11/§12, M1a).\n *\n * The loader is the assembler layer of the suite system: it resolves the\n * active suite id (explicit > AGENT_FORGE_SUITE > project settings > global\n * settings > \"assistant\"), provisions the builtin suite workspaces under\n * `<agentDir>/suites/<id>/`, assembles the agents.md three-level chain\n * (system -> suite -> project, 设计 §8), gates the global SYSTEM.md/\n * APPEND_SYSTEM.md system prompt channel by inheritSystemAgentsMd (设计 §4:\n * the project-level `<cwd>/.agent-forge/` layer always passes), and bridges\n * the assembled suite onto the existing ProfileIdentityV1/ProfileLock\n * mechanisms. The project level of the chain is delegated to the existing\n * resource loader — the ancestor chain logic itself is never reimplemented\n * here.\n */\nimport { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { join, resolve, sep } from \"node:path\";\nimport type { JsonValue } from \"@agent-forge/ai\";\nimport { CONFIG_DIR_NAME } from \"../config.ts\";\nimport type { ResourceDiagnostic } from \"../core/diagnostics.ts\";\nimport type { SettingsManager } from \"../core/settings-manager.ts\";\nimport type { Skill } from \"../core/skills.ts\";\nimport { loadSkills } from \"../core/skills.ts\";\nimport type { HostFactsV1 } from \"../plugins/ecosystem/types.ts\";\nimport type { ProfileIdentityV1 } from \"../profile/identity.ts\";\nimport { buildProfileIdentityV1, stableJsonDigest } from \"../profile/identity.ts\";\nimport type { ProfileLockV1, ProfileLockVerificationV1 } from \"../profile/lock.ts\";\nimport { createProfileLock, verifyProfileLock } from \"../profile/lock.ts\";\nimport type {\n\tBuiltinPluginManifestOverridesV1,\n\tBuiltinPluginProfileIdV1,\n\tBuiltinPluginProfileResolutionV1,\n} from \"../profile/plugin-profiles.ts\";\nimport { resolveBuiltinPluginProfileV1 } from \"../profile/plugin-profiles.ts\";\nimport type { VerifiedToolPluginV1 } from \"../profile/profile-assembly.ts\";\nimport type { RegistryProfileEntryV1, RegistrySourceV1 } from \"../profile/profile-registry.ts\";\nimport { createProfileRegistry } from \"../profile/profile-registry.ts\";\nimport { stripBom } from \"../utils/text.ts\";\nimport {\n\tBUILTIN_SUITES,\n\tDEFAULT_SUITE_ID,\n\tFACTORY_CONTENTS_VERSION,\n\tgetBuiltinSuite,\n\tisBuiltinSuiteId,\n\tisValidSuiteId,\n\tORIENTATION_PROMPTS,\n\tparseSuiteJson,\n\tSUITE_SCHEMA_VERSION,\n\ttype SuiteDefinition,\n\tserializeSuiteJson,\n} from \"./builtin-suites.ts\";\n\nexport { DEFAULT_SUITE_ID };\n\nexport const SUITES_DIR_NAME = \"suites\";\nexport const SUITE_MANIFEST_FILENAME = \"suite.json\";\nexport const SUITE_AGENTS_MD_FILENAME = \"agents.md\";\nexport const SUITE_ENV_VAR = \"AGENT_FORGE_SUITE\";\n/** customType of the session custom entry recording the suite a session was created with (设计 §10.1). */\nexport const SUITE_SESSION_ENTRY_TYPE = \"suite\";\n/** Persisted suite profile lock inside the suite workspace (M4, 设计 §12). */\nexport const SUITE_LOCK_FILENAME = \".profile-lock.json\";\n\nexport function getSuitesRootDir(agentDir: string): string {\n\treturn join(agentDir, SUITES_DIR_NAME);\n}\n\nexport function getSuiteWorkspaceDir(agentDir: string, suiteId: string): string {\n\treturn join(getSuitesRootDir(agentDir), suiteId);\n}\n\n/** The suite-local skill layer directory (统一修复轮 B): `<suiteDir>/skills`. */\nexport function getSuiteLocalSkillsDir(agentDir: string, suiteId: string): string {\n\treturn join(getSuiteWorkspaceDir(agentDir, suiteId), \"skills\");\n}\n\n/** The suite-local capability-plugin layer directory (统一修复轮 B): `<suiteDir>/plugins`. */\nexport function getSuiteLocalPluginsDir(agentDir: string, suiteId: string): string {\n\treturn join(getSuiteWorkspaceDir(agentDir, suiteId), \"plugins\");\n}\n\n/** Structured error for unknown suite ids; lists the available ids (设计 §9). */\nexport class SuiteResolutionError extends Error {\n\treadonly requestedId: string;\n\treadonly availableSuiteIds: readonly string[];\n\n\tconstructor(requestedId: string, availableSuiteIds: readonly string[]) {\n\t\tsuper(`Unknown suite \"${requestedId}\". Available suites: ${availableSuiteIds.join(\", \")}`);\n\t\tthis.name = \"SuiteResolutionError\";\n\t\tthis.requestedId = requestedId;\n\t\tthis.availableSuiteIds = Object.freeze([...availableSuiteIds]);\n\t}\n}\n\n/** Structured error for resuming a session under a suite it is not bound to. */\nexport class SuiteRebindError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"SuiteRebindError\";\n\t}\n}\n\n/**\n * Every suite id resolvable on this host: the builtin pair plus user\n * workspaces that already contain a suite.json.\n */\nexport function listSuiteIds(agentDir: string): string[] {\n\tconst ids = new Set(BUILTIN_SUITES.map((suite) => suite.id));\n\tconst rootDir = getSuitesRootDir(agentDir);\n\tif (existsSync(rootDir)) {\n\t\tfor (const entry of readdirSync(rootDir, { withFileTypes: true })) {\n\t\t\tif (!entry.isDirectory()) continue;\n\t\t\tif (!existsSync(join(rootDir, entry.name, SUITE_MANIFEST_FILENAME))) continue;\n\t\t\tids.add(entry.name);\n\t\t}\n\t}\n\treturn [...ids].sort();\n}\n\nexport interface ResolveSuiteIdOptions {\n\t/** Explicit suite id (SDK/CLI parameter); highest priority. */\n\texplicit?: string;\n\t/** Raw AGENT_FORGE_SUITE value; callers pass process.env[SUITE_ENV_VAR]. */\n\tenvSuite?: string;\n\t/** Settings source for the project/global `suite` keys. */\n\tsettings?: Pick<SettingsManager, \"getProjectSettings\" | \"getGlobalSettings\">;\n\t/** Agent dir used for workspace discovery and available-id listing. */\n\tagentDir: string;\n}\n\nfunction normalizeCandidate(value: unknown): string | undefined {\n\tif (typeof value !== \"string\") return undefined;\n\tconst trimmed = value.trim();\n\treturn trimmed.length > 0 ? trimmed : undefined;\n}\n\n/**\n * Resolves the active suite id: explicit > env AGENT_FORGE_SUITE > project\n * settings `suite` > global settings `suite` > \"assistant\" (设计 §9). The\n * first configured value wins; an unknown or malformed value is a structured\n * error, never a silent fallback.\n */\nexport function resolveSuiteId(options: ResolveSuiteIdOptions): string {\n\tconst candidate =\n\t\tnormalizeCandidate(options.explicit) ??\n\t\tnormalizeCandidate(options.envSuite) ??\n\t\t(options.settings === undefined ? undefined : normalizeCandidate(options.settings.getProjectSettings().suite)) ??\n\t\t(options.settings === undefined ? undefined : normalizeCandidate(options.settings.getGlobalSettings().suite));\n\tif (candidate === undefined) return DEFAULT_SUITE_ID;\n\tif (!isValidSuiteId(candidate)) throw new SuiteResolutionError(candidate, listSuiteIds(options.agentDir));\n\tif (!isBuiltinSuiteId(candidate)) {\n\t\tconst workspaceManifest = join(getSuiteWorkspaceDir(options.agentDir, candidate), SUITE_MANIFEST_FILENAME);\n\t\tif (!existsSync(workspaceManifest)) throw new SuiteResolutionError(candidate, listSuiteIds(options.agentDir));\n\t}\n\treturn candidate;\n}\n\nexport interface SuiteWorkspace {\n\treadonly suite: SuiteDefinition;\n\treadonly suiteDir: string;\n\treadonly suiteJsonPath: string;\n\treadonly agentsMdPath: string;\n\treadonly diagnostics: readonly string[];\n\t/** Persisted lock file path inside the workspace (M4). */\n\treadonly lockPath: string;\n\t/**\n\t * The suite profile lock (设计 §12): the persisted lock when one existed, a\n\t * fresh lock frozen over the current identity otherwise.\n\t */\n\treadonly lock: ProfileLockV1;\n\t/** Current resolved identity, including any selected optional domain Profile. */\n\treadonly identity: ProfileIdentityV1;\n\t/** Verify result against the persisted lock; absent when none existed. */\n\treadonly lockVerification?: ProfileLockVerificationV1;\n}\n\n/**\n * Serializes a ProfileLockV1 to the canonical `.profile-lock.json` text\n * (stable field order, trailing newline). Round-trips through\n * parseSuiteProfileLockFile.\n */\nexport function serializeSuiteProfileLockFile(lock: ProfileLockV1): string {\n\tconst ordered = {\n\t\tidentity: {\n\t\t\tprofileId: lock.identity.profileId,\n\t\t\tprofileVersion: lock.identity.profileVersion,\n\t\t\tmanifestDigest: lock.identity.manifestDigest,\n\t\t\tcapabilityVersions: lock.identity.capabilityVersions.map((ref) => ({ id: ref.id, version: ref.version })),\n\t\t},\n\t\tlockedAt: lock.lockedAt,\n\t\tlockedBy: lock.lockedBy,\n\t\tgeneration: lock.generation,\n\t};\n\treturn `${JSON.stringify(ordered, null, 2)}\\n`;\n}\n\n/**\n * Parses `.profile-lock.json` text back into a ProfileLockV1. Throws on any\n * structural mismatch so callers can apply their corruption policy.\n */\nexport function parseSuiteProfileLockFile(text: string): ProfileLockV1 {\n\tconst value: unknown = JSON.parse(text);\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value)) {\n\t\tthrow new Error(\".profile-lock.json must be a JSON object\");\n\t}\n\tconst record = value as Record<string, unknown>;\n\tconst identityRecord = record.identity;\n\tif (identityRecord === null || typeof identityRecord !== \"object\" || Array.isArray(identityRecord)) {\n\t\tthrow new Error(\".profile-lock.json identity must be a JSON object\");\n\t}\n\tconst identity = identityRecord as Record<string, unknown>;\n\tif (\n\t\ttypeof identity.profileId !== \"string\" ||\n\t\ttypeof identity.profileVersion !== \"string\" ||\n\t\ttypeof identity.manifestDigest !== \"string\" ||\n\t\t!Array.isArray(identity.capabilityVersions)\n\t) {\n\t\tthrow new Error(\n\t\t\t\".profile-lock.json identity must carry profileId/profileVersion/manifestDigest/capabilityVersions\",\n\t\t);\n\t}\n\tconst capabilityVersions = identity.capabilityVersions.map((entry) => {\n\t\tif (entry === null || typeof entry !== \"object\" || Array.isArray(entry)) {\n\t\t\tthrow new Error(\".profile-lock.json identity.capabilityVersions entries must be objects\");\n\t\t}\n\t\tconst capability = entry as Record<string, unknown>;\n\t\tif (typeof capability.id !== \"string\" || typeof capability.version !== \"number\") {\n\t\t\tthrow new Error(\".profile-lock.json identity.capabilityVersions entries must carry id/version\");\n\t\t}\n\t\treturn { id: capability.id, version: capability.version };\n\t});\n\tif (\n\t\ttypeof record.lockedAt !== \"number\" ||\n\t\ttypeof record.lockedBy !== \"string\" ||\n\t\ttypeof record.generation !== \"number\"\n\t) {\n\t\tthrow new Error(\".profile-lock.json must carry lockedAt/lockedBy/generation\");\n\t}\n\treturn Object.freeze({\n\t\tidentity: Object.freeze({\n\t\t\tprofileId: identity.profileId,\n\t\t\tprofileVersion: identity.profileVersion,\n\t\t\tmanifestDigest: identity.manifestDigest,\n\t\t\tcapabilityVersions: Object.freeze(capabilityVersions.map((ref) => Object.freeze({ ...ref }))),\n\t\t}),\n\t\tlockedAt: record.lockedAt,\n\t\tlockedBy: record.lockedBy,\n\t\tgeneration: record.generation,\n\t});\n}\n\n/**\n * Locates and lazily provisions `<agentDir>/suites/<id>/`: the builtin pair\n * gets its factory suite.json plus an empty agents.md skeleton on first start\n * (设计 §5). Corruption policy (设计 §9): builtin suites fall back to factory\n * content with diagnostics; user suites fail fast with the file path.\n */\nexport function loadSuiteWorkspace(options: {\n\tagentDir: string;\n\tsuiteId: string;\n\tpluginProfile?: BuiltinPluginProfileResolutionV1;\n}): SuiteWorkspace {\n\tconst { agentDir, suiteId } = options;\n\tconst suiteDir = getSuiteWorkspaceDir(agentDir, suiteId);\n\tconst suiteJsonPath = join(suiteDir, SUITE_MANIFEST_FILENAME);\n\tconst agentsMdPath = join(suiteDir, SUITE_AGENTS_MD_FILENAME);\n\tconst diagnostics: string[] = [];\n\n\tlet suite: SuiteDefinition;\n\tif (!existsSync(suiteJsonPath)) {\n\t\tconst builtin = getBuiltinSuite(suiteId);\n\t\tif (builtin === undefined) throw new SuiteResolutionError(suiteId, listSuiteIds(agentDir));\n\t\tmkdirSync(suiteDir, { recursive: true });\n\t\twriteFileSync(suiteJsonPath, serializeSuiteJson(builtin), \"utf8\");\n\t\t// D-075 S4 第三批:首启不再预种角色文件——种子移到 subagent-delegate 插件\n\t\t// 注册期(entry 的幂等 seedFactoryRoleCatalog 补缺),插件安装并注册时\n\t\t// `<agentDir>/roles/{explore,reviewer}.json` 自然到位。\n\t\tsuite = builtin;\n\t} else {\n\t\tconst parsed = parseSuiteJson(readFileSync(suiteJsonPath, \"utf8\"), {\n\t\t\texpectedBuiltin: getBuiltinSuite(suiteId) !== undefined,\n\t\t\texpectedId: suiteId,\n\t\t});\n\t\tconst builtin = getBuiltinSuite(suiteId);\n\t\tif (parsed.valid && parsed.suite) {\n\t\t\tsuite = parsed.suite;\n\t\t} else if (builtin !== undefined) {\n\t\t\t// Builtin corruption policy (设计 §9): fall back to factory content\n\t\t\t// with diagnostics instead of locking the user out. The file on disk\n\t\t\t// is left untouched; recovery (reset) is an explicit M4 flow.\n\t\t\tsuite = builtin;\n\t\t\tdiagnostics.push(\n\t\t\t\t`suite.json at ${suiteJsonPath} is invalid; falling back to the factory content for builtin suite \"${suiteId}\". Errors: ${parsed.errors.join(\"; \")}`,\n\t\t\t);\n\t\t} else {\n\t\t\tthrow new Error(\n\t\t\t\t`Invalid suite.json at ${suiteJsonPath}: ${parsed.errors.join(\"; \")}. Fix the file, or delete the suite workspace directory ${suiteDir} and recreate it.`,\n\t\t\t);\n\t\t}\n\t}\n\n\tif (!existsSync(agentsMdPath)) {\n\t\twriteFileSync(agentsMdPath, \"\", \"utf8\");\n\t}\n\n\t// Suite profile lock persistence (M4, 设计 §12): an existing lock file is\n\t// verified against the current identity (drift/migration recorded, never\n\t// blocking and never silently replaced); without one a fresh lock is frozen\n\t// and persisted. A lock file that cannot be parsed is recreated with a\n\t// diagnostic — it carries no openable identity, so nothing is silently\n\t// replaced.\n\tconst lockPath = join(suiteDir, SUITE_LOCK_FILENAME);\n\tlet previousLock: ProfileLockV1 | undefined;\n\tif (existsSync(lockPath)) {\n\t\ttry {\n\t\t\tpreviousLock = parseSuiteProfileLockFile(readFileSync(lockPath, \"utf8\"));\n\t\t} catch (error) {\n\t\t\tdiagnostics.push(\n\t\t\t\t`Profile lock at ${lockPath} is unreadable; recreating it over the current suite identity. Errors: ${\n\t\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\t\t}`,\n\t\t\t);\n\t\t}\n\t}\n\tconst bridge = bridgeSuiteProfileLock({\n\t\tsuite,\n\t\t...(options.pluginProfile === undefined ? {} : { pluginProfile: options.pluginProfile }),\n\t\t...(previousLock === undefined ? {} : { previousLock }),\n\t\tlockedBy: \"suite-loader\",\n\t});\n\tdiagnostics.push(...bridge.diagnostics);\n\tif (previousLock === undefined) {\n\t\ttry {\n\t\t\twriteFileSync(lockPath, serializeSuiteProfileLockFile(bridge.lock), \"utf8\");\n\t\t} catch (error) {\n\t\t\tdiagnostics.push(\n\t\t\t\t`Failed to persist the suite profile lock at ${lockPath}: ${\n\t\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\t\t}`,\n\t\t\t);\n\t\t}\n\t}\n\n\treturn {\n\t\tsuite,\n\t\tsuiteDir,\n\t\tsuiteJsonPath,\n\t\tagentsMdPath,\n\t\tdiagnostics: Object.freeze(diagnostics),\n\t\tlockPath,\n\t\tlock: bridge.lock,\n\t\tidentity: bridge.identity,\n\t\t...(bridge.verification === undefined ? {} : { lockVerification: bridge.verification }),\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// agents.md three-level chain (设计 §8)\n// ---------------------------------------------------------------------------\n\nexport type SuiteAgentsMdSource = \"system\" | \"suite\" | \"project\";\n\nexport interface SuiteAgentsMdEntry {\n\treadonly source: SuiteAgentsMdSource;\n\treadonly path: string;\n\treadonly content: string;\n}\n\nexport interface SuiteAgentsMdAssembly {\n\treadonly chain: readonly SuiteAgentsMdEntry[];\n\treadonly diagnostics: readonly string[];\n}\n\nexport interface AssembleSuiteAgentsMdChainOptions {\n\treadonly suite: SuiteDefinition;\n\treadonly agentDir: string;\n\treadonly suiteJsonPath: string;\n\treadonly suiteAgentsMdPath: string;\n\t/**\n\t * Project-level context files exactly as produced by the existing resource\n\t * loader (`ResourceLoader.getAgentsFiles()`: agentDir global entry first,\n\t * then the AGENTS.md/CLAUDE.md ancestor chain). The ancestor chain logic is\n\t * delegated, never reimplemented; entries under agentDir are classified as\n\t * system-layer candidates.\n\t */\n\treadonly projectAgentsFiles: ReadonlyArray<{ path: string; content: string }>;\n}\n\nfunction readContextFile(path: string): string {\n\ttry {\n\t\treturn stripBom(readFileSync(path, \"utf8\"));\n\t} catch {\n\t\treturn \"\";\n\t}\n}\n\nfunction isUnderDir(path: string, dir: string): boolean {\n\tconst resolvedPath = resolve(path);\n\tconst resolvedDir = resolve(dir);\n\tconst prefix = resolvedDir.endsWith(sep) ? resolvedDir : `${resolvedDir}${sep}`;\n\treturn resolvedPath.startsWith(prefix);\n}\n\n/**\n * Assembles the agents.md three-level chain (设计 §8): system layer (the\n * agentDir context file the resource loader's agentsFiles already carries,\n * e.g. AGENTS.md, gated by inheritSystemAgentsMd) -> suite layer\n * (`suites/<id>/agents.md`) -> project layer (existing ancestor chain, passed\n * in unchanged). The global SYSTEM.md/APPEND_SYSTEM.md never ride the chain:\n * they keep their native system prompt channel and are gated there by\n * createSuiteSystemPromptGate, so both channels stay single-sourced. Every\n * entry carries its source label; missing layers are skipped. Diagnostics\n * record a blocked system layer (one-time migration hint) and the empty\n * association counts (设计 §11.3: 惰性 + 可观测).\n */\nexport function assembleSuiteAgentsMdChain(options: AssembleSuiteAgentsMdChainOptions): SuiteAgentsMdAssembly {\n\tconst { suite, agentDir, suiteJsonPath, suiteAgentsMdPath, projectAgentsFiles } = options;\n\tconst diagnostics: string[] = [];\n\n\t// System-layer candidates are the agentDir entries already present in the\n\t// loader's agentsFiles; they are never read from disk here again.\n\tconst systemCandidates = projectAgentsFiles\n\t\t.filter((entry) => isUnderDir(entry.path, agentDir))\n\t\t.map((entry) => ({ path: entry.path, content: entry.content }));\n\tconst projectEntries = projectAgentsFiles.filter((entry) => !isUnderDir(entry.path, agentDir));\n\n\tconst chain: SuiteAgentsMdEntry[] = [];\n\tif (suite.inheritSystemAgentsMd) {\n\t\tfor (const candidate of systemCandidates) {\n\t\t\tchain.push({ source: \"system\", path: candidate.path, content: candidate.content });\n\t\t}\n\t} else if (systemCandidates.length > 0) {\n\t\tdiagnostics.push(\n\t\t\t`Suite \"${suite.id}\" does not inherit the system agents.md layer (inheritSystemAgentsMd=false); system-layer file(s) kept out of the suite chain: ${systemCandidates\n\t\t\t\t.map((candidate) => candidate.path)\n\t\t\t\t.join(\n\t\t\t\t\t\", \",\n\t\t\t\t)}. Migrate them into ${suiteAgentsMdPath} or set \"inheritSystemAgentsMd\": true in ${suiteJsonPath}.`,\n\t\t);\n\t}\n\n\tchain.push({ source: \"suite\", path: suiteAgentsMdPath, content: readContextFile(suiteAgentsMdPath) });\n\tfor (const entry of projectEntries) {\n\t\tchain.push({ source: \"project\", path: entry.path, content: entry.content });\n\t}\n\n\t// Plugin associations are wired since M3 (the sdk filters the external\n\t// capability plugin pool by associations.plugins); mcp stays\n\t// declaration-only until M4.\n\tdiagnostics.push(\n\t\t`Suite \"${suite.id}\" mcp associations are declaration-only until M4; MCP association filtering is unwired.`,\n\t);\n\n\treturn { chain: Object.freeze(chain), diagnostics: Object.freeze(diagnostics) };\n}\n\n/**\n * Merges the assembled chain with the resource loader's own agentsFiles for\n * the contextFiles injection channel: chain entries are prepended unless they\n * are empty or already present in the base. Entries with empty content inject\n * nothing, so a fresh factory skeleton changes no prompt bytes. Base entries\n * under agentDir are dropped unconditionally (设计 §8): with\n * inheritSystemAgentsMd=false the switch blocks the system layer, with true\n * the chain already carries it at the head — keeping it in the base too would\n * duplicate it and pin it after the suite layer, breaking the\n * system -> suite -> project order.\n */\nexport function mergeSuiteAgentsFiles(\n\tchain: readonly SuiteAgentsMdEntry[],\n\tbase: ReadonlyArray<{ path: string; content: string }>,\n\toptions: { agentDir: string },\n): Array<{ path: string; content: string }> {\n\tconst retainedBase = base.filter((entry) => !isUnderDir(entry.path, options.agentDir));\n\tconst basePathSet = new Set(retainedBase.map((entry) => resolve(entry.path)));\n\tconst merged: Array<{ path: string; content: string }> = [];\n\tfor (const entry of chain) {\n\t\tif (entry.content.trim().length === 0) continue;\n\t\tif (basePathSet.has(resolve(entry.path))) continue;\n\t\tmerged.push({ path: entry.path, content: entry.content });\n\t}\n\tmerged.push(...retainedBase.map((entry) => ({ path: entry.path, content: entry.content })));\n\treturn merged;\n}\n\nexport interface SuiteSystemPromptGate {\n\t/** Gates the loader's main system prompt: the discovered file's content, or undefined. */\n\treadonly systemPromptOverride: (base: string | undefined) => string | undefined;\n\t/** Gates the loader's append system prompt: the discovered file's content array. */\n\treadonly appendSystemPromptOverride: (base: string[]) => string[];\n\t/** Blocked global system-layer files; filled as the overrides run, deduplicated. */\n\treadonly diagnostics: readonly string[];\n}\n\n/**\n * Gates the global SYSTEM.md/APPEND_SYSTEM.md system prompt channel by\n * inheritSystemAgentsMd (设计 §8: the switch governs the whole system layer,\n * not just the agents.md chain). The resource loader feeds both overrides with\n * the resolved content of exactly one discovered file — project-level\n * `<cwd>/.agent-forge/<name>` first, else global `<agentDir>/<name>` — with no\n * path attached, so project-level existence identifies the base origin:\n * present means the project layer, which per 设计 §4 is the third level and\n * always passes the switch; absent means a global source, which passes only\n * when the suite inherits the system layer. Blocked global files are recorded\n * in diagnostics with their paths (one-time migration hint, 设计 §11.3).\n */\nexport function createSuiteSystemPromptGate(\n\tsuite: SuiteDefinition,\n\toptions: { cwd: string; agentDir: string },\n): SuiteSystemPromptGate {\n\tconst diagnostics: string[] = [];\n\tconst passes = (filename: string): boolean => {\n\t\tconst projectPath = join(options.cwd, CONFIG_DIR_NAME, filename);\n\t\tif (existsSync(projectPath)) return true;\n\t\tif (suite.inheritSystemAgentsMd) return true;\n\t\tconst message =\n\t\t\t`Suite \"${suite.id}\" does not inherit the global system layer (inheritSystemAgentsMd=false); ` +\n\t\t\t`global file kept out of the model context: ${join(options.agentDir, filename)}. Move it to the ` +\n\t\t\t`project level (${projectPath}) or set \"inheritSystemAgentsMd\": true in the suite.json.`;\n\t\tif (!diagnostics.includes(message)) diagnostics.push(message);\n\t\treturn false;\n\t};\n\treturn {\n\t\tsystemPromptOverride: (base) => (base === undefined || passes(\"SYSTEM.md\") ? base : undefined),\n\t\tappendSystemPromptOverride: (base) => (base.length === 0 || passes(\"APPEND_SYSTEM.md\") ? base : []),\n\t\tdiagnostics,\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// Association filtering (设计 §3/§4/§11.3, M1b)\n// ---------------------------------------------------------------------------\n\nexport type SuiteAssociationKind = \"skills\" | \"plugins\" | \"capabilities\";\n\nexport interface SuiteAssociationFilterResult<T> {\n\t/** Entries that pass the filter, in input order. */\n\treadonly kept: T[];\n\t/** Association names that matched no discovered entry (设计 §11.3 dangling). */\n\treadonly dangling: readonly string[];\n}\n\n/**\n * Single-sourced dangling-association diagnostic text (设计 §11.3): reported\n * through the suiteDiagnostics channel, never thrown.\n */\nexport function suiteDanglingAssociationDiagnostic(suiteId: string, kind: SuiteAssociationKind, name: string): string {\n\treturn `Suite \"${suiteId}\" dangling association \"${name}\" (${kind}): not found in the discovered registry; ignored.`;\n}\n\n/**\n * Filters the discovered skills down to the suite's skill associations (设计\n * §3: the filter lives in the assembler; discovery stays untouched). Project\n * scope (`<cwd>/.agent-forge/`) is the third layer (设计 §4) and always passes;\n * every other entry is kept only when its `Skill.name` exactly matches an\n * `associations.skills` entry. Association names that match no discovered\n * skill — including case mismatches — are reported as dangling.\n *\n * `options.localSkillsDir` is the suite-local skill layer (统一修复轮 B:\n * `<agentDir>/suites/<id>/skills`): its entries live inside the active suite\n * workspace, so suite activation is their association and they pass the filter\n * by path — the suite-local layer exemption — instead of requiring an\n * association entry.\n */\nexport function filterSuiteSkills(\n\tsuite: SuiteDefinition,\n\tskills: ReadonlyArray<Skill>,\n\toptions?: { localSkillsDir?: string },\n): SuiteAssociationFilterResult<Skill> {\n\tconst associated = new Set(suite.associations.skills);\n\tconst discovered = new Set(skills.map((skill) => skill.name));\n\tconst dangling = suite.associations.skills.filter((name) => !discovered.has(name));\n\tconst localSkillsDir = options?.localSkillsDir;\n\tconst kept = skills.filter(\n\t\t(skill) =>\n\t\t\tskill.sourceInfo.scope === \"project\" ||\n\t\t\t(localSkillsDir !== undefined && isUnderDir(skill.filePath, localSkillsDir)) ||\n\t\t\tassociated.has(skill.name),\n\t);\n\treturn { kept, dangling: Object.freeze(dangling) };\n}\n\n// ---------------------------------------------------------------------------\n// Capability plugin pool filtering (设计 §10.4, M3)\n// ---------------------------------------------------------------------------\n\n/** One external capability plugin manifest discovered below a plugin pool root. */\nexport interface SuiteCapabilityPluginCandidate {\n\t/** Exact manifest id (`PluginManifest.id`). */\n\treadonly manifestId: string;\n\t/** Resolved manifest path, as it will be reported in diagnostics. */\n\treadonly manifestPath: string;\n}\n\nexport interface SuiteCapabilityPluginDecision {\n\treadonly keep: boolean;\n\t/** Diagnostic for a filtered-out plugin; absent when the plugin passes. */\n\treadonly diagnostic?: string;\n}\n\n/**\n * Decides one external capability plugin manifest against the suite's\n * `associations.plugins` (方案设计 §10.4, M3 双键语义: associations.plugins\n * governs only the external capability plugin pool; suite.capabilities governs\n * the compiled builtin ids). The project-level pool\n * (`<cwd>/.agent-forge/plugins`) is the third layer (设计 §4) and always\n * passes; every other manifest is kept only when its id matches an\n * association exactly. Filtered plugins surface as diagnostics, never as\n * errors.\n */\nexport function decideSuiteCapabilityPlugin(\n\tsuite: SuiteDefinition,\n\tcandidate: SuiteCapabilityPluginCandidate,\n\toptions: { cwd: string },\n): SuiteCapabilityPluginDecision {\n\tif (isUnderDir(candidate.manifestPath, join(options.cwd, CONFIG_DIR_NAME, \"plugins\"))) return { keep: true };\n\tif (suite.associations.plugins.includes(candidate.manifestId)) return { keep: true };\n\treturn {\n\t\tkeep: false,\n\t\tdiagnostic: `Suite \"${suite.id}\" capability plugin \"${candidate.manifestId}\" at ${candidate.manifestPath} is not associated; not loaded.`,\n\t};\n}\n\n/**\n * Dangling `associations.plugins` entries: association ids that matched no\n * candidate capability plugin manifest (设计 §11.3), single-sourced through\n * the shared dangling diagnostic text. The caller decides what counts as a\n * candidate: the sdk assembler passes every manifest id it loads, so explicit\n * capabilityPluginPaths count toward satisfying an association even though\n * they bypass the keep filter; only manifests absent from the passed ids\n * surface as dangling.\n */\nexport function suiteDanglingPluginAssociations(\n\tsuite: SuiteDefinition,\n\tdiscoveredManifestIds: readonly string[],\n): readonly string[] {\n\tconst discovered = new Set(discoveredManifestIds);\n\treturn suite.associations.plugins\n\t\t.filter((id) => !discovered.has(id))\n\t\t.map((id) => suiteDanglingAssociationDiagnostic(suite.id, \"plugins\", id));\n}\n\n// ---------------------------------------------------------------------------\n// Shared suite loader assembly (设计 §3/§4/§8, M2)\n// ---------------------------------------------------------------------------\n\n/**\n * The DefaultResourceLoader override subset that wires a resolved suite into a\n * loader: the agents.md three-level chain, the skill/extension association\n * filters, and the inheritSystemAgentsMd gate on the global SYSTEM.md/\n * APPEND_SYSTEM.md prompt channel. Structurally compatible with the matching\n * DefaultResourceLoaderOptions fields.\n */\nexport interface SuiteLoaderOverrides {\n\tagentsFilesOverride: (base: { agentsFiles: Array<{ path: string; content: string }> }) => {\n\t\tagentsFiles: Array<{ path: string; content: string }>;\n\t};\n\tskillsOverride: (base: { skills: Skill[]; diagnostics: ResourceDiagnostic[] }) => {\n\t\tskills: Skill[];\n\t\tdiagnostics: ResourceDiagnostic[];\n\t};\n\tsystemPromptOverride: (base: string | undefined) => string | undefined;\n\tappendSystemPromptOverride: (base: string[]) => string[];\n}\n\nexport interface SuiteAssembly {\n\treadonly workspace: SuiteWorkspace;\n\t/** Optional domain plugin profile selected for this suite. */\n\treadonly pluginProfile?: BuiltinPluginProfileResolutionV1;\n\t/** Spread into DefaultResourceLoader options to wire the suite in. */\n\treadonly loaderOverrides: SuiteLoaderOverrides;\n\t/**\n\t * The suite-local skill layer directory (统一修复轮 B) when it exists on\n\t * disk; inject it into the loader's skill paths so suites/<id>/skills load\n\t * with the suite itself. Undefined when the directory is absent, so empty\n\t * and missing directories both contribute nothing.\n\t */\n\treadonly localSkillsDir?: string;\n\t/**\n\t * The suite-local capability-plugin layer directory (统一修复轮 B) when it\n\t * exists on disk; discover its manifests into the session's capability\n\t * plugin candidates. Undefined when the directory is absent.\n\t */\n\treadonly localPluginsDir?: string;\n\t/**\n\t * Snapshot of every suite assembly diagnostic collected so far — workspace\n\t * provisioning, agents.md chain, extension/skill filters, system prompt\n\t * gate, context budget — in the canonical suiteDiagnostics order. Overrides\n\t * that have not run yet contribute nothing (the budget line needs the\n\t * assembled agents.md chain).\n\t */\n\tcollectDiagnostics(): readonly string[];\n}\n\n/**\n * Single-sourced assembly-layer context budget estimate (统一修复轮 B): pure\n * chars/4 arithmetic over the assembled agents.md chain (per source layer),\n * the orientation persona text, plus the count of suite-local workspace\n * skills. Diagnostic-only: it never blocks, gates, or degrades anything.\n */\nexport function suiteContextBudgetDiagnostic(\n\tsuiteId: string,\n\tchain: ReadonlyArray<SuiteAgentsMdEntry>,\n\toptions: { personaChars: number; workspaceSkillCount: number },\n): string {\n\tconst layerChars: Record<SuiteAgentsMdSource, number> = { system: 0, suite: 0, project: 0 };\n\tfor (const entry of chain) {\n\t\tlayerChars[entry.source] += entry.content.length;\n\t}\n\tconst tokens = (chars: number): number => Math.round(chars / 4);\n\tconst system = tokens(layerChars.system);\n\tconst suiteLayer = tokens(layerChars.suite);\n\tconst project = tokens(layerChars.project);\n\treturn `Suite \"${suiteId}\" context budget: agents.md ~${system + suiteLayer + project} tok (system ${system}/suite ${suiteLayer}/project ${project}), persona ~${tokens(options.personaChars)} tok, workspace skills ${options.workspaceSkillCount}`;\n}\n\n/**\n * Plugin-profile diagnostics in the canonical suiteDiagnostics order.\n *\n * D-075 S2 soft degradation: a resolved Profile renders structured per-plugin\n * misses (e.g. `manifest_missing` for a package-distributed plugin without an\n * installed active version) as readable diagnostics, so the session keeps\n * starting without the missing plugin's tools and the miss stays visible.\n * Blocked resolutions already render every plugin diagnostic through\n * `resolution.diagnostics`; the per-plugin lines are additive for the\n * non-blocked branches only.\n */\nfunction pluginProfileDiagnosticsV1(profile: BuiltinPluginProfileResolutionV1): readonly string[] {\n\tif (profile.status === \"not_found\") return [`Plugin profile unavailable: ${profile.profileId}`];\n\tif (profile.status === \"host_facts_required\") return [`Plugin profile host facts required: ${profile.profileId}`];\n\tif (profile.status === \"invalid_selection\")\n\t\treturn [\n\t\t\t`Plugin profile invalid selection: ${profile.profileId} (unknown: ${profile.unknownPluginIds.join(\", \") || \"none\"}; duplicates: ${profile.duplicatePluginIds.join(\", \") || \"none\"})`,\n\t\t];\n\tconst pluginMisses =\n\t\tprofile.resolution.status === \"blocked\"\n\t\t\t? []\n\t\t\t: profile.resolution.plugins\n\t\t\t\t\t.filter((plugin) => plugin.status !== \"installed-ready\")\n\t\t\t\t\t.flatMap((plugin) =>\n\t\t\t\t\t\tplugin.diagnostics.map(\n\t\t\t\t\t\t\t(diagnostic) =>\n\t\t\t\t\t\t\t\t`Plugin profile plugin unavailable: ${plugin.pluginId} (${diagnostic.code}): ${diagnostic.message}`,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\tif (profile.resolution.status === \"blocked\")\n\t\treturn profile.resolution.diagnostics.map((diagnostic) => `Plugin profile blocked: ${diagnostic.message}`);\n\tif (profile.assembly?.status === \"unverified\")\n\t\treturn [\n\t\t\t...profile.assembly.unverified.map(\n\t\t\t\t(plugin) => `Plugin profile unverified: ${plugin.pluginId}@${plugin.pluginVersion}`,\n\t\t\t),\n\t\t\t...pluginMisses,\n\t\t];\n\treturn pluginMisses;\n}\n\n/**\n * The single suite assembly used by both first-party entry paths (sdk.ts\n * self-built loader and agent-session-services `suiteAssembly`), so the two\n * cannot drift. Loads the suite workspace, builds the system prompt gate, and\n * returns the loader overrides plus a diagnostics collection channel.\n */\nexport function createSuiteAssembly(options: {\n\tcwd: string;\n\tagentDir: string;\n\tsuiteId: string;\n\tpluginProfileId?: BuiltinPluginProfileIdV1;\n\tselectedPluginIds?: readonly string[];\n\tdisabledPluginIds?: readonly string[];\n\tpluginHost?: HostFactsV1;\n\tverifiedPlugins?: readonly VerifiedToolPluginV1[];\n\t/** Explicit host-owned active installed manifests; never discovered implicitly. */\n\tmanifestOverrides?: BuiltinPluginManifestOverridesV1;\n\tpluginProfile?: BuiltinPluginProfileResolutionV1;\n}): SuiteAssembly {\n\tconst { cwd, agentDir, suiteId } = options;\n\tlet pluginProfile = options.pluginProfile;\n\tif (pluginProfile === undefined && options.pluginProfileId !== undefined) {\n\t\tpluginProfile =\n\t\t\toptions.pluginHost === undefined\n\t\t\t\t? ({ status: \"host_facts_required\", profileId: options.pluginProfileId } as const)\n\t\t\t\t: resolveBuiltinPluginProfileV1({\n\t\t\t\t\t\tprofileId: options.pluginProfileId,\n\t\t\t\t\t\tselectedPluginIds: options.selectedPluginIds,\n\t\t\t\t\t\tdisabledPluginIds: options.disabledPluginIds,\n\t\t\t\t\t\thost: options.pluginHost,\n\t\t\t\t\t\tverifiedPlugins: options.verifiedPlugins,\n\t\t\t\t\t\tmanifestOverrides: options.manifestOverrides,\n\t\t\t\t\t});\n\t}\n\tconst workspace = loadSuiteWorkspace({\n\t\tagentDir,\n\t\tsuiteId,\n\t\t...(pluginProfile === undefined ? {} : { pluginProfile }),\n\t});\n\tconst gate = createSuiteSystemPromptGate(workspace.suite, { cwd, agentDir });\n\t// Suite-local asset layer (统一修复轮 B): present directories only, so\n\t// missing and empty directories both contribute nothing.\n\tconst localSkillsDir = getSuiteLocalSkillsDir(agentDir, suiteId);\n\tconst localPluginsDir = getSuiteLocalPluginsDir(agentDir, suiteId);\n\tconst hasLocalSkillsDir = existsSync(localSkillsDir);\n\tconst hasLocalPluginsDir = existsSync(localPluginsDir);\n\tconst workspaceSkillCount = hasLocalSkillsDir\n\t\t? loadSkills({ cwd, agentDir, skillPaths: [localSkillsDir], includeDefaults: false }).skills.length\n\t\t: 0;\n\tlet chainDiagnostics: readonly string[] = [];\n\tlet skillDiagnostics: readonly string[] = [];\n\t// The assembled chain as far as the agentsFilesOverride has run; the budget\n\t// line is only honest once the real chain is known.\n\tlet assembledChain: readonly SuiteAgentsMdEntry[] | undefined;\n\t// Factory upgrade proposal (M4, 设计 §9 升级合并): an unbounded registry\n\t// resolve only proposes when the factory source wins, i.e. its revision is\n\t// strictly greater than the disk revision. Daily assembly keeps the disk\n\t// contents; adoption is an explicit --suite-reset.\n\tconst upgrade = detectSuiteFactoryUpgrade(workspace.suite);\n\tconst proposalDiagnostics = upgrade === undefined ? [] : [suiteFactoryUpgradeDiagnostic(suiteId, upgrade)];\n\tconst budgetDiagnostics = (): readonly string[] => {\n\t\tif (assembledChain === undefined) return [];\n\t\treturn [\n\t\t\tsuiteContextBudgetDiagnostic(suiteId, assembledChain, {\n\t\t\t\tpersonaChars: ORIENTATION_PROMPTS[workspace.suite.orientation].length,\n\t\t\t\tworkspaceSkillCount,\n\t\t\t}),\n\t\t];\n\t};\n\treturn {\n\t\tworkspace,\n\t\t...(pluginProfile === undefined ? {} : { pluginProfile }),\n\t\t...(hasLocalSkillsDir ? { localSkillsDir } : {}),\n\t\t...(hasLocalPluginsDir ? { localPluginsDir } : {}),\n\t\tloaderOverrides: {\n\t\t\tagentsFilesOverride: (base) => {\n\t\t\t\tconst assembly = assembleSuiteAgentsMdChain({\n\t\t\t\t\tsuite: workspace.suite,\n\t\t\t\t\tagentDir,\n\t\t\t\t\tsuiteJsonPath: workspace.suiteJsonPath,\n\t\t\t\t\tsuiteAgentsMdPath: workspace.agentsMdPath,\n\t\t\t\t\tprojectAgentsFiles: base.agentsFiles,\n\t\t\t\t});\n\t\t\t\tchainDiagnostics = assembly.diagnostics;\n\t\t\t\tassembledChain = assembly.chain;\n\t\t\t\treturn { agentsFiles: mergeSuiteAgentsFiles(assembly.chain, base.agentsFiles, { agentDir }) };\n\t\t\t},\n\t\t\tskillsOverride: (base) => {\n\t\t\t\tconst filtered = filterSuiteSkills(workspace.suite, base.skills, { localSkillsDir });\n\t\t\t\tskillDiagnostics = filtered.dangling.map((name) =>\n\t\t\t\t\tsuiteDanglingAssociationDiagnostic(suiteId, \"skills\", name),\n\t\t\t\t);\n\t\t\t\treturn { skills: filtered.kept, diagnostics: base.diagnostics };\n\t\t\t},\n\t\t\tsystemPromptOverride: gate.systemPromptOverride,\n\t\t\tappendSystemPromptOverride: gate.appendSystemPromptOverride,\n\t\t},\n\t\tcollectDiagnostics: () =>\n\t\t\tObject.freeze([\n\t\t\t\t...workspace.diagnostics,\n\t\t\t\t...(pluginProfile === undefined ? [] : pluginProfileDiagnosticsV1(pluginProfile)),\n\t\t\t\t...proposalDiagnostics,\n\t\t\t\t...chainDiagnostics,\n\t\t\t\t...skillDiagnostics,\n\t\t\t\t...budgetDiagnostics(),\n\t\t\t\t...gate.diagnostics,\n\t\t\t]),\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// Session suite binding reader (设计 §10.1, 统一修复轮 B)\n// ---------------------------------------------------------------------------\n\n/**\n * Reads the suite binding recorded as session protocol data (设计 §10.1): the\n * suiteId of the latest `SUITE_SESSION_ENTRY_TYPE` custom entry. Undefined\n * when the session carries no binding — pre-suite sessions, entries without a\n * data payload, or payloads without a non-empty string suiteId.\n */\nexport function readSessionSuiteId(\n\tentries: ReadonlyArray<{ type: string; customType?: string; data?: unknown }>,\n): string | undefined {\n\treturn readSessionSuiteBinding(entries)?.suiteId;\n}\n\nexport interface SessionSuiteBindingV1 {\n\treadonly suiteId: string;\n\treadonly profileIdentity?: ProfileIdentityV1;\n}\n\nfunction sessionProfileIdentity(value: unknown): ProfileIdentityV1 | undefined {\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value)) return undefined;\n\tconst record = value as Record<string, unknown>;\n\tif (\n\t\ttypeof record.profileId !== \"string\" ||\n\t\trecord.profileId.trim() === \"\" ||\n\t\ttypeof record.profileVersion !== \"string\" ||\n\t\trecord.profileVersion.trim() === \"\" ||\n\t\ttypeof record.manifestDigest !== \"string\" ||\n\t\trecord.manifestDigest.trim() === \"\" ||\n\t\t!Array.isArray(record.capabilityVersions)\n\t) {\n\t\treturn undefined;\n\t}\n\tconst capabilityVersions: { id: string; version: number }[] = [];\n\tfor (const entry of record.capabilityVersions) {\n\t\tif (entry === null || typeof entry !== \"object\" || Array.isArray(entry)) return undefined;\n\t\tconst capability = entry as Record<string, unknown>;\n\t\tif (\n\t\t\ttypeof capability.id !== \"string\" ||\n\t\t\tcapability.id.trim() === \"\" ||\n\t\t\ttypeof capability.version !== \"number\" ||\n\t\t\t!Number.isSafeInteger(capability.version) ||\n\t\t\tcapability.version < 1\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\t\tcapabilityVersions.push({ id: capability.id, version: capability.version });\n\t}\n\treturn Object.freeze({\n\t\tprofileId: record.profileId,\n\t\tprofileVersion: record.profileVersion,\n\t\tmanifestDigest: record.manifestDigest,\n\t\tcapabilityVersions: Object.freeze(capabilityVersions) as readonly {\n\t\t\treadonly id: string;\n\t\t\treadonly version: number;\n\t\t}[],\n\t});\n}\n\n/** Reads the latest suite and optional Profile identity bound to a session. */\nexport function readSessionSuiteBinding(\n\tentries: ReadonlyArray<{ type: string; customType?: string; data?: unknown }>,\n): SessionSuiteBindingV1 | undefined {\n\tfor (let index = entries.length - 1; index >= 0; index--) {\n\t\tconst entry = entries[index];\n\t\tif (entry.type !== \"custom\" || entry.customType !== SUITE_SESSION_ENTRY_TYPE) continue;\n\t\tconst data = entry.data;\n\t\tif (data !== null && typeof data === \"object\" && !Array.isArray(data)) {\n\t\t\tconst suiteId = (data as { suiteId?: unknown }).suiteId;\n\t\t\tif (typeof suiteId === \"string\" && suiteId.length > 0) {\n\t\t\t\tconst profileIdentity = sessionProfileIdentity((data as { profileIdentity?: unknown }).profileIdentity);\n\t\t\t\treturn Object.freeze({\n\t\t\t\t\tsuiteId,\n\t\t\t\t\t...(profileIdentity === undefined ? {} : { profileIdentity }),\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\treturn undefined;\n}\n\n// ---------------------------------------------------------------------------\n// Suite -> ProfileIdentityV1 -> lock bridge (设计 §12)\n// ---------------------------------------------------------------------------\n\nfunction suiteToJsonValue(suite: SuiteDefinition): JsonValue {\n\treturn {\n\t\tschemaVersion: suite.schemaVersion,\n\t\tid: suite.id,\n\t\tname: suite.name,\n\t\tbuiltin: suite.builtin,\n\t\ttools: [...suite.tools],\n\t\tcapabilities: [...suite.capabilities],\n\t\tassociations: {\n\t\t\tskills: [...suite.associations.skills],\n\t\t\tmcp: [...suite.associations.mcp],\n\t\t\tplugins: [...suite.associations.plugins],\n\t\t},\n\t\tinheritSystemAgentsMd: suite.inheritSystemAgentsMd,\n\t\tmemory: suite.memory,\n\t\torientation: suite.orientation,\n\t\tmodel: suite.model,\n\t\tthinking: suite.thinking,\n\t\tclonedFrom: suite.clonedFrom\n\t\t\t? { id: suite.clonedFrom.id, digest: suite.clonedFrom.digest, at: suite.clonedFrom.at }\n\t\t\t: null,\n\t\t...(suite.factoryRevision === undefined ? {} : { factoryRevision: suite.factoryRevision }),\n\t};\n}\n\n/** The stable suite.json digest that rides as the suite profile manifest digest. */\nexport function suiteManifestDigest(suite: SuiteDefinition): string {\n\treturn stableJsonDigest(suiteToJsonValue(suite));\n}\n\n/**\n * Builds the ProfileIdentityV1 for an assembled suite. The identity is a pure\n * function of suite.json: the stable suite.json digest rides as the single\n * resolved \"manifest\", and the declared capabilities map to capability\n * references at version 1. No new identity/lock mechanism is introduced.\n */\nexport function buildSuiteProfileIdentity(\n\tsuite: SuiteDefinition,\n\tpluginProfile?: BuiltinPluginProfileResolutionV1,\n): ProfileIdentityV1 {\n\tconst fingerprint = suiteManifestDigest(suite);\n\tconst suiteCapabilityRefs = suite.capabilities.map((id) => ({ id, version: 1 }));\n\tconst pluginRefs =\n\t\tpluginProfile?.status === \"resolved\" && pluginProfile.resolution.status === \"ready\"\n\t\t\t? pluginProfile.resolution.resolvedManifest.plugins\n\t\t\t: [];\n\tconst capabilityRefs = [...suiteCapabilityRefs, ...pluginRefs.flatMap((plugin) => plugin.capabilityRefs)].sort(\n\t\t(left, right) => left.id.localeCompare(right.id) || left.version - right.version,\n\t);\n\treturn buildProfileIdentityV1({\n\t\tprofileId: suiteProfileId(suite.id),\n\t\tprofileVersion: `${SUITE_SCHEMA_VERSION}`,\n\t\tresolvedPlugins: [\n\t\t\t{\n\t\t\t\tpluginId: `${suite.id}/suite.json`,\n\t\t\t\tpluginVersion: fingerprint,\n\t\t\t\tcapabilityRefs: suiteCapabilityRefs,\n\t\t\t},\n\t\t\t...(pluginProfile?.status === \"resolved\" && pluginProfile.resolution.status === \"ready\"\n\t\t\t\t? [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpluginId: `profile:${pluginProfile.profile.id}`,\n\t\t\t\t\t\t\tpluginVersion: pluginProfile.profile.version,\n\t\t\t\t\t\t\tcapabilityRefs: [],\n\t\t\t\t\t\t},\n\t\t\t\t\t\t...pluginRefs,\n\t\t\t\t\t]\n\t\t\t\t: []),\n\t\t],\n\t\tcapabilityVersions: capabilityRefs,\n\t});\n}\n\n// ---------------------------------------------------------------------------\n// ProfileRegistryV1 hookup: factory/disk sources and upgrade proposals (M4)\n// ---------------------------------------------------------------------------\n\n/** Registry profileId namespace for suites (设计 §12). */\nexport function suiteProfileId(suiteId: string): string {\n\treturn `suite:${suiteId}`;\n}\n\nexport const SUITE_FACTORY_REGISTRY_SOURCE_ID = \"suite-factory\";\nexport const SUITE_DISK_REGISTRY_SOURCE_ID = \"suite-disk\";\n/** Lower priority wins same-version ties: the disk contents beat the factory. */\nconst SUITE_FACTORY_REGISTRY_PRIORITY = 10;\nconst SUITE_DISK_REGISTRY_PRIORITY = 0;\n\n/** The effective on-disk revision: absent key means FACTORY_CONTENTS_VERSION. */\nfunction suiteDiskRevision(suite: SuiteDefinition): number {\n\treturn suite.factoryRevision ?? FACTORY_CONTENTS_VERSION;\n}\n\n/** Builds the registry entry of one suite definition (version = factoryRevision). */\nexport function buildSuiteRegistryEntry(suite: SuiteDefinition): RegistryProfileEntryV1 {\n\treturn {\n\t\tprofileId: suiteProfileId(suite.id),\n\t\tprofileVersion: String(suiteDiskRevision(suite)),\n\t\tmanifestDigest: suiteManifestDigest(suite),\n\t};\n}\n\n/** Factory source over the builtin declarations (priority 10). */\nexport function buildSuiteFactoryRegistrySource(): RegistrySourceV1 {\n\treturn {\n\t\tsourceId: SUITE_FACTORY_REGISTRY_SOURCE_ID,\n\t\tpriority: SUITE_FACTORY_REGISTRY_PRIORITY,\n\t\tprofiles: BUILTIN_SUITES.map(buildSuiteRegistryEntry),\n\t};\n}\n\n/** Disk source over workspace-effective definitions (priority 0; wins ties). */\nexport function buildSuiteDiskRegistrySource(suites: readonly SuiteDefinition[]): RegistrySourceV1 {\n\treturn {\n\t\tsourceId: SUITE_DISK_REGISTRY_SOURCE_ID,\n\t\tpriority: SUITE_DISK_REGISTRY_PRIORITY,\n\t\tprofiles: suites.map(buildSuiteRegistryEntry),\n\t};\n}\n\nexport interface SuiteFactoryUpgrade {\n\t/** Revision the factory builtin declaration carries. */\n\treadonly factoryRevision: number;\n\t/** Revision effective on disk. */\n\treadonly diskRevision: number;\n}\n\n/** Single-sourced upgrade-proposal diagnostic text (设计 §9 升级合并). */\nexport function suiteFactoryUpgradeDiagnostic(suiteId: string, upgrade: SuiteFactoryUpgrade): string {\n\treturn `Suite \"${suiteId}\": factory revision ${upgrade.factoryRevision} available (disk has ${upgrade.diskRevision}); run \"--suite-reset ${suiteId}\" to review and adopt.`;\n}\n\n/**\n * Detects a factory upgrade proposal for one disk-effective suite: an\n * unbounded registry resolve over the factory source (all builtins) plus a\n * disk source carrying exactly the effective definition. The factory source\n * wins only when its revision is strictly greater — same-version resolves\n * keep the disk contents (priority 0), so no proposal is emitted for\n * unchanged suites, and user suites (no factory entry) never resolve to the\n * factory. Pure function; the caller decides what to do with the proposal.\n */\nexport function detectSuiteFactoryUpgrade(diskSuite: SuiteDefinition): SuiteFactoryUpgrade | undefined {\n\tconst registry = createProfileRegistry();\n\tregistry.registerSource(buildSuiteFactoryRegistrySource());\n\tregistry.registerSource(buildSuiteDiskRegistrySource([diskSuite]));\n\tconst resolution = registry.resolve({ profileId: suiteProfileId(diskSuite.id) });\n\tif (resolution.status !== \"resolved\" || resolution.sourceId !== SUITE_FACTORY_REGISTRY_SOURCE_ID) {\n\t\treturn undefined;\n\t}\n\treturn {\n\t\tfactoryRevision: Number.parseInt(resolution.profileVersion, 10),\n\t\tdiskRevision: suiteDiskRevision(diskSuite),\n\t};\n}\n\nexport interface SuiteProfileLockBridge {\n\treadonly identity: ProfileIdentityV1;\n\t/**\n\t * The lock for this assembly. When a previous lock exists it is kept as-is\n\t * (a lock is never silently replaced); without one, a fresh lock freezes\n\t * the current identity.\n\t */\n\treadonly lock: ProfileLockV1;\n\treadonly verification?: ProfileLockVerificationV1;\n\t/** Drift/migration findings; recorded, never blocking in M1a (设计 §12). */\n\treadonly diagnostics: readonly string[];\n}\n\n/** Bridges an assembled suite onto the existing lock create/verify trio. */\nexport function bridgeSuiteProfileLock(options: {\n\treadonly suite: SuiteDefinition;\n\treadonly pluginProfile?: BuiltinPluginProfileResolutionV1;\n\treadonly previousLock?: ProfileLockV1;\n\treadonly lockedBy?: string;\n\treadonly now?: () => number;\n}): SuiteProfileLockBridge {\n\tconst identity = buildSuiteProfileIdentity(options.suite, options.pluginProfile);\n\tconst diagnostics: string[] = [];\n\tlet verification: ProfileLockVerificationV1 | undefined;\n\tif (options.previousLock !== undefined) {\n\t\tverification = verifyProfileLock(options.previousLock, identity);\n\t\tif (verification.status === \"drift\") {\n\t\t\tdiagnostics.push(`Suite \"${options.suite.id}\" profile lock drift: ${verification.reason}`);\n\t\t} else if (verification.status === \"migration_required\") {\n\t\t\tdiagnostics.push(`Suite \"${options.suite.id}\" profile lock migration required: ${verification.reason}`);\n\t\t}\n\t}\n\tconst lock =\n\t\toptions.previousLock ??\n\t\tcreateProfileLock(identity, {\n\t\t\tlockedBy: options.lockedBy ?? \"suite-loader\",\n\t\t\t...(options.now === undefined ? {} : { now: options.now }),\n\t\t});\n\treturn {\n\t\tidentity,\n\t\tlock,\n\t\t...(verification === undefined ? {} : { verification }),\n\t\tdiagnostics: Object.freeze(diagnostics),\n\t};\n}\n"]}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import type { Api, Model } from "@agent-forge/ai/compat";
|
|
2
|
+
import type { ArtifactRef, JsonValue, ModelMetadata, ModelRef, SessionMetadata, SessionPhase, SessionSnapshot, ThinkingLevel, TranscriptItem } from "@agent-forge/protocol";
|
|
3
|
+
import { type CreateSessionOptions, type MutationResponseStore, PiServer, type PiServerOptions, type PiServerService, type PiSessionArtifactStore, type PiSessionOperationStore, type PiSessionRuntime, type PiSessionRuntimeEvent } from "@agent-forge/server";
|
|
4
|
+
import type { AgentSession } from "../core/agent-session.ts";
|
|
5
|
+
import type { OutputArtifactRef } from "../core/extensions/public-api.ts";
|
|
6
|
+
import { type DurableServiceV1 } from "../durable/durable-service.ts";
|
|
7
|
+
/** Server-visible facts about one durable coding-agent session. */
|
|
8
|
+
export interface CodingAgentSessionDescriptor {
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly name?: string;
|
|
11
|
+
/** Working directory; omitted when unknown (legacy sessions record none). */
|
|
12
|
+
readonly cwd?: string;
|
|
13
|
+
/** Model instance to attach at creation; resolved from the protocol ref by the service. */
|
|
14
|
+
readonly model?: Model<Api>;
|
|
15
|
+
/** Thinking level for the created session. */
|
|
16
|
+
readonly thinkingLevel?: ThinkingLevel;
|
|
17
|
+
/**
|
|
18
|
+
* Optional creation-time profile lock (protocol create `profileId`/
|
|
19
|
+
* `profileVersion`) passed by the remote create command: stored unchanged
|
|
20
|
+
* and echoed in snapshots, never interpreted by the runtime. Persisted in
|
|
21
|
+
* the session header and echoed verbatim in snapshots across restarts;
|
|
22
|
+
* absent when the create command did not carry it.
|
|
23
|
+
*/
|
|
24
|
+
readonly profileId?: string;
|
|
25
|
+
readonly profileVersion?: string;
|
|
26
|
+
readonly createdAt: number;
|
|
27
|
+
readonly updatedAt: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Persistence boundary owned by the host. `create`/`open` hand over exclusive
|
|
31
|
+
* ownership of one `AgentSession` to the server runtime until `dispose()`.
|
|
32
|
+
*/
|
|
33
|
+
export interface CodingAgentServerSessionSource {
|
|
34
|
+
list(): Promise<readonly CodingAgentSessionDescriptor[]>;
|
|
35
|
+
create(descriptor: CodingAgentSessionDescriptor): Promise<AgentSession>;
|
|
36
|
+
open(descriptor: CodingAgentSessionDescriptor): Promise<AgentSession>;
|
|
37
|
+
}
|
|
38
|
+
/** Model catalog projection used for `listModels` and `set_model` resolution. */
|
|
39
|
+
export interface CodingAgentServerModels {
|
|
40
|
+
list(): Promise<readonly ModelMetadata[]>;
|
|
41
|
+
resolve(ref: ModelRef): Promise<Model<Api>>;
|
|
42
|
+
}
|
|
43
|
+
export interface CodingAgentServerAssemblyOptions {
|
|
44
|
+
readonly sessions: CodingAgentServerSessionSource;
|
|
45
|
+
readonly models: CodingAgentServerModels;
|
|
46
|
+
readonly listeners: PiServerOptions["listeners"];
|
|
47
|
+
readonly journal?: PiServerOptions["journal"];
|
|
48
|
+
readonly authenticate?: PiServerOptions["authenticate"];
|
|
49
|
+
readonly authorize?: PiServerOptions["authorize"];
|
|
50
|
+
readonly serverId?: string;
|
|
51
|
+
readonly maxFrameLength?: number;
|
|
52
|
+
readonly handshakeTimeoutMs?: number;
|
|
53
|
+
readonly onError?: (error: Error) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Durable service backing operation and artifact records. Single-instance
|
|
56
|
+
* per store: the writer lease is process-local memory. Omission keeps the
|
|
57
|
+
* server `operations` surface undefined (clients see `durable_unavailable`)
|
|
58
|
+
* and the `artifacts` surface unconfigured (clients see `not_implemented`).
|
|
59
|
+
*/
|
|
60
|
+
readonly durable?: DurableServiceV1;
|
|
61
|
+
/**
|
|
62
|
+
* Writer id claimed on the durable service. Hosts that also pass the same
|
|
63
|
+
* store into their session source (`agentTaskResults.writerId`) supply it
|
|
64
|
+
* here so one writer serves the whole process; omission generates a fresh
|
|
65
|
+
* id (claim/recover behavior is unchanged).
|
|
66
|
+
*/
|
|
67
|
+
readonly writerId?: string;
|
|
68
|
+
/** Executors for submitted operation types; unknown types terminate as rejected. */
|
|
69
|
+
readonly operationExecutors?: readonly CodingAgentOperationExecutor[];
|
|
70
|
+
/** Clock for descriptor timestamps; defaults to the host clock. */
|
|
71
|
+
readonly now?: () => number;
|
|
72
|
+
}
|
|
73
|
+
/** Executes one submitted operation type; the abort signal fires on cancel requests. */
|
|
74
|
+
export interface CodingAgentOperationExecutor {
|
|
75
|
+
readonly operationType: string;
|
|
76
|
+
execute(input: {
|
|
77
|
+
readonly sessionId: string;
|
|
78
|
+
readonly operationId: string;
|
|
79
|
+
readonly input?: JsonValue;
|
|
80
|
+
readonly signal: AbortSignal;
|
|
81
|
+
}): Promise<JsonValue>;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Projects the current `AgentSession` messages onto the protocol transcript.
|
|
85
|
+
* Tool inputs are recovered from the matching assistant `toolCall` content;
|
|
86
|
+
* `null` marks an unrecoverable input instead of fabricating one. `!`-command
|
|
87
|
+
* bash executions project as `bash` tool items. Session-level summary and
|
|
88
|
+
* extension messages (`branchSummary`, `compactionSummary`, `custom`) project
|
|
89
|
+
* as snapshot-only `note` items; they never enter streaming progress. Note
|
|
90
|
+
* items carry the text/summary face only — custom-message `details` and image
|
|
91
|
+
* content parts are not projected. Item ids
|
|
92
|
+
* stay positional (`t-<index>`): they are stable within one revision but not
|
|
93
|
+
* across history rewrites such as compaction.
|
|
94
|
+
*/
|
|
95
|
+
export declare function projectSessionTranscript(session: AgentSession): TranscriptItem[];
|
|
96
|
+
/** Server-side runtime over one exclusively owned coding-agent session. */
|
|
97
|
+
export declare class CodingAgentSessionRuntime implements PiSessionRuntime {
|
|
98
|
+
private readonly session;
|
|
99
|
+
private readonly descriptor;
|
|
100
|
+
private readonly models;
|
|
101
|
+
private readonly listeners;
|
|
102
|
+
private readonly unsubscribe;
|
|
103
|
+
private readonly onDisposed?;
|
|
104
|
+
private disposed;
|
|
105
|
+
constructor(session: AgentSession, descriptor: CodingAgentSessionDescriptor, options?: {
|
|
106
|
+
readonly models?: CodingAgentServerModels;
|
|
107
|
+
readonly onDisposed?: () => void;
|
|
108
|
+
});
|
|
109
|
+
snapshot(): SessionSnapshot;
|
|
110
|
+
getPhase(): SessionPhase;
|
|
111
|
+
prompt(input: {
|
|
112
|
+
readonly text: string;
|
|
113
|
+
}): Promise<void>;
|
|
114
|
+
steer(input: {
|
|
115
|
+
readonly text: string;
|
|
116
|
+
}): Promise<void>;
|
|
117
|
+
abort(): Promise<void>;
|
|
118
|
+
setModel(model: ModelRef): Promise<void>;
|
|
119
|
+
setThinking(thinkingLevel: ThinkingLevel): Promise<void>;
|
|
120
|
+
subscribe(listener: (event: PiSessionRuntimeEvent) => void): () => void;
|
|
121
|
+
dispose(): Promise<void>;
|
|
122
|
+
private assertUsable;
|
|
123
|
+
private onSessionEvent;
|
|
124
|
+
private currentModelRef;
|
|
125
|
+
}
|
|
126
|
+
/** Exclusive `PiServerService` over a coding-agent session source. */
|
|
127
|
+
export declare class CodingAgentServerService implements PiServerService {
|
|
128
|
+
private readonly source;
|
|
129
|
+
private readonly models;
|
|
130
|
+
private readonly now;
|
|
131
|
+
private readonly acquired;
|
|
132
|
+
private readonly opening;
|
|
133
|
+
private readonly durable;
|
|
134
|
+
private readonly executors;
|
|
135
|
+
/** In-memory operation store surface; undefined without a durable service. */
|
|
136
|
+
private readonly operationStore;
|
|
137
|
+
/** In-memory artifact store surface; undefined without a durable service. */
|
|
138
|
+
private readonly artifactStore;
|
|
139
|
+
/** Durable mutation-response store surface; undefined without a durable service. */
|
|
140
|
+
private readonly mutationResponseStore;
|
|
141
|
+
private readonly writerId;
|
|
142
|
+
private leaseReady;
|
|
143
|
+
/** Idempotency key (`sessionId\0key`) -> recorded operation. */
|
|
144
|
+
private readonly idempotencyIndex;
|
|
145
|
+
/** Operation id -> recorded payload snapshot for idempotent acks. */
|
|
146
|
+
private readonly recordedOperations;
|
|
147
|
+
/** Active executor abort controllers by operation id. */
|
|
148
|
+
private readonly inFlight;
|
|
149
|
+
/** Cancel requests observed while the executor was still draining. */
|
|
150
|
+
private readonly cancelRequested;
|
|
151
|
+
constructor(options: {
|
|
152
|
+
readonly sessions: CodingAgentServerSessionSource;
|
|
153
|
+
readonly models: CodingAgentServerModels;
|
|
154
|
+
readonly durable?: DurableServiceV1;
|
|
155
|
+
readonly writerId?: string;
|
|
156
|
+
readonly operationExecutors?: readonly CodingAgentOperationExecutor[];
|
|
157
|
+
readonly now?: () => number;
|
|
158
|
+
});
|
|
159
|
+
/** Remote artifact access; unconfigured without a durable service. */
|
|
160
|
+
get artifacts(): PiSessionArtifactStore | undefined;
|
|
161
|
+
/** Durable operation commands; unconfigured without a durable service. */
|
|
162
|
+
get operations(): PiSessionOperationStore | undefined;
|
|
163
|
+
/** Durable replay of mutation-command responses; unconfigured without a durable service. */
|
|
164
|
+
get mutationResponses(): MutationResponseStore | undefined;
|
|
165
|
+
/**
|
|
166
|
+
* Claims the writer lease at startup. A holder found in restored state
|
|
167
|
+
* belonged to a dead process (snapshot import), so it is recovered; a live
|
|
168
|
+
* foreign writer keeps the lease and this service stays unavailable.
|
|
169
|
+
*/
|
|
170
|
+
private claimWriterLease;
|
|
171
|
+
/**
|
|
172
|
+
* Releases the store writer lease on graceful shutdown (D-067 phase 2 S2)
|
|
173
|
+
* so a successor process can claim immediately. Best-effort: only a held
|
|
174
|
+
* lease is released, and failures are swallowed — a crashed process leaves
|
|
175
|
+
* the lease for the TTL recovery path instead.
|
|
176
|
+
*/
|
|
177
|
+
releaseWriterLease(): void;
|
|
178
|
+
/** Persists one adapter-owned operation record; a lost lease degrades to `durable_unavailable`. */
|
|
179
|
+
private persistOperation;
|
|
180
|
+
private requireDurable;
|
|
181
|
+
/**
|
|
182
|
+
* Rejects operations that were pending when the previous process stopped:
|
|
183
|
+
* no executor survives a crash, so replayed `pending` records are swept to
|
|
184
|
+
* a rejected terminal and their idempotency keys keep returning that
|
|
185
|
+
/**
|
|
186
|
+
* recorded terminal.
|
|
187
|
+
*/
|
|
188
|
+
private sweepInterruptedOperations;
|
|
189
|
+
private recordOperation;
|
|
190
|
+
private submitOperation;
|
|
191
|
+
private executeOperation;
|
|
192
|
+
private toTerminalError;
|
|
193
|
+
private completeOperation;
|
|
194
|
+
private cancelOperation;
|
|
195
|
+
private resultOperation;
|
|
196
|
+
private ackOf;
|
|
197
|
+
/**
|
|
198
|
+
* Mirrors one runtime output artifact into the durable store so remote
|
|
199
|
+
* `artifact_stat`/`artifact_read` can serve it, including after a restart
|
|
200
|
+
* via log replay. The runtime in-memory store (capability-runtime) stays
|
|
201
|
+
* the live write path; this adds durable persistence, not a second store.
|
|
202
|
+
*/
|
|
203
|
+
persistOutputArtifact(sessionId: string, ref: OutputArtifactRef, bytes: Uint8Array): ArtifactRef;
|
|
204
|
+
private statArtifact;
|
|
205
|
+
private readArtifact;
|
|
206
|
+
/**
|
|
207
|
+
* Loads one artifact payload through the durable service.
|
|
208
|
+
*/
|
|
209
|
+
private loadArtifactPayload;
|
|
210
|
+
/**
|
|
211
|
+
* Deterministic artifact id for one mutation-command response, following the
|
|
212
|
+
* `agent-task:<taskId>` precedent for derived artifact ids.
|
|
213
|
+
*/
|
|
214
|
+
private mutationResponseArtifactId;
|
|
215
|
+
private loadMutationResponse;
|
|
216
|
+
private recordMutationResponse;
|
|
217
|
+
listSessions(): Promise<SessionMetadata[]>;
|
|
218
|
+
listModels(): Promise<ModelMetadata[]>;
|
|
219
|
+
createSession(options: CreateSessionOptions): Promise<PiSessionRuntime>;
|
|
220
|
+
openSession(sessionId: string): Promise<PiSessionRuntime>;
|
|
221
|
+
private openExclusively;
|
|
222
|
+
private acquireRuntime;
|
|
223
|
+
private assertNotAcquired;
|
|
224
|
+
}
|
|
225
|
+
/** Composes the coding-agent service with transport, journal, and auth hooks into one server. */
|
|
226
|
+
export declare function assembleCodingAgentServer(options: CodingAgentServerAssemblyOptions): {
|
|
227
|
+
readonly server: PiServer;
|
|
228
|
+
readonly service: CodingAgentServerService;
|
|
229
|
+
};
|
|
230
|
+
//# sourceMappingURL=server-assembly.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-assembly.d.ts","sourceRoot":"","sources":["../../src/remote/server-assembly.ts"],"names":[],"mappings":"AA0CA,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EACX,WAAW,EACX,SAAS,EACT,aAAa,EACb,QAAQ,EAGR,eAAe,EACf,YAAY,EACZ,eAAe,EACf,aAAa,EACb,cAAc,EAEd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,QAAQ,EAER,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAE3B,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,YAAY,EAAqB,MAAM,0BAA0B,CAAC;AAChF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAyB,KAAK,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAE7F,mEAAmE;AACnE,MAAM,WAAW,4BAA4B;IAC5C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,6EAA6E;IAC7E,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,2FAA2F;IAC3F,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAC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CAAC,cAAc;IAOtB;;;;;;OAMG;IACH,OAAO,CAAC,0BAA0B;IAoBlC,OAAO,CAAC,eAAe;YAWT,eAAe;YA0Df,gBAAgB;IA0C9B,OAAO,CAAC,eAAe;IAevB,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,KAAK;IAyBb;;;;;OAKG;IACH,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,iBAAiB,EAAE,KAAK,EAAE,UAAU,GAAG,WAAW,CAuB/F;IAED,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,YAAY;IAuBpB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAiB3B;;;OAGG;IACH,OAAO,CAAC,0BAA0B;YAWpB,oBAAoB;YAgBpB,sBAAsB;IAqB9B,YAAY,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC,CAU/C;IAEK,UAAU,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC,CAE3C;IAEK,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAwD5E;IAEK,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA2B9D;YAGa,eAAe;IAY7B,OAAO,CAAC,cAAc;IAuBtB,OAAO,CAAC,iBAAiB;CAKzB;AAED,iGAAiG;AACjG,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,gCAAgC,GAAG;IACrF,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,wBAAwB,CAAC;CAC3C,CAoBA","sourcesContent":["/**\n * Minimal coding-agent runtime -> remote server assembly (1B.7h).\n *\n * Adapts first-party `AgentSession` instances to the public `@agent-forge/server`\n * session boundary so a preinstalled session adapter can run a deterministic\n * server end to end. The adapter only consumes the public `AgentSession` surface\n * and never reads private session objects.\n *\n * Snapshot transcripts use positional ids (`t-<index>`) that are stable within\n * one revision but not across history rewrites such as compaction; snapshots\n * stay authoritative and durable replay is journal-based, so replay does not\n * depend on these ids. Streaming is reported as snapshot-change notifications;\n * amortized delta progress belongs to a later slice.\n *\n * Durable operations and artifacts (E4-c): when a `DurableServiceV1` is\n * supplied, the service exposes the server `operations`/`artifacts` surfaces as\n * a thin adapter over the durable service — it never creates a second artifact\n * store. Artifact records project the protocol `ArtifactRef` 1:1 onto the SDK\n * `OutputArtifactRef` and carry base64 bytes so remote `artifact_stat` /\n * `artifact_read` survive restarts via the durable log replay; the runtime\n * in-memory artifact store remains the live write path (built in\n * capability-runtime). Keyed mutation commands (`operationId` on prompt/steer/\n * abort/set_model/set_thinking) persist their successful response snapshots as\n * deterministic `mutation-response:<sessionId>:<operationId>` artifact records\n * so a retry after a restart replays the recorded response; the server's\n * in-process LRU stays the live dedup path. Without a durable service the\n * surfaces stay undefined and the server answers `durable_unavailable` /\n * `not_implemented` explicitly.\n *\n * Deployment boundary: the durable writer lease is process-local memory. This\n * assembly is single-instance per durable store — the durable backend's file\n * writes are cross-process mutually exclusive (its `.lock`), while the writer\n * lease single-instance semantics remain process-local: who should claim the\n * lease still needs deployment-level coordination. On\n * startup the service claims the writer lease and, when the restored state\n * marks a dead writer (snapshot import), recovers it; a live foreign writer\n * keeps the service unavailable instead of fighting over the lease. Operations\n * left pending by a crashed process are swept to a rejected terminal so no\n * submitted operation can hang as `accepted` forever.\n */\nimport { Buffer } from \"node:buffer\";\nimport { randomUUID } from \"node:crypto\";\nimport type { Api, Model } from \"@agent-forge/ai/compat\";\nimport type {\n\tArtifactRef,\n\tJsonValue,\n\tModelMetadata,\n\tModelRef,\n\tProtocolError,\n\tProtocolErrorCode,\n\tSessionMetadata,\n\tSessionPhase,\n\tSessionSnapshot,\n\tThinkingLevel,\n\tTranscriptItem,\n\tUsage,\n} from \"@agent-forge/protocol\";\nimport {\n\ttype CreateSessionOptions,\n\ttype MutationResponseStore,\n\tPiServer,\n\tPiServerError,\n\ttype PiServerOptions,\n\ttype PiServerService,\n\ttype PiSessionArtifactStore,\n\ttype PiSessionOperationAck,\n\ttype PiSessionOperationStore,\n\ttype PiSessionRuntime,\n\ttype PiSessionRuntimeEvent,\n} from \"@agent-forge/server\";\nimport type { AgentSession, AgentSessionEvent } from \"../core/agent-session.ts\";\nimport type { OutputArtifactRef } from \"../core/extensions/public-api.ts\";\nimport { DurableServiceErrorV1, type DurableServiceV1 } from \"../durable/durable-service.ts\";\n\n/** Server-visible facts about one durable coding-agent session. */\nexport interface CodingAgentSessionDescriptor {\n\treadonly id: string;\n\treadonly name?: string;\n\t/** Working directory; omitted when unknown (legacy sessions record none). */\n\treadonly cwd?: string;\n\t/** Model instance to attach at creation; resolved from the protocol ref by the service. */\n\treadonly model?: Model<Api>;\n\t/** Thinking level for the created session. */\n\treadonly thinkingLevel?: ThinkingLevel;\n\t/**\n\t * Optional creation-time profile lock (protocol create `profileId`/\n\t * `profileVersion`) passed by the remote create command: stored unchanged\n\t * and echoed in snapshots, never interpreted by the runtime. Persisted in\n\t * the session header and echoed verbatim in snapshots across restarts;\n\t * absent when the create command did not carry it.\n\t */\n\treadonly profileId?: string;\n\treadonly profileVersion?: string;\n\treadonly createdAt: number;\n\treadonly updatedAt: number;\n}\n\n/**\n * Persistence boundary owned by the host. `create`/`open` hand over exclusive\n * ownership of one `AgentSession` to the server runtime until `dispose()`.\n */\nexport interface CodingAgentServerSessionSource {\n\tlist(): Promise<readonly CodingAgentSessionDescriptor[]>;\n\tcreate(descriptor: CodingAgentSessionDescriptor): Promise<AgentSession>;\n\topen(descriptor: CodingAgentSessionDescriptor): Promise<AgentSession>;\n}\n\n/** Model catalog projection used for `listModels` and `set_model` resolution. */\nexport interface CodingAgentServerModels {\n\tlist(): Promise<readonly ModelMetadata[]>;\n\tresolve(ref: ModelRef): Promise<Model<Api>>;\n}\n\nexport interface CodingAgentServerAssemblyOptions {\n\treadonly sessions: CodingAgentServerSessionSource;\n\treadonly models: CodingAgentServerModels;\n\treadonly listeners: PiServerOptions[\"listeners\"];\n\treadonly journal?: PiServerOptions[\"journal\"];\n\treadonly authenticate?: PiServerOptions[\"authenticate\"];\n\treadonly authorize?: PiServerOptions[\"authorize\"];\n\treadonly serverId?: string;\n\treadonly maxFrameLength?: number;\n\treadonly handshakeTimeoutMs?: number;\n\treadonly onError?: (error: Error) => void;\n\t/**\n\t * Durable service backing operation and artifact records. Single-instance\n\t * per store: the writer lease is process-local memory. Omission keeps the\n\t * server `operations` surface undefined (clients see `durable_unavailable`)\n\t * and the `artifacts` surface unconfigured (clients see `not_implemented`).\n\t */\n\treadonly durable?: DurableServiceV1;\n\t/**\n\t * Writer id claimed on the durable service. Hosts that also pass the same\n\t * store into their session source (`agentTaskResults.writerId`) supply it\n\t * here so one writer serves the whole process; omission generates a fresh\n\t * id (claim/recover behavior is unchanged).\n\t */\n\treadonly writerId?: string;\n\t/** Executors for submitted operation types; unknown types terminate as rejected. */\n\treadonly operationExecutors?: readonly CodingAgentOperationExecutor[];\n\t/** Clock for descriptor timestamps; defaults to the host clock. */\n\treadonly now?: () => number;\n}\n\nfunction requireIdle(session: AgentSession, action: string): void {\n\tif (!session.isIdle) {\n\t\tthrow new PiServerError(\"busy\", `Cannot ${action} while the session is busy`);\n\t}\n}\n\nfunction toError(error: unknown): PiServerError {\n\tif (error instanceof PiServerError) return error;\n\tconst message = error instanceof Error ? error.message : String(error);\n\tif (/reload in progress/i.test(message)) return new PiServerError(\"busy\", message);\n\tif (/compaction is in progress/i.test(message)) return new PiServerError(\"busy\", message);\n\tif (/already processing/i.test(message)) return new PiServerError(\"busy\", message);\n\t// Operational session failures (missing credentials, no active model,\n\t// extension rejections) must reach the remote client with their original\n\t// message instead of being folded into an unspecific internal error.\n\treturn new PiServerError(\"invalid_request\", message);\n}\n\nfunction jsonSafe(value: unknown): boolean {\n\tif (value === null || typeof value === \"string\" || typeof value === \"boolean\") return true;\n\tif (typeof value === \"number\") return Number.isFinite(value);\n\tif (Array.isArray(value)) return value.every(jsonSafe);\n\tif (typeof value !== \"object\" || Object.getPrototypeOf(value) !== Object.prototype) return false;\n\treturn Object.values(value).every(jsonSafe);\n}\n\n/** Payload stored in `DurableOperationRecordV1.data`. Adapter-owned shape. */\ninterface DurableOperationPayloadV1 {\n\treadonly status: \"pending\" | \"completed\" | \"rejected\";\n\treadonly sessionId: string;\n\treadonly operationType: string;\n\treadonly idempotencyKey?: string;\n\treadonly result?: JsonValue;\n\treadonly error?: { readonly code: ProtocolErrorCode; readonly message: string };\n\treadonly submittedAt: number;\n\treadonly terminalAt?: number;\n}\n\n/** Payload stored in `DurableArtifactRecordV1.data`. Adapter-owned shape. */\ninterface DurableArtifactPayloadV1 {\n\treadonly ref: OutputArtifactRef;\n\t/** Base64 artifact bytes so records survive the JSONL log replay. */\n\treadonly bytes: string;\n}\n\n/** An operation id paired with its latest recorded payload snapshot. */\ninterface RecordedOperation {\n\treadonly operationId: string;\n\treadonly payload: DurableOperationPayloadV1;\n}\n\n/** Parses an adapter-owned operation payload; undefined for foreign or malformed records. */\nfunction parseOperationPayload(value: unknown): DurableOperationPayloadV1 | undefined {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) return undefined;\n\tconst record = value as Record<string, unknown>;\n\tif (record.status !== \"pending\" && record.status !== \"completed\" && record.status !== \"rejected\") return undefined;\n\tif (typeof record.sessionId !== \"string\" || record.sessionId === \"\") return undefined;\n\tif (typeof record.operationType !== \"string\") return undefined;\n\tif (typeof record.submittedAt !== \"number\" || !Number.isFinite(record.submittedAt)) return undefined;\n\tlet error: DurableOperationPayloadV1[\"error\"];\n\tif (record.error !== undefined) {\n\t\tif (typeof record.error !== \"object\" || record.error === null || Array.isArray(record.error)) return undefined;\n\t\tconst entry = record.error as Record<string, unknown>;\n\t\tif (typeof entry.code !== \"string\" || typeof entry.message !== \"string\") return undefined;\n\t\terror = { code: entry.code as ProtocolErrorCode, message: entry.message };\n\t}\n\treturn {\n\t\tstatus: record.status,\n\t\tsessionId: record.sessionId,\n\t\toperationType: record.operationType,\n\t\t...(typeof record.idempotencyKey === \"string\" ? { idempotencyKey: record.idempotencyKey } : {}),\n\t\t...(record.result === undefined ? {} : { result: record.result as JsonValue }),\n\t\t...(error === undefined ? {} : { error }),\n\t\tsubmittedAt: record.submittedAt,\n\t\t...(typeof record.terminalAt === \"number\" ? { terminalAt: record.terminalAt } : {}),\n\t};\n}\n\n/** Parses an adapter-owned artifact payload; undefined for foreign or malformed records. */\nfunction parseArtifactPayload(value: unknown): DurableArtifactPayloadV1 | undefined {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) return undefined;\n\tconst record = value as Record<string, unknown>;\n\tconst ref = record.ref;\n\tif (typeof ref !== \"object\" || ref === null || Array.isArray(ref)) return undefined;\n\tconst entry = ref as Record<string, unknown>;\n\tif (\n\t\ttypeof entry.sessionId !== \"string\" ||\n\t\ttypeof entry.operationId !== \"string\" ||\n\t\ttypeof entry.artifactId !== \"string\" ||\n\t\ttypeof entry.kind !== \"string\" ||\n\t\ttypeof entry.mediaType !== \"string\" ||\n\t\ttypeof entry.truncated !== \"boolean\" ||\n\t\ttypeof entry.createdAt !== \"number\" ||\n\t\ttypeof record.bytes !== \"string\"\n\t) {\n\t\treturn undefined;\n\t}\n\treturn {\n\t\tref: {\n\t\t\tsessionId: entry.sessionId,\n\t\t\toperationId: entry.operationId,\n\t\t\tartifactId: entry.artifactId,\n\t\t\tkind: entry.kind,\n\t\t\tmediaType: entry.mediaType,\n\t\t\t...(typeof entry.sizeBytes === \"number\" ? { sizeBytes: entry.sizeBytes } : {}),\n\t\t\ttruncated: entry.truncated,\n\t\t\tcreatedAt: entry.createdAt,\n\t\t},\n\t\tbytes: record.bytes,\n\t};\n}\n\n/**\n * Parses a stored mutation-response payload; undefined for foreign or\n * malformed records. The required-field assertion is deliberately minimal: the\n * full `SessionSnapshot` shape is already enforced by the wire codec when the\n * replayed snapshot is encoded into a response, so a damaged record only needs\n * to fail this check to fall back to a fresh execution.\n */\nfunction parseMutationResponsePayload(value: unknown, sessionId: string): SessionSnapshot | undefined {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) return undefined;\n\tconst record = value as Record<string, unknown>;\n\tif (\n\t\trecord.id !== sessionId ||\n\t\ttypeof record.cwd !== \"string\" ||\n\t\trecord.cwd === \"\" ||\n\t\ttypeof record.revision !== \"number\" ||\n\t\t!Number.isInteger(record.revision) ||\n\t\trecord.revision < 0 ||\n\t\t!Array.isArray(record.transcript)\n\t) {\n\t\treturn undefined;\n\t}\n\treturn value as SessionSnapshot;\n}\n\n/** Protocol `ArtifactRef` is a 1:1 projection of the SDK `OutputArtifactRef`. */\nfunction toProtocolArtifactRef(ref: OutputArtifactRef): ArtifactRef {\n\treturn {\n\t\tsessionId: ref.sessionId,\n\t\toperationId: ref.operationId,\n\t\tartifactId: ref.artifactId,\n\t\tkind: ref.kind,\n\t\tmediaType: ref.mediaType,\n\t\t...(ref.sizeBytes === undefined ? {} : { sizeBytes: ref.sizeBytes }),\n\t\ttruncated: ref.truncated,\n\t\tcreatedAt: ref.createdAt,\n\t};\n}\n\n/** Executes one submitted operation type; the abort signal fires on cancel requests. */\nexport interface CodingAgentOperationExecutor {\n\treadonly operationType: string;\n\texecute(input: {\n\t\treadonly sessionId: string;\n\t\treadonly operationId: string;\n\t\treadonly input?: JsonValue;\n\t\treadonly signal: AbortSignal;\n\t}): Promise<JsonValue>;\n}\n\nfunction projectUsage(usage: unknown): Usage | undefined {\n\tif (!usage || typeof usage !== \"object\" || Array.isArray(usage)) return undefined;\n\tconst record = usage as Record<string, unknown>;\n\tconst readCount = (key: string): number | undefined => {\n\t\tconst value = record[key];\n\t\treturn typeof value === \"number\" && Number.isFinite(value) ? Math.max(0, Math.trunc(value)) : undefined;\n\t};\n\tconst input = readCount(\"input\");\n\tconst output = readCount(\"output\");\n\tconst cacheRead = readCount(\"cacheRead\");\n\tconst cacheWrite = readCount(\"cacheWrite\");\n\tconst totalTokens = readCount(\"totalTokens\");\n\tif (input === undefined || output === undefined || cacheRead === undefined || cacheWrite === undefined) {\n\t\treturn undefined;\n\t}\n\tif (totalTokens === undefined) return undefined;\n\tconst cost = record.cost;\n\tif (!cost || typeof cost !== \"object\" || Array.isArray(cost)) return undefined;\n\tconst costRecord = cost as Record<string, unknown>;\n\tconst readCost = (key: string): number | undefined => {\n\t\tconst value = costRecord[key];\n\t\treturn typeof value === \"number\" && Number.isFinite(value) ? value : undefined;\n\t};\n\tconst costInput = readCost(\"input\");\n\tconst costOutput = readCost(\"output\");\n\tconst costCacheRead = readCost(\"cacheRead\");\n\tconst costCacheWrite = readCost(\"cacheWrite\");\n\tconst costTotal = readCost(\"total\");\n\tif (\n\t\tcostInput === undefined ||\n\t\tcostOutput === undefined ||\n\t\tcostCacheRead === undefined ||\n\t\tcostCacheWrite === undefined ||\n\t\tcostTotal === undefined\n\t) {\n\t\treturn undefined;\n\t}\n\tconst reasoning = readCount(\"reasoning\");\n\treturn {\n\t\tinput,\n\t\toutput,\n\t\tcacheRead,\n\t\tcacheWrite,\n\t\t...(reasoning === undefined ? {} : { reasoning }),\n\t\ttotalTokens,\n\t\tcost: {\n\t\t\tinput: costInput,\n\t\t\toutput: costOutput,\n\t\t\tcacheRead: costCacheRead,\n\t\t\tcacheWrite: costCacheWrite,\n\t\t\ttotal: costTotal,\n\t\t},\n\t};\n}\n\ntype ImagePart = { type: \"image\"; data: string; mimeType: string };\ntype TextPart = { type: \"text\"; text: string };\n\nfunction projectUserContent(content: string | readonly unknown[]): Array<TextPart | ImagePart> {\n\tif (typeof content === \"string\") return [{ type: \"text\", text: content }];\n\tconst projected: Array<TextPart | ImagePart> = [];\n\tfor (const part of content) {\n\t\tif (!part || typeof part !== \"object\") continue;\n\t\tconst record = part as Record<string, unknown>;\n\t\tif (record.type === \"text\" && typeof record.text === \"string\") {\n\t\t\tprojected.push({ type: \"text\", text: record.text });\n\t\t} else if (record.type === \"image\" && typeof record.data === \"string\" && typeof record.mimeType === \"string\") {\n\t\t\tprojected.push({ type: \"image\", data: record.data, mimeType: record.mimeType });\n\t\t}\n\t}\n\treturn projected;\n}\n\nfunction projectToolResultContent(content: readonly unknown[]): Array<TextPart | ImagePart> {\n\treturn projectUserContent(content);\n}\n\n/**\n * Projects the current `AgentSession` messages onto the protocol transcript.\n * Tool inputs are recovered from the matching assistant `toolCall` content;\n * `null` marks an unrecoverable input instead of fabricating one. `!`-command\n * bash executions project as `bash` tool items. Session-level summary and\n * extension messages (`branchSummary`, `compactionSummary`, `custom`) project\n * as snapshot-only `note` items; they never enter streaming progress. Note\n * items carry the text/summary face only — custom-message `details` and image\n * content parts are not projected. Item ids\n * stay positional (`t-<index>`): they are stable within one revision but not\n * across history rewrites such as compaction.\n */\nexport function projectSessionTranscript(session: AgentSession): TranscriptItem[] {\n\tconst messages = session.messages;\n\tconst toolInputs = new Map<string, JsonValue>();\n\tfor (const message of messages) {\n\t\tif (message.role !== \"assistant\") continue;\n\t\tfor (const part of message.content) {\n\t\t\tif (part.type === \"toolCall\") toolInputs.set(part.id, part.arguments as JsonValue);\n\t\t}\n\t}\n\tconst items: TranscriptItem[] = [];\n\tfor (const message of messages) {\n\t\tconst id = `t-${items.length}`;\n\t\tconst timestamp = Math.max(0, Math.trunc(message.timestamp));\n\t\tif (message.role === \"user\") {\n\t\t\titems.push({\n\t\t\t\tid,\n\t\t\t\trole: \"user\",\n\t\t\t\tcontent: projectUserContent(message.content),\n\t\t\t\ttimestamp,\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (message.role === \"toolResult\") {\n\t\t\tconst input = toolInputs.get(message.toolCallId);\n\t\t\tconst usage = projectUsage(message.usage);\n\t\t\tconst details = jsonSafe(message.details) ? (message.details as JsonValue) : undefined;\n\t\t\tconst base = {\n\t\t\t\tid,\n\t\t\t\trole: \"tool\" as const,\n\t\t\t\ttoolCallId: message.toolCallId,\n\t\t\t\ttoolName: message.toolName,\n\t\t\t\tinput: input !== undefined && jsonSafe(input) ? input : null,\n\t\t\t\tcontent: projectToolResultContent(message.content),\n\t\t\t\t...(details === undefined ? {} : { details }),\n\t\t\t\t...(usage === undefined ? {} : { usage }),\n\t\t\t\ttimestamp,\n\t\t\t};\n\t\t\tif (message.isError) {\n\t\t\t\tconst item: TranscriptItem = { ...base, status: \"error\", isError: true };\n\t\t\t\titems.push(item);\n\t\t\t} else {\n\t\t\t\tconst item: TranscriptItem = { ...base, status: \"complete\", isError: false };\n\t\t\t\titems.push(item);\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tif (message.role === \"bashExecution\") {\n\t\t\tconst failed = message.cancelled || (message.exitCode !== undefined && message.exitCode !== 0);\n\t\t\tconst base = {\n\t\t\t\tid,\n\t\t\t\trole: \"tool\" as const,\n\t\t\t\ttoolCallId: `bash-${id}`,\n\t\t\t\ttoolName: \"bash\",\n\t\t\t\tinput: { command: message.command } satisfies JsonValue,\n\t\t\t\tcontent: [{ type: \"text\" as const, text: message.output }],\n\t\t\t\tdetails: {\n\t\t\t\t\texitCode: message.exitCode ?? null,\n\t\t\t\t\tcancelled: message.cancelled,\n\t\t\t\t\ttruncated: message.truncated,\n\t\t\t\t} satisfies JsonValue,\n\t\t\t\ttimestamp,\n\t\t\t};\n\t\t\tif (failed) {\n\t\t\t\tconst item: TranscriptItem = { ...base, status: \"error\", isError: true };\n\t\t\t\titems.push(item);\n\t\t\t} else {\n\t\t\t\tconst item: TranscriptItem = { ...base, status: \"complete\", isError: false };\n\t\t\t\titems.push(item);\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tif (message.role === \"branchSummary\") {\n\t\t\titems.push({\n\t\t\t\tid,\n\t\t\t\trole: \"note\",\n\t\t\t\tkind: \"branchSummary\",\n\t\t\t\ttext: message.summary,\n\t\t\t\tfromId: message.fromId,\n\t\t\t\ttimestamp,\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (message.role === \"compactionSummary\") {\n\t\t\titems.push({\n\t\t\t\tid,\n\t\t\t\trole: \"note\",\n\t\t\t\tkind: \"compactionSummary\",\n\t\t\t\ttext: message.summary,\n\t\t\t\ttokensBefore: Math.max(0, Math.trunc(message.tokensBefore)),\n\t\t\t\ttimestamp,\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (message.role === \"custom\") {\n\t\t\tconst text =\n\t\t\t\ttypeof message.content === \"string\"\n\t\t\t\t\t? message.content\n\t\t\t\t\t: message.content\n\t\t\t\t\t\t\t.filter((part) => part.type === \"text\")\n\t\t\t\t\t\t\t.map((part) => part.text)\n\t\t\t\t\t\t\t.join(\"\\n\");\n\t\t\titems.push({\n\t\t\t\tid,\n\t\t\t\trole: \"note\",\n\t\t\t\tkind: \"custom\",\n\t\t\t\ttext,\n\t\t\t\tcustomType: message.customType,\n\t\t\t\tdisplay: message.display,\n\t\t\t\ttimestamp,\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (message.role !== \"assistant\") continue;\n\t\tconst streaming = session.isStreaming && message === messages.at(-1);\n\t\tconst content: Array<\n\t\t\t| { type: \"text\"; text: string }\n\t\t\t| { type: \"thinking\"; thinking: string; redacted?: boolean }\n\t\t\t| { type: \"toolCall\"; toolCallId: string; toolName: string; input: JsonValue }\n\t\t> = message.content.map((part) => {\n\t\t\tif (part.type === \"text\") return { type: \"text\", text: part.text };\n\t\t\tif (part.type === \"thinking\") {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"thinking\",\n\t\t\t\t\tthinking: part.thinking,\n\t\t\t\t\t...(part.redacted === undefined ? {} : { redacted: part.redacted }),\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\ttype: \"toolCall\",\n\t\t\t\ttoolCallId: part.id,\n\t\t\t\ttoolName: part.name,\n\t\t\t\tinput: part.arguments as JsonValue,\n\t\t\t};\n\t\t});\n\t\tconst usage = projectUsage(message.usage);\n\t\tconst common = {\n\t\t\tid,\n\t\t\trole: \"assistant\" as const,\n\t\t\tcontent,\n\t\t\tmodel: { provider: message.provider, id: message.model } satisfies ModelRef,\n\t\t\t...(message.responseModel ? { responseModel: message.responseModel } : {}),\n\t\t\t...(usage === undefined ? {} : { usage }),\n\t\t\ttimestamp,\n\t\t};\n\t\tif (streaming || message.stopReason === \"pending\" || message.stopReason === \"deferred\") {\n\t\t\tconst item: TranscriptItem = { ...common, status: \"streaming\" };\n\t\t\titems.push(item);\n\t\t} else if (message.stopReason === \"error\") {\n\t\t\tconst item: TranscriptItem = {\n\t\t\t\t...common,\n\t\t\t\tstatus: \"error\",\n\t\t\t\tstopReason: \"error\",\n\t\t\t\t...(message.errorMessage ? { errorMessage: message.errorMessage } : {}),\n\t\t\t};\n\t\t\titems.push(item);\n\t\t} else if (message.stopReason === \"aborted\") {\n\t\t\tconst item: TranscriptItem = {\n\t\t\t\t...common,\n\t\t\t\tstatus: \"aborted\",\n\t\t\t\tstopReason: \"aborted\",\n\t\t\t\t...(message.errorMessage ? { errorMessage: message.errorMessage } : {}),\n\t\t\t};\n\t\t\titems.push(item);\n\t\t} else {\n\t\t\tconst item: TranscriptItem = { ...common, status: \"complete\", stopReason: message.stopReason };\n\t\t\titems.push(item);\n\t\t}\n\t}\n\treturn items;\n}\n\nfunction sessionPhase(session: AgentSession): SessionPhase {\n\tif (session.isCompacting) return \"compaction\";\n\tif (session.isStreaming) return \"turn\";\n\treturn \"idle\";\n}\n\n/** Server-side runtime over one exclusively owned coding-agent session. */\nexport class CodingAgentSessionRuntime implements PiSessionRuntime {\n\tprivate readonly session: AgentSession;\n\tprivate readonly descriptor: CodingAgentSessionDescriptor;\n\tprivate readonly models: CodingAgentServerModels;\n\tprivate readonly listeners = new Set<(event: PiSessionRuntimeEvent) => void>();\n\tprivate readonly unsubscribe: () => void;\n\tprivate readonly onDisposed?: () => void;\n\tprivate disposed = false;\n\n\tconstructor(\n\t\tsession: AgentSession,\n\t\tdescriptor: CodingAgentSessionDescriptor,\n\t\toptions?: { readonly models?: CodingAgentServerModels; readonly onDisposed?: () => void },\n\t) {\n\t\tthis.session = session;\n\t\tthis.descriptor = descriptor;\n\t\tthis.models = options?.models ?? {\n\t\t\tlist: async () => [],\n\t\t\tresolve: () => {\n\t\t\t\tthrow new PiServerError(\"not_implemented\", \"Model resolution is not configured\");\n\t\t\t},\n\t\t};\n\t\tthis.onDisposed = options?.onDisposed;\n\t\tthis.unsubscribe = session.subscribe((event: AgentSessionEvent) => this.onSessionEvent(event));\n\t}\n\n\tsnapshot(): SessionSnapshot {\n\t\tconst queuedSteer = this.session.getSteeringMessages();\n\t\tconst name = this.session.sessionName ?? this.descriptor.name;\n\t\treturn {\n\t\t\tid: this.descriptor.id,\n\t\t\t...(name === undefined ? {} : { name }),\n\t\t\t// The protocol requires a non-empty snapshot cwd. This runtime only\n\t\t\t// describes acquired sessions: creates validate a non-empty cwd and\n\t\t\t// opens fall back to a non-empty cwd inside the source, so the\n\t\t\t// SessionManager cwd is the authoritative value when the descriptor\n\t\t\t// carries none (legacy sessions record no cwd).\n\t\t\tcwd: this.descriptor.cwd ?? this.session.sessionManager.getCwd(),\n\t\t\tcreatedAt: this.descriptor.createdAt,\n\t\t\tupdatedAt: this.descriptor.updatedAt,\n\t\t\tphase: sessionPhase(this.session),\n\t\t\tmodel: this.currentModelRef(),\n\t\t\tthinkingLevel: this.session.thinkingLevel,\n\t\t\t...(this.descriptor.profileId === undefined ? {} : { profileId: this.descriptor.profileId }),\n\t\t\t...(this.descriptor.profileVersion === undefined ? {} : { profileVersion: this.descriptor.profileVersion }),\n\t\t\tattached: false,\n\t\t\tlocked: false,\n\t\t\t// Durable revision: the SessionManager entry sequence. It survives\n\t\t\t// reopen and only advances when a persisted entry lands.\n\t\t\trevision: this.session.getRevision().sequence,\n\t\t\ttranscript: projectSessionTranscript(this.session),\n\t\t\tqueuedSteer: queuedSteer.map((text, index) => ({\n\t\t\t\tid: `steer-${index}`,\n\t\t\t\trole: \"user\" as const,\n\t\t\t\tcontent: [{ type: \"text\" as const, text }],\n\t\t\t\ttimestamp: this.descriptor.updatedAt,\n\t\t\t})),\n\t\t\tqueuedSteerCount: queuedSteer.length,\n\t\t};\n\t}\n\n\tgetPhase(): SessionPhase {\n\t\treturn sessionPhase(this.session);\n\t}\n\n\tasync prompt(input: { readonly text: string }): Promise<void> {\n\t\tthis.assertUsable();\n\t\trequireIdle(this.session, \"submit a prompt\");\n\t\ttry {\n\t\t\tawait this.session.prompt(input.text);\n\t\t} catch (error) {\n\t\t\tthrow toError(error);\n\t\t}\n\t}\n\n\tasync steer(input: { readonly text: string }): Promise<void> {\n\t\tthis.assertUsable();\n\t\tif (this.session.isIdle) {\n\t\t\tthrow new PiServerError(\"busy\", \"There is no active prompt to steer\");\n\t\t}\n\t\ttry {\n\t\t\tawait this.session.steer(input.text);\n\t\t} catch (error) {\n\t\t\tthrow toError(error);\n\t\t}\n\t}\n\n\tasync abort(): Promise<void> {\n\t\tthis.assertUsable();\n\t\ttry {\n\t\t\tawait this.session.abort();\n\t\t} catch (error) {\n\t\t\tthrow toError(error);\n\t\t}\n\t}\n\n\tasync setModel(model: ModelRef): Promise<void> {\n\t\tthis.assertUsable();\n\t\trequireIdle(this.session, \"change the model\");\n\t\tlet resolved: Model<Api>;\n\t\ttry {\n\t\t\tresolved = await this.models.resolve(model);\n\t\t\tawait this.session.setModel(resolved);\n\t\t} catch (error) {\n\t\t\tthrow toError(error);\n\t\t}\n\t}\n\n\tasync setThinking(thinkingLevel: ThinkingLevel): Promise<void> {\n\t\tthis.assertUsable();\n\t\trequireIdle(this.session, \"change the thinking level\");\n\t\ttry {\n\t\t\tthis.session.setThinkingLevel(thinkingLevel);\n\t\t} catch (error) {\n\t\t\tthrow toError(error);\n\t\t}\n\t}\n\n\tsubscribe(listener: (event: PiSessionRuntimeEvent) => void): () => void {\n\t\tthis.listeners.add(listener);\n\t\treturn () => this.listeners.delete(listener);\n\t}\n\n\tasync dispose(): Promise<void> {\n\t\tif (this.disposed) return;\n\t\tthis.disposed = true;\n\t\tthis.unsubscribe();\n\t\ttry {\n\t\t\tawait this.session.dispose();\n\t\t} finally {\n\t\t\tthis.onDisposed?.();\n\t\t}\n\t}\n\n\tprivate assertUsable(): void {\n\t\tif (this.disposed) throw new PiServerError(\"invalid_request\", \"Session runtime is disposed\");\n\t}\n\n\tprivate onSessionEvent(_event: AgentSessionEvent): void {\n\t\t// Every event still broadcasts a snapshot, but the revision value is the\n\t\t// durable SessionManager sequence: events that persist no entry keep the\n\t\t// same revision number. Clients accept equal-revision snapshots (only\n\t\t// regressions are dropped), so no state is lost.\n\t\tfor (const listener of [...this.listeners]) {\n\t\t\ttry {\n\t\t\t\tlistener({ type: \"snapshot\" });\n\t\t\t} catch {\n\t\t\t\t// Snapshot observers must not affect the session.\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate currentModelRef(): ModelRef {\n\t\tconst model = this.session.model;\n\t\t// Defensive layer: the create/open preflights reject model-less sessions,\n\t\t// so a live runtime always has a model. A residual model-less runtime must\n\t\t// still fail diagnosably instead of surfacing as an unspecific internal\n\t\t// error through snapshot projection.\n\t\tif (!model) throw new PiServerError(\"invalid_request\", \"Session has no active model\");\n\t\treturn { provider: model.provider, id: model.id };\n\t}\n}\n\n/** Exclusive `PiServerService` over a coding-agent session source. */\nexport class CodingAgentServerService implements PiServerService {\n\tprivate readonly source: CodingAgentServerSessionSource;\n\tprivate readonly models: CodingAgentServerModels;\n\tprivate readonly now: () => number;\n\tprivate readonly acquired = new Map<string, CodingAgentSessionRuntime>();\n\tprivate readonly opening = new Set<string>();\n\tprivate readonly durable: DurableServiceV1 | undefined;\n\tprivate readonly executors = new Map<string, CodingAgentOperationExecutor>();\n\t/** In-memory operation store surface; undefined without a durable service. */\n\tprivate readonly operationStore: PiSessionOperationStore | undefined;\n\t/** In-memory artifact store surface; undefined without a durable service. */\n\tprivate readonly artifactStore: PiSessionArtifactStore | undefined;\n\t/** Durable mutation-response store surface; undefined without a durable service. */\n\tprivate readonly mutationResponseStore: MutationResponseStore | undefined;\n\tprivate readonly writerId: string | undefined;\n\tprivate leaseReady = false;\n\t/** Idempotency key (`sessionId\\0key`) -> recorded operation. */\n\tprivate readonly idempotencyIndex = new Map<string, RecordedOperation>();\n\t/** Operation id -> recorded payload snapshot for idempotent acks. */\n\tprivate readonly recordedOperations = new Map<string, RecordedOperation>();\n\t/** Active executor abort controllers by operation id. */\n\tprivate readonly inFlight = new Map<string, AbortController>();\n\t/** Cancel requests observed while the executor was still draining. */\n\tprivate readonly cancelRequested = new Set<string>();\n\n\tconstructor(options: {\n\t\treadonly sessions: CodingAgentServerSessionSource;\n\t\treadonly models: CodingAgentServerModels;\n\t\treadonly durable?: DurableServiceV1;\n\t\treadonly writerId?: string;\n\t\treadonly operationExecutors?: readonly CodingAgentOperationExecutor[];\n\t\treadonly now?: () => number;\n\t}) {\n\t\tthis.source = options.sessions;\n\t\tthis.models = options.models;\n\t\tthis.now = options.now ?? (() => Date.now());\n\t\tfor (const executor of options.operationExecutors ?? []) this.executors.set(executor.operationType, executor);\n\t\tif (options.durable) {\n\t\t\tthis.durable = options.durable;\n\t\t\tthis.writerId = options.writerId ?? randomUUID();\n\t\t\tthis.claimWriterLease();\n\t\t\tif (this.leaseReady) this.sweepInterruptedOperations();\n\t\t\tthis.operationStore = {\n\t\t\t\tsubmit: (input) => this.submitOperation(input),\n\t\t\t\tcancel: (input) => this.cancelOperation(input),\n\t\t\t\tresult: (input) => this.resultOperation(input),\n\t\t\t};\n\t\t\tthis.artifactStore = {\n\t\t\t\tstat: (sessionId, artifactId) => this.statArtifact(sessionId, artifactId),\n\t\t\t\tread: (sessionId, artifactId, readerOptions) => this.readArtifact(sessionId, artifactId, readerOptions),\n\t\t\t};\n\t\t\tthis.mutationResponseStore = {\n\t\t\t\tload: (sessionId, operationId) => this.loadMutationResponse(sessionId, operationId),\n\t\t\t\trecord: (sessionId, operationId, snapshot) => this.recordMutationResponse(sessionId, operationId, snapshot),\n\t\t\t};\n\t\t}\n\t}\n\n\t/** Remote artifact access; unconfigured without a durable service. */\n\tget artifacts(): PiSessionArtifactStore | undefined {\n\t\treturn this.artifactStore;\n\t}\n\n\t/** Durable operation commands; unconfigured without a durable service. */\n\tget operations(): PiSessionOperationStore | undefined {\n\t\treturn this.operationStore;\n\t}\n\n\t/** Durable replay of mutation-command responses; unconfigured without a durable service. */\n\tget mutationResponses(): MutationResponseStore | undefined {\n\t\treturn this.mutationResponseStore;\n\t}\n\n\t// -------------------------------------------------------------------------\n\t// Durable writer lease (single-instance boundary)\n\t// -------------------------------------------------------------------------\n\n\t/**\n\t * Claims the writer lease at startup. A holder found in restored state\n\t * belonged to a dead process (snapshot import), so it is recovered; a live\n\t * foreign writer keeps the lease and this service stays unavailable.\n\t */\n\tprivate claimWriterLease(): void {\n\t\tconst durable = this.durable;\n\t\tconst writerId = this.writerId;\n\t\tif (!durable || !writerId) return;\n\t\tif (durable.claimWriter(writerId).status === \"claimed\") {\n\t\t\tthis.leaseReady = true;\n\t\t\treturn;\n\t\t}\n\t\tthis.leaseReady = durable.recoverWriter(writerId).status === \"recovered\";\n\t}\n\n\t/**\n\t * Releases the store writer lease on graceful shutdown (D-067 phase 2 S2)\n\t * so a successor process can claim immediately. Best-effort: only a held\n\t * lease is released, and failures are swallowed — a crashed process leaves\n\t * the lease for the TTL recovery path instead.\n\t */\n\treleaseWriterLease(): void {\n\t\tconst durable = this.durable;\n\t\tconst writerId = this.writerId;\n\t\tif (!durable || !writerId || !this.leaseReady) return;\n\t\ttry {\n\t\t\tdurable.releaseWriter(writerId);\n\t\t\tthis.leaseReady = false;\n\t\t} catch {\n\t\t\t// Shutdown release is advisory; the TTL recovery path handles the rest.\n\t\t}\n\t}\n\n\t/** Persists one adapter-owned operation record; a lost lease degrades to `durable_unavailable`. */\n\tprivate persistOperation(operationId: string, sessionId: string, payload: DurableOperationPayloadV1): void {\n\t\ttry {\n\t\t\tthis.durable?.persistOperation({\n\t\t\t\twriterId: this.writerId ?? \"\",\n\t\t\t\toperationId,\n\t\t\t\tsessionId,\n\t\t\t\tdata: payload,\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tif (error instanceof DurableServiceErrorV1) {\n\t\t\t\tthrow new PiServerError(\"durable_unavailable\", error.message);\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tprivate requireDurable(): DurableServiceV1 {\n\t\tif (!this.durable || !this.leaseReady) {\n\t\t\tthrow new PiServerError(\"durable_unavailable\", \"Durable operation store is not ready\");\n\t\t}\n\t\treturn this.durable;\n\t}\n\n\t/**\n\t * Rejects operations that were pending when the previous process stopped:\n\t * no executor survives a crash, so replayed `pending` records are swept to\n\t * a rejected terminal and their idempotency keys keep returning that\n\t/**\n\t * recorded terminal.\n\t */\n\tprivate sweepInterruptedOperations(): void {\n\t\tconst durable = this.durable;\n\t\tif (!durable) return;\n\t\tfor (const record of durable.exportState().operations) {\n\t\t\tconst payload = parseOperationPayload(record.data);\n\t\t\tif (!payload) continue;\n\t\t\tconst resolved: DurableOperationPayloadV1 =\n\t\t\t\tpayload.status === \"pending\"\n\t\t\t\t\t? {\n\t\t\t\t\t\t\t...payload,\n\t\t\t\t\t\t\tstatus: \"rejected\",\n\t\t\t\t\t\t\terror: { code: \"internal_error\", message: \"Operation did not complete before the server stopped\" },\n\t\t\t\t\t\t\tterminalAt: this.now(),\n\t\t\t\t\t\t}\n\t\t\t\t\t: payload;\n\t\t\tif (resolved !== payload) this.persistOperation(record.operationId, payload.sessionId, resolved);\n\t\t\tthis.recordOperation(record.operationId, resolved);\n\t\t}\n\t}\n\n\tprivate recordOperation(operationId: string, payload: DurableOperationPayloadV1): void {\n\t\tthis.recordedOperations.set(operationId, { operationId, payload });\n\t\tif (payload.idempotencyKey !== undefined) {\n\t\t\tthis.idempotencyIndex.set(`${payload.sessionId}\\0${payload.idempotencyKey}`, { operationId, payload });\n\t\t}\n\t}\n\n\t// -------------------------------------------------------------------------\n\t// Operation commands (server `operations` surface)\n\t// -------------------------------------------------------------------------\n\n\tprivate async submitOperation(input: {\n\t\treadonly sessionId: string;\n\t\treadonly operationType: string;\n\t\treadonly input?: JsonValue;\n\t\treadonly idempotencyKey?: string;\n\t\treadonly expectedRevision?: number;\n\t}): Promise<PiSessionOperationAck> {\n\t\tthis.requireDurable();\n\t\t// Idempotent replay precedes the live-session check: a recorded terminal\n\t\t// must stay answerable after a restart even though no runtime is open.\n\t\tif (input.idempotencyKey !== undefined) {\n\t\t\tconst recorded = this.idempotencyIndex.get(`${input.sessionId}\\0${input.idempotencyKey}`);\n\t\t\tif (recorded) return this.ackOf(recorded);\n\t\t}\n\t\tconst runtime = this.acquired.get(input.sessionId);\n\t\tif (!runtime) throw new PiServerError(\"not_found\", `Session is not open: ${input.sessionId}`);\n\t\tif (input.expectedRevision !== undefined) {\n\t\t\tconst revision = (await runtime.snapshot()).revision;\n\t\t\tif (revision !== input.expectedRevision) {\n\t\t\t\tthrow new PiServerError(\n\t\t\t\t\t\"operation_conflict\",\n\t\t\t\t\t`Session revision is ${revision}, expectedRevision was ${input.expectedRevision}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tconst operationId = randomUUID();\n\t\tconst payload: DurableOperationPayloadV1 = {\n\t\t\tstatus: \"pending\",\n\t\t\tsessionId: input.sessionId,\n\t\t\toperationType: input.operationType,\n\t\t\t...(input.idempotencyKey === undefined ? {} : { idempotencyKey: input.idempotencyKey }),\n\t\t\tsubmittedAt: this.now(),\n\t\t};\n\t\tthis.persistOperation(operationId, input.sessionId, payload);\n\t\tthis.recordOperation(operationId, payload);\n\t\t// Fire-and-forget execution: the ack must reach the client immediately,\n\t\t// otherwise a long operation hides its own operationId and cancel/result\n\t\t// stay unreachable. `executeOperation` records executor failures as\n\t\t// rejected terminals; only a terminal persist failure can still escape,\n\t\t// so pin the in-memory record to a rejected terminal carrying the\n\t\t// original error. The durable log keeps `pending` and the restart sweep\n\t\t// converges the record.\n\t\tthis.executeOperation(operationId, payload, input.input).catch((error: unknown) => {\n\t\t\tthis.recordOperation(operationId, {\n\t\t\t\t...payload,\n\t\t\t\tstatus: \"rejected\",\n\t\t\t\terror: { code: \"internal_error\", message: error instanceof Error ? error.message : String(error) },\n\t\t\t\tterminalAt: this.now(),\n\t\t\t});\n\t\t});\n\t\treturn this.ackOf({ operationId, payload });\n\t}\n\n\t/**\n\t * Runs the executor and persists the terminal state. Cancel is only a\n\t * request: the terminal record is written strictly after the executor\n\t * drains, so `cancel -> drain -> terminal` is the observable order.\n\t */\n\tprivate async executeOperation(\n\t\toperationId: string,\n\t\tpayload: DurableOperationPayloadV1,\n\t\tinput: JsonValue | undefined,\n\t): Promise<PiSessionOperationAck> {\n\t\tconst executor = this.executors.get(payload.operationType);\n\t\tif (!executor) {\n\t\t\treturn this.completeOperation(operationId, {\n\t\t\t\t...payload,\n\t\t\t\tstatus: \"rejected\",\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"not_implemented\",\n\t\t\t\t\tmessage: `No executor is registered for operation type ${payload.operationType}`,\n\t\t\t\t},\n\t\t\t\tterminalAt: this.now(),\n\t\t\t});\n\t\t}\n\t\tconst controller = new AbortController();\n\t\tthis.inFlight.set(operationId, controller);\n\t\tlet terminal: DurableOperationPayloadV1;\n\t\ttry {\n\t\t\tconst result = await executor.execute({\n\t\t\t\tsessionId: payload.sessionId,\n\t\t\t\toperationId,\n\t\t\t\t...(input === undefined ? {} : { input }),\n\t\t\t\tsignal: controller.signal,\n\t\t\t});\n\t\t\tterminal = { ...payload, status: \"completed\", result, terminalAt: this.now() };\n\t\t} catch (error) {\n\t\t\tterminal = {\n\t\t\t\t...payload,\n\t\t\t\tstatus: \"rejected\",\n\t\t\t\terror: this.toTerminalError(operationId, error),\n\t\t\t\tterminalAt: this.now(),\n\t\t\t};\n\t\t} finally {\n\t\t\tthis.inFlight.delete(operationId);\n\t\t\tthis.cancelRequested.delete(operationId);\n\t\t}\n\t\treturn this.completeOperation(operationId, terminal);\n\t}\n\n\tprivate toTerminalError(\n\t\toperationId: string,\n\t\terror: unknown,\n\t): {\n\t\treadonly code: ProtocolErrorCode;\n\t\treadonly message: string;\n\t} {\n\t\tif (this.cancelRequested.has(operationId)) {\n\t\t\treturn { code: \"operation_cancelled\", message: \"Operation was cancelled before completion\" };\n\t\t}\n\t\tif (error instanceof PiServerError) return { code: error.code, message: error.message };\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\treturn { code: \"invalid_request\", message };\n\t}\n\n\tprivate completeOperation(operationId: string, terminal: DurableOperationPayloadV1): PiSessionOperationAck {\n\t\tthis.persistOperation(operationId, terminal.sessionId, terminal);\n\t\tthis.recordOperation(operationId, terminal);\n\t\treturn this.ackOf({ operationId, payload: terminal });\n\t}\n\n\tprivate cancelOperation(input: { readonly sessionId: string; readonly operationId: string }): PiSessionOperationAck {\n\t\tthis.requireDurable();\n\t\tconst recorded = this.recordedOperations.get(input.operationId);\n\t\t// Session ownership is part of the lookup: a foreign session gets the\n\t\t// same not-found answer as a missing id, without leaking ownership.\n\t\tif (!recorded || recorded.payload.sessionId !== input.sessionId) {\n\t\t\tthrow new PiServerError(\"operation_not_found\", `Unknown operation: ${input.operationId}`);\n\t\t}\n\t\tif (recorded.payload.status !== \"pending\") return this.ackOf(recorded);\n\t\t// Record the cancel request and signal the executor. The terminal state\n\t\t// is only written once the executor drained (or nothing is draining).\n\t\tthis.cancelRequested.add(input.operationId);\n\t\tthis.inFlight.get(input.operationId)?.abort();\n\t\treturn { operationId: input.operationId, status: \"accepted\" };\n\t}\n\n\tprivate resultOperation(input: { readonly sessionId: string; readonly operationId: string }): PiSessionOperationAck {\n\t\tthis.requireDurable();\n\t\tconst recorded = this.recordedOperations.get(input.operationId);\n\t\t// Session ownership is part of the lookup: a foreign session gets the\n\t\t// same not-found answer as a missing id, without leaking ownership.\n\t\tif (!recorded || recorded.payload.sessionId !== input.sessionId) {\n\t\t\tthrow new PiServerError(\"operation_not_found\", `Unknown operation: ${input.operationId}`);\n\t\t}\n\t\treturn this.ackOf(recorded);\n\t}\n\n\tprivate ackOf(recorded: RecordedOperation): PiSessionOperationAck {\n\t\tconst { operationId, payload } = recorded;\n\t\tif (payload.status === \"completed\") {\n\t\t\treturn {\n\t\t\t\toperationId,\n\t\t\t\tstatus: \"completed\",\n\t\t\t\t...(payload.result === undefined ? {} : { result: payload.result }),\n\t\t\t};\n\t\t}\n\t\tif (payload.status === \"rejected\") {\n\t\t\treturn {\n\t\t\t\toperationId,\n\t\t\t\tstatus: \"rejected\",\n\t\t\t\t...(payload.error === undefined\n\t\t\t\t\t? {}\n\t\t\t\t\t: { error: { code: payload.error.code, message: payload.error.message } satisfies ProtocolError }),\n\t\t\t};\n\t\t}\n\t\treturn { operationId, status: \"accepted\" };\n\t}\n\n\t// -------------------------------------------------------------------------\n\t// Artifact adapter (output-artifacts face + durable persistence)\n\t// -------------------------------------------------------------------------\n\n\t/**\n\t * Mirrors one runtime output artifact into the durable store so remote\n\t * `artifact_stat`/`artifact_read` can serve it, including after a restart\n\t * via log replay. The runtime in-memory store (capability-runtime) stays\n\t * the live write path; this adds durable persistence, not a second store.\n\t */\n\tpersistOutputArtifact(sessionId: string, ref: OutputArtifactRef, bytes: Uint8Array): ArtifactRef {\n\t\tthis.requireDurable();\n\t\tif (ref.sessionId !== sessionId) {\n\t\t\tthrow new PiServerError(\"invalid_request\", \"Artifact sessionId must match the owning session\");\n\t\t}\n\t\tif (ref.artifactId === \"\") throw new PiServerError(\"invalid_request\", \"Artifact id must not be empty\");\n\t\tif (ref.sizeBytes !== undefined && ref.sizeBytes !== bytes.byteLength) {\n\t\t\tthrow new PiServerError(\"invalid_request\", \"Artifact sizeBytes must match the payload length\");\n\t\t}\n\t\ttry {\n\t\t\tthis.durable?.persistArtifact({\n\t\t\t\twriterId: this.writerId ?? \"\",\n\t\t\t\tartifactId: ref.artifactId,\n\t\t\t\tsessionId,\n\t\t\t\tdata: { ref, bytes: Buffer.from(bytes).toString(\"base64\") } satisfies DurableArtifactPayloadV1,\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tif (error instanceof DurableServiceErrorV1) {\n\t\t\t\tthrow new PiServerError(\"durable_unavailable\", error.message);\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t\treturn toProtocolArtifactRef(ref);\n\t}\n\n\tprivate statArtifact(sessionId: string, artifactId: string): ArtifactRef {\n\t\treturn toProtocolArtifactRef(this.loadArtifactPayload(sessionId, artifactId).ref);\n\t}\n\n\tprivate readArtifact(\n\t\tsessionId: string,\n\t\tartifactId: string,\n\t\toptions: { readonly offset: number; readonly maxBytes: number },\n\t): {\n\t\treadonly artifact: ArtifactRef;\n\t\treadonly data: Uint8Array;\n\t\treadonly nextOffset?: number;\n\t\treadonly eof: boolean;\n\t} {\n\t\tconst payload = this.loadArtifactPayload(sessionId, artifactId);\n\t\tconst bytes = Buffer.from(payload.bytes, \"base64\");\n\t\tconst end = Math.min(options.offset + options.maxBytes, bytes.byteLength);\n\t\tconst data = new Uint8Array(bytes.subarray(options.offset, end));\n\t\tconst eof = end >= bytes.byteLength;\n\t\treturn {\n\t\t\tartifact: toProtocolArtifactRef(payload.ref),\n\t\t\tdata,\n\t\t\t...(eof ? {} : { nextOffset: end }),\n\t\t\teof,\n\t\t};\n\t}\n\n\t/**\n\t * Loads one artifact payload through the durable service.\n\t */\n\tprivate loadArtifactPayload(sessionId: string, artifactId: string): DurableArtifactPayloadV1 {\n\t\tconst durable = this.requireDurable();\n\t\tconst record = durable.loadArtifact({ artifactId });\n\t\tif (!record || record.sessionId !== sessionId) {\n\t\t\tthrow new PiServerError(\"not_found\", `Unknown artifact: ${artifactId}`);\n\t\t}\n\t\tconst payload = parseArtifactPayload(record.data);\n\t\tif (!payload || payload.ref.sessionId !== sessionId || payload.ref.artifactId !== artifactId) {\n\t\t\tthrow new PiServerError(\"durable_unavailable\", \"Stored artifact record is malformed\");\n\t\t}\n\t\treturn payload;\n\t}\n\n\t// -------------------------------------------------------------------------\n\t// Mutation-response store (idempotent replay of keyed mutation commands)\n\t// -------------------------------------------------------------------------\n\n\t/**\n\t * Deterministic artifact id for one mutation-command response, following the\n\t * `agent-task:<taskId>` precedent for derived artifact ids.\n\t */\n\tprivate mutationResponseArtifactId(sessionId: string, operationId: string): string {\n\t\treturn `mutation-response:${sessionId}:${operationId}`;\n\t}\n\n\t/**\n\t * Loads a recorded response through the durable service. The durable log\n\t * was already replayed into memory at construction, so this read never\n\t * touches the disk. A missing or malformed record yields undefined so the\n\t * caller re-executes; unexpected durable failures propagate and are\n\t * reported (and treated as a miss) by the server's idempotency layer.\n\t */\n\tprivate async loadMutationResponse(sessionId: string, operationId: string): Promise<SessionSnapshot | undefined> {\n\t\tconst durable = this.requireDurable();\n\t\tconst record = durable.loadArtifact({\n\t\t\tartifactId: this.mutationResponseArtifactId(sessionId, operationId),\n\t\t});\n\t\tif (record === undefined || record.sessionId !== sessionId) return undefined;\n\t\tconst snapshot = parseMutationResponsePayload(record.data, sessionId);\n\t\treturn snapshot === undefined ? undefined : structuredClone(snapshot);\n\t}\n\n\t/**\n\t * Persists one successful response snapshot as a durable artifact record so\n\t * retries after a restart replay it. The payload is the `SessionSnapshot`\n\t * itself: every field is JSON-safe, so the JSONL durable log round-trips it\n\t * without an adapter-specific envelope.\n\t */\n\tprivate async recordMutationResponse(\n\t\tsessionId: string,\n\t\toperationId: string,\n\t\tsnapshot: SessionSnapshot,\n\t): Promise<void> {\n\t\tconst durable = this.requireDurable();\n\t\ttry {\n\t\t\tdurable.persistArtifact({\n\t\t\t\twriterId: this.writerId ?? \"\",\n\t\t\t\tartifactId: this.mutationResponseArtifactId(sessionId, operationId),\n\t\t\t\tsessionId,\n\t\t\t\tdata: snapshot,\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tif (error instanceof DurableServiceErrorV1) {\n\t\t\t\tthrow new PiServerError(\"durable_unavailable\", error.message);\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tasync listSessions(): Promise<SessionMetadata[]> {\n\t\tconst descriptors = await this.source.list();\n\t\treturn descriptors.map((descriptor) => ({\n\t\t\tid: descriptor.id,\n\t\t\tcreatedAt: descriptor.createdAt,\n\t\t\tupdatedAt: descriptor.updatedAt,\n\t\t\t...(descriptor.name === undefined ? {} : { sessionName: descriptor.name }),\n\t\t\t// Legacy sessions record no cwd; the protocol marks it optional.\n\t\t\t...(descriptor.cwd === undefined ? {} : { cwd: descriptor.cwd }),\n\t\t}));\n\t}\n\n\tasync listModels(): Promise<ModelMetadata[]> {\n\t\treturn [...(await this.models.list())];\n\t}\n\n\tasync createSession(options: CreateSessionOptions): Promise<PiSessionRuntime> {\n\t\tthis.assertNotAcquired(options.id);\n\t\tif (options.cwd === undefined || options.cwd.trim() === \"\") {\n\t\t\tthrow new PiServerError(\"invalid_request\", \"Creating a coding-agent session requires a cwd\");\n\t\t}\n\t\t// The protocol carries a model ref; resolve it to a Model instance the\n\t\t// same way runtime `set_model` does. An unknown ref fails the create\n\t\t// instead of being silently dropped.\n\t\tlet model: Model<Api> | undefined;\n\t\ttry {\n\t\t\tmodel = options.model === undefined ? undefined : await this.models.resolve(options.model);\n\t\t} catch (error) {\n\t\t\tthrow toError(error);\n\t\t}\n\t\tconst timestamp = Math.max(0, Math.trunc(this.now()));\n\t\tconst descriptor: CodingAgentSessionDescriptor = {\n\t\t\tid: options.id,\n\t\t\t...(options.name === undefined ? {} : { name: options.name }),\n\t\t\tcwd: options.cwd,\n\t\t\t...(model === undefined ? {} : { model }),\n\t\t\t...(options.thinkingLevel === undefined ? {} : { thinkingLevel: options.thinkingLevel }),\n\t\t\t...(options.profileId === undefined ? {} : { profileId: options.profileId }),\n\t\t\t...(options.profileVersion === undefined ? {} : { profileVersion: options.profileVersion }),\n\t\t\tcreatedAt: timestamp,\n\t\t\tupdatedAt: timestamp,\n\t\t};\n\t\tlet session: AgentSession;\n\t\ttry {\n\t\t\tsession = await this.openExclusively(descriptor.id, () => this.source.create(descriptor));\n\t\t} catch (error) {\n\t\t\tthrow toError(error);\n\t\t}\n\t\t// Lazy-model contract: createAgentSession does not fail when no model is\n\t\t// resolvable (no auth, empty catalog); it returns a session whose model is\n\t\t// undefined. A model-less live session cannot serve prompts and breaks\n\t\t// every client's list/server_snapshot, so the create fails explicitly.\n\t\t// Disposing rolls the session back before any registration; the\n\t\t// SessionManager has not flushed the JSONL yet (persistence defers until\n\t\t// the first assistant message), so nothing stays on disk, and a flushed\n\t\t// residue would still be harmless: reopening it runs into the same\n\t\t// preflight in openSession.\n\t\tif (session.model === undefined) {\n\t\t\t// Keep the structured rejection even if rollback fails; the cleanup\n\t\t\t// failure is appended to the message instead of masking it.\n\t\t\tlet cleanupNote = \"\";\n\t\t\ttry {\n\t\t\t\tawait session.dispose();\n\t\t\t} catch (disposeError) {\n\t\t\t\tcleanupNote = ` (session cleanup also failed: ${disposeError instanceof Error ? disposeError.message : String(disposeError)})`;\n\t\t\t}\n\t\t\tthrow new PiServerError(\n\t\t\t\t\"invalid_request\",\n\t\t\t\t`Creating a coding-agent session requires a resolvable model; none is available for this server's agent directory${cleanupNote}`,\n\t\t\t);\n\t\t}\n\t\treturn this.acquireRuntime(descriptor, session);\n\t}\n\n\tasync openSession(sessionId: string): Promise<PiSessionRuntime> {\n\t\tthis.assertNotAcquired(sessionId);\n\t\tconst descriptors = await this.source.list();\n\t\tconst descriptor = descriptors.find((entry) => entry.id === sessionId);\n\t\tif (!descriptor) throw new PiServerError(\"not_found\", `Unknown session: ${sessionId}`);\n\t\tlet session: AgentSession;\n\t\ttry {\n\t\t\tsession = await this.openExclusively(descriptor.id, () => this.source.open(descriptor));\n\t\t} catch (error) {\n\t\t\tthrow toError(error);\n\t\t}\n\t\t// Same preflight as create: a history session whose stored model no longer\n\t\t// resolves (model removed, auth missing) must fail the open instead of\n\t\t// going live model-less and breaking every client's list/server_snapshot.\n\t\tif (session.model === undefined) {\n\t\t\tlet cleanupNote = \"\";\n\t\t\ttry {\n\t\t\t\tawait session.dispose();\n\t\t\t} catch (disposeError) {\n\t\t\t\tcleanupNote = ` (session cleanup also failed: ${disposeError instanceof Error ? disposeError.message : String(disposeError)})`;\n\t\t\t}\n\t\t\tthrow new PiServerError(\n\t\t\t\t\"invalid_request\",\n\t\t\t\t`Reopening session ${sessionId} requires a resolvable model; none is available for this server's agent directory${cleanupNote}`,\n\t\t\t);\n\t\t}\n\t\treturn this.acquireRuntime(descriptor, session);\n\t}\n\n\t/** Serializes the acquired-check with the async source call to keep opens exclusive. */\n\tprivate async openExclusively(id: string, open: () => Promise<AgentSession>): Promise<AgentSession> {\n\t\tif (this.opening.has(id) || this.acquired.has(id)) {\n\t\t\tthrow new PiServerError(\"session_locked\", `Session is already open: ${id}`);\n\t\t}\n\t\tthis.opening.add(id);\n\t\ttry {\n\t\t\treturn await open();\n\t\t} finally {\n\t\t\tthis.opening.delete(id);\n\t\t}\n\t}\n\n\tprivate acquireRuntime(descriptor: CodingAgentSessionDescriptor, session: AgentSession): CodingAgentSessionRuntime {\n\t\t// Auto-mirror: with a durable service configured, every artifact committed\n\t\t// by the session's capability runtime is mirrored here, so the wire face\n\t\t// serves it without an explicit persist call. Without a durable service\n\t\t// nothing is registered (no behavior change). Mirror failures surface as\n\t\t// runtime commit-observer log records; they never fail the artifact put.\n\t\tconst unsubscribeArtifactMirror =\n\t\t\tthis.durable === undefined\n\t\t\t\t? undefined\n\t\t\t\t: session.onOutputArtifactCommit(({ ref, bytes }) => {\n\t\t\t\t\t\tthis.persistOutputArtifact(descriptor.id, ref, bytes);\n\t\t\t\t\t});\n\t\tconst runtime = new CodingAgentSessionRuntime(session, descriptor, {\n\t\t\tmodels: this.models,\n\t\t\tonDisposed: () => {\n\t\t\t\tunsubscribeArtifactMirror?.();\n\t\t\t\tthis.acquired.delete(descriptor.id);\n\t\t\t},\n\t\t});\n\t\tthis.acquired.set(descriptor.id, runtime);\n\t\treturn runtime;\n\t}\n\n\tprivate assertNotAcquired(id: string): void {\n\t\tif (this.acquired.has(id) || this.opening.has(id)) {\n\t\t\tthrow new PiServerError(\"session_locked\", `Session is already open: ${id}`);\n\t\t}\n\t}\n}\n\n/** Composes the coding-agent service with transport, journal, and auth hooks into one server. */\nexport function assembleCodingAgentServer(options: CodingAgentServerAssemblyOptions): {\n\treadonly server: PiServer;\n\treadonly service: CodingAgentServerService;\n} {\n\tconst service = new CodingAgentServerService({\n\t\tsessions: options.sessions,\n\t\tmodels: options.models,\n\t\tnow: options.now,\n\t\t...(options.durable === undefined ? {} : { durable: options.durable }),\n\t\t...(options.writerId === undefined ? {} : { writerId: options.writerId }),\n\t\t...(options.operationExecutors === undefined ? {} : { operationExecutors: options.operationExecutors }),\n\t});\n\tconst server = new PiServer(service, {\n\t\tlisteners: options.listeners,\n\t\t...(options.journal === undefined ? {} : { journal: options.journal }),\n\t\t...(options.authenticate === undefined ? {} : { authenticate: options.authenticate }),\n\t\t...(options.authorize === undefined ? {} : { authorize: options.authorize }),\n\t\t...(options.serverId === undefined ? {} : { serverId: options.serverId }),\n\t\t...(options.maxFrameLength === undefined ? {} : { maxFrameLength: options.maxFrameLength }),\n\t\t...(options.handshakeTimeoutMs === undefined ? {} : { handshakeTimeoutMs: options.handshakeTimeoutMs }),\n\t\t...(options.onError === undefined ? {} : { onError: options.onError }),\n\t});\n\treturn { server, service };\n}\n"]}
|