@draht/coding-agent 2026.7.30 → 2026.10.4-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +606 -0
- package/README.md +46 -2
- package/agents/debugger.md +12 -1
- package/agents/git-committer.md +1 -0
- package/agents/implementer.md +20 -0
- package/agents/investigator.md +75 -0
- package/agents/reviewer.md +7 -0
- package/agents/spec-reviewer.md +66 -0
- package/agents/verifier.md +4 -3
- package/bin/draht-tools.cjs +472 -41
- package/dist/agents/debugger.md +12 -1
- package/dist/agents/git-committer.md +1 -0
- package/dist/agents/implementer.md +20 -0
- package/dist/agents/investigator.md +75 -0
- package/dist/agents/reviewer.md +7 -0
- package/dist/agents/spec-reviewer.md +66 -0
- package/dist/agents/verifier.md +4 -3
- package/dist/bun/cli.d.ts +1 -1
- package/dist/bun/cli.d.ts.map +1 -1
- package/dist/bun/cli.js +6 -3
- package/dist/bun/cli.js.map +1 -1
- package/dist/bun/sandbox-env-setup.d.ts +2 -0
- package/dist/bun/sandbox-env-setup.d.ts.map +1 -0
- package/dist/bun/sandbox-env-setup.js +4 -0
- package/dist/bun/sandbox-env-setup.js.map +1 -0
- package/dist/bundle/chunks/anthropic-messages-GAKYXF65.js +6 -0
- package/dist/bundle/chunks/anthropic.js +75 -0
- package/dist/bundle/chunks/azure-openai-responses-ZIXMK6JO.js +2 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +79 -0
- package/dist/bundle/chunks/chunk-2E5VODES.js +2 -0
- package/dist/bundle/chunks/chunk-2FBJKY7F.js +2 -0
- package/dist/bundle/chunks/chunk-2N4I6WXC.js +2 -0
- package/dist/bundle/chunks/chunk-5VZWYVZB.js +82 -0
- package/dist/bundle/chunks/chunk-63BK6WK2.js +2 -0
- package/dist/bundle/chunks/chunk-6MSE6LZ3.js +6 -0
- package/dist/bundle/chunks/chunk-6ZJKIMU7.js +2 -0
- package/dist/bundle/chunks/chunk-736QBNUZ.js +12 -0
- package/dist/bundle/chunks/chunk-BXSHCX3G.js +11 -0
- package/dist/bundle/chunks/chunk-CEJJ5XF2.js +170 -0
- package/dist/bundle/chunks/chunk-COF5JT7R.js +4 -0
- package/dist/bundle/chunks/chunk-D6TMD5Q2.js +44 -0
- package/dist/bundle/chunks/chunk-DPE4ALPU.js +146 -0
- package/dist/bundle/chunks/chunk-EBVYI75P.js +2 -0
- package/dist/bundle/chunks/chunk-GVXA72ZA.js +2 -0
- package/dist/bundle/chunks/chunk-H6FT43VC.js +137 -0
- package/dist/bundle/chunks/chunk-HJ72RANT.js +2 -0
- package/dist/bundle/chunks/chunk-HTJ3L72O.js +2 -0
- package/dist/bundle/chunks/chunk-HZ2UHMBT.js +2 -0
- package/dist/bundle/chunks/chunk-I5OKY6RH.js +11 -0
- package/dist/bundle/chunks/chunk-IWTUBX6V.js +4 -0
- package/dist/bundle/chunks/chunk-KPO5375S.js +2 -0
- package/dist/bundle/chunks/chunk-KVH4HR57.js +31 -0
- package/dist/bundle/chunks/chunk-LDAOC5RB.js +18 -0
- package/dist/bundle/chunks/chunk-ON6XU6AG.js +2 -0
- package/dist/bundle/chunks/chunk-QMN7OD6G.js +2 -0
- package/dist/bundle/chunks/chunk-RZKPFWMH.js +42 -0
- package/dist/bundle/chunks/chunk-SDRCE6OP.js +2 -0
- package/dist/bundle/chunks/chunk-SVNWI7EV.js +8 -0
- package/dist/bundle/chunks/chunk-TIA2T6EO.js +3 -0
- package/dist/bundle/chunks/chunk-VOFPZOUQ.js +1472 -0
- package/dist/bundle/chunks/chunk-XBUEMKIY.js +2 -0
- package/dist/bundle/chunks/chunk-XOGEYN4Q.js +2 -0
- package/dist/bundle/chunks/chunk-ZZD35WKM.js +2 -0
- package/dist/bundle/chunks/cli-SR5QBZH4.js +51 -0
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-MJKOAE5S.js +2 -0
- package/dist/bundle/chunks/codemode-worker.js +315 -0
- package/dist/bundle/chunks/execute-VCYDHEYA.js +328 -0
- package/dist/bundle/chunks/github-copilot.js +2 -0
- package/dist/bundle/chunks/google-antigravity.js +75 -0
- package/dist/bundle/chunks/google-gemini-cli.js +75 -0
- package/dist/bundle/chunks/google-generative-ai-RPUPQ6PM.js +2 -0
- package/dist/bundle/chunks/google-vertex-EZES5QVQ.js +2 -0
- package/dist/bundle/chunks/https-proxy-agent-O2PVUIOI.js +13 -0
- package/dist/bundle/chunks/image-resize-worker.js +2 -0
- package/dist/bundle/chunks/jiti-loader-RKXLMQV2.js +2 -0
- package/dist/bundle/chunks/kimi-coding.js +2 -0
- package/dist/bundle/chunks/lib-XOG5PI3Y.js +9 -0
- package/dist/bundle/chunks/llama-cpp-classify-EJ5XMSQL.js +22 -0
- package/dist/bundle/chunks/meta.js +2 -0
- package/dist/bundle/chunks/mistral-conversations-AOYGU43Y.js +5 -0
- package/dist/bundle/chunks/multipart-parser-AZP5BX2W.js +3 -0
- package/dist/bundle/chunks/node-C2JGH2OB.js +2 -0
- package/dist/bundle/chunks/node-LQ52KV6B.js +16 -0
- package/dist/bundle/chunks/openai-chatgpt.js +75 -0
- package/dist/bundle/chunks/openai-codex-responses-M2Y77JEQ.js +10 -0
- package/dist/bundle/chunks/openai-codex.js +75 -0
- package/dist/bundle/chunks/openai-completions-A4OKYOYV.js +7 -0
- package/dist/bundle/chunks/openai-responses-6IXV53T3.js +3 -0
- package/dist/bundle/chunks/opencode-go.js +2 -0
- package/dist/bundle/chunks/openrouter-images-LYV4NKFM.js +2 -0
- package/dist/bundle/chunks/openrouter.js +75 -0
- package/dist/bundle/chunks/pi-messages-KKMEUT3Z.js +8 -0
- package/dist/bundle/chunks/radius.js +75 -0
- package/dist/bundle/chunks/runtime-6YJPGSP7.js +2 -0
- package/dist/bundle/chunks/settings-manager-D2EG7WDO.js +2 -0
- package/dist/bundle/chunks/src-TIBHS42X.js +4 -0
- package/dist/bundle/chunks/typesafe-system-one-YBEEY5XU.js +2 -0
- package/dist/bundle/chunks/virtual-modules-CBOAFAFT.js +2 -0
- package/dist/bundle/chunks/xai.js +75 -0
- package/dist/bundle/cli-runtime.js +3 -0
- package/dist/bundle/cli.js +5 -0
- package/dist/bundle/index.js +2 -0
- package/dist/bundle/rpc-entry.js +3 -0
- package/dist/cli/args.d.ts +14 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +140 -22
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/attach-mode.d.ts +61 -0
- package/dist/cli/attach-mode.d.ts.map +1 -1
- package/dist/cli/attach-mode.js +243 -5
- package/dist/cli/attach-mode.js.map +1 -1
- 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 +103 -0
- package/dist/cli/auth-command.js.map +1 -0
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +3 -2
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/credential-print.d.ts +6 -4
- package/dist/cli/credential-print.d.ts.map +1 -1
- package/dist/cli/credential-print.js +47 -34
- package/dist/cli/credential-print.js.map +1 -1
- package/dist/cli/file-processor.d.ts +1 -1
- package/dist/cli/file-processor.d.ts.map +1 -1
- package/dist/cli/file-processor.js +2 -1
- package/dist/cli/file-processor.js.map +1 -1
- package/dist/cli/list-models.d.ts +1 -1
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +2 -2
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli/session-picker.d.ts +1 -1
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/cli/setup.d.ts +2 -0
- package/dist/cli/setup.d.ts.map +1 -0
- package/dist/cli/setup.js +12 -0
- package/dist/cli/setup.js.map +1 -0
- package/dist/cli/startup-ui.d.ts +2 -2
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js +42 -33
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/cli.js +3 -12
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +29 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +73 -10
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +17 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +98 -32
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +2 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +15 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +266 -49
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +1503 -597
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +25 -9
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +245 -45
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bug-report-upload.d.ts +11 -0
- package/dist/core/bug-report-upload.d.ts.map +1 -0
- package/dist/core/bug-report-upload.js +20 -0
- package/dist/core/bug-report-upload.js.map +1 -0
- package/dist/core/bug-report.d.ts +176 -0
- package/dist/core/bug-report.d.ts.map +1 -0
- package/dist/core/bug-report.js +292 -0
- package/dist/core/bug-report.js.map +1 -0
- package/dist/core/builtins/checkpoints.d.ts +20 -0
- package/dist/core/builtins/checkpoints.d.ts.map +1 -0
- package/dist/core/builtins/checkpoints.js +161 -0
- package/dist/core/builtins/checkpoints.js.map +1 -0
- package/dist/core/builtins/duet.d.ts +26 -0
- package/dist/core/builtins/duet.d.ts.map +1 -0
- package/dist/core/builtins/duet.js +660 -0
- package/dist/core/builtins/duet.js.map +1 -0
- package/dist/core/builtins/index.d.ts.map +1 -1
- package/dist/core/builtins/index.js +7 -1
- package/dist/core/builtins/index.js.map +1 -1
- package/dist/core/builtins/subagent.d.ts +24 -4
- package/dist/core/builtins/subagent.d.ts.map +1 -1
- package/dist/core/builtins/subagent.js +278 -35
- package/dist/core/builtins/subagent.js.map +1 -1
- package/dist/core/cache-stats.d.ts.map +1 -1
- package/dist/core/cache-stats.js +12 -1
- package/dist/core/cache-stats.js.map +1 -1
- package/dist/core/cache-warmer.d.ts +103 -0
- package/dist/core/cache-warmer.d.ts.map +1 -0
- package/dist/core/cache-warmer.js +356 -0
- package/dist/core/cache-warmer.js.map +1 -0
- package/dist/core/checkpoints/checkpoint-cli.d.ts +17 -0
- package/dist/core/checkpoints/checkpoint-cli.d.ts.map +1 -0
- package/dist/core/checkpoints/checkpoint-cli.js +78 -0
- package/dist/core/checkpoints/checkpoint-cli.js.map +1 -0
- package/dist/core/checkpoints/checkpoint-manager.d.ts +298 -0
- package/dist/core/checkpoints/checkpoint-manager.d.ts.map +1 -0
- package/dist/core/checkpoints/checkpoint-manager.js +901 -0
- package/dist/core/checkpoints/checkpoint-manager.js.map +1 -0
- package/dist/core/checkpoints/rewind.d.ts +143 -0
- package/dist/core/checkpoints/rewind.d.ts.map +1 -0
- package/dist/core/checkpoints/rewind.js +247 -0
- package/dist/core/checkpoints/rewind.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +11 -6
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +14 -6
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +221 -122
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/utils.d.ts +2 -1
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js +25 -18
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/crash-log.d.ts +27 -0
- package/dist/core/crash-log.d.ts.map +1 -0
- package/dist/core/crash-log.js +140 -0
- package/dist/core/crash-log.js.map +1 -0
- package/dist/core/defaults.d.ts +1 -0
- package/dist/core/defaults.d.ts.map +1 -1
- package/dist/core/defaults.js +9 -0
- package/dist/core/defaults.js.map +1 -1
- package/dist/core/experimental.js +1 -1
- package/dist/core/experimental.js.map +1 -1
- package/dist/core/export-html/template.css +10 -0
- package/dist/core/export-html/template.js +72 -18
- package/dist/core/extensions/index.d.ts +2 -2
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/jiti-loader.d.ts +2 -0
- package/dist/core/extensions/jiti-loader.d.ts.map +1 -0
- package/dist/core/extensions/jiti-loader.js +5 -0
- package/dist/core/extensions/jiti-loader.js.map +1 -0
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +298 -96
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +59 -9
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +410 -103
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +701 -85
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js +3 -0
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/extensions/virtual-modules.d.ts +3 -0
- package/dist/core/extensions/virtual-modules.d.ts.map +1 -0
- package/dist/core/extensions/virtual-modules.js +37 -0
- package/dist/core/extensions/virtual-modules.js.map +1 -0
- package/dist/core/extensions/wrapper.d.ts +2 -2
- package/dist/core/extensions/wrapper.d.ts.map +1 -1
- package/dist/core/extensions/wrapper.js +3 -22
- package/dist/core/extensions/wrapper.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts +1 -1
- package/dist/core/footer-data-provider.js +19 -18
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +7 -0
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/index.d.ts +2 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/keybindings.d.ts +88 -13
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +34 -7
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/mcp-servers.d.ts +119 -0
- package/dist/core/mcp-servers.d.ts.map +1 -0
- package/dist/core/mcp-servers.js +191 -0
- package/dist/core/mcp-servers.js.map +1 -0
- package/dist/core/messages.d.ts +1 -1
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +1 -0
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-config.d.ts +202 -20
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +53 -18
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-registry.d.ts +21 -3
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +47 -10
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts +7 -5
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +62 -23
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts +80 -15
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +466 -120
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/models-store.d.ts +12 -7
- package/dist/core/models-store.d.ts.map +1 -1
- package/dist/core/models-store.js +87 -18
- package/dist/core/models-store.js.map +1 -1
- package/dist/core/multi-agent/fsm.js +8 -3
- package/dist/core/multi-agent/fsm.js.map +1 -1
- package/dist/core/multi-agent/mailbox.js +1 -3
- package/dist/core/multi-agent/mailbox.js.map +1 -1
- package/dist/core/multi-agent/permission-gate.d.ts +5 -2
- package/dist/core/multi-agent/permission-gate.d.ts.map +1 -1
- package/dist/core/multi-agent/permission-gate.js +601 -37
- package/dist/core/multi-agent/permission-gate.js.map +1 -1
- package/dist/core/multi-agent/task-board.js +2 -4
- package/dist/core/multi-agent/task-board.js.map +1 -1
- package/dist/core/multi-agent/worktree.d.ts +2 -0
- package/dist/core/multi-agent/worktree.d.ts.map +1 -1
- package/dist/core/multi-agent/worktree.js +3 -5
- package/dist/core/multi-agent/worktree.js.map +1 -1
- package/dist/core/nested-tool-calls.d.ts +102 -0
- package/dist/core/nested-tool-calls.d.ts.map +1 -0
- package/dist/core/nested-tool-calls.js +178 -0
- package/dist/core/nested-tool-calls.js.map +1 -0
- package/dist/core/package-manager.d.ts +16 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +162 -69
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/permission-relay/index.d.ts +19 -0
- package/dist/core/permission-relay/index.d.ts.map +1 -0
- package/dist/core/permission-relay/index.js +49 -0
- package/dist/core/permission-relay/index.js.map +1 -0
- package/dist/core/permission-relay/relay-ui-context.d.ts +39 -0
- package/dist/core/permission-relay/relay-ui-context.d.ts.map +1 -0
- package/dist/core/permission-relay/relay-ui-context.js +788 -0
- package/dist/core/permission-relay/relay-ui-context.js.map +1 -0
- package/dist/core/permission-relay/types.d.ts +222 -0
- package/dist/core/permission-relay/types.d.ts.map +1 -0
- package/dist/core/permission-relay/types.js +15 -0
- package/dist/core/permission-relay/types.js.map +1 -0
- package/dist/core/pi-manifest.d.ts +14 -0
- package/dist/core/pi-manifest.d.ts.map +1 -0
- package/dist/core/pi-manifest.js +36 -0
- package/dist/core/pi-manifest.js.map +1 -0
- package/dist/core/project-trust.js +2 -2
- package/dist/core/project-trust.js.map +1 -1
- package/dist/core/prompt-templates.d.ts +6 -1
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +63 -37
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/provider-attribution.js +5 -5
- package/dist/core/provider-attribution.js.map +1 -1
- package/dist/core/provider-composer.d.ts +44 -20
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +151 -51
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/radius.d.ts +13 -0
- package/dist/core/radius.d.ts.map +1 -1
- package/dist/core/radius.js +19 -0
- package/dist/core/radius.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts +10 -3
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +105 -81
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resource-loader.d.ts +28 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +319 -65
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/runtime-credentials.d.ts +5 -5
- package/dist/core/runtime-credentials.d.ts.map +1 -1
- package/dist/core/runtime-credentials.js +13 -9
- package/dist/core/runtime-credentials.js.map +1 -1
- package/dist/core/sandbox/bash-operations.d.ts +149 -0
- package/dist/core/sandbox/bash-operations.d.ts.map +1 -0
- package/dist/core/sandbox/bash-operations.js +163 -0
- package/dist/core/sandbox/bash-operations.js.map +1 -0
- package/dist/core/sandbox/env.d.ts +83 -0
- package/dist/core/sandbox/env.d.ts.map +1 -0
- package/dist/core/sandbox/env.js +123 -0
- package/dist/core/sandbox/env.js.map +1 -0
- package/dist/core/sandbox/executor.d.ts +104 -0
- package/dist/core/sandbox/executor.d.ts.map +1 -0
- package/dist/core/sandbox/executor.js +93 -0
- package/dist/core/sandbox/executor.js.map +1 -0
- package/dist/core/sandbox/index.d.ts +36 -0
- package/dist/core/sandbox/index.d.ts.map +1 -0
- package/dist/core/sandbox/index.js +36 -0
- package/dist/core/sandbox/index.js.map +1 -0
- package/dist/core/sandbox/linux.d.ts +121 -0
- package/dist/core/sandbox/linux.d.ts.map +1 -0
- package/dist/core/sandbox/linux.js +260 -0
- package/dist/core/sandbox/linux.js.map +1 -0
- package/dist/core/sandbox/policy.d.ts +142 -0
- package/dist/core/sandbox/policy.d.ts.map +1 -0
- package/dist/core/sandbox/policy.js +297 -0
- package/dist/core/sandbox/policy.js.map +1 -0
- package/dist/core/sandbox/real-path.d.ts +112 -0
- package/dist/core/sandbox/real-path.d.ts.map +1 -0
- package/dist/core/sandbox/real-path.js +158 -0
- package/dist/core/sandbox/real-path.js.map +1 -0
- package/dist/core/sandbox/seatbelt-profile.d.ts +95 -0
- package/dist/core/sandbox/seatbelt-profile.d.ts.map +1 -0
- package/dist/core/sandbox/seatbelt-profile.js +239 -0
- package/dist/core/sandbox/seatbelt-profile.js.map +1 -0
- package/dist/core/sandbox/seatbelt.d.ts +95 -0
- package/dist/core/sandbox/seatbelt.d.ts.map +1 -0
- package/dist/core/sandbox/seatbelt.js +154 -0
- package/dist/core/sandbox/seatbelt.js.map +1 -0
- package/dist/core/sandbox/self-test.d.ts +109 -0
- package/dist/core/sandbox/self-test.d.ts.map +1 -0
- package/dist/core/sandbox/self-test.js +369 -0
- package/dist/core/sandbox/self-test.js.map +1 -0
- package/dist/core/sandbox/spawn.d.ts +33 -0
- package/dist/core/sandbox/spawn.d.ts.map +1 -0
- package/dist/core/sandbox/spawn.js +87 -0
- package/dist/core/sandbox/spawn.js.map +1 -0
- package/dist/core/sdk.d.ts +7 -5
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +103 -53
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-cwd.js +1 -0
- package/dist/core/session-cwd.js.map +1 -1
- package/dist/core/session-export.d.ts +8 -0
- package/dist/core/session-export.d.ts.map +1 -0
- package/dist/core/session-export.js +33 -0
- package/dist/core/session-export.js.map +1 -0
- package/dist/core/session-manager.d.ts +134 -15
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +366 -149
- package/dist/core/session-manager.js.map +1 -1
- 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 +105 -4
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +274 -40
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts +3 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +70 -39
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +4 -1
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/soak/soak-log.d.ts +298 -0
- package/dist/core/soak/soak-log.d.ts.map +1 -0
- package/dist/core/soak/soak-log.js +666 -0
- package/dist/core/soak/soak-log.js.map +1 -0
- package/dist/core/soak/soak-reader.d.ts +60 -0
- package/dist/core/soak/soak-reader.d.ts.map +1 -0
- package/dist/core/soak/soak-reader.js +106 -0
- package/dist/core/soak/soak-reader.js.map +1 -0
- package/dist/core/socket-server/discovery.d.ts +78 -1
- package/dist/core/socket-server/discovery.d.ts.map +1 -1
- package/dist/core/socket-server/discovery.js +356 -37
- package/dist/core/socket-server/discovery.js.map +1 -1
- package/dist/core/socket-server/index.d.ts +10 -4
- package/dist/core/socket-server/index.d.ts.map +1 -1
- package/dist/core/socket-server/index.js +6 -3
- package/dist/core/socket-server/index.js.map +1 -1
- package/dist/core/socket-server/permission-delivery.d.ts +125 -0
- package/dist/core/socket-server/permission-delivery.d.ts.map +1 -0
- package/dist/core/socket-server/permission-delivery.js +152 -0
- package/dist/core/socket-server/permission-delivery.js.map +1 -0
- package/dist/core/socket-server/permission-registry.d.ts +301 -0
- package/dist/core/socket-server/permission-registry.d.ts.map +1 -0
- package/dist/core/socket-server/permission-registry.js +410 -0
- package/dist/core/socket-server/permission-registry.js.map +1 -0
- package/dist/core/socket-server/permission-relay.d.ts +81 -0
- package/dist/core/socket-server/permission-relay.d.ts.map +1 -0
- package/dist/core/socket-server/permission-relay.js +528 -0
- package/dist/core/socket-server/permission-relay.js.map +1 -0
- package/dist/core/socket-server/safe-text.d.ts +83 -0
- package/dist/core/socket-server/safe-text.d.ts.map +1 -0
- package/dist/core/socket-server/safe-text.js +277 -0
- package/dist/core/socket-server/safe-text.js.map +1 -0
- package/dist/core/socket-server/session-integration.d.ts +65 -2
- package/dist/core/socket-server/session-integration.d.ts.map +1 -1
- package/dist/core/socket-server/session-integration.js +434 -32
- package/dist/core/socket-server/session-integration.js.map +1 -1
- package/dist/core/socket-server/socket-client.d.ts +21 -2
- package/dist/core/socket-server/socket-client.d.ts.map +1 -1
- package/dist/core/socket-server/socket-client.js +52 -1
- package/dist/core/socket-server/socket-client.js.map +1 -1
- package/dist/core/socket-server/socket-server.d.ts +152 -1
- package/dist/core/socket-server/socket-server.d.ts.map +1 -1
- package/dist/core/socket-server/socket-server.js +786 -26
- package/dist/core/socket-server/socket-server.js.map +1 -1
- package/dist/core/socket-server/types.d.ts +108 -3
- package/dist/core/socket-server/types.d.ts.map +1 -1
- package/dist/core/socket-server/types.js +13 -1
- package/dist/core/socket-server/types.js.map +1 -1
- package/dist/core/source-info.d.ts +8 -0
- package/dist/core/source-info.d.ts.map +1 -1
- package/dist/core/source-info.js +16 -0
- package/dist/core/source-info.js.map +1 -1
- package/dist/core/system-prompt.d.ts +49 -6
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +126 -90
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts +32 -2
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +83 -141
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts +0 -5
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +2 -5
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts +5 -12
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +36 -173
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.d.ts +7 -0
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +22 -76
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts +4 -0
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +10 -62
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/index.d.ts +4 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +18 -1
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/ls.d.ts +4 -0
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +9 -50
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts +11 -0
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +54 -12
- package/dist/core/tools/output-accumulator.js.map +1 -1
- 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 +8 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +16 -123
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts +6 -0
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js +26 -0
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/renderers/bash.d.ts +12 -0
- package/dist/core/tools/renderers/bash.d.ts.map +1 -0
- package/dist/core/tools/renderers/bash.js +117 -0
- package/dist/core/tools/renderers/bash.js.map +1 -0
- package/dist/core/tools/renderers/edit.d.ts +23 -0
- package/dist/core/tools/renderers/edit.d.ts.map +1 -0
- package/dist/core/tools/renderers/edit.js +167 -0
- package/dist/core/tools/renderers/edit.js.map +1 -0
- package/dist/core/tools/renderers/find.d.ts +10 -0
- package/dist/core/tools/renderers/find.d.ts.map +1 -0
- package/dist/core/tools/renderers/find.js +64 -0
- package/dist/core/tools/renderers/find.js.map +1 -0
- package/dist/core/tools/renderers/grep.d.ts +10 -0
- package/dist/core/tools/renderers/grep.d.ts.map +1 -0
- package/dist/core/tools/renderers/grep.js +69 -0
- package/dist/core/tools/renderers/grep.js.map +1 -0
- package/dist/core/tools/renderers/index.d.ts +28 -0
- package/dist/core/tools/renderers/index.d.ts.map +1 -0
- package/dist/core/tools/renderers/index.js +47 -0
- package/dist/core/tools/renderers/index.js.map +1 -0
- package/dist/core/tools/renderers/ls.d.ts +10 -0
- package/dist/core/tools/renderers/ls.d.ts.map +1 -0
- package/dist/core/tools/renderers/ls.js +58 -0
- package/dist/core/tools/renderers/ls.js.map +1 -0
- package/dist/core/tools/renderers/read.d.ts +11 -0
- package/dist/core/tools/renderers/read.d.ts.map +1 -0
- package/dist/core/tools/renderers/read.js +130 -0
- package/dist/core/tools/renderers/read.js.map +1 -0
- package/dist/core/tools/renderers/write.d.ts +10 -0
- package/dist/core/tools/renderers/write.d.ts.map +1 -0
- package/dist/core/tools/renderers/write.js +153 -0
- package/dist/core/tools/renderers/write.js.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts +5 -3
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.js +3 -1
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
- package/dist/core/tools/truncate.d.ts +14 -0
- package/dist/core/tools/truncate.d.ts.map +1 -1
- package/dist/core/tools/truncate.js +29 -0
- package/dist/core/tools/truncate.js.map +1 -1
- package/dist/core/tools/write.d.ts +4 -0
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +12 -147
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/trust-manager.d.ts +6 -4
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +59 -22
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/core/usage-totals.d.ts +3 -1
- package/dist/core/usage-totals.d.ts.map +1 -1
- package/dist/core/usage-totals.js +28 -1
- package/dist/core/usage-totals.js.map +1 -1
- package/dist/core/virtual-models.d.ts +117 -0
- package/dist/core/virtual-models.d.ts.map +1 -0
- package/dist/core/virtual-models.js +124 -0
- package/dist/core/virtual-models.js.map +1 -0
- package/dist/experimental/micro/api.d.ts +81 -0
- package/dist/experimental/micro/api.d.ts.map +1 -0
- package/dist/experimental/micro/api.js +2 -0
- package/dist/experimental/micro/api.js.map +1 -0
- package/dist/experimental/micro/main.d.ts +3 -0
- package/dist/experimental/micro/main.d.ts.map +1 -0
- package/dist/experimental/micro/main.js +21 -0
- package/dist/experimental/micro/main.js.map +1 -0
- package/dist/experimental/micro/models.d.ts +11 -0
- package/dist/experimental/micro/models.d.ts.map +1 -0
- package/dist/experimental/micro/models.js +95 -0
- package/dist/experimental/micro/models.js.map +1 -0
- package/dist/experimental/micro/runtime.d.ts +12 -0
- package/dist/experimental/micro/runtime.d.ts.map +1 -0
- package/dist/experimental/micro/runtime.js +465 -0
- package/dist/experimental/micro/runtime.js.map +1 -0
- package/dist/experimental/micro/sessions.d.ts +10 -0
- package/dist/experimental/micro/sessions.d.ts.map +1 -0
- package/dist/experimental/micro/sessions.js +41 -0
- package/dist/experimental/micro/sessions.js.map +1 -0
- package/dist/experimental/micro/tools.d.ts +10 -0
- package/dist/experimental/micro/tools.d.ts.map +1 -0
- package/dist/experimental/micro/tools.js +96 -0
- package/dist/experimental/micro/tools.js.map +1 -0
- package/dist/experimental/micro/tui.d.ts +3 -0
- package/dist/experimental/micro/tui.d.ts.map +1 -0
- package/dist/experimental/micro/tui.js +510 -0
- package/dist/experimental/micro/tui.js.map +1 -0
- package/dist/experimental/mini/main.d.ts +7 -0
- package/dist/experimental/mini/main.d.ts.map +1 -0
- package/dist/experimental/mini/main.js +21 -0
- package/dist/experimental/mini/main.js.map +1 -0
- package/dist/experimental/mini/server/entry.d.ts +3 -0
- package/dist/experimental/mini/server/entry.d.ts.map +1 -0
- package/dist/experimental/mini/server/entry.js +11 -0
- package/dist/experimental/mini/server/entry.js.map +1 -0
- package/dist/experimental/mini/server/run.d.ts +13 -0
- package/dist/experimental/mini/server/run.d.ts.map +1 -0
- package/dist/experimental/mini/server/run.js +150 -0
- package/dist/experimental/mini/server/run.js.map +1 -0
- package/dist/experimental/mini/shared/protocol.d.ts +127 -0
- package/dist/experimental/mini/shared/protocol.d.ts.map +1 -0
- package/dist/experimental/mini/shared/protocol.js +13 -0
- package/dist/experimental/mini/shared/protocol.js.map +1 -0
- package/dist/experimental/mini/shared/rpc.d.ts +49 -0
- package/dist/experimental/mini/shared/rpc.d.ts.map +1 -0
- package/dist/experimental/mini/shared/rpc.js +171 -0
- package/dist/experimental/mini/shared/rpc.js.map +1 -0
- package/dist/experimental/mini/shared/transport.d.ts +35 -0
- package/dist/experimental/mini/shared/transport.d.ts.map +1 -0
- package/dist/experimental/mini/shared/transport.js +94 -0
- package/dist/experimental/mini/shared/transport.js.map +1 -0
- package/dist/experimental/mini/tui/run.d.ts +9 -0
- package/dist/experimental/mini/tui/run.d.ts.map +1 -0
- package/dist/experimental/mini/tui/run.js +62 -0
- package/dist/experimental/mini/tui/run.js.map +1 -0
- package/dist/experimental/mini/tui/session.d.ts +26 -0
- package/dist/experimental/mini/tui/session.d.ts.map +1 -0
- package/dist/experimental/mini/tui/session.js +94 -0
- package/dist/experimental/mini/tui/session.js.map +1 -0
- package/dist/experimental/mini/tui/view.d.ts +10 -0
- package/dist/experimental/mini/tui/view.d.ts.map +1 -0
- package/dist/experimental/mini/tui/view.js +461 -0
- package/dist/experimental/mini/tui/view.js.map +1 -0
- package/dist/experimental/mini/worker/entry.d.ts +3 -0
- package/dist/experimental/mini/worker/entry.d.ts.map +1 -0
- package/dist/experimental/mini/worker/entry.js +10 -0
- package/dist/experimental/mini/worker/entry.js.map +1 -0
- package/dist/experimental/mini/worker/lane-service.d.ts +44 -0
- package/dist/experimental/mini/worker/lane-service.d.ts.map +1 -0
- package/dist/experimental/mini/worker/lane-service.js +97 -0
- package/dist/experimental/mini/worker/lane-service.js.map +1 -0
- package/dist/experimental/mini/worker/models-service.d.ts +19 -0
- package/dist/experimental/mini/worker/models-service.d.ts.map +1 -0
- package/dist/experimental/mini/worker/models-service.js +136 -0
- package/dist/experimental/mini/worker/models-service.js.map +1 -0
- package/dist/experimental/mini/worker/run.d.ts +14 -0
- package/dist/experimental/mini/worker/run.d.ts.map +1 -0
- package/dist/experimental/mini/worker/run.js +88 -0
- package/dist/experimental/mini/worker/run.js.map +1 -0
- package/dist/extensions/codemode/execute.d.ts +16 -0
- package/dist/extensions/codemode/execute.d.ts.map +1 -0
- package/dist/extensions/codemode/execute.js +429 -0
- package/dist/extensions/codemode/execute.js.map +1 -0
- package/dist/extensions/codemode/execute.lazy.d.ts +3 -0
- package/dist/extensions/codemode/execute.lazy.d.ts.map +1 -0
- package/dist/extensions/codemode/execute.lazy.js +3 -0
- package/dist/extensions/codemode/execute.lazy.js.map +1 -0
- package/dist/extensions/codemode/index.d.ts +21 -0
- package/dist/extensions/codemode/index.d.ts.map +1 -0
- package/dist/extensions/codemode/index.js +31 -0
- package/dist/extensions/codemode/index.js.map +1 -0
- package/dist/extensions/codemode/renderer.d.ts +12 -0
- package/dist/extensions/codemode/renderer.d.ts.map +1 -0
- package/dist/extensions/codemode/renderer.js +137 -0
- package/dist/extensions/codemode/renderer.js.map +1 -0
- package/dist/extensions/codemode/tool.d.ts +123 -0
- package/dist/extensions/codemode/tool.d.ts.map +1 -0
- package/dist/extensions/codemode/tool.js +315 -0
- package/dist/extensions/codemode/tool.js.map +1 -0
- package/dist/extensions/codemode/worker.d.ts +7 -0
- package/dist/extensions/codemode/worker.d.ts.map +1 -0
- package/dist/extensions/codemode/worker.js +7 -0
- package/dist/extensions/codemode/worker.js.map +1 -0
- package/dist/extensions/index.d.ts.map +1 -1
- package/dist/extensions/index.js +13 -1
- package/dist/extensions/index.js.map +1 -1
- package/dist/extensions/llama/client.d.ts +8 -0
- package/dist/extensions/llama/client.d.ts.map +1 -1
- package/dist/extensions/llama/client.js +13 -0
- package/dist/extensions/llama/client.js.map +1 -1
- package/dist/extensions/llama/huggingface.js +2 -0
- package/dist/extensions/llama/huggingface.js.map +1 -1
- package/dist/extensions/llama/index.d.ts.map +1 -1
- package/dist/extensions/llama/index.js +13 -2
- package/dist/extensions/llama/index.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts +4 -2
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +121 -15
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/extensions/llama/ui.js +28 -12
- package/dist/extensions/llama/ui.js.map +1 -1
- package/dist/extensions/mcp/cli.d.ts +21 -0
- package/dist/extensions/mcp/cli.d.ts.map +1 -0
- package/dist/extensions/mcp/cli.js +500 -0
- package/dist/extensions/mcp/cli.js.map +1 -0
- package/dist/extensions/mcp/cli.lazy.d.ts +3 -0
- package/dist/extensions/mcp/cli.lazy.d.ts.map +1 -0
- package/dist/extensions/mcp/cli.lazy.js +3 -0
- package/dist/extensions/mcp/cli.lazy.js.map +1 -0
- package/dist/extensions/mcp/config.d.ts +72 -0
- package/dist/extensions/mcp/config.d.ts.map +1 -0
- package/dist/extensions/mcp/config.js +158 -0
- package/dist/extensions/mcp/config.js.map +1 -0
- package/dist/extensions/mcp/index.d.ts +76 -0
- package/dist/extensions/mcp/index.d.ts.map +1 -0
- package/dist/extensions/mcp/index.js +1055 -0
- package/dist/extensions/mcp/index.js.map +1 -0
- package/dist/extensions/mcp/log.d.ts +16 -0
- package/dist/extensions/mcp/log.d.ts.map +1 -0
- package/dist/extensions/mcp/log.js +66 -0
- package/dist/extensions/mcp/log.js.map +1 -0
- package/dist/extensions/mcp/oauth.d.ts +96 -0
- package/dist/extensions/mcp/oauth.d.ts.map +1 -0
- package/dist/extensions/mcp/oauth.js +333 -0
- package/dist/extensions/mcp/oauth.js.map +1 -0
- package/dist/extensions/mcp/resources.d.ts +43 -0
- package/dist/extensions/mcp/resources.d.ts.map +1 -0
- package/dist/extensions/mcp/resources.js +262 -0
- package/dist/extensions/mcp/resources.js.map +1 -0
- package/dist/extensions/mcp/runtime.d.ts +98 -0
- package/dist/extensions/mcp/runtime.d.ts.map +1 -0
- package/dist/extensions/mcp/runtime.js +394 -0
- package/dist/extensions/mcp/runtime.js.map +1 -0
- package/dist/extensions/mcp/runtime.lazy.d.ts +3 -0
- package/dist/extensions/mcp/runtime.lazy.d.ts.map +1 -0
- package/dist/extensions/mcp/runtime.lazy.js +3 -0
- package/dist/extensions/mcp/runtime.lazy.js.map +1 -0
- package/dist/extensions/mcp/tools.d.ts +84 -0
- package/dist/extensions/mcp/tools.d.ts.map +1 -0
- package/dist/extensions/mcp/tools.js +251 -0
- package/dist/extensions/mcp/tools.js.map +1 -0
- package/dist/extensions/mcp/ui.d.ts +60 -0
- package/dist/extensions/mcp/ui.d.ts.map +1 -0
- package/dist/extensions/mcp/ui.js +174 -0
- package/dist/extensions/mcp/ui.js.map +1 -0
- package/dist/extensions/stub-provider/index.d.ts +9 -0
- package/dist/extensions/stub-provider/index.d.ts.map +1 -0
- package/dist/extensions/stub-provider/index.js +13 -0
- package/dist/extensions/stub-provider/index.js.map +1 -0
- package/dist/extensions/stub-provider/provider.d.ts +77 -0
- package/dist/extensions/stub-provider/provider.d.ts.map +1 -0
- package/dist/extensions/stub-provider/provider.js +194 -0
- package/dist/extensions/stub-provider/provider.js.map +1 -0
- package/dist/extensions/tool-search/index.d.ts +12 -0
- package/dist/extensions/tool-search/index.d.ts.map +1 -0
- package/dist/extensions/tool-search/index.js +15 -0
- package/dist/extensions/tool-search/index.js.map +1 -0
- package/dist/extensions/tool-search/tool.d.ts +73 -0
- package/dist/extensions/tool-search/tool.d.ts.map +1 -0
- package/dist/extensions/tool-search/tool.js +189 -0
- package/dist/extensions/tool-search/tool.js.map +1 -0
- package/dist/hooks/gsd/draht-quality-gate.js +3 -3
- package/dist/index.d.ts +20 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -6
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +4 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +365 -96
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts +1 -1
- package/dist/migrations.js +7 -6
- package/dist/migrations.js.map +1 -1
- package/dist/modes/index.d.ts +1 -0
- package/dist/modes/index.d.ts.map +1 -1
- package/dist/modes/index.js.map +1 -1
- package/dist/modes/interactive/bug-report.d.ts +19 -0
- package/dist/modes/interactive/bug-report.d.ts.map +1 -0
- package/dist/modes/interactive/bug-report.js +211 -0
- package/dist/modes/interactive/bug-report.js.map +1 -0
- package/dist/modes/interactive/chat-viewport.d.ts +20 -0
- package/dist/modes/interactive/chat-viewport.d.ts.map +1 -0
- package/dist/modes/interactive/chat-viewport.js +28 -0
- package/dist/modes/interactive/chat-viewport.js.map +1 -0
- package/dist/modes/interactive/components/armin.js +10 -6
- package/dist/modes/interactive/components/armin.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +6 -2
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +38 -15
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +9 -4
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.js +3 -0
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +15 -6
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +15 -6
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +38 -10
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/countdown-timer.js +5 -0
- package/dist/modes/interactive/components/countdown-timer.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +10 -1
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +54 -2
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/custom-entry.js +4 -1
- package/dist/modes/interactive/components/custom-entry.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +7 -1
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/daxnuts.js +8 -6
- package/dist/modes/interactive/components/daxnuts.js.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.js +1 -0
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts +4 -1
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +14 -3
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-input.d.ts +2 -0
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-input.js +14 -2
- package/dist/modes/interactive/components/extension-input.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts +50 -0
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +218 -6
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts +4 -4
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.js +12 -4
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +7 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +51 -6
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +1 -1
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +9 -3
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- 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 +10 -4
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +101 -40
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +11 -3
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +4 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +60 -32
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +5 -5
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +138 -80
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +25 -4
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +240 -67
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- 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.js +1 -0
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +14 -5
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts +3 -1
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-indicator.js +12 -3
- package/dist/modes/interactive/components/status-indicator.js.map +1 -1
- package/dist/modes/interactive/components/theme-selector.js +2 -0
- package/dist/modes/interactive/components/theme-selector.js.map +1 -1
- package/dist/modes/interactive/components/themed-text.d.ts +17 -0
- package/dist/modes/interactive/components/themed-text.d.ts.map +1 -0
- package/dist/modes/interactive/components/themed-text.js +29 -0
- package/dist/modes/interactive/components/themed-text.js.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts +15 -3
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +76 -18
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +21 -4
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +88 -53
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts +20 -2
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +65 -23
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/components/trust-selector.js +8 -2
- package/dist/modes/interactive/components/trust-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.js +6 -3
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts +3 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +12 -2
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.d.ts +27 -3
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.js +39 -6
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
- package/dist/modes/interactive/external-editor.d.ts.map +1 -1
- package/dist/modes/interactive/external-editor.js +2 -1
- package/dist/modes/interactive/external-editor.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +166 -8
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +1690 -599
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/model-catalog-refresh.d.ts +7 -0
- package/dist/modes/interactive/model-catalog-refresh.d.ts.map +1 -0
- package/dist/modes/interactive/model-catalog-refresh.js +34 -0
- package/dist/modes/interactive/model-catalog-refresh.js.map +1 -0
- package/dist/modes/interactive/session-share.d.ts +23 -0
- package/dist/modes/interactive/session-share.d.ts.map +1 -0
- package/dist/modes/interactive/session-share.js +130 -0
- package/dist/modes/interactive/session-share.js.map +1 -0
- package/dist/modes/interactive/theme/dark.json +54 -63
- package/dist/modes/interactive/theme/light.json +52 -60
- package/dist/modes/interactive/theme/system-theme.d.ts +54 -0
- package/dist/modes/interactive/theme/system-theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/system-theme.js +535 -0
- package/dist/modes/interactive/theme/system-theme.js.map +1 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts +59 -7
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.js +164 -51
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
- package/dist/modes/interactive/theme/theme-json.d.ts +85 -0
- package/dist/modes/interactive/theme/theme-json.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-json.js +132 -0
- package/dist/modes/interactive/theme/theme-json.js.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.json +24 -3
- package/dist/modes/interactive/theme/theme.d.ts +80 -42
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +274 -417
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/interactive/tui-renderer.d.ts +22 -0
- package/dist/modes/interactive/tui-renderer.d.ts.map +1 -0
- package/dist/modes/interactive/tui-renderer.js +67 -0
- package/dist/modes/interactive/tui-renderer.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 +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +12 -2
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +17 -9
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +27 -15
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +179 -19
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +90 -2
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/package-manager-cli.d.ts +1 -0
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +217 -63
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/prompts/commands/atomic-commit.md +1 -12
- package/dist/prompts/commands/brainstorm.md +12 -15
- package/dist/prompts/commands/create-verification-skill.md +108 -0
- package/dist/prompts/commands/discuss-phase.md +3 -14
- package/dist/prompts/commands/execute-phase.md +3 -11
- package/dist/prompts/commands/fix.md +41 -18
- package/dist/prompts/commands/grill.md +66 -0
- package/dist/prompts/commands/init-project.md +5 -15
- package/dist/prompts/commands/map-codebase.md +1 -13
- package/dist/prompts/commands/new-project.md +5 -15
- package/dist/prompts/commands/next-milestone.md +1 -13
- package/dist/prompts/commands/orchestrate.md +1 -1
- package/dist/prompts/commands/pause-work.md +1 -13
- package/dist/prompts/commands/plan-phase.md +3 -11
- package/dist/prompts/commands/progress.md +0 -13
- package/dist/prompts/commands/quick.md +3 -11
- package/dist/prompts/commands/resolve-conflicts.md +71 -0
- package/dist/prompts/commands/resume-work.md +0 -13
- package/dist/prompts/commands/review.md +6 -13
- package/dist/prompts/commands/triage.md +159 -0
- package/dist/prompts/commands/verify-work.md +5 -14
- package/dist/prompts/commands/why.md +139 -0
- package/dist/rpc-entry.js +1 -0
- package/dist/rpc-entry.js.map +1 -1
- package/dist/skills/atomic-reasoning/SKILL.md +115 -0
- package/dist/skills/blast-radius/SKILL.md +56 -0
- package/dist/skills/epistemics/SKILL.md +99 -0
- package/dist/skills/explainers/SKILL.md +65 -0
- package/dist/skills/hexagon-animation/SKILL.md +49 -0
- package/dist/skills/hexagon-animation/generate.mjs +81 -0
- package/dist/skills/hexagon-animation/template.html +361 -0
- package/dist/skills/typescript-discipline/SKILL.md +50 -0
- package/dist/skills/typescript-discipline/references/patterns.md +294 -0
- package/dist/skills/unslop/SKILL.md +119 -0
- package/dist/utils/abort.d.ts +5 -0
- package/dist/utils/abort.d.ts.map +1 -0
- package/dist/utils/abort.js +48 -0
- package/dist/utils/abort.js.map +1 -0
- package/dist/utils/canonical-path.d.ts +28 -0
- package/dist/utils/canonical-path.d.ts.map +1 -0
- package/dist/utils/canonical-path.js +90 -0
- package/dist/utils/canonical-path.js.map +1 -0
- package/dist/utils/changelog.js +1 -1
- package/dist/utils/changelog.js.map +1 -1
- package/dist/utils/child-process.d.ts +13 -2
- package/dist/utils/child-process.d.ts.map +1 -1
- package/dist/utils/child-process.js +26 -9
- package/dist/utils/child-process.js.map +1 -1
- package/dist/utils/clipboard-command.d.ts +7 -0
- package/dist/utils/clipboard-command.d.ts.map +1 -0
- package/dist/utils/clipboard-command.js +45 -0
- package/dist/utils/clipboard-command.js.map +1 -0
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +60 -91
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard.d.ts +3 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +123 -108
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/draht-user-agent.d.ts +2 -0
- package/dist/utils/draht-user-agent.d.ts.map +1 -0
- package/dist/utils/draht-user-agent.js +5 -0
- package/dist/utils/draht-user-agent.js.map +1 -0
- package/dist/utils/exif-orientation.d.ts +2 -1
- package/dist/utils/exif-orientation.d.ts.map +1 -1
- package/dist/utils/exif-orientation.js +2 -3
- package/dist/utils/exif-orientation.js.map +1 -1
- package/dist/utils/frontmatter.d.ts.map +1 -1
- package/dist/utils/frontmatter.js +2 -1
- package/dist/utils/frontmatter.js.map +1 -1
- 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.js +1 -1
- package/dist/utils/mime.js.map +1 -1
- package/dist/utils/paths.d.ts +6 -10
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +23 -14
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/photon.d.ts +2 -1
- package/dist/utils/photon.d.ts.map +1 -1
- package/dist/utils/photon.js.map +1 -1
- package/dist/utils/shell.d.ts +4 -3
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +26 -39
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/syntax-highlight.d.ts +1 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +62 -1
- package/dist/utils/syntax-highlight.js.map +1 -1
- 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 +21 -0
- package/dist/utils/tool-result-images.d.ts.map +1 -0
- package/dist/utils/tool-result-images.js +48 -0
- package/dist/utils/tool-result-images.js.map +1 -0
- package/dist/utils/tools-manager.d.ts +11 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +56 -41
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/version-check.d.ts +4 -1
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js +30 -9
- package/dist/utils/version-check.js.map +1 -1
- package/dist/utils/wsl.d.ts +3 -0
- package/dist/utils/wsl.d.ts.map +1 -0
- package/dist/utils/wsl.js +15 -0
- package/dist/utils/wsl.js.map +1 -0
- package/dist/utils/zip.d.ts +7 -0
- package/dist/utils/zip.d.ts.map +1 -0
- package/dist/utils/zip.js +60 -0
- package/dist/utils/zip.js.map +1 -0
- package/docs/attachable-sessions.md +79 -0
- package/docs/cli-integration.md +106 -0
- package/docs/cli.md +374 -0
- package/docs/compaction.md +107 -45
- package/docs/configuration.md +47 -0
- package/docs/containerization.md +100 -66
- package/docs/custom-provider.md +109 -707
- package/docs/docs.json +155 -95
- package/docs/duet.md +42 -0
- package/docs/environment-variables.md +30 -17
- package/docs/extensions.md +169 -2811
- package/docs/how-pi-works.md +53 -0
- package/docs/images/interactive-mode.png +0 -0
- package/docs/index.md +25 -69
- package/docs/json.md +198 -57
- package/docs/keybindings.md +89 -92
- package/docs/llama-cpp.md +23 -8
- package/docs/mcp.md +231 -0
- package/docs/message-types.md +261 -0
- package/docs/models.md +94 -478
- package/docs/packages.md +68 -164
- package/docs/prompt-templates.md +31 -68
- package/docs/providers.md +118 -215
- package/docs/quickstart.md +56 -109
- package/docs/rpc-commands.md +860 -0
- package/docs/rpc-extension-ui.md +200 -0
- package/docs/rpc.md +186 -1494
- package/docs/sdk.md +79 -1127
- package/docs/security.md +77 -33
- package/docs/session-format.md +98 -222
- package/docs/sessions.md +36 -113
- package/docs/settings.md +125 -251
- package/docs/shell-aliases.md +85 -5
- package/docs/skills.md +52 -188
- package/docs/slash-commands.md +61 -0
- package/docs/terminal-setup.md +132 -61
- package/docs/termux.md +74 -84
- package/docs/themes.md +91 -252
- package/docs/tmux.md +31 -39
- package/docs/tui.md +74 -891
- package/docs/usage.md +54 -255
- package/docs/virtual-models.md +114 -0
- package/docs/windows.md +57 -7
- package/examples/extensions/antigravity-image-gen.ts +9 -9
- package/examples/extensions/bash-spawn-hook.ts +1 -1
- package/examples/extensions/border-status-editor.ts +1 -1
- package/examples/extensions/built-in-tool-renderer.ts +16 -40
- package/examples/extensions/custom-compaction.ts +1 -16
- package/examples/extensions/custom-provider-anthropic/index.ts +20 -13
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +4 -3
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +5 -5
- package/examples/extensions/debug-provider.ts +90 -0
- package/examples/extensions/doom-overlay/wad-finder.ts +7 -3
- package/examples/extensions/dynamic-resources/dynamic.json +3 -1
- package/examples/extensions/git-checkpoint.ts +2 -2
- package/examples/extensions/handoff.ts +2 -11
- package/examples/extensions/jev-router.ts +113 -0
- package/examples/extensions/minimal-mode.ts +24 -96
- package/examples/extensions/notify.ts +3 -1
- package/examples/extensions/overlay-qa-tests.ts +3 -3
- package/examples/extensions/prompt-customizer.ts +19 -67
- package/examples/extensions/qna.ts +3 -7
- package/examples/extensions/subagent/agents.ts +40 -9
- package/examples/extensions/subagent/index.ts +27 -4
- package/examples/extensions/summarize.ts +7 -18
- package/examples/extensions/titlebar-spinner.ts +1 -1
- package/examples/rpc-client.ts +35 -0
- package/examples/rpc-extension-ui.ts +38 -9
- package/examples/sdk/02-custom-model.ts +1 -2
- package/examples/sdk/06-extensions.ts +1 -1
- package/examples/sdk/09-api-keys-and-oauth.ts +1 -1
- package/examples/sdk/12-full-control.ts +1 -1
- package/examples/sdk/14-codemode-mcp.ts +61 -0
- package/hooks/gsd/draht-quality-gate.js +3 -3
- package/package.json +28 -32
- package/prompts/commands/atomic-commit.md +1 -12
- package/prompts/commands/brainstorm.md +12 -15
- package/prompts/commands/create-verification-skill.md +108 -0
- package/prompts/commands/discuss-phase.md +3 -14
- package/prompts/commands/execute-phase.md +3 -11
- package/prompts/commands/fix.md +41 -18
- package/prompts/commands/grill.md +66 -0
- package/prompts/commands/init-project.md +5 -15
- package/prompts/commands/map-codebase.md +1 -13
- package/prompts/commands/new-project.md +5 -15
- package/prompts/commands/next-milestone.md +1 -13
- package/prompts/commands/orchestrate.md +1 -1
- package/prompts/commands/pause-work.md +1 -13
- package/prompts/commands/plan-phase.md +3 -11
- package/prompts/commands/progress.md +0 -13
- package/prompts/commands/quick.md +3 -11
- package/prompts/commands/resolve-conflicts.md +71 -0
- package/prompts/commands/resume-work.md +0 -13
- package/prompts/commands/review.md +6 -13
- package/prompts/commands/triage.md +159 -0
- package/prompts/commands/verify-work.md +5 -14
- package/prompts/commands/why.md +139 -0
- package/skills/atomic-reasoning/SKILL.md +115 -0
- package/skills/blast-radius/SKILL.md +56 -0
- package/skills/epistemics/SKILL.md +99 -0
- package/skills/explainers/SKILL.md +65 -0
- package/skills/hexagon-animation/SKILL.md +49 -0
- package/skills/hexagon-animation/generate.mjs +81 -0
- package/skills/hexagon-animation/template.html +361 -0
- package/skills/typescript-discipline/SKILL.md +50 -0
- package/skills/typescript-discipline/references/patterns.md +294 -0
- package/skills/unslop/SKILL.md +119 -0
- package/dist/prompts/agents/build.md +0 -86
- package/dist/prompts/agents/plan.md +0 -79
- package/dist/prompts/agents/verify.md +0 -69
- package/dist/utils/clipboard-native.d.ts +0 -11
- package/dist/utils/clipboard-native.d.ts.map +0 -1
- package/dist/utils/clipboard-native.js +0 -20
- package/dist/utils/clipboard-native.js.map +0 -1
- package/dist/utils/pi-user-agent.d.ts +0 -2
- package/dist/utils/pi-user-agent.d.ts.map +0 -1
- package/dist/utils/pi-user-agent.js +0 -5
- package/dist/utils/pi-user-agent.js.map +0 -1
- package/docs/development.md +0 -71
- package/docs/tree.md +0 -231
- package/examples/extensions/kimi-deferred-tools.ts +0 -61
- package/prompts/agents/build.md +0 -86
- package/prompts/agents/plan.md +0 -79
- package/prompts/agents/verify.md +0 -69
|
@@ -7,37 +7,140 @@
|
|
|
7
7
|
* - Register commands, keyboard shortcuts, and CLI flags
|
|
8
8
|
* - Interact with the user via UI primitives
|
|
9
9
|
*/
|
|
10
|
-
import type { AgentMessage, AgentToolResult, AgentToolUpdateCallback, ThinkingLevel, ToolExecutionMode } from "@draht/agent-core";
|
|
11
|
-
import type { Api, AssistantMessageEvent, AssistantMessageEventStream, ConstrainedSamplingConfig,
|
|
10
|
+
import type { AgentMessage, AgentTool, AgentToolCallOutcome, AgentToolResult, AgentToolUpdateCallback, ThinkingLevel, ToolExecutionMode } from "@draht/agent-core";
|
|
11
|
+
import type { AnyModel, Api, AssistantMessageEvent, AssistantMessageEventStream, ClassifierApi, ConstrainedSamplingConfig, ImageApi, ImageContent, JsonValue, Message, Model, OAuthCredentials, OAuthLoginCallbacks, Provider, ProviderClassifier, ProviderHeaders, ProviderId, ProviderImages, RefreshModelsContext, SimpleStreamOptions, TextContent, ToolResultMessage, TranscriptContext, Usage } from "@draht/ai";
|
|
12
12
|
import type { AutocompleteItem, AutocompleteProvider, Component, EditorComponent, EditorTheme, KeyId, OverlayHandle, OverlayOptions, TUI } from "@draht/tui";
|
|
13
13
|
import type { Static, TSchema } from "typebox";
|
|
14
14
|
import type { Theme } from "../../modes/interactive/theme/theme.ts";
|
|
15
15
|
import type { BashResult } from "../bash-executor.ts";
|
|
16
|
+
import type { CacheWarmingDecisionEvent, CacheWarmingDecisionEventResult } from "../cache-warmer.ts";
|
|
17
|
+
import type { CheckpointCaptureResult, CheckpointManager, CheckpointRecord, CheckpointRestoreOptions, CheckpointRestoreResult } from "../checkpoints/checkpoint-manager.ts";
|
|
16
18
|
import type { CompactionPreparation, CompactionResult } from "../compaction/index.ts";
|
|
17
19
|
import type { EventBus } from "../event-bus.ts";
|
|
18
20
|
import type { ExecOptions, ExecResult } from "../exec.ts";
|
|
19
21
|
import type { ReadonlyFooterDataProvider } from "../footer-data-provider.ts";
|
|
20
22
|
import type { KeybindingsManager } from "../keybindings.ts";
|
|
23
|
+
import type { McpServerConfig, McpServerRegistry, RegisteredMcpServer } from "../mcp-servers.ts";
|
|
21
24
|
import type { CustomMessage } from "../messages.ts";
|
|
22
25
|
import type { ModelRegistry } from "../model-registry.ts";
|
|
23
26
|
import type { ScopedModel } from "../model-resolver.ts";
|
|
24
|
-
import type {
|
|
27
|
+
import type { RelayOutcome } from "../permission-relay/types.ts";
|
|
28
|
+
import type { BranchSummaryEntry, CompactionEntry, ContextEditEntry, CustomEntry, ProjectedSessionEntry, ReadonlySessionManager, SessionEntry, SessionManager } from "../session-manager.ts";
|
|
29
|
+
import type { Settings } from "../settings-manager.ts";
|
|
25
30
|
import type { SlashCommandInfo } from "../slash-commands.ts";
|
|
26
31
|
import type { SourceInfo } from "../source-info.ts";
|
|
27
|
-
import type { BuildSystemPromptOptions } from "../system-prompt.ts";
|
|
32
|
+
import type { BuildSystemPromptOptions, NormalizedBuildSystemPromptOptions } from "../system-prompt.ts";
|
|
28
33
|
import type { BashOperations } from "../tools/bash.ts";
|
|
29
34
|
import type { EditToolDetails } from "../tools/edit.ts";
|
|
30
|
-
import type { BashToolDetails, BashToolInput, EditToolInput, FindToolDetails, FindToolInput, GrepToolDetails, GrepToolInput, LsToolDetails, LsToolInput, ReadToolDetails, ReadToolInput, WriteToolInput } from "../tools/index.ts";
|
|
35
|
+
import type { BashToolDetails, BashToolInput, EditToolInput, FindToolDetails, FindToolInput, GrepToolDetails, GrepToolInput, LsToolDetails, LsToolInput, PowerShellToolDetails, PowerShellToolInput, ReadToolDetails, ReadToolInput, WriteToolInput } from "../tools/index.ts";
|
|
36
|
+
import type { ModelRoute, ModelRouteRequest, VirtualModelDefinition } from "../virtual-models.ts";
|
|
37
|
+
export type { AutocompleteItem } from "@draht/tui";
|
|
31
38
|
export type { ExecOptions, ExecResult } from "../exec.ts";
|
|
32
|
-
export type { BuildSystemPromptOptions } from "../system-prompt.ts";
|
|
39
|
+
export type { BuildSystemPromptOptions, NormalizedBuildSystemPromptOptions } from "../system-prompt.ts";
|
|
33
40
|
export type { AgentToolResult, AgentToolUpdateCallback, ToolExecutionMode };
|
|
34
41
|
export type { AppKeybinding, KeybindingsManager } from "../keybindings.ts";
|
|
42
|
+
/**
|
|
43
|
+
* Structured detail for a tool permission ask.
|
|
44
|
+
*
|
|
45
|
+
* Carried as optional trailing data on {@link ExtensionUIDialogOptions} so that every surface
|
|
46
|
+
* (TUI, attached client, RPC) renders the same canonical facts instead of a prose summary.
|
|
47
|
+
* All fields are already-resolved values: `cwd` is a canonical (realpath) directory, and
|
|
48
|
+
* `options` is the immutable set of choices that were offered for this request.
|
|
49
|
+
*/
|
|
50
|
+
export interface PermissionAskDetail {
|
|
51
|
+
kind: "tool_permission";
|
|
52
|
+
/** Id of the tool call this ask gates. */
|
|
53
|
+
toolCallId: string;
|
|
54
|
+
/** Name of the tool being gated (e.g. "bash", "write"). */
|
|
55
|
+
toolName: string;
|
|
56
|
+
/** Canonical (realpath) working directory the tool call would run in. */
|
|
57
|
+
cwd: string;
|
|
58
|
+
/** The command line, for command-shaped tools. */
|
|
59
|
+
command?: string;
|
|
60
|
+
/** The target path, for file-shaped tools. */
|
|
61
|
+
path?: string;
|
|
62
|
+
/** The operation being performed, when the tool distinguishes several. */
|
|
63
|
+
operation?: string;
|
|
64
|
+
/** Why the permission gate stopped this call. */
|
|
65
|
+
reason: string;
|
|
66
|
+
/**
|
|
67
|
+
* True when ANY free-text field above was elided to fit its budget.
|
|
68
|
+
*
|
|
69
|
+
* A human is entitled to know they are approving an abbreviated string. This field is the only
|
|
70
|
+
* carrier of that fact: the producer bounds by graphemes AND bytes, and the elision is not
|
|
71
|
+
* recoverable from the value afterwards — a 5000-character command arrives here already cut to
|
|
72
|
+
* ~530 characters, comfortably inside every downstream budget, so nothing later can rediscover
|
|
73
|
+
* that anything was dropped.
|
|
74
|
+
*
|
|
75
|
+
* It lives on the SHARED type rather than as a structural widening at each end on purpose. It was
|
|
76
|
+
* first added as two independent optional widenings — one in the producer, one in the relay — and
|
|
77
|
+
* an adversarial reviewer pointed out that renaming or dropping either side would typecheck clean
|
|
78
|
+
* and silently degrade to `false`, which is exactly the defect it was added to fix, restored in
|
|
79
|
+
* silence. Declared here, both ends refer to one name and the compiler notices.
|
|
80
|
+
*
|
|
81
|
+
* Still optional, so a producer that does not bound anything is unaffected and can never
|
|
82
|
+
* fabricate a `true`. Hand-mirrored in `RpcPermissionDetail` (`modes/rpc/rpc-types.ts`).
|
|
83
|
+
*/
|
|
84
|
+
truncated?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* The immutable set of options offered for this request, each stating its OWN semantics.
|
|
87
|
+
*
|
|
88
|
+
* `decision` is what makes this a permission vocabulary rather than a list of words: it says,
|
|
89
|
+
* per option, whether choosing it lets the tool call proceed. Consumers read it; nothing may
|
|
90
|
+
* infer an option's meaning from its position in this array, from the array's length, or from
|
|
91
|
+
* its id — a vocabulary like `[allow, deny-once, deny-always]` has its denial in the middle and
|
|
92
|
+
* two of them, and a positional rule silently turns a human's denial into an approval.
|
|
93
|
+
*
|
|
94
|
+
* A vocabulary must be non-empty, must carry only the two decision words, and must not repeat
|
|
95
|
+
* an id. A consumer that cannot honour those rules must offer NOTHING rather than substitute a
|
|
96
|
+
* vocabulary of its own: an empty list is a caller that authorised no option, and a repeated id
|
|
97
|
+
* makes array position decide which of two options an answer names.
|
|
98
|
+
*/
|
|
99
|
+
options: readonly {
|
|
100
|
+
id: string;
|
|
101
|
+
label: string;
|
|
102
|
+
decision: "approve" | "deny";
|
|
103
|
+
}[];
|
|
104
|
+
}
|
|
35
105
|
/** Options for extension UI dialogs. */
|
|
36
106
|
export interface ExtensionUIDialogOptions {
|
|
37
107
|
/** AbortSignal to programmatically dismiss the dialog. */
|
|
38
108
|
signal?: AbortSignal;
|
|
39
109
|
/** Timeout in milliseconds. Dialog auto-dismisses with live countdown display. */
|
|
40
110
|
timeout?: number;
|
|
111
|
+
/**
|
|
112
|
+
* Structured detail for a tool permission ask.
|
|
113
|
+
*
|
|
114
|
+
* Optional and purely additive: third-party extensions implement `ExtensionUIContext`,
|
|
115
|
+
* so widening the options object is the only backwards-compatible way to carry it.
|
|
116
|
+
*/
|
|
117
|
+
detail?: PermissionAskDetail;
|
|
118
|
+
/**
|
|
119
|
+
* The surface STATES ITS OWN OUTCOME, just before it resolves.
|
|
120
|
+
*
|
|
121
|
+
* {@link ExtensionUIContext.confirm} returns a bare `Promise<boolean>`, and that is the whole
|
|
122
|
+
* problem: a human pressing "No" and a surface GIVING UP — a shutdown, a stdin EOF, an abort,
|
|
123
|
+
* the surface's own timeout — resolve to the same `false`. Anything derived from that boolean
|
|
124
|
+
* therefore fabricates something, and what it fabricated was a human's refusal recorded against
|
|
125
|
+
* asks nobody ever answered. There is no cleverer reading of a boolean that fixes this; the
|
|
126
|
+
* only fix is for the party that knows to say so.
|
|
127
|
+
*
|
|
128
|
+
* Call it with what ACTUALLY happened:
|
|
129
|
+
*
|
|
130
|
+
* - `{kind: "approved" | "denied", chosenOptionId}` — somebody answered. `chosenOptionId` names
|
|
131
|
+
* the offered option when the surface validated one (this is how a `deny-once` an operator
|
|
132
|
+
* actually named reaches the audit row instead of a `null`), and is `null` for a surface that
|
|
133
|
+
* drew its own Yes/No and never named one.
|
|
134
|
+
* - `{kind: "answered"}` — a `select` or `input` was answered. Neither grants nor refuses.
|
|
135
|
+
* - `{kind: "cancelled"}` — NOBODY ANSWERED. Shutdown, abort, EOF, dismissal, timeout. An
|
|
136
|
+
* ending reported this way is attributed to the system, never to the surface.
|
|
137
|
+
*
|
|
138
|
+
* OPTIONAL, AND ADDITIVE ON PURPOSE. Third parties implement `ExtensionUIContext`, so a base
|
|
139
|
+
* that never calls this keeps today's behaviour exactly — the caller falls back to reading the
|
|
140
|
+
* resolved value. Only the FIRST call is used; a surface that reports again while being torn
|
|
141
|
+
* down cannot overwrite the answer that already won.
|
|
142
|
+
*/
|
|
143
|
+
reportOutcome?: (outcome: RelayOutcome) => void;
|
|
41
144
|
}
|
|
42
145
|
/** Placement for extension widgets. */
|
|
43
146
|
export type WidgetPlacement = "aboveEditor" | "belowEditor";
|
|
@@ -101,8 +204,8 @@ export interface ExtensionUIContext {
|
|
|
101
204
|
/** Set a custom footer component, or undefined to restore the built-in footer.
|
|
102
205
|
*
|
|
103
206
|
* The factory receives a FooterDataProvider for data not otherwise accessible:
|
|
104
|
-
* git branch and extension statuses from setStatus().
|
|
105
|
-
*
|
|
207
|
+
* git branch and extension statuses from setStatus(). Context usage is on
|
|
208
|
+
* ctx.getContextUsage(), token stats on ctx.sessionManager.getEntries(), model info on ctx.model.
|
|
106
209
|
*/
|
|
107
210
|
setFooter(factory: ((tui: TUI, theme: Theme, footerData: ReadonlyFooterDataProvider) => Component & {
|
|
108
211
|
dispose?(): void;
|
|
@@ -189,6 +292,15 @@ export interface ExtensionUIContext {
|
|
|
189
292
|
getToolsExpanded(): boolean;
|
|
190
293
|
/** Set tool output expansion state. */
|
|
191
294
|
setToolsExpanded(expanded: boolean): void;
|
|
295
|
+
/**
|
|
296
|
+
* True only while some surface can actually answer right now.
|
|
297
|
+
*
|
|
298
|
+
* Optional: an implementation that omits it is assumed to be able to answer, which keeps
|
|
299
|
+
* every existing implementer working unchanged. Implementations that can lose their answering
|
|
300
|
+
* surface at runtime (for example a relay whose clients have all disconnected) must evaluate
|
|
301
|
+
* this LIVE on every call rather than caching it.
|
|
302
|
+
*/
|
|
303
|
+
hasAnswerSurface?(): boolean;
|
|
192
304
|
}
|
|
193
305
|
export interface ContextUsage {
|
|
194
306
|
/** Estimated context tokens, or null if unknown (e.g. right after compaction, before next LLM response). */
|
|
@@ -247,6 +359,34 @@ export interface ExtensionContext {
|
|
|
247
359
|
/** Get the current effective system prompt. */
|
|
248
360
|
getSystemPrompt(): string;
|
|
249
361
|
}
|
|
362
|
+
/** Options for {@link ExtensionToolContext.executeTool}. */
|
|
363
|
+
export interface ExecuteToolOptions {
|
|
364
|
+
/** Defaults to the calling tool's signal. */
|
|
365
|
+
signal?: AbortSignal;
|
|
366
|
+
/** Receives partial results of the nested tool, in addition to `tool_execution_update` events. */
|
|
367
|
+
onUpdate?: AgentToolUpdateCallback;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Context passed to tool `execute()` in a session: the extension context plus `executeTool()`
|
|
371
|
+
* for running other tools through the same validation, hooks, and permission checks as
|
|
372
|
+
* model-issued calls.
|
|
373
|
+
*
|
|
374
|
+
* A tool wrapped with `wrapToolDefinition()` without a context factory, such as a built-in tool
|
|
375
|
+
* created with `createBashTool()` and run in a plain `Agent` or called directly, gets no context.
|
|
376
|
+
*/
|
|
377
|
+
export interface ExtensionToolContext extends ExtensionContext {
|
|
378
|
+
/** Tools {@link executeTool} can call. */
|
|
379
|
+
readonly tools: readonly AgentTool[];
|
|
380
|
+
/**
|
|
381
|
+
* Run another tool. The call gets the id `<calling id>/<n>`, and the `tool_call`, `tool_result`,
|
|
382
|
+
* and `tool_execution_*` events carry `parentToolCallId`. It does not appear in the transcript;
|
|
383
|
+
* a bounded record of it is kept as `nestedCalls` on the calling tool's result message.
|
|
384
|
+
*
|
|
385
|
+
* Never rejects for tool failures: unknown tools, validation errors, blocked calls, and thrown
|
|
386
|
+
* errors come back as `isError: true`.
|
|
387
|
+
*/
|
|
388
|
+
executeTool(name: string, args: unknown, options?: ExecuteToolOptions): Promise<AgentToolCallOutcome>;
|
|
389
|
+
}
|
|
250
390
|
/**
|
|
251
391
|
* Extended context for command handlers.
|
|
252
392
|
* Includes session control methods only safe in user-initiated commands.
|
|
@@ -301,6 +441,7 @@ export interface ReplacedSessionContext extends ExtensionCommandContext {
|
|
|
301
441
|
}): Promise<void>;
|
|
302
442
|
sendUserMessage(content: string | (TextContent | ImageContent)[], options?: {
|
|
303
443
|
deliverAs?: "steer" | "followUp";
|
|
444
|
+
expandPromptTemplates?: boolean;
|
|
304
445
|
}): Promise<void>;
|
|
305
446
|
}
|
|
306
447
|
/** Rendering options for tool results */
|
|
@@ -337,6 +478,69 @@ export interface ToolRenderContext<TState = any, TArgs = any> {
|
|
|
337
478
|
/** Whether the current result is an error. */
|
|
338
479
|
isError: boolean;
|
|
339
480
|
}
|
|
481
|
+
/**
|
|
482
|
+
* How the model reaches a tool. "Callable" means callable from other tools through
|
|
483
|
+
* `ctx.executeTool()`, as the `codemode` tool does.
|
|
484
|
+
*
|
|
485
|
+
* - `direct`: declared to the model while active, and callable while active.
|
|
486
|
+
* - `model-only`: declared to the model while active, never callable. Use it for orchestrating or
|
|
487
|
+
* interactive tools.
|
|
488
|
+
* - `codemode`: callable whenever registered. Not declared to the model unless explicitly
|
|
489
|
+
* activated. Codemode tools list it in their description.
|
|
490
|
+
* - `deferred`: like `codemode`, but codemode tools do not list it; tool search can find it.
|
|
491
|
+
* - `hidden`: registered but unreachable. Activating it has no effect.
|
|
492
|
+
*
|
|
493
|
+
* `direct` and `model-only` tools are activated when they are registered; the others are not.
|
|
494
|
+
* The active tool set (`getActiveTools`/`setActiveTools`) is the set declared to the model.
|
|
495
|
+
*/
|
|
496
|
+
export type ToolExposure = "direct" | "model-only" | "codemode" | "deferred" | "hidden";
|
|
497
|
+
/**
|
|
498
|
+
* Hints about what a tool does, with the meaning of MCP tool annotations. They come from the tool's
|
|
499
|
+
* author and are not verified; permission extensions can use them to decide which calls to confirm.
|
|
500
|
+
*/
|
|
501
|
+
export interface ToolAnnotations {
|
|
502
|
+
/** The tool does not modify its environment. */
|
|
503
|
+
readOnlyHint?: boolean;
|
|
504
|
+
/** The tool may delete or overwrite data, rather than only add to it. Meaningful when not read-only. */
|
|
505
|
+
destructiveHint?: boolean;
|
|
506
|
+
/** Repeating a call with the same arguments has no further effect. Meaningful when not read-only. */
|
|
507
|
+
idempotentHint?: boolean;
|
|
508
|
+
/** The tool reaches an open world of external entities, such as the web, rather than a closed domain. */
|
|
509
|
+
openWorldHint?: boolean;
|
|
510
|
+
}
|
|
511
|
+
/** A group of related tools, such as the tools of one MCP server. Codemode tools list them together. */
|
|
512
|
+
export interface ToolNamespace {
|
|
513
|
+
/** For example `mcp__docs`. */
|
|
514
|
+
name: string;
|
|
515
|
+
/** Short summary shown once with the group in model-facing tool listings. */
|
|
516
|
+
description?: string;
|
|
517
|
+
/**
|
|
518
|
+
* Longer usage guidance, such as MCP server instructions. Not part of tool listings; tools that
|
|
519
|
+
* describe the namespace on request (codemode's `describeNamespace()`) return it.
|
|
520
|
+
*/
|
|
521
|
+
instructions?: string;
|
|
522
|
+
}
|
|
523
|
+
/** The tools of a session as {@link ToolDefinition.prepareLoadout} sees them. */
|
|
524
|
+
export interface ToolLoadout {
|
|
525
|
+
/** Tools declared to the model (the active tools), in order, with their original descriptions. */
|
|
526
|
+
readonly declared: readonly AgentTool[];
|
|
527
|
+
/** Tools callable through `ctx.executeTool()`. */
|
|
528
|
+
readonly callable: readonly AgentTool[];
|
|
529
|
+
/** Every registered tool. */
|
|
530
|
+
readonly registered: readonly AgentTool[];
|
|
531
|
+
getExposure(name: string): ToolExposure;
|
|
532
|
+
getNamespace(name: string): ToolNamespace | undefined;
|
|
533
|
+
}
|
|
534
|
+
/** Changes {@link ToolDefinition.prepareLoadout} makes to what the model sees. */
|
|
535
|
+
export interface ToolLoadoutChanges {
|
|
536
|
+
/** Model-facing descriptions of declared tools, by tool name. */
|
|
537
|
+
descriptions?: Readonly<Record<string, string>>;
|
|
538
|
+
/**
|
|
539
|
+
* Declared tools whose declarations requests leave out. They stay active and callable, and the
|
|
540
|
+
* transcript still declares them, so the active set survives `/tree` and resume.
|
|
541
|
+
*/
|
|
542
|
+
hiddenDeclarations?: readonly string[];
|
|
543
|
+
}
|
|
340
544
|
/**
|
|
341
545
|
* Tool definition for registerTool().
|
|
342
546
|
*/
|
|
@@ -359,6 +563,31 @@ export interface ToolDefinition<TParams extends TSchema = TSchema, TDetails = un
|
|
|
359
563
|
renderShell?: "default" | "self";
|
|
360
564
|
/** Optional compatibility shim to prepare raw tool call arguments before schema validation. Must return an object conforming to TParams. */
|
|
361
565
|
prepareArguments?: (args: unknown) => Static<TParams>;
|
|
566
|
+
/**
|
|
567
|
+
* JSON Schema of `structuredContent` in successful results. Tools that declare it should always
|
|
568
|
+
* set `structuredContent`; codemode scripts then receive it instead of the text content.
|
|
569
|
+
*/
|
|
570
|
+
outputSchema?: TSchema;
|
|
571
|
+
/**
|
|
572
|
+
* How the model reaches the tool. Default: `"direct"`. See {@link ToolExposure}.
|
|
573
|
+
*/
|
|
574
|
+
exposure?: ToolExposure;
|
|
575
|
+
/** Group the tool belongs to, for example its MCP server. */
|
|
576
|
+
namespace?: ToolNamespace;
|
|
577
|
+
/** Hints about what the tool does, for example from an MCP server. */
|
|
578
|
+
annotations?: ToolAnnotations;
|
|
579
|
+
/**
|
|
580
|
+
* Whether registering the tool activates it. Default: `true` for `direct` and `model-only` tools;
|
|
581
|
+
* other exposures are never activated on registration. A tool with `defaultActive: false` is
|
|
582
|
+
* activated by naming it in `--tools` or the `defaultTools` setting, or with `setActiveTools()`.
|
|
583
|
+
*/
|
|
584
|
+
defaultActive?: boolean;
|
|
585
|
+
/**
|
|
586
|
+
* Adjust how the loadout is presented to the model while this tool is active. Called whenever
|
|
587
|
+
* the active tools change. Tools that orchestrate other tools use it, for example to list the
|
|
588
|
+
* callable tools in their own description.
|
|
589
|
+
*/
|
|
590
|
+
prepareLoadout?: (loadout: ToolLoadout) => ToolLoadoutChanges | undefined;
|
|
362
591
|
/**
|
|
363
592
|
* Per-tool execution mode override.
|
|
364
593
|
* - "sequential": this tool must execute one at a time with other tool calls.
|
|
@@ -368,7 +597,7 @@ export interface ToolDefinition<TParams extends TSchema = TSchema, TDetails = un
|
|
|
368
597
|
*/
|
|
369
598
|
executionMode?: ToolExecutionMode;
|
|
370
599
|
/** Execute the tool. */
|
|
371
|
-
execute(toolCallId: string, params: Static<TParams>, signal: AbortSignal | undefined, onUpdate: AgentToolUpdateCallback<TDetails> | undefined, ctx:
|
|
600
|
+
execute(toolCallId: string, params: Static<TParams>, signal: AbortSignal | undefined, onUpdate: AgentToolUpdateCallback<TDetails> | undefined, ctx: ExtensionToolContext): Promise<AgentToolResult<TDetails>>;
|
|
372
601
|
/** Custom rendering for tool call display */
|
|
373
602
|
renderCall?: (args: Static<TParams>, theme: Theme, context: ToolRenderContext<TState, Static<TParams>>) => Component;
|
|
374
603
|
/** Custom rendering for tool result display */
|
|
@@ -411,6 +640,17 @@ export interface ResourcesDiscoverResult {
|
|
|
411
640
|
promptPaths?: string[];
|
|
412
641
|
themePaths?: string[];
|
|
413
642
|
}
|
|
643
|
+
/**
|
|
644
|
+
* Fired when an extension registers or unregisters an MCP server after the extensions are bound
|
|
645
|
+
* (see {@link ExtensionAPI.registerMcpServer}). Servers registered while extensions load are read
|
|
646
|
+
* with `pi.getMcpServers()` on `session_start`. Handling this event marks an extension as the one
|
|
647
|
+
* that connects registered servers.
|
|
648
|
+
*/
|
|
649
|
+
export interface McpServersChangeEvent {
|
|
650
|
+
type: "mcp_servers_change";
|
|
651
|
+
/** Every registered server after the change. */
|
|
652
|
+
servers: RegisteredMcpServer[];
|
|
653
|
+
}
|
|
414
654
|
/** Fired when a session is started, loaded, or reloaded */
|
|
415
655
|
export interface SessionStartEvent {
|
|
416
656
|
type: "session_start";
|
|
@@ -449,7 +689,7 @@ export interface SessionBeforeCompactEvent {
|
|
|
449
689
|
willRetry: boolean;
|
|
450
690
|
signal: AbortSignal;
|
|
451
691
|
}
|
|
452
|
-
/** Fired after context compaction */
|
|
692
|
+
/** Fired after context compaction succeeds */
|
|
453
693
|
export interface SessionCompactEvent {
|
|
454
694
|
type: "session_compact";
|
|
455
695
|
compactionEntry: CompactionEntry;
|
|
@@ -459,6 +699,20 @@ export interface SessionCompactEvent {
|
|
|
459
699
|
/** True when the aborted turn is retried after this compaction (overflow recovery) */
|
|
460
700
|
willRetry: boolean;
|
|
461
701
|
}
|
|
702
|
+
/** Fired after context compaction fails or is aborted */
|
|
703
|
+
export interface SessionCompactFailedEvent {
|
|
704
|
+
type: "session_compact_failed";
|
|
705
|
+
/** What triggered the compaction: manual /compact, the context threshold, or context overflow recovery */
|
|
706
|
+
reason: "manual" | "threshold" | "overflow";
|
|
707
|
+
/** Error text when compaction failed for a non-abort reason. */
|
|
708
|
+
errorMessage?: string;
|
|
709
|
+
/** True when compaction was cancelled or aborted. */
|
|
710
|
+
aborted: boolean;
|
|
711
|
+
/** True when the aborted turn would have been retried after this compaction (overflow recovery) */
|
|
712
|
+
willRetry: boolean;
|
|
713
|
+
/** True when the failing compaction content came from a session_before_compact handler. */
|
|
714
|
+
fromExtension: boolean;
|
|
715
|
+
}
|
|
462
716
|
/** Fired before an extension runtime is torn down due to quit, reload, or session replacement. */
|
|
463
717
|
export interface SessionShutdownEvent {
|
|
464
718
|
type: "session_shutdown";
|
|
@@ -486,6 +740,20 @@ export interface SessionBeforeTreeEvent {
|
|
|
486
740
|
preparation: TreePreparation;
|
|
487
741
|
signal: AbortSignal;
|
|
488
742
|
}
|
|
743
|
+
/**
|
|
744
|
+
* Fired before a `/rewind` restores conversation and/or working-tree state
|
|
745
|
+
* (can be cancelled). Emitted before the pre-rewind safety snapshot is taken,
|
|
746
|
+
* so a cancelling handler leaves both halves of the session untouched.
|
|
747
|
+
*/
|
|
748
|
+
export interface SessionBeforeRewindEvent {
|
|
749
|
+
type: "session_before_rewind";
|
|
750
|
+
/** Entry the rewind targets. */
|
|
751
|
+
targetEntryId: string;
|
|
752
|
+
/** Current conversation leaf the rewind starts from. */
|
|
753
|
+
currentEntryId: string;
|
|
754
|
+
/** Which halves of the state the rewind would restore. */
|
|
755
|
+
scope: "conversation-and-files" | "conversation-only" | "files-only";
|
|
756
|
+
}
|
|
489
757
|
/** Fired after navigating in the session tree */
|
|
490
758
|
export interface SessionTreeEvent {
|
|
491
759
|
type: "session_tree";
|
|
@@ -494,12 +762,32 @@ export interface SessionTreeEvent {
|
|
|
494
762
|
summaryEntry?: BranchSummaryEntry;
|
|
495
763
|
fromExtension?: boolean;
|
|
496
764
|
}
|
|
497
|
-
export type SessionEvent = SessionStartEvent | SessionInfoChangedEvent | SessionBeforeSwitchEvent | SessionBeforeForkEvent | SessionBeforeCompactEvent | SessionCompactEvent | SessionShutdownEvent | SessionBeforeTreeEvent | SessionTreeEvent;
|
|
498
|
-
/** Fired
|
|
765
|
+
export type SessionEvent = SessionStartEvent | SessionInfoChangedEvent | SessionBeforeSwitchEvent | SessionBeforeForkEvent | SessionBeforeCompactEvent | SessionCompactEvent | SessionCompactFailedEvent | SessionShutdownEvent | SessionBeforeTreeEvent | SessionBeforeRewindEvent | SessionTreeEvent;
|
|
766
|
+
/** Fired after a working-tree checkpoint has been captured and recorded. */
|
|
767
|
+
export interface CheckpointCreatedEvent {
|
|
768
|
+
type: "checkpoint_created";
|
|
769
|
+
record: CheckpointRecord;
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* Fired before each LLM call. Can modify messages.
|
|
773
|
+
*
|
|
774
|
+
* `messages` holds the conversation without system messages. The prompt and tool state
|
|
775
|
+
* belong to Pi: it restores them after the handler returns, so a handler cannot drop
|
|
776
|
+
* them and does not need to preserve them.
|
|
777
|
+
*/
|
|
499
778
|
export interface ContextEvent {
|
|
500
779
|
type: "context";
|
|
501
780
|
messages: AgentMessage[];
|
|
502
781
|
}
|
|
782
|
+
/**
|
|
783
|
+
* Fired before each LLM call, after every `context` handler has run and draht has restored
|
|
784
|
+
* the prompt and tool state. `messages` is the full transcript including system messages,
|
|
785
|
+
* and the result is sent as returned: the handler owns the prompt and tool declarations.
|
|
786
|
+
*/
|
|
787
|
+
export interface ContextWithSystemEvent {
|
|
788
|
+
type: "context_with_system";
|
|
789
|
+
messages: AgentMessage[];
|
|
790
|
+
}
|
|
503
791
|
/** Fired before a provider request is sent. Can replace the payload. */
|
|
504
792
|
export interface BeforeProviderRequestEvent {
|
|
505
793
|
type: "before_provider_request";
|
|
@@ -520,6 +808,14 @@ export interface AfterProviderResponseEvent {
|
|
|
520
808
|
status: number;
|
|
521
809
|
headers: Record<string, string>;
|
|
522
810
|
}
|
|
811
|
+
/** Fired for a parsed provider stream event before Pi normalizes it. */
|
|
812
|
+
export interface ProviderStreamEvent {
|
|
813
|
+
type: "provider_stream_event";
|
|
814
|
+
provider: ProviderId;
|
|
815
|
+
api: Api;
|
|
816
|
+
model: string;
|
|
817
|
+
data: unknown;
|
|
818
|
+
}
|
|
523
819
|
/** Fired after user submits prompt but before agent loop. */
|
|
524
820
|
export interface BeforeAgentStartEvent {
|
|
525
821
|
type: "before_agent_start";
|
|
@@ -527,10 +823,10 @@ export interface BeforeAgentStartEvent {
|
|
|
527
823
|
prompt: string;
|
|
528
824
|
/** Images attached to the user prompt, if any. */
|
|
529
825
|
images?: ImageContent[];
|
|
530
|
-
/** The
|
|
531
|
-
systemPrompt: string;
|
|
532
|
-
/**
|
|
533
|
-
systemPromptOptions:
|
|
826
|
+
/** The current system prompt, rendered from systemPromptOptions and earlier handler changes. */
|
|
827
|
+
readonly systemPrompt: string;
|
|
828
|
+
/** Mutable prompt sections. Later handlers observe mutations made by earlier handlers. */
|
|
829
|
+
systemPromptOptions: NormalizedBuildSystemPromptOptions;
|
|
534
830
|
}
|
|
535
831
|
/** Fired when an agent loop starts */
|
|
536
832
|
export interface AgentStartEvent {
|
|
@@ -541,10 +837,73 @@ export interface AgentEndEvent {
|
|
|
541
837
|
type: "agent_end";
|
|
542
838
|
messages: AgentMessage[];
|
|
543
839
|
}
|
|
840
|
+
export type AgentActivityOutcome = "completed" | "aborted" | "error";
|
|
841
|
+
export interface CustomEntryDraft {
|
|
842
|
+
type: "custom";
|
|
843
|
+
customType: string;
|
|
844
|
+
data?: unknown;
|
|
845
|
+
}
|
|
846
|
+
export interface CustomMessageEntryDraft {
|
|
847
|
+
type: "custom_message";
|
|
848
|
+
customType: string;
|
|
849
|
+
content: string | (TextContent | ImageContent)[];
|
|
850
|
+
display: boolean;
|
|
851
|
+
details?: unknown;
|
|
852
|
+
}
|
|
853
|
+
export interface ContextEditEntryDraft {
|
|
854
|
+
type: "context_edit";
|
|
855
|
+
targetId: string;
|
|
856
|
+
replacement: ContextEditEntry["replacement"];
|
|
857
|
+
}
|
|
858
|
+
export interface CompactionEntryDraft {
|
|
859
|
+
type: "compaction";
|
|
860
|
+
summary: string;
|
|
861
|
+
/** Null creates a self-retaining compaction that keeps no preceding entries. */
|
|
862
|
+
firstKeptEntryId: string | null;
|
|
863
|
+
details?: unknown;
|
|
864
|
+
usage?: Usage;
|
|
865
|
+
}
|
|
866
|
+
export type SessionBoundaryDraft = CustomEntryDraft | CustomMessageEntryDraft | ContextEditEntryDraft | CompactionEntryDraft;
|
|
867
|
+
export interface BoundaryContextPreview {
|
|
868
|
+
contextEntries: ProjectedSessionEntry[];
|
|
869
|
+
contextMessages: AgentMessage[];
|
|
870
|
+
llmMessages: Message[];
|
|
871
|
+
pendingMessages: AgentMessage[];
|
|
872
|
+
canContinue: boolean;
|
|
873
|
+
}
|
|
874
|
+
export interface BoundaryState {
|
|
875
|
+
entries: SessionBoundaryDraft[];
|
|
876
|
+
continue: boolean;
|
|
877
|
+
context: BoundaryContextPreview;
|
|
878
|
+
outcome: AgentActivityOutcome;
|
|
879
|
+
}
|
|
880
|
+
export interface BoundaryResult {
|
|
881
|
+
entries?: SessionBoundaryDraft[];
|
|
882
|
+
continue?: boolean;
|
|
883
|
+
}
|
|
884
|
+
/** Fired before final settlement. May append entries and ensure one next provider request. */
|
|
885
|
+
export interface AgentBeforeSettleEvent extends BoundaryState {
|
|
886
|
+
type: "agent_before_settle";
|
|
887
|
+
}
|
|
544
888
|
/** Fired after an agent run has fully settled and no automatic retry, compaction, or queued continuation will run. */
|
|
545
889
|
export interface AgentSettledEvent {
|
|
546
890
|
type: "agent_settled";
|
|
547
891
|
}
|
|
892
|
+
export type UIPromptKind = "select" | "confirm" | "input" | "editor" | "custom";
|
|
893
|
+
/** Fired when Pi starts waiting on a blocking user-facing extension UI prompt. */
|
|
894
|
+
export interface UIPromptStartEvent {
|
|
895
|
+
type: "ui_prompt_start";
|
|
896
|
+
reason: "ui_prompt";
|
|
897
|
+
kind: UIPromptKind;
|
|
898
|
+
title?: string;
|
|
899
|
+
}
|
|
900
|
+
/** Fired when Pi is no longer waiting on a blocking user-facing extension UI prompt. */
|
|
901
|
+
export interface UIPromptEndEvent {
|
|
902
|
+
type: "ui_prompt_end";
|
|
903
|
+
reason: "ui_prompt";
|
|
904
|
+
kind: UIPromptKind;
|
|
905
|
+
title?: string;
|
|
906
|
+
}
|
|
548
907
|
/** Fired at the start of each turn */
|
|
549
908
|
export interface TurnStartEvent {
|
|
550
909
|
type: "turn_start";
|
|
@@ -552,11 +911,13 @@ export interface TurnStartEvent {
|
|
|
552
911
|
timestamp: number;
|
|
553
912
|
}
|
|
554
913
|
/** Fired at the end of each turn */
|
|
555
|
-
export interface TurnEndEvent {
|
|
914
|
+
export interface TurnEndEvent extends BoundaryState {
|
|
556
915
|
type: "turn_end";
|
|
557
916
|
turnIndex: number;
|
|
558
917
|
message: AgentMessage;
|
|
559
918
|
toolResults: ToolResultMessage[];
|
|
919
|
+
messageEntryId: string;
|
|
920
|
+
toolResultEntryIds: string[];
|
|
560
921
|
}
|
|
561
922
|
/** Fired when a message starts (user, assistant, or toolResult) */
|
|
562
923
|
export interface MessageStartEvent {
|
|
@@ -580,6 +941,8 @@ export interface ToolExecutionStartEvent {
|
|
|
580
941
|
toolCallId: string;
|
|
581
942
|
toolName: string;
|
|
582
943
|
args: any;
|
|
944
|
+
/** Set when another tool (for example a codemode script) made this call. */
|
|
945
|
+
parentToolCallId?: string;
|
|
583
946
|
}
|
|
584
947
|
/** Fired during tool execution with partial/streaming output */
|
|
585
948
|
export interface ToolExecutionUpdateEvent {
|
|
@@ -588,6 +951,8 @@ export interface ToolExecutionUpdateEvent {
|
|
|
588
951
|
toolName: string;
|
|
589
952
|
args: any;
|
|
590
953
|
partialResult: any;
|
|
954
|
+
/** Set when another tool (for example a codemode script) made this call. */
|
|
955
|
+
parentToolCallId?: string;
|
|
591
956
|
}
|
|
592
957
|
/** Fired when a tool finishes executing */
|
|
593
958
|
export interface ToolExecutionEndEvent {
|
|
@@ -596,6 +961,8 @@ export interface ToolExecutionEndEvent {
|
|
|
596
961
|
toolName: string;
|
|
597
962
|
result: any;
|
|
598
963
|
isError: boolean;
|
|
964
|
+
/** Set when another tool (for example a codemode script) made this call. */
|
|
965
|
+
parentToolCallId?: string;
|
|
599
966
|
}
|
|
600
967
|
export type ModelSelectSource = "set" | "cycle" | "restore";
|
|
601
968
|
/** Fired when a new model is selected */
|
|
@@ -647,12 +1014,23 @@ export type InputEventResult = {
|
|
|
647
1014
|
};
|
|
648
1015
|
interface ToolCallEventBase {
|
|
649
1016
|
type: "tool_call";
|
|
1017
|
+
/**
|
|
1018
|
+
* The call's id. For calls another tool made (with `parentToolCallId` set), pi assigns
|
|
1019
|
+
* `<parent id>/<n>`; such ids never appear as tool calls or tool results in the transcript, only
|
|
1020
|
+
* in the parent result's `nestedCalls` record.
|
|
1021
|
+
*/
|
|
650
1022
|
toolCallId: string;
|
|
1023
|
+
/** Set when another tool (for example a codemode script) issued this call. */
|
|
1024
|
+
parentToolCallId?: string;
|
|
651
1025
|
}
|
|
652
1026
|
export interface BashToolCallEvent extends ToolCallEventBase {
|
|
653
1027
|
toolName: "bash";
|
|
654
1028
|
input: BashToolInput;
|
|
655
1029
|
}
|
|
1030
|
+
export interface PowerShellToolCallEvent extends ToolCallEventBase {
|
|
1031
|
+
toolName: "powershell";
|
|
1032
|
+
input: PowerShellToolInput;
|
|
1033
|
+
}
|
|
656
1034
|
export interface ReadToolCallEvent extends ToolCallEventBase {
|
|
657
1035
|
toolName: "read";
|
|
658
1036
|
input: ReadToolInput;
|
|
@@ -687,12 +1065,20 @@ export interface CustomToolCallEvent extends ToolCallEventBase {
|
|
|
687
1065
|
* `event.input` is mutable. Mutate it in place to patch tool arguments before execution.
|
|
688
1066
|
* Later `tool_call` handlers see earlier mutations. No re-validation is performed after mutation.
|
|
689
1067
|
*/
|
|
690
|
-
export type ToolCallEvent = BashToolCallEvent | ReadToolCallEvent | EditToolCallEvent | WriteToolCallEvent | GrepToolCallEvent | FindToolCallEvent | LsToolCallEvent | CustomToolCallEvent;
|
|
1068
|
+
export type ToolCallEvent = BashToolCallEvent | PowerShellToolCallEvent | ReadToolCallEvent | EditToolCallEvent | WriteToolCallEvent | GrepToolCallEvent | FindToolCallEvent | LsToolCallEvent | CustomToolCallEvent;
|
|
691
1069
|
interface ToolResultEventBase {
|
|
692
1070
|
type: "tool_result";
|
|
1071
|
+
/** The call's id; `<parent id>/<n>` for nested calls, see `ToolCallEvent`. */
|
|
693
1072
|
toolCallId: string;
|
|
1073
|
+
/** Set when another tool (for example a codemode script) issued this call. */
|
|
1074
|
+
parentToolCallId?: string;
|
|
694
1075
|
input: Record<string, unknown>;
|
|
695
1076
|
content: (TextContent | ImageContent)[];
|
|
1077
|
+
/**
|
|
1078
|
+
* Machine-readable result for tools that declare an `outputSchema`. Handlers that redact
|
|
1079
|
+
* `content` should also replace this; replacing `content` alone drops it.
|
|
1080
|
+
*/
|
|
1081
|
+
structuredContent?: JsonValue;
|
|
696
1082
|
isError: boolean;
|
|
697
1083
|
/** Usage from the tool execution itself, if available. */
|
|
698
1084
|
usage?: Usage;
|
|
@@ -701,6 +1087,10 @@ export interface BashToolResultEvent extends ToolResultEventBase {
|
|
|
701
1087
|
toolName: "bash";
|
|
702
1088
|
details: BashToolDetails | undefined;
|
|
703
1089
|
}
|
|
1090
|
+
export interface PowerShellToolResultEvent extends ToolResultEventBase {
|
|
1091
|
+
toolName: "powershell";
|
|
1092
|
+
details: PowerShellToolDetails | undefined;
|
|
1093
|
+
}
|
|
704
1094
|
export interface ReadToolResultEvent extends ToolResultEventBase {
|
|
705
1095
|
toolName: "read";
|
|
706
1096
|
details: ReadToolDetails | undefined;
|
|
@@ -730,8 +1120,9 @@ export interface CustomToolResultEvent extends ToolResultEventBase {
|
|
|
730
1120
|
details: unknown;
|
|
731
1121
|
}
|
|
732
1122
|
/** Fired after a tool executes. Can modify result. */
|
|
733
|
-
export type ToolResultEvent = BashToolResultEvent | ReadToolResultEvent | EditToolResultEvent | WriteToolResultEvent | GrepToolResultEvent | FindToolResultEvent | LsToolResultEvent | CustomToolResultEvent;
|
|
1123
|
+
export type ToolResultEvent = BashToolResultEvent | PowerShellToolResultEvent | ReadToolResultEvent | EditToolResultEvent | WriteToolResultEvent | GrepToolResultEvent | FindToolResultEvent | LsToolResultEvent | CustomToolResultEvent;
|
|
734
1124
|
export declare function isBashToolResult(e: ToolResultEvent): e is BashToolResultEvent;
|
|
1125
|
+
export declare function isPowerShellToolResult(e: ToolResultEvent): e is PowerShellToolResultEvent;
|
|
735
1126
|
export declare function isReadToolResult(e: ToolResultEvent): e is ReadToolResultEvent;
|
|
736
1127
|
export declare function isEditToolResult(e: ToolResultEvent): e is EditToolResultEvent;
|
|
737
1128
|
export declare function isWriteToolResult(e: ToolResultEvent): e is WriteToolResultEvent;
|
|
@@ -759,6 +1150,7 @@ export declare function isLsToolResult(e: ToolResultEvent): e is LsToolResultEve
|
|
|
759
1150
|
* CustomToolCallEvent.toolName is `string` which overlaps with all literals.
|
|
760
1151
|
*/
|
|
761
1152
|
export declare function isToolCallEventType(toolName: "bash", event: ToolCallEvent): event is BashToolCallEvent;
|
|
1153
|
+
export declare function isToolCallEventType(toolName: "powershell", event: ToolCallEvent): event is PowerShellToolCallEvent;
|
|
762
1154
|
export declare function isToolCallEventType(toolName: "read", event: ToolCallEvent): event is ReadToolCallEvent;
|
|
763
1155
|
export declare function isToolCallEventType(toolName: "edit", event: ToolCallEvent): event is EditToolCallEvent;
|
|
764
1156
|
export declare function isToolCallEventType(toolName: "write", event: ToolCallEvent): event is WriteToolCallEvent;
|
|
@@ -770,26 +1162,43 @@ export declare function isToolCallEventType<TName extends string, TInput extends
|
|
|
770
1162
|
input: TInput;
|
|
771
1163
|
};
|
|
772
1164
|
/** Union of all event types */
|
|
773
|
-
export type ExtensionEvent = ProjectTrustEvent | ResourcesDiscoverEvent | SessionEvent | ContextEvent | BeforeProviderRequestEvent | BeforeProviderHeadersEvent | AfterProviderResponseEvent | BeforeAgentStartEvent | AgentStartEvent | AgentEndEvent | AgentSettledEvent | TurnStartEvent | TurnEndEvent | MessageStartEvent | MessageUpdateEvent | MessageEndEvent | ToolExecutionStartEvent | ToolExecutionUpdateEvent | ToolExecutionEndEvent | ModelSelectEvent | ThinkingLevelSelectEvent | UserBashEvent | InputEvent | ToolCallEvent | ToolResultEvent;
|
|
1165
|
+
export type ExtensionEvent = ProjectTrustEvent | ResourcesDiscoverEvent | McpServersChangeEvent | SessionEvent | CheckpointCreatedEvent | ContextEvent | ContextWithSystemEvent | CacheWarmingDecisionEvent | BeforeProviderRequestEvent | BeforeProviderHeadersEvent | AfterProviderResponseEvent | ProviderStreamEvent | BeforeAgentStartEvent | AgentStartEvent | AgentEndEvent | AgentBeforeSettleEvent | AgentSettledEvent | UIPromptStartEvent | UIPromptEndEvent | TurnStartEvent | TurnEndEvent | MessageStartEvent | MessageUpdateEvent | MessageEndEvent | ToolExecutionStartEvent | ToolExecutionUpdateEvent | ToolExecutionEndEvent | ModelSelectEvent | ThinkingLevelSelectEvent | UserBashEvent | InputEvent | ToolCallEvent | ToolResultEvent;
|
|
774
1166
|
export interface ContextEventResult {
|
|
775
1167
|
messages?: AgentMessage[];
|
|
776
1168
|
}
|
|
1169
|
+
export type TurnEndEventResult = BoundaryResult;
|
|
1170
|
+
export type AgentBeforeSettleEventResult = BoundaryResult;
|
|
777
1171
|
export type BeforeProviderRequestEventResult = unknown;
|
|
1172
|
+
export type { CacheWarmingDecisionEvent, CacheWarmingDecisionEventResult } from "../cache-warmer.ts";
|
|
778
1173
|
export interface ToolCallEventResult {
|
|
779
1174
|
/** Block tool execution. To modify arguments, mutate `event.input` in place instead. */
|
|
780
1175
|
block?: boolean;
|
|
781
1176
|
reason?: string;
|
|
1177
|
+
/**
|
|
1178
|
+
* Hint that the agent should stop after the current tool batch when this call is blocked.
|
|
1179
|
+
* Early termination only happens when every finalized tool result in the batch sets this to true.
|
|
1180
|
+
*/
|
|
1181
|
+
terminate?: boolean;
|
|
782
1182
|
}
|
|
783
1183
|
/** Result from user_bash event handler */
|
|
784
|
-
export
|
|
1184
|
+
export type UserBashEventResult = {
|
|
785
1185
|
/** Custom operations to use for execution */
|
|
786
|
-
operations
|
|
1186
|
+
operations: BashOperations;
|
|
1187
|
+
result?: never;
|
|
1188
|
+
} | {
|
|
1189
|
+
operations?: never;
|
|
787
1190
|
/** Full replacement: extension handled execution, use this result */
|
|
788
|
-
result
|
|
789
|
-
}
|
|
1191
|
+
result: BashResult;
|
|
1192
|
+
};
|
|
1193
|
+
/**
|
|
1194
|
+
* Changes a `tool_result` handler makes. Omitted fields stay as they are, except that replacing
|
|
1195
|
+
* `content` without returning `structuredContent` drops the structured content, because it may no
|
|
1196
|
+
* longer match. Return it along with `content` to keep it.
|
|
1197
|
+
*/
|
|
790
1198
|
export interface ToolResultEventResult {
|
|
791
1199
|
content?: (TextContent | ImageContent)[];
|
|
792
1200
|
details?: unknown;
|
|
1201
|
+
structuredContent?: JsonValue;
|
|
793
1202
|
isError?: boolean;
|
|
794
1203
|
usage?: Usage;
|
|
795
1204
|
}
|
|
@@ -799,7 +1208,7 @@ export interface MessageEndEventResult {
|
|
|
799
1208
|
}
|
|
800
1209
|
export interface BeforeAgentStartEventResult {
|
|
801
1210
|
message?: Pick<CustomMessage, "customType" | "content" | "display" | "details">;
|
|
802
|
-
/** Replace the system prompt for this turn.
|
|
1211
|
+
/** Replace the complete system prompt for this turn. Later handlers observe this exact override. */
|
|
803
1212
|
systemPrompt?: string;
|
|
804
1213
|
}
|
|
805
1214
|
export interface SessionBeforeSwitchResult {
|
|
@@ -827,11 +1236,20 @@ export interface SessionBeforeTreeResult {
|
|
|
827
1236
|
/** Override label to attach to the branch summary entry */
|
|
828
1237
|
label?: string;
|
|
829
1238
|
}
|
|
1239
|
+
export interface SessionBeforeRewindResult {
|
|
1240
|
+
cancel?: boolean;
|
|
1241
|
+
}
|
|
830
1242
|
export interface MessageRenderOptions {
|
|
831
1243
|
expanded: boolean;
|
|
832
1244
|
/** Horizontal padding configured by the outputPad setting. */
|
|
833
1245
|
outputPad: number;
|
|
834
1246
|
}
|
|
1247
|
+
export interface MarkdownTransformContext {
|
|
1248
|
+
messageType: "user" | "assistant" | "assistant-thinking";
|
|
1249
|
+
isStreaming: boolean;
|
|
1250
|
+
availableWidth: number;
|
|
1251
|
+
}
|
|
1252
|
+
export type MarkdownTransformer = (markdown: string, context: MarkdownTransformContext) => string;
|
|
835
1253
|
export interface EntryRenderOptions {
|
|
836
1254
|
expanded: boolean;
|
|
837
1255
|
}
|
|
@@ -853,39 +1271,49 @@ export type ExtensionHandler<E, R = undefined> = (event: E, ctx: ExtensionContex
|
|
|
853
1271
|
* ExtensionAPI passed to extension factory functions.
|
|
854
1272
|
*/
|
|
855
1273
|
export interface ExtensionAPI {
|
|
856
|
-
on(event: "project_trust", handler: ProjectTrustHandler): void;
|
|
857
|
-
on(event: "resources_discover", handler: ExtensionHandler<ResourcesDiscoverEvent, ResourcesDiscoverResult>): void;
|
|
858
|
-
on(event: "session_start", handler: ExtensionHandler<SessionStartEvent>): void;
|
|
859
|
-
on(event: "session_info_changed", handler: ExtensionHandler<SessionInfoChangedEvent>): void;
|
|
860
|
-
on(event: "session_before_switch", handler: ExtensionHandler<SessionBeforeSwitchEvent, SessionBeforeSwitchResult>): void;
|
|
861
|
-
on(event: "session_before_fork", handler: ExtensionHandler<SessionBeforeForkEvent, SessionBeforeForkResult>): void;
|
|
862
|
-
on(event: "session_before_compact", handler: ExtensionHandler<SessionBeforeCompactEvent, SessionBeforeCompactResult>): void;
|
|
863
|
-
on(event: "session_compact", handler: ExtensionHandler<SessionCompactEvent>): void;
|
|
864
|
-
on(event: "
|
|
865
|
-
on(event: "
|
|
866
|
-
on(event: "
|
|
867
|
-
on(event: "
|
|
868
|
-
on(event: "
|
|
869
|
-
on(event: "
|
|
870
|
-
on(event: "
|
|
871
|
-
on(event: "
|
|
872
|
-
on(event: "
|
|
873
|
-
on(event: "
|
|
874
|
-
on(event: "
|
|
875
|
-
on(event: "
|
|
876
|
-
on(event: "
|
|
877
|
-
on(event: "
|
|
878
|
-
on(event: "
|
|
879
|
-
on(event: "
|
|
880
|
-
on(event: "
|
|
881
|
-
on(event: "
|
|
882
|
-
on(event: "
|
|
883
|
-
on(event: "
|
|
884
|
-
on(event: "
|
|
885
|
-
on(event: "
|
|
886
|
-
on(event: "
|
|
887
|
-
on(event: "
|
|
888
|
-
on(event: "
|
|
1274
|
+
on(event: "project_trust", handler: ProjectTrustHandler): () => void;
|
|
1275
|
+
on(event: "resources_discover", handler: ExtensionHandler<ResourcesDiscoverEvent, ResourcesDiscoverResult>): () => void;
|
|
1276
|
+
on(event: "session_start", handler: ExtensionHandler<SessionStartEvent>): () => void;
|
|
1277
|
+
on(event: "session_info_changed", handler: ExtensionHandler<SessionInfoChangedEvent>): () => void;
|
|
1278
|
+
on(event: "session_before_switch", handler: ExtensionHandler<SessionBeforeSwitchEvent, SessionBeforeSwitchResult>): () => void;
|
|
1279
|
+
on(event: "session_before_fork", handler: ExtensionHandler<SessionBeforeForkEvent, SessionBeforeForkResult>): () => void;
|
|
1280
|
+
on(event: "session_before_compact", handler: ExtensionHandler<SessionBeforeCompactEvent, SessionBeforeCompactResult>): () => void;
|
|
1281
|
+
on(event: "session_compact", handler: ExtensionHandler<SessionCompactEvent>): () => void;
|
|
1282
|
+
on(event: "session_compact_failed", handler: ExtensionHandler<SessionCompactFailedEvent>): () => void;
|
|
1283
|
+
on(event: "session_shutdown", handler: ExtensionHandler<SessionShutdownEvent>): () => void;
|
|
1284
|
+
on(event: "mcp_servers_change", handler: ExtensionHandler<McpServersChangeEvent>): () => void;
|
|
1285
|
+
on(event: "session_before_tree", handler: ExtensionHandler<SessionBeforeTreeEvent, SessionBeforeTreeResult>): () => void;
|
|
1286
|
+
on(event: "session_before_rewind", handler: ExtensionHandler<SessionBeforeRewindEvent, SessionBeforeRewindResult>): () => void;
|
|
1287
|
+
on(event: "session_tree", handler: ExtensionHandler<SessionTreeEvent>): () => void;
|
|
1288
|
+
on(event: "checkpoint_created", handler: ExtensionHandler<CheckpointCreatedEvent>): () => void;
|
|
1289
|
+
on(event: "context", handler: ExtensionHandler<ContextEvent, ContextEventResult>): () => void;
|
|
1290
|
+
on(event: "context_with_system", handler: ExtensionHandler<ContextWithSystemEvent, ContextEventResult>): () => void;
|
|
1291
|
+
on(event: "cache_warming_decision", handler: ExtensionHandler<CacheWarmingDecisionEvent, CacheWarmingDecisionEventResult>): () => void;
|
|
1292
|
+
on(event: "before_provider_request", handler: ExtensionHandler<BeforeProviderRequestEvent, BeforeProviderRequestEventResult>): () => void;
|
|
1293
|
+
on(event: "before_provider_headers", handler: ExtensionHandler<BeforeProviderHeadersEvent>): () => void;
|
|
1294
|
+
on(event: "after_provider_response", handler: ExtensionHandler<AfterProviderResponseEvent>): () => void;
|
|
1295
|
+
on(event: "provider_stream_event", handler: ExtensionHandler<ProviderStreamEvent>): () => void;
|
|
1296
|
+
on(event: "before_agent_start", handler: ExtensionHandler<BeforeAgentStartEvent, BeforeAgentStartEventResult>): () => void;
|
|
1297
|
+
on(event: "agent_start", handler: ExtensionHandler<AgentStartEvent>): () => void;
|
|
1298
|
+
on(event: "agent_end", handler: ExtensionHandler<AgentEndEvent>): () => void;
|
|
1299
|
+
on(event: "agent_before_settle", handler: ExtensionHandler<AgentBeforeSettleEvent, AgentBeforeSettleEventResult>): () => void;
|
|
1300
|
+
on(event: "agent_settled", handler: ExtensionHandler<AgentSettledEvent>): () => void;
|
|
1301
|
+
on(event: "ui_prompt_start", handler: ExtensionHandler<UIPromptStartEvent>): () => void;
|
|
1302
|
+
on(event: "ui_prompt_end", handler: ExtensionHandler<UIPromptEndEvent>): () => void;
|
|
1303
|
+
on(event: "turn_start", handler: ExtensionHandler<TurnStartEvent>): () => void;
|
|
1304
|
+
on(event: "turn_end", handler: ExtensionHandler<TurnEndEvent, TurnEndEventResult>): () => void;
|
|
1305
|
+
on(event: "message_start", handler: ExtensionHandler<MessageStartEvent>): () => void;
|
|
1306
|
+
on(event: "message_update", handler: ExtensionHandler<MessageUpdateEvent>): () => void;
|
|
1307
|
+
on(event: "message_end", handler: ExtensionHandler<MessageEndEvent, MessageEndEventResult>): () => void;
|
|
1308
|
+
on(event: "tool_execution_start", handler: ExtensionHandler<ToolExecutionStartEvent>): () => void;
|
|
1309
|
+
on(event: "tool_execution_update", handler: ExtensionHandler<ToolExecutionUpdateEvent>): () => void;
|
|
1310
|
+
on(event: "tool_execution_end", handler: ExtensionHandler<ToolExecutionEndEvent>): () => void;
|
|
1311
|
+
on(event: "model_select", handler: ExtensionHandler<ModelSelectEvent>): () => void;
|
|
1312
|
+
on(event: "thinking_level_select", handler: ExtensionHandler<ThinkingLevelSelectEvent>): () => void;
|
|
1313
|
+
on(event: "tool_call", handler: ExtensionHandler<ToolCallEvent, ToolCallEventResult>): () => void;
|
|
1314
|
+
on(event: "tool_result", handler: ExtensionHandler<ToolResultEvent, ToolResultEventResult>): () => void;
|
|
1315
|
+
on(event: "user_bash", handler: ExtensionHandler<UserBashEvent, UserBashEventResult>): () => void;
|
|
1316
|
+
on(event: "input", handler: ExtensionHandler<InputEvent, InputEventResult>): () => void;
|
|
889
1317
|
/** Register a tool that the LLM can call. */
|
|
890
1318
|
registerTool<TParams extends TSchema = TSchema, TDetails = unknown, TState = any>(tool: ToolDefinition<TParams, TDetails, TState>): void;
|
|
891
1319
|
/** Register a custom command. */
|
|
@@ -898,13 +1326,19 @@ export interface ExtensionAPI {
|
|
|
898
1326
|
/** Register a CLI flag. */
|
|
899
1327
|
registerFlag(name: string, options: {
|
|
900
1328
|
description?: string;
|
|
901
|
-
type: "boolean"
|
|
902
|
-
default?: boolean
|
|
1329
|
+
type: "boolean";
|
|
1330
|
+
default?: boolean;
|
|
1331
|
+
} | {
|
|
1332
|
+
description?: string;
|
|
1333
|
+
type: "string";
|
|
1334
|
+
default?: string;
|
|
903
1335
|
}): void;
|
|
904
1336
|
/** Get the value of a registered CLI flag. */
|
|
905
1337
|
getFlag(name: string): boolean | string | undefined;
|
|
906
1338
|
/** Register a custom renderer for CustomMessageEntry. */
|
|
907
1339
|
registerMessageRenderer<T = unknown>(customType: string, renderer: MessageRenderer<T>): void;
|
|
1340
|
+
/** Register a transformer for user and assistant Markdown before Pi renders it in the interactive transcript. */
|
|
1341
|
+
registerMarkdownTransformer(transformer: MarkdownTransformer): void;
|
|
908
1342
|
/** Register a custom renderer for CustomEntry. Custom entries do not participate in LLM context. */
|
|
909
1343
|
registerEntryRenderer<T = unknown>(customType: string, renderer: EntryRenderer<T>): void;
|
|
910
1344
|
/** Send a custom message to the session. */
|
|
@@ -915,9 +1349,11 @@ export interface ExtensionAPI {
|
|
|
915
1349
|
/**
|
|
916
1350
|
* Send a user message to the agent. Always triggers a turn.
|
|
917
1351
|
* When the agent is streaming, use deliverAs to specify how to queue the message.
|
|
1352
|
+
* Set expandPromptTemplates to dispatch extension commands and expand skill commands and prompt templates.
|
|
918
1353
|
*/
|
|
919
1354
|
sendUserMessage(content: string | (TextContent | ImageContent)[], options?: {
|
|
920
1355
|
deliverAs?: "steer" | "followUp";
|
|
1356
|
+
expandPromptTemplates?: boolean;
|
|
921
1357
|
}): void;
|
|
922
1358
|
/** Append a custom entry to the session for state persistence (not sent to LLM). */
|
|
923
1359
|
appendEntry<T = unknown>(customType: string, data?: T): void;
|
|
@@ -929,20 +1365,31 @@ export interface ExtensionAPI {
|
|
|
929
1365
|
setLabel(entryId: string, label: string | undefined): void;
|
|
930
1366
|
/** Execute a shell command. */
|
|
931
1367
|
exec(command: string, args: string[], options?: ExecOptions): Promise<ExecResult>;
|
|
932
|
-
/** Get the
|
|
1368
|
+
/** Get the names of the active tools, which are the tools declared to the model. */
|
|
933
1369
|
getActiveTools(): string[];
|
|
934
|
-
/** Get all configured tools with parameter schema, prompt guidelines, and source metadata. */
|
|
1370
|
+
/** Get all configured tools with parameter schema, prompt guidelines, exposure, and source metadata. */
|
|
935
1371
|
getAllTools(): ToolInfo[];
|
|
936
|
-
/**
|
|
1372
|
+
/** Get a copy of the effective settings (global and project settings merged, with overrides). */
|
|
1373
|
+
getSettings(): Settings;
|
|
1374
|
+
/**
|
|
1375
|
+
* Set the active tools by name. Unknown and `hidden` tools are ignored. Tools with `codemode` or
|
|
1376
|
+
* `deferred` exposure stay callable from codemode scripts whether active or not.
|
|
1377
|
+
*/
|
|
937
1378
|
setActiveTools(toolNames: string[]): void;
|
|
938
1379
|
/** Get available slash commands in the current session. */
|
|
939
1380
|
getCommands(): SlashCommandInfo[];
|
|
940
|
-
/**
|
|
941
|
-
|
|
1381
|
+
/**
|
|
1382
|
+
* Set the model for the current session. By default the configured default for new sessions is unchanged;
|
|
1383
|
+
* pass `{ persist: true }` to also update it. Returns false if authentication is not configured for the model's provider.
|
|
1384
|
+
*/
|
|
1385
|
+
setModel(model: Model<any>, options?: ModelSelectionOptions): Promise<boolean>;
|
|
942
1386
|
/** Get current thinking level. */
|
|
943
1387
|
getThinkingLevel(): ThinkingLevel;
|
|
944
|
-
/**
|
|
945
|
-
|
|
1388
|
+
/**
|
|
1389
|
+
* Set the thinking level (clamped to model capabilities) for the current session. By default the configured default
|
|
1390
|
+
* for new sessions is unchanged; pass `{ persist: true }` to also update it.
|
|
1391
|
+
*/
|
|
1392
|
+
setThinkingLevel(level: ThinkingLevel, options?: ThinkingLevelSelectionOptions): void;
|
|
946
1393
|
/**
|
|
947
1394
|
* Register or override a model provider.
|
|
948
1395
|
*
|
|
@@ -1011,8 +1458,75 @@ export interface ExtensionAPI {
|
|
|
1011
1458
|
* pi.unregisterProvider("my-proxy");
|
|
1012
1459
|
*/
|
|
1013
1460
|
unregisterProvider(name: string): void;
|
|
1461
|
+
/**
|
|
1462
|
+
* Register an MCP server for this session, with the same config as an `mcpServers` entry in
|
|
1463
|
+
* `mcp.json`. The server connects next to the configured servers: on `session_start` when
|
|
1464
|
+
* registered during extension load, right away when registered later. Registering a name again
|
|
1465
|
+
* replaces the extension's earlier registration.
|
|
1466
|
+
*
|
|
1467
|
+
* The registration is not saved; register again on every load. A server of the same name in
|
|
1468
|
+
* `mcp.json` takes precedence. Throws for invalid configs and for names another extension
|
|
1469
|
+
* registered. When no loaded extension handles MCP servers (for example because another MCP
|
|
1470
|
+
* extension replaced the built-in one), the registration is reported as an extension error.
|
|
1471
|
+
*
|
|
1472
|
+
* @example
|
|
1473
|
+
* pi.registerMcpServer("jira", { url: "https://mcp.example.com/jira" });
|
|
1474
|
+
*/
|
|
1475
|
+
registerMcpServer(name: string, config: McpServerConfig): void;
|
|
1476
|
+
/** Remove an MCP server this extension registered and close its connection. */
|
|
1477
|
+
unregisterMcpServer(name: string): void;
|
|
1478
|
+
/** Every MCP server registered by extensions. For extensions that connect MCP servers. */
|
|
1479
|
+
getMcpServers(): RegisteredMcpServer[];
|
|
1480
|
+
/**
|
|
1481
|
+
* Register a virtual model: a selectable catalog entry that routes each request to a physical
|
|
1482
|
+
* model. The selection (`ctx.model`, `model_change` entries) names the virtual model; assistant
|
|
1483
|
+
* messages record the physical model and thinking level the router picked.
|
|
1484
|
+
*
|
|
1485
|
+
* `provider` may be any provider id, including one with physical models, and may list several
|
|
1486
|
+
* virtual models. Registering the same provider and id again replaces the virtual model. See
|
|
1487
|
+
* docs/virtual-models.md.
|
|
1488
|
+
*/
|
|
1489
|
+
registerVirtualModel<TState = unknown>(model: ExtensionVirtualModel<TState>): void;
|
|
1490
|
+
/** Remove a virtual model registered with `registerVirtualModel()`. */
|
|
1491
|
+
unregisterVirtualModel(provider: string, id: string): void;
|
|
1014
1492
|
/** Shared event bus for extension communication. */
|
|
1015
1493
|
events: EventBus;
|
|
1494
|
+
/** Working-tree checkpoints for the current session (R42-RWD.8). */
|
|
1495
|
+
checkpoints: ExtensionCheckpointsAPI;
|
|
1496
|
+
}
|
|
1497
|
+
/**
|
|
1498
|
+
* `pi.checkpoints` — read and restore the working-tree snapshots taken for the
|
|
1499
|
+
* current session. All calls operate on the session's own checkpoint namespace
|
|
1500
|
+
* and degrade quietly when checkpoints are unavailable (no session file yet, or
|
|
1501
|
+
* a cwd outside any git repository).
|
|
1502
|
+
*/
|
|
1503
|
+
export interface ExtensionCheckpointsAPI {
|
|
1504
|
+
/** Every checkpoint recorded for this session, in capture order. */
|
|
1505
|
+
list(): CheckpointRecord[];
|
|
1506
|
+
/** The newest checkpoint recorded for an entry id, if any. */
|
|
1507
|
+
get(entryId: string): CheckpointRecord | undefined;
|
|
1508
|
+
/**
|
|
1509
|
+
* Restore the working tree to an entry's checkpoint, taking a pre-rewind
|
|
1510
|
+
* safety snapshot first and rolling back to it on failure. Never throws:
|
|
1511
|
+
* the outcome is on the returned status. Writes are NUL-safe batches;
|
|
1512
|
+
* `onPathsRestored` reports each completed batch and each individual delete.
|
|
1513
|
+
*/
|
|
1514
|
+
restore(options: CheckpointRestoreOptions): Promise<CheckpointRestoreResult>;
|
|
1515
|
+
/**
|
|
1516
|
+
* Capture a checkpoint for an entry id, skipping when the working tree is
|
|
1517
|
+
* unchanged since the previous one. A successful capture dispatches
|
|
1518
|
+
* `checkpoint_created`.
|
|
1519
|
+
*
|
|
1520
|
+
* This is the seam the always-loaded checkpoints builtin captures through,
|
|
1521
|
+
* which is what makes `checkpoint_created` fire for every capture in the
|
|
1522
|
+
* session rather than only for extension-initiated ones. Never throws.
|
|
1523
|
+
*/
|
|
1524
|
+
capture(entryId: string): Promise<CheckpointCaptureResult>;
|
|
1525
|
+
}
|
|
1526
|
+
/** Virtual model registered via pi.registerVirtualModel(). */
|
|
1527
|
+
export interface ExtensionVirtualModel<TState = unknown> extends Omit<VirtualModelDefinition<TState>, "route"> {
|
|
1528
|
+
/** Like `VirtualModelDefinition.route`, with an extension context. */
|
|
1529
|
+
route(request: ModelRouteRequest<TState>, ctx: ExtensionContext): ModelRoute<TState> | Promise<ModelRoute<TState>>;
|
|
1016
1530
|
}
|
|
1017
1531
|
/** Configuration for registering a provider via pi.registerProvider(). */
|
|
1018
1532
|
export interface ProviderConfig {
|
|
@@ -1024,8 +1538,21 @@ export interface ProviderConfig {
|
|
|
1024
1538
|
apiKey?: string;
|
|
1025
1539
|
/** API type. Required at provider or model level when defining models. */
|
|
1026
1540
|
api?: Api;
|
|
1027
|
-
/**
|
|
1028
|
-
|
|
1541
|
+
/**
|
|
1542
|
+
* Optional streamSimple handler for custom APIs.
|
|
1543
|
+
* The context is a normalized transcript: read the prompt and tools from its system messages
|
|
1544
|
+
* (`getCurrentSystemPrompt(context.messages)`, `getCurrentTools(context.messages)`).
|
|
1545
|
+
* Implementations must invoke `options.onPayload` before sending the provider request and use any
|
|
1546
|
+
* returned replacement payload. They must invoke `options.onResponse` after receiving the response
|
|
1547
|
+
* and before consuming its body, matching built-in providers. Implementations may invoke
|
|
1548
|
+
* `options.onProviderStreamEvent(data, model)` with parsed stream events before normalization.
|
|
1549
|
+
* Event data is adapter-owned and must be treated as read-only.
|
|
1550
|
+
*/
|
|
1551
|
+
streamSimple?: (model: Model<Api>, context: TranscriptContext, options?: SimpleStreamOptions) => AssistantMessageEventStream;
|
|
1552
|
+
/** Image-generation implementations keyed by image API. */
|
|
1553
|
+
images?: Partial<Record<ImageApi, ProviderImages>>;
|
|
1554
|
+
/** Classifier implementations keyed by classifier API. */
|
|
1555
|
+
classifiers?: Partial<Record<ClassifierApi, ProviderClassifier>>;
|
|
1029
1556
|
/** Custom headers to include in requests. */
|
|
1030
1557
|
headers?: Record<string, string>;
|
|
1031
1558
|
/** If true, adds Authorization: Bearer header with the resolved API key. */
|
|
@@ -1034,60 +1561,105 @@ export interface ProviderConfig {
|
|
|
1034
1561
|
models?: ProviderModelConfig[];
|
|
1035
1562
|
/**
|
|
1036
1563
|
* Refresh this provider's model list. The returned list replaces extension-provided models.
|
|
1037
|
-
* Use context.
|
|
1564
|
+
* Use context.publish({ persist: entry }) when the catalog should persist across sessions.
|
|
1038
1565
|
*/
|
|
1039
1566
|
refreshModels?(context: RefreshModelsContext): Promise<ProviderModelConfig[]>;
|
|
1040
1567
|
/** OAuth provider for /login support. The `id` is set automatically from the provider name. */
|
|
1041
1568
|
oauth?: {
|
|
1042
1569
|
/** Display name for the provider in login UI. */
|
|
1043
1570
|
name: string;
|
|
1571
|
+
/** Whether access through this auth method is backed by a provider subscription. */
|
|
1572
|
+
isSubscription?: boolean;
|
|
1044
1573
|
/** @deprecated Retained for source compatibility; canonical auth flows ignore it. */
|
|
1045
1574
|
usesCallbackServer?: boolean;
|
|
1046
1575
|
/** Run the login flow, return credentials to persist. */
|
|
1047
1576
|
login(callbacks: OAuthLoginCallbacks): Promise<OAuthCredentials>;
|
|
1048
1577
|
/** Refresh expired credentials, return updated credentials to persist. */
|
|
1049
|
-
refreshToken(credentials: OAuthCredentials): Promise<OAuthCredentials>;
|
|
1578
|
+
refreshToken(credentials: OAuthCredentials, signal: AbortSignal): Promise<OAuthCredentials>;
|
|
1050
1579
|
/** Convert credentials to API key string for the provider. */
|
|
1051
1580
|
getApiKey(credentials: OAuthCredentials): string;
|
|
1052
1581
|
/** Legacy synchronous credential-dependent model projection. */
|
|
1053
1582
|
modifyModels?(models: Model<Api>[], credentials: OAuthCredentials): Model<Api>[];
|
|
1054
1583
|
};
|
|
1055
1584
|
}
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
/** Model ID (e.g., "claude-sonnet-4-20250514"). */
|
|
1585
|
+
interface ProviderModelConfigBase {
|
|
1586
|
+
/** Model ID. */
|
|
1059
1587
|
id: string;
|
|
1060
|
-
/** Display name
|
|
1588
|
+
/** Display name. */
|
|
1061
1589
|
name: string;
|
|
1062
1590
|
/** API type override for this model. */
|
|
1063
|
-
api?:
|
|
1591
|
+
api?: string;
|
|
1064
1592
|
/** API endpoint URL override for this model. */
|
|
1065
1593
|
baseUrl?: string;
|
|
1594
|
+
/** Supported input types. */
|
|
1595
|
+
input: ("text" | "image")[];
|
|
1596
|
+
/** Provider input limits and cache-safe image preprocessing metadata. */
|
|
1597
|
+
inputLimits?: AnyModel["inputLimits"];
|
|
1598
|
+
/** Per-million-token cost rates and optional request-wide input pricing tiers. */
|
|
1599
|
+
cost: AnyModel["cost"];
|
|
1600
|
+
/** Custom headers for this model. */
|
|
1601
|
+
headers?: Record<string, string>;
|
|
1602
|
+
}
|
|
1603
|
+
/** Chat model configuration. Omitted `type` is normalized to `"chat"`. */
|
|
1604
|
+
export interface ProviderChatModelConfig extends ProviderModelConfigBase {
|
|
1605
|
+
type?: "chat";
|
|
1606
|
+
api?: Api;
|
|
1066
1607
|
/** Whether the model supports extended thinking. */
|
|
1067
1608
|
reasoning: boolean;
|
|
1068
1609
|
/** Maps pi thinking levels to provider/model-specific values; null marks a level unsupported. */
|
|
1069
1610
|
thinkingLevelMap?: Model<Api>["thinkingLevelMap"];
|
|
1070
|
-
/**
|
|
1071
|
-
|
|
1072
|
-
/** Per-million-token cost rates and optional request-wide input pricing tiers. */
|
|
1073
|
-
cost: Model<Api>["cost"];
|
|
1611
|
+
/** Best-effort prompt cache lifetime in seconds per retention tier. Unset disables cache warming. */
|
|
1612
|
+
promptCache?: Model<Api>["promptCache"];
|
|
1074
1613
|
/** Maximum context window size in tokens. */
|
|
1075
1614
|
contextWindow: number;
|
|
1076
1615
|
/** Maximum output tokens. */
|
|
1077
1616
|
maxTokens: number;
|
|
1078
|
-
|
|
1079
|
-
headers?: Record<string, string>;
|
|
1617
|
+
samplingParams?: Record<string, unknown>;
|
|
1080
1618
|
/** OpenAI compatibility settings. */
|
|
1081
1619
|
compat?: Model<Api>["compat"];
|
|
1082
1620
|
}
|
|
1621
|
+
/** Image-generation model configuration. */
|
|
1622
|
+
export interface ProviderImageModelConfig extends ProviderModelConfigBase {
|
|
1623
|
+
type: "image";
|
|
1624
|
+
api?: ImageApi;
|
|
1625
|
+
output: ("text" | "image")[];
|
|
1626
|
+
}
|
|
1627
|
+
/** Structured classifier model configuration. */
|
|
1628
|
+
export interface ProviderClassifierModelConfig extends ProviderModelConfigBase {
|
|
1629
|
+
type: "classifier";
|
|
1630
|
+
api?: ClassifierApi;
|
|
1631
|
+
contextWindow: number;
|
|
1632
|
+
}
|
|
1633
|
+
/** Configuration for a model within a provider. */
|
|
1634
|
+
export type ProviderModelConfig = ProviderChatModelConfig | ProviderImageModelConfig | ProviderClassifierModelConfig;
|
|
1083
1635
|
/** Extension factory function type. Supports both sync and async initialization. */
|
|
1084
1636
|
export type ExtensionFactory = (pi: ExtensionAPI) => void | Promise<void>;
|
|
1085
1637
|
export type InlineExtension = ExtensionFactory | {
|
|
1086
|
-
/**
|
|
1638
|
+
/**
|
|
1639
|
+
* Display name shown as `<inline:name>` in the startup Extensions list and errors. With
|
|
1640
|
+
* `builtin`, the extension is named `builtin:name` in errors and diagnostics.
|
|
1641
|
+
*/
|
|
1087
1642
|
name: string;
|
|
1088
1643
|
factory: ExtensionFactory;
|
|
1089
1644
|
/** Omit this extension from the startup Extensions list. */
|
|
1090
1645
|
hidden?: boolean;
|
|
1646
|
+
/**
|
|
1647
|
+
* Leave this extension out when another extension registers a tool, command, or flag with a
|
|
1648
|
+
* name it registers during loading, instead of reporting a conflict. The CLI's built-in MCP,
|
|
1649
|
+
* codemode, and tool search extensions use it, so for example an MCP extension that registers
|
|
1650
|
+
* `/mcp` replaces the built-in MCP support. The factory still runs, so it should only register
|
|
1651
|
+
* tools, commands, flags, and event handlers.
|
|
1652
|
+
*/
|
|
1653
|
+
replaceable?: boolean;
|
|
1654
|
+
/**
|
|
1655
|
+
* Supply the code of the `builtin:<name>` extension instead of loading as an inline extension.
|
|
1656
|
+
* `builtin:<name>` is an extension resource like a file: it loads by default, `draht config` lists
|
|
1657
|
+
* it, `-builtin:<name>` in the `extensions` setting and `--no-extensions` disable it, and
|
|
1658
|
+
* `-e builtin:<name>` loads it explicitly. It is hidden from the startup Extensions list and
|
|
1659
|
+
* loads after project trust is resolved, so it cannot handle `project_trust`. The CLI's built-in
|
|
1660
|
+
* extensions use it.
|
|
1661
|
+
*/
|
|
1662
|
+
builtin?: boolean;
|
|
1091
1663
|
};
|
|
1092
1664
|
export interface RegisteredTool {
|
|
1093
1665
|
definition: ToolDefinition;
|
|
@@ -1113,6 +1685,7 @@ export type SendMessageHandler = <T = unknown>(message: Pick<CustomMessage<T>, "
|
|
|
1113
1685
|
}) => void;
|
|
1114
1686
|
export type SendUserMessageHandler = (content: string | (TextContent | ImageContent)[], options?: {
|
|
1115
1687
|
deliverAs?: "steer" | "followUp";
|
|
1688
|
+
expandPromptTemplates?: boolean;
|
|
1116
1689
|
}) => void;
|
|
1117
1690
|
export type AppendEntryHandler = <T = unknown>(customType: string, data?: T) => void;
|
|
1118
1691
|
export type SetSessionNameHandler = (name: string) => void;
|
|
@@ -1120,15 +1693,27 @@ export type GetSessionNameHandler = () => string | undefined;
|
|
|
1120
1693
|
export type GetActiveToolsHandler = () => string[];
|
|
1121
1694
|
/** Tool info with name, description, parameter schema, prompt guidelines, and source metadata. */
|
|
1122
1695
|
export type ToolInfo = Pick<ToolDefinition, "name" | "description" | "parameters" | "promptGuidelines"> & {
|
|
1696
|
+
exposure: ToolExposure;
|
|
1697
|
+
namespace?: ToolNamespace;
|
|
1698
|
+
annotations?: ToolAnnotations;
|
|
1123
1699
|
sourceInfo: SourceInfo;
|
|
1124
1700
|
};
|
|
1125
1701
|
export type GetAllToolsHandler = () => ToolInfo[];
|
|
1702
|
+
export type GetSettingsHandler = () => Settings;
|
|
1126
1703
|
export type GetCommandsHandler = () => SlashCommandInfo[];
|
|
1127
1704
|
export type SetActiveToolsHandler = (toolNames: string[]) => void;
|
|
1128
1705
|
export type RefreshToolsHandler = () => void;
|
|
1129
|
-
export
|
|
1706
|
+
export interface ModelSelectionOptions {
|
|
1707
|
+
/** Whether to update the global default model. Defaults to false (session-scoped). */
|
|
1708
|
+
persist?: boolean;
|
|
1709
|
+
}
|
|
1710
|
+
export interface ThinkingLevelSelectionOptions {
|
|
1711
|
+
/** Whether to update the global default thinking level. Defaults to false (session-scoped). */
|
|
1712
|
+
persist?: boolean;
|
|
1713
|
+
}
|
|
1714
|
+
export type SetModelHandler = (model: Model<any>, options?: ModelSelectionOptions) => Promise<boolean>;
|
|
1130
1715
|
export type GetThinkingLevelHandler = () => ThinkingLevel;
|
|
1131
|
-
export type SetThinkingLevelHandler = (level: ThinkingLevel) => void;
|
|
1716
|
+
export type SetThinkingLevelHandler = (level: ThinkingLevel, options?: ThinkingLevelSelectionOptions) => void;
|
|
1132
1717
|
export type SetLabelHandler = (entryId: string, label: string | undefined) => void;
|
|
1133
1718
|
/**
|
|
1134
1719
|
* Shared state created by loader, used during registration and runtime.
|
|
@@ -1147,10 +1732,25 @@ export interface ExtensionRuntimeState {
|
|
|
1147
1732
|
provider: Provider;
|
|
1148
1733
|
extensionPath: string;
|
|
1149
1734
|
}>;
|
|
1735
|
+
/**
|
|
1736
|
+
* Checkpoint manager for the active session, backing `pi.checkpoints`.
|
|
1737
|
+
* Bound by the runner; returns undefined until then, and whenever the
|
|
1738
|
+
* session has no file to hang a checkpoint sidecar off.
|
|
1739
|
+
*/
|
|
1740
|
+
getCheckpointManager: () => CheckpointManager | undefined;
|
|
1741
|
+
/** Virtual model registrations queued during extension loading, processed when runner binds. */
|
|
1742
|
+
pendingVirtualModelRegistrations: Array<{
|
|
1743
|
+
definition: VirtualModelDefinition;
|
|
1744
|
+
extensionPath: string;
|
|
1745
|
+
}>;
|
|
1746
|
+
/** Create an extension context. Throws before the runner binds. */
|
|
1747
|
+
createContext: () => ExtensionContext;
|
|
1150
1748
|
/** Throws when this extension instance is stale after runtime replacement. */
|
|
1151
1749
|
assertActive: () => void;
|
|
1152
1750
|
/** Marks this extension instance as stale after runtime replacement or reload. */
|
|
1153
1751
|
invalidate: (message?: string) => void;
|
|
1752
|
+
/** Retain an event-bus subscription until this runtime is invalidated. */
|
|
1753
|
+
trackEventBusSubscription: (unsubscribe: () => void) => () => void;
|
|
1154
1754
|
/**
|
|
1155
1755
|
* Register or unregister a provider.
|
|
1156
1756
|
*
|
|
@@ -1160,6 +1760,10 @@ export interface ExtensionRuntimeState {
|
|
|
1160
1760
|
registerProvider: (name: string, config: ProviderConfig, extensionPath?: string) => void;
|
|
1161
1761
|
registerNativeProvider: (provider: Provider, extensionPath?: string) => void;
|
|
1162
1762
|
unregisterProvider: (name: string, extensionPath?: string) => void;
|
|
1763
|
+
/** Servers registered with `pi.registerMcpServer()`. */
|
|
1764
|
+
mcpServers: McpServerRegistry;
|
|
1765
|
+
registerVirtualModel: (definition: VirtualModelDefinition, extensionPath?: string) => void;
|
|
1766
|
+
unregisterVirtualModel: (provider: string, id: string) => void;
|
|
1163
1767
|
}
|
|
1164
1768
|
/**
|
|
1165
1769
|
* Action implementations for pi.* API methods.
|
|
@@ -1174,6 +1778,7 @@ export interface ExtensionActions {
|
|
|
1174
1778
|
setLabel: SetLabelHandler;
|
|
1175
1779
|
getActiveTools: GetActiveToolsHandler;
|
|
1176
1780
|
getAllTools: GetAllToolsHandler;
|
|
1781
|
+
getSettings: GetSettingsHandler;
|
|
1177
1782
|
setActiveTools: SetActiveToolsHandler;
|
|
1178
1783
|
refreshTools: RefreshToolsHandler;
|
|
1179
1784
|
getCommands: GetCommandsHandler;
|
|
@@ -1198,6 +1803,10 @@ export interface ExtensionContextActions {
|
|
|
1198
1803
|
compact: (options?: CompactOptions) => void;
|
|
1199
1804
|
getSystemPrompt: () => string;
|
|
1200
1805
|
getSystemPromptOptions?: () => BuildSystemPromptOptions;
|
|
1806
|
+
/** Backs `ExtensionToolContext.executeTool()`. Without it, nested calls fail. */
|
|
1807
|
+
executeTool?: (callerId: string, name: string, args: unknown, options: ExecuteToolOptions) => Promise<AgentToolCallOutcome>;
|
|
1808
|
+
/** Backs `ExtensionToolContext.tools`. */
|
|
1809
|
+
getCallableTools?: () => readonly AgentTool[];
|
|
1201
1810
|
}
|
|
1202
1811
|
/**
|
|
1203
1812
|
* Actions for ExtensionCommandContext (ctx.* in command handlers).
|
|
@@ -1244,10 +1853,13 @@ export interface Extension {
|
|
|
1244
1853
|
path: string;
|
|
1245
1854
|
resolvedPath: string;
|
|
1246
1855
|
hidden?: boolean;
|
|
1856
|
+
/** See {@link InlineExtension}. */
|
|
1857
|
+
replaceable?: boolean;
|
|
1247
1858
|
sourceInfo: SourceInfo;
|
|
1248
1859
|
handlers: Map<string, HandlerFn[]>;
|
|
1249
1860
|
tools: Map<string, RegisteredTool>;
|
|
1250
1861
|
messageRenderers: Map<string, MessageRenderer>;
|
|
1862
|
+
markdownTransformer?: MarkdownTransformer;
|
|
1251
1863
|
entryRenderers?: Map<string, EntryRenderer>;
|
|
1252
1864
|
commands: Map<string, RegisteredCommand>;
|
|
1253
1865
|
flags: Map<string, ExtensionFlag>;
|
|
@@ -1260,6 +1872,10 @@ export interface LoadExtensionsResult {
|
|
|
1260
1872
|
path: string;
|
|
1261
1873
|
error: string;
|
|
1262
1874
|
}>;
|
|
1875
|
+
warnings?: Array<{
|
|
1876
|
+
path: string;
|
|
1877
|
+
warning: string;
|
|
1878
|
+
}>;
|
|
1263
1879
|
/** Shared runtime - actions are throwing stubs until runner.initialize() */
|
|
1264
1880
|
runtime: ExtensionRuntime;
|
|
1265
1881
|
}
|