@particle-academy/fancy-flow 0.15.1 → 0.16.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/index.cjs CHANGED
@@ -217,6 +217,9 @@ var llmClient = null;
217
217
  function getLlmClient() {
218
218
  return llmClient;
219
219
  }
220
+ function isResolutionFailure(value) {
221
+ return typeof value === "object" && value !== null && "reason" in value && value.reason !== void 0;
222
+ }
220
223
  var workflowResolver = null;
221
224
  function getWorkflowResolver() {
222
225
  return workflowResolver;
@@ -465,7 +468,14 @@ var subflowExecutor = async (ctx) => {
465
468
  `subflow depth limit reached (${maxDepth}) at "${ref}" \u2014 a workflow is referencing itself, directly or through a chain.`
466
469
  );
467
470
  }
468
- const child = await resolver(ref);
471
+ const pinned = config.version === void 0 || config.version === "" ? void 0 : Number(config.version);
472
+ if (pinned !== void 0 && !Number.isInteger(pinned)) {
473
+ ctx.abort(`subflow "${ref}" has a non-integer version pin (${String(config.version)}).`);
474
+ }
475
+ const resolved = await resolver(ref, pinned);
476
+ const child = isResolutionFailure(resolved) ? ctx.abort(
477
+ resolved.reason === "version-mismatch" ? resolved.message ?? `subflow "${ref}" is pinned to version ${pinned}, but the host has ${resolved.available ?? "a different version"}.` : resolved.message ?? `subflow could not resolve workflow "${ref}"`
478
+ ) : resolved;
469
479
  if (!child) ctx.abort(`subflow could not resolve workflow "${ref}"`);
470
480
  const mode = subflowMode(config);
471
481
  const streaming = mode === "stream" || mode === "both";
@@ -689,6 +699,12 @@ var KINDS = [
689
699
  placeholder: "onboarding-v2",
690
700
  description: "Reference resolved by the host's registerWorkflowResolver()."
691
701
  },
702
+ {
703
+ type: "number",
704
+ key: "version",
705
+ label: "Pin to version",
706
+ description: "Optional. Leave blank to always run the child's current version. Pinning fails the run loudly if the child has moved on \u2014 without it, someone edits the child and this flow silently runs different logic."
707
+ },
692
708
  {
693
709
  type: "select",
694
710
  key: "mode",