@draht/coding-agent 2026.11.5-1 → 2026.11.14-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 +66 -0
- package/dist/bundle/chunks/anthropic-messages-C5ZJVCKX.js +6 -0
- package/dist/bundle/chunks/{azure-openai-responses-NCMJPZVJ.js → azure-openai-responses-TNRID5YC.js} +1 -1
- package/dist/bundle/chunks/bedrock-converse-stream.js +2 -2
- package/dist/bundle/chunks/chunk-2CHTECAU.js +2 -0
- package/dist/bundle/chunks/{chunk-DWOGGNWY.js → chunk-2IQVBLH6.js} +1 -1
- package/dist/bundle/chunks/{chunk-P7O36UDU.js → chunk-4FPBO5KP.js} +5 -1
- package/dist/bundle/chunks/{chunk-Q2QKCYPU.js → chunk-5C4MAPF6.js} +1 -1
- package/dist/bundle/chunks/chunk-5WEOWREV.js +82 -0
- package/dist/bundle/chunks/{chunk-DN7SM3LX.js → chunk-ATYP3OSV.js} +3 -1
- package/dist/bundle/chunks/chunk-B6S2UR4T.js +2 -0
- package/dist/bundle/chunks/chunk-EBTEI43G.js +20 -0
- package/dist/bundle/chunks/{chunk-F5TDVH26.js → chunk-GAABJAG4.js} +12 -15
- package/dist/bundle/chunks/{chunk-PMINB7UH.js → chunk-JHKMYVPC.js} +169 -130
- package/dist/bundle/chunks/{chunk-EOXOMUKR.js → chunk-LCTFXH4P.js} +1 -1
- package/dist/bundle/chunks/{chunk-UFACUBF2.js → chunk-MPJIXESS.js} +1 -1
- package/dist/bundle/chunks/{chunk-PZKD35UB.js → chunk-MXA4WY3C.js} +1 -1
- package/dist/bundle/chunks/chunk-O2XYFH2E.js +30 -0
- package/dist/bundle/chunks/{chunk-CA23BDNK.js → chunk-OUXJRC2W.js} +1 -1
- package/dist/bundle/chunks/{chunk-3BJ462DN.js → chunk-RI7HJ6AF.js} +1 -1
- package/dist/bundle/chunks/chunk-RVXTPNXQ.js +44 -0
- package/dist/bundle/chunks/{chunk-QBUTRTYN.js → chunk-SXHVGWCU.js} +1 -1
- package/dist/bundle/chunks/chunk-WNZ64GW3.js +2 -0
- package/dist/bundle/chunks/chunk-XWZLYE4L.js +9 -0
- package/dist/bundle/chunks/{chunk-HJ3PS7QP.js → chunk-YSE3VKKB.js} +2 -2
- package/dist/bundle/chunks/{cli-4SUT6MJ6.js → cli-2QKCAPPD.js} +3 -3
- package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-BJVMNETD.js → cloudflare-workers-ai-system-one-UCG6T3XP.js} +1 -1
- package/dist/bundle/chunks/codemode-worker.js +2 -0
- package/dist/bundle/chunks/{execute-ZI7T2SUH.js → execute-KGJOWTPG.js} +2 -2
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/google-generative-ai-GPBKPOXA.js +2 -0
- package/dist/bundle/chunks/google-vertex-USZY53NF.js +2 -0
- package/dist/bundle/chunks/{llama-cpp-classify-L4URPZ4F.js → llama-cpp-classify-7DEQ4ZUF.js} +1 -1
- package/dist/bundle/chunks/{mistral-conversations-CK2BS74V.js → mistral-conversations-UOGXPDZ3.js} +1 -1
- package/dist/bundle/chunks/{openai-codex-responses-XGVNKP4D.js → openai-codex-responses-VUDXQ3EU.js} +1 -1
- package/dist/bundle/chunks/{openai-completions-72XZO4Q3.js → openai-completions-UQOOS7NM.js} +3 -3
- package/dist/bundle/chunks/{openai-decisions-P5OCXLLD.js → openai-decisions-24WNXO2R.js} +1 -1
- package/dist/bundle/chunks/{openai-responses-RGLZ4E3Q.js → openai-responses-5AF6MZ5L.js} +1 -1
- package/dist/bundle/chunks/{openrouter-images-LSBWMZDK.js → openrouter-images-OUXVVTYQ.js} +1 -1
- package/dist/bundle/chunks/{pi-messages-CL4MEVNS.js → pi-messages-DRMOEO6B.js} +1 -1
- package/dist/bundle/chunks/{runtime-FJYRBK3O.js → runtime-FZKS2BWI.js} +1 -1
- package/dist/bundle/chunks/{runtime-F4362CZF.js → runtime-L23MZBKL.js} +1 -1
- package/dist/bundle/chunks/{settings-manager-T6G6KKY3.js → settings-manager-CWRQW6PZ.js} +1 -1
- package/dist/bundle/chunks/{typesafe-system-one-BFYS6AEA.js → typesafe-system-one-K63EBJDD.js} +1 -1
- package/dist/bundle/chunks/virtual-modules-JZV35VDE.js +2 -0
- package/dist/bundle/cli-runtime.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +5 -3
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/auth-command.d.ts.map +1 -1
- package/dist/cli/auth-command.js +30 -6
- package/dist/cli/auth-command.js.map +1 -1
- package/dist/cli/auth-login.d.ts +15 -0
- package/dist/cli/auth-login.d.ts.map +1 -0
- package/dist/cli/auth-login.js +232 -0
- package/dist/cli/auth-login.js.map +1 -0
- package/dist/cli/auth-logout.d.ts +14 -0
- package/dist/cli/auth-logout.d.ts.map +1 -0
- package/dist/cli/auth-logout.js +57 -0
- package/dist/cli/auth-logout.js.map +1 -0
- package/dist/cli/auth-terminal.d.ts +17 -0
- package/dist/cli/auth-terminal.d.ts.map +1 -0
- package/dist/cli/auth-terminal.js +63 -0
- package/dist/cli/auth-terminal.js.map +1 -0
- package/dist/core/agent-session-runtime.d.ts +5 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +16 -2
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session.d.ts +20 -9
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +71 -29
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/ai-schemas.d.ts +1 -0
- package/dist/core/ai-schemas.d.ts.map +1 -1
- package/dist/core/builtins/budgets.d.ts.map +1 -1
- package/dist/core/builtins/budgets.js +6 -3
- package/dist/core/builtins/budgets.js.map +1 -1
- package/dist/core/cache-warmer.d.ts +4 -37
- package/dist/core/cache-warmer.d.ts.map +1 -1
- package/dist/core/cache-warmer.js +11 -91
- package/dist/core/cache-warmer.js.map +1 -1
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js +2 -1
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/exec.d.ts +1 -0
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js +4 -1
- package/dist/core/exec.js.map +1 -1
- package/dist/core/export-html/ansi-to-html.d.ts +5 -0
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
- package/dist/core/export-html/ansi-to-html.js +57 -20
- package/dist/core/export-html/ansi-to-html.js.map +1 -1
- package/dist/core/export-html/template.js +1 -1
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js +2 -3
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/extensions/types.d.ts +3 -2
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/model-config.d.ts +13 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-resolver.d.ts +0 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +17 -24
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts +5 -0
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +7 -0
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/polyphase/render/format.d.ts +2 -0
- package/dist/core/polyphase/render/format.d.ts.map +1 -1
- package/dist/core/polyphase/render/format.js +6 -0
- package/dist/core/polyphase/render/format.js.map +1 -1
- package/dist/core/polyphase/render/run-block.d.ts +4 -0
- package/dist/core/polyphase/render/run-block.d.ts.map +1 -1
- package/dist/core/polyphase/render/run-block.js +71 -12
- package/dist/core/polyphase/render/run-block.js.map +1 -1
- package/dist/core/polyphase/render/snapshot.d.ts +1 -1
- package/dist/core/polyphase/render/snapshot.d.ts.map +1 -1
- package/dist/core/polyphase/render/snapshot.js +22 -7
- package/dist/core/polyphase/render/snapshot.js.map +1 -1
- package/dist/core/polyphase/ui/dock.d.ts.map +1 -1
- package/dist/core/polyphase/ui/dock.js +34 -2
- package/dist/core/polyphase/ui/dock.js.map +1 -1
- package/dist/core/polyphase/ui/inspector.d.ts +18 -6
- package/dist/core/polyphase/ui/inspector.d.ts.map +1 -1
- package/dist/core/polyphase/ui/inspector.js +125 -44
- package/dist/core/polyphase/ui/inspector.js.map +1 -1
- package/dist/core/polyphase/ui/transcript-layout.d.ts.map +1 -1
- package/dist/core/polyphase/ui/transcript-layout.js +5 -1
- package/dist/core/polyphase/ui/transcript-layout.js.map +1 -1
- package/dist/core/preferred-providers.d.ts +17 -0
- package/dist/core/preferred-providers.d.ts.map +1 -0
- package/dist/core/preferred-providers.js +24 -0
- package/dist/core/preferred-providers.js.map +1 -0
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +18 -2
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +2 -0
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/provider-matching.d.ts +6 -0
- package/dist/core/provider-matching.d.ts.map +1 -0
- package/dist/core/provider-matching.js +8 -0
- package/dist/core/provider-matching.js.map +1 -0
- package/dist/core/radius-mcp.d.ts +13 -0
- package/dist/core/radius-mcp.d.ts.map +1 -0
- package/dist/core/radius-mcp.js +29 -0
- package/dist/core/radius-mcp.js.map +1 -0
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +2 -0
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/runtime-credentials.d.ts +8 -0
- package/dist/core/runtime-credentials.d.ts.map +1 -1
- package/dist/core/runtime-credentials.js +15 -1
- package/dist/core/runtime-credentials.js.map +1 -1
- package/dist/core/session-cwd.d.ts +7 -0
- package/dist/core/session-cwd.d.ts.map +1 -1
- package/dist/core/session-cwd.js +9 -1
- package/dist/core/session-cwd.js.map +1 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +45 -36
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-defaults.d.ts +1 -1
- package/dist/core/settings-defaults.d.ts.map +1 -1
- package/dist/core/settings-defaults.js +1 -1
- package/dist/core/settings-defaults.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +35 -5
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts +23 -14
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +182 -41
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +8 -7
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +57 -16
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts +4 -0
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +20 -8
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +4 -1
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/powershell.d.ts.map +1 -1
- package/dist/core/tools/powershell.js +15 -2
- package/dist/core/tools/powershell.js.map +1 -1
- package/dist/core/tools/read.d.ts +13 -0
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +146 -35
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/renderers/read.d.ts.map +1 -1
- package/dist/core/tools/renderers/read.js +6 -2
- package/dist/core/tools/renderers/read.js.map +1 -1
- package/dist/core/tools/truncate.d.ts +4 -0
- package/dist/core/tools/truncate.d.ts.map +1 -1
- package/dist/core/tools/truncate.js +24 -1
- package/dist/core/tools/truncate.js.map +1 -1
- package/dist/extensions/codemode/execute.js +4 -4
- package/dist/extensions/codemode/execute.js.map +1 -1
- package/dist/extensions/codemode/tool.d.ts.map +1 -1
- package/dist/extensions/codemode/tool.js +34 -12
- package/dist/extensions/codemode/tool.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts +1 -1
- package/dist/extensions/llama/provider.js +1 -1
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/extensions/llama/ui.d.ts.map +1 -1
- package/dist/extensions/llama/ui.js +15 -3
- package/dist/extensions/llama/ui.js.map +1 -1
- package/dist/extensions/mcp/cli.js +5 -8
- package/dist/extensions/mcp/cli.js.map +1 -1
- package/dist/extensions/mcp/index.d.ts.map +1 -1
- package/dist/extensions/mcp/index.js +2 -1
- package/dist/extensions/mcp/index.js.map +1 -1
- package/dist/extensions/mcp/runtime.d.ts.map +1 -1
- package/dist/extensions/mcp/runtime.js +3 -2
- package/dist/extensions/mcp/runtime.js.map +1 -1
- package/dist/extensions/tool-search/tool.d.ts.map +1 -1
- package/dist/extensions/tool-search/tool.js +18 -6
- package/dist/extensions/tool-search/tool.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +67 -15
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +2 -19
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +14 -6
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +10 -3
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +32 -5
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/provider-brand.d.ts +14 -0
- package/dist/modes/interactive/components/provider-brand.d.ts.map +1 -0
- package/dist/modes/interactive/components/provider-brand.js +66 -0
- package/dist/modes/interactive/components/provider-brand.js.map +1 -0
- package/dist/modes/interactive/components/radius-login-selector.d.ts +1 -2
- package/dist/modes/interactive/components/radius-login-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/radius-login-selector.js +6 -37
- package/dist/modes/interactive/components/radius-login-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +6 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +23 -5
- package/dist/modes/interactive/components/session-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 +3 -1
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +11 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +133 -78
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/session-share.js +2 -0
- package/dist/modes/interactive/session-share.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +27 -4
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/prompts/commands/test-audit.md +84 -0
- package/dist/utils/image-resize.d.ts.map +1 -1
- package/dist/utils/image-resize.js +3 -1
- package/dist/utils/image-resize.js.map +1 -1
- package/dist/utils/terminal-question.d.ts +8 -0
- package/dist/utils/terminal-question.d.ts.map +1 -0
- package/dist/utils/terminal-question.js +24 -0
- package/dist/utils/terminal-question.js.map +1 -0
- package/dist/utils/web-url.d.ts +12 -0
- package/dist/utils/web-url.d.ts.map +1 -0
- package/dist/utils/web-url.js +20 -0
- package/dist/utils/web-url.js.map +1 -0
- package/docs/cli.md +14 -1
- package/docs/extensions.md +6 -4
- package/docs/llama-cpp.md +5 -5
- package/docs/models-configuration.md +2 -1
- package/docs/nvidia-rtx-llama-cpp.md +5 -5
- package/docs/polyphase.md +13 -1
- package/docs/prompt-templates.md +1 -1
- package/docs/providers.md +4 -2
- package/docs/quickstart.md +1 -1
- package/docs/rpc-commands.md +1 -1
- package/docs/rpc.md +1 -1
- package/docs/sessions.md +7 -1
- package/docs/settings.md +1 -1
- package/docs/tui.md +1 -1
- package/examples/extensions/gondolin/index.ts +4 -7
- package/examples/extensions/subagent/index.ts +5 -1
- package/package.json +10 -10
- package/prompts/commands/test-audit.md +84 -0
- package/schemas/models.schema.json +5 -1
- package/schemas/settings.schema.json +1 -1
- package/dist/bundle/chunks/anthropic-messages-UJZ4SGHU.js +0 -6
- package/dist/bundle/chunks/chunk-AOCWORXE.js +0 -2
- package/dist/bundle/chunks/chunk-BK5LXGIH.js +0 -2
- package/dist/bundle/chunks/chunk-DQ4G4IS4.js +0 -20
- package/dist/bundle/chunks/chunk-SUVMF4W5.js +0 -2
- package/dist/bundle/chunks/chunk-VXO6B72D.js +0 -9
- package/dist/bundle/chunks/chunk-WXASQQBZ.js +0 -44
- package/dist/bundle/chunks/chunk-YD5VPPI4.js +0 -30
- package/dist/bundle/chunks/chunk-YWRWN7ZB.js +0 -82
- package/dist/bundle/chunks/google-generative-ai-N5IPPKQY.js +0 -2
- package/dist/bundle/chunks/google-vertex-A4BKUE4H.js +0 -2
- package/dist/bundle/chunks/virtual-modules-BPZIVXNK.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-resize.js","sourceRoot":"","sources":["../../src/utils/image-resize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EACN,iCAAiC,EAIjC,oBAAoB,GACpB,MAAM,wBAAwB,CAAC;AAIhC,SAAS,mBAAmB,CAAC,KAAiB;IAC7C,8EAA8E;IAC9E,yBAAyB;IACzB,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED,SAAS,2BAA2B,CAAC,KAAc;IAClD,OAAO,CACN,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAA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Aa,IAAI,MAAM,CAAC,cAAc,kBAAkB,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,MAAM,6BAA6B,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,6BAA6B,CAAC;AACnM,CAAC","sourcesContent":["import { Worker } from \"node:worker_threads\";\nimport {\n\tIMAGE_RESIZE_WORKER_RESPONSE_TYPE,\n\ttype ImageResizeOptions,\n\ttype ResizedImage,\n\ttype ResizeImageWorkerResponse,\n\tresizeImageInProcess,\n} from \"./image-resize-core.ts\";\n\nexport type { ImageResizeOptions, ResizedImage } from \"./image-resize-core.ts\";\n\nfunction toTransferableBytes(input: Uint8Array): Uint8Array<ArrayBuffer> {\n\t// Transfer detaches the buffer, so transfer a worker-owned copy and leave the\n\t// caller's bytes intact.\n\treturn new Uint8Array(input);\n}\n\nfunction isResizeImageWorkerResponse(value: unknown): value is ResizeImageWorkerResponse {\n\treturn (\n\t\tvalue !== null && typeof value === \"object\" && \"type\" in value && value.type === IMAGE_RESIZE_WORKER_RESPONSE_TYPE\n\t);\n}\n\nfunction createResizeWorker(workerSpecifier: string | URL): Worker {\n\treturn new Worker(workerSpecifier);\n}\n\nasync function resizeImageInWorker(\n\tworkerSpecifier: string | URL,\n\tinputBytes: Uint8Array,\n\tmimeType: string,\n\toptions?: ImageResizeOptions,\n): Promise<ResizedImage | null> {\n\tconst worker = createResizeWorker(workerSpecifier);\n\ttry {\n\t\tconst inputBytesForWorker = toTransferableBytes(inputBytes);\n\t\treturn await new Promise<ResizedImage | null>((resolve, reject) => {\n\t\t\tlet settled = false;\n\t\t\tconst settle = (result: ResizedImage | null): void => {\n\t\t\t\tif (settled) return;\n\t\t\t\tsettled = true;\n\t\t\t\tresolve(result);\n\t\t\t};\n\t\t\tconst fail = (error: Error): void => {\n\t\t\t\tif (settled) return;\n\t\t\t\tsettled = true;\n\t\t\t\treject(error);\n\t\t\t};\n\n\t\t\tworker.on(\"message\", (message: unknown) => {\n\t\t\t\t// Ignore messages Node posts on the worker channel itself, such as\n\t\t\t\t// `{ \"watch:require\": [...] }` under `node --watch` (nodejs/node#65044).\n\t\t\t\tif (!isResizeImageWorkerResponse(message)) return;\n\t\t\t\tif (\"error\" in message) fail(new Error(message.error));\n\t\t\t\telse settle(message.result);\n\t\t\t});\n\t\t\tworker.once(\"error\", fail);\n\t\t\tworker.once(\"exit\", (code) => {\n\t\t\t\tif (!settled) {\n\t\t\t\t\tfail(new Error(`Image resize worker exited with code ${code}`));\n\t\t\t\t}\n\t\t\t});\n\t\t\tworker.postMessage(\n\t\t\t\t{\n\t\t\t\t\tinputBytes: inputBytesForWorker,\n\t\t\t\t\tmimeType,\n\t\t\t\t\toptions,\n\t\t\t\t},\n\t\t\t\t[inputBytesForWorker.buffer],\n\t\t\t);\n\t\t});\n\t} finally {\n\t\t// Await termination so a serial resize never starts a worker while this one is\n\t\t// still shutting down; that overlap aborted the process on macOS with Node 24 (#10695).\n\t\tawait worker.terminate().catch(() => undefined);\n\t}\n}\n\n/**\n * Resize an image to fit within the specified max dimensions and encoded file size.\n * Runs Photon in a worker thread so WASM decoding, resizing, and encoding do not\n * block the TUI event loop. If the worker cannot be loaded (for example in some\n * Bun compiled executable layouts), fall back to in-process resizing so image\n * reads still work.\n */\nexport async function resizeImage(\n\tinputBytes: Uint8Array,\n\tmimeType: string,\n\toptions?: ImageResizeOptions,\n): Promise<ResizedImage | null> {\n\tconst isTypeScriptRuntime = import.meta.url.endsWith(\".ts\");\n\tconst workerUrl = new URL(\n\t\tisTypeScriptRuntime ? \"./image-resize-worker.ts\" : \"./image-resize-worker.js\",\n\t\timport.meta.url,\n\t);\n\n\t// Bun compiled executables resolve worker entrypoints by string path, not via\n\t// new URL(..., import.meta.url). Try the string path first under Bun so the\n\t// release binary uses the embedded worker instead of falling back in-process.\n\tif (typeof process.versions.bun === \"string\") {\n\t\ttry {\n\t\t\treturn await resizeImageInWorker(\"./src/utils/image-resize-worker.ts\", inputBytes, mimeType, options);\n\t\t} catch {}\n\t}\n\n\ttry {\n\t\treturn await resizeImageInWorker(workerUrl, inputBytes, mimeType, options);\n\t} catch {\n\t\treturn resizeImageInProcess(inputBytes, mimeType, options);\n\t}\n}\n\n/**\n * Format a dimension note for resized images.\n * This helps the model understand the coordinate mapping.\n */\nexport function formatDimensionNote(result: ResizedImage): string | undefined {\n\tif (!result.wasResized) {\n\t\treturn undefined;\n\t}\n\n\tconst scale = result.originalWidth / result.width;\n\treturn `[Image: original ${result.originalWidth}x${result.originalHeight}, displayed at ${result.width}x${result.height}. Multiply coordinates by ${scale.toFixed(2)} to map to original image.]`;\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Read one line from stdin, rejecting on abort, Ctrl+C, or EOF and always closing readline. */
|
|
2
|
+
export declare function questionTerminal(message: string, options: {
|
|
3
|
+
output: NodeJS.WritableStream;
|
|
4
|
+
signal: AbortSignal;
|
|
5
|
+
/** Called on Ctrl+C or EOF, not when the caller aborts just this prompt. */
|
|
6
|
+
onInterrupt?: () => void;
|
|
7
|
+
}): Promise<string>;
|
|
8
|
+
//# sourceMappingURL=terminal-question.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal-question.d.ts","sourceRoot":"","sources":["../../src/utils/terminal-question.ts"],"names":[],"mappings":"AAEA,gGAAgG;AAChG,wBAAsB,gBAAgB,CACrC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;IACR,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC;IAC9B,MAAM,EAAE,WAAW,CAAC;IACpB,4EAA4E;IAC5E,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB,GACC,OAAO,CAAC,MAAM,CAAC,CAiBjB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createInterface } from "node:readline/promises";
|
|
2
|
+
/** Read one line from stdin, rejecting on abort, Ctrl+C, or EOF and always closing readline. */
|
|
3
|
+
export async function questionTerminal(message, options) {
|
|
4
|
+
const readline = createInterface({ input: process.stdin, output: options.output });
|
|
5
|
+
const interrupted = new AbortController();
|
|
6
|
+
// EOF closes readline without settling its pending question; Ctrl+C normally only pauses it.
|
|
7
|
+
const onInterrupt = () => interrupted.abort();
|
|
8
|
+
readline.on("SIGINT", onInterrupt);
|
|
9
|
+
readline.on("close", onInterrupt);
|
|
10
|
+
try {
|
|
11
|
+
return await readline.question(message, { signal: AbortSignal.any([options.signal, interrupted.signal]) });
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
if (interrupted.signal.aborted)
|
|
15
|
+
options.onInterrupt?.();
|
|
16
|
+
throw error;
|
|
17
|
+
}
|
|
18
|
+
finally {
|
|
19
|
+
readline.off("close", onInterrupt);
|
|
20
|
+
readline.off("SIGINT", onInterrupt);
|
|
21
|
+
readline.close();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=terminal-question.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal-question.js","sourceRoot":"","sources":["../../src/utils/terminal-question.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,gGAAgG;AAChG,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACrC,OAAe,EACf,OAKC;IAED,MAAM,QAAQ,GAAG,eAAe,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACnF,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;IAC1C,6FAA6F;IAC7F,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;IAC9C,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACnC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAClC,IAAI,CAAC;QACJ,OAAO,MAAM,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;IAC5G,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,IAAI,WAAW,CAAC,MAAM,CAAC,OAAO;YAAE,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;QACxD,MAAM,KAAK,CAAC;IACb,CAAC;YAAS,CAAC;QACV,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QACnC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QACpC,QAAQ,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;AACF,CAAC","sourcesContent":["import { createInterface } from \"node:readline/promises\";\n\n/** Read one line from stdin, rejecting on abort, Ctrl+C, or EOF and always closing readline. */\nexport async function questionTerminal(\n\tmessage: string,\n\toptions: {\n\t\toutput: NodeJS.WritableStream;\n\t\tsignal: AbortSignal;\n\t\t/** Called on Ctrl+C or EOF, not when the caller aborts just this prompt. */\n\t\tonInterrupt?: () => void;\n\t},\n): Promise<string> {\n\tconst readline = createInterface({ input: process.stdin, output: options.output });\n\tconst interrupted = new AbortController();\n\t// EOF closes readline without settling its pending question; Ctrl+C normally only pauses it.\n\tconst onInterrupt = () => interrupted.abort();\n\treadline.on(\"SIGINT\", onInterrupt);\n\treadline.on(\"close\", onInterrupt);\n\ttry {\n\t\treturn await readline.question(message, { signal: AbortSignal.any([options.signal, interrupted.signal]) });\n\t} catch (error) {\n\t\tif (interrupted.signal.aborted) options.onInterrupt?.();\n\t\tthrow error;\n\t} finally {\n\t\treadline.off(\"close\", onInterrupt);\n\t\treadline.off(\"SIGINT\", onInterrupt);\n\t\treadline.close();\n\t}\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `http:` or `https:` URL `value` names, normalized, or undefined. The shared launcher also opens files and custom
|
|
3
|
+
* protocols, so login only opens web URLs. Normalizing percent-encodes control characters, which would otherwise end a
|
|
4
|
+
* terminal hyperlink early.
|
|
5
|
+
*/
|
|
6
|
+
export declare function webUrl(value: string): string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* `value` normalized as a web URL, else with control characters replaced: an untrusted string printed as is could end a
|
|
9
|
+
* hyperlink early or send its own escape sequences to the terminal.
|
|
10
|
+
*/
|
|
11
|
+
export declare function displayUrl(value: string): string;
|
|
12
|
+
//# sourceMappingURL=web-url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-url.d.ts","sourceRoot":"","sources":["../../src/utils/web-url.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAIxD;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEhD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { replaceControlCharacters } from "@draht/tui";
|
|
2
|
+
/**
|
|
3
|
+
* The `http:` or `https:` URL `value` names, normalized, or undefined. The shared launcher also opens files and custom
|
|
4
|
+
* protocols, so login only opens web URLs. Normalizing percent-encodes control characters, which would otherwise end a
|
|
5
|
+
* terminal hyperlink early.
|
|
6
|
+
*/
|
|
7
|
+
export function webUrl(value) {
|
|
8
|
+
if (!URL.canParse(value))
|
|
9
|
+
return undefined;
|
|
10
|
+
const url = new URL(value);
|
|
11
|
+
return url.protocol === "https:" || url.protocol === "http:" ? url.href : undefined;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* `value` normalized as a web URL, else with control characters replaced: an untrusted string printed as is could end a
|
|
15
|
+
* hyperlink early or send its own escape sequences to the terminal.
|
|
16
|
+
*/
|
|
17
|
+
export function displayUrl(value) {
|
|
18
|
+
return webUrl(value) ?? replaceControlCharacters(value);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=web-url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-url.js","sourceRoot":"","sources":["../../src/utils/web-url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAEtD;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAC,KAAa;IACnC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC3C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IAC3B,OAAO,GAAG,CAAC,QAAQ,KAAK,QAAQ,IAAI,GAAG,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AACrF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa;IACvC,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,wBAAwB,CAAC,KAAK,CAAC,CAAC;AACzD,CAAC","sourcesContent":["import { replaceControlCharacters } from \"@draht/tui\";\n\n/**\n * The `http:` or `https:` URL `value` names, normalized, or undefined. The shared launcher also opens files and custom\n * protocols, so login only opens web URLs. Normalizing percent-encodes control characters, which would otherwise end a\n * terminal hyperlink early.\n */\nexport function webUrl(value: string): string | undefined {\n\tif (!URL.canParse(value)) return undefined;\n\tconst url = new URL(value);\n\treturn url.protocol === \"https:\" || url.protocol === \"http:\" ? url.href : undefined;\n}\n\n/**\n * `value` normalized as a web URL, else with control characters replaced: an untrusted string printed as is could end a\n * hyperlink early or send its own escape sequences to the terminal.\n */\nexport function displayUrl(value: string): string {\n\treturn webUrl(value) ?? replaceControlCharacters(value);\n}\n"]}
|
package/docs/cli.md
CHANGED
|
@@ -12,6 +12,8 @@ draht uninstall <source> [options]
|
|
|
12
12
|
draht update [target] [options]
|
|
13
13
|
draht list
|
|
14
14
|
draht config [options]
|
|
15
|
+
draht auth login <provider> [--api-key] [--no-browser]
|
|
16
|
+
draht auth logout <provider>
|
|
15
17
|
draht auth <check|print-api-key|print-bearer-token> [options]
|
|
16
18
|
draht mcp <add|remove|list|login|logout> [options]
|
|
17
19
|
draht checkpoint prune [--days <n>] [--max-per-session <n>] [--dry-run]
|
|
@@ -319,11 +321,22 @@ export DRAHT_SELF_UPDATE_COMMAND="mise use -g npm:{packageName}@{version}"
|
|
|
319
321
|
|
|
320
322
|
## Credential commands
|
|
321
323
|
|
|
324
|
+
`draht auth login <provider>` logs in to a provider in the terminal and exits, without starting a session. It signs in with an account and opens the browser, like `/login <provider>`. Providers without account sign-in ask for an API key. Logging in to Radius also adds the Radius MCP server to `~/.draht/agent/mcp.json` when no global server uses that login yet. It requires an interactive terminal.
|
|
325
|
+
|
|
326
|
+
| Option | Description |
|
|
327
|
+
|---|---|
|
|
328
|
+
| `--api-key` | Save an API key instead of signing in with an account; the key is read without echoing it |
|
|
329
|
+
| `--no-browser` | Do not open a browser; use the provider's other sign-in method, such as a device code, for example over SSH. Asks when there are several. Not allowed with `--api-key` |
|
|
330
|
+
|
|
331
|
+
`draht auth logout <provider>` removes the credentials that `draht auth login` or `/login` stored, like `/logout`. Environment variables and `models.json` config are unchanged. It exits with status `0` when nothing is stored, so it is safe to repeat.
|
|
332
|
+
|
|
322
333
|
```sh
|
|
334
|
+
draht auth login radius
|
|
335
|
+
draht auth logout radius
|
|
323
336
|
draht auth check --provider openai --json
|
|
324
337
|
```
|
|
325
338
|
|
|
326
|
-
|
|
339
|
+
The other authentication commands require `--provider <provider>` or `--model <model>`. See [Providers](providers.md) for supported methods.
|
|
327
340
|
|
|
328
341
|
| Command | Description |
|
|
329
342
|
|---|---|
|
package/docs/extensions.md
CHANGED
|
@@ -1915,7 +1915,7 @@ const result = await pi.exec("git", ["status"], { signal, timeout: 5000 });
|
|
|
1915
1915
|
// result.stdout, result.stderr, result.code, result.killed, result.truncated
|
|
1916
1916
|
```
|
|
1917
1917
|
|
|
1918
|
-
Options: `signal` and `timeout` terminate the command, `cwd` sets the working directory, and `maxBuffer` limits stdout and stderr combined (default 256 MiB). When output exceeds `maxBuffer`, draht terminates the command and returns the output up to the limit with `truncated: true`, `killed: true`, and a nonzero `code`. `killed` is true whenever draht terminated the command: timeout, abort, or `maxBuffer`. A command that ignores SIGTERM gets SIGKILL after 5 seconds.
|
|
1918
|
+
Options: `signal` and `timeout` terminate the command, `cwd` sets the working directory, and `maxBuffer` limits stdout and stderr combined (default 256 MiB). When output exceeds `maxBuffer`, draht terminates the command and returns the output up to the limit with `truncated: true`, `killed: true`, and a nonzero `code`. `killed` is true whenever draht terminated the command: timeout, abort, or `maxBuffer`. A command that ignores SIGTERM gets SIGKILL after 5 seconds. A command terminated by a signal, by draht or otherwise, reports 128 + the signal number as `code`, like a shell: 143 for SIGTERM, 137 for SIGKILL.
|
|
1919
1919
|
|
|
1920
1920
|
### pi.getActiveTools() / pi.getAllTools() / pi.setActiveTools(names)
|
|
1921
1921
|
|
|
@@ -2001,7 +2001,7 @@ import { createProvider, openAICompletionsApi } from "@draht/ai/compat";
|
|
|
2001
2001
|
const provider = createProvider({
|
|
2002
2002
|
id: "local-server",
|
|
2003
2003
|
name: "Local Server",
|
|
2004
|
-
baseUrl: "http://localhost:
|
|
2004
|
+
baseUrl: "http://localhost:9931/v1",
|
|
2005
2005
|
auth: {
|
|
2006
2006
|
apiKey: {
|
|
2007
2007
|
name: "Local server setup",
|
|
@@ -2045,11 +2045,11 @@ pi.registerProvider("my-proxy", {
|
|
|
2045
2045
|
|
|
2046
2046
|
// Register a live llama.cpp catalog without persisting discovered models
|
|
2047
2047
|
pi.registerProvider("llama.cpp", {
|
|
2048
|
-
baseUrl: "http://localhost:
|
|
2048
|
+
baseUrl: "http://localhost:9931/v1",
|
|
2049
2049
|
apiKey: "local",
|
|
2050
2050
|
api: "openai-completions",
|
|
2051
2051
|
async refreshModels({ signal }) {
|
|
2052
|
-
const response = await fetch("http://localhost:
|
|
2052
|
+
const response = await fetch("http://localhost:9931/v1/models", { signal });
|
|
2053
2053
|
const { data } = (await response.json()) as { data: Array<{ id: string }> };
|
|
2054
2054
|
return data.map(({ id }) => ({
|
|
2055
2055
|
id,
|
|
@@ -2426,6 +2426,8 @@ pi.registerTool({
|
|
|
2426
2426
|
});
|
|
2427
2427
|
```
|
|
2428
2428
|
|
|
2429
|
+
`ReadOperations.createReadStream` is optional. When it returns the file as an async iterable of chunks (a Node `Readable` works), `read` keeps only the lines it shows in memory, so large files can be read with `offset`/`limit`; without it, `read` loads the whole file through `readFile`.
|
|
2430
|
+
|
|
2429
2431
|
The `create*ToolDefinition()` factories, such as `createReadToolDefinition()`, return complete tool definitions, including the built-in prompt snippet and guidelines, for the same purpose. Rendering does not need copying: a tool registered under a built-in name inherits the built-in renderer for each slot it leaves out (see [Overriding Built-in Tools](#overriding-built-in-tools)).
|
|
2430
2432
|
|
|
2431
2433
|
**Operations interfaces:** `ReadOperations`, `WriteOperations`, `EditOperations`, `BashOperations`, `PowerShellOperations`, `LsOperations`, `GrepOperations`, `FindOperations`
|
package/docs/llama-cpp.md
CHANGED
|
@@ -13,7 +13,7 @@ curl -LsSf https://llama.app/install.sh | sh
|
|
|
13
13
|
Verify the installation:
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
llama
|
|
16
|
+
llama --version
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
See [llama.app](https://llama.app) for other installation methods, including package managers and building from source.
|
|
@@ -59,14 +59,14 @@ Start draht and configure the provider:
|
|
|
59
59
|
/login llama.cpp
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
Enter the router URL and optional API key. The default URL is `http://127.0.0.1:
|
|
62
|
+
Enter the router URL and optional API key. The default URL is `http://127.0.0.1:9931`.
|
|
63
63
|
|
|
64
64
|
If you start the router with `--no-models-autoload`, `/login llama.cpp` only stores the connection. Run `/llama` to load a model, then `/model` to select the loaded model for the current session.
|
|
65
65
|
|
|
66
66
|
Environment variables can configure the same values without `/login`:
|
|
67
67
|
|
|
68
68
|
```bash
|
|
69
|
-
export LLAMA_BASE_URL=http://127.0.0.1:
|
|
69
|
+
export LLAMA_BASE_URL=http://127.0.0.1:9931
|
|
70
70
|
export LLAMA_API_KEY=optional-secret
|
|
71
71
|
draht
|
|
72
72
|
```
|
|
@@ -117,8 +117,8 @@ The model does not generate an answer. Each question becomes one chat prompt: th
|
|
|
117
117
|
Check that the router is reachable:
|
|
118
118
|
|
|
119
119
|
```bash
|
|
120
|
-
curl http://127.0.0.1:
|
|
121
|
-
curl http://127.0.0.1:
|
|
120
|
+
curl http://127.0.0.1:9931/health
|
|
121
|
+
curl http://127.0.0.1:9931/models
|
|
122
122
|
```
|
|
123
123
|
|
|
124
124
|
- **No models in `/llama`:** Check `--models-dir`, the directory layout, and restart the router.
|
|
@@ -119,6 +119,7 @@ See [Describe model input and caching](models.md#describe-model-input-and-cachin
|
|
|
119
119
|
| `requiresToolResultName` | boolean | | Whether tool results require the name field. Default: auto-detected from URL. |
|
|
120
120
|
| `requiresAssistantAfterToolResult` | boolean | | Whether a user message after tool results requires an assistant message in between. Default: auto-detected from URL. |
|
|
121
121
|
| `requiresNonNullAssistantContent` | boolean | | Whether replayed assistant messages with no text (e.g. tool-call-only messages) must send "" instead of null content. Default: false. |
|
|
122
|
+
| `requiresToolsWithToolHistory` | boolean | | Whether requests without tools must send "tools": [] when the conversation contains tool calls or tool results. Needed by some proxies in front of Anthropic, such as older LiteLLM versions. Default: false, the field is omitted. |
|
|
122
123
|
| `requiresThinkingAsText` | boolean | | Whether thinking blocks must be converted to text blocks with <thinking> delimiters. Default: auto-detected from URL. |
|
|
123
124
|
| `requiresReasoningContentOnAssistantMessages` | boolean | | Whether all replayed assistant messages must include an empty reasoning_content field when reasoning is enabled. Default: auto-detected from URL. |
|
|
124
125
|
| `thinkingFormat` | `"openai" \| "openrouter" \| "deepseek" \| "together" \| "baseten" \| "zai" \| "qwen" \| "chat-template" \| "qwen-chat-template" \| "string-thinking" \| "ant-ling"` | | Format for reasoning or thinking parameters. When omitted, draht auto-detects the format from the provider URL. "openai" uses reasoning_effort, "openrouter" uses reasoning.effort, "deepseek" uses thinking.type plus reasoning_effort when supported, "together" uses reasoning.enabled plus reasoning_effort when supported, "baseten" uses configurable chat_template_args plus reasoning_effort when supported, "zai" uses thinking.type, "qwen" uses top-level enable_thinking, "qwen-chat-template" uses chat_template_kwargs.enable_thinking and preserve_thinking, "chat-template" uses configurable chat_template_kwargs, "string-thinking" uses top-level thinking, and "ant-ling" uses reasoning.effort only when the mapped effort is non-null. |
|
|
@@ -175,7 +176,7 @@ Also applies to `azure-openai-responses` and `openai-codex-responses`.
|
|
|
175
176
|
| `supportsMidConvoEffort` | boolean | `false` | Whether the exact model transport supports effort-only system messages and thinking binding controls. |
|
|
176
177
|
| `supportsMidConvoSystemMessages` | boolean | `false` | Whether the exact model accepts system-role messages inside the conversation. When false, later system messages are folded into the top-level system prompt. |
|
|
177
178
|
| `supportsMidConvoToolChanges` | boolean | `false` | Whether the exact model accepts mid-conversation tool_addition and tool_removal blocks. Requires supportsMidConvoSystemMessages. |
|
|
178
|
-
| `supportsMessageThreads` | boolean | | Whether the endpoint supports Anthropic message threads, which let a request with a session id send only the new messages and continue from the previous reply. Default: true for
|
|
179
|
+
| `supportsMessageThreads` | boolean | | Whether the endpoint supports Anthropic message threads, which let a request with a session id send only the new messages and continue from the previous reply. Default: true for a baseUrl on api.anthropic.com, false otherwise. Set true for gateways that forward the thread request field. |
|
|
179
180
|
| `allowedFallbackModels` | `object[]` | | Models Anthropic accepts for server-side refusal fallback, with local pricing metadata for returned fallback responses. When absent or empty, callers must omit fallbacks; Anthropic rejects the field for models with no permitted fallback targets. |
|
|
180
181
|
|
|
181
182
|
### `bedrock-converse-stream`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Run draht with NVIDIA RTX and llama.cpp
|
|
2
2
|
|
|
3
|
-
[NVIDIA Local AI Inference Recipes](https://nvidia.github.io/local-ai-inference-recipes/index.html) provides llama.cpp settings tuned for specific NVIDIA hardware and models. Each recipe gives a single-model `llama-server` command. draht works with the llama.cpp router, which can serve and manage several models, so this guide converts the recipe command into a router preset
|
|
3
|
+
[NVIDIA Local AI Inference Recipes](https://nvidia.github.io/local-ai-inference-recipes/index.html) provides llama.cpp settings tuned for specific NVIDIA hardware and models. Each recipe gives a single-model `llama-server` command. draht works with the llama.cpp router, which can serve and manage several models, so this guide converts the recipe command into a router preset and starts it with `llama serve`. `llama serve` accepts the same options as `llama-server`.
|
|
4
4
|
|
|
5
5
|
The examples below use Windows PowerShell. See [Local Models with llama.cpp](llama-cpp.md) for draht's complete router and model-management reference.
|
|
6
6
|
|
|
@@ -8,12 +8,12 @@ The examples below use Windows PowerShell. See [Local Models with llama.cpp](lla
|
|
|
8
8
|
|
|
9
9
|
1. Open the [recipe catalog](https://nvidia.github.io/local-ai-inference-recipes/index.html), select your hardware, operating system, and model, then choose **llama.cpp**. Check the prerequisites and memory requirements. Keep the recipe's launch command for the conversion below.
|
|
10
10
|
2. Install llama.cpp with the recipe's setup instructions. The recipe's settings depend on its build, for example CUDA support or speculative decoding options.
|
|
11
|
-
3. Run `llama
|
|
11
|
+
3. Run `llama serve --help` and check that it lists `--models-preset`. If the build has no `llama` program or the option is missing, it cannot load the recipe as a router preset. Use a newer build that still meets the recipe's requirements.
|
|
12
12
|
4. Install draht with the [Quickstart](quickstart.md). On native Windows, also see [Run draht on Windows](windows.md).
|
|
13
13
|
|
|
14
14
|
## Convert the recipe to a preset
|
|
15
15
|
|
|
16
|
-
A preset lists the settings for one or more models. Each section name becomes the model ID shown in draht. Save the preset
|
|
16
|
+
A preset lists the settings for one or more models. Each section name becomes the model ID shown in draht. Save the preset in the llama.cpp folder, or pass its full path when starting the router.
|
|
17
17
|
|
|
18
18
|
Convert each option from the recipe command into one preset line:
|
|
19
19
|
|
|
@@ -82,7 +82,7 @@ spec-draft-backend-sampling = true
|
|
|
82
82
|
Open PowerShell in the llama.cpp folder and run:
|
|
83
83
|
|
|
84
84
|
```powershell
|
|
85
|
-
.\llama
|
|
85
|
+
.\llama.exe serve --models-preset qwen3.8-27b.ini --host 127.0.0.1
|
|
86
86
|
```
|
|
87
87
|
|
|
88
88
|
If the recipe requires a Hugging Face token, set `$env:HF_TOKEN` in the same PowerShell window before starting the router. On its first start, the router downloads the model files.
|
|
@@ -91,6 +91,6 @@ Use the [router health checks](llama-cpp.md#troubleshooting) to confirm that the
|
|
|
91
91
|
|
|
92
92
|
## Use the model in draht
|
|
93
93
|
|
|
94
|
-
Follow [Configure draht](llama-cpp.md#configure-draht) and connect to `http://127.0.0.1:
|
|
94
|
+
Follow [Configure draht](llama-cpp.md#configure-draht) and connect to `http://127.0.0.1:9931`. The preset section name is the model ID, so select `qwen3.8-27b` in `/model` for this example.
|
|
95
95
|
|
|
96
96
|
NVIDIA recipe memory settings assume that only the selected model uses the GPU. If `/llama` shows other loaded models, unload them before using the recipe model.
|
package/docs/polyphase.md
CHANGED
|
@@ -39,10 +39,15 @@ alt+a inspect agents · ctrl+o expand
|
|
|
39
39
|
|
|
40
40
|
- **Glyphs:** `◐`/`◓`/`◑`/`◒` spinner or `●` (running), `◌` (queued), `·` (pending), `✓` (done),
|
|
41
41
|
`✗` (failed), `⊘` (cancelled), `–` (skipped), `⚠` (blocked tool call).
|
|
42
|
+
A workflow phase uses the same glyphs: `⊘` when every agent in it was cancelled, `–` when the
|
|
43
|
+
script moved past it without starting any agent.
|
|
42
44
|
- **Only the focus row animates.** The focus row is the newest running tool-origin `subagent` or
|
|
43
45
|
`workflow` run. Every other row shows a static `●` glyph with no elapsed time, no live tokens,
|
|
44
46
|
and no "what it's doing now" text, so scrolling past a background run never forces a full
|
|
45
47
|
terminal redraw.
|
|
48
|
+
- **Overflow.** When a run has more agents than the row has lines, the focus row shows failed,
|
|
49
|
+
blocked and running agents first (still in run order), and the `… +N more (…)` line counts the
|
|
50
|
+
rest by status.
|
|
46
51
|
- **Expand/collapse** with `app.tools.expand` (`ctrl+o`, the existing key). The expanded view adds
|
|
47
52
|
per-agent task text, tool-call counts, and either the live transcript tail (thinking/text/tool
|
|
48
53
|
items) or, once finished, a head+tail preview of the output (up to 10 lines; longer output shows
|
|
@@ -63,8 +68,11 @@ on):
|
|
|
63
68
|
|
|
64
69
|
```
|
|
65
70
|
◐ polyphase · 2 runs · 3 running · 1 queued · 6 done · 1 failed · $0.69 · alt+a inspect
|
|
71
|
+
● review the diff 2/3 done 0:42 $0.21
|
|
72
|
+
● investigate the flaky test 0/1 done 0:12 $0.03
|
|
66
73
|
```
|
|
67
74
|
|
|
75
|
+
With two or more live runs, each one gets its own line (title, finished agents, elapsed, cost).
|
|
68
76
|
A running workflow started from a slash command (`/<name>` or `/workflow <name>`) additionally
|
|
69
77
|
shows its compact phase tree under the summary line, capped at 10 lines total for the whole dock.
|
|
70
78
|
The dock disappears again once nothing is running, and is skipped entirely when
|
|
@@ -83,12 +91,16 @@ agents, and to follow any agent's live thinking, text, and tool calls. A second
|
|
|
83
91
|
`/workflow <name> `) into the editor and closes the inspector. Opens automatically when there
|
|
84
92
|
is no exactly-one live run, or on `/workflows`.
|
|
85
93
|
- **Run** — phase-grouped for workflows, a flat numbered list of steps for chains, a flat list of
|
|
86
|
-
agents otherwise.
|
|
94
|
+
agents otherwise. A run with a token budget or time limit shows a gauge line on top
|
|
95
|
+
(`budget ███░░░░░░░ 12.3k/50.0k tok · time ██░░░░░░░░ 4:10/30:00`), turning yellow at 80% and red
|
|
96
|
+
once reached. Opens automatically when exactly one run is live, with its first running
|
|
87
97
|
agent selected.
|
|
88
98
|
- **Agent detail** — the live transcript tail for one agent: tool calls with status and duration,
|
|
89
99
|
thinking and text, and a footer showing `◆ following` or `‖ paused · f to follow`.
|
|
90
100
|
- **Split view** — at 120 columns or more, the run view's agent list (left, 40 columns) and the
|
|
91
101
|
selected agent's detail (right) render side by side; `enter` switches to the full-width detail.
|
|
102
|
+
The left pane keeps the workflow phase tree; the right pane opens with the agent's name and
|
|
103
|
+
current activity.
|
|
92
104
|
|
|
93
105
|
Archived (no-longer-live) runs render from their persisted summary only, with the note
|
|
94
106
|
"Live transcript is only kept while the run is in memory."
|
package/docs/prompt-templates.md
CHANGED
|
@@ -46,7 +46,7 @@ Templates support these substitutions:
|
|
|
46
46
|
| `${@:N}` | Arguments starting at position `N` |
|
|
47
47
|
| `${@:N:L}` | `L` arguments starting at position `N` |
|
|
48
48
|
|
|
49
|
-
Arguments follow shell-like quoting, so `/review "API compatibility"` supplies one argument containing a space.
|
|
49
|
+
Arguments follow shell-like quoting, so `/review "API compatibility"` supplies one argument containing a space. A quote only starts quoting at the beginning of an argument, so apostrophes inside words such as `doesn't` stay as text, and a quote with no closing match is kept as text. Inside a quoted argument, a backslash before the same quote character keeps it as text, so `/review "the \"fast\" path"` supplies `the "fast" path`; other backslashes are kept as typed.
|
|
50
50
|
|
|
51
51
|
<a id="choose-where-it-loads"></a>
|
|
52
52
|
|
package/docs/providers.md
CHANGED
|
@@ -65,8 +65,10 @@ This table covers providers with a single primary API-key variable. Providers th
|
|
|
65
65
|
| MiniMax | `MINIMAX_API_KEY` |
|
|
66
66
|
| MiniMax (China) | `MINIMAX_CN_API_KEY` |
|
|
67
67
|
| Moonshot AI (Global and China) | `MOONSHOT_API_KEY` |
|
|
68
|
-
| Qwen Token Plan
|
|
69
|
-
| Qwen Token Plan
|
|
68
|
+
| Qwen Token Plan Team | `QWEN_TOKEN_PLAN_TEAM_API_KEY` |
|
|
69
|
+
| Qwen Token Plan Team (China) | `QWEN_TOKEN_PLAN_TEAM_CN_API_KEY` |
|
|
70
|
+
| Qwen Token Plan Individual | `QWEN_TOKEN_PLAN_INDIVIDUAL_API_KEY` |
|
|
71
|
+
| Qwen Token Plan Individual (China) | `QWEN_TOKEN_PLAN_INDIVIDUAL_CN_API_KEY` |
|
|
70
72
|
| Xiaomi MiMo | `XIAOMI_API_KEY` |
|
|
71
73
|
| Xiaomi MiMo Token Plan (China) | `XIAOMI_TOKEN_PLAN_CN_API_KEY` |
|
|
72
74
|
| Xiaomi MiMo Token Plan (Amsterdam) | `XIAOMI_TOKEN_PLAN_AMS_API_KEY` |
|
package/docs/quickstart.md
CHANGED
|
@@ -6,7 +6,7 @@ For native Windows setup, read [Windows Setup](windows.md). For Android, read [T
|
|
|
6
6
|
|
|
7
7
|
## 1. Install draht
|
|
8
8
|
|
|
9
|
-
Install draht from npm. This requires Node.js 22.
|
|
9
|
+
Install draht from npm. This requires Node.js `^22.23.4`, `^24.22.1` or `^26.12.1`:
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
12
|
npm install -g --ignore-scripts @draht/coding-agent
|
package/docs/rpc-commands.md
CHANGED
|
@@ -746,7 +746,7 @@ Response:
|
|
|
746
746
|
|
|
747
747
|
### get_last_assistant_text
|
|
748
748
|
|
|
749
|
-
Get the text content of the last assistant message.
|
|
749
|
+
Get the text content of the last assistant message. Messages without text from an aborted or failed turn, or that only call tools, are skipped.
|
|
750
750
|
|
|
751
751
|
```json
|
|
752
752
|
{"type": "get_last_assistant_text"}
|
package/docs/rpc.md
CHANGED
|
@@ -90,7 +90,7 @@ Clients must also handle child-process startup failures, unexpected exits, stder
|
|
|
90
90
|
|
|
91
91
|
## Shutdown
|
|
92
92
|
|
|
93
|
-
Close the child's stdin to request an orderly shutdown. draht disposes the active runtime before exiting. Clients should still handle process signals and unexpected exits.
|
|
93
|
+
Close the child's stdin to request an orderly shutdown. draht disposes the active runtime and waits for pending work to finish before exiting, so give it time to exit before killing it. Clients should still handle process signals and unexpected exits.
|
|
94
94
|
|
|
95
95
|
SIGTERM and SIGHUP also start an orderly shutdown. Once a shutdown has started, from either stdin EOF or a signal, a stdin EOF or a single signal does not interrupt it; a second signal exits at once. Closing stdin and sending SIGTERM together is safe.
|
|
96
96
|
|
package/docs/sessions.md
CHANGED
|
@@ -21,7 +21,13 @@ Each session records the working directory it was created in and never changes i
|
|
|
21
21
|
| `--resume`, `/resume`, `--session`, `/import` | The session's working directory, which can differ from the current directory |
|
|
22
22
|
| `--fork`, or a `--session` ID from another directory that you choose to fork | The current directory, in a new session |
|
|
23
23
|
|
|
24
|
-
If a session's working directory no longer exists,
|
|
24
|
+
If a session's working directory no longer exists, for example after the project folder was renamed, interactive mode asks how to open it:
|
|
25
|
+
|
|
26
|
+
- **Continue** runs the session in the current directory. draht does not store that choice, so it asks again the next time you open the session.
|
|
27
|
+
- **Fork** copies the session into the current directory as a new session with a new ID, like `--fork`. The original stays unchanged. At startup the copy is stored like other new sessions for the current directory; from `/resume` or `/import` it is stored next to the current session, like `/new`.
|
|
28
|
+
- **Cancel** leaves the current session open, or exits at startup.
|
|
29
|
+
|
|
30
|
+
Other modes exit with an error.
|
|
25
31
|
|
|
26
32
|
Use `/name` or `--name` to assign a recognizable session name. Run `/session` to verify the current session file, ID, message count, token usage, and cost.
|
|
27
33
|
|
package/docs/settings.md
CHANGED
|
@@ -18,7 +18,7 @@ Add `"$schema": "https://raw.githubusercontent.com/draht-dev/draht/main/packages
|
|
|
18
18
|
| `enabledModels` | `string[]` | All available models | Model patterns used for startup selection and model cycling. Uses the same format as `--models`. |
|
|
19
19
|
| `hideThinkingBlock` | boolean | `false` | Hide thinking blocks in the transcript. |
|
|
20
20
|
| `showCacheMissNotices` | boolean | `false` | Show notices for significant cache misses, successful cache warming, compaction usage, and provider recovery. |
|
|
21
|
-
| `cacheWarming` | `"off" \| "streaming" \| "idle"` | `"
|
|
21
|
+
| `cacheWarming` | `"off" \| "streaming" \| "idle"` | `"idle"` | Keep eligible provider prompt caches warm during active runs and, with `"idle"`, for up to 30 minutes between runs. `"streaming"` warms only during active runs. Global setting only. |
|
|
22
22
|
|
|
23
23
|
Cache warming runs only when the model declares a cache lifetime and draht estimates at least $0.05 in avoided cache-miss cost. Refresh usage counts toward session totals but does not enter model context. `/session` shows the next decision; extensions can override it with `cache_warming_decision`. See [Prompt Cache Lifetimes](models.md#prompt-cache-lifetimes).
|
|
24
24
|
|
package/docs/tui.md
CHANGED
|
@@ -135,7 +135,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
135
135
|
|
|
136
136
|
This component does not display a text cursor, so it does not need `Focusable`. A component containing `Input` or `Editor` must implement `Focusable` and propagate its `focused` value to that child.
|
|
137
137
|
|
|
138
|
-
Custom components do not report draht as waiting for the user, because `ctx.ui.custom()` also hosts loaders and other non-blocking UI. When
|
|
138
|
+
Custom components do not report draht as waiting for the user, because `ctx.ui.custom()` also hosts loaders and other non-blocking UI. When a component waits for an answer, pass `blocked: { kind: "question", message: "Pick a color" }` so terminals that support [program status](terminal-setup.md#program-status) show draht as blocked. `kind` is `"question"`, `"permission"`, or `"auth"`. An inline component reports blocked while it is visible: a newer dialog or component shown in its place reports its own status instead. An overlay reports blocked from when it is shown until it calls `done()`, also while it is hidden with `setHidden()` or covered by another overlay. When several blocking prompts are open, the most recently shown one supplies `kind` and `message`.
|
|
139
139
|
|
|
140
140
|
Pass `overlay: true` to draw above existing content. Overlay options control size, anchors, offsets, margins, and responsive visibility. An overlay handle can change focus or temporarily hide and show the overlay with `setHidden()` while the interaction remains active.
|
|
141
141
|
|
|
@@ -169,14 +169,11 @@ async function walkGuestFiles(
|
|
|
169
169
|
return walkDirectory(root, "");
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
+
// Like the built-in find and grep: a pattern with '/' is relative to the search root, one without
|
|
173
|
+
// '/' matches file names at any depth.
|
|
172
174
|
function matchesToolGlob(relativePath: string, pattern: string): boolean {
|
|
173
|
-
const normalizedPattern = toPosix(pattern);
|
|
174
|
-
if (normalizedPattern.includes("/"))
|
|
175
|
-
return (
|
|
176
|
-
path.posix.matchesGlob(relativePath, normalizedPattern) ||
|
|
177
|
-
path.posix.matchesGlob(relativePath, `**/${normalizedPattern}`)
|
|
178
|
-
);
|
|
179
|
-
}
|
|
175
|
+
const normalizedPattern = toPosix(pattern).replace(/^(?:\.\/)+/, "");
|
|
176
|
+
if (normalizedPattern.includes("/")) return path.posix.matchesGlob(relativePath, normalizedPattern);
|
|
180
177
|
return path.posix.matchesGlob(path.posix.basename(relativePath), normalizedPattern);
|
|
181
178
|
}
|
|
182
179
|
|
|
@@ -291,7 +291,11 @@ async function writePromptToTempFile(agentName: string, prompt: string): Promise
|
|
|
291
291
|
|
|
292
292
|
function getPiInvocation(args: string[]): { command: string; args: string[] } {
|
|
293
293
|
const currentScript = process.argv[1];
|
|
294
|
-
|
|
294
|
+
// Bun-compiled binaries report their embedded entry as argv[1]: "/$bunfs/root/..." on
|
|
295
|
+
// POSIX and "B:/~BUN/root/..." on Windows. fs.existsSync() resolves these inside Bun.
|
|
296
|
+
const isBunVirtualScript =
|
|
297
|
+
currentScript !== undefined &&
|
|
298
|
+
(currentScript.startsWith("/$bunfs/root/") || /^[A-Za-z]:[\\/]~BUN[\\/]root[\\/]/.test(currentScript));
|
|
295
299
|
if (currentScript && !isBunVirtualScript && fs.existsSync(currentScript)) {
|
|
296
300
|
return { command: process.execPath, args: [currentScript, ...args] };
|
|
297
301
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draht/coding-agent",
|
|
3
|
-
"version": "2026.11.
|
|
3
|
+
"version": "2026.11.14-1",
|
|
4
4
|
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"drahtConfig": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"dev": "tsc -p tsconfig.build.json --watch --preserveWatchOutput",
|
|
43
43
|
"build": "bun run build:unbundled && node ../../scripts/build-coding-agent-bundle.mjs",
|
|
44
44
|
"build:unbundled": "tsc -p tsconfig.build.json && node ../../scripts/package-files.mjs executable dist/cli.js dist/rpc-entry.js && bun run copy-assets",
|
|
45
|
-
"build:binary": "npm --prefix ../telemetry run build && bun run build && bun build --compile --no-compile-autoload-bunfig --no-compile-autoload-dotenv ./dist/bun/cli.js ./src/utils/image-resize-worker.ts ./src/extensions/codemode/worker.ts --outfile dist/draht && bun run copy-binary-assets",
|
|
45
|
+
"build:binary": "npm --prefix ../telemetry run build && bun run build && bun build --compile --no-compile-autoload-bunfig --no-compile-autoload-dotenv --compile-autoload-package-json ./dist/bun/cli.js ./src/utils/image-resize-worker.ts ./src/extensions/codemode/worker.ts --outfile dist/draht && bun run copy-binary-assets",
|
|
46
46
|
"copy-assets": "node ../../scripts/package-files.mjs copy \"src/modes/interactive/theme/*.json\" dist/modes/interactive/theme && node ../../scripts/package-files.mjs copy \"src/modes/interactive/assets/*.png\" dist/modes/interactive/assets && node ../../scripts/package-files.mjs copy src/core/export-html/template.html src/core/export-html/template.css src/core/export-html/template.js dist/core/export-html && node ../../scripts/package-files.mjs copy \"src/core/export-html/vendor/*.js\" dist/core/export-html/vendor && node ../../scripts/package-files.mjs clean dist/prompts dist/skills dist/hooks dist/agents && node ../../scripts/package-files.mjs copy prompts skills hooks agents dist",
|
|
47
47
|
"copy-binary-assets": "node ../../scripts/package-files.mjs copy package.json README.md CHANGELOG.md docs examples prompts skills hooks agents dist && node ../../scripts/package-files.mjs copy \"src/modes/interactive/theme/*.json\" dist/theme && node ../../scripts/package-files.mjs copy \"src/modes/interactive/assets/*.png\" dist/assets && node ../../scripts/package-files.mjs copy src/core/export-html/template.html dist/export-html && node ../../scripts/package-files.mjs copy \"src/core/export-html/vendor/*.js\" dist/export-html/vendor && node -e \"require('fs').copyFileSync(require.resolve('@silvia-odwyer/photon-node/photon_rs_bg.wasm'), 'dist/photon_rs_bg.wasm')\"",
|
|
48
48
|
"generate:schemas": "tsx scripts/generate-schemas.ts",
|
|
@@ -53,14 +53,14 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@mariozechner/jiti": "^2.6.2",
|
|
56
|
-
"@draht/agent-core": "2026.11.
|
|
57
|
-
"@draht/ai": "2026.11.
|
|
58
|
-
"@draht/codemode": "2026.11.
|
|
59
|
-
"@draht/mcp": "2026.11.
|
|
60
|
-
"@draht/rlm": "2026.11.
|
|
61
|
-
"@draht/router": "2026.11.
|
|
62
|
-
"@draht/tools": "2026.11.
|
|
63
|
-
"@draht/tui": "2026.11.
|
|
56
|
+
"@draht/agent-core": "2026.11.14-1",
|
|
57
|
+
"@draht/ai": "2026.11.14-1",
|
|
58
|
+
"@draht/codemode": "2026.11.14-1",
|
|
59
|
+
"@draht/mcp": "2026.11.14-1",
|
|
60
|
+
"@draht/rlm": "2026.11.14-1",
|
|
61
|
+
"@draht/router": "2026.11.14-1",
|
|
62
|
+
"@draht/tools": "2026.11.14-1",
|
|
63
|
+
"@draht/tui": "2026.11.14-1",
|
|
64
64
|
"@silvia-odwyer/photon-node": "^0.3.4",
|
|
65
65
|
"@sinclair/typebox": "^0.34.41",
|
|
66
66
|
"brace-expansion": "5.0.12",
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Audit test value or gate new tests at the owning behavior boundary"
|
|
3
|
+
argument-hint: "[scope]"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /test-audit
|
|
7
|
+
|
|
8
|
+
Audit the value of tests in a scope, or gate a proposed new test before it lands.
|
|
9
|
+
This prompt is self-contained; no additional test-audit skill is required.
|
|
10
|
+
|
|
11
|
+
Scope: $ARGUMENTS
|
|
12
|
+
|
|
13
|
+
When no scope is supplied, inspect the current diff and the tests changed by it.
|
|
14
|
+
Do not expand that into a repository-wide campaign.
|
|
15
|
+
|
|
16
|
+
## Authoring gate
|
|
17
|
+
|
|
18
|
+
Before adding or changing a test, identify:
|
|
19
|
+
|
|
20
|
+
1. The observable behavior, invariant, or independent contract it protects.
|
|
21
|
+
2. A credible regression that makes it fail.
|
|
22
|
+
3. The owning behavior boundary and why existing coverage cannot catch the failure.
|
|
23
|
+
4. Any production seam needed solely for testing. Move the test to a real boundary
|
|
24
|
+
rather than adding a test-only export, flag, wrapper, or injection hook.
|
|
25
|
+
|
|
26
|
+
Missing answers block authoring. Prefer extending an existing table or fixture
|
|
27
|
+
rather than duplicating proof across layers. A bug regression must fail on the
|
|
28
|
+
pre-fix code for the intended reason and pass after the owner-boundary repair.
|
|
29
|
+
|
|
30
|
+
## Audit rules
|
|
31
|
+
|
|
32
|
+
- Read root and scoped `AGENTS.md` files and follow their approval and test rules.
|
|
33
|
+
- Read each candidate test in full, its production owner, entry point, callers,
|
|
34
|
+
callees, sibling implementations, overlapping coverage, CI routing, and history.
|
|
35
|
+
Inspect dependency source or types when the claim depends on that dependency.
|
|
36
|
+
- Hunt for assertion-free probes, self-comparisons, copied inventories, exact
|
|
37
|
+
source greps, private-call assertions, duplicated contracts, mock-only behavior,
|
|
38
|
+
expected values computed by the code under test, and negative controls that
|
|
39
|
+
pass for an unrelated reason.
|
|
40
|
+
- Keep independently meaningful API, protocol, configuration, migration, storage,
|
|
41
|
+
security, platform, default, prompt-byte, generated-code, package, release, and
|
|
42
|
+
architecture contracts. Observable call ordering and credible regressions count.
|
|
43
|
+
Source inspection can be an independent contract guard; static or slow is not
|
|
44
|
+
a deletion reason.
|
|
45
|
+
- A retained test failing on the baseline may expose a product bug. Report and
|
|
46
|
+
reproduce it rather than deleting it. Uncertain candidates remain findings.
|
|
47
|
+
|
|
48
|
+
## Candidate evidence
|
|
49
|
+
|
|
50
|
+
Keep discovery read-only. Before proposing an edit, record every field:
|
|
51
|
+
|
|
52
|
+
- Exact test name and location, and the failure it can detect.
|
|
53
|
+
- Non-test callers of the covered production or support seam.
|
|
54
|
+
- Stronger remaining owner-boundary proof, or why no proof is needed.
|
|
55
|
+
- Relevant history and the reason the test or seam exists.
|
|
56
|
+
- Production or test-support deletion unlocked.
|
|
57
|
+
- Risk and the focused validation command.
|
|
58
|
+
|
|
59
|
+
A missing field blocks the edit. Select one coherent owner-boundary batch;
|
|
60
|
+
remove obsolete test-only seams only when evidence proves they have no production
|
|
61
|
+
caller and repository rules permit removal. Preserve meaningful contracts at
|
|
62
|
+
canonical owners. Optimize for confidence, not deletion count.
|
|
63
|
+
|
|
64
|
+
## Broad campaigns
|
|
65
|
+
|
|
66
|
+
Only when explicitly requested: pin a baseline revision and record every in-scope
|
|
67
|
+
test's result; assign every test to an owner-boundary lane; mark each declaration
|
|
68
|
+
retain, repair, consolidate, or delete with evidence. Name the keeper for each
|
|
69
|
+
contract before editing. Serialize shared harness edits. Review deleted coverage
|
|
70
|
+
against keepers, independently when available and permitted. Prove restored
|
|
71
|
+
contracts with deliberate mutations, restoring source afterward. Keep product
|
|
72
|
+
fixes separate and prove them with failing controls. Reconcile base-branch
|
|
73
|
+
changes using repository conventions without losing newly added contracts.
|
|
74
|
+
|
|
75
|
+
## Validation and handoff
|
|
76
|
+
|
|
77
|
+
Run the smallest owner and sibling checks, then the repository's required gate.
|
|
78
|
+
Do not edit source or tests while their runner is active. For removed source
|
|
79
|
+
greps, run the executable or dry-run that owns the real contract. Run
|
|
80
|
+
`git diff --check` and inspect `git diff --numstat`.
|
|
81
|
+
|
|
82
|
+
Report removed categories, production simplifications, retained false positives,
|
|
83
|
+
proof actually run, separate production versus test/support LOC, review gaps,
|
|
84
|
+
and named follow-ups. Commit, push, or land only when authorized.
|