@arbidocs/blocks 0.5.103 → 0.5.105

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 (210) hide show
  1. package/dist/{ConnectedCallDock-P7LK2HYF.cjs → ConnectedCallDock-63F733HH.cjs} +21 -21
  2. package/dist/{ConnectedCallDock-P7LK2HYF.cjs.map → ConnectedCallDock-63F733HH.cjs.map} +1 -1
  3. package/dist/{ConnectedCallDock-NEZJNTKH.js → ConnectedCallDock-VJGARAFW.js} +13 -13
  4. package/dist/{ConnectedCallDock-NEZJNTKH.js.map → ConnectedCallDock-VJGARAFW.js.map} +1 -1
  5. package/dist/{ConnectedCallRoom-K3X6ICCG.js → ConnectedCallRoom-JEHW4VML.js} +13 -13
  6. package/dist/{ConnectedCallRoom-K3X6ICCG.js.map → ConnectedCallRoom-JEHW4VML.js.map} +1 -1
  7. package/dist/{ConnectedCallRoom-FXTR4YFI.cjs → ConnectedCallRoom-RYPXT4T5.cjs} +14 -14
  8. package/dist/{ConnectedCallRoom-FXTR4YFI.cjs.map → ConnectedCallRoom-RYPXT4T5.cjs.map} +1 -1
  9. package/dist/{ConnectedNativeDocxComparison-FENZYWDH.js → ConnectedNativeDocxComparison-3EASEGA7.js} +16 -16
  10. package/dist/{ConnectedNativeDocxComparison-FENZYWDH.js.map → ConnectedNativeDocxComparison-3EASEGA7.js.map} +1 -1
  11. package/dist/{ConnectedNativeDocxComparison-7VJKOKYU.cjs → ConnectedNativeDocxComparison-JZ6E75CT.cjs} +17 -17
  12. package/dist/{ConnectedNativeDocxComparison-7VJKOKYU.cjs.map → ConnectedNativeDocxComparison-JZ6E75CT.cjs.map} +1 -1
  13. package/dist/{ConnectedNativeDocxEditor-HB5BHGZ2.cjs → ConnectedNativeDocxEditor-QJET2DM7.cjs} +17 -17
  14. package/dist/{ConnectedNativeDocxEditor-HB5BHGZ2.cjs.map → ConnectedNativeDocxEditor-QJET2DM7.cjs.map} +1 -1
  15. package/dist/{ConnectedNativeDocxEditor-CNQAMO2N.js → ConnectedNativeDocxEditor-X5R5WDIV.js} +15 -15
  16. package/dist/{ConnectedNativeDocxEditor-CNQAMO2N.js.map → ConnectedNativeDocxEditor-X5R5WDIV.js.map} +1 -1
  17. package/dist/{ConnectedProductionSetDialog-ENAIZWPK.cjs → ConnectedProductionSetDialog-CNF6RZCU.cjs} +3 -3
  18. package/dist/{ConnectedProductionSetDialog-ENAIZWPK.cjs.map → ConnectedProductionSetDialog-CNF6RZCU.cjs.map} +1 -1
  19. package/dist/{ConnectedProductionSetDialog-O4FWTZNF.js → ConnectedProductionSetDialog-MVSRWQAH.js} +3 -3
  20. package/dist/{ConnectedProductionSetDialog-O4FWTZNF.js.map → ConnectedProductionSetDialog-MVSRWQAH.js.map} +1 -1
  21. package/dist/{ConnectedStreamedWordArtifact-BF6JET2D.cjs → ConnectedStreamedWordArtifact-G4NO45TW.cjs} +17 -17
  22. package/dist/ConnectedStreamedWordArtifact-G4NO45TW.cjs.map +1 -0
  23. package/dist/{ConnectedStreamedWordArtifact-ILMKFCDC.js → ConnectedStreamedWordArtifact-WY34LSU2.js} +16 -16
  24. package/dist/ConnectedStreamedWordArtifact-WY34LSU2.js.map +1 -0
  25. package/dist/{DocumentReviewCard-XB7BE7MZ.js → DocumentReviewCard-DBRWDHRF.js} +12 -12
  26. package/dist/{DocumentReviewCard-XB7BE7MZ.js.map → DocumentReviewCard-DBRWDHRF.js.map} +1 -1
  27. package/dist/{DocumentReviewCard-FSOBIVED.cjs → DocumentReviewCard-O2CPX6PY.cjs} +17 -17
  28. package/dist/{DocumentReviewCard-FSOBIVED.cjs.map → DocumentReviewCard-O2CPX6PY.cjs.map} +1 -1
  29. package/dist/{FilesViewerDialog-GEIQCBBK.cjs → FilesViewerDialog-3JCXOSI5.cjs} +40 -40
  30. package/dist/{FilesViewerDialog-GEIQCBBK.cjs.map → FilesViewerDialog-3JCXOSI5.cjs.map} +1 -1
  31. package/dist/{FilesViewerDialog-5PL3HGYO.js → FilesViewerDialog-7AHLHVDB.js} +34 -34
  32. package/dist/{FilesViewerDialog-5PL3HGYO.js.map → FilesViewerDialog-7AHLHVDB.js.map} +1 -1
  33. package/dist/{WorkspaceTableView-SX5FIC4C.js → WorkspaceTableView-4VRDGFGG.js} +7 -7
  34. package/dist/{WorkspaceTableView-SX5FIC4C.js.map → WorkspaceTableView-4VRDGFGG.js.map} +1 -1
  35. package/dist/{WorkspaceTableView-Y2GX5GB2.cjs → WorkspaceTableView-T2SIYAEM.cjs} +9 -9
  36. package/dist/{WorkspaceTableView-Y2GX5GB2.cjs.map → WorkspaceTableView-T2SIYAEM.cjs.map} +1 -1
  37. package/dist/agents/index.cjs +297 -297
  38. package/dist/agents/index.js +14 -14
  39. package/dist/{ai-WASSGEMI.js → ai-KXDTYRZC.js} +16 -16
  40. package/dist/ai-KXDTYRZC.js.map +1 -0
  41. package/dist/{ai-E6FA4Y4J.cjs → ai-QXZ4PB2M.cjs} +24 -24
  42. package/dist/ai-QXZ4PB2M.cjs.map +1 -0
  43. package/dist/calls/index.cjs +121 -121
  44. package/dist/calls/index.js +8 -8
  45. package/dist/chat/index.cjs +2 -2
  46. package/dist/chat/index.js +2 -2
  47. package/dist/{chunk-DZGLEEUT.cjs → chunk-2NAAK4NF.cjs} +4 -4
  48. package/dist/{chunk-DZGLEEUT.cjs.map → chunk-2NAAK4NF.cjs.map} +1 -1
  49. package/dist/{chunk-PIWT2GCY.cjs → chunk-2THO5FO3.cjs} +20 -20
  50. package/dist/{chunk-PIWT2GCY.cjs.map → chunk-2THO5FO3.cjs.map} +1 -1
  51. package/dist/{chunk-JAIMJTXQ.js → chunk-35M3UPTC.js} +71 -20
  52. package/dist/chunk-35M3UPTC.js.map +1 -0
  53. package/dist/{chunk-QVY5DH2R.js → chunk-3726GQUW.js} +17 -17
  54. package/dist/{chunk-QVY5DH2R.js.map → chunk-3726GQUW.js.map} +1 -1
  55. package/dist/{chunk-N77UYRV7.js → chunk-3BSFHBHY.js} +4 -4
  56. package/dist/{chunk-N77UYRV7.js.map → chunk-3BSFHBHY.js.map} +1 -1
  57. package/dist/{chunk-CRKWD7B5.cjs → chunk-3V7IZLHM.cjs} +28 -28
  58. package/dist/{chunk-CRKWD7B5.cjs.map → chunk-3V7IZLHM.cjs.map} +1 -1
  59. package/dist/{chunk-TP5PGWIO.cjs → chunk-4IOYQLKG.cjs} +3 -3
  60. package/dist/{chunk-TP5PGWIO.cjs.map → chunk-4IOYQLKG.cjs.map} +1 -1
  61. package/dist/{chunk-KGUBKE3V.cjs → chunk-4WJTJ2CM.cjs} +12 -12
  62. package/dist/{chunk-KGUBKE3V.cjs.map → chunk-4WJTJ2CM.cjs.map} +1 -1
  63. package/dist/{chunk-K2G2P66L.js → chunk-534Q6CX4.js} +3 -3
  64. package/dist/{chunk-K2G2P66L.js.map → chunk-534Q6CX4.js.map} +1 -1
  65. package/dist/{chunk-DBHBJIF4.js → chunk-55UIEU7L.js} +3 -3
  66. package/dist/{chunk-DBHBJIF4.js.map → chunk-55UIEU7L.js.map} +1 -1
  67. package/dist/{chunk-N52PBUAP.cjs → chunk-5VZVB63L.cjs} +6 -6
  68. package/dist/{chunk-N52PBUAP.cjs.map → chunk-5VZVB63L.cjs.map} +1 -1
  69. package/dist/{chunk-Y2FPWPDB.js → chunk-5XB3H2TJ.js} +3 -3
  70. package/dist/{chunk-Y2FPWPDB.js.map → chunk-5XB3H2TJ.js.map} +1 -1
  71. package/dist/{chunk-BQHTBUOA.js → chunk-62J727CD.js} +3 -3
  72. package/dist/{chunk-BQHTBUOA.js.map → chunk-62J727CD.js.map} +1 -1
  73. package/dist/{chunk-3PV25ICC.js → chunk-6KKVJ2V6.js} +3 -3
  74. package/dist/{chunk-3PV25ICC.js.map → chunk-6KKVJ2V6.js.map} +1 -1
  75. package/dist/{chunk-UYFWLP74.js → chunk-6PM2ZUUL.js} +14 -14
  76. package/dist/{chunk-UYFWLP74.js.map → chunk-6PM2ZUUL.js.map} +1 -1
  77. package/dist/{chunk-SYMZ6L3C.js → chunk-6Q3SYCSX.js} +4 -4
  78. package/dist/{chunk-SYMZ6L3C.js.map → chunk-6Q3SYCSX.js.map} +1 -1
  79. package/dist/{chunk-7Z5CSFYV.cjs → chunk-7HGIC644.cjs} +5 -5
  80. package/dist/{chunk-7Z5CSFYV.cjs.map → chunk-7HGIC644.cjs.map} +1 -1
  81. package/dist/{chunk-G4D4UGSW.cjs → chunk-7MGK4ROW.cjs} +4 -4
  82. package/dist/{chunk-G4D4UGSW.cjs.map → chunk-7MGK4ROW.cjs.map} +1 -1
  83. package/dist/{chunk-KUI2IC7W.js → chunk-7OUI4S7X.js} +3 -3
  84. package/dist/{chunk-KUI2IC7W.js.map → chunk-7OUI4S7X.js.map} +1 -1
  85. package/dist/{chunk-QN5GTCPB.cjs → chunk-BM2B6RWH.cjs} +6 -6
  86. package/dist/{chunk-QN5GTCPB.cjs.map → chunk-BM2B6RWH.cjs.map} +1 -1
  87. package/dist/{chunk-ASOPBELQ.js → chunk-C66RM2KW.js} +12 -12
  88. package/dist/{chunk-ASOPBELQ.js.map → chunk-C66RM2KW.js.map} +1 -1
  89. package/dist/{chunk-5OUOPKGE.cjs → chunk-C67B5OL7.cjs} +10 -10
  90. package/dist/{chunk-5OUOPKGE.cjs.map → chunk-C67B5OL7.cjs.map} +1 -1
  91. package/dist/{chunk-OG3TI5GX.js → chunk-CARVLLKR.js} +5 -5
  92. package/dist/{chunk-OG3TI5GX.js.map → chunk-CARVLLKR.js.map} +1 -1
  93. package/dist/{chunk-OSWKA2NQ.cjs → chunk-CJOYEXEI.cjs} +4 -4
  94. package/dist/{chunk-OSWKA2NQ.cjs.map → chunk-CJOYEXEI.cjs.map} +1 -1
  95. package/dist/{chunk-HKGO2GUG.cjs → chunk-CQ4M5S7Q.cjs} +3 -3
  96. package/dist/{chunk-HKGO2GUG.cjs.map → chunk-CQ4M5S7Q.cjs.map} +1 -1
  97. package/dist/{chunk-PGCKTXYH.js → chunk-E23QC3K5.js} +3 -3
  98. package/dist/{chunk-PGCKTXYH.js.map → chunk-E23QC3K5.js.map} +1 -1
  99. package/dist/{chunk-RAYNCZ7O.js → chunk-EAHJ2JSM.js} +4 -4
  100. package/dist/{chunk-RAYNCZ7O.js.map → chunk-EAHJ2JSM.js.map} +1 -1
  101. package/dist/{chunk-J3E5CSSC.js → chunk-ETUFJZKO.js} +4 -4
  102. package/dist/{chunk-J3E5CSSC.js.map → chunk-ETUFJZKO.js.map} +1 -1
  103. package/dist/{chunk-KVQ6O54R.cjs → chunk-FA5EFIHM.cjs} +55 -55
  104. package/dist/{chunk-KVQ6O54R.cjs.map → chunk-FA5EFIHM.cjs.map} +1 -1
  105. package/dist/{chunk-FDNIK5YS.cjs → chunk-GAJ5HESV.cjs} +4 -4
  106. package/dist/{chunk-FDNIK5YS.cjs.map → chunk-GAJ5HESV.cjs.map} +1 -1
  107. package/dist/{chunk-FNGFSHVE.js → chunk-H57PBOFE.js} +3 -3
  108. package/dist/{chunk-FNGFSHVE.js.map → chunk-H57PBOFE.js.map} +1 -1
  109. package/dist/{chunk-7OPOPYV6.cjs → chunk-H5OLHP2U.cjs} +3 -3
  110. package/dist/{chunk-7OPOPYV6.cjs.map → chunk-H5OLHP2U.cjs.map} +1 -1
  111. package/dist/{chunk-Y5P5ZMHQ.js → chunk-HFPKMVHR.js} +4 -4
  112. package/dist/{chunk-Y5P5ZMHQ.js.map → chunk-HFPKMVHR.js.map} +1 -1
  113. package/dist/{chunk-VJAMDAR6.cjs → chunk-I727LFZM.cjs} +4 -4
  114. package/dist/{chunk-VJAMDAR6.cjs.map → chunk-I727LFZM.cjs.map} +1 -1
  115. package/dist/{chunk-3RUQHIDC.js → chunk-IUOTGOXM.js} +3 -3
  116. package/dist/{chunk-3RUQHIDC.js.map → chunk-IUOTGOXM.js.map} +1 -1
  117. package/dist/{chunk-4LK74S7T.cjs → chunk-IUTJW6FB.cjs} +50 -50
  118. package/dist/{chunk-4LK74S7T.cjs.map → chunk-IUTJW6FB.cjs.map} +1 -1
  119. package/dist/{chunk-ZR4TH6DZ.js → chunk-JKAVXGHL.js} +5 -5
  120. package/dist/{chunk-ZR4TH6DZ.js.map → chunk-JKAVXGHL.js.map} +1 -1
  121. package/dist/{chunk-DDIV3MYQ.cjs → chunk-K3C4WECV.cjs} +5 -5
  122. package/dist/{chunk-DDIV3MYQ.cjs.map → chunk-K3C4WECV.cjs.map} +1 -1
  123. package/dist/{chunk-KXNC24EF.cjs → chunk-KYTOLFAU.cjs} +35 -35
  124. package/dist/{chunk-KXNC24EF.cjs.map → chunk-KYTOLFAU.cjs.map} +1 -1
  125. package/dist/{chunk-FMRTLPC7.cjs → chunk-LKK4PVOM.cjs} +6 -6
  126. package/dist/{chunk-FMRTLPC7.cjs.map → chunk-LKK4PVOM.cjs.map} +1 -1
  127. package/dist/{chunk-BMHW7WTF.js → chunk-LPHUB6EC.js} +3 -3
  128. package/dist/{chunk-BMHW7WTF.js.map → chunk-LPHUB6EC.js.map} +1 -1
  129. package/dist/{chunk-IIUEDF3F.js → chunk-LZAID6RY.js} +7 -7
  130. package/dist/{chunk-IIUEDF3F.js.map → chunk-LZAID6RY.js.map} +1 -1
  131. package/dist/{chunk-OFF2PR4W.js → chunk-NAAOKIR5.js} +3 -3
  132. package/dist/{chunk-OFF2PR4W.js.map → chunk-NAAOKIR5.js.map} +1 -1
  133. package/dist/{chunk-7LIPW6ZK.cjs → chunk-NNJQTH6R.cjs} +3 -3
  134. package/dist/{chunk-7LIPW6ZK.cjs.map → chunk-NNJQTH6R.cjs.map} +1 -1
  135. package/dist/{chunk-2VHZUSFW.js → chunk-OUORCDQD.js} +3 -3
  136. package/dist/{chunk-2VHZUSFW.js.map → chunk-OUORCDQD.js.map} +1 -1
  137. package/dist/{chunk-S3SWSAUB.cjs → chunk-OVKVMKTI.cjs} +15 -15
  138. package/dist/{chunk-S3SWSAUB.cjs.map → chunk-OVKVMKTI.cjs.map} +1 -1
  139. package/dist/{chunk-KCP42W67.cjs → chunk-P5D5GKVH.cjs} +3 -3
  140. package/dist/{chunk-KCP42W67.cjs.map → chunk-P5D5GKVH.cjs.map} +1 -1
  141. package/dist/{chunk-JS66ZT33.js → chunk-PVNULRFR.js} +3 -3
  142. package/dist/{chunk-JS66ZT33.js.map → chunk-PVNULRFR.js.map} +1 -1
  143. package/dist/{chunk-EIV4H2PZ.cjs → chunk-QZGXZRWU.cjs} +4 -4
  144. package/dist/{chunk-EIV4H2PZ.cjs.map → chunk-QZGXZRWU.cjs.map} +1 -1
  145. package/dist/{chunk-MMSHLHTA.cjs → chunk-RB6MAAS7.cjs} +4 -4
  146. package/dist/{chunk-MMSHLHTA.cjs.map → chunk-RB6MAAS7.cjs.map} +1 -1
  147. package/dist/{chunk-M6DTLHCN.js → chunk-RMQZHYBO.js} +6 -6
  148. package/dist/{chunk-M6DTLHCN.js.map → chunk-RMQZHYBO.js.map} +1 -1
  149. package/dist/{chunk-I6WRLTWU.js → chunk-S5AFXSIQ.js} +3 -3
  150. package/dist/{chunk-I6WRLTWU.js.map → chunk-S5AFXSIQ.js.map} +1 -1
  151. package/dist/{chunk-SY2WD6VA.cjs → chunk-SBTIITBJ.cjs} +6 -6
  152. package/dist/{chunk-SY2WD6VA.cjs.map → chunk-SBTIITBJ.cjs.map} +1 -1
  153. package/dist/{chunk-COCZMF7B.cjs → chunk-TBYFNJRJ.cjs} +27 -27
  154. package/dist/{chunk-COCZMF7B.cjs.map → chunk-TBYFNJRJ.cjs.map} +1 -1
  155. package/dist/{chunk-DGOVO2QO.cjs → chunk-TSIMQOJR.cjs} +126 -75
  156. package/dist/chunk-TSIMQOJR.cjs.map +1 -0
  157. package/dist/{chunk-GARDQALH.js → chunk-TSLXIDUF.js} +7 -7
  158. package/dist/{chunk-GARDQALH.js.map → chunk-TSLXIDUF.js.map} +1 -1
  159. package/dist/{chunk-6KQVTMRL.cjs → chunk-UOGXKHTJ.cjs} +3 -3
  160. package/dist/{chunk-6KQVTMRL.cjs.map → chunk-UOGXKHTJ.cjs.map} +1 -1
  161. package/dist/{chunk-NTXO6IYE.js → chunk-UTUXEZBC.js} +3 -3
  162. package/dist/{chunk-NTXO6IYE.js.map → chunk-UTUXEZBC.js.map} +1 -1
  163. package/dist/{chunk-2UP73FZT.js → chunk-VNFNIHHJ.js} +3 -3
  164. package/dist/{chunk-2UP73FZT.js.map → chunk-VNFNIHHJ.js.map} +1 -1
  165. package/dist/{chunk-M4TM3K52.cjs → chunk-XCTQ6MLJ.cjs} +47 -47
  166. package/dist/{chunk-M4TM3K52.cjs.map → chunk-XCTQ6MLJ.cjs.map} +1 -1
  167. package/dist/{chunk-SOY6UUFS.js → chunk-Y3NQBB43.js} +3 -3
  168. package/dist/{chunk-SOY6UUFS.js.map → chunk-Y3NQBB43.js.map} +1 -1
  169. package/dist/{chunk-LWCLAAEX.js → chunk-YG77JLOX.js} +4 -4
  170. package/dist/{chunk-LWCLAAEX.js.map → chunk-YG77JLOX.js.map} +1 -1
  171. package/dist/{chunk-35BADIIF.cjs → chunk-YGOMTIBA.cjs} +3 -3
  172. package/dist/{chunk-35BADIIF.cjs.map → chunk-YGOMTIBA.cjs.map} +1 -1
  173. package/dist/{chunk-4FV5DO3V.js → chunk-YK4U6EV5.js} +3 -3
  174. package/dist/{chunk-4FV5DO3V.js.map → chunk-YK4U6EV5.js.map} +1 -1
  175. package/dist/{chunk-YPTZNQPJ.cjs → chunk-YP4FDWK3.cjs} +4 -4
  176. package/dist/{chunk-YPTZNQPJ.cjs.map → chunk-YP4FDWK3.cjs.map} +1 -1
  177. package/dist/{chunk-JNVJQCGF.cjs → chunk-YXYHYS5S.cjs} +3 -3
  178. package/dist/{chunk-JNVJQCGF.cjs.map → chunk-YXYHYS5S.cjs.map} +1 -1
  179. package/dist/collaboration/index.cjs +1 -1
  180. package/dist/collaboration/index.js +1 -1
  181. package/dist/connect/docx.cjs +20 -20
  182. package/dist/connect/docx.js +16 -16
  183. package/dist/connect/index.cjs +1022 -1022
  184. package/dist/connect/index.js +76 -76
  185. package/dist/connect/viewer.cjs +26 -26
  186. package/dist/connect/viewer.js +25 -25
  187. package/dist/dashboards/index.cjs +1 -1
  188. package/dist/dashboards/index.js +1 -1
  189. package/dist/embed/index.cjs +39 -39
  190. package/dist/embed/index.js +33 -33
  191. package/dist/files/index.cjs +225 -225
  192. package/dist/files/index.js +4 -4
  193. package/dist/index.cjs +1577 -1577
  194. package/dist/index.js +42 -42
  195. package/dist/settings/index.cjs +152 -152
  196. package/dist/settings/index.js +3 -3
  197. package/dist/shell/index.cjs +88 -88
  198. package/dist/shell/index.js +9 -9
  199. package/dist/studio/index.cjs +26 -26
  200. package/dist/studio/index.js +23 -23
  201. package/dist/workflow-canvas/index.cjs +52 -52
  202. package/dist/workflow-canvas/index.js +32 -32
  203. package/node_modules/@arbidocs/coedit/package.json +1 -1
  204. package/package.json +5 -5
  205. package/dist/ConnectedStreamedWordArtifact-BF6JET2D.cjs.map +0 -1
  206. package/dist/ConnectedStreamedWordArtifact-ILMKFCDC.js.map +0 -1
  207. package/dist/ai-E6FA4Y4J.cjs.map +0 -1
  208. package/dist/ai-WASSGEMI.js.map +0 -1
  209. package/dist/chunk-DGOVO2QO.cjs.map +0 -1
  210. package/dist/chunk-JAIMJTXQ.js.map +0 -1
@@ -1,11 +1,11 @@
1
1
  "use client";
2
- import { useWorkflowTasks, useWorkflowDefinitions, useHostSkills, useUsableSkillListings, useSkillsEnabled, useNamedWorkflows, hostSkillItem, useCanBrowseSkills } from './chunk-DBHBJIF4.js';
3
- import { ConnectedWorkflowLauncher } from './chunk-BMHW7WTF.js';
4
- import { GENERATE_IMAGE_ID, IMAGE_ASPECT_AUTO, deriveAnnotationName, ANNOTATE_ID, recordWorkflowUse, renderWorkflowIcon, isSkillPackWorkflow } from './chunk-ZLIQ5Q2J.js';
5
- import { documentScopeLabels, matchWorkflowScope } from './chunk-J3E5CSSC.js';
6
- import { useHost } from './chunk-BH4MK2J5.js';
2
+ import { useWorkflowTasks, useWorkflowDefinitions, useHostSkills, useUsableSkillListings, useSkillsEnabled, useNamedWorkflows, hostSkillItem, useCanBrowseSkills } from './chunk-55UIEU7L.js';
3
+ import { ConnectedWorkflowLauncher } from './chunk-LPHUB6EC.js';
7
4
  import { buildSlashItems, parseSlashTokenInProgress, filterSlashItems } from './chunk-RYAOJXNH.js';
5
+ import { GENERATE_IMAGE_ID, IMAGE_ASPECT_AUTO, deriveAnnotationName, ANNOTATE_ID, recordWorkflowUse, renderWorkflowIcon, isSkillPackWorkflow } from './chunk-ZLIQ5Q2J.js';
6
+ import { documentScopeLabels, matchWorkflowScope } from './chunk-ETUFJZKO.js';
8
7
  import { composeWorkflowPrompt, mergeSkillWorkflows, isEmptyWorkflowScope, promptFieldName } from './chunk-ECYOIRXR.js';
8
+ import { useHost } from './chunk-BH4MK2J5.js';
9
9
  import { useBlocksEnvironment } from './chunk-YUHSDOPW.js';
10
10
  import { buildRetrievalFullContextTool, buildRetrievalChunkTool } from '@arbidocs/sdk/browser';
11
11
  import { useDocuments, useTags, useCreateTag, useUpdateTag, useGenerateDocTags, useApplyChatModel, useArbiSessionStore, useBuiltinCommands } from '@arbidocs/react';
@@ -394,5 +394,5 @@ function skillItems(builtinSkills, listings) {
394
394
  }
395
395
 
396
396
  export { ConnectedWorkflowStart, PROMPT_BINDINGS, parseTypedSkill, useLaunchWorkflow, useSlashItems, useSlashMenuItems, useSlashSkillWorkflows };
397
- //# sourceMappingURL=chunk-GARDQALH.js.map
398
- //# sourceMappingURL=chunk-GARDQALH.js.map
397
+ //# sourceMappingURL=chunk-TSLXIDUF.js.map
398
+ //# sourceMappingURL=chunk-TSLXIDUF.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/connection/workflows/launch-bindings.ts","../src/connection/workflows/useLaunchWorkflow.ts","../src/connection/workflows/ConnectedWorkflowStart.tsx","../src/connection/workflows/useSlashSkillWorkflows.tsx","../src/connection/conversation/useSlashItems.ts"],"names":["useCallback","useTags","useMemo","text","jsx","useBuiltinCommands"],"mappings":";;;;;;;;;;;;;;;AAw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CAAE,IAAA,EAAM,CAAC,CAAC,CAAC,CAAA;AACxD,EAAA,OAAO;AAAA,IACL,GAAG,IAAA,CAAK,GAAA,CAAI,CAAC,CAAA,MAAsB;AAAA,MACjC,MAAM,CAAA,CAAE,EAAA;AAAA,MACR,aAAa,CAAA,CAAE,WAAA;AAAA,MACf,OAAA,EAAS,CAAA,CAAE,MAAA,CAAO,CAAC,GAAG,KAAA,IAAS,EAAA;AAAA,MAC/B,UAAA,EAAY,QAAA;AAAA,MACZ,IAAA,EAAM;AAAA,KACR,CAAE,CAAA;AAAA,IACF,GAAG,MAAA,CAAO,GAAA,CAAI,CAAC,CAAA,KAAqB;AAClC,MAAA,MAAM,CAAA,GAAI,OAAA,CAAQ,GAAA,CAAI,CAAA,CAAE,EAAE,CAAA;AAC1B,MAAA,OAAO;AAAA,QACL,MAAM,CAAA,CAAE,EAAA;AAAA,QACR,WAAA,EAAa,GAAG,WAAA,KAAgB,CAAA,CAAE,UAAU,CAAA,CAAE,EAAA,GAAK,EAAE,KAAA,GAAQ,EAAA,CAAA;AAAA,QAC7D,OAAA,EAAS,GAAG,QAAA,IAAY,EAAA;AAAA,QACxB,UAAA,EAAY,CAAA,EAAG,UAAA,KAAe,QAAA,GAAW,QAAA,GAAW,MAAA;AAAA,QACpD,IAAA,EAAM;AAAA,OACR;AAAA,IACF,CAAC;AAAA,GACH;AACF","file":"chunk-GARDQALH.js","sourcesContent":["/**\n * Host bindings of prompt workflows that need more than words on send. Bound by workflow id, the\n * same way the annotation operation is: blocks and the registry stay declarative, and the one\n * place that knows the wire shape is here.\n *\n * Generate image: the reference images and the aspect ratio ride structured tool arguments\n * (`retrieval_full_context` over every reference, `image_generation.aspect_ratio`), never the\n * prompt text: the image model does not reliably honour a shape or sources worded into the prompt,\n * and the references go to the separate image model in its own request, so (unlike the app's\n * one-at-a-time pinned document) several of them do not compound against the agent's context.\n */\n\nimport type { WorkflowInputs, WorkflowScope } from '../../agents/workflows/types'\nimport { buildRetrievalChunkTool, buildRetrievalFullContextTool } from '@arbidocs/sdk/browser'\nimport type { TurnTools } from '@arbidocs/react'\nimport { GENERATE_IMAGE_ID, IMAGE_ASPECT_AUTO } from '../../agents/workflows/catalogue/seed'\n\nexport interface PromptBinding {\n /** Attach the scoped files to the chat (default true). Off when the files are tool inputs. */\n attachScope: boolean\n /** Structured tools for the one send, from the form's inputs. */\n tools?: (inputs: WorkflowInputs) => TurnTools\n}\n\nconst referencesOf = (inputs: WorkflowInputs): string[] => {\n const value = inputs.references as WorkflowScope | undefined\n return value?.documents ?? []\n}\n\nexport const PROMPT_BINDINGS: Record<string, PromptBinding> = {\n [GENERATE_IMAGE_ID]: {\n attachScope: false,\n tools: (inputs) => {\n const aspectRatio = typeof inputs.aspect_ratio === 'string' ? inputs.aspect_ratio : ''\n return {\n retrieval_chunk: buildRetrievalChunkTool([]),\n retrieval_full_context: buildRetrievalFullContextTool(referencesOf(inputs)),\n ...(aspectRatio && aspectRatio !== IMAGE_ASPECT_AUTO\n ? {\n image_generation: {\n name: 'image_generation' as const,\n description: 'image generation',\n tool_args: { aspect_ratio: aspectRatio },\n tool_responses: {},\n },\n }\n : {}),\n }\n },\n },\n}\n","/**\n * The host side of the launch contract: `onLaunch({workflow, inputs, scope, agentId})`.\n *\n * Blocks only say WHAT to run; this performs it, so workspace isolation stays host-side:\n *\n * - prompt workflow, my assistant: open a fresh chat (or stay in this one when `inPlace`), scope\n * its documents, set the composed draft and ask for it to be sent (`autoSendDraft`). The host's\n * send waits for the new chat's documents to be seeded, so a scoped run is never sent with the\n * wrong files. Order matters: `openNewConversation` resets the draft, so it is set after it.\n * - prompt workflow, another agent: a run-now task assigned to that agent (the interactive chat\n * query has no agent parameter), created through the same path as the task composer.\n * - operation workflow (tier B): the handler bound to its id (annotation).\n * - a workflow's own model becomes the chat's (`useApplyChatModel`).\n *\n * The prompt is composed in exactly one place: `composeWorkflowPrompt(workflow, inputs)`.\n */\n\nimport {\n useApplyChatModel,\n useArbiSessionStore,\n useCreateTag,\n useDocuments,\n useGenerateDocTags,\n useTags,\n useUpdateTag,\n} from '@arbidocs/react'\nimport { getDocumentTitle } from '@arbidocs/react/ui'\nimport { useCallback, useMemo } from 'react'\nimport { composeWorkflowPrompt, isEmptyWorkflowScope } from '../../agents/workflows/workflow'\nimport { documentScopeLabels, matchWorkflowScope } from '../../agents/workflows/workspaceScope'\nimport {\n type WorkflowInputs,\n type WorkflowLanding,\n type WorkflowLaunch,\n} from '../../agents/workflows/types'\nimport { deriveAnnotationName } from '../../agents/workflows/catalogue/annotation-name'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { PROMPT_BINDINGS } from './launch-bindings'\nimport { ANNOTATE_ID } from '../../agents/workflows/catalogue/seed'\nimport { useWorkflowTasks } from './useWorkflowTasks'\nimport { recordWorkflowUse } from '../../agents/workflows/catalogue/workflow-usage'\n\nexport interface UseLaunchWorkflowOptions {\n /**\n * Where launches from this surface land, over each workflow's own default. The empty chat and\n * the slash menu send into the conversation on screen (`current-chat`); everything else opens a\n * fresh one. A single launch can still override it (`WorkflowLaunch.landing`).\n */\n landing?: WorkflowLanding\n /**\n * A prompt run on the user's own assistant is sent here instead of through the session's draft:\n * the surface's own chat (`ChatPage`) or its own ask (the document ask). Everything else is the\n * same: the file scope, the workflow's model and its bound tools are set on the session in scope\n * (before a send in place, after a send that opens a fresh chat), so the turn carries them.\n */\n send?: (prompt: string) => void\n}\n\nconst text = (inputs: WorkflowInputs, name: string): string => {\n const v = inputs[name]\n return typeof v === 'string' ? v.trim() : ''\n}\n\nexport function useLaunchWorkflow({\n landing: surfaceLanding,\n send,\n}: UseLaunchWorkflowOptions = {}) {\n const { data: documents = [] } = useDocuments()\n const { data: workspaceTags = [] } = useTags()\n const tags = useMemo(() => documentScopeLabels(workspaceTags), [workspaceTags])\n const createTag = useCreateTag()\n const updateTag = useUpdateTag()\n const generate = useGenerateDocTags()\n const { create: createTask } = useWorkflowTasks()\n const applyModel = useApplyChatModel()\n const session = useArbiSessionStore()\n const { notify, openFiles, openNewConversation } = useBlocksEnvironment()\n\n /** Annotation: create (or reuse) the label, start the AI run, land on Files filtered to the set. */\n const annotate = useCallback(\n async ({ inputs, scope }: WorkflowLaunch) => {\n const description = text(inputs, 'description')\n const name = text(inputs, 'name') || deriveAnnotationName(description)\n const matching = matchWorkflowScope(documents, scope)\n if (!name || !description || matching.length === 0) return\n try {\n // A same-named label is reused rather than duplicated, the rule the Files page's\n // label-creation paths follow.\n const existing = tags.find((t) => t.name.toLowerCase() === name.toLowerCase())\n let tagId: string\n if (existing) {\n tagId = existing.external_id\n await updateTag.mutateAsync({\n tagId: tagId,\n change: { instruction: description },\n })\n } else {\n const created = await createTag.mutateAsync({\n name,\n tagType: { type: 'text', options: [] },\n shared: true,\n instruction: description,\n })\n const createdId = (created as { external_id?: string } | undefined)?.external_id\n if (!createdId) throw new Error('tag create returned no id')\n tagId = createdId\n }\n const docIds = matching.map((d) => d.external_id)\n // overwrite=true so a re-run on an existing field refreshes stale values, matching the\n // Files page's default review behaviour.\n await generate.mutateAsync({ tagIds: [tagId], docIds: docIds, overwrite: true })\n // Land on Files with those documents selected and the view narrowed to the annotated set\n // through the same tri-state quick filter the pickers write to. An empty scope selected\n // every file, so no filter is applied.\n const filters: Record<string, 'include'> = {}\n scope.folders.forEach((folder) => {\n filters[folder === '' ? 'folder:none' : `folder:${folder}`] = 'include'\n })\n scope.labels.forEach((labelId) => {\n filters[labelId] = 'include'\n })\n openFiles({ select: docIds, filters })\n } catch (error) {\n notify('Could not start the annotation', 'error')\n throw error\n }\n },\n [documents, tags, createTag, updateTag, generate, openFiles, notify]\n )\n\n return useCallback(\n async (launch: WorkflowLaunch) => {\n const { workflow, inputs, scope, agentId } = launch\n if (workflow.run.kind === 'operation') {\n if (workflow.id === ANNOTATE_ID) {\n await annotate(launch)\n recordWorkflowUse(workflow.id)\n return\n }\n throw new Error(`No host handler for workflow \"${workflow.id}\"`)\n }\n\n // Names for the wording: a `documents` field quotes the files it picked.\n const documentTitles = Object.fromEntries(\n documents.map((d) => [d.external_id, getDocumentTitle(d, d.external_id)])\n )\n const prompt = composeWorkflowPrompt(workflow, inputs, { documentTitles })\n if (!prompt) return\n recordWorkflowUse(workflow.id)\n\n if (agentId) {\n try {\n const created = await createTask({\n workflow,\n values: {\n assignee: 'agent',\n workflowId: workflow.id,\n inputs,\n when: 'now',\n runAt: '',\n rrule: '',\n timezone: 'UTC',\n eventKind: '',\n afterTaskId: '',\n parentTaskId: '',\n shared: true,\n description: '',\n dueAt: '',\n agentId,\n name: '',\n notifyOnComplete: true,\n access: 'ask_each_run',\n },\n })\n const ran = created.kind === 'work' ? created.ran : null\n const title = created.kind === 'work' ? created.task.title : created.workflow.name\n notify(\n ran === false\n ? 'Task created, but the run could not start'\n : `Running \\u201c${title ?? workflow.title}\\u201d`,\n ran === false ? 'warning' : 'success'\n )\n } catch (error) {\n notify(\n error instanceof Error && error.message.startsWith('Open a workspace')\n ? error.message\n : 'Could not start the run',\n 'error'\n )\n throw error\n }\n return\n }\n\n const landing = launch.landing ?? surfaceLanding ?? workflow.landing\n const inPlace = landing === 'current-chat'\n const binding = PROMPT_BINDINGS[workflow.id]\n /** The run's setup on the session in scope: its file scope, its model, its bound tools. */\n const prepare = () => {\n // Scope the chat to the chosen files when a restriction was made; otherwise the\n // workspace's usual \"all documents\" attachment (useDocumentAutoAdd) applies.\n if (binding?.attachScope !== false && !isEmptyWorkflowScope(scope)) {\n const ids = matchWorkflowScope(documents, scope).map((d) => d.external_id)\n if (ids.length > 0) {\n session.setConversationDocuments(\n inPlace ? (session.getState().conversationId ?? 'new') : 'new',\n ids.map((docId) => ({ docId, isPinned: false }))\n )\n }\n }\n if (workflow.model) void applyModel(workflow.model, `Workflow - ${workflow.title}`)\n // The tools ride the next send of the session in scope.\n session.setPendingTools(binding?.tools?.(inputs) ?? null)\n }\n // A fresh chat's reset clears the draft and the model, so the setup follows it. A surface\n // with its own send sends in its chat (set up first) or opens a fresh one (set up after).\n if (send) {\n if (inPlace) prepare()\n send(prompt)\n if (!inPlace) prepare()\n return\n }\n if (!inPlace) openNewConversation()\n prepare()\n session.setDraft(prompt)\n session.setAutoSendDraft(true)\n },\n [\n annotate,\n applyModel,\n createTask,\n documents,\n surfaceLanding,\n session,\n notify,\n openNewConversation,\n send,\n ]\n )\n}\n","/**\n * The workflow launcher, wired to run what it launches: `ConnectedWorkflowLauncher` (the\n * workspace's files behind scope and file fields, the user's agents behind \"Run as\") with the one\n * launch handler (`useLaunchWorkflow`), the host's upload dialog for adding files\n * (`environment.openUpload`), and the touches of the annotation operation (its derived name and\n * overwrite warning, \"Annotate N documents\").\n *\n * The dashboard's Start band, Files (\"Create new\") and, headless, the slash menu use it.\n */\n\nimport { useTags } from '@arbidocs/react'\nimport { useCallback, useMemo, type ReactNode } from 'react'\nimport { TriangleAlert } from 'lucide-react'\nimport { documentScopeLabels } from '../../agents/workflows/workspaceScope'\nimport {\n type WorkflowDefinition,\n type WorkflowField,\n type WorkflowInputs,\n type WorkflowLanding,\n} from '../../agents/workflows/types'\nimport { ConnectedWorkflowLauncher } from '../ConnectedWorkflowLauncher'\nimport { type StartTile } from '../../home/StartTiles'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useHost } from '../../provider/host'\nimport { deriveAnnotationName } from '../../agents/workflows/catalogue/annotation-name'\nimport { ANNOTATE_ID, renderWorkflowIcon } from '../../agents/workflows/catalogue/seed'\nimport { useLaunchWorkflow } from './useLaunchWorkflow'\n\n// The agent picker names the person it hands the work to: the default \"Run as\" / \"My assistant\"\n// copy did not say who an assistant is.\nconst AGENT_LABELS = { label: 'Who this runs for', myAssistant: 'Me (your own assistant)' }\n\nexport interface ConnectedWorkflowStartProps {\n workflows: WorkflowDefinition[]\n /** Which of `workflows` get a tile (a filtered or capped view). */\n tileWorkflows?: WorkflowDefinition[]\n /** Render the Start band (off when another surface opens the dialog). */\n showTiles?: boolean\n caption?: string\n captionTestId?: string\n testId?: string\n /** Plain tiles appended to the band (e.g. the \"Create a file\" menu). */\n extraTiles?: StartTile[]\n /** Controlled open workflow id. */\n activeId?: string | null\n onActiveIdChange?: (id: string | null) => void\n initialInputsFor?: (workflow: WorkflowDefinition) => Partial<WorkflowInputs> | undefined\n /** Where launches land, over each workflow's default (`current-chat` = the chat on screen). */\n landing?: WorkflowLanding\n /** A prompt run's own send (a chat that is not the session's conversation). See `useLaunchWorkflow`. */\n send?: (prompt: string) => void\n /** The host's own \"Add\" control, offered when a workflow needs files and there are none. */\n addFilesAction?: ReactNode\n tileTestId?: (workflow: WorkflowDefinition) => string | undefined\n disabledReason?: (workflow: WorkflowDefinition) => string | undefined\n}\n\nexport function ConnectedWorkflowStart({\n workflows,\n landing,\n send,\n addFilesAction,\n ...rest\n}: ConnectedWorkflowStartProps) {\n const onLaunch = useLaunchWorkflow({ landing, send })\n // The host's icons first (a skill pack names its own), then the kit's, then the skill icon.\n const hostIcon = useHost().workflows?.renderIcon\n const renderIcon = useCallback(\n (key: string) => hostIcon?.(key) ?? renderWorkflowIcon(key) ?? renderWorkflowIcon('skill'),\n [hostIcon]\n )\n const { openUpload } = useBlocksEnvironment()\n const { data: workspaceTags = [] } = useTags()\n const tags = useMemo(() => documentScopeLabels(workspaceTags), [workspaceTags])\n\n // The annotation's name is optional: left blank it is taken from the question, which the\n // field's placeholder shows before anything runs.\n const fieldPlaceholder = useCallback(\n (field: WorkflowField, inputs: WorkflowInputs, workflow: WorkflowDefinition) => {\n if (workflow.id !== ANNOTATE_ID || field.name !== 'name') return undefined\n const derived = deriveAnnotationName(String(inputs.description ?? ''))\n return derived ? `Otherwise “${derived}”` : 'Taken from the description'\n },\n []\n )\n\n return (\n <ConnectedWorkflowLauncher\n {...rest}\n workflows={workflows}\n onLaunch={onLaunch}\n renderIcon={renderIcon}\n onAddFiles={openUpload}\n agentLabels={AGENT_LABELS}\n addFilesAction={addFilesAction}\n fieldPlaceholder={fieldPlaceholder}\n submitLabel={({ workflow, matchedCount }) =>\n workflow.id === ANNOTATE_ID && matchedCount !== null\n ? `Annotate ${matchedCount} document${matchedCount !== 1 ? 's' : ''}`\n : undefined\n }\n renderNotice={({ workflow, inputs }) => {\n if (workflow.id !== ANNOTATE_ID) return null\n // A same-named label is reused: warn that this overwrites its stored description and the\n // cell values for the selected documents.\n const name =\n String(inputs.name ?? '').trim() || deriveAnnotationName(String(inputs.description ?? ''))\n const existing = name\n ? tags.find((t) => t.name.toLowerCase() === name.toLowerCase())\n : undefined\n if (!existing) return null\n return (\n <div\n className=\"flex items-start gap-2 rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-sm text-amber-800 dark:text-amber-200\"\n role=\"status\"\n data-testid=\"workflow-existing-label-warning\"\n >\n <TriangleAlert className=\"mt-0.5 size-4 shrink-0 text-amber-500\" />\n <span>\n An annotation called <span className=\"font-medium\">{existing.name}</span> already\n exists. Annotating will overwrite its description and the current cell values for the\n selected files.\n </span>\n </div>\n )\n }}\n />\n )\n}\n","/**\n * Slash skills are launched prompt-first, through the one workflow launcher.\n *\n * A skill (or a prompt-style built-in such as Deep research) is run WITH a prompt, so it never\n * just executes:\n * - picking it in the slash menu opens its form (the prompt field first, focused, required);\n * - typing `/slug` and pressing Enter opens the same form with the field empty;\n * - typing `/slug some text` and pressing Enter opens it with the text already in the field.\n * The rule is the same for any recognised skill slug as the FIRST token of the draft; a backend\n * command (`/goal`, `/compact`, ...) is never a skill and is sent as typed. Nothing is sent from\n * the composer until the user starts it in the form. Without skills enabled (`show_skills`) this\n * applies to the host's skill packs only (`host.workflows.skillPacks`): the menu lists no other\n * skills and any other `/text` is sent as typed.\n *\n * The run lands where the surface says (`landing`), through the one launch handler. A chat that\n * is not the session's conversation (`ChatPage`, the document ask) passes `send`: the composed\n * prompt then goes to its own send, as a typed message would.\n */\n\nimport { useCallback, useMemo, useState, type ReactNode } from 'react'\nimport { promptFieldName } from '../../agents/workflows/workflow'\nimport { isSkillPackWorkflow } from '../../agents/workflows/skillPack'\nimport { type SlashMenuItem } from '../../chat/SlashMenu'\nimport {\n type WorkflowDefinition,\n type WorkflowInputs,\n type WorkflowLanding,\n} from '../../agents/workflows/types'\nimport { useBuiltinCommands } from '@arbidocs/react'\nimport { ConnectedWorkflowStart } from './ConnectedWorkflowStart'\nimport { useWorkflowDefinitions } from './useWorkflowDefinitions'\n\n/** `/slug` or `/slug rest of the line`: the first token and the text after it. */\nconst TYPED_SKILL = /^\\s*\\/([a-zA-Z0-9][a-zA-Z0-9_-]*)(?:\\s+([\\s\\S]*))?$/\n\n/** What the typed draft names: its slug (lower-cased) and the text after it (trimmed). */\nexport function parseTypedSkill(draft: string): { slug: string; text: string } | null {\n const m = TYPED_SKILL.exec(draft)\n return m ? { slug: m[1].toLowerCase(), text: (m[2] ?? '').trim() } : null\n}\n\n/**\n * Whether a skill opens its form from a menu (the `/` menus, the command palette): a prompt skill,\n * and with skills switched off (`show_skills`) only the host's packs. The one gate both share.\n */\nexport function canOpenSkill(workflow: WorkflowDefinition, skillsEnabled: boolean): boolean {\n return workflow.run.kind === 'prompt' && (skillsEnabled || isSkillPackWorkflow(workflow))\n}\n\nexport interface UseSlashSkillWorkflowsOptions {\n landing: WorkflowLanding\n /** Where the composed prompt goes, for a chat that is not the session's conversation. */\n send?: (prompt: string) => void\n}\n\nexport function useSlashSkillWorkflows({ landing, send }: UseSlashSkillWorkflowsOptions): {\n /** Opens the launcher for a picked menu item. True when it did (the caller then clears the draft). */\n openFor: (item: SlashMenuItem) => boolean\n /**\n * Opens the launcher for a typed `/slug text` draft, text pre-filled. True when the draft names\n * a skill (the caller then clears the draft and sends nothing).\n */\n openForDraft: (draft: string) => boolean\n /**\n * Opens the launcher for a skill by id (a surface listing the skills itself, the command\n * palette). True when it is a skill this person may run here.\n */\n openSkill: (id: string) => boolean\n /** The skills this person may open here: the host's packs, and the rest with `show_skills`. */\n openable: WorkflowDefinition[]\n /** Render once, anywhere in the surface that hosts the slash menu. */\n launcher: ReactNode\n} {\n const { skills, skillsEnabled } = useWorkflowDefinitions()\n const { commands } = useBuiltinCommands()\n const [active, setActive] = useState<{ id: string; text: string } | null>(null)\n\n // Stable while the lists are, so a surface can memoise what it builds on them.\n const open = useCallback(\n (workflow: WorkflowDefinition | undefined, text: string): boolean => {\n if (!workflow || !canOpenSkill(workflow, skillsEnabled)) return false\n setActive({ id: workflow.id, text })\n return true\n },\n [skillsEnabled]\n )\n\n const openFor = useCallback(\n (item: SlashMenuItem): boolean =>\n item.kind === 'skill' &&\n open(\n skills.find((w) => w.id === item.name),\n ''\n ),\n [open, skills]\n )\n\n const openSkill = useCallback(\n (id: string): boolean =>\n open(\n skills.find((w) => w.id === id),\n ''\n ),\n [open, skills]\n )\n\n const openable = useMemo(\n () => skills.filter((w) => canOpenSkill(w, skillsEnabled)),\n [skills, skillsEnabled]\n )\n\n const openForDraft = useCallback(\n (draft: string): boolean => {\n const typed = parseTypedSkill(draft)\n if (!typed) return false\n // A backend command wins a name collision, as in the menu: it is sent as typed.\n if (commands.some((c) => c.name.toLowerCase() === typed.slug)) return false\n return open(\n skills.find((w) => w.id.toLowerCase() === typed.slug),\n typed.text\n )\n },\n [open, skills, commands]\n )\n\n // Mounted only while a workflow is open: the ask bar lives in every page's topbar, so the\n // launcher's data hooks (files, agents, tasks) must not run until it is needed.\n const launcher = useMemo(() => {\n if (active === null) return null\n const initialInputsFor = (\n workflow: WorkflowDefinition\n ): Partial<WorkflowInputs> | undefined => {\n const field = promptFieldName(workflow)\n return field && active.text ? { [field]: active.text } : undefined\n }\n return (\n <ConnectedWorkflowStart\n workflows={skills}\n showTiles={false}\n landing={landing}\n send={send}\n activeId={active.id}\n onActiveIdChange={(id) => id === null && setActive(null)}\n initialInputsFor={initialInputsFor}\n />\n )\n }, [active, skills, landing, send])\n\n return { openFor, openForDraft, openSkill, openable, launcher }\n}\n","/**\n * The slash menu's data, in one place for every surface that hosts it (the chat composers, the\n * workspace ask bar, the document ask and `ChatPage`): the backend's built-in commands, the host's\n * skill packs and the user's skills, filtered by the slash token in progress. Commands and the\n * user's skills are typed `/<slug>` and dispatched by the backend; a skill opens its form\n * (`useSlashSkillWorkflows`).\n */\n\nimport { useMemo } from 'react'\nimport { useBuiltinCommands } from '@arbidocs/react'\nimport type { SlashMenuItem } from '../../chat/SlashMenu'\nimport { buildSlashItems, filterSlashItems, parseSlashToken } from '../../chat/slash-menu-helpers'\nimport { mergeSkillWorkflows } from '../../agents/workflows/workflow'\nimport type { WorkflowDefinition } from '../../agents/workflows/types'\nimport { useCanBrowseSkills, useSkillsEnabled } from '../workflows/useSkillsEnabled'\nimport { hostSkillItem, useHostSkills } from '../workflows/useHostSkills'\nimport { useUsableSkillListings } from '../workflows/useWorkflowDefinitions'\nimport { useNamedWorkflows } from '../workflows/useNamedWorkflows'\n\nconst NO_SKILLS: ReadonlyArray<WorkflowDefinition> = []\n\n/**\n * Every row of the menu, unfiltered: commands, then the host's packs (always: the host offers\n * them), then, for skills users (`show_skills`), the built-in skills and the user's own.\n *\n * @param builtinSkills The built-in skills to offer (prompt workflows offered as `/slug`), for a\n * surface that can open their form; default none.\n */\nexport function useSlashMenuItems(builtinSkills: ReadonlyArray<WorkflowDefinition> = NO_SKILLS): {\n items: SlashMenuItem[]\n /** The menu's \"Browse all\" footer opens the Skills browser: skills users, never guests. */\n canBrowseSkills: boolean\n} {\n const hostSkills = useHostSkills()\n const listings = useUsableSkillListings(hostSkills)\n const skillsEnabled = useSkillsEnabled()\n const { commands } = useBuiltinCommands()\n const builtins = useNamedWorkflows(builtinSkills)\n const items = useMemo<SlashMenuItem[]>(() => {\n const packSlugs = new Set(hostSkills.map((w) => w.id))\n return buildSlashItems(\n commands.map((c) => ({\n name: c.name,\n description: c.description,\n argHint: c.arg_hint,\n kind: 'command' as const,\n })),\n [\n ...hostSkills.map(hostSkillItem),\n ...(skillsEnabled\n ? skillItems(\n builtins.filter((w) => !packSlugs.has(w.id)),\n listings\n )\n : []),\n ]\n )\n }, [commands, hostSkills, listings, skillsEnabled, builtins])\n return { items, canBrowseSkills: useCanBrowseSkills() }\n}\n\n/**\n * @param text The draft.\n * @param builtinSkills The built-in skills (prompt workflows offered as `/slug`).\n */\nexport function useSlashItems(\n text: string,\n builtinSkills: ReadonlyArray<WorkflowDefinition> = NO_SKILLS\n) {\n const { items, canBrowseSkills } = useSlashMenuItems(builtinSkills)\n const slashToken = parseSlashToken(text)\n const filteredItems = useMemo(\n () => (slashToken !== null ? filterSlashItems(items, slashToken) : []),\n [items, slashToken]\n )\n return {\n slashToken,\n filteredItems,\n isOpen: slashToken !== null && filteredItems.length > 0,\n canBrowseSkills,\n }\n}\n\ntype SkillListings = ReturnType<typeof useUsableSkillListings>\n\n/**\n * Built-in skills share the list and the `/slug` path; a same-slug skill of the user's own shadows\n * the built-in, as on the backend.\n */\nfunction skillItems(\n builtinSkills: ReadonlyArray<WorkflowDefinition>,\n listings: SkillListings\n): SlashMenuItem[] {\n const { host, skills } = mergeSkillWorkflows([...builtinSkills], listings)\n const listing = new Map(listings.map((s) => [s.slug, s]))\n return [\n ...host.map((w): SlashMenuItem => ({\n name: w.id,\n description: w.description,\n argHint: w.inputs[0]?.label ?? '',\n visibility: 'global',\n kind: 'skill',\n })),\n ...skills.map((w): SlashMenuItem => {\n const s = listing.get(w.id)\n return {\n name: w.id,\n description: s?.description || (w.title !== w.id ? w.title : ''),\n argHint: s?.arg_hint ?? '',\n visibility: s?.visibility === 'global' ? 'global' : 'mine',\n kind: 'skill',\n }\n }),\n ]\n}\n"]}
1
+ {"version":3,"sources":["../src/connection/workflows/launch-bindings.ts","../src/connection/workflows/useLaunchWorkflow.ts","../src/connection/workflows/ConnectedWorkflowStart.tsx","../src/connection/workflows/useSlashSkillWorkflows.tsx","../src/connection/conversation/useSlashItems.ts"],"names":["useCallback","useTags","useMemo","text","jsx","useBuiltinCommands"],"mappings":";;;;;;;;;;;;;;;AAwBA,IAAM,YAAA,GAAe,CAAC,MAAA,KAAqC;AACzD,EAAA,MAAM,QAAQ,MAAA,CAAO,UAAA;AACrB,EAAA,OAAO,KAAA,EAAO,aAAa,EAAC;A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ACjC,MAAM,CAAA,CAAE,EAAA;AAAA,MACR,aAAa,CAAA,CAAE,WAAA;AAAA,MACf,OAAA,EAAS,CAAA,CAAE,MAAA,CAAO,CAAC,GAAG,KAAA,IAAS,EAAA;AAAA,MAC/B,UAAA,EAAY,QAAA;AAAA,MACZ,IAAA,EAAM;AAAA,KACR,CAAE,CAAA;AAAA,IACF,GAAG,MAAA,CAAO,GAAA,CAAI,CAAC,CAAA,KAAqB;AAClC,MAAA,MAAM,CAAA,GAAI,OAAA,CAAQ,GAAA,CAAI,CAAA,CAAE,EAAE,CAAA;AAC1B,MAAA,OAAO;AAAA,QACL,MAAM,CAAA,CAAE,EAAA;AAAA,QACR,WAAA,EAAa,GAAG,WAAA,KAAgB,CAAA,CAAE,UAAU,CAAA,CAAE,EAAA,GAAK,EAAE,KAAA,GAAQ,EAAA,CAAA;AAAA,QAC7D,OAAA,EAAS,GAAG,QAAA,IAAY,EAAA;AAAA,QACxB,UAAA,EAAY,CAAA,EAAG,UAAA,KAAe,QAAA,GAAW,QAAA,GAAW,MAAA;AAAA,QACpD,IAAA,EAAM;AAAA,OACR;AAAA,IACF,CAAC;AAAA,GACH;AACF","file":"chunk-TSLXIDUF.js","sourcesContent":["/**\n * Host bindings of prompt workflows that need more than words on send. Bound by workflow id, the\n * same way the annotation operation is: blocks and the registry stay declarative, and the one\n * place that knows the wire shape is here.\n *\n * Generate image: the reference images and the aspect ratio ride structured tool arguments\n * (`retrieval_full_context` over every reference, `image_generation.aspect_ratio`), never the\n * prompt text: the image model does not reliably honour a shape or sources worded into the prompt,\n * and the references go to the separate image model in its own request, so (unlike the app's\n * one-at-a-time pinned document) several of them do not compound against the agent's context.\n */\n\nimport type { WorkflowInputs, WorkflowScope } from '../../agents/workflows/types'\nimport { buildRetrievalChunkTool, buildRetrievalFullContextTool } from '@arbidocs/sdk/browser'\nimport type { TurnTools } from '@arbidocs/react'\nimport { GENERATE_IMAGE_ID, IMAGE_ASPECT_AUTO } from '../../agents/workflows/catalogue/seed'\n\nexport interface PromptBinding {\n /** Attach the scoped files to the chat (default true). Off when the files are tool inputs. */\n attachScope: boolean\n /** Structured tools for the one send, from the form's inputs. */\n tools?: (inputs: WorkflowInputs) => TurnTools\n}\n\nconst referencesOf = (inputs: WorkflowInputs): string[] => {\n const value = inputs.references as WorkflowScope | undefined\n return value?.documents ?? []\n}\n\nexport const PROMPT_BINDINGS: Record<string, PromptBinding> = {\n [GENERATE_IMAGE_ID]: {\n attachScope: false,\n tools: (inputs) => {\n const aspectRatio = typeof inputs.aspect_ratio === 'string' ? inputs.aspect_ratio : ''\n return {\n retrieval_chunk: buildRetrievalChunkTool([]),\n retrieval_full_context: buildRetrievalFullContextTool(referencesOf(inputs)),\n ...(aspectRatio && aspectRatio !== IMAGE_ASPECT_AUTO\n ? {\n image_generation: {\n name: 'image_generation' as const,\n description: 'image generation',\n tool_args: { aspect_ratio: aspectRatio },\n tool_responses: {},\n },\n }\n : {}),\n }\n },\n },\n}\n","/**\n * The host side of the launch contract: `onLaunch({workflow, inputs, scope, agentId})`.\n *\n * Blocks only say WHAT to run; this performs it, so workspace isolation stays host-side:\n *\n * - prompt workflow, my assistant: open a fresh chat (or stay in this one when `inPlace`), scope\n * its documents, set the composed draft and ask for it to be sent (`autoSendDraft`). The host's\n * send waits for the new chat's documents to be seeded, so a scoped run is never sent with the\n * wrong files. Order matters: `openNewConversation` resets the draft, so it is set after it.\n * - prompt workflow, another agent: a run-now task assigned to that agent (the interactive chat\n * query has no agent parameter), created through the same path as the task composer.\n * - operation workflow (tier B): the handler bound to its id (annotation).\n * - a workflow's own model becomes the chat's (`useApplyChatModel`).\n *\n * The prompt is composed in exactly one place: `composeWorkflowPrompt(workflow, inputs)`.\n */\n\nimport {\n useApplyChatModel,\n useArbiSessionStore,\n useCreateTag,\n useDocuments,\n useGenerateDocTags,\n useTags,\n useUpdateTag,\n} from '@arbidocs/react'\nimport { getDocumentTitle } from '@arbidocs/react/ui'\nimport { useCallback, useMemo } from 'react'\nimport { composeWorkflowPrompt, isEmptyWorkflowScope } from '../../agents/workflows/workflow'\nimport { documentScopeLabels, matchWorkflowScope } from '../../agents/workflows/workspaceScope'\nimport {\n type WorkflowInputs,\n type WorkflowLanding,\n type WorkflowLaunch,\n} from '../../agents/workflows/types'\nimport { deriveAnnotationName } from '../../agents/workflows/catalogue/annotation-name'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { PROMPT_BINDINGS } from './launch-bindings'\nimport { ANNOTATE_ID } from '../../agents/workflows/catalogue/seed'\nimport { useWorkflowTasks } from './useWorkflowTasks'\nimport { recordWorkflowUse } from '../../agents/workflows/catalogue/workflow-usage'\n\nexport interface UseLaunchWorkflowOptions {\n /**\n * Where launches from this surface land, over each workflow's own default. The empty chat and\n * the slash menu send into the conversation on screen (`current-chat`); everything else opens a\n * fresh one. A single launch can still override it (`WorkflowLaunch.landing`).\n */\n landing?: WorkflowLanding\n /**\n * A prompt run on the user's own assistant is sent here instead of through the session's draft:\n * the surface's own chat (`ChatPage`) or its own ask (the document ask). Everything else is the\n * same: the file scope, the workflow's model and its bound tools are set on the session in scope\n * (before a send in place, after a send that opens a fresh chat), so the turn carries them.\n */\n send?: (prompt: string) => void\n}\n\nconst text = (inputs: WorkflowInputs, name: string): string => {\n const v = inputs[name]\n return typeof v === 'string' ? v.trim() : ''\n}\n\nexport function useLaunchWorkflow({\n landing: surfaceLanding,\n send,\n}: UseLaunchWorkflowOptions = {}) {\n const { data: documents = [] } = useDocuments()\n const { data: workspaceTags = [] } = useTags()\n const tags = useMemo(() => documentScopeLabels(workspaceTags), [workspaceTags])\n const createTag = useCreateTag()\n const updateTag = useUpdateTag()\n const generate = useGenerateDocTags()\n const { create: createTask } = useWorkflowTasks()\n const applyModel = useApplyChatModel()\n const session = useArbiSessionStore()\n const { notify, openFiles, openNewConversation } = useBlocksEnvironment()\n\n /** Annotation: create (or reuse) the label, start the AI run, land on Files filtered to the set. */\n const annotate = useCallback(\n async ({ inputs, scope }: WorkflowLaunch) => {\n const description = text(inputs, 'description')\n const name = text(inputs, 'name') || deriveAnnotationName(description)\n const matching = matchWorkflowScope(documents, scope)\n if (!name || !description || matching.length === 0) return\n try {\n // A same-named label is reused rather than duplicated, the rule the Files page's\n // label-creation paths follow.\n const existing = tags.find((t) => t.name.toLowerCase() === name.toLowerCase())\n let tagId: string\n if (existing) {\n tagId = existing.external_id\n await updateTag.mutateAsync({\n tagId: tagId,\n change: { instruction: description },\n })\n } else {\n const created = await createTag.mutateAsync({\n name,\n tagType: { type: 'text', options: [] },\n shared: true,\n instruction: description,\n })\n const createdId = (created as { external_id?: string } | undefined)?.external_id\n if (!createdId) throw new Error('tag create returned no id')\n tagId = createdId\n }\n const docIds = matching.map((d) => d.external_id)\n // overwrite=true so a re-run on an existing field refreshes stale values, matching the\n // Files page's default review behaviour.\n await generate.mutateAsync({ tagIds: [tagId], docIds: docIds, overwrite: true })\n // Land on Files with those documents selected and the view narrowed to the annotated set\n // through the same tri-state quick filter the pickers write to. An empty scope selected\n // every file, so no filter is applied.\n const filters: Record<string, 'include'> = {}\n scope.folders.forEach((folder) => {\n filters[folder === '' ? 'folder:none' : `folder:${folder}`] = 'include'\n })\n scope.labels.forEach((labelId) => {\n filters[labelId] = 'include'\n })\n openFiles({ select: docIds, filters })\n } catch (error) {\n notify('Could not start the annotation', 'error')\n throw error\n }\n },\n [documents, tags, createTag, updateTag, generate, openFiles, notify]\n )\n\n return useCallback(\n async (launch: WorkflowLaunch) => {\n const { workflow, inputs, scope, agentId } = launch\n if (workflow.run.kind === 'operation') {\n if (workflow.id === ANNOTATE_ID) {\n await annotate(launch)\n recordWorkflowUse(workflow.id)\n return\n }\n throw new Error(`No host handler for workflow \"${workflow.id}\"`)\n }\n\n // Names for the wording: a `documents` field quotes the files it picked.\n const documentTitles = Object.fromEntries(\n documents.map((d) => [d.external_id, getDocumentTitle(d, d.external_id)])\n )\n const prompt = composeWorkflowPrompt(workflow, inputs, { documentTitles })\n if (!prompt) return\n recordWorkflowUse(workflow.id)\n\n if (agentId) {\n try {\n const created = await createTask({\n workflow,\n values: {\n assignee: 'agent',\n workflowId: workflow.id,\n inputs,\n when: 'now',\n runAt: '',\n rrule: '',\n timezone: 'UTC',\n eventKind: '',\n afterTaskId: '',\n parentTaskId: '',\n shared: true,\n description: '',\n dueAt: '',\n agentId,\n name: '',\n notifyOnComplete: true,\n access: 'ask_each_run',\n },\n })\n const ran = created.kind === 'work' ? created.ran : null\n const title = created.kind === 'work' ? created.task.title : created.workflow.name\n notify(\n ran === false\n ? 'Task created, but the run could not start'\n : `Running \\u201c${title ?? workflow.title}\\u201d`,\n ran === false ? 'warning' : 'success'\n )\n } catch (error) {\n notify(\n error instanceof Error && error.message.startsWith('Open a workspace')\n ? error.message\n : 'Could not start the run',\n 'error'\n )\n throw error\n }\n return\n }\n\n const landing = launch.landing ?? surfaceLanding ?? workflow.landing\n const inPlace = landing === 'current-chat'\n const binding = PROMPT_BINDINGS[workflow.id]\n /** The run's setup on the session in scope: its file scope, its model, its bound tools. */\n const prepare = () => {\n // Scope the chat to the chosen files when a restriction was made; otherwise the\n // workspace's usual \"all documents\" attachment (useDocumentAutoAdd) applies.\n if (binding?.attachScope !== false && !isEmptyWorkflowScope(scope)) {\n const ids = matchWorkflowScope(documents, scope).map((d) => d.external_id)\n if (ids.length > 0) {\n session.setConversationDocuments(\n inPlace ? (session.getState().conversationId ?? 'new') : 'new',\n ids.map((docId) => ({ docId, isPinned: false }))\n )\n }\n }\n if (workflow.model) void applyModel(workflow.model, `Workflow - ${workflow.title}`)\n // The tools ride the next send of the session in scope.\n session.setPendingTools(binding?.tools?.(inputs) ?? null)\n }\n // A fresh chat's reset clears the draft and the model, so the setup follows it. A surface\n // with its own send sends in its chat (set up first) or opens a fresh one (set up after).\n if (send) {\n if (inPlace) prepare()\n send(prompt)\n if (!inPlace) prepare()\n return\n }\n if (!inPlace) openNewConversation()\n prepare()\n session.setDraft(prompt)\n session.setAutoSendDraft(true)\n },\n [\n annotate,\n applyModel,\n createTask,\n documents,\n surfaceLanding,\n session,\n notify,\n openNewConversation,\n send,\n ]\n )\n}\n","/**\n * The workflow launcher, wired to run what it launches: `ConnectedWorkflowLauncher` (the\n * workspace's files behind scope and file fields, the user's agents behind \"Run as\") with the one\n * launch handler (`useLaunchWorkflow`), the host's upload dialog for adding files\n * (`environment.openUpload`), and the touches of the annotation operation (its derived name and\n * overwrite warning, \"Annotate N documents\").\n *\n * The dashboard's Start band, Files (\"Create new\") and, headless, the slash menu use it.\n */\n\nimport { useTags } from '@arbidocs/react'\nimport { useCallback, useMemo, type ReactNode } from 'react'\nimport { TriangleAlert } from 'lucide-react'\nimport { documentScopeLabels } from '../../agents/workflows/workspaceScope'\nimport {\n type WorkflowDefinition,\n type WorkflowField,\n type WorkflowInputs,\n type WorkflowLanding,\n} from '../../agents/workflows/types'\nimport { ConnectedWorkflowLauncher } from '../ConnectedWorkflowLauncher'\nimport { type StartTile } from '../../home/StartTiles'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useHost } from '../../provider/host'\nimport { deriveAnnotationName } from '../../agents/workflows/catalogue/annotation-name'\nimport { ANNOTATE_ID, renderWorkflowIcon } from '../../agents/workflows/catalogue/seed'\nimport { useLaunchWorkflow } from './useLaunchWorkflow'\n\n// The agent picker names the person it hands the work to: the default \"Run as\" / \"My assistant\"\n// copy did not say who an assistant is.\nconst AGENT_LABELS = { label: 'Who this runs for', myAssistant: 'Me (your own assistant)' }\n\nexport interface ConnectedWorkflowStartProps {\n workflows: WorkflowDefinition[]\n /** Which of `workflows` get a tile (a filtered or capped view). */\n tileWorkflows?: WorkflowDefinition[]\n /** Render the Start band (off when another surface opens the dialog). */\n showTiles?: boolean\n caption?: string\n captionTestId?: string\n testId?: string\n /** Plain tiles appended to the band (e.g. the \"Create a file\" menu). */\n extraTiles?: StartTile[]\n /** Controlled open workflow id. */\n activeId?: string | null\n onActiveIdChange?: (id: string | null) => void\n initialInputsFor?: (workflow: WorkflowDefinition) => Partial<WorkflowInputs> | undefined\n /** Where launches land, over each workflow's default (`current-chat` = the chat on screen). */\n landing?: WorkflowLanding\n /** A prompt run's own send (a chat that is not the session's conversation). See `useLaunchWorkflow`. */\n send?: (prompt: string) => void\n /** The host's own \"Add\" control, offered when a workflow needs files and there are none. */\n addFilesAction?: ReactNode\n tileTestId?: (workflow: WorkflowDefinition) => string | undefined\n disabledReason?: (workflow: WorkflowDefinition) => string | undefined\n}\n\nexport function ConnectedWorkflowStart({\n workflows,\n landing,\n send,\n addFilesAction,\n ...rest\n}: ConnectedWorkflowStartProps) {\n const onLaunch = useLaunchWorkflow({ landing, send })\n // The host's icons first (a skill pack names its own), then the kit's, then the skill icon.\n const hostIcon = useHost().workflows?.renderIcon\n const renderIcon = useCallback(\n (key: string) => hostIcon?.(key) ?? renderWorkflowIcon(key) ?? renderWorkflowIcon('skill'),\n [hostIcon]\n )\n const { openUpload } = useBlocksEnvironment()\n const { data: workspaceTags = [] } = useTags()\n const tags = useMemo(() => documentScopeLabels(workspaceTags), [workspaceTags])\n\n // The annotation's name is optional: left blank it is taken from the question, which the\n // field's placeholder shows before anything runs.\n const fieldPlaceholder = useCallback(\n (field: WorkflowField, inputs: WorkflowInputs, workflow: WorkflowDefinition) => {\n if (workflow.id !== ANNOTATE_ID || field.name !== 'name') return undefined\n const derived = deriveAnnotationName(String(inputs.description ?? ''))\n return derived ? `Otherwise “${derived}”` : 'Taken from the description'\n },\n []\n )\n\n return (\n <ConnectedWorkflowLauncher\n {...rest}\n workflows={workflows}\n onLaunch={onLaunch}\n renderIcon={renderIcon}\n onAddFiles={openUpload}\n agentLabels={AGENT_LABELS}\n addFilesAction={addFilesAction}\n fieldPlaceholder={fieldPlaceholder}\n submitLabel={({ workflow, matchedCount }) =>\n workflow.id === ANNOTATE_ID && matchedCount !== null\n ? `Annotate ${matchedCount} document${matchedCount !== 1 ? 's' : ''}`\n : undefined\n }\n renderNotice={({ workflow, inputs }) => {\n if (workflow.id !== ANNOTATE_ID) return null\n // A same-named label is reused: warn that this overwrites its stored description and the\n // cell values for the selected documents.\n const name =\n String(inputs.name ?? '').trim() || deriveAnnotationName(String(inputs.description ?? ''))\n const existing = name\n ? tags.find((t) => t.name.toLowerCase() === name.toLowerCase())\n : undefined\n if (!existing) return null\n return (\n <div\n className=\"flex items-start gap-2 rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-sm text-amber-800 dark:text-amber-200\"\n role=\"status\"\n data-testid=\"workflow-existing-label-warning\"\n >\n <TriangleAlert className=\"mt-0.5 size-4 shrink-0 text-amber-500\" />\n <span>\n An annotation called <span className=\"font-medium\">{existing.name}</span> already\n exists. Annotating will overwrite its description and the current cell values for the\n selected files.\n </span>\n </div>\n )\n }}\n />\n )\n}\n","/**\n * Slash skills are launched prompt-first, through the one workflow launcher.\n *\n * A skill (or a prompt-style built-in such as Deep research) is run WITH a prompt, so it never\n * just executes:\n * - picking it in the slash menu opens its form (the prompt field first, focused, required);\n * - typing `/slug` and pressing Enter opens the same form with the field empty;\n * - typing `/slug some text` and pressing Enter opens it with the text already in the field.\n * The rule is the same for any recognised skill slug as the FIRST token of the draft; a backend\n * command (`/goal`, `/compact`, ...) is never a skill and is sent as typed. Nothing is sent from\n * the composer until the user starts it in the form. Without skills enabled (`show_skills`) this\n * applies to the host's skill packs only (`host.workflows.skillPacks`): the menu lists no other\n * skills and any other `/text` is sent as typed.\n *\n * The run lands where the surface says (`landing`), through the one launch handler. A chat that\n * is not the session's conversation (`ChatPage`, the document ask) passes `send`: the composed\n * prompt then goes to its own send, as a typed message would.\n */\n\nimport { useCallback, useMemo, useState, type ReactNode } from 'react'\nimport { promptFieldName } from '../../agents/workflows/workflow'\nimport { isSkillPackWorkflow } from '../../agents/workflows/skillPack'\nimport { type SlashMenuItem } from '../../chat/SlashMenu'\nimport {\n type WorkflowDefinition,\n type WorkflowInputs,\n type WorkflowLanding,\n} from '../../agents/workflows/types'\nimport { useBuiltinCommands } from '@arbidocs/react'\nimport { ConnectedWorkflowStart } from './ConnectedWorkflowStart'\nimport { useWorkflowDefinitions } from './useWorkflowDefinitions'\n\n/** `/slug` or `/slug rest of the line`: the first token and the text after it. */\nconst TYPED_SKILL = /^\\s*\\/([a-zA-Z0-9][a-zA-Z0-9_-]*)(?:\\s+([\\s\\S]*))?$/\n\n/** What the typed draft names: its slug (lower-cased) and the text after it (trimmed). */\nexport function parseTypedSkill(draft: string): { slug: string; text: string } | null {\n const m = TYPED_SKILL.exec(draft)\n return m ? { slug: m[1].toLowerCase(), text: (m[2] ?? '').trim() } : null\n}\n\n/**\n * Whether a skill opens its form from a menu (the `/` menus, the command palette): a prompt skill,\n * and with skills switched off (`show_skills`) only the host's packs. The one gate both share.\n */\nexport function canOpenSkill(workflow: WorkflowDefinition, skillsEnabled: boolean): boolean {\n return workflow.run.kind === 'prompt' && (skillsEnabled || isSkillPackWorkflow(workflow))\n}\n\nexport interface UseSlashSkillWorkflowsOptions {\n landing: WorkflowLanding\n /** Where the composed prompt goes, for a chat that is not the session's conversation. */\n send?: (prompt: string) => void\n}\n\nexport function useSlashSkillWorkflows({ landing, send }: UseSlashSkillWorkflowsOptions): {\n /** Opens the launcher for a picked menu item. True when it did (the caller then clears the draft). */\n openFor: (item: SlashMenuItem) => boolean\n /**\n * Opens the launcher for a typed `/slug text` draft, text pre-filled. True when the draft names\n * a skill (the caller then clears the draft and sends nothing).\n */\n openForDraft: (draft: string) => boolean\n /**\n * Opens the launcher for a skill by id (a surface listing the skills itself, the command\n * palette). True when it is a skill this person may run here.\n */\n openSkill: (id: string) => boolean\n /** The skills this person may open here: the host's packs, and the rest with `show_skills`. */\n openable: WorkflowDefinition[]\n /** Render once, anywhere in the surface that hosts the slash menu. */\n launcher: ReactNode\n} {\n const { skills, skillsEnabled } = useWorkflowDefinitions()\n const { commands } = useBuiltinCommands()\n const [active, setActive] = useState<{ id: string; text: string } | null>(null)\n\n // Stable while the lists are, so a surface can memoise what it builds on them.\n const open = useCallback(\n (workflow: WorkflowDefinition | undefined, text: string): boolean => {\n if (!workflow || !canOpenSkill(workflow, skillsEnabled)) return false\n setActive({ id: workflow.id, text })\n return true\n },\n [skillsEnabled]\n )\n\n const openFor = useCallback(\n (item: SlashMenuItem): boolean =>\n item.kind === 'skill' &&\n open(\n skills.find((w) => w.id === item.name),\n ''\n ),\n [open, skills]\n )\n\n const openSkill = useCallback(\n (id: string): boolean =>\n open(\n skills.find((w) => w.id === id),\n ''\n ),\n [open, skills]\n )\n\n const openable = useMemo(\n () => skills.filter((w) => canOpenSkill(w, skillsEnabled)),\n [skills, skillsEnabled]\n )\n\n const openForDraft = useCallback(\n (draft: string): boolean => {\n const typed = parseTypedSkill(draft)\n if (!typed) return false\n // A backend command wins a name collision, as in the menu: it is sent as typed.\n if (commands.some((c) => c.name.toLowerCase() === typed.slug)) return false\n return open(\n skills.find((w) => w.id.toLowerCase() === typed.slug),\n typed.text\n )\n },\n [open, skills, commands]\n )\n\n // Mounted only while a workflow is open: the ask bar lives in every page's topbar, so the\n // launcher's data hooks (files, agents, tasks) must not run until it is needed.\n const launcher = useMemo(() => {\n if (active === null) return null\n const initialInputsFor = (\n workflow: WorkflowDefinition\n ): Partial<WorkflowInputs> | undefined => {\n const field = promptFieldName(workflow)\n return field && active.text ? { [field]: active.text } : undefined\n }\n return (\n <ConnectedWorkflowStart\n workflows={skills}\n showTiles={false}\n landing={landing}\n send={send}\n activeId={active.id}\n onActiveIdChange={(id) => id === null && setActive(null)}\n initialInputsFor={initialInputsFor}\n />\n )\n }, [active, skills, landing, send])\n\n return { openFor, openForDraft, openSkill, openable, launcher }\n}\n","/**\n * The slash menu's data, in one place for every surface that hosts it (the chat composers, the\n * workspace ask bar, the document ask and `ChatPage`): the backend's built-in commands, the host's\n * skill packs and the user's skills, filtered by the slash token in progress. Commands and the\n * user's skills are typed `/<slug>` and dispatched by the backend; a skill opens its form\n * (`useSlashSkillWorkflows`).\n */\n\nimport { useMemo } from 'react'\nimport { useBuiltinCommands } from '@arbidocs/react'\nimport type { SlashMenuItem } from '../../chat/SlashMenu'\nimport { buildSlashItems, filterSlashItems, parseSlashToken } from '../../chat/slash-menu-helpers'\nimport { mergeSkillWorkflows } from '../../agents/workflows/workflow'\nimport type { WorkflowDefinition } from '../../agents/workflows/types'\nimport { useCanBrowseSkills, useSkillsEnabled } from '../workflows/useSkillsEnabled'\nimport { hostSkillItem, useHostSkills } from '../workflows/useHostSkills'\nimport { useUsableSkillListings } from '../workflows/useWorkflowDefinitions'\nimport { useNamedWorkflows } from '../workflows/useNamedWorkflows'\n\nconst NO_SKILLS: ReadonlyArray<WorkflowDefinition> = []\n\n/**\n * Every row of the menu, unfiltered: commands, then the host's packs (always: the host offers\n * them), then, for skills users (`show_skills`), the built-in skills and the user's own.\n *\n * @param builtinSkills The built-in skills to offer (prompt workflows offered as `/slug`), for a\n * surface that can open their form; default none.\n */\nexport function useSlashMenuItems(builtinSkills: ReadonlyArray<WorkflowDefinition> = NO_SKILLS): {\n items: SlashMenuItem[]\n /** The menu's \"Browse all\" footer opens the Skills browser: skills users, never guests. */\n canBrowseSkills: boolean\n} {\n const hostSkills = useHostSkills()\n const listings = useUsableSkillListings(hostSkills)\n const skillsEnabled = useSkillsEnabled()\n const { commands } = useBuiltinCommands()\n const builtins = useNamedWorkflows(builtinSkills)\n const items = useMemo<SlashMenuItem[]>(() => {\n const packSlugs = new Set(hostSkills.map((w) => w.id))\n return buildSlashItems(\n commands.map((c) => ({\n name: c.name,\n description: c.description,\n argHint: c.arg_hint,\n kind: 'command' as const,\n })),\n [\n ...hostSkills.map(hostSkillItem),\n ...(skillsEnabled\n ? skillItems(\n builtins.filter((w) => !packSlugs.has(w.id)),\n listings\n )\n : []),\n ]\n )\n }, [commands, hostSkills, listings, skillsEnabled, builtins])\n return { items, canBrowseSkills: useCanBrowseSkills() }\n}\n\n/**\n * @param text The draft.\n * @param builtinSkills The built-in skills (prompt workflows offered as `/slug`).\n */\nexport function useSlashItems(\n text: string,\n builtinSkills: ReadonlyArray<WorkflowDefinition> = NO_SKILLS\n) {\n const { items, canBrowseSkills } = useSlashMenuItems(builtinSkills)\n const slashToken = parseSlashToken(text)\n const filteredItems = useMemo(\n () => (slashToken !== null ? filterSlashItems(items, slashToken) : []),\n [items, slashToken]\n )\n return {\n slashToken,\n filteredItems,\n isOpen: slashToken !== null && filteredItems.length > 0,\n canBrowseSkills,\n }\n}\n\ntype SkillListings = ReturnType<typeof useUsableSkillListings>\n\n/**\n * Built-in skills share the list and the `/slug` path; a same-slug skill of the user's own shadows\n * the built-in, as on the backend.\n */\nfunction skillItems(\n builtinSkills: ReadonlyArray<WorkflowDefinition>,\n listings: SkillListings\n): SlashMenuItem[] {\n const { host, skills } = mergeSkillWorkflows([...builtinSkills], listings)\n const listing = new Map(listings.map((s) => [s.slug, s]))\n return [\n ...host.map((w): SlashMenuItem => ({\n name: w.id,\n description: w.description,\n argHint: w.inputs[0]?.label ?? '',\n visibility: 'global',\n kind: 'skill',\n })),\n ...skills.map((w): SlashMenuItem => {\n const s = listing.get(w.id)\n return {\n name: w.id,\n description: s?.description || (w.title !== w.id ? w.title : ''),\n argHint: s?.arg_hint ?? '',\n visibility: s?.visibility === 'global' ? 'global' : 'mine',\n kind: 'skill',\n }\n }),\n ]\n}\n"]}
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunkBZFCD6A6_cjs = require('./chunk-BZFCD6A6.cjs');
5
4
  var chunkZ2XZ2D4N_cjs = require('./chunk-Z2XZ2D4N.cjs');
6
5
  var chunkMCXS6X37_cjs = require('./chunk-MCXS6X37.cjs');
7
6
  var chunk75BNMCUX_cjs = require('./chunk-75BNMCUX.cjs');
7
+ var chunkBZFCD6A6_cjs = require('./chunk-BZFCD6A6.cjs');
8
8
  var chunkWGWP4ATS_cjs = require('./chunk-WGWP4ATS.cjs');
9
9
  var React = require('react');
10
10
  var jsxRuntime = require('react/jsx-runtime');
@@ -284,5 +284,5 @@ exports.InternalDocLink = InternalDocLink;
284
284
  exports.MermaidDiagram = MermaidDiagram;
285
285
  exports.WorkspaceDocumentReference = WorkspaceDocumentReference;
286
286
  exports.useDocumentWorkspace = useDocumentWorkspace;
287
- //# sourceMappingURL=chunk-6KQVTMRL.cjs.map
288
- //# sourceMappingURL=chunk-6KQVTMRL.cjs.map
287
+ //# sourceMappingURL=chunk-UOGXKHTJ.cjs.map
288
+ //# sourceMappingURL=chunk-UOGXKHTJ.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/chat/mermaid-normalize.ts","../src/connection/conversation/MermaidDiagram.tsx","../src/connection/conversation/DocumentWorkspaceContext.tsx","../src/connection/conversation/ConnectedMarkdown.tsx"],"names":["useState","useId","useEffect","jsxs","jsx","createContext","useContext","useBlocksEnvironment","React","useArbiSession","MentionChip","QuietLink","useArbiHost","Fragment","useCompactChat","useDocument","EntityPill","FileText","DocumentEntity","Mail","mentionFromHref","MarkdownLink","workspaceDocIdFromHref","MarkdownStreamingContext","MarkdownCode","rehypeDocEntityPills","useMemo","KitMarkdownRenderer"],"mappings":";;;;;;;;;;;;;;;;;;;AAsBO,SAAS,sBAAsB,MAAA,EAAwB;AAE5D,EAAA,IAAI,IAAA,CAAK,IAAA,CAAK,MAAM,CAAA,EAAG,OAAO,MAAA;AAE9B,EAAA,MAAM,WAAA,GAAc,MAAA,CAAO,KAAA,CAAM,gCAAgC,CAAA;AACjE,EAAA,IAAI,CAAC,aAAa,OAAO,MAAA;AAEzB,EAAA,MAAM,MAAA,GAAS,WAAA,CAAY,CAAC,CAAA,CAAE,OAAA,EAAQ;AACtC,EAAA,IAAI,OAAO,MAAA,CAAO,KAAA,CAAM,WAAA,CAAY,CAAC,EAAE,MAAM,CAAA;AAG7C,EAAA,IAAA,GAAO,IAAA,CAAK,OAAA,CAAQ,uDAAA,EAAyD,OAAO,CAAA;AAIpF,EAAA,IAAA,GAAO,IAAA,CAAK,OAAA,CAAQ,cAAA,EAAgB,SAAS,CAAA;AAI7C,EAAA,IAAA,GAAO,IAAA,CAAK,OAAA,CAAQ,wCAAA,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AG,8BAAA,EAAgC,GAAG,YAAW,GACnD,8BAAA;AAAA,IACN,CAAC,UAAU;AAAA,GACb;AACA,EAAA,uBACEtB,eAACuB,mBAAA,EAAA,EAAqB,GAAG,OAAO,UAAA,EAAY,MAAA,EAAQ,eAAe,yBAAA,EAA2B,CAAA;AAElG;AAEO,IAAM,iBAAA,GAAoBnB,sBAAA,CAAM,IAAA,CAAK,0BAA0B","file":"chunk-6KQVTMRL.cjs","sourcesContent":["/**\n * Defensive normalizer for single-line `graph` / `flowchart` Mermaid source.\n *\n * Some LLMs emit the entire diagram on one line. Mermaid's parser splits\n * statements on newlines, so a single-line graph fails outright. This helper\n * inserts newlines on safe statement boundaries so the diagram has a chance\n * of parsing. Only attempts normalization when:\n * 1. The source has no embedded newlines (i.e. is genuinely single-line), and\n * 2. The first directive is `graph` or `flowchart`.\n *\n * Other diagram types (sequenceDiagram, classDiagram, gantt, …) have very\n * different syntaxes — applying these heuristics to them would corrupt valid\n * input, so they're left untouched.\n *\n * Boundaries we split on:\n * - After the diagram-type header (`graph TD`, `flowchart LR`, …).\n * - Before each `style` / `classDef` / `class` / `linkStyle` / `click`\n * / `subgraph` keyword.\n * - Before/after `end` (closes a subgraph block).\n * - After a `]` (label close) that's followed by another node identifier\n * starting a new edge or node declaration.\n */\nexport function normalizeMermaidGraph(source: string): string {\n // Already multi-line — assume it's well-formed; don't touch it.\n if (/\\n/.test(source)) return source\n\n const headerMatch = source.match(/^\\s*(graph|flowchart)\\s+\\w+\\s+/)\n if (!headerMatch) return source\n\n const header = headerMatch[0].trimEnd()\n let body = source.slice(headerMatch[0].length)\n\n // Insert newline before keywords that always start a new statement.\n body = body.replace(/\\s+(style|classDef|class|linkStyle|click|subgraph)\\s/g, '\\n$1 ')\n\n // `end` closes a subgraph: put it on its own line, with a break after it\n // too so any trailing statements don't stay attached.\n body = body.replace(/\\s+end\\b\\s*/g, '\\nend\\n')\n\n // After a label close (`]`), if the next token looks like a Mermaid node id\n // followed by another `[` or `-->`, that's a new statement starting.\n body = body.replace(/\\]\\s+(?=[A-Za-z_][\\w-]*\\s*(?:\\[|-->))/g, ']\\n')\n\n // Collapse any accidental runs of blank lines we may have produced.\n body = body.replace(/\\n{2,}/g, '\\n')\n\n return `${header}\\n${body.trimStart()}`\n}\n","/**\n * MermaidDiagram Component\n *\n * Renders a Mermaid diagram from source code.\n * Used inside MarkdownRenderer to handle ```mermaid code blocks.\n * Lazy-loads the mermaid library to avoid bloating the initial bundle.\n */\n\nimport { useState, useEffect, useId } from 'react'\nimport { normalizeMermaidGraph } from '../../chat/mermaid-normalize'\n\ninterface MermaidDiagramProps {\n /** Mermaid diagram source code */\n chart: string\n}\n\n// Lazy-load and initialize mermaid once\nlet mermaidInstance: typeof import('mermaid').default | null = null\nlet mermaidLoadPromise: Promise<typeof import('mermaid').default> | null = null\n\nasync function getMermaid() {\n if (mermaidInstance) return mermaidInstance\n if (!mermaidLoadPromise) {\n mermaidLoadPromise = import('mermaid').then((mod) => {\n const m = mod.default\n m.initialize({\n startOnLoad: false,\n theme: 'default',\n securityLevel: 'strict',\n flowchart: { useMaxWidth: true, curve: 'basis' },\n })\n mermaidInstance = m\n return m\n })\n }\n return mermaidLoadPromise\n}\n\nexport function MermaidDiagram({ chart }: MermaidDiagramProps) {\n const [svg, setSvg] = useState<string | null>(null)\n const [error, setError] = useState<string | null>(null)\n const uniqueId = useId().replace(/:/g, '-')\n\n useEffect(() => {\n let cancelled = false\n\n async function render() {\n const mermaid = await getMermaid()\n const diagramId = `mermaid${uniqueId}`\n\n // Validate with parse() before render(). In Mermaid v11 a render() with\n // bad source can return a \"Syntax error in text\" bomb SVG instead of\n // throwing — and it appends DOM side-effects of its own — so a try/catch\n // around render() doesn't reliably catch failures and the bomb leaks\n // into the page (especially under React StrictMode where effects run\n // twice). parse() throws cleanly with no DOM side-effects.\n //\n // Defensive rescue: some LLMs emit single-line `graph`/`flowchart`\n // source. If the original parse fails, try a normalized variant. The\n // normalizer is a no-op on already-multi-line source and on non-graph\n // diagram types, so this only helps the bad-source case and never\n // corrupts valid input.\n let validSource: string | null = null\n let firstErr: unknown\n try {\n await mermaid.parse(chart)\n validSource = chart\n } catch (err) {\n firstErr = err\n const normalized = normalizeMermaidGraph(chart)\n if (normalized !== chart) {\n try {\n await mermaid.parse(normalized)\n validSource = normalized\n } catch (retryErr) {\n console.warn('Mermaid normalized parse also failed', retryErr)\n }\n }\n }\n\n if (cancelled) return\n\n if (!validSource) {\n console.warn('Mermaid parse failed, showing source', firstErr)\n setError('Failed to render diagram')\n setSvg(null)\n return\n }\n\n try {\n const { svg: renderedSvg } = await mermaid.render(diagramId, validSource)\n if (!cancelled) {\n setSvg(renderedSvg)\n setError(null)\n }\n } catch (renderErr) {\n if (!cancelled) {\n console.warn('Mermaid render failed despite parse success', renderErr)\n setError('Failed to render diagram')\n setSvg(null)\n }\n }\n }\n\n render()\n return () => {\n cancelled = true\n }\n }, [chart, uniqueId])\n\n if (error) {\n // Fall back to showing the raw source in a code block\n return (\n <div className=\"code-block\" data-testid=\"mermaid-error\">\n <div className=\"text-sm text-muted-foreground mb-1\">{error}</div>\n <code className=\"language-mermaid\">{chart}</code>\n </div>\n )\n }\n\n if (!svg) {\n return (\n <div\n className=\"flex items-center justify-center py-8 text-muted-foreground text-sm\"\n data-testid=\"mermaid-loading\"\n >\n Rendering diagram...\n </div>\n )\n }\n\n return (\n <div\n className=\"mermaid-diagram my-4 overflow-x-auto rounded-md border border-border bg-background p-4\"\n data-testid=\"mermaid-diagram\"\n dangerouslySetInnerHTML={{ __html: svg }}\n />\n )\n}\n","/**\n * The workspace a conversation's document references belong to, when it is not the open one: an\n * agent's direct-message thread runs in the agent's workspace, so the documents it names are there.\n * A reference then opens that workspace first (`openDocument(id, { workspaceId })`).\n */\n\nimport { createContext, useContext, type ReactNode } from 'react'\nimport { useBlocksEnvironment } from '../../provider/environment'\n\n/** The workspace of the documents referenced inside it (null: the open workspace). */\nexport const DocumentWorkspaceContext = createContext<string | null>(null)\nexport const useDocumentWorkspace = () => useContext(DocumentWorkspaceContext)\n\n/** A reference to a document of another workspace: opening it opens that workspace first. */\nexport function WorkspaceDocumentReference({\n workspaceId,\n docId,\n children,\n className = 'inline-flex rounded-full border px-2 py-0.5 text-xs hover:bg-muted',\n}: {\n workspaceId: string\n docId: string\n children?: ReactNode\n className?: string\n}) {\n const { openDocument } = useBlocksEnvironment()\n return (\n <button\n type=\"button\"\n className={className}\n onClick={() => openDocument(docId, { workspaceId })}\n >\n {children ?? docId}\n </button>\n )\n}\n","/**\n * The conversation's markdown: the kit's `MarkdownRenderer` (`@arbidocs/react`: sanitised HTML,\n * slugs, lazy KaTeX, streaming blocks, tables, code) with what a conversation adds: @mention chips,\n * workspace documents opening in the viewer, quiet external links, document and email pills (the\n * host's chips, `ArbiChatHost.renderDocumentChip` / `renderMailChip`) and Mermaid diagrams.\n */\nimport { useArbiHost, useArbiSession, useDocument } from '@arbidocs/react'\nimport { mentionFromHref, type MentionKind } from '@arbidocs/react/shell'\nimport {\n EntityPill,\n getDocumentTitle,\n MarkdownCode,\n MarkdownLink,\n MarkdownRenderer as KitMarkdownRenderer,\n MarkdownStreamingContext,\n type MarkdownRendererProps as KitMarkdownRendererProps,\n DocumentEntity,\n} from '@arbidocs/react/ui'\nimport React, { useContext, useMemo } from 'react'\nimport { FileText, Mail } from 'lucide-react'\n\n/** The markdown element overrides, as the kit's renderer takes them. */\ntype Components = NonNullable<KitMarkdownRendererProps['components']>\nimport { useCompactChat } from '../../chat/CompactChatContext'\nimport { MentionChip } from '../../chat/MentionMenu'\nimport { QuietLink } from '../../citations/QuietMarks'\nimport { rehypeDocEntityPills } from '../../chat/rehype-doc-entity-pills'\nimport { workspaceDocIdFromHref } from '../../chat/doc-links'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { MermaidDiagram } from './MermaidDiagram'\nimport { useDocumentWorkspace, WorkspaceDocumentReference } from './DocumentWorkspaceContext'\n\n/** Plain text of a link's children (the `@Label` of a mention link). */\nfunction childrenText(children: React.ReactNode): string {\n return React.Children.toArray(children)\n .map((child) => (typeof child === 'string' || typeof child === 'number' ? String(child) : ''))\n .join('')\n}\n\n/** A mention chip; a mention of the reader stands out. */\nfunction MentionLink({ kind, id, text }: { kind: MentionKind; id: string; text: string }) {\n const currentUserId = useArbiSession().user?.external_id\n return (\n <MentionChip\n kind={kind}\n id={id}\n label={text.replace(/^@/, '')}\n isSelf={kind === 'user' && id === currentUserId}\n />\n )\n}\n\n/**\n * A link to elsewhere, as quiet text. Its menu (Open link / Copy link) is the deliberate step\n * the old confirmation dialog used to be; nothing opens until the menu's primary row is chosen.\n */\nexport function ExternalLink({ href, children }: React.ComponentPropsWithoutRef<'a'>) {\n return (\n <QuietLink href={href} kind=\"external\">\n {children}\n </QuietLink>\n )\n}\n\n/**\n * A workspace document referenced by a link's href rather than by its text.\n *\n * `rehypeDocEntityPills` turns a bare `doc-…` id into a pill, but it only walks\n * TEXT nodes — so `[NVDA DCF Valuation Report](…doc-abc12345…)`, which is how an\n * answer links an artifact it just saved, keeps the id in the href where the\n * plugin never looks. The link then fell through to `ExternalLink`, and opening\n * your own workspace document asked you to confirm an \"external link\" and\n * launched a new tab. It opens in the document viewer, like the pill and the\n * artifact card already do.\n */\nexport function InternalDocLink({\n docId,\n href,\n children,\n}: React.ComponentPropsWithoutRef<'a'> & { docId: string }) {\n const { openDocument } = useBlocksEnvironment()\n const workspaceId = useDocumentWorkspace()\n if (workspaceId) {\n return (\n <WorkspaceDocumentReference workspaceId={workspaceId} docId={docId}>\n {children}\n </WorkspaceDocumentReference>\n )\n }\n\n return (\n <QuietLink href={href} kind=\"document\" onOpen={() => openDocument(docId)}>\n {children}\n </QuietLink>\n )\n}\n\n/** A document of the workspace, as a pill: the host's chip, else the document entity. */\nexport function DocumentChip({ docId }: { docId: string }) {\n const render = useArbiHost().chat?.renderDocumentChip\n const workspaceId = useDocumentWorkspace()\n if (workspaceId) return <WorkspaceDocumentReference workspaceId={workspaceId} docId={docId} />\n return render ? <>{render(docId)}</> : <DefaultDocumentChip docId={docId} />\n}\n\nfunction DefaultDocumentChip({ docId }: { docId: string }) {\n const compact = useCompactChat()\n const { data: doc } = useDocument(docId)\n const { openDocument } = useBlocksEnvironment()\n if (compact && doc)\n return (\n <button\n type=\"button\"\n className=\"inline text-left text-primary underline decoration-primary/30 underline-offset-2 hover:decoration-primary\"\n onClick={() => openDocument(docId)}\n >\n {getDocumentTitle(doc)}\n </button>\n )\n if (!doc)\n return (\n <EntityPill\n icon={<FileText className=\"w-3.5 h-3.5 flex-shrink-0\" />}\n label={docId}\n size=\"sm\"\n onClick={() => openDocument(docId)}\n data-testid=\"doc-entity-pill\"\n />\n )\n return (\n <DocumentEntity doc={doc} onClick={() => openDocument(docId)} data-testid=\"doc-entity-pill\" />\n )\n}\n\n/** An email of the person's mailbox, as a pill: the host's chip, else a plain \"Email\". */\nfunction MailChip({ mailId }: { mailId: string }) {\n const render = useArbiHost().chat?.renderMailChip\n if (render) return <>{render(mailId)}</>\n return (\n <EntityPill\n icon={<Mail className=\"w-3.5 h-3.5 flex-shrink-0\" />}\n label=\"Email\"\n size=\"sm\"\n data-testid=\"mail-entity-pill\"\n />\n )\n}\n\n/**\n * The conversation's overrides, layered on the kit's defaults. Module scope, so the reference is stable\n * and memoised markdown blocks do not re-parse.\n */\nconst conversationMarkdownComponents: Partial<Components> = {\n a: function ConversationMarkdownLink({\n href,\n children,\n ...props\n }: React.ComponentPropsWithoutRef<'a'>) {\n const deploymentDomain = useBlocksEnvironment().runtimeConfig.deploymentDomain\n // @mentions: `linkMentions` turned them into `#mention-<id>` links; draw them as chips.\n const mention = mentionFromHref(href)\n if (mention) {\n return <MentionLink kind={mention.kind} id={mention.id} text={childrenText(children)} />\n }\n // Bookmarks: in-page anchors are near-invisible text; the menu jumps or copies the place.\n if (href?.startsWith('#') && !href.startsWith('#cite-')) {\n return (\n <QuietLink href={href} kind=\"anchor\">\n {children}\n </QuietLink>\n )\n }\n // Citations, `cite:` references and bare links: the kit's link.\n if (!href || href.startsWith('#') || href.startsWith('cite:')) {\n return (\n <MarkdownLink href={href} {...props}>\n {children}\n </MarkdownLink>\n )\n }\n // A workspace document is not an external link, wherever it is hosted: it opens in the viewer.\n const docId = workspaceDocIdFromHref(href, deploymentDomain)\n if (docId) {\n return (\n <InternalDocLink docId={docId} href={href} {...props}>\n {children}\n </InternalDocLink>\n )\n }\n return (\n <ExternalLink href={href} {...props}>\n {children}\n </ExternalLink>\n )\n },\n code: function ConversationMarkdownCode(\n props: React.ComponentPropsWithoutRef<'code'> & { inline?: boolean }\n ) {\n const isStreaming = useContext(MarkdownStreamingContext)\n const { className, children } = props\n const language = /language-(\\w+)/.exec(className || '')?.[1]\n if (!language) {\n // Answers often backtick a bare doc id (`doc-f7b3eeb5`). The text-node pass skips code, so\n // the id would stay monospace text; show it as the document pill. Only a whole id (eight\n // alphanumerics): while streaming, a partial one (\"doc-e\") would be looked up and 404.\n const codeText = typeof children === 'string' ? children.trim() : ''\n if (/^doc-[a-zA-Z0-9]{8}$/.test(codeText)) return <DocumentChip docId={codeText} />\n if (/^eml-[a-zA-Z0-9]{8}$/.test(codeText)) return <MailChip mailId={codeText} />\n }\n // Mermaid lazy-loads its own bundle and re-renders SVG on every change. While streaming the\n // fence is almost always partial, so it stays a code block until generation completes.\n if (language === 'mermaid' && !isStreaming) {\n return <MermaidDiagram chart={String(children).replace(/\\n$/, '')} />\n }\n return <MarkdownCode {...props} />\n },\n span: ({ children, className, ...props }: React.ComponentPropsWithoutRef<'span'>) => {\n const docId = (props as Record<string, unknown>)['data-doc-id'] as string | undefined\n if (docId) return <DocumentChip docId={docId} />\n const mailId = (props as Record<string, unknown>)['data-mail-id'] as string | undefined\n if (mailId) return <MailChip mailId={mailId} />\n return (\n <span className={className} {...props}>\n {children}\n </span>\n )\n },\n}\n\n/** Bare `doc-…` / `eml-…` ids in text become `<span data-doc-id>` / `<span data-mail-id>` pills. */\nconst conversationRehypePlugins = [rehypeDocEntityPills]\n\nexport type ConnectedMarkdownProps = Omit<\n KitMarkdownRendererProps,\n 'rehypePlugins' | 'allowHtml' | 'renderCitation'\n>\n\n/**\n * The kit's renderer with the conversation's overrides; a caller's `components` (e.g. the citation\n * core's) still win over both.\n */\nfunction ConnectedMarkdownComponent({ components, ...props }: ConnectedMarkdownProps) {\n const merged = useMemo(\n () =>\n components\n ? { ...conversationMarkdownComponents, ...components }\n : conversationMarkdownComponents,\n [components]\n )\n return (\n <KitMarkdownRenderer {...props} components={merged} rehypePlugins={conversationRehypePlugins} />\n )\n}\n\nexport const ConnectedMarkdown = React.memo(ConnectedMarkdownComponent)\n"]}
1
+ {"version":3,"sources":["../src/chat/mermaid-normalize.ts","../src/connection/conversation/MermaidDiagram.tsx","../src/connection/conversation/DocumentWorkspaceContext.tsx","../src/connection/conversation/ConnectedMarkdown.tsx"],"names":["useState","useId","useEffect","jsxs","jsx","createContext","useContext","useBlocksEnvironment","React","useArbiSession","MentionChip","QuietLink","useArbiHost","Fragment","useCompactChat","useDocument","EntityPill","FileText","DocumentEntity","Mail","mentionFromHref","MarkdownLink","workspaceDocIdFromHref","MarkdownStreamingContext","MarkdownCode","rehypeDocEntityPills","useMemo","KitMarkdownRenderer"],"mappings":";;;;;;;;;;;;;;;;;;;AAsBO,SAAS,sBAAsB,MAAA,EAAwB;AAE5D,EAAA,IAAI,IAAA,CAAK,IAAA,CAAK,MAAM,CAAA,EAAG,OAAO,MAAA;AAE9B,EAAA,MAAM,WAAA,GAAc,MAAA,CAAO,KAAA,CAAM,gCAAgC,CAAA;AACjE,EAAA,IAAI,CAAC,aAAa,OAAO,MAAA;AAEzB,EAAA,MAAM,MAAA,GAAS,WAAA,CAAY,CAAC,CAAA,CAAE,OAAA,EAAQ;AACtC,EAAA,IAAI,OAAO,MAAA,CAAO,KAAA,CAAM,WAAA,CAAY,CAAC,EAAE,MAAM,CAAA;AAG7C,EAAA,IAAA,GAAO,IAAA,CAAK,OAAA,CAAQ,uDAAA,EAAyD,OAAO,CAAA;AAIpF,EAA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0BAAA,CAA2B,EAAE,UAAA,EAAY,GAAG,OAAM,EAA2B;AACpF,EAAA,MAAM,MAAA,GAASC,aAAA;AAAA,IACb,MACE,UAAA,GACI,EAAE,GAAG,8BAAA,EAAgC,GAAG,YAAW,GACnD,8BAAA;AAAA,IACN,CAAC,UAAU;AAAA,GACb;AACA,EAAA,uBACEtB,eAACuB,mBAAA,EAAA,EAAqB,GAAG,OAAO,UAAA,EAAY,MAAA,EAAQ,eAAe,yBAAA,EAA2B,CAAA;AAElG;AAEO,IAAM,iBAAA,GAAoBnB,sBAAA,CAAM,IAAA,CAAK,0BAA0B","file":"chunk-UOGXKHTJ.cjs","sourcesContent":["/**\n * Defensive normalizer for single-line `graph` / `flowchart` Mermaid source.\n *\n * Some LLMs emit the entire diagram on one line. Mermaid's parser splits\n * statements on newlines, so a single-line graph fails outright. This helper\n * inserts newlines on safe statement boundaries so the diagram has a chance\n * of parsing. Only attempts normalization when:\n * 1. The source has no embedded newlines (i.e. is genuinely single-line), and\n * 2. The first directive is `graph` or `flowchart`.\n *\n * Other diagram types (sequenceDiagram, classDiagram, gantt, …) have very\n * different syntaxes — applying these heuristics to them would corrupt valid\n * input, so they're left untouched.\n *\n * Boundaries we split on:\n * - After the diagram-type header (`graph TD`, `flowchart LR`, …).\n * - Before each `style` / `classDef` / `class` / `linkStyle` / `click`\n * / `subgraph` keyword.\n * - Before/after `end` (closes a subgraph block).\n * - After a `]` (label close) that's followed by another node identifier\n * starting a new edge or node declaration.\n */\nexport function normalizeMermaidGraph(source: string): string {\n // Already multi-line — assume it's well-formed; don't touch it.\n if (/\\n/.test(source)) return source\n\n const headerMatch = source.match(/^\\s*(graph|flowchart)\\s+\\w+\\s+/)\n if (!headerMatch) return source\n\n const header = headerMatch[0].trimEnd()\n let body = source.slice(headerMatch[0].length)\n\n // Insert newline before keywords that always start a new statement.\n body = body.replace(/\\s+(style|classDef|class|linkStyle|click|subgraph)\\s/g, '\\n$1 ')\n\n // `end` closes a subgraph: put it on its own line, with a break after it\n // too so any trailing statements don't stay attached.\n body = body.replace(/\\s+end\\b\\s*/g, '\\nend\\n')\n\n // After a label close (`]`), if the next token looks like a Mermaid node id\n // followed by another `[` or `-->`, that's a new statement starting.\n body = body.replace(/\\]\\s+(?=[A-Za-z_][\\w-]*\\s*(?:\\[|-->))/g, ']\\n')\n\n // Collapse any accidental runs of blank lines we may have produced.\n body = body.replace(/\\n{2,}/g, '\\n')\n\n return `${header}\\n${body.trimStart()}`\n}\n","/**\n * MermaidDiagram Component\n *\n * Renders a Mermaid diagram from source code.\n * Used inside MarkdownRenderer to handle ```mermaid code blocks.\n * Lazy-loads the mermaid library to avoid bloating the initial bundle.\n */\n\nimport { useState, useEffect, useId } from 'react'\nimport { normalizeMermaidGraph } from '../../chat/mermaid-normalize'\n\ninterface MermaidDiagramProps {\n /** Mermaid diagram source code */\n chart: string\n}\n\n// Lazy-load and initialize mermaid once\nlet mermaidInstance: typeof import('mermaid').default | null = null\nlet mermaidLoadPromise: Promise<typeof import('mermaid').default> | null = null\n\nasync function getMermaid() {\n if (mermaidInstance) return mermaidInstance\n if (!mermaidLoadPromise) {\n mermaidLoadPromise = import('mermaid').then((mod) => {\n const m = mod.default\n m.initialize({\n startOnLoad: false,\n theme: 'default',\n securityLevel: 'strict',\n flowchart: { useMaxWidth: true, curve: 'basis' },\n })\n mermaidInstance = m\n return m\n })\n }\n return mermaidLoadPromise\n}\n\nexport function MermaidDiagram({ chart }: MermaidDiagramProps) {\n const [svg, setSvg] = useState<string | null>(null)\n const [error, setError] = useState<string | null>(null)\n const uniqueId = useId().replace(/:/g, '-')\n\n useEffect(() => {\n let cancelled = false\n\n async function render() {\n const mermaid = await getMermaid()\n const diagramId = `mermaid${uniqueId}`\n\n // Validate with parse() before render(). In Mermaid v11 a render() with\n // bad source can return a \"Syntax error in text\" bomb SVG instead of\n // throwing — and it appends DOM side-effects of its own — so a try/catch\n // around render() doesn't reliably catch failures and the bomb leaks\n // into the page (especially under React StrictMode where effects run\n // twice). parse() throws cleanly with no DOM side-effects.\n //\n // Defensive rescue: some LLMs emit single-line `graph`/`flowchart`\n // source. If the original parse fails, try a normalized variant. The\n // normalizer is a no-op on already-multi-line source and on non-graph\n // diagram types, so this only helps the bad-source case and never\n // corrupts valid input.\n let validSource: string | null = null\n let firstErr: unknown\n try {\n await mermaid.parse(chart)\n validSource = chart\n } catch (err) {\n firstErr = err\n const normalized = normalizeMermaidGraph(chart)\n if (normalized !== chart) {\n try {\n await mermaid.parse(normalized)\n validSource = normalized\n } catch (retryErr) {\n console.warn('Mermaid normalized parse also failed', retryErr)\n }\n }\n }\n\n if (cancelled) return\n\n if (!validSource) {\n console.warn('Mermaid parse failed, showing source', firstErr)\n setError('Failed to render diagram')\n setSvg(null)\n return\n }\n\n try {\n const { svg: renderedSvg } = await mermaid.render(diagramId, validSource)\n if (!cancelled) {\n setSvg(renderedSvg)\n setError(null)\n }\n } catch (renderErr) {\n if (!cancelled) {\n console.warn('Mermaid render failed despite parse success', renderErr)\n setError('Failed to render diagram')\n setSvg(null)\n }\n }\n }\n\n render()\n return () => {\n cancelled = true\n }\n }, [chart, uniqueId])\n\n if (error) {\n // Fall back to showing the raw source in a code block\n return (\n <div className=\"code-block\" data-testid=\"mermaid-error\">\n <div className=\"text-sm text-muted-foreground mb-1\">{error}</div>\n <code className=\"language-mermaid\">{chart}</code>\n </div>\n )\n }\n\n if (!svg) {\n return (\n <div\n className=\"flex items-center justify-center py-8 text-muted-foreground text-sm\"\n data-testid=\"mermaid-loading\"\n >\n Rendering diagram...\n </div>\n )\n }\n\n return (\n <div\n className=\"mermaid-diagram my-4 overflow-x-auto rounded-md border border-border bg-background p-4\"\n data-testid=\"mermaid-diagram\"\n dangerouslySetInnerHTML={{ __html: svg }}\n />\n )\n}\n","/**\n * The workspace a conversation's document references belong to, when it is not the open one: an\n * agent's direct-message thread runs in the agent's workspace, so the documents it names are there.\n * A reference then opens that workspace first (`openDocument(id, { workspaceId })`).\n */\n\nimport { createContext, useContext, type ReactNode } from 'react'\nimport { useBlocksEnvironment } from '../../provider/environment'\n\n/** The workspace of the documents referenced inside it (null: the open workspace). */\nexport const DocumentWorkspaceContext = createContext<string | null>(null)\nexport const useDocumentWorkspace = () => useContext(DocumentWorkspaceContext)\n\n/** A reference to a document of another workspace: opening it opens that workspace first. */\nexport function WorkspaceDocumentReference({\n workspaceId,\n docId,\n children,\n className = 'inline-flex rounded-full border px-2 py-0.5 text-xs hover:bg-muted',\n}: {\n workspaceId: string\n docId: string\n children?: ReactNode\n className?: string\n}) {\n const { openDocument } = useBlocksEnvironment()\n return (\n <button\n type=\"button\"\n className={className}\n onClick={() => openDocument(docId, { workspaceId })}\n >\n {children ?? docId}\n </button>\n )\n}\n","/**\n * The conversation's markdown: the kit's `MarkdownRenderer` (`@arbidocs/react`: sanitised HTML,\n * slugs, lazy KaTeX, streaming blocks, tables, code) with what a conversation adds: @mention chips,\n * workspace documents opening in the viewer, quiet external links, document and email pills (the\n * host's chips, `ArbiChatHost.renderDocumentChip` / `renderMailChip`) and Mermaid diagrams.\n */\nimport { useArbiHost, useArbiSession, useDocument } from '@arbidocs/react'\nimport { mentionFromHref, type MentionKind } from '@arbidocs/react/shell'\nimport {\n EntityPill,\n getDocumentTitle,\n MarkdownCode,\n MarkdownLink,\n MarkdownRenderer as KitMarkdownRenderer,\n MarkdownStreamingContext,\n type MarkdownRendererProps as KitMarkdownRendererProps,\n DocumentEntity,\n} from '@arbidocs/react/ui'\nimport React, { useContext, useMemo } from 'react'\nimport { FileText, Mail } from 'lucide-react'\n\n/** The markdown element overrides, as the kit's renderer takes them. */\ntype Components = NonNullable<KitMarkdownRendererProps['components']>\nimport { useCompactChat } from '../../chat/CompactChatContext'\nimport { MentionChip } from '../../chat/MentionMenu'\nimport { QuietLink } from '../../citations/QuietMarks'\nimport { rehypeDocEntityPills } from '../../chat/rehype-doc-entity-pills'\nimport { workspaceDocIdFromHref } from '../../chat/doc-links'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { MermaidDiagram } from './MermaidDiagram'\nimport { useDocumentWorkspace, WorkspaceDocumentReference } from './DocumentWorkspaceContext'\n\n/** Plain text of a link's children (the `@Label` of a mention link). */\nfunction childrenText(children: React.ReactNode): string {\n return React.Children.toArray(children)\n .map((child) => (typeof child === 'string' || typeof child === 'number' ? String(child) : ''))\n .join('')\n}\n\n/** A mention chip; a mention of the reader stands out. */\nfunction MentionLink({ kind, id, text }: { kind: MentionKind; id: string; text: string }) {\n const currentUserId = useArbiSession().user?.external_id\n return (\n <MentionChip\n kind={kind}\n id={id}\n label={text.replace(/^@/, '')}\n isSelf={kind === 'user' && id === currentUserId}\n />\n )\n}\n\n/**\n * A link to elsewhere, as quiet text. Its menu (Open link / Copy link) is the deliberate step\n * the old confirmation dialog used to be; nothing opens until the menu's primary row is chosen.\n */\nexport function ExternalLink({ href, children }: React.ComponentPropsWithoutRef<'a'>) {\n return (\n <QuietLink href={href} kind=\"external\">\n {children}\n </QuietLink>\n )\n}\n\n/**\n * A workspace document referenced by a link's href rather than by its text.\n *\n * `rehypeDocEntityPills` turns a bare `doc-…` id into a pill, but it only walks\n * TEXT nodes — so `[NVDA DCF Valuation Report](…doc-abc12345…)`, which is how an\n * answer links an artifact it just saved, keeps the id in the href where the\n * plugin never looks. The link then fell through to `ExternalLink`, and opening\n * your own workspace document asked you to confirm an \"external link\" and\n * launched a new tab. It opens in the document viewer, like the pill and the\n * artifact card already do.\n */\nexport function InternalDocLink({\n docId,\n href,\n children,\n}: React.ComponentPropsWithoutRef<'a'> & { docId: string }) {\n const { openDocument } = useBlocksEnvironment()\n const workspaceId = useDocumentWorkspace()\n if (workspaceId) {\n return (\n <WorkspaceDocumentReference workspaceId={workspaceId} docId={docId}>\n {children}\n </WorkspaceDocumentReference>\n )\n }\n\n return (\n <QuietLink href={href} kind=\"document\" onOpen={() => openDocument(docId)}>\n {children}\n </QuietLink>\n )\n}\n\n/** A document of the workspace, as a pill: the host's chip, else the document entity. */\nexport function DocumentChip({ docId }: { docId: string }) {\n const render = useArbiHost().chat?.renderDocumentChip\n const workspaceId = useDocumentWorkspace()\n if (workspaceId) return <WorkspaceDocumentReference workspaceId={workspaceId} docId={docId} />\n return render ? <>{render(docId)}</> : <DefaultDocumentChip docId={docId} />\n}\n\nfunction DefaultDocumentChip({ docId }: { docId: string }) {\n const compact = useCompactChat()\n const { data: doc } = useDocument(docId)\n const { openDocument } = useBlocksEnvironment()\n if (compact && doc)\n return (\n <button\n type=\"button\"\n className=\"inline text-left text-primary underline decoration-primary/30 underline-offset-2 hover:decoration-primary\"\n onClick={() => openDocument(docId)}\n >\n {getDocumentTitle(doc)}\n </button>\n )\n if (!doc)\n return (\n <EntityPill\n icon={<FileText className=\"w-3.5 h-3.5 flex-shrink-0\" />}\n label={docId}\n size=\"sm\"\n onClick={() => openDocument(docId)}\n data-testid=\"doc-entity-pill\"\n />\n )\n return (\n <DocumentEntity doc={doc} onClick={() => openDocument(docId)} data-testid=\"doc-entity-pill\" />\n )\n}\n\n/** An email of the person's mailbox, as a pill: the host's chip, else a plain \"Email\". */\nfunction MailChip({ mailId }: { mailId: string }) {\n const render = useArbiHost().chat?.renderMailChip\n if (render) return <>{render(mailId)}</>\n return (\n <EntityPill\n icon={<Mail className=\"w-3.5 h-3.5 flex-shrink-0\" />}\n label=\"Email\"\n size=\"sm\"\n data-testid=\"mail-entity-pill\"\n />\n )\n}\n\n/**\n * The conversation's overrides, layered on the kit's defaults. Module scope, so the reference is stable\n * and memoised markdown blocks do not re-parse.\n */\nconst conversationMarkdownComponents: Partial<Components> = {\n a: function ConversationMarkdownLink({\n href,\n children,\n ...props\n }: React.ComponentPropsWithoutRef<'a'>) {\n const deploymentDomain = useBlocksEnvironment().runtimeConfig.deploymentDomain\n // @mentions: `linkMentions` turned them into `#mention-<id>` links; draw them as chips.\n const mention = mentionFromHref(href)\n if (mention) {\n return <MentionLink kind={mention.kind} id={mention.id} text={childrenText(children)} />\n }\n // Bookmarks: in-page anchors are near-invisible text; the menu jumps or copies the place.\n if (href?.startsWith('#') && !href.startsWith('#cite-')) {\n return (\n <QuietLink href={href} kind=\"anchor\">\n {children}\n </QuietLink>\n )\n }\n // Citations, `cite:` references and bare links: the kit's link.\n if (!href || href.startsWith('#') || href.startsWith('cite:')) {\n return (\n <MarkdownLink href={href} {...props}>\n {children}\n </MarkdownLink>\n )\n }\n // A workspace document is not an external link, wherever it is hosted: it opens in the viewer.\n const docId = workspaceDocIdFromHref(href, deploymentDomain)\n if (docId) {\n return (\n <InternalDocLink docId={docId} href={href} {...props}>\n {children}\n </InternalDocLink>\n )\n }\n return (\n <ExternalLink href={href} {...props}>\n {children}\n </ExternalLink>\n )\n },\n code: function ConversationMarkdownCode(\n props: React.ComponentPropsWithoutRef<'code'> & { inline?: boolean }\n ) {\n const isStreaming = useContext(MarkdownStreamingContext)\n const { className, children } = props\n const language = /language-(\\w+)/.exec(className || '')?.[1]\n if (!language) {\n // Answers often backtick a bare doc id (`doc-f7b3eeb5`). The text-node pass skips code, so\n // the id would stay monospace text; show it as the document pill. Only a whole id (eight\n // alphanumerics): while streaming, a partial one (\"doc-e\") would be looked up and 404.\n const codeText = typeof children === 'string' ? children.trim() : ''\n if (/^doc-[a-zA-Z0-9]{8}$/.test(codeText)) return <DocumentChip docId={codeText} />\n if (/^eml-[a-zA-Z0-9]{8}$/.test(codeText)) return <MailChip mailId={codeText} />\n }\n // Mermaid lazy-loads its own bundle and re-renders SVG on every change. While streaming the\n // fence is almost always partial, so it stays a code block until generation completes.\n if (language === 'mermaid' && !isStreaming) {\n return <MermaidDiagram chart={String(children).replace(/\\n$/, '')} />\n }\n return <MarkdownCode {...props} />\n },\n span: ({ children, className, ...props }: React.ComponentPropsWithoutRef<'span'>) => {\n const docId = (props as Record<string, unknown>)['data-doc-id'] as string | undefined\n if (docId) return <DocumentChip docId={docId} />\n const mailId = (props as Record<string, unknown>)['data-mail-id'] as string | undefined\n if (mailId) return <MailChip mailId={mailId} />\n return (\n <span className={className} {...props}>\n {children}\n </span>\n )\n },\n}\n\n/** Bare `doc-…` / `eml-…` ids in text become `<span data-doc-id>` / `<span data-mail-id>` pills. */\nconst conversationRehypePlugins = [rehypeDocEntityPills]\n\nexport type ConnectedMarkdownProps = Omit<\n KitMarkdownRendererProps,\n 'rehypePlugins' | 'allowHtml' | 'renderCitation'\n>\n\n/**\n * The kit's renderer with the conversation's overrides; a caller's `components` (e.g. the citation\n * core's) still win over both.\n */\nfunction ConnectedMarkdownComponent({ components, ...props }: ConnectedMarkdownProps) {\n const merged = useMemo(\n () =>\n components\n ? { ...conversationMarkdownComponents, ...components }\n : conversationMarkdownComponents,\n [components]\n )\n return (\n <KitMarkdownRenderer {...props} components={merged} rehypePlugins={conversationRehypePlugins} />\n )\n}\n\nexport const ConnectedMarkdown = React.memo(ConnectedMarkdownComponent)\n"]}
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { DOCUMENTS_ROW_HEIGHT_INITIAL } from './chunk-SYMZ6L3C.js';
2
+ import { DOCUMENTS_ROW_HEIGHT_INITIAL } from './chunk-6Q3SYCSX.js';
3
3
  import { create } from 'zustand';
4
4
  import { persist, createJSONStorage } from 'zustand/middleware';
5
5
 
@@ -112,5 +112,5 @@ var useFilesDialogs = create()((set) => ({
112
112
  }));
113
113
 
114
114
  export { FILES_PREFS_KEY, filesViewMode, useAiReviewStore, useFilesDialogs, useFilesGridStates, useFilesPrefs, useFilesStore, usePendingFolders };
115
- //# sourceMappingURL=chunk-NTXO6IYE.js.map
116
- //# sourceMappingURL=chunk-NTXO6IYE.js.map
115
+ //# sourceMappingURL=chunk-UTUXEZBC.js.map
116
+ //# sourceMappingURL=chunk-UTUXEZBC.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/connection/files/store.ts"],"names":[],"mappings":";;;;AAmBO,IAAM,gBAAgB,MAAA,EAAmB;AAAA,EAC9C,OAAA;AAAA,IACE,CAAC,GAAA,MAAS;AAAA,MACR,gBAAgB,EAAC;AAAA,MACjB,kBAAkB,CAAC,WAAA,EA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AA,EAAY,CAAC,MAAM,GAAG,KAAA,IAAQ,CAAE;AAAA,KACjF,CAAA;AAAA,IACA,EAAE,IAAA,EAAM,kBAAA,EAAoB,SAAS,iBAAA,CAAkB,MAAM,YAAY,CAAA;AAAE;AAE/E;AA0BO,IAAM,eAAA,GAAkB,MAAA,EAA0B,CAAE,CAAC,GAAA,MAAS;AAAA,EACnE,IAAA,EAAM,IAAA;AAAA,EACN,QAAA,EAAU,CAAC,MAAA,GAAS,IAAA,KAAS,GAAA,CAAI,EAAE,IAAA,EAAM,EAAE,MAAA,EAAO,EAAG,CAAA;AAAA,EACrD,WAAW,MAAM,GAAA,CAAI,EAAE,IAAA,EAAM,MAAM,CAAA;AAAA,EACnC,YAAA,EAAc,KAAA;AAAA,EACd,iBAAiB,CAAC,YAAA,KAAiB,GAAA,CAAI,EAAE,cAAc,CAAA;AAAA,EACvD,aAAA,EAAe,IAAA;AAAA,EACf,eAAe,CAAC,aAAA,KAAkB,GAAA,CAAI,EAAE,eAAe,CAAA;AAAA,EACvD,UAAA,EAAY,KAAA;AAAA,EACZ,eAAe,CAAC,UAAA,KAAe,GAAA,CAAI,EAAE,YAAY;AACnD,CAAA,CAAE","file":"chunk-NTXO6IYE.js","sourcesContent":["/**\n * The Files kits' own state: empty folders the user created (a folder exists only through its\n * documents, so a new one is a placeholder until something is moved into it), per workspace, for\n * the session (kept in `sessionStorage`, so a reload keeps them).\n */\n\nimport type { GridState } from 'ag-grid-community'\nimport { create } from 'zustand'\nimport { createJSONStorage, persist } from 'zustand/middleware'\nimport { DOCUMENTS_ROW_HEIGHT_INITIAL } from '../../files/documentColumns'\nimport type { ExplorerFolder } from '../../files/folders/folderPaths'\n\ninterface FilesState {\n /** Placeholder folder paths per workspace. */\n pendingFolders: Readonly<Record<string, readonly string[]>>\n addPendingFolder: (workspaceId: string, path: string) => void\n removePendingFolder: (workspaceId: string, path: string) => void\n}\n\nexport const useFilesStore = create<FilesState>()(\n persist(\n (set) => ({\n pendingFolders: {},\n addPendingFolder: (workspaceId, path) =>\n set((state) => {\n const current = state.pendingFolders[workspaceId] ?? []\n if (current.includes(path)) return state\n return { pendingFolders: { ...state.pendingFolders, [workspaceId]: [...current, path] } }\n }),\n removePendingFolder: (workspaceId, path) =>\n set((state) => {\n const current = state.pendingFolders[workspaceId] ?? []\n if (!current.includes(path)) return state\n return {\n pendingFolders: {\n ...state.pendingFolders,\n [workspaceId]: current.filter((p) => p !== path),\n },\n }\n }),\n }),\n {\n name: 'arbi_explorer_pending_folders',\n storage: createJSONStorage(() => sessionStorage),\n partialize: (state) => ({ pendingFolders: state.pendingFolders }),\n }\n )\n)\n\nconst NONE: readonly string[] = []\n\n/** A workspace's placeholder folders. */\nexport function usePendingFolders(workspaceId: string | null | undefined): readonly string[] {\n return useFilesStore(\n (state) => (workspaceId ? state.pendingFolders[workspaceId] : undefined) ?? NONE\n )\n}\n\n/** How the files page shows the documents: a table, the explorer, review one by one, or search. */\nexport type FilesViewMode = 'grid' | 'explorer' | 'navigator' | 'search'\n\n/** The files page's own preferences key (`ConnectedFilesPage` `prefsKey`). */\nexport const FILES_PREFS_KEY = 'files'\nconst DEFAULT_VIEW_MODE: FilesViewMode = 'explorer'\n\ninterface FilesPrefsState {\n /** The documents list's tri-state filters (filter id → include / exclude / off). */\n documentFilters: Readonly<Record<string, 'include' | 'exclude' | null>>\n setDocumentFilters: (filters: Record<string, 'include' | 'exclude' | null>) => void\n /**\n * Each files page's view, by its `prefsKey` (a page that is the same kit in another role, e.g.\n * a tabular review in the table view, keeps its own). Absent: that page's default.\n */\n viewModes: Readonly<Record<string, FilesViewMode>>\n /** Set a page's view (default: the files page's). */\n setViewMode: (mode: FilesViewMode, prefsKey?: string) => void\n /** The table's row height (density). */\n rowHeight: number\n setRowHeight: (height: number) => void\n}\n\n/** The Files kits' preferences, kept on this device (`localStorage`) across sessions. */\nexport const useFilesPrefs = create<FilesPrefsState>()(\n persist(\n (set) => ({\n documentFilters: {},\n setDocumentFilters: (documentFilters) => set({ documentFilters }),\n viewModes: {},\n setViewMode: (viewMode, prefsKey = FILES_PREFS_KEY) =>\n set((state) =>\n state.viewModes[prefsKey] === viewMode\n ? state\n : { viewModes: { ...state.viewModes, [prefsKey]: viewMode } }\n ),\n // New users start at the compact minimum (more rows at once).\n rowHeight: DOCUMENTS_ROW_HEIGHT_INITIAL,\n setRowHeight: (rowHeight) => set({ rowHeight }),\n }),\n {\n name: 'arbi_files_prefs',\n storage: createJSONStorage(() => localStorage),\n version: 1,\n // Version 0 kept one view for every files page: it becomes the files page's own.\n migrate: (persisted, version) => {\n const state = (persisted ?? {}) as Record<string, unknown>\n if (version >= 1) return state as Partial<FilesPrefsState>\n const { viewMode, ...rest } = state\n return {\n ...rest,\n viewModes: viewMode ? { [FILES_PREFS_KEY]: viewMode as FilesViewMode } : {},\n } as Partial<FilesPrefsState>\n },\n partialize: (state) => ({\n documentFilters: state.documentFilters,\n viewModes: state.viewModes,\n rowHeight: state.rowHeight,\n }),\n }\n )\n)\n\n/** A files page's view (`prefsKey`, default the files page's), else its `defaultViewMode`. */\nexport function filesViewMode(\n state: Pick<FilesPrefsState, 'viewModes'>,\n prefsKey: string = FILES_PREFS_KEY,\n defaultViewMode: FilesViewMode = DEFAULT_VIEW_MODE\n): FilesViewMode {\n return state.viewModes[prefsKey] ?? defaultViewMode\n}\n\n/** An AI review run: the fields, the documents, and which of them the server finished. */\nexport interface AiReviewRun {\n tags: { id: string; name: string }[]\n docIds: string[]\n /** The documents the server finished (a finished cell with no value will not fill). */\n finishedDocIds?: string[]\n /** It replaces values already there: a cell shows its new value only once finished. */\n replacing?: boolean\n}\n\ninterface AiReviewState {\n /** The AI review dialog is open. */\n open: boolean\n /** The run on screen, kept after closing so \"View results\" can bring the answers back. */\n run: AiReviewRun | null\n setOpen: (open: boolean) => void\n setRun: (run: AiReviewRun | null) => void\n /** The server finished these documents of the run (with or without a value). */\n markFinished: (docIds: string[]) => void\n}\n\n/** The AI review dialog and its run, reachable from outside React (a finished-run notice). */\nexport const useAiReviewStore = create<AiReviewState>()((set) => ({\n open: false,\n run: null,\n setOpen: (open) => set({ open }),\n setRun: (run) => set({ run }),\n markFinished: (docIds) =>\n set((state) => {\n const run = state.run\n if (!run) return state\n const finished = new Set(run.finishedDocIds ?? [])\n const added = docIds.filter((id) => run.docIds.includes(id) && !finished.has(id))\n if (added.length === 0) return state\n return { run: { ...run, finishedDocIds: [...finished, ...added] } }\n }),\n}))\n\ninterface GridStatesState {\n /** AG Grid's saved state (columns, widths, sort) per grid id. */\n gridStates: Readonly<Record<string, GridState>>\n setGridState: (gridId: string, state: GridState) => void\n}\n\n/** The Files grids' saved state, kept on this device, for hosts that keep none of their own. */\nexport const useFilesGridStates = create<GridStatesState>()(\n persist(\n (set) => ({\n gridStates: {},\n setGridState: (gridId, state) =>\n set((current) => ({ gridStates: { ...current.gridStates, [gridId]: state } })),\n }),\n { name: 'arbi_files_grids', storage: createJSONStorage(() => localStorage) }\n )\n)\n\n/** A document the Delete confirmation asks about. */\nexport interface DeleteRequestDocument {\n external_id: string\n file_name?: string | null\n doc_metadata?: { title?: string | null } | null\n}\n\ninterface FilesDialogsState {\n /** Move the selection (or `folder`) to a folder. */\n move: { folder: ExplorerFolder | null } | null\n openMove: (folder?: ExplorerFolder | null) => void\n closeMove: () => void\n /** Edit the selection's labels and fields. */\n bulkTagsOpen: boolean\n setBulkTagsOpen: (open: boolean) => void\n /** Confirm deleting one document. */\n deleteRequest: DeleteRequestDocument | null\n requestDelete: (doc: DeleteRequestDocument | null) => void\n /** Export, copy or move the selection (the page's own dialog, when the host has none). */\n exportOpen: boolean\n setExportOpen: (open: boolean) => void\n}\n\n/** The files page's dialogs, also opened from outside it (commands, the viewer's related files). */\nexport const useFilesDialogs = create<FilesDialogsState>()((set) => ({\n move: null,\n openMove: (folder = null) => set({ move: { folder } }),\n closeMove: () => set({ move: null }),\n bulkTagsOpen: false,\n setBulkTagsOpen: (bulkTagsOpen) => set({ bulkTagsOpen }),\n deleteRequest: null,\n requestDelete: (deleteRequest) => set({ deleteRequest }),\n exportOpen: false,\n setExportOpen: (exportOpen) => set({ exportOpen }),\n}))\n"]}
1
+ {"version":3,"sources":["../src/connection/files/store.ts"],"names":[],"mappings":";;;;AAmBO,IAAM,gBAAgB,MAAA,EAAmB;AAAA,EAC9C,OAAA;AAAA,IACE,CAAC,GAAA,MAAS;AAAA,MACR,gBAAgB,EAAC;AAAA,MACjB,kBAAkB,CAAC,WAAA,EAAa,IAAA,KAC9B,GAAA,CAAI,CAAC,KAAA,KAAU;AACb,QAAA,MAAM,OAAA,GAAU,KAAA,CAAM,cAAA,CAAe,WAAW,KAAK,EAAC;AACtD,QAAA,IAAI,OAAA,CAAQ,QAAA,CAAS,IAAI,CAAA,EAAG,OAAO,KAAA;AACnC,QAAA,OAAO,EAAE,cAAA,EAAgB,EAAE,GAAG,MAAM,cAAA,EAAgB,CAAC,WAAW,GAAG,CAAC,GAAG,OAAA,EAAS,IAAI,GAAE,EAAE;AAAA,MAC1F,CAAC,CAAA;AAAA,MACH,qBAAqB,CAAC,WAAA,EAAa,IAAA,KACjC,GAAA,CAAI,CAAC,KAAA,KAAU;AACb,QAAA,MAAM,OAAA,GAAU,KAAA,CAAM,cAAA,CAAe,WAAW,KAAK,EAAC;AACtD,QAAA,IAAI,CAAC,OAAA,CAAQ,QAAA,CAAS,IAAI,GAAG,OAAO,KAAA;AACpC,QAAA,OAAO;AAAA,UACL,cAAA,EAAgB;AAAA,YACd,GAAG,KAAA,CAAM,cAAA;AAAA,YACT,CAAC,WAAW,GAAG,OAAA,CAAQ,OAAO,CAAC,CAAA,KAAM,MAAM,IAAI;AAAA;AACjD,SACF;AAAA,MACF,CAAC;AAAA,KACL,CAAA;AAAA,IACA;AAAA,MACE,IAAA,EAAM,+BAAA;AAAA,MACN,OAAA,EAAS,iBAAA,CAAkB,MAAM,cAAc,CAAA;AAAA,MAC/C,YAAY,CAAC,KAAA,MAAW,EAAE,cAAA,EAAgB,MAAM,cAAA,EAAe;AAAA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A,EAAU,GAAG,KAAK,CAAA,EAAE,EAAE;AAAA,EACpE,CAAC;AACL,CAAA,CAAE;AASK,IAAM,qBAAqB,MAAA,EAAwB;AAAA,EACxD,OAAA;AAAA,IACE,CAAC,GAAA,MAAS;AAAA,MACR,YAAY,EAAC;AAAA,MACb,cAAc,CAAC,MAAA,EAAQ,UACrB,GAAA,CAAI,CAAC,aAAa,EAAE,UAAA,EAAY,EAAE,GAAG,QAAQ,UAAA,EAAY,CAAC,MAAM,GAAG,KAAA,IAAQ,CAAE;AAAA,KACjF,CAAA;AAAA,IACA,EAAE,IAAA,EAAM,kBAAA,EAAoB,SAAS,iBAAA,CAAkB,MAAM,YAAY,CAAA;AAAE;AAE/E;AA0BO,IAAM,eAAA,GAAkB,MAAA,EAA0B,CAAE,CAAC,GAAA,MAAS;AAAA,EACnE,IAAA,EAAM,IAAA;AAAA,EACN,QAAA,EAAU,CAAC,MAAA,GAAS,IAAA,KAAS,GAAA,CAAI,EAAE,IAAA,EAAM,EAAE,MAAA,EAAO,EAAG,CAAA;AAAA,EACrD,WAAW,MAAM,GAAA,CAAI,EAAE,IAAA,EAAM,MAAM,CAAA;AAAA,EACnC,YAAA,EAAc,KAAA;AAAA,EACd,iBAAiB,CAAC,YAAA,KAAiB,GAAA,CAAI,EAAE,cAAc,CAAA;AAAA,EACvD,aAAA,EAAe,IAAA;AAAA,EACf,eAAe,CAAC,aAAA,KAAkB,GAAA,CAAI,EAAE,eAAe,CAAA;AAAA,EACvD,UAAA,EAAY,KAAA;AAAA,EACZ,eAAe,CAAC,UAAA,KAAe,GAAA,CAAI,EAAE,YAAY;AACnD,CAAA,CAAE","file":"chunk-UTUXEZBC.js","sourcesContent":["/**\n * The Files kits' own state: empty folders the user created (a folder exists only through its\n * documents, so a new one is a placeholder until something is moved into it), per workspace, for\n * the session (kept in `sessionStorage`, so a reload keeps them).\n */\n\nimport type { GridState } from 'ag-grid-community'\nimport { create } from 'zustand'\nimport { createJSONStorage, persist } from 'zustand/middleware'\nimport { DOCUMENTS_ROW_HEIGHT_INITIAL } from '../../files/documentColumns'\nimport type { ExplorerFolder } from '../../files/folders/folderPaths'\n\ninterface FilesState {\n /** Placeholder folder paths per workspace. */\n pendingFolders: Readonly<Record<string, readonly string[]>>\n addPendingFolder: (workspaceId: string, path: string) => void\n removePendingFolder: (workspaceId: string, path: string) => void\n}\n\nexport const useFilesStore = create<FilesState>()(\n persist(\n (set) => ({\n pendingFolders: {},\n addPendingFolder: (workspaceId, path) =>\n set((state) => {\n const current = state.pendingFolders[workspaceId] ?? []\n if (current.includes(path)) return state\n return { pendingFolders: { ...state.pendingFolders, [workspaceId]: [...current, path] } }\n }),\n removePendingFolder: (workspaceId, path) =>\n set((state) => {\n const current = state.pendingFolders[workspaceId] ?? []\n if (!current.includes(path)) return state\n return {\n pendingFolders: {\n ...state.pendingFolders,\n [workspaceId]: current.filter((p) => p !== path),\n },\n }\n }),\n }),\n {\n name: 'arbi_explorer_pending_folders',\n storage: createJSONStorage(() => sessionStorage),\n partialize: (state) => ({ pendingFolders: state.pendingFolders }),\n }\n )\n)\n\nconst NONE: readonly string[] = []\n\n/** A workspace's placeholder folders. */\nexport function usePendingFolders(workspaceId: string | null | undefined): readonly string[] {\n return useFilesStore(\n (state) => (workspaceId ? state.pendingFolders[workspaceId] : undefined) ?? NONE\n )\n}\n\n/** How the files page shows the documents: a table, the explorer, review one by one, or search. */\nexport type FilesViewMode = 'grid' | 'explorer' | 'navigator' | 'search'\n\n/** The files page's own preferences key (`ConnectedFilesPage` `prefsKey`). */\nexport const FILES_PREFS_KEY = 'files'\nconst DEFAULT_VIEW_MODE: FilesViewMode = 'explorer'\n\ninterface FilesPrefsState {\n /** The documents list's tri-state filters (filter id → include / exclude / off). */\n documentFilters: Readonly<Record<string, 'include' | 'exclude' | null>>\n setDocumentFilters: (filters: Record<string, 'include' | 'exclude' | null>) => void\n /**\n * Each files page's view, by its `prefsKey` (a page that is the same kit in another role, e.g.\n * a tabular review in the table view, keeps its own). Absent: that page's default.\n */\n viewModes: Readonly<Record<string, FilesViewMode>>\n /** Set a page's view (default: the files page's). */\n setViewMode: (mode: FilesViewMode, prefsKey?: string) => void\n /** The table's row height (density). */\n rowHeight: number\n setRowHeight: (height: number) => void\n}\n\n/** The Files kits' preferences, kept on this device (`localStorage`) across sessions. */\nexport const useFilesPrefs = create<FilesPrefsState>()(\n persist(\n (set) => ({\n documentFilters: {},\n setDocumentFilters: (documentFilters) => set({ documentFilters }),\n viewModes: {},\n setViewMode: (viewMode, prefsKey = FILES_PREFS_KEY) =>\n set((state) =>\n state.viewModes[prefsKey] === viewMode\n ? state\n : { viewModes: { ...state.viewModes, [prefsKey]: viewMode } }\n ),\n // New users start at the compact minimum (more rows at once).\n rowHeight: DOCUMENTS_ROW_HEIGHT_INITIAL,\n setRowHeight: (rowHeight) => set({ rowHeight }),\n }),\n {\n name: 'arbi_files_prefs',\n storage: createJSONStorage(() => localStorage),\n version: 1,\n // Version 0 kept one view for every files page: it becomes the files page's own.\n migrate: (persisted, version) => {\n const state = (persisted ?? {}) as Record<string, unknown>\n if (version >= 1) return state as Partial<FilesPrefsState>\n const { viewMode, ...rest } = state\n return {\n ...rest,\n viewModes: viewMode ? { [FILES_PREFS_KEY]: viewMode as FilesViewMode } : {},\n } as Partial<FilesPrefsState>\n },\n partialize: (state) => ({\n documentFilters: state.documentFilters,\n viewModes: state.viewModes,\n rowHeight: state.rowHeight,\n }),\n }\n )\n)\n\n/** A files page's view (`prefsKey`, default the files page's), else its `defaultViewMode`. */\nexport function filesViewMode(\n state: Pick<FilesPrefsState, 'viewModes'>,\n prefsKey: string = FILES_PREFS_KEY,\n defaultViewMode: FilesViewMode = DEFAULT_VIEW_MODE\n): FilesViewMode {\n return state.viewModes[prefsKey] ?? defaultViewMode\n}\n\n/** An AI review run: the fields, the documents, and which of them the server finished. */\nexport interface AiReviewRun {\n tags: { id: string; name: string }[]\n docIds: string[]\n /** The documents the server finished (a finished cell with no value will not fill). */\n finishedDocIds?: string[]\n /** It replaces values already there: a cell shows its new value only once finished. */\n replacing?: boolean\n}\n\ninterface AiReviewState {\n /** The AI review dialog is open. */\n open: boolean\n /** The run on screen, kept after closing so \"View results\" can bring the answers back. */\n run: AiReviewRun | null\n setOpen: (open: boolean) => void\n setRun: (run: AiReviewRun | null) => void\n /** The server finished these documents of the run (with or without a value). */\n markFinished: (docIds: string[]) => void\n}\n\n/** The AI review dialog and its run, reachable from outside React (a finished-run notice). */\nexport const useAiReviewStore = create<AiReviewState>()((set) => ({\n open: false,\n run: null,\n setOpen: (open) => set({ open }),\n setRun: (run) => set({ run }),\n markFinished: (docIds) =>\n set((state) => {\n const run = state.run\n if (!run) return state\n const finished = new Set(run.finishedDocIds ?? [])\n const added = docIds.filter((id) => run.docIds.includes(id) && !finished.has(id))\n if (added.length === 0) return state\n return { run: { ...run, finishedDocIds: [...finished, ...added] } }\n }),\n}))\n\ninterface GridStatesState {\n /** AG Grid's saved state (columns, widths, sort) per grid id. */\n gridStates: Readonly<Record<string, GridState>>\n setGridState: (gridId: string, state: GridState) => void\n}\n\n/** The Files grids' saved state, kept on this device, for hosts that keep none of their own. */\nexport const useFilesGridStates = create<GridStatesState>()(\n persist(\n (set) => ({\n gridStates: {},\n setGridState: (gridId, state) =>\n set((current) => ({ gridStates: { ...current.gridStates, [gridId]: state } })),\n }),\n { name: 'arbi_files_grids', storage: createJSONStorage(() => localStorage) }\n )\n)\n\n/** A document the Delete confirmation asks about. */\nexport interface DeleteRequestDocument {\n external_id: string\n file_name?: string | null\n doc_metadata?: { title?: string | null } | null\n}\n\ninterface FilesDialogsState {\n /** Move the selection (or `folder`) to a folder. */\n move: { folder: ExplorerFolder | null } | null\n openMove: (folder?: ExplorerFolder | null) => void\n closeMove: () => void\n /** Edit the selection's labels and fields. */\n bulkTagsOpen: boolean\n setBulkTagsOpen: (open: boolean) => void\n /** Confirm deleting one document. */\n deleteRequest: DeleteRequestDocument | null\n requestDelete: (doc: DeleteRequestDocument | null) => void\n /** Export, copy or move the selection (the page's own dialog, when the host has none). */\n exportOpen: boolean\n setExportOpen: (open: boolean) => void\n}\n\n/** The files page's dialogs, also opened from outside it (commands, the viewer's related files). */\nexport const useFilesDialogs = create<FilesDialogsState>()((set) => ({\n move: null,\n openMove: (folder = null) => set({ move: { folder } }),\n closeMove: () => set({ move: null }),\n bulkTagsOpen: false,\n setBulkTagsOpen: (bulkTagsOpen) => set({ bulkTagsOpen }),\n deleteRequest: null,\n requestDelete: (deleteRequest) => set({ deleteRequest }),\n exportOpen: false,\n setExportOpen: (exportOpen) => set({ exportOpen }),\n}))\n"]}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { ActionLink } from './chunk-U53SIJES.js';
3
2
  import { useShellBottomInset } from './chunk-UH7LTR2B.js';
3
+ import { ActionLink } from './chunk-U53SIJES.js';
4
4
  import { testIdOr, prefixedTestId } from './chunk-UP3GCNPM.js';
5
5
  import { Globe, Users, Lock, ChevronDown, LayoutGrid, Plus, Menu } from 'lucide-react';
6
6
  import { cn, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuLabel } from '@arbidocs/react/ui';
@@ -540,5 +540,5 @@ function installReloadPolicy(overrides = {}) {
540
540
  }
541
541
 
542
542
  export { DEFAULT_MOBILE_BARS_LABELS, DEFAULT_WORKSPACE_KIND_LABELS, DEFAULT_WORKSPACE_SWITCHER_LABELS, MobileAppBar, MobileTabBar, WorkspaceIdentity, WorkspaceSwitcher, hasUnsavedInput, installReloadPolicy, markBuildStale, prefetchChunk, requestReload, workspaceKindColor, workspaceKindMeta };
543
- //# sourceMappingURL=chunk-2UP73FZT.js.map
544
- //# sourceMappingURL=chunk-2UP73FZT.js.map
543
+ //# sourceMappingURL=chunk-VNFNIHHJ.js.map
544
+ //# sourceMappingURL=chunk-VNFNIHHJ.js.map