@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
package/docs/rpc.md
CHANGED
|
@@ -1,1576 +1,268 @@
|
|
|
1
1
|
# RPC Mode
|
|
2
2
|
|
|
3
|
-
RPC mode
|
|
3
|
+
RPC mode runs draht as a long-lived subprocess controlled through JSON records on stdin and stdout. Use it for language-independent integrations, process isolation, IDEs, and custom user interfaces.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
For an in-process Node.js or Bun integration, prefer the [SDK](sdk.md). For a subprocess-based TypeScript integration, prefer the exported `RpcClient`, which starts draht, correlates responses, exposes typed command methods, and delivers events to listeners.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
| Interface | Process boundary | Control model | Best fit |
|
|
8
|
+
|---|---|---|---|
|
|
9
|
+
| [SDK](sdk.md) | In process | Direct TypeScript methods and events | Node.js or Bun hosts that want complete API access |
|
|
10
|
+
| RPC | Child process | JSONL commands, responses, and events | Other languages, isolated processes, IDEs, or custom clients |
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
pi --mode rpc [options]
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Common options:
|
|
14
|
-
- `--provider <name>`: Set the LLM provider (anthropic, openai, google, etc.)
|
|
15
|
-
- `--model <pattern>`: Model pattern or ID (supports `provider/id` and optional `:<thinking>`)
|
|
16
|
-
- `--name <name>` / `-n <name>`: Set the session display name at startup
|
|
17
|
-
- `--no-session`: Disable session persistence
|
|
18
|
-
- `--session-dir <path>`: Custom session storage directory
|
|
19
|
-
|
|
20
|
-
## Protocol Overview
|
|
21
|
-
|
|
22
|
-
- **Commands**: JSON objects sent to stdin, one per line
|
|
23
|
-
- **Responses**: JSON objects with `type: "response"` indicating command success/failure
|
|
24
|
-
- **Events**: Agent events streamed to stdout as JSON lines
|
|
25
|
-
|
|
26
|
-
All commands support an optional `id` field for request/response correlation. If provided, the corresponding response will include the same `id`. `bash_execution_update` events also include the `id` of their originating `bash` command.
|
|
27
|
-
|
|
28
|
-
### Framing
|
|
29
|
-
|
|
30
|
-
RPC mode uses strict JSONL semantics with LF (`\n`) as the only record delimiter.
|
|
31
|
-
|
|
32
|
-
This matters for clients:
|
|
33
|
-
- Split records on `\n` only
|
|
34
|
-
- Accept optional `\r\n` input by stripping a trailing `\r`
|
|
35
|
-
- Do not use generic line readers that treat Unicode separators as newlines
|
|
36
|
-
|
|
37
|
-
In particular, Node `readline` is not protocol-compliant for RPC mode because it also splits on `U+2028` and `U+2029`, which are valid inside JSON strings.
|
|
38
|
-
|
|
39
|
-
## Commands
|
|
40
|
-
|
|
41
|
-
### Prompting
|
|
42
|
-
|
|
43
|
-
#### prompt
|
|
44
|
-
|
|
45
|
-
Send a user prompt to the agent. The command response is emitted after the prompt is accepted, queued, or handled. Events continue streaming asynchronously after acceptance.
|
|
46
|
-
|
|
47
|
-
```json
|
|
48
|
-
{"id": "req-1", "type": "prompt", "message": "Hello, world!"}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
With images:
|
|
52
|
-
```json
|
|
53
|
-
{"type": "prompt", "message": "What's in this image?", "images": [{"type": "image", "data": "base64-encoded-data", "mimeType": "image/png"}]}
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
**During streaming**: If the agent is already streaming, you must specify `streamingBehavior` to queue the message:
|
|
57
|
-
|
|
58
|
-
```json
|
|
59
|
-
{"type": "prompt", "message": "New instruction", "streamingBehavior": "steer"}
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
- `"steer"`: Queue the message while the agent is running. It is delivered after the current assistant turn finishes executing its tool calls, before the next LLM call.
|
|
63
|
-
- `"followUp"`: Wait until the agent finishes. Message is delivered only when agent stops.
|
|
64
|
-
|
|
65
|
-
If the agent is streaming and no `streamingBehavior` is specified, the command returns an error.
|
|
66
|
-
|
|
67
|
-
**Extension commands**: If the message is an extension command (e.g., `/mycommand`), it executes immediately even during streaming. Extension commands manage their own LLM interaction via `pi.sendMessage()`.
|
|
68
|
-
|
|
69
|
-
**Input expansion**: Skill commands (`/skill:name`) and prompt templates (`/template`) are expanded before sending/queueing.
|
|
70
|
-
|
|
71
|
-
Response:
|
|
72
|
-
```json
|
|
73
|
-
{"id": "req-1", "type": "response", "command": "prompt", "success": true}
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
`success: true` means the prompt was accepted, queued, or handled immediately. `success: false` means the prompt was rejected before acceptance. Failures after acceptance are reported through the normal event and message stream, not as a second `response` for the same request id.
|
|
77
|
-
|
|
78
|
-
The `images` field is optional. Each image uses `ImageContent` format: `{"type": "image", "data": "base64-encoded-data", "mimeType": "image/png"}`.
|
|
79
|
-
|
|
80
|
-
#### steer
|
|
81
|
-
|
|
82
|
-
Queue a steering message while the agent is running. It is delivered after the current assistant turn finishes executing its tool calls, before the next LLM call. Skill commands and prompt templates are expanded. Extension commands are not allowed (use `prompt` instead).
|
|
83
|
-
|
|
84
|
-
```json
|
|
85
|
-
{"type": "steer", "message": "Stop and do this instead"}
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
With images:
|
|
89
|
-
```json
|
|
90
|
-
{"type": "steer", "message": "Look at this instead", "images": [{"type": "image", "data": "base64-encoded-data", "mimeType": "image/png"}]}
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
The `images` field is optional. Each image uses `ImageContent` format (same as `prompt`).
|
|
94
|
-
|
|
95
|
-
Response:
|
|
96
|
-
```json
|
|
97
|
-
{"type": "response", "command": "steer", "success": true}
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
See [set_steering_mode](#set_steering_mode) for controlling how steering messages are processed.
|
|
101
|
-
|
|
102
|
-
#### follow_up
|
|
103
|
-
|
|
104
|
-
Queue a follow-up message to be processed after the agent finishes. Delivered only when agent has no more tool calls or steering messages. Skill commands and prompt templates are expanded. Extension commands are not allowed (use `prompt` instead).
|
|
105
|
-
|
|
106
|
-
```json
|
|
107
|
-
{"type": "follow_up", "message": "After you're done, also do this"}
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
With images:
|
|
111
|
-
```json
|
|
112
|
-
{"type": "follow_up", "message": "Also check this image", "images": [{"type": "image", "data": "base64-encoded-data", "mimeType": "image/png"}]}
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
The `images` field is optional. Each image uses `ImageContent` format (same as `prompt`).
|
|
116
|
-
|
|
117
|
-
Response:
|
|
118
|
-
```json
|
|
119
|
-
{"type": "response", "command": "follow_up", "success": true}
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
See [set_follow_up_mode](#set_follow_up_mode) for controlling how follow-up messages are processed.
|
|
123
|
-
|
|
124
|
-
#### abort
|
|
125
|
-
|
|
126
|
-
Abort the current agent operation.
|
|
127
|
-
|
|
128
|
-
```json
|
|
129
|
-
{"type": "abort"}
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
Response:
|
|
133
|
-
```json
|
|
134
|
-
{"type": "response", "command": "abort", "success": true}
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
#### new_session
|
|
138
|
-
|
|
139
|
-
Start a fresh session. Can be cancelled by a `session_before_switch` extension event handler.
|
|
140
|
-
|
|
141
|
-
```json
|
|
142
|
-
{"type": "new_session"}
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
With optional parent session tracking:
|
|
146
|
-
```json
|
|
147
|
-
{"type": "new_session", "parentSession": "/path/to/parent-session.jsonl"}
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
Response:
|
|
151
|
-
```json
|
|
152
|
-
{"type": "response", "command": "new_session", "success": true, "data": {"cancelled": false}}
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
If an extension cancelled:
|
|
156
|
-
```json
|
|
157
|
-
{"type": "response", "command": "new_session", "success": true, "data": {"cancelled": true}}
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### State
|
|
161
|
-
|
|
162
|
-
#### get_state
|
|
163
|
-
|
|
164
|
-
Get current session state.
|
|
165
|
-
|
|
166
|
-
```json
|
|
167
|
-
{"type": "get_state"}
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
Response:
|
|
171
|
-
```json
|
|
172
|
-
{
|
|
173
|
-
"type": "response",
|
|
174
|
-
"command": "get_state",
|
|
175
|
-
"success": true,
|
|
176
|
-
"data": {
|
|
177
|
-
"model": {...},
|
|
178
|
-
"thinkingLevel": "medium",
|
|
179
|
-
"isStreaming": false,
|
|
180
|
-
"isCompacting": false,
|
|
181
|
-
"steeringMode": "all",
|
|
182
|
-
"followUpMode": "one-at-a-time",
|
|
183
|
-
"sessionFile": "/path/to/session.jsonl",
|
|
184
|
-
"sessionId": "abc123",
|
|
185
|
-
"sessionName": "my-feature-work",
|
|
186
|
-
"autoCompactionEnabled": true,
|
|
187
|
-
"messageCount": 5,
|
|
188
|
-
"pendingMessageCount": 0
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
The `model` field is a full [Model](#model) object or `null`. The `sessionName` field is the display name set via `set_session_name`, or omitted if not set.
|
|
194
|
-
|
|
195
|
-
#### get_messages
|
|
196
|
-
|
|
197
|
-
Get all messages in the conversation.
|
|
198
|
-
|
|
199
|
-
```json
|
|
200
|
-
{"type": "get_messages"}
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
Response:
|
|
204
|
-
```json
|
|
205
|
-
{
|
|
206
|
-
"type": "response",
|
|
207
|
-
"command": "get_messages",
|
|
208
|
-
"success": true,
|
|
209
|
-
"data": {"messages": [...]}
|
|
210
|
-
}
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
Messages are `AgentMessage` objects (see [Message Types](#message-types)).
|
|
214
|
-
|
|
215
|
-
### Model
|
|
216
|
-
|
|
217
|
-
#### set_model
|
|
218
|
-
|
|
219
|
-
Switch to a specific model.
|
|
220
|
-
|
|
221
|
-
```json
|
|
222
|
-
{"type": "set_model", "provider": "anthropic", "modelId": "claude-sonnet-4-20250514"}
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
Response contains the full [Model](#model) object:
|
|
226
|
-
```json
|
|
227
|
-
{
|
|
228
|
-
"type": "response",
|
|
229
|
-
"command": "set_model",
|
|
230
|
-
"success": true,
|
|
231
|
-
"data": {...}
|
|
232
|
-
}
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
#### cycle_model
|
|
236
|
-
|
|
237
|
-
Cycle to the next available model. Returns `null` data if only one model available.
|
|
238
|
-
|
|
239
|
-
```json
|
|
240
|
-
{"type": "cycle_model"}
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
Response:
|
|
244
|
-
```json
|
|
245
|
-
{
|
|
246
|
-
"type": "response",
|
|
247
|
-
"command": "cycle_model",
|
|
248
|
-
"success": true,
|
|
249
|
-
"data": {
|
|
250
|
-
"model": {...},
|
|
251
|
-
"thinkingLevel": "medium",
|
|
252
|
-
"isScoped": false
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
The `model` field is a full [Model](#model) object.
|
|
258
|
-
|
|
259
|
-
#### get_available_models
|
|
260
|
-
|
|
261
|
-
List all configured models.
|
|
262
|
-
|
|
263
|
-
```json
|
|
264
|
-
{"type": "get_available_models"}
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
Response contains an array of full [Model](#model) objects:
|
|
268
|
-
```json
|
|
269
|
-
{
|
|
270
|
-
"type": "response",
|
|
271
|
-
"command": "get_available_models",
|
|
272
|
-
"success": true,
|
|
273
|
-
"data": {
|
|
274
|
-
"models": [...]
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
### Thinking
|
|
280
|
-
|
|
281
|
-
#### set_thinking_level
|
|
282
|
-
|
|
283
|
-
Set the reasoning/thinking level for models that support it.
|
|
284
|
-
|
|
285
|
-
```json
|
|
286
|
-
{"type": "set_thinking_level", "level": "high"}
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
Levels: `"off"`, `"minimal"`, `"low"`, `"medium"`, `"high"`, `"xhigh"`, `"max"`
|
|
290
|
-
|
|
291
|
-
`"xhigh"` and `"max"` are exposed only when supported by the selected model. Some models, including GPT-5.6, expose both.
|
|
292
|
-
|
|
293
|
-
Response:
|
|
294
|
-
```json
|
|
295
|
-
{"type": "response", "command": "set_thinking_level", "success": true}
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
#### cycle_thinking_level
|
|
299
|
-
|
|
300
|
-
Cycle through available thinking levels. Returns `null` data if model doesn't support thinking.
|
|
301
|
-
|
|
302
|
-
```json
|
|
303
|
-
{"type": "cycle_thinking_level"}
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
Response:
|
|
307
|
-
```json
|
|
308
|
-
{
|
|
309
|
-
"type": "response",
|
|
310
|
-
"command": "cycle_thinking_level",
|
|
311
|
-
"success": true,
|
|
312
|
-
"data": {"level": "high"}
|
|
313
|
-
}
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
#### get_available_thinking_levels
|
|
317
|
-
|
|
318
|
-
List the thinking levels supported by the current model. Returns `["off"]` for a model without reasoning support.
|
|
319
|
-
|
|
320
|
-
```json
|
|
321
|
-
{"type": "get_available_thinking_levels"}
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
Response:
|
|
325
|
-
```json
|
|
326
|
-
{
|
|
327
|
-
"type": "response",
|
|
328
|
-
"command": "get_available_thinking_levels",
|
|
329
|
-
"success": true,
|
|
330
|
-
"data": {
|
|
331
|
-
"levels": ["off", "minimal", "low", "medium", "high"]
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
### Queue Modes
|
|
337
|
-
|
|
338
|
-
#### set_steering_mode
|
|
339
|
-
|
|
340
|
-
Control how steering messages (from `steer`) are delivered.
|
|
341
|
-
|
|
342
|
-
```json
|
|
343
|
-
{"type": "set_steering_mode", "mode": "one-at-a-time"}
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
Modes:
|
|
347
|
-
- `"all"`: Deliver all steering messages after the current assistant turn finishes executing its tool calls
|
|
348
|
-
- `"one-at-a-time"`: Deliver one steering message per completed assistant turn (default)
|
|
349
|
-
|
|
350
|
-
Response:
|
|
351
|
-
```json
|
|
352
|
-
{"type": "response", "command": "set_steering_mode", "success": true}
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
#### set_follow_up_mode
|
|
356
|
-
|
|
357
|
-
Control how follow-up messages (from `follow_up`) are delivered.
|
|
358
|
-
|
|
359
|
-
```json
|
|
360
|
-
{"type": "set_follow_up_mode", "mode": "one-at-a-time"}
|
|
361
|
-
```
|
|
362
|
-
|
|
363
|
-
Modes:
|
|
364
|
-
- `"all"`: Deliver all follow-up messages when agent finishes
|
|
365
|
-
- `"one-at-a-time"`: Deliver one follow-up message per agent completion (default)
|
|
366
|
-
|
|
367
|
-
Response:
|
|
368
|
-
```json
|
|
369
|
-
{"type": "response", "command": "set_follow_up_mode", "success": true}
|
|
370
|
-
```
|
|
371
|
-
|
|
372
|
-
### Compaction
|
|
373
|
-
|
|
374
|
-
#### compact
|
|
375
|
-
|
|
376
|
-
Manually compact conversation context to reduce token usage.
|
|
377
|
-
|
|
378
|
-
```json
|
|
379
|
-
{"type": "compact"}
|
|
380
|
-
```
|
|
381
|
-
|
|
382
|
-
With custom instructions:
|
|
383
|
-
```json
|
|
384
|
-
{"type": "compact", "customInstructions": "Focus on code changes"}
|
|
385
|
-
```
|
|
386
|
-
|
|
387
|
-
Response:
|
|
388
|
-
```json
|
|
389
|
-
{
|
|
390
|
-
"type": "response",
|
|
391
|
-
"command": "compact",
|
|
392
|
-
"success": true,
|
|
393
|
-
"data": {
|
|
394
|
-
"summary": "Summary of conversation...",
|
|
395
|
-
"firstKeptEntryId": "abc123",
|
|
396
|
-
"tokensBefore": 150000,
|
|
397
|
-
"estimatedTokensAfter": 32000,
|
|
398
|
-
"usage": {
|
|
399
|
-
"input": 32000,
|
|
400
|
-
"output": 1200,
|
|
401
|
-
"cacheRead": 0,
|
|
402
|
-
"cacheWrite": 0,
|
|
403
|
-
"totalTokens": 33200,
|
|
404
|
-
"cost": {"input": 0.01, "output": 0.02, "cacheRead": 0, "cacheWrite": 0, "total": 0.03}
|
|
405
|
-
},
|
|
406
|
-
"details": {}
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
```
|
|
410
|
-
|
|
411
|
-
`estimatedTokensAfter` is a heuristic estimate over the rebuilt message context immediately after compaction, not a provider-exact token count. `usage` reports the LLM call or calls that generated the summary and may be omitted by custom compaction handlers.
|
|
412
|
-
|
|
413
|
-
#### set_auto_compaction
|
|
414
|
-
|
|
415
|
-
Enable or disable automatic compaction when context is nearly full.
|
|
416
|
-
|
|
417
|
-
```json
|
|
418
|
-
{"type": "set_auto_compaction", "enabled": true}
|
|
419
|
-
```
|
|
420
|
-
|
|
421
|
-
Response:
|
|
422
|
-
```json
|
|
423
|
-
{"type": "response", "command": "set_auto_compaction", "success": true}
|
|
424
|
-
```
|
|
425
|
-
|
|
426
|
-
### Retry
|
|
427
|
-
|
|
428
|
-
#### set_auto_retry
|
|
429
|
-
|
|
430
|
-
Enable or disable automatic retry on transient errors (overloaded, rate limit, 5xx).
|
|
431
|
-
|
|
432
|
-
```json
|
|
433
|
-
{"type": "set_auto_retry", "enabled": true}
|
|
434
|
-
```
|
|
435
|
-
|
|
436
|
-
Response:
|
|
437
|
-
```json
|
|
438
|
-
{"type": "response", "command": "set_auto_retry", "success": true}
|
|
439
|
-
```
|
|
440
|
-
|
|
441
|
-
#### abort_retry
|
|
442
|
-
|
|
443
|
-
Abort an in-progress retry (cancel the delay and stop retrying).
|
|
444
|
-
|
|
445
|
-
```json
|
|
446
|
-
{"type": "abort_retry"}
|
|
447
|
-
```
|
|
448
|
-
|
|
449
|
-
Response:
|
|
450
|
-
```json
|
|
451
|
-
{"type": "response", "command": "abort_retry", "success": true}
|
|
452
|
-
```
|
|
453
|
-
|
|
454
|
-
### Bash
|
|
455
|
-
|
|
456
|
-
#### bash
|
|
457
|
-
|
|
458
|
-
Execute a shell command and add output to conversation context. Output streams as `bash_execution_update` events while the command runs; the response contains the final result.
|
|
459
|
-
|
|
460
|
-
```json
|
|
461
|
-
{"id": "req-1", "type": "bash", "command": "ls -la"}
|
|
462
|
-
```
|
|
463
|
-
|
|
464
|
-
Include an `id` to associate streamed `bash_execution_update` events with this command.
|
|
465
|
-
|
|
466
|
-
Response:
|
|
467
|
-
```json
|
|
468
|
-
{
|
|
469
|
-
"id": "req-1",
|
|
470
|
-
"type": "response",
|
|
471
|
-
"command": "bash",
|
|
472
|
-
"success": true,
|
|
473
|
-
"data": {
|
|
474
|
-
"output": "total 48\ndrwxr-xr-x ...",
|
|
475
|
-
"exitCode": 0,
|
|
476
|
-
"cancelled": false,
|
|
477
|
-
"truncated": false
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
```
|
|
481
|
-
|
|
482
|
-
If output was truncated, includes `fullOutputPath`:
|
|
483
|
-
```json
|
|
484
|
-
{
|
|
485
|
-
"type": "response",
|
|
486
|
-
"command": "bash",
|
|
487
|
-
"success": true,
|
|
488
|
-
"data": {
|
|
489
|
-
"output": "truncated output...",
|
|
490
|
-
"exitCode": 0,
|
|
491
|
-
"cancelled": false,
|
|
492
|
-
"truncated": true,
|
|
493
|
-
"fullOutputPath": "/tmp/pi-bash-abc123.log"
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
```
|
|
497
|
-
|
|
498
|
-
**How bash results reach the LLM:**
|
|
499
|
-
|
|
500
|
-
The `bash` command executes immediately and returns a `BashResult`. Internally, a `BashExecutionMessage` is created and stored in the agent's message state.
|
|
501
|
-
|
|
502
|
-
When the next `prompt` command is sent, all messages (including `BashExecutionMessage`) are transformed before being sent to the LLM. The `BashExecutionMessage` is converted to a `UserMessage` with this format:
|
|
503
|
-
|
|
504
|
-
````
|
|
505
|
-
Ran `ls -la`
|
|
506
|
-
```
|
|
507
|
-
total 48
|
|
508
|
-
drwxr-xr-x ...
|
|
509
|
-
```
|
|
510
|
-
````
|
|
511
|
-
|
|
512
|
-
This means:
|
|
513
|
-
1. Bash output is included in the LLM context on the **next prompt**, not immediately
|
|
514
|
-
2. Multiple bash commands can be executed before a prompt; all outputs will be included
|
|
515
|
-
|
|
516
|
-
#### abort_bash
|
|
517
|
-
|
|
518
|
-
Abort a running bash command.
|
|
519
|
-
|
|
520
|
-
```json
|
|
521
|
-
{"type": "abort_bash"}
|
|
522
|
-
```
|
|
523
|
-
|
|
524
|
-
Response:
|
|
525
|
-
```json
|
|
526
|
-
{"type": "response", "command": "abort_bash", "success": true}
|
|
527
|
-
```
|
|
528
|
-
|
|
529
|
-
### Session
|
|
530
|
-
|
|
531
|
-
#### get_session_stats
|
|
532
|
-
|
|
533
|
-
Get token usage, cost statistics, and current context window usage.
|
|
534
|
-
|
|
535
|
-
```json
|
|
536
|
-
{"type": "get_session_stats"}
|
|
537
|
-
```
|
|
538
|
-
|
|
539
|
-
Response:
|
|
540
|
-
```json
|
|
541
|
-
{
|
|
542
|
-
"type": "response",
|
|
543
|
-
"command": "get_session_stats",
|
|
544
|
-
"success": true,
|
|
545
|
-
"data": {
|
|
546
|
-
"sessionFile": "/path/to/session.jsonl",
|
|
547
|
-
"sessionId": "abc123",
|
|
548
|
-
"userMessages": 5,
|
|
549
|
-
"assistantMessages": 5,
|
|
550
|
-
"toolCalls": 12,
|
|
551
|
-
"toolResults": 12,
|
|
552
|
-
"totalMessages": 22,
|
|
553
|
-
"tokens": {
|
|
554
|
-
"input": 50000,
|
|
555
|
-
"output": 10000,
|
|
556
|
-
"cacheRead": 40000,
|
|
557
|
-
"cacheWrite": 5000,
|
|
558
|
-
"total": 105000
|
|
559
|
-
},
|
|
560
|
-
"cost": 0.45,
|
|
561
|
-
"contextUsage": {
|
|
562
|
-
"tokens": 60000,
|
|
563
|
-
"contextWindow": 200000,
|
|
564
|
-
"percent": 30
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
```
|
|
569
|
-
|
|
570
|
-
`tokens` and `cost` include assistant messages, usage reported by tools, and compaction/branch-summary generation across the full session. `contextUsage` contains the actual current context-window estimate used for compaction and footer display.
|
|
571
|
-
|
|
572
|
-
`contextUsage` is omitted when no model or context window is available. `contextUsage.tokens` and `contextUsage.percent` are `null` immediately after compaction until a fresh post-compaction assistant response provides valid usage data.
|
|
573
|
-
|
|
574
|
-
#### export_html
|
|
575
|
-
|
|
576
|
-
Export session to an HTML file.
|
|
577
|
-
|
|
578
|
-
```json
|
|
579
|
-
{"type": "export_html"}
|
|
580
|
-
```
|
|
581
|
-
|
|
582
|
-
With custom path:
|
|
583
|
-
```json
|
|
584
|
-
{"type": "export_html", "outputPath": "/tmp/session.html"}
|
|
585
|
-
```
|
|
586
|
-
|
|
587
|
-
Response:
|
|
588
|
-
```json
|
|
589
|
-
{
|
|
590
|
-
"type": "response",
|
|
591
|
-
"command": "export_html",
|
|
592
|
-
"success": true,
|
|
593
|
-
"data": {"path": "/tmp/session.html"}
|
|
594
|
-
}
|
|
595
|
-
```
|
|
596
|
-
|
|
597
|
-
#### switch_session
|
|
598
|
-
|
|
599
|
-
Load a different session file. Can be cancelled by a `session_before_switch` extension event handler.
|
|
600
|
-
|
|
601
|
-
```json
|
|
602
|
-
{"type": "switch_session", "sessionPath": "/path/to/session.jsonl"}
|
|
603
|
-
```
|
|
604
|
-
|
|
605
|
-
Response:
|
|
606
|
-
```json
|
|
607
|
-
{"type": "response", "command": "switch_session", "success": true, "data": {"cancelled": false}}
|
|
608
|
-
```
|
|
609
|
-
|
|
610
|
-
If an extension cancelled the switch:
|
|
611
|
-
```json
|
|
612
|
-
{"type": "response", "command": "switch_session", "success": true, "data": {"cancelled": true}}
|
|
613
|
-
```
|
|
614
|
-
|
|
615
|
-
#### fork
|
|
616
|
-
|
|
617
|
-
Create a new fork from a previous user message on the active branch. Can be cancelled by a `session_before_fork` extension event handler. Returns the text of the message being forked from.
|
|
618
|
-
|
|
619
|
-
```json
|
|
620
|
-
{"type": "fork", "entryId": "abc123"}
|
|
621
|
-
```
|
|
622
|
-
|
|
623
|
-
Response:
|
|
624
|
-
```json
|
|
625
|
-
{
|
|
626
|
-
"type": "response",
|
|
627
|
-
"command": "fork",
|
|
628
|
-
"success": true,
|
|
629
|
-
"data": {"text": "The original prompt text...", "cancelled": false}
|
|
630
|
-
}
|
|
631
|
-
```
|
|
632
|
-
|
|
633
|
-
If an extension cancelled the fork:
|
|
634
|
-
```json
|
|
635
|
-
{
|
|
636
|
-
"type": "response",
|
|
637
|
-
"command": "fork",
|
|
638
|
-
"success": true,
|
|
639
|
-
"data": {"text": "The original prompt text...", "cancelled": true}
|
|
640
|
-
}
|
|
641
|
-
```
|
|
642
|
-
|
|
643
|
-
#### clone
|
|
644
|
-
|
|
645
|
-
Duplicate the current active branch into a new session at the current position. Can be cancelled by a `session_before_fork` extension event handler.
|
|
646
|
-
|
|
647
|
-
```json
|
|
648
|
-
{"type": "clone"}
|
|
649
|
-
```
|
|
650
|
-
|
|
651
|
-
Response:
|
|
652
|
-
```json
|
|
653
|
-
{
|
|
654
|
-
"type": "response",
|
|
655
|
-
"command": "clone",
|
|
656
|
-
"success": true,
|
|
657
|
-
"data": {"cancelled": false}
|
|
658
|
-
}
|
|
659
|
-
```
|
|
660
|
-
|
|
661
|
-
If an extension cancelled the clone:
|
|
662
|
-
```json
|
|
663
|
-
{
|
|
664
|
-
"type": "response",
|
|
665
|
-
"command": "clone",
|
|
666
|
-
"success": true,
|
|
667
|
-
"data": {"cancelled": true}
|
|
668
|
-
}
|
|
669
|
-
```
|
|
670
|
-
|
|
671
|
-
#### get_fork_messages
|
|
672
|
-
|
|
673
|
-
Get user messages available for forking.
|
|
674
|
-
|
|
675
|
-
```json
|
|
676
|
-
{"type": "get_fork_messages"}
|
|
677
|
-
```
|
|
678
|
-
|
|
679
|
-
Response:
|
|
680
|
-
```json
|
|
681
|
-
{
|
|
682
|
-
"type": "response",
|
|
683
|
-
"command": "get_fork_messages",
|
|
684
|
-
"success": true,
|
|
685
|
-
"data": {
|
|
686
|
-
"messages": [
|
|
687
|
-
{"entryId": "abc123", "text": "First prompt..."},
|
|
688
|
-
{"entryId": "def456", "text": "Second prompt..."}
|
|
689
|
-
]
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
```
|
|
693
|
-
|
|
694
|
-
#### get_entries
|
|
695
|
-
|
|
696
|
-
Get all session entries in append order (excluding the session header). The session is an append-only tree of entries with stable ids, so an entry id works as a durable cursor: pass the last entry id you have seen as `since` to get only entries strictly after it, even across client restarts. Unlike `get_messages`, this includes pre-compaction history and abandoned branches.
|
|
697
|
-
|
|
698
|
-
```json
|
|
699
|
-
{"type": "get_entries"}
|
|
700
|
-
```
|
|
701
|
-
|
|
702
|
-
With a cursor:
|
|
703
|
-
```json
|
|
704
|
-
{"type": "get_entries", "since": "abc123"}
|
|
705
|
-
```
|
|
706
|
-
|
|
707
|
-
Response:
|
|
708
|
-
```json
|
|
709
|
-
{
|
|
710
|
-
"type": "response",
|
|
711
|
-
"command": "get_entries",
|
|
712
|
-
"success": true,
|
|
713
|
-
"data": {
|
|
714
|
-
"entries": [
|
|
715
|
-
{"type": "message", "id": "def456", "parentId": "abc123", "timestamp": "...", "message": {"role": "user", "...": "..."}}
|
|
716
|
-
],
|
|
717
|
-
"leafId": "def456"
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
```
|
|
721
|
-
|
|
722
|
-
`leafId` is the id of the current leaf entry (`null` for an empty session), so a client can tell in one round trip whether the active branch moved. If `since` does not match any entry id, the response is `success: false`.
|
|
723
|
-
|
|
724
|
-
#### get_tree
|
|
725
|
-
|
|
726
|
-
Get the session as a tree of entries. Each node is `{entry, children, label?, labelTimestamp?}`. A well-formed session has a single root; orphaned entries (broken parent chain) also appear as roots.
|
|
727
|
-
|
|
728
|
-
```json
|
|
729
|
-
{"type": "get_tree"}
|
|
730
|
-
```
|
|
731
|
-
|
|
732
|
-
Response:
|
|
733
|
-
```json
|
|
734
|
-
{
|
|
735
|
-
"type": "response",
|
|
736
|
-
"command": "get_tree",
|
|
737
|
-
"success": true,
|
|
738
|
-
"data": {
|
|
739
|
-
"tree": [
|
|
740
|
-
{
|
|
741
|
-
"entry": {"type": "message", "id": "abc123", "parentId": null, "...": "..."},
|
|
742
|
-
"children": [
|
|
743
|
-
{"entry": {"type": "message", "id": "def456", "parentId": "abc123", "...": "..."}, "children": []}
|
|
744
|
-
]
|
|
745
|
-
}
|
|
746
|
-
],
|
|
747
|
-
"leafId": "def456"
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
```
|
|
751
|
-
|
|
752
|
-
#### get_last_assistant_text
|
|
753
|
-
|
|
754
|
-
Get the text content of the last assistant message.
|
|
755
|
-
|
|
756
|
-
```json
|
|
757
|
-
{"type": "get_last_assistant_text"}
|
|
758
|
-
```
|
|
759
|
-
|
|
760
|
-
Response:
|
|
761
|
-
```json
|
|
762
|
-
{
|
|
763
|
-
"type": "response",
|
|
764
|
-
"command": "get_last_assistant_text",
|
|
765
|
-
"success": true,
|
|
766
|
-
"data": {"text": "The assistant's response..."}
|
|
767
|
-
}
|
|
768
|
-
```
|
|
769
|
-
|
|
770
|
-
Returns `{"text": null}` if no assistant messages exist.
|
|
771
|
-
|
|
772
|
-
#### set_session_name
|
|
773
|
-
|
|
774
|
-
Set a display name for the current session. The name appears in session listings and helps identify sessions.
|
|
775
|
-
|
|
776
|
-
```json
|
|
777
|
-
{"type": "set_session_name", "name": "my-feature-work"}
|
|
778
|
-
```
|
|
779
|
-
|
|
780
|
-
Response:
|
|
781
|
-
```json
|
|
782
|
-
{
|
|
783
|
-
"type": "response",
|
|
784
|
-
"command": "set_session_name",
|
|
785
|
-
"success": true
|
|
786
|
-
}
|
|
787
|
-
```
|
|
788
|
-
|
|
789
|
-
The current session name is available via `get_state` in the `sessionName` field. To set the initial name when starting RPC mode, pass `--name <name>` or `-n <name>` to the `pi --mode rpc` process.
|
|
790
|
-
|
|
791
|
-
### Commands
|
|
792
|
-
|
|
793
|
-
#### get_commands
|
|
794
|
-
|
|
795
|
-
Get available commands (extension commands, prompt templates, and skills). These can be invoked via the `prompt` command by prefixing with `/`.
|
|
796
|
-
|
|
797
|
-
```json
|
|
798
|
-
{"type": "get_commands"}
|
|
799
|
-
```
|
|
800
|
-
|
|
801
|
-
Response:
|
|
802
|
-
```json
|
|
803
|
-
{
|
|
804
|
-
"type": "response",
|
|
805
|
-
"command": "get_commands",
|
|
806
|
-
"success": true,
|
|
807
|
-
"data": {
|
|
808
|
-
"commands": [
|
|
809
|
-
{"name": "session-name", "description": "Set or clear session name", "source": "extension", "path": "/home/user/.pi/agent/extensions/session.ts"},
|
|
810
|
-
{"name": "fix-tests", "description": "Fix failing tests", "source": "prompt", "location": "project", "path": "/home/user/myproject/.pi/agent/prompts/fix-tests.md"},
|
|
811
|
-
{"name": "skill:brave-search", "description": "Web search via Brave API", "source": "skill", "location": "user", "path": "/home/user/.pi/agent/skills/brave-search/SKILL.md"}
|
|
812
|
-
]
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
```
|
|
816
|
-
|
|
817
|
-
Each command has:
|
|
818
|
-
- `name`: Command name (invoke with `/name`)
|
|
819
|
-
- `description`: Human-readable description (optional for extension commands)
|
|
820
|
-
- `source`: What kind of command:
|
|
821
|
-
- `"extension"`: Registered via `pi.registerCommand()` in an extension
|
|
822
|
-
- `"prompt"`: Loaded from a prompt template `.md` file
|
|
823
|
-
- `"skill"`: Loaded from a skill directory (name is prefixed with `skill:`)
|
|
824
|
-
- `location`: Where it was loaded from (optional, not present for extensions):
|
|
825
|
-
- `"user"`: User-level (`~/.pi/agent/`)
|
|
826
|
-
- `"project"`: Project-level (`./.pi/agent/`)
|
|
827
|
-
- `"path"`: Explicit path via CLI or settings
|
|
828
|
-
- `path`: Absolute file path to the command source (optional)
|
|
829
|
-
|
|
830
|
-
**Note**: Built-in TUI commands (`/settings`, `/hotkeys`, etc.) are not included. They are handled only in interactive mode and would not execute if sent via `prompt`.
|
|
831
|
-
|
|
832
|
-
## Events
|
|
833
|
-
|
|
834
|
-
Events are streamed to stdout as JSON lines during agent operation. Events do not generally include an `id` field; `bash_execution_update` includes the `id` of its originating `bash` command when one was provided.
|
|
835
|
-
|
|
836
|
-
### Event Types
|
|
837
|
-
|
|
838
|
-
| Event | Description |
|
|
839
|
-
|-------|-------------|
|
|
840
|
-
| `agent_start` | Agent begins processing |
|
|
841
|
-
| `agent_end` | One low-level agent run completes (may still be followed by retry, compaction, or queued continuations) |
|
|
842
|
-
| `agent_settled` | Agent run is fully settled; no automatic retry, compaction retry, or queued continuation remains |
|
|
843
|
-
| `turn_start` | New turn begins |
|
|
844
|
-
| `turn_end` | Turn completes (includes assistant message and tool results) |
|
|
845
|
-
| `message_start` | Message begins |
|
|
846
|
-
| `message_update` | Streaming update (text/thinking/toolcall deltas) |
|
|
847
|
-
| `message_end` | Message completes |
|
|
848
|
-
| `bash_execution_update` | Direct RPC bash command output chunk |
|
|
849
|
-
| `tool_execution_start` | Tool begins execution |
|
|
850
|
-
| `tool_execution_update` | Tool execution progress (streaming output) |
|
|
851
|
-
| `tool_execution_end` | Tool completes |
|
|
852
|
-
| `queue_update` | Pending steering/follow-up queue changed |
|
|
853
|
-
| `compaction_start` | Compaction begins |
|
|
854
|
-
| `compaction_end` | Compaction completes |
|
|
855
|
-
| `auto_retry_start` | Auto-retry begins (after transient error) |
|
|
856
|
-
| `auto_retry_end` | Auto-retry completes (success or final failure) |
|
|
857
|
-
| `summarization_retry_scheduled` | Retry scheduled for a transient compaction or branch-summary summarization error |
|
|
858
|
-
| `summarization_retry_attempt_start` | Retried summarization request starts |
|
|
859
|
-
| `summarization_retry_finished` | Summarization retry loop completes |
|
|
860
|
-
| `extension_error` | Extension threw an error |
|
|
861
|
-
|
|
862
|
-
### agent_start
|
|
863
|
-
|
|
864
|
-
Emitted when the agent begins processing a prompt.
|
|
865
|
-
|
|
866
|
-
```json
|
|
867
|
-
{"type": "agent_start"}
|
|
868
|
-
```
|
|
869
|
-
|
|
870
|
-
### agent_end
|
|
871
|
-
|
|
872
|
-
Emitted when one low-level agent run completes. Contains all messages generated during this run. If `willRetry` is true, an automatic retry will follow.
|
|
873
|
-
|
|
874
|
-
```json
|
|
875
|
-
{
|
|
876
|
-
"type": "agent_end",
|
|
877
|
-
"messages": [...],
|
|
878
|
-
"willRetry": false
|
|
879
|
-
}
|
|
880
|
-
```
|
|
881
|
-
|
|
882
|
-
### agent_settled
|
|
12
|
+
## Start RPC mode
|
|
883
13
|
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
```json
|
|
887
|
-
{"type": "agent_settled"}
|
|
14
|
+
```bash
|
|
15
|
+
draht --mode rpc --no-session
|
|
888
16
|
```
|
|
889
17
|
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
A turn consists of one assistant response plus any resulting tool calls and results.
|
|
18
|
+
Normal CLI options still select the working folder, model, tools, resources, and session behavior. Common choices include `--provider`, `--model`, `--name`, `--no-session`, and `--session-dir`. See [Command Line](cli.md) for the complete, version-specific interface; `draht --help` is authoritative for the installed version.
|
|
893
19
|
|
|
894
|
-
|
|
895
|
-
{"type": "turn_start"}
|
|
896
|
-
```
|
|
897
|
-
|
|
898
|
-
```json
|
|
899
|
-
{
|
|
900
|
-
"type": "turn_end",
|
|
901
|
-
"message": {...},
|
|
902
|
-
"toolResults": [...]
|
|
903
|
-
}
|
|
904
|
-
```
|
|
20
|
+
RPC mode rejects `@file` prompt arguments. Send prompts through the [`prompt`](rpc-commands.md#prompt) command instead.
|
|
905
21
|
|
|
906
|
-
|
|
22
|
+
## Protocol records
|
|
907
23
|
|
|
908
|
-
|
|
24
|
+
The protocol has four record families:
|
|
909
25
|
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
26
|
+
| Direction | Record | Purpose |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| stdin | Command | Ask draht to prompt, inspect state, change configuration, or manage the session |
|
|
29
|
+
| stdout | `response` | Report whether one command succeeded and return any command data |
|
|
30
|
+
| stdout | Session event | Stream run, message, tool, queue, compaction, and retry activity |
|
|
31
|
+
| Both | Extension UI record | Forward supported extension interactions between draht and the client |
|
|
914
32
|
|
|
915
|
-
|
|
33
|
+
See [RPC Commands](rpc-commands.md), [JSON Event Stream](json.md), and [RPC Extension UI](rpc-extension-ui.md) for the canonical record definitions.
|
|
916
34
|
|
|
917
|
-
|
|
35
|
+
### Correlate commands and responses
|
|
918
36
|
|
|
919
|
-
|
|
920
|
-
{
|
|
921
|
-
"type": "message_update",
|
|
922
|
-
"message": {...},
|
|
923
|
-
"assistantMessageEvent": {
|
|
924
|
-
"type": "text_delta",
|
|
925
|
-
"contentIndex": 0,
|
|
926
|
-
"delta": "Hello ",
|
|
927
|
-
"partial": {...}
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
```
|
|
37
|
+
Every command accepts an optional string `id`. A matching response repeats it:
|
|
931
38
|
|
|
932
|
-
The `assistantMessageEvent` field contains one of these delta types:
|
|
933
|
-
|
|
934
|
-
| Type | Description |
|
|
935
|
-
|------|-------------|
|
|
936
|
-
| `start` | Message generation started |
|
|
937
|
-
| `text_start` | Text content block started |
|
|
938
|
-
| `text_delta` | Text content chunk |
|
|
939
|
-
| `text_end` | Text content block ended |
|
|
940
|
-
| `thinking_start` | Thinking block started |
|
|
941
|
-
| `thinking_delta` | Thinking content chunk |
|
|
942
|
-
| `thinking_end` | Thinking block ended |
|
|
943
|
-
| `toolcall_start` | Tool call started |
|
|
944
|
-
| `toolcall_delta` | Tool call arguments chunk |
|
|
945
|
-
| `toolcall_end` | Tool call ended (includes full `toolCall` object) |
|
|
946
|
-
| `done` | Message complete (reason: `"stop"`, `"length"`, `"toolUse"`) |
|
|
947
|
-
| `error` | Error occurred (reason: `"aborted"`, `"error"`) |
|
|
948
|
-
|
|
949
|
-
Example streaming a text response:
|
|
950
39
|
```json
|
|
951
|
-
{"
|
|
952
|
-
{"
|
|
953
|
-
{"type":"message_update","message":{...},"assistantMessageEvent":{"type":"text_delta","contentIndex":0,"delta":" world","partial":{...}}}
|
|
954
|
-
{"type":"message_update","message":{...},"assistantMessageEvent":{"type":"text_end","contentIndex":0,"content":"Hello world","partial":{...}}}
|
|
40
|
+
{"id":"req-1","type":"get_state"}
|
|
41
|
+
{"id":"req-1","type":"response","command":"get_state","success":true,"data":{"...":"..."}}
|
|
955
42
|
```
|
|
956
43
|
|
|
957
|
-
|
|
44
|
+
Use unique IDs whenever more than one command can be outstanding. Command handling is asynchronous, so clients should correlate by ID rather than response order.
|
|
958
45
|
|
|
959
|
-
|
|
46
|
+
Session events generally have no command ID because they describe session activity. `bash_execution_update` is the exception: when the originating [`bash`](rpc-commands.md#bash) command has an ID, its output events repeat that ID.
|
|
960
47
|
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
```json
|
|
964
|
-
{
|
|
965
|
-
"type": "bash_execution_update",
|
|
966
|
-
"id": "req-1",
|
|
967
|
-
"delta": "total 48\n"
|
|
968
|
-
}
|
|
969
|
-
```
|
|
48
|
+
An `extension_ui_response` uses the ID supplied by its `extension_ui_request`. It does not produce a normal command response.
|
|
970
49
|
|
|
971
|
-
|
|
50
|
+
## Framing
|
|
972
51
|
|
|
973
|
-
|
|
52
|
+
RPC uses strict JSONL framing. Write one complete JSON object per record and terminate it with LF (`\n`). Read stdout as a byte or UTF-8 stream and split records only on LF. Strip an optional preceding carriage return to accept CRLF input.
|
|
974
53
|
|
|
975
|
-
|
|
976
|
-
{
|
|
977
|
-
"type": "tool_execution_start",
|
|
978
|
-
"toolCallId": "call_abc123",
|
|
979
|
-
"toolName": "bash",
|
|
980
|
-
"args": {"command": "ls -la"}
|
|
981
|
-
}
|
|
982
|
-
```
|
|
54
|
+
Do not use a generic line reader that treats Unicode line or paragraph separators as record boundaries. In particular, Node.js `readline` also splits on `U+2028` and `U+2029`, which are valid inside JSON strings.
|
|
983
55
|
|
|
984
|
-
|
|
56
|
+
Read stdout continuously. draht honors stdout backpressure, but a client that stops reading can stall the process. Honor stdin backpressure when writing commands. Stdout is reserved for protocol records; diagnostics and application logging go to stderr.
|
|
985
57
|
|
|
986
|
-
|
|
987
|
-
{
|
|
988
|
-
"type": "tool_execution_update",
|
|
989
|
-
"toolCallId": "call_abc123",
|
|
990
|
-
"toolName": "bash",
|
|
991
|
-
"args": {"command": "ls -la"},
|
|
992
|
-
"partialResult": {
|
|
993
|
-
"content": [{"type": "text", "text": "partial output so far..."}],
|
|
994
|
-
"details": {"truncation": null, "fullOutputPath": null}
|
|
995
|
-
}
|
|
996
|
-
}
|
|
997
|
-
```
|
|
58
|
+
## Run lifecycle
|
|
998
59
|
|
|
999
|
-
|
|
60
|
+
A successful `prompt` response means the prompt was accepted, queued, or handled. It does not mean model work completed:
|
|
1000
61
|
|
|
1001
62
|
```json
|
|
1002
|
-
{
|
|
1003
|
-
|
|
1004
|
-
"toolCallId": "call_abc123",
|
|
1005
|
-
"toolName": "bash",
|
|
1006
|
-
"result": {
|
|
1007
|
-
"content": [{"type": "text", "text": "total 48\n..."}],
|
|
1008
|
-
"details": {...}
|
|
1009
|
-
},
|
|
1010
|
-
"isError": false
|
|
1011
|
-
}
|
|
63
|
+
{"id":"req-2","type":"prompt","message":"Review this repository"}
|
|
64
|
+
{"id":"req-2","type":"response","command":"prompt","success":true,"data":{"disposition":"started"}}
|
|
1012
65
|
```
|
|
1013
66
|
|
|
1014
|
-
|
|
67
|
+
`data.disposition` reports what happened to the prompt. If it is `"handled"`, no run started for this prompt, so don't wait for `agent_settled`. See [RPC Commands](rpc-commands.md#prompt) for all values.
|
|
1015
68
|
|
|
1016
|
-
|
|
69
|
+
Continue consuming [events](json.md) after that response. `agent_end` marks the end of one low-level agent run, but retries, overflow recovery, compaction, steering, or follow-up work can still follow. Wait for `agent_settled` when the client needs to know draht will not continue automatically.
|
|
1017
70
|
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
```json
|
|
1021
|
-
{
|
|
1022
|
-
"type": "queue_update",
|
|
1023
|
-
"steering": ["Focus on error handling"],
|
|
1024
|
-
"followUp": ["After that, summarize the result"]
|
|
1025
|
-
}
|
|
1026
|
-
```
|
|
71
|
+
Subscribe before sending a prompt to avoid missing a fast completion. `RpcClient.promptAndWait()` does this internally. If using separate `RpcClient` calls, install the event listener before `prompt()` and call `waitForIdle()` only while a run is active.
|
|
1027
72
|
|
|
1028
|
-
|
|
73
|
+
## Errors
|
|
1029
74
|
|
|
1030
|
-
|
|
75
|
+
A failed command returns one response with `success: false`:
|
|
1031
76
|
|
|
1032
77
|
```json
|
|
1033
|
-
{"type":
|
|
78
|
+
{"id":"req-3","type":"response","command":"set_model","success":false,"error":"Model not found: invalid/model"}
|
|
1034
79
|
```
|
|
1035
80
|
|
|
1036
|
-
|
|
81
|
+
Malformed JSON produces a parse response without a request ID:
|
|
1037
82
|
|
|
1038
83
|
```json
|
|
1039
|
-
{
|
|
1040
|
-
"type": "compaction_end",
|
|
1041
|
-
"reason": "threshold",
|
|
1042
|
-
"result": {
|
|
1043
|
-
"summary": "Summary of conversation...",
|
|
1044
|
-
"firstKeptEntryId": "abc123",
|
|
1045
|
-
"tokensBefore": 150000,
|
|
1046
|
-
"estimatedTokensAfter": 32000,
|
|
1047
|
-
"usage": {
|
|
1048
|
-
"input": 32000,
|
|
1049
|
-
"output": 1200,
|
|
1050
|
-
"cacheRead": 0,
|
|
1051
|
-
"cacheWrite": 0,
|
|
1052
|
-
"totalTokens": 33200,
|
|
1053
|
-
"cost": {"input": 0.01, "output": 0.02, "cacheRead": 0, "cacheWrite": 0, "total": 0.03}
|
|
1054
|
-
},
|
|
1055
|
-
"details": {}
|
|
1056
|
-
},
|
|
1057
|
-
"aborted": false,
|
|
1058
|
-
"willRetry": false
|
|
1059
|
-
}
|
|
84
|
+
{"type":"response","command":"parse","success":false,"error":"Failed to parse command: Unexpected token..."}
|
|
1060
85
|
```
|
|
1061
86
|
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
If compaction was aborted, `result` is `null` and `aborted` is `true`.
|
|
1065
|
-
|
|
1066
|
-
If compaction failed (e.g., API quota exceeded), `result` is `null`, `aborted` is `false`, and `errorMessage` contains the error description.
|
|
1067
|
-
|
|
1068
|
-
### auto_retry_start / auto_retry_end
|
|
87
|
+
A success response only covers command handling. Provider failures and aborts after a prompt is accepted appear in the message and event stream.
|
|
1069
88
|
|
|
1070
|
-
|
|
89
|
+
Clients must also handle child-process startup failures, unexpected exits, stderr diagnostics, cancellation, and their own deadlines. Do not parse stderr as protocol data.
|
|
1071
90
|
|
|
1072
|
-
|
|
1073
|
-
{
|
|
1074
|
-
"type": "auto_retry_start",
|
|
1075
|
-
"attempt": 1,
|
|
1076
|
-
"maxAttempts": 3,
|
|
1077
|
-
"delayMs": 2000,
|
|
1078
|
-
"errorMessage": "529 {\"type\":\"error\",\"error\":{\"type\":\"overloaded_error\",\"message\":\"Overloaded\"}}"
|
|
1079
|
-
}
|
|
1080
|
-
```
|
|
1081
|
-
|
|
1082
|
-
```json
|
|
1083
|
-
{
|
|
1084
|
-
"type": "auto_retry_end",
|
|
1085
|
-
"success": true,
|
|
1086
|
-
"attempt": 2
|
|
1087
|
-
}
|
|
1088
|
-
```
|
|
91
|
+
## Shutdown
|
|
1089
92
|
|
|
1090
|
-
|
|
1091
|
-
```json
|
|
1092
|
-
{
|
|
1093
|
-
"type": "auto_retry_end",
|
|
1094
|
-
"success": false,
|
|
1095
|
-
"attempt": 3,
|
|
1096
|
-
"finalError": "529 overloaded_error: Overloaded"
|
|
1097
|
-
}
|
|
1098
|
-
```
|
|
93
|
+
Close the child's stdin to request an orderly shutdown. draht disposes the active runtime before exiting. Clients should still handle process signals and unexpected exits.
|
|
1099
94
|
|
|
1100
|
-
|
|
95
|
+
An extension can also request shutdown through its extension context. draht completes shutdown after the current command or after the active run emits `agent_settled`.
|
|
1101
96
|
|
|
1102
|
-
|
|
97
|
+
## Minimal client
|
|
1103
98
|
|
|
1104
|
-
|
|
1105
|
-
{
|
|
1106
|
-
"type": "summarization_retry_scheduled",
|
|
1107
|
-
"attempt": 1,
|
|
1108
|
-
"maxAttempts": 3,
|
|
1109
|
-
"delayMs": 2000,
|
|
1110
|
-
"errorMessage": "terminated"
|
|
1111
|
-
}
|
|
1112
|
-
```
|
|
99
|
+
This Python example uses a binary pipe reader, which splits on LF without treating Unicode separators as protocol boundaries:
|
|
1113
100
|
|
|
1114
|
-
```
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
"source": "compaction",
|
|
1118
|
-
"reason": "threshold"
|
|
1119
|
-
}
|
|
1120
|
-
```
|
|
101
|
+
```python
|
|
102
|
+
import json
|
|
103
|
+
import subprocess
|
|
1121
104
|
|
|
1122
|
-
|
|
105
|
+
process = subprocess.Popen(
|
|
106
|
+
["draht", "--mode", "rpc", "--no-session"],
|
|
107
|
+
stdin=subprocess.PIPE,
|
|
108
|
+
stdout=subprocess.PIPE,
|
|
109
|
+
)
|
|
1123
110
|
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
"type": "summarization_retry_finished"
|
|
1127
|
-
}
|
|
1128
|
-
```
|
|
111
|
+
assert process.stdin is not None
|
|
112
|
+
assert process.stdout is not None
|
|
1129
113
|
|
|
1130
|
-
|
|
114
|
+
command = {"id": "prompt-1", "type": "prompt", "message": "Hello"}
|
|
115
|
+
process.stdin.write(json.dumps(command).encode("utf-8") + b"\n")
|
|
116
|
+
process.stdin.flush()
|
|
1131
117
|
|
|
1132
|
-
|
|
118
|
+
while line := process.stdout.readline():
|
|
119
|
+
record = json.loads(line)
|
|
120
|
+
if record.get("type") == "message_update":
|
|
121
|
+
update = record["assistantMessageEvent"]
|
|
122
|
+
if update["type"] == "text_delta":
|
|
123
|
+
print(update["delta"], end="", flush=True)
|
|
124
|
+
elif record.get("type") == "agent_settled":
|
|
125
|
+
print()
|
|
126
|
+
break
|
|
1133
127
|
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
"type": "extension_error",
|
|
1137
|
-
"extensionPath": "/path/to/extension.ts",
|
|
1138
|
-
"event": "tool_call",
|
|
1139
|
-
"error": "Error message..."
|
|
1140
|
-
}
|
|
128
|
+
process.stdin.close()
|
|
129
|
+
process.wait()
|
|
1141
130
|
```
|
|
1142
131
|
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
Extensions can request user interaction via `ctx.ui.select()`, `ctx.ui.confirm()`, etc. In RPC mode, these are translated into a request/response sub-protocol on top of the base command/event flow.
|
|
1146
|
-
|
|
1147
|
-
There are two categories of extension UI methods:
|
|
1148
|
-
|
|
1149
|
-
- **Dialog methods** (`select`, `confirm`, `input`, `editor`): emit an `extension_ui_request` on stdout and block until the client sends back an `extension_ui_response` on stdin with the matching `id`.
|
|
1150
|
-
- **Fire-and-forget methods** (`notify`, `setStatus`, `setWidget`, `setTitle`, `set_editor_text`): emit an `extension_ui_request` on stdout but do not expect a response. The client can display the information or ignore it.
|
|
132
|
+
For maintained TypeScript clients, use the checked [RPC client example](../examples/rpc-client.ts). It requires a built draht CLI because the repository example points to `dist/cli.js`.
|
|
1151
133
|
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
Some `ExtensionUIContext` methods are not supported or degraded in RPC mode because they require direct TUI access:
|
|
1155
|
-
- `custom()` returns `undefined`
|
|
1156
|
-
- `setWorkingMessage()`, `setWorkingIndicator()`, `setFooter()`, `setHeader()`, `setEditorComponent()`, `setToolsExpanded()` are no-ops
|
|
1157
|
-
- `getEditorText()` returns `""`
|
|
1158
|
-
- `getToolsExpanded()` returns `false`
|
|
1159
|
-
- `pasteToEditor()` delegates to `setEditorText()` (no paste/collapse handling)
|
|
1160
|
-
- `getAllThemes()` returns `[]`
|
|
1161
|
-
- `getTheme()` returns `undefined`
|
|
1162
|
-
- `setTheme()` returns `{ success: false, error: "..." }`
|
|
1163
|
-
|
|
1164
|
-
Note: `ctx.mode` is `"rpc"` and `ctx.hasUI` is `true` in RPC mode because the dialog and fire-and-forget methods are functional via the extension UI sub-protocol. Use `ctx.mode === "tui"` to guard TUI-specific features like `custom()` that require a real terminal.
|
|
1165
|
-
|
|
1166
|
-
### Extension UI Requests (stdout)
|
|
1167
|
-
|
|
1168
|
-
All requests have `type: "extension_ui_request"`, a unique `id`, and a `method` field.
|
|
1169
|
-
|
|
1170
|
-
#### select
|
|
1171
|
-
|
|
1172
|
-
Prompt the user to choose from a list. Dialog methods with a `timeout` field include the timeout in milliseconds; the agent auto-resolves with `undefined` if the client doesn't respond in time.
|
|
1173
|
-
|
|
1174
|
-
```json
|
|
1175
|
-
{
|
|
1176
|
-
"type": "extension_ui_request",
|
|
1177
|
-
"id": "uuid-1",
|
|
1178
|
-
"method": "select",
|
|
1179
|
-
"title": "Allow dangerous command?",
|
|
1180
|
-
"options": ["Allow", "Block"],
|
|
1181
|
-
"timeout": 10000
|
|
1182
|
-
}
|
|
1183
|
-
```
|
|
134
|
+
## Extension UI option ids
|
|
1184
135
|
|
|
1185
|
-
|
|
136
|
+
[RPC Extension UI](rpc-extension-ui.md) defines the dialog requests and their `confirmed` / `value` / `cancelled` responses. draht extends dialog answers with an optional `optionId`, and an answer whose `id` matches no open dialog is silently dropped.
|
|
1186
137
|
|
|
1187
|
-
|
|
138
|
+
### Naming the option that was chosen (`optionId`)
|
|
1188
139
|
|
|
1189
|
-
|
|
140
|
+
A request may carry a `detail` object describing what is being decided. When it does, `detail.options`
|
|
141
|
+
is the immutable set of options that request offered, each stating its own meaning:
|
|
1190
142
|
|
|
1191
143
|
```json
|
|
1192
144
|
{
|
|
1193
145
|
"type": "extension_ui_request",
|
|
1194
146
|
"id": "uuid-2",
|
|
1195
147
|
"method": "confirm",
|
|
1196
|
-
"title": "
|
|
1197
|
-
"message": "
|
|
1198
|
-
"
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
"type": "extension_ui_request",
|
|
1211
|
-
"id": "uuid-3",
|
|
1212
|
-
"method": "input",
|
|
1213
|
-
"title": "Enter a value",
|
|
1214
|
-
"placeholder": "type something..."
|
|
1215
|
-
}
|
|
1216
|
-
```
|
|
1217
|
-
|
|
1218
|
-
Expected response: `extension_ui_response` with `value` (the entered text) or `cancelled: true`.
|
|
1219
|
-
|
|
1220
|
-
#### editor
|
|
1221
|
-
|
|
1222
|
-
Open a multi-line text editor with optional prefilled content.
|
|
1223
|
-
|
|
1224
|
-
```json
|
|
1225
|
-
{
|
|
1226
|
-
"type": "extension_ui_request",
|
|
1227
|
-
"id": "uuid-4",
|
|
1228
|
-
"method": "editor",
|
|
1229
|
-
"title": "Edit some text",
|
|
1230
|
-
"prefill": "Line 1\nLine 2\nLine 3"
|
|
1231
|
-
}
|
|
1232
|
-
```
|
|
1233
|
-
|
|
1234
|
-
Expected response: `extension_ui_response` with `value` (the edited text) or `cancelled: true`.
|
|
1235
|
-
|
|
1236
|
-
#### notify
|
|
1237
|
-
|
|
1238
|
-
Display a notification. Fire-and-forget, no response expected.
|
|
1239
|
-
|
|
1240
|
-
```json
|
|
1241
|
-
{
|
|
1242
|
-
"type": "extension_ui_request",
|
|
1243
|
-
"id": "uuid-5",
|
|
1244
|
-
"method": "notify",
|
|
1245
|
-
"message": "Command blocked by user",
|
|
1246
|
-
"notifyType": "warning"
|
|
1247
|
-
}
|
|
1248
|
-
```
|
|
1249
|
-
|
|
1250
|
-
The `notifyType` field is `"info"`, `"warning"`, or `"error"`. Defaults to `"info"` if omitted.
|
|
1251
|
-
|
|
1252
|
-
#### setStatus
|
|
1253
|
-
|
|
1254
|
-
Set or clear a status entry in the footer/status bar. Fire-and-forget.
|
|
1255
|
-
|
|
1256
|
-
```json
|
|
1257
|
-
{
|
|
1258
|
-
"type": "extension_ui_request",
|
|
1259
|
-
"id": "uuid-6",
|
|
1260
|
-
"method": "setStatus",
|
|
1261
|
-
"statusKey": "my-ext",
|
|
1262
|
-
"statusText": "Turn 3 running..."
|
|
1263
|
-
}
|
|
1264
|
-
```
|
|
1265
|
-
|
|
1266
|
-
Send `statusText: undefined` (or omit it) to clear the status entry for that key.
|
|
1267
|
-
|
|
1268
|
-
#### setWidget
|
|
1269
|
-
|
|
1270
|
-
Set or clear a widget (block of text lines) displayed above or below the editor. Fire-and-forget.
|
|
1271
|
-
|
|
1272
|
-
```json
|
|
1273
|
-
{
|
|
1274
|
-
"type": "extension_ui_request",
|
|
1275
|
-
"id": "uuid-7",
|
|
1276
|
-
"method": "setWidget",
|
|
1277
|
-
"widgetKey": "my-ext",
|
|
1278
|
-
"widgetLines": ["--- My Widget ---", "Line 1", "Line 2"],
|
|
1279
|
-
"widgetPlacement": "aboveEditor"
|
|
1280
|
-
}
|
|
1281
|
-
```
|
|
1282
|
-
|
|
1283
|
-
Send `widgetLines: undefined` (or omit it) to clear the widget. The `widgetPlacement` field is `"aboveEditor"` (default) or `"belowEditor"`. Only string arrays are supported in RPC mode; component factories are ignored.
|
|
1284
|
-
|
|
1285
|
-
#### setTitle
|
|
1286
|
-
|
|
1287
|
-
Set the terminal window/tab title. Fire-and-forget.
|
|
1288
|
-
|
|
1289
|
-
```json
|
|
1290
|
-
{
|
|
1291
|
-
"type": "extension_ui_request",
|
|
1292
|
-
"id": "uuid-8",
|
|
1293
|
-
"method": "setTitle",
|
|
1294
|
-
"title": "pi - my project"
|
|
1295
|
-
}
|
|
1296
|
-
```
|
|
1297
|
-
|
|
1298
|
-
#### set_editor_text
|
|
1299
|
-
|
|
1300
|
-
Set the text in the input editor. Fire-and-forget.
|
|
1301
|
-
|
|
1302
|
-
```json
|
|
1303
|
-
{
|
|
1304
|
-
"type": "extension_ui_request",
|
|
1305
|
-
"id": "uuid-9",
|
|
1306
|
-
"method": "set_editor_text",
|
|
1307
|
-
"text": "prefilled text for the user"
|
|
148
|
+
"title": "Approve tool call?",
|
|
149
|
+
"message": "bash wants to run a command",
|
|
150
|
+
"detail": {
|
|
151
|
+
"kind": "tool_permission",
|
|
152
|
+
"toolCallId": "call-1",
|
|
153
|
+
"toolName": "bash",
|
|
154
|
+
"cwd": "/private/tmp/project",
|
|
155
|
+
"command": "rm -rf build",
|
|
156
|
+
"reason": "bash commands require approval by default",
|
|
157
|
+
"options": [
|
|
158
|
+
{"id": "approve", "label": "Yes", "decision": "approve"},
|
|
159
|
+
{"id": "deny", "label": "No", "decision": "deny"}
|
|
160
|
+
]
|
|
161
|
+
}
|
|
1308
162
|
}
|
|
1309
163
|
```
|
|
1310
164
|
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
Responses are sent for dialog methods only (`select`, `confirm`, `input`, `editor`). The `id` must match the request.
|
|
1314
|
-
|
|
1315
|
-
#### Value response (select, input, editor)
|
|
1316
|
-
|
|
1317
|
-
```json
|
|
1318
|
-
{"type": "extension_ui_response", "id": "uuid-1", "value": "Allow"}
|
|
1319
|
-
```
|
|
1320
|
-
|
|
1321
|
-
#### Confirmation response (confirm)
|
|
1322
|
-
|
|
1323
|
-
```json
|
|
1324
|
-
{"type": "extension_ui_response", "id": "uuid-2", "confirmed": true}
|
|
1325
|
-
```
|
|
1326
|
-
|
|
1327
|
-
#### Cancellation response (any dialog)
|
|
1328
|
-
|
|
1329
|
-
Dismiss any dialog method. The extension receives `undefined` (for select/input/editor) or `false` (for confirm).
|
|
165
|
+
An answer may name which of those options was chosen by adding `optionId`:
|
|
1330
166
|
|
|
1331
167
|
```json
|
|
1332
|
-
{"type": "extension_ui_response", "id": "uuid-
|
|
168
|
+
{"type": "extension_ui_response", "id": "uuid-2", "confirmed": false, "optionId": "deny"}
|
|
1333
169
|
```
|
|
1334
170
|
|
|
1335
|
-
|
|
171
|
+
Rules, all enforced by the agent:
|
|
1336
172
|
|
|
1337
|
-
|
|
173
|
+
- `optionId` is **optional**. Clients that only know yes/no keep sending `confirmed` alone and are
|
|
174
|
+
unaffected.
|
|
175
|
+
- When present, it **decides**: the named option's own `decision` (`"approve"` or `"deny"`) wins over
|
|
176
|
+
`confirmed`, in both directions. `{"confirmed": true, "optionId": "deny"}` denies. Never infer an
|
|
177
|
+
option's meaning from its position in the array, from the array's length, or from its id — read
|
|
178
|
+
`decision`.
|
|
179
|
+
- When present, it must be **one of the ids that this request offered**. An id nobody offered, an id
|
|
180
|
+
that appears twice in the offered set, and a present-but-non-string value such as
|
|
181
|
+
`{"optionId": 123}` are all refused (see below). A wrongly-typed `optionId` is *not* treated as
|
|
182
|
+
absent.
|
|
183
|
+
- When the matching request offered **no options** — any dialog raised without `detail`, such as
|
|
184
|
+
`/rewind`'s "Restore files?" confirm or `/agent`'s picker — there is nothing to validate against,
|
|
185
|
+
so `optionId` is ignored and the answer decides on `confirmed` / `value` as usual. A client may
|
|
186
|
+
therefore attach `optionId` unconditionally without risk of stranding those dialogs.
|
|
1338
187
|
|
|
1339
|
-
|
|
1340
|
-
{
|
|
1341
|
-
"type": "response",
|
|
1342
|
-
"command": "set_model",
|
|
1343
|
-
"success": false,
|
|
1344
|
-
"error": "Model not found: invalid/model"
|
|
1345
|
-
}
|
|
1346
|
-
```
|
|
188
|
+
### Refused response (`command: "extension_ui_response"`)
|
|
1347
189
|
|
|
1348
|
-
|
|
190
|
+
A rejected `optionId` is reported on stdout as an ordinary failed-command response — note that
|
|
191
|
+
`command` here is `"extension_ui_response"`, a value **no client ever sends as a command**. Clients
|
|
192
|
+
that switch exhaustively on `command` must expect it:
|
|
1349
193
|
|
|
1350
194
|
```json
|
|
1351
195
|
{
|
|
196
|
+
"id": "uuid-2",
|
|
1352
197
|
"type": "response",
|
|
1353
|
-
"command": "
|
|
198
|
+
"command": "extension_ui_response",
|
|
1354
199
|
"success": false,
|
|
1355
|
-
"error": "
|
|
1356
|
-
}
|
|
1357
|
-
```
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
}
|
|
1425
|
-
```
|
|
1426
|
-
|
|
1427
|
-
Stop reasons: `"stop"`, `"length"`, `"toolUse"`, `"error"`, `"aborted"`
|
|
1428
|
-
|
|
1429
|
-
### ToolResultMessage
|
|
1430
|
-
|
|
1431
|
-
```json
|
|
1432
|
-
{
|
|
1433
|
-
"role": "toolResult",
|
|
1434
|
-
"toolCallId": "call_123",
|
|
1435
|
-
"toolName": "bash",
|
|
1436
|
-
"content": [{"type": "text", "text": "total 48\ndrwxr-xr-x ..."}],
|
|
1437
|
-
"usage": {
|
|
1438
|
-
"input": 100,
|
|
1439
|
-
"output": 50,
|
|
1440
|
-
"cacheRead": 0,
|
|
1441
|
-
"cacheWrite": 0,
|
|
1442
|
-
"totalTokens": 150,
|
|
1443
|
-
"cost": {"input": 0.0003, "output": 0.00075, "cacheRead": 0, "cacheWrite": 0, "total": 0.00105}
|
|
1444
|
-
},
|
|
1445
|
-
"isError": false,
|
|
1446
|
-
"timestamp": 1733234567890
|
|
1447
|
-
}
|
|
1448
|
-
```
|
|
1449
|
-
|
|
1450
|
-
`usage` is optional and reports nested LLM work performed by the tool. When present, it contributes to session token and cost totals.
|
|
1451
|
-
|
|
1452
|
-
### BashExecutionMessage
|
|
1453
|
-
|
|
1454
|
-
Created by the `bash` RPC command (not by LLM tool calls):
|
|
1455
|
-
|
|
1456
|
-
```json
|
|
1457
|
-
{
|
|
1458
|
-
"role": "bashExecution",
|
|
1459
|
-
"command": "ls -la",
|
|
1460
|
-
"output": "total 48\ndrwxr-xr-x ...",
|
|
1461
|
-
"exitCode": 0,
|
|
1462
|
-
"cancelled": false,
|
|
1463
|
-
"truncated": false,
|
|
1464
|
-
"fullOutputPath": null,
|
|
1465
|
-
"timestamp": 1733234567890
|
|
1466
|
-
}
|
|
1467
|
-
```
|
|
1468
|
-
|
|
1469
|
-
### Attachment
|
|
1470
|
-
|
|
1471
|
-
```json
|
|
1472
|
-
{
|
|
1473
|
-
"id": "img1",
|
|
1474
|
-
"type": "image",
|
|
1475
|
-
"fileName": "photo.jpg",
|
|
1476
|
-
"mimeType": "image/jpeg",
|
|
1477
|
-
"size": 102400,
|
|
1478
|
-
"content": "base64-encoded-data...",
|
|
1479
|
-
"extractedText": null,
|
|
1480
|
-
"preview": null
|
|
1481
|
-
}
|
|
1482
|
-
```
|
|
1483
|
-
|
|
1484
|
-
## Example: Basic Client (Python)
|
|
1485
|
-
|
|
1486
|
-
```python
|
|
1487
|
-
import subprocess
|
|
1488
|
-
import json
|
|
1489
|
-
|
|
1490
|
-
proc = subprocess.Popen(
|
|
1491
|
-
["pi", "--mode", "rpc", "--no-session"],
|
|
1492
|
-
stdin=subprocess.PIPE,
|
|
1493
|
-
stdout=subprocess.PIPE,
|
|
1494
|
-
text=True
|
|
1495
|
-
)
|
|
1496
|
-
|
|
1497
|
-
def send(cmd):
|
|
1498
|
-
proc.stdin.write(json.dumps(cmd) + "\n")
|
|
1499
|
-
proc.stdin.flush()
|
|
1500
|
-
|
|
1501
|
-
def read_events():
|
|
1502
|
-
for line in proc.stdout:
|
|
1503
|
-
yield json.loads(line)
|
|
1504
|
-
|
|
1505
|
-
# Send prompt
|
|
1506
|
-
send({"type": "prompt", "message": "Hello!"})
|
|
1507
|
-
|
|
1508
|
-
# Process events
|
|
1509
|
-
for event in read_events():
|
|
1510
|
-
if event.get("type") == "message_update":
|
|
1511
|
-
delta = event.get("assistantMessageEvent", {})
|
|
1512
|
-
if delta.get("type") == "text_delta":
|
|
1513
|
-
print(delta["delta"], end="", flush=True)
|
|
1514
|
-
|
|
1515
|
-
if event.get("type") == "agent_end":
|
|
1516
|
-
print()
|
|
1517
|
-
break
|
|
1518
|
-
```
|
|
1519
|
-
|
|
1520
|
-
## Example: Interactive Client (Node.js)
|
|
1521
|
-
|
|
1522
|
-
See [`test/rpc-example.ts`](../test/rpc-example.ts) for a complete interactive example, or [`src/modes/rpc/rpc-client.ts`](../src/modes/rpc/rpc-client.ts) for a typed client implementation.
|
|
1523
|
-
|
|
1524
|
-
For a complete example of handling the extension UI protocol, see [`examples/rpc-extension-ui.ts`](../examples/rpc-extension-ui.ts) which pairs with the [`examples/extensions/rpc-demo.ts`](../examples/extensions/rpc-demo.ts) extension.
|
|
1525
|
-
|
|
1526
|
-
```javascript
|
|
1527
|
-
const { spawn } = require("child_process");
|
|
1528
|
-
const { StringDecoder } = require("string_decoder");
|
|
1529
|
-
|
|
1530
|
-
const agent = spawn("pi", ["--mode", "rpc", "--no-session"]);
|
|
1531
|
-
|
|
1532
|
-
function attachJsonlReader(stream, onLine) {
|
|
1533
|
-
const decoder = new StringDecoder("utf8");
|
|
1534
|
-
let buffer = "";
|
|
1535
|
-
|
|
1536
|
-
stream.on("data", (chunk) => {
|
|
1537
|
-
buffer += typeof chunk === "string" ? chunk : decoder.write(chunk);
|
|
1538
|
-
|
|
1539
|
-
while (true) {
|
|
1540
|
-
const newlineIndex = buffer.indexOf("\n");
|
|
1541
|
-
if (newlineIndex === -1) break;
|
|
1542
|
-
|
|
1543
|
-
let line = buffer.slice(0, newlineIndex);
|
|
1544
|
-
buffer = buffer.slice(newlineIndex + 1);
|
|
1545
|
-
if (line.endsWith("\r")) line = line.slice(0, -1);
|
|
1546
|
-
onLine(line);
|
|
1547
|
-
}
|
|
1548
|
-
});
|
|
1549
|
-
|
|
1550
|
-
stream.on("end", () => {
|
|
1551
|
-
buffer += decoder.end();
|
|
1552
|
-
if (buffer.length > 0) {
|
|
1553
|
-
onLine(buffer.endsWith("\r") ? buffer.slice(0, -1) : buffer);
|
|
1554
|
-
}
|
|
1555
|
-
});
|
|
1556
|
-
}
|
|
1557
|
-
|
|
1558
|
-
attachJsonlReader(agent.stdout, (line) => {
|
|
1559
|
-
const event = JSON.parse(line);
|
|
1560
|
-
|
|
1561
|
-
if (event.type === "message_update") {
|
|
1562
|
-
const { assistantMessageEvent } = event;
|
|
1563
|
-
if (assistantMessageEvent.type === "text_delta") {
|
|
1564
|
-
process.stdout.write(assistantMessageEvent.delta);
|
|
1565
|
-
}
|
|
1566
|
-
}
|
|
1567
|
-
});
|
|
1568
|
-
|
|
1569
|
-
// Send prompt
|
|
1570
|
-
agent.stdin.write(JSON.stringify({ type: "prompt", message: "Hello" }) + "\n");
|
|
1571
|
-
|
|
1572
|
-
// Abort on Ctrl+C
|
|
1573
|
-
process.on("SIGINT", () => {
|
|
1574
|
-
agent.stdin.write(JSON.stringify({ type: "abort" }) + "\n");
|
|
1575
|
-
});
|
|
1576
|
-
```
|
|
200
|
+
"error": "optionId \"not-an-option\" is not one of the options offered for this request; the request is still pending"
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
The `id` is the **dialog request id**, not a command id. The refusal does **not** consume the
|
|
205
|
+
request: the dialog is still open and still answerable, and a subsequent valid answer — with a good
|
|
206
|
+
`optionId`, or with none at all — decides it. A client that receives this line should correct its
|
|
207
|
+
answer and send it again; ignoring it leaves the agent waiting.
|
|
208
|
+
|
|
209
|
+
## Reference
|
|
210
|
+
|
|
211
|
+
- [RPC Commands](rpc-commands.md): every stdin command and response
|
|
212
|
+
- [JSON Event Stream](json.md): shared stdout session events and streaming reconstruction
|
|
213
|
+
- [RPC Extension UI](rpc-extension-ui.md): dialogs, notifications, responses, and limitations
|
|
214
|
+
- [Message Types](message-types.md): messages and content blocks used by responses and events
|
|
215
|
+
- [Session File Format](session-format.md): entries returned by session commands
|
|
216
|
+
- [`rpc-types.ts`](https://github.com/draht-dev/draht/blob/main/packages/coding-agent/src/modes/rpc/rpc-types.ts): exported TypeScript protocol definitions
|
|
217
|
+
- [`RpcClient`](https://github.com/draht-dev/draht/blob/main/packages/coding-agent/src/modes/rpc/rpc-client.ts): subprocess client implementation
|
|
218
|
+
|
|
219
|
+
## Moved reference anchors
|
|
220
|
+
|
|
221
|
+
The detailed references formerly on this page now have dedicated pages. These anchors preserve existing links.
|
|
222
|
+
|
|
223
|
+
<a id="prompt"></a>
|
|
224
|
+
<a id="steer"></a>
|
|
225
|
+
<a id="follow_up"></a>
|
|
226
|
+
<a id="abort"></a>
|
|
227
|
+
<a id="clear_queue"></a>
|
|
228
|
+
<a id="new_session"></a>
|
|
229
|
+
<a id="get_state"></a>
|
|
230
|
+
<a id="get_messages"></a>
|
|
231
|
+
<a id="set_model"></a>
|
|
232
|
+
<a id="cycle_model"></a>
|
|
233
|
+
<a id="get_available_models"></a>
|
|
234
|
+
<a id="set_thinking_level"></a>
|
|
235
|
+
<a id="cycle_thinking_level"></a>
|
|
236
|
+
<a id="get_available_thinking_levels"></a>
|
|
237
|
+
<a id="set_steering_mode"></a>
|
|
238
|
+
<a id="set_follow_up_mode"></a>
|
|
239
|
+
<a id="compact"></a>
|
|
240
|
+
<a id="set_auto_compaction"></a>
|
|
241
|
+
<a id="set_auto_retry"></a>
|
|
242
|
+
<a id="abort_retry"></a>
|
|
243
|
+
<a id="bash"></a>
|
|
244
|
+
<a id="abort_bash"></a>
|
|
245
|
+
<a id="get_session_stats"></a>
|
|
246
|
+
<a id="export_html"></a>
|
|
247
|
+
<a id="switch_session"></a>
|
|
248
|
+
<a id="fork"></a>
|
|
249
|
+
<a id="clone"></a>
|
|
250
|
+
<a id="get_fork_messages"></a>
|
|
251
|
+
<a id="get_entries"></a>
|
|
252
|
+
<a id="get_tree"></a>
|
|
253
|
+
<a id="get_last_assistant_text"></a>
|
|
254
|
+
<a id="set_session_name"></a>
|
|
255
|
+
<a id="get_commands"></a>
|
|
256
|
+
|
|
257
|
+
Command details moved to [RPC Commands](rpc-commands.md).
|
|
258
|
+
|
|
259
|
+
<a id="message_update-streaming"></a>
|
|
260
|
+
<a id="bash_execution_update"></a>
|
|
261
|
+
<a id="compaction_start--compaction_end"></a>
|
|
262
|
+
<a id="summarization_retry_scheduled--summarization_retry_attempt_start--summarization_retry_finished"></a>
|
|
263
|
+
|
|
264
|
+
Event details moved to [JSON Event Stream](json.md).
|
|
265
|
+
|
|
266
|
+
<a id="extension-ui-protocol"></a>
|
|
267
|
+
|
|
268
|
+
Extension interaction details moved to [RPC Extension UI](rpc-extension-ui.md).
|