@fieldwangai/agentflow 0.1.85 → 0.1.87
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.
- package/README.md +21 -5
- package/README.zh-CN.md +21 -5
- package/bin/agentflow.mjs +1 -1
- package/bin/lib/agent-runners.mjs +589 -0
- package/bin/lib/auth.mjs +11 -1
- package/bin/lib/catalog-flows.mjs +2 -0
- package/bin/lib/composer-agent.mjs +163 -1
- package/bin/lib/composer-model-router.mjs +28 -3
- package/bin/lib/composer-planner.mjs +3 -1
- package/bin/lib/help.mjs +16 -14
- package/bin/lib/locales/en.json +5 -1
- package/bin/lib/locales/zh.json +5 -1
- package/bin/lib/main.mjs +5 -0
- package/bin/lib/mcp-server.mjs +328 -0
- package/bin/lib/model-config.mjs +32 -3
- package/bin/lib/model-lists.mjs +68 -3
- package/bin/lib/node-execute.mjs +22 -1
- package/bin/lib/ui-server.mjs +579 -17
- package/bin/pipeline/validate-flow.mjs +19 -11
- package/bin/pipeline/validate-for-ui.mjs +19 -11
- package/builtin/nodes/display_react_app.md +52 -0
- package/builtin/web-ui/dist/assets/index-BqOb-W89.css +1 -0
- package/builtin/web-ui/dist/assets/index-Cla8u37K.js +340 -0
- package/builtin/web-ui/dist/index.html +2 -2
- package/package.json +3 -2
- package/builtin/web-ui/dist/assets/index-Lb9rIMqs.js +0 -250
- package/builtin/web-ui/dist/assets/index-aqphFZlG.css +0 -1
|
@@ -113,18 +113,26 @@ function loadFlowYaml(flowDir) {
|
|
|
113
113
|
|
|
114
114
|
function loadModelLists(_workspaceRoot) {
|
|
115
115
|
const p = getModelListsAbs();
|
|
116
|
-
if (!fs.existsSync(p)) return { cursor: [], opencode: [] };
|
|
116
|
+
if (!fs.existsSync(p)) return { cursor: [], opencode: [], claudeCode: [], codex: [] };
|
|
117
117
|
try {
|
|
118
118
|
const data = JSON.parse(fs.readFileSync(p, "utf-8"));
|
|
119
119
|
return {
|
|
120
120
|
cursor: Array.isArray(data.cursor) ? data.cursor : [],
|
|
121
121
|
opencode: Array.isArray(data.opencode) ? data.opencode : [],
|
|
122
|
+
claudeCode: Array.isArray(data.claudeCode) ? data.claudeCode : [],
|
|
123
|
+
codex: Array.isArray(data.codex) ? data.codex : [],
|
|
122
124
|
};
|
|
123
125
|
} catch {
|
|
124
|
-
return { cursor: [], opencode: [] };
|
|
126
|
+
return { cursor: [], opencode: [], claudeCode: [], codex: [] };
|
|
125
127
|
}
|
|
126
128
|
}
|
|
127
129
|
|
|
130
|
+
function modelEntryId(entry) {
|
|
131
|
+
const t = String(entry || "").trim();
|
|
132
|
+
const first = t.split(/\s+-/)[0].trim();
|
|
133
|
+
return first || t;
|
|
134
|
+
}
|
|
135
|
+
|
|
128
136
|
function loadCustomRoleIds(_workspaceRoot) {
|
|
129
137
|
const agentsPath = getUserAgentsJsonAbs();
|
|
130
138
|
if (!fs.existsSync(agentsPath)) return new Set();
|
|
@@ -683,21 +691,21 @@ function computeValidation(loaded, workspaceRoot) {
|
|
|
683
691
|
}
|
|
684
692
|
|
|
685
693
|
const root = workspaceRoot ? path.resolve(workspaceRoot) : path.dirname(loaded._flowDir || ".");
|
|
686
|
-
const { cursor: cursorList, opencode: opencodeList } = loadModelLists(root);
|
|
687
|
-
const opencodeSet = new Set((opencodeList || []).map(
|
|
688
|
-
const
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
const first = t.split(/\s+-/)[0].trim();
|
|
692
|
-
return first || t;
|
|
693
|
-
})
|
|
694
|
-
);
|
|
694
|
+
const { cursor: cursorList, opencode: opencodeList, claudeCode: claudeCodeList, codex: codexList } = loadModelLists(root);
|
|
695
|
+
const opencodeSet = new Set((opencodeList || []).map(modelEntryId));
|
|
696
|
+
const claudeCodeSet = new Set((claudeCodeList || []).map(modelEntryId));
|
|
697
|
+
const codexSet = new Set((codexList || []).map(modelEntryId));
|
|
698
|
+
const cursorSet = new Set((cursorList || []).map(modelEntryId));
|
|
695
699
|
for (const n of nodes) {
|
|
696
700
|
const model = (instances[n.id] && instances[n.id].model != null) ? String(instances[n.id].model).trim() : "";
|
|
697
701
|
if (!model) continue;
|
|
698
702
|
let valid = false;
|
|
699
703
|
if (model.startsWith("opencode:")) {
|
|
700
704
|
valid = opencodeSet.has(model.slice(9).trim());
|
|
705
|
+
} else if (model.startsWith("claude-code:")) {
|
|
706
|
+
valid = claudeCodeSet.size === 0 || claudeCodeSet.has(model.slice(12).trim());
|
|
707
|
+
} else if (model.startsWith("codex:")) {
|
|
708
|
+
valid = codexSet.size === 0 || codexSet.has(model.slice(6).trim());
|
|
701
709
|
} else {
|
|
702
710
|
const cursorId = model.startsWith("cursor:") ? model.slice(7).trim() : model;
|
|
703
711
|
valid = cursorSet.has(cursorId) || (cursorList || []).some((c) => String(c).trim() === model || String(c).trim().startsWith(cursorId + " "));
|
|
@@ -91,18 +91,26 @@ function loadFlowYaml(flowDir) {
|
|
|
91
91
|
|
|
92
92
|
function loadModelLists(_workspaceRoot) {
|
|
93
93
|
const p = getModelListsAbs();
|
|
94
|
-
if (!fs.existsSync(p)) return { cursor: [], opencode: [] };
|
|
94
|
+
if (!fs.existsSync(p)) return { cursor: [], opencode: [], claudeCode: [], codex: [] };
|
|
95
95
|
try {
|
|
96
96
|
const data = JSON.parse(fs.readFileSync(p, "utf-8"));
|
|
97
97
|
return {
|
|
98
98
|
cursor: Array.isArray(data.cursor) ? data.cursor : [],
|
|
99
99
|
opencode: Array.isArray(data.opencode) ? data.opencode : [],
|
|
100
|
+
claudeCode: Array.isArray(data.claudeCode) ? data.claudeCode : [],
|
|
101
|
+
codex: Array.isArray(data.codex) ? data.codex : [],
|
|
100
102
|
};
|
|
101
103
|
} catch {
|
|
102
|
-
return { cursor: [], opencode: [] };
|
|
104
|
+
return { cursor: [], opencode: [], claudeCode: [], codex: [] };
|
|
103
105
|
}
|
|
104
106
|
}
|
|
105
107
|
|
|
108
|
+
function modelEntryId(entry) {
|
|
109
|
+
const t = String(entry || "").trim();
|
|
110
|
+
const first = t.split(/\s+-/)[0].trim();
|
|
111
|
+
return first || t;
|
|
112
|
+
}
|
|
113
|
+
|
|
106
114
|
/** ~/agentflow/agents.json 仅存用户角色,无 source 字段,取所有条目的 id */
|
|
107
115
|
function loadCustomRoleIds(_workspaceRoot) {
|
|
108
116
|
const agentsPath = getUserAgentsJsonAbs();
|
|
@@ -163,21 +171,21 @@ function computeValidation(flowDir, workspaceRoot) {
|
|
|
163
171
|
}
|
|
164
172
|
|
|
165
173
|
const root = workspaceRoot ? path.resolve(workspaceRoot) : flowDir;
|
|
166
|
-
const { cursor: cursorList, opencode: opencodeList } = loadModelLists(root);
|
|
167
|
-
const opencodeSet = new Set((opencodeList || []).map(
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
const first = t.split(/\s+-/)[0].trim();
|
|
172
|
-
return first || t;
|
|
173
|
-
})
|
|
174
|
-
);
|
|
174
|
+
const { cursor: cursorList, opencode: opencodeList, claudeCode: claudeCodeList, codex: codexList } = loadModelLists(root);
|
|
175
|
+
const opencodeSet = new Set((opencodeList || []).map(modelEntryId));
|
|
176
|
+
const claudeCodeSet = new Set((claudeCodeList || []).map(modelEntryId));
|
|
177
|
+
const codexSet = new Set((codexList || []).map(modelEntryId));
|
|
178
|
+
const cursorSet = new Set((cursorList || []).map(modelEntryId));
|
|
175
179
|
for (const n of nodes) {
|
|
176
180
|
const model = (instances[n.id] && instances[n.id].model != null) ? String(instances[n.id].model).trim() : "";
|
|
177
181
|
if (!model) continue;
|
|
178
182
|
let valid = false;
|
|
179
183
|
if (model.startsWith("opencode:")) {
|
|
180
184
|
valid = opencodeSet.has(model.slice(9).trim());
|
|
185
|
+
} else if (model.startsWith("claude-code:")) {
|
|
186
|
+
valid = claudeCodeSet.size === 0 || claudeCodeSet.has(model.slice(12).trim());
|
|
187
|
+
} else if (model.startsWith("codex:")) {
|
|
188
|
+
valid = codexSet.size === 0 || codexSet.has(model.slice(6).trim());
|
|
181
189
|
} else {
|
|
182
190
|
const cursorId = model.startsWith("cursor:") ? model.slice(7).trim() : model;
|
|
183
191
|
valid = cursorSet.has(cursorId) || (cursorList || []).some((c) => String(c).trim() === model || String(c).trim().startsWith(cursorId + " "));
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
# Built-in node: React App Display
|
|
3
|
+
description: Display a small React project in a sandboxed workspace iframe and pass the project JSON downstream
|
|
4
|
+
displayName: React App
|
|
5
|
+
input:
|
|
6
|
+
- type: node
|
|
7
|
+
name: prev
|
|
8
|
+
default: ""
|
|
9
|
+
- type: text
|
|
10
|
+
name: content
|
|
11
|
+
default: ""
|
|
12
|
+
required: true
|
|
13
|
+
showOnNode: true
|
|
14
|
+
- type: file
|
|
15
|
+
name: filePath
|
|
16
|
+
default: ""
|
|
17
|
+
showOnNode: false
|
|
18
|
+
- type: text
|
|
19
|
+
name: workspaceContext
|
|
20
|
+
default: ""
|
|
21
|
+
showOnNode: false
|
|
22
|
+
output:
|
|
23
|
+
- type: text
|
|
24
|
+
name: content
|
|
25
|
+
default: ""
|
|
26
|
+
showOnNode: true
|
|
27
|
+
- type: node
|
|
28
|
+
name: next
|
|
29
|
+
default: ""
|
|
30
|
+
---
|
|
31
|
+
{
|
|
32
|
+
"title": "React App",
|
|
33
|
+
"entry": "src/App.jsx",
|
|
34
|
+
"packageJson": {
|
|
35
|
+
"scripts": {
|
|
36
|
+
"dev": "vite --host 0.0.0.0",
|
|
37
|
+
"build": "vite build"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@vitejs/plugin-react": "latest",
|
|
41
|
+
"vite": "latest",
|
|
42
|
+
"react": "latest",
|
|
43
|
+
"react-dom": "latest"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {}
|
|
46
|
+
},
|
|
47
|
+
"files": {
|
|
48
|
+
"src/App.jsx": "export default function App() {\\n return (\\n <main>\\n <h1>React App</h1>\\n <p>Ask an Agent to replace this with a React project.</p>\\n </main>\\n );\\n}\\n",
|
|
49
|
+
"src/styles.css": "body { margin: 0; background: #111112; color: #f4f0ff; font-family: Inter, system-ui, sans-serif; }\\nmain { min-height: 100vh; padding: 24px; }\\nh1 { margin: 0 0 8px; font-size: 28px; }\\np { margin: 0; color: rgba(244, 240, 255, 0.68); }\\n"
|
|
50
|
+
},
|
|
51
|
+
"inputs": {}
|
|
52
|
+
}
|