digitalsee-ai-flow-cli 0.1.9 → 0.2.0
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 +349 -66
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +93 -17
- package/dist/api/client.js.map +1 -1
- package/dist/api/dip.d.ts.map +1 -0
- package/dist/api/dip.js +14 -0
- package/dist/api/dip.js.map +1 -0
- package/dist/api/flow-log.d.ts.map +1 -0
- package/dist/api/flow-log.js +34 -0
- package/dist/api/flow-log.js.map +1 -0
- package/dist/api/link.d.ts.map +1 -0
- package/dist/api/link.js +42 -0
- package/dist/api/link.js.map +1 -0
- package/dist/api/sync.d.ts.map +1 -0
- package/dist/api/sync.js +42 -0
- package/dist/api/sync.js.map +1 -0
- package/dist/commands/flow/account.d.ts.map +1 -1
- package/dist/commands/flow/account.js +10 -3
- package/dist/commands/flow/account.js.map +1 -1
- package/dist/commands/flow/analyze.d.ts.map +1 -1
- package/dist/commands/flow/analyze.js +40 -3
- package/dist/commands/flow/analyze.js.map +1 -1
- package/dist/commands/flow/create.d.ts.map +1 -1
- package/dist/commands/flow/create.js +33 -2
- package/dist/commands/flow/create.js.map +1 -1
- package/dist/commands/flow/draft.d.ts.map +1 -0
- package/dist/commands/flow/draft.js +173 -0
- package/dist/commands/flow/draft.js.map +1 -0
- package/dist/commands/flow/edge.d.ts.map +1 -1
- package/dist/commands/flow/edge.js +71 -12
- package/dist/commands/flow/edge.js.map +1 -1
- package/dist/commands/flow/helpers.d.ts.map +1 -1
- package/dist/commands/flow/helpers.js +99 -2
- package/dist/commands/flow/helpers.js.map +1 -1
- package/dist/commands/flow/log.d.ts.map +1 -0
- package/dist/commands/flow/log.js +325 -0
- package/dist/commands/flow/log.js.map +1 -0
- package/dist/commands/flow/node.d.ts.map +1 -1
- package/dist/commands/flow/node.js +292 -185
- package/dist/commands/flow/node.js.map +1 -1
- package/dist/commands/flow/test.d.ts.map +1 -1
- package/dist/commands/flow/test.js +58 -18
- package/dist/commands/flow/test.js.map +1 -1
- package/dist/commands/flow/validate.d.ts.map +1 -0
- package/dist/commands/flow/validate.js +85 -0
- package/dist/commands/flow/validate.js.map +1 -0
- package/dist/commands/flow/variables.d.ts.map +1 -1
- package/dist/commands/flow/variables.js +18 -5
- package/dist/commands/flow/variables.js.map +1 -1
- package/dist/commands/flow.d.ts.map +1 -1
- package/dist/commands/flow.js +6 -0
- package/dist/commands/flow.js.map +1 -1
- package/dist/commands/knowledge.d.ts.map +1 -1
- package/dist/commands/knowledge.js +17 -2
- package/dist/commands/knowledge.js.map +1 -1
- package/dist/commands/link/create.d.ts.map +1 -0
- package/dist/commands/link/create.js +38 -0
- package/dist/commands/link/create.js.map +1 -0
- package/dist/commands/link/helpers.d.ts.map +1 -0
- package/dist/commands/link/helpers.js +176 -0
- package/dist/commands/link/helpers.js.map +1 -0
- package/dist/commands/link/list.d.ts.map +1 -0
- package/dist/commands/link/list.js +42 -0
- package/dist/commands/link/list.js.map +1 -0
- package/dist/commands/link/log.d.ts.map +1 -0
- package/dist/commands/link/log.js +208 -0
- package/dist/commands/link/log.js.map +1 -0
- package/dist/commands/link/reset.d.ts.map +1 -0
- package/dist/commands/link/reset.js +23 -0
- package/dist/commands/link/reset.js.map +1 -0
- package/dist/commands/link/templates-cmd.d.ts.map +1 -0
- package/dist/commands/link/templates-cmd.js +26 -0
- package/dist/commands/link/templates-cmd.js.map +1 -0
- package/dist/commands/link/templates.d.ts.map +1 -0
- package/dist/commands/link/templates.js +104 -0
- package/dist/commands/link/templates.js.map +1 -0
- package/dist/commands/link.d.ts.map +1 -0
- package/dist/commands/link.js +17 -0
- package/dist/commands/link.js.map +1 -0
- package/dist/commands/sync/create.d.ts.map +1 -0
- package/dist/commands/sync/create.js +38 -0
- package/dist/commands/sync/create.js.map +1 -0
- package/dist/commands/sync/list.d.ts.map +1 -0
- package/dist/commands/sync/list.js +42 -0
- package/dist/commands/sync/list.js.map +1 -0
- package/dist/commands/sync/log.d.ts.map +1 -0
- package/dist/commands/sync/log.js +207 -0
- package/dist/commands/sync/log.js.map +1 -0
- package/dist/commands/sync/reset.d.ts.map +1 -0
- package/dist/commands/sync/reset.js +23 -0
- package/dist/commands/sync/reset.js.map +1 -0
- package/dist/commands/sync/templates-cmd.d.ts.map +1 -0
- package/dist/commands/sync/templates-cmd.js +26 -0
- package/dist/commands/sync/templates-cmd.js.map +1 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +17 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/common.d.ts.map +1 -0
- package/dist/utils/common.js +14 -0
- package/dist/utils/common.js.map +1 -0
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/format.js +24 -3
- package/dist/utils/format.js.map +1 -1
- package/dist/utils/mask.d.ts.map +1 -0
- package/dist/utils/mask.js +102 -0
- package/dist/utils/mask.js.map +1 -0
- package/dist/utils/output.d.ts.map +1 -1
- package/dist/utils/output.js +132 -27
- package/dist/utils/output.js.map +1 -1
- package/package.json +1 -1
- package/CHANGELOG.md +0 -84
package/README.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
AI Flow 连接流命令行管理工具,通过 AI Flow v2 API 管理连接流和节点配置。
|
|
4
4
|
|
|
5
|
+
面向 AI Agent 调用优化:默认非交互、支持 `--json` 结构化输出、错误分类码。
|
|
6
|
+
|
|
7
|
+
## 全局选项
|
|
8
|
+
|
|
9
|
+
| 选项 | 说明 |
|
|
10
|
+
|------|------|
|
|
11
|
+
| `--quiet` | 安静模式,仅输出核心数据,无装饰文本和颜色 |
|
|
12
|
+
| `--json` | 各命令独立支持,输出结构化 JSON(自动启用安静模式) |
|
|
13
|
+
|
|
5
14
|
## 安装
|
|
6
15
|
|
|
7
16
|
```bash
|
|
@@ -126,12 +135,18 @@ ai-flow flow list --filter "测试"
|
|
|
126
135
|
|
|
127
136
|
### flow create
|
|
128
137
|
|
|
129
|
-
|
|
138
|
+
创建新的连接流。支持通过 `--data`/`--data-file` 一次性传入完整流定义(含 nodes + connections)实现原子创建。
|
|
130
139
|
|
|
131
140
|
```bash
|
|
132
141
|
ai-flow flow create --name "我的连接流"
|
|
133
142
|
ai-flow flow create --name "带数据的流" --data '{"nodes":[],"connections":[]}'
|
|
134
143
|
ai-flow flow create --name "从文件创建" --data-file ./flow-data.json
|
|
144
|
+
|
|
145
|
+
# 干跑校验(不实际创建)
|
|
146
|
+
ai-flow flow create --name "测试" --data-file ./flow.json --dry-run
|
|
147
|
+
|
|
148
|
+
# JSON 输出
|
|
149
|
+
ai-flow flow create --name "我的流" --json
|
|
135
150
|
```
|
|
136
151
|
|
|
137
152
|
| 选项 | 必填 | 说明 |
|
|
@@ -139,6 +154,13 @@ ai-flow flow create --name "从文件创建" --data-file ./flow-data.json
|
|
|
139
154
|
| `--name` | 是 | 连接流名称 |
|
|
140
155
|
| `--data` | 否 | JSON 字符串,包含 nodes 和 connections(与 `--data-file` 互斥) |
|
|
141
156
|
| `--data-file` | 否 | JSON 文件路径,包含 nodes 和 connections(与 `--data` 互斥) |
|
|
157
|
+
| `--dry-run` | 否 | 仅校验数据格式,不实际创建 |
|
|
158
|
+
| `--json` | 否 | 以 JSON 格式输出 `{ ok, id, message }` |
|
|
159
|
+
|
|
160
|
+
`--json` 输出示例:
|
|
161
|
+
```json
|
|
162
|
+
{ "ok": true, "id": "2056988777387053057", "message": "连接流创建成功: 我的流" }
|
|
163
|
+
```
|
|
142
164
|
|
|
143
165
|
### flow update
|
|
144
166
|
|
|
@@ -163,13 +185,13 @@ ai-flow flow update <flowId> --name "新名称"
|
|
|
163
185
|
- 每节点配置详情(config_schema 字段及当前值)
|
|
164
186
|
- Edges 连接表
|
|
165
187
|
|
|
166
|
-
|
|
188
|
+
支持多种输出格式:
|
|
167
189
|
|
|
168
190
|
```bash
|
|
169
191
|
ai-flow flow analyze <flowId> # table(默认,全量输出)
|
|
170
192
|
ai-flow flow analyze <flowId> --format brief # 简要模式:流概览 + 节点清单 + 执行顺序
|
|
171
193
|
ai-flow flow analyze <flowId> --format graph # ASCII 流程图模式:流概览 + 增强型流程图
|
|
172
|
-
ai-flow flow analyze <flowId> --
|
|
194
|
+
ai-flow flow analyze <flowId> --json # JSON 格式(含 $schema 字段描述结构)
|
|
173
195
|
```
|
|
174
196
|
|
|
175
197
|
`--format graph` 输出示例:
|
|
@@ -203,15 +225,29 @@ ai-flow flow analyze <flowId> --format json # 纯 JSON 格式
|
|
|
203
225
|
|
|
204
226
|
### flow test
|
|
205
227
|
|
|
206
|
-
测试运行指定节点。可先通过 `--data`/`--data-file`
|
|
228
|
+
测试运行指定节点。可先通过 `--data`/`--data-file` 更新节点配置再测试。支持断言。
|
|
207
229
|
|
|
208
230
|
```bash
|
|
209
231
|
ai-flow flow test <nodeId>
|
|
210
232
|
ai-flow flow test <nodeId> --flow-id <flowId>
|
|
211
233
|
ai-flow flow test <nodeId> --data-file ./config.json
|
|
212
234
|
ai-flow flow test <nodeId> --data '{"properties": {"millisecond": "2000"}}'
|
|
235
|
+
|
|
236
|
+
# 带断言:期望 status_code 为 200
|
|
237
|
+
ai-flow flow test <nodeId> --expect '{"status_code": 200}'
|
|
238
|
+
|
|
239
|
+
# JSON 输出
|
|
240
|
+
ai-flow flow test <nodeId> --json
|
|
213
241
|
```
|
|
214
242
|
|
|
243
|
+
| 选项 | 必填 | 说明 |
|
|
244
|
+
|------|------|------|
|
|
245
|
+
| `--flow-id` | 否 | 连接流 ID |
|
|
246
|
+
| `--data` | 否 | JSON 字符串,覆盖节点配置值 |
|
|
247
|
+
| `--data-file` | 否 | JSON 文件路径,覆盖节点配置值 |
|
|
248
|
+
| `--expect` | 否 | JSON 格式断言,如 `{"status_code": 200}` |
|
|
249
|
+
| `--json` | 否 | 以 JSON 格式输出 `{ ok, data, expectErrors }` |
|
|
250
|
+
|
|
215
251
|
`config.json` 示例(配置值包裹在 `properties` 中):
|
|
216
252
|
```json
|
|
217
253
|
{
|
|
@@ -272,12 +308,13 @@ ai-flow flow node create \
|
|
|
272
308
|
| `--action-id` | 是 | — | 动作 ID |
|
|
273
309
|
| `--trigger` | 否 | `false` | 作为触发器节点,流无节点时会提示启用 |
|
|
274
310
|
| `--node-type` | 否 | 首个节点 `StartEventNode`,否则 `ActionNode` | 节点类型或动作类型 |
|
|
275
|
-
| `--account-id` | 否 | — | 账号实例 ID
|
|
311
|
+
| `--account-id` | 否 | — | 账号实例 ID(需要账号鉴权时指定)。若仅 1 个可用账号则自动选择;多个账号时输出列表由调用方选择 |
|
|
276
312
|
| `--error-handler-file` | 否 | — | 错误处理配置 JSON 文件 |
|
|
277
313
|
| `--data-file` | 否 | — | JSON 文件,覆盖配置字段值 |
|
|
278
314
|
| `--data` | 否 | — | JSON 字符串,覆盖配置字段值(与 `--data-file` 互斥) |
|
|
279
315
|
| `--position-x` | 否 | `250` | 节点 X 坐标 |
|
|
280
316
|
| `--position-y` | 否 | `150` | 节点 Y 坐标 |
|
|
317
|
+
| `--json` | 否 | — | 以 JSON 格式输出 `{ ok, id, message, nodeType, ... }` |
|
|
281
318
|
|
|
282
319
|
流程:
|
|
283
320
|
1. 调 `GET /acm/actions/v2` 获取 action 的 config_schema 作为模板
|
|
@@ -286,7 +323,7 @@ ai-flow flow node create \
|
|
|
286
323
|
|
|
287
324
|
> 不传 `--data`/`--data-file` 时使用默认值填充。`--data`/`--data-file` 内容必须为 `{"properties": {"fieldName": "value"}}` 格式,配置字段包裹在 `properties` 中,键名对应配置字段的 `name`。对于特殊节点类型(ConditionNode/LoopNode/SwitchNode),额外字段(`or_list`/`branches`/`type` 等)与 `properties` 同级传入,会自动转发。详见 [特殊节点类型配置指南](docs/special-node-types.md)。`--trigger` 标志会筛选触发器类型的动作。
|
|
288
325
|
|
|
289
|
-
> **账号配置**:当动作的 `config_schema` 包含 `account_schema_id`
|
|
326
|
+
> **账号配置**:当动作的 `config_schema` 包含 `account_schema_id` 时,需要通过 `--account-id` 指定账号实例 ID。若未指定且仅 1 个可用账号,CLI 自动选择;多个账号时通过结构化输出返回可用列表。
|
|
290
327
|
|
|
291
328
|
> **错误处理配置**:通过 `--error-handler-file` 指定 JSON 文件配置节点的错误处理策略,格式如下。`process_type`: `1`=中断流程, `2`=忽略错误;`warn_type`: `1`=启用告警, `0`=禁用。
|
|
292
329
|
> ```json
|
|
@@ -309,7 +346,7 @@ ai-flow flow node create \
|
|
|
309
346
|
|
|
310
347
|
```bash
|
|
311
348
|
ai-flow flow node show <nodeId>
|
|
312
|
-
ai-flow flow node show <nodeId> --
|
|
349
|
+
ai-flow flow node show <nodeId> --json
|
|
313
350
|
```
|
|
314
351
|
|
|
315
352
|
输出示例:
|
|
@@ -338,54 +375,48 @@ timeout 超时时间(ms) NUMBER 否 5000 -
|
|
|
338
375
|
|
|
339
376
|
### flow node update
|
|
340
377
|
|
|
341
|
-
|
|
378
|
+
更新连接流中的节点配置。使用 `--patch`/`--patch-file` 做深度合并更新(`--data` 已废弃)。
|
|
342
379
|
|
|
343
380
|
```bash
|
|
344
|
-
# 通过 JSON
|
|
381
|
+
# 通过 JSON 文件 patch 更新配置
|
|
345
382
|
ai-flow flow node update <nodeId> \
|
|
346
383
|
--flow-id <flowId> \
|
|
347
|
-
--
|
|
384
|
+
--patch-file ./node-config.json
|
|
348
385
|
|
|
349
|
-
# 通过内联 JSON 更新配置
|
|
386
|
+
# 通过内联 JSON patch 更新配置
|
|
350
387
|
ai-flow flow node update <nodeId> \
|
|
351
388
|
--flow-id <flowId> \
|
|
352
|
-
--
|
|
389
|
+
--patch '{"properties": {"name":"value"}}'
|
|
353
390
|
|
|
354
|
-
#
|
|
355
|
-
ai-flow flow node update <nodeId> \
|
|
356
|
-
--flow-id <flowId> \
|
|
357
|
-
--data '{"or_list":[{"and_list":[{"query":"{{N123.value}}","operator":"gt","value":"100"}]}]}'
|
|
358
|
-
ai-flow flow node update <nodeId> \
|
|
359
|
-
--flow-id <flowId> \
|
|
360
|
-
--position-x 400 --position-y 200
|
|
361
|
-
|
|
362
|
-
# 更新节点备注
|
|
391
|
+
# patch 更新 + 校验变量引用
|
|
363
392
|
ai-flow flow node update <nodeId> \
|
|
364
393
|
--flow-id <flowId> \
|
|
365
|
-
--
|
|
394
|
+
--patch-file ./config.json \
|
|
395
|
+
--validate-vars
|
|
366
396
|
|
|
367
|
-
#
|
|
397
|
+
# 更新条件分支节点的 or_list
|
|
368
398
|
ai-flow flow node update <nodeId> \
|
|
369
399
|
--flow-id <flowId> \
|
|
370
|
-
--
|
|
371
|
-
--action-id <newActionId>
|
|
400
|
+
--patch '{"properties":{"or_list":[{"and_list":[{"query":"{{N123.value}}","operator":"gt","value":"100"}]}]}}'
|
|
372
401
|
|
|
373
|
-
#
|
|
374
|
-
ai-flow flow node update <nodeId>
|
|
375
|
-
|
|
376
|
-
|
|
402
|
+
# 更新位置/备注/连接器/动作/账号
|
|
403
|
+
ai-flow flow node update <nodeId> --flow-id <flowId> --position-x 400 --position-y 200
|
|
404
|
+
ai-flow flow node update <nodeId> --flow-id <flowId> --note "处理用户登录请求"
|
|
405
|
+
ai-flow flow node update <nodeId> --flow-id <flowId> --connector-id <id> --action-id <id>
|
|
406
|
+
ai-flow flow node update <nodeId> --flow-id <flowId> --account-id <accountId>
|
|
407
|
+
ai-flow flow node update <nodeId> --flow-id <flowId> --error-handler-file ./error-handler.json
|
|
377
408
|
|
|
378
|
-
#
|
|
379
|
-
ai-flow flow node update <nodeId>
|
|
380
|
-
--flow-id <flowId> \
|
|
381
|
-
--error-handler-file ./error-handler.json
|
|
409
|
+
# JSON 输出
|
|
410
|
+
ai-flow flow node update <nodeId> --flow-id <flowId> --patch-file ./config.json --json
|
|
382
411
|
```
|
|
383
412
|
|
|
384
413
|
| 选项 | 必填 | 说明 |
|
|
385
414
|
|------|------|------|
|
|
386
415
|
| `--flow-id` | 是 | 连接流 ID |
|
|
387
|
-
| `--
|
|
388
|
-
| `--
|
|
416
|
+
| `--patch` | 否 | JSON 字符串,深度合并更新节点配置值 |
|
|
417
|
+
| `--patch-file` | 否 | JSON 文件路径,深度合并更新节点配置值 |
|
|
418
|
+
| `--data` / `--data-file` | 否 | **已废弃**,请使用 `--patch` / `--patch-file` |
|
|
419
|
+
| `--validate-vars` | 否 | 校验 patch 中的变量引用(`{{Nxxx.field}}`)合法性 |
|
|
389
420
|
| `--position-x` | 否 | 节点 X 坐标 |
|
|
390
421
|
| `--position-y` | 否 | 节点 Y 坐标 |
|
|
391
422
|
| `--note` | 否 | 节点备注 |
|
|
@@ -393,25 +424,44 @@ ai-flow flow node update <nodeId> \
|
|
|
393
424
|
| `--action-id` | 否 | 更换动作 ID |
|
|
394
425
|
| `--account-id` | 否 | 更换账号实例 ID |
|
|
395
426
|
| `--error-handler-file` | 否 | 错误处理配置 JSON 文件 |
|
|
427
|
+
| `--json` | 否 | 以 JSON 格式输出 `{ ok, id, message }` |
|
|
396
428
|
|
|
397
|
-
> `--
|
|
429
|
+
> `--patch` 与 `--data` 的区别:`--patch` 与现有配置做深度合并,语义明确为 patch 操作;`--data` 为旧参数,语义不统一,已废弃。
|
|
398
430
|
|
|
399
431
|
### flow node delete
|
|
400
432
|
|
|
401
|
-
|
|
433
|
+
删除连接流中的节点。默认需 `--yes` 确认(面向 Agent 的非交互模式)。
|
|
402
434
|
|
|
403
435
|
```bash
|
|
404
|
-
#
|
|
436
|
+
# 直接删除
|
|
437
|
+
ai-flow flow node delete <nodeId> --flow-id <flowId> --yes
|
|
438
|
+
|
|
439
|
+
# 不带 --yes 时输出结构化提示,由调用方二次确认
|
|
405
440
|
ai-flow flow node delete <nodeId> --flow-id <flowId>
|
|
406
441
|
|
|
407
|
-
#
|
|
408
|
-
ai-flow flow node delete <nodeId> --flow-id <flowId> --
|
|
442
|
+
# JSON 输出
|
|
443
|
+
ai-flow flow node delete <nodeId> --flow-id <flowId> --yes --json
|
|
409
444
|
```
|
|
410
445
|
|
|
411
446
|
| 选项 | 必填 | 说明 |
|
|
412
447
|
|------|------|------|
|
|
413
448
|
| `--flow-id` | 是 | 连接流 ID |
|
|
414
|
-
| `--
|
|
449
|
+
| `--yes` | 否 | 跳过确认,直接删除。不带此参数时输出确认提示 JSON |
|
|
450
|
+
| `--json` | 否 | 以 JSON 格式输出 `{ ok, id, message }` |
|
|
451
|
+
|
|
452
|
+
### flow node list
|
|
453
|
+
|
|
454
|
+
列出流中所有节点的轻量级列表。
|
|
455
|
+
|
|
456
|
+
```bash
|
|
457
|
+
ai-flow flow node list --flow-id <flowId>
|
|
458
|
+
ai-flow flow node list --flow-id <flowId> --json
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
| 选项 | 必填 | 说明 |
|
|
462
|
+
|------|------|------|
|
|
463
|
+
| `--flow-id` | 是 | 连接流 ID |
|
|
464
|
+
| `--json` | 否 | 以 JSON 格式输出节点数组 `[{ id, name, type, status, position }]` |
|
|
415
465
|
|
|
416
466
|
### flow account list
|
|
417
467
|
|
|
@@ -420,13 +470,13 @@ ai-flow flow node delete <nodeId> --flow-id <flowId> --force
|
|
|
420
470
|
```bash
|
|
421
471
|
ai-flow flow account list <connectorId>
|
|
422
472
|
ai-flow flow account list <connectorId> --account-schema-id <id>
|
|
423
|
-
ai-flow flow account list <connectorId> --
|
|
473
|
+
ai-flow flow account list <connectorId> --json
|
|
424
474
|
```
|
|
425
475
|
|
|
426
476
|
| 选项 | 必填 | 说明 |
|
|
427
477
|
|------|------|------|
|
|
428
478
|
| `--account-schema-id` | 否 | 按账号模型过滤 |
|
|
429
|
-
| `--
|
|
479
|
+
| `--json` | 否 | 以 JSON 格式输出 |
|
|
430
480
|
|
|
431
481
|
## flow edge connect
|
|
432
482
|
|
|
@@ -497,6 +547,7 @@ ai-flow flow edge connect \
|
|
|
497
547
|
| `--source-handle` | 否 | `output` | 源节点输出句柄 |
|
|
498
548
|
| `--target-handle` | 否 | `input` | 目标节点输入句柄 |
|
|
499
549
|
| `--edges-file` | 批量模式必填 | — | JSON 文件,含边数组 |
|
|
550
|
+
| `--json` | 否 | — | 以 JSON 格式输出 `{ ok, edgeIds, edges }` |
|
|
500
551
|
|
|
501
552
|
### flow edge disconnect
|
|
502
553
|
|
|
@@ -508,8 +559,17 @@ ai-flow flow edge disconnect --flow-id <flowId> --edge-ids <edgeId>
|
|
|
508
559
|
|
|
509
560
|
# 删除多条边
|
|
510
561
|
ai-flow flow edge disconnect --flow-id <flowId> --edge-ids <id1> <id2> <id3>
|
|
562
|
+
|
|
563
|
+
# JSON 输出
|
|
564
|
+
ai-flow flow edge disconnect --flow-id <flowId> --edge-ids <id1> --json
|
|
511
565
|
```
|
|
512
566
|
|
|
567
|
+
| 选项 | 必填 | 说明 |
|
|
568
|
+
|------|------|------|
|
|
569
|
+
| `--flow-id` | 是 | 连接流 ID |
|
|
570
|
+
| `--edge-ids` | 是 | 要删除的边 ID(可多个) |
|
|
571
|
+
| `--json` | 否 | 以 JSON 格式输出 `{ ok, removedEdgeIds }` |
|
|
572
|
+
|
|
513
573
|
### flow variables show
|
|
514
574
|
|
|
515
575
|
获取连接流中目标节点可用的上游变量。
|
|
@@ -518,14 +578,14 @@ ai-flow flow edge disconnect --flow-id <flowId> --edge-ids <id1> <id2> <id3>
|
|
|
518
578
|
ai-flow flow variables show <flowId>
|
|
519
579
|
ai-flow flow variables show <flowId> --node-id <targetNodeId>
|
|
520
580
|
ai-flow flow variables show <flowId> --global # 同时显示全局变量
|
|
521
|
-
ai-flow flow variables show <flowId> --
|
|
581
|
+
ai-flow flow variables show <flowId> --json # JSON 格式输出
|
|
522
582
|
```
|
|
523
583
|
|
|
524
584
|
| 选项 | 必填 | 默认值 | 说明 |
|
|
525
585
|
|------|------|--------|------|
|
|
526
586
|
| `--node-id` | 否 | 流中第一个节点 | 目标节点 ID |
|
|
527
587
|
| `--global` | 否 | `false` | 同时显示全局变量 |
|
|
528
|
-
| `--
|
|
588
|
+
| `--json` | 否 | — | 以 JSON 格式输出 |
|
|
529
589
|
|
|
530
590
|
输出展示每个上游节点的输出字段树,以及可用的变量引用格式:
|
|
531
591
|
```
|
|
@@ -537,35 +597,222 @@ hook_url [STRING] = https://... {{N2056988936204374018.hook_url}}
|
|
|
537
597
|
|
|
538
598
|
### flow variables inject
|
|
539
599
|
|
|
540
|
-
|
|
600
|
+
> **已废弃**:请使用 `flow node update --validate-vars` 代替。`variables inject` 仍然可用但会输出废弃警告。
|
|
601
|
+
|
|
602
|
+
在节点配置中注入变量引用。通过 `--data` 传入包含 `{{Nxxx.field}}` 占位符的 JSON,验证引用的合法性后提交更新。
|
|
541
603
|
|
|
542
604
|
```bash
|
|
543
|
-
#
|
|
544
|
-
ai-flow flow
|
|
545
|
-
--
|
|
605
|
+
# 推荐:使用 flow node update --validate-vars
|
|
606
|
+
ai-flow flow node update <nodeId> --flow-id <flowId> \
|
|
607
|
+
--patch-file ./config-with-vars.json --validate-vars
|
|
546
608
|
|
|
547
|
-
#
|
|
548
|
-
ai-flow flow variables inject <flowId> <nodeId>
|
|
549
|
-
--data '{"properties": {"millisecond": "{{N2056988936204374018.value}}"}}' \
|
|
550
|
-
--dry-run
|
|
551
|
-
|
|
552
|
-
# 预览模式(不实际更新)
|
|
553
|
-
ai-flow flow variables inject <flowId> <nodeId> \
|
|
554
|
-
--data-file ./config-with-vars.json \
|
|
555
|
-
--dry-run
|
|
609
|
+
# 旧方式(已废弃)
|
|
610
|
+
ai-flow flow variables inject <flowId> <nodeId> --data-file ./config-with-vars.json --dry-run
|
|
556
611
|
```
|
|
557
612
|
|
|
558
|
-
|
|
613
|
+
---
|
|
614
|
+
|
|
615
|
+
### flow draft
|
|
616
|
+
|
|
617
|
+
两阶段提交模式:先创建草稿流,确认后再提交。适合通过 `--data-file` 一次性传入完整流定义的场景。
|
|
618
|
+
|
|
619
|
+
```bash
|
|
620
|
+
# 创建草稿流(含完整 nodes + connections)
|
|
621
|
+
ai-flow flow draft create --name "草稿流" --data-file ./flow.json
|
|
622
|
+
ai-flow flow draft create --name "草稿流" --data-file ./flow.json --json
|
|
623
|
+
|
|
624
|
+
# 提交草稿流
|
|
625
|
+
ai-flow flow draft commit <flowId>
|
|
626
|
+
ai-flow flow draft commit <flowId> --json
|
|
627
|
+
|
|
628
|
+
# 丢弃草稿流(删除所有节点)
|
|
629
|
+
ai-flow flow draft discard <flowId> --yes
|
|
630
|
+
ai-flow flow draft discard <flowId> --yes --json
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
### flow validate
|
|
634
|
+
|
|
635
|
+
干跑校验流配置完整性(不实际执行),检查节点配置、边连接合法性、必填字段。
|
|
636
|
+
|
|
637
|
+
```bash
|
|
638
|
+
ai-flow flow validate <flowId>
|
|
639
|
+
ai-flow flow validate <flowId> --json
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
`--json` 输出示例:
|
|
559
643
|
```json
|
|
560
644
|
{
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
645
|
+
"ok": false,
|
|
646
|
+
"flowId": "123",
|
|
647
|
+
"nodeCount": 3,
|
|
648
|
+
"edgeCount": 2,
|
|
649
|
+
"errors": ["边 e1 的源节点 N4 不存在"],
|
|
650
|
+
"warnings": []
|
|
564
651
|
}
|
|
565
652
|
```
|
|
566
653
|
|
|
567
654
|
---
|
|
568
655
|
|
|
656
|
+
### flow log list
|
|
657
|
+
|
|
658
|
+
列出流程运行日志,支持按流程、状态、时间范围筛选。
|
|
659
|
+
|
|
660
|
+
```bash
|
|
661
|
+
ai-flow flow log list
|
|
662
|
+
ai-flow flow log list --flow-id <flowId>
|
|
663
|
+
ai-flow flow log list --flow-id <flowId> --status 0 --time-range 1d
|
|
664
|
+
ai-flow flow log list --page 1 --size 20 --search "error"
|
|
665
|
+
ai-flow flow log list --flow-id <flowId> --json
|
|
666
|
+
```
|
|
667
|
+
|
|
668
|
+
| 选项 | 说明 |
|
|
669
|
+
|------|------|
|
|
670
|
+
| `--flow-id` | 按流程 ID 筛选 |
|
|
671
|
+
| `--page / --size` | 分页 |
|
|
672
|
+
| `--status` | 运行状态:0=失败, 1=成功, 2=警告, 3=运行中, 4=手动停止, 5=超时, 6=超限 |
|
|
673
|
+
| `--type` | 事件类型 |
|
|
674
|
+
| `--time-range` | 时间范围:1h, 12h, 1d, 7d, 1m |
|
|
675
|
+
| `--search` | 搜索文本 |
|
|
676
|
+
| `--json` | 以 JSON 格式输出(敏感字段自动脱敏) |
|
|
677
|
+
|
|
678
|
+
### flow log show
|
|
679
|
+
|
|
680
|
+
查看某次运行的节点执行树详情。支持查看子节点循环迭代日志。
|
|
681
|
+
|
|
682
|
+
```bash
|
|
683
|
+
ai-flow flow log show --id <logId>
|
|
684
|
+
ai-flow flow log show --id <logId> --node-id <baseId>
|
|
685
|
+
ai-flow flow log show --id <logId> --child <baseId>
|
|
686
|
+
ai-flow flow log show --id <logId> --child <baseId> --child-page 2 --child-size 10
|
|
687
|
+
ai-flow flow log show --id <logId> --json
|
|
688
|
+
```
|
|
689
|
+
|
|
690
|
+
| 选项 | 说明 |
|
|
691
|
+
|------|------|
|
|
692
|
+
| `--id` | 日志运行 ID |
|
|
693
|
+
| `--node-id` | 查看指定节点的输入/输出详情 |
|
|
694
|
+
| `--child` | 查看子节点循环迭代日志 |
|
|
695
|
+
| `--child-page / --child-size` | 循环迭代分页 |
|
|
696
|
+
| `--json` | 以 JSON 格式输出(敏感字段自动脱敏) |
|
|
697
|
+
|
|
698
|
+
---
|
|
699
|
+
|
|
700
|
+
## 身份自动化
|
|
701
|
+
|
|
702
|
+
管理连接流中的身份上游/下游自动化连接器。这两类连接器本质上是**特殊的连接流**,创建后即可通过 `ai-flow link <id>` 查看,其中的节点添加、边连接、分析等操作与其他连接流一致,统一使用 `ai-flow flow` 命令。
|
|
703
|
+
|
|
704
|
+
> 通过 `link create` 或 `sync create` 创建的连接器会返回 ID,该 ID 即为连接流 ID,可直接用于 `ai-flow flow list`、`ai-flow flow analyze <id>`、`ai-flow flow node create --flow-id <id>` 等命令。
|
|
705
|
+
|
|
706
|
+
### link — 身份上游自动化(通讯录集成)
|
|
707
|
+
|
|
708
|
+
从外部系统拉入组织与用户数据到 IDaaS。
|
|
709
|
+
|
|
710
|
+
#### 连接器管理
|
|
711
|
+
|
|
712
|
+
```bash
|
|
713
|
+
# 列出已创建的上游连接器(名称、类型、同步周期、时间、状态)
|
|
714
|
+
ai-flow link list
|
|
715
|
+
|
|
716
|
+
# 查看可用模板类型(供 create --type 参考,按企业身份源/HTTP/数据库/LDAP 分组)
|
|
717
|
+
ai-flow link templates
|
|
718
|
+
|
|
719
|
+
# 创建上游连接器
|
|
720
|
+
ai-flow link create --type DINGDING
|
|
721
|
+
ai-flow link create --type HTTPFLOW --name "我的上游"
|
|
722
|
+
ai-flow link create --type DBFLOW --reset # 创建后立即套用预设模板
|
|
723
|
+
|
|
724
|
+
# 重置连接器为模板初始状态
|
|
725
|
+
ai-flow link reset --id <connectorId>
|
|
726
|
+
```
|
|
727
|
+
|
|
728
|
+
#### 同步日志
|
|
729
|
+
|
|
730
|
+
```bash
|
|
731
|
+
# 列出同步日志(含开始时间、结束时间、事件类型、状态)
|
|
732
|
+
ai-flow link log list --connector-id <id>
|
|
733
|
+
ai-flow link log list --connector-id <id> --page 1 --size 20
|
|
734
|
+
ai-flow link log list --connector-id <id> --status 0 --type 1 --time-range 7d
|
|
735
|
+
ai-flow link log list --connector-id <id> --json
|
|
736
|
+
|
|
737
|
+
# 查看日志详情(含影响统计 + 同步明细)
|
|
738
|
+
ai-flow link log show --id <logId>
|
|
739
|
+
ai-flow link log show --id <logId> --detail-size 10 --detail-page 1
|
|
740
|
+
ai-flow link log show --id <logId> --detail-type USER --detail-status FAILED
|
|
741
|
+
ai-flow link log show --id <logId> --detail-op DELETED --detail-name "张三"
|
|
742
|
+
ai-flow link log show --id <logId> --json
|
|
743
|
+
```
|
|
744
|
+
|
|
745
|
+
| 选项 | 说明 |
|
|
746
|
+
|------|------|
|
|
747
|
+
| `--connector-id` | 连接器 ID |
|
|
748
|
+
| `--page / --size` | 分页(list 命令) |
|
|
749
|
+
| `--status` | 同步结果:0=失败, 1=成功, 2=进行中, -1=警告, 3=部分异常 |
|
|
750
|
+
| `--type` | 事件类型:0=定时任务, 1=手动, 2=事件触发 |
|
|
751
|
+
| `--time-range` | 时间范围:1h, 12h, 1d, 7d, 1m |
|
|
752
|
+
| `--json` | 以 JSON 格式输出(敏感字段自动脱敏,list 和 show 均支持) |
|
|
753
|
+
| `--detail-size` | 同步明细每页条数,默认 10(show 命令) |
|
|
754
|
+
| `--detail-page` | 同步明细页码,默认 1(show 命令) |
|
|
755
|
+
| `--detail-type` | 资源类型筛选:USER / ORG / ROLE |
|
|
756
|
+
| `--detail-status` | 同步状态筛选:SUCCESS / FAILED |
|
|
757
|
+
| `--detail-op` | 操作类型筛选:CREATED / UPDATED / DELETED |
|
|
758
|
+
| `--detail-name` | 资源名称模糊匹配 |
|
|
759
|
+
|
|
760
|
+
### sync — 身份下游自动化(通讯录同步)
|
|
761
|
+
|
|
762
|
+
从 IDaaS 推送组织与用户数据到外部系统。
|
|
763
|
+
|
|
764
|
+
#### 连接器管理
|
|
765
|
+
|
|
766
|
+
```bash
|
|
767
|
+
# 列出已创建的下游连接器
|
|
768
|
+
ai-flow sync list
|
|
769
|
+
|
|
770
|
+
# 查看可用模板类型
|
|
771
|
+
ai-flow sync templates
|
|
772
|
+
|
|
773
|
+
# 创建下游连接器
|
|
774
|
+
ai-flow sync create --type HTTPPUSHFLOW
|
|
775
|
+
ai-flow sync create --type HTTPPUSHFLOW --name "我的下游" --reset
|
|
776
|
+
|
|
777
|
+
# 重置连接器为模板初始状态
|
|
778
|
+
ai-flow sync reset --id <connectorId>
|
|
779
|
+
```
|
|
780
|
+
|
|
781
|
+
#### 推送日志
|
|
782
|
+
|
|
783
|
+
```bash
|
|
784
|
+
# 列出推送日志
|
|
785
|
+
ai-flow sync log list --connector-id <id>
|
|
786
|
+
ai-flow sync log list --connector-id <id> --page 1 --size 20
|
|
787
|
+
ai-flow sync log list --connector-id <id> --status 0 --type 1 --time-range 7d
|
|
788
|
+
ai-flow sync log list --connector-id <id> --json
|
|
789
|
+
|
|
790
|
+
# 查看日志详情(含影响统计 + 推送明细)
|
|
791
|
+
ai-flow sync log show --id <logId>
|
|
792
|
+
ai-flow sync log show --id <logId> --detail-size 10 --detail-page 2
|
|
793
|
+
ai-flow sync log show --id <logId> --detail-type ORG --detail-status SUCCESS
|
|
794
|
+
ai-flow sync log show --id <logId> --json
|
|
795
|
+
```
|
|
796
|
+
|
|
797
|
+
| 选项 | 说明 |
|
|
798
|
+
|------|------|
|
|
799
|
+
| `--connector-id` | 连接器 ID |
|
|
800
|
+
| `--page / --size` | 分页(list 命令) |
|
|
801
|
+
| `--status` | 同步结果:0=失败, 1=成功, 2=进行中, -1=警告, 3=部分异常 |
|
|
802
|
+
| `--type` | 事件类型:0=定时任务, 1=手动, 2=事件触发 |
|
|
803
|
+
| `--time-range` | 时间范围:1h, 12h, 1d, 7d, 1m |
|
|
804
|
+
| `--json` | 以 JSON 格式输出(敏感字段自动脱敏,list 和 show 均支持) |
|
|
805
|
+
| `--detail-size` | 推送明细每页条数,默认 10(show 命令) |
|
|
806
|
+
| `--detail-page` | 推送明细页码,默认 1(show 命令) |
|
|
807
|
+
| `--detail-type` | 资源类型筛选:USER / ORG / ROLE |
|
|
808
|
+
| `--detail-status` | 同步状态筛选:SUCCESS / FAILED |
|
|
809
|
+
| `--detail-op` | 操作类型筛选:CREATED / UPDATED / DELETED |
|
|
810
|
+
| `--detail-name` | 资源名称模糊匹配 |
|
|
811
|
+
|
|
812
|
+
> 前置检查:查看日志前检查连接器是否已执行过同步/推送,如有问题仅提醒不阻塞。
|
|
813
|
+
|
|
814
|
+
---
|
|
815
|
+
|
|
569
816
|
## 知识库
|
|
570
817
|
|
|
571
818
|
### knowledge categories
|
|
@@ -621,7 +868,7 @@ ai-flow knowledge nodes --json
|
|
|
621
868
|
```bash
|
|
622
869
|
ai-flow knowledge actions <linkId>
|
|
623
870
|
ai-flow knowledge actions <linkId> --trigger # 仅触发器
|
|
624
|
-
ai-flow knowledge actions <linkId> --json # JSON
|
|
871
|
+
ai-flow knowledge actions <linkId> --json # JSON 格式输出(含 output_schema 字段)
|
|
625
872
|
```
|
|
626
873
|
|
|
627
874
|
### knowledge generate-skills
|
|
@@ -630,6 +877,8 @@ ai-flow knowledge actions <linkId> --json # JSON 格式输出
|
|
|
630
877
|
|
|
631
878
|
```bash
|
|
632
879
|
ai-flow knowledge generate-skills ./docs
|
|
880
|
+
ai-flow knowledge generate-skills ./docs --since "2026-01-01T00:00:00Z" # 增量更新
|
|
881
|
+
ai-flow knowledge generate-skills ./docs --since "2026-01-01T00:00:00Z" --diff # 增量 + 变化对比
|
|
633
882
|
```
|
|
634
883
|
|
|
635
884
|
输出:
|
|
@@ -660,6 +909,16 @@ docs/
|
|
|
660
909
|
|
|
661
910
|
---
|
|
662
911
|
|
|
912
|
+
## Shell Completion
|
|
913
|
+
|
|
914
|
+
```bash
|
|
915
|
+
# zsh
|
|
916
|
+
echo 'eval "$(ai-flow completion --zsh)"' >> ~/.zshrc
|
|
917
|
+
|
|
918
|
+
# bash
|
|
919
|
+
echo 'source <(ai-flow completion --bash)' >> ~/.bashrc
|
|
920
|
+
```
|
|
921
|
+
|
|
663
922
|
## 开发
|
|
664
923
|
|
|
665
924
|
```bash
|
|
@@ -683,7 +942,24 @@ src/
|
|
|
683
942
|
├── index.ts # CLI 入口
|
|
684
943
|
├── commands/
|
|
685
944
|
│ ├── config.ts # ai-flow config
|
|
686
|
-
│ ├──
|
|
945
|
+
│ ├── auth.ts # ai-flow auth
|
|
946
|
+
│ ├── flow.ts # ai-flow flow 父命令
|
|
947
|
+
│ ├── flow/
|
|
948
|
+
│ │ ├── create.ts # flow create
|
|
949
|
+
│ │ ├── update.ts # flow update
|
|
950
|
+
│ │ ├── list.ts # flow list
|
|
951
|
+
│ │ ├── analyze.ts # flow analyze
|
|
952
|
+
│ │ ├── test.ts # flow test
|
|
953
|
+
│ │ ├── node.ts # flow node (show/create/update/delete/list)
|
|
954
|
+
│ │ ├── edge.ts # flow edge (connect/disconnect)
|
|
955
|
+
│ │ ├── account.ts # flow account list
|
|
956
|
+
│ │ ├── variables.ts # flow variables (show/inject)
|
|
957
|
+
│ │ ├── log.ts # flow log (list/show)
|
|
958
|
+
│ │ ├── draft.ts # flow draft (create/commit/discard)
|
|
959
|
+
│ │ ├── validate.ts # flow validate
|
|
960
|
+
│ │ └── helpers.ts # 共享辅助函数
|
|
961
|
+
│ ├── link.ts # ai-flow link(身份上游自动化)
|
|
962
|
+
│ ├── sync.ts # ai-flow sync(身份下游自动化)
|
|
687
963
|
│ └── knowledge.ts # ai-flow knowledge
|
|
688
964
|
├── api/
|
|
689
965
|
│ ├── client.ts # axios 实例(SSL、Token)
|
|
@@ -691,14 +967,21 @@ src/
|
|
|
691
967
|
│ ├── node.ts # 节点 CRUD + 测试运行
|
|
692
968
|
│ ├── edge.ts # 边管理
|
|
693
969
|
│ ├── knowledge.ts # 分类/节点搜索
|
|
694
|
-
│
|
|
970
|
+
│ ├── variables.ts # 全局变量 + 输出树
|
|
971
|
+
│ ├── link.ts # 上游连接器 API
|
|
972
|
+
│ └── sync.ts # 下游连接器 API
|
|
695
973
|
├── services/
|
|
696
974
|
│ ├── flowAnalyzer.ts # DAG 拓扑分析
|
|
697
975
|
│ └── skillGenerator.ts # Skills 批量生成
|
|
698
976
|
├── utils/
|
|
977
|
+
│ ├── common.ts # JSON 安全解析
|
|
699
978
|
│ ├── config.ts # 配置持久化(全局 + 项目级)
|
|
979
|
+
│ ├── encoding.ts # Base64 编解码
|
|
980
|
+
│ ├── format.ts # 数据转换
|
|
981
|
+
│ ├── mask.ts # 敏感数据脱敏
|
|
982
|
+
│ ├── oauth.ts # OAuth 设备流
|
|
700
983
|
│ ├── output.ts # 终端彩色输出
|
|
701
|
-
│ └──
|
|
984
|
+
│ └── updateCheck.ts # 版本更新检查
|
|
702
985
|
└── types/
|
|
703
986
|
└── index.ts # TypeScript 类型定义
|
|
704
987
|
```
|
package/dist/api/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AACA,OAAc,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AACA,OAAc,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAEjE,OAAO,EAAuB,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAgGhE,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAGpD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAGlE;AAuCD,wBAAgB,SAAS,IAAI,aAAa,CAKzC;AAED,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAED,wBAAsB,MAAM,CAAC,CAAC,GAAG,OAAO,EACtC,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,CAAC,CAAC,CAIZ;AAED,wBAAsB,OAAO,CAAC,CAAC,GAAG,OAAO,EACvC,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,OAAO,EACd,MAAM,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,CAAC,CAAC,CAIZ;AAED,wBAAsB,QAAQ,CAAC,CAAC,GAAG,OAAO,EACxC,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,OAAO,EACd,MAAM,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,CAAC,CAAC,CAIZ;AAED,wBAAsB,SAAS,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAIpE"}
|