@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 @@
1
+ {"version":3,"file":"settings-schema.js","sourceRoot":"","sources":["../../src/core/settings-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAoC,IAAI,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,SAAS,sBAAsB,CAAC,OAAO,GAAyB,EAAE;IACjE,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,gBAAgB,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;AACnF,CAAC;AAED,SAAS,cAAc,CAAC,OAAwB;IAC/C,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,IAA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C,mBAAmB;KAC9C,CAAC,CACF;IACD,sBAAsB,EAAE,IAAI,CAAC,QAAQ,CACpC,IAAI,CAAC,OAAO,CAAC;QACZ,WAAW,EAAE,gCAAgC;QAC7C,OAAO,EAAE,iBAAiB,CAAC,sBAAsB;KACjD,CAAC,CACF;IACD,0BAA0B,EAAE,IAAI,CAAC,QAAQ,CACxC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE;QACjD,WAAW,EAAE,8FAA8F;QAC3G,OAAO,EAAE,iBAAiB,CAAC,0BAA0B;KACrD,CAAC,CACF;IACD,SAAS,EAAE,IAAI,CAAC,QAAQ,CACvB,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,EAAE;QAChE,WAAW,EAAE,0CAA0C;QACvD,UAAU,EAAE,IAAI;KAChB,CAAC,CACF;IACD,UAAU,EAAE,IAAI,CAAC,QAAQ,CACxB,IAAI,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,uCAAuC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CACxF;CACD,EACD,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAC9B,CAAC","sourcesContent":["import { ModelThinkingLevelSchema } from \"@draht/ai/providers/model-schema\";\nimport { type Static, type TSchemaOptions, Type } from \"typebox\";\nimport { SETTINGS_DEFAULTS } from \"./settings-defaults.ts\";\n\nfunction nonNegativeSafeInteger(options: { default?: number } = {}) {\n\treturn Type.Integer({ minimum: 0, maximum: Number.MAX_SAFE_INTEGER, ...options });\n}\n\nfunction timeoutSetting(options?: TSchemaOptions) {\n\treturn Type.Union([Type.Number({ minimum: 0 }), Type.Literal(\"disabled\")], options);\n}\n\nconst CompactionModelOverrideSchema = Type.Object({\n\treserveTokens: Type.Optional(nonNegativeSafeInteger()),\n\tkeepRecentTokens: Type.Optional(nonNegativeSafeInteger()),\n});\n\nconst CompactionSettingsSchema = Type.Object({\n\tenabled: Type.Optional(Type.Boolean({ default: SETTINGS_DEFAULTS.compaction.enabled })),\n\treserveTokens: Type.Optional(nonNegativeSafeInteger({ default: SETTINGS_DEFAULTS.compaction.reserveTokens })),\n\tkeepRecentTokens: Type.Optional(nonNegativeSafeInteger({ default: SETTINGS_DEFAULTS.compaction.keepRecentTokens })),\n\tmodelOverrides: Type.Optional(\n\t\tType.Record(Type.String(), CompactionModelOverrideSchema, {\n\t\t\tdescription: 'Per-model overrides keyed by exact \"provider/modelId\" strings.',\n\t\t}),\n\t),\n});\n\nconst BranchSummarySettingsSchema = Type.Object({\n\treserveTokens: Type.Optional(\n\t\tType.Number({\n\t\t\tdescription: \"Tokens reserved for the prompt and LLM response.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.branchSummary.reserveTokens,\n\t\t}),\n\t),\n\tskipPrompt: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: 'When true, skips the \"Summarize branch?\" prompt and defaults to no summary.',\n\t\t\tdefault: SETTINGS_DEFAULTS.branchSummary.skipPrompt,\n\t\t}),\n\t),\n});\n\nconst CheckpointSettingsSchema = Type.Object({\n\tretentionDays: Type.Optional(\n\t\tType.Number({ default: 30, description: \"Delete checkpoint refs older than this many days.\" }),\n\t),\n\tmaxPerSession: Type.Optional(\n\t\tType.Number({ description: \"Maximum newest checkpoint refs per session; omitted means unlimited.\" }),\n\t),\n});\n\nconst PolyphaseSettingsSchema = Type.Object({\n\tmaxConcurrency: Type.Optional(\n\t\tType.Number({\n\t\t\tdescription: \"Concurrent child agents; clamped to 1-16. Defaults to available CPUs minus two, clamped to 2-8.\",\n\t\t}),\n\t),\n\tmaxAgentsPerRun: Type.Optional(\n\t\tType.Number({ default: 200, description: \"Agent calls per workflow; clamped to 1-1000.\" }),\n\t),\n\tmaxItemsPerCall: Type.Optional(\n\t\tType.Number({ default: 1024, description: \"Items per parallel or pipeline call; clamped to 1-4096.\" }),\n\t),\n\tworkflowTool: Type.Optional(Type.Enum([\"keyword\", \"always\", \"off\"], { default: \"keyword\" })),\n\tkeyword: Type.Optional(\n\t\tType.String({\n\t\t\tdefault: \"polyphase\",\n\t\t\tdescription: \"Workflow activation keyword; invalid keywords fall back to polyphase.\",\n\t\t}),\n\t),\n\tdefaultBudgetTokens: Type.Optional(\n\t\tType.Number({ description: \"Default workflow token budget; minimum 1000. Omitted means unlimited.\" }),\n\t),\n\tresultChars: Type.Optional(\n\t\tType.Number({ default: 64000, description: \"Agent output characters per call; clamped to 8000-400000.\" }),\n\t),\n\tdock: Type.Optional(Type.Boolean({ default: true })),\n\tmaxDepth: Type.Optional(Type.Number({ default: 2, description: \"Delegation depth; clamped to 1-4.\" })),\n\tliveUpdateMs: Type.Optional(\n\t\tType.Number({ default: 250, description: \"Tool row update interval; clamped to 100-2000 milliseconds.\" }),\n\t),\n\tretainRuns: Type.Optional(Type.Number({ default: 20, description: \"Finished runs retained; clamped to 1-100.\" })),\n\tworkflowTimeoutMs: Type.Optional(\n\t\tType.Number({ default: 0, description: \"Workflow deadline in milliseconds; zero disables it.\" }),\n\t),\n});\n\nconst ProviderRetrySettingsSchema = Type.Object({\n\ttimeoutMs: Type.Optional(Type.Number({ description: \"SDK or provider request timeout in milliseconds.\" })),\n\tmaxRetries: Type.Optional(Type.Number({ description: \"SDK or provider retry attempts.\" })),\n\tmaxRetryDelayMs: Type.Optional(\n\t\tType.Number({\n\t\t\tdescription: \"Maximum server-requested delay before failing.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.retry.provider.maxRetryDelayMs,\n\t\t}),\n\t),\n});\n\nconst RetrySettingsSchema = Type.Object({\n\tenabled: Type.Optional(Type.Boolean({ default: SETTINGS_DEFAULTS.retry.enabled })),\n\tmaxRetries: Type.Optional(Type.Number({ default: SETTINGS_DEFAULTS.retry.maxRetries })),\n\tbaseDelayMs: Type.Optional(\n\t\tType.Number({\n\t\t\tdescription: \"Exponential backoff base delay in milliseconds: 2s, 4s, 8s.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.retry.baseDelayMs,\n\t\t}),\n\t),\n\tmaxAgentDelayMs: Type.Optional(Type.Number({ default: SETTINGS_DEFAULTS.retry.maxAgentDelayMs })),\n\tprovider: Type.Optional(ProviderRetrySettingsSchema),\n\tmaxDelayMs: Type.Optional(\n\t\tType.Number({\n\t\t\tdescription: \"Legacy retry delay setting. Use provider.maxRetryDelayMs instead.\",\n\t\t\tdeprecated: true,\n\t\t}),\n\t),\n});\n\nconst TerminalSettingsSchema = Type.Object({\n\tshowImages: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: \"Show images when the terminal supports them.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.terminal.showImages,\n\t\t}),\n\t),\n\timageWidthCells: Type.Optional(\n\t\tType.Number({\n\t\t\tdescription: \"Preferred inline image width in terminal cells.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.terminal.imageWidthCells,\n\t\t}),\n\t),\n\tclearOnShrink: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: \"Clear empty rows when content shrinks.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.terminal.clearOnShrink,\n\t\t}),\n\t),\n\tshowTerminalProgress: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: \"Show OSC 9;4 terminal progress indicators.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.terminal.showTerminalProgress,\n\t\t}),\n\t),\n\thyperlinks: Type.Optional(Type.Union([Type.Boolean(), Type.Literal(\"auto\")])),\n\timages: Type.Optional(\n\t\tType.Union([Type.Literal(\"kitty\"), Type.Literal(\"iterm2\"), Type.Literal(\"auto\"), Type.Literal(false)]),\n\t),\n\ttrueColor: Type.Optional(Type.Union([Type.Boolean(), Type.Literal(\"auto\")])),\n});\n\nconst ImageSettingsSchema = Type.Object({\n\tautoResize: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: \"Resize images to 2000x2000 maximum for better model compatibility.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.images.autoResize,\n\t\t}),\n\t),\n\tblockImages: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: \"When true, prevents all images from being sent to LLM providers.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.images.blockImages,\n\t\t}),\n\t),\n});\n\nfunction thinkingBudgetsSettings(options?: TSchemaOptions) {\n\treturn Type.Object(\n\t\t{\n\t\t\tminimal: Type.Optional(Type.Number()),\n\t\t\tlow: Type.Optional(Type.Number()),\n\t\t\tmedium: Type.Optional(Type.Number()),\n\t\t\thigh: Type.Optional(Type.Number()),\n\t\t},\n\t\toptions,\n\t);\n}\n\nconst ThinkingBudgetsSettingsSchema = thinkingBudgetsSettings();\n\nconst MarkdownSettingsSchema = Type.Object({\n\tcodeBlockIndent: Type.Optional(Type.String({ default: SETTINGS_DEFAULTS.markdown.codeBlockIndent })),\n\tmermaid: Type.Optional(\n\t\tType.Union([Type.Literal(\"off\"), Type.Literal(\"final\"), Type.Literal(\"streaming\")], {\n\t\t\tdefault: SETTINGS_DEFAULTS.markdown.mermaid,\n\t\t}),\n\t),\n});\n\nconst WarningSettingsSchema = Type.Object({\n\tanthropicExtraUsage: Type.Optional(Type.Boolean({ default: SETTINGS_DEFAULTS.warnings.anthropicExtraUsage })),\n});\n\nfunction codemodeMode(options?: TSchemaOptions) {\n\treturn Type.Union([Type.Literal(\"on\"), Type.Literal(\"only\")], options);\n}\n\nconst CodemodeModeSchema = codemodeMode();\n\nconst CodemodeSettingsSchema = Type.Object({\n\tmode: Type.Optional(\n\t\tcodemodeMode({\n\t\t\tdescription:\n\t\t\t\t'How codemode presents tools. \"on\" keeps direct tools declared and annotates tools callable from scripts; codemode lists only tools without direct exposure. \"only\" lists every script-callable tool in codemode and does not declare active direct tools.',\n\t\t\tdefault: SETTINGS_DEFAULTS.codemode.mode,\n\t\t}),\n\t),\n\tinlineBudget: Type.Optional(\n\t\tType.Number({\n\t\t\tminimum: 0,\n\t\t\tdescription: \"Estimated tokens available for inline codemode tool declarations.\",\n\t\t\tdefault: SETTINGS_DEFAULTS.codemode.inlineBudget,\n\t\t}),\n\t),\n});\n\nconst PackageSourceSchema = Type.Union(\n\t[\n\t\tType.String({ description: \"Load all resources from the package.\" }),\n\t\tType.Object({\n\t\t\tsource: Type.String(),\n\t\t\tautoload: Type.Optional(\n\t\t\t\tType.Boolean({ description: \"When false, start empty and only apply explicit resource patterns.\" }),\n\t\t\t),\n\t\t\textensions: Type.Optional(Type.Array(Type.String())),\n\t\t\tskills: Type.Optional(Type.Array(Type.String())),\n\t\t\tprompts: Type.Optional(Type.Array(Type.String())),\n\t\t\tthemes: Type.Optional(Type.Array(Type.String())),\n\t\t}),\n\t],\n\t{\n\t\tdescription:\n\t\t\t\"Package source for npm or git packages. Use the string form to load all resources or the object form to filter resources.\",\n\t},\n);\n\nconst StringArraySchema = Type.Array(Type.String());\nconst SkillsInputSchema = Type.Union(\n\t[\n\t\tStringArraySchema,\n\t\tType.Object(\n\t\t\t{\n\t\t\t\tenableSkillCommands: Type.Optional(Type.Boolean()),\n\t\t\t\tcustomDirectories: Type.Optional(StringArraySchema),\n\t\t\t},\n\t\t\t{ deprecated: true },\n\t\t),\n\t],\n\t{ description: \"Local skill file paths or directories.\" },\n);\n\nexport const SettingsSchema = Type.Object(\n\t{\n\t\t$schema: Type.Optional(Type.String({ description: \"JSON Schema reference.\" })),\n\t\tlastChangelogVersion: Type.Optional(Type.String()),\n\t\tdefaultProvider: Type.Optional(Type.String()),\n\t\tdefaultModel: Type.Optional(Type.String()),\n\t\tdefaultThinkingLevel: Type.Optional(ModelThinkingLevelSchema),\n\t\tmodelThinkingLevels: Type.Optional(\n\t\t\tType.Record(Type.String(), ModelThinkingLevelSchema, {\n\t\t\t\tdescription: 'Per-model default thinking level overrides keyed by \"provider/modelId\".',\n\t\t\t}),\n\t\t),\n\t\ttransport: Type.Optional(\n\t\t\tType.Union(\n\t\t\t\t[Type.Literal(\"auto\"), Type.Literal(\"sse\"), Type.Literal(\"websocket\"), Type.Literal(\"websocket-cached\")],\n\t\t\t\t{ default: SETTINGS_DEFAULTS.transport },\n\t\t\t),\n\t\t),\n\t\tsteeringMode: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"all\"), Type.Literal(\"one-at-a-time\")], {\n\t\t\t\tdefault: SETTINGS_DEFAULTS.steeringMode,\n\t\t\t}),\n\t\t),\n\t\tfollowUpMode: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"all\"), Type.Literal(\"one-at-a-time\")], {\n\t\t\t\tdefault: SETTINGS_DEFAULTS.followUpMode,\n\t\t\t}),\n\t\t),\n\t\ttheme: Type.Optional(Type.String()),\n\t\tcompaction: Type.Optional(CompactionSettingsSchema),\n\t\tbranchSummary: Type.Optional(BranchSummarySettingsSchema),\n\t\tcheckpoints: Type.Optional(CheckpointSettingsSchema),\n\t\tpolyphase: Type.Optional(PolyphaseSettingsSchema),\n\t\tattachableSessions: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdefault: true,\n\t\t\t\tdescription:\n\t\t\t\t\t\"Register interactive sessions on a control socket. Global setting only; project settings cannot override it.\",\n\t\t\t}),\n\t\t),\n\t\tretry: Type.Optional(RetrySettingsSchema),\n\t\thideThinkingBlock: Type.Optional(Type.Boolean({ default: SETTINGS_DEFAULTS.hideThinkingBlock })),\n\t\tshowCacheMissNotices: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Show cache cost and provider recovery notices.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.showCacheMissNotices,\n\t\t\t}),\n\t\t),\n\t\texternalEditor: Type.Optional(\n\t\t\tType.String({ description: \"Command for Ctrl+G external editor; takes precedence over VISUAL and EDITOR.\" }),\n\t\t),\n\t\tshellPath: Type.Optional(\n\t\t\tType.String({\n\t\t\t\tdescription: \"Custom shell path, for example for Cygwin on Windows, with support for leading ~ expansion.\",\n\t\t\t}),\n\t\t),\n\t\tquietStartup: Type.Optional(\n\t\t\tType.Union([Type.Boolean(), Type.Literal(\"header\")], {\n\t\t\t\tdescription: 'When true, hide all startup output. When \"header\", keep only the startup header.',\n\t\t\t\tdefault: SETTINGS_DEFAULTS.quietStartup,\n\t\t\t}),\n\t\t),\n\t\tdefaultProjectTrust: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"ask\"), Type.Literal(\"always\"), Type.Literal(\"never\")], {\n\t\t\t\tdescription: \"Global setting only.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.defaultProjectTrust,\n\t\t\t}),\n\t\t),\n\t\tshellCommandPrefix: Type.Optional(\n\t\t\tType.String({ description: \"Prefix prepended to every bash command, for example to enable shell aliases.\" }),\n\t\t),\n\t\tnpmCommand: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription:\n\t\t\t\t\t'Command used for npm package lookup and installation, in argv form such as [\"mise\", \"exec\", \"node@20\", \"--\", \"npm\"].',\n\t\t\t}),\n\t\t),\n\t\tcollapseChangelog: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Show the condensed changelog after update; use /changelog for the full changelog.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.collapseChangelog,\n\t\t\t}),\n\t\t),\n\t\tenableInstallTelemetry: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Send provider attribution headers to OpenRouter, NVIDIA NIM, and Cloudflare.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.enableInstallTelemetry,\n\t\t\t}),\n\t\t),\n\t\tenableAnalytics: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Opt in to analytics data sharing.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.enableAnalytics,\n\t\t\t}),\n\t\t),\n\t\ttrackingId: Type.Optional(\n\t\t\tType.String({ description: \"Analytics tracking identifier, generated when analytics is enabled.\" }),\n\t\t),\n\t\tpackages: Type.Optional(\n\t\t\tType.Array(PackageSourceSchema, {\n\t\t\t\tdescription: \"npm or git package sources, as strings or objects with resource filtering.\",\n\t\t\t}),\n\t\t),\n\t\textensions: Type.Optional(\n\t\t\tType.Array(Type.String(), { description: \"Local extension file paths or directories.\" }),\n\t\t),\n\t\tdeviceId: Type.Optional(\n\t\t\tType.String({\n\t\t\t\tdescription: \"Stable installation UUID, generated when authentication first needs it. Global only.\",\n\t\t\t}),\n\t\t),\n\t\tskills: Type.Optional(SkillsInputSchema),\n\t\tprompts: Type.Optional(\n\t\t\tType.Array(Type.String(), { description: \"Local prompt template file paths or directories.\" }),\n\t\t),\n\t\tthemes: Type.Optional(Type.Array(Type.String(), { description: \"Local theme file paths or directories.\" })),\n\t\tenableSkillCommands: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Register skills as /skill:name commands.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.enableSkillCommands,\n\t\t\t}),\n\t\t),\n\t\tterminal: Type.Optional(TerminalSettingsSchema),\n\t\timages: Type.Optional(ImageSettingsSchema),\n\t\tenabledModels: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription: \"Model patterns for cycling, in the same format as the --models CLI flag.\",\n\t\t\t}),\n\t\t),\n\t\tdefaultTools: Type.Optional(\n\t\t\tType.Array(Type.String(), {\n\t\t\t\tdescription:\n\t\t\t\t\t\"Initial tool selection. Plain names replace the inherited selection; +name and -name entries add or remove tools.\",\n\t\t\t}),\n\t\t),\n\t\tdoubleEscapeAction: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"fork\"), Type.Literal(\"tree\"), Type.Literal(\"none\")], {\n\t\t\t\tdescription: \"Action for double-escape with an empty editor.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.doubleEscapeAction,\n\t\t\t}),\n\t\t),\n\t\ttreeFilterMode: Type.Optional(\n\t\t\tType.Union(\n\t\t\t\t[\n\t\t\t\t\tType.Literal(\"default\"),\n\t\t\t\t\tType.Literal(\"no-tools\"),\n\t\t\t\t\tType.Literal(\"user-only\"),\n\t\t\t\t\tType.Literal(\"labeled-only\"),\n\t\t\t\t\tType.Literal(\"all\"),\n\t\t\t\t],\n\t\t\t\t{\n\t\t\t\t\tdescription: \"Default filter when opening /tree.\",\n\t\t\t\t\tdefault: SETTINGS_DEFAULTS.treeFilterMode,\n\t\t\t\t},\n\t\t\t),\n\t\t),\n\t\tthinkingBudgets: Type.Optional(\n\t\t\tthinkingBudgetsSettings({\n\t\t\t\tdescription: \"Custom token budgets for thinking levels.\",\n\t\t\t}),\n\t\t),\n\t\teditorPaddingX: Type.Optional(\n\t\t\tType.Number({\n\t\t\t\tdescription: \"Horizontal padding for the input editor.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.editorPaddingX,\n\t\t\t}),\n\t\t),\n\t\toutputPad: Type.Optional(\n\t\t\tType.Union([Type.Literal(0), Type.Literal(1)], {\n\t\t\t\tdescription: \"Horizontal padding for transcript content.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.outputPad,\n\t\t\t}),\n\t\t),\n\t\tautocompleteMaxVisible: Type.Optional(\n\t\t\tType.Number({\n\t\t\t\tdescription: \"Maximum visible items in the autocomplete dropdown.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.autocompleteMaxVisible,\n\t\t\t}),\n\t\t),\n\t\tshowHardwareCursor: Type.Optional(\n\t\t\tType.Boolean({ description: \"Show the terminal cursor while still positioning it for IME.\" }),\n\t\t),\n\t\tmarkdown: Type.Optional(MarkdownSettingsSchema),\n\t\twarnings: Type.Optional(WarningSettingsSchema),\n\t\tcodemode: Type.Optional(CodemodeSettingsSchema),\n\t\tsessionDir: Type.Optional(\n\t\t\tType.String({\n\t\t\t\tdescription: \"Custom session storage directory, in the same format as the --session-dir CLI flag.\",\n\t\t\t}),\n\t\t),\n\t\thttpProxy: Type.Optional(\n\t\t\tType.String({\n\t\t\t\tdescription: \"Proxy URL applied as HTTP_PROXY and HTTPS_PROXY for draht-managed HTTP clients.\",\n\t\t\t}),\n\t\t),\n\t\thttpIdleTimeoutMs: Type.Optional(\n\t\t\ttimeoutSetting({\n\t\t\t\tdescription: 'HTTP header or body idle timeout in milliseconds; 0 or \"disabled\" disables it.',\n\t\t\t}),\n\t\t),\n\t\tcacheWarming: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"off\"), Type.Literal(\"streaming\"), Type.Literal(\"idle\")], {\n\t\t\t\tdescription:\n\t\t\t\t\t'Cache-warming profile. \"idle\" also warms between agent runs. Global only because each refresh costs money.',\n\t\t\t\tdefault: SETTINGS_DEFAULTS.cacheWarming,\n\t\t\t}),\n\t\t),\n\t\twebsocketConnectTimeoutMs: Type.Optional(\n\t\t\ttimeoutSetting({\n\t\t\t\tdescription: 'WebSocket connect or open handshake timeout in milliseconds; 0 or \"disabled\" disables it.',\n\t\t\t}),\n\t\t),\n\t\ttuiMode: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"regular\"), Type.Literal(\"fullscreen\")], {\n\t\t\t\tdefault: SETTINGS_DEFAULTS.tuiMode,\n\t\t\t}),\n\t\t),\n\t\tfullscreenExitOutput: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"transcript\"), Type.Literal(\"resume-hint\")], {\n\t\t\t\tdescription: \"No effect in regular TUI mode.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.fullscreenExitOutput,\n\t\t\t}),\n\t\t),\n\t\tfullscreenScrollbar: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"auto\"), Type.Literal(\"always\"), Type.Literal(\"hidden\")], {\n\t\t\t\tdescription: \"No effect in regular TUI mode.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.fullscreenScrollbar,\n\t\t\t}),\n\t\t),\n\t\tfullscreenCopyOnSelect: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"No effect in regular TUI mode.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.fullscreenCopyOnSelect,\n\t\t\t}),\n\t\t),\n\t\tfullscreenWheelScrollLines: Type.Optional(\n\t\t\tType.Union([Type.Number(), Type.Literal(\"auto\")], {\n\t\t\t\tdescription: \"Lines scrolled per wheel event in fullscreen mode; numeric values are clamped from 1 to 100.\",\n\t\t\t\tdefault: SETTINGS_DEFAULTS.fullscreenWheelScrollLines,\n\t\t\t}),\n\t\t),\n\t\tqueueMode: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"all\"), Type.Literal(\"one-at-a-time\")], {\n\t\t\t\tdescription: \"Legacy setting migrated to steeringMode.\",\n\t\t\t\tdeprecated: true,\n\t\t\t}),\n\t\t),\n\t\twebsockets: Type.Optional(\n\t\t\tType.Boolean({ description: \"Legacy setting migrated to transport.\", deprecated: true }),\n\t\t),\n\t},\n\t{ additionalProperties: true },\n);\n\ntype SettingsInput = Static<typeof SettingsSchema>;\n\nexport interface CheckpointSettings extends Static<typeof CheckpointSettingsSchema> {}\nexport interface PolyphaseSettings extends Static<typeof PolyphaseSettingsSchema> {}\nexport interface CompactionModelOverride extends Static<typeof CompactionModelOverrideSchema> {}\nexport interface CompactionSettings extends Static<typeof CompactionSettingsSchema> {}\nexport interface BranchSummarySettings extends Static<typeof BranchSummarySettingsSchema> {}\nexport interface ProviderRetrySettings extends Static<typeof ProviderRetrySettingsSchema> {}\nexport interface RetrySettings extends Omit<Static<typeof RetrySettingsSchema>, \"maxDelayMs\"> {}\nexport interface TerminalSettings extends Static<typeof TerminalSettingsSchema> {}\nexport interface ImageSettings extends Static<typeof ImageSettingsSchema> {}\nexport interface ThinkingBudgetsSettings extends Static<typeof ThinkingBudgetsSettingsSchema> {}\nexport type MermaidRenderingMode = NonNullable<Static<typeof MarkdownSettingsSchema>[\"mermaid\"]>;\nexport interface MarkdownSettings extends Static<typeof MarkdownSettingsSchema> {}\nexport interface WarningSettings extends Static<typeof WarningSettingsSchema> {}\nexport type CodemodeMode = Static<typeof CodemodeModeSchema>;\nexport interface CodemodeSettings extends Static<typeof CodemodeSettingsSchema> {}\nexport type DefaultProjectTrust = NonNullable<SettingsInput[\"defaultProjectTrust\"]>;\nexport type QuietStartup = NonNullable<SettingsInput[\"quietStartup\"]>;\nexport type TransportSetting = NonNullable<SettingsInput[\"transport\"]>;\nexport type PackageSource = Static<typeof PackageSourceSchema>;\nexport type FullscreenExitOutput = NonNullable<SettingsInput[\"fullscreenExitOutput\"]>;\nexport type TuiMode = NonNullable<SettingsInput[\"tuiMode\"]>;\nexport type CacheWarmingMode = NonNullable<SettingsInput[\"cacheWarming\"]>;\nexport interface Settings extends Omit<SettingsInput, \"queueMode\" | \"retry\" | \"skills\" | \"websockets\"> {\n\tretry?: RetrySettings;\n\tskills?: string[];\n}\n"]}
@@ -40,8 +40,11 @@ export declare function loadSkillsFromDir(options: LoadSkillsFromDirOptions): Lo
40
40
  *
41
41
  * Skills with disableModelInvocation=true are excluded from the prompt
42
42
  * (they can only be invoked explicitly via /skill:name commands).
43
+ *
44
+ * `fileReadTool` names the tool that loads skill files; `indirect` names none, for a reader that
45
+ * is reachable only through another tool.
43
46
  */
44
- export declare function formatSkillsForPrompt(skills: Skill[], fileReadTool?: "read" | "bash"): string;
47
+ export declare function formatSkillsForPrompt(skills: Skill[], fileReadTool?: "read" | "bash" | "indirect"): string;
45
48
  export interface LoadSkillsOptions {
46
49
  /** Working directory for project-local skills. */
47
50
  cwd: string;
@@ -1 +1 @@
1
- {"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/core/skills.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAA6B,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AA2D9E,MAAM,WAAW,gBAAgB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,KAAK;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE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IACrB,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,KAAK;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,UAAU,CAAC;IACvB,sBAAsB,EAAE,OAAO,CAAC;CAChC;AAED,MAAM,WAAW,gBAAgB;IAChC,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,WAAW,EAAE,kBAAkB,EAAE,CAAC;CAClC;AA2CD,MAAM,WAAW,wBAAwB;IACxC,mCAAmC;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;CACf;AAgCD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,gBAAgB,CAGrF;AAgLD;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,YAAY,GAAE,MAAM,GAAG,MAAM,GAAG,UAAmB,GAAG,MAAM,CA8BlH;AAWD,MAAM,WAAW,iBAAiB;IACjC,kDAAkD;IAClD,GAAG,EAAE,MAAM,CAAC;IACZ,gDAAgD;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,kDAAkD;IAClD,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,0CAA0C;IAC1C,eAAe,EAAE,OAAO,CAAC;IACzB,gEAAgE;IAChE,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,CAyGvE"}
@@ -278,6 +278,9 @@ function loadSkillFromFile(filePath, source) {
278
278
  *
279
279
  * Skills with disableModelInvocation=true are excluded from the prompt
280
280
  * (they can only be invoked explicitly via /skill:name commands).
281
+ *
282
+ * `fileReadTool` names the tool that loads skill files; `indirect` names none, for a reader that
283
+ * is reachable only through another tool.
281
284
  */
282
285
  export function formatSkillsForPrompt(skills, fileReadTool = "read") {
283
286
  const visibleSkills = skills.filter((s) => !s.disableModelInvocation);
@@ -288,7 +291,9 @@ export function formatSkillsForPrompt(skills, fileReadTool = "read") {
288
291
  "\n\nThe following skills provide specialized instructions for specific tasks.",
289
292
  fileReadTool === "read"
290
293
  ? "Use the read tool to load a skill's file when the task matches its description."
291
- : "Use bash to load a skill's file when the task matches its description.",
294
+ : fileReadTool === "bash"
295
+ ? "Use bash to load a skill's file when the task matches its description."
296
+ : "Load a skill's file when the task matches its description.",
292
297
  "When a skill file references a relative path, resolve it against the skill directory (parent of SKILL.md / dirname of the path) and use that absolute path in tool commands.",
293
298
  "",
294
299
  "<available_skills>",
@@ -1 +1 @@
1
- {"version":3,"file":"skills.js","sourceRoot":"","sources":["../../src/core/skills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AACrE,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,yBAAyB,EAAmB,MAAM,kBAAkB,CAAC;AAE9E,+BAA+B;AAC/B,MAAM,eAAe,GAAG,EAAE,CAAC;AAE3B,sCAAsC;AACtC,MAAM,sBAAsB,GAAG,IAA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,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;gBACxE,CAAC;qBAAM,CAAC;oBACP,cAAc,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;gBAC5C,CAAC;YACF,CAAC;iBAAM,CAAC;gBACP,cAAc,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,mCAAmC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;YAC5G,CAAC;QACF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,2BAA2B,CAAC;YACrF,cAAc,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;QACvE,CAAC;IACF,CAAC;IAED,qFAAqF;IACrF,IAAI,cAAc,EAAE,CAAC;QACpB,SAAS,CAAC,yBAAyB,CAAC,mBAAmB,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;IAC/E,CAAC;IAED,OAAO;QACN,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;QACrC,WAAW,EAAE,CAAC,GAAG,cAAc,EAAE,GAAG,oBAAoB,CAAC;KACzD,CAAC;AACH,CAAC","sourcesContent":["import { existsSync, readdirSync, readFileSync, statSync } from \"fs\";\nimport ignore from \"ignore\";\nimport { basename, dirname, join, relative, resolve, sep } from \"path\";\nimport { CONFIG_DIR_NAME, getAgentDir, getShippedSkillsDir } from \"../config.ts\";\nimport { comparablePath } from \"../utils/canonical-path.ts\";\nimport { parseFrontmatter } from \"../utils/frontmatter.ts\";\nimport { resolvePath } from \"../utils/paths.ts\";\nimport type { ResourceDiagnostic } from \"./diagnostics.ts\";\nimport { createSyntheticSourceInfo, type SourceInfo } from \"./source-info.ts\";\n\n/** Max name length per spec */\nconst MAX_NAME_LENGTH = 64;\n\n/** Max description length per spec */\nconst MAX_DESCRIPTION_LENGTH = 1024;\n\nconst IGNORE_FILE_NAMES = [\".gitignore\", \".ignore\", \".fdignore\"];\n\ntype IgnoreMatcher = ReturnType<typeof ignore>;\n\nfunction toPosixPath(p: string): string {\n\treturn p.split(sep).join(\"/\");\n}\n\nfunction prefixIgnorePattern(line: string, prefix: string): string | null {\n\tconst trimmed = line.trim();\n\tif (!trimmed) return null;\n\tif (trimmed.startsWith(\"#\") && !trimmed.startsWith(\"\\\\#\")) return null;\n\n\tlet pattern = line;\n\tlet negated = false;\n\n\tif (pattern.startsWith(\"!\")) {\n\t\tnegated = true;\n\t\tpattern = pattern.slice(1);\n\t} else if (pattern.startsWith(\"\\\\!\")) {\n\t\tpattern = pattern.slice(1);\n\t}\n\n\tif (pattern.startsWith(\"/\")) {\n\t\tpattern = pattern.slice(1);\n\t}\n\n\tconst prefixed = prefix ? `${prefix}${pattern}` : pattern;\n\treturn negated ? `!${prefixed}` : prefixed;\n}\n\nfunction addIgnoreRules(ig: IgnoreMatcher, dir: string, rootDir: string): void {\n\tconst relativeDir = relative(rootDir, dir);\n\tconst prefix = relativeDir ? `${toPosixPath(relativeDir)}/` : \"\";\n\n\tfor (const filename of IGNORE_FILE_NAMES) {\n\t\tconst ignorePath = join(dir, filename);\n\t\tif (!existsSync(ignorePath)) continue;\n\t\ttry {\n\t\t\tconst content = readFileSync(ignorePath, \"utf-8\");\n\t\t\tconst patterns = content\n\t\t\t\t.split(/\\r?\\n/)\n\t\t\t\t.map((line) => prefixIgnorePattern(line, prefix))\n\t\t\t\t.filter((line): line is string => Boolean(line));\n\t\t\tif (patterns.length > 0) {\n\t\t\t\tig.add(patterns);\n\t\t\t}\n\t\t} catch {}\n\t}\n}\n\nexport interface SkillFrontmatter {\n\tname?: string;\n\tdescription?: string;\n\t\"disable-model-invocation\"?: boolean;\n\t[key: string]: unknown;\n}\n\nexport interface Skill {\n\tname: string;\n\tdescription: string;\n\tfilePath: string;\n\tbaseDir: string;\n\tsourceInfo: SourceInfo;\n\tdisableModelInvocation: boolean;\n}\n\nexport interface LoadSkillsResult {\n\tskills: Skill[];\n\tdiagnostics: ResourceDiagnostic[];\n}\n\n/**\n * Validate skill name per Agent Skills spec.\n * Returns array of validation error messages (empty if valid).\n */\nfunction validateName(name: string): string[] {\n\tconst errors: string[] = [];\n\n\tif (name.length > MAX_NAME_LENGTH) {\n\t\terrors.push(`name exceeds ${MAX_NAME_LENGTH} characters (${name.length})`);\n\t}\n\n\tif (!/^[a-z0-9-]+$/.test(name)) {\n\t\terrors.push(`name contains invalid characters (must be lowercase a-z, 0-9, hyphens only)`);\n\t}\n\n\tif (name.startsWith(\"-\") || name.endsWith(\"-\")) {\n\t\terrors.push(`name must not start or end with a hyphen`);\n\t}\n\n\tif (name.includes(\"--\")) {\n\t\terrors.push(`name must not contain consecutive hyphens`);\n\t}\n\n\treturn errors;\n}\n\n/**\n * Validate description per Agent Skills spec.\n */\nfunction validateDescription(description: unknown): string[] {\n\tconst errors: string[] = [];\n\n\tif (typeof description !== \"string\" || description.trim() === \"\") {\n\t\terrors.push(\"description is required\");\n\t} else if (description.length > MAX_DESCRIPTION_LENGTH) {\n\t\terrors.push(`description exceeds ${MAX_DESCRIPTION_LENGTH} characters (${description.length})`);\n\t}\n\n\treturn errors;\n}\n\nexport interface LoadSkillsFromDirOptions {\n\t/** Directory to scan for skills */\n\tdir: string;\n\t/** Source identifier for these skills */\n\tsource: string;\n}\n\nfunction createSkillSourceInfo(filePath: string, baseDir: string, source: string): SourceInfo {\n\tswitch (source) {\n\t\tcase \"builtin\":\n\t\t\treturn createSyntheticSourceInfo(filePath, {\n\t\t\t\tsource: \"builtin\",\n\t\t\t\tscope: \"user\",\n\t\t\t\tbaseDir,\n\t\t\t});\n\t\tcase \"user\":\n\t\t\treturn createSyntheticSourceInfo(filePath, {\n\t\t\t\tsource: \"local\",\n\t\t\t\tscope: \"user\",\n\t\t\t\tbaseDir,\n\t\t\t});\n\t\tcase \"project\":\n\t\t\treturn createSyntheticSourceInfo(filePath, {\n\t\t\t\tsource: \"local\",\n\t\t\t\tscope: \"project\",\n\t\t\t\tbaseDir,\n\t\t\t});\n\t\tcase \"path\":\n\t\t\treturn createSyntheticSourceInfo(filePath, {\n\t\t\t\tsource: \"local\",\n\t\t\t\tbaseDir,\n\t\t\t});\n\t\tdefault:\n\t\t\treturn createSyntheticSourceInfo(filePath, { source, baseDir });\n\t}\n}\n\n/**\n * Load skills from a directory.\n *\n * Discovery rules:\n * - if a directory contains SKILL.md, treat it as a skill root and do not recurse further\n * - otherwise, load direct .md children in the root\n * - recurse into subdirectories to find SKILL.md\n */\nexport function loadSkillsFromDir(options: LoadSkillsFromDirOptions): LoadSkillsResult {\n\tconst { dir, source } = options;\n\treturn loadSkillsFromDirInternal(dir, source, true);\n}\n\nfunction loadSkillsFromDirInternal(\n\tdir: string,\n\tsource: string,\n\tincludeRootFiles: boolean,\n\tignoreMatcher?: IgnoreMatcher,\n\trootDir?: string,\n): LoadSkillsResult {\n\tconst skills: Skill[] = [];\n\tconst diagnostics: ResourceDiagnostic[] = [];\n\n\tif (!existsSync(dir)) {\n\t\treturn { skills, diagnostics };\n\t}\n\n\tconst root = rootDir ?? dir;\n\tconst ig = ignoreMatcher ?? ignore();\n\taddIgnoreRules(ig, dir, root);\n\n\ttry {\n\t\tconst entries = readdirSync(dir, { withFileTypes: true });\n\n\t\tfor (const entry of entries) {\n\t\t\tif (entry.name !== \"SKILL.md\") {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst fullPath = join(dir, entry.name);\n\n\t\t\tlet isFile = entry.isFile();\n\t\t\tif (entry.isSymbolicLink()) {\n\t\t\t\ttry {\n\t\t\t\t\tisFile = statSync(fullPath).isFile();\n\t\t\t\t} catch {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst relPath = toPosixPath(relative(root, fullPath));\n\t\t\tif (!isFile || ig.ignores(relPath)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst result = loadSkillFromFile(fullPath, source);\n\t\t\tif (result.skill) {\n\t\t\t\tskills.push(result.skill);\n\t\t\t}\n\t\t\tdiagnostics.push(...result.diagnostics);\n\t\t\treturn { skills, diagnostics };\n\t\t}\n\n\t\tfor (const entry of entries) {\n\t\t\tif (entry.name.startsWith(\".\")) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Skip node_modules to avoid scanning dependencies\n\t\t\tif (entry.name === \"node_modules\") {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst fullPath = join(dir, entry.name);\n\n\t\t\t// For symlinks, check if they point to a directory and follow them\n\t\t\tlet isDirectory = entry.isDirectory();\n\t\t\tlet isFile = entry.isFile();\n\t\t\tif (entry.isSymbolicLink()) {\n\t\t\t\ttry {\n\t\t\t\t\tconst stats = statSync(fullPath);\n\t\t\t\t\tisDirectory = stats.isDirectory();\n\t\t\t\t\tisFile = stats.isFile();\n\t\t\t\t} catch {\n\t\t\t\t\t// Broken symlink, skip it\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst relPath = toPosixPath(relative(root, fullPath));\n\t\t\tconst ignorePath = isDirectory ? `${relPath}/` : relPath;\n\t\t\tif (ig.ignores(ignorePath)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (isDirectory) {\n\t\t\t\tconst subResult = loadSkillsFromDirInternal(fullPath, source, false, ig, root);\n\t\t\t\tskills.push(...subResult.skills);\n\t\t\t\tdiagnostics.push(...subResult.diagnostics);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (!isFile || !includeRootFiles || !entry.name.endsWith(\".md\")) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst result = loadSkillFromFile(fullPath, source);\n\t\t\tif (result.skill) {\n\t\t\t\tskills.push(result.skill);\n\t\t\t}\n\t\t\tdiagnostics.push(...result.diagnostics);\n\t\t}\n\t} catch {}\n\n\treturn { skills, diagnostics };\n}\n\nfunction loadSkillFromFile(\n\tfilePath: string,\n\tsource: string,\n): { skill: Skill | null; diagnostics: ResourceDiagnostic[] } {\n\tconst diagnostics: ResourceDiagnostic[] = [];\n\tconst isDeclaredSkill = basename(filePath) === \"SKILL.md\";\n\n\tlet rawContent: string;\n\ttry {\n\t\trawContent = readFileSync(filePath, \"utf-8\");\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : \"failed to read skill file\";\n\t\tdiagnostics.push({ type: \"warning\", message, path: filePath });\n\t\treturn { skill: null, diagnostics };\n\t}\n\n\tlet frontmatter: SkillFrontmatter;\n\ttry {\n\t\t({ frontmatter } = parseFrontmatter<SkillFrontmatter>(rawContent));\n\t} catch (error) {\n\t\tif (isDeclaredSkill) {\n\t\t\tconst message = error instanceof Error ? error.message : \"failed to parse skill file\";\n\t\t\tdiagnostics.push({ type: \"warning\", message, path: filePath });\n\t\t}\n\t\treturn { skill: null, diagnostics };\n\t}\n\n\tconst description = frontmatter.description;\n\tconst hasDescription = typeof description === \"string\" && description.trim() !== \"\";\n\tif (!isDeclaredSkill && !hasDescription) {\n\t\treturn { skill: null, diagnostics };\n\t}\n\n\tconst skillDir = dirname(filePath);\n\tconst parentDirName = basename(skillDir);\n\n\t// Validate description\n\tconst descErrors = validateDescription(description);\n\tfor (const error of descErrors) {\n\t\tdiagnostics.push({ type: \"warning\", message: error, path: filePath });\n\t}\n\n\t// Use name from frontmatter, or fall back to parent directory name\n\tconst frontmatterName = typeof frontmatter.name === \"string\" ? frontmatter.name : undefined;\n\tconst name = frontmatterName || parentDirName;\n\n\t// Validate name\n\tconst nameErrors = validateName(name);\n\tfor (const error of nameErrors) {\n\t\tdiagnostics.push({ type: \"warning\", message: error, path: filePath });\n\t}\n\n\t// Still load the skill even with warnings, unless description is missing or empty.\n\tif (!hasDescription) {\n\t\treturn { skill: null, diagnostics };\n\t}\n\n\treturn {\n\t\tskill: {\n\t\t\tname,\n\t\t\tdescription,\n\t\t\tfilePath,\n\t\t\tbaseDir: skillDir,\n\t\t\tsourceInfo: createSkillSourceInfo(filePath, skillDir, source),\n\t\t\tdisableModelInvocation: frontmatter[\"disable-model-invocation\"] === true,\n\t\t},\n\t\tdiagnostics,\n\t};\n}\n\n/**\n * Format skills for inclusion in a system prompt.\n * Uses XML format per Agent Skills standard.\n * See: https://agentskills.io/integrate-skills\n *\n * Skills with disableModelInvocation=true are excluded from the prompt\n * (they can only be invoked explicitly via /skill:name commands).\n */\nexport function formatSkillsForPrompt(skills: Skill[], fileReadTool: \"read\" | \"bash\" = \"read\"): string {\n\tconst visibleSkills = skills.filter((s) => !s.disableModelInvocation);\n\n\tif (visibleSkills.length === 0) {\n\t\treturn \"\";\n\t}\n\n\tconst lines = [\n\t\t\"\\n\\nThe following skills provide specialized instructions for specific tasks.\",\n\t\tfileReadTool === \"read\"\n\t\t\t? \"Use the read tool to load a skill's file when the task matches its description.\"\n\t\t\t: \"Use bash to load a skill's file when the task matches its description.\",\n\t\t\"When a skill file references a relative path, resolve it against the skill directory (parent of SKILL.md / dirname of the path) and use that absolute path in tool commands.\",\n\t\t\"\",\n\t\t\"<available_skills>\",\n\t];\n\n\tfor (const skill of visibleSkills) {\n\t\tlines.push(\" <skill>\");\n\t\tlines.push(` <name>${escapeXml(skill.name)}</name>`);\n\t\tlines.push(` <description>${escapeXml(skill.description)}</description>`);\n\t\tlines.push(` <location>${escapeXml(skill.filePath)}</location>`);\n\t\tlines.push(\" </skill>\");\n\t}\n\n\tlines.push(\"</available_skills>\");\n\n\treturn lines.join(\"\\n\");\n}\n\nfunction escapeXml(str: string): string {\n\treturn str\n\t\t.replace(/&/g, \"&amp;\")\n\t\t.replace(/</g, \"&lt;\")\n\t\t.replace(/>/g, \"&gt;\")\n\t\t.replace(/\"/g, \"&quot;\")\n\t\t.replace(/'/g, \"&apos;\");\n}\n\nexport interface LoadSkillsOptions {\n\t/** Working directory for project-local skills. */\n\tcwd: string;\n\t/** Agent config directory for global skills. */\n\tagentDir: string;\n\t/** Explicit skill paths (files or directories) */\n\tskillPaths: string[];\n\t/** Include default skills directories. */\n\tincludeDefaults: boolean;\n\t/** Include skills shipped with the package (builtin skills). */\n\tincludeShipped?: boolean;\n}\n\n/**\n * Load skills from all configured locations.\n * Returns skills and any validation diagnostics.\n */\nexport function loadSkills(options: LoadSkillsOptions): LoadSkillsResult {\n\tconst { agentDir, skillPaths, includeDefaults, includeShipped } = options;\n\n\t// Resolve agentDir - if not provided, use default from config\n\tconst resolvedCwd = resolvePath(options.cwd);\n\tconst resolvedAgentDir = resolvePath(agentDir ?? getAgentDir());\n\n\tconst skillMap = new Map<string, Skill>();\n\tconst realPathSet = new Set<string>();\n\tconst allDiagnostics: ResourceDiagnostic[] = [];\n\tconst collisionDiagnostics: ResourceDiagnostic[] = [];\n\n\tfunction addSkills(result: LoadSkillsResult) {\n\t\tallDiagnostics.push(...result.diagnostics);\n\t\tfor (const skill of result.skills) {\n\t\t\t// Resolve symlinks to detect duplicate files\n\t\t\tconst realPath = comparablePath(skill.filePath);\n\n\t\t\t// Skip silently if we've already loaded this exact file (via symlink)\n\t\t\tif (realPathSet.has(realPath)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst existing = skillMap.get(skill.name);\n\t\t\tif (existing) {\n\t\t\t\tcollisionDiagnostics.push({\n\t\t\t\t\ttype: \"collision\",\n\t\t\t\t\tmessage: `name \"${skill.name}\" collision`,\n\t\t\t\t\tpath: skill.filePath,\n\t\t\t\t\tcollision: {\n\t\t\t\t\t\tresourceType: \"skill\",\n\t\t\t\t\t\tname: skill.name,\n\t\t\t\t\t\twinnerPath: existing.filePath,\n\t\t\t\t\t\tloserPath: skill.filePath,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tskillMap.set(skill.name, skill);\n\t\t\t\trealPathSet.add(realPath);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (includeDefaults) {\n\t\taddSkills(loadSkillsFromDirInternal(join(resolvedAgentDir, \"skills\"), \"user\", true));\n\t\taddSkills(loadSkillsFromDirInternal(resolve(resolvedCwd, CONFIG_DIR_NAME, \"skills\"), \"project\", true));\n\t}\n\n\tconst userSkillsDir = join(resolvedAgentDir, \"skills\");\n\tconst projectSkillsDir = resolve(resolvedCwd, CONFIG_DIR_NAME, \"skills\");\n\n\tconst isUnderPath = (target: string, root: string): boolean => {\n\t\tconst normalizedRoot = resolve(root);\n\t\tif (target === normalizedRoot) {\n\t\t\treturn true;\n\t\t}\n\t\tconst prefix = normalizedRoot.endsWith(sep) ? normalizedRoot : `${normalizedRoot}${sep}`;\n\t\treturn target.startsWith(prefix);\n\t};\n\n\tconst getSource = (resolvedPath: string): \"user\" | \"project\" | \"path\" => {\n\t\tif (!includeDefaults) {\n\t\t\tif (isUnderPath(resolvedPath, userSkillsDir)) return \"user\";\n\t\t\tif (isUnderPath(resolvedPath, projectSkillsDir)) return \"project\";\n\t\t}\n\t\treturn \"path\";\n\t};\n\n\tfor (const rawPath of skillPaths) {\n\t\tconst resolvedPath = resolvePath(rawPath, resolvedCwd, { trim: true });\n\t\tif (!existsSync(resolvedPath)) {\n\t\t\tallDiagnostics.push({ type: \"warning\", message: \"skill path does not exist\", path: resolvedPath });\n\t\t\tcontinue;\n\t\t}\n\n\t\ttry {\n\t\t\tconst stats = statSync(resolvedPath);\n\t\t\tconst source = getSource(resolvedPath);\n\t\t\tif (stats.isDirectory()) {\n\t\t\t\taddSkills(loadSkillsFromDirInternal(resolvedPath, source, true));\n\t\t\t} else if (stats.isFile() && resolvedPath.endsWith(\".md\")) {\n\t\t\t\tconst result = loadSkillFromFile(resolvedPath, source);\n\t\t\t\tif (result.skill) {\n\t\t\t\t\taddSkills({ skills: [result.skill], diagnostics: result.diagnostics });\n\t\t\t\t} else {\n\t\t\t\t\tallDiagnostics.push(...result.diagnostics);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tallDiagnostics.push({ type: \"warning\", message: \"skill path is not a markdown file\", path: resolvedPath });\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : \"failed to read skill path\";\n\t\t\tallDiagnostics.push({ type: \"warning\", message, path: resolvedPath });\n\t\t}\n\t}\n\n\t// Shipped (builtin) skills load last so user/project/CLI skills win name collisions.\n\tif (includeShipped) {\n\t\taddSkills(loadSkillsFromDirInternal(getShippedSkillsDir(), \"builtin\", false));\n\t}\n\n\treturn {\n\t\tskills: Array.from(skillMap.values()),\n\t\tdiagnostics: [...allDiagnostics, ...collisionDiagnostics],\n\t};\n}\n"]}
1
+ {"version":3,"file":"skills.js","sourceRoot":"","sources":["../../src/core/skills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AACrE,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,yBAAyB,EAAmB,MAAM,kBAAkB,CAAC;AAE9E,+BAA+B;AAC/B,MAAM,eAAe,GAAG,EAAE,CAAC;AAE3B,sCAAsC;AACtC,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAEpC,MAAM,iBAAiB,GAAG,CAAC,YAAY,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;AAIjE,SAAS,WAAW,CAAC,CAAS;IAC7B,OAAO,CAAC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C;qBAAM,CAAC;oBACP,cAAc,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;gBAC5C,CAAC;YACF,CAAC;iBAAM,CAAC;gBACP,cAAc,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,mCAAmC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;YAC5G,CAAC;QACF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,2BAA2B,CAAC;YACrF,cAAc,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;QACvE,CAAC;IACF,CAAC;IAED,qFAAqF;IACrF,IAAI,cAAc,EAAE,CAAC;QACpB,SAAS,CAAC,yBAAyB,CAAC,mBAAmB,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;IAC/E,CAAC;IAED,OAAO;QACN,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;QACrC,WAAW,EAAE,CAAC,GAAG,cAAc,EAAE,GAAG,oBAAoB,CAAC;KACzD,CAAC;AACH,CAAC","sourcesContent":["import { existsSync, readdirSync, readFileSync, statSync } from \"fs\";\nimport ignore from \"ignore\";\nimport { basename, dirname, join, relative, resolve, sep } from \"path\";\nimport { CONFIG_DIR_NAME, getAgentDir, getShippedSkillsDir } from \"../config.ts\";\nimport { comparablePath } from \"../utils/canonical-path.ts\";\nimport { parseFrontmatter } from \"../utils/frontmatter.ts\";\nimport { resolvePath } from \"../utils/paths.ts\";\nimport type { ResourceDiagnostic } from \"./diagnostics.ts\";\nimport { createSyntheticSourceInfo, type SourceInfo } from \"./source-info.ts\";\n\n/** Max name length per spec */\nconst MAX_NAME_LENGTH = 64;\n\n/** Max description length per spec */\nconst MAX_DESCRIPTION_LENGTH = 1024;\n\nconst IGNORE_FILE_NAMES = [\".gitignore\", \".ignore\", \".fdignore\"];\n\ntype IgnoreMatcher = ReturnType<typeof ignore>;\n\nfunction toPosixPath(p: string): string {\n\treturn p.split(sep).join(\"/\");\n}\n\nfunction prefixIgnorePattern(line: string, prefix: string): string | null {\n\tconst trimmed = line.trim();\n\tif (!trimmed) return null;\n\tif (trimmed.startsWith(\"#\") && !trimmed.startsWith(\"\\\\#\")) return null;\n\n\tlet pattern = line;\n\tlet negated = false;\n\n\tif (pattern.startsWith(\"!\")) {\n\t\tnegated = true;\n\t\tpattern = pattern.slice(1);\n\t} else if (pattern.startsWith(\"\\\\!\")) {\n\t\tpattern = pattern.slice(1);\n\t}\n\n\tif (pattern.startsWith(\"/\")) {\n\t\tpattern = pattern.slice(1);\n\t}\n\n\tconst prefixed = prefix ? `${prefix}${pattern}` : pattern;\n\treturn negated ? `!${prefixed}` : prefixed;\n}\n\nfunction addIgnoreRules(ig: IgnoreMatcher, dir: string, rootDir: string): void {\n\tconst relativeDir = relative(rootDir, dir);\n\tconst prefix = relativeDir ? `${toPosixPath(relativeDir)}/` : \"\";\n\n\tfor (const filename of IGNORE_FILE_NAMES) {\n\t\tconst ignorePath = join(dir, filename);\n\t\tif (!existsSync(ignorePath)) continue;\n\t\ttry {\n\t\t\tconst content = readFileSync(ignorePath, \"utf-8\");\n\t\t\tconst patterns = content\n\t\t\t\t.split(/\\r?\\n/)\n\t\t\t\t.map((line) => prefixIgnorePattern(line, prefix))\n\t\t\t\t.filter((line): line is string => Boolean(line));\n\t\t\tif (patterns.length > 0) {\n\t\t\t\tig.add(patterns);\n\t\t\t}\n\t\t} catch {}\n\t}\n}\n\nexport interface SkillFrontmatter {\n\tname?: string;\n\tdescription?: string;\n\t\"disable-model-invocation\"?: boolean;\n\t[key: string]: unknown;\n}\n\nexport interface Skill {\n\tname: string;\n\tdescription: string;\n\tfilePath: string;\n\tbaseDir: string;\n\tsourceInfo: SourceInfo;\n\tdisableModelInvocation: boolean;\n}\n\nexport interface LoadSkillsResult {\n\tskills: Skill[];\n\tdiagnostics: ResourceDiagnostic[];\n}\n\n/**\n * Validate skill name per Agent Skills spec.\n * Returns array of validation error messages (empty if valid).\n */\nfunction validateName(name: string): string[] {\n\tconst errors: string[] = [];\n\n\tif (name.length > MAX_NAME_LENGTH) {\n\t\terrors.push(`name exceeds ${MAX_NAME_LENGTH} characters (${name.length})`);\n\t}\n\n\tif (!/^[a-z0-9-]+$/.test(name)) {\n\t\terrors.push(`name contains invalid characters (must be lowercase a-z, 0-9, hyphens only)`);\n\t}\n\n\tif (name.startsWith(\"-\") || name.endsWith(\"-\")) {\n\t\terrors.push(`name must not start or end with a hyphen`);\n\t}\n\n\tif (name.includes(\"--\")) {\n\t\terrors.push(`name must not contain consecutive hyphens`);\n\t}\n\n\treturn errors;\n}\n\n/**\n * Validate description per Agent Skills spec.\n */\nfunction validateDescription(description: unknown): string[] {\n\tconst errors: string[] = [];\n\n\tif (typeof description !== \"string\" || description.trim() === \"\") {\n\t\terrors.push(\"description is required\");\n\t} else if (description.length > MAX_DESCRIPTION_LENGTH) {\n\t\terrors.push(`description exceeds ${MAX_DESCRIPTION_LENGTH} characters (${description.length})`);\n\t}\n\n\treturn errors;\n}\n\nexport interface LoadSkillsFromDirOptions {\n\t/** Directory to scan for skills */\n\tdir: string;\n\t/** Source identifier for these skills */\n\tsource: string;\n}\n\nfunction createSkillSourceInfo(filePath: string, baseDir: string, source: string): SourceInfo {\n\tswitch (source) {\n\t\tcase \"builtin\":\n\t\t\treturn createSyntheticSourceInfo(filePath, {\n\t\t\t\tsource: \"builtin\",\n\t\t\t\tscope: \"user\",\n\t\t\t\tbaseDir,\n\t\t\t});\n\t\tcase \"user\":\n\t\t\treturn createSyntheticSourceInfo(filePath, {\n\t\t\t\tsource: \"local\",\n\t\t\t\tscope: \"user\",\n\t\t\t\tbaseDir,\n\t\t\t});\n\t\tcase \"project\":\n\t\t\treturn createSyntheticSourceInfo(filePath, {\n\t\t\t\tsource: \"local\",\n\t\t\t\tscope: \"project\",\n\t\t\t\tbaseDir,\n\t\t\t});\n\t\tcase \"path\":\n\t\t\treturn createSyntheticSourceInfo(filePath, {\n\t\t\t\tsource: \"local\",\n\t\t\t\tbaseDir,\n\t\t\t});\n\t\tdefault:\n\t\t\treturn createSyntheticSourceInfo(filePath, { source, baseDir });\n\t}\n}\n\n/**\n * Load skills from a directory.\n *\n * Discovery rules:\n * - if a directory contains SKILL.md, treat it as a skill root and do not recurse further\n * - otherwise, load direct .md children in the root\n * - recurse into subdirectories to find SKILL.md\n */\nexport function loadSkillsFromDir(options: LoadSkillsFromDirOptions): LoadSkillsResult {\n\tconst { dir, source } = options;\n\treturn loadSkillsFromDirInternal(dir, source, true);\n}\n\nfunction loadSkillsFromDirInternal(\n\tdir: string,\n\tsource: string,\n\tincludeRootFiles: boolean,\n\tignoreMatcher?: IgnoreMatcher,\n\trootDir?: string,\n): LoadSkillsResult {\n\tconst skills: Skill[] = [];\n\tconst diagnostics: ResourceDiagnostic[] = [];\n\n\tif (!existsSync(dir)) {\n\t\treturn { skills, diagnostics };\n\t}\n\n\tconst root = rootDir ?? dir;\n\tconst ig = ignoreMatcher ?? ignore();\n\taddIgnoreRules(ig, dir, root);\n\n\ttry {\n\t\tconst entries = readdirSync(dir, { withFileTypes: true });\n\n\t\tfor (const entry of entries) {\n\t\t\tif (entry.name !== \"SKILL.md\") {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst fullPath = join(dir, entry.name);\n\n\t\t\tlet isFile = entry.isFile();\n\t\t\tif (entry.isSymbolicLink()) {\n\t\t\t\ttry {\n\t\t\t\t\tisFile = statSync(fullPath).isFile();\n\t\t\t\t} catch {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst relPath = toPosixPath(relative(root, fullPath));\n\t\t\tif (!isFile || ig.ignores(relPath)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst result = loadSkillFromFile(fullPath, source);\n\t\t\tif (result.skill) {\n\t\t\t\tskills.push(result.skill);\n\t\t\t}\n\t\t\tdiagnostics.push(...result.diagnostics);\n\t\t\treturn { skills, diagnostics };\n\t\t}\n\n\t\tfor (const entry of entries) {\n\t\t\tif (entry.name.startsWith(\".\")) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Skip node_modules to avoid scanning dependencies\n\t\t\tif (entry.name === \"node_modules\") {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst fullPath = join(dir, entry.name);\n\n\t\t\t// For symlinks, check if they point to a directory and follow them\n\t\t\tlet isDirectory = entry.isDirectory();\n\t\t\tlet isFile = entry.isFile();\n\t\t\tif (entry.isSymbolicLink()) {\n\t\t\t\ttry {\n\t\t\t\t\tconst stats = statSync(fullPath);\n\t\t\t\t\tisDirectory = stats.isDirectory();\n\t\t\t\t\tisFile = stats.isFile();\n\t\t\t\t} catch {\n\t\t\t\t\t// Broken symlink, skip it\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst relPath = toPosixPath(relative(root, fullPath));\n\t\t\tconst ignorePath = isDirectory ? `${relPath}/` : relPath;\n\t\t\tif (ig.ignores(ignorePath)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (isDirectory) {\n\t\t\t\tconst subResult = loadSkillsFromDirInternal(fullPath, source, false, ig, root);\n\t\t\t\tskills.push(...subResult.skills);\n\t\t\t\tdiagnostics.push(...subResult.diagnostics);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (!isFile || !includeRootFiles || !entry.name.endsWith(\".md\")) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst result = loadSkillFromFile(fullPath, source);\n\t\t\tif (result.skill) {\n\t\t\t\tskills.push(result.skill);\n\t\t\t}\n\t\t\tdiagnostics.push(...result.diagnostics);\n\t\t}\n\t} catch {}\n\n\treturn { skills, diagnostics };\n}\n\nfunction loadSkillFromFile(\n\tfilePath: string,\n\tsource: string,\n): { skill: Skill | null; diagnostics: ResourceDiagnostic[] } {\n\tconst diagnostics: ResourceDiagnostic[] = [];\n\tconst isDeclaredSkill = basename(filePath) === \"SKILL.md\";\n\n\tlet rawContent: string;\n\ttry {\n\t\trawContent = readFileSync(filePath, \"utf-8\");\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : \"failed to read skill file\";\n\t\tdiagnostics.push({ type: \"warning\", message, path: filePath });\n\t\treturn { skill: null, diagnostics };\n\t}\n\n\tlet frontmatter: SkillFrontmatter;\n\ttry {\n\t\t({ frontmatter } = parseFrontmatter<SkillFrontmatter>(rawContent));\n\t} catch (error) {\n\t\tif (isDeclaredSkill) {\n\t\t\tconst message = error instanceof Error ? error.message : \"failed to parse skill file\";\n\t\t\tdiagnostics.push({ type: \"warning\", message, path: filePath });\n\t\t}\n\t\treturn { skill: null, diagnostics };\n\t}\n\n\tconst description = frontmatter.description;\n\tconst hasDescription = typeof description === \"string\" && description.trim() !== \"\";\n\tif (!isDeclaredSkill && !hasDescription) {\n\t\treturn { skill: null, diagnostics };\n\t}\n\n\tconst skillDir = dirname(filePath);\n\tconst parentDirName = basename(skillDir);\n\n\t// Validate description\n\tconst descErrors = validateDescription(description);\n\tfor (const error of descErrors) {\n\t\tdiagnostics.push({ type: \"warning\", message: error, path: filePath });\n\t}\n\n\t// Use name from frontmatter, or fall back to parent directory name\n\tconst frontmatterName = typeof frontmatter.name === \"string\" ? frontmatter.name : undefined;\n\tconst name = frontmatterName || parentDirName;\n\n\t// Validate name\n\tconst nameErrors = validateName(name);\n\tfor (const error of nameErrors) {\n\t\tdiagnostics.push({ type: \"warning\", message: error, path: filePath });\n\t}\n\n\t// Still load the skill even with warnings, unless description is missing or empty.\n\tif (!hasDescription) {\n\t\treturn { skill: null, diagnostics };\n\t}\n\n\treturn {\n\t\tskill: {\n\t\t\tname,\n\t\t\tdescription,\n\t\t\tfilePath,\n\t\t\tbaseDir: skillDir,\n\t\t\tsourceInfo: createSkillSourceInfo(filePath, skillDir, source),\n\t\t\tdisableModelInvocation: frontmatter[\"disable-model-invocation\"] === true,\n\t\t},\n\t\tdiagnostics,\n\t};\n}\n\n/**\n * Format skills for inclusion in a system prompt.\n * Uses XML format per Agent Skills standard.\n * See: https://agentskills.io/integrate-skills\n *\n * Skills with disableModelInvocation=true are excluded from the prompt\n * (they can only be invoked explicitly via /skill:name commands).\n *\n * `fileReadTool` names the tool that loads skill files; `indirect` names none, for a reader that\n * is reachable only through another tool.\n */\nexport function formatSkillsForPrompt(skills: Skill[], fileReadTool: \"read\" | \"bash\" | \"indirect\" = \"read\"): string {\n\tconst visibleSkills = skills.filter((s) => !s.disableModelInvocation);\n\n\tif (visibleSkills.length === 0) {\n\t\treturn \"\";\n\t}\n\n\tconst lines = [\n\t\t\"\\n\\nThe following skills provide specialized instructions for specific tasks.\",\n\t\tfileReadTool === \"read\"\n\t\t\t? \"Use the read tool to load a skill's file when the task matches its description.\"\n\t\t\t: fileReadTool === \"bash\"\n\t\t\t\t? \"Use bash to load a skill's file when the task matches its description.\"\n\t\t\t\t: \"Load a skill's file when the task matches its description.\",\n\t\t\"When a skill file references a relative path, resolve it against the skill directory (parent of SKILL.md / dirname of the path) and use that absolute path in tool commands.\",\n\t\t\"\",\n\t\t\"<available_skills>\",\n\t];\n\n\tfor (const skill of visibleSkills) {\n\t\tlines.push(\" <skill>\");\n\t\tlines.push(` <name>${escapeXml(skill.name)}</name>`);\n\t\tlines.push(` <description>${escapeXml(skill.description)}</description>`);\n\t\tlines.push(` <location>${escapeXml(skill.filePath)}</location>`);\n\t\tlines.push(\" </skill>\");\n\t}\n\n\tlines.push(\"</available_skills>\");\n\n\treturn lines.join(\"\\n\");\n}\n\nfunction escapeXml(str: string): string {\n\treturn str\n\t\t.replace(/&/g, \"&amp;\")\n\t\t.replace(/</g, \"&lt;\")\n\t\t.replace(/>/g, \"&gt;\")\n\t\t.replace(/\"/g, \"&quot;\")\n\t\t.replace(/'/g, \"&apos;\");\n}\n\nexport interface LoadSkillsOptions {\n\t/** Working directory for project-local skills. */\n\tcwd: string;\n\t/** Agent config directory for global skills. */\n\tagentDir: string;\n\t/** Explicit skill paths (files or directories) */\n\tskillPaths: string[];\n\t/** Include default skills directories. */\n\tincludeDefaults: boolean;\n\t/** Include skills shipped with the package (builtin skills). */\n\tincludeShipped?: boolean;\n}\n\n/**\n * Load skills from all configured locations.\n * Returns skills and any validation diagnostics.\n */\nexport function loadSkills(options: LoadSkillsOptions): LoadSkillsResult {\n\tconst { agentDir, skillPaths, includeDefaults, includeShipped } = options;\n\n\t// Resolve agentDir - if not provided, use default from config\n\tconst resolvedCwd = resolvePath(options.cwd);\n\tconst resolvedAgentDir = resolvePath(agentDir ?? getAgentDir());\n\n\tconst skillMap = new Map<string, Skill>();\n\tconst realPathSet = new Set<string>();\n\tconst allDiagnostics: ResourceDiagnostic[] = [];\n\tconst collisionDiagnostics: ResourceDiagnostic[] = [];\n\n\tfunction addSkills(result: LoadSkillsResult) {\n\t\tallDiagnostics.push(...result.diagnostics);\n\t\tfor (const skill of result.skills) {\n\t\t\t// Resolve symlinks to detect duplicate files\n\t\t\tconst realPath = comparablePath(skill.filePath);\n\n\t\t\t// Skip silently if we've already loaded this exact file (via symlink)\n\t\t\tif (realPathSet.has(realPath)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst existing = skillMap.get(skill.name);\n\t\t\tif (existing) {\n\t\t\t\tcollisionDiagnostics.push({\n\t\t\t\t\ttype: \"collision\",\n\t\t\t\t\tmessage: `name \"${skill.name}\" collision`,\n\t\t\t\t\tpath: skill.filePath,\n\t\t\t\t\tcollision: {\n\t\t\t\t\t\tresourceType: \"skill\",\n\t\t\t\t\t\tname: skill.name,\n\t\t\t\t\t\twinnerPath: existing.filePath,\n\t\t\t\t\t\tloserPath: skill.filePath,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tskillMap.set(skill.name, skill);\n\t\t\t\trealPathSet.add(realPath);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (includeDefaults) {\n\t\taddSkills(loadSkillsFromDirInternal(join(resolvedAgentDir, \"skills\"), \"user\", true));\n\t\taddSkills(loadSkillsFromDirInternal(resolve(resolvedCwd, CONFIG_DIR_NAME, \"skills\"), \"project\", true));\n\t}\n\n\tconst userSkillsDir = join(resolvedAgentDir, \"skills\");\n\tconst projectSkillsDir = resolve(resolvedCwd, CONFIG_DIR_NAME, \"skills\");\n\n\tconst isUnderPath = (target: string, root: string): boolean => {\n\t\tconst normalizedRoot = resolve(root);\n\t\tif (target === normalizedRoot) {\n\t\t\treturn true;\n\t\t}\n\t\tconst prefix = normalizedRoot.endsWith(sep) ? normalizedRoot : `${normalizedRoot}${sep}`;\n\t\treturn target.startsWith(prefix);\n\t};\n\n\tconst getSource = (resolvedPath: string): \"user\" | \"project\" | \"path\" => {\n\t\tif (!includeDefaults) {\n\t\t\tif (isUnderPath(resolvedPath, userSkillsDir)) return \"user\";\n\t\t\tif (isUnderPath(resolvedPath, projectSkillsDir)) return \"project\";\n\t\t}\n\t\treturn \"path\";\n\t};\n\n\tfor (const rawPath of skillPaths) {\n\t\tconst resolvedPath = resolvePath(rawPath, resolvedCwd, { trim: true });\n\t\tif (!existsSync(resolvedPath)) {\n\t\t\tallDiagnostics.push({ type: \"warning\", message: \"skill path does not exist\", path: resolvedPath });\n\t\t\tcontinue;\n\t\t}\n\n\t\ttry {\n\t\t\tconst stats = statSync(resolvedPath);\n\t\t\tconst source = getSource(resolvedPath);\n\t\t\tif (stats.isDirectory()) {\n\t\t\t\taddSkills(loadSkillsFromDirInternal(resolvedPath, source, true));\n\t\t\t} else if (stats.isFile() && resolvedPath.endsWith(\".md\")) {\n\t\t\t\tconst result = loadSkillFromFile(resolvedPath, source);\n\t\t\t\tif (result.skill) {\n\t\t\t\t\taddSkills({ skills: [result.skill], diagnostics: result.diagnostics });\n\t\t\t\t} else {\n\t\t\t\t\tallDiagnostics.push(...result.diagnostics);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tallDiagnostics.push({ type: \"warning\", message: \"skill path is not a markdown file\", path: resolvedPath });\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : \"failed to read skill path\";\n\t\t\tallDiagnostics.push({ type: \"warning\", message, path: resolvedPath });\n\t\t}\n\t}\n\n\t// Shipped (builtin) skills load last so user/project/CLI skills win name collisions.\n\tif (includeShipped) {\n\t\taddSkills(loadSkillsFromDirInternal(getShippedSkillsDir(), \"builtin\", false));\n\t}\n\n\treturn {\n\t\tskills: Array.from(skillMap.values()),\n\t\tdiagnostics: [...allDiagnostics, ...collisionDiagnostics],\n\t};\n}\n"]}
@@ -9,6 +9,11 @@ export interface BuildSystemPromptOptions {
9
9
  forceSystemPrompt?: string;
10
10
  /** Tools to include in prompt. Default: [read, bash, edit, write]. */
11
11
  selectedTools?: string[];
12
+ /**
13
+ * Selected tools whose declarations requests leave out (`prepareLoadout` hidden declarations).
14
+ * They are reachable only through another tool, so the tool list and rules leave them out too.
15
+ */
16
+ hiddenTools?: string[];
12
17
  /** Optional one-line tool snippets keyed by tool name. */
13
18
  toolSnippets?: Record<string, string>;
14
19
  /** Guideline bullets contributed by each tool, keyed by tool name. */
@@ -31,6 +36,7 @@ export interface BuildSystemPromptOptions {
31
36
  }
32
37
  export type NormalizedBuildSystemPromptOptions = BuildSystemPromptOptions & {
33
38
  selectedTools: string[];
39
+ hiddenTools: string[];
34
40
  toolSnippets: Record<string, string>;
35
41
  toolGuidelines: Record<string, string[]>;
36
42
  promptGuidelines: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../../src/core/system-prompt.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAyB,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAEhE,MAAM,WAAW,wBAAwB;IACxC,0DAA0D;IA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B,CAAC,KAAK,EAAE,wBAAwB,GAAG,oBAAoB,CAgE/F;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,wBAAwB,GAAG;IACxE,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,oBAAoB,CAAC;CAChC,CAGA;AAED,oGAAoG;AACpG,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,wBAAwB,GAAG,MAAM,CAEzE;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACvC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,EACvC,OAAO,EAAE,oBAAoB,GAC3B,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,GAAG,SAAS,CAS3C"}
@@ -11,6 +11,7 @@ export function normalizeBuildSystemPromptOptions(input) {
11
11
  customPrompt: input.customPrompt,
12
12
  forceSystemPrompt: input.forceSystemPrompt,
13
13
  selectedTools: [...(input.selectedTools ?? ["read", "bash", "edit", "write"])],
14
+ hiddenTools: [...(input.hiddenTools ?? [])],
14
15
  toolSnippets: { ...(input.toolSnippets ?? {}) },
15
16
  toolGuidelines: Object.fromEntries(Object.entries(input.toolGuidelines ?? {}).map(([name, guidelines]) => [name, [...guidelines]])),
16
17
  promptGuidelines: [...(input.promptGuidelines ?? [])],
@@ -66,28 +67,29 @@ function buildRules(selectedTools, toolGuidelines, promptGuidelines) {
66
67
  /** Build the ordered, independently replaceable sections of the structured system prompt. */
67
68
  export function buildSystemPromptSections(input) {
68
69
  const options = normalizeBuildSystemPromptOptions(input);
69
- const { customPrompt, selectedTools, toolSnippets, toolGuidelines, promptGuidelines, appendSystemPrompt, sections: customSections, cwd, contextFiles, skills, } = options;
70
+ const { customPrompt, selectedTools, hiddenTools, toolSnippets, toolGuidelines, promptGuidelines, appendSystemPrompt, sections: customSections, cwd, contextFiles, skills, } = options;
70
71
  for (const name of Object.keys(customSections)) {
71
72
  if (!SYSTEM_PROMPT_SECTION_NAME.test(name) || name === "preamble") {
72
73
  throw new Error(`Invalid system prompt section name: ${name}`);
73
74
  }
74
75
  }
76
+ const declaredTools = selectedTools.filter((name) => !hiddenTools.includes(name));
75
77
  const promptSections = {};
76
78
  if (customPrompt) {
77
79
  promptSections.preamble = customPrompt;
78
80
  }
79
81
  else {
80
82
  promptSections.preamble = `You are an expert coding assistant operating inside ${APP_NAME}, a coding agent harness. You help users by reading files, executing commands, editing code, and writing new files.`;
81
- const visibleTools = selectedTools.filter((name) => !!toolSnippets[name]);
83
+ const visibleTools = declaredTools.filter((name) => !!toolSnippets[name]);
82
84
  const tools = visibleTools.length > 0 ? visibleTools.map((name) => `- ${name}: ${toolSnippets[name]}`).join("\n") : "(none)";
83
85
  promptSections.tools = `${tools}\n\nIn addition to the tools above, you may have access to other custom tools depending on the project.`;
84
- promptSections.rules = buildRules(selectedTools, toolGuidelines, promptGuidelines);
86
+ promptSections.rules = buildRules(declaredTools, toolGuidelines, promptGuidelines);
85
87
  promptSections.docs = `${APP_NAME} documentation (read only when the user asks about ${APP_NAME} itself, its SDK, extensions, themes, skills, or TUI):
86
88
  - Main documentation: ${getReadmePath()}
87
89
  - Additional docs: ${getDocsPath()}
88
90
  - Examples: ${getExamplesPath()} (extensions, custom tools, SDK)
89
91
  - When reading ${APP_NAME} docs or examples, resolve docs/... under Additional docs and examples/... under Examples, not the current working directory
90
- - When asked about: extensions (docs/extensions.md, examples/extensions/), themes (docs/themes.md), skills (docs/skills.md), prompt templates (docs/prompt-templates.md), TUI components (docs/tui.md), keybindings (docs/keybindings.md), SDK integrations (docs/sdk.md), custom providers (docs/custom-provider.md), adding models (docs/models.md), ${APP_NAME} packages (docs/packages.md), environment variables (docs/environment-variables.md), MCP servers (docs/mcp.md)
92
+ - When asked about: extensions (docs/extensions.md, examples/extensions/), themes (docs/themes.md), skills (docs/skills.md), prompt templates (docs/prompt-templates.md), TUI components (docs/tui.md), keybindings (docs/keybindings.md), SDK integrations (docs/sdk.md), custom providers (docs/custom-provider.md), adding models (docs/models.md), ${APP_NAME} packages (docs/packages.md), environment variables (docs/environment-variables.md), MCP servers (docs/mcp.md), codemode scripts and non-LLM models such as classifiers and image models (docs/codemode.md)
91
93
  - When working on ${APP_NAME} topics, read the docs and examples, and follow .md cross-references before implementing
92
94
  - Always read ${APP_NAME} .md files completely and follow links to related docs (e.g., tui.md for TUI API details)`;
93
95
  }
@@ -95,7 +97,10 @@ export function buildSystemPromptSections(input) {
95
97
  promptSections.addendum = appendSystemPrompt;
96
98
  if (contextFiles.length > 0)
97
99
  promptSections.project_context = renderProjectContext(contextFiles);
98
- const skillFileReadTool = ["read", "bash"].find((tool) => selectedTools.includes(tool));
100
+ // A hidden reader is still reachable through another tool, so skills stay but the hint names no tool.
101
+ const readers = ["read", "bash"];
102
+ const skillFileReadTool = readers.find((tool) => declaredTools.includes(tool)) ??
103
+ (readers.some((tool) => selectedTools.includes(tool)) ? "indirect" : undefined);
99
104
  if (skillFileReadTool && skills.length > 0) {
100
105
  const skillsPrompt = formatSkillsForPrompt(skills, skillFileReadTool).trim();
101
106
  if (skillsPrompt)
@@ -1 +1 @@
1
- {"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../../src/core/system-prompt.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,qBAAqB,EAAc,MAAM,aAAa,CAAC;AA6ChE,MAAM,0BAA0B,GAAG,oBAAoB,CAAC;AACxD,gGAAgG;AAChG,MAAM,UAAU,iCAAiC,CAAC,KAA+B;IAChF,OAAO;QACN,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;QAC1C,aAAa,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,aAAa,IAAI,CAAC,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AI,CAAC;IACjD,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1C,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,SAAS;YAAE,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACrD,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC1D,CAAC","sourcesContent":["/**\n * System prompt construction and project context loading\n */\n\nimport { getSystemMessageText } from \"@draht/ai\";\nimport { APP_NAME, getDocsPath, getExamplesPath, getReadmePath } from \"../config.ts\";\nimport { formatSkillsForPrompt, type Skill } from \"./skills.ts\";\n\nexport interface BuildSystemPromptOptions {\n\t/** Custom system prompt (replaces the default prefix). */\n\tcustomPrompt?: string;\n\t/** Exact full prompt replacement set by a before_agent_start handler. */\n\tforceSystemPrompt?: string;\n\t/** Tools to include in prompt. Default: [read, bash, edit, write]. */\n\tselectedTools?: string[];\n\t/** Optional one-line tool snippets keyed by tool name. */\n\ttoolSnippets?: Record<string, string>;\n\t/** Guideline bullets contributed by each tool, keyed by tool name. */\n\ttoolGuidelines?: Record<string, string[]>;\n\t/** Additional guideline bullets appended to the default system prompt rules. */\n\tpromptGuidelines?: string[];\n\t/** Text appended from user configuration before project context, skills, and cwd. */\n\tappendSystemPrompt?: string;\n\t/** Additional XML-wrapped prompt sections keyed by tag name. */\n\tsections?: Record<string, string>;\n\t/** Working directory. */\n\tcwd: string;\n\t/** Pre-loaded context files. */\n\tcontextFiles?: Array<{ path: string; content: string }>;\n\t/** Pre-loaded skills. */\n\tskills?: Skill[];\n}\n\nexport type NormalizedBuildSystemPromptOptions = BuildSystemPromptOptions & {\n\tselectedTools: string[];\n\ttoolSnippets: Record<string, string>;\n\ttoolGuidelines: Record<string, string[]>;\n\tpromptGuidelines: string[];\n\tappendSystemPrompt: string;\n\tsections: Record<string, string>;\n\tcontextFiles: Array<{ path: string; content: string }>;\n\tskills: Skill[];\n};\n\n/**\n * Ordered system prompt sections, keyed by name. `preamble` is untagged text; every other\n * section is wrapped in a tag of the same name so the model can match later updates to it.\n * These become `SystemMessage.sections` in the transcript.\n */\nexport type SystemPromptSections = Record<string, string>;\n\nconst SYSTEM_PROMPT_SECTION_NAME = /^[a-z][a-z0-9_-]*$/;\n/** Normalize prompt input into the mutable, collection-complete shape exposed to extensions. */\nexport function normalizeBuildSystemPromptOptions(input: BuildSystemPromptOptions): NormalizedBuildSystemPromptOptions {\n\treturn {\n\t\tcustomPrompt: input.customPrompt,\n\t\tforceSystemPrompt: input.forceSystemPrompt,\n\t\tselectedTools: [...(input.selectedTools ?? [\"read\", \"bash\", \"edit\", \"write\"])],\n\t\ttoolSnippets: { ...(input.toolSnippets ?? {}) },\n\t\ttoolGuidelines: Object.fromEntries(\n\t\t\tObject.entries(input.toolGuidelines ?? {}).map(([name, guidelines]) => [name, [...guidelines]]),\n\t\t),\n\t\tpromptGuidelines: [...(input.promptGuidelines ?? [])],\n\t\tappendSystemPrompt: input.appendSystemPrompt ?? \"\",\n\t\tsections: { ...(input.sections ?? {}) },\n\t\tcwd: input.cwd,\n\t\tcontextFiles: (input.contextFiles ?? []).map((file) => ({ ...file })),\n\t\tskills: (input.skills ?? []).map((skill) => ({ ...skill })),\n\t};\n}\n\nfunction renderProjectContext(contextFiles: Array<{ path: string; content: string }>): string {\n\treturn [\n\t\t\"Project-specific instructions and guidelines:\",\n\t\t...contextFiles.map(\n\t\t\t({ path, content }) => `<project_instructions path=\"${path}\">\\n${content}\\n</project_instructions>`,\n\t\t),\n\t].join(\"\\n\\n\");\n}\n\nfunction buildRules(\n\tselectedTools: string[],\n\ttoolGuidelines: Record<string, string[]>,\n\tpromptGuidelines: string[],\n): string {\n\tconst rules: string[] = [];\n\tconst seen = new Set<string>();\n\tconst addRule = (rule: string): void => {\n\t\tconst normalized = rule.trim();\n\t\tif (!normalized || seen.has(normalized)) return;\n\t\tseen.add(normalized);\n\t\trules.push(normalized);\n\t};\n\n\tconst hasBash = selectedTools.includes(\"bash\");\n\tconst hasPowerShell = selectedTools.includes(\"powershell\");\n\tconst hasGrep = selectedTools.includes(\"grep\");\n\tconst hasFind = selectedTools.includes(\"find\");\n\tconst hasLs = selectedTools.includes(\"ls\");\n\n\tif ((hasBash || hasPowerShell) && !hasGrep && !hasFind && !hasLs) {\n\t\tif (hasBash && hasPowerShell) {\n\t\t\taddRule(\"Use bash or PowerShell for file operations like listing, searching, and finding files\");\n\t\t} else if (hasPowerShell) {\n\t\t\taddRule(\"Use PowerShell for file operations like listing, searching, and finding files\");\n\t\t} else {\n\t\t\taddRule(\"Use bash for file operations like ls, rg, find\");\n\t\t}\n\t}\n\n\tfor (const name of selectedTools) {\n\t\tfor (const rule of toolGuidelines[name] ?? []) addRule(rule);\n\t}\n\tfor (const rule of promptGuidelines) addRule(rule);\n\taddRule(\"Be concise in your responses\");\n\taddRule(\"Show file paths clearly when working with files\");\n\treturn rules.map((rule) => `- ${rule}`).join(\"\\n\");\n}\n\n/** Build the ordered, independently replaceable sections of the structured system prompt. */\nexport function buildSystemPromptSections(input: BuildSystemPromptOptions): SystemPromptSections {\n\tconst options = normalizeBuildSystemPromptOptions(input);\n\tconst {\n\t\tcustomPrompt,\n\t\tselectedTools,\n\t\ttoolSnippets,\n\t\ttoolGuidelines,\n\t\tpromptGuidelines,\n\t\tappendSystemPrompt,\n\t\tsections: customSections,\n\t\tcwd,\n\t\tcontextFiles,\n\t\tskills,\n\t} = options;\n\n\tfor (const name of Object.keys(customSections)) {\n\t\tif (!SYSTEM_PROMPT_SECTION_NAME.test(name) || name === \"preamble\") {\n\t\t\tthrow new Error(`Invalid system prompt section name: ${name}`);\n\t\t}\n\t}\n\n\tconst promptSections: Record<string, string> = {};\n\tif (customPrompt) {\n\t\tpromptSections.preamble = customPrompt;\n\t} else {\n\t\tpromptSections.preamble = `You are an expert coding assistant operating inside ${APP_NAME}, a coding agent harness. You help users by reading files, executing commands, editing code, and writing new files.`;\n\t\tconst visibleTools = selectedTools.filter((name) => !!toolSnippets[name]);\n\t\tconst tools =\n\t\t\tvisibleTools.length > 0 ? visibleTools.map((name) => `- ${name}: ${toolSnippets[name]}`).join(\"\\n\") : \"(none)\";\n\t\tpromptSections.tools = `${tools}\\n\\nIn addition to the tools above, you may have access to other custom tools depending on the project.`;\n\t\tpromptSections.rules = buildRules(selectedTools, toolGuidelines, promptGuidelines);\n\t\tpromptSections.docs = `${APP_NAME} documentation (read only when the user asks about ${APP_NAME} itself, its SDK, extensions, themes, skills, or TUI):\n- Main documentation: ${getReadmePath()}\n- Additional docs: ${getDocsPath()}\n- Examples: ${getExamplesPath()} (extensions, custom tools, SDK)\n- When reading ${APP_NAME} docs or examples, resolve docs/... under Additional docs and examples/... under Examples, not the current working directory\n- When asked about: extensions (docs/extensions.md, examples/extensions/), themes (docs/themes.md), skills (docs/skills.md), prompt templates (docs/prompt-templates.md), TUI components (docs/tui.md), keybindings (docs/keybindings.md), SDK integrations (docs/sdk.md), custom providers (docs/custom-provider.md), adding models (docs/models.md), ${APP_NAME} packages (docs/packages.md), environment variables (docs/environment-variables.md), MCP servers (docs/mcp.md)\n- When working on ${APP_NAME} topics, read the docs and examples, and follow .md cross-references before implementing\n- Always read ${APP_NAME} .md files completely and follow links to related docs (e.g., tui.md for TUI API details)`;\n\t}\n\n\tif (appendSystemPrompt) promptSections.addendum = appendSystemPrompt;\n\tif (contextFiles.length > 0) promptSections.project_context = renderProjectContext(contextFiles);\n\tconst skillFileReadTool = ([\"read\", \"bash\"] as const).find((tool) => selectedTools.includes(tool));\n\tif (skillFileReadTool && skills.length > 0) {\n\t\tconst skillsPrompt = formatSkillsForPrompt(skills, skillFileReadTool).trim();\n\t\tif (skillsPrompt) promptSections.skills = skillsPrompt;\n\t}\n\tpromptSections.cwd = cwd.replace(/\\\\/g, \"/\");\n\tfor (const [name, content] of Object.entries(customSections)) {\n\t\tif (content) promptSections[name] = content;\n\t}\n\n\tconst sections: SystemPromptSections = { preamble: promptSections.preamble };\n\tfor (const [name, content] of Object.entries(promptSections)) {\n\t\tif (name !== \"preamble\") sections[name] = `<${name}>\\n${content}\\n</${name}>`;\n\t}\n\treturn sections;\n}\n\n/**\n * The complete prompt state for `input`. A forced prompt is opaque and lives in `content`\n * with no sections; otherwise `content` is empty and the structured sections carry the prompt.\n */\nexport function buildSystemPromptState(input: BuildSystemPromptOptions): {\n\tcontent: string;\n\tsections?: SystemPromptSections;\n} {\n\tif (input.forceSystemPrompt !== undefined) return { content: input.forceSystemPrompt };\n\treturn { content: \"\", sections: buildSystemPromptSections(input) };\n}\n\n/** Build the system prompt text, rendered exactly as the transcript's system message replays it. */\nexport function buildSystemPrompt(input: BuildSystemPromptOptions): string {\n\treturn getSystemMessageText({ role: \"system\", ...buildSystemPromptState(input), timestamp: 0 });\n}\n\n/**\n * Diff the sections the model currently has (replayed from the transcript, so never null)\n * against the desired ones. Returns a `SystemMessage.sections` patch, or undefined when\n * nothing changed.\n */\nexport function diffSystemPromptSections(\n\tprevious: Record<string, string | null>,\n\tcurrent: SystemPromptSections,\n): Record<string, string | null> | undefined {\n\tconst patch: Record<string, string | null> = {};\n\tfor (const [name, text] of Object.entries(current)) {\n\t\tif (previous[name] !== text) patch[name] = text;\n\t}\n\tfor (const name of Object.keys(previous)) {\n\t\tif (current[name] === undefined) patch[name] = null;\n\t}\n\treturn Object.keys(patch).length > 0 ? patch : undefined;\n}\n"]}
1
+ {"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../../src/core/system-prompt.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,qBAAqB,EAAc,MAAM,aAAa,CAAC;AAmDhE,M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,iBAAiB,KAAK,SAAS;QAAE,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,iBAAiB,EAAE,CAAC;IACvF,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,yBAAyB,CAAC,KAAK,CAAC,EAAE,CAAC;AACpE,CAAC;AAED,oGAAoG;AACpG,MAAM,UAAU,iBAAiB,CAAC,KAA+B;IAChE,OAAO,oBAAoB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,sBAAsB,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;AACjG,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CACvC,QAAuC,EACvC,OAA6B;IAE7B,MAAM,KAAK,GAAkC,EAAE,CAAC;IAChD,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACpD,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,IAAI;YAAE,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACjD,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1C,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,SAAS;YAAE,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACrD,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC1D,CAAC","sourcesContent":["/**\n * System prompt construction and project context loading\n */\n\nimport { getSystemMessageText } from \"@draht/ai\";\nimport { APP_NAME, getDocsPath, getExamplesPath, getReadmePath } from \"../config.ts\";\nimport { formatSkillsForPrompt, type Skill } from \"./skills.ts\";\n\nexport interface BuildSystemPromptOptions {\n\t/** Custom system prompt (replaces the default prefix). */\n\tcustomPrompt?: string;\n\t/** Exact full prompt replacement set by a before_agent_start handler. */\n\tforceSystemPrompt?: string;\n\t/** Tools to include in prompt. Default: [read, bash, edit, write]. */\n\tselectedTools?: string[];\n\t/**\n\t * Selected tools whose declarations requests leave out (`prepareLoadout` hidden declarations).\n\t * They are reachable only through another tool, so the tool list and rules leave them out too.\n\t */\n\thiddenTools?: string[];\n\t/** Optional one-line tool snippets keyed by tool name. */\n\ttoolSnippets?: Record<string, string>;\n\t/** Guideline bullets contributed by each tool, keyed by tool name. */\n\ttoolGuidelines?: Record<string, string[]>;\n\t/** Additional guideline bullets appended to the default system prompt rules. */\n\tpromptGuidelines?: string[];\n\t/** Text appended from user configuration before project context, skills, and cwd. */\n\tappendSystemPrompt?: string;\n\t/** Additional XML-wrapped prompt sections keyed by tag name. */\n\tsections?: Record<string, string>;\n\t/** Working directory. */\n\tcwd: string;\n\t/** Pre-loaded context files. */\n\tcontextFiles?: Array<{ path: string; content: string }>;\n\t/** Pre-loaded skills. */\n\tskills?: Skill[];\n}\n\nexport type NormalizedBuildSystemPromptOptions = BuildSystemPromptOptions & {\n\tselectedTools: string[];\n\thiddenTools: string[];\n\ttoolSnippets: Record<string, string>;\n\ttoolGuidelines: Record<string, string[]>;\n\tpromptGuidelines: string[];\n\tappendSystemPrompt: string;\n\tsections: Record<string, string>;\n\tcontextFiles: Array<{ path: string; content: string }>;\n\tskills: Skill[];\n};\n\n/**\n * Ordered system prompt sections, keyed by name. `preamble` is untagged text; every other\n * section is wrapped in a tag of the same name so the model can match later updates to it.\n * These become `SystemMessage.sections` in the transcript.\n */\nexport type SystemPromptSections = Record<string, string>;\n\nconst SYSTEM_PROMPT_SECTION_NAME = /^[a-z][a-z0-9_-]*$/;\n/** Normalize prompt input into the mutable, collection-complete shape exposed to extensions. */\nexport function normalizeBuildSystemPromptOptions(input: BuildSystemPromptOptions): NormalizedBuildSystemPromptOptions {\n\treturn {\n\t\tcustomPrompt: input.customPrompt,\n\t\tforceSystemPrompt: input.forceSystemPrompt,\n\t\tselectedTools: [...(input.selectedTools ?? [\"read\", \"bash\", \"edit\", \"write\"])],\n\t\thiddenTools: [...(input.hiddenTools ?? [])],\n\t\ttoolSnippets: { ...(input.toolSnippets ?? {}) },\n\t\ttoolGuidelines: Object.fromEntries(\n\t\t\tObject.entries(input.toolGuidelines ?? {}).map(([name, guidelines]) => [name, [...guidelines]]),\n\t\t),\n\t\tpromptGuidelines: [...(input.promptGuidelines ?? [])],\n\t\tappendSystemPrompt: input.appendSystemPrompt ?? \"\",\n\t\tsections: { ...(input.sections ?? {}) },\n\t\tcwd: input.cwd,\n\t\tcontextFiles: (input.contextFiles ?? []).map((file) => ({ ...file })),\n\t\tskills: (input.skills ?? []).map((skill) => ({ ...skill })),\n\t};\n}\n\nfunction renderProjectContext(contextFiles: Array<{ path: string; content: string }>): string {\n\treturn [\n\t\t\"Project-specific instructions and guidelines:\",\n\t\t...contextFiles.map(\n\t\t\t({ path, content }) => `<project_instructions path=\"${path}\">\\n${content}\\n</project_instructions>`,\n\t\t),\n\t].join(\"\\n\\n\");\n}\n\nfunction buildRules(\n\tselectedTools: string[],\n\ttoolGuidelines: Record<string, string[]>,\n\tpromptGuidelines: string[],\n): string {\n\tconst rules: string[] = [];\n\tconst seen = new Set<string>();\n\tconst addRule = (rule: string): void => {\n\t\tconst normalized = rule.trim();\n\t\tif (!normalized || seen.has(normalized)) return;\n\t\tseen.add(normalized);\n\t\trules.push(normalized);\n\t};\n\n\tconst hasBash = selectedTools.includes(\"bash\");\n\tconst hasPowerShell = selectedTools.includes(\"powershell\");\n\tconst hasGrep = selectedTools.includes(\"grep\");\n\tconst hasFind = selectedTools.includes(\"find\");\n\tconst hasLs = selectedTools.includes(\"ls\");\n\n\tif ((hasBash || hasPowerShell) && !hasGrep && !hasFind && !hasLs) {\n\t\tif (hasBash && hasPowerShell) {\n\t\t\taddRule(\"Use bash or PowerShell for file operations like listing, searching, and finding files\");\n\t\t} else if (hasPowerShell) {\n\t\t\taddRule(\"Use PowerShell for file operations like listing, searching, and finding files\");\n\t\t} else {\n\t\t\taddRule(\"Use bash for file operations like ls, rg, find\");\n\t\t}\n\t}\n\n\tfor (const name of selectedTools) {\n\t\tfor (const rule of toolGuidelines[name] ?? []) addRule(rule);\n\t}\n\tfor (const rule of promptGuidelines) addRule(rule);\n\taddRule(\"Be concise in your responses\");\n\taddRule(\"Show file paths clearly when working with files\");\n\treturn rules.map((rule) => `- ${rule}`).join(\"\\n\");\n}\n\n/** Build the ordered, independently replaceable sections of the structured system prompt. */\nexport function buildSystemPromptSections(input: BuildSystemPromptOptions): SystemPromptSections {\n\tconst options = normalizeBuildSystemPromptOptions(input);\n\tconst {\n\t\tcustomPrompt,\n\t\tselectedTools,\n\t\thiddenTools,\n\t\ttoolSnippets,\n\t\ttoolGuidelines,\n\t\tpromptGuidelines,\n\t\tappendSystemPrompt,\n\t\tsections: customSections,\n\t\tcwd,\n\t\tcontextFiles,\n\t\tskills,\n\t} = options;\n\n\tfor (const name of Object.keys(customSections)) {\n\t\tif (!SYSTEM_PROMPT_SECTION_NAME.test(name) || name === \"preamble\") {\n\t\t\tthrow new Error(`Invalid system prompt section name: ${name}`);\n\t\t}\n\t}\n\n\tconst declaredTools = selectedTools.filter((name) => !hiddenTools.includes(name));\n\tconst promptSections: Record<string, string> = {};\n\tif (customPrompt) {\n\t\tpromptSections.preamble = customPrompt;\n\t} else {\n\t\tpromptSections.preamble = `You are an expert coding assistant operating inside ${APP_NAME}, a coding agent harness. You help users by reading files, executing commands, editing code, and writing new files.`;\n\t\tconst visibleTools = declaredTools.filter((name) => !!toolSnippets[name]);\n\t\tconst tools =\n\t\t\tvisibleTools.length > 0 ? visibleTools.map((name) => `- ${name}: ${toolSnippets[name]}`).join(\"\\n\") : \"(none)\";\n\t\tpromptSections.tools = `${tools}\\n\\nIn addition to the tools above, you may have access to other custom tools depending on the project.`;\n\t\tpromptSections.rules = buildRules(declaredTools, toolGuidelines, promptGuidelines);\n\t\tpromptSections.docs = `${APP_NAME} documentation (read only when the user asks about ${APP_NAME} itself, its SDK, extensions, themes, skills, or TUI):\n- Main documentation: ${getReadmePath()}\n- Additional docs: ${getDocsPath()}\n- Examples: ${getExamplesPath()} (extensions, custom tools, SDK)\n- When reading ${APP_NAME} docs or examples, resolve docs/... under Additional docs and examples/... under Examples, not the current working directory\n- When asked about: extensions (docs/extensions.md, examples/extensions/), themes (docs/themes.md), skills (docs/skills.md), prompt templates (docs/prompt-templates.md), TUI components (docs/tui.md), keybindings (docs/keybindings.md), SDK integrations (docs/sdk.md), custom providers (docs/custom-provider.md), adding models (docs/models.md), ${APP_NAME} packages (docs/packages.md), environment variables (docs/environment-variables.md), MCP servers (docs/mcp.md), codemode scripts and non-LLM models such as classifiers and image models (docs/codemode.md)\n- When working on ${APP_NAME} topics, read the docs and examples, and follow .md cross-references before implementing\n- Always read ${APP_NAME} .md files completely and follow links to related docs (e.g., tui.md for TUI API details)`;\n\t}\n\n\tif (appendSystemPrompt) promptSections.addendum = appendSystemPrompt;\n\tif (contextFiles.length > 0) promptSections.project_context = renderProjectContext(contextFiles);\n\t// A hidden reader is still reachable through another tool, so skills stay but the hint names no tool.\n\tconst readers = [\"read\", \"bash\"] as const;\n\tconst skillFileReadTool =\n\t\treaders.find((tool) => declaredTools.includes(tool)) ??\n\t\t(readers.some((tool) => selectedTools.includes(tool)) ? \"indirect\" : undefined);\n\tif (skillFileReadTool && skills.length > 0) {\n\t\tconst skillsPrompt = formatSkillsForPrompt(skills, skillFileReadTool).trim();\n\t\tif (skillsPrompt) promptSections.skills = skillsPrompt;\n\t}\n\tpromptSections.cwd = cwd.replace(/\\\\/g, \"/\");\n\tfor (const [name, content] of Object.entries(customSections)) {\n\t\tif (content) promptSections[name] = content;\n\t}\n\n\tconst sections: SystemPromptSections = { preamble: promptSections.preamble };\n\tfor (const [name, content] of Object.entries(promptSections)) {\n\t\tif (name !== \"preamble\") sections[name] = `<${name}>\\n${content}\\n</${name}>`;\n\t}\n\treturn sections;\n}\n\n/**\n * The complete prompt state for `input`. A forced prompt is opaque and lives in `content`\n * with no sections; otherwise `content` is empty and the structured sections carry the prompt.\n */\nexport function buildSystemPromptState(input: BuildSystemPromptOptions): {\n\tcontent: string;\n\tsections?: SystemPromptSections;\n} {\n\tif (input.forceSystemPrompt !== undefined) return { content: input.forceSystemPrompt };\n\treturn { content: \"\", sections: buildSystemPromptSections(input) };\n}\n\n/** Build the system prompt text, rendered exactly as the transcript's system message replays it. */\nexport function buildSystemPrompt(input: BuildSystemPromptOptions): string {\n\treturn getSystemMessageText({ role: \"system\", ...buildSystemPromptState(input), timestamp: 0 });\n}\n\n/**\n * Diff the sections the model currently has (replayed from the transcript, so never null)\n * against the desired ones. Returns a `SystemMessage.sections` patch, or undefined when\n * nothing changed.\n */\nexport function diffSystemPromptSections(\n\tprevious: Record<string, string | null>,\n\tcurrent: SystemPromptSections,\n): Record<string, string | null> | undefined {\n\tconst patch: Record<string, string | null> = {};\n\tfor (const [name, text] of Object.entries(current)) {\n\t\tif (previous[name] !== text) patch[name] = text;\n\t}\n\tfor (const name of Object.keys(previous)) {\n\t\tif (current[name] === undefined) patch[name] = null;\n\t}\n\treturn Object.keys(patch).length > 0 ? patch : undefined;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../../src/core/tools/bash.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAIN,KAAK,WAAW,EAGhB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAoB,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAI/E,OAAO,EAAoD,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAoBxG,QAAA,MAAM,UAAU;;;EAGd,CAAC;AAEH,eAAO,MAAM,gCAAgC;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AAC,OAAO,UAAU,EAAE,eAAe,GAAG,SAAS,EAAE,eAAe,CAAC,CAwKjF;AAYD,wBAAgB,wBAAwB,CACvC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,eAAe,GACvB,cAAc,CAAC,OAAO,UAAU,EAAE,eAAe,GAAG,SAAS,EAAE,eAAe,CAAC,CAEjF;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC,OAAO,UAAU,CAAC,CAQnG"}
@@ -38,11 +38,9 @@ export const bashToolSystemPromptContribution = {
38
38
  * `output` is not limited like the model-facing output: callers decide how much of it reaches the model.
39
39
  */
40
40
  const bashOutputSchema = Type.Object({
41
- output: Type.String({
42
- description: "Combined stdout and stderr, up to 1 MiB. Longer output keeps its first and last 512 KiB around an omission marker.",
43
- }),
44
- truncated: Type.Boolean({ description: "Whether `output` omits part of the command output" }),
45
- full_output_path: Type.Optional(Type.String({ description: "Temp file with the full output, when truncated" })),
41
+ output: Type.String({ description: "Combined stdout and stderr, possibly truncated" }),
42
+ truncated: Type.Boolean(),
43
+ full_output_path: Type.Optional(Type.String({ description: "Full output, when truncated" })),
46
44
  exit_code: Type.Number(),
47
45
  wall_time_seconds: Type.Number(),
48
46
  });