@particle-academy/fancy-flow 0.54.0 → 0.56.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/{chunk-CIBW5ATA.js → chunk-22OJOD4X.js} +7 -3
  2. package/dist/chunk-22OJOD4X.js.map +1 -0
  3. package/dist/{chunk-VWANLNL5.js → chunk-E3AGYTHP.js} +3 -3
  4. package/dist/{chunk-VWANLNL5.js.map → chunk-E3AGYTHP.js.map} +1 -1
  5. package/dist/{chunk-FH6MWLKD.js → chunk-GB4A7DFM.js} +20 -5
  6. package/dist/chunk-GB4A7DFM.js.map +1 -0
  7. package/dist/{chunk-FTGVVKWX.js → chunk-HMEI2LFU.js} +4 -4
  8. package/dist/{chunk-FTGVVKWX.js.map → chunk-HMEI2LFU.js.map} +1 -1
  9. package/dist/{chunk-WCFRKXH5.js → chunk-KP4TBF3A.js} +3 -3
  10. package/dist/{chunk-WCFRKXH5.js.map → chunk-KP4TBF3A.js.map} +1 -1
  11. package/dist/{chunk-FG3C7LIG.js → chunk-L4QAAGLV.js} +3 -3
  12. package/dist/{chunk-FG3C7LIG.js.map → chunk-L4QAAGLV.js.map} +1 -1
  13. package/dist/durable/index.d.cts +1 -1
  14. package/dist/durable/index.d.ts +1 -1
  15. package/dist/durable.cjs +5 -1
  16. package/dist/durable.cjs.map +1 -1
  17. package/dist/durable.js +1 -1
  18. package/dist/engine.cjs +5 -1
  19. package/dist/engine.cjs.map +1 -1
  20. package/dist/engine.d.cts +2 -2
  21. package/dist/engine.d.ts +2 -2
  22. package/dist/engine.js +3 -3
  23. package/dist/index.cjs +22 -3
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +2 -2
  26. package/dist/index.d.ts +2 -2
  27. package/dist/index.js +11 -11
  28. package/dist/registry.cjs +5 -1
  29. package/dist/registry.cjs.map +1 -1
  30. package/dist/registry.js +2 -2
  31. package/dist/{run-cohort-BPIOpE8A.d.ts → run-cohort-C1nRh_mi.d.ts} +1 -1
  32. package/dist/{run-cohort-r-L8dMED.d.cts → run-cohort-CBRAUj-z.d.cts} +1 -1
  33. package/dist/{run-flow-COdAOFg2.d.cts → run-flow-2XsHBwpd.d.cts} +31 -0
  34. package/dist/{run-flow-DJ7KYT6E.d.ts → run-flow-D7AOCcfE.d.ts} +31 -0
  35. package/dist/runtime/index.d.cts +3 -3
  36. package/dist/runtime/index.d.ts +3 -3
  37. package/dist/runtime.cjs +5 -1
  38. package/dist/runtime.cjs.map +1 -1
  39. package/dist/runtime.js +3 -3
  40. package/dist/schema/index.d.cts +29 -5
  41. package/dist/schema/index.d.ts +29 -5
  42. package/dist/schema.cjs +22 -3
  43. package/dist/schema.cjs.map +1 -1
  44. package/dist/schema.js +2 -2
  45. package/dist/screens.cjs +5 -1
  46. package/dist/screens.cjs.map +1 -1
  47. package/dist/screens.js +4 -4
  48. package/dist/ux.cjs +5 -1
  49. package/dist/ux.cjs.map +1 -1
  50. package/dist/ux.js +1 -1
  51. package/package.json +2 -2
  52. package/dist/chunk-CIBW5ATA.js.map +0 -1
  53. package/dist/chunk-FH6MWLKD.js.map +0 -1
package/dist/runtime.js CHANGED
@@ -1,6 +1,6 @@
1
- export { applyOutputsToNodes, applyStatusesToNodes, createHistory, useFlowHistory, useFlowRun, useFlowState } from './chunk-FG3C7LIG.js';
2
- export { runCohort } from './chunk-WCFRKXH5.js';
3
- export { RunIdentity, escapeSegment, runFlow } from './chunk-CIBW5ATA.js';
1
+ export { applyOutputsToNodes, applyStatusesToNodes, createHistory, useFlowHistory, useFlowRun, useFlowState } from './chunk-L4QAAGLV.js';
2
+ export { runCohort } from './chunk-KP4TBF3A.js';
3
+ export { RunIdentity, escapeSegment, runFlow } from './chunk-22OJOD4X.js';
4
4
  import './chunk-F5RPRB7A.js';
5
5
  import './chunk-USL4FMFU.js';
6
6
  //# sourceMappingURL=runtime.js.map
@@ -116,13 +116,37 @@ type ImportOptions = {
116
116
  * instead of errors. Default false. */
117
117
  lenient?: boolean;
118
118
  };
119
+ /** A migration step: takes a version-N document to version N+1. */
120
+ type MigrationStep = (schema: Record<string, unknown>) => Record<string, unknown>;
119
121
  /**
120
- * Migrate a raw schema object up to the current version. Additive changes need
121
- * no migration (an older document simply lacks the newer optional fields); this
122
- * is the seam for a future BREAKING bump add `case N N+1` steps here and
123
- * `importWorkflow` runs them before validating the version.
122
+ * Migrate a raw schema object up to the current version, as far as it can go.
123
+ *
124
+ * Additive changes need no migrationan older document simply lacks the newer
125
+ * optional fields. This is the seam for a future BREAKING bump, and
126
+ * `importWorkflow` runs it before validating the version.
127
+ *
128
+ * ## The three rules, each with a reason
129
+ *
130
+ * - **A PAST version migrates forward**, step by step, to the current one.
131
+ * - **A FUTURE version is left ALONE.** We cannot know what a later schema
132
+ * means, and migrating downward would be guessing. Untouched hands it to the
133
+ * version check, which reports it honestly.
134
+ * - **A GAP in the table is left alone too.** A missing step is not a licence
135
+ * to guess.
136
+ *
137
+ * ## Why `steps` is a parameter
138
+ *
139
+ * With only v1 in existence there is no old document to migrate, so a seam
140
+ * tested against the built-in (empty) table is a check that CANNOT fail — it
141
+ * would pass identically against a function that returned its input untouched,
142
+ * which is what this was until the twins needed the same seam.
143
+ *
144
+ * The PHP and Python runtimes carry the identical shape. That mattered more
145
+ * than it sounds: they had no migration at all and errored on any version
146
+ * mismatch, so a v2 bump would have made every stored Op unreadable on exactly
147
+ * the runtimes where durable runs resume.
124
148
  */
125
- declare function migrateSchema(schema: unknown): unknown;
149
+ declare function migrateSchema(schema: unknown, steps?: Record<number, MigrationStep>): unknown;
126
150
  /**
127
151
  * Hydrate a schema into runtime FlowGraph + validate kinds/configs against
128
152
  * the registry. Reports issues for unknown kinds, missing required config,
@@ -116,13 +116,37 @@ type ImportOptions = {
116
116
  * instead of errors. Default false. */
117
117
  lenient?: boolean;
118
118
  };
119
+ /** A migration step: takes a version-N document to version N+1. */
120
+ type MigrationStep = (schema: Record<string, unknown>) => Record<string, unknown>;
119
121
  /**
120
- * Migrate a raw schema object up to the current version. Additive changes need
121
- * no migration (an older document simply lacks the newer optional fields); this
122
- * is the seam for a future BREAKING bump add `case N N+1` steps here and
123
- * `importWorkflow` runs them before validating the version.
122
+ * Migrate a raw schema object up to the current version, as far as it can go.
123
+ *
124
+ * Additive changes need no migrationan older document simply lacks the newer
125
+ * optional fields. This is the seam for a future BREAKING bump, and
126
+ * `importWorkflow` runs it before validating the version.
127
+ *
128
+ * ## The three rules, each with a reason
129
+ *
130
+ * - **A PAST version migrates forward**, step by step, to the current one.
131
+ * - **A FUTURE version is left ALONE.** We cannot know what a later schema
132
+ * means, and migrating downward would be guessing. Untouched hands it to the
133
+ * version check, which reports it honestly.
134
+ * - **A GAP in the table is left alone too.** A missing step is not a licence
135
+ * to guess.
136
+ *
137
+ * ## Why `steps` is a parameter
138
+ *
139
+ * With only v1 in existence there is no old document to migrate, so a seam
140
+ * tested against the built-in (empty) table is a check that CANNOT fail — it
141
+ * would pass identically against a function that returned its input untouched,
142
+ * which is what this was until the twins needed the same seam.
143
+ *
144
+ * The PHP and Python runtimes carry the identical shape. That mattered more
145
+ * than it sounds: they had no migration at all and errored on any version
146
+ * mismatch, so a v2 bump would have made every stored Op unreadable on exactly
147
+ * the runtimes where durable runs resume.
124
148
  */
125
- declare function migrateSchema(schema: unknown): unknown;
149
+ declare function migrateSchema(schema: unknown, steps?: Record<number, MigrationStep>): unknown;
126
150
  /**
127
151
  * Hydrate a schema into runtime FlowGraph + validate kinds/configs against
128
152
  * the registry. Reports issues for unknown kinds, missing required config,
package/dist/schema.cjs CHANGED
@@ -9337,7 +9337,7 @@ function resolveWorkflowProps(declared, passed) {
9337
9337
  // src/runtime/run-flow.ts
9338
9338
  async function runFlow(graph, executors, onEvent = () => {
9339
9339
  }, options = {}) {
9340
- const { signal, initialInputs = {}, timeoutMs, depth = 0, resumeOutputs = {} } = options;
9340
+ const { signal, initialInputs = {}, timeoutMs, depth = 0, resumeOutputs = {}, entryNodes } = options;
9341
9341
  const run = options.run === void 0 ? void 0 : RunIdentity.from(options.run);
9342
9342
  const outputs = {};
9343
9343
  const portValues = /* @__PURE__ */ new Map();
@@ -9376,6 +9376,10 @@ async function runFlow(graph, executors, onEvent = () => {
9376
9376
  continue;
9377
9377
  }
9378
9378
  const incoming = incomingByNode.get(node.id) ?? [];
9379
+ if (incoming.length === 0 && entryNodes !== void 0 && !entryNodes.includes(node.id)) {
9380
+ onEvent({ type: "node-status", nodeId: node.id, status: "idle", text: "skipped" });
9381
+ continue;
9382
+ }
9379
9383
  if (incoming.length > 0) {
9380
9384
  const anyActive = incoming.some((e) => portValues.has(`${e.source}:${e.sourceHandle ?? "out"}`));
9381
9385
  if (!anyActive) {
@@ -10733,8 +10737,23 @@ function toSchemaEdge(e) {
10733
10737
  label: typeof e.label === "string" ? e.label : void 0
10734
10738
  };
10735
10739
  }
10736
- function migrateSchema(schema) {
10737
- return schema;
10740
+ var MIGRATIONS = {};
10741
+ function migrateSchema(schema, steps = MIGRATIONS) {
10742
+ if (!schema || typeof schema !== "object") return schema;
10743
+ const doc = schema;
10744
+ let version = doc.version;
10745
+ if (typeof version !== "number" || !Number.isInteger(version) || version >= WORKFLOW_SCHEMA_VERSION) {
10746
+ return schema;
10747
+ }
10748
+ let out = doc;
10749
+ while (version < WORKFLOW_SCHEMA_VERSION) {
10750
+ const step = steps[version];
10751
+ if (!step) return out;
10752
+ out = step(out);
10753
+ version += 1;
10754
+ out.version = version;
10755
+ }
10756
+ return out;
10738
10757
  }
10739
10758
  function importWorkflow(schema, options = {}) {
10740
10759
  const issues = [];