@arbidocs/react 0.5.110 → 0.5.112

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 (1011) hide show
  1. package/dist/PdfViewerImpl-QUSDLNNM.cjs +380 -0
  2. package/dist/PdfViewerImpl-QUSDLNNM.cjs.map +1 -0
  3. package/dist/{PdfViewer.d-bQH9yxFg.d.cts → PdfViewerImpl.d-B28hLEuj.d.ts} +8 -1
  4. package/dist/account/client.js +96 -0
  5. package/dist/account/client.js.map +7 -0
  6. package/dist/account/delete.js +70 -0
  7. package/dist/account/delete.js.map +7 -0
  8. package/dist/account/didit.js +34 -0
  9. package/dist/account/didit.js.map +7 -0
  10. package/dist/account/dismissed-tips.js +33 -0
  11. package/dist/account/dismissed-tips.js.map +7 -0
  12. package/dist/account/email.js +84 -0
  13. package/dist/account/email.js.map +7 -0
  14. package/dist/account/entitlements.js +47 -0
  15. package/dist/account/entitlements.js.map +7 -0
  16. package/dist/account/identity.js +270 -0
  17. package/dist/account/identity.js.map +7 -0
  18. package/dist/account/index.js +93 -0
  19. package/dist/account/index.js.map +7 -0
  20. package/dist/account/notifications.js +59 -0
  21. package/dist/account/notifications.js.map +7 -0
  22. package/dist/account/password.js +103 -0
  23. package/dist/account/password.js.map +7 -0
  24. package/dist/account/profile.js +116 -0
  25. package/dist/account/profile.js.map +7 -0
  26. package/dist/account/recovery.js +13 -0
  27. package/dist/account/recovery.js.map +7 -0
  28. package/dist/account/relevance.js +82 -0
  29. package/dist/account/relevance.js.map +7 -0
  30. package/dist/account/sessions.js +37 -0
  31. package/dist/account/sessions.js.map +7 -0
  32. package/dist/account/settings.js +39 -0
  33. package/dist/account/settings.js.map +7 -0
  34. package/dist/account/table-views.js +16 -0
  35. package/dist/account/table-views.js.map +7 -0
  36. package/dist/ai/AiAnswer.js +83 -0
  37. package/dist/ai/AiAnswer.js.map +7 -0
  38. package/dist/ai/AiMarkdown.js +40 -0
  39. package/dist/ai/AiMarkdown.js.map +7 -0
  40. package/dist/ai/ArtifactCanvas.js +193 -0
  41. package/dist/ai/ArtifactCanvas.js.map +7 -0
  42. package/dist/ai/CitationRenderer.js +413 -0
  43. package/dist/ai/CitationRenderer.js.map +7 -0
  44. package/dist/{chunk-WL2Y2T47.js → ai/MarkdownRenderer.js} +35 -101
  45. package/dist/ai/MarkdownRenderer.js.map +7 -0
  46. package/dist/ai/MessageArtifactCard.js +75 -0
  47. package/dist/ai/MessageArtifactCard.js.map +7 -0
  48. package/dist/ai/PassageCard.js +79 -0
  49. package/dist/ai/PassageCard.js.map +7 -0
  50. package/dist/ai/engine.js +110 -0
  51. package/dist/ai/engine.js.map +7 -0
  52. package/dist/ai/index.js +63 -0
  53. package/dist/ai/index.js.map +7 -0
  54. package/dist/ai/markdown-base-components.js +37 -0
  55. package/dist/ai/markdown-base-components.js.map +7 -0
  56. package/dist/ai/markdown-streaming-context.js +6 -0
  57. package/dist/ai/markdown-streaming-context.js.map +7 -0
  58. package/dist/{chunk-VSCU7K4V.js → ai/normalize-citations.js} +12 -19
  59. package/dist/ai/normalize-citations.js.map +7 -0
  60. package/dist/ai/redline.js +41 -0
  61. package/dist/ai/redline.js.map +7 -0
  62. package/dist/ai/split-markdown-blocks.js +40 -0
  63. package/dist/ai/split-markdown-blocks.js.map +7 -0
  64. package/dist/{chunk-UW2SGTI5.js → ai/stored-markdown.js} +41 -93
  65. package/dist/ai/stored-markdown.js.map +7 -0
  66. package/dist/annotations/AnnotationPageOverlay.js +807 -0
  67. package/dist/annotations/AnnotationPageOverlay.js.map +7 -0
  68. package/dist/annotations/AnnotationToolbar.js +398 -0
  69. package/dist/annotations/AnnotationToolbar.js.map +7 -0
  70. package/dist/annotations/FreezeDialog.js +170 -0
  71. package/dist/annotations/FreezeDialog.js.map +7 -0
  72. package/dist/annotations/ProductionDialog.js +354 -0
  73. package/dist/annotations/ProductionDialog.js.map +7 -0
  74. package/dist/annotations/controller.js +49 -0
  75. package/dist/annotations/controller.js.map +7 -0
  76. package/dist/annotations/freeze/browser.js +21 -0
  77. package/dist/annotations/freeze/browser.js.map +7 -0
  78. package/dist/annotations/freeze/bundle.js +201 -0
  79. package/dist/annotations/freeze/bundle.js.map +7 -0
  80. package/dist/annotations/freeze/coords.js +37 -0
  81. package/dist/annotations/freeze/coords.js.map +7 -0
  82. package/dist/annotations/freeze/freeze.js +261 -0
  83. package/dist/annotations/freeze/freeze.js.map +7 -0
  84. package/dist/annotations/freeze/hash.js +28 -0
  85. package/dist/annotations/freeze/hash.js.map +7 -0
  86. package/dist/annotations/freeze/index-page.js +78 -0
  87. package/dist/annotations/freeze/index-page.js.map +7 -0
  88. package/dist/annotations/freeze/index.d.ts +1 -1
  89. package/dist/annotations/freeze/index.js +28 -22
  90. package/dist/annotations/freeze/index.js.map +7 -1
  91. package/dist/annotations/freeze/raster.js +208 -0
  92. package/dist/annotations/freeze/raster.js.map +7 -0
  93. package/dist/annotations/freeze/stamp.js +117 -0
  94. package/dist/annotations/freeze/stamp.js.map +7 -0
  95. package/dist/annotations/freeze/types.js +14 -0
  96. package/dist/annotations/freeze/types.js.map +7 -0
  97. package/dist/annotations/freeze/vector.js +283 -0
  98. package/dist/annotations/freeze/vector.js.map +7 -0
  99. package/dist/annotations/geometry.js +81 -0
  100. package/dist/annotations/geometry.js.map +7 -0
  101. package/dist/annotations/index.js +125 -6
  102. package/dist/annotations/index.js.map +7 -1
  103. package/dist/annotations/merge.js +53 -0
  104. package/dist/annotations/merge.js.map +7 -0
  105. package/dist/{chunk-T3USOSVN.js → annotations/model.js} +23 -16
  106. package/dist/annotations/model.js.map +7 -0
  107. package/dist/annotations/overlay-geometry.js +41 -0
  108. package/dist/annotations/overlay-geometry.js.map +7 -0
  109. package/dist/annotations/redaction-log.js +33 -0
  110. package/dist/annotations/redaction-log.js.map +7 -0
  111. package/dist/annotations/selection-marks.js +122 -0
  112. package/dist/annotations/selection-marks.js.map +7 -0
  113. package/dist/annotations/state.js +140 -0
  114. package/dist/annotations/state.js.map +7 -0
  115. package/dist/annotations/store.js +49 -0
  116. package/dist/annotations/store.js.map +7 -0
  117. package/dist/annotations/useAnnotationLayer.js +306 -0
  118. package/dist/annotations/useAnnotationLayer.js.map +7 -0
  119. package/dist/annotations/useAnnotationShortcuts.js +31 -0
  120. package/dist/annotations/useAnnotationShortcuts.js.map +7 -0
  121. package/dist/annotations/useTextSelectionMarks.js +100 -0
  122. package/dist/annotations/useTextSelectionMarks.js.map +7 -0
  123. package/dist/artifacts/artifact-kind.js +19 -0
  124. package/dist/artifacts/artifact-kind.js.map +7 -0
  125. package/dist/artifacts/index.cjs +13 -13
  126. package/dist/artifacts/index.js +89 -571
  127. package/dist/artifacts/index.js.map +7 -1
  128. package/dist/{chunk-WUTL62MC.js → artifacts/normalize-markdown.js} +12 -14
  129. package/dist/artifacts/normalize-markdown.js.map +7 -0
  130. package/dist/artifacts/redline-core.js +12 -3
  131. package/dist/artifacts/redline-core.js.map +7 -1
  132. package/dist/{chunk-74N436VK.js → artifacts/redline-diff.js} +10 -9
  133. package/dist/artifacts/redline-diff.js.map +7 -0
  134. package/dist/artifacts/redline-engine.js +14 -0
  135. package/dist/artifacts/redline-engine.js.map +7 -0
  136. package/dist/artifacts/renderArtifactMarkdown.js +9 -0
  137. package/dist/artifacts/renderArtifactMarkdown.js.map +7 -0
  138. package/dist/artifacts/useArtifactEditSession.js +183 -0
  139. package/dist/artifacts/useArtifactEditSession.js.map +7 -0
  140. package/dist/artifacts/useArtifactSession.js +173 -0
  141. package/dist/artifacts/useArtifactSession.js.map +7 -0
  142. package/dist/artifacts/useArtifactSource.js +16 -0
  143. package/dist/artifacts/useArtifactSource.js.map +7 -0
  144. package/dist/artifacts/useArtifactText.js +78 -0
  145. package/dist/artifacts/useArtifactText.js.map +7 -0
  146. package/dist/artifacts/useRedline.js +65 -0
  147. package/dist/artifacts/useRedline.js.map +7 -0
  148. package/dist/artifacts/useStreamedArtifact.js +74 -0
  149. package/dist/artifacts/useStreamedArtifact.js.map +7 -0
  150. package/dist/artifacts/versions.js +68 -0
  151. package/dist/artifacts/versions.js.map +7 -0
  152. package/dist/billing.js +200 -0
  153. package/dist/billing.js.map +7 -0
  154. package/dist/boot-timeout.js +19 -0
  155. package/dist/boot-timeout.js.map +7 -0
  156. package/dist/calendar/accounts.js +213 -0
  157. package/dist/calendar/accounts.js.map +7 -0
  158. package/dist/calendar/hooks.js +409 -0
  159. package/dist/calendar/hooks.js.map +7 -0
  160. package/dist/calendar/index.js +31 -0
  161. package/dist/calendar/index.js.map +7 -0
  162. package/dist/calendar/keys.js +5 -0
  163. package/dist/calendar/keys.js.map +7 -0
  164. package/dist/calendar/offline/outbox.js +231 -0
  165. package/dist/calendar/offline/outbox.js.map +7 -0
  166. package/dist/calendar/offline/runtime.js +109 -0
  167. package/dist/calendar/offline/runtime.js.map +7 -0
  168. package/dist/calendar/offline/support.js +41 -0
  169. package/dist/calendar/offline/support.js.map +7 -0
  170. package/dist/calendar/support.js +34 -0
  171. package/dist/calendar/support.js.map +7 -0
  172. package/dist/calls/actions.js +226 -0
  173. package/dist/calls/actions.js.map +7 -0
  174. package/dist/calls/events.js +138 -0
  175. package/dist/calls/events.js.map +7 -0
  176. package/dist/calls/gate.js +19 -0
  177. package/dist/calls/gate.js.map +7 -0
  178. package/dist/calls/hooks.js +115 -0
  179. package/dist/calls/hooks.js.map +7 -0
  180. package/dist/calls/in-call-chat.js +132 -0
  181. package/dist/calls/in-call-chat.js.map +7 -0
  182. package/dist/calls/index.js +24 -0
  183. package/dist/calls/index.js.map +7 -0
  184. package/dist/calls/keys.js +17 -0
  185. package/dist/calls/keys.js.map +7 -0
  186. package/dist/calls/livekit/index.cjs +48 -48
  187. package/dist/calls/livekit/index.js +6 -958
  188. package/dist/calls/livekit/index.js.map +7 -1
  189. package/dist/calls/livekit/room.js +98 -0
  190. package/dist/calls/livekit/room.js.map +7 -0
  191. package/dist/calls/livekit/useCallRecorder.js +219 -0
  192. package/dist/calls/livekit/useCallRecorder.js.map +7 -0
  193. package/dist/calls/livekit/useCallTranscriber.js +309 -0
  194. package/dist/calls/livekit/useCallTranscriber.js.map +7 -0
  195. package/dist/calls/livekit/useHostMuteNotice.js +29 -0
  196. package/dist/calls/livekit/useHostMuteNotice.js.map +7 -0
  197. package/dist/calls/livekit/useInCallChat.js +161 -0
  198. package/dist/calls/livekit/useInCallChat.js.map +7 -0
  199. package/dist/calls/livekit/useWebinar.js +239 -0
  200. package/dist/calls/livekit/useWebinar.js.map +7 -0
  201. package/dist/calls/meeting-chat.js +149 -0
  202. package/dist/calls/meeting-chat.js.map +7 -0
  203. package/dist/calls/moderation.js +50 -0
  204. package/dist/calls/moderation.js.map +7 -0
  205. package/dist/calls/open-meeting-chat.js +29 -0
  206. package/dist/calls/open-meeting-chat.js.map +7 -0
  207. package/dist/calls/read-only.js +24 -0
  208. package/dist/calls/read-only.js.map +7 -0
  209. package/dist/calls/recording-media.js +218 -0
  210. package/dist/calls/recording-media.js.map +7 -0
  211. package/dist/calls/recording-playback.js +260 -0
  212. package/dist/calls/recording-playback.js.map +7 -0
  213. package/dist/calls/recording.js +268 -0
  214. package/dist/calls/recording.js.map +7 -0
  215. package/dist/calls/save-to-thread.js +80 -0
  216. package/dist/calls/save-to-thread.js.map +7 -0
  217. package/dist/calls/session.js +134 -0
  218. package/dist/calls/session.js.map +7 -0
  219. package/dist/calls/transcript-format.js +147 -0
  220. package/dist/calls/transcript-format.js.map +7 -0
  221. package/dist/calls/transcription.js +101 -0
  222. package/dist/calls/transcription.js.map +7 -0
  223. package/dist/calls/webinar.js +71 -0
  224. package/dist/calls/webinar.js.map +7 -0
  225. package/dist/charge-watch.js +71 -0
  226. package/dist/charge-watch.js.map +7 -0
  227. package/dist/chat/ChatBubble.js +146 -0
  228. package/dist/chat/ChatBubble.js.map +7 -0
  229. package/dist/chat/ConversationScope.js +30 -0
  230. package/dist/chat/ConversationScope.js.map +7 -0
  231. package/dist/chat/active-config.js +20 -0
  232. package/dist/chat/active-config.js.map +7 -0
  233. package/dist/chat/agent-chat-owner.js +25 -0
  234. package/dist/chat/agent-chat-owner.js.map +7 -0
  235. package/dist/chat/chat-artifacts.js +64 -0
  236. package/dist/chat/chat-artifacts.js.map +7 -0
  237. package/dist/chat/citations.js +32 -0
  238. package/dist/chat/citations.js.map +7 -0
  239. package/dist/chat/config-model.js +10 -0
  240. package/dist/chat/config-model.js.map +7 -0
  241. package/dist/chat/conversation-cache.js +676 -0
  242. package/dist/chat/conversation-cache.js.map +7 -0
  243. package/dist/chat/conversation-events.js +57 -0
  244. package/dist/chat/conversation-events.js.map +7 -0
  245. package/dist/chat/conversation-mentions.js +58 -0
  246. package/dist/chat/conversation-mentions.js.map +7 -0
  247. package/dist/chat/conversation-workspace.js +58 -0
  248. package/dist/chat/conversation-workspace.js.map +7 -0
  249. package/dist/chat/mentions.js +116 -0
  250. package/dist/chat/mentions.js.map +7 -0
  251. package/dist/chat/open-document.js +106 -0
  252. package/dist/chat/open-document.js.map +7 -0
  253. package/dist/chat/orphaned.js +44 -0
  254. package/dist/chat/orphaned.js.map +7 -0
  255. package/dist/chat/pendingFirstTurn.js +30 -0
  256. package/dist/chat/pendingFirstTurn.js.map +7 -0
  257. package/dist/chat/reply-target.js +12 -0
  258. package/dist/chat/reply-target.js.map +7 -0
  259. package/dist/chat/run-finished.js +28 -0
  260. package/dist/chat/run-finished.js.map +7 -0
  261. package/dist/chat/run-state.js +91 -0
  262. package/dist/chat/run-state.js.map +7 -0
  263. package/dist/chat/stream-handlers.js +419 -0
  264. package/dist/chat/stream-handlers.js.map +7 -0
  265. package/dist/chat/thread-binding.js +76 -0
  266. package/dist/chat/thread-binding.js.map +7 -0
  267. package/dist/chat/thread-document.js +53 -0
  268. package/dist/chat/thread-document.js.map +7 -0
  269. package/dist/chat/turn-control.js +79 -0
  270. package/dist/chat/turn-control.js.map +7 -0
  271. package/dist/chat/useAgentRunControl.js +36 -0
  272. package/dist/chat/useAgentRunControl.js.map +7 -0
  273. package/dist/chat/useAnswerAgentQuestion.js +19 -0
  274. package/dist/chat/useAnswerAgentQuestion.js.map +7 -0
  275. package/dist/chat/useAskAgain.js +32 -0
  276. package/dist/chat/useAskAgain.js.map +7 -0
  277. package/dist/chat/useAutoSendDraft.js +17 -0
  278. package/dist/chat/useAutoSendDraft.js.map +7 -0
  279. package/dist/chat/useBranchNavigation.js +97 -0
  280. package/dist/chat/useBranchNavigation.js.map +7 -0
  281. package/dist/chat/useConnectRunStream.js +169 -0
  282. package/dist/chat/useConnectRunStream.js.map +7 -0
  283. package/dist/chat/useConversation.js +431 -0
  284. package/dist/chat/useConversation.js.map +7 -0
  285. package/dist/chat/useConversationActions.js +662 -0
  286. package/dist/chat/useConversationActions.js.map +7 -0
  287. package/dist/chat/useConversationData.js +143 -0
  288. package/dist/chat/useConversationData.js.map +7 -0
  289. package/dist/chat/useConversationDocuments.js +41 -0
  290. package/dist/chat/useConversationDocuments.js.map +7 -0
  291. package/dist/chat/useConversationSettings.js +78 -0
  292. package/dist/chat/useConversationSettings.js.map +7 -0
  293. package/dist/chat/useConversationTurn.js +31 -0
  294. package/dist/chat/useConversationTurn.js.map +7 -0
  295. package/dist/chat/useConversationWorkspace.js +12 -0
  296. package/dist/chat/useConversationWorkspace.js.map +7 -0
  297. package/dist/chat/useDeleteMessage.js +15 -0
  298. package/dist/chat/useDeleteMessage.js.map +7 -0
  299. package/dist/chat/useDocumentAutoAdd.js +73 -0
  300. package/dist/chat/useDocumentAutoAdd.js.map +7 -0
  301. package/dist/chat/useMessageTimer.js +39 -0
  302. package/dist/chat/useMessageTimer.js.map +7 -0
  303. package/dist/chat/useThinkingContent.js +67 -0
  304. package/dist/chat/useThinkingContent.js.map +7 -0
  305. package/dist/chat/useThreadDocument.js +61 -0
  306. package/dist/chat/useThreadDocument.js.map +7 -0
  307. package/dist/chat/workflow-run-titles.js +50 -0
  308. package/dist/chat/workflow-run-titles.js.map +7 -0
  309. package/dist/{chunk-W2FATOTX.cjs → chunk-3JAEX57E.cjs} +4 -4
  310. package/dist/{chunk-W2FATOTX.cjs.map → chunk-3JAEX57E.cjs.map} +1 -1
  311. package/dist/{chunk-HD5H2PPP.cjs → chunk-5TRUFWKT.cjs} +66 -66
  312. package/dist/{chunk-HD5H2PPP.cjs.map → chunk-5TRUFWKT.cjs.map} +1 -1
  313. package/dist/{chunk-Z3W4XFWB.cjs → chunk-C72FSQUE.cjs} +3 -3
  314. package/dist/{chunk-Z3W4XFWB.cjs.map → chunk-C72FSQUE.cjs.map} +1 -1
  315. package/dist/{chunk-LBAG7KL7.cjs → chunk-FQVNZCTD.cjs} +3 -3
  316. package/dist/{chunk-LBAG7KL7.cjs.map → chunk-FQVNZCTD.cjs.map} +1 -1
  317. package/dist/{chunk-RVUGSM65.cjs → chunk-GKGAPU6T.cjs} +44 -44
  318. package/dist/{chunk-RVUGSM65.cjs.map → chunk-GKGAPU6T.cjs.map} +1 -1
  319. package/dist/{chunk-7LIMHY56.cjs → chunk-O32T7XRD.cjs} +3 -3
  320. package/dist/{chunk-7LIMHY56.cjs.map → chunk-O32T7XRD.cjs.map} +1 -1
  321. package/dist/chunk-PWGSIM3F.cjs +291 -0
  322. package/dist/chunk-PWGSIM3F.cjs.map +1 -0
  323. package/dist/chunk-QP3WQSAA.cjs +23 -0
  324. package/dist/chunk-QP3WQSAA.cjs.map +1 -0
  325. package/dist/chunk-T5FZICXN.cjs +50 -0
  326. package/dist/chunk-T5FZICXN.cjs.map +1 -0
  327. package/dist/{chunk-QF2BW6HZ.cjs → chunk-UDDJIUHJ.cjs} +38 -38
  328. package/dist/{chunk-QF2BW6HZ.cjs.map → chunk-UDDJIUHJ.cjs.map} +1 -1
  329. package/dist/{chunk-5HDKL6XB.cjs → chunk-YMB6XUR2.cjs} +57 -57
  330. package/dist/{chunk-5HDKL6XB.cjs.map → chunk-YMB6XUR2.cjs.map} +1 -1
  331. package/dist/config/config-hooks.js +209 -0
  332. package/dist/config/config-hooks.js.map +7 -0
  333. package/dist/connectivity.js +72 -0
  334. package/dist/connectivity.js.map +7 -0
  335. package/dist/connectors/hooks.js +263 -0
  336. package/dist/connectors/hooks.js.map +7 -0
  337. package/dist/connectors/index.js +28 -0
  338. package/dist/connectors/index.js.map +7 -0
  339. package/dist/contacts.js +100 -0
  340. package/dist/contacts.js.map +7 -0
  341. package/dist/conversation-list.js +65 -0
  342. package/dist/conversation-list.js.map +7 -0
  343. package/dist/databases.js +195 -0
  344. package/dist/databases.js.map +7 -0
  345. package/dist/datasets/aggregate.js +281 -0
  346. package/dist/datasets/aggregate.js.map +7 -0
  347. package/dist/datasets/index.js +122 -0
  348. package/dist/datasets/index.js.map +7 -0
  349. package/dist/datasets/members.js +27 -0
  350. package/dist/datasets/members.js.map +7 -0
  351. package/dist/datasets/panel.js +44 -0
  352. package/dist/datasets/panel.js.map +7 -0
  353. package/dist/datasets/registry.js +47 -0
  354. package/dist/datasets/registry.js.map +7 -0
  355. package/dist/datasets/rows-source.js +44 -0
  356. package/dist/datasets/rows-source.js.map +7 -0
  357. package/dist/datasets/sources/activity.js +83 -0
  358. package/dist/datasets/sources/activity.js.map +7 -0
  359. package/dist/datasets/sources/conversations.js +74 -0
  360. package/dist/datasets/sources/conversations.js.map +7 -0
  361. package/dist/datasets/sources/database.js +209 -0
  362. package/dist/datasets/sources/database.js.map +7 -0
  363. package/dist/datasets/sources/documents.js +93 -0
  364. package/dist/datasets/sources/documents.js.map +7 -0
  365. package/dist/datasets/sources/facts.js +56 -0
  366. package/dist/datasets/sources/facts.js.map +7 -0
  367. package/dist/datasets/sources/projects.js +117 -0
  368. package/dist/datasets/sources/projects.js.map +7 -0
  369. package/dist/datasets/sources/tags.js +67 -0
  370. package/dist/datasets/sources/tags.js.map +7 -0
  371. package/dist/datasets/sources/usage.js +268 -0
  372. package/dist/datasets/sources/usage.js.map +7 -0
  373. package/dist/datasets/sources/workflows.js +91 -0
  374. package/dist/datasets/sources/workflows.js.map +7 -0
  375. package/dist/datasets/sources/workspaces.js +67 -0
  376. package/dist/datasets/sources/workspaces.js.map +7 -0
  377. package/dist/datasets/store.js +194 -0
  378. package/dist/datasets/store.js.map +7 -0
  379. package/dist/datasets/types.js +14 -0
  380. package/dist/datasets/types.js.map +7 -0
  381. package/dist/directmessages/ConversationList.js +148 -0
  382. package/dist/directmessages/ConversationList.js.map +7 -0
  383. package/dist/directmessages/DateSeparator.js +8 -0
  384. package/dist/directmessages/DateSeparator.js.map +7 -0
  385. package/dist/directmessages/DmAvatar.js +29 -0
  386. package/dist/directmessages/DmAvatar.js.map +7 -0
  387. package/dist/directmessages/DmComposer.js +201 -0
  388. package/dist/directmessages/DmComposer.js.map +7 -0
  389. package/dist/directmessages/arrivals.js +29 -0
  390. package/dist/directmessages/arrivals.js.map +7 -0
  391. package/dist/directmessages/chat-cache.js +192 -0
  392. package/dist/directmessages/chat-cache.js.map +7 -0
  393. package/dist/directmessages/grouping.js +26 -0
  394. package/dist/directmessages/grouping.js.map +7 -0
  395. package/dist/directmessages/index.js +81 -0
  396. package/dist/directmessages/index.js.map +7 -0
  397. package/dist/directmessages/useChats.js +266 -0
  398. package/dist/directmessages/useChats.js.map +7 -0
  399. package/dist/directmessages/utils.js +23 -0
  400. package/dist/directmessages/utils.js.map +7 -0
  401. package/dist/document-tools/can-annotate.js +7 -0
  402. package/dist/document-tools/can-annotate.js.map +7 -0
  403. package/dist/document-tools/core.cjs +99 -99
  404. package/dist/document-tools/core.d.ts +2 -2
  405. package/dist/document-tools/core.js +218 -12
  406. package/dist/document-tools/core.js.map +7 -1
  407. package/dist/document-tools/document-pdf.js +76 -0
  408. package/dist/document-tools/document-pdf.js.map +7 -0
  409. package/dist/document-tools/environment.js +136 -0
  410. package/dist/document-tools/environment.js.map +7 -0
  411. package/dist/document-tools/file-shares.js +112 -0
  412. package/dist/document-tools/file-shares.js.map +7 -0
  413. package/dist/document-tools/frozen-copy.js +27 -0
  414. package/dist/document-tools/frozen-copy.js.map +7 -0
  415. package/dist/document-tools/index.cjs +101 -101
  416. package/dist/document-tools/index.d.ts +1 -1
  417. package/dist/document-tools/index.js +26 -148
  418. package/dist/document-tools/index.js.map +7 -1
  419. package/dist/document-tools/markup-download.js +51 -0
  420. package/dist/document-tools/markup-download.js.map +7 -0
  421. package/dist/document-tools/markup-store.js +138 -0
  422. package/dist/document-tools/markup-store.js.map +7 -0
  423. package/dist/document-tools/markup-transfer.js +88 -0
  424. package/dist/document-tools/markup-transfer.js.map +7 -0
  425. package/dist/document-tools/production.js +147 -0
  426. package/dist/document-tools/production.js.map +7 -0
  427. package/dist/document-tools/saved-signature.js +90 -0
  428. package/dist/document-tools/saved-signature.js.map +7 -0
  429. package/dist/document-tools/signature-requests.js +310 -0
  430. package/dist/document-tools/signature-requests.js.map +7 -0
  431. package/dist/document-tools/signing.js +127 -0
  432. package/dist/document-tools/signing.js.map +7 -0
  433. package/dist/document-tools/useDocumentBytes.js +38 -0
  434. package/dist/document-tools/useDocumentBytes.js.map +7 -0
  435. package/dist/document-tools/useDocumentMarkup.js +154 -0
  436. package/dist/document-tools/useDocumentMarkup.js.map +7 -0
  437. package/dist/document-tools/useIsOnline.js +13 -0
  438. package/dist/document-tools/useIsOnline.js.map +7 -0
  439. package/dist/document-tools/verification.js +60 -0
  440. package/dist/document-tools/verification.js.map +7 -0
  441. package/dist/documents/DocumentReview.js +220 -0
  442. package/dist/documents/DocumentReview.js.map +7 -0
  443. package/dist/documents/DraftTitleControls.js +41 -0
  444. package/dist/documents/DraftTitleControls.js.map +7 -0
  445. package/dist/documents/InlineMicButton.js +90 -0
  446. package/dist/documents/InlineMicButton.js.map +7 -0
  447. package/dist/documents/MicRecordingOverlay.js +29 -0
  448. package/dist/documents/MicRecordingOverlay.js.map +7 -0
  449. package/dist/documents/MicWaveformIndicator.js +68 -0
  450. package/dist/documents/MicWaveformIndicator.js.map +7 -0
  451. package/dist/documents/PhotoCapture.js +120 -0
  452. package/dist/documents/PhotoCapture.js.map +7 -0
  453. package/dist/documents/VideoCapture.js +129 -0
  454. package/dist/documents/VideoCapture.js.map +7 -0
  455. package/dist/documents/VoiceNoteRecorder.js +166 -0
  456. package/dist/documents/VoiceNoteRecorder.js.map +7 -0
  457. package/dist/documents/audio-segmenter.js +63 -0
  458. package/dist/documents/audio-segmenter.js.map +7 -0
  459. package/dist/documents/capture-frame.js +21 -0
  460. package/dist/documents/capture-frame.js.map +7 -0
  461. package/dist/documents/chunked-recorder.js +190 -0
  462. package/dist/documents/chunked-recorder.js.map +7 -0
  463. package/dist/documents/document-download.js +53 -0
  464. package/dist/documents/document-download.js.map +7 -0
  465. package/dist/documents/document-fields.js +109 -0
  466. package/dist/documents/document-fields.js.map +7 -0
  467. package/dist/documents/documents-cache.js +110 -0
  468. package/dist/documents/documents-cache.js.map +7 -0
  469. package/dist/documents/documents-data.js +128 -0
  470. package/dist/documents/documents-data.js.map +7 -0
  471. package/dist/documents/documents-loader.js +113 -0
  472. package/dist/documents/documents-loader.js.map +7 -0
  473. package/dist/documents/documents-writes.js +448 -0
  474. package/dist/documents/documents-writes.js.map +7 -0
  475. package/dist/documents/format-elapsed.js +10 -0
  476. package/dist/documents/format-elapsed.js.map +7 -0
  477. package/dist/documents/has-video-track.js +26 -0
  478. package/dist/documents/has-video-track.js.map +7 -0
  479. package/dist/documents/index.js +266 -0
  480. package/dist/documents/index.js.map +7 -0
  481. package/dist/documents/media-error.js +18 -0
  482. package/dist/documents/media-error.js.map +7 -0
  483. package/dist/documents/offline-documents.js +160 -0
  484. package/dist/documents/offline-documents.js.map +7 -0
  485. package/dist/documents/pending-sync.js +210 -0
  486. package/dist/documents/pending-sync.js.map +7 -0
  487. package/dist/documents/processing-live.js +122 -0
  488. package/dist/documents/processing-live.js.map +7 -0
  489. package/dist/documents/processing-order.js +59 -0
  490. package/dist/documents/processing-order.js.map +7 -0
  491. package/dist/documents/processing-settle.js +21 -0
  492. package/dist/documents/processing-settle.js.map +7 -0
  493. package/dist/documents/related-documents.js +133 -0
  494. package/dist/documents/related-documents.js.map +7 -0
  495. package/dist/documents/support.js +29 -0
  496. package/dist/documents/support.js.map +7 -0
  497. package/dist/documents/upload-files.js +169 -0
  498. package/dist/documents/upload-files.js.map +7 -0
  499. package/dist/documents/useAudioRecorder.js +315 -0
  500. package/dist/documents/useAudioRecorder.js.map +7 -0
  501. package/dist/documents/useCameraStream.js +35 -0
  502. package/dist/documents/useCameraStream.js.map +7 -0
  503. package/dist/documents/useDocumentThumbnails.js +71 -0
  504. package/dist/documents/useDocumentThumbnails.js.map +7 -0
  505. package/dist/documents/useDownloadDocuments.js +90 -0
  506. package/dist/documents/useDownloadDocuments.js.map +7 -0
  507. package/dist/documents/usePassageQuotes.js +37 -0
  508. package/dist/documents/usePassageQuotes.js.map +7 -0
  509. package/dist/documents/useUploadFiles.js +165 -0
  510. package/dist/documents/useUploadFiles.js.map +7 -0
  511. package/dist/documents/useUploadFromUrls.js +63 -0
  512. package/dist/documents/useUploadFromUrls.js.map +7 -0
  513. package/dist/documents/useVideoRecorder.js +62 -0
  514. package/dist/documents/useVideoRecorder.js.map +7 -0
  515. package/dist/entities/AgentMarkers.js +61 -0
  516. package/dist/entities/AgentMarkers.js.map +7 -0
  517. package/dist/entities/DocumentEntity.js +125 -0
  518. package/dist/entities/DocumentEntity.js.map +7 -0
  519. package/dist/entities/EntityPill.js +250 -0
  520. package/dist/entities/EntityPill.js.map +7 -0
  521. package/dist/entities/ProjectEntity.js +61 -0
  522. package/dist/entities/ProjectEntity.js.map +7 -0
  523. package/dist/entities/ShieldIcon.js +49 -0
  524. package/dist/entities/ShieldIcon.js.map +7 -0
  525. package/dist/entities/TagEntity.js +79 -0
  526. package/dist/entities/TagEntity.js.map +7 -0
  527. package/dist/entities/ThreadVisibilityIcon.js +15 -0
  528. package/dist/entities/ThreadVisibilityIcon.js.map +7 -0
  529. package/dist/entities/UserEntity.js +211 -0
  530. package/dist/entities/UserEntity.js.map +7 -0
  531. package/dist/entities/VerifiedBadge.js +19 -0
  532. package/dist/entities/VerifiedBadge.js.map +7 -0
  533. package/dist/entities/agent-avatar-colors.js +26 -0
  534. package/dist/entities/agent-avatar-colors.js.map +7 -0
  535. package/dist/entities/colors.js +64 -0
  536. package/dist/entities/colors.js.map +7 -0
  537. package/dist/entities/file-type.js +151 -0
  538. package/dist/entities/file-type.js.map +7 -0
  539. package/dist/entities/index.js +100 -0
  540. package/dist/entities/index.js.map +7 -0
  541. package/dist/entities/media-type.js +61 -0
  542. package/dist/entities/media-type.js.map +7 -0
  543. package/dist/entities/registry.js +385 -0
  544. package/dist/entities/registry.js.map +7 -0
  545. package/dist/entities/status.js +43 -0
  546. package/dist/entities/status.js.map +7 -0
  547. package/dist/entities/tag-kinds.js +23 -0
  548. package/dist/entities/tag-kinds.js.map +7 -0
  549. package/dist/entities/tag-types.js +44 -0
  550. package/dist/entities/tag-types.js.map +7 -0
  551. package/dist/entities/vocabulary.js +12 -0
  552. package/dist/entities/vocabulary.js.map +7 -0
  553. package/dist/entity-extraction.js +25 -0
  554. package/dist/entity-extraction.js.map +7 -0
  555. package/dist/facts-search.js +57 -0
  556. package/dist/facts-search.js.map +7 -0
  557. package/dist/facts.js +69 -0
  558. package/dist/facts.js.map +7 -0
  559. package/dist/hooks.js +320 -0
  560. package/dist/hooks.js.map +7 -0
  561. package/dist/host/ArbiHost.js +24 -0
  562. package/dist/host/ArbiHost.js.map +7 -0
  563. package/dist/host/assistant-copy.js +54 -0
  564. package/dist/host/assistant-copy.js.map +7 -0
  565. package/dist/host/config.js +9 -0
  566. package/dist/host/config.js.map +7 -0
  567. package/dist/host/context.js +10 -0
  568. package/dist/host/context.js.map +7 -0
  569. package/dist/host/features.js +144 -0
  570. package/dist/host/features.js.map +7 -0
  571. package/dist/host/index.js +12 -0
  572. package/dist/host/index.js.map +7 -0
  573. package/dist/{chunk-DPYBZDJB.js → host/merge.js} +7 -7
  574. package/dist/host/merge.js.map +7 -0
  575. package/dist/house-template.js +40 -0
  576. package/dist/house-template.js.map +7 -0
  577. package/dist/icons/AppleIcon.js +25 -0
  578. package/dist/icons/AppleIcon.js.map +7 -0
  579. package/dist/icons/ArbiBotHeadIcon.js +46 -0
  580. package/dist/icons/ArbiBotHeadIcon.js.map +7 -0
  581. package/dist/icons/ArbiIcon.js +24 -0
  582. package/dist/icons/ArbiIcon.js.map +7 -0
  583. package/dist/icons/AudIcon.js +56 -0
  584. package/dist/icons/AudIcon.js.map +7 -0
  585. package/dist/icons/ClaudeIcon.js +28 -0
  586. package/dist/icons/ClaudeIcon.js.map +7 -0
  587. package/dist/icons/DocIcon.js +56 -0
  588. package/dist/icons/DocIcon.js.map +7 -0
  589. package/dist/icons/EmlIcon.js +57 -0
  590. package/dist/icons/EmlIcon.js.map +7 -0
  591. package/dist/icons/FireworksIcon.js +47 -0
  592. package/dist/icons/FireworksIcon.js.map +7 -0
  593. package/dist/icons/GeminiIcon.js +37 -0
  594. package/dist/icons/GeminiIcon.js.map +7 -0
  595. package/dist/icons/GitHubIcon.js +32 -0
  596. package/dist/icons/GitHubIcon.js.map +7 -0
  597. package/dist/icons/GoogleIcon.js +53 -0
  598. package/dist/icons/GoogleIcon.js.map +7 -0
  599. package/dist/icons/HtmlIcon.js +56 -0
  600. package/dist/icons/HtmlIcon.js.map +7 -0
  601. package/dist/icons/ImgIcon.js +56 -0
  602. package/dist/icons/ImgIcon.js.map +7 -0
  603. package/dist/icons/LinkedInIcon.js +25 -0
  604. package/dist/icons/LinkedInIcon.js.map +7 -0
  605. package/dist/icons/OpenAIIcon.js +28 -0
  606. package/dist/icons/OpenAIIcon.js.map +7 -0
  607. package/dist/icons/PdfIcon.js +56 -0
  608. package/dist/icons/PdfIcon.js.map +7 -0
  609. package/dist/icons/ProviderIcon.js +42 -0
  610. package/dist/icons/ProviderIcon.js.map +7 -0
  611. package/dist/icons/TxtIcon.js +56 -0
  612. package/dist/icons/TxtIcon.js.map +7 -0
  613. package/dist/icons/VidIcon.js +56 -0
  614. package/dist/icons/VidIcon.js.map +7 -0
  615. package/dist/icons/XlsIcon.js +56 -0
  616. package/dist/icons/XlsIcon.js.map +7 -0
  617. package/dist/icons/arbi-mark.js +5 -0
  618. package/dist/icons/arbi-mark.js.map +7 -0
  619. package/dist/icons/colors.js +31 -0
  620. package/dist/icons/colors.js.map +7 -0
  621. package/dist/icons/file-type.js +105 -0
  622. package/dist/icons/file-type.js.map +7 -0
  623. package/dist/icons/index.js +55 -0
  624. package/dist/icons/index.js.map +7 -0
  625. package/dist/imagecrop/ImageCropModal.js +56 -0
  626. package/dist/imagecrop/ImageCropModal.js.map +7 -0
  627. package/dist/imagecrop/ImageCropper.js +100 -0
  628. package/dist/imagecrop/ImageCropper.js.map +7 -0
  629. package/dist/imagecrop/cropImage.js +43 -0
  630. package/dist/imagecrop/cropImage.js.map +7 -0
  631. package/dist/imagecrop/index.js +13 -0
  632. package/dist/imagecrop/index.js.map +7 -0
  633. package/dist/index.cjs +1689 -1619
  634. package/dist/index.cjs.map +1 -1
  635. package/dist/{index.d-BMhTH98a.d.ts → index.d-CYXcTKYt.d.ts} +1 -0
  636. package/dist/index.d.ts +38 -8
  637. package/dist/index.js +702 -17060
  638. package/dist/index.js.map +7 -1
  639. package/dist/lazy-chunk.d-B6YDLMKI.d.ts +31 -0
  640. package/dist/lazy-chunk.js +46 -0
  641. package/dist/lazy-chunk.js.map +7 -0
  642. package/dist/lib/collision-padding.js +13 -0
  643. package/dist/lib/collision-padding.js.map +7 -0
  644. package/dist/lib/format-friendly-date.js +55 -0
  645. package/dist/lib/format-friendly-date.js.map +7 -0
  646. package/dist/lib/format-relative-time.js +52 -0
  647. package/dist/lib/format-relative-time.js.map +7 -0
  648. package/dist/lib/markdown-to-text.js +35 -0
  649. package/dist/lib/markdown-to-text.js.map +7 -0
  650. package/dist/lib/toast-interaction.js +9 -0
  651. package/dist/lib/toast-interaction.js.map +7 -0
  652. package/dist/lib/utils.js +9 -0
  653. package/dist/lib/utils.js.map +7 -0
  654. package/dist/mail/client.js +103 -0
  655. package/dist/mail/client.js.map +7 -0
  656. package/dist/mail/document-attachment.js +38 -0
  657. package/dist/mail/document-attachment.js.map +7 -0
  658. package/dist/mail/filing.js +132 -0
  659. package/dist/mail/filing.js.map +7 -0
  660. package/dist/mail/hooks.js +393 -0
  661. package/dist/mail/hooks.js.map +7 -0
  662. package/dist/mail/index.js +120 -0
  663. package/dist/mail/index.js.map +7 -0
  664. package/dist/mail/offline/changes.js +258 -0
  665. package/dist/mail/offline/changes.js.map +7 -0
  666. package/dist/mail/offline/confirm-sign-out.js +37 -0
  667. package/dist/mail/offline/confirm-sign-out.js.map +7 -0
  668. package/dist/mail/offline/crypto.js +26 -0
  669. package/dist/mail/offline/crypto.js.map +7 -0
  670. package/dist/mail/offline/drafts.js +69 -0
  671. package/dist/mail/offline/drafts.js.map +7 -0
  672. package/dist/mail/offline/hooks.js +104 -0
  673. package/dist/mail/offline/hooks.js.map +7 -0
  674. package/dist/mail/offline/index.js +48 -0
  675. package/dist/mail/offline/index.js.map +7 -0
  676. package/dist/mail/offline/live.js +233 -0
  677. package/dist/mail/offline/live.js.map +7 -0
  678. package/dist/mail/offline/mailbox.js +191 -0
  679. package/dist/mail/offline/mailbox.js.map +7 -0
  680. package/dist/mail/offline/outbox.js +167 -0
  681. package/dist/mail/offline/outbox.js.map +7 -0
  682. package/dist/mail/offline/reads.js +159 -0
  683. package/dist/mail/offline/reads.js.map +7 -0
  684. package/dist/mail/offline/runtime.js +100 -0
  685. package/dist/mail/offline/runtime.js.map +7 -0
  686. package/dist/mail/offline/settings.js +84 -0
  687. package/dist/mail/offline/settings.js.map +7 -0
  688. package/dist/mail/offline/store.js +29 -0
  689. package/dist/mail/offline/store.js.map +7 -0
  690. package/dist/mail/offline/sync.js +251 -0
  691. package/dist/mail/offline/sync.js.map +7 -0
  692. package/dist/mail/offline/wipe.js +19 -0
  693. package/dist/mail/offline/wipe.js.map +7 -0
  694. package/dist/mail/thread-keys.js +53 -0
  695. package/dist/mail/thread-keys.js.map +7 -0
  696. package/dist/mail/threads.js +71 -0
  697. package/dist/mail/threads.js.map +7 -0
  698. package/dist/mail/useMailClient.js +42 -0
  699. package/dist/mail/useMailClient.js.map +7 -0
  700. package/dist/model-connections.js +58 -0
  701. package/dist/model-connections.js.map +7 -0
  702. package/dist/notifications/ActivityFeed.js +70 -0
  703. package/dist/notifications/ActivityFeed.js.map +7 -0
  704. package/dist/notifications/NotificationBell.js +200 -0
  705. package/dist/notifications/NotificationBell.js.map +7 -0
  706. package/dist/notifications/Toaster.js +24 -0
  707. package/dist/notifications/Toaster.js.map +7 -0
  708. package/dist/notifications/activity-types.js +65 -0
  709. package/dist/notifications/activity-types.js.map +7 -0
  710. package/dist/notifications/bell.js +24 -0
  711. package/dist/notifications/bell.js.map +7 -0
  712. package/dist/notifications/calendar-notifications.js +79 -0
  713. package/dist/notifications/calendar-notifications.js.map +7 -0
  714. package/dist/notifications/index.js +108 -0
  715. package/dist/notifications/index.js.map +7 -0
  716. package/dist/notifications/live.js +28 -0
  717. package/dist/notifications/live.js.map +7 -0
  718. package/dist/notifications/notification-types.js +127 -0
  719. package/dist/notifications/notification-types.js.map +7 -0
  720. package/dist/{chunk-BF5KW5ZI.js → notifications/notify-store.js} +24 -74
  721. package/dist/notifications/notify-store.js.map +7 -0
  722. package/dist/notifications/server-notifications.js +452 -0
  723. package/dist/notifications/server-notifications.js.map +7 -0
  724. package/dist/notifications/useNotifications.js +34 -0
  725. package/dist/notifications/useNotifications.js.map +7 -0
  726. package/dist/offline-store/network.js +11 -0
  727. package/dist/offline-store/network.js.map +7 -0
  728. package/dist/offline-store/store.js +136 -0
  729. package/dist/offline-store/store.js.map +7 -0
  730. package/dist/offline-store/wipe.js +8 -0
  731. package/dist/offline-store/wipe.js.map +7 -0
  732. package/dist/offline.js +58 -0
  733. package/dist/offline.js.map +7 -0
  734. package/dist/people.js +122 -0
  735. package/dist/people.js.map +7 -0
  736. package/dist/projects.js +30 -0
  737. package/dist/projects.js.map +7 -0
  738. package/dist/query-client.js +63 -0
  739. package/dist/query-client.js.map +7 -0
  740. package/dist/{query-keys.d-ChgpJLPF.d.ts → query-keys.d-B1Am9tIF.d.ts} +1 -1
  741. package/dist/{chunk-6H3O63TQ.js → query-keys.js} +19 -32
  742. package/dist/query-keys.js.map +7 -0
  743. package/dist/query-persist.js +66 -0
  744. package/dist/query-persist.js.map +7 -0
  745. package/dist/queued-writes.js +59 -0
  746. package/dist/queued-writes.js.map +7 -0
  747. package/dist/remote-control.js +67 -0
  748. package/dist/remote-control.js.map +7 -0
  749. package/dist/search/index.js +23 -0
  750. package/dist/search/index.js.map +7 -0
  751. package/dist/search/session.js +58 -0
  752. package/dist/search/session.js.map +7 -0
  753. package/dist/search/useSemanticSearch.js +82 -0
  754. package/dist/search/useSemanticSearch.js.map +7 -0
  755. package/dist/session/chat.js +512 -0
  756. package/dist/session/chat.js.map +7 -0
  757. package/dist/session/documents.js +196 -0
  758. package/dist/session/documents.js.map +7 -0
  759. package/dist/session/drafts.js +103 -0
  760. package/dist/session/drafts.js.map +7 -0
  761. package/dist/session/index.js +123 -0
  762. package/dist/session/index.js.map +7 -0
  763. package/dist/session/layout.js +339 -0
  764. package/dist/session/layout.js.map +7 -0
  765. package/dist/session/persist.js +106 -0
  766. package/dist/session/persist.js.map +7 -0
  767. package/dist/session/session-hooks.js +53 -0
  768. package/dist/session/session-hooks.js.map +7 -0
  769. package/dist/session/signed-in.js +36 -0
  770. package/dist/session/signed-in.js.map +7 -0
  771. package/dist/session/store.js +166 -0
  772. package/dist/session/store.js.map +7 -0
  773. package/dist/session/thread-tabs.js +121 -0
  774. package/dist/session/thread-tabs.js.map +7 -0
  775. package/dist/session/ui-state-storage.js +76 -0
  776. package/dist/session/ui-state-storage.js.map +7 -0
  777. package/dist/session/workspace.js +77 -0
  778. package/dist/session/workspace.js.map +7 -0
  779. package/dist/shell/index.cjs +37 -37
  780. package/dist/shell/index.js +43 -10
  781. package/dist/shell/index.js.map +7 -1
  782. package/dist/skill-pack.js +111 -0
  783. package/dist/skill-pack.js.map +7 -0
  784. package/dist/storage.js +186 -0
  785. package/dist/storage.js.map +7 -0
  786. package/dist/support/index.js +35 -0
  787. package/dist/support/index.js.map +7 -0
  788. package/dist/tags.js +204 -0
  789. package/dist/tags.js.map +7 -0
  790. package/dist/ui/DebouncedInput.js +109 -0
  791. package/dist/ui/DebouncedInput.js.map +7 -0
  792. package/dist/ui/DictateContext.js +8 -0
  793. package/dist/ui/DictateContext.js.map +7 -0
  794. package/dist/ui/IconToggle.js +79 -0
  795. package/dist/ui/IconToggle.js.map +7 -0
  796. package/dist/ui/VerifiedToggle.js +38 -0
  797. package/dist/ui/VerifiedToggle.js.map +7 -0
  798. package/dist/ui/VisibilityToggle.js +103 -0
  799. package/dist/ui/VisibilityToggle.js.map +7 -0
  800. package/dist/ui/avatar.js +40 -0
  801. package/dist/ui/avatar.js.map +7 -0
  802. package/dist/ui/badge.js +28 -0
  803. package/dist/ui/badge.js.map +7 -0
  804. package/dist/ui/button.js +48 -0
  805. package/dist/ui/button.js.map +7 -0
  806. package/dist/ui/card.js +90 -0
  807. package/dist/ui/card.js.map +7 -0
  808. package/dist/ui/checkbox.js +22 -0
  809. package/dist/ui/checkbox.js.map +7 -0
  810. package/dist/ui/collapsible.js +10 -0
  811. package/dist/ui/collapsible.js.map +7 -0
  812. package/dist/ui/command.js +103 -0
  813. package/dist/ui/command.js.map +7 -0
  814. package/dist/{chunk-YNNAJJ5Z.js → ui/dialog.js} +30 -68
  815. package/dist/ui/dialog.js.map +7 -0
  816. package/dist/{chunk-47CCGUWR.js → ui/dropdown-menu.js} +40 -45
  817. package/dist/ui/dropdown-menu.js.map +7 -0
  818. package/dist/ui/hover-card.js +36 -0
  819. package/dist/ui/hover-card.js.map +7 -0
  820. package/dist/ui/index.cjs +167 -154
  821. package/dist/ui/index.d.ts +2 -1
  822. package/dist/ui/index.js +290 -9
  823. package/dist/ui/index.js.map +7 -1
  824. package/dist/ui/input.js +65 -0
  825. package/dist/ui/input.js.map +7 -0
  826. package/dist/ui/label.js +16 -0
  827. package/dist/ui/label.js.map +7 -0
  828. package/dist/ui/mark-menu.js +300 -0
  829. package/dist/ui/mark-menu.js.map +7 -0
  830. package/dist/ui/popover.js +40 -0
  831. package/dist/ui/popover.js.map +7 -0
  832. package/dist/ui/portal-container.js +17 -0
  833. package/dist/ui/portal-container.js.map +7 -0
  834. package/dist/ui/progress.js +24 -0
  835. package/dist/ui/progress.js.map +7 -0
  836. package/dist/ui/radio-group.js +29 -0
  837. package/dist/ui/radio-group.js.map +7 -0
  838. package/dist/ui/scroll-area.js +39 -0
  839. package/dist/ui/scroll-area.js.map +7 -0
  840. package/dist/ui/select.js +130 -0
  841. package/dist/ui/select.js.map +7 -0
  842. package/dist/ui/separator.js +23 -0
  843. package/dist/ui/separator.js.map +7 -0
  844. package/dist/ui/slider.js +23 -0
  845. package/dist/ui/slider.js.map +7 -0
  846. package/dist/ui/switch.js +28 -0
  847. package/dist/ui/switch.js.map +7 -0
  848. package/dist/ui/table.js +75 -0
  849. package/dist/ui/table.js.map +7 -0
  850. package/dist/ui/tabs.js +48 -0
  851. package/dist/ui/tabs.js.map +7 -0
  852. package/dist/ui/textarea.js +63 -0
  853. package/dist/ui/textarea.js.map +7 -0
  854. package/dist/ui/toggle-group.js +43 -0
  855. package/dist/ui/toggle-group.js.map +7 -0
  856. package/dist/ui/toggle.js +40 -0
  857. package/dist/ui/toggle.js.map +7 -0
  858. package/dist/ui/tooltip.js +215 -0
  859. package/dist/ui/tooltip.js.map +7 -0
  860. package/dist/usage-metered.js +8 -0
  861. package/dist/usage-metered.js.map +7 -0
  862. package/dist/useArbi.js +16 -0
  863. package/dist/useArbi.js.map +7 -0
  864. package/dist/useInstallSkillPack.js +81 -0
  865. package/dist/useInstallSkillPack.js.map +7 -0
  866. package/dist/usermenu/UserMenu.js +188 -0
  867. package/dist/usermenu/UserMenu.js.map +7 -0
  868. package/dist/usermenu/index.js +5 -0
  869. package/dist/usermenu/index.js.map +7 -0
  870. package/dist/users/index.js +15 -0
  871. package/dist/users/index.js.map +7 -0
  872. package/dist/users/user-display.js +60 -0
  873. package/dist/users/user-display.js.map +7 -0
  874. package/dist/viewers/AudioViewer.js +23 -0
  875. package/dist/viewers/AudioViewer.js.map +7 -0
  876. package/dist/viewers/DocxViewer.js +81 -0
  877. package/dist/viewers/DocxViewer.js.map +7 -0
  878. package/dist/viewers/ImageViewer.js +31 -0
  879. package/dist/viewers/ImageViewer.js.map +7 -0
  880. package/dist/viewers/PdfViewer.cjs +17 -0
  881. package/dist/viewers/PdfViewer.cjs.map +1 -0
  882. package/dist/viewers/PdfViewer.d.ts +9 -0
  883. package/dist/viewers/PdfViewer.js +20 -0
  884. package/dist/viewers/PdfViewer.js.map +7 -0
  885. package/dist/viewers/PdfViewerImpl.js +384 -0
  886. package/dist/viewers/PdfViewerImpl.js.map +7 -0
  887. package/dist/viewers/VideoViewer.js +31 -0
  888. package/dist/viewers/VideoViewer.js.map +7 -0
  889. package/dist/viewers/XlsxViewer.js +102 -0
  890. package/dist/viewers/XlsxViewer.js.map +7 -0
  891. package/dist/viewers/index.cjs +79 -653
  892. package/dist/viewers/index.cjs.map +1 -1
  893. package/dist/viewers/index.d.ts +3 -1
  894. package/dist/viewers/index.js +60 -903
  895. package/dist/viewers/index.js.map +7 -1
  896. package/dist/viewers/page-scroll.js +59 -0
  897. package/dist/viewers/page-scroll.js.map +7 -0
  898. package/dist/viewers/pdf-viewer-constants.js +9 -0
  899. package/dist/viewers/pdf-viewer-constants.js.map +7 -0
  900. package/dist/{chunk-PTOP7OHG.js → viewers/pdfjs-polyfills.js} +5 -6
  901. package/dist/viewers/pdfjs-polyfills.js.map +7 -0
  902. package/dist/viewers/selection-runs.js +38 -0
  903. package/dist/viewers/selection-runs.js.map +7 -0
  904. package/dist/viewers/usePageIntersectionObserver.js +68 -0
  905. package/dist/viewers/usePageIntersectionObserver.js.map +7 -0
  906. package/dist/viewers/useProcessedChunks.js +58 -0
  907. package/dist/viewers/useProcessedChunks.js.map +7 -0
  908. package/dist/viewers/viewer-zoom.js +163 -0
  909. package/dist/viewers/viewer-zoom.js.map +7 -0
  910. package/dist/websocket/ArbiWebSocketProvider.js +207 -0
  911. package/dist/websocket/ArbiWebSocketProvider.js.map +7 -0
  912. package/dist/websocket/context.js +14 -0
  913. package/dist/websocket/context.js.map +7 -0
  914. package/dist/websocket/hooks.js +30 -0
  915. package/dist/websocket/hooks.js.map +7 -0
  916. package/dist/websocket/index.js +22 -0
  917. package/dist/websocket/index.js.map +7 -0
  918. package/dist/websocket/live-updates.js +38 -0
  919. package/dist/websocket/live-updates.js.map +7 -0
  920. package/dist/websocket/reconnect.js +13 -0
  921. package/dist/websocket/reconnect.js.map +7 -0
  922. package/dist/websocket/store.js +58 -0
  923. package/dist/websocket/store.js.map +7 -0
  924. package/dist/workforce.js +607 -0
  925. package/dist/workforce.js.map +7 -0
  926. package/dist/workspaces/access-request.js +35 -0
  927. package/dist/workspaces/access-request.js.map +7 -0
  928. package/dist/workspaces/archive.js +59 -0
  929. package/dist/workspaces/archive.js.map +7 -0
  930. package/dist/workspaces/current.js +20 -0
  931. package/dist/workspaces/current.js.map +7 -0
  932. package/dist/workspaces/delete-workspaces.js +15 -0
  933. package/dist/workspaces/delete-workspaces.js.map +7 -0
  934. package/dist/workspaces/export-archive.js +40 -0
  935. package/dist/workspaces/export-archive.js.map +7 -0
  936. package/dist/workspaces/index.js +99 -0
  937. package/dist/workspaces/index.js.map +7 -0
  938. package/dist/workspaces/settings.js +45 -0
  939. package/dist/workspaces/settings.js.map +7 -0
  940. package/dist/workspaces/shell-workspaces.js +49 -0
  941. package/dist/workspaces/shell-workspaces.js.map +7 -0
  942. package/dist/workspaces/switch.js +234 -0
  943. package/dist/workspaces/switch.js.map +7 -0
  944. package/dist/workspaces/transfer.js +170 -0
  945. package/dist/workspaces/transfer.js.map +7 -0
  946. package/dist/workspaces/useShellWorkspaces.js +86 -0
  947. package/dist/workspaces/useShellWorkspaces.js.map +7 -0
  948. package/dist/workspaces/workspace-users.js +65 -0
  949. package/dist/workspaces/workspace-users.js.map +7 -0
  950. package/package.json +12 -4
  951. package/dist/PdfViewer.d-bQH9yxFg.d.ts +0 -55
  952. package/dist/ProductionDialog.d-CpzslFn0.d.cts +0 -51
  953. package/dist/annotations/freeze/index.d.cts +0 -205
  954. package/dist/annotations/index.d.cts +0 -360
  955. package/dist/artifacts/index.d.cts +0 -476
  956. package/dist/artifacts/redline-core.d.cts +0 -39
  957. package/dist/bundle-YNOX7VIL.js +0 -5
  958. package/dist/bundle-YNOX7VIL.js.map +0 -1
  959. package/dist/bundle.d-BnCSbHy2.d.cts +0 -85
  960. package/dist/calls/livekit/index.d.cts +0 -280
  961. package/dist/chunk-47CCGUWR.js.map +0 -1
  962. package/dist/chunk-6H3O63TQ.js.map +0 -1
  963. package/dist/chunk-74N436VK.js.map +0 -1
  964. package/dist/chunk-APZZQZ6P.js +0 -147
  965. package/dist/chunk-APZZQZ6P.js.map +0 -1
  966. package/dist/chunk-BF5KW5ZI.js.map +0 -1
  967. package/dist/chunk-CPQ3CU4B.js +0 -246
  968. package/dist/chunk-CPQ3CU4B.js.map +0 -1
  969. package/dist/chunk-DPYBZDJB.js.map +0 -1
  970. package/dist/chunk-DQALOQPI.js +0 -2766
  971. package/dist/chunk-DQALOQPI.js.map +0 -1
  972. package/dist/chunk-FZJMA32S.js +0 -1011
  973. package/dist/chunk-FZJMA32S.js.map +0 -1
  974. package/dist/chunk-H5M7FXLB.js +0 -2057
  975. package/dist/chunk-H5M7FXLB.js.map +0 -1
  976. package/dist/chunk-HDCRPPBW.js +0 -75
  977. package/dist/chunk-HDCRPPBW.js.map +0 -1
  978. package/dist/chunk-NIKPG4PW.js +0 -1128
  979. package/dist/chunk-NIKPG4PW.js.map +0 -1
  980. package/dist/chunk-NNAJLY6B.js +0 -4974
  981. package/dist/chunk-NNAJLY6B.js.map +0 -1
  982. package/dist/chunk-OYPKKHXY.js +0 -559
  983. package/dist/chunk-OYPKKHXY.js.map +0 -1
  984. package/dist/chunk-P6WLV5UY.js +0 -644
  985. package/dist/chunk-P6WLV5UY.js.map +0 -1
  986. package/dist/chunk-PTOP7OHG.js.map +0 -1
  987. package/dist/chunk-SN5YV6FF.js +0 -11
  988. package/dist/chunk-SN5YV6FF.js.map +0 -1
  989. package/dist/chunk-T3USOSVN.js.map +0 -1
  990. package/dist/chunk-T4CLW3DN.js +0 -2560
  991. package/dist/chunk-T4CLW3DN.js.map +0 -1
  992. package/dist/chunk-UW2SGTI5.js.map +0 -1
  993. package/dist/chunk-VSCU7K4V.js.map +0 -1
  994. package/dist/chunk-WL2Y2T47.js.map +0 -1
  995. package/dist/chunk-WUTL62MC.js.map +0 -1
  996. package/dist/chunk-Y3MTRA7D.js +0 -97
  997. package/dist/chunk-Y3MTRA7D.js.map +0 -1
  998. package/dist/chunk-YNNAJJ5Z.js.map +0 -1
  999. package/dist/document-tools/core.d.cts +0 -883
  1000. package/dist/document-tools/index.d.cts +0 -90
  1001. package/dist/index.d-BMhTH98a.d.cts +0 -2035
  1002. package/dist/index.d-oR5FKZpJ.d.cts +0 -579
  1003. package/dist/index.d.cts +0 -15893
  1004. package/dist/model.d-CNtRWKVK.d.cts +0 -110
  1005. package/dist/query-keys.d-ChgpJLPF.d.cts +0 -337
  1006. package/dist/shell/index.d.cts +0 -6
  1007. package/dist/store.d-GADDvC7w.d.cts +0 -35
  1008. package/dist/stored-markdown.d-Bp18vrbr.d.cts +0 -125
  1009. package/dist/ui/index.d.cts +0 -25
  1010. package/dist/useAudioRecorder.d-B9rlMI_E.d.cts +0 -778
  1011. package/dist/viewers/index.d.cts +0 -260
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/workforce.ts"],
4
+ "sourcesContent": ["/**\n * Work, workflows, agents and skills: the mutation and read hooks behind an \"AI workforce\" screen.\n *\n * A conversation with a `status` is a task: it is listed by `useConversations` and changed through\n * `useUpdateConversation` and friends (which patch the list, see `conversation-list`). A workflow is the automation that creates them. Everything\n * sits on the SDK (`arbi.conversations`, `arbi.workflows`, `arbi.agents`, `arbi.agentConfig`,\n * `arbi.workspaces`, `arbi.assistant.listSkills`) and invalidates through {@link arbiQueryKeys}, so\n * `useConversations`, `useWorkflows`, `useAgents` and `useConfigs` refresh on their own after a\n * write. Mapping a form onto these requests (`TaskComposerValues` to a create-work or create-workflow\n * request, an agent form to a persona) is the pure part and lives next to the forms in\n * `@arbidocs/blocks/agents`.\n *\n * Requires an `ArbiHost` (with an `arbi`) and a React Query client above it.\n */\n\nimport { useEffect, useMemo, useRef } from 'react'\nimport { useMutation, useQuery, useQueryClient, type QueryClient } from '@tanstack/react-query'\nimport type {\n ActivityResponse,\n ConversationResponse,\n CreateWorkRequest,\n CreateWorkflowRequest,\n PlanWorkRequest,\n StepActionRequest,\n UpdateConversationRequest,\n UpdateWorkflowRequest,\n WorkflowResponse,\n WorkflowRunResponse,\n WorkflowRunHistoryResponse,\n} from '@arbidocs/sdk/browser'\nimport type { components } from '@arbidocs/client'\nimport { useArbi } from './useArbi'\nimport { useCurrentWorkspace } from './workspaces/current'\nimport { arbiMutationKeys, arbiQueryKeys, useConversations } from './hooks'\nimport {\n addConversationToList,\n invalidateConversationDetails,\n invalidateConversationLists,\n patchConversation,\n removeConversationFromLists,\n} from './conversation-list'\nimport { useArbiSessionState } from './session'\n\n/** An agent or deployment config: section name (`Agents`, `QueryLLM`, ...) to its parameters. */\nexport type AgentConfigSections = Record<string, Record<string, unknown>>\n\n// \u2500\u2500 Conversations as work \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/**\n * Whether a React Query key is the cached activity of a task (of `conversationId`, or any): the\n * {@link useConversationActivity} key, `['arbi', 'conversations', id, 'activity']`.\n */\nexport function isActivityKey(queryKey: readonly unknown[], conversationId?: string): boolean {\n const [scope, resource, id, leaf] = queryKey\n if (scope !== 'arbi' || resource !== 'conversations' || leaf !== 'activity') return false\n return !conversationId || id === conversationId\n}\n\n/** Re-read the activity of one task (or every cached one): after a run or a patch. */\nexport function invalidateConversationActivity(queryClient: QueryClient, conversationId?: string) {\n void queryClient.invalidateQueries({\n predicate: (q) => isActivityKey(q.queryKey, conversationId),\n })\n}\n\n/** How often to re-read the list while an agent is generating. */\nconst GENERATING_POLL_MS = 2500\n\n/**\n * One poll for the whole page. Several components read the list, and each running its own timer\n * meant N times the requests, each cancelling the last. Holders share a single timer that runs\n * while at least one of them needs it; the returned function lets go.\n */\nlet listPollHolders = 0\nlet listPollTimer: ReturnType<typeof setInterval> | undefined\nlet listPollRefetch: (() => unknown) | undefined\n\nfunction holdListPoll(refetch: () => unknown): () => void {\n listPollRefetch = refetch\n listPollHolders += 1\n if (listPollTimer === undefined) {\n listPollTimer = setInterval(() => void listPollRefetch?.(), GENERATING_POLL_MS)\n }\n return () => {\n listPollHolders -= 1\n if (listPollHolders === 0 && listPollTimer !== undefined) {\n clearInterval(listPollTimer)\n listPollTimer = undefined\n }\n }\n}\n\n/**\n * The open workspace's conversations, and among them its tasks: the ones that have a `status` (a\n * plain chat has none). One list serves both: a task is a conversation with a status.\n *\n * The list is seeded once and patched by writes, so a run that finishes server-side is picked up by\n * re-reading it while any task is generating. A task whose status or update time changed has a\n * stale history, which is re-read.\n */\nexport function useConversationItems() {\n // Not the id alone: it lands before the workspace is open, and the list is read once.\n const workspaceId = useArbiSessionState((s) => s.workspaceId)\n const open = useArbiSessionState((s) => s.workspaceStatus === 'open')\n const query = useConversations(workspaceId ?? undefined, { enabled: open })\n const { refetch } = query\n const all = query.data\n const tasks = useMemo(() => (all ?? []).filter((c) => c.status != null), [all])\n const queryClient = useQueryClient()\n const seen = useRef(new Map<string, string>())\n useEffect(() => {\n for (const t of tasks) {\n const stamp = `${t.status}|${t.updated_at ?? ''}`\n const before = seen.current.get(t.external_id)\n if (before !== undefined && before !== stamp) {\n invalidateConversationActivity(queryClient, t.external_id)\n }\n seen.current.set(t.external_id, stamp)\n }\n }, [tasks, queryClient])\n const generating = tasks.some((t) => t.in_progress || t.status === 'generating')\n useEffect(() => (generating ? holdListPoll(refetch) : undefined), [generating, refetch])\n return { conversations: all ?? [], tasks, isLoading: query.isLoading, refetch }\n}\n\n/** Whether the open conversation is shared (a thread with people in it), from the list. */\nexport function useConversationIsShared(): boolean {\n const id = useArbiSessionState((state) => state.conversationId)\n const { conversations } = useConversationItems()\n return conversations.find((conversation) => conversation.external_id === id)?.is_shared ?? false\n}\n\n/** The open workspace's tasks only: the conversations that have a `status`. */\nexport function useWorkItems() {\n const { tasks, isLoading, refetch } = useConversationItems()\n return { tasks, isLoading, refetch }\n}\n\n/**\n * The signed-in person's role in the open workspace (`owner`, `collaborator`, `guest`), or null when\n * they are not a member: their entry in the workspace's own member list.\n */\nexport function useWorkspaceRole() {\n return useCurrentWorkspace().role\n}\n\n/**\n * Whether the viewer edits the open workspace (owner or collaborator). A task or workflow they do\n * not own is always shared with them, and editors may then change it; guests only read. Sharing and\n * deleting stay with the row's owner, which the row itself says (`is_owner`).\n */\nexport function useCanEditShared(): boolean {\n const role = useWorkspaceRole()\n return role === 'owner' || role === 'collaborator'\n}\n\n/** Whether the viewer owns the open workspace: with an item's creator, the only one who shares or deletes it. */\nexport function useIsWorkspaceOwner(): boolean {\n return useWorkspaceRole() === 'owner'\n}\n\n/**\n * The run was accepted, but the thread it creates did not show up within the lookup. The task is\n * running, so starting it again would make a second one: look for its thread again with\n * `findThread(messageId)` instead.\n */\nexport class TaskThreadPendingError extends Error {\n constructor(readonly messageId: string) {\n super(\"The task has started, but its thread isn't ready yet.\")\n this.name = 'TaskThreadPendingError'\n }\n}\n\n/** Looking up the thread a just-accepted run is creating: how many tries, how far apart. */\nconst THREAD_LOOKUP_ATTEMPTS = 20\nconst THREAD_LOOKUP_DELAY_MS = 500\n\n/** A run that makes its thread a task, as the person asking (see `ThreadQuery` in blocks). */\nexport interface StartTaskQuery {\n input: string\n workspaceId: string\n docIds: string[]\n mentions?: Parameters<ReturnType<typeof useArbi>['assistant']['submit']>[1]['mentions']\n task?: Parameters<ReturnType<typeof useArbi>['assistant']['submit']>[1]['task']\n}\n\n/**\n * Run now: a background response whose `task` options make its thread a task (generating, then\n * open again). It runs as the person asking, so there is no stream to hold open: the response\n * carries the message id, from which the thread is found and the list re-read. A bad parent is\n * refused before anything is created. Resolves with the new thread's id; the run uses the chat's\n * model choice, else the person's last config.\n */\nexport function useStartTaskQuery() {\n const arbi = useArbi()\n const queryClient = useQueryClient()\n const chatModel = useArbiSessionState((s) => s.chatModel)\n const post = useMutation({\n mutationFn: (query: StartTaskQuery) => {\n const selectedConfig =\n chatModel ||\n queryClient\n .getQueriesData<{ last_config?: string }>({ queryKey: arbiQueryKeys.userSettings() })\n .map(([, settings]) => settings?.last_config)\n .find(Boolean)\n // The run goes to the workspace the query names (opened for this session if it is not the\n // current one), never to whichever workspace the session has open when it is sent.\n return arbi.assistant.submit(query.input, {\n workspaceId: query.workspaceId,\n docIds: query.docIds,\n fullContext: false,\n ...(selectedConfig ? { model: selectedConfig } : {}),\n ...(query.mentions !== undefined ? { mentions: query.mentions } : {}),\n ...(query.task !== undefined ? { task: query.task } : {}),\n })\n },\n })\n /**\n * The thread of a run, read from the run itself (`GET /v1/responses/{id}`, which answers while the\n * run is live): undefined while the run has not created it yet. Once the run has posted its\n * question the thread exists (its `arbi.user_message` event names it); a finished run's message is\n * stored with its thread. Asking for the message of a run still setting up would be a 404.\n */\n const threadOf = async (\n messageId: string,\n known?: string | null\n ): Promise<string | undefined> => {\n const response = await arbi.assistant.getResponse(messageId)\n const events = (response.metadata?.events ?? []) as {\n type?: string\n conversation_ext_id?: string\n }[]\n const posted = events.find((e) => e.type === 'arbi.user_message')?.conversation_ext_id\n if (posted) return posted\n if (response.status === 'queued' || response.status === 'in_progress') return undefined\n return known || (await arbi.conversations.getMessage(messageId)).conversation_ext_id\n }\n /** The thread a run is creating, looked up `attempts` times; null while it is not there yet. */\n const lookUpThread = async (\n messageId: string,\n attempts: number,\n known?: string | null\n ): Promise<{ conversationId: string } | null> => {\n let conversationId: string | undefined\n for (let attempt = 0; attempt < attempts && !conversationId; attempt += 1) {\n if (attempt > 0) await new Promise((r) => setTimeout(r, THREAD_LOOKUP_DELAY_MS))\n try {\n conversationId = await threadOf(messageId, known)\n } catch (error) {\n // A 404 is a run another server instance has not marked live yet; anything else (a\n // refusal) is not worth waiting on.\n if (!(error && typeof error === 'object' && 'status' in error && error.status === 404))\n throw error\n }\n }\n if (!conversationId) return null\n // The new task is not in the cached list yet: read it again.\n await invalidateConversationLists(queryClient)\n return { conversationId }\n }\n return {\n isPending: post.isPending,\n /** Look again for the thread of a run whose start threw {@link TaskThreadPendingError}. */\n findThread: (messageId: string) => lookUpThread(messageId, 1),\n start: async (query: StartTaskQuery): Promise<{ conversationId: string }> => {\n const accepted = await post.mutateAsync(query)\n const found = await lookUpThread(\n accepted.id,\n THREAD_LOOKUP_ATTEMPTS,\n accepted.conversation_ext_id\n )\n if (!found) throw new TaskThreadPendingError(accepted.id)\n return found\n },\n }\n}\n\n/**\n * Patch a conversation: rename it, share it or make it private (`shared`, owner only), or change\n * its work fields (description, due date, parent, `status` `todo | done`, plan).\n * The one write behind title edits, the share toggle and marking a task done.\n */\nexport function useUpdateConversation() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({\n conversationId,\n patch,\n }: {\n conversationId: string\n patch: UpdateConversationRequest\n }): Promise<ConversationResponse> => arbi.conversations.update(conversationId, patch),\n // The list takes the server's version of the row; what hangs off it is read again.\n onSuccess: (updated, { conversationId }) => {\n patchConversation(qc, conversationId, updated)\n return invalidateConversationDetails(qc, conversationId)\n },\n })\n}\n\n/** Delete a conversation (thread or task); it leaves every cached list at once. */\nexport function useDeleteConversation() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (conversationId: string) => arbi.conversations.delete(conversationId),\n onSuccess: (_res, conversationId) => removeConversationFromLists(qc, conversationId),\n })\n}\n\n/** The workspace a work call names: the one given, else the one open now (none: the SDK's). */\nfunction workWorkspace(arbi: ReturnType<typeof useArbi>, workspaceId?: string | null) {\n return workspaceId || (arbi.hasWorkspace ? arbi.getWorkspaceId() : undefined)\n}\n\n/**\n * Search the past conversation messages (keyword + semantic, grouped) of `workspaceId`, else of\n * the workspace open when it is sent.\n */\nexport function useConversationSearch(workspaceId?: string | null) {\n const arbi = useArbi()\n return useMutation({\n mutationFn: (body: components['schemas']['ConversationSearchRequest']) =>\n arbi.conversations.search(body, { workspaceId: workWorkspace(arbi, workspaceId) }),\n })\n}\n\n/**\n * Create a work item from a `CreateWorkRequest`: a plain to-do, or (with a prompt or skill) agent\n * work that starts at once. It is made in `options.workspaceId` (the page's), else in the workspace\n * open when it is sent; the request names it, and it joins that workspace's list. Resolves with the\n * created conversation.\n */\nexport function useCreateWork(options?: { workspaceId?: string | null }) {\n const arbi = useArbi()\n const qc = useQueryClient()\n const named = options?.workspaceId\n return useMutation({\n // The workspace is read once, when the request is sent: the request names it and the new work\n // joins that workspace's list, so one switched to while it is in flight neither receives it\n // nor lists it.\n mutationFn: async (body: CreateWorkRequest): Promise<ConversationResponse> => {\n const workspaceId = workWorkspace(arbi, named)\n const created = await arbi.conversations.createWork(body, { workspaceId })\n addConversationToList(qc, workspaceId ?? null, created)\n return created\n },\n })\n}\n\n/**\n * Run a work item now, or retry it. A run parked waiting for workspace access (a temporary\n * authorization tier) is granted a temporary, session-scoped key and run again, so the person\n * clicking Run authorizes it. Resolves with the updated conversation.\n */\nexport function useRunConversation() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (conversationId: string): Promise<ConversationResponse> =>\n arbi.conversations.runWithAuth(conversationId),\n // The server's version replaces the listed one; everything under the conversation is re-read.\n onSuccess: (updated) => {\n if (updated?.external_id) patchConversation(qc, updated.external_id, updated)\n return qc.invalidateQueries({ queryKey: arbiQueryKeys.allConversations() })\n },\n })\n}\n\n/**\n * Complete or skip a step of a workflow run (a form, an upload, a review's approval). The run then\n * starts its next agent step; the listed conversation is replaced and its activity re-read.\n */\nexport function useActOnStep() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({\n conversationId,\n body,\n }: {\n conversationId: string\n body: StepActionRequest\n }): Promise<ConversationResponse> => arbi.conversations.actOnStep(conversationId, body),\n // The server's version of the conversation replaces the listed one; its history is re-read.\n onSuccess: (updated) => {\n if (!updated?.external_id) return\n patchConversation(qc, updated.external_id, updated)\n invalidateConversationActivity(qc, updated.external_id)\n },\n })\n}\n\n/**\n * Draft an editable plan (goal and acceptance checklist) from an objective, for a task in\n * `workspaceId`, else in the workspace open when it is sent.\n */\nexport function usePlanWork(workspaceId?: string | null) {\n const arbi = useArbi()\n return useMutation({\n mutationFn: (body: PlanWorkRequest) =>\n arbi.conversations.plan(body, { workspaceId: workWorkspace(arbi, workspaceId) }),\n })\n}\n\n/**\n * The agent run-session key a parked run waits for the owner to allow (public key and email,\n * non-secret). Enabled only while the run is waiting; 404 otherwise.\n */\nexport function useConversationPendingAuth(\n conversationId: string | undefined,\n options?: { enabled?: boolean }\n) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.conversationPendingAuth(conversationId ?? ''),\n queryFn: () => arbi.conversations.pendingAuth(conversationId as string),\n enabled: (options?.enabled ?? true) && !!conversationId && arbi.isLoggedIn,\n retry: false,\n })\n}\n\n/**\n * A task's history, oldest first (created, run started, handed off, sent back, done, ...). Cached\n * under the conversations prefix, so every task write that invalidates the list refreshes it too.\n * Pass `live` while a run is generating to re-read it every few seconds.\n */\nexport function useConversationActivity(\n conversationId: string | undefined,\n options?: { enabled?: boolean; live?: boolean }\n) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.conversationActivity(conversationId ?? ''),\n queryFn: (): Promise<ActivityResponse[]> =>\n arbi.conversations.activity(conversationId as string),\n enabled: (options?.enabled ?? true) && !!conversationId && arbi.isLoggedIn,\n refetchInterval: options?.live ? 2500 : false,\n })\n}\n\n// \u2500\u2500 Workflows \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/** The caller's workflows (their own, and the ones shared with the open workspace). */\nexport function useWorkflows(options?: { enabled?: boolean; live?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.workflows(),\n queryFn: (): Promise<WorkflowResponse[]> => arbi.workflows.list(),\n // A clock or event can fire while the list is open, without a write here.\n refetchInterval: options?.live ? 10_000 : false,\n enabled: (options?.enabled ?? true) && arbi.isLoggedIn,\n })\n}\n\n/** A workflow's runs, re-read every few seconds while shown (a run moves on by itself). */\nexport function useWorkflowRuns(workflowId: string | undefined) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.workflowRuns(workflowId ?? ''),\n queryFn: (): Promise<WorkflowRunHistoryResponse[]> => arbi.workflows.runs(workflowId as string),\n enabled: !!workflowId && arbi.isLoggedIn,\n refetchInterval: 3000,\n staleTime: 0,\n refetchOnMount: 'always',\n })\n}\n\n/** Create a workflow from a `CreateWorkflowRequest`. Resolves with the created workflow. */\nexport function useCreateWorkflow() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (body: CreateWorkflowRequest): Promise<WorkflowResponse> =>\n arbi.workflows.create(body),\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.workflows() }),\n })\n}\n\n/** Patch a workflow: pause or resume it (`active`), share it, or change its trigger or action. */\nexport function useUpdateWorkflow() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({\n workflowId,\n patch,\n }: {\n workflowId: string\n patch: UpdateWorkflowRequest\n }): Promise<WorkflowResponse> => arbi.workflows.update(workflowId, patch),\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.workflows() }),\n })\n}\n\nexport function useDeleteWorkflow() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (workflowId: string) => arbi.workflows.delete(workflowId),\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.workflows() }),\n })\n}\n\n/**\n * Run a workflow now. Resolves with the conversation it created\n * (`conversation_ext_id`), which joins the conversation list.\n */\nexport function useRunWorkflow() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationKey: arbiMutationKeys.runWorkflow(),\n mutationFn: (workflowId: string): Promise<WorkflowRunResponse> =>\n arbi.workflows.run(workflowId),\n onSuccess: () =>\n Promise.all([\n qc.invalidateQueries({ queryKey: arbiQueryKeys.workflows() }),\n qc.invalidateQueries({ queryKey: arbiQueryKeys.allConversations() }),\n ]),\n })\n}\n\n// \u2500\u2500 Agents \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/** Create an agent by name. The one-time `signing_private_key` is in the result. */\nexport function useCreateAgent() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (name: string) => arbi.agents.create(name),\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.agents() }),\n })\n}\n\n/**\n * Generate an avatar for an owned agent from a prompt and set it as its picture. Resolves with the\n * agent (`picture` set); the agent list refreshes.\n */\nexport function useGenerateAgentAvatar() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({ agentExtId, prompt }: { agentExtId: string; prompt: string }) =>\n arbi.agents.generateAvatar(agentExtId, prompt),\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.agents() }),\n })\n}\n\n/** The default and maximum lifetime of a temporary agent authorization (seconds). */\nexport function useAuthorizeLimits(options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.authorizeLimits(),\n queryFn: () => arbi.agents.authorizeLimits(),\n enabled: (options?.enabled ?? true) && arbi.isLoggedIn,\n })\n}\n\n/** The MCP tools registered on the deployment, for an agent's tool picker. */\nexport function useMcpTools(options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.mcpTools(),\n queryFn: () => arbi.health.mcpTools(),\n enabled: (options?.enabled ?? true) && arbi.isLoggedIn,\n })\n}\n\n/**\n * An agent's pinned config (persona, model, tool switches), or the library default config when\n * `agentExtId` is omitted: edit forms seed from the first, create forms from the second.\n */\nexport function useAgentConfig(agentExtId?: string, options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.agentConfig(agentExtId),\n queryFn: async () =>\n (agentExtId\n ? await arbi.agents.getConfig(agentExtId)\n : await arbi.agentConfig.get('default')) as AgentConfigSections | null,\n enabled: (options?.enabled ?? true) && arbi.isLoggedIn,\n })\n}\n\n/** The model names an agent may be pinned to. */\nexport function useAgentModels(options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.models(),\n queryFn: async () => (await arbi.agentConfig.getModels()).models.map((m) => m.model_name),\n enabled: (options?.enabled ?? true) && arbi.isLoggedIn,\n })\n}\n\nexport interface SaveAgentConfigVars {\n agentExtId: string\n /** Config title; defaults to `agent-<agentExtId>`. */\n title?: string\n /**\n * Parameters to set, per section, e.g. `{ Agents: { PERSONA: '...', WEB_SEARCH_ENABLED: true } }`.\n * Merged key by key over the agent's current config (or the default one for a new agent).\n */\n sections: AgentConfigSections\n}\n\n/** Pin a behaviour config to an agent: read its current config, merge `sections` over it, save. */\nexport function useSaveAgentConfig() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: async ({ agentExtId, title, sections }: SaveAgentConfigVars) => {\n const pinned = (await arbi.agents.getConfig(agentExtId)) as AgentConfigSections | null\n const base = pinned ?? ((await arbi.agentConfig.get('default')) as AgentConfigSections)\n const merged: AgentConfigSections = structuredClone(base)\n for (const [section, params] of Object.entries(sections)) {\n merged[section] = { ...(merged[section] ?? {}), ...params }\n }\n return arbi.agentConfig.save({\n ...merged,\n agent_ext_id: agentExtId,\n title: title ?? `agent-${agentExtId}`,\n } as never)\n },\n onSuccess: (_saved, { agentExtId }) =>\n Promise.all([\n qc.invalidateQueries({ queryKey: arbiQueryKeys.configs() }),\n qc.invalidateQueries({ queryKey: arbiQueryKeys.agentConfig(agentExtId) }),\n // The agent list shows the pinned persona/model, so it refreshes too.\n qc.invalidateQueries({ queryKey: arbiQueryKeys.agents() }),\n ]),\n })\n}\n\n/** The workspaces an agent can currently open (`permanent` tells standing from temporary). */\nexport function useAgentWorkspaces(\n agentExtId: string | undefined,\n options?: { enabled?: boolean }\n) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.agentWorkspaces(agentExtId ?? ''),\n queryFn: () => arbi.agents.listWorkspaces(agentExtId as string),\n enabled: (options?.enabled ?? true) && !!agentExtId && arbi.isLoggedIn,\n })\n}\n\n/** How an agent is given a workspace. */\nexport type AgentAccessMode =\n /** A standing member: the agent can open the workspace while the owner is away. */\n | { kind: 'standing' }\n /** A TTL'd, session-scoped key: gone when the run session ends. `ttlSeconds` omitted = default. */\n | { kind: 'temporary'; ttlSeconds?: number }\n\nexport interface GrantAgentAccessVars {\n agentExtId: string\n workspaceId: string\n /** Default `{ kind: 'standing' }`. */\n mode?: AgentAccessMode\n}\n\n/**\n * Give an agent access to a workspace you own. Standing access adds the agent as a member without\n * switching the open workspace; temporary access mints the agent's run session and deposits a\n * session-scoped key on it (the `session_pubkey_b64` path).\n */\nexport function useGrantAgentAccess() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: async ({\n agentExtId,\n workspaceId,\n mode = { kind: 'standing' },\n }: GrantAgentAccessVars) => {\n if (mode.kind === 'temporary') {\n return arbi.agents.grantTemporaryAccess(agentExtId, workspaceId, mode.ttlSeconds)\n }\n const agent = (await arbi.agents.list()).find((a) => a.external_id === agentExtId)\n if (!agent?.email) throw new Error(\"The agent's address is unknown.\")\n return arbi.workspaces.grantAccess({ workspaceId, emails: [agent.email] })\n },\n onSuccess: (_res, { agentExtId, mode }) => {\n void qc.invalidateQueries({ queryKey: arbiQueryKeys.agentWorkspaces(agentExtId) })\n // Temporary access is a new run session: the session list shows it.\n if (mode?.kind === 'temporary')\n void qc.invalidateQueries({ queryKey: arbiQueryKeys.sessions() })\n },\n })\n}\n\n/**\n * Take an agent out of a workspace (owner only). The workspace is named on the request (opened for\n * the session, not switched to), so the app's current workspace never changes.\n */\nexport function useRevokeAgentAccess() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({ agentExtId, workspaceId }: { agentExtId: string; workspaceId: string }) =>\n arbi.workspaces.removeUsers([agentExtId], { workspaceId }),\n onSuccess: (_res, { agentExtId }) =>\n qc.invalidateQueries({ queryKey: arbiQueryKeys.agentWorkspaces(agentExtId) }),\n })\n}\n\n// \u2500\u2500 Skills \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/**\n * The skills the user can run (own plus the shared marketplace), metadata only. Without a\n * deployment marketplace the server lists a workspace's skills, so the list is kept per workspace\n * and the request names the open one: a switch while it runs cannot answer for another.\n */\nexport function useSkills(options?: {\n enabled?: boolean\n includeHidden?: boolean\n live?: boolean\n}) {\n const arbi = useArbi()\n const workspaceId = arbi.hasWorkspace ? arbi.getWorkspaceId() : ''\n return useQuery({\n queryKey: arbiQueryKeys.skillList(workspaceId, options?.includeHidden ?? false),\n queryFn: () =>\n arbi.assistant.listSkills({\n includeHidden: options?.includeHidden,\n workspaceId: workspaceId || undefined,\n }),\n refetchInterval: options?.live ? 5000 : false,\n enabled: (options?.enabled ?? true) && arbi.isLoggedIn,\n staleTime: 30_000,\n })\n}\n\n/**\n * Upload skill files through the same document path as the main application. A skill is the\n * uploader's own (`mine`) unless an entry says `shared` (everyone's, as \"Share with everyone\" makes\n * it): saving a private skill again never publishes it.\n */\nexport function useUploadSkillFiles() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: async (\n entries: {\n folder: string\n fileName: string\n content: Blob\n shared?: boolean\n /** Explicit target, already open/primed on this session. Uses session-gated upload. */\n workspaceId?: string\n }[]\n ): Promise<{ doc_ext_ids?: string[] }[]> => {\n if (!entries.length) throw new Error('Choose at least one skill file.')\n for (const entry of entries) assertSkillFolder(entry.folder)\n const results = []\n for (const entry of entries) {\n const options = {\n folder: entry.folder,\n wpType: 'skill' as const,\n shared: entry.shared ?? false,\n }\n const result = entry.workspaceId\n ? await arbi.documents.upload(\n [new File([entry.content], entry.fileName, { type: entry.content.type })],\n { ...options, workspaceExtId: entry.workspaceId }\n )\n : await arbi.documents.uploadFile(entry.content, entry.fileName, options)\n throwOnSkipped(result)\n results.push(result)\n }\n return results\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.skills() }),\n })\n}\n\n/** A skill's files live under `skills/<slug>/`, never outside it. */\nfunction assertSkillFolder(folder: string) {\n if (\n !/^skills\\/[a-z0-9][a-z0-9_-]*(?:\\/[^/]+)*$/.test(folder) ||\n folder.split('/').some((segment) => segment === '..' || segment === '.')\n )\n throw new Error('Skill files need a folder under skills/<name>.')\n}\n\n/** Fail on files the server skipped (a name clash, a rejected type), naming each with its reason. */\nfunction throwOnSkipped(result: { skipped?: { file_name: string; reason: string }[] | null }) {\n if (result.skipped?.length)\n throw new Error(result.skipped.map((file) => `${file.file_name}: ${file.reason}`).join('; '))\n}\n\n/**\n * Save a SKILL.md as the user's own skill `slug` (`arbi.assistant.uploadSkill`): private unless\n * `shared`. Pass `shared: isSharedSkill(skill)` from `@arbidocs/sdk` when changing an existing\n * skill, so a shared one stays shared and nothing else is ever published by saving.\n */\nexport function useSaveSkill() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: async ({\n slug,\n markdown,\n shared,\n }: {\n slug: string\n markdown: string\n shared?: boolean\n }): Promise<{ doc_ext_ids?: string[] }> => {\n assertSkillFolder(`skills/${slug}`)\n const result = await arbi.assistant.uploadSkill(slug, markdown, { shared })\n throwOnSkipped(result)\n return result\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.skills() }),\n })\n}\n\n/**\n * A skill's main file (SKILL.md) as text, read on demand (a skill's detail or its editor), never\n * for the whole list.\n */\nexport function useSkillSource(docExtId: string | undefined, options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.skillSource(docExtId ?? ''),\n queryFn: async () => {\n const response = await arbi.documents.download(docExtId as string)\n if (!response.ok) throw new Error(`Could not read the skill (${response.status})`)\n return response.text()\n },\n enabled: (options?.enabled ?? true) && !!docExtId && arbi.isLoggedIn,\n staleTime: 5 * 60_000,\n })\n}\n\n/** Delete a skill: its main file (only its owner may). The skill list refreshes. */\nexport function useDeleteSkill() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (docExtId: string) => arbi.documents.delete([docExtId]),\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.skills() }),\n })\n}\n\n/**\n * Share a skill with everyone (`global`) or make it the owner's again (`mine`): its main file's\n * `shared` flag, which the server carries to the skill's other files. A shared name must be unique\n * (409 when someone has shared one already).\n */\nexport function useSetSkillVisibility() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({ docExtId, visibility }: { docExtId: string; visibility: 'mine' | 'global' }) =>\n arbi.documents.update([{ external_id: docExtId, shared: visibility === 'global' }]),\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.skills() }),\n })\n}\n\n/** Independent agent login status, polled while its controls are visible. */\nexport function useAgentSession(agentId: string | undefined, options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.agentSession(agentId ?? ''),\n queryFn: () => arbi.agents.getSession(agentId!),\n enabled: !!agentId && arbi.isLoggedIn && (options?.enabled ?? true),\n refetchInterval: 5000,\n })\n}\nexport function useAgentChats(agentId: string | undefined) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.agentChats(agentId ?? ''),\n queryFn: () => arbi.agents.listChats(agentId!),\n enabled: !!agentId && arbi.isLoggedIn,\n refetchInterval: 5000,\n })\n}\n/** Starting or closing an agent's login changes its session, workspaces and chats, and the user's sessions. */\nfunction refreshAgentSession(qc: ReturnType<typeof useQueryClient>, agentId: string) {\n return Promise.all(\n [\n arbiQueryKeys.agentSession(agentId),\n arbiQueryKeys.agentWorkspaces(agentId),\n arbiQueryKeys.agentChats(agentId),\n arbiQueryKeys.sessions(),\n ].map((queryKey) => qc.invalidateQueries({ queryKey }))\n )\n}\n\n/** Log an owned agent in on its own (optionally into a workspace). */\nexport function useStartAgentSession() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({ agentId, workspaceId }: { agentId: string; workspaceId?: string }) =>\n arbi.agents.startSession(agentId, workspaceId),\n onSuccess: (_session, { agentId }) => refreshAgentSession(qc, agentId),\n })\n}\n\n/** Log an owned agent out. */\nexport function useCloseAgentSession() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (agentId: string) => arbi.agents.closeSession(agentId),\n onSuccess: (_result, agentId) => refreshAgentSession(qc, agentId),\n })\n}\n"],
5
+ "mappings": "AAeA,SAAS,WAAW,SAAS,cAAc;AAC3C,SAAS,aAAa,UAAU,sBAAwC;AAexE,SAAS,eAAe;AACxB,SAAS,2BAA2B;AACpC,SAAS,kBAAkB,eAAe,wBAAwB;AAClE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,2BAA2B;AAW7B,SAAS,cAAc,UAA8B,gBAAkC;AAC5F,QAAM,CAAC,OAAO,UAAU,IAAI,IAAI,IAAI;AACpC,MAAI,UAAU,UAAU,aAAa,mBAAmB,SAAS,WAAY,QAAO;AACpF,SAAO,CAAC,kBAAkB,OAAO;AACnC;AAGO,SAAS,+BAA+B,aAA0B,gBAAyB;AAChG,OAAK,YAAY,kBAAkB;AAAA,IACjC,WAAW,CAAC,MAAM,cAAc,EAAE,UAAU,cAAc;AAAA,EAC5D,CAAC;AACH;AAGA,MAAM,qBAAqB;AAO3B,IAAI,kBAAkB;AACtB,IAAI;AACJ,IAAI;AAEJ,SAAS,aAAa,SAAoC;AACxD,oBAAkB;AAClB,qBAAmB;AACnB,MAAI,kBAAkB,QAAW;AAC/B,oBAAgB,YAAY,MAAM,KAAK,kBAAkB,GAAG,kBAAkB;AAAA,EAChF;AACA,SAAO,MAAM;AACX,uBAAmB;AACnB,QAAI,oBAAoB,KAAK,kBAAkB,QAAW;AACxD,oBAAc,aAAa;AAC3B,sBAAgB;AAAA,IAClB;AAAA,EACF;AACF;AAUO,SAAS,uB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zD,QAAM,OAAO,QAAQ;AACrB,SAAO,SAAS;AAAA,IACd,UAAU,cAAc,WAAW,WAAW,EAAE;AAAA,IAChD,SAAS,MAAM,KAAK,OAAO,UAAU,OAAQ;AAAA,IAC7C,SAAS,CAAC,CAAC,WAAW,KAAK;AAAA,IAC3B,iBAAiB;AAAA,EACnB,CAAC;AACH;AAEA,SAAS,oBAAoB,IAAuC,SAAiB;AACnF,SAAO,QAAQ;AAAA,IACb;AAAA,MACE,cAAc,aAAa,OAAO;AAAA,MAClC,cAAc,gBAAgB,OAAO;AAAA,MACrC,cAAc,WAAW,OAAO;AAAA,MAChC,cAAc,SAAS;AAAA,IACzB,EAAE,IAAI,CAAC,aAAa,GAAG,kBAAkB,EAAE,SAAS,CAAC,CAAC;AAAA,EACxD;AACF;AAGO,SAAS,uBAAuB;AACrC,QAAM,OAAO,QAAQ;AACrB,QAAM,KAAK,eAAe;AAC1B,SAAO,YAAY;AAAA,IACjB,YAAY,CAAC,EAAE,SAAS,YAAY,MAClC,KAAK,OAAO,aAAa,SAAS,WAAW;AAAA,IAC/C,WAAW,CAAC,UAAU,EAAE,QAAQ,MAAM,oBAAoB,IAAI,OAAO;AAAA,EACvE,CAAC;AACH;AAGO,SAAS,uBAAuB;AACrC,QAAM,OAAO,QAAQ;AACrB,QAAM,KAAK,eAAe;AAC1B,SAAO,YAAY;AAAA,IACjB,YAAY,CAAC,YAAoB,KAAK,OAAO,aAAa,OAAO;AAAA,IACjE,WAAW,CAAC,SAAS,YAAY,oBAAoB,IAAI,OAAO;AAAA,EAClE,CAAC;AACH;",
6
+ "names": []
7
+ }
@@ -0,0 +1,35 @@
1
+ import { decryptMessage, getUserEncryptionKeypair } from "@arbidocs/client";
2
+ import { useMutation, useQueryClient } from "@tanstack/react-query";
3
+ import { useArbi } from "../useArbi.js";
4
+ import { arbiQueryKeys } from "../hooks.js";
5
+ async function openAccessRequest(content, requesterPublicKey) {
6
+ const keypair = await getUserEncryptionKeypair();
7
+ if (!keypair) return null;
8
+ try {
9
+ const plaintext = await decryptMessage(content, requesterPublicKey, keypair.secretKey);
10
+ return JSON.parse(plaintext);
11
+ } catch {
12
+ return null;
13
+ }
14
+ }
15
+ function useRequestWorkspaceAccess() {
16
+ const arbi = useArbi();
17
+ const qc = useQueryClient();
18
+ return useMutation({
19
+ mutationFn: ({
20
+ recipient,
21
+ options
22
+ }) => arbi.workspaces.requestAccess({
23
+ recipientExtId: recipient.external_id,
24
+ recipientEncryptionPublicKey: recipient.encryption_public_key,
25
+ note: options?.note,
26
+ workspaceExtId: options?.workspaceExtId
27
+ }),
28
+ onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.allNotifications() })
29
+ });
30
+ }
31
+ export {
32
+ openAccessRequest,
33
+ useRequestWorkspaceAccess
34
+ };
35
+ //# sourceMappingURL=access-request.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/workspaces/access-request.ts"],
4
+ "sourcesContent": ["/**\n * A workspace access request (a `workspace_access_request` notification): what the requester\n * sealed for the owner (their session's public key, for a temporary grant, and a note).\n */\nimport { decryptMessage, getUserEncryptionKeypair } from '@arbidocs/client'\nimport { useMutation, useQueryClient } from '@tanstack/react-query'\nimport { useArbi } from '../useArbi'\nimport { arbiQueryKeys } from '../hooks'\n\n/** What a request carries, sealed from the requester to the owner. */\nexport interface AccessRequestPayload {\n session_pubkey_b64: string\n note?: string\n}\n\n/**\n * Open a request's sealed content with the signed-in person's key. Null when no one is signed in\n * or it cannot be opened (not meant for them, damaged).\n */\nexport async function openAccessRequest(\n content: string,\n requesterPublicKey: string\n): Promise<AccessRequestPayload | null> {\n const keypair = await getUserEncryptionKeypair()\n if (!keypair) return null\n try {\n const plaintext = await decryptMessage(content, requesterPublicKey, keypair.secretKey)\n return JSON.parse(plaintext) as AccessRequestPayload\n } catch {\n return null\n }\n}\n\n/** Who a request goes to: anyone we can address and seal to. */\nexport interface AccessRequestRecipient {\n external_id: string\n encryption_public_key: string\n}\n\n/** What a request says beyond the session key: a note, and (rarely) the workspace it is for. */\nexport interface RequestAccessOptions {\n note?: string\n /**\n * Only when the workspace is already known (an invite-and-share completed after sign-up): it\n * locks the owner's review to it. Otherwise the owner picks.\n */\n workspaceExtId?: string\n}\n\n/**\n * Ask someone for workspace access: seal this session's public key (for a temporary grant) and a\n * note to them, and send it as a `workspace_access_request` notification.\n */\nexport function useRequestWorkspaceAccess() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({\n recipient,\n options,\n }: {\n recipient: AccessRequestRecipient\n options?: RequestAccessOptions\n }) =>\n arbi.workspaces.requestAccess({\n recipientExtId: recipient.external_id,\n recipientEncryptionPublicKey: recipient.encryption_public_key,\n note: options?.note,\n workspaceExtId: options?.workspaceExtId,\n }),\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.allNotifications() }),\n })\n}\n"],
5
+ "mappings": "AAIA,SAAS,gBAAgB,gCAAgC;AACzD,SAAS,aAAa,sBAAsB;AAC5C,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAY9B,eAAsB,kBACpB,SACA,oBACsC;AACtC,QAAM,UAAU,MAAM,yBAAyB;AAC/C,MAAI,CAAC,QAAS,QAAO;AACrB,MAAI;AACF,UAAM,YAAY,MAAM,eAAe,SAAS,oBAAoB,QAAQ,SAAS;AACrF,WAAO,KAAK,MAAM,SAAS;AAAA,EAC7B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAsBO,SAAS,4BAA4B;AAC1C,QAAM,OAAO,QAAQ;AACrB,QAAM,KAAK,eAAe;AAC1B,SAAO,YAAY;AAAA,IACjB,YAAY,CAAC;AAAA,MACX;AAAA,MACA;AAAA,IACF,MAIE,KAAK,WAAW,cAAc;AAAA,MAC5B,gBAAgB,UAAU;AAAA,MAC1B,8BAA8B,UAAU;AAAA,MACxC,MAAM,SAAS;AAAA,MACf,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AAAA,IACH,WAAW,MAAM,GAAG,kBAAkB,EAAE,UAAU,cAAc,iBAAiB,EAAE,CAAC;AAAA,EACtF,CAAC;AACH;",
6
+ "names": []
7
+ }
@@ -0,0 +1,59 @@
1
+ import { useEffect } from "react";
2
+ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
3
+ import { useArbi } from "../useArbi.js";
4
+ import { arbiQueryKeys } from "../query-keys.js";
5
+ const ARCHIVE_POLL_MS = 5e3;
6
+ const isArchiveMoving = (status) => status === "archiving" || status === "restoring";
7
+ function useWorkspaceArchive(workspaceId, enabled = true) {
8
+ const arbi = useArbi();
9
+ return useQuery({
10
+ queryKey: arbiQueryKeys.workspaceArchive(workspaceId ?? ""),
11
+ queryFn: () => arbi.workspaces.archiveState(workspaceId),
12
+ enabled: arbi.isLoggedIn && enabled && Boolean(workspaceId),
13
+ retry: false,
14
+ refetchInterval: (query) => isArchiveMoving(query.state.data?.status) ? ARCHIVE_POLL_MS : false
15
+ });
16
+ }
17
+ function invalidateArchive(queryClient) {
18
+ return Promise.all([
19
+ queryClient.invalidateQueries({ queryKey: arbiQueryKeys.workspaces() }),
20
+ queryClient.invalidateQueries({ queryKey: arbiQueryKeys.workspaceArchive() }),
21
+ queryClient.invalidateQueries({ queryKey: arbiQueryKeys.storage() })
22
+ ]);
23
+ }
24
+ function useArchiveWorkspace() {
25
+ const arbi = useArbi();
26
+ const queryClient = useQueryClient();
27
+ return useMutation({
28
+ mutationFn: (workspaceId) => arbi.workspaces.archive(workspaceId),
29
+ onSuccess: () => invalidateArchive(queryClient)
30
+ });
31
+ }
32
+ function useUnarchiveWorkspace() {
33
+ const arbi = useArbi();
34
+ const queryClient = useQueryClient();
35
+ return useMutation({
36
+ mutationFn: (workspaceId) => arbi.workspaces.unarchive(workspaceId),
37
+ onSuccess: () => invalidateArchive(queryClient)
38
+ });
39
+ }
40
+ function useArchiveProgressPolling(workspaces) {
41
+ const queryClient = useQueryClient();
42
+ const moving = (workspaces ?? []).some((w) => isArchiveMoving(w.archive?.status));
43
+ useEffect(() => {
44
+ if (!moving) return;
45
+ const timer = window.setInterval(() => {
46
+ void queryClient.invalidateQueries({ queryKey: arbiQueryKeys.workspaces() });
47
+ }, ARCHIVE_POLL_MS);
48
+ return () => window.clearInterval(timer);
49
+ }, [moving, queryClient]);
50
+ }
51
+ export {
52
+ ARCHIVE_POLL_MS,
53
+ isArchiveMoving,
54
+ useArchiveProgressPolling,
55
+ useArchiveWorkspace,
56
+ useUnarchiveWorkspace,
57
+ useWorkspaceArchive
58
+ };
59
+ //# sourceMappingURL=archive.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/workspaces/archive.ts"],
4
+ "sourcesContent": ["/**\n * Workspace archive: a workspace's archive state, archiving and unarchiving it, and keeping a list\n * of workspaces current while one of them moves to or from the archive.\n */\n\nimport { useEffect } from 'react'\nimport { useMutation, useQuery, useQueryClient, type QueryClient } from '@tanstack/react-query'\nimport type { components } from '@arbidocs/client'\nimport { useArbi } from '../useArbi'\nimport { arbiQueryKeys } from '../query-keys'\n\nexport type WorkspaceArchive = components['schemas']['WorkspaceArchiveRead']\nexport type WorkspaceArchiveState = components['schemas']['WorkspaceArchiveState']\nexport type UnarchiveEstimate = components['schemas']['UnarchiveEstimate']\n\n/** How often a workspace on its way to or from the archive is checked. */\nexport const ARCHIVE_POLL_MS = 5_000\n\n/** Its files are moving (to the archive, or back and re-indexing): progress keeps changing. */\nexport const isArchiveMoving = (status: string | null | undefined) =>\n status === 'archiving' || status === 'restoring'\n\n/** A workspace's archive state, bytes per tier and (while archived) what unarchiving costs. */\nexport function useWorkspaceArchive(workspaceId: string | null | undefined, enabled = true) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.workspaceArchive(workspaceId ?? ''),\n queryFn: () => arbi.workspaces.archiveState(workspaceId as string),\n enabled: arbi.isLoggedIn && enabled && Boolean(workspaceId),\n retry: false,\n refetchInterval: (query) =>\n isArchiveMoving(query.state.data?.status) ? ARCHIVE_POLL_MS : false,\n })\n}\n\n/** After an archive or unarchive: the workspace list, its archive state and the storage views. */\nfunction invalidateArchive(queryClient: QueryClient) {\n return Promise.all([\n queryClient.invalidateQueries({ queryKey: arbiQueryKeys.workspaces() }),\n queryClient.invalidateQueries({ queryKey: arbiQueryKeys.workspaceArchive() }),\n queryClient.invalidateQueries({ queryKey: arbiQueryKeys.storage() }),\n ])\n}\n\n/** Archive a workspace (its owner or its project's owner). */\nexport function useArchiveWorkspace() {\n const arbi = useArbi()\n const queryClient = useQueryClient()\n return useMutation({\n mutationFn: (workspaceId: string) => arbi.workspaces.archive(workspaceId),\n onSuccess: () => invalidateArchive(queryClient),\n })\n}\n\n/** Start unarchiving a workspace; refused up front when the AI budget cannot cover the re-index. */\nexport function useUnarchiveWorkspace() {\n const arbi = useArbi()\n const queryClient = useQueryClient()\n return useMutation({\n mutationFn: (workspaceId: string) => arbi.workspaces.unarchive(workspaceId),\n onSuccess: () => invalidateArchive(queryClient),\n })\n}\n\n/**\n * Keep the workspace list fresh while any workspace in it is archiving or restoring, so its card\n * shows the progress and opens again as soon as it is back.\n */\nexport function useArchiveProgressPolling(\n workspaces: ReadonlyArray<{ archive?: { status?: string | null } | null }> | undefined\n) {\n const queryClient = useQueryClient()\n const moving = (workspaces ?? []).some((w) => isArchiveMoving(w.archive?.status))\n useEffect(() => {\n if (!moving) return\n const timer = window.setInterval(() => {\n void queryClient.invalidateQueries({ queryKey: arbiQueryKeys.workspaces() })\n }, ARCHIVE_POLL_MS)\n return () => window.clearInterval(timer)\n }, [moving, queryClient])\n}\n"],
5
+ "mappings": "AAKA,SAAS,iBAAiB;AAC1B,SAAS,aAAa,UAAU,sBAAwC;AAExE,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAOvB,MAAM,kBAAkB;AAGxB,MAAM,kBAAkB,CAAC,WAC9B,WAAW,eAAe,WAAW;AAGhC,SAAS,oBAAoB,aAAwC,UAAU,MAAM;AAC1F,QAAM,OAAO,QAAQ;AACrB,SAAO,SAAS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,GAAG,eAAe;AAClB,WAAO,MAAM,OAAO,cAAc,KAAK;AAAA,EACzC,GAAG,CAAC,QAAQ,WAAW,CAAC;AAC1B;",
6
+ "names": []
7
+ }
@@ -0,0 +1,20 @@
1
+ import { useMemo } from "react";
2
+ import { useWorkspaces } from "../hooks.js";
3
+ import { useArbiSession, useArbiSessionState } from "../session/index.js";
4
+ function useCurrentWorkspace() {
5
+ const workspaceId = useArbiSessionState((s) => s.workspaceId);
6
+ const workspaceStatus = useArbiSessionState((s) => s.workspaceStatus);
7
+ const userId = useArbiSession().user?.external_id ?? null;
8
+ const { data: workspaces } = useWorkspaces();
9
+ const workspace = workspaceId ? workspaces?.find((w) => w.external_id === workspaceId) : void 0;
10
+ const membership = userId ? workspace?.users?.find((member) => member.user.external_id === userId) : void 0;
11
+ const role = membership?.role ?? null;
12
+ return useMemo(
13
+ () => ({ workspaceId, workspaceStatus, workspace, role, isMember: !!membership, userId }),
14
+ [workspaceId, workspaceStatus, workspace, role, membership, userId]
15
+ );
16
+ }
17
+ export {
18
+ useCurrentWorkspace
19
+ };
20
+ //# sourceMappingURL=current.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/workspaces/current.ts"],
4
+ "sourcesContent": ["/**\n * The workspace the app is in: the session's selection, as the workspace list has it, and the\n * signed-in person's membership in it.\n */\n\nimport { useMemo } from 'react'\nimport type { components } from '@arbidocs/client'\nimport { useWorkspaces } from '../hooks'\nimport { useArbiSession, useArbiSessionState } from '../session'\nimport type { ArbiWorkspaceStatus } from '../session'\n\ntype Workspace = NonNullable<ReturnType<typeof useWorkspaces>['data']>[number]\ntype WorkspaceRole = components['schemas']['WorkspaceRole']\n\nexport interface CurrentWorkspace {\n /** The selected workspace (`wrk-\u2026`), also before the list has it; null on the workspace list. */\n workspaceId: string | null\n /** Whether it is open on the server session. */\n workspaceStatus: ArbiWorkspaceStatus\n /** Its entry in the workspace list (undefined until listed, or when it is no longer there). */\n workspace: Workspace | undefined\n /** The signed-in person's role in it, null when they are not a member (a public workspace). */\n role: WorkspaceRole | null\n isMember: boolean\n /** The signed-in person (`usr-\u2026`). */\n userId: string | null\n}\n\nexport function useCurrentWorkspace(): CurrentWorkspace {\n const workspaceId = useArbiSessionState((s) => s.workspaceId)\n const workspaceStatus = useArbiSessionState((s) => s.workspaceStatus)\n const userId = useArbiSession().user?.external_id ?? null\n const { data: workspaces } = useWorkspaces()\n const workspace = workspaceId ? workspaces?.find((w) => w.external_id === workspaceId) : undefined\n const membership = userId\n ? workspace?.users?.find((member) => member.user.external_id === userId)\n : undefined\n const role = membership?.role ?? null\n return useMemo(\n () => ({ workspaceId, workspaceStatus, workspace, role, isMember: !!membership, userId }),\n [workspaceId, workspaceStatus, workspace, role, membership, userId]\n )\n}\n"],
5
+ "mappings": "AAKA,SAAS,eAAe;AAExB,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB,2BAA2B;AAoB7C,SAAS,sBAAwC;AACtD,QAAM,cAAc,oBAAoB,CAAC,MAAM,EAAE,WAAW;AAC5D,QAAM,kBAAkB,oBAAoB,CAAC,MAAM,EAAE,eAAe;AACpE,QAAM,SAAS,eAAe,EAAE,MAAM,eAAe;AACrD,QAAM,EAAE,MAAM,WAAW,IAAI,cAAc;AAC3C,QAAM,YAAY,cAAc,YAAY,KAAK,CAAC,MAAM,EAAE,gBAAgB,WAAW,IAAI;AACzF,QAAM,aAAa,SACf,WAAW,OAAO,KAAK,CAAC,WAAW,OAAO,KAAK,gBAAgB,MAAM,IACrE;AACJ,QAAM,OAAO,YAAY,QAAQ;AACjC,SAAO;AAAA,IACL,OAAO,EAAE,aAAa,iBAAiB,WAAW,MAAM,UAAU,CAAC,CAAC,YAAY,OAAO;AAAA,IACvF,CAAC,aAAa,iBAAiB,WAAW,MAAM,YAAY,MAAM;AAAA,EACpE;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,15 @@
1
+ import { useMutation, useQueryClient } from "@tanstack/react-query";
2
+ import { useArbi } from "../useArbi.js";
3
+ import { arbiQueryKeys } from "../hooks.js";
4
+ function useDeleteWorkspaces() {
5
+ const arbi = useArbi();
6
+ const qc = useQueryClient();
7
+ return useMutation({
8
+ mutationFn: (workspaceIds) => arbi.workspaces.delete(workspaceIds),
9
+ onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.workspaces() })
10
+ });
11
+ }
12
+ export {
13
+ useDeleteWorkspaces
14
+ };
15
+ //# sourceMappingURL=delete-workspaces.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/workspaces/delete-workspaces.ts"],
4
+ "sourcesContent": ["/**\n * Delete workspaces (owners only). They go to Recently deleted, where they can be restored for a\n * while; the workspace list refreshes.\n */\n\nimport { useMutation, useQueryClient } from '@tanstack/react-query'\nimport { useArbi } from '../useArbi'\nimport { arbiQueryKeys } from '../hooks'\n\nexport function useDeleteWorkspaces() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (workspaceIds: string[]) => arbi.workspaces.delete(workspaceIds),\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.workspaces() }),\n })\n}\n"],
5
+ "mappings": "AAKA,SAAS,aAAa,sBAAsB;AAC5C,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAEvB,SAAS,sBAAsB;AACpC,QAAM,OAAO,QAAQ;AACrB,QAAM,KAAK,eAAe;AAC1B,SAAO,YAAY;AAAA,IACjB,YAAY,CAAC,iBAA2B,KAAK,WAAW,OAAO,YAAY;AAAA,IAC3E,WAAW,MAAM,GAAG,kBAAkB,EAAE,UAAU,cAAc,WAAW,EAAE,CAAC;AAAA,EAChF,CAAC;AACH;",
6
+ "names": []
7
+ }
@@ -0,0 +1,40 @@
1
+ async function buildWorkspaceArchive({
2
+ exportData,
3
+ fetchFile,
4
+ metadataCsv,
5
+ onProgress
6
+ }) {
7
+ const JSZip = (await import("jszip")).default;
8
+ const zip = new JSZip();
9
+ const failed = [];
10
+ let fileCount = 0;
11
+ const files = exportData.files ?? [];
12
+ for (const [index, file] of files.entries()) {
13
+ try {
14
+ const kind = file.markup ? "markup" : "original";
15
+ const blob = await fetchFile(file.doc_ext_id, file.version ?? 1, kind);
16
+ if (blob) {
17
+ zip.file(file.path, blob);
18
+ fileCount++;
19
+ } else {
20
+ failed.push(file.path);
21
+ }
22
+ } catch {
23
+ failed.push(file.path);
24
+ }
25
+ onProgress?.(index + 1, files.length);
26
+ }
27
+ for (const [entity, records] of Object.entries(exportData.data ?? {})) {
28
+ zip.file(`data/${entity}.json`, JSON.stringify(records, null, 2));
29
+ }
30
+ if (metadataCsv) zip.file("index.csv", metadataCsv);
31
+ zip.file(
32
+ "manifest.json",
33
+ JSON.stringify({ ...exportData.manifest, files_missing: failed }, null, 2)
34
+ );
35
+ return { blob: await zip.generateAsync({ type: "blob" }), fileCount, failed };
36
+ }
37
+ export {
38
+ buildWorkspaceArchive
39
+ };
40
+ //# sourceMappingURL=export-archive.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/workspaces/export-archive.ts"],
4
+ "sourcesContent": ["/**\n * Assemble the workspace export archive from `POST /v1/workspace/export`.\n *\n * manifest.json what the archive is: format, scope, counts, layout\n * documents/<folder>/<name> current versions (older ones under documents/_versions/); one\n * document id may name several files, one per version\n * .../<name> (markup).pdf beside a version with markup: its PDF with the annotations as\n * native PDF annotations\n * data/<entity>.json one JSON array per entity type, cross-referenced by external_id\n * index.csv the documents' metadata table (when columns were chosen)\n *\n * Pure apart from `fetchFile`, so it is tested without a network.\n */\n\nimport type { WorkspaceExport } from './transfer'\n\nexport type ExportFileKind = 'original' | 'markup'\n\nexport interface BuildArchiveInput {\n exportData: WorkspaceExport\n /**\n * Fetch one file: a version of a document (`original`), or that version's markup PDF\n * (`markup`); `null` when it could not be fetched.\n */\n fetchFile: (docExtId: string, version: number, kind: ExportFileKind) => Promise<Blob | null>\n /** Ready-made `index.csv` content, or null for none. */\n metadataCsv?: string | null\n onProgress?: (done: number, total: number) => void\n}\n\nexport interface BuiltArchive {\n blob: Blob\n fileCount: number\n /** Archive paths of the files that could not be fetched. */\n failed: string[]\n}\n\nexport async function buildWorkspaceArchive({\n exportData,\n fetchFile,\n metadataCsv,\n onProgress,\n}: BuildArchiveInput): Promise<BuiltArchive> {\n const JSZip = (await import('jszip')).default\n const zip = new JSZip()\n const failed: string[] = []\n let fileCount = 0\n const files = exportData.files ?? []\n for (const [index, file] of files.entries()) {\n try {\n const kind: ExportFileKind = file.markup ? 'markup' : 'original'\n const blob = await fetchFile(file.doc_ext_id, file.version ?? 1, kind)\n if (blob) {\n zip.file(file.path, blob)\n fileCount++\n } else {\n failed.push(file.path)\n }\n } catch {\n failed.push(file.path)\n }\n onProgress?.(index + 1, files.length)\n }\n for (const [entity, records] of Object.entries(exportData.data ?? {})) {\n zip.file(`data/${entity}.json`, JSON.stringify(records, null, 2))\n }\n if (metadataCsv) zip.file('index.csv', metadataCsv)\n zip.file(\n 'manifest.json',\n JSON.stringify({ ...exportData.manifest, files_missing: failed }, null, 2)\n )\n return { blob: await zip.generateAsync({ type: 'blob' }), fileCount, failed }\n}\n"],
5
+ "mappings": "AAqCA,eAAsB,sBAAsB;AAAA,EAC1C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA6C;AAC3C,QAAM,SAAS,MAAM,OAAO,OAAO,GAAG;AACtC,QAAM,MAAM,IAAI,MAAM;AACtB,QAAM,SAAmB,CAAC;AAC1B,MAAI,YAAY;AAChB,QAAM,QAAQ,WAAW,SAAS,CAAC;AACnC,aAAW,CAAC,OAAO,IAAI,KAAK,MAAM,QAAQ,GAAG;AAC3C,QAAI;AACF,YAAM,OAAuB,KAAK,SAAS,WAAW;AACtD,YAAM,OAAO,MAAM,UAAU,KAAK,YAAY,KAAK,WAAW,GAAG,IAAI;AACrE,UAAI,MAAM;AACR,YAAI,KAAK,KAAK,MAAM,IAAI;AACxB;AAAA,MACF,OAAO;AACL,eAAO,KAAK,KAAK,IAAI;AAAA,MACvB;AAAA,IACF,QAAQ;AACN,aAAO,KAAK,KAAK,IAAI;AAAA,IACvB;AACA,iBAAa,QAAQ,GAAG,MAAM,MAAM;AAAA,EACtC;AACA,aAAW,CAAC,QAAQ,OAAO,KAAK,OAAO,QAAQ,WAAW,QAAQ,CAAC,CAAC,GAAG;AACrE,QAAI,KAAK,QAAQ,MAAM,SAAS,KAAK,UAAU,SAAS,MAAM,CAAC,CAAC;AAAA,EAClE;AACA,MAAI,YAAa,KAAI,KAAK,aAAa,WAAW;AAClD,MAAI;AAAA,IACF;AAAA,IACA,KAAK,UAAU,EAAE,GAAG,WAAW,UAAU,eAAe,OAAO,GAAG,MAAM,CAAC;AAAA,EAC3E;AACA,SAAO,EAAE,MAAM,MAAM,IAAI,cAAc,EAAE,MAAM,OAAO,CAAC,GAAG,WAAW,OAAO;AAC9E;",
6
+ "names": []
7
+ }
@@ -0,0 +1,99 @@
1
+ import { useCurrentWorkspace } from "./current.js";
2
+ import {
3
+ useShellWorkspaces
4
+ } from "./useShellWorkspaces.js";
5
+ import {
6
+ toShellWorkspace,
7
+ getWorkspaceKind,
8
+ resolveActiveWorkspace,
9
+ pickRecentWorkspaces
10
+ } from "./shell-workspaces.js";
11
+ import {
12
+ useSwitchWorkspace,
13
+ createWorkspaceSwitch,
14
+ useOpenSelectedWorkspace,
15
+ isWorkspaceArchivedError,
16
+ archivedWorkspaceMessage
17
+ } from "./switch.js";
18
+ import {
19
+ useUpdateWorkspace,
20
+ useCreateWorkspace,
21
+ useMoveWorkspaceToProject
22
+ } from "./settings.js";
23
+ import {
24
+ useWorkspaceUsers,
25
+ useAddWorkspaceMembers,
26
+ useRemoveWorkspaceMembers,
27
+ useSetWorkspaceMemberRoles
28
+ } from "./workspace-users.js";
29
+ import { useDeleteWorkspaces } from "./delete-workspaces.js";
30
+ import {
31
+ TRANSFER_POLL_MS,
32
+ isTransferFinished,
33
+ isTransferResumable,
34
+ usePlanWorkspaceTransfer,
35
+ useStartWorkspaceTransfer,
36
+ useResumeWorkspaceTransfer,
37
+ useCancelWorkspaceTransfer,
38
+ useWorkspaceTransfer,
39
+ useWorkspaceTransfers,
40
+ useInvalidateAfterTransfer,
41
+ useWorkspaceExportDownload
42
+ } from "./transfer.js";
43
+ import {
44
+ buildWorkspaceArchive
45
+ } from "./export-archive.js";
46
+ import {
47
+ openAccessRequest,
48
+ useRequestWorkspaceAccess
49
+ } from "./access-request.js";
50
+ import {
51
+ useWorkspaceArchive,
52
+ useArchiveWorkspace,
53
+ useUnarchiveWorkspace,
54
+ useArchiveProgressPolling,
55
+ isArchiveMoving,
56
+ ARCHIVE_POLL_MS
57
+ } from "./archive.js";
58
+ export {
59
+ ARCHIVE_POLL_MS,
60
+ TRANSFER_POLL_MS,
61
+ archivedWorkspaceMessage,
62
+ buildWorkspaceArchive,
63
+ createWorkspaceSwitch,
64
+ getWorkspaceKind,
65
+ isArchiveMoving,
66
+ isTransferFinished,
67
+ isTransferResumable,
68
+ isWorkspaceArchivedError,
69
+ openAccessRequest,
70
+ pickRecentWorkspaces,
71
+ resolveActiveWorkspace,
72
+ toShellWorkspace,
73
+ useAddWorkspaceMembers,
74
+ useArchiveProgressPolling,
75
+ useArchiveWorkspace,
76
+ useCancelWorkspaceTransfer,
77
+ useCreateWorkspace,
78
+ useCurrentWorkspace,
79
+ useDeleteWorkspaces,
80
+ useInvalidateAfterTransfer,
81
+ useMoveWorkspaceToProject,
82
+ useOpenSelectedWorkspace,
83
+ usePlanWorkspaceTransfer,
84
+ useRemoveWorkspaceMembers,
85
+ useRequestWorkspaceAccess,
86
+ useResumeWorkspaceTransfer,
87
+ useSetWorkspaceMemberRoles,
88
+ useShellWorkspaces,
89
+ useStartWorkspaceTransfer,
90
+ useSwitchWorkspace,
91
+ useUnarchiveWorkspace,
92
+ useUpdateWorkspace,
93
+ useWorkspaceArchive,
94
+ useWorkspaceExportDownload,
95
+ useWorkspaceTransfer,
96
+ useWorkspaceTransfers,
97
+ useWorkspaceUsers
98
+ };
99
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/workspaces/index.ts"],
4
+ "sourcesContent": ["export { useCurrentWorkspace, type CurrentWorkspace } from './current'\nexport {\n useShellWorkspaces,\n type ShellWorkspaceSeed,\n type UseShellWorkspacesOptions,\n type UseShellWorkspacesResult,\n} from './useShellWorkspaces'\nexport {\n toShellWorkspace,\n getWorkspaceKind,\n resolveActiveWorkspace,\n pickRecentWorkspaces,\n type ShellWorkspaceKind,\n type ShellWorkspaceMember,\n type ShellWorkspaceSource,\n type ShellWorkspaceItem,\n type ShellRecentWorkspaceItem,\n} from './shell-workspaces'\nexport {\n useSwitchWorkspace,\n createWorkspaceSwitch,\n useOpenSelectedWorkspace,\n isWorkspaceArchivedError,\n archivedWorkspaceMessage,\n type SwitchWorkspaceTarget,\n type UseSwitchWorkspaceResult,\n type WorkspaceSwitchContext,\n} from './switch'\nexport {\n useUpdateWorkspace,\n useCreateWorkspace,\n useMoveWorkspaceToProject,\n type WorkspaceUpdate,\n type CreateWorkspaceVars,\n} from './settings'\nexport {\n useWorkspaceUsers,\n useAddWorkspaceMembers,\n useRemoveWorkspaceMembers,\n useSetWorkspaceMemberRoles,\n type WorkspaceMember,\n type AddWorkspaceMembersRequest,\n type WorkspaceRole,\n} from './workspace-users'\nexport { useDeleteWorkspaces } from './delete-workspaces'\nexport {\n TRANSFER_POLL_MS,\n isTransferFinished,\n isTransferResumable,\n usePlanWorkspaceTransfer,\n useStartWorkspaceTransfer,\n useResumeWorkspaceTransfer,\n useCancelWorkspaceTransfer,\n useWorkspaceTransfer,\n useWorkspaceTransfers,\n useInvalidateAfterTransfer,\n useWorkspaceExportDownload,\n type ExportDownloadRequest,\n type TransferScope,\n type TransferKind,\n type TransferMode,\n type TransferPlan,\n type TransferStatus,\n type TransferConflictPolicy,\n type WorkspaceExport,\n} from './transfer'\nexport {\n buildWorkspaceArchive,\n type BuildArchiveInput,\n type BuiltArchive,\n type ExportFileKind,\n} from './export-archive'\nexport {\n openAccessRequest,\n useRequestWorkspaceAccess,\n type AccessRequestPayload,\n type AccessRequestRecipient,\n type RequestAccessOptions,\n} from './access-request'\nexport {\n useWorkspaceArchive,\n useArchiveWorkspace,\n useUnarchiveWorkspace,\n useArchiveProgressPolling,\n isArchiveMoving,\n ARCHIVE_POLL_MS,\n type WorkspaceArchive,\n type WorkspaceArchiveState,\n type UnarchiveEstimate,\n} from './archive'\n"],
5
+ "mappings": "AAAA,SAAS,2BAAkD;AAC3D;AAAA,EACE;AAAA,OAIK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAMK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP,SAAS,2BAA2B;AACpC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OASK;AACP;AAAA,EACE;AAAA,OAIK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAIK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;",
6
+ "names": []
7
+ }
@@ -0,0 +1,45 @@
1
+ import { useMutation, useQueryClient } from "@tanstack/react-query";
2
+ import { useArbi } from "../useArbi.js";
3
+ import { arbiQueryKeys } from "../hooks.js";
4
+ function useCreateWorkspace() {
5
+ const arbi = useArbi();
6
+ const qc = useQueryClient();
7
+ return useMutation({
8
+ mutationFn: ({ name, projectId, description, isPublic }) => arbi.workspaces.create(name, projectId, description, isPublic),
9
+ onSuccess: (created) => {
10
+ if (qc.getQueryCache().find({ queryKey: arbiQueryKeys.workspaces(), exact: true })) {
11
+ qc.setQueryData(
12
+ arbiQueryKeys.workspaces(),
13
+ (list = []) => list.some((w) => w.external_id === created.external_id) ? list : [...list, created]
14
+ );
15
+ }
16
+ void qc.invalidateQueries({ queryKey: arbiQueryKeys.workspaces() });
17
+ void qc.invalidateQueries({ queryKey: arbiQueryKeys.projects() });
18
+ }
19
+ });
20
+ }
21
+ function useMoveWorkspaceToProject() {
22
+ const arbi = useArbi();
23
+ const qc = useQueryClient();
24
+ return useMutation({
25
+ mutationFn: ({ workspaceId, projectId }) => arbi.workspaces.moveToProject(workspaceId, projectId),
26
+ onSuccess: () => {
27
+ void qc.invalidateQueries({ queryKey: arbiQueryKeys.workspaces() });
28
+ void qc.invalidateQueries({ queryKey: arbiQueryKeys.projects() });
29
+ }
30
+ });
31
+ }
32
+ function useUpdateWorkspace() {
33
+ const arbi = useArbi();
34
+ const qc = useQueryClient();
35
+ return useMutation({
36
+ mutationFn: (body) => arbi.workspaces.update(body),
37
+ onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.workspaces() })
38
+ });
39
+ }
40
+ export {
41
+ useCreateWorkspace,
42
+ useMoveWorkspaceToProject,
43
+ useUpdateWorkspace
44
+ };
45
+ //# sourceMappingURL=settings.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/workspaces/settings.ts"],
4
+ "sourcesContent": ["/**\n * Workspace writes over the SDK: create one, rename, describe or change the visibility of the open\n * workspace, and move a workspace to another project. Its members and their writes are in\n * `workspace-users.ts`.\n */\n\nimport { useMutation, useQueryClient } from '@tanstack/react-query'\nimport type { components } from '@arbidocs/client'\nimport { useArbi } from '../useArbi'\nimport { arbiQueryKeys } from '../hooks'\n\nexport type WorkspaceUpdate = components['schemas']['WorkspaceUpdateRequest']\ntype Workspace = components['schemas']['WorkspaceResponse']\n\n/** A new workspace: its name, the project it belongs to, and optionally a description. */\nexport interface CreateWorkspaceVars {\n name: string\n projectId: string\n description?: string | null\n isPublic?: boolean\n}\n\n/**\n * Create a workspace (its key generated and sealed by the SDK). The new workspace goes into the\n * cached list at once, so opening it right away finds it; the list and the projects (their\n * workspace counts) are then read again.\n */\nexport function useCreateWorkspace() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({ name, projectId, description, isPublic }: CreateWorkspaceVars) =>\n arbi.workspaces.create(name, projectId, description, isPublic),\n onSuccess: (created) => {\n if (qc.getQueryCache().find({ queryKey: arbiQueryKeys.workspaces(), exact: true })) {\n qc.setQueryData<Workspace[]>(arbiQueryKeys.workspaces(), (list = []) =>\n list.some((w) => w.external_id === created.external_id) ? list : [...list, created]\n )\n }\n void qc.invalidateQueries({ queryKey: arbiQueryKeys.workspaces() })\n void qc.invalidateQueries({ queryKey: arbiQueryKeys.projects() })\n },\n })\n}\n\n/** Move a workspace (open or not) to another project; both projects' counts change. */\nexport function useMoveWorkspaceToProject() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({ workspaceId, projectId }: { workspaceId: string; projectId: string }) =>\n arbi.workspaces.moveToProject(workspaceId, projectId),\n onSuccess: () => {\n void qc.invalidateQueries({ queryKey: arbiQueryKeys.workspaces() })\n void qc.invalidateQueries({ queryKey: arbiQueryKeys.projects() })\n },\n })\n}\n\n/** Change the open workspace's name, description or visibility. */\nexport function useUpdateWorkspace() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (body: WorkspaceUpdate) => arbi.workspaces.update(body),\n onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.workspaces() }),\n })\n}\n"],
5
+ "mappings": "AAMA,SAAS,aAAa,sBAAsB;AAE5C,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAkBvB,SAAS,qBAAqB;AACnC,QAAM,OAAO,QAAQ;AACrB,QAAM,KAAK,eAAe;AAC1B,SAAO,YAAY;AAAA,IACjB,YAAY,CAAC,EAAE,MAAM,WAAW,aAAa,SAAS,MACpD,KAAK,WAAW,OAAO,MAAM,WAAW,aAAa,QAAQ;AAAA,IAC/D,WAAW,CAAC,YAAY;AACtB,UAAI,GAAG,cAAc,EAAE,KAAK,EAAE,UAAU,cAAc,WAAW,GAAG,OAAO,KAAK,CAAC,GAAG;AAClF,WAAG;AAAA,UAA0B,cAAc,WAAW;AAAA,UAAG,CAAC,OAAO,CAAC,MAChE,KAAK,KAAK,CAAC,MAAM,EAAE,gBAAgB,QAAQ,WAAW,IAAI,OAAO,CAAC,GAAG,MAAM,OAAO;AAAA,QACpF;AAAA,MACF;AACA,WAAK,GAAG,kBAAkB,EAAE,UAAU,cAAc,WAAW,EAAE,CAAC;AAClE,WAAK,GAAG,kBAAkB,EAAE,UAAU,cAAc,SAAS,EAAE,CAAC;AAAA,IAClE;AAAA,EACF,CAAC;AACH;AAGO,SAAS,4BAA4B;AAC1C,QAAM,OAAO,QAAQ;AACrB,QAAM,KAAK,eAAe;AAC1B,SAAO,YAAY;AAAA,IACjB,YAAY,CAAC,EAAE,aAAa,UAAU,MACpC,KAAK,WAAW,cAAc,aAAa,SAAS;AAAA,IACtD,WAAW,MAAM;AACf,WAAK,GAAG,kBAAkB,EAAE,UAAU,cAAc,WAAW,EAAE,CAAC;AAClE,WAAK,GAAG,kBAAkB,EAAE,UAAU,cAAc,SAAS,EAAE,CAAC;AAAA,IAClE;AAAA,EACF,CAAC;AACH;AAGO,SAAS,qBAAqB;AACnC,QAAM,OAAO,QAAQ;AACrB,QAAM,KAAK,eAAe;AAC1B,SAAO,YAAY;AAAA,IACjB,YAAY,CAAC,SAA0B,KAAK,WAAW,OAAO,IAAI;AAAA,IAClE,WAAW,MAAM,GAAG,kBAAkB,EAAE,UAAU,cAAc,WAAW,EAAE,CAAC;AAAA,EAChF,CAAC;AACH;",
6
+ "names": []
7
+ }
@@ -0,0 +1,49 @@
1
+ function getWorkspaceKind(workspace) {
2
+ if (workspace.is_public) return "common";
3
+ if ((workspace.users?.length ?? 0) > 1) return "shared";
4
+ return "private";
5
+ }
6
+ function memberName(user) {
7
+ const full = [user?.given_name, user?.family_name].filter(Boolean).join(" ").trim();
8
+ return full || user?.email || "";
9
+ }
10
+ function toShellWorkspace(workspace) {
11
+ const people = (workspace.users ?? []).filter((u) => !u.agent_ext_id);
12
+ return {
13
+ id: workspace.external_id,
14
+ name: workspace.name,
15
+ kind: getWorkspaceKind(workspace),
16
+ description: workspace.description,
17
+ projectName: workspace.project_name,
18
+ docCount: (workspace.shared_document_count ?? 0) + (workspace.private_document_count ?? 0),
19
+ memberCount: people.length,
20
+ members: people.map((u) => ({ name: memberName(u.user), picture: u.user?.picture })),
21
+ updatedAt: workspace.updated_at
22
+ };
23
+ }
24
+ function recency(workspace, lastOpened) {
25
+ const opened = lastOpened?.[workspace.id];
26
+ if (opened !== void 0) return opened;
27
+ const updated = Date.parse(workspace.updatedAt ?? "");
28
+ return Number.isNaN(updated) ? 0 : updated;
29
+ }
30
+ function resolveActiveWorkspace(items, selectedId, options = {}) {
31
+ const selected = selectedId ? items.find((w) => w.id === selectedId) : void 0;
32
+ if (selected) return selected;
33
+ if (options.isSeed && options.seedActiveId) {
34
+ const seeded = items.find((w) => w.id === options.seedActiveId);
35
+ if (seeded) return seeded;
36
+ }
37
+ return items[0];
38
+ }
39
+ function pickRecentWorkspaces(items, activeId, options = {}) {
40
+ const { limit = 4, lastOpened, formatLastSeen } = options;
41
+ return items.filter((w) => w.id !== activeId).map((w) => ({ w, at: recency(w, lastOpened) })).sort((a, b) => b.at - a.at).slice(0, limit).map(({ w, at }) => formatLastSeen ? { ...w, lastSeen: formatLastSeen(at) } : w);
42
+ }
43
+ export {
44
+ getWorkspaceKind,
45
+ pickRecentWorkspaces,
46
+ resolveActiveWorkspace,
47
+ toShellWorkspace
48
+ };
49
+ //# sourceMappingURL=shell-workspaces.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/workspaces/shell-workspaces.ts"],
4
+ "sourcesContent": ["/**\n * Pure workspace adapters: an SDK `WorkspaceResponse` (or the host's own copy of it) to the view\n * models the shell and the workspaces gallery show. No React state, no SDK calls, so a host that\n * has no `arbi` in its host can use them too.\n */\n\nimport type { ReactNode } from 'react'\n\n/** Workspace visibility: public = common, several members = shared, else private. */\nexport type ShellWorkspaceKind = 'private' | 'shared' | 'common'\n\n/** One face on a workspace card. */\nexport interface ShellWorkspaceMember {\n name: string\n picture?: string | null\n}\n\n/**\n * The fields of an SDK workspace the adapters read. Every field but the id and the name is\n * optional, so the SDK's `WorkspaceResponse` and a host's own copy of it are both assignable.\n */\nexport interface ShellWorkspaceSource {\n external_id: string\n name: string\n description?: string | null\n is_public?: boolean\n project_name?: string | null\n updated_at?: string\n shared_document_count?: number\n private_document_count?: number\n users?: ReadonlyArray<{\n user?: {\n given_name?: string | null\n family_name?: string | null\n email?: string | null\n picture?: string | null\n }\n /** Set when the member is an agent: agents are not people and are left off the faces. */\n agent_ext_id?: string | null\n }>\n}\n\n/**\n * A workspace as the shell and the gallery see it. Structurally a superset of blocks'\n * `ShellWorkspace` and `WorkspaceSummary`, so it is passed to both unchanged.\n */\nexport interface ShellWorkspaceItem {\n id: string\n name: string\n kind: ShellWorkspaceKind\n description?: string | null\n projectName?: string | null\n /** A rendered project pill; the host supplies it (see `decorate`). */\n projectLine?: ReactNode\n /** Shared plus private documents. */\n docCount: number\n /** People in the workspace (agents excluded). */\n memberCount: number\n members: ShellWorkspaceMember[]\n /** ISO timestamp. */\n updatedAt?: string\n}\n\n/** A workspace offered in the switcher menu. */\nexport interface ShellRecentWorkspaceItem extends ShellWorkspaceItem {\n /** Pre-formatted \"last seen\" text, when the host supplies `formatLastSeen`. */\n lastSeen?: string\n}\n\n/** Public, several members: shared. Otherwise private. */\nexport function getWorkspaceKind(\n workspace: Pick<ShellWorkspaceSource, 'is_public' | 'users'>\n): ShellWorkspaceKind {\n if (workspace.is_public) return 'common'\n if ((workspace.users?.length ?? 0) > 1) return 'shared'\n return 'private'\n}\n\nfunction memberName(user: NonNullable<ShellWorkspaceSource['users']>[number]['user']): string {\n const full = [user?.given_name, user?.family_name].filter(Boolean).join(' ').trim()\n return full || user?.email || ''\n}\n\n/** Adapt one SDK workspace to the shell and gallery view model. */\nexport function toShellWorkspace(workspace: ShellWorkspaceSource): ShellWorkspaceItem {\n const people = (workspace.users ?? []).filter((u) => !u.agent_ext_id)\n return {\n id: workspace.external_id,\n name: workspace.name,\n kind: getWorkspaceKind(workspace),\n description: workspace.description,\n projectName: workspace.project_name,\n docCount: (workspace.shared_document_count ?? 0) + (workspace.private_document_count ?? 0),\n memberCount: people.length,\n members: people.map((u) => ({ name: memberName(u.user), picture: u.user?.picture })),\n updatedAt: workspace.updated_at,\n }\n}\n\n/** The moment a workspace was last opened here, else last updated; 0 when neither is known. */\nfunction recency(\n workspace: ShellWorkspaceItem,\n lastOpened: Readonly<Record<string, number>> | undefined\n): number {\n const opened = lastOpened?.[workspace.id]\n if (opened !== undefined) return opened\n const updated = Date.parse(workspace.updatedAt ?? '')\n return Number.isNaN(updated) ? 0 : updated\n}\n\n/**\n * The workspace the app is in. Order: the host's selection if it is in the list; else the first\n * workspace of a live list; else the seed's active one; else the first workspace.\n */\nexport function resolveActiveWorkspace(\n items: readonly ShellWorkspaceItem[],\n selectedId: string | null | undefined,\n options: { isSeed?: boolean; seedActiveId?: string } = {}\n): ShellWorkspaceItem | undefined {\n const selected = selectedId ? items.find((w) => w.id === selectedId) : undefined\n if (selected) return selected\n if (options.isSeed && options.seedActiveId) {\n const seeded = items.find((w) => w.id === options.seedActiveId)\n if (seeded) return seeded\n }\n return items[0]\n}\n\n/** The other workspaces for the quick-switch menu, most recently opened first, capped. */\nexport function pickRecentWorkspaces(\n items: readonly ShellWorkspaceItem[],\n activeId: string | undefined,\n options: {\n limit?: number\n lastOpened?: Readonly<Record<string, number>>\n formatLastSeen?: (timestamp: number) => string\n } = {}\n): ShellRecentWorkspaceItem[] {\n const { limit = 4, lastOpened, formatLastSeen } = options\n return items\n .filter((w) => w.id !== activeId)\n .map((w) => ({ w, at: recency(w, lastOpened) }))\n .sort((a, b) => b.at - a.at)\n .slice(0, limit)\n .map(({ w, at }) => (formatLastSeen ? { ...w, lastSeen: formatLastSeen(at) } : w))\n}\n"],
5
+ "mappings": "AAsEO,SAAS,iBACd,WACoB;AACpB,MAAI,UAAU,UAAW,QAAO;AAChC,OAAK,UAAU,OAAO,UAAU,KAAK,EAAG,QAAO;AAC/C,SAAO;AACT;AAEA,SAAS,WAAW,MAA0E;AAC5F,QAAM,OAAO,CAAC,MAAM,YAAY,MAAM,WAAW,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK;AAClF,SAAO,QAAQ,MAAM,SAAS;AAChC;AAGO,SAAS,iBAAiB,WAAqD;AACpF,QAAM,UAAU,UAAU,SAAS,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE,YAAY;AACpE,SAAO;AAAA,IACL,IAAI,UAAU;AAAA,IACd,MAAM,UAAU;AAAA,IAChB,MAAM,iBAAiB,SAAS;AAAA,IAChC,aAAa,UAAU;AAAA,IACvB,aAAa,UAAU;AAAA,IACvB,WAAW,UAAU,yBAAyB,MAAM,UAAU,0BAA0B;AAAA,IACxF,aAAa,OAAO;AAAA,IACpB,SAAS,OAAO,IAAI,CAAC,OAAO,EAAE,MAAM,WAAW,EAAE,IAAI,GAAG,SAAS,EAAE,MAAM,QAAQ,EAAE;AAAA,IACnF,WAAW,UAAU;AAAA,EACvB;AACF;AAGA,SAAS,QACP,WACA,YACQ;AACR,QAAM,SAAS,aAAa,UAAU,EAAE;AACxC,MAAI,WAAW,OAAW,QAAO;AACjC,QAAM,UAAU,KAAK,MAAM,UAAU,aAAa,EAAE;AACpD,SAAO,OAAO,MAAM,OAAO,IAAI,IAAI;AACrC;AAMO,SAAS,uBACd,OACA,YACA,UAAuD,CAAC,GACxB;AAChC,QAAM,WAAW,aAAa,MAAM,KAAK,CAAC,MAAM,EAAE,OAAO,UAAU,IAAI;AACvE,MAAI,S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