dal-code 0.1.6 → 0.1.8

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 (52) hide show
  1. package/dist/core/house-providers.d.ts +22 -37
  2. package/dist/core/house-providers.d.ts.map +1 -1
  3. package/dist/core/house-providers.js +22 -54
  4. package/dist/core/house-providers.js.map +1 -1
  5. package/dist/core/model-runtime.d.ts.map +1 -1
  6. package/dist/core/model-runtime.js.map +1 -1
  7. package/dist/core/tools/bash.d.ts.map +1 -1
  8. package/dist/core/tools/bash.js +5 -1
  9. package/dist/core/tools/bash.js.map +1 -1
  10. package/dist/dal/builtins.d.ts.map +1 -1
  11. package/dist/dal/builtins.js +20 -2
  12. package/dist/dal/builtins.js.map +1 -1
  13. package/dist/node_modules/@dalcode/dal-bridge/package.json +2 -2
  14. package/dist/node_modules/@dalcode/dal-gateway/package.json +2 -2
  15. package/dist/node_modules/@dalcode/dal-guard/package.json +4 -4
  16. package/dist/node_modules/@dalcode/dal-halo/package.json +1 -1
  17. package/dist/node_modules/@dalcode/dal-lang/package.json +3 -3
  18. package/dist/node_modules/@dalcode/dal-lsp/package.json +3 -3
  19. package/dist/node_modules/@dalcode/dal-lsp/src/client.ts +5 -0
  20. package/dist/node_modules/@dalcode/dal-lsp/src/config.ts +16 -4
  21. package/dist/node_modules/@dalcode/dal-lsp/src/index.ts +1 -1
  22. package/dist/node_modules/@dalcode/dal-mcp/package.json +9 -7
  23. package/dist/node_modules/@dalcode/dal-mcp/src/account-layer.ts +85 -0
  24. package/dist/node_modules/@dalcode/dal-mcp/src/config.ts +21 -2
  25. package/dist/node_modules/@dalcode/dal-mcp/src/index.ts +37 -2
  26. package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.d.ts.map +1 -1
  27. package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +15 -0
  28. package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js.map +1 -1
  29. package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
  30. package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.ts +20 -0
  31. package/dist/node_modules/@dalcode/dal-skills/LICENSE +21 -0
  32. package/dist/node_modules/@dalcode/dal-skills/package.json +33 -0
  33. package/dist/node_modules/@dalcode/dal-skills/src/client.ts +96 -0
  34. package/dist/node_modules/@dalcode/dal-skills/src/index.ts +178 -0
  35. package/dist/node_modules/@dalcode/dal-subagent/package.json +3 -3
  36. package/dist/node_modules/@dalcode/dal-telemetry/package.json +2 -2
  37. package/dist/node_modules/@dalcode/dal-telemetry/src/index.ts +30 -2
  38. package/dist/node_modules/@dalcode/deepailab/package.json +2 -2
  39. package/dist/node_modules/@dalcode/deepailab/src/index.ts +39 -8
  40. package/dist/node_modules/@earendil-works/pi-agent-core/package.json +1 -1
  41. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  42. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
  43. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/baseten.json +1 -1
  44. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  45. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  46. package/dist/node_modules/@earendil-works/pi-ai/package.json +1 -1
  47. package/dist/node_modules/@earendil-works/pi-client/package.json +1 -1
  48. package/dist/node_modules/@earendil-works/pi-protocol/package.json +1 -1
  49. package/dist/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  50. package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
  51. package/npm-shrinkwrap.json +2 -2
  52. package/package.json +1 -1
@@ -27,6 +27,15 @@ interface McpConfigLayer {
27
27
 
28
28
  export interface LoadMcpServerConfigsOptions {
29
29
  includeDefaults?: boolean;
30
+ /** Read `cwd/.dal/mcp.json`. Off unless the caller has confirmed trust. */
31
+ projectTrusted?: boolean;
32
+ /**
33
+ * Hosted servers enabled on the user's DeepAILab account. Applied below the
34
+ * user's own file, so a local entry of the same name still wins and
35
+ * `"disabled": true` still turns one off — the account proposes, the machine
36
+ * disposes.
37
+ */
38
+ accountServers?: Record<string, McpServerConfig>;
30
39
  }
31
40
 
32
41
  /** Lowest-priority servers. User/project entries with the same name win. */
@@ -126,13 +135,23 @@ function applyLayer(merged: Record<string, McpServerConfig>, layer: McpConfigLay
126
135
  for (const name of layer.disabled) delete merged[name];
127
136
  }
128
137
 
129
- /** Project-configured servers override user-level servers with the same name. */
138
+ /**
139
+ * `opts.projectTrusted` gates the project layer, and defaults to off.
140
+ *
141
+ * A project `.dal/mcp.json` names a command that gets spawned on connect, so
142
+ * reading one out of a freshly cloned repository is arbitrary code execution.
143
+ * Listing the file in the trust manager only makes dal *ask* — it does not stop
144
+ * anything — so a user answering "don't trust", or a headless `dal -p` which
145
+ * never asks and counts as untrusted, still had the command run. The user's own
146
+ * ~/.dal/agent/mcp.json is always read: it is theirs, not the repository's.
147
+ */
130
148
  export function loadMcpServerConfigs(cwd: string, opts?: LoadMcpServerConfigsOptions): Record<string, McpServerConfig> {
131
149
  const merged: Record<string, McpServerConfig> = {};
132
150
  if (shouldIncludeDefaults(opts)) {
133
151
  Object.assign(merged, DEFAULT_MCP_SERVERS);
134
152
  }
153
+ if (opts?.accountServers) Object.assign(merged, opts.accountServers);
135
154
  applyLayer(merged, readServersFile(join(getAgentDir(), "mcp.json")));
136
- applyLayer(merged, readServersFile(join(cwd, CONFIG_DIR_NAME, "mcp.json")));
155
+ if (opts?.projectTrusted) applyLayer(merged, readServersFile(join(cwd, CONFIG_DIR_NAME, "mcp.json")));
137
156
  return merged;
138
157
  }
@@ -16,7 +16,9 @@
16
16
 
17
17
  import { evaluateToolCall } from "@dalcode/dal-guard";
18
18
  import { t } from "@dalcode/dal-pi-kit";
19
+ import { defaultConfig } from "@dalcode/deepailab/oidc";
19
20
  import type { ExtensionAPI, ExtensionContext, ToolCallEvent } from "@earendil-works/pi-coding-agent";
21
+ import { fetchAccountMcpServers } from "./account-layer.ts";
20
22
  import { loadMcpServerConfigs, takeMcpConfigProblems } from "./config.ts";
21
23
  import { McpHttpClient } from "./http-client.ts";
22
24
  import { type McpStatusItem, rememberMcpSessionId, reportMcpStatus } from "./report.ts";
@@ -253,15 +255,48 @@ async function mcpReconnect(pi: ExtensionAPI, serverName: string, ctx: Extension
253
255
  }
254
256
  }
255
257
 
258
+ /**
259
+ * hasUI, not `ui`. A headless run still gets a real `ui` object whose notify
260
+ * does nothing, so a truthiness check would drop the message in `dal -p` — the
261
+ * run where nobody is watching and the explanation matters most.
262
+ */
263
+ function report(ctx: ExtensionContext, message: string, level: "info" | "warning" | "error"): void {
264
+ if (ctx.hasUI) ctx.ui.notify(message, level);
265
+ else process.stderr.write(`${message}\n`);
266
+ }
267
+
256
268
  export default function (pi: ExtensionAPI) {
257
269
  pi.on("session_start", async (_event, ctx: ExtensionContext) => {
258
270
  const sessionId = ctx.sessionManager?.getSessionId?.();
259
271
  if (sessionId) rememberMcpSessionId(sessionId);
260
- const servers = loadMcpServerConfigs(ctx.cwd);
272
+ // The account layer, fetched before the local files are read so the two can
273
+ // be merged in one pass. Best-effort in the sense that a signed-out user or
274
+ // an unreachable gateway leaves the local configuration working exactly as
275
+ // before — but never silent: a refused entry or a failed fetch is said out
276
+ // loud, because "my MCP server is missing and nothing explains why" is the
277
+ // failure this codebase keeps paying for.
278
+ let accountServers: Record<string, McpServerConfig> | undefined;
279
+ try {
280
+ const vk = await ctx.modelRegistry?.getApiKeyForProvider?.("deepailab");
281
+ if (vk) {
282
+ const layer = await fetchAccountMcpServers(defaultConfig().apiBase, vk);
283
+ accountServers = layer.servers;
284
+ for (const name of layer.rejected) {
285
+ report(ctx, `${t("已拒绝账号下发的 MCP 条目(只接受 https 远程服务器):")}${name}`, "warning");
286
+ }
287
+ }
288
+ } catch (error) {
289
+ report(ctx, `${t("无法获取账号的 MCP 配置:")}${errorMessage(error)}`, "warning");
290
+ }
291
+
292
+ const servers = loadMcpServerConfigs(ctx.cwd, {
293
+ projectTrusted: ctx.isProjectTrusted(),
294
+ accountServers,
295
+ });
261
296
  // A malformed mcp.json used to make every server disappear with no error
262
297
  // and no line number; "未配置 MCP 服务器" was the only sign.
263
298
  for (const problem of takeMcpConfigProblems()) {
264
- ctx.ui.notify(`${t("MCP 配置有问题:")}${problem}`, "warning");
299
+ report(ctx, `${t("MCP 配置有问题:")}${problem}`, "warning");
265
300
  }
266
301
  for (const [name, config] of Object.entries(servers)) {
267
302
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,CAAC;AA+StC,wEAAwE;AACxE,wBAAgB,iBAAiB,IAAI,OAAO,CAO3C;AAED,wBAAgB,WAAW,IAAI,WAAW,CAEzC;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO,CAS1D;AAED,iFAAiF;AACjF,wBAAgB,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAGpC","sourcesContent":["/**\n * Lightweight bilingual layer for dal.\n *\n * Keys are the Chinese source strings (the product's first language), values\n * are English translations. t() is identity for zh; for en it looks up the\n * catalog and falls back to the Chinese source when a translation is missing,\n * so partial coverage never breaks the UI.\n *\n * Language resolution: ~/.dal/language file > DAL_LANG env > system LANG.\n */\n\nimport { mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\n\nexport type DalLanguage = \"zh\" | \"en\";\n\nconst EN_CATALOG: Record<string, string> = {\n\t// model switch\n\t\"默认模型:\": \"Default model: \",\n\t\"模型:\": \"Model: \",\n\t\" 思考级别用 /thinking 调整\": \" Use /thinking to set the reasoning level\",\n\t// interactive status / error messages\n\t\"已有 bash 命令在运行,请先按 Esc 取消。\": \"A bash command is already running. Press Esc to cancel it first.\",\n\t已经在这个位置: \"Already at this point\",\n\t已取消自动压缩: \"Auto-compaction cancelled\",\n\t已取消分支摘要: \"Branch summarization cancelled\",\n\t已克隆到新会话: \"Cloned to new session\",\n\t\"切换 TUI 模式前请先关闭浮层\": \"Close active overlays before changing TUI mode\",\n\t已取消压缩: \"Compaction cancelled\",\n\t已复制最后一条回复到剪贴板: \"Copied last agent message to clipboard\",\n\t已复制所选消息到剪贴板: \"Copied selected message to clipboard\",\n\t当前模型不支持思考模式: \"Current model does not support thinking\",\n\t\"无法从 gh 的输出中解析 gist ID\": \"Failed to parse gist ID from gh output\",\n\t已分叉到新会话: \"Forked to new session\",\n\t\"未安装 GitHub CLI(gh),请从 https://cli.github.com/ 安装。\":\n\t\t\"GitHub CLI (gh) is not installed. Install it from https://cli.github.com/\",\n\t\"GitHub CLI 尚未登录,请先运行 gh auth login。\": \"GitHub CLI is not logged in. Run 'gh auth login' first.\",\n\t已取消导入: \"Import cancelled\",\n\t\"模型刷新超时,改为搜索已缓存的模型。\": \"Model refresh timed out; searching cached models.\",\n\t模型选择已保存到设置: \"Model selection saved to settings\",\n\t已跳转到所选位置: \"Navigated to selected point\",\n\t已取消跳转: \"Navigation cancelled\",\n\t\"还没有可复制的回复。\": \"No agent messages to copy yet.\",\n\t会话中没有条目: \"No entries in session\",\n\t\"没有可用的登录方式。\": \"No login methods available.\",\n\t没有可用于分叉的消息: \"No messages to fork from\",\n\t没有可恢复的排队消息: \"No queued messages to restore\",\n\t还没有可克隆的内容: \"Nothing to clone yet\",\n\t\"消息已排队,将在压缩完成后发送\": \"Queued message for after compaction\",\n\t已取消恢复: \"Resume cancelled\",\n\t已恢复会话: \"Resumed session\",\n\t已在当前目录恢复会话: \"Resumed session in current cwd\",\n\t所选条目没有可复制的文本: \"Selected entry has no text to copy\",\n\t已取消分享: \"Share cancelled\",\n\t启动仍在进行中: \"Startup is still in progress\",\n\t\"Windows 不支持挂起到后台\": \"Suspend to background is not supported on Windows\",\n\t\"用法:/import <path.jsonl>\": \"Usage: /import <path.jsonl>\",\n\t\"用法:/name <名称>\": \"Usage: /name <name>\",\n\t\"请等待压缩完成后再重新加载。\": \"Wait for compaction to finish before reloading.\",\n\t\"请等待当前回复完成后再重新加载。\": \"Wait for the current response to finish before reloading.\",\n\t// model selector / catalog\n\t\"仅显示已配置提供方的模型。用 /login 添加提供方。\":\n\t\t\"Only showing models from configured providers. Use /login to add providers.\",\n\t没有匹配的模型: \"No matching models\",\n\t\"正在刷新模型目录…\": \"Refreshing model catalogs…\",\n\t\"模型目录已刷新。\": \"Model catalogs refreshed.\",\n\t// dal-telemetry\n\t\"查看或切换匿名遥测(on | off)\": \"Show or toggle anonymous telemetry (on | off)\",\n\t\"匿名遥测已开启,重启后生效。\": \"Anonymous telemetry is on. Takes effect after restart.\",\n\t\"匿名遥测已关闭,重启后生效。\": \"Anonymous telemetry is off. Takes effect after restart.\",\n\t你已关闭: \"you turned it off\",\n\t\"DO_NOT_TRACK 已设置\": \"DO_NOT_TRACK is set\",\n\t\"DAL_TELEMETRY 已设置为关闭\": \"DAL_TELEMETRY is set to off\",\n\t\"检测到 CI 环境\": \"running in CI\",\n\t配置无法写入: \"the config file could not be written\",\n\t\"匿名遥测:开启\": \"Anonymous telemetry: on\",\n\t\"匿名遥测:关闭\": \"Anonymous telemetry: off\",\n\t\" 用 /telemetry on|off 切换\": \" Use /telemetry on|off to change this\",\n\t\"DAL 会发送匿名使用统计(不含代码、提示词和文件路径)以改进产品。/telemetry off 可关闭。\":\n\t\t\"DAL sends anonymous usage stats (never your code, prompts, or file paths) to improve the product. Run /telemetry off to opt out.\",\n\t\"DAL Code\": \"DAL Code\",\n\t\"输入 /login 登录 DeepAILab 账号即可开始使用。\":\n\t\t\"Run /login to sign in with your DeepAILab account and get started.\",\n\t\"当前没有可用模型。\": \"No models available. \",\n\t\"尚未选择模型。\": \"No model selected.\",\n\t\"然后用 /model 选择一个模型。\": \"Then use /model to select a model.\",\n\t所选模型: \"the selected model\",\n\t\"没有找到「{provider}」的 API 密钥。\": \"No API key found for {provider}. \",\n\t\"dal-bridge:无法联系 DAL Code 取得授权,已拒绝执行。\":\n\t\t\"dal-bridge: could not reach DAL Code for approval, so the action was refused.\",\n\t\"dal-bridge:用户已拒绝该操作。\": \"dal-bridge: the user rejected this action.\",\n\t\"submit_plan - 多步骤任务动手前先提交计划待用户审批\":\n\t\t\"submit_plan - submit a plan for approval before starting multi-step work\",\n\t提交计划待审批: \"Submit plan for approval\",\n\t\"在动手改动之前,把计划提交给用户审批。返回是否继续执行,以及用户给出的反馈。\":\n\t\t\"Submit a plan for the user to approve before making changes. Returns whether to proceed, plus any feedback.\",\n\t\"当任务是多步骤的、或会改动多个文件时使用。\": \"Use this when the task is multi-step or touches several files.\",\n\t\"这个计划要达成什么,一句话说明\": \"One sentence on what this plan achieves\",\n\t为什么选这个方案: \"Why this approach\",\n\t按顺序排列的执行步骤: \"The steps to carry out, in order\",\n\t这一步做什么: \"What this step does\",\n\t这一步的细节: \"Details for this step\",\n\t\"请在浏览器中确认登录请求,以连接 DeepAILab。\": \"Confirm the sign-in request in your browser to connect DeepAILab.\",\n\t\"警告:未签发刷新令牌 — 请检查 offline_access 授权范围。\":\n\t\t\"Warning: no refresh token was issued - check the offline_access scope.\",\n\t\"正在开通 DeepAILab 访问密钥…\": \"Provisioning your DeepAILab access key...\",\n\t\"访问密钥开通失败(\": \"Could not provision the access key (\",\n\t\"),下次使用时将自动重试。\": \"). It will be retried automatically next time.\",\n\t\"查看 DeepAILab 会员和套餐状态\": \"Show DeepAILab membership and plan status\",\n\t\"尚未登录。请运行 /login 并选择 DeepAILab。\": \"Not signed in. Run /login and choose DeepAILab.\",\n\t无法获取模型列表: \"Could not load the model list\",\n\t网关拒绝了请求: \"the gateway rejected the request\",\n\t请求超时: \"the request timed out\",\n\t\"无法连接 DeepAILab 网关\": \"could not reach the DeepAILab gateway\",\n\t\"MCP 配置有问题:\": \"MCP config problem: \",\n\t\"lsp: 正在启动语言服务器:\": \"lsp: starting the language server: \",\n\t\"lsp: line 必须从 1 开始。\": \"lsp: line is 1-based and must be at least 1.\",\n\t\"lsp: character 必须从 1 开始。\": \"lsp: character is 1-based and must be at least 1.\",\n\t\"lsp: filePath 必须是绝对路径。\": \"lsp: filePath must be absolute.\",\n\t\"未找到语言服务器命令:\": \"Language server command not found: \",\n\t\"。请安装:\": \". Install it with: \",\n\t\"没有为该文件类型配置语言服务器。请在 .dal/lsp.json 的 lspServers 中配置。\":\n\t\t\"No language server is configured for this file type. Add one under lspServers in .dal/lsp.json.\",\n\t\"lsp: 本地语言服务器查询失败:\": \"lsp: the local language server query failed: \",\n\t已激活: \"active\",\n\t未激活: \"inactive\",\n\t至: \"until\",\n\t\"无法加载会员信息:\": \"Could not load membership information: \",\n\t\"登录状态已失效,请运行 /login 重新登录 DeepAILab。\":\n\t\t\"Your session has expired. Run /login to sign in to DeepAILab again.\",\n\t\"账户额度已用完。运行 /account 查看套餐,或前往 deepailab.ai 充值后继续。\":\n\t\t\"Your account is out of credit. Run /account to see your plan, or top up at deepailab.ai to continue.\",\n\t\"请求太频繁,网关正在限流。请稍等几秒再试。\":\n\t\t\"Too many requests - the gateway is rate limiting. Wait a few seconds and try again.\",\n\t\"当前模型在网关上不可用(可能未绑定密钥)。用 /model 换一个模型试试。\":\n\t\t\"This model is not available on the gateway (it may have no key bound). Try another with /model.\",\n\t\"DeepAILab 网关暂时不可用(服务端错误),请稍后重试。\":\n\t\t\"The DeepAILab gateway is temporarily unavailable (server error). Please try again shortly.\",\n\t要查询的文件的绝对路径: \"Absolute path of the file to query\",\n\t\"查询类型:definition(定义)、references(引用)、hover(悬停文档)\":\n\t\t\"Query kind: definition, references, or hover\",\n\t\"符号所在行号(1 起算)\": \"Line the symbol is on (1-based)\",\n\t\"符号所在列号(1 起算,缺省为 1)\": \"Column the symbol is on (1-based, defaults to 1)\",\n\t\"语言服务器查询 (LSP)\": \"Language server query (LSP)\",\n\t\"通过语言服务器获取权威的类型信息:符号定义(definition)、全部引用位置(references)、悬停文档(hover)。\":\n\t\t\"Get authoritative type information from the language server: a symbol's definition, all of its references, or its hover documentation. \",\n\t\"支持已配置语言服务器的语言(TypeScript/JavaScript 开箱即用)。\":\n\t\t\"Works for any language with a configured server (TypeScript/JavaScript out of the box).\",\n\t\"lsp - 用语言服务器查询权威类型信息(definition / references / hover)\":\n\t\t\"lsp - authoritative type info from the language server (definition / references / hover)\",\n\t\"lsp: 无法联系 DAL Code 的 LSP 桥接,查询失败。改用 read/grep 继续。\":\n\t\t\"lsp: could not reach DAL Code's LSP bridge, so the query failed. Fall back to read/grep.\",\n\t\"… (结果过长,已截断)\": \"... (result too long, truncated)\",\n\t\"DeepAILab · 终端智能体\": \"DeepAILab · Terminal Agent\",\n\n\t中断: \"interrupt\",\n\t清屏: \"clear\",\n\t退出: \"exit\",\n\t\"退出(空输入时)\": \"exit (on empty input)\",\n\t挂起: \"suspend\",\n\t删除到行尾: \"delete to end of line\",\n\t切换思考深度: \"cycle thinking level\",\n\t切换模型: \"cycle models\",\n\t选择模型: \"select model\",\n\t展开工具输出: \"expand tool output\",\n\t展开思考过程: \"expand thinking\",\n\t外部编辑器: \"external editor\",\n\t命令菜单: \"command menu\",\n\t\"运行 bash\": \"run bash\",\n\t\"运行 bash(不进上下文)\": \"run bash (outside context)\",\n\t追加排队消息: \"queue follow-up message\",\n\t编辑排队消息: \"edit queued message\",\n\t粘贴图片: \"paste image\",\n\t拖入附件: \"drop files to attach\",\n\t\"清屏/退出\": \"clear/exit\",\n\t命令: \"commands\",\n\t更多: \"more\",\n\t\"按 ctrl+o 查看完整快捷键和已加载资源。\": \"Press ctrl+o for all shortcuts and loaded resources.\",\n\t\"遇到不会的直接问 dal——它能解释自己的功能和用法。首次使用请输入 /login 登录。\":\n\t\t\"Not sure how something works? Just ask dal — it can explain itself. Run /login to sign in first.\",\n\t会员: \"sub\",\n\t未登录: \"not signed in\",\n\t\"Enter 发送\": \"Enter to send\",\n\t\"ctrl+j 换行\": \"ctrl+j newline\",\n\t\"ctrl+v 贴图\": \"ctrl+v paste image\",\n\t\"ctrl+shift+s 截图\": \"ctrl+shift+s screenshot\",\n\t换行: \"newline\",\n\t贴图: \"paste image\",\n\t截图: \"screenshot\",\n\t附件: \"attach file\",\n\t\"@附件\": \"@ file\",\n\t个工具: \"tools\",\n\t\"拖选区域截图,取消则跳过\": \"Drag to capture a region. Cancel to skip.\",\n\t已取消截图: \"Screenshot cancelled\",\n\t\"截图后用 ctrl+v 粘贴\": \"Capture a screenshot, then paste with ctrl+v\",\n\t已选择: \"Selected\",\n\t上下文: \"context\",\n\t自动压缩: \"auto-compact\",\n\t思考关: \"thinking off\",\n\t思考: \"thinking\",\n\t\"发现新版本 \": \"New version \",\n\t\",运行 \": \" available. Run \",\n\t\"更新日志: \": \"Changelog: \",\n\t登录: \"Sign in\",\n\t快捷键: \"Shortcuts\",\n\t语言: \"Language\",\n\t终端智能体: \"Terminal Agent\",\n\n\t\"子任务的简短标题(3-5 个字,用于展示进度)\": \"Short task title (3-5 words, shown as progress label)\",\n\t\"交给子 agent 的完整任务说明,需自包含(子 agent 看不到父对话历史)\":\n\t\t\"Full task description for the sub-agent, must be self-contained (the sub-agent cannot see the parent conversation)\",\n\t\"true 时子 agent 只拥有只读工具(read/grep/find/ls),不能写文件或跑 bash\":\n\t\t\"When true, the sub-agent only gets read-only tools (read/grep/find/ls) and cannot write files or run bash\",\n\t\"子 agent 运行出错:\": \"Sub-agent failed: \",\n\t\"子 agent 没有产生任何输出。\": \"The sub-agent produced no output.\",\n\t\"dal-guard:子 agent 的\": \"dal-guard: sub-agent's\",\n\t\"调用被拒绝。\": \"call was rejected.\",\n\t\"没有可用的当前模型,无法派发子 agent。\": \"No current model available, cannot dispatch a sub-agent.\",\n\t\"你是一个专注的子 agent,负责完成父任务派发给你的一个独立子任务。\":\n\t\t\"You are a focused sub-agent responsible for completing one independent subtask dispatched by the parent task.\",\n\t\"完成后用简洁的中文文字给出最终结果,不要反问,不要征求确认。\":\n\t\t\"When done, give a concise final answer in English. Do not ask clarifying questions or seek confirmation.\",\n\t派发子任务: \"Dispatch subtask\",\n\t\"派发一个独立子 agent 去完成指定子任务,可在同一轮多次调用以并行处理互不依赖的子任务\":\n\t\t\"Dispatches an independent sub-agent to complete a given subtask; can be called multiple times in the same turn to parallelize independent subtasks\",\n\t\"(实际并发上限 \": \" (actual concurrency capped at \",\n\t\")。子 agent 默认使用当前模型和完整工具集,\":\n\t\t\"). The sub-agent uses the current model and the full toolset by default, \",\n\t\"其每次工具调用同样经过 dal-guard 审批(无 UI 场景一律拒绝风险操作)。子 agent 看不到父对话历史,\":\n\t\t\"and every tool call it makes is also approved by dal-guard (risky actions are always rejected with no UI). The sub-agent cannot see the parent conversation, \",\n\t\"prompt 必须自包含所有必要上下文。\": \"so the prompt must be self-contained with all necessary context.\",\n\t\"task - 派发子 agent 并行处理独立子任务\": \"task - dispatch sub-agents to handle independent subtasks in parallel\",\n\n\t\"dal-bridge:请求失败后不允许自动换模型。\":\n\t\t\"dal-bridge: automatic model swap after a failed request is not allowed.\",\n\t'dal-mcp:连接 MCP 服务器 \"': 'dal-mcp: failed to connect to MCP server \"',\n\t'\" 失败:': '\": ',\n\t'dal-guard:MCP 工具 \"': 'dal-guard: MCP tool \"',\n\t'\" 调用被拒绝。': '\" call was denied.',\n\t'MCP 工具 \"': 'MCP tool \"',\n\t'\" 执行失败。': '\" execution failed.',\n\t\"查看/管理 MCP 服务器连接(list | status <server> | reconnect <server>)\":\n\t\t\"View/manage MCP server connections (list | status <server> | reconnect <server>)\",\n\t\"用法:/mcp list | /mcp status <server> | /mcp reconnect <server>\":\n\t\t\"Usage: /mcp list | /mcp status <server> | /mcp reconnect <server>\",\n\t\"用法:/mcp status <server>\": \"Usage: /mcp status <server>\",\n\t\"用法:/mcp reconnect <server>\": \"Usage: /mcp reconnect <server>\",\n\t\"未配置 MCP 服务器。在 .dal/mcp.json 或 ~/.dal/agent/mcp.json 中添加。\":\n\t\t\"No MCP servers configured. Add one to .dal/mcp.json or ~/.dal/agent/mcp.json.\",\n\t\"未找到 MCP 服务器:\": \"MCP server not found: \",\n\t已连接: \"connected\",\n\t连接失败: \"failed\",\n\t已断开: \"disconnected\",\n\t\"(\": \" (\",\n\t\" 个工具)\": \" tools)\",\n\t\"命令:\": \"Command: \",\n\t\"工具:\": \"Tools: \",\n\t\"(无)\": \"(none)\",\n\t\"最近错误:\": \"Last error: \",\n\t\"已重新连接:\": \"Reconnected: \",\n\t\"重连失败:\": \"Reconnect failed: \",\n\n\t// dal-guard: interactive approval gate for risky tool calls.\n\t\"特权执行(sudo/doas)\": \"Privileged execution (sudo/doas)\",\n\t强制推送将改写远程历史: \"Force push will rewrite remote history\",\n\t硬重置会丢弃本地改动: \"Hard reset will discard local changes\",\n\t\"git clean 会删除未跟踪文件\": \"git clean will delete untracked files\",\n\t将下载内容直接管道执行: \"Piping a download straight into a shell\",\n\t执行下载的脚本: \"Executing a downloaded script\",\n\t\"递归修改权限/属主\": \"Recursive permission/ownership change\",\n\t发布软件包: \"Publishing a package\",\n\t按名称结束进程: \"Killing processes by name\",\n\t底层磁盘操作: \"Low-level disk operation\",\n\t\"第三方 MCP 工具调用(\": \"Third-party MCP tool call (\",\n\t\")\": \")\",\n\t项目目录之外的文件改动: \"File change outside the project directory\",\n\t仅本次允许: \"Allow once\",\n\t\"本次会话内允许(同类操作)\": \"Allow for this session (same kind)\",\n\t拒绝: \"Deny\",\n\t\"需要审批:\": \"Approval required: \",\n\t'dal-guard:\"': 'dal-guard: \"',\n\t'\"需要交互式审批(': '\" requires interactive approval (',\n\t\")。请在交互模式下重试,或用 /guard yolo 关闭审批门。\":\n\t\t\"). Retry in interactive mode, or run /guard yolo to turn off the approval gate.\",\n\t\"dal-guard:用户已拒绝(\": \"dal-guard: user denied (\",\n\t\")。\": \").\",\n\t\"查看或切换 dal-guard 审批门(default | yolo)\": \"View or toggle the dal-guard approval gate (default | yolo)\",\n\t\"dal-guard 模式:\": \"dal-guard mode: \",\n\t\" · 本次会话已允许:\": \" · Allowed this session: \",\n};\n\nlet currentLanguage: DalLanguage = resolveLanguage();\n\n/** Same location as pi `getAgentDir()/language`, without importing the host package. */\nfunction languageFilePath(): string {\n\tconst envDir = process.env.DAL_CODING_AGENT_DIR;\n\tconst agentDir = envDir && envDir.length > 0 ? envDir : join(homedir(), \".dal\", \"agent\");\n\treturn join(agentDir, \"language\");\n}\n\nfunction resolveLanguage(): DalLanguage {\n\ttry {\n\t\tconst saved = readFileSync(languageFilePath(), \"utf8\").trim();\n\t\tif (saved === \"zh\" || saved === \"en\") return saved;\n\t} catch {\n\t\t// Not chosen yet — fall through to environment detection.\n\t}\n\tconst env = process.env.DAL_LANG || process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG || \"\";\n\t// An unset locale used to mean Chinese. It is characteristic of Docker\n\t// images, CI runners and stripped-down SSH sessions rather than of Chinese\n\t// users — and those are exactly the environments that never see the language\n\t// picker, which only opens in a TUI (dal-lang/src/index.ts). A Chinese user\n\t// in a terminal is asked on first run and their answer is remembered; an\n\t// English user in a container had no way out of a Chinese interface.\n\treturn /^(zh|cmn)/i.test(env) ? \"zh\" : \"en\";\n}\n\n/** Whether the user has made an explicit, persisted language choice. */\nexport function hasChosenLanguage(): boolean {\n\ttry {\n\t\tconst saved = readFileSync(languageFilePath(), \"utf8\").trim();\n\t\treturn saved === \"zh\" || saved === \"en\";\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport function getLanguage(): DalLanguage {\n\treturn currentLanguage;\n}\n\n/**\n * Applies the language and persists the choice.\n *\n * Returns whether it was persisted. Callers must not claim success on a false:\n * the one-time picker used to say \"Restart dal to apply everywhere\" after a\n * failed write, so the user restarted into the old language and got asked again.\n */\nexport function setLanguage(language: DalLanguage): boolean {\n\tcurrentLanguage = language;\n\ttry {\n\t\tmkdirSync(dirname(languageFilePath()), { recursive: true });\n\t\twriteFileSync(languageFilePath(), language);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/** Translate a Chinese source string. Identity for zh; catalog lookup for en. */\nexport function t(zh: string): string {\n\tif (currentLanguage === \"zh\") return zh;\n\treturn EN_CATALOG[zh] ?? zh;\n}\n"]}
1
+ {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,CAAC;AAmUtC,wEAAwE;AACxE,wBAAgB,iBAAiB,IAAI,OAAO,CAO3C;AAED,wBAAgB,WAAW,IAAI,WAAW,CAEzC;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO,CAS1D;AAED,iFAAiF;AACjF,wBAAgB,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAGpC","sourcesContent":["/**\n * Lightweight bilingual layer for dal.\n *\n * Keys are the Chinese source strings (the product's first language), values\n * are English translations. t() is identity for zh; for en it looks up the\n * catalog and falls back to the Chinese source when a translation is missing,\n * so partial coverage never breaks the UI.\n *\n * Language resolution: ~/.dal/language file > DAL_LANG env > system LANG.\n */\n\nimport { mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\n\nexport type DalLanguage = \"zh\" | \"en\";\n\nconst EN_CATALOG: Record<string, string> = {\n\t// model switch\n\t\"默认模型:\": \"Default model: \",\n\t\"模型:\": \"Model: \",\n\t\" 思考级别用 /thinking 调整\": \" Use /thinking to set the reasoning level\",\n\t// interactive status / error messages\n\t\"已有 bash 命令在运行,请先按 Esc 取消。\": \"A bash command is already running. Press Esc to cancel it first.\",\n\t已经在这个位置: \"Already at this point\",\n\t已取消自动压缩: \"Auto-compaction cancelled\",\n\t已取消分支摘要: \"Branch summarization cancelled\",\n\t已克隆到新会话: \"Cloned to new session\",\n\t\"切换 TUI 模式前请先关闭浮层\": \"Close active overlays before changing TUI mode\",\n\t已取消压缩: \"Compaction cancelled\",\n\t已复制最后一条回复到剪贴板: \"Copied last agent message to clipboard\",\n\t已复制所选消息到剪贴板: \"Copied selected message to clipboard\",\n\t当前模型不支持思考模式: \"Current model does not support thinking\",\n\t\"无法从 gh 的输出中解析 gist ID\": \"Failed to parse gist ID from gh output\",\n\t已分叉到新会话: \"Forked to new session\",\n\t\"未安装 GitHub CLI(gh),请从 https://cli.github.com/ 安装。\":\n\t\t\"GitHub CLI (gh) is not installed. Install it from https://cli.github.com/\",\n\t\"GitHub CLI 尚未登录,请先运行 gh auth login。\": \"GitHub CLI is not logged in. Run 'gh auth login' first.\",\n\t已取消导入: \"Import cancelled\",\n\t\"模型刷新超时,改为搜索已缓存的模型。\": \"Model refresh timed out; searching cached models.\",\n\t模型选择已保存到设置: \"Model selection saved to settings\",\n\t已跳转到所选位置: \"Navigated to selected point\",\n\t已取消跳转: \"Navigation cancelled\",\n\t\"还没有可复制的回复。\": \"No agent messages to copy yet.\",\n\t会话中没有条目: \"No entries in session\",\n\t\"没有可用的登录方式。\": \"No login methods available.\",\n\t没有可用于分叉的消息: \"No messages to fork from\",\n\t没有可恢复的排队消息: \"No queued messages to restore\",\n\t还没有可克隆的内容: \"Nothing to clone yet\",\n\t\"消息已排队,将在压缩完成后发送\": \"Queued message for after compaction\",\n\t已取消恢复: \"Resume cancelled\",\n\t已恢复会话: \"Resumed session\",\n\t已在当前目录恢复会话: \"Resumed session in current cwd\",\n\t所选条目没有可复制的文本: \"Selected entry has no text to copy\",\n\t已取消分享: \"Share cancelled\",\n\t启动仍在进行中: \"Startup is still in progress\",\n\t\"Windows 不支持挂起到后台\": \"Suspend to background is not supported on Windows\",\n\t\"用法:/import <path.jsonl>\": \"Usage: /import <path.jsonl>\",\n\t\"用法:/name <名称>\": \"Usage: /name <name>\",\n\t\"请等待压缩完成后再重新加载。\": \"Wait for compaction to finish before reloading.\",\n\t\"请等待当前回复完成后再重新加载。\": \"Wait for the current response to finish before reloading.\",\n\t// model selector / catalog\n\t\"仅显示已配置提供方的模型。用 /login 添加提供方。\":\n\t\t\"Only showing models from configured providers. Use /login to add providers.\",\n\t没有匹配的模型: \"No matching models\",\n\t\"正在刷新模型目录…\": \"Refreshing model catalogs…\",\n\t\"模型目录已刷新。\": \"Model catalogs refreshed.\",\n\t// dal-telemetry\n\t\"查看或切换匿名遥测(on | off)\": \"Show or toggle anonymous telemetry (on | off)\",\n\t\"匿名遥测已开启,重启后生效。\": \"Anonymous telemetry is on. Takes effect after restart.\",\n\t\"匿名遥测已关闭,重启后生效。\": \"Anonymous telemetry is off. Takes effect after restart.\",\n\t你已关闭: \"you turned it off\",\n\t\"DO_NOT_TRACK 已设置\": \"DO_NOT_TRACK is set\",\n\t\"DAL_TELEMETRY 已设置为关闭\": \"DAL_TELEMETRY is set to off\",\n\t\"检测到 CI 环境\": \"running in CI\",\n\t配置无法写入: \"the config file could not be written\",\n\t\"匿名遥测:开启\": \"Anonymous telemetry: on\",\n\t\"匿名遥测:关闭\": \"Anonymous telemetry: off\",\n\t\" 用 /telemetry on|off 切换\": \" Use /telemetry on|off to change this\",\n\t\"DAL 会发送匿名使用统计(不含代码、提示词和文件路径)以改进产品。/telemetry off 可关闭。\":\n\t\t\"DAL sends anonymous usage stats (never your code, prompts, or file paths) to improve the product. Run /telemetry off to opt out.\",\n\t\"DAL Code\": \"DAL Code\",\n\t\"输入 /login 登录 DeepAILab 账号即可开始使用。\":\n\t\t\"Run /login to sign in with your DeepAILab account and get started.\",\n\t\"当前没有可用模型。\": \"No models available. \",\n\t\"尚未选择模型。\": \"No model selected.\",\n\t\"然后用 /model 选择一个模型。\": \"Then use /model to select a model.\",\n\t所选模型: \"the selected model\",\n\t\"没有找到「{provider}」的 API 密钥。\": \"No API key found for {provider}. \",\n\t\"dal-bridge:无法联系 DAL Code 取得授权,已拒绝执行。\":\n\t\t\"dal-bridge: could not reach DAL Code for approval, so the action was refused.\",\n\t\"dal-bridge:用户已拒绝该操作。\": \"dal-bridge: the user rejected this action.\",\n\t\"submit_plan - 多步骤任务动手前先提交计划待用户审批\":\n\t\t\"submit_plan - submit a plan for approval before starting multi-step work\",\n\t提交计划待审批: \"Submit plan for approval\",\n\t\"在动手改动之前,把计划提交给用户审批。返回是否继续执行,以及用户给出的反馈。\":\n\t\t\"Submit a plan for the user to approve before making changes. Returns whether to proceed, plus any feedback.\",\n\t\"当任务是多步骤的、或会改动多个文件时使用。\": \"Use this when the task is multi-step or touches several files.\",\n\t\"这个计划要达成什么,一句话说明\": \"One sentence on what this plan achieves\",\n\t为什么选这个方案: \"Why this approach\",\n\t按顺序排列的执行步骤: \"The steps to carry out, in order\",\n\t这一步做什么: \"What this step does\",\n\t这一步的细节: \"Details for this step\",\n\t\"请在浏览器中确认登录请求,以连接 DeepAILab。\": \"Confirm the sign-in request in your browser to connect DeepAILab.\",\n\t\"警告:未签发刷新令牌 — 请检查 offline_access 授权范围。\":\n\t\t\"Warning: no refresh token was issued - check the offline_access scope.\",\n\t\"正在开通 DeepAILab 访问密钥…\": \"Provisioning your DeepAILab access key...\",\n\t\"访问密钥开通失败(\": \"Could not provision the access key (\",\n\t\"),下次使用时将自动重试。\": \"). It will be retried automatically next time.\",\n\t\"查看 DeepAILab 会员和套餐状态\": \"Show DeepAILab membership and plan status\",\n\t\"尚未登录。请运行 /login 并选择 DeepAILab。\": \"Not signed in. Run /login and choose DeepAILab.\",\n\t无法获取模型列表: \"Could not load the model list\",\n\t网关拒绝了请求: \"the gateway rejected the request\",\n\t请求超时: \"the request timed out\",\n\t\"无法连接 DeepAILab 网关\": \"could not reach the DeepAILab gateway\",\n\t\"MCP 配置有问题:\": \"MCP config problem: \",\n\t\"lsp: 正在启动语言服务器:\": \"lsp: starting the language server: \",\n\t\"lsp: line 必须从 1 开始。\": \"lsp: line is 1-based and must be at least 1.\",\n\t\"lsp: character 必须从 1 开始。\": \"lsp: character is 1-based and must be at least 1.\",\n\t\"lsp: filePath 必须是绝对路径。\": \"lsp: filePath must be absolute.\",\n\t\"未找到语言服务器命令:\": \"Language server command not found: \",\n\t\"。请安装:\": \". Install it with: \",\n\t\"没有为该文件类型配置语言服务器。请在 .dal/lsp.json 的 lspServers 中配置。\":\n\t\t\"No language server is configured for this file type. Add one under lspServers in .dal/lsp.json.\",\n\t\"lsp: 本地语言服务器查询失败:\": \"lsp: the local language server query failed: \",\n\t\"要加载的技能名称,取自本工具描述中列出的清单\":\n\t\t\"Name of the skill to load, from the list in this tool's description\",\n\t\"可用技能:\": \"Available skills:\",\n\t\"加载一个 DeepAILab 技能:针对特定任务的专门指引。当手头任务与下列某条描述相符时调用本工具,然后按返回的指引执行。\":\n\t\t\"Load a DeepAILab skill: specialised instructions for a particular kind of task. Call this when the work at hand matches one of the descriptions below, then follow what it returns.\",\n\t无法获取云端技能列表: \"Could not load the cloud skill list\",\n\t技能: \"Skill\",\n\t\"skill - 加载 DeepAILab 云端技能(专项任务指引)\":\n\t\t\"skill - load a DeepAILab cloud skill (task-specific instructions)\",\n\t\"没有这个技能:\": \"No such skill: \",\n\t\"可用:\": \"Available: \",\n\t\"加载技能失败:\": \"Could not load skill: \",\n\t\"查看可用的 DeepAILab 云端技能\": \"List the available DeepAILab cloud skills\",\n\t\"服务端返回了意外的 304\": \"the service answered 304 unexpectedly\",\n\t\"已拒绝账号下发的 MCP 条目(只接受 https 远程服务器):\":\n\t\t\"Refused an MCP entry from the account (hosted https servers only): \",\n\t\"无法获取账号的 MCP 配置:\": \"Could not load the account's MCP configuration: \",\n\t\"当前没有可用的云端技能(未登录,或服务端目录为空)。\":\n\t\t\"No cloud skills are available (not signed in, or the catalogue is empty).\",\n\t云端技能: \"Cloud skills\",\n\t已激活: \"active\",\n\t未激活: \"inactive\",\n\t至: \"until\",\n\t\"无法加载会员信息:\": \"Could not load membership information: \",\n\t\"登录状态已失效,请运行 /login 重新登录 DeepAILab。\":\n\t\t\"Your session has expired. Run /login to sign in to DeepAILab again.\",\n\t\"账户额度已用完。运行 /account 查看套餐,或前往 deepailab.ai 充值后继续。\":\n\t\t\"Your account is out of credit. Run /account to see your plan, or top up at deepailab.ai to continue.\",\n\t\"请求太频繁,网关正在限流。请稍等几秒再试。\":\n\t\t\"Too many requests - the gateway is rate limiting. Wait a few seconds and try again.\",\n\t\"当前模型在网关上不可用(可能未绑定密钥)。用 /model 换一个模型试试。\":\n\t\t\"This model is not available on the gateway (it may have no key bound). Try another with /model.\",\n\t\"DeepAILab 网关暂时不可用(服务端错误),请稍后重试。\":\n\t\t\"The DeepAILab gateway is temporarily unavailable (server error). Please try again shortly.\",\n\t要查询的文件的绝对路径: \"Absolute path of the file to query\",\n\t\"查询类型:definition(定义)、references(引用)、hover(悬停文档)\":\n\t\t\"Query kind: definition, references, or hover\",\n\t\"符号所在行号(1 起算)\": \"Line the symbol is on (1-based)\",\n\t\"符号所在列号(1 起算,缺省为 1)\": \"Column the symbol is on (1-based, defaults to 1)\",\n\t\"语言服务器查询 (LSP)\": \"Language server query (LSP)\",\n\t\"通过语言服务器获取权威的类型信息:符号定义(definition)、全部引用位置(references)、悬停文档(hover)。\":\n\t\t\"Get authoritative type information from the language server: a symbol's definition, all of its references, or its hover documentation. \",\n\t\"支持已配置语言服务器的语言(TypeScript/JavaScript 开箱即用)。\":\n\t\t\"Works for any language with a configured server (TypeScript/JavaScript out of the box).\",\n\t\"lsp - 用语言服务器查询权威类型信息(definition / references / hover)\":\n\t\t\"lsp - authoritative type info from the language server (definition / references / hover)\",\n\t\"lsp: 无法联系 DAL Code 的 LSP 桥接,查询失败。改用 read/grep 继续。\":\n\t\t\"lsp: could not reach DAL Code's LSP bridge, so the query failed. Fall back to read/grep.\",\n\t\"… (结果过长,已截断)\": \"... (result too long, truncated)\",\n\t\"DeepAILab · 终端智能体\": \"DeepAILab · Terminal Agent\",\n\n\t中断: \"interrupt\",\n\t清屏: \"clear\",\n\t退出: \"exit\",\n\t\"退出(空输入时)\": \"exit (on empty input)\",\n\t挂起: \"suspend\",\n\t删除到行尾: \"delete to end of line\",\n\t切换思考深度: \"cycle thinking level\",\n\t切换模型: \"cycle models\",\n\t选择模型: \"select model\",\n\t展开工具输出: \"expand tool output\",\n\t展开思考过程: \"expand thinking\",\n\t外部编辑器: \"external editor\",\n\t命令菜单: \"command menu\",\n\t\"运行 bash\": \"run bash\",\n\t\"运行 bash(不进上下文)\": \"run bash (outside context)\",\n\t追加排队消息: \"queue follow-up message\",\n\t编辑排队消息: \"edit queued message\",\n\t粘贴图片: \"paste image\",\n\t拖入附件: \"drop files to attach\",\n\t\"清屏/退出\": \"clear/exit\",\n\t命令: \"commands\",\n\t更多: \"more\",\n\t\"按 ctrl+o 查看完整快捷键和已加载资源。\": \"Press ctrl+o for all shortcuts and loaded resources.\",\n\t\"遇到不会的直接问 dal——它能解释自己的功能和用法。首次使用请输入 /login 登录。\":\n\t\t\"Not sure how something works? Just ask dal — it can explain itself. Run /login to sign in first.\",\n\t会员: \"sub\",\n\t未登录: \"not signed in\",\n\t\"Enter 发送\": \"Enter to send\",\n\t\"ctrl+j 换行\": \"ctrl+j newline\",\n\t\"ctrl+v 贴图\": \"ctrl+v paste image\",\n\t\"ctrl+shift+s 截图\": \"ctrl+shift+s screenshot\",\n\t换行: \"newline\",\n\t贴图: \"paste image\",\n\t截图: \"screenshot\",\n\t附件: \"attach file\",\n\t\"@附件\": \"@ file\",\n\t个工具: \"tools\",\n\t\"拖选区域截图,取消则跳过\": \"Drag to capture a region. Cancel to skip.\",\n\t已取消截图: \"Screenshot cancelled\",\n\t\"截图后用 ctrl+v 粘贴\": \"Capture a screenshot, then paste with ctrl+v\",\n\t已选择: \"Selected\",\n\t上下文: \"context\",\n\t自动压缩: \"auto-compact\",\n\t思考关: \"thinking off\",\n\t思考: \"thinking\",\n\t\"发现新版本 \": \"New version \",\n\t\",运行 \": \" available. Run \",\n\t\"更新日志: \": \"Changelog: \",\n\t登录: \"Sign in\",\n\t快捷键: \"Shortcuts\",\n\t语言: \"Language\",\n\t终端智能体: \"Terminal Agent\",\n\n\t\"子任务的简短标题(3-5 个字,用于展示进度)\": \"Short task title (3-5 words, shown as progress label)\",\n\t\"交给子 agent 的完整任务说明,需自包含(子 agent 看不到父对话历史)\":\n\t\t\"Full task description for the sub-agent, must be self-contained (the sub-agent cannot see the parent conversation)\",\n\t\"true 时子 agent 只拥有只读工具(read/grep/find/ls),不能写文件或跑 bash\":\n\t\t\"When true, the sub-agent only gets read-only tools (read/grep/find/ls) and cannot write files or run bash\",\n\t\"子 agent 运行出错:\": \"Sub-agent failed: \",\n\t\"子 agent 没有产生任何输出。\": \"The sub-agent produced no output.\",\n\t\"dal-guard:子 agent 的\": \"dal-guard: sub-agent's\",\n\t\"调用被拒绝。\": \"call was rejected.\",\n\t\"没有可用的当前模型,无法派发子 agent。\": \"No current model available, cannot dispatch a sub-agent.\",\n\t\"你是一个专注的子 agent,负责完成父任务派发给你的一个独立子任务。\":\n\t\t\"You are a focused sub-agent responsible for completing one independent subtask dispatched by the parent task.\",\n\t\"完成后用简洁的中文文字给出最终结果,不要反问,不要征求确认。\":\n\t\t\"When done, give a concise final answer in English. Do not ask clarifying questions or seek confirmation.\",\n\t派发子任务: \"Dispatch subtask\",\n\t\"派发一个独立子 agent 去完成指定子任务,可在同一轮多次调用以并行处理互不依赖的子任务\":\n\t\t\"Dispatches an independent sub-agent to complete a given subtask; can be called multiple times in the same turn to parallelize independent subtasks\",\n\t\"(实际并发上限 \": \" (actual concurrency capped at \",\n\t\")。子 agent 默认使用当前模型和完整工具集,\":\n\t\t\"). The sub-agent uses the current model and the full toolset by default, \",\n\t\"其每次工具调用同样经过 dal-guard 审批(无 UI 场景一律拒绝风险操作)。子 agent 看不到父对话历史,\":\n\t\t\"and every tool call it makes is also approved by dal-guard (risky actions are always rejected with no UI). The sub-agent cannot see the parent conversation, \",\n\t\"prompt 必须自包含所有必要上下文。\": \"so the prompt must be self-contained with all necessary context.\",\n\t\"task - 派发子 agent 并行处理独立子任务\": \"task - dispatch sub-agents to handle independent subtasks in parallel\",\n\n\t\"dal-bridge:请求失败后不允许自动换模型。\":\n\t\t\"dal-bridge: automatic model swap after a failed request is not allowed.\",\n\t'dal-mcp:连接 MCP 服务器 \"': 'dal-mcp: failed to connect to MCP server \"',\n\t'\" 失败:': '\": ',\n\t'dal-guard:MCP 工具 \"': 'dal-guard: MCP tool \"',\n\t'\" 调用被拒绝。': '\" call was denied.',\n\t'MCP 工具 \"': 'MCP tool \"',\n\t'\" 执行失败。': '\" execution failed.',\n\t\"查看/管理 MCP 服务器连接(list | status <server> | reconnect <server>)\":\n\t\t\"View/manage MCP server connections (list | status <server> | reconnect <server>)\",\n\t\"用法:/mcp list | /mcp status <server> | /mcp reconnect <server>\":\n\t\t\"Usage: /mcp list | /mcp status <server> | /mcp reconnect <server>\",\n\t\"用法:/mcp status <server>\": \"Usage: /mcp status <server>\",\n\t\"用法:/mcp reconnect <server>\": \"Usage: /mcp reconnect <server>\",\n\t\"未配置 MCP 服务器。在 .dal/mcp.json 或 ~/.dal/agent/mcp.json 中添加。\":\n\t\t\"No MCP servers configured. Add one to .dal/mcp.json or ~/.dal/agent/mcp.json.\",\n\t\"未找到 MCP 服务器:\": \"MCP server not found: \",\n\t已连接: \"connected\",\n\t连接失败: \"failed\",\n\t已断开: \"disconnected\",\n\t\"(\": \" (\",\n\t\" 个工具)\": \" tools)\",\n\t\"命令:\": \"Command: \",\n\t\"工具:\": \"Tools: \",\n\t\"(无)\": \"(none)\",\n\t\"最近错误:\": \"Last error: \",\n\t\"已重新连接:\": \"Reconnected: \",\n\t\"重连失败:\": \"Reconnect failed: \",\n\n\t// dal-guard: interactive approval gate for risky tool calls.\n\t\"特权执行(sudo/doas)\": \"Privileged execution (sudo/doas)\",\n\t强制推送将改写远程历史: \"Force push will rewrite remote history\",\n\t硬重置会丢弃本地改动: \"Hard reset will discard local changes\",\n\t\"git clean 会删除未跟踪文件\": \"git clean will delete untracked files\",\n\t将下载内容直接管道执行: \"Piping a download straight into a shell\",\n\t执行下载的脚本: \"Executing a downloaded script\",\n\t\"递归修改权限/属主\": \"Recursive permission/ownership change\",\n\t发布软件包: \"Publishing a package\",\n\t按名称结束进程: \"Killing processes by name\",\n\t底层磁盘操作: \"Low-level disk operation\",\n\t\"第三方 MCP 工具调用(\": \"Third-party MCP tool call (\",\n\t\")\": \")\",\n\t项目目录之外的文件改动: \"File change outside the project directory\",\n\t仅本次允许: \"Allow once\",\n\t\"本次会话内允许(同类操作)\": \"Allow for this session (same kind)\",\n\t拒绝: \"Deny\",\n\t\"需要审批:\": \"Approval required: \",\n\t'dal-guard:\"': 'dal-guard: \"',\n\t'\"需要交互式审批(': '\" requires interactive approval (',\n\t\")。请在交互模式下重试,或用 /guard yolo 关闭审批门。\":\n\t\t\"). Retry in interactive mode, or run /guard yolo to turn off the approval gate.\",\n\t\"dal-guard:用户已拒绝(\": \"dal-guard: user denied (\",\n\t\")。\": \").\",\n\t\"查看或切换 dal-guard 审批门(default | yolo)\": \"View or toggle the dal-guard approval gate (default | yolo)\",\n\t\"dal-guard 模式:\": \"dal-guard mode: \",\n\t\" · 本次会话已允许:\": \" · Allowed this session: \",\n};\n\nlet currentLanguage: DalLanguage = resolveLanguage();\n\n/** Same location as pi `getAgentDir()/language`, without importing the host package. */\nfunction languageFilePath(): string {\n\tconst envDir = process.env.DAL_CODING_AGENT_DIR;\n\tconst agentDir = envDir && envDir.length > 0 ? envDir : join(homedir(), \".dal\", \"agent\");\n\treturn join(agentDir, \"language\");\n}\n\nfunction resolveLanguage(): DalLanguage {\n\ttry {\n\t\tconst saved = readFileSync(languageFilePath(), \"utf8\").trim();\n\t\tif (saved === \"zh\" || saved === \"en\") return saved;\n\t} catch {\n\t\t// Not chosen yet — fall through to environment detection.\n\t}\n\tconst env = process.env.DAL_LANG || process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG || \"\";\n\t// An unset locale used to mean Chinese. It is characteristic of Docker\n\t// images, CI runners and stripped-down SSH sessions rather than of Chinese\n\t// users — and those are exactly the environments that never see the language\n\t// picker, which only opens in a TUI (dal-lang/src/index.ts). A Chinese user\n\t// in a terminal is asked on first run and their answer is remembered; an\n\t// English user in a container had no way out of a Chinese interface.\n\treturn /^(zh|cmn)/i.test(env) ? \"zh\" : \"en\";\n}\n\n/** Whether the user has made an explicit, persisted language choice. */\nexport function hasChosenLanguage(): boolean {\n\ttry {\n\t\tconst saved = readFileSync(languageFilePath(), \"utf8\").trim();\n\t\treturn saved === \"zh\" || saved === \"en\";\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport function getLanguage(): DalLanguage {\n\treturn currentLanguage;\n}\n\n/**\n * Applies the language and persists the choice.\n *\n * Returns whether it was persisted. Callers must not claim success on a false:\n * the one-time picker used to say \"Restart dal to apply everywhere\" after a\n * failed write, so the user restarted into the old language and got asked again.\n */\nexport function setLanguage(language: DalLanguage): boolean {\n\tcurrentLanguage = language;\n\ttry {\n\t\tmkdirSync(dirname(languageFilePath()), { recursive: true });\n\t\twriteFileSync(languageFilePath(), language);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/** Translate a Chinese source string. Identity for zh; catalog lookup for en. */\nexport function t(zh: string): string {\n\tif (currentLanguage === \"zh\") return zh;\n\treturn EN_CATALOG[zh] ?? zh;\n}\n"]}
@@ -110,6 +110,21 @@ const EN_CATALOG = {
110
110
  "。请安装:": ". Install it with: ",
111
111
  "没有为该文件类型配置语言服务器。请在 .dal/lsp.json 的 lspServers 中配置。": "No language server is configured for this file type. Add one under lspServers in .dal/lsp.json.",
112
112
  "lsp: 本地语言服务器查询失败:": "lsp: the local language server query failed: ",
113
+ "要加载的技能名称,取自本工具描述中列出的清单": "Name of the skill to load, from the list in this tool's description",
114
+ "可用技能:": "Available skills:",
115
+ "加载一个 DeepAILab 技能:针对特定任务的专门指引。当手头任务与下列某条描述相符时调用本工具,然后按返回的指引执行。": "Load a DeepAILab skill: specialised instructions for a particular kind of task. Call this when the work at hand matches one of the descriptions below, then follow what it returns.",
116
+ 无法获取云端技能列表: "Could not load the cloud skill list",
117
+ 技能: "Skill",
118
+ "skill - 加载 DeepAILab 云端技能(专项任务指引)": "skill - load a DeepAILab cloud skill (task-specific instructions)",
119
+ "没有这个技能:": "No such skill: ",
120
+ "可用:": "Available: ",
121
+ "加载技能失败:": "Could not load skill: ",
122
+ "查看可用的 DeepAILab 云端技能": "List the available DeepAILab cloud skills",
123
+ "服务端返回了意外的 304": "the service answered 304 unexpectedly",
124
+ "已拒绝账号下发的 MCP 条目(只接受 https 远程服务器):": "Refused an MCP entry from the account (hosted https servers only): ",
125
+ "无法获取账号的 MCP 配置:": "Could not load the account's MCP configuration: ",
126
+ "当前没有可用的云端技能(未登录,或服务端目录为空)。": "No cloud skills are available (not signed in, or the catalogue is empty).",
127
+ 云端技能: "Cloud skills",
113
128
  已激活: "active",
114
129
  未激活: "inactive",
115
130
  至: "until",
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.js","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAI1C,MAAM,UAAU,GAA2B;IAC1C,eAAe;IACf,iBAAO,EAAE,iBAAiB;IAC1B,WAAK,EAAE,SAAS;IAChB,qCAAqB,EAAE,4CAA4C;IACnE,sCAAsC;IACtC,uDAA2B,EAAE,kEAAkE;IAC/F,qBAAO,EAAE,uBAAuB;IAChC,qBAAO,EAAE,2BAA2B;IACpC,qBAAO,EAAE,gCAAgC;IACzC,qBAAO,EAAE,uBAAuB;IAChC,wCAAkB,EAAE,gDAAgD;IACpE,eAAK,EAAE,sBAAsB;IAC7B,uCAAa,EAAE,wCAAwC;IACvD,iCAAW,EAAE,sCAAsC;IACnD,iCAAW,EAAE,yCAAyC;IACtD,yCAAuB,EAAE,wCAAwC;IACjE,qBA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AC1C,OAAO,eAAe,CAAC;AAAA,CACvB;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,QAAqB,EAAW;IAC3D,eAAe,GAAG,QAAQ,CAAC;IAC3B,IAAI,CAAC;QACJ,SAAS,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5D,aAAa,CAAC,gBAAgB,EAAE,EAAE,QAAQ,CAAC,CAAC;QAC5C,OAAO,IAAI,CAAC;IACb,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,KAAK,CAAC;IACd,CAAC;AAAA,CACD;AAED,iFAAiF;AACjF,MAAM,UAAU,CAAC,CAAC,EAAU,EAAU;IACrC,IAAI,eAAe,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC;IACxC,OAAO,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;AAAA,CAC5B","sourcesContent":["/**\n * Lightweight bilingual layer for dal.\n *\n * Keys are the Chinese source strings (the product's first language), values\n * are English translations. t() is identity for zh; for en it looks up the\n * catalog and falls back to the Chinese source when a translation is missing,\n * so partial coverage never breaks the UI.\n *\n * Language resolution: ~/.dal/language file > DAL_LANG env > system LANG.\n */\n\nimport { mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\n\nexport type DalLanguage = \"zh\" | \"en\";\n\nconst EN_CATALOG: Record<string, string> = {\n\t// model switch\n\t\"默认模型:\": \"Default model: \",\n\t\"模型:\": \"Model: \",\n\t\" 思考级别用 /thinking 调整\": \" Use /thinking to set the reasoning level\",\n\t// interactive status / error messages\n\t\"已有 bash 命令在运行,请先按 Esc 取消。\": \"A bash command is already running. Press Esc to cancel it first.\",\n\t已经在这个位置: \"Already at this point\",\n\t已取消自动压缩: \"Auto-compaction cancelled\",\n\t已取消分支摘要: \"Branch summarization cancelled\",\n\t已克隆到新会话: \"Cloned to new session\",\n\t\"切换 TUI 模式前请先关闭浮层\": \"Close active overlays before changing TUI mode\",\n\t已取消压缩: \"Compaction cancelled\",\n\t已复制最后一条回复到剪贴板: \"Copied last agent message to clipboard\",\n\t已复制所选消息到剪贴板: \"Copied selected message to clipboard\",\n\t当前模型不支持思考模式: \"Current model does not support thinking\",\n\t\"无法从 gh 的输出中解析 gist ID\": \"Failed to parse gist ID from gh output\",\n\t已分叉到新会话: \"Forked to new session\",\n\t\"未安装 GitHub CLI(gh),请从 https://cli.github.com/ 安装。\":\n\t\t\"GitHub CLI (gh) is not installed. Install it from https://cli.github.com/\",\n\t\"GitHub CLI 尚未登录,请先运行 gh auth login。\": \"GitHub CLI is not logged in. Run 'gh auth login' first.\",\n\t已取消导入: \"Import cancelled\",\n\t\"模型刷新超时,改为搜索已缓存的模型。\": \"Model refresh timed out; searching cached models.\",\n\t模型选择已保存到设置: \"Model selection saved to settings\",\n\t已跳转到所选位置: \"Navigated to selected point\",\n\t已取消跳转: \"Navigation cancelled\",\n\t\"还没有可复制的回复。\": \"No agent messages to copy yet.\",\n\t会话中没有条目: \"No entries in session\",\n\t\"没有可用的登录方式。\": \"No login methods available.\",\n\t没有可用于分叉的消息: \"No messages to fork from\",\n\t没有可恢复的排队消息: \"No queued messages to restore\",\n\t还没有可克隆的内容: \"Nothing to clone yet\",\n\t\"消息已排队,将在压缩完成后发送\": \"Queued message for after compaction\",\n\t已取消恢复: \"Resume cancelled\",\n\t已恢复会话: \"Resumed session\",\n\t已在当前目录恢复会话: \"Resumed session in current cwd\",\n\t所选条目没有可复制的文本: \"Selected entry has no text to copy\",\n\t已取消分享: \"Share cancelled\",\n\t启动仍在进行中: \"Startup is still in progress\",\n\t\"Windows 不支持挂起到后台\": \"Suspend to background is not supported on Windows\",\n\t\"用法:/import <path.jsonl>\": \"Usage: /import <path.jsonl>\",\n\t\"用法:/name <名称>\": \"Usage: /name <name>\",\n\t\"请等待压缩完成后再重新加载。\": \"Wait for compaction to finish before reloading.\",\n\t\"请等待当前回复完成后再重新加载。\": \"Wait for the current response to finish before reloading.\",\n\t// model selector / catalog\n\t\"仅显示已配置提供方的模型。用 /login 添加提供方。\":\n\t\t\"Only showing models from configured providers. Use /login to add providers.\",\n\t没有匹配的模型: \"No matching models\",\n\t\"正在刷新模型目录…\": \"Refreshing model catalogs…\",\n\t\"模型目录已刷新。\": \"Model catalogs refreshed.\",\n\t// dal-telemetry\n\t\"查看或切换匿名遥测(on | off)\": \"Show or toggle anonymous telemetry (on | off)\",\n\t\"匿名遥测已开启,重启后生效。\": \"Anonymous telemetry is on. Takes effect after restart.\",\n\t\"匿名遥测已关闭,重启后生效。\": \"Anonymous telemetry is off. Takes effect after restart.\",\n\t你已关闭: \"you turned it off\",\n\t\"DO_NOT_TRACK 已设置\": \"DO_NOT_TRACK is set\",\n\t\"DAL_TELEMETRY 已设置为关闭\": \"DAL_TELEMETRY is set to off\",\n\t\"检测到 CI 环境\": \"running in CI\",\n\t配置无法写入: \"the config file could not be written\",\n\t\"匿名遥测:开启\": \"Anonymous telemetry: on\",\n\t\"匿名遥测:关闭\": \"Anonymous telemetry: off\",\n\t\" 用 /telemetry on|off 切换\": \" Use /telemetry on|off to change this\",\n\t\"DAL 会发送匿名使用统计(不含代码、提示词和文件路径)以改进产品。/telemetry off 可关闭。\":\n\t\t\"DAL sends anonymous usage stats (never your code, prompts, or file paths) to improve the product. Run /telemetry off to opt out.\",\n\t\"DAL Code\": \"DAL Code\",\n\t\"输入 /login 登录 DeepAILab 账号即可开始使用。\":\n\t\t\"Run /login to sign in with your DeepAILab account and get started.\",\n\t\"当前没有可用模型。\": \"No models available. \",\n\t\"尚未选择模型。\": \"No model selected.\",\n\t\"然后用 /model 选择一个模型。\": \"Then use /model to select a model.\",\n\t所选模型: \"the selected model\",\n\t\"没有找到「{provider}」的 API 密钥。\": \"No API key found for {provider}. \",\n\t\"dal-bridge:无法联系 DAL Code 取得授权,已拒绝执行。\":\n\t\t\"dal-bridge: could not reach DAL Code for approval, so the action was refused.\",\n\t\"dal-bridge:用户已拒绝该操作。\": \"dal-bridge: the user rejected this action.\",\n\t\"submit_plan - 多步骤任务动手前先提交计划待用户审批\":\n\t\t\"submit_plan - submit a plan for approval before starting multi-step work\",\n\t提交计划待审批: \"Submit plan for approval\",\n\t\"在动手改动之前,把计划提交给用户审批。返回是否继续执行,以及用户给出的反馈。\":\n\t\t\"Submit a plan for the user to approve before making changes. Returns whether to proceed, plus any feedback.\",\n\t\"当任务是多步骤的、或会改动多个文件时使用。\": \"Use this when the task is multi-step or touches several files.\",\n\t\"这个计划要达成什么,一句话说明\": \"One sentence on what this plan achieves\",\n\t为什么选这个方案: \"Why this approach\",\n\t按顺序排列的执行步骤: \"The steps to carry out, in order\",\n\t这一步做什么: \"What this step does\",\n\t这一步的细节: \"Details for this step\",\n\t\"请在浏览器中确认登录请求,以连接 DeepAILab。\": \"Confirm the sign-in request in your browser to connect DeepAILab.\",\n\t\"警告:未签发刷新令牌 — 请检查 offline_access 授权范围。\":\n\t\t\"Warning: no refresh token was issued - check the offline_access scope.\",\n\t\"正在开通 DeepAILab 访问密钥…\": \"Provisioning your DeepAILab access key...\",\n\t\"访问密钥开通失败(\": \"Could not provision the access key (\",\n\t\"),下次使用时将自动重试。\": \"). It will be retried automatically next time.\",\n\t\"查看 DeepAILab 会员和套餐状态\": \"Show DeepAILab membership and plan status\",\n\t\"尚未登录。请运行 /login 并选择 DeepAILab。\": \"Not signed in. Run /login and choose DeepAILab.\",\n\t无法获取模型列表: \"Could not load the model list\",\n\t网关拒绝了请求: \"the gateway rejected the request\",\n\t请求超时: \"the request timed out\",\n\t\"无法连接 DeepAILab 网关\": \"could not reach the DeepAILab gateway\",\n\t\"MCP 配置有问题:\": \"MCP config problem: \",\n\t\"lsp: 正在启动语言服务器:\": \"lsp: starting the language server: \",\n\t\"lsp: line 必须从 1 开始。\": \"lsp: line is 1-based and must be at least 1.\",\n\t\"lsp: character 必须从 1 开始。\": \"lsp: character is 1-based and must be at least 1.\",\n\t\"lsp: filePath 必须是绝对路径。\": \"lsp: filePath must be absolute.\",\n\t\"未找到语言服务器命令:\": \"Language server command not found: \",\n\t\"。请安装:\": \". Install it with: \",\n\t\"没有为该文件类型配置语言服务器。请在 .dal/lsp.json 的 lspServers 中配置。\":\n\t\t\"No language server is configured for this file type. Add one under lspServers in .dal/lsp.json.\",\n\t\"lsp: 本地语言服务器查询失败:\": \"lsp: the local language server query failed: \",\n\t已激活: \"active\",\n\t未激活: \"inactive\",\n\t至: \"until\",\n\t\"无法加载会员信息:\": \"Could not load membership information: \",\n\t\"登录状态已失效,请运行 /login 重新登录 DeepAILab。\":\n\t\t\"Your session has expired. Run /login to sign in to DeepAILab again.\",\n\t\"账户额度已用完。运行 /account 查看套餐,或前往 deepailab.ai 充值后继续。\":\n\t\t\"Your account is out of credit. Run /account to see your plan, or top up at deepailab.ai to continue.\",\n\t\"请求太频繁,网关正在限流。请稍等几秒再试。\":\n\t\t\"Too many requests - the gateway is rate limiting. Wait a few seconds and try again.\",\n\t\"当前模型在网关上不可用(可能未绑定密钥)。用 /model 换一个模型试试。\":\n\t\t\"This model is not available on the gateway (it may have no key bound). Try another with /model.\",\n\t\"DeepAILab 网关暂时不可用(服务端错误),请稍后重试。\":\n\t\t\"The DeepAILab gateway is temporarily unavailable (server error). Please try again shortly.\",\n\t要查询的文件的绝对路径: \"Absolute path of the file to query\",\n\t\"查询类型:definition(定义)、references(引用)、hover(悬停文档)\":\n\t\t\"Query kind: definition, references, or hover\",\n\t\"符号所在行号(1 起算)\": \"Line the symbol is on (1-based)\",\n\t\"符号所在列号(1 起算,缺省为 1)\": \"Column the symbol is on (1-based, defaults to 1)\",\n\t\"语言服务器查询 (LSP)\": \"Language server query (LSP)\",\n\t\"通过语言服务器获取权威的类型信息:符号定义(definition)、全部引用位置(references)、悬停文档(hover)。\":\n\t\t\"Get authoritative type information from the language server: a symbol's definition, all of its references, or its hover documentation. \",\n\t\"支持已配置语言服务器的语言(TypeScript/JavaScript 开箱即用)。\":\n\t\t\"Works for any language with a configured server (TypeScript/JavaScript out of the box).\",\n\t\"lsp - 用语言服务器查询权威类型信息(definition / references / hover)\":\n\t\t\"lsp - authoritative type info from the language server (definition / references / hover)\",\n\t\"lsp: 无法联系 DAL Code 的 LSP 桥接,查询失败。改用 read/grep 继续。\":\n\t\t\"lsp: could not reach DAL Code's LSP bridge, so the query failed. Fall back to read/grep.\",\n\t\"… (结果过长,已截断)\": \"... (result too long, truncated)\",\n\t\"DeepAILab · 终端智能体\": \"DeepAILab · Terminal Agent\",\n\n\t中断: \"interrupt\",\n\t清屏: \"clear\",\n\t退出: \"exit\",\n\t\"退出(空输入时)\": \"exit (on empty input)\",\n\t挂起: \"suspend\",\n\t删除到行尾: \"delete to end of line\",\n\t切换思考深度: \"cycle thinking level\",\n\t切换模型: \"cycle models\",\n\t选择模型: \"select model\",\n\t展开工具输出: \"expand tool output\",\n\t展开思考过程: \"expand thinking\",\n\t外部编辑器: \"external editor\",\n\t命令菜单: \"command menu\",\n\t\"运行 bash\": \"run bash\",\n\t\"运行 bash(不进上下文)\": \"run bash (outside context)\",\n\t追加排队消息: \"queue follow-up message\",\n\t编辑排队消息: \"edit queued message\",\n\t粘贴图片: \"paste image\",\n\t拖入附件: \"drop files to attach\",\n\t\"清屏/退出\": \"clear/exit\",\n\t命令: \"commands\",\n\t更多: \"more\",\n\t\"按 ctrl+o 查看完整快捷键和已加载资源。\": \"Press ctrl+o for all shortcuts and loaded resources.\",\n\t\"遇到不会的直接问 dal——它能解释自己的功能和用法。首次使用请输入 /login 登录。\":\n\t\t\"Not sure how something works? Just ask dal — it can explain itself. Run /login to sign in first.\",\n\t会员: \"sub\",\n\t未登录: \"not signed in\",\n\t\"Enter 发送\": \"Enter to send\",\n\t\"ctrl+j 换行\": \"ctrl+j newline\",\n\t\"ctrl+v 贴图\": \"ctrl+v paste image\",\n\t\"ctrl+shift+s 截图\": \"ctrl+shift+s screenshot\",\n\t换行: \"newline\",\n\t贴图: \"paste image\",\n\t截图: \"screenshot\",\n\t附件: \"attach file\",\n\t\"@附件\": \"@ file\",\n\t个工具: \"tools\",\n\t\"拖选区域截图,取消则跳过\": \"Drag to capture a region. Cancel to skip.\",\n\t已取消截图: \"Screenshot cancelled\",\n\t\"截图后用 ctrl+v 粘贴\": \"Capture a screenshot, then paste with ctrl+v\",\n\t已选择: \"Selected\",\n\t上下文: \"context\",\n\t自动压缩: \"auto-compact\",\n\t思考关: \"thinking off\",\n\t思考: \"thinking\",\n\t\"发现新版本 \": \"New version \",\n\t\",运行 \": \" available. Run \",\n\t\"更新日志: \": \"Changelog: \",\n\t登录: \"Sign in\",\n\t快捷键: \"Shortcuts\",\n\t语言: \"Language\",\n\t终端智能体: \"Terminal Agent\",\n\n\t\"子任务的简短标题(3-5 个字,用于展示进度)\": \"Short task title (3-5 words, shown as progress label)\",\n\t\"交给子 agent 的完整任务说明,需自包含(子 agent 看不到父对话历史)\":\n\t\t\"Full task description for the sub-agent, must be self-contained (the sub-agent cannot see the parent conversation)\",\n\t\"true 时子 agent 只拥有只读工具(read/grep/find/ls),不能写文件或跑 bash\":\n\t\t\"When true, the sub-agent only gets read-only tools (read/grep/find/ls) and cannot write files or run bash\",\n\t\"子 agent 运行出错:\": \"Sub-agent failed: \",\n\t\"子 agent 没有产生任何输出。\": \"The sub-agent produced no output.\",\n\t\"dal-guard:子 agent 的\": \"dal-guard: sub-agent's\",\n\t\"调用被拒绝。\": \"call was rejected.\",\n\t\"没有可用的当前模型,无法派发子 agent。\": \"No current model available, cannot dispatch a sub-agent.\",\n\t\"你是一个专注的子 agent,负责完成父任务派发给你的一个独立子任务。\":\n\t\t\"You are a focused sub-agent responsible for completing one independent subtask dispatched by the parent task.\",\n\t\"完成后用简洁的中文文字给出最终结果,不要反问,不要征求确认。\":\n\t\t\"When done, give a concise final answer in English. Do not ask clarifying questions or seek confirmation.\",\n\t派发子任务: \"Dispatch subtask\",\n\t\"派发一个独立子 agent 去完成指定子任务,可在同一轮多次调用以并行处理互不依赖的子任务\":\n\t\t\"Dispatches an independent sub-agent to complete a given subtask; can be called multiple times in the same turn to parallelize independent subtasks\",\n\t\"(实际并发上限 \": \" (actual concurrency capped at \",\n\t\")。子 agent 默认使用当前模型和完整工具集,\":\n\t\t\"). The sub-agent uses the current model and the full toolset by default, \",\n\t\"其每次工具调用同样经过 dal-guard 审批(无 UI 场景一律拒绝风险操作)。子 agent 看不到父对话历史,\":\n\t\t\"and every tool call it makes is also approved by dal-guard (risky actions are always rejected with no UI). The sub-agent cannot see the parent conversation, \",\n\t\"prompt 必须自包含所有必要上下文。\": \"so the prompt must be self-contained with all necessary context.\",\n\t\"task - 派发子 agent 并行处理独立子任务\": \"task - dispatch sub-agents to handle independent subtasks in parallel\",\n\n\t\"dal-bridge:请求失败后不允许自动换模型。\":\n\t\t\"dal-bridge: automatic model swap after a failed request is not allowed.\",\n\t'dal-mcp:连接 MCP 服务器 \"': 'dal-mcp: failed to connect to MCP server \"',\n\t'\" 失败:': '\": ',\n\t'dal-guard:MCP 工具 \"': 'dal-guard: MCP tool \"',\n\t'\" 调用被拒绝。': '\" call was denied.',\n\t'MCP 工具 \"': 'MCP tool \"',\n\t'\" 执行失败。': '\" execution failed.',\n\t\"查看/管理 MCP 服务器连接(list | status <server> | reconnect <server>)\":\n\t\t\"View/manage MCP server connections (list | status <server> | reconnect <server>)\",\n\t\"用法:/mcp list | /mcp status <server> | /mcp reconnect <server>\":\n\t\t\"Usage: /mcp list | /mcp status <server> | /mcp reconnect <server>\",\n\t\"用法:/mcp status <server>\": \"Usage: /mcp status <server>\",\n\t\"用法:/mcp reconnect <server>\": \"Usage: /mcp reconnect <server>\",\n\t\"未配置 MCP 服务器。在 .dal/mcp.json 或 ~/.dal/agent/mcp.json 中添加。\":\n\t\t\"No MCP servers configured. Add one to .dal/mcp.json or ~/.dal/agent/mcp.json.\",\n\t\"未找到 MCP 服务器:\": \"MCP server not found: \",\n\t已连接: \"connected\",\n\t连接失败: \"failed\",\n\t已断开: \"disconnected\",\n\t\"(\": \" (\",\n\t\" 个工具)\": \" tools)\",\n\t\"命令:\": \"Command: \",\n\t\"工具:\": \"Tools: \",\n\t\"(无)\": \"(none)\",\n\t\"最近错误:\": \"Last error: \",\n\t\"已重新连接:\": \"Reconnected: \",\n\t\"重连失败:\": \"Reconnect failed: \",\n\n\t// dal-guard: interactive approval gate for risky tool calls.\n\t\"特权执行(sudo/doas)\": \"Privileged execution (sudo/doas)\",\n\t强制推送将改写远程历史: \"Force push will rewrite remote history\",\n\t硬重置会丢弃本地改动: \"Hard reset will discard local changes\",\n\t\"git clean 会删除未跟踪文件\": \"git clean will delete untracked files\",\n\t将下载内容直接管道执行: \"Piping a download straight into a shell\",\n\t执行下载的脚本: \"Executing a downloaded script\",\n\t\"递归修改权限/属主\": \"Recursive permission/ownership change\",\n\t发布软件包: \"Publishing a package\",\n\t按名称结束进程: \"Killing processes by name\",\n\t底层磁盘操作: \"Low-level disk operation\",\n\t\"第三方 MCP 工具调用(\": \"Third-party MCP tool call (\",\n\t\")\": \")\",\n\t项目目录之外的文件改动: \"File change outside the project directory\",\n\t仅本次允许: \"Allow once\",\n\t\"本次会话内允许(同类操作)\": \"Allow for this session (same kind)\",\n\t拒绝: \"Deny\",\n\t\"需要审批:\": \"Approval required: \",\n\t'dal-guard:\"': 'dal-guard: \"',\n\t'\"需要交互式审批(': '\" requires interactive approval (',\n\t\")。请在交互模式下重试,或用 /guard yolo 关闭审批门。\":\n\t\t\"). Retry in interactive mode, or run /guard yolo to turn off the approval gate.\",\n\t\"dal-guard:用户已拒绝(\": \"dal-guard: user denied (\",\n\t\")。\": \").\",\n\t\"查看或切换 dal-guard 审批门(default | yolo)\": \"View or toggle the dal-guard approval gate (default | yolo)\",\n\t\"dal-guard 模式:\": \"dal-guard mode: \",\n\t\" · 本次会话已允许:\": \" · Allowed this session: \",\n};\n\nlet currentLanguage: DalLanguage = resolveLanguage();\n\n/** Same location as pi `getAgentDir()/language`, without importing the host package. */\nfunction languageFilePath(): string {\n\tconst envDir = process.env.DAL_CODING_AGENT_DIR;\n\tconst agentDir = envDir && envDir.length > 0 ? envDir : join(homedir(), \".dal\", \"agent\");\n\treturn join(agentDir, \"language\");\n}\n\nfunction resolveLanguage(): DalLanguage {\n\ttry {\n\t\tconst saved = readFileSync(languageFilePath(), \"utf8\").trim();\n\t\tif (saved === \"zh\" || saved === \"en\") return saved;\n\t} catch {\n\t\t// Not chosen yet — fall through to environment detection.\n\t}\n\tconst env = process.env.DAL_LANG || process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG || \"\";\n\t// An unset locale used to mean Chinese. It is characteristic of Docker\n\t// images, CI runners and stripped-down SSH sessions rather than of Chinese\n\t// users — and those are exactly the environments that never see the language\n\t// picker, which only opens in a TUI (dal-lang/src/index.ts). A Chinese user\n\t// in a terminal is asked on first run and their answer is remembered; an\n\t// English user in a container had no way out of a Chinese interface.\n\treturn /^(zh|cmn)/i.test(env) ? \"zh\" : \"en\";\n}\n\n/** Whether the user has made an explicit, persisted language choice. */\nexport function hasChosenLanguage(): boolean {\n\ttry {\n\t\tconst saved = readFileSync(languageFilePath(), \"utf8\").trim();\n\t\treturn saved === \"zh\" || saved === \"en\";\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport function getLanguage(): DalLanguage {\n\treturn currentLanguage;\n}\n\n/**\n * Applies the language and persists the choice.\n *\n * Returns whether it was persisted. Callers must not claim success on a false:\n * the one-time picker used to say \"Restart dal to apply everywhere\" after a\n * failed write, so the user restarted into the old language and got asked again.\n */\nexport function setLanguage(language: DalLanguage): boolean {\n\tcurrentLanguage = language;\n\ttry {\n\t\tmkdirSync(dirname(languageFilePath()), { recursive: true });\n\t\twriteFileSync(languageFilePath(), language);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/** Translate a Chinese source string. Identity for zh; catalog lookup for en. */\nexport function t(zh: string): string {\n\tif (currentLanguage === \"zh\") return zh;\n\treturn EN_CATALOG[zh] ?? zh;\n}\n"]}
1
+ {"version":3,"file":"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AG,QAAQ,CAAC;IAC3B,IAAI,CAAC;QACJ,SAAS,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5D,aAAa,CAAC,gBAAgB,EAAE,EAAE,QAAQ,CAAC,CAAC;QAC5C,OAAO,IAAI,CAAC;IACb,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,KAAK,CAAC;IACd,CAAC;AAAA,CACD;AAED,iFAAiF;AACjF,MAAM,UAAU,CAAC,CAAC,EAAU,EAAU;IACrC,IAAI,eAAe,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC;IACxC,OAAO,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;AAAA,CAC5B","sourcesContent":["/**\n * Lightweight bilingual layer for dal.\n *\n * Keys are the Chinese source strings (the product's first language), values\n * are English translations. t() is identity for zh; for en it looks up the\n * catalog and falls back to the Chinese source when a translation is missing,\n * so partial coverage never breaks the UI.\n *\n * Language resolution: ~/.dal/language file > DAL_LANG env > system LANG.\n */\n\nimport { mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\n\nexport type DalLanguage = \"zh\" | \"en\";\n\nconst EN_CATALOG: Record<string, string> = {\n\t// model switch\n\t\"默认模型:\": \"Default model: \",\n\t\"模型:\": \"Model: \",\n\t\" 思考级别用 /thinking 调整\": \" Use /thinking to set the reasoning level\",\n\t// interactive status / error messages\n\t\"已有 bash 命令在运行,请先按 Esc 取消。\": \"A bash command is already running. Press Esc to cancel it first.\",\n\t已经在这个位置: \"Already at this point\",\n\t已取消自动压缩: \"Auto-compaction cancelled\",\n\t已取消分支摘要: \"Branch summarization cancelled\",\n\t已克隆到新会话: \"Cloned to new session\",\n\t\"切换 TUI 模式前请先关闭浮层\": \"Close active overlays before changing TUI mode\",\n\t已取消压缩: \"Compaction cancelled\",\n\t已复制最后一条回复到剪贴板: \"Copied last agent message to clipboard\",\n\t已复制所选消息到剪贴板: \"Copied selected message to clipboard\",\n\t当前模型不支持思考模式: \"Current model does not support thinking\",\n\t\"无法从 gh 的输出中解析 gist ID\": \"Failed to parse gist ID from gh output\",\n\t已分叉到新会话: \"Forked to new session\",\n\t\"未安装 GitHub CLI(gh),请从 https://cli.github.com/ 安装。\":\n\t\t\"GitHub CLI (gh) is not installed. Install it from https://cli.github.com/\",\n\t\"GitHub CLI 尚未登录,请先运行 gh auth login。\": \"GitHub CLI is not logged in. Run 'gh auth login' first.\",\n\t已取消导入: \"Import cancelled\",\n\t\"模型刷新超时,改为搜索已缓存的模型。\": \"Model refresh timed out; searching cached models.\",\n\t模型选择已保存到设置: \"Model selection saved to settings\",\n\t已跳转到所选位置: \"Navigated to selected point\",\n\t已取消跳转: \"Navigation cancelled\",\n\t\"还没有可复制的回复。\": \"No agent messages to copy yet.\",\n\t会话中没有条目: \"No entries in session\",\n\t\"没有可用的登录方式。\": \"No login methods available.\",\n\t没有可用于分叉的消息: \"No messages to fork from\",\n\t没有可恢复的排队消息: \"No queued messages to restore\",\n\t还没有可克隆的内容: \"Nothing to clone yet\",\n\t\"消息已排队,将在压缩完成后发送\": \"Queued message for after compaction\",\n\t已取消恢复: \"Resume cancelled\",\n\t已恢复会话: \"Resumed session\",\n\t已在当前目录恢复会话: \"Resumed session in current cwd\",\n\t所选条目没有可复制的文本: \"Selected entry has no text to copy\",\n\t已取消分享: \"Share cancelled\",\n\t启动仍在进行中: \"Startup is still in progress\",\n\t\"Windows 不支持挂起到后台\": \"Suspend to background is not supported on Windows\",\n\t\"用法:/import <path.jsonl>\": \"Usage: /import <path.jsonl>\",\n\t\"用法:/name <名称>\": \"Usage: /name <name>\",\n\t\"请等待压缩完成后再重新加载。\": \"Wait for compaction to finish before reloading.\",\n\t\"请等待当前回复完成后再重新加载。\": \"Wait for the current response to finish before reloading.\",\n\t// model selector / catalog\n\t\"仅显示已配置提供方的模型。用 /login 添加提供方。\":\n\t\t\"Only showing models from configured providers. Use /login to add providers.\",\n\t没有匹配的模型: \"No matching models\",\n\t\"正在刷新模型目录…\": \"Refreshing model catalogs…\",\n\t\"模型目录已刷新。\": \"Model catalogs refreshed.\",\n\t// dal-telemetry\n\t\"查看或切换匿名遥测(on | off)\": \"Show or toggle anonymous telemetry (on | off)\",\n\t\"匿名遥测已开启,重启后生效。\": \"Anonymous telemetry is on. Takes effect after restart.\",\n\t\"匿名遥测已关闭,重启后生效。\": \"Anonymous telemetry is off. Takes effect after restart.\",\n\t你已关闭: \"you turned it off\",\n\t\"DO_NOT_TRACK 已设置\": \"DO_NOT_TRACK is set\",\n\t\"DAL_TELEMETRY 已设置为关闭\": \"DAL_TELEMETRY is set to off\",\n\t\"检测到 CI 环境\": \"running in CI\",\n\t配置无法写入: \"the config file could not be written\",\n\t\"匿名遥测:开启\": \"Anonymous telemetry: on\",\n\t\"匿名遥测:关闭\": \"Anonymous telemetry: off\",\n\t\" 用 /telemetry on|off 切换\": \" Use /telemetry on|off to change this\",\n\t\"DAL 会发送匿名使用统计(不含代码、提示词和文件路径)以改进产品。/telemetry off 可关闭。\":\n\t\t\"DAL sends anonymous usage stats (never your code, prompts, or file paths) to improve the product. Run /telemetry off to opt out.\",\n\t\"DAL Code\": \"DAL Code\",\n\t\"输入 /login 登录 DeepAILab 账号即可开始使用。\":\n\t\t\"Run /login to sign in with your DeepAILab account and get started.\",\n\t\"当前没有可用模型。\": \"No models available. \",\n\t\"尚未选择模型。\": \"No model selected.\",\n\t\"然后用 /model 选择一个模型。\": \"Then use /model to select a model.\",\n\t所选模型: \"the selected model\",\n\t\"没有找到「{provider}」的 API 密钥。\": \"No API key found for {provider}. \",\n\t\"dal-bridge:无法联系 DAL Code 取得授权,已拒绝执行。\":\n\t\t\"dal-bridge: could not reach DAL Code for approval, so the action was refused.\",\n\t\"dal-bridge:用户已拒绝该操作。\": \"dal-bridge: the user rejected this action.\",\n\t\"submit_plan - 多步骤任务动手前先提交计划待用户审批\":\n\t\t\"submit_plan - submit a plan for approval before starting multi-step work\",\n\t提交计划待审批: \"Submit plan for approval\",\n\t\"在动手改动之前,把计划提交给用户审批。返回是否继续执行,以及用户给出的反馈。\":\n\t\t\"Submit a plan for the user to approve before making changes. Returns whether to proceed, plus any feedback.\",\n\t\"当任务是多步骤的、或会改动多个文件时使用。\": \"Use this when the task is multi-step or touches several files.\",\n\t\"这个计划要达成什么,一句话说明\": \"One sentence on what this plan achieves\",\n\t为什么选这个方案: \"Why this approach\",\n\t按顺序排列的执行步骤: \"The steps to carry out, in order\",\n\t这一步做什么: \"What this step does\",\n\t这一步的细节: \"Details for this step\",\n\t\"请在浏览器中确认登录请求,以连接 DeepAILab。\": \"Confirm the sign-in request in your browser to connect DeepAILab.\",\n\t\"警告:未签发刷新令牌 — 请检查 offline_access 授权范围。\":\n\t\t\"Warning: no refresh token was issued - check the offline_access scope.\",\n\t\"正在开通 DeepAILab 访问密钥…\": \"Provisioning your DeepAILab access key...\",\n\t\"访问密钥开通失败(\": \"Could not provision the access key (\",\n\t\"),下次使用时将自动重试。\": \"). It will be retried automatically next time.\",\n\t\"查看 DeepAILab 会员和套餐状态\": \"Show DeepAILab membership and plan status\",\n\t\"尚未登录。请运行 /login 并选择 DeepAILab。\": \"Not signed in. Run /login and choose DeepAILab.\",\n\t无法获取模型列表: \"Could not load the model list\",\n\t网关拒绝了请求: \"the gateway rejected the request\",\n\t请求超时: \"the request timed out\",\n\t\"无法连接 DeepAILab 网关\": \"could not reach the DeepAILab gateway\",\n\t\"MCP 配置有问题:\": \"MCP config problem: \",\n\t\"lsp: 正在启动语言服务器:\": \"lsp: starting the language server: \",\n\t\"lsp: line 必须从 1 开始。\": \"lsp: line is 1-based and must be at least 1.\",\n\t\"lsp: character 必须从 1 开始。\": \"lsp: character is 1-based and must be at least 1.\",\n\t\"lsp: filePath 必须是绝对路径。\": \"lsp: filePath must be absolute.\",\n\t\"未找到语言服务器命令:\": \"Language server command not found: \",\n\t\"。请安装:\": \". Install it with: \",\n\t\"没有为该文件类型配置语言服务器。请在 .dal/lsp.json 的 lspServers 中配置。\":\n\t\t\"No language server is configured for this file type. Add one under lspServers in .dal/lsp.json.\",\n\t\"lsp: 本地语言服务器查询失败:\": \"lsp: the local language server query failed: \",\n\t\"要加载的技能名称,取自本工具描述中列出的清单\":\n\t\t\"Name of the skill to load, from the list in this tool's description\",\n\t\"可用技能:\": \"Available skills:\",\n\t\"加载一个 DeepAILab 技能:针对特定任务的专门指引。当手头任务与下列某条描述相符时调用本工具,然后按返回的指引执行。\":\n\t\t\"Load a DeepAILab skill: specialised instructions for a particular kind of task. Call this when the work at hand matches one of the descriptions below, then follow what it returns.\",\n\t无法获取云端技能列表: \"Could not load the cloud skill list\",\n\t技能: \"Skill\",\n\t\"skill - 加载 DeepAILab 云端技能(专项任务指引)\":\n\t\t\"skill - load a DeepAILab cloud skill (task-specific instructions)\",\n\t\"没有这个技能:\": \"No such skill: \",\n\t\"可用:\": \"Available: \",\n\t\"加载技能失败:\": \"Could not load skill: \",\n\t\"查看可用的 DeepAILab 云端技能\": \"List the available DeepAILab cloud skills\",\n\t\"服务端返回了意外的 304\": \"the service answered 304 unexpectedly\",\n\t\"已拒绝账号下发的 MCP 条目(只接受 https 远程服务器):\":\n\t\t\"Refused an MCP entry from the account (hosted https servers only): \",\n\t\"无法获取账号的 MCP 配置:\": \"Could not load the account's MCP configuration: \",\n\t\"当前没有可用的云端技能(未登录,或服务端目录为空)。\":\n\t\t\"No cloud skills are available (not signed in, or the catalogue is empty).\",\n\t云端技能: \"Cloud skills\",\n\t已激活: \"active\",\n\t未激活: \"inactive\",\n\t至: \"until\",\n\t\"无法加载会员信息:\": \"Could not load membership information: \",\n\t\"登录状态已失效,请运行 /login 重新登录 DeepAILab。\":\n\t\t\"Your session has expired. Run /login to sign in to DeepAILab again.\",\n\t\"账户额度已用完。运行 /account 查看套餐,或前往 deepailab.ai 充值后继续。\":\n\t\t\"Your account is out of credit. Run /account to see your plan, or top up at deepailab.ai to continue.\",\n\t\"请求太频繁,网关正在限流。请稍等几秒再试。\":\n\t\t\"Too many requests - the gateway is rate limiting. Wait a few seconds and try again.\",\n\t\"当前模型在网关上不可用(可能未绑定密钥)。用 /model 换一个模型试试。\":\n\t\t\"This model is not available on the gateway (it may have no key bound). Try another with /model.\",\n\t\"DeepAILab 网关暂时不可用(服务端错误),请稍后重试。\":\n\t\t\"The DeepAILab gateway is temporarily unavailable (server error). Please try again shortly.\",\n\t要查询的文件的绝对路径: \"Absolute path of the file to query\",\n\t\"查询类型:definition(定义)、references(引用)、hover(悬停文档)\":\n\t\t\"Query kind: definition, references, or hover\",\n\t\"符号所在行号(1 起算)\": \"Line the symbol is on (1-based)\",\n\t\"符号所在列号(1 起算,缺省为 1)\": \"Column the symbol is on (1-based, defaults to 1)\",\n\t\"语言服务器查询 (LSP)\": \"Language server query (LSP)\",\n\t\"通过语言服务器获取权威的类型信息:符号定义(definition)、全部引用位置(references)、悬停文档(hover)。\":\n\t\t\"Get authoritative type information from the language server: a symbol's definition, all of its references, or its hover documentation. \",\n\t\"支持已配置语言服务器的语言(TypeScript/JavaScript 开箱即用)。\":\n\t\t\"Works for any language with a configured server (TypeScript/JavaScript out of the box).\",\n\t\"lsp - 用语言服务器查询权威类型信息(definition / references / hover)\":\n\t\t\"lsp - authoritative type info from the language server (definition / references / hover)\",\n\t\"lsp: 无法联系 DAL Code 的 LSP 桥接,查询失败。改用 read/grep 继续。\":\n\t\t\"lsp: could not reach DAL Code's LSP bridge, so the query failed. Fall back to read/grep.\",\n\t\"… (结果过长,已截断)\": \"... (result too long, truncated)\",\n\t\"DeepAILab · 终端智能体\": \"DeepAILab · Terminal Agent\",\n\n\t中断: \"interrupt\",\n\t清屏: \"clear\",\n\t退出: \"exit\",\n\t\"退出(空输入时)\": \"exit (on empty input)\",\n\t挂起: \"suspend\",\n\t删除到行尾: \"delete to end of line\",\n\t切换思考深度: \"cycle thinking level\",\n\t切换模型: \"cycle models\",\n\t选择模型: \"select model\",\n\t展开工具输出: \"expand tool output\",\n\t展开思考过程: \"expand thinking\",\n\t外部编辑器: \"external editor\",\n\t命令菜单: \"command menu\",\n\t\"运行 bash\": \"run bash\",\n\t\"运行 bash(不进上下文)\": \"run bash (outside context)\",\n\t追加排队消息: \"queue follow-up message\",\n\t编辑排队消息: \"edit queued message\",\n\t粘贴图片: \"paste image\",\n\t拖入附件: \"drop files to attach\",\n\t\"清屏/退出\": \"clear/exit\",\n\t命令: \"commands\",\n\t更多: \"more\",\n\t\"按 ctrl+o 查看完整快捷键和已加载资源。\": \"Press ctrl+o for all shortcuts and loaded resources.\",\n\t\"遇到不会的直接问 dal——它能解释自己的功能和用法。首次使用请输入 /login 登录。\":\n\t\t\"Not sure how something works? Just ask dal — it can explain itself. Run /login to sign in first.\",\n\t会员: \"sub\",\n\t未登录: \"not signed in\",\n\t\"Enter 发送\": \"Enter to send\",\n\t\"ctrl+j 换行\": \"ctrl+j newline\",\n\t\"ctrl+v 贴图\": \"ctrl+v paste image\",\n\t\"ctrl+shift+s 截图\": \"ctrl+shift+s screenshot\",\n\t换行: \"newline\",\n\t贴图: \"paste image\",\n\t截图: \"screenshot\",\n\t附件: \"attach file\",\n\t\"@附件\": \"@ file\",\n\t个工具: \"tools\",\n\t\"拖选区域截图,取消则跳过\": \"Drag to capture a region. Cancel to skip.\",\n\t已取消截图: \"Screenshot cancelled\",\n\t\"截图后用 ctrl+v 粘贴\": \"Capture a screenshot, then paste with ctrl+v\",\n\t已选择: \"Selected\",\n\t上下文: \"context\",\n\t自动压缩: \"auto-compact\",\n\t思考关: \"thinking off\",\n\t思考: \"thinking\",\n\t\"发现新版本 \": \"New version \",\n\t\",运行 \": \" available. Run \",\n\t\"更新日志: \": \"Changelog: \",\n\t登录: \"Sign in\",\n\t快捷键: \"Shortcuts\",\n\t语言: \"Language\",\n\t终端智能体: \"Terminal Agent\",\n\n\t\"子任务的简短标题(3-5 个字,用于展示进度)\": \"Short task title (3-5 words, shown as progress label)\",\n\t\"交给子 agent 的完整任务说明,需自包含(子 agent 看不到父对话历史)\":\n\t\t\"Full task description for the sub-agent, must be self-contained (the sub-agent cannot see the parent conversation)\",\n\t\"true 时子 agent 只拥有只读工具(read/grep/find/ls),不能写文件或跑 bash\":\n\t\t\"When true, the sub-agent only gets read-only tools (read/grep/find/ls) and cannot write files or run bash\",\n\t\"子 agent 运行出错:\": \"Sub-agent failed: \",\n\t\"子 agent 没有产生任何输出。\": \"The sub-agent produced no output.\",\n\t\"dal-guard:子 agent 的\": \"dal-guard: sub-agent's\",\n\t\"调用被拒绝。\": \"call was rejected.\",\n\t\"没有可用的当前模型,无法派发子 agent。\": \"No current model available, cannot dispatch a sub-agent.\",\n\t\"你是一个专注的子 agent,负责完成父任务派发给你的一个独立子任务。\":\n\t\t\"You are a focused sub-agent responsible for completing one independent subtask dispatched by the parent task.\",\n\t\"完成后用简洁的中文文字给出最终结果,不要反问,不要征求确认。\":\n\t\t\"When done, give a concise final answer in English. Do not ask clarifying questions or seek confirmation.\",\n\t派发子任务: \"Dispatch subtask\",\n\t\"派发一个独立子 agent 去完成指定子任务,可在同一轮多次调用以并行处理互不依赖的子任务\":\n\t\t\"Dispatches an independent sub-agent to complete a given subtask; can be called multiple times in the same turn to parallelize independent subtasks\",\n\t\"(实际并发上限 \": \" (actual concurrency capped at \",\n\t\")。子 agent 默认使用当前模型和完整工具集,\":\n\t\t\"). The sub-agent uses the current model and the full toolset by default, \",\n\t\"其每次工具调用同样经过 dal-guard 审批(无 UI 场景一律拒绝风险操作)。子 agent 看不到父对话历史,\":\n\t\t\"and every tool call it makes is also approved by dal-guard (risky actions are always rejected with no UI). The sub-agent cannot see the parent conversation, \",\n\t\"prompt 必须自包含所有必要上下文。\": \"so the prompt must be self-contained with all necessary context.\",\n\t\"task - 派发子 agent 并行处理独立子任务\": \"task - dispatch sub-agents to handle independent subtasks in parallel\",\n\n\t\"dal-bridge:请求失败后不允许自动换模型。\":\n\t\t\"dal-bridge: automatic model swap after a failed request is not allowed.\",\n\t'dal-mcp:连接 MCP 服务器 \"': 'dal-mcp: failed to connect to MCP server \"',\n\t'\" 失败:': '\": ',\n\t'dal-guard:MCP 工具 \"': 'dal-guard: MCP tool \"',\n\t'\" 调用被拒绝。': '\" call was denied.',\n\t'MCP 工具 \"': 'MCP tool \"',\n\t'\" 执行失败。': '\" execution failed.',\n\t\"查看/管理 MCP 服务器连接(list | status <server> | reconnect <server>)\":\n\t\t\"View/manage MCP server connections (list | status <server> | reconnect <server>)\",\n\t\"用法:/mcp list | /mcp status <server> | /mcp reconnect <server>\":\n\t\t\"Usage: /mcp list | /mcp status <server> | /mcp reconnect <server>\",\n\t\"用法:/mcp status <server>\": \"Usage: /mcp status <server>\",\n\t\"用法:/mcp reconnect <server>\": \"Usage: /mcp reconnect <server>\",\n\t\"未配置 MCP 服务器。在 .dal/mcp.json 或 ~/.dal/agent/mcp.json 中添加。\":\n\t\t\"No MCP servers configured. Add one to .dal/mcp.json or ~/.dal/agent/mcp.json.\",\n\t\"未找到 MCP 服务器:\": \"MCP server not found: \",\n\t已连接: \"connected\",\n\t连接失败: \"failed\",\n\t已断开: \"disconnected\",\n\t\"(\": \" (\",\n\t\" 个工具)\": \" tools)\",\n\t\"命令:\": \"Command: \",\n\t\"工具:\": \"Tools: \",\n\t\"(无)\": \"(none)\",\n\t\"最近错误:\": \"Last error: \",\n\t\"已重新连接:\": \"Reconnected: \",\n\t\"重连失败:\": \"Reconnect failed: \",\n\n\t// dal-guard: interactive approval gate for risky tool calls.\n\t\"特权执行(sudo/doas)\": \"Privileged execution (sudo/doas)\",\n\t强制推送将改写远程历史: \"Force push will rewrite remote history\",\n\t硬重置会丢弃本地改动: \"Hard reset will discard local changes\",\n\t\"git clean 会删除未跟踪文件\": \"git clean will delete untracked files\",\n\t将下载内容直接管道执行: \"Piping a download straight into a shell\",\n\t执行下载的脚本: \"Executing a downloaded script\",\n\t\"递归修改权限/属主\": \"Recursive permission/ownership change\",\n\t发布软件包: \"Publishing a package\",\n\t按名称结束进程: \"Killing processes by name\",\n\t底层磁盘操作: \"Low-level disk operation\",\n\t\"第三方 MCP 工具调用(\": \"Third-party MCP tool call (\",\n\t\")\": \")\",\n\t项目目录之外的文件改动: \"File change outside the project directory\",\n\t仅本次允许: \"Allow once\",\n\t\"本次会话内允许(同类操作)\": \"Allow for this session (same kind)\",\n\t拒绝: \"Deny\",\n\t\"需要审批:\": \"Approval required: \",\n\t'dal-guard:\"': 'dal-guard: \"',\n\t'\"需要交互式审批(': '\" requires interactive approval (',\n\t\")。请在交互模式下重试,或用 /guard yolo 关闭审批门。\":\n\t\t\"). Retry in interactive mode, or run /guard yolo to turn off the approval gate.\",\n\t\"dal-guard:用户已拒绝(\": \"dal-guard: user denied (\",\n\t\")。\": \").\",\n\t\"查看或切换 dal-guard 审批门(default | yolo)\": \"View or toggle the dal-guard approval gate (default | yolo)\",\n\t\"dal-guard 模式:\": \"dal-guard mode: \",\n\t\" · 本次会话已允许:\": \" · Allowed this session: \",\n};\n\nlet currentLanguage: DalLanguage = resolveLanguage();\n\n/** Same location as pi `getAgentDir()/language`, without importing the host package. */\nfunction languageFilePath(): string {\n\tconst envDir = process.env.DAL_CODING_AGENT_DIR;\n\tconst agentDir = envDir && envDir.length > 0 ? envDir : join(homedir(), \".dal\", \"agent\");\n\treturn join(agentDir, \"language\");\n}\n\nfunction resolveLanguage(): DalLanguage {\n\ttry {\n\t\tconst saved = readFileSync(languageFilePath(), \"utf8\").trim();\n\t\tif (saved === \"zh\" || saved === \"en\") return saved;\n\t} catch {\n\t\t// Not chosen yet — fall through to environment detection.\n\t}\n\tconst env = process.env.DAL_LANG || process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG || \"\";\n\t// An unset locale used to mean Chinese. It is characteristic of Docker\n\t// images, CI runners and stripped-down SSH sessions rather than of Chinese\n\t// users — and those are exactly the environments that never see the language\n\t// picker, which only opens in a TUI (dal-lang/src/index.ts). A Chinese user\n\t// in a terminal is asked on first run and their answer is remembered; an\n\t// English user in a container had no way out of a Chinese interface.\n\treturn /^(zh|cmn)/i.test(env) ? \"zh\" : \"en\";\n}\n\n/** Whether the user has made an explicit, persisted language choice. */\nexport function hasChosenLanguage(): boolean {\n\ttry {\n\t\tconst saved = readFileSync(languageFilePath(), \"utf8\").trim();\n\t\treturn saved === \"zh\" || saved === \"en\";\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport function getLanguage(): DalLanguage {\n\treturn currentLanguage;\n}\n\n/**\n * Applies the language and persists the choice.\n *\n * Returns whether it was persisted. Callers must not claim success on a false:\n * the one-time picker used to say \"Restart dal to apply everywhere\" after a\n * failed write, so the user restarted into the old language and got asked again.\n */\nexport function setLanguage(language: DalLanguage): boolean {\n\tcurrentLanguage = language;\n\ttry {\n\t\tmkdirSync(dirname(languageFilePath()), { recursive: true });\n\t\twriteFileSync(languageFilePath(), language);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/** Translate a Chinese source string. Identity for zh; catalog lookup for en. */\nexport function t(zh: string): string {\n\tif (currentLanguage === \"zh\") return zh;\n\treturn EN_CATALOG[zh] ?? zh;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-pi-kit",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "private": true,
5
5
  "description": "Shared i18n helpers for DAL pi extensions. No engine peer.",
6
6
  "type": "module",
@@ -123,6 +123,26 @@ const EN_CATALOG: Record<string, string> = {
123
123
  "没有为该文件类型配置语言服务器。请在 .dal/lsp.json 的 lspServers 中配置。":
124
124
  "No language server is configured for this file type. Add one under lspServers in .dal/lsp.json.",
125
125
  "lsp: 本地语言服务器查询失败:": "lsp: the local language server query failed: ",
126
+ "要加载的技能名称,取自本工具描述中列出的清单":
127
+ "Name of the skill to load, from the list in this tool's description",
128
+ "可用技能:": "Available skills:",
129
+ "加载一个 DeepAILab 技能:针对特定任务的专门指引。当手头任务与下列某条描述相符时调用本工具,然后按返回的指引执行。":
130
+ "Load a DeepAILab skill: specialised instructions for a particular kind of task. Call this when the work at hand matches one of the descriptions below, then follow what it returns.",
131
+ 无法获取云端技能列表: "Could not load the cloud skill list",
132
+ 技能: "Skill",
133
+ "skill - 加载 DeepAILab 云端技能(专项任务指引)":
134
+ "skill - load a DeepAILab cloud skill (task-specific instructions)",
135
+ "没有这个技能:": "No such skill: ",
136
+ "可用:": "Available: ",
137
+ "加载技能失败:": "Could not load skill: ",
138
+ "查看可用的 DeepAILab 云端技能": "List the available DeepAILab cloud skills",
139
+ "服务端返回了意外的 304": "the service answered 304 unexpectedly",
140
+ "已拒绝账号下发的 MCP 条目(只接受 https 远程服务器):":
141
+ "Refused an MCP entry from the account (hosted https servers only): ",
142
+ "无法获取账号的 MCP 配置:": "Could not load the account's MCP configuration: ",
143
+ "当前没有可用的云端技能(未登录,或服务端目录为空)。":
144
+ "No cloud skills are available (not signed in, or the catalogue is empty).",
145
+ 云端技能: "Cloud skills",
126
146
  已激活: "active",
127
147
  未激活: "inactive",
128
148
  至: "until",
@@ -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,33 @@
1
+ {
2
+ "name": "@dalcode/dal-skills",
3
+ "version": "0.1.8",
4
+ "private": true,
5
+ "type": "module",
6
+ "main": "./src/index.ts",
7
+ "exports": {
8
+ ".": "./src/index.ts",
9
+ "./client": "./src/client.ts",
10
+ "./package.json": "./package.json"
11
+ },
12
+ "files": [
13
+ "src"
14
+ ],
15
+ "pi": {
16
+ "extensions": [
17
+ "./src/index.ts"
18
+ ]
19
+ },
20
+ "dependencies": {
21
+ "@dalcode/dal-pi-kit": "0.1.8",
22
+ "@dalcode/deepailab": "0.1.8",
23
+ "typebox": "1.3.7"
24
+ },
25
+ "peerDependencies": {
26
+ "@earendil-works/pi-coding-agent": "^0.1.2"
27
+ },
28
+ "peerDependenciesMeta": {
29
+ "@earendil-works/pi-coding-agent": {
30
+ "optional": false
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Talks to the DeepAILab skill service.
3
+ *
4
+ * Two calls, split on purpose. The index is what every session pays for, so it
5
+ * carries names and one-line descriptions and nothing else — a few hundred
6
+ * bytes for a catalogue of any size. A body is fetched only once the model has
7
+ * decided it wants that skill, which is also what keeps the system prompt
8
+ * small: the agent sees a menu, not the meals.
9
+ */
10
+
11
+ export interface SkillSummary {
12
+ readonly id: string;
13
+ readonly name: string;
14
+ readonly description: string;
15
+ /** Server-side revision. Shown in /skills so a user can say which they have. */
16
+ readonly version?: string;
17
+ }
18
+
19
+ export interface SkillBody extends SkillSummary {
20
+ readonly body: string;
21
+ }
22
+
23
+ export interface SkillsIndex {
24
+ readonly skills: readonly SkillSummary[];
25
+ /** Opaque; sent back as If-None-Match so an unchanged catalogue costs nothing. */
26
+ readonly etag?: string;
27
+ }
28
+
29
+ /**
30
+ * Bounded so an unreachable gateway delays the session rather than hanging it.
31
+ * The index is on the session-start path, so it gets the tighter budget; a body
32
+ * fetch happens mid-turn, where the model is already waiting.
33
+ */
34
+ const INDEX_TIMEOUT_MS = 8_000;
35
+ const BODY_TIMEOUT_MS = 15_000;
36
+
37
+ async function getJson<T>(url: string, vk: string, timeoutMs: number, etag?: string): Promise<T | "not-modified"> {
38
+ const controller = new AbortController();
39
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
40
+ try {
41
+ const res = await fetch(url, {
42
+ headers: {
43
+ "x-bf-vk": vk,
44
+ Accept: "application/json",
45
+ ...(etag ? { "If-None-Match": etag } : {}),
46
+ },
47
+ signal: controller.signal,
48
+ });
49
+ if (res.status === 304) return "not-modified";
50
+ if (!res.ok) throw new Error(`HTTP ${res.status}`);
51
+ return (await res.json()) as T;
52
+ } finally {
53
+ clearTimeout(timer);
54
+ }
55
+ }
56
+
57
+ export async function fetchSkillIndex(
58
+ apiBase: string,
59
+ vk: string,
60
+ etag?: string,
61
+ ): Promise<SkillsIndex | "not-modified"> {
62
+ const body = await getJson<{ skills?: SkillSummary[]; etag?: string }>(
63
+ `${apiBase}/portal/skills`,
64
+ vk,
65
+ INDEX_TIMEOUT_MS,
66
+ etag,
67
+ );
68
+ if (body === "not-modified") return "not-modified";
69
+ const skills = (body.skills ?? []).filter(
70
+ (s): s is SkillSummary =>
71
+ typeof s?.id === "string" &&
72
+ s.id.length > 0 &&
73
+ typeof s.name === "string" &&
74
+ typeof s.description === "string",
75
+ );
76
+ return { skills, etag: body.etag };
77
+ }
78
+
79
+ export async function fetchSkillBody(apiBase: string, vk: string, id: string): Promise<SkillBody> {
80
+ const body = await getJson<Partial<SkillBody>>(
81
+ `${apiBase}/portal/skills/${encodeURIComponent(id)}`,
82
+ vk,
83
+ BODY_TIMEOUT_MS,
84
+ );
85
+ if (body === "not-modified") throw new Error("unexpected 304 for a skill body");
86
+ if (typeof body.body !== "string" || body.body.length === 0) {
87
+ throw new Error("the service returned a skill with no content");
88
+ }
89
+ return {
90
+ id,
91
+ name: typeof body.name === "string" ? body.name : id,
92
+ description: typeof body.description === "string" ? body.description : "",
93
+ version: typeof body.version === "string" ? body.version : undefined,
94
+ body: body.body,
95
+ };
96
+ }