@arbidocs/blocks 0.4.83 → 0.4.85

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 (124) hide show
  1. package/dist/MailBodyEditor-5PIQLYVY.js +217 -0
  2. package/dist/MailBodyEditor-5PIQLYVY.js.map +1 -0
  3. package/dist/MailBodyEditor-D7MGJMLH.cjs +223 -0
  4. package/dist/MailBodyEditor-D7MGJMLH.cjs.map +1 -0
  5. package/dist/agents/index.cjs +281 -280
  6. package/dist/agents/index.js +6 -5
  7. package/dist/agents/workflows/StepBarFrame.d.ts +3 -1
  8. package/dist/agents/workflows/WorkflowRunner.d.ts +10 -1
  9. package/dist/agents/workflows/run.d.ts +24 -3
  10. package/dist/agents/workflows/stepWindow.d.ts +4 -2
  11. package/dist/agents/workflows/types.d.ts +5 -0
  12. package/dist/agents/workflows/useWorkflowView.d.ts +16 -1
  13. package/dist/chat/index.cjs +1 -1
  14. package/dist/chat/index.js +1 -1
  15. package/dist/{chunk-FE4ULGOR.js → chunk-2YOVK524.js} +28 -5
  16. package/dist/chunk-2YOVK524.js.map +1 -0
  17. package/dist/chunk-3R6XBYL7.cjs +576 -0
  18. package/dist/chunk-3R6XBYL7.cjs.map +1 -0
  19. package/dist/{chunk-CKB64Z4R.js → chunk-4XJZ6AAY.js} +6 -245
  20. package/dist/chunk-4XJZ6AAY.js.map +1 -0
  21. package/dist/{chunk-SB5ZKOYN.js → chunk-7C35WXYB.js} +4 -63
  22. package/dist/chunk-7C35WXYB.js.map +1 -0
  23. package/dist/chunk-7RJTEWYM.js +362 -0
  24. package/dist/chunk-7RJTEWYM.js.map +1 -0
  25. package/dist/chunk-AFSOUS5X.cjs +253 -0
  26. package/dist/chunk-AFSOUS5X.cjs.map +1 -0
  27. package/dist/{chunk-F4RUCUXF.cjs → chunk-C2HRZSAT.cjs} +2 -63
  28. package/dist/chunk-C2HRZSAT.cjs.map +1 -0
  29. package/dist/{chunk-RX35SMPR.js → chunk-FHOZMT5P.js} +7 -6
  30. package/dist/chunk-FHOZMT5P.js.map +1 -0
  31. package/dist/{chunk-ZVBPRMHJ.cjs → chunk-JH6JTI76.cjs} +27 -4
  32. package/dist/chunk-JH6JTI76.cjs.map +1 -0
  33. package/dist/{chunk-CONIA2ZA.js → chunk-KHY4PYU7.js} +246 -146
  34. package/dist/chunk-KHY4PYU7.js.map +1 -0
  35. package/dist/chunk-LGX6UFYG.js +557 -0
  36. package/dist/chunk-LGX6UFYG.js.map +1 -0
  37. package/dist/chunk-O4YPVYPO.cjs +373 -0
  38. package/dist/chunk-O4YPVYPO.cjs.map +1 -0
  39. package/dist/chunk-R26OHONI.js +250 -0
  40. package/dist/chunk-R26OHONI.js.map +1 -0
  41. package/dist/{chunk-RYYYHPFU.cjs → chunk-RZUMQM7W.cjs} +246 -146
  42. package/dist/chunk-RZUMQM7W.cjs.map +1 -0
  43. package/dist/{chunk-YJQVLVBJ.cjs → chunk-S5HZBXZA.cjs} +2 -243
  44. package/dist/chunk-S5HZBXZA.cjs.map +1 -0
  45. package/dist/{chunk-ZQYE7J3J.cjs → chunk-WRSBM6QN.cjs} +332 -94
  46. package/dist/chunk-WRSBM6QN.cjs.map +1 -0
  47. package/dist/{chunk-RSKSXEPW.js → chunk-X23U6QEJ.js} +324 -88
  48. package/dist/chunk-X23U6QEJ.js.map +1 -0
  49. package/dist/{chunk-XA5S4776.cjs → chunk-Z7YUCYI6.cjs} +51 -50
  50. package/dist/chunk-Z7YUCYI6.cjs.map +1 -0
  51. package/dist/collaboration/index.cjs +100 -49
  52. package/dist/collaboration/index.js +4 -1
  53. package/dist/collaboration/mail/MailBodyEditor.d.ts +7 -0
  54. package/dist/collaboration/mail/MailDeliveryList.d.ts +8 -0
  55. package/dist/collaboration/mail/MailDocumentPicker.d.ts +15 -0
  56. package/dist/collaboration/mail/MailGrid.d.ts +17 -0
  57. package/dist/collaboration/mail/MailMessageView.d.ts +27 -0
  58. package/dist/collaboration/mail/PlainMailBodyEditor.d.ts +12 -0
  59. package/dist/collaboration/mail/index.d.ts +6 -0
  60. package/dist/collaboration/mail/mailCompose.d.ts +24 -0
  61. package/dist/connect/index.cjs +1684 -72
  62. package/dist/connect/index.cjs.map +1 -1
  63. package/dist/connect/index.d.ts +2 -1
  64. package/dist/connect/index.js +1670 -64
  65. package/dist/connect/index.js.map +1 -1
  66. package/dist/connection/ConnectedTagTable.d.ts +32 -0
  67. package/dist/connection/WorkflowRunnerDialogs.d.ts +12 -1
  68. package/dist/connection/mail/ConnectedMailAccounts.d.ts +21 -0
  69. package/dist/connection/mail/ConnectedMailComposer.d.ts +40 -0
  70. package/dist/connection/mail/ConnectedMailSetup.d.ts +16 -0
  71. package/dist/connection/mail/ConnectedMailbox.d.ts +65 -0
  72. package/dist/connection/mail/MailComposerForm.d.ts +25 -0
  73. package/dist/connection/mail/attachments.d.ts +13 -0
  74. package/dist/connection/mail/index.d.ts +6 -0
  75. package/dist/connection/mail/mailbox.d.ts +6 -0
  76. package/dist/connection/mail/types.d.ts +92 -0
  77. package/dist/connection/useConnectedWorkNotifications.d.ts +6 -0
  78. package/dist/connection/useWorkflowThread.d.ts +7 -2
  79. package/dist/document-tools/SignDocumentDialog.d.ts +9 -2
  80. package/dist/document-tools/index.cjs +2 -2
  81. package/dist/document-tools/index.js +1 -1
  82. package/dist/facts/index.cjs +2 -2
  83. package/dist/facts/index.js +2 -2
  84. package/dist/files/index.cjs +47 -367
  85. package/dist/files/index.cjs.map +1 -1
  86. package/dist/files/index.js +10 -360
  87. package/dist/files/index.js.map +1 -1
  88. package/dist/index.cjs +510 -451
  89. package/dist/index.cjs.map +1 -1
  90. package/dist/index.js +21 -18
  91. package/dist/index.js.map +1 -1
  92. package/dist/settings/index.cjs +10 -9
  93. package/dist/settings/index.cjs.map +1 -1
  94. package/dist/settings/index.js +2 -1
  95. package/dist/settings/index.js.map +1 -1
  96. package/dist/shell/index.cjs +1 -1
  97. package/dist/shell/index.js +1 -1
  98. package/dist/tags/TagColumnsEditor.d.ts +34 -0
  99. package/dist/tags/TagDetail.d.ts +13 -11
  100. package/dist/tags/TagTable.d.ts +99 -0
  101. package/dist/tags/TagsNav.d.ts +2 -2
  102. package/dist/tags/index.d.ts +7 -5
  103. package/dist/tags/{tagMatrixDocx.d.ts → tagTableDocx.d.ts} +12 -12
  104. package/dist/tags/tagTableModel.d.ts +47 -0
  105. package/dist/workflow-canvas/index.cjs +49 -48
  106. package/dist/workflow-canvas/index.cjs.map +1 -1
  107. package/dist/workflow-canvas/index.js +6 -5
  108. package/dist/workflow-canvas/index.js.map +1 -1
  109. package/package.json +29 -4
  110. package/dist/chunk-CKB64Z4R.js.map +0 -1
  111. package/dist/chunk-CONIA2ZA.js.map +0 -1
  112. package/dist/chunk-F4RUCUXF.cjs.map +0 -1
  113. package/dist/chunk-FE4ULGOR.js.map +0 -1
  114. package/dist/chunk-RSKSXEPW.js.map +0 -1
  115. package/dist/chunk-RX35SMPR.js.map +0 -1
  116. package/dist/chunk-RYYYHPFU.cjs.map +0 -1
  117. package/dist/chunk-SB5ZKOYN.js.map +0 -1
  118. package/dist/chunk-XA5S4776.cjs.map +0 -1
  119. package/dist/chunk-YJQVLVBJ.cjs.map +0 -1
  120. package/dist/chunk-ZQYE7J3J.cjs.map +0 -1
  121. package/dist/chunk-ZVBPRMHJ.cjs.map +0 -1
  122. package/dist/connection/ConnectedTagMatrix.d.ts +0 -23
  123. package/dist/tags/TagMatrix.d.ts +0 -87
  124. package/dist/tags/tagMatrixModel.d.ts +0 -43
@@ -680,10 +680,12 @@ function stepStatesFromActivity(events) {
680
680
  const approved = Array.isArray(detail.approved) ? detail.approved.filter(asRecord) : void 0;
681
681
  const finished2 = status === "done" || status === "skipped" || status === "failed";
682
682
  const declinedBy = str2(detail.declined_by);
683
+ const afterFailure = status === "skipped" && (before?.status === "failed" || !!before?.skippedAfterFailure);
683
684
  states[step] = {
684
685
  status,
685
686
  responseId,
686
- error: str2(detail.error) ?? null,
687
+ error: str2(detail.error) ?? (afterFailure ? before?.error ?? null : null),
688
+ ...afterFailure ? { skippedAfterFailure: true } : {},
687
689
  ...startedAt ? { startedAt } : {},
688
690
  ...action ? { action } : {},
689
691
  ...documents?.length ? { documents } : {},
@@ -717,7 +719,7 @@ var isRunFinished = (steps, states) => steps.length > 0 && steps.every((s) => fi
717
719
  var isPersonStep = (step) => step.kind !== "agent" && step.kind !== "action";
718
720
  var isPersonAction = (step) => step.kind === "action" && (step.action.type === "sign" || step.action.type === "email_draft");
719
721
  var canAssign = (step) => isPersonStep(step) || isPersonAction(step);
720
- function nextAction(steps, states, current) {
722
+ function nextAction(steps, states, current, { needsStart = false, canRetry = false } = {}) {
721
723
  const i = steps.findIndex((s) => s.id === current);
722
724
  const step = steps[i];
723
725
  if (!step) return "wait";
@@ -732,9 +734,17 @@ function nextAction(steps, states, current) {
732
734
  if (isPersonStep(step)) return "complete";
733
735
  if (phase === "waiting" && step.kind === "action" && step.action.type === "email_draft")
734
736
  return "complete";
737
+ if (phase === "ready" && needsStart) return "start";
735
738
  if (phase !== "failed") return independentNext ? "move" : "wait";
736
739
  const waitedFor = steps.slice(i + 1).some((s) => dependsOn(steps, s.id, step.id));
737
- return waitedFor || !following ? "skip" : "move";
740
+ if (!waitedFor && following) return "move";
741
+ return canRetry ? "retry" : "wait";
742
+ }
743
+ function failedUpstream(steps, states, id) {
744
+ return upstreamSteps(steps, id).flatMap((s) => {
745
+ const state = states[s.id];
746
+ return state && (state.status === "failed" || state.skippedAfterFailure) ? [{ step: s, state }] : [];
747
+ });
738
748
  }
739
749
  function validateStep(step, inputs) {
740
750
  const fields = stepFields(step);
@@ -1131,26 +1141,33 @@ function useWorkflowView(options) {
1131
1141
  },
1132
1142
  [following]
1133
1143
  );
1134
- const action = busy ? "wait" : nextAction(steps, states, current);
1144
+ const actionOptions = react.useCallback(
1145
+ (o) => ({
1146
+ needsStart: !!o.start && !!o.needsStart,
1147
+ canRetry: !!o.retry
1148
+ }),
1149
+ []
1150
+ );
1151
+ const action = busy ? "wait" : nextAction(steps, states, current, actionOptions(options));
1135
1152
  const next = react.useCallback(async () => {
1136
1153
  const { steps: s, states: st, inputs: values } = optionsRef.current;
1137
1154
  const at = s.find((x) => x.id === current);
1138
- const act2 = nextAction(s, st, current);
1155
+ const act2 = nextAction(s, st, current, actionOptions(optionsRef.current));
1139
1156
  if (!at || act2 === "wait" || busy) return;
1140
1157
  setActionError(null);
1141
1158
  if (act2 === "finish") return setCurrent(null);
1142
1159
  if (act2 === "move") return setCurrent(following(current));
1143
1160
  setBusy(true);
1144
1161
  try {
1145
- if (act2 === "skip") {
1146
- await optionsRef.current.skip(at.id);
1147
- } else {
1148
- if (Object.keys(validateStep(at, values)).length > 0) {
1149
- setShowErrors(true);
1150
- return;
1151
- }
1152
- await optionsRef.current.complete(at);
1162
+ if (act2 === "start" || act2 === "retry") {
1163
+ await (act2 === "start" ? optionsRef.current.start?.() : optionsRef.current.retry?.(at.id));
1164
+ return;
1165
+ }
1166
+ if (Object.keys(validateStep(at, values)).length > 0) {
1167
+ setShowErrors(true);
1168
+ return;
1153
1169
  }
1170
+ await optionsRef.current.complete(at);
1154
1171
  setShowErrors(false);
1155
1172
  setCurrent(onward(at.id) ?? current);
1156
1173
  } catch (e) {
@@ -1158,7 +1175,7 @@ function useWorkflowView(options) {
1158
1175
  } finally {
1159
1176
  setBusy(false);
1160
1177
  }
1161
- }, [current, busy, following, onward]);
1178
+ }, [current, busy, following, onward, actionOptions]);
1162
1179
  const goTo = react.useCallback((stepId) => {
1163
1180
  setShowErrors(false);
1164
1181
  setActionError(null);
@@ -1248,11 +1265,14 @@ function useWorkflowView(options) {
1248
1265
  setInput,
1249
1266
  stateOf: (id) => states[id],
1250
1267
  phaseOf: (id) => stepPhase(steps, states, id),
1268
+ failedUpstreamOf: (id) => failedUpstream(steps, states, id),
1251
1269
  isLocked,
1252
1270
  errors: showErrors && step && !isLocked(step.id) ? validateStep(step, inputs) : {},
1253
1271
  busy,
1254
1272
  actionError,
1255
1273
  isRunning: Object.values(states).some((s) => s.status === "running"),
1274
+ needsStart: !!options.start && !!options.needsStart,
1275
+ runError: options.runError ?? null,
1256
1276
  action,
1257
1277
  canBack: (current === null || index > 0) && !busy,
1258
1278
  next,
@@ -1347,6 +1367,7 @@ function stepWindow({
1347
1367
  canBack: start > 0,
1348
1368
  canForward: end < n,
1349
1369
  runningHidden: all.filter((s) => phaseOf(s.id) === "running" && !shown.has(s.id)),
1370
+ failedHidden: all.filter((s) => phaseOf(s.id) === "failed" && !shown.has(s.id)),
1350
1371
  position: Math.max(1, all.findIndex((s) => s.id === at) + 1),
1351
1372
  total: all.length
1352
1373
  };
@@ -1370,6 +1391,7 @@ var DEFAULT_STEP_BAR_LABELS = {
1370
1391
  inParallel: "In parallel",
1371
1392
  working: "Working: {title}",
1372
1393
  moreWorking: "+{count} working",
1394
+ failedStep: "Failed: {title}",
1373
1395
  waitingFor: "Waiting for {name}",
1374
1396
  phases: {
1375
1397
  blocked: "Not started",
@@ -1591,6 +1613,21 @@ function StepBarFrame({
1591
1613
  },
1592
1614
  s.id
1593
1615
  );
1616
+ const failedPill = (s) => /* @__PURE__ */ jsxRuntime.jsxs(
1617
+ "button",
1618
+ {
1619
+ type: "button",
1620
+ onClick: () => select(s.id),
1621
+ className: "flex min-w-0 max-w-[14rem] shrink items-center gap-1.5 rounded-full border border-destructive/40 bg-destructive/5 px-2 py-1 text-xs text-destructive hover:bg-destructive/10",
1622
+ title: fill(l.failedStep, { title: s.title }),
1623
+ "data-testid": tid(`failed-${s.id}`),
1624
+ children: [
1625
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertTriangle, { className: "size-3.5 shrink-0" }),
1626
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: fill(l.failedStep, { title: s.title }) })
1627
+ ]
1628
+ },
1629
+ s.id
1630
+ );
1594
1631
  return /* @__PURE__ */ jsxRuntime.jsxs(
1595
1632
  "nav",
1596
1633
  {
@@ -1678,6 +1715,17 @@ function StepBarFrame({
1678
1715
  ] })
1679
1716
  ]
1680
1717
  }
1718
+ ),
1719
+ win.failedHidden.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
1720
+ "div",
1721
+ {
1722
+ className: ui.cn(
1723
+ "flex min-w-[6.5rem] shrink-[1000] items-center gap-1",
1724
+ narrow && "basis-full"
1725
+ ),
1726
+ "data-testid": tid("failed"),
1727
+ children: win.failedHidden.map(failedPill)
1728
+ }
1681
1729
  )
1682
1730
  ]
1683
1731
  }
@@ -2011,6 +2059,7 @@ function ActionStepBody({
2011
2059
  }) {
2012
2060
  const state = run.stateOf(step.id);
2013
2061
  const phase = run.phaseOf(step.id);
2062
+ const underWay = phase === "running" || phase === "ready" && !run.needsStart;
2014
2063
  const name = (id) => run.nameOf?.(id) ?? id;
2015
2064
  const [declining, setDeclining] = react.useState(false);
2016
2065
  const [note, setNote] = react.useState("");
@@ -2035,7 +2084,7 @@ function ActionStepBody({
2035
2084
  const mine = !actions?.me || signers.includes(actions.me) && !signed.has(actions.me);
2036
2085
  const signedRef = state?.status === "done" ? state.documents?.[0] : void 0;
2037
2086
  body = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2038
- (phase === "ready" || phase === "running") && working(l.preparingSign),
2087
+ underWay && working(l.preparingSign),
2039
2088
  phase === "waiting" && waiting?.doc_ext_id && /* @__PURE__ */ jsxRuntime.jsx(
2040
2089
  DocChip,
2041
2090
  {
@@ -2145,7 +2194,7 @@ function ActionStepBody({
2145
2194
  } else if (a.type === "email_draft") {
2146
2195
  const draftId = state?.waiting?.draft_id ?? (typeof state?.output?.draft_id === "string" ? state.output.draft_id : void 0);
2147
2196
  body = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2148
- (phase === "ready" || phase === "running") && working(l.preparingDraft),
2197
+ underWay && working(l.preparingDraft),
2149
2198
  phase === "waiting" && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: l.draftReady }),
2150
2199
  phase === "done" && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "flex items-center gap-1.5 text-sm", "data-testid": `${testId}-sent`, children: [
2151
2200
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "size-4 text-primary" }),
@@ -2171,7 +2220,7 @@ function ActionStepBody({
2171
2220
  const tags = state?.output?.tag_ext_ids ?? a.tags;
2172
2221
  const docs = state?.output?.doc_ext_ids ?? [];
2173
2222
  body = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2174
- (phase === "ready" || phase === "running") && working(l.reviewRunning),
2223
+ underWay && working(l.reviewRunning),
2175
2224
  phase === "done" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2176
2225
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", "data-testid": `${testId}-reviewed`, children: l.reviewDone.replace("{docs}", String(docs.length)).replace("{cols}", String(tags.length)) }),
2177
2226
  actions?.openReview && /* @__PURE__ */ jsxRuntime.jsxs(
@@ -2222,7 +2271,9 @@ function WorkflowStepBar({
2222
2271
  const isCurrent = s.id === current;
2223
2272
  const assignee = ["ready", "waiting"].includes(phase) ? run.assigneeOf(s.id) : void 0;
2224
2273
  const waiting = assignee ? l.waitingFor.replace("{name}", assignee) : void 0;
2225
- const title = waiting ? `${s.title} \xB7 ${waiting}` : s.title;
2274
+ const state = s.id === DONE ? void 0 : run.stateOf(s.id);
2275
+ const failure = (phase === "failed" || state?.skippedAfterFailure) && state?.error ? `${l.phases.failed}: ${state.error}` : void 0;
2276
+ const title = [s.title, waiting, failure].filter(Boolean).join(" \xB7 ");
2226
2277
  const name = `${title} (${l.phases[phase]})`;
2227
2278
  if (s.id === DONE)
2228
2279
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -2298,15 +2349,19 @@ function WorkflowStepBar({
2298
2349
  var DEFAULT_WORKFLOW_RUNNER_LABELS = {
2299
2350
  back: "Back",
2300
2351
  next: "Continue",
2301
- skip: "Skip",
2302
2352
  skipStep: "Skip this step",
2303
2353
  finish: "Finish",
2304
2354
  approve: "Approve",
2305
2355
  working: "Working\u2026",
2306
2356
  stepWorking: "{step}\u2026 {elapsed}",
2307
2357
  starting: "Starting\u2026",
2358
+ start: "Start",
2359
+ notStarted: "Not started yet. Press Start to run this step.",
2308
2360
  retry: "Retry",
2309
2361
  failed: "This step did not finish.",
2362
+ upstreamFailed: "\u201C{step}\u201D failed{error}. Retry it before this step can go on.",
2363
+ upstreamSkippedAfterFailure: "\u201C{step}\u201D failed{error} and was skipped: this step goes on without its result.",
2364
+ skippedAfterFailure: "Skipped after it failed{error}.",
2310
2365
  blocked: "Starts after {steps}.",
2311
2366
  awaitingReview: "Waiting for approval.",
2312
2367
  approved: "Approved.",
@@ -2375,7 +2430,7 @@ function WorkflowRunner({
2375
2430
  const unsent = added.filter((f) => f.status === "upload-failed").length;
2376
2431
  const uploadHold = step?.kind === "upload" && (sending > 0 || uploading || unsent > 0);
2377
2432
  const docsWait = !!step && waitingDocuments(run.stateOf(step.id)).length > 0;
2378
- const nextLabel = sending ? sending === 1 ? l.uploadingFile : l.uploadingFiles.replace("{count}", String(sending)) : uploadHold && uploading ? l.uploadingAny : uploadHold ? unsent === 1 ? l.uploadFailed : l.uploadsFailed.replace("{count}", String(unsent)) : reading ? l.readingFiles.replace("{current}", String(Math.min(added.length - unread + 1, added.length))).replace("{count}", String(added.length)) : action === "skip" ? l.skip : action === "finish" ? l.finish : action === "complete" && step?.kind === "review" ? l.approve : action === "complete" && step?.kind === "action" ? l.markSent : action === "wait" && (run.isRunning || run.busy || docsWait) ? l.working : (step && !run.isLocked(step.id) ? step.nextLabel : void 0) ?? l.next;
2433
+ const nextLabel = sending ? sending === 1 ? l.uploadingFile : l.uploadingFiles.replace("{count}", String(sending)) : uploadHold && uploading ? l.uploadingAny : uploadHold ? unsent === 1 ? l.uploadFailed : l.uploadsFailed.replace("{count}", String(unsent)) : reading ? l.readingFiles.replace("{current}", String(Math.min(added.length - unread + 1, added.length))).replace("{count}", String(added.length)) : action === "start" ? l.start : action === "retry" ? l.retry : action === "finish" ? l.finish : action === "complete" && step?.kind === "review" ? l.approve : action === "complete" && step?.kind === "action" ? l.markSent : action === "wait" && (run.isRunning || run.busy || docsWait) ? l.working : (step && !run.isLocked(step.id) ? step.nextLabel : void 0) ?? l.next;
2379
2434
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cn(compact3 ? "space-y-3" : "space-y-6", className), "data-testid": testIdPrefix, children: [
2380
2435
  !hideStepBar && /* @__PURE__ */ jsxRuntime.jsx(
2381
2436
  WorkflowStepBar,
@@ -2402,138 +2457,141 @@ function WorkflowRunner({
2402
2457
  children: l.restart
2403
2458
  }
2404
2459
  )
2405
- ] }) : step ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-3", children: run.phaseOf(step.id) === "blocked" ? /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { className: ui.cn(box, "p-6"), "data-testid": tid(step.id), children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", "data-testid": tid(`${step.id}-blocked`), children: l.blocked.replace(
2406
- "{steps}",
2407
- stepDependencies(steps, step.id).map((d) => steps.find((s) => s.id === d)?.title ?? d).join(", ")
2408
- ) }) }) : step.kind === "form" ? /* @__PURE__ */ jsxRuntime.jsxs(ui.Card, { className: ui.cn(box, "space-y-4"), "data-testid": tid(step.id), children: [
2409
- /* @__PURE__ */ jsxRuntime.jsx(StepHeading, { step, icon: icon(step.icon), testId: tid(`${step.id}-title`) }),
2410
- /* @__PURE__ */ jsxRuntime.jsx(SentBackNote, { state: run.stateOf(step.id), l: pl, testId: tid(step.id) }),
2411
- /* @__PURE__ */ jsxRuntime.jsx(AssigneeLine, { run, stepId: step.id, l: pl, testId: tid(step.id) }),
2412
- /* @__PURE__ */ jsxRuntime.jsx("fieldset", { disabled: run.isLocked(step.id), className: "contents", children: /* @__PURE__ */ jsxRuntime.jsx(
2413
- SchemaForm,
2414
- {
2415
- fields: step.inputs,
2416
- values: run.inputs,
2417
- onChange: run.setInput,
2418
- errors: run.errors,
2419
- renderScope,
2420
- renderDocuments,
2421
- renderIcon,
2422
- people,
2423
- onEnterSubmit: () => void run.next(),
2424
- testIdPrefix: tid("field")
2425
- }
2426
- ) }),
2427
- run.actionError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-destructive", "data-testid": tid("action-error"), children: run.actionError }),
2428
- renderStepNote?.(step, run)
2429
- ] }) : step.kind === "upload" ? /* @__PURE__ */ jsxRuntime.jsxs(ui.Card, { className: ui.cn(box, "space-y-4"), "data-testid": tid(step.id), children: [
2430
- /* @__PURE__ */ jsxRuntime.jsx(SentBackNote, { state: run.stateOf(step.id), l: pl, testId: tid(step.id) }),
2431
- /* @__PURE__ */ jsxRuntime.jsx(AssigneeLine, { run, stepId: step.id, l: pl, testId: tid(step.id) }),
2432
- renderUpload?.(step) ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2460
+ ] }) : step ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
2461
+ /* @__PURE__ */ jsxRuntime.jsx(StepNotices, { run, step, l, tid }),
2462
+ run.phaseOf(step.id) === "blocked" ? /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { className: ui.cn(box, "p-6"), "data-testid": tid(step.id), children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", "data-testid": tid(`${step.id}-blocked`), children: l.blocked.replace(
2463
+ "{steps}",
2464
+ stepDependencies(steps, step.id).map((d) => steps.find((s) => s.id === d)?.title ?? d).join(", ")
2465
+ ) }) }) : step.kind === "form" ? /* @__PURE__ */ jsxRuntime.jsxs(ui.Card, { className: ui.cn(box, "space-y-4"), "data-testid": tid(step.id), children: [
2466
+ /* @__PURE__ */ jsxRuntime.jsx(StepHeading, { step, icon: icon(step.icon), testId: tid(`${step.id}-title`) }),
2467
+ /* @__PURE__ */ jsxRuntime.jsx(SentBackNote, { state: run.stateOf(step.id), l: pl, testId: tid(step.id) }),
2468
+ /* @__PURE__ */ jsxRuntime.jsx(AssigneeLine, { run, stepId: step.id, l: pl, testId: tid(step.id) }),
2469
+ /* @__PURE__ */ jsxRuntime.jsx("fieldset", { disabled: run.isLocked(step.id), className: "contents", children: /* @__PURE__ */ jsxRuntime.jsx(
2470
+ SchemaForm,
2471
+ {
2472
+ fields: step.inputs,
2473
+ values: run.inputs,
2474
+ onChange: run.setInput,
2475
+ errors: run.errors,
2476
+ renderScope,
2477
+ renderDocuments,
2478
+ renderIcon,
2479
+ people,
2480
+ onEnterSubmit: () => void run.next(),
2481
+ testIdPrefix: tid("field")
2482
+ }
2483
+ ) }),
2484
+ run.actionError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-destructive", "data-testid": tid("action-error"), children: run.actionError }),
2485
+ renderStepNote?.(step, run)
2486
+ ] }) : step.kind === "upload" ? /* @__PURE__ */ jsxRuntime.jsxs(ui.Card, { className: ui.cn(box, "space-y-4"), "data-testid": tid(step.id), children: [
2487
+ /* @__PURE__ */ jsxRuntime.jsx(SentBackNote, { state: run.stateOf(step.id), l: pl, testId: tid(step.id) }),
2488
+ /* @__PURE__ */ jsxRuntime.jsx(AssigneeLine, { run, stepId: step.id, l: pl, testId: tid(step.id) }),
2489
+ renderUpload?.(step) ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2490
+ /* @__PURE__ */ jsxRuntime.jsx(
2491
+ chunkDETZZBG2_cjs.UploadDropzone,
2492
+ {
2493
+ onFiles: (picked) => void onUpload?.(picked, step),
2494
+ uploading,
2495
+ disabled: !onUpload,
2496
+ accept: step.accept,
2497
+ title: step.title,
2498
+ description: step.description,
2499
+ hint: step.hint,
2500
+ testId: tid(`${step.id}-drop`)
2501
+ }
2502
+ ),
2503
+ files && /* @__PURE__ */ jsxRuntime.jsx(
2504
+ UploadFiles,
2505
+ {
2506
+ onRetry: onRetryUpload,
2507
+ onRemove: onRemoveUpload,
2508
+ added,
2509
+ others: files.filter((f) => f.addedFor !== step.id),
2510
+ l,
2511
+ testId: tid(`${step.id}-files`)
2512
+ }
2513
+ )
2514
+ ] }),
2515
+ run.actionError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-destructive", children: run.actionError }),
2516
+ renderStepNote?.(step, run)
2517
+ ] }) : step.kind === "review" ? /* @__PURE__ */ jsxRuntime.jsxs(ui.Card, { className: ui.cn(box, "space-y-4"), "data-testid": tid(step.id), children: [
2518
+ /* @__PURE__ */ jsxRuntime.jsx(StepHeading, { step, icon: icon(step.icon) }),
2519
+ /* @__PURE__ */ jsxRuntime.jsx(SentBackNote, { state: run.stateOf(step.id), l: pl, testId: tid(step.id) }),
2520
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "whitespace-pre-line text-sm text-muted-foreground", children: reviewInstructions(step, run.inputs) }),
2521
+ /* @__PURE__ */ jsxRuntime.jsx(AssigneeLine, { run, stepId: step.id, l: pl, testId: tid(step.id) }),
2522
+ !(run.phaseOf(step.id) === "done" && run.stateOf(step.id)?.by) && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm", "data-testid": tid(`${step.id}-status`), children: run.phaseOf(step.id) === "done" ? l.approved : run.phaseOf(step.id) === "skipped" ? l.skipped : l.awaitingReview }),
2523
+ (step.fields ?? []).length > 0 && run.phaseOf(step.id) === "ready" && /* @__PURE__ */ jsxRuntime.jsx(
2524
+ SchemaForm,
2525
+ {
2526
+ fields: step.fields ?? [],
2527
+ values: run.inputs,
2528
+ onChange: run.setInput,
2529
+ errors: run.errors,
2530
+ renderScope,
2531
+ renderDocuments,
2532
+ renderIcon,
2533
+ people,
2534
+ testIdPrefix: tid("field")
2535
+ }
2536
+ ),
2433
2537
  /* @__PURE__ */ jsxRuntime.jsx(
2434
- chunkDETZZBG2_cjs.UploadDropzone,
2538
+ ApprovalEvidence,
2435
2539
  {
2436
- onFiles: (picked) => void onUpload?.(picked, step),
2437
- uploading,
2438
- disabled: !onUpload,
2439
- accept: step.accept,
2440
- title: step.title,
2441
- description: step.description,
2442
- hint: step.hint,
2443
- testId: tid(`${step.id}-drop`)
2540
+ run,
2541
+ step,
2542
+ actions,
2543
+ nameOfDoc,
2544
+ l: pl,
2545
+ testId: tid(step.id)
2444
2546
  }
2445
2547
  ),
2446
- files && /* @__PURE__ */ jsxRuntime.jsx(
2447
- UploadFiles,
2548
+ run.phaseOf(step.id) === "ready" && renderReview?.(step),
2549
+ /* @__PURE__ */ jsxRuntime.jsx(SendBackControl, { run, step, l: pl, testId: tid(step.id) }),
2550
+ run.actionError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-destructive", children: run.actionError }),
2551
+ renderStepNote?.(step, run)
2552
+ ] }) : step.kind === "action" ? /* @__PURE__ */ jsxRuntime.jsxs(ui.Card, { className: ui.cn(box, "space-y-4"), "data-testid": tid(step.id), children: [
2553
+ /* @__PURE__ */ jsxRuntime.jsx(
2554
+ ActionStepBody,
2448
2555
  {
2449
- onRetry: onRetryUpload,
2450
- onRemove: onRemoveUpload,
2451
- added,
2452
- others: files.filter((f) => f.addedFor !== step.id),
2453
- l,
2454
- testId: tid(`${step.id}-files`)
2556
+ step,
2557
+ run,
2558
+ actions,
2559
+ nameOfDoc,
2560
+ heading: /* @__PURE__ */ jsxRuntime.jsx(StepHeading, { step, icon: icon(step.icon) }),
2561
+ l: pl,
2562
+ testId: tid(step.id)
2455
2563
  }
2456
- )
2457
- ] }),
2458
- run.actionError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-destructive", children: run.actionError }),
2459
- renderStepNote?.(step, run)
2460
- ] }) : step.kind === "review" ? /* @__PURE__ */ jsxRuntime.jsxs(ui.Card, { className: ui.cn(box, "space-y-4"), "data-testid": tid(step.id), children: [
2461
- /* @__PURE__ */ jsxRuntime.jsx(StepHeading, { step, icon: icon(step.icon) }),
2462
- /* @__PURE__ */ jsxRuntime.jsx(SentBackNote, { state: run.stateOf(step.id), l: pl, testId: tid(step.id) }),
2463
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "whitespace-pre-line text-sm text-muted-foreground", children: reviewInstructions(step, run.inputs) }),
2464
- /* @__PURE__ */ jsxRuntime.jsx(AssigneeLine, { run, stepId: step.id, l: pl, testId: tid(step.id) }),
2465
- !(run.phaseOf(step.id) === "done" && run.stateOf(step.id)?.by) && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm", "data-testid": tid(`${step.id}-status`), children: run.phaseOf(step.id) === "done" ? l.approved : run.phaseOf(step.id) === "skipped" ? l.skipped : l.awaitingReview }),
2466
- (step.fields ?? []).length > 0 && run.phaseOf(step.id) === "ready" && /* @__PURE__ */ jsxRuntime.jsx(
2467
- SchemaForm,
2468
- {
2469
- fields: step.fields ?? [],
2470
- values: run.inputs,
2471
- onChange: run.setInput,
2472
- errors: run.errors,
2473
- renderScope,
2474
- renderDocuments,
2475
- renderIcon,
2476
- people,
2477
- testIdPrefix: tid("field")
2478
- }
2479
- ),
2480
- /* @__PURE__ */ jsxRuntime.jsx(
2481
- ApprovalEvidence,
2482
- {
2483
- run,
2484
- step,
2485
- actions,
2486
- nameOfDoc,
2487
- l: pl,
2488
- testId: tid(step.id)
2489
- }
2490
- ),
2491
- run.phaseOf(step.id) === "ready" && renderReview?.(step),
2492
- /* @__PURE__ */ jsxRuntime.jsx(SendBackControl, { run, step, l: pl, testId: tid(step.id) }),
2493
- run.actionError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-destructive", children: run.actionError }),
2494
- renderStepNote?.(step, run)
2495
- ] }) : step.kind === "action" ? /* @__PURE__ */ jsxRuntime.jsxs(ui.Card, { className: ui.cn(box, "space-y-4"), "data-testid": tid(step.id), children: [
2496
- /* @__PURE__ */ jsxRuntime.jsx(
2497
- ActionStepBody,
2564
+ ),
2565
+ run.actionError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-destructive", children: run.actionError }),
2566
+ renderStepNote?.(step, run)
2567
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(
2568
+ AgentStepBody,
2498
2569
  {
2499
2570
  step,
2500
2571
  run,
2501
- actions,
2572
+ renderAgentOutput,
2573
+ icon: icon(step.icon),
2574
+ renderStepNote,
2575
+ compact: compact3,
2502
2576
  nameOfDoc,
2503
- heading: /* @__PURE__ */ jsxRuntime.jsx(StepHeading, { step, icon: icon(step.icon) }),
2504
- l: pl,
2505
- testId: tid(step.id)
2577
+ extra: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2578
+ /* @__PURE__ */ jsxRuntime.jsx(SentBackNote, { state: run.stateOf(step.id), l: pl, testId: tid(step.id) }),
2579
+ /* @__PURE__ */ jsxRuntime.jsx(
2580
+ RedlineOpen,
2581
+ {
2582
+ step,
2583
+ state: run.stateOf(step.id),
2584
+ actions,
2585
+ l: pl,
2586
+ testId: tid(step.id)
2587
+ }
2588
+ )
2589
+ ] }),
2590
+ l,
2591
+ tid
2506
2592
  }
2507
- ),
2508
- run.actionError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-destructive", children: run.actionError }),
2509
- renderStepNote?.(step, run)
2510
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(
2511
- AgentStepBody,
2512
- {
2513
- step,
2514
- run,
2515
- renderAgentOutput,
2516
- icon: icon(step.icon),
2517
- renderStepNote,
2518
- compact: compact3,
2519
- nameOfDoc,
2520
- extra: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2521
- /* @__PURE__ */ jsxRuntime.jsx(SentBackNote, { state: run.stateOf(step.id), l: pl, testId: tid(step.id) }),
2522
- /* @__PURE__ */ jsxRuntime.jsx(
2523
- RedlineOpen,
2524
- {
2525
- step,
2526
- state: run.stateOf(step.id),
2527
- actions,
2528
- l: pl,
2529
- testId: tid(step.id)
2530
- }
2531
- )
2532
- ] }),
2533
- l,
2534
- tid
2535
- }
2536
- ) }, step.id) : null,
2593
+ )
2594
+ ] }, step.id) : null,
2537
2595
  !isComplete && /* @__PURE__ */ jsxRuntime.jsxs(
2538
2596
  "div",
2539
2597
  {
@@ -2561,7 +2619,7 @@ function WorkflowRunner({
2561
2619
  {
2562
2620
  className: ui.cn("flex items-center gap-2", compact3 && "ml-auto flex-wrap justify-end"),
2563
2621
  children: [
2564
- step && action !== "skip" && // A step that commits (creates the matter, starts the thread) is what the run stands on.
2622
+ step && // A step that commits (creates the matter, starts the thread) is what the run stands on.
2565
2623
  !step.commit && ["ready", "blocked", "failed"].includes(run.phaseOf(step.id)) && /* @__PURE__ */ jsxRuntime.jsx(
2566
2624
  ui.Button,
2567
2625
  {
@@ -2752,7 +2810,7 @@ function AgentStepBody({
2752
2810
  " ",
2753
2811
  l.branch
2754
2812
  ] }),
2755
- (phase === "ready" || phase === "running") && !state?.text && /* @__PURE__ */ jsxRuntime.jsxs(
2813
+ (phase === "running" || phase === "ready" && !run.needsStart) && !state?.text && /* @__PURE__ */ jsxRuntime.jsxs(
2756
2814
  "p",
2757
2815
  {
2758
2816
  className: "flex items-center gap-2 text-sm text-muted-foreground",
@@ -2779,7 +2837,7 @@ function AgentStepBody({
2779
2837
  }
2780
2838
  ),
2781
2839
  phase === "failed" && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-destructive", "data-testid": tid(`${step.id}-failed`), children: state?.error || l.failed }),
2782
- phase === "skipped" && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: l.skipped }),
2840
+ phase === "skipped" && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", "data-testid": tid(`${step.id}-skipped`), children: state?.skippedAfterFailure ? l.skippedAfterFailure.replace("{error}", state.error ? `: ${state.error}` : "") : l.skipped }),
2783
2841
  extra
2784
2842
  ] });
2785
2843
  if (step.output === "artifact" && !compact3) {
@@ -2806,6 +2864,48 @@ function AgentStepBody({
2806
2864
  renderStepNote?.(step, run)
2807
2865
  ] });
2808
2866
  }
2867
+ function StepNotices({
2868
+ run,
2869
+ step,
2870
+ l,
2871
+ tid
2872
+ }) {
2873
+ const notStarted = !isPersonStep(step) && run.needsStart && run.phaseOf(step.id) === "ready";
2874
+ const failed = run.failedUpstreamOf(step.id);
2875
+ if (!notStarted && failed.length === 0) return null;
2876
+ const why = (error) => error ? `: ${error}` : "";
2877
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", "data-testid": tid(`${step.id}-notices`), children: [
2878
+ notStarted && /* @__PURE__ */ jsxRuntime.jsxs(
2879
+ "p",
2880
+ {
2881
+ className: ui.cn(
2882
+ "flex items-start gap-2 text-sm",
2883
+ run.runError ? "text-destructive" : "text-muted-foreground"
2884
+ ),
2885
+ "data-testid": tid(`${step.id}-not-started`),
2886
+ children: [
2887
+ run.runError && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertTriangle, { className: "mt-0.5 size-4 shrink-0" }),
2888
+ run.runError || l.notStarted
2889
+ ]
2890
+ }
2891
+ ),
2892
+ failed.map(({ step: s, state }) => /* @__PURE__ */ jsxRuntime.jsxs(
2893
+ "p",
2894
+ {
2895
+ className: ui.cn(
2896
+ "flex items-start gap-2 rounded-md border px-3 py-2 text-sm",
2897
+ state.status === "failed" ? "border-destructive/40 text-destructive" : "border-amber-500/40 text-amber-700 dark:text-amber-300"
2898
+ ),
2899
+ "data-testid": tid(`${step.id}-upstream-${s.id}`),
2900
+ children: [
2901
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertTriangle, { className: "mt-0.5 size-4 shrink-0" }),
2902
+ (state.status === "failed" ? l.upstreamFailed : l.upstreamSkippedAfterFailure).replace("{step}", s.title).replace("{error}", why(state.error))
2903
+ ]
2904
+ },
2905
+ s.id
2906
+ ))
2907
+ ] });
2908
+ }
2809
2909
 
2810
2910
  exports.ActionStepBody = ActionStepBody;
2811
2911
  exports.ApprovalEvidence = ApprovalEvidence;
@@ -2887,5 +2987,5 @@ exports.workflowFromFrontmatter = workflowFromFrontmatter;
2887
2987
  exports.workflowSteps = workflowSteps;
2888
2988
  exports.workflowsAccepting = workflowsAccepting;
2889
2989
  exports.workflowsForHost = workflowsForHost;
2890
- //# sourceMappingURL=chunk-RYYYHPFU.cjs.map
2891
- //# sourceMappingURL=chunk-RYYYHPFU.cjs.map
2990
+ //# sourceMappingURL=chunk-RZUMQM7W.cjs.map
2991
+ //# sourceMappingURL=chunk-RZUMQM7W.cjs.map