@lingjingai/lj-awb-cli 0.4.8 → 0.5.1

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.
@@ -213,8 +213,9 @@ function normalizeDryRun(data = {}) {
213
213
 
214
214
  function submissionStatusCommand(commandName, data = {}) {
215
215
  if (!data?.taskId) return null;
216
- if (commandName === 'create image') return `${commandPrefix()} task image-status --task-id ${data.taskId}`;
217
- if (commandName === 'create video') return `${commandPrefix()} task video-status --task-id ${data.taskId}`;
216
+ if (commandName === 'create image' || commandName === 'create video') {
217
+ return `${commandPrefix()} task status --task-id ${data.taskId}`;
218
+ }
218
219
  return null;
219
220
  }
220
221
 
@@ -296,6 +297,44 @@ function normalizeCredits(data = {}) {
296
297
  });
297
298
  }
298
299
 
300
+ function normalizeCreditsRecords(data = {}) {
301
+ const rows = Array.isArray(data.creditRecords)
302
+ ? data.creditRecords
303
+ : (Array.isArray(data.records) ? data.records : []);
304
+ return compactRecord({
305
+ remainPoint: data.remainPoint,
306
+ dataPlanPoint: data.dataPlanPoint,
307
+ topUpPoint: data.topUpPoint,
308
+ queryType: data.queryType,
309
+ total: data.total,
310
+ page: data.page,
311
+ size: data.size,
312
+ pages: data.pages,
313
+ creditRecords: rows.map((row) => compactRecord({
314
+ operationTime: row.operationTime,
315
+ title: row.title,
316
+ point: row.point,
317
+ projectGroupName: row.projectGroupName,
318
+ projectGroupNo: row.projectGroupNo,
319
+ userName: row.userName,
320
+ })),
321
+ });
322
+ }
323
+
324
+ function normalizeCreditDetailStatus(data = {}) {
325
+ return compactRecord({
326
+ detailId: data.detailId,
327
+ status: data.status,
328
+ statusText: data.statusText,
329
+ lockTime: data.lockTime,
330
+ lockPoint: data.lockPoint,
331
+ useTime: data.useTime,
332
+ usePoint: data.usePoint,
333
+ regetTime: data.regetTime,
334
+ regetPoint: data.regetPoint,
335
+ });
336
+ }
337
+
299
338
  function normalizeProjectSummary(data = {}) {
300
339
  return compactRecord({
301
340
  selected: data.selected,
@@ -345,6 +384,7 @@ function normalizeTaskStatus(data = {}) {
345
384
  modelGroupCode: data.modelGroupCode,
346
385
  projectGroupNo: data.projectGroupNo,
347
386
  pointNo: data.pointNo,
387
+ benefitsId: data.benefitsId,
348
388
  gmtCreate: data.gmtCreate,
349
389
  resultCount: data.resultCount,
350
390
  resultUrls: data.resultUrls,
@@ -464,6 +504,10 @@ export function normalizeOutputData(commandName, data) {
464
504
  return normalizeAccountInfo(data);
465
505
  case 'credits balance':
466
506
  return normalizeCredits(data);
507
+ case 'credits records':
508
+ return normalizeCreditsRecords(data);
509
+ case 'credits detail-status':
510
+ return normalizeCreditDetailStatus(data);
467
511
  case 'project current':
468
512
  case 'project switch':
469
513
  case 'project create':
@@ -472,11 +516,8 @@ export function normalizeOutputData(commandName, data) {
472
516
  return normalizeProjectSummary(data);
473
517
  case 'credits usage':
474
518
  return normalizeCreditsUsage(data);
475
- case 'task image-status':
476
- case 'task video-status':
519
+ case 'task status':
477
520
  case 'task wait':
478
- case 'task video-subtitle-status':
479
- case 'task video-super-resolution-status':
480
521
  return normalizeTaskStatus(data);
481
522
  case 'create subject':
482
523
  case 'create subject-wait':
@@ -655,6 +696,7 @@ function rowSummary(row) {
655
696
  'status',
656
697
  'message',
657
698
  'title',
699
+ 'point',
658
700
  'description',
659
701
  'groupId',
660
702
  'groupName',
@@ -1156,12 +1198,11 @@ function modelListAgentHint(commandName) {
1156
1198
 
1157
1199
  function statusNextCommand(commandName, normalized) {
1158
1200
  if (!isPlainObject(normalized) || normalized.isTerminal !== false || !normalized.taskId) return null;
1159
- const taskType = normalized.taskType || (commandName === 'task video-status' ? 'VIDEO_GROUP' : 'IMAGE_CREATE');
1160
- return `${commandPrefix()} task wait --task-id ${normalized.taskId} --task-type ${taskType} --wait-seconds 180`;
1201
+ return `${commandPrefix()} task wait --task-id ${normalized.taskId} --wait-seconds 180`;
1161
1202
  }
1162
1203
 
1163
1204
  function subtitleRemoveNextCommand(commandName, normalized) {
1164
- if (commandName !== 'task video-status' && commandName !== 'task wait') return null;
1205
+ if (commandName !== 'task status' && commandName !== 'task wait') return null;
1165
1206
  if (!normalized.taskId || normalized.taskStatus !== 'SUCCESS') return null;
1166
1207
  const taskType = String(normalized.taskType || '');
1167
1208
  if (taskType && taskType !== 'VIDEO_GROUP' && !taskType.startsWith('VIDEO_') && !taskType.startsWith('LIP_SYNC')) return null;
@@ -1187,8 +1228,10 @@ const OUTPUT_KIND_BY_COMMAND = {
1187
1228
  'project update': 'generic',
1188
1229
  'project ensure': 'generic',
1189
1230
  'credits balance': 'credits_balance',
1231
+ 'credits records': 'credits_records',
1232
+ 'credits detail-status': 'credit_detail_status',
1190
1233
  'credits usage': 'credits_usage',
1191
- 'credits buy': 'purchase_guide',
1234
+ 'credits recharge': 'purchase_guide',
1192
1235
  'credits redeem': 'redeem_result',
1193
1236
  'model image-models': 'model_list',
1194
1237
  'model video-models': 'model_list',
@@ -1200,16 +1243,13 @@ const OUTPUT_KIND_BY_COMMAND = {
1200
1243
  'create image-fee': 'fee_estimate',
1201
1244
  'create image': 'task_submission',
1202
1245
  'create image-batch': 'batch_task_submission',
1203
- 'task image-status': 'task_status',
1204
1246
  'create video-fee': 'fee_estimate',
1205
1247
  'create video': 'task_submission',
1206
1248
  'create video-batch': 'batch_task_submission',
1207
1249
  'create video-super-resolution-fee': 'fee_estimate',
1208
1250
  'create video-super-resolution': 'task_submission',
1209
- 'task video-status': 'task_status',
1210
1251
  'create video-subtitle-removal': 'subtitle_task_submission',
1211
- 'task video-subtitle-status': 'subtitle_task_status',
1212
- 'task video-super-resolution-status': 'task_status',
1252
+ 'task status': 'task_status',
1213
1253
  'task list': 'task_list',
1214
1254
  'task wait': 'task_status',
1215
1255
  'task records': 'local_task_records',
@@ -1244,7 +1284,9 @@ const KIND_TITLES = {
1244
1284
  batch_task_status: '批量任务状态',
1245
1285
  batch_task_submission: '批量任务提交结果',
1246
1286
  command_schema: '命令 Schema',
1287
+ credit_detail_status: '积分明细状态',
1247
1288
  credits_balance: '积分余额',
1289
+ credits_records: '积分明细',
1248
1290
  credits_usage: '积分用量',
1249
1291
  environment_report: '环境体检',
1250
1292
  fee_estimate: '费用预估',
@@ -1393,6 +1435,7 @@ const FIELD_LABELS = {
1393
1435
  point: '预算点数',
1394
1436
  pointCost: '预计消耗积分',
1395
1437
  pointNo: '积分规格',
1438
+ benefitsId: '积分明细 ID',
1396
1439
  pointTotal: '积分合计',
1397
1440
  projectBudgetBalance: '项目预算余额',
1398
1441
  projectBudgetMax: '项目预算上限',
@@ -1495,7 +1538,9 @@ const DETAIL_FIELDS_BY_KIND = {
1495
1538
  batch_subject_publish_result: ['dryRun', 'submitted', 'count', 'successCount', 'failureCount', 'modelCode', 'projectGroupNo'],
1496
1539
  batch_task_status: ['count', 'taskCount', 'successTaskCount', 'resultCount', 'pointTotal', 'timedOut', 'waitedMs'],
1497
1540
  batch_task_submission: ['dryRun', 'submitted', 'count', 'taskCount', 'successCount', 'failureCount', 'modelGroupCode', 'projectGroupNo', 'pointCost', 'billingPointBalance', 'projectBudgetBalance'],
1541
+ credit_detail_status: ['detailId', 'status', 'statusText', 'lockTime', 'lockPoint', 'useTime', 'usePoint', 'regetTime', 'regetPoint'],
1498
1542
  credits_balance: ['billingPointBalance', 'currentProjectGroupNo', 'currentProjectGroupName', 'projectBudgetBalance', 'projectBudgetMax'],
1543
+ credits_records: ['remainPoint', 'dataPlanPoint', 'topUpPoint', 'queryType', 'total', 'page', 'size', 'pages'],
1499
1544
  credits_usage: ['projectGroupNo', 'sinceText', 'untilText', 'scannedTaskCount', 'pointTotal'],
1500
1545
  environment_report: ['doctorStatus', 'verify'],
1501
1546
  fee_estimate: ['objectName', 'modelGroupCode', 'projectGroupNo', 'pointCost', 'billingPointBalance', 'billingPointRemainingAfter', 'projectBudgetBalance', 'projectBudgetMax', 'projectBudgetRemainingAfter'],
@@ -1510,9 +1555,9 @@ const DETAIL_FIELDS_BY_KIND = {
1510
1555
  subject_voice_status: ['name', 'voiceRecordId', 'reqTaskId', 'voiceId', 'externalId', 'status', 'taskStatus', 'errorMessage', 'isTerminal', 'nextVoiceArg'],
1511
1556
  subtitle_task_status: ['taskId', 'publicId', 'remoteTaskId', 'taskType', 'taskStatus', 'isTerminal', 'projectGroupNo', 'resultCount', 'errorMessage', 'timedOut', 'waitedMs'],
1512
1557
  subtitle_task_submission: ['submitted', 'taskId', 'taskType', 'sourceTaskId', 'projectGroupNo', 'pointCost', 'billingPointBalance', 'billingPointRemainingAfter', 'projectBudgetBalance', 'projectBudgetMax', 'projectBudgetRemainingAfter', 'nextCommand'],
1513
- task_status: ['taskId', 'publicId', 'remoteTaskId', 'taskType', 'taskStatus', 'isTerminal', 'modelGroupCode', 'projectGroupNo', 'pointNo', 'gmtCreate', 'resultCount', 'errorMessage', 'timedOut', 'waitedMs'],
1558
+ task_status: ['taskId', 'publicId', 'remoteTaskId', 'taskType', 'taskStatus', 'isTerminal', 'modelGroupCode', 'projectGroupNo', 'pointNo', 'benefitsId', 'gmtCreate', 'resultCount', 'errorMessage', 'timedOut', 'waitedMs'],
1514
1559
  task_submission: ['taskId', 'taskType', 'objectName', 'modelGroupCode', 'projectGroupNo', 'pointNo', 'points', 'pointCost', 'billingPointBalance', 'billingPointRemainingAfter', 'projectBudgetBalance', 'projectBudgetMax', 'projectBudgetRemainingAfter', 'uploadCount', 'nextCommand', 'statusCommand'],
1515
- update_result: ['checked', 'updated', 'updateAvailable', 'packageName', 'previousVersion', 'currentVersion', 'latestVersion', 'command', 'skillUpdated', 'restartRecommended', 'message'],
1560
+ update_result: ['checked', 'updated', 'updateAvailable', 'packageName', 'installer', 'previousVersion', 'currentVersion', 'latestVersion', 'command', 'skillUpdated', 'restartRecommended', 'message'],
1516
1561
  upload_result: ['dryRun', 'fileCount', 'assetCount', 'localFileCount', 'resourceConversionCount'],
1517
1562
  };
1518
1563
 
@@ -1549,6 +1594,7 @@ const LIST_KEY_BY_KIND = {
1549
1594
  batch_task_status: 'records',
1550
1595
  batch_task_submission: 'results',
1551
1596
  command_schema: 'commands',
1597
+ credits_records: 'creditRecords',
1552
1598
  credits_usage: 'buckets',
1553
1599
  local_task_records: 'records',
1554
1600
  model_list: 'models',
@@ -1569,8 +1615,13 @@ const PRETTY_KIND_PROFILES = Object.fromEntries(Object.keys(KIND_TITLES).map((ki
1569
1615
 
1570
1616
  export const PRETTY_OUTPUT_KIND_COVERAGE = Object.freeze(Object.keys(PRETTY_KIND_PROFILES));
1571
1617
 
1572
- function outputKindForCommand(commandName, context = {}) {
1573
- return context.outputKind || OUTPUT_KIND_BY_COMMAND[commandName] || 'generic';
1618
+ function outputKindForCommand(commandName, context = {}, data = null) {
1619
+ if (context.outputKind) return context.outputKind;
1620
+ if (commandName === 'task status') {
1621
+ const taskType = String(data?.taskType || '').trim().toUpperCase();
1622
+ return taskType === 'VIDEO_SUBTITLE_REMOVAL' ? 'subtitle_task_status' : 'task_status';
1623
+ }
1624
+ return OUTPUT_KIND_BY_COMMAND[commandName] || 'generic';
1574
1625
  }
1575
1626
 
1576
1627
  function prettyTitle(commandName, kind, data) {
@@ -1701,19 +1752,19 @@ function colorText(value, code) {
1701
1752
  }
1702
1753
 
1703
1754
  const COLOR = {
1704
- title: '1;38;5;39',
1705
- accent: '1;38;5;208',
1706
- section: '1;38;5;75',
1755
+ title: '1;38;5;252',
1756
+ accent: '38;5;110',
1757
+ section: '1;38;5;252',
1707
1758
  border: '38;5;238',
1708
- header: '1;38;5;81',
1709
- label: '38;5;215',
1759
+ header: '38;5;109',
1760
+ label: '38;5;245',
1710
1761
  value: '38;5;250',
1711
- command: '38;5;82',
1712
- code: '38;5;111',
1713
- success: '38;5;82',
1714
- warning: '38;5;220',
1715
- danger: '38;5;203',
1716
- muted: '2;38;5;245',
1762
+ command: '38;5;71',
1763
+ code: '38;5;109',
1764
+ success: '38;5;71',
1765
+ warning: '38;5;179',
1766
+ danger: '38;5;167',
1767
+ muted: '2;38;5;244',
1717
1768
  };
1718
1769
 
1719
1770
  function titleText(value) {
@@ -1868,6 +1919,13 @@ const TABLE_COLUMNS = {
1868
1919
  column('安全', (row) => (row.safety?.safeToAutoRun ? '可自动运行' : '需确认/写入'), { maxWidth: 14 }),
1869
1920
  column('说明', 'summary', { maxWidth: 44 }),
1870
1921
  ],
1922
+ creditRecords: [
1923
+ column('时间', 'operationTime', { maxWidth: 20 }),
1924
+ column('标题', 'title', { maxWidth: 18 }),
1925
+ column('积分', 'point', { maxWidth: 10 }),
1926
+ column('项目组', 'projectGroupName', { maxWidth: 20 }),
1927
+ column('用户', 'userName', { maxWidth: 16 }),
1928
+ ],
1871
1929
  domains: [
1872
1930
  column('领域', 'name', { maxWidth: 14 }),
1873
1931
  column('命令数', 'commandCount', { maxWidth: 10 }),
@@ -2771,7 +2829,7 @@ function formatPrettyModelInputGuide(data = {}, context = {}) {
2771
2829
 
2772
2830
  function formatPrettyGeneric(commandName, data, context = {}) {
2773
2831
  const normalized = normalizeOutputData(commandName, data);
2774
- const kind = outputKindForCommand(commandName, context);
2832
+ const kind = outputKindForCommand(commandName, context, normalized);
2775
2833
  if (!isPlainObject(normalized)) {
2776
2834
  const lines = [prettyTitle(commandName, kind, data), ''];
2777
2835
  renderDetails(lines, '结果', { value: normalized }, ['value']);
@@ -2861,7 +2919,7 @@ function csvColumnsForRows(rows = []) {
2861
2919
 
2862
2920
  export function formatCsvOutput(commandName, data, context = {}) {
2863
2921
  const normalized = normalizeJsonData(commandName, data);
2864
- const kind = outputKindForCommand(commandName, context);
2922
+ const kind = outputKindForCommand(commandName, context, normalized);
2865
2923
  const primaryKey = LIST_KEY_BY_KIND[kind];
2866
2924
  const list = primaryKey && Array.isArray(normalized?.[primaryKey])
2867
2925
  ? { key: primaryKey, rows: normalized[primaryKey] }
@@ -2921,6 +2979,7 @@ export function formatTextOutput(commandName, data, context = {}) {
2921
2979
  'publicId',
2922
2980
  'remoteTaskId',
2923
2981
  'pointNo',
2982
+ 'benefitsId',
2924
2983
  'taskType',
2925
2984
  'taskStatus',
2926
2985
  'modelCode',
@@ -2983,7 +3042,15 @@ export function formatTextOutput(commandName, data, context = {}) {
2983
3042
  'projectBudgetBalance',
2984
3043
  'projectBudgetMax',
2985
3044
  'projectBudgetRemainingAfter',
3045
+ 'remainPoint',
3046
+ 'dataPlanPoint',
3047
+ 'topUpPoint',
3048
+ 'queryType',
2986
3049
  'pointTotal',
3050
+ 'total',
3051
+ 'page',
3052
+ 'pages',
3053
+ 'size',
2987
3054
  'dryRun',
2988
3055
  'action',
2989
3056
  ],
@@ -2993,9 +3060,10 @@ export function formatTextOutput(commandName, data, context = {}) {
2993
3060
  if (list) {
2994
3061
  const total = list.rows.length;
2995
3062
  lines.push(`${list.key}.count=${total}`);
3063
+ const defaultListLimit = commandName === 'credits records' ? list.rows.length : 8;
2996
3064
  const configuredLimit = context.listLimit === Number.POSITIVE_INFINITY
2997
3065
  ? list.rows.length
2998
- : (Number.isFinite(context.listLimit) ? context.listLimit : 8);
3066
+ : (Number.isFinite(context.listLimit) ? context.listLimit : defaultListLimit);
2999
3067
  const visibleLimit = Math.max(0, configuredLimit);
3000
3068
  const visibleRows = list.rows.slice(0, visibleLimit);
3001
3069
  for (const [index, row] of visibleRows.entries()) {