@arbidocs/blocks 0.5.62 → 0.5.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/README.md +7 -0
  2. package/dist/{ConnectedCallDock-CRECGH7K.js → ConnectedCallDock-DEAEFUUD.js} +5 -5
  3. package/dist/{ConnectedCallDock-CRECGH7K.js.map → ConnectedCallDock-DEAEFUUD.js.map} +1 -1
  4. package/dist/{ConnectedCallDock-RGDNX76B.cjs → ConnectedCallDock-GJAGY75U.cjs} +14 -14
  5. package/dist/{ConnectedCallDock-RGDNX76B.cjs.map → ConnectedCallDock-GJAGY75U.cjs.map} +1 -1
  6. package/dist/{ConnectedCallRoom-Z2M6QRJJ.js → ConnectedCallRoom-DI7UYRHE.js} +5 -5
  7. package/dist/{ConnectedCallRoom-Z2M6QRJJ.js.map → ConnectedCallRoom-DI7UYRHE.js.map} +1 -1
  8. package/dist/{ConnectedCallRoom-LM7UNH34.cjs → ConnectedCallRoom-KLE2PCMQ.cjs} +6 -6
  9. package/dist/{ConnectedCallRoom-LM7UNH34.cjs.map → ConnectedCallRoom-KLE2PCMQ.cjs.map} +1 -1
  10. package/dist/{ConnectedDocumentViewer-ELA7R4RJ.js → ConnectedDocumentViewer-7VKAM6KD.js} +8 -8
  11. package/dist/{ConnectedDocumentViewer-ELA7R4RJ.js.map → ConnectedDocumentViewer-7VKAM6KD.js.map} +1 -1
  12. package/dist/{ConnectedDocumentViewer-6SFJWKXN.cjs → ConnectedDocumentViewer-FGQ27H4B.cjs} +9 -9
  13. package/dist/{ConnectedDocumentViewer-6SFJWKXN.cjs.map → ConnectedDocumentViewer-FGQ27H4B.cjs.map} +1 -1
  14. package/dist/{ConnectedNativeDocxComparison-3MCCETF5.js → ConnectedNativeDocxComparison-FPW3BNBN.js} +8 -8
  15. package/dist/ConnectedNativeDocxComparison-FPW3BNBN.js.map +1 -0
  16. package/dist/{ConnectedNativeDocxComparison-XZIRCESL.cjs → ConnectedNativeDocxComparison-HJ4FTVH6.cjs} +9 -9
  17. package/dist/ConnectedNativeDocxComparison-HJ4FTVH6.cjs.map +1 -0
  18. package/dist/{ConnectedNativeDocxEditor-YE6KA53Q.cjs → ConnectedNativeDocxEditor-PF46MU5H.cjs} +9 -9
  19. package/dist/ConnectedNativeDocxEditor-PF46MU5H.cjs.map +1 -0
  20. package/dist/{ConnectedNativeDocxEditor-FGW35PIL.js → ConnectedNativeDocxEditor-S7NJMDSU.js} +7 -7
  21. package/dist/ConnectedNativeDocxEditor-S7NJMDSU.js.map +1 -0
  22. package/dist/{ConnectedStreamedWordArtifact-N6YRKWDH.js → ConnectedStreamedWordArtifact-5MHLV24V.js} +8 -8
  23. package/dist/ConnectedStreamedWordArtifact-5MHLV24V.js.map +1 -0
  24. package/dist/{ConnectedStreamedWordArtifact-ROPYU3LE.cjs → ConnectedStreamedWordArtifact-LNGW7YGV.cjs} +9 -9
  25. package/dist/ConnectedStreamedWordArtifact-LNGW7YGV.cjs.map +1 -0
  26. package/dist/{DocumentReviewCard-SYBCU7NL.js → DocumentReviewCard-5U3TGJZA.js} +7 -7
  27. package/dist/{DocumentReviewCard-SYBCU7NL.js.map → DocumentReviewCard-5U3TGJZA.js.map} +1 -1
  28. package/dist/{DocumentReviewCard-YOZMWE33.cjs → DocumentReviewCard-VFNMJSK7.cjs} +7 -7
  29. package/dist/{DocumentReviewCard-YOZMWE33.cjs.map → DocumentReviewCard-VFNMJSK7.cjs.map} +1 -1
  30. package/dist/{WorkspaceTableView-4DGONK5A.cjs → WorkspaceTableView-DHMCJRC6.cjs} +7 -7
  31. package/dist/{WorkspaceTableView-4DGONK5A.cjs.map → WorkspaceTableView-DHMCJRC6.cjs.map} +1 -1
  32. package/dist/{WorkspaceTableView-ZCUYOMSL.js → WorkspaceTableView-EH5CEB44.js} +5 -5
  33. package/dist/{WorkspaceTableView-ZCUYOMSL.js.map → WorkspaceTableView-EH5CEB44.js.map} +1 -1
  34. package/dist/agents/index.cjs +283 -283
  35. package/dist/agents/index.js +5 -5
  36. package/dist/agents/tasks/WorkflowsTable.d.ts +2 -1
  37. package/dist/calls/index.cjs +132 -132
  38. package/dist/calls/index.js +8 -8
  39. package/dist/{chunk-57FBBWU2.cjs → chunk-23ACBETH.cjs} +4 -4
  40. package/dist/{chunk-57FBBWU2.cjs.map → chunk-23ACBETH.cjs.map} +1 -1
  41. package/dist/{chunk-D34YIJGE.js → chunk-2SLDVFOZ.js} +4 -4
  42. package/dist/{chunk-D34YIJGE.js.map → chunk-2SLDVFOZ.js.map} +1 -1
  43. package/dist/{chunk-6SWK5QCT.cjs → chunk-33PWCTND.cjs} +21 -21
  44. package/dist/{chunk-6SWK5QCT.cjs.map → chunk-33PWCTND.cjs.map} +1 -1
  45. package/dist/{chunk-LZROSRGK.cjs → chunk-3X37I6QE.cjs} +10 -10
  46. package/dist/{chunk-LZROSRGK.cjs.map → chunk-3X37I6QE.cjs.map} +1 -1
  47. package/dist/{chunk-3VCVMW5X.cjs → chunk-4RJPTXUQ.cjs} +5 -5
  48. package/dist/{chunk-3VCVMW5X.cjs.map → chunk-4RJPTXUQ.cjs.map} +1 -1
  49. package/dist/{chunk-GWTKLPBJ.js → chunk-5CWBAINB.js} +3 -3
  50. package/dist/{chunk-GWTKLPBJ.js.map → chunk-5CWBAINB.js.map} +1 -1
  51. package/dist/{chunk-X5GO56JN.js → chunk-64DMXUYS.js} +3 -3
  52. package/dist/{chunk-X5GO56JN.js.map → chunk-64DMXUYS.js.map} +1 -1
  53. package/dist/{chunk-PBIFISDD.js → chunk-7P24MJQN.js} +3 -3
  54. package/dist/{chunk-PBIFISDD.js.map → chunk-7P24MJQN.js.map} +1 -1
  55. package/dist/{chunk-CLOYC6QG.cjs → chunk-7YHGLYRJ.cjs} +67 -67
  56. package/dist/{chunk-CLOYC6QG.cjs.map → chunk-7YHGLYRJ.cjs.map} +1 -1
  57. package/dist/{chunk-2CH22I7M.js → chunk-AMP7KX7F.js} +3 -3
  58. package/dist/{chunk-2CH22I7M.js.map → chunk-AMP7KX7F.js.map} +1 -1
  59. package/dist/{chunk-UQAHDGYH.cjs → chunk-CCSF7RI4.cjs} +5 -5
  60. package/dist/{chunk-UQAHDGYH.cjs.map → chunk-CCSF7RI4.cjs.map} +1 -1
  61. package/dist/{chunk-QK546T4C.cjs → chunk-CKNUL4LM.cjs} +3 -3
  62. package/dist/{chunk-QK546T4C.cjs.map → chunk-CKNUL4LM.cjs.map} +1 -1
  63. package/dist/{chunk-6USEJFPC.cjs → chunk-COZDIUG7.cjs} +24 -24
  64. package/dist/chunk-COZDIUG7.cjs.map +1 -0
  65. package/dist/{chunk-SLX2YIUA.cjs → chunk-EOIJ5JYP.cjs} +4 -4
  66. package/dist/{chunk-SLX2YIUA.cjs.map → chunk-EOIJ5JYP.cjs.map} +1 -1
  67. package/dist/{chunk-LMKEDVEB.cjs → chunk-F73EZQT4.cjs} +4 -4
  68. package/dist/{chunk-LMKEDVEB.cjs.map → chunk-F73EZQT4.cjs.map} +1 -1
  69. package/dist/{chunk-J55WDXIR.js → chunk-G4OZQFES.js} +3 -3
  70. package/dist/{chunk-J55WDXIR.js.map → chunk-G4OZQFES.js.map} +1 -1
  71. package/dist/{chunk-JHLIVEJI.js → chunk-GRDLCRNL.js} +5 -5
  72. package/dist/{chunk-JHLIVEJI.js.map → chunk-GRDLCRNL.js.map} +1 -1
  73. package/dist/{chunk-XPB6KMPY.cjs → chunk-HVOPUYAG.cjs} +19 -19
  74. package/dist/{chunk-XPB6KMPY.cjs.map → chunk-HVOPUYAG.cjs.map} +1 -1
  75. package/dist/{chunk-TL7SHXBN.js → chunk-IC6SBDYA.js} +3 -3
  76. package/dist/{chunk-TL7SHXBN.js.map → chunk-IC6SBDYA.js.map} +1 -1
  77. package/dist/{chunk-QTZ25F5G.js → chunk-IFLFLP4K.js} +5 -5
  78. package/dist/{chunk-QTZ25F5G.js.map → chunk-IFLFLP4K.js.map} +1 -1
  79. package/dist/{chunk-C3SLFANS.js → chunk-ITS3USZ3.js} +5 -5
  80. package/dist/{chunk-C3SLFANS.js.map → chunk-ITS3USZ3.js.map} +1 -1
  81. package/dist/{chunk-SEH4ZDN5.js → chunk-IUFS3AYQ.js} +7 -7
  82. package/dist/{chunk-SEH4ZDN5.js.map → chunk-IUFS3AYQ.js.map} +1 -1
  83. package/dist/{chunk-3IRJ4MTF.cjs → chunk-J25NN3XJ.cjs} +14 -14
  84. package/dist/{chunk-3IRJ4MTF.cjs.map → chunk-J25NN3XJ.cjs.map} +1 -1
  85. package/dist/{chunk-TX4CIWH5.cjs → chunk-JBL4PPEE.cjs} +6 -6
  86. package/dist/{chunk-TX4CIWH5.cjs.map → chunk-JBL4PPEE.cjs.map} +1 -1
  87. package/dist/{chunk-QUSDMOSF.js → chunk-JWRTUYLC.js} +3 -3
  88. package/dist/{chunk-QUSDMOSF.js.map → chunk-JWRTUYLC.js.map} +1 -1
  89. package/dist/{chunk-XGJU2Y5N.cjs → chunk-LBKTTQUR.cjs} +7 -7
  90. package/dist/{chunk-XGJU2Y5N.cjs.map → chunk-LBKTTQUR.cjs.map} +1 -1
  91. package/dist/{chunk-SMM32PL6.cjs → chunk-M42XWNS6.cjs} +4 -4
  92. package/dist/{chunk-SMM32PL6.cjs.map → chunk-M42XWNS6.cjs.map} +1 -1
  93. package/dist/{chunk-F3VIBHH2.cjs → chunk-MAKTAR7H.cjs} +18 -18
  94. package/dist/{chunk-F3VIBHH2.cjs.map → chunk-MAKTAR7H.cjs.map} +1 -1
  95. package/dist/{chunk-2TOM5FT5.js → chunk-NDVLCOWS.js} +12 -12
  96. package/dist/chunk-NDVLCOWS.js.map +1 -0
  97. package/dist/{chunk-UJI52BUA.js → chunk-OI4DL2DX.js} +3 -3
  98. package/dist/{chunk-UJI52BUA.js.map → chunk-OI4DL2DX.js.map} +1 -1
  99. package/dist/{chunk-7BH55CGS.js → chunk-OZL5ABLF.js} +4 -4
  100. package/dist/{chunk-7BH55CGS.js.map → chunk-OZL5ABLF.js.map} +1 -1
  101. package/dist/{chunk-7S3CTSF7.js → chunk-PKDPQS6Z.js} +3 -3
  102. package/dist/{chunk-7S3CTSF7.js.map → chunk-PKDPQS6Z.js.map} +1 -1
  103. package/dist/{chunk-LIOT6WLN.js → chunk-PVPGD6QR.js} +3 -3
  104. package/dist/{chunk-LIOT6WLN.js.map → chunk-PVPGD6QR.js.map} +1 -1
  105. package/dist/{chunk-HISU5HLW.js → chunk-QUZPQWPX.js} +3 -3
  106. package/dist/{chunk-HISU5HLW.js.map → chunk-QUZPQWPX.js.map} +1 -1
  107. package/dist/{chunk-RCBGX4IC.cjs → chunk-RGPKW6KQ.cjs} +4 -4
  108. package/dist/{chunk-RCBGX4IC.cjs.map → chunk-RGPKW6KQ.cjs.map} +1 -1
  109. package/dist/{chunk-VFBQBWZI.js → chunk-TAI23FCY.js} +46 -43
  110. package/dist/chunk-TAI23FCY.js.map +1 -0
  111. package/dist/{chunk-ONML6J5O.cjs → chunk-UDMII47W.cjs} +8 -8
  112. package/dist/{chunk-ONML6J5O.cjs.map → chunk-UDMII47W.cjs.map} +1 -1
  113. package/dist/{chunk-ABEKUV6L.js → chunk-VDXKB4WK.js} +82 -77
  114. package/dist/chunk-VDXKB4WK.js.map +1 -0
  115. package/dist/{chunk-MEMWZ72Y.cjs → chunk-WVEFRQSW.cjs} +81 -76
  116. package/dist/chunk-WVEFRQSW.cjs.map +1 -0
  117. package/dist/{chunk-PJW2IOPZ.cjs → chunk-X3JJTHQ4.cjs} +51 -51
  118. package/dist/{chunk-PJW2IOPZ.cjs.map → chunk-X3JJTHQ4.cjs.map} +1 -1
  119. package/dist/{chunk-4OJGFYB5.cjs → chunk-Y6ZNWC7E.cjs} +47 -44
  120. package/dist/chunk-Y6ZNWC7E.cjs.map +1 -0
  121. package/dist/{chunk-B63TSC3W.js → chunk-ZZTH27G7.js} +3 -3
  122. package/dist/{chunk-B63TSC3W.js.map → chunk-ZZTH27G7.js.map} +1 -1
  123. package/dist/connect/docx.cjs +13 -13
  124. package/dist/connect/docx.js +9 -9
  125. package/dist/connect/index.cjs +694 -694
  126. package/dist/connect/index.js +36 -36
  127. package/dist/connect/viewer.cjs +7 -7
  128. package/dist/connect/viewer.js +6 -6
  129. package/dist/connection/workflows/ConnectedWorkflowsPage.d.ts +7 -1
  130. package/dist/dashboards/index.cjs +1 -1
  131. package/dist/dashboards/index.js +1 -1
  132. package/dist/document-tools/index.cjs +17 -17
  133. package/dist/document-tools/index.js +2 -2
  134. package/dist/embed/index.cjs +13 -13
  135. package/dist/embed/index.js +10 -10
  136. package/dist/facts/index.cjs +40 -40
  137. package/dist/facts/index.js +4 -4
  138. package/dist/files/index.cjs +1 -1
  139. package/dist/files/index.js +1 -1
  140. package/dist/index.cjs +434 -434
  141. package/dist/index.js +13 -13
  142. package/dist/settings/index.cjs +156 -156
  143. package/dist/settings/index.js +2 -2
  144. package/dist/shell/TabHeader.d.ts +6 -1
  145. package/dist/shell/index.cjs +3 -3
  146. package/dist/shell/index.js +1 -1
  147. package/dist/site/index.cjs +22 -22
  148. package/dist/site/index.js +2 -2
  149. package/dist/studio/index.cjs +3 -3
  150. package/dist/studio/index.js +3 -3
  151. package/dist/workflow-canvas/index.cjs +64 -40
  152. package/dist/workflow-canvas/index.cjs.map +1 -1
  153. package/dist/workflow-canvas/index.js +49 -25
  154. package/dist/workflow-canvas/index.js.map +1 -1
  155. package/node_modules/@arbidocs/coedit/package.json +1 -1
  156. package/package.json +5 -5
  157. package/dist/ConnectedNativeDocxComparison-3MCCETF5.js.map +0 -1
  158. package/dist/ConnectedNativeDocxComparison-XZIRCESL.cjs.map +0 -1
  159. package/dist/ConnectedNativeDocxEditor-FGW35PIL.js.map +0 -1
  160. package/dist/ConnectedNativeDocxEditor-YE6KA53Q.cjs.map +0 -1
  161. package/dist/ConnectedStreamedWordArtifact-N6YRKWDH.js.map +0 -1
  162. package/dist/ConnectedStreamedWordArtifact-ROPYU3LE.cjs.map +0 -1
  163. package/dist/chunk-2TOM5FT5.js.map +0 -1
  164. package/dist/chunk-4OJGFYB5.cjs.map +0 -1
  165. package/dist/chunk-6USEJFPC.cjs.map +0 -1
  166. package/dist/chunk-ABEKUV6L.js.map +0 -1
  167. package/dist/chunk-MEMWZ72Y.cjs.map +0 -1
  168. package/dist/chunk-VFBQBWZI.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/connection/docx/support.ts","../src/connection/ConnectedWorkflowLauncher.tsx","../src/connection/docx/useConnectedDocxReferences.tsx","../src/connection/ConnectedWorkflowsTable.tsx","../src/connection/docx/useConnectedHouseTemplate.ts","../src/connection/docx/ConnectedNativeDocxEditor.tsx"],"names":["useHost","useListedDocuments","useConnectedTags","useMemo","buildWorkflowScopeSource","documentScopeLabels","useAgents","useBlocksEnvironment","useConnectedWorkspace","useUploadDocuments","useThumbnails","useRef","useState","useCallback","jsxs","Fragment","jsx","WorkflowDocumentsField","WorkflowLauncher","DocumentPicker","useArbi","buildDeepLinkUrl","parseDeepLinkPath","useWorkspaceUsers","fmtDate","useOpenWorkflow","workflowSteps","useWorkflows","useConnectedConversations","useUpdateWorkflow","useDeleteWorkflow","useRunWorkflow","isScheduledWorkflow","useEffect","WorkflowsTable","workflowSignal","workflowTriggerType","useSetWorkspaceHouseTemplate","useWorkspaces","supportsHouseTemplates","workspaceHouseTemplateId","useHouseTemplateCandidates","contentPath","builtinHouseTemplate","isCandidate","useRegisterOpenDocument","NativeDocxEditor","useQueryClient","useOptionalDocumentTools","loadDocxFonts","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,OA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AU,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-ONML6J5O.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 workflow launcher bound to the connection: the open workspace's folders, labels and files\n * behind its scope and `documents` fields (files can be added right there), and the user's agents\n * behind \"Run as\". The host still says what a launch does (`onLaunch`): open a chat, start a task.\n */\n\nimport { useCallback, useMemo, useRef, useState } from 'react'\nimport { useAgents, useThumbnails, useUploadDocuments } from '@arbidocs/react'\nimport { WorkflowLauncher, type WorkflowLauncherProps } from '../agents/workflows/WorkflowLauncher'\nimport {\n WorkflowDocumentsField,\n type WorkflowDocumentsFieldLabels,\n type WorkflowFieldDocument,\n} from '../agents/workflows/WorkflowDocumentsField'\nimport type { WorkflowScopeSource } from '../agents/workflows/WorkflowConfigDialog'\nimport { buildWorkflowScopeSource, documentScopeLabels } from '../agents/workflows/workspaceScope'\nimport type { AgentOption } from '../agents/workflows/AgentSelect'\nimport type { WorkflowField, WorkflowScope } from '../agents/workflows/types'\nimport { useBlocksEnvironment } from '../provider/environment'\nimport { useConnectedWorkspace } from './ConnectionProvider'\nimport { useConnectedTags, useListedDocuments, type ConnectedDocument } from './workspaceData'\n\nconst IMAGE_FILE_TYPES = new Set(['png', 'jpg', 'jpeg', 'gif', 'bmp', 'tiff', 'webp'])\n\n/** A workspace document as a `documents` field offers it. */\nexport function toWorkflowFieldDocument(doc: ConnectedDocument): WorkflowFieldDocument {\n // Pages and tokens are a text-parsing concept: never meaningful for an image.\n const isImage = IMAGE_FILE_TYPES.has((doc.file_type ?? '').toLowerCase())\n return {\n id: doc.external_id,\n title: doc.doc_metadata?.title || doc.file_name || doc.external_id,\n fileName: doc.file_name,\n pages: isImage ? null : (doc.n_pages ?? null),\n tokens: isImage ? null : (doc.tokens ?? null),\n status: doc.status,\n isImage,\n }\n}\n\n/** The open workspace's folders and labels for a workflow's scope field. */\nexport function useConnectedWorkflowScopeSource(): WorkflowScopeSource {\n const { data: docs } = useListedDocuments()\n const { data: tags } = useConnectedTags()\n return useMemo(() => buildWorkflowScopeSource(docs, documentScopeLabels(tags)), [docs, tags])\n}\n\n/** The user's agents, for \"Run as\". */\nexport function useConnectedAgentOptions(): AgentOption[] {\n const { data: agents } = useAgents()\n return useMemo(\n () => (agents ?? []).map((a) => ({ id: a.external_id, label: a.given_name || a.email })),\n [agents]\n )\n}\n\nexport interface ConnectedWorkflowDocumentsFieldProps {\n field: WorkflowField\n value: WorkflowScope\n onChange: (value: WorkflowScope) => void\n /** Add files the host's way (its upload dialog). Absent: they are uploaded here. */\n onAddFiles?: (files?: File[]) => void\n labels?: Partial<WorkflowDocumentsFieldLabels>\n}\n\n/**\n * A workflow `documents` field over the open workspace's files: pick, add (or drop) files, see the\n * chosen images. A launcher's or a task composer's `renderDocuments`.\n */\nexport function ConnectedWorkflowDocumentsField({\n field,\n value,\n onChange,\n onAddFiles,\n labels,\n}: ConnectedWorkflowDocumentsFieldProps) {\n const { notify } = useBlocksEnvironment()\n const { ensureWorkspaceOpen } = useConnectedWorkspace()\n const { data: docs, loaded } = useListedDocuments()\n const uploadDocuments = useUploadDocuments()\n const documents = useMemo(() => docs.map(toWorkflowFieldDocument), [docs])\n const chosen = value.documents ?? []\n const { data: thumbnails } = useThumbnails(chosen, { enabled: (field.max ?? 1) > 1 })\n const input = useRef<HTMLInputElement>(null)\n const [adding, setAdding] = useState(false)\n\n const upload = useCallback(\n async (files: File[]) => {\n setAdding(true)\n try {\n await ensureWorkspaceOpen()\n // Each new document joins the shared list as it lands.\n for (const file of files) await uploadDocuments.mutateAsync({ files: [file] })\n } catch (error) {\n notify(error instanceof Error && error.message ? error.message : String(error), 'error')\n } finally {\n setAdding(false)\n }\n },\n [uploadDocuments, ensureWorkspaceOpen, notify]\n )\n\n return (\n <>\n {!onAddFiles && (\n <input\n ref={input}\n type=\"file\"\n multiple\n className=\"hidden\"\n aria-label=\"Add files\"\n data-testid=\"workflow-add-files-input\"\n onChange={(e) => {\n const files = Array.from(e.target.files ?? [])\n e.target.value = ''\n if (files.length) void upload(files)\n }}\n />\n )}\n <WorkflowDocumentsField\n field={field}\n value={value}\n onChange={onChange}\n documents={documents}\n loaded={loaded}\n thumbnailOf={(id) => thumbnails?.[id]}\n onAddFiles={\n onAddFiles ?? ((files) => (files?.length ? void upload(files) : input.current?.click()))\n }\n adding={adding}\n labels={labels}\n />\n </>\n )\n}\n\nexport interface ConnectedWorkflowLauncherProps extends Omit<\n WorkflowLauncherProps,\n 'scopeSource' | 'renderDocuments' | 'agents'\n> {\n /** Add files from a `documents` field the host's way (its upload dialog). Absent: uploaded here. */\n onAddFiles?: (files?: File[]) => void\n}\n\nexport function ConnectedWorkflowLauncher({\n onAddFiles,\n ...props\n}: ConnectedWorkflowLauncherProps) {\n const scopeSource = useConnectedWorkflowScopeSource()\n const agents = useConnectedAgentOptions()\n return (\n <WorkflowLauncher\n {...props}\n scopeSource={scopeSource}\n agents={agents}\n renderDocuments={(field, value, onChange) => (\n <ConnectedWorkflowDocumentsField\n field={field}\n value={value}\n onChange={onChange}\n onAddFiles={onAddFiles}\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 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 * `groupBy=\"category\"` lists the host's catalogue (the host configuration's `workflows.catalogue`)\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' })`).\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> {\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 groupBy,\n renderIcon,\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 const catalogueEntries = groupBy === 'category' ? host?.catalogue : undefined\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 groupBy={groupBy}\n catalogue={catalogue}\n categories={host?.categories}\n renderIcon={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 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/NativeDocxEditor'\nimport {\n builtinHouseTemplate,\n type HouseTemplate,\n type HouseTemplateHost,\n} 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 return 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 {\n NativeDocxEditor,\n type NativeDocxAdapter,\n type NativeDocxEditorProps,\n} from '../../docx/NativeDocxEditor'\nimport { loadDocxFonts } from '../../docx/fonts'\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'> & {\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 && !props.compact\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&apos;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: () => 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/ConnectedWorkflowLauncher.tsx","../src/connection/docx/useConnectedDocxReferences.tsx","../src/connection/ConnectedWorkflowsTable.tsx","../src/connection/docx/useConnectedHouseTemplate.ts","../src/connection/docx/ConnectedNativeDocxEditor.tsx"],"names":["useHost","useListedDocuments","useConnectedTags","useMemo","buildWorkflowScopeSource","documentScopeLabels","useAgents","useBlocksEnvironment","useConnectedWorkspace","useUploadDocuments","useThumbnails","useRef","useState","useCallback","jsxs","Fragment","jsx","WorkflowDocumentsField","WorkflowLauncher","DocumentPicker","useArbi","buildDeepLinkUrl","parseDeepLinkPath","useWorkspaceUsers","fmtDate","useOpenWorkflow","workflowSteps","useWorkflows","useConnectedConversations","useUpdateWorkflow","useDeleteWorkflow","useRunWorkflow","isScheduledWorkflow","useEffect","WorkflowsTable","workflowSignal","workflowTriggerType","useSetWorkspaceHouseTemplate","useWorkspaces","supportsHouseTemplates","workspaceHouseTemplateId","useHouseTemplateCandidates","contentPath","builtinHouseTemplate","isCandidate","useRegisterOpenDocument","NativeDocxEditor","useQueryClient","useOptionalDocumentTools","loadDocxFonts","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;ACZA,IAAM,gBAAA,mBAAmB,IAAI,GAAA,CAAI,CAAC,KAAA,EAAO,KAAA,EAAO,MAAA,EAAQ,KAAA,EAAO,KAAA,EAAO,MAAA,EAAQ,MAAM,CAAC,CAAA;AAG9E,SAAS,wBAAwB,GAAA,EAA+C;AAErF,EAAA,MAAM,UAAU,gBAAA,CAAiB,GAAA,CAAA,CAAK,IAAI,SAAA,IAAa,EAAA,EAAI,aAAa,CAAA;AACxE,EAAA,OAAO;AAAA,IACL,IAAI,GAAA,CAAI,WAAA;AAAA,IACR,OAAO,GAAA,CAAI,YAAA,EAAc,KAAA,IAAS,GAAA,CAAI,aAAa,GAAA,CAAI,WAAA;AAAA,IACvD,UAAU,GAAA,CAAI,SAAA;AAAA,IACd,KAAA,EAAO,OAAA,GAAU,IAAA,GAAQ,GAAA,CAAI,OAAA,IAAW,IAAA;AAAA,IACxC,MAAA,EAAQ,OAAA,GAAU,IAAA,GAAQ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AmB,EAAE,CAAC,CAAA,SAAA,CAAA,EAAa;AAAA,UAChF,MAAA,EAAQ,MAAA;AAAA,UACR,OAAA,EAAS,EAAE,cAAA,EAAgB,kBAAA,EAAmB;AAAA,UAC9C,IAAA,EAAM,KAAK,SAAA,CAAU;AAAA,YACnB,YAAY,OAAA,CAAQ,SAAA;AAAA,YACpB,aAAa,OAAA,CAAQ,WAAA;AAAA,YACrB,YAAY,OAAA,CAAQ,SAAA;AAAA,YACpB,eAAe,OAAA,CAAQ;AAAA,WACxB;AAAA,SACF,CAAA;AACD,QAAA,MAAM,QAAA,GAAY,MAAM,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-UDMII47W.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 workflow launcher bound to the connection: the open workspace's folders, labels and files\n * behind its scope and `documents` fields (files can be added right there), and the user's agents\n * behind \"Run as\". The host still says what a launch does (`onLaunch`): open a chat, start a task.\n */\n\nimport { useCallback, useMemo, useRef, useState } from 'react'\nimport { useAgents, useThumbnails, useUploadDocuments } from '@arbidocs/react'\nimport { WorkflowLauncher, type WorkflowLauncherProps } from '../agents/workflows/WorkflowLauncher'\nimport {\n WorkflowDocumentsField,\n type WorkflowDocumentsFieldLabels,\n type WorkflowFieldDocument,\n} from '../agents/workflows/WorkflowDocumentsField'\nimport type { WorkflowScopeSource } from '../agents/workflows/WorkflowConfigDialog'\nimport { buildWorkflowScopeSource, documentScopeLabels } from '../agents/workflows/workspaceScope'\nimport type { AgentOption } from '../agents/workflows/AgentSelect'\nimport type { WorkflowField, WorkflowScope } from '../agents/workflows/types'\nimport { useBlocksEnvironment } from '../provider/environment'\nimport { useConnectedWorkspace } from './ConnectionProvider'\nimport { useConnectedTags, useListedDocuments, type ConnectedDocument } from './workspaceData'\n\nconst IMAGE_FILE_TYPES = new Set(['png', 'jpg', 'jpeg', 'gif', 'bmp', 'tiff', 'webp'])\n\n/** A workspace document as a `documents` field offers it. */\nexport function toWorkflowFieldDocument(doc: ConnectedDocument): WorkflowFieldDocument {\n // Pages and tokens are a text-parsing concept: never meaningful for an image.\n const isImage = IMAGE_FILE_TYPES.has((doc.file_type ?? '').toLowerCase())\n return {\n id: doc.external_id,\n title: doc.doc_metadata?.title || doc.file_name || doc.external_id,\n fileName: doc.file_name,\n pages: isImage ? null : (doc.n_pages ?? null),\n tokens: isImage ? null : (doc.tokens ?? null),\n status: doc.status,\n isImage,\n }\n}\n\n/** The open workspace's folders and labels for a workflow's scope field. */\nexport function useConnectedWorkflowScopeSource(): WorkflowScopeSource {\n const { data: docs } = useListedDocuments()\n const { data: tags } = useConnectedTags()\n return useMemo(() => buildWorkflowScopeSource(docs, documentScopeLabels(tags)), [docs, tags])\n}\n\n/** The user's agents, for \"Run as\". */\nexport function useConnectedAgentOptions(): AgentOption[] {\n const { data: agents } = useAgents()\n return useMemo(\n () => (agents ?? []).map((a) => ({ id: a.external_id, label: a.given_name || a.email })),\n [agents]\n )\n}\n\nexport interface ConnectedWorkflowDocumentsFieldProps {\n field: WorkflowField\n value: WorkflowScope\n onChange: (value: WorkflowScope) => void\n /** Add files the host's way (its upload dialog). Absent: they are uploaded here. */\n onAddFiles?: (files?: File[]) => void\n labels?: Partial<WorkflowDocumentsFieldLabels>\n}\n\n/**\n * A workflow `documents` field over the open workspace's files: pick, add (or drop) files, see the\n * chosen images. A launcher's or a task composer's `renderDocuments`.\n */\nexport function ConnectedWorkflowDocumentsField({\n field,\n value,\n onChange,\n onAddFiles,\n labels,\n}: ConnectedWorkflowDocumentsFieldProps) {\n const { notify } = useBlocksEnvironment()\n const { ensureWorkspaceOpen } = useConnectedWorkspace()\n const { data: docs, loaded } = useListedDocuments()\n const uploadDocuments = useUploadDocuments()\n const documents = useMemo(() => docs.map(toWorkflowFieldDocument), [docs])\n const chosen = value.documents ?? []\n const { data: thumbnails } = useThumbnails(chosen, { enabled: (field.max ?? 1) > 1 })\n const input = useRef<HTMLInputElement>(null)\n const [adding, setAdding] = useState(false)\n\n const upload = useCallback(\n async (files: File[]) => {\n setAdding(true)\n try {\n await ensureWorkspaceOpen()\n // Each new document joins the shared list as it lands.\n for (const file of files) await uploadDocuments.mutateAsync({ files: [file] })\n } catch (error) {\n notify(error instanceof Error && error.message ? error.message : String(error), 'error')\n } finally {\n setAdding(false)\n }\n },\n [uploadDocuments, ensureWorkspaceOpen, notify]\n )\n\n return (\n <>\n {!onAddFiles && (\n <input\n ref={input}\n type=\"file\"\n multiple\n className=\"hidden\"\n aria-label=\"Add files\"\n data-testid=\"workflow-add-files-input\"\n onChange={(e) => {\n const files = Array.from(e.target.files ?? [])\n e.target.value = ''\n if (files.length) void upload(files)\n }}\n />\n )}\n <WorkflowDocumentsField\n field={field}\n value={value}\n onChange={onChange}\n documents={documents}\n loaded={loaded}\n thumbnailOf={(id) => thumbnails?.[id]}\n onAddFiles={\n onAddFiles ?? ((files) => (files?.length ? void upload(files) : input.current?.click()))\n }\n adding={adding}\n labels={labels}\n />\n </>\n )\n}\n\nexport interface ConnectedWorkflowLauncherProps extends Omit<\n WorkflowLauncherProps,\n 'scopeSource' | 'renderDocuments' | 'agents'\n> {\n /** Add files from a `documents` field the host's way (its upload dialog). Absent: uploaded here. */\n onAddFiles?: (files?: File[]) => void\n}\n\nexport function ConnectedWorkflowLauncher({\n onAddFiles,\n ...props\n}: ConnectedWorkflowLauncherProps) {\n const scopeSource = useConnectedWorkflowScopeSource()\n const agents = useConnectedAgentOptions()\n return (\n <WorkflowLauncher\n {...props}\n scopeSource={scopeSource}\n agents={agents}\n renderDocuments={(field, value, onChange) => (\n <ConnectedWorkflowDocumentsField\n field={field}\n value={value}\n onChange={onChange}\n onAddFiles={onAddFiles}\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 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 * `groupBy=\"category\"` lists the host's catalogue (the host configuration's `workflows.catalogue`)\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' })`).\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> {\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 groupBy,\n renderIcon,\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 const catalogueEntries = groupBy === 'category' ? host?.catalogue : undefined\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 groupBy={groupBy}\n catalogue={catalogue}\n categories={host?.categories}\n renderIcon={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 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/NativeDocxEditor'\nimport {\n builtinHouseTemplate,\n type HouseTemplate,\n type HouseTemplateHost,\n} 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 return 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 {\n NativeDocxEditor,\n type NativeDocxAdapter,\n type NativeDocxEditorProps,\n} from '../../docx/NativeDocxEditor'\nimport { loadDocxFonts } from '../../docx/fonts'\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'> & {\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 && !props.compact\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&apos;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: () => 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"]}
@@ -4,7 +4,7 @@ import { testIdOr } from './chunk-7F6CBP3Z.js';
4
4
  import { useRef, useState, useEffect, useCallback } from 'react';
5
5
  import { X } from 'lucide-react';
6
6
  import { Tooltip, TooltipTrigger, TooltipContent, cn, Badge } from '@arbidocs/react/ui';
7
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
7
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
8
8
 
9
9
  var DEFAULT_TAB_HEADER_LABELS = {
10
10
  closeTab: "Close tab"
@@ -171,6 +171,7 @@ function TabHeader({
171
171
  centerContent,
172
172
  absoluteCenterContent,
173
173
  rightContent,
174
+ belowContent,
174
175
  className,
175
176
  compactBreakpoint = 640,
176
177
  labels,
@@ -208,97 +209,101 @@ function TabHeader({
208
209
  const active = scroller?.querySelector('[data-slot="tab"][data-state="active"]');
209
210
  if (scroller && active) scrollRowToShow(scroller, active);
210
211
  }, [activeTabId]);
211
- return /* @__PURE__ */ jsx(
212
+ const below = typeof belowContent === "function" ? belowContent(isCompact) : belowContent;
213
+ return /* @__PURE__ */ jsxs(
212
214
  "div",
213
215
  {
214
216
  ref: containerRef,
215
217
  className: cn("w-full bg-background pt-1 pr-3 pb-2", className),
216
218
  "data-slot": "tab-header",
217
219
  "data-testid": testIdOr(testId, { testId: "tab-header" }),
218
- children: /* @__PURE__ */ jsxs("div", { className: "relative bg-background", children: [
219
- /* @__PURE__ */ jsx(
220
- "span",
221
- {
222
- "aria-hidden": true,
223
- className: "pointer-events-none absolute inset-x-0 bottom-0 h-px bg-border"
224
- }
225
- ),
226
- /* @__PURE__ */ jsxs("div", { className: "relative flex min-h-[40px] items-end justify-between gap-4", children: [
227
- leading && /* @__PURE__ */ jsx("div", { className: "absolute bottom-1.5 left-1.5 z-10 flex items-center", children: leading }),
228
- /* @__PURE__ */ jsxs("div", { className: "relative flex min-w-0 flex-shrink items-end", children: [
220
+ children: [
221
+ /* @__PURE__ */ jsxs("div", { className: "relative bg-background", children: [
222
+ /* @__PURE__ */ jsx(
223
+ "span",
224
+ {
225
+ "aria-hidden": true,
226
+ className: "pointer-events-none absolute inset-x-0 bottom-0 h-px bg-border"
227
+ }
228
+ ),
229
+ /* @__PURE__ */ jsxs("div", { className: "relative flex min-h-[40px] items-end justify-between gap-4", children: [
230
+ leading && /* @__PURE__ */ jsx("div", { className: "absolute bottom-1.5 left-1.5 z-10 flex items-center", children: leading }),
231
+ /* @__PURE__ */ jsxs("div", { className: "relative flex min-w-0 flex-shrink items-end", children: [
232
+ /* @__PURE__ */ jsx(
233
+ "div",
234
+ {
235
+ ref: scrollerRef,
236
+ "data-slot": "tab-scroller",
237
+ className: cn(
238
+ "flex min-w-0 items-end overflow-x-auto overflow-y-hidden pt-1",
239
+ leading ? "pl-8" : "pl-3"
240
+ ),
241
+ children: leftContent || /* @__PURE__ */ jsxs("div", { className: "flex items-end gap-1", children: [
242
+ tabs.map((tab, index) => {
243
+ const tabButton = /* @__PURE__ */ jsx(
244
+ TabButton,
245
+ {
246
+ tab,
247
+ isActive: activeTabId === tab.id,
248
+ isChip: isChipRow,
249
+ isCompact: isCompact && tabs.length > 1,
250
+ onTabChange,
251
+ labels: mergedLabels,
252
+ testIds
253
+ },
254
+ tab.id
255
+ );
256
+ const renderedTab = !tab.tooltip ? tabButton : /* @__PURE__ */ jsxs(Tooltip, { children: [
257
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: tabButton }),
258
+ /* @__PURE__ */ jsx(TooltipContent, { side: "bottom", children: /* @__PURE__ */ jsx("p", { children: tab.tooltip }) })
259
+ ] }, tab.id);
260
+ if (index !== 0 || !firstTabContent) return renderedTab;
261
+ return /* @__PURE__ */ jsxs(
262
+ "div",
263
+ {
264
+ "data-slot": "count-tab-group",
265
+ className: "flex shrink-0 items-end gap-1",
266
+ children: [
267
+ renderedTab,
268
+ /* @__PURE__ */ jsx("div", { className: cn("self-center", COMPACT_SECTION), children: typeof firstTabContent === "function" ? firstTabContent(isCompact) : firstTabContent })
269
+ ]
270
+ },
271
+ tab.id
272
+ );
273
+ }),
274
+ afterTabs && /* @__PURE__ */ jsx("div", { className: cn("self-center", COMPACT_SECTION), children: typeof afterTabs === "function" ? afterTabs(isCompact) : afterTabs })
275
+ ] })
276
+ }
277
+ ),
278
+ canScrollEnd && /* @__PURE__ */ jsx(
279
+ "span",
280
+ {
281
+ "aria-hidden": true,
282
+ "data-slot": "tab-scroll-cue",
283
+ className: "pointer-events-none absolute inset-y-0 right-0 w-8 bg-gradient-to-l from-background to-transparent"
284
+ }
285
+ )
286
+ ] }),
287
+ centerContent && /* @__PURE__ */ jsx("div", { className: cn("flex min-w-fit flex-1 items-center self-center", COMPACT_SECTION), children: typeof centerContent === "function" ? centerContent(isCompact) : centerContent }),
288
+ absoluteCenterContent && /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-0 z-10 flex items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "pointer-events-auto", children: absoluteCenterContent }) }),
229
289
  /* @__PURE__ */ jsx(
230
290
  "div",
231
291
  {
232
- ref: scrollerRef,
233
- "data-slot": "tab-scroller",
234
292
  className: cn(
235
- "flex min-w-0 items-end overflow-x-auto overflow-y-hidden pt-1",
236
- leading ? "pl-8" : "pl-3"
293
+ "flex flex-shrink-0 items-center justify-end gap-2 self-center",
294
+ COMPACT_SECTION
237
295
  ),
238
- children: leftContent || /* @__PURE__ */ jsxs("div", { className: "flex items-end gap-1", children: [
239
- tabs.map((tab, index) => {
240
- const tabButton = /* @__PURE__ */ jsx(
241
- TabButton,
242
- {
243
- tab,
244
- isActive: activeTabId === tab.id,
245
- isChip: isChipRow,
246
- isCompact: isCompact && tabs.length > 1,
247
- onTabChange,
248
- labels: mergedLabels,
249
- testIds
250
- },
251
- tab.id
252
- );
253
- const renderedTab = !tab.tooltip ? tabButton : /* @__PURE__ */ jsxs(Tooltip, { children: [
254
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: tabButton }),
255
- /* @__PURE__ */ jsx(TooltipContent, { side: "bottom", children: /* @__PURE__ */ jsx("p", { children: tab.tooltip }) })
256
- ] }, tab.id);
257
- if (index !== 0 || !firstTabContent) return renderedTab;
258
- return /* @__PURE__ */ jsxs(
259
- "div",
260
- {
261
- "data-slot": "count-tab-group",
262
- className: "flex shrink-0 items-end gap-1",
263
- children: [
264
- renderedTab,
265
- /* @__PURE__ */ jsx("div", { className: cn("self-center", COMPACT_SECTION), children: typeof firstTabContent === "function" ? firstTabContent(isCompact) : firstTabContent })
266
- ]
267
- },
268
- tab.id
269
- );
270
- }),
271
- afterTabs && /* @__PURE__ */ jsx("div", { className: cn("self-center", COMPACT_SECTION), children: typeof afterTabs === "function" ? afterTabs(isCompact) : afterTabs })
272
- ] })
273
- }
274
- ),
275
- canScrollEnd && /* @__PURE__ */ jsx(
276
- "span",
277
- {
278
- "aria-hidden": true,
279
- "data-slot": "tab-scroll-cue",
280
- className: "pointer-events-none absolute inset-y-0 right-0 w-8 bg-gradient-to-l from-background to-transparent"
296
+ children: typeof rightContent === "function" ? rightContent(isCompact) : rightContent
281
297
  }
282
298
  )
283
- ] }),
284
- centerContent && /* @__PURE__ */ jsx("div", { className: cn("flex min-w-fit flex-1 items-center self-center", COMPACT_SECTION), children: typeof centerContent === "function" ? centerContent(isCompact) : centerContent }),
285
- absoluteCenterContent && /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-0 z-10 flex items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "pointer-events-auto", children: absoluteCenterContent }) }),
286
- /* @__PURE__ */ jsx(
287
- "div",
288
- {
289
- className: cn(
290
- "flex flex-shrink-0 items-center justify-end gap-2 self-center",
291
- COMPACT_SECTION
292
- ),
293
- children: typeof rightContent === "function" ? rightContent(isCompact) : rightContent
294
- }
295
- )
296
- ] })
297
- ] })
299
+ ] })
300
+ ] }),
301
+ below != null && below !== false && /* @__PURE__ */ jsx("div", { "data-slot": "tab-header-below", className: "flex items-center pt-2 pl-3", children: below })
302
+ ]
298
303
  }
299
304
  );
300
305
  }
301
306
 
302
307
  export { DEFAULT_TAB_HEADER_LABELS, TabHeader };
303
- //# sourceMappingURL=chunk-ABEKUV6L.js.map
304
- //# sourceMappingURL=chunk-ABEKUV6L.js.map
308
+ //# sourceMappingURL=chunk-VDXKB4WK.js.map
309
+ //# sourceMappingURL=chunk-VDXKB4WK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/shell/TabHeader.tsx"],"names":[],"mappings":";;;;;;;AAoBO,IAAM,yBAAA,GAA6C;AAAA,EACxD,QAAA,EAAU;AACZ;AAqCA,IAAM,eAAA,GACJ,6RAAA;AAgBF,SAAS,SAAA,CAAU;AAAA,EACjB,GAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA,WAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,EAAmB;AAKjB,EAAA,MAAM,YAAY,SAAA,IAAa,CAAC,CAAC,GAAA,CAAI,QAAQ,CAAC,QAAA;AAC9C,EAAA,MAAM,WAAA,GAAc,YAAY,MAAM;AACpC,IAAA,IAAI,CAAC,GAAA,CAAI,QAAA,EAAU,WAAA,CAAY,IAAI,EAAE,CAAA;AAAA,EACvC,GAAG,CAAC,GAAA,CAAI,UAAU,GAAA,CAAI,EAAA,EAAI,WAAW,CAAC,CAAA;AAGtC,EAAA,MAAM,aAAA,GAAgB,WAAA;AAAA,IACpB,CAAC,CAAA,KAAqC;AACpC,MAAA,IAAI,IAAI,QAAA,EAAU;AAClB,MAAA,IAAI,CAAA,CAAE,GAAA,KAAQ,OAAA,IAAW,CAAA,CAAE,QAAQ,GAAA,EAAK;AACtC,QAA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;AAAA,GAEJ;AAEJ","file":"chunk-VDXKB4WK.js","sourcesContent":["import {\n useCallback,\n useEffect,\n useRef,\n useState,\n type KeyboardEvent,\n type MouseEvent,\n type ReactNode,\n} from 'react'\nimport { X } from 'lucide-react'\nimport { Badge, cn, Tooltip, TooltipContent, TooltipTrigger } from '@arbidocs/react/ui'\nimport { testIdOr } from '../chat/test-id'\nimport { observeResize } from '../lib/observe-resize'\n\n/** Fixed strings of the tab row. */\nexport interface TabHeaderLabels {\n /** A tab's close button (a tab's own `closeTooltip` wins). */\n closeTab: string\n}\n\nexport const DEFAULT_TAB_HEADER_LABELS: TabHeaderLabels = {\n closeTab: 'Close tab',\n}\n\nexport interface Tab {\n id: string\n label: string | ReactNode\n testId?: string\n icon?: ReactNode\n /**\n * An entity pill (conversation, workspace, …) shown in place of the icon + label. The app\n * renders it, so the block stays free of entity components.\n */\n pill?: ReactNode\n count?: number\n /** Where the count sits relative to the label. Defaults to 'trailing'. */\n countPlacement?: 'leading' | 'trailing'\n /** Glyph INSIDE the count, in front of the number, so icon and count read as one object. */\n countIcon?: ReactNode\n /** Classes for the number alone (e.g. a filled pill), leaving the glyph as it is. */\n countClassName?: string\n badge?: string | ReactNode\n disabled?: boolean\n tooltip?: string\n actions?: ReactNode\n /** Hover handlers from actions (e.g. a filter dropdown), attached to the whole tab wrapper. */\n actionsHoverHandlers?: { onMouseEnter: () => void; onMouseLeave: () => void }\n isProcessing?: boolean\n isVariable?: boolean\n onClose?: () => void\n closeTooltip?: string\n hasActiveFilters?: boolean\n /** Entity count header without selectable-tab chrome (Facts, Tasks, Files). */\n presentation?: 'tab' | 'count'\n /** Extra classes for the tab button. */\n tabClassName?: string\n}\n\n/** Forces buttons in a header section to a uniform compact size (28px, 14px text). */\nconst COMPACT_SECTION =\n '[&_button]:h-7 [&_button]:px-2 [&_button]:py-0 [&_button]:text-sm [&_button]:font-medium ' +\n '[&_[role=button]]:h-7 [&_[role=button]]:px-2 [&_[role=button]]:py-0 [&_[role=button]]:text-sm [&_[role=button]]:font-medium ' +\n // Touch: the compact 28px floor is lifted to 44px (important beats the rules above).\n 'pointer-coarse:[&_button]:h-11! pointer-coarse:[&_[role=button]]:h-11!'\n\ninterface TabButtonProps {\n tab: Tab\n isActive: boolean\n /** Closable-items row: a soft chip with a close button instead of an underline. */\n isChip: boolean\n isCompact: boolean\n onTabChange: (tabId: string) => void\n labels: TabHeaderLabels\n testIds?: TabHeaderProps['testIds']\n}\n\nfunction TabButton({\n tab,\n isActive,\n isChip,\n isCompact,\n onTabChange,\n labels,\n testIds,\n}: TabButtonProps) {\n // Compact mode (narrow header) collapses every INACTIVE tab that has an icon to icon-only so\n // the trailing controls are never pushed off the edge. The active tab keeps a truncated title:\n // otherwise two icon-only tabs cannot be told apart on a phone. Collapsed tabs keep an\n // accessible name and a title with their label; label-only tabs keep their text.\n const hideLabel = isCompact && !!tab.icon && !isActive\n const handleClick = useCallback(() => {\n if (!tab.disabled) onTabChange(tab.id)\n }, [tab.disabled, tab.id, onTabChange])\n\n // div+role=button needs explicit keyboard handling; Space must not scroll the page.\n const handleKeyDown = useCallback(\n (e: KeyboardEvent<HTMLDivElement>) => {\n if (tab.disabled) return\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n onTabChange(tab.id)\n }\n },\n [tab.disabled, tab.id, onTabChange]\n )\n\n const handleClose = useCallback(\n (e: MouseEvent) => {\n e.stopPropagation()\n tab.onClose?.()\n },\n [tab]\n )\n\n // Two looks, chosen by the row: a row that holds closable items (conversations, open panels)\n // shows soft chips, the active one filled, so \"close\" has an obvious owner. Every other row is a\n // plain underline: ink text + a 2px primary underline for the active tab, nothing else.\n const className = cn(\n 'group relative z-[1] flex pointer-coarse:h-11 cursor-pointer items-center justify-start text-left text-sm transition-colors',\n isChip\n ? 'h-8 max-w-[260px] rounded-md px-2.5'\n : 'h-9 max-w-[320px] border-b-2 bg-transparent px-2.5',\n isChip\n ? isActive\n ? 'bg-muted font-semibold text-foreground'\n : 'bg-transparent font-medium text-muted-foreground hover:bg-muted/60 hover:text-foreground'\n : isActive\n ? 'border-b-primary font-semibold text-foreground'\n : 'border-b-transparent font-medium text-muted-foreground hover:text-foreground',\n // Touch: an icon-only tab still meets the 44px target; a titled active tab truncates.\n isCompact && tab.icon && (isActive ? 'max-w-[45vw]' : 'pointer-coarse:min-w-11 justify-center'),\n tab.disabled && 'cursor-not-allowed opacity-50',\n tab.presentation === 'count' &&\n 'rounded-none border-transparent bg-transparent pl-0 font-normal hover:bg-transparent',\n tab.tabClassName\n )\n\n const countValue = tab.isProcessing ? (\n <span className=\"animate-pulse\">{tab.count}</span>\n ) : (\n tab.count\n )\n const countBadge =\n tab.count === undefined ? null : (\n // A plain muted number, a footnote to the label. A filtered count switches to primary ink so\n // \"this is narrowed\" still reads without a fill.\n <span\n data-testid={testIdOr(testIds?.count, { testId: 'tab-count' })}\n className={cn(\n 'flex-shrink-0 items-center justify-center gap-1 font-normal leading-none tabular-nums',\n tab.countIcon ? 'text-sm' : 'text-xs',\n tab.countPlacement === 'leading' ? 'mr-1.5' : 'ml-1.5',\n // Compact rows drop counts to save width, but a tab whose glyph lives in the count has\n // nothing else to show: there the count IS the tab.\n isCompact && !tab.countIcon ? 'hidden' : 'inline-flex',\n tab.hasActiveFilters ? 'text-primary' : 'text-muted-foreground'\n )}\n >\n {tab.countIcon && (\n <span aria-hidden className=\"flex shrink-0 items-center justify-center\">\n {tab.countIcon}\n </span>\n )}\n {tab.countClassName ? <span className={tab.countClassName}>{countValue}</span> : countValue}\n </span>\n )\n\n const content = tab.pill ? (\n // The outer wrapper hosts the processing dot outside the pill's bounds; the inner span keeps\n // the truncation the pill needs without clipping the dot.\n <span className=\"relative inline-flex min-w-0 items-center\">\n <span className=\"min-w-0 truncate overflow-hidden\">{tab.pill}</span>\n {tab.isProcessing && (\n <span className=\"absolute -right-1 -top-1 size-2 rounded-full border border-background bg-yellow-solid\" />\n )}\n </span>\n ) : (\n <>\n {tab.icon && (\n <span\n className={cn(\n 'flex size-5 flex-shrink-0 items-center justify-center',\n !hideLabel && 'mr-1.5'\n )}\n >\n {tab.icon}\n </span>\n )}\n {tab.countPlacement === 'leading' && countBadge}\n <span className={cn('truncate', hideLabel ? 'hidden' : 'inline')}>{tab.label}</span>\n {tab.countPlacement !== 'leading' && countBadge}\n {tab.badge &&\n (typeof tab.badge === 'string' ? (\n <Badge\n variant=\"outline\"\n className={cn('ml-1.5 truncate', isCompact ? 'max-w-[120px]' : 'max-w-none')}\n >\n {tab.badge}\n </Badge>\n ) : (\n <span className=\"ml-1.5 inline-flex items-center\">{tab.badge}</span>\n ))}\n </>\n )\n\n return (\n <div\n className={cn('flex items-end', isChip && 'pb-1')}\n data-testid={testIdOr(tab.testId, { testId: `${tab.id}-tab` })}\n onMouseEnter={tab.actionsHoverHandlers?.onMouseEnter}\n onMouseLeave={tab.actionsHoverHandlers?.onMouseLeave}\n >\n {/* role=button on a div, not a <button>: a tab whose badge holds a real interactive element\n (an entity tooltip trigger) would otherwise nest a button inside a button. */}\n <div\n role=\"button\"\n tabIndex={tab.disabled ? -1 : 0}\n aria-disabled={tab.disabled || undefined}\n aria-current={isActive ? 'true' : undefined}\n data-slot=\"tab\"\n data-state={isActive ? 'active' : 'inactive'}\n // Icon-only tabs expose the label for a11y and as a native title.\n aria-label={hideLabel && typeof tab.label === 'string' ? tab.label : undefined}\n title={hideLabel && !tab.tooltip && typeof tab.label === 'string' ? tab.label : undefined}\n className={className}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n >\n {content}\n {tab.actions && (\n <span className=\"ml-auto flex-shrink-0\" onClick={(e) => e.stopPropagation()}>\n {tab.actions}\n </span>\n )}\n {tab.onClose && (\n <Tooltip>\n <TooltipTrigger asChild>\n <span\n role=\"button\"\n tabIndex={0}\n className={cn(\n 'ml-0.5 inline-flex !size-4 flex-shrink-0 items-center justify-center rounded-sm !p-0 text-muted-foreground transition-colors hover:bg-foreground/10 hover:text-foreground pointer-coarse:!size-11',\n // A chip row keeps the close button quiet until the chip is the active one or is\n // hovered or focused; touch always shows it (there is no hover).\n isChip &&\n !isActive &&\n 'opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 pointer-coarse:opacity-100'\n )}\n onClick={handleClose}\n aria-label={tab.closeTooltip || labels.closeTab}\n data-testid={testIdOr(testIds?.closeButton, { testId: 'close-tab-button' })}\n >\n <X className=\"size-3\" />\n </span>\n </TooltipTrigger>\n <TooltipContent>\n <p>{tab.closeTooltip || labels.closeTab}</p>\n </TooltipContent>\n </Tooltip>\n )}\n </div>\n </div>\n )\n}\n\nexport interface TabHeaderProps {\n tabs: Tab[]\n activeTabId: string\n onTabChange: (tabId: string) => void\n /** Pinned to the far left before the tabs (e.g. the sidebar toggle). */\n leading?: ReactNode\n leftContent?: ReactNode\n /** Controls attached to the first count tab, before any additional tabs. */\n firstTabContent?: ReactNode | ((isCompact: boolean) => ReactNode)\n afterTabs?: ReactNode | ((isCompact: boolean) => ReactNode)\n centerContent?: ReactNode | ((isCompact: boolean) => ReactNode)\n /** Pinned to the true horizontal center of the row, independent of left/right widths. */\n absoluteCenterContent?: ReactNode\n rightContent?: ReactNode | ((isCompact: boolean) => ReactNode)\n /**\n * A row under the tabs, e.g. a filter that leaves the tab row on a narrow header (return it\n * for `isCompact` only) so the tabs keep their room. Nothing rendered when it returns nothing.\n */\n belowContent?: ReactNode | ((isCompact: boolean) => ReactNode)\n className?: string\n /** Header width below which tabs collapse to icons. */\n compactBreakpoint?: number\n labels?: Partial<TabHeaderLabels>\n /**\n * `chips` renders every tab as a soft chip (for rows of closable items), `underline` as a plain\n * underline tab. Default: chips when any tab can be closed, underline otherwise.\n */\n variant?: 'underline' | 'chips'\n /** Root id (default `tab-header`). */\n testId?: string\n /**\n * Per-tab ids; defaults are the current ids. A tab's own id is `Tab.testId`, else `<tab id>-tab`\n * (structural).\n */\n testIds?: Partial<Record<'count' | 'closeButton', string>>\n}\n\n/** Scroll `row` sideways (only it, no ancestor) so `item` is fully visible. */\nfunction scrollRowToShow(row: HTMLElement, item: Element): void {\n const r = row.getBoundingClientRect()\n const i = item.getBoundingClientRect()\n if (i.left < r.left) row.scrollLeft -= r.left - i.left\n else if (i.right > r.right) row.scrollLeft += i.right - r.right\n}\n\n/** Underline tab row with leading / center / right slots; collapses to icons when narrow. */\nexport function TabHeader({\n tabs,\n activeTabId,\n onTabChange,\n leading,\n leftContent,\n firstTabContent,\n afterTabs,\n centerContent,\n absoluteCenterContent,\n rightContent,\n belowContent,\n className,\n compactBreakpoint = 640,\n labels,\n variant,\n testId,\n testIds,\n}: TabHeaderProps) {\n const mergedLabels = { ...DEFAULT_TAB_HEADER_LABELS, ...labels }\n const isChipRow = variant ? variant === 'chips' : tabs.some((tab) => !!tab.onClose)\n const containerRef = useRef<HTMLDivElement>(null)\n const scrollerRef = useRef<HTMLDivElement>(null)\n const [isCompact, setIsCompact] = useState(false)\n const [canScrollEnd, setCanScrollEnd] = useState(false)\n\n useEffect(() => {\n const container = containerRef.current\n if (!container) return\n return observeResize(container, (entries) => {\n for (const entry of entries) setIsCompact(entry.contentRect.width < compactBreakpoint)\n })\n }, [compactBreakpoint])\n\n // Overflow cue: track whether tabs are hidden past the trailing edge.\n useEffect(() => {\n const scroller = scrollerRef.current\n if (!scroller) return\n const update = () =>\n setCanScrollEnd(scroller.scrollLeft + scroller.clientWidth < scroller.scrollWidth - 1)\n update()\n scroller.addEventListener('scroll', update, { passive: true })\n const stopObserving = observeResize(scroller, update)\n return () => {\n scroller.removeEventListener('scroll', update)\n stopObserving()\n }\n }, [tabs.length])\n\n // Keep the active tab visible when it changes (or on first render) in a scrolling row. Only the\n // row scrolls, sideways: `scrollIntoView` would also scroll every ancestor, so a tab header below\n // the fold dragged the whole page down to it on load.\n useEffect(() => {\n const scroller = scrollerRef.current\n const active = scroller?.querySelector('[data-slot=\"tab\"][data-state=\"active\"]')\n if (scroller && active) scrollRowToShow(scroller, active)\n }, [activeTabId])\n\n const below = typeof belowContent === 'function' ? belowContent(isCompact) : belowContent\n\n return (\n <div\n ref={containerRef}\n className={cn('w-full bg-background pt-1 pr-3 pb-2', className)}\n data-slot=\"tab-header\"\n data-testid={testIdOr(testId, { testId: 'tab-header' })}\n >\n <div className=\"relative bg-background\">\n {/* The hairline lives on this non-scrolling wrapper: overflow-y-hidden on the scroll row\n would clip the active tab's underline overhang. The tabs paint over the line. */}\n <span\n aria-hidden\n className=\"pointer-events-none absolute inset-x-0 bottom-0 h-px bg-border\"\n />\n {/* overflow-y-hidden is mandatory: overflow-x-auto alone makes the browser compute\n overflow-y to `auto` too, surfacing a phantom vertical scrollbar from sub-pixel\n overflow (e.g. the processing dot's -top-1). pt-1 keeps that dot inside the clip box. */}\n <div className=\"relative flex min-h-[40px] items-end justify-between gap-4\">\n {/* Leading slot: placed in the left margin (the pl-8 gap), claiming no extra width. */}\n {leading && (\n <div className=\"absolute bottom-1.5 left-1.5 z-10 flex items-center\">{leading}</div>\n )}\n {/* Only the tabs scroll: the center and right slots sit outside the scroller so they can\n never overlap a tab, and a fade at the trailing edge signals that more tabs exist. */}\n <div className=\"relative flex min-w-0 flex-shrink items-end\">\n <div\n ref={scrollerRef}\n data-slot=\"tab-scroller\"\n className={cn(\n 'flex min-w-0 items-end overflow-x-auto overflow-y-hidden pt-1',\n leading ? 'pl-8' : 'pl-3'\n )}\n >\n {leftContent || (\n <div className=\"flex items-end gap-1\">\n {tabs.map((tab, index) => {\n const tabButton = (\n <TabButton\n key={tab.id}\n tab={tab}\n isActive={activeTabId === tab.id}\n isChip={isChipRow}\n // A lone tab competes with nothing: its label is the surface's title.\n isCompact={isCompact && tabs.length > 1}\n onTabChange={onTabChange}\n labels={mergedLabels}\n testIds={testIds}\n />\n )\n const renderedTab = !tab.tooltip ? (\n tabButton\n ) : (\n <Tooltip key={tab.id}>\n <TooltipTrigger asChild>{tabButton}</TooltipTrigger>\n {/* Below: the header can sit at the very top of the viewport. */}\n <TooltipContent side=\"bottom\">\n <p>{tab.tooltip}</p>\n </TooltipContent>\n </Tooltip>\n )\n if (index !== 0 || !firstTabContent) return renderedTab\n return (\n <div\n key={tab.id}\n data-slot=\"count-tab-group\"\n className=\"flex shrink-0 items-end gap-1\"\n >\n {renderedTab}\n <div className={cn('self-center', COMPACT_SECTION)}>\n {typeof firstTabContent === 'function'\n ? firstTabContent(isCompact)\n : firstTabContent}\n </div>\n </div>\n )\n })}\n {afterTabs && (\n <div className={cn('self-center', COMPACT_SECTION)}>\n {typeof afterTabs === 'function' ? afterTabs(isCompact) : afterTabs}\n </div>\n )}\n </div>\n )}\n </div>\n {canScrollEnd && (\n <span\n aria-hidden\n data-slot=\"tab-scroll-cue\"\n className=\"pointer-events-none absolute inset-y-0 right-0 w-8 bg-gradient-to-l from-background to-transparent\"\n />\n )}\n </div>\n\n {centerContent && (\n <div className={cn('flex min-w-fit flex-1 items-center self-center', COMPACT_SECTION)}>\n {typeof centerContent === 'function' ? centerContent(isCompact) : centerContent}\n </div>\n )}\n\n {/* pointer-events-none on the overlay so clicks reach the tabs beneath; the inner div\n re-enables them for the actual content. */}\n {absoluteCenterContent && (\n <div className=\"pointer-events-none absolute inset-0 z-10 flex items-center justify-center\">\n <div className=\"pointer-events-auto\">{absoluteCenterContent}</div>\n </div>\n )}\n\n <div\n className={cn(\n 'flex flex-shrink-0 items-center justify-end gap-2 self-center',\n COMPACT_SECTION\n )}\n >\n {typeof rightContent === 'function' ? rightContent(isCompact) : rightContent}\n </div>\n </div>\n </div>\n {below != null && below !== false && (\n <div data-slot=\"tab-header-below\" className=\"flex items-center pt-2 pl-3\">\n {below}\n </div>\n )}\n </div>\n )\n}\n"]}