@ixo/editor 6.13.0 → 6.15.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.
@@ -10,7 +10,7 @@ import {
10
10
  replaceBlockInFragment,
11
11
  swapBlocksInFragment,
12
12
  writeCompiledBlocksToFragment
13
- } from "./chunk-ESPPJONO.js";
13
+ } from "./chunk-WSRVRHND.js";
14
14
 
15
15
  // src/core/lib/flowCompiler/authoring.ts
16
16
  import * as Y from "yjs";
@@ -257,4 +257,4 @@ export {
257
257
  resetStepRuntime,
258
258
  setFormAnswers
259
259
  };
260
- //# sourceMappingURL=chunk-ID2Q6WO4.js.map
260
+ //# sourceMappingURL=chunk-AEMFFWTU.js.map
@@ -14,11 +14,13 @@ import {
14
14
  buildServicesFromHandlers,
15
15
  buildVerifiableCredential,
16
16
  buildXeroPaymentWorkKey,
17
+ countSuccessfulRuns,
17
18
  createInvocationStore,
18
19
  createReference,
19
20
  createRuntimeStateManager,
20
21
  createUcanDelegationStore,
21
22
  createUcanService,
23
+ deriveBlockPhase,
22
24
  executeActionBlock,
23
25
  extractDid,
24
26
  extractSurveyAnswerSchema,
@@ -74,7 +76,7 @@ import {
74
76
  verifyCompletion,
75
77
  warnOnce,
76
78
  writeRunRecordAndReconcile
77
- } from "./chunk-ESPPJONO.js";
79
+ } from "./chunk-WSRVRHND.js";
78
80
 
79
81
  // src/mantine/hooks/usePanel.ts
80
82
  import { useCallback, useMemo, useEffect, useRef } from "react";
@@ -24067,30 +24069,49 @@ function NeedsVerificationAlert({ editor, block }) {
24067
24069
  }
24068
24070
 
24069
24071
  // src/mantine/blocks/action/flow/FlowView.tsx
24070
- var getStatusLabel4 = (runtimeState, t) => {
24071
- switch (runtimeState) {
24072
+ var getStatusLabel4 = (derived, t) => {
24073
+ switch (derived.detail) {
24072
24074
  case "running":
24073
24075
  return t("actionBlock.status.inProgress", { defaultValue: "In Progress" });
24076
+ case "awaiting_readback":
24077
+ return t("actionBlock.status.awaitingConfirmation", { defaultValue: "Awaiting Confirmation" });
24078
+ case "queued":
24079
+ return t("actionBlock.status.active", { defaultValue: "Active" });
24080
+ case "standing": {
24081
+ const active = t("actionBlock.status.active", { defaultValue: "Active" });
24082
+ if (!derived.runCount) return active;
24083
+ const runsWord = derived.runCount === 1 ? t("actionBlock.status.run", { defaultValue: "run" }) : t("actionBlock.status.runs", { defaultValue: "runs" });
24084
+ return `${active} \xB7 ${derived.runCount} ${runsWord}`;
24085
+ }
24074
24086
  case "completed":
24087
+ case "cancelled":
24075
24088
  return t("actionBlock.status.completed", { defaultValue: "Completed" });
24076
24089
  case "failed":
24077
24090
  return t("actionBlock.status.failed", { defaultValue: "Failed" });
24078
24091
  case "needs_verification":
24079
24092
  return t("actionBlock.status.needsVerification", { defaultValue: "Needs verification" });
24093
+ case "unverified":
24094
+ return t("actionBlock.status.unverified", { defaultValue: "Unverified" });
24080
24095
  default:
24081
24096
  return t("actionBlock.status.pending", { defaultValue: "Pending" });
24082
24097
  }
24083
24098
  };
24084
- var getStatusColor4 = (runtimeState) => {
24085
- switch (runtimeState) {
24099
+ var getStatusColor4 = (derived) => {
24100
+ switch (derived.detail) {
24086
24101
  case "running":
24102
+ case "awaiting_readback":
24103
+ case "queued":
24087
24104
  return "blue";
24105
+ case "standing":
24088
24106
  case "completed":
24107
+ case "cancelled":
24089
24108
  return "green.5";
24090
24109
  case "failed":
24091
24110
  return "red";
24092
24111
  case "needs_verification":
24093
24112
  return "orange";
24113
+ case "unverified":
24114
+ return "yellow";
24094
24115
  default:
24095
24116
  return void 0;
24096
24117
  }
@@ -24102,7 +24123,6 @@ var ActionFlowView = ({ editor, block, isDisabled }) => {
24102
24123
  const panelId = `action-flow-panel-${block.id}`;
24103
24124
  const { closePanel, activePanel } = usePanelStore();
24104
24125
  const actionType = block.props.actionType || "";
24105
- const runtimeState = runtime.state || "";
24106
24126
  const completionVerification = useMemo93(
24107
24127
  () => verifyCompletion({
24108
24128
  runtime,
@@ -24113,9 +24133,17 @@ var ActionFlowView = ({ editor, block, isDisabled }) => {
24113
24133
  }),
24114
24134
  [runtime, block.id, actionType, editor]
24115
24135
  );
24116
- const isUnverifiedCompletion = completionVerification.status === "unverified";
24117
- const statusLabel = isUnverifiedCompletion ? t("actionBlock.status.unverified", { defaultValue: "Unverified" }) : getStatusLabel4(runtimeState, t);
24118
- const statusColor3 = isUnverifiedCompletion ? "yellow" : getStatusColor4(runtimeState);
24136
+ const derivedState = useMemo93(() => {
24137
+ const yDoc = editor?._yDoc;
24138
+ return deriveBlockPhase({
24139
+ runtime,
24140
+ actionType,
24141
+ completionVerification,
24142
+ runCount: yDoc ? countSuccessfulRuns(yDoc, block.id) : void 0
24143
+ });
24144
+ }, [runtime, actionType, completionVerification, editor, block.id]);
24145
+ const statusLabel = getStatusLabel4(derivedState, t);
24146
+ const statusColor3 = getStatusColor4(derivedState);
24119
24147
  const configIssues = useMemo93(() => validateBlockConfig(block), [block?.props?.inputs, block?.props?.trigger, block?.props?.assignment, block?.props?.conditions]);
24120
24148
  const dueDate = block.props.ttlAbsoluteDueDate;
24121
24149
  const dueDateDisplay = dueDate ? formatDate(dueDate) : "";
@@ -32269,6 +32297,29 @@ import React314, { useCallback as useCallback108, useEffect as useEffect111, use
32269
32297
  import { Badge as Badge51, Box as Box58, Button as Button65, Group as Group112, Loader as Loader59, Overlay, SegmentedControl as SegmentedControl14, Stack as Stack207, Text as Text195 } from "@mantine/core";
32270
32298
  import { DateTimePicker as DateTimePicker2 } from "@mantine/dates";
32271
32299
  import { IconAlertCircle as IconAlertCircle27, IconCheck as IconCheck23, IconRefresh as IconRefresh8 } from "@tabler/icons-react";
32300
+
32301
+ // src/core/lib/actionRegistry/actions/collection/failure.ts
32302
+ var ACTION_INPUT_REQUIRED_ERROR_CODE = "ACTION_INPUT_REQUIRED";
32303
+ var COLLECTION_MANAGE_OPERATIONS = /* @__PURE__ */ new Set(["refresh", "updateState", "updateDates", "updateQuota", "updatePayments", "updateIntents"]);
32304
+ function collectionLifecycleRuntimeError(error, runtimeInputs, at = Date.now()) {
32305
+ const message = error instanceof Error ? error.message : String(error || "Collection lifecycle action failed");
32306
+ const operation = runtimeInputs.operation;
32307
+ const collectionId = String(runtimeInputs.collectionId || "").trim();
32308
+ const isMissingCollectionId = operation !== "create" && COLLECTION_MANAGE_OPERATIONS.has(operation) && collectionId.length === 0 && message.includes("collectionId is required");
32309
+ if (!isMissingCollectionId) return { message, at };
32310
+ return {
32311
+ message,
32312
+ code: ACTION_INPUT_REQUIRED_ERROR_CODE,
32313
+ at,
32314
+ data: {
32315
+ actionType: "qi/collection.lifecycle",
32316
+ field: "collectionId",
32317
+ operation
32318
+ }
32319
+ };
32320
+ }
32321
+
32322
+ // src/mantine/blocks/action/actionTypes/collection/CollectionLifecycleFlowDetail.tsx
32272
32323
  var LOG = "[collection.lifecycle]";
32273
32324
  function parseTemplateInputs(json) {
32274
32325
  try {
@@ -32468,9 +32519,10 @@ var CollectionLifecycleFlowDetail = ({
32468
32519
  }
32469
32520
  console.log(`${LOG} refresh success`, { collectionId: payload.collectionId });
32470
32521
  } catch (err) {
32471
- const message = err instanceof Error ? err.message : "Failed to refresh collection state";
32522
+ const failure = collectionLifecycleRuntimeError(err, { operation: "refresh", collectionId });
32523
+ const message = failure.message;
32472
32524
  console.error(`${LOG} refresh failed`, { message });
32473
- updateRuntime({ state: "failed", error: { message, at: Date.now() } });
32525
+ updateRuntime({ state: "failed", error: failure });
32474
32526
  }
32475
32527
  }, [executeAction, effectiveCollectionId, updateRuntime]);
32476
32528
  useEffect111(() => {
@@ -32651,9 +32703,10 @@ var CollectionLifecycleFlowDetail = ({
32651
32703
  }
32652
32704
  console.log(`${LOG} execute success`, { operation: runtimeInputs.operation, collectionId: payload.collectionId, state: payload.state });
32653
32705
  } catch (err) {
32654
- const message = err instanceof Error ? err.message : `Failed to ${runtimeInputs.operation} collection`;
32706
+ const failure = collectionLifecycleRuntimeError(err, runtimeInputs);
32707
+ const message = failure.message;
32655
32708
  console.error(`${LOG} execute failed`, { operation: runtimeInputs.operation, message });
32656
- updateRuntime({ state: "failed", error: { message, at: Date.now() } });
32709
+ updateRuntime({ state: "failed", error: failure });
32657
32710
  }
32658
32711
  }, [isDisabled, isRunning, executeAction, validation.ok, validation.error, operation, buildRuntimeInputs, effectiveCollectionId, updateRuntime]);
32659
32712
  useEffect111(() => {
@@ -48088,21 +48141,6 @@ async function appendToThread(matrixClient, roomId, threadType, payload) {
48088
48141
  }
48089
48142
  });
48090
48143
  }
48091
- function logDelegation(matrixClient, roomId, delegation) {
48092
- appendToThread(matrixClient, roomId, "delegations", {
48093
- type: "delegation",
48094
- cid: delegation.cid,
48095
- issuerDid: delegation.issuerDid,
48096
- audienceDid: delegation.audienceDid,
48097
- capabilities: delegation.capabilities,
48098
- expiration: delegation.expiration,
48099
- createdAt: delegation.createdAt,
48100
- format: delegation.format,
48101
- proofCids: delegation.proofCids
48102
- }).catch((error) => {
48103
- console.warn("[MatrixThreadLog] Failed to log delegation:", delegation.cid, error);
48104
- });
48105
- }
48106
48144
  function logInvocation(matrixClient, roomId, invocation) {
48107
48145
  appendToThread(matrixClient, roomId, "invocations", {
48108
48146
  type: "invocation",
@@ -48499,15 +48537,7 @@ function useCreateCollaborativeIxoEditor(options) {
48499
48537
  const agentLeasesMap = useMemo176(() => yDoc.getMap("agentLeases"), [yDoc]);
48500
48538
  const xeroWorkItemsMap = useMemo176(() => yDoc.getMap("xeroWorkItems"), [yDoc]);
48501
48539
  const xeroConnectionMap = useMemo176(() => yDoc.getMap("xeroConnection"), [yDoc]);
48502
- const ucanDelegationStore = useMemo176(() => {
48503
- const store = createUcanDelegationStore(delegationsMap);
48504
- const originalSet = store.set;
48505
- store.set = (delegation) => {
48506
- originalSet(delegation);
48507
- logDelegation(matrixClient, options.roomId, delegation);
48508
- };
48509
- return store;
48510
- }, [delegationsMap, matrixClient, options.roomId]);
48540
+ const ucanDelegationStore = useMemo176(() => createUcanDelegationStore(delegationsMap), [delegationsMap]);
48511
48541
  const invocationStore = useMemo176(() => {
48512
48542
  const store = createInvocationStore(invocationsMap);
48513
48543
  const originalAdd = store.add;
@@ -48644,7 +48674,6 @@ function useCreateCollaborativeIxoEditor(options) {
48644
48674
  }
48645
48675
  if (delegation.cid) {
48646
48676
  ucanDelegationStore.set(delegation);
48647
- logDelegation(matrixClient, options.roomId, delegation);
48648
48677
  } else if (delegation.id) {
48649
48678
  const stored = {
48650
48679
  cid: delegation.id,
@@ -48658,7 +48687,6 @@ function useCreateCollaborativeIxoEditor(options) {
48658
48687
  proofCids: delegation.proofs || []
48659
48688
  };
48660
48689
  ucanDelegationStore.set(stored);
48661
- logDelegation(matrixClient, options.roomId, stored);
48662
48690
  }
48663
48691
  };
48664
48692
  ixoEditor.getRootCapability = () => {
@@ -51496,4 +51524,4 @@ export {
51496
51524
  ixoGraphQLClient,
51497
51525
  getEntity
51498
51526
  };
51499
- //# sourceMappingURL=chunk-LMX55KEO.js.map
51527
+ //# sourceMappingURL=chunk-SB3QHMRF.js.map