@particle-academy/fancy-flow 0.34.0 → 0.36.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/{capabilities-BLOeLACV.d.cts → capabilities-BtJQTbnw.d.cts} +1 -1
- package/dist/{capabilities-BH7zmSQQ.d.ts → capabilities-CkhKj_U_.d.ts} +1 -1
- package/dist/{chunk-N5ICD2WZ.js → chunk-3BKU4SQZ.js} +3 -3
- package/dist/{chunk-N5ICD2WZ.js.map → chunk-3BKU4SQZ.js.map} +1 -1
- package/dist/{chunk-EBE3FEAJ.js → chunk-A6RFLGWV.js} +4 -4
- package/dist/{chunk-EBE3FEAJ.js.map → chunk-A6RFLGWV.js.map} +1 -1
- package/dist/{chunk-Q6IPK64P.js → chunk-PVROYW7C.js} +32 -5
- package/dist/chunk-PVROYW7C.js.map +1 -0
- package/dist/{chunk-FKOXQP76.js → chunk-QZTGV3ZL.js} +3 -3
- package/dist/{chunk-FKOXQP76.js.map → chunk-QZTGV3ZL.js.map} +1 -1
- package/dist/{chunk-THU5LW22.js → chunk-UX65ML3J.js} +4 -4
- package/dist/{chunk-THU5LW22.js.map → chunk-UX65ML3J.js.map} +1 -1
- package/dist/{chunk-RE7T5GKQ.js → chunk-VLATLVGH.js} +3 -3
- package/dist/{chunk-RE7T5GKQ.js.map → chunk-VLATLVGH.js.map} +1 -1
- package/dist/engine.cjs +10 -2
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.d.cts +7 -238
- package/dist/engine.d.ts +7 -238
- package/dist/engine.js +5 -5
- package/dist/index.cjs +163 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +65 -8
- package/dist/index.d.ts +65 -8
- package/dist/index.js +142 -13
- package/dist/index.js.map +1 -1
- package/dist/layout/index.d.cts +1 -1
- package/dist/layout/index.d.ts +1 -1
- package/dist/llm/prism.d.cts +2 -2
- package/dist/llm/prism.d.ts +2 -2
- package/dist/llm/vercel-ai.d.cts +2 -2
- package/dist/llm/vercel-ai.d.ts +2 -2
- package/dist/registry/index.d.cts +6 -6
- package/dist/registry/index.d.ts +6 -6
- package/dist/registry-BADFn97n.d.cts +85 -0
- package/dist/registry-DYbFLEcW.d.ts +85 -0
- package/dist/registry.cjs +31 -2
- package/dist/registry.cjs.map +1 -1
- package/dist/registry.js +3 -3
- package/dist/{run-cohort-DitsaYgS.d.cts → run-cohort-Bjv2ZU6g.d.cts} +1 -1
- package/dist/{run-cohort-CV7EcwGG.d.ts → run-cohort-BnP6ErHi.d.ts} +1 -1
- package/dist/runtime/index.d.cts +3 -3
- package/dist/runtime/index.d.ts +3 -3
- package/dist/runtime.cjs +7 -1
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.js +4 -4
- package/dist/schema/index.d.cts +1 -1
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema.cjs +7 -1
- package/dist/schema.cjs.map +1 -1
- package/dist/schema.js +2 -2
- package/dist/styles.css +103 -0
- package/dist/styles.css.map +1 -1
- package/dist/{types-DEmDSByY.d.cts → types-D6lsIGoe.d.ts} +251 -2
- package/dist/{types-Bj_ZHwqG.d.ts → types-D8Dezh9v.d.cts} +251 -2
- package/dist/{types-CMSrWVYM.d.cts → types-sOmpCitB.d.cts} +1 -1
- package/dist/{types-CMSrWVYM.d.ts → types-sOmpCitB.d.ts} +1 -1
- package/dist/ux.cjs.map +1 -1
- package/dist/ux.d.cts +2 -2
- package/dist/ux.d.ts +2 -2
- package/dist/ux.js +1 -1
- package/package.json +181 -181
- package/dist/chunk-Q6IPK64P.js.map +0 -1
- package/dist/registry-Dd1Q66uP.d.ts +0 -45
- package/dist/registry-qv4gRiuQ.d.cts +0 -45
package/dist/ux.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/registry/registry.ts","../src/ux.ts"],"names":["createEffectDispatcher","useMemo"],"mappings":";;;;;;;;AAEA,IAAM,KAAA,uBAAY,GAAA,EAA+C;AAEjE,IAAM,OA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AA,OAAO;AAAA,IACL,SAAA;AAAA,IACA,UAAU,UAAA,CAAW,QAAA;AAAA,IACrB,aAAa,UAAA,CAAW,KAAA;AAAA,IACxB;AAAA,GACF;AACF;AAMO,SAAS,gBAAgB,OAAA,EAA4C;AAC1E,EAAA,MAAM,MAAM,CAAA,EAAG,MAAA,CAAO,IAAA,CAAK,OAAA,CAAQ,OAAO,CAAA,CAAE,IAAA,EAAK,CAAE,IAAA,CAAK,GAAG,CAAC,CAAA,CAAA,EAAI,OAAA,CAAQ,KAAA,EAAO,MAAM,MAAM,CAAA,CAAA;AAE3F,EAAA,OAAOC,cAAQ,MAAM,kBAAA,CAAmB,OAAO,CAAA,EAAG,CAAC,GAAG,CAAC,CAAA;AACzD","file":"ux.cjs","sourcesContent":["import type { ConfigField, NodeKindDefinition } from \"./types\";\n\nconst kinds = new Map<string, NodeKindDefinition<any, any, any>>();\n/** alias → canonical name. See `resolveKindId`. */\nconst aliases = new Map<string, string>();\nconst listeners = new Set<() => void>();\n\n/**\n * registerNodeKind — install a node kind in the global registry. Returns\n * an `unregister` function. Calling with the same name replaces the prior\n * registration (handy for HMR).\n *\n * A kind's `name` is its CANONICAL id and is what gets written into saved\n * documents. Publish namespaced (`@fancy/llm_branch`, `@acme/salesforce_upsert`)\n * and list any previous bare names in `aliases`, so graphs saved before the\n * rename keep resolving.\n */\nexport function registerNodeKind<TC = any, TI = any, TO = any>(\n definition: NodeKindDefinition<TC, TI, TO>,\n): () => void {\n kinds.set(definition.name, definition as NodeKindDefinition<any, any, any>);\n for (const alias of definition.aliases ?? []) aliases.set(alias, definition.name);\n notify();\n return () => {\n if (kinds.get(definition.name) === (definition as any)) {\n kinds.delete(definition.name);\n for (const alias of definition.aliases ?? []) {\n if (aliases.get(alias) === definition.name) aliases.delete(alias);\n }\n notify();\n }\n };\n}\n\n/**\n * Resolve any id — canonical or alias — to the canonical one, or null.\n *\n * `kind` is persisted inside every saved graph, so a bare name that two\n * packages could both claim is unfixable after the fact: the ambiguous string\n * is already in the document. Canonical ids are namespaced; aliases exist so\n * documents written before namespacing keep opening.\n */\nexport function resolveKindId(id: string): string | null {\n if (kinds.has(id)) return id;\n const canonical = aliases.get(id);\n return canonical && kinds.has(canonical) ? canonical : null;\n}\n\n/** Get a single kind by canonical id or alias, or null. */\nexport function getNodeKind(name: string): NodeKindDefinition | null {\n const canonical = resolveKindId(name);\n return canonical ? ((kinds.get(canonical) as NodeKindDefinition) ?? null) : null;\n}\n\n/** Every id a kind answers to — canonical first. Used to key node-type maps. */\nexport function kindIds(kind: NodeKindDefinition): string[] {\n return [kind.name, ...(kind.aliases ?? [])];\n}\n\n/** List every registered kind, optionally filtered by category. */\nexport function listNodeKinds(category?: string): NodeKindDefinition[] {\n const all = Array.from(kinds.values()) as NodeKindDefinition[];\n return category ? all.filter((k) => k.category === category) : all;\n}\n\n/** Subscribe to registry changes. Returns an unsubscribe function. */\nexport function onNodeKindsChanged(listener: () => void): () => void {\n listeners.add(listener);\n return () => listeners.delete(listener);\n}\n\nfunction notify(): void {\n for (const l of listeners) l();\n}\n\n/** Fill in defaults from a kind's configSchema for newly-created nodes. */\nexport function defaultConfigFor(kind: NodeKindDefinition): Record<string, unknown> {\n const fromKind = kind.defaultConfig ? { ...(kind.defaultConfig as Record<string, unknown>) } : {};\n for (const field of kind.configSchema ?? []) {\n if (fromKind[field.key] !== undefined) continue;\n if (\"default\" in field && (field as any).default !== undefined) {\n fromKind[field.key] = (field as any).default;\n }\n }\n return fromKind;\n}\n\n/**\n * Validate a config object against a kind's schema. Returns an array of\n * issues (empty = valid). Validation is intentionally light — type\n * coercion + required-field checks. Hosts can layer Zod / Ajv on top.\n */\nexport function validateConfig(\n kind: NodeKindDefinition,\n config: Record<string, unknown>,\n): Array<{ key: string; message: string }> {\n const issues: Array<{ key: string; message: string }> = [];\n for (const field of kind.configSchema ?? []) {\n const value = config[field.key];\n if (field.required && (value === undefined || value === null || value === \"\")) {\n issues.push({ key: field.key, message: `${field.label} is required` });\n continue;\n }\n if (value === undefined || value === null) continue;\n const issue = validateField(field, value);\n if (issue) issues.push({ key: field.key, message: issue });\n }\n return issues;\n}\n\nfunction validateField(field: ConfigField, value: unknown): string | null {\n switch (field.type) {\n case \"text\":\n case \"textarea\":\n case \"expression\":\n case \"credential\":\n return typeof value === \"string\" ? null : `${field.label} must be a string`;\n case \"number\": {\n if (typeof value !== \"number\" || !Number.isFinite(value)) return `${field.label} must be a number`;\n if (field.min !== undefined && value < field.min) return `${field.label} must be >= ${field.min}`;\n if (field.max !== undefined && value > field.max) return `${field.label} must be <= ${field.max}`;\n return null;\n }\n case \"switch\":\n return typeof value === \"boolean\" ? null : `${field.label} must be a boolean`;\n case \"select\": {\n const allowed = field.options.map((o) => o.value);\n return allowed.includes(String(value)) ? null : `${field.label} must be one of ${allowed.join(\", \")}`;\n }\n case \"json\":\n return null; // permissive — just JSON-shaped\n case \"repeater\": {\n if (!Array.isArray(value)) return `${field.label} must be a list`;\n if (field.minItems !== undefined && value.length < field.minItems) {\n return `${field.label} needs at least ${field.minItems}`;\n }\n if (field.maxItems !== undefined && value.length > field.maxItems) {\n return `${field.label} allows at most ${field.maxItems}`;\n }\n // Surface the first offending row so the author knows WHICH one.\n for (let i = 0; i < value.length; i++) {\n const row = value[i];\n if (!row || typeof row !== \"object\" || Array.isArray(row)) {\n return `${field.label} item ${i + 1} must be an object`;\n }\n for (const sub of field.fields) {\n const cell = (row as Record<string, unknown>)[sub.key];\n if (sub.required && (cell === undefined || cell === null || cell === \"\")) {\n return `${field.label} item ${i + 1}: ${sub.label} is required`;\n }\n if (cell === undefined || cell === null) continue;\n const issue = validateField(sub, cell);\n if (issue) return `${field.label} item ${i + 1}: ${issue}`;\n }\n }\n return null;\n }\n case \"keyvalue\": {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return `${field.label} must be a key/value map`;\n }\n const allowed = field.valueOptions?.map((o) => o.value);\n for (const [k, v] of Object.entries(value as Record<string, unknown>)) {\n if (typeof v !== \"string\") return `${field.label}: \"${k}\" must be a string`;\n if (allowed && !allowed.includes(v)) {\n return `${field.label}: \"${k}\" must be one of ${allowed.join(\", \")}`;\n }\n }\n return null;\n }\n case \"document\":\n return null; // opaque to fancy-flow — the host's editor owns its shape\n default:\n return null;\n }\n}\n\n/** Default accents per category. */\nexport function categoryAccent(category: string): string {\n switch (category) {\n case \"trigger\": return \"#10b981\";\n case \"logic\": return \"#f59e0b\";\n case \"data\": return \"#0ea5e9\";\n case \"ai\": return \"#8b5cf6\";\n case \"io\": return \"#3b82f6\";\n case \"human\": return \"#ec4899\";\n case \"output\": return \"#a855f7\";\n case \"layout\": return \"#64748b\";\n case \"annotation\": return \"#eab308\";\n default: return \"#71717a\";\n }\n}\n","/**\n * FlowRunnerUx — the **flow-driven UX** bridge. The headless counterpart to\n * agent-integrations: where that wires an *agent* to host UI surfaces, this\n * wires a *running flow* to host UX. Both share the same primitives from\n * `@particle-academy/fancy-auto-common` (activity bus, effect dispatch).\n *\n * The host registers named UX effects (toast, navigate, confirm, …); this turns\n * each into a flow executor keyed by a node kind (`ux_<effect>` by default), so\n * dropping a `ux_toast` node into a `<FlowEditor>` and running it fires the\n * host's toast. Every dispatch broadcasts an `AutoActivityEvent` (source:\"flow\")\n * for presence / logging. Human-in-the-loop is free: an effect that returns a\n * Promise (e.g. an approval dialog) pauses the run until the user resolves it.\n *\n * const ux = createFlowRunnerUx({\n * effects: {\n * toast: ({ message }) => toast({ title: message }),\n * navigate:({ to }) => router.visit(to),\n * confirm: ({ prompt }) => new Promise(res => openDialog(prompt, res)), // pauses the run\n * },\n * });\n * ux.registerKinds(); // adds ux_toast / ux_navigate / ux_confirm to the palette\n * <FlowEditor initial={graph} executors={ux.executors} />\n */\nimport { useMemo } from \"react\";\nimport {\n createEffectDispatcher,\n type DispatchActor,\n type EffectRegistry,\n} from \"@particle-academy/fancy-auto-common\";\nimport { registerNodeKind } from \"./registry/registry\";\nimport type { ConfigField, NodeCategory } from \"./registry/types\";\nimport type { ExecutorRegistry, FlowNode } from \"./types\";\n\nexport type { AutoActivityEvent } from \"@particle-academy/fancy-auto-common\";\n\n/** Per-effect presentation for the palette node kind that drives it. */\nexport type UxEffectMeta = {\n /** Palette label. Default: the effect name. */\n label?: string;\n /** One-line palette description. */\n description?: string;\n /** Emoji / glyph for the node header. */\n icon?: string;\n /** Header accent color. */\n accent?: string;\n /** Palette grouping. Default \"output\". */\n category?: NodeCategory;\n /** Config form fields = the effect's params. */\n configSchema?: ConfigField[];\n};\n\nexport type FlowRunnerUxOptions = {\n /** Named host UX effects the flow can invoke. */\n effects: EffectRegistry;\n /** Optional per-effect palette metadata (used by `registerKinds`). */\n meta?: Record<string, UxEffectMeta>;\n /** Identifies the flow run in emitted activity. Default `{ id: \"flow\", source: \"flow\" }`. */\n actor?: DispatchActor;\n /** Map an effect name to its node-kind name. Default `ux_<effect>`. */\n kindFor?: (effectName: string) => string;\n};\n\nexport type FlowRunnerUx = {\n /** Executor registry to hand to `<FlowEditor executors>` or `runFlow`. */\n executors: ExecutorRegistry;\n /** Invoke an effect imperatively (also emits activity). */\n dispatch: <R = unknown>(name: string, params?: unknown) => Promise<R>;\n /** All effect names. */\n effectNames: () => string[];\n /** Register a palette node kind per effect (`ux_<effect>`). Idempotent. */\n registerKinds: () => void;\n};\n\nconst defaultKindFor = (name: string) => `ux_${name}`;\n\n/** Build a FlowRunnerUx from a set of host effects. Framework-agnostic. */\nexport function createFlowRunnerUx(options: FlowRunnerUxOptions): FlowRunnerUx {\n const {\n effects,\n meta = {},\n actor = { id: \"flow\", source: \"flow\" },\n kindFor = defaultKindFor,\n } = options;\n\n const dispatcher = createEffectDispatcher(effects, { actor, targetKind: \"ux\" });\n\n const executors: ExecutorRegistry = {};\n for (const name of Object.keys(effects)) {\n executors[kindFor(name)] = async ({ node }: { node: FlowNode }) => {\n const params = (node.data as { config?: Record<string, unknown> } | undefined)?.config ?? {};\n const result = await dispatcher.dispatch(name, params);\n // A UX effect can drive flow control: if it returns the decision sugar\n // (`{ branch }` or `{ __port }`) — e.g. an interactive \"choose\" effect that\n // awaits a human pick and returns the chosen port — pass it straight\n // through so runFlow routes on it. Otherwise wrap the result for the feed.\n if (result && typeof result === \"object\" && (\"branch\" in result || \"__port\" in result)) {\n return result;\n }\n return { effect: name, result };\n };\n }\n\n const registerKinds = () => {\n for (const name of Object.keys(effects)) {\n const m = meta[name] ?? {};\n registerNodeKind({\n name: kindFor(name),\n category: m.category ?? \"output\",\n label: m.label ?? name,\n description: m.description ?? `Flow-driven UX effect: ${name}.`,\n icon: m.icon ?? \"✨\",\n accent: m.accent ?? \"#8b5cf6\",\n inputs: [{ id: \"in\" }],\n outputs: [],\n configSchema: m.configSchema,\n });\n }\n };\n\n return {\n executors,\n dispatch: dispatcher.dispatch as FlowRunnerUx[\"dispatch\"],\n effectNames: dispatcher.names,\n registerKinds,\n };\n}\n\n/**\n * React hook form — memoizes on the effect-name set + actor id so the returned\n * executors keep a stable identity across renders.\n */\nexport function useFlowRunnerUx(options: FlowRunnerUxOptions): FlowRunnerUx {\n const key = `${Object.keys(options.effects).sort().join(\",\")}|${options.actor?.id ?? \"flow\"}`;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return useMemo(() => createFlowRunnerUx(options), [key]);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/registry/registry.ts","../src/ux.ts"],"names":["createEffectDispatcher","useMemo"],"mappings":";;;;;;;;AAEA,IAAM,KAAA,uBAAY,GAAA,EAA+C;AAEjE,IAAM,OAAA,uBAAc,GAAA,EAAoB;AACxC,IAAM,SAAA,uBAAgB,GAAA,EAAgB;AAoC/B,SAAS,iBACd,UAAA,EACY;AACZ,EAAA,KAAA,CAAM,GAAA,CAAI,UAAA,CAAW,IAAA,EAAM,UAA+C,CAAA;AAC1E,EAAA,KAAA,MAAW,KAAA,IAAS,WAAW,OAAA,IAAW,IAAI,OAAA,CAAQ,GAAA,CAAI,KAAA,EAAO,UAAA,CAAW,IAAI,CAAA;AAChF,EAAA,MAAA,EAAO;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AAA,CAAQ,KAAA,EAAO,MAAM,MAAM,CAAA,CAAA;AAE3F,EAAA,OAAOC,cAAQ,MAAM,kBAAA,CAAmB,OAAO,CAAA,EAAG,CAAC,GAAG,CAAC,CAAA;AACzD","file":"ux.cjs","sourcesContent":["import type { ConfigField, NodeKindDefinition } from \"./types\";\n\nconst kinds = new Map<string, NodeKindDefinition<any, any, any>>();\n/** alias → canonical name. See `resolveKindId`. */\nconst aliases = new Map<string, string>();\nconst listeners = new Set<() => void>();\n/**\n * canonical name → presentation patch. See `overrideNodeKind`.\n *\n * Kept SEPARATE from `kinds` on purpose: an override has to survive its base\n * kind being re-registered (HMR, a later `registerBuiltinKinds()`, a package\n * upgrade). Merging into the definition would mean the next registration\n * silently reverts the consumer's naming.\n */\nconst overrides = new Map<string, NodeKindPresentation>();\n\n/**\n * The presentation fields a consumer may override on someone else's node kind.\n *\n * Deliberately excludes everything behavioural — `executor`, `inputs`,\n * `outputs`, `configSchema`, `sideEffects`. An \"override\" that could change\n * those is not an override, it is a fork wearing a friendly name, and it would\n * desync the graph from the runtime that executes it.\n *\n * `category` IS included: which drawer a node appears in is presentation, and a\n * consumer regrouping their palette is the same kind of act as renaming.\n */\nexport type NodeKindPresentation = Partial<\n Pick<NodeKindDefinition, \"label\" | \"description\" | \"icon\" | \"accent\" | \"category\">\n>;\n\n/**\n * registerNodeKind — install a node kind in the global registry. Returns\n * an `unregister` function. Calling with the same name replaces the prior\n * registration (handy for HMR).\n *\n * A kind's `name` is its CANONICAL id and is what gets written into saved\n * documents. Publish namespaced (`@fancy/llm_branch`, `@acme/salesforce_upsert`)\n * and list any previous bare names in `aliases`, so graphs saved before the\n * rename keep resolving.\n */\nexport function registerNodeKind<TC = any, TI = any, TO = any>(\n definition: NodeKindDefinition<TC, TI, TO>,\n): () => void {\n kinds.set(definition.name, definition as NodeKindDefinition<any, any, any>);\n for (const alias of definition.aliases ?? []) aliases.set(alias, definition.name);\n notify();\n return () => {\n if (kinds.get(definition.name) === (definition as any)) {\n kinds.delete(definition.name);\n for (const alias of definition.aliases ?? []) {\n if (aliases.get(alias) === definition.name) aliases.delete(alias);\n }\n notify();\n }\n };\n}\n\n/**\n * Resolve any id — canonical or alias — to the canonical one, or null.\n *\n * `kind` is persisted inside every saved graph, so a bare name that two\n * packages could both claim is unfixable after the fact: the ambiguous string\n * is already in the document. Canonical ids are namespaced; aliases exist so\n * documents written before namespacing keep opening.\n */\nexport function resolveKindId(id: string): string | null {\n if (kinds.has(id)) return id;\n const canonical = aliases.get(id);\n return canonical && kinds.has(canonical) ? canonical : null;\n}\n\n/**\n * Rename or re-describe a kind you did not author.\n *\n * Before this existed the only way to relabel a builtin was `registerNodeKind`\n * with a full definition — which REPLACES the kind, so a consumer wanting\n * \"Call an API\" instead of \"HTTP Request\" had to re-declare that node's\n * configSchema, ports, executor and renderer, and silently forfeited whatever\n * the builtin gained in the next release. In practice nobody renamed a node,\n * and the palette could not be localised at all.\n *\n * ```ts\n * const undo = overrideNodeKind(\"@particle-academy/http_request\", {\n * label: \"Call an API\",\n * description: \"Fetch or post JSON to a URL\",\n * });\n * ```\n *\n * Applies at `getNodeKind()` and `listNodeKinds()`, so one call reaches the\n * palette, the node cards on the canvas, `FlowViewer`, and anything else that\n * reads the registry. Returns an unsubscribe, matching `registerNodeKind`.\n *\n * Patching an unregistered id is allowed and takes effect if that kind is\n * registered later — order of module side effects is not something a consumer\n * should have to reason about.\n */\nexport function overrideNodeKind(name: string, patch: NodeKindPresentation): () => void {\n const canonical = resolveKindId(name) ?? name;\n const previous = overrides.get(canonical);\n\n overrides.set(canonical, { ...previous, ...patch });\n notify();\n\n return () => {\n if (previous) {\n overrides.set(canonical, previous);\n } else {\n overrides.delete(canonical);\n }\n notify();\n };\n}\n\n/** Remove every presentation override. Mostly for tests. */\nexport function clearNodeKindOverrides(): void {\n if (overrides.size === 0) return;\n overrides.clear();\n notify();\n}\n\nfunction withOverride(kind: NodeKindDefinition | undefined): NodeKindDefinition | null {\n if (!kind) return null;\n const patch = overrides.get(kind.name);\n return patch ? ({ ...kind, ...patch } as NodeKindDefinition) : kind;\n}\n\n/** Get a single kind by canonical id or alias, or null. */\nexport function getNodeKind(name: string): NodeKindDefinition | null {\n const canonical = resolveKindId(name);\n return canonical ? withOverride(kinds.get(canonical) as NodeKindDefinition) : null;\n}\n\n/** Every id a kind answers to — canonical first. Used to key node-type maps. */\nexport function kindIds(kind: NodeKindDefinition): string[] {\n return [kind.name, ...(kind.aliases ?? [])];\n}\n\n/** List every registered kind, optionally filtered by category. */\nexport function listNodeKinds(category?: string): NodeKindDefinition[] {\n const all = Array.from(kinds.values()).map((k) =>\n withOverride(k as NodeKindDefinition),\n ) as NodeKindDefinition[];\n // Filter AFTER applying overrides, so an override that moves a node to a\n // different category actually moves it in the palette rather than leaving it\n // filed under the old one with a new name.\n return category ? all.filter((k) => k.category === category) : all;\n}\n\n/** Subscribe to registry changes. Returns an unsubscribe function. */\nexport function onNodeKindsChanged(listener: () => void): () => void {\n listeners.add(listener);\n return () => listeners.delete(listener);\n}\n\nfunction notify(): void {\n for (const l of listeners) l();\n}\n\n/** Fill in defaults from a kind's configSchema for newly-created nodes. */\nexport function defaultConfigFor(kind: NodeKindDefinition): Record<string, unknown> {\n const fromKind = kind.defaultConfig ? { ...(kind.defaultConfig as Record<string, unknown>) } : {};\n for (const field of kind.configSchema ?? []) {\n if (fromKind[field.key] !== undefined) continue;\n if (\"default\" in field && (field as any).default !== undefined) {\n fromKind[field.key] = (field as any).default;\n }\n }\n return fromKind;\n}\n\n/**\n * Validate a config object against a kind's schema. Returns an array of\n * issues (empty = valid). Validation is intentionally light — type\n * coercion + required-field checks. Hosts can layer Zod / Ajv on top.\n */\nexport function validateConfig(\n kind: NodeKindDefinition,\n config: Record<string, unknown>,\n): Array<{ key: string; message: string }> {\n const issues: Array<{ key: string; message: string }> = [];\n for (const field of kind.configSchema ?? []) {\n const value = config[field.key];\n if (field.required && (value === undefined || value === null || value === \"\")) {\n issues.push({ key: field.key, message: `${field.label} is required` });\n continue;\n }\n if (value === undefined || value === null) continue;\n const issue = validateField(field, value);\n if (issue) issues.push({ key: field.key, message: issue });\n }\n return issues;\n}\n\nfunction validateField(field: ConfigField, value: unknown): string | null {\n switch (field.type) {\n case \"text\":\n case \"textarea\":\n case \"expression\":\n case \"credential\":\n return typeof value === \"string\" ? null : `${field.label} must be a string`;\n case \"number\": {\n if (typeof value !== \"number\" || !Number.isFinite(value)) return `${field.label} must be a number`;\n if (field.min !== undefined && value < field.min) return `${field.label} must be >= ${field.min}`;\n if (field.max !== undefined && value > field.max) return `${field.label} must be <= ${field.max}`;\n return null;\n }\n case \"switch\":\n return typeof value === \"boolean\" ? null : `${field.label} must be a boolean`;\n case \"select\": {\n const allowed = field.options.map((o) => o.value);\n return allowed.includes(String(value)) ? null : `${field.label} must be one of ${allowed.join(\", \")}`;\n }\n case \"json\":\n return null; // permissive — just JSON-shaped\n case \"repeater\": {\n if (!Array.isArray(value)) return `${field.label} must be a list`;\n if (field.minItems !== undefined && value.length < field.minItems) {\n return `${field.label} needs at least ${field.minItems}`;\n }\n if (field.maxItems !== undefined && value.length > field.maxItems) {\n return `${field.label} allows at most ${field.maxItems}`;\n }\n // Surface the first offending row so the author knows WHICH one.\n for (let i = 0; i < value.length; i++) {\n const row = value[i];\n if (!row || typeof row !== \"object\" || Array.isArray(row)) {\n return `${field.label} item ${i + 1} must be an object`;\n }\n for (const sub of field.fields) {\n const cell = (row as Record<string, unknown>)[sub.key];\n if (sub.required && (cell === undefined || cell === null || cell === \"\")) {\n return `${field.label} item ${i + 1}: ${sub.label} is required`;\n }\n if (cell === undefined || cell === null) continue;\n const issue = validateField(sub, cell);\n if (issue) return `${field.label} item ${i + 1}: ${issue}`;\n }\n }\n return null;\n }\n case \"keyvalue\": {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return `${field.label} must be a key/value map`;\n }\n const allowed = field.valueOptions?.map((o) => o.value);\n for (const [k, v] of Object.entries(value as Record<string, unknown>)) {\n if (typeof v !== \"string\") return `${field.label}: \"${k}\" must be a string`;\n if (allowed && !allowed.includes(v)) {\n return `${field.label}: \"${k}\" must be one of ${allowed.join(\", \")}`;\n }\n }\n return null;\n }\n case \"document\":\n return null; // opaque to fancy-flow — the host's editor owns its shape\n default:\n return null;\n }\n}\n\n/** Default accents per category. */\nexport function categoryAccent(category: string): string {\n switch (category) {\n case \"trigger\": return \"#10b981\";\n case \"logic\": return \"#f59e0b\";\n case \"data\": return \"#0ea5e9\";\n case \"ai\": return \"#8b5cf6\";\n case \"io\": return \"#3b82f6\";\n case \"human\": return \"#ec4899\";\n case \"output\": return \"#a855f7\";\n case \"layout\": return \"#64748b\";\n case \"annotation\": return \"#eab308\";\n default: return \"#71717a\";\n }\n}\n","/**\n * FlowRunnerUx — the **flow-driven UX** bridge. The headless counterpart to\n * agent-integrations: where that wires an *agent* to host UI surfaces, this\n * wires a *running flow* to host UX. Both share the same primitives from\n * `@particle-academy/fancy-auto-common` (activity bus, effect dispatch).\n *\n * The host registers named UX effects (toast, navigate, confirm, …); this turns\n * each into a flow executor keyed by a node kind (`ux_<effect>` by default), so\n * dropping a `ux_toast` node into a `<FlowEditor>` and running it fires the\n * host's toast. Every dispatch broadcasts an `AutoActivityEvent` (source:\"flow\")\n * for presence / logging. Human-in-the-loop is free: an effect that returns a\n * Promise (e.g. an approval dialog) pauses the run until the user resolves it.\n *\n * const ux = createFlowRunnerUx({\n * effects: {\n * toast: ({ message }) => toast({ title: message }),\n * navigate:({ to }) => router.visit(to),\n * confirm: ({ prompt }) => new Promise(res => openDialog(prompt, res)), // pauses the run\n * },\n * });\n * ux.registerKinds(); // adds ux_toast / ux_navigate / ux_confirm to the palette\n * <FlowEditor initial={graph} executors={ux.executors} />\n */\nimport { useMemo } from \"react\";\nimport {\n createEffectDispatcher,\n type DispatchActor,\n type EffectRegistry,\n} from \"@particle-academy/fancy-auto-common\";\nimport { registerNodeKind } from \"./registry/registry\";\nimport type { ConfigField, NodeCategory } from \"./registry/types\";\nimport type { ExecutorRegistry, FlowNode } from \"./types\";\n\nexport type { AutoActivityEvent } from \"@particle-academy/fancy-auto-common\";\n\n/** Per-effect presentation for the palette node kind that drives it. */\nexport type UxEffectMeta = {\n /** Palette label. Default: the effect name. */\n label?: string;\n /** One-line palette description. */\n description?: string;\n /** Emoji / glyph for the node header. */\n icon?: string;\n /** Header accent color. */\n accent?: string;\n /** Palette grouping. Default \"output\". */\n category?: NodeCategory;\n /** Config form fields = the effect's params. */\n configSchema?: ConfigField[];\n};\n\nexport type FlowRunnerUxOptions = {\n /** Named host UX effects the flow can invoke. */\n effects: EffectRegistry;\n /** Optional per-effect palette metadata (used by `registerKinds`). */\n meta?: Record<string, UxEffectMeta>;\n /** Identifies the flow run in emitted activity. Default `{ id: \"flow\", source: \"flow\" }`. */\n actor?: DispatchActor;\n /** Map an effect name to its node-kind name. Default `ux_<effect>`. */\n kindFor?: (effectName: string) => string;\n};\n\nexport type FlowRunnerUx = {\n /** Executor registry to hand to `<FlowEditor executors>` or `runFlow`. */\n executors: ExecutorRegistry;\n /** Invoke an effect imperatively (also emits activity). */\n dispatch: <R = unknown>(name: string, params?: unknown) => Promise<R>;\n /** All effect names. */\n effectNames: () => string[];\n /** Register a palette node kind per effect (`ux_<effect>`). Idempotent. */\n registerKinds: () => void;\n};\n\nconst defaultKindFor = (name: string) => `ux_${name}`;\n\n/** Build a FlowRunnerUx from a set of host effects. Framework-agnostic. */\nexport function createFlowRunnerUx(options: FlowRunnerUxOptions): FlowRunnerUx {\n const {\n effects,\n meta = {},\n actor = { id: \"flow\", source: \"flow\" },\n kindFor = defaultKindFor,\n } = options;\n\n const dispatcher = createEffectDispatcher(effects, { actor, targetKind: \"ux\" });\n\n const executors: ExecutorRegistry = {};\n for (const name of Object.keys(effects)) {\n executors[kindFor(name)] = async ({ node }: { node: FlowNode }) => {\n const params = (node.data as { config?: Record<string, unknown> } | undefined)?.config ?? {};\n const result = await dispatcher.dispatch(name, params);\n // A UX effect can drive flow control: if it returns the decision sugar\n // (`{ branch }` or `{ __port }`) — e.g. an interactive \"choose\" effect that\n // awaits a human pick and returns the chosen port — pass it straight\n // through so runFlow routes on it. Otherwise wrap the result for the feed.\n if (result && typeof result === \"object\" && (\"branch\" in result || \"__port\" in result)) {\n return result;\n }\n return { effect: name, result };\n };\n }\n\n const registerKinds = () => {\n for (const name of Object.keys(effects)) {\n const m = meta[name] ?? {};\n registerNodeKind({\n name: kindFor(name),\n category: m.category ?? \"output\",\n label: m.label ?? name,\n description: m.description ?? `Flow-driven UX effect: ${name}.`,\n icon: m.icon ?? \"✨\",\n accent: m.accent ?? \"#8b5cf6\",\n inputs: [{ id: \"in\" }],\n outputs: [],\n configSchema: m.configSchema,\n });\n }\n };\n\n return {\n executors,\n dispatch: dispatcher.dispatch as FlowRunnerUx[\"dispatch\"],\n effectNames: dispatcher.names,\n registerKinds,\n };\n}\n\n/**\n * React hook form — memoizes on the effect-name set + actor id so the returned\n * executors keep a stable identity across renders.\n */\nexport function useFlowRunnerUx(options: FlowRunnerUxOptions): FlowRunnerUx {\n const key = `${Object.keys(options.effects).sort().join(\",\")}|${options.actor?.id ?? \"flow\"}`;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return useMemo(() => createFlowRunnerUx(options), [key]);\n}\n"]}
|
package/dist/ux.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EffectRegistry, DispatchActor } from '@particle-academy/fancy-auto-common';
|
|
2
2
|
export { AutoActivityEvent } from '@particle-academy/fancy-auto-common';
|
|
3
|
-
import {
|
|
4
|
-
import { E as ExecutorRegistry } from './types-
|
|
3
|
+
import { c as NodeCategory, a as ConfigField } from './types-D8Dezh9v.cjs';
|
|
4
|
+
import { E as ExecutorRegistry } from './types-sOmpCitB.cjs';
|
|
5
5
|
import 'react';
|
|
6
6
|
import '@xyflow/react';
|
|
7
7
|
|
package/dist/ux.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EffectRegistry, DispatchActor } from '@particle-academy/fancy-auto-common';
|
|
2
2
|
export { AutoActivityEvent } from '@particle-academy/fancy-auto-common';
|
|
3
|
-
import {
|
|
4
|
-
import { E as ExecutorRegistry } from './types-
|
|
3
|
+
import { c as NodeCategory, a as ConfigField } from './types-D6lsIGoe.js';
|
|
4
|
+
import { E as ExecutorRegistry } from './types-sOmpCitB.js';
|
|
5
5
|
import 'react';
|
|
6
6
|
import '@xyflow/react';
|
|
7
7
|
|
package/dist/ux.js
CHANGED
package/package.json
CHANGED
|
@@ -1,192 +1,192 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
},
|
|
9
|
-
"homepage": "https://github.com/Particle-Academy/fancy-flow#readme",
|
|
10
|
-
"bugs": "https://github.com/Particle-Academy/fancy-flow/issues",
|
|
11
|
-
"type": "module",
|
|
12
|
-
"main": "./dist/index.cjs",
|
|
13
|
-
"module": "./dist/index.js",
|
|
14
|
-
"types": "./dist/index.d.ts",
|
|
15
|
-
"exports": {
|
|
16
|
-
".": {
|
|
17
|
-
"import": {
|
|
18
|
-
"types": "./dist/index.d.ts",
|
|
19
|
-
"default": "./dist/index.js"
|
|
20
|
-
},
|
|
21
|
-
"require": {
|
|
22
|
-
"types": "./dist/index.d.cts",
|
|
23
|
-
"default": "./dist/index.cjs"
|
|
24
|
-
}
|
|
2
|
+
"name": "@particle-academy/fancy-flow",
|
|
3
|
+
"version": "0.36.0",
|
|
4
|
+
"description": "Workflow editor + runner. Six built-in node kits (trigger / action / decision / output / note / subgraph), tokenized theme, topological execution with per-node status. React-flow bundled; consumers npm install fancy-flow and get nothing extra.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/Particle-Academy/fancy-flow.git"
|
|
25
8
|
},
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
|
|
9
|
+
"homepage": "https://github.com/Particle-Academy/fancy-flow#readme",
|
|
10
|
+
"bugs": "https://github.com/Particle-Academy/fancy-flow/issues",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"main": "./dist/index.cjs",
|
|
13
|
+
"module": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"import": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"default": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"require": {
|
|
22
|
+
"types": "./dist/index.d.cts",
|
|
23
|
+
"default": "./dist/index.cjs"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"./runtime": {
|
|
27
|
+
"import": {
|
|
28
|
+
"types": "./dist/runtime/index.d.ts",
|
|
29
|
+
"default": "./dist/runtime.js"
|
|
30
|
+
},
|
|
31
|
+
"require": {
|
|
32
|
+
"types": "./dist/runtime/index.d.cts",
|
|
33
|
+
"default": "./dist/runtime.cjs"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"./registry": {
|
|
37
|
+
"import": {
|
|
38
|
+
"types": "./dist/registry/index.d.ts",
|
|
39
|
+
"default": "./dist/registry.js"
|
|
40
|
+
},
|
|
41
|
+
"require": {
|
|
42
|
+
"types": "./dist/registry/index.d.cts",
|
|
43
|
+
"default": "./dist/registry.cjs"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"./schema": {
|
|
47
|
+
"import": {
|
|
48
|
+
"types": "./dist/schema/index.d.ts",
|
|
49
|
+
"default": "./dist/schema.js"
|
|
50
|
+
},
|
|
51
|
+
"require": {
|
|
52
|
+
"types": "./dist/schema/index.d.cts",
|
|
53
|
+
"default": "./dist/schema.cjs"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"./layout": {
|
|
57
|
+
"import": {
|
|
58
|
+
"types": "./dist/layout/index.d.ts",
|
|
59
|
+
"default": "./dist/layout.js"
|
|
60
|
+
},
|
|
61
|
+
"require": {
|
|
62
|
+
"types": "./dist/layout/index.d.cts",
|
|
63
|
+
"default": "./dist/layout.cjs"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"./engine": {
|
|
67
|
+
"import": {
|
|
68
|
+
"types": "./dist/engine.d.ts",
|
|
69
|
+
"default": "./dist/engine.js"
|
|
70
|
+
},
|
|
71
|
+
"require": {
|
|
72
|
+
"types": "./dist/engine.d.cts",
|
|
73
|
+
"default": "./dist/engine.cjs"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"./ux": {
|
|
77
|
+
"import": {
|
|
78
|
+
"types": "./dist/ux.d.ts",
|
|
79
|
+
"default": "./dist/ux.js"
|
|
80
|
+
},
|
|
81
|
+
"require": {
|
|
82
|
+
"types": "./dist/ux.d.cts",
|
|
83
|
+
"default": "./dist/ux.cjs"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"./styles.css": "./dist/styles.css",
|
|
87
|
+
"./rich-input": {
|
|
88
|
+
"import": {
|
|
89
|
+
"types": "./dist/rich-input.d.ts",
|
|
90
|
+
"default": "./dist/rich-input.js"
|
|
91
|
+
},
|
|
92
|
+
"require": {
|
|
93
|
+
"types": "./dist/rich-input.d.cts",
|
|
94
|
+
"default": "./dist/rich-input.cjs"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"./llm/vercel-ai": {
|
|
98
|
+
"import": {
|
|
99
|
+
"types": "./dist/llm/vercel-ai.d.ts",
|
|
100
|
+
"default": "./dist/llm/vercel-ai.js"
|
|
101
|
+
},
|
|
102
|
+
"require": {
|
|
103
|
+
"types": "./dist/llm/vercel-ai.d.cts",
|
|
104
|
+
"default": "./dist/llm/vercel-ai.cjs"
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"./llm/prism": {
|
|
108
|
+
"import": {
|
|
109
|
+
"types": "./dist/llm/prism.d.ts",
|
|
110
|
+
"default": "./dist/llm/prism.js"
|
|
111
|
+
},
|
|
112
|
+
"require": {
|
|
113
|
+
"types": "./dist/llm/prism.d.cts",
|
|
114
|
+
"default": "./dist/llm/prism.cjs"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
35
117
|
},
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
|
|
118
|
+
"files": [
|
|
119
|
+
"dist",
|
|
120
|
+
"docs",
|
|
121
|
+
"README.md"
|
|
122
|
+
],
|
|
123
|
+
"scripts": {
|
|
124
|
+
"build": "tsup",
|
|
125
|
+
"dev": "tsup --watch",
|
|
126
|
+
"lint": "tsc --noEmit && eslint .",
|
|
127
|
+
"test": "vitest run",
|
|
128
|
+
"clean": "rm -rf dist",
|
|
129
|
+
"prepublishOnly": "tsup"
|
|
45
130
|
},
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
|
|
131
|
+
"keywords": [
|
|
132
|
+
"react",
|
|
133
|
+
"workflow",
|
|
134
|
+
"flow",
|
|
135
|
+
"graph",
|
|
136
|
+
"agent",
|
|
137
|
+
"fancy"
|
|
138
|
+
],
|
|
139
|
+
"peerDependencies": {
|
|
140
|
+
"@particle-academy/fancy-cms-ui": ">=0.2",
|
|
141
|
+
"@particle-academy/react-fancy": ">=3",
|
|
142
|
+
"ai": ">=5",
|
|
143
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
144
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
55
145
|
},
|
|
56
|
-
"
|
|
57
|
-
|
|
58
|
-
"types": "./dist/layout/index.d.ts",
|
|
59
|
-
"default": "./dist/layout.js"
|
|
60
|
-
},
|
|
61
|
-
"require": {
|
|
62
|
-
"types": "./dist/layout/index.d.cts",
|
|
63
|
-
"default": "./dist/layout.cjs"
|
|
64
|
-
}
|
|
146
|
+
"dependencies": {
|
|
147
|
+
"@particle-academy/fancy-auto-common": ">=0.1 <2.0"
|
|
65
148
|
},
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
"types": "
|
|
73
|
-
"
|
|
74
|
-
|
|
149
|
+
"devDependencies": {
|
|
150
|
+
"@dagrejs/dagre": "^3.0.0",
|
|
151
|
+
"@particle-academy/fancy-cms-ui": "^0.2.0",
|
|
152
|
+
"@particle-academy/react-fancy": "^4.15.0",
|
|
153
|
+
"@testing-library/dom": "^10.4.1",
|
|
154
|
+
"@testing-library/react": "^16.3.2",
|
|
155
|
+
"@types/react": "^19.0.0",
|
|
156
|
+
"@types/react-dom": "^19.0.0",
|
|
157
|
+
"@xyflow/react": "^12.4.0",
|
|
158
|
+
"ai": "^7.0.31",
|
|
159
|
+
"clsx": "^2.1.0",
|
|
160
|
+
"eslint": "^10.8.0",
|
|
161
|
+
"eslint-plugin-react-hooks": "^7.1.1",
|
|
162
|
+
"jsdom": "^29.1.1",
|
|
163
|
+
"react": "^19.0.0",
|
|
164
|
+
"react-dom": "^19.0.0",
|
|
165
|
+
"tsup": "^8.0.0",
|
|
166
|
+
"typescript": "^5.7.0",
|
|
167
|
+
"typescript-eslint": "^8.65.0",
|
|
168
|
+
"vitest": "^3.2.6",
|
|
169
|
+
"zod": "^4.4.3"
|
|
75
170
|
},
|
|
76
|
-
"
|
|
77
|
-
|
|
78
|
-
"types": "./dist/ux.d.ts",
|
|
79
|
-
"default": "./dist/ux.js"
|
|
80
|
-
},
|
|
81
|
-
"require": {
|
|
82
|
-
"types": "./dist/ux.d.cts",
|
|
83
|
-
"default": "./dist/ux.cjs"
|
|
84
|
-
}
|
|
171
|
+
"publishConfig": {
|
|
172
|
+
"access": "public"
|
|
85
173
|
},
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
"require": {
|
|
93
|
-
"types": "./dist/rich-input.d.cts",
|
|
94
|
-
"default": "./dist/rich-input.cjs"
|
|
95
|
-
}
|
|
174
|
+
"license": "MIT",
|
|
175
|
+
"sideEffects": [
|
|
176
|
+
"**/*.css"
|
|
177
|
+
],
|
|
178
|
+
"overrides": {
|
|
179
|
+
"esbuild": "^0.28.1"
|
|
96
180
|
},
|
|
97
|
-
"
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
"
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
"./llm/prism": {
|
|
108
|
-
"import": {
|
|
109
|
-
"types": "./dist/llm/prism.d.ts",
|
|
110
|
-
"default": "./dist/llm/prism.js"
|
|
111
|
-
},
|
|
112
|
-
"require": {
|
|
113
|
-
"types": "./dist/llm/prism.d.cts",
|
|
114
|
-
"default": "./dist/llm/prism.cjs"
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
"files": [
|
|
119
|
-
"dist",
|
|
120
|
-
"docs",
|
|
121
|
-
"README.md"
|
|
122
|
-
],
|
|
123
|
-
"scripts": {
|
|
124
|
-
"build": "tsup",
|
|
125
|
-
"dev": "tsup --watch",
|
|
126
|
-
"lint": "tsc --noEmit && eslint .",
|
|
127
|
-
"test": "vitest run",
|
|
128
|
-
"clean": "rm -rf dist",
|
|
129
|
-
"prepublishOnly": "tsup"
|
|
130
|
-
},
|
|
131
|
-
"keywords": [
|
|
132
|
-
"react",
|
|
133
|
-
"workflow",
|
|
134
|
-
"flow",
|
|
135
|
-
"graph",
|
|
136
|
-
"agent",
|
|
137
|
-
"fancy"
|
|
138
|
-
],
|
|
139
|
-
"peerDependencies": {
|
|
140
|
-
"@particle-academy/fancy-cms-ui": ">=0.2",
|
|
141
|
-
"@particle-academy/react-fancy": ">=3",
|
|
142
|
-
"ai": ">=5",
|
|
143
|
-
"react": "^18.0.0 || ^19.0.0",
|
|
144
|
-
"react-dom": "^18.0.0 || ^19.0.0"
|
|
145
|
-
},
|
|
146
|
-
"dependencies": {
|
|
147
|
-
"@particle-academy/fancy-auto-common": ">=0.1 <2.0"
|
|
148
|
-
},
|
|
149
|
-
"devDependencies": {
|
|
150
|
-
"@dagrejs/dagre": "^3.0.0",
|
|
151
|
-
"@particle-academy/fancy-cms-ui": "^0.2.0",
|
|
152
|
-
"@particle-academy/react-fancy": "^4.15.0",
|
|
153
|
-
"@testing-library/dom": "^10.4.1",
|
|
154
|
-
"@testing-library/react": "^16.3.2",
|
|
155
|
-
"@types/react": "^19.0.0",
|
|
156
|
-
"@types/react-dom": "^19.0.0",
|
|
157
|
-
"@xyflow/react": "^12.4.0",
|
|
158
|
-
"ai": "^7.0.31",
|
|
159
|
-
"clsx": "^2.1.0",
|
|
160
|
-
"eslint": "^10.8.0",
|
|
161
|
-
"eslint-plugin-react-hooks": "^7.1.1",
|
|
162
|
-
"jsdom": "^29.1.1",
|
|
163
|
-
"react": "^19.0.0",
|
|
164
|
-
"react-dom": "^19.0.0",
|
|
165
|
-
"tsup": "^8.0.0",
|
|
166
|
-
"typescript": "^5.7.0",
|
|
167
|
-
"typescript-eslint": "^8.65.0",
|
|
168
|
-
"vitest": "^3.2.6",
|
|
169
|
-
"zod": "^4.4.3"
|
|
170
|
-
},
|
|
171
|
-
"publishConfig": {
|
|
172
|
-
"access": "public"
|
|
173
|
-
},
|
|
174
|
-
"license": "MIT",
|
|
175
|
-
"sideEffects": [
|
|
176
|
-
"**/*.css"
|
|
177
|
-
],
|
|
178
|
-
"overrides": {
|
|
179
|
-
"esbuild": "^0.28.1"
|
|
180
|
-
},
|
|
181
|
-
"peerDependenciesMeta": {
|
|
182
|
-
"@particle-academy/fancy-cms-ui": {
|
|
183
|
-
"optional": true
|
|
184
|
-
},
|
|
185
|
-
"@particle-academy/react-fancy": {
|
|
186
|
-
"optional": true
|
|
187
|
-
},
|
|
188
|
-
"ai": {
|
|
189
|
-
"optional": true
|
|
181
|
+
"peerDependenciesMeta": {
|
|
182
|
+
"@particle-academy/fancy-cms-ui": {
|
|
183
|
+
"optional": true
|
|
184
|
+
},
|
|
185
|
+
"@particle-academy/react-fancy": {
|
|
186
|
+
"optional": true
|
|
187
|
+
},
|
|
188
|
+
"ai": {
|
|
189
|
+
"optional": true
|
|
190
|
+
}
|
|
190
191
|
}
|
|
191
|
-
}
|
|
192
192
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/registry/registry.ts"],"names":[],"mappings":";AAEA,IAAM,KAAA,uBAAY,GAAA,EAA+C;AAEjE,IAAM,OAAA,uBAAc,GAAA,EAAoB;AACxC,IAAM,SAAA,uBAAgB,GAAA,EAAgB;AAY/B,SAAS,iBACd,UAAA,EACY;AACZ,EAAA,KAAA,CAAM,GAAA,CAAI,UAAA,CAAW,IAAA,EAAM,UAA+C,CAAA;AAC1E,EAAA,KAAA,MAAW,KAAA,IAAS,WAAW,OAAA,IAAW,IAAI,OAAA,CAAQ,GAAA,CAAI,KAAA,EAAO,UAAA,CAAW,IAAI,CAAA;AAChF,EAAA,MAAA,EAAO;AACP,EAAA,OAAO,MAAM;AACX,IAAA,IAAI,KAAA,CAAM,GAAA,CAAI,UAAA,CAAW,IAAI,MAAO,UAAA,EAAoB;AACtD,MAAA,KAAA,CAAM,MAAA,CAAO,WAAW,IAAI,CAAA;AAC5B,MAAA,KAAA,MAAW,KAAA,IAAS,UAAA,CAAW,OAAA,IAAW,EAAC,EAAG;AAC5C,QAAA,IAAI,OAAA,CAAQ,IAAI,KAAK,CAAA,KAAM,WAAW,IAAA,EAAM,OAAA,CAAQ,OAAO,KAAK,CAAA;AAAA,MAClE;AACA,MAAA,MAAA,EAAO;AAAA,IACT;AAAA,EACF,CAAA;AACF;AAUO,SAAS,cAAc,EAAA,EAA2B;AACvD,EAAA,IAAI,KAAA,CAAM,GAAA,CAAI,E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AAA;AAAA,IACvB,KAAK,IAAA;AAAW,MAAA,OAAO,SAAA;AAAA,IACvB,KAAK,IAAA;AAAW,MAAA,OAAO,SAAA;AAAA,IACvB,KAAK,OAAA;AAAW,MAAA,OAAO,SAAA;AAAA,IACvB,KAAK,QAAA;AAAW,MAAA,OAAO,SAAA;AAAA,IACvB,KAAK,QAAA;AAAW,MAAA,OAAO,SAAA;AAAA,IACvB,KAAK,YAAA;AAAc,MAAA,OAAO,SAAA;AAAA,IAC1B;AAAgB,MAAA,OAAO,SAAA;AAAA;AAE3B","file":"chunk-Q6IPK64P.js","sourcesContent":["import type { ConfigField, NodeKindDefinition } from \"./types\";\n\nconst kinds = new Map<string, NodeKindDefinition<any, any, any>>();\n/** alias → canonical name. See `resolveKindId`. */\nconst aliases = new Map<string, string>();\nconst listeners = new Set<() => void>();\n\n/**\n * registerNodeKind — install a node kind in the global registry. Returns\n * an `unregister` function. Calling with the same name replaces the prior\n * registration (handy for HMR).\n *\n * A kind's `name` is its CANONICAL id and is what gets written into saved\n * documents. Publish namespaced (`@fancy/llm_branch`, `@acme/salesforce_upsert`)\n * and list any previous bare names in `aliases`, so graphs saved before the\n * rename keep resolving.\n */\nexport function registerNodeKind<TC = any, TI = any, TO = any>(\n definition: NodeKindDefinition<TC, TI, TO>,\n): () => void {\n kinds.set(definition.name, definition as NodeKindDefinition<any, any, any>);\n for (const alias of definition.aliases ?? []) aliases.set(alias, definition.name);\n notify();\n return () => {\n if (kinds.get(definition.name) === (definition as any)) {\n kinds.delete(definition.name);\n for (const alias of definition.aliases ?? []) {\n if (aliases.get(alias) === definition.name) aliases.delete(alias);\n }\n notify();\n }\n };\n}\n\n/**\n * Resolve any id — canonical or alias — to the canonical one, or null.\n *\n * `kind` is persisted inside every saved graph, so a bare name that two\n * packages could both claim is unfixable after the fact: the ambiguous string\n * is already in the document. Canonical ids are namespaced; aliases exist so\n * documents written before namespacing keep opening.\n */\nexport function resolveKindId(id: string): string | null {\n if (kinds.has(id)) return id;\n const canonical = aliases.get(id);\n return canonical && kinds.has(canonical) ? canonical : null;\n}\n\n/** Get a single kind by canonical id or alias, or null. */\nexport function getNodeKind(name: string): NodeKindDefinition | null {\n const canonical = resolveKindId(name);\n return canonical ? ((kinds.get(canonical) as NodeKindDefinition) ?? null) : null;\n}\n\n/** Every id a kind answers to — canonical first. Used to key node-type maps. */\nexport function kindIds(kind: NodeKindDefinition): string[] {\n return [kind.name, ...(kind.aliases ?? [])];\n}\n\n/** List every registered kind, optionally filtered by category. */\nexport function listNodeKinds(category?: string): NodeKindDefinition[] {\n const all = Array.from(kinds.values()) as NodeKindDefinition[];\n return category ? all.filter((k) => k.category === category) : all;\n}\n\n/** Subscribe to registry changes. Returns an unsubscribe function. */\nexport function onNodeKindsChanged(listener: () => void): () => void {\n listeners.add(listener);\n return () => listeners.delete(listener);\n}\n\nfunction notify(): void {\n for (const l of listeners) l();\n}\n\n/** Fill in defaults from a kind's configSchema for newly-created nodes. */\nexport function defaultConfigFor(kind: NodeKindDefinition): Record<string, unknown> {\n const fromKind = kind.defaultConfig ? { ...(kind.defaultConfig as Record<string, unknown>) } : {};\n for (const field of kind.configSchema ?? []) {\n if (fromKind[field.key] !== undefined) continue;\n if (\"default\" in field && (field as any).default !== undefined) {\n fromKind[field.key] = (field as any).default;\n }\n }\n return fromKind;\n}\n\n/**\n * Validate a config object against a kind's schema. Returns an array of\n * issues (empty = valid). Validation is intentionally light — type\n * coercion + required-field checks. Hosts can layer Zod / Ajv on top.\n */\nexport function validateConfig(\n kind: NodeKindDefinition,\n config: Record<string, unknown>,\n): Array<{ key: string; message: string }> {\n const issues: Array<{ key: string; message: string }> = [];\n for (const field of kind.configSchema ?? []) {\n const value = config[field.key];\n if (field.required && (value === undefined || value === null || value === \"\")) {\n issues.push({ key: field.key, message: `${field.label} is required` });\n continue;\n }\n if (value === undefined || value === null) continue;\n const issue = validateField(field, value);\n if (issue) issues.push({ key: field.key, message: issue });\n }\n return issues;\n}\n\nfunction validateField(field: ConfigField, value: unknown): string | null {\n switch (field.type) {\n case \"text\":\n case \"textarea\":\n case \"expression\":\n case \"credential\":\n return typeof value === \"string\" ? null : `${field.label} must be a string`;\n case \"number\": {\n if (typeof value !== \"number\" || !Number.isFinite(value)) return `${field.label} must be a number`;\n if (field.min !== undefined && value < field.min) return `${field.label} must be >= ${field.min}`;\n if (field.max !== undefined && value > field.max) return `${field.label} must be <= ${field.max}`;\n return null;\n }\n case \"switch\":\n return typeof value === \"boolean\" ? null : `${field.label} must be a boolean`;\n case \"select\": {\n const allowed = field.options.map((o) => o.value);\n return allowed.includes(String(value)) ? null : `${field.label} must be one of ${allowed.join(\", \")}`;\n }\n case \"json\":\n return null; // permissive — just JSON-shaped\n case \"repeater\": {\n if (!Array.isArray(value)) return `${field.label} must be a list`;\n if (field.minItems !== undefined && value.length < field.minItems) {\n return `${field.label} needs at least ${field.minItems}`;\n }\n if (field.maxItems !== undefined && value.length > field.maxItems) {\n return `${field.label} allows at most ${field.maxItems}`;\n }\n // Surface the first offending row so the author knows WHICH one.\n for (let i = 0; i < value.length; i++) {\n const row = value[i];\n if (!row || typeof row !== \"object\" || Array.isArray(row)) {\n return `${field.label} item ${i + 1} must be an object`;\n }\n for (const sub of field.fields) {\n const cell = (row as Record<string, unknown>)[sub.key];\n if (sub.required && (cell === undefined || cell === null || cell === \"\")) {\n return `${field.label} item ${i + 1}: ${sub.label} is required`;\n }\n if (cell === undefined || cell === null) continue;\n const issue = validateField(sub, cell);\n if (issue) return `${field.label} item ${i + 1}: ${issue}`;\n }\n }\n return null;\n }\n case \"keyvalue\": {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return `${field.label} must be a key/value map`;\n }\n const allowed = field.valueOptions?.map((o) => o.value);\n for (const [k, v] of Object.entries(value as Record<string, unknown>)) {\n if (typeof v !== \"string\") return `${field.label}: \"${k}\" must be a string`;\n if (allowed && !allowed.includes(v)) {\n return `${field.label}: \"${k}\" must be one of ${allowed.join(\", \")}`;\n }\n }\n return null;\n }\n case \"document\":\n return null; // opaque to fancy-flow — the host's editor owns its shape\n default:\n return null;\n }\n}\n\n/** Default accents per category. */\nexport function categoryAccent(category: string): string {\n switch (category) {\n case \"trigger\": return \"#10b981\";\n case \"logic\": return \"#f59e0b\";\n case \"data\": return \"#0ea5e9\";\n case \"ai\": return \"#8b5cf6\";\n case \"io\": return \"#3b82f6\";\n case \"human\": return \"#ec4899\";\n case \"output\": return \"#a855f7\";\n case \"layout\": return \"#64748b\";\n case \"annotation\": return \"#eab308\";\n default: return \"#71717a\";\n }\n}\n"]}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { N as NodeKindDefinition } from './types-Bj_ZHwqG.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* registerNodeKind — install a node kind in the global registry. Returns
|
|
5
|
-
* an `unregister` function. Calling with the same name replaces the prior
|
|
6
|
-
* registration (handy for HMR).
|
|
7
|
-
*
|
|
8
|
-
* A kind's `name` is its CANONICAL id and is what gets written into saved
|
|
9
|
-
* documents. Publish namespaced (`@fancy/llm_branch`, `@acme/salesforce_upsert`)
|
|
10
|
-
* and list any previous bare names in `aliases`, so graphs saved before the
|
|
11
|
-
* rename keep resolving.
|
|
12
|
-
*/
|
|
13
|
-
declare function registerNodeKind<TC = any, TI = any, TO = any>(definition: NodeKindDefinition<TC, TI, TO>): () => void;
|
|
14
|
-
/**
|
|
15
|
-
* Resolve any id — canonical or alias — to the canonical one, or null.
|
|
16
|
-
*
|
|
17
|
-
* `kind` is persisted inside every saved graph, so a bare name that two
|
|
18
|
-
* packages could both claim is unfixable after the fact: the ambiguous string
|
|
19
|
-
* is already in the document. Canonical ids are namespaced; aliases exist so
|
|
20
|
-
* documents written before namespacing keep opening.
|
|
21
|
-
*/
|
|
22
|
-
declare function resolveKindId(id: string): string | null;
|
|
23
|
-
/** Get a single kind by canonical id or alias, or null. */
|
|
24
|
-
declare function getNodeKind(name: string): NodeKindDefinition | null;
|
|
25
|
-
/** Every id a kind answers to — canonical first. Used to key node-type maps. */
|
|
26
|
-
declare function kindIds(kind: NodeKindDefinition): string[];
|
|
27
|
-
/** List every registered kind, optionally filtered by category. */
|
|
28
|
-
declare function listNodeKinds(category?: string): NodeKindDefinition[];
|
|
29
|
-
/** Subscribe to registry changes. Returns an unsubscribe function. */
|
|
30
|
-
declare function onNodeKindsChanged(listener: () => void): () => void;
|
|
31
|
-
/** Fill in defaults from a kind's configSchema for newly-created nodes. */
|
|
32
|
-
declare function defaultConfigFor(kind: NodeKindDefinition): Record<string, unknown>;
|
|
33
|
-
/**
|
|
34
|
-
* Validate a config object against a kind's schema. Returns an array of
|
|
35
|
-
* issues (empty = valid). Validation is intentionally light — type
|
|
36
|
-
* coercion + required-field checks. Hosts can layer Zod / Ajv on top.
|
|
37
|
-
*/
|
|
38
|
-
declare function validateConfig(kind: NodeKindDefinition, config: Record<string, unknown>): Array<{
|
|
39
|
-
key: string;
|
|
40
|
-
message: string;
|
|
41
|
-
}>;
|
|
42
|
-
/** Default accents per category. */
|
|
43
|
-
declare function categoryAccent(category: string): string;
|
|
44
|
-
|
|
45
|
-
export { resolveKindId as a, categoryAccent as c, defaultConfigFor as d, getNodeKind as g, kindIds as k, listNodeKinds as l, onNodeKindsChanged as o, registerNodeKind as r, validateConfig as v };
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { N as NodeKindDefinition } from './types-DEmDSByY.cjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* registerNodeKind — install a node kind in the global registry. Returns
|
|
5
|
-
* an `unregister` function. Calling with the same name replaces the prior
|
|
6
|
-
* registration (handy for HMR).
|
|
7
|
-
*
|
|
8
|
-
* A kind's `name` is its CANONICAL id and is what gets written into saved
|
|
9
|
-
* documents. Publish namespaced (`@fancy/llm_branch`, `@acme/salesforce_upsert`)
|
|
10
|
-
* and list any previous bare names in `aliases`, so graphs saved before the
|
|
11
|
-
* rename keep resolving.
|
|
12
|
-
*/
|
|
13
|
-
declare function registerNodeKind<TC = any, TI = any, TO = any>(definition: NodeKindDefinition<TC, TI, TO>): () => void;
|
|
14
|
-
/**
|
|
15
|
-
* Resolve any id — canonical or alias — to the canonical one, or null.
|
|
16
|
-
*
|
|
17
|
-
* `kind` is persisted inside every saved graph, so a bare name that two
|
|
18
|
-
* packages could both claim is unfixable after the fact: the ambiguous string
|
|
19
|
-
* is already in the document. Canonical ids are namespaced; aliases exist so
|
|
20
|
-
* documents written before namespacing keep opening.
|
|
21
|
-
*/
|
|
22
|
-
declare function resolveKindId(id: string): string | null;
|
|
23
|
-
/** Get a single kind by canonical id or alias, or null. */
|
|
24
|
-
declare function getNodeKind(name: string): NodeKindDefinition | null;
|
|
25
|
-
/** Every id a kind answers to — canonical first. Used to key node-type maps. */
|
|
26
|
-
declare function kindIds(kind: NodeKindDefinition): string[];
|
|
27
|
-
/** List every registered kind, optionally filtered by category. */
|
|
28
|
-
declare function listNodeKinds(category?: string): NodeKindDefinition[];
|
|
29
|
-
/** Subscribe to registry changes. Returns an unsubscribe function. */
|
|
30
|
-
declare function onNodeKindsChanged(listener: () => void): () => void;
|
|
31
|
-
/** Fill in defaults from a kind's configSchema for newly-created nodes. */
|
|
32
|
-
declare function defaultConfigFor(kind: NodeKindDefinition): Record<string, unknown>;
|
|
33
|
-
/**
|
|
34
|
-
* Validate a config object against a kind's schema. Returns an array of
|
|
35
|
-
* issues (empty = valid). Validation is intentionally light — type
|
|
36
|
-
* coercion + required-field checks. Hosts can layer Zod / Ajv on top.
|
|
37
|
-
*/
|
|
38
|
-
declare function validateConfig(kind: NodeKindDefinition, config: Record<string, unknown>): Array<{
|
|
39
|
-
key: string;
|
|
40
|
-
message: string;
|
|
41
|
-
}>;
|
|
42
|
-
/** Default accents per category. */
|
|
43
|
-
declare function categoryAccent(category: string): string;
|
|
44
|
-
|
|
45
|
-
export { resolveKindId as a, categoryAccent as c, defaultConfigFor as d, getNodeKind as g, kindIds as k, listNodeKinds as l, onNodeKindsChanged as o, registerNodeKind as r, validateConfig as v };
|