@fieldwangai/agentflow 0.1.25

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 (138) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +201 -0
  3. package/README.zh-CN.md +201 -0
  4. package/agents/agentflow-node-executor-code.md +32 -0
  5. package/agents/agentflow-node-executor-planning.md +32 -0
  6. package/agents/agentflow-node-executor-requirement.md +32 -0
  7. package/agents/agentflow-node-executor-test.md +32 -0
  8. package/agents/agentflow-node-executor-ui.md +32 -0
  9. package/agents/agentflow-node-executor.md +32 -0
  10. package/agents/agents.json +8 -0
  11. package/agents/en/agentflow-node-executor.md +32 -0
  12. package/agents/zh/agentflow-node-executor.md +32 -0
  13. package/bin/agentflow.mjs +52 -0
  14. package/bin/ensure-workspace-reference.mjs +35 -0
  15. package/bin/lib/agent-runners.mjs +1199 -0
  16. package/bin/lib/agents-path.mjs +61 -0
  17. package/bin/lib/api-runner.mjs +361 -0
  18. package/bin/lib/apply.mjs +852 -0
  19. package/bin/lib/catalog-agents.mjs +300 -0
  20. package/bin/lib/catalog-flows.mjs +532 -0
  21. package/bin/lib/composer-agent.mjs +884 -0
  22. package/bin/lib/composer-flow-instances.mjs +68 -0
  23. package/bin/lib/composer-flow-skeleton.mjs +334 -0
  24. package/bin/lib/composer-flow-validate.mjs +47 -0
  25. package/bin/lib/composer-log.mjs +197 -0
  26. package/bin/lib/composer-model-router.mjs +160 -0
  27. package/bin/lib/composer-node-schema.mjs +299 -0
  28. package/bin/lib/composer-planner.mjs +749 -0
  29. package/bin/lib/composer-script-ops.mjs +233 -0
  30. package/bin/lib/composer-skill-router.mjs +384 -0
  31. package/bin/lib/flow-import.mjs +305 -0
  32. package/bin/lib/flow-normalize.mjs +71 -0
  33. package/bin/lib/flow-write.mjs +395 -0
  34. package/bin/lib/help.mjs +139 -0
  35. package/bin/lib/hub-login.mjs +54 -0
  36. package/bin/lib/hub-publish.mjs +159 -0
  37. package/bin/lib/hub-remote.mjs +189 -0
  38. package/bin/lib/hub.mjs +299 -0
  39. package/bin/lib/i18n.mjs +233 -0
  40. package/bin/lib/locales/en.json +344 -0
  41. package/bin/lib/locales/zh.json +344 -0
  42. package/bin/lib/log.mjs +37 -0
  43. package/bin/lib/main.mjs +611 -0
  44. package/bin/lib/model-config.mjs +118 -0
  45. package/bin/lib/model-lists.mjs +188 -0
  46. package/bin/lib/node-exec-context.mjs +336 -0
  47. package/bin/lib/node-execute.mjs +513 -0
  48. package/bin/lib/normalize-node-tool-command.mjs +97 -0
  49. package/bin/lib/paths.mjs +216 -0
  50. package/bin/lib/pipeline-scripts.mjs +41 -0
  51. package/bin/lib/recent-runs.mjs +173 -0
  52. package/bin/lib/run-apply-active-lock.mjs +82 -0
  53. package/bin/lib/run-events.mjs +85 -0
  54. package/bin/lib/run-node-statuses-from-disk.mjs +85 -0
  55. package/bin/lib/schedule-config.mjs +227 -0
  56. package/bin/lib/scheduler.mjs +312 -0
  57. package/bin/lib/table.mjs +4 -0
  58. package/bin/lib/terminal.mjs +42 -0
  59. package/bin/lib/ui-print.mjs +94 -0
  60. package/bin/lib/ui-server.mjs +2113 -0
  61. package/bin/lib/workspace-tree.mjs +266 -0
  62. package/bin/lib/workspace.mjs +180 -0
  63. package/bin/pipeline/build-node-prompt.mjs +179 -0
  64. package/bin/pipeline/check-cache.mjs +191 -0
  65. package/bin/pipeline/check-flow.mjs +543 -0
  66. package/bin/pipeline/collect-nodes.mjs +212 -0
  67. package/bin/pipeline/compute-cache-md5.mjs +177 -0
  68. package/bin/pipeline/ensure-run-dir.mjs +71 -0
  69. package/bin/pipeline/extract-thinking.mjs +308 -0
  70. package/bin/pipeline/gc.mjs +129 -0
  71. package/bin/pipeline/get-env.mjs +83 -0
  72. package/bin/pipeline/get-exec-id.mjs +145 -0
  73. package/bin/pipeline/get-ready-nodes.mjs +435 -0
  74. package/bin/pipeline/get-resolved-values.mjs +337 -0
  75. package/bin/pipeline/load-key.mjs +62 -0
  76. package/bin/pipeline/parse-bool.mjs +33 -0
  77. package/bin/pipeline/parse-flow.mjs +698 -0
  78. package/bin/pipeline/post-process-control-if.mjs +23 -0
  79. package/bin/pipeline/post-process-node.mjs +490 -0
  80. package/bin/pipeline/pre-process-node.mjs +449 -0
  81. package/bin/pipeline/resolve-inputs.mjs +201 -0
  82. package/bin/pipeline/run-log.mjs +34 -0
  83. package/bin/pipeline/run-tool-nodejs.mjs +160 -0
  84. package/bin/pipeline/save-key.mjs +93 -0
  85. package/bin/pipeline/snapshot-prior-round.mjs +70 -0
  86. package/bin/pipeline/validate-flow.mjs +825 -0
  87. package/bin/pipeline/validate-for-ui.mjs +226 -0
  88. package/bin/pipeline/validate-script-output.mjs +130 -0
  89. package/bin/pipeline/write-result.mjs +182 -0
  90. package/builtin/nodes/agent_subAgent.md +14 -0
  91. package/builtin/nodes/control_agent_toBool.md +20 -0
  92. package/builtin/nodes/control_anyOne.md +17 -0
  93. package/builtin/nodes/control_end.md +11 -0
  94. package/builtin/nodes/control_if.md +20 -0
  95. package/builtin/nodes/control_start.md +11 -0
  96. package/builtin/nodes/control_toBool.md +21 -0
  97. package/builtin/nodes/provide_file.md +11 -0
  98. package/builtin/nodes/provide_str.md +11 -0
  99. package/builtin/nodes/tool_get_env.md +14 -0
  100. package/builtin/nodes/tool_load_key.md +20 -0
  101. package/builtin/nodes/tool_nodejs.md +40 -0
  102. package/builtin/nodes/tool_print.md +14 -0
  103. package/builtin/nodes/tool_save_key.md +20 -0
  104. package/builtin/nodes/tool_user_ask.md +23 -0
  105. package/builtin/nodes/tool_user_check.md +22 -0
  106. package/builtin/pipelines/module-migrate/flow.yaml +819 -0
  107. package/builtin/pipelines/module-migrate/scripts/check_imports.mjs +700 -0
  108. package/builtin/pipelines/module-migrate/scripts/node_modules/tree-sitter-kotlin/build/Makefile +362 -0
  109. package/builtin/pipelines/module-migrate/scripts/node_modules/tree-sitter-kotlin/build/Release/.deps/Release/obj.target/node_modules/node-addon-api/node_addon_api_except.stamp.d +1 -0
  110. package/builtin/pipelines/module-migrate/scripts/node_modules/tree-sitter-kotlin/build/Release/.deps/Release/obj.target/tree_sitter_kotlin_binding/bindings/node/binding.o.d +17 -0
  111. package/builtin/pipelines/module-migrate/scripts/node_modules/tree-sitter-kotlin/build/Release/.deps/Release/obj.target/tree_sitter_kotlin_binding/src/parser.o.d +5 -0
  112. package/builtin/pipelines/module-migrate/scripts/node_modules/tree-sitter-kotlin/build/Release/.deps/Release/obj.target/tree_sitter_kotlin_binding/src/scanner.o.d +8 -0
  113. package/builtin/pipelines/module-migrate/scripts/node_modules/tree-sitter-kotlin/build/Release/.deps/Release/tree_sitter_kotlin_binding.node.d +1 -0
  114. package/builtin/pipelines/module-migrate/scripts/node_modules/tree-sitter-kotlin/build/Release/obj.target/node_modules/node-addon-api/node_addon_api_except.stamp +0 -0
  115. package/builtin/pipelines/module-migrate/scripts/node_modules/tree-sitter-kotlin/build/Release/obj.target/tree_sitter_kotlin_binding/bindings/node/binding.o +0 -0
  116. package/builtin/pipelines/module-migrate/scripts/node_modules/tree-sitter-kotlin/build/Release/obj.target/tree_sitter_kotlin_binding/src/parser.o +0 -0
  117. package/builtin/pipelines/module-migrate/scripts/node_modules/tree-sitter-kotlin/build/Release/obj.target/tree_sitter_kotlin_binding/src/scanner.o +0 -0
  118. package/builtin/pipelines/module-migrate/scripts/node_modules/tree-sitter-kotlin/build/Release/tree_sitter_kotlin_binding.node +0 -0
  119. package/builtin/pipelines/module-migrate/scripts/node_modules/tree-sitter-kotlin/build/binding.Makefile +6 -0
  120. package/builtin/pipelines/module-migrate/scripts/node_modules/tree-sitter-kotlin/build/gyp-mac-tool +768 -0
  121. package/builtin/pipelines/module-migrate/scripts/node_modules/tree-sitter-kotlin/build/node_modules/node-addon-api/node_addon_api.Makefile +6 -0
  122. package/builtin/pipelines/module-migrate/scripts/node_modules/tree-sitter-kotlin/build/node_modules/node-addon-api/node_addon_api.target.mk +122 -0
  123. package/builtin/pipelines/module-migrate/scripts/node_modules/tree-sitter-kotlin/build/node_modules/node-addon-api/node_addon_api_except.target.mk +126 -0
  124. package/builtin/pipelines/module-migrate/scripts/node_modules/tree-sitter-kotlin/build/node_modules/node-addon-api/node_addon_api_maybe.target.mk +122 -0
  125. package/builtin/pipelines/module-migrate/scripts/node_modules/tree-sitter-kotlin/build/tree_sitter_kotlin_binding.target.mk +203 -0
  126. package/builtin/pipelines/new/flow.yaml +545 -0
  127. package/builtin/pipelines/new/scripts/check-flow.mjs +9 -0
  128. package/builtin/pipelines/new/scripts/collect-nodes.mjs +211 -0
  129. package/builtin/pipelines/scripts/adjust-node-positions.mjs +113 -0
  130. package/builtin/web-ui/dist/agentflow-icon.svg +23 -0
  131. package/builtin/web-ui/dist/assets/index-CZkUPcXE.css +1 -0
  132. package/builtin/web-ui/dist/assets/index-DkkhNESc.js +190 -0
  133. package/builtin/web-ui/dist/index.html +24 -0
  134. package/package.json +67 -0
  135. package/reference/flow-control-capabilities.md +274 -0
  136. package/reference/flow-layout.md +84 -0
  137. package/reference/flow-prompt-handler-check.md +12 -0
  138. package/reference/flow-result-semantics.md +14 -0
@@ -0,0 +1,233 @@
1
+ /**
2
+ * AgentFlow CLI i18n 模块
3
+ * 支持通过 LANG 环境变量或 --lang 参数切换语言
4
+ */
5
+
6
+ import { readFileSync } from "fs";
7
+ import { fileURLToPath } from "url";
8
+ import path from "path";
9
+
10
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
11
+
12
+ /** 支持的语言列表 */
13
+ export const SUPPORTED_LANGUAGES = ["en", "zh"];
14
+
15
+ /**
16
+ * 检测系统语言
17
+ * - 优先使用 LANG/LANGUAGE 环境变量
18
+ * - macOS/Linux: process.env.LANG (如 zh_CN.UTF-8)
19
+ * - Windows: process.env.LANGUAGE 或 LC_ALL
20
+ * @returns {string}
21
+ */
22
+ function detectSystemLanguage() {
23
+ const envLang = process.env.LANG || process.env.LANGUAGE || process.env.LC_ALL || "";
24
+ // 处理形如 zh_CN.UTF-8、en_US.UTF-8 的格式
25
+ const langCode = envLang.split(".")[0].split("_")[0].toLowerCase();
26
+ // 默认使用英文,仅在检测到中文时使用中文
27
+ if (langCode === "zh") return "zh";
28
+ if (SUPPORTED_LANGUAGES.includes(langCode)) return langCode;
29
+ return "en";
30
+ }
31
+
32
+ /** 默认语言(跟随系统) */
33
+ export const DEFAULT_LANGUAGE = detectSystemLanguage();
34
+
35
+ /** 当前语言 */
36
+ let currentLang = DEFAULT_LANGUAGE;
37
+
38
+ /** 已加载的语言包缓存 */
39
+ const localeCache = new Map();
40
+
41
+ /**
42
+ * 从环境变量解析语言(兼容旧 API)
43
+ * @returns {string}
44
+ */
45
+ function detectLanguageFromEnv() {
46
+ return detectSystemLanguage();
47
+ }
48
+
49
+ /**
50
+ * 初始化 i18n
51
+ * @param {string} [lang] - 指定语言,如不提供则使用环境变量检测
52
+ */
53
+ export function initI18n(lang) {
54
+ currentLang = lang || detectLanguageFromEnv();
55
+ if (!SUPPORTED_LANGUAGES.includes(currentLang)) {
56
+ currentLang = DEFAULT_LANGUAGE;
57
+ }
58
+ // 清空缓存以重新加载
59
+ localeCache.clear();
60
+ }
61
+
62
+ /**
63
+ * 设置当前语言
64
+ * @param {string} lang
65
+ */
66
+ export function setLanguage(lang) {
67
+ if (SUPPORTED_LANGUAGES.includes(lang)) {
68
+ currentLang = lang;
69
+ localeCache.clear();
70
+ }
71
+ }
72
+
73
+ /**
74
+ * 获取当前语言
75
+ * @returns {string}
76
+ */
77
+ export function getLanguage() {
78
+ return currentLang;
79
+ }
80
+
81
+ /**
82
+ * 加载语言包
83
+ * @param {string} lang
84
+ * @returns {object}
85
+ */
86
+ function loadLocale(lang) {
87
+ if (localeCache.has(lang)) {
88
+ return localeCache.get(lang);
89
+ }
90
+
91
+ try {
92
+ const filePath = path.join(__dirname, "locales", `${lang}.json`);
93
+ const content = readFileSync(filePath, "utf-8");
94
+ const locale = JSON.parse(content);
95
+ localeCache.set(lang, locale);
96
+ return locale;
97
+ } catch (err) {
98
+ // 如果加载失败,返回空对象(会使用回退逻辑)
99
+ return {};
100
+ }
101
+ }
102
+
103
+ /**
104
+ * 获取翻译文本
105
+ * @param {string} key - 键名,支持嵌套如 "flow.not_found"
106
+ * @param {object} [vars] - 插值变量
107
+ * @returns {string}
108
+ */
109
+ export function t(key, vars = {}) {
110
+ const locale = loadLocale(currentLang);
111
+ const fallbackLocale = loadLocale(DEFAULT_LANGUAGE);
112
+
113
+ // 解析嵌套键
114
+ const keys = key.split(".");
115
+ let value = locale;
116
+ let fallbackValue = fallbackLocale;
117
+
118
+ for (const k of keys) {
119
+ value = value?.[k];
120
+ fallbackValue = fallbackValue?.[k];
121
+ }
122
+
123
+ // 如果没有找到翻译,使用回退语言或键名
124
+ let text = value || fallbackValue || key;
125
+
126
+ // 处理插值 {{varName}}
127
+ if (vars && typeof text === "string") {
128
+ text = text.replace(/\{\{(\w+)\}\}/g, (match, varName) => {
129
+ return vars[varName] !== undefined ? String(vars[varName]) : match;
130
+ });
131
+ }
132
+
133
+ return text;
134
+ }
135
+
136
+ /**
137
+ * 批量翻译多个键
138
+ * @param {string[]} keys
139
+ * @returns {object}
140
+ */
141
+ export function tBatch(keys) {
142
+ const result = {};
143
+ for (const key of keys) {
144
+ result[key] = t(key);
145
+ }
146
+ return result;
147
+ }
148
+
149
+ // 初始化(使用环境变量检测)
150
+ initI18n();
151
+
152
+ /** 中文 type 到英文 key 的映射 */
153
+ export const TYPE_ZH_TO_KEY = {
154
+ 节点: "node",
155
+ 文本: "text",
156
+ 文件: "file",
157
+ bool: "bool",
158
+ 布尔: "bool",
159
+ };
160
+
161
+ /** 英文 key 到中文 type 的映射 */
162
+ export const TYPE_KEY_TO_ZH = {
163
+ node: "节点",
164
+ text: "文本",
165
+ file: "文件",
166
+ bool: "布尔",
167
+ };
168
+
169
+ /** 中文 role 到英文 key 的映射 */
170
+ export const ROLE_ZH_TO_KEY = {
171
+ 普通: "normal",
172
+ 技术规划: "planning",
173
+ 代码执行: "code",
174
+ 测试回归: "test",
175
+ 需求拆解: "requirement",
176
+ };
177
+
178
+ /** 英文 key 到中文 role 的映射 */
179
+ export const ROLE_KEY_TO_ZH = {
180
+ normal: "普通",
181
+ planning: "技术规划",
182
+ code: "代码执行",
183
+ test: "测试回归",
184
+ requirement: "需求拆解",
185
+ };
186
+
187
+ /**
188
+ * 翻译类型名称(支持中英文互转)
189
+ * @param {string} typeOrKey - 中文类型名或英文 key
190
+ * @returns {string} 当前语言对应的类型名
191
+ */
192
+ export function translateType(typeOrKey) {
193
+ const key = TYPE_ZH_TO_KEY[typeOrKey] || typeOrKey;
194
+ return t(`type.${key}`);
195
+ }
196
+
197
+ /**
198
+ * 翻译角色名称(支持中英文互转)
199
+ * @param {string} roleOrKey - 中文角色名或英文 key
200
+ * @returns {string} 当前语言对应的角色名
201
+ */
202
+ export function translateRole(roleOrKey) {
203
+ const key = ROLE_ZH_TO_KEY[roleOrKey] || roleOrKey;
204
+ return t(`role.${key}`);
205
+ }
206
+
207
+ /**
208
+ * 获取类型的英文 key(用于内部存储)
209
+ * @param {string} typeOrKey - 中文类型名或英文 key
210
+ * @returns {string} 英文 key
211
+ */
212
+ export function normalizeTypeToKey(typeOrKey) {
213
+ return TYPE_ZH_TO_KEY[typeOrKey] || typeOrKey;
214
+ }
215
+
216
+ /**
217
+ * 获取角色的英文 key(用于内部存储)
218
+ * @param {string} roleOrKey - 中文角色名或英文 key
219
+ * @returns {string} 英文 key
220
+ */
221
+ export function normalizeRoleToKey(roleOrKey) {
222
+ return ROLE_ZH_TO_KEY[roleOrKey] || roleOrKey;
223
+ }
224
+
225
+ /**
226
+ * 翻译节点定义字段
227
+ * @param {string} definitionId - 节点定义 ID
228
+ * @param {"displayName" | "description"} field - 字段名
229
+ * @returns {string}
230
+ */
231
+ export function translateNodeDef(definitionId, field) {
232
+ return t(`nodeDef.${definitionId}.${field}`);
233
+ }
@@ -0,0 +1,344 @@
1
+ {
2
+ "meta": {
3
+ "name": "English",
4
+ "code": "en"
5
+ },
6
+ "common": {
7
+ "loading": "Loading...",
8
+ "error": "Error",
9
+ "success": "Success",
10
+ "warning": "Warning",
11
+ "info": "Info",
12
+ "done": "Done",
13
+ "cancel": "Cancel",
14
+ "confirm": "Confirm",
15
+ "yes": "Yes",
16
+ "no": "No",
17
+ "save": "Save",
18
+ "delete": "Delete",
19
+ "edit": "Edit",
20
+ "create": "Create",
21
+ "close": "Close",
22
+ "back": "Back",
23
+ "next": "Next",
24
+ "prev": "Previous",
25
+ "search": "Search",
26
+ "filter": "Filter",
27
+ "refresh": "Refresh",
28
+ "copy": "Copy",
29
+ "copied": "Copied",
30
+ "not_found": "Not found",
31
+ "required": "Required",
32
+ "optional": "Optional",
33
+ "total": "Total",
34
+ "local": "Local",
35
+ "default": "Default"
36
+ },
37
+ "cli": {
38
+ "description": "AgentFlow CLI — drive apply/replay with Cursor or OpenCode CLI streaming",
39
+ "usage": "Usage",
40
+ "commands": "Commands",
41
+ "options": "Options",
42
+ "requires": "Requires",
43
+ "examples": "Examples"
44
+ },
45
+ "flow": {
46
+ "name": "Flow",
47
+ "list": "List all pipelines",
48
+ "apply": "Apply flow",
49
+ "replay": "Replay node",
50
+ "resume": "Resume flow",
51
+ "validate": "Validate flow",
52
+ "not_found": "Flow not found: {{name}}",
53
+ "invalid": "Invalid flow",
54
+ "running": "Flow is running",
55
+ "completed": "Flow completed",
56
+ "failed": "Flow failed",
57
+ "pending": "Flow pending",
58
+ "ready_nodes": "Ready nodes",
59
+ "no_ready_nodes": "No ready nodes",
60
+ "node_start": "Starting node: {{label}} ({{instanceId}})",
61
+ "node_done": "Node completed: {{label}} ({{instanceId}})",
62
+ "node_failed": "Node failed: {{label}} ({{instanceId}}) - {{error}}",
63
+ "extract_thinking": "Extract thinking content",
64
+ "dry_run_nodes": "[--dry-run] Would execute nodes: {{nodes}}. Omit --dry-run to run.",
65
+ "stuck_error": "No ready nodes and not all done; flow may be stuck.",
66
+ "paused": "Paused",
67
+ "resume_hint": "To resume, run:"
68
+ },
69
+ "node": {
70
+ "name": "Node",
71
+ "status": {
72
+ "success": "Success",
73
+ "failed": "Failed",
74
+ "pending": "Pending",
75
+ "running": "Running",
76
+ "skipped": "Skipped"
77
+ },
78
+ "types": {
79
+ "agent": "Agent Node",
80
+ "control": "Control Node",
81
+ "tool": "Tool Node"
82
+ },
83
+ "start": "[START] Node",
84
+ "end": "[END] Node",
85
+ "start_parallel": "[START] Parallel execution",
86
+ "end_parallel": "[END] All parallel nodes completed",
87
+ "model_label": "Model",
88
+ "done_label": "Done",
89
+ "failed_label": "Failed"
90
+ },
91
+ "apply": {
92
+ "done": "Apply done",
93
+ "paused": "Paused",
94
+ "stuck": "Flow may be stuck",
95
+ "resume_command": "To resume, run:",
96
+ "user_confirmed": "User confirmed to continue (including retry failed)"
97
+ },
98
+ "catalog": {
99
+ "builtin_agent_not_found": "Built-in agent not found",
100
+ "name_already_exists": "Name already exists, please choose another",
101
+ "agent_not_found": "Agent not found",
102
+ "invalid_agent_id": "Invalid agent id (needs to be filename-safe)",
103
+ "builtin_flow_not_found": "Built-in flow not found",
104
+ "builtin_flow_archive_not_supported": "Built-in pipelines do not support archive view",
105
+ "builtin_flow_archive_path_not_supported": "Built-in pipelines do not support archive path",
106
+ "type_text": "Text",
107
+ "pipeline_header": "Pipeline",
108
+ "source_header": "Source",
109
+ "apply_example_header": "Apply Example"
110
+ },
111
+ "composer": {
112
+ "edit_context": "## AgentFlow Edit Context",
113
+ "tool_nodejs_rules_title": "## tool_nodejs Node Writing Rules (Must Follow)",
114
+ "tool_nodejs_rules_body": "The core of `definitionId: tool_nodejs` is the **`script` field**—must write a complete executable shell/node command.\n- `script`: Pipeline spawns directly, stdout becomes result, exit code determines success/failure\n- `body`: When `script` exists, it serves only as human-readable comment, **will NOT be executed**\n- `script` supports `${}` placeholders referencing input slots and system variables (workspaceRoot, runDir, etc.), values are auto shell-quoted\n- **Do NOT** wrap `${workspaceRoot}` etc. with extra double quotes (e.g., `node \"${workspaceRoot}/...\"`); write `node ${workspaceRoot}/...` instead, otherwise path will contain extra quotes causing execution failure\n- **Forbidden** to only write natural language description in `body` without `script`—this leads to no executable code at runtime\n- If logic is too complex to write complete `script`, use `agent_subAgent` instead (also change definitionId)",
115
+ "task_title": "## Task",
116
+ "task_instruction": "Please complete only the above single task, no extra modifications. After completion, sync UI per context instructions.",
117
+ "validation_passed": "flow validation passed",
118
+ "validation_passed_detail": "✓ flow.yaml validation passed (validate-flow)",
119
+ "validation_failed": "flow validation failed, attempting auto-fix...",
120
+ "fix_task_title": "## Task: Fix flow.yaml to pass validate-flow",
121
+ "fix_errors_intro": "The following errors must be **all eliminated** (same rules as CLI `agentflow validate` / `validate-flow.mjs`):",
122
+ "fix_constraints_title": "### Constraints",
123
+ "fix_constraints_body": "- **Only** edit the \"flow definition file\" `flow.yaml` in context, do not modify unrelated files.\n- Prefer minimal changes: add edges, fix sourceHandle/targetHandle, role, model, instance structure, etc.",
124
+ "analyzing_task": "Analyzing task…",
125
+ "validation_repair": "Validation repair: agent attempt {{attempt}}/{{max}}…",
126
+ "validation_repair_start": "🔧 Starting validation repair ({{attempt}}/{{max}})…",
127
+ "validation_repair_auto_success": "(auto-repair succeeded)",
128
+ "skip_validation_for_phase": "Skipping validation for current phase (will validate at final phase)",
129
+ "all_phases_complete": "All phases complete",
130
+ "phase_complete_waiting": "{{label}} complete, waiting for confirmation…",
131
+ "current_phase": "Phase {{index}}",
132
+ "all_steps_complete": "All steps complete",
133
+ "multi_step_failed": "Multi-step execution failed: {{message}}",
134
+ "multi_step_starting": "Multi-step mode starting…",
135
+ "classify_failed": "[CLASSIFY_FAIL] Task classification failed: {{message}}"
136
+ },
137
+ "runner": {
138
+ "cursor_account_limit": "[agentflow] Cursor account limit: detected Auto-only support, auto-retrying once (Auto)...",
139
+ "generating_reply": "Generating reply...",
140
+ "thinking": "Thinking...",
141
+ "completed": "Completed",
142
+ "execution_failed": "Execution failed",
143
+ "event_label": "Event",
144
+ "tool_call": "Tool call ({{subtype}})",
145
+ "base64_data": "[cursor-stdout] (base64 data, {{len}} chars)",
146
+ "non_json_line": "(non-JSON) {{preview}}",
147
+ "unparsed_line": "(unparsed line, {{len}} chars)",
148
+ "opencode_exit_code": "OpenCode exit code {{code}}",
149
+ "done": "Done"
150
+ },
151
+ "tool": {
152
+ "nodejs_script_hint": "script success/failure determined by exit code (0=success), stdout directly becomes result slot content (plain text, e.g., console.log).",
153
+ "nodejs_heal_retry": "[tool_nodejs self-heal] {{instanceId}} retry {{attempt}}/{{maxRetries}}: {{detail}}"
154
+ },
155
+ "planner": {
156
+ "heuristic_analysis": "Heuristic task analysis (configure OPENAI_API_KEY or ANTHROPIC_API_KEY to enable smart planning)",
157
+ "planning": "Planning task ({{model}})…",
158
+ "planner_format_error": "Planner returned unexpected format, falling back to single-step",
159
+ "planner_call_failed": "Planner call failed ({{message}}), falling back to heuristic analysis",
160
+ "phased_planning": "Phased planning: {{label}} ({{index}}/{{total}})…",
161
+ "phased_cli_exec": "Phased: {{label}} (CLI execution)",
162
+ "phased_format_error": "Phased planner returned unexpected format, using default agent step",
163
+ "phased_planning_failed": "Phased planning failed ({{message}}), using default agent step"
164
+ },
165
+ "api": {
166
+ "node_context_marker": "## Node Context",
167
+ "task_marker": "## Execution Task"
168
+ },
169
+ "ui": {
170
+ "server_start": "UI server started",
171
+ "server_listening": "Server listening on port {{port}}",
172
+ "open_browser": "Open browser",
173
+ "projects": "Projects & Pipelines",
174
+ "flow_editor": "Flow Editor",
175
+ "settings": "Settings"
176
+ },
177
+ "error": {
178
+ "generic": "Error occurred: {{message}}",
179
+ "file_not_found": "File not found: {{path}}",
180
+ "invalid_args": "Invalid arguments",
181
+ "missing_required": "Missing required field: {{field}}",
182
+ "exec_failed": "Execution failed: {{command}}",
183
+ "network_error": "Network error",
184
+ "permission_denied": "Permission denied",
185
+ "read_flow_failed": "Failed to read flow",
186
+ "read_node_library_failed": "Failed to read node library",
187
+ "save_failed": "Save failed",
188
+ "move_failed": "Move failed"
189
+ },
190
+ "env": {
191
+ "cursor_not_cached": "Not cached",
192
+ "cursor_cached": "Model list cached",
193
+ "opencode_not_found": "Not found",
194
+ "opencode_ready": "Ready",
195
+ "service_normal": "Service normal",
196
+ "service_abnormal": "Some interfaces abnormal"
197
+ },
198
+ "type": {
199
+ "node": "Node",
200
+ "text": "Text",
201
+ "file": "File",
202
+ "bool": "Boolean"
203
+ },
204
+ "role": {
205
+ "normal": "Normal",
206
+ "planning": "Planning",
207
+ "code": "Code",
208
+ "test": "Test",
209
+ "requirement": "Requirement"
210
+ },
211
+ "nodeDef": {
212
+ "control_start": {
213
+ "displayName": "Start",
214
+ "description": "Entry point of AgentFlow, all flows should start from this node"
215
+ },
216
+ "control_end": {
217
+ "displayName": "End",
218
+ "description": "End point of AgentFlow, flow terminates after this node"
219
+ },
220
+ "agent_subAgent": {
221
+ "displayName": "SubAgent",
222
+ "description": "Execute tasks using SubAgent"
223
+ },
224
+ "tool_user_ask": {
225
+ "displayName": "UserAsk",
226
+ "description": "Pause and wait for the user to pick one of N branches. Each output slot is an option; the slot description is the option label (human-driven switch)."
227
+ },
228
+ "tool_user_check": {
229
+ "displayName": "User Confirm",
230
+ "description": "Wait for user confirmation, flow pauses. Requires user to reply 'continue' to resume"
231
+ },
232
+ "control_if": {
233
+ "displayName": "If Branch",
234
+ "description": "Has exactly one bool type input. Continues to next1 if true, next2 if false"
235
+ },
236
+ "control_anyOne": {
237
+ "displayName": "Any One",
238
+ "description": "Continues to next when any upstream input is ready"
239
+ },
240
+ "control_toBool": {
241
+ "displayName": "To Bool",
242
+ "description": "Execute script to produce true/false prediction. Like tool_nodejs but enforces bool output. Extensible inputs."
243
+ },
244
+ "control_agent_toBool": {
245
+ "displayName": "Agent ToBool",
246
+ "description": "AI-powered boolean judgment for non-deterministic scenarios"
247
+ },
248
+ "tool_nodejs": {
249
+ "displayName": "Node.js Script",
250
+ "description": "Execute Node.js script, success determined by exit code, stdout as result"
251
+ },
252
+ "tool_print": {
253
+ "displayName": "Print",
254
+ "description": "Output content to user with special font style"
255
+ },
256
+ "tool_get_env": {
257
+ "displayName": "Get Env",
258
+ "description": "Get environment variable value"
259
+ },
260
+ "tool_save_key": {
261
+ "displayName": "Save Key",
262
+ "description": "Save key-value pair to global storage"
263
+ },
264
+ "tool_load_key": {
265
+ "displayName": "Load Key",
266
+ "description": "Load key-value from global storage"
267
+ },
268
+ "provide_str": {
269
+ "displayName": "Text",
270
+ "description": "Provide a text value directly, value will be passed to downstream as-is"
271
+ },
272
+ "provide_file": {
273
+ "displayName": "File",
274
+ "description": "Provide file path or content directly, value will be passed to downstream as-is"
275
+ }
276
+ },
277
+ "pipeline": {
278
+ "module-migrate": {
279
+ "description": "Module migration pipeline (Define scope -> Confirm -> Migrate -> Static loop -> Compile loop -> Output document)",
280
+ "start": { "label": "Start", "body": "Flow entry" },
281
+ "scope": { "label": "Define Migration Scope" },
282
+ "user_confirm_scope": { "label": "User Confirm Scope" },
283
+ "migrate": { "label": "Execute Migration" },
284
+ "anyOne_static": { "label": "AnyOne (Static Loop Entry)" },
285
+ "anyOne_gradle": { "label": "AnyOne (Compile Loop Entry)" },
286
+ "ai_check_ref": { "label": "AI Check References" },
287
+ "agent_sum_error": { "label": "Summarize Issues" },
288
+ "gradle_build": { "label": "Gradle Build" },
289
+ "fix_dynamic": { "label": "Fix Build Issues" },
290
+ "output_doc": { "label": "Output Document" },
291
+ "end": { "label": "End", "body": "Flow exit" },
292
+ "provide_key_ready_file": { "label": "KeyReadyFile" },
293
+ "provide_key_module_name": { "label": "KeyModuleName" },
294
+ "tool_save_ready_file": { "label": "Ready Files List" },
295
+ "tool_save_module_name": { "label": "Module Name" },
296
+ "agent_new_module": { "label": "Create Module" },
297
+ "tool_static_analy": { "label": "Static Analysis" },
298
+ "if_static": { "label": "If Static Check" },
299
+ "LoadFile": { "label": "Migration File List" },
300
+ "agent_fix_todo": { "label": "Fix TODO Items" },
301
+ "control_toBool_static_bool": { "label": "Static Check Result Conversion" },
302
+ "control_if_task_gradle": { "label": "If Task Complete" },
303
+ "control_toBool_gradle_bool": { "label": "List Complete Result" },
304
+ "control_if_fixed": { "label": "If Fix Complete" },
305
+ "to_bool_fix_all": { "label": "Check If All Fixed" },
306
+ "control_anyOne_start_fix": { "label": "Fix Entry" },
307
+ "tool_print_module": { "label": "Print Summary" },
308
+ "gradle_tasks": { "label": "Get Java/Kotlin Build Tasks" }
309
+ },
310
+ "figma-restore": {
311
+ "description": "Figma design restoration pipeline",
312
+ "Start": { "label": "Start" },
313
+ "FigmaURL": { "label": "FigmaURL" },
314
+ "FigmaToken": { "label": "FigmaToken" },
315
+ "script_check": { "label": "Script Self Check" },
316
+ "get_figma_tree": { "label": "Get Figma Node Tree and Screenshots" },
317
+ "ai_semantic": { "label": "AI Semantic Analysis of Screenshot Structure" },
318
+ "restore_by_depth": { "label": "Restore by Tree Depth Traversal" },
319
+ "export_resources": { "label": "Export img/icon Resources" },
320
+ "summarize": { "label": "Summarize Delivery JSON" },
321
+ "End": { "label": "End" }
322
+ },
323
+ "new": {
324
+ "description": "New pipeline",
325
+ "control_start_new": { "label": "Start" },
326
+ "agent_plan": { "label": "Plan Nodes" },
327
+ "agent_create": { "label": "Create Flow" },
328
+ "control_end_new": { "label": "End" },
329
+ "provide_skills_file": { "label": "Layout Skills" },
330
+ "provide_requirement": { "label": "Requirements" },
331
+ "agent_fix": { "label": "Fix Nodes" },
332
+ "agent_implement_script": { "label": "Complete Code" },
333
+ "tool_user_check": { "label": "UserCheck" },
334
+ "control_anyOne": { "label": "AnyOne" },
335
+ "provide_flow": { "label": "Flows Skills" },
336
+ "provide_newFlow_key_save": { "label": "Flow Key Name" },
337
+ "provide_newFlow_key_load": { "label": "Flow Key Name" },
338
+ "agent_ai_check_tool": { "label": "AI Check Tools" },
339
+ "AI_CHECK_FILE": { "label": "AI Check Files" },
340
+ "control_if_check": { "label": "If Check" },
341
+ "control_toBool_check": { "label": "Check Result" }
342
+ }
343
+ }
344
+ }