@lingjingai/lj-awb-cli 0.5.21 → 0.5.23

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/README.md CHANGED
@@ -255,6 +255,9 @@ lj-awb create video \
255
255
  lj-awb task wait \
256
256
  --task-id <taskId> \
257
257
  --wait-seconds 300
258
+
259
+ lj-awb task batch-status --task-id <taskId1>,<taskId2> -f json
260
+ lj-awb task batch-wait --task-id <taskId1>,<taskId2> --wait-seconds 180 -f json
258
261
  ```
259
262
 
260
263
  帧素材也可以直接使用平台资产 ID;是否可传尾帧以 `model options.resources[].usage` 是否包含 `last_frame` 为准:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingjingai/lj-awb-cli",
3
- "version": "0.5.21",
3
+ "version": "0.5.23",
4
4
  "description": "Lingjing AWB CLI monorepo with shared core, standalone CLI, and agent skills",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -25,7 +25,7 @@
25
25
  "build:pre-publish": "node build/pre-publish.mjs",
26
26
  "build:prod": "node build/prod.mjs",
27
27
  "check": "npm run check:local && npm run check:real",
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
+ "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 --check tests/test-video-auto-convert.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 tests/test-video-auto-convert.mjs",
29
29
  "check:real": "node scripts/validate-cli-output-contract.mjs && node scripts/validate-openapi-cli-examples.mjs",
30
30
  "test:openapi-real": "node scripts/run-openapi-cli-examples-real.mjs",
31
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.21",
3
+ "version": "0.5.23",
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.21"
16
+ "@lingjingai/awb-core": "0.5.23"
17
17
  }
18
18
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingjingai/awb-core",
3
- "version": "0.5.21",
3
+ "version": "0.5.23",
4
4
  "description": "Shared core runtime for Lingjing AWB CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -347,6 +347,13 @@ export async function fetchTaskInfo(taskId) {
347
347
  });
348
348
  }
349
349
 
350
+ export async function fetchTaskBatchInfo(taskIds) {
351
+ return await apiFetch('/api/material/creation/task/batch-info', {
352
+ body: { taskIds },
353
+ timeoutMs: 60_000,
354
+ });
355
+ }
356
+
350
357
  export async function fetchVideoSubtitleRemovalFee(payload = {}) {
351
358
  return await apiFetch('/api/material/creation/videoSubtitleRemovalFeeCalc', { body: payload });
352
359
  }
@@ -49,6 +49,8 @@ import {
49
49
  videoSuperResolution,
50
50
  videoSuperResolutionFee,
51
51
  taskList,
52
+ taskBatchStatus,
53
+ taskBatchWait,
52
54
  taskRecordPoll,
53
55
  taskRecords,
54
56
  taskStatus,
@@ -112,11 +114,11 @@ const MODEL_PARAMS_JSON_ARG = { name: 'model-params-json', valueName: 'json|path
112
114
  const MODEL_PARAM_ARGS = [MODEL_PARAM_ARG, MODEL_PARAMS_JSON_ARG];
113
115
  const CREATE_WAIT_ARGS = [
114
116
  { name: 'wait-seconds', valueName: 'seconds', description: '提交后顺带等待结果的秒数;默认 0 不等待' },
115
- { name: 'poll-interval-ms', valueName: 'ms', description: '任务轮询间隔毫秒数,默认 5000' },
117
+ { name: 'poll-interval-ms', valueName: 'ms', description: '任务轮询间隔毫秒数,默认 30000' },
116
118
  ];
117
119
  const TASK_WAIT_ARGS = [
118
120
  { name: 'wait-seconds', valueName: 'seconds', description: '最长等待秒数;默认 300,传 0 只查询一次' },
119
- { name: 'poll-interval-ms', valueName: 'ms', description: '任务轮询间隔毫秒数,默认 5000' },
121
+ { name: 'poll-interval-ms', valueName: 'ms', description: '任务轮询间隔毫秒数,默认 30000' },
120
122
  ];
121
123
  const RECORD_POLL_ARGS = [
122
124
  { name: 'wait-seconds', valueName: 'seconds', description: '最长轮询秒数;默认 0 只轮询一次本地台账' },
@@ -688,7 +690,7 @@ export function registerAwbCommands(cli) {
688
690
  'lj-awb create video --model-group-code <code> --prompt "首尾帧过渡" --duration 5 --resources-json \'[{"type":"image","usage":"first_frame","source":{"kind":"url","value":"./first.png"}},{"type":"image","usage":"last_frame","source":{"kind":"url","value":"./last.png"}}]\' --dry-run',
689
691
  'lj-awb create video --model-group-code <code> --prompt "让 <<<hero>>> 跟随音乐节奏转身" --resource image:reference:hero=./actor.png --resource audio:reference=./music.mp3 --duration 5 --dry-run',
690
692
  ],
691
- hint: '--prompt / --resource / --resources-json 至少传一个;fee / --dry-run 之前先确认 quality、duration、ratio 等关键参数。',
693
+ hint: '--prompt / --resource / --resources-json 至少传一个;自动加白 Seedance 的参考图在正式提交前自动检查尺寸,超限时转码上传;fee / --dry-run 之前先确认 quality、duration、ratio 等关键参数。',
692
694
  }),
693
695
  args: [
694
696
  MODEL_GROUP_ARG,
@@ -717,7 +719,7 @@ export function registerAwbCommands(cli) {
717
719
  'lj-awb create video-batch --input-file ./prompts.txt --model-group-code <code> --dry-run',
718
720
  'lj-awb create video-batch --input-file ./video-input.jsonl --model-group-code <code> --concurrency 2 --yes',
719
721
  ],
720
- hint: 'JSON/JSONL 每项只写任务差异字段:prompt、ratio、quality、duration、need_audio、resources、resource、model_params;提交后默认用 results[].taskId / statusCommand 查询本批次;需要中断恢复时可显式传 --task-record-file。',
722
+ hint: 'JSON/JSONL 每项只写任务差异字段:prompt、ratio、quality、duration、need_audio、resources、resource、model_params;自动加白 Seedance 的参考图逐项检查并在超限时转码;提交后用 results[].taskId / statusCommand 查询,需要中断恢复可传 --task-record-file。',
721
723
  }),
722
724
  args: [
723
725
  { name: 'input-file', valueName: 'path', description: '批量输入文件' },
@@ -850,7 +852,7 @@ export function registerAwbCommands(cli) {
850
852
  examples: [
851
853
  'lj-awb task status --task-id <taskId>',
852
854
  ],
853
- hint: '状态查询只依赖 taskId。',
855
+ hint: '单个任务使用本命令;多个任务使用 task batch-status。',
854
856
  }),
855
857
  args: [
856
858
  { name: 'task-id', valueName: 'id', description: '任务 ID' },
@@ -858,6 +860,18 @@ export function registerAwbCommands(cli) {
858
860
  func: async (_ctx, kwargs) => taskStatus(kwargs),
859
861
  });
860
862
 
863
+ cli({
864
+ name: 'task batch-status',
865
+ description: commandHelp('按逗号分隔的任务 ID 一次查询多个任务状态', {
866
+ examples: ['lj-awb task batch-status --task-id 任务ID_A,任务ID_B'],
867
+ hint: '只查询一次;单项未找到会在该项返回错误,不影响其他任务。',
868
+ }),
869
+ args: [
870
+ { name: 'task-id', valueName: 'id1,id2', description: '逗号分隔的任务 ID,最多 5000 个;逗号后可留空格' },
871
+ ],
872
+ func: async (_ctx, kwargs) => taskBatchStatus(kwargs),
873
+ });
874
+
861
875
  cli({
862
876
  name: 'task list',
863
877
  description: commandHelp('查询项目组近期任务流', {
@@ -874,9 +888,9 @@ export function registerAwbCommands(cli) {
874
888
 
875
889
  cli({
876
890
  name: 'task wait',
877
- description: commandHelp('等待任务进入终态', {
891
+ description: commandHelp('等待单个任务进入终态', {
878
892
  examples: ['lj-awb task wait --task-id <id> --wait-seconds 180'],
879
- hint: '超时返回 task_still_running / exit code 20,不代表远端失败。',
893
+ hint: '多个任务使用 task batch-wait;超时返回 task_still_running / exit code 20,不代表远端失败。',
880
894
  }),
881
895
  args: [
882
896
  { name: 'task-id', valueName: 'id', description: '任务 ID' },
@@ -885,6 +899,19 @@ export function registerAwbCommands(cli) {
885
899
  func: async (_ctx, kwargs) => waitTask(kwargs),
886
900
  });
887
901
 
902
+ cli({
903
+ name: 'task batch-wait',
904
+ description: commandHelp('批量等待任务进入终态', {
905
+ examples: ['lj-awb task batch-wait --task-id <id1>,<id2> --wait-seconds 180'],
906
+ hint: '每轮一次批量查询,只续查未完成任务;超时返回 task_still_running / exit code 20。',
907
+ }),
908
+ args: [
909
+ { name: 'task-id', valueName: 'id1,id2', description: '逗号分隔的任务 ID,最多 5000 个;逗号后可留空格' },
910
+ ...TASK_WAIT_ARGS,
911
+ ],
912
+ func: async (_ctx, kwargs) => taskBatchWait(kwargs),
913
+ });
914
+
888
915
  cli({
889
916
  name: 'task records',
890
917
  description: commandHelp('读取本地任务台账 JSONL', {
@@ -614,6 +614,8 @@ export function normalizeOutputData(commandName, data) {
614
614
  case 'task list':
615
615
  return normalizeList(data, ['tasks']);
616
616
  case 'task records':
617
+ case 'task batch-status':
618
+ case 'task batch-wait':
617
619
  return normalizeList(data, ['records']);
618
620
  case 'create asset-groups':
619
621
  return normalizeList(data, ['groups']);
@@ -1353,6 +1355,8 @@ const OUTPUT_KIND_BY_COMMAND = {
1353
1355
  'create video-super-resolution': 'task_submission',
1354
1356
  'create video-subtitle-removal': 'subtitle_task_submission',
1355
1357
  'task status': 'task_status',
1358
+ 'task batch-status': 'batch_task_status',
1359
+ 'task batch-wait': 'batch_task_status',
1356
1360
  'task list': 'task_list',
1357
1361
  'task wait': 'task_status',
1358
1362
  'task records': 'local_task_records',
@@ -56,12 +56,15 @@ const REMOTE_IMAGE_DOWNLOAD_MAX_BYTES = 100 * 1024 * 1024;
56
56
  const REMOTE_IMAGE_MIME_TYPES = new Set([
57
57
  'image/bmp',
58
58
  'image/gif',
59
+ 'image/heic',
60
+ 'image/heif',
59
61
  'image/jpeg',
60
62
  'image/jpg',
61
63
  'image/png',
64
+ 'image/tiff',
62
65
  'image/webp',
63
66
  ]);
64
- const REMOTE_IMAGE_EXTENSIONS = new Set(['.bmp', '.gif', '.jfif', '.jpg', '.jpeg', '.png', '.webp']);
67
+ const REMOTE_IMAGE_EXTENSIONS = new Set(['.bmp', '.gif', '.heic', '.heif', '.jfif', '.jpg', '.jpeg', '.png', '.tif', '.tiff', '.webp']);
65
68
  const REMOTE_VOICE_DOWNLOAD_TIMEOUT_MS = 30_000;
66
69
  const REMOTE_VOICE_DOWNLOAD_MAX_BYTES = 100 * 1024 * 1024;
67
70
  const REMOTE_VOICE_MIME_TYPES = new Set([
@@ -4014,8 +4017,11 @@ async function confirmAssetConversion(validation) {
4014
4017
  }
4015
4018
  }
4016
4019
 
4017
- async function convertAssetLocalFile(validation) {
4018
- const plan = validation.conversionPlan;
4020
+ async function convertAssetLocalFile(validation, options = {}) {
4021
+ const plan = validation.conversionPlan && {
4022
+ ...validation.conversionPlan,
4023
+ toFormat: options.toFormat ?? validation.conversionPlan.toFormat,
4024
+ };
4019
4025
  if (!plan) throw assetConversionUnavailableError(validation);
4020
4026
  let converted;
4021
4027
  if (validation.assetType === ASSET_TYPE_CODES.Image) {
@@ -4225,8 +4231,11 @@ function extensionFromContentType(contentType = '') {
4225
4231
  const normalized = String(contentType || '').split(';')[0].trim().toLowerCase();
4226
4232
  if (normalized === 'image/bmp') return '.bmp';
4227
4233
  if (normalized === 'image/gif') return '.gif';
4234
+ if (normalized === 'image/heic') return '.heic';
4235
+ if (normalized === 'image/heif') return '.heif';
4228
4236
  if (normalized === 'image/jpeg' || normalized === 'image/jpg') return '.jpg';
4229
4237
  if (normalized === 'image/png') return '.png';
4238
+ if (normalized === 'image/tiff') return '.tiff';
4230
4239
  if (normalized === 'image/webp') return '.webp';
4231
4240
  if (normalized === 'audio/mpeg') return '.mp3';
4232
4241
  if (normalized === 'audio/wav' || normalized === 'audio/x-wav') return '.wav';
@@ -4797,6 +4806,59 @@ function conversionOutputExtension(format) {
4797
4806
  return normalized || 'jpg';
4798
4807
  }
4799
4808
 
4809
+ async function resolveAutoAssetVideoImage(resource, base, options) {
4810
+ if (!options.autoConvertAssetImages || resource.type !== 'image') return null;
4811
+ const value = resource._source.value;
4812
+ const remote = isRemoteOrBackendPath(value);
4813
+ // Dry-run does not download remote material; the formal submission checks it before creating a task.
4814
+ if (remote && options.dryRun) return null;
4815
+ const downloaded = remote
4816
+ ? await downloadRemoteImageFileToTemp(value, {
4817
+ fallbackName: resourceText(base).replace(/[^0-9A-Za-z._-]+/g, '-'),
4818
+ })
4819
+ : null;
4820
+ try {
4821
+ const original = await inspectAssetLocalFile(downloaded?.filePath ?? value);
4822
+ if (original.legal) return null;
4823
+ if (!original.conversionPlan) throw assetConversionUnavailableError(original);
4824
+ const source = { kind: 'url', value };
4825
+ const rule = options.resourceRules?.find((item) => resourceRuleMatches(item, { ...base, source }));
4826
+ const toFormat = rule && !fileTypeAllowedByRule(rule, 'jpg')
4827
+ ? preferredImageConversionTarget(rule.fileTypes)
4828
+ : 'jpg';
4829
+ const plan = { ...original.conversionPlan, toFormat };
4830
+ const conversion = compactRecord({
4831
+ resource: resourceText(base),
4832
+ ...plan,
4833
+ ...(remote ? { sourceValue: displayResourceSourceValue(value) } : { sourceFile: original.localFile.filePath }),
4834
+ dryRun: options.dryRun || undefined,
4835
+ });
4836
+ const convertedName = forceFileExtension(remoteImageFileNameFromValue(value), extensionForImageFormat(toFormat));
4837
+ if (options.dryRun) {
4838
+ return {
4839
+ resource: { ...base, source: { kind: 'url', value: dryRunBackendPath(convertedName, options.sceneType) } },
4840
+ upload: null,
4841
+ localFile: original.localFile,
4842
+ conversion,
4843
+ };
4844
+ }
4845
+ const converted = await convertAssetLocalFile(original, { toFormat });
4846
+ try {
4847
+ const upload = await uploadLocalFile(converted.localFile.filePath, { sceneType: options.sceneType });
4848
+ return {
4849
+ resource: { ...base, source: { kind: 'url', value: upload.backendPath } },
4850
+ upload,
4851
+ localFile: remote ? null : original.localFile,
4852
+ conversion: { ...conversion, convertedSize: converted.localFile.size },
4853
+ };
4854
+ } finally {
4855
+ await fs.rm(converted.localFile.filePath, { force: true }).catch(() => {});
4856
+ }
4857
+ } finally {
4858
+ if (downloaded) await fs.rm(downloaded.dir, { recursive: true, force: true }).catch(() => {});
4859
+ }
4860
+ }
4861
+
4800
4862
  async function resolveResourceFileValue(resource, options = {}) {
4801
4863
  if (resource.type === 'subject') {
4802
4864
  if (resource._source.kind !== 'asset_id') throw argumentError('subject resource 必须使用 asset_id,例如 subject:reference:hero=asset:element_123');
@@ -4822,6 +4884,8 @@ async function resolveResourceFileValue(resource, options = {}) {
4822
4884
  if (resource._source.kind === 'asset_id') {
4823
4885
  return { resource: { ...base, source: resource._source }, upload: null, localFile: null };
4824
4886
  }
4887
+ const preparedImage = await resolveAutoAssetVideoImage(resource, base, options);
4888
+ if (preparedImage) return preparedImage;
4825
4889
  const value = resource._source.value;
4826
4890
  if (isRemoteOrBackendPath(value)) {
4827
4891
  const source = { kind: 'url', value };
@@ -5176,6 +5240,11 @@ function isAutoAssetSeedanceModel(code) {
5176
5240
  return /^Auto_(JiMeng|BytePlus)_Seedance_(2|2_Fast|2_Mini|2_5)_VideoCreate_Group$/.test(code || '');
5177
5241
  }
5178
5242
 
5243
+ function needsAutoAssetVideoImageConversion(code) {
5244
+ return isAutoAssetSeedanceModel(code)
5245
+ || LEGACY_ASSET_REVIEW_MODELS.some((model) => model.modelGroupCode === code);
5246
+ }
5247
+
5179
5248
  async function buildVideoRequest(kwargs = {}, options = {}) {
5180
5249
  const dryRun = Boolean(options.dryRun);
5181
5250
  const model = resolveTaskModel('video', kwargs);
@@ -5217,6 +5286,8 @@ async function buildVideoRequest(kwargs = {}, options = {}) {
5217
5286
  kind: 'video',
5218
5287
  sceneType: TASK_UPLOAD_SCENE.VIDEO_CREATE,
5219
5288
  resourceRules: validation.resourceRules,
5289
+ autoConvertAssetImages: options.autoConvertAssetImages === true
5290
+ && needsAutoAssetVideoImageConversion(model.modelGroupCode),
5220
5291
  });
5221
5292
  const requestPromptParams = normalizeUnifiedPromptParams({ ...defaultParams, resources: resolvedResources.resources });
5222
5293
  const projectGroupNo = await resolveProjectGroupNo(kwargs.projectGroupNo, { allowNull: dryRun, noNetwork: dryRun, noSave: dryRun });
@@ -5255,7 +5326,7 @@ export async function videoFee(kwargs = {}) {
5255
5326
 
5256
5327
  export async function videoCreate(kwargs = {}) {
5257
5328
  if (toBool(kwargs.dryRun)) {
5258
- const built = await buildVideoRequest(kwargs, { dryRun: true });
5329
+ const built = await buildVideoRequest(kwargs, { dryRun: true, autoConvertAssetImages: true });
5259
5330
  return compactRecord({
5260
5331
  dryRun: true,
5261
5332
  action: 'create video',
@@ -5265,7 +5336,7 @@ export async function videoCreate(kwargs = {}) {
5265
5336
  });
5266
5337
  }
5267
5338
  ensureConfirmed(kwargs, '正式生视频会消耗积分,需要确认', { action: 'create video' });
5268
- const built = await buildVideoRequest(kwargs);
5339
+ const built = await buildVideoRequest(kwargs, { autoConvertAssetImages: true });
5269
5340
  const feePayload = await awbApi.fetchVideoFee(built.request).catch(() => null);
5270
5341
  const estimate = await pointEstimate(feePayload, built.projectGroupNo).catch(() => ({}));
5271
5342
  const payload = await awbApi.createVideoTask(built.request);
@@ -5754,12 +5825,39 @@ export function normalizeTaskPayload(payload, taskType = null, extra = {}) {
5754
5825
 
5755
5826
  export async function taskStatus(kwargs = {}) {
5756
5827
  const taskId = requireValue(kwargs, 'taskId', 'task-id');
5828
+ if (parseListArg(taskId).length > 1) {
5829
+ throw argumentError('查询多个任务请使用 task batch-status');
5830
+ }
5757
5831
  const payload = await awbApi.fetchTaskInfo(taskId);
5758
5832
  return normalizeTaskPayload(payload, null, {
5759
5833
  taskId,
5760
5834
  });
5761
5835
  }
5762
5836
 
5837
+ /** 一次查询多项任务;查询失败项与任务自身失败状态分别呈现。 */
5838
+ export async function taskBatchStatus(kwargs = {}) {
5839
+ const taskIds = uniqueNonEmpty(parseListArg(kwargs.taskId));
5840
+ if (!taskIds.length || taskIds.length > 5000) {
5841
+ throw argumentError('请通过 --task-id 传入 1 到 5000 个逗号分隔的任务 ID');
5842
+ }
5843
+ const payload = await awbApi.fetchTaskBatchInfo(taskIds);
5844
+ if (!Array.isArray(payload)) {
5845
+ throw new LingjingAwbCliError('批量任务查询接口返回格式不正确', {
5846
+ type: 'invalid_response',
5847
+ exitCode: 30,
5848
+ });
5849
+ }
5850
+ const records = payload.map((item) => item?.task
5851
+ ? normalizeTaskPayload(item.task, null, { taskId: item.taskId })
5852
+ : compactRecord({
5853
+ taskId: item?.taskId,
5854
+ status: item?.errorCode || 'QUERY_ERROR',
5855
+ errorCode: item?.errorCode,
5856
+ errorMessage: item?.errorMessage,
5857
+ }));
5858
+ return { count: records.length, records };
5859
+ }
5860
+
5763
5861
  export async function taskList(kwargs = {}) {
5764
5862
  const taskType = normalizeFeedTaskType(kwargs.taskType ?? 'IMAGE_CREATE');
5765
5863
  const projectGroupNo = await resolveProjectGroupNo(kwargs.projectGroupNo);
@@ -5784,8 +5882,11 @@ export async function taskList(kwargs = {}) {
5784
5882
 
5785
5883
  export async function waitTask(kwargs = {}) {
5786
5884
  const taskId = requireValue(kwargs, 'taskId', 'task-id');
5885
+ if (parseListArg(taskId).length > 1) {
5886
+ throw argumentError('等待多个任务请使用 task batch-wait');
5887
+ }
5787
5888
  const waitSeconds = Math.max(0, toInt(kwargs.waitSeconds, 300));
5788
- const pollIntervalMs = Math.max(500, toInt(kwargs.pollIntervalMs, 5000));
5889
+ const pollIntervalMs = Math.max(500, toInt(kwargs.pollIntervalMs, 30_000));
5789
5890
  const deadline = Date.now() + waitSeconds * 1000;
5790
5891
  let last = null;
5791
5892
  while (true) {
@@ -5808,6 +5909,43 @@ export async function waitTask(kwargs = {}) {
5808
5909
  });
5809
5910
  }
5810
5911
 
5912
+ /** 批量等待只续查未完成项;单项查询错误保留在结果中。 */
5913
+ export async function taskBatchWait(kwargs = {}) {
5914
+ const taskIds = uniqueNonEmpty(parseListArg(kwargs.taskId));
5915
+ if (!taskIds.length || taskIds.length > 5000) {
5916
+ throw argumentError('请通过 --task-id 传入 1 到 5000 个逗号分隔的任务 ID');
5917
+ }
5918
+ const waitSeconds = Math.max(0, toInt(kwargs.waitSeconds, 300));
5919
+ const pollIntervalMs = Math.max(500, toInt(kwargs.pollIntervalMs, 30_000));
5920
+ const deadline = Date.now() + waitSeconds * 1000;
5921
+ const taskIdSet = new Set(taskIds);
5922
+ const latest = new Map();
5923
+ let pendingTaskIds = taskIds;
5924
+ while (true) {
5925
+ const batch = await taskBatchStatus({ taskId: pendingTaskIds.join(',') });
5926
+ for (const record of batch.records) {
5927
+ if (taskIdSet.has(record?.taskId)) latest.set(record.taskId, record);
5928
+ }
5929
+ pendingTaskIds = taskIds.filter((id) => {
5930
+ const record = latest.get(id);
5931
+ return !record?.isTerminal && !record?.errorCode;
5932
+ });
5933
+ const last = { count: taskIds.length, records: taskIds.map((id) => latest.get(id) ?? { taskId: id }) };
5934
+ if (!pendingTaskIds.length) {
5935
+ return { ...last, timedOut: false, waitedMs: waitSeconds * 1000 - Math.max(0, deadline - Date.now()) };
5936
+ }
5937
+ if (Date.now() >= deadline || waitSeconds === 0) {
5938
+ throw new LingjingAwbCliError('部分任务仍在运行,当前等待窗口已结束', {
5939
+ type: 'task_still_running',
5940
+ exitCode: 20,
5941
+ hint: '稍后再次运行 task batch-wait,或增大 --wait-seconds。',
5942
+ details: { taskIds, pendingTaskIds, waitSeconds, last },
5943
+ });
5944
+ }
5945
+ await sleep(Math.min(pollIntervalMs, Math.max(0, deadline - Date.now())));
5946
+ }
5947
+ }
5948
+
5811
5949
  export async function taskRecords(kwargs = {}) {
5812
5950
  const filePath = resolveTaskRecordFile(kwargs);
5813
5951
  if (!filePath) throw argumentError('缺少任务台账文件', '传 --task-record-file <path>,或设置 LINGJING_AWB_TASK_RECORD_FILE。');
@@ -326,6 +326,19 @@ function parseArgv(argv) {
326
326
  return { commandName: commandParts.join(' '), kwargs, kwargRawFlags, format };
327
327
  }
328
328
 
329
+ function normalizeTaskIdListArgv(argv) {
330
+ if (argv[0] !== 'task' || !['batch-status', 'batch-wait'].includes(argv[1])) return argv;
331
+ const tokens = [...argv];
332
+ const taskIdIndex = tokens.indexOf('--task-id');
333
+ if (taskIdIndex < 0 || !tokens[taskIdIndex + 1]) return tokens;
334
+ while (tokens[taskIdIndex + 1].trimEnd().endsWith(',')
335
+ && tokens[taskIdIndex + 2] && !tokens[taskIdIndex + 2].startsWith('-')) {
336
+ tokens[taskIdIndex + 1] += tokens[taskIdIndex + 2];
337
+ tokens.splice(taskIdIndex + 2, 1);
338
+ }
339
+ return tokens;
340
+ }
341
+
329
342
  async function readVersion() {
330
343
  const currentDir = path.dirname(fileURLToPath(import.meta.url));
331
344
  const packagePath = path.join(currentDir, '..', 'package.json');
@@ -567,7 +580,9 @@ const COMMAND_REQUIRED_OPTIONS = {
567
580
  'create video-super-resolution-fee': ['objectName', 'targetResolution'],
568
581
  'create video-super-resolution': ['objectName', 'targetResolution'],
569
582
  'task status': ['taskId'],
583
+ 'task batch-status': ['taskId'],
570
584
  'task wait': ['taskId'],
585
+ 'task batch-wait': ['taskId'],
571
586
  'create asset-match-actor': ['description'],
572
587
  'create asset-groups': ['platform'],
573
588
  'create asset-group-get': ['groupId', 'platform'],
@@ -662,7 +677,7 @@ const LOCAL_STATE_WRITE_COMMANDS = new Set([
662
677
  ]);
663
678
 
664
679
  const DESTRUCTIVE_COMMANDS = new Set(['auth clear']);
665
- const LONG_RUNNING_COMMANDS = new Set(['auth login', 'credits redeem', 'task wait', 'task record-poll', 'create subject-wait', 'create subject-voice-wait']);
680
+ const LONG_RUNNING_COMMANDS = new Set(['auth login', 'credits redeem', 'task wait', 'task batch-wait', 'task record-poll', 'create subject-wait', 'create subject-voice-wait']);
666
681
  const NETWORK_NONE_COMMANDS = new Set(['schema', 'auth status', 'auth clear', 'auth logout', 'credits recharge', 'model input-guide', 'task records']);
667
682
  const NETWORK_CONDITIONAL_COMMANDS = new Set(['doctor', 'auth login']);
668
683
 
@@ -705,6 +720,8 @@ const OUTPUT_KIND_BY_COMMAND = {
705
720
  'create video-super-resolution': 'task_submission',
706
721
  'create video-subtitle-removal': 'subtitle_task_submission',
707
722
  'task status': 'task_status',
723
+ 'task batch-status': 'batch_task_status',
724
+ 'task batch-wait': 'batch_task_status',
708
725
  'task list': 'task_list',
709
726
  'task wait': 'task_status',
710
727
  'task records': 'local_task_records',
@@ -999,7 +1016,7 @@ function buildAgentBrief(commands, version = 'unknown') {
999
1016
  },
1000
1017
  {
1001
1018
  intent: '异步任务和批量恢复',
1002
- start: ['task wait', 'task record-poll', 'task records'],
1019
+ start: ['task wait', 'task batch-wait', 'task record-poll', 'task records'],
1003
1020
  rule: '优先复用 create 返回的 nextCommand;批量创建默认用 results[].taskId / statusCommand 查本批次,只有显式传 task-record-file 时才用 record-poll,失败项单独重试。',
1004
1021
  },
1005
1022
  ],
@@ -1484,6 +1501,7 @@ function printError(error, format, meta = {}) {
1484
1501
  }
1485
1502
 
1486
1503
  export async function runStandaloneCli(argv = process.argv.slice(2)) {
1504
+ argv = normalizeTaskIdListArgv(argv);
1487
1505
  process.env.LINGJING_AWB_COMMAND_PREFIX ??= 'lj-awb';
1488
1506
  const commands = buildRegistry();
1489
1507
  const version = await readVersion().catch(() => 'unknown');
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: lj-awb
3
- version: 0.5.21
3
+ version: 0.5.23
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.21"
8
+ version: "0.5.23"
9
9
  bin: "lj-awb"
10
10
  cliHelp: "lj-awb --help"
11
11
  ---
@@ -1 +1 @@
1
- 0.5.21
1
+ 0.5.23
@@ -1,6 +1,6 @@
1
1
  {
2
- "skillVersion": "0.5.21",
3
- "minCliVersion": "0.5.21",
2
+ "skillVersion": "0.5.23",
3
+ "minCliVersion": "0.5.23",
4
4
  "preferredCommand": "lj-awb",
5
- "updatedAt": "2026-10-20"
5
+ "updatedAt": "2026-10-28"
6
6
  }
@@ -38,6 +38,7 @@
38
38
  - 音频创建必须传 `prompt` 和 `duration`;默认 `audio-format=mp3`,最多 3 个参考音频或 1 张参考图,两类不能混用。
39
39
  - 状态和等待仍在查询域:`task status` / `task wait` 按 `taskId` 查询统一任务状态;主体 / 音色使用 `create subject-wait` / `create subject-voice-wait`。
40
40
  - 所有 `create` 写入或扣费命令正式执行前必须先 `--dry-run`,用户确认后再 `--yes`。
41
+ - `create video` 和 `create video-batch` 使用自动加白 Seedance 模型时,正式提交前会检查本地文件和远程 URL / 平台路径中的图片;超出加白规格会在 CLI 本机转码并上传处理后的图片。`--dry-run` 会展示本地图片的转换计划,不下载远程图片;远程图片在正式提交时检查。
41
42
  - 查询型 create 子命令(`subject-list`、`subject-voice-list`、`asset-groups`、`asset-group-get`、`asset-match-actor`)是为了避免重复创建;创建前优先查重。
42
43
  - `asset-groups` / `asset-group-get` / `asset-group` / `asset-group-update` / `asset` 都必须显式传 `--platform`;平台先由 `model asset-review-models` 或用户选择确定。
43
44
 
@@ -7,8 +7,10 @@
7
7
  | 命令 | 用途 |
8
8
  |------|------|
9
9
  | `lj-awb task list --task-type IMAGE_CREATE --project-group-no <no>` | 列出远端任务(按类型过滤) |
10
- | `lj-awb task status --task-id <id>` | 按 taskId 查询单个任务状态(生图 / 生视频 / 去字幕 / 超分统一返回结构) |
10
+ | `lj-awb task status --task-id <id>` | 查询单个任务状态 |
11
+ | `lj-awb task batch-status --task-id <id1,id2>` | 一次查询多个任务 ID 的状态;只查询一次,不等待 |
11
12
  | `lj-awb task wait --task-id <id> --wait-seconds 180` | 等待单个任务进入终态 |
13
+ | `lj-awb task batch-wait --task-id <id1,id2> --wait-seconds 180` | 批量等待任务进入终态;每轮只查询未完成项 |
12
14
  | `lj-awb task records --task-record-file .awb/tasks.jsonl` | 读本地任务台账 |
13
15
  | `lj-awb task records --pending-only --task-record-file .awb/tasks.jsonl` | 只看未终态记录 |
14
16
  | `lj-awb task record-poll --task-record-file .awb/tasks.jsonl --wait-seconds 180` | 一次性轮询台账里所有未终态任务 |
@@ -26,12 +28,22 @@ lj-awb task wait --task-id <id> --wait-seconds 180
26
28
 
27
29
  ### 批量查询
28
30
 
29
- `create image-batch` / `create video-batch` 返回每个子任务的 `taskId` / `statusCommand`。批量提交后优先直接用响应里的 `statusCommand` 逐条查询:
31
+ `create image-batch` / `create video-batch` 返回每个子任务的 `taskId` / `statusCommand`。收集本次的任务 ID 后可一次查询:
30
32
 
31
33
  ```bash
32
- lj-awb task status --task-id <taskId>
34
+ lj-awb task batch-status --task-id <taskId1>,<taskId2> -f json
33
35
  ```
34
36
 
37
+ 多个 ID 用逗号分隔,最多 5000 个;逗号后可以有空格。返回的每项包含任务状态或 `TASK_NOT_FOUND` 查询错误;命令不自动轮询,需要时由调用方再次执行。服务端与单任务查询共用缓存:运行中 10 秒、已结束 60 秒。
38
+
39
+ 需要等待整批任务时使用:
40
+
41
+ ```bash
42
+ lj-awb task batch-wait --task-id <taskId1>,<taskId2> --wait-seconds 180 -f json
43
+ ```
44
+
45
+ `batch-wait` 每轮调用一次批量接口,只续查未完成的任务;`wait` 和 `batch-wait` 默认均每 30 秒一轮,可用 `--poll-interval-ms` 覆盖。批量等待窗口结束时返回 `task_still_running`(exit 20),错误详情中的 `pendingTaskIds` 列出未完成的任务,`last.records` 保留本轮已知结果。
46
+
35
47
  `--task-record-file` / `task record-poll` 只作为高级恢复能力使用:如果调用方明确传了台账文件,且 batch 响应包含 `taskRecordFile` / `nextCommand`,才用台账续等;普通批量结果不要为了查询本批次去创建额外文件。
36
48
 
37
49
  ### 历史查询
@@ -70,7 +82,7 @@ CLI 当前**不暴露 task cancel**;用户问"能不能停掉这个任务"时
70
82
  - 输出字段只提取 `taskId / taskStatus / isTerminal / resultUrls / errorMessage`,详见 [`../references/output-fields.md`](../references/output-fields.md) 的"生图 / 生视频"和"任务台账"小节。
71
83
  - **交付链接必须逐条、完整、原样**:`resultUrls` / `originUrls` 里的每条 URL 都已带可访问凭证(腾讯云 COS 的 `?sign=...`、火山 TOS 的 `?X-Tos-*`)。给用户时把**整条**贴出去,**绝不能只贴 `.mp4` / `.png` 前的基础部分而吞掉 `?` 后面的签名查询串**——截掉签名 = 用户打不开(曾因此踩坑)。同理不要 URL 编码改写、不要换行截断、不要"省略号略过"。`resultUrls[0]` 是带签名的展示链接(CLI 已把 `resultFileDisplayList` 排在最前),必报;`originUrls` 是同一文件的另一存储源,作兜底一并附上。
72
84
  - `create video-subtitle-removal` / `create video-super-resolution` 返回 `nextCommand` 时直接执行该命令;不要把它改写成通用 `task wait`。
73
- - `task status` / `task wait` 只依赖 `taskId` 查询状态。
85
+ - `task status` / `task wait` 使用单个 ID;`task batch-status` / `task batch-wait` 使用逗号分隔的 ID。
74
86
  - 不要把大型 raw JSON 整段塞回上下文。
75
87
  - `task list` 是远端查询、`task records` 是本地台账;两者覆盖范围不同(台账只有本机创建的任务)。批量结果优先用本次返回的 taskId,不要用 `task list` 找本批次。
76
88
 
@@ -75,7 +75,7 @@
75
75
  |------------|------|-----------|--------------|--------|
76
76
  | `task_list` | `task list` | `count` + 简明摘要 | 每条 `taskId/taskType/taskStatus`(用于决定 wait 哪几条) | gmtCreate |
77
77
  | `local_task_records` | `task records` | 待终态条数 | 每条 `taskId/taskType`(用于补 wait) | — |
78
- | `batch_task_status` | `task record-poll` | 终态计数、失败原因汇总 | 失败列表(用于 retry) | 完整 records |
78
+ | `batch_task_status` | `task batch-status` / `task batch-wait` / `task record-poll` | `records[]` 中每项任务状态或查询错误 | `batch-wait` 超时错误的 `pendingTaskIds` | 完整 records |
79
79
 
80
80
  ## 主体
81
81