@draht/coding-agent 2026.5.12 → 2026.7.7-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 +47 -0
- package/README.md +1 -4
- package/bin/draht-tools.cjs +3756 -1
- package/dist/bun/cli.d.ts.map +1 -1
- package/dist/bun/cli.js +4 -2
- package/dist/bun/cli.js.map +1 -1
- package/dist/bun/register-bedrock.d.ts.map +1 -1
- package/dist/bun/register-bedrock.js +1 -1
- package/dist/bun/register-bedrock.js.map +1 -1
- package/dist/bun/restore-sandbox-env.d.ts +17 -0
- package/dist/bun/restore-sandbox-env.d.ts.map +1 -0
- package/dist/bun/restore-sandbox-env.js +36 -0
- package/dist/bun/restore-sandbox-env.js.map +1 -0
- package/dist/cli/args.d.ts +9 -4
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +91 -38
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/config-selector.d.ts +5 -3
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +1 -1
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/file-processor.d.ts.map +1 -1
- package/dist/cli/file-processor.js +13 -26
- package/dist/cli/file-processor.js.map +1 -1
- package/dist/cli/initial-message.d.ts +1 -1
- package/dist/cli/initial-message.d.ts.map +1 -1
- package/dist/cli/initial-message.js.map +1 -1
- package/dist/cli/list-models.d.ts +1 -1
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +7 -1
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli/project-trust.d.ts +10 -0
- package/dist/cli/project-trust.d.ts.map +1 -0
- package/dist/cli/project-trust.js +48 -0
- package/dist/cli/project-trust.js.map +1 -0
- package/dist/cli/session-picker.d.ts +3 -2
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js +5 -4
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/cli/startup-ui.d.ts +20 -0
- package/dist/cli/startup-ui.d.ts.map +1 -0
- package/dist/cli/startup-ui.js +184 -0
- package/dist/cli/startup-ui.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +7 -4
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +27 -13
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +284 -63
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +45 -9
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +100 -33
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +6 -4
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +7 -4
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +55 -33
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +560 -492
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-guidance.d.ts +5 -0
- package/dist/core/auth-guidance.d.ts.map +1 -0
- package/dist/core/auth-guidance.js +21 -0
- package/dist/core/auth-guidance.js.map +1 -0
- package/dist/core/auth-storage.d.ts +21 -13
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +48 -28
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bash-executor.d.ts +1 -15
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +10 -24
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/builtins/subagent.d.ts.map +1 -1
- package/dist/core/builtins/subagent.js +1 -2
- package/dist/core/builtins/subagent.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +9 -5
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +10 -4
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +8 -7
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +56 -47
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/index.d.ts +3 -3
- package/dist/core/compaction/index.d.ts.map +1 -1
- package/dist/core/compaction/index.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 +1 -1
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js.map +1 -1
- package/dist/core/experimental.d.ts +2 -0
- package/dist/core/experimental.d.ts.map +1 -0
- package/dist/core/experimental.js +4 -0
- package/dist/core/experimental.js.map +1 -0
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
- package/dist/core/export-html/ansi-to-html.js +1 -1
- package/dist/core/export-html/ansi-to-html.js.map +1 -1
- package/dist/core/export-html/index.d.ts +1 -1
- package/dist/core/export-html/index.d.ts.map +1 -1
- package/dist/core/export-html/index.js +13 -11
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/export-html/template.css +69 -4
- package/dist/core/export-html/template.js +231 -57
- package/dist/core/export-html/tool-renderer.d.ts +0 -6
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js +15 -2
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/export-html/vendor/marked.min.js +75 -3
- package/dist/core/extensions/index.d.ts +8 -8
- 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 +5 -6
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +98 -43
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +31 -12
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +248 -33
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +191 -36
- 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 +2 -2
- package/dist/core/extensions/wrapper.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts +7 -1
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +78 -54
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts +22 -0
- package/dist/core/http-dispatcher.d.ts.map +1 -0
- package/dist/core/http-dispatcher.js +91 -0
- package/dist/core/http-dispatcher.js.map +1 -0
- package/dist/core/index.d.ts +9 -8
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/keybindings.d.ts +67 -2
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +59 -7
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/model-registry.d.ts +24 -5
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +188 -51
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts +12 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +84 -39
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/output-guard.d.ts +1 -0
- package/dist/core/output-guard.d.ts.map +1 -1
- package/dist/core/output-guard.js +52 -22
- package/dist/core/output-guard.js.map +1 -1
- package/dist/core/package-manager.d.ts +22 -4
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +455 -157
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/project-trust.d.ts +15 -0
- package/dist/core/project-trust.d.ts.map +1 -0
- package/dist/core/project-trust.js +59 -0
- package/dist/core/project-trust.js.map +1 -0
- package/dist/core/prompt-templates.d.ts +13 -11
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +67 -76
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/provider-attribution.d.ts +4 -0
- package/dist/core/provider-attribution.d.ts.map +1 -0
- package/dist/core/provider-attribution.js +72 -0
- package/dist/core/provider-attribution.js.map +1 -0
- package/dist/core/provider-display-names.d.ts +2 -0
- package/dist/core/provider-display-names.d.ts.map +1 -0
- package/dist/core/provider-display-names.js +36 -0
- package/dist/core/provider-display-names.js.map +1 -0
- package/dist/core/resolve-config-value.d.ts +13 -6
- package/dist/core/resolve-config-value.d.ts.map +1 -1
- package/dist/core/resolve-config-value.js +143 -22
- package/dist/core/resolve-config-value.js.map +1 -1
- package/dist/core/resource-loader.d.ts +36 -15
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +178 -79
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts +34 -18
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +47 -16
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts +32 -14
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +366 -209
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +62 -6
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +230 -40
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts +10 -10
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +13 -35
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.d.ts +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +7 -4
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/source-info.d.ts +1 -1
- package/dist/core/source-info.d.ts.map +1 -1
- package/dist/core/source-info.js.map +1 -1
- package/dist/core/system-prompt.d.ts +4 -4
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +20 -16
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/telemetry.d.ts +3 -0
- package/dist/core/telemetry.d.ts.map +1 -0
- package/dist/core/telemetry.js +9 -0
- package/dist/core/telemetry.js.map +1 -0
- package/dist/core/timings.d.ts +4 -2
- package/dist/core/timings.d.ts.map +1 -1
- package/dist/core/timings.js +24 -14
- package/dist/core/timings.js.map +1 -1
- package/dist/core/tools/bash.d.ts +11 -16
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +187 -178
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts +26 -5
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +110 -23
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts +22 -24
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +201 -113
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
- package/dist/core/tools/file-mutation-queue.js +27 -12
- package/dist/core/tools/file-mutation-queue.js.map +1 -1
- package/dist/core/tools/find.d.ts +7 -18
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +148 -101
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts +11 -30
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +23 -12
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/index.d.ts +26 -101
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +78 -52
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/ls.d.ts +6 -15
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +12 -17
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts +52 -0
- package/dist/core/tools/output-accumulator.d.ts.map +1 -0
- package/dist/core/tools/output-accumulator.js +184 -0
- package/dist/core/tools/output-accumulator.js.map +1 -0
- package/dist/core/tools/path-utils.d.ts +2 -0
- package/dist/core/tools/path-utils.d.ts.map +1 -1
- package/dist/core/tools/path-utils.js +40 -22
- package/dist/core/tools/path-utils.js.map +1 -1
- package/dist/core/tools/read.d.ts +7 -18
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +103 -52
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts +5 -2
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js +18 -2
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.js +2 -0
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
- package/dist/core/tools/truncate.d.ts.map +1 -1
- package/dist/core/tools/truncate.js +12 -2
- package/dist/core/tools/truncate.js.map +1 -1
- package/dist/core/tools/write.d.ts +5 -14
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +27 -46
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/trust-manager.d.ts +36 -0
- package/dist/core/trust-manager.d.ts.map +1 -0
- package/dist/core/trust-manager.js +202 -0
- package/dist/core/trust-manager.js.map +1 -0
- package/dist/index.d.ts +33 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -9
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +5 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +208 -93
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts +2 -2
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +4 -4
- package/dist/migrations.js.map +1 -1
- package/dist/modes/index.d.ts +5 -5
- package/dist/modes/index.d.ts.map +1 -1
- package/dist/modes/index.js.map +1 -1
- package/dist/modes/interactive/assets/clankolas.png +0 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +5 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +37 -15
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +3 -3
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.js +3 -0
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts +36 -5
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +318 -36
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/countdown-timer.d.ts +2 -2
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
- package/dist/modes/interactive/components/countdown-timer.js +2 -2
- package/dist/modes/interactive/components/countdown-timer.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/custom-entry.d.ts +19 -0
- package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-entry.js +52 -0
- package/dist/modes/interactive/components/custom-entry.js.map +1 -0
- package/dist/modes/interactive/components/custom-message.d.ts +2 -2
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/diff.d.ts.map +1 -1
- package/dist/modes/interactive/components/diff.js.map +1 -1
- package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -1
- package/dist/modes/interactive/components/earendil-announcement.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts +3 -1
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +26 -9
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-input.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts +2 -0
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +8 -3
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts +25 -0
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -0
- package/dist/modes/interactive/components/first-time-setup.js +103 -0
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -0
- package/dist/modes/interactive/components/footer.d.ts +4 -3
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +27 -7
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +33 -31
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js +2 -0
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts +5 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js +19 -5
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +12 -2
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +45 -11
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +2 -2
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +10 -6
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +18 -6
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +93 -25
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +5 -12
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +49 -31
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +2 -2
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +33 -14
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +17 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +301 -20
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts +28 -0
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -0
- package/dist/modes/interactive/components/status-indicator.js +60 -0
- package/dist/modes/interactive/components/status-indicator.js.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +1 -1
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +6 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +57 -14
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +137 -13
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/components/trust-selector.d.ts +23 -0
- package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/trust-selector.js +91 -0
- package/dist/modes/interactive/components/trust-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts +2 -2
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.js +8 -7
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts +6 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +22 -8
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +76 -19
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +1294 -494
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/model-search.d.ts +12 -0
- package/dist/modes/interactive/model-search.d.ts.map +1 -0
- package/dist/modes/interactive/model-search.js +15 -0
- package/dist/modes/interactive/model-search.js.map +1 -0
- package/dist/modes/interactive/theme/dark.json +5 -4
- package/dist/modes/interactive/theme/light.json +5 -4
- package/dist/modes/interactive/theme/theme-controller.d.ts +29 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-controller.js +102 -0
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.json +2 -1
- package/dist/modes/interactive/theme/theme.d.ts +41 -3
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +183 -106
- 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 +40 -20
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +30 -5
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +87 -8
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts +2 -2
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +113 -31
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +42 -4
- 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 +6 -2
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +504 -25
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/prompts/agents/build.md +38 -0
- package/dist/prompts/agents/plan.md +36 -0
- package/dist/prompts/agents/verify.md +36 -4
- package/dist/prompts/commands/brainstorm.md +162 -0
- package/dist/prompts/commands/discuss-phase.md +1 -1
- package/dist/prompts/commands/execute-phase.md +4 -1
- package/dist/prompts/commands/fix.md +12 -0
- package/dist/prompts/commands/init-project.md +1 -0
- package/dist/prompts/commands/map-codebase.md +15 -1
- package/dist/prompts/commands/new-project.md +1 -0
- package/dist/prompts/commands/next-milestone.md +2 -0
- package/dist/prompts/commands/orchestrate.md +4 -4
- package/dist/prompts/commands/plan-phase.md +5 -0
- package/dist/prompts/commands/quick.md +4 -0
- package/dist/prompts/commands/review.md +4 -1
- package/dist/prompts/commands/verify-work.md +10 -8
- package/dist/rpc-entry.d.ts +3 -0
- package/dist/rpc-entry.d.ts.map +1 -0
- package/dist/rpc-entry.js +10 -0
- package/dist/rpc-entry.js.map +1 -0
- package/dist/utils/ansi.d.ts +2 -0
- package/dist/utils/ansi.d.ts.map +1 -0
- package/dist/utils/ansi.js +52 -0
- package/dist/utils/ansi.js.map +1 -0
- package/dist/utils/changelog.d.ts +2 -1
- package/dist/utils/changelog.d.ts.map +1 -1
- package/dist/utils/changelog.js +78 -0
- package/dist/utils/changelog.js.map +1 -1
- package/dist/utils/child-process.d.ts +12 -5
- package/dist/utils/child-process.d.ts.map +1 -1
- package/dist/utils/child-process.js +33 -5
- package/dist/utils/child-process.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +2 -2
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard-native.d.ts +3 -1
- package/dist/utils/clipboard-native.d.ts.map +1 -1
- package/dist/utils/clipboard-native.js +14 -8
- package/dist/utils/clipboard-native.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +84 -45
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/deprecation.d.ts +4 -0
- package/dist/utils/deprecation.d.ts.map +1 -0
- package/dist/utils/deprecation.js +13 -0
- package/dist/utils/deprecation.js.map +1 -0
- package/dist/utils/exif-orientation.d.ts +1 -1
- package/dist/utils/exif-orientation.d.ts.map +1 -1
- package/dist/utils/exif-orientation.js.map +1 -1
- package/dist/utils/fs-watch.d.ts +5 -0
- package/dist/utils/fs-watch.d.ts.map +1 -0
- package/dist/utils/fs-watch.js +25 -0
- package/dist/utils/fs-watch.js.map +1 -0
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js +54 -22
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/html.d.ts +7 -0
- package/dist/utils/html.d.ts.map +1 -0
- package/dist/utils/html.js +40 -0
- package/dist/utils/html.js.map +1 -0
- package/dist/utils/image-convert.d.ts +1 -0
- package/dist/utils/image-convert.d.ts.map +1 -1
- package/dist/utils/image-convert.js +21 -15
- package/dist/utils/image-convert.js.map +1 -1
- package/dist/utils/image-process.d.ts +18 -0
- package/dist/utils/image-process.d.ts.map +1 -0
- package/dist/utils/image-process.js +83 -0
- package/dist/utils/image-process.js.map +1 -0
- package/dist/utils/image-resize-core.d.ts +30 -0
- package/dist/utils/image-resize-core.d.ts.map +1 -0
- package/dist/utils/image-resize-core.js +124 -0
- package/dist/utils/image-resize-core.js.map +1 -0
- package/dist/utils/image-resize-worker.d.ts +2 -0
- package/dist/utils/image-resize-worker.d.ts.map +1 -0
- package/dist/utils/image-resize-worker.js +31 -0
- package/dist/utils/image-resize-worker.js.map +1 -0
- package/dist/utils/image-resize.d.ts +7 -27
- package/dist/utils/image-resize.d.ts.map +1 -1
- package/dist/utils/image-resize.js +75 -115
- package/dist/utils/image-resize.js.map +1 -1
- package/dist/utils/json.d.ts +3 -0
- package/dist/utils/json.d.ts.map +1 -0
- package/dist/utils/json.js +7 -0
- package/dist/utils/json.js.map +1 -0
- package/dist/utils/mime.d.ts +1 -0
- package/dist/utils/mime.d.ts.map +1 -1
- package/dist/utils/mime.js +100 -16
- package/dist/utils/mime.js.map +1 -1
- package/dist/utils/open-browser.d.ts +9 -0
- package/dist/utils/open-browser.d.ts.map +1 -0
- package/dist/utils/open-browser.js +22 -0
- package/dist/utils/open-browser.js.map +1 -0
- package/dist/utils/paths.d.ts +25 -1
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +75 -2
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/pi-user-agent.d.ts +2 -0
- package/dist/utils/pi-user-agent.d.ts.map +1 -0
- package/dist/utils/pi-user-agent.js +5 -0
- package/dist/utils/pi-user-agent.js.map +1 -0
- package/dist/utils/shell.d.ts +11 -6
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +42 -26
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/syntax-highlight.d.ts +12 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -0
- package/dist/utils/syntax-highlight.js +118 -0
- package/dist/utils/syntax-highlight.js.map +1 -0
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +86 -10
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/version-check.d.ts +15 -0
- package/dist/utils/version-check.d.ts.map +1 -0
- package/dist/utils/version-check.js +59 -0
- package/dist/utils/version-check.js.map +1 -0
- package/dist/utils/windows-self-update.d.ts +3 -0
- package/dist/utils/windows-self-update.d.ts.map +1 -0
- package/dist/utils/windows-self-update.js +77 -0
- package/dist/utils/windows-self-update.js.map +1 -0
- package/docs/compaction.md +12 -12
- package/docs/containerization.md +111 -0
- package/docs/custom-provider.md +187 -47
- package/docs/development.md +5 -5
- package/docs/docs.json +156 -0
- package/docs/extensions.md +520 -79
- package/docs/index.md +82 -0
- package/docs/json.md +4 -4
- package/docs/keybindings.md +24 -2
- package/docs/models.md +119 -17
- package/docs/packages.md +19 -11
- package/docs/prompt-templates.md +30 -2
- package/docs/providers.md +85 -23
- package/docs/quickstart.md +165 -0
- package/docs/rpc.md +99 -10
- package/docs/sdk.md +118 -50
- package/docs/security.md +55 -0
- package/docs/{session.md → session-format.md} +29 -19
- package/docs/sessions.md +145 -0
- package/docs/settings.md +71 -11
- package/docs/skills.md +16 -17
- package/docs/terminal-setup.md +44 -2
- package/docs/termux.md +4 -4
- package/docs/themes.md +3 -3
- package/docs/tmux.md +4 -2
- package/docs/tui.md +44 -4
- package/docs/usage.md +305 -0
- package/examples/extensions/README.md +1 -0
- package/examples/extensions/border-status-editor.ts +145 -0
- package/examples/extensions/built-in-tool-renderer.ts +3 -0
- package/examples/extensions/custom-compaction.ts +2 -1
- package/examples/extensions/custom-header.ts +1 -1
- package/examples/extensions/custom-provider-anthropic/index.ts +2 -2
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +2 -2
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +63 -8
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +2 -2
- package/examples/extensions/doom-overlay/doom-component.ts +2 -2
- package/examples/extensions/doom-overlay/index.ts +1 -1
- package/examples/extensions/dynamic-resources/dynamic.json +1 -1
- package/examples/extensions/dynamic-tools.ts +2 -2
- package/examples/extensions/entry-renderer.ts +41 -0
- package/examples/extensions/git-merge-and-resolve.ts +115 -0
- package/examples/extensions/github-issue-autocomplete.ts +185 -0
- package/examples/extensions/gondolin/index.ts +531 -0
- package/examples/extensions/gondolin/package-lock.json +185 -0
- package/examples/extensions/gondolin/package.json +19 -0
- package/examples/extensions/handoff.ts +52 -14
- package/examples/extensions/input-transform-streaming.ts +39 -0
- package/examples/extensions/interactive-shell.ts +1 -1
- package/examples/extensions/notify.ts +2 -9
- package/examples/extensions/overlay-qa-tests.ts +240 -138
- package/examples/extensions/overlay-test.ts +7 -4
- package/examples/extensions/plan-mode/index.ts +87 -37
- package/examples/extensions/plan-mode/utils.ts +1 -1
- package/examples/extensions/preset.ts +46 -7
- package/examples/extensions/project-trust.ts +64 -0
- package/examples/extensions/prompt-customizer.ts +97 -0
- package/examples/extensions/provider-payload.ts +8 -4
- package/examples/extensions/qna.ts +3 -3
- package/examples/extensions/question.ts +34 -20
- package/examples/extensions/questionnaire.ts +43 -30
- package/examples/extensions/reload-runtime.ts +1 -1
- package/examples/extensions/sandbox/index.ts +6 -6
- package/examples/extensions/sandbox/package-lock.json +5 -5
- package/examples/extensions/sandbox/package.json +2 -2
- package/examples/extensions/shutdown-command.ts +1 -1
- package/examples/extensions/snake.ts +1 -1
- package/examples/extensions/space-invaders.ts +1 -1
- package/examples/extensions/structured-output.ts +65 -0
- package/examples/extensions/subagent/agents.ts +2 -2
- package/examples/extensions/subagent/index.ts +58 -29
- package/examples/extensions/summarize.ts +3 -2
- package/examples/extensions/tic-tac-toe.ts +1008 -0
- package/examples/extensions/titlebar-spinner.ts +2 -2
- package/examples/extensions/todo.ts +2 -2
- package/examples/extensions/tool-override.ts +1 -1
- package/examples/extensions/tools.ts +5 -0
- package/examples/extensions/truncated-tool.ts +1 -1
- package/examples/extensions/with-deps/index.ts +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +3 -3
- package/examples/extensions/working-indicator.ts +123 -0
- package/examples/extensions/working-message-test.ts +25 -0
- package/examples/sdk/01-minimal.ts +14 -10
- package/examples/sdk/02-custom-model.ts +13 -9
- package/examples/sdk/03-custom-prompt.ts +32 -17
- package/examples/sdk/04-skills.ts +5 -2
- package/examples/sdk/05-tools.ts +23 -31
- package/examples/sdk/06-extensions.ts +14 -8
- package/examples/sdk/07-context-files.ts +5 -3
- package/examples/sdk/08-prompt-templates.ts +5 -2
- package/examples/sdk/09-api-keys-and-oauth.ts +8 -4
- package/examples/sdk/10-settings.ts +8 -6
- package/examples/sdk/11-sessions.ts +4 -0
- package/examples/sdk/12-full-control.ts +15 -19
- package/package.json +22 -16
- package/prompts/agents/build.md +38 -0
- package/prompts/agents/plan.md +36 -0
- package/prompts/agents/verify.md +36 -4
- package/prompts/commands/brainstorm.md +162 -0
- package/prompts/commands/discuss-phase.md +1 -1
- package/prompts/commands/execute-phase.md +4 -1
- package/prompts/commands/fix.md +12 -0
- package/prompts/commands/init-project.md +1 -0
- package/prompts/commands/map-codebase.md +15 -1
- package/prompts/commands/new-project.md +1 -0
- package/prompts/commands/next-milestone.md +2 -0
- package/prompts/commands/orchestrate.md +4 -4
- package/prompts/commands/plan-phase.md +5 -0
- package/prompts/commands/quick.md +4 -0
- package/prompts/commands/review.md +4 -1
- package/prompts/commands/verify-work.md +10 -8
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import type { ExtensionAPI } from "@draht/coding-agent";
|
|
9
|
-
import { Editor, type EditorTheme, Key, matchesKey, Text,
|
|
10
|
-
import { Type } from "
|
|
9
|
+
import { Editor, type EditorTheme, Key, matchesKey, Text, visibleWidth, wrapTextWithAnsi } from "@draht/tui";
|
|
10
|
+
import { Type } from "typebox";
|
|
11
11
|
|
|
12
12
|
// Types
|
|
13
13
|
interface QuestionOption {
|
|
@@ -82,7 +82,7 @@ export default function questionnaire(pi: ExtensionAPI) {
|
|
|
82
82
|
parameters: QuestionnaireParams,
|
|
83
83
|
|
|
84
84
|
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
85
|
-
if (
|
|
85
|
+
if (ctx.mode !== "tui") {
|
|
86
86
|
return errorResult("Error: UI not available (running in non-interactive mode)");
|
|
87
87
|
}
|
|
88
88
|
if (params.questions.length === 0) {
|
|
@@ -259,13 +259,28 @@ export default function questionnaire(pi: ExtensionAPI) {
|
|
|
259
259
|
if (cachedLines) return cachedLines;
|
|
260
260
|
|
|
261
261
|
const lines: string[] = [];
|
|
262
|
+
const renderWidth = Math.max(1, width);
|
|
262
263
|
const q = currentQuestion();
|
|
263
264
|
const opts = currentOptions();
|
|
264
265
|
|
|
265
|
-
|
|
266
|
-
|
|
266
|
+
function addWrapped(text: string) {
|
|
267
|
+
lines.push(...wrapTextWithAnsi(text, renderWidth));
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
function addWrappedWithPrefix(prefix: string, text: string) {
|
|
271
|
+
const prefixWidth = visibleWidth(prefix);
|
|
272
|
+
if (prefixWidth >= renderWidth) {
|
|
273
|
+
addWrapped(prefix + text);
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
const wrapped = wrapTextWithAnsi(text, renderWidth - prefixWidth);
|
|
277
|
+
const continuationPrefix = " ".repeat(prefixWidth);
|
|
278
|
+
for (let i = 0; i < wrapped.length; i++) {
|
|
279
|
+
lines.push(`${i === 0 ? prefix : continuationPrefix}${wrapped[i]}`);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
267
282
|
|
|
268
|
-
|
|
283
|
+
lines.push(theme.fg("accent", "─".repeat(renderWidth)));
|
|
269
284
|
|
|
270
285
|
// Tab bar (multi-question only)
|
|
271
286
|
if (isMulti) {
|
|
@@ -287,7 +302,7 @@ export default function questionnaire(pi: ExtensionAPI) {
|
|
|
287
302
|
? theme.bg("selectedBg", theme.fg("text", submitText))
|
|
288
303
|
: theme.fg(canSubmit ? "success" : "dim", submitText);
|
|
289
304
|
tabs.push(`${submitStyled} →`);
|
|
290
|
-
|
|
305
|
+
addWrappedWithPrefix(" ", tabs.join(""));
|
|
291
306
|
lines.push("");
|
|
292
307
|
}
|
|
293
308
|
|
|
@@ -298,54 +313,52 @@ export default function questionnaire(pi: ExtensionAPI) {
|
|
|
298
313
|
const selected = i === optionIndex;
|
|
299
314
|
const isOther = opt.isOther === true;
|
|
300
315
|
const prefix = selected ? theme.fg("accent", "> ") : " ";
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
} else {
|
|
306
|
-
add(prefix + theme.fg(color, `${i + 1}. ${opt.label}`));
|
|
307
|
-
}
|
|
316
|
+
const label = `${i + 1}. ${opt.label}${isOther && inputMode ? " ✎" : ""}`;
|
|
317
|
+
const color = selected || (isOther && inputMode) ? "accent" : "text";
|
|
318
|
+
|
|
319
|
+
addWrappedWithPrefix(prefix, theme.fg(color, label));
|
|
308
320
|
if (opt.description) {
|
|
309
|
-
|
|
321
|
+
addWrappedWithPrefix(" ", theme.fg("muted", opt.description));
|
|
310
322
|
}
|
|
311
323
|
}
|
|
312
324
|
}
|
|
313
325
|
|
|
314
326
|
// Content
|
|
315
327
|
if (inputMode && q) {
|
|
316
|
-
|
|
328
|
+
addWrappedWithPrefix(" ", theme.fg("text", q.prompt));
|
|
317
329
|
lines.push("");
|
|
318
330
|
// Show options for reference
|
|
319
331
|
renderOptions();
|
|
320
332
|
lines.push("");
|
|
321
|
-
|
|
322
|
-
for (const line of editor.render(
|
|
323
|
-
|
|
333
|
+
addWrappedWithPrefix(" ", theme.fg("muted", "Your answer:"));
|
|
334
|
+
for (const line of editor.render(Math.max(1, renderWidth - 2))) {
|
|
335
|
+
lines.push(` ${line}`);
|
|
324
336
|
}
|
|
325
337
|
lines.push("");
|
|
326
|
-
|
|
338
|
+
addWrappedWithPrefix(" ", theme.fg("dim", "Enter to submit • Esc to cancel"));
|
|
327
339
|
} else if (currentTab === questions.length) {
|
|
328
|
-
|
|
340
|
+
addWrappedWithPrefix(" ", theme.fg("accent", theme.bold("Ready to submit")));
|
|
329
341
|
lines.push("");
|
|
330
342
|
for (const question of questions) {
|
|
331
343
|
const answer = answers.get(question.id);
|
|
332
344
|
if (answer) {
|
|
333
345
|
const prefix = answer.wasCustom ? "(wrote) " : "";
|
|
334
|
-
|
|
346
|
+
const summary = `${theme.fg("muted", `${question.label}: `)}${theme.fg("text", prefix + answer.label)}`;
|
|
347
|
+
addWrappedWithPrefix(" ", summary);
|
|
335
348
|
}
|
|
336
349
|
}
|
|
337
350
|
lines.push("");
|
|
338
351
|
if (allAnswered()) {
|
|
339
|
-
|
|
352
|
+
addWrappedWithPrefix(" ", theme.fg("success", "Press Enter to submit"));
|
|
340
353
|
} else {
|
|
341
354
|
const missing = questions
|
|
342
355
|
.filter((q) => !answers.has(q.id))
|
|
343
356
|
.map((q) => q.label)
|
|
344
357
|
.join(", ");
|
|
345
|
-
|
|
358
|
+
addWrappedWithPrefix(" ", theme.fg("warning", `Unanswered: ${missing}`));
|
|
346
359
|
}
|
|
347
360
|
} else if (q) {
|
|
348
|
-
|
|
361
|
+
addWrappedWithPrefix(" ", theme.fg("text", q.prompt));
|
|
349
362
|
lines.push("");
|
|
350
363
|
renderOptions();
|
|
351
364
|
}
|
|
@@ -353,11 +366,11 @@ export default function questionnaire(pi: ExtensionAPI) {
|
|
|
353
366
|
lines.push("");
|
|
354
367
|
if (!inputMode) {
|
|
355
368
|
const help = isMulti
|
|
356
|
-
? "
|
|
357
|
-
: "
|
|
358
|
-
|
|
369
|
+
? "Tab/←→ navigate • ↑↓ select • Enter confirm • Esc cancel"
|
|
370
|
+
: "↑↓ navigate • Enter select • Esc cancel";
|
|
371
|
+
addWrappedWithPrefix(" ", theme.fg("dim", help));
|
|
359
372
|
}
|
|
360
|
-
|
|
373
|
+
lines.push(theme.fg("accent", "─".repeat(renderWidth)));
|
|
361
374
|
|
|
362
375
|
cachedLines = lines;
|
|
363
376
|
return lines;
|
|
@@ -400,7 +413,7 @@ export default function questionnaire(pi: ExtensionAPI) {
|
|
|
400
413
|
let text = theme.fg("toolTitle", theme.bold("questionnaire "));
|
|
401
414
|
text += theme.fg("muted", `${count} question${count !== 1 ? "s" : ""}`);
|
|
402
415
|
if (labels) {
|
|
403
|
-
text += theme.fg("dim", ` (${
|
|
416
|
+
text += theme.fg("dim", ` (${labels})`);
|
|
404
417
|
}
|
|
405
418
|
return new Text(text, 0, 0);
|
|
406
419
|
},
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
* via `tool_call` input mutation without replacing the tool.
|
|
11
11
|
*
|
|
12
12
|
* Config files (merged, project takes precedence):
|
|
13
|
-
* - ~/.
|
|
14
|
-
* - <cwd>/.
|
|
13
|
+
* - ~/.pi/agent/extensions/sandbox.json (global)
|
|
14
|
+
* - <cwd>/.pi/sandbox.json (project-local)
|
|
15
15
|
*
|
|
16
16
|
* Example .pi/sandbox.json:
|
|
17
17
|
* ```json
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
* - `/sandbox` - show current sandbox configuration
|
|
36
36
|
*
|
|
37
37
|
* Setup:
|
|
38
|
-
* 1. Copy sandbox/ directory to ~/.
|
|
39
|
-
* 2. Run `npm install` in ~/.
|
|
38
|
+
* 1. Copy sandbox/ directory to ~/.pi/agent/extensions/
|
|
39
|
+
* 2. Run `npm install` in ~/.pi/agent/extensions/sandbox/
|
|
40
40
|
*
|
|
41
41
|
* Linux also requires: bubblewrap, socat, ripgrep
|
|
42
42
|
*/
|
|
@@ -46,7 +46,7 @@ import { existsSync, readFileSync } from "node:fs";
|
|
|
46
46
|
import { join } from "node:path";
|
|
47
47
|
import { SandboxManager, type SandboxRuntimeConfig } from "@anthropic-ai/sandbox-runtime";
|
|
48
48
|
import type { ExtensionAPI } from "@draht/coding-agent";
|
|
49
|
-
import { type BashOperations, createBashTool, getAgentDir } from "@draht/coding-agent";
|
|
49
|
+
import { type BashOperations, CONFIG_DIR_NAME, createBashTool, getAgentDir } from "@draht/coding-agent";
|
|
50
50
|
|
|
51
51
|
interface SandboxConfig extends SandboxRuntimeConfig {
|
|
52
52
|
enabled?: boolean;
|
|
@@ -77,7 +77,7 @@ const DEFAULT_CONFIG: SandboxConfig = {
|
|
|
77
77
|
};
|
|
78
78
|
|
|
79
79
|
function loadConfig(cwd: string): SandboxConfig {
|
|
80
|
-
const projectConfigPath = join(cwd,
|
|
80
|
+
const projectConfigPath = join(cwd, CONFIG_DIR_NAME, "sandbox.json");
|
|
81
81
|
const globalConfigPath = join(getAgentDir(), "extensions", "sandbox.json");
|
|
82
82
|
|
|
83
83
|
let globalConfig: Partial<SandboxConfig> = {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-sandbox",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.3",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-sandbox",
|
|
9
|
-
"version": "1.
|
|
9
|
+
"version": "1.10.3",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sandbox-runtime": "^0.0.26"
|
|
12
12
|
}
|
|
@@ -62,9 +62,9 @@
|
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
"node_modules/lodash-es": {
|
|
65
|
-
"version": "4.
|
|
66
|
-
"resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.
|
|
67
|
-
"integrity": "sha512-
|
|
65
|
+
"version": "4.18.1",
|
|
66
|
+
"resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.18.1.tgz",
|
|
67
|
+
"integrity": "sha512-J8xewKD/Gk22OZbhpOVSwcs60zhd95ESDwezOFuA3/099925PdHJ7OFHNTGtajL3AlZkykD32HykiMo+BIBI8A==",
|
|
68
68
|
"license": "MIT"
|
|
69
69
|
},
|
|
70
70
|
"node_modules/shell-quote": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-sandbox",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.10.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"clean": "echo 'nothing to clean'",
|
|
@@ -14,6 +14,6 @@
|
|
|
14
14
|
]
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@anthropic-ai/sandbox-runtime": "
|
|
17
|
+
"@anthropic-ai/sandbox-runtime": "0.0.26"
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -529,7 +529,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
529
529
|
description: "Play Space Invaders!",
|
|
530
530
|
|
|
531
531
|
handler: async (_args, ctx) => {
|
|
532
|
-
if (
|
|
532
|
+
if (ctx.mode !== "tui") {
|
|
533
533
|
ctx.ui.notify("Space Invaders requires interactive mode", "error");
|
|
534
534
|
return;
|
|
535
535
|
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured Output Tool
|
|
3
|
+
*
|
|
4
|
+
* Demonstrates `terminate: true` so the agent can end on a tool call
|
|
5
|
+
* without paying for an extra follow-up LLM turn.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { defineTool, type ExtensionAPI } from "@draht/coding-agent";
|
|
9
|
+
import { Text } from "@draht/tui";
|
|
10
|
+
import { Type } from "typebox";
|
|
11
|
+
|
|
12
|
+
interface StructuredOutputDetails {
|
|
13
|
+
headline: string;
|
|
14
|
+
summary: string;
|
|
15
|
+
actionItems: string[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const structuredOutputTool = defineTool({
|
|
19
|
+
name: "structured_output",
|
|
20
|
+
label: "Structured Output",
|
|
21
|
+
description:
|
|
22
|
+
"Return a final structured answer. Use this as your last action when the user asks for structured output or a machine-readable summary.",
|
|
23
|
+
promptSnippet: "Emit a final structured answer as a terminating tool result",
|
|
24
|
+
promptGuidelines: [
|
|
25
|
+
"Use structured_output as your final action when the user asks for structured output, JSON-like output, or a machine-readable summary.",
|
|
26
|
+
"After calling structured_output, do not emit another assistant response in the same turn.",
|
|
27
|
+
],
|
|
28
|
+
parameters: Type.Object({
|
|
29
|
+
headline: Type.String({ description: "Short title for the result" }),
|
|
30
|
+
summary: Type.String({ description: "One-paragraph summary" }),
|
|
31
|
+
actionItems: Type.Array(Type.String(), { description: "Concrete next steps or key bullets" }),
|
|
32
|
+
}),
|
|
33
|
+
|
|
34
|
+
async execute(_toolCallId, params) {
|
|
35
|
+
return {
|
|
36
|
+
content: [{ type: "text", text: `Saved structured output: ${params.headline}` }],
|
|
37
|
+
details: {
|
|
38
|
+
headline: params.headline,
|
|
39
|
+
summary: params.summary,
|
|
40
|
+
actionItems: params.actionItems,
|
|
41
|
+
} satisfies StructuredOutputDetails,
|
|
42
|
+
terminate: true,
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
renderResult(result, _options, theme) {
|
|
47
|
+
const details = result.details as StructuredOutputDetails | undefined;
|
|
48
|
+
if (!details) {
|
|
49
|
+
const text = result.content[0];
|
|
50
|
+
return new Text(text?.type === "text" ? text.text : "", 0, 0);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const lines = [
|
|
54
|
+
theme.fg("toolTitle", theme.bold(details.headline)),
|
|
55
|
+
theme.fg("text", details.summary),
|
|
56
|
+
"",
|
|
57
|
+
...details.actionItems.map((item, index) => theme.fg("muted", `${index + 1}. ${item}`)),
|
|
58
|
+
];
|
|
59
|
+
return new Text(lines.join("\n"), 0, 0);
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
export default function (pi: ExtensionAPI) {
|
|
64
|
+
pi.registerTool(structuredOutputTool);
|
|
65
|
+
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import * as fs from "node:fs";
|
|
6
6
|
import * as path from "node:path";
|
|
7
|
-
import { getAgentDir, parseFrontmatter } from "@draht/coding-agent";
|
|
7
|
+
import { CONFIG_DIR_NAME, getAgentDir, parseFrontmatter } from "@draht/coding-agent";
|
|
8
8
|
|
|
9
9
|
export type AgentScope = "user" | "project" | "both";
|
|
10
10
|
|
|
@@ -85,7 +85,7 @@ function isDirectory(p: string): boolean {
|
|
|
85
85
|
function findNearestProjectAgentsDir(cwd: string): string | null {
|
|
86
86
|
let currentDir = cwd;
|
|
87
87
|
while (true) {
|
|
88
|
-
const candidate = path.join(currentDir,
|
|
88
|
+
const candidate = path.join(currentDir, CONFIG_DIR_NAME, "agents");
|
|
89
89
|
if (isDirectory(candidate)) return candidate;
|
|
90
90
|
|
|
91
91
|
const parentDir = path.dirname(currentDir);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Subagent Tool - Delegate tasks to specialized agents
|
|
3
3
|
*
|
|
4
|
-
* Spawns a separate `
|
|
4
|
+
* Spawns a separate `pi` process for each subagent invocation,
|
|
5
5
|
* giving it an isolated context window.
|
|
6
6
|
*
|
|
7
7
|
* Supports three modes:
|
|
@@ -16,17 +16,24 @@ import { spawn } from "node:child_process";
|
|
|
16
16
|
import * as fs from "node:fs";
|
|
17
17
|
import * as os from "node:os";
|
|
18
18
|
import * as path from "node:path";
|
|
19
|
-
import type { AgentToolResult } from "@draht/agent";
|
|
19
|
+
import type { AgentToolResult } from "@draht/agent-core";
|
|
20
20
|
import type { Message } from "@draht/ai";
|
|
21
21
|
import { StringEnum } from "@draht/ai";
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
CONFIG_DIR_NAME,
|
|
24
|
+
type ExtensionAPI,
|
|
25
|
+
getAgentDir,
|
|
26
|
+
getMarkdownTheme,
|
|
27
|
+
withFileMutationQueue,
|
|
28
|
+
} from "@draht/coding-agent";
|
|
23
29
|
import { Container, Markdown, Spacer, Text } from "@draht/tui";
|
|
24
|
-
import { Type } from "
|
|
25
|
-
import { type AgentConfig, type AgentScope, discoverAgents } from "./agents.
|
|
30
|
+
import { Type } from "typebox";
|
|
31
|
+
import { type AgentConfig, type AgentScope, discoverAgents } from "./agents.ts";
|
|
26
32
|
|
|
27
33
|
const MAX_PARALLEL_TASKS = 8;
|
|
28
34
|
const MAX_CONCURRENCY = 4;
|
|
29
35
|
const COLLAPSED_ITEM_COUNT = 10;
|
|
36
|
+
const PER_TASK_OUTPUT_CAP = 50 * 1024;
|
|
30
37
|
|
|
31
38
|
function formatTokens(count: number): string {
|
|
32
39
|
if (count < 1000) return count.toString();
|
|
@@ -172,6 +179,28 @@ function getFinalOutput(messages: Message[]): string {
|
|
|
172
179
|
return "";
|
|
173
180
|
}
|
|
174
181
|
|
|
182
|
+
function isFailedResult(result: SingleResult): boolean {
|
|
183
|
+
return result.exitCode !== 0 || result.stopReason === "error" || result.stopReason === "aborted";
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function getResultOutput(result: SingleResult): string {
|
|
187
|
+
if (isFailedResult(result)) {
|
|
188
|
+
return result.errorMessage || result.stderr || getFinalOutput(result.messages) || "(no output)";
|
|
189
|
+
}
|
|
190
|
+
return getFinalOutput(result.messages) || "(no output)";
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function truncateParallelOutput(output: string): string {
|
|
194
|
+
const byteLength = Buffer.byteLength(output, "utf8");
|
|
195
|
+
if (byteLength <= PER_TASK_OUTPUT_CAP) return output;
|
|
196
|
+
|
|
197
|
+
let truncated = output.slice(0, PER_TASK_OUTPUT_CAP);
|
|
198
|
+
while (Buffer.byteLength(truncated, "utf8") > PER_TASK_OUTPUT_CAP) {
|
|
199
|
+
truncated = truncated.slice(0, -1);
|
|
200
|
+
}
|
|
201
|
+
return `${truncated}\n\n[Output truncated: ${byteLength - Buffer.byteLength(truncated, "utf8")} bytes omitted. Full output preserved in tool details.]`;
|
|
202
|
+
}
|
|
203
|
+
|
|
175
204
|
type DisplayItem = { type: "text"; text: string } | { type: "toolCall"; name: string; args: Record<string, any> };
|
|
176
205
|
|
|
177
206
|
function getDisplayItems(messages: Message[]): DisplayItem[] {
|
|
@@ -208,7 +237,7 @@ async function mapWithConcurrencyLimit<TIn, TOut>(
|
|
|
208
237
|
}
|
|
209
238
|
|
|
210
239
|
async function writePromptToTempFile(agentName: string, prompt: string): Promise<{ dir: string; filePath: string }> {
|
|
211
|
-
const tmpDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), "
|
|
240
|
+
const tmpDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), "pi-subagent-"));
|
|
212
241
|
const safeName = agentName.replace(/[^\w.-]+/g, "_");
|
|
213
242
|
const filePath = path.join(tmpDir, `prompt-${safeName}.md`);
|
|
214
243
|
await withFileMutationQueue(filePath, async () => {
|
|
@@ -219,7 +248,8 @@ async function writePromptToTempFile(agentName: string, prompt: string): Promise
|
|
|
219
248
|
|
|
220
249
|
function getPiInvocation(args: string[]): { command: string; args: string[] } {
|
|
221
250
|
const currentScript = process.argv[1];
|
|
222
|
-
|
|
251
|
+
const isBunVirtualScript = currentScript?.startsWith("/$bunfs/root/");
|
|
252
|
+
if (currentScript && !isBunVirtualScript && fs.existsSync(currentScript)) {
|
|
223
253
|
return { command: process.execPath, args: [currentScript, ...args] };
|
|
224
254
|
}
|
|
225
255
|
|
|
@@ -229,7 +259,7 @@ function getPiInvocation(args: string[]): { command: string; args: string[] } {
|
|
|
229
259
|
return { command: process.execPath, args };
|
|
230
260
|
}
|
|
231
261
|
|
|
232
|
-
return { command: "
|
|
262
|
+
return { command: "pi", args };
|
|
233
263
|
}
|
|
234
264
|
|
|
235
265
|
type OnUpdateCallback = (partial: AgentToolResult<SubagentDetails>) => void;
|
|
@@ -434,8 +464,8 @@ export default function (pi: ExtensionAPI) {
|
|
|
434
464
|
description: [
|
|
435
465
|
"Delegate tasks to specialized subagents with isolated context.",
|
|
436
466
|
"Modes: single (agent + task), parallel (tasks array), chain (sequential with {previous} placeholder).",
|
|
437
|
-
|
|
438
|
-
|
|
467
|
+
`Default agent scope is "user" (from ${path.join(getAgentDir(), "agents")}).`,
|
|
468
|
+
`To enable project-local agents in ${CONFIG_DIR_NAME}/agents, set agentScope: "both" (or "project").`,
|
|
439
469
|
].join(" "),
|
|
440
470
|
parameters: SubagentParams,
|
|
441
471
|
|
|
@@ -533,11 +563,9 @@ export default function (pi: ExtensionAPI) {
|
|
|
533
563
|
);
|
|
534
564
|
results.push(result);
|
|
535
565
|
|
|
536
|
-
const isError =
|
|
537
|
-
result.exitCode !== 0 || result.stopReason === "error" || result.stopReason === "aborted";
|
|
566
|
+
const isError = isFailedResult(result);
|
|
538
567
|
if (isError) {
|
|
539
|
-
const errorMsg =
|
|
540
|
-
result.errorMessage || result.stderr || getFinalOutput(result.messages) || "(no output)";
|
|
568
|
+
const errorMsg = getResultOutput(result);
|
|
541
569
|
return {
|
|
542
570
|
content: [{ type: "text", text: `Chain stopped at step ${i + 1} (${step.agent}): ${errorMsg}` }],
|
|
543
571
|
details: makeDetails("chain")(results),
|
|
@@ -616,17 +644,19 @@ export default function (pi: ExtensionAPI) {
|
|
|
616
644
|
return result;
|
|
617
645
|
});
|
|
618
646
|
|
|
619
|
-
const successCount = results.filter((r) => r
|
|
647
|
+
const successCount = results.filter((r) => !isFailedResult(r)).length;
|
|
620
648
|
const summaries = results.map((r) => {
|
|
621
|
-
const output =
|
|
622
|
-
const
|
|
623
|
-
|
|
649
|
+
const output = truncateParallelOutput(getResultOutput(r));
|
|
650
|
+
const status = isFailedResult(r)
|
|
651
|
+
? `failed${r.stopReason && r.stopReason !== "end" ? ` (${r.stopReason})` : ""}`
|
|
652
|
+
: "completed";
|
|
653
|
+
return `### [${r.agent}] ${status}\n\n${output}`;
|
|
624
654
|
});
|
|
625
655
|
return {
|
|
626
656
|
content: [
|
|
627
657
|
{
|
|
628
658
|
type: "text",
|
|
629
|
-
text: `Parallel: ${successCount}/${results.length} succeeded\n\n${summaries.join("\n\n")}`,
|
|
659
|
+
text: `Parallel: ${successCount}/${results.length} succeeded\n\n${summaries.join("\n\n---\n\n")}`,
|
|
630
660
|
},
|
|
631
661
|
],
|
|
632
662
|
details: makeDetails("parallel")(results),
|
|
@@ -645,10 +675,9 @@ export default function (pi: ExtensionAPI) {
|
|
|
645
675
|
onUpdate,
|
|
646
676
|
makeDetails("single"),
|
|
647
677
|
);
|
|
648
|
-
const isError = result
|
|
678
|
+
const isError = isFailedResult(result);
|
|
649
679
|
if (isError) {
|
|
650
|
-
const errorMsg =
|
|
651
|
-
result.errorMessage || result.stderr || getFinalOutput(result.messages) || "(no output)";
|
|
680
|
+
const errorMsg = getResultOutput(result);
|
|
652
681
|
return {
|
|
653
682
|
content: [{ type: "text", text: `Agent ${result.stopReason || "failed"}: ${errorMsg}` }],
|
|
654
683
|
details: makeDetails("single")([result]),
|
|
@@ -739,7 +768,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
739
768
|
|
|
740
769
|
if (details.mode === "single" && details.results.length === 1) {
|
|
741
770
|
const r = details.results[0];
|
|
742
|
-
const isError = r
|
|
771
|
+
const isError = isFailedResult(r);
|
|
743
772
|
const icon = isError ? theme.fg("error", "✗") : theme.fg("success", "✓");
|
|
744
773
|
const displayItems = getDisplayItems(r.messages);
|
|
745
774
|
const finalOutput = getFinalOutput(r.messages);
|
|
@@ -892,8 +921,8 @@ export default function (pi: ExtensionAPI) {
|
|
|
892
921
|
|
|
893
922
|
if (details.mode === "parallel") {
|
|
894
923
|
const running = details.results.filter((r) => r.exitCode === -1).length;
|
|
895
|
-
const successCount = details.results.filter((r) => r.exitCode
|
|
896
|
-
const failCount = details.results.filter((r) => r.exitCode
|
|
924
|
+
const successCount = details.results.filter((r) => r.exitCode !== -1 && !isFailedResult(r)).length;
|
|
925
|
+
const failCount = details.results.filter((r) => r.exitCode !== -1 && isFailedResult(r)).length;
|
|
897
926
|
const isRunning = running > 0;
|
|
898
927
|
const icon = isRunning
|
|
899
928
|
? theme.fg("warning", "⏳")
|
|
@@ -915,7 +944,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
915
944
|
);
|
|
916
945
|
|
|
917
946
|
for (const r of details.results) {
|
|
918
|
-
const rIcon = r
|
|
947
|
+
const rIcon = isFailedResult(r) ? theme.fg("error", "✗") : theme.fg("success", "✓");
|
|
919
948
|
const displayItems = getDisplayItems(r.messages);
|
|
920
949
|
const finalOutput = getFinalOutput(r.messages);
|
|
921
950
|
|
|
@@ -962,9 +991,9 @@ export default function (pi: ExtensionAPI) {
|
|
|
962
991
|
const rIcon =
|
|
963
992
|
r.exitCode === -1
|
|
964
993
|
? theme.fg("warning", "⏳")
|
|
965
|
-
: r
|
|
966
|
-
? theme.fg("
|
|
967
|
-
: theme.fg("
|
|
994
|
+
: isFailedResult(r)
|
|
995
|
+
? theme.fg("error", "✗")
|
|
996
|
+
: theme.fg("success", "✓");
|
|
968
997
|
const displayItems = getDisplayItems(r.messages);
|
|
969
998
|
text += `\n\n${theme.fg("muted", "─── ")}${theme.fg("accent", r.agent)} ${rIcon}`;
|
|
970
999
|
if (displayItems.length === 0)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { complete, getModel } from "@draht/ai";
|
|
1
|
+
import { complete, getModel } from "@draht/ai/compat";
|
|
2
2
|
import type { ExtensionAPI, ExtensionCommandContext } from "@draht/coding-agent";
|
|
3
3
|
import { DynamicBorder, getMarkdownTheme } from "@draht/coding-agent";
|
|
4
4
|
import { Container, Markdown, matchesKey, Text } from "@draht/tui";
|
|
@@ -115,7 +115,7 @@ const buildSummaryPrompt = (conversationText: string): string =>
|
|
|
115
115
|
].join("\n");
|
|
116
116
|
|
|
117
117
|
const showSummaryUi = async (summary: string, ctx: ExtensionCommandContext) => {
|
|
118
|
-
if (
|
|
118
|
+
if (ctx.mode !== "tui") {
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
121
|
|
|
@@ -191,6 +191,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
191
191
|
{
|
|
192
192
|
apiKey: auth.apiKey,
|
|
193
193
|
headers: auth.headers,
|
|
194
|
+
env: auth.env,
|
|
194
195
|
reasoningEffort: "high",
|
|
195
196
|
},
|
|
196
197
|
);
|