@mindscraft/branch-video-agent-cli 0.3.1 → 0.3.3

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/README.md CHANGED
@@ -127,20 +127,37 @@ AI Gateway 图片生成示例:
127
127
  '@ | npm exec --yes --package=@mindscraft/branch-video-agent-cli branch-video-agent -- ai-gateway image-generate -- --raw
128
128
  ```
129
129
 
130
- AI Gateway 视频生成并等待示例:
131
-
132
- ```powershell
133
- @'
130
+ AI Gateway 视频生成并等待示例:
131
+
132
+ ```powershell
133
+ @'
134
134
  {
135
135
  "model": "doubao-seedance-2-0-260128",
136
136
  "input": {
137
137
  "prompt": "镜头推进到实验台,卡通猫老师点亮一个小灯泡"
138
138
  }
139
139
  }
140
- '@ | npm exec --yes --package=@mindscraft/branch-video-agent-cli branch-video-agent -- ai-gateway video-create -- --wait --raw
141
- ```
142
-
143
- ## 在仓库内构建发布包
140
+ '@ | npm exec --yes --package=@mindscraft/branch-video-agent-cli branch-video-agent -- ai-gateway video-create -- --wait --raw
141
+ ```
142
+
143
+ AI Gateway Seed Audio 音频生成并等待示例:
144
+
145
+ ```powershell
146
+ @'
147
+ {
148
+ "model": "seed-audio-1.0",
149
+ "text_prompt": "温柔的女声朗读:欢迎使用豆包语音合成服务。背景加入轻柔科技感铺底音乐。",
150
+ "audio_config": {
151
+ "format": "mp3",
152
+ "sample_rate": 24000
153
+ }
154
+ }
155
+ '@ | npm exec --yes --package=@mindscraft/branch-video-agent-cli branch-video-agent -- ai-gateway seed-audio-create -- --wait --raw
156
+ ```
157
+
158
+ `tts-create` / `tts-get` 是 Seed Audio 的历史兼容别名;新脚本优先使用 `seed-audio-create` / `seed-audio-get`。
159
+
160
+ ## 在仓库内构建发布包
144
161
 
145
162
  从仓库根目录执行:
146
163
 
@@ -9,6 +9,11 @@ function appendQuery(path, params) {
9
9
  const queryString = query.toString();
10
10
  return queryString ? `${path}?${queryString}` : path;
11
11
  }
12
+ function getRequiredStringAlias(payload, camelKey, snakeKey) {
13
+ const camelValue = payload[camelKey];
14
+ const value = typeof camelValue === 'string' && camelValue.trim() ? camelValue : payload[snakeKey];
15
+ return getRequiredString({ [camelKey]: value }, camelKey);
16
+ }
12
17
  export const agentProductionCommands = {
13
18
  create: async ({ client, payload }) => {
14
19
  const result = await client.request('/api/branch-video/agent-production/create', {
@@ -68,13 +73,14 @@ export const agentProductionCommands = {
68
73
  return { data: result.data, requestId: result.requestId };
69
74
  },
70
75
  'node.submit': async ({ client, payload }) => {
71
- const dagRunId = getRequiredString(payload, 'dagRunId');
72
- const nodeId = getRequiredString(payload, 'nodeId');
76
+ const dagRunId = getRequiredStringAlias(payload, 'dagRunId', 'dag_run_id');
77
+ const nodeId = getRequiredStringAlias(payload, 'nodeId', 'node_id');
78
+ const nodeRunId = getRequiredStringAlias(payload, 'nodeRunId', 'node_run_id');
73
79
  const body = {
74
- ...omitKeys(payload, ['dagRunId', 'nodeId', 'nodeRunId']),
75
- dag_run_id: payload.dag_run_id || dagRunId,
76
- node_id: payload.node_id || nodeId,
77
- node_run_id: payload.node_run_id || payload.nodeRunId,
80
+ ...omitKeys(payload, ['dagRunId', 'dag_run_id', 'nodeId', 'node_id', 'nodeRunId', 'node_run_id']),
81
+ dag_run_id: dagRunId,
82
+ node_id: nodeId,
83
+ node_run_id: nodeRunId,
78
84
  };
79
85
  const result = await client.request(`/api/branch-video/agent-production/dag-runs/${encodeURIComponent(dagRunId)}/nodes/${encodeURIComponent(nodeId)}/submit`, {
80
86
  method: 'POST',
@@ -97,6 +97,26 @@ async function getMusicStatus(context, operation, id) {
97
97
  query: { id },
98
98
  });
99
99
  }
100
+ async function createSeedAudio(context) {
101
+ const result = await context.client.request('/api/agent/ai-gateway/tts/create', {
102
+ method: 'POST',
103
+ body: context.payload,
104
+ });
105
+ if (!context.flags.wait) {
106
+ return { data: result.data, requestId: result.requestId };
107
+ }
108
+ const taskId = extractTaskId(result.data);
109
+ const query = pickDefined(context.payload, ['model']);
110
+ return waitForGatewayTask(context, result.data, () => context.client.request(`/api/agent/ai-gateway/tts/query/${encodeURIComponent(taskId)}`, { method: 'GET', query }));
111
+ }
112
+ async function getSeedAudio({ client, payload }) {
113
+ const taskId = getRequiredString(payload, 'taskId');
114
+ const result = await client.request(`/api/agent/ai-gateway/tts/query/${encodeURIComponent(taskId)}`, {
115
+ method: 'GET',
116
+ query: pickDefined(payload, ['model']),
117
+ });
118
+ return { data: result.data, requestId: result.requestId };
119
+ }
100
120
  export const aiGatewayCommands = {
101
121
  capabilities: async ({ client }) => {
102
122
  const result = await client.request('/api/agent/ai-gateway/capabilities', {
@@ -153,6 +173,10 @@ export const aiGatewayCommands = {
153
173
  });
154
174
  return { data: result.data, requestId: result.requestId };
155
175
  },
176
+ 'seed-audio-create': createSeedAudio,
177
+ 'seed-audio-get': getSeedAudio,
178
+ 'tts-create': createSeedAudio,
179
+ 'tts-get': getSeedAudio,
156
180
  'music-submit': async (context) => {
157
181
  const operation = normalizeOperation(getRequiredString(context.payload, 'operation'));
158
182
  const body = context.payload.body === undefined
package/dist/lib/flags.js CHANGED
@@ -100,7 +100,7 @@ export function getCliHelpText() {
100
100
  ' agent-production create | status | cancel | finalize | autopilot-binding | events | metrics | multica-comment-payload | node claim|inputs|complete|submit|block|fail|retry|expire | blocker resolve | artifact submit|list | asset-job poll|retry|revise|attach-artifact|fail | gate evaluate|results',
101
101
  ' aihub-production schema | start | status | retry',
102
102
  ' character search | create | get',
103
- ' ai-gateway capabilities | request | image-generate | image-edit | video-create | video-get | music-submit | music-get',
103
+ ' ai-gateway capabilities | request | image-generate | image-edit | video-create | video-get | seed-audio-create | seed-audio-get | music-submit | music-get | tts-create | tts-get',
104
104
  '',
105
105
  'Config precedence:',
106
106
  ' AIHUB_AGENT_TOKEN / BRANCH_VIDEO_AGENT_BASE_URL > stdin JSON or --token-file > command flags',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindscraft/branch-video-agent-cli",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Published CLI for branch-video and AIHub agent APIs.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -33,4 +33,4 @@
33
33
  "prepack": "npm run build",
34
34
  "smoke:help": "npm run build && node dist/bin.js --help"
35
35
  }
36
- }
36
+ }