@fieldwangai/agentflow 0.1.77 → 0.1.79
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/bin/lib/ui-server.mjs
CHANGED
|
@@ -4677,6 +4677,18 @@ async function runWorkspaceGraph(root, scopedRoot, payload, userCtx = {}, opts =
|
|
|
4677
4677
|
}
|
|
4678
4678
|
return "";
|
|
4679
4679
|
};
|
|
4680
|
+
const recordNodeOutput = (nodeId, content) => {
|
|
4681
|
+
outputs.set(nodeId, content);
|
|
4682
|
+
};
|
|
4683
|
+
const propagateNodeOutputDisplays = (nodeId, content, { emitGraph = false } = {}) => {
|
|
4684
|
+
const updatedDisplays = workspaceUpdateDirectDisplays(graph, nodeId, content, outputs, scopedRoot);
|
|
4685
|
+
if (emitGraph && updatedDisplays.length) emit({ type: "graph", nodeId, displayNodeIds: updatedDisplays, graph });
|
|
4686
|
+
return updatedDisplays;
|
|
4687
|
+
};
|
|
4688
|
+
const publishNodeOutput = (nodeId, content, options = {}) => {
|
|
4689
|
+
recordNodeOutput(nodeId, content);
|
|
4690
|
+
return propagateNodeOutputDisplays(nodeId, content, options);
|
|
4691
|
+
};
|
|
4680
4692
|
|
|
4681
4693
|
try {
|
|
4682
4694
|
for (const nodeId of order) {
|
|
@@ -4710,9 +4722,8 @@ async function runWorkspaceGraph(root, scopedRoot, payload, userCtx = {}, opts =
|
|
|
4710
4722
|
: slot
|
|
4711
4723
|
)),
|
|
4712
4724
|
};
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
emit({ type: "graph", nodeId, graph });
|
|
4725
|
+
const updatedDisplays = publishNodeOutput(nodeId, skillsBlock);
|
|
4726
|
+
emit({ type: "graph", nodeId, displayNodeIds: updatedDisplays, graph });
|
|
4716
4727
|
emit({ type: "node-done", nodeId, definitionId: defId });
|
|
4717
4728
|
continue;
|
|
4718
4729
|
}
|
|
@@ -4730,9 +4741,8 @@ async function runWorkspaceGraph(root, scopedRoot, payload, userCtx = {}, opts =
|
|
|
4730
4741
|
: slot
|
|
4731
4742
|
)),
|
|
4732
4743
|
};
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
emit({ type: "graph", nodeId, graph });
|
|
4744
|
+
const updatedDisplays = publishNodeOutput(nodeId, mcpBlock);
|
|
4745
|
+
emit({ type: "graph", nodeId, displayNodeIds: updatedDisplays, graph });
|
|
4736
4746
|
emit({ type: "node-done", nodeId, definitionId: defId });
|
|
4737
4747
|
continue;
|
|
4738
4748
|
}
|
|
@@ -4740,8 +4750,8 @@ async function runWorkspaceGraph(root, scopedRoot, payload, userCtx = {}, opts =
|
|
|
4740
4750
|
if (workspaceDisplayKind(defId)) {
|
|
4741
4751
|
const content = workspaceUpstreamText(graph, nodeId, outputs, scopedRoot);
|
|
4742
4752
|
graph.instances[nodeId] = workspaceWriteDisplayContent(instance, content);
|
|
4743
|
-
|
|
4744
|
-
emit({ type: "graph", nodeId, graph });
|
|
4753
|
+
const updatedDisplays = publishNodeOutput(nodeId, content);
|
|
4754
|
+
emit({ type: "graph", nodeId, displayNodeIds: updatedDisplays, graph });
|
|
4745
4755
|
emit({ type: "node-done", nodeId, definitionId: defId });
|
|
4746
4756
|
continue;
|
|
4747
4757
|
}
|
|
@@ -4757,7 +4767,7 @@ async function runWorkspaceGraph(root, scopedRoot, payload, userCtx = {}, opts =
|
|
|
4757
4767
|
const boolValue = parseBool(rawValue);
|
|
4758
4768
|
const branch = boolValue ? "true" : "false";
|
|
4759
4769
|
controlBranches.set(nodeId, branch);
|
|
4760
|
-
|
|
4770
|
+
publishNodeOutput(nodeId, branch, { emitGraph: true });
|
|
4761
4771
|
emit({ type: "status", nodeId, line: `control_if branch: ${branch}` });
|
|
4762
4772
|
emit({ type: "node-done", nodeId, definitionId: defId, branch });
|
|
4763
4773
|
continue;
|
|
@@ -4765,7 +4775,7 @@ async function runWorkspaceGraph(root, scopedRoot, payload, userCtx = {}, opts =
|
|
|
4765
4775
|
|
|
4766
4776
|
if (defId === "provide_str" || defId === "provide_password") {
|
|
4767
4777
|
const content = workspaceInstanceText(instance);
|
|
4768
|
-
|
|
4778
|
+
publishNodeOutput(nodeId, content, { emitGraph: true });
|
|
4769
4779
|
emit({ type: "node-done", nodeId, definitionId: defId });
|
|
4770
4780
|
continue;
|
|
4771
4781
|
}
|
|
@@ -4773,7 +4783,7 @@ async function runWorkspaceGraph(root, scopedRoot, payload, userCtx = {}, opts =
|
|
|
4773
4783
|
if (defId === "provide_bool") {
|
|
4774
4784
|
const raw = workspaceSlotValue(Array.isArray(instance.output) ? instance.output[0] : null) || workspaceInstanceText(instance);
|
|
4775
4785
|
const content = ["true", "1", "yes", "on"].includes(String(raw || "").trim().toLowerCase()) ? "true" : "false";
|
|
4776
|
-
|
|
4786
|
+
publishNodeOutput(nodeId, content, { emitGraph: true });
|
|
4777
4787
|
emit({ type: "node-done", nodeId, definitionId: defId });
|
|
4778
4788
|
continue;
|
|
4779
4789
|
}
|
|
@@ -4785,7 +4795,7 @@ async function runWorkspaceGraph(root, scopedRoot, payload, userCtx = {}, opts =
|
|
|
4785
4795
|
throw new Error(`Workspace file is outside root: ${fileValue}`);
|
|
4786
4796
|
}
|
|
4787
4797
|
const content = fs.existsSync(abs) && fs.statSync(abs).isFile() ? fs.readFileSync(abs, "utf-8") : fileValue;
|
|
4788
|
-
|
|
4798
|
+
publishNodeOutput(nodeId, content, { emitGraph: true });
|
|
4789
4799
|
emit({ type: "node-done", nodeId, definitionId: defId });
|
|
4790
4800
|
continue;
|
|
4791
4801
|
}
|
|
@@ -4803,9 +4813,9 @@ async function runWorkspaceGraph(root, scopedRoot, payload, userCtx = {}, opts =
|
|
|
4803
4813
|
let nextInstance = workspaceSetOutputSlot(instance, "keys", keys.join(", "));
|
|
4804
4814
|
nextInstance = workspaceSetOutputSlot(nextInstance, "count", String(keys.length));
|
|
4805
4815
|
graph.instances[nodeId] = nextInstance;
|
|
4806
|
-
|
|
4816
|
+
const updatedDisplays = publishNodeOutput(nodeId, keys.join(", "));
|
|
4807
4817
|
emit({ type: "status", nodeId, line: `Set run env: ${keys.join(", ")}`, envKeys: keys });
|
|
4808
|
-
emit({ type: "graph", nodeId, graph });
|
|
4818
|
+
emit({ type: "graph", nodeId, displayNodeIds: updatedDisplays, graph });
|
|
4809
4819
|
emit({ type: "node-done", nodeId, definitionId: defId });
|
|
4810
4820
|
continue;
|
|
4811
4821
|
}
|
|
@@ -4818,14 +4828,14 @@ async function runWorkspaceGraph(root, scopedRoot, payload, userCtx = {}, opts =
|
|
|
4818
4828
|
const candidate = workspaceSlotValue(pathSlot) || workspaceInstanceText(instance) || inputText;
|
|
4819
4829
|
const abs = candidate ? path.resolve(scopedRoot, candidate) : scopedRoot;
|
|
4820
4830
|
if (fs.existsSync(abs) && fs.statSync(abs).isDirectory()) cwd = abs;
|
|
4821
|
-
|
|
4831
|
+
publishNodeOutput(nodeId, cwd, { emitGraph: true });
|
|
4822
4832
|
emit({ type: "node-done", nodeId, definitionId: defId });
|
|
4823
4833
|
continue;
|
|
4824
4834
|
}
|
|
4825
4835
|
|
|
4826
4836
|
if (defId === "control_user_workspace") {
|
|
4827
4837
|
cwd = path.resolve(os.homedir());
|
|
4828
|
-
|
|
4838
|
+
publishNodeOutput(nodeId, cwd, { emitGraph: true });
|
|
4829
4839
|
emit({ type: "node-done", nodeId, definitionId: defId });
|
|
4830
4840
|
continue;
|
|
4831
4841
|
}
|
|
@@ -4894,8 +4904,8 @@ async function runWorkspaceGraph(root, scopedRoot, payload, userCtx = {}, opts =
|
|
|
4894
4904
|
previous: { version: 1, label: "workspace", cwd: previousCwd, workspaceRoot: previousCwd, pipelineWorkspace: scopedRoot, previous: null },
|
|
4895
4905
|
}));
|
|
4896
4906
|
graph.instances[nodeId] = nextInstance;
|
|
4897
|
-
|
|
4898
|
-
emit({ type: "graph", nodeId, graph });
|
|
4907
|
+
const updatedDisplays = publishNodeOutput(nodeId, targetDir);
|
|
4908
|
+
emit({ type: "graph", nodeId, displayNodeIds: updatedDisplays, graph });
|
|
4899
4909
|
emit({ type: "node-done", nodeId, definitionId: defId });
|
|
4900
4910
|
continue;
|
|
4901
4911
|
}
|
|
@@ -4947,8 +4957,8 @@ async function runWorkspaceGraph(root, scopedRoot, payload, userCtx = {}, opts =
|
|
|
4947
4957
|
previous: { version: 1, label: "workspace", cwd: previousCwd, workspaceRoot: previousCwd, pipelineWorkspace: scopedRoot, previous: null },
|
|
4948
4958
|
}));
|
|
4949
4959
|
graph.instances[nodeId] = nextInstance;
|
|
4950
|
-
|
|
4951
|
-
emit({ type: "graph", nodeId, graph });
|
|
4960
|
+
const updatedDisplays = publishNodeOutput(nodeId, result.worktreePath);
|
|
4961
|
+
emit({ type: "graph", nodeId, displayNodeIds: updatedDisplays, graph });
|
|
4952
4962
|
emit({ type: "node-done", nodeId, definitionId: defId });
|
|
4953
4963
|
continue;
|
|
4954
4964
|
}
|
|
@@ -4981,8 +4991,8 @@ async function runWorkspaceGraph(root, scopedRoot, payload, userCtx = {}, opts =
|
|
|
4981
4991
|
previous: null,
|
|
4982
4992
|
}));
|
|
4983
4993
|
graph.instances[nodeId] = nextInstance;
|
|
4984
|
-
|
|
4985
|
-
emit({ type: "graph", nodeId, graph });
|
|
4994
|
+
const updatedDisplays = publishNodeOutput(nodeId, result.message);
|
|
4995
|
+
emit({ type: "graph", nodeId, displayNodeIds: updatedDisplays, graph });
|
|
4986
4996
|
emit({ type: "node-done", nodeId, definitionId: defId });
|
|
4987
4997
|
continue;
|
|
4988
4998
|
}
|
|
@@ -5016,8 +5026,8 @@ async function runWorkspaceGraph(root, scopedRoot, payload, userCtx = {}, opts =
|
|
|
5016
5026
|
nextInstance = workspaceSetOutputSlot(nextInstance, "title", result.title ?? "");
|
|
5017
5027
|
nextInstance = workspaceSetOutputSlot(nextInstance, "message", result.message ?? "");
|
|
5018
5028
|
graph.instances[nodeId] = nextInstance;
|
|
5019
|
-
|
|
5020
|
-
emit({ type: "graph", nodeId, graph });
|
|
5029
|
+
const updatedDisplays = publishNodeOutput(nodeId, result.mrUrl);
|
|
5030
|
+
emit({ type: "graph", nodeId, displayNodeIds: updatedDisplays, graph });
|
|
5021
5031
|
emit({ type: "node-done", nodeId, definitionId: defId });
|
|
5022
5032
|
continue;
|
|
5023
5033
|
}
|
|
@@ -5043,8 +5053,8 @@ async function runWorkspaceGraph(root, scopedRoot, payload, userCtx = {}, opts =
|
|
|
5043
5053
|
nextInstance = workspaceSetOutputSlot(nextInstance, "message", result.message);
|
|
5044
5054
|
nextInstance = workspaceSetOutputSlot(nextInstance, "response", JSON.stringify(result.response || {}));
|
|
5045
5055
|
graph.instances[nodeId] = nextInstance;
|
|
5046
|
-
|
|
5047
|
-
emit({ type: "graph", nodeId, graph });
|
|
5056
|
+
const updatedDisplays = publishNodeOutput(nodeId, result.message);
|
|
5057
|
+
emit({ type: "graph", nodeId, displayNodeIds: updatedDisplays, graph });
|
|
5048
5058
|
emit({ type: "node-done", nodeId, definitionId: defId });
|
|
5049
5059
|
continue;
|
|
5050
5060
|
}
|
|
@@ -5089,8 +5099,8 @@ async function runWorkspaceGraph(root, scopedRoot, payload, userCtx = {}, opts =
|
|
|
5089
5099
|
nextInstance = workspaceSetOutputSlot(nextInstance, "shareId", share.id);
|
|
5090
5100
|
nextInstance = workspaceSetOutputSlot(nextInstance, "expiresAt", share.expiresAt);
|
|
5091
5101
|
graph.instances[nodeId] = nextInstance;
|
|
5092
|
-
|
|
5093
|
-
emit({ type: "graph", nodeId, graph, displayNodeIds: nodeIds });
|
|
5102
|
+
const updatedDisplays = publishNodeOutput(nodeId, url);
|
|
5103
|
+
emit({ type: "graph", nodeId, graph, displayNodeIds: [...nodeIds, ...updatedDisplays] });
|
|
5094
5104
|
emit({ type: "node-done", nodeId, definitionId: defId });
|
|
5095
5105
|
continue;
|
|
5096
5106
|
}
|
|
@@ -5121,7 +5131,7 @@ async function runWorkspaceGraph(root, scopedRoot, payload, userCtx = {}, opts =
|
|
|
5121
5131
|
});
|
|
5122
5132
|
const normalizedAgentOutput = workspacePublishAgentOutputFiles(workspaceStructuredAgentOutput(content), runPackage);
|
|
5123
5133
|
const resultContent = normalizedAgentOutput.result || content;
|
|
5124
|
-
|
|
5134
|
+
recordNodeOutput(nodeId, resultContent);
|
|
5125
5135
|
const slotUpdate = workspaceApplyAgentOutputSlots(instance, normalizedAgentOutput);
|
|
5126
5136
|
if (slotUpdate.changed) graph.instances[nodeId] = slotUpdate.instance;
|
|
5127
5137
|
const implementationUpdate = await workspaceTryPersistNodeImplementation(scopedRoot, graph, nodeId, {
|
|
@@ -5135,7 +5145,7 @@ async function runWorkspaceGraph(root, scopedRoot, payload, userCtx = {}, opts =
|
|
|
5135
5145
|
onActiveChild: opts.onActiveChild,
|
|
5136
5146
|
});
|
|
5137
5147
|
if (implementationUpdate.changed) graph.instances[nodeId] = implementationUpdate.instance;
|
|
5138
|
-
const updatedDisplays =
|
|
5148
|
+
const updatedDisplays = propagateNodeOutputDisplays(nodeId, resultContent);
|
|
5139
5149
|
if (slotUpdate.changed || implementationUpdate.changed || updatedDisplays.length) emit({ type: "graph", nodeId, displayNodeIds: updatedDisplays, graph });
|
|
5140
5150
|
emit({ type: "node-done", nodeId, definitionId: defId });
|
|
5141
5151
|
continue;
|
|
@@ -5258,7 +5268,7 @@ async function runWorkspaceGraph(root, scopedRoot, payload, userCtx = {}, opts =
|
|
|
5258
5268
|
}
|
|
5259
5269
|
const normalizedAgentOutput = workspacePublishAgentOutputFiles(workspaceStructuredAgentOutput(content), runPackage);
|
|
5260
5270
|
const resultContent = normalizedAgentOutput.result || content;
|
|
5261
|
-
|
|
5271
|
+
recordNodeOutput(nodeId, resultContent);
|
|
5262
5272
|
const slotUpdate = workspaceApplyAgentOutputSlots(instance, normalizedAgentOutput);
|
|
5263
5273
|
if (slotUpdate.changed) graph.instances[nodeId] = slotUpdate.instance;
|
|
5264
5274
|
const implementationUpdate = await workspaceTryPersistNodeImplementation(scopedRoot, graph, nodeId, {
|
|
@@ -5273,7 +5283,7 @@ async function runWorkspaceGraph(root, scopedRoot, payload, userCtx = {}, opts =
|
|
|
5273
5283
|
onActiveChild: opts.onActiveChild,
|
|
5274
5284
|
});
|
|
5275
5285
|
if (implementationUpdate.changed) graph.instances[nodeId] = implementationUpdate.instance;
|
|
5276
|
-
const updatedDisplays =
|
|
5286
|
+
const updatedDisplays = propagateNodeOutputDisplays(nodeId, resultContent);
|
|
5277
5287
|
if (slotUpdate.changed || implementationUpdate.changed || updatedDisplays.length) emit({ type: "graph", nodeId, displayNodeIds: updatedDisplays, graph });
|
|
5278
5288
|
emit({ type: "node-done", nodeId, definitionId: defId });
|
|
5279
5289
|
}
|