@arbidocs/react 0.5.5 → 0.5.7

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 (49) hide show
  1. package/dist/artifacts/index.cjs +10 -10
  2. package/dist/artifacts/index.js +3 -3
  3. package/dist/calls/livekit/index.cjs +42 -42
  4. package/dist/calls/livekit/index.js +3 -3
  5. package/dist/{chunk-Y3LBWRXS.js → chunk-7OD25FTK.js} +4 -4
  6. package/dist/{chunk-Y3LBWRXS.js.map → chunk-7OD25FTK.js.map} +1 -1
  7. package/dist/{chunk-6YLK5AGS.js → chunk-GN33GLHR.js} +3 -3
  8. package/dist/{chunk-6YLK5AGS.js.map → chunk-GN33GLHR.js.map} +1 -1
  9. package/dist/{chunk-VLK52VXC.cjs → chunk-H4FGDXYB.cjs} +4 -2
  10. package/dist/chunk-H4FGDXYB.cjs.map +1 -0
  11. package/dist/{chunk-SBWEI3BO.cjs → chunk-KFFH2JJM.cjs} +32 -32
  12. package/dist/{chunk-SBWEI3BO.cjs.map → chunk-KFFH2JJM.cjs.map} +1 -1
  13. package/dist/{chunk-IFPSLIRL.cjs → chunk-L3NHETSD.cjs} +33 -33
  14. package/dist/{chunk-IFPSLIRL.cjs.map → chunk-L3NHETSD.cjs.map} +1 -1
  15. package/dist/{chunk-X2OC2LCD.js → chunk-ME2D5GWC.js} +3 -3
  16. package/dist/{chunk-X2OC2LCD.js.map → chunk-ME2D5GWC.js.map} +1 -1
  17. package/dist/{chunk-QVGAUQSD.js → chunk-OILCKGGB.js} +29 -61
  18. package/dist/chunk-OILCKGGB.js.map +1 -0
  19. package/dist/{chunk-TYZFRV7P.cjs → chunk-QYUL4GQC.cjs} +33 -67
  20. package/dist/chunk-QYUL4GQC.cjs.map +1 -0
  21. package/dist/{chunk-NVAIVJID.js → chunk-RG2ZE7DF.js} +4 -2
  22. package/dist/chunk-RG2ZE7DF.js.map +1 -0
  23. package/dist/{chunk-J62MWU4O.cjs → chunk-ZLHS3UKP.cjs} +41 -41
  24. package/dist/{chunk-J62MWU4O.cjs.map → chunk-ZLHS3UKP.cjs.map} +1 -1
  25. package/dist/document-tools/index.cjs +17 -17
  26. package/dist/document-tools/index.d.cts +2 -2
  27. package/dist/document-tools/index.d.ts +2 -2
  28. package/dist/document-tools/index.js +3 -3
  29. package/dist/index.cjs +877 -771
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/{index.d-C_Fa1zTU.d.ts → index.d-CMhTWoA-.d.cts} +32 -30
  32. package/dist/{index.d-C_Fa1zTU.d.cts → index.d-CMhTWoA-.d.ts} +32 -30
  33. package/dist/index.d.cts +141 -8
  34. package/dist/index.d.ts +141 -8
  35. package/dist/index.js +133 -25
  36. package/dist/index.js.map +1 -1
  37. package/dist/{query-keys.d-Kw0JMoff.d.cts → query-keys.d-ClYiYNBR.d.cts} +2 -0
  38. package/dist/{query-keys.d-Kw0JMoff.d.ts → query-keys.d-ClYiYNBR.d.ts} +2 -0
  39. package/dist/shell/index.cjs +41 -49
  40. package/dist/shell/index.d.cts +1 -1
  41. package/dist/shell/index.d.ts +1 -1
  42. package/dist/shell/index.js +2 -2
  43. package/dist/ui/index.cjs +9 -9
  44. package/dist/ui/index.js +1 -1
  45. package/package.json +3 -3
  46. package/dist/chunk-NVAIVJID.js.map +0 -1
  47. package/dist/chunk-QVGAUQSD.js.map +0 -1
  48. package/dist/chunk-TYZFRV7P.cjs.map +0 -1
  49. package/dist/chunk-VLK52VXC.cjs.map +0 -1
@@ -220,37 +220,39 @@ declare function takeDocumentForTurn(input: TurnDocumentInput): string | null;
220
220
  * beside the chat binds nothing: a new chat (the ask bar, the new-chat button, the thread
221
221
  * launcher, home) starts unbound, so a question there never becomes an edit of whatever is open.
222
222
  *
223
- * A new chat's binding is the session's `newChatDocumentId` (opening a new chat clears it); the
224
- * first turn moves it here, under the conversation's id. Saved threads' bindings are kept on the
225
- * device (`localStorage`), so a reload keeps them.
223
+ * The binding is the server's: the conversation's `bound_document_ext_id`, set by the first turn
224
+ * (`bound_document_ext_id` on the turn that starts it) or by a PATCH, and read under each reader's
225
+ * access (`bound_document_unavailable`: bound to a document this reader cannot open). It follows
226
+ * the person to every device, and a shared thread's members all see it. The query cache holds it
227
+ * (`./thread-binding`); a new chat's binding is the session's `newChatDocumentId` until its first
228
+ * turn creates the conversation.
229
+ *
230
+ * This module is the light half (no query client, no SDK), so the shell entry can carry it.
226
231
  */
227
- /** What this module needs of the session store (structural: the shell entry stays light). */
228
- interface NewChatSession {
229
- getState(): {
230
- conversationId: string | null;
231
- newChatDocumentId: string | null;
232
- };
233
- setNewChatDocumentId(documentId: string | null): void;
232
+ /** What a conversation row says about its binding. */
233
+ interface ThreadBindingRow {
234
+ external_id: string;
235
+ bound_document_ext_id?: string | null;
236
+ bound_document_unavailable?: boolean | null;
237
+ updated_at?: string | null;
234
238
  }
235
- declare function subscribeThreadDocuments(listener: () => void): () => void;
236
- /** The document a saved conversation is bound to, or null. */
237
- declare function threadDocumentId(conversationId: string | null | undefined): string | null;
238
- /** Bind a saved conversation to a document, or (null) unbind it. */
239
- declare function bindThreadDocument(conversationId: string, documentId: string | null): void;
240
- /** The most recently bound conversation of a document, or null. */
241
- declare function latestThreadOfDocument(documentId: string): string | null;
242
- /** The document the open conversation is bound to (its saved binding, or the new chat's). */
243
- declare function boundDocumentOf(state: ReturnType<NewChatSession['getState']>): string | null;
244
- /**
245
- * A new chat got its server id: the document it was bound to is now the conversation's. Call it
246
- * beside `session.moveConversation('new', id)`; `documentId` is the binding its first turn was sent
247
- * with (default: the session's new-chat binding).
248
- */
249
- declare function adoptNewChatDocument(session: NewChatSession, conversationId: string, documentId?: string | null): void;
250
- /** Test seam: forget every binding (and what is stored). */
251
- declare function resetThreadDocumentsForTests(): void;
252
- /** Test seam: read the stored bindings again, as a reload does. */
253
- declare function reloadThreadDocumentsForTests(): void;
239
+ /** A conversation's binding as this reader sees it. */
240
+ interface ThreadBinding {
241
+ /** The bound document, or null (unbound, or bound to one this reader cannot open). */
242
+ documentId: string | null;
243
+ /** Bound to a document this reader cannot open (another member's private document, or deleted). */
244
+ unavailable: boolean;
245
+ }
246
+ declare const UNBOUND: ThreadBinding;
247
+ /** A row's binding. */
248
+ declare function bindingOfRow(row: ThreadBindingRow | null | undefined): ThreadBinding;
249
+ /** The most recently active conversation bound to a document, among `conversations`, or null. */
250
+ declare function latestThreadOfDocument(conversations: readonly ThreadBindingRow[] | null | undefined, documentId: string): string | null;
251
+ declare const LEGACY_THREAD_DOCUMENTS_KEY = "arbi-thread-documents";
252
+ /** The bindings this browser kept locally (conversation id → document id); empty when none. */
253
+ declare function readLegacyThreadDocuments(): Record<string, string>;
254
+ /** Forget locally kept bindings (moved to the server); the key goes with the last of them. */
255
+ declare function forgetLegacyThreadDocuments(conversationIds: readonly string[]): void;
254
256
 
255
257
  /**
256
258
  * A search's state outside any component: the query last searched, its passages, and whether it
@@ -452,4 +454,4 @@ declare function NotificationBell({ renderTrigger, onNavigate, onSelectNotificat
452
454
 
453
455
  declare function Toaster({ toastOptions, ...props }: ToasterProps): React$1.JSX.Element;
454
456
 
455
- export { toMessageMentions as $, type AppNotification as A, insertMention as B, latestThreadOfDocument as C, DEFAULT_NOTIFY_TONE as D, linkMentions as E, mentionFromHref as F, notify as G, type HostConfigRecord as H, openDocumentId as I, persistNotifyHistory as J, persistSearchSession as K, reloadThreadDocumentsForTests as L, MAX_SESSION_NOTIFICATIONS as M, NotificationBell as N, type OpenDocumentRegistration as O, requestSearch as P, resetThreadDocumentsForTests as Q, savedDocumentIdFor as R, type SavedDocumentInput as S, Toaster as T, seedNotifications as U, selectUnread as V, sharedSearchSession as W, subscribeThreadDocuments as X, takeDocumentForTurn as Y, takePendingSearch as Z, threadDocumentId as _, ArbiHost as a, useHostConfigRecord as a0, useNotify as a1, useOpenDocumentId as a2, useRegisterOpenDocument as a3, useTurnDocumentId as a4, type ArbiHostConnection as b, type ArbiHostProps as c, MENTION_HREF_PREFIX as d, type MentionCandidate as e, type MentionKind as f, type MessageMentionRef as g, type NotificationBellProps as h, type NotificationBellTriggerState as i, type NotifyConfig as j, type NotifyOptions as k, type NotifyVariant as l, type SearchSession as m, type SearchSessionState as n, type SearchStatus as o, type TurnDocumentInput as p, adoptNewChatDocument as q, bindThreadDocument as r, boundDocumentOf as s, clearSearchSession as t, configureNotify as u, createSearchSession as v, extractMentions as w, filterMentionCandidates as x, findMentionQuery as y, hasMessageBody as z };
457
+ export { toMessageMentions as $, type AppNotification as A, hasMessageBody as B, insertMention as C, DEFAULT_NOTIFY_TONE as D, latestThreadOfDocument as E, linkMentions as F, mentionFromHref as G, type HostConfigRecord as H, notify as I, openDocumentId as J, persistNotifyHistory as K, LEGACY_THREAD_DOCUMENTS_KEY as L, MAX_SESSION_NOTIFICATIONS as M, NotificationBell as N, type OpenDocumentRegistration as O, persistSearchSession as P, readLegacyThreadDocuments as Q, requestSearch as R, type SavedDocumentInput as S, type ThreadBinding as T, UNBOUND as U, savedDocumentIdFor as V, seedNotifications as W, selectUnread as X, sharedSearchSession as Y, takeDocumentForTurn as Z, takePendingSearch as _, ArbiHost as a, useHostConfigRecord as a0, useNotify as a1, useOpenDocumentId as a2, useRegisterOpenDocument as a3, useTurnDocumentId as a4, type ArbiHostConnection as b, type ArbiHostProps as c, MENTION_HREF_PREFIX as d, type MentionCandidate as e, type MentionKind as f, type MessageMentionRef as g, type NotificationBellProps as h, type NotificationBellTriggerState as i, type NotifyConfig as j, type NotifyOptions as k, type NotifyVariant as l, type SearchSession as m, type SearchSessionState as n, type SearchStatus as o, type ThreadBindingRow as p, Toaster as q, type TurnDocumentInput as r, bindingOfRow as s, clearSearchSession as t, configureNotify as u, createSearchSession as v, extractMentions as w, filterMentionCandidates as x, findMentionQuery as y, forgetLegacyThreadDocuments as z };
@@ -220,37 +220,39 @@ declare function takeDocumentForTurn(input: TurnDocumentInput): string | null;
220
220
  * beside the chat binds nothing: a new chat (the ask bar, the new-chat button, the thread
221
221
  * launcher, home) starts unbound, so a question there never becomes an edit of whatever is open.
222
222
  *
223
- * A new chat's binding is the session's `newChatDocumentId` (opening a new chat clears it); the
224
- * first turn moves it here, under the conversation's id. Saved threads' bindings are kept on the
225
- * device (`localStorage`), so a reload keeps them.
223
+ * The binding is the server's: the conversation's `bound_document_ext_id`, set by the first turn
224
+ * (`bound_document_ext_id` on the turn that starts it) or by a PATCH, and read under each reader's
225
+ * access (`bound_document_unavailable`: bound to a document this reader cannot open). It follows
226
+ * the person to every device, and a shared thread's members all see it. The query cache holds it
227
+ * (`./thread-binding`); a new chat's binding is the session's `newChatDocumentId` until its first
228
+ * turn creates the conversation.
229
+ *
230
+ * This module is the light half (no query client, no SDK), so the shell entry can carry it.
226
231
  */
227
- /** What this module needs of the session store (structural: the shell entry stays light). */
228
- interface NewChatSession {
229
- getState(): {
230
- conversationId: string | null;
231
- newChatDocumentId: string | null;
232
- };
233
- setNewChatDocumentId(documentId: string | null): void;
232
+ /** What a conversation row says about its binding. */
233
+ interface ThreadBindingRow {
234
+ external_id: string;
235
+ bound_document_ext_id?: string | null;
236
+ bound_document_unavailable?: boolean | null;
237
+ updated_at?: string | null;
234
238
  }
235
- declare function subscribeThreadDocuments(listener: () => void): () => void;
236
- /** The document a saved conversation is bound to, or null. */
237
- declare function threadDocumentId(conversationId: string | null | undefined): string | null;
238
- /** Bind a saved conversation to a document, or (null) unbind it. */
239
- declare function bindThreadDocument(conversationId: string, documentId: string | null): void;
240
- /** The most recently bound conversation of a document, or null. */
241
- declare function latestThreadOfDocument(documentId: string): string | null;
242
- /** The document the open conversation is bound to (its saved binding, or the new chat's). */
243
- declare function boundDocumentOf(state: ReturnType<NewChatSession['getState']>): string | null;
244
- /**
245
- * A new chat got its server id: the document it was bound to is now the conversation's. Call it
246
- * beside `session.moveConversation('new', id)`; `documentId` is the binding its first turn was sent
247
- * with (default: the session's new-chat binding).
248
- */
249
- declare function adoptNewChatDocument(session: NewChatSession, conversationId: string, documentId?: string | null): void;
250
- /** Test seam: forget every binding (and what is stored). */
251
- declare function resetThreadDocumentsForTests(): void;
252
- /** Test seam: read the stored bindings again, as a reload does. */
253
- declare function reloadThreadDocumentsForTests(): void;
239
+ /** A conversation's binding as this reader sees it. */
240
+ interface ThreadBinding {
241
+ /** The bound document, or null (unbound, or bound to one this reader cannot open). */
242
+ documentId: string | null;
243
+ /** Bound to a document this reader cannot open (another member's private document, or deleted). */
244
+ unavailable: boolean;
245
+ }
246
+ declare const UNBOUND: ThreadBinding;
247
+ /** A row's binding. */
248
+ declare function bindingOfRow(row: ThreadBindingRow | null | undefined): ThreadBinding;
249
+ /** The most recently active conversation bound to a document, among `conversations`, or null. */
250
+ declare function latestThreadOfDocument(conversations: readonly ThreadBindingRow[] | null | undefined, documentId: string): string | null;
251
+ declare const LEGACY_THREAD_DOCUMENTS_KEY = "arbi-thread-documents";
252
+ /** The bindings this browser kept locally (conversation id → document id); empty when none. */
253
+ declare function readLegacyThreadDocuments(): Record<string, string>;
254
+ /** Forget locally kept bindings (moved to the server); the key goes with the last of them. */
255
+ declare function forgetLegacyThreadDocuments(conversationIds: readonly string[]): void;
254
256
 
255
257
  /**
256
258
  * A search's state outside any component: the query last searched, its passages, and whether it
@@ -452,4 +454,4 @@ declare function NotificationBell({ renderTrigger, onNavigate, onSelectNotificat
452
454
 
453
455
  declare function Toaster({ toastOptions, ...props }: ToasterProps): React$1.JSX.Element;
454
456
 
455
- export { toMessageMentions as $, type AppNotification as A, insertMention as B, latestThreadOfDocument as C, DEFAULT_NOTIFY_TONE as D, linkMentions as E, mentionFromHref as F, notify as G, type HostConfigRecord as H, openDocumentId as I, persistNotifyHistory as J, persistSearchSession as K, reloadThreadDocumentsForTests as L, MAX_SESSION_NOTIFICATIONS as M, NotificationBell as N, type OpenDocumentRegistration as O, requestSearch as P, resetThreadDocumentsForTests as Q, savedDocumentIdFor as R, type SavedDocumentInput as S, Toaster as T, seedNotifications as U, selectUnread as V, sharedSearchSession as W, subscribeThreadDocuments as X, takeDocumentForTurn as Y, takePendingSearch as Z, threadDocumentId as _, ArbiHost as a, useHostConfigRecord as a0, useNotify as a1, useOpenDocumentId as a2, useRegisterOpenDocument as a3, useTurnDocumentId as a4, type ArbiHostConnection as b, type ArbiHostProps as c, MENTION_HREF_PREFIX as d, type MentionCandidate as e, type MentionKind as f, type MessageMentionRef as g, type NotificationBellProps as h, type NotificationBellTriggerState as i, type NotifyConfig as j, type NotifyOptions as k, type NotifyVariant as l, type SearchSession as m, type SearchSessionState as n, type SearchStatus as o, type TurnDocumentInput as p, adoptNewChatDocument as q, bindThreadDocument as r, boundDocumentOf as s, clearSearchSession as t, configureNotify as u, createSearchSession as v, extractMentions as w, filterMentionCandidates as x, findMentionQuery as y, hasMessageBody as z };
457
+ export { toMessageMentions as $, type AppNotification as A, hasMessageBody as B, insertMention as C, DEFAULT_NOTIFY_TONE as D, latestThreadOfDocument as E, linkMentions as F, mentionFromHref as G, type HostConfigRecord as H, notify as I, openDocumentId as J, persistNotifyHistory as K, LEGACY_THREAD_DOCUMENTS_KEY as L, MAX_SESSION_NOTIFICATIONS as M, NotificationBell as N, type OpenDocumentRegistration as O, persistSearchSession as P, readLegacyThreadDocuments as Q, requestSearch as R, type SavedDocumentInput as S, type ThreadBinding as T, UNBOUND as U, savedDocumentIdFor as V, seedNotifications as W, selectUnread as X, sharedSearchSession as Y, takeDocumentForTurn as Z, takePendingSearch as _, ArbiHost as a, useHostConfigRecord as a0, useNotify as a1, useOpenDocumentId as a2, useRegisterOpenDocument as a3, useTurnDocumentId as a4, type ArbiHostConnection as b, type ArbiHostProps as c, MENTION_HREF_PREFIX as d, type MentionCandidate as e, type MentionKind as f, type MessageMentionRef as g, type NotificationBellProps as h, type NotificationBellTriggerState as i, type NotifyConfig as j, type NotifyOptions as k, type NotifyVariant as l, type SearchSession as m, type SearchSessionState as n, type SearchStatus as o, type ThreadBindingRow as p, Toaster as q, type TurnDocumentInput as r, bindingOfRow as s, clearSearchSession as t, configureNotify as u, createSearchSession as v, extractMentions as w, filterMentionCandidates as x, findMentionQuery as y, forgetLegacyThreadDocuments as z };