@gaoding/cli 3.0.1 → 3.0.2

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 (45) hide show
  1. package/README.md +4 -2
  2. package/contracts/operations/agent.send/input.schema.json +1 -1
  3. package/contracts/operations/credits.get/output.schema.json +3 -3
  4. package/contracts/operations/dam.copy/input.schema.json +3 -3
  5. package/contracts/operations/dam.copy/output.schema.json +1 -1
  6. package/contracts/operations/dam.list/output.schema.json +2 -2
  7. package/contracts/operations/dam.move/input.schema.json +3 -3
  8. package/contracts/operations/dam.search/output.schema.json +2 -2
  9. package/contracts/operations/task.get/output.schema.json +2 -2
  10. package/contracts/presentations/task.get.schema.json +2 -2
  11. package/dist/bin/gd-cli.js +1 -6
  12. package/dist/bin/insmind-cli.js +1 -6
  13. package/dist/src/bootstrap/create-cli.js +32 -19
  14. package/dist/src/bootstrap/create-runtime.js +6 -2
  15. package/dist/src/bootstrap/run-task-worker.js +6 -2
  16. package/dist/src/bootstrap/validators.js +0 -8
  17. package/dist/src/cli/agent-commands.js +3 -3
  18. package/dist/src/cli/dam-commands.js +14 -6
  19. package/dist/src/cli/errors.js +17 -6
  20. package/dist/src/cli/task-commands.js +1 -1
  21. package/dist/src/cli/update-command.js +3 -3
  22. package/dist/src/contracts/creation-input.js +0 -3
  23. package/dist/src/features/dam/file-downloader.js +19 -9
  24. package/dist/src/features/dam/operation-executor.js +2 -0
  25. package/dist/src/features/dam/use-cases.js +53 -29
  26. package/dist/src/features/skill/manual.js +37 -31
  27. package/dist/src/features/task/store.js +7 -0
  28. package/dist/src/features/task/use-cases.js +66 -10
  29. package/dist/src/features/update/check-schema.js +22 -16
  30. package/dist/src/features/update/update-notification.js +8 -4
  31. package/dist/src/features/update/update-service.js +37 -16
  32. package/dist/src/telemetry/invocation.js +8 -4
  33. package/dist/src/telemetry/process-errors.js +7 -2
  34. package/dist/src/telemetry/sanitize.js +18 -7
  35. package/dist/src/telemetry/sls-sink.js +38 -15
  36. package/package.json +7 -7
  37. package/skills/gd-cli/SKILL.md +1 -1
  38. package/dist/src/features/editor/bridge-client.js +0 -107
  39. package/dist/src/features/editor/bridge-process.js +0 -237
  40. package/dist/src/features/editor/bridge-server.js +0 -339
  41. package/dist/src/features/editor/protocol.js +0 -1
  42. package/dist/src/features/editor/public-url.js +0 -1
  43. package/dist/src/features/editor/session-state.js +0 -81
  44. package/dist/src/features/editor/session.js +0 -232
  45. package/dist/src/features/editor/use-cases.js +0 -118
package/README.md CHANGED
@@ -6,7 +6,9 @@
6
6
 
7
7
  ## 安装
8
8
 
9
- 需要 Node.js 20 或更高版本。使用 npm 或 pnpm 全局安装:
9
+ 需要 Node.js 20.10.0 或更高版本。使用 npm 或 pnpm 全局安装:
10
+
11
+ 旧版千问办公 CLI 连接器使用宿主管理的 Node。若其版本低于 20.10.0,请切换到千问办公远程 MCP 连接器 2.x,或请宿主升级其 Node 到 20.10.0 或更高版本后重新安装 CLI。
10
12
 
11
13
  ```bash
12
14
  npm install --global --allow-scripts=@gaoding/cli @gaoding/cli
@@ -68,7 +70,7 @@ gd-cli credits usage list --help
68
70
  gd-cli credits usage get --schema
69
71
  ```
70
72
 
71
- 选定 Model 后,以 `model get` 返回的 `parameters` 与 `usageDescription` 构造实际输入;其中 `cost` 是当前上架 SKU 的稿豆价格区间,不表示某次调用的实际扣费。`tool call <tool> --schema` 只给出整个 Tool 的参数并集。运行 `gd-cli --help` 查看当前命令;运行任一命令的 `--help` 查看参数。
73
+ 选定 Model 后,以 `model get` 返回的 `parameters` 与 `usageDescription` 构造实际输入;其中 `cost` 是当前上架 SKU 的稿豆价格区间,不表示某次调用的实际扣费。`tool call <tool> --schema` 给出整个 Tool 的参数索引,并在 `allOf` 中按所选模型列出必填项和取值约束;结合 `model get <model> --tool <tool>` 查看当前模型的说明和完整输入 Schema。运行 `gd-cli --help` 查看当前命令;运行任一命令的 `--help` 查看参数。
72
74
 
73
75
  CLI 最多每小时检查一次 npm `latest`,发现新版本后每天最多在 stderr 提醒一次;检查失败不影响原命令,`CI=true` 时跳过。普通启动不会检查或修复 Agent Skill。`gd-cli update` 始终实时检查 `latest`,支持更新 npm、pnpm 全局安装并同步 Agent Skill。
74
76
 
@@ -204,7 +204,7 @@
204
204
  "type": "string",
205
205
  "minLength": 1,
206
206
  "pattern": ".*\\S.*",
207
- "description": "可选创作模型机器标识;指定时由 CLI 根据实时 Model Catalog 校验。"
207
+ "description": "可选创作模型标识;已知编辑模型别名会映射到服务端 code,其余标识原样发送,由执行服务判断能否使用。"
208
208
  },
209
209
  "arguments": {
210
210
  "type": "object",
@@ -32,19 +32,19 @@
32
32
  "type": "number",
33
33
  "minimum": 0,
34
34
  "maximum": 9007199254740991,
35
- "description": "该权益行的 total;不等同于终身累计充值。"
35
+ "description": "本次查询返回的各条权益的 total 之和;不等同于终身累计充值。"
36
36
  },
37
37
  "used": {
38
38
  "type": "number",
39
39
  "minimum": 0,
40
40
  "maximum": 9007199254740991,
41
- "description": "与该权益行总量配对的已用量;不等同于所选日期消费合计。"
41
+ "description": "本次查询返回的各条权益的 used 之和;不等同于所选日期消费合计。"
42
42
  },
43
43
  "pending": {
44
44
  "type": "number",
45
45
  "minimum": 0,
46
46
  "maximum": 9007199254740991,
47
- "description": "服务端 wait 的数值;含义由服务端定义,不承诺待生效或冻结。"
47
+ "description": "本次查询返回的各条权益的服务端 wait 之和;含义由服务端定义,不承诺待生效或冻结。"
48
48
  },
49
49
  "available": {
50
50
  "type": "number",
@@ -8,9 +8,9 @@
8
8
  "properties": {
9
9
  "entry_id": { "$ref": "#/$defs/nonblank" },
10
10
  "kind": { "$ref": "#/$defs/kind" },
11
- "repositoryId": { "$ref": "#/$defs/nonblank" },
12
- "targetRepositoryId": { "$ref": "#/$defs/nonblank" },
13
- "targetFolderId": { "$ref": "#/$defs/nonblank" }
11
+ "repositoryId": { "$ref": "#/$defs/nonblank", "description": "源资源库 ID;省略时使用当前默认资源库。" },
12
+ "targetRepositoryId": { "$ref": "#/$defs/nonblank", "description": "目标资源库 ID;省略时使用源资源库。" },
13
+ "targetFolderId": { "$ref": "#/$defs/nonblank", "description": "目标文件夹 ID;目标资源库根目录传字符串 \"0\"。" }
14
14
  },
15
15
  "$defs": {
16
16
  "nonblank": { "type": "string", "minLength": 1, "pattern": ".*\\S.*" },
@@ -10,7 +10,7 @@
10
10
  "kind": { "$ref": "#/$defs/kind" },
11
11
  "repository_id": { "$ref": "#/$defs/nonblank" },
12
12
  "folder_id": { "$ref": "#/$defs/nonblank" },
13
- "copied_entry_id": { "$ref": "#/$defs/nonblank" }
13
+ "copied_entry_id": { "$ref": "#/$defs/nonblank", "description": "服务返回的副本 ID;成功但未返回时,到目标文件夹查找,不要重复提交复制。" }
14
14
  },
15
15
  "$defs": {
16
16
  "nonblank": { "type": "string", "minLength": 1, "pattern": ".*\\S.*" },
@@ -13,8 +13,8 @@
13
13
  "description": "本次查询的资源库 ID。"
14
14
  },
15
15
  "page_size": { "type": "integer", "minimum": 1, "description": "本次 DAM 请求的分页大小;实际 assets 数量可能大于该值。" },
16
- "total": { "type": "integer", "minimum": 0, "description": "匹配素材总数。" },
17
- "finish": { "type": "boolean", "description": "是否已到最后一页。" },
16
+ "total": { "type": "integer", "minimum": 0, "description": "服务返回总数时为匹配素材总数;未返回时为本页条数。结合 finish、next_cursor 和分页信息不完整的警告判断是否还有下一页;缺少分页事实时不能确认结束。" },
17
+ "finish": { "type": "boolean", "description": "结束标记;服务未提供时按已有总数或游标推导,缺少分页事实时不能确认结束。" },
18
18
  "next_cursor": { "$ref": "#/$defs/nonblank", "description": "下一页游标。" },
19
19
  "assets": {
20
20
  "type": "array",
@@ -8,9 +8,9 @@
8
8
  "properties": {
9
9
  "entry_id": { "$ref": "#/$defs/nonblank" },
10
10
  "kind": { "$ref": "#/$defs/kind" },
11
- "repositoryId": { "$ref": "#/$defs/nonblank" },
12
- "targetRepositoryId": { "$ref": "#/$defs/nonblank" },
13
- "targetFolderId": { "$ref": "#/$defs/nonblank" }
11
+ "repositoryId": { "$ref": "#/$defs/nonblank", "description": "源资源库 ID;省略时使用当前默认资源库。" },
12
+ "targetRepositoryId": { "$ref": "#/$defs/nonblank", "description": "目标资源库 ID;省略时使用源资源库。" },
13
+ "targetFolderId": { "$ref": "#/$defs/nonblank", "description": "目标文件夹 ID;目标资源库根目录传字符串 \"0\"。" }
14
14
  },
15
15
  "$defs": {
16
16
  "nonblank": { "type": "string", "minLength": 1, "pattern": ".*\\S.*" },
@@ -13,8 +13,8 @@
13
13
  "description": "本次查询的资源库 ID。"
14
14
  },
15
15
  "page_size": { "type": "integer", "minimum": 1, "description": "本次 DAM 请求的分页大小;实际 assets 数量可能大于该值。" },
16
- "total": { "type": "integer", "minimum": 0, "description": "匹配素材总数。" },
17
- "finish": { "type": "boolean", "description": "是否已到最后一页。" },
16
+ "total": { "type": "integer", "minimum": 0, "description": "服务返回总数时为匹配素材总数;未返回时为本页条数。结合 finish、next_cursor 和分页信息不完整的警告判断是否还有下一页;缺少分页事实时不能确认结束。" },
17
+ "finish": { "type": "boolean", "description": "结束标记;服务未提供时按已有总数或游标推导,缺少分页事实时不能确认结束。" },
18
18
  "next_cursor": { "$ref": "#/$defs/nonblank", "description": "下一页游标。" },
19
19
  "assets": {
20
20
  "type": "array",
@@ -52,7 +52,7 @@
52
52
  "agent.send",
53
53
  "tool.call"
54
54
  ],
55
- "description": "决定 result 的结构及费用含义:agent.send 为本轮回复和实扣,tool.call 为工具产物和估价。"
55
+ "description": "决定 result 的结构及费用含义:agent.send 为本轮回复和已知扣费合计,记录不完整时总额待核对;tool.call 为工具产物和目录或按输入估价。"
56
56
  },
57
57
  "label": {
58
58
  "type": "string",
@@ -96,7 +96,7 @@
96
96
  "$ref": "../tool.call/output.schema.json"
97
97
  }
98
98
  ],
99
- "description": "仅 completed 时提供原调用完整结果;同一 taskId 重读不累计 usage。Tool cost.minimum/maximum 是估价,Agent cost.amount 是本轮实扣。交付本次返回的完整链接;再次查询可更新稿定结构化资源的授权,第三方签名和正文保持原样。"
99
+ "description": "仅 completed 时提供原调用完整结果;同一 taskId 重读不累计 usage。Tool cost.minimum/maximum 是目录或按输入估价;Agent cost.amount 是已确认金额之和,记录不完整时总额待核对。交付本次返回的完整链接;再次查询可更新稿定结构化资源的授权,第三方签名和正文保持原样。"
100
100
  },
101
101
  "partialResult": {
102
102
  "oneOf": [
@@ -52,7 +52,7 @@
52
52
  "agent.send",
53
53
  "tool.call"
54
54
  ],
55
- "description": "决定 result 的结构及费用含义:agent.send 为本轮回复和实扣,tool.call 为工具产物和估价。"
55
+ "description": "决定 result 的结构及费用含义:agent.send 为本轮回复和已知扣费合计,记录不完整时总额待核对;tool.call 为工具产物和目录或按输入估价。"
56
56
  },
57
57
  "label": {
58
58
  "type": "string",
@@ -96,7 +96,7 @@
96
96
  "$ref": "../operations/tool.call/output.schema.json"
97
97
  }
98
98
  ],
99
- "description": "仅 completed 时提供原调用完整结果;同一 taskId 重读不累计 usage。Tool cost.minimum/maximum 是估价,Agent cost.amount 是本轮实扣。交付本次返回的完整链接;再次查询可更新稿定结构化资源的授权,第三方签名和正文保持原样。"
99
+ "description": "仅 completed 时提供原调用完整结果;同一 taskId 重读不累计 usage。Tool cost.minimum/maximum 是目录或按输入估价;Agent cost.amount 是已确认金额之和,记录不完整时总额待核对。交付本次返回的完整链接;再次查询可更新稿定结构化资源的授权,第三方签名和正文保持原样。"
100
100
  },
101
101
  "partialResult": {
102
102
  "oneOf": [
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
  import { randomBytes } from "node:crypto";
3
- import { runSkillManual } from "../src/features/skill/manual.js";
4
3
  import { jsonErrorsRequested } from "../src/platform/error-output-mode.js";
5
4
  import { isInterruption } from "../src/platform/interruption.js";
6
5
  const argv = process.argv.slice(2);
@@ -15,11 +14,7 @@ let runtime;
15
14
  let mapCliError;
16
15
  let redact;
17
16
  try {
18
- const manualExitCode = await runSkillManual(argv, "gd-cli", jsonErrors);
19
- if (manualExitCode !== undefined) {
20
- process.exitCode = manualExitCode;
21
- }
22
- else if (process.env.CLI_INTERNAL_HOST_DIAGNOSTIC === "1" && process.argv.length === 3 && process.argv[2] === "--version") {
17
+ if (process.env.CLI_INTERNAL_HOST_DIAGNOSTIC === "1" && process.argv.length === 3 && process.argv[2] === "--version") {
23
18
  await Promise.all([import("../src/telemetry/host-diagnostics.js"), import("../src/product/config.js")])
24
19
  .then(([{ runHostDiagnosticReporter }, { gaodingProduct }]) => runHostDiagnosticReporter({ product: gaodingProduct }))
25
20
  .catch(() => undefined);
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
  import { randomBytes } from "node:crypto";
3
- import { runSkillManual } from "../src/features/skill/manual.js";
4
3
  import { jsonErrorsRequested } from "../src/platform/error-output-mode.js";
5
4
  import { isInterruption } from "../src/platform/interruption.js";
6
5
  import { insmindProduct } from "../src/product/config.js";
@@ -16,11 +15,7 @@ let runtime;
16
15
  let mapCliError;
17
16
  let redact;
18
17
  try {
19
- const manualExitCode = await runSkillManual(process.argv.slice(2), "insmind-cli", jsonErrors);
20
- if (manualExitCode !== undefined) {
21
- process.exitCode = manualExitCode;
22
- }
23
- else if (process.env.CLI_INTERNAL_HOST_DIAGNOSTIC === "1" && process.argv.length === 3 && process.argv[2] === "--version") {
18
+ if (process.env.CLI_INTERNAL_HOST_DIAGNOSTIC === "1" && process.argv.length === 3 && process.argv[2] === "--version") {
24
19
  await import("../src/telemetry/host-diagnostics.js")
25
20
  .then(({ runHostDiagnosticReporter }) => runHostDiagnosticReporter({ product: insmindProduct }))
26
21
  .catch(() => undefined);
@@ -1,3 +1,4 @@
1
+ import { writeSkillManual, skillManualArguments } from "../features/skill/manual.js";
1
2
  import { isInterruption } from "../platform/interruption.js";
2
3
  import { registerTaskCommands } from "../cli/task-commands.js";
3
4
  import { Command, CommanderError } from "commander";
@@ -66,14 +67,27 @@ export function createCli(runtime, options) {
66
67
  return program;
67
68
  }
68
69
  export async function executeCli(options) {
69
- const definition = invocationDefinition(options.program, options.argv);
70
+ const name = options.product?.commandName ?? "gd-cli";
71
+ const manual = skillManualArguments(options.argv, name);
72
+ const definition = manual ? { operation: "skill", mode: () => "help" } : invocationDefinition(options.program, options.argv);
70
73
  await options.telemetry.issue(definition);
71
- const automaticNotice = definition.operation !== "update" && !definition.operation.startsWith("update.");
74
+ const automaticNotice = !manual && definition.operation !== "update" && !definition.operation.startsWith("update.");
72
75
  let informational = false;
73
76
  let help = false;
74
77
  try {
75
78
  try {
76
- await options.program.parseAsync(options.argv, { from: "user" });
79
+ if (manual) {
80
+ const runtime = outputs.get(options.program);
81
+ const catalog = runtime.skillCatalog;
82
+ await writeSkillManual(manual, name, content => options.telemetry.stage("output", () => {
83
+ options.signal.throwIfAborted();
84
+ runtime.io.writeOut(content);
85
+ }), catalog?.list && catalog.read ? { list: catalog.list, read: catalog.read } : undefined);
86
+ informational = true;
87
+ }
88
+ else {
89
+ await options.program.parseAsync(options.argv, { from: "user" });
90
+ }
77
91
  }
78
92
  catch (error) {
79
93
  if (!isHelpOutcome(error))
@@ -115,14 +129,16 @@ export async function executeCli(options) {
115
129
  const refused = ["TOOL_TASK_FAILED", "INSUFFICIENT_CREDITS"].includes(outcome.failure.code)
116
130
  || ["audit_rejected", "input_audit_rejected", "output_audit_rejected"].includes(details?.reason ?? "");
117
131
  const recovery = { ...details, cli_task_id: taskId };
118
- if (outcome.exitCode !== 2 && !refused && details?.phase !== "input_upload_before_dispatch") {
119
- recovery.next_steps = [
120
- ...(details?.next_steps ?? []),
121
- `${options.product?.commandName ?? "gd-cli"} task get ${taskId}`,
122
- options.product?.id === "insmind"
123
- ? "If the outcome is still unknown, tell the user and keep this ID for recovery. Do not start another creation."
124
- : "原任务结果仍未知时,向用户说明并保留此 ID 供取回。不要另发创作。"
125
- ];
132
+ const unsent = details?.phase === "input_upload_before_dispatch" ||
133
+ (details?.phase === "before_dispatch" && details.request_sent === false && details.accepted === false);
134
+ if (outcome.exitCode !== 2 && !refused && !unsent) {
135
+ recovery.next_steps = [...new Set([
136
+ ...(details?.next_steps ?? []),
137
+ `${options.product?.commandName ?? "gd-cli"} task get ${taskId}`,
138
+ options.product?.id === "insmind"
139
+ ? "If the outcome is still unknown, tell the user and keep this ID for recovery. Do not start another creation."
140
+ : "原任务结果仍未知时,向用户说明并保留此 ID 供取回。不要另发创作。"
141
+ ])];
126
142
  }
127
143
  outcome.failure.details = recovery;
128
144
  }
@@ -131,18 +147,15 @@ export async function executeCli(options) {
131
147
  const traceId = options.telemetry.selected
132
148
  ? options.telemetry.traceId
133
149
  : undefined;
134
- let errorDelivered = false;
135
- try {
150
+ const errorDelivered = await options.telemetry.stage("output", async () => {
136
151
  options.presenter.error(outcome, {
137
152
  json: errorUsesJson(options.program, options.argv),
138
153
  ...(traceId ? { traceId } : {})
139
154
  });
140
- await outputs.get(options.program)?.io.flush?.();
141
- errorDelivered = true;
142
- }
143
- catch (presenterError) {
144
- await options.telemetry.stage("output", () => { throw presenterError; }).catch(() => undefined);
145
- }
155
+ const io = outputs.get(options.program)?.io;
156
+ await (io?.flushError ?? io?.flush)?.();
157
+ return true;
158
+ }).catch(() => false);
146
159
  if (errorDelivered)
147
160
  await outputs.get(options.program)?.tasks.outputCompleted(error);
148
161
  if (errorDelivered && automaticNotice && outcome.exitCode === 1 && definition.operation !== "unknown") {
@@ -53,7 +53,7 @@ import { createOrganizationPrompt } from "../cli/prompt.js";
53
53
  import { createPresenter } from "../cli/presenter.js";
54
54
  import { createContractValidators } from "./validators.js";
55
55
  import { loadBundledSkills } from "../features/skill/bundled-skills.js";
56
- import { createUpdateService } from "../features/update/update-service.js";
56
+ import { createUpdateService, detectInstallSource, legacyQwenBridge } from "../features/update/update-service.js";
57
57
  import { createUpdateNotificationService } from "../features/update/update-notification.js";
58
58
  import { classifyTelemetryError, mapCliError } from "../cli/errors.js";
59
59
  import { createTelemetryInvocation, hostTelemetryContext } from "../telemetry/invocation.js";
@@ -138,6 +138,7 @@ export function createProductionRuntime(options = {}) {
138
138
  const io = {
139
139
  writeOut: stdout.write,
140
140
  writeError: stderr.write,
141
+ flushError: stderr.flush,
141
142
  flush: async () => { await Promise.all([stdout.flush(), stderr.flush()]); },
142
143
  inputTerminal: rawIo.inputTerminal ?? hasTerminal(rawIo.input),
143
144
  stderrTerminal: rawIo.stderrTerminal ?? hasTerminal(rawIo.stderr)
@@ -547,6 +548,7 @@ export function createProductionRuntime(options = {}) {
547
548
  currentVersion: primarySkill.version,
548
549
  packageRoot,
549
550
  bundledSkills,
551
+ env,
550
552
  fetch,
551
553
  telemetry,
552
554
  ...(product.id === "insmind" ? {
@@ -566,6 +568,8 @@ export function createProductionRuntime(options = {}) {
566
568
  fetch,
567
569
  now,
568
570
  installationOwner,
571
+ installSource: () => detectInstallSource({ binaryPath: process.argv[1] ?? "", packageRoot, cwd: process.cwd(), env,
572
+ packageName: product.npmPackage, binaryName: product.commandName }),
569
573
  ...(options.homeDirectory ? { homeDirectory: options.homeDirectory } : {}),
570
574
  ...(options.env ? { env: options.env } : {}),
571
575
  diagnosticOnly: !io.stderrTerminal && env.CLI_UPDATE_NOTICE_FORMAT !== "offer",
@@ -577,7 +581,7 @@ export function createProductionRuntime(options = {}) {
577
581
  } : {})
578
582
  });
579
583
  // The retired Qwen CLI bridge validates the original closed JSON schemas.
580
- const legacyQwen = env.CLI_HOST_APPLICATION === "qwenwork" && env.CLI_INVOCATION_PURPOSE !== undefined;
584
+ const legacyQwen = legacyQwenBridge(env);
581
585
  return {
582
586
  ...(legacyQwen ? {} : {
583
587
  skillCatalog: createSkillCatalog(product.commandName, { home: options.homeDirectory,
@@ -8,8 +8,12 @@ export async function runTaskWorker(options) {
8
8
  const { job, signal, send } = options;
9
9
  runtime.telemetry.useSignal(signal);
10
10
  runtime.telemetry.select({ operation: job.operation, mode: () => "execute" });
11
- runtime.telemetry.annotate({ ...(job.origin ? { host_application: job.origin.host_application ?? "unknown" } : {}),
12
- ...(job.origin ? { creation_trace_id: job.origin.trace_id } : {}),
11
+ runtime.telemetry.annotate({ ...(job.origin ? {
12
+ host_application: job.origin.host_application ?? "unknown",
13
+ host_application_source: job.origin.host_application_source ?? "unknown",
14
+ ...(job.origin.host_connector_version ? { host_connector_version: job.origin.host_connector_version } : {}),
15
+ creation_trace_id: job.origin.trace_id
16
+ } : {}),
13
17
  account_id: job.state.account?.id, organization_id: job.state.organization.id,
14
18
  parameters: { ...job.input }, execution_mode: "async" });
15
19
  let completion = { outcome: "success" };
@@ -90,14 +90,6 @@ export function createContractValidators(options = {}) {
90
90
  damMoveOutput: output("dam.move"),
91
91
  damCopyInput: input("dam.copy"),
92
92
  damCopyOutput: output("dam.copy"),
93
- editorConnectInput: input("editor.connect"),
94
- editorConnectOutput: output("editor.connect"),
95
- editorDisconnectOutput: output("editor.disconnect"),
96
- editorSnapshotOutput: output("editor.snapshot"),
97
- editorApplyInput: input("editor.apply"),
98
- editorApplyOutput: output("editor.apply"),
99
- editorScreenshotOutput: output("editor.screenshot"),
100
- editorSaveOutput: output("editor.save"),
101
93
  toolListOutput: output("tool.list"),
102
94
  modelListInput: input("model.list"),
103
95
  modelListOutput: output("model.list"),
@@ -17,14 +17,14 @@ export function registerAgentCommands(program, runtime) {
17
17
  .allowExcessArguments(false);
18
18
  send.addHelpText("after", [
19
19
  "",
20
- text(runtime.product, "用于业务策划、多步骤或持续创作;明确的单次媒体处理也可从 tool list 发现。先保存完整 JSON 再用 --input request.json 执行;--input - 必须在同一条 shell 命令中经管道或重定向提供完整 JSON,不交互填参。", "Use for planning, multiple steps or continuing creation; discover atomic media processing with tool list. Save complete JSON before using --input request.json. With --input -, pipe or redirect complete JSON in the same shell command; input is not an interactive form."),
20
+ text(runtime.product, "用于业务策划、多步骤或持续创作;明确的单次媒体处理也可从 tool list 发现。先保存完整 JSON 再用 --input request.json 执行;--input - 必须在同一条 shell 命令中经管道或重定向提供完整 JSON,不交互填参。", "Use agent send to plan a design, complete a task in several steps, or continue earlier work. For a single media edit, run tool list to find a tool. Save complete JSON before using --input request.json. With --input -, pipe or redirect complete JSON in the same shell command; input is not an interactive form."),
21
21
  text(runtime.product, "完整结果已校验但最终本地记录保存失败时仍返回结果和退出码 0;stderr 警告 task get 可能无法恢复,请保留输出。", "A validated complete result is delivered with exit code 0 even if its final local record cannot be saved; stderr warns that task get may not recover it. Keep the output."),
22
22
  text(runtime.product, "最终错误为 stderr 中的 JSON error 对象;stderr 也可能有进度和警告。中断退出码 130 只表示本地停止等待。", "The final error is a JSON error object on stderr, which may also contain progress and warnings. Exit code 130 means local waiting stopped."),
23
23
  ...creationTaskHelp(runtime.product),
24
24
  text(runtime.product, "本机后台进程终止或关机可能使 Agent 任务变为 unknown。", "If the local background process stops or the machine shuts down, an Agent task may become unknown."),
25
25
  text(runtime.product, "首次创作省略 JSON 中的 message.contextId;续聊时传入上次结果的 message.contextId。", "Omit message.contextId for the first creation. Continue a conversation using message.contextId from the previous result."),
26
- text(runtime.product, "completed 表示本轮 Agent 已完整回复,可能是文本、资源或补充/确认问题,并不保证已生成成品。转述实际回复;需要用户回答时询问用户,收到回答后沿用 contextId 发送下一轮。", "completed means the Agent's turn has fully replied with text, assets or clarification/confirmation questions; it does not guarantee a finished asset. Relay the actual reply, ask the user when an answer is needed, then continue with the same contextId."),
27
- text(runtime.product, "把本轮实际回复或资源连同 usage.cost.amount 的实际消耗一并交付。同步从输出读取,异步从 completed 的 result 读取。返回 0 就报 0,缺失则说明未取得。汇总按不同 taskId,同一任务重复读取只计一次。Tool minimum/maximum 是目录估价。", "Deliver this turn's reply or assets together with the actual charge in usage.cost.amount. Read it from the synchronous output or the completed task's result. Report 0 when present, and unknown when absent. Count each distinct taskId once. Tool minimum/maximum are catalog estimates."),
26
+ text(runtime.product, "completed 表示这一轮已回复。返回正文或作品就交给用户;返回问题就请用户回答,再用原 contextId 继续对话。只有实际收到作品才能说已生成。", "completed means this turn has replied. Deliver returned text or assets; if it asks a question, ask the user and continue with the same contextId. Say an asset was created only when one was returned."),
27
+ text(runtime.product, "交付本轮回复或资源,并说明 usage.cost.amount:同步从输出读取,异步从 completed 的 result 读取。记录完整时按实扣报告;若警告有记录缺少金额,报告已知合计并说明总额待核对、以账单为准,即使已知合计为 0 也不能说免费。未取得金额时说明暂时查不到。不同 taskId 分别汇总,同一任务重复读取只计一次。Tool minimum/maximum 是目录或按输入估价,实扣查对应账单。", "Deliver this turn's reply or assets and explain usage.cost.amount, read from synchronous output or the completed task's result. When records are complete, report the actual charge. If a warning says amounts are missing, report the known subtotal and say the total needs checking against the ledger, even if the subtotal is 0. If no amount is available, say so. Count each taskId once. Tool minimum/maximum are catalog or input-based estimates; check the matching ledger for actual charges."),
28
28
  text(runtime.product, "结构化问题位于 message.parts[].data.questions;回答时将 message.messageId 写入 data.questionMessageId,answers 保留 question 原文及用户 values,该 data Part 是本轮 parts 唯一一项。普通文本续聊使用 text Part。", "Structured questions are in message.parts[].data.questions. Reply with message.messageId as data.questionMessageId and answers containing the original question and the user's values; this data Part must be the sole Part. Use a text Part for ordinary follow-up conversation."),
29
29
  text(runtime.product, "可用 model 和参数示例见 model list / model get。显式 model 和 arguments 会传给 Agent,编辑模型的已知别名转换为服务字段。文本和素材用独立 Part。", "Discover models and example controls with model list and model get. Explicit model and arguments are sent to the Agent, with known editing aliases mapped to service fields. Supply text and assets as separate Parts."),
30
30
  text(runtime.product, "交付服务返回的资源时,原样使用完整 URL 及查询参数;不凭记忆重写、拼接或去掉授权参数。诊断凭证脱敏不改变可交付资源链接。", "Deliver service resources using the complete returned URL and query parameters. Do not reconstruct, splice or strip authorization parameters. Diagnostic credential redaction does not alter delivery links."),
@@ -3,6 +3,9 @@ import { bindAction, bindPreparedAction } from "./action-binding.js";
3
3
  import { CliUsageError } from "./errors.js";
4
4
  import { repositoryListView } from "./presenter.js";
5
5
  import { productText as text } from "../product/text.js";
6
+ function defaultRepositoryHelp(product) {
7
+ return text(product, "省略 --repository-id 时优先用个人库。目录完整且没有个人库时,用第一项。有些库未能列出且未找到个人库时,请用 dam repository list 查看可用的 ID,再传 --repository-id。", "Without --repository-id, the CLI uses your personal repository if available. If the full list has no personal repository, it uses the first entry. If the list is incomplete and shows no personal repository, choose an ID from dam repository list and pass --repository-id.");
8
+ }
6
9
  export function registerDamCommands(program, runtime) {
7
10
  const dam = program.command("dam")
8
11
  .description(text(runtime.product, "DAM 素材管理", "Asset management"))
@@ -11,7 +14,8 @@ export function registerDamCommands(program, runtime) {
11
14
  "",
12
15
  text(runtime.product, "先通过 repository list、folder list、tag list 或资源查询取得真实 ID,再操作;名称、前端 URL 和旧缓存不能代替 ID。", "Discover real IDs with repository list, folder list, tag list or asset queries before acting; names, frontend URLs and old caches are not IDs."),
13
16
  text(runtime.product, "支持的命令以本 help 为准;读取所选子命令的 --help 获取参数、作用范围和输出形式。", "Available commands are listed here; read the selected subcommand's --help for parameters, scope and output mode."),
14
- text(runtime.product, "资源库 ID 与组织 ID 不同。团队/企业资料显式传查询到的 repository_id;list/search/upload 省略资源库时默认个人库。素材处理使用详情中的资源链接或下载后的本地文件,再从 tool list 发现处理能力。", "Repository IDs differ from organization IDs. Pass a discovered repository_id for team/enterprise assets; list/search/upload default to the personal repository when omitted. To process an asset, use its resource link or downloaded file and discover processing with tool list."),
17
+ defaultRepositoryHelp(runtime.product),
18
+ text(runtime.product, "团队和企业素材请传资源库 ID。处理素材时,用详情中的链接或下载的文件,运行 tool list 查看可用工具。", "For team and enterprise assets, pass the repository ID. To process an asset, use the link from its details or the downloaded file. Run tool list to see available tools."),
15
19
  text(runtime.product, "写入结果未确认时先查询实际状态,不重复提交。跨资源库查询、受保护路径上传和永久删除须有用户明确授权。", "Inspect actual state before retrying an unconfirmed write. Cross-repository queries, protected-path uploads and permanent deletion require explicit user authorization."),
16
20
  ""
17
21
  ].join("\n"));
@@ -295,7 +299,7 @@ export function registerDamCommands(program, runtime) {
295
299
  .option("--allow-sensitive-path", text(runtime.product, "明确允许受保护路径", "allow a protected local path"))
296
300
  .option("--wait-analysis", text(runtime.product, "等待素材分析结束", "wait for asset analysis"))
297
301
  .option("--json", text(runtime.product, "输出 JSON", "output JSON"));
298
- upload.addHelpText("after", text(runtime.product, "\n<file> 是本地文件路径(不是 file URI);路径含空格时按 shell 规则引用。默认上传个人库根目录 0,标题默认取不含扩展名的文件名;团队位置显式传资源库和文件夹 ID。返回素材详情表示已创建;--wait-analysis 额外等待分析,未知写入先查目标位置,不重复上传。\n", "\n<file> is a local path, not a file URI; quote spaces for the shell. Defaults to personal repository root 0 and a title from the filename without its extension. Specify repository/folder IDs for team destinations. Returned asset details confirm creation; --wait-analysis also waits for analysis. Inspect the destination before repeating an unconfirmed upload.\n"));
302
+ upload.addHelpText("after", "\n" + defaultRepositoryHelp(runtime.product) + "\n" + text(runtime.product, "\n<file> 是本地文件路径(不是 file URI);路径含空格时按 shell 规则引用。省略 --folder-id 时上传到所选库的根目录 0。标题默认用去掉扩展名的文件名。返回素材详情表示已创建;--wait-analysis 额外等待分析,未知写入先查目标位置,不重复上传。\n", "\n<file> is a local path, not a file URI; quote spaces for the shell. Omit --folder-id to upload to the selected repository’s root folder (0). The title defaults to the filename without its extension. Returned asset details confirm creation; --wait-analysis also waits for analysis. Inspect the destination before repeating an unconfirmed upload.\n"));
299
303
  bindPreparedAction(upload, "organization", async (signal) => {
300
304
  signal.throwIfAborted();
301
305
  const options = upload.opts();
@@ -329,7 +333,11 @@ export function registerDamCommands(program, runtime) {
329
333
  .argument("<asset>", text(runtime.product, "素材 ID", "asset ID"))
330
334
  .option("--repository-id <id>", text(runtime.product, "所属资源库 ID", "repository ID"))
331
335
  .option("--permanent", text(runtime.product, "移入回收站后永久删除", "permanently delete after moving to trash"));
332
- deleteCommand.addHelpText("after", `\n${text(runtime.product, "默认移入回收站;--permanent 不可恢复,仅在用户明确要求永久删除时使用。支持的回收站操作请查 dam --help,不推断未列出的命令。", "Moves to the recycle bin by default; --permanent is irreversible and requires an explicit request. Consult dam --help for available recycle-bin operations rather than assuming unlisted commands exist.")}\n`);
336
+ deleteCommand.addHelpText("after", [
337
+ "", defaultRepositoryHelp(runtime.product),
338
+ text(runtime.product, "先用 dam repository list 核对素材所在的库,再移入回收站。只有用户明确要求永久删除时,才加 --permanent。永久删除无法撤销。", "Check the repository with dam repository list before moving the asset to the recycle bin. Add --permanent only when the user explicitly requests permanent deletion. This cannot be undone."),
339
+ `${runtime.product.commandName} dam delete <asset> --repository-id <id>`, ""
340
+ ].join("\n"));
333
341
  bindPreparedAction(deleteCommand, "organization", async (signal) => {
334
342
  signal.throwIfAborted();
335
343
  const options = deleteCommand.opts();
@@ -377,7 +385,7 @@ function browseCommand(command, runtime) {
377
385
  .option("--page-size <number>", text(runtime.product, "请求分页大小", "request page size"), positiveInteger)
378
386
  .option("--cursor <id>", text(runtime.product, "原样使用上一页 next_cursor,并保持相同筛选", "reuse the previous next_cursor unchanged with the same filters"))
379
387
  .option("--json", text(runtime.product, "输出 JSON", "output JSON"))
380
- .addHelpText("after", text(runtime.product, "\n默认个人资源库,每页 20 条,包含子文件夹;finish=false 时用 next_cursor 继续同范围查询,本页不代表全部结果。空结果不证明其他资源库不存在该素材;按用户指定范围核对资源库和筛选。\n", "\nDefaults to the personal repository, 20 items and inclusion of child folders. When finish=false, continue with next_cursor and unchanged scope; one page is not the entire result. An empty page says nothing about other repositories; check the user's intended repository and filters.\n"));
388
+ .addHelpText("after", "\n" + defaultRepositoryHelp(runtime.product) + "\n" + text(runtime.product, "\n默认每页 20 条,包含子文件夹。finish=false 时用 next_cursor 继续同范围查询,本页不代表全部结果。空结果不证明其他资源库不存在该素材;按用户指定范围核对资源库和筛选。\n", "\nBy default, each page includes up to 20 items and includes child folders. When finish=false, continue with next_cursor and unchanged scope; one page is not the entire result. An empty page says nothing about other repositories; check the user's intended repository and filters.\n"));
381
389
  }
382
390
  function browseInput(command) {
383
391
  const options = command.opts();
@@ -425,8 +433,8 @@ function assetListView(value, product) {
425
433
  const result = value;
426
434
  return [
427
435
  `${text(product, "资源库", "Repositories")}: ${result.repository_ids.join(", ")}`,
428
- `${text(product, "本批 / 总数", "This batch / total")}: ${result.assets.length} / ${result.total}`,
429
- result.finish ? text(product, "已到最后一页。", "Last page.")
436
+ `${text(product, "本批 / 返回计数(服务未提供总数时为本批数)", "This batch / returned count (batch size when total is unavailable)")}: ${result.assets.length} / ${result.total}`,
437
+ result.finish ? text(product, "返回结束标记:是。若提示分页信息不完整,请核对结果范围。", "End marker: yes. If pagination information is incomplete, verify the result scope.")
430
438
  : !result.next_cursor ? text(product, "服务提示还有结果,但未返回可用游标,无法续页。", "More results are indicated, but the service supplied no cursor.")
431
439
  : text(product, `还有下一页;保留筛选条件,使用 --cursor ${result.next_cursor ?? "<cursor>"} 查询。`, `More results; keep the same filters and query with --cursor ${result.next_cursor ?? "<cursor>"}.`),
432
440
  ...(result.assets.length ? [text(product, "ID\t标题\t类型\t格式", "ID\tTitle\tType\tFormat"), ...result.assets.map(assetRow)]
@@ -1,3 +1,4 @@
1
+ import { SkillManualError } from "../features/skill/manual.js";
1
2
  import { CreditsPageCursorError } from "../features/credits/use-cases.js";
2
3
  import { observedErrorCategory, observedErrorMessage } from "./observed-errors.js";
3
4
  import { TaskBackgroundError } from "../features/task/task-background.js";
@@ -46,6 +47,9 @@ export function isHelpOutcome(error) {
46
47
  && (error.code === "commander.helpDisplayed" || error.code === "commander.version");
47
48
  }
48
49
  export function mapCliError(error, options) {
50
+ if (!options.aborted && error instanceof SkillManualError) {
51
+ return failure(error.code, error.message, error.code === "USAGE_ERROR" ? 2 : 1);
52
+ }
49
53
  const outcome = mapBaseCliError(error instanceof CreationInputUploadError ? error.cause : error, options);
50
54
  if (outcome.kind === "interrupted")
51
55
  return { ...outcome, failure: { code: "INTERRUPTED",
@@ -114,11 +118,17 @@ function mapBaseCliError(error, options) {
114
118
  failure: { code: "INTERRUPTED", message: text("生成任务已取消。", "The creation task was canceled.") } };
115
119
  if (error instanceof UpdateError)
116
120
  return failure(error.code, error.message, 1, error.nextSteps, error.details);
121
+ if (options.aborted && options.operation === "dam.download") {
122
+ const paths = error instanceof DamDownloadError || error instanceof DamDownloadDestinationExistsError ? error.remainingPaths : [];
123
+ return { kind: "interrupted", exitCode: 130, failure: { code: "INTERRUPTED",
124
+ message: text("素材下载已中断。", "The download was interrupted."),
125
+ ...(paths.length ? { details: { phase: "interrupted", remaining_paths: paths,
126
+ next_steps: [text("请检查列出的文件,再决定是否重新下载。", "Check the listed files before downloading again.")] } } : {}) } };
127
+ }
117
128
  if (options.aborted)
118
129
  return { kind: "interrupted", exitCode: 130, failure: {
119
130
  code: "INTERRUPTED", message: text("已停止本地等待;已派发的任务或写操作可能仍在继续。", "Local waiting stopped; dispatched tasks or writes may still be active."),
120
131
  details: { ...(error instanceof DamOperationUnconfirmedError ? { operation: error.operation, ...error.context } : {}),
121
- ...(error instanceof DamDownloadError ? { phase: error.phase, remaining_paths: error.remainingPaths } : {}),
122
132
  next_steps: [text(`创作用 ${command} task list 找到原任务,再用 task get <id> 查询。不要直接重复提交。`, `For creation, find the original task with ${command} task list, then task get <id>. Do not resubmit directly.`)] }
123
133
  } };
124
134
  if (error instanceof TaskBackgroundError)
@@ -128,8 +138,10 @@ function mapBaseCliError(error, options) {
128
138
  if (error instanceof TaskStoreError)
129
139
  return failure("LOCAL_STATE_ERROR", insmind
130
140
  ? "Cannot read or write local task records. Check permissions and file integrity in ~/.insmind/tasks."
131
- : "无法读写本地执行记录;请检查 ~/.gd/tasks 的权限和文件完整性。", 1, error.context ? [text("保留已有输出;恢复文件访问后查询原任务,不要重新提交创作。", "Keep any output; restore file access and query the original task without submitting again."),
132
- `${command} task get ${error.context.cli_task_id}`] : undefined, { ...error.context, reason: "task_storage", system_code: systemErrorCode(error) });
141
+ : "无法读写本地执行记录;请检查 ~/.gd/tasks 的权限和文件完整性。", 1, error.context?.phase === "before_dispatch" && error.context.request_sent === false && error.context.accepted === false
142
+ ? [text("这次创作还没提交。请恢复任务目录的写入权限,再运行刚才的命令。", "The creation request was not sent. Restore write access to the task directory, then run the original command again.")]
143
+ : error.context ? [text("保留已有输出;恢复文件访问后查询原任务,不要重新提交创作。", "Keep any output; restore file access and query the original task without submitting again."),
144
+ `${command} task get ${error.context.cli_task_id}`] : undefined, { ...error.context, reason: "task_storage", system_code: systemErrorCode(error) });
133
145
  if (error instanceof UserIdentityMissingError) {
134
146
  return failure("AUTH_REQUIRED", text("登录身份缺少用户 ID,请重新登录。", "The login identity has no user ID. Please sign in again."), 1, [`${command} auth login`]);
135
147
  }
@@ -240,9 +252,8 @@ function mapBaseCliError(error, options) {
240
252
  return failure("DAM_ASSET_NOT_DOWNLOADABLE", "该素材当前没有可下载的源文件;请先查看素材状态。", 1, ["gd-cli dam get <asset-id>"]);
241
253
  }
242
254
  if (error instanceof DamDownloadDestinationExistsError) {
243
- return failure("DAM_DOWNLOAD_DESTINATION_EXISTS", insmind
244
- ? "The destination file already exists and was not overwritten. Choose another output directory."
245
- : "目标文件已存在,未覆盖任何文件;请更换输出目录或移走同名文件。", 1);
255
+ const paths = error.remainingPaths;
256
+ return failure("DAM_DOWNLOAD_DESTINATION_EXISTS", text("目标目录已有同名文件。请换一个目录下载。", "A file with this name already exists. Choose another download directory."), 1, paths.length ? [text("请先检查 remaining_paths 列出的文件。", "Check the files listed in remaining_paths first.")] : undefined, paths.length ? { phase: "destination", remaining_paths: paths } : undefined);
246
257
  }
247
258
  if (error instanceof DamDownloadError)
248
259
  return failure("DAM_DOWNLOAD_FAILED", text("素材下载未完成;请按失败阶段检查源文件访问或目标目录。", "The asset download did not complete; check source access or the destination for the reported phase."), 1, [text("已有素材无需重新生成;先检查文件状态再决定是否重新下载。", "Do not regenerate the asset; inspect file state before downloading again.")], { phase: error.phase, system_code: systemErrorCode(error), http_status: error.status,
@@ -40,7 +40,7 @@ export function registerTaskCommands(program, runtime) {
40
40
  text("读取本地状态不请求组织绑定;查询远端进度或获取下载授权仍需联网授权。查询请求失败不代表生成失败,可用原 taskId 重查。", "Local status reads do not bind the organization. Remote progress and download authorization still require network access. A failed query does not mean generation failed; query the same taskId again."),
41
41
  text("查询得到完整结果但最终缓存保存失败时仍返回结果和退出码 0;请保留 stderr 警告所指的输出,后续可能无法恢复。", "A complete result is delivered with exit code 0 if only final cache persistence fails; keep the output as warned on stderr because later recovery may be unavailable."),
42
42
  text("最终错误为 stderr 中的 JSON error 对象;stderr 也可能有进度和警告,中断不代表远端任务取消。", "The final error is a JSON error object on stderr, which may also contain progress and warnings. Interruption does not mean the remote task was cancelled."),
43
- text("查询不重新提交创作。同一任务的 usage 不重复相加;Agent usage.cost.amount 为本轮实扣,Tool minimum/maximum 为目录估价,即使相等也不是实扣。", "Queries never resubmit creation or add usage for repeated reads. Agent usage.cost.amount is this turn's actual charge; Tool minimum/maximum are catalog estimates even when equal."),
43
+ text("查询不重新提交创作。同一任务的 usage 不重复相加;Agent usage.cost.amount 是已确认扣费合计,若提示记录缺少金额则总额待核对,以账单为准。Tool minimum/maximum 是目录或按输入估价,即使相等也不是实扣。", "Queries never resubmit creation or add usage for repeated reads. Agent usage.cost.amount is the confirmed subtotal; if a warning says amounts are missing, check the total against the ledger. Tool minimum/maximum are catalog or input-based estimates even when equal."),
44
44
  text(`记录仅来自本机执行;保留至用户删除 ~/${runtime.product.stateDirectory}/tasks。切换身份或组织后只显示对应记录。`, `Tasks are local to this machine and identity context; they remain until you remove ~/${runtime.product.stateDirectory}/tasks.`),
45
45
  text("Agent 首次回执未取得或原连接中断时可能只能确认未知;不会自动选择最近 Context 或重新生成。", "A missing first Agent receipt or interrupted connection may leave the outcome unknown; the CLI does not select another Context or generate again."),
46
46
  ""
@@ -11,12 +11,12 @@ export function registerUpdateCommand(program, runtime) {
11
11
  text(runtime.product, `检查 ${runtime.product.npmPackage} 的 npm latest,更新受支持的全局 npm/pnpm 安装;CLI 已最新时仍同步随包 Skill。`, `Checks npm latest for ${runtime.product.npmPackage}, updates supported global npm/pnpm installations and synchronizes the bundled Skill even when the CLI is current.`),
12
12
  text(runtime.product, `只授权本包安装脚本:npm --allow-scripts=${runtime.product.npmPackage},pnpm --allow-build=${runtime.product.npmPackage}。`, `Enables lifecycle scripts only for this package: npm --allow-scripts=${runtime.product.npmPackage}, pnpm --allow-build=${runtime.product.npmPackage}.`),
13
13
  text(runtime.product, "普通使用只检查/提醒,不自动安装或同步 Skill。宿主管理的安装拒绝自行升级,并返回对应渠道的处理步骤;遵循该渠道,不覆盖其他宿主的 Skill。", "Normal use only checks/notifies; it does not install or synchronize Skills automatically. Host-managed installations reject self-update and return channel-specific instructions; follow that channel without overwriting other hosts' Skills."),
14
- text(runtime.product, "若 CLI 更新成功但 Skill 验收失败,保留已更新版本,按错误中的下一步修复;不支持的安装来源也以命令返回的指引为准。", "If the CLI updates but Skill verification fails, keep the updated version and follow the error's next steps. Unsupported installation sources also receive channel-specific guidance."),
14
+ text(runtime.product, "若 CLI 更新成功但 Skill 验收失败,保留已更新版本,按错误中的下一步修复;项目依赖请在原项目更新;临时运行请用原运行器选择新版;宿主安装请在宿主中更新。", "If the CLI updates but Skill verification fails, keep the updated version and follow the error's next steps. Update a project dependency in the original project, select a new version in a temporary runner, or update a host installation through that host."),
15
15
  ""
16
16
  ].join("\n"));
17
17
  const check = update.command("check")
18
18
  .description(text(runtime.product, "只读查询是否有可用升级,无需登录", "Check for an available update without signing in or installing"))
19
- .option("--for-display", text(runtime.product, "为当前前台入口交付一次到期提醒,写出成功后开始 60 分钟计时", "Deliver a due notice to the current foreground surface and start its 60-minute window on output"))
19
+ .option("--for-display", text(runtime.product, "提醒到期时,返回一条可展示的升级提示。成功写出后,同一入口在 60 分钟内不会再收到这条提醒。", "Return a due update notice. Once written successfully, the same surface will not receive it again for 60 minutes."))
20
20
  .option("--schema", text(runtime.product, "输出本地查询结果的 Schema,不查询 npm", "Print the local output schema without checking npm"))
21
21
  .allowExcessArguments(false);
22
22
  jsonOutput(check);
@@ -27,7 +27,7 @@ export function registerUpdateCommand(program, runtime) {
27
27
  await runtime.io.flush?.();
28
28
  });
29
29
  if (check.opts().schema)
30
- return write({ outputSchema: updateCheckSchema });
30
+ return write({ outputSchema: updateCheckSchema(runtime.product.id === "insmind") });
31
31
  const forDisplay = check.opts().forDisplay === true;
32
32
  await runtime.updateNotification.report(signal, forDisplay, async (result) => {
33
33
  await write(result);
@@ -7,9 +7,6 @@ export function readAgentInputSchema() {
7
7
  delete definitions.FirstFramePart;
8
8
  delete definitions.LastFramePart;
9
9
  const generation = definitions.GenerationConstraintsPart.properties.data;
10
- const model = generation.properties.model;
11
- if (model.description)
12
- model.description = "可选创作模型标识;已知编辑模型别名会映射到服务端 code,其余标识原样发送。";
13
10
  delete generation.properties.arguments.minProperties;
14
11
  const question = { $ref: "#/$defs/QuestionAnswerPart" };
15
12
  definitions.UserMessage.allOf = [