dal-code 1.0.38 → 1.0.40

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 (320) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/NOTICE +224 -0
  3. package/dal-docs/examples/extensions/LICENSE +21 -0
  4. package/dal-docs/examples/extensions/README.md +64 -0
  5. package/dal-docs/examples/extensions/bookmark.ts +52 -0
  6. package/dal-docs/examples/extensions/claude-rules.ts +88 -0
  7. package/dal-docs/examples/extensions/commands.ts +74 -0
  8. package/dal-docs/examples/extensions/custom-footer.ts +66 -0
  9. package/dal-docs/examples/extensions/dirty-repo-guard.ts +58 -0
  10. package/dal-docs/examples/extensions/dynamic-tools.ts +76 -0
  11. package/dal-docs/examples/extensions/hello.ts +49 -0
  12. package/dal-docs/examples/extensions/inline-bash.ts +96 -0
  13. package/dal-docs/examples/extensions/permission-gate.ts +36 -0
  14. package/dal-docs/examples/extensions/protected-paths.ts +32 -0
  15. package/dal-docs/examples/extensions/session-name.ts +29 -0
  16. package/dal-docs/examples/extensions/status-line.ts +34 -0
  17. package/dal-docs/examples/extensions/structured-output.ts +67 -0
  18. package/dal-docs/examples/extensions/tool-override.ts +146 -0
  19. package/dal-docs/examples/extensions/trigger-compact.ts +59 -0
  20. package/dal-docs/examples/extensions/truncated-tool.ts +197 -0
  21. package/dal-docs/extensions.md +27 -0
  22. package/dal-docs/settings.md +1 -1
  23. package/dist/cli/args.d.ts +3 -0
  24. package/dist/cli/args.js +17 -17
  25. package/dist/config.d.ts +1 -0
  26. package/dist/config.js +1 -1
  27. package/dist/core/agent-session.js +6 -6
  28. package/dist/core/compaction/compaction.js +31 -13
  29. package/dist/core/extensions/loader.js +1 -1
  30. package/dist/core/extensions/permission-surface.js +1 -1
  31. package/dist/core/extensions/runner.js +1 -1
  32. package/dist/core/extensions/types.d.ts +15 -1
  33. package/dist/core/model-registry.d.ts +1 -0
  34. package/dist/core/model-registry.js +1 -1
  35. package/dist/core/nested-tool-calls.js +2 -2
  36. package/dist/core/permissions/tool-policy.js +1 -1
  37. package/dist/core/project-facts.d.ts +16 -0
  38. package/dist/core/project-facts.js +2 -0
  39. package/dist/core/resource-loader.js +1 -1
  40. package/dist/core/sandbox/policy.js +1 -1
  41. package/dist/core/sandbox/windows.js +1 -1
  42. package/dist/core/system-prompt.d.ts +1 -0
  43. package/dist/core/system-prompt.js +13 -12
  44. package/dist/core/tools/bash.js +13 -12
  45. package/dist/core/tools/path-utils.d.ts +5 -0
  46. package/dist/core/tools/process.d.ts +2 -0
  47. package/dist/core/tools/process.js +14 -13
  48. package/dist/core/workspace-lock.d.ts +29 -0
  49. package/dist/core/workspace-lock.js +3 -0
  50. package/dist/dal/extension-compat.d.ts +62 -0
  51. package/dist/dal/extension-compat.js +4 -0
  52. package/dist/dal/hooks/extension.js +2 -2
  53. package/dist/dal/i18n.js +1 -1
  54. package/dist/dal/manifest.js +1 -1
  55. package/dist/dal/reviewed/endorsed-cli.js +1 -1
  56. package/dist/dal/reviewed/endorsed.js +1 -1
  57. package/dist/dal/reviewed/market-keys.js +1 -0
  58. package/dist/dal/reviewed/market.d.ts +64 -0
  59. package/dist/dal/reviewed/market.js +2 -0
  60. package/dist/extensions/mcp/runtime.d.ts +2 -1
  61. package/dist/extensions/mcp/runtime.js +3 -3
  62. package/dist/extensions/mcp/runtime.lazy.d.ts +1 -0
  63. package/dist/index.d.ts +9 -1
  64. package/dist/index.js +1 -1
  65. package/dist/main.js +4 -4
  66. package/dist/modes/acp/acp-mode.js +1 -1
  67. package/dist/modes/interactive/interactive-mode.d.ts +1 -0
  68. package/dist/modes/interactive/interactive-mode.js +14 -14
  69. package/dist/modes/print-mode.js +3 -3
  70. package/dist/modes/rpc/rpc-mode.js +1 -1
  71. package/dist/node_modules/@dalcode/dal-advisor/LICENSE +45 -0
  72. package/dist/node_modules/@dalcode/dal-advisor/package.json +35 -0
  73. package/dist/node_modules/@dalcode/dal-advisor/src/index.js +22 -0
  74. package/dist/node_modules/@dalcode/dal-bridge/package.json +2 -2
  75. package/dist/node_modules/@dalcode/dal-bridge/src/ask-user.js +1 -1
  76. package/dist/node_modules/@dalcode/dal-capabilities/LICENSE +21 -0
  77. package/dist/node_modules/@dalcode/dal-capabilities/package.json +38 -0
  78. package/dist/node_modules/@dalcode/dal-capabilities/src/catalogue.js +1 -0
  79. package/dist/node_modules/@dalcode/dal-capabilities/src/index.js +11 -0
  80. package/dist/node_modules/@dalcode/dal-capabilities/src/install.js +4 -0
  81. package/dist/node_modules/@dalcode/dal-capabilities/src/match.js +1 -0
  82. package/dist/node_modules/@dalcode/dal-capabilities/src/state.js +3 -0
  83. package/dist/node_modules/@dalcode/dal-compat/LICENSE +21 -0
  84. package/dist/node_modules/@dalcode/dal-compat/package.json +32 -0
  85. package/dist/node_modules/@dalcode/dal-compat/src/claude-rules.js +3 -0
  86. package/dist/node_modules/@dalcode/dal-compat/src/index.js +7 -0
  87. package/dist/node_modules/@dalcode/dal-dap/LICENSE +47 -0
  88. package/dist/node_modules/@dalcode/dal-dap/package.json +38 -0
  89. package/dist/node_modules/@dalcode/dal-dap/src/adapters.js +1 -0
  90. package/dist/node_modules/@dalcode/dal-dap/src/client.js +5 -0
  91. package/dist/node_modules/@dalcode/dal-dap/src/index.js +9 -0
  92. package/dist/node_modules/@dalcode/dal-dap/src/install.js +2 -0
  93. package/dist/node_modules/@dalcode/dal-dap/src/session.js +2 -0
  94. package/dist/node_modules/@dalcode/dal-dap/src/types.js +0 -0
  95. package/dist/node_modules/@dalcode/dal-gateway/package.json +2 -2
  96. package/dist/node_modules/@dalcode/dal-goal/package.json +4 -3
  97. package/dist/node_modules/@dalcode/dal-goal/src/core.js +6 -6
  98. package/dist/node_modules/@dalcode/dal-goal/src/index.js +17 -7
  99. package/dist/node_modules/@dalcode/dal-goal/src/verify.js +26 -0
  100. package/dist/node_modules/@dalcode/dal-guard/package.json +6 -4
  101. package/dist/node_modules/@dalcode/dal-guard/src/attribution.js +1 -0
  102. package/dist/node_modules/@dalcode/dal-guard/src/credentials.js +1 -1
  103. package/dist/node_modules/@dalcode/dal-guard/src/edit-anchor-core.js +23 -0
  104. package/dist/node_modules/@dalcode/dal-guard/src/edit-anchor.js +4 -0
  105. package/dist/node_modules/@dalcode/dal-guard/src/index.js +1 -1
  106. package/dist/node_modules/@dalcode/dal-guard/src/package-manager.js +1 -0
  107. package/dist/node_modules/@dalcode/dal-guard/src/workspace.js +2 -0
  108. package/dist/node_modules/@dalcode/dal-halo/package.json +1 -1
  109. package/dist/node_modules/@dalcode/dal-interactive/LICENSE +209 -0
  110. package/dist/node_modules/@dalcode/dal-interactive/package.json +4 -3
  111. package/dist/node_modules/@dalcode/dal-interactive/src/btw.js +25 -0
  112. package/dist/node_modules/@dalcode/dal-interactive/src/index.js +1 -1
  113. package/dist/node_modules/@dalcode/dal-lang/package.json +3 -3
  114. package/dist/node_modules/@dalcode/dal-learn/LICENSE +21 -0
  115. package/dist/node_modules/@dalcode/dal-learn/package.json +35 -0
  116. package/dist/node_modules/@dalcode/dal-learn/src/engine.js +8 -0
  117. package/dist/node_modules/@dalcode/dal-learn/src/extract.js +14 -0
  118. package/dist/node_modules/@dalcode/dal-learn/src/index.js +17 -0
  119. package/dist/node_modules/@dalcode/dal-learn/src/lessons.js +3 -0
  120. package/dist/node_modules/@dalcode/dal-learn/src/migrate.js +1 -0
  121. package/dist/node_modules/@dalcode/dal-learn/src/procedures.js +11 -0
  122. package/dist/node_modules/@dalcode/dal-learn/src/project-map.js +2 -0
  123. package/dist/node_modules/@dalcode/dal-learn/src/project.js +1 -0
  124. package/dist/node_modules/@dalcode/dal-learn/src/safety.js +2 -0
  125. package/dist/node_modules/@dalcode/dal-learn/src/signals.js +5 -0
  126. package/dist/node_modules/@dalcode/dal-learn/src/skill-actions.js +1 -0
  127. package/dist/node_modules/@dalcode/dal-learn/src/skill-evolution.js +16 -0
  128. package/dist/node_modules/@dalcode/dal-learn/src/store.js +2 -0
  129. package/dist/node_modules/@dalcode/dal-lsp/package.json +6 -4
  130. package/dist/node_modules/@dalcode/dal-lsp/src/client.js +3 -3
  131. package/dist/node_modules/@dalcode/dal-lsp/src/config.js +1 -1
  132. package/dist/node_modules/@dalcode/dal-lsp/src/format.js +8 -7
  133. package/dist/node_modules/@dalcode/dal-lsp/src/index.js +11 -8
  134. package/dist/node_modules/@dalcode/dal-mcp/package.json +6 -5
  135. package/dist/node_modules/@dalcode/dal-mcp/src/config.d.ts +1 -0
  136. package/dist/node_modules/@dalcode/dal-mcp/src/config.js +1 -1
  137. package/dist/node_modules/@dalcode/dal-mcp/src/http-client.d.ts +32 -1
  138. package/dist/node_modules/@dalcode/dal-mcp/src/http-client.js +2 -1
  139. package/dist/node_modules/@dalcode/dal-mcp/src/index.js +16 -16
  140. package/dist/node_modules/@dalcode/dal-mcp/src/oauth.js +2 -0
  141. package/dist/node_modules/@dalcode/dal-mcp/src/stdio-client.d.ts +4 -2
  142. package/dist/node_modules/@dalcode/dal-mcp/src/stdio-client.js +4 -4
  143. package/dist/node_modules/@dalcode/dal-mcp/src/types.d.ts +9 -0
  144. package/dist/node_modules/@dalcode/dal-mcp/src/types.js +1 -1
  145. package/dist/node_modules/@dalcode/dal-office/package.json +2 -2
  146. package/dist/node_modules/@dalcode/dal-office/src/index.d.ts +6 -3
  147. package/dist/node_modules/@dalcode/dal-office/src/index.js +1 -1
  148. package/dist/node_modules/@dalcode/dal-office/src/render/chart-theme.d.ts +13 -0
  149. package/dist/node_modules/@dalcode/dal-office/src/render/chart-theme.js +1 -0
  150. package/dist/node_modules/@dalcode/dal-office/src/render/chart.d.ts +16 -0
  151. package/dist/node_modules/@dalcode/dal-office/src/render/chart.js +4 -2
  152. package/dist/node_modules/@dalcode/dal-office/src/render/docx.d.ts +4 -1
  153. package/dist/node_modules/@dalcode/dal-office/src/render/docx.js +1 -1
  154. package/dist/node_modules/@dalcode/dal-office/src/render/drawio-style.d.ts +4 -0
  155. package/dist/node_modules/@dalcode/dal-office/src/render/drawio-style.js +1 -0
  156. package/dist/node_modules/@dalcode/dal-office/src/render/pptx.d.ts +52 -4
  157. package/dist/node_modules/@dalcode/dal-office/src/render/pptx.js +3 -2
  158. package/dist/node_modules/@dalcode/dal-office/src/render/thumbnails.d.ts +1 -1
  159. package/dist/node_modules/@dalcode/dal-office/src/render/thumbnails.js +1 -1
  160. package/dist/node_modules/@dalcode/dal-office/src/render/xlsx.d.ts +1 -0
  161. package/dist/node_modules/@dalcode/dal-office/src/render/xlsx.js +1 -1
  162. package/dist/node_modules/@dalcode/dal-office/src/scratchpad.d.ts +30 -1
  163. package/dist/node_modules/@dalcode/dal-office/src/scratchpad.js +1 -1
  164. package/dist/node_modules/@dalcode/dal-office/src/themes.d.ts +35 -1
  165. package/dist/node_modules/@dalcode/dal-office/src/themes.js +1 -1
  166. package/dist/node_modules/@dalcode/dal-office/src/tools/chart-generate.js +3 -3
  167. package/dist/node_modules/@dalcode/dal-office/src/tools/doc-generate.js +2 -2
  168. package/dist/node_modules/@dalcode/dal-office/src/tools/drawio-generate.js +3 -3
  169. package/dist/node_modules/@dalcode/dal-office/src/tools/ppt-generate.js +2 -2
  170. package/dist/node_modules/@dalcode/dal-office/src/tools/ppt-plan.js +2 -2
  171. package/dist/node_modules/@dalcode/dal-office/src/tools/sheet-generate.js +2 -2
  172. package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +5 -3
  173. package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
  174. package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.js +5 -3
  175. package/dist/node_modules/@dalcode/dal-plugins/package.json +4 -5
  176. package/dist/node_modules/@dalcode/dal-plugins/src/index.js +11 -11
  177. package/dist/node_modules/@dalcode/dal-plugins/src/manage.js +8 -10
  178. package/dist/node_modules/@dalcode/dal-plugins/src/npm-hook.js +1 -1
  179. package/dist/node_modules/@dalcode/dal-plugins/src/registry.js +2 -2
  180. package/dist/node_modules/@dalcode/dal-recall/LICENSE +45 -0
  181. package/dist/node_modules/@dalcode/dal-recall/package.json +34 -0
  182. package/dist/node_modules/@dalcode/dal-recall/src/index-db.js +57 -0
  183. package/dist/node_modules/@dalcode/dal-recall/src/index.js +1 -0
  184. package/dist/node_modules/@dalcode/dal-recall/src/query.js +1 -0
  185. package/dist/node_modules/@dalcode/dal-recall/src/redact.js +1 -0
  186. package/dist/node_modules/@dalcode/dal-recall/src/sqlite.js +1 -0
  187. package/dist/node_modules/@dalcode/dal-review/package.json +3 -3
  188. package/dist/node_modules/@dalcode/dal-rewind/package.json +2 -2
  189. package/dist/node_modules/@dalcode/dal-rewind/src/commands.js +2 -2
  190. package/dist/node_modules/@dalcode/dal-rewind/src/core.d.ts +21 -8
  191. package/dist/node_modules/@dalcode/dal-rewind/src/core.js +8 -3
  192. package/dist/node_modules/@dalcode/dal-rewind/src/index.js +1 -1
  193. package/dist/node_modules/@dalcode/dal-rewind/src/state.js +1 -1
  194. package/dist/node_modules/@dalcode/dal-router/package.json +7 -5
  195. package/dist/node_modules/@dalcode/dal-router/src/advisor.js +1 -0
  196. package/dist/node_modules/@dalcode/dal-router/src/assist.js +4 -2
  197. package/dist/node_modules/@dalcode/dal-router/src/commands.js +8 -8
  198. package/dist/node_modules/@dalcode/dal-router/src/config.d.ts +5 -0
  199. package/dist/node_modules/@dalcode/dal-router/src/config.js +2 -2
  200. package/dist/node_modules/@dalcode/dal-router/src/index.js +4 -4
  201. package/dist/node_modules/@dalcode/dal-router/src/jev.d.ts +2 -1
  202. package/dist/node_modules/@dalcode/dal-router/src/jev.js +4 -4
  203. package/dist/node_modules/@dalcode/dal-router/src/services.js +1 -1
  204. package/dist/node_modules/@dalcode/dal-router/src/subagent.js +1 -1
  205. package/dist/node_modules/@dalcode/dal-router/src/suggest.js +2 -0
  206. package/dist/node_modules/@dalcode/dal-skills/package.json +4 -3
  207. package/dist/node_modules/@dalcode/dal-skills/src/bundled/browser-qa/SKILL.md +48 -0
  208. package/dist/node_modules/@dalcode/dal-skills/src/bundled/diagram-design/SKILL.md +81 -0
  209. package/dist/node_modules/@dalcode/dal-skills/src/bundled/poster-design/SKILL.md +50 -0
  210. package/dist/node_modules/@dalcode/dal-skills/src/bundled/print-design/SKILL.md +55 -0
  211. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/dashboard.html +177 -0
  212. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/diagram.html +39 -0
  213. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/echarts-dal.json +360 -0
  214. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/email/notice.html +46 -0
  215. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/landing.html +173 -0
  216. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/mermaid-dal.json +140 -0
  217. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/mindmap.html +65 -0
  218. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/posters/event-poster.html +40 -0
  219. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/posters/poster.css +41 -0
  220. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/posters/square-card.html +25 -0
  221. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/posters/wechat-cover.html +29 -0
  222. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/posters/xhs-card.html +35 -0
  223. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/posters/xhs-cover.html +26 -0
  224. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/print/letter.html +35 -0
  225. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/print/print.css +65 -0
  226. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/print/report.html +76 -0
  227. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/print/resume.html +72 -0
  228. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/render.mjs +18 -0
  229. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/tokens.css +264 -0
  230. package/dist/node_modules/@dalcode/dal-skills/src/bundled/web-design/SKILL.md +73 -0
  231. package/dist/node_modules/@dalcode/dal-skills/src/bundled.js +1 -0
  232. package/dist/node_modules/@dalcode/dal-skills/src/catalog.js +2 -2
  233. package/dist/node_modules/@dalcode/dal-skills/src/index.js +16 -11
  234. package/dist/node_modules/@dalcode/dal-statusline/LICENSE +21 -0
  235. package/dist/node_modules/@dalcode/dal-statusline/package.json +31 -0
  236. package/dist/node_modules/@dalcode/dal-statusline/src/index.js +3 -0
  237. package/dist/node_modules/@dalcode/dal-structured/LICENSE +21 -0
  238. package/dist/node_modules/@dalcode/dal-structured/package.json +32 -0
  239. package/dist/node_modules/@dalcode/dal-structured/src/index.js +9 -0
  240. package/dist/node_modules/@dalcode/dal-subagent/LICENSE +24 -0
  241. package/dist/node_modules/@dalcode/dal-subagent/package.json +7 -6
  242. package/dist/node_modules/@dalcode/dal-subagent/src/background.js +13 -0
  243. package/dist/node_modules/@dalcode/dal-subagent/src/index.js +22 -14
  244. package/dist/node_modules/@dalcode/dal-subagent/src/inproc-runner.js +3 -0
  245. package/dist/node_modules/@dalcode/dal-subagent/src/pool.js +1 -0
  246. package/dist/node_modules/@dalcode/dal-subagent/src/process-runner.js +3 -3
  247. package/dist/node_modules/@dalcode/dal-subagent/src/tmux-runner.js +3 -0
  248. package/dist/node_modules/@dalcode/dal-subagent/src/worktree.js +2 -0
  249. package/dist/node_modules/@dalcode/dal-telemetry/package.json +2 -2
  250. package/dist/node_modules/@dalcode/dal-terminal/package.json +2 -2
  251. package/dist/node_modules/@dalcode/dal-tool-catalog/package.json +2 -2
  252. package/dist/node_modules/@dalcode/dal-tool-catalog/src/groups.js +1 -1
  253. package/dist/node_modules/@dalcode/dal-tool-catalog/src/index.js +4 -4
  254. package/dist/node_modules/@dalcode/dal-tool-catalog/src/repair-hook.js +1 -0
  255. package/dist/node_modules/@dalcode/dal-tool-catalog/src/repair.js +4 -0
  256. package/dist/node_modules/@dalcode/dal-usage/LICENSE +45 -0
  257. package/dist/node_modules/@dalcode/dal-usage/package.json +33 -0
  258. package/dist/node_modules/@dalcode/dal-usage/src/budget.d.ts +14 -0
  259. package/dist/node_modules/@dalcode/dal-usage/src/budget.js +3 -0
  260. package/dist/node_modules/@dalcode/dal-usage/src/data.d.ts +30 -0
  261. package/dist/node_modules/@dalcode/dal-usage/src/data.js +1 -0
  262. package/dist/node_modules/@dalcode/dal-usage/src/index.d.ts +12 -0
  263. package/dist/node_modules/@dalcode/dal-usage/src/index.js +2 -0
  264. package/dist/node_modules/@dalcode/dal-usage/src/report.d.ts +29 -0
  265. package/dist/node_modules/@dalcode/dal-usage/src/report.js +3 -0
  266. package/dist/node_modules/@dalcode/dal-web/package.json +6 -4
  267. package/dist/node_modules/@dalcode/dal-web/src/fetch.js +11 -5
  268. package/dist/node_modules/@dalcode/dal-web/src/index.js +2 -2
  269. package/dist/node_modules/@dalcode/dal-web/src/pdf.js +5 -0
  270. package/dist/node_modules/@dalcode/dal-workflow/LICENSE +24 -0
  271. package/dist/node_modules/@dalcode/dal-workflow/package.json +2 -2
  272. package/dist/node_modules/@dalcode/dal-workflow/src/announce-check.js +1 -0
  273. package/dist/node_modules/@dalcode/dal-workflow/src/check-in.js +1 -1
  274. package/dist/node_modules/@dalcode/dal-workflow/src/completion-check.js +4 -0
  275. package/dist/node_modules/@dalcode/dal-workflow/src/index.js +4 -4
  276. package/dist/node_modules/@dalcode/dal-workflow/src/lean-code.js +1 -0
  277. package/dist/node_modules/@dalcode/dal-workflow/src/ledger.js +3 -0
  278. package/dist/node_modules/@dalcode/dal-workflow/src/loop-guard.js +3 -0
  279. package/dist/node_modules/@dalcode/dal-workflow/src/shared.js +2 -2
  280. package/dist/node_modules/@dalcode/dal-workflow/src/todo.js +4 -2
  281. package/dist/node_modules/@dalcode/dal-workflow/src/verify-check.js +2 -0
  282. package/dist/node_modules/@dalcode/deepailab/package.json +3 -3
  283. package/dist/node_modules/@earendil-works/chord/package.json +1 -1
  284. package/dist/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
  285. package/dist/node_modules/@earendil-works/pi-ai/dist/cli.js +0 -0
  286. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  287. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
  288. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  289. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/radius.json +1 -1
  290. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  291. package/dist/node_modules/@earendil-works/pi-ai/package.json +2 -2
  292. package/dist/node_modules/@earendil-works/pi-client/package.json +3 -3
  293. package/dist/node_modules/@earendil-works/pi-codemode/package.json +1 -1
  294. package/dist/node_modules/@earendil-works/pi-coding-agent/package.json +1 -1
  295. package/dist/node_modules/@earendil-works/pi-mcp/package.json +1 -1
  296. package/dist/node_modules/@earendil-works/pi-protocol/package.json +2 -2
  297. package/dist/node_modules/@earendil-works/pi-server/package.json +3 -3
  298. package/dist/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  299. package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
  300. package/dist/package-manager-cli.js +61 -61
  301. package/dist/sdk/office.d.ts +1 -1
  302. package/dist/sdk/office.js +1 -1
  303. package/dist/sdk/rewind.d.ts +1 -1
  304. package/dist/sdk/rewind.js +1 -1
  305. package/dist/sdk/usage.d.ts +8 -0
  306. package/dist/sdk/usage.js +1 -0
  307. package/dist/utils/open-browser.d.ts +1 -0
  308. package/dist/utils/tools-manager.js +1 -1
  309. package/dist/utils/version-check.d.ts +1 -0
  310. package/dist/utils/version-check.js +2 -2
  311. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  312. package/examples/extensions/gondolin/package-lock.json +2 -2
  313. package/examples/extensions/gondolin/package.json +1 -1
  314. package/examples/extensions/sandbox/package-lock.json +2 -2
  315. package/examples/extensions/sandbox/package.json +1 -1
  316. package/examples/extensions/with-deps/package-lock.json +2 -2
  317. package/examples/extensions/with-deps/package.json +1 -1
  318. package/npm-shrinkwrap.json +57 -14
  319. package/package.json +9 -2
  320. package/dist/node_modules/@dalcode/dal-plugins/src/compat.js +0 -2
package/CHANGELOG.md CHANGED
@@ -8,6 +8,93 @@ DAL Code 的发布说明。这里只写用户看得见的变化。
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [1.0.40] - 2026-10-17
12
+
13
+ - 自动选模型改为先征得同意:它会把每轮提问的部分内容(最多前 8000 字)发给第三方路由服务来挑选模型、调整工具和思考深度。第一次在终端里需要用到时会先问你,选“不用”就一直用你选的模型,什么都不发送;以后可用 `/factory auto on` / `/factory auto off` 随时开关,关掉后子助手选模型、插件排序、命令复核这些也都不再向第三方发送内容。还没回答过时,`dal -p` 和其他非交互方式一律不发送。
14
+ - 生成的 PPT 更有设计感:新增咨询报告、发布会深色大字、极简商务、教育培训、政企汇报五套风格,不选也会按主题自动挑合适的一套(旧的 business、tech 等名字仍可用)。整份 PPT 用同一套配色和字体,中英文混排在 PowerPoint、WPS、Keynote 上都能正常显示;每页按内容自动排版——大数字、可编辑的原生图表、方案对比、时间线、表格、目录、章节页、引用和结束页,标题过长会自动缩字号不再溢出,数据来源显示在页脚。
15
+ - 生成的 Word 文档按正式报告排版:A4、结论先行的摘要框、带页码的目录、自动编号的标题层级(Word 导航窗格可用)、页眉页脚“第 X 页 / 共 Y 页”、报表式表格(数字右对齐),正文两端对齐、首行缩进两字。政府和国企类文档可用公文格式(按 GB/T 9704:仿宋三号正文,一、(一)1. 标题层级,奇偶页页码)。
16
+ - 生成的 Excel 表格开箱即是成品:表头着色、斑马纹、冻结表头和筛选,数字、百分比、金额、日期按列自动识别成真正的数值格式,主金额列带数据条,增长列正数标绿、负数标红,可加“合计”行(公式求和),有连续月份或季度列时自动加趋势迷你图。
17
+ - 新增可选的“精简改动”:用 `dal --lean-code` 或在设置里写 `leanCode: true`,助手会优先复用项目里已有的代码,不加任务用不到的抽象、选项、配置和依赖,只写任务需要的代码;输入校验、错误处理、安全和无障碍不会因此省掉。默认不开启。
18
+ - 新增费用上限:`dal -p --max-cost 2 "任务"`、设置里的 `maxCost`,或在会话里用 `/budget 2`,给这一次运行设一个美元上限。花到八成时提醒一次;到上限后不再发出新的模型请求,并用中文说明花了多少、怎么继续(`/budget <更高金额>` 提高上限,`/budget off` 取消,`dal -p` 调大 `--max-cost` 重新运行),`dal -p` 以非零状态退出。子助手、第二意见、经验提炼的花费都算在内;派出的子助手也受剩余额度限制,后台子助手的花费在它结束时才计入,可能略超上限。`/budget` 查看当前花费和剩余额度。
19
+ - 便宜模型更少因“参数格式不对”白跑一轮:模型发来的工具参数有多余逗号、用了单引号、被包在代码块或字符串里、少了结尾的括号,或者把参数名写成别家工具的叫法(如 `file_path`),会先自动修正再调用,并在这次工具结果里注明改了什么;只修只有一种理解的错误,内容被截断在半句话里这类情况不会去猜,照常报错。`/usage` 会显示修正了多少次。可在设置里用 `toolArgRepair: false` 关闭。
20
+ - 改文件更不容易改错地方:助手读过一个文件后,如果它被格式化工具、脚本或别的程序改动过,助手再按旧内容去改那一处时会被拦下,什么都不写入,并直接看到那里现在的内容,按新内容重做;文件别处的改动不影响这次修改,只会提醒一句。
21
+ - 修改匹配不上时不再只报“找不到”:会给出文件里最接近的几处(带行号),或者列出重复出现的位置,助手不用整份重读就能改对;要替换的原文里误带了读取提示、或整体缩进差了一层这类小错会自动纠正并说明。
22
+ - 助手只读了长文件的一部分就想整份覆盖写入时会被拦下,避免把没看到的内容删掉。
23
+ - 助手连续几轮用完全相同的参数调用同一个工具、结果也一模一样时,会被提醒换个做法或直接回答,不再原地打转白白消耗时间和用量;轮询构建进度这类每次结果不同的调用不受影响。
24
+ - 助手说完“我来运行测试”之类的话却没有动手就停下时,会自动接着把这一步做完,不用你再输入“继续”;它最后是在问你问题或给你选项时不受影响。
25
+ - 助手改了代码却一次都没运行就要收尾时,会被要求先用最小的办法验证(相关测试、构建或一条能走到改动的命令),确实没法验证就说明原因和你该怎么验证;只改文档、或者你说了“不用跑测试”时不会这样。
26
+ - 新增 `dal -p --output-schema <文件.json>`:最终回答按你给的 JSON Schema 输出,标准输出里只有这段 JSON,适合脚本和 CI 直接解析;回答不符合时会让助手改正,仍不符合就不输出内容、在标准错误里说明哪一项不符合,并以退出码 3 结束(Schema 文件本身不能用时退出码为 2,不会调用模型)。
27
+ - 从 Claude Code 迁来的规则直接生效:用户目录和项目里的 `.claude/rules/` 与 `.claude/CLAUDE.md` 会和 AGENTS.md 一样交给助手;带 `paths:` 的规则在助手第一次读写匹配的文件时才加入。只读这些 Markdown 文件,不会读 `.claude` 下的设置或凭据。可在设置里用 `dalCompat.claudeRules: false` 关闭,`--no-context-files` 也会一并跳过。
28
+ - 新增 `/statusline`:在底部状态栏加一行自己的内容。可以写模板(如 `/statusline {model} · {cost} · {branch}`),也可以指定一个命令,它会从标准输入收到模型、目录、分支、用量、费用等信息,输出的第一行会显示出来;`/statusline off` 恢复默认。不设置时和以前一样。
29
+ - 新增“第二意见”:遇到有风险的改动、反复失败或复杂任务收尾时,助手可以请另一个更强的模型复核当前方案,并说明对方指出的风险。费用计入当前会话,每个会话最多 3 次(可在设置里用 `dalAdvisor` 调整次数或指定模型,设为 0 关闭)。
30
+ - 后台子助手可以在单独的 tmux 窗口里运行:用 `/agents tmux on` 开启(`/agents tmux off` 关闭,默认关闭),切过去就能看到它在做什么,也可以直接回答它的审批或接着打字接管,结果照常送回主对话;它在窗口里等你确认时,主窗口会提示“子助手 xxx 在 tmux 窗口 N 等你确认”。不在 tmux 里时窗口放进后台会话 `dal-subagents`。
31
+ - 新增 `/agents steer <ID> <指示>`:随时给正在运行的后台子助手补充或调整指示。
32
+ - 按任务自动启用能力时,如果它第一次使用前要下载较大的浏览器、运行时或模型,会先说明并征得你同意。
33
+ - 图表换了一套更耐看的默认样式:标题左对齐并可带一句结论作副标题,柱子上直接标数值,饼图改为按大小排序、中间显示合计的环形图,漏斗图标出每一步的转化率,类目名较长时自动改成横向条形图。生成的网页会跟随系统的深色/浅色模式切换,也可以直接要深色配色。修复图表在网页和文档里中文字体没有生效的问题。
34
+ - 生成的 draw.io 流程图、架构图统一成同一套专业样式:同一种强调色、中性底色的节点、直角圆角连线和系统中文字体,以前常见的默认蓝黄绿色块会自动换掉。
35
+ - 新增随附技能「网页和界面」:做网页、落地页、数据看板或管理后台时,按成熟产品的结构排版,使用统一的配色、字号和间距,支持深色模式和手机屏幕,避开渐变、玻璃拟态、满屏卡片这些一眼就像 AI 做的样式;交付前会截桌面、手机和深色三张图自查。
36
+ - 新增随附技能「图表样式」:流程图、架构图、时序图用统一配色,思维导图改用更清爽的分支导图,都能直接导出成图片。
37
+ - 新增随附技能「海报与社交卡片」:小红书封面和内页、公众号封面、活动海报、数据卡片都有现成版式,按你的内容排好后导出 PNG,文字放不下时会提示是哪一块。
38
+ - 新增随附技能「PDF 报告、简历、信函」:分析报告、一页简历、邀请函等直接导出排版规范的 PDF,自动加页码,简历超出一页会提示;也能做在各家邮箱里显示正常的 HTML 邮件。
39
+ - 以上导出图片和 PDF 都用你电脑上已有的 Chrome 或 Edge,在独立的临时配置里运行,不会碰你浏览器的登录状态;没有浏览器时会先问你再从国内镜像下载。
40
+
41
+ - 不用再自己找、自己装工具:任务需要时,助手会自动启用经 DAL 审核的连接器、技能和扩展,并在开头提示一行“已为这个任务启用:…”。比如说“打开这个网页看看报错”,会自动装好并启用 Chrome 开发者工具;只写代码的普通任务什么都不启用,也不会多一次模型调用。只会安装 DAL 审核并签名的固定版本,安装包与登记的校验值不一致就拒绝;国内网络会优先用国内镜像,镜像没有时再用官方源。
42
+ - 会改文件、用你的凭据、操作外部账号、删除数据或执行 `git clean` 的能力,启用前会问你一次;需要令牌或数据库连接串的,会用中文说明问你一次并妥善保存,下次不再问。`dal -p` 这类没有界面的运行不会询问,只说明跳过了什么。
43
+ - 新增 `/capabilities`:查看已启用和可用的能力,`/capabilities disable <名称>` 停用后不再自动启用,`/capabilities enable <名称>` 重新启用,`/capabilities auto off` 关闭自动安装。CI 环境中默认不自动安装。
44
+ - 新增随附技能「浏览器验收」:改了网页或界面后,助手先用命令能验证的就不开浏览器;需要看渲染结果时用浏览器打开页面、截图并检查控制台报错,把截图路径和控制台结果写进回答,拿不到这些证据就明说“未能在浏览器中验证”。它不会复用你本机浏览器的登录状态;本机没有可用的浏览器时,会先问你再从国内镜像下载约 180MB 的测试版 Chrome,并核对校验值。
45
+ - 审核过的能力里没有合适的工具时,助手会提议为这个任务写一个扩展,等你同意再动手,不会去网上装未经审核的包。
46
+ - 助手会从自己的工作中学经验:命令失败后换了做法才成功、你纠正了它、或者反复绕路时,会记下一条经验和依据。同一条经验在两个会话里都出现,或者修正后的测试、构建确实通过了,就自动启用,从下一个会话起交给助手;涉及删除、权限、凭据、联网或发布的经验,一定要你用 `/lessons approve` 确认后才启用。`/lessons` 查看全部,`/lessons undo` 随时撤销。
47
+ - 经验分两类:只对当前项目有效的,和对你所有项目都有效的个人习惯(比如惯用的包管理器、提交信息的语言)。同一仓库的不同克隆和工作区共用同一份项目经验。
48
+ - 助手会记住项目里验证过的事实:各个包能通过的测试和构建命令、用的包管理器、常被查找的代码在哪个文件、踩过的坑。新会话开头直接交给助手,少走一轮搜索;项目文件变了、命令失败了或长期没再用上,就不再提供,等下次成功后更新。
49
+ - 经验会跟踪效果:帮倒忙多于帮忙、或长期没用上的经验会自动退役。`/lessons stats` 查看启用、退役、帮上忙的次数和今天的提炼用量;`/lessons map` 查看项目地图。
50
+ - 同一套多步操作在 3 个会话里重复出现时,助手先看有没有相关的技能:有就只提一处最小的补充(比如它漏掉的步骤、失败过的命令和改用的命令),附上来自哪几次会话、出过什么错;补充会让技能过长时,改为拆成一个新技能。没有相关技能才起草新技能。`/lessons skills` 里能看到改动对比和依据,`/lessons skill accept` 采用后才生效,`/lessons skill discard` 丢弃。
51
+ - 技能分项目和个人两种:用到本项目的目录、脚本或路径的,作为项目技能只在这个项目里生效;只用通用命令的,作为个人技能在所有项目里可用。提议里会说明为什么这样判断,采用时可以用 `--scope project|user` 改。项目技能存在 DAL 自己的目录里,不会写进你的项目仓库;想提交给团队用时,用 `/lessons skill export <名字>` 导出到项目里。
52
+ - 随附技能、云端技能、插件和项目里自带的技能不会被改动:补充作为本机补充保存,加载技能时附在原文对应的位置。原技能更新后补充会自动重新附上;补充针对的那一段在新版里变了时,这条补充先不生效并提示你,用 `/lessons skill keep` 让它跟随新版,或 `/lessons undo` 不要它。
53
+ - 采用的技能改动会跟踪效果:之后用到这个技能的会话里,被你纠正或检查失败的次数比改动前多时,会自动退回上一版并告诉你。每个技能保留全部历史版本,`/lessons undo <技能提议编号>` 随时撤回。涉及删除、权限、凭据、联网或发布的技能改动,采用时还要你再确认一次。
54
+ - 只对当前任务有用的信息(例如这次要改的是哪一份文件、一个临时步骤)不再记成长期经验,而是留在这次对话里:上下文压缩后的任务台账会列出它,之后提到“上次那个任务”时也能从历史记录里搜到。同样的信息在别的任务里再次出现,才会按经验的规则记下来。
55
+ - 在 DAL Code 里点过“保留”的经验,会在命令行第一次进入该项目时自动导入,DAL Code 原有的经验数据保持不变。提炼经验时发给模型的内容会先去掉密钥、密码和你的用户目录,凭据文件的内容不会发出;每天有调用上限,可在设置里用 `dalLearn` 关闭。
56
+ - 经 DAL 审核的扩展会随 `dal update` 一起更新,而且只更新到审核过的版本;审核目录的签名不对、已过期或被改动过时,保留已安装的版本并说明原因。你自己安装的扩展仍然只在你明确要求时更新。
57
+ - 在命令行里使用时,检查点(`/rewind`)不再写进你项目的 git 仓库:不会再出现在 `git log --all`、分支列表或推送里,改存在 DAL 自己的目录;以前留在仓库里的检查点会自动移出并从仓库删除,仍可照常回退。
58
+ - 修复:账号下发的 MCP 服务器(例如 deepwiki)连不上时,`dal -p` 不再在结束时崩溃退出。
59
+ - 修复:`dal -p --yolo "任务"` 这类写法(开关选项后面紧跟任务)会把任务当成选项的值吞掉,结果什么都不输出、也不报错;现在任务照常执行。`dal -p` 没有拿到任何任务时会报错并以非零状态退出。
60
+ - 在新机器上第一次用 `dal -p`(或桌面端、子助手)时,助手的命令找不到 `rg`/`fd` 会自动补装并提示重跑;装不上时会改用普通的搜索方式,而不是卡在“命令不存在”。
61
+ - 从插件市场安装时,如果国内镜像上的版本落后于官方源(或镜像还没有这个包),会自动改从官方源安装,不再装上过时的旧版本。
62
+ - 报告的问题复现不了时,助手会先复现、拿出实际结果说明,并停下来不改业务代码;加载的技能(例如写测试、排障)不会再让它去“修”本来正确的代码。
63
+ - 助手用你最近一条消息的语言回答:界面是中文、但你用英文提问时,回答和它读到的工具反馈(例如待办清单)都会是英文,反过来也一样。
64
+ - 助手少花轮次记账:待办清单一次写完整份、和实际操作放在同一轮更新,短任务和 `dal -p` 这类无人值守的运行基本不再列清单;自动判断出要用的技能会随你的消息直接带上,不再单独花一轮去加载。
65
+ - 小项目(不到 50 个文件的 git 仓库)里助手不再派子助手,除非你明确要求;验证控制在几分钟内,后台等待一个进程太久时会提示它停下来汇报。
66
+ - 代码导航更准:DAL 自带 TypeScript/JavaScript 语言服务器,不用另装;在代码项目里 lsp 工具默认可用,可以只给符号名查定义、引用、实现和调用方,路径给成目录或不存在也能用;项目还没加载完时会先等它(最多 60 秒),超时会说明结果可能不完整,不再悄悄只返回一部分引用。
67
+ - 社区插件开箱即用:用 `dal install` 或 `/plugins install` 装的插件,原本固定写在主目录别处的配置和缓存会自动改存到 DAL 自己的目录,插件更新后也会自动重新处理;插件自带的重复依赖不再引发启动警告。少数无法自动处理的插件,会在安装时和 `dal list` 里标出“需要适配”。
68
+ - 助手可以搜索你在本机的过往会话:你提到“上次定的约定”“之前那个决定”时,它会在当前项目的历史会话里查找并引用原话,也可以搜全部项目。搜索完全在本机进行,聊天里出现过的密钥、令牌不会被收进搜索范围;第一次用到时才建立索引,不拖慢启动。
69
+ - 新增 `/usage`:查看所有会话的 token 用量和费用,按天、按模型、按项目分别列出,可选今天、最近 7 天、最近 30 天或全部(`/usage today|7d|30d|all`);子助手的花费只按派发它的会话计一次,不会重复计算。
70
+ - 目标模式(/goal)宣布完成前,会另起一个只能查看、不能改动文件的助手,对照目标独立检查项目里的实际文件:发现缺口时目标继续,并把具体缺口交给助手去补;检查本身没能完成时目标会暂停,由你选 `/goal resume` 重新检查或 `/goal accept` 直接标记完成。连续 3 次检查不通过会暂停,不会无限重试;检查的花费计入本次会话和目标的 token 预算。不需要时可在设置里把 `dalGoal.verify` 设为 false。
71
+ - 让助手“帮我写一个扩展”现在可以直接用:它会先看随包附带的十几个可运行示例再动手,写好的扩展放进你的个人扩展目录(所有项目可用)或当前项目的 `.dal/extensions`,`/reload` 后就能使用。
72
+ - 新增 `/btw <问题>`:助手干活时随手问一句(比如“刚才说的重试上限在哪个文件”),它根据当前对话马上回答,不打断正在进行的任务,问答也不会进入主对话、不占后续上下文。`/btw` 查看问过的内容,`/btw fold` 把这些问答带回主对话,`/btw clear` 清空;花费计入本次会话。
73
+ - 子助手可以在后台运行:助手把耗时的子任务放到后台后继续干别的,子助手做完会自动把报告送回来,不需要等待或反复查询;运行中可以随时给它补充或改变指示。同时最多 4 个后台子助手,多出的排队;每次你发消息后最多新派 8 个子助手。子助手的每一步操作都和主助手一样经过安全审批;它连续碰壁时会停下来,把卡住的原因先告诉主助手。`/agents` 查看正在运行的后台子助手,`/agents stop <ID>` 停止一个;后台子助手的花费计入本次会话。
74
+ - 需要改文件的子助手可以在独立的 git 工作区里干活:几个子助手并行修改也不会互相覆盖,也不动你当前的工作区;做完后改动提交到一个 `dal-sub-…` 分支,由你审阅后合并,没有改动就什么都不留下。
75
+ - MCP 服务器运行中新增或去掉了工具,助手下一次请求就能看到最新的工具列表,不用重新连接;远程 MCP 服务器随时主动通知的变化也能收到,不必等到下一次调用它。本机的 MCP 服务器进程意外退出后会自动重连(约 1、3、5、10、30 秒后各试一次),不必再手动 `/mcp reconnect`;远程服务器丢掉会话后也会自动重新建立。
76
+ - 需要登录的远程 MCP 服务器(例如 Notion、GitHub 的托管服务)现在可以用了:连接时提示需要登录,运行 `/mcp login <服务器>` 在浏览器里完成授权即可连上;登录信息保存在本机 DAL 目录里,过期会自动续期,`/mcp logout <服务器>` 退出登录。连接本身从不自动弹出浏览器。
77
+ - 修复:`dal` 退出、被 Ctrl+C 或 `kill` 终止后,经 `npx`、`uvx` 等方式启动的本机 MCP 服务器(例如 postgres-mcp)及其衍生进程不再残留在后台;不响应正常结束信号的服务器,约 2 秒后会被强制结束。
78
+ - 修复:助手用 `~/` 开头的路径写文件时,会被正确识别为项目之外的改动并先征求你的同意;`dal -p` 下未开全自动时照常拒绝。
79
+ - 读取网页(web_fetch)现在能读 PDF 链接:给出论文、报告等 PDF 的地址,助手会提取其中的文字按页阅读(最多 100 页、20 MB,长文可以接着往后读);扫描件、带密码或损坏的 PDF 会说明读不了的原因。
80
+ - 助手改完代码会马上知道有没有改坏:编辑或写入 TypeScript/JavaScript 等文件后,这次改动新引入的错误会直接附在结果后面(只列新出现的,文件里原有的不重复报,每个文件最多列 10 条)。语言服务器还没启动时会自动启动;几秒内没查完的,会在下一步操作的结果里补上,文件已经又改过就不再报旧结果。不需要时可在语言服务器设置里把 `editDiagnostics` 设为 false。
81
+ - 新增调试器:程序行为不对时,助手可以直接在调试器里运行 Python 或 Node.js 程序,设断点、单步、查看调用栈和变量的真实值,在断点处计算表达式,不用再到处加打印语句反复重跑。每次停下都会一次给出位置、调用栈和局部变量。第一次调试某种语言时会自动安装对应的调试组件(固定版本,下载后校验,Python 的优先走国内镜像),装不上会用中文说明原因。平时不占用每次请求的上下文,任务需要时才启用。
82
+ - 修复:切到上下文窗口更小的模型后,即使回复已经超出这个窗口,有时也不会自动压缩上下文;现在每次都会压缩。
83
+
84
+ ## [1.0.39] - 2026-10-17
85
+
86
+ - 登录凭据保护更严:凭据文件的副本,无论改名还是放在别的目录,助手都读不到、搜不到、也复制不走;被拦下后助手会停下来告诉你原因,不再换路子去拿。
87
+ - 修复:助手写的报告里只要提到凭据文件的位置就会被拦下;名字以 `.dal` 开头的其他目录(例如 `~/.dal_scratch`)也不再被误当成 DAL 的配置目录。
88
+ - 助手提交代码时,共同作者一栏署名 DAL Code,不会再照抄别的助手的署名;转交给子助手的任务说明会先按当前情况改写,去掉不适用或违反保护规则的步骤。
89
+ - 待办清单里还有没完成的项时,助手不会再说“全部完成”,而是逐项说明哪些已完成、哪些未做或只做了一部分。
90
+ - 固定使用轻量模型(如 deepseek-flash)做多条线的大任务时,每个会话会提示一次可以在 /model 选“自动”;不会自动替你换模型,`/factory suggest off` 可关闭提示。子助手的模型可以设为沿用当前模型,或指定一个专门干活的模型。
91
+ - 同一个 git 工作区正被另一个 `dal` 会话使用时,助手改动前会先问你;没有你的确认不会在那里提交。
92
+ - 助手会按项目的锁文件使用对应的包管理器(npm、pnpm、yarn、bun),不会在 npm 项目里跑 `pnpm install`;也知道每个子包的测试要在各自目录里运行。
93
+ - 长对话整理(压缩)后,助手会拿到整理时的待办清单、各仓库的分支和未提交状态以及改过的文件,不必再反复查 git 状态找回进度。
94
+ - 新增环境变量 `DAL_SKIP_VERSION_CHECK=1` 关闭启动时的更新检查(原来的 `PI_SKIP_VERSION_CHECK` 仍然有效)。
95
+
96
+ ## [1.0.38] - 2026-10-17
97
+
11
98
  - 同时使用 DAL Code 和独立的 `dal` 命令行(哪怕版本不同、同时在运行)时,设置、登录信息、会话和 MCP 配置不会再互相覆盖或丢失改动;程序意外退出也不会留下写了一半的文件。遇到更新版本写入的数据时,旧版本只读取、不改动,并提示你升级。
12
99
  - 修复:上游服务的输出上限低于模型标称值时,被截断的回答不再被丢弃、导致 `dal -p` 什么都不输出却返回成功;现在会照常输出已有内容,提示被截断,并以非零状态退出。
13
100
  - `dal update` 不再在没有安装第三方扩展时提示“已跳过扩展”;装了第三方扩展时,会告诉你装了几个、有几个有新版本,以及单独更新它们的命令。
package/NOTICE CHANGED
@@ -40,6 +40,17 @@ The goal mode extension (@dalcode/dal-goal) is adapted from
40
40
  Licensed under the MIT License, whose terms are the same as those in the
41
41
  LICENSE file distributed with this package.
42
42
 
43
+ The learning extension (@dalcode/dal-learn) adapts ideas, not code, from:
44
+
45
+ PenguinHarness continual-learning hook (https://github.com/Prism-Shadow/penguin-harness),
46
+ Licensed under the Apache License, Version 2.0: the per-line clipping of the
47
+ run excerpt given to the lesson-drafting model (modified: one run instead of a
48
+ task, smaller limits, credentials masked first).
49
+ pi-memory 0.4.2, Copyright (c) 2026 Jay Zeng, MIT License: rendering memory
50
+ once per session as a frozen snapshot so the prompt prefix stays cacheable.
51
+ openwiki 0.7.2, MIT License: tying a remembered fact to a content hash of the
52
+ file it rests on, and telling a missing file apart from a changed one.
53
+
43
54
  The command sandbox uses @anthropic-ai/sandbox-runtime, unmodified:
44
55
 
45
56
  Anthropic Sandbox Runtime (https://github.com/anthropic-experimental/sandbox-runtime)
@@ -47,6 +58,219 @@ The command sandbox uses @anthropic-ai/sandbox-runtime, unmodified:
47
58
  Licensed under the Apache License, Version 2.0; its LICENSE file ships in
48
59
  its package directory.
49
60
 
61
+ The lsp tool (@dalcode/dal-lsp) ships a TypeScript language server, used
62
+ when the project has none of its own, unmodified:
63
+
64
+ typescript-language-server (https://github.com/typescript-language-server/typescript-language-server)
65
+ Copyright TypeFox and others
66
+ Licensed under the Apache License, Version 2.0; its LICENSE file ships in
67
+ its package directory.
68
+
69
+ TypeScript (https://github.com/microsoft/TypeScript), used for its tsserver
70
+ when the project does not bring its own
71
+ Copyright (c) Microsoft Corporation
72
+ Licensed under the Apache License, Version 2.0; its LICENSE.txt and
73
+ ThirdPartyNoticeText.txt ship in its package directory.
74
+
75
+ The session search tool (@dalcode/dal-recall) is adapted from:
76
+
77
+ @henryqw/pi-session-recall 5.1.4 (https://github.com/HenryQW/pi-harness)
78
+ Copyright (c) 2026 Henry Wang
79
+ Licensed under the MIT License; its LICENSE file ships in the package
80
+ directory. Modified: secrets are masked before indexing and tool results
81
+ are never indexed, the index carries a schema version for engines sharing
82
+ one data directory, results are scoped to the project and kept small,
83
+ node:sqlite is loaded on first use, the pattern-miner preparation is left out.
84
+
85
+ The /usage command (@dalcode/dal-usage) adapts code from:
86
+
87
+ pi-usage-extension 0.9.5 (https://github.com/tmustier/pi-usage-extension)
88
+ Copyright (c) 2026 Thomas Mustier
89
+ Licensed under the MIT License; its LICENSE file ships in the package
90
+ directory. Modified: paths follow the DAL agent directory, sub-agent spend is
91
+ counted from the dispatching session only, the interactive dashboard,
92
+ graphs, insights and export are left out, and the per-file cache follows
93
+ DAL's shared-data rules.
94
+
95
+ The goal extension (@dalcode/dal-goal) also adapts, from pi-goal-x 0.32.3,
96
+ Copyright (c) 2026 Lucas, MIT License: an independent completion auditor with
97
+ fresh context and read-only tools that checks the agent's claim before a goal
98
+ is marked complete, treating the claim as untrusted and keeping the goal open
99
+ with the reasons when it is not met. Modified: the auditor runs as a separate
100
+ DAL process (approval gate and tool allowlist apply), has no shell, reports
101
+ through a schema-checked verdict tool, returns at most five short gaps, and
102
+ never counts a failed or timed-out check as approval; the prompts are new.
103
+
104
+ The extension examples in packages/coding-agent/dal-docs/examples/extensions/
105
+ are adapted from the example extensions of pi-mono
106
+ (https://github.com/badlogic/pi-mono), Copyright (c) 2025 Mario Zechner,
107
+ MIT License. Modified: renamed, rewritten headers and comments, DAL paths;
108
+ the LICENSE file ships in that folder.
109
+
110
+ Background sub-agents (@dalcode/dal-subagent: src/inproc-runner.ts,
111
+ src/background.ts, src/pool.ts, src/worktree.ts) adapt code from:
112
+
113
+ @tintinweb/pi-subagents 0.22.0 (https://github.com/tintinweb/pi-subagents)
114
+ Copyright (c) 2026 tintinweb
115
+ Licensed under the MIT License; its LICENSE file ships in the package
116
+ directory. Modified: the in-process sub-agent runs every tool through the
117
+ parent's own tool pipeline (approvals, sandbox, guard), stops early after
118
+ repeated tool failures and tells the parent, reports are capped in size and
119
+ their spend is recorded in the parent session once, DAL's run and
120
+ concurrency limits apply, worktree branches use DAL names; none of the
121
+ package's prompts are used.
122
+
123
+ The advisor tool (@dalcode/dal-advisor) adapts the design of:
124
+
125
+ @juicesharp/rpiv-advisor 2.13.8 (npm), Copyright (c) 2026 juicesharp
126
+ Licensed under the MIT License; its LICENSE file ships in the package
127
+ directory. Adapted: a zero-parameter tool the working model calls, the
128
+ conversation forwarded automatically, one tool-less model call with one
129
+ retry on an empty answer, the tool inventory shown to the reviewer.
130
+ Rewritten for DAL: the reviewer model is picked by DAL's router (a strong
131
+ model other than the current one), calls are capped per session, the
132
+ spend is recorded on the tool result, and none of the package's prompts
133
+ are used.
134
+
135
+ Tool-argument repair (@dalcode/dal-tool-catalog: src/repair.ts) follows the
136
+ ideas of tool-input-repair in pi-model-tools
137
+ (https://github.com/bacnh85/pi-extensions), by bacnh85: closing JSON cut off
138
+ after a complete value, unwrapping JSON sent as a string, and mapping other
139
+ agents' parameter names to the tool's own. No code was copied (that package
140
+ ships no license file); the implementation, rules and limits are DAL's own.
141
+
142
+ The spend cap (@dalcode/dal-usage: src/budget.ts) follows the idea of pi-budget
143
+ in the same repository (https://github.com/bacnh85/pi-extensions), by bacnh85:
144
+ a --budget flag that stops the agent once the session's cost reaches it, and
145
+ rejecting amounts that are not plain decimals. No code was copied (no license
146
+ file); DAL counts the session's own recorded spend (sub-agents, advisor,
147
+ lesson drafting included) and stops before the next request instead.
148
+
149
+ The lean-code rule (@dalcode/dal-workflow: src/lean-code.ts) adapts:
150
+
151
+ Ponytail (https://github.com/DietrichGebert/ponytail), at commit
152
+ 16352ac229eb08a9598dcae48fe9f2b342567d86
153
+ Copyright (c) 2026 DietrichGebert
154
+ Licensed under the MIT License; its LICENSE file ships in the package
155
+ directory. Adapted: the "smallest complete change"
156
+ ladder (reuse what the codebase has; no abstraction, option, config or
157
+ dependency nobody asked for; finish every place the change reaches) and the
158
+ "never cut" list (validation, error handling, security, accessibility),
159
+ condensed into one system-prompt rule. Ponytail's levels, commands and
160
+ wording are not used.
161
+
162
+ The MCP reconnect schedule (@dalcode/dal-mcp, src/index.ts) follows:
163
+
164
+ pi-mcp-extension 1.5.1 (npm), Copyright (c) 2026 irahardianto
165
+ Licensed under the MIT License. Adapted: the 1/3/5/10/30-second retry
166
+ schedule after a server drops, and refreshing a server's tools on
167
+ notifications/tools/list_changed; written against dal-mcp's own clients.
168
+
169
+ The /btw command (@dalcode/dal-interactive, src/btw.ts) is adapted from:
170
+
171
+ mitsupi 1.6.0, extensions/btw.ts (https://github.com/mitsuhiko/agent-stuff)
172
+ by Armin Ronacher
173
+ Licensed under the Apache License, Version 2.0; the license text ships in
174
+ that package's LICENSE file. Modified: one model call with no tools instead
175
+ of a side agent session, the answer shown as a notification, the fold-back
176
+ handed over verbatim and size-capped, its spend recorded in the session.
177
+
178
+ The debugger (@dalcode/dal-dap: src/client.ts, src/session.ts, src/types.ts)
179
+ adapts the Debug Adapter Protocol client of oh-my-pi:
180
+
181
+ oh-my-pi, packages/coding-agent/src/dap/ (https://github.com/can1357/oh-my-pi),
182
+ at commit eb74cf84d8e16ac9b8c4fa5d7c43037023d016ac
183
+ Copyright (c) 2025 Mario Zechner
184
+ Copyright (c) 2025-2026 Can Bölük
185
+ Copyright (c) 2026 Stencil Labs, Inc.
186
+ Licensed under the MIT License; its LICENSE file ships in the package
187
+ directory. Only that directory was used. Modified: Node child processes and
188
+ sockets instead of Bun's, stdio and TCP adapters only, launch only,
189
+ breakpoints bound before the program runs, the adapter table, tool, prompts
190
+ and installer are new.
191
+
192
+ The debug adapters it installs on first use are downloaded unmodified, each
193
+ pinned to one version and checked against its SHA-256:
194
+
195
+ debugpy 1.8.21 (https://github.com/microsoft/debugpy), Copyright (c)
196
+ Microsoft Corporation, MIT License; its LICENSE ships inside the package.
197
+ vscode-js-debug 1.140.0 (https://github.com/microsoft/vscode-js-debug),
198
+ Copyright (c) Microsoft Corporation, MIT License; its LICENSE ships inside
199
+ the downloaded archive.
200
+
201
+ The visual skills (@dalcode/dal-skills: src/bundled/web-design,
202
+ diagram-design, poster-design, print-design and the shared
203
+ src/bundled/visual-kit) and the chart and diagram styles of
204
+ @dalcode/dal-office use the following:
205
+
206
+ frontend-design skill (https://github.com/anthropics/skills,
207
+ skills/frontend-design), Copyright Anthropic, PBC, Licensed under the
208
+ Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0).
209
+ Parts of its design principles are adapted, rewritten in Chinese and
210
+ combined with DAL's own rules in web-design/SKILL.md.
211
+ Radix Colors 3.0.0 (https://github.com/radix-ui/colors), Copyright (c) 2021
212
+ Radix, MIT License: the slate, indigo, red, green and amber steps in
213
+ visual-kit/tokens.css.
214
+ shadcn/ui (https://github.com/shadcn-ui/ui), Copyright (c) 2023 shadcn,
215
+ MIT License: the semantic token naming in visual-kit/tokens.css follows it.
216
+ The "observable10" categorical colors, as published in d3-scale-chromatic
217
+ (https://github.com/d3/d3-scale-chromatic), Copyright 2010-2024 Mike
218
+ Bostock, ISC License, and used by Observable Plot: the colors in the
219
+ chart theme (dal-office src/render/chart-theme.ts, visual-kit
220
+ echarts-dal.json and the pages that embed it).
221
+ The terms of the MIT and ISC licenses are the same in substance as those in
222
+ the LICENSE file distributed with this package.
223
+
224
+ The page templates load these libraries at view time, unmodified, from a
225
+ pinned version on the npmmirror CDN with a subresource-integrity hash; they
226
+ are not redistributed in this package:
227
+
228
+ Mermaid 11.17.2 (https://github.com/mermaid-js/mermaid), MIT License.
229
+ markmap-lib / markmap-view 0.18.12 (https://github.com/markmap/markmap),
230
+ MIT License.
231
+ D3 7.9.0 (https://github.com/d3/d3), ISC License.
232
+ Apache ECharts 6.1.0 (https://github.com/apache/echarts), Apache License 2.0.
233
+
234
+ The office document styles (@dalcode/dal-office) contain no copied code or
235
+ template files. Their layout catalogue, content-driven layout selection and
236
+ type scale were written for DAL after studying these projects, which are
237
+ credited here:
238
+
239
+ presenton (https://github.com/presenton/presenton), Copyright 2025
240
+ presenton, Apache License 2.0 - layout grouping and content-to-layout
241
+ matching.
242
+ PPTAgent (https://github.com/icip-cas/PPTAgent), Copyright (c) 2025
243
+ ICIP-CAS, MIT License - layout selection by element count and text length.
244
+ ppt-master (https://github.com/hugohe3/ppt-master), Copyright (c) 2025-2026
245
+ Hugo He, MIT License - page-type catalogue (its brand and icon templates
246
+ were not used).
247
+ Slidev themes (https://github.com/slidevjs/themes), Copyright (c) 2021
248
+ Slidev.js Team, and Marp Core themes (https://github.com/marp-team/marp-core),
249
+ Copyright (c) 2018 Marp team, both MIT License - title/body type scale and
250
+ cover / section / statement / fact / quote page types.
251
+ anthropics/skills theme-factory, Copyright Anthropic, PBC, Apache License
252
+ 2.0 - the practice of pairing each palette with a heading/body font pair.
253
+ Okabe & Ito, "Color Universal Design" (2002), and IBM Carbon Design System
254
+ data-visualization palettes (https://github.com/carbon-design-system/carbon),
255
+ Copyright IBM Corp., Apache License 2.0 - ordering of categorical chart
256
+ colours for adjacent-hue contrast.
257
+ Chinese Copywriting Guidelines
258
+ (https://github.com/sparanoid/chinese-copywriting-guidelines), Copyright (c)
259
+ Tunghsiao Liu, MIT License, and W3C "Requirements for Chinese Text Layout"
260
+ (https://www.w3.org/TR/clreq/), W3C Document License - mixed Chinese/Latin
261
+ typesetting rules.
262
+ GB/T 9704-2012 "Layout key for official document of Party and government
263
+ organs" - the official-document page, type and numbering parameters follow
264
+ the standard's published format specification.
265
+
266
+ Design ideas, no code copied. The edit anchors in @dalcode/dal-guard
267
+ (src/edit-anchor.ts: an edit is checked against the file version the model
268
+ last read and refused when that place has changed since) follow the hashline
269
+ edits of oh-my-pi (same repository and commit as above, MIT License); the
270
+ recovery of failed edits (a copied read notice, indentation drift, the nearest
271
+ region shown) follows the edit repair of bacnh85/pi-extensions pi-model-tools,
272
+ whose package has no LICENSE file, so only its ideas were used.
273
+
50
274
  Third-party dependencies are installed from the public npm registry and carry
51
275
  their own licenses in their own package directories. A few that a vendored
52
276
  component needs at a version the rest of the package does not use ship inside
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Mario Zechner
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,64 @@
1
+ # Extension examples
2
+
3
+ Small, working extensions to copy from. Each file loads as is: try one with
4
+ `dal -e <file>`, or copy it to `~/.dal/agent/extensions/` (all projects) or
5
+ `.dal/extensions/` in a project, then `/reload`. The API is described in
6
+ [../../extensions.md](../../extensions.md). Each file's header lists what it
7
+ registers (`Registers:`).
8
+
9
+ When writing a new extension, start from the closest example below and keep
10
+ its structure: a default-exported function that receives `api: ExtensionAPI`.
11
+
12
+ ## Tools the model can call
13
+
14
+ | File | Shows |
15
+ | --- | --- |
16
+ | [hello.ts](hello.ts) | The smallest extension: one tool and one `/hello` command whose reply also prints under `dal -p` |
17
+ | [structured-output.ts](structured-output.ts) | A tool that ends the turn (`terminate: true`) with a structured answer and a custom result renderer |
18
+ | [truncated-tool.ts](truncated-tool.ts) | Truncating large tool output to the built-in limits and saving the full text to a file |
19
+ | [tool-override.ts](tool-override.ts) | Replacing a built-in tool (`read`) to log and block access, plus a `/read-log` command |
20
+ | [dynamic-tools.ts](dynamic-tools.ts) | Registering tools after startup, from `session_start` and from a command |
21
+
22
+ ## Commands
23
+
24
+ | File | Shows |
25
+ | --- | --- |
26
+ | [commands.ts](commands.ts) | Listing every slash command with `getCommands()`, argument completion, `ctx.ui.select` |
27
+ | [session-name.ts](session-name.ts) | Naming the session with `setSessionName` / `getSessionName` |
28
+ | [bookmark.ts](bookmark.ts) | Labelling conversation entries with `setLabel` for `/tree` |
29
+ | [trigger-compact.ts](trigger-compact.ts) | Compacting the context from a command or once usage crosses a threshold |
30
+
31
+ ## Safety gates (event hooks)
32
+
33
+ | File | Shows |
34
+ | --- | --- |
35
+ | [permission-gate.ts](permission-gate.ts) | Asking before risky bash commands in `tool_call`, blocking when there is no UI |
36
+ | [protected-paths.ts](protected-paths.ts) | Blocking writes and edits to protected paths |
37
+ | [dirty-repo-guard.ts](dirty-repo-guard.ts) | Cancelling a session switch or fork while git has uncommitted changes |
38
+
39
+ ## Prompt and input
40
+
41
+ | File | Shows |
42
+ | --- | --- |
43
+ | [claude-rules.ts](claude-rules.ts) | Listing `.claude/rules/*.md` in the system prompt from `before_agent_start` |
44
+ | [inline-bash.ts](inline-bash.ts) | Expanding `!{command}` in the user's message in the `input` event |
45
+
46
+ ## Terminal UI
47
+
48
+ | File | Shows |
49
+ | --- | --- |
50
+ | [status-line.ts](status-line.ts) | Persistent footer status text with `ctx.ui.setStatus` |
51
+ | [custom-footer.ts](custom-footer.ts) | Replacing the footer with `ctx.ui.setFooter` (token totals, git branch) |
52
+
53
+ ## Notes
54
+
55
+ - `ctx.hasUI` is false under `dal -p` and in the desktop backend: check it
56
+ before `ctx.ui.select` / `confirm`, and block (rather than allow) when a
57
+ safety decision cannot be asked.
58
+ - `ctx.ui.notify` shows nothing under `dal -p`; a command that must answer
59
+ there sends a displayed message (see `hello.ts`).
60
+ - Imports keep the engine's package names (`@earendil-works/pi-coding-agent`
61
+ and friends); they are resolved to DAL's own implementation at load time.
62
+
63
+ These examples are adapted from the example extensions of the MIT-licensed
64
+ open-source engine DAL is built on (copyright notice in [LICENSE](LICENSE)).
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Entry bookmarking example.
3
+ *
4
+ * Shows setLabel to mark entries with labels for easy navigation in /tree.
5
+ * Labels appear in the tree view and help you find important points.
6
+ *
7
+ * Usage: /bookmark [label] - bookmark the last assistant message
8
+ *
9
+ * Registers: commands bookmark, unbookmark
10
+ */
11
+
12
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
13
+
14
+ export default function (api: ExtensionAPI) {
15
+ api.registerCommand("bookmark", {
16
+ description: "Bookmark last message (usage: /bookmark [label])",
17
+ handler: async (args, ctx) => {
18
+ const label = args.trim() || `bookmark-${Date.now()}`;
19
+
20
+ // Find the last assistant message entry
21
+ const entries = ctx.sessionManager.getEntries();
22
+ for (let i = entries.length - 1; i >= 0; i--) {
23
+ const entry = entries[i];
24
+ if (entry.type === "message" && entry.message.role === "assistant") {
25
+ api.setLabel(entry.id, label);
26
+ ctx.ui.notify(`Bookmarked as: ${label}`, "info");
27
+ return;
28
+ }
29
+ }
30
+
31
+ ctx.ui.notify("No assistant message to bookmark", "warning");
32
+ },
33
+ });
34
+
35
+ // Remove bookmark
36
+ api.registerCommand("unbookmark", {
37
+ description: "Remove bookmark from last labeled entry",
38
+ handler: async (_args, ctx) => {
39
+ const entries = ctx.sessionManager.getEntries();
40
+ for (let i = entries.length - 1; i >= 0; i--) {
41
+ const entry = entries[i];
42
+ const label = ctx.sessionManager.getLabel(entry.id);
43
+ if (label) {
44
+ api.setLabel(entry.id, undefined);
45
+ ctx.ui.notify(`Removed bookmark: ${label}`, "info");
46
+ return;
47
+ }
48
+ }
49
+ ctx.ui.notify("No bookmarked entry found", "warning");
50
+ },
51
+ });
52
+ }
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Claude Rules Extension
3
+ *
4
+ * Scans the project's .claude/rules/ folder for rule files and lists them
5
+ * in the system prompt. The agent can then use the read tool to load
6
+ * specific rules when needed.
7
+ *
8
+ * Best practices for .claude/rules/:
9
+ * - Keep rules focused: Each file should cover one topic (e.g., testing.md, api-design.md)
10
+ * - Use descriptive filenames: The filename should indicate what the rules cover
11
+ * - Use conditional rules sparingly: Only add paths frontmatter when rules truly apply to specific file types
12
+ * - Organize with subdirectories: Group related rules (e.g., frontend/, backend/)
13
+ *
14
+ * Usage:
15
+ * 1. Copy this file to ~/.dal/agent/extensions/ or your project's .dal/extensions/
16
+ * 2. Create .claude/rules/ folder in your project root
17
+ * 3. Add .md files with your rules
18
+ *
19
+ * Registers: events before_agent_start, session_start
20
+ */
21
+
22
+ import * as fs from "node:fs";
23
+ import * as path from "node:path";
24
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
25
+
26
+ /**
27
+ * Recursively find all .md files in a directory
28
+ */
29
+ function findMarkdownFiles(dir: string, basePath: string = ""): string[] {
30
+ const results: string[] = [];
31
+
32
+ if (!fs.existsSync(dir)) {
33
+ return results;
34
+ }
35
+
36
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
37
+
38
+ for (const entry of entries) {
39
+ const relativePath = basePath ? `${basePath}/${entry.name}` : entry.name;
40
+
41
+ if (entry.isDirectory()) {
42
+ results.push(...findMarkdownFiles(path.join(dir, entry.name), relativePath));
43
+ } else if (entry.isFile() && entry.name.endsWith(".md")) {
44
+ results.push(relativePath);
45
+ }
46
+ }
47
+
48
+ return results;
49
+ }
50
+
51
+ export default function claudeRulesExtension(api: ExtensionAPI) {
52
+ let ruleFiles: string[] = [];
53
+ let rulesDir: string = "";
54
+
55
+ // Scan for rules on session start
56
+ api.on("session_start", async (_event, ctx) => {
57
+ rulesDir = path.join(ctx.cwd, ".claude", "rules");
58
+ ruleFiles = findMarkdownFiles(rulesDir);
59
+
60
+ if (ruleFiles.length > 0) {
61
+ ctx.ui.notify(`Found ${ruleFiles.length} rule(s) in .claude/rules/`, "info");
62
+ }
63
+ });
64
+
65
+ // Append available rules to system prompt
66
+ api.on("before_agent_start", async (event) => {
67
+ if (ruleFiles.length === 0) {
68
+ return;
69
+ }
70
+
71
+ const rulesList = ruleFiles.map((f) => `- .claude/rules/${f}`).join("\n");
72
+
73
+ return {
74
+ systemPrompt:
75
+ event.systemPrompt +
76
+ `
77
+
78
+ ## Project Rules
79
+
80
+ The following project rules are available in .claude/rules/:
81
+
82
+ ${rulesList}
83
+
84
+ When working on tasks related to these rules, use the read tool to load the relevant rule files for guidance.
85
+ `,
86
+ };
87
+ });
88
+ }