@lingjingai/lj-awb-cli 0.3.13 → 0.3.15

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.
@@ -1,4 +1,5 @@
1
1
  import { fetchProjectGroupUsers, fetchTeams, fetchUserInfo } from './api.js';
2
+ import * as artifact from './artifact.js';
2
3
  import { clearAuth, loadAuth, saveAccessKey, summarizeAuth } from './auth.js';
3
4
  import { LingjingAwbCliError, maskSecret, toBool, trimSecret } from './common.js';
4
5
  import {
@@ -22,6 +23,7 @@ import {
22
23
  listModels,
23
24
  modelOptions,
24
25
  modelCreateSpec,
26
+ modelInputGuide,
25
27
  listProjectGroups,
26
28
  normalizeRows,
27
29
  normalizeUserInfo,
@@ -65,6 +67,7 @@ const YES_ARG = { name: 'yes', description: '确认执行写入 / 扣费 / 切
65
67
  const DRY_RUN_ARG = { name: 'dry-run', description: '只预览请求,不执行写入 / 扣费动作' };
66
68
  const FEE_DRY_RUN_ARG = { name: 'dry-run', description: '只预览估价请求,不调用平台接口' };
67
69
  const INCLUDE_RAW_ARG = { name: 'include-raw', description: '在 JSON 中附带平台原始返回' };
70
+ const PROJECT_ID_ARG = { name: 'project-id', valueName: 'id', description: 'Workbench 项目 ID;E2B 沙箱内通常读取 SANDBOX_PROJECT_ID 后传入' };
68
71
  const PROJECT_GROUP_ARG = { name: 'project-group-no', valueName: 'no', description: '项目组编号;不传时读取当前项目组 / 环境变量 / 本地状态' };
69
72
  const CUSTOM_BIZ_ARG = { name: 'custom-biz-id', valueName: 'id', description: '外部追踪 ID;不传则请求不携带 customBizId' };
70
73
  const MODEL_GROUP_ARG = { name: 'model-group-code', valueName: 'code', description: '模型组编码;创建和参数查询只传这个字段' };
@@ -93,6 +96,11 @@ const SUBJECT_WAIT_ARGS = [
93
96
  { name: 'wait-seconds', valueName: 'seconds', description: '最长等待 externalId 的秒数;默认 0 只查询一次' },
94
97
  { name: 'poll-interval-ms', valueName: 'ms', description: '轮询间隔毫秒数,默认 2000' },
95
98
  ];
99
+ const BODY_INPUT_ARGS = [
100
+ { name: 'body-json', valueName: 'json', description: '直接传接口 body JSON' },
101
+ { name: 'input-file', valueName: 'path', description: '从本地 JSON 文件读取接口 body' },
102
+ ];
103
+ const ARTIFACT_WRITE_ARGS = [DRY_RUN_ARG, YES_ARG];
96
104
 
97
105
  export function registerAwbCommands(cli) {
98
106
  cli({
@@ -116,12 +124,35 @@ export function registerAwbCommands(cli) {
116
124
  name: 'auth status',
117
125
  description: commandHelp('查看本地 access key 是否已配置;不联网', {
118
126
  examples: ['lj-awb auth status'],
119
- hint: '需要确认 access key 远端有效时运行 account info;需要完整环境体检时运行 doctor --verify。',
127
+ hint: '只说明本地是否配置,不代表远端可用;需要联网验证运行 auth verify 或 doctor --verify。',
120
128
  }),
121
129
  args: [],
122
130
  func: async () => {
123
131
  const auth = await loadAuth();
124
- return summarizeAuth(auth);
132
+ return {
133
+ ...summarizeAuth(auth),
134
+ verification: 'local_only',
135
+ verifyCommand: 'lj-awb auth verify',
136
+ };
137
+ },
138
+ });
139
+
140
+ cli({
141
+ name: 'auth verify',
142
+ description: commandHelp('联网校验 access key 是否远端有效', {
143
+ examples: ['lj-awb auth verify'],
144
+ hint: '会调用 userInfo;失败表示当前 access key 缺失、无效、过期或不适用于当前 API 地址。',
145
+ }),
146
+ args: [],
147
+ func: async () => {
148
+ const auth = await loadAuth();
149
+ const user = normalizeUserInfo(await fetchUserInfo());
150
+ return {
151
+ ...summarizeAuth(auth),
152
+ verified: true,
153
+ verification: 'remote',
154
+ user,
155
+ };
125
156
  },
126
157
  });
127
158
 
@@ -234,7 +265,7 @@ export function registerAwbCommands(cli) {
234
265
 
235
266
  cli({
236
267
  name: 'project current',
237
- description: commandHelp('查看云端当前项目组和项目组积分', {
268
+ description: commandHelp('查看云端当前项目组和项目组预算', {
238
269
  examples: ['lj-awb project current'],
239
270
  }),
240
271
  args: [PROJECT_GROUP_ARG],
@@ -321,7 +352,7 @@ export function registerAwbCommands(cli) {
321
352
 
322
353
  cli({
323
354
  name: 'credits balance',
324
- description: commandHelp('查看团队积分和项目组积分', {
355
+ description: commandHelp('查看可扣积分余额和项目组预算', {
325
356
  examples: ['lj-awb credits balance', 'lj-awb credits balance --project-group-no <no>'],
326
357
  }),
327
358
  args: [PROJECT_GROUP_ARG],
@@ -369,12 +400,12 @@ export function registerAwbCommands(cli) {
369
400
 
370
401
  cli({
371
402
  name: 'model options',
372
- description: commandHelp('查询指定模型支持的 CLI 参数、枚举值和素材约束', {
403
+ description: commandHelp('查询指定模型支持的 CLI 参数、枚举值、素材约束和条件约束', {
373
404
  examples: [
374
405
  'lj-awb model options --model-group-code <code>',
375
406
  'lj-awb model options --model-group-code <code> --selected-configs-json \'{"quality":"720"}\'',
376
407
  ],
377
- hint: '用 options 判断 values、fileTypes、maxFiles、duration 等约束;如何组装 create 命令看 model create-spec。',
408
+ hint: '用 options 判断 values、fileTypes、maxFiles、duration、constraints 等约束;如何组装 create 命令看 model create-spec。',
378
409
  }),
379
410
  args: [
380
411
  MODEL_GROUP_ARG,
@@ -386,11 +417,11 @@ export function registerAwbCommands(cli) {
386
417
 
387
418
  cli({
388
419
  name: 'model create-spec',
389
- description: commandHelp('查看指定模型如何创建任务:输入模式、prompt/key 规则、示例和前置步骤', {
420
+ description: commandHelp('查看指定模型如何创建任务:输入模式、素材绑定规则、示例和前置步骤', {
390
421
  examples: [
391
422
  'lj-awb model create-spec --model-group-code <code>',
392
423
  ],
393
- hint: '创建前先用 model options 查参数值和素材限制,再按 create-spec 的 supportedIntents 和 examples 组装 image create / video create。',
424
+ hint: '创建前先用 model input-guide 理解统一参数,再用 model options 查具体枚举和素材限制,最后按 create-spec 组装 image create / video create。',
394
425
  }),
395
426
  args: [
396
427
  MODEL_GROUP_ARG,
@@ -399,6 +430,18 @@ export function registerAwbCommands(cli) {
399
430
  func: async (_ctx, kwargs) => modelCreateSpec(kwargs),
400
431
  });
401
432
 
433
+ cli({
434
+ name: 'model input-guide',
435
+ description: commandHelp('查看统一创建参数和 resources 素材绑定的通用说明', {
436
+ examples: [
437
+ 'lj-awb model input-guide',
438
+ ],
439
+ hint: '这是跨模型的统一参数说明;具体枚举值、文件类型、数量和条件约束仍以 model options 为准。',
440
+ }),
441
+ args: [],
442
+ func: async () => modelInputGuide(),
443
+ });
444
+
402
445
  cli({
403
446
  name: 'upload files',
404
447
  description: commandHelp('上传本地图片 / 视频 / 音频到平台 COS,并返回 backendPath / URL', {
@@ -506,7 +549,7 @@ export function registerAwbCommands(cli) {
506
549
  { name: 'ratio', valueName: 'ratio', description: '视频比例' },
507
550
  { name: 'quality', valueName: 'quality', description: '清晰度,如 720' },
508
551
  { name: 'duration', valueName: 'seconds', description: '生成时长秒数' },
509
- { name: 'need-audio', valueName: 'bool', description: '输出音频/音效布尔开关;不是上传音频入口,音频素材用 --resource audio:reference=...' },
552
+ { name: 'need-audio', valueName: 'bool', description: '是否需要输出音效;不是上传音频入口,音频素材用 --resource audio:reference=...' },
510
553
  RESOURCE_ARG,
511
554
  RESOURCES_JSON_ARG,
512
555
  FEE_DRY_RUN_ARG,
@@ -532,7 +575,7 @@ export function registerAwbCommands(cli) {
532
575
  { name: 'ratio', valueName: 'ratio', description: '视频比例' },
533
576
  { name: 'quality', valueName: 'quality', description: '清晰度' },
534
577
  { name: 'duration', valueName: 'seconds', description: '生成时长秒数' },
535
- { name: 'need-audio', valueName: 'bool', description: '输出音频/音效布尔开关;不是上传音频入口,音频素材用 --resource audio:reference=...' },
578
+ { name: 'need-audio', valueName: 'bool', description: '是否需要输出音效;不是上传音频入口,音频素材用 --resource audio:reference=...' },
536
579
  RESOURCE_ARG,
537
580
  RESOURCES_JSON_ARG,
538
581
  TASK_RECORD_ARG,
@@ -743,6 +786,386 @@ export function registerAwbCommands(cli) {
743
786
  func: async (_ctx, kwargs) => assetRegister(kwargs),
744
787
  });
745
788
 
789
+ const ARTIFACT_ROW_KIND_ARG = { name: 'row-kind', valueName: 'kind', description: 'document/asset/state/speaker/episode/scene/action' };
790
+ const ARTIFACT_ENTITY_KEY_ARG = { name: 'entity-key', valueName: 'key', description: '业务唯一键;可包含 / 和 #' };
791
+ const ARTIFACT_EPISODE_ARG = { name: 'episode-id', valueName: 'id', description: '集 ID,例如 ep_001' };
792
+ const ARTIFACT_SCENE_ARG = { name: 'scene-id', valueName: 'id', description: '场 ID,例如 scn_001' };
793
+ const ARTIFACT_CLIP_ARG = { name: 'clip-id', valueName: 'id', description: 'clip ID,例如 clip_001' };
794
+ const ARTIFACT_INCLUDE_STATES_ARG = { name: 'include-states', valueName: 'bool', description: '是否带 states,默认 true' };
795
+
796
+ for (const spec of [
797
+ {
798
+ name: 'artifact script get',
799
+ summary: '查询项目完整剧本最终产物',
800
+ examples: ['lj-awb artifact script get --project-id <projectId>'],
801
+ args: [PROJECT_ID_ARG],
802
+ func: artifact.artifactScriptGet,
803
+ },
804
+ {
805
+ name: 'artifact script document',
806
+ summary: '查询剧本 document 根记录',
807
+ examples: ['lj-awb artifact script document --project-id <projectId>'],
808
+ args: [PROJECT_ID_ARG],
809
+ func: artifact.artifactScriptDocument,
810
+ },
811
+ {
812
+ name: 'artifact script rows',
813
+ summary: '查询剧本最终产物行列表',
814
+ examples: [
815
+ 'lj-awb artifact script rows --project-id <projectId> --row-kind scene',
816
+ 'lj-awb artifact script rows --project-id <projectId> --row-kind action --parent-key scn_001',
817
+ ],
818
+ args: [
819
+ PROJECT_ID_ARG,
820
+ ARTIFACT_ROW_KIND_ARG,
821
+ { name: 'parent-key', valueName: 'key', description: '按父节点业务键过滤' },
822
+ { name: 'revision-after', valueName: 'n', description: '只查 revisionNo 大于该值的行' },
823
+ { name: 'include-deleted', valueName: 'bool', description: '是否包含逻辑删除行,默认 false' },
824
+ ],
825
+ func: artifact.artifactScriptRows,
826
+ },
827
+ {
828
+ name: 'artifact script row',
829
+ summary: '查询单条剧本最终产物行',
830
+ examples: ['lj-awb artifact script row --project-id <projectId> --row-kind action --entity-key "ep_001/scn_001#0"'],
831
+ args: [PROJECT_ID_ARG, ARTIFACT_ROW_KIND_ARG, ARTIFACT_ENTITY_KEY_ARG],
832
+ func: artifact.artifactScriptRow,
833
+ },
834
+ {
835
+ name: 'artifact script children',
836
+ summary: '按 parentKey 查询剧本子节点',
837
+ examples: ['lj-awb artifact script children --project-id <projectId> --parent-key scn_001 --row-kind action'],
838
+ args: [
839
+ PROJECT_ID_ARG,
840
+ { name: 'parent-key', valueName: 'key', description: '父节点业务键' },
841
+ ARTIFACT_ROW_KIND_ARG,
842
+ ],
843
+ func: artifact.artifactScriptChildren,
844
+ },
845
+ {
846
+ name: 'artifact script upsert-row',
847
+ summary: '新增或更新单条剧本最终产物行',
848
+ examples: ['lj-awb artifact script upsert-row --project-id <projectId> --input-file ./row.json --dry-run'],
849
+ args: [PROJECT_ID_ARG, ...BODY_INPUT_ARGS, ...ARTIFACT_WRITE_ARGS],
850
+ func: artifact.artifactScriptUpsertRow,
851
+ },
852
+ {
853
+ name: 'artifact script delete-row',
854
+ summary: '逻辑删除单条剧本最终产物行',
855
+ examples: ['lj-awb artifact script delete-row --project-id <projectId> --row-kind action --entity-key "ep_001/scn_001#0" --dry-run'],
856
+ args: [PROJECT_ID_ARG, ARTIFACT_ROW_KIND_ARG, ARTIFACT_ENTITY_KEY_ARG, ...ARTIFACT_WRITE_ARGS],
857
+ func: artifact.artifactScriptDeleteRow,
858
+ },
859
+ {
860
+ name: 'artifact script import',
861
+ summary: '从本地 script.json 拆分并批量导入剧本最终产物',
862
+ examples: [
863
+ 'lj-awb artifact script import --project-id <projectId> --input-file 1_script/output/script.json --dry-run',
864
+ 'lj-awb artifact script import --project-id <projectId> --input-file output/script.json --yes',
865
+ ],
866
+ args: [
867
+ PROJECT_ID_ARG,
868
+ { name: 'input-file', valueName: 'path', description: 'script.json 路径,默认 output/script.json' },
869
+ ...ARTIFACT_WRITE_ARGS,
870
+ ],
871
+ func: artifact.artifactScriptImport,
872
+ hint: '不传 --input-file 时默认读取当前目录的 output/script.json。',
873
+ },
874
+ ]) {
875
+ cli({
876
+ name: spec.name,
877
+ description: commandHelp(spec.summary, { examples: spec.examples, hint: spec.hint }),
878
+ args: spec.args,
879
+ func: async (_ctx, kwargs) => spec.func(kwargs),
880
+ });
881
+ }
882
+
883
+ for (const spec of [
884
+ {
885
+ name: 'artifact asset get',
886
+ summary: '查询项目完整资产最终产物',
887
+ examples: ['lj-awb artifact asset get --project-id <projectId>'],
888
+ args: [PROJECT_ID_ARG],
889
+ func: artifact.artifactAssetGet,
890
+ },
891
+ {
892
+ name: 'artifact asset actors',
893
+ summary: '查询角色最终产物列表',
894
+ examples: ['lj-awb artifact asset actors --project-id <projectId> --include-states true'],
895
+ args: [PROJECT_ID_ARG, ARTIFACT_INCLUDE_STATES_ARG],
896
+ func: artifact.artifactAssetActors,
897
+ },
898
+ {
899
+ name: 'artifact asset actor',
900
+ summary: '查询单个角色最终产物',
901
+ examples: ['lj-awb artifact asset actor --project-id <projectId> --actor-key act_001'],
902
+ args: [PROJECT_ID_ARG, { name: 'actor-key', valueName: 'key', description: '角色业务键' }, ARTIFACT_INCLUDE_STATES_ARG],
903
+ func: artifact.artifactAssetActor,
904
+ },
905
+ {
906
+ name: 'artifact asset props',
907
+ summary: '查询道具最终产物列表',
908
+ examples: ['lj-awb artifact asset props --project-id <projectId>'],
909
+ args: [PROJECT_ID_ARG, ARTIFACT_INCLUDE_STATES_ARG],
910
+ func: artifact.artifactAssetProps,
911
+ },
912
+ {
913
+ name: 'artifact asset prop',
914
+ summary: '查询单个道具最终产物',
915
+ examples: ['lj-awb artifact asset prop --project-id <projectId> --prop-key prp_001'],
916
+ args: [PROJECT_ID_ARG, { name: 'prop-key', valueName: 'key', description: '道具业务键' }, ARTIFACT_INCLUDE_STATES_ARG],
917
+ func: artifact.artifactAssetProp,
918
+ },
919
+ {
920
+ name: 'artifact asset locations',
921
+ summary: '查询场景最终产物列表',
922
+ examples: ['lj-awb artifact asset locations --project-id <projectId>'],
923
+ args: [PROJECT_ID_ARG, ARTIFACT_INCLUDE_STATES_ARG],
924
+ func: artifact.artifactAssetLocations,
925
+ },
926
+ {
927
+ name: 'artifact asset location',
928
+ summary: '查询单个场景最终产物',
929
+ examples: ['lj-awb artifact asset location --project-id <projectId> --location-key loc_001'],
930
+ args: [PROJECT_ID_ARG, { name: 'location-key', valueName: 'key', description: '场景业务键' }, ARTIFACT_INCLUDE_STATES_ARG],
931
+ func: artifact.artifactAssetLocation,
932
+ },
933
+ {
934
+ name: 'artifact asset upsert-actor',
935
+ summary: '新增或更新角色最终产物',
936
+ examples: ['lj-awb artifact asset upsert-actor --project-id <projectId> --input-file ./actor.json --dry-run'],
937
+ args: [PROJECT_ID_ARG, ...BODY_INPUT_ARGS, ...ARTIFACT_WRITE_ARGS],
938
+ func: artifact.artifactAssetUpsertActor,
939
+ },
940
+ {
941
+ name: 'artifact asset upsert-prop',
942
+ summary: '新增或更新道具最终产物',
943
+ examples: ['lj-awb artifact asset upsert-prop --project-id <projectId> --input-file ./prop.json --dry-run'],
944
+ args: [PROJECT_ID_ARG, ...BODY_INPUT_ARGS, ...ARTIFACT_WRITE_ARGS],
945
+ func: artifact.artifactAssetUpsertProp,
946
+ },
947
+ {
948
+ name: 'artifact asset upsert-location',
949
+ summary: '新增或更新场景最终产物',
950
+ examples: ['lj-awb artifact asset upsert-location --project-id <projectId> --input-file ./location.json --dry-run'],
951
+ args: [PROJECT_ID_ARG, ...BODY_INPUT_ARGS, ...ARTIFACT_WRITE_ARGS],
952
+ func: artifact.artifactAssetUpsertLocation,
953
+ },
954
+ {
955
+ name: 'artifact asset upsert-actor-state',
956
+ summary: '新增或更新角色状态最终产物',
957
+ examples: ['lj-awb artifact asset upsert-actor-state --project-id <projectId> --actor-key act_001 --input-file ./state.json --dry-run'],
958
+ args: [PROJECT_ID_ARG, { name: 'actor-key', valueName: 'key', description: '角色业务键' }, ...BODY_INPUT_ARGS, ...ARTIFACT_WRITE_ARGS],
959
+ func: artifact.artifactAssetUpsertActorState,
960
+ },
961
+ {
962
+ name: 'artifact asset upsert-prop-state',
963
+ summary: '新增或更新道具状态最终产物',
964
+ examples: ['lj-awb artifact asset upsert-prop-state --project-id <projectId> --prop-key prp_001 --input-file ./state.json --dry-run'],
965
+ args: [PROJECT_ID_ARG, { name: 'prop-key', valueName: 'key', description: '道具业务键' }, ...BODY_INPUT_ARGS, ...ARTIFACT_WRITE_ARGS],
966
+ func: artifact.artifactAssetUpsertPropState,
967
+ },
968
+ {
969
+ name: 'artifact asset upsert-location-state',
970
+ summary: '新增或更新场景状态最终产物',
971
+ examples: ['lj-awb artifact asset upsert-location-state --project-id <projectId> --location-key loc_001 --input-file ./state.json --dry-run'],
972
+ args: [PROJECT_ID_ARG, { name: 'location-key', valueName: 'key', description: '场景业务键' }, ...BODY_INPUT_ARGS, ...ARTIFACT_WRITE_ARGS],
973
+ func: artifact.artifactAssetUpsertLocationState,
974
+ },
975
+ {
976
+ name: 'artifact asset delete-actor',
977
+ summary: '逻辑删除角色及其状态最终产物',
978
+ examples: ['lj-awb artifact asset delete-actor --project-id <projectId> --actor-key act_001 --dry-run'],
979
+ args: [PROJECT_ID_ARG, { name: 'actor-key', valueName: 'key', description: '角色业务键' }, ...ARTIFACT_WRITE_ARGS],
980
+ func: artifact.artifactAssetDeleteActor,
981
+ },
982
+ {
983
+ name: 'artifact asset delete-prop',
984
+ summary: '逻辑删除道具及其状态最终产物',
985
+ examples: ['lj-awb artifact asset delete-prop --project-id <projectId> --prop-key prp_001 --dry-run'],
986
+ args: [PROJECT_ID_ARG, { name: 'prop-key', valueName: 'key', description: '道具业务键' }, ...ARTIFACT_WRITE_ARGS],
987
+ func: artifact.artifactAssetDeleteProp,
988
+ },
989
+ {
990
+ name: 'artifact asset delete-location',
991
+ summary: '逻辑删除场景及其状态最终产物',
992
+ examples: ['lj-awb artifact asset delete-location --project-id <projectId> --location-key loc_001 --dry-run'],
993
+ args: [PROJECT_ID_ARG, { name: 'location-key', valueName: 'key', description: '场景业务键' }, ...ARTIFACT_WRITE_ARGS],
994
+ func: artifact.artifactAssetDeleteLocation,
995
+ },
996
+ {
997
+ name: 'artifact asset delete-actor-state',
998
+ summary: '逻辑删除角色状态最终产物',
999
+ examples: ['lj-awb artifact asset delete-actor-state --project-id <projectId> --actor-key act_001 --state-key default --dry-run'],
1000
+ args: [PROJECT_ID_ARG, { name: 'actor-key', valueName: 'key', description: '角色业务键' }, { name: 'state-key', valueName: 'key', description: '状态业务键' }, ...ARTIFACT_WRITE_ARGS],
1001
+ func: artifact.artifactAssetDeleteActorState,
1002
+ },
1003
+ {
1004
+ name: 'artifact asset delete-prop-state',
1005
+ summary: '逻辑删除道具状态最终产物',
1006
+ examples: ['lj-awb artifact asset delete-prop-state --project-id <projectId> --prop-key prp_001 --state-key default --dry-run'],
1007
+ args: [PROJECT_ID_ARG, { name: 'prop-key', valueName: 'key', description: '道具业务键' }, { name: 'state-key', valueName: 'key', description: '状态业务键' }, ...ARTIFACT_WRITE_ARGS],
1008
+ func: artifact.artifactAssetDeletePropState,
1009
+ },
1010
+ {
1011
+ name: 'artifact asset delete-location-state',
1012
+ summary: '逻辑删除场景状态最终产物',
1013
+ examples: ['lj-awb artifact asset delete-location-state --project-id <projectId> --location-key loc_001 --state-key default --dry-run'],
1014
+ args: [PROJECT_ID_ARG, { name: 'location-key', valueName: 'key', description: '场景业务键' }, { name: 'state-key', valueName: 'key', description: '状态业务键' }, ...ARTIFACT_WRITE_ARGS],
1015
+ func: artifact.artifactAssetDeleteLocationState,
1016
+ },
1017
+ {
1018
+ name: 'artifact asset import',
1019
+ summary: '从本地 actors/props/locations JSON 批量导入资产最终产物',
1020
+ examples: [
1021
+ 'lj-awb artifact asset import --project-id <projectId> --input-dir 2_asset/output --dry-run',
1022
+ 'lj-awb artifact asset import --project-id <projectId> --actors-file output/actors/actors.json --props-file output/props/props.json --locations-file output/locations/locations.json --yes',
1023
+ ],
1024
+ args: [
1025
+ PROJECT_ID_ARG,
1026
+ { name: 'input-dir', valueName: 'path', description: '资产 output 目录,默认 output' },
1027
+ { name: 'actors-file', valueName: 'path', description: '可选 actors.json 路径' },
1028
+ { name: 'props-file', valueName: 'path', description: '可选 props.json 路径' },
1029
+ { name: 'locations-file', valueName: 'path', description: '可选 locations.json 路径' },
1030
+ ...ARTIFACT_WRITE_ARGS,
1031
+ ],
1032
+ func: artifact.artifactAssetImport,
1033
+ hint: '默认在 --input-dir 下查找 actors/actors.json、props/props.json、locations/locations.json;也兼容 actors.json 等扁平文件名。',
1034
+ },
1035
+ ]) {
1036
+ cli({
1037
+ name: spec.name,
1038
+ description: commandHelp(spec.summary, { examples: spec.examples, hint: spec.hint }),
1039
+ args: spec.args,
1040
+ func: async (_ctx, kwargs) => spec.func(kwargs),
1041
+ });
1042
+ }
1043
+
1044
+ for (const spec of [
1045
+ {
1046
+ name: 'artifact video get',
1047
+ summary: '查询项目完整视频最终产物',
1048
+ examples: ['lj-awb artifact video get --project-id <projectId>'],
1049
+ args: [PROJECT_ID_ARG],
1050
+ func: artifact.artifactVideoGet,
1051
+ },
1052
+ {
1053
+ name: 'artifact video episodes',
1054
+ summary: '查询视频集列表',
1055
+ examples: ['lj-awb artifact video episodes --project-id <projectId>'],
1056
+ args: [PROJECT_ID_ARG],
1057
+ func: artifact.artifactVideoEpisodes,
1058
+ },
1059
+ {
1060
+ name: 'artifact video episode',
1061
+ summary: '查询单集视频最终产物',
1062
+ examples: ['lj-awb artifact video episode --project-id <projectId> --episode-id ep_001'],
1063
+ args: [PROJECT_ID_ARG, ARTIFACT_EPISODE_ARG],
1064
+ func: artifact.artifactVideoEpisode,
1065
+ },
1066
+ {
1067
+ name: 'artifact video scenes',
1068
+ summary: '查询某集下的场列表',
1069
+ examples: ['lj-awb artifact video scenes --project-id <projectId> --episode-id ep_001'],
1070
+ args: [PROJECT_ID_ARG, ARTIFACT_EPISODE_ARG],
1071
+ func: artifact.artifactVideoScenes,
1072
+ },
1073
+ {
1074
+ name: 'artifact video scene',
1075
+ summary: '查询单场视频最终产物',
1076
+ examples: ['lj-awb artifact video scene --project-id <projectId> --episode-id ep_001 --scene-id scn_001'],
1077
+ args: [PROJECT_ID_ARG, ARTIFACT_EPISODE_ARG, ARTIFACT_SCENE_ARG],
1078
+ func: artifact.artifactVideoScene,
1079
+ },
1080
+ {
1081
+ name: 'artifact video clips',
1082
+ summary: '查询某场下的 clip 列表',
1083
+ examples: ['lj-awb artifact video clips --project-id <projectId> --episode-id ep_001 --scene-id scn_001'],
1084
+ args: [PROJECT_ID_ARG, ARTIFACT_EPISODE_ARG, ARTIFACT_SCENE_ARG],
1085
+ func: artifact.artifactVideoClips,
1086
+ },
1087
+ {
1088
+ name: 'artifact video clip',
1089
+ summary: '查询单个 clip 视频最终产物',
1090
+ examples: ['lj-awb artifact video clip --project-id <projectId> --episode-id ep_001 --scene-id scn_001 --clip-id clip_001'],
1091
+ args: [PROJECT_ID_ARG, ARTIFACT_EPISODE_ARG, ARTIFACT_SCENE_ARG, ARTIFACT_CLIP_ARG],
1092
+ func: artifact.artifactVideoClip,
1093
+ },
1094
+ {
1095
+ name: 'artifact video upsert-episode',
1096
+ summary: '新增或更新视频 episode 最终产物',
1097
+ examples: ['lj-awb artifact video upsert-episode --project-id <projectId> --input-file ./episode.json --dry-run'],
1098
+ args: [PROJECT_ID_ARG, ...BODY_INPUT_ARGS, ...ARTIFACT_WRITE_ARGS],
1099
+ func: artifact.artifactVideoUpsertEpisode,
1100
+ },
1101
+ {
1102
+ name: 'artifact video upsert-scene',
1103
+ summary: '新增或更新视频 scene 最终产物',
1104
+ examples: ['lj-awb artifact video upsert-scene --project-id <projectId> --episode-id ep_001 --input-file ./scene.json --dry-run'],
1105
+ args: [PROJECT_ID_ARG, ARTIFACT_EPISODE_ARG, ...BODY_INPUT_ARGS, ...ARTIFACT_WRITE_ARGS],
1106
+ func: artifact.artifactVideoUpsertScene,
1107
+ },
1108
+ {
1109
+ name: 'artifact video upsert-clip',
1110
+ summary: '新增或更新视频 clip 最终产物',
1111
+ examples: ['lj-awb artifact video upsert-clip --project-id <projectId> --episode-id ep_001 --scene-id scn_001 --input-file ./clip.json --dry-run'],
1112
+ args: [PROJECT_ID_ARG, ARTIFACT_EPISODE_ARG, ARTIFACT_SCENE_ARG, ...BODY_INPUT_ARGS, ...ARTIFACT_WRITE_ARGS],
1113
+ func: artifact.artifactVideoUpsertClip,
1114
+ },
1115
+ {
1116
+ name: 'artifact video update-clip-video-urls',
1117
+ summary: '只回写 clip.videoUrls,不覆盖 payload / prompt / duration',
1118
+ examples: ['lj-awb artifact video update-clip-video-urls --project-id <projectId> --episode-id ep_001 --scene-id scn_001 --clip-id clip_001 --video-urls-json \'["https://example.com/a.mp4"]\' --dry-run'],
1119
+ args: [
1120
+ PROJECT_ID_ARG,
1121
+ ARTIFACT_EPISODE_ARG,
1122
+ ARTIFACT_SCENE_ARG,
1123
+ ARTIFACT_CLIP_ARG,
1124
+ { name: 'video-urls-json', valueName: 'json', description: '视频 URL 数组 JSON' },
1125
+ ...ARTIFACT_WRITE_ARGS,
1126
+ ],
1127
+ func: artifact.artifactVideoUpdateClipVideoUrls,
1128
+ },
1129
+ {
1130
+ name: 'artifact video delete-episode',
1131
+ summary: '逻辑删除视频 episode,并级联删除该集 scenes/clips',
1132
+ examples: ['lj-awb artifact video delete-episode --project-id <projectId> --episode-id ep_001 --dry-run'],
1133
+ args: [PROJECT_ID_ARG, ARTIFACT_EPISODE_ARG, ...ARTIFACT_WRITE_ARGS],
1134
+ func: artifact.artifactVideoDeleteEpisode,
1135
+ },
1136
+ {
1137
+ name: 'artifact video delete-scene',
1138
+ summary: '逻辑删除视频 scene,并级联删除该场 clips',
1139
+ examples: ['lj-awb artifact video delete-scene --project-id <projectId> --episode-id ep_001 --scene-id scn_001 --dry-run'],
1140
+ args: [PROJECT_ID_ARG, ARTIFACT_EPISODE_ARG, ARTIFACT_SCENE_ARG, ...ARTIFACT_WRITE_ARGS],
1141
+ func: artifact.artifactVideoDeleteScene,
1142
+ },
1143
+ {
1144
+ name: 'artifact video delete-clip',
1145
+ summary: '逻辑删除视频 clip',
1146
+ examples: ['lj-awb artifact video delete-clip --project-id <projectId> --episode-id ep_001 --scene-id scn_001 --clip-id clip_001 --dry-run'],
1147
+ args: [PROJECT_ID_ARG, ARTIFACT_EPISODE_ARG, ARTIFACT_SCENE_ARG, ARTIFACT_CLIP_ARG, ...ARTIFACT_WRITE_ARGS],
1148
+ func: artifact.artifactVideoDeleteClip,
1149
+ },
1150
+ {
1151
+ name: 'artifact video import-storyboard',
1152
+ summary: '从 epXXX_storyboard.json 拆分 episode/scenes/clips 并导入视频最终产物',
1153
+ examples: [
1154
+ 'lj-awb artifact video import-storyboard --project-id <projectId> --input-file 3_footage/output/ep001/ep001_storyboard.json --dry-run',
1155
+ 'lj-awb artifact video import-storyboard --project-id <projectId> --input-file output/ep001/ep001_storyboard.json --yes',
1156
+ ],
1157
+ args: [PROJECT_ID_ARG, { name: 'input-file', valueName: 'path', description: 'epXXX_storyboard.json 路径' }, ...ARTIFACT_WRITE_ARGS],
1158
+ func: artifact.artifactVideoImportStoryboard,
1159
+ },
1160
+ ]) {
1161
+ cli({
1162
+ name: spec.name,
1163
+ description: commandHelp(spec.summary, { examples: spec.examples }),
1164
+ args: spec.args,
1165
+ func: async (_ctx, kwargs) => spec.func(kwargs),
1166
+ });
1167
+ }
1168
+
746
1169
  cli({
747
1170
  name: 'subject list',
748
1171
  description: commandHelp('查询可用于视频主体参考的元素 / 主体', {
@@ -4,7 +4,7 @@ import crypto from 'node:crypto';
4
4
  import os from 'node:os';
5
5
  import path from 'node:path';
6
6
 
7
- export const DEFAULT_API_ORIGIN = 'https://animeworkbench-pre.lingjingai.cn';
7
+ export const DEFAULT_API_ORIGIN = 'https://animeworkbench.lingjingai.cn';
8
8
  export const API_ORIGIN = (
9
9
  process.env.LINGJING_AWB_API_ORIGIN
10
10
  || process.env.ANIME_API_ORIGIN