@arbidocs/react 0.5.73 → 0.5.75

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 (54) hide show
  1. package/README.md +85 -66
  2. package/dist/artifacts/index.cjs +9 -9
  3. package/dist/artifacts/index.js +3 -3
  4. package/dist/calls/livekit/index.cjs +48 -48
  5. package/dist/calls/livekit/index.js +3 -3
  6. package/dist/{chunk-M3SB5TZB.js → chunk-2MECTZLS.js} +9 -5
  7. package/dist/chunk-2MECTZLS.js.map +1 -0
  8. package/dist/{chunk-R7YNABZY.js → chunk-2Y6LJNWA.js} +2 -2
  9. package/dist/{chunk-R7YNABZY.js.map → chunk-2Y6LJNWA.js.map} +1 -1
  10. package/dist/{chunk-QGOYIYLI.js → chunk-33PVGKXT.js} +819 -509
  11. package/dist/chunk-33PVGKXT.js.map +1 -0
  12. package/dist/{chunk-Y7S2SQH3.cjs → chunk-5YGUBXXH.cjs} +2 -2
  13. package/dist/{chunk-Y7S2SQH3.cjs.map → chunk-5YGUBXXH.cjs.map} +1 -1
  14. package/dist/{chunk-RS6UUPD2.cjs → chunk-6RSVGLQY.cjs} +853 -536
  15. package/dist/chunk-6RSVGLQY.cjs.map +1 -0
  16. package/dist/{chunk-2LV53J46.js → chunk-JHN4PKWX.js} +3 -3
  17. package/dist/{chunk-2LV53J46.js.map → chunk-JHN4PKWX.js.map} +1 -1
  18. package/dist/{chunk-ZTPJNKF2.js → chunk-LC276BI7.js} +5 -5
  19. package/dist/chunk-LC276BI7.js.map +1 -0
  20. package/dist/{chunk-GOJHU7RZ.cjs → chunk-MWW54PY6.cjs} +25 -25
  21. package/dist/{chunk-GOJHU7RZ.cjs.map → chunk-MWW54PY6.cjs.map} +1 -1
  22. package/dist/{chunk-4DTTEUVY.js → chunk-O2HDONQE.js} +4 -4
  23. package/dist/{chunk-4DTTEUVY.js.map → chunk-O2HDONQE.js.map} +1 -1
  24. package/dist/{chunk-SI7DJWBT.js → chunk-OR6B7IL2.js} +3 -3
  25. package/dist/{chunk-SI7DJWBT.js.map → chunk-OR6B7IL2.js.map} +1 -1
  26. package/dist/{chunk-LMW46NBD.cjs → chunk-OY4PYCJH.cjs} +5 -5
  27. package/dist/chunk-OY4PYCJH.cjs.map +1 -0
  28. package/dist/{chunk-HXITD6DN.cjs → chunk-PMHFLOXY.cjs} +27 -22
  29. package/dist/chunk-PMHFLOXY.cjs.map +1 -0
  30. package/dist/{chunk-TGSEQGM3.cjs → chunk-QEVM3F5X.cjs} +4 -4
  31. package/dist/{chunk-TGSEQGM3.cjs.map → chunk-QEVM3F5X.cjs.map} +1 -1
  32. package/dist/{chunk-ZNQPUPX6.cjs → chunk-RDERZWMO.cjs} +16 -16
  33. package/dist/{chunk-ZNQPUPX6.cjs.map → chunk-RDERZWMO.cjs.map} +1 -1
  34. package/dist/document-tools/core.cjs +99 -99
  35. package/dist/document-tools/core.js +3 -3
  36. package/dist/document-tools/index.cjs +101 -101
  37. package/dist/document-tools/index.js +4 -4
  38. package/dist/index.cjs +1036 -891
  39. package/dist/index.cjs.map +1 -1
  40. package/dist/index.d.cts +411 -240
  41. package/dist/index.d.ts +411 -240
  42. package/dist/index.js +143 -32
  43. package/dist/index.js.map +1 -1
  44. package/dist/shell/index.cjs +32 -32
  45. package/dist/shell/index.js +1 -1
  46. package/dist/viewers/index.cjs +2 -2
  47. package/dist/viewers/index.js +1 -1
  48. package/package.json +3 -3
  49. package/dist/chunk-HXITD6DN.cjs.map +0 -1
  50. package/dist/chunk-LMW46NBD.cjs.map +0 -1
  51. package/dist/chunk-M3SB5TZB.js.map +0 -1
  52. package/dist/chunk-QGOYIYLI.js.map +0 -1
  53. package/dist/chunk-RS6UUPD2.cjs.map +0 -1
  54. package/dist/chunk-ZTPJNKF2.js.map +0 -1
package/README.md CHANGED
@@ -34,6 +34,11 @@ optionally `session`, `documents`, `calendar`, `mail`, `account` and `dictate` (
34
34
  default). `@arbidocs/blocks` re-exports it with the blocks domains too; a blocks site uses that one
35
35
  (see its README).
36
36
 
37
+ `assistantName` is what people call the assistant when they address it in a chat: the `@<name>`
38
+ in the mention menu, the draft a shared thread starts with, and the name a message is routed to
39
+ the assistant on (`useAssistantName()`). It defaults to "ARBI". Mentions stored under an earlier
40
+ name still show as chips.
41
+
37
42
  ### 2. Build a streaming chat
38
43
 
39
44
  ```tsx
@@ -46,12 +51,14 @@ function Chat() {
46
51
 
47
52
  if (!workspaceId) {
48
53
  return (
49
- <button onClick={async () => {
50
- await arbi.login('user@example.com', 'password')
51
- const ws = await arbi.workspaces.list()
52
- await arbi.selectWorkspace(ws[0].external_id)
53
- setWorkspaceId(ws[0].external_id)
54
- }}>
54
+ <button
55
+ onClick={async () => {
56
+ await arbi.login('user@example.com', 'password')
57
+ const ws = await arbi.workspaces.list()
58
+ await arbi.selectWorkspace(ws[0].external_id)
59
+ setWorkspaceId(ws[0].external_id)
60
+ }}
61
+ >
55
62
  Connect
56
63
  </button>
57
64
  )
@@ -70,22 +77,26 @@ function ChatWindow({ workspaceId }: { workspaceId: string }) {
70
77
  return (
71
78
  <div>
72
79
  <div>{response}</div>
73
- <form onSubmit={(e) => {
74
- e.preventDefault()
75
- setResponse('')
76
- mutation.mutate({
77
- question: input,
78
- docIds: docs?.map((d) => d.external_id) ?? [],
79
- previousResponseId: lastId.current,
80
- onToken: (t) => setResponse((r) => r + t),
81
- onStreamStart: ({ assistant_message_ext_id }) => {
82
- lastId.current = assistant_message_ext_id
83
- },
84
- })
85
- setInput('')
86
- }}>
80
+ <form
81
+ onSubmit={(e) => {
82
+ e.preventDefault()
83
+ setResponse('')
84
+ mutation.mutate({
85
+ question: input,
86
+ docIds: docs?.map((d) => d.external_id) ?? [],
87
+ previousResponseId: lastId.current,
88
+ onToken: (t) => setResponse((r) => r + t),
89
+ onStreamStart: ({ assistant_message_ext_id }) => {
90
+ lastId.current = assistant_message_ext_id
91
+ },
92
+ })
93
+ setInput('')
94
+ }}
95
+ >
87
96
  <input value={input} onChange={(e) => setInput(e.target.value)} />
88
- <button type="submit" disabled={mutation.isPending}>Send</button>
97
+ <button type="submit" disabled={mutation.isPending}>
98
+ Send
99
+ </button>
89
100
  </form>
90
101
  </div>
91
102
  )
@@ -96,32 +107,32 @@ That's it — three hooks and you have a streaming RAG chat.
96
107
 
97
108
  ## Hooks
98
109
 
99
- | Hook | Returns | Auto-enabled when |
100
- |------|---------|-------------------|
101
- | `useArbi()` | `Arbi` instance | Always |
102
- | `useWorkspaces()` | User's workspaces | Logged in |
103
- | `useCurrentWorkspace()` | The selected workspace (`workspaceId`, `workspaceStatus`, its list entry) and my `role` / `isMember` in it | Logged in |
104
- | `useActiveConfigId()` | The configuration new work runs with (the chosen one, else the replied-to message's, else the last) | Always |
105
- | `useArbiShellWorkspaces(options)` | Workspaces as shell/gallery view models, the active one, `open(workspace)` (select, then `onOpened`) | Logged in |
106
- | `useShellWorkspaces(options)` | Same, over a list and `select` you supply (no provider needed) | Always |
107
- | `useDocuments(workspaceId)` | Workspace documents | Workspace selected |
108
- | `useConversations(workspaceId)` | Workspace conversations | Workspace selected |
109
- | `useTags(workspaceId)` | Workspace tags | Workspace selected |
110
- | `useTags(workspaceId, { kind, parentId, ids, include: ['links'], linksLimit })` | Tags filtered, with each one's documents, facts and threads (a table's rows) | Workspace selected |
111
- | `useTagKindSchema(kind)` / `useUpdateTagKindSchema()` | A kind's fields in the workspace (a table's columns); set them | Workspace selected |
112
- | `useSetTagValues()` | Merge-patch a tag's values for its kind's fields | Call `.mutate()` |
113
- | `useFactsSearch({ workspaceId })` | The facts Smart Search: the query box, the hits of the last search (hybrid), `search()` and `clear()`, kept for the session under `FACTS_SEARCH_VIEW` | Workspace selected |
114
- | `useAssistantQuery()` | Streaming mutation | Call `.mutate()` |
115
- | `useHealth()` | Backend status | Pass `{ enabled: true }` |
116
- | `useProfile()` / `useUpdateProfile()` | The user's name, picture and email; save name or picture | Logged in |
117
- | `useRequestEmailChange()` / `useConfirmEmailChange()` | Email change by verification code | Call `.mutate()` |
118
- | `usePasswordChange()` | Change the master password (one request: the password only wraps the account key) | Call `.mutate()` |
119
- | `useNotificationPreferences(keys)` | Email notification switches, optimistic save | Logged in |
120
- | `useSessions()` / `useTerminateSession()` / `useLogoutAllSessions()` | Active sessions, end one, sign out everywhere | Logged in |
121
- | `useDeleteAccount()` | Close the account (soft delete) | Call `.mutate()` |
122
- | `useModelConnections()` / `useDirectModelUsage()` | The main agent's model connections (box and personal) and the direct calls of the last 30 days | Logged in |
123
- | `useSaveModelConnection()` / `useRemoveModelConnection()` / `useUnlockModelConnections()` | Save a personal connection (its key sealed to the identity, then unlocked on this session), remove one, unlock the personal keys | Call `.mutate()` |
124
- | `useFeature(name)` / `useFeatureSwitch(name)` | Whether a feature is on for the user (`<ArbiHost config={{ features }}>`; unlisted: on), and how to switch it | Always |
110
+ | Hook | Returns | Auto-enabled when |
111
+ | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ |
112
+ | `useArbi()` | `Arbi` instance | Always |
113
+ | `useWorkspaces()` | User's workspaces | Logged in |
114
+ | `useCurrentWorkspace()` | The selected workspace (`workspaceId`, `workspaceStatus`, its list entry) and my `role` / `isMember` in it | Logged in |
115
+ | `useActiveConfigId()` | The configuration new work runs with (the chosen one, else the replied-to message's, else the last) | Always |
116
+ | `useArbiShellWorkspaces(options)` | Workspaces as shell/gallery view models, the active one, `open(workspace)` (select, then `onOpened`) | Logged in |
117
+ | `useShellWorkspaces(options)` | Same, over a list and `select` you supply (no provider needed) | Always |
118
+ | `useDocuments(workspaceId)` | Workspace documents | Workspace selected |
119
+ | `useConversations(workspaceId)` | Workspace conversations | Workspace selected |
120
+ | `useTags(workspaceId)` | Workspace tags | Workspace selected |
121
+ | `useTags(workspaceId, { kind, parentId, ids, include: ['links'], linksLimit })` | Tags filtered, with each one's documents, facts and threads (a table's rows) | Workspace selected |
122
+ | `useTagKindSchema(kind)` / `useUpdateTagKindSchema()` | A kind's fields in the workspace (a table's columns); set them | Workspace selected |
123
+ | `useSetTagValues()` | Merge-patch a tag's values for its kind's fields | Call `.mutate()` |
124
+ | `useFactsSearch({ workspaceId })` | The facts Smart Search: the query box, the hits of the last search (hybrid), `search()` and `clear()`, kept for the session under `FACTS_SEARCH_VIEW` | Workspace selected |
125
+ | `useAssistantQuery()` | Streaming mutation | Call `.mutate()` |
126
+ | `useHealth()` | Backend status | Pass `{ enabled: true }` |
127
+ | `useProfile()` / `useUpdateProfile()` | The user's name, picture and email; save name or picture | Logged in |
128
+ | `useRequestEmailChange()` / `useConfirmEmailChange()` | Email change by verification code | Call `.mutate()` |
129
+ | `usePasswordChange()` | Change the master password (one request: the password only wraps the account key) | Call `.mutate()` |
130
+ | `useNotificationPreferences(keys)` | Email notification switches, optimistic save | Logged in |
131
+ | `useSessions()` / `useTerminateSession()` / `useLogoutAllSessions()` | Active sessions, end one, sign out everywhere | Logged in |
132
+ | `useDeleteAccount()` | Close the account (soft delete) | Call `.mutate()` |
133
+ | `useModelConnections()` / `useDirectModelUsage()` | The main agent's model connections (box and personal) and the direct calls of the last 30 days | Logged in |
134
+ | `useSaveModelConnection()` / `useRemoveModelConnection()` / `useUnlockModelConnections()` | Save a personal connection (its key sealed to the identity, then unlocked on this session), remove one, unlock the personal keys | Call `.mutate()` |
135
+ | `useFeature(name)` / `useFeatureSwitch(name)` | Whether a feature is on for the user (`<ArbiHost config={{ features }}>`; unlisted: on), and how to switch it | Always |
125
136
 
126
137
  The account hooks have SDK-free controllers for hosts without an `arbi` (`useNameEditor`,
127
138
  `useEmailChange`, `usePasswordChangeForm`, `useDeleteAccountFlow`, `useAvatarCrop`,
@@ -152,12 +163,21 @@ orders a "recent workspaces" list.
152
163
 
153
164
  **Thread tabs.** The open conversations are the layout's `tabs.threads` (in the order opened, at
154
165
  most `MAX_THREAD_TABS`), with `tabs.activeThread` the one on screen (`threadTabId`: its conversation,
155
- or `new`). Each tab keeps the composer it was left with (`ArbiThreadTabView`: its line, edit, model,
156
- scroll position and draft), so `selectThreadTab` brings it back and `openThreadTab` opens a thread at
157
- its latest message. They are kept across reloads with the layout's `persist`, never with what was
158
- typed (keep drafts with `createSealedDraftStorage`). A host adapter over its own composer state
159
- applies the layout store's `threads` changes (`open`, `select`, `close`, `showList`), which take the
160
- composer being left and say what shows next.
166
+ or `new`). Each tab keeps the composer it was left with (`ArbiThreadTabView`: its line, edit, model
167
+ and scroll position; its draft is the chat's, per conversation), so `selectThreadTab` brings it back
168
+ and `openThreadTab` opens a thread at its latest message. They are kept across reloads with the
169
+ layout's `persist`, never with what was typed.
170
+
171
+ **Chat.** The open conversation and its composer, the turns running in each conversation, the
172
+ context documents and facts, and the agent bar's queue and run control live in a chat store
173
+ (`createArbiChatStore({ layout, persist, draftStorage })`), which moves with the layout's thread tabs
174
+ and tells readers once per tab change. With a `persist` (`createStoragePersist({ parse:
175
+ parseSavedChat })`) the open conversation and its line, the context, each agent chat's agent and the
176
+ chosen model survive a reload; the drafts are kept apart, sealed to the person
177
+ (`createSealedDraftStorage`), and only for open tabs. `createArbiSessionStore` uses one in memory. A
178
+ host with state of its own composes its session from parts instead (`composeArbiSessionStore({
179
+ layout, workspace, chat, documents })`, with `createArbiDocumentSessionStore` or its own documents
180
+ part).
161
181
 
162
182
  ## Artifact editing (`@arbidocs/react/artifacts`)
163
183
 
@@ -193,13 +213,13 @@ PDF), `useDocumentMarkup`, `createMarkupStore` (an `AnnotationStore` over the se
193
213
 
194
214
  Pass these to `mutation.mutate()` alongside `question` and `docIds`:
195
215
 
196
- | Callback | Description |
197
- |----------|-------------|
198
- | `onToken(token)` | Each text chunk as it streams |
216
+ | Callback | Description |
217
+ | --------------------------------------------- | -------------------------------------------------- |
218
+ | `onToken(token)` | Each text chunk as it streams |
199
219
  | `onStreamStart({ assistant_message_ext_id })` | Stream started — save the ID for follow-up queries |
200
- | `onAgentStep(step)` | Agent tool usage (searching, reading, etc.) |
201
- | `onError(message)` | Error during streaming |
202
- | `onComplete()` | Stream finished |
220
+ | `onAgentStep(step)` | Agent tool usage (searching, reading, etc.) |
221
+ | `onError(message)` | Error during streaming |
222
+ | `onComplete()` | Stream finished |
203
223
 
204
224
  ## Cache invalidation
205
225
 
@@ -215,19 +235,18 @@ queryClient.invalidateQueries({ queryKey: arbiQueryKeys.documents(workspaceId) }
215
235
 
216
236
  - `react` >= 18
217
237
 
218
-
219
238
  ## Tasks, agents, skills, contacts and AI usage
220
239
 
221
240
  Hooks for an "AI workforce" and a messages screen. Writes invalidate through `arbiQueryKeys`, so
222
241
  `useTasks`, `useAgents`, `useConfigs` and `useChats` refresh by themselves.
223
242
 
224
243
  ```tsx
225
- const create = useCreateTask() // mutateAsync(CreateTaskRequest) -> TaskResponse
226
- const run = useRunTask() // approves a run parked for access (temporary grant), then runs
227
- const runs = useTaskRuns(taskId) // polls while a run is in flight
228
- const save = useSaveAgentConfig() // { agentExtId, sections: { Agents: { PERSONA, ... } } }
229
- const grant = useGrantAgentAccess() // { agentExtId, workspaceId, mode?: { kind: 'standing' | 'temporary' } }
230
- const contacts = usePendingContacts() // + useInviteContacts(), useCreateContact(), useUpdateContact(), useDeleteContact()
244
+ const create = useCreateTask() // mutateAsync(CreateTaskRequest) -> TaskResponse
245
+ const run = useRunTask() // approves a run parked for access (temporary grant), then runs
246
+ const runs = useTaskRuns(taskId) // polls while a run is in flight
247
+ const save = useSaveAgentConfig() // { agentExtId, sections: { Agents: { PERSONA, ... } } }
248
+ const grant = useGrantAgentAccess() // { agentExtId, workspaceId, mode?: { kind: 'standing' | 'temporary' } }
249
+ const contacts = usePendingContacts() // + useInviteContacts(), useCreateContact(), useUpdateContact(), useDeleteContact()
231
250
  ```
232
251
 
233
252
  Form-to-request mappings (`taskComposerToCreateRequest`, `composePersona`, ...) are in
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkZNQPUPX6_cjs = require('../chunk-ZNQPUPX6.cjs');
4
- var chunkRS6UUPD2_cjs = require('../chunk-RS6UUPD2.cjs');
3
+ var chunkRDERZWMO_cjs = require('../chunk-RDERZWMO.cjs');
4
+ var chunk6RSVGLQY_cjs = require('../chunk-6RSVGLQY.cjs');
5
5
  var chunk3AADNIOK_cjs = require('../chunk-3AADNIOK.cjs');
6
6
  var chunkGQAXAZN7_cjs = require('../chunk-GQAXAZN7.cjs');
7
- var chunkY7S2SQH3_cjs = require('../chunk-Y7S2SQH3.cjs');
7
+ var chunk5YGUBXXH_cjs = require('../chunk-5YGUBXXH.cjs');
8
8
  require('../chunk-N73IMVFF.cjs');
9
9
  var chunkZWFMFOGP_cjs = require('../chunk-ZWFMFOGP.cjs');
10
10
  var chunkVOFNX4P6_cjs = require('../chunk-VOFNX4P6.cjs');
@@ -279,7 +279,7 @@ var isRefusal = (error) => {
279
279
  return code === 401 || code === 403;
280
280
  };
281
281
  function useArtifactText(docId, options) {
282
- const arbi = chunkY7S2SQH3_cjs.useArbi();
282
+ const arbi = chunk5YGUBXXH_cjs.useArbi();
283
283
  const { attempts, baseDelayMs, maxDelayMs } = {
284
284
  ...DEFAULT_ARTIFACT_TEXT_RETRY,
285
285
  ...options?.retry
@@ -335,12 +335,12 @@ function useArtifactText(docId, options) {
335
335
  // src/artifacts/useArtifactSession.ts
336
336
  function useArtifactVersions(workspaceId, docId) {
337
337
  const plainId = docId ? chunkZWFMFOGP_cjs.parseVersionRef(docId).docId : null;
338
- const { data: documents } = chunkZNQPUPX6_cjs.useDocuments(workspaceId);
338
+ const { data: documents } = chunkRDERZWMO_cjs.useDocuments(workspaceId);
339
339
  const listed = react.useMemo(
340
340
  () => (documents ?? []).find((d) => d.external_id === plainId),
341
341
  [documents, plainId]
342
342
  );
343
- const { data: history } = chunkRS6UUPD2_cjs.useDocumentVersionList(plainId, {
343
+ const { data: history } = chunk6RSVGLQY_cjs.useDocumentVersionList(plainId, {
344
344
  enabled: !!plainId && documents !== void 0 && !listed
345
345
  });
346
346
  return react.useMemo(
@@ -349,7 +349,7 @@ function useArtifactVersions(workspaceId, docId) {
349
349
  );
350
350
  }
351
351
  function useSaveArtifactVersion() {
352
- const arbi = chunkY7S2SQH3_cjs.useArbi();
352
+ const arbi = chunk5YGUBXXH_cjs.useArbi();
353
353
  const queryClient = reactQuery.useQueryClient();
354
354
  return reactQuery.useMutation({
355
355
  mutationFn: async ({ title, content, versionOf, configId, wpType }) => {
@@ -364,7 +364,7 @@ function useSaveArtifactVersion() {
364
364
  }
365
365
  );
366
366
  const docId = result.doc_ext_ids?.[0];
367
- if (docId) await chunkZNQPUPX6_cjs.refreshDocuments(queryClient, arbi, [docId]);
367
+ if (docId) await chunkRDERZWMO_cjs.refreshDocuments(queryClient, arbi, [docId]);
368
368
  await queryClient.invalidateQueries({ queryKey: chunkGQAXAZN7_cjs.arbiQueryKeys.allDocumentVersions() });
369
369
  if (docId)
370
370
  await queryClient.invalidateQueries({ queryKey: chunkGQAXAZN7_cjs.arbiQueryKeys.parsedDocument(docId) });
@@ -484,7 +484,7 @@ function useArtifactSession(options) {
484
484
  );
485
485
  }
486
486
  function useArtifactSource(documentId, enabled = true) {
487
- const arbi = chunkY7S2SQH3_cjs.useArbi();
487
+ const arbi = chunk5YGUBXXH_cjs.useArbi();
488
488
  return reactQuery.useQuery({
489
489
  queryKey: chunkGQAXAZN7_cjs.arbiQueryKeys.artifactSource(documentId ?? ""),
490
490
  queryFn: async () => (await arbi.documents.download(documentId)).text(),
@@ -1,9 +1,9 @@
1
- import { useDocuments, refreshDocuments } from '../chunk-2LV53J46.js';
2
- import { useDocumentVersionList } from '../chunk-QGOYIYLI.js';
1
+ import { useDocuments, refreshDocuments } from '../chunk-JHN4PKWX.js';
2
+ import { useDocumentVersionList } from '../chunk-33PVGKXT.js';
3
3
  import { revertRedlineRegion, buildHybridRedlineWithRegions, buildHybridRedlineMarkdown } from '../chunk-74N436VK.js';
4
4
  export { buildHybridRedlineMarkdown, buildHybridRedlineWithRegions, revertRedlineRegion } from '../chunk-74N436VK.js';
5
5
  import { arbiQueryKeys } from '../chunk-AOEJ744V.js';
6
- import { useArbi } from '../chunk-R7YNABZY.js';
6
+ import { useArbi } from '../chunk-2Y6LJNWA.js';
7
7
  import '../chunk-DPYBZDJB.js';
8
8
  import { isDocumentId, parseVersionRef, flattenChunks, documentVersions, toArtifactVersions, findVersion, versionLabel, cleanDraftWithReport } from '../chunk-NNWMHMEC.js';
9
9
  export { cleanDraftMarkdown, cleanDraftWithReport, documentVersions, findVersion, flattenChunks, isDocumentId, parseVersionRef, promoteBoldTitle, repairParsedStructure, repairParsedTitle, savedFromId, stripAgentPreamble, toArtifactVersions, unescapeMarkdown, unwrapCitationLinks, versionLabel, versionRef } from '../chunk-NNWMHMEC.js';
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var chunkHXITD6DN_cjs = require('../../chunk-HXITD6DN.cjs');
4
- require('../../chunk-RS6UUPD2.cjs');
3
+ var chunkPMHFLOXY_cjs = require('../../chunk-PMHFLOXY.cjs');
4
+ require('../../chunk-6RSVGLQY.cjs');
5
5
  require('../../chunk-GQAXAZN7.cjs');
6
- var chunkY7S2SQH3_cjs = require('../../chunk-Y7S2SQH3.cjs');
6
+ var chunk5YGUBXXH_cjs = require('../../chunk-5YGUBXXH.cjs');
7
7
  var chunkDZUBZ45Y_cjs = require('../../chunk-DZUBZ45Y.cjs');
8
8
  require('../../chunk-N73IMVFF.cjs');
9
9
  require('../../chunk-ZWFMFOGP.cjs');
@@ -122,11 +122,11 @@ function useCallTranscriber({
122
122
  const room = componentsReact.useRoomContext();
123
123
  const { localParticipant } = componentsReact.useLocalParticipant();
124
124
  const myIdentity = localParticipant.identity;
125
- const arbi = chunkY7S2SQH3_cjs.useArbi();
125
+ const arbi = chunk5YGUBXXH_cjs.useArbi();
126
126
  const queryClient = reactQuery.useQueryClient();
127
127
  const profile = arbi.isLoggedIn ? arbi.user.profile() : null;
128
- const myProfileName = profile && chunkHXITD6DN_cjs.toProfileView(profile).fullName || null;
129
- const deploymentAvailable = chunkHXITD6DN_cjs.useCallTranscriptionAvailable();
128
+ const myProfileName = profile && chunkPMHFLOXY_cjs.toProfileView(profile).fullName || null;
129
+ const deploymentAvailable = chunkPMHFLOXY_cjs.useCallTranscriptionAvailable();
130
130
  const available = deploymentAvailable && !!callKey;
131
131
  const [state, setState] = react.useState(null);
132
132
  const [creatorExtId, setCreatorExtId] = react.useState(null);
@@ -169,7 +169,7 @@ function useCallTranscriber({
169
169
  };
170
170
  }, [available, callExtId]);
171
171
  react.useEffect(
172
- () => chunkHXITD6DN_cjs.onCallEvent("call.transcription", (message) => {
172
+ () => chunkPMHFLOXY_cjs.onCallEvent("call.transcription", (message) => {
173
173
  if (message.call_ext_id === callExtId) applyState(message);
174
174
  }),
175
175
  [callExtId, applyState]
@@ -185,7 +185,7 @@ function useCallTranscriber({
185
185
  const persist = react.useCallback(
186
186
  (segment, speakerNeedsProxy) => {
187
187
  if (!callKey || persisted.current.has(segment.segmentId)) return;
188
- const role = chunkHXITD6DN_cjs.transcriptPersistRole({
188
+ const role = chunkPMHFLOXY_cjs.transcriptPersistRole({
189
189
  myIdentity,
190
190
  canPost: canPost && (segment.speakerIdentity !== myIdentity || selfPosts.current),
191
191
  hasCallKey: true,
@@ -194,7 +194,7 @@ function useCallTranscriber({
194
194
  });
195
195
  if (!role) return;
196
196
  persisted.current.add(segment.segmentId);
197
- chunkHXITD6DN_cjs.persistTranscriptSegment(arbi, queryClient, callExtId, callKey, segment).catch(
197
+ chunkPMHFLOXY_cjs.persistTranscriptSegment(arbi, queryClient, callExtId, callKey, segment).catch(
198
198
  (err) => {
199
199
  persisted.current.delete(segment.segmentId);
200
200
  if (role === "own" && err?.status === 403) {
@@ -214,7 +214,7 @@ function useCallTranscriber({
214
214
  );
215
215
  react.useEffect(() => {
216
216
  const onData = (payload, participant, _kind, topic, _encryption, participantIdentity) => {
217
- if (topic === chunkHXITD6DN_cjs.CALL_TRANSCRIPTION_TOPIC) {
217
+ if (topic === chunkPMHFLOXY_cjs.CALL_TRANSCRIPTION_TOPIC) {
218
218
  if (participant || participantIdentity) return;
219
219
  try {
220
220
  const next = browser.calls.transcriptionStateFrom(JSON.parse(new TextDecoder().decode(payload)));
@@ -223,10 +223,10 @@ function useCallTranscriber({
223
223
  }
224
224
  return;
225
225
  }
226
- if (topic !== chunkHXITD6DN_cjs.CALL_CAPTION_TOPIC || !callKey) return;
226
+ if (topic !== chunkPMHFLOXY_cjs.CALL_CAPTION_TOPIC || !callKey) return;
227
227
  const identity = participant?.identity ?? participantIdentity;
228
228
  if (!identity || identity === myIdentity) return;
229
- void chunkHXITD6DN_cjs.decodeCaptionPacket(payload, callKey).then((packet) => {
229
+ void chunkPMHFLOXY_cjs.decodeCaptionPacket(payload, callKey).then((packet) => {
230
230
  if (!packet || packet.identity !== identity) return;
231
231
  const name = participant?.name || packet.name || identity;
232
232
  const t = Math.min(packet.t, Date.now());
@@ -266,7 +266,7 @@ function useCallTranscriber({
266
266
  })) {
267
267
  return;
268
268
  }
269
- const segmentId = chunkHXITD6DN_cjs.newSegmentId();
269
+ const segmentId = chunkPMHFLOXY_cjs.newSegmentId();
270
270
  const startedAt = new Date(segment.startedAt).toISOString();
271
271
  let text;
272
272
  try {
@@ -300,7 +300,7 @@ function useCallTranscriber({
300
300
  });
301
301
  try {
302
302
  await localParticipant.publishData(
303
- await chunkHXITD6DN_cjs.encodeCaptionPacket(
303
+ await chunkPMHFLOXY_cjs.encodeCaptionPacket(
304
304
  {
305
305
  v: 1,
306
306
  segment_id: segmentId,
@@ -312,7 +312,7 @@ function useCallTranscriber({
312
312
  },
313
313
  callKey
314
314
  ),
315
- { reliable: true, topic: chunkHXITD6DN_cjs.CALL_CAPTION_TOPIC }
315
+ { reliable: true, topic: chunkPMHFLOXY_cjs.CALL_CAPTION_TOPIC }
316
316
  );
317
317
  } catch (err) {
318
318
  console.warn("[calls] could not broadcast a caption", err);
@@ -393,7 +393,7 @@ function useCallRecorder({
393
393
  isCreator,
394
394
  linkVersion = null
395
395
  }) {
396
- const arbi = chunkY7S2SQH3_cjs.useArbi();
396
+ const arbi = chunk5YGUBXXH_cjs.useArbi();
397
397
  const queryClient = reactQuery.useQueryClient();
398
398
  const room = componentsReact.useRoomContext();
399
399
  const { localParticipant } = componentsReact.useLocalParticipant();
@@ -427,14 +427,14 @@ function useCallRecorder({
427
427
  };
428
428
  }, [callExtId]);
429
429
  react.useEffect(
430
- () => chunkHXITD6DN_cjs.onCallEvent("call.recording", (message) => {
430
+ () => chunkPMHFLOXY_cjs.onCallEvent("call.recording", (message) => {
431
431
  if (message.call_ext_id === callExtId) applyState(message);
432
432
  }),
433
433
  [callExtId, applyState]
434
434
  );
435
435
  react.useEffect(() => {
436
436
  const onData = (payload, participant, _kind, topic, _encryption, participantIdentity) => {
437
- if (topic !== chunkHXITD6DN_cjs.CALL_RECORDING_TOPIC) return;
437
+ if (topic !== chunkPMHFLOXY_cjs.CALL_RECORDING_TOPIC) return;
438
438
  if (participant || participantIdentity) return;
439
439
  try {
440
440
  const next = browser.calls.recordingStateFrom(JSON.parse(new TextDecoder().decode(payload)));
@@ -455,7 +455,7 @@ function useCallRecorder({
455
455
  try {
456
456
  const row = call ?? await arbi.calls.get(callExtId);
457
457
  if (!row.workspace_locked && !row.chat_ext_id && callKey) {
458
- const ref = await chunkHXITD6DN_cjs.ensureMeetingChat(arbi, queryClient, callExtId, callKey);
458
+ const ref = await chunkPMHFLOXY_cjs.ensureMeetingChat(arbi, queryClient, callExtId, callKey);
459
459
  if (ref.kind === "chat") setCall({ ...row, chat_ext_id: ref.chatExtId });
460
460
  }
461
461
  const answer = await arbi.calls.recording.start(callExtId, mode);
@@ -553,11 +553,11 @@ function useCallRecorder({
553
553
  }
554
554
  function useTrackUploader(recording, callKey, kind, mimeType) {
555
555
  const { recordingExtId, call, startedAt, shouldCapture, markStopped, linkVersion } = recording;
556
- const arbi = chunkY7S2SQH3_cjs.useArbi();
556
+ const arbi = chunk5YGUBXXH_cjs.useArbi();
557
557
  const queryClient = reactQuery.useQueryClient();
558
558
  return react.useMemo(() => {
559
559
  if (!shouldCapture || !recordingExtId || !call) return null;
560
- return chunkHXITD6DN_cjs.trackUploaderFor({
560
+ return chunkPMHFLOXY_cjs.trackUploaderFor({
561
561
  arbi,
562
562
  callExtId: call.external_id,
563
563
  recordingExtId,
@@ -565,7 +565,7 @@ function useTrackUploader(recording, callKey, kind, mimeType) {
565
565
  mimeType,
566
566
  recordingStartedAt: startedAt,
567
567
  linkVersion,
568
- conversationKey: () => chunkHXITD6DN_cjs.conversationKeyForCall(arbi, queryClient, call, { callKey }),
568
+ conversationKey: () => chunkPMHFLOXY_cjs.conversationKeyForCall(arbi, queryClient, call, { callKey }),
569
569
  // The server stopped the recording at the quota (its state event says so too).
570
570
  onStopped: () => markStopped()
571
571
  });
@@ -593,9 +593,9 @@ function useInCallChat({
593
593
  const room = componentsReact.useRoomContext();
594
594
  const { localParticipant } = componentsReact.useLocalParticipant();
595
595
  const myIdentity = localParticipant.identity;
596
- const arbi = chunkY7S2SQH3_cjs.useArbi();
596
+ const arbi = chunk5YGUBXXH_cjs.useArbi();
597
597
  const queryClient = reactQuery.useQueryClient();
598
- const openMeetingChat = chunkY7S2SQH3_cjs.useArbiHost().calls?.openMeetingChat;
598
+ const openMeetingChat = chunk5YGUBXXH_cjs.useArbiHost().calls?.openMeetingChat;
599
599
  const signedIn = arbi.isLoggedIn;
600
600
  const persists = !!callKey && signedIn && !readOnly && persist;
601
601
  const [live, setLive] = react.useState([]);
@@ -614,10 +614,10 @@ function useInCallChat({
614
614
  react.useEffect(() => {
615
615
  if (!callKey) return;
616
616
  const onData = (payload, participant, _kind, topic, _encryption, participantIdentity) => {
617
- if (topic !== chunkHXITD6DN_cjs.CALL_CHAT_TOPIC) return;
617
+ if (topic !== chunkPMHFLOXY_cjs.CALL_CHAT_TOPIC) return;
618
618
  const identity = participant?.identity ?? participantIdentity;
619
619
  if (!identity || identity === myIdentity) return;
620
- void chunkHXITD6DN_cjs.decodeCallChatPacket(payload, callKey).then((packet) => {
620
+ void chunkPMHFLOXY_cjs.decodeCallChatPacket(payload, callKey).then((packet) => {
621
621
  if (!packet) return;
622
622
  const key = `${identity}:${packet.id}`;
623
623
  if (seen.current.has(key)) return;
@@ -647,7 +647,7 @@ function useInCallChat({
647
647
  if (!open || !canRead || historyRequested.current) return;
648
648
  historyRequested.current = true;
649
649
  setHistoryLoading(true);
650
- chunkHXITD6DN_cjs.loadMeetingHistory(arbi, queryClient, callExtId).then((result) => {
650
+ chunkPMHFLOXY_cjs.loadMeetingHistory(arbi, queryClient, callExtId).then((result) => {
651
651
  if (!result) return;
652
652
  setMeetingChat(result.ref);
653
653
  setHistory(result.messages);
@@ -658,13 +658,13 @@ function useInCallChat({
658
658
  }, [open, canRead, callExtId]);
659
659
  const send = react.useCallback(
660
660
  async (raw) => {
661
- const text = raw.trim().slice(0, chunkHXITD6DN_cjs.CALL_CHAT_MAX_CHARS);
661
+ const text = raw.trim().slice(0, chunkPMHFLOXY_cjs.CALL_CHAT_MAX_CHARS);
662
662
  if (!text || !callKey || readOnly) return;
663
- const id = chunkHXITD6DN_cjs.newPacketId();
663
+ const id = chunkPMHFLOXY_cjs.newPacketId();
664
664
  const at = Date.now();
665
665
  await localParticipant.publishData(
666
- await chunkHXITD6DN_cjs.encodeCallChatPacket({ v: 1, id, text, at }, callKey),
667
- { reliable: true, topic: chunkHXITD6DN_cjs.CALL_CHAT_TOPIC }
666
+ await chunkPMHFLOXY_cjs.encodeCallChatPacket({ v: 1, id, text, at }, callKey),
667
+ { reliable: true, topic: chunkPMHFLOXY_cjs.CALL_CHAT_TOPIC }
668
668
  );
669
669
  setLive((prev) => [
670
670
  ...prev,
@@ -683,7 +683,7 @@ function useInCallChat({
683
683
  (prev) => prev.map((l) => l.id === id && l.senderIdentity === myIdentity ? { ...l, status } : l)
684
684
  );
685
685
  try {
686
- setMeetingChat(await chunkHXITD6DN_cjs.persistMeetingMessage(arbi, queryClient, callExtId, callKey, text));
686
+ setMeetingChat(await chunkPMHFLOXY_cjs.persistMeetingMessage(arbi, queryClient, callExtId, callKey, text));
687
687
  mark("saved");
688
688
  } catch (err) {
689
689
  console.warn("[calls] could not keep the message in the meeting chat", err);
@@ -695,7 +695,7 @@ function useInCallChat({
695
695
  const openMeeting = react.useCallback(async () => {
696
696
  if (!callKey) return;
697
697
  try {
698
- const ref = meetingChat ?? await chunkHXITD6DN_cjs.ensureMeetingChat(arbi, queryClient, callExtId, callKey);
698
+ const ref = meetingChat ?? await chunkPMHFLOXY_cjs.ensureMeetingChat(arbi, queryClient, callExtId, callKey);
699
699
  setMeetingChat(ref);
700
700
  openMeetingChat?.(ref);
701
701
  } catch (err) {
@@ -703,7 +703,7 @@ function useInCallChat({
703
703
  }
704
704
  }, [callExtId, callKey, meetingChat]);
705
705
  const lines = react.useMemo(
706
- () => chunkHXITD6DN_cjs.mergeChatLines(history, live, {
706
+ () => chunkPMHFLOXY_cjs.mergeChatLines(history, live, {
707
707
  myIdentity,
708
708
  nameOf: (identity) => identity === myIdentity ? localParticipant.name || "You" : room.remoteParticipants.get(identity)?.name || null
709
709
  }),
@@ -735,7 +735,7 @@ function useWebinar({
735
735
  linkVersion = null,
736
736
  callKey
737
737
  }) {
738
- const arbi = chunkY7S2SQH3_cjs.useArbi();
738
+ const arbi = chunk5YGUBXXH_cjs.useArbi();
739
739
  const webinarApi = react.useCallback(() => arbi.calls.webinar, [arbi]);
740
740
  const enabled = !!roleHint;
741
741
  const room = componentsReact.useRoomContext();
@@ -762,7 +762,7 @@ function useWebinar({
762
762
  const n = ++questionsRead.current;
763
763
  try {
764
764
  const rows = await webinarApi().questions.list(callExtId, linkVersion);
765
- const opened = await Promise.all(rows.map((q) => chunkHXITD6DN_cjs.openQuestion(q, callKey)));
765
+ const opened = await Promise.all(rows.map((q) => chunkPMHFLOXY_cjs.openQuestion(q, callKey)));
766
766
  if (n === questionsRead.current) setQuestions(opened);
767
767
  } catch (err) {
768
768
  console.warn("[calls] could not load the questions", err);
@@ -774,7 +774,7 @@ function useWebinar({
774
774
  }, [refresh, refreshQuestions]);
775
775
  react.useEffect(() => {
776
776
  if (!enabled) return;
777
- return chunkHXITD6DN_cjs.onCallEvent("call.webinar", (m) => {
777
+ return chunkPMHFLOXY_cjs.onCallEvent("call.webinar", (m) => {
778
778
  if (m.call_ext_id !== callExtId) return;
779
779
  setState((s) => s ? { ...s, live: m.live, chat: m.chat } : s);
780
780
  });
@@ -783,8 +783,8 @@ function useWebinar({
783
783
  react.useEffect(() => {
784
784
  if (!enabled) return;
785
785
  const onData = (payload, participant, _kind, topic, _encryption, participantIdentity) => {
786
- if (topic !== chunkHXITD6DN_cjs.CALL_WEBINAR_TOPIC) return;
787
- const packet = chunkHXITD6DN_cjs.parseWebinarPacket(payload, !!(participant || participantIdentity));
786
+ if (topic !== chunkPMHFLOXY_cjs.CALL_WEBINAR_TOPIC) return;
787
+ const packet = chunkPMHFLOXY_cjs.parseWebinarPacket(payload, !!(participant || participantIdentity));
788
788
  if (!packet) return;
789
789
  switch (packet.type) {
790
790
  case "state":
@@ -805,7 +805,7 @@ function useWebinar({
805
805
  return;
806
806
  case "demoted":
807
807
  setStageCheck(false);
808
- chunkHXITD6DN_cjs.markRejoining(callExtId);
808
+ chunkPMHFLOXY_cjs.markRejoining(callExtId);
809
809
  if (fallback.current) clearTimeout(fallback.current);
810
810
  fallback.current = setTimeout(() => void room.disconnect(), DEMOTE_REJOIN_FALLBACK_MS);
811
811
  return;
@@ -832,12 +832,12 @@ function useWebinar({
832
832
  [callExtId, linkVersion]
833
833
  );
834
834
  const stepDown = react.useCallback(async () => {
835
- chunkHXITD6DN_cjs.markRejoining(callExtId);
835
+ chunkPMHFLOXY_cjs.markRejoining(callExtId);
836
836
  setStageCheck(false);
837
837
  try {
838
838
  await webinarApi().demote(callExtId, myIdentity, linkVersion);
839
839
  } catch (err) {
840
- chunkHXITD6DN_cjs.markRejoining(callExtId, false);
840
+ chunkPMHFLOXY_cjs.markRejoining(callExtId, false);
841
841
  failed("leave the stage")(err);
842
842
  }
843
843
  }, [callExtId, myIdentity, linkVersion]);
@@ -897,7 +897,7 @@ function useWebinar({
897
897
  if (!callKey) throw new Error("This call has no key.");
898
898
  await webinarApi().questions.ask(
899
899
  callExtId,
900
- await chunkHXITD6DN_cjs.sealQuestionText(text, callKey),
900
+ await chunkPMHFLOXY_cjs.sealQuestionText(text, callKey),
901
901
  linkVersion
902
902
  );
903
903
  }, "ask the question"),
@@ -911,7 +911,7 @@ function useWebinar({
911
911
  await webinarApi().questions.update(
912
912
  callExtId,
913
913
  id,
914
- { answer: await chunkHXITD6DN_cjs.sealQuestionText(text, callKey) },
914
+ { answer: await chunkPMHFLOXY_cjs.sealQuestionText(text, callKey) },
915
915
  linkVersion
916
916
  );
917
917
  }, "answer the question"),
@@ -941,15 +941,15 @@ function useWebinar({
941
941
  function useHostMuteNotice(callExtId) {
942
942
  const room = componentsReact.useRoomContext();
943
943
  react.useEffect(() => {
944
- const notifyMuted = chunkHXITD6DN_cjs.createMutedNotifier((text) => chunkDZUBZ45Y_cjs.notify.info(text));
944
+ const notifyMuted = chunkPMHFLOXY_cjs.createMutedNotifier((text) => chunkDZUBZ45Y_cjs.notify.info(text));
945
945
  const onData = (payload, participant, _kind, topic, _encryption, participantIdentity) => {
946
- if (topic !== chunkHXITD6DN_cjs.CALL_MODERATION_TOPIC) return;
946
+ if (topic !== chunkPMHFLOXY_cjs.CALL_MODERATION_TOPIC) return;
947
947
  if (participant || participantIdentity) return;
948
- const notice = chunkHXITD6DN_cjs.mutedNoticeFromPacket(payload);
948
+ const notice = chunkPMHFLOXY_cjs.mutedNoticeFromPacket(payload);
949
949
  if (notice) notifyMuted(notice);
950
950
  };
951
951
  room.on(livekitClient.RoomEvent.DataReceived, onData);
952
- const offWs = chunkHXITD6DN_cjs.onCallEvent("call.muted", (message) => {
952
+ const offWs = chunkPMHFLOXY_cjs.onCallEvent("call.muted", (message) => {
953
953
  if (message.callExtId === callExtId) notifyMuted(message);
954
954
  });
955
955
  return () => {
@@ -1,7 +1,7 @@
1
- import { toProfileView, useCallTranscriptionAvailable, onCallEvent, transcriptPersistRole, persistTranscriptSegment, newSegmentId, encodeCaptionPacket, CALL_CAPTION_TOPIC, ensureMeetingChat, trackUploaderFor, conversationKeyForCall, loadMeetingHistory, CALL_CHAT_MAX_CHARS, newPacketId, encodeCallChatPacket, CALL_CHAT_TOPIC, persistMeetingMessage, mergeChatLines, openQuestion, markRejoining, sealQuestionText, createMutedNotifier, CALL_RECORDING_TOPIC, CALL_TRANSCRIPTION_TOPIC, decodeCaptionPacket, CALL_MODERATION_TOPIC, mutedNoticeFromPacket, decodeCallChatPacket, CALL_WEBINAR_TOPIC, parseWebinarPacket } from '../../chunk-M3SB5TZB.js';
2
- import '../../chunk-QGOYIYLI.js';
1
+ import { toProfileView, useCallTranscriptionAvailable, onCallEvent, transcriptPersistRole, persistTranscriptSegment, newSegmentId, encodeCaptionPacket, CALL_CAPTION_TOPIC, ensureMeetingChat, trackUploaderFor, conversationKeyForCall, loadMeetingHistory, CALL_CHAT_MAX_CHARS, newPacketId, encodeCallChatPacket, CALL_CHAT_TOPIC, persistMeetingMessage, mergeChatLines, openQuestion, markRejoining, sealQuestionText, createMutedNotifier, CALL_RECORDING_TOPIC, CALL_TRANSCRIPTION_TOPIC, decodeCaptionPacket, CALL_MODERATION_TOPIC, mutedNoticeFromPacket, decodeCallChatPacket, CALL_WEBINAR_TOPIC, parseWebinarPacket } from '../../chunk-2MECTZLS.js';
2
+ import '../../chunk-33PVGKXT.js';
3
3
  import '../../chunk-AOEJ744V.js';
4
- import { useArbi, useArbiHost } from '../../chunk-R7YNABZY.js';
4
+ import { useArbi, useArbiHost } from '../../chunk-2Y6LJNWA.js';
5
5
  import { notify } from '../../chunk-G4Z3IP4J.js';
6
6
  import '../../chunk-DPYBZDJB.js';
7
7
  import '../../chunk-NNWMHMEC.js';