@particle-academy/fancy-flow 0.55.0 → 0.57.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 (41) hide show
  1. package/dist/{chunk-KP4TBF3A.js → chunk-45SSUYW7.js} +3 -3
  2. package/dist/{chunk-KP4TBF3A.js.map → chunk-45SSUYW7.js.map} +1 -1
  3. package/dist/{chunk-L4QAAGLV.js → chunk-4X3DPRVD.js} +3 -3
  4. package/dist/{chunk-L4QAAGLV.js.map → chunk-4X3DPRVD.js.map} +1 -1
  5. package/dist/{chunk-YVLOLS25.js → chunk-E3XNFOLI.js} +20 -5
  6. package/dist/chunk-E3XNFOLI.js.map +1 -0
  7. package/dist/{chunk-22OJOD4X.js → chunk-LTUOAFQA.js} +27 -2
  8. package/dist/chunk-LTUOAFQA.js.map +1 -0
  9. package/dist/{chunk-E3AGYTHP.js → chunk-LUXQXJ4R.js} +3 -3
  10. package/dist/{chunk-E3AGYTHP.js.map → chunk-LUXQXJ4R.js.map} +1 -1
  11. package/dist/{chunk-HMEI2LFU.js → chunk-UBXRIK5R.js} +4 -4
  12. package/dist/{chunk-HMEI2LFU.js.map → chunk-UBXRIK5R.js.map} +1 -1
  13. package/dist/durable.cjs +25 -0
  14. package/dist/durable.cjs.map +1 -1
  15. package/dist/durable.js +1 -1
  16. package/dist/engine.cjs +25 -0
  17. package/dist/engine.cjs.map +1 -1
  18. package/dist/engine.js +3 -3
  19. package/dist/index.cjs +42 -2
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.js +11 -11
  22. package/dist/registry.cjs +25 -0
  23. package/dist/registry.cjs.map +1 -1
  24. package/dist/registry.js +2 -2
  25. package/dist/runtime.cjs +25 -0
  26. package/dist/runtime.cjs.map +1 -1
  27. package/dist/runtime.js +3 -3
  28. package/dist/schema/index.d.cts +29 -5
  29. package/dist/schema/index.d.ts +29 -5
  30. package/dist/schema.cjs +42 -2
  31. package/dist/schema.cjs.map +1 -1
  32. package/dist/schema.js +2 -2
  33. package/dist/screens.cjs +25 -0
  34. package/dist/screens.cjs.map +1 -1
  35. package/dist/screens.js +4 -4
  36. package/dist/ux.cjs +25 -0
  37. package/dist/ux.cjs.map +1 -1
  38. package/dist/ux.js +1 -1
  39. package/package.json +1 -1
  40. package/dist/chunk-22OJOD4X.js.map +0 -1
  41. package/dist/chunk-YVLOLS25.js.map +0 -1
package/dist/runtime.js CHANGED
@@ -1,6 +1,6 @@
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';
1
+ export { applyOutputsToNodes, applyStatusesToNodes, createHistory, useFlowHistory, useFlowRun, useFlowState } from './chunk-4X3DPRVD.js';
2
+ export { runCohort } from './chunk-45SSUYW7.js';
3
+ export { RunIdentity, escapeSegment, runFlow } from './chunk-LTUOAFQA.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
@@ -10036,6 +10036,11 @@ var KINDS = [
10036
10036
  },
10037
10037
  {
10038
10038
  name: "@particle-academy/wait",
10039
+ outputShape: [
10040
+ { path: "waited", type: "string", description: "Which wait mode ran." },
10041
+ { path: "duration", type: "number", description: "How long it waited." },
10042
+ { path: "input", type: "unknown", description: "The value that arrived, carried forward." }
10043
+ ],
10039
10044
  aliases: ["wait", "@fancy/wait"],
10040
10045
  category: "logic",
10041
10046
  label: "Wait",
@@ -10233,6 +10238,11 @@ var KINDS = [
10233
10238
  },
10234
10239
  {
10235
10240
  name: "@particle-academy/llm_router",
10241
+ outputShape: [
10242
+ { path: "route", type: "string", description: "The port the model chose." },
10243
+ { path: "reason", type: "string", description: "Why the model chose it." },
10244
+ { path: "input", type: "unknown", description: "The value that arrived, carried forward." }
10245
+ ],
10236
10246
  // Every id this node has ever shipped under keeps resolving — MOIC's saved
10237
10247
  // flows carry the bare `llm_branch`.
10238
10248
  aliases: ["llm_router", "llm_branch", "@fancy/llm_branch", "@fancy/llm_router"],
@@ -10371,6 +10381,11 @@ var KINDS = [
10371
10381
  },
10372
10382
  {
10373
10383
  name: "@particle-academy/webhook_out",
10384
+ outputShape: [
10385
+ { path: "sent", type: "boolean", description: "True once the request was made." },
10386
+ { path: "status", type: "number", description: "HTTP status, when the transport reported one." },
10387
+ { path: "response", type: "unknown", description: "The response body, when there was one." }
10388
+ ],
10374
10389
  aliases: ["webhook_out", "@fancy/webhook_out"],
10375
10390
  category: "io",
10376
10391
  label: "Send Webhook",
@@ -10408,6 +10423,12 @@ var KINDS = [
10408
10423
  },
10409
10424
  {
10410
10425
  name: "@particle-academy/notify",
10426
+ outputShape: [
10427
+ { path: "sent", type: "boolean", description: "True once the message was handed to the channel." },
10428
+ { path: "channel", type: "string", description: "The channel it went to." },
10429
+ { path: "to", type: "string", description: "The recipient." },
10430
+ { path: "message", type: "string", description: "The rendered message." }
10431
+ ],
10411
10432
  aliases: ["notify", "@fancy/notify"],
10412
10433
  category: "human",
10413
10434
  label: "Notify",
@@ -10443,6 +10464,10 @@ var KINDS = [
10443
10464
  },
10444
10465
  {
10445
10466
  name: "@particle-academy/log",
10467
+ outputShape: [
10468
+ { path: "logged", type: "string", description: "The message that was written." },
10469
+ { path: "level", type: "string", description: "The level it was written at." }
10470
+ ],
10446
10471
  aliases: ["log", "@fancy/log"],
10447
10472
  category: "output",
10448
10473
  label: "Log",
@@ -10737,8 +10762,23 @@ function toSchemaEdge(e) {
10737
10762
  label: typeof e.label === "string" ? e.label : void 0
10738
10763
  };
10739
10764
  }
10740
- function migrateSchema(schema) {
10741
- return schema;
10765
+ var MIGRATIONS = {};
10766
+ function migrateSchema(schema, steps = MIGRATIONS) {
10767
+ if (!schema || typeof schema !== "object") return schema;
10768
+ const doc = schema;
10769
+ let version = doc.version;
10770
+ if (typeof version !== "number" || !Number.isInteger(version) || version >= WORKFLOW_SCHEMA_VERSION) {
10771
+ return schema;
10772
+ }
10773
+ let out = doc;
10774
+ while (version < WORKFLOW_SCHEMA_VERSION) {
10775
+ const step = steps[version];
10776
+ if (!step) return out;
10777
+ out = step(out);
10778
+ version += 1;
10779
+ out.version = version;
10780
+ }
10781
+ return out;
10742
10782
  }
10743
10783
  function importWorkflow(schema, options = {}) {
10744
10784
  const issues = [];