@draht/coding-agent 2026.10.20 → 2026.10.23-1
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 +138 -0
- package/agents/advisor.md +2 -2
- package/agents/architect.md +11 -33
- package/agents/debugger.md +13 -54
- package/agents/git-committer.md +18 -42
- package/agents/implementer.md +14 -36
- package/agents/investigator.md +12 -63
- package/agents/reviewer.md +16 -44
- package/agents/security-auditor.md +22 -56
- package/agents/spec-reviewer.md +13 -53
- package/agents/verifier.md +14 -33
- package/bin/drahtbank.mjs +4 -0
- package/dist/agents/advisor.md +2 -2
- package/dist/agents/architect.md +11 -33
- package/dist/agents/debugger.md +13 -54
- package/dist/agents/git-committer.md +18 -42
- package/dist/agents/implementer.md +14 -36
- package/dist/agents/investigator.md +12 -63
- package/dist/agents/reviewer.md +16 -44
- package/dist/agents/security-auditor.md +22 -56
- package/dist/agents/spec-reviewer.md +13 -53
- package/dist/agents/verifier.md +14 -33
- package/dist/bundle/chunks/anthropic-messages-G57VPNTF.js +6 -0
- package/dist/bundle/chunks/anthropic.js +1 -1
- package/dist/bundle/chunks/azure-openai-responses-AYUCZ5WN.js +2 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +31 -28
- package/dist/bundle/chunks/chunk-2JZLKNZ4.js +3 -0
- package/dist/bundle/chunks/chunk-3GDEPGTR.js +16 -0
- package/dist/bundle/chunks/chunk-5JW3NSTV.js +2 -0
- package/dist/bundle/chunks/{chunk-KVH4HR57.js → chunk-6WESOD4H.js} +1 -1
- package/dist/bundle/chunks/chunk-76YNMQ57.js +2 -0
- package/dist/bundle/chunks/chunk-AC3MSTC6.js +2 -0
- package/dist/bundle/chunks/chunk-ACLWH5WQ.js +2 -0
- package/dist/bundle/chunks/chunk-BL72B6LV.js +82 -0
- package/dist/bundle/chunks/chunk-CLKG6K6Z.js +7 -0
- package/dist/bundle/chunks/chunk-DN7SM3LX.js +479 -0
- package/dist/bundle/chunks/{chunk-D6TMD5Q2.js → chunk-DOUMZTXH.js} +10 -10
- package/dist/bundle/chunks/chunk-DQ4G4IS4.js +20 -0
- package/dist/bundle/chunks/chunk-E4VZJRJ2.js +9 -0
- package/dist/bundle/chunks/chunk-FOYIPAAD.js +6 -0
- package/dist/bundle/chunks/chunk-FXCTQRNN.js +2 -0
- package/dist/bundle/chunks/chunk-GBFVS2SF.js +12 -0
- package/dist/bundle/chunks/chunk-GQXRTK54.js +20 -0
- package/dist/bundle/chunks/chunk-IGO52ZOY.js +132 -0
- package/dist/bundle/chunks/chunk-IT4RIOZD.js +2 -0
- package/dist/bundle/chunks/chunk-JJKPUMH2.js +1424 -0
- package/dist/bundle/chunks/chunk-JNWRE5F4.js +2 -0
- package/dist/bundle/chunks/chunk-KSGHCBHT.js +2 -0
- package/dist/bundle/chunks/chunk-LO6CVU2L.js +6 -0
- package/dist/bundle/chunks/chunk-MBFTIGLS.js +2 -0
- package/dist/bundle/chunks/chunk-N26RGV3K.js +11 -0
- package/dist/bundle/chunks/{chunk-KPO5375S.js → chunk-RCRGGYLW.js} +1 -1
- package/dist/bundle/chunks/chunk-UCJ7FLSO.js +166 -0
- package/dist/bundle/chunks/chunk-USCN7R2E.js +2 -0
- package/dist/bundle/chunks/chunk-WFHH5SX6.js +4 -0
- package/dist/bundle/chunks/chunk-WYWBXNDO.js +6 -0
- package/dist/bundle/chunks/chunk-ZRPAOMVB.js +2 -0
- package/dist/bundle/chunks/{cli-PYJB6AQ3.js → cli-HTUB6WOG.js} +6 -6
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-RRSO6OXX.js +2 -0
- package/dist/bundle/chunks/codemode-worker.js +188 -21
- package/dist/bundle/chunks/execute-UUPNZJJG.js +31 -0
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/google-generative-ai-VJSS5EBX.js +2 -0
- package/dist/bundle/chunks/google-vertex-K23DBWTT.js +2 -0
- package/dist/bundle/chunks/https-proxy-agent-WQIRL24U.js +13 -0
- package/dist/bundle/chunks/image-resize-worker.js +1 -1
- package/dist/bundle/chunks/lib-ULKZYRGD.js +9 -0
- package/dist/bundle/chunks/{llama-cpp-classify-EJ5XMSQL.js → llama-cpp-classify-3VDXTYVJ.js} +3 -3
- package/dist/bundle/chunks/mistral-conversations-SKVQJGFZ.js +5 -0
- package/dist/bundle/chunks/{multipart-parser-AZP5BX2W.js → multipart-parser-HMCXZ4BD.js} +1 -1
- package/dist/bundle/chunks/node-DXZFQBEO.js +16 -0
- package/dist/bundle/chunks/{node-C2JGH2OB.js → node-LBZLUIBE.js} +1 -1
- package/dist/bundle/chunks/openai-chatgpt.js +1 -1
- package/dist/bundle/chunks/openai-codex-responses-LV4RIZL3.js +10 -0
- package/dist/bundle/chunks/openai-codex.js +1 -1
- package/dist/bundle/chunks/openai-completions-PUIR2V25.js +7 -0
- package/dist/bundle/chunks/openai-decisions-2DJLSYQF.js +5 -0
- package/dist/bundle/chunks/openai-responses-6ESQOXAF.js +4 -0
- package/dist/bundle/chunks/opencode-go.js +1 -1
- package/dist/bundle/chunks/openrouter-images-TVXBMY3V.js +2 -0
- package/dist/bundle/chunks/pi-messages-XS7FDWQI.js +8 -0
- package/dist/bundle/chunks/runtime-IB3XQ7E3.js +2 -0
- package/dist/bundle/chunks/runtime-LB35PK4J.js +3 -0
- package/dist/bundle/chunks/settings-manager-YNY5F4RU.js +2 -0
- package/dist/bundle/chunks/src-KDGO7EGF.js +4 -0
- package/dist/bundle/chunks/typesafe-system-one-67GAWZXE.js +2 -0
- package/dist/bundle/chunks/virtual-modules-U4CBGVMI.js +2 -0
- package/dist/bundle/cli-runtime.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/cli/args.d.ts +2 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +30 -8
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/credential-print.d.ts.map +1 -1
- package/dist/cli/credential-print.js +4 -4
- package/dist/cli/credential-print.js.map +1 -1
- package/dist/config.d.ts +18 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +44 -6
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts +65 -8
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +240 -102
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +20 -13
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +42 -52
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/bug-report.d.ts +9 -1
- package/dist/core/bug-report.d.ts.map +1 -1
- package/dist/core/builtins/completion-checks.d.ts +3 -0
- package/dist/core/builtins/completion-checks.d.ts.map +1 -0
- package/dist/core/builtins/completion-checks.js +142 -0
- package/dist/core/builtins/completion-checks.js.map +1 -0
- package/dist/core/builtins/duet.d.ts.map +1 -1
- package/dist/core/builtins/duet.js +7 -5
- package/dist/core/builtins/duet.js.map +1 -1
- package/dist/core/builtins/git-safety.d.ts +3 -0
- package/dist/core/builtins/git-safety.d.ts.map +1 -0
- package/dist/core/builtins/git-safety.js +34 -0
- package/dist/core/builtins/git-safety.js.map +1 -0
- package/dist/core/builtins/index.d.ts.map +1 -1
- package/dist/core/builtins/index.js +4 -0
- package/dist/core/builtins/index.js.map +1 -1
- package/dist/core/client-identity.d.ts +8 -0
- package/dist/core/client-identity.d.ts.map +1 -0
- package/dist/core/client-identity.js +15 -0
- package/dist/core/client-identity.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +1 -2
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +2 -2
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +20 -15
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/utils.d.ts +6 -0
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js +7 -8
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/export-html/index.d.ts.map +1 -1
- package/dist/core/export-html/index.js +2 -0
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/export-html/template.html +1 -0
- package/dist/core/export-html/template.js +23 -17
- package/dist/core/export-html/tool-renderer.d.ts +3 -3
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js +5 -3
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/export-html/vendor/marked-cjk-friendly.min.js +6 -0
- package/dist/core/export-html/vendor/marked.min.js +30 -29
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +7 -0
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +6 -2
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +16 -4
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +61 -7
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/extensions/virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/virtual-modules.js +2 -0
- package/dist/core/extensions/virtual-modules.js.map +1 -1
- package/dist/core/key-id-schema.d.ts +6 -0
- package/dist/core/key-id-schema.d.ts.map +1 -0
- package/dist/core/key-id-schema.js +16 -0
- package/dist/core/key-id-schema.js.map +1 -0
- package/dist/core/keybindings-schema.d.ts +4 -0
- package/dist/core/keybindings-schema.d.ts.map +1 -0
- package/dist/core/keybindings-schema.js +16 -0
- package/dist/core/keybindings-schema.js.map +1 -0
- package/dist/core/keybindings.d.ts +242 -75
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +30 -23
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/mcp-servers.d.ts +22 -0
- package/dist/core/mcp-servers.d.ts.map +1 -1
- package/dist/core/mcp-servers.js +72 -11
- package/dist/core/mcp-servers.js.map +1 -1
- package/dist/core/model-config.d.ts +1623 -74
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +70 -184
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-registry.d.ts +3 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +4 -0
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts +56 -43
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +253 -358
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +19 -10
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/nested-tool-calls.d.ts +1 -0
- package/dist/core/nested-tool-calls.d.ts.map +1 -1
- package/dist/core/nested-tool-calls.js +1 -0
- package/dist/core/nested-tool-calls.js.map +1 -1
- package/dist/core/package-manager.js +3 -3
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/polyphase/keyword.js +1 -1
- package/dist/core/polyphase/keyword.js.map +1 -1
- package/dist/core/polyphase/model-selection.d.ts.map +1 -1
- package/dist/core/polyphase/model-selection.js +15 -7
- package/dist/core/polyphase/model-selection.js.map +1 -1
- package/dist/core/polyphase/workflow/prelude.d.ts +2 -0
- package/dist/core/polyphase/workflow/prelude.d.ts.map +1 -1
- package/dist/core/polyphase/workflow/prelude.js +12 -16
- package/dist/core/polyphase/workflow/prelude.js.map +1 -1
- package/dist/core/polyphase/workflow/runtime.d.ts.map +1 -1
- package/dist/core/polyphase/workflow/runtime.js +2 -1
- package/dist/core/polyphase/workflow/runtime.js.map +1 -1
- package/dist/core/project-trust.d.ts.map +1 -1
- package/dist/core/project-trust.js +2 -1
- package/dist/core/project-trust.js.map +1 -1
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +7 -2
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/provider-composer.d.ts +2 -1
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +13 -0
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/radius.d.ts +2 -0
- package/dist/core/radius.d.ts.map +1 -1
- package/dist/core/radius.js +2 -0
- package/dist/core/radius.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts +12 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +84 -24
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resource-loader.d.ts +3 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +7 -4
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts +13 -4
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +27 -15
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/settings-defaults.d.ts +65 -0
- package/dist/core/settings-defaults.d.ts.map +1 -0
- package/dist/core/settings-defaults.js +66 -0
- package/dist/core/settings-defaults.js.map +1 -0
- package/dist/core/settings-manager.d.ts +17 -178
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +86 -57
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-schema.d.ts +269 -0
- package/dist/core/settings-schema.d.ts.map +1 -0
- package/dist/core/settings-schema.js +318 -0
- package/dist/core/settings-schema.js.map +1 -0
- package/dist/core/skills.d.ts +4 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +6 -1
- package/dist/core/skills.js.map +1 -1
- package/dist/core/system-prompt.d.ts +6 -0
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +10 -5
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +3 -5
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/grep.d.ts +8 -0
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +19 -7
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/index.d.ts +2 -0
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +2 -0
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +4 -10
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/path-utils.d.ts +1 -1
- package/dist/core/tools/path-utils.d.ts.map +1 -1
- package/dist/core/tools/path-utils.js +6 -6
- package/dist/core/tools/path-utils.js.map +1 -1
- package/dist/core/tools/read.d.ts +13 -0
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +32 -2
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts +20 -0
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js +67 -0
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/renderers/bash.d.ts.map +1 -1
- package/dist/core/tools/renderers/bash.js +7 -35
- package/dist/core/tools/renderers/bash.js.map +1 -1
- package/dist/core/tools/renderers/edit.d.ts.map +1 -1
- package/dist/core/tools/renderers/edit.js +5 -4
- package/dist/core/tools/renderers/edit.js.map +1 -1
- package/dist/core/tools/renderers/index.d.ts +2 -2
- package/dist/core/tools/renderers/index.d.ts.map +1 -1
- package/dist/core/tools/renderers/index.js.map +1 -1
- package/dist/core/tools/renderers/read.d.ts.map +1 -1
- package/dist/core/tools/renderers/read.js +7 -11
- package/dist/core/tools/renderers/read.js.map +1 -1
- package/dist/extensions/codemode/execute.d.ts.map +1 -1
- package/dist/extensions/codemode/execute.js +391 -80
- package/dist/extensions/codemode/execute.js.map +1 -1
- package/dist/extensions/codemode/index.d.ts.map +1 -1
- package/dist/extensions/codemode/index.js +3 -1
- package/dist/extensions/codemode/index.js.map +1 -1
- package/dist/extensions/codemode/renderer.d.ts +2 -2
- package/dist/extensions/codemode/renderer.d.ts.map +1 -1
- package/dist/extensions/codemode/renderer.js +9 -3
- package/dist/extensions/codemode/renderer.js.map +1 -1
- package/dist/extensions/codemode/tool.d.ts +22 -21
- package/dist/extensions/codemode/tool.d.ts.map +1 -1
- package/dist/extensions/codemode/tool.js +96 -123
- package/dist/extensions/codemode/tool.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +34 -11
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/extensions/mcp/cli.d.ts.map +1 -1
- package/dist/extensions/mcp/cli.js +27 -33
- package/dist/extensions/mcp/cli.js.map +1 -1
- package/dist/extensions/mcp/config.d.ts +15 -3
- package/dist/extensions/mcp/config.d.ts.map +1 -1
- package/dist/extensions/mcp/config.js +49 -12
- package/dist/extensions/mcp/config.js.map +1 -1
- package/dist/extensions/mcp/index.d.ts +4 -1
- package/dist/extensions/mcp/index.d.ts.map +1 -1
- package/dist/extensions/mcp/index.js +279 -129
- package/dist/extensions/mcp/index.js.map +1 -1
- package/dist/extensions/mcp/oauth.d.ts +21 -11
- package/dist/extensions/mcp/oauth.d.ts.map +1 -1
- package/dist/extensions/mcp/oauth.js +166 -45
- package/dist/extensions/mcp/oauth.js.map +1 -1
- package/dist/extensions/mcp/resources.d.ts +3 -10
- package/dist/extensions/mcp/resources.d.ts.map +1 -1
- package/dist/extensions/mcp/resources.js +4 -5
- package/dist/extensions/mcp/resources.js.map +1 -1
- package/dist/extensions/mcp/runtime.d.ts +7 -7
- package/dist/extensions/mcp/runtime.d.ts.map +1 -1
- package/dist/extensions/mcp/runtime.js +31 -45
- package/dist/extensions/mcp/runtime.js.map +1 -1
- package/dist/extensions/mcp/tools.d.ts +7 -5
- package/dist/extensions/mcp/tools.d.ts.map +1 -1
- package/dist/extensions/mcp/tools.js +87 -29
- package/dist/extensions/mcp/tools.js.map +1 -1
- package/dist/extensions/mcp/ui.d.ts +3 -3
- package/dist/extensions/mcp/ui.d.ts.map +1 -1
- package/dist/extensions/mcp/ui.js +18 -6
- package/dist/extensions/mcp/ui.js.map +1 -1
- package/dist/extensions/tool-search/tool.d.ts +0 -2
- package/dist/extensions/tool-search/tool.d.ts.map +1 -1
- package/dist/extensions/tool-search/tool.js +2 -4
- package/dist/extensions/tool-search/tool.js.map +1 -1
- package/dist/hooks/checks/checks-runtime.cjs +215 -0
- package/dist/hooks/checks/git-safety.cjs +198 -0
- package/dist/hooks/checks/git-safety.d.cts +1 -0
- package/dist/hooks/gsd/draht-post-task.js +78 -39
- package/dist/hooks/gsd/draht-quality-gate.js +210 -122
- package/dist/hooks/gsd/package.json +3 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +11 -3
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/auth-url.d.ts +14 -0
- package/dist/modes/interactive/components/auth-url.d.ts.map +1 -0
- package/dist/modes/interactive/components/auth-url.js +37 -0
- package/dist/modes/interactive/components/auth-url.js.map +1 -0
- package/dist/modes/interactive/components/bash-execution.d.ts +5 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +17 -14
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts +2 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +5 -2
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +2 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +5 -2
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/custom-entry.d.ts +3 -1
- package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-entry.js +8 -2
- package/dist/modes/interactive/components/custom-entry.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +1 -0
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +3 -0
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +38 -10
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +8 -2
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +24 -21
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/radius-login-selector.d.ts +15 -0
- package/dist/modes/interactive/components/radius-login-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/radius-login-selector.js +85 -0
- package/dist/modes/interactive/components/radius-login-selector.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +3 -3
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +9 -8
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +2 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +5 -2
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-indicator.js +2 -2
- package/dist/modes/interactive/components/status-indicator.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +12 -13
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +32 -45
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +2 -9
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +5 -4
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +43 -48
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +362 -278
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/program-status-reporter.d.ts +34 -0
- package/dist/modes/interactive/program-status-reporter.d.ts.map +1 -0
- package/dist/modes/interactive/program-status-reporter.js +110 -0
- package/dist/modes/interactive/program-status-reporter.js.map +1 -0
- package/dist/modes/interactive/theme/dark.json +1 -1
- package/dist/modes/interactive/theme/light.json +1 -1
- package/dist/modes/interactive/theme/system-theme.d.ts +2 -1
- package/dist/modes/interactive/theme/system-theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/system-theme.js +16 -5
- package/dist/modes/interactive/theme/system-theme.js.map +1 -1
- package/dist/modes/interactive/theme/theme-schema.d.ts +28 -0
- package/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.js +105 -0
- package/dist/modes/interactive/theme/theme-schema.js.map +1 -0
- package/dist/modes/interactive/theme/theme-tokens.d.ts +257 -0
- package/dist/modes/interactive/theme/theme-tokens.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-tokens.js +94 -0
- package/dist/modes/interactive/theme/theme-tokens.js.map +1 -0
- package/dist/modes/interactive/theme/theme.d.ts +13 -16
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +22 -29
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +4 -0
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +26 -1
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/prompts/commands/atomic-commit.md +8 -6
- package/dist/prompts/commands/brainstorm.md +5 -149
- package/dist/prompts/commands/create-verification-skill.md +8 -48
- package/dist/prompts/commands/discuss-phase.md +6 -10
- package/dist/prompts/commands/execute-phase.md +18 -45
- package/dist/prompts/commands/fix.md +16 -128
- package/dist/prompts/commands/grill.md +6 -53
- package/dist/prompts/commands/init-project.md +13 -18
- package/dist/prompts/commands/map-codebase.md +3 -3
- package/dist/prompts/commands/new-project.md +12 -17
- package/dist/prompts/commands/next-milestone.md +4 -8
- package/dist/prompts/commands/orchestrate-loop.md +12 -12
- package/dist/prompts/commands/orchestrate.md +12 -11
- package/dist/prompts/commands/pause-work.md +1 -1
- package/dist/prompts/commands/plan-phase.md +15 -37
- package/dist/prompts/commands/quick.md +11 -64
- package/dist/prompts/commands/resolve-conflicts.md +2 -15
- package/dist/prompts/commands/triage.md +3 -14
- package/dist/prompts/commands/verify-work.md +15 -63
- package/dist/prompts/commands/why.md +18 -118
- package/dist/skills/atomic-reasoning/SKILL.md +6 -105
- package/dist/skills/blast-radius/SKILL.md +1 -1
- package/dist/skills/epistemics/SKILL.md +12 -87
- package/dist/skills/explainers/SKILL.md +1 -1
- package/dist/skills/typescript-discipline/SKILL.md +12 -42
- package/dist/skills/typescript-discipline/references/patterns.md +25 -266
- package/dist/skills/unslop/SKILL.md +14 -105
- package/dist/utils/ansi.d.ts +8 -0
- package/dist/utils/ansi.d.ts.map +1 -1
- package/dist/utils/ansi.js +30 -11
- package/dist/utils/ansi.js.map +1 -1
- package/dist/utils/clipboard-command.d.ts.map +1 -1
- package/dist/utils/clipboard-command.js +3 -0
- package/dist/utils/clipboard-command.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +18 -12
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/draht-user-agent.d.ts +1 -0
- package/dist/utils/draht-user-agent.d.ts.map +1 -1
- package/dist/utils/draht-user-agent.js +3 -2
- package/dist/utils/draht-user-agent.js.map +1 -1
- package/dist/utils/image-convert.d.ts +12 -0
- package/dist/utils/image-convert.d.ts.map +1 -1
- package/dist/utils/image-convert.js +45 -6
- package/dist/utils/image-convert.js.map +1 -1
- package/dist/utils/image-resize-core.d.ts +12 -0
- package/dist/utils/image-resize-core.d.ts.map +1 -1
- package/dist/utils/image-resize-core.js +5 -0
- package/dist/utils/image-resize-core.js.map +1 -1
- package/dist/utils/image-resize-worker.js +3 -2
- package/dist/utils/image-resize-worker.js.map +1 -1
- package/dist/utils/image-resize.d.ts.map +1 -1
- package/dist/utils/image-resize.js +9 -10
- package/dist/utils/image-resize.js.map +1 -1
- package/dist/utils/output-files.d.ts +15 -0
- package/dist/utils/output-files.d.ts.map +1 -0
- package/dist/utils/output-files.js +30 -0
- package/dist/utils/output-files.js.map +1 -0
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +43 -13
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +6 -1
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +4 -3
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/cli-integration.md +1 -1
- package/docs/cli.md +30 -26
- package/docs/codemode.md +230 -0
- package/docs/compaction.md +5 -5
- package/docs/containerization.md +1 -1
- package/docs/custom-provider.md +53 -1
- package/docs/docs.json +17 -1
- package/docs/drahtbank.md +163 -0
- package/docs/environment-variables.md +5 -2
- package/docs/extensions.md +143 -13
- package/docs/index.md +1 -1
- package/docs/json.md +3 -3
- package/docs/keybindings.md +9 -5
- package/docs/llama-cpp.md +9 -2
- package/docs/mcp.md +59 -3
- package/docs/message-types.md +22 -4
- package/docs/models-configuration.md +187 -0
- package/docs/models.md +67 -4
- package/docs/nvidia-rtx-llama-cpp.md +96 -0
- package/docs/providers.md +70 -5
- package/docs/sdk.md +1 -1
- package/docs/settings.md +10 -8
- package/docs/terminal-setup.md +14 -0
- package/docs/themes.md +4 -2
- package/docs/tui.md +71 -1
- package/docs/usage.md +1 -1
- package/docs/windows.md +16 -2
- package/eval/drahtbank/adapters.d.mts +35 -0
- package/eval/drahtbank/adapters.mjs +192 -0
- package/eval/drahtbank/bank.d.mts +141 -0
- package/eval/drahtbank/bank.mjs +515 -0
- package/eval/drahtbank/cases-v2.d.mts +28 -0
- package/eval/drahtbank/cases-v2.mjs +164 -0
- package/eval/drahtbank/cases.d.mts +17 -0
- package/eval/drahtbank/cases.mjs +198 -0
- package/eval/drahtbank/cli.mjs +120 -0
- package/eval/drahtbank/grading-v2.d.mts +26 -0
- package/eval/drahtbank/grading-v2.mjs +227 -0
- package/eval/drahtbank/isolated-tools.ts +223 -0
- package/eval/drahtbank/isolation-worker.mjs +53 -0
- package/eval/drahtbank/isolation.d.mts +52 -0
- package/eval/drahtbank/isolation.mjs +345 -0
- package/eval/drahtbank/runtime-checks.d.mts +15 -0
- package/eval/drahtbank/runtime-checks.mjs +187 -0
- package/examples/extensions/dynamic-resources/dynamic.json +1 -1
- package/examples/extensions/minimal-mode.ts +4 -5
- package/examples/extensions/overlay-test.ts +2 -2
- package/examples/extensions/plan-mode/index.ts +6 -2
- package/examples/extensions/subagent/index.ts +4 -6
- package/hooks/checks/checks-runtime.cjs +215 -0
- package/hooks/checks/git-safety.cjs +198 -0
- package/hooks/checks/git-safety.d.cts +1 -0
- package/hooks/gsd/draht-post-task.js +78 -39
- package/hooks/gsd/draht-quality-gate.js +210 -122
- package/hooks/gsd/package.json +3 -0
- package/package.json +21 -16
- package/prompts/commands/atomic-commit.md +8 -6
- package/prompts/commands/brainstorm.md +5 -149
- package/prompts/commands/create-verification-skill.md +8 -48
- package/prompts/commands/discuss-phase.md +6 -10
- package/prompts/commands/execute-phase.md +18 -45
- package/prompts/commands/fix.md +16 -128
- package/prompts/commands/grill.md +6 -53
- package/prompts/commands/init-project.md +13 -18
- package/prompts/commands/map-codebase.md +3 -3
- package/prompts/commands/new-project.md +12 -17
- package/prompts/commands/next-milestone.md +4 -8
- package/prompts/commands/orchestrate-loop.md +12 -12
- package/prompts/commands/orchestrate.md +12 -11
- package/prompts/commands/pause-work.md +1 -1
- package/prompts/commands/plan-phase.md +15 -37
- package/prompts/commands/quick.md +11 -64
- package/prompts/commands/resolve-conflicts.md +2 -15
- package/prompts/commands/triage.md +3 -14
- package/prompts/commands/verify-work.md +15 -63
- package/prompts/commands/why.md +18 -118
- package/schemas/keybindings.schema.json +433 -0
- package/schemas/models.schema.json +1190 -0
- package/schemas/settings.schema.json +849 -0
- package/schemas/theme.schema.json +365 -0
- package/skills/atomic-reasoning/SKILL.md +6 -105
- package/skills/blast-radius/SKILL.md +1 -1
- package/skills/epistemics/SKILL.md +12 -87
- package/skills/explainers/SKILL.md +1 -1
- package/skills/typescript-discipline/SKILL.md +12 -42
- package/skills/typescript-discipline/references/patterns.md +25 -266
- package/skills/unslop/SKILL.md +14 -105
- package/dist/bundle/chunks/anthropic-messages-GAKYXF65.js +0 -6
- package/dist/bundle/chunks/azure-openai-responses-ZIXMK6JO.js +0 -2
- package/dist/bundle/chunks/chunk-2E5VODES.js +0 -2
- package/dist/bundle/chunks/chunk-2VAF4XJI.js +0 -146
- package/dist/bundle/chunks/chunk-4TVQYRQY.js +0 -2
- package/dist/bundle/chunks/chunk-6MSE6LZ3.js +0 -6
- package/dist/bundle/chunks/chunk-6ZJKIMU7.js +0 -2
- package/dist/bundle/chunks/chunk-736QBNUZ.js +0 -12
- package/dist/bundle/chunks/chunk-7TYCZN4Z.js +0 -137
- package/dist/bundle/chunks/chunk-BXSHCX3G.js +0 -11
- package/dist/bundle/chunks/chunk-GVXA72ZA.js +0 -2
- package/dist/bundle/chunks/chunk-I5OKY6RH.js +0 -11
- package/dist/bundle/chunks/chunk-IWTUBX6V.js +0 -4
- package/dist/bundle/chunks/chunk-KU5HAKZL.js +0 -4
- package/dist/bundle/chunks/chunk-MO3SCGBN.js +0 -18
- package/dist/bundle/chunks/chunk-N2QZNJT6.js +0 -65
- package/dist/bundle/chunks/chunk-PGJAHC3R.js +0 -107
- package/dist/bundle/chunks/chunk-QVFELZW2.js +0 -312
- package/dist/bundle/chunks/chunk-RZKPFWMH.js +0 -42
- package/dist/bundle/chunks/chunk-SDRCE6OP.js +0 -2
- package/dist/bundle/chunks/chunk-SVNWI7EV.js +0 -8
- package/dist/bundle/chunks/chunk-TIA2T6EO.js +0 -3
- package/dist/bundle/chunks/chunk-TOWVIJ2O.js +0 -1623
- package/dist/bundle/chunks/chunk-XBUEMKIY.js +0 -2
- package/dist/bundle/chunks/chunk-ZA4QNPJY.js +0 -82
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-MJKOAE5S.js +0 -2
- package/dist/bundle/chunks/execute-6N7T7VLY.js +0 -18
- package/dist/bundle/chunks/google-generative-ai-RPUPQ6PM.js +0 -2
- package/dist/bundle/chunks/google-vertex-EZES5QVQ.js +0 -2
- package/dist/bundle/chunks/https-proxy-agent-O2PVUIOI.js +0 -13
- package/dist/bundle/chunks/lib-XOG5PI3Y.js +0 -9
- package/dist/bundle/chunks/mistral-conversations-AOYGU43Y.js +0 -5
- package/dist/bundle/chunks/node-LQ52KV6B.js +0 -16
- package/dist/bundle/chunks/openai-codex-responses-M2Y77JEQ.js +0 -10
- package/dist/bundle/chunks/openai-completions-A4OKYOYV.js +0 -7
- package/dist/bundle/chunks/openai-responses-6IXV53T3.js +0 -3
- package/dist/bundle/chunks/openrouter-images-LYV4NKFM.js +0 -2
- package/dist/bundle/chunks/pi-messages-KKMEUT3Z.js +0 -8
- package/dist/bundle/chunks/runtime-363BOYEO.js +0 -3
- package/dist/bundle/chunks/runtime-D3KV73AE.js +0 -2
- package/dist/bundle/chunks/settings-manager-GEOZJXFQ.js +0 -2
- package/dist/bundle/chunks/src-TIBHS42X.js +0 -4
- package/dist/bundle/chunks/typesafe-system-one-YBEEY5XU.js +0 -2
- package/dist/bundle/chunks/virtual-modules-RLC4Y5MX.js +0 -2
- package/dist/core/provider-attribution.d.ts +0 -4
- package/dist/core/provider-attribution.d.ts.map +0 -1
- package/dist/core/provider-attribution.js +0 -72
- package/dist/core/provider-attribution.js.map +0 -1
- package/dist/experimental/micro/api.d.ts +0 -81
- package/dist/experimental/micro/api.d.ts.map +0 -1
- package/dist/experimental/micro/api.js +0 -2
- package/dist/experimental/micro/api.js.map +0 -1
- package/dist/experimental/micro/main.d.ts +0 -3
- package/dist/experimental/micro/main.d.ts.map +0 -1
- package/dist/experimental/micro/main.js +0 -21
- package/dist/experimental/micro/main.js.map +0 -1
- package/dist/experimental/micro/models.d.ts +0 -11
- package/dist/experimental/micro/models.d.ts.map +0 -1
- package/dist/experimental/micro/models.js +0 -95
- package/dist/experimental/micro/models.js.map +0 -1
- package/dist/experimental/micro/runtime.d.ts +0 -12
- package/dist/experimental/micro/runtime.d.ts.map +0 -1
- package/dist/experimental/micro/runtime.js +0 -465
- package/dist/experimental/micro/runtime.js.map +0 -1
- package/dist/experimental/micro/sessions.d.ts +0 -10
- package/dist/experimental/micro/sessions.d.ts.map +0 -1
- package/dist/experimental/micro/sessions.js +0 -41
- package/dist/experimental/micro/sessions.js.map +0 -1
- package/dist/experimental/micro/tools.d.ts +0 -10
- package/dist/experimental/micro/tools.d.ts.map +0 -1
- package/dist/experimental/micro/tools.js +0 -96
- package/dist/experimental/micro/tools.js.map +0 -1
- package/dist/experimental/micro/tui.d.ts +0 -3
- package/dist/experimental/micro/tui.d.ts.map +0 -1
- package/dist/experimental/micro/tui.js +0 -510
- package/dist/experimental/micro/tui.js.map +0 -1
- package/dist/experimental/mini/main.d.ts +0 -7
- package/dist/experimental/mini/main.d.ts.map +0 -1
- package/dist/experimental/mini/main.js +0 -21
- package/dist/experimental/mini/main.js.map +0 -1
- package/dist/experimental/mini/server/entry.d.ts +0 -3
- package/dist/experimental/mini/server/entry.d.ts.map +0 -1
- package/dist/experimental/mini/server/entry.js +0 -11
- package/dist/experimental/mini/server/entry.js.map +0 -1
- package/dist/experimental/mini/server/run.d.ts +0 -13
- package/dist/experimental/mini/server/run.d.ts.map +0 -1
- package/dist/experimental/mini/server/run.js +0 -150
- package/dist/experimental/mini/server/run.js.map +0 -1
- package/dist/experimental/mini/shared/protocol.d.ts +0 -127
- package/dist/experimental/mini/shared/protocol.d.ts.map +0 -1
- package/dist/experimental/mini/shared/protocol.js +0 -13
- package/dist/experimental/mini/shared/protocol.js.map +0 -1
- package/dist/experimental/mini/shared/rpc.d.ts +0 -49
- package/dist/experimental/mini/shared/rpc.d.ts.map +0 -1
- package/dist/experimental/mini/shared/rpc.js +0 -171
- package/dist/experimental/mini/shared/rpc.js.map +0 -1
- package/dist/experimental/mini/shared/transport.d.ts +0 -35
- package/dist/experimental/mini/shared/transport.d.ts.map +0 -1
- package/dist/experimental/mini/shared/transport.js +0 -94
- package/dist/experimental/mini/shared/transport.js.map +0 -1
- package/dist/experimental/mini/tui/run.d.ts +0 -9
- package/dist/experimental/mini/tui/run.d.ts.map +0 -1
- package/dist/experimental/mini/tui/run.js +0 -62
- package/dist/experimental/mini/tui/run.js.map +0 -1
- package/dist/experimental/mini/tui/session.d.ts +0 -26
- package/dist/experimental/mini/tui/session.d.ts.map +0 -1
- package/dist/experimental/mini/tui/session.js +0 -94
- package/dist/experimental/mini/tui/session.js.map +0 -1
- package/dist/experimental/mini/tui/view.d.ts +0 -10
- package/dist/experimental/mini/tui/view.d.ts.map +0 -1
- package/dist/experimental/mini/tui/view.js +0 -461
- package/dist/experimental/mini/tui/view.js.map +0 -1
- package/dist/experimental/mini/worker/entry.d.ts +0 -3
- package/dist/experimental/mini/worker/entry.d.ts.map +0 -1
- package/dist/experimental/mini/worker/entry.js +0 -10
- package/dist/experimental/mini/worker/entry.js.map +0 -1
- package/dist/experimental/mini/worker/lane-service.d.ts +0 -44
- package/dist/experimental/mini/worker/lane-service.d.ts.map +0 -1
- package/dist/experimental/mini/worker/lane-service.js +0 -97
- package/dist/experimental/mini/worker/lane-service.js.map +0 -1
- package/dist/experimental/mini/worker/models-service.d.ts +0 -19
- package/dist/experimental/mini/worker/models-service.d.ts.map +0 -1
- package/dist/experimental/mini/worker/models-service.js +0 -136
- package/dist/experimental/mini/worker/models-service.js.map +0 -1
- package/dist/experimental/mini/worker/run.d.ts +0 -14
- package/dist/experimental/mini/worker/run.d.ts.map +0 -1
- package/dist/experimental/mini/worker/run.js +0 -88
- package/dist/experimental/mini/worker/run.js.map +0 -1
- package/dist/modes/interactive/theme/theme-json.d.ts +0 -85
- package/dist/modes/interactive/theme/theme-json.d.ts.map +0 -1
- package/dist/modes/interactive/theme/theme-json.js +0 -132
- package/dist/modes/interactive/theme/theme-json.js.map +0 -1
- package/dist/modes/interactive/theme/theme-schema.json +0 -361
- /package/dist/bundle/chunks/{chunk-ZZD35WKM.js → chunk-MOOADNVS.js} +0 -0
package/docs/extensions.md
CHANGED
|
@@ -51,7 +51,7 @@ Reload replaces the extension runtime, so code after `await ctx.reload()` must n
|
|
|
51
51
|
|
|
52
52
|
<a id="understand-the-lifecycle"></a>
|
|
53
53
|
|
|
54
|
-
##
|
|
54
|
+
## Understand the runtime lifecycle
|
|
55
55
|
|
|
56
56
|
The factory can be synchronous or asynchronous. draht waits for an asynchronous factory before startup continues, allowing it to fetch configuration or register providers needed during startup.
|
|
57
57
|
|
|
@@ -59,12 +59,112 @@ Do not start processes, sockets, watchers, or timers in the factory because some
|
|
|
59
59
|
Start long-lived resources from `session_start` or from the command or tool that needs them.
|
|
60
60
|
Close session-scoped resources from an idempotent `session_shutdown` handler.
|
|
61
61
|
|
|
62
|
-
A
|
|
63
|
-
|
|
62
|
+
A normal prompt starts a run. The run repeats turns, then checks whether more work starts another low-level agent run:
|
|
63
|
+
|
|
64
|
+
```mermaid
|
|
65
|
+
flowchart TD
|
|
66
|
+
Input["input"] --> Before["before_agent_start"]
|
|
67
|
+
Before --> AgentStart["agent_start"]
|
|
68
|
+
AgentStart --> Turns[["turns"]]
|
|
69
|
+
Turns --> AgentEnd["agent_end"]
|
|
70
|
+
AgentEnd --> MoreRuns{"More work?"}
|
|
71
|
+
MoreRuns -->|yes| AgentStart
|
|
72
|
+
MoreRuns -->|no| BeforeSettle["agent_before_settle"]
|
|
73
|
+
BeforeSettle --> Continue{"Continuation requested?"}
|
|
74
|
+
Continue -->|yes| AgentStart
|
|
75
|
+
Continue -->|no| Settled["agent_settled"]
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
More work means a retry, recovery, compaction retry, or queued work.
|
|
79
|
+
|
|
80
|
+
Each turn sends one model request and executes the tool calls in the assistant response:
|
|
81
|
+
|
|
82
|
+
```mermaid
|
|
83
|
+
flowchart TD
|
|
84
|
+
TurnStart["turn_start"] --> Request[["model request"]]
|
|
85
|
+
Request --> ToolDecision{"Tool calls?"}
|
|
86
|
+
ToolDecision -->|yes| Tools[["tool execution"]]
|
|
87
|
+
Tools --> TurnEnd["turn_end"]
|
|
88
|
+
ToolDecision -->|no| TurnEnd
|
|
89
|
+
TurnEnd --> MoreTurns{"Another turn?"}
|
|
90
|
+
MoreTurns -->|yes| TurnStart
|
|
91
|
+
MoreTurns -->|no| AgentEnd(["agent_end"])
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The model request runs these hooks in order:
|
|
95
|
+
|
|
96
|
+
1. `context`
|
|
97
|
+
2. `context_with_system`
|
|
98
|
+
3. `before_provider_headers`
|
|
99
|
+
4. `before_provider_request`
|
|
100
|
+
5. `after_provider_response`
|
|
101
|
+
6. `provider_stream_event` and assistant message events
|
|
102
|
+
|
|
103
|
+
Tool execution runs these hooks in order for each tool call:
|
|
104
|
+
|
|
105
|
+
1. `tool_execution_start`
|
|
106
|
+
2. `tool_call`
|
|
107
|
+
3. `tool_execution_update` while the tool executes
|
|
108
|
+
4. `tool_result`
|
|
109
|
+
5. `tool_execution_end`
|
|
110
|
+
|
|
111
|
+
The lifecycle involves these event groups:
|
|
112
|
+
|
|
113
|
+
| Area | Events |
|
|
114
|
+
|---|---|
|
|
115
|
+
| Input preparation | `input`, `before_agent_start` |
|
|
116
|
+
| Agent run | `agent_start`, `agent_end` |
|
|
117
|
+
| Model turn | `turn_start`, `context`, `context_with_system`, `turn_end` |
|
|
118
|
+
| Provider call | `before_provider_headers`, `before_provider_request`, `after_provider_response`, `provider_stream_event` |
|
|
119
|
+
| Message lifecycle | `message_start`, `message_update`, `message_end` |
|
|
120
|
+
| Tool execution | `tool_execution_start`, `tool_call`, `tool_execution_update`, `tool_result`, `tool_execution_end` |
|
|
121
|
+
| Settlement | `agent_before_settle`, `agent_settled` |
|
|
122
|
+
|
|
123
|
+
Draht counts as busy while a run starts, including the compaction check and `before_agent_start`, so messages sent meanwhile go into the starting run. Message lifecycle events also cover user and tool-result messages; the model request list places only the assistant stream where it occurs in each turn.
|
|
124
|
+
|
|
125
|
+
Tool hooks run for each tool call, and one assistant response can start another turn by returning tool calls. Provider hooks run only when that transport exposes the corresponding stage. See the exported declarations in [`extensions/types.ts`](https://github.com/draht-dev/draht/blob/main/packages/coding-agent/src/core/extensions/types.ts) for exact event payloads and result types.
|
|
126
|
+
|
|
127
|
+
Session startup and replacement follow a separate lifecycle:
|
|
128
|
+
|
|
129
|
+
```mermaid
|
|
130
|
+
flowchart TD
|
|
131
|
+
Startup["Process startup"] --> Trust["project_trust when needed"]
|
|
132
|
+
Trust --> SessionStart["session_start"]
|
|
133
|
+
Switch["/new or /resume"] --> BeforeSwitch["session_before_switch"]
|
|
134
|
+
Fork["/fork or /clone"] --> BeforeFork["session_before_fork"]
|
|
135
|
+
BeforeSwitch --> Shutdown["session_shutdown"]
|
|
136
|
+
BeforeFork --> Shutdown
|
|
137
|
+
Reload["reload"] --> Shutdown
|
|
138
|
+
Shutdown --> Replacing{"Replacing the runtime?"}
|
|
139
|
+
Replacing -->|yes| Replacement["load replacement extension runtime"]
|
|
140
|
+
Replacement --> SessionStart
|
|
141
|
+
Replacing -->|no| Stop["process exits"]
|
|
142
|
+
SessionStart --> Discover["resources_discover"]
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
`project_trust` runs before trusted project resources load and can run again when session replacement enters a new working directory. Retries, recovery, compaction, and queued messages can start another agent run after `agent_end`, so `agent_end` is not a final-idle signal. Reload and session replacement invalidate the old runtime. Code after `await ctx.reload()` still belongs to the old runtime and must not reuse its session-bound state.
|
|
146
|
+
|
|
147
|
+
### Choose an event by intent
|
|
148
|
+
|
|
149
|
+
| Goal | Event |
|
|
150
|
+
|---|---|
|
|
151
|
+
| Inspect, transform, or consume raw user input | `input` |
|
|
152
|
+
| Change prompt sections, active tools, or add context before a run | `before_agent_start` |
|
|
153
|
+
| Observe one low-level agent run | `agent_start`, `agent_end` |
|
|
154
|
+
| Act after one model response and its tool calls | `turn_end` |
|
|
155
|
+
| Filter conversation messages for one provider request | `context` |
|
|
156
|
+
| Transform the complete transcript, including system messages | `context_with_system` |
|
|
157
|
+
| Change request headers or the serialized provider payload | `before_provider_headers`, `before_provider_request` |
|
|
158
|
+
| Observe provider response metadata or parsed stream events | `after_provider_response`, `provider_stream_event` |
|
|
159
|
+
| Authorize or modify a tool call | `tool_call` |
|
|
160
|
+
| Redact, annotate, or replace a tool result | `tool_result` |
|
|
161
|
+
| Append final entries or request one last continuation | `agent_before_settle` |
|
|
162
|
+
| Run notification work after automatic processing has stopped | `agent_settled` |
|
|
163
|
+
| Initialize or release session-scoped resources | `session_start`, `session_shutdown` |
|
|
164
|
+
|
|
64
165
|
<a id="agent_start--agent_end--agent_before_settle--agent_settled"></a>
|
|
65
166
|
|
|
66
|
-
`agent_before_settle`
|
|
67
|
-
`agent_settled` is final and notification-only; use it when an integration needs to know draht will not continue automatically.
|
|
167
|
+
Use `agent_before_settle` when an extension must append entries or request one final continuation. Use `agent_settled` for notification-only work that should run after draht has no automatic continuation remaining.
|
|
68
168
|
|
|
69
169
|
<a id="extensionapi-methods"></a>
|
|
70
170
|
|
|
@@ -104,7 +204,20 @@ Use each event’s declared result type rather than assuming every return value
|
|
|
104
204
|
|
|
105
205
|
Events cover resource discovery, sessions, agent and message lifecycle, providers, tools, and raw input.
|
|
106
206
|
|
|
107
|
-
|
|
207
|
+
#### Understand handler composition
|
|
208
|
+
|
|
209
|
+
| Pattern | Behavior |
|
|
210
|
+
|---|---|
|
|
211
|
+
| Notification | Return values are ignored. Use the event for observation only. |
|
|
212
|
+
| In-place mutation | Later handlers see changes to values such as `before_provider_headers.headers`, `before_agent_start.systemPromptOptions`, and `tool_call.input`. |
|
|
213
|
+
| Chained transformation | Later handlers receive the value returned by earlier `input`, `context`, `context_with_system`, `message_end`, `tool_result`, and `before_provider_request` handlers. |
|
|
214
|
+
| Gate | A handled input, blocked tool call, cancelled session operation, or handled `user_bash` command stops that operation's normal fallback path. |
|
|
215
|
+
| Actionable boundary | Each `turn_end` or `agent_before_settle` handler sees the entries and continuation decision proposed so far. |
|
|
216
|
+
| Last override | The last `cache_warming_decision` handler that returns an action wins. |
|
|
217
|
+
|
|
218
|
+
Notification handlers should not perform slow work on a streaming event. Transform handlers should preserve fields they do not intentionally own, and gate handlers should fail closed when their safety decision cannot be made.
|
|
219
|
+
|
|
220
|
+
`before_agent_start` exposes both the current prompt and its structured `systemPromptOptions`. `event.messageType` says what started the run: `"user"` for a prompt or `pi.sendUserMessage()`, with `prompt` and `images`; `"custom"` for `pi.sendMessage(..., { triggerTurn: true })`, with the starting `message` and no `prompt`. A returned `message` is added to either kind of run; check `messageType` to skip runs started by custom messages. Prefer changing prompt sections, selected tools, or guidelines so draht can append a transcript delta. Returning `systemPrompt`, or setting `forceSystemPrompt`, replaces the whole prompt for that run while the transcript continues recording the structured sections. Providers receive the forced text as their leading system prompt.
|
|
108
221
|
|
|
109
222
|
`message_end` can replace a finalized message while preserving its role. `tool_call` can mutate input or block execution. `tool_result` handlers compose, with each handler seeing prior changes.
|
|
110
223
|
|
|
@@ -163,9 +276,9 @@ See [`hello.ts`](../examples/extensions/hello.ts), [`todo.ts`](../examples/exten
|
|
|
163
276
|
- `deferred`: like `codemode`, but codemode tools do not list it; `tool_search` can find and activate it.
|
|
164
277
|
- `hidden`: registered but unreachable. Re-register a tool with `exposure: "hidden"` to withdraw it, since tools cannot be unregistered.
|
|
165
278
|
|
|
166
|
-
`namespace: { name, description, instructions }` groups related tools, as MCP servers do. Codemode tools list a namespace under one heading with its `description`. `instructions` holds longer usage guidance; it is not listed, and codemode scripts read it with `describeNamespace(name)`.
|
|
279
|
+
`namespace: { name, aliases, description, instructions }` groups related tools, as MCP servers do. Codemode tools list a namespace under one heading with its `description`. `instructions` holds longer usage guidance; it is not listed, and codemode scripts read it with `describeNamespace(name)`. `aliases` are other names scripts may look the namespace up by, for example the server name `docs` for `mcp__docs`; a name and the same name as a script identifier (`my-docs`, `my_docs`) match alike.
|
|
167
280
|
|
|
168
|
-
Registering a `direct` or `model-only` tool activates it; the other exposures are not activated on registration. The active set (`pi.getActiveTools()`, `pi.setActiveTools()`) is the set of tools declared to the model. `pi.getAllTools()` reports each tool's `exposure`, `namespace`, and `
|
|
281
|
+
Registering a `direct` or `model-only` tool activates it; the other exposures are not activated on registration. The active set (`pi.getActiveTools()`, `pi.setActiveTools()`) is the set of tools declared to the model. `pi.getAllTools()` reports each tool's `exposure`, `namespace`, `annotations`, and `reachesTools`.
|
|
169
282
|
|
|
170
283
|
`annotations` are hints about what a tool does, with the meaning of MCP tool annotations: `readOnlyHint`, `destructiveHint`, `idempotentHint`, and `openWorldHint`. MCP tools carry the hints their server declares. Missing hints take the MCP defaults: a tool is not read-only, and may be destructive and reach an open world. The hints are not verified, but a permission extension can use them to decide which calls to confirm. This confirms the calls Codex asks approval for:
|
|
171
284
|
|
|
@@ -181,7 +294,9 @@ pi.on("tool_call", async (event, ctx) => {
|
|
|
181
294
|
});
|
|
182
295
|
```
|
|
183
296
|
|
|
184
|
-
A tool that orchestrates other tools can adjust what the model sees while it is active with `prepareLoadout(loadout)`. It runs whenever the active tools change and receives the declared tools, the callable tools, and every registered tool with its exposure and
|
|
297
|
+
A tool that orchestrates other tools can adjust what the model sees while it is active with `prepareLoadout(loadout)`. It runs whenever the active tools change and receives the declared tools, the callable tools, and every registered tool with its exposure, namespace, and prompt guidelines. It returns replacement `descriptions` for declared tools (including its own) and `hiddenDeclarations`: active tools whose declarations requests leave out while they stay active and callable. The default system prompt leaves hidden tools out of its tool list and rules, and names no tool in the skills hint when the file reader is hidden, so the orchestrating tool should present their guidelines itself. `codemode` uses only this hook, `exposure`, `reachesTools`, and `ctx.executeTool()`, so another tool can implement the same behavior under a different name.
|
|
298
|
+
|
|
299
|
+
A tool that reaches other tools declares which ones a call may reach with `reachesTools(input)`: `"all"`, or the words of the input that may name them, where a word refers to every tool or namespace whose name it contains. `codemode` returns `"all"` for scripts that search or list tools and the words of the script otherwise; `tool_search` always returns `"all"`. Extensions that register tools late use it from their `tool_call` handler to finish registering the tools a call needs before it runs, as the MCP extension does for servers that are still connecting. The MCP extension also activates `codemode` or `tool_search` for MCP tools only when the tool of that name declares `reachesTools`.
|
|
185
300
|
|
|
186
301
|
### Activate tools dynamically
|
|
187
302
|
|
|
@@ -195,6 +310,10 @@ draht snapshots the working tree per session so `/rewind` can restore conversati
|
|
|
195
310
|
|
|
196
311
|
`checkpoint_created` fires after every capture. `session_before_rewind` reports the target entry and scope (`conversation-and-files`, `conversation-only`, or `files-only`) and can return `{ cancel: true }`. Retention is configured in [Settings](settings.md).
|
|
197
312
|
|
|
313
|
+
### Tool rendering
|
|
314
|
+
|
|
315
|
+
A tool's `renderCall` and `renderResult` draw its calls in the interactive transcript and in HTML exports. `draht.registerToolRenderer((toolName, next) => renderers)` chooses renderers for calls to any tool, including tools that are not registered yet, such as MCP tools in a resumed session before their server connected. `next()` returns what the remaining resolvers (in extension load order), then the registered tool, would use, so `next() ?? mine` only fills in.
|
|
316
|
+
|
|
198
317
|
### MCP servers
|
|
199
318
|
|
|
200
319
|
`pi.registerMcpServer(name, config)` adds an MCP server for the current session. `config` has the shape of an `mcpServers` entry in [`mcp.json`](mcp.md): `command`, `args`, `env`, and `cwd` for stdio servers, `url`, `headers`, and `oauth` for HTTP servers, plus `exposure`, `toolExposure`, `description`, `enabled`, and `timeout`.
|
|
@@ -274,7 +393,18 @@ Use `ctx.shutdown()` to request an orderly process shutdown.
|
|
|
274
393
|
|
|
275
394
|
## Examples and reference
|
|
276
395
|
|
|
277
|
-
The checked [extension examples](../examples/extensions/)
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
396
|
+
The checked [extension examples](../examples/extensions/) are the implementation reference. Start with the smallest example matching the behavior you need:
|
|
397
|
+
|
|
398
|
+
| Goal | Start with | Why |
|
|
399
|
+
|---|---|---|
|
|
400
|
+
| Confirm or block tool calls | [`permission-gate.ts`](../examples/extensions/permission-gate.ts) | Combines `tool_call`, mode-aware UI, and fail-closed behavior. |
|
|
401
|
+
| Modify prompt sections for a run | [`prompt-customizer.ts`](../examples/extensions/prompt-customizer.ts) | Uses structured prompt options instead of replacing the complete prompt. |
|
|
402
|
+
| Keep branch-aware tool state | [`todo.ts`](../examples/extensions/todo.ts) | Reconstructs state from persisted entries and renders it in the TUI. |
|
|
403
|
+
| Register tools after startup | [`dynamic-tools.ts`](../examples/extensions/dynamic-tools.ts) | Shares registration logic between lifecycle and command handlers. |
|
|
404
|
+
| Run cancellable model work from a command | [`qna.ts`](../examples/extensions/qna.ts) | Combines nested model calls, cancellation, and custom UI. |
|
|
405
|
+
| Replace the main editor | [`modal-editor.ts`](../examples/extensions/modal-editor.ts) | Extends `CustomEditor` while preserving application controls. |
|
|
406
|
+
| Run finalization at shutdown | [`auto-commit-on-exit.ts`](../examples/extensions/auto-commit-on-exit.ts) | Uses the session shutdown hook for finalization work. |
|
|
407
|
+
| Route built-in tools to another machine | [`ssh.ts`](../examples/extensions/ssh.ts) | Reuses tool operation interfaces instead of recreating tool contracts. |
|
|
408
|
+
| Add OAuth and provider-specific streaming | [`custom-provider-gitlab-duo/`](../examples/extensions/custom-provider-gitlab-duo/) | Shows a complete provider integration while delegating supported protocols. |
|
|
409
|
+
|
|
410
|
+
Use [Custom Providers](custom-provider.md) for model-service integrations, [Terminal UI](tui.md) for custom components, and [draht Packages](packages.md) to install or distribute extensions with other resources. Use the exported declarations for exact signatures, payloads, and result schemas; this guide focuses on lifecycle choices, composition, and durable implementation patterns.
|
package/docs/index.md
CHANGED
|
@@ -31,7 +31,7 @@ Use the [Quickstart customization chooser](quickstart.md#choose-how-to-customize
|
|
|
31
31
|
|
|
32
32
|
## Find reference and setup information
|
|
33
33
|
|
|
34
|
-
Use the reference pages to look up [CLI options](cli.md), [settings](settings.md), [
|
|
34
|
+
Use the reference pages to look up [CLI options](cli.md), [settings](settings.md), [providers](providers.md), [keybindings](keybindings.md), and [environment variables](environment-variables.md).
|
|
35
35
|
|
|
36
36
|
For platform-specific help, see [Terminal Setup](terminal-setup.md), [Windows](windows.md), [tmux](tmux.md), [Termux on Android](termux.md), or [Containerization](containerization.md).
|
|
37
37
|
|
package/docs/json.md
CHANGED
|
@@ -42,7 +42,7 @@ A basic run produces records like these:
|
|
|
42
42
|
{"type":"message_end","message":{"role":"assistant","...":"..."}}
|
|
43
43
|
{"type":"turn_end","message":{"role":"assistant","...":"..."},"toolResults":[]}
|
|
44
44
|
{"type":"agent_end","messages":[{"...":"..."}],"willRetry":false}
|
|
45
|
-
{"type":"agent_settled"}
|
|
45
|
+
{"type":"agent_settled","aborted":false}
|
|
46
46
|
```
|
|
47
47
|
|
|
48
48
|
`agent_end` closes one low-level agent run. Automatic retry, overflow recovery, compaction retry, steering, or follow-up work can still continue. `agent_settled` means draht has no remaining automatic work for that session-level run.
|
|
@@ -53,7 +53,7 @@ A basic run produces records like these:
|
|
|
53
53
|
|---|---|---|
|
|
54
54
|
| `agent_start` | None | A low-level agent run started. |
|
|
55
55
|
| `agent_end` | `messages`, `willRetry` | That low-level run ended. `messages` contains messages generated by the run. |
|
|
56
|
-
| `agent_settled` |
|
|
56
|
+
| `agent_settled` | `aborted` | draht will not continue automatically through retries, compaction recovery, or queued messages. `aborted` is `true` when the run ended because it was aborted. |
|
|
57
57
|
| `turn_start` | None | One assistant turn started. |
|
|
58
58
|
| `turn_end` | `message`, `toolResults` | One assistant response and its resulting tool calls finished. |
|
|
59
59
|
|
|
@@ -104,7 +104,7 @@ The top-level `usage` is the latest cumulative provider-reported usage for the a
|
|
|
104
104
|
|---|---|---|
|
|
105
105
|
| `tool_execution_start` | `toolCallId`, `toolName`, `args` | Tool execution started. |
|
|
106
106
|
| `tool_execution_update` | `toolCallId`, `toolName`, `args`, `partialResult` | The tool reported a partial result. |
|
|
107
|
-
| `tool_execution_end` | `toolCallId`, `toolName`, `result`, `isError` | Tool execution finished. |
|
|
107
|
+
| `tool_execution_end` | `toolCallId`, `toolName`, `result`, `isError`, `durationMs` | Tool execution finished. `durationMs` is how long the tool's `execute()` took, measured with a monotonic clock; absent when the tool did not run. |
|
|
108
108
|
|
|
109
109
|
Use `toolCallId` to correlate the lifecycle. `partialResult` is the latest partial result supplied by the tool. Whether it replaces or extends an earlier update depends on that tool's result contract.
|
|
110
110
|
|
package/docs/keybindings.md
CHANGED
|
@@ -12,6 +12,7 @@ Map each action identifier to one key or a list of keys:
|
|
|
12
12
|
|
|
13
13
|
```json
|
|
14
14
|
{
|
|
15
|
+
"$schema": "https://raw.githubusercontent.com/draht-dev/draht/main/packages/coding-agent/schemas/keybindings.schema.json",
|
|
15
16
|
"app.session.new": "ctrl+shift+n",
|
|
16
17
|
"app.session.tree": ["ctrl+shift+t", "alt+shift+t"]
|
|
17
18
|
}
|
|
@@ -59,8 +60,8 @@ On macOS, `alt` with a letter, such as `alt+m`, requires a terminal that sends O
|
|
|
59
60
|
| `tui.editor.cursorRight` | `right`, `ctrl+f` | Move cursor right |
|
|
60
61
|
| `tui.editor.cursorWordLeft` | `alt+left`, `ctrl+left`, `alt+b` | Move cursor word left |
|
|
61
62
|
| `tui.editor.cursorWordRight` | `alt+right`, `ctrl+right`, `alt+f` | Move cursor word right |
|
|
62
|
-
| `tui.editor.cursorLineStart` | `home`, `ctrl+
|
|
63
|
-
| `tui.editor.cursorLineEnd` | `end`, `ctrl+
|
|
63
|
+
| `tui.editor.cursorLineStart` | `home`, `ctrl+a` | Move to line start |
|
|
64
|
+
| `tui.editor.cursorLineEnd` | `end`, `ctrl+e` | Move to line end |
|
|
64
65
|
| `tui.editor.jumpForward` | `ctrl+]` | Jump forward to character |
|
|
65
66
|
| `tui.editor.jumpBackward` | `ctrl+alt+]` | Jump backward to character |
|
|
66
67
|
| `tui.editor.pageUp` | `pageUp`, `ctrl+pageUp` | Scroll up by page |
|
|
@@ -115,8 +116,8 @@ In fullscreen mode, these actions control the transcript and take precedence ove
|
|
|
115
116
|
| `tui.altScreen.searchNext` | `enter`, `ctrl+g` | Select the next search match while searching |
|
|
116
117
|
| `tui.altScreen.searchPrevious` | `shift+enter`, `ctrl+shift+g` | Select the previous search match while searching |
|
|
117
118
|
| `tui.altScreen.searchClose` | `escape` | Close transcript search |
|
|
118
|
-
| `tui.altScreen.top` | `home` | Scroll to the beginning of the transcript |
|
|
119
|
-
| `tui.altScreen.bottom` | `end` | Scroll to the transcript end and follow new output |
|
|
119
|
+
| `tui.altScreen.top` | `ctrl+home` | Scroll to the beginning of the transcript |
|
|
120
|
+
| `tui.altScreen.bottom` | `ctrl+end` | Scroll to the transcript end and follow new output |
|
|
120
121
|
|
|
121
122
|
### Application
|
|
122
123
|
|
|
@@ -128,9 +129,12 @@ In fullscreen mode, these actions control the transcript and take precedence ove
|
|
|
128
129
|
| `app.suspend` | `ctrl+z` (None on Windows) | Suspend to background |
|
|
129
130
|
| `app.editor.external` | `ctrl+g` | Open in external editor (`externalEditor`, `$VISUAL`, `$EDITOR`, Notepad on Windows, or `nano` elsewhere) |
|
|
130
131
|
| `app.clipboard.pasteImage` | `ctrl+v` (`alt+v` on Windows and WSL) | Paste files on macOS, images, or text from clipboard |
|
|
132
|
+
| `app.login.copyUrl` | `ctrl+x` | Copy the complete login URL while `/login` is open |
|
|
131
133
|
|
|
132
134
|
On native Windows, `app.suspend` has no default because Windows terminals do not support Unix job control. If you assign it manually, draht shows a status message instead of suspending. WSL uses the normal `ctrl+z` and `fg` behavior.
|
|
133
135
|
|
|
136
|
+
During `/login`, `app.login.copyUrl` copies the original URL without the line breaks shown on screen. Over SSH, this requires a local terminal that allows OSC 52 clipboard writes.
|
|
137
|
+
|
|
134
138
|
### Sessions
|
|
135
139
|
|
|
136
140
|
| Keybinding id | Default | Description |
|
|
@@ -166,7 +170,7 @@ On native Windows, `app.suspend` has no default because Windows terminals do not
|
|
|
166
170
|
| Keybinding id | Default | Description |
|
|
167
171
|
|--------|---------|-------------|
|
|
168
172
|
| `app.tools.expand` | `ctrl+o` | Collapse or expand tool output |
|
|
169
|
-
| `app.message.copy` | `ctrl+x` | Copy the selected message in `/tree`; in fullscreen mode, copy the active selection when `fullscreenCopyOnSelect` is `false`; otherwise copy the last assistant message |
|
|
173
|
+
| `app.message.copy` | `ctrl+x` | Copy the selected message in `/tree`; in fullscreen mode, copy the active selection when `fullscreenCopyOnSelect` is `false`; otherwise copy the last assistant message. On OAuth sign-in screens, copy the sign-in URL |
|
|
170
174
|
| `app.message.followUp` | `alt+enter` (`ctrl+q` on Windows and WSL) | Queue follow-up message |
|
|
171
175
|
| `app.message.dequeue` | `alt+up` (`alt+q` on Windows and WSL) | Restore queued messages to editor |
|
|
172
176
|
| `app.polyphase.inspector` | `alt+a` | Open or close the agent inspector |
|
package/docs/llama-cpp.md
CHANGED
|
@@ -41,7 +41,7 @@ A single-file model can sit directly in the model directory. Put multimodal and
|
|
|
41
41
|
└── large-model-Q4_K_M-00003-of-00003.gguf
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
Restart the router after manually adding files. For per-model context sizes and other options, use [llama.cpp model presets](https://github.com/ggml-org/llama.cpp/blob/master/tools/server/README.md#model-presets).
|
|
44
|
+
Restart the router after manually adding files. For per-model context sizes and other options, use [llama.cpp model presets](https://github.com/ggml-org/llama.cpp/blob/master/tools/server/README.md#model-presets). For settings tuned to a specific NVIDIA GPU and model, see [Run draht with NVIDIA RTX and llama.cpp](nvidia-rtx-llama-cpp.md).
|
|
45
45
|
|
|
46
46
|
## Configure draht
|
|
47
47
|
|
|
@@ -88,7 +88,14 @@ If the router disconnects, `/llama` shows **Retry** and **Close**. Retry reconne
|
|
|
88
88
|
|
|
89
89
|
## Classification
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
Classifier models answer typed `choice`, `bool`, and `score` questions about JSON state, like TypeSafe's Jev models. The model reaches them from [`codemode`](cli.md#enable-codemode) scripts, and extensions through `ctx.modelRegistry.classify()`; see [Classifier models](models.md#use-classifier-models). draht lists llama.cpp models as classifiers in two ways:
|
|
92
|
+
|
|
93
|
+
- **Decision models** such as [Julia-1, Laya, Kev, lev, and OpenJev](https://huggingface.co/collections/ggml-org/decision-models-6abf80cca3c83f127060a769) answer natively through llama.cpp's `/v1/systemone` endpoint. They appear only as classifiers, with the `typesafe-system-one` API, and not in `/model`.
|
|
94
|
+
- **Chat models** are also listed as classifiers with the same ID and the `llama-cpp-classify` API, which reads answers from next-token probabilities as described below.
|
|
95
|
+
|
|
96
|
+
llama.cpp 0.6.0 and later report decision models in the router's model list: their `architecture.output_modalities` contains `decisions`. The router reads this from the GGUF metadata without loading the model, so draht recognizes unloaded and sleeping decision models too. Older llama.cpp builds do not report it, and draht lists their decision models as chat models.
|
|
97
|
+
|
|
98
|
+
### Chat models as classifiers
|
|
92
99
|
|
|
93
100
|
The model does not generate an answer. Each question becomes one chat prompt: the state, every question of the request, the state again, and then the question with its answers under single-token labels. Labels are letters for a choice (up to 62 options), `Yes`/`No` for a bool, and digits for a score (up to 10 levels). The second copy of the state is read with the questions in view, which improved accuracy on JevBench with small models. draht reads the probabilities of the labels as the next token and normalizes them. A choice returns every option's probability and a confidence of `(n * peak - 1) / (n - 1)`; a score returns the expected level.
|
|
94
101
|
|
package/docs/mcp.md
CHANGED
|
@@ -31,6 +31,16 @@ Use `/mcp` inside an interactive session to inspect connections, sign in, reconn
|
|
|
31
31
|
|
|
32
32
|
draht reads user-level servers from `~/.draht/agent/mcp.json` and project servers from `.draht/mcp.json`. Project configuration is read only after [project trust](security.md#understand-project-trust) is granted. A project entry replaces a user-level entry with the same name.
|
|
33
33
|
|
|
34
|
+
A project entry without `command`, `url`, or `type` overrides only `enabled`, `exposure`, and `toolExposure` of the user-level server with the same name and keeps the rest, including `env`, `headers`, and `auth`. For example, this turns off a user-level server in one project:
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"mcpServers": {
|
|
39
|
+
"internal-tools": { "enabled": false }
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
34
44
|
The format matches other MCP clients:
|
|
35
45
|
|
|
36
46
|
```json
|
|
@@ -77,7 +87,7 @@ Keep personal servers and servers with credentials in the user-level file. Use t
|
|
|
77
87
|
|
|
78
88
|
`/mcp` lists configured servers with their state, tool count, exposure, and configuration source. Servers that need attention appear first. Select a server to inspect its tools and connection details, reconnect, sign in or out, change exposure, or enable and disable it.
|
|
79
89
|
|
|
80
|
-
Exposure and enabled-state changes are saved to the file that defines the server without replacing unrelated content. Disabled servers remain listed. Outside the interactive TUI, `/mcp` prints server status; `/mcp login <server>`, `/mcp logout <server>`, and `/mcp reconnect <server>` perform those actions directly.
|
|
90
|
+
Exposure and enabled-state changes are saved to the file that defines the server without replacing unrelated content. In a trusted project, "Enable in this project" and "Disable in this project" add a project override for a user-level server; later changes to that server are saved to the override. Disabled servers remain listed. Outside the interactive TUI, `/mcp` prints server status; `/mcp login <server>`, `/mcp logout <server>`, and `/mcp reconnect <server>` perform those actions directly.
|
|
81
91
|
|
|
82
92
|
Shell commands work without a session: `draht mcp add`, `draht mcp remove`, `draht mcp list`, `draht mcp login`, and `draht mcp logout`. Shell commands do not load extensions.
|
|
83
93
|
|
|
@@ -118,6 +128,8 @@ When the server rejects an unauthenticated connection, `/mcp` shows that it need
|
|
|
118
128
|
|
|
119
129
|
draht registers itself with the authorization server, stores tokens in `~/.draht/agent/mcp-auth.json`, and refreshes access tokens when they expire or the server rejects them. If a server later requests additional scope, draht asks for sign-in again. Signing out deletes the stored credentials.
|
|
120
130
|
|
|
131
|
+
Credentials belong to a server name and URL. Servers with the same URL under different names, such as one per account, sign in separately; servers with the same name and URL in different `mcp.json` files share one sign-in.
|
|
132
|
+
|
|
121
133
|
OAuth applies to HTTP servers without an `Authorization` header. For a server that does not support dynamic client registration, configure a registered client:
|
|
122
134
|
|
|
123
135
|
```json
|
|
@@ -147,6 +159,48 @@ draht registers as `draht`. Some servers only accept registrations from known cl
|
|
|
147
159
|
|
|
148
160
|
The name is only sent when draht registers a client. To register again under a new name, sign out first.
|
|
149
161
|
|
|
162
|
+
Some authorization servers accept a Client ID Metadata Document URL instead of dynamic registration. To opt in, set `clientRegistration` to `cimd` and supply `clientMetadataBaseUrl`. There is no default metadata service. The following URL is illustrative; replace it with an HTTPS service you operate:
|
|
163
|
+
|
|
164
|
+
```json
|
|
165
|
+
{
|
|
166
|
+
"mcpServers": {
|
|
167
|
+
"example": {
|
|
168
|
+
"url": "https://mcp.example.com/mcp",
|
|
169
|
+
"oauth": {
|
|
170
|
+
"clientRegistration": "cimd",
|
|
171
|
+
"clientMetadataBaseUrl": "https://example.com/team/oauth/"
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
The base must be an absolute HTTPS URL without userinfo, query, or fragment. A trailing slash is normalized; the path prefix is preserved. The operator must actually host JSON metadata under that base:
|
|
179
|
+
|
|
180
|
+
- `client.json`, whose `client_id` is its complete URL and whose `redirect_uris` includes `http://127.0.0.1/callback` (or `http://localhost/callback` when configured).
|
|
181
|
+
- `<id>/client.json`, whose `client_id` is its complete URL and whose `redirect_uris` uses the matching `/callback/<id>` path. The ID is the first 9 bytes of SHA-256 of the normalized MCP server URL with its fragment removed, encoded as unpadded base64url. A service can generate these documents for each requested ID.
|
|
182
|
+
|
|
183
|
+
The documents must describe a public client (`token_endpoint_auth_method: "none"`) with authorization-code and refresh-token grants and the `code` response type. Authorization servers must accept the dynamically chosen loopback port as specified by RFC 8252, or the documents must list the exact configured port. Each document's identity and redirect paths must match the URLs draht sends; draht does not publish these documents for you.
|
|
184
|
+
|
|
185
|
+
When the authorization server supports the `iss` parameter (RFC 9207), draht uses `client.json` and checks the returned issuer. Otherwise it uses the server-specific document and callback path to prevent authorization-server mix-ups. Browser callbacks and pasted redirect URLs must match the chosen callback origin and path. The server must advertise metadata-document support and public-client authentication, or sign-in fails. CIMD cannot be combined with `clientId`, `clientName`, or `clientSecret`; `callbackUrl` must use `localhost` or `127.0.0.1` with path `/callback`.
|
|
186
|
+
|
|
187
|
+
Without `clientRegistration`, or with `"dcr"`, dynamic registration remains the default. `clientMetadataBaseUrl` is rejected outside CIMD mode. Switching between DCR and CIMD or changing the metadata base requires a new sign-in: cached tokens are bound to the issuing client document and are never sent or refreshed under another client. Existing DCR credentials remain valid.
|
|
188
|
+
|
|
189
|
+
draht finds the authorization server through the server's protected resource metadata (RFC 9728) and checks that the authorization server's metadata names the expected issuer (RFC 8414). Some servers advertise the wrong authorization server or none, so sign-in opens a page that does not exist. Set `authServerMetadataUrl` to the metadata document of the right authorization server:
|
|
190
|
+
|
|
191
|
+
```json
|
|
192
|
+
{
|
|
193
|
+
"mcpServers": {
|
|
194
|
+
"example": {
|
|
195
|
+
"url": "https://mcp.example.com/mcp",
|
|
196
|
+
"oauth": { "authServerMetadataUrl": "https://example.okta.com/.well-known/openid-configuration" }
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
draht uses that document instead of discovery and trusts it as configured, so only point it at a document you trust. The URL must use HTTPS, except on `localhost`, `127.0.0.1`, or `[::1]`.
|
|
203
|
+
|
|
150
204
|
## Control tool exposure
|
|
151
205
|
|
|
152
206
|
Each server tool is registered as `mcp__<server>__<tool>`. The server's `exposure` determines how the model reaches it:
|
|
@@ -186,6 +240,8 @@ draht activates `codemode` when a server with `codemode` exposure connects. It a
|
|
|
186
240
|
|
|
187
241
|
Tools with `codemode` or `deferred` exposure can be reached through either indirect mechanism: codemode scripts can call them, and `tool_search` can load them. Codemode calls do not depend on the active tool set, so they remain available after `/tree`, resume, and fork. Tools loaded by `tool_search` are recorded in the transcript and remain declared on that branch.
|
|
188
242
|
|
|
243
|
+
`--tools` does not remove MCP tools unless one of its entries starts with `mcp__`; `draht --tools read,codemode,'mcp__radius__*'` keeps only the tools of `radius`. `--exclude-tools` accepts the same patterns, and `--no-mcp` disables MCP for one run (see [Tools](cli.md#mcp-tools)).
|
|
244
|
+
|
|
189
245
|
To keep `codemode` active without MCP servers, add `"defaultTools": ["+codemode"]` to [settings](settings.md#tools). To prevent automatic codemode activation, set `"autoEnableCodemode": false` beside `mcpServers`. A project value overrides the user-level value. draht warns once when neither `codemode` nor `tool_search` is active and non-direct tools cannot be called.
|
|
190
246
|
|
|
191
247
|
Text results over 20 KB reach the model with their middle removed around a `…N chars truncated…` marker. The full text is saved to a temporary file named in the result. Codemode scripts receive the complete result and can reduce it before returning output to the model.
|
|
@@ -222,9 +278,9 @@ Changes to enabled state or exposure apply only to the current session. A file-c
|
|
|
222
278
|
|
|
223
279
|
### Replace the built-in MCP support
|
|
224
280
|
|
|
225
|
-
An installed extension that registers `/mcp`, such as `pi-mcp-adapter`, replaces the built-in MCP support for sessions. draht then does not read `mcp.json` or connect its servers in a session, and `/mcp` belongs to the extension. Remove the extension to restore the built-in behavior. To disable built-in MCP support without a replacement, disable `mcp` under Built-in in `draht config`, or set `"extensions": ["-builtin:mcp"]` in [settings](settings.md#resources).
|
|
281
|
+
An installed extension that registers `/mcp`, such as `pi-mcp-adapter`, replaces the built-in MCP support for sessions. draht then does not read `mcp.json` or connect its servers in a session, and `/mcp` belongs to the extension. Remove the extension to restore the built-in behavior. To disable built-in MCP support without a replacement, disable `mcp` under Built-in in `draht config`, or set `"extensions": ["-builtin:mcp"]` in [settings](settings.md#resources). `--no-mcp` disables it for one run.
|
|
226
282
|
|
|
227
|
-
An extension that registers `codemode` or `tool_search` similarly replaces the built-in tool with that name. Shell-level `draht mcp` commands always use the built-in implementation.
|
|
283
|
+
An extension that registers `codemode` or `tool_search` similarly replaces the built-in tool with that name. draht activates the replacement for MCP servers and waits for the servers its calls need only when it declares [`reachesTools`](extensions.md#tool-exposure). Shell-level `draht mcp` commands always use the built-in implementation.
|
|
228
284
|
|
|
229
285
|
### Use MCP from the SDK
|
|
230
286
|
|
package/docs/message-types.md
CHANGED
|
@@ -100,12 +100,11 @@ interface SystemMessage {
|
|
|
100
100
|
sections?: Record<string, string | null>;
|
|
101
101
|
toolsAdded?: Tool[];
|
|
102
102
|
toolsRemoved?: ToolReference[];
|
|
103
|
-
replace?: boolean;
|
|
104
103
|
timestamp: number;
|
|
105
104
|
}
|
|
106
105
|
```
|
|
107
106
|
|
|
108
|
-
The leading system message declares the initial prompt and tools. Later system messages can append instructions, replace or remove named prompt sections, and add or remove tools. Replaying them in order yields the current state.
|
|
107
|
+
The leading system message declares the initial prompt and tools. Later system messages can append instructions, replace or remove named prompt sections, and add or remove tools. Replaying them in order yields the current state.
|
|
109
108
|
|
|
110
109
|
### UserMessage
|
|
111
110
|
|
|
@@ -129,6 +128,7 @@ interface AssistantMessage {
|
|
|
129
128
|
responseModel?: string;
|
|
130
129
|
responseId?: string;
|
|
131
130
|
providerThinkingLevel?: string;
|
|
131
|
+
thinkingLevel?: ModelThinkingLevel;
|
|
132
132
|
diagnostics?: AssistantMessageDiagnostic[];
|
|
133
133
|
usage: Usage;
|
|
134
134
|
stopReason: "pending" | "stop" | "length" | "toolUse" | "error" | "aborted" | "deferred";
|
|
@@ -140,7 +140,7 @@ interface AssistantMessage {
|
|
|
140
140
|
}
|
|
141
141
|
```
|
|
142
142
|
|
|
143
|
-
`responseModel` records a concrete provider response model when it differs from the requested model. `responseId`, `providerThinkingLevel`, `diagnostics`, and `rawStopReason` preserve provider or runtime details.
|
|
143
|
+
`responseModel` records a concrete provider response model when it differs from the requested model. `responseId`, `providerThinkingLevel`, `thinkingLevel`, `diagnostics`, and `rawStopReason` preserve provider or runtime details.
|
|
144
144
|
|
|
145
145
|
`"pending"` is used for a partial assistant message while it streams. The completed message in `message_end` has a terminal stop reason, and draht does not persist `"pending"` assistant messages in session JSONL.
|
|
146
146
|
|
|
@@ -168,12 +168,30 @@ interface ToolResultMessage<TDetails = any> {
|
|
|
168
168
|
content: (TextContent | ImageContent)[];
|
|
169
169
|
details?: TDetails;
|
|
170
170
|
usage?: Usage;
|
|
171
|
+
nestedCalls?: NestedToolCalls;
|
|
171
172
|
isError: boolean;
|
|
172
173
|
timestamp: number;
|
|
173
174
|
}
|
|
174
175
|
```
|
|
175
176
|
|
|
176
|
-
`details` is tool-specific. Optional `usage` reports nested model work performed by the tool and contributes to full-session statistics, but it is not part of the main model-call usage.
|
|
177
|
+
`details` is tool-specific. Optional `usage` reports nested model work performed by the tool and contributes to full-session statistics, but it is not part of the main model-call usage. `nestedCalls` records bounded metadata about calls this tool made to other tools:
|
|
178
|
+
|
|
179
|
+
```typescript
|
|
180
|
+
interface NestedToolCalls {
|
|
181
|
+
calls: NestedToolCallRecord[];
|
|
182
|
+
complete: boolean;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
interface NestedToolCallRecord {
|
|
186
|
+
id: string;
|
|
187
|
+
name: string;
|
|
188
|
+
arguments?: JsonObject;
|
|
189
|
+
argumentsBytes?: number;
|
|
190
|
+
status: "ok" | "error" | "unfinished";
|
|
191
|
+
durationMs?: number;
|
|
192
|
+
error?: string;
|
|
193
|
+
}
|
|
194
|
+
```
|
|
177
195
|
|
|
178
196
|
## Coding-agent messages
|
|
179
197
|
|