@particle-academy/fancy-flow 0.23.0 → 0.25.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.
Files changed (47) hide show
  1. package/dist/{chunk-AUL4LU63.js → chunk-ATQXZEVD.js} +122 -7
  2. package/dist/chunk-ATQXZEVD.js.map +1 -0
  3. package/dist/{chunk-OHVSEHDC.js → chunk-N5ICD2WZ.js} +3 -3
  4. package/dist/{chunk-OHVSEHDC.js.map → chunk-N5ICD2WZ.js.map} +1 -1
  5. package/dist/{chunk-O7F6SGV4.js → chunk-OFW7GN3Y.js} +18 -6
  6. package/dist/chunk-OFW7GN3Y.js.map +1 -0
  7. package/dist/{chunk-ZB4HHQMR.js → chunk-OWENS2H5.js} +11 -3
  8. package/dist/chunk-OWENS2H5.js.map +1 -0
  9. package/dist/{chunk-YXRLIV7A.js → chunk-Q6IPK64P.js} +4 -2
  10. package/dist/chunk-Q6IPK64P.js.map +1 -0
  11. package/dist/{chunk-KDHLKBL2.js → chunk-U2VJB7HR.js} +7 -5
  12. package/dist/chunk-U2VJB7HR.js.map +1 -0
  13. package/dist/engine.cjs +4 -2
  14. package/dist/engine.cjs.map +1 -1
  15. package/dist/engine.js +3 -3
  16. package/dist/index.cjs +382 -130
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +7 -10
  19. package/dist/index.d.ts +7 -10
  20. package/dist/index.js +177 -64
  21. package/dist/index.js.map +1 -1
  22. package/dist/registry/index.d.cts +2 -2
  23. package/dist/registry/index.d.ts +2 -2
  24. package/dist/registry.cjs +114 -2
  25. package/dist/registry.cjs.map +1 -1
  26. package/dist/registry.js +4 -4
  27. package/dist/runtime/index.d.cts +13 -1
  28. package/dist/runtime/index.d.ts +13 -1
  29. package/dist/runtime.cjs +17 -3
  30. package/dist/runtime.cjs.map +1 -1
  31. package/dist/runtime.js +4 -4
  32. package/dist/schema.cjs.map +1 -1
  33. package/dist/schema.js +2 -2
  34. package/dist/styles.css +80 -0
  35. package/dist/styles.css.map +1 -1
  36. package/dist/{types-CFEtuRWJ.d.ts → types-BGtR3k9J.d.ts} +8 -1
  37. package/dist/{types-DneUoivl.d.cts → types-B_pxRqfw.d.cts} +8 -1
  38. package/dist/ux.cjs.map +1 -1
  39. package/dist/ux.d.cts +1 -1
  40. package/dist/ux.d.ts +1 -1
  41. package/dist/ux.js +1 -1
  42. package/package.json +1 -1
  43. package/dist/chunk-AUL4LU63.js.map +0 -1
  44. package/dist/chunk-KDHLKBL2.js.map +0 -1
  45. package/dist/chunk-O7F6SGV4.js.map +0 -1
  46. package/dist/chunk-YXRLIV7A.js.map +0 -1
  47. package/dist/chunk-ZB4HHQMR.js.map +0 -1
package/dist/registry.js CHANGED
@@ -1,10 +1,10 @@
1
- export { ANY_PORT_TYPE, BUILTIN_KINDS, DEFAULT_MAX_DEPTH, RegistryNode, buildNodeTypes, createConnectionValidator, declaredRoutes, defaultPortCompatibility, llmRouterExecutor as llmBranchExecutor, llmRouterExecutor, registerBuiltinKinds, resolveFallbackPort, subflowExecutor, subflowMode, subflowPorts } from './chunk-AUL4LU63.js';
2
- import './chunk-ZB4HHQMR.js';
1
+ export { ANY_PORT_TYPE, BUILTIN_KINDS, DEFAULT_MAX_DEPTH, RegistryNode, buildNodeTypes, createConnectionValidator, declaredRoutes, defaultPortCompatibility, llmRouterExecutor as llmBranchExecutor, llmRouterExecutor, registerBuiltinKinds, resolveFallbackPort, subflowExecutor, subflowMode, subflowPorts } from './chunk-ATQXZEVD.js';
2
+ import './chunk-OWENS2H5.js';
3
3
  export { LEGACY_PAUSE_PREFIXES, PAUSE_PREFIX, decodePause, encodePause, isPause, pauseForHuman } from './chunk-UEOE6B52.js';
4
4
  export { capabilityStatus, getLlmClient, getWorkflowResolver, isResolutionFailure, registerLlmClient, registerWorkflowResolver } from './chunk-USL4FMFU.js';
5
- import './chunk-KDHLKBL2.js';
5
+ import './chunk-U2VJB7HR.js';
6
6
  export { nodeConfig, resolveNodePorts, resolvePortSpec } from './chunk-TITD5W4Y.js';
7
- export { categoryAccent, defaultConfigFor, getNodeKind, kindIds, listNodeKinds, onNodeKindsChanged, registerNodeKind, resolveKindId, validateConfig } from './chunk-YXRLIV7A.js';
7
+ export { categoryAccent, defaultConfigFor, getNodeKind, kindIds, listNodeKinds, onNodeKindsChanged, registerNodeKind, resolveKindId, validateConfig } from './chunk-Q6IPK64P.js';
8
8
  export { RichInputPreview, getRichInputAdapter, isRichInputEnabled, onRichInputAdapterChanged, registerRichInputAdapter } from './chunk-F5RPRB7A.js';
9
9
  //# sourceMappingURL=registry.js.map
10
10
  //# sourceMappingURL=registry.js.map
@@ -16,6 +16,8 @@ type UseFlowRunReturn = {
16
16
  statuses: Record<string, NodeRunStatus>;
17
17
  /** Per-node status text (e.g. error message). */
18
18
  statusText: Record<string, string | undefined>;
19
+ /** Latest computed output value per node (for reactive kinds). */
20
+ outputs: Record<string, unknown>;
19
21
  /** Live event log (capped to last N). */
20
22
  feed: FlowRunFeedEntry[];
21
23
  /** Whether a run is currently in progress. */
@@ -39,6 +41,16 @@ type UseFlowRunOptions = {
39
41
  * the per-node status badge renders.
40
42
  */
41
43
  declare function useFlowRun({ maxFeed }?: UseFlowRunOptions): UseFlowRunReturn;
44
+ /**
45
+ * Write each reactive kind's latest run output into its `data.output`, so its
46
+ * card can render the computed value live. Non-reactive kinds are returned
47
+ * untouched. Pair with `applyStatusesToNodes` before rendering.
48
+ */
49
+ declare function applyOutputsToNodes<TNode extends {
50
+ id: string;
51
+ type?: string;
52
+ data: any;
53
+ }>(nodes: TNode[], outputs: Record<string, unknown>): TNode[];
42
54
  /** Merge runtime statuses into nodes for rendering. */
43
55
  declare function applyStatusesToNodes<TNode extends {
44
56
  id: string;
@@ -122,4 +134,4 @@ type HistoryController = {
122
134
  };
123
135
  declare function createHistory(limit?: number): HistoryController;
124
136
 
125
- export { type FlowRunFeedEntry, type HistoryController, RunOptions, RunResult, type UseFlowHistoryReturn, type UseFlowRunOptions, type UseFlowRunReturn, type UseFlowStateReturn, applyStatusesToNodes, createHistory, useFlowHistory, useFlowRun, useFlowState };
137
+ export { type FlowRunFeedEntry, type HistoryController, RunOptions, RunResult, type UseFlowHistoryReturn, type UseFlowRunOptions, type UseFlowRunReturn, type UseFlowStateReturn, applyOutputsToNodes, applyStatusesToNodes, createHistory, useFlowHistory, useFlowRun, useFlowState };
@@ -16,6 +16,8 @@ type UseFlowRunReturn = {
16
16
  statuses: Record<string, NodeRunStatus>;
17
17
  /** Per-node status text (e.g. error message). */
18
18
  statusText: Record<string, string | undefined>;
19
+ /** Latest computed output value per node (for reactive kinds). */
20
+ outputs: Record<string, unknown>;
19
21
  /** Live event log (capped to last N). */
20
22
  feed: FlowRunFeedEntry[];
21
23
  /** Whether a run is currently in progress. */
@@ -39,6 +41,16 @@ type UseFlowRunOptions = {
39
41
  * the per-node status badge renders.
40
42
  */
41
43
  declare function useFlowRun({ maxFeed }?: UseFlowRunOptions): UseFlowRunReturn;
44
+ /**
45
+ * Write each reactive kind's latest run output into its `data.output`, so its
46
+ * card can render the computed value live. Non-reactive kinds are returned
47
+ * untouched. Pair with `applyStatusesToNodes` before rendering.
48
+ */
49
+ declare function applyOutputsToNodes<TNode extends {
50
+ id: string;
51
+ type?: string;
52
+ data: any;
53
+ }>(nodes: TNode[], outputs: Record<string, unknown>): TNode[];
42
54
  /** Merge runtime statuses into nodes for rendering. */
43
55
  declare function applyStatusesToNodes<TNode extends {
44
56
  id: string;
@@ -122,4 +134,4 @@ type HistoryController = {
122
134
  };
123
135
  declare function createHistory(limit?: number): HistoryController;
124
136
 
125
- export { type FlowRunFeedEntry, type HistoryController, RunOptions, RunResult, type UseFlowHistoryReturn, type UseFlowRunOptions, type UseFlowRunReturn, type UseFlowStateReturn, applyStatusesToNodes, createHistory, useFlowHistory, useFlowRun, useFlowState };
137
+ export { type FlowRunFeedEntry, type HistoryController, RunOptions, RunResult, type UseFlowHistoryReturn, type UseFlowRunOptions, type UseFlowRunReturn, type UseFlowStateReturn, applyOutputsToNodes, applyStatusesToNodes, createHistory, useFlowHistory, useFlowRun, useFlowState };
package/dist/runtime.cjs CHANGED
@@ -77,12 +77,14 @@ async function runFlow(graph, executors, onEvent = () => {
77
77
  }
78
78
  }
79
79
  const visualKind = getNodeKind(node.type ?? "");
80
- if (node.type === "note" || visualKind?.category === "layout") {
80
+ const isLayout = visualKind?.category === "layout";
81
+ const isAnnotation = node.type === "note" || visualKind?.category === "annotation";
82
+ if (isLayout || isAnnotation) {
81
83
  onEvent({
82
84
  type: "node-status",
83
85
  nodeId: node.id,
84
86
  status: "idle",
85
- text: visualKind?.category === "layout" ? "lane" : "annotation"
87
+ text: isLayout ? "lane" : "annotation"
86
88
  });
87
89
  continue;
88
90
  }
@@ -198,6 +200,7 @@ function activatedPorts(node, result) {
198
200
  function useFlowRun({ maxFeed = 200 } = {}) {
199
201
  const [statuses, setStatuses] = ReactExports.useState({});
200
202
  const [statusText, setStatusText] = ReactExports.useState({});
203
+ const [outputs, setOutputs] = ReactExports.useState({});
201
204
  const [feed, setFeed] = ReactExports.useState([]);
202
205
  const [running, setRunning] = ReactExports.useState(false);
203
206
  const [lastResult, setLastResult] = ReactExports.useState(null);
@@ -211,6 +214,7 @@ function useFlowRun({ maxFeed = 200 } = {}) {
211
214
  appendFeed({ level: "status", text: `${e.nodeId} \u2192 ${e.status}${e.text ? ` (${e.text})` : ""}`, nodeId: e.nodeId });
212
215
  break;
213
216
  case "node-output":
217
+ setOutputs((o) => ({ ...o, [e.nodeId]: e.value }));
214
218
  appendFeed({ level: "info", text: `${e.nodeId}.${e.portId} = ${preview(e.value)}`, nodeId: e.nodeId, detail: e.value });
215
219
  break;
216
220
  case "log":
@@ -247,6 +251,7 @@ function useFlowRun({ maxFeed = 200 } = {}) {
247
251
  for (const n of graph.nodes) idleStatuses[n.id] = "idle";
248
252
  setStatuses(idleStatuses);
249
253
  setStatusText({});
254
+ setOutputs({});
250
255
  setRunning(true);
251
256
  try {
252
257
  const result = await runFlow(graph, executors, handleEvent, { ...options, signal: controller.signal });
@@ -263,10 +268,18 @@ function useFlowRun({ maxFeed = 200 } = {}) {
263
268
  const reset = ReactExports.useCallback(() => {
264
269
  setStatuses({});
265
270
  setStatusText({});
271
+ setOutputs({});
266
272
  setFeed([]);
267
273
  setLastResult(null);
268
274
  }, []);
269
- return { statuses, statusText, feed, running, lastResult, run, cancel, reset };
275
+ return { statuses, statusText, outputs, feed, running, lastResult, run, cancel, reset };
276
+ }
277
+ function applyOutputsToNodes(nodes, outputs) {
278
+ return nodes.map((n) => {
279
+ const kind = getNodeKind(n.data?.kind ?? n.type ?? "");
280
+ if (!kind?.reactive || !(n.id in outputs)) return n;
281
+ return { ...n, data: { ...n.data, output: outputs[n.id] } };
282
+ });
270
283
  }
271
284
  function applyStatusesToNodes(nodes, statuses, statusText) {
272
285
  return nodes.map((n) => ({
@@ -9313,6 +9326,7 @@ function useFlowHistory(flow) {
9313
9326
  };
9314
9327
  }
9315
9328
 
9329
+ exports.applyOutputsToNodes = applyOutputsToNodes;
9316
9330
  exports.applyStatusesToNodes = applyStatusesToNodes;
9317
9331
  exports.createHistory = createHistory;
9318
9332
  exports.runFlow = runFlow;