@fieldwangai/agentflow 0.1.28 → 0.1.30

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 (63) hide show
  1. package/agents/agentflow-node-executor-code.md +3 -2
  2. package/agents/agentflow-node-executor-planning.md +3 -2
  3. package/agents/agentflow-node-executor-requirement.md +3 -2
  4. package/agents/agentflow-node-executor-test.md +3 -2
  5. package/agents/agentflow-node-executor-ui.md +3 -2
  6. package/agents/agentflow-node-executor.md +3 -2
  7. package/agents/en/agentflow-node-executor.md +3 -2
  8. package/agents/zh/agentflow-node-executor.md +3 -2
  9. package/bin/lib/agent-runners.mjs +38 -13
  10. package/bin/lib/api-runner.mjs +6 -3
  11. package/bin/lib/auth.mjs +240 -0
  12. package/bin/lib/catalog-agents.mjs +2 -2
  13. package/bin/lib/catalog-flows.mjs +192 -16
  14. package/bin/lib/composer-agent.mjs +21 -1
  15. package/bin/lib/composer-skill-router.mjs +10 -78
  16. package/bin/lib/flow-import.mjs +2 -2
  17. package/bin/lib/flow-write.mjs +20 -20
  18. package/bin/lib/help.mjs +2 -2
  19. package/bin/lib/locales/en.json +25 -1
  20. package/bin/lib/locales/zh.json +25 -1
  21. package/bin/lib/main.mjs +6 -1
  22. package/bin/lib/node-exec-context.mjs +5 -5
  23. package/bin/lib/node-execute.mjs +14 -9
  24. package/bin/lib/paths.mjs +64 -13
  25. package/bin/lib/recent-runs.mjs +2 -2
  26. package/bin/lib/run-node-statuses-from-disk.mjs +3 -3
  27. package/bin/lib/runtime-context.mjs +225 -0
  28. package/bin/lib/scheduler.mjs +41 -38
  29. package/bin/lib/skill-registry.mjs +145 -0
  30. package/bin/lib/ui-server.mjs +902 -57
  31. package/bin/lib/workspace-tree.mjs +4 -3
  32. package/bin/lib/workspace.mjs +9 -11
  33. package/bin/pipeline/build-node-prompt.mjs +29 -4
  34. package/bin/pipeline/get-exec-id.mjs +2 -2
  35. package/bin/pipeline/get-resolved-values.mjs +1 -0
  36. package/bin/pipeline/pre-process-node.mjs +306 -6
  37. package/bin/pipeline/validate-flow.mjs +2 -0
  38. package/builtin/nodes/agent_subAgent.md +7 -1
  39. package/builtin/nodes/control_cd_workspace.md +43 -0
  40. package/builtin/nodes/control_load_skills.md +48 -0
  41. package/builtin/nodes/display_ascii.md +17 -0
  42. package/builtin/nodes/display_markdown.md +17 -0
  43. package/builtin/nodes/display_mermaid.md +17 -0
  44. package/builtin/nodes/tool_git_checkout.md +54 -0
  45. package/builtin/nodes/tool_nodejs.md +8 -1
  46. package/builtin/nodes/tool_print.md +4 -1
  47. package/builtin/web-ui/dist/assets/index-NdVOJLL9.js +196 -0
  48. package/builtin/web-ui/dist/assets/index-naVI6LZj.css +1 -0
  49. package/builtin/web-ui/dist/index.html +2 -2
  50. package/package.json +2 -1
  51. package/skills/agentflow-flow-add-instances/SKILL.md +257 -0
  52. package/skills/agentflow-flow-edit-node-fields/SKILL.md +79 -0
  53. package/skills/agentflow-flow-recipes/SKILL.md +24 -0
  54. package/skills/agentflow-flow-recipes/references/recipes.md +63 -0
  55. package/skills/agentflow-flow-sync-ui/SKILL.md +59 -0
  56. package/skills/agentflow-node-reference/SKILL.md +25 -0
  57. package/skills/agentflow-node-reference/references/builtin-nodes.md +210 -0
  58. package/skills/agentflow-placeholder-reference/SKILL.md +24 -0
  59. package/skills/agentflow-placeholder-reference/references/placeholders.md +20 -0
  60. package/skills/agentflow-runtime-reference/SKILL.md +25 -0
  61. package/skills/agentflow-runtime-reference/references/runtime.md +64 -0
  62. package/builtin/web-ui/dist/assets/index-BeUBxIj1.js +0 -190
  63. package/builtin/web-ui/dist/assets/index-BzhdjOzb.css +0 -1
@@ -0,0 +1,210 @@
1
+ # AgentFlow Builtin Nodes Reference
2
+
3
+ > Generated from `builtin/nodes/*.md` by `scripts/generate-agentflow-skill-references.mjs`.
4
+
5
+ ## Rules Of Thumb
6
+
7
+ - `tool_nodejs` needs an executable `script`; `body` is documentation when `script` exists.
8
+ - `agent_subAgent` is for semantic/code/text reasoning tasks.
9
+ - Local-only nodes are executed by AgentFlow runtime and do not call an agent.
10
+ - Edge handles are positional: `input-0`, `output-0`, etc. Match slot order exactly.
11
+
12
+ ## agent
13
+
14
+ ### agent_subAgent
15
+
16
+ - Display: SubAgent
17
+ - Description: 利用 SubAgent 执行任务;可接收 workspaceContext 切换执行工作区,并接收 skillsContext 注入已加载 skills。
18
+ - Runtime: agent/runner
19
+ - Inputs: 0. `prev`:node; 1. `workspaceContext`:text; 2. `skillsContext`:text
20
+ - Outputs: 0. `next`:node
21
+
22
+ ## control
23
+
24
+ ### control_agent_toBool
25
+
26
+ - Display: Agent ToBool
27
+ - 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.
28
+ - Runtime: agent/runner
29
+ - Inputs: 0. `prev`:node; 1. `value`:text
30
+ - Outputs: 0. `next`:node; 1. `prediction`:bool
31
+
32
+ ### control_anyOne
33
+
34
+ - Display: AnyOne
35
+ - Description: Continues to next when any upstream input is ready
36
+ - Runtime: agent/runner
37
+ - Inputs: 0. `prev1`:node; 1. `prev2`:node
38
+ - Outputs: 0. `next`:node
39
+
40
+ ### control_cancelled
41
+
42
+ - Display: Cancelled
43
+ - Description: Check whether the current run/watch has been cancelled. Use cancelled output with control_if.
44
+ - Runtime: local-only
45
+ - Inputs: 0. `prev`:node; 1. `watchId`:text
46
+ - Outputs: 0. `next`:node; 1. `cancelled`:bool
47
+
48
+ ### control_cd_workspace
49
+
50
+ - Display: CD Workspace
51
+ - Description: Switch the runtime workspace context for downstream nodes without changing the AgentFlow pipeline workspace. Modes: - `set`: switch to target, keep previous stack unchanged. - `push`: switch to target and save the incoming context as previous. - `pop`: restore the previous context. `target` supports `${workspaceRoot}`, `${pipelineWorkspace}`, `${flowDir}`, absolute paths, and paths relative to current workspace context.
52
+ - Runtime: local-only
53
+ - Inputs: 0. `prev`:node; 1. `target`:text = ${pipelineWorkspace}; 2. `mode`:text = set; 3. `label`:text; 4. `workspaceContext`:text
54
+ - Outputs: 0. `next`:node; 1. `workspaceContext`:text; 2. `cwd`:file; 3. `previous`:text
55
+
56
+ ### control_deadline
57
+
58
+ - Display: Deadline
59
+ - Description: Compute whether a deadline has expired. Use expired output with control_if.
60
+ - Runtime: local-only
61
+ - Inputs: 0. `prev`:node; 1. `startAt`:text; 2. `duration`:text; 3. `deadlineAt`:text; 4. `timezone`:text = Asia/Shanghai
62
+ - Outputs: 0. `next`:node; 1. `expired`:bool; 2. `deadlineAt`:text
63
+
64
+ ### control_delay
65
+
66
+ - Display: Delay
67
+ - Description: Persistently wait for a relative duration, then continue when scheduler resumes this run.
68
+ - Runtime: local-only
69
+ - Inputs: 0. `prev`:node; 1. `duration`:text = 10m
70
+ - Outputs: 0. `next`:node; 1. `wakeAt`:text
71
+
72
+ ### control_end
73
+
74
+ - Display: End
75
+ - Description: End point of AgentFlow, flow terminates after this node
76
+ - Runtime: local-only
77
+ - Inputs: 0. `prev`:node
78
+ - Outputs: 无
79
+
80
+ ### control_if
81
+
82
+ - Display: If
83
+ - Description: Has exactly one bool type input. Continues to next1 if true, next2 if false
84
+ - Runtime: local-only
85
+ - Inputs: 0. `prev`:node; 1. `prediction`:bool
86
+ - Outputs: 0. `next1`:node; 1. `next2`:node
87
+
88
+ ### control_interval_loop
89
+
90
+ - Display: IntervalLoop
91
+ - Description: Wait by interval and branch to continue, done, timeout, or cancelled for watch-style flows.
92
+ - Runtime: local-only
93
+ - Inputs: 0. `prev`:node; 1. `done`:bool; 2. `cancelled`:bool; 3. `interval`:text = 10m; 4. `startAt`:text; 5. `duration`:text; 6. `deadlineAt`:text; 7. `timezone`:text = Asia/Shanghai
94
+ - Outputs: 0. `continue`:node; 1. `done`:node; 2. `timeout`:node; 3. `cancelled`:node; 4. `wakeAt`:text; 5. `expired`:bool; 6. `deadlineAt`:text
95
+
96
+ ### control_load_skills
97
+
98
+ - Display: Load Skills
99
+ - Description: Load SKILL.md files from the current workspace context, pipeline workspace, explicit paths, or both. The output `skillsContext` can be connected to downstream agent nodes. Loaded skills are injected into the node prompt under "已加载 Skills". Sources: - `current-workspace` - `pipeline-workspace` - `explicit-paths` - `all` Merge modes: - `replace` - `append` - `prepend`
100
+ - Runtime: local-only
101
+ - Inputs: 0. `prev`:node; 1. `source`:text = current-workspace; 2. `paths`:text; 3. `include`:text; 4. `exclude`:text; 5. `mergeMode`:text = replace; 6. `workspaceContext`:text; 7. `skillsContext`:text
102
+ - Outputs: 0. `next`:node; 1. `skillsContext`:text; 2. `loadedCount`:text; 3. `summary`:text
103
+
104
+ ### control_start
105
+
106
+ - Display: Start
107
+ - Description: Entry point of AgentFlow, all flows should start from this node
108
+ - Runtime: local-only
109
+ - Inputs: 无
110
+ - Outputs: 0. `next`:node
111
+
112
+ ### control_toBool
113
+
114
+ - Display: ToBool
115
+ - Description: Script-based boolean conversion: executes script to produce true/false prediction. Like tool_nodejs but enforces bool output. Must have script field.
116
+ - Runtime: agent/runner
117
+ - Inputs: 0. `prev`:node; 1. `value`:text
118
+ - Outputs: 0. `next`:node; 1. `prediction`:bool
119
+
120
+ ### control_wait_until
121
+
122
+ - Display: WaitUntil
123
+ - Description: Persistently wait until an absolute time, then continue when scheduler resumes this run.
124
+ - Runtime: local-only
125
+ - Inputs: 0. `prev`:node; 1. `until`:text; 2. `timezone`:text = Asia/Shanghai
126
+ - Outputs: 0. `next`:node; 1. `wakeAt`:text
127
+
128
+ ## tool
129
+
130
+ ### tool_get_env
131
+
132
+ - Display: GetEnv
133
+ - Description: Get environment variable value
134
+ - Runtime: agent/runner
135
+ - Inputs: 0. `key`:text
136
+ - Outputs: 0. `value`:text
137
+
138
+ ### tool_git_checkout
139
+
140
+ - Display: Git Checkout
141
+ - Description: Clone or update a Git repository and expose it as a workspace context for downstream nodes. - `repoUrl` is required. - `targetDir` may be absolute or relative to the current workspace context. - If `targetDir` is empty, the repository is cloned into `${pipelineWorkspace}/.workspace/agentflow/git-repos/<repo-name>`. - Set `includeSubmodules` to `true` to clone/update Git submodules recursively. - The `workspaceContext` output can be connected to CD Workspace, Load Skills, agent, or tool nodes.
142
+ - Runtime: local-only
143
+ - Inputs: 0. `prev`:node; 1. `repoUrl`:text; 2. `branch`:text; 3. `targetDir`:text; 4. `pullIfExists`:bool = true; 5. `includeSubmodules`:bool = false; 6. `workspaceContext`:text
144
+ - Outputs: 0. `next`:node; 1. `repoPath`:file; 2. `branch`:text; 3. `commit`:text; 4. `changed`:bool; 5. `workspaceContext`:text
145
+
146
+ ### tool_load_key
147
+
148
+ - Display: LoadKey
149
+ - Description: Load key-value from global storage
150
+ - Runtime: agent/runner
151
+ - Inputs: 0. `prev`:node; 1. `key`:text
152
+ - Outputs: 0. `next`:node; 1. `result`:text
153
+
154
+ ### tool_nodejs
155
+
156
+ - Display: NodeJs
157
+ - Description: Execute Node.js script via agentflow apply -ai run-tool-nodejs. **Success/Failure:** Determined by script process **exit code**—0 = success, non-0 = failed. **Result Output:** Script stdout directly becomes result slot content (plain text, e.g., `console.log("hello")`). When stdout is empty and exit code is non-0, stderr info will be written to failure message. **JSON Compatible (Optional):** If stdout is `{"err_code":0,"message":{"result":"..."}}` format, err_code will override exit code semantics, message.result writes to result slot. Only use when needing different success/failure semantics than exit code. **Direct Execution Mode (Recommended):** Set `script` field in flow.yaml instance, pipeline will skip AI and execute directly. `script` supports ${} placeholders (workspaceRoot, pipelineWorkspace, flowName, runDir, flowDir and all input/output slots), values are auto shell-quoted. When a CD Workspace node is connected, `workspaceRoot` is the current execution workspace; `pipelineWorkspace` is the original pipeline workspace. flowDir is absolute path of current pipeline flow.yaml directory, can be used to reference scripts in same directory. Example: `script: node ${flowDir}/scripts/my-check.mjs --root ${workspaceRoot} --input ${todo}` **Pin Path Constraint (Important):** File paths read/written by script **must be passed via pins**, forbidden to construct output paths inside script. - All input slots with type 'file' (e.g., `figma_tree`, `semantic_outline`) are parsed from upstream connections by pipeline, script receives via CLI args. - All output slots with type 'file' (e.g., `restore_todolist`, `screenshot_map`) are generated by pipeline as absolute paths following `output/<instanceId>/node_<instanceId>_<slot>.md` convention, script receives via CLI args and writes directly. - Use `${slotName}` in `script` field to get correct path, e.g., `--figma-tree ${figma_tree} --output ${restore_todolist}`. - **Forbidden** to use `outDirForNode`, manually write `node_<instance>_xxx.json` etc. in script—this causes script output path mismatch with pipeline parser convention, downstream nodes cannot find files. **AI Execution Mode (Legacy):** Without `script` field, AI agent reads body and manually executes commands. **Underlying Usage:** agentflow apply -ai run-tool-nodejs <workspaceRoot> <flowName> <uuid> <instanceId> [execId] -- <scriptCmd> [args...]
158
+ - Runtime: direct script when script exists, otherwise agent
159
+ - Inputs: 0. `prev`:node; 1. `workspaceContext`:text; 2. `skillsContext`:text
160
+ - Outputs: 0. `next`:node; 1. `result`:text
161
+
162
+ ### tool_print
163
+
164
+ - Display: Print
165
+ - Description: Output content to user with special font style
166
+ - Runtime: local-only
167
+ - Inputs: 0. `prev`:node; 1. `content`:text
168
+ - Outputs: 0. `next`:node
169
+
170
+ ### tool_save_key
171
+
172
+ - Display: SaveKey
173
+ - Description: Save key-value pair to global storage
174
+ - Runtime: agent/runner
175
+ - Inputs: 0. `prev`:node; 1. `key`:text; 2. `value`:text
176
+ - Outputs: 0. `next`:node
177
+
178
+ ### tool_user_ask
179
+
180
+ - Display: UserAsk
181
+ - Description: 等待用户从多个选项中选择一个,流程暂停;按用户选择沿对应出边分支继续。每个 output 槽位对应一条分支,槽位的 description 作为选项文案。
182
+ - Runtime: local-only
183
+ - Inputs: 0. `prev`:node; 1. `question`:file
184
+ - Outputs: 0. `option_0`:node; 1. `option_1`:node
185
+
186
+ ### tool_user_check
187
+
188
+ - Display: UserCheck
189
+ - Description: 等待用户确认,流程暂停。展示确认内容给用户,用户可编辑/AI修改后保存,回复 "继续" 后重启流程。
190
+ - Runtime: local-only
191
+ - Inputs: 0. `prev`:node; 1. `content`:file
192
+ - Outputs: 0. `next`:node; 1. `content`:file
193
+
194
+ ## provide
195
+
196
+ ### provide_file
197
+
198
+ - Display: File
199
+ - Description: Provide file path or content directly, value will be passed to downstream as-is
200
+ - Runtime: local-only
201
+ - Inputs: 无
202
+ - Outputs: 0. `value`:file
203
+
204
+ ### provide_str
205
+
206
+ - Display: String
207
+ - Description: Provide a text value directly, value will be passed to downstream as-is
208
+ - Runtime: local-only
209
+ - Inputs: 无
210
+ - Outputs: 0. `value`:text
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: agentflow-placeholder-reference
3
+ description: >-
4
+ AgentFlow 占位符参考。用于编写 body/script 中的 ${workspaceRoot}、${pipelineWorkspace}、
5
+ ${flowDir}、${runDir}、${input.xxx}、${output.xxx} 等变量。
6
+ ---
7
+
8
+ # AgentFlow Placeholder Reference
9
+
10
+ 使用本技能处理这些问题:
11
+
12
+ - 编写或修复 `tool_nodejs.script`、agent body、节点默认值中的 `${...}`。
13
+ - CD Workspace 后确认路径应该用 `workspaceRoot` 还是 `pipelineWorkspace`。
14
+ - 解决脚本里路径多了一层引号、找不到 flow scripts、输出路径不对的问题。
15
+
16
+ ## 必读规则
17
+
18
+ - 读 [placeholders.md](references/placeholders.md)。
19
+ - 不要在 `script` 中给 `${workspaceRoot}` 这类占位符再包一层双引号;AgentFlow 会 shell-quote。
20
+ - flow 自带脚本优先用 `${flowDir}/scripts/...`。
21
+
22
+ ## Reference
23
+
24
+ - [Placeholder reference](references/placeholders.md)
@@ -0,0 +1,20 @@
1
+ # AgentFlow Placeholder Reference
2
+
3
+ > Generated from `builtin/web-ui/src/bodyPlaceholders.js` by `scripts/generate-agentflow-skill-references.mjs`.
4
+
5
+ ## Runtime Placeholders
6
+
7
+ - `${workspaceRoot}`: Current execution workspace. After CD Workspace, this is the target project workspace.
8
+ - `${pipelineWorkspace}`: Original AgentFlow pipeline workspace. Use this to access pipeline-owned files after CD Workspace.
9
+ - `${cwd}`: Alias-like current working directory for the runtime workspace context.
10
+ - `${flowName}`: Current pipeline id/name.
11
+ - `${runDir}`: Current run directory, relative to pipeline workspace.
12
+ - `${flowDir}`: Absolute directory containing the current flow.yaml.
13
+
14
+ ## Slot Placeholders
15
+
16
+ - `${input.<slotName>}`: input slot value by name.
17
+ - `${output.<slotName>}`: output slot path by name.
18
+ - `${<slotName>}`: shorthand for input or output slot when unambiguous.
19
+
20
+ Do not wrap placeholders in extra quotes inside `script`; AgentFlow shell-quotes substituted values.
@@ -0,0 +1,25 @@
1
+ ---
2
+ name: agentflow-runtime-reference
3
+ description: >-
4
+ AgentFlow 运行时参考。用于理解 pipeline/workspace 目录、runBuild、
5
+ intermediate/output/result 文件、workspaceContext/skillsContext 传递和 CD Workspace 行为。
6
+ ---
7
+
8
+ # AgentFlow Runtime Reference
9
+
10
+ 使用本技能处理这些问题:
11
+
12
+ - 解释或调试 AgentFlow 运行目录和产物。
13
+ - 设计 Git Checkout、CD Workspace、Load Skills、Agent、Print 的工作区切换链路。
14
+ - 判断 `${workspaceRoot}` 与 `${pipelineWorkspace}` 在 CD Workspace 前后的差异。
15
+ - 排查上游 output 文件、result.md、cache.json、skillsContext 没传到下游的问题。
16
+
17
+ ## 必读规则
18
+
19
+ - 读 [runtime.md](references/runtime.md) 了解目录与上下文。
20
+ - 下游 agent/tool 的当前执行目录由 `workspaceContext` 决定。
21
+ - pipeline 自己的文件永远通过 `pipelineWorkspace` / `flowDir` 找,不要在 CD 后误用 `workspaceRoot`。
22
+
23
+ ## Reference
24
+
25
+ - [Runtime reference](references/runtime.md)
@@ -0,0 +1,64 @@
1
+ # AgentFlow Runtime Reference
2
+
3
+ ## Workspaces
4
+
5
+ - `pipelineWorkspace`: the original workspace that owns the AgentFlow pipeline run.
6
+ - `workspaceRoot`: current execution workspace. Before CD Workspace it is usually the pipeline workspace; after CD Workspace it becomes the selected project directory.
7
+ - `cwd`: current runtime working directory, normally same as `workspaceRoot`.
8
+ - `flowDir`: absolute directory containing the current `flow.yaml`.
9
+
10
+ ## Pipeline Locations
11
+
12
+ - Builtin pipelines: `builtin/pipelines/<flowId>/flow.yaml`
13
+ - Workspace pipelines: `.workspace/agentflow/pipelines/<flowId>/flow.yaml`
14
+ - User pipelines: `~/agentflow/pipelines/<flowId>/flow.yaml`
15
+ - Pipeline scripts: `<flowDir>/scripts/*`
16
+ - Flow-local nodes: `<flowDir>/nodes/*.md`
17
+
18
+ ## Run Directory
19
+
20
+ Each run writes under:
21
+
22
+ ```text
23
+ <pipelineWorkspace>/.workspace/agentflow/runBuild/<flowName>/<uuid>/
24
+ ```
25
+
26
+ Important files:
27
+
28
+ - `intermediate/flow.json`: parsed graph snapshot.
29
+ - `intermediate/<instanceId>/<instanceId>.prompt.md`: prompt used by a node.
30
+ - `intermediate/<instanceId>/<instanceId>.result.md`: node status and result body.
31
+ - `intermediate/<instanceId>/<instanceId>.cache.json`: cache metadata.
32
+ - `output/<instanceId>/node_<instanceId>_<slot>.md`: output slot files.
33
+ - `logs/log.txt`: run events and CLI logs.
34
+
35
+ ## Context Objects
36
+
37
+ `workspaceContext` is a JSON text value passed between nodes:
38
+
39
+ ```json
40
+ {
41
+ "version": 1,
42
+ "label": "workspace",
43
+ "cwd": "/abs/current/workspace",
44
+ "workspaceRoot": "/abs/current/workspace",
45
+ "pipelineWorkspace": "/abs/pipeline/workspace",
46
+ "flowDir": "/abs/flow/dir",
47
+ "previous": null
48
+ }
49
+ ```
50
+
51
+ `skillsContext` is a JSON text value generated by Load Skills and consumed by downstream agent/tool nodes. It contains selected skill metadata and loaded SKILL.md bodies.
52
+
53
+ ## Git / CD Behavior
54
+
55
+ - `tool_git_checkout` outputs `workspaceContext` whose `workspaceRoot` is the checked-out repository path.
56
+ - `control_cd_workspace` changes downstream execution workspace.
57
+ - If Git Checkout is immediately followed by CD Workspace, connect `workspaceContext` and set CD `target` to `.`.
58
+ - Do not connect `repoPath:file` to `target:text`; use `workspaceContext` instead.
59
+
60
+ ## Output Resolution
61
+
62
+ - Edge values are resolved by handle index.
63
+ - File slots usually pass paths; text slots may read upstream output file content.
64
+ - `tool_print.content` should receive the display text. If missing, `tool_print` may fallback to upstream result body.