@fieldwangai/agentflow 0.1.159 → 0.1.162

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.
Files changed (118) hide show
  1. package/bin/lib/auth.mjs +231 -14
  2. package/bin/lib/catalog-flows.mjs +12 -1
  3. package/bin/lib/cli-auth-page.mjs +103 -0
  4. package/bin/lib/control-while.mjs +336 -0
  5. package/bin/lib/flow-dsl/codegen.mjs +74 -11
  6. package/bin/lib/flow-dsl/ir.mjs +33 -2
  7. package/bin/lib/flow-dsl/lint.mjs +128 -3
  8. package/bin/lib/flow-dsl/parser.mjs +168 -4
  9. package/bin/lib/marketplace.mjs +10 -2
  10. package/bin/lib/node-package-manifest.mjs +7 -2
  11. package/bin/lib/node-ui-kit.mjs +156 -0
  12. package/bin/lib/paths.mjs +2 -0
  13. package/bin/lib/skill-runtime.mjs +6 -0
  14. package/bin/lib/table.mjs +2 -3
  15. package/bin/lib/ui-server.mjs +220 -17
  16. package/bin/lib/workspace-draft.mjs +74 -0
  17. package/bin/lib/workspace-flow-store.mjs +11 -2
  18. package/bin/lib/workspace-graph-merge.mjs +3 -0
  19. package/bin/lib/workspace-routes.mjs +307 -5
  20. package/bin/lib/workspace-server.mjs +598 -11
  21. package/bin/pipeline/validate-flow.mjs +3 -3
  22. package/builtin/nodes/control_parse_json.md +25 -0
  23. package/builtin/nodes/control_subflow_call.md +27 -0
  24. package/builtin/nodes/control_while.md +124 -0
  25. package/builtin/nodes/provide_json.md +14 -0
  26. package/builtin/nodes/workspace_subflow_input.md +14 -0
  27. package/builtin/pipelines/new/workspace.flow.js +1 -1
  28. package/builtin/pipelines/subflow-preview/workspace.flow.js +29 -0
  29. package/builtin/pipelines/subflow-preview/workspace.layout.json +38 -0
  30. package/builtin/pipelines/subflow-preview/workspace.nodes.json +19 -0
  31. package/builtin/pipelines/subflow-preview/workspace.state.json +93 -0
  32. package/builtin/pipelines/while-subflow-preview/workspace.flow.js +55 -0
  33. package/builtin/pipelines/while-subflow-preview/workspace.layout.json +66 -0
  34. package/builtin/pipelines/while-subflow-preview/workspace.nodes.json +49 -0
  35. package/builtin/pipelines/while-subflow-preview/workspace.state.json +194 -0
  36. package/builtin/web-ui/dist/assets/{WorkflowAssistantThread-CY19DsYq.js → WorkflowAssistantThread-CTrXOZ00.js} +1 -1
  37. package/builtin/web-ui/dist/assets/index-5uJFccdX.css +1 -0
  38. package/builtin/web-ui/dist/assets/index-BeUfNQRL.js +873 -0
  39. package/builtin/web-ui/dist/index.html +2 -2
  40. package/package.json +6 -1
  41. package/reference/flow-control-capabilities.md +41 -16
  42. package/shared/slot-types.js +58 -0
  43. package/skills/agentflow-author-flow/SKILL.md +81 -8
  44. package/skills/agentflow-author-flow/agents/openai.yaml +3 -3
  45. package/skills/agentflow-cli/SKILL.md +130 -25
  46. package/skills/agentflow-cli/agents/openai.yaml +2 -2
  47. package/skills/agentflow-cli/runtime/bin/lib/skill-runtime.mjs +14765 -0
  48. package/skills/agentflow-cli/runtime/builtin/nodes/agent_subAgent.md +34 -0
  49. package/skills/agentflow-cli/runtime/builtin/nodes/control_agent_toBool.md +26 -0
  50. package/skills/agentflow-cli/runtime/builtin/nodes/control_anyOne.md +19 -0
  51. package/skills/agentflow-cli/runtime/builtin/nodes/control_cancelled.md +26 -0
  52. package/skills/agentflow-cli/runtime/builtin/nodes/control_cd_workspace.md +50 -0
  53. package/skills/agentflow-cli/runtime/builtin/nodes/control_delay.md +31 -0
  54. package/skills/agentflow-cli/runtime/builtin/nodes/control_end.md +13 -0
  55. package/skills/agentflow-cli/runtime/builtin/nodes/control_if.md +21 -0
  56. package/skills/agentflow-cli/runtime/builtin/nodes/control_interval_loop.md +55 -0
  57. package/skills/agentflow-cli/runtime/builtin/nodes/control_load_mcp.md +24 -0
  58. package/skills/agentflow-cli/runtime/builtin/nodes/control_load_skills.md +35 -0
  59. package/skills/agentflow-cli/runtime/builtin/nodes/control_parse_json.md +25 -0
  60. package/skills/agentflow-cli/runtime/builtin/nodes/control_start.md +13 -0
  61. package/skills/agentflow-cli/runtime/builtin/nodes/control_subflow_call.md +27 -0
  62. package/skills/agentflow-cli/runtime/builtin/nodes/control_toBool.md +27 -0
  63. package/skills/agentflow-cli/runtime/builtin/nodes/control_user_workspace.md +24 -0
  64. package/skills/agentflow-cli/runtime/builtin/nodes/control_wait_until.md +34 -0
  65. package/skills/agentflow-cli/runtime/builtin/nodes/control_while.md +124 -0
  66. package/skills/agentflow-cli/runtime/builtin/nodes/display_ascii.md +24 -0
  67. package/skills/agentflow-cli/runtime/builtin/nodes/display_chart.md +32 -0
  68. package/skills/agentflow-cli/runtime/builtin/nodes/display_code.md +39 -0
  69. package/skills/agentflow-cli/runtime/builtin/nodes/display_html.md +32 -0
  70. package/skills/agentflow-cli/runtime/builtin/nodes/display_image.md +36 -0
  71. package/skills/agentflow-cli/runtime/builtin/nodes/display_markdown.md +24 -0
  72. package/skills/agentflow-cli/runtime/builtin/nodes/display_mermaid.md +24 -0
  73. package/skills/agentflow-cli/runtime/builtin/nodes/display_react_app.md +53 -0
  74. package/skills/agentflow-cli/runtime/builtin/nodes/display_table.md +32 -0
  75. package/skills/agentflow-cli/runtime/builtin/nodes/provide_bool.md +14 -0
  76. package/skills/agentflow-cli/runtime/builtin/nodes/provide_file.md +14 -0
  77. package/skills/agentflow-cli/runtime/builtin/nodes/provide_json.md +14 -0
  78. package/skills/agentflow-cli/runtime/builtin/nodes/provide_password.md +14 -0
  79. package/skills/agentflow-cli/runtime/builtin/nodes/provide_str.md +14 -0
  80. package/skills/agentflow-cli/runtime/builtin/nodes/tool_display_share_link.md +47 -0
  81. package/skills/agentflow-cli/runtime/builtin/nodes/tool_get_env.md +20 -0
  82. package/skills/agentflow-cli/runtime/builtin/nodes/tool_git_checkout.md +70 -0
  83. package/skills/agentflow-cli/runtime/builtin/nodes/tool_git_worktree_load.md +73 -0
  84. package/skills/agentflow-cli/runtime/builtin/nodes/tool_git_worktree_unload.md +52 -0
  85. package/skills/agentflow-cli/runtime/builtin/nodes/tool_gitlab_create_mr.md +114 -0
  86. package/skills/agentflow-cli/runtime/builtin/nodes/tool_jenkins_build.md +67 -0
  87. package/skills/agentflow-cli/runtime/builtin/nodes/tool_load_key.md +26 -0
  88. package/skills/agentflow-cli/runtime/builtin/nodes/tool_nodejs.md +52 -0
  89. package/skills/agentflow-cli/runtime/builtin/nodes/tool_print.md +21 -0
  90. package/skills/agentflow-cli/runtime/builtin/nodes/tool_save_key.md +26 -0
  91. package/skills/agentflow-cli/runtime/builtin/nodes/tool_set_run_env.md +38 -0
  92. package/skills/agentflow-cli/runtime/builtin/nodes/tool_user_ask.md +27 -0
  93. package/skills/agentflow-cli/runtime/builtin/nodes/tool_user_check.md +26 -0
  94. package/skills/agentflow-cli/runtime/builtin/nodes/tool_wecom_send_app_markdown.md +57 -0
  95. package/skills/agentflow-cli/runtime/builtin/nodes/tool_wecom_send_group_markdown.md +45 -0
  96. package/skills/agentflow-cli/runtime/builtin/nodes/workspace_one_click_task.md +44 -0
  97. package/skills/agentflow-cli/runtime/builtin/nodes/workspace_run.md +16 -0
  98. package/skills/agentflow-cli/runtime/builtin/nodes/workspace_scheduled_run.md +16 -0
  99. package/skills/agentflow-cli/runtime/builtin/nodes/workspace_subflow_input.md +14 -0
  100. package/skills/agentflow-cli/runtime/package.json +6 -0
  101. package/skills/agentflow-cli/scripts/agentflow-auth-store.mjs +113 -0
  102. package/skills/agentflow-cli/scripts/agentflow-cli.mjs +393 -28
  103. package/skills/agentflow-cli/scripts/agentflow-runtime.mjs +11 -4
  104. package/skills/agentflow-flow-add-instances/SKILL.md +2 -2
  105. package/skills/agentflow-flow-dsl/SKILL.md +83 -10
  106. package/skills/agentflow-flow-dsl/agents/openai.yaml +2 -2
  107. package/skills/agentflow-flow-dsl/references/node-calls.md +3 -0
  108. package/skills/agentflow-flow-dsl/references/subflow-authoring.md +230 -0
  109. package/skills/agentflow-flow-edit-node-fields/SKILL.md +3 -3
  110. package/skills/agentflow-flow-recipes/SKILL.md +1 -1
  111. package/skills/agentflow-flow-recipes/references/recipes.md +1 -2
  112. package/skills/agentflow-flow-sync-ui/SKILL.md +1 -1
  113. package/skills/agentflow-node-dsl/SKILL.md +44 -13
  114. package/skills/agentflow-node-reference/references/builtin-nodes.md +25 -0
  115. package/skills/agentflow-workspace-markdown/SKILL.md +1 -1
  116. package/builtin/web-ui/dist/assets/index-B9ppXv7e.css +0 -1
  117. package/builtin/web-ui/dist/assets/index-CdEQWRrp.js +0 -872
  118. package/skills/agentflow-workspace-graph/SKILL.md +0 -85
@@ -0,0 +1,34 @@
1
+ ---
2
+ # 内置节点:子 Agent
3
+ runtime: native
4
+ description: 利用子 Agent 执行任务;可接收 knowledgeContext 读取知识库,可接收 workspaceContext 切换执行工作区,并接收 skillsContext / mcpContext 注入已加载 skills 与 MCP 工具清单。
5
+ displayName: 子 Agent
6
+ input:
7
+ - type: node
8
+ name: prev
9
+ default: ""
10
+ - type: text
11
+ name: workspaceContext
12
+ default: ""
13
+ - type: text
14
+ name: skillsContext
15
+ default: ""
16
+ showOnNode: true
17
+ - type: text
18
+ name: mcpContext
19
+ default: ""
20
+ - type: text
21
+ name: knowledgeContext
22
+ default: ""
23
+ showOnNode: true
24
+ output:
25
+ - type: node
26
+ name: next
27
+ default: ""
28
+ - type: text
29
+ name: result
30
+ default: ""
31
+ required: true
32
+ showOnNode: true
33
+ ---
34
+ ${USER_PROMPT}
@@ -0,0 +1,26 @@
1
+ ---
2
+ # 内置节点:AI 转布尔(agent 执行)
3
+ runtime: degraded
4
+ palette: hidden
5
+ description: "AI-powered boolean judgment: an agent evaluates the input value and writes true/false to prediction. Use for non-deterministic scenarios requiring semantic understanding."
6
+ displayName: Agent ToBool
7
+ input:
8
+ - type: node
9
+ name: prev
10
+ default: ""
11
+ - type: text
12
+ name: value
13
+ default: ""
14
+ required: true
15
+ showOnNode: true
16
+ output:
17
+ - type: node
18
+ name: next
19
+ default: ""
20
+ - type: bool
21
+ name: prediction
22
+ default: ""
23
+ required: true
24
+ showOnNode: true
25
+ ---
26
+ ${USER_PROMPT}
@@ -0,0 +1,19 @@
1
+ ---
2
+ # 内置节点:任一满足
3
+ runtime: none
4
+ palette: hidden
5
+ description: Continues to next when any upstream input is ready
6
+ displayName: AnyOne
7
+ input:
8
+ - type: node
9
+ name: prev1
10
+ default: ""
11
+ - type: node
12
+ name: prev2
13
+ default: ""
14
+ output:
15
+ - type: node
16
+ name: next
17
+ default: ""
18
+ ---
19
+ ${USER_PROMPT}
@@ -0,0 +1,26 @@
1
+ ---
2
+ # 内置节点:取消判断
3
+ runtime: none
4
+ palette: hidden
5
+ description: Check whether the current wait/run has been cancelled. Use cancelled output with control_if.
6
+ displayName: Cancel Check
7
+ input:
8
+ - type: node
9
+ name: prev
10
+ default: ""
11
+ - type: text
12
+ name: waitId
13
+ default: ""
14
+ required: true
15
+ showOnNode: true
16
+ output:
17
+ - type: node
18
+ name: next
19
+ default: ""
20
+ - type: bool
21
+ name: cancelled
22
+ default: ""
23
+ required: true
24
+ showOnNode: true
25
+ ---
26
+ ${USER_PROMPT}
@@ -0,0 +1,50 @@
1
+ ---
2
+ # 内置节点:加载知识库
3
+ runtime: native
4
+ type: control
5
+ description: |
6
+ Load one or more read-only knowledge sources for downstream Agent nodes.
7
+
8
+ This node does not change the runtime cwd. It publishes `knowledgeContext`
9
+ for reading/searching referenced repos or folders. `workspaceContext` and
10
+ `cwd` are retained as legacy compatibility outputs for the first source.
11
+ displayName: 加载知识库
12
+ input:
13
+ - type: node
14
+ name: prev
15
+ default: ""
16
+ - type: text
17
+ name: path
18
+ default: ""
19
+ showOnNode: false
20
+ - type: text
21
+ name: label
22
+ default: ""
23
+ showOnNode: false
24
+ - type: text
25
+ name: knowledgeContext
26
+ default: ""
27
+ showOnNode: false
28
+ - type: text
29
+ name: workspaceContext
30
+ default: ""
31
+ showOnNode: false
32
+ output:
33
+ - type: node
34
+ name: next
35
+ default: ""
36
+ - type: text
37
+ name: knowledgeContext
38
+ default: ""
39
+ required: true
40
+ showOnNode: true
41
+ - type: text
42
+ name: workspaceContext
43
+ default: ""
44
+ showOnNode: false
45
+ - type: file
46
+ name: cwd
47
+ default: ""
48
+ showOnNode: false
49
+ ---
50
+ Load selected knowledge sources for downstream agents.
@@ -0,0 +1,31 @@
1
+ ---
2
+ # 内置节点:延迟等待
3
+ runtime: none
4
+ palette: hidden
5
+ description: Persistently wait for a relative duration, then continue when scheduler resumes this run.
6
+ displayName: Delay
7
+ input:
8
+ - type: node
9
+ name: prev
10
+ default: ""
11
+ - type: text
12
+ name: duration
13
+ default: "10m"
14
+ required: true
15
+ showOnNode: true
16
+ output:
17
+ - type: node
18
+ name: next
19
+ default: ""
20
+ - type: text
21
+ name: waitId
22
+ default: ""
23
+ required: true
24
+ showOnNode: true
25
+ - type: text
26
+ name: wakeAt
27
+ default: ""
28
+ required: true
29
+ showOnNode: true
30
+ ---
31
+ ${USER_PROMPT}
@@ -0,0 +1,13 @@
1
+ ---
2
+ # 内置节点:结束
3
+ runtime: none
4
+ palette: hidden
5
+ description: End point of AgentFlow, flow terminates after this node
6
+ displayName: End
7
+ input:
8
+ - type: node
9
+ name: prev
10
+ default: ""
11
+ output: []
12
+ ---
13
+ ${USER_PROMPT}
@@ -0,0 +1,21 @@
1
+ ---
2
+ # 内置节点:If 分支
3
+ runtime: native
4
+ description: Has exactly one bool type input. Continues to next1 if true, next2 if false
5
+ displayName: If
6
+ input:
7
+ - type: node
8
+ name: prev
9
+ default: ""
10
+ - type: bool
11
+ name: prediction
12
+ default: ""
13
+ output:
14
+ - type: node
15
+ name: next1
16
+ default: ""
17
+ - type: node
18
+ name: next2
19
+ default: ""
20
+ ---
21
+ ${USER_PROMPT}
@@ -0,0 +1,55 @@
1
+ ---
2
+ # 内置节点:间隔循环
3
+ runtime: none
4
+ palette: hidden
5
+ description: Wait by interval and branch to continue, done, timeout, or cancelled for watch-style flows.
6
+ displayName: IntervalLoop
7
+ input:
8
+ - type: node
9
+ name: prev
10
+ default: ""
11
+ - type: bool
12
+ name: done
13
+ default: ""
14
+ - type: bool
15
+ name: cancelled
16
+ default: ""
17
+ - type: text
18
+ name: interval
19
+ default: "10m"
20
+ - type: text
21
+ name: startAt
22
+ default: ""
23
+ - type: text
24
+ name: duration
25
+ default: ""
26
+ - type: text
27
+ name: deadlineAt
28
+ default: ""
29
+ - type: text
30
+ name: timezone
31
+ default: "Asia/Shanghai"
32
+ output:
33
+ - type: node
34
+ name: continue
35
+ default: ""
36
+ - type: node
37
+ name: done
38
+ default: ""
39
+ - type: node
40
+ name: timeout
41
+ default: ""
42
+ - type: node
43
+ name: cancelled
44
+ default: ""
45
+ - type: text
46
+ name: wakeAt
47
+ default: ""
48
+ - type: bool
49
+ name: expired
50
+ default: ""
51
+ - type: text
52
+ name: deadlineAt
53
+ default: ""
54
+ ---
55
+ ${USER_PROMPT}
@@ -0,0 +1,24 @@
1
+ ---
2
+ # 内置节点:Load MCP
3
+ runtime: native
4
+ type: control
5
+ description: 加载所选 Cursor MCP Server 的工具清单,通过 mcpContext 传给下游 agent 节点。
6
+ displayName: Load MCP
7
+ input:
8
+ - type: node
9
+ name: prev
10
+ default: ""
11
+ - type: text
12
+ name: serverNames
13
+ default: ""
14
+ showOnNode: false
15
+ output:
16
+ - type: node
17
+ name: next
18
+ default: ""
19
+ - type: text
20
+ name: mcpContext
21
+ default: ""
22
+ showOnNode: true
23
+ ---
24
+ Load selected Cursor MCP server tool manifests for downstream agent nodes.
@@ -0,0 +1,35 @@
1
+ ---
2
+ # 内置节点:Load Skills
3
+ runtime: native
4
+ type: control
5
+ description: |
6
+ Load the currently selected Workspace skill collection for downstream agent nodes.
7
+
8
+ Set `skillKeys` to skill names or registry keys, then connect `skillsContext` to
9
+ downstream agent/tool nodes. Loaded skills are injected into the node prompt under
10
+ "已加载 Skills"。
11
+
12
+ Skill key examples:
13
+ - `agentflow-flow-add-instances`
14
+ - `workspace-agents:agentflow-flow-edit-node-fields`
15
+ - `global-codex:some-skill`
16
+ displayName: Load Skills
17
+ input:
18
+ - type: node
19
+ name: prev
20
+ default: ""
21
+ - type: text
22
+ name: skillKeys
23
+ default: ""
24
+ required: true
25
+ showOnNode: true
26
+ output:
27
+ - type: node
28
+ name: next
29
+ default: ""
30
+ - type: text
31
+ name: skillsContext
32
+ default: ""
33
+ showOnNode: true
34
+ ---
35
+ Load public skills `${skillKeys}` and pass them to downstream nodes.
@@ -0,0 +1,25 @@
1
+ ---
2
+ # 内置节点:解析 JSON
3
+ runtime: native
4
+ type: control
5
+ description: 显式解析并校验文本 JSON,成功后输出 json 类型;解析失败会终止本次运行。
6
+ displayName: Parse JSON
7
+ input:
8
+ - type: node
9
+ name: prev
10
+ default: ""
11
+ - type: text
12
+ name: value
13
+ default: ""
14
+ required: true
15
+ showOnNode: true
16
+ output:
17
+ - type: node
18
+ name: next
19
+ default: ""
20
+ - type: json
21
+ name: result
22
+ default: "null"
23
+ showOnNode: true
24
+ ---
25
+ Parse a text value as JSON and expose the validated result through a typed output.
@@ -0,0 +1,13 @@
1
+ ---
2
+ # 内置节点:开始
3
+ runtime: none
4
+ palette: hidden
5
+ description: Entry point of AgentFlow, all flows should start from this node
6
+ displayName: Start
7
+ input: []
8
+ output:
9
+ - type: node
10
+ name: next
11
+ default: ""
12
+ ---
13
+ ${USER_PROMPT}
@@ -0,0 +1,27 @@
1
+ ---
2
+ # 内置节点:调用子流程
3
+ runtime: native
4
+ type: control
5
+ palette: hidden
6
+ description: |
7
+ 调用 workspace.flow.js 中由 flow.subflow 声明的同 Workspace 子流程。
8
+ 输入和输出槽来自子流程契约;每次调用使用独立调用帧,内部节点仍按标准 AgentFlow DSL 和运行时执行。
9
+ displayName: Call Subflow
10
+ ui:
11
+ card:
12
+ template: details
13
+ icon: account_tree
14
+ tone: purple
15
+ sections:
16
+ - type: subflow
17
+ label: Called subflow
18
+ input:
19
+ - type: node
20
+ name: prev
21
+ default: ""
22
+ output:
23
+ - type: node
24
+ name: next
25
+ default: ""
26
+ ---
27
+ Execute the referenced inline subflow using its declared input and output contract.
@@ -0,0 +1,27 @@
1
+ ---
2
+ # 内置节点:代码转布尔(本地脚本执行,★ 可扩展输入)
3
+ runtime: none
4
+ palette: hidden
5
+ description: "Script-based boolean conversion: executes script to produce true/false prediction. Like tool_nodejs but enforces bool output. Must have script field."
6
+ displayName: Code ToBool
7
+ input:
8
+ - type: node
9
+ name: prev
10
+ default: ""
11
+ - type: text
12
+ name: value
13
+ default: ""
14
+ required: true
15
+ showOnNode: true
16
+ output:
17
+ - type: node
18
+ name: next
19
+ default: ""
20
+ - type: bool
21
+ name: prediction
22
+ default: ""
23
+ required: true
24
+ showOnNode: true
25
+ extensible: true
26
+ ---
27
+ ${USER_PROMPT}
@@ -0,0 +1,24 @@
1
+ ---
2
+ # Built-in node: User Workspace
3
+ runtime: native
4
+ palette: hidden
5
+ description: Output a workspace context pointing to the current user's home directory.
6
+ displayName: User Workspace
7
+ input:
8
+ - type: node
9
+ name: prev
10
+ default: ""
11
+ output:
12
+ - type: node
13
+ name: next
14
+ default: ""
15
+ - type: text
16
+ name: workspaceContext
17
+ default: ""
18
+ required: true
19
+ showOnNode: true
20
+ - type: file
21
+ name: cwd
22
+ default: ""
23
+ ---
24
+ Use the current user's home directory as downstream workspace context.
@@ -0,0 +1,34 @@
1
+ ---
2
+ # 内置节点:等待到指定时间
3
+ runtime: none
4
+ palette: hidden
5
+ description: Persistently wait until an absolute time, then continue when scheduler resumes this run.
6
+ displayName: WaitUntil
7
+ input:
8
+ - type: node
9
+ name: prev
10
+ default: ""
11
+ - type: text
12
+ name: until
13
+ default: ""
14
+ required: true
15
+ showOnNode: true
16
+ - type: text
17
+ name: timezone
18
+ default: "Asia/Shanghai"
19
+ output:
20
+ - type: node
21
+ name: next
22
+ default: ""
23
+ - type: text
24
+ name: waitId
25
+ default: ""
26
+ required: true
27
+ showOnNode: true
28
+ - type: text
29
+ name: wakeAt
30
+ default: ""
31
+ required: true
32
+ showOnNode: true
33
+ ---
34
+ ${USER_PROMPT}
@@ -0,0 +1,124 @@
1
+ ---
2
+ # 内置节点:While 单步推进
3
+ runtime: native
4
+ description: |
5
+ Repeatedly execute either an explicit Condition/Body subflow pair or one legacy deterministic
6
+ step command (`script` or `scriptRef`) without adding a cycle to the Workspace graph. A Run
7
+ restarted after `wait` resumes from the saved output state.
8
+
9
+ Preferred DSL form:
10
+ `control.while("Advance", { state, maxIterations, timeout }, conditionFlow, bodyFlow)`.
11
+ Condition must accept `state` and `iteration`, and return `decision` plus optional `summary`.
12
+ Only `continue` invokes Body. Body must accept `state`, `iteration`, and `idempotencyKey`, and
13
+ return the next `state` plus optional `summary`. `wait`, `done`, and `fail` skip Body.
14
+
15
+ In legacy script mode, the command runs once per iteration and stdout must be exactly one JSON object:
16
+ `{"decision":"continue|wait|done|fail","state":{},"summary":"..."}`.
17
+ `continue` starts another iteration, `wait` pauses this Run before downstream nodes, `done`
18
+ continues downstream, and `fail` fails the node. A missing `state` keeps the previous state.
19
+
20
+ Each step receives `AGENTFLOW_WHILE_STATE` (JSON), the absolute
21
+ `AGENTFLOW_WHILE_ITERATION`, `AGENTFLOW_WHILE_MAX_ITERATIONS`,
22
+ `AGENTFLOW_WHILE_TIMEOUT_MS`, and a stable per-iteration
23
+ `AGENTFLOW_WHILE_IDEMPOTENCY_KEY`. Pass the idempotency key to external write APIs when they
24
+ support one. Write progress logs to stderr because stdout is reserved for the decision object.
25
+ The command also supports the same runtime placeholders as `tool.nodejs`, including
26
+ `${flowDir}` and `${workspaceRoot}`.
27
+
28
+ A waiting checkpoint retains state, history, elapsed active time, and the next absolute
29
+ iteration. `maxIterations` and `timeout` are cumulative across resumes. A changed input resets
30
+ the checkpoint; a matching but malformed checkpoint fails closed. Step output is schema-strict
31
+ and bounded: unknown fields are rejected, state/stdout are limited to 1 MiB, stderr to 256 KiB,
32
+ and summary to 4000 characters.
33
+ displayName: While
34
+ ui:
35
+ card:
36
+ template: state-machine
37
+ icon: repeat
38
+ tone: purple
39
+ sections:
40
+ - type: binding
41
+ label: State input
42
+ input: state
43
+ - type: loop
44
+ label: Loop execution
45
+ field: script
46
+ - type: decision
47
+ label: Decision status
48
+ output: decision
49
+ source: step.stdout.decision
50
+ options:
51
+ - value: continue
52
+ label: continue
53
+ tone: purple
54
+ description: 保存 state 并立即进入下一轮
55
+ - value: wait
56
+ label: wait
57
+ tone: amber
58
+ description: 保存 checkpoint,暂停当前 Run
59
+ - value: done
60
+ label: done
61
+ tone: green
62
+ description: 结束循环并继续下游
63
+ - value: fail
64
+ label: fail
65
+ tone: red
66
+ description: 终止并标记节点失败
67
+ - type: metrics
68
+ label: Limits and progress
69
+ items:
70
+ - label: Iteration
71
+ output: iterations
72
+ maxInput: maxIterations
73
+ - label: Timeout
74
+ input: timeout
75
+ - type: summary
76
+ label: Latest outcome
77
+ output: summary
78
+ - type: history
79
+ label: Iteration history
80
+ output: history
81
+ limit: 3
82
+ input:
83
+ - type: node
84
+ name: prev
85
+ default: ""
86
+ - type: json
87
+ name: state
88
+ default: "null"
89
+ - type: text
90
+ name: maxIterations
91
+ default: "20"
92
+ - type: text
93
+ name: timeout
94
+ default: "30m"
95
+ output:
96
+ - type: node
97
+ name: next
98
+ default: ""
99
+ - type: json
100
+ name: result
101
+ default: ""
102
+ - type: json
103
+ name: state
104
+ default: "null"
105
+ - type: text
106
+ name: decision
107
+ default: ""
108
+ showOnNode: true
109
+ - type: text
110
+ name: iterations
111
+ default: "0"
112
+ showOnNode: true
113
+ - type: text
114
+ name: summary
115
+ default: ""
116
+ showOnNode: true
117
+ - type: json
118
+ name: history
119
+ default: "[]"
120
+ - type: text
121
+ name: checkpointFingerprint
122
+ default: ""
123
+ ---
124
+ ${USER_PROMPT}
@@ -0,0 +1,24 @@
1
+ ---
2
+ # 内置节点:ASCII 图展示
3
+ runtime: native
4
+ description: Display ASCII diagram content in workspace canvas; passes diagram text downstream as text
5
+ displayName: ASCII Display
6
+ input:
7
+ - type: node
8
+ name: prev
9
+ default: ""
10
+ - type: text
11
+ name: content
12
+ default: ""
13
+ required: true
14
+ showOnNode: true
15
+ output:
16
+ - type: text
17
+ name: content
18
+ default: ""
19
+ showOnNode: true
20
+ - type: node
21
+ name: next
22
+ default: ""
23
+ ---
24
+ ${content}
@@ -0,0 +1,32 @@
1
+ ---
2
+ # Built-in node: Chart Display
3
+ runtime: native
4
+ description: Display a JSON ChartSpec with ECharts in workspace canvas; passes the JSON downstream as text
5
+ displayName: Chart Display
6
+ input:
7
+ - type: node
8
+ name: prev
9
+ default: ""
10
+ - type: text
11
+ name: content
12
+ default: ""
13
+ required: true
14
+ showOnNode: true
15
+ - type: file
16
+ name: filePath
17
+ default: ""
18
+ showOnNode: false
19
+ - type: text
20
+ name: workspaceContext
21
+ default: ""
22
+ showOnNode: false
23
+ output:
24
+ - type: text
25
+ name: content
26
+ default: ""
27
+ showOnNode: true
28
+ - type: node
29
+ name: next
30
+ default: ""
31
+ ---
32
+ ${content}