@fieldwangai/agentflow 0.1.63 → 0.1.65

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.
@@ -2122,7 +2122,9 @@ function workspaceExtractNamedOutputValue(content, slotName) {
2122
2122
  }
2123
2123
 
2124
2124
  function workspaceApplyAgentOutputSlots(instance, content) {
2125
- const structured = workspaceStructuredAgentOutput(content);
2125
+ const structured = content && typeof content === "object" && !Array.isArray(content)
2126
+ ? content
2127
+ : workspaceStructuredAgentOutput(content);
2126
2128
  const text = String(structured.result || "").trim();
2127
2129
  let changed = false;
2128
2130
  const next = {
@@ -2233,15 +2235,17 @@ function workspacePublishNodeOutputFile(runPackage, relPath) {
2233
2235
  if (!fs.existsSync(src) || !fs.statSync(src).isFile()) {
2234
2236
  throw new Error(`Agent returned resultFile but did not create it under node outputs: ${clean}`);
2235
2237
  }
2236
- const destRel = clean.slice("outputs/".length);
2237
- const dest = path.resolve(workspaceOutputsDir, destRel);
2238
+ const nodePart = workspaceSanitizeTmpSegment(runPackage?.nodeId || "node", "node");
2239
+ const destRel = clean.slice("outputs/".length).replace(/^\/+/, "");
2240
+ const publishedRel = path.posix.join("outputs", nodePart, ...destRel.split("/").filter(Boolean));
2241
+ const dest = path.resolve(workspaceOutputsDir, nodePart, ...destRel.split("/").filter(Boolean));
2238
2242
  const workspaceOutputsWithSep = workspaceOutputsDir.endsWith(path.sep) ? workspaceOutputsDir : `${workspaceOutputsDir}${path.sep}`;
2239
2243
  if (dest !== workspaceOutputsDir && !dest.startsWith(workspaceOutputsWithSep)) {
2240
2244
  throw new Error(`Invalid workspace output path: ${clean}`);
2241
2245
  }
2242
2246
  fs.mkdirSync(path.dirname(dest), { recursive: true });
2243
2247
  fs.copyFileSync(src, dest);
2244
- return clean;
2248
+ return publishedRel;
2245
2249
  }
2246
2250
 
2247
2251
  function workspacePublishAgentOutputFiles(structured, runPackage) {
@@ -3370,7 +3374,7 @@ async function runWorkspaceGraph(root, scopedRoot, payload, userCtx = {}, opts =
3370
3374
  const normalizedAgentOutput = workspacePublishAgentOutputFiles(workspaceStructuredAgentOutput(content), runPackage);
3371
3375
  const resultContent = normalizedAgentOutput.result || content;
3372
3376
  outputs.set(nodeId, resultContent);
3373
- const slotUpdate = workspaceApplyAgentOutputSlots(instance, content);
3377
+ const slotUpdate = workspaceApplyAgentOutputSlots(instance, normalizedAgentOutput);
3374
3378
  if (slotUpdate.changed) graph.instances[nodeId] = slotUpdate.instance;
3375
3379
  const updatedDisplays = workspaceUpdateDirectDisplays(graph, nodeId, resultContent, outputs);
3376
3380
  if (slotUpdate.changed || updatedDisplays.length) emit({ type: "graph", nodeId, displayNodeIds: updatedDisplays, graph });