@particle-academy/fancy-flow 0.45.0 → 0.47.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/README.md +29 -0
- package/dist/{ConfigFieldRenderer-Dzy4f6rG.d.cts → ConfigFieldRenderer-Cyir8-B8.d.cts} +2 -2
- package/dist/{ConfigFieldRenderer-WqJr-td_.d.ts → ConfigFieldRenderer-iMkZj0VK.d.ts} +2 -2
- package/dist/{FlowViewer-BbbUJe2b.d.cts → FlowViewer-CY3_vHSg.d.cts} +1 -1
- package/dist/{FlowViewer-csuaTL5t.d.ts → FlowViewer-DGW6t-80.d.ts} +1 -1
- package/dist/{capabilities-Brn74URS.d.ts → capabilities-DMUhnyZD.d.ts} +1 -1
- package/dist/{capabilities-CYCeIx6I.d.cts → capabilities-Dmd26aAs.d.cts} +1 -1
- package/dist/chunk-BHM5HGXH.js +79 -0
- package/dist/chunk-BHM5HGXH.js.map +1 -0
- package/dist/chunk-DR3GWVDG.js +196 -0
- package/dist/chunk-DR3GWVDG.js.map +1 -0
- package/dist/{chunk-3BKU4SQZ.js → chunk-ISXRQELT.js} +3 -4
- package/dist/chunk-ISXRQELT.js.map +1 -0
- package/dist/{chunk-OWENS2H5.js → chunk-NDEX655E.js} +1603 -36
- package/dist/chunk-NDEX655E.js.map +1 -0
- package/dist/{chunk-QZTGV3ZL.js → chunk-QVFVL5LQ.js} +3 -3
- package/dist/{chunk-QZTGV3ZL.js.map → chunk-QVFVL5LQ.js.map} +1 -1
- package/dist/{chunk-DHUFUDEX.js → chunk-Z2GRNYR2.js} +7 -6
- package/dist/chunk-Z2GRNYR2.js.map +1 -0
- package/dist/{chunk-A6RFLGWV.js → chunk-ZKJJWBDJ.js} +3 -5
- package/dist/chunk-ZKJJWBDJ.js.map +1 -0
- package/dist/durable/index.d.cts +490 -0
- package/dist/durable/index.d.ts +490 -0
- package/dist/durable.cjs +10991 -0
- package/dist/durable.cjs.map +1 -0
- package/dist/durable.js +552 -0
- package/dist/durable.js.map +1 -0
- package/dist/engine.cjs +10223 -47
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.d.cts +9 -7
- package/dist/engine.d.ts +9 -7
- package/dist/engine.js +4 -6
- package/dist/engine.js.map +1 -1
- package/dist/fields/react-fancy.d.cts +4 -3
- package/dist/fields/react-fancy.d.ts +4 -3
- package/dist/index.cjs +336 -194
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -10
- package/dist/index.d.ts +12 -10
- package/dist/index.js +15 -93
- package/dist/index.js.map +1 -1
- package/dist/layout/index.d.cts +1 -1
- package/dist/layout/index.d.ts +1 -1
- package/dist/llm/prism.d.cts +2 -2
- package/dist/llm/prism.d.ts +2 -2
- package/dist/llm/vercel-ai.d.cts +2 -2
- package/dist/llm/vercel-ai.d.ts +2 -2
- package/dist/pause-9iT4tCEV.d.cts +96 -0
- package/dist/pause-9iT4tCEV.d.ts +96 -0
- package/dist/registry/index.d.cts +7 -6
- package/dist/registry/index.d.ts +7 -6
- package/dist/{registry-Budds73w.d.cts → registry-Bt55f63_.d.ts} +21 -2
- package/dist/{registry-D0I20HJ3.d.ts → registry-CkcSwmfR.d.cts} +21 -2
- package/dist/registry.cjs +3961 -3821
- package/dist/registry.cjs.map +1 -1
- package/dist/registry.js +3 -6
- package/dist/{run-cohort-CV7EcwGG.d.ts → run-cohort-Cyeny2Uu.d.ts} +3 -34
- package/dist/{run-cohort-DitsaYgS.d.cts → run-cohort-DdPPowJ3.d.cts} +3 -34
- package/dist/run-flow-1KiXhy59.d.cts +55 -0
- package/dist/run-flow-CQvTDBYk.d.ts +55 -0
- package/dist/runtime/index.d.cts +5 -3
- package/dist/runtime/index.d.ts +5 -3
- package/dist/runtime.cjs +1712 -430
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.js +5 -6
- package/dist/schema/index.d.cts +1 -1
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema.cjs +10369 -24
- package/dist/schema.cjs.map +1 -1
- package/dist/schema.js +4 -3
- package/dist/screens.cjs +1366 -38
- 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 +5 -8
- package/dist/screens.js.map +1 -1
- package/dist/{types-D6ZSKBly.d.ts → types--S2Kzx7w.d.cts} +3 -97
- package/dist/{types-nQOA8jpk.d.cts → types-ChkCRonF.d.ts} +3 -97
- package/dist/types-Jx1TwehV.d.cts +247 -0
- package/dist/types-Jx1TwehV.d.ts +247 -0
- package/dist/ux.cjs +10363 -2
- package/dist/ux.cjs.map +1 -1
- package/dist/ux.d.cts +3 -2
- package/dist/ux.d.ts +3 -2
- package/dist/ux.js +3 -1
- package/dist/ux.js.map +1 -1
- package/package.json +17 -3
- package/dist/chunk-3BKU4SQZ.js.map +0 -1
- package/dist/chunk-A6RFLGWV.js.map +0 -1
- package/dist/chunk-DHUFUDEX.js.map +0 -1
- package/dist/chunk-OWENS2H5.js.map +0 -1
- package/dist/chunk-PVROYW7C.js +0 -187
- package/dist/chunk-PVROYW7C.js.map +0 -1
- package/dist/chunk-TITD5W4Y.js +0 -26
- package/dist/chunk-TITD5W4Y.js.map +0 -1
- package/dist/chunk-VLATLVGH.js +0 -158
- package/dist/chunk-VLATLVGH.js.map +0 -1
- package/dist/chunk-WBXGZVLB.js +0 -1268
- package/dist/chunk-WBXGZVLB.js.map +0 -1
- package/dist/types-CMSrWVYM.d.cts +0 -109
- package/dist/types-CMSrWVYM.d.ts +0 -109
package/dist/screens.cjs
CHANGED
|
@@ -1000,7 +1000,7 @@ function defaultTouchable() {
|
|
|
1000
1000
|
return navigator.maxTouchPoints || "ontouchstart" in this;
|
|
1001
1001
|
}
|
|
1002
1002
|
function drag_default() {
|
|
1003
|
-
var filter2 = defaultFilter, container = defaultContainer, subject = defaultSubject, touchable = defaultTouchable, gestures = {},
|
|
1003
|
+
var filter2 = defaultFilter, container = defaultContainer, subject = defaultSubject, touchable = defaultTouchable, gestures = {}, listeners2 = dispatch_default("start", "drag", "end"), active = 0, mousedownx, mousedowny, mousemoving, touchending, clickDistance2 = 0;
|
|
1004
1004
|
function drag(selection2) {
|
|
1005
1005
|
selection2.on("mousedown.drag", mousedowned).filter(touchable).on("touchstart.drag", touchstarted).on("touchmove.drag", touchmoved, nonpassive).on("touchend.drag touchcancel.drag", touchended).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
|
|
1006
1006
|
}
|
|
@@ -1063,7 +1063,7 @@ function drag_default() {
|
|
|
1063
1063
|
}
|
|
1064
1064
|
}
|
|
1065
1065
|
function beforestart(that, container2, event, d, identifier, touch) {
|
|
1066
|
-
var dispatch2 =
|
|
1066
|
+
var dispatch2 = listeners2.copy(), p = pointer_default(touch || event, container2), dx, dy, s;
|
|
1067
1067
|
if ((s = subject.call(that, new DragEvent("beforestart", {
|
|
1068
1068
|
sourceEvent: event,
|
|
1069
1069
|
target: drag,
|
|
@@ -1122,8 +1122,8 @@ function drag_default() {
|
|
|
1122
1122
|
return arguments.length ? (touchable = typeof _ === "function" ? _ : constant_default2(!!_), drag) : touchable;
|
|
1123
1123
|
};
|
|
1124
1124
|
drag.on = function() {
|
|
1125
|
-
var value =
|
|
1126
|
-
return value ===
|
|
1125
|
+
var value = listeners2.on.apply(listeners2, arguments);
|
|
1126
|
+
return value === listeners2 ? drag : value;
|
|
1127
1127
|
};
|
|
1128
1128
|
drag.clickDistance = function(_) {
|
|
1129
1129
|
return arguments.length ? (clickDistance2 = (_ = +_) * _, drag) : Math.sqrt(clickDistance2);
|
|
@@ -2677,7 +2677,7 @@ function defaultConstrain(transform2, extent, translateExtent) {
|
|
|
2677
2677
|
);
|
|
2678
2678
|
}
|
|
2679
2679
|
function zoom_default2() {
|
|
2680
|
-
var filter2 = defaultFilter2, extent = defaultExtent, constrain = defaultConstrain, wheelDelta2 = defaultWheelDelta, touchable = defaultTouchable2, scaleExtent = [0, Infinity], translateExtent = [[-Infinity, -Infinity], [Infinity, Infinity]], duration = 250, interpolate = zoom_default,
|
|
2680
|
+
var filter2 = defaultFilter2, extent = defaultExtent, constrain = defaultConstrain, wheelDelta2 = defaultWheelDelta, touchable = defaultTouchable2, scaleExtent = [0, Infinity], translateExtent = [[-Infinity, -Infinity], [Infinity, Infinity]], duration = 250, interpolate = zoom_default, listeners2 = dispatch_default("start", "zoom", "end"), touchstarting, touchfirst, touchending, touchDelay = 500, wheelDelay = 150, clickDistance2 = 0, tapDistance = 10;
|
|
2681
2681
|
function zoom(selection2) {
|
|
2682
2682
|
selection2.property("__zoom", defaultTransform).on("wheel.zoom", wheeled, { passive: false }).on("mousedown.zoom", mousedowned).on("dblclick.zoom", dblclicked).filter(touchable).on("touchstart.zoom", touchstarted).on("touchmove.zoom", touchmoved).on("touchend.zoom touchcancel.zoom", touchended).style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
|
|
2683
2683
|
}
|
|
@@ -2789,14 +2789,14 @@ function zoom_default2() {
|
|
|
2789
2789
|
},
|
|
2790
2790
|
emit: function(type) {
|
|
2791
2791
|
var d = select_default2(this.that).datum();
|
|
2792
|
-
|
|
2792
|
+
listeners2.call(
|
|
2793
2793
|
type,
|
|
2794
2794
|
this.that,
|
|
2795
2795
|
new ZoomEvent(type, {
|
|
2796
2796
|
sourceEvent: this.sourceEvent,
|
|
2797
2797
|
target: zoom,
|
|
2798
2798
|
transform: this.that.__zoom,
|
|
2799
|
-
dispatch:
|
|
2799
|
+
dispatch: listeners2
|
|
2800
2800
|
}),
|
|
2801
2801
|
d
|
|
2802
2802
|
);
|
|
@@ -2946,8 +2946,8 @@ function zoom_default2() {
|
|
|
2946
2946
|
return arguments.length ? (interpolate = _, zoom) : interpolate;
|
|
2947
2947
|
};
|
|
2948
2948
|
zoom.on = function() {
|
|
2949
|
-
var value =
|
|
2950
|
-
return value ===
|
|
2949
|
+
var value = listeners2.on.apply(listeners2, arguments);
|
|
2950
|
+
return value === listeners2 ? zoom : value;
|
|
2951
2951
|
};
|
|
2952
2952
|
zoom.clickDistance = function(_) {
|
|
2953
2953
|
return arguments.length ? (clickDistance2 = (_ = +_) * _, zoom) : Math.sqrt(clickDistance2);
|
|
@@ -5656,20 +5656,20 @@ var use_sync_external_store_with_selector_default = { useSyncExternalStoreWithSe
|
|
|
5656
5656
|
// node_modules/zustand/esm/vanilla.mjs
|
|
5657
5657
|
var createStoreImpl = (createState) => {
|
|
5658
5658
|
let state;
|
|
5659
|
-
const
|
|
5659
|
+
const listeners2 = /* @__PURE__ */ new Set();
|
|
5660
5660
|
const setState = (partial, replace) => {
|
|
5661
5661
|
const nextState = typeof partial === "function" ? partial(state) : partial;
|
|
5662
5662
|
if (!Object.is(nextState, state)) {
|
|
5663
5663
|
const previousState = state;
|
|
5664
5664
|
state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
|
|
5665
|
-
|
|
5665
|
+
listeners2.forEach((listener) => listener(state, previousState));
|
|
5666
5666
|
}
|
|
5667
5667
|
};
|
|
5668
5668
|
const getState = () => state;
|
|
5669
5669
|
const getInitialState2 = () => initialState;
|
|
5670
5670
|
const subscribe = (listener) => {
|
|
5671
|
-
|
|
5672
|
-
return () =>
|
|
5671
|
+
listeners2.add(listener);
|
|
5672
|
+
return () => listeners2.delete(listener);
|
|
5673
5673
|
};
|
|
5674
5674
|
const destroy = () => {
|
|
5675
5675
|
if ((undefined ? undefined.MODE : void 0) !== "production") {
|
|
@@ -5677,7 +5677,7 @@ var createStoreImpl = (createState) => {
|
|
|
5677
5677
|
"[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."
|
|
5678
5678
|
);
|
|
5679
5679
|
}
|
|
5680
|
-
|
|
5680
|
+
listeners2.clear();
|
|
5681
5681
|
};
|
|
5682
5682
|
const api = { setState, getState, getInitialState: getInitialState2, subscribe, destroy };
|
|
5683
5683
|
const initialState = state = createState(setState, getState, api);
|
|
@@ -9196,12 +9196,1338 @@ function SubgraphNodeInner(props) {
|
|
|
9196
9196
|
] }) });
|
|
9197
9197
|
}
|
|
9198
9198
|
var SubgraphNode = ReactExports.memo(SubgraphNodeInner);
|
|
9199
|
+
function RichInputPreview({ config }) {
|
|
9200
|
+
const title = typeof config.title === "string" && config.title.trim() !== "" ? config.title : "Untitled step";
|
|
9201
|
+
config.document;
|
|
9202
|
+
{
|
|
9203
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ff-rich-preview", children: [
|
|
9204
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ff-rich-preview__title", children: title }),
|
|
9205
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ff-rich-preview__unavailable", children: [
|
|
9206
|
+
"Add ",
|
|
9207
|
+
/* @__PURE__ */ jsxRuntime.jsx("code", { children: "@particle-academy/fancy-cms-ui" }),
|
|
9208
|
+
" +",
|
|
9209
|
+
" ",
|
|
9210
|
+
/* @__PURE__ */ jsxRuntime.jsx("code", { children: "@particle-academy/react-fancy" }),
|
|
9211
|
+
", then",
|
|
9212
|
+
" ",
|
|
9213
|
+
/* @__PURE__ */ jsxRuntime.jsx("code", { children: 'import "@particle-academy/fancy-flow/rich-input"' }),
|
|
9214
|
+
"."
|
|
9215
|
+
] })
|
|
9216
|
+
] });
|
|
9217
|
+
}
|
|
9218
|
+
}
|
|
9219
|
+
|
|
9220
|
+
// src/registry/capabilities.ts
|
|
9221
|
+
var llmClient = null;
|
|
9222
|
+
function getLlmClient() {
|
|
9223
|
+
return llmClient;
|
|
9224
|
+
}
|
|
9225
|
+
function isResolutionFailure(value) {
|
|
9226
|
+
return typeof value === "object" && value !== null && "reason" in value && value.reason !== void 0;
|
|
9227
|
+
}
|
|
9228
|
+
var workflowResolver = null;
|
|
9229
|
+
function getWorkflowResolver() {
|
|
9230
|
+
return workflowResolver;
|
|
9231
|
+
}
|
|
9232
|
+
|
|
9233
|
+
// src/registry/llm-router.ts
|
|
9234
|
+
function declaredRoutes(config) {
|
|
9235
|
+
const raw = config.routes;
|
|
9236
|
+
if (!Array.isArray(raw)) return [];
|
|
9237
|
+
return raw.map((r) => ({ port: String(r?.port ?? "").trim(), description: r?.description })).filter((r) => r.port !== "");
|
|
9238
|
+
}
|
|
9239
|
+
function resolveFallbackPort(routes, fallbackEnabled) {
|
|
9240
|
+
if (fallbackEnabled) return "fallback";
|
|
9241
|
+
return routes[0]?.port ?? "out";
|
|
9242
|
+
}
|
|
9243
|
+
var llmRouterExecutor = async (ctx) => {
|
|
9244
|
+
const config = ctx.node.data?.config ?? {};
|
|
9245
|
+
const routes = declaredRoutes(config);
|
|
9246
|
+
if (routes.length === 0) {
|
|
9247
|
+
ctx.abort("llm_router has no routes configured");
|
|
9248
|
+
}
|
|
9249
|
+
const client = getLlmClient();
|
|
9250
|
+
{
|
|
9251
|
+
ctx.abort(
|
|
9252
|
+
"No LLM client registered. Call registerLlmClient() with your provider adapter \u2014 fancy-flow ships the routing, not the model call."
|
|
9253
|
+
);
|
|
9254
|
+
}
|
|
9255
|
+
const fallbackEnabled = config.fallback !== false;
|
|
9256
|
+
const choice = await client.chooseRoute({
|
|
9257
|
+
system: typeof config.system === "string" ? config.system : void 0,
|
|
9258
|
+
prompt: String(config.prompt ?? ctx.inputs ?? ""),
|
|
9259
|
+
routes,
|
|
9260
|
+
provider: typeof config.provider === "string" ? config.provider : void 0,
|
|
9261
|
+
model: typeof config.model === "string" ? config.model : void 0,
|
|
9262
|
+
credential: typeof config.credential === "string" ? config.credential : void 0
|
|
9263
|
+
});
|
|
9264
|
+
const offered = new Set(routes.map((r) => r.port));
|
|
9265
|
+
let port = choice?.port ?? "";
|
|
9266
|
+
let reason = choice?.reason;
|
|
9267
|
+
if (!offered.has(port)) {
|
|
9268
|
+
const safe = resolveFallbackPort(routes, fallbackEnabled);
|
|
9269
|
+
ctx.emit({
|
|
9270
|
+
type: "log",
|
|
9271
|
+
nodeId: ctx.node.id,
|
|
9272
|
+
level: "warn",
|
|
9273
|
+
message: `llm_router: model returned "${port || "(nothing)"}", which is not a declared route. Routing to "${safe}".`
|
|
9274
|
+
});
|
|
9275
|
+
reason = reason ?? `unrecognised route "${port}"`;
|
|
9276
|
+
port = safe;
|
|
9277
|
+
}
|
|
9278
|
+
return { __port: port, value: { route: port, reason, input: ctx.inputs } };
|
|
9279
|
+
};
|
|
9280
|
+
|
|
9281
|
+
// src/registry/ports.ts
|
|
9282
|
+
function resolvePortSpec(spec, config) {
|
|
9283
|
+
if (spec === void 0) return void 0;
|
|
9284
|
+
if (typeof spec !== "function") return spec;
|
|
9285
|
+
try {
|
|
9286
|
+
const resolved = spec(config);
|
|
9287
|
+
return Array.isArray(resolved) ? resolved : void 0;
|
|
9288
|
+
} catch {
|
|
9289
|
+
return void 0;
|
|
9290
|
+
}
|
|
9291
|
+
}
|
|
9292
|
+
function nodeConfig(node) {
|
|
9293
|
+
return node.data?.config ?? {};
|
|
9294
|
+
}
|
|
9295
|
+
function resolveNodePorts(node, kind) {
|
|
9296
|
+
const config = nodeConfig(node);
|
|
9297
|
+
const data = node.data;
|
|
9298
|
+
return {
|
|
9299
|
+
inputs: data?.inputs ?? resolvePortSpec(kind?.inputs, config),
|
|
9300
|
+
outputs: data?.outputs ?? resolvePortSpec(kind?.outputs, config)
|
|
9301
|
+
};
|
|
9302
|
+
}
|
|
9303
|
+
|
|
9304
|
+
// src/runtime/run-identity.ts
|
|
9305
|
+
function escapeSegment(value) {
|
|
9306
|
+
return value.replace(/%/g, "%25").replace(/\//g, "%2F").replace(/#/g, "%23");
|
|
9307
|
+
}
|
|
9308
|
+
function renderSegment(value, occurrence) {
|
|
9309
|
+
const escaped = escapeSegment(value);
|
|
9310
|
+
return occurrence === void 0 || occurrence === null ? escaped : `${escaped}#${occurrence}`;
|
|
9311
|
+
}
|
|
9312
|
+
function instant(value) {
|
|
9313
|
+
const ms = Date.parse(value);
|
|
9314
|
+
if (Number.isNaN(ms)) {
|
|
9315
|
+
throw new Error(
|
|
9316
|
+
`RunIdentity: firstAttemptAt is not a parseable timestamp: ${JSON.stringify(value)}`
|
|
9317
|
+
);
|
|
9318
|
+
}
|
|
9319
|
+
return ms;
|
|
9320
|
+
}
|
|
9321
|
+
var RunIdentity = class _RunIdentity {
|
|
9322
|
+
constructor(runKey, path = [], attempt = 1, firstAttemptAt = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
9323
|
+
if (!runKey || runKey.trim() === "") {
|
|
9324
|
+
throw new Error("RunIdentity: runKey must be a non-empty string.");
|
|
9325
|
+
}
|
|
9326
|
+
this.runKey = runKey;
|
|
9327
|
+
this.path = Object.freeze([...path]);
|
|
9328
|
+
this.attempt = Math.max(1, Math.trunc(attempt));
|
|
9329
|
+
this.firstAttemptAt = firstAttemptAt;
|
|
9330
|
+
Object.freeze(this);
|
|
9331
|
+
}
|
|
9332
|
+
/**
|
|
9333
|
+
* The identity of one execution of one node — stable across retries of that
|
|
9334
|
+
* execution, distinct from every other execution of the same node.
|
|
9335
|
+
*
|
|
9336
|
+
* Pass `occurrence` when an executor runs the same node more than once at the
|
|
9337
|
+
* same level (a loop body, one item of a fan-out it drives itself).
|
|
9338
|
+
*/
|
|
9339
|
+
stepKey(nodeId, occurrence) {
|
|
9340
|
+
return `${this.runKey}:${[...this.path, renderSegment(nodeId, occurrence)].join("/")}`;
|
|
9341
|
+
}
|
|
9342
|
+
/**
|
|
9343
|
+
* A child identity for work nested inside this step.
|
|
9344
|
+
*
|
|
9345
|
+
* `subflow` pushes the invoking node's id, so a node inside the child graph
|
|
9346
|
+
* cannot collide with a same-named node in the parent. Attempt and
|
|
9347
|
+
* `firstAttemptAt` are carried down unchanged: the nested work happens inside
|
|
9348
|
+
* this step's attempt, and shares its clock.
|
|
9349
|
+
*/
|
|
9350
|
+
descend(segment, occurrence) {
|
|
9351
|
+
return new _RunIdentity(
|
|
9352
|
+
this.runKey,
|
|
9353
|
+
[...this.path, renderSegment(segment, occurrence)],
|
|
9354
|
+
this.attempt,
|
|
9355
|
+
this.firstAttemptAt
|
|
9356
|
+
);
|
|
9357
|
+
}
|
|
9358
|
+
/** A copy on a different attempt, first-attempt clock preserved. */
|
|
9359
|
+
withAttempt(attempt, firstAttemptAt) {
|
|
9360
|
+
return new _RunIdentity(
|
|
9361
|
+
this.runKey,
|
|
9362
|
+
this.path,
|
|
9363
|
+
attempt,
|
|
9364
|
+
firstAttemptAt ?? this.firstAttemptAt
|
|
9365
|
+
);
|
|
9366
|
+
}
|
|
9367
|
+
/**
|
|
9368
|
+
* May this attempt reuse the step key and still be deduplicated?
|
|
9369
|
+
*
|
|
9370
|
+
* Providers forget idempotency keys — Stripe after 24 hours. Past that
|
|
9371
|
+
* window, resending the key creates a second charge and sending a fresh one
|
|
9372
|
+
* creates a second charge, so **the caller must refuse rather than pick
|
|
9373
|
+
* between them**: a loud stuck run beats a silent double write.
|
|
9374
|
+
*
|
|
9375
|
+
* `true` on attempt 1 whatever the elapsed time — nothing was sent on an
|
|
9376
|
+
* earlier attempt, so there is nothing for the provider to have forgotten.
|
|
9377
|
+
* That is what lets a run park on a human gate for a week and then write.
|
|
9378
|
+
*
|
|
9379
|
+
* `windowSeconds: null` means the provider does not expire keys. `0` means
|
|
9380
|
+
* it does not dedupe at all, so no retry may reuse a key — it is a real
|
|
9381
|
+
* window, not an absent one, and the two must not be conflated: reading `0`
|
|
9382
|
+
* as `null` turns "this provider does not dedupe" into "this provider
|
|
9383
|
+
* dedupes forever", which is the more dangerous of the two by a distance.
|
|
9384
|
+
*/
|
|
9385
|
+
isReplaySafe(windowSeconds, now2 = /* @__PURE__ */ new Date()) {
|
|
9386
|
+
if (this.attempt <= 1) return true;
|
|
9387
|
+
if (windowSeconds === null || windowSeconds === void 0) return true;
|
|
9388
|
+
if (windowSeconds <= 0) return false;
|
|
9389
|
+
const nowMs = typeof now2 === "string" ? instant(now2) : now2.getTime();
|
|
9390
|
+
const elapsedSeconds = Math.max(0, (nowMs - instant(this.firstAttemptAt)) / 1e3);
|
|
9391
|
+
return elapsedSeconds <= windowSeconds;
|
|
9392
|
+
}
|
|
9393
|
+
toJSON() {
|
|
9394
|
+
return {
|
|
9395
|
+
runKey: this.runKey,
|
|
9396
|
+
path: [...this.path],
|
|
9397
|
+
attempt: this.attempt,
|
|
9398
|
+
firstAttemptAt: this.firstAttemptAt
|
|
9399
|
+
};
|
|
9400
|
+
}
|
|
9401
|
+
/** Rebuild from a queue payload. */
|
|
9402
|
+
static from(value) {
|
|
9403
|
+
if (value instanceof _RunIdentity) return value;
|
|
9404
|
+
if (typeof value === "string") return new _RunIdentity(value);
|
|
9405
|
+
return new _RunIdentity(
|
|
9406
|
+
value.runKey,
|
|
9407
|
+
value.path ?? [],
|
|
9408
|
+
value.attempt ?? 1,
|
|
9409
|
+
value.firstAttemptAt ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
9410
|
+
);
|
|
9411
|
+
}
|
|
9412
|
+
};
|
|
9413
|
+
|
|
9414
|
+
// src/runtime/run-flow.ts
|
|
9415
|
+
async function runFlow(graph, executors, onEvent = () => {
|
|
9416
|
+
}, options = {}) {
|
|
9417
|
+
const { signal, initialInputs = {}, timeoutMs, depth = 0, resumeOutputs = {} } = options;
|
|
9418
|
+
const run = options.run === void 0 ? void 0 : RunIdentity.from(options.run);
|
|
9419
|
+
const outputs = {};
|
|
9420
|
+
const portValues = /* @__PURE__ */ new Map();
|
|
9421
|
+
const completed = /* @__PURE__ */ new Set();
|
|
9422
|
+
const errors = [];
|
|
9423
|
+
const order = topoSort(graph);
|
|
9424
|
+
if (order === null) {
|
|
9425
|
+
const msg = "Cycle detected in flow graph \u2014 aborting.";
|
|
9426
|
+
onEvent({ type: "run-error", error: msg });
|
|
9427
|
+
return { ok: false, outputs, error: msg };
|
|
9428
|
+
}
|
|
9429
|
+
const incomingByNode = indexIncoming(graph.edges);
|
|
9430
|
+
const timer2 = timeoutMs ? setTimeout(() => errors.push(`Run timed out after ${timeoutMs}ms`), timeoutMs) : null;
|
|
9431
|
+
onEvent({ type: "run-start" });
|
|
9432
|
+
try {
|
|
9433
|
+
for (const node of order) {
|
|
9434
|
+
if (signal?.aborted) throw new Error("aborted");
|
|
9435
|
+
if (errors.length) break;
|
|
9436
|
+
if (Object.prototype.hasOwnProperty.call(resumeOutputs, node.id)) {
|
|
9437
|
+
const stored = resumeOutputs[node.id];
|
|
9438
|
+
outputs[node.id] = stored;
|
|
9439
|
+
const activated = activatedPorts(node, stored);
|
|
9440
|
+
for (const portId of activated.ports) {
|
|
9441
|
+
portValues.set(`${node.id}:${portId}`, activated.value);
|
|
9442
|
+
onEvent({ type: "node-output", nodeId: node.id, portId, value: activated.value });
|
|
9443
|
+
}
|
|
9444
|
+
completed.add(node.id);
|
|
9445
|
+
onEvent({ type: "node-status", nodeId: node.id, status: "done", text: "resumed" });
|
|
9446
|
+
continue;
|
|
9447
|
+
}
|
|
9448
|
+
const incoming = incomingByNode.get(node.id) ?? [];
|
|
9449
|
+
if (incoming.length > 0) {
|
|
9450
|
+
const anyActive = incoming.some((e) => portValues.has(`${e.source}:${e.sourceHandle ?? "out"}`));
|
|
9451
|
+
if (!anyActive) {
|
|
9452
|
+
onEvent({ type: "node-status", nodeId: node.id, status: "idle", text: "skipped" });
|
|
9453
|
+
continue;
|
|
9454
|
+
}
|
|
9455
|
+
}
|
|
9456
|
+
const visualKind = getNodeKind(node.type ?? "");
|
|
9457
|
+
const isLayout = visualKind?.category === "layout";
|
|
9458
|
+
const isAnnotation = node.type === "note" || visualKind?.category === "annotation";
|
|
9459
|
+
if (isLayout || isAnnotation) {
|
|
9460
|
+
onEvent({
|
|
9461
|
+
type: "node-status",
|
|
9462
|
+
nodeId: node.id,
|
|
9463
|
+
status: "idle",
|
|
9464
|
+
text: isLayout ? "lane" : "annotation"
|
|
9465
|
+
});
|
|
9466
|
+
continue;
|
|
9467
|
+
}
|
|
9468
|
+
onEvent({ type: "node-status", nodeId: node.id, status: "running" });
|
|
9469
|
+
const inputs = collectInputs(node, incoming, portValues, initialInputs);
|
|
9470
|
+
const exec = pickExecutor(executors, node);
|
|
9471
|
+
if (!exec) {
|
|
9472
|
+
const msg = `No executor registered for kind=${node.type}`;
|
|
9473
|
+
errors.push(msg);
|
|
9474
|
+
onEvent({ type: "node-status", nodeId: node.id, status: "error", text: msg });
|
|
9475
|
+
onEvent({ type: "log", nodeId: node.id, level: "error", message: msg });
|
|
9476
|
+
break;
|
|
9477
|
+
}
|
|
9478
|
+
try {
|
|
9479
|
+
const result = await Promise.resolve(
|
|
9480
|
+
exec({
|
|
9481
|
+
node,
|
|
9482
|
+
inputs,
|
|
9483
|
+
abort: (reason) => {
|
|
9484
|
+
throw new Error(reason ?? "aborted");
|
|
9485
|
+
},
|
|
9486
|
+
emit: onEvent,
|
|
9487
|
+
depth,
|
|
9488
|
+
run
|
|
9489
|
+
})
|
|
9490
|
+
);
|
|
9491
|
+
outputs[node.id] = result;
|
|
9492
|
+
const activated = activatedPorts(node, result);
|
|
9493
|
+
for (const portId of activated.ports) {
|
|
9494
|
+
portValues.set(`${node.id}:${portId}`, activated.value);
|
|
9495
|
+
onEvent({ type: "node-output", nodeId: node.id, portId, value: activated.value });
|
|
9496
|
+
}
|
|
9497
|
+
completed.add(node.id);
|
|
9498
|
+
onEvent({ type: "node-status", nodeId: node.id, status: "done" });
|
|
9499
|
+
} catch (e) {
|
|
9500
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
9501
|
+
errors.push(msg);
|
|
9502
|
+
onEvent({ type: "node-status", nodeId: node.id, status: "error", text: msg });
|
|
9503
|
+
onEvent({ type: "log", nodeId: node.id, level: "error", message: msg });
|
|
9504
|
+
break;
|
|
9505
|
+
}
|
|
9506
|
+
}
|
|
9507
|
+
} finally {
|
|
9508
|
+
if (timer2) clearTimeout(timer2);
|
|
9509
|
+
}
|
|
9510
|
+
const ok = errors.length === 0;
|
|
9511
|
+
onEvent({ type: "run-end", ok });
|
|
9512
|
+
return ok ? { ok, outputs } : { ok, outputs, error: errors[0] };
|
|
9513
|
+
}
|
|
9514
|
+
function indexIncoming(edges) {
|
|
9515
|
+
const map = /* @__PURE__ */ new Map();
|
|
9516
|
+
for (const e of edges) {
|
|
9517
|
+
const list = map.get(e.target) ?? [];
|
|
9518
|
+
list.push(e);
|
|
9519
|
+
map.set(e.target, list);
|
|
9520
|
+
}
|
|
9521
|
+
return map;
|
|
9522
|
+
}
|
|
9523
|
+
function topoSort(graph) {
|
|
9524
|
+
const inDegree = /* @__PURE__ */ new Map();
|
|
9525
|
+
for (const n of graph.nodes) inDegree.set(n.id, 0);
|
|
9526
|
+
for (const e of graph.edges) inDegree.set(e.target, (inDegree.get(e.target) ?? 0) + 1);
|
|
9527
|
+
const queue = [];
|
|
9528
|
+
for (const [id2, d] of inDegree) if (d === 0) queue.push(id2);
|
|
9529
|
+
const ordered = [];
|
|
9530
|
+
while (queue.length) {
|
|
9531
|
+
const id2 = queue.shift();
|
|
9532
|
+
ordered.push(id2);
|
|
9533
|
+
for (const e of graph.edges) {
|
|
9534
|
+
if (e.source !== id2) continue;
|
|
9535
|
+
const next = (inDegree.get(e.target) ?? 0) - 1;
|
|
9536
|
+
inDegree.set(e.target, next);
|
|
9537
|
+
if (next === 0) queue.push(e.target);
|
|
9538
|
+
}
|
|
9539
|
+
}
|
|
9540
|
+
if (ordered.length !== graph.nodes.length) return null;
|
|
9541
|
+
const byId = new Map(graph.nodes.map((n) => [n.id, n]));
|
|
9542
|
+
return ordered.map((id2) => byId.get(id2)).filter(Boolean);
|
|
9543
|
+
}
|
|
9544
|
+
function collectInputs(node, incoming, portValues, initial) {
|
|
9545
|
+
const inputs = { ...initial[node.id] ?? {} };
|
|
9546
|
+
for (const e of incoming) {
|
|
9547
|
+
const portId = e.targetHandle ?? "in";
|
|
9548
|
+
const key = `${e.source}:${e.sourceHandle ?? "out"}`;
|
|
9549
|
+
if (!portValues.has(key)) continue;
|
|
9550
|
+
inputs[portId] = portValues.get(key);
|
|
9551
|
+
}
|
|
9552
|
+
return inputs;
|
|
9553
|
+
}
|
|
9554
|
+
function pickExecutor(executors, node) {
|
|
9555
|
+
if (executors[node.id]) return executors[node.id];
|
|
9556
|
+
if (node.type && executors[node.type]) return executors[node.type];
|
|
9557
|
+
const kind = node.type ? getNodeKind(node.type) : null;
|
|
9558
|
+
if (kind) {
|
|
9559
|
+
for (const id2 of kindIds(kind)) {
|
|
9560
|
+
if (executors[id2]) return executors[id2];
|
|
9561
|
+
}
|
|
9562
|
+
}
|
|
9563
|
+
return executors["*"];
|
|
9564
|
+
}
|
|
9565
|
+
function activatedPorts(node, result) {
|
|
9566
|
+
if (result && typeof result === "object") {
|
|
9567
|
+
const r = result;
|
|
9568
|
+
if (typeof r.__port === "string") {
|
|
9569
|
+
return { ports: [r.__port], value: r.value };
|
|
9570
|
+
}
|
|
9571
|
+
if (typeof r.branch === "string") {
|
|
9572
|
+
return { ports: [r.branch], value: r.value ?? r };
|
|
9573
|
+
}
|
|
9574
|
+
}
|
|
9575
|
+
const kind = getNodeKind(node.data?.kind ?? node.type ?? "") ?? void 0;
|
|
9576
|
+
const declared = resolveNodePorts(node, kind).outputs?.map((p) => p.id);
|
|
9577
|
+
return { ports: declared?.length ? declared : ["out"], value: result };
|
|
9578
|
+
}
|
|
9579
|
+
|
|
9580
|
+
// src/registry/subflow.ts
|
|
9581
|
+
var DEFAULT_MAX_DEPTH = 8;
|
|
9582
|
+
function subflowMode(config) {
|
|
9583
|
+
const mode = config.mode;
|
|
9584
|
+
return mode === "stream" || mode === "both" ? mode : "output";
|
|
9585
|
+
}
|
|
9586
|
+
function subflowPorts(config) {
|
|
9587
|
+
const mode = subflowMode(config);
|
|
9588
|
+
const ports = [{ id: "out", label: "result" }];
|
|
9589
|
+
if (mode === "stream" || mode === "both") ports.unshift({ id: "stream", label: "stream" });
|
|
9590
|
+
return ports;
|
|
9591
|
+
}
|
|
9592
|
+
var subflowExecutor = async (ctx) => {
|
|
9593
|
+
const config = ctx.node.data?.config ?? {};
|
|
9594
|
+
const ref = String(config.workflow ?? "").trim();
|
|
9595
|
+
if (!ref) ctx.abort("subflow has no workflow reference configured");
|
|
9596
|
+
const resolver = getWorkflowResolver();
|
|
9597
|
+
{
|
|
9598
|
+
ctx.abort(
|
|
9599
|
+
"No workflow resolver registered. Call registerWorkflowResolver() so subflow can find the workflow it references."
|
|
9600
|
+
);
|
|
9601
|
+
}
|
|
9602
|
+
const maxDepth = Number.isFinite(config.maxDepth) ? Number(config.maxDepth) : DEFAULT_MAX_DEPTH;
|
|
9603
|
+
const depth = ctx.depth ?? 0;
|
|
9604
|
+
if (depth + 1 > maxDepth) {
|
|
9605
|
+
ctx.abort(
|
|
9606
|
+
`subflow depth limit reached (${maxDepth}) at "${ref}" \u2014 a workflow is referencing itself, directly or through a chain.`
|
|
9607
|
+
);
|
|
9608
|
+
}
|
|
9609
|
+
const pinned = config.version === void 0 || config.version === "" ? void 0 : Number(config.version);
|
|
9610
|
+
if (pinned !== void 0 && !Number.isInteger(pinned)) {
|
|
9611
|
+
ctx.abort(`subflow "${ref}" has a non-integer version pin (${String(config.version)}).`);
|
|
9612
|
+
}
|
|
9613
|
+
const resolved = await resolver(ref, pinned);
|
|
9614
|
+
const child = isResolutionFailure(resolved) ? ctx.abort(
|
|
9615
|
+
resolved.reason === "version-mismatch" ? resolved.message ?? `subflow "${ref}" is pinned to version ${pinned}, but the host has ${resolved.available ?? "a different version"}.` : resolved.message ?? `subflow could not resolve workflow "${ref}"`
|
|
9616
|
+
) : resolved;
|
|
9617
|
+
if (!child) ctx.abort(`subflow could not resolve workflow "${ref}"`);
|
|
9618
|
+
const mode = subflowMode(config);
|
|
9619
|
+
const streaming = mode === "stream" || mode === "both";
|
|
9620
|
+
const forward = (event) => {
|
|
9621
|
+
if (!streaming) return;
|
|
9622
|
+
const detail = event.type === "node-status" ? `${event.nodeId} ${event.status}` : event.type === "run-end" ? `finished (${event.ok ? "ok" : "failed"})` : event.type;
|
|
9623
|
+
ctx.emit({
|
|
9624
|
+
type: "log",
|
|
9625
|
+
nodeId: ctx.node.id,
|
|
9626
|
+
level: "info",
|
|
9627
|
+
message: `[${ref}] ${detail}`
|
|
9628
|
+
});
|
|
9629
|
+
};
|
|
9630
|
+
const result = await runFlow(
|
|
9631
|
+
child,
|
|
9632
|
+
config.executors ?? {},
|
|
9633
|
+
forward,
|
|
9634
|
+
{
|
|
9635
|
+
initialInputs: config.inputs ?? {
|
|
9636
|
+
// With no explicit mapping, hand the parent's inputs to the child's
|
|
9637
|
+
// entry points — the obvious default, and it makes the simple case
|
|
9638
|
+
// require no configuration at all.
|
|
9639
|
+
__parent: ctx.inputs
|
|
9640
|
+
},
|
|
9641
|
+
depth: depth + 1,
|
|
9642
|
+
// Push THIS node onto the identity path, so a node inside the child graph
|
|
9643
|
+
// cannot share an idempotency key with a same-named node in the parent —
|
|
9644
|
+
// or with the same child graph invoked from a different parent node.
|
|
9645
|
+
// Attempt and the first-attempt clock ride down unchanged: the child's
|
|
9646
|
+
// work happens inside this node's attempt.
|
|
9647
|
+
run: ctx.run?.descend(ctx.node.id)
|
|
9648
|
+
}
|
|
9649
|
+
);
|
|
9650
|
+
if (!result.ok) {
|
|
9651
|
+
ctx.abort(`subflow "${ref}" failed: ${result.error ?? "unknown error"}`);
|
|
9652
|
+
}
|
|
9653
|
+
if (mode === "stream") {
|
|
9654
|
+
return { __port: "stream", value: result.outputs };
|
|
9655
|
+
}
|
|
9656
|
+
if (mode === "both") {
|
|
9657
|
+
return result.outputs;
|
|
9658
|
+
}
|
|
9659
|
+
return { __port: "out", value: result.outputs };
|
|
9660
|
+
};
|
|
9661
|
+
|
|
9662
|
+
// src/registry/builtin.ts
|
|
9663
|
+
function casePorts(cases) {
|
|
9664
|
+
const byPort = /* @__PURE__ */ new Map();
|
|
9665
|
+
if (cases && typeof cases === "object" && !Array.isArray(cases)) {
|
|
9666
|
+
for (const [match, port] of Object.entries(cases)) {
|
|
9667
|
+
if (typeof port !== "string" || port === "" || port === "default") continue;
|
|
9668
|
+
const matches = byPort.get(port) ?? [];
|
|
9669
|
+
matches.push(match);
|
|
9670
|
+
byPort.set(port, matches);
|
|
9671
|
+
}
|
|
9672
|
+
}
|
|
9673
|
+
const ports = [...byPort].map(([id2, matches]) => ({
|
|
9674
|
+
id: id2,
|
|
9675
|
+
label: matches.join("|")
|
|
9676
|
+
}));
|
|
9677
|
+
return [...ports, { id: "default", label: "default" }];
|
|
9678
|
+
}
|
|
9679
|
+
function routePorts(routes, fallback) {
|
|
9680
|
+
const ports = [];
|
|
9681
|
+
const seen = /* @__PURE__ */ new Set();
|
|
9682
|
+
if (Array.isArray(routes)) {
|
|
9683
|
+
for (const route of routes) {
|
|
9684
|
+
const id2 = route?.port;
|
|
9685
|
+
if (typeof id2 !== "string" || id2.trim() === "" || seen.has(id2)) continue;
|
|
9686
|
+
seen.add(id2);
|
|
9687
|
+
ports.push({ id: id2, label: id2 });
|
|
9688
|
+
}
|
|
9689
|
+
}
|
|
9690
|
+
if (fallback !== false && !seen.has("fallback")) {
|
|
9691
|
+
ports.push({ id: "fallback", label: "fallback" });
|
|
9692
|
+
}
|
|
9693
|
+
if (ports.length === 0) ports.push({ id: "out" });
|
|
9694
|
+
return ports;
|
|
9695
|
+
}
|
|
9696
|
+
var HTTP_METHODS = [
|
|
9697
|
+
{ type: "select", key: "method", label: "Method", options: [
|
|
9698
|
+
{ value: "GET", label: "GET" },
|
|
9699
|
+
{ value: "POST", label: "POST" },
|
|
9700
|
+
{ value: "PUT", label: "PUT" },
|
|
9701
|
+
{ value: "PATCH", label: "PATCH" },
|
|
9702
|
+
{ value: "DELETE", label: "DELETE" }
|
|
9703
|
+
], default: "GET", required: true }
|
|
9704
|
+
];
|
|
9705
|
+
var KINDS = [
|
|
9706
|
+
// ───────────── Triggers ─────────────
|
|
9707
|
+
{
|
|
9708
|
+
name: "@particle-academy/manual_trigger",
|
|
9709
|
+
aliases: ["manual_trigger", "@fancy/manual_trigger"],
|
|
9710
|
+
category: "trigger",
|
|
9711
|
+
label: "Manual",
|
|
9712
|
+
description: "Entry point fired when the user clicks Run.",
|
|
9713
|
+
icon: "\u26A1",
|
|
9714
|
+
inputs: [],
|
|
9715
|
+
outputs: [{ id: "out" }]
|
|
9716
|
+
},
|
|
9717
|
+
{
|
|
9718
|
+
name: "@particle-academy/webhook_trigger",
|
|
9719
|
+
aliases: ["webhook_trigger", "@fancy/webhook_trigger"],
|
|
9720
|
+
category: "trigger",
|
|
9721
|
+
label: "Webhook",
|
|
9722
|
+
description: "Triggered by an inbound HTTP request to a host-provided URL.",
|
|
9723
|
+
icon: "\u{1F4E1}",
|
|
9724
|
+
inputs: [],
|
|
9725
|
+
outputs: [{ id: "out", label: "payload" }],
|
|
9726
|
+
configSchema: [
|
|
9727
|
+
{ type: "text", key: "path", label: "Path", placeholder: "/hooks/my-flow", required: true },
|
|
9728
|
+
{ type: "select", key: "method", label: "Method", options: [
|
|
9729
|
+
{ value: "POST", label: "POST" },
|
|
9730
|
+
{ value: "GET", label: "GET" }
|
|
9731
|
+
], default: "POST" },
|
|
9732
|
+
{ type: "credential", key: "secret", label: "Verifying secret", credentialType: "webhook_secret" }
|
|
9733
|
+
]
|
|
9734
|
+
},
|
|
9735
|
+
{
|
|
9736
|
+
name: "@particle-academy/schedule_trigger",
|
|
9737
|
+
aliases: ["schedule_trigger", "@fancy/schedule_trigger"],
|
|
9738
|
+
category: "trigger",
|
|
9739
|
+
label: "Schedule",
|
|
9740
|
+
description: "Fires on a cron schedule (host-implemented).",
|
|
9741
|
+
icon: "\u23F1",
|
|
9742
|
+
inputs: [],
|
|
9743
|
+
outputs: [{ id: "out" }],
|
|
9744
|
+
configSchema: [
|
|
9745
|
+
{
|
|
9746
|
+
type: "text",
|
|
9747
|
+
key: "cron",
|
|
9748
|
+
label: "Cron",
|
|
9749
|
+
placeholder: "*/5 * * * *",
|
|
9750
|
+
required: true,
|
|
9751
|
+
description: "Standard 5-field cron expression."
|
|
9752
|
+
},
|
|
9753
|
+
{ type: "text", key: "timezone", label: "Timezone", placeholder: "UTC", default: "UTC" }
|
|
9754
|
+
]
|
|
9755
|
+
},
|
|
9756
|
+
{
|
|
9757
|
+
name: "@particle-academy/user_input",
|
|
9758
|
+
// The keys an author declared on THIS node — the case a static list cannot
|
|
9759
|
+
// express, and the one issue #5 named.
|
|
9760
|
+
outputShape: (config) => (config.fields ?? []).filter((f) => typeof f.key === "string" && f.key !== "").map((f) => ({ path: f.key, type: "string", description: f.label })),
|
|
9761
|
+
aliases: ["user_input", "@fancy/user_input"],
|
|
9762
|
+
pausesForHuman: "input",
|
|
9763
|
+
category: "human",
|
|
9764
|
+
label: "User Input",
|
|
9765
|
+
description: "Pause the flow until the user submits the configured form.",
|
|
9766
|
+
icon: "\u270E",
|
|
9767
|
+
inputs: [{ id: "in" }],
|
|
9768
|
+
outputs: [{ id: "out", label: "values" }],
|
|
9769
|
+
configSchema: [
|
|
9770
|
+
{ type: "text", key: "title", label: "Form title", default: "Need your input" },
|
|
9771
|
+
{
|
|
9772
|
+
type: "repeater",
|
|
9773
|
+
key: "fields",
|
|
9774
|
+
label: "Fields",
|
|
9775
|
+
description: "The form the run pauses on.",
|
|
9776
|
+
titleKey: "label",
|
|
9777
|
+
addLabel: "Add field",
|
|
9778
|
+
minItems: 1,
|
|
9779
|
+
fields: [
|
|
9780
|
+
{ type: "text", key: "key", label: "Key", required: true, placeholder: "answer" },
|
|
9781
|
+
{ type: "text", key: "label", label: "Label", required: true, placeholder: "Your answer" },
|
|
9782
|
+
{
|
|
9783
|
+
type: "select",
|
|
9784
|
+
key: "type",
|
|
9785
|
+
label: "Type",
|
|
9786
|
+
default: "text",
|
|
9787
|
+
options: [
|
|
9788
|
+
{ value: "text", label: "Text" },
|
|
9789
|
+
{ value: "textarea", label: "Long text" },
|
|
9790
|
+
{ value: "number", label: "Number" },
|
|
9791
|
+
{ value: "select", label: "Select" },
|
|
9792
|
+
{ value: "switch", label: "Switch" }
|
|
9793
|
+
]
|
|
9794
|
+
},
|
|
9795
|
+
{ type: "switch", key: "required", label: "Required", default: false }
|
|
9796
|
+
],
|
|
9797
|
+
default: [{ key: "answer", label: "Your answer", type: "textarea", required: true }]
|
|
9798
|
+
}
|
|
9799
|
+
]
|
|
9800
|
+
},
|
|
9801
|
+
{
|
|
9802
|
+
name: "@particle-academy/rich_user_input",
|
|
9803
|
+
aliases: ["rich_user_input", "@fancy/rich_user_input"],
|
|
9804
|
+
pausesForHuman: "input",
|
|
9805
|
+
category: "human",
|
|
9806
|
+
label: "Rich User Input",
|
|
9807
|
+
description: "Pause the flow on a fully authored page \u2014 content, required reading, multi-section forms.",
|
|
9808
|
+
icon: "\u25A4",
|
|
9809
|
+
inputs: [{ id: "in" }],
|
|
9810
|
+
outputs: [{ id: "out", label: "values" }],
|
|
9811
|
+
configSchema: [
|
|
9812
|
+
{ type: "text", key: "title", label: "Step title", default: "Please review" },
|
|
9813
|
+
{
|
|
9814
|
+
type: "document",
|
|
9815
|
+
key: "document",
|
|
9816
|
+
label: "Page content",
|
|
9817
|
+
documentType: "stages",
|
|
9818
|
+
description: "Authored with the host's document editor (fancy-cms Stages)."
|
|
9819
|
+
},
|
|
9820
|
+
{ type: "switch", key: "requireConfirm", label: "Require explicit confirmation", default: true },
|
|
9821
|
+
{ type: "text", key: "submitLabel", label: "Submit button", default: "Continue" }
|
|
9822
|
+
],
|
|
9823
|
+
// Preview the authored page inside a FauxClient frame, so the canvas shows
|
|
9824
|
+
// what the person hitting this step will actually see.
|
|
9825
|
+
renderBody: (ctx) => ReactExports.createElement(RichInputPreview, { config: ctx.config ?? {} })
|
|
9826
|
+
},
|
|
9827
|
+
{
|
|
9828
|
+
name: "@particle-academy/subflow",
|
|
9829
|
+
aliases: ["subflow", "@fancy/subflow"],
|
|
9830
|
+
category: "logic",
|
|
9831
|
+
label: "SubFlow",
|
|
9832
|
+
description: "Run another workflow and bring its result \u2014 or its live progress \u2014 back into this one.",
|
|
9833
|
+
icon: "\u29C9",
|
|
9834
|
+
inputs: [{ id: "in" }],
|
|
9835
|
+
// The stream port only exists when something actually streams.
|
|
9836
|
+
outputs: (config) => subflowPorts(config ?? {}),
|
|
9837
|
+
// Core, not marketplace: it runs a child graph through this same engine and
|
|
9838
|
+
// needs nothing from outside except where workflows live.
|
|
9839
|
+
executor: subflowExecutor,
|
|
9840
|
+
configSchema: [
|
|
9841
|
+
{
|
|
9842
|
+
type: "text",
|
|
9843
|
+
key: "workflow",
|
|
9844
|
+
label: "Workflow",
|
|
9845
|
+
required: true,
|
|
9846
|
+
placeholder: "onboarding-v2",
|
|
9847
|
+
description: "Reference resolved by the host's registerWorkflowResolver()."
|
|
9848
|
+
},
|
|
9849
|
+
{
|
|
9850
|
+
type: "number",
|
|
9851
|
+
key: "version",
|
|
9852
|
+
label: "Pin to version",
|
|
9853
|
+
description: "Optional. Leave blank to always run the child's current version. Pinning fails the run loudly if the child has moved on \u2014 without it, someone edits the child and this flow silently runs different logic."
|
|
9854
|
+
},
|
|
9855
|
+
{
|
|
9856
|
+
type: "select",
|
|
9857
|
+
key: "mode",
|
|
9858
|
+
label: "Return",
|
|
9859
|
+
default: "output",
|
|
9860
|
+
options: [
|
|
9861
|
+
{ value: "output", label: "Output when it finishes" },
|
|
9862
|
+
{ value: "stream", label: "Stream progress as it runs" },
|
|
9863
|
+
{ value: "both", label: "Both \u2014 stream, then output" }
|
|
9864
|
+
],
|
|
9865
|
+
description: "Streaming adds a second port so a parent can show progress instead of a spinner."
|
|
9866
|
+
},
|
|
9867
|
+
{
|
|
9868
|
+
type: "keyvalue",
|
|
9869
|
+
key: "inputs",
|
|
9870
|
+
label: "Input mapping",
|
|
9871
|
+
description: "Values handed to the child's entry points. Omit to pass this node's inputs straight through.",
|
|
9872
|
+
keyLabel: "Name",
|
|
9873
|
+
valueLabel: "Value",
|
|
9874
|
+
addLabel: "Add input"
|
|
9875
|
+
},
|
|
9876
|
+
{
|
|
9877
|
+
type: "number",
|
|
9878
|
+
key: "maxDepth",
|
|
9879
|
+
label: "Max nesting depth",
|
|
9880
|
+
default: DEFAULT_MAX_DEPTH,
|
|
9881
|
+
min: 1,
|
|
9882
|
+
max: 32,
|
|
9883
|
+
description: "Guards against a workflow referencing itself."
|
|
9884
|
+
}
|
|
9885
|
+
]
|
|
9886
|
+
},
|
|
9887
|
+
// ───────────── Logic ─────────────
|
|
9888
|
+
{
|
|
9889
|
+
name: "@particle-academy/branch",
|
|
9890
|
+
aliases: ["branch", "@fancy/branch"],
|
|
9891
|
+
category: "logic",
|
|
9892
|
+
label: "Branch",
|
|
9893
|
+
description: "Multi-way branch on a condition or value.",
|
|
9894
|
+
icon: "\u25C7",
|
|
9895
|
+
inputs: [{ id: "in" }],
|
|
9896
|
+
outputs: [{ id: "true", label: "true" }, { id: "false", label: "false" }],
|
|
9897
|
+
configSchema: [
|
|
9898
|
+
{
|
|
9899
|
+
type: "select",
|
|
9900
|
+
key: "match",
|
|
9901
|
+
label: "Match",
|
|
9902
|
+
default: "all",
|
|
9903
|
+
options: [
|
|
9904
|
+
{ value: "all", label: "All conditions (AND)" },
|
|
9905
|
+
{ value: "any", label: "Any condition (OR)" }
|
|
9906
|
+
]
|
|
9907
|
+
},
|
|
9908
|
+
{
|
|
9909
|
+
type: "repeater",
|
|
9910
|
+
key: "conditions",
|
|
9911
|
+
label: "Conditions",
|
|
9912
|
+
description: "Routes to `true` when these match, otherwise `false`.",
|
|
9913
|
+
titleKey: "left",
|
|
9914
|
+
addLabel: "Add condition",
|
|
9915
|
+
minItems: 1,
|
|
9916
|
+
fields: [
|
|
9917
|
+
{ type: "expression", key: "left", label: "Value", example: "{{ $json.status }}", required: true },
|
|
9918
|
+
{
|
|
9919
|
+
type: "select",
|
|
9920
|
+
key: "operator",
|
|
9921
|
+
label: "Is",
|
|
9922
|
+
default: "eq",
|
|
9923
|
+
options: [
|
|
9924
|
+
{ value: "eq", label: "equal to" },
|
|
9925
|
+
{ value: "neq", label: "not equal to" },
|
|
9926
|
+
{ value: "contains", label: "contains" },
|
|
9927
|
+
{ value: "not_contains", label: "does not contain" },
|
|
9928
|
+
{ value: "gt", label: "greater than" },
|
|
9929
|
+
{ value: "gte", label: "greater than or equal to" },
|
|
9930
|
+
{ value: "lt", label: "less than" },
|
|
9931
|
+
{ value: "lte", label: "less than or equal to" },
|
|
9932
|
+
{ value: "truthy", label: "true" },
|
|
9933
|
+
{ value: "falsy", label: "false" },
|
|
9934
|
+
{ value: "empty", label: "empty" },
|
|
9935
|
+
{ value: "not_empty", label: "not empty" }
|
|
9936
|
+
]
|
|
9937
|
+
},
|
|
9938
|
+
{ type: "text", key: "right", label: "Compared to", placeholder: "active" }
|
|
9939
|
+
],
|
|
9940
|
+
default: [{ left: "", operator: "eq", right: "" }]
|
|
9941
|
+
},
|
|
9942
|
+
{
|
|
9943
|
+
type: "expression",
|
|
9944
|
+
key: "condition",
|
|
9945
|
+
label: "Raw expression (advanced)",
|
|
9946
|
+
example: "{{ $json.active && $json.score > 10 }}",
|
|
9947
|
+
description: "Escape hatch for logic the builder can't express. Overrides the conditions above when set."
|
|
9948
|
+
}
|
|
9949
|
+
]
|
|
9950
|
+
},
|
|
9951
|
+
{
|
|
9952
|
+
name: "@particle-academy/switch_case",
|
|
9953
|
+
aliases: ["switch_case", "@fancy/switch_case"],
|
|
9954
|
+
category: "logic",
|
|
9955
|
+
label: "Switch",
|
|
9956
|
+
description: "Route to one of N labelled outputs based on a key.",
|
|
9957
|
+
icon: "\u2933",
|
|
9958
|
+
inputs: [{ id: "in" }],
|
|
9959
|
+
// Ports ARE the config: every distinct port a case routes to becomes an
|
|
9960
|
+
// output handle, plus the always-present `default`. Editing the cases map
|
|
9961
|
+
// moves the ports on the canvas and the ports the runtime activates.
|
|
9962
|
+
outputs: (config) => casePorts(config?.cases),
|
|
9963
|
+
configSchema: [
|
|
9964
|
+
{ type: "expression", key: "value", label: "Switch on", example: "{{ $json.kind }}", required: true },
|
|
9965
|
+
{
|
|
9966
|
+
type: "keyvalue",
|
|
9967
|
+
key: "cases",
|
|
9968
|
+
label: "Cases",
|
|
9969
|
+
description: "Match value \u2192 output port. Unmatched input takes `default`.",
|
|
9970
|
+
keyLabel: "When value is",
|
|
9971
|
+
valueLabel: "Route to port",
|
|
9972
|
+
keyPlaceholder: "a",
|
|
9973
|
+
valuePlaceholder: "case_a",
|
|
9974
|
+
addLabel: "Add case",
|
|
9975
|
+
default: { a: "case_a", b: "case_b" }
|
|
9976
|
+
}
|
|
9977
|
+
]
|
|
9978
|
+
},
|
|
9979
|
+
{
|
|
9980
|
+
name: "@particle-academy/for_each",
|
|
9981
|
+
outputShape: [
|
|
9982
|
+
{ path: "items", type: "array" },
|
|
9983
|
+
{ path: "count", type: "number" }
|
|
9984
|
+
],
|
|
9985
|
+
aliases: ["for_each", "@fancy/for_each"],
|
|
9986
|
+
category: "logic",
|
|
9987
|
+
label: "For Each",
|
|
9988
|
+
description: "Iterate over a list, emitting each item on `item`.",
|
|
9989
|
+
icon: "\u21BB",
|
|
9990
|
+
inputs: [{ id: "in" }],
|
|
9991
|
+
outputs: [{ id: "item", label: "item" }, { id: "done", label: "done" }],
|
|
9992
|
+
configSchema: [
|
|
9993
|
+
{ type: "expression", key: "source", label: "List", example: "{{ $json.users }}", required: true },
|
|
9994
|
+
{ type: "number", key: "concurrency", label: "Concurrency", default: 1, min: 1, max: 50 }
|
|
9995
|
+
]
|
|
9996
|
+
},
|
|
9997
|
+
{
|
|
9998
|
+
name: "@particle-academy/merge",
|
|
9999
|
+
aliases: ["merge", "@fancy/merge"],
|
|
10000
|
+
category: "logic",
|
|
10001
|
+
label: "Merge",
|
|
10002
|
+
description: "Combine multiple inputs into one object or array.",
|
|
10003
|
+
icon: "\u2295",
|
|
10004
|
+
inputs: [{ id: "a" }, { id: "b" }],
|
|
10005
|
+
outputs: [{ id: "out" }],
|
|
10006
|
+
configSchema: [
|
|
10007
|
+
{
|
|
10008
|
+
type: "select",
|
|
10009
|
+
key: "mode",
|
|
10010
|
+
label: "Mode",
|
|
10011
|
+
default: "merge",
|
|
10012
|
+
options: [{ value: "merge", label: "Object merge" }, { value: "concat", label: "Array concat" }]
|
|
10013
|
+
}
|
|
10014
|
+
]
|
|
10015
|
+
},
|
|
10016
|
+
{
|
|
10017
|
+
name: "@particle-academy/wait",
|
|
10018
|
+
aliases: ["wait", "@fancy/wait"],
|
|
10019
|
+
category: "logic",
|
|
10020
|
+
label: "Wait",
|
|
10021
|
+
description: "Sleep or wait for an external event.",
|
|
10022
|
+
icon: "\u23F8",
|
|
10023
|
+
configSchema: [
|
|
10024
|
+
{
|
|
10025
|
+
type: "select",
|
|
10026
|
+
key: "mode",
|
|
10027
|
+
label: "Mode",
|
|
10028
|
+
default: "duration",
|
|
10029
|
+
options: [{ value: "duration", label: "Duration" }, { value: "until", label: "Until timestamp" }, { value: "event", label: "External event" }]
|
|
10030
|
+
},
|
|
10031
|
+
{ type: "text", key: "duration", label: "Duration", placeholder: "5s, 10m, 1h", description: "Used when mode = duration." }
|
|
10032
|
+
]
|
|
10033
|
+
},
|
|
10034
|
+
{
|
|
10035
|
+
name: "@particle-academy/transform",
|
|
10036
|
+
aliases: ["transform", "@fancy/transform"],
|
|
10037
|
+
category: "logic",
|
|
10038
|
+
label: "Transform",
|
|
10039
|
+
description: "Reshape data with an expression.",
|
|
10040
|
+
icon: "\u0192",
|
|
10041
|
+
configSchema: [
|
|
10042
|
+
{
|
|
10043
|
+
type: "select",
|
|
10044
|
+
key: "mode",
|
|
10045
|
+
label: "Build the output",
|
|
10046
|
+
default: "fields",
|
|
10047
|
+
options: [
|
|
10048
|
+
{ value: "fields", label: "Field by field" },
|
|
10049
|
+
{ value: "expression", label: "One expression" }
|
|
10050
|
+
]
|
|
10051
|
+
},
|
|
10052
|
+
{
|
|
10053
|
+
type: "repeater",
|
|
10054
|
+
key: "fields",
|
|
10055
|
+
label: "Output fields",
|
|
10056
|
+
description: "Each row becomes a key on the result.",
|
|
10057
|
+
titleKey: "key",
|
|
10058
|
+
addLabel: "Add field",
|
|
10059
|
+
fields: [
|
|
10060
|
+
{ type: "text", key: "key", label: "Key", required: true, placeholder: "name" },
|
|
10061
|
+
{ type: "expression", key: "value", label: "Value", example: "{{ $json.first }}", required: true }
|
|
10062
|
+
],
|
|
10063
|
+
default: [{ key: "", value: "" }]
|
|
10064
|
+
},
|
|
10065
|
+
{
|
|
10066
|
+
type: "expression",
|
|
10067
|
+
key: "expression",
|
|
10068
|
+
label: "Expression (advanced)",
|
|
10069
|
+
example: "{{ { id: $json.id, name: $json.first + ' ' + $json.last } }}",
|
|
10070
|
+
description: "Used when the mode above is set to one expression."
|
|
10071
|
+
}
|
|
10072
|
+
]
|
|
10073
|
+
},
|
|
10074
|
+
// ───────────── Data ─────────────
|
|
10075
|
+
{
|
|
10076
|
+
name: "@particle-academy/memory_store",
|
|
10077
|
+
aliases: ["memory_store", "@fancy/memory_store"],
|
|
10078
|
+
category: "data",
|
|
10079
|
+
label: "Memory Store",
|
|
10080
|
+
description: "Read or write per-conversation memory.",
|
|
10081
|
+
icon: "\u{1F9E0}",
|
|
10082
|
+
configSchema: [
|
|
10083
|
+
{
|
|
10084
|
+
type: "select",
|
|
10085
|
+
key: "operation",
|
|
10086
|
+
label: "Operation",
|
|
10087
|
+
required: true,
|
|
10088
|
+
default: "read",
|
|
10089
|
+
options: [{ value: "read", label: "Read" }, { value: "write", label: "Write" }, { value: "append", label: "Append" }]
|
|
10090
|
+
},
|
|
10091
|
+
{ type: "text", key: "key", label: "Key", placeholder: "user.preferences", required: true },
|
|
10092
|
+
{ type: "expression", key: "value", label: "Value (write/append only)", example: "{{ $json }}" },
|
|
10093
|
+
{ type: "credential", key: "store", label: "Memory store", credentialType: "memory_store" }
|
|
10094
|
+
]
|
|
10095
|
+
},
|
|
10096
|
+
{
|
|
10097
|
+
name: "@particle-academy/data_store",
|
|
10098
|
+
aliases: ["data_store", "@fancy/data_store"],
|
|
10099
|
+
category: "data",
|
|
10100
|
+
label: "Data Store",
|
|
10101
|
+
description: "Key-value or table read/write against a host store.",
|
|
10102
|
+
icon: "\u{1F5C3}",
|
|
10103
|
+
configSchema: [
|
|
10104
|
+
{
|
|
10105
|
+
type: "select",
|
|
10106
|
+
key: "operation",
|
|
10107
|
+
label: "Operation",
|
|
10108
|
+
required: true,
|
|
10109
|
+
default: "get",
|
|
10110
|
+
options: [
|
|
10111
|
+
{ value: "get", label: "Get" },
|
|
10112
|
+
{ value: "set", label: "Set" },
|
|
10113
|
+
{ value: "delete", label: "Delete" },
|
|
10114
|
+
{ value: "query", label: "Query" },
|
|
10115
|
+
{ value: "list", label: "List" }
|
|
10116
|
+
]
|
|
10117
|
+
},
|
|
10118
|
+
{ type: "text", key: "table", label: "Table / collection", required: true },
|
|
10119
|
+
{ type: "text", key: "key", label: "Key" },
|
|
10120
|
+
{
|
|
10121
|
+
type: "keyvalue",
|
|
10122
|
+
key: "where",
|
|
10123
|
+
label: "Where",
|
|
10124
|
+
description: "Field/value pairs to match. For query and list operations.",
|
|
10125
|
+
keyLabel: "Field",
|
|
10126
|
+
valueLabel: "Equals",
|
|
10127
|
+
addLabel: "Add filter"
|
|
10128
|
+
},
|
|
10129
|
+
{ type: "expression", key: "value", label: "Value (set only)", example: "{{ $json }}" },
|
|
10130
|
+
{ type: "credential", key: "store", label: "Data store", credentialType: "data_store" }
|
|
10131
|
+
]
|
|
10132
|
+
},
|
|
10133
|
+
{
|
|
10134
|
+
name: "@particle-academy/variable",
|
|
10135
|
+
aliases: ["variable", "@fancy/variable"],
|
|
10136
|
+
category: "data",
|
|
10137
|
+
label: "Variable",
|
|
10138
|
+
description: "Workflow-scoped value used by other nodes.",
|
|
10139
|
+
icon: "\u{1D4CD}",
|
|
10140
|
+
configSchema: [
|
|
10141
|
+
{ type: "text", key: "name", label: "Name", required: true },
|
|
10142
|
+
{ type: "expression", key: "value", label: "Value", required: true }
|
|
10143
|
+
]
|
|
10144
|
+
},
|
|
10145
|
+
// ───────────── AI ─────────────
|
|
10146
|
+
{
|
|
10147
|
+
name: "@particle-academy/llm_call",
|
|
10148
|
+
// LlmClient::complete() -> array{text:string,data?:mixed,usage?:array,raw?:mixed}
|
|
10149
|
+
//
|
|
10150
|
+
// A FUNCTION of config, because `data` exists only when this node was asked
|
|
10151
|
+
// for a schema. Declaring it statically would offer `{{ $json.data }}` on
|
|
10152
|
+
// every llm_call in the kit, including the ones that emit nothing of the
|
|
10153
|
+
// sort — and a suggestion that resolves to null at runtime is worse than no
|
|
10154
|
+
// suggestion, since the picker is exactly what gave the author confidence.
|
|
10155
|
+
outputShape: (config) => {
|
|
10156
|
+
const asked = config?.response_schema != null && config.response_schema !== "" && !(Array.isArray(config.response_schema) && config.response_schema.length === 0);
|
|
10157
|
+
return [
|
|
10158
|
+
{ path: "text", type: "string", description: "The model's completion." },
|
|
10159
|
+
...asked ? [{ path: "data", type: "unknown", description: "The parsed, schema-checked result." }] : [],
|
|
10160
|
+
{ path: "usage", type: "object", description: "Token counts, when the provider reports them." },
|
|
10161
|
+
{ path: "raw", type: "unknown", description: "The provider's untouched response." }
|
|
10162
|
+
];
|
|
10163
|
+
},
|
|
10164
|
+
aliases: ["llm_call", "@fancy/llm_call"],
|
|
10165
|
+
category: "ai",
|
|
10166
|
+
label: "LLM Call",
|
|
10167
|
+
description: "Send a prompt + context to a model and receive a response.",
|
|
10168
|
+
icon: "\u2726",
|
|
10169
|
+
configSchema: [
|
|
10170
|
+
{
|
|
10171
|
+
type: "select",
|
|
10172
|
+
key: "provider",
|
|
10173
|
+
label: "Provider",
|
|
10174
|
+
default: "anthropic",
|
|
10175
|
+
options: [
|
|
10176
|
+
{ value: "anthropic", label: "Anthropic" },
|
|
10177
|
+
{ value: "openai", label: "OpenAI" },
|
|
10178
|
+
{ value: "custom", label: "Custom" }
|
|
10179
|
+
]
|
|
10180
|
+
},
|
|
10181
|
+
{ type: "text", key: "model", label: "Model", placeholder: "claude-sonnet-4-5", required: true },
|
|
10182
|
+
{ type: "textarea", key: "system", label: "System prompt", rows: 4 },
|
|
10183
|
+
{ type: "expression", key: "prompt", label: "User prompt", example: "{{ $json.question }}", required: true },
|
|
10184
|
+
{ type: "number", key: "temperature", label: "Temperature", min: 0, max: 2, step: 0.1, default: 0.7 },
|
|
10185
|
+
{ type: "number", key: "max_tokens", label: "Max tokens", min: 1, max: 8192, default: 1024 },
|
|
10186
|
+
{
|
|
10187
|
+
type: "repeater",
|
|
10188
|
+
key: "tools",
|
|
10189
|
+
label: "Tools",
|
|
10190
|
+
description: "Tools the model may call.",
|
|
10191
|
+
titleKey: "name",
|
|
10192
|
+
addLabel: "Add tool",
|
|
10193
|
+
fields: [
|
|
10194
|
+
{ type: "text", key: "name", label: "Name", required: true, placeholder: "search_index" },
|
|
10195
|
+
{ type: "text", key: "description", label: "When to use it" },
|
|
10196
|
+
{
|
|
10197
|
+
type: "json",
|
|
10198
|
+
key: "input_schema",
|
|
10199
|
+
label: "Input schema",
|
|
10200
|
+
description: "JSON Schema for the tool's arguments."
|
|
10201
|
+
}
|
|
10202
|
+
]
|
|
10203
|
+
},
|
|
10204
|
+
{
|
|
10205
|
+
type: "json",
|
|
10206
|
+
key: "response_schema",
|
|
10207
|
+
label: "Response schema",
|
|
10208
|
+
description: "Optional JSON Schema. When set, the runtime asks the provider for schema-valid JSON and the node emits the parsed value as `data` \u2014 reference it as {{ $json.data }}. A response that cannot be parsed or does not match FAILS the node rather than passing an empty value downstream."
|
|
10209
|
+
},
|
|
10210
|
+
{ type: "credential", key: "credential", label: "API credential", credentialType: "llm_credential" }
|
|
10211
|
+
]
|
|
10212
|
+
},
|
|
10213
|
+
{
|
|
10214
|
+
name: "@particle-academy/llm_router",
|
|
10215
|
+
// Every id this node has ever shipped under keeps resolving — MOIC's saved
|
|
10216
|
+
// flows carry the bare `llm_branch`.
|
|
10217
|
+
aliases: ["llm_router", "llm_branch", "@fancy/llm_branch", "@fancy/llm_router"],
|
|
10218
|
+
category: "ai",
|
|
10219
|
+
label: "LLM Router",
|
|
10220
|
+
description: "Let a model choose which route the flow takes.",
|
|
10221
|
+
icon: "\u2727",
|
|
10222
|
+
inputs: [{ id: "in" }],
|
|
10223
|
+
// Each declared route is a port. The executor returns `{ __port: id }`
|
|
10224
|
+
// (or `Port.only(id)` on the PHP runtime) to pick one.
|
|
10225
|
+
outputs: (config) => routePorts(config?.routes, config?.fallback),
|
|
10226
|
+
// A shuttle, not an engine: it carries the routes out to whatever LLM
|
|
10227
|
+
// client the host registered and carries the choice back. No provider SDK
|
|
10228
|
+
// reaches core, so this stays a builtin without adding a dependency.
|
|
10229
|
+
executor: llmRouterExecutor,
|
|
10230
|
+
configSchema: [
|
|
10231
|
+
{
|
|
10232
|
+
type: "textarea",
|
|
10233
|
+
key: "system",
|
|
10234
|
+
label: "System prompt",
|
|
10235
|
+
rows: 3,
|
|
10236
|
+
description: "Optional framing for the routing decision."
|
|
10237
|
+
},
|
|
10238
|
+
{
|
|
10239
|
+
type: "expression",
|
|
10240
|
+
key: "prompt",
|
|
10241
|
+
label: "What to route on",
|
|
10242
|
+
example: "{{ $json.message }}",
|
|
10243
|
+
required: true
|
|
10244
|
+
},
|
|
10245
|
+
{
|
|
10246
|
+
type: "repeater",
|
|
10247
|
+
key: "routes",
|
|
10248
|
+
label: "Routes",
|
|
10249
|
+
description: "The model picks exactly one. Descriptions are what it chooses between \u2014 make them distinct.",
|
|
10250
|
+
titleKey: "port",
|
|
10251
|
+
addLabel: "Add route",
|
|
10252
|
+
minItems: 2,
|
|
10253
|
+
fields: [
|
|
10254
|
+
{ type: "text", key: "port", label: "Port", required: true, placeholder: "billing" },
|
|
10255
|
+
{
|
|
10256
|
+
type: "text",
|
|
10257
|
+
key: "description",
|
|
10258
|
+
label: "When to choose it",
|
|
10259
|
+
required: true,
|
|
10260
|
+
placeholder: "The user is asking about an invoice, refund, or payment."
|
|
10261
|
+
}
|
|
10262
|
+
],
|
|
10263
|
+
default: [
|
|
10264
|
+
{ port: "a", description: "Describe when the model should pick this route." },
|
|
10265
|
+
{ port: "b", description: "Describe when the model should pick this route." }
|
|
10266
|
+
]
|
|
10267
|
+
},
|
|
10268
|
+
{
|
|
10269
|
+
type: "select",
|
|
10270
|
+
key: "provider",
|
|
10271
|
+
label: "Provider",
|
|
10272
|
+
default: "anthropic",
|
|
10273
|
+
options: [
|
|
10274
|
+
{ value: "anthropic", label: "Anthropic" },
|
|
10275
|
+
{ value: "openai", label: "OpenAI" },
|
|
10276
|
+
{ value: "custom", label: "Custom" }
|
|
10277
|
+
]
|
|
10278
|
+
},
|
|
10279
|
+
{ type: "text", key: "model", label: "Model", placeholder: "claude-sonnet-4-5" },
|
|
10280
|
+
{
|
|
10281
|
+
type: "switch",
|
|
10282
|
+
key: "fallback",
|
|
10283
|
+
label: "Add a `fallback` port",
|
|
10284
|
+
default: true,
|
|
10285
|
+
description: "Where the flow goes if the model returns no usable route."
|
|
10286
|
+
},
|
|
10287
|
+
{ type: "credential", key: "credential", label: "API credential", credentialType: "llm_credential" }
|
|
10288
|
+
]
|
|
10289
|
+
},
|
|
10290
|
+
{
|
|
10291
|
+
name: "@particle-academy/tool_use",
|
|
10292
|
+
aliases: ["tool_use", "@fancy/tool_use"],
|
|
10293
|
+
category: "ai",
|
|
10294
|
+
label: "Tool Use",
|
|
10295
|
+
description: "Hand control to a host-registered tool by name.",
|
|
10296
|
+
icon: "\u{1F6E0}",
|
|
10297
|
+
configSchema: [
|
|
10298
|
+
{ type: "text", key: "tool", label: "Tool name", placeholder: "search_index", required: true },
|
|
10299
|
+
{ type: "expression", key: "args", label: "Arguments", example: "{{ { query: $json.q } }}" }
|
|
10300
|
+
]
|
|
10301
|
+
},
|
|
10302
|
+
{
|
|
10303
|
+
name: "@particle-academy/embed_search",
|
|
10304
|
+
outputShape: [
|
|
10305
|
+
{ path: "query", type: "string" },
|
|
10306
|
+
{ path: "matches", type: "array", description: "Ranked results from the vector store." }
|
|
10307
|
+
],
|
|
10308
|
+
aliases: ["embed_search", "@fancy/embed_search"],
|
|
10309
|
+
category: "ai",
|
|
10310
|
+
label: "Embed & Search",
|
|
10311
|
+
description: "Embed a query and search a vector store.",
|
|
10312
|
+
icon: "\u273A",
|
|
10313
|
+
configSchema: [
|
|
10314
|
+
{ type: "expression", key: "query", label: "Query", required: true, example: "{{ $json.question }}" },
|
|
10315
|
+
{ type: "number", key: "topK", label: "Top K", default: 5, min: 1, max: 50 },
|
|
10316
|
+
{ type: "credential", key: "vectorStore", label: "Vector store", credentialType: "vector_store" }
|
|
10317
|
+
]
|
|
10318
|
+
},
|
|
10319
|
+
// ───────────── IO ─────────────
|
|
10320
|
+
{
|
|
10321
|
+
name: "@particle-academy/api_request",
|
|
10322
|
+
// HttpClient::send() -> array{status:int,headers:array,body:mixed}
|
|
10323
|
+
outputShape: [
|
|
10324
|
+
{ path: "status", type: "number", description: "HTTP status code." },
|
|
10325
|
+
{ path: "headers", type: "object" },
|
|
10326
|
+
{ path: "body", type: "unknown", description: "Decoded JSON when the response is JSON, otherwise the raw body." }
|
|
10327
|
+
],
|
|
10328
|
+
aliases: ["api_request", "@fancy/api_request"],
|
|
10329
|
+
category: "io",
|
|
10330
|
+
label: "API Request",
|
|
10331
|
+
description: "HTTP request to any URL.",
|
|
10332
|
+
icon: "\u2194",
|
|
10333
|
+
configSchema: [
|
|
10334
|
+
...HTTP_METHODS,
|
|
10335
|
+
{ type: "text", key: "url", label: "URL", placeholder: "https://api.example.com/...", required: true },
|
|
10336
|
+
{
|
|
10337
|
+
type: "keyvalue",
|
|
10338
|
+
key: "headers",
|
|
10339
|
+
label: "Headers",
|
|
10340
|
+
keyLabel: "Header",
|
|
10341
|
+
valueLabel: "Value",
|
|
10342
|
+
keyPlaceholder: "content-type",
|
|
10343
|
+
valuePlaceholder: "application/json",
|
|
10344
|
+
addLabel: "Add header",
|
|
10345
|
+
default: { "content-type": "application/json" }
|
|
10346
|
+
},
|
|
10347
|
+
{ type: "json", key: "body", label: "Body" },
|
|
10348
|
+
{ type: "credential", key: "auth", label: "Auth", credentialType: "api_credential" }
|
|
10349
|
+
]
|
|
10350
|
+
},
|
|
10351
|
+
{
|
|
10352
|
+
name: "@particle-academy/webhook_out",
|
|
10353
|
+
aliases: ["webhook_out", "@fancy/webhook_out"],
|
|
10354
|
+
category: "io",
|
|
10355
|
+
label: "Send Webhook",
|
|
10356
|
+
description: "POST a payload to a configured URL.",
|
|
10357
|
+
icon: "\u2197",
|
|
10358
|
+
configSchema: [
|
|
10359
|
+
{ type: "text", key: "url", label: "URL", required: true },
|
|
10360
|
+
{
|
|
10361
|
+
type: "keyvalue",
|
|
10362
|
+
key: "headers",
|
|
10363
|
+
label: "Headers",
|
|
10364
|
+
keyLabel: "Header",
|
|
10365
|
+
valueLabel: "Value",
|
|
10366
|
+
addLabel: "Add header"
|
|
10367
|
+
},
|
|
10368
|
+
{ type: "expression", key: "payload", label: "Payload", required: true, example: "{{ $json }}" }
|
|
10369
|
+
]
|
|
10370
|
+
},
|
|
10371
|
+
// ───────────── Human ─────────────
|
|
10372
|
+
{
|
|
10373
|
+
name: "@particle-academy/human_approval",
|
|
10374
|
+
aliases: ["human_approval", "@fancy/human_approval"],
|
|
10375
|
+
pausesForHuman: "approval",
|
|
10376
|
+
category: "human",
|
|
10377
|
+
label: "Human Approval",
|
|
10378
|
+
description: "Pause until a human approves or denies.",
|
|
10379
|
+
icon: "\u2713",
|
|
10380
|
+
inputs: [{ id: "in" }],
|
|
10381
|
+
outputs: [{ id: "approved", label: "approved" }, { id: "denied", label: "denied" }],
|
|
10382
|
+
configSchema: [
|
|
10383
|
+
{ type: "text", key: "title", label: "Approval title", default: "Approve action" },
|
|
10384
|
+
{ type: "textarea", key: "description", label: "Description for approver", rows: 3 },
|
|
10385
|
+
{ type: "credential", key: "channel", label: "Notify channel", credentialType: "notify_channel" }
|
|
10386
|
+
]
|
|
10387
|
+
},
|
|
10388
|
+
{
|
|
10389
|
+
name: "@particle-academy/notify",
|
|
10390
|
+
aliases: ["notify", "@fancy/notify"],
|
|
10391
|
+
category: "human",
|
|
10392
|
+
label: "Notify",
|
|
10393
|
+
description: "Send a message via Slack / email / SMS / etc.",
|
|
10394
|
+
icon: "\u{1F514}",
|
|
10395
|
+
configSchema: [
|
|
10396
|
+
{
|
|
10397
|
+
type: "select",
|
|
10398
|
+
key: "channel",
|
|
10399
|
+
label: "Channel",
|
|
10400
|
+
default: "slack",
|
|
10401
|
+
options: [
|
|
10402
|
+
{ value: "slack", label: "Slack" },
|
|
10403
|
+
{ value: "email", label: "Email" },
|
|
10404
|
+
{ value: "sms", label: "SMS" },
|
|
10405
|
+
{ value: "discord", label: "Discord" }
|
|
10406
|
+
]
|
|
10407
|
+
},
|
|
10408
|
+
{ type: "text", key: "to", label: "To", required: true },
|
|
10409
|
+
{ type: "expression", key: "message", label: "Message", required: true, example: "{{ $json.summary }}" }
|
|
10410
|
+
]
|
|
10411
|
+
},
|
|
10412
|
+
// ───────────── Output ─────────────
|
|
10413
|
+
{
|
|
10414
|
+
name: "@particle-academy/output",
|
|
10415
|
+
aliases: ["output", "@fancy/output"],
|
|
10416
|
+
category: "output",
|
|
10417
|
+
label: "Output",
|
|
10418
|
+
description: "Terminal node \u2014 captures the workflow's result.",
|
|
10419
|
+
icon: "\u25CF",
|
|
10420
|
+
inputs: [{ id: "in" }],
|
|
10421
|
+
outputs: []
|
|
10422
|
+
},
|
|
10423
|
+
{
|
|
10424
|
+
name: "@particle-academy/log",
|
|
10425
|
+
aliases: ["log", "@fancy/log"],
|
|
10426
|
+
category: "output",
|
|
10427
|
+
label: "Log",
|
|
10428
|
+
description: "Send to the run feed.",
|
|
10429
|
+
icon: "\u2261",
|
|
10430
|
+
inputs: [{ id: "in" }],
|
|
10431
|
+
outputs: [],
|
|
10432
|
+
configSchema: [
|
|
10433
|
+
{
|
|
10434
|
+
type: "select",
|
|
10435
|
+
key: "level",
|
|
10436
|
+
label: "Level",
|
|
10437
|
+
default: "info",
|
|
10438
|
+
options: [{ value: "info", label: "info" }, { value: "warn", label: "warn" }, { value: "error", label: "error" }]
|
|
10439
|
+
},
|
|
10440
|
+
{ type: "expression", key: "message", label: "Message", required: true, example: "{{ $json }}" }
|
|
10441
|
+
]
|
|
10442
|
+
},
|
|
10443
|
+
{
|
|
10444
|
+
// Swimlane — a portless, resizable container. Child nodes are parented into
|
|
10445
|
+
// it; it never runs (the runtime skips the `layout` category). Uses its own
|
|
10446
|
+
// renderer (LaneNode) instead of the default card.
|
|
10447
|
+
name: "@particle-academy/lane",
|
|
10448
|
+
aliases: ["lane", "@fancy/lane"],
|
|
10449
|
+
category: "layout",
|
|
10450
|
+
label: "Lane",
|
|
10451
|
+
description: "A resizable swimlane \u2014 drop nodes into it to group them.",
|
|
10452
|
+
icon: "\u25A4",
|
|
10453
|
+
inputs: [],
|
|
10454
|
+
outputs: [],
|
|
10455
|
+
configSchema: [
|
|
10456
|
+
{ type: "text", key: "title", label: "Title", default: "Lane" },
|
|
10457
|
+
{
|
|
10458
|
+
type: "select",
|
|
10459
|
+
key: "orientation",
|
|
10460
|
+
label: "Orientation",
|
|
10461
|
+
default: "horizontal",
|
|
10462
|
+
options: [{ value: "horizontal", label: "Row" }, { value: "vertical", label: "Column" }]
|
|
10463
|
+
}
|
|
10464
|
+
],
|
|
10465
|
+
defaultConfig: { title: "Lane", orientation: "horizontal" },
|
|
10466
|
+
resizable: { minWidth: 160, minHeight: 72 },
|
|
10467
|
+
component: LaneNode
|
|
10468
|
+
},
|
|
10469
|
+
{
|
|
10470
|
+
// Note — a sticky-note annotation. Portless + visual-only: the runtime skips
|
|
10471
|
+
// the `annotation` category, so a note's text NEVER reaches a runner — it
|
|
10472
|
+
// rides in the document purely for people, editors, and MCP tools. Uses its
|
|
10473
|
+
// own renderer (NoteNode); double-click on the canvas to edit in place.
|
|
10474
|
+
name: "@particle-academy/note",
|
|
10475
|
+
aliases: ["note", "@fancy/note"],
|
|
10476
|
+
category: "annotation",
|
|
10477
|
+
label: "Note",
|
|
10478
|
+
description: "A sticky note that documents the canvas. Never runs \u2014 editor + agent only.",
|
|
10479
|
+
icon: "\u{1F5D2}",
|
|
10480
|
+
inputs: [],
|
|
10481
|
+
outputs: [],
|
|
10482
|
+
configSchema: [
|
|
10483
|
+
{ type: "text", key: "title", label: "Title", placeholder: "Optional heading" },
|
|
10484
|
+
{ type: "textarea", key: "text", label: "Note", rows: 5, placeholder: "What does this part of the flow do?" },
|
|
10485
|
+
{ type: "select", key: "color", label: "Color", default: "amber", options: [
|
|
10486
|
+
{ value: "amber", label: "Amber" },
|
|
10487
|
+
{ value: "sky", label: "Sky" },
|
|
10488
|
+
{ value: "violet", label: "Violet" },
|
|
10489
|
+
{ value: "emerald", label: "Emerald" },
|
|
10490
|
+
{ value: "rose", label: "Rose" },
|
|
10491
|
+
{ value: "slate", label: "Slate" }
|
|
10492
|
+
] }
|
|
10493
|
+
],
|
|
10494
|
+
defaultConfig: { text: "", color: "amber" },
|
|
10495
|
+
resizable: { minWidth: 140, minHeight: 80 },
|
|
10496
|
+
component: NoteNode
|
|
10497
|
+
}
|
|
10498
|
+
];
|
|
10499
|
+
function registerBuiltinKinds() {
|
|
10500
|
+
for (const k of KINDS) registerNodeKind(k);
|
|
10501
|
+
}
|
|
9199
10502
|
|
|
9200
10503
|
// src/registry/registry.ts
|
|
9201
10504
|
var kinds = /* @__PURE__ */ new Map();
|
|
9202
10505
|
var aliases = /* @__PURE__ */ new Map();
|
|
10506
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
9203
10507
|
var overrides = /* @__PURE__ */ new Map();
|
|
10508
|
+
var builtinsEnsured = false;
|
|
10509
|
+
function ensureBuiltinKinds() {
|
|
10510
|
+
if (builtinsEnsured) return;
|
|
10511
|
+
builtinsEnsured = true;
|
|
10512
|
+
registerBuiltinKinds();
|
|
10513
|
+
}
|
|
10514
|
+
function registerNodeKind(definition) {
|
|
10515
|
+
ensureBuiltinKinds();
|
|
10516
|
+
kinds.set(definition.name, definition);
|
|
10517
|
+
for (const alias of definition.aliases ?? []) aliases.set(alias, definition.name);
|
|
10518
|
+
notify();
|
|
10519
|
+
return () => {
|
|
10520
|
+
if (kinds.get(definition.name) === definition) {
|
|
10521
|
+
kinds.delete(definition.name);
|
|
10522
|
+
for (const alias of definition.aliases ?? []) {
|
|
10523
|
+
if (aliases.get(alias) === definition.name) aliases.delete(alias);
|
|
10524
|
+
}
|
|
10525
|
+
notify();
|
|
10526
|
+
}
|
|
10527
|
+
};
|
|
10528
|
+
}
|
|
9204
10529
|
function resolveKindId(id2) {
|
|
10530
|
+
ensureBuiltinKinds();
|
|
9205
10531
|
if (kinds.has(id2)) return id2;
|
|
9206
10532
|
const canonical = aliases.get(id2);
|
|
9207
10533
|
return canonical && kinds.has(canonical) ? canonical : null;
|
|
@@ -9219,11 +10545,15 @@ function kindIds(kind) {
|
|
|
9219
10545
|
return [kind.name, ...kind.aliases ?? []];
|
|
9220
10546
|
}
|
|
9221
10547
|
function listNodeKinds(category) {
|
|
10548
|
+
ensureBuiltinKinds();
|
|
9222
10549
|
const all = Array.from(kinds.values()).map(
|
|
9223
10550
|
(k) => withOverride(k)
|
|
9224
10551
|
);
|
|
9225
10552
|
return category ? all.filter((k) => k.category === category) : all;
|
|
9226
10553
|
}
|
|
10554
|
+
function notify() {
|
|
10555
|
+
for (const l of listeners) l();
|
|
10556
|
+
}
|
|
9227
10557
|
function categoryAccent(category) {
|
|
9228
10558
|
switch (category) {
|
|
9229
10559
|
case "trigger":
|
|
@@ -9248,6 +10578,25 @@ function categoryAccent(category) {
|
|
|
9248
10578
|
return "#71717a";
|
|
9249
10579
|
}
|
|
9250
10580
|
}
|
|
10581
|
+
function LaneNodeInner(props) {
|
|
10582
|
+
const data = props.data;
|
|
10583
|
+
const config = data.config ?? {};
|
|
10584
|
+
const title = config.title ?? data.label ?? "Lane";
|
|
10585
|
+
const orientation = config.orientation ?? "horizontal";
|
|
10586
|
+
const accent = config.color ?? data.color ?? categoryAccent("layout");
|
|
10587
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10588
|
+
"div",
|
|
10589
|
+
{
|
|
10590
|
+
className: ["ff-lane", `ff-lane--${orientation}`, props.selected ? "ff-lane--selected" : ""].filter(Boolean).join(" "),
|
|
10591
|
+
style: { borderColor: props.selected ? accent : void 0 },
|
|
10592
|
+
children: [
|
|
10593
|
+
/* @__PURE__ */ jsxRuntime.jsx(NodeResizer, { isVisible: props.selected ?? false, color: accent, minWidth: 160, minHeight: 72 }),
|
|
10594
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "ff-lane__header", style: { background: accent }, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ff-lane__title", children: title }) })
|
|
10595
|
+
]
|
|
10596
|
+
}
|
|
10597
|
+
);
|
|
10598
|
+
}
|
|
10599
|
+
var LaneNode = ReactExports.memo(LaneNodeInner);
|
|
9251
10600
|
|
|
9252
10601
|
// src/components/nodes/index.ts
|
|
9253
10602
|
var defaultNodeTypes = {
|
|
@@ -9259,29 +10608,6 @@ var defaultNodeTypes = {
|
|
|
9259
10608
|
subgraph: SubgraphNode
|
|
9260
10609
|
};
|
|
9261
10610
|
|
|
9262
|
-
// src/registry/ports.ts
|
|
9263
|
-
function resolvePortSpec(spec, config) {
|
|
9264
|
-
if (spec === void 0) return void 0;
|
|
9265
|
-
if (typeof spec !== "function") return spec;
|
|
9266
|
-
try {
|
|
9267
|
-
const resolved = spec(config);
|
|
9268
|
-
return Array.isArray(resolved) ? resolved : void 0;
|
|
9269
|
-
} catch {
|
|
9270
|
-
return void 0;
|
|
9271
|
-
}
|
|
9272
|
-
}
|
|
9273
|
-
function nodeConfig(node) {
|
|
9274
|
-
return node.data?.config ?? {};
|
|
9275
|
-
}
|
|
9276
|
-
function resolveNodePorts(node, kind) {
|
|
9277
|
-
const config = nodeConfig(node);
|
|
9278
|
-
const data = node.data;
|
|
9279
|
-
return {
|
|
9280
|
-
inputs: data?.inputs ?? resolvePortSpec(kind?.inputs, config),
|
|
9281
|
-
outputs: data?.outputs ?? resolvePortSpec(kind?.outputs, config)
|
|
9282
|
-
};
|
|
9283
|
-
}
|
|
9284
|
-
|
|
9285
10611
|
// src/registry/connection.ts
|
|
9286
10612
|
var ANY_PORT_TYPE = "any";
|
|
9287
10613
|
var defaultPortCompatibility = (source, target) => {
|
|
@@ -9750,7 +11076,9 @@ function FlowViewer({
|
|
|
9750
11076
|
return {
|
|
9751
11077
|
node,
|
|
9752
11078
|
index: index2,
|
|
9753
|
-
|
|
11079
|
+
// The node's own label is the name the AUTHOR gave THIS node ("Summarize");
|
|
11080
|
+
// the kind label is the generic type name ("LLM Call"). Specific wins.
|
|
11081
|
+
title: node.data?.label ?? kind?.label ?? node.data?.kind ?? node.id,
|
|
9754
11082
|
description: kind?.description ?? null,
|
|
9755
11083
|
accent: kind?.accent ?? categoryAccent(kind?.category ?? "custom"),
|
|
9756
11084
|
status: statuses?.[node.id] ?? null
|