@lingjingai/lj-awb-cli 0.4.6 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +14 -7
  2. package/build/volta-pre.mjs +64 -0
  3. package/install.mjs +11 -3
  4. package/package.json +4 -3
  5. package/packages/awb-cli/package.json +2 -2
  6. package/packages/awb-core/package.json +1 -2
  7. package/packages/awb-core/src/api.js +14 -12
  8. package/packages/awb-core/src/commands.js +55 -506
  9. package/packages/awb-core/src/common.js +3 -5
  10. package/packages/awb-core/src/output.js +92 -306
  11. package/packages/awb-core/src/services.js +263 -64
  12. package/packages/awb-core/src/standalone.js +33 -207
  13. package/packages/awb-core/src/update.js +74 -3
  14. package/skills/lj-awb/SKILL.md +15 -8
  15. package/skills/lj-awb/VERSION +1 -1
  16. package/skills/lj-awb/compat.json +3 -3
  17. package/skills/lj-awb/modules/account.md +5 -3
  18. package/skills/lj-awb/modules/asset.md +1 -1
  19. package/skills/lj-awb/modules/create-contract.md +10 -8
  20. package/skills/lj-awb/modules/create.md +1 -1
  21. package/skills/lj-awb/modules/credits.md +18 -1
  22. package/skills/lj-awb/modules/driver.md +4 -10
  23. package/skills/lj-awb/modules/evals.md +2 -2
  24. package/skills/lj-awb/modules/image.md +6 -6
  25. package/skills/lj-awb/modules/model.md +50 -1
  26. package/skills/lj-awb/modules/project.md +2 -2
  27. package/skills/lj-awb/modules/task-manual.md +3 -3
  28. package/skills/lj-awb/modules/task.md +6 -5
  29. package/skills/lj-awb/modules/upload.md +10 -10
  30. package/skills/lj-awb/modules/video.md +11 -13
  31. package/skills/lj-awb/modules/workflows.md +2 -77
  32. package/skills/lj-awb/references/error-codes.md +2 -2
  33. package/skills/lj-awb/references/output-fields.md +11 -15
  34. package/packages/awb-core/src/artifact.js +0 -936
  35. package/skills/lj-awb/modules/artifact/asset.md +0 -64
  36. package/skills/lj-awb/modules/artifact/clip.md +0 -65
  37. package/skills/lj-awb/modules/artifact/script.md +0 -37
  38. package/skills/lj-awb/modules/artifact/video.md +0 -65
  39. package/skills/lj-awb/modules/artifact.md +0 -65
@@ -1,7 +1,7 @@
1
1
  import fs from 'node:fs/promises';
2
2
  import path from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
- import { LingjingAwbCliError, createEnvelope, toBool, toInt } from './common.js';
4
+ import { LingjingAwbCliError, createEnvelope, toBool, toInt, trimToNull } from './common.js';
5
5
  import { registerAwbCommands } from './commands.js';
6
6
  import { checkCliUpdate } from './update.js';
7
7
  import {
@@ -196,7 +196,13 @@ function buildOutputContext(command, kwargs = {}, data = {}) {
196
196
  confirmSet.autoConvert = true;
197
197
  }
198
198
  const isModelList = command.name === 'model image-models' || command.name === 'model video-models';
199
- const modelListAll = isModelList && toBool(kwargs.all);
199
+ const hasModelFilter = isModelList && !toBool(kwargs.all) && Boolean(
200
+ trimToNull(kwargs.model) || trimToNull(kwargs.usage) || trimToNull(kwargs.provider)
201
+ || trimToNull(kwargs.inputMode) || trimToNull(kwargs.supports)
202
+ || trimToNull(kwargs.quality) || trimToNull(kwargs.ratio)
203
+ || trimToNull(kwargs.duration) || toBool(kwargs.needAudio),
204
+ );
205
+ const modelListAll = isModelList && (toBool(kwargs.all) || hasModelFilter);
200
206
  const modelListLimit = isModelList
201
207
  ? (modelListAll ? Number.POSITIVE_INFINITY : Math.max(1, toInt(kwargs.limit, 8)))
202
208
  : undefined;
@@ -344,7 +350,7 @@ const VIRTUAL_COMMANDS = [
344
350
  ].join('\n'),
345
351
  args: [
346
352
  { name: 'brief', description: '输出面向 Agent 的轻量能力摘要,不展开每个参数' },
347
- { name: 'domain', valueName: 'name', description: '按命令域过滤,如 create / task / artifact / system' },
353
+ { name: 'domain', valueName: 'name', description: '按命令域过滤,如 create / task / system' },
348
354
  { name: 'command', valueName: 'name', description: '按子命令过滤,如 image / video / wait / doctor' },
349
355
  ],
350
356
  },
@@ -355,17 +361,13 @@ const RENAMED_COMMAND_HINTS = {
355
361
  'image fee': 'create image-fee',
356
362
  'image create': 'create image',
357
363
  'image create-batch': 'create image-batch',
358
- 'image status': 'task image-status',
359
364
  video: 'create video',
360
365
  'video fee': 'create video-fee',
361
366
  'video create': 'create video',
362
367
  'video create-batch': 'create video-batch',
363
- 'video status': 'task video-status',
364
368
  'video subtitle-remove': 'create video-subtitle-removal',
365
369
  'video super-resolution': 'create video-super-resolution',
366
370
  'video super-resolution-fee': 'create video-super-resolution-fee',
367
- 'video super-resolution-status': 'task video-super-resolution-status',
368
- 'video subtitle-status': 'task video-subtitle-status',
369
371
  asset: 'create asset',
370
372
  'asset match-actor': 'create asset-match-actor',
371
373
  'asset groups': 'create asset-groups',
@@ -386,7 +388,8 @@ const RENAMED_COMMAND_HINTS = {
386
388
  'workspace team-select': 'account switch-team',
387
389
  'workspace project-groups': 'project list',
388
390
  'workspace project-group-current': 'project current',
389
- 'workspace project-group-select': 'project use',
391
+ 'workspace project-group-select': 'project switch',
392
+ 'project use': 'project switch',
390
393
  'workspace project-group-users': 'project users',
391
394
  'workspace project-group-create': 'project create',
392
395
  'workspace project-group-update': 'project update',
@@ -459,45 +462,16 @@ const GROUP_DESCRIPTIONS = {
459
462
  auth: '认证:登录、查看和清空本地 access key',
460
463
  account: '账号:查看账号和团队',
461
464
  project: '项目:查看、切换、创建和更新项目组',
462
- credits: '积分:查询可扣积分余额、项目组预算和用量统计',
465
+ credits: '积分:查询可扣积分余额、项目组预算、用量统计和积分明细',
463
466
  model: '模型:查询生图 / 生视频模型、参数约束和创建用法',
464
467
  create: '创建:统一提交图片、视频、主体、音色、素材和视频去字幕任务',
465
468
  upload: '上传:把本地文件上传为平台可访问素材',
466
469
  task: '任务:任务列表、等待和本地任务台账',
467
- artifact: '最终产物:剧本、资产、视频、剪辑 CRUD 与本地 JSON 导入',
468
470
  };
469
471
 
470
- const SUBGROUP_DESCRIPTIONS = {
471
- artifact: {
472
- script: '剧本:document / asset / state / speaker / episode / scene / action 行 CRUD 与 script.json 批量导入',
473
- asset: '资产:角色 / 道具 / 场景 及其状态 CRUD,actors/props/locations JSON 批量导入',
474
- video: '视频:集 / 场 / clip 三级最终产物 CRUD 与 storyboard 批量导入',
475
- clip: '剪辑:按集组织的剪辑宽表 CRUD 与状态更新',
476
- },
477
- };
472
+ const SUBGROUP_DESCRIPTIONS = {};
478
473
 
479
- const SUBGROUP_EXAMPLES = {
480
- 'artifact script': [
481
- 'lj-awb artifact script import --project-id <projectId> --input-file 1_script/output/script.json --dry-run',
482
- 'lj-awb artifact script get --project-id <projectId>',
483
- 'lj-awb artifact script rows --project-id <projectId> --row-kind scene',
484
- ],
485
- 'artifact asset': [
486
- 'lj-awb artifact asset import --project-id <projectId> --input-dir 2_asset/output --dry-run',
487
- 'lj-awb artifact asset actors --project-id <projectId> --include-states true',
488
- 'lj-awb artifact asset props --project-id <projectId>',
489
- ],
490
- 'artifact video': [
491
- 'lj-awb artifact video import-storyboard --project-id <projectId> --input-file 3_footage/output/ep001/ep001_storyboard.json --dry-run',
492
- 'lj-awb artifact video episodes --project-id <projectId>',
493
- 'lj-awb artifact video clips --project-id <projectId> --episode-id ep_001 --scene-id scn_001',
494
- ],
495
- 'artifact clip': [
496
- 'lj-awb artifact clip upsert-episode --project-id <projectId> --input-file 4_clip/output/ep001_clip_output.json --dry-run',
497
- 'lj-awb artifact clip episodes --project-id <projectId>',
498
- 'lj-awb artifact clip episode-by-id --project-id <projectId> --episode-id ep_001',
499
- ],
500
- };
474
+ const SUBGROUP_EXAMPLES = {};
501
475
 
502
476
  const GROUP_EXAMPLES = {
503
477
  system: [
@@ -528,11 +502,12 @@ const GROUP_EXAMPLES = {
528
502
  project: [
529
503
  'lj-awb project list',
530
504
  'lj-awb project current',
531
- 'lj-awb project use --project-group-no <no> --yes',
505
+ 'lj-awb project switch --project-group-no <no> --yes',
532
506
  'lj-awb project create --name "CLI 测试项目" --point 1000 --yes',
533
507
  ],
534
508
  credits: [
535
509
  'lj-awb credits balance',
510
+ 'lj-awb credits records --query-type 2 --page 1 --size 20',
536
511
  'lj-awb credits usage --project-group-no <no> --last-hours 24',
537
512
  'lj-awb credits buy',
538
513
  'lj-awb credits redeem',
@@ -562,19 +537,10 @@ const GROUP_EXAMPLES = {
562
537
  ],
563
538
  task: [
564
539
  'lj-awb task list --task-type IMAGE_CREATE --project-group-no <no>',
565
- 'lj-awb task image-status --task-id <imageTaskId>',
566
- 'lj-awb task video-status --task-id <videoTaskId>',
567
- 'lj-awb task video-subtitle-status --task-id <subtitleTaskId>',
568
- 'lj-awb task video-super-resolution-status --task-id <superResolutionTaskId>',
569
- 'lj-awb task wait --task-id <id> --task-type IMAGE_CREATE --wait-seconds 180',
540
+ 'lj-awb task status --task-id <taskId>',
541
+ 'lj-awb task wait --task-id <id> --wait-seconds 180',
570
542
  'lj-awb task records --task-record-file .awb/tasks.jsonl',
571
543
  ],
572
- artifact: [
573
- 'lj-awb artifact script import --project-id <projectId> --input-file 1_script/output/script.json --dry-run',
574
- 'lj-awb artifact asset import --project-id <projectId> --input-dir 2_asset/output --dry-run',
575
- 'lj-awb artifact video import-storyboard --project-id <projectId> --input-file 3_footage/output/ep001/ep001_storyboard.json --dry-run',
576
- 'lj-awb artifact clip upsert-episode --project-id <projectId> --input-file 4_clip/output/ep001_clip_output.json --dry-run',
577
- ],
578
544
  };
579
545
 
580
546
  const COMMAND_REQUIRED_OPTIONS = {
@@ -586,53 +552,19 @@ const COMMAND_REQUIRED_OPTIONS = {
586
552
  'create image-fee': ['modelGroupCode', 'prompt'],
587
553
  'create image': ['modelGroupCode', 'prompt'],
588
554
  'create image-batch': ['inputFile', 'modelGroupCode'],
589
- 'task image-status': ['taskId'],
590
555
  'create video-fee': ['modelGroupCode'],
591
556
  'create video': ['modelGroupCode'],
592
557
  'create video-batch': ['inputFile', 'modelGroupCode'],
593
558
  'create video-super-resolution-fee': ['objectName'],
594
559
  'create video-super-resolution': ['objectName'],
595
- 'task video-status': ['taskId'],
596
- 'task video-subtitle-status': ['taskId'],
597
- 'task video-super-resolution-status': ['taskId'],
598
- 'task wait': ['taskId', 'taskType'],
560
+ 'task status': ['taskId'],
561
+ 'task wait': ['taskId'],
599
562
  'create asset-match-actor': ['description'],
600
563
  'create asset-groups': ['platform'],
601
564
  'create asset-group-get': ['groupId', 'platform'],
602
565
  'create asset-group': ['name', 'platform'],
603
566
  'create asset-group-update': ['groupId', 'platform'],
604
567
  'create asset': ['groupId', 'name', 'platform'],
605
- 'artifact script row': ['rowKind', 'entityKey'],
606
- 'artifact script children': ['parentKey'],
607
- 'artifact script delete-row': ['rowKind', 'entityKey'],
608
- 'artifact asset actor': ['actorKey'],
609
- 'artifact asset prop': ['propKey'],
610
- 'artifact asset location': ['locationKey'],
611
- 'artifact asset upsert-actor-state': ['actorKey'],
612
- 'artifact asset upsert-prop-state': ['propKey'],
613
- 'artifact asset upsert-location-state': ['locationKey'],
614
- 'artifact asset delete-actor': ['actorKey'],
615
- 'artifact asset delete-prop': ['propKey'],
616
- 'artifact asset delete-location': ['locationKey'],
617
- 'artifact asset delete-actor-state': ['actorKey', 'stateKey'],
618
- 'artifact asset delete-prop-state': ['propKey', 'stateKey'],
619
- 'artifact asset delete-location-state': ['locationKey', 'stateKey'],
620
- 'artifact video episode': ['episodeId'],
621
- 'artifact video scenes': ['episodeId'],
622
- 'artifact video scene': ['episodeId', 'sceneId'],
623
- 'artifact video clips': ['episodeId', 'sceneId'],
624
- 'artifact video clip': ['episodeId', 'sceneId', 'clipId'],
625
- 'artifact video upsert-scene': ['episodeId'],
626
- 'artifact video upsert-clip': ['episodeId', 'sceneId'],
627
- 'artifact video update-clip-urls': ['episodeId', 'sceneId', 'clipId', 'videoUrlsJson'],
628
- 'artifact video delete-episode': ['episodeId'],
629
- 'artifact video delete-scene': ['episodeId', 'sceneId'],
630
- 'artifact video delete-clip': ['episodeId', 'sceneId', 'clipId'],
631
- 'artifact video import-storyboard': ['inputFile'],
632
- 'artifact clip episode': ['videoEpisodeId'],
633
- 'artifact clip episode-by-id': ['episodeId'],
634
- 'artifact clip update-status': ['videoEpisodeId', 'status'],
635
- 'artifact clip delete-episode': ['videoEpisodeId'],
636
568
  'create subject': ['name'],
637
569
  'create subject-wait': ['elementId'],
638
570
  'create subject-voice': ['name'],
@@ -649,61 +581,16 @@ const COMMAND_REQUIRED_ANY_OPTIONS = {
649
581
  'create video-subtitle-removal': [['sourceTaskId']],
650
582
  'create asset-group-update': [['name', 'description', 'projectName']],
651
583
  'create asset': [['file', 'url', 'backendPath']],
652
- 'artifact script upsert-row': [['bodyJson', 'inputFile']],
653
- 'artifact asset upsert-actor': [['bodyJson', 'inputFile']],
654
- 'artifact asset upsert-prop': [['bodyJson', 'inputFile']],
655
- 'artifact asset upsert-location': [['bodyJson', 'inputFile']],
656
- 'artifact asset upsert-actor-state': [['bodyJson', 'inputFile']],
657
- 'artifact asset upsert-prop-state': [['bodyJson', 'inputFile']],
658
- 'artifact asset upsert-location-state': [['bodyJson', 'inputFile']],
659
- 'artifact video upsert-episode': [['bodyJson', 'inputFile']],
660
- 'artifact video upsert-scene': [['bodyJson', 'inputFile']],
661
- 'artifact video upsert-clip': [['bodyJson', 'inputFile']],
662
- 'artifact clip upsert-episode': [['bodyJson', 'inputFile']],
663
- 'artifact clip upsert-batch': [['bodyJson', 'inputFile']],
664
584
  'create subject': [['resource'], ['modelCode']],
665
585
  'create subject-batch': [['modelCode']],
666
586
  'create subject-voice': [['file', 'voiceUrl', 'audioUrl', 'videoId']],
667
587
  'create subject-voice-wait': [['voiceRecordId', 'reqTaskId']],
668
588
  };
669
589
 
670
- const ARTIFACT_WRITE_COMMANDS = [
671
- 'artifact script upsert-row',
672
- 'artifact script delete-row',
673
- 'artifact script import',
674
- 'artifact asset upsert-actor',
675
- 'artifact asset upsert-prop',
676
- 'artifact asset upsert-location',
677
- 'artifact asset upsert-actor-state',
678
- 'artifact asset upsert-prop-state',
679
- 'artifact asset upsert-location-state',
680
- 'artifact asset delete-actor',
681
- 'artifact asset delete-prop',
682
- 'artifact asset delete-location',
683
- 'artifact asset delete-actor-state',
684
- 'artifact asset delete-prop-state',
685
- 'artifact asset delete-location-state',
686
- 'artifact asset import',
687
- 'artifact video upsert-episode',
688
- 'artifact video upsert-scene',
689
- 'artifact video upsert-clip',
690
- 'artifact video update-clip-urls',
691
- 'artifact video delete-episode',
692
- 'artifact video delete-scene',
693
- 'artifact video delete-clip',
694
- 'artifact video import-storyboard',
695
- 'artifact clip upsert-episode',
696
- 'artifact clip upsert-batch',
697
- 'artifact clip update-status',
698
- 'artifact clip delete-episode',
699
- ];
700
-
701
- const ARTIFACT_DELETE_COMMANDS = ARTIFACT_WRITE_COMMANDS.filter((name) => name.includes(' delete-'));
702
-
703
590
  const CONFIRMATION_COMMANDS = new Set([
704
591
  'auth clear',
705
592
  'account switch-team',
706
- 'project use',
593
+ 'project switch',
707
594
  'project create',
708
595
  'project update',
709
596
  'project ensure',
@@ -716,7 +603,6 @@ const CONFIRMATION_COMMANDS = new Set([
716
603
  'create asset-group',
717
604
  'create asset-group-update',
718
605
  'create asset',
719
- ...ARTIFACT_WRITE_COMMANDS,
720
606
  'create subject',
721
607
  'create subject-voice',
722
608
  'create subject-batch',
@@ -733,7 +619,7 @@ const COST_COMMANDS = new Set([
733
619
 
734
620
  const REMOTE_WRITE_COMMANDS = new Set([
735
621
  'account switch-team',
736
- 'project use',
622
+ 'project switch',
737
623
  'project create',
738
624
  'project update',
739
625
  'project ensure',
@@ -748,7 +634,6 @@ const REMOTE_WRITE_COMMANDS = new Set([
748
634
  'create asset-group',
749
635
  'create asset-group-update',
750
636
  'create asset',
751
- ...ARTIFACT_WRITE_COMMANDS,
752
637
  'create subject',
753
638
  'create subject-voice',
754
639
  'create subject-batch',
@@ -759,12 +644,12 @@ const LOCAL_STATE_WRITE_COMMANDS = new Set([
759
644
  'auth login',
760
645
  'auth clear',
761
646
  'auth logout',
762
- 'project use',
647
+ 'project switch',
763
648
  'project create',
764
649
  'project ensure',
765
650
  ]);
766
651
 
767
- const DESTRUCTIVE_COMMANDS = new Set(['auth clear', ...ARTIFACT_DELETE_COMMANDS]);
652
+ const DESTRUCTIVE_COMMANDS = new Set(['auth clear']);
768
653
  const LONG_RUNNING_COMMANDS = new Set(['auth login', 'credits redeem', 'task wait', 'task record-poll', 'create subject-wait', 'create subject-voice-wait']);
769
654
  const NETWORK_NONE_COMMANDS = new Set(['schema', 'auth status', 'auth clear', 'auth logout', 'credits buy', 'model input-guide', 'task records']);
770
655
  const NETWORK_CONDITIONAL_COMMANDS = new Set(['doctor', 'auth login']);
@@ -783,6 +668,8 @@ const OUTPUT_KIND_BY_COMMAND = {
783
668
  'project current': 'project_summary',
784
669
  'project users': 'project_user_list',
785
670
  'credits balance': 'credits_balance',
671
+ 'credits records': 'credits_records',
672
+ 'credits detail-status': 'credit_detail_status',
786
673
  'credits usage': 'credits_usage',
787
674
  'credits buy': 'purchase_guide',
788
675
  'credits redeem': 'redeem_result',
@@ -796,16 +683,13 @@ const OUTPUT_KIND_BY_COMMAND = {
796
683
  'create image-fee': 'fee_estimate',
797
684
  'create image': 'task_submission',
798
685
  'create image-batch': 'batch_task_submission',
799
- 'task image-status': 'task_status',
800
686
  'create video-fee': 'fee_estimate',
801
687
  'create video': 'task_submission',
802
688
  'create video-batch': 'batch_task_submission',
803
689
  'create video-super-resolution-fee': 'fee_estimate',
804
690
  'create video-super-resolution': 'task_submission',
805
- 'task video-status': 'task_status',
806
691
  'create video-subtitle-removal': 'subtitle_task_submission',
807
- 'task video-subtitle-status': 'subtitle_task_status',
808
- 'task video-super-resolution-status': 'task_status',
692
+ 'task status': 'task_status',
809
693
  'task list': 'task_list',
810
694
  'task wait': 'task_status',
811
695
  'task records': 'local_task_records',
@@ -823,57 +707,6 @@ const OUTPUT_KIND_BY_COMMAND = {
823
707
  'create subject-voice': 'subject_voice_create_result',
824
708
  'create subject-voice-wait': 'subject_voice_status',
825
709
  'create subject-batch': 'batch_subject_publish_result',
826
- 'artifact script get': 'artifact_full',
827
- 'artifact script document': 'artifact_record',
828
- 'artifact script rows': 'artifact_list',
829
- 'artifact script row': 'artifact_record',
830
- 'artifact script children': 'artifact_list',
831
- 'artifact script upsert-row': 'artifact_write_result',
832
- 'artifact script delete-row': 'artifact_delete_result',
833
- 'artifact script import': 'artifact_import_result',
834
- 'artifact asset get': 'artifact_full',
835
- 'artifact asset actors': 'artifact_list',
836
- 'artifact asset actor': 'artifact_record',
837
- 'artifact asset props': 'artifact_list',
838
- 'artifact asset prop': 'artifact_record',
839
- 'artifact asset locations': 'artifact_list',
840
- 'artifact asset location': 'artifact_record',
841
- 'artifact asset upsert-actor': 'artifact_write_result',
842
- 'artifact asset upsert-prop': 'artifact_write_result',
843
- 'artifact asset upsert-location': 'artifact_write_result',
844
- 'artifact asset upsert-actor-state': 'artifact_write_result',
845
- 'artifact asset upsert-prop-state': 'artifact_write_result',
846
- 'artifact asset upsert-location-state': 'artifact_write_result',
847
- 'artifact asset delete-actor': 'artifact_delete_result',
848
- 'artifact asset delete-prop': 'artifact_delete_result',
849
- 'artifact asset delete-location': 'artifact_delete_result',
850
- 'artifact asset delete-actor-state': 'artifact_delete_result',
851
- 'artifact asset delete-prop-state': 'artifact_delete_result',
852
- 'artifact asset delete-location-state': 'artifact_delete_result',
853
- 'artifact asset import': 'artifact_import_result',
854
- 'artifact video get': 'artifact_full',
855
- 'artifact video episodes': 'artifact_list',
856
- 'artifact video episode': 'artifact_record',
857
- 'artifact video scenes': 'artifact_list',
858
- 'artifact video scene': 'artifact_record',
859
- 'artifact video clips': 'artifact_list',
860
- 'artifact video clip': 'artifact_record',
861
- 'artifact video upsert-episode': 'artifact_write_result',
862
- 'artifact video upsert-scene': 'artifact_write_result',
863
- 'artifact video upsert-clip': 'artifact_write_result',
864
- 'artifact video update-clip-urls': 'artifact_write_result',
865
- 'artifact video delete-episode': 'artifact_delete_result',
866
- 'artifact video delete-scene': 'artifact_delete_result',
867
- 'artifact video delete-clip': 'artifact_delete_result',
868
- 'artifact video import-storyboard': 'artifact_import_result',
869
- 'artifact clip get': 'artifact_full',
870
- 'artifact clip episodes': 'artifact_list',
871
- 'artifact clip episode': 'artifact_record',
872
- 'artifact clip episode-by-id': 'artifact_record',
873
- 'artifact clip upsert-episode': 'artifact_write_result',
874
- 'artifact clip upsert-batch': 'artifact_import_result',
875
- 'artifact clip update-status': 'artifact_status_update',
876
- 'artifact clip delete-episode': 'artifact_delete_result',
877
710
  };
878
711
 
879
712
  const PREFLIGHTS_BY_COMMAND = {
@@ -965,16 +798,16 @@ function buildCommandWorkflow(command) {
965
798
  const outputKind = OUTPUT_KIND_BY_COMMAND[command.name] || 'generic';
966
799
  const next = [];
967
800
  if (command.name === 'create image') {
968
- next.push('读取 data.taskId 和 data.nextCommand', '立即运行响应里的 nextCommand,或 task wait --task-type IMAGE_CREATE 等待结果');
801
+ next.push('读取 data.taskId 和 data.nextCommand', '立即运行响应里的 nextCommand,或 task wait --task-id <id> 等待结果');
969
802
  }
970
803
  if (command.name === 'create video') {
971
- next.push('读取 data.taskId 和 data.nextCommand', '立即运行响应里的 nextCommand,或 task wait --task-type VIDEO_GROUP 等待结果');
804
+ next.push('读取 data.taskId 和 data.nextCommand', '立即运行响应里的 nextCommand,或 task wait --task-id <id> 等待结果');
972
805
  }
973
806
  if (command.name === 'create video-super-resolution') {
974
- next.push('读取 data.taskId 和 data.nextCommand', '运行响应里的 task video-super-resolution-status 命令查询结果');
807
+ next.push('读取 data.taskId 和 data.nextCommand', '运行响应里的 task status 命令查询结果');
975
808
  }
976
809
  if (command.name === 'create video-subtitle-removal') {
977
- next.push('读取 data.taskId 和 data.nextCommand', '运行 task video-subtitle-status 或响应里的 nextCommand 等待结果');
810
+ next.push('读取 data.taskId 和 data.nextCommand', '运行 task status 或响应里的 nextCommand 等待结果');
978
811
  }
979
812
  if (command.name === 'create subject') {
980
813
  next.push('读取 data.elementId / data.externalId', 'externalId 为空时立刻运行 create subject-wait 获取 nextRefSubject');
@@ -1007,7 +840,7 @@ function buildCommandWorkflow(command) {
1007
840
  }
1008
841
  return {
1009
842
  outputKind,
1010
- recommendedPreflight: PREFLIGHTS_BY_COMMAND[command.name] || (ARTIFACT_WRITE_COMMANDS.includes(command.name) ? [`${command.name} --dry-run`] : []),
843
+ recommendedPreflight: PREFLIGHTS_BY_COMMAND[command.name] || [],
1011
844
  nextActions: next,
1012
845
  };
1013
846
  }
@@ -1027,7 +860,6 @@ function buildDomainSummaries(commands) {
1027
860
 
1028
861
  function requiredOptionsForCommand(command) {
1029
862
  const requiredOptions = new Set();
1030
- if (commandGroup(command) === 'artifact') requiredOptions.add('projectId');
1031
863
  for (const key of COMMAND_REQUIRED_OPTIONS[command.name] || []) requiredOptions.add(key);
1032
864
  return [...requiredOptions];
1033
865
  }
@@ -1140,11 +972,6 @@ function buildAgentBrief(commands, version = 'unknown') {
1140
972
  start: ['task wait', 'task record-poll', 'task records'],
1141
973
  rule: '优先复用 create 返回的 nextCommand;批量任务使用 task-record-file,失败项单独重试。',
1142
974
  },
1143
- {
1144
- intent: '最终产物 artifact',
1145
- start: ['artifact script', 'artifact asset', 'artifact video', 'artifact clip'],
1146
- rule: 'artifact 使用 project-id,不是 project-group-no;写入/删除/导入先 dry-run,再一次性确认写入面。',
1147
- },
1148
975
  ],
1149
976
  lookup: {
1150
977
  preciseSchema: `${commandPrefix()} schema --domain <domain> --command <command> -f json`,
@@ -1185,7 +1012,6 @@ function buildAgentContract() {
1185
1012
  'taskId -> taskType / projectGroupNo / resultUrls / errorMessage',
1186
1013
  'subject name + modelCode -> elementId / externalId / nextRefSubject',
1187
1014
  'subject voice name + source -> voiceRecordId / externalId / nextVoiceArg',
1188
- 'artifact projectId and imported file paths',
1189
1015
  ],
1190
1016
  invalidation: '用户切换账号、团队、项目组、模型、素材、prompt 或关键参数后,只刷新受影响的缓存;不要重复跑未变化的 model options / create-spec / fee。',
1191
1017
  },
@@ -1197,7 +1023,7 @@ function buildAgentContract() {
1197
1023
  '用户给出多条同模型同参数任务时优先 batch + task-record-file,不要单条循环 create。',
1198
1024
  '命令返回 nextCommand / nextRefSubject / nextVoiceArg 时优先复用返回值,不手拼等价命令。',
1199
1025
  '素材加白平台先通过 model asset-review-models 或用户明确输入确定;create asset-* 必须显式传 --platform,不要依赖默认平台。create asset 会自动判断 assetType=Image/Video/Audio,本地文件会用 ffprobe 校验图片/视频尺寸、视频时长/FPS/像素数和音频时长;不合法素材正式执行时会询问是否转码,非交互场景可追加 --auto-convert;macOS + Homebrew 环境缺失时 CLI 会自动安装 ffmpeg。',
1200
- '旧根域 image / video / asset / subject 已移除;只使用 create / task / artifact 等 schema 暴露的 domain。',
1026
+ '旧根域 image / video / asset / subject 已移除;只使用 create / task 等 schema 暴露的 domain。',
1201
1027
  ],
1202
1028
  canonicalFields: {
1203
1029
  purpose: 'CLI 输出对上游平台多版本字段做了归一化。Agent 只识别 canonical 列,遇到 aliases 列出的旧字段名时说明是上游原始返回,CLI 已在 text / 归一化层做了 fallback。不要把旧名当成独立新字段对外报告。',
@@ -149,6 +149,32 @@ async function runNpm(args, options = {}) {
149
149
  }
150
150
  }
151
151
 
152
+ async function runVolta(args, options = {}) {
153
+ try {
154
+ const result = await execFileAsync('volta', args, {
155
+ cwd: currentRootDir(),
156
+ encoding: 'utf8',
157
+ timeout: options.timeoutMs || DEFAULT_NPM_TIMEOUT_MS,
158
+ maxBuffer: 1024 * 1024,
159
+ env: process.env,
160
+ });
161
+ return result;
162
+ } catch (error) {
163
+ const stderr = String(error.stderr || '').trim();
164
+ const stdout = String(error.stdout || '').trim();
165
+ throw new LingjingAwbCliError('volta 命令执行失败', {
166
+ type: 'runtime_error',
167
+ exitCode: 30,
168
+ hint: stderr || stdout || error.message || '请确认 Volta 可用,或改用 npm 全局安装方式。',
169
+ details: {
170
+ command: `volta ${args.join(' ')}`,
171
+ code: error.code,
172
+ signal: error.signal,
173
+ },
174
+ });
175
+ }
176
+ }
177
+
152
178
  export async function fetchLatestCliVersion(options = {}) {
153
179
  const mocked = trimToNull(process.env.LINGJING_AWB_UPDATE_LATEST_VERSION);
154
180
  if (mocked) return mocked;
@@ -258,6 +284,45 @@ function tailLines(value, limit = 8) {
258
284
  return lines.slice(Math.max(0, lines.length - limit));
259
285
  }
260
286
 
287
+ function isVoltaPackageImagePath(value) {
288
+ const normalized = String(value || '').replaceAll('\\', '/');
289
+ return normalized.includes('/.volta/tools/image/packages/');
290
+ }
291
+
292
+ async function isCurrentCommandVoltaManaged() {
293
+ try {
294
+ const result = await execFileAsync('volta', ['which', commandPrefix()], {
295
+ cwd: currentRootDir(),
296
+ encoding: 'utf8',
297
+ timeout: 5_000,
298
+ maxBuffer: 256 * 1024,
299
+ env: process.env,
300
+ });
301
+ return isVoltaPackageImagePath(result.stdout);
302
+ } catch {
303
+ return false;
304
+ }
305
+ }
306
+
307
+ async function resolveUpdateInstaller({ packageName, installVersion, installSpec, registry }) {
308
+ if (await isCurrentCommandVoltaManaged()) {
309
+ return {
310
+ name: 'volta',
311
+ args: ['install', npmInstallSpec(packageName, installVersion)],
312
+ command: `volta install ${npmInstallSpec(packageName, installVersion)}`,
313
+ run: () => runVolta(['install', npmInstallSpec(packageName, installVersion)], { timeoutMs: 120_000 }),
314
+ };
315
+ }
316
+
317
+ const args = npmArgsWithRegistry(['install', '-g', installSpec], registry);
318
+ return {
319
+ name: 'npm',
320
+ args,
321
+ command: `npm ${args.join(' ')}`,
322
+ run: () => runNpm(args, { timeoutMs: 120_000 }),
323
+ };
324
+ }
325
+
261
326
  export async function runCliUpdate(kwargs = {}) {
262
327
  const currentVersion = await readCurrentCliVersion().catch(() => 'unknown');
263
328
  const packageName = resolveCliPackageName(kwargs);
@@ -268,7 +333,6 @@ export async function runCliUpdate(kwargs = {}) {
268
333
  const force = toBool(kwargs.force);
269
334
  const installVersion = latestVersion || 'latest';
270
335
  const installSpec = npmInstallSpec(packageName, force ? 'latest' : installVersion);
271
- const installArgs = npmArgsWithRegistry(['install', '-g', installSpec], registry);
272
336
 
273
337
  if (checkOnly) {
274
338
  return {
@@ -297,7 +361,13 @@ export async function runCliUpdate(kwargs = {}) {
297
361
  };
298
362
  }
299
363
 
300
- const result = await runNpm(installArgs, { timeoutMs: 120_000 });
364
+ const installer = await resolveUpdateInstaller({
365
+ packageName,
366
+ installVersion: force ? 'latest' : installVersion,
367
+ installSpec,
368
+ registry,
369
+ });
370
+ const result = await installer.run();
301
371
  await saveState({
302
372
  updateCheck: {
303
373
  packageName,
@@ -314,10 +384,11 @@ export async function runCliUpdate(kwargs = {}) {
314
384
  updated: true,
315
385
  updateAvailable,
316
386
  packageName,
387
+ installer: installer.name,
317
388
  previousVersion: currentVersion,
318
389
  currentVersion: latestVersion,
319
390
  latestVersion,
320
- command: `npm ${installArgs.join(' ')}`,
391
+ command: installer.command,
321
392
  skillUpdated: true,
322
393
  restartRecommended: true,
323
394
  message: '更新完成。请退出并重新打开 AI Agent,以加载最新 CLI 和 skill。',
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: lj-awb
3
- version: 0.4.6
4
- description: "灵境 AWB CLI skill。使用 `lj-awb` 命令调用动漫平台 / AWB 云端能力,覆盖认证、项目组、积分(含充值购买与兑换码兑换)、模型发现、上传、统一 create 创建域、任务查询、视频超分、最终产物 artifact CRUD 与本地 JSON 导入。用户说生图、生视频、视频超分、主体、音色、素材加白、去字幕、充值、购买积分、兑换码、artifact 写入或查询时使用。正式生成、切换项目组、清空认证、兑换码、artifact 写入等写入或扣费动作前必须确认。"
3
+ version: 0.5.0
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.4.6"
8
+ version: "0.5.0"
9
9
  bin: "lj-awb"
10
10
  cliHelp: "lj-awb --help"
11
11
  ---
@@ -15,13 +15,20 @@ metadata:
15
15
  `lj-awb` 是确定性 CLI,skill 的职责是调度:少查、少问、少重跑,按 schema 和业务链条把命令串对。不要把本 skill 当成一堆命令片段来拼。
16
16
  普通命令如果 JSON 输出里出现 `meta._notice.update`,先完成当前用户请求,再告诉用户当前版本和最新版本,并建议执行 `lj-awb update`;更新后提醒重新打开 AI Agent。
17
17
 
18
+ ## 对话输出纪律
19
+
20
+ - 面向用户只汇报关键状态和确认点:候选模型摘要、需要用户选择的参数、费用 / dry-run 结果、任务 ID、最终产物链接或明确错误。
21
+ - 不主动暴露完整命令、长 JSON、schema 摘要、并行查询清单或内部调度过程;这些只在用户明确要求“展示命令 / 输出 / 日志”时给出。
22
+ - 中间更新保持短句,避免逐条复述每个只读查询。需要说明进度时,用“正在查询模型候选 / 正在估价 / 正在等待任务”这类概括表达。
23
+ - 最终答复聚焦结果和下一步,不把工具调用轨迹当作交付内容。
24
+
18
25
  ## 先读驱动器
19
26
 
20
27
  任何非单条查询任务,都先加载 [`modules/driver.md`](modules/driver.md)。它定义:
21
28
 
22
29
  - CLI 全部能力域和业务边界。
23
30
  - Agent 状态账本,避免重复跑 `model options`、`model create-spec`、`fee`、`upload`。
24
- - 创作、批量、主体、音色、素材加白、artifact 的最短链条。
31
+ - 创作、批量、主体、音色、素材加白的最短链条。
25
32
  - 禁止清单:旧命令域、默认参数代决策、单条循环批量任务、直连后端等。
26
33
 
27
34
  只在驱动器把你引到某个细节模块时才继续读该模块。不要为了“掌握全部功能”一次性加载所有模块。
@@ -72,18 +79,18 @@ schema 查询必须先返回,再组织业务命令;不要把 schema 查询
72
79
  |------|--------|----------|
73
80
  | 环境体检、schema | `system` | [`modules/auth.md`](modules/auth.md) |
74
81
  | 认证、账号、团队 | `auth` / `account` | [`modules/auth.md`](modules/auth.md)、[`modules/account.md`](modules/account.md) |
75
- | 项目组与预算上下文 | `project` / `credits` | [`modules/project.md`](modules/project.md)、[`modules/credits.md`](modules/credits.md) |
82
+ | 项目组、预算与积分明细上下文 | `project` / `credits` | [`modules/project.md`](modules/project.md)、[`modules/credits.md`](modules/credits.md) |
76
83
  | 模型发现、参数约束、创建规格 | `model` | [`modules/model.md`](modules/model.md) |
77
84
  | 本地文件上传为 backendPath | `upload` | [`modules/upload.md`](modules/upload.md) |
78
85
  | 图片 / 视频 / 去字幕 / 主体 / 音色 / 素材创建 | `create` | [`modules/create.md`](modules/create.md)、[`modules/create-contract.md`](modules/create-contract.md) |
79
86
  | 异步任务等待与本地台账 | `task` | [`modules/task.md`](modules/task.md) |
80
- | 剧本、资产、视频、剪辑最终产物 | `artifact` | [`modules/artifact.md`](modules/artifact.md) |
81
87
 
82
88
  ## 触发分流
83
89
 
84
90
  | 用户意图 | 先走 |
85
91
  |----------|------|
86
92
  | “能不能跑 / 认证 / 当前项目 / 余额” | `doctor --verify`,再按需 `account` / `project` / `credits` |
93
+ | “积分明细 / 积分流水 / 充值记录 / 消耗记录 / 支出明细 / 收入明细” | [`modules/credits.md`](modules/credits.md):明细走 `credits records`;`--query-type` 1=全部、2=支出、3=收入 |
87
94
  | “充值 / 购买积分 / 积分不够了 / 兑换码” | [`modules/credits.md`](modules/credits.md):购买走 `credits buy` 给链接,兑换走 `credits redeem`(非交互用 `--code <code>`)|
88
95
  | “有哪些模型 / 推荐模型 / 用某某模型” | [`modules/model.md`](modules/model.md),模型口语名默认是平台模型,不是本地工具 |
89
96
  | “生图 / 生成图片 / 参考图生图” | [`modules/driver.md`](modules/driver.md) 创作链条 + [`modules/create-contract.md`](modules/create-contract.md) |
@@ -95,15 +102,15 @@ schema 查询必须先返回,再组织业务命令;不要把 schema 查询
95
102
  | “去字幕 / 擦掉英文字幕” | [`modules/video.md`](modules/video.md),只走 material 任务体系 |
96
103
  | “批量 / 多镜头 / 分镜 / JSONL / 并行” | [`modules/workflows.md`](modules/workflows.md) 的批量链条 |
97
104
  | “任务好了没 / 继续等 / 查状态” | [`modules/task.md`](modules/task.md) |
98
- | “写入 AWB / 最终产物 / script / actor / storyboard / clip” | [`modules/artifact.md`](modules/artifact.md) |
99
105
 
100
- 歧义词先一句话澄清:`加白` 是素材审核还是视觉白边;`存一下` 是 artifact 哪个子域;`角色一致` 是主体还是一次性参考图。
106
+ 歧义词先一句话澄清:`加白` 是素材审核还是视觉白边;`角色一致` 是主体还是一次性参考图。
101
107
 
102
108
  ## 全局硬规则
103
109
 
104
110
  - schema 中 `safety.requiresConfirmation=true` 的命令必须先向用户确认,再追加 `--yes`。
105
111
  - schema 中 `safety.supportsDryRun=true` 的写入 / 扣费命令先 `--dry-run`,确认后再正式执行。
106
112
  - 创作类命令在 fee / dry-run 前必须确认会影响价格或效果的关键参数;用户明确说“按默认”后才使用 defaultValue。
113
+ - Prompt 默认原文直出:用户提供明确 prompt / 创作描述时,禁止语义改写、润色、扩写或从参考图补画面细节;只有用户明确要求“优化 / 润色 / 扩写 / 你来写 prompt”时才允许改写,且改写后的最终 prompt 必须先展示并等待确认,之后才能 fee / dry-run / create。
107
114
  - `fee` 是最终估价,不是参数探索工具。不要为多个 quality / duration / ratio / 渠道组合反复跑 fee。
108
115
  - 正式图片 / 视频任务要带 `--project-group-no`,除非命令 schema 没有该参数。
109
116
  - 命令返回 `nextCommand`、`nextRefSubject`、`nextVoiceArg` 时优先复用返回值,不手拼。
@@ -1 +1 @@
1
- 0.4.6
1
+ 0.5.0