@arbidocs/blocks 0.4.80 → 0.4.81

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 (65) hide show
  1. package/dist/agents/index.cjs +280 -280
  2. package/dist/agents/index.js +5 -5
  3. package/dist/agents/workflows/WorkflowRunner.d.ts +35 -3
  4. package/dist/agents/workflows/run.d.ts +10 -0
  5. package/dist/agents/workflows/types.d.ts +4 -2
  6. package/dist/chat/index.cjs +125 -125
  7. package/dist/chat/index.js +3 -3
  8. package/dist/{chunk-MFDGNUKX.cjs → chunk-B3WCKBJ7.cjs} +3 -3
  9. package/dist/{chunk-MFDGNUKX.cjs.map → chunk-B3WCKBJ7.cjs.map} +1 -1
  10. package/dist/{chunk-2FEQGDW2.cjs → chunk-BX7JWZWE.cjs} +97 -5
  11. package/dist/chunk-BX7JWZWE.cjs.map +1 -0
  12. package/dist/{chunk-P5ST47VY.js → chunk-DDF5GPIJ.js} +3 -3
  13. package/dist/{chunk-P5ST47VY.js.map → chunk-DDF5GPIJ.js.map} +1 -1
  14. package/dist/{chunk-PFA43QNX.js → chunk-EWSEQEPL.js} +3 -3
  15. package/dist/{chunk-PFA43QNX.js.map → chunk-EWSEQEPL.js.map} +1 -1
  16. package/dist/{chunk-LGDX34UR.cjs → chunk-F5WIETZY.cjs} +66 -51
  17. package/dist/chunk-F5WIETZY.cjs.map +1 -0
  18. package/dist/{chunk-E367ZUHE.js → chunk-GJV2G4FC.js} +3 -3
  19. package/dist/{chunk-E367ZUHE.js.map → chunk-GJV2G4FC.js.map} +1 -1
  20. package/dist/{chunk-A5WCK6ZG.js → chunk-I56ORHPY.js} +28 -13
  21. package/dist/chunk-I56ORHPY.js.map +1 -0
  22. package/dist/{chunk-LBE36YNZ.js → chunk-ICBAFX5B.js} +3 -3
  23. package/dist/{chunk-LBE36YNZ.js.map → chunk-ICBAFX5B.js.map} +1 -1
  24. package/dist/{chunk-C3DRLFU7.cjs → chunk-IF6VAYIA.cjs} +5 -5
  25. package/dist/{chunk-C3DRLFU7.cjs.map → chunk-IF6VAYIA.cjs.map} +1 -1
  26. package/dist/{chunk-O5NDG4EA.cjs → chunk-MP6FK43E.cjs} +3 -3
  27. package/dist/{chunk-O5NDG4EA.cjs.map → chunk-MP6FK43E.cjs.map} +1 -1
  28. package/dist/{chunk-QFA3NCWL.js → chunk-THCFZKTM.js} +95 -6
  29. package/dist/chunk-THCFZKTM.js.map +1 -0
  30. package/dist/{chunk-HUJLKDWX.cjs → chunk-XMBYDLZQ.cjs} +4 -4
  31. package/dist/{chunk-HUJLKDWX.cjs.map → chunk-XMBYDLZQ.cjs.map} +1 -1
  32. package/dist/{chunk-WDD255XQ.js → chunk-XQDM6T6C.js} +3 -3
  33. package/dist/{chunk-WDD255XQ.js.map → chunk-XQDM6T6C.js.map} +1 -1
  34. package/dist/{chunk-ZV3BKLFY.cjs → chunk-Z5VUZ6YD.cjs} +3 -3
  35. package/dist/{chunk-ZV3BKLFY.cjs.map → chunk-Z5VUZ6YD.cjs.map} +1 -1
  36. package/dist/connect/index.cjs +154 -75
  37. package/dist/connect/index.cjs.map +1 -1
  38. package/dist/connect/index.js +106 -27
  39. package/dist/connect/index.js.map +1 -1
  40. package/dist/connection/ConnectedWorkflowRunner.d.ts +16 -5
  41. package/dist/facts/index.cjs +2 -2
  42. package/dist/facts/index.js +2 -2
  43. package/dist/files/index.cjs +2 -2
  44. package/dist/files/index.js +2 -2
  45. package/dist/home/index.cjs +18 -18
  46. package/dist/home/index.js +4 -4
  47. package/dist/index.cjs +503 -503
  48. package/dist/index.js +9 -9
  49. package/dist/retrieval/index.cjs +1 -1
  50. package/dist/retrieval/index.js +1 -1
  51. package/dist/settings/index.cjs +35 -35
  52. package/dist/settings/index.js +2 -2
  53. package/dist/shell/index.cjs +1 -1
  54. package/dist/shell/index.js +1 -1
  55. package/dist/studio/index.cjs +5 -5
  56. package/dist/studio/index.js +4 -4
  57. package/dist/workflow-canvas/index.cjs +48 -48
  58. package/dist/workflow-canvas/index.js +5 -5
  59. package/dist/workspaces/index.cjs +2 -2
  60. package/dist/workspaces/index.js +2 -2
  61. package/package.json +4 -4
  62. package/dist/chunk-2FEQGDW2.cjs.map +0 -1
  63. package/dist/chunk-A5WCK6ZG.js.map +0 -1
  64. package/dist/chunk-LGDX34UR.cjs.map +0 -1
  65. package/dist/chunk-QFA3NCWL.js.map +0 -1
@@ -627,6 +627,15 @@ var ACTION_TYPES = ["sign", "email_draft", "tabular_review"];
627
627
  var asAction = (v) => ACTION_TYPES.includes(v) ? v : void 0;
628
628
  var asRecord = (v) => v && typeof v === "object" && !Array.isArray(v) ? v : void 0;
629
629
  var asStrings = (v) => Array.isArray(v) ? v.filter((x) => typeof x === "string") : void 0;
630
+ function waitingDocuments(state) {
631
+ return state?.status === "waiting" ? asStrings(state.waiting?.documents) ?? [] : [];
632
+ }
633
+ function eventWaitingDocuments(detail) {
634
+ return asStrings(asRecord(detail?.waiting)?.documents);
635
+ }
636
+ function waitingForDocumentsText(count) {
637
+ return `Waiting for ${count} ${count === 1 ? "document" : "documents"} to finish processing`;
638
+ }
630
639
  function reopenedBy(detail) {
631
640
  const to = str2(detail.to);
632
641
  return asStrings(detail.reopened) ?? (to ? [to] : []);
@@ -2310,6 +2319,17 @@ var DEFAULT_WORKFLOW_RUNNER_LABELS = {
2310
2319
  fileReady: "Ready",
2311
2320
  fileFailed: "Could not be read",
2312
2321
  readingFiles: "Reading {current} of {count} files\u2026",
2322
+ uploadingFiles: "Uploading {count} files\u2026",
2323
+ uploadingFile: "Uploading 1 file\u2026",
2324
+ uploadingAny: "Uploading\u2026",
2325
+ uploadsFailed: "Retry or remove the {count} files that did not upload",
2326
+ uploadFailed: "Retry or remove the file that did not upload",
2327
+ fileUploading: "Uploading\u2026",
2328
+ fileUploadFailed: "Did not upload",
2329
+ retryUpload: "Retry",
2330
+ removeUpload: "Remove",
2331
+ waitingForDocuments: "Waiting for {count} documents to finish processing",
2332
+ waitingForDocument: "Waiting for 1 document to finish processing",
2313
2333
  markSent: "Mark as sent"
2314
2334
  };
2315
2335
  function WorkflowRunner({
@@ -2320,6 +2340,8 @@ function WorkflowRunner({
2320
2340
  onUpload,
2321
2341
  uploading = false,
2322
2342
  files,
2343
+ onRetryUpload,
2344
+ onRemoveUpload,
2323
2345
  renderUpload,
2324
2346
  renderStepNote,
2325
2347
  renderComplete,
@@ -2347,7 +2369,11 @@ function WorkflowRunner({
2347
2369
  const added = step?.kind === "upload" ? (files ?? []).filter((f) => f.addedFor === step.id) : [];
2348
2370
  const unread = added.filter((f) => f.status === "processing").length;
2349
2371
  const reading = action === "complete" && unread > 0;
2350
- const nextLabel = 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) ? l.working : (step && !run.isLocked(step.id) ? step.nextLabel : void 0) ?? l.next;
2372
+ const sending = added.filter((f) => f.status === "uploading").length;
2373
+ const unsent = added.filter((f) => f.status === "upload-failed").length;
2374
+ const uploadHold = step?.kind === "upload" && (sending > 0 || uploading || unsent > 0);
2375
+ const docsWait = !!step && waitingDocuments(run.stateOf(step.id)).length > 0;
2376
+ 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;
2351
2377
  return /* @__PURE__ */ jsxs("div", { className: cn(compact3 ? "space-y-3" : "space-y-6", className), "data-testid": testIdPrefix, children: [
2352
2378
  !hideStepBar && /* @__PURE__ */ jsx(
2353
2379
  WorkflowStepBar,
@@ -2418,6 +2444,8 @@ function WorkflowRunner({
2418
2444
  files && /* @__PURE__ */ jsx(
2419
2445
  UploadFiles,
2420
2446
  {
2447
+ onRetry: onRetryUpload,
2448
+ onRemove: onRemoveUpload,
2421
2449
  added,
2422
2450
  others: files.filter((f) => f.addedFor !== step.id),
2423
2451
  l,
@@ -2486,6 +2514,7 @@ function WorkflowRunner({
2486
2514
  icon: icon(step.icon),
2487
2515
  renderStepNote,
2488
2516
  compact: compact3,
2517
+ nameOfDoc,
2489
2518
  extra: /* @__PURE__ */ jsxs(Fragment, { children: [
2490
2519
  /* @__PURE__ */ jsx(SentBackNote, { state: run.stateOf(step.id), l: pl, testId: tid(step.id) }),
2491
2520
  /* @__PURE__ */ jsx(
@@ -2545,11 +2574,11 @@ function WorkflowRunner({
2545
2574
  Button,
2546
2575
  {
2547
2576
  onClick: () => void run.next(),
2548
- disabled: action === "wait" || reading,
2577
+ disabled: action === "wait" || reading || uploadHold,
2549
2578
  "data-testid": tid("next"),
2550
2579
  children: [
2551
2580
  nextLabel,
2552
- reading || action === "wait" && (run.isRunning || run.busy) ? /* @__PURE__ */ jsx(Loader2, { className: "size-4 animate-spin" }) : /* @__PURE__ */ jsx(ArrowRight, { className: "size-4" })
2581
+ reading || uploadHold && unsent === 0 || action === "wait" && (run.isRunning || run.busy || docsWait) ? /* @__PURE__ */ jsx(Loader2, { className: "size-4 animate-spin" }) : /* @__PURE__ */ jsx(ArrowRight, { className: "size-4" })
2553
2582
  ]
2554
2583
  }
2555
2584
  )
@@ -2564,6 +2593,8 @@ function WorkflowRunner({
2564
2593
  function UploadFiles({
2565
2594
  added,
2566
2595
  others,
2596
+ onRetry,
2597
+ onRemove,
2567
2598
  l,
2568
2599
  testId
2569
2600
  }) {
@@ -2577,6 +2608,47 @@ function UploadFiles({
2577
2608
  children: [
2578
2609
  /* @__PURE__ */ jsx(FileText, { className: "size-3.5 shrink-0 text-primary" }),
2579
2610
  /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", title: f.name, children: f.name }),
2611
+ f.status === "uploading" && /* @__PURE__ */ jsxs("span", { className: "flex shrink-0 items-center gap-1 text-xs", children: [
2612
+ /* @__PURE__ */ jsx(Loader2, { className: "size-3 animate-spin" }),
2613
+ " ",
2614
+ l.fileUploading
2615
+ ] }),
2616
+ f.status === "upload-failed" && /* @__PURE__ */ jsxs("span", { className: "flex shrink-0 items-center gap-1 text-xs text-destructive", role: "alert", children: [
2617
+ /* @__PURE__ */ jsx(AlertTriangle, { className: "size-3" }),
2618
+ " ",
2619
+ l.fileUploadFailed,
2620
+ f.error ? `: ${f.error}` : "",
2621
+ onRetry && /* @__PURE__ */ jsxs(
2622
+ Button,
2623
+ {
2624
+ variant: "ghost",
2625
+ size: "sm",
2626
+ className: "h-6 px-2",
2627
+ onClick: () => onRetry(f),
2628
+ "data-testid": `${testId}-file-${f.id}-retry`,
2629
+ children: [
2630
+ /* @__PURE__ */ jsx(RotateCw, { className: "size-3" }),
2631
+ " ",
2632
+ l.retryUpload
2633
+ ]
2634
+ }
2635
+ ),
2636
+ onRemove && /* @__PURE__ */ jsxs(
2637
+ Button,
2638
+ {
2639
+ variant: "ghost",
2640
+ size: "sm",
2641
+ className: "h-6 px-2",
2642
+ onClick: () => onRemove(f),
2643
+ "data-testid": `${testId}-file-${f.id}-remove`,
2644
+ children: [
2645
+ /* @__PURE__ */ jsx(X, { className: "size-3" }),
2646
+ " ",
2647
+ l.removeUpload
2648
+ ]
2649
+ }
2650
+ )
2651
+ ] }),
2580
2652
  f.status === "processing" && /* @__PURE__ */ jsxs("span", { className: "flex shrink-0 items-center gap-1 text-xs", children: [
2581
2653
  /* @__PURE__ */ jsx(Loader2, { className: "size-3 animate-spin" }),
2582
2654
  " ",
@@ -2646,11 +2718,14 @@ function AgentStepBody({
2646
2718
  renderStepNote,
2647
2719
  extra,
2648
2720
  compact: compact3,
2721
+ nameOfDoc,
2649
2722
  l,
2650
2723
  tid
2651
2724
  }) {
2652
2725
  const state = run.stateOf(step.id);
2653
2726
  const phase = run.phaseOf(step.id);
2727
+ const pending = waitingDocuments(state);
2728
+ const pendingNames = pending.flatMap((ref) => nameOfDoc?.(splitDocRef(ref).id) ?? []);
2654
2729
  const header = /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-3", children: [
2655
2730
  /* @__PURE__ */ jsx(StepHeading, { step, icon }),
2656
2731
  phase === "failed" && /* @__PURE__ */ jsx("div", { className: "flex shrink-0 items-center gap-2", children: run.retry && /* @__PURE__ */ jsxs(
@@ -2687,6 +2762,20 @@ function AgentStepBody({
2687
2762
  ]
2688
2763
  }
2689
2764
  ),
2765
+ pending.length > 0 && /* @__PURE__ */ jsxs(
2766
+ "div",
2767
+ {
2768
+ className: "space-y-0.5 text-sm text-muted-foreground",
2769
+ "data-testid": tid(`${step.id}-waiting-documents`),
2770
+ children: [
2771
+ /* @__PURE__ */ jsxs("p", { className: "flex items-center gap-2", children: [
2772
+ /* @__PURE__ */ jsx(Hourglass, { className: "size-4" }),
2773
+ pending.length === 1 ? l.waitingForDocument : l.waitingForDocuments.replace("{count}", String(pending.length))
2774
+ ] }),
2775
+ pendingNames.length > 0 && /* @__PURE__ */ jsx("p", { className: "pl-6 text-xs", children: pendingNames.join(", ") })
2776
+ ]
2777
+ }
2778
+ ),
2690
2779
  phase === "failed" && /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", "data-testid": tid(`${step.id}-failed`), children: state?.error || l.failed }),
2691
2780
  phase === "skipped" && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: l.skipped }),
2692
2781
  extra
@@ -2716,6 +2805,6 @@ function AgentStepBody({
2716
2805
  ] });
2717
2806
  }
2718
2807
 
2719
- export { ActionStepBody, ApprovalEvidence, AssigneeLine, DEFAULT_ASSIGNEE_WORDING, DEFAULT_SCHEMA_FORM_LABELS, DEFAULT_STEP_BAR_LABELS, DEFAULT_WORKFLOW_RUNNER_LABELS, DEFAULT_WORKFLOW_STEP_PARTS_LABELS, EMPTY_WORKFLOW_SCOPE, PhaseMark, SKILL_PROMPT_FALLBACK_PLACEHOLDER, SKILL_PROMPT_LABEL, STEP_EXTRA, STEP_LABEL, STEP_LABEL_MAX, STEP_LABEL_MAX_CURRENT, STEP_PILL, SchemaForm, SendBackControl, StepBarFrame, WorkflowRunner, WorkflowStepBar, activeStepId, assigneeName, buildLaunch, canAssign, composeStepPrompt, composeWorkflowPrompt, defaultInputs, dependsOn, fieldToFrontmatter, fillRunText, fillStepInputs, fromPlanAssignee, fromPlanDocumentRef, fromPlanSteps, initialRunInputs, inputsFromContext, isEmptyWorkflowScope, isIncompleteSignal, isPersonAction, isPersonStep, isRunFinished, isSteppedWorkflow, isWorkflowScope, layoutFromPlanSteps, nextAction, orderSteps, promptFieldName, reviewInstructions, runFields, runFieldsOf, runThreadTitle, sendBackTargets, skillToWorkflow, splitDocRef, stepConfigProblems, stepDependencies, stepFields, stepLevels, stepPhase, stepPillTone, stepStatesFromActivity, stepWindow, toPlanAssignee, toPlanDocumentRef, toPlanSteps, upstreamSteps, useWorkflowView, validateInputs, validateStep, validateWorkflowGraph, workflowAccepts, workflowFromFrontmatter, workflowSteps, workflowsAccepting, workflowsForHost };
2720
- //# sourceMappingURL=chunk-QFA3NCWL.js.map
2721
- //# sourceMappingURL=chunk-QFA3NCWL.js.map
2808
+ export { ActionStepBody, ApprovalEvidence, AssigneeLine, DEFAULT_ASSIGNEE_WORDING, DEFAULT_SCHEMA_FORM_LABELS, DEFAULT_STEP_BAR_LABELS, DEFAULT_WORKFLOW_RUNNER_LABELS, DEFAULT_WORKFLOW_STEP_PARTS_LABELS, EMPTY_WORKFLOW_SCOPE, PhaseMark, SKILL_PROMPT_FALLBACK_PLACEHOLDER, SKILL_PROMPT_LABEL, STEP_EXTRA, STEP_LABEL, STEP_LABEL_MAX, STEP_LABEL_MAX_CURRENT, STEP_PILL, SchemaForm, SendBackControl, StepBarFrame, WorkflowRunner, WorkflowStepBar, activeStepId, assigneeName, buildLaunch, canAssign, composeStepPrompt, composeWorkflowPrompt, defaultInputs, dependsOn, eventWaitingDocuments, fieldToFrontmatter, fillRunText, fillStepInputs, fromPlanAssignee, fromPlanDocumentRef, fromPlanSteps, initialRunInputs, inputsFromContext, isEmptyWorkflowScope, isIncompleteSignal, isPersonAction, isPersonStep, isRunFinished, isSteppedWorkflow, isWorkflowScope, layoutFromPlanSteps, nextAction, orderSteps, promptFieldName, reviewInstructions, runFields, runFieldsOf, runThreadTitle, sendBackTargets, skillToWorkflow, splitDocRef, stepConfigProblems, stepDependencies, stepFields, stepLevels, stepPhase, stepPillTone, stepStatesFromActivity, stepWindow, toPlanAssignee, toPlanDocumentRef, toPlanSteps, upstreamSteps, useWorkflowView, validateInputs, validateStep, validateWorkflowGraph, waitingDocuments, waitingForDocumentsText, workflowAccepts, workflowFromFrontmatter, workflowSteps, workflowsAccepting, workflowsForHost };
2809
+ //# sourceMappingURL=chunk-THCFZKTM.js.map
2810
+ //# sourceMappingURL=chunk-THCFZKTM.js.map