@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
@@ -629,6 +629,15 @@ var ACTION_TYPES = ["sign", "email_draft", "tabular_review"];
629
629
  var asAction = (v) => ACTION_TYPES.includes(v) ? v : void 0;
630
630
  var asRecord = (v) => v && typeof v === "object" && !Array.isArray(v) ? v : void 0;
631
631
  var asStrings = (v) => Array.isArray(v) ? v.filter((x) => typeof x === "string") : void 0;
632
+ function waitingDocuments(state) {
633
+ return state?.status === "waiting" ? asStrings(state.waiting?.documents) ?? [] : [];
634
+ }
635
+ function eventWaitingDocuments(detail) {
636
+ return asStrings(asRecord(detail?.waiting)?.documents);
637
+ }
638
+ function waitingForDocumentsText(count) {
639
+ return `Waiting for ${count} ${count === 1 ? "document" : "documents"} to finish processing`;
640
+ }
632
641
  function reopenedBy(detail) {
633
642
  const to = str2(detail.to);
634
643
  return asStrings(detail.reopened) ?? (to ? [to] : []);
@@ -2312,6 +2321,17 @@ var DEFAULT_WORKFLOW_RUNNER_LABELS = {
2312
2321
  fileReady: "Ready",
2313
2322
  fileFailed: "Could not be read",
2314
2323
  readingFiles: "Reading {current} of {count} files\u2026",
2324
+ uploadingFiles: "Uploading {count} files\u2026",
2325
+ uploadingFile: "Uploading 1 file\u2026",
2326
+ uploadingAny: "Uploading\u2026",
2327
+ uploadsFailed: "Retry or remove the {count} files that did not upload",
2328
+ uploadFailed: "Retry or remove the file that did not upload",
2329
+ fileUploading: "Uploading\u2026",
2330
+ fileUploadFailed: "Did not upload",
2331
+ retryUpload: "Retry",
2332
+ removeUpload: "Remove",
2333
+ waitingForDocuments: "Waiting for {count} documents to finish processing",
2334
+ waitingForDocument: "Waiting for 1 document to finish processing",
2315
2335
  markSent: "Mark as sent"
2316
2336
  };
2317
2337
  function WorkflowRunner({
@@ -2322,6 +2342,8 @@ function WorkflowRunner({
2322
2342
  onUpload,
2323
2343
  uploading = false,
2324
2344
  files,
2345
+ onRetryUpload,
2346
+ onRemoveUpload,
2325
2347
  renderUpload,
2326
2348
  renderStepNote,
2327
2349
  renderComplete,
@@ -2349,7 +2371,11 @@ function WorkflowRunner({
2349
2371
  const added = step?.kind === "upload" ? (files ?? []).filter((f) => f.addedFor === step.id) : [];
2350
2372
  const unread = added.filter((f) => f.status === "processing").length;
2351
2373
  const reading = action === "complete" && unread > 0;
2352
- 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;
2374
+ const sending = added.filter((f) => f.status === "uploading").length;
2375
+ const unsent = added.filter((f) => f.status === "upload-failed").length;
2376
+ const uploadHold = step?.kind === "upload" && (sending > 0 || uploading || unsent > 0);
2377
+ 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;
2353
2379
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cn(compact3 ? "space-y-3" : "space-y-6", className), "data-testid": testIdPrefix, children: [
2354
2380
  !hideStepBar && /* @__PURE__ */ jsxRuntime.jsx(
2355
2381
  WorkflowStepBar,
@@ -2420,6 +2446,8 @@ function WorkflowRunner({
2420
2446
  files && /* @__PURE__ */ jsxRuntime.jsx(
2421
2447
  UploadFiles,
2422
2448
  {
2449
+ onRetry: onRetryUpload,
2450
+ onRemove: onRemoveUpload,
2423
2451
  added,
2424
2452
  others: files.filter((f) => f.addedFor !== step.id),
2425
2453
  l,
@@ -2488,6 +2516,7 @@ function WorkflowRunner({
2488
2516
  icon: icon(step.icon),
2489
2517
  renderStepNote,
2490
2518
  compact: compact3,
2519
+ nameOfDoc,
2491
2520
  extra: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2492
2521
  /* @__PURE__ */ jsxRuntime.jsx(SentBackNote, { state: run.stateOf(step.id), l: pl, testId: tid(step.id) }),
2493
2522
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -2547,11 +2576,11 @@ function WorkflowRunner({
2547
2576
  ui.Button,
2548
2577
  {
2549
2578
  onClick: () => void run.next(),
2550
- disabled: action === "wait" || reading,
2579
+ disabled: action === "wait" || reading || uploadHold,
2551
2580
  "data-testid": tid("next"),
2552
2581
  children: [
2553
2582
  nextLabel,
2554
- reading || action === "wait" && (run.isRunning || run.busy) ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-4 animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowRight, { className: "size-4" })
2583
+ reading || uploadHold && unsent === 0 || action === "wait" && (run.isRunning || run.busy || docsWait) ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-4 animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowRight, { className: "size-4" })
2555
2584
  ]
2556
2585
  }
2557
2586
  )
@@ -2566,6 +2595,8 @@ function WorkflowRunner({
2566
2595
  function UploadFiles({
2567
2596
  added,
2568
2597
  others,
2598
+ onRetry,
2599
+ onRemove,
2569
2600
  l,
2570
2601
  testId
2571
2602
  }) {
@@ -2579,6 +2610,47 @@ function UploadFiles({
2579
2610
  children: [
2580
2611
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileText, { className: "size-3.5 shrink-0 text-primary" }),
2581
2612
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 flex-1 truncate", title: f.name, children: f.name }),
2613
+ f.status === "uploading" && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex shrink-0 items-center gap-1 text-xs", children: [
2614
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-3 animate-spin" }),
2615
+ " ",
2616
+ l.fileUploading
2617
+ ] }),
2618
+ f.status === "upload-failed" && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex shrink-0 items-center gap-1 text-xs text-destructive", role: "alert", children: [
2619
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertTriangle, { className: "size-3" }),
2620
+ " ",
2621
+ l.fileUploadFailed,
2622
+ f.error ? `: ${f.error}` : "",
2623
+ onRetry && /* @__PURE__ */ jsxRuntime.jsxs(
2624
+ ui.Button,
2625
+ {
2626
+ variant: "ghost",
2627
+ size: "sm",
2628
+ className: "h-6 px-2",
2629
+ onClick: () => onRetry(f),
2630
+ "data-testid": `${testId}-file-${f.id}-retry`,
2631
+ children: [
2632
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RotateCw, { className: "size-3" }),
2633
+ " ",
2634
+ l.retryUpload
2635
+ ]
2636
+ }
2637
+ ),
2638
+ onRemove && /* @__PURE__ */ jsxRuntime.jsxs(
2639
+ ui.Button,
2640
+ {
2641
+ variant: "ghost",
2642
+ size: "sm",
2643
+ className: "h-6 px-2",
2644
+ onClick: () => onRemove(f),
2645
+ "data-testid": `${testId}-file-${f.id}-remove`,
2646
+ children: [
2647
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-3" }),
2648
+ " ",
2649
+ l.removeUpload
2650
+ ]
2651
+ }
2652
+ )
2653
+ ] }),
2582
2654
  f.status === "processing" && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex shrink-0 items-center gap-1 text-xs", children: [
2583
2655
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-3 animate-spin" }),
2584
2656
  " ",
@@ -2648,11 +2720,14 @@ function AgentStepBody({
2648
2720
  renderStepNote,
2649
2721
  extra,
2650
2722
  compact: compact3,
2723
+ nameOfDoc,
2651
2724
  l,
2652
2725
  tid
2653
2726
  }) {
2654
2727
  const state = run.stateOf(step.id);
2655
2728
  const phase = run.phaseOf(step.id);
2729
+ const pending = waitingDocuments(state);
2730
+ const pendingNames = pending.flatMap((ref) => nameOfDoc?.(splitDocRef(ref).id) ?? []);
2656
2731
  const header = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-3", children: [
2657
2732
  /* @__PURE__ */ jsxRuntime.jsx(StepHeading, { step, icon }),
2658
2733
  phase === "failed" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex shrink-0 items-center gap-2", children: run.retry && /* @__PURE__ */ jsxRuntime.jsxs(
@@ -2689,6 +2764,20 @@ function AgentStepBody({
2689
2764
  ]
2690
2765
  }
2691
2766
  ),
2767
+ pending.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
2768
+ "div",
2769
+ {
2770
+ className: "space-y-0.5 text-sm text-muted-foreground",
2771
+ "data-testid": tid(`${step.id}-waiting-documents`),
2772
+ children: [
2773
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "flex items-center gap-2", children: [
2774
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Hourglass, { className: "size-4" }),
2775
+ pending.length === 1 ? l.waitingForDocument : l.waitingForDocuments.replace("{count}", String(pending.length))
2776
+ ] }),
2777
+ pendingNames.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pl-6 text-xs", children: pendingNames.join(", ") })
2778
+ ]
2779
+ }
2780
+ ),
2692
2781
  phase === "failed" && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-destructive", "data-testid": tid(`${step.id}-failed`), children: state?.error || l.failed }),
2693
2782
  phase === "skipped" && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: l.skipped }),
2694
2783
  extra
@@ -2748,6 +2837,7 @@ exports.composeStepPrompt = composeStepPrompt;
2748
2837
  exports.composeWorkflowPrompt = composeWorkflowPrompt;
2749
2838
  exports.defaultInputs = defaultInputs;
2750
2839
  exports.dependsOn = dependsOn;
2840
+ exports.eventWaitingDocuments = eventWaitingDocuments;
2751
2841
  exports.fieldToFrontmatter = fieldToFrontmatter;
2752
2842
  exports.fillRunText = fillRunText;
2753
2843
  exports.fillStepInputs = fillStepInputs;
@@ -2790,10 +2880,12 @@ exports.useWorkflowView = useWorkflowView;
2790
2880
  exports.validateInputs = validateInputs;
2791
2881
  exports.validateStep = validateStep;
2792
2882
  exports.validateWorkflowGraph = validateWorkflowGraph;
2883
+ exports.waitingDocuments = waitingDocuments;
2884
+ exports.waitingForDocumentsText = waitingForDocumentsText;
2793
2885
  exports.workflowAccepts = workflowAccepts;
2794
2886
  exports.workflowFromFrontmatter = workflowFromFrontmatter;
2795
2887
  exports.workflowSteps = workflowSteps;
2796
2888
  exports.workflowsAccepting = workflowsAccepting;
2797
2889
  exports.workflowsForHost = workflowsForHost;
2798
- //# sourceMappingURL=chunk-2FEQGDW2.cjs.map
2799
- //# sourceMappingURL=chunk-2FEQGDW2.cjs.map
2890
+ //# sourceMappingURL=chunk-BX7JWZWE.cjs.map
2891
+ //# sourceMappingURL=chunk-BX7JWZWE.cjs.map