@ixo/editor 6.12.0 → 6.14.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.
@@ -549,6 +549,10 @@ function getAction(type) {
549
549
  function getAllActions() {
550
550
  return Array.from(actions.values());
551
551
  }
552
+ function isRepeatableAction(type) {
553
+ if (!type) return false;
554
+ return getAction(type)?.cardinality === "many";
555
+ }
552
556
  function getAliasEntries() {
553
557
  return Array.from(aliases.entries());
554
558
  }
@@ -12309,6 +12313,44 @@ async function executeActionBlock(params) {
12309
12313
  };
12310
12314
  }
12311
12315
 
12316
+ // src/core/lib/flowEngine/blockPhase.ts
12317
+ function deriveBlockPhase(params) {
12318
+ const { runtime, actionType, completionVerification, pendingInvocationCount = 0, runCount } = params;
12319
+ const repeatable = isRepeatableAction(actionType);
12320
+ const state = runtime?.state ?? "idle";
12321
+ const base = { repeatable, ...repeatable && runCount !== void 0 ? { runCount } : {} };
12322
+ if (state === "completed" && completionVerification?.status === "unverified") {
12323
+ return { ...base, phase: "failed", detail: "unverified", safeToRetry: false };
12324
+ }
12325
+ switch (state) {
12326
+ case "idle":
12327
+ if (pendingInvocationCount > 0) {
12328
+ return { ...base, phase: "active", detail: "queued", safeToRetry: true };
12329
+ }
12330
+ return { ...base, phase: "pending", detail: "idle", safeToRetry: true };
12331
+ case "running":
12332
+ return { ...base, phase: "active", detail: "running", safeToRetry: false };
12333
+ case "awaiting_readback":
12334
+ return { ...base, phase: "active", detail: "awaiting_readback", safeToRetry: false };
12335
+ case "completed":
12336
+ if (repeatable) {
12337
+ return { ...base, phase: "active", detail: "standing", safeToRetry: true };
12338
+ }
12339
+ return { ...base, phase: "complete", detail: "completed", safeToRetry: false };
12340
+ case "cancelled":
12341
+ return { ...base, phase: "complete", detail: "cancelled", safeToRetry: false };
12342
+ case "failed":
12343
+ return { ...base, phase: "failed", detail: "failed", safeToRetry: true };
12344
+ case "needs_verification":
12345
+ return { ...base, phase: "failed", detail: "needs_verification", safeToRetry: false };
12346
+ default:
12347
+ return { ...base, phase: "failed", detail: "needs_verification", safeToRetry: false };
12348
+ }
12349
+ }
12350
+ function countSuccessfulRuns(yDoc, blockId) {
12351
+ return readRunRecords(yDoc, blockId).filter((record) => !record.error).length;
12352
+ }
12353
+
12312
12354
  // src/core/lib/flowEngine/validateBlockConfig.ts
12313
12355
  function validateBlockConfig(block) {
12314
12356
  const issues = [];
@@ -13921,13 +13963,18 @@ function classifyBlockerCause(block, runtime) {
13921
13963
  return void 0;
13922
13964
  }
13923
13965
  function classifyNodeState({ block, runtime, now, pendingInvocationCount = 0, completionVerification }) {
13924
- if (runtime.state === "completed" && completionVerification?.status === "unverified") return "Blocked";
13925
- if (runtime.state === "completed" || runtime.state === "cancelled") return "Done";
13926
- if (runtime.state === "needs_verification") return "Blocked";
13927
- if (runtime.state === "failed" || runtime.error) return "Blocked";
13966
+ const derived = deriveBlockPhase({
13967
+ runtime,
13968
+ actionType: getBlockActionType(block),
13969
+ completionVerification,
13970
+ pendingInvocationCount
13971
+ });
13972
+ if (derived.phase === "failed") return "Blocked";
13973
+ if (derived.phase === "complete") return "Done";
13974
+ if (derived.detail === "standing" && pendingInvocationCount === 0) return "Done";
13975
+ if (runtime.error) return "Blocked";
13928
13976
  const dueAt = getDueAt(block);
13929
13977
  if (dueAt != null && dueAt <= now) return "Overdue";
13930
- if (pendingInvocationCount > 0) return "Pending";
13931
13978
  return "Pending";
13932
13979
  }
13933
13980
  function snapshotNode(block, runtime, now, pendingInvocationCount = 0, completionVerification) {
@@ -14928,6 +14975,8 @@ export {
14928
14975
  executeActionBlock,
14929
14976
  verifyCompletion,
14930
14977
  isVerifiedCompletion,
14978
+ deriveBlockPhase,
14979
+ countSuccessfulRuns,
14931
14980
  validateBlockConfig,
14932
14981
  createUcanDelegationStore,
14933
14982
  createMemoryUcanDelegationStore,
@@ -14987,4 +15036,4 @@ export {
14987
15036
  executeQueuedFlowAgentCoreCommands,
14988
15037
  FlowAgentService
14989
15038
  };
14990
- //# sourceMappingURL=chunk-ESPPJONO.js.map
15039
+ //# sourceMappingURL=chunk-LMHIE6UG.js.map