@particle-academy/fancy-flow 0.77.1 → 0.78.0
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/dist/{FlowViewer-Ak8kbY0e.d.cts → FlowViewer-BqYQl2vS.d.cts} +1 -1
- package/dist/{FlowViewer-BAV29Zpi.d.ts → FlowViewer-_Fq8AX9V.d.ts} +1 -1
- package/dist/{HumanPrompt-xYPCL2jO.d.cts → HumanPrompt-Sl1wD9Bx.d.cts} +2 -2
- package/dist/{HumanPrompt-Ge_ccCgS.d.ts → HumanPrompt-_SKIdSpx.d.ts} +2 -2
- package/dist/{chunk-G5RAGPVD.js → chunk-3EDB6ELL.js} +3 -3
- package/dist/{chunk-G5RAGPVD.js.map → chunk-3EDB6ELL.js.map} +1 -1
- package/dist/{chunk-CQAMEPPI.js → chunk-4GNDRRJ3.js} +3 -3
- package/dist/{chunk-CQAMEPPI.js.map → chunk-4GNDRRJ3.js.map} +1 -1
- package/dist/{chunk-EGXA4SYJ.js → chunk-BBFHGAEN.js} +4 -4
- package/dist/{chunk-EGXA4SYJ.js.map → chunk-BBFHGAEN.js.map} +1 -1
- package/dist/{chunk-ARSOSEJV.js → chunk-GPFIJR2K.js} +4 -4
- package/dist/{chunk-ARSOSEJV.js.map → chunk-GPFIJR2K.js.map} +1 -1
- package/dist/{chunk-EEIWAIXW.js → chunk-J5YUYDMK.js} +106 -6
- package/dist/chunk-J5YUYDMK.js.map +1 -0
- package/dist/{chunk-2VI24UPB.js → chunk-S4MOUOG4.js} +3 -3
- package/dist/{chunk-2VI24UPB.js.map → chunk-S4MOUOG4.js.map} +1 -1
- package/dist/{chunk-T6WIIGSK.js → chunk-XO4ODEY2.js} +3 -3
- package/dist/{chunk-T6WIIGSK.js.map → chunk-XO4ODEY2.js.map} +1 -1
- package/dist/connectors.d.cts +2 -2
- package/dist/connectors.d.ts +2 -2
- package/dist/durable/index.d.cts +2 -2
- package/dist/durable/index.d.ts +2 -2
- package/dist/durable.cjs +104 -4
- package/dist/durable.cjs.map +1 -1
- package/dist/durable.js +1 -1
- package/dist/engine.cjs +104 -4
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.d.cts +6 -6
- package/dist/engine.d.ts +6 -6
- package/dist/engine.js +4 -4
- package/dist/fields/react-fancy.d.cts +3 -3
- package/dist/fields/react-fancy.d.ts +3 -3
- package/dist/index.cjs +104 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +12 -12
- package/dist/layout/index.d.cts +1 -1
- package/dist/layout/index.d.ts +1 -1
- package/dist/llm/prism.d.cts +1 -1
- package/dist/llm/prism.d.ts +1 -1
- package/dist/llm/vercel-ai.d.cts +1 -1
- package/dist/llm/vercel-ai.d.ts +1 -1
- package/dist/registry/index.d.cts +5 -5
- package/dist/registry/index.d.ts +5 -5
- package/dist/{registry-JUcN_xWK.d.ts → registry-C4GcH583.d.ts} +1 -1
- package/dist/{registry-B6SiTaLZ.d.cts → registry-DWIY3bMP.d.cts} +1 -1
- package/dist/registry.cjs +104 -4
- package/dist/registry.cjs.map +1 -1
- package/dist/registry.js +2 -2
- package/dist/{run-cohort-rgT_FX3V.d.ts → run-cohort-DAfhZm-p.d.ts} +2 -2
- package/dist/{run-cohort-DNpPa0mq.d.cts → run-cohort-DRJvUWO9.d.cts} +2 -2
- package/dist/{run-flow-pW0PllaZ.d.cts → run-flow-Bdrn4lQV.d.cts} +1 -1
- package/dist/{run-flow-BLP9rXfO.d.ts → run-flow-D2iOjWsj.d.ts} +1 -1
- package/dist/runtime/index.d.cts +5 -5
- package/dist/runtime/index.d.ts +5 -5
- package/dist/runtime.cjs +104 -4
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.js +3 -3
- package/dist/schema/index.d.cts +1 -1
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema.cjs +104 -4
- package/dist/schema.cjs.map +1 -1
- package/dist/schema.js +3 -3
- package/dist/screens.cjs +104 -4
- package/dist/screens.cjs.map +1 -1
- package/dist/screens.d.cts +2 -2
- package/dist/screens.d.ts +2 -2
- package/dist/screens.js +4 -4
- package/dist/terminal/fancy-term-host.d.cts +1 -1
- package/dist/terminal/fancy-term-host.d.ts +1 -1
- package/dist/{types-BdkXxjFh.d.cts → types-B1jftRa9.d.cts} +1 -1
- package/dist/{types-CbekKMMO.d.ts → types-D5SBBpbe.d.ts} +1 -1
- package/dist/{types-B-Syk9-M.d.ts → types-E48Dpesq.d.cts} +20 -0
- package/dist/{types-B-Syk9-M.d.cts → types-E48Dpesq.d.ts} +20 -0
- package/dist/ux.cjs +104 -4
- package/dist/ux.cjs.map +1 -1
- package/dist/ux.d.cts +2 -2
- package/dist/ux.d.ts +2 -2
- package/dist/ux.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-EEIWAIXW.js.map +0 -1
package/dist/engine.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { R as RunOptions, a as RunResult, r as runFlow } from './run-flow-
|
|
2
|
-
import { F as FlowGraph, R as RunEvent, N as NodeExecutor, W as WorkflowResolver, a as FlowNode } from './types-
|
|
3
|
-
export { A as ActionNodeData, B as BaseNodeData, D as DecisionNodeData, E as ExecutorRegistry, e as FlowEdge, f as FlowNodeData, g as FlowNodeKind, h as NodeRunStatus, i as NoteNodeData, O as OutputNodeData, P as PortDescriptor, c as RunIdentity, d as RunIdentityJson, S as SubgraphNodeData, j as TriggerNodeData, k as escapeSegment } from './types-
|
|
4
|
-
export { C as CohortGuard, a as CohortOptions, b as CohortPolicy, c as CohortResult, r as runCohort } from './run-cohort-
|
|
5
|
-
export { K as KindSchemaOverlay, a as KindSchemaOverlayResult, b as applyKindSchemaOverlay, c as clearKindSchemaOverlays, d as defaultConfigFor, g as getNodeKind, k as kindIds, l as listNodeKinds, r as registerNodeKind, e as resolveKindId, u as unregisterNodeKind, v as validateConfig } from './registry-
|
|
6
|
-
export { b as CapabilityRequirement, C as ConfigField, E as EmitsRelation, M as ManifestProblem, c as ManifestValidation, d as NODE_MANIFEST_SCHEMA_VERSION, a as NodeCategory, N as NodeKindDefinition, e as NodePackageManifest, f as NodeRuntimeId, g as NodeRuntimeSpec, O as OutputField, h as OutputShape, P as PortSpec, S as SideEffects, i as checkCapabilities, j as checkRuntimeSupport, s as satisfiesRange, v as validateNodeManifest } from './types-
|
|
1
|
+
export { R as RunOptions, a as RunResult, r as runFlow } from './run-flow-Bdrn4lQV.cjs';
|
|
2
|
+
import { F as FlowGraph, R as RunEvent, N as NodeExecutor, W as WorkflowResolver, a as FlowNode } from './types-E48Dpesq.cjs';
|
|
3
|
+
export { A as ActionNodeData, B as BaseNodeData, D as DecisionNodeData, E as ExecutorRegistry, e as FlowEdge, f as FlowNodeData, g as FlowNodeKind, h as NodeRunStatus, i as NoteNodeData, O as OutputNodeData, P as PortDescriptor, c as RunIdentity, d as RunIdentityJson, S as SubgraphNodeData, j as TriggerNodeData, k as escapeSegment } from './types-E48Dpesq.cjs';
|
|
4
|
+
export { C as CohortGuard, a as CohortOptions, b as CohortPolicy, c as CohortResult, r as runCohort } from './run-cohort-DRJvUWO9.cjs';
|
|
5
|
+
export { K as KindSchemaOverlay, a as KindSchemaOverlayResult, b as applyKindSchemaOverlay, c as clearKindSchemaOverlays, d as defaultConfigFor, g as getNodeKind, k as kindIds, l as listNodeKinds, r as registerNodeKind, e as resolveKindId, u as unregisterNodeKind, v as validateConfig } from './registry-DWIY3bMP.cjs';
|
|
6
|
+
export { b as CapabilityRequirement, C as ConfigField, E as EmitsRelation, M as ManifestProblem, c as ManifestValidation, d as NODE_MANIFEST_SCHEMA_VERSION, a as NodeCategory, N as NodeKindDefinition, e as NodePackageManifest, f as NodeRuntimeId, g as NodeRuntimeSpec, O as OutputField, h as OutputShape, P as PortSpec, S as SideEffects, i as checkCapabilities, j as checkRuntimeSupport, s as satisfiesRange, v as validateNodeManifest } from './types-B1jftRa9.cjs';
|
|
7
7
|
export { E as EvaluateOptions, a as ExprContext, b as ExprValue, R as Resolution, U as UnresolvedPathError, c as UnresolvedPolicy, e as evaluateConfig, d as evaluateExpression, r as resolvePath, t as text, f as truthy, g as tryResolvePath } from './expr-BfXDrs4H.cjs';
|
|
8
8
|
import { P as PauseAwaiting } from './pause-9iT4tCEV.cjs';
|
|
9
9
|
export { L as LEGACY_PAUSE_PREFIXES, a as PAUSE_PREFIX, b as PauseSignal, d as decodePause, e as encodePause, i as isPause, p as pauseForHuman } from './pause-9iT4tCEV.cjs';
|
package/dist/engine.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { R as RunOptions, a as RunResult, r as runFlow } from './run-flow-
|
|
2
|
-
import { F as FlowGraph, R as RunEvent, N as NodeExecutor, W as WorkflowResolver, a as FlowNode } from './types-
|
|
3
|
-
export { A as ActionNodeData, B as BaseNodeData, D as DecisionNodeData, E as ExecutorRegistry, e as FlowEdge, f as FlowNodeData, g as FlowNodeKind, h as NodeRunStatus, i as NoteNodeData, O as OutputNodeData, P as PortDescriptor, c as RunIdentity, d as RunIdentityJson, S as SubgraphNodeData, j as TriggerNodeData, k as escapeSegment } from './types-
|
|
4
|
-
export { C as CohortGuard, a as CohortOptions, b as CohortPolicy, c as CohortResult, r as runCohort } from './run-cohort-
|
|
5
|
-
export { K as KindSchemaOverlay, a as KindSchemaOverlayResult, b as applyKindSchemaOverlay, c as clearKindSchemaOverlays, d as defaultConfigFor, g as getNodeKind, k as kindIds, l as listNodeKinds, r as registerNodeKind, e as resolveKindId, u as unregisterNodeKind, v as validateConfig } from './registry-
|
|
6
|
-
export { b as CapabilityRequirement, C as ConfigField, E as EmitsRelation, M as ManifestProblem, c as ManifestValidation, d as NODE_MANIFEST_SCHEMA_VERSION, a as NodeCategory, N as NodeKindDefinition, e as NodePackageManifest, f as NodeRuntimeId, g as NodeRuntimeSpec, O as OutputField, h as OutputShape, P as PortSpec, S as SideEffects, i as checkCapabilities, j as checkRuntimeSupport, s as satisfiesRange, v as validateNodeManifest } from './types-
|
|
1
|
+
export { R as RunOptions, a as RunResult, r as runFlow } from './run-flow-D2iOjWsj.js';
|
|
2
|
+
import { F as FlowGraph, R as RunEvent, N as NodeExecutor, W as WorkflowResolver, a as FlowNode } from './types-E48Dpesq.js';
|
|
3
|
+
export { A as ActionNodeData, B as BaseNodeData, D as DecisionNodeData, E as ExecutorRegistry, e as FlowEdge, f as FlowNodeData, g as FlowNodeKind, h as NodeRunStatus, i as NoteNodeData, O as OutputNodeData, P as PortDescriptor, c as RunIdentity, d as RunIdentityJson, S as SubgraphNodeData, j as TriggerNodeData, k as escapeSegment } from './types-E48Dpesq.js';
|
|
4
|
+
export { C as CohortGuard, a as CohortOptions, b as CohortPolicy, c as CohortResult, r as runCohort } from './run-cohort-DAfhZm-p.js';
|
|
5
|
+
export { K as KindSchemaOverlay, a as KindSchemaOverlayResult, b as applyKindSchemaOverlay, c as clearKindSchemaOverlays, d as defaultConfigFor, g as getNodeKind, k as kindIds, l as listNodeKinds, r as registerNodeKind, e as resolveKindId, u as unregisterNodeKind, v as validateConfig } from './registry-C4GcH583.js';
|
|
6
|
+
export { b as CapabilityRequirement, C as ConfigField, E as EmitsRelation, M as ManifestProblem, c as ManifestValidation, d as NODE_MANIFEST_SCHEMA_VERSION, a as NodeCategory, N as NodeKindDefinition, e as NodePackageManifest, f as NodeRuntimeId, g as NodeRuntimeSpec, O as OutputField, h as OutputShape, P as PortSpec, S as SideEffects, i as checkCapabilities, j as checkRuntimeSupport, s as satisfiesRange, v as validateNodeManifest } from './types-D5SBBpbe.js';
|
|
7
7
|
export { E as EvaluateOptions, a as ExprContext, b as ExprValue, R as Resolution, U as UnresolvedPathError, c as UnresolvedPolicy, e as evaluateConfig, d as evaluateExpression, r as resolvePath, t as text, f as truthy, g as tryResolvePath } from './expr-BfXDrs4H.js';
|
|
8
8
|
import { P as PauseAwaiting } from './pause-9iT4tCEV.js';
|
|
9
9
|
export { L as LEGACY_PAUSE_PREFIXES, a as PAUSE_PREFIX, b as PauseSignal, d as decodePause, e as encodePause, i as isPause, p as pauseForHuman } from './pause-9iT4tCEV.js';
|
package/dist/engine.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { runCohort } from './chunk-
|
|
2
|
-
export { checkGraphConnectivity, mayFloat } from './chunk-
|
|
3
|
-
import { runFlow, decodePause, getNodeKind, resolveNodePorts } from './chunk-
|
|
4
|
-
export { LEGACY_PAUSE_PREFIXES, PAUSE_PREFIX, RunIdentity, UnresolvedPathError, applyKindSchemaOverlay, clearKindSchemaOverlays, decodePause, defaultConfigFor, encodePause, escapeSegment, evaluateConfig, evaluateExpression, getNodeKind, isPause, kindIds, listNodeKinds, pauseForHuman, registerNodeKind, resolveKindId, resolvePath, runFlow, text, truthy, tryResolvePath, unregisterNodeKind, validateConfig } from './chunk-
|
|
1
|
+
export { runCohort } from './chunk-4GNDRRJ3.js';
|
|
2
|
+
export { checkGraphConnectivity, mayFloat } from './chunk-3EDB6ELL.js';
|
|
3
|
+
import { runFlow, decodePause, getNodeKind, resolveNodePorts } from './chunk-J5YUYDMK.js';
|
|
4
|
+
export { LEGACY_PAUSE_PREFIXES, PAUSE_PREFIX, RunIdentity, UnresolvedPathError, applyKindSchemaOverlay, clearKindSchemaOverlays, decodePause, defaultConfigFor, encodePause, escapeSegment, evaluateConfig, evaluateExpression, getNodeKind, isPause, kindIds, listNodeKinds, pauseForHuman, registerNodeKind, resolveKindId, resolvePath, runFlow, text, truthy, tryResolvePath, unregisterNodeKind, validateConfig } from './chunk-J5YUYDMK.js';
|
|
5
5
|
import { isResolutionFailure, registerLlmClient, registerWorkflowResolver } from './chunk-2QXKDLGT.js';
|
|
6
6
|
|
|
7
7
|
// src/marketplace/manifest.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { H as HumanFieldRenderers, C as ConfigFieldRenderFn } from '../HumanPrompt-
|
|
1
|
+
import { H as HumanFieldRenderers, C as ConfigFieldRenderFn } from '../HumanPrompt-Sl1wD9Bx.cjs';
|
|
2
2
|
import 'react';
|
|
3
|
-
import '../types-
|
|
3
|
+
import '../types-E48Dpesq.cjs';
|
|
4
4
|
import '@xyflow/react';
|
|
5
|
-
import '../types-
|
|
5
|
+
import '../types-B1jftRa9.cjs';
|
|
6
6
|
import '../pause-9iT4tCEV.cjs';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { H as HumanFieldRenderers, C as ConfigFieldRenderFn } from '../HumanPrompt-
|
|
1
|
+
import { H as HumanFieldRenderers, C as ConfigFieldRenderFn } from '../HumanPrompt-_SKIdSpx.js';
|
|
2
2
|
import 'react';
|
|
3
|
-
import '../types-
|
|
3
|
+
import '../types-E48Dpesq.js';
|
|
4
4
|
import '@xyflow/react';
|
|
5
|
-
import '../types-
|
|
5
|
+
import '../types-D5SBBpbe.js';
|
|
6
6
|
import '../pause-9iT4tCEV.js';
|
|
7
7
|
|
|
8
8
|
/**
|
package/dist/index.cjs
CHANGED
|
@@ -2532,6 +2532,9 @@ async function runFlow(graph, executors, onEvent = () => {
|
|
|
2532
2532
|
executors,
|
|
2533
2533
|
depth,
|
|
2534
2534
|
run,
|
|
2535
|
+
// Structural executors derive a nested lane from the graph they are
|
|
2536
|
+
// in; `for_each`'s `item` port cannot be implemented without it.
|
|
2537
|
+
graph,
|
|
2535
2538
|
terminal: terminalAccessorFor(node)
|
|
2536
2539
|
})
|
|
2537
2540
|
);
|
|
@@ -3040,14 +3043,102 @@ var mergeExecutor = (ctx) => {
|
|
|
3040
3043
|
}
|
|
3041
3044
|
return merged;
|
|
3042
3045
|
};
|
|
3043
|
-
var
|
|
3044
|
-
|
|
3046
|
+
var FOR_EACH_DEFAULT_MAX_ITEMS = 1e3;
|
|
3047
|
+
var FOR_EACH_HARD_MAX_ITEMS = 1e4;
|
|
3048
|
+
function reachable(adjacency, starts) {
|
|
3049
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3050
|
+
const queue = [...starts];
|
|
3051
|
+
for (let cursor = 0; cursor < queue.length; cursor += 1) {
|
|
3052
|
+
const id2 = queue[cursor];
|
|
3053
|
+
if (seen.has(id2)) continue;
|
|
3054
|
+
seen.add(id2);
|
|
3055
|
+
for (const target of adjacency.get(id2) ?? []) queue.push(target);
|
|
3056
|
+
}
|
|
3057
|
+
return seen;
|
|
3058
|
+
}
|
|
3059
|
+
function forEachLane(graph, nodeId) {
|
|
3060
|
+
const handleOf = (edge) => edge.sourceHandle ?? "out";
|
|
3061
|
+
const itemEdges = graph.edges.filter((e) => e.source === nodeId && handleOf(e) === "item");
|
|
3062
|
+
if (itemEdges.length === 0) return null;
|
|
3063
|
+
const adjacency = /* @__PURE__ */ new Map();
|
|
3064
|
+
for (const edge of graph.edges) {
|
|
3065
|
+
const list = adjacency.get(edge.source) ?? [];
|
|
3066
|
+
list.push(edge.target);
|
|
3067
|
+
adjacency.set(edge.source, list);
|
|
3068
|
+
}
|
|
3069
|
+
const done = reachable(
|
|
3070
|
+
adjacency,
|
|
3071
|
+
graph.edges.filter((e) => e.source === nodeId && handleOf(e) === "done").map((e) => e.target)
|
|
3072
|
+
);
|
|
3073
|
+
const body = new Set(
|
|
3074
|
+
[...reachable(adjacency, itemEdges.map((e) => e.target))].filter(
|
|
3075
|
+
(id2) => !done.has(id2) && id2 !== nodeId
|
|
3076
|
+
)
|
|
3077
|
+
);
|
|
3078
|
+
return {
|
|
3079
|
+
graph: {
|
|
3080
|
+
nodes: graph.nodes.filter((n) => body.has(n.id)),
|
|
3081
|
+
edges: graph.edges.filter((e) => body.has(e.source) && body.has(e.target)),
|
|
3082
|
+
...graph.inputs === void 0 ? {} : { inputs: graph.inputs }
|
|
3083
|
+
},
|
|
3084
|
+
entries: itemEdges.filter((e) => body.has(e.target))
|
|
3085
|
+
};
|
|
3086
|
+
}
|
|
3087
|
+
var forEachExecutor = async (ctx) => {
|
|
3088
|
+
const config = configOf(ctx.node);
|
|
3089
|
+
const source = resolve(config.source, ctx.inputs);
|
|
3045
3090
|
let items;
|
|
3046
3091
|
if (Array.isArray(source)) items = source;
|
|
3047
3092
|
else if (source === null || source === void 0) items = [];
|
|
3048
3093
|
else if (typeof source === "object") items = Object.values(source);
|
|
3049
3094
|
else items = [source];
|
|
3050
|
-
|
|
3095
|
+
const lane = ctx.graph ? forEachLane(ctx.graph, ctx.node.id) : null;
|
|
3096
|
+
if (lane === null || config.mode === "collect") {
|
|
3097
|
+
return { items, count: items.length };
|
|
3098
|
+
}
|
|
3099
|
+
if (lane.graph.nodes.length === 0) {
|
|
3100
|
+
ctx.abort(`for_each "${ctx.node.id}" has an item edge but its derived lane is empty`);
|
|
3101
|
+
}
|
|
3102
|
+
const maxItems = Number(config.maxItems ?? FOR_EACH_DEFAULT_MAX_ITEMS);
|
|
3103
|
+
if (!Number.isFinite(maxItems) || maxItems < 1 || maxItems > FOR_EACH_HARD_MAX_ITEMS) {
|
|
3104
|
+
ctx.abort(`for_each "${ctx.node.id}" maxItems must be between 1 and ${FOR_EACH_HARD_MAX_ITEMS}`);
|
|
3105
|
+
}
|
|
3106
|
+
if (items.length > maxItems) {
|
|
3107
|
+
ctx.abort(
|
|
3108
|
+
`for_each "${ctx.node.id}" resolved ${items.length} items exceeds its maxItems cap of ${maxItems}`
|
|
3109
|
+
);
|
|
3110
|
+
}
|
|
3111
|
+
const results = [];
|
|
3112
|
+
const failures = [];
|
|
3113
|
+
for (const [index2, item] of items.entries()) {
|
|
3114
|
+
const initialInputs = {};
|
|
3115
|
+
for (const edge of lane.entries) {
|
|
3116
|
+
initialInputs[edge.target] = {
|
|
3117
|
+
...initialInputs[edge.target] ?? {},
|
|
3118
|
+
[edge.targetHandle ?? "in"]: item
|
|
3119
|
+
};
|
|
3120
|
+
}
|
|
3121
|
+
const nested = await runFlow(lane.graph, { ...ctx.executors ?? {} }, () => {
|
|
3122
|
+
}, {
|
|
3123
|
+
initialInputs,
|
|
3124
|
+
depth: (ctx.depth ?? 0) + 1,
|
|
3125
|
+
// The index rides on the identity, so a node in iteration 3 cannot share
|
|
3126
|
+
// an idempotency key with the same node in iteration 4.
|
|
3127
|
+
run: ctx.run?.descend(ctx.node.id, index2)
|
|
3128
|
+
});
|
|
3129
|
+
if (!nested.ok) {
|
|
3130
|
+
const reason = nested.error ?? "unknown error";
|
|
3131
|
+
if (decodePause(reason)) ctx.abort(reason);
|
|
3132
|
+
results.push(null);
|
|
3133
|
+
failures.push({ index: index2, item, error: reason });
|
|
3134
|
+
continue;
|
|
3135
|
+
}
|
|
3136
|
+
results.push(nested.outputs);
|
|
3137
|
+
}
|
|
3138
|
+
return {
|
|
3139
|
+
__port: "done",
|
|
3140
|
+
value: { items, results, failures, count: items.length }
|
|
3141
|
+
};
|
|
3051
3142
|
};
|
|
3052
3143
|
var manualTriggerExecutor = (ctx) => ctx.inputs;
|
|
3053
3144
|
var outputExecutor = (ctx) => {
|
|
@@ -3604,6 +3695,15 @@ var KINDS = [
|
|
|
3604
3695
|
name: "@particle-academy/for_each",
|
|
3605
3696
|
outputShape: [
|
|
3606
3697
|
{ path: "items", type: "array" },
|
|
3698
|
+
// `results` and `failures` are the WIRED shape -- what a lane produces
|
|
3699
|
+
// when the `item` port is connected. Declared unconditionally because a
|
|
3700
|
+
// declaration describes the kind, not one graph's use of it, and because
|
|
3701
|
+
// the shared table requires them: fancy-conformance 0.30.0 added
|
|
3702
|
+
// `results` and 0.31.0 added `failures`, both BREAKING, both so that a
|
|
3703
|
+
// runtime which has not implemented iteration fails here rather than
|
|
3704
|
+
// reporting surface parity it does not have.
|
|
3705
|
+
{ path: "results", type: "array" },
|
|
3706
|
+
{ path: "failures", type: "array" },
|
|
3607
3707
|
{ path: "count", type: "number" }
|
|
3608
3708
|
],
|
|
3609
3709
|
aliases: ["for_each", "@fancy/for_each"],
|
|
@@ -3612,7 +3712,7 @@ var KINDS = [
|
|
|
3612
3712
|
executor: forEachExecutor,
|
|
3613
3713
|
category: "logic",
|
|
3614
3714
|
label: "For Each",
|
|
3615
|
-
description: "
|
|
3715
|
+
description: "Wire `item` to a lane and it runs once per item, aggregating `results` and `failures` on `done`. Leave `item` unwired (or set `mode: collect`) and it just publishes the list and its size -- one node, one checkpoint.",
|
|
3616
3716
|
icon: "\u21BB",
|
|
3617
3717
|
inputs: [{ id: "in" }],
|
|
3618
3718
|
outputs: [{ id: "item", label: "item" }, { id: "done", label: "done" }],
|