@fieldwangai/agentflow 0.1.149 → 0.1.154

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 (195) hide show
  1. package/README.md +20 -33
  2. package/README.zh-CN.md +14 -34
  3. package/agents/agentflow-node-executor-code.md +13 -3
  4. package/agents/agentflow-node-executor-planning.md +13 -3
  5. package/agents/agentflow-node-executor-requirement.md +13 -3
  6. package/agents/agentflow-node-executor-test.md +13 -3
  7. package/agents/agentflow-node-executor-ui.md +13 -3
  8. package/agents/agentflow-node-executor.md +13 -3
  9. package/agents/en/agentflow-node-executor.md +13 -3
  10. package/agents/zh/agentflow-node-executor.md +13 -3
  11. package/bin/agentflow.mjs +3 -3
  12. package/bin/lib/admin-builtin-pipelines.mjs +3 -2
  13. package/bin/lib/agent-runners.mjs +0 -929
  14. package/bin/lib/auth.mjs +2 -1
  15. package/bin/lib/catalog-agents.mjs +2 -1
  16. package/bin/lib/catalog-flows.mjs +167 -88
  17. package/bin/lib/composer-agent.mjs +3 -793
  18. package/bin/lib/composer-skill-router.mjs +3 -323
  19. package/bin/lib/exec-buffered.mjs +32 -0
  20. package/bin/lib/flow-dsl/cli.mjs +276 -0
  21. package/bin/lib/flow-dsl/codegen.mjs +358 -0
  22. package/bin/lib/flow-dsl/defs.mjs +103 -0
  23. package/bin/lib/flow-dsl/index.mjs +77 -0
  24. package/bin/lib/flow-dsl/ir.mjs +305 -0
  25. package/bin/lib/flow-dsl/layout.mjs +115 -0
  26. package/bin/lib/flow-dsl/legacy-yaml.mjs +268 -0
  27. package/bin/lib/flow-dsl/lint.mjs +241 -0
  28. package/bin/lib/flow-dsl/packages.mjs +251 -0
  29. package/bin/lib/flow-dsl/parser.mjs +444 -0
  30. package/bin/lib/flow-import.mjs +96 -26
  31. package/bin/lib/flow-write.mjs +48 -12
  32. package/bin/lib/help.mjs +10 -30
  33. package/bin/lib/html-escape.mjs +19 -0
  34. package/bin/lib/http-util.mjs +49 -0
  35. package/bin/lib/legacy-flow-execution.mjs +43 -0
  36. package/bin/lib/locales/en.json +1 -1
  37. package/bin/lib/locales/zh.json +1 -1
  38. package/bin/lib/main.mjs +153 -283
  39. package/bin/lib/marketplace.mjs +206 -61
  40. package/bin/lib/model-config.mjs +10 -0
  41. package/bin/lib/node-package-archive.mjs +240 -0
  42. package/bin/lib/node-package-bootstrap.mjs +72 -0
  43. package/bin/lib/node-package-manifest.mjs +174 -0
  44. package/bin/lib/paths.mjs +42 -19
  45. package/bin/lib/prd-workflow-routes.mjs +2949 -0
  46. package/bin/lib/prd-workflow-server.mjs +4884 -0
  47. package/bin/lib/run-events.mjs +0 -66
  48. package/bin/lib/schedule-config.mjs +4 -4
  49. package/bin/lib/skill-runtime.mjs +35 -0
  50. package/bin/lib/startup-storage-migrations.mjs +274 -0
  51. package/bin/lib/ui-server.mjs +1106 -18013
  52. package/bin/lib/user-env.mjs +16 -0
  53. package/bin/lib/workspace-auto-layout.mjs +234 -0
  54. package/bin/lib/workspace-flow-store.mjs +478 -0
  55. package/bin/lib/workspace-graph-merge.mjs +41 -34
  56. package/bin/lib/workspace-preview.mjs +74 -0
  57. package/bin/lib/workspace-routes.mjs +3088 -0
  58. package/bin/lib/workspace-server.mjs +6199 -0
  59. package/bin/lib/workspace-state.mjs +331 -0
  60. package/bin/lib/workspace.mjs +2 -1
  61. package/builtin/nodes/agent_subAgent.md +1 -0
  62. package/builtin/nodes/control_agent_toBool.md +2 -0
  63. package/builtin/nodes/control_anyOne.md +2 -0
  64. package/builtin/nodes/control_cancelled.md +2 -0
  65. package/builtin/nodes/control_cd_workspace.md +5 -11
  66. package/builtin/nodes/control_delay.md +2 -0
  67. package/builtin/nodes/control_end.md +2 -0
  68. package/builtin/nodes/control_if.md +1 -0
  69. package/builtin/nodes/control_interval_loop.md +2 -0
  70. package/builtin/nodes/control_load_mcp.md +24 -0
  71. package/builtin/nodes/control_load_skills.md +8 -23
  72. package/builtin/nodes/control_start.md +2 -0
  73. package/builtin/nodes/control_toBool.md +2 -0
  74. package/builtin/nodes/control_user_workspace.md +2 -0
  75. package/builtin/nodes/control_wait_until.md +2 -0
  76. package/builtin/nodes/display_ascii.md +1 -0
  77. package/builtin/nodes/display_chart.md +1 -0
  78. package/builtin/nodes/display_html.md +1 -0
  79. package/builtin/nodes/display_image.md +1 -0
  80. package/builtin/nodes/display_markdown.md +1 -0
  81. package/builtin/nodes/display_mermaid.md +1 -0
  82. package/builtin/nodes/display_react_app.md +1 -0
  83. package/builtin/nodes/display_table.md +1 -0
  84. package/builtin/nodes/provide_bool.md +1 -0
  85. package/builtin/nodes/provide_file.md +1 -0
  86. package/builtin/nodes/provide_password.md +1 -0
  87. package/builtin/nodes/provide_str.md +1 -0
  88. package/builtin/nodes/tool_display_share_link.md +1 -0
  89. package/builtin/nodes/tool_get_env.md +2 -0
  90. package/builtin/nodes/tool_git_checkout.md +1 -0
  91. package/builtin/nodes/tool_git_worktree_load.md +1 -0
  92. package/builtin/nodes/tool_git_worktree_unload.md +1 -0
  93. package/builtin/nodes/tool_gitlab_create_mr.md +1 -0
  94. package/builtin/nodes/tool_jenkins_build.md +2 -0
  95. package/builtin/nodes/tool_load_key.md +2 -0
  96. package/builtin/nodes/tool_nodejs.md +17 -19
  97. package/builtin/nodes/tool_print.md +2 -0
  98. package/builtin/nodes/tool_save_key.md +2 -0
  99. package/builtin/nodes/tool_set_run_env.md +1 -0
  100. package/builtin/nodes/tool_user_ask.md +2 -0
  101. package/builtin/nodes/tool_user_check.md +2 -0
  102. package/builtin/nodes/tool_wecom_send_app_markdown.md +1 -0
  103. package/builtin/nodes/tool_wecom_send_group_markdown.md +1 -0
  104. package/builtin/nodes/workspace_one_click_task.md +44 -0
  105. package/builtin/nodes/workspace_run.md +16 -0
  106. package/builtin/nodes/workspace_scheduled_run.md +16 -0
  107. package/builtin/pipelines/module-migrate/scripts/gate.mjs +37 -0
  108. package/builtin/pipelines/module-migrate/scripts/static-check.mjs +82 -0
  109. package/builtin/pipelines/module-migrate/workspace.flow.js +172 -0
  110. package/builtin/pipelines/module-migrate/workspace.layout.json +134 -0
  111. package/builtin/pipelines/new/scripts/lint-flow.mjs +38 -0
  112. package/builtin/pipelines/new/workspace.flow.js +91 -0
  113. package/builtin/pipelines/new/workspace.layout.json +70 -0
  114. package/builtin/web-ui/dist/assets/{WorkflowAssistantThread-DPbR2UaN.js → WorkflowAssistantThread-CKClwj96.js} +1 -1
  115. package/builtin/web-ui/dist/assets/index-BZ5KqLur.js +870 -0
  116. package/builtin/web-ui/dist/assets/index-CEXmmwM2.css +1 -0
  117. package/builtin/web-ui/dist/index.html +2 -2
  118. package/package.json +2 -1
  119. package/reference/flow-control-capabilities.md +77 -158
  120. package/reference/flow-layout.md +1 -1
  121. package/reference/flow-prompt-handler-check.md +2 -2
  122. package/skills/agentflow-author-flow/SKILL.md +8 -47
  123. package/skills/agentflow-cli/SKILL.md +158 -25
  124. package/skills/agentflow-cli/agents/openai.yaml +2 -2
  125. package/skills/agentflow-cli/scripts/agentflow-cli.mjs +668 -18
  126. package/skills/agentflow-cli/scripts/agentflow-runtime.mjs +97 -0
  127. package/skills/agentflow-flow-add-instances/SKILL.md +7 -248
  128. package/skills/agentflow-flow-dsl/SKILL.md +206 -0
  129. package/skills/agentflow-flow-dsl/agents/openai.yaml +4 -0
  130. package/skills/agentflow-flow-dsl/references/node-calls.md +39 -0
  131. package/skills/agentflow-flow-edit-node-fields/SKILL.md +4 -73
  132. package/skills/agentflow-flow-recipes/SKILL.md +7 -18
  133. package/skills/agentflow-flow-recipes/references/recipes.md +97 -43
  134. package/skills/agentflow-flow-sync-ui/SKILL.md +3 -54
  135. package/skills/agentflow-node-dsl/SKILL.md +212 -0
  136. package/skills/agentflow-node-dsl/agents/openai.yaml +4 -0
  137. package/skills/agentflow-node-reference/SKILL.md +5 -4
  138. package/skills/agentflow-node-reference/references/builtin-nodes.md +166 -115
  139. package/skills/agentflow-placeholder-reference/SKILL.md +2 -2
  140. package/skills/agentflow-runtime-reference/SKILL.md +2 -2
  141. package/skills/agentflow-runtime-reference/references/runtime.md +1 -1
  142. package/skills/agentflow-workspace-ascii/SKILL.md +9 -16
  143. package/skills/agentflow-workspace-graph/SKILL.md +62 -48
  144. package/skills/agentflow-workspace-html/SKILL.md +7 -2
  145. package/skills/agentflow-workspace-image/SKILL.md +6 -2
  146. package/skills/agentflow-workspace-markdown/SKILL.md +14 -21
  147. package/skills/agentflow-workspace-mermaid/SKILL.md +8 -16
  148. package/bin/lib/api-runner.mjs +0 -387
  149. package/bin/lib/apply.mjs +0 -903
  150. package/bin/lib/composer-flow-instances.mjs +0 -68
  151. package/bin/lib/composer-flow-skeleton.mjs +0 -334
  152. package/bin/lib/composer-flow-validate.mjs +0 -47
  153. package/bin/lib/composer-model-router.mjs +0 -185
  154. package/bin/lib/composer-node-schema.mjs +0 -303
  155. package/bin/lib/composer-planner.mjs +0 -751
  156. package/bin/lib/composer-script-ops.mjs +0 -233
  157. package/bin/lib/flow-static-preview.mjs +0 -104
  158. package/bin/lib/hub-login.mjs +0 -54
  159. package/bin/lib/hub-publish.mjs +0 -159
  160. package/bin/lib/hub-remote.mjs +0 -189
  161. package/bin/lib/hub.mjs +0 -299
  162. package/bin/lib/jenkins.mjs +0 -380
  163. package/bin/lib/node-execute.mjs +0 -539
  164. package/bin/lib/normalize-node-tool-command.mjs +0 -97
  165. package/bin/lib/runtime-context.mjs +0 -243
  166. package/bin/lib/scheduler.mjs +0 -601
  167. package/bin/lib/ui-print.mjs +0 -94
  168. package/bin/pipeline/build-node-prompt.mjs +0 -271
  169. package/bin/pipeline/check-cache.mjs +0 -191
  170. package/bin/pipeline/check-flow.mjs +0 -543
  171. package/bin/pipeline/collect-nodes.mjs +0 -212
  172. package/bin/pipeline/compute-cache-md5.mjs +0 -177
  173. package/bin/pipeline/ensure-run-dir.mjs +0 -71
  174. package/bin/pipeline/gc.mjs +0 -129
  175. package/bin/pipeline/get-env.mjs +0 -59
  176. package/bin/pipeline/get-resolved-values.mjs +0 -344
  177. package/bin/pipeline/load-key.mjs +0 -62
  178. package/bin/pipeline/parse-flow.mjs +0 -708
  179. package/bin/pipeline/post-process-control-if.mjs +0 -23
  180. package/bin/pipeline/post-process-node.mjs +0 -490
  181. package/bin/pipeline/pre-process-node.mjs +0 -1430
  182. package/bin/pipeline/resolve-inputs.mjs +0 -201
  183. package/bin/pipeline/run-tool-nodejs.mjs +0 -167
  184. package/bin/pipeline/save-key.mjs +0 -93
  185. package/bin/pipeline/snapshot-prior-round.mjs +0 -70
  186. package/bin/pipeline/validate-for-ui.mjs +0 -234
  187. package/bin/pipeline/validate-script-output.mjs +0 -130
  188. package/bin/pipeline/write-result.mjs +0 -182
  189. package/builtin/pipelines/module-migrate/flow.yaml +0 -819
  190. package/builtin/pipelines/new/flow.yaml +0 -545
  191. package/builtin/pipelines/new/scripts/check-flow.mjs +0 -9
  192. package/builtin/pipelines/new/scripts/collect-nodes.mjs +0 -211
  193. package/builtin/web-ui/dist/assets/index-BSCpd5la.js +0 -889
  194. package/builtin/web-ui/dist/assets/index-DZ328oSo.css +0 -1
  195. package/skills/agentflow-node-authoring/SKILL.md +0 -57
package/README.md CHANGED
@@ -65,30 +65,17 @@ npm install -g @fieldwangai/agentflow
65
65
  # Launch Web UI (port 8765)
66
66
  agentflow ui
67
67
 
68
- # Generate and open a single-file static preview using the platform canvas (no local server)
69
- agentflow flow preview ./my-flow/flow.yaml
68
+ # Upload a Workspace graph to a server-side temporary preview project
69
+ node skills/agentflow-cli/scripts/agentflow-cli.mjs workspace-preview \
70
+ --file .workspace/agentflow/pipelines/my-flow/workspace.graph.json \
71
+ --ttl-seconds 7200
70
72
 
71
- # Or run a flow directly
72
- agentflow apply <FlowName>
73
73
  ```
74
74
 
75
- From source: `git clone` `npm install` `npm link`.
76
-
77
- ## AgentFlow Hub
75
+ Runs are started from the Workspace graph in the Web UI, or on a schedule via a
76
+ `workspace_scheduled_run` node.
78
77
 
79
- Browse, download and share community-built workflows at **[agentflow-hub.com](https://agentflow-hub.com)**.
80
-
81
- ```bash
82
- # Browse flows from the command line
83
- agentflow list-remote
84
-
85
- # Download a flow
86
- agentflow download <slug>
87
-
88
- # Publish your flow to the Hub
89
- agentflow login
90
- agentflow publish <FlowName> --tags "migration,review"
91
- ```
78
+ From source: `git clone` `npm install` → `npm link`.
92
79
 
93
80
  ## Creating Flows
94
81
 
@@ -108,25 +95,26 @@ Create a code review flow:
108
95
  4. Loop until all pass
109
96
  ```
110
97
 
111
- Composer auto-detects loop patterns and generates the correct control-flow nodes. Complex flows are built in three phases: topology → node details → wiring & validation (auto-repairs up to 5 times).
112
-
113
- ## Running & Recovery
98
+ Complex flows are built in three phases: topology → node details → wiring & validation (auto-repairs up to 5 times). Note the Workspace runtime executes a DAG — cyclic graphs are rejected, so describe check-then-fix work as forward steps rather than a loop.
114
99
 
115
- ```bash
116
- # Execute
117
- agentflow apply <FlowName>
100
+ ## Running
118
101
 
119
- # Check status
120
- agentflow run-status <FlowName> <uuid>
102
+ Runs start from the Workspace graph: open the flow in the Web UI and hit **Run**, or add a
103
+ `workspace_scheduled_run` node for cron-driven runs. Every node's inputs, outputs and state
104
+ are persisted under the flow's run directory.
121
105
 
122
- # Resume from failure
123
- agentflow resume <FlowName> <uuid>
106
+ The legacy Start/End Pipeline runtime is retired — `agentflow apply` / `resume` / `replay`
107
+ and the `/api/flow/run*` endpoints no longer execute anything.
124
108
 
125
- # Retry one node
126
- agentflow replay <FlowName> <uuid> <instanceId>
109
+ ```bash
110
+ # Check node status of a run
111
+ agentflow run-status <FlowName> <uuid>
127
112
 
128
113
  # View agent reasoning
129
114
  agentflow extract-thinking <FlowName> <uuid>
115
+
116
+ # Validate a flow definition
117
+ agentflow validate <FlowName>
130
118
  ```
131
119
 
132
120
  ## Skills
@@ -158,7 +146,6 @@ For example, tell Codex/Cursor: “Use `agentflow-author-flow` to generate a Flo
158
146
  |---------|-------------|
159
147
  | `list` | List all pipelines |
160
148
  | `ui` | Start Web UI |
161
- | `flow preview <FlowName\|flow.yaml>` | Generate a single-file static Flow preview; use `--output` to choose the HTML path |
162
149
  | `apply` | Execute flow |
163
150
  | `validate` | Validate flow structure |
164
151
  | `resume` | Resume from breakpoint |
package/README.zh-CN.md CHANGED
@@ -64,30 +64,11 @@ npm install -g @fieldwangai/agentflow
64
64
  # 启动 Web UI(端口 8765)
65
65
  agentflow ui
66
66
 
67
- # 生成并打开平台同款画布的单文件静态预览(无需本地服务)
68
- agentflow flow preview ./my-flow/flow.yaml
69
-
70
- # 或直接运行流程
71
- agentflow apply <FlowName>
72
67
  ```
73
68
 
74
- 从源码开发:`git clone` `npm install` `npm link`
75
-
76
- ## AgentFlow Hub
77
-
78
- 在 **[agentflow-hub.com](https://agentflow-hub.com)** 浏览、下载和分享社区工作流。
69
+ 运行从 Web UI Workspace 图发起;需要定时执行时在图里加 `workspace_scheduled_run` 节点。
79
70
 
80
- ```bash
81
- # 浏览社区工作流
82
- agentflow list-remote
83
-
84
- # 下载工作流
85
- agentflow download <slug>
86
-
87
- # 发布你的工作流
88
- agentflow login
89
- agentflow publish <FlowName> --tags "migration,review"
90
- ```
71
+ 从源码开发:`git clone` → `npm install` → `npm link`
91
72
 
92
73
  ## 创建流程
93
74
 
@@ -107,25 +88,25 @@ Web UI 中 — 新建流水线 → 从面板拖节点到画布 → 连线 →
107
88
  4. 没通过就继续修,直到全过
108
89
  ```
109
90
 
110
- Composer 会自动识别循环模式,生成正确的控制流节点。复杂流程分三阶段构建:拓扑 → 节点详情 → 连线校验(自动修复最多 5 次)。
111
-
112
- ## 运行与恢复
91
+ 复杂流程分三阶段构建:拓扑 → 节点详情 → 连线校验(自动修复最多 5 次)。注意 Workspace 运行时执行的是 DAG,有环的图会被拒绝,所以「检查—修复—复检」要描述成向前推进的步骤,而不是回环。
113
92
 
114
- ```bash
115
- # 执行
116
- agentflow apply <FlowName>
93
+ ## 运行
117
94
 
118
- # 查看状态
119
- agentflow run-status <FlowName> <uuid>
95
+ 运行从 Workspace 图发起:在 Web UI 打开流程点 **Run**,或在图里加 `workspace_scheduled_run`
96
+ 节点做定时执行。每个节点的输入、输出与状态都会持久化到该流程的 run 目录。
120
97
 
121
- # 断点续跑
122
- agentflow resume <FlowName> <uuid>
98
+ 旧版 Start/End Pipeline 运行时已下线 —— `agentflow apply` / `resume` / `replay` 与
99
+ `/api/flow/run*` 接口不再执行任何流程。
123
100
 
124
- # 重试单个节点
125
- agentflow replay <FlowName> <uuid> <instanceId>
101
+ ```bash
102
+ # 查看某次运行的节点状态
103
+ agentflow run-status <FlowName> <uuid>
126
104
 
127
105
  # 查看 agent 推理过程
128
106
  agentflow extract-thinking <FlowName> <uuid>
107
+
108
+ # 校验流程定义
109
+ agentflow validate <FlowName>
129
110
  ```
130
111
 
131
112
  ## 技能
@@ -157,7 +138,6 @@ AgentFlow 提供专用技能用于常见操作:
157
138
  |------|------|
158
139
  | `list` | 列出所有流水线 |
159
140
  | `ui` | 启动 Web UI |
160
- | `flow preview <FlowName\|flow.yaml>` | 生成平台同款画布的单文件静态 Flow 预览;可用 `--output` 指定 HTML |
161
141
  | `apply` | 执行流程 |
162
142
  | `validate` | 校验流程结构 |
163
143
  | `resume` | 断点续跑 |
@@ -27,7 +27,17 @@ ${taskBody}
27
27
 
28
28
  ---
29
29
 
30
- 以代码实现为核心:理清需求与接口,编写或修改代码,确保可运行、通过类型检查与项目规范,节点中如有写入文件的操作可以执行。任务完成后直接退出,结果由系统自动标记成功。**仅当任务明确失败时**,执行以下命令报告失败(`agentflow` 是可直接在终端运行的 CLI 命令):
31
- ```bash
32
- agentflow apply -ai write-result ${pipelineWorkspace} ${flowName} ${uuid} ${instanceId} --json '{"status":"failed","message":"失败原因"}'
30
+ 以代码实现为核心:理清需求与接口,编写或修改代码,确保可运行、通过类型检查与项目规范,节点中如有写入文件的操作可以执行。
31
+
32
+ **结果回传**:最终回复的正文就是本节点的结果,AgentFlow 会自行写入 `AGENTFLOW_RESULT_FILE`——不要自己创建该文件,也不要输出文件路径。若节点声明了额外的 output 槽,则最终**只**输出一个 agentflow envelope:
33
+
33
34
  ```
35
+ ---agentflow
36
+ result: |
37
+ <完整结果正文,每行缩进两个空格>
38
+ outParams:
39
+ <槽位名>: <短值>
40
+ ---end
41
+ ```
42
+
43
+ **失败上报**:任务明确失败时,直接以非零退出码结束,或在回复中说明失败原因——不要调用任何 CLI 写状态。
@@ -27,7 +27,17 @@ ${taskBody}
27
27
 
28
28
  ---
29
29
 
30
- 先做规划(目标拆解、步骤与依赖、可选方案),再按规划执行并产出结果,节点中如有写入文件的操作可以执行。任务完成后直接退出,结果由系统自动标记成功。**仅当任务明确失败时**,执行以下命令报告失败(`agentflow` 是可直接在终端运行的 CLI 命令):
31
- ```bash
32
- agentflow apply -ai write-result ${pipelineWorkspace} ${flowName} ${uuid} ${instanceId} --json '{"status":"failed","message":"失败原因"}'
30
+ 先做规划(目标拆解、步骤与依赖、可选方案),再按规划执行并产出结果,节点中如有写入文件的操作可以执行。
31
+
32
+ **结果回传**:最终回复的正文就是本节点的结果,AgentFlow 会自行写入 `AGENTFLOW_RESULT_FILE`——不要自己创建该文件,也不要输出文件路径。若节点声明了额外的 output 槽,则最终**只**输出一个 agentflow envelope:
33
+
33
34
  ```
35
+ ---agentflow
36
+ result: |
37
+ <完整结果正文,每行缩进两个空格>
38
+ outParams:
39
+ <槽位名>: <短值>
40
+ ---end
41
+ ```
42
+
43
+ **失败上报**:任务明确失败时,直接以非零退出码结束,或在回复中说明失败原因——不要调用任何 CLI 写状态。
@@ -27,7 +27,17 @@ ${taskBody}
27
27
 
28
28
  ---
29
29
 
30
- 侧重需求理解与拆解,按上述任务完成执行,节点中如有写入文件的操作可以执行。任务完成后直接退出,结果由系统自动标记成功。**仅当任务明确失败时**,执行以下命令报告失败(`agentflow` 是可直接在终端运行的 CLI 命令):
31
- ```bash
32
- agentflow apply -ai write-result ${pipelineWorkspace} ${flowName} ${uuid} ${instanceId} --json '{"status":"failed","message":"失败原因"}'
30
+ 侧重需求理解与拆解,按上述任务完成执行,节点中如有写入文件的操作可以执行。
31
+
32
+ **结果回传**:最终回复的正文就是本节点的结果,AgentFlow 会自行写入 `AGENTFLOW_RESULT_FILE`——不要自己创建该文件,也不要输出文件路径。若节点声明了额外的 output 槽,则最终**只**输出一个 agentflow envelope:
33
+
33
34
  ```
35
+ ---agentflow
36
+ result: |
37
+ <完整结果正文,每行缩进两个空格>
38
+ outParams:
39
+ <槽位名>: <短值>
40
+ ---end
41
+ ```
42
+
43
+ **失败上报**:任务明确失败时,直接以非零退出码结束,或在回复中说明失败原因——不要调用任何 CLI 写状态。
@@ -27,7 +27,17 @@ ${taskBody}
27
27
 
28
28
  ---
29
29
 
30
- 侧重测试与验证,执行并产出结果,节点中如有写入文件的操作可以执行。任务完成后直接退出,结果由系统自动标记成功。**仅当任务明确失败时**,执行以下命令报告失败(`agentflow` 是可直接在终端运行的 CLI 命令):
31
- ```bash
32
- agentflow apply -ai write-result ${pipelineWorkspace} ${flowName} ${uuid} ${instanceId} --json '{"status":"failed","message":"失败原因"}'
30
+ 侧重测试与验证,执行并产出结果,节点中如有写入文件的操作可以执行。
31
+
32
+ **结果回传**:最终回复的正文就是本节点的结果,AgentFlow 会自行写入 `AGENTFLOW_RESULT_FILE`——不要自己创建该文件,也不要输出文件路径。若节点声明了额外的 output 槽,则最终**只**输出一个 agentflow envelope:
33
+
33
34
  ```
35
+ ---agentflow
36
+ result: |
37
+ <完整结果正文,每行缩进两个空格>
38
+ outParams:
39
+ <槽位名>: <短值>
40
+ ---end
41
+ ```
42
+
43
+ **失败上报**:任务明确失败时,直接以非零退出码结束,或在回复中说明失败原因——不要调用任何 CLI 写状态。
@@ -27,7 +27,17 @@ ${taskBody}
27
27
 
28
28
  ---
29
29
 
30
- 理解设计稿或规格(Figma、标注、描述),实现或调整组件与样式,保证布局、间距、层级、断点与 RTL 等与设计一致;必要时做走查与修正,节点中如有写入文件的操作可以执行。任务完成后直接退出,结果由系统自动标记成功。**仅当任务明确失败时**,执行以下命令报告失败(`agentflow` 是可直接在终端运行的 CLI 命令):
31
- ```bash
32
- agentflow apply -ai write-result ${pipelineWorkspace} ${flowName} ${uuid} ${instanceId} --json '{"status":"failed","message":"失败原因"}'
30
+ 理解设计稿或规格(Figma、标注、描述),实现或调整组件与样式,保证布局、间距、层级、断点与 RTL 等与设计一致;必要时做走查与修正,节点中如有写入文件的操作可以执行。
31
+
32
+ **结果回传**:最终回复的正文就是本节点的结果,AgentFlow 会自行写入 `AGENTFLOW_RESULT_FILE`——不要自己创建该文件,也不要输出文件路径。若节点声明了额外的 output 槽,则最终**只**输出一个 agentflow envelope:
33
+
33
34
  ```
35
+ ---agentflow
36
+ result: |
37
+ <完整结果正文,每行缩进两个空格>
38
+ outParams:
39
+ <槽位名>: <短值>
40
+ ---end
41
+ ```
42
+
43
+ **失败上报**:任务明确失败时,直接以非零退出码结束,或在回复中说明失败原因——不要调用任何 CLI 写状态。
@@ -27,7 +27,17 @@ ${taskBody}
27
27
 
28
28
  ---
29
29
 
30
- 按上述任务完成执行,节点中如有写入文件的操作可以执行。任务完成后直接退出,结果由系统自动标记成功。**仅当任务明确失败时**,执行以下命令报告失败(`agentflow` 是可直接在终端运行的 CLI 命令):
31
- ```bash
32
- agentflow apply -ai write-result ${pipelineWorkspace} ${flowName} ${uuid} ${instanceId} --json '{"status":"failed","message":"失败原因"}'
30
+ 按上述任务完成执行,节点中如有写入文件的操作可以执行。
31
+
32
+ **结果回传**:最终回复的正文就是本节点的结果,AgentFlow 会自行写入 `AGENTFLOW_RESULT_FILE`——不要自己创建该文件,也不要输出文件路径。若节点声明了额外的 output 槽,则最终**只**输出一个 agentflow envelope:
33
+
33
34
  ```
35
+ ---agentflow
36
+ result: |
37
+ <完整结果正文,每行缩进两个空格>
38
+ outParams:
39
+ <槽位名>: <短值>
40
+ ---end
41
+ ```
42
+
43
+ **失败上报**:任务明确失败时,直接以非零退出码结束,或在回复中说明失败原因——不要调用任何 CLI 写状态。
@@ -27,7 +27,17 @@ ${taskBody}
27
27
 
28
28
  ---
29
29
 
30
- Complete the task as described above. If the node involves file writing operations, they can be executed. Exit when done — the system automatically marks the result as success. **Only if the task explicitly fails**, run the following command to report failure (`agentflow` is a CLI command available directly in the terminal):
31
- ```bash
32
- agentflow apply -ai write-result ${pipelineWorkspace} ${flowName} ${uuid} ${instanceId} --json '{"status":"failed","message":"reason for failure"}'
30
+ Complete the task as described above. If the node involves file writing operations, they can be executed.
31
+
32
+ **Returning the result**: the body of your final reply *is* this node's result. AgentFlow writes it to `AGENTFLOW_RESULT_FILE` for you — do not create that file and do not print a path. If the node declares extra output slots, emit exactly one agentflow envelope and nothing else:
33
+
33
34
  ```
35
+ ---agentflow
36
+ result: |
37
+ <full result body, each line indented two spaces>
38
+ outParams:
39
+ <slotName>: <short value>
40
+ ---end
41
+ ```
42
+
43
+ **Reporting failure**: on a real failure, exit non-zero or state the reason in your reply — do not call any CLI to write status.
@@ -27,7 +27,17 @@ ${taskBody}
27
27
 
28
28
  ---
29
29
 
30
- 按上述任务完成执行,节点中如有写入文件的操作可以执行。任务完成后直接退出,结果由系统自动标记成功。**仅当任务明确失败时**,执行以下命令报告失败(`agentflow` 是可直接在终端运行的 CLI 命令):
31
- ```bash
32
- agentflow apply -ai write-result ${pipelineWorkspace} ${flowName} ${uuid} ${instanceId} --json '{"status":"failed","message":"失败原因"}'
30
+ 按上述任务完成执行,节点中如有写入文件的操作可以执行。
31
+
32
+ **结果回传**:最终回复的正文就是本节点的结果,AgentFlow 会自行写入 `AGENTFLOW_RESULT_FILE`——不要自己创建该文件,也不要输出文件路径。若节点声明了额外的 output 槽,则最终**只**输出一个 agentflow envelope:
33
+
33
34
  ```
35
+ ---agentflow
36
+ result: |
37
+ <完整结果正文,每行缩进两个空格>
38
+ outParams:
39
+ <槽位名>: <短值>
40
+ ---end
41
+ ```
42
+
43
+ **失败上报**:任务明确失败时,直接以非零退出码结束,或在回复中说明失败原因——不要调用任何 CLI 写状态。
package/bin/agentflow.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * AgentFlow CLI: drive apply/replay from command line.
4
- * Commands: agentflow apply <FlowName> [uuid], agentflow replay [flowName] <uuid> <instanceId>
5
- * Cursor agent execution uses --print --output-format stream-json.
3
+ * AgentFlow CLI entry point.
4
+ * Flow execution lives in the Workspace graph (Web UI Run / workspace_scheduled_run);
5
+ * this CLI covers catalog, validation, Hub and the local UI server.
6
6
  */
7
7
 
8
8
  import { createRequire } from "module";
@@ -3,6 +3,7 @@ import path from "path";
3
3
  import {
4
4
  getAgentflowDataRoot,
5
5
  getUserPipelinesRoot,
6
+ isFlowDir,
6
7
  } from "./paths.mjs";
7
8
 
8
9
  const CONFIG_FILENAME = "admin-builtin-pipelines.json";
@@ -57,7 +58,7 @@ export function resolveAdminBuiltinPipelineDir(flowId) {
57
58
  const entry = config.promoted.find((item) => item.id === id);
58
59
  if (!entry) return "";
59
60
  const dir = path.join(getUserPipelinesRoot(entry.ownerUserId), entry.id);
60
- return fs.existsSync(path.join(dir, "flow.yaml")) ? dir : "";
61
+ return isFlowDir(dir) ? dir : "";
61
62
  }
62
63
 
63
64
  export function updateAdminBuiltinPipelineConfig(action, payload = {}, actor = {}) {
@@ -68,7 +69,7 @@ export function updateAdminBuiltinPipelineConfig(action, payload = {}, actor = {
68
69
  const ownerUserId = String(payload.ownerUserId || actor.userId || "").trim();
69
70
  if (!ownerUserId) return { ok: false, error: "Missing ownerUserId" };
70
71
  const dir = path.join(getUserPipelinesRoot(ownerUserId), flowId);
71
- if (!fs.existsSync(path.join(dir, "flow.yaml"))) return { ok: false, error: "Pipeline not found" };
72
+ if (!isFlowDir(dir)) return { ok: false, error: "Pipeline not found" };
72
73
  const promoted = config.promoted.filter((item) => item.id !== flowId);
73
74
  promoted.unshift({
74
75
  id: flowId,