@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.
@@ -104,6 +104,12 @@ function normalizeAuthStatus(data = {}) {
104
104
  accessKey: data.accessKey,
105
105
  source: [data.accessKeySource, data.accessKeySourceName].filter(Boolean).join('/'),
106
106
  verified: data.verified,
107
+ verification: data.verification,
108
+ verifyCommand: data.verifyCommand,
109
+ userId: data.user?.userId,
110
+ userName: data.user?.userName,
111
+ groupId: data.user?.groupId,
112
+ groupName: data.user?.groupName,
107
113
  user: data.user,
108
114
  });
109
115
  }
@@ -134,6 +140,7 @@ function normalizeDryRunResult(row = {}) {
134
140
 
135
141
  function normalizeDryRun(data = {}) {
136
142
  const localFiles = Array.isArray(data.localFiles) ? data.localFiles : (data.localFile ? [data.localFile] : undefined);
143
+ const resourceConversions = Array.isArray(data.resourceConversions) ? data.resourceConversions : undefined;
137
144
  return compactRecord({
138
145
  dryRun: true,
139
146
  action: data.action,
@@ -141,6 +148,10 @@ function normalizeDryRun(data = {}) {
141
148
  ...scalarRequestSummary(data.request),
142
149
  ...requestSummary(data.request),
143
150
  localFileCount: Array.isArray(localFiles) ? localFiles.length : undefined,
151
+ resourceConversionCount: Array.isArray(resourceConversions) ? resourceConversions.length : undefined,
152
+ resourceConversion: Array.isArray(resourceConversions) && resourceConversions.length === 1
153
+ ? `${resourceConversions[0].resource || 'resource'} ${resourceConversions[0].fromFormat}->${resourceConversions[0].toFormat}`
154
+ : undefined,
144
155
  fileCount: Array.isArray(data.files) ? data.files.length : undefined,
145
156
  assetCount: Array.isArray(data.assets) ? data.assets.length : undefined,
146
157
  files: data.files,
@@ -159,6 +170,12 @@ function normalizeTaskSubmission(data = {}) {
159
170
  projectGroupNo: data.projectGroupNo,
160
171
  pointNo: data.pointNo,
161
172
  points: data.points ?? data.point ?? data.costPoint ?? data.estimatePoint,
173
+ pointCost: data.pointCost,
174
+ billingPointBalance: data.billingPointBalance ?? data.teamPointBalance,
175
+ billingPointRemainingAfter: data.billingPointRemainingAfter ?? data.teamPointRemainingAfter,
176
+ projectBudgetBalance: data.projectBudgetBalance ?? data.projectPointBalance,
177
+ projectBudgetMax: data.projectBudgetMax ?? data.projectPointMax,
178
+ projectBudgetRemainingAfter: data.projectBudgetRemainingAfter ?? data.projectPointRemainingAfter,
162
179
  uploadCount: Array.isArray(data.uploads) ? data.uploads.length : undefined,
163
180
  nextCommand: rewriteCommandPrefix(data.nextCommand),
164
181
  waited: data.waited ? normalizeTaskStatus(data.waited) : undefined,
@@ -178,11 +195,11 @@ function normalizeFee(data = {}) {
178
195
  modelGroupCode: data.modelGroupCode,
179
196
  projectGroupNo: data.projectGroupNo,
180
197
  pointCost: data.pointCost,
181
- teamPointBalance: data.teamPointBalance,
182
- projectPointBalance: data.projectPointBalance,
183
- projectPointMax: data.projectPointMax,
184
- teamPointRemainingAfter: data.teamPointRemainingAfter,
185
- projectPointRemainingAfter: data.projectPointRemainingAfter,
198
+ billingPointBalance: data.billingPointBalance ?? data.teamPointBalance,
199
+ billingPointRemainingAfter: data.billingPointRemainingAfter ?? data.teamPointRemainingAfter,
200
+ projectBudgetBalance: data.projectBudgetBalance ?? data.projectPointBalance,
201
+ projectBudgetMax: data.projectBudgetMax ?? data.projectPointMax,
202
+ projectBudgetRemainingAfter: data.projectBudgetRemainingAfter ?? data.projectPointRemainingAfter,
186
203
  });
187
204
  }
188
205
 
@@ -194,19 +211,34 @@ function normalizeAccountInfo(data = {}) {
194
211
  groupName: data.groupName,
195
212
  currentProjectGroupNo: data.currentProjectGroupNo,
196
213
  currentProjectGroupName: data.currentProjectGroupName,
197
- teamPointBalance: data.teamPointBalance,
198
- projectPointBalance: data.projectPointBalance,
199
- projectPointMax: data.projectPointMax,
214
+ billingPointBalance: data.billingPointBalance ?? data.teamPointBalance,
215
+ projectBudgetBalance: data.projectBudgetBalance ?? data.projectPointBalance,
216
+ projectBudgetMax: data.projectBudgetMax ?? data.projectPointMax,
200
217
  });
201
218
  }
202
219
 
203
220
  function normalizeCredits(data = {}) {
204
221
  return compactRecord({
205
- teamPointBalance: data.teamPointBalance,
222
+ billingPointBalance: data.billingPointBalance ?? data.teamPointBalance,
206
223
  currentProjectGroupNo: data.currentProjectGroupNo,
207
224
  currentProjectGroupName: data.currentProjectGroupName,
208
- projectPointBalance: data.projectPointBalance,
209
- projectPointMax: data.projectPointMax,
225
+ projectBudgetBalance: data.projectBudgetBalance ?? data.projectPointBalance,
226
+ projectBudgetMax: data.projectBudgetMax ?? data.projectPointMax,
227
+ });
228
+ }
229
+
230
+ function normalizeProjectSummary(data = {}) {
231
+ return compactRecord({
232
+ selected: data.selected,
233
+ created: data.created,
234
+ updated: data.updated,
235
+ reused: data.reused,
236
+ projectGroupNo: data.projectGroupNo,
237
+ projectGroupName: data.projectGroupName,
238
+ isSelected: data.isSelected,
239
+ projectBudgetBalance: data.projectBudgetBalance ?? data.projectPointBalance,
240
+ projectBudgetMax: data.projectBudgetMax ?? data.projectPointMax,
241
+ memberCount: data.memberCount,
210
242
  });
211
243
  }
212
244
 
@@ -295,6 +327,7 @@ export function normalizeOutputData(commandName, data) {
295
327
  if (!isPlainObject(data)) return cleanNested(data);
296
328
  switch (commandName) {
297
329
  case 'auth status':
330
+ case 'auth verify':
298
331
  return normalizeAuthStatus(data);
299
332
  case 'auth login-key':
300
333
  return normalizeAuthLogin(data);
@@ -315,6 +348,12 @@ export function normalizeOutputData(commandName, data) {
315
348
  return normalizeAccountInfo(data);
316
349
  case 'credits balance':
317
350
  return normalizeCredits(data);
351
+ case 'project current':
352
+ case 'project use':
353
+ case 'project create':
354
+ case 'project update':
355
+ case 'project ensure':
356
+ return normalizeProjectSummary(data);
318
357
  case 'credits usage':
319
358
  return normalizeCreditsUsage(data);
320
359
  case 'image status':
@@ -355,14 +394,8 @@ export function normalizeOutputData(commandName, data) {
355
394
 
356
395
  export function normalizeJsonData(commandName, data) {
357
396
  if (!isPlainObject(data)) return rewriteNested(data);
358
- switch (commandName) {
359
- case 'auth status':
360
- return normalizeAuthStatus(data);
361
- case 'auth login-key':
362
- return normalizeAuthLogin(data);
363
- default:
364
- return rewriteNested(data);
365
- }
397
+ if (data.dryRun) return rewriteNested(data);
398
+ return normalizeOutputData(commandName, data);
366
399
  }
367
400
 
368
401
  function shortValue(value) {
@@ -431,6 +464,7 @@ function rowSummary(row) {
431
464
  'groupName',
432
465
  'projectGroupNo',
433
466
  'projectGroupName',
467
+ 'projectId',
434
468
  'isSelected',
435
469
  'userId',
436
470
  'userName',
@@ -442,6 +476,7 @@ function rowSummary(row) {
442
476
  'created',
443
477
  'updated',
444
478
  'registered',
479
+ 'imported',
445
480
  'submitted',
446
481
  'selected',
447
482
  'reused',
@@ -451,10 +486,23 @@ function rowSummary(row) {
451
486
  'taskCount',
452
487
  'successTaskCount',
453
488
  'pointTotal',
489
+ 'billingPointBalance',
490
+ 'billingPointRemainingAfter',
491
+ 'projectBudgetBalance',
492
+ 'projectBudgetMax',
493
+ 'projectBudgetRemainingAfter',
454
494
  'projectPointBalance',
455
495
  'projectPointMax',
456
496
  'teamPointBalance',
457
497
  'assetId',
498
+ 'assetKind',
499
+ 'assetKey',
500
+ 'assetName',
501
+ 'actorKey',
502
+ 'propKey',
503
+ 'locationKey',
504
+ 'stateKey',
505
+ 'stateName',
458
506
  'partType',
459
507
  'score',
460
508
  'imageUrl',
@@ -485,7 +533,32 @@ function rowSummary(row) {
485
533
  'sceneType',
486
534
  'projectName',
487
535
  'inputIndex',
536
+ 'rowKind',
537
+ 'entityKey',
538
+ 'parentKey',
539
+ 'revisionNo',
540
+ 'sortOrder',
541
+ 'schemaVersion',
542
+ 'speakerKey',
543
+ 'episodeKey',
544
+ 'episodeId',
545
+ 'episodeNo',
546
+ 'episodeTitle',
547
+ 'sceneKey',
548
+ 'sceneId',
549
+ 'sceneNo',
550
+ 'clipId',
551
+ 'expectedDuration',
552
+ 'completePrompt',
488
553
  'key',
554
+ 'sourceFile',
555
+ 'inputDir',
556
+ 'rowCount',
557
+ 'actorCount',
558
+ 'propCount',
559
+ 'locationCount',
560
+ 'sceneCount',
561
+ 'clipCount',
489
562
  'requestSource',
490
563
  'prompt',
491
564
  'ratio',
@@ -544,9 +617,58 @@ function textItemCount(item = {}) {
544
617
  return undefined;
545
618
  }
546
619
 
620
+ function textAllowValues(values = []) {
621
+ return Array.isArray(values) && values.length ? valueList(values) : '<none>';
622
+ }
623
+
624
+ function textConditionValue(value) {
625
+ if (value === '__NOT_EMPTY__') return 'present';
626
+ if (value === '__EMPTY__') return 'empty';
627
+ return value;
628
+ }
629
+
630
+ function textConstraintConditions(conditions = []) {
631
+ if (!Array.isArray(conditions) || !conditions.length) return undefined;
632
+ return conditions
633
+ .map((item) => {
634
+ const key = item.key || item.configCode;
635
+ return key ? `${key}=${textConditionValue(item.value)}` : null;
636
+ })
637
+ .filter(Boolean)
638
+ .join('&');
639
+ }
640
+
641
+ const NORMAL_IMAGE_FORMATS = ['jpg', 'jpeg', 'png', 'jfif'];
642
+
643
+ function textImageFormats(item = {}) {
644
+ const policy = String(item.formatPolicy || '');
645
+ if (policy === 'normal_plus_webp') return valueList([...NORMAL_IMAGE_FORMATS, 'webp']);
646
+ if (policy === 'normal_without_webp') return valueList(NORMAL_IMAGE_FORMATS);
647
+ return valueList(item.fileTypes);
648
+ }
649
+
650
+ function textResourceFormats(item = {}) {
651
+ if (item.mediaType === 'IMAGE') return textImageFormats(item);
652
+ return valueList(item.fileTypes);
653
+ }
654
+
655
+ function textWebpInput(item = {}) {
656
+ if (item.mediaType !== 'IMAGE') return undefined;
657
+ const policy = String(item.formatPolicy || '');
658
+ if (policy === 'normal_plus_webp') return 'accepted';
659
+ if (policy === 'normal_without_webp') return item.autoConvertTo ? `autoConvertTo${String(item.autoConvertTo).toUpperCase()}` : 'unsupported';
660
+ return undefined;
661
+ }
662
+
663
+ function textResourceAutoConvert(item = {}) {
664
+ if (item.mediaType === 'IMAGE' && ['normal_plus_webp', 'normal_without_webp'].includes(String(item.formatPolicy || ''))) return undefined;
665
+ return item.autoConvertTo;
666
+ }
667
+
547
668
  function formatModelOptionsOutput(data = {}) {
548
669
  const params = Array.isArray(data.params) ? data.params : [];
549
670
  const resources = Array.isArray(data.resources) ? data.resources : [];
671
+ const constraints = Array.isArray(data.constraints) ? data.constraints : [];
550
672
  const lines = ['ok model options'];
551
673
  lines.push(renderRecord(compactRecord({
552
674
  modelGroupCode: data.modelGroupCode,
@@ -571,30 +693,48 @@ function formatModelOptionsOutput(data = {}) {
571
693
  media: item.mediaType,
572
694
  usage: item.usage,
573
695
  sources: textSources(item.sources),
574
- formats: valueList(item.fileTypes),
696
+ formats: textResourceFormats(item),
697
+ webpInput: textWebpInput(item),
698
+ autoConvert: textResourceAutoConvert(item),
575
699
  files: textFileCount(item),
576
700
  maxSizeKB: item.maxSizeKB,
577
701
  durationMs: textDurationRange(item),
578
702
  totalDurationMs: item.maxTotalDurationMs != null ? `<=${item.maxTotalDurationMs}` : undefined,
579
703
  items: textItemCount(item),
580
704
  maxPromptLength: item.maxPromptLength,
581
- supportLastFrame: item.supportLastFrame,
705
+ lastFrameOnly: item.supportLastFrameOnly,
582
706
  }), [
583
707
  'mode',
584
708
  'media',
585
709
  'usage',
586
710
  'sources',
587
711
  'formats',
712
+ 'webpInput',
713
+ 'autoConvert',
588
714
  'files',
589
715
  'maxSizeKB',
590
716
  'durationMs',
591
717
  'totalDurationMs',
592
718
  'items',
593
719
  'maxPromptLength',
594
- 'supportLastFrame',
720
+ 'lastFrameOnly',
595
721
  ])}`);
596
722
  }
597
723
  }
724
+ if (constraints.length) {
725
+ lines.push(`constraints.count=${constraints.length}`);
726
+ for (const [index, item] of constraints.entries()) {
727
+ lines.push(`constraint[${index}]: ${renderRecord(compactRecord({
728
+ target: item.target,
729
+ targetConfig: item.targetConfigCode && item.targetConfigCode !== item.target ? item.targetConfigCode : undefined,
730
+ allowedValues: textAllowValues(item.allowValues),
731
+ when: textConstraintConditions(item.conditions),
732
+ effect: item.effect,
733
+ priority: item.priority,
734
+ name: item.name,
735
+ }), ['target', 'targetConfig', 'allowedValues', 'when', 'effect', 'priority', 'name'])}`);
736
+ }
737
+ }
598
738
  return `${lines.join('\n')}\n`;
599
739
  }
600
740
 
@@ -626,9 +766,10 @@ function formatModelCreateSpecOutput(data = {}) {
626
766
  mode: intent.mode,
627
767
  intent: intent.intent,
628
768
  args: valueList(intent.requiredArgs),
769
+ usage: valueList(intent.resourceUsages),
629
770
  resources: valueList(intent.resourceSyntax),
630
771
  key: textKeyBinding(intent.promptBinding),
631
- }), ['mode', 'intent', 'args', 'resources', 'key'])}`);
772
+ }), ['mode', 'intent', 'args', 'usage', 'resources', 'key'])}`);
632
773
  }
633
774
  if (examples.length) {
634
775
  lines.push(`examples.count=${examples.length}`);
@@ -638,6 +779,36 @@ function formatModelCreateSpecOutput(data = {}) {
638
779
  return `${lines.join('\n')}\n`;
639
780
  }
640
781
 
782
+ function formatGuideTableRows(rows = []) {
783
+ return (Array.isArray(rows) ? rows : []).map((item, index) => {
784
+ const values = valueList(item.values);
785
+ return `field[${index}]: ${renderRecord(compactRecord({
786
+ name: item.field,
787
+ values,
788
+ desc: item.description,
789
+ }), ['name', 'values', 'desc'])}`;
790
+ });
791
+ }
792
+
793
+ function formatModelInputGuideOutput(data = {}) {
794
+ const lines = ['ok model input-guide'];
795
+ lines.push('commonFields.count=' + (Array.isArray(data.commonFields) ? data.commonFields.length : 0));
796
+ lines.push(...formatGuideTableRows(data.commonFields));
797
+ lines.push('resourceFields.count=' + (Array.isArray(data.resourceFields) ? data.resourceFields.length : 0));
798
+ lines.push(...formatGuideTableRows(data.resourceFields));
799
+ const rules = Array.isArray(data.resourceRules) ? data.resourceRules : [];
800
+ if (rules.length) {
801
+ lines.push(`resourceRules.count=${rules.length}`);
802
+ for (const [index, rule] of rules.entries()) lines.push(`rule[${index}]=${rule}`);
803
+ }
804
+ const referenceKeyGuide = Array.isArray(data.referenceKeyGuide) ? data.referenceKeyGuide : [];
805
+ if (referenceKeyGuide.length) {
806
+ lines.push(`referenceKey.count=${referenceKeyGuide.length}`);
807
+ for (const [index, item] of referenceKeyGuide.entries()) lines.push(`referenceKey[${index}]=${item}`);
808
+ }
809
+ return `${lines.join('\n')}\n`;
810
+ }
811
+
641
812
  function defaultJsonCommand(commandName) {
642
813
  return `${commandPrefix()} ${commandName} -f json`;
643
814
  }
@@ -664,6 +835,7 @@ function subtitleRemoveNextCommand(commandName, normalized) {
664
835
  export function formatTextOutput(commandName, data, context = {}) {
665
836
  if (commandName === 'model options') return formatModelOptionsOutput(data);
666
837
  if (commandName === 'model create-spec') return formatModelCreateSpecOutput(data);
838
+ if (commandName === 'model input-guide') return formatModelInputGuideOutput(data);
667
839
  const normalized = normalizeOutputData(commandName, data);
668
840
  if (!isPlainObject(normalized)) return `ok ${commandName}\nvalue=${shortValue(normalized)}\n`;
669
841
  const lines = [`ok ${commandName}`];
@@ -674,6 +846,11 @@ export function formatTextOutput(commandName, data, context = {}) {
674
846
  [
675
847
  'configured',
676
848
  'accessKey',
849
+ 'verified',
850
+ 'verification',
851
+ 'verifyCommand',
852
+ 'userId',
853
+ 'userName',
677
854
  'doctorStatus',
678
855
  'taskId',
679
856
  'publicId',
@@ -682,14 +859,44 @@ export function formatTextOutput(commandName, data, context = {}) {
682
859
  'taskStatus',
683
860
  'modelGroupCode',
684
861
  'projectGroupNo',
862
+ 'projectId',
685
863
  'groupId',
864
+ 'groupName',
686
865
  'assetId',
687
866
  'elementId',
688
867
  'externalId',
689
868
  'status',
869
+ 'imported',
870
+ 'sourceFile',
871
+ 'inputDir',
690
872
  'count',
873
+ 'rowCount',
874
+ 'actorCount',
875
+ 'propCount',
876
+ 'locationCount',
877
+ 'sceneCount',
878
+ 'clipCount',
879
+ 'episodeId',
880
+ 'rowKind',
881
+ 'entityKey',
882
+ 'parentKey',
883
+ 'assetKind',
884
+ 'assetKey',
885
+ 'actorKey',
886
+ 'propKey',
887
+ 'locationKey',
888
+ 'stateKey',
889
+ 'sceneId',
890
+ 'clipId',
691
891
  'resultCount',
892
+ 'resourceConversionCount',
893
+ 'resourceConversion',
692
894
  'pointCost',
895
+ 'billingPointBalance',
896
+ 'billingPointRemainingAfter',
897
+ 'projectBudgetBalance',
898
+ 'projectBudgetMax',
899
+ 'projectBudgetRemainingAfter',
693
900
  'pointTotal',
694
901
  'dryRun',
695
902
  'action',