@particle-academy/fancy-flow 0.59.0 → 0.64.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/{HumanPrompt-Bw09OyS3.d.ts → HumanPrompt-BKThiyjB.d.ts} +1 -1
- package/dist/{HumanPrompt-DV5-xnDa.d.cts → HumanPrompt-Bpp3JiVH.d.cts} +1 -1
- package/dist/{chunk-M7M6GLFV.js → chunk-5H54OTKT.js} +3 -3
- package/dist/{chunk-M7M6GLFV.js.map → chunk-5H54OTKT.js.map} +1 -1
- package/dist/chunk-77V4QC6Y.js +54 -0
- package/dist/chunk-77V4QC6Y.js.map +1 -0
- package/dist/{chunk-MX4SJDNI.js → chunk-EO6444T2.js} +4 -4
- package/dist/{chunk-MX4SJDNI.js.map → chunk-EO6444T2.js.map} +1 -1
- package/dist/{chunk-HBE4LVPX.js → chunk-JF6WCRBU.js} +9 -7
- package/dist/chunk-JF6WCRBU.js.map +1 -0
- package/dist/{chunk-LGLOBK6Q.js → chunk-MBVX4ZRB.js} +3 -3
- package/dist/{chunk-LGLOBK6Q.js.map → chunk-MBVX4ZRB.js.map} +1 -1
- package/dist/{chunk-A3TLZS5B.js → chunk-RIAFHQT5.js} +3 -3
- package/dist/{chunk-A3TLZS5B.js.map → chunk-RIAFHQT5.js.map} +1 -1
- package/dist/{chunk-BHM5HGXH.js → chunk-UM4C46AF.js} +38 -14
- package/dist/chunk-UM4C46AF.js.map +1 -0
- package/dist/{chunk-FGYG5JVW.js → chunk-W5DPKJY4.js} +5 -3
- package/dist/chunk-W5DPKJY4.js.map +1 -0
- package/dist/connectors.d.cts +1 -1
- package/dist/connectors.d.ts +1 -1
- package/dist/durable.cjs +7 -5
- package/dist/durable.cjs.map +1 -1
- package/dist/durable.js +2 -2
- package/dist/engine.cjs +189 -29
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.d.cts +67 -5
- package/dist/engine.d.ts +67 -5
- package/dist/engine.js +7 -5
- package/dist/engine.js.map +1 -1
- package/dist/expr-BfXDrs4H.d.cts +149 -0
- package/dist/expr-BfXDrs4H.d.ts +149 -0
- package/dist/fields/react-fancy.d.cts +2 -2
- package/dist/fields/react-fancy.d.ts +2 -2
- package/dist/index.cjs +94 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -84
- package/dist/index.d.ts +7 -84
- package/dist/index.js +13 -12
- package/dist/index.js.map +1 -1
- package/dist/registry/index.d.cts +3 -3
- package/dist/registry/index.d.ts +3 -3
- package/dist/{registry-1qhmRtvC.d.cts → registry-CntAdUcY.d.cts} +1 -1
- package/dist/{registry-D2qocEsY.d.ts → registry-DYoV-MQi.d.ts} +1 -1
- package/dist/registry.cjs +7 -5
- package/dist/registry.cjs.map +1 -1
- package/dist/registry.js +2 -2
- package/dist/runtime.cjs +7 -5
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.js +3 -3
- package/dist/schema.cjs +57 -5
- package/dist/schema.cjs.map +1 -1
- package/dist/schema.js +3 -2
- package/dist/screens.cjs +7 -5
- package/dist/screens.cjs.map +1 -1
- package/dist/screens.js +4 -4
- package/dist/{types-CLSUZW8c.d.ts → types-Ckhz-YwC.d.ts} +7 -2
- package/dist/{types-BLVpNNLN.d.cts → types-D71SKA5A.d.cts} +7 -2
- package/dist/ux.cjs +7 -5
- package/dist/ux.cjs.map +1 -1
- package/dist/ux.d.cts +1 -1
- package/dist/ux.d.ts +1 -1
- package/dist/ux.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-BHM5HGXH.js.map +0 -1
- package/dist/chunk-FGYG5JVW.js.map +0 -1
- package/dist/chunk-HBE4LVPX.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { F as FlowGraph } from './types-JFYjPJAG.js';
|
|
4
|
-
import { C as ConfigField } from './types-
|
|
4
|
+
import { C as ConfigField } from './types-Ckhz-YwC.js';
|
|
5
5
|
|
|
6
6
|
/** What a host renderer is handed. */
|
|
7
7
|
type ConfigFieldRenderContext = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { F as FlowGraph } from './types-JFYjPJAG.cjs';
|
|
4
|
-
import { C as ConfigField } from './types-
|
|
4
|
+
import { C as ConfigField } from './types-D71SKA5A.cjs';
|
|
5
5
|
|
|
6
6
|
/** What a host renderer is handed. */
|
|
7
7
|
type ConfigFieldRenderContext = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getNodeKind, categoryAccent, resolveNodePorts, nodeConfig, NodeResizer, NodeToolbar, Handle, Position, listNodeKinds, kindIds } from './chunk-
|
|
1
|
+
import { getNodeKind, categoryAccent, resolveNodePorts, nodeConfig, NodeResizer, NodeToolbar, Handle, Position, listNodeKinds, kindIds } from './chunk-JF6WCRBU.js';
|
|
2
2
|
import { memo, useMemo } from 'react';
|
|
3
3
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
4
|
|
|
@@ -192,5 +192,5 @@ function buildNodeTypes() {
|
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
export { ANY_PORT_TYPE, RegistryNode, buildNodeTypes, createConnectionValidator, defaultPortCompatibility };
|
|
195
|
-
//# sourceMappingURL=chunk-
|
|
196
|
-
//# sourceMappingURL=chunk-
|
|
195
|
+
//# sourceMappingURL=chunk-5H54OTKT.js.map
|
|
196
|
+
//# sourceMappingURL=chunk-5H54OTKT.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/registry/connection.ts","../src/registry/RegistryNode.tsx","../src/registry/index.ts"],"names":[],"mappings":";;;;;AAqBO,IAAM,aAAA,GAAgB;AActB,IAAM,wBAAA,GAA8C,CAAC,MAAA,EAAQ,MAAA,KAAW;AAC7E,EAAA,MAAM,IAAI,MAAA,EAAQ,IAAA;AAClB,EAAA,MAAM,IAAI,MAAA,E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U,CAAA,EAAG,IAAA,CAAK,MAAM,CAAA,MAAA,EAAS,IAAA,CAAK,MAAA,KAAW,CAAA,GAAI,EAAA,GAAK,GAAG,CAAA,CAAA;AAAA,EAC1F;AACA,EAAA,OAAO,QAAA;AACT;;;AC7EO,SAAS,cAAA,GAA4B;AAC1C,EAAA,MAAM,MAAiB,EAAC;AACxB,EAAA,KAAA,MAAW,CAAA,IAAK,eAAc,EAAG;AAM/B,IAAA,MAAM,QAAA,GAAW,EAAE,SAAA,IAAa,YAAA;AAChC,IAAA,KAAA,MAAW,MAAM,OAAA,CAAQ,CAAC,CAAA,EAAG,GAAA,CAAI,EAAE,CAAA,GAAI,QAAA;AAAA,EACzC;AACA,EAAA,OAAO,GAAA;AACT","file":"chunk-M7M6GLFV.js","sourcesContent":["import type { Connection, Edge } from \"@xyflow/react\";\nimport type { FlowNode, PortDescriptor } from \"../types\";\nimport { getNodeKind } from \"./registry\";\nimport { resolveNodePorts } from \"./ports\";\n\n/**\n * Connection validation — the single rule that decides whether an edge between\n * two ports is allowed. Lives here (React-free, registry-adjacent) so BOTH the\n * canvas (`<FlowCanvas isValidConnection>`) and the agent bridge's\n * `flow_connect` tool call the same function: a connection the canvas refuses\n * is a connection an agent cannot sneak past, and vice versa — no drift.\n *\n * `PortDescriptor.type` has always documented itself as being \"for hosts that\n * want to validate connections\", but nothing consumed it. This wires it up.\n */\n\n/**\n * Wildcard port type — matches any other type. A port that declares no `type`\n * is treated as a wildcard too, so existing flows (whose ports are untyped)\n * validate exactly as before.\n */\nexport const ANY_PORT_TYPE = \"any\";\n\n/** Decides whether a source-output port may feed a target-input port. */\nexport type PortCompatibility = (\n source: PortDescriptor | undefined,\n target: PortDescriptor | undefined,\n) => boolean;\n\n/**\n * Default compatibility rule: allow the connection UNLESS both ports declare a\n * concrete, differing type. An absent type or the `any` wildcard matches\n * anything — so typed ports get enforced while untyped ports stay permissive,\n * making this a safe default that never breaks an existing untyped graph.\n */\nexport const defaultPortCompatibility: PortCompatibility = (source, target) => {\n const s = source?.type;\n const t = target?.type;\n if (!s || !t) return true;\n if (s === ANY_PORT_TYPE || t === ANY_PORT_TYPE) return true;\n return s === t;\n};\n\nexport type ConnectionValidatorOptions = {\n /** Override the type-compatibility rule. Defaults to {@link defaultPortCompatibility}. */\n compatible?: PortCompatibility;\n /**\n * Allow a node's own output to feed its own input (a self-loop). Default\n * false — self-connections are almost always an accident, and the rare flow\n * that wants one can opt in.\n */\n allowSelfConnection?: boolean;\n};\n\n/** Resolve a node's effective ports for one side, going through the registry. */\nfunction portsFor(node: FlowNode, side: \"inputs\" | \"outputs\"): PortDescriptor[] {\n const kind = getNodeKind((node.data as any)?.kind ?? node.type);\n const resolved = resolveNodePorts(node, kind ?? undefined);\n return resolved[side] ?? [];\n}\n\n/**\n * Resolve which port a handle id refers to. When a side has a single port and\n * the handle id is absent (React Flow omits it for a lone default handle), use\n * that port; otherwise match by id.\n */\nfunction findPort(\n ports: PortDescriptor[],\n handleId: string | null | undefined,\n): PortDescriptor | undefined {\n if (handleId == null) return ports.length === 1 ? ports[0] : undefined;\n return ports.find((p) => p.id === handleId);\n}\n\n/**\n * Build an `isValidConnection` predicate that enforces port-type compatibility\n * against a live node list. Pass it straight to `<FlowCanvas isValidConnection>`\n * or reuse it to gate an agent's `flow_connect`.\n *\n * `getNodes` is called on every check so the validator always sees the current\n * graph (wire it to a ref/state getter, not a snapshot).\n *\n * A connection is rejected when: an endpoint is missing; it is a self-loop and\n * `allowSelfConnection` is off; either node is unknown; or the resolved ports\n * are type-incompatible. Nodes/ports with no declared type validate as before.\n */\nexport function createConnectionValidator(\n getNodes: () => FlowNode[],\n options: ConnectionValidatorOptions = {},\n): (connection: Connection | Edge) => boolean {\n const compatible = options.compatible ?? defaultPortCompatibility;\n return (connection) => {\n const { source, target, sourceHandle, targetHandle } = connection;\n if (!source || !target) return false;\n if (!options.allowSelfConnection && source === target) return false;\n\n const nodes = getNodes();\n const src = nodes.find((n) => n.id === source);\n const tgt = nodes.find((n) => n.id === target);\n if (!src || !tgt) return false;\n\n const outPort = findPort(portsFor(src, \"outputs\"), sourceHandle);\n const inPort = findPort(portsFor(tgt, \"inputs\"), targetHandle);\n return compatible(outPort, inPort);\n };\n}\n","import { memo, useMemo } from \"react\";\nimport { Handle, NodeResizer, NodeToolbar, Position, type NodeProps } from \"@xyflow/react\";\nimport type { FlowNode, NodeRunStatus, PortDescriptor } from \"../types\";\nimport { categoryAccent, getNodeKind } from \"./registry\";\nimport { nodeConfig, resolveNodePorts } from \"./ports\";\n\n/**\n * RegistryNode — generic node renderer that looks up the node's kind in\n * the registry and applies its `accent`/`label`/`icon`/`renderBody`. Used\n * as the xyflow node component for every registered kind.\n */\nfunction RegistryNodeInner(props: NodeProps<FlowNode>) {\n const kindName = (props.data as any).kind ?? props.type;\n const kind = useMemo(() => getNodeKind(kindName), [kindName]);\n\n if (!kind) {\n return (\n <div className=\"ff-node ff-node--unknown\">\n <div className=\"ff-node__header\" style={{ background: \"#71717a\" }}>\n <span className=\"ff-node__tag\">UNKNOWN</span>\n <span className=\"ff-node__label\">{kindName}</span>\n </div>\n <p className=\"ff-node__desc\">No registered kind for \"{kindName}\".</p>\n </div>\n );\n }\n\n const data = props.data;\n const status: NodeRunStatus = data.status ?? \"idle\";\n const accent = kind.accent ?? categoryAccent(kind.category);\n const resolved = resolveNodePorts(props, kind);\n const inputs: PortDescriptor[] = resolved.inputs ?? defaultInputs(kind.category);\n const outputs: PortDescriptor[] = resolved.outputs ?? defaultOutputs(kind.category);\n const config = nodeConfig(props);\n const label = data.label ?? kind.label;\n\n return (\n <div\n className={[\n \"ff-node\",\n `ff-node--status-${status}`,\n `ff-node--cat-${kind.category}`,\n props.selected ? \"ff-node--selected\" : \"\",\n kind.resizable ? \"ff-node--resizable\" : \"\",\n ].filter(Boolean).join(\" \")}\n style={{ borderColor: props.selected ? accent : undefined }}\n >\n {kind.resizable && (\n <NodeResizer\n isVisible={props.selected ?? false}\n color={accent}\n {...(typeof kind.resizable === \"object\" ? kind.resizable : {})}\n />\n )}\n {kind.toolbar && (\n <NodeToolbar isVisible={props.selected ?? false}>\n {kind.toolbar({ nodeId: props.id, config: config as any, selected: props.selected ?? false })}\n </NodeToolbar>\n )}\n <header className=\"ff-node__header\" style={{ background: accent }}>\n {kind.icon && <span className=\"ff-node__icon\" aria-hidden>{kind.icon}</span>}\n <span className=\"ff-node__tag\">{kind.label.toUpperCase()}</span>\n <span className=\"ff-node__label\">{label}</span>\n {status !== \"idle\" && <span className={`ff-node__dot ff-node__dot--${status}`} aria-label={`status ${status}`} />}\n </header>\n\n {data.description && <p className=\"ff-node__desc\">{data.description}</p>}\n\n <div className=\"ff-node__body\">\n {kind.renderBody\n ? kind.renderBody({ nodeId: props.id, config: config as any, selected: props.selected ?? false })\n : <DefaultBody config={config} kind={kind.configSchema} />}\n </div>\n\n {data.statusText && <p className=\"ff-node__status-text\">{data.statusText}</p>}\n\n {(data as any).output !== undefined && (\n <p className=\"ff-node__output\" title=\"Latest output\">→ {previewValue((data as any).output)}</p>\n )}\n\n {inputs.map((p, i) => (\n <Handle\n key={p.id}\n type=\"target\"\n position={Position.Left}\n id={p.id}\n style={portStyle(i, inputs.length)}\n title={p.label ?? p.id}\n />\n ))}\n {outputs.map((p, i) => (\n <Handle\n key={p.id}\n type=\"source\"\n position={Position.Right}\n id={p.id}\n style={portStyle(i, outputs.length)}\n title={p.label ?? p.id}\n />\n ))}\n </div>\n );\n}\n\nexport const RegistryNode = memo(RegistryNodeInner);\n\nfunction defaultInputs(category: string): PortDescriptor[] {\n return category === \"trigger\" ? [] : [{ id: \"in\" }];\n}\nfunction defaultOutputs(category: string): PortDescriptor[] {\n return category === \"output\" ? [] : [{ id: \"out\" }];\n}\n\nfunction portStyle(i: number, total: number): React.CSSProperties {\n if (total <= 1) return {};\n const slot = (100 / (total + 1)) * (i + 1);\n return { top: `${slot}%` };\n}\n\n/**\n * DefaultBody — compact summary of the config values for nodes that\n * don't provide a custom renderBody. Skips fields that look empty.\n */\nfunction DefaultBody({ config, kind }: { config: Record<string, unknown>; kind?: import(\"./types\").ConfigField[] }) {\n const fields = kind ?? [];\n // A kind with no config schema has nothing to configure — don't nag with a\n // \"configure in the panel\" prompt (that's only for a kind that HAS fields but\n // none are filled in yet). Triggers, Output, etc. render as just their header.\n if (fields.length === 0) return null;\n const visible = fields\n .map((f) => ({ field: f, value: config[f.key] }))\n .filter(({ value }) => value !== undefined && value !== \"\" && value !== null);\n if (visible.length === 0) {\n return <div className=\"ff-node__body-empty\">— configure in the panel</div>;\n }\n return (\n <ul className=\"ff-node__summary\">\n {visible.slice(0, 4).map(({ field, value }) => (\n <li key={field.key}>\n <span className=\"ff-node__summary-key\">{field.label}:</span>\n <span className=\"ff-node__summary-value\">{previewValue(value)}</span>\n </li>\n ))}\n {visible.length > 4 && <li className=\"ff-node__summary-more\">+ {visible.length - 4} more</li>}\n </ul>\n );\n}\n\nconst truncate = (s: string, n = 30): string => (s.length > n ? s.slice(0, n - 1) + \"…\" : s);\n\n/** A short, human name for one item in a repeater/list value. */\nfunction itemLabel(item: unknown): string {\n if (item && typeof item === \"object\") {\n const o = item as Record<string, unknown>;\n const name = o.label ?? o.name ?? o.key ?? o.title ?? o.id;\n if (typeof name === \"string\" && name) return name;\n if (typeof name === \"number\") return String(name);\n return \"item\";\n }\n return String(item ?? \"\");\n}\n\n/**\n * A node card's job is to read at a glance, not to be a data dump — so a value\n * is summarised, never `JSON.stringify`d. An array becomes its item names (or a\n * count), an object becomes a field count. Raw JSON on a card was the specific\n * thing to kill: `Fields: [{\"key\":\"answer\",…}]` reads as noise.\n */\nexport function previewValue(v: unknown): string {\n if (v === null || v === undefined) return \"\";\n if (typeof v === \"string\") return truncate(v);\n if (typeof v === \"number\" || typeof v === \"boolean\") return String(v);\n if (Array.isArray(v)) {\n if (v.length === 0) return \"none\";\n const names = v.slice(0, 3).map(itemLabel).filter(Boolean).join(\", \");\n const rest = v.length > 3 ? `, +${v.length - 3}` : \"\";\n return names ? truncate(names + rest) : `${v.length} item${v.length === 1 ? \"\" : \"s\"}`;\n }\n if (typeof v === \"object\") {\n const keys = Object.keys(v as object);\n return keys.length === 0 ? \"empty\" : `${keys.length} field${keys.length === 1 ? \"\" : \"s\"}`;\n }\n return \"…\";\n}\n","export type {\n ConfigField,\n TextConfigField,\n TextareaConfigField,\n NumberConfigField,\n SelectConfigField,\n SwitchConfigField,\n JsonConfigField,\n ExpressionConfigField,\n CredentialConfigField,\n RepeaterConfigField,\n RepeaterRowField,\n KeyValueConfigField,\n DocumentConfigField,\n NodeCategory,\n NodeKindDefinition,\n EmitsRelation,\n PortSpec,\n RenderBodyContext,\n} from \"./types\";\n\nexport { resolvePortSpec, resolveNodePorts, nodeConfig } from \"./ports\";\n\nexport {\n createConnectionValidator,\n defaultPortCompatibility,\n ANY_PORT_TYPE,\n type PortCompatibility,\n type ConnectionValidatorOptions,\n} from \"./connection\";\n\n/** Host capabilities — core declares the contract, the host supplies the impl. */\nexport {\n registerLlmClient,\n getLlmClient,\n registerWorkflowResolver,\n getWorkflowResolver,\n capabilityStatus,\n type LlmClient,\n type LlmRoute,\n type LlmRouteRequest,\n type LlmRouteChoice,\n type WorkflowResolver,\n type WorkflowResolution,\n type WorkflowResolutionFailure,\n type CapabilityId,\n isResolutionFailure,\n} from \"./capabilities\";\n\n/**\n * The human-pause contract — a run waiting for a person, not a failure.\n * `decodePause` is the one function a durable runner needs.\n */\nexport {\n pauseForHuman,\n encodePause,\n decodePause,\n isPause,\n PAUSE_PREFIX,\n LEGACY_PAUSE_PREFIXES,\n type PauseAwaiting,\n type PauseSignal,\n} from \"./pause\";\n\nexport { subflowExecutor, subflowPorts, subflowMode, DEFAULT_MAX_DEPTH, type SubflowMode } from \"./subflow\";\nexport { llmRouterExecutor, declaredRoutes, resolveFallbackPort } from \"./llm-router\";\n/** @deprecated Renamed to `llmRouterExecutor` — the id and label now match. */\nexport { llmRouterExecutor as llmBranchExecutor } from \"./llm-router\";\n\nexport {\n registerRichInputAdapter,\n getRichInputAdapter,\n isRichInputEnabled,\n onRichInputAdapterChanged,\n RichInputPreview,\n type RichInputAdapter,\n} from \"./rich-input\";\n\nexport {\n registerNodeKind,\n overrideNodeKind,\n clearNodeKindOverrides,\n type NodeKindPresentation,\n getNodeKind,\n resolveKindId,\n kindIds,\n listNodeKinds,\n onNodeKindsChanged,\n defaultConfigFor,\n validateConfig,\n categoryAccent,\n} from \"./registry\";\n\nexport { RegistryNode } from \"./RegistryNode\";\nexport { registerBuiltinKinds, BUILTIN_KINDS } from \"./builtin\";\nexport { ensureBuiltinKinds } from \"./registry\";\n\nimport type { NodeTypes } from \"@xyflow/react\";\nimport { RegistryNode } from \"./RegistryNode\";\nimport { kindIds, listNodeKinds } from \"./registry\";\n\n/**\n * Build an xyflow `nodeTypes` map from the registry — every registered\n * kind gets `RegistryNode` as its renderer. Refresh manually via\n * `useNodeTypes()` (a hook that subscribes to registry changes).\n */\nexport function buildNodeTypes(): NodeTypes {\n const map: NodeTypes = {};\n for (const k of listNodeKinds()) {\n // A kind may bring its own full renderer (lanes/containers); otherwise the\n // default card. Key on every id the kind answers to, not just the canonical\n // one — xyflow looks the renderer up by `node.type` BEFORE RegistryNode gets\n // a chance to resolve aliases, so a graph carrying a pre-namespace type would\n // otherwise fall through to the unknown-node placeholder.\n const renderer = k.component ?? RegistryNode;\n for (const id of kindIds(k)) map[id] = renderer;\n }\n return map;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/registry/connection.ts","../src/registry/RegistryNode.tsx","../src/registry/index.ts"],"names":[],"mappings":";;;;;AAqBO,IAAM,aAAA,GAAgB;AActB,IAAM,wBAAA,GAA8C,CAAC,MAAA,EAAQ,MAAA,KAAW;AAC7E,EAAA,MAAM,IAAI,MAAA,EAAQ,IAAA;AAClB,EAAA,MAAM,IAAI,MAAA,EAAQ,IAAA;AAClB,EAAA,IAAI,CAAC,CAAA,IAAK,CAAC,CAAA,EAAG,OAAO,IAAA;AACrB,EAAA,IAAI,CAAA,KAAM,aAAA,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A;AAAA,EAC1F;AACA,EAAA,OAAO,QAAA;AACT;;;AC7EO,SAAS,cAAA,GAA4B;AAC1C,EAAA,MAAM,MAAiB,EAAC;AACxB,EAAA,KAAA,MAAW,CAAA,IAAK,eAAc,EAAG;AAM/B,IAAA,MAAM,QAAA,GAAW,EAAE,SAAA,IAAa,YAAA;AAChC,IAAA,KAAA,MAAW,MAAM,OAAA,CAAQ,CAAC,CAAA,EAAG,GAAA,CAAI,EAAE,CAAA,GAAI,QAAA;AAAA,EACzC;AACA,EAAA,OAAO,GAAA;AACT","file":"chunk-5H54OTKT.js","sourcesContent":["import type { Connection, Edge } from \"@xyflow/react\";\nimport type { FlowNode, PortDescriptor } from \"../types\";\nimport { getNodeKind } from \"./registry\";\nimport { resolveNodePorts } from \"./ports\";\n\n/**\n * Connection validation — the single rule that decides whether an edge between\n * two ports is allowed. Lives here (React-free, registry-adjacent) so BOTH the\n * canvas (`<FlowCanvas isValidConnection>`) and the agent bridge's\n * `flow_connect` tool call the same function: a connection the canvas refuses\n * is a connection an agent cannot sneak past, and vice versa — no drift.\n *\n * `PortDescriptor.type` has always documented itself as being \"for hosts that\n * want to validate connections\", but nothing consumed it. This wires it up.\n */\n\n/**\n * Wildcard port type — matches any other type. A port that declares no `type`\n * is treated as a wildcard too, so existing flows (whose ports are untyped)\n * validate exactly as before.\n */\nexport const ANY_PORT_TYPE = \"any\";\n\n/** Decides whether a source-output port may feed a target-input port. */\nexport type PortCompatibility = (\n source: PortDescriptor | undefined,\n target: PortDescriptor | undefined,\n) => boolean;\n\n/**\n * Default compatibility rule: allow the connection UNLESS both ports declare a\n * concrete, differing type. An absent type or the `any` wildcard matches\n * anything — so typed ports get enforced while untyped ports stay permissive,\n * making this a safe default that never breaks an existing untyped graph.\n */\nexport const defaultPortCompatibility: PortCompatibility = (source, target) => {\n const s = source?.type;\n const t = target?.type;\n if (!s || !t) return true;\n if (s === ANY_PORT_TYPE || t === ANY_PORT_TYPE) return true;\n return s === t;\n};\n\nexport type ConnectionValidatorOptions = {\n /** Override the type-compatibility rule. Defaults to {@link defaultPortCompatibility}. */\n compatible?: PortCompatibility;\n /**\n * Allow a node's own output to feed its own input (a self-loop). Default\n * false — self-connections are almost always an accident, and the rare flow\n * that wants one can opt in.\n */\n allowSelfConnection?: boolean;\n};\n\n/** Resolve a node's effective ports for one side, going through the registry. */\nfunction portsFor(node: FlowNode, side: \"inputs\" | \"outputs\"): PortDescriptor[] {\n const kind = getNodeKind((node.data as any)?.kind ?? node.type);\n const resolved = resolveNodePorts(node, kind ?? undefined);\n return resolved[side] ?? [];\n}\n\n/**\n * Resolve which port a handle id refers to. When a side has a single port and\n * the handle id is absent (React Flow omits it for a lone default handle), use\n * that port; otherwise match by id.\n */\nfunction findPort(\n ports: PortDescriptor[],\n handleId: string | null | undefined,\n): PortDescriptor | undefined {\n if (handleId == null) return ports.length === 1 ? ports[0] : undefined;\n return ports.find((p) => p.id === handleId);\n}\n\n/**\n * Build an `isValidConnection` predicate that enforces port-type compatibility\n * against a live node list. Pass it straight to `<FlowCanvas isValidConnection>`\n * or reuse it to gate an agent's `flow_connect`.\n *\n * `getNodes` is called on every check so the validator always sees the current\n * graph (wire it to a ref/state getter, not a snapshot).\n *\n * A connection is rejected when: an endpoint is missing; it is a self-loop and\n * `allowSelfConnection` is off; either node is unknown; or the resolved ports\n * are type-incompatible. Nodes/ports with no declared type validate as before.\n */\nexport function createConnectionValidator(\n getNodes: () => FlowNode[],\n options: ConnectionValidatorOptions = {},\n): (connection: Connection | Edge) => boolean {\n const compatible = options.compatible ?? defaultPortCompatibility;\n return (connection) => {\n const { source, target, sourceHandle, targetHandle } = connection;\n if (!source || !target) return false;\n if (!options.allowSelfConnection && source === target) return false;\n\n const nodes = getNodes();\n const src = nodes.find((n) => n.id === source);\n const tgt = nodes.find((n) => n.id === target);\n if (!src || !tgt) return false;\n\n const outPort = findPort(portsFor(src, \"outputs\"), sourceHandle);\n const inPort = findPort(portsFor(tgt, \"inputs\"), targetHandle);\n return compatible(outPort, inPort);\n };\n}\n","import { memo, useMemo } from \"react\";\nimport { Handle, NodeResizer, NodeToolbar, Position, type NodeProps } from \"@xyflow/react\";\nimport type { FlowNode, NodeRunStatus, PortDescriptor } from \"../types\";\nimport { categoryAccent, getNodeKind } from \"./registry\";\nimport { nodeConfig, resolveNodePorts } from \"./ports\";\n\n/**\n * RegistryNode — generic node renderer that looks up the node's kind in\n * the registry and applies its `accent`/`label`/`icon`/`renderBody`. Used\n * as the xyflow node component for every registered kind.\n */\nfunction RegistryNodeInner(props: NodeProps<FlowNode>) {\n const kindName = (props.data as any).kind ?? props.type;\n const kind = useMemo(() => getNodeKind(kindName), [kindName]);\n\n if (!kind) {\n return (\n <div className=\"ff-node ff-node--unknown\">\n <div className=\"ff-node__header\" style={{ background: \"#71717a\" }}>\n <span className=\"ff-node__tag\">UNKNOWN</span>\n <span className=\"ff-node__label\">{kindName}</span>\n </div>\n <p className=\"ff-node__desc\">No registered kind for \"{kindName}\".</p>\n </div>\n );\n }\n\n const data = props.data;\n const status: NodeRunStatus = data.status ?? \"idle\";\n const accent = kind.accent ?? categoryAccent(kind.category);\n const resolved = resolveNodePorts(props, kind);\n const inputs: PortDescriptor[] = resolved.inputs ?? defaultInputs(kind.category);\n const outputs: PortDescriptor[] = resolved.outputs ?? defaultOutputs(kind.category);\n const config = nodeConfig(props);\n const label = data.label ?? kind.label;\n\n return (\n <div\n className={[\n \"ff-node\",\n `ff-node--status-${status}`,\n `ff-node--cat-${kind.category}`,\n props.selected ? \"ff-node--selected\" : \"\",\n kind.resizable ? \"ff-node--resizable\" : \"\",\n ].filter(Boolean).join(\" \")}\n style={{ borderColor: props.selected ? accent : undefined }}\n >\n {kind.resizable && (\n <NodeResizer\n isVisible={props.selected ?? false}\n color={accent}\n {...(typeof kind.resizable === \"object\" ? kind.resizable : {})}\n />\n )}\n {kind.toolbar && (\n <NodeToolbar isVisible={props.selected ?? false}>\n {kind.toolbar({ nodeId: props.id, config: config as any, selected: props.selected ?? false })}\n </NodeToolbar>\n )}\n <header className=\"ff-node__header\" style={{ background: accent }}>\n {kind.icon && <span className=\"ff-node__icon\" aria-hidden>{kind.icon}</span>}\n <span className=\"ff-node__tag\">{kind.label.toUpperCase()}</span>\n <span className=\"ff-node__label\">{label}</span>\n {status !== \"idle\" && <span className={`ff-node__dot ff-node__dot--${status}`} aria-label={`status ${status}`} />}\n </header>\n\n {data.description && <p className=\"ff-node__desc\">{data.description}</p>}\n\n <div className=\"ff-node__body\">\n {kind.renderBody\n ? kind.renderBody({ nodeId: props.id, config: config as any, selected: props.selected ?? false })\n : <DefaultBody config={config} kind={kind.configSchema} />}\n </div>\n\n {data.statusText && <p className=\"ff-node__status-text\">{data.statusText}</p>}\n\n {(data as any).output !== undefined && (\n <p className=\"ff-node__output\" title=\"Latest output\">→ {previewValue((data as any).output)}</p>\n )}\n\n {inputs.map((p, i) => (\n <Handle\n key={p.id}\n type=\"target\"\n position={Position.Left}\n id={p.id}\n style={portStyle(i, inputs.length)}\n title={p.label ?? p.id}\n />\n ))}\n {outputs.map((p, i) => (\n <Handle\n key={p.id}\n type=\"source\"\n position={Position.Right}\n id={p.id}\n style={portStyle(i, outputs.length)}\n title={p.label ?? p.id}\n />\n ))}\n </div>\n );\n}\n\nexport const RegistryNode = memo(RegistryNodeInner);\n\nfunction defaultInputs(category: string): PortDescriptor[] {\n return category === \"trigger\" ? [] : [{ id: \"in\" }];\n}\nfunction defaultOutputs(category: string): PortDescriptor[] {\n return category === \"output\" ? [] : [{ id: \"out\" }];\n}\n\nfunction portStyle(i: number, total: number): React.CSSProperties {\n if (total <= 1) return {};\n const slot = (100 / (total + 1)) * (i + 1);\n return { top: `${slot}%` };\n}\n\n/**\n * DefaultBody — compact summary of the config values for nodes that\n * don't provide a custom renderBody. Skips fields that look empty.\n */\nfunction DefaultBody({ config, kind }: { config: Record<string, unknown>; kind?: import(\"./types\").ConfigField[] }) {\n const fields = kind ?? [];\n // A kind with no config schema has nothing to configure — don't nag with a\n // \"configure in the panel\" prompt (that's only for a kind that HAS fields but\n // none are filled in yet). Triggers, Output, etc. render as just their header.\n if (fields.length === 0) return null;\n const visible = fields\n .map((f) => ({ field: f, value: config[f.key] }))\n .filter(({ value }) => value !== undefined && value !== \"\" && value !== null);\n if (visible.length === 0) {\n return <div className=\"ff-node__body-empty\">— configure in the panel</div>;\n }\n return (\n <ul className=\"ff-node__summary\">\n {visible.slice(0, 4).map(({ field, value }) => (\n <li key={field.key}>\n <span className=\"ff-node__summary-key\">{field.label}:</span>\n <span className=\"ff-node__summary-value\">{previewValue(value)}</span>\n </li>\n ))}\n {visible.length > 4 && <li className=\"ff-node__summary-more\">+ {visible.length - 4} more</li>}\n </ul>\n );\n}\n\nconst truncate = (s: string, n = 30): string => (s.length > n ? s.slice(0, n - 1) + \"…\" : s);\n\n/** A short, human name for one item in a repeater/list value. */\nfunction itemLabel(item: unknown): string {\n if (item && typeof item === \"object\") {\n const o = item as Record<string, unknown>;\n const name = o.label ?? o.name ?? o.key ?? o.title ?? o.id;\n if (typeof name === \"string\" && name) return name;\n if (typeof name === \"number\") return String(name);\n return \"item\";\n }\n return String(item ?? \"\");\n}\n\n/**\n * A node card's job is to read at a glance, not to be a data dump — so a value\n * is summarised, never `JSON.stringify`d. An array becomes its item names (or a\n * count), an object becomes a field count. Raw JSON on a card was the specific\n * thing to kill: `Fields: [{\"key\":\"answer\",…}]` reads as noise.\n */\nexport function previewValue(v: unknown): string {\n if (v === null || v === undefined) return \"\";\n if (typeof v === \"string\") return truncate(v);\n if (typeof v === \"number\" || typeof v === \"boolean\") return String(v);\n if (Array.isArray(v)) {\n if (v.length === 0) return \"none\";\n const names = v.slice(0, 3).map(itemLabel).filter(Boolean).join(\", \");\n const rest = v.length > 3 ? `, +${v.length - 3}` : \"\";\n return names ? truncate(names + rest) : `${v.length} item${v.length === 1 ? \"\" : \"s\"}`;\n }\n if (typeof v === \"object\") {\n const keys = Object.keys(v as object);\n return keys.length === 0 ? \"empty\" : `${keys.length} field${keys.length === 1 ? \"\" : \"s\"}`;\n }\n return \"…\";\n}\n","export type {\n ConfigField,\n TextConfigField,\n TextareaConfigField,\n NumberConfigField,\n SelectConfigField,\n SwitchConfigField,\n JsonConfigField,\n ExpressionConfigField,\n CredentialConfigField,\n RepeaterConfigField,\n RepeaterRowField,\n KeyValueConfigField,\n DocumentConfigField,\n NodeCategory,\n NodeKindDefinition,\n EmitsRelation,\n PortSpec,\n RenderBodyContext,\n} from \"./types\";\n\nexport { resolvePortSpec, resolveNodePorts, nodeConfig } from \"./ports\";\n\nexport {\n createConnectionValidator,\n defaultPortCompatibility,\n ANY_PORT_TYPE,\n type PortCompatibility,\n type ConnectionValidatorOptions,\n} from \"./connection\";\n\n/** Host capabilities — core declares the contract, the host supplies the impl. */\nexport {\n registerLlmClient,\n getLlmClient,\n registerWorkflowResolver,\n getWorkflowResolver,\n capabilityStatus,\n type LlmClient,\n type LlmRoute,\n type LlmRouteRequest,\n type LlmRouteChoice,\n type WorkflowResolver,\n type WorkflowResolution,\n type WorkflowResolutionFailure,\n type CapabilityId,\n isResolutionFailure,\n} from \"./capabilities\";\n\n/**\n * The human-pause contract — a run waiting for a person, not a failure.\n * `decodePause` is the one function a durable runner needs.\n */\nexport {\n pauseForHuman,\n encodePause,\n decodePause,\n isPause,\n PAUSE_PREFIX,\n LEGACY_PAUSE_PREFIXES,\n type PauseAwaiting,\n type PauseSignal,\n} from \"./pause\";\n\nexport { subflowExecutor, subflowPorts, subflowMode, DEFAULT_MAX_DEPTH, type SubflowMode } from \"./subflow\";\nexport { llmRouterExecutor, declaredRoutes, resolveFallbackPort } from \"./llm-router\";\n/** @deprecated Renamed to `llmRouterExecutor` — the id and label now match. */\nexport { llmRouterExecutor as llmBranchExecutor } from \"./llm-router\";\n\nexport {\n registerRichInputAdapter,\n getRichInputAdapter,\n isRichInputEnabled,\n onRichInputAdapterChanged,\n RichInputPreview,\n type RichInputAdapter,\n} from \"./rich-input\";\n\nexport {\n registerNodeKind,\n overrideNodeKind,\n clearNodeKindOverrides,\n type NodeKindPresentation,\n getNodeKind,\n resolveKindId,\n kindIds,\n listNodeKinds,\n onNodeKindsChanged,\n defaultConfigFor,\n validateConfig,\n categoryAccent,\n} from \"./registry\";\n\nexport { RegistryNode } from \"./RegistryNode\";\nexport { registerBuiltinKinds, BUILTIN_KINDS } from \"./builtin\";\nexport { ensureBuiltinKinds } from \"./registry\";\n\nimport type { NodeTypes } from \"@xyflow/react\";\nimport { RegistryNode } from \"./RegistryNode\";\nimport { kindIds, listNodeKinds } from \"./registry\";\n\n/**\n * Build an xyflow `nodeTypes` map from the registry — every registered\n * kind gets `RegistryNode` as its renderer. Refresh manually via\n * `useNodeTypes()` (a hook that subscribes to registry changes).\n */\nexport function buildNodeTypes(): NodeTypes {\n const map: NodeTypes = {};\n for (const k of listNodeKinds()) {\n // A kind may bring its own full renderer (lanes/containers); otherwise the\n // default card. Key on every id the kind answers to, not just the canonical\n // one — xyflow looks the renderer up by `node.type` BEFORE RegistryNode gets\n // a chance to resolve aliases, so a graph carrying a pre-namespace type would\n // otherwise fall through to the unknown-node placeholder.\n const renderer = k.component ?? RegistryNode;\n for (const id of kindIds(k)) map[id] = renderer;\n }\n return map;\n}\n"]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { getNodeKind, kindIds } from './chunk-JF6WCRBU.js';
|
|
2
|
+
|
|
3
|
+
// src/analysis/graph-connectivity.ts
|
|
4
|
+
function checkGraphConnectivity(graph) {
|
|
5
|
+
const { nodes, edges } = graph;
|
|
6
|
+
const issues = [];
|
|
7
|
+
const hasIncoming = /* @__PURE__ */ new Set();
|
|
8
|
+
const hasOutgoing = /* @__PURE__ */ new Set();
|
|
9
|
+
for (const edge of edges) {
|
|
10
|
+
hasIncoming.add(edge.target);
|
|
11
|
+
hasOutgoing.add(edge.source);
|
|
12
|
+
}
|
|
13
|
+
const single = nodes.length === 1;
|
|
14
|
+
for (const node of nodes) {
|
|
15
|
+
if (single || mayFloat(node)) continue;
|
|
16
|
+
if (!hasIncoming.has(node.id) && !hasOutgoing.has(node.id)) {
|
|
17
|
+
issues.push({
|
|
18
|
+
level: "error",
|
|
19
|
+
nodeId: node.id,
|
|
20
|
+
message: `Node "${node.id}" is connected to nothing \u2014 no inbound edge and no outbound edge. It still RUNS (a node with no inbound edge is a root), but it receives nothing from the graph and reaches nobody in it, so it is either unwired or left behind by a deletion. Only a note, an annotation or a lane may float.`
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const byId = new Map(nodes.map((n) => [n.id, n]));
|
|
25
|
+
for (const edge of edges) {
|
|
26
|
+
const source = byId.get(edge.source);
|
|
27
|
+
if (!source || !isTerminator(source)) continue;
|
|
28
|
+
issues.push({
|
|
29
|
+
level: "error",
|
|
30
|
+
edgeId: edge.id,
|
|
31
|
+
message: `Edge "${edge.id}" reads from "${edge.source}", which is a TERMINAL node and publishes no output ports at all. Nothing can ever travel this edge: it does not fail at run time, it delivers nothing, and "${edge.target}" runs anyway with an empty input.`
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return issues;
|
|
35
|
+
}
|
|
36
|
+
function mayFloat(node) {
|
|
37
|
+
const type = node.type;
|
|
38
|
+
if (!type) return false;
|
|
39
|
+
if (type === "note") return true;
|
|
40
|
+
const kind = getNodeKind(type);
|
|
41
|
+
if (!kind) return true;
|
|
42
|
+
return kindIds(kind).includes("note") || kind.category === "annotation" || kind.category === "layout";
|
|
43
|
+
}
|
|
44
|
+
function isTerminator(node) {
|
|
45
|
+
const own = node.data?.outputs;
|
|
46
|
+
if (Array.isArray(own)) return own.length === 0;
|
|
47
|
+
const kind = node.type ? getNodeKind(node.type) : null;
|
|
48
|
+
if (!kind) return false;
|
|
49
|
+
return Array.isArray(kind.outputs) && kind.outputs.length === 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { checkGraphConnectivity, mayFloat };
|
|
53
|
+
//# sourceMappingURL=chunk-77V4QC6Y.js.map
|
|
54
|
+
//#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","file":"chunk-77V4QC6Y.js","sourcesContent":["import { getNodeKind, kindIds } from \"../registry/registry\";\nimport type { FlowGraph, FlowNode } from \"../types\";\nimport type { ImportIssue } from \"../schema/workflow-schema\";\n\n/**\n * Refuse a graph whose nodes cannot take part in the workflow's dataflow.\n *\n * Two shapes, both of which import cleanly and then quietly do nothing. Neither\n * FAILS — which is what makes them worth refusing at authoring time, because a\n * run that reports success is the worst way for a workflow to be wrong. Both\n * were measured against the PHP twin's engine before this was written, and both\n * behave the same way here:\n *\n * ## 1. A FLOATING node — no inbound and no outbound edge\n *\n * It is NOT skipped. A node with no incoming edge is a root, so the topo sort\n * runs it: a three-node graph with one floating `log` executed `t,lonely,o`. It\n * runs disconnected — receiving nothing from the graph and reaching nobody in\n * it — which is precisely the state an author cannot see on a canvas.\n *\n * ## 2. An edge leaving a TERMINATOR\n *\n * A terminal kind — `output`, `log` — declares an EMPTY output port list. It\n * ends a chain. Measured: `t -> output -> log` imported clean and the `log` DID\n * run, with `{{ input }}` resolving to `\"\"`. `collectInputs` binds a payload\n * only when `\"<sourceId>:<handle>\"` exists, and a node publishing no ports never\n * creates that key — so the edge does not fail, it delivers nothing, and the\n * node downstream operates on a hole.\n *\n * That is the same silent-nothing the undelivered-edge diagnostic reports at run\n * time, but this one is decidable FROM THE DOCUMENT ALONE.\n *\n * ## What may float\n *\n * See {@link mayFloat}. Not only `note`: any `annotation` or `layout` kind (a\n * swimlane is never wired to anything — that is what a lane IS), and any kind\n * the registry does not know.\n */\nexport function checkGraphConnectivity(graph: FlowGraph): ImportIssue[] {\n const { nodes, edges } = graph;\n const issues: ImportIssue[] = [];\n\n const hasIncoming = new Set<string>();\n const hasOutgoing = new Set<string>();\n for (const edge of edges) {\n hasIncoming.add(edge.target);\n hasOutgoing.add(edge.source);\n }\n\n // A single-node graph is not \"floating\" — it is a graph with one step, which\n // is a legitimate (if small) workflow and what every graph looks like on the\n // way to a bigger one. Refusing it would make the editor unusable from the\n // first node placed.\n const single = nodes.length === 1;\n\n for (const node of nodes) {\n if (single || mayFloat(node)) continue;\n\n if (!hasIncoming.has(node.id) && !hasOutgoing.has(node.id)) {\n issues.push({\n level: \"error\",\n nodeId: node.id,\n message:\n `Node \"${node.id}\" is connected to nothing — no inbound edge and no outbound edge. ` +\n `It still RUNS (a node with no inbound edge is a root), but it receives nothing from ` +\n `the graph and reaches nobody in it, so it is either unwired or left behind by a ` +\n `deletion. Only a note, an annotation or a lane may float.`,\n });\n }\n }\n\n const byId = new Map(nodes.map((n) => [n.id, n]));\n\n for (const edge of edges) {\n const source = byId.get(edge.source);\n if (!source || !isTerminator(source)) continue;\n\n issues.push({\n level: \"error\",\n edgeId: edge.id,\n message:\n `Edge \"${edge.id}\" reads from \"${edge.source}\", which is a TERMINAL node and publishes ` +\n `no output ports at all. Nothing can ever travel this edge: it does not fail at run ` +\n `time, it delivers nothing, and \"${edge.target}\" runs anyway with an empty input.`,\n });\n }\n\n return issues;\n}\n\n/**\n * Which nodes are allowed to sit unconnected.\n *\n * Three answers, and the third is the one that took a second pass — it was\n * missed in the PHP twin's first release and shipped as 0.48.1:\n *\n * 1. **`note`**, across every id the kind answers to, so a graph saved with the\n * canonical `@particle-academy/note` stays an annotation rather than becoming\n * an unwireable node.\n * 2. **Any `annotation` or `layout` kind.** A host may register its own note,\n * and `@particle-academy/lane` is a swimlane the engine walks straight past.\n * Neither is a step and neither is ever wired.\n * 3. **A kind the registry has never heard of.** Not a loophole — the honest\n * answer. An unknown kind already produces its own issue, and we cannot know\n * whether it is a step, an annotation or a lane. Claiming it must be wired\n * would assert something unverifiable, and it lands hardest on the graphs\n * that deserve it least: a laned graph loaded by a runtime without `lane`\n * registered would report every swimlane twice, the second time wrongly.\n *\n * The note/annotation/layout half matches the test `run-flow` uses to skip a\n * node. The unknown-kind half deliberately does NOT — see the closing comment in\n * this file for why the two must not become one helper.\n */\nexport function mayFloat(node: FlowNode): boolean {\n const type = node.type;\n if (!type) return false;\n if (type === \"note\") return true;\n\n const kind = getNodeKind(type);\n if (!kind) return true;\n\n return kindIds(kind).includes(\"note\") || kind.category === \"annotation\" || kind.category === \"layout\";\n}\n\n/**\n * A kind that declares an EMPTY output list ends a chain.\n *\n * `[]` and `undefined` are different answers and only the first means this.\n * `undefined` is \"nobody declared what this publishes\", which resolves to `out`\n * and is most nodes in most graphs; `[]` is an explicit claim that there is\n * nothing to connect from. Reading them alike would refuse nearly every\n * workflow ever written.\n */\nfunction isTerminator(node: FlowNode): boolean {\n // A node carrying its own ports overrides its kind — the engine reads these\n // first, so an author who has said what this node publishes is believed.\n // (The PHP twin's importer DROPS node-level ports, so this branch is reachable\n // there only for a hand-built graph. Noted rather than smoothed over: the two\n // importers genuinely differ here.)\n const own = (node.data as { outputs?: unknown[] } | undefined)?.outputs;\n if (Array.isArray(own)) return own.length === 0;\n\n const kind = node.type ? getNodeKind(node.type) : null;\n\n // An unregistered kind falls back to `out` in the engine, so it is not a\n // terminator. Refusing here would break a host mid-registration, and would\n // use \"I do not know\" as evidence.\n if (!kind) return false;\n\n return Array.isArray(kind.outputs) && kind.outputs.length === 0;\n}\n\n/**\n * NOT shared with `frontier`'s / `run-flow`'s annotation test, deliberately.\n *\n * The two predicates look identical and have OPPOSITE safe defaults, which is\n * exactly how a shared helper becomes a bug:\n *\n * - **Here** an unknown kind may float. Being permissive costs nothing — the\n * unknown-kind issue already fires, and we would otherwise assert something\n * unverifiable.\n * - **In the engine** an unknown kind must NOT be treated as an annotation.\n * Being permissive there means SKIPPING a node the host meant to run, which\n * is silent and unrecoverable.\n *\n * So the note/annotation/layout half is the same question and the unknown half\n * is a different one. Collapsing them into one function would read as tidier and\n * would make a host's unregistered kind stop executing.\n */\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createConnectionValidator, buildNodeTypes } from './chunk-
|
|
2
|
-
import { Handle, Position, NoteNode, reconnectEdge, index, BackgroundVariant, Background, Controls, MiniMap, getNodeKind, categoryAccent, ViewportPortal } from './chunk-
|
|
1
|
+
import { createConnectionValidator, buildNodeTypes } from './chunk-5H54OTKT.js';
|
|
2
|
+
import { Handle, Position, NoteNode, reconnectEdge, index, BackgroundVariant, Background, Controls, MiniMap, getNodeKind, categoryAccent, ViewportPortal } from './chunk-JF6WCRBU.js';
|
|
3
3
|
import { memo, useMemo, useRef, useState, useCallback, useEffect } from 'react';
|
|
4
4
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
5
|
|
|
@@ -621,5 +621,5 @@ function cx(...parts) {
|
|
|
621
621
|
}
|
|
622
622
|
|
|
623
623
|
export { ActionNode, DecisionNode, FlowCanvas, FlowViewer, NodeShell, OutputNode, SubgraphNode, TriggerNode, alignNodes, assignToLane, cloneSubgraph, defaultNodeTypes, distributeNodes, duplicateNode, reconnectEdge2 as reconnectEdge, removeEdges, removeFromLane, removeNodes, setEdgeLabel };
|
|
624
|
-
//# sourceMappingURL=chunk-
|
|
625
|
-
//# sourceMappingURL=chunk-
|
|
624
|
+
//# sourceMappingURL=chunk-EO6444T2.js.map
|
|
625
|
+
//# sourceMappingURL=chunk-EO6444T2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/nodes/NodeShell.tsx","../src/components/nodes/TriggerNode.tsx","../src/components/nodes/ActionNode.tsx","../src/components/nodes/DecisionNode.tsx","../src/components/nodes/OutputNode.tsx","../src/components/nodes/SubgraphNode.tsx","../src/components/nodes/index.ts","../src/components/FlowEditor/graph-ops.ts","../src/components/canvas/helper-lines.ts","../src/components/canvas/HelperLines.tsx","../src/components/canvas/use-resolved-color-mode.ts","../src/components/canvas/FlowCanvas.tsx","../src/components/FlowViewer/FlowViewer.tsx"],"names":["jsx","memo","jsxs","reconnectEdge","cx","useState","useMemo","index"],"mappings":";;;;;AAyBA,SAAS,cAAA,CAAe;AAAA,EACtB,IAAA;AAAA,EACA,MAAA;AAAA,EACA,GAAA;AAAA,EACA,IAAA;AAAA,EACA,UAAA,GAAa,IAAA;AAAA,EACb,WAAA,GAAc,IAAA;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CAAA;AAAA,QAEJ,CAAC,CAAA,EACH;AAAA;AAAA,KACF;AAAA,EAEJ;AAEA,EAAA,uBACEA,GAAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,EAAA,CAAG,6BAAA,EAA+B,SAAA,EAAW,WAAW,IAAI,CAAA;AAAA,MACvE,KAAA;AAAA,MACA,kBAAA,EAAiB,QAAA;AAAA,MAEjB,QAAA,kBAAAA,GAAAA;AAAA,QAAC,UAAA;AAAA,QAAA;AAAA,UACC,OAAO,KAAA,CAAM,KAAA;AAAA,UACb,OAAO,KAAA,CAAM,KAAA;AAAA,UACb,SAAA;AAAA,UACA,MAAA;AAAA,UACA,YAAA;AAAA,UACA,WAAA;AAAA,UAGA,cAAA,EAAgB,KAAA;AAAA,UAChB,gBAAA,EAAkB,KAAA;AAAA,UAClB,cAAA,EAAgB,QAAQ,YAAY,CAAA;AAAA,UACpC,cAAA,EAAgB,KAAA;AAAA,UAChB,kBAAA,EAAoB,QAAQ,YAAY,CAAA;AAAA,UACxC,aAAA,EAAe,IAAA;AAAA,UACf,gBAAA,EAAkB,IAAA;AAAA,UAClB,qBAAA,EAAuB,IAAA;AAAA,UACvB,cAAA,EAAgB,KAAA;AAAA,UAEhB,YAAA,EAAc,KAAA;AAAA,UACd,aAAa,YAAA,GAAe,CAAC,GAAG,IAAA,KAAS,YAAA,CAAa,IAAgB,CAAA,GAAI,MAAA;AAAA,UAC1E,OAAA,EAAO;AAAA;AAAA;AACT;AAAA,GACF;AAEJ;AAEA,SAAS,MAAM,KAAA,EAAyD;AACtE,EAAA,OAAO,KAAA,CAAM,MAAA,CAAO,OAAO,CAAA,CAAE,KAAK,GAAG,CAAA;AACvC","file":"chunk-MX4SJDNI.js","sourcesContent":["import { type ReactNode, memo } from \"react\";\nimport { Handle, Position, type NodeProps } from \"@xyflow/react\";\nimport type { FlowNode, NodeRunStatus, PortDescriptor } from \"../../types\";\n\nexport type NodeShellProps = {\n /** Required: the xyflow node this is rendering. */\n node: NodeProps<FlowNode>;\n /** Accent color for the title bar / status ring. */\n accent: string;\n /** Tag/label shown to the left of the title (e.g. \"TRIGGER\", \"ACTION\"). */\n tag: string;\n /** Optional icon glyph (single-character string is fine). */\n icon?: ReactNode;\n /** Whether to show input handles on the left. Defaults true. */\n showInputs?: boolean;\n /** Whether to show output handles on the right. Defaults true. */\n showOutputs?: boolean;\n /** Body content under the title bar. */\n children?: ReactNode;\n};\n\n/**\n * Shared chrome for every kit node — title bar, accent border, status ring,\n * port handles. Specific node kinds compose this with their body content.\n */\nfunction NodeShellInner({\n node,\n accent,\n tag,\n icon,\n showInputs = true,\n showOutputs = true,\n children,\n}: NodeShellProps) {\n const data = node.data;\n const status: NodeRunStatus = data.status ?? \"idle\";\n const inputs = data.inputs ?? defaultInputs(showInputs);\n const outputs = data.outputs ?? defaultOutputs(showOutputs);\n\n return (\n <div\n className={[\"ff-node\", `ff-node--status-${status}`, node.selected ? \"ff-node--selected\" : \"\"].filter(Boolean).join(\" \")}\n style={{ borderColor: node.selected ? accent : undefined }}\n >\n <header className=\"ff-node__header\" style={{ background: accent }}>\n <span className=\"ff-node__icon\" aria-hidden>{icon ?? null}</span>\n <span className=\"ff-node__tag\">{tag}</span>\n <span className=\"ff-node__label\">{data.label}</span>\n {status !== \"idle\" && <StatusDot status={status} />}\n </header>\n\n {data.description && <p className=\"ff-node__desc\">{data.description}</p>}\n {children && <div className=\"ff-node__body\">{children}</div>}\n {data.statusText && <p className=\"ff-node__status-text\">{data.statusText}</p>}\n\n {inputs.map((p, i) => (\n <Handle\n key={p.id}\n type=\"target\"\n position={Position.Left}\n id={p.id}\n style={portStyle(i, inputs.length)}\n title={p.label ?? p.id}\n />\n ))}\n {outputs.map((p, i) => (\n <Handle\n key={p.id}\n type=\"source\"\n position={Position.Right}\n id={p.id}\n style={portStyle(i, outputs.length)}\n title={p.label ?? p.id}\n />\n ))}\n </div>\n );\n}\n\nexport const NodeShell = memo(NodeShellInner);\n\nfunction defaultInputs(show: boolean): PortDescriptor[] {\n return show ? [{ id: \"in\" }] : [];\n}\nfunction defaultOutputs(show: boolean): PortDescriptor[] {\n return show ? [{ id: \"out\" }] : [];\n}\n\nfunction portStyle(i: number, total: number): React.CSSProperties {\n if (total <= 1) return {};\n const slot = (100 / (total + 1)) * (i + 1);\n return { top: `${slot}%` };\n}\n\nfunction StatusDot({ status }: { status: NodeRunStatus }) {\n return <span className={`ff-node__dot ff-node__dot--${status}`} aria-label={`status ${status}`} />;\n}\n","import { memo } from \"react\";\nimport type { NodeProps } from \"@xyflow/react\";\nimport type { FlowNode } from \"../../types\";\nimport { NodeShell } from \"./NodeShell\";\n\n/** Entry-point node — outputs only, no inputs. */\nfunction TriggerNodeInner(props: NodeProps<FlowNode>) {\n return <NodeShell node={props} accent=\"#10b981\" tag=\"TRIGGER\" icon=\"⚡\" showInputs={false} />;\n}\nexport const TriggerNode = memo(TriggerNodeInner);\n","import { memo } from \"react\";\nimport type { NodeProps } from \"@xyflow/react\";\nimport type { FlowNode } from \"../../types\";\nimport { NodeShell } from \"./NodeShell\";\n\n/** General-purpose work node — inputs and outputs. */\nfunction ActionNodeInner(props: NodeProps<FlowNode>) {\n return <NodeShell node={props} accent=\"#3b82f6\" tag=\"ACTION\" icon=\"▸\" />;\n}\nexport const ActionNode = memo(ActionNodeInner);\n","import { memo } from \"react\";\nimport type { NodeProps } from \"@xyflow/react\";\nimport type { FlowNode, PortDescriptor } from \"../../types\";\nimport { NodeShell } from \"./NodeShell\";\n\nconst DEFAULT_BRANCHES: PortDescriptor[] = [\n { id: \"true\", label: \"true\" },\n { id: \"false\", label: \"false\" },\n];\n\n/** Branching node — multiple typed outputs, one input. */\nfunction DecisionNodeInner(props: NodeProps<FlowNode>) {\n // If the host hasn't customised outputs, default to a true/false split.\n if (!props.data.outputs) {\n props = { ...props, data: { ...props.data, outputs: DEFAULT_BRANCHES } };\n }\n return <NodeShell node={props} accent=\"#f59e0b\" tag=\"DECISION\" icon=\"◇\" />;\n}\nexport const DecisionNode = memo(DecisionNodeInner);\n","import { memo } from \"react\";\nimport type { NodeProps } from \"@xyflow/react\";\nimport type { FlowNode } from \"../../types\";\nimport { NodeShell } from \"./NodeShell\";\n\n/** Terminal node — receives the workflow's final result; no outputs. */\nfunction OutputNodeInner(props: NodeProps<FlowNode>) {\n return <NodeShell node={props} accent=\"#a855f7\" tag=\"OUTPUT\" icon=\"●\" showOutputs={false} />;\n}\nexport const OutputNode = memo(OutputNodeInner);\n","import { memo } from \"react\";\nimport type { NodeProps } from \"@xyflow/react\";\nimport type { FlowNode, SubgraphNodeData } from \"../../types\";\nimport { NodeShell } from \"./NodeShell\";\n\n/**\n * SubgraphNode — collapses a group of nodes behind a single facade with\n * inputs and outputs that map to the inner graph's boundary ports. The\n * runtime treats it like an action node: when running, it dispatches to\n * the registered \"subgraph\" executor (host decides expand vs inline).\n *\n * v0.1 just renders the facade. Expand/collapse interactions and inner-\n * graph editing are deferred — host apps can implement those by toggling\n * `data.collapsed` and rendering a nested <FlowCanvas> when expanded.\n */\nfunction SubgraphNodeInner(props: NodeProps<FlowNode>) {\n const data = props.data as SubgraphNodeData;\n const childCount = data.childIds?.length ?? 0;\n return (\n <NodeShell node={props} accent=\"#0ea5e9\" tag=\"SUBGRAPH\" icon=\"❐\">\n <div className=\"ff-subgraph__meta\">\n <span>{childCount} node{childCount === 1 ? \"\" : \"s\"}</span>\n <span>{data.collapsed === false ? \"expanded\" : \"collapsed\"}</span>\n </div>\n </NodeShell>\n );\n}\nexport const SubgraphNode = memo(SubgraphNodeInner);\n","import type { NodeTypes } from \"@xyflow/react\";\nimport { TriggerNode } from \"./TriggerNode\";\nimport { ActionNode } from \"./ActionNode\";\nimport { DecisionNode } from \"./DecisionNode\";\nimport { OutputNode } from \"./OutputNode\";\nimport { NoteNode } from \"./NoteNode\";\nimport { SubgraphNode } from \"./SubgraphNode\";\n\nexport { TriggerNode, ActionNode, DecisionNode, OutputNode, NoteNode, SubgraphNode };\nexport { LaneNode } from \"./LaneNode\";\nexport { NodeShell, type NodeShellProps } from \"./NodeShell\";\n\n/**\n * Default xyflow `nodeTypes` map covering the kit. Spread into your own:\n *\n * <FlowCanvas nodeTypes={{ ...defaultNodeTypes, custom: MyNode }} ... />\n */\nexport const defaultNodeTypes: NodeTypes = {\n trigger: TriggerNode,\n action: ActionNode,\n decision: DecisionNode,\n output: OutputNode,\n note: NoteNode,\n subgraph: SubgraphNode,\n};\n","import { reconnectEdge as xyReconnectEdge, type Connection, type Edge } from \"@xyflow/react\";\nimport type { FlowGraph, FlowNode } from \"../../types\";\n\n/**\n * Remove nodes AND every edge attached to them.\n *\n * Deleting a node without pruning its edges leaves danglers that point at\n * nothing — they survive a round-trip through the schema and blow up the\n * runner, so the two always move together.\n */\nexport function removeNodes(graph: FlowGraph, ids: string[]): FlowGraph {\n if (ids.length === 0) return graph;\n const doomed = new Set(ids);\n\n return {\n nodes: graph.nodes.filter((n) => !doomed.has(n.id)),\n edges: graph.edges.filter((e) => !doomed.has(e.source) && !doomed.has(e.target)),\n };\n}\n\n/** Remove edges by id, leaving nodes untouched. */\nexport function removeEdges(edges: Edge[], ids: string[]): Edge[] {\n if (ids.length === 0) return edges;\n const doomed = new Set(ids);\n\n return edges.filter((e) => !doomed.has(e.id));\n}\n\n/**\n * Set (or clear) an edge's label.\n *\n * An empty/whitespace label is removed rather than stored as `\"\"` — xyflow\n * renders an empty label as an empty chip on the wire, and a blank key would\n * survive export into the workflow schema.\n */\nexport function setEdgeLabel(edges: Edge[], id: string, label: string | undefined): Edge[] {\n const next = label?.trim();\n return edges.map((e) => {\n if (e.id !== id) return e;\n if (!next) {\n const { label: _drop, ...rest } = e;\n return rest as Edge;\n }\n return { ...e, label: next };\n });\n}\n\n/** Copy a node with a fresh id, offset so it doesn't sit exactly on top. */\nexport function duplicateNode(node: FlowNode, id: string, offset = 40): FlowNode {\n return {\n ...node,\n id,\n position: { x: node.position.x + offset, y: node.position.y + offset },\n // Deep copy so the clone's config edits don't mutate the original.\n data: JSON.parse(JSON.stringify(node.data ?? {})),\n } as FlowNode;\n}\n\n/**\n * Clone a set of nodes AND the edges internal to that set, remapping every id.\n * This is the piece `duplicateNode` lacks: a copy/paste (or duplicate-selection)\n * that preserves the wiring *between* the copied nodes. Edges with an endpoint\n * outside the set are dropped (they'd dangle). A `parentId` pointing inside the\n * set is remapped; one pointing outside is detached.\n */\nexport function cloneSubgraph(\n nodes: FlowNode[],\n edges: Edge[],\n opts: { makeId: () => string; offset?: number },\n): { nodes: FlowNode[]; edges: Edge[]; idMap: Map<string, string> } {\n const offset = opts.offset ?? 40;\n const idMap = new Map<string, string>();\n for (const n of nodes) idMap.set(n.id, opts.makeId());\n\n const clonedNodes = nodes.map((n) => {\n const cloned = duplicateNode(n, idMap.get(n.id)!, offset) as any;\n const parentId = (n as any).parentId;\n if (parentId && idMap.has(parentId)) cloned.parentId = idMap.get(parentId);\n else if (parentId) delete cloned.parentId;\n return cloned as FlowNode;\n });\n\n const clonedEdges = edges\n .filter((e) => idMap.has(e.source) && idMap.has(e.target))\n .map((e) => ({ ...e, id: opts.makeId(), source: idMap.get(e.source)!, target: idMap.get(e.target)! }));\n\n return { nodes: clonedNodes, edges: clonedEdges, idMap };\n}\n\n/**\n * Rewire one edge's endpoint(s) — wraps xyflow's `reconnectEdge`. Keeps the\n * edge's id (`shouldReplaceId: false`) so its label and identity survive the\n * rewire instead of being regenerated from the new endpoints.\n */\nexport function reconnectEdge(edges: Edge[], oldEdge: Edge, newConnection: Connection): Edge[] {\n return xyReconnectEdge(oldEdge, newConnection, edges, { shouldReplaceId: false });\n}\n\nexport type AlignEdge = \"left\" | \"hcenter\" | \"right\" | \"top\" | \"vcenter\" | \"bottom\";\n\nconst nodeW = (n: FlowNode): number => (n as any).width ?? (n as any).measured?.width ?? 0;\nconst nodeH = (n: FlowNode): number => (n as any).height ?? (n as any).measured?.height ?? 0;\n\n/** Align a selection to a shared edge/center of its bounding box. */\nexport function alignNodes(nodes: FlowNode[], edge: AlignEdge): FlowNode[] {\n if (nodes.length < 2) return nodes;\n const minL = Math.min(...nodes.map((n) => n.position.x));\n const maxR = Math.max(...nodes.map((n) => n.position.x + nodeW(n)));\n const minT = Math.min(...nodes.map((n) => n.position.y));\n const maxB = Math.max(...nodes.map((n) => n.position.y + nodeH(n)));\n const cx = (minL + maxR) / 2;\n const cy = (minT + maxB) / 2;\n return nodes.map((n) => {\n let { x, y } = n.position;\n if (edge === \"left\") x = minL;\n else if (edge === \"right\") x = maxR - nodeW(n);\n else if (edge === \"hcenter\") x = cx - nodeW(n) / 2;\n else if (edge === \"top\") y = minT;\n else if (edge === \"bottom\") y = maxB - nodeH(n);\n else if (edge === \"vcenter\") y = cy - nodeH(n) / 2;\n return { ...n, position: { x, y } };\n });\n}\n\n/**\n * Order nodes so every parent precedes its children — xyflow misrenders (and\n * warns) when a child appears before its `parentId` in the array. Stable\n * otherwise. Apply at the render boundary once grouping is in play.\n */\nexport function sortNodesParentFirst<T extends { id: string; parentId?: string }>(nodes: T[]): T[] {\n const byId = new Map(nodes.map((n) => [n.id, n] as const));\n const seen = new Set<string>();\n const out: T[] = [];\n const visit = (n: T) => {\n if (seen.has(n.id)) return;\n const pid = (n as any).parentId as string | undefined;\n if (pid && byId.has(pid) && !seen.has(pid)) visit(byId.get(pid)!);\n seen.add(n.id);\n out.push(n);\n };\n for (const n of nodes) visit(n);\n return out;\n}\n\n/** Absolute position of a node, accounting for one level of parent nesting. */\nfunction absolutePosition(node: FlowNode, nodes: FlowNode[]): { x: number; y: number } {\n const pid = (node as any).parentId as string | undefined;\n if (!pid) return node.position;\n const parent = nodes.find((n) => n.id === pid);\n return parent ? { x: node.position.x + parent.position.x, y: node.position.y + parent.position.y } : node.position;\n}\n\n/**\n * Put a node inside a lane/container: set `parentId` + `extent:'parent'` and\n * convert its position to be relative to the lane. Idempotent-safe; a no-op if\n * either id is missing or they're the same node.\n */\nexport function assignToLane(nodes: FlowNode[], nodeId: string, laneId: string): FlowNode[] {\n if (nodeId === laneId) return nodes;\n const node = nodes.find((n) => n.id === nodeId);\n const lane = nodes.find((n) => n.id === laneId);\n if (!node || !lane) return nodes;\n const abs = absolutePosition(node, nodes);\n const laneAbs = absolutePosition(lane, nodes);\n const rel = { x: abs.x - laneAbs.x, y: abs.y - laneAbs.y };\n return nodes.map((n) => (n.id === nodeId ? ({ ...n, parentId: laneId, extent: \"parent\", position: rel } as FlowNode) : n));\n}\n\n/** Take a node out of its lane: drop `parentId`/`extent`, restore absolute position. */\nexport function removeFromLane(nodes: FlowNode[], nodeId: string): FlowNode[] {\n const node = nodes.find((n) => n.id === nodeId);\n if (!node || !(node as any).parentId) return nodes;\n const abs = absolutePosition(node, nodes);\n return nodes.map((n) => {\n if (n.id !== nodeId) return n;\n const { parentId: _p, extent: _e, ...rest } = n as any;\n return { ...rest, position: abs } as FlowNode;\n });\n}\n\n/**\n * Stack lanes into contiguous rows (horizontal) or columns (vertical) — the\n * \"fixed rows/columns\" behavior. `isLane` picks which nodes are lanes; they're\n * ordered by their current cross-axis position and repacked from the first\n * lane's origin. Each lane keeps its own size (independently resizable).\n */\nexport function stackLanes(\n nodes: FlowNode[],\n isLane: (n: FlowNode) => boolean,\n opts: { orientation?: \"horizontal\" | \"vertical\"; gap?: number } = {},\n): FlowNode[] {\n const orientation = opts.orientation ?? \"horizontal\";\n const gap = opts.gap ?? 12;\n const vertical = orientation === \"vertical\";\n const lanes = nodes.filter(isLane).sort((a, b) => (vertical ? a.position.x - b.position.x : a.position.y - b.position.y));\n if (lanes.length === 0) return nodes;\n const originX = lanes[0].position.x;\n const originY = lanes[0].position.y;\n const moves = new Map<string, { x: number; y: number }>();\n let cursor = vertical ? originX : originY;\n for (const lane of lanes) {\n moves.set(lane.id, vertical ? { x: cursor, y: originY } : { x: originX, y: cursor });\n cursor += (vertical ? ((lane as any).width ?? 320) : ((lane as any).height ?? 160)) + gap;\n }\n return nodes.map((n) => (moves.has(n.id) ? { ...n, position: moves.get(n.id)! } : n));\n}\n\n/** Evenly distribute a selection's gaps along an axis (needs 3+ nodes). */\nexport function distributeNodes(nodes: FlowNode[], axis: \"h\" | \"v\"): FlowNode[] {\n if (nodes.length < 3) return nodes;\n const size = (n: FlowNode) => (axis === \"h\" ? nodeW(n) : nodeH(n));\n const coord = (n: FlowNode) => (axis === \"h\" ? n.position.x : n.position.y);\n const sorted = [...nodes].sort((a, b) => coord(a) - coord(b));\n const start = coord(sorted[0]);\n const last = sorted[sorted.length - 1];\n const end = coord(last) + size(last);\n const totalSize = sorted.reduce((s, n) => s + size(n), 0);\n const gap = (end - start - totalSize) / (sorted.length - 1);\n const posById = new Map<string, number>();\n let cursor = start;\n for (const n of sorted) {\n posById.set(n.id, cursor);\n cursor += size(n) + gap;\n }\n return nodes.map((n) => {\n const p = posById.get(n.id)!;\n return { ...n, position: axis === \"h\" ? { ...n.position, x: p } : { ...n.position, y: p } };\n });\n}\n","import type { FlowNode } from \"../../types\";\n\nexport type HelperLineChange = { id: string; position?: { x: number; y: number } };\n\nexport type HelperLinesResult = {\n /** Y of a horizontal guide line (flow coords), if the drag aligns on Y. */\n horizontal?: number;\n /** X of a vertical guide line (flow coords), if the drag aligns on X. */\n vertical?: number;\n /** The snapped position to apply to the dragged node. */\n snapPosition: { x?: number; y?: number };\n};\n\nconst w = (n: FlowNode): number => (n as any).width ?? (n as any).measured?.width ?? 0;\nconst h = (n: FlowNode): number => (n as any).height ?? (n as any).measured?.height ?? 0;\n\n/**\n * Compute alignment guide lines (and a snapped position) for a node being\n * dragged to `change.position`, against the other nodes. Standard \"helper\n * lines\" algorithm: match the dragged node's left/right/top/bottom edges to any\n * other node's edges within `distance`, snapping to the nearest. Pure + testable.\n */\nexport function getHelperLines(change: HelperLineChange, nodes: FlowNode[], distance = 6): HelperLinesResult {\n const result: HelperLinesResult = { snapPosition: { x: undefined, y: undefined } };\n const a = nodes.find((n) => n.id === change.id);\n if (!a || !change.position) return result;\n\n const A = {\n left: change.position.x,\n right: change.position.x + w(a),\n top: change.position.y,\n bottom: change.position.y + h(a),\n width: w(a),\n height: h(a),\n };\n let vDist = distance;\n let hDist = distance;\n\n for (const b of nodes) {\n if (b.id === a.id) continue;\n const B = { left: b.position.x, right: b.position.x + w(b), top: b.position.y, bottom: b.position.y + h(b) };\n\n // Vertical guides (X alignment).\n const ll = Math.abs(A.left - B.left);\n if (ll < vDist) { result.snapPosition.x = B.left; result.vertical = B.left; vDist = ll; }\n const rr = Math.abs(A.right - B.right);\n if (rr < vDist) { result.snapPosition.x = B.right - A.width; result.vertical = B.right; vDist = rr; }\n const lr = Math.abs(A.left - B.right);\n if (lr < vDist) { result.snapPosition.x = B.right; result.vertical = B.right; vDist = lr; }\n const rl = Math.abs(A.right - B.left);\n if (rl < vDist) { result.snapPosition.x = B.left - A.width; result.vertical = B.left; vDist = rl; }\n\n // Horizontal guides (Y alignment).\n const tt = Math.abs(A.top - B.top);\n if (tt < hDist) { result.snapPosition.y = B.top; result.horizontal = B.top; hDist = tt; }\n const bb = Math.abs(A.bottom - B.bottom);\n if (bb < hDist) { result.snapPosition.y = B.bottom - A.height; result.horizontal = B.bottom; hDist = bb; }\n const tb = Math.abs(A.top - B.bottom);\n if (tb < hDist) { result.snapPosition.y = B.bottom; result.horizontal = B.bottom; hDist = tb; }\n const bt = Math.abs(A.bottom - B.top);\n if (bt < hDist) { result.snapPosition.y = B.top - A.height; result.horizontal = B.top; hDist = bt; }\n }\n\n return result;\n}\n","import { ViewportPortal } from \"@xyflow/react\";\n\n/**\n * HelperLines — alignment guides drawn during a drag. Rendered in flow\n * coordinate space (ViewportPortal), so the lines track pan/zoom. Positions come\n * from `getHelperLines`.\n */\nexport function HelperLines({ horizontal, vertical }: { horizontal?: number; vertical?: number }) {\n if (horizontal === undefined && vertical === undefined) return null;\n return (\n <ViewportPortal>\n {vertical !== undefined && (\n <div\n className=\"ff-helper-line\"\n style={{ position: \"absolute\", transform: `translateX(${vertical}px)`, top: -5000, height: 10000, width: 1, pointerEvents: \"none\" }}\n />\n )}\n {horizontal !== undefined && (\n <div\n className=\"ff-helper-line\"\n style={{ position: \"absolute\", transform: `translateY(${horizontal}px)`, left: -5000, width: 10000, height: 1, pointerEvents: \"none\" }}\n />\n )}\n </ViewportPortal>\n );\n}\n","import { useEffect, useState } from \"react\";\n\n/** The resolved mode React Flow and our own `ff-` tokens both understand. */\nexport type FlowColorMode = \"light\" | \"dark\";\n\n/**\n * What a host may PASS. React Flow's own `ColorMode` includes `\"system\"`, and\n * it is meaningful here rather than something to cast away: it means \"follow\n * the environment\", which is the same job `undefined` now does.\n */\nexport type FlowColorModeInput = FlowColorMode | \"system\";\n\n/**\n * Read the app's theme off the document, the way every host in this suite\n * signals it.\n *\n * Checked in the order a host actually sets them: an explicit `data-theme`\n * beats a `.dark` class (a host that writes both, like the showcase, is\n * consistent either way), and only when neither is present does the OS\n * preference decide.\n */\nfunction readDocumentTheme(): FlowColorMode {\n if (typeof document === \"undefined\") return \"light\";\n\n const root = document.documentElement;\n const attr = root.getAttribute(\"data-theme\");\n if (attr === \"dark\" || attr === \"light\") return attr;\n if (root.classList.contains(\"dark\")) return \"dark\";\n\n return typeof window !== \"undefined\" && window.matchMedia?.(\"(prefers-color-scheme: dark)\").matches\n ? \"dark\"\n : \"light\";\n}\n\n/**\n * The colour mode the canvas should actually use.\n *\n * **Why this exists.** `colorMode` used to be passed straight through to React\n * Flow, so a host that did not supply one got React Flow's own default —\n * `light` — no matter what the surrounding app was doing. Our `ff-` styles\n * still looked right, because they hang off an ancestor `.dark`, which is\n * exactly what made the bug hard to see: the nodes we style were fine while\n * React Flow's own layer stayed light underneath. Any node whose kind is not\n * registered falls back to React Flow's default node, and on a dark page that\n * is a white box with unreadable text. Edges, handles, the selection rectangle\n * and the controls were light too.\n *\n * So an unset `colorMode` now means \"follow the app\", not \"light\". Passing one\n * explicitly still wins — a canvas deliberately pinned light on a dark page is\n * a real thing, and this does not take it away.\n *\n * The subscription matters as much as the initial read: a theme toggle changes\n * an attribute on `<html>`, which triggers no React render on its own, so\n * without an observer the canvas would be correct on load and wrong the moment\n * someone flipped the switch.\n */\nexport function useResolvedColorMode(explicit?: FlowColorModeInput): FlowColorMode {\n // Start light on the server and on first paint. Reading the DOM in the\n // initialiser would differ between server and client markup and trip\n // hydration; the effect below corrects it before anything is visible.\n const [resolved, setResolved] = useState<FlowColorMode>(\"light\");\n\n // `\"system\"` is treated exactly like an unset prop: both mean \"follow the\n // environment\", and collapsing them here keeps one resolution path.\n const pinned = explicit === \"light\" || explicit === \"dark\" ? explicit : undefined;\n\n useEffect(() => {\n if (pinned) return;\n if (typeof document === \"undefined\") return;\n\n const sync = () => setResolved(readDocumentTheme());\n sync();\n\n const observer = new MutationObserver(sync);\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [\"class\", \"data-theme\"],\n });\n\n const media = window.matchMedia?.(\"(prefers-color-scheme: dark)\");\n media?.addEventListener?.(\"change\", sync);\n\n return () => {\n observer.disconnect();\n media?.removeEventListener?.(\"change\", sync);\n };\n }, [pinned]);\n\n return pinned ?? resolved;\n}\n","import {\n type CSSProperties,\n type ReactNode,\n type WheelEvent as ReactWheelEvent,\n useCallback,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport {\n ReactFlow,\n Background,\n BackgroundVariant,\n Controls,\n MiniMap,\n type DefaultEdgeOptions,\n type Edge,\n type EdgeTypes,\n type FitViewOptions,\n type NodeTypes,\n type ReactFlowProps,\n} from \"@xyflow/react\";\nimport \"@xyflow/react/dist/style.css\";\nimport { defaultNodeTypes } from \"../nodes\";\nimport { createConnectionValidator, type ConnectionValidatorOptions } from \"../../registry/connection\";\nimport { sortNodesParentFirst } from \"../FlowEditor/graph-ops\";\nimport { getHelperLines } from \"./helper-lines\";\nimport { HelperLines } from \"./HelperLines\";\nimport type { FlowNode } from \"../../types\";\nimport { useResolvedColorMode } from \"./use-resolved-color-mode\";\n\n/**\n * With wheel-zoom off, Shift+wheel still zooms — and must not ALSO scroll the\n * page while it does. React Flow's own `preventScrolling` is all-or-nothing, so\n * the modifier case is handled here: swallow the gesture that zooms, leave the\n * one that doesn't alone.\n *\n * Capture phase, so it lands before React Flow's own wheel handling.\n */\nfunction preventScrollWhileZooming(event: ReactWheelEvent<HTMLDivElement>): void {\n if (event.shiftKey) event.preventDefault();\n}\n\n/**\n * The three React Flow props that together decide what the wheel does.\n *\n * Extracted because they only make sense as a set, and getting the set wrong is\n * invisible in a screenshot: the canvas looks fine and feels broken. This is\n * the unit worth testing — mounting a canvas to assert it would be testing\n * d3-zoom through jsdom.\n *\n * - **on** (default): no modifier needed, and the page never scrolls under a\n * wheel that is zooming.\n * - **off**: zoom moves to Shift+wheel and the bare wheel goes back to the\n * page. `preventScrolling` alone cannot express that — left true it swallows\n * the bare wheel (page frozen, nothing zooms), left false it lets Shift+wheel\n * zoom *and* scroll at once — so the handler covers the modifier case.\n */\nexport function wheelZoomProps(zoomOnWheel: boolean): {\n zoomActivationKeyCode: string | null;\n preventScrolling: boolean;\n onWheelCapture?: (event: ReactWheelEvent<HTMLDivElement>) => void;\n} {\n return zoomOnWheel\n ? { zoomActivationKeyCode: null, preventScrolling: true }\n : {\n zoomActivationKeyCode: \"Shift\",\n preventScrolling: false,\n onWheelCapture: preventScrollWhileZooming,\n };\n}\n\nexport type FlowCanvasProps = Omit<ReactFlowProps<FlowNode, Edge>, \"nodes\" | \"edges\" | \"height\"> & {\n nodes: FlowNode[];\n edges: Edge[];\n /** Background variant. Default: \"dots\". */\n background?: BackgroundVariant | \"none\";\n /** Show pan/zoom/fit controls. Default true. */\n showControls?: boolean;\n /** Show minimap. Default false (turn on for big graphs). */\n showMinimap?: boolean;\n /** Pixel height; FlowCanvas expects a sized container. Default 600. */\n height?: number | string;\n /**\n * Enforce port-type compatibility on new connections. `true` (default) uses\n * the built-in validator: a connection is refused only when both ports\n * declare a concrete, differing `type` (so untyped graphs are unaffected),\n * and self-loops are blocked. Pass options to tune the rule, or `false` to\n * disable. An `isValidConnection` you pass yourself always takes precedence.\n */\n validateConnections?: boolean | ConnectionValidatorOptions;\n /** Show alignment guide lines while dragging, and snap to them. Default off. */\n showHelperLines?: boolean;\n /**\n * A bare mouse wheel over the canvas zooms it. Default **true**.\n *\n * Turn it off for a canvas embedded mid-page, where a reader scrolling past\n * would otherwise get trapped zooming. With it off the wheel scrolls the page\n * and **Shift+wheel** zooms instead.\n *\n * Either way, a wheel gesture that zooms never also scrolls the page — the\n * two happening at once is the thing that makes an embedded canvas feel\n * broken.\n */\n zoomOnWheel?: boolean;\n /** Optional toolbar / palette etc. rendered above the canvas. */\n toolbar?: ReactNode;\n className?: string;\n style?: CSSProperties;\n};\n\nconst DEFAULT_FIT_VIEW: FitViewOptions = { padding: 0.2 };\nconst DEFAULT_EDGE_OPTIONS: DefaultEdgeOptions = {\n type: \"smoothstep\",\n animated: false,\n};\n\n/**\n * FlowCanvas — themed React Flow surface with the kit's nodes registered\n * by default. Pass your own `nodeTypes` to extend; the kit's defaults are\n * merged behind yours.\n *\n * Hosts wire `onNodesChange` / `onEdgesChange` / `onConnect` themselves\n * (xyflow's standard pattern). The surrounding `useFlowState` hook in\n * `runtime/use-flow-state.ts` is a convenience that wires those for you.\n */\nexport function FlowCanvas({\n nodes,\n edges,\n background = BackgroundVariant.Dots,\n showControls = true,\n showMinimap = false,\n height = 600,\n validateConnections = true,\n isValidConnection,\n colorMode,\n showHelperLines = false,\n zoomOnWheel = true,\n onNodesChange,\n toolbar,\n nodeTypes,\n edgeTypes,\n className,\n style,\n ...rest\n}: FlowCanvasProps) {\n const mergedNodeTypes = useMemo<NodeTypes>(\n () => ({ ...defaultNodeTypes, ...(nodeTypes ?? {}) }),\n [nodeTypes],\n );\n\n // Read nodes live through a ref so the validator (built once) always sees the\n // current graph without being rebuilt on every node change.\n const nodesRef = useRef(nodes);\n nodesRef.current = nodes;\n const builtinValidator = useMemo(\n () =>\n validateConnections === false\n ? undefined\n : createConnectionValidator(\n () => nodesRef.current,\n validateConnections === true ? undefined : validateConnections,\n ),\n [validateConnections],\n );\n // A caller-supplied predicate wins; otherwise fall back to port-type validation.\n const resolvedIsValidConnection = isValidConnection ?? builtinValidator;\n\n const mergedEdgeTypes = useMemo<EdgeTypes | undefined>(\n () => (edgeTypes ? { ...edgeTypes } : undefined),\n [edgeTypes],\n );\n\n // xyflow requires a parent node to precede its children in the array; grouping\n // (swimlanes) can produce any order, so normalize it here at the boundary.\n const orderedNodes = useMemo(() => sortNodesParentFirst(nodes), [nodes]);\n\n // Helper lines: on a single-node drag, snap to aligned edges + show guides.\n const [helperLines, setHelperLines] = useState<{ horizontal?: number; vertical?: number }>({});\n const handleNodesChange = useCallback(\n (changes: any[]) => {\n if (showHelperLines) {\n const pos = changes.filter((c) => c.type === \"position\" && c.position);\n if (pos.length === 1 && pos[0].dragging) {\n const lines = getHelperLines(pos[0], nodesRef.current);\n if (lines.snapPosition.x !== undefined) pos[0].position.x = lines.snapPosition.x;\n if (lines.snapPosition.y !== undefined) pos[0].position.y = lines.snapPosition.y;\n setHelperLines({ horizontal: lines.horizontal, vertical: lines.vertical });\n } else {\n setHelperLines({});\n }\n }\n onNodesChange?.(changes as any);\n },\n [showHelperLines, onNodesChange],\n );\n\n /**\n * An unset `colorMode` means \"follow the app\", NOT \"light\".\n *\n * It used to pass straight through to React Flow, whose own default is\n * light — so on a dark page React Flow's layer stayed light underneath our\n * `ff-` styles, which look right because they hang off an ancestor `.dark`.\n * Any node kind without a registered type falls back to React Flow's default\n * node: a white box with unreadable text on a dark canvas. Passing a mode\n * explicitly still wins.\n */\n const resolvedColorMode = useResolvedColorMode(colorMode);\n\n return (\n <div\n className={[\n \"ff-canvas\",\n // colorMode drives BOTH react-flow's chrome (below) and our `ff-` styles\n // via the shared `.dark` class / light opt-out — one theme signal.\n resolvedColorMode === \"dark\" ? \"dark\" : \"\",\n resolvedColorMode === \"light\" ? \"ff-canvas--light\" : \"\",\n className ?? \"\",\n ]\n .filter(Boolean)\n .join(\" \")}\n style={{ height, ...style }}\n >\n {toolbar && <div className=\"ff-canvas__toolbar\">{toolbar}</div>}\n <div className=\"ff-canvas__surface\">\n <ReactFlow\n nodes={orderedNodes}\n edges={edges}\n onNodesChange={handleNodesChange}\n colorMode={resolvedColorMode}\n nodeTypes={mergedNodeTypes}\n edgeTypes={mergedEdgeTypes}\n fitView\n fitViewOptions={DEFAULT_FIT_VIEW}\n defaultEdgeOptions={DEFAULT_EDGE_OPTIONS}\n proOptions={{ hideAttribution: true }}\n // Wheel zooms by default; `zoomOnWheel={false}` moves that onto\n // Shift+wheel and gives the bare wheel back to the page. The three\n // props only make sense as a set — see wheelZoomProps.\n {...wheelZoomProps(zoomOnWheel)}\n isValidConnection={resolvedIsValidConnection}\n {...rest}\n >\n {background !== \"none\" && (\n <Background variant={background as BackgroundVariant} gap={20} size={1} color=\"rgba(0,0,0,0.18)\" />\n )}\n {showControls && <Controls className=\"ff-controls\" position=\"bottom-right\" />}\n {showMinimap && <MiniMap className=\"ff-minimap\" pannable zoomable />}\n {showHelperLines && <HelperLines horizontal={helperLines.horizontal} vertical={helperLines.vertical} />}\n </ReactFlow>\n </div>\n </div>\n );\n}\n","import { useMemo, type CSSProperties, type ReactNode } from \"react\";\nimport { FlowCanvas } from \"../canvas\";\nimport { buildNodeTypes } from \"../../registry\";\nimport { categoryAccent, getNodeKind } from \"../../registry/registry\";\nimport type { FlowGraph, FlowNode } from \"../../types\";\n\n/** Outcome of one node in a run, for annotating the graph after the fact. */\nexport type FlowNodeStatus = \"ok\" | \"running\" | \"failed\" | \"skipped\" | \"pending\";\n\nexport interface FlowViewerClassNames {\n root?: string;\n list?: string;\n row?: string;\n rowIndex?: string;\n rowTitle?: string;\n rowDescription?: string;\n rowStatus?: string;\n}\n\nexport interface FlowViewerProps {\n /** The graph to show. */\n graph: FlowGraph;\n /**\n * `canvas` draws the graph. `list` renders the nodes as rows — for a docs\n * page, a narrow column, print, or an audit view, where a pan-zoom surface is\n * the wrong shape and often not usable at all.\n */\n variant?: \"canvas\" | \"list\";\n /** Canvas height. Ignored by `list`. Default 480. */\n height?: number | string;\n /** Canvas minimap. Default false. */\n showMinimap?: boolean;\n /** Canvas pan/zoom/fit controls. Default true. */\n showControls?: boolean;\n /**\n * Per-node run outcome, keyed by node id. Lets the same component serve\n * \"here is the workflow\" and \"here is what happened on Tuesday\".\n */\n statuses?: Record<string, FlowNodeStatus>;\n /** Controlled selection. */\n selectedNodeId?: string | null;\n /** Omit and nothing is clickable — a viewer with no handler is inert. */\n onSelectNode?: (node: FlowNode) => void;\n className?: string;\n classNames?: FlowViewerClassNames;\n style?: CSSProperties;\n /** Rendered when the graph has no nodes. */\n empty?: ReactNode;\n}\n\nconst STATUS_LABEL: Record<FlowNodeStatus, string> = {\n ok: \"ok\",\n running: \"running\",\n failed: \"failed\",\n skipped: \"skipped\",\n pending: \"pending\",\n};\n\n/**\n * FlowViewer — a workflow, read-only.\n *\n * **Read-only by construction, not by configuration.** There is no prop that\n * makes this editable, because a viewer that can be switched into an editor is\n * a viewer somebody eventually switches into an editor by accident. Before this\n * existed the only way to show a flow was `FlowEditor` (the whole editor) or\n * `FlowCanvas` plus four React Flow flags a consumer had to know to pass —\n * assembly, not an affordance, and nothing stopped the next person shipping a\n * fully editable canvas where they wanted a picture.\n *\n * Node titles come from the registry, so `overrideNodeKind()` renames apply\n * here too.\n */\nexport function FlowViewer({\n graph,\n variant = \"canvas\",\n height = 480,\n showMinimap = false,\n showControls = true,\n statuses,\n selectedNodeId = null,\n onSelectNode,\n className,\n classNames = {},\n style,\n empty,\n}: FlowViewerProps) {\n const nodeTypes = useMemo(() => buildNodeTypes(), []);\n\n const rows = useMemo(\n () =>\n graph.nodes.map((node, index) => {\n const kind = getNodeKind(node.data?.kind ?? node.type ?? \"\");\n return {\n node,\n index,\n // The node's own label is the name the AUTHOR gave THIS node (\"Summarize\");\n // the kind label is the generic type name (\"LLM Call\"). Specific wins.\n title: node.data?.label ?? kind?.label ?? node.data?.kind ?? node.id,\n description: kind?.description ?? null,\n accent: kind?.accent ?? categoryAccent(kind?.category ?? \"custom\"),\n status: statuses?.[node.id] ?? null,\n };\n }),\n [graph.nodes, statuses],\n );\n\n if (graph.nodes.length === 0) {\n return (\n <div className={cx(\"ff-viewer ff-viewer--empty\", className, classNames.root)} style={style}>\n {empty ?? <span className=\"ff-viewer__empty\">This flow has no nodes.</span>}\n </div>\n );\n }\n\n if (variant === \"list\") {\n return (\n <div\n className={cx(\"ff-viewer ff-viewer--list\", className, classNames.root)}\n style={style}\n data-flow-viewer=\"list\"\n >\n <ol className={cx(\"ff-viewer__list\", classNames.list)}>\n {rows.map(({ node, index, title, description, accent, status }) => {\n const selected = node.id === selectedNodeId;\n const Row = onSelectNode ? \"button\" : \"div\";\n\n return (\n <li key={node.id}>\n <Row\n {...(onSelectNode\n ? { type: \"button\" as const, onClick: () => onSelectNode(node) }\n : {})}\n className={cx(\n \"ff-viewer__row\",\n selected && \"ff-viewer__row--selected\",\n onSelectNode && \"ff-viewer__row--interactive\",\n classNames.row,\n )}\n data-flow-viewer-node={node.id}\n data-flow-viewer-status={status ?? undefined}\n aria-current={selected || undefined}\n >\n <span\n className={cx(\"ff-viewer__index\", classNames.rowIndex)}\n style={{ backgroundColor: accent }}\n aria-hidden\n >\n {index + 1}\n </span>\n\n <span className=\"ff-viewer__body\">\n <span className={cx(\"ff-viewer__title\", classNames.rowTitle)}>{title}</span>\n {description && (\n <span className={cx(\"ff-viewer__desc\", classNames.rowDescription)}>\n {description}\n </span>\n )}\n </span>\n\n {status && (\n <span\n className={cx(\n \"ff-viewer__status\",\n `ff-viewer__status--${status}`,\n classNames.rowStatus,\n )}\n >\n {STATUS_LABEL[status]}\n </span>\n )}\n </Row>\n </li>\n );\n })}\n </ol>\n </div>\n );\n }\n\n return (\n <div\n className={cx(\"ff-viewer ff-viewer--canvas\", className, classNames.root)}\n style={style}\n data-flow-viewer=\"canvas\"\n >\n <FlowCanvas\n nodes={graph.nodes}\n edges={graph.edges}\n nodeTypes={nodeTypes}\n height={height}\n showControls={showControls}\n showMinimap={showMinimap}\n // The read-only contract. Every mutation path React Flow offers is\n // closed here rather than left to the caller to remember.\n nodesDraggable={false}\n nodesConnectable={false}\n nodesFocusable={Boolean(onSelectNode)}\n edgesFocusable={false}\n elementsSelectable={Boolean(onSelectNode)}\n deleteKeyCode={null}\n selectionKeyCode={null}\n multiSelectionKeyCode={null}\n connectOnClick={false}\n // A canvas embedded mid-page must not trap a reader's scroll.\n zoomOnScroll={false}\n onNodeClick={onSelectNode ? (_, node) => onSelectNode(node as FlowNode) : undefined}\n fitView\n />\n </div>\n );\n}\n\nfunction cx(...parts: Array<string | false | null | undefined>): string {\n return parts.filter(Boolean).join(\" \");\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/nodes/NodeShell.tsx","../src/components/nodes/TriggerNode.tsx","../src/components/nodes/ActionNode.tsx","../src/components/nodes/DecisionNode.tsx","../src/components/nodes/OutputNode.tsx","../src/components/nodes/SubgraphNode.tsx","../src/components/nodes/index.ts","../src/components/FlowEditor/graph-ops.ts","../src/components/canvas/helper-lines.ts","../src/components/canvas/HelperLines.tsx","../src/components/canvas/use-resolved-color-mode.ts","../src/components/canvas/FlowCanvas.tsx","../src/components/FlowViewer/FlowViewer.tsx"],"names":["jsx","memo","jsxs","reconnectEdge","cx","useState","useMemo","index"],"mappings":";;;;;AAyBA,SAAS,cAAA,CAAe;AAAA,EACtB,IAAA;AAAA,EACA,MAAA;AAAA,EACA,GAAA;AAAA,EACA,IAAA;AAAA,EACA,UAAA,GAAa,IAAA;AAAA,EACb,WAAA,GAAc,IAAA;AAAA,EACd;AACF,CAAA,EAAmB;AACjB,EAAA,MAAM,OAAO,IAAA,CAAK,IAAA;AAClB,EAAA,MAAM,MAAA,GAAwB,KAAK,MAAA,IAAU,MAAA;AAC7C,EAAA,MAAM,MAAA,GAAS,IAAA,CAAK,MAAA,IAAU,aAAA,CAAc,UAAU,CAAA;AACtD,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,OAAA,IAAW,cAAA,CAAe,WAAW,CAAA;AAE1D,EAAA,uBACE,IAA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AA,QAAA;AAAA,UACC,OAAO,KAAA,CAAM,KAAA;AAAA,UACb,OAAO,KAAA,CAAM,KAAA;AAAA,UACb,SAAA;AAAA,UACA,MAAA;AAAA,UACA,YAAA;AAAA,UACA,WAAA;AAAA,UAGA,cAAA,EAAgB,KAAA;AAAA,UAChB,gBAAA,EAAkB,KAAA;AAAA,UAClB,cAAA,EAAgB,QAAQ,YAAY,CAAA;AAAA,UACpC,cAAA,EAAgB,KAAA;AAAA,UAChB,kBAAA,EAAoB,QAAQ,YAAY,CAAA;AAAA,UACxC,aAAA,EAAe,IAAA;AAAA,UACf,gBAAA,EAAkB,IAAA;AAAA,UAClB,qBAAA,EAAuB,IAAA;AAAA,UACvB,cAAA,EAAgB,KAAA;AAAA,UAEhB,YAAA,EAAc,KAAA;AAAA,UACd,aAAa,YAAA,GAAe,CAAC,GAAG,IAAA,KAAS,YAAA,CAAa,IAAgB,CAAA,GAAI,MAAA;AAAA,UAC1E,OAAA,EAAO;AAAA;AAAA;AACT;AAAA,GACF;AAEJ;AAEA,SAAS,MAAM,KAAA,EAAyD;AACtE,EAAA,OAAO,KAAA,CAAM,MAAA,CAAO,OAAO,CAAA,CAAE,KAAK,GAAG,CAAA;AACvC","file":"chunk-EO6444T2.js","sourcesContent":["import { type ReactNode, memo } from \"react\";\nimport { Handle, Position, type NodeProps } from \"@xyflow/react\";\nimport type { FlowNode, NodeRunStatus, PortDescriptor } from \"../../types\";\n\nexport type NodeShellProps = {\n /** Required: the xyflow node this is rendering. */\n node: NodeProps<FlowNode>;\n /** Accent color for the title bar / status ring. */\n accent: string;\n /** Tag/label shown to the left of the title (e.g. \"TRIGGER\", \"ACTION\"). */\n tag: string;\n /** Optional icon glyph (single-character string is fine). */\n icon?: ReactNode;\n /** Whether to show input handles on the left. Defaults true. */\n showInputs?: boolean;\n /** Whether to show output handles on the right. Defaults true. */\n showOutputs?: boolean;\n /** Body content under the title bar. */\n children?: ReactNode;\n};\n\n/**\n * Shared chrome for every kit node — title bar, accent border, status ring,\n * port handles. Specific node kinds compose this with their body content.\n */\nfunction NodeShellInner({\n node,\n accent,\n tag,\n icon,\n showInputs = true,\n showOutputs = true,\n children,\n}: NodeShellProps) {\n const data = node.data;\n const status: NodeRunStatus = data.status ?? \"idle\";\n const inputs = data.inputs ?? defaultInputs(showInputs);\n const outputs = data.outputs ?? defaultOutputs(showOutputs);\n\n return (\n <div\n className={[\"ff-node\", `ff-node--status-${status}`, node.selected ? \"ff-node--selected\" : \"\"].filter(Boolean).join(\" \")}\n style={{ borderColor: node.selected ? accent : undefined }}\n >\n <header className=\"ff-node__header\" style={{ background: accent }}>\n <span className=\"ff-node__icon\" aria-hidden>{icon ?? null}</span>\n <span className=\"ff-node__tag\">{tag}</span>\n <span className=\"ff-node__label\">{data.label}</span>\n {status !== \"idle\" && <StatusDot status={status} />}\n </header>\n\n {data.description && <p className=\"ff-node__desc\">{data.description}</p>}\n {children && <div className=\"ff-node__body\">{children}</div>}\n {data.statusText && <p className=\"ff-node__status-text\">{data.statusText}</p>}\n\n {inputs.map((p, i) => (\n <Handle\n key={p.id}\n type=\"target\"\n position={Position.Left}\n id={p.id}\n style={portStyle(i, inputs.length)}\n title={p.label ?? p.id}\n />\n ))}\n {outputs.map((p, i) => (\n <Handle\n key={p.id}\n type=\"source\"\n position={Position.Right}\n id={p.id}\n style={portStyle(i, outputs.length)}\n title={p.label ?? p.id}\n />\n ))}\n </div>\n );\n}\n\nexport const NodeShell = memo(NodeShellInner);\n\nfunction defaultInputs(show: boolean): PortDescriptor[] {\n return show ? [{ id: \"in\" }] : [];\n}\nfunction defaultOutputs(show: boolean): PortDescriptor[] {\n return show ? [{ id: \"out\" }] : [];\n}\n\nfunction portStyle(i: number, total: number): React.CSSProperties {\n if (total <= 1) return {};\n const slot = (100 / (total + 1)) * (i + 1);\n return { top: `${slot}%` };\n}\n\nfunction StatusDot({ status }: { status: NodeRunStatus }) {\n return <span className={`ff-node__dot ff-node__dot--${status}`} aria-label={`status ${status}`} />;\n}\n","import { memo } from \"react\";\nimport type { NodeProps } from \"@xyflow/react\";\nimport type { FlowNode } from \"../../types\";\nimport { NodeShell } from \"./NodeShell\";\n\n/** Entry-point node — outputs only, no inputs. */\nfunction TriggerNodeInner(props: NodeProps<FlowNode>) {\n return <NodeShell node={props} accent=\"#10b981\" tag=\"TRIGGER\" icon=\"⚡\" showInputs={false} />;\n}\nexport const TriggerNode = memo(TriggerNodeInner);\n","import { memo } from \"react\";\nimport type { NodeProps } from \"@xyflow/react\";\nimport type { FlowNode } from \"../../types\";\nimport { NodeShell } from \"./NodeShell\";\n\n/** General-purpose work node — inputs and outputs. */\nfunction ActionNodeInner(props: NodeProps<FlowNode>) {\n return <NodeShell node={props} accent=\"#3b82f6\" tag=\"ACTION\" icon=\"▸\" />;\n}\nexport const ActionNode = memo(ActionNodeInner);\n","import { memo } from \"react\";\nimport type { NodeProps } from \"@xyflow/react\";\nimport type { FlowNode, PortDescriptor } from \"../../types\";\nimport { NodeShell } from \"./NodeShell\";\n\nconst DEFAULT_BRANCHES: PortDescriptor[] = [\n { id: \"true\", label: \"true\" },\n { id: \"false\", label: \"false\" },\n];\n\n/** Branching node — multiple typed outputs, one input. */\nfunction DecisionNodeInner(props: NodeProps<FlowNode>) {\n // If the host hasn't customised outputs, default to a true/false split.\n if (!props.data.outputs) {\n props = { ...props, data: { ...props.data, outputs: DEFAULT_BRANCHES } };\n }\n return <NodeShell node={props} accent=\"#f59e0b\" tag=\"DECISION\" icon=\"◇\" />;\n}\nexport const DecisionNode = memo(DecisionNodeInner);\n","import { memo } from \"react\";\nimport type { NodeProps } from \"@xyflow/react\";\nimport type { FlowNode } from \"../../types\";\nimport { NodeShell } from \"./NodeShell\";\n\n/** Terminal node — receives the workflow's final result; no outputs. */\nfunction OutputNodeInner(props: NodeProps<FlowNode>) {\n return <NodeShell node={props} accent=\"#a855f7\" tag=\"OUTPUT\" icon=\"●\" showOutputs={false} />;\n}\nexport const OutputNode = memo(OutputNodeInner);\n","import { memo } from \"react\";\nimport type { NodeProps } from \"@xyflow/react\";\nimport type { FlowNode, SubgraphNodeData } from \"../../types\";\nimport { NodeShell } from \"./NodeShell\";\n\n/**\n * SubgraphNode — collapses a group of nodes behind a single facade with\n * inputs and outputs that map to the inner graph's boundary ports. The\n * runtime treats it like an action node: when running, it dispatches to\n * the registered \"subgraph\" executor (host decides expand vs inline).\n *\n * v0.1 just renders the facade. Expand/collapse interactions and inner-\n * graph editing are deferred — host apps can implement those by toggling\n * `data.collapsed` and rendering a nested <FlowCanvas> when expanded.\n */\nfunction SubgraphNodeInner(props: NodeProps<FlowNode>) {\n const data = props.data as SubgraphNodeData;\n const childCount = data.childIds?.length ?? 0;\n return (\n <NodeShell node={props} accent=\"#0ea5e9\" tag=\"SUBGRAPH\" icon=\"❐\">\n <div className=\"ff-subgraph__meta\">\n <span>{childCount} node{childCount === 1 ? \"\" : \"s\"}</span>\n <span>{data.collapsed === false ? \"expanded\" : \"collapsed\"}</span>\n </div>\n </NodeShell>\n );\n}\nexport const SubgraphNode = memo(SubgraphNodeInner);\n","import type { NodeTypes } from \"@xyflow/react\";\nimport { TriggerNode } from \"./TriggerNode\";\nimport { ActionNode } from \"./ActionNode\";\nimport { DecisionNode } from \"./DecisionNode\";\nimport { OutputNode } from \"./OutputNode\";\nimport { NoteNode } from \"./NoteNode\";\nimport { SubgraphNode } from \"./SubgraphNode\";\n\nexport { TriggerNode, ActionNode, DecisionNode, OutputNode, NoteNode, SubgraphNode };\nexport { LaneNode } from \"./LaneNode\";\nexport { NodeShell, type NodeShellProps } from \"./NodeShell\";\n\n/**\n * Default xyflow `nodeTypes` map covering the kit. Spread into your own:\n *\n * <FlowCanvas nodeTypes={{ ...defaultNodeTypes, custom: MyNode }} ... />\n */\nexport const defaultNodeTypes: NodeTypes = {\n trigger: TriggerNode,\n action: ActionNode,\n decision: DecisionNode,\n output: OutputNode,\n note: NoteNode,\n subgraph: SubgraphNode,\n};\n","import { reconnectEdge as xyReconnectEdge, type Connection, type Edge } from \"@xyflow/react\";\nimport type { FlowGraph, FlowNode } from \"../../types\";\n\n/**\n * Remove nodes AND every edge attached to them.\n *\n * Deleting a node without pruning its edges leaves danglers that point at\n * nothing — they survive a round-trip through the schema and blow up the\n * runner, so the two always move together.\n */\nexport function removeNodes(graph: FlowGraph, ids: string[]): FlowGraph {\n if (ids.length === 0) return graph;\n const doomed = new Set(ids);\n\n return {\n nodes: graph.nodes.filter((n) => !doomed.has(n.id)),\n edges: graph.edges.filter((e) => !doomed.has(e.source) && !doomed.has(e.target)),\n };\n}\n\n/** Remove edges by id, leaving nodes untouched. */\nexport function removeEdges(edges: Edge[], ids: string[]): Edge[] {\n if (ids.length === 0) return edges;\n const doomed = new Set(ids);\n\n return edges.filter((e) => !doomed.has(e.id));\n}\n\n/**\n * Set (or clear) an edge's label.\n *\n * An empty/whitespace label is removed rather than stored as `\"\"` — xyflow\n * renders an empty label as an empty chip on the wire, and a blank key would\n * survive export into the workflow schema.\n */\nexport function setEdgeLabel(edges: Edge[], id: string, label: string | undefined): Edge[] {\n const next = label?.trim();\n return edges.map((e) => {\n if (e.id !== id) return e;\n if (!next) {\n const { label: _drop, ...rest } = e;\n return rest as Edge;\n }\n return { ...e, label: next };\n });\n}\n\n/** Copy a node with a fresh id, offset so it doesn't sit exactly on top. */\nexport function duplicateNode(node: FlowNode, id: string, offset = 40): FlowNode {\n return {\n ...node,\n id,\n position: { x: node.position.x + offset, y: node.position.y + offset },\n // Deep copy so the clone's config edits don't mutate the original.\n data: JSON.parse(JSON.stringify(node.data ?? {})),\n } as FlowNode;\n}\n\n/**\n * Clone a set of nodes AND the edges internal to that set, remapping every id.\n * This is the piece `duplicateNode` lacks: a copy/paste (or duplicate-selection)\n * that preserves the wiring *between* the copied nodes. Edges with an endpoint\n * outside the set are dropped (they'd dangle). A `parentId` pointing inside the\n * set is remapped; one pointing outside is detached.\n */\nexport function cloneSubgraph(\n nodes: FlowNode[],\n edges: Edge[],\n opts: { makeId: () => string; offset?: number },\n): { nodes: FlowNode[]; edges: Edge[]; idMap: Map<string, string> } {\n const offset = opts.offset ?? 40;\n const idMap = new Map<string, string>();\n for (const n of nodes) idMap.set(n.id, opts.makeId());\n\n const clonedNodes = nodes.map((n) => {\n const cloned = duplicateNode(n, idMap.get(n.id)!, offset) as any;\n const parentId = (n as any).parentId;\n if (parentId && idMap.has(parentId)) cloned.parentId = idMap.get(parentId);\n else if (parentId) delete cloned.parentId;\n return cloned as FlowNode;\n });\n\n const clonedEdges = edges\n .filter((e) => idMap.has(e.source) && idMap.has(e.target))\n .map((e) => ({ ...e, id: opts.makeId(), source: idMap.get(e.source)!, target: idMap.get(e.target)! }));\n\n return { nodes: clonedNodes, edges: clonedEdges, idMap };\n}\n\n/**\n * Rewire one edge's endpoint(s) — wraps xyflow's `reconnectEdge`. Keeps the\n * edge's id (`shouldReplaceId: false`) so its label and identity survive the\n * rewire instead of being regenerated from the new endpoints.\n */\nexport function reconnectEdge(edges: Edge[], oldEdge: Edge, newConnection: Connection): Edge[] {\n return xyReconnectEdge(oldEdge, newConnection, edges, { shouldReplaceId: false });\n}\n\nexport type AlignEdge = \"left\" | \"hcenter\" | \"right\" | \"top\" | \"vcenter\" | \"bottom\";\n\nconst nodeW = (n: FlowNode): number => (n as any).width ?? (n as any).measured?.width ?? 0;\nconst nodeH = (n: FlowNode): number => (n as any).height ?? (n as any).measured?.height ?? 0;\n\n/** Align a selection to a shared edge/center of its bounding box. */\nexport function alignNodes(nodes: FlowNode[], edge: AlignEdge): FlowNode[] {\n if (nodes.length < 2) return nodes;\n const minL = Math.min(...nodes.map((n) => n.position.x));\n const maxR = Math.max(...nodes.map((n) => n.position.x + nodeW(n)));\n const minT = Math.min(...nodes.map((n) => n.position.y));\n const maxB = Math.max(...nodes.map((n) => n.position.y + nodeH(n)));\n const cx = (minL + maxR) / 2;\n const cy = (minT + maxB) / 2;\n return nodes.map((n) => {\n let { x, y } = n.position;\n if (edge === \"left\") x = minL;\n else if (edge === \"right\") x = maxR - nodeW(n);\n else if (edge === \"hcenter\") x = cx - nodeW(n) / 2;\n else if (edge === \"top\") y = minT;\n else if (edge === \"bottom\") y = maxB - nodeH(n);\n else if (edge === \"vcenter\") y = cy - nodeH(n) / 2;\n return { ...n, position: { x, y } };\n });\n}\n\n/**\n * Order nodes so every parent precedes its children — xyflow misrenders (and\n * warns) when a child appears before its `parentId` in the array. Stable\n * otherwise. Apply at the render boundary once grouping is in play.\n */\nexport function sortNodesParentFirst<T extends { id: string; parentId?: string }>(nodes: T[]): T[] {\n const byId = new Map(nodes.map((n) => [n.id, n] as const));\n const seen = new Set<string>();\n const out: T[] = [];\n const visit = (n: T) => {\n if (seen.has(n.id)) return;\n const pid = (n as any).parentId as string | undefined;\n if (pid && byId.has(pid) && !seen.has(pid)) visit(byId.get(pid)!);\n seen.add(n.id);\n out.push(n);\n };\n for (const n of nodes) visit(n);\n return out;\n}\n\n/** Absolute position of a node, accounting for one level of parent nesting. */\nfunction absolutePosition(node: FlowNode, nodes: FlowNode[]): { x: number; y: number } {\n const pid = (node as any).parentId as string | undefined;\n if (!pid) return node.position;\n const parent = nodes.find((n) => n.id === pid);\n return parent ? { x: node.position.x + parent.position.x, y: node.position.y + parent.position.y } : node.position;\n}\n\n/**\n * Put a node inside a lane/container: set `parentId` + `extent:'parent'` and\n * convert its position to be relative to the lane. Idempotent-safe; a no-op if\n * either id is missing or they're the same node.\n */\nexport function assignToLane(nodes: FlowNode[], nodeId: string, laneId: string): FlowNode[] {\n if (nodeId === laneId) return nodes;\n const node = nodes.find((n) => n.id === nodeId);\n const lane = nodes.find((n) => n.id === laneId);\n if (!node || !lane) return nodes;\n const abs = absolutePosition(node, nodes);\n const laneAbs = absolutePosition(lane, nodes);\n const rel = { x: abs.x - laneAbs.x, y: abs.y - laneAbs.y };\n return nodes.map((n) => (n.id === nodeId ? ({ ...n, parentId: laneId, extent: \"parent\", position: rel } as FlowNode) : n));\n}\n\n/** Take a node out of its lane: drop `parentId`/`extent`, restore absolute position. */\nexport function removeFromLane(nodes: FlowNode[], nodeId: string): FlowNode[] {\n const node = nodes.find((n) => n.id === nodeId);\n if (!node || !(node as any).parentId) return nodes;\n const abs = absolutePosition(node, nodes);\n return nodes.map((n) => {\n if (n.id !== nodeId) return n;\n const { parentId: _p, extent: _e, ...rest } = n as any;\n return { ...rest, position: abs } as FlowNode;\n });\n}\n\n/**\n * Stack lanes into contiguous rows (horizontal) or columns (vertical) — the\n * \"fixed rows/columns\" behavior. `isLane` picks which nodes are lanes; they're\n * ordered by their current cross-axis position and repacked from the first\n * lane's origin. Each lane keeps its own size (independently resizable).\n */\nexport function stackLanes(\n nodes: FlowNode[],\n isLane: (n: FlowNode) => boolean,\n opts: { orientation?: \"horizontal\" | \"vertical\"; gap?: number } = {},\n): FlowNode[] {\n const orientation = opts.orientation ?? \"horizontal\";\n const gap = opts.gap ?? 12;\n const vertical = orientation === \"vertical\";\n const lanes = nodes.filter(isLane).sort((a, b) => (vertical ? a.position.x - b.position.x : a.position.y - b.position.y));\n if (lanes.length === 0) return nodes;\n const originX = lanes[0].position.x;\n const originY = lanes[0].position.y;\n const moves = new Map<string, { x: number; y: number }>();\n let cursor = vertical ? originX : originY;\n for (const lane of lanes) {\n moves.set(lane.id, vertical ? { x: cursor, y: originY } : { x: originX, y: cursor });\n cursor += (vertical ? ((lane as any).width ?? 320) : ((lane as any).height ?? 160)) + gap;\n }\n return nodes.map((n) => (moves.has(n.id) ? { ...n, position: moves.get(n.id)! } : n));\n}\n\n/** Evenly distribute a selection's gaps along an axis (needs 3+ nodes). */\nexport function distributeNodes(nodes: FlowNode[], axis: \"h\" | \"v\"): FlowNode[] {\n if (nodes.length < 3) return nodes;\n const size = (n: FlowNode) => (axis === \"h\" ? nodeW(n) : nodeH(n));\n const coord = (n: FlowNode) => (axis === \"h\" ? n.position.x : n.position.y);\n const sorted = [...nodes].sort((a, b) => coord(a) - coord(b));\n const start = coord(sorted[0]);\n const last = sorted[sorted.length - 1];\n const end = coord(last) + size(last);\n const totalSize = sorted.reduce((s, n) => s + size(n), 0);\n const gap = (end - start - totalSize) / (sorted.length - 1);\n const posById = new Map<string, number>();\n let cursor = start;\n for (const n of sorted) {\n posById.set(n.id, cursor);\n cursor += size(n) + gap;\n }\n return nodes.map((n) => {\n const p = posById.get(n.id)!;\n return { ...n, position: axis === \"h\" ? { ...n.position, x: p } : { ...n.position, y: p } };\n });\n}\n","import type { FlowNode } from \"../../types\";\n\nexport type HelperLineChange = { id: string; position?: { x: number; y: number } };\n\nexport type HelperLinesResult = {\n /** Y of a horizontal guide line (flow coords), if the drag aligns on Y. */\n horizontal?: number;\n /** X of a vertical guide line (flow coords), if the drag aligns on X. */\n vertical?: number;\n /** The snapped position to apply to the dragged node. */\n snapPosition: { x?: number; y?: number };\n};\n\nconst w = (n: FlowNode): number => (n as any).width ?? (n as any).measured?.width ?? 0;\nconst h = (n: FlowNode): number => (n as any).height ?? (n as any).measured?.height ?? 0;\n\n/**\n * Compute alignment guide lines (and a snapped position) for a node being\n * dragged to `change.position`, against the other nodes. Standard \"helper\n * lines\" algorithm: match the dragged node's left/right/top/bottom edges to any\n * other node's edges within `distance`, snapping to the nearest. Pure + testable.\n */\nexport function getHelperLines(change: HelperLineChange, nodes: FlowNode[], distance = 6): HelperLinesResult {\n const result: HelperLinesResult = { snapPosition: { x: undefined, y: undefined } };\n const a = nodes.find((n) => n.id === change.id);\n if (!a || !change.position) return result;\n\n const A = {\n left: change.position.x,\n right: change.position.x + w(a),\n top: change.position.y,\n bottom: change.position.y + h(a),\n width: w(a),\n height: h(a),\n };\n let vDist = distance;\n let hDist = distance;\n\n for (const b of nodes) {\n if (b.id === a.id) continue;\n const B = { left: b.position.x, right: b.position.x + w(b), top: b.position.y, bottom: b.position.y + h(b) };\n\n // Vertical guides (X alignment).\n const ll = Math.abs(A.left - B.left);\n if (ll < vDist) { result.snapPosition.x = B.left; result.vertical = B.left; vDist = ll; }\n const rr = Math.abs(A.right - B.right);\n if (rr < vDist) { result.snapPosition.x = B.right - A.width; result.vertical = B.right; vDist = rr; }\n const lr = Math.abs(A.left - B.right);\n if (lr < vDist) { result.snapPosition.x = B.right; result.vertical = B.right; vDist = lr; }\n const rl = Math.abs(A.right - B.left);\n if (rl < vDist) { result.snapPosition.x = B.left - A.width; result.vertical = B.left; vDist = rl; }\n\n // Horizontal guides (Y alignment).\n const tt = Math.abs(A.top - B.top);\n if (tt < hDist) { result.snapPosition.y = B.top; result.horizontal = B.top; hDist = tt; }\n const bb = Math.abs(A.bottom - B.bottom);\n if (bb < hDist) { result.snapPosition.y = B.bottom - A.height; result.horizontal = B.bottom; hDist = bb; }\n const tb = Math.abs(A.top - B.bottom);\n if (tb < hDist) { result.snapPosition.y = B.bottom; result.horizontal = B.bottom; hDist = tb; }\n const bt = Math.abs(A.bottom - B.top);\n if (bt < hDist) { result.snapPosition.y = B.top - A.height; result.horizontal = B.top; hDist = bt; }\n }\n\n return result;\n}\n","import { ViewportPortal } from \"@xyflow/react\";\n\n/**\n * HelperLines — alignment guides drawn during a drag. Rendered in flow\n * coordinate space (ViewportPortal), so the lines track pan/zoom. Positions come\n * from `getHelperLines`.\n */\nexport function HelperLines({ horizontal, vertical }: { horizontal?: number; vertical?: number }) {\n if (horizontal === undefined && vertical === undefined) return null;\n return (\n <ViewportPortal>\n {vertical !== undefined && (\n <div\n className=\"ff-helper-line\"\n style={{ position: \"absolute\", transform: `translateX(${vertical}px)`, top: -5000, height: 10000, width: 1, pointerEvents: \"none\" }}\n />\n )}\n {horizontal !== undefined && (\n <div\n className=\"ff-helper-line\"\n style={{ position: \"absolute\", transform: `translateY(${horizontal}px)`, left: -5000, width: 10000, height: 1, pointerEvents: \"none\" }}\n />\n )}\n </ViewportPortal>\n );\n}\n","import { useEffect, useState } from \"react\";\n\n/** The resolved mode React Flow and our own `ff-` tokens both understand. */\nexport type FlowColorMode = \"light\" | \"dark\";\n\n/**\n * What a host may PASS. React Flow's own `ColorMode` includes `\"system\"`, and\n * it is meaningful here rather than something to cast away: it means \"follow\n * the environment\", which is the same job `undefined` now does.\n */\nexport type FlowColorModeInput = FlowColorMode | \"system\";\n\n/**\n * Read the app's theme off the document, the way every host in this suite\n * signals it.\n *\n * Checked in the order a host actually sets them: an explicit `data-theme`\n * beats a `.dark` class (a host that writes both, like the showcase, is\n * consistent either way), and only when neither is present does the OS\n * preference decide.\n */\nfunction readDocumentTheme(): FlowColorMode {\n if (typeof document === \"undefined\") return \"light\";\n\n const root = document.documentElement;\n const attr = root.getAttribute(\"data-theme\");\n if (attr === \"dark\" || attr === \"light\") return attr;\n if (root.classList.contains(\"dark\")) return \"dark\";\n\n return typeof window !== \"undefined\" && window.matchMedia?.(\"(prefers-color-scheme: dark)\").matches\n ? \"dark\"\n : \"light\";\n}\n\n/**\n * The colour mode the canvas should actually use.\n *\n * **Why this exists.** `colorMode` used to be passed straight through to React\n * Flow, so a host that did not supply one got React Flow's own default —\n * `light` — no matter what the surrounding app was doing. Our `ff-` styles\n * still looked right, because they hang off an ancestor `.dark`, which is\n * exactly what made the bug hard to see: the nodes we style were fine while\n * React Flow's own layer stayed light underneath. Any node whose kind is not\n * registered falls back to React Flow's default node, and on a dark page that\n * is a white box with unreadable text. Edges, handles, the selection rectangle\n * and the controls were light too.\n *\n * So an unset `colorMode` now means \"follow the app\", not \"light\". Passing one\n * explicitly still wins — a canvas deliberately pinned light on a dark page is\n * a real thing, and this does not take it away.\n *\n * The subscription matters as much as the initial read: a theme toggle changes\n * an attribute on `<html>`, which triggers no React render on its own, so\n * without an observer the canvas would be correct on load and wrong the moment\n * someone flipped the switch.\n */\nexport function useResolvedColorMode(explicit?: FlowColorModeInput): FlowColorMode {\n // Start light on the server and on first paint. Reading the DOM in the\n // initialiser would differ between server and client markup and trip\n // hydration; the effect below corrects it before anything is visible.\n const [resolved, setResolved] = useState<FlowColorMode>(\"light\");\n\n // `\"system\"` is treated exactly like an unset prop: both mean \"follow the\n // environment\", and collapsing them here keeps one resolution path.\n const pinned = explicit === \"light\" || explicit === \"dark\" ? explicit : undefined;\n\n useEffect(() => {\n if (pinned) return;\n if (typeof document === \"undefined\") return;\n\n const sync = () => setResolved(readDocumentTheme());\n sync();\n\n const observer = new MutationObserver(sync);\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [\"class\", \"data-theme\"],\n });\n\n const media = window.matchMedia?.(\"(prefers-color-scheme: dark)\");\n media?.addEventListener?.(\"change\", sync);\n\n return () => {\n observer.disconnect();\n media?.removeEventListener?.(\"change\", sync);\n };\n }, [pinned]);\n\n return pinned ?? resolved;\n}\n","import {\n type CSSProperties,\n type ReactNode,\n type WheelEvent as ReactWheelEvent,\n useCallback,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport {\n ReactFlow,\n Background,\n BackgroundVariant,\n Controls,\n MiniMap,\n type DefaultEdgeOptions,\n type Edge,\n type EdgeTypes,\n type FitViewOptions,\n type NodeTypes,\n type ReactFlowProps,\n} from \"@xyflow/react\";\nimport \"@xyflow/react/dist/style.css\";\nimport { defaultNodeTypes } from \"../nodes\";\nimport { createConnectionValidator, type ConnectionValidatorOptions } from \"../../registry/connection\";\nimport { sortNodesParentFirst } from \"../FlowEditor/graph-ops\";\nimport { getHelperLines } from \"./helper-lines\";\nimport { HelperLines } from \"./HelperLines\";\nimport type { FlowNode } from \"../../types\";\nimport { useResolvedColorMode } from \"./use-resolved-color-mode\";\n\n/**\n * With wheel-zoom off, Shift+wheel still zooms — and must not ALSO scroll the\n * page while it does. React Flow's own `preventScrolling` is all-or-nothing, so\n * the modifier case is handled here: swallow the gesture that zooms, leave the\n * one that doesn't alone.\n *\n * Capture phase, so it lands before React Flow's own wheel handling.\n */\nfunction preventScrollWhileZooming(event: ReactWheelEvent<HTMLDivElement>): void {\n if (event.shiftKey) event.preventDefault();\n}\n\n/**\n * The three React Flow props that together decide what the wheel does.\n *\n * Extracted because they only make sense as a set, and getting the set wrong is\n * invisible in a screenshot: the canvas looks fine and feels broken. This is\n * the unit worth testing — mounting a canvas to assert it would be testing\n * d3-zoom through jsdom.\n *\n * - **on** (default): no modifier needed, and the page never scrolls under a\n * wheel that is zooming.\n * - **off**: zoom moves to Shift+wheel and the bare wheel goes back to the\n * page. `preventScrolling` alone cannot express that — left true it swallows\n * the bare wheel (page frozen, nothing zooms), left false it lets Shift+wheel\n * zoom *and* scroll at once — so the handler covers the modifier case.\n */\nexport function wheelZoomProps(zoomOnWheel: boolean): {\n zoomActivationKeyCode: string | null;\n preventScrolling: boolean;\n onWheelCapture?: (event: ReactWheelEvent<HTMLDivElement>) => void;\n} {\n return zoomOnWheel\n ? { zoomActivationKeyCode: null, preventScrolling: true }\n : {\n zoomActivationKeyCode: \"Shift\",\n preventScrolling: false,\n onWheelCapture: preventScrollWhileZooming,\n };\n}\n\nexport type FlowCanvasProps = Omit<ReactFlowProps<FlowNode, Edge>, \"nodes\" | \"edges\" | \"height\"> & {\n nodes: FlowNode[];\n edges: Edge[];\n /** Background variant. Default: \"dots\". */\n background?: BackgroundVariant | \"none\";\n /** Show pan/zoom/fit controls. Default true. */\n showControls?: boolean;\n /** Show minimap. Default false (turn on for big graphs). */\n showMinimap?: boolean;\n /** Pixel height; FlowCanvas expects a sized container. Default 600. */\n height?: number | string;\n /**\n * Enforce port-type compatibility on new connections. `true` (default) uses\n * the built-in validator: a connection is refused only when both ports\n * declare a concrete, differing `type` (so untyped graphs are unaffected),\n * and self-loops are blocked. Pass options to tune the rule, or `false` to\n * disable. An `isValidConnection` you pass yourself always takes precedence.\n */\n validateConnections?: boolean | ConnectionValidatorOptions;\n /** Show alignment guide lines while dragging, and snap to them. Default off. */\n showHelperLines?: boolean;\n /**\n * A bare mouse wheel over the canvas zooms it. Default **true**.\n *\n * Turn it off for a canvas embedded mid-page, where a reader scrolling past\n * would otherwise get trapped zooming. With it off the wheel scrolls the page\n * and **Shift+wheel** zooms instead.\n *\n * Either way, a wheel gesture that zooms never also scrolls the page — the\n * two happening at once is the thing that makes an embedded canvas feel\n * broken.\n */\n zoomOnWheel?: boolean;\n /** Optional toolbar / palette etc. rendered above the canvas. */\n toolbar?: ReactNode;\n className?: string;\n style?: CSSProperties;\n};\n\nconst DEFAULT_FIT_VIEW: FitViewOptions = { padding: 0.2 };\nconst DEFAULT_EDGE_OPTIONS: DefaultEdgeOptions = {\n type: \"smoothstep\",\n animated: false,\n};\n\n/**\n * FlowCanvas — themed React Flow surface with the kit's nodes registered\n * by default. Pass your own `nodeTypes` to extend; the kit's defaults are\n * merged behind yours.\n *\n * Hosts wire `onNodesChange` / `onEdgesChange` / `onConnect` themselves\n * (xyflow's standard pattern). The surrounding `useFlowState` hook in\n * `runtime/use-flow-state.ts` is a convenience that wires those for you.\n */\nexport function FlowCanvas({\n nodes,\n edges,\n background = BackgroundVariant.Dots,\n showControls = true,\n showMinimap = false,\n height = 600,\n validateConnections = true,\n isValidConnection,\n colorMode,\n showHelperLines = false,\n zoomOnWheel = true,\n onNodesChange,\n toolbar,\n nodeTypes,\n edgeTypes,\n className,\n style,\n ...rest\n}: FlowCanvasProps) {\n const mergedNodeTypes = useMemo<NodeTypes>(\n () => ({ ...defaultNodeTypes, ...(nodeTypes ?? {}) }),\n [nodeTypes],\n );\n\n // Read nodes live through a ref so the validator (built once) always sees the\n // current graph without being rebuilt on every node change.\n const nodesRef = useRef(nodes);\n nodesRef.current = nodes;\n const builtinValidator = useMemo(\n () =>\n validateConnections === false\n ? undefined\n : createConnectionValidator(\n () => nodesRef.current,\n validateConnections === true ? undefined : validateConnections,\n ),\n [validateConnections],\n );\n // A caller-supplied predicate wins; otherwise fall back to port-type validation.\n const resolvedIsValidConnection = isValidConnection ?? builtinValidator;\n\n const mergedEdgeTypes = useMemo<EdgeTypes | undefined>(\n () => (edgeTypes ? { ...edgeTypes } : undefined),\n [edgeTypes],\n );\n\n // xyflow requires a parent node to precede its children in the array; grouping\n // (swimlanes) can produce any order, so normalize it here at the boundary.\n const orderedNodes = useMemo(() => sortNodesParentFirst(nodes), [nodes]);\n\n // Helper lines: on a single-node drag, snap to aligned edges + show guides.\n const [helperLines, setHelperLines] = useState<{ horizontal?: number; vertical?: number }>({});\n const handleNodesChange = useCallback(\n (changes: any[]) => {\n if (showHelperLines) {\n const pos = changes.filter((c) => c.type === \"position\" && c.position);\n if (pos.length === 1 && pos[0].dragging) {\n const lines = getHelperLines(pos[0], nodesRef.current);\n if (lines.snapPosition.x !== undefined) pos[0].position.x = lines.snapPosition.x;\n if (lines.snapPosition.y !== undefined) pos[0].position.y = lines.snapPosition.y;\n setHelperLines({ horizontal: lines.horizontal, vertical: lines.vertical });\n } else {\n setHelperLines({});\n }\n }\n onNodesChange?.(changes as any);\n },\n [showHelperLines, onNodesChange],\n );\n\n /**\n * An unset `colorMode` means \"follow the app\", NOT \"light\".\n *\n * It used to pass straight through to React Flow, whose own default is\n * light — so on a dark page React Flow's layer stayed light underneath our\n * `ff-` styles, which look right because they hang off an ancestor `.dark`.\n * Any node kind without a registered type falls back to React Flow's default\n * node: a white box with unreadable text on a dark canvas. Passing a mode\n * explicitly still wins.\n */\n const resolvedColorMode = useResolvedColorMode(colorMode);\n\n return (\n <div\n className={[\n \"ff-canvas\",\n // colorMode drives BOTH react-flow's chrome (below) and our `ff-` styles\n // via the shared `.dark` class / light opt-out — one theme signal.\n resolvedColorMode === \"dark\" ? \"dark\" : \"\",\n resolvedColorMode === \"light\" ? \"ff-canvas--light\" : \"\",\n className ?? \"\",\n ]\n .filter(Boolean)\n .join(\" \")}\n style={{ height, ...style }}\n >\n {toolbar && <div className=\"ff-canvas__toolbar\">{toolbar}</div>}\n <div className=\"ff-canvas__surface\">\n <ReactFlow\n nodes={orderedNodes}\n edges={edges}\n onNodesChange={handleNodesChange}\n colorMode={resolvedColorMode}\n nodeTypes={mergedNodeTypes}\n edgeTypes={mergedEdgeTypes}\n fitView\n fitViewOptions={DEFAULT_FIT_VIEW}\n defaultEdgeOptions={DEFAULT_EDGE_OPTIONS}\n proOptions={{ hideAttribution: true }}\n // Wheel zooms by default; `zoomOnWheel={false}` moves that onto\n // Shift+wheel and gives the bare wheel back to the page. The three\n // props only make sense as a set — see wheelZoomProps.\n {...wheelZoomProps(zoomOnWheel)}\n isValidConnection={resolvedIsValidConnection}\n {...rest}\n >\n {background !== \"none\" && (\n <Background variant={background as BackgroundVariant} gap={20} size={1} color=\"rgba(0,0,0,0.18)\" />\n )}\n {showControls && <Controls className=\"ff-controls\" position=\"bottom-right\" />}\n {showMinimap && <MiniMap className=\"ff-minimap\" pannable zoomable />}\n {showHelperLines && <HelperLines horizontal={helperLines.horizontal} vertical={helperLines.vertical} />}\n </ReactFlow>\n </div>\n </div>\n );\n}\n","import { useMemo, type CSSProperties, type ReactNode } from \"react\";\nimport { FlowCanvas } from \"../canvas\";\nimport { buildNodeTypes } from \"../../registry\";\nimport { categoryAccent, getNodeKind } from \"../../registry/registry\";\nimport type { FlowGraph, FlowNode } from \"../../types\";\n\n/** Outcome of one node in a run, for annotating the graph after the fact. */\nexport type FlowNodeStatus = \"ok\" | \"running\" | \"failed\" | \"skipped\" | \"pending\";\n\nexport interface FlowViewerClassNames {\n root?: string;\n list?: string;\n row?: string;\n rowIndex?: string;\n rowTitle?: string;\n rowDescription?: string;\n rowStatus?: string;\n}\n\nexport interface FlowViewerProps {\n /** The graph to show. */\n graph: FlowGraph;\n /**\n * `canvas` draws the graph. `list` renders the nodes as rows — for a docs\n * page, a narrow column, print, or an audit view, where a pan-zoom surface is\n * the wrong shape and often not usable at all.\n */\n variant?: \"canvas\" | \"list\";\n /** Canvas height. Ignored by `list`. Default 480. */\n height?: number | string;\n /** Canvas minimap. Default false. */\n showMinimap?: boolean;\n /** Canvas pan/zoom/fit controls. Default true. */\n showControls?: boolean;\n /**\n * Per-node run outcome, keyed by node id. Lets the same component serve\n * \"here is the workflow\" and \"here is what happened on Tuesday\".\n */\n statuses?: Record<string, FlowNodeStatus>;\n /** Controlled selection. */\n selectedNodeId?: string | null;\n /** Omit and nothing is clickable — a viewer with no handler is inert. */\n onSelectNode?: (node: FlowNode) => void;\n className?: string;\n classNames?: FlowViewerClassNames;\n style?: CSSProperties;\n /** Rendered when the graph has no nodes. */\n empty?: ReactNode;\n}\n\nconst STATUS_LABEL: Record<FlowNodeStatus, string> = {\n ok: \"ok\",\n running: \"running\",\n failed: \"failed\",\n skipped: \"skipped\",\n pending: \"pending\",\n};\n\n/**\n * FlowViewer — a workflow, read-only.\n *\n * **Read-only by construction, not by configuration.** There is no prop that\n * makes this editable, because a viewer that can be switched into an editor is\n * a viewer somebody eventually switches into an editor by accident. Before this\n * existed the only way to show a flow was `FlowEditor` (the whole editor) or\n * `FlowCanvas` plus four React Flow flags a consumer had to know to pass —\n * assembly, not an affordance, and nothing stopped the next person shipping a\n * fully editable canvas where they wanted a picture.\n *\n * Node titles come from the registry, so `overrideNodeKind()` renames apply\n * here too.\n */\nexport function FlowViewer({\n graph,\n variant = \"canvas\",\n height = 480,\n showMinimap = false,\n showControls = true,\n statuses,\n selectedNodeId = null,\n onSelectNode,\n className,\n classNames = {},\n style,\n empty,\n}: FlowViewerProps) {\n const nodeTypes = useMemo(() => buildNodeTypes(), []);\n\n const rows = useMemo(\n () =>\n graph.nodes.map((node, index) => {\n const kind = getNodeKind(node.data?.kind ?? node.type ?? \"\");\n return {\n node,\n index,\n // The node's own label is the name the AUTHOR gave THIS node (\"Summarize\");\n // the kind label is the generic type name (\"LLM Call\"). Specific wins.\n title: node.data?.label ?? kind?.label ?? node.data?.kind ?? node.id,\n description: kind?.description ?? null,\n accent: kind?.accent ?? categoryAccent(kind?.category ?? \"custom\"),\n status: statuses?.[node.id] ?? null,\n };\n }),\n [graph.nodes, statuses],\n );\n\n if (graph.nodes.length === 0) {\n return (\n <div className={cx(\"ff-viewer ff-viewer--empty\", className, classNames.root)} style={style}>\n {empty ?? <span className=\"ff-viewer__empty\">This flow has no nodes.</span>}\n </div>\n );\n }\n\n if (variant === \"list\") {\n return (\n <div\n className={cx(\"ff-viewer ff-viewer--list\", className, classNames.root)}\n style={style}\n data-flow-viewer=\"list\"\n >\n <ol className={cx(\"ff-viewer__list\", classNames.list)}>\n {rows.map(({ node, index, title, description, accent, status }) => {\n const selected = node.id === selectedNodeId;\n const Row = onSelectNode ? \"button\" : \"div\";\n\n return (\n <li key={node.id}>\n <Row\n {...(onSelectNode\n ? { type: \"button\" as const, onClick: () => onSelectNode(node) }\n : {})}\n className={cx(\n \"ff-viewer__row\",\n selected && \"ff-viewer__row--selected\",\n onSelectNode && \"ff-viewer__row--interactive\",\n classNames.row,\n )}\n data-flow-viewer-node={node.id}\n data-flow-viewer-status={status ?? undefined}\n aria-current={selected || undefined}\n >\n <span\n className={cx(\"ff-viewer__index\", classNames.rowIndex)}\n style={{ backgroundColor: accent }}\n aria-hidden\n >\n {index + 1}\n </span>\n\n <span className=\"ff-viewer__body\">\n <span className={cx(\"ff-viewer__title\", classNames.rowTitle)}>{title}</span>\n {description && (\n <span className={cx(\"ff-viewer__desc\", classNames.rowDescription)}>\n {description}\n </span>\n )}\n </span>\n\n {status && (\n <span\n className={cx(\n \"ff-viewer__status\",\n `ff-viewer__status--${status}`,\n classNames.rowStatus,\n )}\n >\n {STATUS_LABEL[status]}\n </span>\n )}\n </Row>\n </li>\n );\n })}\n </ol>\n </div>\n );\n }\n\n return (\n <div\n className={cx(\"ff-viewer ff-viewer--canvas\", className, classNames.root)}\n style={style}\n data-flow-viewer=\"canvas\"\n >\n <FlowCanvas\n nodes={graph.nodes}\n edges={graph.edges}\n nodeTypes={nodeTypes}\n height={height}\n showControls={showControls}\n showMinimap={showMinimap}\n // The read-only contract. Every mutation path React Flow offers is\n // closed here rather than left to the caller to remember.\n nodesDraggable={false}\n nodesConnectable={false}\n nodesFocusable={Boolean(onSelectNode)}\n edgesFocusable={false}\n elementsSelectable={Boolean(onSelectNode)}\n deleteKeyCode={null}\n selectionKeyCode={null}\n multiSelectionKeyCode={null}\n connectOnClick={false}\n // A canvas embedded mid-page must not trap a reader's scroll.\n zoomOnScroll={false}\n onNodeClick={onSelectNode ? (_, node) => onSelectNode(node as FlowNode) : undefined}\n fitView\n />\n </div>\n );\n}\n\nfunction cx(...parts: Array<string | false | null | undefined>): string {\n return parts.filter(Boolean).join(\" \");\n}\n"]}
|