@particle-academy/fancy-flow 0.76.0 → 0.77.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/{chunk-ZKAPSUTL.js → chunk-2VI24UPB.js} +3 -3
  2. package/dist/{chunk-ZKAPSUTL.js.map → chunk-2VI24UPB.js.map} +1 -1
  3. package/dist/{chunk-PXVISCSC.js → chunk-ARSOSEJV.js} +4 -4
  4. package/dist/{chunk-PXVISCSC.js.map → chunk-ARSOSEJV.js.map} +1 -1
  5. package/dist/{chunk-G4GKDJG5.js → chunk-CQAMEPPI.js} +3 -3
  6. package/dist/{chunk-G4GKDJG5.js.map → chunk-CQAMEPPI.js.map} +1 -1
  7. package/dist/{chunk-V2657EQG.js → chunk-EEIWAIXW.js} +45 -5
  8. package/dist/chunk-EEIWAIXW.js.map +1 -0
  9. package/dist/{chunk-4KYW5BT4.js → chunk-EGXA4SYJ.js} +4 -4
  10. package/dist/{chunk-4KYW5BT4.js.map → chunk-EGXA4SYJ.js.map} +1 -1
  11. package/dist/{chunk-CYVVUKHH.js → chunk-G5RAGPVD.js} +3 -3
  12. package/dist/{chunk-CYVVUKHH.js.map → chunk-G5RAGPVD.js.map} +1 -1
  13. package/dist/{chunk-M34S7XUM.js → chunk-T6WIIGSK.js} +3 -3
  14. package/dist/{chunk-M34S7XUM.js.map → chunk-T6WIIGSK.js.map} +1 -1
  15. package/dist/durable.cjs +39 -35
  16. package/dist/durable.cjs.map +1 -1
  17. package/dist/durable.js +1 -2
  18. package/dist/durable.js.map +1 -1
  19. package/dist/engine.cjs +42 -38
  20. package/dist/engine.cjs.map +1 -1
  21. package/dist/engine.js +4 -6
  22. package/dist/engine.js.map +1 -1
  23. package/dist/index.cjs +42 -38
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.js +12 -13
  26. package/dist/index.js.map +1 -1
  27. package/dist/registry.cjs +42 -38
  28. package/dist/registry.cjs.map +1 -1
  29. package/dist/registry.js +2 -3
  30. package/dist/runtime.cjs +32 -2
  31. package/dist/runtime.cjs.map +1 -1
  32. package/dist/runtime.js +3 -3
  33. package/dist/schema.cjs +32 -2
  34. package/dist/schema.cjs.map +1 -1
  35. package/dist/schema.js +3 -3
  36. package/dist/screens.cjs +32 -2
  37. package/dist/screens.cjs.map +1 -1
  38. package/dist/screens.js +4 -5
  39. package/dist/screens.js.map +1 -1
  40. package/dist/ux.cjs +32 -2
  41. package/dist/ux.cjs.map +1 -1
  42. package/dist/ux.js +1 -1
  43. package/package.json +1 -1
  44. package/dist/chunk-UEOE6B52.js +0 -39
  45. package/dist/chunk-UEOE6B52.js.map +0 -1
  46. package/dist/chunk-V2657EQG.js.map +0 -1
package/dist/ux.js CHANGED
@@ -1,4 +1,4 @@
1
- import { registerNodeKind } from './chunk-V2657EQG.js';
1
+ import { registerNodeKind } from './chunk-EEIWAIXW.js';
2
2
  import './chunk-2QXKDLGT.js';
3
3
  import { useMemo } from 'react';
4
4
  import { createEffectDispatcher } from '@particle-academy/fancy-auto-common';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@particle-academy/fancy-flow",
3
- "version": "0.76.0",
3
+ "version": "0.77.1",
4
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
5
  "repository": {
6
6
  "type": "git",
@@ -1,39 +0,0 @@
1
- // src/registry/pause.ts
2
- var PAUSE_PREFIX = "fancy-flow:pause:";
3
- var LEGACY_PAUSE_PREFIXES = [
4
- ["awaiting-approval:", "approval"],
5
- ["awaiting-input:", "input"]
6
- ];
7
- function encodePause(signal) {
8
- const { nodeId, awaiting, detail } = signal;
9
- return PAUSE_PREFIX + JSON.stringify(detail === void 0 ? { nodeId, awaiting } : { nodeId, awaiting, detail });
10
- }
11
- function decodePause(reason) {
12
- if (typeof reason !== "string") return null;
13
- if (reason.startsWith(PAUSE_PREFIX)) {
14
- const body = reason.slice(PAUSE_PREFIX.length);
15
- try {
16
- const parsed = JSON.parse(body);
17
- if (typeof parsed?.nodeId !== "string" || typeof parsed?.awaiting !== "string") return null;
18
- return "detail" in parsed ? { nodeId: parsed.nodeId, awaiting: parsed.awaiting, detail: parsed.detail } : { nodeId: parsed.nodeId, awaiting: parsed.awaiting };
19
- } catch {
20
- return null;
21
- }
22
- }
23
- for (const [prefix, awaiting] of LEGACY_PAUSE_PREFIXES) {
24
- if (reason.startsWith(prefix)) {
25
- return { nodeId: reason.slice(prefix.length), awaiting };
26
- }
27
- }
28
- return null;
29
- }
30
- function isPause(reason) {
31
- return decodePause(reason) !== null;
32
- }
33
- function pauseForHuman(ctx, awaiting, detail) {
34
- return ctx.abort(encodePause({ nodeId: ctx.node.id, awaiting, detail }));
35
- }
36
-
37
- export { LEGACY_PAUSE_PREFIXES, PAUSE_PREFIX, decodePause, encodePause, isPause, pauseForHuman };
38
- //# sourceMappingURL=chunk-UEOE6B52.js.map
39
- //# sourceMappingURL=chunk-UEOE6B52.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/registry/pause.ts"],"names":[],"mappings":";AA8CO,IAAM,YAAA,GAAe;AAUrB,IAAM,qBAAA,GAAyE;AAAA,EACpF,CAAC,sBAAsB,UAAU,CAAA;AAAA,EACjC,CAAC,mBAAmB,OAAO;AAC7B;AASO,SAAS,YAAY,MAAA,EAA6B;AACvD,EAAA,MAAM,EAAE,MAAA,EAAQ,QAAA,EAAU,MAAA,EAAO,GAAI,MAAA;AACrC,EAAA,OAAO,YAAA,GAAe,IAAA,CAAK,SAAA,CAAU,MAAA,KAAW,MAAA,GAAY,EAAE,MAAA,EAAQ,QAAA,EAAS,GAAI,EAAE,MAAA,EAAQ,QAAA,EAAU,QAAQ,CAAA;AACjH;AAUO,SAAS,YAAY,MAAA,EAAuD;AACjF,EAAA,IAAI,OAAO,MAAA,KAAW,QAAA,EAAU,OAAO,IAAA;AAEvC,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*\n * A workflow that waits for a person is not an error, but it travels the same\n * channel as one: the executor aborts, the engine records a reason string, and\n * the durable runner decides whether that string meant \"failed\" or \"waiting\".\n *\n * That seam existed before this module, as two `str_starts_with` checks in the\n * Laravel run job against constants owned by two BUILTIN executors. It worked,\n * and it was invisible: a third-party human-input node had no way to announce\n * that it pauses, and nothing stopped a refactor from removing the mechanism\n * out from under published packages. Reported by the MOIC Suite consumer, who\n * needed exactly that and had to reach for a private constant to get it.\n *\n * So the encoding is now public, typed, and versioned by prefix rather than\n * implied. The wire format stays a plain string on purpose — it survives the\n * existing abort → `RunResult.error` path unchanged, crosses a queue boundary,\n * and decodes identically in PHP, none of which a thrown class would do.\n *\n * @see decodePause — the one function a durable runner needs.\n */\n\n/**\n * What the run is waiting for.\n *\n * `approval` and `input` are the shapes both runtimes ship. The type stays open\n * because the whole point is that a marketplace node can define its own —\n * a signature step, a payment confirmation, a review queue — and a runner that\n * does not recognise one should report it rather than guess.\n */\nexport type PauseAwaiting = \"approval\" | \"input\" | (string & {});\n\n/** A run halted, waiting for a person. */\nexport type PauseSignal = {\n /** The node that paused — where a submission gets injected on resume. */\n nodeId: string;\n awaiting: PauseAwaiting;\n /**\n * Kind-supplied context for whoever renders the wait — a form schema, the\n * question being asked, a diff to approve. Must be JSON-serializable: it\n * crosses a queue boundary and, for durable runs, a database column.\n */\n detail?: unknown;\n};\n\n/** Marks a reason string as a pause rather than a failure. */\nexport const PAUSE_PREFIX = \"fancy-flow:pause:\";\n\n/**\n * Reason prefixes shipped before this contract, kept decodable forever.\n *\n * These are what `DurableApprovalExecutor` and `DurableUserInputExecutor`\n * emitted, and they are written into the `error` column of every run that\n * paused under an older version. Dropping them would strand those runs\n * mid-flight — a resume path that only works for new runs is not a resume path.\n */\nexport const LEGACY_PAUSE_PREFIXES: ReadonlyArray<readonly [string, PauseAwaiting]> = [\n [\"awaiting-approval:\", \"approval\"],\n [\"awaiting-input:\", \"input\"],\n];\n\n/**\n * Encode a pause as the reason string an executor aborts with.\n *\n * The payload is JSON rather than delimited fields because a node id may\n * contain a colon, and a positional encoding that breaks on user data is the\n * kind of bug that only shows up in someone else's graph.\n */\nexport function encodePause(signal: PauseSignal): string {\n const { nodeId, awaiting, detail } = signal;\n return PAUSE_PREFIX + JSON.stringify(detail === undefined ? { nodeId, awaiting } : { nodeId, awaiting, detail });\n}\n\n/**\n * Decode a run's error reason into a pause, or null if it was a real failure.\n *\n * This is the whole contract from a runner's side: call it on `result.error`,\n * and if it returns non-null, persist the run as waiting on `signal.nodeId`\n * instead of failing it. Accepts the legacy prefixes, so a runner written\n * against this handles runs that paused under an older version.\n */\nexport function decodePause(reason: string | null | undefined): PauseSignal | null {\n if (typeof reason !== \"string\") return null;\n\n if (reason.startsWith(PAUSE_PREFIX)) {\n const body = reason.slice(PAUSE_PREFIX.length);\n try {\n const parsed = JSON.parse(body) as Partial<PauseSignal>;\n // A malformed payload is a corrupt pause, not a failure to report as a\n // crash — but it is also not something to invent a node id for.\n if (typeof parsed?.nodeId !== \"string\" || typeof parsed?.awaiting !== \"string\") return null;\n return \"detail\" in parsed\n ? { nodeId: parsed.nodeId, awaiting: parsed.awaiting, detail: parsed.detail }\n : { nodeId: parsed.nodeId, awaiting: parsed.awaiting };\n } catch {\n return null;\n }\n }\n\n for (const [prefix, awaiting] of LEGACY_PAUSE_PREFIXES) {\n if (reason.startsWith(prefix)) {\n return { nodeId: reason.slice(prefix.length), awaiting };\n }\n }\n\n return null;\n}\n\n/** True when a run's error reason is actually a pause. */\nexport function isPause(reason: string | null | undefined): boolean {\n return decodePause(reason) !== null;\n}\n\n/**\n * Abort the current node as a pause.\n *\n * Called from inside an executor with its own context. Node authors should\n * reach for this rather than hand-encoding a reason, so the format stays ours\n * to change:\n *\n * ```ts\n * const values = ctx.inputs.values;\n * if (values === undefined) pauseForHuman(ctx, \"input\", { fields });\n * return values;\n * ```\n *\n * Note the `undefined` check — an empty submission (`{}`) is a real answer and\n * must resume. Truthiness here pauses forever on an empty form.\n */\nexport function pauseForHuman(\n ctx: { node: { id: string }; abort: (reason?: string) => never },\n awaiting: PauseAwaiting,\n detail?: unknown,\n): never {\n return ctx.abort(encodePause({ nodeId: ctx.node.id, awaiting, detail }));\n}\n"]}