@arbidocs/blocks 0.5.114 → 0.5.115
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.
- package/dist/{ConnectedCallDock-2KXEQENS.cjs → ConnectedCallDock-WER7R222.cjs} +21 -21
- package/dist/{ConnectedCallDock-2KXEQENS.cjs.map → ConnectedCallDock-WER7R222.cjs.map} +1 -1
- package/dist/{ConnectedCallRoom-MU3NPNXF.cjs → ConnectedCallRoom-T7OBQTYP.cjs} +14 -14
- package/dist/{ConnectedCallRoom-MU3NPNXF.cjs.map → ConnectedCallRoom-T7OBQTYP.cjs.map} +1 -1
- package/dist/{ConnectedNativeDocxComparison-VH3I65H6.cjs → ConnectedNativeDocxComparison-YXMYJWXY.cjs} +19 -19
- package/dist/{ConnectedNativeDocxComparison-VH3I65H6.cjs.map → ConnectedNativeDocxComparison-YXMYJWXY.cjs.map} +1 -1
- package/dist/{ConnectedProductionSetDialog-4EAY6KAZ.cjs → ConnectedProductionSetDialog-LHB4VQWC.cjs} +3 -3
- package/dist/{ConnectedProductionSetDialog-4EAY6KAZ.cjs.map → ConnectedProductionSetDialog-LHB4VQWC.cjs.map} +1 -1
- package/dist/{ConnectedStreamedWordArtifact-KQSHCA75.cjs → ConnectedStreamedWordArtifact-2RTCHVPI.cjs} +19 -19
- package/dist/{ConnectedStreamedWordArtifact-KQSHCA75.cjs.map → ConnectedStreamedWordArtifact-2RTCHVPI.cjs.map} +1 -1
- package/dist/{DocumentReviewCard-OCPFVMLD.cjs → DocumentReviewCard-ZSBZBGFK.cjs} +15 -15
- package/dist/{DocumentReviewCard-OCPFVMLD.cjs.map → DocumentReviewCard-ZSBZBGFK.cjs.map} +1 -1
- package/dist/{FilesViewerDialog-BAGOEMXW.cjs → FilesViewerDialog-I5QIHQZT.cjs} +44 -44
- package/dist/{FilesViewerDialog-BAGOEMXW.cjs.map → FilesViewerDialog-I5QIHQZT.cjs.map} +1 -1
- package/dist/{NativeDocxEditor-EJEIJDOC.cjs → NativeDocxEditor-H6TAEVGY.cjs} +6 -6
- package/dist/{NativeDocxEditor-EJEIJDOC.cjs.map → NativeDocxEditor-H6TAEVGY.cjs.map} +1 -1
- package/dist/{WorkspaceTableView-IMAZICIZ.cjs → WorkspaceTableView-J3C6VH4T.cjs} +8 -8
- package/dist/{WorkspaceTableView-IMAZICIZ.cjs.map → WorkspaceTableView-J3C6VH4T.cjs.map} +1 -1
- package/dist/agents/index.cjs +297 -297
- package/dist/{ai-7U4B4CVF.cjs → ai-IM4A23YT.cjs} +24 -24
- package/dist/ai-IM4A23YT.cjs.map +1 -0
- package/dist/calls/index.cjs +121 -121
- package/dist/chat/DraftingDocChip.d.ts +3 -1
- package/dist/chat/DraftingDocChip.js +7 -4
- package/dist/chat/DraftingDocChip.js.map +2 -2
- package/dist/chat/index.cjs +37 -37
- package/dist/{chunk-AHT6DQNI.cjs → chunk-24EDG4PC.cjs} +50 -50
- package/dist/{chunk-AHT6DQNI.cjs.map → chunk-24EDG4PC.cjs.map} +1 -1
- package/dist/{chunk-Q6DQGGP4.cjs → chunk-325GVZE6.cjs} +3 -3
- package/dist/{chunk-Q6DQGGP4.cjs.map → chunk-325GVZE6.cjs.map} +1 -1
- package/dist/{chunk-HM5L4SBC.cjs → chunk-3A7QWUAW.cjs} +3 -3
- package/dist/{chunk-HM5L4SBC.cjs.map → chunk-3A7QWUAW.cjs.map} +1 -1
- package/dist/{chunk-ET3NVY27.cjs → chunk-42TURFHF.cjs} +5 -5
- package/dist/{chunk-ET3NVY27.cjs.map → chunk-42TURFHF.cjs.map} +1 -1
- package/dist/{chunk-LFRNBT2I.cjs → chunk-557MJ4IH.cjs} +20 -20
- package/dist/{chunk-LFRNBT2I.cjs.map → chunk-557MJ4IH.cjs.map} +1 -1
- package/dist/{chunk-JSQQV23D.cjs → chunk-6UTKM5AB.cjs} +3 -3
- package/dist/{chunk-JSQQV23D.cjs.map → chunk-6UTKM5AB.cjs.map} +1 -1
- package/dist/{chunk-H5OLHP2U.cjs → chunk-7OPOPYV6.cjs} +3 -3
- package/dist/{chunk-H5OLHP2U.cjs.map → chunk-7OPOPYV6.cjs.map} +1 -1
- package/dist/{chunk-MGQSLMTC.cjs → chunk-A3T3IC3K.cjs} +57 -57
- package/dist/{chunk-MGQSLMTC.cjs.map → chunk-A3T3IC3K.cjs.map} +1 -1
- package/dist/{chunk-WW6LXQY6.cjs → chunk-B3LZITVF.cjs} +12 -12
- package/dist/{chunk-WW6LXQY6.cjs.map → chunk-B3LZITVF.cjs.map} +1 -1
- package/dist/{chunk-V5IMYLYK.cjs → chunk-BQ5RIWWT.cjs} +3 -3
- package/dist/{chunk-V5IMYLYK.cjs.map → chunk-BQ5RIWWT.cjs.map} +1 -1
- package/dist/chunk-CIHERNDO.cjs +18 -0
- package/dist/{chunk-ZZA756I4.cjs.map → chunk-CIHERNDO.cjs.map} +1 -1
- package/dist/{chunk-MC4F2URI.cjs → chunk-CPG7II4E.cjs} +28 -28
- package/dist/{chunk-MC4F2URI.cjs.map → chunk-CPG7II4E.cjs.map} +1 -1
- package/dist/{chunk-7XT5B2DZ.cjs → chunk-CPR6EHG7.cjs} +47 -47
- package/dist/{chunk-7XT5B2DZ.cjs.map → chunk-CPR6EHG7.cjs.map} +1 -1
- package/dist/{chunk-3U36VYMD.cjs → chunk-DDIW4HLU.cjs} +27 -27
- package/dist/{chunk-3U36VYMD.cjs.map → chunk-DDIW4HLU.cjs.map} +1 -1
- package/dist/{chunk-INEPPS4H.cjs → chunk-IW7CDJTA.cjs} +4 -4
- package/dist/{chunk-INEPPS4H.cjs.map → chunk-IW7CDJTA.cjs.map} +1 -1
- package/dist/{chunk-IFOGBMAE.cjs → chunk-KLMNCBLY.cjs} +9 -6
- package/dist/chunk-KLMNCBLY.cjs.map +1 -0
- package/dist/{chunk-TDN33HSK.cjs → chunk-KTQOGT2L.cjs} +6 -6
- package/dist/{chunk-TDN33HSK.cjs.map → chunk-KTQOGT2L.cjs.map} +1 -1
- package/dist/{chunk-UUENH4BJ.cjs → chunk-KXIRVKCJ.cjs} +3 -3
- package/dist/{chunk-UUENH4BJ.cjs.map → chunk-KXIRVKCJ.cjs.map} +1 -1
- package/dist/{chunk-4ED7CNOX.cjs → chunk-M6IKVKU5.cjs} +40 -3
- package/dist/chunk-M6IKVKU5.cjs.map +1 -0
- package/dist/{chunk-XKDUPU7B.cjs → chunk-NJCK6V6U.cjs} +4 -4
- package/dist/{chunk-XKDUPU7B.cjs.map → chunk-NJCK6V6U.cjs.map} +1 -1
- package/dist/{chunk-5QUL5BZO.cjs → chunk-NNUK5ZM7.cjs} +4 -4
- package/dist/{chunk-5QUL5BZO.cjs.map → chunk-NNUK5ZM7.cjs.map} +1 -1
- package/dist/{chunk-4NPCDS2X.cjs → chunk-NY3YUCOW.cjs} +3 -3
- package/dist/{chunk-4NPCDS2X.cjs.map → chunk-NY3YUCOW.cjs.map} +1 -1
- package/dist/{chunk-6DCIZA3X.cjs → chunk-OEREKAAP.cjs} +75 -75
- package/dist/{chunk-6DCIZA3X.cjs.map → chunk-OEREKAAP.cjs.map} +1 -1
- package/dist/{chunk-3ODEWSRO.cjs → chunk-P77YTTJ3.cjs} +4 -4
- package/dist/{chunk-3ODEWSRO.cjs.map → chunk-P77YTTJ3.cjs.map} +1 -1
- package/dist/{chunk-LYTIQQQ2.cjs → chunk-R7CJEIA5.cjs} +3 -3
- package/dist/{chunk-LYTIQQQ2.cjs.map → chunk-R7CJEIA5.cjs.map} +1 -1
- package/dist/{chunk-2W5E62EY.cjs → chunk-SGYSDABK.cjs} +6 -6
- package/dist/{chunk-2W5E62EY.cjs.map → chunk-SGYSDABK.cjs.map} +1 -1
- package/dist/{chunk-UNDQYTRF.cjs → chunk-T23UTIRI.cjs} +6 -6
- package/dist/{chunk-UNDQYTRF.cjs.map → chunk-T23UTIRI.cjs.map} +1 -1
- package/dist/{chunk-E4BLRF2L.cjs → chunk-TDO5UWXF.cjs} +5 -5
- package/dist/{chunk-E4BLRF2L.cjs.map → chunk-TDO5UWXF.cjs.map} +1 -1
- package/dist/{chunk-4IOYQLKG.cjs → chunk-TP5PGWIO.cjs} +3 -3
- package/dist/{chunk-4IOYQLKG.cjs.map → chunk-TP5PGWIO.cjs.map} +1 -1
- package/dist/{chunk-7X3FS5HQ.cjs → chunk-TT4IF52H.cjs} +35 -35
- package/dist/{chunk-7X3FS5HQ.cjs.map → chunk-TT4IF52H.cjs.map} +1 -1
- package/dist/{chunk-GQXPNIRE.cjs → chunk-WAV762GP.cjs} +6 -6
- package/dist/{chunk-GQXPNIRE.cjs.map → chunk-WAV762GP.cjs.map} +1 -1
- package/dist/{chunk-436I7PQL.cjs → chunk-WR2SF44W.cjs} +9 -9
- package/dist/{chunk-436I7PQL.cjs.map → chunk-WR2SF44W.cjs.map} +1 -1
- package/dist/{chunk-MZ2KZXNU.cjs → chunk-WXUU3COI.cjs} +3 -3
- package/dist/{chunk-MZ2KZXNU.cjs.map → chunk-WXUU3COI.cjs.map} +1 -1
- package/dist/{chunk-NHHEMBXQ.cjs → chunk-X5LANJDZ.cjs} +12 -12
- package/dist/{chunk-NHHEMBXQ.cjs.map → chunk-X5LANJDZ.cjs.map} +1 -1
- package/dist/{chunk-BW5MF464.cjs → chunk-XKVPSOKP.cjs} +4 -4
- package/dist/{chunk-BW5MF464.cjs.map → chunk-XKVPSOKP.cjs.map} +1 -1
- package/dist/{chunk-57EE6CMW.cjs → chunk-Y24V6HPR.cjs} +15 -15
- package/dist/{chunk-57EE6CMW.cjs.map → chunk-Y24V6HPR.cjs.map} +1 -1
- package/dist/{chunk-7TEUGFIL.cjs → chunk-YGXOKB5Z.cjs} +4 -4
- package/dist/{chunk-7TEUGFIL.cjs.map → chunk-YGXOKB5Z.cjs.map} +1 -1
- package/dist/{chunk-3R6YHJ3G.cjs → chunk-ZTXQIIFV.cjs} +6 -6
- package/dist/{chunk-3R6YHJ3G.cjs.map → chunk-ZTXQIIFV.cjs.map} +1 -1
- package/dist/connect/docx.cjs +23 -23
- package/dist/connect/index.cjs +1231 -1069
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/viewer.cjs +33 -33
- package/dist/connection/conversation/ConnectedConversation.js +143 -55
- package/dist/connection/conversation/ConnectedConversation.js.map +2 -2
- package/dist/connection/conversation/ConversationSendButton.d.ts +1 -0
- package/dist/connection/conversation/ConversationSendButton.js +3 -2
- package/dist/connection/conversation/ConversationSendButton.js.map +2 -2
- package/dist/connection/conversation/DocumentTargetNotice.d.ts +7 -0
- package/dist/connection/conversation/DocumentTargetNotice.js +45 -0
- package/dist/connection/conversation/DocumentTargetNotice.js.map +7 -0
- package/dist/connection/conversation/documentSwitch.d.ts +9 -0
- package/dist/connection/conversation/documentSwitch.js +40 -0
- package/dist/connection/conversation/documentSwitch.js.map +7 -0
- package/dist/dashboards/index.cjs +1 -1
- package/dist/docx/NativeDocxEditor.js +3 -1
- package/dist/docx/NativeDocxEditor.js.map +2 -2
- package/dist/docx/index.cjs +38 -38
- package/dist/docx/signatures/SignatureFields.d.ts +2 -0
- package/dist/docx/signatures/SignatureFields.js +40 -2
- package/dist/docx/signatures/SignatureFields.js.map +2 -2
- package/dist/embed/index.cjs +38 -38
- package/dist/files/index.cjs +224 -224
- package/dist/index.cjs +1731 -1731
- package/dist/settings/index.cjs +147 -147
- package/dist/shell/index.cjs +90 -90
- package/dist/site/index.cjs +5 -5
- package/dist/studio/index.cjs +27 -27
- package/dist/styles.css +1 -1
- package/dist/workflow-canvas/index.cjs +54 -54
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +5 -5
- package/dist/ai-7U4B4CVF.cjs.map +0 -1
- package/dist/chunk-4ED7CNOX.cjs.map +0 -1
- package/dist/chunk-IFOGBMAE.cjs.map +0 -1
- package/dist/chunk-ZZA756I4.cjs +0 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/connection/docx/support.ts","../src/connection/ConnectedWorkflowsTable.tsx","../src/connection/docx/useConnectedDocxReferences.tsx","../src/connection/docx/useConnectedHouseTemplate.ts","../src/connection/docx/ConnectedNativeDocxEditor.tsx"],"names":["useHost","useConnectedWorkspace","useWorkspaceUsers","fmtDate","useBlocksEnvironment","useOpenWorkflow","useMemo","workflowSteps","useWorkflows","useConnectedConversations","useAgents","useUpdateWorkflow","useDeleteWorkflow","useRunWorkflow","useState","isScheduledWorkflow","useEffect","jsx","WorkflowsTable","workflowSignal","workflowTriggerType","toWorkflowFieldDocument","DocumentPicker","useArbi","useListedDocuments","useRef","buildDeepLinkUrl","parseDeepLinkPath","useSetWorkspaceHouseTemplate","useWorkspaces","supportsHouseTemplates","workspaceHouseTemplateId","useHouseTemplateCandidates","contentPath","isCandidate","useRegisterOpenDocument","jsxs","NativeDocxEditor","useQueryClient","useOptionalDocumentTools","refreshDocuments","fetchSavedSignature","storeSavedSignature"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,IAAM,aAAgC,EAAC;AACvC,IAAM,YAAY,MAAM,IAAA;AAEjB,SAAS,oBAAA,GAA0C;AACxD,EAAA,OAAOA,yBAAA,GAAU,IAAA,IAAQ,UAAA;AAC3B;AAGO,SAAS,oBAAA,GAAyE;AACvF,EAAA,MAAM,SAAA,GAAY,oBAAA,EAAqB,CAAE,gBAAA,IAAoB,SAAA;AAC7D,EAAA,OAAO,SAAA,EAAU;AACnB;ACIO,SAAS,yBAAA,GAA4B;AAC1C,EAAA,MAAM,EAAE,WAAA,EAAa,IAAA,EAAM,MAAA,EAAQ,mBAAA,KAAwBC,uCAAA,EAAsB;AACjF,EAAA,MAAM,EAAE,MAAM,OAAA,GAAU,IAAG,GAAIC,uBAAA,CAAkB,eAAe,MAAA,EAAW;AAAA,IACzE,OAAA,EAAS,IAAA,IAAQ,CAAC,CAAC,WAAA;AAAA,IACnB,WAAA,EAAa;AAAA,GACd,CAAA;AACD,EAAA,MAAM,IAAA,GAAO,QAAQ,IAAA,CAAK,CAAC,MAAM,CAAA,CAAE,IAAA,CAAK,WAAA,KAAgB,MAAM,CAAA,EAAG,I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QAAA,CAAS,IAAA,EAAK;AACtC,QAAA,MAAA,CAAO,sBAAsB,SAAS,CAAA;AACtC,QAAA,OAAO,EAAE,WAAA,EAAa,QAAA,CAAS,YAAA,IAAgB,EAAC,EAAE;AAAA,MACpD,CAAA;AAAA,MACA,cAAA,EAAgB,OAAO,UAAA,KAAA,CAAgB,MAAM,KAAK,SAAA,CAAU,WAAA,CAAY,UAAU,CAAA,EAAG,MAAA;AAAA,MACrF,aAAa,OAAA,CAAQ,WAAA;AAAA,MACrB,UAAA;AAAA,MACA,iBAAiB,OAAA,CAAQ,eAAA;AAAA,MACzB;AAAA,KACF,CAAA;AAAA,IACA;AAAA,MACE,IAAA;AAAA,MACA,MAAA;AAAA,MACA,OAAA;AAAA,MACA,mBAAA;AAAA,MACA,WAAA;AAAA,MACA,OAAA;AAAA,MACA,MAAA;AAAA,MACA,kBAAA;AAAA,MACA,OAAA;AAAA,MACA,UAAA;AAAA,MACA,aAAA;AAAA,MACA,IAAA,EAAM;AAAA;AACR,GACF;AACA,EAAA,OAAO,OAAA;AACT","file":"chunk-NHHEMBXQ.cjs","sourcesContent":["/**\n * What a host adds to the connected Word editor that the platform API alone cannot give: the\n * workspace's definitions (facts labelled \"Definitions\"), image generation (an assistant run), the\n * host's leave-page guard, and a comment to open the editor at. It is the host configuration's\n * `docx`; every field is optional, and without one the editor simply offers less (no Defined term,\n * no Generate image).\n */\n\nimport { useHost } from '../../provider/host'\nimport type { DefinitionSource } from '../../tags/definitions'\nimport type { DocxImageGeneration } from '../../docx/layout/GenerateImage'\n\nexport interface NativeDocxSupport {\n /** The workspace's definitions. Present: Insert offers Defined term and `@@` the type-ahead. */\n definitions?: () => Promise<DefinitionSource[]>\n /** The platform's image generation. Present: Insert offers Generate image. */\n imageGeneration?: DocxImageGeneration\n /** The open editor has (or no longer has) unsaved changes. */\n onDirtyChange?: (dirty: boolean) => void\n /** A comment thread to open when its document opens (a notification's link), as a hook. */\n useCommentTarget?: () => { documentId: string; commentId: string } | null\n}\n\nconst NO_SUPPORT: NativeDocxSupport = {}\nconst NO_TARGET = () => null\n\nexport function useNativeDocxSupport(): NativeDocxSupport {\n return useHost().docx ?? NO_SUPPORT\n}\n\n/** The comment thread to open with its document (none without the host's). */\nexport function useDocxCommentTarget(): { documentId: string; commentId: string } | null {\n const useTarget = useNativeDocxSupport().useCommentTarget ?? NO_TARGET\n return useTarget()\n}\n","/**\n * The saved workflows bound to the connection: when each starts, its last run (a link to the thread\n * it created) and next run, who runs it, pause and resume, share, run now, delete (one or many), and\n * the workflow's history. The host opens a workflow (its builder) and its history; threads open\n * through the environment's `openConversation`, failures are told through its `notify`.\n *\n * The host's catalogue (the host configuration's `workflows.catalogue`), when it has one, is listed\n * in its categories above the saved workflows: an entry opens in the builder (`onOpenTemplate`) or\n * runs (the environment's `openWorkflow(id, { view: 'run' })`). A filtered list (`filter`) is about\n * saved workflows only and leaves the catalogue out.\n */\n\nimport { useEffect, useMemo, useState } from 'react'\nimport {\n useAgents,\n useDeleteWorkflow,\n useRunWorkflow,\n useUpdateWorkflow,\n useWorkflows,\n useWorkspaceUsers,\n type WorkflowResponse,\n} from '@arbidocs/react'\nimport { WorkflowsTable, type WorkflowsTableProps } from '../agents/tasks/WorkflowsTable'\nimport type { WorkflowCatalogueRow } from '../agents/tasks/WorkflowCatalogueSections'\nimport {\n isScheduledWorkflow,\n workflowSignal,\n workflowTriggerType,\n} from '../agents/tasks/workflowRows'\nimport { workflowSteps } from '../agents/workflows/run'\nimport { fmtDate } from '../lib/format'\nimport { useBlocksEnvironment } from '../provider/environment'\nimport { useOpenWorkflow } from './workflows/useOpenWorkflow'\nimport { useHost } from '../provider/host'\nimport { useConnectedWorkspace } from './ConnectionProvider'\nimport { useConnectedConversations } from './workspaceData'\n\n/** The viewer's role in the open workspace, and the workspace's members. */\nexport function useConnectedWorkspaceRole() {\n const { workspaceId, live, userId, ensureWorkspaceOpen } = useConnectedWorkspace()\n const { data: members = [] } = useWorkspaceUsers(workspaceId ?? undefined, {\n enabled: live && !!workspaceId,\n beforeFetch: ensureWorkspaceOpen,\n })\n const role = members.find((m) => m.user.external_id === userId)?.role\n return {\n members,\n role,\n /** An owner or a collaborator edits, pauses, resumes and runs what is shared with the workspace. */\n canEditShared: role === 'owner' || role === 'collaborator',\n /** With an item's creator, the only one who deletes it. */\n isWorkspaceOwner: role === 'owner',\n }\n}\n\nexport interface ConnectedWorkflowsTableLabels {\n /** A change (pause, share, delete) that failed without a message. */\n updateFailed: string\n deleteTitle: string\n deleteOne: (name: string) => string\n deleteMany: (count: number) => string\n /** A run that failed: its history has the error report. */\n runFailed: string\n /** A run that created no thread. */\n noThread: string\n /** A document action that started (it has no thread): what is happening. */\n documentAction: (workflow: WorkflowResponse) => string\n untitledTask: string\n /** When a workflow that starts on a step signal starts (the default trigger text). */\n signalTrigger: (signal: string) => string\n}\n\nexport const DEFAULT_CONNECTED_WORKFLOWS_TABLE_LABELS: ConnectedWorkflowsTableLabels = {\n updateFailed: 'Could not update the workflow',\n deleteTitle: 'Delete workflow',\n deleteOne: (name) => `Delete “${name}”? Threads it already created stay.`,\n deleteMany: (count) => `Delete ${count} workflows? Threads they already created stay.`,\n runFailed: 'The workflow failed. You can send an error report from its history.',\n noThread: 'The workflow did not create a thread.',\n documentAction: (workflow) =>\n workflow.action?.type === 'email_documents'\n ? 'Preparing your document email'\n : 'Reviewing documents',\n untitledTask: 'Untitled thread',\n signalTrigger: (signal) => `When a step signals ${signal}`,\n}\n\ntype TableProps = WorkflowsTableProps<WorkflowResponse>\n\nexport interface ConnectedWorkflowsTableProps extends Omit<\n TableProps,\n | 'workflows'\n | 'isLoading'\n | 'busyId'\n | 'describeTrigger'\n | 'formatDate'\n | 'onToggleActive'\n | 'onToggleShared'\n | 'onDelete'\n | 'onDeleteMany'\n | 'onToggleActiveMany'\n | 'onRun'\n | 'onOpenThread'\n | 'lastRuns'\n | 'agentNames'\n | 'taskNames'\n | 'canEditShared'\n | 'isWorkspaceOwner'\n | 'catalogue'\n | 'categories'\n | 'renderIcon'\n> {\n /**\n * Which saved workflows to list: `scheduled` (those that start on a date or a repeat), or a\n * predicate. Default: all.\n */\n filter?: 'scheduled' | ((workflow: WorkflowResponse) => boolean)\n /**\n * When a workflow starts, in the host's words. Default: the step signal it starts on, else its\n * trigger type.\n */\n describeTrigger?: TableProps['describeTrigger']\n formatDate?: TableProps['formatDate']\n connectedLabels?: Partial<ConnectedWorkflowsTableLabels>\n}\n\nconst messageOf = (error: unknown) => (error instanceof Error ? error.message : '')\n\nexport function ConnectedWorkflowsTable({\n filter,\n describeTrigger,\n formatDate = fmtDate,\n onViewRuns,\n connectedLabels,\n onRunTemplate,\n ...tableProps\n}: ConnectedWorkflowsTableProps) {\n const l = { ...DEFAULT_CONNECTED_WORKFLOWS_TABLE_LABELS, ...connectedLabels }\n const { notify, confirm, openConversation } = useBlocksEnvironment()\n const openWorkflow = useOpenWorkflow()\n const host = useHost().workflows\n // A filtered list (the scheduled workflows) is about saved workflows only.\n const catalogueEntries = filter ? undefined : host?.catalogue\n const catalogue = useMemo(\n () =>\n catalogueEntries?.map(({ workflow, category, note, runnable }): WorkflowCatalogueRow => ({\n id: workflow.id,\n title: workflow.title,\n description: workflow.description,\n icon: workflow.icon,\n category,\n stepCount: workflowSteps(workflow).length,\n note,\n runnable,\n })),\n [catalogueEntries]\n )\n const { canEditShared, isWorkspaceOwner } = useConnectedWorkspaceRole()\n const { data: saved = [], isLoading } = useWorkflows({ live: true })\n const { data: conversations, refetch } = useConnectedConversations({ live: true })\n const { data: agents = [] } = useAgents()\n const update = useUpdateWorkflow()\n const remove = useDeleteWorkflow()\n const run = useRunWorkflow()\n const [busyId, setBusyId] = useState<string | null>(null)\n\n const workflows = useMemo(() => {\n const keep = filter === 'scheduled' ? isScheduledWorkflow : filter\n return keep ? saved.filter(keep) : saved\n }, [saved, filter])\n // A clock or an event fired a workflow: the thread it created is new to the conversation list.\n const firingStamp = saved.map((w) => `${w.external_id}:${w.last_fired_at ?? ''}`).join('|')\n useEffect(() => {\n void refetch?.()\n }, [firingStamp, refetch])\n\n const lastRuns = useMemo(() => {\n const out: NonNullable<TableProps['lastRuns']> = {}\n for (const c of conversations) {\n const id = c.workflow_ext_id\n if (id && (!out[id] || Date.parse(c.created_at) > Date.parse(out[id].at)))\n out[id] = { conversationId: c.external_id, at: c.created_at, threadStatus: c.status }\n }\n return out\n }, [conversations])\n const agentNames = useMemo(\n () => Object.fromEntries(agents.map((a) => [a.external_id, a.given_name || a.email])),\n [agents]\n )\n const taskNames = useMemo(\n () =>\n Object.fromEntries(\n conversations\n .filter((c) => c.status != null)\n .map((c) => [c.external_id, c.title || l.untitledTask])\n ),\n [conversations, l.untitledTask]\n )\n\n const act = async (workflow: WorkflowResponse, action: () => Promise<unknown>) => {\n setBusyId(workflow.external_id)\n try {\n await action()\n } catch (error) {\n notify(messageOf(error) || l.updateFailed, 'error')\n } finally {\n setBusyId(null)\n }\n }\n const setActive = (workflow: WorkflowResponse, active: boolean) =>\n act(workflow, () => update.mutateAsync({ workflowId: workflow.external_id, patch: { active } }))\n const deleteAll = async (items: WorkflowResponse[]) => {\n if (!items.length) return\n const ok = await confirm({\n title: l.deleteTitle,\n message: items.length === 1 ? l.deleteOne(items[0].name) : l.deleteMany(items.length),\n })\n if (!ok) return\n for (const workflow of items)\n await act(workflow, () => remove.mutateAsync(workflow.external_id))\n }\n\n return (\n <WorkflowsTable\n {...tableProps}\n workflows={workflows}\n isLoading={isLoading}\n busyId={busyId}\n describeTrigger={\n describeTrigger ??\n ((w) => {\n const signal = workflowSignal(w)\n return signal ? l.signalTrigger(signal) : workflowTriggerType(w).replaceAll('_', ' ')\n })\n }\n catalogue={catalogue}\n categories={host?.categories}\n renderIcon={host?.renderIcon}\n onRunTemplate={onRunTemplate ?? (openWorkflow && ((id) => openWorkflow(id, { view: 'run' })))}\n formatDate={formatDate}\n agentNames={agentNames}\n taskNames={taskNames}\n lastRuns={lastRuns}\n canEditShared={canEditShared}\n isWorkspaceOwner={isWorkspaceOwner}\n onOpenThread={(conversationId) => openConversation(conversationId)}\n onViewRuns={onViewRuns}\n onToggleActive={(workflow, active) => void setActive(workflow, active)}\n onToggleActiveMany={(items, active) => {\n void (async () => {\n for (const workflow of items) await setActive(workflow, active)\n })()\n }}\n onToggleShared={(workflow, shared) =>\n void act(workflow, () =>\n update.mutateAsync({ workflowId: workflow.external_id, patch: { shared } })\n )\n }\n onDelete={(workflow) => void deleteAll([workflow])}\n onDeleteMany={(items) => void deleteAll(items)}\n onRun={(workflow) =>\n void act(workflow, async () => {\n const result = await run.mutateAsync(workflow.external_id)\n if (result.conversation_ext_id) openConversation(result.conversation_ext_id)\n if (result.error) {\n onViewRuns?.(workflow)\n notify(l.runFailed, 'error')\n return\n }\n if (result.execution_id && !result.conversation_ext_id) {\n // A document action runs without a thread: its history shows how it goes.\n onViewRuns?.(workflow)\n notify(l.documentAction(workflow), 'success')\n return\n }\n if (!result.conversation_ext_id) throw new Error(l.noThread)\n })\n }\n />\n )\n}\n","/**\n * The Word editor's references to the workspace's other documents: the documents and their\n * passages (the same parsed passages a fact's citations quote), the ARBI address of a passage\n * (`/wrk-…/doc-…/cnk-…`, the deep link that opens a document at a passage, so the link works from\n * Word too), and opening one wherever the host shows documents, highlighted like a citation.\n */\nimport { useMemo, useRef } from 'react'\nimport { useArbi } from '@arbidocs/react'\nimport type { DocxReferencesAdapter } from '../../docx/references/CrossReferences'\nimport { DocumentPicker } from '../../settings/DocumentPicker'\nimport { buildDeepLinkUrl, parseDeepLinkPath } from '../../lib/deep-link'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useConnectedWorkspace } from '../ConnectionProvider'\nimport { toWorkflowFieldDocument } from '../ConnectedWorkflowLauncher'\nimport { useListedDocuments, type ConnectedDocument } from '../workspaceData'\n\ninterface ParsedChunk {\n content?: string | null\n metadata?: { chunk_ext_id?: string | null; page_number?: number | null } | null\n}\n\n/** Top-level documents only: an attachment opens with its parent. */\nconst isTopLevel = (doc: ConnectedDocument) => !doc.parent_ext_id\n\nfunction ReferencePicker({\n documents,\n selectedId,\n onSelect,\n}: {\n documents: ConnectedDocument[]\n selectedId: string | null\n onSelect: (documentId: string) => void\n}) {\n const groups = useMemo(() => {\n const docs = documents\n .filter(isTopLevel)\n .map(toWorkflowFieldDocument)\n .sort((a, b) => a.title.toLowerCase().localeCompare(b.title.toLowerCase()))\n return [{ id: 'all', heading: 'In this workspace', docs }]\n }, [documents])\n const selected = groups[0].docs.find((d) => d.id === selectedId)\n return (\n <DocumentPicker\n groups={groups}\n value={selectedId ?? ''}\n onValueChange={onSelect}\n selected={selected}\n labels={{ placeholder: 'Search documents…' }}\n />\n )\n}\n\nexport function useConnectedDocxReferences(): DocxReferencesAdapter {\n const arbi = useArbi()\n const { workspaceId } = useConnectedWorkspace()\n const { openDocument, runtimeConfig } = useBlocksEnvironment()\n const { data: documents } = useListedDocuments()\n // Read when called (the picker, a link): the list grows while the editor is open.\n const documentsRef = useRef(documents)\n documentsRef.current = documents\n return useMemo<DocxReferencesAdapter>(\n () => ({\n documents: async () =>\n documentsRef.current\n .filter(isTopLevel)\n .map((d) => ({ id: d.external_id, title: toWorkflowFieldDocument(d).title })),\n passages: async (documentId) => {\n const parsed = await arbi.documents.getParsedContent(documentId, 'final')\n return ((parsed.chunks ?? []) as ParsedChunk[]).flatMap((chunk) =>\n chunk.metadata?.chunk_ext_id && chunk.content?.trim()\n ? [\n {\n chunkId: chunk.metadata.chunk_ext_id,\n page: chunk.metadata.page_number ?? null,\n text: chunk.content,\n },\n ]\n : []\n )\n },\n linkFor: ({ documentId, chunkId, page }) => {\n const url = buildDeepLinkUrl(\n { workspaceId: workspaceId ?? undefined, documentId, chunkId },\n runtimeConfig.deploymentDomain\n )\n return page ? `${url}?page=${page}` : url\n },\n targetOf: (href) => {\n let url: URL\n try {\n url = new URL(href, window.location.origin)\n } catch {\n return null\n }\n const { documentId, chunkId } = parseDeepLinkPath(url.pathname)\n if (!documentId || !chunkId) return null\n const page = Number(url.searchParams.get('page')) || null\n return { documentId, chunkId, page }\n },\n open: ({ documentId, chunkId, page }) =>\n openDocument(documentId, { passageId: chunkId, page: page ?? undefined }),\n renderDocumentPicker: (onSelect, selectedId) => (\n <ReferencePicker\n documents={documentsRef.current}\n selectedId={selectedId}\n onSelect={onSelect}\n />\n ),\n }),\n [arbi, workspaceId, openDocument, runtimeConfig.deploymentDomain]\n )\n}\n","/**\n * The house template for the open workspace: its own (a document of the workspace), else the\n * deployment's default, else ARBI's built-in legal template. A workspace owner can make a document\n * the house template once the server supports it.\n */\nimport { useMemo } from 'react'\nimport {\n supportsHouseTemplates,\n useArbi,\n useHouseTemplateCandidates,\n useSetWorkspaceHouseTemplate,\n useWorkspaces,\n workspaceHouseTemplateId,\n} from '@arbidocs/react'\nimport { contentPath } from '../../docx/content-path'\nimport type { HouseTemplate, HouseTemplateHost } from '../../docx/template/HouseTemplate'\nimport { isCandidate } from '../../docx/template/candidates'\nimport { useConnectedWorkspace } from '../ConnectionProvider'\nimport { useConnectedWorkspaceRole } from '../ConnectedWorkflowsTable'\n\nexport function useConnectedHouseTemplate(): HouseTemplateHost {\n const arbi = useArbi()\n const { mutateAsync: setWorkspaceTemplate } = useSetWorkspaceHouseTemplate()\n const { workspaceId, live, ensureWorkspaceOpen } = useConnectedWorkspace()\n const { data: workspaces } = useWorkspaces({ enabled: live })\n const workspace = workspaces?.find((w) => w.external_id === workspaceId)\n const { isWorkspaceOwner } = useConnectedWorkspaceRole()\n const supported = supportsHouseTemplates(workspace)\n const templateId = workspaceHouseTemplateId(workspace)\n // Only an eligible document (shared, Word, here or in a public workspace) is offered as the template.\n const { data: candidates } = useHouseTemplateCandidates(\n workspaceId,\n supported && isWorkspaceOwner\n )\n return useMemo<HouseTemplateHost>(\n () => ({\n load: async (): Promise<HouseTemplate> => {\n if (templateId) {\n await ensureWorkspaceOpen()\n const response = await arbi.editor.request(contentPath(templateId))\n const [record] = await arbi.documents.get([templateId]).catch(() => [])\n return {\n bytes: new Uint8Array(await response.arrayBuffer()),\n name: record?.file_name ?? 'House template.docx',\n source: 'workspace',\n documentId: templateId,\n }\n }\n if (supported) {\n const deployment = await arbi.houseTemplates.deployment()\n if (deployment) return { ...deployment, source: 'deployment' }\n }\n // The built-in template comes with the Word editor's template code: loaded on demand.\n return (await import('../../docx/template/HouseTemplate')).builtinHouseTemplate()\n },\n setFromDocument:\n supported && isWorkspaceOwner\n ? async (documentId) => {\n await ensureWorkspaceOpen()\n await setWorkspaceTemplate(documentId)\n }\n : undefined,\n isEligible: (documentId) => isCandidate(candidates, documentId),\n }),\n [\n arbi,\n setWorkspaceTemplate,\n supported,\n templateId,\n isWorkspaceOwner,\n candidates,\n ensureWorkspaceOpen,\n ]\n )\n}\n","import { useMemo, useRef, useState } from 'react'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { refreshDocuments, useArbi, useWorkspaceUsers } from '@arbidocs/react'\nimport {\n fetchSavedSignature,\n storeSavedSignature,\n useOptionalDocumentTools,\n} from '@arbidocs/react/document-tools'\nimport type { NativeDocxAdapter, NativeDocxEditorProps } from '../../docx/NativeDocxEditor'\nimport { NativeDocxEditor } from '../../docx/lazy'\nimport { useRegisterOpenDocument } from '@arbidocs/react/shell'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useConnectedWorkspace } from '../ConnectionProvider'\nimport { useDocxCommentTarget, useNativeDocxSupport } from './support'\nimport { useConnectedDocxReferences } from './useConnectedDocxReferences'\nimport { useConnectedHouseTemplate } from './useConnectedHouseTemplate'\n\nexport type ConnectedNativeDocxEditorProps = Omit<NativeDocxEditorProps, 'adapter' | 'compact'> & {\n fontBaseUrl?: string\n}\n\n/**\n * The native Word editor on the signed-in ARBI session, under any host (`defaultHost`'s sign-in\n * layer, or the host's own `arbi` and session state). Until a live session has opened, a failure to\n * open one falls back to the saved copy, read-only, so the document is still readable; later token\n * refreshes are not guarded (switching modes would drop unsaved edits).\n */\nexport function ConnectedNativeDocxEditor({\n fontBaseUrl = '/native-docx/fonts',\n ...props\n}: ConnectedNativeDocxEditorProps) {\n const adapter = useConnectedNativeDocxAdapter(fontBaseUrl)\n const { workspaceId } = useConnectedWorkspace()\n const commentTarget = useDocxCommentTarget()\n const [openFailed, setOpenFailed] = useState(false)\n const hasOpened = useRef(false)\n const guardedAdapter = useMemo<NativeDocxAdapter>(\n () => ({\n ...adapter,\n open: async (documentId) => {\n try {\n const session = await adapter.open(documentId)\n hasOpened.current = true\n return session\n } catch (error) {\n if (!hasOpened.current) setOpenFailed(true)\n throw error\n }\n },\n }),\n [adapter]\n )\n // Drafting mode: the saved Word document being edited is what the chat is about. A history\n // snapshot, a streamed preview, an unsaved draft and an embedded body field are not.\n const live = !props.snapshot && !props.stream && !props.draftContent\n useRegisterOpenDocument({ documentId: live ? props.documentId : null, workspaceId })\n const initialCommentId =\n props.initialCommentId ??\n (commentTarget?.documentId === props.documentId ? commentTarget.commentId : undefined)\n return (\n <div className=\"flex h-full min-h-0 flex-col\">\n {openFailed && (\n <p role=\"status\" className=\"text-muted-foreground border-b px-3 py-2 text-xs\">\n Co-editing isn't available for this document right now, so this is a read-only copy\n of the last saved version.\n </p>\n )}\n <div className=\"min-h-0 flex-1\">\n <NativeDocxEditor\n {...props}\n snapshot={props.snapshot || openFailed}\n initialCommentId={initialCommentId}\n adapter={guardedAdapter}\n />\n </div>\n </div>\n )\n}\n\n/** The access token changed (a refresh): the live room is told the new one. */\nfunction tokenChanges(arbi: ReturnType<typeof useArbi>) {\n return (listener: () => void) => {\n if (!arbi.isLoggedIn) return () => {}\n const session = arbi.getClient().session\n let token = session.getState().accessToken\n return session.subscribe((state) => {\n if (state.accessToken === token) return\n token = state.accessToken\n listener()\n })\n }\n}\n\n/**\n * The native Word adapter on the signed-in session: the editor transport, the people to mention,\n * cross-references, the house template, and the host's extras (its host config's `docx`).\n */\nexport function useConnectedNativeDocxAdapter(fontBaseUrl = '/native-docx/fonts') {\n const arbi = useArbi()\n const { workspaceId, live, user, ensureWorkspaceOpen } = useConnectedWorkspace()\n const queries = useQueryClient()\n const { notify } = useBlocksEnvironment()\n const tools = useOptionalDocumentTools()\n const support = useNativeDocxSupport()\n const references = useConnectedDocxReferences()\n const houseTemplate = useConnectedHouseTemplate()\n const { data: members } = useWorkspaceUsers(workspaceId ?? undefined, {\n enabled: live && !!workspaceId,\n beforeFetch: ensureWorkspaceOpen,\n })\n const onDocumentsChanged = tools?.onDocumentsChanged\n // Tracked changes and comments are authored by the user's first name.\n const author = (live && arbi.user.profile()?.givenName) || user?.name || 'You'\n const adapter = useMemo<NativeDocxAdapter>(\n () => ({\n request: async (path, options) => {\n await ensureWorkspaceOpen()\n return arbi.editor.request(path, options)\n },\n open: async (id) => {\n await ensureWorkspaceOpen()\n return (\n await arbi.editor.request(`/${encodeURIComponent(id)}/session`, { method: 'POST' })\n ).json()\n },\n save: async (id, state) =>\n (\n await arbi.editor.request(`/${encodeURIComponent(id)}/save`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ state }),\n })\n ).json(),\n loadFonts: () => import('../../docx/fonts').then((m) => m.loadDocxFonts(fontBaseUrl)),\n baseUrl: arbi.getConnectionInfo()?.baseUrl || window.location.origin,\n author,\n subscribeTokenChanges: tokenChanges(arbi),\n onDirtyChange: support.onDirtyChange,\n // The document's row moves to the saved version in place: through the host when it keeps\n // the lists (its document tools refresh them), else here.\n onVersionSaved: async (id) => {\n await (onDocumentsChanged\n ? onDocumentsChanged([id], 'version')\n : refreshDocuments(queries, arbi, [id]))\n },\n notify,\n mentions: members?.map(({ user: member }) => ({\n id: member.external_id,\n name: [member.given_name, member.family_name].filter(Boolean).join(' '),\n kind: member.external_id.startsWith('agt-') ? 'agent' : 'human',\n })),\n savedSignature: {\n load: () => fetchSavedSignature(arbi.getClient().fetch),\n save: (signature) => storeSavedSignature(arbi.getClient().fetch, signature),\n defaultName: user?.name ?? '',\n },\n signatureSigners: members\n ?.filter(({ user: member }) => member.external_id.startsWith('usr-'))\n .map(({ user: member }) => ({\n email: member.email,\n name: [member.given_name, member.family_name].filter(Boolean).join(' '),\n })),\n requestAgent: async (id, request) => {\n const response = await arbi.editor.request(`/${encodeURIComponent(id)}/mentions`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n comment_id: request.commentId,\n instruction: request.instruction,\n request_id: request.requestId,\n recipient_ids: request.recipientIds,\n }),\n })\n const delivery = (await response.json()) as { response_ids: string[] }\n notify('Mention delivered.', 'success')\n return { responseIds: delivery.response_ids || [] }\n },\n getAgentStatus: async (responseId) => (await arbi.assistant.getResponse(responseId)).status,\n definitions: support.definitions,\n references,\n imageGeneration: support.imageGeneration,\n houseTemplate,\n }),\n [\n arbi,\n author,\n members,\n ensureWorkspaceOpen,\n fontBaseUrl,\n queries,\n notify,\n onDocumentsChanged,\n support,\n references,\n houseTemplate,\n user?.name,\n ]\n )\n return adapter\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/connection/docx/support.ts","../src/connection/ConnectedWorkflowsTable.tsx","../src/connection/docx/useConnectedDocxReferences.tsx","../src/connection/docx/useConnectedHouseTemplate.ts","../src/connection/docx/ConnectedNativeDocxEditor.tsx"],"names":["useHost","useConnectedWorkspace","useWorkspaceUsers","fmtDate","useBlocksEnvironment","useOpenWorkflow","useMemo","workflowSteps","useWorkflows","useConnectedConversations","useAgents","useUpdateWorkflow","useDeleteWorkflow","useRunWorkflow","useState","isScheduledWorkflow","useEffect","jsx","WorkflowsTable","workflowSignal","workflowTriggerType","toWorkflowFieldDocument","DocumentPicker","useArbi","useListedDocuments","useRef","buildDeepLinkUrl","parseDeepLinkPath","useSetWorkspaceHouseTemplate","useWorkspaces","supportsHouseTemplates","workspaceHouseTemplateId","useHouseTemplateCandidates","contentPath","isCandidate","useRegisterOpenDocument","jsxs","NativeDocxEditor","useQueryClient","useOptionalDocumentTools","refreshDocuments","fetchSavedSignature","storeSavedSignature"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,IAAM,aAAgC,EAAC;AACvC,IAAM,YAAY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A,MACA,aAAA;AAAA,MACA,IAAA,EAAM;AAAA;AACR,GACF;AACA,EAAA,OAAO,OAAA;AACT","file":"chunk-X5LANJDZ.cjs","sourcesContent":["/**\n * What a host adds to the connected Word editor that the platform API alone cannot give: the\n * workspace's definitions (facts labelled \"Definitions\"), image generation (an assistant run), the\n * host's leave-page guard, and a comment to open the editor at. It is the host configuration's\n * `docx`; every field is optional, and without one the editor simply offers less (no Defined term,\n * no Generate image).\n */\n\nimport { useHost } from '../../provider/host'\nimport type { DefinitionSource } from '../../tags/definitions'\nimport type { DocxImageGeneration } from '../../docx/layout/GenerateImage'\n\nexport interface NativeDocxSupport {\n /** The workspace's definitions. Present: Insert offers Defined term and `@@` the type-ahead. */\n definitions?: () => Promise<DefinitionSource[]>\n /** The platform's image generation. Present: Insert offers Generate image. */\n imageGeneration?: DocxImageGeneration\n /** The open editor has (or no longer has) unsaved changes. */\n onDirtyChange?: (dirty: boolean) => void\n /** A comment thread to open when its document opens (a notification's link), as a hook. */\n useCommentTarget?: () => { documentId: string; commentId: string } | null\n}\n\nconst NO_SUPPORT: NativeDocxSupport = {}\nconst NO_TARGET = () => null\n\nexport function useNativeDocxSupport(): NativeDocxSupport {\n return useHost().docx ?? NO_SUPPORT\n}\n\n/** The comment thread to open with its document (none without the host's). */\nexport function useDocxCommentTarget(): { documentId: string; commentId: string } | null {\n const useTarget = useNativeDocxSupport().useCommentTarget ?? NO_TARGET\n return useTarget()\n}\n","/**\n * The saved workflows bound to the connection: when each starts, its last run (a link to the thread\n * it created) and next run, who runs it, pause and resume, share, run now, delete (one or many), and\n * the workflow's history. The host opens a workflow (its builder) and its history; threads open\n * through the environment's `openConversation`, failures are told through its `notify`.\n *\n * The host's catalogue (the host configuration's `workflows.catalogue`), when it has one, is listed\n * in its categories above the saved workflows: an entry opens in the builder (`onOpenTemplate`) or\n * runs (the environment's `openWorkflow(id, { view: 'run' })`). A filtered list (`filter`) is about\n * saved workflows only and leaves the catalogue out.\n */\n\nimport { useEffect, useMemo, useState } from 'react'\nimport {\n useAgents,\n useDeleteWorkflow,\n useRunWorkflow,\n useUpdateWorkflow,\n useWorkflows,\n useWorkspaceUsers,\n type WorkflowResponse,\n} from '@arbidocs/react'\nimport { WorkflowsTable, type WorkflowsTableProps } from '../agents/tasks/WorkflowsTable'\nimport type { WorkflowCatalogueRow } from '../agents/tasks/WorkflowCatalogueSections'\nimport {\n isScheduledWorkflow,\n workflowSignal,\n workflowTriggerType,\n} from '../agents/tasks/workflowRows'\nimport { workflowSteps } from '../agents/workflows/run'\nimport { fmtDate } from '../lib/format'\nimport { useBlocksEnvironment } from '../provider/environment'\nimport { useOpenWorkflow } from './workflows/useOpenWorkflow'\nimport { useHost } from '../provider/host'\nimport { useConnectedWorkspace } from './ConnectionProvider'\nimport { useConnectedConversations } from './workspaceData'\n\n/** The viewer's role in the open workspace, and the workspace's members. */\nexport function useConnectedWorkspaceRole() {\n const { workspaceId, live, userId, ensureWorkspaceOpen } = useConnectedWorkspace()\n const { data: members = [] } = useWorkspaceUsers(workspaceId ?? undefined, {\n enabled: live && !!workspaceId,\n beforeFetch: ensureWorkspaceOpen,\n })\n const role = members.find((m) => m.user.external_id === userId)?.role\n return {\n members,\n role,\n /** An owner or a collaborator edits, pauses, resumes and runs what is shared with the workspace. */\n canEditShared: role === 'owner' || role === 'collaborator',\n /** With an item's creator, the only one who deletes it. */\n isWorkspaceOwner: role === 'owner',\n }\n}\n\nexport interface ConnectedWorkflowsTableLabels {\n /** A change (pause, share, delete) that failed without a message. */\n updateFailed: string\n deleteTitle: string\n deleteOne: (name: string) => string\n deleteMany: (count: number) => string\n /** A run that failed: its history has the error report. */\n runFailed: string\n /** A run that created no thread. */\n noThread: string\n /** A document action that started (it has no thread): what is happening. */\n documentAction: (workflow: WorkflowResponse) => string\n untitledTask: string\n /** When a workflow that starts on a step signal starts (the default trigger text). */\n signalTrigger: (signal: string) => string\n}\n\nexport const DEFAULT_CONNECTED_WORKFLOWS_TABLE_LABELS: ConnectedWorkflowsTableLabels = {\n updateFailed: 'Could not update the workflow',\n deleteTitle: 'Delete workflow',\n deleteOne: (name) => `Delete “${name}”? Threads it already created stay.`,\n deleteMany: (count) => `Delete ${count} workflows? Threads they already created stay.`,\n runFailed: 'The workflow failed. You can send an error report from its history.',\n noThread: 'The workflow did not create a thread.',\n documentAction: (workflow) =>\n workflow.action?.type === 'email_documents'\n ? 'Preparing your document email'\n : 'Reviewing documents',\n untitledTask: 'Untitled thread',\n signalTrigger: (signal) => `When a step signals ${signal}`,\n}\n\ntype TableProps = WorkflowsTableProps<WorkflowResponse>\n\nexport interface ConnectedWorkflowsTableProps extends Omit<\n TableProps,\n | 'workflows'\n | 'isLoading'\n | 'busyId'\n | 'describeTrigger'\n | 'formatDate'\n | 'onToggleActive'\n | 'onToggleShared'\n | 'onDelete'\n | 'onDeleteMany'\n | 'onToggleActiveMany'\n | 'onRun'\n | 'onOpenThread'\n | 'lastRuns'\n | 'agentNames'\n | 'taskNames'\n | 'canEditShared'\n | 'isWorkspaceOwner'\n | 'catalogue'\n | 'categories'\n | 'renderIcon'\n> {\n /**\n * Which saved workflows to list: `scheduled` (those that start on a date or a repeat), or a\n * predicate. Default: all.\n */\n filter?: 'scheduled' | ((workflow: WorkflowResponse) => boolean)\n /**\n * When a workflow starts, in the host's words. Default: the step signal it starts on, else its\n * trigger type.\n */\n describeTrigger?: TableProps['describeTrigger']\n formatDate?: TableProps['formatDate']\n connectedLabels?: Partial<ConnectedWorkflowsTableLabels>\n}\n\nconst messageOf = (error: unknown) => (error instanceof Error ? error.message : '')\n\nexport function ConnectedWorkflowsTable({\n filter,\n describeTrigger,\n formatDate = fmtDate,\n onViewRuns,\n connectedLabels,\n onRunTemplate,\n ...tableProps\n}: ConnectedWorkflowsTableProps) {\n const l = { ...DEFAULT_CONNECTED_WORKFLOWS_TABLE_LABELS, ...connectedLabels }\n const { notify, confirm, openConversation } = useBlocksEnvironment()\n const openWorkflow = useOpenWorkflow()\n const host = useHost().workflows\n // A filtered list (the scheduled workflows) is about saved workflows only.\n const catalogueEntries = filter ? undefined : host?.catalogue\n const catalogue = useMemo(\n () =>\n catalogueEntries?.map(({ workflow, category, note, runnable }): WorkflowCatalogueRow => ({\n id: workflow.id,\n title: workflow.title,\n description: workflow.description,\n icon: workflow.icon,\n category,\n stepCount: workflowSteps(workflow).length,\n note,\n runnable,\n })),\n [catalogueEntries]\n )\n const { canEditShared, isWorkspaceOwner } = useConnectedWorkspaceRole()\n const { data: saved = [], isLoading } = useWorkflows({ live: true })\n const { data: conversations, refetch } = useConnectedConversations({ live: true })\n const { data: agents = [] } = useAgents()\n const update = useUpdateWorkflow()\n const remove = useDeleteWorkflow()\n const run = useRunWorkflow()\n const [busyId, setBusyId] = useState<string | null>(null)\n\n const workflows = useMemo(() => {\n const keep = filter === 'scheduled' ? isScheduledWorkflow : filter\n return keep ? saved.filter(keep) : saved\n }, [saved, filter])\n // A clock or an event fired a workflow: the thread it created is new to the conversation list.\n const firingStamp = saved.map((w) => `${w.external_id}:${w.last_fired_at ?? ''}`).join('|')\n useEffect(() => {\n void refetch?.()\n }, [firingStamp, refetch])\n\n const lastRuns = useMemo(() => {\n const out: NonNullable<TableProps['lastRuns']> = {}\n for (const c of conversations) {\n const id = c.workflow_ext_id\n if (id && (!out[id] || Date.parse(c.created_at) > Date.parse(out[id].at)))\n out[id] = { conversationId: c.external_id, at: c.created_at, threadStatus: c.status }\n }\n return out\n }, [conversations])\n const agentNames = useMemo(\n () => Object.fromEntries(agents.map((a) => [a.external_id, a.given_name || a.email])),\n [agents]\n )\n const taskNames = useMemo(\n () =>\n Object.fromEntries(\n conversations\n .filter((c) => c.status != null)\n .map((c) => [c.external_id, c.title || l.untitledTask])\n ),\n [conversations, l.untitledTask]\n )\n\n const act = async (workflow: WorkflowResponse, action: () => Promise<unknown>) => {\n setBusyId(workflow.external_id)\n try {\n await action()\n } catch (error) {\n notify(messageOf(error) || l.updateFailed, 'error')\n } finally {\n setBusyId(null)\n }\n }\n const setActive = (workflow: WorkflowResponse, active: boolean) =>\n act(workflow, () => update.mutateAsync({ workflowId: workflow.external_id, patch: { active } }))\n const deleteAll = async (items: WorkflowResponse[]) => {\n if (!items.length) return\n const ok = await confirm({\n title: l.deleteTitle,\n message: items.length === 1 ? l.deleteOne(items[0].name) : l.deleteMany(items.length),\n })\n if (!ok) return\n for (const workflow of items)\n await act(workflow, () => remove.mutateAsync(workflow.external_id))\n }\n\n return (\n <WorkflowsTable\n {...tableProps}\n workflows={workflows}\n isLoading={isLoading}\n busyId={busyId}\n describeTrigger={\n describeTrigger ??\n ((w) => {\n const signal = workflowSignal(w)\n return signal ? l.signalTrigger(signal) : workflowTriggerType(w).replaceAll('_', ' ')\n })\n }\n catalogue={catalogue}\n categories={host?.categories}\n renderIcon={host?.renderIcon}\n onRunTemplate={onRunTemplate ?? (openWorkflow && ((id) => openWorkflow(id, { view: 'run' })))}\n formatDate={formatDate}\n agentNames={agentNames}\n taskNames={taskNames}\n lastRuns={lastRuns}\n canEditShared={canEditShared}\n isWorkspaceOwner={isWorkspaceOwner}\n onOpenThread={(conversationId) => openConversation(conversationId)}\n onViewRuns={onViewRuns}\n onToggleActive={(workflow, active) => void setActive(workflow, active)}\n onToggleActiveMany={(items, active) => {\n void (async () => {\n for (const workflow of items) await setActive(workflow, active)\n })()\n }}\n onToggleShared={(workflow, shared) =>\n void act(workflow, () =>\n update.mutateAsync({ workflowId: workflow.external_id, patch: { shared } })\n )\n }\n onDelete={(workflow) => void deleteAll([workflow])}\n onDeleteMany={(items) => void deleteAll(items)}\n onRun={(workflow) =>\n void act(workflow, async () => {\n const result = await run.mutateAsync(workflow.external_id)\n if (result.conversation_ext_id) openConversation(result.conversation_ext_id)\n if (result.error) {\n onViewRuns?.(workflow)\n notify(l.runFailed, 'error')\n return\n }\n if (result.execution_id && !result.conversation_ext_id) {\n // A document action runs without a thread: its history shows how it goes.\n onViewRuns?.(workflow)\n notify(l.documentAction(workflow), 'success')\n return\n }\n if (!result.conversation_ext_id) throw new Error(l.noThread)\n })\n }\n />\n )\n}\n","/**\n * The Word editor's references to the workspace's other documents: the documents and their\n * passages (the same parsed passages a fact's citations quote), the ARBI address of a passage\n * (`/wrk-…/doc-…/cnk-…`, the deep link that opens a document at a passage, so the link works from\n * Word too), and opening one wherever the host shows documents, highlighted like a citation.\n */\nimport { useMemo, useRef } from 'react'\nimport { useArbi } from '@arbidocs/react'\nimport type { DocxReferencesAdapter } from '../../docx/references/CrossReferences'\nimport { DocumentPicker } from '../../settings/DocumentPicker'\nimport { buildDeepLinkUrl, parseDeepLinkPath } from '../../lib/deep-link'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useConnectedWorkspace } from '../ConnectionProvider'\nimport { toWorkflowFieldDocument } from '../ConnectedWorkflowLauncher'\nimport { useListedDocuments, type ConnectedDocument } from '../workspaceData'\n\ninterface ParsedChunk {\n content?: string | null\n metadata?: { chunk_ext_id?: string | null; page_number?: number | null } | null\n}\n\n/** Top-level documents only: an attachment opens with its parent. */\nconst isTopLevel = (doc: ConnectedDocument) => !doc.parent_ext_id\n\nfunction ReferencePicker({\n documents,\n selectedId,\n onSelect,\n}: {\n documents: ConnectedDocument[]\n selectedId: string | null\n onSelect: (documentId: string) => void\n}) {\n const groups = useMemo(() => {\n const docs = documents\n .filter(isTopLevel)\n .map(toWorkflowFieldDocument)\n .sort((a, b) => a.title.toLowerCase().localeCompare(b.title.toLowerCase()))\n return [{ id: 'all', heading: 'In this workspace', docs }]\n }, [documents])\n const selected = groups[0].docs.find((d) => d.id === selectedId)\n return (\n <DocumentPicker\n groups={groups}\n value={selectedId ?? ''}\n onValueChange={onSelect}\n selected={selected}\n labels={{ placeholder: 'Search documents…' }}\n />\n )\n}\n\nexport function useConnectedDocxReferences(): DocxReferencesAdapter {\n const arbi = useArbi()\n const { workspaceId } = useConnectedWorkspace()\n const { openDocument, runtimeConfig } = useBlocksEnvironment()\n const { data: documents } = useListedDocuments()\n // Read when called (the picker, a link): the list grows while the editor is open.\n const documentsRef = useRef(documents)\n documentsRef.current = documents\n return useMemo<DocxReferencesAdapter>(\n () => ({\n documents: async () =>\n documentsRef.current\n .filter(isTopLevel)\n .map((d) => ({ id: d.external_id, title: toWorkflowFieldDocument(d).title })),\n passages: async (documentId) => {\n const parsed = await arbi.documents.getParsedContent(documentId, 'final')\n return ((parsed.chunks ?? []) as ParsedChunk[]).flatMap((chunk) =>\n chunk.metadata?.chunk_ext_id && chunk.content?.trim()\n ? [\n {\n chunkId: chunk.metadata.chunk_ext_id,\n page: chunk.metadata.page_number ?? null,\n text: chunk.content,\n },\n ]\n : []\n )\n },\n linkFor: ({ documentId, chunkId, page }) => {\n const url = buildDeepLinkUrl(\n { workspaceId: workspaceId ?? undefined, documentId, chunkId },\n runtimeConfig.deploymentDomain\n )\n return page ? `${url}?page=${page}` : url\n },\n targetOf: (href) => {\n let url: URL\n try {\n url = new URL(href, window.location.origin)\n } catch {\n return null\n }\n const { documentId, chunkId } = parseDeepLinkPath(url.pathname)\n if (!documentId || !chunkId) return null\n const page = Number(url.searchParams.get('page')) || null\n return { documentId, chunkId, page }\n },\n open: ({ documentId, chunkId, page }) =>\n openDocument(documentId, { passageId: chunkId, page: page ?? undefined }),\n renderDocumentPicker: (onSelect, selectedId) => (\n <ReferencePicker\n documents={documentsRef.current}\n selectedId={selectedId}\n onSelect={onSelect}\n />\n ),\n }),\n [arbi, workspaceId, openDocument, runtimeConfig.deploymentDomain]\n )\n}\n","/**\n * The house template for the open workspace: its own (a document of the workspace), else the\n * deployment's default, else ARBI's built-in legal template. A workspace owner can make a document\n * the house template once the server supports it.\n */\nimport { useMemo } from 'react'\nimport {\n supportsHouseTemplates,\n useArbi,\n useHouseTemplateCandidates,\n useSetWorkspaceHouseTemplate,\n useWorkspaces,\n workspaceHouseTemplateId,\n} from '@arbidocs/react'\nimport { contentPath } from '../../docx/content-path'\nimport type { HouseTemplate, HouseTemplateHost } from '../../docx/template/HouseTemplate'\nimport { isCandidate } from '../../docx/template/candidates'\nimport { useConnectedWorkspace } from '../ConnectionProvider'\nimport { useConnectedWorkspaceRole } from '../ConnectedWorkflowsTable'\n\nexport function useConnectedHouseTemplate(): HouseTemplateHost {\n const arbi = useArbi()\n const { mutateAsync: setWorkspaceTemplate } = useSetWorkspaceHouseTemplate()\n const { workspaceId, live, ensureWorkspaceOpen } = useConnectedWorkspace()\n const { data: workspaces } = useWorkspaces({ enabled: live })\n const workspace = workspaces?.find((w) => w.external_id === workspaceId)\n const { isWorkspaceOwner } = useConnectedWorkspaceRole()\n const supported = supportsHouseTemplates(workspace)\n const templateId = workspaceHouseTemplateId(workspace)\n // Only an eligible document (shared, Word, here or in a public workspace) is offered as the template.\n const { data: candidates } = useHouseTemplateCandidates(\n workspaceId,\n supported && isWorkspaceOwner\n )\n return useMemo<HouseTemplateHost>(\n () => ({\n load: async (): Promise<HouseTemplate> => {\n if (templateId) {\n await ensureWorkspaceOpen()\n const response = await arbi.editor.request(contentPath(templateId))\n const [record] = await arbi.documents.get([templateId]).catch(() => [])\n return {\n bytes: new Uint8Array(await response.arrayBuffer()),\n name: record?.file_name ?? 'House template.docx',\n source: 'workspace',\n documentId: templateId,\n }\n }\n if (supported) {\n const deployment = await arbi.houseTemplates.deployment()\n if (deployment) return { ...deployment, source: 'deployment' }\n }\n // The built-in template comes with the Word editor's template code: loaded on demand.\n return (await import('../../docx/template/HouseTemplate')).builtinHouseTemplate()\n },\n setFromDocument:\n supported && isWorkspaceOwner\n ? async (documentId) => {\n await ensureWorkspaceOpen()\n await setWorkspaceTemplate(documentId)\n }\n : undefined,\n isEligible: (documentId) => isCandidate(candidates, documentId),\n }),\n [\n arbi,\n setWorkspaceTemplate,\n supported,\n templateId,\n isWorkspaceOwner,\n candidates,\n ensureWorkspaceOpen,\n ]\n )\n}\n","import { useMemo, useRef, useState } from 'react'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { refreshDocuments, useArbi, useWorkspaceUsers } from '@arbidocs/react'\nimport {\n fetchSavedSignature,\n storeSavedSignature,\n useOptionalDocumentTools,\n} from '@arbidocs/react/document-tools'\nimport type { NativeDocxAdapter, NativeDocxEditorProps } from '../../docx/NativeDocxEditor'\nimport { NativeDocxEditor } from '../../docx/lazy'\nimport { useRegisterOpenDocument } from '@arbidocs/react/shell'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useConnectedWorkspace } from '../ConnectionProvider'\nimport { useDocxCommentTarget, useNativeDocxSupport } from './support'\nimport { useConnectedDocxReferences } from './useConnectedDocxReferences'\nimport { useConnectedHouseTemplate } from './useConnectedHouseTemplate'\n\nexport type ConnectedNativeDocxEditorProps = Omit<NativeDocxEditorProps, 'adapter' | 'compact'> & {\n fontBaseUrl?: string\n}\n\n/**\n * The native Word editor on the signed-in ARBI session, under any host (`defaultHost`'s sign-in\n * layer, or the host's own `arbi` and session state). Until a live session has opened, a failure to\n * open one falls back to the saved copy, read-only, so the document is still readable; later token\n * refreshes are not guarded (switching modes would drop unsaved edits).\n */\nexport function ConnectedNativeDocxEditor({\n fontBaseUrl = '/native-docx/fonts',\n ...props\n}: ConnectedNativeDocxEditorProps) {\n const adapter = useConnectedNativeDocxAdapter(fontBaseUrl)\n const { workspaceId } = useConnectedWorkspace()\n const commentTarget = useDocxCommentTarget()\n const [openFailed, setOpenFailed] = useState(false)\n const hasOpened = useRef(false)\n const guardedAdapter = useMemo<NativeDocxAdapter>(\n () => ({\n ...adapter,\n open: async (documentId) => {\n try {\n const session = await adapter.open(documentId)\n hasOpened.current = true\n return session\n } catch (error) {\n if (!hasOpened.current) setOpenFailed(true)\n throw error\n }\n },\n }),\n [adapter]\n )\n // Drafting mode: the saved Word document being edited is what the chat is about. A history\n // snapshot, a streamed preview, an unsaved draft and an embedded body field are not.\n const live = !props.snapshot && !props.stream && !props.draftContent\n useRegisterOpenDocument({ documentId: live ? props.documentId : null, workspaceId })\n const initialCommentId =\n props.initialCommentId ??\n (commentTarget?.documentId === props.documentId ? commentTarget.commentId : undefined)\n return (\n <div className=\"flex h-full min-h-0 flex-col\">\n {openFailed && (\n <p role=\"status\" className=\"text-muted-foreground border-b px-3 py-2 text-xs\">\n Co-editing isn't available for this document right now, so this is a read-only copy\n of the last saved version.\n </p>\n )}\n <div className=\"min-h-0 flex-1\">\n <NativeDocxEditor\n {...props}\n snapshot={props.snapshot || openFailed}\n initialCommentId={initialCommentId}\n adapter={guardedAdapter}\n />\n </div>\n </div>\n )\n}\n\n/** The access token changed (a refresh): the live room is told the new one. */\nfunction tokenChanges(arbi: ReturnType<typeof useArbi>) {\n return (listener: () => void) => {\n if (!arbi.isLoggedIn) return () => {}\n const session = arbi.getClient().session\n let token = session.getState().accessToken\n return session.subscribe((state) => {\n if (state.accessToken === token) return\n token = state.accessToken\n listener()\n })\n }\n}\n\n/**\n * The native Word adapter on the signed-in session: the editor transport, the people to mention,\n * cross-references, the house template, and the host's extras (its host config's `docx`).\n */\nexport function useConnectedNativeDocxAdapter(fontBaseUrl = '/native-docx/fonts') {\n const arbi = useArbi()\n const { workspaceId, live, user, ensureWorkspaceOpen } = useConnectedWorkspace()\n const queries = useQueryClient()\n const { notify } = useBlocksEnvironment()\n const tools = useOptionalDocumentTools()\n const support = useNativeDocxSupport()\n const references = useConnectedDocxReferences()\n const houseTemplate = useConnectedHouseTemplate()\n const { data: members } = useWorkspaceUsers(workspaceId ?? undefined, {\n enabled: live && !!workspaceId,\n beforeFetch: ensureWorkspaceOpen,\n })\n const onDocumentsChanged = tools?.onDocumentsChanged\n // Tracked changes and comments are authored by the user's first name.\n const author = (live && arbi.user.profile()?.givenName) || user?.name || 'You'\n const adapter = useMemo<NativeDocxAdapter>(\n () => ({\n request: async (path, options) => {\n await ensureWorkspaceOpen()\n return arbi.editor.request(path, options)\n },\n open: async (id) => {\n await ensureWorkspaceOpen()\n return (\n await arbi.editor.request(`/${encodeURIComponent(id)}/session`, { method: 'POST' })\n ).json()\n },\n save: async (id, state) =>\n (\n await arbi.editor.request(`/${encodeURIComponent(id)}/save`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ state }),\n })\n ).json(),\n loadFonts: () => import('../../docx/fonts').then((m) => m.loadDocxFonts(fontBaseUrl)),\n baseUrl: arbi.getConnectionInfo()?.baseUrl || window.location.origin,\n author,\n subscribeTokenChanges: tokenChanges(arbi),\n onDirtyChange: support.onDirtyChange,\n // The document's row moves to the saved version in place: through the host when it keeps\n // the lists (its document tools refresh them), else here.\n onVersionSaved: async (id) => {\n await (onDocumentsChanged\n ? onDocumentsChanged([id], 'version')\n : refreshDocuments(queries, arbi, [id]))\n },\n notify,\n mentions: members?.map(({ user: member }) => ({\n id: member.external_id,\n name: [member.given_name, member.family_name].filter(Boolean).join(' '),\n kind: member.external_id.startsWith('agt-') ? 'agent' : 'human',\n })),\n savedSignature: {\n load: () => fetchSavedSignature(arbi.getClient().fetch),\n save: (signature) => storeSavedSignature(arbi.getClient().fetch, signature),\n defaultName: user?.name ?? '',\n },\n signatureSigners: members\n ?.filter(({ user: member }) => member.external_id.startsWith('usr-'))\n .map(({ user: member }) => ({\n email: member.email,\n name: [member.given_name, member.family_name].filter(Boolean).join(' '),\n })),\n requestAgent: async (id, request) => {\n const response = await arbi.editor.request(`/${encodeURIComponent(id)}/mentions`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n comment_id: request.commentId,\n instruction: request.instruction,\n request_id: request.requestId,\n recipient_ids: request.recipientIds,\n }),\n })\n const delivery = (await response.json()) as { response_ids: string[] }\n notify('Mention delivered.', 'success')\n return { responseIds: delivery.response_ids || [] }\n },\n getAgentStatus: async (responseId) => (await arbi.assistant.getResponse(responseId)).status,\n definitions: support.definitions,\n references,\n imageGeneration: support.imageGeneration,\n houseTemplate,\n }),\n [\n arbi,\n author,\n members,\n ensureWorkspaceOpen,\n fontBaseUrl,\n queries,\n notify,\n onDocumentsChanged,\n support,\n references,\n houseTemplate,\n user?.name,\n ]\n )\n return adapter\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkDDIW4HLU_cjs = require('./chunk-DDIW4HLU.cjs');
|
|
5
5
|
var chunkQGVOT7E4_cjs = require('./chunk-QGVOT7E4.cjs');
|
|
6
6
|
var react = require('react');
|
|
7
7
|
|
|
@@ -45,7 +45,7 @@ function useWorkflowPreview(workflow, { answer = "{prompt}", delayMs = 400, reso
|
|
|
45
45
|
}, delayMs)
|
|
46
46
|
);
|
|
47
47
|
}, [states, steps, workflow]);
|
|
48
|
-
return
|
|
48
|
+
return chunkDDIW4HLU_cjs.useWorkflowView({
|
|
49
49
|
steps,
|
|
50
50
|
states,
|
|
51
51
|
inputs,
|
|
@@ -58,5 +58,5 @@ function useWorkflowPreview(workflow, { answer = "{prompt}", delayMs = 400, reso
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
exports.useWorkflowPreview = useWorkflowPreview;
|
|
61
|
-
//# sourceMappingURL=chunk-
|
|
62
|
-
//# sourceMappingURL=chunk-
|
|
61
|
+
//# sourceMappingURL=chunk-XKVPSOKP.cjs.map
|
|
62
|
+
//# sourceMappingURL=chunk-XKVPSOKP.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/agents/workflows/useWorkflowPreview.ts"],"names":["workflowSteps","useState","initialRunInputs","useRef","useEffect","stepPhase","composeStepPrompt","useWorkflowView"],"mappings":";;;;;;AAwBO,SAAS,kBAAA,CACd,QAAA,EACA,EAAE,MAAA,GAAS,UAAA,EAAY,OAAA,GAAU,GAAA,EAAK,eAAA,EAAiB,OAAA,EAAQ,GAA+B,EAAC,EAC9E;AACjB,EAAA,MAAM,KAAA,GAAQA,gCAAc,QAAQ,CAAA;AACpC,EAAA,MAAM,CAAC,QAAQ,SAAS,CAAA,GAAIC,eAAyB,MAAMC,kCAAA,CAAiB,QAAQ,CAAC,CAAA;AACrF,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,GAAID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AI,IAAI,EAAE,MAAA,EAAQ,WAAW,CAAA;AAAA,IACjD,KAAA,EAAO,OAAO,EAAA,KAAO,GAAA,CAAI,IAAI,EAAE,MAAA,EAAQ,WAAW,CAAA;AAAA,IAClD,UAAU,CAAC,EAAA,KAAO,MAAA,CAAO,EAAE,GAAG,MAAA,KAAW;AAAA,GAC1C,CAAA;AACH","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/agents/workflows/useWorkflowPreview.ts"],"names":["workflowSteps","useState","initialRunInputs","useRef","useEffect","stepPhase","composeStepPrompt","useWorkflowView"],"mappings":";;;;;;AAwBO,SAAS,kBAAA,CACd,QAAA,EACA,EAAE,MAAA,GAAS,UAAA,EAAY,OAAA,GAAU,GAAA,EAAK,eAAA,EAAiB,OAAA,EAAQ,GAA+B,EAAC,EAC9E;AACjB,EAAA,MAAM,KAAA,GAAQA,gCAAc,QAAQ,CAAA;AACpC,EAAA,MAAM,CAAC,QAAQ,SAAS,CAAA,GAAIC,eAAyB,MAAMC,kCAAA,CAAiB,QAAQ,CAAC,CAAA;AACrF,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,GAAID,cAAA,CAA4C,EAAE,CAAA;AAC1E,EAAA,MAAM,GAAA,GAAM,CAAC,EAAA,EAAY,KAAA,KAA6B,UAAU,CAAC,CAAA,MAAO,EAAE,GAAG,CAAA,EAAG,CAAC,EAAE,GAAG,OAAM,CAAE,CAAA;AAI9F,EAAA,MAAM,MAAA,GAASE,YAAA,iBAAO,IAAI,GAAA,EAA4C,CAAA;AACtE,EAAAC,eAAA,CAAU,MAAM;AACd,IAAA,MAAM,UAAU,MAAA,CAAO,OAAA;AACvB,IAAA,OAAO,MAAM;AACX,MAAA,KAAA,MAAW,CAAA,IAAK,OAAA,CAAQ,MAAA,EAAO,eAAgB,CAAC,CAAA;AAChD,MAAA,OAAA,CAAQ,KAAA,EAAM;AACd,MAAA,SAAA;AAAA,QAAU,CAAC,MACT,MAAA,CAAO,WAAA;AAAA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AC7B,QAAA,GAAA;AAAA,UACE,IAAA,CAAK,EAAA;AAAA,UACL,IAAA,CAAK,IAAA,KAAS,OAAA,GACV,EAAE,QAAQ,MAAA,EAAQ,IAAA,EAAM,MAAA,CAAO,OAAA,CAAQ,YAAY,MAAM,CAAA,EAAE,GAC3D,EAAE,QAAQ,MAAA;AAAO,SACvB;AAAA,MACF,GAAG,OAAO;AAAA,KACZ;AAAA,EAGF,CAAA,EAAG,CAAC,MAAA,EAAQ,KAAA,EAAO,QAAQ,CAAC,CAAA;AAE5B,EAAA,OAAOC,iCAAA,CAAgB;AAAA,IACrB,KAAA;AAAA,IACA,MAAA;AAAA,IACA,MAAA;AAAA,IACA,QAAA,EAAU,CAAC,IAAA,EAAM,KAAA,KAAU,UAAU,CAAC,CAAA,MAAO,EAAE,GAAG,CAAA,EAAG,CAAC,IAAI,GAAG,OAAM,CAAE,CAAA;AAAA,IACrE,QAAA,EAAU,OAAO,IAAA,KAAS,GAAA,CAAI,KAAK,EAAA,EAAI,EAAE,MAAA,EAAQ,MAAA,EAAQ,CAAA;AAAA,IACzD,IAAA,EAAM,OAAO,EAAA,KAAO,GAAA,CAAI,IAAI,EAAE,MAAA,EAAQ,WAAW,CAAA;AAAA,IACjD,KAAA,EAAO,OAAO,EAAA,KAAO,GAAA,CAAI,IAAI,EAAE,MAAA,EAAQ,WAAW,CAAA;AAAA,IAClD,UAAU,CAAC,EAAA,KAAO,MAAA,CAAO,EAAE,GAAG,MAAA,KAAW;AAAA,GAC1C,CAAA;AACH","file":"chunk-XKVPSOKP.cjs","sourcesContent":["/**\n * A stepped workflow run on screen only (the builder's preview): agent steps run one at a time,\n * the way the server does, and answer with the prompt they would send; action steps just finish.\n * No thread, no agent.\n */\n\nimport { useEffect, useRef, useState } from 'react'\nimport {\n composeStepPrompt,\n initialRunInputs,\n stepPhase,\n workflowSteps,\n type StepComposeOptions,\n} from './run'\nimport type { WorkflowDefinition, WorkflowInputs, WorkflowStepState } from './types'\nimport { useWorkflowView, type WorkflowRunView } from './useWorkflowView'\n\nexport interface UseWorkflowPreviewOptions extends StepComposeOptions {\n /** What a stand-in agent step answers; `{prompt}` is replaced with the prompt it would send. */\n answer?: string\n /** How long a stand-in step takes. */\n delayMs?: number\n}\n\nexport function useWorkflowPreview(\n workflow: WorkflowDefinition,\n { answer = '{prompt}', delayMs = 400, resolveWorkflow, compose }: UseWorkflowPreviewOptions = {}\n): WorkflowRunView {\n const steps = workflowSteps(workflow)\n const [inputs, setInputs] = useState<WorkflowInputs>(() => initialRunInputs(workflow))\n const [states, setStates] = useState<Record<string, WorkflowStepState>>({})\n const set = (id: string, state: WorkflowStepState) => setStates((s) => ({ ...s, [id]: state }))\n\n // A stand-in step's timer outlives the re-render its start causes; it is cleared on unmount, and\n // a step it cut short starts again (StrictMode mounts twice).\n const timers = useRef(new Map<string, ReturnType<typeof setTimeout>>())\n useEffect(() => {\n const pending = timers.current\n return () => {\n for (const t of pending.values()) clearTimeout(t)\n pending.clear()\n setStates((s) =>\n Object.fromEntries(\n Object.entries(s).map(([id, v]) => [\n id,\n v.status === 'running' ? { status: 'pending' } : v,\n ])\n )\n )\n }\n }, [])\n\n // One turn at a time: start the first ready agent step when nothing is running.\n useEffect(() => {\n if (Object.values(states).some((s) => s.status === 'running')) return\n // An action step (a signature, an email, a review) stands in the same way, with no answer.\n const next = steps.find(\n (s) =>\n (s.kind === 'agent' || s.kind === 'action') && stepPhase(steps, states, s.id) === 'ready'\n )\n if (!next || (next.kind !== 'agent' && next.kind !== 'action')) return\n const prompt =\n next.kind === 'agent'\n ? composeStepPrompt(workflow, next, inputs, { resolveWorkflow, compose })\n : ''\n set(next.id, { status: 'running', startedAt: new Date().toISOString() })\n timers.current.set(\n next.id,\n setTimeout(() => {\n timers.current.delete(next.id)\n set(\n next.id,\n next.kind === 'agent'\n ? { status: 'done', text: answer.replace('{prompt}', prompt) }\n : { status: 'done' }\n )\n }, delayMs)\n )\n // `inputs` are read when a step starts, not watched.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [states, steps, workflow])\n\n return useWorkflowView({\n steps,\n states,\n inputs,\n setInput: (name, value) => setInputs((i) => ({ ...i, [name]: value })),\n complete: async (step) => set(step.id, { status: 'done' }),\n skip: async (id) => set(id, { status: 'skipped' }),\n retry: async (id) => set(id, { status: 'pending' }),\n isLocked: (id) => states[id]?.status === 'done',\n })\n}\n"]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkP77YTTJ3_cjs = require('./chunk-P77YTTJ3.cjs');
|
|
5
5
|
var chunkP5AQYC4D_cjs = require('./chunk-P5AQYC4D.cjs');
|
|
6
|
-
var
|
|
7
|
-
var chunkHSLPFBK2_cjs = require('./chunk-HSLPFBK2.cjs');
|
|
8
|
-
var chunkQGVOT7E4_cjs = require('./chunk-QGVOT7E4.cjs');
|
|
6
|
+
var chunkTP5PGWIO_cjs = require('./chunk-TP5PGWIO.cjs');
|
|
9
7
|
var chunkSBWIA4PL_cjs = require('./chunk-SBWIA4PL.cjs');
|
|
10
8
|
var chunkQMIHLJMH_cjs = require('./chunk-QMIHLJMH.cjs');
|
|
11
9
|
var chunkJR2YSBD5_cjs = require('./chunk-JR2YSBD5.cjs');
|
|
10
|
+
var chunkHSLPFBK2_cjs = require('./chunk-HSLPFBK2.cjs');
|
|
11
|
+
var chunkQGVOT7E4_cjs = require('./chunk-QGVOT7E4.cjs');
|
|
12
12
|
var chunkTKHCIHE2_cjs = require('./chunk-TKHCIHE2.cjs');
|
|
13
13
|
var ui = require('@arbidocs/react/ui');
|
|
14
14
|
var lucideReact = require('lucide-react');
|
|
@@ -48,16 +48,16 @@ function useConnectedThreadActivity(conversationId) {
|
|
|
48
48
|
const assistantCopy = shell.useAssistantCopy();
|
|
49
49
|
const workspaceExtId = react.useArbiSessionState((s) => s.workspaceId);
|
|
50
50
|
const task = conversations.find((c) => c.external_id === conversationId);
|
|
51
|
-
const latestMessageAt =
|
|
51
|
+
const latestMessageAt = chunkTP5PGWIO_cjs.latestMessageTime(messageHistory);
|
|
52
52
|
const events = (activity.data ?? []).filter(
|
|
53
|
-
(event) => !
|
|
53
|
+
(event) => !chunkTP5PGWIO_cjs.isSupersededStop(event, latestMessageAt)
|
|
54
54
|
);
|
|
55
55
|
const personName = (extId) => {
|
|
56
56
|
const person = members.find((m) => m.user.external_id === extId)?.user;
|
|
57
57
|
return person ? ui.getUserDisplayName(person) : "someone";
|
|
58
58
|
};
|
|
59
|
-
const planSteps =
|
|
60
|
-
const entries =
|
|
59
|
+
const planSteps = chunkTP5PGWIO_cjs.fromPlanSteps(task?.plan?.steps ?? []);
|
|
60
|
+
const entries = chunkTP5PGWIO_cjs.compactThreadActivity(events, (id) => planSteps.find((s) => s.id === id)?.title);
|
|
61
61
|
const items = entries.map(({ event, label, recipients }) => {
|
|
62
62
|
const messageActivity = [
|
|
63
63
|
"created",
|
|
@@ -83,7 +83,7 @@ function useConnectedThreadActivity(conversationId) {
|
|
|
83
83
|
const messageId = sourceMessage ?? [...messageHistory].reverse().find((message) => Date.parse(message.created_at ?? "") <= Date.parse(event.created_at))?.external_id ?? messageHistory[0]?.external_id;
|
|
84
84
|
const doc = docId ? docs.find((d) => d.external_id === docId) : void 0;
|
|
85
85
|
const mailDraftId = event.kind === "notified" && event.detail?.event === "mail_draft_ready" && typeof event.detail?.mail_id === "string" ? event.detail.mail_id : void 0;
|
|
86
|
-
const missed = event.kind === "notified" && recipients.length ?
|
|
86
|
+
const missed = event.kind === "notified" && recipients.length ? chunkTP5PGWIO_cjs.unnotifiedMentions(
|
|
87
87
|
messageHistory.find((message) => message.external_id === sourceMessage)?.mentions,
|
|
88
88
|
recipients,
|
|
89
89
|
event.actor_ext_id
|
|
@@ -116,7 +116,7 @@ function useConnectedThreadActivity(conversationId) {
|
|
|
116
116
|
) : void 0,
|
|
117
117
|
docId,
|
|
118
118
|
docTitle: doc ? ui.getDocumentTitle(doc) : void 0,
|
|
119
|
-
label: mailDraftId ? "Left a draft email" : event.kind === "notified" && recipients.length ?
|
|
119
|
+
label: mailDraftId ? "Left a draft email" : event.kind === "notified" && recipients.length ? chunkTP5PGWIO_cjs.notifiedLabel(recipients.map(personName), missed.map(personName)) : label,
|
|
120
120
|
description: [
|
|
121
121
|
name,
|
|
122
122
|
label,
|
|
@@ -130,7 +130,7 @@ function useConnectedThreadActivity(conversationId) {
|
|
|
130
130
|
stepChip: eventStep ? stepChipOf(eventStep, event.kind, stepDocument) : void 0,
|
|
131
131
|
// No avatar tooltip: the entry is already a button (or titled row) that carries the same
|
|
132
132
|
// details, and a tooltip trigger inside it would be a nested <button>.
|
|
133
|
-
avatar: assistant ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
133
|
+
avatar: assistant ? /* @__PURE__ */ jsxRuntime.jsx(chunkTP5PGWIO_cjs.AssistantEntity, { variant: "icon", size: 20, showTooltip: false }) : member ? /* @__PURE__ */ jsxRuntime.jsx(chunkP77YTTJ3_cjs.DocumentUser, { user: member, tooltip: false }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Clock, { className: "size-4 text-muted-foreground" }),
|
|
134
134
|
time: ui.formatRelativeTime(event.created_at, { style: "short" }),
|
|
135
135
|
exactTime: ui.formatFriendlyDate(event.created_at),
|
|
136
136
|
onOpenDocument: docId && doc ? () => openDocument(docId) : void 0,
|
|
@@ -179,7 +179,7 @@ function useConnectedThreadActivity(conversationId) {
|
|
|
179
179
|
onSelect: () => navigateToConversation(source)
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
|
-
const links =
|
|
182
|
+
const links = chunkTP5PGWIO_cjs.linkedRunsFromActivity(activity.data);
|
|
183
183
|
const threadName = (id, workflowId) => conversations.find((c) => c.external_id === id)?.title || workflows.find((w) => w.external_id === workflowId)?.name || "Linked thread";
|
|
184
184
|
const signals = links.raised.map((raised) => ({
|
|
185
185
|
step: raised.step,
|
|
@@ -194,7 +194,7 @@ function useConnectedThreadActivity(conversationId) {
|
|
|
194
194
|
if (links.startedBy) {
|
|
195
195
|
const { conversationId: parentId, step, signal } = links.startedBy;
|
|
196
196
|
const parent = conversations.find((c) => c.external_id === parentId);
|
|
197
|
-
const parentSteps =
|
|
197
|
+
const parentSteps = chunkTP5PGWIO_cjs.fromPlanSteps(parent?.plan?.steps ?? []);
|
|
198
198
|
startedBy = {
|
|
199
199
|
stepTitle: parentSteps.find((s) => s.id === step)?.title ?? step ?? "a step",
|
|
200
200
|
threadTitle: parent?.title || "another thread",
|
|
@@ -218,5 +218,5 @@ function useSelectWorkspace() {
|
|
|
218
218
|
|
|
219
219
|
exports.useConnectedThreadActivity = useConnectedThreadActivity;
|
|
220
220
|
exports.useSelectWorkspace = useSelectWorkspace;
|
|
221
|
-
//# sourceMappingURL=chunk-
|
|
222
|
-
//# sourceMappingURL=chunk-
|
|
221
|
+
//# sourceMappingURL=chunk-Y24V6HPR.cjs.map
|
|
222
|
+
//# sourceMappingURL=chunk-Y24V6HPR.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/connection/tasks/useConnectedThreadActivity.tsx","../src/connection/useSelectWorkspace.ts"],"names":["stepKindOf","STEP_KIND_ICONS","jsx","useWorkflows","useConversationItems","useWorkspaceUsers","useDocuments","useConversationActivity","useConversationData","useBlocksEnvironment","useOpenWorkflow","useAssistantCopy","useArbiSessionState","latestMessageTime","isSupersededStop","getUserDisplayName","fromPlanSteps","compactThreadActivity","splitDocRef","getDocumentTitle","unnotifiedMentions","parseCallLogDetail","ThreadCallLogCard","formatRelativeTime","RecordingCard","notifiedLabel","AssistantEntity","DocumentUser","Clock","formatFriendlyDate","linkedRunsFromActivity","useOptionalConnection","useSwitchWorkspace","useCallback"],"mappings":";;;;;;;;;;;;;;;;;;AA2CA,IAAM,iBAAA,GAAuD;AAAA;AAAA,EAE3D,YAAA,EAAc,OAAA;AAAA,EACd,YAAA,EAAc,SAAA;AAAA,EACd,aAAA,EAAe,SAAA;AAAA,EAC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jD,MAAA,IAAI,CAAE,MAAM,eAAA,CAAgB,EAAE,EAAA,EAAI,CAAA,EAAI,MAAM,IAAI,KAAA,CAAM,8BAA8B,CAAA;AAAA,IACtF,CAAA;AAAA,IACA,CAAC,YAAY,eAAe;AAAA,GAC9B;AACF","file":"chunk-57EE6CMW.cjs","sourcesContent":["import {\n formatFriendlyDate,\n getDocumentTitle,\n getUserDisplayName,\n formatRelativeTime,\n} from '@arbidocs/react/ui'\nimport { Clock } from 'lucide-react'\nimport {\n useConversationActivity,\n useWorkflows,\n useDocuments,\n useWorkspaceUsers,\n useArbiSessionState,\n useConversationData,\n useConversationItems,\n} from '@arbidocs/react'\nimport { useAssistantCopy } from '@arbidocs/react/shell'\nimport { STEP_KIND_ICONS, stepKindOf } from '../../agents/workflows/stepKinds'\nimport { compactThreadActivity } from '../../agents/tasks/compact-thread-activity'\nimport { fromPlanSteps, type TaskPlanStep } from '../../agents/workflows/planSteps'\nimport { splitDocRef, type WorkflowStepPhase } from '../../agents/workflows/run'\nimport { type WorkflowStep } from '../../agents/workflows/types'\nimport { linkedRunsFromActivity } from '../../agents/tasks/linkedRuns'\nimport { type TaskActivityEvent } from '../../agents/tasks/TaskActivityTimeline'\nimport {\n type WorkflowThreadOrigin,\n type WorkflowThreadSignal,\n} from '../../agents/tasks/WorkflowThreadStrip'\nimport { ThreadCallLogCard } from '../../calls/connected/ThreadCallLogCard'\nimport { RecordingCard } from '../../calls/connected/RecordingCard'\nimport { parseCallLogDetail } from '../../calls/call-cards'\nimport { AssistantEntity } from '../../agents/tasks/AssistantEntity'\nimport {\n isSupersededStop,\n latestMessageTime,\n notifiedLabel,\n unnotifiedMentions,\n} from '../../agents/tasks/taskHelpers'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useOpenWorkflow } from '../workflows/useOpenWorkflow'\nimport { DocumentUser } from '../files/fields/DocumentUser'\n\n/** The phase a step event puts its step in, for its chip in the transcript. */\nconst STEP_EVENT_PHASES: Record<string, WorkflowStepPhase> = {\n // A past \"started\" is not still running: the step's own chip (on the bar) says where it is now.\n step_started: 'ready',\n step_waiting: 'waiting',\n step_progress: 'waiting',\n step_done: 'done',\n step_skipped: 'skipped',\n step_failed: 'failed',\n step_sent_back: 'ready',\n}\n\n/** A step event's chip in the transcript: its step's kind and icon, the phase the event set. */\nfunction stepChipOf(\n step: WorkflowStep,\n eventKind: string,\n document?: { name: string; onOpen: () => void }\n) {\n const phase = STEP_EVENT_PHASES[eventKind]\n if (!phase) return undefined\n const kind = stepKindOf(step)\n const KindIcon = STEP_KIND_ICONS[kind]\n return { kind, phase, icon: <KindIcon />, document }\n}\n\n/**\n * A thread's persisted history, as its top bar's ribbon and its transcript show it: each entry with\n * its actor, its step chip, the document or email it is about and where a click goes; the threads\n * linked to it (what started it, what it starts); the signals its steps raised. Documents,\n * threads, email drafts and workflows open through the host's environment.\n */\nexport function useConnectedThreadActivity(conversationId: string | null | undefined) {\n const { data: workflows = [] } = useWorkflows()\n const { conversations } = useConversationItems()\n const { data: members = [] } = useWorkspaceUsers()\n const { data: docs = [] } = useDocuments()\n const activity = useConversationActivity(conversationId ?? undefined, { live: true })\n const { messageHistory } = useConversationData()\n const environment = useBlocksEnvironment()\n const { openDocument, openMail } = environment\n const navigateToConversation = (id: string, messageId?: string) =>\n environment.openConversation(id, messageId ? { messageId } : undefined)\n // The host's Workflows page, while it has one (absent: a workflow has nowhere to open).\n const openWorkflow = useOpenWorkflow()\n const assistantCopy = useAssistantCopy()\n const workspaceExtId = useArbiSessionState((s) => s.workspaceId)\n const task = conversations.find((c) => c.external_id === conversationId)\n const latestMessageAt = latestMessageTime(messageHistory)\n const events = ((activity.data ?? []) as TaskActivityEvent[]).filter(\n (event) => !isSupersededStop(event, latestMessageAt)\n )\n const personName = (extId: string) => {\n const person = members.find((m) => m.user.external_id === extId)?.user\n return person ? getUserDisplayName(person) : 'someone'\n }\n // The run's steps, from its plan: step events are named after their step and drawn as its chip.\n const planSteps = fromPlanSteps((task?.plan?.steps ?? []) as TaskPlanStep[])\n const entries = compactThreadActivity(events, (id) => planSteps.find((s) => s.id === id)?.title)\n const items = entries.map(({ event, label, recipients }) => {\n const messageActivity = [\n 'created',\n 'participant_joined',\n 'assistant_responded',\n 'assistant_stopped',\n ].includes(event.kind)\n // A stop is about the assistant's turn (the event names no actor), so it is shown as ARBI's.\n const eventStep =\n event.kind.startsWith('step_') && typeof event.detail?.step === 'string'\n ? planSteps.find((s) => s.id === event.detail?.step)\n : undefined\n // A finished step's document (its latest version), one click from its chip in the transcript.\n const stepDocRef =\n event.kind === 'step_done' && Array.isArray(event.detail?.documents)\n ? (event.detail.documents as string[]).at(-1)\n : undefined\n const stepDocId = stepDocRef ? splitDocRef(stepDocRef).id : undefined\n const stepDocRecord = stepDocId ? docs.find((d) => d.external_id === stepDocId) : undefined\n const stepDocument = stepDocId\n ? {\n name: stepDocRecord ? getDocumentTitle(stepDocRecord) : stepDocId,\n onOpen: () => openDocument(stepDocId),\n }\n : undefined\n // An AI step's progress is ARBI's, whoever started the run.\n const assistant =\n event.kind === 'assistant_responded' ||\n event.kind === 'assistant_stopped' ||\n event.detail?.assistant === true ||\n eventStep?.kind === 'agent'\n const member = members.find(\n (m) =>\n m.user.external_id ===\n (event.actor_ext_id ?? (event.kind === 'created' ? task?.created_by_ext_id : undefined))\n )?.user\n const name = assistant ? assistantCopy.name : member ? getUserDisplayName(member) : 'System'\n const docId = typeof event.detail?.doc_ext_id === 'string' ? event.detail.doc_ext_id : undefined\n const sourceMessage =\n typeof event.detail?.message_ext_id === 'string' ? event.detail.message_ext_id : undefined\n const messageId =\n sourceMessage ??\n [...messageHistory]\n .reverse()\n .find((message) => Date.parse(message.created_at ?? '') <= Date.parse(event.created_at))\n ?.external_id ??\n messageHistory[0]?.external_id\n const doc = docId ? docs.find((d) => d.external_id === docId) : undefined\n // A draft email an agent left in the user's native mailbox: the entry opens it in Mail.\n const mailDraftId =\n event.kind === 'notified' &&\n event.detail?.event === 'mail_draft_ready' &&\n typeof event.detail?.mail_id === 'string'\n ? event.detail.mail_id\n : undefined\n // Say who a batch reached, and name any @mentioned person it did not, so nobody has to guess.\n const missed =\n event.kind === 'notified' && recipients.length\n ? unnotifiedMentions(\n messageHistory.find((message) => message.external_id === sourceMessage)?.mentions,\n recipients,\n event.actor_ext_id\n )\n : []\n // A thread call: the server's log card (live → Join, ended → summary + meeting chat).\n const callDetail = event.kind === 'call' ? parseCallLogDetail(event.detail) : null\n // A recording of the thread's call stopped: its Recording card (in a meeting thread).\n const recordingCall =\n event.kind === 'recording' && typeof event.detail?.call_ext_id === 'string'\n ? event.detail.call_ext_id\n : null\n const recordingId =\n typeof event.detail?.recording_ext_id === 'string' ? event.detail.recording_ext_id : null\n return {\n id: event.external_id,\n kind: event.kind,\n // A workflow step event: the step it is about (the thread's step strip places entries by it).\n step: typeof event.detail?.step === 'string' ? event.detail.step : undefined,\n createdAt: event.created_at,\n card: callDetail ? (\n <ThreadCallLogCard\n detail={callDetail}\n name={personName}\n workspaceExtId={workspaceExtId}\n time={formatRelativeTime(event.created_at, { style: 'short' })}\n />\n ) : recordingCall ? (\n <RecordingCard\n callExtId={recordingCall}\n recordingExtId={recordingId}\n title={task?.title}\n time={formatRelativeTime(event.created_at, { style: 'short' })}\n />\n ) : undefined,\n docId,\n docTitle: doc ? getDocumentTitle(doc) : undefined,\n label: mailDraftId\n ? 'Left a draft email'\n : event.kind === 'notified' && recipients.length\n ? notifiedLabel(recipients.map(personName), missed.map(personName))\n : label,\n description: [\n name,\n label,\n ...recipients.map((id) => {\n const person = members.find((m) => m.user.external_id === id)?.user\n return person ? getUserDisplayName(person) : id\n }),\n doc ? getDocumentTitle(doc) : null,\n ]\n .filter(Boolean)\n .join(' · '),\n actor: assistant ? 'assistant' : (member?.external_id ?? 'system'),\n stepChip: eventStep ? stepChipOf(eventStep, event.kind, stepDocument) : undefined,\n // No avatar tooltip: the entry is already a button (or titled row) that carries the same\n // details, and a tooltip trigger inside it would be a nested <button>.\n avatar: assistant ? (\n <AssistantEntity variant=\"icon\" size={20} showTooltip={false} />\n ) : member ? (\n <DocumentUser user={member} tooltip={false} />\n ) : (\n <Clock className=\"size-4 text-muted-foreground\" />\n ),\n time: formatRelativeTime(event.created_at, { style: 'short' }),\n exactTime: formatFriendlyDate(event.created_at),\n onOpenDocument: docId && doc ? () => openDocument(docId) : undefined,\n onSelect: () => {\n if (mailDraftId && openMail) {\n openMail({ draftId: mailDraftId })\n return\n }\n const target = messageActivity ? messageId : event.external_id\n // The deep link selects the thread the message is on (useConversationData).\n if (target) navigateToConversation(conversationId!, target)\n },\n }\n })\n const related = workflows\n .filter((workflow) => workflow.after_conversation_ext_id === conversationId)\n .map((workflow) => {\n const next = conversations.find(\n (conversation) => conversation.workflow_ext_id === workflow.external_id\n )\n return {\n id: workflow.external_id,\n label: next?.title || workflow.name,\n title: 'Starts when this thread is done',\n onSelect: () => {\n if (next) navigateToConversation(next.external_id)\n else openWorkflow?.(workflow.external_id)\n },\n }\n })\n // The run's workflow, opened in the builder: the same steps, as designed. Only where Workflows\n // is on (otherwise there is no page to open it on).\n const origin = openWorkflow\n ? workflows.find((workflow) => workflow.external_id === task?.workflow_ext_id)\n : undefined\n if (origin && openWorkflow)\n related.unshift({\n id: `origin-${origin.external_id}`,\n label: origin.name,\n title: 'Open the workflow in the builder',\n onSelect: () => openWorkflow(origin.external_id),\n })\n const source = workflows.find(\n (workflow) => workflow.external_id === task?.workflow_ext_id\n )?.after_conversation_ext_id\n if (source) {\n const before = conversations.find((conversation) => conversation.external_id === source)\n if (before)\n related.unshift({\n id: source,\n label: before.title || 'Previous thread',\n title: 'Started when this thread was done',\n onSelect: () => navigateToConversation(source),\n })\n }\n // Linked runs: the signals this thread's steps raised and the threads they started, and, for a\n // thread a signal started, the step and thread it came from.\n const links = linkedRunsFromActivity(activity.data as TaskActivityEvent[] | undefined)\n const threadName = (id: string, workflowId?: string) =>\n conversations.find((c) => c.external_id === id)?.title ||\n workflows.find((w) => w.external_id === workflowId)?.name ||\n 'Linked thread'\n const signals: WorkflowThreadSignal[] = links.raised.map((raised) => ({\n step: raised.step,\n signal: raised.signal,\n runs: raised.runs.map((run) => ({\n id: run.conversationId,\n label: threadName(run.conversationId, run.workflowId),\n onSelect: () => navigateToConversation(run.conversationId),\n })),\n }))\n let startedBy: WorkflowThreadOrigin | undefined\n if (links.startedBy) {\n const { conversationId: parentId, step, signal } = links.startedBy\n const parent = conversations.find((c) => c.external_id === parentId)\n const parentSteps = fromPlanSteps((parent?.plan?.steps ?? []) as TaskPlanStep[])\n startedBy = {\n stepTitle: parentSteps.find((s) => s.id === step)?.title ?? step ?? 'a step',\n threadTitle: parent?.title || 'another thread',\n signal,\n onSelect: () => navigateToConversation(parentId),\n }\n }\n return { activity, items, related, signals, startedBy }\n}\n","import { useCallback } from 'react'\nimport { useSwitchWorkspace } from '@arbidocs/react'\nimport { useOptionalConnection } from './ConnectionProvider'\n\n/**\n * Select a workspace in place, through the sign-in layer when there is one (else the host's own\n * session switch): the page on screen stays, unlike `openWorkspace`, which also shows the\n * workspace. Rejects when it could not be opened.\n */\nexport function useSelectWorkspace(): (id: string) => Promise<void> {\n const connection = useOptionalConnection()\n const { switchWorkspace } = useSwitchWorkspace()\n return useCallback(\n async (id: string) => {\n if (connection) return connection.setWorkspace(id)\n if (!(await switchWorkspace({ id }))) throw new Error('Could not open the workspace')\n },\n [connection, switchWorkspace]\n )\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/connection/tasks/useConnectedThreadActivity.tsx","../src/connection/useSelectWorkspace.ts"],"names":["stepKindOf","STEP_KIND_ICONS","jsx","useWorkflows","useConversationItems","useWorkspaceUsers","useDocuments","useConversationActivity","useConversationData","useBlocksEnvironment","useOpenWorkflow","useAssistantCopy","useArbiSessionState","latestMessageTime","isSupersededStop","getUserDisplayName","fromPlanSteps","compactThreadActivity","splitDocRef","getDocumentTitle","unnotifiedMentions","parseCallLogDetail","ThreadCallLogCard","formatRelativeTime","RecordingCard","notifiedLabel","AssistantEntity","Docum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ClE,EAAA,MAAM,aAAae,uCAAA,EAAsB;AACzC,EAAA,MAAM,EAAE,eAAA,EAAgB,GAAIC,wBAAA,EAAmB;AAC/C,EAAA,OAAOC,mBAAA;AAAA,IACL,OAAO,EAAA,KAAe;AACpB,MAAA,IAAI,UAAA,EAAY,OAAO,UAAA,CAAW,YAAA,CAAa,EAAE,CAAA;AACjD,MAAA,IAAI,CAAE,MAAM,eAAA,CAAgB,EAAE,EAAA,EAAI,CAAA,EAAI,MAAM,IAAI,KAAA,CAAM,8BAA8B,CAAA;AAAA,IACtF,CAAA;AAAA,IACA,CAAC,YAAY,eAAe;AAAA,GAC9B;AACF","file":"chunk-Y24V6HPR.cjs","sourcesContent":["import {\n formatFriendlyDate,\n getDocumentTitle,\n getUserDisplayName,\n formatRelativeTime,\n} from '@arbidocs/react/ui'\nimport { Clock } from 'lucide-react'\nimport {\n useConversationActivity,\n useWorkflows,\n useDocuments,\n useWorkspaceUsers,\n useArbiSessionState,\n useConversationData,\n useConversationItems,\n} from '@arbidocs/react'\nimport { useAssistantCopy } from '@arbidocs/react/shell'\nimport { STEP_KIND_ICONS, stepKindOf } from '../../agents/workflows/stepKinds'\nimport { compactThreadActivity } from '../../agents/tasks/compact-thread-activity'\nimport { fromPlanSteps, type TaskPlanStep } from '../../agents/workflows/planSteps'\nimport { splitDocRef, type WorkflowStepPhase } from '../../agents/workflows/run'\nimport { type WorkflowStep } from '../../agents/workflows/types'\nimport { linkedRunsFromActivity } from '../../agents/tasks/linkedRuns'\nimport { type TaskActivityEvent } from '../../agents/tasks/TaskActivityTimeline'\nimport {\n type WorkflowThreadOrigin,\n type WorkflowThreadSignal,\n} from '../../agents/tasks/WorkflowThreadStrip'\nimport { ThreadCallLogCard } from '../../calls/connected/ThreadCallLogCard'\nimport { RecordingCard } from '../../calls/connected/RecordingCard'\nimport { parseCallLogDetail } from '../../calls/call-cards'\nimport { AssistantEntity } from '../../agents/tasks/AssistantEntity'\nimport {\n isSupersededStop,\n latestMessageTime,\n notifiedLabel,\n unnotifiedMentions,\n} from '../../agents/tasks/taskHelpers'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useOpenWorkflow } from '../workflows/useOpenWorkflow'\nimport { DocumentUser } from '../files/fields/DocumentUser'\n\n/** The phase a step event puts its step in, for its chip in the transcript. */\nconst STEP_EVENT_PHASES: Record<string, WorkflowStepPhase> = {\n // A past \"started\" is not still running: the step's own chip (on the bar) says where it is now.\n step_started: 'ready',\n step_waiting: 'waiting',\n step_progress: 'waiting',\n step_done: 'done',\n step_skipped: 'skipped',\n step_failed: 'failed',\n step_sent_back: 'ready',\n}\n\n/** A step event's chip in the transcript: its step's kind and icon, the phase the event set. */\nfunction stepChipOf(\n step: WorkflowStep,\n eventKind: string,\n document?: { name: string; onOpen: () => void }\n) {\n const phase = STEP_EVENT_PHASES[eventKind]\n if (!phase) return undefined\n const kind = stepKindOf(step)\n const KindIcon = STEP_KIND_ICONS[kind]\n return { kind, phase, icon: <KindIcon />, document }\n}\n\n/**\n * A thread's persisted history, as its top bar's ribbon and its transcript show it: each entry with\n * its actor, its step chip, the document or email it is about and where a click goes; the threads\n * linked to it (what started it, what it starts); the signals its steps raised. Documents,\n * threads, email drafts and workflows open through the host's environment.\n */\nexport function useConnectedThreadActivity(conversationId: string | null | undefined) {\n const { data: workflows = [] } = useWorkflows()\n const { conversations } = useConversationItems()\n const { data: members = [] } = useWorkspaceUsers()\n const { data: docs = [] } = useDocuments()\n const activity = useConversationActivity(conversationId ?? undefined, { live: true })\n const { messageHistory } = useConversationData()\n const environment = useBlocksEnvironment()\n const { openDocument, openMail } = environment\n const navigateToConversation = (id: string, messageId?: string) =>\n environment.openConversation(id, messageId ? { messageId } : undefined)\n // The host's Workflows page, while it has one (absent: a workflow has nowhere to open).\n const openWorkflow = useOpenWorkflow()\n const assistantCopy = useAssistantCopy()\n const workspaceExtId = useArbiSessionState((s) => s.workspaceId)\n const task = conversations.find((c) => c.external_id === conversationId)\n const latestMessageAt = latestMessageTime(messageHistory)\n const events = ((activity.data ?? []) as TaskActivityEvent[]).filter(\n (event) => !isSupersededStop(event, latestMessageAt)\n )\n const personName = (extId: string) => {\n const person = members.find((m) => m.user.external_id === extId)?.user\n return person ? getUserDisplayName(person) : 'someone'\n }\n // The run's steps, from its plan: step events are named after their step and drawn as its chip.\n const planSteps = fromPlanSteps((task?.plan?.steps ?? []) as TaskPlanStep[])\n const entries = compactThreadActivity(events, (id) => planSteps.find((s) => s.id === id)?.title)\n const items = entries.map(({ event, label, recipients }) => {\n const messageActivity = [\n 'created',\n 'participant_joined',\n 'assistant_responded',\n 'assistant_stopped',\n ].includes(event.kind)\n // A stop is about the assistant's turn (the event names no actor), so it is shown as ARBI's.\n const eventStep =\n event.kind.startsWith('step_') && typeof event.detail?.step === 'string'\n ? planSteps.find((s) => s.id === event.detail?.step)\n : undefined\n // A finished step's document (its latest version), one click from its chip in the transcript.\n const stepDocRef =\n event.kind === 'step_done' && Array.isArray(event.detail?.documents)\n ? (event.detail.documents as string[]).at(-1)\n : undefined\n const stepDocId = stepDocRef ? splitDocRef(stepDocRef).id : undefined\n const stepDocRecord = stepDocId ? docs.find((d) => d.external_id === stepDocId) : undefined\n const stepDocument = stepDocId\n ? {\n name: stepDocRecord ? getDocumentTitle(stepDocRecord) : stepDocId,\n onOpen: () => openDocument(stepDocId),\n }\n : undefined\n // An AI step's progress is ARBI's, whoever started the run.\n const assistant =\n event.kind === 'assistant_responded' ||\n event.kind === 'assistant_stopped' ||\n event.detail?.assistant === true ||\n eventStep?.kind === 'agent'\n const member = members.find(\n (m) =>\n m.user.external_id ===\n (event.actor_ext_id ?? (event.kind === 'created' ? task?.created_by_ext_id : undefined))\n )?.user\n const name = assistant ? assistantCopy.name : member ? getUserDisplayName(member) : 'System'\n const docId = typeof event.detail?.doc_ext_id === 'string' ? event.detail.doc_ext_id : undefined\n const sourceMessage =\n typeof event.detail?.message_ext_id === 'string' ? event.detail.message_ext_id : undefined\n const messageId =\n sourceMessage ??\n [...messageHistory]\n .reverse()\n .find((message) => Date.parse(message.created_at ?? '') <= Date.parse(event.created_at))\n ?.external_id ??\n messageHistory[0]?.external_id\n const doc = docId ? docs.find((d) => d.external_id === docId) : undefined\n // A draft email an agent left in the user's native mailbox: the entry opens it in Mail.\n const mailDraftId =\n event.kind === 'notified' &&\n event.detail?.event === 'mail_draft_ready' &&\n typeof event.detail?.mail_id === 'string'\n ? event.detail.mail_id\n : undefined\n // Say who a batch reached, and name any @mentioned person it did not, so nobody has to guess.\n const missed =\n event.kind === 'notified' && recipients.length\n ? unnotifiedMentions(\n messageHistory.find((message) => message.external_id === sourceMessage)?.mentions,\n recipients,\n event.actor_ext_id\n )\n : []\n // A thread call: the server's log card (live → Join, ended → summary + meeting chat).\n const callDetail = event.kind === 'call' ? parseCallLogDetail(event.detail) : null\n // A recording of the thread's call stopped: its Recording card (in a meeting thread).\n const recordingCall =\n event.kind === 'recording' && typeof event.detail?.call_ext_id === 'string'\n ? event.detail.call_ext_id\n : null\n const recordingId =\n typeof event.detail?.recording_ext_id === 'string' ? event.detail.recording_ext_id : null\n return {\n id: event.external_id,\n kind: event.kind,\n // A workflow step event: the step it is about (the thread's step strip places entries by it).\n step: typeof event.detail?.step === 'string' ? event.detail.step : undefined,\n createdAt: event.created_at,\n card: callDetail ? (\n <ThreadCallLogCard\n detail={callDetail}\n name={personName}\n workspaceExtId={workspaceExtId}\n time={formatRelativeTime(event.created_at, { style: 'short' })}\n />\n ) : recordingCall ? (\n <RecordingCard\n callExtId={recordingCall}\n recordingExtId={recordingId}\n title={task?.title}\n time={formatRelativeTime(event.created_at, { style: 'short' })}\n />\n ) : undefined,\n docId,\n docTitle: doc ? getDocumentTitle(doc) : undefined,\n label: mailDraftId\n ? 'Left a draft email'\n : event.kind === 'notified' && recipients.length\n ? notifiedLabel(recipients.map(personName), missed.map(personName))\n : label,\n description: [\n name,\n label,\n ...recipients.map((id) => {\n const person = members.find((m) => m.user.external_id === id)?.user\n return person ? getUserDisplayName(person) : id\n }),\n doc ? getDocumentTitle(doc) : null,\n ]\n .filter(Boolean)\n .join(' · '),\n actor: assistant ? 'assistant' : (member?.external_id ?? 'system'),\n stepChip: eventStep ? stepChipOf(eventStep, event.kind, stepDocument) : undefined,\n // No avatar tooltip: the entry is already a button (or titled row) that carries the same\n // details, and a tooltip trigger inside it would be a nested <button>.\n avatar: assistant ? (\n <AssistantEntity variant=\"icon\" size={20} showTooltip={false} />\n ) : member ? (\n <DocumentUser user={member} tooltip={false} />\n ) : (\n <Clock className=\"size-4 text-muted-foreground\" />\n ),\n time: formatRelativeTime(event.created_at, { style: 'short' }),\n exactTime: formatFriendlyDate(event.created_at),\n onOpenDocument: docId && doc ? () => openDocument(docId) : undefined,\n onSelect: () => {\n if (mailDraftId && openMail) {\n openMail({ draftId: mailDraftId })\n return\n }\n const target = messageActivity ? messageId : event.external_id\n // The deep link selects the thread the message is on (useConversationData).\n if (target) navigateToConversation(conversationId!, target)\n },\n }\n })\n const related = workflows\n .filter((workflow) => workflow.after_conversation_ext_id === conversationId)\n .map((workflow) => {\n const next = conversations.find(\n (conversation) => conversation.workflow_ext_id === workflow.external_id\n )\n return {\n id: workflow.external_id,\n label: next?.title || workflow.name,\n title: 'Starts when this thread is done',\n onSelect: () => {\n if (next) navigateToConversation(next.external_id)\n else openWorkflow?.(workflow.external_id)\n },\n }\n })\n // The run's workflow, opened in the builder: the same steps, as designed. Only where Workflows\n // is on (otherwise there is no page to open it on).\n const origin = openWorkflow\n ? workflows.find((workflow) => workflow.external_id === task?.workflow_ext_id)\n : undefined\n if (origin && openWorkflow)\n related.unshift({\n id: `origin-${origin.external_id}`,\n label: origin.name,\n title: 'Open the workflow in the builder',\n onSelect: () => openWorkflow(origin.external_id),\n })\n const source = workflows.find(\n (workflow) => workflow.external_id === task?.workflow_ext_id\n )?.after_conversation_ext_id\n if (source) {\n const before = conversations.find((conversation) => conversation.external_id === source)\n if (before)\n related.unshift({\n id: source,\n label: before.title || 'Previous thread',\n title: 'Started when this thread was done',\n onSelect: () => navigateToConversation(source),\n })\n }\n // Linked runs: the signals this thread's steps raised and the threads they started, and, for a\n // thread a signal started, the step and thread it came from.\n const links = linkedRunsFromActivity(activity.data as TaskActivityEvent[] | undefined)\n const threadName = (id: string, workflowId?: string) =>\n conversations.find((c) => c.external_id === id)?.title ||\n workflows.find((w) => w.external_id === workflowId)?.name ||\n 'Linked thread'\n const signals: WorkflowThreadSignal[] = links.raised.map((raised) => ({\n step: raised.step,\n signal: raised.signal,\n runs: raised.runs.map((run) => ({\n id: run.conversationId,\n label: threadName(run.conversationId, run.workflowId),\n onSelect: () => navigateToConversation(run.conversationId),\n })),\n }))\n let startedBy: WorkflowThreadOrigin | undefined\n if (links.startedBy) {\n const { conversationId: parentId, step, signal } = links.startedBy\n const parent = conversations.find((c) => c.external_id === parentId)\n const parentSteps = fromPlanSteps((parent?.plan?.steps ?? []) as TaskPlanStep[])\n startedBy = {\n stepTitle: parentSteps.find((s) => s.id === step)?.title ?? step ?? 'a step',\n threadTitle: parent?.title || 'another thread',\n signal,\n onSelect: () => navigateToConversation(parentId),\n }\n }\n return { activity, items, related, signals, startedBy }\n}\n","import { useCallback } from 'react'\nimport { useSwitchWorkspace } from '@arbidocs/react'\nimport { useOptionalConnection } from './ConnectionProvider'\n\n/**\n * Select a workspace in place, through the sign-in layer when there is one (else the host's own\n * session switch): the page on screen stays, unlike `openWorkspace`, which also shows the\n * workspace. Rejects when it could not be opened.\n */\nexport function useSelectWorkspace(): (id: string) => Promise<void> {\n const connection = useOptionalConnection()\n const { switchWorkspace } = useSwitchWorkspace()\n return useCallback(\n async (id: string) => {\n if (connection) return connection.setWorkspace(id)\n if (!(await switchWorkspace({ id }))) throw new Error('Could not open the workspace')\n },\n [connection, switchWorkspace]\n )\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkNNUK5ZM7_cjs = require('./chunk-NNUK5ZM7.cjs');
|
|
5
5
|
var zustand = require('zustand');
|
|
6
6
|
var middleware = require('zustand/middleware');
|
|
7
7
|
|
|
@@ -50,7 +50,7 @@ var useFilesPrefs = zustand.create()(
|
|
|
50
50
|
(state) => state.viewModes[prefsKey] === viewMode ? state : { viewModes: { ...state.viewModes, [prefsKey]: viewMode } }
|
|
51
51
|
),
|
|
52
52
|
// New users start at the compact minimum (more rows at once).
|
|
53
|
-
rowHeight:
|
|
53
|
+
rowHeight: chunkNNUK5ZM7_cjs.DOCUMENTS_ROW_HEIGHT_INITIAL,
|
|
54
54
|
setRowHeight: (rowHeight) => set({ rowHeight })
|
|
55
55
|
}),
|
|
56
56
|
{
|
|
@@ -121,5 +121,5 @@ exports.useFilesGridStates = useFilesGridStates;
|
|
|
121
121
|
exports.useFilesPrefs = useFilesPrefs;
|
|
122
122
|
exports.useFilesStore = useFilesStore;
|
|
123
123
|
exports.usePendingFolders = usePendingFolders;
|
|
124
|
-
//# sourceMappingURL=chunk-
|
|
125
|
-
//# sourceMappingURL=chunk-
|
|
124
|
+
//# sourceMappingURL=chunk-YGXOKB5Z.cjs.map
|
|
125
|
+
//# sourceMappingURL=chunk-YGXOKB5Z.cjs.map
|