@actionway/cli 0.18.21 → 0.18.22

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 (2) hide show
  1. package/dist/index.js +132 -132
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9981,6 +9981,134 @@ ${spec.helpText}`);
9981
9981
  });
9982
9982
  }
9983
9983
 
9984
+ // ../contracts/src/compatibility.ts
9985
+ var LEGACY_VARIANT_ALIASES = {
9986
+ "media.video.generate": {
9987
+ dli2v3: "image-video-v3",
9988
+ dlim2v: "motion-video",
9989
+ dlai2v: "ai-video",
9990
+ dlai2v_pro: "ai-video-pro",
9991
+ dlai2v_pro_multiframe: "ai-video-pro-multiframe",
9992
+ "happyhorse-1-0-i2v": "happyhorse-i2v",
9993
+ "happyhorse-1-0-r2v": "happyhorse-r2v",
9994
+ "happyhorse-1-0-video-edit": "happyhorse-video-edit",
9995
+ "kling3.0": "kling-3",
9996
+ "grok-imagine-1.5": "grok-imagine-1-5"
9997
+ },
9998
+ "media.music.generate": { "suno-v5_5": "suno-v5-5" },
9999
+ "media.video.lipsync": { dlai2v_pro: "ai-video-pro", dlai2v_pro_multiframe: "ai-video-pro-multiframe" },
10000
+ "media.video.motion-control": { "kling3.0-motion": "kling-motion" }
10001
+ };
10002
+ function canonicalVariantId(toolRef, value) {
10003
+ return LEGACY_VARIANT_ALIASES[toolRef]?.[value] ?? value;
10004
+ }
10005
+
10006
+ // ../cli-core/src/commands/typed-tool-projection.ts
10007
+ function without(source, keys) {
10008
+ const output = { ...source };
10009
+ for (const key of keys) delete output[key];
10010
+ return output;
10011
+ }
10012
+ function strings2(value) {
10013
+ if (typeof value === "string" && value) return [value];
10014
+ return Array.isArray(value) ? value.filter((item) => typeof item === "string" && item.length > 0) : [];
10015
+ }
10016
+ function serviceProjection(toolRef, params, extraDrop = []) {
10017
+ const variantId = typeof params.service === "string" ? canonicalVariantId(toolRef, params.service) : void 0;
10018
+ return {
10019
+ toolRef,
10020
+ ...variantId ? { variantId } : {},
10021
+ arguments: without(params, ["service", ...extraDrop])
10022
+ };
10023
+ }
10024
+ function imageProjection(params) {
10025
+ const referenceUrls = [
10026
+ ...strings2(params.img_url),
10027
+ ...strings2(params.image),
10028
+ ...strings2(params.image_urls)
10029
+ ];
10030
+ const args = without(params, ["service", "img_url", "image", "image_urls", "model", "vendor"]);
10031
+ if (referenceUrls.length) args.reference_urls = [...new Set(referenceUrls)];
10032
+ return {
10033
+ toolRef: "media.image.generate",
10034
+ variantId: canonicalVariantId("media.image.generate", String(params.service)),
10035
+ arguments: args
10036
+ };
10037
+ }
10038
+ function videoProjection(params) {
10039
+ const args = without(params, ["service", "refs_from", "_reference_subject_type"]);
10040
+ if (args.ark_asset_ids !== void 0) {
10041
+ args.asset_ids = args.ark_asset_ids;
10042
+ delete args.ark_asset_ids;
10043
+ }
10044
+ return { toolRef: "media.video.generate", variantId: canonicalVariantId("media.video.generate", String(params.service)), arguments: args };
10045
+ }
10046
+ function searchProjection(params, prepared) {
10047
+ const provider = String(params.provider ?? "");
10048
+ const body = prepared.body ?? {};
10049
+ if (provider === "baidu-image") {
10050
+ const { image, count, ...extras2 } = body;
10051
+ return {
10052
+ toolRef: "web.image.search",
10053
+ variantId: "baidu-similar",
10054
+ arguments: { image_base64: image, k: count, ...Object.keys(extras2).length ? { params: extras2 } : {} }
10055
+ };
10056
+ }
10057
+ const args = {
10058
+ query: params.query,
10059
+ ...params.k !== void 0 ? { k: params.k } : {},
10060
+ ...params.resource_type !== void 0 ? { resource_type: params.resource_type } : {},
10061
+ ...params.country !== void 0 ? { country: params.country } : {},
10062
+ ...params.freshness !== void 0 ? { freshness: params.freshness } : {}
10063
+ };
10064
+ let extras = {};
10065
+ if (provider === "baidu") extras = without(body, ["messages", "search_source", "resource_type_filter", "search_recency_filter"]);
10066
+ else if (provider === "serper") extras = without(body, ["q", "num", "gl", "tbs"]);
10067
+ else if (provider === "tavily") extras = without(body, ["query", "max_results", "search_depth", "time_range"]);
10068
+ else if (provider === "brave" && prepared.endpoint) {
10069
+ const query = new URL(`https://actionway.invalid/${prepared.endpoint}`).searchParams;
10070
+ for (const [key, value] of query) if (!["q", "count", "country", "freshness"].includes(key)) extras[key] = value;
10071
+ }
10072
+ if (Object.keys(extras).length) args.params = extras;
10073
+ return { toolRef: "web.search", variantId: provider, arguments: args };
10074
+ }
10075
+ function projectTypedToolCall(spec, commandParams, prepared) {
10076
+ const params = prepared.body ?? commandParams;
10077
+ switch (spec.name) {
10078
+ case "generate-image-prompt":
10079
+ case "generate-image-ref":
10080
+ return imageProjection(params);
10081
+ case "generate-video":
10082
+ return videoProjection(params);
10083
+ case "generate-music":
10084
+ return serviceProjection("media.music.generate", params);
10085
+ case "generate-tts":
10086
+ return serviceProjection("media.audio.tts", params);
10087
+ case "lipsync":
10088
+ return serviceProjection("media.video.lipsync", params);
10089
+ case "motion-control":
10090
+ return serviceProjection("media.video.motion-control", params);
10091
+ case "transcribe":
10092
+ return { toolRef: "media.audio.transcribe", arguments: params };
10093
+ case "search":
10094
+ return searchProjection(commandParams, prepared);
10095
+ case "detect-shots":
10096
+ return { toolRef: "media.video.detect-shots", arguments: params };
10097
+ case "download-media":
10098
+ return { toolRef: "media.download", arguments: params };
10099
+ case "analyze-beats":
10100
+ return { toolRef: "media.audio.analyze-beats", arguments: params };
10101
+ case "generate-sound":
10102
+ return { toolRef: "media.audio.sound.generate", arguments: without(params, ["service"]) };
10103
+ case "generate-lyrics":
10104
+ return { toolRef: "media.lyrics.generate", arguments: params };
10105
+ case "fetch":
10106
+ return { toolRef: "web.fetch", arguments: params };
10107
+ default:
10108
+ return null;
10109
+ }
10110
+ }
10111
+
9984
10112
  // ../cli-core/src/commands/validation.ts
9985
10113
  function schema(message, hint, extra) {
9986
10114
  throw new CliError("E_SCHEMA", message, hint, extra);
@@ -9990,7 +10118,7 @@ function nonEmpty(value) {
9990
10118
  if (Array.isArray(value)) return value.length > 0;
9991
10119
  return value !== void 0 && value !== null;
9992
10120
  }
9993
- function strings2(value) {
10121
+ function strings3(value) {
9994
10122
  if (!Array.isArray(value)) return [];
9995
10123
  return value.filter((item) => typeof item === "string" && item.trim() !== "");
9996
10124
  }
@@ -10035,9 +10163,9 @@ function validateMinimaxH3Video(params) {
10035
10163
  if (params.resolution !== void 0 && String(params.resolution).toLowerCase() !== "2k") {
10036
10164
  schema("--resolution must be 2K for minimax-h3");
10037
10165
  }
10038
- const images = strings2(params.image_urls);
10039
- const videos = strings2(params.video_urls);
10040
- const audios = strings2(params.reference_audio_urls);
10166
+ const images = strings3(params.image_urls);
10167
+ const videos = strings3(params.video_urls);
10168
+ const audios = strings3(params.reference_audio_urls);
10041
10169
  const singleVideo = nonEmpty(params.ref_video_url);
10042
10170
  const singleAudio = nonEmpty(params.reference_audio_url);
10043
10171
  const hasFrames = nonEmpty(params.image_url) || nonEmpty(params.last_frame_url);
@@ -13795,134 +13923,6 @@ function getTransport(env = process.env, fetchImpl, clientContext) {
13795
13923
  });
13796
13924
  }
13797
13925
 
13798
- // ../contracts/src/compatibility.ts
13799
- var LEGACY_VARIANT_ALIASES = {
13800
- "media.video.generate": {
13801
- dli2v3: "image-video-v3",
13802
- dlim2v: "motion-video",
13803
- dlai2v: "ai-video",
13804
- dlai2v_pro: "ai-video-pro",
13805
- dlai2v_pro_multiframe: "ai-video-pro-multiframe",
13806
- "happyhorse-1-0-i2v": "happyhorse-i2v",
13807
- "happyhorse-1-0-r2v": "happyhorse-r2v",
13808
- "happyhorse-1-0-video-edit": "happyhorse-video-edit",
13809
- "kling3.0": "kling-3",
13810
- "grok-imagine-1.5": "grok-imagine-1-5"
13811
- },
13812
- "media.music.generate": { "suno-v5_5": "suno-v5-5" },
13813
- "media.video.lipsync": { dlai2v_pro: "ai-video-pro", dlai2v_pro_multiframe: "ai-video-pro-multiframe" },
13814
- "media.video.motion-control": { "kling3.0-motion": "kling-motion" }
13815
- };
13816
- function canonicalVariantId(toolRef, value) {
13817
- return LEGACY_VARIANT_ALIASES[toolRef]?.[value] ?? value;
13818
- }
13819
-
13820
- // src/lib/typed-tool-projection.ts
13821
- function without(source, keys) {
13822
- const output = { ...source };
13823
- for (const key of keys) delete output[key];
13824
- return output;
13825
- }
13826
- function strings3(value) {
13827
- if (typeof value === "string" && value) return [value];
13828
- return Array.isArray(value) ? value.filter((item) => typeof item === "string" && item.length > 0) : [];
13829
- }
13830
- function serviceProjection(toolRef, params, extraDrop = []) {
13831
- const variantId = typeof params.service === "string" ? canonicalVariantId(toolRef, params.service) : void 0;
13832
- return {
13833
- toolRef,
13834
- ...variantId ? { variantId } : {},
13835
- arguments: without(params, ["service", ...extraDrop])
13836
- };
13837
- }
13838
- function imageProjection(params) {
13839
- const referenceUrls = [
13840
- ...strings3(params.img_url),
13841
- ...strings3(params.image),
13842
- ...strings3(params.image_urls)
13843
- ];
13844
- const args = without(params, ["service", "img_url", "image", "image_urls", "model", "vendor"]);
13845
- if (referenceUrls.length) args.reference_urls = [...new Set(referenceUrls)];
13846
- return {
13847
- toolRef: "media.image.generate",
13848
- variantId: canonicalVariantId("media.image.generate", String(params.service)),
13849
- arguments: args
13850
- };
13851
- }
13852
- function videoProjection(params) {
13853
- const args = without(params, ["service", "refs_from", "_reference_subject_type"]);
13854
- if (args.ark_asset_ids !== void 0) {
13855
- args.asset_ids = args.ark_asset_ids;
13856
- delete args.ark_asset_ids;
13857
- }
13858
- return { toolRef: "media.video.generate", variantId: canonicalVariantId("media.video.generate", String(params.service)), arguments: args };
13859
- }
13860
- function searchProjection(params, prepared) {
13861
- const provider = String(params.provider ?? "");
13862
- const body = prepared.body ?? {};
13863
- if (provider === "baidu-image") {
13864
- const { image, count, ...extras2 } = body;
13865
- return {
13866
- toolRef: "web.image.search",
13867
- variantId: "baidu-similar",
13868
- arguments: { image_base64: image, k: count, ...Object.keys(extras2).length ? { params: extras2 } : {} }
13869
- };
13870
- }
13871
- const args = {
13872
- query: params.query,
13873
- ...params.k !== void 0 ? { k: params.k } : {},
13874
- ...params.resource_type !== void 0 ? { resource_type: params.resource_type } : {},
13875
- ...params.country !== void 0 ? { country: params.country } : {},
13876
- ...params.freshness !== void 0 ? { freshness: params.freshness } : {}
13877
- };
13878
- let extras = {};
13879
- if (provider === "baidu") extras = without(body, ["messages", "search_source", "resource_type_filter", "search_recency_filter"]);
13880
- else if (provider === "serper") extras = without(body, ["q", "num", "gl", "tbs"]);
13881
- else if (provider === "tavily") extras = without(body, ["query", "max_results", "search_depth", "time_range"]);
13882
- else if (provider === "brave" && prepared.endpoint) {
13883
- const query = new URL(`https://actionway.invalid/${prepared.endpoint}`).searchParams;
13884
- for (const [key, value] of query) if (!["q", "count", "country", "freshness"].includes(key)) extras[key] = value;
13885
- }
13886
- if (Object.keys(extras).length) args.params = extras;
13887
- return { toolRef: "web.search", variantId: provider, arguments: args };
13888
- }
13889
- function projectTypedToolCall(spec, commandParams, prepared) {
13890
- const params = prepared.body ?? commandParams;
13891
- switch (spec.name) {
13892
- case "generate-image-prompt":
13893
- case "generate-image-ref":
13894
- return imageProjection(params);
13895
- case "generate-video":
13896
- return videoProjection(params);
13897
- case "generate-music":
13898
- return serviceProjection("media.music.generate", params);
13899
- case "generate-tts":
13900
- return serviceProjection("media.audio.tts", params);
13901
- case "lipsync":
13902
- return serviceProjection("media.video.lipsync", params);
13903
- case "motion-control":
13904
- return serviceProjection("media.video.motion-control", params);
13905
- case "transcribe":
13906
- return { toolRef: "media.audio.transcribe", arguments: params };
13907
- case "search":
13908
- return searchProjection(commandParams, prepared);
13909
- case "detect-shots":
13910
- return { toolRef: "media.video.detect-shots", arguments: params };
13911
- case "download-media":
13912
- return { toolRef: "media.download", arguments: params };
13913
- case "analyze-beats":
13914
- return { toolRef: "media.audio.analyze-beats", arguments: params };
13915
- case "generate-sound":
13916
- return { toolRef: "media.audio.sound.generate", arguments: without(params, ["service"]) };
13917
- case "generate-lyrics":
13918
- return { toolRef: "media.lyrics.generate", arguments: params };
13919
- case "fetch":
13920
- return { toolRef: "web.fetch", arguments: params };
13921
- default:
13922
- return null;
13923
- }
13924
- }
13925
-
13926
13926
  // src/index.ts
13927
13927
  function buildProgram() {
13928
13928
  const distribution = cliDistribution();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actionway/cli",
3
- "version": "0.18.21",
3
+ "version": "0.18.22",
4
4
  "description": "actionway CLI 的本地端壳:Clerk OAuth 鉴权 + cli-core 共享命令面 + init / update / skill 物化 / 版本三链路(终端用户本地 Codex / Claude Code / WorkBuddy 使用)",
5
5
  "type": "module",
6
6
  "bin": {