dal-code 1.0.39 → 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 (305) hide show
  1. package/CHANGELOG.md +82 -4
  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/dist/cli/args.d.ts +3 -0
  23. package/dist/cli/args.js +17 -17
  24. package/dist/config.d.ts +1 -0
  25. package/dist/config.js +1 -1
  26. package/dist/core/agent-session.js +6 -6
  27. package/dist/core/extensions/loader.js +1 -1
  28. package/dist/core/extensions/permission-surface.js +1 -1
  29. package/dist/core/extensions/runner.js +1 -1
  30. package/dist/core/extensions/types.d.ts +15 -1
  31. package/dist/core/model-registry.d.ts +1 -0
  32. package/dist/core/model-registry.js +1 -1
  33. package/dist/core/nested-tool-calls.js +2 -2
  34. package/dist/core/resource-loader.js +1 -1
  35. package/dist/core/system-prompt.js +10 -9
  36. package/dist/core/tools/bash.js +13 -12
  37. package/dist/core/tools/path-utils.d.ts +5 -0
  38. package/dist/core/tools/process.d.ts +2 -0
  39. package/dist/core/tools/process.js +14 -13
  40. package/dist/dal/extension-compat.d.ts +62 -0
  41. package/dist/dal/extension-compat.js +4 -0
  42. package/dist/dal/hooks/extension.js +2 -2
  43. package/dist/dal/i18n.js +1 -1
  44. package/dist/dal/manifest.js +1 -1
  45. package/dist/dal/reviewed/endorsed-cli.js +1 -1
  46. package/dist/dal/reviewed/endorsed.js +1 -1
  47. package/dist/dal/reviewed/market-keys.js +1 -0
  48. package/dist/dal/reviewed/market.d.ts +64 -0
  49. package/dist/dal/reviewed/market.js +2 -0
  50. package/dist/extensions/mcp/runtime.d.ts +2 -1
  51. package/dist/extensions/mcp/runtime.js +3 -3
  52. package/dist/extensions/mcp/runtime.lazy.d.ts +1 -0
  53. package/dist/index.d.ts +7 -1
  54. package/dist/index.js +1 -1
  55. package/dist/main.js +4 -4
  56. package/dist/modes/acp/acp-mode.js +1 -1
  57. package/dist/modes/interactive/interactive-mode.d.ts +1 -0
  58. package/dist/modes/interactive/interactive-mode.js +14 -14
  59. package/dist/modes/print-mode.js +3 -3
  60. package/dist/modes/rpc/rpc-mode.js +1 -1
  61. package/dist/node_modules/@dalcode/dal-advisor/LICENSE +45 -0
  62. package/dist/node_modules/@dalcode/dal-advisor/package.json +35 -0
  63. package/dist/node_modules/@dalcode/dal-advisor/src/index.js +22 -0
  64. package/dist/node_modules/@dalcode/dal-bridge/package.json +2 -2
  65. package/dist/node_modules/@dalcode/dal-bridge/src/ask-user.js +1 -1
  66. package/dist/node_modules/@dalcode/dal-capabilities/LICENSE +21 -0
  67. package/dist/node_modules/@dalcode/dal-capabilities/package.json +38 -0
  68. package/dist/node_modules/@dalcode/dal-capabilities/src/catalogue.js +1 -0
  69. package/dist/node_modules/@dalcode/dal-capabilities/src/index.js +11 -0
  70. package/dist/node_modules/@dalcode/dal-capabilities/src/install.js +4 -0
  71. package/dist/node_modules/@dalcode/dal-capabilities/src/match.js +1 -0
  72. package/dist/node_modules/@dalcode/dal-capabilities/src/state.js +3 -0
  73. package/dist/node_modules/@dalcode/dal-compat/LICENSE +21 -0
  74. package/dist/node_modules/@dalcode/dal-compat/package.json +32 -0
  75. package/dist/node_modules/@dalcode/dal-compat/src/claude-rules.js +3 -0
  76. package/dist/node_modules/@dalcode/dal-compat/src/index.js +7 -0
  77. package/dist/node_modules/@dalcode/dal-dap/LICENSE +47 -0
  78. package/dist/node_modules/@dalcode/dal-dap/package.json +38 -0
  79. package/dist/node_modules/@dalcode/dal-dap/src/adapters.js +1 -0
  80. package/dist/node_modules/@dalcode/dal-dap/src/client.js +5 -0
  81. package/dist/node_modules/@dalcode/dal-dap/src/index.js +9 -0
  82. package/dist/node_modules/@dalcode/dal-dap/src/install.js +2 -0
  83. package/dist/node_modules/@dalcode/dal-dap/src/session.js +2 -0
  84. package/dist/node_modules/@dalcode/dal-dap/src/types.js +0 -0
  85. package/dist/node_modules/@dalcode/dal-gateway/package.json +2 -2
  86. package/dist/node_modules/@dalcode/dal-goal/package.json +4 -3
  87. package/dist/node_modules/@dalcode/dal-goal/src/core.js +6 -6
  88. package/dist/node_modules/@dalcode/dal-goal/src/index.js +17 -7
  89. package/dist/node_modules/@dalcode/dal-goal/src/verify.js +26 -0
  90. package/dist/node_modules/@dalcode/dal-guard/package.json +6 -4
  91. package/dist/node_modules/@dalcode/dal-guard/src/credentials.js +1 -1
  92. package/dist/node_modules/@dalcode/dal-guard/src/edit-anchor-core.js +23 -0
  93. package/dist/node_modules/@dalcode/dal-guard/src/edit-anchor.js +4 -0
  94. package/dist/node_modules/@dalcode/dal-guard/src/index.js +1 -1
  95. package/dist/node_modules/@dalcode/dal-guard/src/workspace.js +2 -2
  96. package/dist/node_modules/@dalcode/dal-halo/package.json +1 -1
  97. package/dist/node_modules/@dalcode/dal-interactive/LICENSE +209 -0
  98. package/dist/node_modules/@dalcode/dal-interactive/package.json +4 -3
  99. package/dist/node_modules/@dalcode/dal-interactive/src/btw.js +25 -0
  100. package/dist/node_modules/@dalcode/dal-interactive/src/index.js +1 -1
  101. package/dist/node_modules/@dalcode/dal-lang/package.json +3 -3
  102. package/dist/node_modules/@dalcode/dal-learn/LICENSE +21 -0
  103. package/dist/node_modules/@dalcode/dal-learn/package.json +35 -0
  104. package/dist/node_modules/@dalcode/dal-learn/src/engine.js +8 -0
  105. package/dist/node_modules/@dalcode/dal-learn/src/extract.js +14 -0
  106. package/dist/node_modules/@dalcode/dal-learn/src/index.js +17 -0
  107. package/dist/node_modules/@dalcode/dal-learn/src/lessons.js +3 -0
  108. package/dist/node_modules/@dalcode/dal-learn/src/migrate.js +1 -0
  109. package/dist/node_modules/@dalcode/dal-learn/src/procedures.js +11 -0
  110. package/dist/node_modules/@dalcode/dal-learn/src/project-map.js +2 -0
  111. package/dist/node_modules/@dalcode/dal-learn/src/project.js +1 -0
  112. package/dist/node_modules/@dalcode/dal-learn/src/safety.js +2 -0
  113. package/dist/node_modules/@dalcode/dal-learn/src/signals.js +5 -0
  114. package/dist/node_modules/@dalcode/dal-learn/src/skill-actions.js +1 -0
  115. package/dist/node_modules/@dalcode/dal-learn/src/skill-evolution.js +16 -0
  116. package/dist/node_modules/@dalcode/dal-learn/src/store.js +2 -0
  117. package/dist/node_modules/@dalcode/dal-lsp/package.json +6 -4
  118. package/dist/node_modules/@dalcode/dal-lsp/src/client.js +3 -3
  119. package/dist/node_modules/@dalcode/dal-lsp/src/config.js +1 -1
  120. package/dist/node_modules/@dalcode/dal-lsp/src/format.js +8 -7
  121. package/dist/node_modules/@dalcode/dal-lsp/src/index.js +11 -8
  122. package/dist/node_modules/@dalcode/dal-mcp/package.json +6 -5
  123. package/dist/node_modules/@dalcode/dal-mcp/src/config.d.ts +1 -0
  124. package/dist/node_modules/@dalcode/dal-mcp/src/config.js +1 -1
  125. package/dist/node_modules/@dalcode/dal-mcp/src/http-client.d.ts +32 -1
  126. package/dist/node_modules/@dalcode/dal-mcp/src/http-client.js +2 -1
  127. package/dist/node_modules/@dalcode/dal-mcp/src/index.js +16 -16
  128. package/dist/node_modules/@dalcode/dal-mcp/src/oauth.js +2 -0
  129. package/dist/node_modules/@dalcode/dal-mcp/src/stdio-client.d.ts +4 -2
  130. package/dist/node_modules/@dalcode/dal-mcp/src/stdio-client.js +4 -4
  131. package/dist/node_modules/@dalcode/dal-mcp/src/types.d.ts +9 -0
  132. package/dist/node_modules/@dalcode/dal-mcp/src/types.js +1 -1
  133. package/dist/node_modules/@dalcode/dal-office/package.json +2 -2
  134. package/dist/node_modules/@dalcode/dal-office/src/index.d.ts +6 -3
  135. package/dist/node_modules/@dalcode/dal-office/src/index.js +1 -1
  136. package/dist/node_modules/@dalcode/dal-office/src/render/chart-theme.d.ts +13 -0
  137. package/dist/node_modules/@dalcode/dal-office/src/render/chart-theme.js +1 -0
  138. package/dist/node_modules/@dalcode/dal-office/src/render/chart.d.ts +16 -0
  139. package/dist/node_modules/@dalcode/dal-office/src/render/chart.js +4 -2
  140. package/dist/node_modules/@dalcode/dal-office/src/render/docx.d.ts +4 -1
  141. package/dist/node_modules/@dalcode/dal-office/src/render/docx.js +1 -1
  142. package/dist/node_modules/@dalcode/dal-office/src/render/drawio-style.d.ts +4 -0
  143. package/dist/node_modules/@dalcode/dal-office/src/render/drawio-style.js +1 -0
  144. package/dist/node_modules/@dalcode/dal-office/src/render/pptx.d.ts +52 -4
  145. package/dist/node_modules/@dalcode/dal-office/src/render/pptx.js +3 -2
  146. package/dist/node_modules/@dalcode/dal-office/src/render/thumbnails.d.ts +1 -1
  147. package/dist/node_modules/@dalcode/dal-office/src/render/thumbnails.js +1 -1
  148. package/dist/node_modules/@dalcode/dal-office/src/render/xlsx.d.ts +1 -0
  149. package/dist/node_modules/@dalcode/dal-office/src/render/xlsx.js +1 -1
  150. package/dist/node_modules/@dalcode/dal-office/src/scratchpad.d.ts +30 -1
  151. package/dist/node_modules/@dalcode/dal-office/src/scratchpad.js +1 -1
  152. package/dist/node_modules/@dalcode/dal-office/src/themes.d.ts +35 -1
  153. package/dist/node_modules/@dalcode/dal-office/src/themes.js +1 -1
  154. package/dist/node_modules/@dalcode/dal-office/src/tools/chart-generate.js +3 -3
  155. package/dist/node_modules/@dalcode/dal-office/src/tools/doc-generate.js +2 -2
  156. package/dist/node_modules/@dalcode/dal-office/src/tools/drawio-generate.js +3 -3
  157. package/dist/node_modules/@dalcode/dal-office/src/tools/ppt-generate.js +2 -2
  158. package/dist/node_modules/@dalcode/dal-office/src/tools/ppt-plan.js +2 -2
  159. package/dist/node_modules/@dalcode/dal-office/src/tools/sheet-generate.js +2 -2
  160. package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +4 -4
  161. package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
  162. package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.js +4 -4
  163. package/dist/node_modules/@dalcode/dal-plugins/package.json +4 -5
  164. package/dist/node_modules/@dalcode/dal-plugins/src/index.js +11 -11
  165. package/dist/node_modules/@dalcode/dal-plugins/src/manage.js +8 -10
  166. package/dist/node_modules/@dalcode/dal-plugins/src/npm-hook.js +1 -1
  167. package/dist/node_modules/@dalcode/dal-plugins/src/registry.js +2 -2
  168. package/dist/node_modules/@dalcode/dal-recall/LICENSE +45 -0
  169. package/dist/node_modules/@dalcode/dal-recall/package.json +34 -0
  170. package/dist/node_modules/@dalcode/dal-recall/src/index-db.js +57 -0
  171. package/dist/node_modules/@dalcode/dal-recall/src/index.js +1 -0
  172. package/dist/node_modules/@dalcode/dal-recall/src/query.js +1 -0
  173. package/dist/node_modules/@dalcode/dal-recall/src/redact.js +1 -0
  174. package/dist/node_modules/@dalcode/dal-recall/src/sqlite.js +1 -0
  175. package/dist/node_modules/@dalcode/dal-review/package.json +3 -3
  176. package/dist/node_modules/@dalcode/dal-rewind/package.json +2 -2
  177. package/dist/node_modules/@dalcode/dal-rewind/src/commands.js +2 -2
  178. package/dist/node_modules/@dalcode/dal-rewind/src/core.d.ts +21 -8
  179. package/dist/node_modules/@dalcode/dal-rewind/src/core.js +8 -3
  180. package/dist/node_modules/@dalcode/dal-rewind/src/index.js +1 -1
  181. package/dist/node_modules/@dalcode/dal-rewind/src/state.js +1 -1
  182. package/dist/node_modules/@dalcode/dal-router/package.json +6 -5
  183. package/dist/node_modules/@dalcode/dal-router/src/advisor.js +1 -0
  184. package/dist/node_modules/@dalcode/dal-router/src/assist.js +4 -2
  185. package/dist/node_modules/@dalcode/dal-router/src/commands.js +8 -8
  186. package/dist/node_modules/@dalcode/dal-router/src/config.d.ts +3 -0
  187. package/dist/node_modules/@dalcode/dal-router/src/config.js +2 -2
  188. package/dist/node_modules/@dalcode/dal-router/src/index.js +4 -4
  189. package/dist/node_modules/@dalcode/dal-router/src/jev.d.ts +2 -1
  190. package/dist/node_modules/@dalcode/dal-router/src/jev.js +4 -4
  191. package/dist/node_modules/@dalcode/dal-router/src/services.js +1 -1
  192. package/dist/node_modules/@dalcode/dal-router/src/subagent.js +1 -1
  193. package/dist/node_modules/@dalcode/dal-skills/package.json +4 -3
  194. package/dist/node_modules/@dalcode/dal-skills/src/bundled/browser-qa/SKILL.md +48 -0
  195. package/dist/node_modules/@dalcode/dal-skills/src/bundled/diagram-design/SKILL.md +81 -0
  196. package/dist/node_modules/@dalcode/dal-skills/src/bundled/poster-design/SKILL.md +50 -0
  197. package/dist/node_modules/@dalcode/dal-skills/src/bundled/print-design/SKILL.md +55 -0
  198. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/dashboard.html +177 -0
  199. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/diagram.html +39 -0
  200. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/echarts-dal.json +360 -0
  201. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/email/notice.html +46 -0
  202. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/landing.html +173 -0
  203. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/mermaid-dal.json +140 -0
  204. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/mindmap.html +65 -0
  205. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/posters/event-poster.html +40 -0
  206. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/posters/poster.css +41 -0
  207. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/posters/square-card.html +25 -0
  208. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/posters/wechat-cover.html +29 -0
  209. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/posters/xhs-card.html +35 -0
  210. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/posters/xhs-cover.html +26 -0
  211. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/print/letter.html +35 -0
  212. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/print/print.css +65 -0
  213. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/print/report.html +76 -0
  214. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/print/resume.html +72 -0
  215. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/render.mjs +18 -0
  216. package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/tokens.css +264 -0
  217. package/dist/node_modules/@dalcode/dal-skills/src/bundled/web-design/SKILL.md +73 -0
  218. package/dist/node_modules/@dalcode/dal-skills/src/bundled.js +1 -0
  219. package/dist/node_modules/@dalcode/dal-skills/src/catalog.js +2 -2
  220. package/dist/node_modules/@dalcode/dal-skills/src/index.js +16 -11
  221. package/dist/node_modules/@dalcode/dal-statusline/LICENSE +21 -0
  222. package/dist/node_modules/@dalcode/dal-statusline/package.json +31 -0
  223. package/dist/node_modules/@dalcode/dal-statusline/src/index.js +3 -0
  224. package/dist/node_modules/@dalcode/dal-structured/LICENSE +21 -0
  225. package/dist/node_modules/@dalcode/dal-structured/package.json +32 -0
  226. package/dist/node_modules/@dalcode/dal-structured/src/index.js +9 -0
  227. package/dist/node_modules/@dalcode/dal-subagent/LICENSE +24 -0
  228. package/dist/node_modules/@dalcode/dal-subagent/package.json +7 -6
  229. package/dist/node_modules/@dalcode/dal-subagent/src/background.js +13 -0
  230. package/dist/node_modules/@dalcode/dal-subagent/src/index.js +22 -14
  231. package/dist/node_modules/@dalcode/dal-subagent/src/inproc-runner.js +3 -0
  232. package/dist/node_modules/@dalcode/dal-subagent/src/pool.js +1 -0
  233. package/dist/node_modules/@dalcode/dal-subagent/src/process-runner.js +3 -3
  234. package/dist/node_modules/@dalcode/dal-subagent/src/tmux-runner.js +3 -0
  235. package/dist/node_modules/@dalcode/dal-subagent/src/worktree.js +2 -0
  236. package/dist/node_modules/@dalcode/dal-telemetry/package.json +2 -2
  237. package/dist/node_modules/@dalcode/dal-terminal/package.json +2 -2
  238. package/dist/node_modules/@dalcode/dal-tool-catalog/package.json +2 -2
  239. package/dist/node_modules/@dalcode/dal-tool-catalog/src/groups.js +1 -1
  240. package/dist/node_modules/@dalcode/dal-tool-catalog/src/index.js +4 -4
  241. package/dist/node_modules/@dalcode/dal-tool-catalog/src/repair-hook.js +1 -0
  242. package/dist/node_modules/@dalcode/dal-tool-catalog/src/repair.js +4 -0
  243. package/dist/node_modules/@dalcode/dal-usage/LICENSE +45 -0
  244. package/dist/node_modules/@dalcode/dal-usage/package.json +33 -0
  245. package/dist/node_modules/@dalcode/dal-usage/src/budget.d.ts +14 -0
  246. package/dist/node_modules/@dalcode/dal-usage/src/budget.js +3 -0
  247. package/dist/node_modules/@dalcode/dal-usage/src/data.d.ts +30 -0
  248. package/dist/node_modules/@dalcode/dal-usage/src/data.js +1 -0
  249. package/dist/node_modules/@dalcode/dal-usage/src/index.d.ts +12 -0
  250. package/dist/node_modules/@dalcode/dal-usage/src/index.js +2 -0
  251. package/dist/node_modules/@dalcode/dal-usage/src/report.d.ts +29 -0
  252. package/dist/node_modules/@dalcode/dal-usage/src/report.js +3 -0
  253. package/dist/node_modules/@dalcode/dal-web/package.json +6 -4
  254. package/dist/node_modules/@dalcode/dal-web/src/fetch.js +11 -5
  255. package/dist/node_modules/@dalcode/dal-web/src/index.js +2 -2
  256. package/dist/node_modules/@dalcode/dal-web/src/pdf.js +5 -0
  257. package/dist/node_modules/@dalcode/dal-workflow/LICENSE +24 -0
  258. package/dist/node_modules/@dalcode/dal-workflow/package.json +2 -2
  259. package/dist/node_modules/@dalcode/dal-workflow/src/announce-check.js +1 -0
  260. package/dist/node_modules/@dalcode/dal-workflow/src/check-in.js +1 -1
  261. package/dist/node_modules/@dalcode/dal-workflow/src/completion-check.js +2 -2
  262. package/dist/node_modules/@dalcode/dal-workflow/src/index.js +4 -4
  263. package/dist/node_modules/@dalcode/dal-workflow/src/lean-code.js +1 -0
  264. package/dist/node_modules/@dalcode/dal-workflow/src/ledger.js +3 -3
  265. package/dist/node_modules/@dalcode/dal-workflow/src/loop-guard.js +3 -0
  266. package/dist/node_modules/@dalcode/dal-workflow/src/shared.js +2 -2
  267. package/dist/node_modules/@dalcode/dal-workflow/src/todo.js +4 -2
  268. package/dist/node_modules/@dalcode/dal-workflow/src/verify-check.js +2 -0
  269. package/dist/node_modules/@dalcode/deepailab/package.json +3 -3
  270. package/dist/node_modules/@earendil-works/chord/package.json +1 -1
  271. package/dist/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
  272. package/dist/node_modules/@earendil-works/pi-ai/dist/cli.js +0 -0
  273. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  274. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
  275. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  276. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/radius.json +1 -1
  277. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  278. package/dist/node_modules/@earendil-works/pi-ai/package.json +2 -2
  279. package/dist/node_modules/@earendil-works/pi-client/package.json +3 -3
  280. package/dist/node_modules/@earendil-works/pi-codemode/package.json +1 -1
  281. package/dist/node_modules/@earendil-works/pi-coding-agent/package.json +1 -1
  282. package/dist/node_modules/@earendil-works/pi-mcp/package.json +1 -1
  283. package/dist/node_modules/@earendil-works/pi-protocol/package.json +2 -2
  284. package/dist/node_modules/@earendil-works/pi-server/package.json +3 -3
  285. package/dist/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  286. package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
  287. package/dist/package-manager-cli.js +61 -61
  288. package/dist/sdk/office.d.ts +1 -1
  289. package/dist/sdk/office.js +1 -1
  290. package/dist/sdk/rewind.d.ts +1 -1
  291. package/dist/sdk/rewind.js +1 -1
  292. package/dist/sdk/usage.d.ts +8 -0
  293. package/dist/sdk/usage.js +1 -0
  294. package/dist/utils/open-browser.d.ts +1 -0
  295. package/dist/utils/tools-manager.js +1 -1
  296. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  297. package/examples/extensions/gondolin/package-lock.json +2 -2
  298. package/examples/extensions/gondolin/package.json +1 -1
  299. package/examples/extensions/sandbox/package-lock.json +2 -2
  300. package/examples/extensions/sandbox/package.json +1 -1
  301. package/examples/extensions/with-deps/package-lock.json +2 -2
  302. package/examples/extensions/with-deps/package.json +1 -1
  303. package/npm-shrinkwrap.json +57 -14
  304. package/package.json +9 -2
  305. package/dist/node_modules/@dalcode/dal-plugins/src/compat.js +0 -2
@@ -0,0 +1,72 @@
1
+ <!doctype html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>林舟 - 产品经理</title>
6
+ <!--
7
+ DAL resume (one A4 page). Name and contact on top, then experience with
8
+ results in numbers, projects, education, skills. Keep it to one page:
9
+ render.mjs prints the page count; anything but 1 means cut content.
10
+ Export: node ../render.mjs resume.html resume.pdf
11
+ -->
12
+ <link rel="stylesheet" href="print.css">
13
+ <style>
14
+ @page { margin: 16mm 18mm; @bottom-center { content: none; } }
15
+ @media screen { body { padding: 16mm 18mm; } }
16
+ body { font-size: 10pt; line-height: 1.6; }
17
+ .head { display: flex; justify-content: space-between; align-items: flex-end; padding-bottom: 10pt; border-bottom: 2px solid var(--ink); }
18
+ .head h1 { font-size: 22pt; }
19
+ .head .role { margin-top: 2pt; font-size: 11pt; color: var(--muted); }
20
+ .contact { text-align: right; font-size: 9pt; color: var(--muted); line-height: 1.7; }
21
+ h2 { font-size: 11pt; margin: 14pt 0 6pt; padding: 0; border: 0; color: var(--accent); }
22
+ .item { display: grid; grid-template-columns: 1fr auto; column-gap: 12pt; margin-bottom: 9pt; break-inside: avoid; }
23
+ .item h3 { margin: 0; font-size: 10.5pt; }
24
+ .item .when { font-size: 9pt; color: var(--muted); font-variant-numeric: tabular-nums; }
25
+ .item .sub { grid-column: 1 / -1; font-size: 9.5pt; color: var(--muted); }
26
+ .item ul { grid-column: 1 / -1; margin: 3pt 0 0; }
27
+ .skills { display: grid; grid-template-columns: 5em 1fr; gap: 3pt 10pt; font-size: 9.5pt; }
28
+ .skills dt { color: var(--muted); }
29
+ .skills dd { margin: 0; }
30
+ </style>
31
+ </head>
32
+ <body>
33
+ <header class="head">
34
+ <div><h1>林舟</h1><div class="role">高级产品经理 · 8 年 SaaS 产品经验</div></div>
35
+ <div class="contact">138 0000 0000<br>linzhou@example.com<br>杭州</div>
36
+ </header>
37
+
38
+ <h2>工作经历</h2>
39
+ <div class="item">
40
+ <h3>青账科技 · 高级产品经理</h3><span class="when">2022.03 – 至今</span>
41
+ <div class="sub">负责报销与费控产品线,带 3 名产品经理</div>
42
+ <ul>
43
+ <li>主导发票识别功能上线,单据处理时长从 2 天降到 4 小时,付费转化率提升 18%。</li>
44
+ <li>设计审批规则引擎,支撑 1,200 家企业客户的自定义流程,相关工单减少 60%。</li>
45
+ </ul>
46
+ </div>
47
+ <div class="item">
48
+ <h3>某电商平台 · 产品经理</h3><span class="when">2018.07 – 2022.02</span>
49
+ <div class="sub">商家后台与数据产品</div>
50
+ <ul>
51
+ <li>重做商家数据看板,日活商家从 3 万增至 9 万。</li>
52
+ <li>推动订单导出改造,导出失败率从 7% 降到 0.3%。</li>
53
+ </ul>
54
+ </div>
55
+
56
+ <h2>项目</h2>
57
+ <div class="item">
58
+ <h3>费控 2.0 改版</h3><span class="when">2024</span>
59
+ <ul><li>从 40 家客户访谈中提炼 6 类审批场景,三个月完成改版,续费率提升 9 个百分点。</li></ul>
60
+ </div>
61
+
62
+ <h2>教育</h2>
63
+ <div class="item"><h3>浙江大学 · 信息管理与信息系统 · 本科</h3><span class="when">2014 – 2018</span></div>
64
+
65
+ <h2>技能</h2>
66
+ <dl class="skills">
67
+ <dt>产品</dt><dd>需求分析、B 端流程设计、数据指标体系、A/B 实验</dd>
68
+ <dt>工具</dt><dd>SQL、Figma、Axure、飞书多维表格</dd>
69
+ <dt>语言</dt><dd>英语 CET-6,可作为工作语言</dd>
70
+ </dl>
71
+ </body>
72
+ </html>
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ var S=Object.defineProperty;var d=(e,t)=>S(e,"name",{value:t,configurable:!0});import{spawn as A}from"node:child_process";import{existsSync as u,mkdtempSync as b,readdirSync as C,readFileSync as x,rmSync as k,writeFileSync as $}from"node:fs";import{homedir as M,platform as P,tmpdir as D}from"node:os";import{extname as L,join as c,resolve as v}from"node:path";import{pathToFileURL as R}from"node:url";function F(e){const t={width:1200,height:800,scale:2,full:!1,dark:!1,timeout:2e4},s=[];for(let r=0;r<e.length;r++){const o=e[r];if(o==="--full")t.full=!0;else if(o==="--dark")t.dark=!0;else if(["--width","--height","--scale","--timeout"].includes(o)){const n=Number(e[++r]);if(!Number.isFinite(n)||n<=0)throw new Error(`${o} \u9700\u8981\u6B63\u6570`);t[o.slice(2)]=n}else{if(o.startsWith("--"))throw new Error(`\u672A\u77E5\u53C2\u6570 ${o}`);s.push(o)}}if(s.length!==2)throw new Error("\u7528\u6CD5\uFF1Anode render.mjs <page.html> <out.png|out.pdf> [--width N] [--height N] [--scale N] [--full] [--dark]");return{input:v(s[0]),output:v(s[1]),...t}}d(F,"parseArgs");function H(){const e=M(),t=[];process.env.DAL_CHROME&&t.push(process.env.DAL_CHROME);const s=P();if(s==="darwin")t.push("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome","/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge","/Applications/Chromium.app/Contents/MacOS/Chromium",c(e,"Applications/Google Chrome.app/Contents/MacOS/Google Chrome"));else if(s==="win32")for(const o of[process.env.PROGRAMFILES,process.env["PROGRAMFILES(X86)"],process.env.LOCALAPPDATA])o&&t.push(c(o,"Google/Chrome/Application/chrome.exe"),c(o,"Microsoft/Edge/Application/msedge.exe"));else for(const o of(process.env.PATH??"").split(":"))for(const n of["google-chrome","google-chrome-stable","chromium","chromium-browser","microsoft-edge"])t.push(c(o,n));const r=c(e,".agent-browser","browsers");if(u(r))for(const o of C(r).sort().reverse()){for(const n of["chrome-mac-arm64","chrome-mac-x64"])t.push(c(r,o,n,"Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing"));t.push(c(r,o,"chrome-linux64","chrome"),c(r,o,"chrome-win64","chrome.exe"))}return t}d(H,"chromeCandidates");function O(){return H().find(e=>e&&u(e))}d(O,"findChrome");async function y(e,t,s){const r=Date.now()+t;for(;Date.now()<r;){const o=e();if(o)return o;await new Promise(n=>setTimeout(n,100))}throw new Error(`\u7B49\u5F85${s}\u8D85\u65F6`)}d(y,"waitFor");class T{static{d(this,"Cdp")}constructor(t){this.socket=new WebSocket(t),this.nextId=1,this.pending=new Map,this.listeners=[],this.socket.addEventListener("message",s=>{const r=JSON.parse(String(s.data));if(r.id!==void 0){const o=this.pending.get(r.id);this.pending.delete(r.id),r.error?o?.reject(new Error(r.error.message)):o?.resolve(r.result)}else for(const o of this.listeners)o(r)})}open(){return new Promise((t,s)=>{this.socket.addEventListener("open",()=>t(),{once:!0}),this.socket.addEventListener("error",()=>s(new Error("\u65E0\u6CD5\u8FDE\u63A5\u6D4F\u89C8\u5668\u8C03\u8BD5\u7AEF\u53E3")),{once:!0})})}send(t,s={}){const r=this.nextId++;return this.socket.send(JSON.stringify({id:r,method:t,params:s})),new Promise((o,n)=>this.pending.set(r,{resolve:o,reject:n}))}on(t){this.listeners.push(t)}close(){this.socket.close()}}const G=`(async () => {
3
+ await document.fonts.ready;
4
+ if (window.DAL_READY && typeof window.DAL_READY.then === "function") await window.DAL_READY;
5
+ await new Promise((done) => requestAnimationFrame(() => requestAnimationFrame(done)));
6
+ const root = document.documentElement;
7
+ return { width: root.scrollWidth, height: root.scrollHeight, viewport: innerWidth, viewportHeight: innerHeight,
8
+ overflow: [...document.querySelectorAll("[data-fit]")]
9
+ // Tight display line-heights let glyphs poke out of the last line box by a
10
+ // fraction of an em; only a real extra line or clipped word counts.
11
+ .filter((el) => {
12
+ const slack = parseFloat(getComputedStyle(el).fontSize) * 0.3;
13
+ return el.scrollHeight > el.clientHeight + slack || el.scrollWidth > el.clientWidth + slack;
14
+ })
15
+ .map((el) => ({ name: el.getAttribute("data-fit") || el.tagName.toLowerCase(),
16
+ detail: el.scrollHeight > el.clientHeight + parseFloat(getComputedStyle(el).fontSize) * 0.3 ? \`\u9AD8 \${el.scrollHeight}/\${el.clientHeight}px\` : \`\u5BBD \${el.scrollWidth}/\${el.clientWidth}px\` })) };
17
+ })()`;async function N(){const e=F(process.argv.slice(2)),t=L(e.output).toLowerCase();if(t!==".png"&&t!==".pdf")throw new Error("\u8F93\u51FA\u6587\u4EF6\u5FC5\u987B\u4EE5 .png \u6216 .pdf \u7ED3\u5C3E");if(!u(e.input))throw new Error(`\u627E\u4E0D\u5230\u9875\u9762\u6587\u4EF6\uFF1A${e.input}`);const s=O();s||(console.error("\u6CA1\u6709\u627E\u5230 Chrome / Edge\u3002\u6309\u300C\u6D4F\u89C8\u5668\u9A8C\u6536\u300D\u6280\u80FD\u91CC\u7684\u7B2C 3 \u6B65\uFF08\u5148\u95EE\u7528\u6237\uFF09\u4E0B\u8F7D\u6D4B\u8BD5\u7248 Chrome\uFF0C\u6216\u8BBE\u7F6E DAL_CHROME \u6307\u5411\u6D4F\u89C8\u5668\u7A0B\u5E8F\u3002"),process.exit(2));const r=b(c(D(),"dal-render-")),o=A(s,["--headless=new","--remote-debugging-port=0",`--user-data-dir=${r}`,"--no-first-run","--no-default-browser-check","--disable-extensions","--disable-sync","--hide-scrollbars","--font-render-hinting=none","about:blank"],{stdio:"ignore"}),n=[];let a;try{const h=c(r,"DevToolsActivePort"),[E]=await y(()=>{const i=u(h)?x(h,"utf8").split(`
18
+ `).filter(Boolean):[];return i.length>=2?i:void 0},15e3,"\u6D4F\u89C8\u5668\u542F\u52A8"),m=(await(await fetch(`http://127.0.0.1:${E}/json/list`)).json()).find(i=>i.type==="page");if(!m)throw new Error("\u6D4F\u89C8\u5668\u6CA1\u6709\u6253\u5F00\u9875\u9762");a=new T(m.webSocketDebuggerUrl),await a.open();let g=!1;a.on(i=>{if(i.method==="Page.loadEventFired"&&(g=!0),i.method==="Runtime.exceptionThrown"){const p=i.params.exceptionDetails;n.push(`\u9875\u9762\u811A\u672C\u62A5\u9519\uFF1A${p.exception?.description??p.text}`)}i.method==="Runtime.consoleAPICalled"&&i.params.type==="error"&&n.push(`\u63A7\u5236\u53F0\u9519\u8BEF\uFF1A${i.params.args.map(p=>p.value??p.description).join(" ")}`),i.method==="Log.entryAdded"&&i.params.entry.level==="error"&&n.push(`\u52A0\u8F7D\u9519\u8BEF\uFF1A${i.params.entry.text} ${i.params.entry.url??""}`.trim())}),await a.send("Page.enable"),await a.send("Runtime.enable"),await a.send("Log.enable"),await a.send("Emulation.setDeviceMetricsOverride",{width:Math.round(e.width),height:Math.round(e.height),deviceScaleFactor:e.scale,mobile:!1}),await a.send("Emulation.setEmulatedMedia",{features:[{name:"prefers-color-scheme",value:e.dark?"dark":"light"}]}),await a.send("Page.navigate",{url:R(e.input).href}),await y(()=>g,e.timeout,"\u9875\u9762\u52A0\u8F7D");const l=(await a.send("Runtime.evaluate",{expression:G,awaitPromise:!0,returnByValue:!0,timeout:e.timeout})).result?.value??{};l.width>l.viewport+1&&n.push(`\u9875\u9762\u6A2A\u5411\u6EA2\u51FA\uFF1A\u5185\u5BB9\u5BBD ${l.width}px\uFF0C\u753B\u5E03\u5BBD ${l.viewport}px`),!e.full&&t===".png"&&l.height>l.viewportHeight+1&&n.push(`\u5185\u5BB9\u9AD8 ${l.height}px \u8D85\u51FA\u753B\u5E03 ${l.viewportHeight}px\uFF0C\u5E95\u90E8\u4F1A\u88AB\u88C1\u6389\uFF08\u957F\u9875\u7528 --full\uFF09`);for(const i of l.overflow??[])n.push(`\u6587\u5B57\u653E\u4E0D\u4E0B\uFF1A${i.name}\uFF0C\u5185\u5BB9${i.detail}\uFF08\u7F29\u77ED\u6587\u6848\u6216\u8C03\u5C0F\u5B57\u53F7\uFF09`);let f;t===".pdf"?f=(await a.send("Page.printToPDF",{printBackground:!0,preferCSSPageSize:!0})).data:(e.full&&await a.send("Emulation.setDeviceMetricsOverride",{width:Math.round(e.width),height:Math.max(Math.round(e.height),l.height??0),deviceScaleFactor:e.scale,mobile:!1}),f=(await a.send("Page.captureScreenshot",{format:"png",captureBeyondViewport:e.full})).data);const w=Buffer.from(f,"base64");if($(e.output,w),t===".pdf"){const i=w.toString("latin1").match(/\/Type\s*\/Page[^s]/g)?.length??0;console.log(`\u5DF2\u751F\u6210 ${e.output}\uFF08\u5171 ${i} \u9875\uFF09`)}else console.log(`\u5DF2\u751F\u6210 ${e.output}`)}finally{a?.close(),o.kill(),await new Promise(h=>setTimeout(h,300)),k(r,{recursive:!0,force:!0})}if(n.length>0){for(const h of n)console.error(h);process.exit(3)}}d(N,"main"),N().catch(e=>{console.error(e instanceof Error?e.message:String(e)),process.exit(1)});
@@ -0,0 +1,264 @@
1
+ /*
2
+ * DAL design tokens: the one place colors, type, spacing, radius and motion
3
+ * are defined for every page, poster, report and email DAL builds.
4
+ * Pages reference the semantic variables only (var(--color-danger), never a hex).
5
+ *
6
+ * Neutral, indigo, red, green and amber steps are Radix Colors 3.0.0
7
+ * (MIT, © 2021 Radix; see NOTICE). Variable names follow the semantic
8
+ * naming of shadcn/ui (MIT). Chart hues match the DAL chart theme
9
+ * (Observable "observable10", ISC).
10
+ *
11
+ * Usage: <link rel="stylesheet" href="tokens.css"> (copy the file next to the
12
+ * page), or paste its contents into the page's <style>. Light by default;
13
+ * follows the system dark setting; <html data-theme="light|dark"> forces one.
14
+ */
15
+
16
+ :root {
17
+ color-scheme: light dark;
18
+
19
+ /* Type. System CJK faces: they ship with every OS, load instantly and
20
+ never depend on a font CDN (Google Fonts is unreachable in mainland China). */
21
+ --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC",
22
+ "Source Han Sans SC", "Segoe UI", system-ui, sans-serif;
23
+ --font-serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", Georgia, serif;
24
+ --font-mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
25
+
26
+ /* Type scale (px): 12 13 14 16 20 24 32 44 60 — a 1.25-ish ramp, CJK-friendly. */
27
+ --text-xs: 0.75rem;
28
+ --text-sm: 0.8125rem;
29
+ --text-base: 0.875rem;
30
+ --text-md: 1rem;
31
+ --text-lg: 1.25rem;
32
+ --text-xl: 1.5rem;
33
+ --text-2xl: 2rem;
34
+ --text-3xl: 2.75rem;
35
+ --text-4xl: 3.75rem;
36
+ --leading-tight: 1.25;
37
+ --leading-normal: 1.6;
38
+ --leading-relaxed: 1.8;
39
+ --weight-regular: 400;
40
+ --weight-medium: 500;
41
+ --weight-semibold: 600;
42
+
43
+ /* Spacing: 4px grid. */
44
+ --space-1: 4px;
45
+ --space-2: 8px;
46
+ --space-3: 12px;
47
+ --space-4: 16px;
48
+ --space-5: 20px;
49
+ --space-6: 24px;
50
+ --space-8: 32px;
51
+ --space-10: 40px;
52
+ --space-12: 48px;
53
+ --space-16: 64px;
54
+ --space-24: 96px;
55
+
56
+ --radius-sm: 4px;
57
+ --radius-md: 6px;
58
+ --radius-lg: 8px;
59
+ --radius-xl: 12px;
60
+ --radius-full: 999px;
61
+
62
+ --content-width: 72rem;
63
+ --prose-width: 42rem;
64
+
65
+ /* Motion: short, ease-out, only to show what changed. */
66
+ --duration-fast: 120ms;
67
+ --duration-base: 200ms;
68
+ --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
69
+
70
+ /* Light colors. */
71
+ --color-bg: #fcfcfd;
72
+ --color-bg-subtle: #f9f9fb;
73
+ --color-surface: #ffffff;
74
+ --color-surface-hover: #f0f0f3;
75
+ --color-surface-active: #e8e8ec;
76
+ --color-border: #e0e1e6;
77
+ --color-border-strong: #cdced6;
78
+ --color-text: #1c2024;
79
+ --color-text-muted: #60646c;
80
+ --color-text-faint: #8b8d98;
81
+
82
+ --color-primary: #3e63dd;
83
+ --color-primary-hover: #3358d4;
84
+ --color-primary-text: #3a5bc7;
85
+ --color-primary-subtle: #edf2fe;
86
+ --color-primary-border: #c1d0ff;
87
+ --color-on-primary: #ffffff;
88
+ --color-focus-ring: #8da4ef;
89
+
90
+ --color-danger: #e5484d;
91
+ --color-danger-text: #ce2c31;
92
+ --color-danger-subtle: #feebec;
93
+ --color-success: #30a46c;
94
+ --color-success-text: #218358;
95
+ --color-success-subtle: #e6f6eb;
96
+ --color-warning: #ffc53d;
97
+ --color-warning-text: #ab6400;
98
+ --color-warning-subtle: #fff7c2;
99
+
100
+ /* Chart series (DAL chart theme, light). */
101
+ --chart-1: #4269d0;
102
+ --chart-2: #efb118;
103
+ --chart-3: #ff725c;
104
+ --chart-4: #6cc5b0;
105
+ --chart-5: #3ca951;
106
+ --chart-6: #ff8ab7;
107
+
108
+ /* Shadows only for things that float (menus, popovers, dialogs). */
109
+ --shadow-float: 0 8px 24px rgb(0 0 0 / 0.12), 0 1px 3px rgb(0 0 0 / 0.08);
110
+ }
111
+
112
+ @media (prefers-color-scheme: dark) {
113
+ :root:not([data-theme="light"]) {
114
+ --color-bg: #111113;
115
+ --color-bg-subtle: #18191b;
116
+ --color-surface: #18191b;
117
+ --color-surface-hover: #212225;
118
+ --color-surface-active: #272a2d;
119
+ --color-border: #2e3135;
120
+ --color-border-strong: #43484e;
121
+ --color-text: #edeef0;
122
+ --color-text-muted: #b0b4ba;
123
+ --color-text-faint: #777b84;
124
+
125
+ --color-primary: #3e63dd;
126
+ --color-primary-hover: #5472e4;
127
+ --color-primary-text: #9eb1ff;
128
+ --color-primary-subtle: #182449;
129
+ --color-primary-border: #304384;
130
+ --color-on-primary: #ffffff;
131
+ --color-focus-ring: #435db1;
132
+
133
+ --color-danger: #e5484d;
134
+ --color-danger-text: #ff9592;
135
+ --color-danger-subtle: #3b1219;
136
+ --color-success: #30a46c;
137
+ --color-success-text: #3dd68c;
138
+ --color-success-subtle: #132d21;
139
+ --color-warning: #ffc53d;
140
+ --color-warning-text: #ffca16;
141
+ --color-warning-subtle: #302008;
142
+
143
+ --chart-1: #6a8df0;
144
+ --chart-2: #efb118;
145
+ --chart-3: #ff725c;
146
+ --chart-4: #6cc5b0;
147
+ --chart-5: #4fc264;
148
+ --chart-6: #ff8ab7;
149
+
150
+ --shadow-float: 0 8px 24px rgb(0 0 0 / 0.5), 0 0 0 1px rgb(255 255 255 / 0.06);
151
+ }
152
+ }
153
+
154
+ :root[data-theme="dark"] {
155
+ --color-bg: #111113;
156
+ --color-bg-subtle: #18191b;
157
+ --color-surface: #18191b;
158
+ --color-surface-hover: #212225;
159
+ --color-surface-active: #272a2d;
160
+ --color-border: #2e3135;
161
+ --color-border-strong: #43484e;
162
+ --color-text: #edeef0;
163
+ --color-text-muted: #b0b4ba;
164
+ --color-text-faint: #777b84;
165
+
166
+ --color-primary: #3e63dd;
167
+ --color-primary-hover: #5472e4;
168
+ --color-primary-text: #9eb1ff;
169
+ --color-primary-subtle: #182449;
170
+ --color-primary-border: #304384;
171
+ --color-on-primary: #ffffff;
172
+ --color-focus-ring: #435db1;
173
+
174
+ --color-danger: #e5484d;
175
+ --color-danger-text: #ff9592;
176
+ --color-danger-subtle: #3b1219;
177
+ --color-success: #30a46c;
178
+ --color-success-text: #3dd68c;
179
+ --color-success-subtle: #132d21;
180
+ --color-warning: #ffc53d;
181
+ --color-warning-text: #ffca16;
182
+ --color-warning-subtle: #302008;
183
+
184
+ --chart-1: #6a8df0;
185
+ --chart-2: #efb118;
186
+ --chart-3: #ff725c;
187
+ --chart-4: #6cc5b0;
188
+ --chart-5: #4fc264;
189
+ --chart-6: #ff8ab7;
190
+
191
+ --shadow-float: 0 8px 24px rgb(0 0 0 / 0.5), 0 0 0 1px rgb(255 255 255 / 0.06);
192
+ }
193
+
194
+ /* Base: sensible defaults every page gets. */
195
+ *,
196
+ *::before,
197
+ *::after {
198
+ box-sizing: border-box;
199
+ }
200
+
201
+ html {
202
+ -webkit-text-size-adjust: 100%;
203
+ text-size-adjust: 100%;
204
+ }
205
+
206
+ body {
207
+ margin: 0;
208
+ background: var(--color-bg);
209
+ color: var(--color-text);
210
+ font-family: var(--font-sans);
211
+ font-size: var(--text-base);
212
+ line-height: var(--leading-normal);
213
+ -webkit-font-smoothing: antialiased;
214
+ text-rendering: optimizeLegibility;
215
+ font-feature-settings: "palt" 0;
216
+ }
217
+
218
+ h1,
219
+ h2,
220
+ h3,
221
+ h4 {
222
+ line-height: var(--leading-tight);
223
+ font-weight: var(--weight-semibold);
224
+ margin: 0;
225
+ text-wrap: balance;
226
+ }
227
+
228
+ p {
229
+ margin: 0;
230
+ text-wrap: pretty;
231
+ }
232
+
233
+ img,
234
+ svg,
235
+ video,
236
+ canvas {
237
+ display: block;
238
+ max-width: 100%;
239
+ }
240
+
241
+ table {
242
+ border-collapse: collapse;
243
+ font-variant-numeric: tabular-nums;
244
+ }
245
+
246
+ :focus-visible {
247
+ outline: 2px solid var(--color-focus-ring);
248
+ outline-offset: 2px;
249
+ }
250
+
251
+ ::selection {
252
+ background: var(--color-primary-subtle);
253
+ }
254
+
255
+ @media (prefers-reduced-motion: reduce) {
256
+ *,
257
+ *::before,
258
+ *::after {
259
+ animation-duration: 0.01ms !important;
260
+ animation-iteration-count: 1 !important;
261
+ transition-duration: 0.01ms !important;
262
+ scroll-behavior: auto !important;
263
+ }
264
+ }
@@ -0,0 +1,73 @@
1
+ ---
2
+ name: web-design
3
+ description: 在做网页、前端界面、落地页、官网、数据看板、管理后台或调整页面样式时使用:网页 / 页面 / 前端 / 界面 / UI / 落地页 / 官网 / 看板 / dashboard / 后台 / 样式 / CSS / landing page。
4
+ ---
5
+
6
+ <!-- Parts of the design principles below are adapted from the "frontend-design" skill by Anthropic (Apache-2.0); see NOTICE. -->
7
+
8
+ # 做网页和界面
9
+
10
+ 回复用用户提问的语言。目标:第一眼就像成熟产品团队做的,而不是模板拼出来的。好看来自**结构和克制**,不是来自配色和特效。
11
+
12
+ ## 1. 先定三件事,再写代码
13
+
14
+ 1. **参照谁**:只指名一个真实产品,并说清学它哪部分结构。后台/工具类学 Linear 或 Vercel 控制台(左侧导航 + 顶部上下文 + 高密度列表);内容/官网类学 Stripe 文档或 Apple 产品页(大标题 + 一句话 + 产品图 + 留白节奏)。不要"综合参考多家"。
15
+ 2. **token**:颜色、间距、字号、圆角、阴影只用 `../visual-kit/tokens.css` 里的语义变量(`var(--color-danger)` 而不是 `#e5484d`)。把这个文件复制到页面旁边用 `<link>` 引入;单文件交付就把它的内容贴进 `<style>`。用户有品牌色时只改 `--color-primary*` 这几项。
16
+ 3. **不用什么**:写下这个页面不用的东西(例:"不用阴影""红色只给错误""不用渐变"),写完逐条自查。
17
+
18
+ 现有项目已经有设计系统(Tailwind 配置、组件库、CSS 变量)时,沿用它,不要另起一套。
19
+
20
+ ## 2. 起点模板
21
+
22
+ - 数据看板 / 管理后台:`../visual-kit/dashboard.html`(左侧导航、顶栏、筛选 chips、指标行、图表、表格;图表已接 DAL 主题)
23
+ - 落地页 / 产品官网:`../visual-kit/landing.html`(导航、首屏、功能两栏、客户证言、价格对比表、常见问题、页脚)
24
+
25
+ 复制到输出目录后**换内容、留结构**:按用户的真实业务改文案、数据、栏目;栏目不适用就删,不要硬凑。React / Vue 项目照它的结构和 token 写组件,不要直接塞整页 HTML。
26
+
27
+ ## 3. 硬规则
28
+
29
+ **排版**
30
+ - 字体用 tokens 里的系统字体栈(苹方 / 微软雅黑 / 思源黑体);不要引 Google Fonts 等境外字体 CDN(国内打不开,页面会白屏等字体)。
31
+ - 正文 14–16px,行高 1.6;标题行高 1.25;一行中文不超过 40 字左右(`max-width: var(--prose-width)`)。
32
+ - 大标题按分句手动断行(`<br>`),或给短标题加 `word-break: keep-all`,不要让一个词被拆到两行("为什 / 么")。
33
+ - 数字列右对齐并用 `font-variant-numeric: tabular-nums`;文本左对齐。
34
+
35
+ **布局与密度**
36
+ - 间距只用 4 的倍数(`--space-*`)。列表行高 32–40px,容器内边距 8–16px;后台页面按"一屏能看到多少有效信息"来评判。
37
+ - 按信息层级排版,主次不等宽;能用表格或列表就不要用卡片;卡片里不再套卡片。
38
+ - 筛选用横排 chips,不要一排下拉框。导航固定在左侧(图标 + 文字),小屏才收起。
39
+
40
+ **颜色**
41
+ - 中性灰为主,一个强调色;语义色(红/绿/黄)只表示状态。深色模式用 tokens 自带的那套,不要自己反色。
42
+ - 图表用 DAL 图表主题:ECharts 用 `../visual-kit/echarts-dal.json` 里的 light/dark 注册(看板模板里有写法),或直接调用 `office_chart_generate`。
43
+
44
+ **动效**
45
+ - 只有用户操作的反馈才加动效(展开、切换、确认),120–200ms、ease-out;不要进场动画、悬停放大、滚动视差。尊重 `prefers-reduced-motion`(tokens 已处理)。
46
+
47
+ **响应式与可用性**
48
+ - 手机宽度(390px)不出现横向滚动;表格在小屏可以横向滚动或改成列表。
49
+ - 焦点环可见(tokens 已处理),主操作有快捷键提示;图标按钮有 `aria-label`;图片有 `alt`。
50
+
51
+ **第三方库**
52
+ - 优先不用库。需要时只从 `https://cdn.npmmirror.com/packages/<包名>/<固定版本>/files/...` 引入,并带 `integrity` 与 `crossorigin="anonymous"`;模板里已有 ECharts 的写法可照抄。
53
+
54
+ ## 4. 一眼就像 AI 做的——默认禁止
55
+
56
+ | 不要 | 改成 |
57
+ |---|---|
58
+ | 靛蓝到紫色的渐变、大面积渐变背景 | 实色;渐变最多用在极小的强调处 |
59
+ | 一排三张等宽圆角卡片 + 图标 + 标题 + 一句话 | 两栏列表、表格,或主次不等宽的布局 |
60
+ | 玻璃拟态、大面积模糊 | 实色 + 1px 边框 |
61
+ | 所有元素都带阴影、到处 12px 以上大圆角 | 阴影只给浮层(菜单、弹窗);圆角 4–8px |
62
+ | 标题上方的小胶囊徽章、全大写小标签、01/02/03 编号 | 删掉;编号只用于真正的步骤 |
63
+ | emoji 当图标 | 线性图标(同一套、同一粗细)或不用 |
64
+ | 每个区块淡入上滑、悬停就放大 | 不加 |
65
+ | "赋能""一站式""极致体验"这类空话 | 写用户能做什么、得到什么,用具体数字 |
66
+ | 只在标题里把一个词染色或加粗 | 整句同一样式 |
67
+
68
+ ## 5. 交付前检查(截图看过才算完成)
69
+
70
+ 1. 用 `node ../visual-kit/render.mjs <页面.html> <截图.png> --width 1440 --height 900 --full` 截桌面图,再用 `--width 390 --height 844 --full` 截手机图,`--dark` 再截一张深色。退出码 3 表示页面有报错或横向溢出,修好再截。没有 Chrome 时按「浏览器验收」技能处理。
71
+ 2. 用读图片的工具看截图,逐条回答:第 4 节的禁止项一个都没有?截图缩小一半主次还分得清?手机上没有挤压、截断?深色下文字都看得清?
72
+ 3. 列表/表格页面再看空数据、加载中、出错、超长文本四种状态有没有处理。
73
+ 4. 交付时写出:页面文件路径、截图路径、参照了哪个产品的哪部分结构。
@@ -0,0 +1 @@
1
+ var m=Object.defineProperty;var i=(a,e)=>m(a,"name",{value:e,configurable:!0});var p=Object.defineProperty,r=i((a,e)=>p(a,"name",{value:e,configurable:!0}),"e");import{dirname as t,join as n}from"node:path";import{fileURLToPath as s}from"node:url";const o=["browser-qa","diagram-design","poster-design","print-design","web-design"],d="visual-kit";function l(){return n(t(s(import.meta.url)),"bundled",d)}i(l,"u"),r(l,"visualKitPath");function u(){const a=t(s(import.meta.url));return o.map(e=>n(a,"bundled",e,"SKILL.md"))}i(u,"g"),r(u,"bundledSkillPaths");export{o as BUNDLED_SKILLS,d as VISUAL_KIT_DIR,u as bundledSkillPaths,l as visualKitPath};
@@ -1,2 +1,2 @@
1
- var k=Object.defineProperty;var o=(u,r)=>k(u,"name",{value:r,configurable:!0});var L=Object.defineProperty,a=o((u,r)=>L(u,"name",{value:r,configurable:!0}),"o");import{t as i}from"@dalcode/dal-pi-kit";const h=["product","cloud","project","package"];function A(u){return u.scope==="temporary"?"product":u.scope==="project"?"project":u.origin==="package"?"package":"user"}o(A,"y"),a(A,"hostTier");function C(u,r){const e=new Set,t=[];for(const F of u){const n=F.name.toLowerCase();e.has(n)||(e.add(n),t.push({name:F.name,description:F.description,source:"local",tier:A(F),filePath:F.filePath,baseDir:F.baseDir}))}for(const F of r){const n=F.id.toLowerCase(),l=F.name.toLowerCase();e.has(n)||e.has(l)||(e.add(n),e.add(l),t.push({name:F.id,title:F.name!==F.id?F.name:void 0,description:F.description,source:"cloud",tier:"cloud",cloudId:F.id}))}return t}o(C,"x"),a(C,"mergeSkills");function d(u,r){const e=r.trim().toLowerCase();if(e.length!==0)return u.find(t=>t.name.toLowerCase()===e||t.title?.toLowerCase()===e)??u.find(t=>t.name.toLowerCase().includes(e)||t.title?.toLowerCase().includes(e))}o(d,"b"),a(d,"resolveSkill");function D(){return i("\u4EFB\u52A1\u7B26\u5408\u67D0\u4E2A\u6280\u80FD\u7684\u300C\u4F55\u65F6\u4F7F\u7528\u300D\u65F6\uFF0C\u5148\u7528 skill \u5DE5\u5177\u52A0\u8F7D\u5B83\uFF0C\u518D\u56DE\u7B54\u6216\u52A8\u624B\uFF1B\u7528\u6237\u70B9\u540D\u67D0\u4E2A\u6280\u80FD\u65F6\u5FC5\u987B\u4F7F\u7528\u5B83\uFF1B\u4E0D\u8981\u53EA\u63D0\u5230\u6280\u80FD\u800C\u4E0D\u52A0\u8F7D\u3002")}o(D,"f"),a(D,"skillRule");const E=25,p=80;function f(u,r){const e=`- ${u.title?`${u.name} (${u.title})`:u.name}: ${u.description.replace(/\s+/g," ").trim()}`;return Array.from(e).length>r?`${Array.from(e).slice(0,r-1).join("")}\u2026`:e}o(f,"k"),a(f,"listingLine");function m(u,r={}){const e=r.maxEntries??E,t=r.maxLineChars??p,F=a((s,c)=>s.name<c.name?-1:s.name>c.name?1:0,"byName"),n=h.flatMap(s=>u.filter(c=>c.tier===s).sort(F)).slice(0,e).map(s=>f(s,t)),l=u.length-n.length;return l>0&&n.push(`${i("\u53E6\u6709\u672A\u5217\u51FA\u7684\u6280\u80FD\uFF0C\u6570\u91CF\uFF1A")}${l}${i("\u3002\u52A8\u624B\u524D\u7528 query \u6309\u4EFB\u52A1\u641C\u7D22\uFF0C\u518D\u7528 name \u52A0\u8F7D\u3002")}`),n}o(m,"E"),a(m,"listSkills");function B(u,r={}){return[D(),i("\u52A0\u8F7D\u6280\u80FD\uFF1A\u4E13\u9879\u4EFB\u52A1\u7684\u64CD\u4F5C\u6307\u5F15\u3002\u8FD9\u662F\u4F7F\u7528\u6280\u80FD\u7684\u552F\u4E00\u5165\u53E3\uFF0C\u4E0D\u8981\u7528 read \u6216 bash \u53BB\u8BFB\u6280\u80FD\u6587\u4EF6\u3002"),i("\u7528 name \u52A0\u8F7D\u67D0\u4E2A\u6280\u80FD\u7684\u5168\u6587\u5E76\u7167\u505A\uFF1B\u7528 query \u6309\u4EFB\u52A1\u63CF\u8FF0\u641C\u7D22\u672A\u5217\u51FA\u7684\u6280\u80FD\u3002"),i('\u7528\u6237\u6D88\u606F\u91CC\u5DF2\u7ECF\u6709 <skill name="\u2026"> \u5757\u65F6\uFF0C\u8BE5\u6280\u80FD\u5DF2\u52A0\u8F7D\uFF0C\u76F4\u63A5\u7167\u505A\uFF0C\u4E0D\u5FC5\u518D\u6B21\u8C03\u7528\u3002'),"",i("\u53EF\u7528\u6280\u80FD\uFF08name: \u4F55\u65F6\u4F7F\u7528\uFF09\uFF1A"),...m(u,r)].join(`
2
- `)}o(B,"C"),a(B,"describeSkillTool");export{p as DEFAULT_MAX_LINE_CHARS,E as DEFAULT_MAX_LISTED_SKILLS,B as describeSkillTool,m as listSkills,C as mergeSkills,d as resolveSkill,D as skillRule};
1
+ var k=Object.defineProperty;var o=(u,r)=>k(u,"name",{value:r,configurable:!0});var L=Object.defineProperty,a=o((u,r)=>L(u,"name",{value:r,configurable:!0}),"o");import{t as i}from"@dalcode/dal-pi-kit";const h=["product","cloud","project","package"];function A(u){return u.scope==="temporary"?"product":u.scope==="project"?"project":u.origin==="package"?"package":"user"}o(A,"y"),a(A,"hostTier");function C(u,r){const e=new Set,t=[];for(const F of u){const n=F.name.toLowerCase();e.has(n)||(e.add(n),t.push({name:F.name,description:F.description,source:"local",tier:A(F),filePath:F.filePath,baseDir:F.baseDir}))}for(const F of r){const n=F.id.toLowerCase(),l=F.name.toLowerCase();e.has(n)||e.has(l)||(e.add(n),e.add(l),t.push({name:F.id,title:F.name!==F.id?F.name:void 0,description:F.description,source:"cloud",tier:"cloud",cloudId:F.id}))}return t}o(C,"x"),a(C,"mergeSkills");function E(u,r){const e=r.trim().toLowerCase();if(e.length!==0)return u.find(t=>t.name.toLowerCase()===e||t.title?.toLowerCase()===e)??u.find(t=>t.name.toLowerCase().includes(e)||t.title?.toLowerCase().includes(e))}o(E,"b"),a(E,"resolveSkill");function D(){return i("\u4EFB\u52A1\u7B26\u5408\u67D0\u4E2A\u6280\u80FD\u7684\u300C\u4F55\u65F6\u4F7F\u7528\u300D\u65F6\uFF0C\u5148\u7528 skill \u5DE5\u5177\u52A0\u8F7D\u5B83\uFF0C\u518D\u56DE\u7B54\u6216\u52A8\u624B\uFF1B\u7528\u6237\u70B9\u540D\u67D0\u4E2A\u6280\u80FD\u65F6\u5FC5\u987B\u4F7F\u7528\u5B83\uFF1B\u4E0D\u8981\u53EA\u63D0\u5230\u6280\u80FD\u800C\u4E0D\u52A0\u8F7D\u3002")}o(D,"f"),a(D,"skillRule");const d=25,p=80;function f(u,r){const e=`- ${u.title?`${u.name} (${u.title})`:u.name}: ${u.description.replace(/\s+/g," ").trim()}`;return Array.from(e).length>r?`${Array.from(e).slice(0,r-1).join("")}\u2026`:e}o(f,"k"),a(f,"listingLine");function m(u,r={}){const e=r.maxEntries??d,t=r.maxLineChars??p,F=a((s,c)=>s.name<c.name?-1:s.name>c.name?1:0,"byName"),n=h.flatMap(s=>u.filter(c=>c.tier===s).sort(F)).slice(0,e).map(s=>f(s,t)),l=u.length-n.length;return l>0&&n.push(`${i("\u53E6\u6709\u672A\u5217\u51FA\u7684\u6280\u80FD\uFF0C\u6570\u91CF\uFF1A")}${l}${i("\u3002\u52A8\u624B\u524D\u7528 query \u6309\u4EFB\u52A1\u641C\u7D22\uFF0C\u518D\u7528 name \u52A0\u8F7D\u3002")}`),n}o(m,"E"),a(m,"listSkills");function B(u,r={}){return[D(),i("\u52A0\u8F7D\u6280\u80FD\uFF1A\u4E13\u9879\u4EFB\u52A1\u7684\u64CD\u4F5C\u6307\u5F15\u3002\u8FD9\u662F\u4F7F\u7528\u6280\u80FD\u7684\u552F\u4E00\u5165\u53E3\uFF0C\u4E0D\u8981\u7528 read \u6216 bash \u53BB\u8BFB\u6280\u80FD\u6587\u4EF6\u3002"),i("\u7528 name \u52A0\u8F7D\u67D0\u4E2A\u6280\u80FD\u7684\u5168\u6587\u5E76\u7167\u505A\uFF1B\u7528 query \u6309\u4EFB\u52A1\u63CF\u8FF0\u641C\u7D22\u672A\u5217\u51FA\u7684\u6280\u80FD\u3002"),i('\u7528\u6237\u6D88\u606F\u6216\u968F\u9644\u7684\u4E0A\u4E0B\u6587\u91CC\u5DF2\u7ECF\u6709 <skill name="\u2026"> \u5757\u65F6\uFF0C\u8BE5\u6280\u80FD\u5DF2\u52A0\u8F7D\uFF0C\u76F4\u63A5\u7167\u505A\uFF0C\u4E0D\u5FC5\u518D\u6B21\u8C03\u7528\u3002'),"",i("\u53EF\u7528\u6280\u80FD\uFF08name: \u4F55\u65F6\u4F7F\u7528\uFF09\uFF1A"),...m(u,r)].join(`
2
+ `)}o(B,"C"),a(B,"describeSkillTool");export{p as DEFAULT_MAX_LINE_CHARS,d as DEFAULT_MAX_LISTED_SKILLS,B as describeSkillTool,m as listSkills,C as mergeSkills,E as resolveSkill,D as skillRule};
@@ -1,14 +1,19 @@
1
- var z=Object.defineProperty;var f=(u,i)=>z(u,"name",{value:i,configurable:!0});var G=Object.defineProperty,r=f((u,i)=>G(u,"name",{value:i,configurable:!0}),"i");import{readFileSync as P}from"node:fs";import{dirname as J}from"node:path";import{t}from"@dalcode/dal-pi-kit";import{accountTag as N,readCache as Q,writeCache as V}from"@dalcode/deepailab/cache";import{defaultConfig as X}from"@dalcode/deepailab/oidc";import{getAgentDir as L,parseFrontmatter as T}from"@earendil-works/pi-coding-agent";import{Type as g}from"typebox";import{describeSkillTool as Y,mergeSkills as Z,resolveSkill as uu}from"./catalog.js";import{fetchSkillBody as eu,fetchSkillIndex as tu}from"./client.js";import{listLocalSkills as nu}from"./discover.js";import{runInstallCommand as ru}from"./install.js";import{runSkillCommand as iu}from"./manage.js";import{fetchAccountPackages as ou,missingPackages as su,readInstalledSources as au,shouldAnnouncePending as lu}from"./packages.js";import{rankSkills as cu}from"./search.js";const Fu=g.Object({name:g.Optional(g.String({description:t("\u8981\u52A0\u8F7D\u5168\u6587\u7684\u6280\u80FD\u540D\u79F0\uFF1A\u53D6\u81EA\u5DE5\u5177\u8BF4\u660E\u91CC\u7684\u5217\u8868\uFF0C\u6216 query \u641C\u7D22\u7684\u7ED3\u679C\u3002")})),query:g.Optional(g.String({description:t("\u6309\u4EFB\u52A1\u63CF\u8FF0\u641C\u7D22\u672A\u5217\u51FA\u7684\u6280\u80FD\uFF1A\u8FD4\u56DE\u6700\u76F8\u5173\u7684\u51E0\u6761\uFF08\u540D\u79F0 + \u4F55\u65F6\u4F7F\u7528\uFF09\uFF0C\u518D\u7528 name \u52A0\u8F7D\u5168\u6587\u3002")}))}),O=6;function j(u){return Array.isArray(u)&&u.every(i=>typeof i?.id=="string"&&i.id.length>0&&typeof i.name=="string"&&typeof i.description=="string")}f(j,"oe"),r(j,"isSkillList");const q=6e4;function $(u){return u.length>q?`${u.slice(0,q)}
1
+ var G=Object.defineProperty;var d=(u,t)=>G(u,"name",{value:t,configurable:!0});var J=Object.defineProperty,n=d((u,t)=>J(u,"name",{value:t,configurable:!0}),"o");import{readFileSync as L}from"node:fs";import{dirname as Q}from"node:path";import{t as o}from"@dalcode/dal-pi-kit";import{accountTag as V,readCache as Y,writeCache as Z}from"@dalcode/deepailab/cache";import{defaultConfig as uu}from"@dalcode/deepailab/oidc";import{getAgentDir as _,parseFrontmatter as O}from"@earendil-works/pi-coding-agent";import{Type as C}from"typebox";import{bundledSkillPaths as eu}from"./bundled.js";import{describeSkillTool as tu,mergeSkills as nu,resolveSkill as ru}from"./catalog.js";import{fetchSkillBody as ou,fetchSkillIndex as iu}from"./client.js";import{listLocalSkills as su}from"./discover.js";import{runInstallCommand as au}from"./install.js";import{runSkillCommand as lu}from"./manage.js";import{fetchAccountPackages as cu,missingPackages as Fu,readInstalledSources as mu,shouldAnnouncePending as du}from"./packages.js";import{rankSkills as pu}from"./search.js";const fu=C.Object({name:C.Optional(C.String({description:o("\u8981\u52A0\u8F7D\u5168\u6587\u7684\u6280\u80FD\u540D\u79F0\uFF1A\u53D6\u81EA\u5DE5\u5177\u8BF4\u660E\u91CC\u7684\u5217\u8868\uFF0C\u6216 query \u641C\u7D22\u7684\u7ED3\u679C\u3002")})),query:C.Optional(C.String({description:o("\u6309\u4EFB\u52A1\u63CF\u8FF0\u641C\u7D22\u672A\u5217\u51FA\u7684\u6280\u80FD\uFF1A\u8FD4\u56DE\u6700\u76F8\u5173\u7684\u51E0\u6761\uFF08\u540D\u79F0 + \u4F55\u65F6\u4F7F\u7528\uFF09\uFF0C\u518D\u7528 name \u52A0\u8F7D\u5168\u6587\u3002")}))}),j=6;function q(u){return Array.isArray(u)&&u.every(t=>typeof t?.id=="string"&&t.id.length>0&&typeof t.name=="string"&&typeof t.description=="string")}d(q,"ae"),n(q,"isSkillList");const K=6e4;function B(u){return u.length>K?`${u.slice(0,K)}
2
2
 
3
- \u2026(truncated)`:u}f($,"T"),r($,"capBody");function B(u){return u.length===0?t("\u6CA1\u6709\u5339\u914D\u7684\u6280\u80FD\u3002\u53EF\u4EE5\u6362\u4E2A\u5173\u952E\u8BCD\uFF0C\u6216\u4E0D\u5E26 query \u8C03\u7528\u67E5\u770B\u53EF\u7528\u6280\u80FD\u3002"):[t("\u6700\u76F8\u5173\u7684\u6280\u80FD\uFF08\u7528 name \u52A0\u8F7D\u5168\u6587\uFF09\uFF1A"),...u.map(i=>`- ${i.name} [${i.source}]: ${i.description}`)].join(`
4
- `)}f(B,"B"),r(B,"renderMatches");function v(u){return{name:u.name,description:u.title?`${u.title} \u2014 ${u.description}`:u.description,source:u.source}}f(v,"D"),r(v,"searchable");function S(u,i){const h=[];for(const l of u){if(l.source!=="skill"||!l.name.startsWith("skill:"))continue;const E=l.sourceInfo.path;i(E)&&h.push({name:l.name.slice(6),description:l.description??"",filePath:E,baseDir:l.sourceInfo.baseDir??J(E),scope:l.sourceInfo.scope,origin:l.sourceInfo.origin})}return h}f(S,"re"),r(S,"hostSkillsFromCommands");function M(u){try{const{frontmatter:i}=T(P(u,"utf8"));return i["disable-model-invocation"]!==!0}catch{return!1}}f(M,"se"),r(M,"readModelInvocable");function _(u){const i=u.filePath??"",{body:h}=T(P(i,"utf8"));return`<skill name="${u.name}" location="${i}">
3
+ \u2026(truncated)`:u}d(B,"R"),n(B,"capBody");function S(u){return u.length===0?o("\u6CA1\u6709\u5339\u914D\u7684\u6280\u80FD\u3002\u53EF\u4EE5\u6362\u4E2A\u5173\u952E\u8BCD\uFF0C\u6216\u4E0D\u5E26 query \u8C03\u7528\u67E5\u770B\u53EF\u7528\u6280\u80FD\u3002"):[o("\u6700\u76F8\u5173\u7684\u6280\u80FD\uFF08\u7528 name \u52A0\u8F7D\u5168\u6587\uFF09\uFF1A"),...u.map(t=>`- ${t.name} [${t.source}]: ${t.description}`)].join(`
4
+ `)}d(S,"B"),n(S,"renderMatches");function b(u){return{name:u.name,description:u.title?`${u.title} \u2014 ${u.description}`:u.description,source:u.source}}d(b,"D"),n(b,"searchable");function w(u,t){const h=[];for(const c of u){if(c.source!=="skill"||!c.name.startsWith("skill:"))continue;const E=c.sourceInfo.path;t(E)&&h.push({name:c.name.slice(6),description:c.description??"",filePath:E,baseDir:c.sourceInfo.baseDir??Q(E),scope:c.sourceInfo.scope,origin:c.sourceInfo.origin})}return h}d(w,"le"),n(w,"hostSkillsFromCommands");function M(u){try{const{frontmatter:t}=O(L(u,"utf8"));return t["disable-model-invocation"]!==!0}catch{return!1}}d(M,"ce"),n(M,"readModelInvocable");const y="[Apply this skill where it fits the facts. It assumes nothing about this task: reproduce a reported problem first, and if it does not reproduce, report the evidence and stop without editing product code.]",R=Symbol.for("dalcode.skills.textTransform");function $(u,t){const h=globalThis[R];if(typeof h!="function")return t;try{return h(u,t)}catch{return t}}d($,"x"),n($,"transformed");function W(u){const t=u.filePath??"",{body:h}=O(L(t,"utf8"));return`<skill name="${u.name}" location="${t}">
5
5
  References are relative to ${u.baseDir}.
6
6
 
7
- ${$(h.trim())}
8
- </skill>`}f(_,"le"),r(_,"readHostSkillBody");const W=Symbol.for("dalcode.skills.search");function b(u){globalThis[W]=u}f(b,"L"),r(b,"publishSkillSearch");function R(u){const i=X(),h=new Map;let l=[],E=!0,w=!1,y="",D;const k=new Map,K=r(o=>{let e=k.get(o);return e===void 0&&(e=M(o),k.set(o,e)),e},"isModelInvocable"),C=r(()=>Z(S(u.getCommands(),K),l),"entries");u.on("session_start",async(o,e)=>{b(void 0),k.clear(),D=void 0;try{D=await e.modelRegistry?.getApiKeyForProvider?.("deepailab")}catch{D=void 0}const a=r(c=>{const n=`${t("\u65E0\u6CD5\u83B7\u53D6\u4E91\u7AEF\u6280\u80FD\u5217\u8868")}\uFF1A${c}`;e.hasUI?e.ui.notify(n,"warning"):process.stderr.write(`${n}
9
- `)},"reportFailure");if(E=u.isToolAllowed("skill"),E&&D){const c=D,n=`skills-index-${N(c)}`,s=Q(n,j),d=(async()=>{try{const m=await tu(i.apiBase,c);if(m==="not-modified"){a(t("\u670D\u52A1\u7AEF\u8FD4\u56DE\u4E86\u610F\u5916\u7684 304"));return}l=m.skills;try{V(n,m.skills)}catch{}}catch(m){const p=m instanceof Error&&m.name==="AbortError"?t("\u8BF7\u6C42\u8D85\u65F6"):String(m);a(p)}})();s?l=s.value:await d}if(D){const c=D;ou(i.apiBase,c).then(n=>{const s=au(L());A=su(n,s),e.hasUI&&lu(L(),A)&&e.ui.notify(`${t("\u8D26\u53F7\u91CC\u6709")}${A.length}${t(" \u4E2A\u6269\u5C55\u672C\u673A\u8FD8\u6CA1\u88C5\uFF0C/install \u53EF\u76F4\u63A5\u5B89\u88C5\u3002")}`,"info")}).catch(()=>{})}if(!E||C().length===0)return;const F=r(async c=>{const n=C(),s=uu(n,c);if(!s)throw new Error(`${t("\u6CA1\u6709\u8FD9\u4E2A\u6280\u80FD\uFF1A")}${c}
10
- ${t("\u53EF\u7528\uFF1A")}${n.map(H=>H.name).join(", ")}`);if(s.source==="local")return{content:[{type:"text",text:_(s)}],details:{name:s.name,source:"local",path:s.filePath}};const d=s.cloudId??s.name,m=h.get(d);if(m!==void 0)return{content:[{type:"text",text:m}],details:{name:s.name,source:"cloud",id:d,cached:!0}};if(!D)throw new Error(t("\u672A\u767B\u5F55\uFF0C\u65E0\u6CD5\u52A0\u8F7D\u4E91\u7AEF\u6280\u80FD"));const p=await eu(i.apiBase,D,d),I=$(p.body);return h.set(d,I),{content:[{type:"text",text:I}],details:{name:s.name,source:"cloud",id:d,version:p.version}}},"loadBody");y=Y(C()),u.registerTool({name:"skill",label:t("\u6280\u80FD"),description:y,promptSnippet:t("skill - \u52A0\u8F7D\u6280\u80FD\uFF08\u4E13\u9879\u4EFB\u52A1\u6307\u5F15\uFF09\uFF1A\u4EFB\u52A1\u7B26\u5408\u67D0\u4E2A\u6280\u80FD\u65F6\u5148\u52A0\u8F7D\u518D\u52A8\u624B"),parameters:Fu,prepareLoadout:r(()=>C().length>0?{descriptions:{skill:y}}:{hiddenDeclarations:["skill"]},"prepareLoadout"),execute:r(async(c,n)=>{const s=n.name?.trim();if(s)try{return await F(s)}catch(p){throw new Error(`${t("\u52A0\u8F7D\u6280\u80FD\u5931\u8D25\uFF1A")}${s} \u2014 ${p instanceof Error?p.message:String(p)}`)}const d=n.query?.trim();if(d){const p=x(d,O);return{content:[{type:"text",text:B(p)}],details:{query:d,count:p.length}}}const m=C();return{content:[{type:"text",text:B(m.slice(0,O).map(v))}],details:{listed:!0,total:m.length}}},"execute")}),w=!0,b({search:r((c,n,s)=>x(c,s),"search")})});const x=r((o,e)=>cu(C().map(v),o,e),"search");u.on("before_agent_start",o=>{!w||!u.getActiveTools().includes("skill")||C().length!==0&&(o.systemPromptOptions.skills=[])});let A=[];const U=r(o=>o.map(e=>` /install ${e.source} # ${e.name}${e.description?` \u2014 ${e.description}`:""}`).join(`
11
- `),"describePackages");u.registerCommand("packages",{description:t("\u67E5\u770B\u8D26\u53F7\u63A8\u8350\u7684\u6269\u5C55"),handler:r(async(o,e)=>{if(A.length===0){e.ui.notify(t("\u8D26\u53F7\u91CC\u7684\u6269\u5C55\u90FD\u5DF2\u5B89\u88C5\u3002"),"info");return}e.ui.notify(`${t("\u8D26\u53F7\u63A8\u8350\u3001\u672C\u673A\u5C1A\u672A\u5B89\u88C5\u7684\u6269\u5C55\uFF1A")}
12
- ${U(A)}`,"info")},"handler")}),u.registerCommand("install",{description:t("\u5B89\u88C5\u6269\u5C55\uFF08<npm:\u5305\u540D|git:...> [--local]\uFF1B\u65E0\u53C2\u6570\u4ECE\u8D26\u53F7\u63A8\u8350\u4E2D\u9009\u62E9\uFF09"),getArgumentCompletions:r(o=>{const e=o.trimStart();if(e.includes(" "))return null;const a=[...A.map(F=>({value:F.source,label:(F.description||F.name).slice(0,80)})),{value:"--local",label:t("\u5B89\u88C5\u5230\u5F53\u524D\u9879\u76EE")}];return e.length===0?a:a.filter(F=>F.value.startsWith(e))},"getArgumentCompletions"),handler:r(async(o,e)=>{const a=await ru(o,e,{recommended:A});a.kept&&(A=A.filter(F=>F.source!==a.kept))},"handler")}),u.registerCommand("skills",{description:t("\u67E5\u770B\u53EF\u7528\u7684 DeepAILab \u4E91\u7AEF\u6280\u80FD"),handler:r(async(o,e)=>{if(!E){e.ui.notify(t("\u672C\u4F1A\u8BDD\u7684\u5DE5\u5177\u767D\u540D\u5355\uFF08--tools\uFF09\u4E0D\u542B skill\uFF0C\u672A\u52A0\u8F7D\u4E91\u7AEF\u6280\u80FD\u3002"),"info");return}if(l.length===0){e.ui.notify(t("\u5F53\u524D\u6CA1\u6709\u53EF\u7528\u7684\u4E91\u7AEF\u6280\u80FD\uFF08\u672A\u767B\u5F55\uFF0C\u6216\u670D\u52A1\u7AEF\u76EE\u5F55\u4E3A\u7A7A\uFF09\u3002"),"info");return}e.ui.notify(`${t("\u4E91\u7AEF\u6280\u80FD")} (${l.length})
13
- `+l.map(a=>` ${a.name}${a.version?` v${a.version}`:""} \u2014 ${a.description}`).join(`
14
- `),"info")},"handler")}),u.registerCommand("skill",{description:t("\u7BA1\u7406\u672C\u5730\u6280\u80FD\uFF08list | show <name> | add | remove <name>\uFF09\uFF1B/skills \u67E5\u770B\u4E91\u7AEF\u6280\u80FD"),getArgumentCompletions:r(o=>{const e=o.trimStart(),a=e.indexOf(" ");if(a===-1)return["list","add","remove","show"].filter(n=>n.startsWith(e)).map(n=>({value:`${n} `,label:n}));const F=e.slice(0,a),c=e.slice(a+1);return(F==="show"||F==="remove")&&!c.includes(" ")?nu(process.cwd()).filter(n=>n.name.startsWith(c)).map(n=>({value:`${F} ${n.name}`,label:n.description.slice(0,80)})):null},"getArgumentCompletions"),handler:r(async(o,e)=>iu(o,e),"handler")})}f(R,"ce"),r(R,"default");export{W as SKILL_SEARCH_SLOT,R as default,S as hostSkillsFromCommands};
7
+ ${B(h.trim())}
8
+ </skill>`}d(W,"me"),n(W,"readHostSkillBody");const H=Symbol.for("dalcode.skills.search");function x(u){globalThis[H]=u}d(x,"O"),n(x,"publishSkillSearch");function N(u){const t=uu(),h=new Map;let c=[],E=!0,I=!1,k="",D;const v=new Map,U=n(s=>{let e=v.get(s);return e===void 0&&(e=M(s),v.set(s,e)),e},"isModelInvocable"),g=n(()=>nu(w(u.getCommands(),U),c),"entries");u.on("resources_discover",()=>({skillPaths:eu()})),u.on("session_start",async(s,e)=>{x(void 0),v.clear(),D=void 0;try{D=await e.modelRegistry?.getApiKeyForProvider?.("deepailab")}catch{D=void 0}const a=n(l=>{const i=`${o("\u65E0\u6CD5\u83B7\u53D6\u4E91\u7AEF\u6280\u80FD\u5217\u8868")}\uFF1A${l}`;e.hasUI?e.ui.notify(i,"warning"):process.stderr.write(`${i}
9
+ `)},"reportFailure");if(E=u.isToolAllowed("skill"),E&&D){const l=D,i=`skills-index-${V(l)}`,r=Y(i,q),p=(async()=>{try{const m=await iu(t.apiBase,l);if(m==="not-modified"){a(o("\u670D\u52A1\u7AEF\u8FD4\u56DE\u4E86\u610F\u5916\u7684 304"));return}c=m.skills;try{Z(i,m.skills)}catch{}}catch(m){const f=m instanceof Error&&m.name==="AbortError"?o("\u8BF7\u6C42\u8D85\u65F6"):String(m);a(f)}})();r?c=r.value:await p}if(D){const l=D;cu(t.apiBase,l).then(i=>{const r=mu(_());A=Fu(i,r),e.hasUI&&du(_(),A)&&e.ui.notify(`${o("\u8D26\u53F7\u91CC\u6709")}${A.length}${o(" \u4E2A\u6269\u5C55\u672C\u673A\u8FD8\u6CA1\u88C5\uFF0C/install \u53EF\u76F4\u63A5\u5B89\u88C5\u3002")}`,"info")}).catch(()=>{})}if(!E||g().length===0)return;const F=n(async l=>{const i=g(),r=ru(i,l);if(!r)throw new Error(`${o("\u6CA1\u6709\u8FD9\u4E2A\u6280\u80FD\uFF1A")}${l}
10
+ ${o("\u53EF\u7528\uFF1A")}${i.map(z=>z.name).join(", ")}`);if(r.source==="local")return{content:[{type:"text",text:$({name:r.name,source:"local",...r.filePath?{path:r.filePath}:{}},`${W(r)}
11
+ ${y}`)}],details:{name:r.name,source:"local",path:r.filePath}};const p=r.cloudId??r.name,m=h.get(p);if(m!==void 0)return{content:[{type:"text",text:$({name:r.name,source:"cloud"},`${m}
12
+
13
+ ${y}`)}],details:{name:r.name,source:"cloud",id:p,cached:!0}};if(!D)throw new Error(o("\u672A\u767B\u5F55\uFF0C\u65E0\u6CD5\u52A0\u8F7D\u4E91\u7AEF\u6280\u80FD"));const f=await ou(t.apiBase,D,p),T=B(f.body);return h.set(p,T),{content:[{type:"text",text:$({name:r.name,source:"cloud"},`${T}
14
+
15
+ ${y}`)}],details:{name:r.name,source:"cloud",id:p,version:f.version}}},"loadBody");k=tu(g()),u.registerTool({name:"skill",label:o("\u6280\u80FD"),description:k,promptSnippet:o("skill - \u52A0\u8F7D\u6280\u80FD\uFF08\u4E13\u9879\u4EFB\u52A1\u6307\u5F15\uFF09\uFF1A\u4EFB\u52A1\u7B26\u5408\u67D0\u4E2A\u6280\u80FD\u65F6\u5148\u52A0\u8F7D\u518D\u52A8\u624B"),parameters:fu,prepareLoadout:n(()=>g().length>0?{descriptions:{skill:k}}:{hiddenDeclarations:["skill"]},"prepareLoadout"),execute:n(async(l,i)=>{const r=i.name?.trim();if(r)try{return await F(r)}catch(f){throw new Error(`${o("\u52A0\u8F7D\u6280\u80FD\u5931\u8D25\uFF1A")}${r} \u2014 ${f instanceof Error?f.message:String(f)}`)}const p=i.query?.trim();if(p){const f=P(p,j);return{content:[{type:"text",text:S(f)}],details:{query:p,count:f.length}}}const m=g();return{content:[{type:"text",text:S(m.slice(0,j).map(b))}],details:{listed:!0,total:m.length}}},"execute")}),I=!0,x({search:n((l,i,r)=>P(l,r),"search"),load:n(async l=>{try{return(await F(l)).content[0]?.text}catch{return}},"load")})});const P=n((s,e)=>pu(g().map(b),s,e),"search");u.on("before_agent_start",s=>{!I||!u.getActiveTools().includes("skill")||g().length!==0&&(s.systemPromptOptions.skills=[])});let A=[];const X=n(s=>s.map(e=>` /install ${e.source} # ${e.name}${e.description?` \u2014 ${e.description}`:""}`).join(`
16
+ `),"describePackages");u.registerCommand("packages",{description:o("\u67E5\u770B\u8D26\u53F7\u63A8\u8350\u7684\u6269\u5C55"),handler:n(async(s,e)=>{if(A.length===0){e.ui.notify(o("\u8D26\u53F7\u91CC\u7684\u6269\u5C55\u90FD\u5DF2\u5B89\u88C5\u3002"),"info");return}e.ui.notify(`${o("\u8D26\u53F7\u63A8\u8350\u3001\u672C\u673A\u5C1A\u672A\u5B89\u88C5\u7684\u6269\u5C55\uFF1A")}
17
+ ${X(A)}`,"info")},"handler")}),u.registerCommand("install",{description:o("\u5B89\u88C5\u6269\u5C55\uFF08<npm:\u5305\u540D|git:...> [--local]\uFF1B\u65E0\u53C2\u6570\u4ECE\u8D26\u53F7\u63A8\u8350\u4E2D\u9009\u62E9\uFF09"),getArgumentCompletions:n(s=>{const e=s.trimStart();if(e.includes(" "))return null;const a=[...A.map(F=>({value:F.source,label:(F.description||F.name).slice(0,80)})),{value:"--local",label:o("\u5B89\u88C5\u5230\u5F53\u524D\u9879\u76EE")}];return e.length===0?a:a.filter(F=>F.value.startsWith(e))},"getArgumentCompletions"),handler:n(async(s,e)=>{const a=await au(s,e,{recommended:A});a.kept&&(A=A.filter(F=>F.source!==a.kept))},"handler")}),u.registerCommand("skills",{description:o("\u67E5\u770B\u53EF\u7528\u7684 DeepAILab \u4E91\u7AEF\u6280\u80FD"),handler:n(async(s,e)=>{if(!E){e.ui.notify(o("\u672C\u4F1A\u8BDD\u7684\u5DE5\u5177\u767D\u540D\u5355\uFF08--tools\uFF09\u4E0D\u542B skill\uFF0C\u672A\u52A0\u8F7D\u4E91\u7AEF\u6280\u80FD\u3002"),"info");return}if(c.length===0){e.ui.notify(o("\u5F53\u524D\u6CA1\u6709\u53EF\u7528\u7684\u4E91\u7AEF\u6280\u80FD\uFF08\u672A\u767B\u5F55\uFF0C\u6216\u670D\u52A1\u7AEF\u76EE\u5F55\u4E3A\u7A7A\uFF09\u3002"),"info");return}e.ui.notify(`${o("\u4E91\u7AEF\u6280\u80FD")} (${c.length})
18
+ `+c.map(a=>` ${a.name}${a.version?` v${a.version}`:""} \u2014 ${a.description}`).join(`
19
+ `),"info")},"handler")}),u.registerCommand("skill",{description:o("\u7BA1\u7406\u672C\u5730\u6280\u80FD\uFF08list | show <name> | add | remove <name>\uFF09\uFF1B/skills \u67E5\u770B\u4E91\u7AEF\u6280\u80FD"),getArgumentCompletions:n(s=>{const e=s.trimStart(),a=e.indexOf(" ");if(a===-1)return["list","add","remove","show"].filter(i=>i.startsWith(e)).map(i=>({value:`${i} `,label:i}));const F=e.slice(0,a),l=e.slice(a+1);return(F==="show"||F==="remove")&&!l.includes(" ")?su(process.cwd()).filter(i=>i.name.startsWith(l)).map(i=>({value:`${F} ${i.name}`,label:i.description.slice(0,80)})):null},"getArgumentCompletions"),handler:n(async(s,e)=>lu(s,e),"handler")})}d(N,"fe"),n(N,"default");export{y as SKILL_PRECEDENCE_NOTE,H as SKILL_SEARCH_SLOT,R as SKILL_TEXT_SLOT,N as default,w as hostSkillsFromCommands};
@@ -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,31 @@
1
+ {
2
+ "name": "@dalcode/dal-statusline",
3
+ "version": "1.0.40",
4
+ "private": true,
5
+ "description": "A scriptable status line under the footer: a template or a command of the user's choosing. Grown from the status-line and custom-footer extension examples.",
6
+ "type": "module",
7
+ "main": "./src/index.js",
8
+ "exports": {
9
+ ".": "./src/index.js",
10
+ "./package.json": "./package.json"
11
+ },
12
+ "files": [
13
+ "src"
14
+ ],
15
+ "pi": {
16
+ "extensions": [
17
+ "./src/index.js"
18
+ ]
19
+ },
20
+ "dependencies": {
21
+ "@dalcode/dal-pi-kit": "1.0.40"
22
+ },
23
+ "peerDependencies": {
24
+ "@earendil-works/pi-coding-agent": "^1.0.9"
25
+ },
26
+ "peerDependenciesMeta": {
27
+ "@earendil-works/pi-coding-agent": {
28
+ "optional": false
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,3 @@
1
+ var P=Object.defineProperty;var d=(e,t)=>P(e,"name",{value:t,configurable:!0});var U=Object.defineProperty,r=d((e,t)=>U(e,"name",{value:t,configurable:!0}),"u");import{spawn as K}from"node:child_process";import{existsSync as N,readFileSync as v,statSync as G}from"node:fs";import{basename as Y,dirname as q,join as S,resolve as O}from"node:path";import{declaredDataFormat as z,reportNewerDataFormat as Q,t as f,withFileLockSync as V,writeFileAtomicSync as X}from"@dalcode/dal-pi-kit";import{getAgentDir as j}from"@earendil-works/pi-coding-agent";const J="dal-statusline",I=2e3,R=1e3,W=300,H=["model","provider","thinking","cwd","dir","branch","session","input","output","tokens","cost","context"];function B(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}d(B,"D"),r(B,"isRecord");function y(e){try{const t=JSON.parse(v(e,"utf8"));return B(t)?t:void 0}catch{return}}d(y,"L"),r(y,"readJson");function $(e=j()){const t=y(S(e,"settings.json"))?.dalStatusLine;return B(t)?typeof t.command=="string"&&t.command.trim()?{command:t.command.trim()}:typeof t.template=="string"&&t.template.trim()?{template:t.template.trim()}:{}:{}}d($,"B"),r($,"readStatusLineSetting");function L(e,t){const i=S(e,"settings.json");V(i,()=>{if(N(i)&&y(i)===void 0)throw new Error(`${i} is not valid JSON`);const u=y(i)??{};if(z(u)>1)throw Q(i),new Error(`${i} was written by a newer DAL`);t?u.dalStatusLine=t:delete u.dalStatusLine,X(i,`${JSON.stringify(u,null,2)}
2
+ `)})}d(L,"X"),r(L,"saveStatusLineSetting");function x(e){let t=O(e);for(;;){const i=S(t,".git");if(N(i))try{let s=i;if(G(i).isFile()){const c=/^gitdir:\s*(.+)$/m.exec(v(i,"utf8"));if(!c)return null;s=O(t,c[1].trim())}const m=v(S(s,"HEAD"),"utf8").trim(),n=/^ref:\s*refs\/heads\/(.+)$/.exec(m);return n?n[1]:m.slice(0,7)}catch{return null}const u=q(t);if(u===t)return null;t=u}}d(x,"Y"),r(x,"gitBranch");function C(e){let t=0,i=0,u=0;const s=r(n=>{n&&(t+=n.input,i+=n.output,u+=n.cost.total)},"add");for(const n of e.sessionManager.getEntries())n.type==="usage"?s(n.usage):n.type==="message"&&n.message.role==="assistant"||n.type==="message"&&n.message.role==="toolResult"?s(n.message.usage):(n.type==="branch_summary"||n.type==="compaction")&&n.usage&&s(n.usage);const m=e.getContextUsage();return{model:e.model?{id:e.model.id,provider:e.model.provider}:null,thinking:e.thinkingLevel??null,cwd:e.cwd,dir:Y(e.cwd),branch:x(e.cwd),session:{id:e.sessionManager.getSessionId(),name:e.sessionManager.getSessionName()??null},tokens:{input:t,output:i},cost:u,context:{percent:m?.percent??null}}}d(C,"q"),r(C,"collectStatus");function D(e){return e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(e<1e4?1:0)}k`:`${(e/1e6).toFixed(1)}M`}d(D,"b"),r(D,"compact");function k(e,t){const i={model:t.model?.id??"",provider:t.model?.provider??"",thinking:t.thinking??"",cwd:t.cwd,dir:t.dir,branch:t.branch??"",session:t.session.name??t.session.id.slice(0,8),input:D(t.tokens.input),output:D(t.tokens.output),tokens:D(t.tokens.input+t.tokens.output),cost:`$${t.cost.toFixed(3)}`,context:t.context.percent===null?"?":`${t.context.percent.toFixed(0)}%`};return e.replace(/\{(\w+)\}/g,(u,s)=>s in i?i[s]:u)}d(k,"z"),r(k,"renderTemplate");function w(e){return(e.split(/\r?\n/).find(t=>t.trim())??"").replace(/\u001b(?!\[[0-9;]*m)/g,"").replace(/[\u0000-\u0008\u000b-\u001a\u001c-\u001f\u007f]/g,"").slice(0,W)}d(w,"A"),r(w,"cleanLine");function b(e,t,i=I){return new Promise(u=>{const s=K(e,{shell:!0,cwd:t.cwd,stdio:["pipe","pipe","ignore"],windowsHide:!0});let m="";const n=setTimeout(()=>{s.kill("SIGKILL"),u(void 0)},i);s.stdout.setEncoding("utf8"),s.stdout.on("data",c=>{m.length<4096&&(m+=c)}),s.on("error",()=>{clearTimeout(n),u(void 0)}),s.on("close",c=>{clearTimeout(n),u(c===0?w(m):void 0)}),s.stdin.on("error",()=>{}),s.stdin.end(JSON.stringify(t))})}d(b,"Q"),r(b,"runStatusCommand");function _(e){return[e.command?`${f("\u5F53\u524D\uFF1A\u547D\u4EE4")} ${e.command}`:e.template?`${f("\u5F53\u524D\uFF1A\u6A21\u677F")} ${e.template}`:f("\u5F53\u524D\uFF1A\u9ED8\u8BA4\uFF08\u5E95\u90E8\u72B6\u6001\u680F\u5DF2\u663E\u793A\u76EE\u5F55\u3001\u5206\u652F\u3001\u7528\u91CF\u3001\u8D39\u7528\u548C\u6A21\u578B\uFF09"),"",f("\u7528\u6CD5\uFF1A/statusline <\u6A21\u677F> | /statusline command <\u547D\u4EE4> | /statusline off"),`${f("\u6A21\u677F\u5360\u4F4D\u7B26\uFF1A")}${H.map(t=>`{${t}}`).join(" ")}`,f("\u547D\u4EE4\u4F1A\u4ECE\u6807\u51C6\u8F93\u5165\u6536\u5230 JSON\uFF08\u6A21\u578B\u3001\u76EE\u5F55\u3001\u5206\u652F\u3001\u4F1A\u8BDD\u3001\u7528\u91CF\u3001\u8D39\u7528\u3001\u4E0A\u4E0B\u6587\uFF09\uFF0C\u663E\u793A\u5B83\u8F93\u51FA\u7684\u7B2C\u4E00\u884C\u3002"),f("\u4F8B\uFF1A/statusline {model} \xB7 {cost} \xB7 {branch}")].join(`
3
+ `)}d(_,"C"),r(_,"helpText");function T(e={}){return r(function(t){const i=e.agentDir??(()=>j());let u={},s=0,m=!1,n,c,A,E=!1;const M=r(a=>{if(E)return!1;try{return a.mode,!0}catch{return E=!0,!1}},"usable"),h=r((a,o)=>{!M(a)||o===A||(A=o,a.ui.setStatus(J,o||void 0))},"show"),p=r(async a=>{if(!M(a)||a.mode!=="tui")return;if(!u.command&&!u.template){h(a,void 0);return}const o=s+R-Date.now();if(m||o>0){n=a,!c&&!m&&(c=setTimeout(()=>{c=void 0;const l=n;n=void 0,l&&p(l)},Math.max(o,0)),c.unref?.());return}m=!0,s=Date.now();try{const l=C(a);if(u.command){const F=await b(u.command,l);F!==void 0&&h(a,F)}else u.template&&h(a,w(k(u.template,l)))}finally{if(m=!1,!E&&n&&!c){const l=n;n=void 0,p(l)}}},"refresh");t.on("session_start",async(a,o)=>{E=!1,u=$(i()),A=void 0,await p(o)}),t.on("turn_end",async(a,o)=>{await p(o)}),t.on("agent_settled",async(a,o)=>{await p(o)}),t.on("model_select",async(a,o)=>{await p(o)}),t.on("thinking_level_select",async(a,o)=>{await p(o)}),t.on("session_shutdown",()=>{E=!0,c&&clearTimeout(c),c=void 0,n=void 0}),t.registerCommand("statusline",{description:f("\u81EA\u5B9A\u4E49\u5E95\u90E8\u72B6\u6001\u884C\uFF1A\u6A21\u677F\u6216\u547D\u4EE4\uFF08/statusline off \u6062\u590D\u9ED8\u8BA4\uFF09"),handler:r(async(a,o)=>{const l=a.trim();if(!l){o.ui.notify(_(u),"info");return}let F;if(l==="off"||l==="\u5173\u95ED")F=void 0;else if(/^command(\s|$)/.test(l)){const g=l.replace(/^command\s*/,"").trim();if(!g){o.ui.notify(_(u),"warning");return}F={command:g}}else F={template:l};try{L(i(),F)}catch(g){o.ui.notify(`${f("\u4FDD\u5B58\u5931\u8D25\uFF1A")}${g instanceof Error?g.message:String(g)}`,"error");return}u=F??{},s=0,await p(o),o.ui.notify(F?f("\u72B6\u6001\u884C\u5DF2\u66F4\u65B0"):f("\u72B6\u6001\u884C\u5DF2\u6062\u590D\u9ED8\u8BA4"),"info")},"handler")})},"dalStatusLine")}d(T,"V"),r(T,"createDalStatusLine");var Z=T();export{I as COMMAND_TIMEOUT_MS,R as MIN_REFRESH_MS,H as PLACEHOLDERS,J as STATUS_KEY,w as cleanLine,C as collectStatus,T as createDalStatusLine,Z as default,x as gitBranch,$ as readStatusLineSetting,k as renderTemplate,b as runStatusCommand,L as saveStatusLineSetting};