@fieldwangai/agentflow 0.1.29 → 0.1.31

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 (69) 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 +63 -14
  10. package/bin/lib/api-runner.mjs +30 -4
  11. package/bin/lib/apply.mjs +6 -5
  12. package/bin/lib/auth.mjs +240 -0
  13. package/bin/lib/catalog-agents.mjs +2 -2
  14. package/bin/lib/catalog-flows.mjs +196 -17
  15. package/bin/lib/composer-agent.mjs +22 -1
  16. package/bin/lib/composer-skill-router.mjs +10 -78
  17. package/bin/lib/flow-import.mjs +2 -2
  18. package/bin/lib/flow-write.mjs +20 -20
  19. package/bin/lib/help.mjs +2 -2
  20. package/bin/lib/locales/en.json +29 -1
  21. package/bin/lib/locales/zh.json +31 -3
  22. package/bin/lib/main.mjs +6 -1
  23. package/bin/lib/node-exec-context.mjs +5 -5
  24. package/bin/lib/node-execute.mjs +15 -10
  25. package/bin/lib/paths.mjs +69 -13
  26. package/bin/lib/recent-runs.mjs +2 -2
  27. package/bin/lib/run-node-statuses-from-disk.mjs +3 -3
  28. package/bin/lib/runtime-context.mjs +225 -0
  29. package/bin/lib/scheduler.mjs +42 -38
  30. package/bin/lib/skill-registry.mjs +145 -0
  31. package/bin/lib/ui-server.mjs +1517 -57
  32. package/bin/lib/user-env.mjs +83 -0
  33. package/bin/lib/workspace-tree.mjs +4 -3
  34. package/bin/lib/workspace.mjs +9 -11
  35. package/bin/pipeline/build-node-prompt.mjs +29 -4
  36. package/bin/pipeline/get-env.mjs +5 -29
  37. package/bin/pipeline/get-exec-id.mjs +2 -2
  38. package/bin/pipeline/get-resolved-values.mjs +1 -0
  39. package/bin/pipeline/pre-process-node.mjs +328 -6
  40. package/bin/pipeline/run-tool-nodejs.mjs +7 -0
  41. package/bin/pipeline/validate-flow.mjs +2 -0
  42. package/builtin/nodes/agent_subAgent.md +12 -3
  43. package/builtin/nodes/control_cd_workspace.md +45 -0
  44. package/builtin/nodes/control_load_skills.md +50 -0
  45. package/builtin/nodes/control_user_workspace.md +20 -0
  46. package/builtin/nodes/display_ascii.md +22 -0
  47. package/builtin/nodes/display_markdown.md +22 -0
  48. package/builtin/nodes/display_mermaid.md +22 -0
  49. package/builtin/nodes/tool_git_checkout.md +57 -0
  50. package/builtin/nodes/tool_nodejs.md +8 -1
  51. package/builtin/nodes/tool_print.md +4 -1
  52. package/builtin/web-ui/dist/assets/index-BVWwQpvg.css +1 -0
  53. package/builtin/web-ui/dist/assets/index-CvNy1n3f.js +197 -0
  54. package/builtin/web-ui/dist/index.html +2 -2
  55. package/package.json +1 -1
  56. package/skills/agentflow-flow-recipes/SKILL.md +24 -0
  57. package/skills/agentflow-flow-recipes/references/recipes.md +63 -0
  58. package/skills/agentflow-node-reference/SKILL.md +25 -0
  59. package/skills/agentflow-node-reference/references/builtin-nodes.md +210 -0
  60. package/skills/agentflow-placeholder-reference/SKILL.md +24 -0
  61. package/skills/agentflow-placeholder-reference/references/placeholders.md +20 -0
  62. package/skills/agentflow-runtime-reference/SKILL.md +25 -0
  63. package/skills/agentflow-runtime-reference/references/runtime.md +64 -0
  64. package/skills/agentflow-workspace-ascii/SKILL.md +42 -0
  65. package/skills/agentflow-workspace-graph/SKILL.md +67 -0
  66. package/skills/agentflow-workspace-markdown/SKILL.md +44 -0
  67. package/skills/agentflow-workspace-mermaid/SKILL.md +43 -0
  68. package/builtin/web-ui/dist/assets/index-0vJxkTJz.css +0 -1
  69. package/builtin/web-ui/dist/assets/index-h69bpxLI.js +0 -190
@@ -15,8 +15,8 @@
15
15
  href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0"
16
16
  rel="stylesheet"
17
17
  />
18
- <script type="module" crossorigin src="/assets/index-h69bpxLI.js"></script>
19
- <link rel="stylesheet" crossorigin href="/assets/index-0vJxkTJz.css">
18
+ <script type="module" crossorigin src="/assets/index-CvNy1n3f.js"></script>
19
+ <link rel="stylesheet" crossorigin href="/assets/index-BVWwQpvg.css">
20
20
  </head>
21
21
  <body>
22
22
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fieldwangai/agentflow",
3
- "version": "0.1.29",
3
+ "version": "0.1.31",
4
4
  "description": "Orchestration system for long-running complex agent tasks using Cursor, OpenCode, or Claude Code as execution backends",
5
5
  "type": "module",
6
6
  "main": "bin/agentflow.mjs",
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: agentflow-flow-recipes
3
+ description: >-
4
+ AgentFlow 常见流程模板。用于新建 Git 项目分析、加载项目 skills、打印结果、
5
+ 以及组合 Git Checkout → CD Workspace → Load Skills → Agent → Print 的标准流水线。
6
+ ---
7
+
8
+ # AgentFlow Flow Recipes
9
+
10
+ 使用本技能处理这些问题:
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)
@@ -0,0 +1,63 @@
1
+ # AgentFlow Flow Recipes
2
+
3
+ ## Git Project Analysis
4
+
5
+ Use when the user asks to clone/pull a repository, enter it, ask an agent what it does, and print the result.
6
+
7
+ Recommended graph:
8
+
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
17
+ ```
18
+
19
+ Minimum required values:
20
+
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.
28
+
29
+ Required context edges:
30
+
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`
40
+
41
+ Notes:
42
+
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.
46
+
47
+ ## Edit Current Flow
48
+
49
+ Use existing flow editing skills:
50
+
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`
54
+
55
+ ## Print Result
56
+
57
+ Prefer explicit content:
58
+
59
+ ```text
60
+ agent.output.summary -> tool_print.input.content
61
+ ```
62
+
63
+ Fallback behavior exists, but explicit content keeps the graph self-documenting.
@@ -0,0 +1,25 @@
1
+ ---
2
+ name: agentflow-node-reference
3
+ description: >-
4
+ AgentFlow 内置节点参考。用于选择节点类型、确认 builtin node 的 input/output 槽位、
5
+ 判断 local-only/script/agent 执行方式,以及避免 handle 类型和顺序接错。
6
+ ---
7
+
8
+ # AgentFlow Node Reference
9
+
10
+ 使用本技能处理这些问题:
11
+
12
+ - 选择 `agent_subAgent`、`tool_nodejs`、`tool_git_checkout`、`control_cd_workspace`、`tool_print` 等节点。
13
+ - 创建或修改 flow 时需要确认 input/output 名称、类型、顺序和 handle 索引。
14
+ - 判断节点是否 local-only,是否会调用 agent,是否需要 `script`。
15
+
16
+ ## 必读规则
17
+
18
+ - 先读 [builtin-nodes.md](references/builtin-nodes.md),再改 `flow.yaml` 的 `definitionId`、`input`、`output` 或 `edges`。
19
+ - `input-N` / `output-N` 必须与节点定义中的槽位顺序一致。
20
+ - `tool_nodejs` 只有写了完整 `script` 才会确定性执行;自然语言任务用 `agent_subAgent`。
21
+ - local-only 节点由 AgentFlow runtime 执行,不会调用 agent。
22
+
23
+ ## Reference
24
+
25
+ - [Builtin nodes reference](references/builtin-nodes.md)
@@ -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.
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: agentflow-workspace-ascii
3
+ description: >-
4
+ AgentFlow Workspace ASCII 图展示技能。用于生成目录树、文本框图、流程草图等
5
+ 等宽 ASCII 内容,并写入 display_ascii 节点的 workspace.graph.json。
6
+ ---
7
+
8
+ # AgentFlow Workspace ASCII
9
+
10
+ 在 Workspace 视图中需要展示目录树、简洁结构图、文本框图或不适合 Mermaid 的草图时使用本技能。
11
+
12
+ ## 生成节点
13
+
14
+ 新增或更新 `workspace.graph.json` 中的 `display_ascii` instance:
15
+
16
+ ```json
17
+ {
18
+ "definitionId": "display_ascii",
19
+ "label": "目录树",
20
+ "body": "app/\n|-- src/\n|-- package.json",
21
+ "input": [
22
+ { "type": "node", "name": "prev", "value": "" },
23
+ { "type": "text", "name": "content", "value": "app/\n|-- src/\n|-- package.json" }
24
+ ],
25
+ "output": [
26
+ { "type": "text", "name": "content", "value": "app/\n|-- src/\n|-- package.json" }
27
+ ]
28
+ }
29
+ ```
30
+
31
+ `body`、`input.content.value`、`output.content.value` 使用同一份 ASCII 文本。
32
+
33
+ ## ASCII 规则
34
+
35
+ - 只写纯文本 ASCII,避免 Unicode 线框字符,保证跨终端显示稳定。
36
+ - 目录树使用 `|--`、`` `-- ``、`| ` 缩进。
37
+ - 框图尽量短行,避免超宽节点。
38
+
39
+ ## 布局建议
40
+
41
+ - 默认宽度 640,高度 420。
42
+ - 适合作为 Markdown 分析节点旁边的辅助图。
@@ -0,0 +1,67 @@
1
+ ---
2
+ name: agentflow-workspace-graph
3
+ description: >-
4
+ AgentFlow Workspace 画布编辑技能。用于在 Workspace 视图中创建或修改
5
+ workspace.graph.json,新增展示节点、上下文节点和连线;不修改正式 flow.yaml。
6
+ ---
7
+
8
+ # AgentFlow Workspace Graph
9
+
10
+ 在 Workspace 视图中需要创建临时工作画布、保存分析结果、组织上下文节点或连接展示节点时使用本技能。
11
+
12
+ ## 目标文件
13
+
14
+ 优先修改当前 pipeline 目录下的 `workspace.graph.json`。不要修改正式 `flow.yaml`,除非用户明确要求并且 UI 勾选允许修改 flow.yaml。
15
+
16
+ `workspace.graph.json` 结构:
17
+
18
+ ```json
19
+ {
20
+ "version": 1,
21
+ "instances": {
22
+ "node_id": {
23
+ "definitionId": "display_markdown",
24
+ "label": "标题",
25
+ "body": "展示内容",
26
+ "input": [
27
+ { "type": "node", "name": "prev", "value": "" },
28
+ { "type": "text", "name": "content", "value": "展示内容" }
29
+ ],
30
+ "output": [
31
+ { "type": "text", "name": "content", "value": "展示内容" }
32
+ ]
33
+ }
34
+ },
35
+ "edges": [
36
+ { "source": "a", "target": "b", "sourceHandle": "output-0", "targetHandle": "input-0" }
37
+ ],
38
+ "ui": {
39
+ "nodePositions": { "node_id": { "x": 320, "y": 180 } },
40
+ "nodeSizes": { "node_id": { "width": 760, "height": 520 } }
41
+ }
42
+ }
43
+ ```
44
+
45
+ ## 节点使用规则
46
+
47
+ - 用 `display_markdown` 展示 Markdown 正文、分析报告、会议纪要、代码结构说明。
48
+ - 用 `display_mermaid` 展示 Mermaid 图源码。
49
+ - 用 `display_ascii` 展示 ASCII 图。
50
+ - 用普通 pipeline 节点作为上下文节点时,保持 `instances` 结构与 flow.yaml instance 一致,但它只属于 workspace graph。
51
+ - 每个新增 instance 必须有 `ui.nodePositions`。
52
+ - 展示节点建议写 `ui.nodeSizes`,避免内容区域过小。
53
+
54
+ ## 连接语义
55
+
56
+ 展示节点的输入:
57
+
58
+ - `input[0]` / `targetHandle: "input-0"`:node prev,用于连接上游上下文。
59
+ - `input[1]`:text content,展示内容。
60
+
61
+ 展示节点的输出:
62
+
63
+ - `output[0]` / `sourceHandle: "output-0"`:text content,可作为后续 agent 的上下文输入。
64
+
65
+ ## 输出要求
66
+
67
+ 当用户要求“生成/展示/放到 workspace 画布”时,直接编辑 `workspace.graph.json`。完成后简要说明新增或修改了哪些 workspace 节点。
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: agentflow-workspace-markdown
3
+ description: >-
4
+ AgentFlow Workspace Markdown 展示技能。用于把分析、总结、文档、代码结构说明
5
+ 生成 display_markdown 节点并写入 workspace.graph.json,作为后续 agent 上下文。
6
+ ---
7
+
8
+ # AgentFlow Workspace Markdown
9
+
10
+ 在 Workspace 视图中需要生成 Markdown 报告、说明文档、分析结果或总结卡片时使用本技能。
11
+
12
+ ## 生成节点
13
+
14
+ 新增或更新 `workspace.graph.json` 中的 `display_markdown` instance:
15
+
16
+ ```json
17
+ {
18
+ "definitionId": "display_markdown",
19
+ "label": "项目结构分析",
20
+ "body": "# 项目结构分析\n\n...",
21
+ "input": [
22
+ { "type": "node", "name": "prev", "value": "" },
23
+ { "type": "text", "name": "content", "value": "# 项目结构分析\n\n..." }
24
+ ],
25
+ "output": [
26
+ { "type": "text", "name": "content", "value": "# 项目结构分析\n\n..." }
27
+ ]
28
+ }
29
+ ```
30
+
31
+ `body`、`input.content.value`、`output.content.value` 使用同一份 Markdown 内容。
32
+
33
+ ## 内容规范
34
+
35
+ - 生成真正可展示的 Markdown,不要包在代码块里,除非用户要求展示原始 Markdown。
36
+ - 表格必须使用标准 Markdown 表格:表头、分隔行、数据行各自独立成行。
37
+ - Mermaid 内容不要放进 Markdown 节点;用 `display_mermaid`。
38
+ - ASCII 图不要放进 Markdown 节点;用 `display_ascii`。
39
+
40
+ ## 布局建议
41
+
42
+ - 默认宽度 760,高度 520。
43
+ - 多个 Markdown 节点按从左到右、从上到下排布。
44
+ - label 放短标题,正文放 body/content。