@marktiderman/genesis-chat 0.1.1 → 0.2.1

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 (175) hide show
  1. package/README.md +379 -13
  2. package/dist/chunk-A4YJX7KT.js +544 -0
  3. package/dist/chunk-A4YJX7KT.js.map +1 -0
  4. package/dist/chunk-AZS3HNLM.js +30 -0
  5. package/dist/chunk-AZS3HNLM.js.map +1 -0
  6. package/dist/chunk-BJCE5O7V.js +70 -0
  7. package/dist/chunk-BJCE5O7V.js.map +1 -0
  8. package/dist/chunk-GBJ3YI4E.js +966 -0
  9. package/dist/chunk-GBJ3YI4E.js.map +1 -0
  10. package/dist/chunk-JU2FAPBI.js +609 -0
  11. package/dist/chunk-JU2FAPBI.js.map +1 -0
  12. package/dist/chunk-VEPZROQB.js +187 -0
  13. package/dist/chunk-VEPZROQB.js.map +1 -0
  14. package/dist/{client-BtdALFCx.d.ts → client-DUIG1hum.d.ts} +187 -11
  15. package/dist/index.d.ts +78 -163
  16. package/dist/index.js +3 -2
  17. package/dist/native.d.ts +1939 -1
  18. package/dist/native.js +5023 -0
  19. package/dist/native.js.map +1 -1
  20. package/dist/outbox-B9NAWQ58.d.ts +219 -0
  21. package/dist/push.d.ts +206 -0
  22. package/dist/push.js +3 -0
  23. package/dist/push.js.map +1 -0
  24. package/dist/react.d.ts +176 -7
  25. package/dist/react.js +3 -3
  26. package/dist/server.d.ts +551 -21
  27. package/dist/server.js +976 -34
  28. package/dist/server.js.map +1 -1
  29. package/dist/thread-oPra7pkW.d.ts +57 -0
  30. package/dist/web.d.ts +335 -12
  31. package/dist/web.js +1784 -64
  32. package/dist/web.js.map +1 -1
  33. package/migrations/0002_genesis_chat_coaching.sql +934 -0
  34. package/migrations/0003_genesis_chat_search_threads.sql +85 -0
  35. package/migrations/tests/0002_genesis_chat_coaching.test.sql +269 -0
  36. package/migrations/tests/0003_genesis_chat_search_threads.test.sql +50 -0
  37. package/package.json +78 -6
  38. package/src/__tests__/coaching-core.test.ts +334 -0
  39. package/src/__tests__/coaching-react.test.tsx +319 -0
  40. package/src/__tests__/coaching-web.test.tsx +521 -0
  41. package/src/__tests__/core.test.ts +91 -0
  42. package/src/__tests__/fake-xhr.ts +54 -0
  43. package/src/__tests__/outbox-hosted.test.ts +269 -0
  44. package/src/__tests__/outbox.test.ts +122 -0
  45. package/src/__tests__/realtime.test.ts +70 -0
  46. package/src/__tests__/review-279.test.ts +41 -0
  47. package/src/__tests__/review-fixes-core.test.ts +193 -0
  48. package/src/__tests__/review-fixes-web.test.tsx +405 -0
  49. package/src/__tests__/server-effects.test.ts +158 -0
  50. package/src/__tests__/server-fake-video.test.ts +81 -0
  51. package/src/__tests__/server-fakes.ts +96 -0
  52. package/src/__tests__/server-integrations.test.ts +247 -0
  53. package/src/__tests__/server-providers.test.ts +246 -0
  54. package/src/__tests__/server-runner.test.ts +277 -0
  55. package/src/__tests__/server-safety.test.ts +303 -0
  56. package/src/__tests__/web-markdown.test.tsx +88 -0
  57. package/src/__tests__/web.test.tsx +349 -0
  58. package/src/core/availability.ts +223 -0
  59. package/src/core/client.ts +783 -0
  60. package/src/core/extras.ts +106 -0
  61. package/src/core/media.ts +144 -0
  62. package/src/core/outbox.ts +635 -0
  63. package/src/core/thread.ts +171 -0
  64. package/src/core/transfer.ts +71 -0
  65. package/src/core/types.ts +328 -0
  66. package/src/index.ts +14 -0
  67. package/src/native/__tests__/auto-retry.test.tsx +128 -0
  68. package/src/native/__tests__/composer-mic-lock.test.tsx +115 -0
  69. package/src/native/__tests__/composer-state.test.ts +188 -0
  70. package/src/native/__tests__/composer.test.tsx +133 -0
  71. package/src/native/__tests__/emoji.test.tsx +254 -0
  72. package/src/native/__tests__/inbox-screen.test.tsx +48 -0
  73. package/src/native/__tests__/message-bubble.test.tsx +127 -0
  74. package/src/native/__tests__/organise-logic.test.ts +164 -0
  75. package/src/native/__tests__/organise-screens.test.tsx +424 -0
  76. package/src/native/__tests__/photo-viewer.test.tsx +226 -0
  77. package/src/native/__tests__/push-payload.test.ts +66 -0
  78. package/src/native/__tests__/push.test.ts +209 -0
  79. package/src/native/__tests__/recorder-machine.test.ts +96 -0
  80. package/src/native/__tests__/rows-actions.test.ts +76 -0
  81. package/src/native/__tests__/thread-layout.test.ts +41 -0
  82. package/src/native/__tests__/thread-screen.test.tsx +116 -0
  83. package/src/native/__tests__/tus.test.ts +154 -0
  84. package/src/native/__tests__/use-voice-recorder.test.tsx +316 -0
  85. package/src/native/__tests__/video-media.test.tsx +498 -0
  86. package/src/native/__tests__/video-recorder-state.test.ts +87 -0
  87. package/src/native/__tests__/video-upload.test.ts +227 -0
  88. package/src/native/access-error.tsx +31 -0
  89. package/src/native/actions.ts +42 -0
  90. package/src/native/attachment-cards.tsx +132 -0
  91. package/src/native/auto-retry.ts +69 -0
  92. package/src/native/availability.tsx +376 -0
  93. package/src/native/broadcast-sheet.tsx +193 -0
  94. package/src/native/composer-state.ts +302 -0
  95. package/src/native/composer.tsx +453 -0
  96. package/src/native/context.tsx +70 -0
  97. package/src/native/copy.ts +296 -0
  98. package/src/native/emoji-data.ts +21 -0
  99. package/src/native/emoji-picker.tsx +229 -0
  100. package/src/native/emoji.ts +118 -0
  101. package/src/native/icon-button.tsx +40 -0
  102. package/src/native/inbox-screen.tsx +122 -0
  103. package/src/native/index.ts +184 -0
  104. package/src/native/link-preview.tsx +104 -0
  105. package/src/native/media-colors.ts +15 -0
  106. package/src/native/media.tsx +187 -0
  107. package/src/native/message-actions-sheet.tsx +126 -0
  108. package/src/native/message-bubble.tsx +366 -0
  109. package/src/native/moderation.tsx +42 -0
  110. package/src/native/modules.ts +277 -0
  111. package/src/native/organise-copy.ts +195 -0
  112. package/src/native/photo-viewer.tsx +531 -0
  113. package/src/native/push.ts +375 -0
  114. package/src/native/recorder-machine.ts +176 -0
  115. package/src/native/rows.ts +81 -0
  116. package/src/native/schedule-sheet.tsx +328 -0
  117. package/src/native/search-screen.tsx +189 -0
  118. package/src/native/stack-options.ts +36 -0
  119. package/src/native/start-sheet.tsx +87 -0
  120. package/src/native/thread-screen.tsx +647 -0
  121. package/src/native/topics.tsx +234 -0
  122. package/src/native/tus.ts +282 -0
  123. package/src/native/use-composer.ts +71 -0
  124. package/src/native/use-jump.ts +91 -0
  125. package/src/native/use-voice-recorder.ts +234 -0
  126. package/src/native/video-player.tsx +410 -0
  127. package/src/native/video-recorder-state.ts +140 -0
  128. package/src/native/video-recorder.tsx +274 -0
  129. package/src/native/video-upload-tray.tsx +77 -0
  130. package/src/native/video-upload.ts +432 -0
  131. package/src/native/voice-player.tsx +301 -0
  132. package/src/react/index.tsx +894 -0
  133. package/src/react/previews.ts +51 -0
  134. package/src/server/assistant.ts +235 -0
  135. package/src/server/crypto.ts +86 -0
  136. package/src/server/expo.ts +119 -0
  137. package/src/server/fake-video.ts +171 -0
  138. package/src/server/handler.ts +32 -0
  139. package/src/server/index.ts +58 -0
  140. package/src/server/moderation.ts +155 -0
  141. package/src/server/mux.ts +290 -0
  142. package/src/server/notifications.ts +130 -0
  143. package/src/server/runner.ts +468 -0
  144. package/src/server/transcribers.ts +111 -0
  145. package/src/server/types.ts +171 -0
  146. package/src/server/unfurl.ts +480 -0
  147. package/src/server/upload.ts +158 -0
  148. package/src/web/attachments.tsx +379 -0
  149. package/src/web/availability.tsx +299 -0
  150. package/src/web/broadcast.tsx +166 -0
  151. package/src/web/bubble.tsx +585 -0
  152. package/src/web/cards.tsx +136 -0
  153. package/src/web/composer.tsx +571 -0
  154. package/src/web/emoji-picker.tsx +84 -0
  155. package/src/web/error-boundary.tsx +33 -0
  156. package/src/web/format.ts +55 -0
  157. package/src/web/inbox.tsx +196 -0
  158. package/src/web/index.ts +75 -0
  159. package/src/web/markdown.tsx +245 -0
  160. package/src/web/memory-client.ts +714 -0
  161. package/src/web/panel.tsx +135 -0
  162. package/src/web/schedule.tsx +204 -0
  163. package/src/web/search.tsx +129 -0
  164. package/src/web/thread-context.ts +64 -0
  165. package/src/web/thread.tsx +830 -0
  166. package/src/web/topics.tsx +160 -0
  167. package/src/web/use-voice-recorder.ts +264 -0
  168. package/src/web/video.tsx +516 -0
  169. package/src/web/voice-note.tsx +197 -0
  170. package/dist/chunk-27UTR5FW.js +0 -322
  171. package/dist/chunk-27UTR5FW.js.map +0 -1
  172. package/dist/chunk-JQXZUEEL.js +0 -525
  173. package/dist/chunk-JQXZUEEL.js.map +0 -1
  174. package/dist/chunk-SAY24E6V.js +0 -309
  175. package/dist/chunk-SAY24E6V.js.map +0 -1
package/dist/react.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import * as _tanstack_query_core from '@tanstack/query-core';
2
- import { C as ChatClient, a as ChatConversation, b as ChatMember, c as ChatRole, d as ChatKindRules, e as ChatMessage, f as ChatActivity, S as SendInput, g as ChatSignal, h as ChatInboxItem } from './client-BtdALFCx.js';
2
+ import { h as ChatAttachment, i as ChatClient, k as ChatConversation, p as ChatMember, t as ChatRole, n as ChatKindRules, q as ChatMessage, g as ChatActivity, F as SendInput, M as MessagePage, C as ChatAvailability, d as AvailabilityInput, v as ChatSignal, m as ChatInboxItem, o as ChatLinkPreview, D as ScheduledMessage, S as ScheduleInput, u as ChatSearchHit, x as ChatTopic, T as TopicInput } from './client-DUIG1hum.js';
3
3
  import * as react from 'react';
4
4
  import { ReactNode } from 'react';
5
- import { OutboxStore, LocalFile, ThreadItem, Outbox, QueuedMessage } from './index.js';
5
+ import { e as OutboxStore, S as StorageUpload, H as HostedUpload, L as LocalFile, O as Outbox, Q as QueuedMessage } from './outbox-B9NAWQ58.js';
6
+ import { T as ThreadItem } from './thread-oPra7pkW.js';
6
7
  import '@supabase/supabase-js';
7
8
 
8
9
  declare const chatKeys: {
@@ -14,15 +15,77 @@ declare const chatKeys: {
14
15
  role: (id: string) => readonly ["genesis-chat", "role", string];
15
16
  pins: (id: string) => readonly ["genesis-chat", "pins", string];
16
17
  files: (paths: string[]) => readonly ["genesis-chat", "files", string[]];
18
+ /** Under the conversation's key, so its `conversation` hint (set_topic broadcasts one) refreshes them. */
19
+ topics: (id: string) => readonly ["genesis-chat", "conversation", string, "topics"];
20
+ scheduled: (conversationId?: string | null) => readonly ["genesis-chat", "scheduled", string | null];
21
+ availability: (conversationId: string) => readonly ["genesis-chat", "conversation", string, "availability"];
22
+ myAvailability: () => readonly ["genesis-chat", "my-availability"];
23
+ search: (query: string, conversationId?: string | null) => readonly ["genesis-chat", "search", string | null, string];
24
+ previews: (messageIds: string[]) => readonly ["genesis-chat", "previews", string[]];
25
+ /** One message's link previews (useLinkPreviews keeps one query per message). */
26
+ preview: (messageId: string) => readonly ["genesis-chat", "preview", string];
17
27
  };
28
+ /** How many messages a catch-up asks for at a time, and how many pages before it gives up and jumps to the newest. */
29
+ declare const CATCH_UP_PAGE = 200;
30
+ declare const CATCH_UP_MAX_PAGES = 10;
31
+ /** What a messages list holds in the query cache: the page, and whether older messages exist. */
32
+ type MessagesData = MessagePage;
18
33
  /** Does a messages list (`[genesis-chat, conversation, id, messages, threadRootId, topic]`) hold this message? */
19
34
  declare function belongsTo(key: readonly unknown[], m: ChatMessage): boolean;
35
+ /**
36
+ * Hosted video uploads (Mux direct uploads): your server makes an upload and returns its URL
37
+ * (`createVideoUploadHandler` in /server). A video the composer marks `hosted` is sent through
38
+ * the outbox at once, in order, with `{ kind: "video", provider, providerId, status: "pending" }`,
39
+ * while its bytes are PUT to that URL (see `hostedUploadFrom`). Without it, videos go to storage
40
+ * as files.
41
+ */
42
+ interface ChatVideoUpload {
43
+ create(conversationId: string): Promise<{
44
+ url: string;
45
+ providerId: string;
46
+ provider: "mux";
47
+ }>;
48
+ }
49
+ /**
50
+ * The outbox's `hostedUpload` from a `ChatVideoUpload`: mints the upload (or, resuming, reuses
51
+ * the one minted before), resolves at once with its id, and PUTs the whole file to its URL in
52
+ * the background (XMLHttpRequest where there is one, for progress). A native file URI is read
53
+ * with `readFile`. Native apps with chunked, resumable uploads pass their own `hostedUpload`.
54
+ */
55
+ declare function hostedUploadFrom(videoUpload: ChatVideoUpload, options?: {
56
+ readFile?: (uri: string) => Promise<Blob | ArrayBuffer>;
57
+ fetch?: typeof fetch;
58
+ }): HostedUpload;
59
+ /** What a kind's `title`, `subtitle` and `action` are told besides the attachment. */
60
+ interface ChatCardContext {
61
+ /** The card is on a message you sent (your own check-in reads "Sent", not "Answer"). */
62
+ mine: boolean;
63
+ }
64
+ /** What an app attachment kind's card shows (a form, a check-in): plain data, drawn by each renderer. */
65
+ interface ChatAttachmentKind {
66
+ title(attachment: ChatAttachment, ctx?: ChatCardContext): string;
67
+ subtitle?(attachment: ChatAttachment, ctx?: ChatCardContext): string | null | undefined;
68
+ /** The card's button: a link (`href`) or a handler (`onPress`). */
69
+ action?(attachment: ChatAttachment, ctx?: ChatCardContext): {
70
+ label: string;
71
+ href?: string;
72
+ onPress?: () => void;
73
+ } | null | undefined;
74
+ /** What previews call it (the inbox's last message, "Check-in"); the title by default. */
75
+ label?: string;
76
+ }
20
77
  interface ChatContextValue {
21
78
  client: ChatClient;
22
79
  userId: string;
23
80
  outbox: Outbox;
24
81
  queue: QueuedMessage[];
25
82
  loadPeople?: (userIds: string[]) => Promise<Record<string, ChatPerson>>;
83
+ videoUpload?: ChatVideoUpload;
84
+ attachmentKinds?: Record<string, ChatAttachmentKind>;
85
+ /** Retries every failed message (call it when the connection comes back: AppState, NetInfo). */
86
+ retryAll(): Promise<void>;
87
+ /** Forgets every unsent message, here and in the outbox store (call it on sign-out). */
88
+ clearOutbox(): Promise<void>;
26
89
  /** Subscribe to inbox hints (one channel for the app, fanned out here). */
27
90
  onInbox(listener: (s: ChatSignal) => void): () => void;
28
91
  }
@@ -34,14 +97,29 @@ interface ChatProviderProps {
34
97
  outboxStore?: OutboxStore;
35
98
  /** Reads a native file URI for upload. */
36
99
  readFile?: (uri: string) => Promise<Blob | ArrayBuffer>;
37
- /** Replaces the plain upload (resumable uploads on native). */
38
- upload?: (conversationId: string, file: LocalFile) => Promise<string>;
100
+ /**
101
+ * Replaces the plain upload (resumable uploads on native). `signal` aborts when the message is
102
+ * discarded or the outbox cleared; `onProgress(sent, total)` fills the pending bubble's bar.
103
+ */
104
+ upload?: StorageUpload;
105
+ /**
106
+ * Starts a hosted upload for files marked `hosted` (see HostedUpload): resolve with
107
+ * `{ provider, providerId, status: "pending", url?, done }` once the upload id exists. Default:
108
+ * `hostedUploadFrom(videoUpload)` when `videoUpload` is given.
109
+ */
110
+ hostedUpload?: HostedUpload;
39
111
  /** Makes client ids (default: a random UUID that works without crypto.randomUUID). */
40
112
  newId?: () => string;
41
113
  /** Keeps a byte file (a pasted image, a recording) across launches: write it, return a URI. */
42
114
  persistFile?: (file: LocalFile) => Promise<string>;
115
+ /** Lets go of a sent file's preview (default: revokes `blob:` object URLs only). */
116
+ releasePreview?: (url: string) => void;
43
117
  /** Names and avatars for user ids, fetched in batches (usePeople, usePerson). */
44
118
  loadPeople?: (userIds: string[]) => Promise<Record<string, ChatPerson>>;
119
+ /** Hosted video uploads (Mux); videos go to storage without it. */
120
+ videoUpload?: ChatVideoUpload;
121
+ /** Cards for your own attachment kinds (`{ form: { title, subtitle, action } }`). */
122
+ attachmentKinds?: Record<string, ChatAttachmentKind>;
45
123
  children: ReactNode;
46
124
  }
47
125
  /** How the app shows a person. */
@@ -50,11 +128,13 @@ interface ChatPerson {
50
128
  avatarUrl?: string | null;
51
129
  }
52
130
  /** Puts chat in reach of every hook below it. Needs a TanStack QueryClientProvider above it. */
53
- declare function ChatProvider({ client, userId, outboxStore, readFile, upload, newId, persistFile, loadPeople, children }: ChatProviderProps): react.JSX.Element;
131
+ declare function ChatProvider({ client, userId, outboxStore, readFile, upload, hostedUpload, newId, persistFile, releasePreview, loadPeople, videoUpload, attachmentKinds, children, }: ChatProviderProps): react.JSX.Element;
54
132
  declare function useChat(): ChatContextValue;
55
133
  /** Your conversations, live. `kind` narrows to one kind; `archived` shows the archived ones. */
56
134
  declare function useInbox(opts?: {
57
135
  kind?: string;
136
+ kinds?: string[];
137
+ excludeKinds?: string[];
58
138
  archived?: boolean;
59
139
  limit?: number;
60
140
  }): {
@@ -64,7 +144,9 @@ declare function useInbox(opts?: {
64
144
  refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<NoInfer<ChatInboxItem[]>, Error>>;
65
145
  };
66
146
  /** How many messages wait for you everywhere (for a badge), live. */
67
- declare function useUnreadTotal(): number;
147
+ declare function useUnreadTotal(opts?: {
148
+ excludeKinds?: string[];
149
+ }): number;
68
150
  interface UseConversationOptions {
69
151
  /** Mark messages read as they arrive while this is true (the thread is on screen). Default true. */
70
152
  markRead?: boolean;
@@ -82,6 +164,14 @@ declare function useConversation(conversationId: string | null | undefined, opts
82
164
  canPost: boolean;
83
165
  /** Your role and posting rights are still loading: show the composer as waiting, not refused. */
84
166
  accessLoading: boolean;
167
+ /** The conversation itself is still loading (it settles to `null` when you can't see it). */
168
+ conversationLoading: boolean;
169
+ /** Your role couldn't be loaded (offline): offer `refetchAccess`, don't say "can't post". */
170
+ accessError: Error | null;
171
+ /** Retries everything this conversation loads (role, members, the conversation, topics, availability, pins), not only access. */
172
+ refetchAccess: () => Promise<undefined>;
173
+ /** Same as refetchAccess: every per-conversation lookup again, for a Retry after being offline. */
174
+ refetchConversation: () => Promise<undefined>;
85
175
  /** The kind's rules (max members, threads, who posts). */
86
176
  kind: NonNullable<NoInfer<ChatKindRules | null>> | null;
87
177
  /** May you pin here: owners and admins, or anyone in a two-person conversation. */
@@ -95,11 +185,14 @@ declare function useConversation(conversationId: string | null | undefined, opts
95
185
  hasEarlier: boolean;
96
186
  loadingEarlier: boolean;
97
187
  loadEarlier: () => Promise<void>;
188
+ loadUntil: (seq: number) => Promise<boolean>;
98
189
  /** Where to draw the "New" line, from what you had read when it opened. */
99
190
  firstUnreadId: string | null;
100
191
  activity: ChatActivity[];
101
192
  signalTyping: () => void;
102
193
  signalRecording: () => void;
194
+ /** Tells the others you are recording a video (throttled). */
195
+ signalRecordingVideo: () => void;
103
196
  markRead: () => Promise<void>;
104
197
  send: (input: Omit<SendInput, "conversationId" | "clientId">, files?: LocalFile[]) => Promise<string>;
105
198
  retry: (clientId: string) => Promise<void>;
@@ -133,5 +226,81 @@ declare function useStartConversation(): (kind: string, memberIds: string[], opt
133
226
  subjectType?: string;
134
227
  subjectId?: string;
135
228
  }) => Promise<string>;
229
+ /**
230
+ * A conversation's topics, live (set_topic's hint refreshes them), and `setTopic` for owners
231
+ * and admins: add one (`setTopic("week-1", { title: "Week 1" })`), close or reopen it.
232
+ */
233
+ declare function useTopics(conversationId: string | null | undefined): {
234
+ topics: ChatTopic[];
235
+ isLoading: boolean;
236
+ error: Error | null;
237
+ setTopic: (topic: string, input?: TopicInput) => Promise<void>;
238
+ refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<NoInfer<ChatTopic[]>, Error>>;
239
+ };
240
+ /**
241
+ * Your scheduled messages (in one conversation, or all), soonest first, with `schedule` and
242
+ * `cancel` (which also removes one that failed). `schedule` uploads its files to storage first,
243
+ * the way `send` does (the provider's `upload` hook, or a native URI read through `readFile`),
244
+ * then schedules them with the message. A file marked `hosted` goes to storage too.
245
+ */
246
+ declare function useScheduled(conversationId?: string | null, opts?: {
247
+ enabled?: boolean;
248
+ }): {
249
+ items: ScheduledMessage[];
250
+ isLoading: boolean;
251
+ error: Error | null;
252
+ schedule: (input: Omit<ScheduleInput, "clientId"> & {
253
+ clientId?: string;
254
+ }, files?: LocalFile[]) => Promise<string>;
255
+ cancel: (id: string) => Promise<void>;
256
+ refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<NoInfer<ScheduledMessage[]>, Error>>;
257
+ };
258
+ /**
259
+ * Availability: yours (`mine`, `setMine`) and, given a conversation, its members' (`members`,
260
+ * `forUser`). Pair with `awayLine` and `isWithinWorkingHours` from the core.
261
+ */
262
+ declare function useAvailability(conversationId?: string | null): {
263
+ mine: NonNullable<NoInfer<ChatAvailability | null>> | null;
264
+ mineLoading: boolean;
265
+ setMine: (input: AvailabilityInput) => Promise<void>;
266
+ members: ChatAvailability[];
267
+ /** Everyone else's, without yours. */
268
+ others: ChatAvailability[];
269
+ forUser: (id: string) => ChatAvailability | null;
270
+ isLoading: boolean;
271
+ };
272
+ /** Sends one message into many conversations (replies come back privately in each). */
273
+ declare function useBroadcast(): {
274
+ send: (conversationIds: string[], body: string, opts?: {
275
+ silent?: boolean;
276
+ clientId?: string;
277
+ }) => Promise<string[]>;
278
+ sending: boolean;
279
+ };
280
+ /** The value, once it has stopped changing for `ms`. */
281
+ declare function useDebouncedValue<T>(value: T, ms: number): T;
282
+ /** Search, debounced (250 ms by default), in one conversation or all of yours. Queries under two characters return nothing. */
283
+ declare function useSearch(query: string, opts?: {
284
+ conversationId?: string | null;
285
+ debounceMs?: number;
286
+ limit?: number;
287
+ }): {
288
+ hits: ChatSearchHit[];
289
+ /** The query the hits are for. */
290
+ query: string;
291
+ /** Typing, or fetching: results are on their way. */
292
+ isSearching: boolean;
293
+ error: Error | null;
294
+ };
295
+ /** At most this many link-preview reads at once, per client. */
296
+ declare const LINK_PREVIEW_CONCURRENCY = 4;
297
+ /**
298
+ * Link previews for these messages, by message id, in link order (only those the server has
299
+ * fetched). Pass the messages whose text has links (`extractLinks(body).length > 0`). One query
300
+ * per message, so a new message asks only for its own, and at most LINK_PREVIEW_CONCURRENCY
301
+ * run at once. One with none yet is asked again a few times, since the runner fills them
302
+ * moments after it lands.
303
+ */
304
+ declare function useLinkPreviews(messageIds: (string | null | undefined)[]): Record<string, ChatLinkPreview[]>;
136
305
 
137
- export { type ChatPerson, ChatProvider, type ChatProviderProps, type ConversationState, LocalFile, QueuedMessage, ThreadItem, type UseConversationOptions, belongsTo, chatKeys, useChat, useConversation, useFileUrls, useInbox, useMessageActions, usePeople, usePerson, usePins, useStartConversation, useUnreadTotal };
306
+ export { CATCH_UP_MAX_PAGES, CATCH_UP_PAGE, type ChatAttachmentKind, type ChatCardContext, type ChatPerson, ChatProvider, type ChatProviderProps, type ChatVideoUpload, type ConversationState, LINK_PREVIEW_CONCURRENCY, LocalFile, type MessagesData, QueuedMessage, ThreadItem, type UseConversationOptions, belongsTo, chatKeys, hostedUploadFrom, useAvailability, useBroadcast, useChat, useConversation, useDebouncedValue, useFileUrls, useInbox, useLinkPreviews, useMessageActions, usePeople, usePerson, usePins, useScheduled, useSearch, useStartConversation, useTopics, useUnreadTotal };
package/dist/react.js CHANGED
@@ -1,5 +1,5 @@
1
- export { ChatProvider, belongsTo, chatKeys, useChat, useConversation, useFileUrls, useInbox, useMessageActions, usePeople, usePerson, usePins, useStartConversation, useUnreadTotal } from './chunk-27UTR5FW.js';
2
- import './chunk-SAY24E6V.js';
3
- import './chunk-JQXZUEEL.js';
1
+ export { CATCH_UP_MAX_PAGES, CATCH_UP_PAGE, ChatProvider, LINK_PREVIEW_CONCURRENCY, belongsTo, chatKeys, hostedUploadFrom, useAvailability, useBroadcast, useChat, useConversation, useDebouncedValue, useFileUrls, useInbox, useLinkPreviews, useMessageActions, usePeople, usePerson, usePins, useScheduled, useSearch, useStartConversation, useTopics, useUnreadTotal } from './chunk-JU2FAPBI.js';
2
+ import './chunk-A4YJX7KT.js';
3
+ import './chunk-GBJ3YI4E.js';
4
4
  //# sourceMappingURL=react.js.map
5
5
  //# sourceMappingURL=react.js.map