@draht/coding-agent 2026.7.13 → 2026.9.5-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 +241 -0
- package/README.md +47 -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.js +2 -0
- package/dist/bun/cli.js.map +1 -1
- package/dist/cli/args.d.ts +10 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +80 -3
- 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/config-selector.js +1 -1
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/credential-print.d.ts +23 -0
- package/dist/cli/credential-print.d.ts.map +1 -0
- package/dist/cli/credential-print.js +117 -0
- package/dist/cli/credential-print.js.map +1 -0
- package/dist/cli/list-models.d.ts +2 -2
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +3 -3
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli/startup-ui.js +1 -1
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/config.d.ts +9 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +31 -4
- 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 +90 -30
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +4 -7
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +24 -9
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +87 -27
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +337 -154
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +20 -104
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +104 -260
- package/dist/core/auth-storage.js.map +1 -1
- 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 +2 -2
- package/dist/core/cache-stats.d.ts.map +1 -1
- package/dist/core/cache-stats.js +1 -1
- package/dist/core/cache-stats.js.map +1 -1
- 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 +294 -0
- package/dist/core/checkpoints/checkpoint-manager.d.ts.map +1 -0
- package/dist/core/checkpoints/checkpoint-manager.js +865 -0
- package/dist/core/checkpoints/checkpoint-manager.js.map +1 -0
- package/dist/core/checkpoints/rewind.d.ts +141 -0
- package/dist/core/checkpoints/rewind.d.ts.map +1 -0
- package/dist/core/checkpoints/rewind.js +246 -0
- package/dist/core/checkpoints/rewind.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts +9 -3
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +16 -14
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +24 -3
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +96 -30
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/utils.d.ts +1 -1
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js +6 -17
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/context-windows.d.ts +7 -0
- package/dist/core/context-windows.d.ts.map +1 -0
- package/dist/core/context-windows.js +35 -0
- package/dist/core/context-windows.js.map +1 -0
- 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 +101 -23
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +19 -3
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +117 -2
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +236 -9
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/extensions/wrapper.d.ts.map +1 -1
- package/dist/core/extensions/wrapper.js +22 -3
- package/dist/core/extensions/wrapper.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts +10 -0
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +1 -1
- 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 +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/keybindings.d.ts +18 -3
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +12 -3
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/model-config.d.ts +542 -0
- package/dist/core/model-config.d.ts.map +1 -0
- package/dist/core/model-config.js +247 -0
- package/dist/core/model-config.js.map +1 -0
- package/dist/core/model-registry.d.ts +19 -124
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +56 -727
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts +7 -6
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +74 -27
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts +89 -0
- package/dist/core/model-runtime.d.ts.map +1 -0
- package/dist/core/model-runtime.js +451 -0
- package/dist/core/model-runtime.js.map +1 -0
- package/dist/core/models-store.d.ts +17 -0
- package/dist/core/models-store.d.ts.map +1 -0
- package/dist/core/models-store.js +46 -0
- package/dist/core/models-store.js.map +1 -0
- package/dist/core/multi-agent/permission-gate.d.ts.map +1 -1
- package/dist/core/multi-agent/permission-gate.js +4 -3
- package/dist/core/multi-agent/permission-gate.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 +2 -2
- package/dist/core/multi-agent/worktree.js.map +1 -1
- package/dist/core/package-manager.d.ts +7 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +41 -45
- 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 +35 -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 +1 -0
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +4 -4
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/provider-composer.d.ts +55 -0
- package/dist/core/provider-composer.d.ts.map +1 -0
- package/dist/core/provider-composer.js +375 -0
- package/dist/core/provider-composer.js.map +1 -0
- package/dist/core/radius.d.ts +2 -0
- package/dist/core/radius.d.ts.map +1 -0
- package/dist/core/radius.js +2 -0
- package/dist/core/radius.js.map +1 -0
- package/dist/core/remote-catalog-provider.d.ts +5 -0
- package/dist/core/remote-catalog-provider.d.ts.map +1 -0
- package/dist/core/remote-catalog-provider.js +115 -0
- package/dist/core/remote-catalog-provider.js.map +1 -0
- package/dist/core/resource-loader.d.ts +36 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +159 -27
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/runtime-credentials.d.ts +15 -0
- package/dist/core/runtime-credentials.d.ts.map +1 -0
- package/dist/core/runtime-credentials.js +35 -0
- package/dist/core/runtime-credentials.js.map +1 -0
- 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 +92 -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 +3 -6
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +25 -22
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts +74 -7
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +169 -34
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +22 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +36 -16
- 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 +19 -6
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -0
- 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 +660 -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 +775 -26
- package/dist/core/socket-server/socket-server.js.map +1 -1
- package/dist/core/socket-server/types.d.ts +106 -2
- 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/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +10 -21
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts +3 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +39 -7
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +17 -2
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.d.ts +3 -0
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +11 -18
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/read.js +1 -1
- package/dist/core/tools/read.js.map +1 -1
- 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/trust-manager.d.ts +6 -4
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +55 -21
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/core/usage-totals.d.ts +19 -0
- package/dist/core/usage-totals.d.ts.map +1 -0
- package/dist/core/usage-totals.js +52 -0
- package/dist/core/usage-totals.js.map +1 -0
- package/dist/extensions/index.d.ts +3 -0
- package/dist/extensions/index.d.ts.map +1 -0
- package/dist/extensions/index.js +7 -0
- package/dist/extensions/index.js.map +1 -0
- package/dist/extensions/llama/client.d.ts +61 -0
- package/dist/extensions/llama/client.d.ts.map +1 -0
- package/dist/extensions/llama/client.js +300 -0
- package/dist/extensions/llama/client.js.map +1 -0
- package/dist/extensions/llama/huggingface.d.ts +23 -0
- package/dist/extensions/llama/huggingface.d.ts.map +1 -0
- package/dist/extensions/llama/huggingface.js +139 -0
- package/dist/extensions/llama/huggingface.js.map +1 -0
- package/dist/extensions/llama/index.d.ts +3 -0
- package/dist/extensions/llama/index.d.ts.map +1 -0
- package/dist/extensions/llama/index.js +208 -0
- package/dist/extensions/llama/index.js.map +1 -0
- package/dist/extensions/llama/provider.d.ts +10 -0
- package/dist/extensions/llama/provider.d.ts.map +1 -0
- package/dist/extensions/llama/provider.js +111 -0
- package/dist/extensions/llama/provider.js.map +1 -0
- package/dist/extensions/llama/ui.d.ts +42 -0
- package/dist/extensions/llama/ui.d.ts.map +1 -0
- package/dist/extensions/llama/ui.js +400 -0
- package/dist/extensions/llama/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 +193 -0
- package/dist/extensions/stub-provider/provider.js.map +1 -0
- package/dist/hooks/gsd/draht-quality-gate.js +3 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +305 -61
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +22 -10
- package/dist/modes/interactive/components/assistant-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 +3 -2
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +1 -1
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts +3 -1
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +9 -2
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts +1 -2
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +16 -46
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts +49 -0
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +202 -5
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +24 -23
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +5 -5
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +17 -8
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +11 -4
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +74 -41
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +4 -4
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +14 -25
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +22 -13
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +10 -2
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +2 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +10 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +10 -1
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts +25 -2
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +68 -17
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/external-editor.d.ts +12 -0
- package/dist/modes/interactive/external-editor.d.ts.map +1 -0
- package/dist/modes/interactive/external-editor.js +37 -0
- package/dist/modes/interactive/external-editor.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +107 -10
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +763 -285
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +4 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +7 -0
- 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 +185 -9
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +79 -1
- 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.map +1 -1
- package/dist/package-manager-cli.js +67 -5
- 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 +2 -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 +4 -13
- package/dist/prompts/commands/triage.md +159 -0
- package/dist/prompts/commands/verify-work.md +4 -14
- package/dist/prompts/commands/why.md +135 -0
- package/dist/skills/atomic-reasoning/SKILL.md +115 -0
- package/dist/skills/blast-radius/SKILL.md +55 -0
- package/dist/skills/epistemics/SKILL.md +99 -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 +101 -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/child-process.d.ts +12 -1
- package/dist/utils/child-process.d.ts.map +1 -1
- package/dist/utils/child-process.js +25 -8
- package/dist/utils/child-process.js.map +1 -1
- package/dist/utils/clipboard-native.d.ts +1 -0
- package/dist/utils/clipboard-native.d.ts.map +1 -1
- package/dist/utils/clipboard-native.js.map +1 -1
- package/dist/utils/clipboard.d.ts +2 -0
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +53 -9
- package/dist/utils/clipboard.js.map +1 -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/paths.d.ts +2 -7
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +13 -15
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +6 -4
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +3 -5
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js +3 -1
- package/dist/utils/version-check.js.map +1 -1
- package/docs/attachable-sessions.md +79 -0
- package/docs/compaction.md +29 -24
- package/docs/containerization.md +23 -23
- package/docs/custom-provider.md +66 -32
- package/docs/development.md +9 -9
- package/docs/docs.json +6 -2
- package/docs/duet.md +42 -0
- package/docs/environment-variables.md +88 -0
- package/docs/extensions.md +278 -65
- package/docs/index.md +12 -10
- package/docs/json.md +12 -8
- package/docs/keybindings.md +8 -5
- package/docs/llama-cpp.md +99 -0
- package/docs/models.md +19 -8
- package/docs/packages.md +43 -42
- package/docs/prompt-templates.md +5 -4
- package/docs/providers.md +45 -11
- package/docs/quickstart.md +33 -33
- package/docs/rpc.md +190 -19
- package/docs/sdk.md +18 -15
- package/docs/security.md +18 -18
- package/docs/session-format.md +53 -15
- package/docs/sessions.md +17 -14
- package/docs/settings.md +26 -19
- package/docs/shell-aliases.md +2 -2
- package/docs/skills.md +12 -11
- package/docs/terminal-setup.md +12 -12
- package/docs/termux.md +6 -6
- package/docs/themes.md +11 -11
- package/docs/tmux.md +4 -4
- package/docs/tui.md +46 -31
- package/docs/usage.md +53 -63
- package/docs/windows.md +2 -2
- package/examples/extensions/custom-compaction.ts +4 -0
- package/examples/extensions/custom-provider-anthropic/index.ts +9 -3
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/custom-provider-qwen-cli/package.json +1 -1
- package/examples/extensions/gondolin/package.json +2 -2
- package/examples/extensions/handoff.ts +9 -1
- package/examples/extensions/kimi-deferred-tools.ts +61 -0
- package/examples/extensions/message-renderer.ts +2 -2
- package/examples/extensions/overlay-qa-tests.ts +3 -3
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/summarize.ts +3 -0
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/sdk/02-custom-model.ts +5 -8
- package/examples/sdk/09-api-keys-and-oauth.ts +15 -31
- package/examples/sdk/12-full-control.ts +9 -12
- package/hooks/gsd/draht-quality-gate.js +3 -3
- package/package.json +14 -11
- 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 +2 -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 +4 -13
- package/prompts/commands/triage.md +159 -0
- package/prompts/commands/verify-work.md +4 -14
- package/prompts/commands/why.md +135 -0
- package/skills/atomic-reasoning/SKILL.md +115 -0
- package/skills/blast-radius/SKILL.md +55 -0
- package/skills/epistemics/SKILL.md +99 -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 +101 -0
- package/dist/core/provider-display-names.d.ts +0 -2
- package/dist/core/provider-display-names.d.ts.map +0 -1
- package/dist/core/provider-display-names.js +0 -36
- package/dist/core/provider-display-names.js.map +0 -1
- 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/prompts/agents/build.md +0 -86
- package/prompts/agents/plan.md +0 -79
- package/prompts/agents/verify.md +0 -69
package/docs/custom-provider.md
CHANGED
|
@@ -30,10 +30,38 @@ See these complete provider examples:
|
|
|
30
30
|
|
|
31
31
|
## Quick Reference
|
|
32
32
|
|
|
33
|
+
Extensions can register either a complete `@draht/ai` `Provider` or use the legacy provider-config form. Prefer a complete provider when custom authentication, filtering, refresh, or streaming behavior is required. draht composes `models.json` overrides above registered native providers.
|
|
34
|
+
|
|
33
35
|
```typescript
|
|
36
|
+
import { createProvider, openAICompletionsApi } from "@draht/ai";
|
|
34
37
|
import type { ExtensionAPI } from "@draht/coding-agent";
|
|
35
38
|
|
|
36
39
|
export default function (pi: ExtensionAPI) {
|
|
40
|
+
pi.registerProvider(createProvider({
|
|
41
|
+
id: "native-local",
|
|
42
|
+
name: "Native Local",
|
|
43
|
+
baseUrl: "http://localhost:8080/v1",
|
|
44
|
+
auth: {
|
|
45
|
+
apiKey: {
|
|
46
|
+
name: "Local server API key",
|
|
47
|
+
async login(interaction) {
|
|
48
|
+
return {
|
|
49
|
+
type: "api_key",
|
|
50
|
+
key: await interaction.prompt({ type: "secret", message: "API key" })
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
async resolve({ credential }) {
|
|
54
|
+
return credential?.key
|
|
55
|
+
? { auth: { apiKey: credential.key }, source: "stored API key" }
|
|
56
|
+
: undefined;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
models: [],
|
|
61
|
+
api: openAICompletionsApi()
|
|
62
|
+
}));
|
|
63
|
+
|
|
64
|
+
// Legacy provider-config form:
|
|
37
65
|
// Override baseUrl for existing provider
|
|
38
66
|
pi.registerProvider("anthropic", {
|
|
39
67
|
baseUrl: "https://proxy.example.com"
|
|
@@ -60,7 +88,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
60
88
|
}
|
|
61
89
|
```
|
|
62
90
|
|
|
63
|
-
The extension factory can also be `async`. For dynamic model discovery, fetch and register models in the factory instead of `session_start`.
|
|
91
|
+
The extension factory can also be `async`. For dynamic model discovery, fetch and register models in the factory instead of `session_start`. draht waits for the factory before startup continues, so the provider is available during interactive startup and to `draht --list-models`.
|
|
64
92
|
|
|
65
93
|
## Override Existing Provider
|
|
66
94
|
|
|
@@ -211,7 +239,7 @@ models: [{
|
|
|
211
239
|
id: "custom-model",
|
|
212
240
|
// ...
|
|
213
241
|
reasoning: true,
|
|
214
|
-
thinkingLevelMap: { // map
|
|
242
|
+
thinkingLevelMap: { // map draht levels to provider values; null hides unsupported levels
|
|
215
243
|
minimal: null,
|
|
216
244
|
low: null,
|
|
217
245
|
medium: null,
|
|
@@ -231,7 +259,7 @@ models: [{
|
|
|
231
259
|
```
|
|
232
260
|
|
|
233
261
|
Use `openrouter` for OpenRouter-style `reasoning: { effort }` controls. Use `together` for Together-style `reasoning: { enabled }` controls; with `supportsReasoningEffort`, it also sends `reasoning_effort`. Use `qwen-chat-template` instead for local Qwen-compatible servers that read `chat_template_kwargs.enable_thinking`.
|
|
234
|
-
Use `cacheControlFormat: "anthropic"` for OpenAI-compatible providers that expose Anthropic-style prompt caching via `cache_control` on the system prompt, last tool definition, and last user
|
|
262
|
+
Use `cacheControlFormat: "anthropic"` for OpenAI-compatible providers that expose Anthropic-style prompt caching via `cache_control` on the system prompt, last tool definition, and last user, assistant, or tool-result text content.
|
|
235
263
|
|
|
236
264
|
For Anthropic-compatible providers using `api: "anthropic-messages"`, set `compat.forceAdaptiveThinking: true` on models or providers whose upstream model requires adaptive thinking (`thinking.type: "adaptive"` plus `output_config.effort`). Built-in adaptive Claude models set this automatically. Set `compat.allowEmptySignature: true` only for providers that emit empty thinking signatures and expect `signature: ""` on replay.
|
|
237
265
|
|
|
@@ -253,6 +281,8 @@ pi.registerProvider("custom-api", {
|
|
|
253
281
|
});
|
|
254
282
|
```
|
|
255
283
|
|
|
284
|
+
The key is resolved for each request. An explicit request `Authorization` header takes precedence over the generated value.
|
|
285
|
+
|
|
256
286
|
## OAuth Support
|
|
257
287
|
|
|
258
288
|
Add OAuth/SSO authentication that integrates with `/login`:
|
|
@@ -312,15 +342,6 @@ pi.registerProvider("corporate-ai", {
|
|
|
312
342
|
|
|
313
343
|
getApiKey(credentials: OAuthCredentials): string {
|
|
314
344
|
return credentials.access;
|
|
315
|
-
},
|
|
316
|
-
|
|
317
|
-
// Optional: modify models based on user's subscription
|
|
318
|
-
modifyModels(models, credentials) {
|
|
319
|
-
const region = decodeRegionFromToken(credentials.access);
|
|
320
|
-
return models.map(m => ({
|
|
321
|
-
...m,
|
|
322
|
-
baseUrl: `https://${region}.ai.corp.com/v1`
|
|
323
|
-
}));
|
|
324
345
|
}
|
|
325
346
|
}
|
|
326
347
|
});
|
|
@@ -330,7 +351,7 @@ After registration, users can authenticate via `/login corporate-ai`.
|
|
|
330
351
|
|
|
331
352
|
### OAuthLoginCallbacks
|
|
332
353
|
|
|
333
|
-
The `callbacks` object provides
|
|
354
|
+
The `callbacks` object provides UI-neutral interactions for the provider-owned flow:
|
|
334
355
|
|
|
335
356
|
```typescript
|
|
336
357
|
interface OAuthLoginCallbacks {
|
|
@@ -345,6 +366,9 @@ interface OAuthLoginCallbacks {
|
|
|
345
366
|
expiresInSeconds?: number;
|
|
346
367
|
}): void;
|
|
347
368
|
|
|
369
|
+
// Show transient progress
|
|
370
|
+
onProgress?(message: string): void;
|
|
371
|
+
|
|
348
372
|
// Prompt user for input (for manual token entry)
|
|
349
373
|
onPrompt(params: { message: string }): Promise<string>;
|
|
350
374
|
|
|
@@ -358,7 +382,7 @@ interface OAuthLoginCallbacks {
|
|
|
358
382
|
|
|
359
383
|
### OAuthCredentials
|
|
360
384
|
|
|
361
|
-
Credentials are persisted in `~/.
|
|
385
|
+
Credentials are persisted in `~/.draht/agent/auth.json`:
|
|
362
386
|
|
|
363
387
|
```typescript
|
|
364
388
|
interface OAuthCredentials {
|
|
@@ -373,12 +397,12 @@ interface OAuthCredentials {
|
|
|
373
397
|
For providers with non-standard APIs, implement `streamSimple`. Study the existing provider implementations before writing your own:
|
|
374
398
|
|
|
375
399
|
**Reference implementations:**
|
|
376
|
-
- [anthropic.ts](https://github.com/
|
|
377
|
-
- [mistral.ts](https://github.com/
|
|
378
|
-
- [openai-completions.ts](https://github.com/
|
|
379
|
-
- [openai-responses.ts](https://github.com/
|
|
380
|
-
- [google.ts](https://github.com/
|
|
381
|
-
- [amazon-bedrock.ts](https://github.com/
|
|
400
|
+
- [anthropic.ts](https://github.com/draht-dev/draht/blob/main/packages/ai/src/providers/anthropic.ts) - Anthropic Messages API
|
|
401
|
+
- [mistral.ts](https://github.com/draht-dev/draht/blob/main/packages/ai/src/providers/mistral.ts) - Mistral Conversations API
|
|
402
|
+
- [openai-completions.ts](https://github.com/draht-dev/draht/blob/main/packages/ai/src/providers/openai-completions.ts) - OpenAI Chat Completions
|
|
403
|
+
- [openai-responses.ts](https://github.com/draht-dev/draht/blob/main/packages/ai/src/providers/openai-responses.ts) - OpenAI Responses API
|
|
404
|
+
- [google.ts](https://github.com/draht-dev/draht/blob/main/packages/ai/src/providers/google.ts) - Google Generative AI
|
|
405
|
+
- [amazon-bedrock.ts](https://github.com/draht-dev/draht/blob/main/packages/ai/src/providers/amazon-bedrock.ts) - AWS Bedrock
|
|
382
406
|
|
|
383
407
|
### Stream Pattern
|
|
384
408
|
|
|
@@ -418,7 +442,7 @@ function streamMyProvider(
|
|
|
418
442
|
totalTokens: 0,
|
|
419
443
|
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
|
|
420
444
|
},
|
|
421
|
-
stopReason: "
|
|
445
|
+
stopReason: "pending",
|
|
422
446
|
timestamp: Date.now(),
|
|
423
447
|
};
|
|
424
448
|
|
|
@@ -427,12 +451,18 @@ function streamMyProvider(
|
|
|
427
451
|
stream.push({ type: "start", partial: output });
|
|
428
452
|
|
|
429
453
|
// Make API request and process response...
|
|
430
|
-
// Push content events as they arrive
|
|
454
|
+
// Push content events as they arrive and set stopReason from the terminal event.
|
|
455
|
+
if (output.stopReason === "pending") {
|
|
456
|
+
throw new Error("Provider stream ended without a stop reason");
|
|
457
|
+
}
|
|
458
|
+
if (output.stopReason === "error" || output.stopReason === "aborted") {
|
|
459
|
+
throw new Error(output.errorMessage || "An unknown error occurred");
|
|
460
|
+
}
|
|
431
461
|
|
|
432
462
|
// Push done event
|
|
433
463
|
stream.push({
|
|
434
464
|
type: "done",
|
|
435
|
-
reason: output.stopReason
|
|
465
|
+
reason: output.stopReason,
|
|
436
466
|
message: output
|
|
437
467
|
});
|
|
438
468
|
stream.end();
|
|
@@ -536,14 +566,14 @@ calculateCost(model, output.usage);
|
|
|
536
566
|
|
|
537
567
|
### Context Overflow Errors
|
|
538
568
|
|
|
539
|
-
When a request exceeds the model's context window,
|
|
569
|
+
When a request exceeds the model's context window, draht can recover automatically by compacting the conversation and retrying. This recovery only kicks in if draht recognizes the failure as an overflow.
|
|
540
570
|
|
|
541
571
|
Detection runs on the finalized assistant message:
|
|
542
572
|
|
|
543
573
|
- `stopReason === "error"`
|
|
544
|
-
- `errorMessage` matches one of
|
|
574
|
+
- `errorMessage` matches one of draht's known overflow patterns (see [`packages/ai/src/utils/overflow.ts`](https://github.com/draht-dev/draht/blob/main/packages/ai/src/utils/overflow.ts))
|
|
545
575
|
|
|
546
|
-
If your provider returns overflow errors with a message
|
|
576
|
+
If your provider returns overflow errors with a message draht does not recognize, normalize the error from the same extension that registers the provider. Use a `message_end` handler to rewrite the assistant message so its `errorMessage` starts with a phrase draht recognizes. The generic fallback `context_length_exceeded` is the safest choice.
|
|
547
577
|
|
|
548
578
|
```typescript
|
|
549
579
|
const MY_PROVIDER_OVERFLOW_PATTERN = /your provider's overflow phrase/i;
|
|
@@ -575,7 +605,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
575
605
|
}
|
|
576
606
|
```
|
|
577
607
|
|
|
578
|
-
`message_end` runs before
|
|
608
|
+
`message_end` runs before draht tracks the assistant message for auto-compaction, so the rewritten `errorMessage` is what draht checks. With this in place, draht will:
|
|
579
609
|
|
|
580
610
|
1. Detect the overflow from `errorMessage`.
|
|
581
611
|
2. Drop the failed assistant message from live context.
|
|
@@ -585,7 +615,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
585
615
|
Guard the rewrite carefully:
|
|
586
616
|
|
|
587
617
|
- Scope it to your provider (`message.provider` and `ctx.model?.provider`) so unrelated errors from other providers are untouched.
|
|
588
|
-
- Match a provider-specific pattern, not
|
|
618
|
+
- Match a provider-specific pattern, not draht's generic overflow patterns. Rewriting rate-limit or throttling errors (`rate limit`, `too many requests`) would falsely trigger compaction instead of draht's normal retry-with-backoff path.
|
|
589
619
|
- Skip when `errorMessage` already includes `context_length_exceeded` so the handler is idempotent.
|
|
590
620
|
|
|
591
621
|
### Registration
|
|
@@ -604,7 +634,7 @@ pi.registerProvider("my-provider", {
|
|
|
604
634
|
|
|
605
635
|
## Testing Your Implementation
|
|
606
636
|
|
|
607
|
-
Test your provider against the same test suites used by built-in providers. Copy and adapt these test files from [packages/ai/test/](https://github.com/
|
|
637
|
+
Test your provider against the same test suites used by built-in providers. Copy and adapt these test files from [packages/ai/test/](https://github.com/draht-dev/draht/tree/main/packages/ai/test):
|
|
608
638
|
|
|
609
639
|
| Test | Purpose |
|
|
610
640
|
|------|---------|
|
|
@@ -660,7 +690,6 @@ interface ProviderConfig {
|
|
|
660
690
|
login(callbacks: OAuthLoginCallbacks): Promise<OAuthCredentials>;
|
|
661
691
|
refreshToken(credentials: OAuthCredentials): Promise<OAuthCredentials>;
|
|
662
692
|
getApiKey(credentials: OAuthCredentials): string;
|
|
663
|
-
modifyModels?(models: Model<Api>[], credentials: OAuthCredentials): Model<Api>[];
|
|
664
693
|
};
|
|
665
694
|
}
|
|
666
695
|
```
|
|
@@ -684,7 +713,7 @@ interface ProviderModelConfig {
|
|
|
684
713
|
/** Whether the model supports extended thinking. */
|
|
685
714
|
reasoning: boolean;
|
|
686
715
|
|
|
687
|
-
/** Maps
|
|
716
|
+
/** Maps draht thinking levels to provider/model-specific values; null marks a level unsupported. */
|
|
688
717
|
thinkingLevelMap?: Partial<Record<"off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max", string | null>>;
|
|
689
718
|
|
|
690
719
|
/** Supported input types. */
|
|
@@ -714,6 +743,8 @@ interface ProviderModelConfig {
|
|
|
714
743
|
supportsDeveloperRole?: boolean;
|
|
715
744
|
supportsReasoningEffort?: boolean;
|
|
716
745
|
supportsUsageInStreaming?: boolean;
|
|
746
|
+
supportsStrictMode?: boolean;
|
|
747
|
+
supportsOpenAIGrammarTools?: boolean; // openai-completions/openai-responses; false falls back to normal function tools
|
|
717
748
|
maxTokensField?: "max_completion_tokens" | "max_tokens";
|
|
718
749
|
requiresToolResultName?: boolean;
|
|
719
750
|
requiresAssistantAfterToolResult?: boolean;
|
|
@@ -721,6 +752,8 @@ interface ProviderModelConfig {
|
|
|
721
752
|
requiresReasoningContentOnAssistantMessages?: boolean;
|
|
722
753
|
thinkingFormat?: "openai" | "openrouter" | "deepseek" | "together" | "zai" | "qwen" | "qwen-chat-template";
|
|
723
754
|
cacheControlFormat?: "anthropic";
|
|
755
|
+
sessionAffinityFormat?: "openai" | "openai-nosession" | "openrouter";
|
|
756
|
+
sendSessionAffinityHeaders?: boolean;
|
|
724
757
|
|
|
725
758
|
// anthropic-messages
|
|
726
759
|
supportsEagerToolInputStreaming?: boolean;
|
|
@@ -729,9 +762,10 @@ interface ProviderModelConfig {
|
|
|
729
762
|
supportsCacheControlOnTools?: boolean;
|
|
730
763
|
forceAdaptiveThinking?: boolean;
|
|
731
764
|
allowEmptySignature?: boolean;
|
|
765
|
+
supportsStrictTools?: boolean;
|
|
732
766
|
};
|
|
733
767
|
}
|
|
734
768
|
```
|
|
735
769
|
|
|
736
770
|
`openrouter` sends `reasoning: { effort }`. `deepseek` sends `thinking: { type: "enabled" | "disabled" }` and `reasoning_effort` when enabled. `together` sends `reasoning: { enabled }` and also `reasoning_effort` when `supportsReasoningEffort` is enabled. `qwen` is for DashScope-style top-level `enable_thinking`. Use `qwen-chat-template` for local Qwen-compatible servers that read `chat_template_kwargs.enable_thinking`.
|
|
737
|
-
`cacheControlFormat: "anthropic"` applies Anthropic-style `cache_control` markers to the system prompt, last tool definition, and last user
|
|
771
|
+
`cacheControlFormat: "anthropic"` applies Anthropic-style `cache_control` markers to the system prompt, last tool definition, and last user, assistant, or tool-result text content.
|
package/docs/development.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Development
|
|
2
2
|
|
|
3
|
-
See [AGENTS.md](https://github.com/
|
|
3
|
+
See [AGENTS.md](https://github.com/draht-dev/draht/blob/main/AGENTS.md) for additional guidelines.
|
|
4
4
|
|
|
5
5
|
## Setup
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
git clone https://github.com/
|
|
9
|
-
cd
|
|
8
|
+
git clone https://github.com/draht-dev/draht
|
|
9
|
+
cd draht
|
|
10
10
|
npm install
|
|
11
11
|
npm run build
|
|
12
12
|
```
|
|
@@ -14,10 +14,10 @@ npm run build
|
|
|
14
14
|
Run from source:
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
|
-
/path/to/
|
|
17
|
+
/path/to/draht/pi-test.sh
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
The script can be run from any directory.
|
|
20
|
+
The script can be run from any directory. draht keeps the caller's current working directory.
|
|
21
21
|
|
|
22
22
|
## Forking / Rebranding
|
|
23
23
|
|
|
@@ -25,9 +25,9 @@ Configure via `package.json`:
|
|
|
25
25
|
|
|
26
26
|
```json
|
|
27
27
|
{
|
|
28
|
-
"
|
|
29
|
-
"name": "
|
|
30
|
-
"configDir": ".
|
|
28
|
+
"drahtConfig": {
|
|
29
|
+
"name": "draht",
|
|
30
|
+
"configDir": ".draht"
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
```
|
|
@@ -48,7 +48,7 @@ Never use `__dirname` directly for package assets.
|
|
|
48
48
|
|
|
49
49
|
## Debug Command
|
|
50
50
|
|
|
51
|
-
`/debug` (hidden) writes to `~/.
|
|
51
|
+
`/debug` (hidden) writes to `~/.draht/agent/draht-debug.log`:
|
|
52
52
|
- Rendered TUI lines with ANSI codes
|
|
53
53
|
- Last messages sent to the LLM
|
|
54
54
|
|
package/docs/docs.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"path": "quickstart.md"
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
|
-
"title": "Using
|
|
15
|
+
"title": "Using Draht",
|
|
16
16
|
"path": "usage.md"
|
|
17
17
|
},
|
|
18
18
|
{
|
|
@@ -39,6 +39,10 @@
|
|
|
39
39
|
"title": "Sessions",
|
|
40
40
|
"path": "sessions.md"
|
|
41
41
|
},
|
|
42
|
+
{
|
|
43
|
+
"title": "Attachable Sessions",
|
|
44
|
+
"path": "attachable-sessions.md"
|
|
45
|
+
},
|
|
42
46
|
{
|
|
43
47
|
"title": "Compaction",
|
|
44
48
|
"path": "compaction.md"
|
|
@@ -65,7 +69,7 @@
|
|
|
65
69
|
"path": "themes.md"
|
|
66
70
|
},
|
|
67
71
|
{
|
|
68
|
-
"title": "
|
|
72
|
+
"title": "Draht Packages",
|
|
69
73
|
"path": "packages.md"
|
|
70
74
|
},
|
|
71
75
|
{
|
package/docs/duet.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Duet mode
|
|
2
|
+
|
|
3
|
+
Duet mode lets multiple authenticated models collaborate in one Draht session. Configuration and turn position are stored in the session, so `/resume`, `/tree`, and compaction continue to work normally.
|
|
4
|
+
|
|
5
|
+
## Configure
|
|
6
|
+
|
|
7
|
+
Pass two to eight comma-separated models. Optional role names use `role=model`; optional thinking levels use `model:level`.
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
/duet turns implementer=openai-codex/gpt-5.5:high,reviewer=anthropic/claude-opus-4-8:high
|
|
11
|
+
/duet triage lead=openai-codex/gpt-5.5:high,reviewer=anthropic/claude-opus-4-8,tester=google/gemini-3.1-pro-preview
|
|
12
|
+
/duet status
|
|
13
|
+
/duet off
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
With no model list, `/duet turns` and `/duet triage` use the models configured by `/scoped-models` or `--models`. At least two scoped models are required.
|
|
17
|
+
|
|
18
|
+
Duet can also start from CLI flags:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
draht \
|
|
22
|
+
--duet "lead=openai-codex/gpt-5.5,reviewer=anthropic/claude-opus-4-8" \
|
|
23
|
+
--duet-strategy triage
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Strategies
|
|
27
|
+
|
|
28
|
+
### Turn taking
|
|
29
|
+
|
|
30
|
+
`turns` rotates the active model before each new, idle user prompt. Every model receives the same persisted conversation, tool results, session tree, and working directory. Steering and follow-up messages queued during an active response stay with that response's model; rotation happens on the next prompt submitted while idle.
|
|
31
|
+
|
|
32
|
+
### Triage
|
|
33
|
+
|
|
34
|
+
`triage` makes the first participant the lead. For non-trivial requests, the lead can call `duet_delegate` to assign independent investigations to the remaining model roles concurrently. Results return as one tool result in the shared conversation, then the lead synthesizes them and performs the implementation.
|
|
35
|
+
|
|
36
|
+
Triage teammates intentionally receive only `read`, `grep`, `find`, and `ls`, and user/project extensions are disabled in their child processes. They cannot modify the shared working tree. This avoids concurrent edits and leaves one model accountable for integration. Use the existing `subagent` tool with worktree isolation when autonomous writing agents are required.
|
|
37
|
+
|
|
38
|
+
Teammates can read project content and send it to their configured providers. Choose participant providers according to the project's data policy, and do not expose secrets through project files or symlinks.
|
|
39
|
+
|
|
40
|
+
## Cost and authentication
|
|
41
|
+
|
|
42
|
+
Every participant must already be authenticated. Parallel triage assignments make concurrent provider requests and are billed independently. By default, each delegation batch requires approval through Draht's permission gate; explicit permission rules can change that behavior. Draht limits triage to one delegation batch per user prompt and records nested teammate usage in session totals. The lead is instructed to skip delegation when it would only add latency or cost.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Environment Variables
|
|
2
|
+
|
|
3
|
+
draht uses environment variables in three ways:
|
|
4
|
+
|
|
5
|
+
- Variables such as `DRAHT_OFFLINE` configure the draht process.
|
|
6
|
+
- draht sets `DRAHT_CODING_AGENT` so child processes can detect that they run inside draht.
|
|
7
|
+
- Commands run by the LLM-callable bash tool receive `DRAHT_*` variables describing the current session.
|
|
8
|
+
|
|
9
|
+
Provider API-key variables are documented separately in [Providers](providers.md#environment-variables-or-auth-file).
|
|
10
|
+
|
|
11
|
+
## Process Marker
|
|
12
|
+
|
|
13
|
+
The CLI and RPC entry points set `DRAHT_CODING_AGENT=true`. Child processes inherit it and can use it to detect that they run inside draht. It is not session-specific and is not set automatically when draht is embedded through the SDK.
|
|
14
|
+
|
|
15
|
+
## Bash Tool Session Environment
|
|
16
|
+
|
|
17
|
+
Commands run by the bash tool receive the current draht session state:
|
|
18
|
+
|
|
19
|
+
| Variable | Description |
|
|
20
|
+
|----------|-------------|
|
|
21
|
+
| `DRAHT_SESSION_ID` | Current session ID |
|
|
22
|
+
| `DRAHT_SESSION_FILE` | Absolute path to the current session JSONL file; unset for ephemeral sessions |
|
|
23
|
+
| `DRAHT_PROVIDER` | Currently selected model provider |
|
|
24
|
+
| `DRAHT_MODEL` | Currently selected model ID |
|
|
25
|
+
| `DRAHT_REASONING_LEVEL` | Current effective reasoning level: `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, or `max` |
|
|
26
|
+
|
|
27
|
+
The values are resolved when each command starts. Switching models or changing the reasoning level therefore affects the next bash command without restarting draht. `DRAHT_PROVIDER` and `DRAHT_MODEL` identify the selected draht model, not a different upstream model that a router may choose internally.
|
|
28
|
+
|
|
29
|
+
When asked which model or provider is running, inspect these variables instead of inferring the answer from the system prompt:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
printf '%s/%s\n' "$DRAHT_PROVIDER" "$DRAHT_MODEL"
|
|
33
|
+
printf 'reasoning=%s session=%s\n' "$DRAHT_REASONING_LEVEL" "$DRAHT_SESSION_ID"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The session file can be inspected directly when the session is persistent:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
if [ -n "$DRAHT_SESSION_FILE" ]; then
|
|
40
|
+
tail -n 1 "$DRAHT_SESSION_FILE"
|
|
41
|
+
fi
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
These variables are injected into the LLM-callable bash tool. They are not injected into user-entered `!` or `!!` commands.
|
|
45
|
+
|
|
46
|
+
### Custom Bash Tools
|
|
47
|
+
|
|
48
|
+
Bash tools created with `createBashTool()` expose the session environment by default when registered with draht. Injection happens before `spawnHook`, so a hook receives the variables in `ctx.env`:
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
const bashTool = createBashTool(cwd, {
|
|
52
|
+
spawnHook: (ctx) => ({
|
|
53
|
+
...ctx,
|
|
54
|
+
env: { ...ctx.env, CI: "1" },
|
|
55
|
+
}),
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Disable session metadata independently of the spawn hook:
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
const bashTool = createBashTool(cwd, {
|
|
63
|
+
exposeSessionEnvironment: false,
|
|
64
|
+
spawnHook: (ctx) => ctx,
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
When disabled, draht removes inherited values for these variables so nested draht processes do not expose stale parent-session metadata.
|
|
69
|
+
|
|
70
|
+
## draht Process Configuration
|
|
71
|
+
|
|
72
|
+
These variables are read by draht itself:
|
|
73
|
+
|
|
74
|
+
| Variable | Description |
|
|
75
|
+
|----------|-------------|
|
|
76
|
+
| `DRAHT_CODING_AGENT_DIR` | Override the config directory; default is `~/.draht/agent` |
|
|
77
|
+
| `DRAHT_CODING_AGENT_SESSION_DIR` | Override session storage; overridden by `--session-dir` |
|
|
78
|
+
| `DRAHT_PACKAGE_DIR` | Override the package directory, useful for Nix/Guix store paths |
|
|
79
|
+
| `DRAHT_OFFLINE` | Disable startup network operations, including update checks, package updates, and install/update telemetry |
|
|
80
|
+
| `DRAHT_SKIP_VERSION_CHECK` | Disable the latest-version request |
|
|
81
|
+
| `DRAHT_TELEMETRY` | Override install/update telemetry and provider attribution headers: `1`/`true`/`yes` or `0`/`false`/`no` |
|
|
82
|
+
| `PI_CACHE_RETENTION` | Set to `long` for extended provider prompt caching where supported |
|
|
83
|
+
| `DRAHT_SHARE_VIEWER_URL` | Override the base URL used by `/share` |
|
|
84
|
+
| `DRAHT_HARDWARE_CURSOR` | Set to `1` to show the hardware cursor; see [Terminal setup](terminal-setup.md) |
|
|
85
|
+
| `VISUAL`, `EDITOR` | External editor fallback when `externalEditor` is unset |
|
|
86
|
+
| `HTTP_PROXY`, `HTTPS_PROXY` | Proxy outbound HTTP requests |
|
|
87
|
+
|
|
88
|
+
Provider credentials such as `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, and cloud-provider configuration are listed in [Providers](providers.md#environment-variables-or-auth-file).
|