@flowweave-ai/cli 0.1.2 → 0.1.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
@@ -14,7 +14,9 @@ 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>`。
18
20
 
19
21
  `api`、`upload`、`ws` 是完整契约入口:任意当前或未来的 REST、multipart、WebSocket 原子接口均可直接调用,不需要等待 CLI 发布。`ws` 使用 Node 原生 WebSocket;当前公开 FlowWeave WebSocket 接口无需自定义请求头。写操作支持 `--dry-run`,并可使用 `-H 'Idempotency-Key: …'` 传入一次性幂等键。对于没有快捷命令的新接口,先运行 `flowweave openapi --paths`,再通过通用命令调用。
20
22
 
package/bin/flowweave.mjs CHANGED
@@ -26,12 +26,12 @@ 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] [--data JSON|--data-file FILE]
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> ...
34
+ run <list|get|start|delete|runtime|replace|cancel|complete|events|workspace-delete|work-directory-delete> ...
35
35
  model <list|create|update|delete|discover|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
 
@@ -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
- throw new CliError('node-directory 支持 list|create|delete');
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,6 +283,30 @@ 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 === 'workspace-delete') {
287
+ const attemptId = option(args, '--attempt');
288
+ const paths = optionValues(args, '--path');
289
+ if (!attemptId || !paths.length) {
290
+ throw new CliError('run workspace-delete 需要 FlowRun ID、--attempt 和至少一个 --path');
291
+ }
292
+ const bindingId = option(args, '--binding');
293
+ const workDirectoryId = option(args, '--work-directory');
294
+ return request('DELETE', `/flow-runs/${id}/node-attempts/${attemptId}/agent-sessions/workspace/entries`, args, {
295
+ body: { paths },
296
+ query: [
297
+ ...(bindingId ? [['binding_id', bindingId]] : []),
298
+ ...(workDirectoryId ? [['work_directory_id', workDirectoryId]] : []),
299
+ ],
300
+ });
301
+ }
302
+ if (action === 'work-directory-delete') {
303
+ const attemptId = option(args, '--attempt');
304
+ const workDirectoryId = option(args, '--work-directory');
305
+ if (!attemptId || !workDirectoryId) {
306
+ throw new CliError('run work-directory-delete 需要 FlowRun ID、--attempt 和 --work-directory');
307
+ }
308
+ return request('DELETE', `/flow-runs/${id}/node-attempts/${attemptId}/agent-sessions/work-directories/${workDirectoryId}`, args);
309
+ }
281
310
  if (action === 'get') return request('GET', `/flow-runs/${id}`, args);
282
311
  if (action === 'delete') return request('DELETE', `/flow-runs/${id}`, args);
283
312
  if (action === 'runtime') return request('GET', `/flow-runs/${id}/runtime`, args);
@@ -285,7 +314,7 @@ async function run(args) {
285
314
  if (action === 'cancel') return request('POST', `/flow-runs/${id}/cancel`, args, { body: {} });
286
315
  if (action === 'complete') return request('POST', `/flow-runs/${id}/complete`, args, { body: {} });
287
316
  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');
317
+ throw new CliError('run 支持 list|get|start|delete|runtime|replace|cancel|complete|events|workspace-delete|work-directory-delete');
289
318
  }
290
319
 
291
320
  async function model(args) {
@@ -325,13 +354,13 @@ async function agent(args) {
325
354
  return request('DELETE', `${base}/work-directories/${binding}`, args);
326
355
  }
327
356
  if (action === 'file-delete') {
328
- const path = option(args, '--path');
329
- if (!path) throw new CliError('agent file-delete 需要 --path <runtime-path>');
357
+ const paths = optionValues(args, '--path');
358
+ if (!paths.length) throw new CliError('agent file-delete 至少需要一个 --path <runtime-path>');
330
359
  const bindingId = option(args, '--binding');
331
360
  const workDirectoryId = option(args, '--work-directory');
332
- return request('DELETE', `${base}/workspace/file`, args, {
361
+ return request('DELETE', `${base}/workspace/entries`, args, {
362
+ body: { paths },
333
363
  query: [
334
- ['path', path],
335
364
  ...(bindingId ? [['binding_id', bindingId]] : []),
336
365
  ...(workDirectoryId ? [['work_directory_id', workDirectoryId]] : []),
337
366
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowweave-ai/cli",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "FlowWeave 平台命令行客户端",
5
5
  "type": "module",
6
6
  "bin": {