dal-code 0.1.10 → 1.0.7

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 (166) hide show
  1. package/CHANGELOG.md +67 -1
  2. package/dist/core/auth-guidance.d.ts +1 -0
  3. package/dist/core/auth-guidance.d.ts.map +1 -1
  4. package/dist/core/auth-guidance.js +6 -0
  5. package/dist/core/auth-guidance.js.map +1 -1
  6. package/dist/core/compaction/compaction.d.ts.map +1 -1
  7. package/dist/core/compaction/compaction.js +4 -7
  8. package/dist/core/compaction/compaction.js.map +1 -1
  9. package/dist/core/extensions/index.d.ts +1 -1
  10. package/dist/core/extensions/index.d.ts.map +1 -1
  11. package/dist/core/extensions/index.js.map +1 -1
  12. package/dist/core/extensions/loader.d.ts.map +1 -1
  13. package/dist/core/extensions/loader.js +13 -1
  14. package/dist/core/extensions/loader.js.map +1 -1
  15. package/dist/core/extensions/runner.d.ts.map +1 -1
  16. package/dist/core/extensions/runner.js +47 -48
  17. package/dist/core/extensions/runner.js.map +1 -1
  18. package/dist/core/extensions/types.d.ts +46 -43
  19. package/dist/core/extensions/types.d.ts.map +1 -1
  20. package/dist/core/extensions/types.js.map +1 -1
  21. package/dist/core/keybindings.d.ts +10 -0
  22. package/dist/core/keybindings.d.ts.map +1 -1
  23. package/dist/core/keybindings.js +13 -0
  24. package/dist/core/keybindings.js.map +1 -1
  25. package/dist/core/tools/bash.d.ts +3 -1
  26. package/dist/core/tools/bash.d.ts.map +1 -1
  27. package/dist/core/tools/bash.js +61 -8
  28. package/dist/core/tools/bash.js.map +1 -1
  29. package/dist/core/tools/renderers/bash.d.ts.map +1 -1
  30. package/dist/core/tools/renderers/bash.js +43 -6
  31. package/dist/core/tools/renderers/bash.js.map +1 -1
  32. package/dist/dal/builtins.d.ts.map +1 -1
  33. package/dist/dal/builtins.js +1 -0
  34. package/dist/dal/builtins.js.map +1 -1
  35. package/dist/index.d.ts +1 -1
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js.map +1 -1
  38. package/dist/main.d.ts.map +1 -1
  39. package/dist/main.js +6 -0
  40. package/dist/main.js.map +1 -1
  41. package/dist/modes/interactive/components/assistant-message.d.ts +12 -0
  42. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  43. package/dist/modes/interactive/components/assistant-message.js +22 -1
  44. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  45. package/dist/modes/interactive/components/footer.d.ts +2 -0
  46. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  47. package/dist/modes/interactive/components/footer.js +24 -7
  48. package/dist/modes/interactive/components/footer.js.map +1 -1
  49. package/dist/modes/interactive/components/tool-execution.d.ts +39 -2
  50. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  51. package/dist/modes/interactive/components/tool-execution.js +200 -29
  52. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  53. package/dist/modes/interactive/interactive-mode.d.ts +35 -0
  54. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  55. package/dist/modes/interactive/interactive-mode.js +177 -23
  56. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  57. package/dist/modes/interactive/theme/dark.json +1 -1
  58. package/dist/modes/interactive/theme/light.json +1 -1
  59. package/dist/modes/interactive/tui-renderer.d.ts.map +1 -1
  60. package/dist/modes/interactive/tui-renderer.js +2 -2
  61. package/dist/modes/interactive/tui-renderer.js.map +1 -1
  62. package/dist/node_modules/@dalcode/dal-bridge/package.json +3 -3
  63. package/dist/node_modules/@dalcode/dal-gateway/package.json +3 -3
  64. package/dist/node_modules/@dalcode/dal-guard/package.json +5 -5
  65. package/dist/node_modules/@dalcode/dal-halo/package.json +2 -2
  66. package/dist/node_modules/@dalcode/dal-lang/package.json +4 -4
  67. package/dist/node_modules/@dalcode/dal-lsp/package.json +4 -4
  68. package/dist/node_modules/@dalcode/dal-mcp/package.json +9 -6
  69. package/dist/node_modules/@dalcode/dal-mcp/src/add-wizard.ts +142 -0
  70. package/dist/node_modules/@dalcode/dal-mcp/src/command-parser.ts +218 -0
  71. package/dist/node_modules/@dalcode/dal-mcp/src/config-edit.ts +99 -0
  72. package/dist/node_modules/@dalcode/dal-mcp/src/index.ts +161 -18
  73. package/dist/node_modules/@dalcode/dal-mcp/src/stdio-client.ts +8 -3
  74. package/dist/node_modules/@dalcode/dal-office/LICENSE +21 -0
  75. package/dist/node_modules/@dalcode/dal-office/package.json +37 -0
  76. package/dist/node_modules/@dalcode/dal-office/src/extract/csv.ts +84 -0
  77. package/dist/node_modules/@dalcode/dal-office/src/extract/index.ts +111 -0
  78. package/dist/node_modules/@dalcode/dal-office/src/extract/ooxml.ts +109 -0
  79. package/dist/node_modules/@dalcode/dal-office/src/extract/pdf.ts +43 -0
  80. package/dist/node_modules/@dalcode/dal-office/src/index.ts +43 -0
  81. package/dist/node_modules/@dalcode/dal-office/src/paths.ts +107 -0
  82. package/dist/node_modules/@dalcode/dal-office/src/render/chart.ts +111 -0
  83. package/dist/node_modules/@dalcode/dal-office/src/render/docx.ts +155 -0
  84. package/dist/node_modules/@dalcode/dal-office/src/render/pptx.ts +386 -0
  85. package/dist/node_modules/@dalcode/dal-office/src/render/xlsx.ts +99 -0
  86. package/dist/node_modules/@dalcode/dal-office/src/scenes.ts +197 -0
  87. package/dist/node_modules/@dalcode/dal-office/src/scratchpad.ts +49 -0
  88. package/dist/node_modules/@dalcode/dal-office/src/themes.ts +240 -0
  89. package/dist/node_modules/@dalcode/dal-office/src/tools/chart-generate.ts +122 -0
  90. package/dist/node_modules/@dalcode/dal-office/src/tools/doc-generate.ts +123 -0
  91. package/dist/node_modules/@dalcode/dal-office/src/tools/drawio-generate.ts +99 -0
  92. package/dist/node_modules/@dalcode/dal-office/src/tools/md-generate.ts +76 -0
  93. package/dist/node_modules/@dalcode/dal-office/src/tools/ppt-generate.ts +106 -0
  94. package/dist/node_modules/@dalcode/dal-office/src/tools/ppt-plan.ts +91 -0
  95. package/dist/node_modules/@dalcode/dal-office/src/tools/read-file.ts +71 -0
  96. package/dist/node_modules/@dalcode/dal-office/src/tools/shared.ts +54 -0
  97. package/dist/node_modules/@dalcode/dal-office/src/tools/sheet-generate.ts +101 -0
  98. package/dist/node_modules/@dalcode/dal-office/src/truncate.ts +27 -0
  99. package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.d.ts.map +1 -1
  100. package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +237 -0
  101. package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js.map +1 -1
  102. package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
  103. package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.ts +326 -0
  104. package/dist/node_modules/@dalcode/dal-skills/package.json +6 -5
  105. package/dist/node_modules/@dalcode/dal-skills/src/discover.ts +101 -0
  106. package/dist/node_modules/@dalcode/dal-skills/src/index.ts +100 -1
  107. package/dist/node_modules/@dalcode/dal-skills/src/install.ts +140 -0
  108. package/dist/node_modules/@dalcode/dal-skills/src/manage.ts +446 -0
  109. package/dist/node_modules/@dalcode/dal-skills/src/packages.ts +130 -0
  110. package/dist/node_modules/@dalcode/dal-subagent/package.json +6 -6
  111. package/dist/node_modules/@dalcode/dal-subagent/src/index.ts +46 -4
  112. package/dist/node_modules/@dalcode/dal-telemetry/package.json +3 -3
  113. package/dist/node_modules/@dalcode/deepailab/package.json +4 -4
  114. package/dist/node_modules/@dalcode/deepailab/src/index.ts +7 -1
  115. package/dist/node_modules/@dalcode/deepailab/src/model-defaults.ts +42 -6
  116. package/dist/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
  117. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  118. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
  119. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
  120. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
  121. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/kimi-coding.json +1 -1
  122. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/mistral.json +1 -1
  123. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
  124. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
  125. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  126. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-cn.json +1 -1
  127. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -1
  128. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  129. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/zai-coding-cn.json +1 -1
  130. package/dist/node_modules/@earendil-works/pi-ai/package.json +2 -2
  131. package/dist/node_modules/@earendil-works/pi-client/package.json +2 -2
  132. package/dist/node_modules/@earendil-works/pi-protocol/package.json +1 -1
  133. package/dist/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  134. package/dist/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts.map +1 -1
  135. package/dist/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +3 -1
  136. package/dist/node_modules/@earendil-works/pi-tui/dist/autocomplete.js.map +1 -1
  137. package/dist/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts.map +1 -1
  138. package/dist/node_modules/@earendil-works/pi-tui/dist/components/input.js +3 -1
  139. package/dist/node_modules/@earendil-works/pi-tui/dist/components/input.js.map +1 -1
  140. package/dist/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts.map +1 -1
  141. package/dist/node_modules/@earendil-works/pi-tui/dist/fuzzy.js +23 -22
  142. package/dist/node_modules/@earendil-works/pi-tui/dist/fuzzy.js.map +1 -1
  143. package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts +4 -3
  144. package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts.map +1 -1
  145. package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js +4 -2
  146. package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js.map +1 -1
  147. package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
  148. package/dist/utils/changelog.d.ts +37 -4
  149. package/dist/utils/changelog.d.ts.map +1 -1
  150. package/dist/utils/changelog.js +80 -17
  151. package/dist/utils/changelog.js.map +1 -1
  152. package/dist/utils/clipboard.d.ts.map +1 -1
  153. package/dist/utils/clipboard.js +13 -1
  154. package/dist/utils/clipboard.js.map +1 -1
  155. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  156. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  157. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  158. package/examples/extensions/gondolin/package-lock.json +2 -2
  159. package/examples/extensions/gondolin/package.json +1 -1
  160. package/examples/extensions/sandbox/package-lock.json +2 -2
  161. package/examples/extensions/sandbox/package.json +1 -1
  162. package/examples/extensions/with-deps/package-lock.json +2 -2
  163. package/examples/extensions/with-deps/package.json +1 -1
  164. package/examples/plugins/pi-example-plugin/package.json +1 -1
  165. package/npm-shrinkwrap.json +1489 -3
  166. package/package.json +8 -2
@@ -83,6 +83,10 @@ const EN_CATALOG: Record<string, string> = {
83
83
  "输入 /login 登录 DeepAILab 账号即可开始使用。":
84
84
  "Run /login to sign in with your DeepAILab account and get started.",
85
85
  "当前没有可用模型。": "No models available. ",
86
+ "登录未完成(验证码已过期),原有登录不受影响。可再次 /login。":
87
+ "Login not completed — the device code expired. Your existing login is unaffected; run /login again.",
88
+ "已更新到 v{version},": "Updated to v{version} — ",
89
+ " 查看更新内容。": " shows what changed.",
86
90
  "尚未选择模型。": "No model selected.",
87
91
  "然后用 /model 选择一个模型。": "Then use /model to select a model.",
88
92
  所选模型: "the selected model",
@@ -137,12 +141,86 @@ const EN_CATALOG: Record<string, string> = {
137
141
  "加载技能失败:": "Could not load skill: ",
138
142
  "查看可用的 DeepAILab 云端技能": "List the available DeepAILab cloud skills",
139
143
  "服务端返回了意外的 304": "the service answered 304 unexpectedly",
144
+ 账号里有: "Your account has ",
145
+ " 个扩展本机还没装,/install 可直接安装。": " extension(s) not installed here — /install sets them up in-session.",
146
+ 查看账号推荐的扩展: "List the extensions recommended on your account",
147
+ "账号里的扩展都已安装。": "Every extension on your account is already installed.",
148
+ "账号推荐、本机尚未安装的扩展:": "Recommended on your account, not installed here:",
149
+ "安装扩展(<npm:包名|git:...> [--local];无参数从账号推荐中选择)":
150
+ "Install an extension (<npm:pkg|git:...> [--local]; no arguments picks from your account's recommendations)",
151
+ 安装到当前项目: "Install into the current project",
152
+ "选择要安装的扩展:": "Pick an extension to install: ",
153
+ "正在安装扩展,请稍候…": "Installing the extension, hang on…",
154
+ "扩展安装失败:": "Extension install failed: ",
155
+ "保留该扩展?": "Keep this extension?",
156
+ "(项目级)": " (project)",
157
+ "(用户级)": " (user)",
158
+ "声明的权限:": "Declared permissions: ",
159
+ "已取消安装。": "Install cancelled.",
160
+ "移除未保留的扩展失败,可稍后手动清理:": "Failed to remove the declined extension, clean it up later: ",
161
+ "已安装扩展:": "Installed extension: ",
162
+ "锁定提交:": "Pinned commit: ",
163
+ "该扩展声明了额外权限,请留意:": "This extension declares extra permissions, review them: ",
164
+ "项目未受信任,无法安装项目级扩展。先运行 /trust 保存信任决策,再重试。":
165
+ "Project is not trusted — cannot install a project-level extension. Run /trust to save the trust decision first, then retry.",
166
+ "账号推荐的扩展都已安装。也可以用 /install <npm:包名> 直接安装。":
167
+ "All recommended extensions are installed. You can also run /install <npm:pkg> to install one directly.",
140
168
  "已拒绝账号下发的 MCP 条目(只接受 https 远程服务器):":
141
169
  "Refused an MCP entry from the account (hosted https servers only): ",
142
170
  "无法获取账号的 MCP 配置:": "Could not load the account's MCP configuration: ",
143
171
  "当前没有可用的云端技能(未登录,或服务端目录为空)。":
144
172
  "No cloud skills are available (not signed in, or the catalogue is empty).",
145
173
  云端技能: "Cloud skills",
174
+ "管理本地技能(list | show <name> | add | remove <name>);/skills 查看云端技能":
175
+ "Manage local skills (list | show <name> | add | remove <name>); /skills lists cloud skills",
176
+ "用法:/skill list | /skill show <name> | /skill add | /skill remove <name>。/skills 查看云端技能。":
177
+ "Usage: /skill list | /skill show <name> | /skill add | /skill remove <name>. /skills lists cloud skills.",
178
+ "用法:/skill add <name> -- <这个技能做什么、何时触发>(AI 起草),或 /skill add(交互式向导)":
179
+ "Usage: /skill add <name> -- <what it does and when to fire> (AI-drafted), or /skill add (interactive wizard)",
180
+ "用法:/skill remove <name> [--scope user|project|shared]":
181
+ "Usage: /skill remove <name> [--scope user|project|shared]",
182
+ "要删除的技能:": "Skill to delete:",
183
+ "确认删除该技能?": "Delete this skill?",
184
+ "删除后不可恢复。": "This cannot be undone.",
185
+ "用法:/skill show <name>": "Usage: /skill show <name>",
186
+ 本地技能: "Local skills",
187
+ "未发现本地技能。用 /skill add 创建,或把 <name>/SKILL.md 目录放进 ~/.dal/agent/skills。":
188
+ "No local skills found. Create one with /skill add, or drop a <name>/SKILL.md directory into ~/.dal/agent/skills.",
189
+ "未找到本地技能:": "No such local skill: ",
190
+ "读取技能失败:": "Could not read the skill: ",
191
+ "技能名称无效(仅小写字母、数字、-,≤64 字符):":
192
+ "Invalid skill name (lowercase letters, digits and '-' only, max 64 chars): ",
193
+ "技能名称(仅小写字母、数字、-):": "Skill name (lowercase letters, digits, '-' only):",
194
+ "描述这个技能:要做什么、何时触发、关键步骤(可粘贴现有提示词,交给 AI 整理)":
195
+ "Describe the skill: what it does, when it fires, key steps (paste an existing prompt and let AI tidy it up)",
196
+ "技能内容:": "Skill content:",
197
+ "AI 起草/整理(推荐)": "AI draft / tidy up (recommended)",
198
+ "我自己手写(空白模板)": "I'll write it myself (blank template)",
199
+ "确认/修改技能内容(提交保存,Esc 取消)": "Review/edit the skill (submit to save, Esc cancels)",
200
+ "用户级(~/.dal/agent/skills,本机所有项目可用)": "User-level (~/.dal/agent/skills, all projects on this machine)",
201
+ "项目级(.dal/skills,仅当前项目,需已信任)": "Project-level (.dal/skills, this project only, requires trust)",
202
+ "项目未受信任,无法写入项目级 .dal/skills。先运行 /trust 保存信任决策,再重试。":
203
+ "This project is not trusted; refusing to write .dal/skills. Save a trust decision with /trust first, then retry.",
204
+ "没有可用的当前模型,无法 AI 起草;请改为手写技能内容。":
205
+ "No current model available; AI drafting is off. Write the skill by hand instead.",
206
+ "当前模型未配置鉴权,无法 AI 起草;请改为手写技能内容。":
207
+ "The current model has no configured auth; AI drafting is off. Write the skill by hand instead.",
208
+ "模型没有返回内容,请重试或手写技能内容。": "The model returned nothing; retry or write the skill by hand.",
209
+ "AI 起草失败:": "AI drafting failed: ",
210
+ "已改为空白模板。": " Switched to the blank template.",
211
+ "<!-- 在这里写技能正文:给 AI 的分步指令 -->": "<!-- Skill body goes here: step-by-step instructions for the AI -->",
212
+ "技能缺少 description(frontmatter 字段),请补充一句“做什么、何时触发”后重试。":
213
+ "The skill is missing a description (frontmatter field); add one line saying what it does and when it fires, then retry.",
214
+ "该技能已存在于 ": "That skill already exists in ",
215
+ "。先 /skill remove,或直接编辑该目录。": ". Remove it with /skill remove first, or edit the directory directly.",
216
+ "已创建技能:": "Created skill: ",
217
+ "已保存,正在重载技能;调用方式:": "Saved; reloading skills — call it as ",
218
+ "(已保存,正在重载)": " (saved, reloading)",
219
+ "已删除技能:": "Deleted skill: ",
220
+ "AI 正在起草技能,请稍候…": "AI is drafting the skill, hang on…",
221
+ "--scope 仅支持 user、project 或 shared:": "--scope only supports user, project or shared: ",
222
+ "环境变量(KEY=VALUE)": "environment variable (KEY=VALUE)",
223
+ "请求头(Key: Value)": "header (Key: Value)",
146
224
  已激活: "active",
147
225
  未激活: "inactive",
148
226
  至: "until",
@@ -219,11 +297,21 @@ const EN_CATALOG: Record<string, string> = {
219
297
  已选择: "Selected",
220
298
  上下文: "context",
221
299
  自动压缩: "auto-compact",
300
+ 步: "steps",
301
+ 还没有工具调用可以展开: "No tool call to expand yet",
302
+ 工具调用: "Tool call",
303
+ 展开: "expand",
304
+ 已展开: "expanded",
305
+ 已收起: "collapsed",
222
306
  思考关: "thinking off",
223
307
  思考: "thinking",
224
308
  "发现新版本 ": "New version ",
225
309
  ",运行 ": " available. Run ",
226
310
  "更新日志: ": "Changelog: ",
311
+ "没有找到更新记录。": "No changelog entries found.",
312
+ "另有 ": "Plus ",
313
+ " 段继承自上游 Pi 的历史记录,仅保留在随包发出的 CHANGELOG.md 中,此处不列出。":
314
+ " sections of inherited upstream Pi history, kept in the shipped CHANGELOG.md and not listed here.",
227
315
  登录: "Sign in",
228
316
  快捷键: "Shortcuts",
229
317
  语言: "Language",
@@ -282,6 +370,65 @@ const EN_CATALOG: Record<string, string> = {
282
370
  "最近错误:": "Last error: ",
283
371
  "已重新连接:": "Reconnected: ",
284
372
  "重连失败:": "Reconnect failed: ",
373
+ "MCP 服务器(": "MCP servers (",
374
+ "):": "):",
375
+ ",": ", ",
376
+ "查看/管理 MCP 服务器连接(list | add | remove | status <server> | reconnect <server>)":
377
+ "View/manage MCP server connections (list | add | remove | status <server> | reconnect <server>)",
378
+ "用法:/mcp list | /mcp add | /mcp remove <name> | /mcp status <server> | /mcp reconnect <server>":
379
+ "Usage: /mcp list | /mcp add | /mcp remove <name> | /mcp status <server> | /mcp reconnect <server>",
380
+ '用法:/mcp add <name> -- <command> [args...](stdio)或 /mcp add <name> <url>(http);选项:--scope user|project、--env KEY=VALUE、--header "Key: Value"':
381
+ 'Usage: /mcp add <name> -- <command> [args...] (stdio) or /mcp add <name> <url> (http); options: --scope user|project, --env KEY=VALUE, --header "Key: Value"',
382
+ "用法:/mcp remove <name> [--scope user|project]": "Usage: /mcp remove <name> [--scope user|project]",
383
+ "引号未闭合。": "Unclosed quote.",
384
+ "服务器名称无效:": "Invalid server name: ",
385
+ "(仅允许字母、数字、-、_)": " (only letters, digits, '-', '_' allowed)",
386
+ "--scope 仅支持 user 或 project:": "--scope only supports user or project: ",
387
+ 无效的: "Invalid ",
388
+ "格式:": " format: ",
389
+ " 缺少值。": " is missing a value.",
390
+ "--url 不能与位置参数同时使用。": "--url cannot be combined with positional arguments.",
391
+ "--env 仅适用于 stdio 服务器。": "--env only applies to stdio servers.",
392
+ "--header 仅适用于 http 服务器。": "--header only applies to http servers.",
393
+ "未知参数:": "Unknown flag: ",
394
+ "URL 无效:": "Invalid URL: ",
395
+ "URL 仅支持 http(s):": "URL only supports http(s): ",
396
+ "JSON 解析失败,拒绝修改以避免覆盖现有配置。":
397
+ "failed to parse as JSON; refusing to edit it and risk clobbering your config. ",
398
+ "顶层不是 JSON 对象,拒绝修改。": "top level is not a JSON object; refusing to edit.",
399
+ '"mcpServers" 不是对象,拒绝修改。': '"mcpServers" is not an object; refusing to edit.',
400
+ "该名称已存在于 ": "That name already exists in ",
401
+ ":": ": ",
402
+ "。先 /mcp remove,或直接编辑该文件。": ". Remove it with /mcp remove first, or edit the file directly.",
403
+ "项目未受信任,无法写入项目级 .dal/mcp.json。先运行 /trust 保存信任决策,再重试。":
404
+ "This project is not trusted; refusing to write .dal/mcp.json. Save a trust decision with /trust first, then retry.",
405
+ "已添加 MCP 服务器:": "Added MCP server: ",
406
+ "已保存到 ": "Saved to ",
407
+ ",但连接失败:": " but the connection failed: ",
408
+ "添加失败:": "Failed to add: ",
409
+ "已从 ": "Removed MCP server ",
410
+ " 移除 MCP 服务器:": " from ",
411
+ "。连接已断开,其工具将在重启会话后消失。": ". Disconnected; its tools disappear after the session restarts.",
412
+ "未找到本地配置条目:": "No local config entry found: ",
413
+ "。账号下发的服务器不可删除,可在用户级 mcp.json 写入 disabled: true 屏蔽。":
414
+ ". Account-provisioned servers cannot be deleted; shadow them with disabled: true in the user-level mcp.json.",
415
+ "要添加的 MCP 服务器类型:": "MCP server type to add:",
416
+ "stdio(本地命令)": "stdio (local command)",
417
+ "http(远程 URL)": "http (remote URL)",
418
+ "服务器名称(仅字母、数字、-、_):": "Server name (letters, digits, '-', '_' only):",
419
+ "服务器 URL(http(s)://…):": "Server URL (http(s)://...):",
420
+ "请求头(可选,逗号分隔 Key: Value):": "Headers (optional, comma-separated Key: Value):",
421
+ "无效的请求头格式(Key: Value):": "Invalid header format (Key: Value): ",
422
+ "启动命令(含参数,如 npx -y chrome-devtools-mcp@latest):":
423
+ "Launch command with args, e.g. npx -y chrome-devtools-mcp@latest:",
424
+ "命令不能为空。": "Command cannot be empty.",
425
+ "环境变量(可选,逗号分隔 KEY=VALUE):": "Environment variables (optional, comma-separated KEY=VALUE):",
426
+ "无效的环境变量格式(KEY=VALUE):": "Invalid env format (KEY=VALUE): ",
427
+ "保存位置:": "Save location:",
428
+ "用户级 ~/.dal/agent/mcp.json(本机所有项目可用)":
429
+ "User-level ~/.dal/agent/mcp.json (all projects on this machine)",
430
+ "项目级 .dal/mcp.json(仅当前项目,需已信任)": "Project-level .dal/mcp.json (this project only, requires trust)",
431
+ "确认保存该 MCP 服务器?": "Save this MCP server?",
285
432
 
286
433
  // dal-guard: interactive approval gate for risky tool calls.
287
434
  "特权执行(sudo/doas)": "Privileged execution (sudo/doas)",
@@ -310,6 +457,185 @@ const EN_CATALOG: Record<string, string> = {
310
457
  "查看或切换 dal-guard 审批门(default | yolo)": "View or toggle the dal-guard approval gate (default | yolo)",
311
458
  "dal-guard 模式:": "dal-guard mode: ",
312
459
  " · 本次会话已允许:": " · Allowed this session: ",
460
+ // dal-office
461
+ "Markdown/README/知识库/说明文档/会议纪要/调研整理类需求用本工具,content 必须是完整正文:结构清楚、示例充分,便于阅读与沉淀。当用户说「先写提示词 / 出提示词 / 帮我构思」时属于文本输出意图:直接回复文本或用本工具产出提示词文档。":
462
+ "Use this tool for Markdown/README/knowledge-base/docs/meeting-notes/research requests; content must be the finished document — clear structure, ample examples, ready to keep. When the user says 'draft the prompt first' / 'help me think it through', that is a text-output intent: reply with text or produce a prompt document with this tool.",
463
+ "PPT 主题/用户需求": "PPT topic / user request",
464
+ "PPT 任务必须两步:先用 office_ppt_plan 规划大纲,再用 office_ppt_generate 生成 .pptx 文件,两步缺一不可。大纲要形成叙事链(背景/目标 → 分析/拆解 → 方案/价值 → 落地/结论),首页做封面、末页做结论或下一步行动。":
465
+ "PPT tasks take two steps: plan the outline with office_ppt_plan first, then render the .pptx with office_ppt_generate — both are required. The outline should form a narrative arc (background/goals → analysis → solution/value → landing/conclusion), with a cover as the first page and a conclusion or next steps at the end.",
466
+ "PPT 标题(可选,默认取主题)": "PPT title (optional; defaults to the topic)",
467
+ "PPT 标题,需与 office_ppt_plan 的大纲标题一致": "PPT title; must match the outline title from office_ppt_plan",
468
+ "Word/文档/报告/PRD/方案/总结类需求用本工具。sections 必须构成可直接交付的完整文档:章节内容具体有深度,禁止空泛提纲、模板占位符或「待补充」;缺少具体数据时按场景补出合理的示例数据、角色、阶段、风险与收益。":
469
+ "Use this tool for Word/document/report/PRD/proposal/summary requests. The sections must form a deliverable-ready document: concrete, substantive content — no bare outlines, template placeholders, or 'TBD'; when real data is missing, fill in plausible figures, roles, phases, risks, and benefits for the scene.",
470
+ "content 不能为空": "content must not be empty",
471
+ "excel/表格/排期/预算/数据分析/台账类需求用本工具。表头要专业可执行,数据要具体真实:不要整列「示例1/示例2」式占位;缺少真实数据时按主题补出贴合业务场景的合理数据,并保持同表口径一致。":
472
+ "Use this tool for Excel/spreadsheet/schedule/budget/data-analysis/ledger requests. Headers must be professional and actionable, data concrete and realistic — no columns of 'Sample 1/Sample 2' placeholders; when real data is missing, fill in plausible business data consistent within each sheet.",
473
+ "labels 与 values 长度必须一致(当前 {labels} / {values}),请修正后重试。":
474
+ "labels and values must have the same length (got {labels} / {values}). Fix them and retry.",
475
+ "office_chart_generate - 生成 ECharts 图表(趋势/对比/占比/排名/漏斗/仪表盘)":
476
+ "office_chart_generate - render an ECharts chart (trend/comparison/share/ranking/funnel/gauge)",
477
+ "office_doc_generate - 生成结构化 Word 文档(报告/计划/总结/文章/PRD)":
478
+ "office_doc_generate - generate a structured Word document (report/plan/summary/article/PRD)",
479
+ "office_drawio_generate - 生成 draw.io 可编辑图表(流程/架构/泳道/拓扑/ER/思维导图)":
480
+ "office_drawio_generate - generate an editable draw.io diagram (flow/architecture/swimlane/topology/ER/mindmap)",
481
+ "office_md_generate - 生成 Markdown 文档(README/知识库/纪要/调研/操作手册)":
482
+ "office_md_generate - generate a Markdown document (README/knowledge base/notes/research/manual)",
483
+ "office_ppt_generate - 生成 .pptx 文件(生成 PPT 的第二步,需要先有 office_ppt_plan 大纲)":
484
+ "office_ppt_generate - render a .pptx file (step two of the PPT pipeline; needs an office_ppt_plan outline first)",
485
+ "office_ppt_plan - 规划 PPT 大纲(生成 PPT 的第一步,之后必须调用 office_ppt_generate)":
486
+ "office_ppt_plan - plan the PPT outline (step one; office_ppt_generate must follow)",
487
+ "office_read_file - 读取 docx/pptx/xlsx/pdf/csv 等 office 文件的文本内容":
488
+ "office_read_file - read text content from office files (docx/pptx/xlsx/pdf/csv, ...)",
489
+ "office_sheet_generate - 生成结构化 Excel 表格(分析/排期/预算/台账)":
490
+ "office_sheet_generate - generate structured Excel sheets (analysis/schedule/budget/ledger)",
491
+ "path 不能为空": "path must not be empty",
492
+ "sections 不能为空": "sections must not be empty",
493
+ "title 不能为空": "title must not be empty",
494
+ "topic 不能为空": "topic must not be empty",
495
+ 一句话说明本文档的价值: "One sentence on what this document delivers",
496
+ "下一步:调用 office_ppt_generate(title 保持一致)生成 .pptx 文件。":
497
+ "Next: call office_ppt_generate (keep the title unchanged) to render the .pptx file.",
498
+ "不是有效的 draw.io XML:需要包含 <mxGraphModel> 或 <mxfile> 根元素,请修正后重试。":
499
+ "Not valid draw.io XML: it must contain an <mxGraphModel> or <mxfile> root element. Fix it and retry.",
500
+ "专业产品需求文档:包含背景、目标、用户与场景、功能设计、流程说明、优先级、非功能要求、验收标准。":
501
+ "Professional PRD: background, goals, users and scenarios, feature design, flows, priorities, non-functional requirements, acceptance criteria.",
502
+ "主题风格:default 多彩 / business 商务 / tech 深色科技 / warm 暖色 / minimal 极简":
503
+ "Theme: default (colorful) / business / tech (dark) / warm / minimal",
504
+ "内联大纲;本会话已调用 office_ppt_plan 时可省略":
505
+ "Inline outline; can be omitted when office_ppt_plan has run in this session",
506
+ "列名,要专业可执行:负责人、阶段、金额、转化率、开始/结束日期等":
507
+ "Column names, professional and actionable: owner, phase, amount, conversion rate, start/end date, etc.",
508
+ "可执行工作计划:包含目标、范围、阶段安排、责任分工、资源需求、风险评估、验收标准。":
509
+ "Actionable work plan: goals, scope, phases, responsibilities, resourcing, risk assessment, acceptance criteria.",
510
+ "图表主题/用户需求": "Chart topic / user request",
511
+ "图表标题(同时用作文件名)": "Chart title (also used as the file name)",
512
+ "图表渲染失败:{error}": "Chart rendering failed: {error}",
513
+ "图表类型,不确定时默认 bar": "Chart type; defaults to bar when unsure",
514
+ "图表类型:flowchart 流程图 / architecture 架构图 / swimlane 泳道图 / topology 拓扑图 / er 实体关系图 / mindmap 思维导图":
515
+ "Diagram type: flowchart / architecture / swimlane / topology / er / mindmap",
516
+ "图表说明,写进结果便于用户理解": "Chart description, included in the result for clarity",
517
+ "场景判断:": "Scene: ",
518
+ "完整 Markdown 正文(不是提纲),从一级标题开始":
519
+ "Full Markdown body (not an outline), starting with a level-1 heading",
520
+ "完整 draw.io XML(mxGraphModel 或 mxfile 格式),使用合理布局坐标、箭头表达关系、中文标签":
521
+ "Full draw.io XML (mxGraphModel or mxfile format) with sensible layout coordinates, arrows for relationships, Chinese labels",
522
+ "完整页面大纲,5-10 页为宜:首页做封面、中间形成叙事链、末页做结论/建议/下一步":
523
+ "Full slide outline, 5-10 slides: cover first, a narrative arc in between, conclusion/recommendations/next steps at the end",
524
+ "对话中出现数据对比、趋势、占比、排名或漏斗诉求时用本工具,即使用户没有要求 PPT 或 Excel。labels 与 values 必须等长;values 是纯数字;数据要有业务含义,缺少真实数据时补出贴合场景的合理数据。":
525
+ "Use this tool whenever the conversation calls for comparison, trends, shares, rankings, or funnels — even if the user never asked for PPT or Excel. labels and values must be equal length; values are plain numbers; data should carry business meaning, filled with plausible scene-appropriate data when real data is missing.",
526
+ "已生成 Excel《{title}》,共 {tables} 个工作表、{rows} 行数据。\\n文件:{file}\\n{scene}":
527
+ 'Generated Excel "{title}": {tables} worksheet(s), {rows} data rows.\\nFile: {file}\\n{scene}',
528
+ "已生成 Markdown 文档《{title}》({chars} 字)。\\n文件:{file}\\n{scene}":
529
+ 'Generated Markdown document "{title}" ({chars} chars).\\nFile: {file}\\n{scene}',
530
+ "已生成 PPT《{title}》,共 {count} 页(theme:{theme})。\\n文件:{file}\\n可直接用 PowerPoint / WPS 打开继续编辑。":
531
+ 'Generated PPT "{title}" with {count} slides (theme: {theme}).\\nFile: {file}\\nOpen it in PowerPoint / WPS to keep editing.',
532
+ "已生成 Word 文档《{title}》({format}),共 {count} 个章节。\\n文件:{file}\\n{scene}":
533
+ 'Generated Word document "{title}" ({format}) with {count} sections.\\nFile: {file}\\n{scene}',
534
+ "已生成《{title}》{type} 图表,共 3 个文件:\\n{files}\\n其中 .svg 可直接插入文档或浏览器查看,.json 保留图表配置便于二次修改。":
535
+ 'Generated {type} chart "{title}", 3 files:\\n{files}\\nThe .svg drops straight into documents or a browser; the .json keeps the chart option for later tweaks.',
536
+ "已生成《{topic}》{type}。\\n文件:{file}\\n可用 draw.io / diagrams.net 打开继续编辑。{scene}":
537
+ 'Generated {type} "{topic}".\\nFile: {file}\\nOpen it in draw.io / diagrams.net to keep editing.{scene}',
538
+ "已规划 PPT《{title}》,共 {count} 页大纲,已存入本会话。":
539
+ 'Planned PPT "{title}": {count} slides outlined and stored for this session.',
540
+ "已读取 {parser} 文件({meta}),正文如下:\\n\\n{text}":
541
+ "Read {parser} file ({meta}); content follows:\\n\\n{text}",
542
+ "当用户说「先写提示词 / 先出方案 / 帮我构思 / 先规划一下」时,当前是文本规划意图:直接回复文本或用 office_md_generate,不要调用本工具生成最终产物。":
543
+ "When the user says 'draft the prompt first' / 'propose an approach first' / 'help me think it through' / 'plan it first', that is a text-planning intent: reply with text or use office_md_generate instead of rendering the final artifact.",
544
+ "指标/系列名称": "Metric / series name",
545
+ "支持的格式:": "Supported formats: ",
546
+ "数值,纯数字,不带单位或百分号": "Values as plain numbers, no units or percent signs",
547
+ "数据行,要具体真实有意义,不要占位符": "Data rows: concrete, realistic, meaningful — no placeholders",
548
+ "整体说明:这套表格适合怎样使用或分析": "Overall note: how to use or analyze these sheets",
549
+ "文件不存在或不是普通文件:{path}": "File does not exist or is not a regular file: {path}",
550
+ "文件解析失败:{error}": "Failed to parse file: {error}",
551
+ 文档标题: "Document title",
552
+ "文档标题(同时用作文件名)": "Document title (also used as the file name)",
553
+ "文档类型:report 报告 / plan 计划 / summary 总结 / article 文章 / prd 需求文档":
554
+ "Document type: report / plan / summary / article / prd",
555
+ "文档风格:knowledge_base 知识库 / readme / guide 指南 / notes 纪要 / research 调研":
556
+ "Style: knowledge_base / readme / guide / notes / research",
557
+ "暂不支持的文件类型:": "Unsupported file type: ",
558
+ "未识别到强场景时,默认按商务化正式汇报组织,兼顾背景、分析、方案、价值与下一步。":
559
+ "No strong scene detected: default to a formal business report covering background, analysis, solution, value, and next steps.",
560
+ "本表标题(用作工作表名)": "Table title (used as the worksheet name)",
561
+ "本表说明(写入 A1 批注)": "Table note (written to the A1 comment)",
562
+ "本页标题,要具体,避免空泛": "Slide title: be specific, avoid vagueness",
563
+ "本页目标,会写入演讲者备注": "Slide goal, written into the speaker notes",
564
+ "本页要点,2-4 条,每条一句话,适合直接上屏": "Slide points, 2-4 one-liners that read well on screen",
565
+ "标题级别 1-3,默认 1": "Heading level 1-3, default 1",
566
+ "正式分析报告:包含背景、现状分析、关键问题、数据或案例支撑、结论和建议。":
567
+ "Formal analysis report: background, current state, key issues, data or case evidence, conclusions and recommendations.",
568
+ "段落文本,每段 50-150 字,可用 **粗体** 与 *斜体* 标记":
569
+ "Paragraph text, 50-150 chars each; **bold** and *italic* markers supported",
570
+ "流程图/架构图/泳道图/拓扑图/ER图/思维导图类需求用本工具。xml 要有合理布局坐标:节点不重叠、用箭头连接表达关系、用颜色区分节点类型、中文标签;布局要「对外能讲清楚」,不要把所有节点排成一行。用户缺少细节时补足合理的模块、阶段、角色或组件。":
571
+ "Use this tool for flowchart/architecture/swimlane/topology/ER/mindmap requests. The xml needs sensible layout coordinates: no overlapping nodes, arrows for relationships, colors distinguishing node types, Chinese labels; the layout must 'read clearly to an audience' — don't line every node up in a row. When details are missing, fill in plausible modules, phases, roles, or components.",
572
+ "版式:title 封面 / content 内容页 / section 章节页 / two-column 双栏":
573
+ "Layout: title (cover) / content / section (divider) / two-column",
574
+ "生成 .pptx 演示文稿(两步流程第二步):使用 office_ppt_plan 规划的大纲渲染幻灯片(含主题配色与版式设计),写入文件供直接使用。":
575
+ "Render a .pptx presentation (step two of the pipeline): renders slides from the outline planned by office_ppt_plan (theme colors and layout design included) and writes a ready-to-use file.",
576
+ "生成 Excel 表格": "Generate Excel sheets",
577
+ "生成 Markdown 文档": "Generate Markdown document",
578
+ "生成 Markdown 文档(.md):适合知识库、README、说明文档、会议纪要、调研整理、操作手册等纯文本结构化内容。":
579
+ "Generate a Markdown document (.md): for knowledge-base articles, READMEs, guides, meeting notes, research summaries, manuals, and other structured plain text.",
580
+ "生成 PPT 文件": "Generate PPT file",
581
+ "生成 PPT 文件前必须已有大纲:优先依赖本会话 office_ppt_plan 的大纲;会话恢复后大纲已失效时,先重新调用 office_ppt_plan 再生成本工具。生成完成后向用户说明文件位置与页数。":
582
+ "An outline must exist before rendering: prefer the one stored by office_ppt_plan in this session; after a session resume it is gone, so call office_ppt_plan again before this tool. Tell the user where the file is and how many slides it has.",
583
+ "生成 Word 文档": "Generate Word document",
584
+ "生成 draw.io 可编辑图表(.drawio):流程图、架构图、泳道图、拓扑图、ER 图、思维导图。xml 参数给出完整 draw.io XML,工具负责校验与落盘。":
585
+ "Generate an editable draw.io diagram (.drawio): flowcharts, architecture, swimlane, topology, ER, mindmap. The xml parameter carries the full draw.io XML; the tool validates and writes it.",
586
+ "生成 draw.io 图表": "Generate draw.io diagram",
587
+ "生成可视化图表:根据 labels/values 渲染 ECharts 图表,输出 .svg(可插入文档)、.html(浏览器打开)与 .json(图表配置)三个文件,适合趋势、对比、占比、排名、漏斗与指标可视化。":
588
+ "Render an ECharts chart from labels/values, writing three files: .svg (drop into documents), .html (open in a browser), and .json (chart option). Fits trends, comparisons, shares, rankings, funnels, and metric displays.",
589
+ 生成图表: "Generate chart",
590
+ "生成结构化 Excel 工作簿(.xlsx),可含多个工作表:tables 里给出每张表的列名与数据行,工具负责渲染(冻结表头、列宽、数字单元格)。":
591
+ "Generate a structured Excel workbook (.xlsx) with multiple worksheets: tables carries each sheet's columns and data rows; the tool handles rendering (frozen headers, column widths, numeric cells).",
592
+ "生成结构化 Word 文档(.docx),支持报告、计划、总结、文章、PRD:sections 里给出完整章节内容(段落/要点/表格),工具负责排版渲染。":
593
+ "Generate a structured Word document (.docx) for reports, plans, summaries, articles, and PRDs: sections carries the full chapter content (paragraphs/bullets/tables); the tool handles typesetting.",
594
+ "用户原始需求(没有大纲也没有内联 slides 时用于兜底)":
595
+ "Original user request (fallback when there is no outline and no inline slides)",
596
+ "用户同时要多个交付物时(如 PPT + 流程图 + 文档),按顺序分别调用对应工具完整交付;除 PPT 占两步外,单次任务工具总数尽量控制在 5 个以内。需求缺少受众、页数、风格等信息时做合理默认假设继续执行,不要反问。":
597
+ "When the user wants several deliverables (e.g. PPT + diagram + document), call each tool in order and deliver them all; PPT takes two steps, and total tool calls per task should stay within 5. When audience, length, style, etc. are missing, make reasonable assumptions and proceed — don't ask back.",
598
+ "用户给出 .docx/.pptx/.xlsx/.pdf/.csv 文件路径,或要求基于某个 office 文件继续加工时,先用本工具读取内容作为上下文,再继续任务。":
599
+ "When the user gives a .docx/.pptx/.xlsx/.pdf/.csv path, or asks to build on an office file, read it with this tool first and use the content as context before continuing.",
600
+ "目标听众(可选)": "Target audience (optional)",
601
+ "目标读者(可选),写入场景判断": "Target reader (optional), included in the scene hint",
602
+ "章节列表:按 背景 → 分析 → 方案 → 结论 组织,像正式交付文档而不是提纲":
603
+ "Sections: organize as background → analysis → solution → conclusion, like a deliverable document rather than an outline",
604
+ 章节标题: "Section heading",
605
+ "类目标签(饼图/漏斗为各项名称,仪表盘为指标名)":
606
+ "Category labels (item names for pie/funnel, metric name for gauge)",
607
+ "结构完整且有阅读价值的文章:包含引言、核心论述、案例或论据、总结,避免空泛套话。":
608
+ "A complete, readable article: introduction, core argument, cases or evidence, summary — no empty boilerplate.",
609
+ "表格列名,要专业、可执行": "Column names: professional and actionable",
610
+ "表格列表;适合多表时拆分为「明细表 + 汇总表」「计划表 + 风险表」等":
611
+ "Tables; when several fit, split them like 'details + summary' or 'plan + risks'",
612
+ "表格数据行,每行长度与列数一致": "Data rows; each row matches the column count",
613
+ "表格组标题(同时用作文件名)": "Workbook title (also used as the file name)",
614
+ 要点列表: "Bullet points",
615
+ "要读取的文件路径(.docx/.pptx/.xlsx/.pdf/.csv/.tsv/.txt/.md)":
616
+ "Path of the file to read (.docx/.pptx/.xlsx/.pdf/.csv/.tsv/.txt/.md)",
617
+ "规划 PPT 大纲": "Plan PPT outline",
618
+ "规划 PPT 大纲(两步流程第一步):整理出每一页的标题、版式、要点,存入会话供 office_ppt_generate 生成文件。只产出规划,不生成幻灯片。":
619
+ "Plan the PPT outline (step one of the pipeline): work out each slide's title, layout, and points, stored for office_ppt_generate to render. Planning only — no slides are produced.",
620
+ "视觉建议,如:数据卡片、流程箭头、双栏对比、时间轴":
621
+ "Visual hint, e.g. data cards, process arrows, side-by-side comparison, timeline",
622
+ "读取 office 文件": "Read office file",
623
+ "读取 office 文件的文本内容:.docx(按段落)、.pptx(按页)、.xlsx(按工作表)、.pdf(按页)、.csv/.tsv(对齐表格)与纯文本。只读,不修改文件。":
624
+ "Read text from office files: .docx (by paragraph), .pptx (by slide), .xlsx (by worksheet), .pdf (by page), .csv/.tsv (aligned table), and plain text. Read-only; never modifies the file.",
625
+ "输出文件路径(可选,相对当前目录,默认写入 office-outputs/)":
626
+ "Output file path (optional, relative to cwd; defaults to office-outputs/)",
627
+ "输出路径必须位于当前工作目录内:": "Output path must stay inside the current working directory: ",
628
+ "高质量总结材料:包含核心结论、关键数据、经验教训、问题反思、后续建议。":
629
+ "High-quality summary: core conclusions, key figures, lessons learned, reflections, follow-up recommendations.",
630
+ "默认按方案汇报图处理,兼顾层次、关系和对外讲解的清晰度。":
631
+ "Default to a proposal-style diagram balancing hierarchy, relationships, and presentational clarity.",
632
+ "默认按正式商务文档处理,兼顾背景、问题、方案、价值、风险与下一步。":
633
+ "Default to a formal business document covering background, problems, solution, value, risks, and next steps.",
634
+ "默认按正式知识文档处理,兼顾背景、核心说明、示例、FAQ 和后续建议。":
635
+ "Default to a formal knowledge document covering background, core explanations, examples, FAQ, and follow-ups.",
636
+ "默认按真实业务表格处理,兼顾明细、汇总、分析字段和执行字段。":
637
+ "Default to a realistic business sheet balancing details, summaries, analysis fields, and execution fields.",
638
+ ",以及 .txt/.md 等纯文本": ", plus plain text like .txt/.md",
313
639
  };
314
640
 
315
641
  let currentLanguage: DalLanguage = resolveLanguage();
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@dalcode/dal-skills",
3
- "version": "0.1.10",
3
+ "version": "1.0.7",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
7
7
  "exports": {
8
8
  ".": "./src/index.ts",
9
9
  "./client": "./src/client.ts",
10
- "./package.json": "./package.json"
10
+ "./package.json": "./package.json",
11
+ "./packages": "./src/packages.ts"
11
12
  },
12
13
  "files": [
13
14
  "src"
@@ -18,12 +19,12 @@
18
19
  ]
19
20
  },
20
21
  "dependencies": {
21
- "@dalcode/dal-pi-kit": "0.1.10",
22
- "@dalcode/deepailab": "0.1.10",
22
+ "@dalcode/dal-pi-kit": "1.0.7",
23
+ "@dalcode/deepailab": "1.0.7",
23
24
  "typebox": "1.3.7"
24
25
  },
25
26
  "peerDependencies": {
26
- "@earendil-works/pi-coding-agent": "^0.1.2"
27
+ "@earendil-works/pi-coding-agent": "^1.0.0"
27
28
  },
28
29
  "peerDependenciesMeta": {
29
30
  "@earendil-works/pi-coding-agent": {
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Local-skill discovery for the /skill management command.
3
+ *
4
+ * A lightweight, read-only mirror of what the host's skill loader scans:
5
+ * `<name>/SKILL.md` under the project dir, the user dir, and the shared
6
+ * `~/.agents/skills` convention. Management-only — listing what is on disk and
7
+ * writing/removing entries; the authoritative loader (and its extra roots and
8
+ * warning rules) stays in the host.
9
+ */
10
+
11
+ import { existsSync, readdirSync, readFileSync } from "node:fs";
12
+ import { homedir } from "node:os";
13
+ import { join } from "node:path";
14
+ import { t } from "@dalcode/dal-pi-kit";
15
+ import { getAgentDir } from "@earendil-works/pi-coding-agent";
16
+
17
+ /** Same charset the host loader enforces (lowercase, hyphen-separated). */
18
+ export const SKILL_NAME_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
19
+
20
+ export type SkillScope = "project" | "user" | "shared";
21
+
22
+ export interface SkillRoot {
23
+ scope: SkillScope;
24
+ dir: string;
25
+ }
26
+
27
+ export function skillRoots(cwd: string): SkillRoot[] {
28
+ return [
29
+ { scope: "project", dir: join(cwd, ".dal", "skills") },
30
+ { scope: "user", dir: join(getAgentDir(), "skills") },
31
+ { scope: "shared", dir: join(homedir(), ".agents", "skills") },
32
+ ];
33
+ }
34
+
35
+ export interface LocalSkill {
36
+ /** The directory name — also the /skill:<name> command name. */
37
+ name: string;
38
+ description: string;
39
+ dir: string;
40
+ path: string;
41
+ scope: SkillScope;
42
+ }
43
+
44
+ export function assertValidSkillName(name: string): void {
45
+ if (!SKILL_NAME_PATTERN.test(name) || name.length > 64) {
46
+ throw new Error(`${t("技能名称无效(仅小写字母、数字、-,≤64 字符):")}${name}`);
47
+ }
48
+ }
49
+
50
+ /**
51
+ * Minimal frontmatter read: the `---` fenced head with flat `key: value`
52
+ * lines. Skills only need name/description here — real YAML features
53
+ * (nesting, lists) are passed through untouched for the host to judge.
54
+ */
55
+ export function parseSkillFile(raw: string): { name?: string; description?: string; body: string } {
56
+ if (!raw.startsWith("---")) return { body: raw };
57
+ const close = raw.indexOf("\n---", 3);
58
+ if (close === -1) return { body: raw };
59
+ const head = raw.slice(3, close);
60
+ const rest = raw.slice(close + 4);
61
+ const body = rest.startsWith("\n") ? rest.slice(1) : rest;
62
+ const fields: Record<string, string> = {};
63
+ for (const line of head.split("\n")) {
64
+ const match = /^([A-Za-z][\w-]*)\s*:\s*(.*)$/.exec(line);
65
+ if (match) fields[match[1].toLowerCase()] = match[2].trim().replace(/^["']|["']$/g, "");
66
+ }
67
+ return { name: fields.name, description: fields.description, body };
68
+ }
69
+
70
+ /**
71
+ * Scans every root. Untrusted projects are skipped when `includeProject` is
72
+ * false, matching what the host actually loads. Skills without a description
73
+ * are skipped too — the host refuses to load them, so they are not real skills.
74
+ */
75
+ export function listLocalSkills(cwd: string, opts?: { includeProject?: boolean }): LocalSkill[] {
76
+ const out: LocalSkill[] = [];
77
+ for (const root of skillRoots(cwd)) {
78
+ if (root.scope === "project" && opts?.includeProject === false) continue;
79
+ if (!existsSync(root.dir)) continue;
80
+ let entries: string[];
81
+ try {
82
+ entries = readdirSync(root.dir).sort();
83
+ } catch {
84
+ continue;
85
+ }
86
+ for (const entry of entries) {
87
+ const dir = join(root.dir, entry);
88
+ const path = join(dir, "SKILL.md");
89
+ if (!existsSync(path)) continue;
90
+ let parsed: ReturnType<typeof parseSkillFile>;
91
+ try {
92
+ parsed = parseSkillFile(readFileSync(path, "utf8"));
93
+ } catch {
94
+ continue;
95
+ }
96
+ if (!parsed.description) continue;
97
+ out.push({ name: entry, description: parsed.description, dir, path, scope: root.scope });
98
+ }
99
+ }
100
+ return out;
101
+ }