@arbidocs/blocks 0.4.80 → 0.4.82

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 (75) hide show
  1. package/dist/agents/index.cjs +281 -281
  2. package/dist/agents/index.js +6 -6
  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-5XVWGJ2H.cjs} +3 -3
  9. package/dist/{chunk-MFDGNUKX.cjs.map → chunk-5XVWGJ2H.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-SWSVPQNB.js → chunk-COP6GVKN.js} +148 -5
  13. package/dist/chunk-COP6GVKN.js.map +1 -0
  14. package/dist/{chunk-P5ST47VY.js → chunk-DDF5GPIJ.js} +3 -3
  15. package/dist/{chunk-P5ST47VY.js.map → chunk-DDF5GPIJ.js.map} +1 -1
  16. package/dist/{chunk-PFA43QNX.js → chunk-EWSEQEPL.js} +3 -3
  17. package/dist/{chunk-PFA43QNX.js.map → chunk-EWSEQEPL.js.map} +1 -1
  18. package/dist/{chunk-LBE36YNZ.js → chunk-ICBAFX5B.js} +3 -3
  19. package/dist/{chunk-LBE36YNZ.js.map → chunk-ICBAFX5B.js.map} +1 -1
  20. package/dist/{chunk-C3DRLFU7.cjs → chunk-IF6VAYIA.cjs} +5 -5
  21. package/dist/{chunk-C3DRLFU7.cjs.map → chunk-IF6VAYIA.cjs.map} +1 -1
  22. package/dist/{chunk-A5WCK6ZG.js → chunk-IRG5LPDP.js} +29 -14
  23. package/dist/chunk-IRG5LPDP.js.map +1 -0
  24. package/dist/{chunk-UA2AMDR6.cjs → chunk-LRRJ2HBW.cjs} +151 -3
  25. package/dist/chunk-LRRJ2HBW.cjs.map +1 -0
  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-E367ZUHE.js → chunk-O35LRB3P.js} +3 -3
  29. package/dist/{chunk-E367ZUHE.js.map → chunk-O35LRB3P.js.map} +1 -1
  30. package/dist/{chunk-QFA3NCWL.js → chunk-THCFZKTM.js} +95 -6
  31. package/dist/chunk-THCFZKTM.js.map +1 -0
  32. package/dist/{chunk-LGDX34UR.cjs → chunk-VWK24TEY.cjs} +67 -52
  33. package/dist/chunk-VWK24TEY.cjs.map +1 -0
  34. package/dist/{chunk-HUJLKDWX.cjs → chunk-XMBYDLZQ.cjs} +4 -4
  35. package/dist/{chunk-HUJLKDWX.cjs.map → chunk-XMBYDLZQ.cjs.map} +1 -1
  36. package/dist/{chunk-WDD255XQ.js → chunk-XQDM6T6C.js} +3 -3
  37. package/dist/{chunk-WDD255XQ.js.map → chunk-XQDM6T6C.js.map} +1 -1
  38. package/dist/{chunk-ZV3BKLFY.cjs → chunk-Z5VUZ6YD.cjs} +3 -3
  39. package/dist/{chunk-ZV3BKLFY.cjs.map → chunk-Z5VUZ6YD.cjs.map} +1 -1
  40. package/dist/connect/index.cjs +187 -87
  41. package/dist/connect/index.cjs.map +1 -1
  42. package/dist/connect/index.js +138 -38
  43. package/dist/connect/index.js.map +1 -1
  44. package/dist/connection/ConnectedTagMatrix.d.ts +6 -3
  45. package/dist/connection/ConnectedWorkflowRunner.d.ts +16 -5
  46. package/dist/facts/index.cjs +2 -2
  47. package/dist/facts/index.js +2 -2
  48. package/dist/files/index.cjs +4 -4
  49. package/dist/files/index.js +4 -4
  50. package/dist/home/index.cjs +18 -18
  51. package/dist/home/index.js +4 -4
  52. package/dist/index.cjs +660 -644
  53. package/dist/index.js +14 -14
  54. package/dist/retrieval/index.cjs +1 -1
  55. package/dist/retrieval/index.js +1 -1
  56. package/dist/settings/index.cjs +36 -36
  57. package/dist/settings/index.js +3 -3
  58. package/dist/shell/index.cjs +1 -1
  59. package/dist/shell/index.js +1 -1
  60. package/dist/studio/index.cjs +5 -5
  61. package/dist/studio/index.js +4 -4
  62. package/dist/tags/TagMatrix.d.ts +7 -3
  63. package/dist/tags/index.d.ts +1 -0
  64. package/dist/tags/tagMatrixDocx.d.ts +42 -0
  65. package/dist/workflow-canvas/index.cjs +49 -49
  66. package/dist/workflow-canvas/index.js +6 -6
  67. package/dist/workspaces/index.cjs +1 -1
  68. package/dist/workspaces/index.js +1 -1
  69. package/package.json +4 -4
  70. package/dist/chunk-2FEQGDW2.cjs.map +0 -1
  71. package/dist/chunk-A5WCK6ZG.js.map +0 -1
  72. package/dist/chunk-LGDX34UR.cjs.map +0 -1
  73. package/dist/chunk-QFA3NCWL.js.map +0 -1
  74. package/dist/chunk-SWSVPQNB.js.map +0 -1
  75. package/dist/chunk-UA2AMDR6.cjs.map +0 -1
@@ -1,26 +1,26 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunkMFDGNUKX_cjs = require('../chunk-MFDGNUKX.cjs');
5
- var chunkHUJLKDWX_cjs = require('../chunk-HUJLKDWX.cjs');
4
+ var chunk5XVWGJ2H_cjs = require('../chunk-5XVWGJ2H.cjs');
5
+ var chunkXMBYDLZQ_cjs = require('../chunk-XMBYDLZQ.cjs');
6
6
  var chunkTZR36PPP_cjs = require('../chunk-TZR36PPP.cjs');
7
7
  var chunkMUMH3Z6K_cjs = require('../chunk-MUMH3Z6K.cjs');
8
8
  var chunkZVBPRMHJ_cjs = require('../chunk-ZVBPRMHJ.cjs');
9
9
  require('../chunk-7YUFMNFW.cjs');
10
- var chunkUA2AMDR6_cjs = require('../chunk-UA2AMDR6.cjs');
11
- var chunk2FEQGDW2_cjs = require('../chunk-2FEQGDW2.cjs');
10
+ var chunkLRRJ2HBW_cjs = require('../chunk-LRRJ2HBW.cjs');
11
+ var chunkBX7JWZWE_cjs = require('../chunk-BX7JWZWE.cjs');
12
12
  require('../chunk-DETZZBG2.cjs');
13
13
  require('../chunk-7D737FLE.cjs');
14
14
  var chunkQVBZESYQ_cjs = require('../chunk-QVBZESYQ.cjs');
15
15
  require('../chunk-ADOKTJHV.cjs');
16
- var chunkO5NDG4EA_cjs = require('../chunk-O5NDG4EA.cjs');
16
+ var chunkULWRNGGE_cjs = require('../chunk-ULWRNGGE.cjs');
17
+ var chunkMP6FK43E_cjs = require('../chunk-MP6FK43E.cjs');
17
18
  require('../chunk-VGOFFCMT.cjs');
18
19
  require('../chunk-B4SRYJLM.cjs');
19
20
  require('../chunk-7UTB4PHM.cjs');
20
21
  require('../chunk-PPCATBOY.cjs');
21
- var chunkULWRNGGE_cjs = require('../chunk-ULWRNGGE.cjs');
22
- require('../chunk-MHVNT4J3.cjs');
23
22
  var chunkKDG6FER6_cjs = require('../chunk-KDG6FER6.cjs');
23
+ require('../chunk-MHVNT4J3.cjs');
24
24
  require('../chunk-DES3K4SD.cjs');
25
25
  var react = require('react');
26
26
  var reactQuery = require('@tanstack/react-query');
@@ -190,7 +190,7 @@ function StreamedArtifact({
190
190
  }
191
191
  var STARTING = /* @__PURE__ */ new Set(["pending", "running"]);
192
192
  function formValues(step, inputs) {
193
- const fields = chunk2FEQGDW2_cjs.stepFields(step);
193
+ const fields = chunkBX7JWZWE_cjs.stepFields(step);
194
194
  if (!fields.length) return void 0;
195
195
  if (step.kind === "form")
196
196
  return Object.fromEntries(fields.map((f) => [f.name, inputs[f.name] ?? ""]));
@@ -225,10 +225,10 @@ function useAnswerRetry(missing, refetch) {
225
225
  function useWorkflowThread(workflow, options = {}) {
226
226
  const arbi = react$1.useArbi();
227
227
  const { ensureWorkspaceOpen, status } = chunkMUMH3Z6K_cjs.useConnection();
228
- const { wsId } = chunkHUJLKDWX_cjs.useWorkspaceDocs();
228
+ const { wsId } = chunkXMBYDLZQ_cjs.useWorkspaceDocs();
229
229
  const [threadId, setThreadId] = react.useState(options.conversationId);
230
230
  const [localInputs, setLocalInputs] = react.useState(
231
- () => chunk2FEQGDW2_cjs.initialRunInputs(workflow, options.initialInputs)
231
+ () => chunkBX7JWZWE_cjs.initialRunInputs(workflow, options.initialInputs)
232
232
  );
233
233
  const [edits, setEdits] = react.useState({});
234
234
  const [localStates, setLocalStates] = react.useState({});
@@ -248,12 +248,12 @@ function useWorkflowThread(workflow, options = {}) {
248
248
  );
249
249
  const conversation = conversations.data?.find((c) => c.external_id === threadId);
250
250
  const steps = react.useMemo(
251
- () => chunk2FEQGDW2_cjs.workflowSteps(workflow).length > 0 ? chunk2FEQGDW2_cjs.workflowSteps(workflow) : chunk2FEQGDW2_cjs.fromPlanSteps(conversation?.plan?.steps ?? []),
251
+ () => chunkBX7JWZWE_cjs.workflowSteps(workflow).length > 0 ? chunkBX7JWZWE_cjs.workflowSteps(workflow) : chunkBX7JWZWE_cjs.fromPlanSteps(conversation?.plan?.steps ?? []),
252
252
  [workflow, conversation?.plan?.steps]
253
253
  );
254
254
  const activity = react$1.useConversationActivity(threadId, { live: !!threadId });
255
255
  const serverStates = react.useMemo(
256
- () => chunk2FEQGDW2_cjs.stepStatesFromActivity(activity.data ?? []),
256
+ () => chunkBX7JWZWE_cjs.stepStatesFromActivity(activity.data ?? []),
257
257
  [activity.data]
258
258
  );
259
259
  const working = steps.some(
@@ -305,7 +305,7 @@ function useWorkflowThread(workflow, options = {}) {
305
305
  if (!id) {
306
306
  await ensureWorkspaceOpen();
307
307
  const created = await createWork.mutateAsync({
308
- title: chunk2FEQGDW2_cjs.runThreadTitle(workflow, values).slice(0, 60),
308
+ title: chunkBX7JWZWE_cjs.runThreadTitle(workflow, values).slice(0, 60),
309
309
  description: workflow.description || null,
310
310
  prompt: null,
311
311
  skill_ref: null,
@@ -317,7 +317,7 @@ function useWorkflowThread(workflow, options = {}) {
317
317
  criteria: [],
318
318
  max_passes: 3,
319
319
  documents: [],
320
- steps: chunk2FEQGDW2_cjs.toPlanSteps(workflow, {
320
+ steps: chunkBX7JWZWE_cjs.toPlanSteps(workflow, {
321
321
  inputs: values,
322
322
  resolveWorkflow: options.resolveWorkflow,
323
323
  compose: options.compose
@@ -372,7 +372,7 @@ function useWorkflowThread(workflow, options = {}) {
372
372
  [threadId, act]
373
373
  );
374
374
  const loaded = !options.conversationId || activity.isSuccess || activity.isError;
375
- const view = chunk2FEQGDW2_cjs.useWorkflowView({
375
+ const view = chunkBX7JWZWE_cjs.useWorkflowView({
376
376
  steps,
377
377
  states,
378
378
  inputs,
@@ -412,7 +412,7 @@ function WorkflowRunThread({
412
412
  if (listed && activeThreadId !== conversationId) selectThread(conversationId);
413
413
  }, [listed, activeThreadId, conversationId, selectThread]);
414
414
  return /* @__PURE__ */ jsxRuntime.jsx(
415
- chunkO5NDG4EA_cjs.ChatPage,
415
+ chunkMP6FK43E_cjs.ChatPage,
416
416
  {
417
417
  chat: { ...chat, threads: chat.threads.filter((t) => t.id === conversationId) },
418
418
  singleThread: true,
@@ -444,7 +444,7 @@ function WorkflowSignDialog({
444
444
  const arbi = react$1.useArbi();
445
445
  const { user, ensureWorkspaceOpen } = chunkMUMH3Z6K_cjs.useConnection();
446
446
  const tools = documentTools.useOptionalDocumentTools();
447
- const { id, version } = chunk2FEQGDW2_cjs.splitDocRef(docRef);
447
+ const { id, version } = chunkBX7JWZWE_cjs.splitDocRef(docRef);
448
448
  const [pdf, setPdf] = react.useState(null);
449
449
  const [failed, setFailed] = react.useState(false);
450
450
  react.useEffect(() => {
@@ -496,7 +496,7 @@ function WorkflowWordDialog({
496
496
  onClose,
497
497
  labels
498
498
  }) {
499
- const { id } = chunk2FEQGDW2_cjs.splitDocRef(docRef);
499
+ const { id } = chunkBX7JWZWE_cjs.splitDocRef(docRef);
500
500
  return /* @__PURE__ */ jsxRuntime.jsx(
501
501
  chunkULWRNGGE_cjs.ModalScaffold,
502
502
  {
@@ -593,6 +593,7 @@ function ConnectedWorkflowRunner({
593
593
  emptyHint,
594
594
  connectedLabels,
595
595
  onOpenDocument,
596
+ onOpenCitation,
596
597
  onOpenDraft,
597
598
  onOpenMessage,
598
599
  actions: hostActions,
@@ -606,10 +607,11 @@ function ConnectedWorkflowRunner({
606
607
  const dl = { ...DEFAULT_WORKFLOW_RUNNER_DIALOG_LABELS, ...dialogLabels };
607
608
  const arbi = react$1.useArbi();
608
609
  const { ensureWorkspaceOpen, user } = chunkMUMH3Z6K_cjs.useConnection();
609
- const { wsId } = chunkHUJLKDWX_cjs.useWorkspaceDocs();
610
+ const { wsId } = chunkXMBYDLZQ_cjs.useWorkspaceDocs();
610
611
  const { data: docs = [], refetch } = react$1.useDocuments(wsId);
611
- const [uploading, setUploading] = react.useState(false);
612
+ const [sending, setSending] = react.useState([]);
612
613
  const [added, setAdded] = react.useState({});
614
+ const [addedNames, setAddedNames] = react.useState({});
613
615
  const addedRef = react.useRef(added);
614
616
  addedRef.current = added;
615
617
  const { view, conversationId, people } = useWorkflowThread(workflow, {
@@ -628,7 +630,7 @@ function ConnectedWorkflowRunner({
628
630
  () => ({
629
631
  me: user?.externalId,
630
632
  openDocument: onOpenDocument && ((ref) => {
631
- const { id, version } = chunk2FEQGDW2_cjs.splitDocRef(ref);
633
+ const { id, version } = chunkBX7JWZWE_cjs.splitDocRef(ref);
632
634
  onOpenDocument(id, version);
633
635
  }),
634
636
  openDraft: onOpenDraft && ((draftId) => onOpenDraft(draftId)),
@@ -638,29 +640,91 @@ function ConnectedWorkflowRunner({
638
640
  const w = state.waiting;
639
641
  if (w?.doc_ext_id) setDialog({ kind: "sign", docRef: w.doc_ext_id });
640
642
  }),
641
- openRedline: hostActions?.openRedline ?? ((ref) => setDialog({ kind: "word", docRef: ref, title: nameOfDoc(chunk2FEQGDW2_cjs.splitDocRef(ref).id) ?? "" })),
643
+ openRedline: hostActions?.openRedline ?? ((ref) => setDialog({ kind: "word", docRef: ref, title: nameOfDoc(chunkBX7JWZWE_cjs.splitDocRef(ref).id) ?? "" })),
642
644
  openReview: hostActions?.openReview ?? ((tags, documents) => setDialog({ kind: "review", tags, documents }))
643
645
  }),
644
646
  [user?.externalId, onOpenDocument, onOpenDraft, onOpenMessage, hostActions, nameOfDoc, inThread]
645
647
  );
646
- const onUpload = react.useCallback(
647
- async (files2, step) => {
648
- if (!files2.length) return;
649
- setUploading(true);
648
+ const openCitation = react.useMemo(
649
+ () => onOpenCitation ?? (onOpenDocument && ((t) => {
650
+ const docId = t.documentId ?? t.passage?.documentId;
651
+ if (docId) onOpenDocument(docId, void 0, t.page ?? t.passage?.page ?? void 0);
652
+ })),
653
+ [onOpenCitation, onOpenDocument]
654
+ );
655
+ const uploadSeq = react.useRef(0);
656
+ const sendingRef = react.useRef(sending);
657
+ sendingRef.current = sending;
658
+ const send = react.useCallback(
659
+ async (batch) => {
660
+ if (!batch.length) return;
661
+ const keys = new Set(batch.map((p) => p.key));
662
+ const mark = (key, patch) => setSending(
663
+ (all) => patch === null ? all.filter((p) => p.key !== key) : all.map((p) => p.key === key ? { ...p, ...patch } : p)
664
+ );
665
+ setSending((all) => [
666
+ ...all.filter((p) => !keys.has(p.key)),
667
+ ...batch.map((p) => ({ ...p, status: "uploading", error: void 0 }))
668
+ ]);
650
669
  try {
651
670
  await ensureWorkspaceOpen();
652
- for (const f of files2) {
653
- const { doc_ext_ids = [] } = await arbi.documents.uploadFile(f, f.name) ?? {};
654
- setAdded((a) => ({ ...a, ...Object.fromEntries(doc_ext_ids.map((id) => [id, step.id])) }));
671
+ } catch (e) {
672
+ for (const p of batch) mark(p.key, { status: "failed", error: uploadError(e) });
673
+ return;
674
+ }
675
+ for (const p of batch) {
676
+ try {
677
+ const { doc_ext_ids = [] } = await arbi.documents.uploadFile(p.file, p.file.name) ?? {};
678
+ if (!doc_ext_ids.length) throw new Error("No document came back");
679
+ setAdded((a) => ({
680
+ ...a,
681
+ ...Object.fromEntries(doc_ext_ids.map((id) => [id, p.stepId]))
682
+ }));
683
+ setAddedNames((n) => ({
684
+ ...n,
685
+ ...Object.fromEntries(doc_ext_ids.map((id) => [id, p.file.name]))
686
+ }));
687
+ mark(p.key, null);
688
+ } catch (e) {
689
+ mark(p.key, { status: "failed", error: uploadError(e) });
655
690
  }
656
- await refetch();
657
- } finally {
658
- setUploading(false);
659
691
  }
692
+ await refetch();
660
693
  },
661
694
  [arbi, ensureWorkspaceOpen, refetch]
662
695
  );
663
- const files = runnerFiles(docs, added, fileFilter);
696
+ const onUpload = react.useCallback(
697
+ (files2, step) => send(
698
+ files2.map((file) => ({
699
+ key: `upload-${++uploadSeq.current}`,
700
+ file,
701
+ stepId: step.id,
702
+ status: "uploading"
703
+ }))
704
+ ),
705
+ [send]
706
+ );
707
+ const onRetryUpload = react.useCallback(
708
+ (file) => {
709
+ const p = sendingRef.current.find((x) => x.key === file.id);
710
+ if (p) void send([p]);
711
+ },
712
+ [send]
713
+ );
714
+ const onRemoveUpload = react.useCallback(
715
+ (file) => setSending((all) => all.filter((p) => p.key !== file.id)),
716
+ []
717
+ );
718
+ const files = [
719
+ ...sending.map((p) => ({
720
+ id: p.key,
721
+ name: p.file.name,
722
+ status: p.status === "failed" ? "upload-failed" : "uploading",
723
+ error: p.error,
724
+ addedFor: p.stepId
725
+ })),
726
+ ...runnerFiles(docs, added, fileFilter, addedNames)
727
+ ];
664
728
  const reading = files.some((f) => f.addedFor && f.status === "processing");
665
729
  react.useEffect(() => {
666
730
  if (!reading) return;
@@ -712,7 +776,7 @@ function ConnectedWorkflowRunner({
712
776
  );
713
777
  };
714
778
  const runner = (compact) => /* @__PURE__ */ jsxRuntime.jsx(
715
- chunk2FEQGDW2_cjs.WorkflowRunner,
779
+ chunkBX7JWZWE_cjs.WorkflowRunner,
716
780
  {
717
781
  people,
718
782
  ...runnerProps,
@@ -729,8 +793,10 @@ function ConnectedWorkflowRunner({
729
793
  }
730
794
  ) : null,
731
795
  onUpload,
732
- uploading,
796
+ uploading: sending.some((p) => p.status === "uploading"),
733
797
  files,
798
+ onRetryUpload,
799
+ onRemoveUpload,
734
800
  actions,
735
801
  nameOfDoc,
736
802
  testIdPrefix,
@@ -756,10 +822,10 @@ function ConnectedWorkflowRunner({
756
822
  ) }),
757
823
  inThread && conversationId ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
758
824
  /* @__PURE__ */ jsxRuntime.jsx(
759
- chunk2FEQGDW2_cjs.WorkflowStepBar,
825
+ chunkBX7JWZWE_cjs.WorkflowStepBar,
760
826
  {
761
827
  run: view,
762
- levels: chunk2FEQGDW2_cjs.stepLevels(view.steps),
828
+ levels: chunkBX7JWZWE_cjs.stepLevels(view.steps),
763
829
  doneTitle: (workflow.run.kind === "steps" ? workflow.run.completion?.title : void 0) ?? runnerProps.labels?.complete ?? "Done",
764
830
  icon: (key) => key && runnerProps.renderIcon ? runnerProps.renderIcon(key) : void 0,
765
831
  tid: (suffix) => `${testIdPrefix}-${suffix}`
@@ -772,6 +838,7 @@ function ConnectedWorkflowRunner({
772
838
  workspaceId: wsId,
773
839
  stepTitle: (id) => view.steps.find((s) => s.id === id)?.title,
774
840
  targetMessageId: target,
841
+ onOpenCitation: openCitation,
775
842
  labels: { workflows: l.currentStep },
776
843
  aside: runner(true)
777
844
  }
@@ -800,13 +867,25 @@ function ConnectedWorkflowRunner({
800
867
  ] });
801
868
  }
802
869
  var READ_POLL_MS = 3e3;
803
- function runnerFiles(docs, added, fileFilter) {
804
- return docs.filter((d) => !fileFilter || added[d.external_id] || fileFilter(d)).map((d) => ({
805
- id: d.external_id,
806
- name: d.file_name ?? d.external_id,
807
- status: fileStatus(d.status),
808
- addedFor: added[d.external_id]
809
- }));
870
+ function uploadError(e) {
871
+ return e instanceof Error && e.message ? e.message : String(e || "Upload failed");
872
+ }
873
+ function runnerFiles(docs, added, fileFilter, names = {}) {
874
+ const listed = new Set(docs.map((d) => d.external_id));
875
+ return [
876
+ ...docs.filter((d) => !fileFilter || added[d.external_id] || fileFilter(d)).map((d) => ({
877
+ id: d.external_id,
878
+ name: d.file_name ?? d.external_id,
879
+ status: fileStatus(d.status),
880
+ addedFor: added[d.external_id]
881
+ })),
882
+ ...Object.entries(added).filter(([id]) => !listed.has(id)).map(([id, stepId]) => ({
883
+ id,
884
+ name: names[id] ?? id,
885
+ status: "processing",
886
+ addedFor: stepId
887
+ }))
888
+ ];
810
889
  }
811
890
  function fileStatus(status) {
812
891
  const s = status?.toLowerCase();
@@ -884,6 +963,7 @@ function ConnectedTagMatrix({
884
963
  linksLimit = 3,
885
964
  exportTitle,
886
965
  onExported,
966
+ downloadable = true,
887
967
  readOnly,
888
968
  ...props
889
969
  }) {
@@ -902,9 +982,19 @@ function ConnectedTagMatrix({
902
982
  label: [m.user.given_name, m.user.family_name].filter(Boolean).join(" ") || m.user.email
903
983
  }));
904
984
  const fail = (e) => setError(e instanceof Error ? e.message : String(e));
985
+ const snapshot = (data) => {
986
+ const title = exportTitle ?? data.parent?.name ?? "Matrix";
987
+ const bytes = chunkLRRJ2HBW_cjs.tagMatrixDocx(data, {
988
+ title,
989
+ nameOf: (id) => people.find((p) => p.value === id)?.label
990
+ });
991
+ const stamp = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
992
+ const name = `${title.replace(/[\\/:*?"<>|]+/g, "-")} (${stamp}).docx`;
993
+ return { blob: new Blob([bytes], { type: chunkLRRJ2HBW_cjs.DOCX_MIME_TYPE }), name };
994
+ };
905
995
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
906
996
  /* @__PURE__ */ jsxRuntime.jsx(
907
- chunkUA2AMDR6_cjs.TagMatrix,
997
+ chunkLRRJ2HBW_cjs.TagMatrix,
908
998
  {
909
999
  ...props,
910
1000
  matrix: matrix.data,
@@ -929,22 +1019,32 @@ function ConnectedTagMatrix({
929
1019
  try {
930
1020
  const data = matrix.data;
931
1021
  if (!data) return;
932
- const title = exportTitle ?? data.parent?.name ?? "Matrix";
933
- const markdown = chunkUA2AMDR6_cjs.tagMatrixMarkdown(data, {
934
- title,
935
- nameOf: (id2) => people.find((p) => p.value === id2)?.label
936
- });
1022
+ const { blob, name } = snapshot(data);
937
1023
  await ensureWorkspaceOpen();
938
- const stamp = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
939
- const uploaded = await arbi.documents.uploadFile(
940
- new Blob([markdown], { type: "text/markdown" }),
941
- `${title} (${stamp}).md`
942
- );
1024
+ const uploaded = await arbi.documents.uploadFile(blob, name);
943
1025
  const id = uploaded?.doc_ext_ids?.[0];
944
1026
  if (id) onExported(id);
945
1027
  } catch (e) {
946
1028
  fail(e);
947
1029
  }
1030
+ } : void 0,
1031
+ onDownload: downloadable && matrix.data ? () => {
1032
+ setError(null);
1033
+ try {
1034
+ const data = matrix.data;
1035
+ if (!data) return;
1036
+ const { blob, name } = snapshot(data);
1037
+ const url = URL.createObjectURL(blob);
1038
+ const link = document.createElement("a");
1039
+ link.href = url;
1040
+ link.download = name;
1041
+ document.body.appendChild(link);
1042
+ link.click();
1043
+ link.remove();
1044
+ setTimeout(() => URL.revokeObjectURL(url), 0);
1045
+ } catch (e) {
1046
+ fail(e);
1047
+ }
948
1048
  } : void 0
949
1049
  }
950
1050
  ),
@@ -1024,12 +1124,12 @@ function ConnectedProfileCard({ notify: notify3, title = "Profile" }) {
1024
1124
  }
1025
1125
  });
1026
1126
  const display = profile?.fullName || user?.name || "Unnamed";
1027
- return /* @__PURE__ */ jsxRuntime.jsx(chunkMFDGNUKX_cjs.SettingsSection, { icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.UserCircle, {}), title, children: /* @__PURE__ */ jsxRuntime.jsx(
1028
- chunkMFDGNUKX_cjs.ProfileCard,
1127
+ return /* @__PURE__ */ jsxRuntime.jsx(chunk5XVWGJ2H_cjs.SettingsSection, { icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.UserCircle, {}), title, children: /* @__PURE__ */ jsxRuntime.jsx(
1128
+ chunk5XVWGJ2H_cjs.ProfileCard,
1029
1129
  {
1030
1130
  avatar: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1031
1131
  /* @__PURE__ */ jsxRuntime.jsx(
1032
- chunkMFDGNUKX_cjs.AvatarPicker,
1132
+ chunk5XVWGJ2H_cjs.AvatarPicker,
1033
1133
  {
1034
1134
  pictureUrl: profile?.picture ?? user?.picture,
1035
1135
  initials: chunkKDG6FER6_cjs.initials(display),
@@ -1071,9 +1171,9 @@ function ConnectedIdentityVerification({
1071
1171
  onNameAccepted: () => notify3?.("Name updated to match your ID", "success")
1072
1172
  });
1073
1173
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1074
- /* @__PURE__ */ jsxRuntime.jsx(chunkMFDGNUKX_cjs.IdentityVerificationCard, { flow, labels }),
1174
+ /* @__PURE__ */ jsxRuntime.jsx(chunk5XVWGJ2H_cjs.IdentityVerificationCard, { flow, labels }),
1075
1175
  /* @__PURE__ */ jsxRuntime.jsx(
1076
- chunkMFDGNUKX_cjs.IdentityVerificationDialog,
1176
+ chunk5XVWGJ2H_cjs.IdentityVerificationDialog,
1077
1177
  {
1078
1178
  flow,
1079
1179
  accountName: profile?.fullName ?? "",
@@ -1085,7 +1185,7 @@ function ConnectedIdentityVerification({
1085
1185
  function ConnectedRequireVerified({ children, labels }) {
1086
1186
  const { data: profile } = react$1.useProfile();
1087
1187
  const flow = react$1.useIdentityVerification();
1088
- return /* @__PURE__ */ jsxRuntime.jsx(chunkMFDGNUKX_cjs.RequireVerified, { flow, accountName: profile?.fullName ?? "", labels, children });
1188
+ return /* @__PURE__ */ jsxRuntime.jsx(chunk5XVWGJ2H_cjs.RequireVerified, { flow, accountName: profile?.fullName ?? "", labels, children });
1089
1189
  }
1090
1190
  function defaultUnmetPasswordRequirement(password) {
1091
1191
  if (password.length < 8) return "Minimum 8 characters";
@@ -1114,10 +1214,10 @@ function ConnectedSecuritySection({
1114
1214
  },
1115
1215
  onClose: () => setOpen(false)
1116
1216
  });
1117
- return /* @__PURE__ */ jsxRuntime.jsxs(chunkMFDGNUKX_cjs.SettingsSection, { icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.KeyRound, {}), title: "Security", children: [
1118
- /* @__PURE__ */ jsxRuntime.jsxs(chunkMFDGNUKX_cjs.SettingsCard, { padding: "sm", children: [
1217
+ return /* @__PURE__ */ jsxRuntime.jsxs(chunk5XVWGJ2H_cjs.SettingsSection, { icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.KeyRound, {}), title: "Security", children: [
1218
+ /* @__PURE__ */ jsxRuntime.jsxs(chunk5XVWGJ2H_cjs.SettingsCard, { padding: "sm", children: [
1119
1219
  /* @__PURE__ */ jsxRuntime.jsx(
1120
- chunkMFDGNUKX_cjs.SettingsActionRow,
1220
+ chunk5XVWGJ2H_cjs.SettingsActionRow,
1121
1221
  {
1122
1222
  title: "Change password",
1123
1223
  description: "Used to sign in and to encrypt your data. Changing it re-encrypts everything in your account.",
@@ -1128,7 +1228,7 @@ function ConnectedSecuritySection({
1128
1228
  children
1129
1229
  ] }),
1130
1230
  /* @__PURE__ */ jsxRuntime.jsx(
1131
- chunkMFDGNUKX_cjs.PasswordChangeDialog,
1231
+ chunk5XVWGJ2H_cjs.PasswordChangeDialog,
1132
1232
  {
1133
1233
  open,
1134
1234
  onClose: form.onCancel,
@@ -1152,23 +1252,23 @@ function ConnectedSecuritySection({
1152
1252
  ] });
1153
1253
  }
1154
1254
  function ConnectedNotificationPreferences({
1155
- categories = chunkMFDGNUKX_cjs.EMAIL_NOTIFICATION_CATEGORIES,
1255
+ categories = chunk5XVWGJ2H_cjs.EMAIL_NOTIFICATION_CATEGORIES,
1156
1256
  title = "Notifications"
1157
1257
  }) {
1158
1258
  const keys = react.useMemo(
1159
- () => categories === chunkMFDGNUKX_cjs.EMAIL_NOTIFICATION_CATEGORIES ? chunkMFDGNUKX_cjs.EMAIL_NOTIFICATION_KEYS : categories.map((c) => c.key),
1259
+ () => categories === chunk5XVWGJ2H_cjs.EMAIL_NOTIFICATION_CATEGORIES ? chunk5XVWGJ2H_cjs.EMAIL_NOTIFICATION_KEYS : categories.map((c) => c.key),
1160
1260
  [categories]
1161
1261
  );
1162
1262
  const prefs = react$1.useNotificationPreferences(keys);
1163
- return /* @__PURE__ */ jsxRuntime.jsx(chunkMFDGNUKX_cjs.SettingsSection, { title, children: /* @__PURE__ */ jsxRuntime.jsx(chunkMFDGNUKX_cjs.SettingsCard, { className: "space-y-0", children: /* @__PURE__ */ jsxRuntime.jsx(
1164
- chunkMFDGNUKX_cjs.NotificationCategoryList,
1263
+ return /* @__PURE__ */ jsxRuntime.jsx(chunk5XVWGJ2H_cjs.SettingsSection, { title, children: /* @__PURE__ */ jsxRuntime.jsx(chunk5XVWGJ2H_cjs.SettingsCard, { className: "space-y-0", children: /* @__PURE__ */ jsxRuntime.jsx(
1264
+ chunk5XVWGJ2H_cjs.NotificationCategoryList,
1165
1265
  {
1166
1266
  masterId: "emailNotifications",
1167
1267
  masterTitle: "Email Notifications",
1168
1268
  masterDescription: "Email me about activity when I\u2019m away",
1169
1269
  masterChecked: prefs.masterChecked,
1170
1270
  onMasterChange: prefs.setAll,
1171
- categories: chunkMFDGNUKX_cjs.toNotificationCategories(prefs.checked, categories),
1271
+ categories: chunk5XVWGJ2H_cjs.toNotificationCategories(prefs.checked, categories),
1172
1272
  onCategoryChange: prefs.setCategory
1173
1273
  }
1174
1274
  ) }) });
@@ -1182,14 +1282,14 @@ function ConnectedSessionsRow({
1182
1282
  const sessions = react$1.useSessions({ enabled: open });
1183
1283
  const currentSessionId = react$1.useCurrentSessionId();
1184
1284
  const terminate = react$1.useTerminateSession();
1185
- const views = chunkMFDGNUKX_cjs.toActiveSessionViews(sessions.data ?? [], {
1285
+ const views = chunk5XVWGJ2H_cjs.toActiveSessionViews(sessions.data ?? [], {
1186
1286
  currentSessionId,
1187
1287
  terminatingId: terminate.isPending ? terminate.variables : null,
1188
1288
  renderIcon: renderSessionIcon
1189
1289
  });
1190
1290
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1191
1291
  /* @__PURE__ */ jsxRuntime.jsx(
1192
- chunkMFDGNUKX_cjs.SettingsRow,
1292
+ chunk5XVWGJ2H_cjs.SettingsRow,
1193
1293
  {
1194
1294
  label: "Active sessions",
1195
1295
  description: "Devices and agents currently signed in to your account.",
@@ -1211,7 +1311,7 @@ function ConnectedSessionsRow({
1211
1311
  }
1212
1312
  ),
1213
1313
  /* @__PURE__ */ jsxRuntime.jsx(
1214
- chunkMFDGNUKX_cjs.ActiveSessionsDialog,
1314
+ chunk5XVWGJ2H_cjs.ActiveSessionsDialog,
1215
1315
  {
1216
1316
  open,
1217
1317
  onOpenChange: setOpen,
@@ -1246,7 +1346,7 @@ function ConnectedLogoutDialog({
1246
1346
  const sessions = react$1.useSessions({ enabled: open });
1247
1347
  const logoutAll = react$1.useLogoutAllSessions();
1248
1348
  return /* @__PURE__ */ jsxRuntime.jsx(
1249
- chunkMFDGNUKX_cjs.LogoutDialog,
1349
+ chunk5XVWGJ2H_cjs.LogoutDialog,
1250
1350
  {
1251
1351
  open,
1252
1352
  onClose,
@@ -1260,7 +1360,7 @@ function ConnectedLogoutDialog({
1260
1360
  },
1261
1361
  canLogoutAll: true,
1262
1362
  isOnline,
1263
- sessions: chunkMFDGNUKX_cjs.toLogoutSessionViews(sessions.data ?? []),
1363
+ sessions: chunk5XVWGJ2H_cjs.toLogoutSessionViews(sessions.data ?? []),
1264
1364
  renderSessionIcon
1265
1365
  }
1266
1366
  );
@@ -1279,7 +1379,7 @@ function ConnectedDangerZone({ notify: notify3, renderSubscriptionLink }) {
1279
1379
  });
1280
1380
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1281
1381
  /* @__PURE__ */ jsxRuntime.jsx(
1282
- chunkMFDGNUKX_cjs.SettingsDangerZone,
1382
+ chunk5XVWGJ2H_cjs.SettingsDangerZone,
1283
1383
  {
1284
1384
  isOpen: zoneOpen,
1285
1385
  onToggle: () => setZoneOpen((o) => !o),
@@ -1299,12 +1399,12 @@ function ConnectedDangerZone({ notify: notify3, renderSubscriptionLink }) {
1299
1399
  }
1300
1400
  ),
1301
1401
  /* @__PURE__ */ jsxRuntime.jsx(
1302
- chunkMFDGNUKX_cjs.DeleteAccountDialog,
1402
+ chunk5XVWGJ2H_cjs.DeleteAccountDialog,
1303
1403
  {
1304
1404
  open: dialogOpen,
1305
1405
  onClose: flow.onClose,
1306
1406
  step: flow.step,
1307
- blockers: chunkMFDGNUKX_cjs.toDeleteBlockerViews(flow.blockers, renderSubscriptionLink),
1407
+ blockers: chunk5XVWGJ2H_cjs.toDeleteBlockerViews(flow.blockers, renderSubscriptionLink),
1308
1408
  onContinue: flow.onContinue,
1309
1409
  onBack: flow.onBack,
1310
1410
  userEmail: user?.email ?? "",
@@ -1489,7 +1589,7 @@ function mapWorkNotification(note) {
1489
1589
  function ActiveChat({ agentId, workspaceId }) {
1490
1590
  const chat = react$1.useArbiChat({ agentId, workspaceId });
1491
1591
  return /* @__PURE__ */ jsxRuntime.jsx(
1492
- chunkO5NDG4EA_cjs.ChatPage,
1592
+ chunkMP6FK43E_cjs.ChatPage,
1493
1593
  {
1494
1594
  chat: { ...chat, assistantMode: void 0, setAssistantMode: void 0 },
1495
1595
  documentsRequired: false,
@@ -1551,35 +1651,35 @@ function ConnectedAgentChatPanel({
1551
1651
 
1552
1652
  Object.defineProperty(exports, "ConnectedAssistantDock", {
1553
1653
  enumerable: true,
1554
- get: function () { return chunkHUJLKDWX_cjs.ConnectedAssistantDock; }
1654
+ get: function () { return chunkXMBYDLZQ_cjs.ConnectedAssistantDock; }
1555
1655
  });
1556
1656
  Object.defineProperty(exports, "redlineStats", {
1557
1657
  enumerable: true,
1558
- get: function () { return chunkHUJLKDWX_cjs.redlineStats; }
1658
+ get: function () { return chunkXMBYDLZQ_cjs.redlineStats; }
1559
1659
  });
1560
1660
  Object.defineProperty(exports, "textToArtifact", {
1561
1661
  enumerable: true,
1562
- get: function () { return chunkHUJLKDWX_cjs.textToArtifact; }
1662
+ get: function () { return chunkXMBYDLZQ_cjs.textToArtifact; }
1563
1663
  });
1564
1664
  Object.defineProperty(exports, "toRedlineMarkdown", {
1565
1665
  enumerable: true,
1566
- get: function () { return chunkHUJLKDWX_cjs.toRedlineMarkdown; }
1666
+ get: function () { return chunkXMBYDLZQ_cjs.toRedlineMarkdown; }
1567
1667
  });
1568
1668
  Object.defineProperty(exports, "useConnectedAiTask", {
1569
1669
  enumerable: true,
1570
- get: function () { return chunkHUJLKDWX_cjs.useConnectedAiTask; }
1670
+ get: function () { return chunkXMBYDLZQ_cjs.useConnectedAiTask; }
1571
1671
  });
1572
1672
  Object.defineProperty(exports, "useConnectedChat", {
1573
1673
  enumerable: true,
1574
- get: function () { return chunkHUJLKDWX_cjs.useConnectedChat; }
1674
+ get: function () { return chunkXMBYDLZQ_cjs.useConnectedChat; }
1575
1675
  });
1576
1676
  Object.defineProperty(exports, "useSemanticSearch", {
1577
1677
  enumerable: true,
1578
- get: function () { return chunkHUJLKDWX_cjs.useSemanticSearch; }
1678
+ get: function () { return chunkXMBYDLZQ_cjs.useSemanticSearch; }
1579
1679
  });
1580
1680
  Object.defineProperty(exports, "useWorkspaceDocs", {
1581
1681
  enumerable: true,
1582
- get: function () { return chunkHUJLKDWX_cjs.useWorkspaceDocs; }
1682
+ get: function () { return chunkXMBYDLZQ_cjs.useWorkspaceDocs; }
1583
1683
  });
1584
1684
  Object.defineProperty(exports, "ConnectionProvider", {
1585
1685
  enumerable: true,