@lingjingai/lj-awb-cli 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingjingai/lj-awb-cli",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Lingjing AWB CLI monorepo with shared core, standalone CLI, and agent skills",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingjingai/awb-cli-bin",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Standalone CLI for Lingjing AWB",
5
5
  "private": true,
6
6
  "license": "MIT",
@@ -13,6 +13,6 @@
13
13
  "README.md"
14
14
  ],
15
15
  "dependencies": {
16
- "@lingjingai/awb-core": "0.4.1"
16
+ "@lingjingai/awb-core": "0.4.2"
17
17
  }
18
18
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingjingai/awb-core",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Shared core runtime for Lingjing AWB CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -72,6 +72,14 @@ const REMOTE_VOICE_EXTENSIONS = new Set(['.mp3', '.wav', '.m4a', '.aac', '.ogg',
72
72
  const ASSET_PLATFORM_CODES = ['JIMENG', 'BYTEPLUS'];
73
73
  const ASSET_PLATFORM_CODE_SET = new Set(ASSET_PLATFORM_CODES);
74
74
  const ASSET_PLATFORM_HINT = ASSET_PLATFORM_CODES.join('|');
75
+ const PLATFORM_BACKEND_PATH_PREFIXES = [
76
+ 'material/',
77
+ 'material-image-draw/',
78
+ 'material-image-edit/',
79
+ 'material-video-create/',
80
+ 'default/workbench/',
81
+ 'asset-review/',
82
+ ];
75
83
  const CREATE_STANDARD_KWARG_KEYS = new Set([
76
84
  'modelGroupCode',
77
85
  'projectGroupNo',
@@ -1262,7 +1270,7 @@ function assertResourceShapeAgainstModel(resourceDetails = [], resourceRules = [
1262
1270
  if (conversion && !conversion.possible) {
1263
1271
  throw argumentError(
1264
1272
  `素材格式需要转换但无法自动处理:${resourceText(resource)}`,
1265
- `当前格式 ${conversion.fromFormat},目标格式 ${conversion.toFormat};请使用本地文件、http(s) URL 或 material backendPath,asset 资源需先转换后再传。`,
1273
+ `当前格式 ${conversion.fromFormat},目标格式 ${conversion.toFormat};请使用本地文件、http(s) URL 或平台 backendPath,asset 资源需先转换后再传。`,
1266
1274
  );
1267
1275
  }
1268
1276
  if (!conversion && !fileTypeAllowedByRule(rule, format)) {
@@ -1615,7 +1623,11 @@ function mergeModelParamRules(options = [], rawModel = null) {
1615
1623
  function modelParamDefaultValue(option = {}) {
1616
1624
  return option.rules?.defaultValue
1617
1625
  ?? option.defaultValue
1618
- ?? option.rules?.defaultName
1626
+ ?? null;
1627
+ }
1628
+
1629
+ function modelParamDefaultName(option = {}) {
1630
+ return option.rules?.defaultName
1619
1631
  ?? option.defaultName
1620
1632
  ?? null;
1621
1633
  }
@@ -1630,7 +1642,7 @@ function modelParamValueSource(option = {}) {
1630
1642
  function isGenericModelConfigParam(option = {}) {
1631
1643
  const key = trimToNull(option.paramKey);
1632
1644
  if (!key) return false;
1633
- if ([
1645
+ const internalResourceKeys = new Set([
1634
1646
  'generated_mode',
1635
1647
  'resources',
1636
1648
  'iref',
@@ -1639,11 +1651,17 @@ function isGenericModelConfigParam(option = {}) {
1639
1651
  'frames',
1640
1652
  'multi_param',
1641
1653
  'multi_prompt',
1642
- ].includes(key)) return false;
1643
- if (/resource|frame|image|video|audio|subject/i.test(key) && ![
1644
- 'need_audio',
1645
- 'audio',
1646
- ].includes(key)) return false;
1654
+ 'subject',
1655
+ 'subject_reference',
1656
+ 'reference_image',
1657
+ 'reference_audio',
1658
+ 'reference_video',
1659
+ 'first_frame',
1660
+ 'first_last_frame',
1661
+ 'last_frame_only',
1662
+ 'storyboard',
1663
+ ]);
1664
+ if (internalResourceKeys.has(key)) return false;
1647
1665
  const paramType = String(option.paramType || '');
1648
1666
  return Boolean(
1649
1667
  optionAllowedValues(option).length
@@ -1726,7 +1744,7 @@ function createParamForModelOption(option = {}, taskKind = 'image') {
1726
1744
  requestPath: 'promptParams.resources[]',
1727
1745
  materialLegacyKey: 'iref',
1728
1746
  meaning: '图片任务的参考图输入。',
1729
- valueSource: '本地文件、http(s) URL 或 material backendPath。',
1747
+ valueSource: '本地文件、http(s) URL 或平台 backendPath。',
1730
1748
  resourceSyntax: ['image:reference=./ref.png'],
1731
1749
  },
1732
1750
  resources: {
@@ -1735,7 +1753,7 @@ function createParamForModelOption(option = {}, taskKind = 'image') {
1735
1753
  requestPath: 'promptParams.resources[]',
1736
1754
  materialLegacyKey: 'resources',
1737
1755
  meaning: '模型声明的素材输入;CLI 统一用 resources 表达。',
1738
- valueSource: '本地文件、http(s) URL 或 material backendPath。',
1756
+ valueSource: '本地文件、http(s) URL 或平台 backendPath。',
1739
1757
  resourceSyntax: taskKind === 'image' ? ['image:reference=./ref.png'] : ['image:first_frame=./first.png'],
1740
1758
  },
1741
1759
  frames: {
@@ -1744,7 +1762,7 @@ function createParamForModelOption(option = {}, taskKind = 'image') {
1744
1762
  requestPath: 'promptParams.resources[]',
1745
1763
  materialLegacyKey: 'frames',
1746
1764
  meaning: '视频首帧 / 尾帧 / 关键帧输入。',
1747
- valueSource: '首帧/尾帧可用本地文件、http(s) URL、material backendPath 或 asset:<assetId>;keyframe 仅用文件/URL/backendPath。',
1765
+ valueSource: '首帧/尾帧可用本地文件、http(s) URL、平台 backendPath 或 asset:<assetId>;keyframe 仅用文件/URL/backendPath。',
1748
1766
  resourceSyntax: ['image:first_frame=./first.png', 'image:first_frame=asset:<assetId>', 'image:last_frame=asset:<assetId>', 'image:keyframe#1=./key1.png'],
1749
1767
  },
1750
1768
  multi_param: {
@@ -2318,7 +2336,7 @@ function modelOptionParams(options = [], taskKind = 'image') {
2318
2336
  valueType: cliValueType(option, allowedValues),
2319
2337
  values: allowedValues.length ? allowedValues : undefined,
2320
2338
  defaultValue,
2321
- defaultName: rules.defaultName ?? option.defaultName,
2339
+ defaultName: modelParamDefaultName(option),
2322
2340
  maxLength,
2323
2341
  required,
2324
2342
  cliArg: createParam.cliArg,
@@ -2423,7 +2441,7 @@ export function modelInputGuide() {
2423
2441
  { field: 'resources[].type', values: ['image', 'video', 'audio', 'subject'], description: '资源本体类型;subject 表示已创建的主体对象。' },
2424
2442
  { field: 'resources[].usage', values: ['first_frame', 'last_frame', 'reference', 'keyframe'], description: '素材用途。' },
2425
2443
  { field: 'resources[].reference_key', values: ['custom string'], description: '仅视频 reference 资源需要占位绑定时使用;图片生图 image:reference 不使用 reference_key。subject reference 必须传。' },
2426
- { field: 'resources[].source.kind', values: ['url', 'asset_id'], description: '只接受 url、asset_id 两个枚举值。本地文件、http(s) URL、material backendPath 一律传 kind=url,CLI 按 value 自动识别;asset_id 表示平台资产或主体对象 ID。注意:模型 resources[].valueShapes 列出的 local_file / http_url / backendPath 是 value 形状分类,不是 kind 枚举。' },
2444
+ { field: 'resources[].source.kind', values: ['url', 'asset_id'], description: '只接受 url、asset_id 两个枚举值。本地文件、http(s) URL、平台 backendPath 一律传 kind=url,CLI 按 value 自动识别;asset_id 表示平台资产或主体对象 ID。注意:模型 resources[].valueShapes 列出的 local_file / http_url / backendPath 是 value 形状分类,不是 kind 枚举。' },
2427
2445
  { field: 'resources[].source.value', description: '资源值,必填。url 传素材地址;asset_id 传资源 ID。' },
2428
2446
  { field: 'resources[].order', description: '仅 usage=keyframe 时需要,且同一请求内不能重复。' },
2429
2447
  { field: 'resources[].duration', description: '仅 keyframe 场景下用于表达该帧持续时长,可传小数秒。' },
@@ -2644,14 +2662,26 @@ function isHttpUrl(value) {
2644
2662
  return /^https?:\/\//i.test(String(value || '').trim());
2645
2663
  }
2646
2664
 
2665
+ function backendObjectName(value) {
2666
+ const text = trimToNull(value);
2667
+ if (!text) return null;
2668
+ return text.replace(/^\/+/, '');
2669
+ }
2670
+
2671
+ function isPlatformBackendPath(value) {
2672
+ const objectName = backendObjectName(value);
2673
+ if (!objectName || /^[a-z][a-z0-9+.-]*:\/\//i.test(objectName)) return false;
2674
+ return PLATFORM_BACKEND_PATH_PREFIXES.some((prefix) => objectName.startsWith(prefix));
2675
+ }
2676
+
2647
2677
  function isUploadedMaterialReference(value) {
2648
2678
  const text = trimToNull(value);
2649
2679
  if (!text) return false;
2650
- if (text.startsWith('material/') || text.startsWith('/material/')) return true;
2680
+ if (isPlatformBackendPath(text)) return true;
2651
2681
  if (!isHttpUrl(text)) return false;
2652
2682
  try {
2653
2683
  const url = new URL(text);
2654
- return url.hostname.endsWith('.myqcloud.com');
2684
+ return url.hostname.endsWith('.myqcloud.com') && isPlatformBackendPath(decodeURIComponent(url.pathname));
2655
2685
  } catch {
2656
2686
  return false;
2657
2687
  }
@@ -2752,8 +2782,8 @@ async function resolveRemoteResourceDownloadUrl(value) {
2752
2782
  const text = trimToNull(value);
2753
2783
  if (!text) throw argumentError('远程图片来源为空');
2754
2784
  if (/^https?:\/\//i.test(text)) return text;
2755
- if (text.startsWith('material/') || text.startsWith('/material/')) {
2756
- const objectName = text.replace(/^\/+/, '');
2785
+ if (isPlatformBackendPath(text)) {
2786
+ const objectName = backendObjectName(text);
2757
2787
  const signed = await awbApi.fetchObjectSignUrl(objectName);
2758
2788
  const signedUrl = firstHttpUrl(signed);
2759
2789
  if (signedUrl) return signedUrl;
@@ -2765,7 +2795,7 @@ async function resolveRemoteResourceDownloadUrl(value) {
2765
2795
  }
2766
2796
  throw argumentError(
2767
2797
  `远程图片来源不支持自动转换:${text}`,
2768
- '请传 http(s) URL、material backendPath,或先下载为本地文件后重试。',
2798
+ '请传 http(s) URL、平台 backendPath,或先下载为本地文件后重试。',
2769
2799
  );
2770
2800
  }
2771
2801
 
@@ -2826,7 +2856,7 @@ async function downloadRemoteImageFileToTemp(sourceValue, options = {}) {
2826
2856
  throw new LingjingAwbCliError(`下载远程图片失败:${error.message}`, {
2827
2857
  type: 'network_error',
2828
2858
  exitCode: 30,
2829
- hint: isAbort ? `远程下载超过 ${timeoutMs}ms,请改用本地文件或已上传 material 路径。` : '',
2859
+ hint: isAbort ? `远程下载超过 ${timeoutMs}ms,请改用本地文件或已上传平台 backendPath。` : '',
2830
2860
  details: { url: sourceValue, causeCode: error?.cause?.code },
2831
2861
  });
2832
2862
  } finally {
@@ -2888,7 +2918,7 @@ async function downloadRemoteFileToTemp(remoteUrl, options = {}) {
2888
2918
  throw new LingjingAwbCliError(`下载远程音频失败:${error.message}`, {
2889
2919
  type: 'network_error',
2890
2920
  exitCode: 30,
2891
- hint: isAbort ? `远程下载超过 ${timeoutMs}ms,请改用本地 --file 或已上传 material 路径。` : '',
2921
+ hint: isAbort ? `远程下载超过 ${timeoutMs}ms,请改用本地 --file 或已上传平台 backendPath。` : '',
2892
2922
  details: { url: remoteUrl, causeCode: error?.cause?.code },
2893
2923
  });
2894
2924
  } finally {
@@ -2964,7 +2994,7 @@ function parseModelParamAssignments(value) {
2964
2994
  }
2965
2995
 
2966
2996
  async function collectGenericModelParams(kwargs = {}) {
2967
- const fromJson = await parseModelParamsJsonArg(kwargs.modelParamsJson);
2997
+ const fromJson = await parseModelParamsJsonArg(kwargs.modelParamsJson ?? kwargs.model_params_json);
2968
2998
  const fromObject = kwargs.modelParams && typeof kwargs.modelParams === 'object' && !Array.isArray(kwargs.modelParams)
2969
2999
  ? kwargs.modelParams
2970
3000
  : {};
@@ -3022,7 +3052,7 @@ function normalizeResourceSource(source, type, index, options = {}) {
3022
3052
  if (!['url', 'asset_id'].includes(kind)) {
3023
3053
  throw argumentError(
3024
3054
  `resource[${index}] source.kind 不支持:${explicitKind}`,
3025
- '只支持 url、asset_id 两个值。本地文件 / http(s) URL / material backendPath 都统一传 kind=url(CLI 按 value 自动识别);平台资产或主体对象传 kind=asset_id。',
3055
+ '只支持 url、asset_id 两个值。本地文件 / http(s) URL / 平台 backendPath 都统一传 kind=url(CLI 按 value 自动识别);平台资产或主体对象传 kind=asset_id。',
3026
3056
  );
3027
3057
  }
3028
3058
  const value = kind === 'asset_id' ? assetValue : rawValue;
@@ -3183,17 +3213,16 @@ function isRemoteOrBackendPath(value) {
3183
3213
  if (!text) return false;
3184
3214
  return /^https?:\/\//i.test(text)
3185
3215
  || /^[a-z][a-z0-9+.-]*:\/\//i.test(text)
3186
- || text.startsWith('material/')
3187
- || text.startsWith('/material/');
3216
+ || isPlatformBackendPath(text);
3188
3217
  }
3189
3218
 
3190
- function normalizeMaterialUrlValue(value) {
3219
+ function normalizeBackendPathUrlValue(value) {
3191
3220
  const text = trimToNull(value);
3192
3221
  if (!text) return text;
3193
3222
  if (/^https?:\/\//i.test(text)) {
3194
3223
  try {
3195
3224
  const pathname = decodeURIComponent(new URL(text).pathname);
3196
- if (pathname.startsWith('/material/')) return pathname;
3225
+ if (isPlatformBackendPath(pathname)) return pathname;
3197
3226
  } catch {}
3198
3227
  }
3199
3228
  return text;
@@ -3329,13 +3358,13 @@ async function resolveResourceFileValue(resource, options = {}) {
3329
3358
  await fs.rm(downloaded.dir, { recursive: true, force: true }).catch(() => {});
3330
3359
  }
3331
3360
  }
3332
- return { resource: { ...base, source: { kind: 'url', value: normalizeMaterialUrlValue(value) } }, upload: null, localFile: null };
3361
+ return { resource: { ...base, source: { kind: 'url', value: normalizeBackendPathUrlValue(value) } }, upload: null, localFile: null };
3333
3362
  }
3334
3363
  const inspected = await inspectLocalFile(value);
3335
3364
  if (!inspected.exists) {
3336
3365
  throw argumentError(
3337
3366
  `资源文件不存在:${value}`,
3338
- 'source.kind=url 只接受完整 http(s) URL、material backendPath,或当前工作目录下存在的本地文件路径。',
3367
+ 'source.kind=url 只接受完整 http(s) URL、平台 backendPath,或当前工作目录下存在的本地文件路径。',
3339
3368
  );
3340
3369
  }
3341
3370
  const conversion = options.resourceRules
@@ -3818,6 +3847,7 @@ function normalizeTaskBatchItem(item, kind, index) {
3818
3847
  if (next.need_audio != null && next.needAudio == null) next.needAudio = next.need_audio;
3819
3848
  if (next.model_param != null && next.modelParam == null) next.modelParam = next.model_param;
3820
3849
  if (next.model_params != null && next.modelParams == null) next.modelParams = next.model_params;
3850
+ if (next.model_params_json != null && next.modelParamsJson == null) next.modelParamsJson = next.model_params_json;
3821
3851
  return next;
3822
3852
  }
3823
3853
 
@@ -4072,7 +4102,8 @@ function normalizeCosAssetPath(value) {
4072
4102
  if (!text) return null;
4073
4103
  if (/^https?:\/\//i.test(text)) {
4074
4104
  try {
4075
- return decodeURIComponent(new URL(text).pathname.replace(/^\/+/, ''));
4105
+ const pathname = decodeURIComponent(new URL(text).pathname);
4106
+ return isPlatformBackendPath(pathname) ? pathname.replace(/^\/+/, '') : text;
4076
4107
  } catch {
4077
4108
  return text.replace(/^\/+/, '');
4078
4109
  }
@@ -1476,7 +1476,7 @@ function validateCommandOptions(command, kwargs, kwargRawFlags = {}) {
1476
1476
  const allowed = new Set(allowedKeys);
1477
1477
  const unknown = Object.keys(kwargs).filter((key) => (
1478
1478
  !allowed.has(key)
1479
- && !(command.allowDynamicModelParams && key.includes('_'))
1479
+ && !(command.allowDynamicModelParams && isAllowedDynamicModelParamFlag(key))
1480
1480
  ));
1481
1481
  if (!unknown.length) return;
1482
1482
  const displayFlag = (key) => kwargRawFlags[key] || formatOptionName(key);
@@ -1525,6 +1525,10 @@ function normalizeDynamicModelParamFlags(command, kwargs = {}, kwargRawFlags = {
1525
1525
  }
1526
1526
  }
1527
1527
 
1528
+ function isAllowedDynamicModelParamFlag(key) {
1529
+ return /^(generation|prompt|negative|seed|style|mode|cfg|guidance|aspect|image|video|audio|subject|output|response|media|safety|watermark|camera|motion|strength|steps)_/i.test(String(key || ''));
1530
+ }
1531
+
1528
1532
  function printData(data, format, meta = {}, context = {}) {
1529
1533
  const outputFormat = resolveOutputFormat(format);
1530
1534
  if (outputFormat === 'json') {
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: lj-awb
3
- version: 0.4.1
3
+ version: 0.4.2
4
4
  description: "灵境 AWB CLI skill。使用 `lj-awb` 命令调用动漫平台 / AWB 云端能力,覆盖认证、项目组、积分、模型发现、上传、统一 create 创建域、任务查询、最终产物 artifact CRUD 与本地 JSON 导入。用户说生图、生视频、主体、音色、素材加白、去字幕、artifact 写入或查询时使用。正式生成、切换项目组、清空认证、artifact 写入等写入或扣费动作前必须确认。"
5
5
  metadata:
6
6
  bootstrap:
7
7
  package: "@lingjingai/lj-awb-cli"
8
- version: "0.4.1"
8
+ version: "0.4.2"
9
9
  bin: "lj-awb"
10
10
  cliHelp: "lj-awb --help"
11
11
  ---
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
@@ -1,6 +1,6 @@
1
1
  {
2
- "skillVersion": "0.4.1",
3
- "minCliVersion": "0.4.1",
2
+ "skillVersion": "0.4.2",
3
+ "minCliVersion": "0.4.2",
4
4
  "preferredCommand": "lj-awb",
5
5
  "updatedAt": "2026-05-26"
6
6
  }