@draht/coding-agent 2026.10.20-1 → 2026.10.23-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (729) hide show
  1. package/CHANGELOG.md +138 -0
  2. package/agents/advisor.md +2 -2
  3. package/agents/architect.md +11 -33
  4. package/agents/debugger.md +13 -54
  5. package/agents/git-committer.md +18 -42
  6. package/agents/implementer.md +14 -36
  7. package/agents/investigator.md +12 -63
  8. package/agents/reviewer.md +16 -44
  9. package/agents/security-auditor.md +22 -56
  10. package/agents/spec-reviewer.md +13 -53
  11. package/agents/verifier.md +14 -33
  12. package/bin/drahtbank.mjs +4 -0
  13. package/dist/agents/advisor.md +2 -2
  14. package/dist/agents/architect.md +11 -33
  15. package/dist/agents/debugger.md +13 -54
  16. package/dist/agents/git-committer.md +18 -42
  17. package/dist/agents/implementer.md +14 -36
  18. package/dist/agents/investigator.md +12 -63
  19. package/dist/agents/reviewer.md +16 -44
  20. package/dist/agents/security-auditor.md +22 -56
  21. package/dist/agents/spec-reviewer.md +13 -53
  22. package/dist/agents/verifier.md +14 -33
  23. package/dist/bundle/chunks/anthropic-messages-G57VPNTF.js +6 -0
  24. package/dist/bundle/chunks/anthropic.js +1 -1
  25. package/dist/bundle/chunks/azure-openai-responses-AYUCZ5WN.js +2 -0
  26. package/dist/bundle/chunks/bedrock-converse-stream.js +23 -20
  27. package/dist/bundle/chunks/chunk-3GDEPGTR.js +16 -0
  28. package/dist/bundle/chunks/chunk-5JW3NSTV.js +2 -0
  29. package/dist/bundle/chunks/{chunk-FHX2S5IG.js → chunk-6WESOD4H.js} +1 -1
  30. package/dist/bundle/chunks/chunk-76YNMQ57.js +2 -0
  31. package/dist/bundle/chunks/chunk-AC3MSTC6.js +2 -0
  32. package/dist/bundle/chunks/chunk-ACLWH5WQ.js +2 -0
  33. package/dist/bundle/chunks/chunk-BL72B6LV.js +82 -0
  34. package/dist/bundle/chunks/{chunk-5QJFWTKA.js → chunk-CLKG6K6Z.js} +5 -2
  35. package/dist/bundle/chunks/chunk-DN7SM3LX.js +479 -0
  36. package/dist/bundle/chunks/{chunk-UTRX2VHB.js → chunk-DOUMZTXH.js} +3 -3
  37. package/dist/bundle/chunks/chunk-DQ4G4IS4.js +20 -0
  38. package/dist/bundle/chunks/chunk-E4VZJRJ2.js +9 -0
  39. package/dist/bundle/chunks/chunk-FOYIPAAD.js +6 -0
  40. package/dist/bundle/chunks/chunk-FXCTQRNN.js +2 -0
  41. package/dist/bundle/chunks/chunk-GQXRTK54.js +20 -0
  42. package/dist/bundle/chunks/chunk-IGO52ZOY.js +132 -0
  43. package/dist/bundle/chunks/{chunk-VXUJMEMO.js → chunk-IT4RIOZD.js} +1 -1
  44. package/dist/bundle/chunks/chunk-JJKPUMH2.js +1424 -0
  45. package/dist/bundle/chunks/chunk-JNWRE5F4.js +2 -0
  46. package/dist/bundle/chunks/chunk-KSGHCBHT.js +2 -0
  47. package/dist/bundle/chunks/chunk-MBFTIGLS.js +2 -0
  48. package/dist/bundle/chunks/chunk-N26RGV3K.js +11 -0
  49. package/dist/bundle/chunks/{chunk-KPO5375S.js → chunk-RCRGGYLW.js} +1 -1
  50. package/dist/bundle/chunks/chunk-UCJ7FLSO.js +166 -0
  51. package/dist/bundle/chunks/chunk-USCN7R2E.js +2 -0
  52. package/dist/bundle/chunks/chunk-WFHH5SX6.js +4 -0
  53. package/dist/bundle/chunks/chunk-WYWBXNDO.js +6 -0
  54. package/dist/bundle/chunks/chunk-ZRPAOMVB.js +2 -0
  55. package/dist/bundle/chunks/{cli-VCHSHNKT.js → cli-HTUB6WOG.js} +6 -6
  56. package/dist/bundle/chunks/cloudflare-workers-ai-system-one-RRSO6OXX.js +2 -0
  57. package/dist/bundle/chunks/codemode-worker.js +188 -21
  58. package/dist/bundle/chunks/execute-UUPNZJJG.js +31 -0
  59. package/dist/bundle/chunks/github-copilot.js +1 -1
  60. package/dist/bundle/chunks/google-generative-ai-VJSS5EBX.js +2 -0
  61. package/dist/bundle/chunks/google-vertex-K23DBWTT.js +2 -0
  62. package/dist/bundle/chunks/image-resize-worker.js +1 -1
  63. package/dist/bundle/chunks/{llama-cpp-classify-EJ5XMSQL.js → llama-cpp-classify-3VDXTYVJ.js} +3 -3
  64. package/dist/bundle/chunks/mistral-conversations-SKVQJGFZ.js +5 -0
  65. package/dist/bundle/chunks/node-DXZFQBEO.js +16 -0
  66. package/dist/bundle/chunks/{node-6IIDYB3K.js → node-LBZLUIBE.js} +1 -1
  67. package/dist/bundle/chunks/openai-chatgpt.js +1 -1
  68. package/dist/bundle/chunks/openai-codex-responses-LV4RIZL3.js +10 -0
  69. package/dist/bundle/chunks/openai-codex.js +1 -1
  70. package/dist/bundle/chunks/openai-completions-PUIR2V25.js +7 -0
  71. package/dist/bundle/chunks/openai-decisions-2DJLSYQF.js +5 -0
  72. package/dist/bundle/chunks/openai-responses-6ESQOXAF.js +4 -0
  73. package/dist/bundle/chunks/opencode-go.js +1 -1
  74. package/dist/bundle/chunks/openrouter-images-TVXBMY3V.js +2 -0
  75. package/dist/bundle/chunks/pi-messages-XS7FDWQI.js +8 -0
  76. package/dist/bundle/chunks/runtime-IB3XQ7E3.js +2 -0
  77. package/dist/bundle/chunks/runtime-LB35PK4J.js +3 -0
  78. package/dist/bundle/chunks/settings-manager-YNY5F4RU.js +2 -0
  79. package/dist/bundle/chunks/typesafe-system-one-67GAWZXE.js +2 -0
  80. package/dist/bundle/chunks/virtual-modules-U4CBGVMI.js +2 -0
  81. package/dist/bundle/cli-runtime.js +1 -1
  82. package/dist/bundle/index.js +1 -1
  83. package/dist/bundle/rpc-entry.js +1 -1
  84. package/dist/cli/args.d.ts +2 -1
  85. package/dist/cli/args.d.ts.map +1 -1
  86. package/dist/cli/args.js +30 -8
  87. package/dist/cli/args.js.map +1 -1
  88. package/dist/cli/credential-print.d.ts.map +1 -1
  89. package/dist/cli/credential-print.js +4 -4
  90. package/dist/cli/credential-print.js.map +1 -1
  91. package/dist/config.d.ts +18 -1
  92. package/dist/config.d.ts.map +1 -1
  93. package/dist/config.js +44 -6
  94. package/dist/config.js.map +1 -1
  95. package/dist/core/agent-session.d.ts +65 -8
  96. package/dist/core/agent-session.d.ts.map +1 -1
  97. package/dist/core/agent-session.js +240 -102
  98. package/dist/core/agent-session.js.map +1 -1
  99. package/dist/core/auth-storage.d.ts.map +1 -1
  100. package/dist/core/auth-storage.js +20 -13
  101. package/dist/core/auth-storage.js.map +1 -1
  102. package/dist/core/bash-executor.d.ts.map +1 -1
  103. package/dist/core/bash-executor.js +42 -52
  104. package/dist/core/bash-executor.js.map +1 -1
  105. package/dist/core/bug-report.d.ts +9 -1
  106. package/dist/core/bug-report.d.ts.map +1 -1
  107. package/dist/core/builtins/completion-checks.d.ts +3 -0
  108. package/dist/core/builtins/completion-checks.d.ts.map +1 -0
  109. package/dist/core/builtins/completion-checks.js +142 -0
  110. package/dist/core/builtins/completion-checks.js.map +1 -0
  111. package/dist/core/builtins/duet.d.ts.map +1 -1
  112. package/dist/core/builtins/duet.js +7 -5
  113. package/dist/core/builtins/duet.js.map +1 -1
  114. package/dist/core/builtins/git-safety.d.ts +3 -0
  115. package/dist/core/builtins/git-safety.d.ts.map +1 -0
  116. package/dist/core/builtins/git-safety.js +34 -0
  117. package/dist/core/builtins/git-safety.js.map +1 -0
  118. package/dist/core/builtins/index.d.ts.map +1 -1
  119. package/dist/core/builtins/index.js +4 -0
  120. package/dist/core/builtins/index.js.map +1 -1
  121. package/dist/core/client-identity.d.ts +8 -0
  122. package/dist/core/client-identity.d.ts.map +1 -0
  123. package/dist/core/client-identity.js +15 -0
  124. package/dist/core/client-identity.js.map +1 -0
  125. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  126. package/dist/core/compaction/branch-summarization.js +1 -2
  127. package/dist/core/compaction/branch-summarization.js.map +1 -1
  128. package/dist/core/compaction/compaction.d.ts +2 -2
  129. package/dist/core/compaction/compaction.d.ts.map +1 -1
  130. package/dist/core/compaction/compaction.js +20 -15
  131. package/dist/core/compaction/compaction.js.map +1 -1
  132. package/dist/core/compaction/utils.d.ts +6 -0
  133. package/dist/core/compaction/utils.d.ts.map +1 -1
  134. package/dist/core/compaction/utils.js +7 -8
  135. package/dist/core/compaction/utils.js.map +1 -1
  136. package/dist/core/export-html/index.d.ts.map +1 -1
  137. package/dist/core/export-html/index.js +2 -0
  138. package/dist/core/export-html/index.js.map +1 -1
  139. package/dist/core/export-html/template.html +1 -0
  140. package/dist/core/export-html/template.js +23 -17
  141. package/dist/core/export-html/tool-renderer.d.ts +3 -3
  142. package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  143. package/dist/core/export-html/tool-renderer.js +5 -3
  144. package/dist/core/export-html/tool-renderer.js.map +1 -1
  145. package/dist/core/export-html/vendor/marked-cjk-friendly.min.js +6 -0
  146. package/dist/core/export-html/vendor/marked.min.js +30 -29
  147. package/dist/core/extensions/index.d.ts +1 -1
  148. package/dist/core/extensions/index.d.ts.map +1 -1
  149. package/dist/core/extensions/index.js.map +1 -1
  150. package/dist/core/extensions/loader.d.ts.map +1 -1
  151. package/dist/core/extensions/loader.js +7 -0
  152. package/dist/core/extensions/loader.js.map +1 -1
  153. package/dist/core/extensions/runner.d.ts +6 -2
  154. package/dist/core/extensions/runner.d.ts.map +1 -1
  155. package/dist/core/extensions/runner.js +16 -4
  156. package/dist/core/extensions/runner.js.map +1 -1
  157. package/dist/core/extensions/types.d.ts +61 -7
  158. package/dist/core/extensions/types.d.ts.map +1 -1
  159. package/dist/core/extensions/types.js.map +1 -1
  160. package/dist/core/extensions/virtual-modules.d.ts.map +1 -1
  161. package/dist/core/extensions/virtual-modules.js +2 -0
  162. package/dist/core/extensions/virtual-modules.js.map +1 -1
  163. package/dist/core/key-id-schema.d.ts +6 -0
  164. package/dist/core/key-id-schema.d.ts.map +1 -0
  165. package/dist/core/key-id-schema.js +16 -0
  166. package/dist/core/key-id-schema.js.map +1 -0
  167. package/dist/core/keybindings-schema.d.ts +4 -0
  168. package/dist/core/keybindings-schema.d.ts.map +1 -0
  169. package/dist/core/keybindings-schema.js +16 -0
  170. package/dist/core/keybindings-schema.js.map +1 -0
  171. package/dist/core/keybindings.d.ts +242 -75
  172. package/dist/core/keybindings.d.ts.map +1 -1
  173. package/dist/core/keybindings.js +30 -23
  174. package/dist/core/keybindings.js.map +1 -1
  175. package/dist/core/mcp-servers.d.ts +22 -0
  176. package/dist/core/mcp-servers.d.ts.map +1 -1
  177. package/dist/core/mcp-servers.js +72 -11
  178. package/dist/core/mcp-servers.js.map +1 -1
  179. package/dist/core/model-config.d.ts +1623 -74
  180. package/dist/core/model-config.d.ts.map +1 -1
  181. package/dist/core/model-config.js +70 -184
  182. package/dist/core/model-config.js.map +1 -1
  183. package/dist/core/model-registry.d.ts +3 -1
  184. package/dist/core/model-registry.d.ts.map +1 -1
  185. package/dist/core/model-registry.js +4 -0
  186. package/dist/core/model-registry.js.map +1 -1
  187. package/dist/core/model-resolver.d.ts +56 -43
  188. package/dist/core/model-resolver.d.ts.map +1 -1
  189. package/dist/core/model-resolver.js +253 -358
  190. package/dist/core/model-resolver.js.map +1 -1
  191. package/dist/core/model-runtime.d.ts.map +1 -1
  192. package/dist/core/model-runtime.js +19 -10
  193. package/dist/core/model-runtime.js.map +1 -1
  194. package/dist/core/nested-tool-calls.d.ts +1 -0
  195. package/dist/core/nested-tool-calls.d.ts.map +1 -1
  196. package/dist/core/nested-tool-calls.js +1 -0
  197. package/dist/core/nested-tool-calls.js.map +1 -1
  198. package/dist/core/package-manager.js +3 -3
  199. package/dist/core/package-manager.js.map +1 -1
  200. package/dist/core/polyphase/keyword.js +1 -1
  201. package/dist/core/polyphase/keyword.js.map +1 -1
  202. package/dist/core/polyphase/model-selection.d.ts.map +1 -1
  203. package/dist/core/polyphase/model-selection.js +15 -7
  204. package/dist/core/polyphase/model-selection.js.map +1 -1
  205. package/dist/core/polyphase/workflow/prelude.d.ts +2 -0
  206. package/dist/core/polyphase/workflow/prelude.d.ts.map +1 -1
  207. package/dist/core/polyphase/workflow/prelude.js +12 -16
  208. package/dist/core/polyphase/workflow/prelude.js.map +1 -1
  209. package/dist/core/polyphase/workflow/runtime.d.ts.map +1 -1
  210. package/dist/core/polyphase/workflow/runtime.js +2 -1
  211. package/dist/core/polyphase/workflow/runtime.js.map +1 -1
  212. package/dist/core/project-trust.d.ts.map +1 -1
  213. package/dist/core/project-trust.js +2 -1
  214. package/dist/core/project-trust.js.map +1 -1
  215. package/dist/core/prompt-templates.d.ts.map +1 -1
  216. package/dist/core/prompt-templates.js +7 -2
  217. package/dist/core/prompt-templates.js.map +1 -1
  218. package/dist/core/provider-composer.d.ts +2 -1
  219. package/dist/core/provider-composer.d.ts.map +1 -1
  220. package/dist/core/provider-composer.js +13 -0
  221. package/dist/core/provider-composer.js.map +1 -1
  222. package/dist/core/radius.d.ts +2 -0
  223. package/dist/core/radius.d.ts.map +1 -1
  224. package/dist/core/radius.js +2 -0
  225. package/dist/core/radius.js.map +1 -1
  226. package/dist/core/remote-catalog-provider.d.ts +12 -1
  227. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  228. package/dist/core/remote-catalog-provider.js +84 -24
  229. package/dist/core/remote-catalog-provider.js.map +1 -1
  230. package/dist/core/resource-loader.d.ts +3 -0
  231. package/dist/core/resource-loader.d.ts.map +1 -1
  232. package/dist/core/resource-loader.js +7 -4
  233. package/dist/core/resource-loader.js.map +1 -1
  234. package/dist/core/sdk.d.ts +13 -4
  235. package/dist/core/sdk.d.ts.map +1 -1
  236. package/dist/core/sdk.js +27 -15
  237. package/dist/core/sdk.js.map +1 -1
  238. package/dist/core/settings-defaults.d.ts +65 -0
  239. package/dist/core/settings-defaults.d.ts.map +1 -0
  240. package/dist/core/settings-defaults.js +66 -0
  241. package/dist/core/settings-defaults.js.map +1 -0
  242. package/dist/core/settings-manager.d.ts +17 -178
  243. package/dist/core/settings-manager.d.ts.map +1 -1
  244. package/dist/core/settings-manager.js +86 -57
  245. package/dist/core/settings-manager.js.map +1 -1
  246. package/dist/core/settings-schema.d.ts +269 -0
  247. package/dist/core/settings-schema.d.ts.map +1 -0
  248. package/dist/core/settings-schema.js +318 -0
  249. package/dist/core/settings-schema.js.map +1 -0
  250. package/dist/core/skills.d.ts +4 -1
  251. package/dist/core/skills.d.ts.map +1 -1
  252. package/dist/core/skills.js +6 -1
  253. package/dist/core/skills.js.map +1 -1
  254. package/dist/core/system-prompt.d.ts +6 -0
  255. package/dist/core/system-prompt.d.ts.map +1 -1
  256. package/dist/core/system-prompt.js +10 -5
  257. package/dist/core/system-prompt.js.map +1 -1
  258. package/dist/core/tools/bash.d.ts.map +1 -1
  259. package/dist/core/tools/bash.js +3 -5
  260. package/dist/core/tools/bash.js.map +1 -1
  261. package/dist/core/tools/grep.d.ts +8 -0
  262. package/dist/core/tools/grep.d.ts.map +1 -1
  263. package/dist/core/tools/grep.js +19 -7
  264. package/dist/core/tools/grep.js.map +1 -1
  265. package/dist/core/tools/index.d.ts +2 -0
  266. package/dist/core/tools/index.d.ts.map +1 -1
  267. package/dist/core/tools/index.js +2 -0
  268. package/dist/core/tools/index.js.map +1 -1
  269. package/dist/core/tools/output-accumulator.d.ts.map +1 -1
  270. package/dist/core/tools/output-accumulator.js +4 -10
  271. package/dist/core/tools/output-accumulator.js.map +1 -1
  272. package/dist/core/tools/path-utils.d.ts +1 -1
  273. package/dist/core/tools/path-utils.d.ts.map +1 -1
  274. package/dist/core/tools/path-utils.js +6 -6
  275. package/dist/core/tools/path-utils.js.map +1 -1
  276. package/dist/core/tools/read.d.ts +13 -0
  277. package/dist/core/tools/read.d.ts.map +1 -1
  278. package/dist/core/tools/read.js +32 -2
  279. package/dist/core/tools/read.js.map +1 -1
  280. package/dist/core/tools/render-utils.d.ts +20 -0
  281. package/dist/core/tools/render-utils.d.ts.map +1 -1
  282. package/dist/core/tools/render-utils.js +67 -0
  283. package/dist/core/tools/render-utils.js.map +1 -1
  284. package/dist/core/tools/renderers/bash.d.ts.map +1 -1
  285. package/dist/core/tools/renderers/bash.js +7 -35
  286. package/dist/core/tools/renderers/bash.js.map +1 -1
  287. package/dist/core/tools/renderers/edit.d.ts.map +1 -1
  288. package/dist/core/tools/renderers/edit.js +5 -4
  289. package/dist/core/tools/renderers/edit.js.map +1 -1
  290. package/dist/core/tools/renderers/index.d.ts +2 -2
  291. package/dist/core/tools/renderers/index.d.ts.map +1 -1
  292. package/dist/core/tools/renderers/index.js.map +1 -1
  293. package/dist/core/tools/renderers/read.d.ts.map +1 -1
  294. package/dist/core/tools/renderers/read.js +7 -11
  295. package/dist/core/tools/renderers/read.js.map +1 -1
  296. package/dist/extensions/codemode/execute.d.ts.map +1 -1
  297. package/dist/extensions/codemode/execute.js +391 -80
  298. package/dist/extensions/codemode/execute.js.map +1 -1
  299. package/dist/extensions/codemode/index.d.ts.map +1 -1
  300. package/dist/extensions/codemode/index.js +3 -1
  301. package/dist/extensions/codemode/index.js.map +1 -1
  302. package/dist/extensions/codemode/renderer.d.ts +2 -2
  303. package/dist/extensions/codemode/renderer.d.ts.map +1 -1
  304. package/dist/extensions/codemode/renderer.js +9 -3
  305. package/dist/extensions/codemode/renderer.js.map +1 -1
  306. package/dist/extensions/codemode/tool.d.ts +22 -21
  307. package/dist/extensions/codemode/tool.d.ts.map +1 -1
  308. package/dist/extensions/codemode/tool.js +96 -123
  309. package/dist/extensions/codemode/tool.js.map +1 -1
  310. package/dist/extensions/llama/provider.d.ts.map +1 -1
  311. package/dist/extensions/llama/provider.js +34 -11
  312. package/dist/extensions/llama/provider.js.map +1 -1
  313. package/dist/extensions/mcp/cli.d.ts.map +1 -1
  314. package/dist/extensions/mcp/cli.js +27 -33
  315. package/dist/extensions/mcp/cli.js.map +1 -1
  316. package/dist/extensions/mcp/config.d.ts +15 -3
  317. package/dist/extensions/mcp/config.d.ts.map +1 -1
  318. package/dist/extensions/mcp/config.js +49 -12
  319. package/dist/extensions/mcp/config.js.map +1 -1
  320. package/dist/extensions/mcp/index.d.ts +4 -1
  321. package/dist/extensions/mcp/index.d.ts.map +1 -1
  322. package/dist/extensions/mcp/index.js +279 -129
  323. package/dist/extensions/mcp/index.js.map +1 -1
  324. package/dist/extensions/mcp/oauth.d.ts +21 -11
  325. package/dist/extensions/mcp/oauth.d.ts.map +1 -1
  326. package/dist/extensions/mcp/oauth.js +166 -45
  327. package/dist/extensions/mcp/oauth.js.map +1 -1
  328. package/dist/extensions/mcp/resources.d.ts +3 -10
  329. package/dist/extensions/mcp/resources.d.ts.map +1 -1
  330. package/dist/extensions/mcp/resources.js +4 -5
  331. package/dist/extensions/mcp/resources.js.map +1 -1
  332. package/dist/extensions/mcp/runtime.d.ts +7 -7
  333. package/dist/extensions/mcp/runtime.d.ts.map +1 -1
  334. package/dist/extensions/mcp/runtime.js +31 -45
  335. package/dist/extensions/mcp/runtime.js.map +1 -1
  336. package/dist/extensions/mcp/tools.d.ts +7 -5
  337. package/dist/extensions/mcp/tools.d.ts.map +1 -1
  338. package/dist/extensions/mcp/tools.js +87 -29
  339. package/dist/extensions/mcp/tools.js.map +1 -1
  340. package/dist/extensions/mcp/ui.d.ts +3 -3
  341. package/dist/extensions/mcp/ui.d.ts.map +1 -1
  342. package/dist/extensions/mcp/ui.js +18 -6
  343. package/dist/extensions/mcp/ui.js.map +1 -1
  344. package/dist/extensions/tool-search/tool.d.ts +0 -2
  345. package/dist/extensions/tool-search/tool.d.ts.map +1 -1
  346. package/dist/extensions/tool-search/tool.js +2 -4
  347. package/dist/extensions/tool-search/tool.js.map +1 -1
  348. package/dist/hooks/checks/checks-runtime.cjs +215 -0
  349. package/dist/hooks/checks/git-safety.cjs +198 -0
  350. package/dist/hooks/checks/git-safety.d.cts +1 -0
  351. package/dist/hooks/gsd/draht-post-task.js +78 -39
  352. package/dist/hooks/gsd/draht-quality-gate.js +210 -122
  353. package/dist/hooks/gsd/package.json +3 -0
  354. package/dist/index.d.ts +5 -4
  355. package/dist/index.d.ts.map +1 -1
  356. package/dist/index.js +3 -2
  357. package/dist/index.js.map +1 -1
  358. package/dist/main.d.ts.map +1 -1
  359. package/dist/main.js +11 -3
  360. package/dist/main.js.map +1 -1
  361. package/dist/modes/interactive/components/auth-url.d.ts +14 -0
  362. package/dist/modes/interactive/components/auth-url.d.ts.map +1 -0
  363. package/dist/modes/interactive/components/auth-url.js +37 -0
  364. package/dist/modes/interactive/components/auth-url.js.map +1 -0
  365. package/dist/modes/interactive/components/bash-execution.d.ts +5 -1
  366. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  367. package/dist/modes/interactive/components/bash-execution.js +17 -14
  368. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  369. package/dist/modes/interactive/components/branch-summary-message.d.ts +2 -1
  370. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  371. package/dist/modes/interactive/components/branch-summary-message.js +5 -2
  372. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  373. package/dist/modes/interactive/components/compaction-summary-message.d.ts +2 -1
  374. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
  375. package/dist/modes/interactive/components/compaction-summary-message.js +5 -2
  376. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
  377. package/dist/modes/interactive/components/custom-entry.d.ts +3 -1
  378. package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
  379. package/dist/modes/interactive/components/custom-entry.js +8 -2
  380. package/dist/modes/interactive/components/custom-entry.js.map +1 -1
  381. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  382. package/dist/modes/interactive/components/custom-message.js +1 -0
  383. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  384. package/dist/modes/interactive/components/login-dialog.d.ts +3 -0
  385. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  386. package/dist/modes/interactive/components/login-dialog.js +38 -10
  387. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  388. package/dist/modes/interactive/components/oauth-selector.d.ts +8 -2
  389. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  390. package/dist/modes/interactive/components/oauth-selector.js +24 -21
  391. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  392. package/dist/modes/interactive/components/radius-login-selector.d.ts +15 -0
  393. package/dist/modes/interactive/components/radius-login-selector.d.ts.map +1 -0
  394. package/dist/modes/interactive/components/radius-login-selector.js +85 -0
  395. package/dist/modes/interactive/components/radius-login-selector.js.map +1 -0
  396. package/dist/modes/interactive/components/settings-selector.d.ts +3 -3
  397. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  398. package/dist/modes/interactive/components/settings-selector.js +9 -8
  399. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  400. package/dist/modes/interactive/components/skill-invocation-message.d.ts +2 -1
  401. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  402. package/dist/modes/interactive/components/skill-invocation-message.js +5 -2
  403. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  404. package/dist/modes/interactive/components/status-indicator.d.ts +1 -1
  405. package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
  406. package/dist/modes/interactive/components/status-indicator.js +2 -2
  407. package/dist/modes/interactive/components/status-indicator.js.map +1 -1
  408. package/dist/modes/interactive/components/tool-execution.d.ts +12 -13
  409. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  410. package/dist/modes/interactive/components/tool-execution.js +32 -45
  411. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  412. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  413. package/dist/modes/interactive/components/tree-selector.js +2 -9
  414. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  415. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  416. package/dist/modes/interactive/components/user-message.js +5 -4
  417. package/dist/modes/interactive/components/user-message.js.map +1 -1
  418. package/dist/modes/interactive/interactive-mode.d.ts +43 -48
  419. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  420. package/dist/modes/interactive/interactive-mode.js +362 -278
  421. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  422. package/dist/modes/interactive/program-status-reporter.d.ts +34 -0
  423. package/dist/modes/interactive/program-status-reporter.d.ts.map +1 -0
  424. package/dist/modes/interactive/program-status-reporter.js +110 -0
  425. package/dist/modes/interactive/program-status-reporter.js.map +1 -0
  426. package/dist/modes/interactive/theme/dark.json +1 -1
  427. package/dist/modes/interactive/theme/light.json +1 -1
  428. package/dist/modes/interactive/theme/system-theme.d.ts +2 -1
  429. package/dist/modes/interactive/theme/system-theme.d.ts.map +1 -1
  430. package/dist/modes/interactive/theme/system-theme.js +16 -5
  431. package/dist/modes/interactive/theme/system-theme.js.map +1 -1
  432. package/dist/modes/interactive/theme/theme-schema.d.ts +28 -0
  433. package/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
  434. package/dist/modes/interactive/theme/theme-schema.js +105 -0
  435. package/dist/modes/interactive/theme/theme-schema.js.map +1 -0
  436. package/dist/modes/interactive/theme/theme-tokens.d.ts +257 -0
  437. package/dist/modes/interactive/theme/theme-tokens.d.ts.map +1 -0
  438. package/dist/modes/interactive/theme/theme-tokens.js +94 -0
  439. package/dist/modes/interactive/theme/theme-tokens.js.map +1 -0
  440. package/dist/modes/interactive/theme/theme.d.ts +13 -16
  441. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  442. package/dist/modes/interactive/theme/theme.js +22 -29
  443. package/dist/modes/interactive/theme/theme.js.map +1 -1
  444. package/dist/modes/print-mode.d.ts.map +1 -1
  445. package/dist/modes/print-mode.js +4 -0
  446. package/dist/modes/print-mode.js.map +1 -1
  447. package/dist/package-manager-cli.d.ts.map +1 -1
  448. package/dist/package-manager-cli.js +26 -1
  449. package/dist/package-manager-cli.js.map +1 -1
  450. package/dist/prompts/commands/atomic-commit.md +8 -6
  451. package/dist/prompts/commands/brainstorm.md +5 -149
  452. package/dist/prompts/commands/create-verification-skill.md +8 -48
  453. package/dist/prompts/commands/discuss-phase.md +6 -10
  454. package/dist/prompts/commands/execute-phase.md +18 -45
  455. package/dist/prompts/commands/fix.md +16 -128
  456. package/dist/prompts/commands/grill.md +6 -53
  457. package/dist/prompts/commands/init-project.md +13 -18
  458. package/dist/prompts/commands/map-codebase.md +3 -3
  459. package/dist/prompts/commands/new-project.md +12 -17
  460. package/dist/prompts/commands/next-milestone.md +4 -8
  461. package/dist/prompts/commands/orchestrate-loop.md +12 -12
  462. package/dist/prompts/commands/orchestrate.md +12 -11
  463. package/dist/prompts/commands/pause-work.md +1 -1
  464. package/dist/prompts/commands/plan-phase.md +15 -37
  465. package/dist/prompts/commands/quick.md +11 -64
  466. package/dist/prompts/commands/resolve-conflicts.md +2 -15
  467. package/dist/prompts/commands/triage.md +3 -14
  468. package/dist/prompts/commands/verify-work.md +15 -63
  469. package/dist/prompts/commands/why.md +18 -118
  470. package/dist/skills/atomic-reasoning/SKILL.md +6 -105
  471. package/dist/skills/blast-radius/SKILL.md +1 -1
  472. package/dist/skills/epistemics/SKILL.md +12 -87
  473. package/dist/skills/explainers/SKILL.md +1 -1
  474. package/dist/skills/typescript-discipline/SKILL.md +12 -42
  475. package/dist/skills/typescript-discipline/references/patterns.md +25 -266
  476. package/dist/skills/unslop/SKILL.md +14 -105
  477. package/dist/utils/ansi.d.ts +8 -0
  478. package/dist/utils/ansi.d.ts.map +1 -1
  479. package/dist/utils/ansi.js +30 -11
  480. package/dist/utils/ansi.js.map +1 -1
  481. package/dist/utils/clipboard-command.d.ts.map +1 -1
  482. package/dist/utils/clipboard-command.js +3 -0
  483. package/dist/utils/clipboard-command.js.map +1 -1
  484. package/dist/utils/clipboard.d.ts.map +1 -1
  485. package/dist/utils/clipboard.js +18 -12
  486. package/dist/utils/clipboard.js.map +1 -1
  487. package/dist/utils/draht-user-agent.d.ts +1 -0
  488. package/dist/utils/draht-user-agent.d.ts.map +1 -1
  489. package/dist/utils/draht-user-agent.js +3 -2
  490. package/dist/utils/draht-user-agent.js.map +1 -1
  491. package/dist/utils/image-convert.d.ts +12 -0
  492. package/dist/utils/image-convert.d.ts.map +1 -1
  493. package/dist/utils/image-convert.js +45 -6
  494. package/dist/utils/image-convert.js.map +1 -1
  495. package/dist/utils/image-resize-core.d.ts +12 -0
  496. package/dist/utils/image-resize-core.d.ts.map +1 -1
  497. package/dist/utils/image-resize-core.js +5 -0
  498. package/dist/utils/image-resize-core.js.map +1 -1
  499. package/dist/utils/image-resize-worker.js +3 -2
  500. package/dist/utils/image-resize-worker.js.map +1 -1
  501. package/dist/utils/image-resize.d.ts.map +1 -1
  502. package/dist/utils/image-resize.js +9 -10
  503. package/dist/utils/image-resize.js.map +1 -1
  504. package/dist/utils/output-files.d.ts +15 -0
  505. package/dist/utils/output-files.d.ts.map +1 -0
  506. package/dist/utils/output-files.js +30 -0
  507. package/dist/utils/output-files.js.map +1 -0
  508. package/dist/utils/shell.d.ts.map +1 -1
  509. package/dist/utils/shell.js +43 -13
  510. package/dist/utils/shell.js.map +1 -1
  511. package/dist/utils/syntax-highlight.d.ts.map +1 -1
  512. package/dist/utils/syntax-highlight.js +6 -1
  513. package/dist/utils/syntax-highlight.js.map +1 -1
  514. package/dist/utils/tools-manager.d.ts.map +1 -1
  515. package/dist/utils/tools-manager.js +4 -3
  516. package/dist/utils/tools-manager.js.map +1 -1
  517. package/docs/cli-integration.md +1 -1
  518. package/docs/cli.md +30 -26
  519. package/docs/codemode.md +230 -0
  520. package/docs/compaction.md +5 -5
  521. package/docs/containerization.md +1 -1
  522. package/docs/custom-provider.md +53 -1
  523. package/docs/docs.json +17 -1
  524. package/docs/drahtbank.md +163 -0
  525. package/docs/environment-variables.md +5 -2
  526. package/docs/extensions.md +143 -13
  527. package/docs/index.md +1 -1
  528. package/docs/json.md +3 -3
  529. package/docs/keybindings.md +9 -5
  530. package/docs/llama-cpp.md +9 -2
  531. package/docs/mcp.md +59 -3
  532. package/docs/message-types.md +22 -4
  533. package/docs/models-configuration.md +187 -0
  534. package/docs/models.md +67 -4
  535. package/docs/nvidia-rtx-llama-cpp.md +96 -0
  536. package/docs/providers.md +70 -5
  537. package/docs/sdk.md +1 -1
  538. package/docs/settings.md +10 -8
  539. package/docs/terminal-setup.md +14 -0
  540. package/docs/themes.md +4 -2
  541. package/docs/tui.md +71 -1
  542. package/docs/usage.md +1 -1
  543. package/docs/windows.md +16 -2
  544. package/eval/drahtbank/adapters.d.mts +35 -0
  545. package/eval/drahtbank/adapters.mjs +192 -0
  546. package/eval/drahtbank/bank.d.mts +141 -0
  547. package/eval/drahtbank/bank.mjs +515 -0
  548. package/eval/drahtbank/cases-v2.d.mts +28 -0
  549. package/eval/drahtbank/cases-v2.mjs +164 -0
  550. package/eval/drahtbank/cases.d.mts +17 -0
  551. package/eval/drahtbank/cases.mjs +198 -0
  552. package/eval/drahtbank/cli.mjs +120 -0
  553. package/eval/drahtbank/grading-v2.d.mts +26 -0
  554. package/eval/drahtbank/grading-v2.mjs +227 -0
  555. package/eval/drahtbank/isolated-tools.ts +223 -0
  556. package/eval/drahtbank/isolation-worker.mjs +53 -0
  557. package/eval/drahtbank/isolation.d.mts +52 -0
  558. package/eval/drahtbank/isolation.mjs +345 -0
  559. package/eval/drahtbank/runtime-checks.d.mts +15 -0
  560. package/eval/drahtbank/runtime-checks.mjs +187 -0
  561. package/examples/extensions/dynamic-resources/dynamic.json +1 -1
  562. package/examples/extensions/minimal-mode.ts +4 -5
  563. package/examples/extensions/overlay-test.ts +2 -2
  564. package/examples/extensions/plan-mode/index.ts +6 -2
  565. package/examples/extensions/subagent/index.ts +4 -6
  566. package/hooks/checks/checks-runtime.cjs +215 -0
  567. package/hooks/checks/git-safety.cjs +198 -0
  568. package/hooks/checks/git-safety.d.cts +1 -0
  569. package/hooks/gsd/draht-post-task.js +78 -39
  570. package/hooks/gsd/draht-quality-gate.js +210 -122
  571. package/hooks/gsd/package.json +3 -0
  572. package/package.json +21 -16
  573. package/prompts/commands/atomic-commit.md +8 -6
  574. package/prompts/commands/brainstorm.md +5 -149
  575. package/prompts/commands/create-verification-skill.md +8 -48
  576. package/prompts/commands/discuss-phase.md +6 -10
  577. package/prompts/commands/execute-phase.md +18 -45
  578. package/prompts/commands/fix.md +16 -128
  579. package/prompts/commands/grill.md +6 -53
  580. package/prompts/commands/init-project.md +13 -18
  581. package/prompts/commands/map-codebase.md +3 -3
  582. package/prompts/commands/new-project.md +12 -17
  583. package/prompts/commands/next-milestone.md +4 -8
  584. package/prompts/commands/orchestrate-loop.md +12 -12
  585. package/prompts/commands/orchestrate.md +12 -11
  586. package/prompts/commands/pause-work.md +1 -1
  587. package/prompts/commands/plan-phase.md +15 -37
  588. package/prompts/commands/quick.md +11 -64
  589. package/prompts/commands/resolve-conflicts.md +2 -15
  590. package/prompts/commands/triage.md +3 -14
  591. package/prompts/commands/verify-work.md +15 -63
  592. package/prompts/commands/why.md +18 -118
  593. package/schemas/keybindings.schema.json +433 -0
  594. package/schemas/models.schema.json +1190 -0
  595. package/schemas/settings.schema.json +849 -0
  596. package/schemas/theme.schema.json +365 -0
  597. package/skills/atomic-reasoning/SKILL.md +6 -105
  598. package/skills/blast-radius/SKILL.md +1 -1
  599. package/skills/epistemics/SKILL.md +12 -87
  600. package/skills/explainers/SKILL.md +1 -1
  601. package/skills/typescript-discipline/SKILL.md +12 -42
  602. package/skills/typescript-discipline/references/patterns.md +25 -266
  603. package/skills/unslop/SKILL.md +14 -105
  604. package/dist/bundle/chunks/anthropic-messages-E2P6C3P7.js +0 -6
  605. package/dist/bundle/chunks/azure-openai-responses-JZMSTDIM.js +0 -2
  606. package/dist/bundle/chunks/chunk-2E5VODES.js +0 -2
  607. package/dist/bundle/chunks/chunk-3DQNSI5W.js +0 -137
  608. package/dist/bundle/chunks/chunk-4COXSQRQ.js +0 -18
  609. package/dist/bundle/chunks/chunk-D3HO453P.js +0 -42
  610. package/dist/bundle/chunks/chunk-GVXA72ZA.js +0 -2
  611. package/dist/bundle/chunks/chunk-I2SOJ4JN.js +0 -65
  612. package/dist/bundle/chunks/chunk-I5OKY6RH.js +0 -11
  613. package/dist/bundle/chunks/chunk-ILSPVHVH.js +0 -1623
  614. package/dist/bundle/chunks/chunk-KY2BG6BC.js +0 -11
  615. package/dist/bundle/chunks/chunk-PGJAHC3R.js +0 -107
  616. package/dist/bundle/chunks/chunk-QVFELZW2.js +0 -312
  617. package/dist/bundle/chunks/chunk-QVTLBSTH.js +0 -4
  618. package/dist/bundle/chunks/chunk-SDRCE6OP.js +0 -2
  619. package/dist/bundle/chunks/chunk-U6LDZZGM.js +0 -146
  620. package/dist/bundle/chunks/chunk-X3YFUSCK.js +0 -82
  621. package/dist/bundle/chunks/chunk-XBUEMKIY.js +0 -2
  622. package/dist/bundle/chunks/chunk-XHCO4PPH.js +0 -8
  623. package/dist/bundle/chunks/chunk-YH7HNI7D.js +0 -2
  624. package/dist/bundle/chunks/cloudflare-workers-ai-system-one-MJKOAE5S.js +0 -2
  625. package/dist/bundle/chunks/execute-AGEWJLIO.js +0 -18
  626. package/dist/bundle/chunks/google-generative-ai-HPNDIAZD.js +0 -2
  627. package/dist/bundle/chunks/google-vertex-KPAWJ4SP.js +0 -2
  628. package/dist/bundle/chunks/mistral-conversations-FMSPWQ7A.js +0 -5
  629. package/dist/bundle/chunks/node-4JNG6XQO.js +0 -16
  630. package/dist/bundle/chunks/openai-codex-responses-TU7NGPXE.js +0 -10
  631. package/dist/bundle/chunks/openai-completions-GANCQQO5.js +0 -7
  632. package/dist/bundle/chunks/openai-responses-ASDPAX3E.js +0 -3
  633. package/dist/bundle/chunks/openrouter-images-NROSQXMZ.js +0 -2
  634. package/dist/bundle/chunks/pi-messages-2QEJYOAO.js +0 -8
  635. package/dist/bundle/chunks/runtime-2B56SZM6.js +0 -2
  636. package/dist/bundle/chunks/runtime-TJ3EAMJK.js +0 -3
  637. package/dist/bundle/chunks/settings-manager-HC5RR36T.js +0 -2
  638. package/dist/bundle/chunks/typesafe-system-one-YBEEY5XU.js +0 -2
  639. package/dist/bundle/chunks/virtual-modules-XKLDADFR.js +0 -2
  640. package/dist/core/provider-attribution.d.ts +0 -4
  641. package/dist/core/provider-attribution.d.ts.map +0 -1
  642. package/dist/core/provider-attribution.js +0 -72
  643. package/dist/core/provider-attribution.js.map +0 -1
  644. package/dist/experimental/micro/api.d.ts +0 -81
  645. package/dist/experimental/micro/api.d.ts.map +0 -1
  646. package/dist/experimental/micro/api.js +0 -2
  647. package/dist/experimental/micro/api.js.map +0 -1
  648. package/dist/experimental/micro/main.d.ts +0 -3
  649. package/dist/experimental/micro/main.d.ts.map +0 -1
  650. package/dist/experimental/micro/main.js +0 -21
  651. package/dist/experimental/micro/main.js.map +0 -1
  652. package/dist/experimental/micro/models.d.ts +0 -11
  653. package/dist/experimental/micro/models.d.ts.map +0 -1
  654. package/dist/experimental/micro/models.js +0 -95
  655. package/dist/experimental/micro/models.js.map +0 -1
  656. package/dist/experimental/micro/runtime.d.ts +0 -12
  657. package/dist/experimental/micro/runtime.d.ts.map +0 -1
  658. package/dist/experimental/micro/runtime.js +0 -465
  659. package/dist/experimental/micro/runtime.js.map +0 -1
  660. package/dist/experimental/micro/sessions.d.ts +0 -10
  661. package/dist/experimental/micro/sessions.d.ts.map +0 -1
  662. package/dist/experimental/micro/sessions.js +0 -41
  663. package/dist/experimental/micro/sessions.js.map +0 -1
  664. package/dist/experimental/micro/tools.d.ts +0 -10
  665. package/dist/experimental/micro/tools.d.ts.map +0 -1
  666. package/dist/experimental/micro/tools.js +0 -96
  667. package/dist/experimental/micro/tools.js.map +0 -1
  668. package/dist/experimental/micro/tui.d.ts +0 -3
  669. package/dist/experimental/micro/tui.d.ts.map +0 -1
  670. package/dist/experimental/micro/tui.js +0 -510
  671. package/dist/experimental/micro/tui.js.map +0 -1
  672. package/dist/experimental/mini/main.d.ts +0 -7
  673. package/dist/experimental/mini/main.d.ts.map +0 -1
  674. package/dist/experimental/mini/main.js +0 -21
  675. package/dist/experimental/mini/main.js.map +0 -1
  676. package/dist/experimental/mini/server/entry.d.ts +0 -3
  677. package/dist/experimental/mini/server/entry.d.ts.map +0 -1
  678. package/dist/experimental/mini/server/entry.js +0 -11
  679. package/dist/experimental/mini/server/entry.js.map +0 -1
  680. package/dist/experimental/mini/server/run.d.ts +0 -13
  681. package/dist/experimental/mini/server/run.d.ts.map +0 -1
  682. package/dist/experimental/mini/server/run.js +0 -150
  683. package/dist/experimental/mini/server/run.js.map +0 -1
  684. package/dist/experimental/mini/shared/protocol.d.ts +0 -127
  685. package/dist/experimental/mini/shared/protocol.d.ts.map +0 -1
  686. package/dist/experimental/mini/shared/protocol.js +0 -13
  687. package/dist/experimental/mini/shared/protocol.js.map +0 -1
  688. package/dist/experimental/mini/shared/rpc.d.ts +0 -49
  689. package/dist/experimental/mini/shared/rpc.d.ts.map +0 -1
  690. package/dist/experimental/mini/shared/rpc.js +0 -171
  691. package/dist/experimental/mini/shared/rpc.js.map +0 -1
  692. package/dist/experimental/mini/shared/transport.d.ts +0 -35
  693. package/dist/experimental/mini/shared/transport.d.ts.map +0 -1
  694. package/dist/experimental/mini/shared/transport.js +0 -94
  695. package/dist/experimental/mini/shared/transport.js.map +0 -1
  696. package/dist/experimental/mini/tui/run.d.ts +0 -9
  697. package/dist/experimental/mini/tui/run.d.ts.map +0 -1
  698. package/dist/experimental/mini/tui/run.js +0 -62
  699. package/dist/experimental/mini/tui/run.js.map +0 -1
  700. package/dist/experimental/mini/tui/session.d.ts +0 -26
  701. package/dist/experimental/mini/tui/session.d.ts.map +0 -1
  702. package/dist/experimental/mini/tui/session.js +0 -94
  703. package/dist/experimental/mini/tui/session.js.map +0 -1
  704. package/dist/experimental/mini/tui/view.d.ts +0 -10
  705. package/dist/experimental/mini/tui/view.d.ts.map +0 -1
  706. package/dist/experimental/mini/tui/view.js +0 -461
  707. package/dist/experimental/mini/tui/view.js.map +0 -1
  708. package/dist/experimental/mini/worker/entry.d.ts +0 -3
  709. package/dist/experimental/mini/worker/entry.d.ts.map +0 -1
  710. package/dist/experimental/mini/worker/entry.js +0 -10
  711. package/dist/experimental/mini/worker/entry.js.map +0 -1
  712. package/dist/experimental/mini/worker/lane-service.d.ts +0 -44
  713. package/dist/experimental/mini/worker/lane-service.d.ts.map +0 -1
  714. package/dist/experimental/mini/worker/lane-service.js +0 -97
  715. package/dist/experimental/mini/worker/lane-service.js.map +0 -1
  716. package/dist/experimental/mini/worker/models-service.d.ts +0 -19
  717. package/dist/experimental/mini/worker/models-service.d.ts.map +0 -1
  718. package/dist/experimental/mini/worker/models-service.js +0 -136
  719. package/dist/experimental/mini/worker/models-service.js.map +0 -1
  720. package/dist/experimental/mini/worker/run.d.ts +0 -14
  721. package/dist/experimental/mini/worker/run.d.ts.map +0 -1
  722. package/dist/experimental/mini/worker/run.js +0 -88
  723. package/dist/experimental/mini/worker/run.js.map +0 -1
  724. package/dist/modes/interactive/theme/theme-json.d.ts +0 -85
  725. package/dist/modes/interactive/theme/theme-json.d.ts.map +0 -1
  726. package/dist/modes/interactive/theme/theme-json.js +0 -132
  727. package/dist/modes/interactive/theme/theme-json.js.map +0 -1
  728. package/dist/modes/interactive/theme/theme-schema.json +0 -361
  729. /package/dist/bundle/chunks/{chunk-FBU742QF.js → chunk-MOOADNVS.js} +0 -0
@@ -0,0 +1,345 @@
1
+ import { spawn as spawnProcess, spawnSync } from "node:child_process";
2
+ import { createHash, randomUUID } from "node:crypto";
3
+ import {
4
+ accessSync, closeSync, constants, existsSync, fstatSync, lstatSync, mkdirSync, mkdtempSync, openSync,
5
+ readFileSync, readdirSync, readSync, realpathSync, rmSync, statSync, symlinkSync, writeFileSync,
6
+ } from "node:fs";
7
+ import { homedir, tmpdir } from "node:os";
8
+ import { delimiter, dirname, isAbsolute, join, relative } from "node:path";
9
+ import { fileURLToPath } from "node:url";
10
+
11
+ export const ISOLATION_VERSION = "linux-user-mount-pid-net-ipc-chroot-v1";
12
+ const WORKER = fileURLToPath(new URL("./isolation-worker.mjs", import.meta.url));
13
+ const WORKER_PATH = "/.drahtbank/worker.mjs";
14
+ const NODE_RUNTIME_PATH = "/.drahtbank/bin/node";
15
+ const ARTIFACTS_PATH = "/.drahtbank/artifacts";
16
+ const MAX_OUTPUT = 10 * 1024 * 1024;
17
+ const MAX_FILESYSTEM_OUTPUT = Math.ceil(MAX_OUTPUT / 3) * 4 + 1024;
18
+ const RUNTIME_ROOTS = ["/nix/store", "/usr", "/bin", "/lib", "/lib64", "/run/current-system/sw"];
19
+ const SETUP = `
20
+ set -eu
21
+ root=$1
22
+ workspace=$2
23
+ worker=$3
24
+ chroot_bin=$4
25
+ setpriv_bin=$5
26
+ mount_bin=$6
27
+ mkdir_bin=$7
28
+ touch_bin=$8
29
+ shell_bin=$9
30
+ shift 9
31
+ root_count=$1
32
+ shift
33
+ artifacts=$1
34
+ shift
35
+ node_runtime=$1
36
+ shift
37
+ "$mount_bin" --make-rprivate /
38
+ "$mount_bin" -t tmpfs -o size=16m,nosuid,nodev,uid=0,gid=0 tmpfs "$root"
39
+ "$mkdir_bin" -p "$root/.drahtbank" "$root/dev" "$root$workspace"
40
+ while [ "$root_count" -gt 0 ]; do
41
+ runtime=$1
42
+ shift
43
+ root_count=$((root_count - 1))
44
+ "$mkdir_bin" -p "$root$runtime"
45
+ "$mount_bin" --bind "$runtime" "$root$runtime"
46
+ "$mount_bin" -o remount,bind,ro,nosuid,nodev "$root$runtime"
47
+ done
48
+ if [ -n "$node_runtime" ]; then
49
+ "$mkdir_bin" -p "$root/.drahtbank/bin"
50
+ "$touch_bin" "$root${NODE_RUNTIME_PATH}"
51
+ "$mount_bin" --bind "$node_runtime" "$root${NODE_RUNTIME_PATH}"
52
+ "$mount_bin" -o remount,bind,ro,nosuid,nodev "$root${NODE_RUNTIME_PATH}"
53
+ fi
54
+ "$touch_bin" "$root/.drahtbank/worker.mjs"
55
+ "$mount_bin" --bind "$worker" "$root/.drahtbank/worker.mjs"
56
+ "$mount_bin" -o remount,bind,ro,nosuid,nodev "$root/.drahtbank/worker.mjs"
57
+ "$mount_bin" --bind "$workspace" "$root$workspace"
58
+ "$mount_bin" -o remount,bind,rw,nosuid,nodev "$root$workspace"
59
+ if [ -n "$artifacts" ]; then
60
+ "$mkdir_bin" -p "$root/.drahtbank/artifacts"
61
+ "$mount_bin" --bind "$artifacts" "$root/.drahtbank/artifacts"
62
+ "$mount_bin" -o remount,bind,ro,nosuid,nodev,noexec "$root/.drahtbank/artifacts"
63
+ fi
64
+ for device in null zero random urandom; do
65
+ "$touch_bin" "$root/dev/$device"
66
+ "$mount_bin" --bind "/dev/$device" "$root/dev/$device"
67
+ "$mount_bin" -o remount,bind,nosuid,noexec "$root/dev/$device"
68
+ done
69
+ "$mount_bin" -o remount,bind,ro,nosuid,nodev "$root"
70
+ exec "$chroot_bin" "$root" "$setpriv_bin" --no-new-privs --inh-caps=-all --ambient-caps=-all --bounding-set=-all -- "$shell_bin" --noprofile --norc -c 'cd -- "$1"; shift; exec "$@"' -- "$workspace" "$@"
71
+ `;
72
+
73
+ function contained(path, root) {
74
+ const suffix = relative(root, path);
75
+ return !suffix || (!isAbsolute(suffix) && suffix !== ".." && !suffix.startsWith("../"));
76
+ }
77
+
78
+ function unavailable(message) {
79
+ return new Error(`Drahtbank isolation unavailable: ${message}`);
80
+ }
81
+
82
+ function checkedArgv(argv) {
83
+ if (!Array.isArray(argv) || !argv.length || !argv[0] || argv.some((arg) => typeof arg !== "string" || arg.includes("\0"))) {
84
+ throw new Error("Isolated command must be a nonempty literal argv array");
85
+ }
86
+ return argv;
87
+ }
88
+
89
+ function timeout(value = 30_000) {
90
+ if (!Number.isInteger(value) || value < 1 || value > 3_600_000) throw new Error("Invalid isolation timeout");
91
+ return value;
92
+ }
93
+
94
+ function rejectReservedWorkspace(workspace) {
95
+ if (contained(workspace, "/.drahtbank") || contained("/.drahtbank", workspace)) {
96
+ throw unavailable("workspace overlaps protected root /.drahtbank");
97
+ }
98
+ }
99
+
100
+ function createExecutor(workspace) {
101
+ if (process.platform !== "linux") throw unavailable(`unsupported platform ${process.platform}`);
102
+ if (isAbsolute(workspace)) rejectReservedWorkspace(workspace);
103
+ workspace = realpathSync(workspace);
104
+ rejectReservedWorkspace(workspace);
105
+ if (!statSync(workspace).isDirectory()) throw unavailable("workspace is not a directory");
106
+ const runtimeRoots = RUNTIME_ROOTS.filter((path) => existsSync(path) && statSync(path).isDirectory());
107
+ for (const root of ["/", homedir(), tmpdir(), ...runtimeRoots]) {
108
+ if (contained(realpathSync(root), workspace) || (runtimeRoots.includes(root) && contained(workspace, realpathSync(root)))) {
109
+ throw unavailable("workspace overlaps a protected root");
110
+ }
111
+ }
112
+ const inspect = (directory) => {
113
+ for (const name of readdirSync(directory)) {
114
+ const path = join(directory, name);
115
+ const entry = lstatSync(path);
116
+ if (entry.isDirectory()) inspect(path);
117
+ else if (entry.isFile()) {
118
+ if (entry.nlink !== 1) throw unavailable("fixture contains a hardlinked file");
119
+ } else if (!entry.isSymbolicLink()) {
120
+ throw unavailable("fixture contains a socket, device, or other special file");
121
+ }
122
+ }
123
+ };
124
+ inspect(workspace);
125
+ const runtimeAllows = (path) => runtimeRoots.some((root) => contained(path, realpathSync(root)));
126
+ const resolveExecutable = (name) => {
127
+ if (typeof name !== "string" || !/^[a-zA-Z0-9._+-]+$/.test(name)) throw unavailable("invalid executable name");
128
+ const candidates = ["/run/current-system/sw/bin", "/usr/bin", "/bin", ...(process.env.PATH ?? "").split(delimiter)];
129
+ for (const directory of candidates) {
130
+ try {
131
+ // Preserve the executable's basename: Nix coreutils uses symlinks to a
132
+ // multicall binary whose real path does not identify the requested tool.
133
+ const candidate = join(realpathSync(directory), name);
134
+ if (!runtimeAllows(realpathSync(candidate)) || !statSync(candidate).isFile()) continue;
135
+ accessSync(candidate, constants.X_OK);
136
+ return candidate;
137
+ } catch {}
138
+ }
139
+ throw unavailable(`${name} is not available in a readonly runtime root`);
140
+ };
141
+ const bins = Object.fromEntries(["unshare", "bash", "chroot", "setpriv", "mount", "mkdir", "touch", "rg", "fd"].map((name) => [name, resolveExecutable(name)]));
142
+ const sourceNodePath = realpathSync(process.execPath);
143
+ if (contained(sourceNodePath, workspace)) throw unavailable("workspace overlaps Node executable");
144
+ if (!statSync(sourceNodePath).isFile()) throw unavailable("Node executable is not a regular file");
145
+ accessSync(sourceNodePath, constants.X_OK);
146
+ const runtimeFiles = runtimeAllows(sourceNodePath) ? [] : [{ source: sourceNodePath, target: NODE_RUNTIME_PATH }];
147
+ const nodePath = runtimeFiles[0]?.target ?? sourceNodePath;
148
+ const paths = new Set([dirname(nodePath), ...Object.values(bins).map(dirname)]);
149
+ for (const entry of (process.env.PATH ?? "").split(delimiter)) {
150
+ try {
151
+ const path = realpathSync(entry);
152
+ if (runtimeAllows(path) && statSync(path).isDirectory()) paths.add(path);
153
+ } catch {}
154
+ }
155
+ const env = {
156
+ PATH: [...paths].join(delimiter), HOME: workspace, TMPDIR: workspace, TMP: workspace, TEMP: workspace,
157
+ SHELL: bins.bash, PWD: workspace, LANG: "C.UTF-8", LC_ALL: "C.UTF-8", TERM: "dumb",
158
+ GIT_CONFIG_NOSYSTEM: "1", GIT_CONFIG_GLOBAL: "/dev/null", GIT_CEILING_DIRECTORIES: dirname(workspace),
159
+ };
160
+ let artifactDirectory;
161
+ let disposed = false;
162
+ const children = new Set();
163
+ const requireActive = () => {
164
+ if (disposed) throw new Error("Drahtbank isolation has been disposed");
165
+ };
166
+ const retainReadOnlyFile = (source) => {
167
+ requireActive();
168
+ if (typeof source !== "string" || !isAbsolute(source) || contained(realpathSync(source), workspace)) {
169
+ throw new Error("Readonly artifacts must be trusted capture files outside the fixture");
170
+ }
171
+ if (!lstatSync(source).isFile()) throw new Error("Readonly artifact must be a regular nonsymlink file");
172
+ const fd = openSync(source, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
173
+ try {
174
+ const entry = fstatSync(fd);
175
+ if (!entry.isFile() || entry.size > MAX_OUTPUT) throw new Error("Readonly artifact must be a regular file of at most 10 MiB");
176
+ const bytes = Buffer.alloc(MAX_OUTPUT + 1);
177
+ let length = 0;
178
+ for (;;) {
179
+ const count = readSync(fd, bytes, length, bytes.length - length, null);
180
+ length += count;
181
+ if (length > MAX_OUTPUT) throw new Error("Readonly artifact exceeded 10 MiB");
182
+ if (count === 0) break;
183
+ }
184
+ artifactDirectory ??= mkdtempSync(join(tmpdir(), "drahtbank-artifacts-"));
185
+ const name = `${randomUUID()}.txt`;
186
+ writeFileSync(join(artifactDirectory, name), bytes.subarray(0, length), { flag: "wx", mode: 0o600 });
187
+ return `${ARTIFACTS_PATH}/${name}`;
188
+ } finally {
189
+ closeSync(fd);
190
+ }
191
+ };
192
+ const invocation = (argv) => {
193
+ requireActive();
194
+ checkedArgv(argv);
195
+ const root = mkdtempSync(join(tmpdir(), "drahtbank-root-"));
196
+ const args = [
197
+ "--user", "--map-root-user", "--mount", "--net", "--ipc", "--pid", "--fork", "--kill-child=KILL", "--",
198
+ bins.bash, "--noprofile", "--norc", "-c", SETUP, "--",
199
+ root, workspace, WORKER, bins.chroot, bins.setpriv, bins.mount, bins.mkdir, bins.touch, bins.bash,
200
+ String(runtimeRoots.length), artifactDirectory ?? "", runtimeFiles[0]?.source ?? "", ...runtimeRoots, ...argv,
201
+ ];
202
+ return { root, command: bins.unshare, args };
203
+ };
204
+ const spawn = (argv, options = {}) => {
205
+ const built = invocation(argv);
206
+ let child;
207
+ try {
208
+ child = spawnProcess(built.command, built.args, {
209
+ cwd: workspace, env, stdio: ["pipe", "pipe", "pipe"],
210
+ signal: options.signal, killSignal: "SIGKILL",
211
+ });
212
+ } catch (error) {
213
+ rmSync(built.root, { recursive: true, force: true });
214
+ throw error;
215
+ }
216
+ children.add(child);
217
+ // unshare ignores SIGTERM while waiting. Its death signal tears down PID 1,
218
+ // which kills even detached descendants; ordinary tool cancellation must
219
+ // therefore kill this supervisor rather than leave a namespace behind.
220
+ const kill = child.kill.bind(child);
221
+ child.kill = (signal) => kill(signal === undefined || signal === "SIGTERM" || signal === 15 ? "SIGKILL" : signal);
222
+ child.once("close", () => {
223
+ children.delete(child);
224
+ rmSync(built.root, { recursive: true, force: true });
225
+ });
226
+ return child;
227
+ };
228
+ const runWithLimit = (argv, options, outputLimit) => new Promise((finish) => {
229
+ const timeoutMs = timeout(options.timeoutMs);
230
+ const started = performance.now();
231
+ const child = spawn(argv);
232
+ let stdout = "", stderr = "", error = null, timedOut = false, total = 0;
233
+ const kill = () => {
234
+ child.kill("SIGKILL");
235
+ };
236
+ const onAbort = () => { error = "Isolated process aborted"; kill(); };
237
+ const timer = setTimeout(() => { timedOut = true; error = "Isolated process timed out"; kill(); }, timeoutMs);
238
+ for (const [stream, key] of [[child.stdout, "stdout"], [child.stderr, "stderr"]]) {
239
+ stream.setEncoding("utf8");
240
+ stream.on("data", (chunk) => {
241
+ total += Buffer.byteLength(chunk);
242
+ if (total > outputLimit) { error = "Isolated process output exceeded its capture limit"; kill(); return; }
243
+ options.onData?.(Buffer.from(chunk));
244
+ if (key === "stdout") stdout += chunk; else stderr += chunk;
245
+ });
246
+ }
247
+ child.once("error", (cause) => { error = cause.message; });
248
+ child.stdin.on("error", () => {});
249
+ child.once("close", (exitCode, signal) => {
250
+ clearTimeout(timer);
251
+ options.signal?.removeEventListener("abort", onAbort);
252
+ finish({ exitCode, signal, stdout, stderr, error, timedOut, elapsedMs: Math.round(performance.now() - started) });
253
+ });
254
+ if (options.signal?.aborted) onAbort();
255
+ else options.signal?.addEventListener("abort", onAbort, { once: true });
256
+ child.stdin.end(options.stdin ?? "");
257
+ });
258
+ const run = (argv, options = {}) => runWithLimit(argv, options, MAX_OUTPUT);
259
+ const runSync = (argv, options = {}) => {
260
+ const started = performance.now();
261
+ const timeoutMs = timeout(options.timeoutMs);
262
+ const built = invocation(argv);
263
+ try {
264
+ const result = spawnSync(built.command, built.args, {
265
+ cwd: workspace, env, encoding: "utf8", input: options.stdin ?? "",
266
+ timeout: timeoutMs, killSignal: "SIGKILL", maxBuffer: MAX_OUTPUT,
267
+ });
268
+ return { exitCode: result.status, signal: result.signal, stdout: result.stdout ?? "", stderr: result.stderr ?? "",
269
+ error: result.error?.message ?? null, timedOut: result.error?.code === "ETIMEDOUT", elapsedMs: Math.round(performance.now() - started) };
270
+ } finally {
271
+ rmSync(built.root, { recursive: true, force: true });
272
+ }
273
+ };
274
+ const fs = async (request, options = {}) => {
275
+ const result = await runWithLimit([nodePath, WORKER_PATH], { ...options, stdin: JSON.stringify(request) }, MAX_FILESYSTEM_OUTPUT);
276
+ if (result.error || result.exitCode !== 0) throw new Error(result.error ?? (result.stderr.trim() || "Isolated filesystem worker failed"));
277
+ let response;
278
+ try { response = JSON.parse(result.stdout); } catch { throw new Error("Invalid isolated filesystem response"); }
279
+ if (response?.ok !== true) {
280
+ const error = new Error(typeof response?.message === "string" ? response.message : "Isolated filesystem operation failed");
281
+ if (typeof response?.code === "string") error.code = response.code;
282
+ throw error;
283
+ }
284
+ return response.value;
285
+ };
286
+ const dispose = () => {
287
+ if (disposed) return;
288
+ disposed = true;
289
+ for (const child of children) child.kill("SIGKILL");
290
+ if (artifactDirectory) rmSync(artifactDirectory, { recursive: true, force: true });
291
+ };
292
+ return {
293
+ workspace, nodePath, shellPath: bins.bash, workerPath: WORKER_PATH, spawn, run, runSync, fs, resolveExecutable,
294
+ retainReadOnlyFile, dispose,
295
+ evidence: {
296
+ policy: ISOLATION_VERSION, workspace, runtimeRoots, runtimeFiles,
297
+ workerSha256: createHash("sha256").update(readFileSync(WORKER)).digest("hex"),
298
+ network: "private namespace", hostProc: false, inheritedEnvironment: false,
299
+ readonlyArtifactsPath: ARTIFACTS_PATH,
300
+ },
301
+ };
302
+ }
303
+
304
+ export async function createIsolation(workspace) {
305
+ const executor = createExecutor(workspace);
306
+ const probeRoot = mkdtempSync(join(tmpdir(), "drahtbank-isolation-probe-"));
307
+ const probe = join(executor.workspace, `.drahtbank-isolation-${randomUUID()}`);
308
+ const marker = join(probeRoot, "outside");
309
+ const forbiddenWrite = join(probeRoot, "forbidden-write");
310
+ mkdirSync(probe);
311
+ writeFileSync(marker, "outside marker");
312
+ symlinkSync(marker, join(probe, "escape"));
313
+ try {
314
+ const source = `
315
+ const fs = require("node:fs");
316
+ const assert = require("node:assert/strict");
317
+ const [probe, outside, forbidden] = process.argv.slice(1);
318
+ const local = probe + "/local";
319
+ fs.writeFileSync(local, "inside");
320
+ assert.equal(fs.readFileSync(local, "utf8"), "inside");
321
+ for (const path of [outside, probe + "/escape", "/proc/self/environ"]) {
322
+ assert.throws(() => fs.readFileSync(path));
323
+ }
324
+ for (const path of [forbidden, probe + "/escape", "/.drahtbank/forbidden"]) {
325
+ assert.throws(() => fs.writeFileSync(path, "escaped"));
326
+ }
327
+ const environment = new Set(${JSON.stringify(["PATH", "HOME", "TMPDIR", "TMP", "TEMP", "SHELL", "PWD", "LANG", "LC_ALL", "TERM", "GIT_CONFIG_NOSYSTEM", "GIT_CONFIG_GLOBAL", "GIT_CEILING_DIRECTORIES", "_", "SHLVL", "OLDPWD"])});
328
+ assert.ok(Object.keys(process.env).every((name) => environment.has(name)));
329
+ fs.unlinkSync(local);
330
+ process.stdout.write("confined");
331
+ `;
332
+ const result = await executor.run([executor.nodePath, "-e", source, probe, marker, forbiddenWrite], { timeoutMs: 15_000 });
333
+ if (result.exitCode !== 0 || result.error || result.stdout !== "confined") {
334
+ throw unavailable(result.error ?? (result.stderr.trim() || `preflight exited ${result.exitCode}`));
335
+ }
336
+ if (readFileSync(marker, "utf8") !== "outside marker" || existsSync(forbiddenWrite)) {
337
+ throw unavailable("outside filesystem changed during preflight");
338
+ }
339
+ await executor.fs({ op: "access", path: executor.workspace });
340
+ return executor;
341
+ } finally {
342
+ rmSync(probe, { recursive: true, force: true });
343
+ rmSync(probeRoot, { recursive: true, force: true });
344
+ }
345
+ }
@@ -0,0 +1,15 @@
1
+ export interface RuntimeProof { id: string; file: string; requiredTests: string[]; }
2
+ export interface RuntimeResult { id: string; file: string; status: string; tests: number; requiredProofs: number; failures: Array<{name: string; messages: unknown}>; }
3
+ export interface RuntimeAssessment { complete: boolean; passed: boolean; tests: number; results: RuntimeResult[]; errors: string[]; }
4
+ export interface RuntimeReport {
5
+ schemaVersion: 1; lane: "runtime-checks"; startedAt: string; completedAt: string; complete: boolean; passed: boolean; modelCalls: 0;
6
+ root: string; packageRoot: string; identity: {node: string; platform: string; arch: string; nodeSha256: string; evaluatorPath: string; evaluatorSha256: string; tsxSha256: string; vitestSha256: string; tsxVersion: string; vitestVersion: string; commit: string; sourceChanges: string};
7
+ command: string[]; environment: {offline: boolean; packageDirectory: string; isolatedAgentDirectory: boolean; inheritedGitOverridesRemoved: boolean; inheritedNodeOptionsRemoved: boolean};
8
+ sourcesBefore: Record<string,string>; sourcesAfter: Record<string,string> | null; sourcesStable: boolean;
9
+ process: {exitCode: number | null; signal: string | null; error: string | null; elapsedMs: number};
10
+ stdoutSha256: string; stderrSha256: string; vitestSha256: string | null; reportError: string | null;
11
+ tests: number; results: RuntimeResult[]; errors: string[]; limits: string[];
12
+ }
13
+ export const RUNTIME_CHECKS: RuntimeProof[];
14
+ export function assessRuntimeChecks(value: unknown, packageRoot: string): RuntimeAssessment;
15
+ export function runRuntimeChecks(output: string, options?: {root?: string; timeoutMs?: number}): RuntimeReport;
@@ -0,0 +1,187 @@
1
+ import { execFileSync, spawnSync } from "node:child_process";
2
+ import { createHash } from "node:crypto";
3
+ import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
4
+ import { createRequire } from "node:module";
5
+ import { join, resolve } from "node:path";
6
+ import { fileURLToPath } from "node:url";
7
+
8
+ const ROOT = fileURLToPath(new URL("../../../..", import.meta.url));
9
+ const hash = value => createHash("sha256").update(value).digest("hex");
10
+ const json = (path, value) => writeFileSync(path, `${JSON.stringify(value, null, 2)}\n`);
11
+ const hosts = ["coding-agent", "draht-claude", "draht-codex"];
12
+
13
+ export const RUNTIME_CHECKS = [
14
+ {
15
+ id: "native-settlement", file: "test/suite/completion-checks.test.ts",
16
+ requiredTests: [
17
+ "does no automatic checks in an unconfigured project",
18
+ "never executes project commands before trust is granted",
19
+ "checks before settlement and gives the model real failure diagnostics to repair",
20
+ "aborts after three failed repairs and leaves a visible failure instead of success",
21
+ "records synchronous runner launch failures and enforces the repair cap",
22
+ "checks edits from later registered settlement handlers before accepting completion",
23
+ "preserves other settlement entries and continuation requests",
24
+ "cancels running checks promptly and starts the next request with a fresh signal",
25
+ "reuses valid evidence then reruns checks after a committed non-JavaScript change",
26
+ ].map(title => `automatic project checks ${title}`),
27
+ },
28
+ {
29
+ id: "configured-runtime", file: "test/checks-runtime.test.ts",
30
+ requiredTests: hosts.flatMap(host => [
31
+ "reuses successful evidence until an input changes",
32
+ "invalidates evidence when the command configuration changes",
33
+ "validates committed non-JavaScript work and reuses identical committed content",
34
+ "retries failed evidence on every attempt and reports actual process failure",
35
+ "does not retain a cached success after a forced check fails",
36
+ "invalidates an earlier successful check when a later command changes its inputs",
37
+ "invalidates evidence if a command changes configuration outside its input scope",
38
+ ].map(title => `'${host}' project checks runtime ${title}`)),
39
+ },
40
+ {
41
+ id: "plugin-stop", file: "test/plugin-stop-quality-gate.test.ts",
42
+ requiredTests: hosts.slice(1).flatMap(host => [
43
+ "does not let the host retry flag turn a failed check into a pass",
44
+ "runs configured checks for committed non-JavaScript changes without planning",
45
+ "honors a project checks opt-out without planning metadata",
46
+ "blocks malformed project check configuration",
47
+ ].map(title => `'${host}' stop quality gate ${title}`)),
48
+ },
49
+ ];
50
+
51
+ const SOURCE_PATHS = [
52
+ "packages/coding-agent/eval/drahtbank/runtime-checks.mjs",
53
+ ...RUNTIME_CHECKS.map(check => `packages/coding-agent/${check.file}`),
54
+ "packages/coding-agent/test/suite/harness.ts",
55
+ "packages/coding-agent/test/model-runtime-test-utils.ts",
56
+ "packages/coding-agent/test/utilities.ts",
57
+ "packages/coding-agent/test/setup/restore-cwd.ts",
58
+ "packages/coding-agent/test/setup/emitted-build-run.ts",
59
+ "packages/coding-agent/vitest.config.ts",
60
+ "packages/coding-agent/src/config.ts",
61
+ "packages/coding-agent/src/core/builtins/completion-checks.ts",
62
+ "packages/coding-agent/src/core/builtins/index.ts",
63
+ "packages/coding-agent/src/core/agent-session.ts",
64
+ "packages/coding-agent/src/core/agent-session-services.ts",
65
+ "packages/coding-agent/src/core/extensions/runner.ts",
66
+ "packages/coding-agent/src/utils/child-process.ts",
67
+ "packages/ai/src/providers/faux.ts",
68
+ "packages/coding-agent/hooks/checks/checks-runtime.cjs",
69
+ ...hosts.slice(1).flatMap(host => [
70
+ `packages/${host}/scripts/checks-runtime.cjs`, `packages/${host}/scripts/stop-quality-gate.cjs`,
71
+ ]),
72
+ "package.json", "bun.lock", "packages/coding-agent/package.json",
73
+ ];
74
+
75
+ /** Validate the complete selected test run, including named behavioral proofs. */
76
+ export function assessRuntimeChecks(value, packageRoot) {
77
+ const errors = [], results = [];
78
+ const reject = message => errors.push(message);
79
+ if (!value || typeof value !== "object" || !Array.isArray(value.testResults)) {
80
+ return { complete: false, passed: false, tests: 0, results, errors: ["Missing Vitest JSON test results"] };
81
+ }
82
+ if (value.testResults.length !== RUNTIME_CHECKS.length) reject("Expected exactly the three selected test files");
83
+ const seenFiles = new Set();
84
+ let tests = 0, passed = 0, failed = 0, skipped = 0, todo = 0;
85
+ for (const proof of RUNTIME_CHECKS) {
86
+ const path = resolve(packageRoot, proof.file);
87
+ const matches = value.testResults.filter(result => result?.name === path);
88
+ if (matches.length !== 1 || !Array.isArray(matches[0]?.assertionResults)) {
89
+ reject(`Missing or duplicate test file: ${proof.file}`); continue;
90
+ }
91
+ seenFiles.add(path);
92
+ const result = matches[0], names = new Set();
93
+ if (!["passed", "failed"].includes(result.status)) reject(`Invalid test-file status: ${proof.file}`);
94
+ if (!result.assertionResults.length) reject(`Empty test file: ${proof.file}`);
95
+ for (const assertion of result.assertionResults) {
96
+ tests++;
97
+ if (typeof assertion?.fullName !== "string" || !assertion.fullName || names.has(assertion.fullName)) reject(`Invalid or duplicate assertion: ${proof.file}`);
98
+ names.add(assertion?.fullName);
99
+ if (assertion?.status === "passed") passed++;
100
+ else if (assertion?.status === "failed") failed++;
101
+ else if (assertion?.status === "todo") todo++;
102
+ else if (["skipped", "pending", "disabled"].includes(assertion?.status)) skipped++;
103
+ else reject(`Invalid assertion status: ${proof.file}`);
104
+ }
105
+ for (const name of proof.requiredTests) if (!names.has(name)) reject(`Missing required proof: ${name}`);
106
+ results.push({ id: proof.id, file: proof.file, status: result.status, tests: result.assertionResults.length,
107
+ requiredProofs: proof.requiredTests.length, failures: result.assertionResults.filter(a => a?.status === "failed").map(a => ({ name: a.fullName, messages: a.failureMessages })) });
108
+ }
109
+ if (seenFiles.size !== value.testResults.length) reject("Unselected test files in report");
110
+ for (const [name, expected] of Object.entries({ numTotalTests: tests, numPassedTests: passed, numFailedTests: failed, numPendingTests: skipped, numTodoTests: todo })) {
111
+ if (value[name] !== expected) reject(`Inconsistent Vitest count: ${name}`);
112
+ }
113
+ if (skipped || todo) reject("Skipped, pending, disabled or todo tests do not establish runtime evidence");
114
+ if (value.numPendingTestSuites !== 0) reject("Pending test suites do not establish runtime evidence");
115
+ const complete = errors.length === 0;
116
+ if (failed || value.numFailedTestSuites !== 0 || value.success !== true || results.some(result => result.status !== "passed")) reject("Runtime checks failed");
117
+ return { complete, passed: errors.length === 0, tests, results, errors };
118
+ }
119
+
120
+ function snapshot(root) {
121
+ return Object.fromEntries(SOURCE_PATHS.map(path => [path, hash(readFileSync(join(root, path)))]));
122
+ }
123
+
124
+ export function runRuntimeChecks(output, options = {}) {
125
+ const root = resolve(options.root ?? ROOT), packageRoot = join(root, "packages/coding-agent");
126
+ output = resolve(output);
127
+ const timeoutMs = options.timeoutMs ?? 180_000;
128
+ if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > 3_600_000) throw new Error("timeoutMs must be from 1 to 3600000");
129
+ if (existsSync(output) && readdirSync(output).length) throw new Error("Choose an empty runtime-checks output directory");
130
+ const sourcesBefore = snapshot(root);
131
+ const packageRequire = createRequire(join(packageRoot, "package.json"));
132
+ const tsx = packageRequire.resolve("tsx/cli"), vitest = packageRequire.resolve("vitest/dist/cli.js");
133
+ const env = Object.fromEntries(Object.entries(process.env).filter(([name]) => !name.startsWith("GIT_") && name !== "NODE_OPTIONS"));
134
+ const identity = { node: process.version, platform: process.platform, arch: process.arch, nodeSha256: hash(readFileSync(process.execPath)),
135
+ evaluatorPath: fileURLToPath(import.meta.url), evaluatorSha256: hash(readFileSync(fileURLToPath(import.meta.url))),
136
+ tsxSha256: hash(readFileSync(tsx)), vitestSha256: hash(readFileSync(vitest)),
137
+ tsxVersion: JSON.parse(readFileSync(packageRequire.resolve("tsx/package.json"))).version,
138
+ vitestVersion: JSON.parse(readFileSync(packageRequire.resolve("vitest/package.json"))).version,
139
+ commit: execFileSync("git", ["rev-parse", "HEAD"], { cwd: root, env, encoding: "utf8" }).trim(),
140
+ sourceChanges: execFileSync("git", ["status", "--porcelain=v1", "--untracked-files=all", "--", ...SOURCE_PATHS], { cwd: root, env, encoding: "utf8" }).trim() };
141
+ mkdirSync(output, { recursive: true });
142
+ mkdirSync(join(output, "agent-home"));
143
+ const args = [tsx, vitest, "--run", ...RUNTIME_CHECKS.map(proof => proof.file), "--maxWorkers=1", "--no-file-parallelism", "--reporter=json", `--outputFile=${join(output, "vitest.json")}`];
144
+ const command = [process.execPath, ...args];
145
+ Object.assign(env, { DRAHT_OFFLINE: "1", DRAHT_PACKAGE_DIR: packageRoot, DRAHT_CODING_AGENT_DIR: join(output, "agent-home") });
146
+ const startedAt = new Date().toISOString(), started = performance.now();
147
+ const processResult = spawnSync(process.execPath, args, { cwd: packageRoot, env, encoding: "utf8", timeout: timeoutMs, killSignal: "SIGKILL", maxBuffer: 16 * 1024 * 1024 });
148
+ const elapsedMs = Math.round(performance.now() - started);
149
+ const stdout = processResult.stdout ?? "", stderr = processResult.stderr ?? "";
150
+ writeFileSync(join(output, "stdout.txt"), stdout);
151
+ writeFileSync(join(output, "stderr.txt"), stderr);
152
+ let raw = null, reportError = null;
153
+ try { raw = JSON.parse(readFileSync(join(output, "vitest.json"), "utf8")); } catch (error) { reportError = error.message; }
154
+ const assessment = assessRuntimeChecks(raw, packageRoot);
155
+ let sourcesAfter = null;
156
+ try { sourcesAfter = snapshot(root); } catch (error) { assessment.errors.push(`Source snapshot failed: ${error.message}`); }
157
+ const sourcesStable = JSON.stringify(sourcesBefore) === JSON.stringify(sourcesAfter);
158
+ if (!sourcesStable) assessment.errors.push("Runtime source or test files changed during evaluation");
159
+ if (processResult.status !== 0 || processResult.signal || processResult.error) assessment.errors.push("Vitest process did not complete successfully");
160
+ const report = { schemaVersion: 1, lane: "runtime-checks", startedAt, completedAt: new Date().toISOString(),
161
+ complete: assessment.complete && processResult.status !== null && !processResult.signal && !processResult.error,
162
+ passed: assessment.errors.length === 0, modelCalls: 0, root, packageRoot, identity,
163
+ command, environment: { offline: true, packageDirectory: packageRoot, isolatedAgentDirectory: true, inheritedGitOverridesRemoved: true, inheritedNodeOptionsRemoved: true },
164
+ sourcesBefore, sourcesAfter, sourcesStable, process: { exitCode: processResult.status, signal: processResult.signal, error: processResult.error?.message ?? null, elapsedMs },
165
+ stdoutSha256: hash(stdout), stderrSha256: hash(stderr), vitestSha256: existsSync(join(output, "vitest.json")) ? hash(readFileSync(join(output, "vitest.json"))) : null,
166
+ reportError, tests: assessment.tests, results: assessment.results, errors: assessment.errors,
167
+ limits: ["Source-runtime regression evidence, separate from model prompt quality and resource scores.",
168
+ "Native lifecycle tests use the existing AgentSession harness and faux provider with an explicitly registered completion builtin; they do not launch an installed CLI.",
169
+ "Plugin tests exercise both Stop scripts and actual configured checks; the fallback quality gate is stubbed and host hook registration is not exercised.",
170
+ "Selected source and harness hashes identify these proofs; this is not a dependency-closure attestation or a security sandbox."] };
171
+ json(join(output, "report.json"), report);
172
+ return report;
173
+ }
174
+
175
+ if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
176
+ try {
177
+ const [output, ...rest] = process.argv.slice(2);
178
+ if (!output || ["--help", "-h"].includes(output)) {
179
+ console.log("Usage: node runtime-checks.mjs <empty-output-directory> [--repo <path>]");
180
+ } else {
181
+ if (rest.length && (rest.length !== 2 || rest[0] !== "--repo" || !rest[1])) throw new Error("Expected optional --repo <path>");
182
+ const report = runRuntimeChecks(output, { root: rest[1] });
183
+ console.log(JSON.stringify({ lane: report.lane, complete: report.complete, passed: report.passed, tests: report.tests, report: join(resolve(output), "report.json") }));
184
+ process.exitCode = report.passed ? 0 : 1;
185
+ }
186
+ } catch (error) { console.error(`drahtbank runtime-checks: ${error.message}`); process.exitCode = 1; }
187
+ }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://raw.githubusercontent.com/draht-dev/draht/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
2
+ "$schema": "https://raw.githubusercontent.com/draht-dev/draht/main/packages/coding-agent/schemas/theme.schema.json",
3
3
  "name": "dynamic-resources",
4
4
  "vars": {
5
5
  "cyan": "#00d7ff",
@@ -25,6 +25,7 @@ import {
25
25
  createLsToolDefinition,
26
26
  createReadToolDefinition,
27
27
  createWriteToolDefinition,
28
+ formatReadLineRange,
28
29
  } from "@draht/coding-agent";
29
30
  import { Text } from "@draht/tui";
30
31
  import { homedir } from "os";
@@ -65,11 +66,9 @@ export default function (pi: ExtensionAPI) {
65
66
  const path = shortenPath(args.path || "");
66
67
  let pathDisplay = path ? theme.fg("accent", path) : theme.fg("toolOutput", "...");
67
68
 
68
- // Show line range if specified
69
- if (args.offset !== undefined || args.limit !== undefined) {
70
- const startLine = args.offset ?? 1;
71
- const endLine = args.limit !== undefined ? startLine + args.limit - 1 : "";
72
- pathDisplay += theme.fg("warning", `:${startLine}${endLine ? `-${endLine}` : ""}`);
69
+ const lineRange = formatReadLineRange(args.offset, args.limit);
70
+ if (lineRange) {
71
+ pathDisplay += theme.fg("warning", lineRange);
73
72
  }
74
73
 
75
74
  return new Text(`${theme.fg("toolTitle", theme.bold("read"))} ${pathDisplay}`, 0, 0);
@@ -9,7 +9,7 @@
9
9
  */
10
10
 
11
11
  import type { ExtensionAPI, ExtensionCommandContext, Theme } from "@draht/coding-agent";
12
- import { CURSOR_MARKER, type Focusable, matchesKey, visibleWidth } from "@draht/tui";
12
+ import { CURSOR_MARKER, type Focusable, matchesKey, renderFakeCursor, visibleWidth } from "@draht/tui";
13
13
 
14
14
  export default function (pi: ExtensionAPI) {
15
15
  pi.registerCommand("overlay-test", {
@@ -131,7 +131,7 @@ class OverlayTestComponent implements Focusable {
131
131
  const after = inputDisplay.slice(item.cursor + 1);
132
132
  // Emit hardware cursor marker for IME support when focused
133
133
  const marker = this.focused ? CURSOR_MARKER : "";
134
- inputDisplay = `${before}${marker}\x1b[7m${cursorChar}\x1b[27m${after}`;
134
+ inputDisplay = `${before}${marker}${renderFakeCursor(cursorChar)}${after}`;
135
135
  }
136
136
  content = `${prefix + label} ${inputDisplay}`;
137
137
  } else {
@@ -197,8 +197,12 @@ export default function planModeExtension(pi: ExtensionAPI): void {
197
197
  };
198
198
  });
199
199
 
200
- // Inject plan/execution context before agent starts
201
- pi.on("before_agent_start", async () => {
200
+ // Inject plan/execution context before a user prompt. Runs started by custom messages, such as
201
+ // background task notifications, skip it: the context from the last prompt is still in the
202
+ // conversation, and adding it again on every notification would only repeat it.
203
+ pi.on("before_agent_start", async (event) => {
204
+ if (event.messageType !== "user") return;
205
+
202
206
  if (planModeEnabled) {
203
207
  return {
204
208
  message: {
@@ -22,6 +22,7 @@ import { StringEnum } from "@draht/ai";
22
22
  import {
23
23
  CONFIG_DIR_NAME,
24
24
  type ExtensionAPI,
25
+ formatReadLineRange,
25
26
  getAgentDir,
26
27
  getMarkdownTheme,
27
28
  withFileMutationQueue,
@@ -87,13 +88,10 @@ function formatToolCall(
87
88
  case "read": {
88
89
  const rawPath = (args.file_path || args.path || "...") as string;
89
90
  const filePath = shortenPath(rawPath);
90
- const offset = args.offset as number | undefined;
91
- const limit = args.limit as number | undefined;
91
+ const lineRange = formatReadLineRange(args.offset, args.limit);
92
92
  let text = themeFg("accent", filePath);
93
- if (offset !== undefined || limit !== undefined) {
94
- const startLine = offset ?? 1;
95
- const endLine = limit !== undefined ? startLine + limit - 1 : "";
96
- text += themeFg("warning", `:${startLine}${endLine ? `-${endLine}` : ""}`);
93
+ if (lineRange) {
94
+ text += themeFg("warning", lineRange);
97
95
  }
98
96
  return themeFg("muted", "read ") + text;
99
97
  }