@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
@@ -1,79 +1,10 @@
1
1
  ---
2
2
  name: agentflow-flow-edit-node-fields
3
- description: >-
4
- 仅修改 AgentFlow flow.yaml 中已有实例的允许字段(label、body、role、
5
- input/output 的 value 等);禁止改 definitionId、instanceId、IO 结构与顺序、
6
- 不增删边与实例。用于改文案、占位符、角色标签而不破坏图拓扑与 handle。
3
+ description: Legacy Pipeline field editing is retired. Use the Workspace Graph skill for node field changes.
7
4
  ---
8
5
 
9
- # AgentFlow:仅修改已有节点(白名单字段)
6
+ # Legacy Flow Node Field Editing(已下线)
10
7
 
11
- **不增加/删除节点与边、不改编译拓扑** 的前提下,修改一个或多个 **已有** `instances` 条目时使用本技能。
8
+ skill 原用于修改 `flow.yaml` 的实例字段。当前新建和操作统一发生在 Workspace 图中,节点字段应修改 `workspace.flow.js` 的节点调用(见 **agentflow-workspace-graph**),并通过 Workspace 保存/预览链路同步。
12
9
 
13
- **路径说明**:`npx skills add` 后本文件不在 AgentFlow 仓库内;`reference/` 相对 **AgentFlow 仓库根目录**。
14
-
15
- **权威参考**:`reference/flow-control-capabilities.md`(内置 description 语义)、`reference/flow-prompt-handler-check.md`(改 `body` 后与图一致)。
16
-
17
- ---
18
-
19
- ## 允许修改的字段(白名单)
20
-
21
- 对每个已存在的 **`<instanceId>`** 块,**仅**可改下列内容:
22
-
23
- | 字段 | 说明 |
24
- |------|------|
25
- | **`label`** | 画布显示名 |
26
- | **`role`** | 角色分类字符串 |
27
- | **`body`** | 节点用户区正文(agent 任务描述等);改后核对与边的数据流是否仍一致 |
28
- | **`script`** | **仅限 `definitionId: tool_nodejs`**——实际执行的 shell/node 命令(`body` 有 script 时不执行)。必须写完整可执行命令,禁止写自然语言 |
29
- | **`input[].value`** | 各输入槽的默认值 / 占位路径 / 字面量(**不改** 该项的 `type`、`name`) |
30
- | **`output[].value`** | 各输出槽默认值(**不改** `type`、`name`) |
31
-
32
- ### tool_nodejs 特殊规则(关键)
33
-
34
- `definitionId: tool_nodejs` 的节点**核心是 `script` 字段**,不是 `body`:
35
- - **`script`**:流水线直接执行的命令代码,stdout 作为 result,exit code 决定成败
36
- - **`body`**:有 `script` 时仅作为人类可读的注释说明,**不会被执行**
37
- - **禁止** `tool_nodejs` 只有 `body` 没有 `script`——自然语言描述不会被执行,节点必定失败
38
- - 如果无法写出完整可执行的 `script`,必须把 `definitionId` 改为 `agent_subAgent`(此变更不在本技能范围,需用 `agentflow-flow-add-instances` 技能)
39
-
40
- **`instances.*.description`** 已废弃:不要在 flow.yaml 中写入;agent 系统说明以 **`definitionId` 对应节点定义 `.md`** 的 frontmatter **`description`** 为准。需要补充说明性文字时用 **`body`** 或 **`label`**。
41
-
42
- ---
43
-
44
- ## 禁止修改(黑名单)
45
-
46
- - **`definitionId`**:换类型会错 handle,须走「新增实例 + 删旧实例 + 改边」流程,**不在**本技能范围。
47
- - **`instanceId` 键名**:改名必须同步改 **所有 `edges` 的 source/target** 与 **`ui.nodePositions` 键**,否则图断裂;**不在**本技能范围。
48
- - **`input` / `output` 数组**:不得 **增删条目**、**改顺序**、**改 `name` / `type`**(会导致 `input-0` / `output-1` 与边不对应)。
49
- - **`edges`**:不得增删改(含 `sourceHandle` / `targetHandle`)。
50
- - **新增或删除整个 instance 块**:使用技能 **`agentflow-flow-add-instances`** 或其它流程。
51
- - **`ui.nodePositions`**:本技能默认 **不** 改;仅当用户明确要求「只动坐标」时可单独改对应 instance 的 `x` / `y`,且 **不** 改其它字段。
52
-
53
- ---
54
-
55
- ## 操作建议
56
-
57
- 1. 用搜索定位目标 **`instanceId`**,只改上表白名单字段。
58
- 2. 修改 **`body`** 或 **`value`** 后,若涉及「读哪些文件 / 写哪些结果」,对照 **`reference/flow-prompt-handler-check.md`**,确保仍与当前 **edges** 上的 handler 一致(本技能不改边,但若文案宣称的读写与图不符,应提示用户需另改图)。
59
- 3. 批量改多个节点时,对每个实例重复上述约束,**不要**顺带重构 YAML 结构。
60
-
61
- ---
62
-
63
- ## 保存后同步 Web UI
64
-
65
- 将 `flow.yaml` 写入磁盘后,在 **Web UI + Composer** 场景下应通知浏览器刷新画布,见 `skills/agentflow-flow-sync-ui/SKILL.md`。
66
-
67
- ---
68
-
69
- ## 安装(vercel-labs [skills](https://github.com/vercel-labs/skills))
70
-
71
- 在 AgentFlow 仓库根目录:
72
-
73
- ```bash
74
- npx skills add ./skills --agent cursor --skill agentflow-flow-edit-node-fields -y
75
- # 或安装本包全部技能:
76
- npx skills add ./skills --agent cursor -y
77
- ```
78
-
79
- 项目内默认 **`.agents/skills/`**;全局加 **`-g`**。
10
+ 不要修改 `flow.yaml`、`control_start/control_end` 或调用旧 Pipeline 执行接口来完成新需求。请改用 `agentflow-workspace-graph`。
@@ -1,24 +1,13 @@
1
1
  ---
2
2
  name: agentflow-flow-recipes
3
- description: >-
4
- AgentFlow 常见流程模板。用于新建 Git 项目分析、加载项目 skills、打印结果、
5
- 以及组合 Git Checkout → CD Workspace → Load Skills → Agent → Print 的标准流水线。
3
+ description: Workspace Graph recipes for AgentFlow canvas tasks (git analysis, display, branching).
6
4
  ---
7
5
 
8
- # AgentFlow Flow Recipes
6
+ # Workspace Graph Recipes
9
7
 
10
- 使用本技能处理这些问题:
8
+ 组合 Git Checkout、CD Workspace、Load Skills、Agent、Display 等节点时,先读
9
+ [recipes.md](references/recipes.md),在 `workspace.flow.js` 中以 `flow(...)` 为入口组织节点,
10
+ 再用 `agentflow-workspace-graph` 校验槽位和连线。
11
11
 
12
- - 用户要求“新建流水线拉仓库、cd 进去、让 agent 分析、print 结果”。
13
- - 需要把 Git 项目作为工作区分析,并可加载项目自身 skills。
14
- - 需要避免临场猜 slot/handle,按标准 recipe 搭图。
15
-
16
- ## 必读规则
17
-
18
- - 读 [recipes.md](references/recipes.md)。
19
- - Git 项目分析的标准链路是:`Start → Git Checkout → CD Workspace → Load Skills → Agent → Print → End`。
20
- - `tool_print.content` 应接 agent 输出内容;没有接 content 时才 fallback 打印上游 result。
21
-
22
- ## Reference
23
-
24
- - [Flow recipes](references/recipes.md)
12
+ 旧的 `Start End` 流水线 recipe 已下线;不得生成 `control_start` / `control_end`
13
+ 或其它已退役的节点类型(recipes.md 末尾列出了完整清单)。
@@ -1,63 +1,117 @@
1
- # AgentFlow Flow Recipes
1
+ # AgentFlow Workspace Graph Recipes
2
+
3
+ These recipes are written in `workspace.flow.js` form — the authoritative representation of a
4
+ Workspace graph. Syntax reference: **agentflow-flow-dsl**. The old
5
+ `control_start → … → control_end` pipeline recipes are retired; see the note at the end.
6
+
7
+ Every pin name below comes from `builtin/nodes/*.md`; the full call table is
8
+ [node-calls.md](../../agentflow-flow-dsl/references/node-calls.md). Run
9
+ `agentflow flow dsl lint <flowDir>` after editing — a wrong pin name is an error, not a warning.
2
10
 
3
11
  ## Git Project Analysis
4
12
 
5
- Use when the user asks to clone/pull a repository, enter it, ask an agent what it does, and print the result.
13
+ Clone/pull a repository, enter it, ask an agent what it does, show the result.
14
+
15
+ ```js
16
+ import { agent, control, display, flow, tool } from "agentflow/flow";
17
+
18
+ const checkout = tool.gitCheckout("拉取仓库", {
19
+ repoUrl: "https://example.com/team/repo.git",
20
+ pullIfExists: "true",
21
+ });
22
+
23
+ const cd = control.cdWorkspace("进入仓库", {
24
+ path: ".",
25
+ workspaceContext: checkout.workspaceContext,
26
+ });
6
27
 
7
- Recommended graph:
28
+ const skills = control.loadSkills("加载 Skills", {
29
+ skillKeys: `["global-codex:code-reading"]`,
30
+ });
8
31
 
9
- ```text
10
- control_start
11
- -> tool_git_checkout
12
- -> control_cd_workspace
13
- -> control_load_skills
14
- -> agent_subAgent
15
- -> tool_print
16
- -> control_end
32
+ const analyse = agent.subAgent("解读仓库", {
33
+ workspaceContext: cd.workspaceContext,
34
+ skillsContext: skills.skillsContext,
35
+ }, `读 README、构建文件、源码目录和入口,说明这个仓库是做什么的、怎么跑起来。`);
36
+
37
+ const report = display.markdown("分析结果", { content: analyse.result });
38
+
39
+ export const run = flow("Run", checkout, cd, skills, analyse, report);
17
40
  ```
18
41
 
19
- Minimum required values:
42
+ What the data edges do:
20
43
 
21
- - `tool_git_checkout.repoUrl`: repository URL.
22
- - `tool_git_checkout.pullIfExists`: `true`.
23
- - `tool_git_checkout.includeSubmodules`: `true` only when the user asks to pull submodules.
24
- - `control_cd_workspace.target`: `.`.
25
- - `control_load_skills.source`: `all` or `current-workspace`.
26
- - `agent_subAgent.body`: ask the agent to inspect README, package/build files, source directories, and entry points.
27
- - `tool_print.content`: connect from the agent output content.
44
+ - `checkout.workspaceContext cd.workspaceContext` — hands the checked-out path to CD
45
+ - `cd.workspaceContext → analyse.workspaceContext` — tells the agent which directory it is in
46
+ - `skills.skillsContext → analyse.skillsContext` injects the selected skills
28
47
 
29
- Required context edges:
48
+ Watch out:
30
49
 
31
- - Git Checkout `next` -> CD Workspace `prev`
32
- - Git Checkout `workspaceContext` -> CD Workspace `workspaceContext`
33
- - CD Workspace `next` -> Load Skills `prev`
34
- - CD Workspace `workspaceContext` -> Load Skills `workspaceContext`
35
- - Load Skills `next` -> Agent `prev`
36
- - CD Workspace `workspaceContext` -> Agent `workspaceContext`
37
- - Load Skills `skillsContext` -> Agent `skillsContext`
38
- - Agent content output -> Print `content`
39
- - Print `next` -> End `prev`
50
+ - `control.cdWorkspace` takes `path`, not `target`; `control.loadSkills` takes `skillKeys`
51
+ (a JSON array of `collection:skill`), not `source`
52
+ - `control.loadSkills` has no `workspaceContext` input do not try to chain context through
53
+ it; feed the agent from `cd` directly
54
+ - Do not wire `checkout.repoPath` (a `file`) into `cd.path` (a `text`)
55
+ - Private repositories need working local credentials
40
56
 
41
- Notes:
57
+ ## Show A Result
42
58
 
43
- - Do not connect `repoPath:file` to CD `target:text`.
44
- - If the agent node has no custom file output slot, use its result body and let Print fallback, or add a text/file output slot intentionally.
45
- - For private/internal Git repositories, local credentials must already work.
59
+ Feed the producing pin into a `display.*` node:
60
+
61
+ ```js
62
+ const shown = display.markdown("结论", { content: analyse.result });
63
+ ```
46
64
 
47
- ## Edit Current Flow
65
+ Pick the type that matches the payload: `display.markdown`, `.html`, `.table`, `.chart`,
66
+ `.mermaid`, `.ascii`, `.image`, `.reactApp`.
48
67
 
49
- Use existing flow editing skills:
68
+ An agent with an extra output pin must be declared by destructuring, and its prompt must emit
69
+ the output envelope:
50
70
 
51
- - New nodes/edges: `agentflow-flow-add-instances`
52
- - Existing node text/value edits only: `agentflow-flow-edit-node-fields`
53
- - After saving in UI Composer: `agentflow-flow-sync-ui`
71
+ ```js
72
+ const { storyId } = breakdown;
73
+ const notify = tool.wecomSendAppMarkdown("通知", { markdown: breakdown.result, toUser: storyId });
74
+ ```
54
75
 
55
- ## Print Result
76
+ ## Branching
56
77
 
57
- Prefer explicit content:
78
+ `control.if` is the branch primitive. Its `prediction` input is a `bool`:
58
79
 
59
- ```text
60
- agent.output.summary -> tool_print.input.content
80
+ ```js
81
+ const passed = provide.bool("是否发布", { value: "true" });
82
+ const gate = control.if("是否发布", { prediction: passed.value },
83
+ flow(publish, notifySuccess),
84
+ flow(rollback, notifyFail),
85
+ );
86
+ export const run = flow("Run", passed, gate);
61
87
  ```
62
88
 
63
- Fallback behavior exists, but explicit content keeps the graph self-documenting.
89
+ The taken branch runs and the other is skipped. **Branches cannot rejoin** — fan-in is
90
+ forbidden and `control_anyOne` has no runtime implementation. Let each branch finish on its own.
91
+
92
+ `control.agentToBool` also produces a `prediction`, but it is `runtime: degraded`: nothing
93
+ constrains the model's answer and `parse-bool` accepts only exactly `true` / `1` / `yes` / `on`.
94
+ If you use it, the prompt must say "只回 true 或 false,多一个字都会被判成 false".
95
+
96
+ ## No Loops
97
+
98
+ The run planner rejects cyclic graphs (`Workspace run graph contains a cycle`). Express
99
+ "check → fix → re-check" as forward steps, or put the retry loop **inside** one node — the
100
+ agent's body, a `tool.nodejs` script, or a code node under `nodes/<name>/index.mjs`. Never
101
+ draw an edge from a downstream node back to an upstream one.
102
+
103
+ ## Edit The Graph
104
+
105
+ - Structure, nodes, edges: **agentflow-workspace-graph**
106
+ - Full syntax and the node call table: **agentflow-flow-dsl**
107
+ - Node implementations in code: `nodes/<name>/index.mjs`, see **agentflow-flow-dsl**
108
+
109
+ Saving is handled by the Workspace API; there is no separate canvas-sync step.
110
+
111
+ ## Retired
112
+
113
+ `control_start`, `control_end`, `control_anyOne`, `control_toBool`, `control_interval_loop`,
114
+ `control_delay`, `control_wait_until`, `control_cancelled`, `tool_user_check`, `tool_user_ask`,
115
+ `tool_print`, `tool_load_key`, `tool_save_key`, `tool_get_env` and `tool_jenkins_build` only
116
+ ever ran under the retired Start/End runtime. They are not in the node palette and lint
117
+ rejects them — do not generate them.
@@ -1,59 +1,8 @@
1
1
  ---
2
2
  name: agentflow-flow-sync-ui
3
- description: >-
4
- 在 AgentFlow Web UI + Composer 场景下,将 flow.yaml 保存到磁盘后通知本地 UI 刷新画布;
5
- 使用 POST /api/flow-editor-sync(端口以 Composer 系统提示中的 URL 为准)。
3
+ description: Legacy flow.yaml canvas sync is retired. Workspace Graph saves are synchronized through the Workspace API automatically.
6
4
  ---
7
5
 
8
- # AgentFlow:保存 flow.yaml 后同步 Web 画布
6
+ # Legacy Flow Canvas Sync(已下线)
9
7
 
10
- **已通过 Composer 编辑当前流水线**(系统提示里已注入 `flowId`、`flowSource`、UI 端口)且 **本机正在运行 `agentflow ui`** 时使用。
11
-
12
- ## 何时执行
13
-
14
- 每次对当前流水线的 **`flow.yaml` 做完增删改并已写入磁盘** 后执行 **一次**(含多次保存中的最后一次完成后)。
15
-
16
- ## 做什么
17
-
18
- 向本地 Web UI 发通知,让已打开该流水线的浏览器通过 SSE 重拉 `GET /api/flow`(与手动切换流水线效果一致,但保留 Composer 对话区)。
19
-
20
- 在终端执行(**必须与系统提示中的 `flowId`、`flowSource`、`端口` 一致**;以下占位符在 Composer 上下文中会给出**可复制的一行命令**):
21
-
22
- ```bash
23
- curl -sS -X POST http://127.0.0.1:<PORT>/api/flow-editor-sync \
24
- -H 'Content-Type: application/json' \
25
- -d '{"flowId":"<flowId>","flowSource":"user"}'
26
- ```
27
-
28
- `flowSource` 取值:
29
-
30
- - `user`:用户目录 `~/agentflow/pipelines`(或 `AGENTFLOW_HOME`)下的该流水线
31
- - `workspace`:当前项目下 `.workspace/agentflow/pipelines` 下的该流水线(仍会读取旧路径 `.cursor/agentflow/pipelines`)。同项目内 **nodes** 以 `.workspace/agentflow/nodes` 为主(可读 `.cursor/agentflow/nodes`);**models.json** 以 `.workspace/agentflow/models.json` 为主(可读 `.cursor` 下旧文件)。
32
- - `builtin`:包内 `builtin/pipelines` 模板(只读;若实际写入的是工作区副本,须用 `workspace` 触发刷新)
33
-
34
- ## 等价的 Node one-liner(无 curl 时)
35
-
36
- ```bash
37
- node -e "fetch('http://127.0.0.1:<PORT>/api/flow-editor-sync',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({flowId:'<flowId>',flowSource:'user'})}).then(r=>r.text()).then(console.log)"
38
- ```
39
-
40
- (将 `<PORT>`、`<flowId>`、`flowSource` 换成实际值。)
41
-
42
- ## 注意
43
-
44
- - 仅 **127.0.0.1** 本地 UI;未启动 UI 时请求会失败,可忽略(Composer 正常结束时前端仍会兜底重拉图一次)。
45
- - 本操作**不**写入 YAML,只触发刷新;请勿用其代替保存文件。
46
-
47
- ---
48
-
49
- ## 安装(vercel-labs [skills](https://github.com/vercel-labs/skills))
50
-
51
- 在 AgentFlow 仓库根目录:
52
-
53
- ```bash
54
- npx skills add ./skills --agent cursor --skill agentflow-flow-sync-ui -y
55
- # 或安装本包全部技能:
56
- npx skills add ./skills --agent cursor -y
57
- ```
58
-
59
- 项目内默认 **`.agents/skills/`**;全局加 **`-g`** → **`~/.cursor/skills/`**。
8
+ 旧的 `flow.yaml` + `/api/flow-editor-sync` 刷新链路不再用于新功能。Workspace 图请直接编辑 `workspace.flow.js`(见 **agentflow-workspace-graph**),或使用 Workspace Graph 页面/API 的保存机制;需要所见即所得预览时使用 `agentflow-cli workspace-preview --file <flowDir>`。
@@ -0,0 +1,212 @@
1
+ ---
2
+ name: agentflow-node-dsl
3
+ description: >-
4
+ 使用 AgentFlow Node DSL 编写代码节点包(节点目录中的 index.mjs),在流程里用起来,并发布到
5
+ marketplace 供其它流程复用。用户要求「加一个自定义节点」「把这段逻辑做成可复用节点」
6
+ 「把节点发布出去」时使用。跨端搜索、上传、安装和 Flow 拉取/发布需配合
7
+ agentflow-cli skill。
8
+ ---
9
+
10
+ # AgentFlow Node DSL
11
+
12
+ **一个目录 = 一个节点 = 一个可发布的包。** `index.mjs` 同时是声明和实现。
13
+
14
+ ```
15
+ <flowDir>/nodes/<name>/index.mjs
16
+ ```
17
+
18
+ 行为完全由输入决定、不需要 AI 推理的,就该是代码节点。需要理解和判断的用
19
+ `agent.subAgent`。
20
+
21
+ ## CLI 前置条件
22
+
23
+ 同时安装并读取 `agentflow-cli` skill。把其 `SKILL.md` 所在目录记为
24
+ `<agentflow-cli-skill-dir>`;不要假设当前项目包含 `skills/agentflow-cli`。先执行:
25
+
26
+ ```bash
27
+ node <agentflow-cli-skill-dir>/scripts/agentflow-cli.mjs config
28
+ ```
29
+
30
+ 跨端节点操作要求 `localRuntime.available: true` 和有效 token;缺少 companion skill 或本地
31
+ AgentFlow runtime 时先停止并按 `agentflow-cli` 的安装说明修复。
32
+
33
+ 写新包之前,先搜索服务端目录,避免重复造已有节点:
34
+
35
+ ```bash
36
+ node <agentflow-cli-skill-dir>/scripts/agentflow-cli.mjs node-package-search --query "需要的能力"
37
+ ```
38
+
39
+ 结果包含固定版本 `specifier` 和输入/输出槽。满足需求时先 `node-package-install`,然后直接
40
+ import 返回的 `marketplace:<id>@<version>`;只有没有合适结果时才创建 `nodes/<name>/`。
41
+
42
+ ## 最小完整例子
43
+
44
+ ```js
45
+ import fs from "node:fs/promises";
46
+
47
+ export default {
48
+ id: "count_lines", // 必填,构成 marketplace:count_lines@1.0.0
49
+ version: "1.0.0", // 必填,完整 semver
50
+ name: "统计行数",
51
+ description: "读一个文本文件,统计行数",
52
+ inputs: {
53
+ filePath: { type: "text", description: "文件路径", required: true },
54
+ },
55
+ outputs: {
56
+ total: { type: "text" },
57
+ },
58
+ };
59
+
60
+ export async function run(inputs, outputs, dirs) {
61
+ const text = await fs.readFile(inputs.filePath, "utf-8");
62
+ const total = text.split("\n").length;
63
+ await fs.writeFile(outputs.total, String(total), "utf-8");
64
+ console.log(`共 ${total} 行`); // 进度而已
65
+ }
66
+ ```
67
+
68
+ 在图里就是一条 import:
69
+
70
+ ```js
71
+ import countLines from "./nodes/count-lines";
72
+
73
+ const count = countLines("统计行数", { filePath: pick.result });
74
+ const show = display.markdown("结果", { content: count.total });
75
+ ```
76
+
77
+ ## 三条硬约束
78
+
79
+ **① 声明必须是纯字面量。** `export default` 由 acorn **静态解析**——列节点面板、渲染画布、
80
+ 校验槽位、算运行缓存指纹,全程不执行包里的代码。目录扫描期执行第三方代码既慢又不安全。
81
+
82
+ ```js
83
+ const T = "text";
84
+ export default { inputs: { day: { type: T } } }; // ✗ 变量引用
85
+ export default { ...base, id: "x" }; // ✗ 展开
86
+ export default { version: pkg.version }; // ✗ 成员访问
87
+ ```
88
+
89
+ 违反时带位置报错(`export default.id: 只允许字面量,不允许 Identifier`),不会静默变成空
90
+ 清单让节点从面板上消失。
91
+
92
+ **② `outputs.<name>` 是要写入的绝对路径,不是值。** 最容易搞错的一点。
93
+
94
+ ```js
95
+ await fs.writeFile(outputs.total, String(total)); // ✓
96
+ outputs.total = String(total); // ✗ 什么都没发生
97
+ ```
98
+
99
+ 每个声明过的输出槽各自一个文件。**第一个非控制输出槽**承载节点的结果正文。stdout 只在你
100
+ **没有**为结果槽写文件时才当结果——所以 `console.log` 打进度不会盖掉你写进去的值。
101
+
102
+ `file` 类型的输出槽同理,把**文件内容本身**写到 `outputs.<name>` 上:
103
+
104
+ ```js
105
+ await fs.writeFile(outputs.deduped, csvText, "utf-8"); // ✓
106
+ const p = path.join(dirs.outputsDir, "deduped.csv");
107
+ await fs.writeFile(p, csvText); await fs.writeFile(outputs.deduped, p); // ✗
108
+ ```
109
+
110
+ 第二种在测试里看着能过(下游确实拿到一个存在的路径),但槽文件才是被当成产物管理的东西,
111
+ 你自选的那个路径在真实运行时位于会被清理的临时目录里。
112
+
113
+ **③ 槽位顺序 = 画布 handle 顺序。** `inputs` / `outputs` 是有序映射,控制槽 `prev` / `next`
114
+ 自动前置。改声明顺序等于改已有流程的接线,加槽位请往后加。
115
+
116
+ 可用类型:`text` `file` `bool` `node` `image` `json`。未知类型直接报错。
117
+
118
+ ## `run(inputs, outputs, dirs)`
119
+
120
+ | 参数 | 内容 |
121
+ |------|------|
122
+ | `inputs` | 槽位名 → 上游传来的值。`file` 槽拿到的是路径 |
123
+ | `outputs` | 槽位名 → **要写入的绝对路径** |
124
+ | `dirs` | `workspaceRoot` / `nodeRunDir` / `nodeTmpDir` / `outputsDir` |
125
+
126
+ 失败 = 抛异常或非零退出。不要用 JSON 包裹 stdout,也不要自己造结果文件。
127
+
128
+ `index.mjs` 是**普通 Node 模块**,会被真执行:`for` / `if` / `await` 都可以写。复杂实现可拆到
129
+ 包内 `scripts/`,模板和资源可放 `templates/`、`assets/` 并用相对路径加载。不要提交
130
+ `node_modules`;跨端包当前只应依赖 Node 内置模块或包内自带源码。
131
+ 和 `workspace.flow.js` 那种「禁一切控制流」的结构文件完全两套规则。
132
+
133
+ ## 验证
134
+
135
+ ```bash
136
+ agentflow flow dsl lint <flowDir> # 声明能不能静态解析、接线对不对
137
+ ```
138
+
139
+ 然后在画布上跑一次。节点会以 `marketplace:<id>@<version>` 出现在面板里。
140
+
141
+ ## 发布给别的流程用
142
+
143
+ 流程自带的 `nodes/<name>/` 只有那个流程能用。要复用就发布:
144
+
145
+ ```bash
146
+ agentflow marketplace publish-node <flowDir>/nodes/<name>
147
+ agentflow marketplace list
148
+ ```
149
+
150
+ 包会被复制到 `.workspace/agentflow/marketplace/packages/nodes/<id>/<version>`。
151
+
152
+ 要发给另一台机器或另一个 Agent workspace,上传和安装**整个包目录**:
153
+
154
+ ```bash
155
+ node <agentflow-cli-skill-dir>/scripts/agentflow-cli.mjs node-package-publish --file <flowDir>/nodes/<name>
156
+ node <agentflow-cli-skill-dir>/scripts/agentflow-cli.mjs node-package-install \
157
+ --node <id>@<version> --workspace-root <targetWorkspace>
158
+ ```
159
+
160
+ 流程和本地 `nodes/` 已经一起完成时,优先一键发布,避免漏传包或只传 `index.mjs`:
161
+
162
+ ```bash
163
+ node <agentflow-cli-skill-dir>/scripts/agentflow-cli.mjs publish-flow \
164
+ --flow-id <flow-id> --file <flowDir> --target-space personal --with-dependencies
165
+ ```
166
+
167
+ 命令上传所有包目录,并只在远端发布产物中把 `./nodes/<name>` 改为固定版本 import;本地
168
+ `workspace.flow.js` 保持不变。同版本不同内容会整批在上传前拒绝,必须先提升版本号。
169
+
170
+ 如果已经有 `workspace.flow.js`,直接同步它声明的全部包:
171
+
172
+ ```bash
173
+ node <agentflow-cli-skill-dir>/scripts/agentflow-cli.mjs node-package-sync \
174
+ --flow <flowDir> --workspace-root <targetWorkspace>
175
+ ```
176
+
177
+ 如果流程本身还没落到本地,直接 pull;它会先同步包,再生成本地 DSL:
178
+
179
+ ```bash
180
+ node <agentflow-cli-skill-dir>/scripts/agentflow-cli.mjs pull-flow \
181
+ --flow-id <flow-id> --flow-source user --workspace-root <targetWorkspace>
182
+ ```
183
+
184
+ 传输格式是 ZIP,`scripts/`、`templates/`、`assets/` 都会随包传输;同一个 `id@version` 内容
185
+ 不同会被拒绝,修改后必须提升版本号。
186
+
187
+ 解析 `marketplace:<id>@<version>` 的顺序是**流程本地 → 已发布 → 集合**:流程自己的实现永远
188
+ 不会被同名的已发布包顶掉。
189
+
190
+ 已安装的包直接在 `workspace.flow.js` 里写版本化 import:
191
+
192
+ ```js
193
+ import myNode from "marketplace:<id>@<version>";
194
+ ```
195
+
196
+ 存储层会把它投影成「基础类型 + `marketplaceRef`」,保存后仍保留这条 import。
197
+
198
+ ## 别做的事
199
+
200
+ - **不要写 `node.yaml`。** 它只是已发布老包的回退清单,新包一律用 `index.mjs`。
201
+ - **不要写 `runtime.entry` / `scripts/run.mjs`。** 那是老 manifest 的字段,现在实现就在
202
+ `index.mjs` 的 `run` 里。
203
+ - **不要找旧的 `agentflow marketplace install-node`。** 它写的是 `flow.yaml` 依赖钉。跨端安装
204
+ 使用 token-backed CLI 的 `node-package-install`;DSL 用 `marketplace:<id>@<version>` import。
205
+ - **不要用 `agentflow run` / `apply`。** Start/End Pipeline 执行栈已退休,运行走 Workspace。
206
+ - **不要把本机绝对路径或密钥写进包。**
207
+
208
+ ## 相关
209
+
210
+ - `agentflow-flow-dsl`:图怎么写,import 代码节点的语法
211
+ - `agentflow-node-reference`:内置节点类型的槽位表
212
+ - `docs/wiki/code-node-packages.zh-CN.md`:更完整的说明
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "AgentFlow Node DSL"
3
+ short_description: "Create, test, and distribute reusable AgentFlow nodes"
4
+ default_prompt: "Use $agentflow-node-dsl to create and validate a reusable AgentFlow code node package."
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: agentflow-node-reference
3
3
  description: >-
4
- AgentFlow 内置节点参考。用于选择节点类型、确认 builtin node 的 input/output 槽位、
4
+ AgentFlow Workspace 节点参考。用于选择节点类型、确认 builtin node 的 input/output 槽位、
5
5
  判断 local-only/script/agent 执行方式,以及避免 handle 类型和顺序接错。
6
6
  ---
7
7
 
@@ -9,13 +9,14 @@ description: >-
9
9
 
10
10
  使用本技能处理这些问题:
11
11
 
12
- - 选择 `agent_subAgent`、`tool_nodejs`、`tool_git_checkout`、`control_cd_workspace`、`tool_print` 等节点。
13
- - 创建或修改 flow 时需要确认 input/output 名称、类型、顺序和 handle 索引。
12
+ - 选择 `agent_subAgent`、`tool_nodejs`、`tool_git_checkout`、`control_cd_workspace`、`display_markdown` 等节点。
13
+ - 创建或修改 Workspace Graph 时需要确认 input/output 名称、类型、顺序和 handle 索引。
14
14
  - 判断节点是否 local-only,是否会调用 agent,是否需要 `script`。
15
15
 
16
16
  ## 必读规则
17
17
 
18
- - 先读 [builtin-nodes.md](references/builtin-nodes.md),再改 `flow.yaml` `definitionId`、`input`、`output` `edges`。
18
+ - 先读 [builtin-nodes.md](references/builtin-nodes.md),再改 `workspace.flow.js` 的节点调用、引脚和连线;DSL 里的调用名见 **agentflow-flow-dsl** 的 node-calls.md。
19
+ - 新图入口使用 `workspace_run` / `workspace_scheduled_run`,不要新增 `control_start` / `control_end`。
19
20
  - `input-N` / `output-N` 必须与节点定义中的槽位顺序一致。
20
21
  - `tool_nodejs` 只有写了完整 `script` 才会确定性执行;自然语言任务用 `agent_subAgent`。
21
22
  - local-only 节点由 AgentFlow runtime 执行,不会调用 agent。