@mindscraft/branch-video-agent-cli 0.3.0 → 0.3.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.
- package/README.md +1 -1
- package/dist/commands/agentProduction.d.ts +2 -0
- package/dist/commands/agentProduction.js +214 -0
- package/dist/index.js +3 -1
- package/dist/lib/flags.js +3 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ branch-video-agent --help
|
|
|
34
34
|
- `AIHUB_AGENT_TOKEN`
|
|
35
35
|
- `BRANCH_VIDEO_AGENT_BASE_URL`
|
|
36
36
|
|
|
37
|
-
AI Gateway 调用同样只传 `AIHUB_AGENT_TOKEN
|
|
37
|
+
AI Gateway 调用同样只传 `AIHUB_AGENT_TOKEN`;CLI 不读取、不传递 `AiGatewayKey` 或 AIHub `projectKey`,上游鉴权由服务端处理。
|
|
38
38
|
|
|
39
39
|
最小调用示例:
|
|
40
40
|
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { getRequiredString, omitKeys } from '../lib/payload.js';
|
|
2
|
+
function appendQuery(path, params) {
|
|
3
|
+
const query = new URLSearchParams();
|
|
4
|
+
for (const [key, value] of Object.entries(params)) {
|
|
5
|
+
if (value === undefined || value === null || value === '')
|
|
6
|
+
continue;
|
|
7
|
+
query.set(key, String(value));
|
|
8
|
+
}
|
|
9
|
+
const queryString = query.toString();
|
|
10
|
+
return queryString ? `${path}?${queryString}` : path;
|
|
11
|
+
}
|
|
12
|
+
export const agentProductionCommands = {
|
|
13
|
+
create: async ({ client, payload }) => {
|
|
14
|
+
const result = await client.request('/api/branch-video/agent-production/create', {
|
|
15
|
+
method: 'POST',
|
|
16
|
+
body: payload,
|
|
17
|
+
});
|
|
18
|
+
return { data: result.data, requestId: result.requestId };
|
|
19
|
+
},
|
|
20
|
+
status: async ({ client, payload }) => {
|
|
21
|
+
const projectId = getRequiredString(payload, 'projectId');
|
|
22
|
+
const result = await client.request(`/api/branch-video/agent-production/${encodeURIComponent(projectId)}/status`, {
|
|
23
|
+
method: 'GET',
|
|
24
|
+
});
|
|
25
|
+
return { data: result.data, requestId: result.requestId };
|
|
26
|
+
},
|
|
27
|
+
cancel: async ({ client, payload }) => {
|
|
28
|
+
const result = await client.request('/api/branch-video/agent-production/cancel', {
|
|
29
|
+
method: 'POST',
|
|
30
|
+
body: payload,
|
|
31
|
+
});
|
|
32
|
+
return { data: result.data, requestId: result.requestId };
|
|
33
|
+
},
|
|
34
|
+
finalize: async ({ client, payload }) => {
|
|
35
|
+
const result = await client.request('/api/branch-video/agent-production/finalize', {
|
|
36
|
+
method: 'POST',
|
|
37
|
+
body: payload,
|
|
38
|
+
});
|
|
39
|
+
return { data: result.data, requestId: result.requestId };
|
|
40
|
+
},
|
|
41
|
+
'autopilot-binding': async ({ client, payload }) => {
|
|
42
|
+
const result = await client.request('/api/branch-video/agent-production/autopilot-binding', {
|
|
43
|
+
method: 'POST',
|
|
44
|
+
body: payload,
|
|
45
|
+
});
|
|
46
|
+
return { data: result.data, requestId: result.requestId };
|
|
47
|
+
},
|
|
48
|
+
'node.claim': async ({ client, payload }) => {
|
|
49
|
+
const result = await client.request('/api/branch-video/agent-production/node/claim', {
|
|
50
|
+
method: 'POST',
|
|
51
|
+
body: payload,
|
|
52
|
+
});
|
|
53
|
+
return { data: result.data, requestId: result.requestId };
|
|
54
|
+
},
|
|
55
|
+
'node.inputs': async ({ client, payload }) => {
|
|
56
|
+
const nodeRunId = getRequiredString(payload, 'nodeRunId');
|
|
57
|
+
const result = await client.request(`/api/branch-video/agent-production/node/${encodeURIComponent(nodeRunId)}/inputs`, {
|
|
58
|
+
method: 'GET',
|
|
59
|
+
});
|
|
60
|
+
return { data: result.data, requestId: result.requestId };
|
|
61
|
+
},
|
|
62
|
+
'node.complete': async ({ client, payload }) => {
|
|
63
|
+
const nodeRunId = getRequiredString(payload, 'nodeRunId');
|
|
64
|
+
const result = await client.request(`/api/branch-video/agent-production/node/${encodeURIComponent(nodeRunId)}/complete`, {
|
|
65
|
+
method: 'POST',
|
|
66
|
+
body: omitKeys(payload, ['nodeRunId']),
|
|
67
|
+
});
|
|
68
|
+
return { data: result.data, requestId: result.requestId };
|
|
69
|
+
},
|
|
70
|
+
'node.submit': async ({ client, payload }) => {
|
|
71
|
+
const dagRunId = getRequiredString(payload, 'dagRunId');
|
|
72
|
+
const nodeId = getRequiredString(payload, 'nodeId');
|
|
73
|
+
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,
|
|
78
|
+
};
|
|
79
|
+
const result = await client.request(`/api/branch-video/agent-production/dag-runs/${encodeURIComponent(dagRunId)}/nodes/${encodeURIComponent(nodeId)}/submit`, {
|
|
80
|
+
method: 'POST',
|
|
81
|
+
body,
|
|
82
|
+
});
|
|
83
|
+
return { data: result.data, requestId: result.requestId };
|
|
84
|
+
},
|
|
85
|
+
'node.block': async ({ client, payload }) => {
|
|
86
|
+
const nodeRunId = getRequiredString(payload, 'nodeRunId');
|
|
87
|
+
const result = await client.request(`/api/branch-video/agent-production/node/${encodeURIComponent(nodeRunId)}/block`, {
|
|
88
|
+
method: 'POST',
|
|
89
|
+
body: omitKeys(payload, ['nodeRunId']),
|
|
90
|
+
});
|
|
91
|
+
return { data: result.data, requestId: result.requestId };
|
|
92
|
+
},
|
|
93
|
+
'blocker.resolve': async ({ client, payload }) => {
|
|
94
|
+
const result = await client.request('/api/branch-video/agent-production/blocker/resolve', {
|
|
95
|
+
method: 'POST',
|
|
96
|
+
body: payload,
|
|
97
|
+
});
|
|
98
|
+
return { data: result.data, requestId: result.requestId };
|
|
99
|
+
},
|
|
100
|
+
'node.retry': async ({ client, payload }) => {
|
|
101
|
+
const nodeRunId = getRequiredString(payload, 'nodeRunId');
|
|
102
|
+
const result = await client.request(`/api/branch-video/agent-production/node/${encodeURIComponent(nodeRunId)}/retry`, {
|
|
103
|
+
method: 'POST',
|
|
104
|
+
body: omitKeys(payload, ['nodeRunId']),
|
|
105
|
+
});
|
|
106
|
+
return { data: result.data, requestId: result.requestId };
|
|
107
|
+
},
|
|
108
|
+
'node.expire': async ({ client, payload }) => {
|
|
109
|
+
const result = await client.request('/api/branch-video/agent-production/node/expire', {
|
|
110
|
+
method: 'POST',
|
|
111
|
+
body: payload,
|
|
112
|
+
});
|
|
113
|
+
return { data: result.data, requestId: result.requestId };
|
|
114
|
+
},
|
|
115
|
+
'node.fail': async ({ client, payload }) => {
|
|
116
|
+
const nodeRunId = getRequiredString(payload, 'nodeRunId');
|
|
117
|
+
const result = await client.request(`/api/branch-video/agent-production/node/${encodeURIComponent(nodeRunId)}/fail`, {
|
|
118
|
+
method: 'POST',
|
|
119
|
+
body: omitKeys(payload, ['nodeRunId']),
|
|
120
|
+
});
|
|
121
|
+
return { data: result.data, requestId: result.requestId };
|
|
122
|
+
},
|
|
123
|
+
'artifact.submit': async ({ client, payload }) => {
|
|
124
|
+
const result = await client.request('/api/branch-video/agent-production/artifact/submit', {
|
|
125
|
+
method: 'POST',
|
|
126
|
+
body: payload,
|
|
127
|
+
});
|
|
128
|
+
return { data: result.data, requestId: result.requestId };
|
|
129
|
+
},
|
|
130
|
+
'artifact.list': async ({ client, payload }) => {
|
|
131
|
+
const projectId = getRequiredString(payload, 'projectId');
|
|
132
|
+
const result = await client.request(`/api/branch-video/agent-production/${encodeURIComponent(projectId)}/artifacts`, {
|
|
133
|
+
method: 'GET',
|
|
134
|
+
});
|
|
135
|
+
return { data: result.data, requestId: result.requestId };
|
|
136
|
+
},
|
|
137
|
+
'asset-job.poll': async ({ client, payload }) => {
|
|
138
|
+
const result = await client.request('/api/branch-video/agent-production/asset-job/poll', {
|
|
139
|
+
method: 'POST',
|
|
140
|
+
body: payload,
|
|
141
|
+
});
|
|
142
|
+
return { data: result.data, requestId: result.requestId };
|
|
143
|
+
},
|
|
144
|
+
'asset-job.retry': async ({ client, payload }) => {
|
|
145
|
+
const result = await client.request('/api/branch-video/agent-production/asset-job/retry', {
|
|
146
|
+
method: 'POST',
|
|
147
|
+
body: payload,
|
|
148
|
+
});
|
|
149
|
+
return { data: result.data, requestId: result.requestId };
|
|
150
|
+
},
|
|
151
|
+
'asset-job.revise': async ({ client, payload }) => {
|
|
152
|
+
const result = await client.request('/api/branch-video/agent-production/asset-job/revise', {
|
|
153
|
+
method: 'POST',
|
|
154
|
+
body: payload,
|
|
155
|
+
});
|
|
156
|
+
return { data: result.data, requestId: result.requestId };
|
|
157
|
+
},
|
|
158
|
+
'asset-job.attach-artifact': async ({ client, payload }) => {
|
|
159
|
+
const result = await client.request('/api/branch-video/agent-production/asset-job/attach-artifact', {
|
|
160
|
+
method: 'POST',
|
|
161
|
+
body: payload,
|
|
162
|
+
});
|
|
163
|
+
return { data: result.data, requestId: result.requestId };
|
|
164
|
+
},
|
|
165
|
+
'asset-job.fail': async ({ client, payload }) => {
|
|
166
|
+
const result = await client.request('/api/branch-video/agent-production/asset-job/fail', {
|
|
167
|
+
method: 'POST',
|
|
168
|
+
body: payload,
|
|
169
|
+
});
|
|
170
|
+
return { data: result.data, requestId: result.requestId };
|
|
171
|
+
},
|
|
172
|
+
'gate.evaluate': async ({ client, payload }) => {
|
|
173
|
+
const result = await client.request('/api/branch-video/agent-production/gate/evaluate', {
|
|
174
|
+
method: 'POST',
|
|
175
|
+
body: payload,
|
|
176
|
+
});
|
|
177
|
+
return { data: result.data, requestId: result.requestId };
|
|
178
|
+
},
|
|
179
|
+
'gate.results': async ({ client, payload }) => {
|
|
180
|
+
const projectId = getRequiredString(payload, 'projectId');
|
|
181
|
+
const path = appendQuery(`/api/branch-video/agent-production/${encodeURIComponent(projectId)}/gates`, {
|
|
182
|
+
gateId: payload.gateId,
|
|
183
|
+
history: payload.history === undefined ? undefined : Boolean(payload.history),
|
|
184
|
+
});
|
|
185
|
+
const result = await client.request(path, {
|
|
186
|
+
method: 'GET',
|
|
187
|
+
});
|
|
188
|
+
return { data: result.data, requestId: result.requestId };
|
|
189
|
+
},
|
|
190
|
+
events: async ({ client, payload }) => {
|
|
191
|
+
const projectId = getRequiredString(payload, 'projectId');
|
|
192
|
+
const path = appendQuery(`/api/branch-video/agent-production/${encodeURIComponent(projectId)}/events`, {
|
|
193
|
+
category: payload.category,
|
|
194
|
+
});
|
|
195
|
+
const result = await client.request(path, {
|
|
196
|
+
method: 'GET',
|
|
197
|
+
});
|
|
198
|
+
return { data: result.data, requestId: result.requestId };
|
|
199
|
+
},
|
|
200
|
+
metrics: async ({ client, payload }) => {
|
|
201
|
+
const projectId = getRequiredString(payload, 'projectId');
|
|
202
|
+
const result = await client.request(`/api/branch-video/agent-production/${encodeURIComponent(projectId)}/metrics`, {
|
|
203
|
+
method: 'GET',
|
|
204
|
+
});
|
|
205
|
+
return { data: result.data, requestId: result.requestId };
|
|
206
|
+
},
|
|
207
|
+
'multica-comment-payload': async ({ client, payload }) => {
|
|
208
|
+
const projectId = getRequiredString(payload, 'projectId');
|
|
209
|
+
const result = await client.request(`/api/branch-video/agent-production/${encodeURIComponent(projectId)}/multica-comment-payload`, {
|
|
210
|
+
method: 'GET',
|
|
211
|
+
});
|
|
212
|
+
return { data: result.data, requestId: result.requestId };
|
|
213
|
+
},
|
|
214
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { presetCommands } from './commands/preset.js';
|
|
2
2
|
import { productionCommands } from './commands/production.js';
|
|
3
|
+
import { agentProductionCommands } from './commands/agentProduction.js';
|
|
3
4
|
import { projectCommands } from './commands/project.js';
|
|
4
5
|
import { versionCommands } from './commands/version.js';
|
|
5
6
|
import { workflowCommands } from './commands/workflow.js';
|
|
@@ -15,7 +16,8 @@ const commandRegistry = {
|
|
|
15
16
|
workflow: workflowCommands,
|
|
16
17
|
project: projectCommands,
|
|
17
18
|
version: versionCommands,
|
|
18
|
-
production:
|
|
19
|
+
'agent-production': agentProductionCommands,
|
|
20
|
+
'aihub-production': productionCommands,
|
|
19
21
|
character: characterCommands,
|
|
20
22
|
'ai-gateway': aiGatewayCommands,
|
|
21
23
|
};
|
package/dist/lib/flags.js
CHANGED
|
@@ -84,7 +84,7 @@ export function parseCliArgs(argv) {
|
|
|
84
84
|
}
|
|
85
85
|
return {
|
|
86
86
|
group: positionals[0] || '',
|
|
87
|
-
action: positionals
|
|
87
|
+
action: positionals.slice(1).join('.') || '',
|
|
88
88
|
flags,
|
|
89
89
|
};
|
|
90
90
|
}
|
|
@@ -97,7 +97,8 @@ export function getCliHelpText() {
|
|
|
97
97
|
' workflow run | status | outputs',
|
|
98
98
|
' project list | get | create | import-aihub | update | delete',
|
|
99
99
|
' version list | get | publish',
|
|
100
|
-
' production
|
|
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
|
+
' aihub-production schema | start | status | retry',
|
|
101
102
|
' character search | create | get',
|
|
102
103
|
' ai-gateway capabilities | request | image-generate | image-edit | video-create | video-get | music-submit | music-get',
|
|
103
104
|
'',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mindscraft/branch-video-agent-cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
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
|
+
}
|