@lingjingai/lj-awb-cli 0.5.14 → 0.5.16

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingjingai/lj-awb-cli",
3
- "version": "0.5.14",
3
+ "version": "0.5.16",
4
4
  "description": "Lingjing AWB CLI monorepo with shared core, standalone CLI, and agent skills",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -9,7 +9,8 @@
9
9
  },
10
10
  "dependencies": {
11
11
  "chalk": "^5.6.2",
12
- "cli-table3": "^0.6.5"
12
+ "cli-table3": "^0.6.5",
13
+ "undici": "^6.28.1"
13
14
  },
14
15
  "engines": {
15
16
  "node": ">=20"
@@ -24,7 +25,7 @@
24
25
  "build:pre-publish": "node build/pre-publish.mjs",
25
26
  "build:prod": "node build/prod.mjs",
26
27
  "check": "npm run check:local && npm run check:real",
27
- "check:local": "node --check install.mjs && node --check packages/awb-core/src/common.js && node --check packages/awb-core/src/api.js && node --check packages/awb-core/src/auth.js && node --check packages/awb-core/src/output.js && node --check packages/awb-core/src/update.js && node --check packages/awb-core/src/services.js && node --check packages/awb-core/src/commands.js && node --check packages/awb-core/src/standalone.js && sh -n packages/awb-cli/bin/lj-awb && bash -n skills/lj-awb/scripts/resolve-lj-awb-cmd.sh && node --check packages/awb-cli/bin/lj-awb.js && node --check build/build.mjs && node --check build/_shared.mjs && node --check build/pre.mjs && node --check build/volta-pre.mjs && node --check build/pre-publish.mjs && node --check build/prod.mjs && node --check scripts/run-openapi-cli-examples-real.mjs && node --check scripts/validate-cli-schema.mjs && node --check scripts/validate-cli-output-contract.mjs && node --check scripts/validate-cli-command-coverage.mjs && node --check tests/test-model-filters.mjs && node --check tests/test-credits-records.mjs && node --check tests/test-task-status.mjs && node --check tests/test-project-members.mjs && node scripts/validate-skill-meta.mjs && node scripts/validate-cli-schema.mjs && node scripts/validate-cli-command-coverage.mjs && node --test tests/test-model-filters.mjs tests/test-credits-records.mjs tests/test-task-status.mjs tests/test-project-members.mjs",
28
+ "check:local": "node --check install.mjs && node --check packages/awb-core/src/common.js && node --check packages/awb-core/src/api.js && node --check packages/awb-core/src/auth.js && node --check packages/awb-core/src/output.js && node --check packages/awb-core/src/update.js && node --check packages/awb-core/src/services.js && node --check packages/awb-core/src/commands.js && node --check packages/awb-core/src/standalone.js && sh -n packages/awb-cli/bin/lj-awb && bash -n skills/lj-awb/scripts/resolve-lj-awb-cmd.sh && node --check packages/awb-cli/bin/lj-awb.js && node --check build/build.mjs && node --check build/_shared.mjs && node --check build/pre.mjs && node --check build/volta-pre.mjs && node --check build/pre-publish.mjs && node --check build/prod.mjs && node --check scripts/run-openapi-cli-examples-real.mjs && node --check scripts/validate-cli-schema.mjs && node --check scripts/validate-cli-output-contract.mjs && node --check scripts/validate-cli-command-coverage.mjs && node --check tests/test-api.mjs && node --check tests/test-model-filters.mjs && node --check tests/test-credits-records.mjs && node --check tests/test-task-status.mjs && node --check tests/test-project-members.mjs && node scripts/validate-skill-meta.mjs && node scripts/validate-cli-schema.mjs && node scripts/validate-cli-command-coverage.mjs && node --test tests/test-api.mjs tests/test-model-filters.mjs tests/test-credits-records.mjs tests/test-task-status.mjs tests/test-project-members.mjs",
28
29
  "check:real": "node scripts/validate-cli-output-contract.mjs && node scripts/validate-openapi-cli-examples.mjs",
29
30
  "test:openapi-real": "node scripts/run-openapi-cli-examples-real.mjs",
30
31
  "smoke": "packages/awb-cli/bin/lj-awb --help && packages/awb-cli/bin/lj-awb auth status -f json && packages/awb-cli/bin/lj-awb system && packages/awb-cli/bin/lj-awb auth && packages/awb-cli/bin/lj-awb account && packages/awb-cli/bin/lj-awb project && packages/awb-cli/bin/lj-awb credits && packages/awb-cli/bin/lj-awb upload && packages/awb-cli/bin/lj-awb model && packages/awb-cli/bin/lj-awb create && packages/awb-cli/bin/lj-awb task && packages/awb-cli/bin/lj-awb schema -f json >/dev/null",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingjingai/awb-cli-bin",
3
- "version": "0.5.14",
3
+ "version": "0.5.16",
4
4
  "description": "Standalone CLI for Lingjing AWB",
5
5
  "private": true,
6
6
  "license": "MIT",
@@ -13,6 +13,6 @@
13
13
  "README.md"
14
14
  ],
15
15
  "dependencies": {
16
- "@lingjingai/awb-core": "0.5.14"
16
+ "@lingjingai/awb-core": "0.5.16"
17
17
  }
18
18
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingjingai/awb-core",
3
- "version": "0.5.14",
3
+ "version": "0.5.16",
4
4
  "description": "Shared core runtime for Lingjing AWB CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -19,6 +19,7 @@
19
19
  ],
20
20
  "dependencies": {
21
21
  "chalk": "^5.6.2",
22
- "cli-table3": "^0.6.5"
22
+ "cli-table3": "^0.6.5",
23
+ "undici": "^6.28.1"
23
24
  }
24
25
  }
@@ -1,6 +1,48 @@
1
+ import { Agent } from 'undici';
1
2
  import { API_ORIGIN, LingjingAwbCliError } from './common.js';
2
3
  import { resolveAuthContext } from './auth.js';
3
4
 
5
+ export const API_REQUEST_TIMEOUT_MS = 20_000;
6
+ export const API_CONNECT_TIMEOUT_MS = 20_000;
7
+
8
+ const API_DISPATCHER = new Agent({ connectTimeout: API_CONNECT_TIMEOUT_MS });
9
+
10
+ const SENSITIVE_DIAGNOSTIC_KEY = /(?:access.?key|authorization|cookie|credential|password|redeem(?:ption)?code|secret|session|signature|token)/i;
11
+
12
+ function sanitizeDiagnosticUrl(value) {
13
+ try {
14
+ const url = new URL(value);
15
+ for (const key of url.searchParams.keys()) {
16
+ if (SENSITIVE_DIAGNOSTIC_KEY.test(key)) url.searchParams.set(key, '[REDACTED]');
17
+ }
18
+ return url.toString();
19
+ } catch {
20
+ return value;
21
+ }
22
+ }
23
+
24
+ export function sanitizeRequestDiagnostics(value, key = '') {
25
+ if (SENSITIVE_DIAGNOSTIC_KEY.test(key)) return '[REDACTED]';
26
+ if (Array.isArray(value)) return value.map((item) => sanitizeRequestDiagnostics(item));
27
+ if (value && typeof value === 'object') {
28
+ return Object.fromEntries(Object.entries(value)
29
+ .map(([itemKey, itemValue]) => [itemKey, sanitizeRequestDiagnostics(itemValue, itemKey)]));
30
+ }
31
+ if (typeof value === 'string' && /^https?:\/\//i.test(value)) return sanitizeDiagnosticUrl(value);
32
+ return value;
33
+ }
34
+
35
+ function requestDiagnostics({ method, url, query, body, timeoutMs, startedAt, extra = {} }) {
36
+ return {
37
+ method,
38
+ url: sanitizeDiagnosticUrl(url.toString()),
39
+ timeoutMs,
40
+ elapsedMs: Date.now() - startedAt,
41
+ request: sanitizeRequestDiagnostics({ query: query || {}, body }),
42
+ ...extra,
43
+ };
44
+ }
45
+
4
46
  function buildHeaders(authContext, extraHeaders = {}) {
5
47
  const contextHeaders = {};
6
48
  for (const [headerName, envNames] of Object.entries({
@@ -43,7 +85,9 @@ export async function apiFetch(pathname, options = {}) {
43
85
  body,
44
86
  auth = true,
45
87
  headers = {},
88
+ timeoutMs: requestedTimeoutMs = API_REQUEST_TIMEOUT_MS,
46
89
  } = options;
90
+ const timeoutMs = Math.max(1, Number(requestedTimeoutMs) || API_REQUEST_TIMEOUT_MS);
47
91
 
48
92
  const authContext = auth ? await resolveAuthContext({ required: true }) : null;
49
93
  const url = new URL(pathname, API_ORIGIN);
@@ -52,29 +96,50 @@ export async function apiFetch(pathname, options = {}) {
52
96
  url.searchParams.set(key, String(value));
53
97
  }
54
98
 
99
+ const startedAt = Date.now();
100
+ const controller = new AbortController();
101
+ const timeout = setTimeout(() => controller.abort(), timeoutMs);
55
102
  let response;
103
+ let rawText;
56
104
  try {
57
105
  response = await fetch(url, {
58
106
  method,
59
107
  headers: buildHeaders(authContext, headers),
60
108
  body: method.toUpperCase() === 'GET' || body === undefined ? undefined : stringifyJsonBody(body),
109
+ dispatcher: API_DISPATCHER,
110
+ signal: controller.signal,
61
111
  });
112
+ rawText = await response.text();
62
113
  } catch (error) {
63
- const causeCode = error?.cause?.code;
114
+ const causeCode = error?.cause?.code ?? error?.code;
115
+ const isTimeout = controller.signal.aborted;
64
116
  const isTlsIssuerError = causeCode === 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY';
65
- throw new LingjingAwbCliError(isTlsIssuerError
117
+ throw new LingjingAwbCliError(isTimeout
118
+ ? `请求平台接口超时:超过 ${timeoutMs}ms`
119
+ : isTlsIssuerError
66
120
  ? '请求平台接口失败:本机 Node 无法验证平台 HTTPS 证书链'
67
121
  : `请求平台接口失败:${error.message}`, {
68
- type: 'network_error',
122
+ type: isTimeout ? 'request_timeout' : 'network_error',
69
123
  exitCode: 30,
70
- hint: isTlsIssuerError
124
+ hint: isTimeout
125
+ ? '请检查平台、网关和网络状态后重试;创建类请求重试前请先确认是否已生成任务,避免重复扣费。'
126
+ : isTlsIssuerError
71
127
  ? '请使用全局 lj-awb 命令运行,或设置 NODE_EXTRA_CA_CERTS=/etc/ssl/cert.pem 后重试。'
72
128
  : '',
73
- details: { url: url.toString(), causeCode },
129
+ details: requestDiagnostics({
130
+ method,
131
+ url,
132
+ query,
133
+ body,
134
+ timeoutMs,
135
+ startedAt,
136
+ extra: { causeCode },
137
+ }),
74
138
  });
139
+ } finally {
140
+ clearTimeout(timeout);
75
141
  }
76
142
 
77
- const rawText = await response.text();
78
143
  let payload = null;
79
144
  try {
80
145
  payload = rawText ? JSON.parse(rawText) : null;
@@ -82,7 +147,15 @@ export async function apiFetch(pathname, options = {}) {
82
147
  throw new LingjingAwbCliError('平台接口返回了无效 JSON', {
83
148
  type: 'invalid_json',
84
149
  exitCode: 30,
85
- details: { status: response.status, body: rawText.slice(0, 500) },
150
+ details: requestDiagnostics({
151
+ method,
152
+ url,
153
+ query,
154
+ body,
155
+ timeoutMs,
156
+ startedAt,
157
+ extra: { status: response.status, responseBody: rawText.slice(0, 500) },
158
+ }),
86
159
  });
87
160
  }
88
161
 
@@ -90,7 +163,15 @@ export async function apiFetch(pathname, options = {}) {
90
163
  throw new LingjingAwbCliError(payload?.msg || payload?.message || `${response.status} ${response.statusText}`, {
91
164
  type: response.status === 401 ? 'auth_failed' : 'http_error',
92
165
  exitCode: response.status === 401 ? 3 : 30,
93
- details: { status: response.status, payload },
166
+ details: requestDiagnostics({
167
+ method,
168
+ url,
169
+ query,
170
+ body,
171
+ timeoutMs,
172
+ startedAt,
173
+ extra: { status: response.status, payload },
174
+ }),
94
175
  });
95
176
  }
96
177
 
@@ -98,7 +179,20 @@ export async function apiFetch(pathname, options = {}) {
98
179
  throw new LingjingAwbCliError(payload.msg || payload.message || '平台接口返回失败', {
99
180
  type: String(payload.code) === '401' ? 'auth_failed' : 'api_error',
100
181
  exitCode: String(payload.code) === '401' ? 3 : 1,
101
- details: payload,
182
+ details: requestDiagnostics({
183
+ method,
184
+ url,
185
+ query,
186
+ body,
187
+ timeoutMs,
188
+ startedAt,
189
+ extra: {
190
+ code: payload.code,
191
+ msg: payload.msg ?? payload.message,
192
+ traceId: payload.traceId,
193
+ payload,
194
+ },
195
+ }),
102
196
  });
103
197
  }
104
198
 
@@ -83,7 +83,12 @@ const INCLUDE_RAW_ARG = { name: 'include-raw', description: '在 JSON 中附带
83
83
  const PROJECT_ID_ARG = { name: 'project-id', valueName: 'projectId', description: 'AWB 项目 ID(不同于 --project-group-no)' };
84
84
  const PROJECT_GROUP_ARG = { name: 'project-group-no', valueName: 'no', description: '项目组编号;不传时读取当前项目组 / 环境变量 / 本地状态' };
85
85
  const MODEL_GROUP_ARG = { name: 'model-group-code', valueName: 'code', description: '模型组编码;创建和参数查询只传这个字段' };
86
- const ASSET_PLATFORM_ARG = { name: 'platform', valueName: 'platform', description: '素材加白平台,必须显式传 JIMENG 或 BYTEPLUS,不做别名推断' };
86
+ const ASSET_PLATFORM_ARG = {
87
+ name: 'platform',
88
+ valueName: 'platform',
89
+ description:
90
+ '素材加白平台,必须使用 model asset-review-models 返回的平台编码,不做别名推断',
91
+ };
87
92
  const MODEL_LIST_ARGS = [
88
93
  { name: 'model', valueName: 'keyword', description: '按模型名、编码、供应商或输入方式过滤;不传时查询全部' },
89
94
  { name: 'usage', valueName: 'usage', description: '模型用途:image=IMAGE_CREATE,video=VIDEO_CREATE,audio=AUDIO_CREATE。取值大小写不敏感' },
@@ -254,7 +254,15 @@ function normalizeBatchTaskResult(row = {}) {
254
254
  resultCount: row.resultCount,
255
255
  resultUrls: row.resultUrls,
256
256
  error: row.error,
257
+ errorType: row.errorType,
257
258
  errorMessage: row.errorMessage,
259
+ errorHint: row.errorHint,
260
+ errorDetails: row.errorDetails,
261
+ waitStatus: row.waitStatus,
262
+ waitError: row.waitError,
263
+ waitErrorType: row.waitErrorType,
264
+ waitErrorMessage: row.waitErrorMessage,
265
+ waitErrorHint: row.waitErrorHint,
258
266
  nextCommand: rewriteCommandPrefix(row.nextCommand),
259
267
  statusCommand: rewriteCommandPrefix(row.statusCommand || submissionStatusCommand('create image', row)),
260
268
  });
@@ -264,6 +272,7 @@ function normalizeBatchTaskSubmission(data = {}) {
264
272
  const results = Array.isArray(data.results) ? data.results.map((row) => normalizeBatchTaskResult(row)) : [];
265
273
  const successCount = data.successCount ?? results.filter((row) => row.status === 'success' || row.taskId).length;
266
274
  const failureCount = data.failureCount ?? results.filter((row) => row.status === 'error' || row.error || row.errorMessage).length;
275
+ const waitFailureCount = data.waitFailureCount ?? results.filter((row) => row.waitError).length;
267
276
  return compactRecord({
268
277
  ...data,
269
278
  dryRun: data.dryRun,
@@ -271,12 +280,32 @@ function normalizeBatchTaskSubmission(data = {}) {
271
280
  count: data.count ?? results.length,
272
281
  successCount,
273
282
  failureCount,
283
+ waitFailureCount,
274
284
  taskRecordFile: data.taskRecordFile,
275
285
  nextCommand: rewriteCommandPrefix(data.nextCommand),
276
286
  results,
277
287
  });
278
288
  }
279
289
 
290
+ function batchTaskErrorDiagnostic(row = {}) {
291
+ const waitError = isPlainObject(row.waitError) ? row.waitError : null;
292
+ const details = isPlainObject(row.errorDetails)
293
+ ? row.errorDetails
294
+ : (isPlainObject(waitError?.details) ? waitError.details : null);
295
+ if (!details) return null;
296
+ return compactRecord({
297
+ phase: waitError ? 'wait' : 'create',
298
+ errorType: waitError?.type ?? row.waitErrorType ?? row.errorType,
299
+ errorMessage: waitError?.message ?? row.waitErrorMessage ?? row.errorMessage ?? row.error,
300
+ causeCode: details.causeCode,
301
+ method: details.method,
302
+ url: details.url,
303
+ timeoutMs: details.timeoutMs,
304
+ elapsedMs: details.elapsedMs,
305
+ request: details.request,
306
+ });
307
+ }
308
+
280
309
  function normalizeSubtitleSubmission(data = {}) {
281
310
  return compactRecord({
282
311
  submitted: data.submitted,
@@ -820,6 +849,10 @@ function rowSummary(row) {
820
849
  'isPrimary',
821
850
  'referenceType',
822
851
  'resultCount',
852
+ 'waitErrorType',
853
+ 'waitErrorMessage',
854
+ 'errorType',
855
+ 'errorMessage',
823
856
  'promptSummary',
824
857
  'recordedAt',
825
858
  'gmtCreate',
@@ -1470,6 +1503,7 @@ const FIELD_LABELS = {
1470
1503
  externalId: '外部 ID',
1471
1504
  fileCount: '文件数',
1472
1505
  failureCount: '失败数',
1506
+ waitFailureCount: '等待失败数',
1473
1507
  feeCommand: '估价命令',
1474
1508
  format: '格式',
1475
1509
  generateNum: '生成数量',
@@ -1540,6 +1574,7 @@ const FIELD_LABELS = {
1540
1574
  sourceTaskId: '来源任务 ID',
1541
1575
  stateKey: '状态 Key',
1542
1576
  status: '状态',
1577
+ waitStatus: '等待状态',
1543
1578
  statusCommand: '状态查询命令',
1544
1579
  statusCommandTaskType: '状态任务类型',
1545
1580
  submitted: '已提交',
@@ -1608,7 +1643,7 @@ const DETAIL_FIELDS_BY_KIND = {
1608
1643
  auth_status: ['configured', 'authType', 'accessKey', 'source', 'verified', 'verification', 'verifyCommand', 'userId', 'userName', 'groupId', 'groupName'],
1609
1644
  batch_subject_publish_result: ['dryRun', 'submitted', 'count', 'successCount', 'failureCount', 'modelCode', 'projectGroupNo'],
1610
1645
  batch_task_status: ['count', 'taskCount', 'successTaskCount', 'resultCount', 'pointTotal', 'timedOut', 'waitedMs'],
1611
- batch_task_submission: ['dryRun', 'submitted', 'count', 'taskCount', 'successCount', 'failureCount', 'modelGroupCode', 'projectGroupNo', 'pointCost', 'billingPointBalance', 'projectBudgetBalance', 'taskRecordFile', 'nextCommand'],
1646
+ batch_task_submission: ['dryRun', 'submitted', 'count', 'taskCount', 'successCount', 'failureCount', 'waitFailureCount', 'modelGroupCode', 'projectGroupNo', 'pointCost', 'billingPointBalance', 'projectBudgetBalance', 'taskRecordFile', 'nextCommand'],
1612
1647
  credit_detail_status: ['detailId', 'status', 'statusText', 'lockTime', 'lockPoint', 'useTime', 'usePoint', 'regetTime', 'regetPoint'],
1613
1648
  credits_balance: ['billingPointBalance', 'currentProjectGroupNo', 'currentProjectGroupName', 'projectBudgetBalance', 'projectBudgetMax'],
1614
1649
  credits_records: ['remainPoint', 'dataPlanPoint', 'topUpPoint', 'queryType', 'total', 'page', 'size', 'pages'],
@@ -2088,7 +2123,7 @@ const TABLE_COLUMNS = {
2088
2123
  column('状态', ['status', 'taskStatus'], { maxWidth: 16 }),
2089
2124
  column('任务 ID', 'taskId', { maxWidth: 28 }),
2090
2125
  column('模型/主体', ['modelGroupCode', 'modelCode', 'name'], { maxWidth: 30 }),
2091
- column('说明', ['promptSummary', 'message', 'errorMessage', 'prompt'], { maxWidth: 42 }),
2126
+ column('说明', (row) => row.waitErrorMessage ?? row.errorMessage ?? row.error?.message ?? row.promptSummary ?? row.message ?? row.prompt, { maxWidth: 42 }),
2092
2127
  column('状态查询', 'statusCommand', { maxWidth: 48 }),
2093
2128
  ],
2094
2129
  subjects: [
@@ -2940,6 +2975,18 @@ function formatPrettyGeneric(commandName, data, context = {}) {
2940
2975
  const limit = listLimitFor(commandName, context, rows);
2941
2976
  renderArraySection(lines, namedListTitle(key), rows, key, limit);
2942
2977
  }
2978
+ if (kind === 'batch_task_submission' && Array.isArray(normalized.results)) {
2979
+ for (const [index, row] of normalized.results.entries()) {
2980
+ const diagnostic = batchTaskErrorDiagnostic(row);
2981
+ if (!diagnostic) continue;
2982
+ renderDetails(
2983
+ lines,
2984
+ `错误诊断(序号 ${row.inputIndex ?? index})`,
2985
+ diagnostic,
2986
+ ['phase', 'errorType', 'errorMessage', 'causeCode', 'method', 'url', 'timeoutMs', 'elapsedMs', 'request'],
2987
+ );
2988
+ }
2989
+ }
2943
2990
  renderUrlLists(lines, normalized);
2944
2991
  renderNextActions(lines, collectPrettyActions(commandName, normalized, context), modelListAgentHint(commandName));
2945
2992
  return `${lines.join('\n')}\n`;
@@ -3037,8 +3084,13 @@ export function formatPrettyError(error) {
3037
3084
  msg: error.details.msg ?? payload.msg ?? payload.message,
3038
3085
  traceId: error.details.traceId ?? payload.traceId,
3039
3086
  causeCode: error.details.causeCode,
3087
+ method: error.details.method,
3088
+ url: error.details.url,
3089
+ timeoutMs: error.details.timeoutMs,
3090
+ elapsedMs: error.details.elapsedMs,
3091
+ request: error.details.request,
3040
3092
  unknownOptions: Array.isArray(error.details.unknownOptions) ? error.details.unknownOptions.join(', ') : undefined,
3041
- }), ['status', 'code', 'msg', 'traceId', 'causeCode', 'unknownOptions']);
3093
+ }), ['status', 'code', 'msg', 'traceId', 'causeCode', 'method', 'url', 'timeoutMs', 'elapsedMs', 'request', 'unknownOptions']);
3042
3094
  }
3043
3095
  return `${lines.join('\n')}\n`;
3044
3096
  }
@@ -3166,6 +3218,18 @@ export function formatTextOutput(commandName, data, context = {}) {
3166
3218
  const summary = rowSummary(row);
3167
3219
  if (summary) lines.push(`${list.key}[${index}]: ${summary}`);
3168
3220
  if (isPlainObject(row)) {
3221
+ const diagnostic = batchTaskErrorDiagnostic(row);
3222
+ if (diagnostic) {
3223
+ const detailLine = renderRecord(
3224
+ diagnostic,
3225
+ ['phase', 'errorType', 'errorMessage', 'causeCode', 'method', 'url', 'timeoutMs', 'elapsedMs'],
3226
+ ['request'],
3227
+ );
3228
+ if (detailLine) lines.push(`${list.key}[${index}].errorDetails ${detailLine}`);
3229
+ if (diagnostic.request !== undefined) {
3230
+ lines.push(`${list.key}[${index}].errorRequest=${JSON.stringify(diagnostic.request)}`);
3231
+ }
3232
+ }
3169
3233
  const resultUrls = Array.isArray(row.resultUrls) ? row.resultUrls : [];
3170
3234
  const originUrls = !resultUrls.length && Array.isArray(row.originUrls) ? row.originUrls : [];
3171
3235
  const urls = resultUrls.length ? resultUrls : originUrls;
@@ -3204,9 +3268,14 @@ export function formatTextError(error) {
3204
3268
  msg: error.details.msg ?? payload.msg ?? payload.message,
3205
3269
  traceId: error.details.traceId ?? payload.traceId,
3206
3270
  causeCode: error.details.causeCode,
3271
+ method: error.details.method,
3272
+ url: error.details.url,
3273
+ timeoutMs: error.details.timeoutMs,
3274
+ elapsedMs: error.details.elapsedMs,
3207
3275
  unknownOptions: Array.isArray(error.details.unknownOptions) ? error.details.unknownOptions.join(',') : undefined,
3208
- }), ['status', 'code', 'msg', 'traceId', 'causeCode', 'unknownOptions']);
3276
+ }), ['status', 'code', 'msg', 'traceId', 'causeCode', 'method', 'url', 'timeoutMs', 'elapsedMs', 'unknownOptions']);
3209
3277
  if (detailLine) lines.push(`details ${detailLine}`);
3278
+ if (error.details.request !== undefined) lines.push(`request=${JSON.stringify(error.details.request)}`);
3210
3279
  }
3211
3280
  return `${lines.join('\n')}\n`;
3212
3281
  }
@@ -50,6 +50,7 @@ const REQUEST_SOURCE_CLI = 'LINGJING_AWB_CLI';
50
50
  const DEFAULT_TASK_RECORD_FILE_ENV = process.env.LINGJING_AWB_TASK_RECORD_FILE || process.env.AWB_TASK_RECORD_FILE;
51
51
  const execFileAsync = promisify(execFile);
52
52
  const COMMON_IMAGE_FORMATS = new Set(['jpg', 'jpeg', 'jfif', 'png', 'webp']);
53
+ export const COS_UPLOAD_TIMEOUT_MS = 60_000;
53
54
  const REMOTE_IMAGE_DOWNLOAD_TIMEOUT_MS = 30_000;
54
55
  const REMOTE_IMAGE_DOWNLOAD_MAX_BYTES = 100 * 1024 * 1024;
55
56
  const REMOTE_IMAGE_MIME_TYPES = new Set([
@@ -73,7 +74,17 @@ const REMOTE_VOICE_MIME_TYPES = new Set([
73
74
  'video/mp4',
74
75
  ]);
75
76
  const REMOTE_VOICE_EXTENSIONS = new Set(['.mp3', '.wav', '.m4a', '.aac', '.ogg', '.mp4']);
76
- const ASSET_PLATFORM_CODES = ['JIMENG', 'BYTEPLUS'];
77
+ const ASSET_PLATFORM_CODES = [
78
+ 'JIMENG',
79
+ 'BYTEPLUS',
80
+ 'SKYPRODUCTION_CN',
81
+ 'SKYPRODUCTION_BP',
82
+ ];
83
+ const SKYPRODUCTION_ASSET_PLATFORM_CODES = [
84
+ 'SKYPRODUCTION_CN',
85
+ 'SKYPRODUCTION_BP',
86
+ ];
87
+ const SKYPRODUCTION_ASSET_PLATFORM_CODE_SET = new Set(SKYPRODUCTION_ASSET_PLATFORM_CODES);
77
88
  const ASSET_PLATFORM_CODE_SET = new Set(ASSET_PLATFORM_CODES);
78
89
  const ASSET_PLATFORM_HINT = ASSET_PLATFORM_CODES.join('|');
79
90
  const ASSET_TYPE_CODES = Object.freeze({
@@ -1350,12 +1361,31 @@ function normalizeAssetReviewModelRecord(item = {}) {
1350
1361
  });
1351
1362
  }
1352
1363
 
1364
+ export function expandAssetReviewModelPlatforms(models = []) {
1365
+ const expanded = [];
1366
+ const seen = new Set();
1367
+ for (const model of models) {
1368
+ const platforms = SKYPRODUCTION_ASSET_PLATFORM_CODE_SET.has(model?.platform)
1369
+ ? SKYPRODUCTION_ASSET_PLATFORM_CODES
1370
+ : [model?.platform];
1371
+ for (const platform of platforms) {
1372
+ const record = compactRecord({ ...model, platform });
1373
+ const key = `${record.modelGroupCode ?? ''}\u0000${record.platform ?? ''}`;
1374
+ if (seen.has(key)) continue;
1375
+ seen.add(key);
1376
+ expanded.push(record);
1377
+ }
1378
+ }
1379
+ return expanded;
1380
+ }
1381
+
1353
1382
  export async function assetReviewModels(kwargs = {}) {
1354
1383
  const modelGroupCode = trimToNull(kwargs.modelGroupCode);
1355
1384
  const platform = optionalAssetPlatform(kwargs.platform);
1356
1385
  const payload = await awbApi.fetchAssetReviewModels();
1357
- const models = normalizeRows(payload)
1358
- .map((item) => normalizeAssetReviewModelRecord(item))
1386
+ const models = expandAssetReviewModelPlatforms(
1387
+ normalizeRows(payload).map((item) => normalizeAssetReviewModelRecord(item)),
1388
+ )
1359
1389
  .filter((item) => !modelGroupCode || item.modelGroupCode === modelGroupCode)
1360
1390
  .filter((item) => !platform || item.platform === platform);
1361
1391
  return {
@@ -3924,7 +3954,7 @@ function assetValidationSummary(validation) {
3924
3954
  function assetConversionUnavailableError(validation) {
3925
3955
  const summary = assetValidationSummary(validation);
3926
3956
  return argumentError(
3927
- `素材不符合 JIMENG 加白规格:${summary || '规格不合法'}`,
3957
+ `素材不符合加白规格:${summary || '规格不合法'}`,
3928
3958
  'CLI 无法自动生成转码计划,请手动转换为合法图片 / 视频 / 音频规格后重试。',
3929
3959
  );
3930
3960
  }
@@ -3932,13 +3962,13 @@ function assetConversionUnavailableError(validation) {
3932
3962
  async function confirmAssetConversion(validation) {
3933
3963
  if (process.stdin.isTTY !== true || process.stderr.isTTY !== true) {
3934
3964
  throw argumentError(
3935
- `素材不符合 JIMENG 加白规格:${assetValidationSummary(validation)}`,
3965
+ `素材不符合加白规格:${assetValidationSummary(validation)}`,
3936
3966
  '非交互终端不会自动询问。请在终端中重试并确认转码,或追加 --auto-convert 自动转换后继续。',
3937
3967
  );
3938
3968
  }
3939
3969
  const rl = createInterface({ input: process.stdin, output: process.stderr });
3940
3970
  try {
3941
- const answer = await rl.question(`素材不符合 JIMENG 加白规格:${assetValidationSummary(validation)}\n是否自动转码为合法规格后继续?[y/N] `);
3971
+ const answer = await rl.question(`素材不符合加白规格:${assetValidationSummary(validation)}\n是否自动转码为合法规格后继续?[y/N] `);
3942
3972
  return ['y', 'yes'].includes(String(answer || '').trim().toLowerCase());
3943
3973
  } finally {
3944
3974
  rl.close();
@@ -3985,7 +4015,7 @@ async function resolveInvalidAssetLocalFile(validation, kwargs = {}) {
3985
4015
  const shouldConvert = toBool(kwargs.autoConvert) || await confirmAssetConversion(validation);
3986
4016
  if (!shouldConvert) {
3987
4017
  throw argumentError(
3988
- `素材不符合 JIMENG 加白规格:${assetValidationSummary(validation)}`,
4018
+ `素材不符合加白规格:${assetValidationSummary(validation)}`,
3989
4019
  '已取消自动转码。请手动转换素材,或追加 --auto-convert 自动转换后继续。',
3990
4020
  );
3991
4021
  }
@@ -4047,22 +4077,62 @@ export async function uploadLocalFile(filePath, options = {}) {
4047
4077
  startTime: secret.startTime,
4048
4078
  expiredTime: secret.expiredTime,
4049
4079
  });
4050
- const response = await fetch(`https://${host}/${encodeObjectNamePath(objectName)}`, {
4051
- method: 'PUT',
4052
- headers: {
4053
- authorization,
4054
- 'content-length': String(buffer.length),
4055
- 'content-type': inspected.mimeType || guessMimeType(inspected.filePath),
4056
- host,
4057
- 'x-cos-security-token': credentials.sessionToken,
4058
- },
4059
- body: buffer,
4060
- });
4080
+ const uploadUrl = `https://${host}/${encodeObjectNamePath(objectName)}`;
4081
+ const startedAt = Date.now();
4082
+ let response;
4083
+ try {
4084
+ response = await fetch(uploadUrl, {
4085
+ method: 'PUT',
4086
+ headers: {
4087
+ authorization,
4088
+ 'content-length': String(buffer.length),
4089
+ 'content-type': inspected.mimeType || guessMimeType(inspected.filePath),
4090
+ host,
4091
+ 'x-cos-security-token': credentials.sessionToken,
4092
+ },
4093
+ body: buffer,
4094
+ signal: AbortSignal.timeout(COS_UPLOAD_TIMEOUT_MS),
4095
+ });
4096
+ } catch (error) {
4097
+ const isTimeout = error?.name === 'TimeoutError';
4098
+ throw new LingjingAwbCliError(isTimeout
4099
+ ? `上传 COS 超时:超过 ${COS_UPLOAD_TIMEOUT_MS}ms`
4100
+ : `上传 COS 失败:${error.message}`, {
4101
+ type: isTimeout ? 'request_timeout' : 'network_error',
4102
+ exitCode: 30,
4103
+ hint: isTimeout ? '请检查 COS、公司出口网络和文件大小后重试。' : '',
4104
+ details: {
4105
+ method: 'PUT',
4106
+ url: uploadUrl,
4107
+ timeoutMs: COS_UPLOAD_TIMEOUT_MS,
4108
+ elapsedMs: Date.now() - startedAt,
4109
+ causeCode: isTimeout ? 'TIMEOUT' : (error?.cause?.code ?? error?.code),
4110
+ request: {
4111
+ fileName: inspected.fileName,
4112
+ fileSize: buffer.length,
4113
+ mimeType: inspected.mimeType || guessMimeType(inspected.filePath),
4114
+ objectName,
4115
+ },
4116
+ },
4117
+ });
4118
+ }
4061
4119
  if (!response.ok) {
4062
4120
  throw new LingjingAwbCliError(`上传 COS 失败:${response.status} ${response.statusText}`, {
4063
4121
  type: 'upload_failed',
4064
4122
  exitCode: 30,
4065
- details: { filePath: inspected.filePath, objectName },
4123
+ details: {
4124
+ method: 'PUT',
4125
+ url: uploadUrl,
4126
+ timeoutMs: COS_UPLOAD_TIMEOUT_MS,
4127
+ elapsedMs: Date.now() - startedAt,
4128
+ status: response.status,
4129
+ request: {
4130
+ fileName: inspected.fileName,
4131
+ fileSize: buffer.length,
4132
+ mimeType: inspected.mimeType || guessMimeType(inspected.filePath),
4133
+ objectName,
4134
+ },
4135
+ },
4066
4136
  });
4067
4137
  }
4068
4138
  return compactRecord({
@@ -5415,10 +5485,15 @@ async function runConcurrent(items, limit, worker) {
5415
5485
  try {
5416
5486
  results[index] = await worker(items[index], index);
5417
5487
  } catch (error) {
5488
+ const serializedError = serializeCliError(error);
5418
5489
  results[index] = {
5419
5490
  inputIndex: index,
5420
5491
  status: 'error',
5421
- error: error instanceof Error ? error.message : String(error),
5492
+ error: serializedError.message,
5493
+ errorType: serializedError.type,
5494
+ errorMessage: serializedError.message,
5495
+ ...(serializedError.hint ? { errorHint: serializedError.hint } : {}),
5496
+ ...(serializedError.details ? { errorDetails: serializedError.details } : {}),
5422
5497
  };
5423
5498
  }
5424
5499
  }
@@ -5427,6 +5502,57 @@ async function runConcurrent(items, limit, worker) {
5427
5502
  return results;
5428
5503
  }
5429
5504
 
5505
+ export function serializeCliError(error) {
5506
+ return compactRecord({
5507
+ type: error?.type || 'error',
5508
+ message: error instanceof Error ? error.message : String(error),
5509
+ hint: error?.hint,
5510
+ details: error?.details,
5511
+ });
5512
+ }
5513
+
5514
+ async function createBatchTask(kind, kwargs, item, index) {
5515
+ const createTask = kind === 'video' ? videoCreate : imageCreate;
5516
+ const taskType = kind === 'video' ? 'VIDEO_GROUP' : 'IMAGE_CREATE';
5517
+ const waitSeconds = Math.max(0, toInt(kwargs.waitSeconds, 0));
5518
+ const result = await createTask({
5519
+ ...kwargs,
5520
+ ...item,
5521
+ yes: true,
5522
+ dryRun: false,
5523
+ waitSeconds: 0,
5524
+ });
5525
+ const submission = {
5526
+ inputIndex: index,
5527
+ status: 'success',
5528
+ promptSummary: taskPromptSummary(item),
5529
+ ...result,
5530
+ };
5531
+ if (!result.taskId || waitSeconds <= 0) return submission;
5532
+ try {
5533
+ return {
5534
+ ...submission,
5535
+ waited: await waitTask({
5536
+ taskId: result.taskId,
5537
+ taskType,
5538
+ projectGroupNo: result.projectGroupNo,
5539
+ waitSeconds,
5540
+ pollIntervalMs: kwargs.pollIntervalMs,
5541
+ }),
5542
+ };
5543
+ } catch (error) {
5544
+ return {
5545
+ ...submission,
5546
+ status: 'submitted',
5547
+ waitStatus: 'error',
5548
+ waitError: serializeCliError(error),
5549
+ waitErrorType: error?.type || 'error',
5550
+ waitErrorMessage: error instanceof Error ? error.message : String(error),
5551
+ ...(error?.hint ? { waitErrorHint: error.hint } : {}),
5552
+ };
5553
+ }
5554
+ }
5555
+
5430
5556
  export async function imageCreateBatch(kwargs = {}) {
5431
5557
  const items = (await loadBatchItems(kwargs.inputFile, 'image'))
5432
5558
  .map((item, index) => normalizeTaskBatchItem(item, 'image', index));
@@ -5442,12 +5568,9 @@ export async function imageCreateBatch(kwargs = {}) {
5442
5568
  return summarizeBatchSubmission('image', kwargs, results, { dryRun: true, count: items.length });
5443
5569
  }
5444
5570
  ensureConfirmed(kwargs, '批量生图会多次消耗积分,需要确认', { action: 'create image-batch', count: items.length });
5445
- const results = await runConcurrent(items, kwargs.concurrency ?? 1, async (item, index) => ({
5446
- inputIndex: index,
5447
- status: 'success',
5448
- promptSummary: taskPromptSummary(item),
5449
- ...(await imageCreate({ ...kwargs, ...item, yes: true, dryRun: false })),
5450
- }));
5571
+ const results = await runConcurrent(items, kwargs.concurrency ?? 1, async (item, index) => (
5572
+ await createBatchTask('image', kwargs, item, index)
5573
+ ));
5451
5574
  return summarizeBatchSubmission('image', kwargs, results, { count: items.length });
5452
5575
  }
5453
5576
 
@@ -5466,12 +5589,9 @@ export async function videoCreateBatch(kwargs = {}) {
5466
5589
  return summarizeBatchSubmission('video', kwargs, results, { dryRun: true, count: items.length });
5467
5590
  }
5468
5591
  ensureConfirmed(kwargs, '批量生视频会多次消耗积分,需要确认', { action: 'create video-batch', count: items.length });
5469
- const results = await runConcurrent(items, kwargs.concurrency ?? 1, async (item, index) => ({
5470
- inputIndex: index,
5471
- status: 'success',
5472
- promptSummary: taskPromptSummary(item),
5473
- ...(await videoCreate({ ...kwargs, ...item, yes: true, dryRun: false })),
5474
- }));
5592
+ const results = await runConcurrent(items, kwargs.concurrency ?? 1, async (item, index) => (
5593
+ await createBatchTask('video', kwargs, item, index)
5594
+ ));
5475
5595
  return summarizeBatchSubmission('video', kwargs, results, { count: items.length });
5476
5596
  }
5477
5597
 
@@ -5513,13 +5633,15 @@ function summarizeBatchSubmission(kind, kwargs = {}, results = [], options = {})
5513
5633
  });
5514
5634
  });
5515
5635
  const successCount = normalizedResults.filter((row) => row.status === 'success' || row.taskId).length;
5516
- const failureCount = normalizedResults.filter((row) => row.status === 'error' || row.error).length;
5636
+ const failureCount = normalizedResults.filter((row) => row.status === 'error' && !row.taskId).length;
5637
+ const waitFailureCount = normalizedResults.filter((row) => row.waitError).length;
5517
5638
  return compactRecord({
5518
5639
  dryRun: options.dryRun,
5519
5640
  submitted: !options.dryRun,
5520
5641
  count: options.count ?? normalizedResults.length,
5521
5642
  successCount,
5522
5643
  failureCount,
5644
+ waitFailureCount,
5523
5645
  taskRecordFile,
5524
5646
  nextCommand: options.dryRun ? null : taskRecordPollCommand(taskRecordFile),
5525
5647
  results: normalizedResults,
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: lj-awb
3
- version: 0.5.14
3
+ version: 0.5.16
4
4
  description: "灵境 AWB CLI skill。使用 `lj-awb` 命令调用动漫平台 / AWB 云端能力,覆盖认证、项目组、积分余额/明细/用量(含充值购买与兑换码兑换)、模型发现、上传、统一 create 创建域、任务查询、视频超分。用户说生图、生视频、生成音频、积分明细、积分流水、充值记录、消耗记录、主体、音色、素材加白、去字幕时使用。正式生成、切换项目组、清空认证、兑换码等写入或扣费动作前必须确认。"
5
5
  metadata:
6
6
  bootstrap:
7
7
  package: "@lingjingai/lj-awb-cli"
8
- version: "0.5.14"
8
+ version: "0.5.16"
9
9
  bin: "lj-awb"
10
10
  cliHelp: "lj-awb --help"
11
11
  ---
@@ -1 +1 @@
1
- 0.5.14
1
+ 0.5.16
@@ -1,6 +1,6 @@
1
1
  {
2
- "skillVersion": "0.5.14",
3
- "minCliVersion": "0.5.14",
2
+ "skillVersion": "0.5.16",
3
+ "minCliVersion": "0.5.16",
4
4
  "preferredCommand": "lj-awb",
5
- "updatedAt": "2026-09-11"
5
+ "updatedAt": "2026-09-15"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  # Asset Module
2
2
 
3
- 资产模块负责素材库的"分组管理 + 素材注册 + 候选匹配",服务于生视频前需要平台素材加白 / 过审的流程。是否支持素材加白、支持哪个平台,以 `model asset-review-models` 返回为准;不要按模型名称硬编码推断。可灵 / KeLing 和 Vidu 的角色一致性通常走 [`subject.md`](subject.md) 的 `create subject`,不要把主体 `modelCode=tx|vidu` 和资产平台 `JIMENG|BYTEPLUS` 混用。
3
+ 资产模块负责素材库的"分组管理 + 素材注册 + 候选匹配",服务于生视频前需要平台素材加白 / 过审的流程。是否支持素材加白、支持哪个平台,以 `model asset-review-models` 返回为准;不要按模型名称硬编码推断。可灵 / KeLing 和 Vidu 的角色一致性通常走 [`subject.md`](subject.md) 的 `create subject`,不要把主体 `modelCode=tx|vidu` 和资产平台编码混用。
4
4
 
5
5
  ## 命令
6
6
 
@@ -49,7 +49,9 @@ lj-awb create video --model-group-code <videoModelGroupCode> \
49
49
  ## 规则
50
50
 
51
51
  - `create asset-group` / `create asset-group-update` / `create asset` 都是云端写入,**必须确认**后追加 `--yes`。
52
- - `create asset-*` 平台必须显式传 `--platform JIMENG|BYTEPLUS`;不要依赖默认平台,不要传中文名、小写名或供应商别名。
52
+ - `create asset-*` 平台必须显式传 `--platform`,且值必须逐字使用 `model asset-review-models --model-group-code <code>` 返回的 `platform`;只展示该命令返回的平台,不要展开系统全部平台,不要依赖默认平台,也不要传中文名、小写名或供应商别名。SkyProduction 国内或海外模型都会返回 `SKYPRODUCTION_CN`、`SKYPRODUCTION_BP` 两项供用户选择。
53
+ - `SKYPRODUCTION_CN` / `SKYPRODUCTION_BP` 没有供应商素材组概念;CLI 仍先创建或复用 Material 的本地组,用于绘梦素材库隔离,组 ID 不会发给供应商。
54
+ - SkyProduction 素材上游最长保留约 30 天并可能提前清理。CLI 不应承诺永久有效;平台不再返回旧素材时,请用原文件重新执行 `create asset` 加白。
53
55
  - `create asset` 会自动判断并传入 `assetType=Image|Video|Audio`;不要让用户手填资产类型。本地 `--file` 会在提交前校验格式、大小、尺寸、时长、帧率等规则。
54
56
  - 本地图片限制:格式 jpeg/jpg、png、webp、bmp、tiff/tif、gif、heic/heif;宽高比(宽/高)在 [0.4,2.5];宽和高都在 [300,6000] px;单张图片小于 30MB。
55
57
  - 本地视频限制:格式 mp4、mov;时长 [2,15] 秒;宽高比(宽/高)在 [0.4,2.5];宽和高都在 [300,6000] px;总像素数在 [409600,927408];单个视频不超过 50MB;FPS 在 [24,60]。平台文档里的 480p / 720p 体现在自动转码目标会压到合法像素区间,不再用“短边必须等于 480/720”作为源文件硬过滤。
@@ -80,6 +82,6 @@ lj-awb create video --model-group-code <videoModelGroupCode> \
80
82
 
81
83
  ## 下一步
82
84
 
83
- - 注册成功 → 优先按模型 create-spec / options 要求使用返回的 `assetId` 或 `assetPath`;需要 asset_id 时写 `--resource image:reference:<key>=asset:<assetId>`。
85
+ - 注册成功 → 使用返回的 `assetId`,写成 `--resource image:reference:<key>=asset:<assetId>`(首帧等其它 usage 同理);不要把 `assetPath` 当成已加白素材传入。`assetPath` 仅用于明确要求平台路径、且不走加白素材 ID 语义的接口。
84
86
  - 想看 group 里有哪些素材 → `create asset-group-get --group-id <id> --platform <platform>`。
85
87
  - 长期复用同一角色(可灵)→ 改走 [`subject.md`](subject.md)。
@@ -55,11 +55,11 @@ JSON 语法:
55
55
 
56
56
  - 图片生图一次性参考图只用 `image:reference=...`,不传 `reference_key`,prompt 中也不写 `<<<key>>>`;用“图一 / 图二 / 参考图 / 白发女 / 背景图”等自然语言指代。
57
57
  - 视频 reference 的 `reference_key` 用于和 prompt 中的 `<<<key>>>` 对齐,例如 `<<<hero>>>`;这是可选绑定,prompt 不写占位符时资源可以不带 key。
58
- - 视频一次性参考图用 `image:reference=...`;需要在 prompt 中明确绑定对象时才用 `image:reference:<key>=...`。取值优先级:平台素材的 `backendPath`(`material/...`) > 本地文件路径 > 真正外部公网完整 URL;视频参考生还可使用普通素材 `asset:<assetId>`。**不要把 `lj-awb upload files` 回显的 `url`(`https://*.myqcloud.com/material/...`)当作 source.value 直接复用,应改用 `backendPath`。**
58
+ - 视频一次性参考图用 `image:reference=...`;需要在 prompt 中明确绑定对象时才用 `image:reference:<key>=...`。普通素材取值优先级:平台素材的 `backendPath`(`material/...`) > 本地文件路径 > 真正外部公网完整 URL。**通过 `create asset` 加白的素材是例外:必须使用返回的 `assetId`,写成 `asset:<assetId>`,不要使用同一响应里的 `assetPath`。**不要把 `lj-awb upload files` 回显的 `url`(`https://*.myqcloud.com/material/...`)当作 source.value 直接复用,应改用 `backendPath`。
59
59
  - 参考音频 / 音乐 / 配音只有在 `model options.resources[]` 暴露 `media=AUDIO usage=reference` 时,才可用 `audio:reference=...` 或 `audio:reference:<key>=...`,作为参考资源进入 `promptParams.resources[]`。**不要把参考音频塞进 `--need-audio`**:`--need-audio` 只是输出音效开关,不接收音频文件。
60
60
  - 用户明确要求在 prompt 中指代音频时,可以使用 `audio:reference:<key>=...` 并在 prompt 中插入同名 `<<<key>>>`。
61
61
  - 可长期复用角色用 `create subject` 生成主体,再用 `subject:reference:<key>=asset:<subjectId>`;`subjectId` 来自 `create subject-wait` 返回的 `externalId`。
62
- - 首尾帧用 `image:first_frame=...` / `image:last_frame=...`;取值优先级与参考图一致:`backendPath` > 本地文件 > 真正外部公网完整 URL,也可以是 `asset:<assetId>`。
62
+ - 首尾帧用 `image:first_frame=...` / `image:last_frame=...`;普通素材取值优先级与参考图一致:`backendPath` > 本地文件 > 真正外部公网完整 URL。通过 `create asset` 加白的素材必须使用 `asset:<assetId>`,不要使用其 `assetPath`。
63
63
  - `image:last_frame` 默认和 `image:first_frame` 成对使用;只有模型资源约束声明 `supportLastFrameOnly=true` 时才可仅传尾帧。
64
64
  - `subject:reference:<key>=asset:<subjectId>` 表示主体引用,只放主体 ID;`image:reference=asset:<assetId>` / `image:first_frame=asset:<assetId>` / `image:last_frame=asset:<assetId>` 表示素材引用,只放素材资产 ID。主体和素材不要混用。
65
65
  - **视频素材模式互斥**:frames 模式(`image:first_frame` / `image:last_frame`)与 reference 模式(`image:reference` / `audio:reference` / `video:reference` / `subject:reference`)在同一次 `create video` 中**不能混用**。后端会以 `api_error code=1007: CLI 视频任务暂不支持 first_frame/last_frame 与 reference 混用` 拒绝。同时需要"图作为起点 + 音频/视频/主体参考"时,统一改用 `image:reference` + 其他 reference,让所有素材都在 reference 模式。
@@ -223,10 +223,10 @@ CLI 当前能力分为:
223
223
  ### 素材库与加白
224
224
 
225
225
  - 素材预审是否可用先查 `model asset-review-models --model-group-code <code>`;不要按模型名硬编码判断,也不要把 `modelGroupCode` 传入资产创建命令。
226
- - `create asset-*` 必须显式传 `--platform JIMENG|BYTEPLUS`,平台来自 `model asset-review-models` 或用户明确选择;不要依赖 material 默认平台。
226
+ - `create asset-*` 必须显式传 `--platform`,平台编码来自 `model asset-review-models --model-group-code <code>`;只展示该命令返回的平台,不要展开系统全部平台,也不要依赖 material 默认平台。SkyProduction 国内或海外模型都会返回 `SKYPRODUCTION_CN`、`SKYPRODUCTION_BP` 两项供用户选择。
227
227
  - 创建素材组前先 `create asset-groups --platform <platform> --name` 查重;有可用组就复用。
228
228
  - `create asset --file` 会在正式阶段自动上传并注册;同一文件多任务复用时,先 `upload files` 缓存 `backendPath`。
229
- - 注册成功后优先使用 `assetPath`,不要重新上传同一文件。
229
+ - 注册成功后使用返回的 `assetId`,以 `asset:<assetId>` 作为视频资源来源;不要把 `assetPath` 当成已加白素材传入,也不要重新上传同一文件。
230
230
 
231
231
  ## 何时加载其它模块
232
232