@gaoding/cli 2.0.0 → 2.1.1

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 (132) hide show
  1. package/README.md +5 -0
  2. package/contracts/operations/agent.send/input.schema.json +8 -84
  3. package/contracts/operations/agent.send/output.schema.json +6 -6
  4. package/contracts/operations/credits.get/input.schema.json +9 -0
  5. package/contracts/operations/credits.get/output.schema.json +107 -0
  6. package/contracts/operations/credits.usage.get/input.schema.json +18 -0
  7. package/contracts/operations/credits.usage.get/output.schema.json +53 -0
  8. package/contracts/operations/credits.usage.list/input.schema.json +32 -0
  9. package/contracts/operations/credits.usage.list/output.schema.json +144 -0
  10. package/contracts/operations/dam.folder.list/input.schema.json +1 -1
  11. package/contracts/operations/dam.folder.list/output.schema.json +1 -1
  12. package/contracts/operations/dam.list/input.schema.json +2 -5
  13. package/contracts/operations/dam.list/output.schema.json +1 -1
  14. package/contracts/operations/dam.search/input.schema.json +2 -5
  15. package/contracts/operations/dam.search/output.schema.json +1 -1
  16. package/contracts/operations/model.get/output.schema.json +6 -5
  17. package/contracts/operations/model.list/output.schema.json +5 -4
  18. package/contracts/operations/task.get/output.schema.json +22 -11
  19. package/contracts/operations/tool.call/models/image-edit-smart.schema.json +7 -5
  20. package/contracts/operations/tool.call/models/image-edit-standard.schema.json +6 -4
  21. package/contracts/operations/tool.call/models/image-enhance-smart.schema.json +5 -3
  22. package/contracts/operations/tool.call/models/image-enhance-standard.schema.json +3 -2
  23. package/contracts/operations/tool.call/models/image-expand-smart.schema.json +16 -10
  24. package/contracts/operations/tool.call/models/image-expand-standard.schema.json +13 -8
  25. package/contracts/operations/tool.call/models/image-layers-layout.schema.json +3 -2
  26. package/contracts/operations/tool.call/models/image-layers-smart.schema.json +3 -4
  27. package/contracts/operations/tool.call/models/image-matting-smart.schema.json +6 -4
  28. package/contracts/operations/tool.call/models/image-matting-standard.schema.json +3 -2
  29. package/contracts/operations/tool.call/models/image-ocr.schema.json +3 -2
  30. package/contracts/operations/tool.call/models/image-remove-smart.schema.json +6 -4
  31. package/contracts/operations/tool.call/models/image-remove-standard.schema.json +4 -3
  32. package/contracts/operations/tool.call/models/image-text-edit.schema.json +5 -3
  33. package/contracts/operations/tool.call/models/image-vectorize.schema.json +3 -2
  34. package/contracts/operations/tool.call/models/video-edit-smart.schema.json +6 -6
  35. package/contracts/operations/tool.call/models/video-enhance-smart.schema.json +7 -4
  36. package/contracts/operations/tool.call/models/video-enhance-standard.schema.json +5 -3
  37. package/contracts/operations/tool.call/ocr-payload.schema.json +4 -5
  38. package/contracts/operations/tool.call/output.schema.json +9 -8
  39. package/dist/bin/postinstall.js +22 -6
  40. package/dist/bin/task-worker.js +2 -2
  41. package/dist/src/bootstrap/create-cli.js +31 -15
  42. package/dist/src/bootstrap/create-runtime.js +103 -30
  43. package/dist/src/bootstrap/run-task-worker.js +6 -2
  44. package/dist/src/bootstrap/validators.js +4 -1
  45. package/dist/src/cli/action-binding.js +17 -50
  46. package/dist/src/cli/agent-commands.js +11 -11
  47. package/dist/src/cli/auth-commands.js +2 -1
  48. package/dist/src/cli/creation-help.js +9 -0
  49. package/dist/src/cli/credits-command.js +127 -16
  50. package/dist/src/cli/dam-commands.js +10 -14
  51. package/dist/src/cli/editor-commands.js +7 -5
  52. package/dist/src/cli/errors.js +81 -22
  53. package/dist/src/cli/host-input.js +64 -5
  54. package/dist/src/cli/model-commands.js +9 -3
  55. package/dist/src/cli/observed-errors.js +7 -3
  56. package/dist/src/cli/org-commands.js +3 -1
  57. package/dist/src/cli/presenter.js +4 -0
  58. package/dist/src/cli/task-commands.js +6 -2
  59. package/dist/src/cli/tool-commands.js +12 -11
  60. package/dist/src/cli/update-command.js +24 -1
  61. package/dist/src/features/agent/creative-agent-adapter.js +6 -2
  62. package/dist/src/features/agent/creative-protocol.js +8 -29
  63. package/dist/src/features/agent/resource-authorizer.js +25 -17
  64. package/dist/src/features/agent/result-reader.js +31 -14
  65. package/dist/src/features/agent/use-cases.js +6 -31
  66. package/dist/src/features/credits/amount.js +51 -0
  67. package/dist/src/features/credits/response.js +11 -0
  68. package/dist/src/features/credits/use-cases.js +200 -30
  69. package/dist/src/features/dam/asset-projection.js +3 -6
  70. package/dist/src/features/dam/dam-api-adapter.js +30 -15
  71. package/dist/src/features/dam/repository-catalog.js +30 -21
  72. package/dist/src/features/dam/use-cases.js +12 -7
  73. package/dist/src/features/editor/bridge-client.js +0 -2
  74. package/dist/src/features/editor/public-url.js +1 -36
  75. package/dist/src/features/editor/session.js +3 -2
  76. package/dist/src/features/editor/use-cases.js +27 -2
  77. package/dist/src/features/org/org-service.js +10 -1
  78. package/dist/src/features/org/use-cases.js +18 -4
  79. package/dist/src/features/task/process-owner.js +54 -0
  80. package/dist/src/features/task/store.js +37 -10
  81. package/dist/src/features/task/task-background.js +5 -2
  82. package/dist/src/features/task/use-cases.js +184 -84
  83. package/dist/src/features/tool/argument-paths.js +14 -0
  84. package/dist/src/features/tool/canvas-copy.js +28 -15
  85. package/dist/src/features/tool/canvas-matting.js +123 -0
  86. package/dist/src/features/tool/canvas-media.js +100 -52
  87. package/dist/src/features/tool/canvas-models.js +66 -33
  88. package/dist/src/features/tool/canvas-pricing.js +12 -0
  89. package/dist/src/features/tool/canvas-recovery.js +13 -30
  90. package/dist/src/features/tool/canvas-results.js +79 -87
  91. package/dist/src/features/tool/canvas-tool-adapter.js +134 -157
  92. package/dist/src/features/tool/canvas-video.js +44 -37
  93. package/dist/src/features/tool/dynamic-schema.js +39 -40
  94. package/dist/src/features/tool/ffprobe-executable.js +21 -0
  95. package/dist/src/features/tool/mns-catalog-adapter.js +61 -24
  96. package/dist/src/features/tool/resource-authorizer.js +11 -3
  97. package/dist/src/features/tool/tool-api-adapter.js +73 -82
  98. package/dist/src/features/tool/tool-errors.js +25 -0
  99. package/dist/src/features/tool/tool-output.js +15 -0
  100. package/dist/src/features/tool/use-cases.js +74 -98
  101. package/dist/src/features/update/check-schema.js +17 -0
  102. package/dist/src/features/update/host-receipt.js +30 -0
  103. package/dist/src/features/update/notice-output.js +30 -0
  104. package/dist/src/features/update/update-lock.js +80 -0
  105. package/dist/src/features/update/update-notification.js +129 -240
  106. package/dist/src/features/update/update-service.js +95 -21
  107. package/dist/src/platform/media-type.js +46 -0
  108. package/dist/src/platform/public-url.js +35 -0
  109. package/dist/src/platform/remote-error-evidence.js +33 -6
  110. package/dist/src/platform/resource-auth-key.js +35 -1
  111. package/dist/src/platform/safe-upload-file.js +36 -41
  112. package/dist/src/platform/signature.js +3 -1
  113. package/dist/src/platform/signed-http-transport.js +14 -6
  114. package/dist/src/platform/url-safety.js +6 -1
  115. package/dist/src/platform/webm-header.js +41 -0
  116. package/dist/src/telemetry/command-route.js +38 -0
  117. package/dist/src/telemetry/command-routes.json +1 -0
  118. package/dist/src/telemetry/failure-summary.js +1 -1
  119. package/dist/src/telemetry/invocation.js +1 -2
  120. package/dist/src/telemetry/process-errors.js +17 -33
  121. package/dist/src/telemetry/sanitize.js +19 -4
  122. package/dist/src/telemetry/sls-sink.js +8 -0
  123. package/package.json +4 -4
  124. package/skills/gd-cli/SKILL.md +19 -5
  125. package/skills/gd-cli/references/agent.md +9 -4
  126. package/skills/gd-cli/references/creation.md +3 -1
  127. package/skills/gd-cli/references/editor.md +7 -5
  128. package/skills/gd-cli/references/errors.md +19 -8
  129. package/skills/gd-cli/references/matting.md +3 -5
  130. package/skills/gd-cli/references/media-tools.md +10 -4
  131. package/skills/gd-cli/references/tool.md +9 -15
  132. package/skills/gd-cli/references/update.md +6 -0
@@ -1,12 +1,16 @@
1
+ import { canvasModelBindings } from "../features/tool/canvas-models.js";
1
2
  import { createWindAnalytics } from "../analytics/wind.js";
2
3
  import { taskScope } from "../features/task/store.js";
4
+ import { noticeWriter, sameTerminal } from "../features/update/notice-output.js";
3
5
  import { createTextOutput } from "../platform/text-output.js";
4
6
  import { TaskNotFoundError } from "../features/task/use-cases.js";
5
7
  import { homedir } from "node:os";
6
8
  import { createTaskBackgroundLauncher, TaskBackgroundError } from "../features/task/task-background.js";
7
9
  import { createTaskStore } from "../features/task/store.js";
8
- import { createTaskUseCases } from "../features/task/use-cases.js";
10
+ import { createTaskUseCases, taskStartedNotice } from "../features/task/use-cases.js";
9
11
  import { readAgentResult } from "../features/agent/result-reader.js";
12
+ import { createToolOutputVerifier, presentToolContent } from "../features/tool/tool-output.js";
13
+ import { RemoteProtocolError } from "../platform/remote-protocol.js";
10
14
  import { queryToolResult, ToolTaskFailedError, ToolTaskCanceledError } from "../features/tool/tool-api-adapter.js";
11
15
  import { randomBytes, randomUUID } from "node:crypto";
12
16
  import { dirname, join } from "node:path";
@@ -188,7 +192,7 @@ export function createProductionRuntime(options = {}) {
188
192
  });
189
193
  const org = createOrgUseCases({
190
194
  store,
191
- org: createOrgService({ transport: orgTransport }),
195
+ org: createOrgService({ transport: orgTransport, onPartial: count => partialWarning("ORG_LIST_PARTIAL", `有 ${count} 条组织记录无法读取,已返回可确认的组织。`, `${count} organization record(s) could not be read.`) }),
192
196
  sso,
193
197
  telemetry,
194
198
  ...(product.exposesOrganizations
@@ -213,7 +217,9 @@ export function createProductionRuntime(options = {}) {
213
217
  });
214
218
  const credits = createCreditsUseCases({
215
219
  transport: creditsTransport,
216
- billingUnit: product.billingUnit
220
+ onPartial: () => partialWarning("CREDITS_RECORDS_PARTIAL", "部分账单记录或可选字段无法表示,已返回可确认的流水;不要据此推算完整账单。", "Some billing records or optional fields could not be represented. Known records are included; do not infer a complete bill."),
221
+ billingUnit: product.billingUnit,
222
+ now
217
223
  });
218
224
  const storageUpload = createDamStorageUploader({
219
225
  transport: damTransport,
@@ -225,6 +231,10 @@ export function createProductionRuntime(options = {}) {
225
231
  writeError: io.writeError,
226
232
  product
227
233
  });
234
+ function partialWarning(code, zh, en) {
235
+ telemetry.annotate({ warning_codes: [code] });
236
+ presenter.warning(text(zh, en));
237
+ }
228
238
  const browser = createBrowserOpener();
229
239
  const validators = createContractValidators({
230
240
  organizations: product.exposesOrganizations
@@ -236,8 +246,15 @@ export function createProductionRuntime(options = {}) {
236
246
  ? { invalidModelWarning: (count) => `Ignored ${count} invalid model configuration${count === 1 ? "" : "s"}.` }
237
247
  : {})
238
248
  }) });
239
- const damApi = createDamApiAdapter({ transport: damTransport });
240
- const damRepositories = createDamRepositoryCatalog({ transport: damTransport });
249
+ const damApi = createDamApiAdapter({
250
+ transport: damTransport,
251
+ onPartial: count => partialWarning("DAM_LIST_PARTIAL", `有 ${count} 条素材库记录无法表示,已返回其余记录。`, `${count} unreadable record(s); the other records are included.`),
252
+ onPaginationFallback: () => partialWarning("DAM_PAGINATION_INCOMPLETE", "服务未提供完整分页信息;缺失的总数或结束标记按本页结果推导。", "The service omitted pagination information; a missing total or end marker was inferred from this page.")
253
+ });
254
+ const damRepositories = createDamRepositoryCatalog({ transport: damTransport, onPartial: source => {
255
+ const label = source === "team" ? "团队" : source === "personal" ? "个人" : "企业";
256
+ partialWarning("DAM_REPOSITORIES_PARTIAL", `${label}库来源或其中部分记录无法读取,已列出可确认的资源库。`, `The ${source} repository source was unavailable or incomplete. Known repositories are included.`);
257
+ } });
241
258
  const damOperations = createDamOperationExecutor({
242
259
  now: () => now().getTime(),
243
260
  sleep: async (milliseconds, signal) => {
@@ -290,7 +307,14 @@ export function createProductionRuntime(options = {}) {
290
307
  traceparent: () => telemetry.traceparent(),
291
308
  ...(businessHeaders ? { businessHeaders } : {})
292
309
  }) });
293
- const resourceAuthorizer = createAgentResourceAuthorizer({ authKeys: resourceAuthKeys });
310
+ const onPartialResourceFailure = (error) => {
311
+ if (!(error instanceof RemoteRequestError || error instanceof RemoteProtocolError)
312
+ || !["RESOURCE_AUTH_REQUEST_FAILED", "RESOURCE_AUTH_INVALID_RESPONSE"].includes(error.diagnosticReason ?? ""))
313
+ return false;
314
+ partialWarning("RESOURCE_AUTH_PARTIAL", "部分私有资源链接尚未取得访问授权;已保留原链接及其他可用内容,请使用原任务再次取件,不要重做。", "Some private links could not be authorized. The original links and other content are included. Query the same task; do not resubmit.");
315
+ return true;
316
+ };
317
+ const resourceAuthorizer = createAgentResourceAuthorizer({ authKeys: resourceAuthKeys, onPartialResourceFailure });
294
318
  const accessPolicies = createAccessPolicies({ store, now, refreshCurrentOrganization: org.refreshCurrentOrganization });
295
319
  const authorizeTaskAccess = async (state, signal) => {
296
320
  await telemetry.stage("access", async () => {
@@ -302,24 +326,59 @@ export function createProductionRuntime(options = {}) {
302
326
  }
303
327
  });
304
328
  };
305
- const authorizeTaskResult = async (result, state, signal, alreadyAuthorized = false) => {
329
+ const authorizeTaskResult = async (result, state, signal, source = "stored") => {
306
330
  if ("message" in result)
307
331
  validators.agentSendOutput(result);
308
332
  else
309
333
  validators.toolCallOutput(result);
310
334
  // Bind only if this result actually needs a fresh resource token.
311
- const taskAuthorizer = createAgentResourceAuthorizer({ authKeys: {
335
+ const taskAuthorizer = createAgentResourceAuthorizer({
336
+ onPartialResourceFailure,
337
+ // Re-reading an existing result can repair an expired official link without probing anyone's URLs.
338
+ ...(source !== "upstream" ? { onSignedRefreshFailure(error) {
339
+ if (!(error instanceof RemoteRequestError || error instanceof RemoteProtocolError)
340
+ || !["RESOURCE_AUTH_REQUEST_FAILED", "RESOURCE_AUTH_INVALID_RESPONSE"].includes(error.diagnosticReason ?? ""))
341
+ return false;
342
+ telemetry.annotate({ warning_codes: ["TASK_RESOURCE_REFRESH_UNAVAILABLE"] });
343
+ presenter.warning(text("资源授权暂未更新,已返回原签名链接;如仍无法打开,请稍后用原任务 ID 查询。", "The resource key could not be refreshed. The original signed URL is included; if it cannot be opened, query the same task ID later."));
344
+ return true;
345
+ } } : {}),
346
+ authKeys: {
312
347
  async getAuthKey(access, tokenSignal) {
313
- if (!alreadyAuthorized)
348
+ if (source === "stored")
314
349
  await authorizeTaskAccess(state, tokenSignal);
315
350
  return resourceAuthKeys.getAuthKey(access, tokenSignal);
316
351
  }
317
- } });
352
+ }
353
+ });
318
354
  const access = { credential: state.credential, organizationId: state.organization.id };
319
355
  if ("message" in result)
320
356
  return taskAuthorizer.authorize(result, access, signal);
321
357
  return authorizeToolResources(result, taskAuthorizer, access, signal);
322
358
  };
359
+ const canvasMedia = (access) => createCanvasMedia({ fetch, uploader: transientUploader,
360
+ ...(access ? { filems: { access, authKeys: resourceAuthKeys } } : {}) });
361
+ const onMissingMedia = (kind) => {
362
+ telemetry.annotate({ warning_codes: ["TOOL_EXPECTED_MEDIA_UNIDENTIFIED"] });
363
+ presenter.warning(text(`已交付服务返回的内容,未发现明确标记为${kind === "video" ? "视频" : "图片"}的资源;请按实际内容交付,勿重新提交。`, `The returned content is included. No resource was identified as ${kind}; report what was received and do not resubmit.`));
364
+ };
365
+ const onUnrepresented = () => {
366
+ telemetry.annotate({ warning_codes: ["TOOL_PART_UNREPRESENTABLE"] });
367
+ presenter.warning(text("已返回可表示的内容,另有无法读取的附件。", "The representable content is included; another attachment could not be read."));
368
+ };
369
+ const verifyToolOutput = createToolOutputVerifier(resourceAuthorizer, onMissingMedia);
370
+ const canvasTools = createCanvasToolAdapter({
371
+ transport: toolTransport, recordTransport: damTransport, resourceAuthorizer, telemetry, media: canvasMedia, onMissingMedia, onUnrepresented, english: product.id === "insmind",
372
+ fallback: createToolApiAdapter({ transport: toolTransport, telemetry, onUnrepresented, verifyOutput: verifyToolOutput }),
373
+ standardMatting: createStandardMatting({ transport: toolTransport, recordTransport: damTransport, media: canvasMedia() })
374
+ });
375
+ const taskFailureNote = (error, operation = telemetry.creationContext().operation) => {
376
+ const outcome = mapCliError(error, { aborted: false, product, operation, failureStage: telemetry.failureStage(error) });
377
+ if (outcome.kind !== "failure")
378
+ return "";
379
+ const details = outcome.failure.details;
380
+ return [outcome.failure.message, details?.remote_code, details?.remote_message].filter(Boolean).join(" ");
381
+ };
323
382
  const tasks = createTaskUseCases({
324
383
  telemetry,
325
384
  ...(analytics ? { analytics } : {}),
@@ -333,6 +392,7 @@ export function createProductionRuntime(options = {}) {
333
392
  store: createTaskStore({
334
393
  ...(options.homeDirectory ? { homeDirectory: options.homeDirectory } : {}),
335
394
  stateDirectory: product.stateDirectory,
395
+ onUnreadableRecords: count => partialWarning("TASK_LIST_PARTIAL", `有 ${count} 条本地任务记录无法读取,已列出可读取的记录。`, `${count} local task record(s) could not be read. Readable records are included.`),
336
396
  validateSummary: task => validators.taskListResult({ tasks: [task] }),
337
397
  validate: validators.taskResult
338
398
  }),
@@ -342,12 +402,19 @@ export function createProductionRuntime(options = {}) {
342
402
  warning: message => presenter.warning(message),
343
403
  commandName: product.commandName,
344
404
  text,
345
- failureNote: error => {
346
- const outcome = mapCliError(error, { aborted: false, product, operation: telemetry.creationContext().operation, failureStage: telemetry.failureStage(error) });
347
- return outcome.kind === "failure" ? outcome.failure.message : "";
348
- },
405
+ failureNote: taskFailureNote,
349
406
  recovery: {
350
- authorize: authorizeTaskResult,
407
+ async authorize(result, state, signal, progress) {
408
+ const authorized = await authorizeTaskResult(result, state, signal);
409
+ const tool = progress?.generation?.tool ?? canvasModelBindings.find(binding => binding[1] === progress?.toolPipeline?.model)?.[0];
410
+ if ("content" in authorized && tool && tool !== "image.ocr" && tool !== "image.layers") {
411
+ if (tool.startsWith("video."))
412
+ presentToolContent(authorized.content, "video", onMissingMedia);
413
+ else if (tool.startsWith("image."))
414
+ presentToolContent(authorized.content, "image", onMissingMedia);
415
+ }
416
+ return authorized;
417
+ },
351
418
  async agent(progress, state, signal) {
352
419
  if (!progress.contextId || !progress.localMessageId)
353
420
  return {
@@ -359,14 +426,18 @@ export function createProductionRuntime(options = {}) {
359
426
  credential: state.credential, organizationId: state.organization.id, signal
360
427
  });
361
428
  return { state: "unknown",
429
+ ...(snapshot.usageAmountMissing ? { usageAmountMissing: true } : {}),
362
430
  ...(snapshot.usageModelMissing ? { usageModelMissing: true } : {}),
363
431
  note: snapshot.partialResult
364
432
  ? text("已找到部分内容,尚未取得完整结果。", "Some content was found, but the complete result has not been received.")
365
433
  : text("尚未取得任务结果。", "The task result has not been received."),
366
- ...(snapshot.partialResult ? { partialResult: await authorizeTaskResult(agentOutputWithBillingUnit(snapshot.partialResult, product.billingUnit), state, signal, true) } : {})
434
+ ...(snapshot.partialResult ? { partialResult: await authorizeTaskResult(agentOutputWithBillingUnit(snapshot.partialResult, product.billingUnit), state, signal, "upstream") } : {})
367
435
  };
368
436
  },
369
437
  async tool(progress, state, signal) {
438
+ // Never interpret an unpublished candidate's Run receipt as a Dify task.
439
+ if (Object.hasOwn(progress, "toolRun"))
440
+ return { state: "unknown", note: text("该实验版本任务不支持继续远端查询。请保留原任务记录用于排查,不要重复提交。", "Remote recovery is unavailable for this experimental task. Keep its original record for diagnosis; do not resubmit.") };
370
441
  if (progress.toolPipeline) {
371
442
  const pipeline = progress.toolPipeline;
372
443
  await authorizeTaskAccess(state, signal);
@@ -374,7 +445,7 @@ export function createProductionRuntime(options = {}) {
374
445
  try {
375
446
  recovered = await telemetry.stage("task.query", () => recoverCanvasTool(progress, {
376
447
  access: { credential: state.credential, organizationId: state.organization.id }, signal
377
- }, { transport: toolTransport, media: canvasMedia, english: product.id === "insmind" }));
448
+ }, { transport: toolTransport, onMissingMedia, onUnrepresented, media: canvasMedia({ credential: state.credential, organizationId: state.organization.id }), english: product.id === "insmind" }));
378
449
  }
379
450
  catch (error) {
380
451
  if (!(error instanceof ToolTaskFailedError) && !(error instanceof ToolTaskCanceledError))
@@ -382,17 +453,18 @@ export function createProductionRuntime(options = {}) {
382
453
  const outcome = mapCliError(error, { aborted: false, product, operation: "task.get", failureStage: "task.query" });
383
454
  return { state: "failed", note: outcome.failure?.message ?? text("本次处理未能完成。", "This processing could not be completed."), failure: error };
384
455
  }
456
+ const source = "fromCheckpoint" in recovered && recovered.fromCheckpoint ? "checkpoint" : "upstream";
385
457
  if (recovered.state === "complete" && progress.toolUsage)
386
458
  return { state: "completed", result: await authorizeTaskResult(toolOutputWithBillingUnit({
387
459
  content: recovered.content, usage: progress.toolUsage
388
- }, product.billingUnit), state, signal, true) };
460
+ }, product.billingUnit), state, signal, source) };
389
461
  if (recovered.state === "pending")
390
462
  return { state: "running", note: text("任务仍在处理中。", "The task is still processing.") };
391
463
  const partialContent = recovered.state === "unknown" ? recovered.content : undefined;
392
464
  return { state: "unknown", note: text(`处理停留在 ${pipeline.stage} 阶段,尚未交付完整结果。查询不会重新处理、上传或结算;请保留任务 ID 排查,勿重复提交。`, `Processing reached ${pipeline.stage}; no complete result was delivered. Querying does not process, upload, or settle again. Keep the task ID for diagnosis; do not resubmit.`),
393
465
  ...(partialContent && progress.toolUsage ? { partialResult: await authorizeTaskResult(toolOutputWithBillingUnit({
394
466
  content: partialContent, usage: progress.toolUsage
395
- }, product.billingUnit), state, signal, true) } : {}) };
467
+ }, product.billingUnit), state, signal, source) } : {}) };
396
468
  }
397
469
  if (!progress.remoteTaskId || !progress.toolUsage)
398
470
  return {
@@ -404,7 +476,7 @@ export function createProductionRuntime(options = {}) {
404
476
  try {
405
477
  response = await telemetry.stage("task.query", async () => {
406
478
  const result = await queryToolResult(toolTransport, {
407
- taskId, credential: state.credential, organizationId: state.organization.id, signal,
479
+ taskId, credential: state.credential, organizationId: state.organization.id, signal, onUnrepresented,
408
480
  onDifyTaskId: id => telemetry.annotate({ dify_task_id: id })
409
481
  });
410
482
  if (result.difyTaskId)
@@ -423,8 +495,8 @@ export function createProductionRuntime(options = {}) {
423
495
  if (response.state === "pending")
424
496
  return { state: "running", note: text("任务仍在处理中。", "The task is still processing.") };
425
497
  return { state: "completed", result: await authorizeTaskResult(toolOutputWithBillingUnit({
426
- content: response.content, usage: progress.toolUsage
427
- }, product.billingUnit), state, signal, true) };
498
+ content: await verifyToolOutput(response.content, progress.generation?.tool === "video.generate" ? "video" : "image", { access: { credential: state.credential, organizationId: state.organization.id }, signal }), usage: progress.toolUsage
499
+ }, product.billingUnit), state, signal, "upstream") };
428
500
  }
429
501
  }
430
502
  });
@@ -438,19 +510,17 @@ export function createProductionRuntime(options = {}) {
438
510
  }),
439
511
  telemetry
440
512
  }), product.billingUnit);
441
- const canvasMedia = createCanvasMedia({ fetch, uploader: transientUploader });
442
513
  const tool = withToolBillingUnit(createToolUseCases({
443
514
  catalog: modelCatalog,
444
515
  tools: product.tools,
445
516
  ...(product.id === "insmind" ? { modelDescription: "Model machine identifier from model list." } : {}),
446
- execution: createCanvasToolAdapter({ transport: toolTransport, recordTransport: damTransport, telemetry, media: canvasMedia, english: product.id === "insmind",
447
- fallback: createToolApiAdapter({ transport: toolTransport, telemetry }),
448
- standardMatting: createStandardMatting({ transport: toolTransport, recordTransport: damTransport, media: canvasMedia }) }),
517
+ execution: canvasTools,
449
518
  uploader: transientUploader,
450
519
  warn: (message) => { presenter.warning(message); },
451
520
  telemetry
452
521
  }), product.billingUnit);
453
522
  const editor = createEditorUseCases({
523
+ onPartial: count => partialWarning("EDITOR_SNAPSHOT_PARTIAL", `有 ${count} 个元素无法表示,已返回其余元素。`, `${count} unsupported element(s); the other elements are included.`),
454
524
  session: createEditorSession({
455
525
  store: createEditorSessionStateStore({
456
526
  ...(options.homeDirectory === undefined
@@ -504,7 +574,8 @@ export function createProductionRuntime(options = {}) {
504
574
  installationOwner,
505
575
  ...(options.homeDirectory ? { homeDirectory: options.homeDirectory } : {}),
506
576
  ...(options.env ? { env: options.env } : {}),
507
- notify: (message) => { presenter.notice(message); },
577
+ diagnosticOnly: !io.stderrTerminal && env.CLI_UPDATE_NOTICE_FORMAT !== "offer",
578
+ notify: noticeWriter(stdout, stderr, sameTerminal(rawIo.stdout, rawIo.stderr), env.CLI_UPDATE_NOTICE_FORMAT === "offer", text("提示: ", "Notice: ")),
508
579
  ...(product.id === "insmind" ? {
509
580
  stateDirectoryName: product.stateDirectory,
510
581
  registryUrl: `https://registry.npmjs.org/${encodeURIComponent(product.npmPackage)}`,
@@ -530,11 +601,13 @@ export function createProductionRuntime(options = {}) {
530
601
  telemetryEnvironment, telemetryVersion: options.telemetryVersion ?? primarySkill.version, origin: telemetry.creationContext(),
531
602
  telemetryTrackingUrl: String(options.telemetryTrackingUrl ?? product.telemetryUrl),
532
603
  locale: locale.locale, endpoints: Object.fromEntries(Object.entries(endpoints).map(([key, value]) => [key, String(value)]))
533
- }, signal, task => {
604
+ }, signal, (task, creationTraceId) => {
534
605
  startedId = task.taskId;
606
+ if (creationTraceId)
607
+ telemetry.annotate({ creation_trace_id: creationTraceId });
535
608
  telemetry.annotate({ cli_task_id: task.taskId, execution_mode: "async", result_state: task.state });
536
- presenter.notice(text(`任务 ID: ${task.taskId};结果未收到时执行 ${product.commandName} task get ${task.taskId}`, `Task ID: ${task.taskId}; retrieve missing output with ${product.commandName} task get ${task.taskId}`));
537
- });
609
+ presenter.notice(taskStartedNotice(task.taskId, product.commandName, "async", text));
610
+ }, facts => telemetry.annotate(facts));
538
611
  }
539
612
  catch (error) {
540
613
  if (startedId)
@@ -8,7 +8,9 @@ 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 ? { creation_trace_id: job.origin.trace_id, host_application: job.origin.host_application ?? "unknown" } : {}), account_id: job.state.account?.id, organization_id: job.state.organization.id,
11
+ runtime.telemetry.annotate({ ...(job.origin ? { host_application: job.origin.host_application ?? "unknown" } : {}),
12
+ ...(job.origin ? { creation_trace_id: job.origin.trace_id } : {}),
13
+ account_id: job.state.account?.id, organization_id: job.state.organization.id,
12
14
  parameters: { ...job.input }, execution_mode: "async" });
13
15
  let completion = { outcome: "success" };
14
16
  let started = false;
@@ -21,6 +23,7 @@ export async function runTaskWorker(options) {
21
23
  runtime.validators.toolCallInput(job.input);
22
24
  await runtime.tasks.track({
23
25
  state: job.state,
26
+ signal,
24
27
  operation: job.operation,
25
28
  label: job.label,
26
29
  executionMode: "async",
@@ -32,7 +35,8 @@ export async function runTaskWorker(options) {
32
35
  }
33
36
  if ((progress.accepted || progress.remoteTaskId) && !accepted) {
34
37
  accepted = true;
35
- send({ type: "accepted", task });
38
+ send({ type: "accepted", task,
39
+ ...(job.operation === "tool.call" ? { execution_protocol: progress.toolPipeline?.protocol ?? "dify" } : {}) });
36
40
  }
37
41
  },
38
42
  run: async (observe) => {
@@ -3,7 +3,7 @@ import { canonicalizeInputFileUris } from "../platform/input-uri.js";
3
3
  import { Ajv2020 } from "ajv/dist/2020.js";
4
4
  import addFormatsImport, {} from "ajv-formats";
5
5
  import { agentInputSchema } from "../contracts/creation-input.js";
6
- import { contractSchema } from "../contracts/schema.js";
6
+ import { contractDocument, contractSchema } from "../contracts/schema.js";
7
7
  const agentSendOutputSchema = contractSchema("agent.send", "output");
8
8
  const authStatusSchema = contractSchema("auth.status", "output");
9
9
  const damDeleteInputSchema = contractSchema("dam.delete", "input");
@@ -123,6 +123,9 @@ export function createContractValidators(options = {}) {
123
123
  const taskResult = ajv.compile(runOutputSchema);
124
124
  const taskListResult = ajv.compile(contractSchema("task.list", "output"));
125
125
  return {
126
+ creditsOutput: assertion(ajv.compile(contractSchema("credits.get", "output")), OutputContractError),
127
+ creditsUsageListOutput: assertion(ajv.compile(contractSchema("credits.usage.list", "output")), OutputContractError),
128
+ creditsUsageGetOutput: assertion(ajv.compile(contractSchema("credits.usage.get", "output")), OutputContractError),
126
129
  taskResult: assertion(taskResult, OutputContractError),
127
130
  taskListResult: assertion(taskListResult, OutputContractError),
128
131
  agentSendInput: assertion(agentSendInput, InputContractError),
@@ -1,8 +1,10 @@
1
+ import { identifyInvocation } from "../telemetry/command-route.js";
1
2
  import { jsonErrorsRequested } from "../platform/error-output-mode.js";
2
3
  const environments = new WeakMap();
3
4
  const boundPolicies = new WeakMap();
4
5
  const jsonCommands = new WeakSet();
5
6
  const selectedCommands = new WeakMap();
7
+ const commandDefinitions = new WeakMap();
6
8
  /** Declare the existing fixed JSON contract alongside the command registration. */
7
9
  export function jsonOutput(command) {
8
10
  jsonCommands.add(command);
@@ -15,7 +17,7 @@ export function errorUsesJson(program, argv) {
15
17
  return true;
16
18
  const command = selectedCommands.get(program);
17
19
  if (command)
18
- return jsonCommands.has(command) || command.opts().json === true;
20
+ return jsonCommands.has(command) || command.optsWithGlobals().json === true;
19
21
  return jsonErrorsRequested(argv);
20
22
  }
21
23
  export function configureActionEnvironment(program, environment) {
@@ -30,7 +32,6 @@ export function bindAction(command, policy, handler, telemetry) {
30
32
  const environment = environments.get(rootCommand(command));
31
33
  if (!environment)
32
34
  throw new Error("CLI action environment is missing.");
33
- await checkUpdateNotification(environment, telemetry);
34
35
  const context = await environment.telemetry.stage("access", async () => {
35
36
  const authorized = await environment.policies[policy].authorize(environment.signal);
36
37
  if (authorized.policy !== policy) {
@@ -51,7 +52,6 @@ export function bindPreparedAction(command, policy, prepare, run, telemetry) {
51
52
  const environment = environments.get(rootCommand(command));
52
53
  if (!environment)
53
54
  throw new Error("CLI action environment is missing.");
54
- await checkUpdateNotification(environment, telemetry);
55
55
  const prepared = await environment.telemetry.stage("input", () => prepare(environment.signal));
56
56
  if (prepared.handled)
57
57
  return;
@@ -66,16 +66,6 @@ export function bindPreparedAction(command, policy, prepare, run, telemetry) {
66
66
  await run(context, prepared.input, environment.signal);
67
67
  });
68
68
  }
69
- async function checkUpdateNotification(environment, telemetry) {
70
- if (telemetry?.operation === "update")
71
- return;
72
- try {
73
- await environment.updateNotification.check(environment.signal);
74
- }
75
- catch {
76
- // Version availability must never change the requested command outcome.
77
- }
78
- }
79
69
  export function assertAllLeafCommandsBound(program) {
80
70
  for (const command of leafCommands(program)) {
81
71
  if (!boundPolicies.has(command)) {
@@ -96,6 +86,7 @@ function rootCommand(command) {
96
86
  }
97
87
  function bindTelemetrySelection(command, definition) {
98
88
  definition ??= { operation: commandPath(command).split(" ").slice(1).join(".") };
89
+ commandDefinitions.set(command, definition);
99
90
  if (!command.parent)
100
91
  throw new Error(`Telemetry command has no parent: ${command.name()}`);
101
92
  command.parent.hook("preSubcommand", (parent, selected) => {
@@ -116,44 +107,20 @@ function annotateAccessContext(telemetry, context) {
116
107
  organization_id: context.state.organization?.id
117
108
  });
118
109
  }
119
- /** Identify the invocation before Commander can read stdin, reject arguments or exit for help. */
120
- export function invocationDefinition(program, argv) {
121
- let command = program;
122
- let unknown = false;
123
- let mode = "execute";
124
- for (let i = 0; i < argv.length; i++) {
125
- const token = argv[i];
126
- if (token === "--")
127
- break;
128
- if (token === "-h" || token === "--help") {
129
- mode = "help";
130
- continue;
131
- }
132
- if (token === "-V" || token === "--version") {
133
- mode = "version";
134
- continue;
135
- }
136
- if (token.startsWith("-")) {
137
- const flag = token.split("=")[0];
138
- const option = [...command.options, ...program.options].find(item => item.long === flag || item.short === flag);
139
- if (option?.long === "--schema" && mode === "execute")
140
- mode = "schema";
141
- if (option?.required && !token.includes("="))
142
- i++;
143
- continue;
144
- }
145
- if (command.commands.length) {
146
- const child = command.commands.find(item => item.name() === token || item.aliases().includes(token));
147
- if (!child) {
148
- unknown = true;
149
- break;
150
- }
151
- command = child;
152
- }
153
- }
110
+ export function commandRoute(command) {
111
+ const definition = commandDefinitions.get(command);
154
112
  const path = commandPath(command).split(" ").slice(1).join(".");
155
- const operation = mode === "version" ? "version" : unknown ? "unknown" : path || (mode === "help" ? "help" : "unknown");
156
- return { operation, mode: () => mode };
113
+ const children = Object.create(null);
114
+ for (const child of command.commands) {
115
+ const route = commandRoute(child);
116
+ for (const name of [child.name(), ...child.aliases()])
117
+ children[name] = route;
118
+ }
119
+ return { operation: definition?.operation ?? (path || "unknown"), action: !!definition,
120
+ options: command.options.map(option => option.flags), children };
121
+ }
122
+ export function invocationDefinition(program, argv) {
123
+ return identifyInvocation(commandRoute(program), argv);
157
124
  }
158
125
  function commandPath(command) {
159
126
  const names = [];
@@ -1,3 +1,4 @@
1
+ import { creationTaskHelp } from "./creation-help.js";
1
2
  import { hostSchema, readHostInput } from "./host-input.js";
2
3
  import { agentInputSchema } from "../contracts/creation-input.js";
3
4
  import { jsonOutput, bindPreparedAction } from "./action-binding.js";
@@ -5,29 +6,28 @@ import { CliUsageError } from "./errors.js";
5
6
  import { productText as text } from "../product/text.js";
6
7
  export function registerAgentCommands(program, runtime) {
7
8
  const agent = program.command("agent")
8
- .description(text(runtime.product, "稿定 Agent", "insMind Agent"))
9
+ .description(text(runtime.product, "业务策划与持续多轮创作", "Business planning and multi-turn creation"))
9
10
  .helpCommand(false);
10
11
  const send = agent.command("send")
11
- .description(text(runtime.product, "发送结构化创作消息并等待最终结果", "Send a structured creation message and wait for its result"))
12
+ .description(text(runtime.product, "发送创作消息,等待本轮回复、成品或补充问题", "Send a creation message and wait for this turn's reply, assets or questions"))
12
13
  .option("--schema", text(runtime.product, "输出输入 Schema", "output the input Schema"))
13
14
  .option("--input <file|->", text(runtime.product, "从文件或标准输入读取 JSON", "read JSON from a file or stdin"))
14
15
  .option("--async", text(runtime.product, "提交后返回 taskId,通过 task get 查询结果", "return taskId after submission; retrieve results with task get"))
15
16
  .allowExcessArguments(false);
16
17
  send.addHelpText("after", [
17
18
  "",
19
+ 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."),
18
20
  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."),
19
21
  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."),
20
- text(runtime.product, "--async 在服务端受理后输出包含 taskId 和 state 的 JSON;退出码 0 仅表示受理。", "--async returns JSON with taskId and state after acceptance; exit code 0 means accepted only."),
21
- text(runtime.product, "用 task get <taskId> 查询原任务;completed 时 result 为完整结果,running/unknown 或查询超时不应重新提交。", "Query the same taskId with task get; completed includes result. Do not resubmit on running, unknown, or a query timeout."),
22
- text(runtime.product, "Agent 异步由本机后台进程继续执行;进程终止或关机可能使状态变为 unknown。", "Agent async continues in a local background process; termination or shutdown may leave its state unknown."),
23
- text(runtime.product, "中断前台等待不会取消已交接的后台任务;仍用原 taskId 查询。", "Interrupting the foreground wait does not cancel a handed-off task; query the same taskId."),
24
- text(runtime.product, "默认在当前进程等待最终结果,成功后一次输出 JSON。", "By default, the command waits in the current process and returns the final result as one JSON object."),
25
- text(runtime.product, "运行中请继续等待原进程;已提交但结果未知时,不要重复提交。", "Wait for the original process. Do not resubmit a creation whose outcome is unknown."),
26
- text(runtime.product, "默认模式在 stderr 提示任务 ID,stdout 保持原结果 JSON。", "In default mode the Task ID is written to stderr; stdout contains only the original result JSON."),
27
- text(runtime.product, `结果未收到时执行 ${runtime.product.commandName} task list 找到原调用,再执行 ${runtime.product.commandName} task get <id> 查询。`, `If output is missing, find the original run with ${runtime.product.commandName} task list, then query ${runtime.product.commandName} task get <id>.`),
22
+ ...creationTaskHelp(runtime.product),
23
+ text(runtime.product, "本机后台进程终止或关机可能使 Agent 任务变为 unknown。", "If the local background process stops or the machine shuts down, an Agent task may become unknown."),
28
24
  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."),
25
+ 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."),
26
+ 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."),
27
+ 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
28
  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
- text(runtime.product, "usage 仅覆盖本次调用,不包含其他命令调用的消耗。", "usage covers this invocation only, excluding other command invocations."),
29
+ 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."),
30
+ text(runtime.product, "素材用独立 URL Part;本地文件用 Path(path).resolve().as_uri() 或 pathToFileURL(path).href 生成标准 URI,保留顺序和 metadata.role。--input 的 JSON 文件参数仍使用路径。", "Supply assets as separate URL Parts, preserving order and metadata.role. Generate local URIs with Path(path).resolve().as_uri() or pathToFileURL(path).href. The --input JSON file argument remains a path."),
31
31
  ""
32
32
  ].join("\n"));
33
33
  jsonOutput(send);
@@ -6,6 +6,7 @@ export function registerAuthCommands(program, runtime) {
6
6
  const auth = program.command("auth")
7
7
  .description(text(runtime.product, "登录与本机凭证", "Authentication and local credentials"))
8
8
  .helpCommand(false);
9
+ auth.addHelpText("after", text(runtime.product, "\n管理本机 CLI 登录;不替代 Editor 浏览器登录。status 只读状态,login 等待浏览器授权完成,logout 清除本机共享登录。授权链接不等于登录成功;无需提供或读取 AK/SK、Cookie 等凭证。\n", "\nManages the local CLI identity, separately from Editor browser login. status reads state, login waits for browser authorization, and logout clears the shared local sign-in. An authorization URL is not successful login; do not provide or read credential values.\n"));
9
10
  const login = leaf(auth.command("login"))
10
11
  .description(text(runtime.product, "登录稿定", "Sign in to insMind"))
11
12
  .option("--no-browser", text(runtime.product, "不自动打开浏览器", "do not open a browser automatically"))
@@ -51,7 +52,7 @@ export function registerAuthCommands(program, runtime) {
51
52
  });
52
53
  });
53
54
  }, { operation: "auth.status" });
54
- const logout = leaf(auth.command("logout")).description(text(runtime.product, "退出登录", "Sign out"));
55
+ const logout = leaf(auth.command("logout")).description(text(runtime.product, "退出登录", "Sign out")).addHelpText("after", text(runtime.product, "\n清除本机 CLI 凭证及当前组织选择,会影响复用这份登录的其他入口;不删除云端素材或作品。\n", "\nClears local CLI credentials and the current identity context, affecting other entry points sharing this sign-in. It does not delete cloud assets or works.\n"));
55
56
  bindAction(logout, "none", async () => {
56
57
  await runtime.auth.logout();
57
58
  await runtime.telemetry.stage("output", async () => {
@@ -0,0 +1,9 @@
1
+ import { productText } from "../product/text.js";
2
+ export function creationTaskHelp(product) {
3
+ return [
4
+ productText(product, "现在要结果时默认同步。保留宿主返回的退出状态和进程句柄,进程仍在运行就继续等待原进程,直到 stdout 给出完整结果或命令报错。", "For a result now, use the default synchronous command. Keep the host's exit status and process handle. While it is running, wait on that process for the complete stdout result or an error."),
5
+ productText(product, "失去进程句柄时,用 stderr 提示的 taskId 执行 task get <taskId>。没有 ID 时用 task list 定位原调用。现在要交付且 state=running 时隔数秒继续查原 ID。", "If the process handle is lost, use task get <taskId> with the ID from stderr, or locate the call with task list. For delivery now, keep checking the same ID every few seconds while state is running."),
6
+ productText(product, "用户明确稍后取回时用 --async。受理后立即向用户返回 taskId 和当前 state,本轮到此结束。用户回来时用同一 ID 取结果。退出码 0 在此表示已受理。", "For later pickup, use --async. As soon as it is accepted, return the taskId and current state to the user and end this turn. When they return, retrieve the result with that ID. Exit 0 here means accepted."),
7
+ productText(product, "异步由本机后台进程继续执行。退出前台不会取消已交接的任务。unknown 或查询超时只能说明结果待确认,请查原任务,勿另发创作。", "Async work continues in a local background process. Leaving the foreground does not cancel accepted work. On unknown or a query timeout, check the original task without resubmitting.")
8
+ ];
9
+ }