@flowweave-ai/cli 0.1.2 → 0.1.4
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 +5 -1
- package/bin/flowweave.mjs +55 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,7 +14,11 @@ flowweave health --ready
|
|
|
14
14
|
|
|
15
15
|
常用命令示例:
|
|
16
16
|
|
|
17
|
-
`flowweave node-directory delete <directory-id> --dry-run`、`flowweave credential delete-many --id <credential-id> --id <credential-id>`、`flowweave environment publish <setup-session-id> --description '升级 Python 依赖'`、`flowweave agent file-delete <workspace-id> --path /runtime/workspace/project/report.md`。
|
|
17
|
+
`flowweave node-directory delete-many --id <directory-id> --id <directory-id> --dry-run`、`flowweave credential delete-many --id <credential-id> --id <credential-id>`、`flowweave environment publish <setup-session-id> --description '升级 Python 依赖'`、`flowweave agent file-delete <workspace-id> --path /runtime/workspace/project/report.md --path /runtime/workspace/project/output`、`flowweave run workspace-delete <run-id> --attempt <attempt-id> --path /runtime/workspace/project/result.txt`。
|
|
18
|
+
|
|
19
|
+
节点目录批量删除、Agent Workspace 文件树删除和 FlowRun 节点工作区删除都使用 JSON 数组请求体。重复传入 `--id` 或 `--path` 即可批量选择;先读取真实资源与路径,并用 `--dry-run` 核对 DELETE URL、范围 query 和请求体。FlowRun 工作目录删除使用 `flowweave run work-directory-delete <run-id> --attempt <attempt-id> --work-directory <directory-id>`。
|
|
20
|
+
|
|
21
|
+
读取 FlowRun 中的记录使用 `flowweave run node <run-id> --node <node-run-id>`;只有用户明确要求时才能执行 `node-copy` 或 `node-delete`。暂停或恢复 Runtime 前,必须先读取 `run runtime`,将返回的 `generation` 与 session `row_version` 写入 `expected_generation`、`expected_session_row_version` 后传给 `run pause` 或 `run resume`。供应商上游余额/用量使用 `flowweave model usage <provider-id>`,它可能依赖该供应商的有效 API 凭据。
|
|
18
22
|
|
|
19
23
|
`api`、`upload`、`ws` 是完整契约入口:任意当前或未来的 REST、multipart、WebSocket 原子接口均可直接调用,不需要等待 CLI 发布。`ws` 使用 Node 原生 WebSocket;当前公开 FlowWeave WebSocket 接口无需自定义请求头。写操作支持 `--dry-run`,并可使用 `-H 'Idempotency-Key: …'` 传入一次性幂等键。对于没有快捷命令的新接口,先运行 `flowweave openapi --paths`,再通过通用命令调用。
|
|
20
24
|
|
package/bin/flowweave.mjs
CHANGED
|
@@ -26,13 +26,13 @@ function usage() {
|
|
|
26
26
|
|
|
27
27
|
页面域原子操作:
|
|
28
28
|
node <list|get|create|update|delete> [ID] [--data JSON|--data-file FILE]
|
|
29
|
-
node-directory <list|create|delete> [ID] [--
|
|
29
|
+
node-directory <list|create|delete|delete-many> [ID] [--id ID ...]
|
|
30
30
|
capability <list|validate|commit|import> ...
|
|
31
31
|
environment <list|get|create|update|delete|setup|publish|stop|version-delete> ...
|
|
32
32
|
credential <list|create|update|delete|delete-many> ...
|
|
33
33
|
flow <list|get|create|update|validate|delete> ...
|
|
34
|
-
run <list|get|start|delete|runtime|replace|cancel|complete|events> ...
|
|
35
|
-
model <list|create|update|delete|discover|test|oauth-start|oauth-poll|oauth-status|oauth-revoke> ...
|
|
34
|
+
run <list|get|start|delete|runtime|replace|pause|resume|cancel|complete|events|node|node-copy|node-delete|workspace-delete|work-directory-delete> ...
|
|
35
|
+
model <list|create|update|delete|discover|usage|test|oauth-start|oauth-poll|oauth-status|oauth-revoke> ...
|
|
36
36
|
agent <default|workspace|runtime|conversations|conversation|create|send|interrupt|resume|work-directories|work-directory-create|work-directory-delete|file-delete> ...
|
|
37
37
|
|
|
38
38
|
所有写入操作都可加 --dry-run 仅查看最终请求。运行 flowweave <命令> --help 查看该命令说明。`;
|
|
@@ -198,7 +198,12 @@ async function nodeDirectory(args) {
|
|
|
198
198
|
if (!id) throw new CliError('node-directory delete 必须提供目录 ID');
|
|
199
199
|
return request('DELETE', `/node-directories/${id}`, args);
|
|
200
200
|
}
|
|
201
|
-
|
|
201
|
+
if (action === 'delete-many') {
|
|
202
|
+
const ids = optionValues(args, '--id');
|
|
203
|
+
if (!ids.length) throw new CliError('node-directory delete-many 至少需要一个 --id');
|
|
204
|
+
return request('DELETE', '/node-directories', args, { body: { ids } });
|
|
205
|
+
}
|
|
206
|
+
throw new CliError('node-directory 支持 list|create|delete|delete-many');
|
|
202
207
|
}
|
|
203
208
|
|
|
204
209
|
async function capability(args) {
|
|
@@ -278,14 +283,53 @@ async function run(args) {
|
|
|
278
283
|
return request('POST', `/flows/${flowId}/runs`, args, { body });
|
|
279
284
|
}
|
|
280
285
|
if (!id) throw new CliError(`run ${action || ''} 需要 FlowRun ID`);
|
|
286
|
+
if (action === 'node' || action === 'node-copy' || action === 'node-delete') {
|
|
287
|
+
const nodeRunId = option(args, '--node');
|
|
288
|
+
if (!nodeRunId) throw new CliError(`run ${action} 需要 --node <node-run-id>`);
|
|
289
|
+
const path = `/flow-runs/${id}/nodes/${nodeRunId}`;
|
|
290
|
+
if (action === 'node') return request('GET', path, args);
|
|
291
|
+
if (action === 'node-copy') return request('POST', `${path}/copy`, args, { body: await objectPayload(args) });
|
|
292
|
+
return request('DELETE', path, args);
|
|
293
|
+
}
|
|
294
|
+
if (action === 'workspace-delete') {
|
|
295
|
+
const attemptId = option(args, '--attempt');
|
|
296
|
+
const paths = optionValues(args, '--path');
|
|
297
|
+
if (!attemptId || !paths.length) {
|
|
298
|
+
throw new CliError('run workspace-delete 需要 FlowRun ID、--attempt 和至少一个 --path');
|
|
299
|
+
}
|
|
300
|
+
const bindingId = option(args, '--binding');
|
|
301
|
+
const workDirectoryId = option(args, '--work-directory');
|
|
302
|
+
return request('DELETE', `/flow-runs/${id}/node-attempts/${attemptId}/agent-sessions/workspace/entries`, args, {
|
|
303
|
+
body: { paths },
|
|
304
|
+
query: [
|
|
305
|
+
...(bindingId ? [['binding_id', bindingId]] : []),
|
|
306
|
+
...(workDirectoryId ? [['work_directory_id', workDirectoryId]] : []),
|
|
307
|
+
],
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
if (action === 'work-directory-delete') {
|
|
311
|
+
const attemptId = option(args, '--attempt');
|
|
312
|
+
const workDirectoryId = option(args, '--work-directory');
|
|
313
|
+
if (!attemptId || !workDirectoryId) {
|
|
314
|
+
throw new CliError('run work-directory-delete 需要 FlowRun ID、--attempt 和 --work-directory');
|
|
315
|
+
}
|
|
316
|
+
return request('DELETE', `/flow-runs/${id}/node-attempts/${attemptId}/agent-sessions/work-directories/${workDirectoryId}`, args);
|
|
317
|
+
}
|
|
281
318
|
if (action === 'get') return request('GET', `/flow-runs/${id}`, args);
|
|
282
319
|
if (action === 'delete') return request('DELETE', `/flow-runs/${id}`, args);
|
|
283
320
|
if (action === 'runtime') return request('GET', `/flow-runs/${id}/runtime`, args);
|
|
284
321
|
if (action === 'replace') return request('POST', `/flow-runs/${id}/runtime/replacements`, args);
|
|
322
|
+
if (action === 'pause' || action === 'resume') {
|
|
323
|
+
const body = await objectPayload(args);
|
|
324
|
+
if (!Number.isInteger(body.expected_generation) || !Number.isInteger(body.expected_session_row_version)) {
|
|
325
|
+
throw new CliError(`run ${action} 需要 --data 或 --data-file,且必须包含整数 expected_generation 和 expected_session_row_version`);
|
|
326
|
+
}
|
|
327
|
+
return request('POST', `/flow-runs/${id}/runtime/${action}`, args, { body });
|
|
328
|
+
}
|
|
285
329
|
if (action === 'cancel') return request('POST', `/flow-runs/${id}/cancel`, args, { body: {} });
|
|
286
330
|
if (action === 'complete') return request('POST', `/flow-runs/${id}/complete`, args, { body: {} });
|
|
287
331
|
if (action === 'events') return request('GET', `/flow-runs/${id}/events`, args);
|
|
288
|
-
throw new CliError('run 支持 list|get|start|delete|runtime|replace|cancel|complete|events');
|
|
332
|
+
throw new CliError('run 支持 list|get|start|delete|runtime|replace|pause|resume|cancel|complete|events|node|node-copy|node-delete|workspace-delete|work-directory-delete');
|
|
289
333
|
}
|
|
290
334
|
|
|
291
335
|
async function model(args) {
|
|
@@ -298,6 +342,7 @@ async function model(args) {
|
|
|
298
342
|
: request('POST', '/model-providers/discover-models', args);
|
|
299
343
|
}
|
|
300
344
|
if (!id) throw new CliError(`model ${action || ''} 需要模型供应商 ID`);
|
|
345
|
+
if (action === 'usage') return request('GET', `/model-providers/${id}/usage`, args);
|
|
301
346
|
if (action === 'update') return request('PUT', `/model-providers/${id}`, args);
|
|
302
347
|
if (action === 'delete') return request('DELETE', `/model-providers/${id}`, args);
|
|
303
348
|
if (action === 'test') return request('POST', `/model-providers/${id}/test`, args);
|
|
@@ -305,7 +350,7 @@ async function model(args) {
|
|
|
305
350
|
if (action === 'oauth-poll') return request('POST', `/model-providers/${id}/oauth/device/poll`, args, { body: await objectPayload(args) });
|
|
306
351
|
if (action === 'oauth-status') return request('GET', `/model-providers/${id}/oauth/status`, args);
|
|
307
352
|
if (action === 'oauth-revoke') return request('DELETE', `/model-providers/${id}/oauth`, args);
|
|
308
|
-
throw new CliError('model 支持 list|create|update|delete|discover|test|oauth-start|oauth-poll|oauth-status|oauth-revoke');
|
|
353
|
+
throw new CliError('model 支持 list|create|update|delete|discover|usage|test|oauth-start|oauth-poll|oauth-status|oauth-revoke');
|
|
309
354
|
}
|
|
310
355
|
|
|
311
356
|
async function agent(args) {
|
|
@@ -325,13 +370,13 @@ async function agent(args) {
|
|
|
325
370
|
return request('DELETE', `${base}/work-directories/${binding}`, args);
|
|
326
371
|
}
|
|
327
372
|
if (action === 'file-delete') {
|
|
328
|
-
const
|
|
329
|
-
if (!
|
|
373
|
+
const paths = optionValues(args, '--path');
|
|
374
|
+
if (!paths.length) throw new CliError('agent file-delete 至少需要一个 --path <runtime-path>');
|
|
330
375
|
const bindingId = option(args, '--binding');
|
|
331
376
|
const workDirectoryId = option(args, '--work-directory');
|
|
332
|
-
return request('DELETE', `${base}/workspace/
|
|
377
|
+
return request('DELETE', `${base}/workspace/entries`, args, {
|
|
378
|
+
body: { paths },
|
|
333
379
|
query: [
|
|
334
|
-
['path', path],
|
|
335
380
|
...(bindingId ? [['binding_id', bindingId]] : []),
|
|
336
381
|
...(workDirectoryId ? [['work_directory_id', workDirectoryId]] : []),
|
|
337
382
|
],
|