@arbidocs/blocks 0.4.77 → 0.4.79

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 (85) hide show
  1. package/dist/agents/index.cjs +287 -275
  2. package/dist/agents/index.js +3 -3
  3. package/dist/agents/tasks/WorkflowThreadStrip.d.ts +9 -4
  4. package/dist/agents/workflows/StepBarFrame.d.ts +75 -0
  5. package/dist/agents/workflows/WorkflowRunner.d.ts +5 -1
  6. package/dist/agents/workflows/WorkflowStepBar.d.ts +9 -11
  7. package/dist/agents/workflows/index.d.ts +2 -0
  8. package/dist/agents/workflows/stepWindow.d.ts +59 -0
  9. package/dist/chat/ChatPage.d.ts +1 -1
  10. package/dist/chat/chat-page-types.d.ts +5 -0
  11. package/dist/chat/index.cjs +124 -124
  12. package/dist/chat/index.js +2 -2
  13. package/dist/{chunk-JFUN4D7D.cjs → chunk-3YET6D5E.cjs} +150 -146
  14. package/dist/chunk-3YET6D5E.cjs.map +1 -0
  15. package/dist/{chunk-B3WCKBJ7.cjs → chunk-5XVWGJ2H.cjs} +3 -3
  16. package/dist/{chunk-B3WCKBJ7.cjs.map → chunk-5XVWGJ2H.cjs.map} +1 -1
  17. package/dist/{chunk-34UW6XUQ.js → chunk-6GXF62XN.js} +566 -171
  18. package/dist/chunk-6GXF62XN.js.map +1 -0
  19. package/dist/{chunk-HEVVT6IT.js → chunk-BMOL5DN6.js} +126 -122
  20. package/dist/chunk-BMOL5DN6.js.map +1 -0
  21. package/dist/chunk-CWAZNXC5.js +441 -0
  22. package/dist/chunk-CWAZNXC5.js.map +1 -0
  23. package/dist/{chunk-NIP5BOP7.js → chunk-EWSEQEPL.js} +5 -4
  24. package/dist/chunk-EWSEQEPL.js.map +1 -0
  25. package/dist/{chunk-UEU23PTW.js → chunk-ICBAFX5B.js} +3 -3
  26. package/dist/{chunk-UEU23PTW.js.map → chunk-ICBAFX5B.js.map} +1 -1
  27. package/dist/{chunk-EKIUMNCN.cjs → chunk-IF6VAYIA.cjs} +5 -5
  28. package/dist/{chunk-EKIUMNCN.cjs.map → chunk-IF6VAYIA.cjs.map} +1 -1
  29. package/dist/chunk-MLAHDAN5.cjs +450 -0
  30. package/dist/chunk-MLAHDAN5.cjs.map +1 -0
  31. package/dist/{chunk-HOD6OM7L.cjs → chunk-MP6FK43E.cjs} +5 -4
  32. package/dist/chunk-MP6FK43E.cjs.map +1 -0
  33. package/dist/{chunk-GJV2G4FC.js → chunk-O35LRB3P.js} +3 -3
  34. package/dist/{chunk-GJV2G4FC.js.map → chunk-O35LRB3P.js.map} +1 -1
  35. package/dist/{chunk-GTXOV7IJ.cjs → chunk-XMBYDLZQ.cjs} +4 -4
  36. package/dist/{chunk-GTXOV7IJ.cjs.map → chunk-XMBYDLZQ.cjs.map} +1 -1
  37. package/dist/{chunk-OEM5ARVM.js → chunk-XQDM6T6C.js} +3 -3
  38. package/dist/{chunk-OEM5ARVM.js.map → chunk-XQDM6T6C.js.map} +1 -1
  39. package/dist/{chunk-3XR3IEGU.cjs → chunk-YGUKTFKW.cjs} +572 -167
  40. package/dist/chunk-YGUKTFKW.cjs.map +1 -0
  41. package/dist/connect/index.cjs +233 -77
  42. package/dist/connect/index.cjs.map +1 -1
  43. package/dist/connect/index.d.ts +2 -0
  44. package/dist/connect/index.js +191 -37
  45. package/dist/connect/index.js.map +1 -1
  46. package/dist/connection/ConnectedTagMatrix.d.ts +20 -0
  47. package/dist/connection/ConnectedWorkflowRunner.d.ts +13 -1
  48. package/dist/connection/WorkflowRunThread.d.ts +21 -0
  49. package/dist/databases/ColumnConfigFields.d.ts +68 -0
  50. package/dist/databases/DatabaseColumnDialog.d.ts +27 -2
  51. package/dist/databases/DatabaseTable.d.ts +8 -1
  52. package/dist/databases/PickCellEditor.d.ts +21 -0
  53. package/dist/databases/column-types.d.ts +73 -9
  54. package/dist/databases/databaseColumns.d.ts +4 -0
  55. package/dist/databases/index.cjs +758 -27
  56. package/dist/databases/index.cjs.map +1 -1
  57. package/dist/databases/index.d.ts +4 -1
  58. package/dist/databases/index.js +745 -31
  59. package/dist/databases/index.js.map +1 -1
  60. package/dist/databases/linkCells.d.ts +48 -0
  61. package/dist/files/index.cjs +2 -2
  62. package/dist/files/index.js +2 -2
  63. package/dist/index.cjs +624 -579
  64. package/dist/index.cjs.map +1 -1
  65. package/dist/index.d.ts +1 -0
  66. package/dist/index.js +9 -8
  67. package/dist/index.js.map +1 -1
  68. package/dist/settings/index.cjs +35 -35
  69. package/dist/settings/index.js +3 -3
  70. package/dist/studio/index.cjs +3 -3
  71. package/dist/studio/index.js +2 -2
  72. package/dist/tags/TagMatrix.d.ts +64 -0
  73. package/dist/tags/index.d.ts +3 -0
  74. package/dist/tags/tagMatrixModel.d.ts +39 -0
  75. package/dist/workflow-canvas/index.cjs +46 -46
  76. package/dist/workflow-canvas/index.js +3 -3
  77. package/dist/workspaces/index.cjs +1 -1
  78. package/dist/workspaces/index.js +1 -1
  79. package/package.json +4 -4
  80. package/dist/chunk-34UW6XUQ.js.map +0 -1
  81. package/dist/chunk-3XR3IEGU.cjs.map +0 -1
  82. package/dist/chunk-HEVVT6IT.js.map +0 -1
  83. package/dist/chunk-HOD6OM7L.cjs.map +0 -1
  84. package/dist/chunk-JFUN4D7D.cjs.map +0 -1
  85. package/dist/chunk-NIP5BOP7.js.map +0 -1
@@ -10,6 +10,8 @@ export { ConnectedSkillUpload } from '../connection/ConnectedSkillUpload';
10
10
  export { useConnectedAiTask, useConnectedChat, ConnectedAssistantDock, useWorkspaceDocs, useSemanticSearch, toRedlineMarkdown, redlineStats, textToArtifact, type AiTaskStatus, type AiRunOptions, type SearchChunk, type ArtifactEvent, } from '../connection/ai';
11
11
  export { StreamedArtifact, type StreamedArtifactProps } from '../connection/StreamedArtifact';
12
12
  export { ConnectedWorkflowRunner, DEFAULT_CONNECTED_WORKFLOW_RUNNER_LABELS, type ConnectedWorkflowRunnerProps, type ConnectedWorkflowRunnerLabels, } from '../connection/ConnectedWorkflowRunner';
13
+ export { WorkflowRunThread, type WorkflowRunThreadProps } from '../connection/WorkflowRunThread';
14
+ export { ConnectedTagMatrix, type ConnectedTagMatrixProps } from '../connection/ConnectedTagMatrix';
13
15
  export { useConnectedShellWorkspaces, type UseConnectedShellWorkspacesOptions, } from '../connection/useConnectedShellWorkspaces';
14
16
  export { ConnectedProfileCard, ConnectedSecuritySection, ConnectedNotificationPreferences, ConnectedSessionsRow, ConnectedLogoutDialog, ConnectedDangerZone, ConnectedIdentityVerification, ConnectedRequireVerified, defaultUnmetPasswordRequirement, type SettingsNotify, type ConnectedProfileCardProps, type ConnectedSecuritySectionProps, type ConnectedNotificationPreferencesProps, type ConnectedSessionsRowProps, type ConnectedLogoutDialogProps, type ConnectedDangerZoneProps, type ConnectedIdentityVerificationProps, type ConnectedRequireVerifiedProps, } from '../connection/ConnectedSettings';
15
17
  export { useConnectedDocxNotifications } from '../connection/useConnectedDocxNotifications';
@@ -1,33 +1,34 @@
1
1
  "use client";
2
- import { SettingsSection, ProfileCard, AvatarPicker, IdentityVerificationCard, IdentityVerificationDialog, RequireVerified, SettingsCard, SettingsActionRow, PasswordChangeDialog, EMAIL_NOTIFICATION_KEYS, EMAIL_NOTIFICATION_CATEGORIES, NotificationCategoryList, toNotificationCategories, toActiveSessionViews, SettingsRow, ActiveSessionsDialog, LogoutDialog, toLogoutSessionViews, SettingsDangerZone, DeleteAccountDialog, toDeleteBlockerViews } from '../chunk-GJV2G4FC.js';
3
- import { useWorkspaceDocs } from '../chunk-OEM5ARVM.js';
4
- export { ConnectedAssistantDock, redlineStats, textToArtifact, toRedlineMarkdown, useConnectedAiTask, useConnectedChat, useSemanticSearch, useWorkspaceDocs } from '../chunk-OEM5ARVM.js';
2
+ import { SettingsSection, ProfileCard, AvatarPicker, IdentityVerificationCard, IdentityVerificationDialog, RequireVerified, SettingsCard, SettingsActionRow, PasswordChangeDialog, EMAIL_NOTIFICATION_KEYS, EMAIL_NOTIFICATION_CATEGORIES, NotificationCategoryList, toNotificationCategories, toActiveSessionViews, SettingsRow, ActiveSessionsDialog, LogoutDialog, toLogoutSessionViews, SettingsDangerZone, DeleteAccountDialog, toDeleteBlockerViews } from '../chunk-O35LRB3P.js';
3
+ import { useWorkspaceDocs } from '../chunk-XQDM6T6C.js';
4
+ export { ConnectedAssistantDock, redlineStats, textToArtifact, toRedlineMarkdown, useConnectedAiTask, useConnectedChat, useSemanticSearch, useWorkspaceDocs } from '../chunk-XQDM6T6C.js';
5
5
  import { ConnectedNativeDocxEditor } from '../chunk-A24C6BNA.js';
6
6
  import { ConnectionProvider, useConnection } from '../chunk-OYMWV45N.js';
7
7
  export { ConnectionProvider, SESSION_EXPIRED_MESSAGE, isAuthenticated, useConnection } from '../chunk-OYMWV45N.js';
8
8
  import { SignDocumentDialog } from '../chunk-FE4ULGOR.js';
9
9
  import '../chunk-OPA2Y6YZ.js';
10
- import { splitDocRef, WorkflowRunner, initialRunInputs, workflowSteps, fromPlanSteps, stepStatesFromActivity, toPlanSteps, runThreadTitle, useWorkflowView, stepFields } from '../chunk-34UW6XUQ.js';
10
+ import { TagMatrix, tagMatrixMarkdown } from '../chunk-CWAZNXC5.js';
11
+ import { splitDocRef, WorkflowStepBar, stepLevels, WorkflowRunner, initialRunInputs, workflowSteps, fromPlanSteps, stepStatesFromActivity, toPlanSteps, runThreadTitle, useWorkflowView, stepFields } from '../chunk-6GXF62XN.js';
11
12
  import '../chunk-EVUEIBNU.js';
12
13
  import '../chunk-XD2M6LIG.js';
13
14
  import { StreamedArtifactFrame } from '../chunk-LOJVUGBJ.js';
14
15
  import '../chunk-VILAPTCB.js';
15
- import { ChatPage } from '../chunk-NIP5BOP7.js';
16
+ import { ModalScaffold } from '../chunk-TX2ZICS7.js';
17
+ import { ChatPage } from '../chunk-EWSEQEPL.js';
16
18
  import '../chunk-KZJAG7T3.js';
17
19
  import '../chunk-HOXKR26S.js';
18
20
  import '../chunk-AA3PT6KR.js';
19
21
  import '../chunk-NPLYHR2E.js';
20
22
  import { initials } from '../chunk-OXF2IFXG.js';
21
- import { ModalScaffold } from '../chunk-TX2ZICS7.js';
22
23
  import '../chunk-7F6CBP3Z.js';
23
24
  import '../chunk-VUNV25KB.js';
24
- import { lazy, useState, Suspense, useRef, useCallback, useMemo, useEffect } from 'react';
25
+ import { lazy, useState, Suspense, useEffect, useRef, useCallback, useMemo } from 'react';
25
26
  import { QueryClient, QueryClientProvider, useQueryClient, useQuery } from '@tanstack/react-query';
26
- import { ArbiProvider, useConversations, useRunConversation, useUploadSkillFiles, ArtifactCanvas, useArbi, useDocuments, useWorkspaceUsers, useWorkspaces, useShellWorkspaces, useProfile, useUpdateProfile, useRequestEmailChange, useConfirmEmailChange, useNameEditor, useAvatarCrop, useEmailChange, ImageCropModal, useIdentityVerification, usePasswordChange, usePasswordChangeForm, useNotificationPreferences, useSessions, useCurrentSessionId, useTerminateSession, useLogoutAllSessions, useDeleteAccount, useDeleteAccountFlow, useArbiWebSocket, notify, useWorkNotifications, useAgentSession, useStartAgentSession, useCloseAgentSession, AiAnswer, ArbiWebSocketProvider, useCreateWork, useActOnStep, useConversationActivity, useConversationThreads, useTags, useArbiChat } from '@arbidocs/react';
27
+ import { ArbiProvider, useConversations, useRunConversation, useUploadSkillFiles, ArtifactCanvas, useArbiChat, useArbi, useDocuments, useTagMatrix, useUpdateTagFields, useInvalidateTagData, useWorkspaceUsers, useWorkspaces, useShellWorkspaces, useProfile, useUpdateProfile, useRequestEmailChange, useConfirmEmailChange, useNameEditor, useAvatarCrop, useEmailChange, ImageCropModal, useIdentityVerification, usePasswordChange, usePasswordChangeForm, useNotificationPreferences, useSessions, useCurrentSessionId, useTerminateSession, useLogoutAllSessions, useDeleteAccount, useDeleteAccountFlow, useArbiWebSocket, notify, useWorkNotifications, useAgentSession, useStartAgentSession, useCloseAgentSession, ArbiWebSocketProvider, useCreateWork, useActOnStep, useConversationActivity, useConversationThreads, useTags, AiAnswer } from '@arbidocs/react';
27
28
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
28
29
  import { Button, Label, Input, cn } from '@arbidocs/react/ui';
29
30
  import { useStreamedArtifact } from '@arbidocs/react/artifacts';
30
- import { ExternalLink, UserCircle, KeyRound, Radio, Loader2 } from 'lucide-react';
31
+ import { ExternalLink, UserCircle, KeyRound, Radio, Loader2, MessageSquare } from 'lucide-react';
31
32
  import { useOptionalDocumentTools, DocumentToolsProvider } from '@arbidocs/react/document-tools';
32
33
  import { useNotify } from '@arbidocs/react/shell';
33
34
 
@@ -394,6 +395,38 @@ function useWorkflowThread(workflow, options = {}) {
394
395
  );
395
396
  return { view, conversationId: threadId, conversation, nameOf, people };
396
397
  }
398
+ function WorkflowRunThread({
399
+ conversationId,
400
+ workspaceId,
401
+ aside,
402
+ stepTitle,
403
+ targetMessageId,
404
+ onOpenCitation,
405
+ labels,
406
+ className
407
+ }) {
408
+ const chat = useArbiChat({ workspaceId });
409
+ const listed = chat.threads.some((t) => t.id === conversationId);
410
+ const { selectThread, activeThreadId } = chat;
411
+ useEffect(() => {
412
+ if (listed && activeThreadId !== conversationId) selectThread(conversationId);
413
+ }, [listed, activeThreadId, conversationId, selectThread]);
414
+ return /* @__PURE__ */ jsx(
415
+ ChatPage,
416
+ {
417
+ chat: { ...chat, threads: chat.threads.filter((t) => t.id === conversationId) },
418
+ singleThread: true,
419
+ documentsRequired: false,
420
+ aside,
421
+ asideBreakpoint: 52,
422
+ workflowStepTitle: stepTitle,
423
+ targetMessageId,
424
+ onOpenCitation,
425
+ labels,
426
+ className: className ?? "h-[min(78dvh,860px)] min-h-[480px] rounded-xl border border-border"
427
+ }
428
+ );
429
+ }
397
430
  var DEFAULT_WORKFLOW_RUNNER_DIALOG_LABELS = {
398
431
  loadingDocument: "Opening the document\u2026",
399
432
  documentFailed: "The document could not be opened.",
@@ -547,6 +580,8 @@ function Cell({ onClick, children }) {
547
580
  }
548
581
  var DEFAULT_CONNECTED_WORKFLOW_RUNNER_LABELS = {
549
582
  notify: "Ask to approve",
583
+ showInThread: "Show in the thread",
584
+ currentStep: "Current step",
550
585
  notified: "Notified.",
551
586
  openThread: "Open the thread",
552
587
  loadingAnswer: "Fetching the answer\u2026"
@@ -562,6 +597,7 @@ function ConnectedWorkflowRunner({
562
597
  onOpenMessage,
563
598
  actions: hostActions,
564
599
  dialogLabels,
600
+ layout = "thread",
565
601
  testIdPrefix = "workflow-run",
566
602
  ...runnerProps
567
603
  }) {
@@ -581,6 +617,8 @@ function ConnectedWorkflowRunner({
581
617
  documentsFor: options?.documentsFor ?? ((stepId) => Object.entries(addedRef.current).flatMap(([doc, step]) => step === stepId ? [doc] : []))
582
618
  });
583
619
  const [dialog, setDialog] = useState(null);
620
+ const inThread = layout === "thread" && !!conversationId;
621
+ const [target, setTarget] = useState(void 0);
584
622
  const nameOfDoc = useCallback(
585
623
  (id) => docs.find((d) => d.external_id === id)?.file_name ?? void 0,
586
624
  [docs]
@@ -593,7 +631,8 @@ function ConnectedWorkflowRunner({
593
631
  onOpenDocument(id, version);
594
632
  }),
595
633
  openDraft: onOpenDraft && ((draftId) => onOpenDraft(draftId)),
596
- openMessage: onOpenMessage,
634
+ // In the thread layout an answer is right there: scroll to it.
635
+ openMessage: inThread ? setTarget : onOpenMessage,
597
636
  sign: hostActions?.sign ?? ((_step, state) => {
598
637
  const w = state.waiting;
599
638
  if (w?.doc_ext_id) setDialog({ kind: "sign", docRef: w.doc_ext_id });
@@ -601,7 +640,7 @@ function ConnectedWorkflowRunner({
601
640
  openRedline: hostActions?.openRedline ?? ((ref) => setDialog({ kind: "word", docRef: ref, title: nameOfDoc(splitDocRef(ref).id) ?? "" })),
602
641
  openReview: hostActions?.openReview ?? ((tags, documents) => setDialog({ kind: "review", tags, documents }))
603
642
  }),
604
- [user?.externalId, onOpenDocument, onOpenDraft, onOpenMessage, hostActions, nameOfDoc]
643
+ [user?.externalId, onOpenDocument, onOpenDraft, onOpenMessage, hostActions, nameOfDoc, inThread]
605
644
  );
606
645
  const onUpload = useCallback(
607
646
  async (files2, step) => {
@@ -634,6 +673,23 @@ function ConnectedWorkflowRunner({
634
673
  }, [reading, refetch]);
635
674
  const renderAgentOutput = (step, state) => {
636
675
  const status = state?.status;
676
+ if (inThread) {
677
+ const id = state?.responseId;
678
+ return id && status === "done" ? /* @__PURE__ */ jsxs(
679
+ Button,
680
+ {
681
+ variant: "outline",
682
+ size: "sm",
683
+ onClick: () => setTarget(id),
684
+ "data-testid": `${testIdPrefix}-${step.id}-show-in-thread`,
685
+ children: [
686
+ /* @__PURE__ */ jsx(MessageSquare, { className: "size-4" }),
687
+ " ",
688
+ l.showInThread
689
+ ]
690
+ }
691
+ ) : null;
692
+ }
637
693
  if (!state?.text && status !== "done") return null;
638
694
  if (!state?.text && state?.responseId) {
639
695
  return /* @__PURE__ */ jsxs(
@@ -659,6 +715,34 @@ function ConnectedWorkflowRunner({
659
715
  }
660
716
  );
661
717
  };
718
+ const runner = (compact) => /* @__PURE__ */ jsx(
719
+ WorkflowRunner,
720
+ {
721
+ people,
722
+ ...runnerProps,
723
+ workflow,
724
+ run: view,
725
+ renderAgentOutput,
726
+ renderReview: (step) => conversationId ? /* @__PURE__ */ jsx(
727
+ ReviewNotify,
728
+ {
729
+ conversationId,
730
+ workspaceId: wsId,
731
+ labels: l,
732
+ testId: `${testIdPrefix}-${step.id}`
733
+ }
734
+ ) : null,
735
+ onUpload,
736
+ uploading,
737
+ files,
738
+ actions,
739
+ nameOfDoc,
740
+ testIdPrefix,
741
+ hideStepBar: compact,
742
+ compact,
743
+ className: compact ? void 0 : runnerProps.className
744
+ }
745
+ );
662
746
  return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
663
747
  conversationId && onOpenConversation && /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxs(
664
748
  Button,
@@ -674,31 +758,29 @@ function ConnectedWorkflowRunner({
674
758
  ]
675
759
  }
676
760
  ) }),
677
- /* @__PURE__ */ jsx(
678
- WorkflowRunner,
679
- {
680
- people,
681
- ...runnerProps,
682
- workflow,
683
- run: view,
684
- renderAgentOutput,
685
- renderReview: (step) => conversationId ? /* @__PURE__ */ jsx(
686
- ReviewNotify,
687
- {
688
- conversationId,
689
- workspaceId: wsId,
690
- labels: l,
691
- testId: `${testIdPrefix}-${step.id}`
692
- }
693
- ) : null,
694
- onUpload,
695
- uploading,
696
- files,
697
- actions,
698
- nameOfDoc,
699
- testIdPrefix
700
- }
701
- ),
761
+ inThread && conversationId ? /* @__PURE__ */ jsxs(Fragment, { children: [
762
+ /* @__PURE__ */ jsx(
763
+ WorkflowStepBar,
764
+ {
765
+ run: view,
766
+ levels: stepLevels(view.steps),
767
+ doneTitle: (workflow.run.kind === "steps" ? workflow.run.completion?.title : void 0) ?? runnerProps.labels?.complete ?? "Done",
768
+ icon: (key) => key && runnerProps.renderIcon ? runnerProps.renderIcon(key) : void 0,
769
+ tid: (suffix) => `${testIdPrefix}-${suffix}`
770
+ }
771
+ ),
772
+ /* @__PURE__ */ jsx(
773
+ WorkflowRunThread,
774
+ {
775
+ conversationId,
776
+ workspaceId: wsId,
777
+ stepTitle: (id) => view.steps.find((s) => s.id === id)?.title,
778
+ targetMessageId: target,
779
+ labels: { workflows: l.currentStep },
780
+ aside: runner(true)
781
+ }
782
+ )
783
+ ] }) : runner(false),
702
784
  dialog?.kind === "sign" && /* @__PURE__ */ jsx(WorkflowSignDialog, { docRef: dialog.docRef, onClose: () => setDialog(null), labels: dl }),
703
785
  dialog?.kind === "word" && /* @__PURE__ */ jsx(
704
786
  WorkflowWordDialog,
@@ -793,6 +875,78 @@ function ReviewNotify({
793
875
  ] })
794
876
  ] });
795
877
  }
878
+ function ConnectedTagMatrix({
879
+ parentId,
880
+ linksLimit = 3,
881
+ exportTitle,
882
+ onExported,
883
+ readOnly,
884
+ ...props
885
+ }) {
886
+ const arbi = useArbi();
887
+ const { workspaceId, status, ensureWorkspaceOpen } = useConnection();
888
+ const matrix = useTagMatrix({ parentId }, { linksLimit });
889
+ const update = useUpdateTagFields();
890
+ const invalidate = useInvalidateTagData();
891
+ const members = useWorkspaceUsers(workspaceId ?? void 0, {
892
+ enabled: status === "authenticated" && !!workspaceId,
893
+ beforeFetch: ensureWorkspaceOpen
894
+ });
895
+ const [error, setError] = useState(null);
896
+ const people = (members.data ?? []).map((m) => ({
897
+ value: m.user.external_id,
898
+ label: [m.user.given_name, m.user.family_name].filter(Boolean).join(" ") || m.user.email
899
+ }));
900
+ const fail = (e) => setError(e instanceof Error ? e.message : String(e));
901
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
902
+ /* @__PURE__ */ jsx(
903
+ TagMatrix,
904
+ {
905
+ ...props,
906
+ matrix: matrix.data,
907
+ isLoading: matrix.isLoading,
908
+ people,
909
+ onChangeValue: readOnly ? void 0 : async (tagId, fieldId, value) => {
910
+ setError(null);
911
+ await update.mutateAsync({ tagId, values: { [fieldId]: value } }).catch(fail);
912
+ },
913
+ onAddRow: readOnly ? void 0 : async (name) => {
914
+ setError(null);
915
+ try {
916
+ await ensureWorkspaceOpen();
917
+ await arbi.tags.create({ name, parentId });
918
+ await invalidate();
919
+ } catch (e) {
920
+ fail(e);
921
+ }
922
+ },
923
+ onExport: onExported && matrix.data ? async () => {
924
+ setError(null);
925
+ try {
926
+ const data = matrix.data;
927
+ if (!data) return;
928
+ const title = exportTitle ?? data.parent?.name ?? "Matrix";
929
+ const markdown = tagMatrixMarkdown(data, {
930
+ title,
931
+ nameOf: (id2) => people.find((p) => p.value === id2)?.label
932
+ });
933
+ await ensureWorkspaceOpen();
934
+ const stamp = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
935
+ const uploaded = await arbi.documents.uploadFile(
936
+ new Blob([markdown], { type: "text/markdown" }),
937
+ `${title} (${stamp}).md`
938
+ );
939
+ const id = uploaded?.doc_ext_ids?.[0];
940
+ if (id) onExported(id);
941
+ } catch (e) {
942
+ fail(e);
943
+ }
944
+ } : void 0
945
+ }
946
+ ),
947
+ error && /* @__PURE__ */ jsx("p", { role: "alert", className: "text-sm text-destructive", children: error })
948
+ ] });
949
+ }
796
950
  function useConnectedShellWorkspaces(options = {}) {
797
951
  const { workspaceId, setWorkspace } = useConnection();
798
952
  const query = useWorkspaces();
@@ -1391,6 +1545,6 @@ function ConnectedAgentChatPanel({
1391
1545
  ] });
1392
1546
  }
1393
1547
 
1394
- export { ArbiAppProvider, ConnectedAgentChatPanel, ConnectedDangerZone, ConnectedIdentityVerification, ConnectedLogoutDialog, ConnectedNotificationPreferences, ConnectedProfileCard, ConnectedRequireVerified, ConnectedSecuritySection, ConnectedSessionsRow, ConnectedSkillUpload, ConnectedTaskAccessRequest, ConnectedWorkflowRunner, DEFAULT_CONNECTED_WORKFLOW_RUNNER_LABELS, StreamedArtifact, defaultUnmetPasswordRequirement, useConnectedDocxNotifications, useConnectedShellWorkspaces, useConnectedWorkNotifications };
1548
+ export { ArbiAppProvider, ConnectedAgentChatPanel, ConnectedDangerZone, ConnectedIdentityVerification, ConnectedLogoutDialog, ConnectedNotificationPreferences, ConnectedProfileCard, ConnectedRequireVerified, ConnectedSecuritySection, ConnectedSessionsRow, ConnectedSkillUpload, ConnectedTagMatrix, ConnectedTaskAccessRequest, ConnectedWorkflowRunner, DEFAULT_CONNECTED_WORKFLOW_RUNNER_LABELS, StreamedArtifact, WorkflowRunThread, defaultUnmetPasswordRequirement, useConnectedDocxNotifications, useConnectedShellWorkspaces, useConnectedWorkNotifications };
1395
1549
  //# sourceMappingURL=index.js.map
1396
1550
  //# sourceMappingURL=index.js.map