@dudousxd/nestjs-agent-react 0.20.0 → 0.22.0

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.
package/dist/index.d.cts CHANGED
@@ -1,13 +1,13 @@
1
1
  import * as ai from 'ai';
2
2
  import { ChatTransport, UIMessage, UIMessageChunk, DataUIPart, UIDataTypes } from 'ai';
3
- import { A as AgentBackend, U as UploadAttachmentOptions, a as AgentClient, b as AttachmentUploadStrategy, Q as QuotaToday } from './client-0Wd-WPsu.cjs';
4
- export { c as AgentBackendUnsupportedError, d as AgentClientOptions, e as AgentConnection, f as AgentHttpError, C as CancelResult, g as ChatStreamRequest, h as ChatStreamResponse, M as MessageFeedbackInput, R as ResumeStreamRequest, T as ThreadPatch, r as requireBackendMethod } from './client-0Wd-WPsu.cjs';
5
- import * as _dudousxd_nestjs_agent_core from '@dudousxd/nestjs-agent-core';
6
- import { MessageAttachment, AgentCatalogEntry, ModelCatalogEntry, ModelCatalogView, QuotaReport, QuotaWindow, QuotaBlock, MessageFeedback, MessageFeedbackValue, ThreadSummary, StoredMessage, ToolCatalogEntry, ThreadDetail } from '@dudousxd/nestjs-agent-core';
3
+ import { A as AgentBackend, U as UploadAttachmentOptions, a as AttachmentUploadStrategy } from './client-CYlhK7XD.cjs';
4
+ export { b as AgentBackendUnsupportedError, c as AgentClient, d as AgentClientOptions, e as AgentConnection, f as AgentHttpError, C as CancelResult, g as ChatStreamRequest, h as ChatStreamResponse, M as MessageFeedbackInput, R as ResumeStreamRequest, T as ThreadPatch, r as requireBackendMethod } from './client-CYlhK7XD.cjs';
5
+ import { MessageAttachment, AgentCatalogEntry, ModelCatalogEntry, ModelCatalogView, QuotaReport, QuotaWindow, QuotaBlock, MessageFeedback, MessageFeedbackValue, ThreadSummary, StoredMessage, ToolCatalogEntry } from '@dudousxd/nestjs-agent-core';
7
6
  export { ElicitationInput, ElicitationInputType, validateElicitationAnswer as validateAnswer, validateElicitationValue as validateAnswerValue } from '@dudousxd/nestjs-agent-core';
7
+ import * as React from 'react';
8
8
  import React__default, { ReactNode, Context } from 'react';
9
- import { T as TranscriptUiBlock, a as TranscriptBlock, U as UsageSummary, b as TimestampInfo, C as ChatStatus, M as MessageUsageInfo, c as ToolCatalog, A as ApproveOptions, d as AnyToolUIPart, e as TranscriptFile } from './model-gHqjNjLJ.cjs';
10
- export { f as ApprovalBlockOptions, B as BuildBlocksOptions, g as CoercibleQuestion, D as DescribeToolCallOptions, E as ElicitationBlockOptions, G as GroupToolActivityOptions, R as RawAnswer, h as ResolvedReading, i as ResolvedResultView, j as RetrievedPassage, S as SettleAction, k as ToolActivityGroup, l as ToolCallDescription, m as ToolCallState, n as ToolCallStatus, o as TranscriptApproval, p as TranscriptApprovalStatus, q as TranscriptElicitationBlock, r as TranscriptElicitationOutcome, s as TranscriptFilesBlock, t as TranscriptQuestion, u as TranscriptQuestionOption, v as TranscriptReasoningBlock, w as TranscriptSettleState, x as TranscriptSource, y as TranscriptSourcesBlock, z as TranscriptTextBlock, F as TranscriptToolBlock, H as TranscriptToolCall, I as buildTranscriptBlocks, J as coerceAnswer, K as correctedCallIds, L as describeTimestamp, N as describeToolCall, O as describeUsage, P as extractMessageText, Q as fillTemplate, V as formatRelativeTime, W as groupToolActivity, X as inferResultView, Y as isActionCall, Z as phraseFor, _ as readPath, $ as resolveResultView, a0 as toolCallState, a1 as toolCatalogFrom } from './model-gHqjNjLJ.cjs';
9
+ import { o as GenuiProviderValue, T as TranscriptUiBlock, A as ApproveOptions, t as TranscriptBlock, U as UsageSummary, v as TimestampInfo, C as ChatStatus, M as MessageUsageInfo, w as ToolCatalog, x as AnyToolUIPart, y as TranscriptFile } from './generative-ui-9AJNVKBZ.cjs';
10
+ export { z as ApprovalBlockOptions, B as BuildBlocksOptions, D as CoercibleQuestion, E as DescribeToolCallOptions, F as ElicitationBlockOptions, H as GroupToolActivityOptions, I as RawAnswer, J as ResolvedReading, K as ResolvedResultView, L as RetrievedPassage, S as SettleAction, N as ToolActivityGroup, O as ToolCallDescription, P as ToolCallState, Q as ToolCallStatus, V as TranscriptApproval, W as TranscriptApprovalStatus, X as TranscriptElicitationBlock, Y as TranscriptElicitationOutcome, Z as TranscriptFilesBlock, _ as TranscriptQuestion, $ as TranscriptQuestionOption, a0 as TranscriptReasoningBlock, a1 as TranscriptSettleState, a2 as TranscriptSource, a3 as TranscriptSourcesBlock, a4 as TranscriptTextBlock, a5 as TranscriptToolBlock, a6 as TranscriptToolCall, a7 as buildTranscriptBlocks, a8 as coerceAnswer, a9 as correctedCallIds, aa as describeTimestamp, ab as describeToolCall, ac as describeUsage, ad as extractMessageText, ae as fillTemplate, af as formatRelativeTime, ag as groupToolActivity, ah as inferResultView, ai as isActionCall, aj as phraseFor, ak as readPath, al as resolveResultView, am as toolCallState, an as toolCatalogFrom } from './generative-ui-9AJNVKBZ.cjs';
11
11
 
12
12
  /** Identity surfaced by the backend's `meta` SSE frame / response headers. */
13
13
  interface AgentStreamMeta {
@@ -56,12 +56,10 @@ interface AgentChatTransportOptions {
56
56
  reconnect?: ReconnectOptions | false;
57
57
  /** Fires as a stream drops, reconnects, or gives up. */
58
58
  onConnectionChange?: (state: StreamConnectionState) => void;
59
- /**
60
- * Origin + base path the agent endpoints hang off, e.g.
61
- * `https://api.example.com`. Endpoints are appended as
62
- * `${baseUrl}/agent/chat` etc. Defaults to `''` (same origin).
63
- */
59
+ /** The server's origin, e.g. `https://api.example.com`. Defaults to `''` (same origin). */
64
60
  baseUrl?: string;
61
+ /** The agent's route prefix (`AgentModule`'s `path`, global prefix included). Default `'agent'`. */
62
+ path?: string;
65
63
  /** Static headers merged into every request (e.g. a tenant ref). */
66
64
  headers?: Record<string, string>;
67
65
  /**
@@ -232,7 +230,7 @@ interface UseAttachmentsOptions {
232
230
  * answered; honour `signal` so `remove` can cancel; call `onProgress(0..1)` if you can.
233
231
  */
234
232
  upload?: (file: File, options: UploadAttachmentOptions) => Promise<MessageAttachment>;
235
- /** Used for the default `upload`. One of `upload` / `backend` is required. */
233
+ /** Used for the default `upload`. Default: the enclosing `<AgentProvider>`'s. */
236
234
  backend?: AgentBackend;
237
235
  /** `<input accept>` grammar: `'image/*,.pdf'` or `['image/*', 'application/pdf']`. */
238
236
  accept?: string | readonly string[];
@@ -303,11 +301,65 @@ interface ClipboardLikeEvent {
303
301
  * files.clear();
304
302
  * ```
305
303
  */
306
- declare function useAttachments(options: UseAttachmentsOptions): AttachmentsState;
304
+ declare function useAttachments(options?: UseAttachmentsOptions): AttachmentsState;
305
+
306
+ interface AgentProviderProps {
307
+ /**
308
+ * A backend of your own — see {@link AgentBackend}. Omitted → an {@link AgentClient} over this
309
+ * library's REST routes, built from the connection props below (which are ignored when a backend
310
+ * is given). Must be stable across renders.
311
+ */
312
+ backend?: AgentBackend;
313
+ /** The server's origin, e.g. `https://api.example.com`. Default `''` (same origin). */
314
+ baseUrl?: string;
315
+ /** `AgentModule`'s `path`, global prefix included (`'api/agent'`). Default `'agent'`. */
316
+ path?: string;
317
+ /** Static headers on every request. */
318
+ headers?: Record<string, string>;
319
+ /**
320
+ * Read at every request — a short-lived bearer token, or a CSRF header read from a cookie
321
+ * (`{ 'X-XSRF-TOKEN': readCookie('XSRF-TOKEN') }`).
322
+ */
323
+ getHeaders?: () => Record<string, string> | Promise<Record<string, string>>;
324
+ /** `'include'` when the API is on another origin and authenticates by cookie. */
325
+ credentials?: RequestCredentials;
326
+ /** Injectable for tests / non-browser runtimes. */
327
+ fetch?: typeof fetch;
328
+ /** Attachment uploads of the built-in client. */
329
+ attachments?: {
330
+ /** e.g. `mediaAttachments()` from `@dudousxd/nestjs-agent-react/media`. */
331
+ upload?: AttachmentUploadStrategy;
332
+ };
333
+ /**
334
+ * Set generative UI up here — the same settings `<GenuiProvider>` takes (registry, catalog,
335
+ * resolver, fallback, …). Every message then draws pushed components with them.
336
+ */
337
+ genui?: GenuiProviderValue;
338
+ children?: ReactNode;
339
+ }
340
+ /**
341
+ * The agent connection, once, at the app root. Every hook below it — `useAgentChat`, `useThreads`,
342
+ * `useModels`, `useAgents`, `useQuota`, `useToolCatalog`, `useMessageFeedback`, `useAttachments` —
343
+ * talks to it unless handed a `backend` of its own.
344
+ *
345
+ * ```tsx
346
+ * <AgentProvider baseUrl="https://api.example.com" credentials="include">
347
+ * <App />
348
+ * </AgentProvider>
349
+ * ```
350
+ *
351
+ * Without a provider every hook shares one same-origin client on `/agent`.
352
+ */
353
+ declare function AgentProvider({ backend, baseUrl, path, headers, getHeaders, credentials, fetch, attachments, genui, children, }: AgentProviderProps): React.JSX.Element;
354
+ /**
355
+ * The backend a hook talks to: `own` when given, else the enclosing {@link AgentProvider}'s, else a
356
+ * shared same-origin client on `/agent`. For your own hooks over the same connection.
357
+ */
358
+ declare function useAgentBackend<B extends AgentBackend = AgentBackend>(own?: B): B;
307
359
 
308
360
  interface UseAgentsOptions {
309
- /** `useAgentChat(...).backend`, or your own. Must implement `listAgents`. */
310
- backend: AgentBackend;
361
+ /** Default: the enclosing `<AgentProvider>`'s. Must implement `listAgents`. */
362
+ backend?: AgentBackend;
311
363
  /** `false` holds the request. Default `true`. */
312
364
  enabled?: boolean;
313
365
  }
@@ -324,11 +376,11 @@ interface AgentsState {
324
376
  * The registered agents (`GET <base>/agents`) — the data behind an agent picker. Send the pick as
325
377
  * `useAgentChat({ agent })`, or pin it on a thread with `PATCH <base>/threads/:id { defaultAgent }`.
326
378
  */
327
- declare function useAgents(options: UseAgentsOptions): AgentsState;
379
+ declare function useAgents(options?: UseAgentsOptions): AgentsState;
328
380
 
329
381
  interface UseModelsOptions {
330
- /** `useAgentChat(...).backend`, or your own. Must implement `listModels`. */
331
- backend: AgentBackend;
382
+ /** Default: the enclosing `<AgentProvider>`'s. Must implement `listModels`. */
383
+ backend?: AgentBackend;
332
384
  /** The agent to list models for; omitted → the default agent. */
333
385
  agent?: string;
334
386
  /** `false` holds the request. Default `true`. */
@@ -358,11 +410,11 @@ interface ModelsState {
358
410
  * as `useAgentChat({ model })`, `sendMessage(msg, { body: { model } })`, or pin it on the thread
359
411
  * with `chat.setThreadModel(id)`.
360
412
  */
361
- declare function useModels(options: UseModelsOptions): ModelsState;
413
+ declare function useModels(options?: UseModelsOptions): ModelsState;
362
414
 
363
415
  interface UseQuotaOptions {
364
- /** `useAgentChat(...).backend`, or your own. Must implement `getQuota`. */
365
- backend: AgentBackend;
416
+ /** Default: the enclosing `<AgentProvider>`'s. Must implement `getQuota`. */
417
+ backend?: AgentBackend;
366
418
  /** `false` holds the request. Default `true`. */
367
419
  enabled?: boolean;
368
420
  /** Re-read every `pollMs` ms as well. Default: only on mount, after runs, and on `refresh`. */
@@ -386,11 +438,11 @@ interface QuotaState {
386
438
  * one — if any — blocks sends. Re-read after every run a chat on the same backend settles, so a
387
439
  * meter moves with the conversation. Headless: draw the meter yourself.
388
440
  */
389
- declare function useQuota(options: UseQuotaOptions): QuotaState;
441
+ declare function useQuota(options?: UseQuotaOptions): QuotaState;
390
442
 
391
443
  interface UseMessageFeedbackOptions {
392
- /** `useAgentChat(...).backend`, or your own. Must implement `setMessageFeedback`. */
393
- backend: AgentBackend;
444
+ /** Default: the enclosing `<AgentProvider>`'s. Must implement `setMessageFeedback`. */
445
+ backend?: AgentBackend;
394
446
  /**
395
447
  * The thread the messages belong to — `useAgentChat(...).getThreadId`, or an id. Needed to rate a
396
448
  * message streamed in this session: its id is the client's own, so the persisted row it became is
@@ -415,7 +467,7 @@ interface MessageFeedbackState {
415
467
  * Headless: it holds the state and the calls, the host draws the buttons. A rating shows at once
416
468
  * and rolls back if the server refuses it.
417
469
  */
418
- declare function useMessageFeedback(options: UseMessageFeedbackOptions): MessageFeedbackState;
470
+ declare function useMessageFeedback(options?: UseMessageFeedbackOptions): MessageFeedbackState;
419
471
 
420
472
  /**
421
473
  * What changed about a backend's thread list. `changed` → refetch (a thread was created, or a run
@@ -439,11 +491,11 @@ declare function onThreadsEvent(backend: AgentBackend, listener: Listener): () =
439
491
 
440
492
  interface UseThreadsOptions {
441
493
  /**
442
- * The backend to list — `useAgentChat(...).backend`, or your own. Must be STABLE across renders:
494
+ * The backend to list. Default: the enclosing `<AgentProvider>`'s. Must be STABLE across renders:
443
495
  * the list refreshes itself when a chat on the SAME backend creates a thread, settles a run or
444
496
  * streams a title.
445
497
  */
446
- backend: AgentBackend;
498
+ backend?: AgentBackend;
447
499
  /** `false` holds the first request (e.g. until the user is signed in). Default `true`. */
448
500
  enabled?: boolean;
449
501
  }
@@ -464,7 +516,7 @@ interface ThreadsState {
464
516
  * backend reports thread creation and settled runs (refetch) and streamed titles (patched in
465
517
  * place). Headless — it renders nothing.
466
518
  */
467
- declare function useThreads(options: UseThreadsOptions): ThreadsState;
519
+ declare function useThreads(options?: UseThreadsOptions): ThreadsState;
468
520
 
469
521
  /**
470
522
  * A sub-agent the conversation started and did not wait for. The chat is free while it works, so a
@@ -635,15 +687,47 @@ interface TranscriptItem {
635
687
  fork: TranscriptActionState;
636
688
  regenerate: TranscriptActionState;
637
689
  }
690
+ /** What an edit-and-resubmit sends. */
691
+ interface EditSubmitInput {
692
+ messageId: string;
693
+ text: string;
694
+ }
695
+ /** Names the message an action is about. */
696
+ interface MessageActionInput {
697
+ messageId: string;
698
+ }
699
+ /** Settling a parked question set. `answers` holds only the questions the user touched. */
700
+ interface AnswerInput {
701
+ toolCallId: string;
702
+ answers?: Record<string, string[]>;
703
+ }
704
+ /** Declining a parked question set. */
705
+ interface SkipInput {
706
+ toolCallId: string;
707
+ }
708
+ /** Approving a tool call parked on a human. */
709
+ interface ApproveInput extends ApproveOptions {
710
+ toolCallId: string;
711
+ /** The surface the decision came through; the server records `'web'` when omitted. */
712
+ via?: string;
713
+ }
714
+ /** Rejecting a tool call parked on a human. */
715
+ interface RejectInput {
716
+ toolCallId: string;
717
+ reason?: string;
718
+ via?: string;
719
+ }
638
720
  interface TranscriptItemOptions {
639
721
  /** User messages get an inline edit-and-resubmit machine. */
640
722
  editable?: boolean;
641
- onEditSubmit?: (messageId: string, text: string) => void | Promise<void>;
642
- onFork?: (messageId: string) => void | Promise<void>;
723
+ onEditSubmit?: (input: EditSubmitInput) => void | Promise<void>;
724
+ onFork?: (input: MessageActionInput) => void | Promise<void>;
643
725
  /** Only the LAST assistant message gets a regenerate machine. */
644
726
  regeneratable?: boolean;
645
- onRegenerate?: (messageId: string) => void | Promise<void>;
727
+ onRegenerate?: (input: MessageActionInput) => void | Promise<void>;
728
+ /** Default: `metadata.usage` (replayed turns; see `AgentMessageMetadata`). */
646
729
  getUsage?: (message: UIMessage) => MessageUsageInfo | null;
730
+ /** Default: `metadata.createdAt` (replayed and streamed messages). */
647
731
  getCreatedAt?: (message: UIMessage) => string | null;
648
732
  /** How long `copy.copied` stays true. Default 1500ms. */
649
733
  copyResetMs?: number;
@@ -660,23 +744,24 @@ interface TranscriptItemOptions {
660
744
  */
661
745
  toolCatalog?: ToolCatalog;
662
746
  /**
663
- * Settle a parked question set — wire to `useAgentChat`'s `answer`. Supplying it is what lifts a
664
- * question set out of the tool run into an `elicitation` block: without somewhere to send an
665
- * answer, a form is a card the user cannot act on.
747
+ * Settle a parked question set. Default: the in-scope backend's `answerToolCall` (the enclosing
748
+ * `<AgentProvider>`'s), so a question set is an `elicitation` block the user can act on without
749
+ * any wiring. `null` turns question sets back into plain tool calls.
666
750
  *
667
751
  * `answers` holds ONLY the questions the user touched. An omitted one takes its own pre-picked
668
752
  * default server-side, which is what keeps "just confirmed" and "picked exactly what was
669
753
  * pre-picked" distinguishable in the settled row.
670
754
  */
671
- onAnswer?: (toolCallId: string, answers: Record<string, string[]>) => void | Promise<void>;
672
- /** Decline the question set and let the agent proceed on its own picks — `useAgentChat`'s `skip`. */
673
- onSkip?: (toolCallId: string) => void | Promise<void>;
755
+ onAnswer?: ((input: AnswerInput) => void | Promise<void>) | null;
756
+ /** Decline the question set and let the agent proceed on its own picks. Default: the backend's. */
757
+ onSkip?: ((input: SkipInput) => void | Promise<void>) | null;
674
758
  /**
675
- * Settle a tool call parked on a human — `useAgentChat`'s `approve` / `reject`. `options.remember`
676
- * is what `call.approve.run({ remember: true })` passed.
759
+ * Settle a tool call parked on a human. Default: the in-scope backend's `approveToolCall` /
760
+ * `rejectToolCall`. `remember` is what `call.approve.run({ remember: true })` passed. `null`
761
+ * leaves the call without the affordance.
677
762
  */
678
- onApprove?: (toolCallId: string, options?: ApproveOptions) => void | Promise<void>;
679
- onReject?: (toolCallId: string) => void | Promise<void>;
763
+ onApprove?: ((input: ApproveInput) => void | Promise<void>) | null;
764
+ onReject?: ((input: RejectInput) => void | Promise<void>) | null;
680
765
  }
681
766
  interface TranscriptWindow {
682
767
  visibleCount: number;
@@ -805,12 +890,12 @@ interface MessageItemProps extends MessageRenderSlots {
805
890
  isStreaming?: boolean;
806
891
  /** User bubble gets a pencil → inline textarea; submitting calls back with the new text. */
807
892
  editable?: boolean;
808
- onEditSubmit?: (newText: string) => void | Promise<void>;
893
+ onEditSubmit?: (input: EditSubmitInput) => void | Promise<void>;
809
894
  /** Assistant bubble gets a "Regenerate" affordance. */
810
895
  regeneratable?: boolean;
811
- onRegenerate?: () => void | Promise<void>;
896
+ onRegenerate?: (input: MessageActionInput) => void | Promise<void>;
812
897
  /** When provided, a "Fork" affordance calls back with this message's id. */
813
- onFork?: (uiMessageId: string) => void | Promise<void>;
898
+ onFork?: (input: MessageActionInput) => void | Promise<void>;
814
899
  /** Server-aggregated usage for this assistant turn (cost + tokens line). */
815
900
  usage?: MessageUsageInfo | null;
816
901
  /** ISO timestamp of the persisted message; rendered as a relative-time line when set. */
@@ -860,13 +945,13 @@ interface MessageListProps {
860
945
  /** Extra content for one message's action row — e.g. a badge naming which agent answered. */
861
946
  getMeta?: (message: UIMessage) => React__default.ReactNode;
862
947
  /** When set, every message gets a "Fork" affordance calling back with its id. */
863
- onFork?: (uiMessageId: string) => void | Promise<void>;
948
+ onFork?: (input: MessageActionInput) => void | Promise<void>;
864
949
  /** User messages get an inline edit-and-resubmit affordance. */
865
950
  editable?: boolean;
866
- onEditSubmit?: (uiMessageId: string, newText: string) => void | Promise<void>;
951
+ onEditSubmit?: (input: EditSubmitInput) => void | Promise<void>;
867
952
  /** The last assistant message gets a "Regenerate" affordance. */
868
953
  regeneratable?: boolean;
869
- onRegenerate?: (uiMessageId: string) => void | Promise<void>;
954
+ onRegenerate?: (input: MessageActionInput) => void | Promise<void>;
870
955
  /** Per-message resolvers for the usage line and the persisted timestamp. */
871
956
  getUsage?: (message: UIMessage) => MessageUsageInfo | null;
872
957
  getCreatedAt?: (message: UIMessage) => string | null;
@@ -1025,8 +1110,8 @@ interface SkillSuggestionData {
1025
1110
  shadows?: string[];
1026
1111
  }
1027
1112
  interface SkillsSourceOptions {
1028
- /** Any backend with `listSkills` — `useAgentChat(...).backend`. */
1029
- client: Pick<AgentBackend, 'listSkills'>;
1113
+ /** Any backend with `listSkills` — `useAgentBackend()`, or `useAgentChat().backend`. */
1114
+ backend: Pick<AgentBackend, 'listSkills'>;
1030
1115
  /**
1031
1116
  * Read at query time, not captured once: a threadless chat learns its id only when the backend
1032
1117
  * creates one on the first send, and a skill may be scoped to a conversation.
@@ -1122,13 +1207,12 @@ declare function useComposerAutocomplete(options: UseComposerAutocompleteOptions
1122
1207
 
1123
1208
  /** What the catalog needs of a backend. */
1124
1209
  type ToolsBackend = Pick<AgentBackend, 'listTools'>;
1125
-
1126
1210
  interface UseToolCatalogOptions {
1127
1211
  /**
1128
- * The client to ask — `useAgentChat(...).client`, or one of your own. Must be STABLE across
1129
- * renders (the shared copy is keyed by it): a client constructed inline refetches every render.
1212
+ * The backend to ask. Default: the enclosing `<AgentProvider>`'s. Must be STABLE across renders
1213
+ * (the shared copy is keyed by it): a backend constructed inline refetches every render.
1130
1214
  */
1131
- client: ToolsBackend;
1215
+ backend?: ToolsBackend;
1132
1216
  /** The agent whose tools to list. Omitted → the server's default agent. */
1133
1217
  agent?: string;
1134
1218
  /** `false` holds the request (e.g. until the user is signed in). Default `true`. */
@@ -1149,7 +1233,7 @@ interface ToolCatalogState {
1149
1233
  * `phraseFor`, `describeToolCall` and `groupToolActivity` — or pass `catalog` to
1150
1234
  * `useChatTranscript({ toolCatalog })` and read the phrases off the transcript's calls.
1151
1235
  */
1152
- declare function useToolCatalog(options: UseToolCatalogOptions): ToolCatalogState;
1236
+ declare function useToolCatalog(options?: UseToolCatalogOptions): ToolCatalogState;
1153
1237
 
1154
1238
  interface ApprovalCountdown {
1155
1239
  /** Milliseconds until the request lapses, floored at 0; `null` when it never does. */
@@ -1231,6 +1315,8 @@ interface AgentMessageMetadata extends Partial<StoredTurnMetadata> {
1231
1315
  feedback?: MessageFeedback;
1232
1316
  runId?: string;
1233
1317
  costUsd?: number | null;
1318
+ /** ISO timestamp: the stored row's `createdAt` (a merged turn: its first row's), or when a live turn started streaming. */
1319
+ createdAt?: string;
1234
1320
  }
1235
1321
  /**
1236
1322
  * Convert a thread's full `StoredMessage[]` history into `UIMessage[]`, merging consecutive
@@ -1272,11 +1358,10 @@ interface AgentMessageMetadata extends Partial<StoredTurnMetadata> {
1272
1358
  */
1273
1359
  declare function storedThreadToUiMessages(messages: StoredMessage[]): UIMessage[];
1274
1360
 
1275
- interface UseAgentChatOptions<B extends AgentBackend = AgentClient> {
1361
+ interface UseAgentChatOptions<B extends AgentBackend = AgentBackend> {
1276
1362
  /**
1277
- * What the chat talks to — see {@link AgentBackend}. Omitted → an {@link AgentClient} over this
1278
- * library's REST routes, built from `baseUrl`, `headers`, `getHeaders`, `credentials` and `fetch`
1279
- * (which are ignored when a backend is given). Must be stable across renders.
1363
+ * What the chat talks to — see {@link AgentBackend}. Omitted → the enclosing `<AgentProvider>`'s,
1364
+ * else a same-origin client on `/agent`. Must be stable across renders.
1280
1365
  */
1281
1366
  backend?: B;
1282
1367
  /**
@@ -1285,86 +1370,77 @@ interface UseAgentChatOptions<B extends AgentBackend = AgentClient> {
1285
1370
  * it off.
1286
1371
  */
1287
1372
  reconnect?: ReconnectOptions | false;
1288
- /** Origin + base path, e.g. `https://api.example.com`. Defaults to `''`. */
1289
- baseUrl?: string;
1290
- /** Static headers merged into every request. */
1291
- headers?: Record<string, string>;
1292
- /** Resolved per request — for short-lived bearer tokens. */
1293
- getHeaders?: () => Record<string, string> | Promise<Record<string, string>>;
1294
- /** Forwarded to fetch so cookie auth/impersonation works. */
1295
- credentials?: RequestCredentials;
1296
- /** Injectable for tests / non-browser runtimes. */
1297
- fetch?: typeof fetch;
1298
- /**
1299
- * How the built-in client uploads attachments (ignored when a backend is given) — e.g.
1300
- * `mediaAttachments()` from `@dudousxd/nestjs-agent-react/media`. Pass `chat.backend` to
1301
- * `useAttachments` and every composer uses it.
1302
- */
1303
- attachments?: AttachmentUploadStrategy;
1304
- /** Reuse an existing client instead of constructing one. Prefer {@link backend}. */
1305
- client?: B;
1306
1373
  /** Named agent to run each turn. */
1307
1374
  agent?: string;
1308
1375
  /**
1309
- * The quota window blocking sends — `useQuota(...).blocked`. While set, `sendMessage` and
1310
- * `regenerate` refuse with {@link QuotaBlockedError} instead of starting a turn the server would
1311
- * refuse anyway.
1376
+ * Thread this chat is bound to. Omitted → the backend creates one on the first send
1377
+ * ({@link UseAgentChatOptions.onThreadCreated}). Changing it switches the chat to that thread:
1378
+ * its history loads and a turn still streaming on it is re-attached. Switching to the thread this
1379
+ * chat just created (syncing a URL) keeps the live conversation as it is.
1312
1380
  */
1313
- blocked?: QuotaBlock | null;
1381
+ threadId?: string;
1314
1382
  /**
1315
- * Catalog model to run each turn on (see `useModels`), sent as the body's `model`. Read at every
1316
- * send, so a picker can change it between turns. Omitted → the thread's pinned model, else the
1317
- * server default. A single send can still override it with `sendMessage(msg, { body: { model } })`.
1383
+ * Load a `threadId`'s persisted history into the chat (`GET <base>/threads/:id`). Default `true`;
1384
+ * skipped when {@link UseAgentChatOptions.initialMessages} is given. `false` opts out.
1318
1385
  */
1319
- model?: string;
1320
- /** Thread this chat is bound to. Omitted → backend creates one on send. */
1321
- threadId?: string;
1322
- /** Persisted history to seed `useChat` with (consumed on mount only). */
1386
+ history?: boolean;
1387
+ /** Persisted history you already have — seeds the chat instead of loading it (read per thread). */
1323
1388
  initialMessages?: UIMessage[];
1324
1389
  /**
1325
- * Run id of a buffered stream to reconnect to on mount — wire this to the thread's
1326
- * `activeStreamId`. Its presence both gates the SDK's `resume` and names the run, so a normal
1327
- * mount (no id) never fires a doomed resume GET. Omitted → no resume.
1328
- *
1329
- * For the common case (no id in hand yet), prefer {@link UseAgentChatOptions.resume} — it does
1330
- * this fetch-and-wire for you.
1390
+ * Re-attach to a turn that was still streaming on `threadId` when the page (re)loaded — read off
1391
+ * the thread's `activeRunId`, so a reload mid-answer keeps streaming it. Default `true`; `false`
1392
+ * opts out.
1393
+ */
1394
+ resume?: boolean;
1395
+ /**
1396
+ * A run id you already know is streaming — attached to on mount without reading the thread first.
1397
+ * Rarely needed: {@link UseAgentChatOptions.resume} finds it by itself.
1331
1398
  */
1332
1399
  resumeRunId?: string;
1333
1400
  /**
1334
- * When `true` and the hook (re)mounts with a `threadId`, the hook fetches the thread and, if its
1335
- * `activeRunId` is non-null (a turn was still streaming when the page loaded/reloaded), attaches
1336
- * to that run's `GET /agent/chat/:runId/stream` automatically — the in-flight turn streams into
1337
- * this session's message state exactly as if the send had happened here. A no-op when `threadId`
1338
- * is omitted (nothing to resume) or the fetched thread has no active run. Default `false`.
1401
+ * The model every turn runs on, controlled by you. Omitted → `chat.models.selected` (what
1402
+ * `chat.models.select(id)` picked), else the thread's pinned model, else the server default. A
1403
+ * single send can still override it with `sendMessage(msg, { body: { model } })`.
1339
1404
  */
1340
- resume?: boolean;
1405
+ model?: string;
1406
+ /**
1407
+ * Read the caller's budget (`GET <base>/quota`) and refuse sends while a window is exhausted.
1408
+ * Default `true` when the backend implements `getQuota`; `false` skips the request.
1409
+ */
1410
+ quota?: boolean;
1411
+ /**
1412
+ * Override the quota gate: `null` never blocks, a {@link QuotaBlock} always does. Omitted → the
1413
+ * gate follows {@link UseAgentChatOptions.quota}'s report. While blocked, `sendMessage` and
1414
+ * `regenerate` refuse with {@link QuotaBlockedError}.
1415
+ */
1416
+ blocked?: QuotaBlock | null;
1417
+ /** Validation and upload for `chat.composer.files` — see `useAttachments`. */
1418
+ composer?: Omit<UseAttachmentsOptions, 'backend'>;
1419
+ /**
1420
+ * Overrides for `chat.transcript` — anything `useChatTranscript` takes (`sources`, `editable` +
1421
+ * `onEditSubmit`, `followUps`, `getUsage`, a `toolCatalog` of your own, `onApprove: null`, …).
1422
+ * Yours win over the chat's own wiring.
1423
+ */
1424
+ transcript?: Partial<Omit<UseChatTranscriptOptions, 'messages' | 'status'>>;
1341
1425
  /** Read at every send to capture a page snapshot for the page-assistant. */
1342
1426
  getPageContext?: () => Record<string, unknown> | null;
1343
1427
  /** Fired after each streamed turn finishes (e.g. to refetch the sidebar). */
1344
1428
  onFinish?: () => void;
1345
1429
  /**
1346
- * Fired once when a threadless chat's first send makes the backend create a thread — carries the
1347
- * new id so the consumer can sync its URL/router. Not fired when `threadId` was supplied. The hook
1348
- * ALSO remembers the id internally, so every subsequent send reuses it (no new thread per message)
1349
- * even before the consumer navigates.
1430
+ * Fired when this chat moves to a thread it created: the first send of a threadless chat (the
1431
+ * backend created one), or `chat.fork(…)`. Carries the id so the host can sync its URL/router.
1432
+ * The hook already remembers a created thread, so every later send reuses it even before the
1433
+ * host navigates.
1350
1434
  */
1351
1435
  onThreadCreated?: (threadId: string) => void;
1352
1436
  /**
1353
1437
  * Fired exactly once per run when its stream settles — normally (`'completed'`) or via a thrown
1354
1438
  * failure / the backend's `event: error` frame (`'failed'`) — including a RESUMED stream's own
1355
1439
  * completion. By the time this fires, the server has already derived and persisted the thread's
1356
- * title (and the run's terminal state), so it's the signal `onFinish` doesn't give you: `onFinish`
1357
- * only says "a turn rendered," never "the server is done writing" — without this, a host has no
1358
- * reason to refetch the thread/list queries, and the header/sidebar title is stuck on "Untitled".
1359
- *
1360
- * Skipped when the attempt never got far enough to learn a run id (e.g. the initial POST itself
1361
- * failed before any response headers/meta frame arrived) — nothing was created server-side, so
1362
- * there's nothing to refetch.
1440
+ * title (and the run's terminal state).
1363
1441
  *
1364
- * A user-initiated `cancel()`/`stop()` reports `'completed'` here (the AI SDK's own abort signal
1365
- * doesn't set its `isError` flag) — the server-side cancel already recorded its own terminal run
1366
- * state; this callback only reflects whether the CLIENT's stream loop exited with or without an
1367
- * error, not why it stopped.
1442
+ * Skipped when the attempt never got far enough to learn a run id. A user-initiated `cancel()`
1443
+ * reports `'completed'` (the server-side cancel records its own terminal state).
1368
1444
  */
1369
1445
  onRunSettled?: (outcome: {
1370
1446
  runId: string;
@@ -1377,29 +1453,16 @@ interface UseAgentChatOptions<B extends AgentBackend = AgentClient> {
1377
1453
  * `data-<kind>`. See `AgentChatTransport` for the full mapping.
1378
1454
  */
1379
1455
  onData?: (part: DataUIPart<UIDataTypes>) => void;
1380
- /**
1381
- * The server set or changed the thread's title while a turn streamed. Lets a header/sidebar
1382
- * update the moment the title exists instead of refetching after the run settles.
1383
- */
1456
+ /** The server set or changed the thread's title while a turn streamed. */
1384
1457
  onTitle?: (title: string) => void;
1385
1458
  /**
1386
1459
  * Track DETACHED sub-agents this conversation started: which are still working, and their answers
1387
1460
  * as they land (see {@link ChatBackground}). Default `false`.
1388
- *
1389
- * Opt-in for the same reason {@link UseAgentChatOptions.resume} is — it reads the thread, and a
1390
- * plain mount must not spend a request on a feature the host is not using. Leaving it off still
1391
- * leaves {@link ChatBackground.refresh} callable, for a host that would rather drive it itself.
1392
1461
  */
1393
1462
  background?: boolean;
1394
1463
  /**
1395
1464
  * How often to re-read the thread while a detached sub-agent is still working, in ms. Default
1396
1465
  * 5000; `0` turns the interval off, leaving {@link ChatBackground.refresh} as the only trigger.
1397
- *
1398
- * A poll rather than a second stream, because what a background run produces is a persisted
1399
- * MESSAGE, not tokens this chat should render as they arrive: its answer belongs to its own run,
1400
- * it can land while the user is mid-turn or has the tab closed, and it has to be there on the next
1401
- * reload either way. The interval exists only while something is outstanding, which is rare and
1402
- * bounded by how many delegations a conversation has started.
1403
1466
  */
1404
1467
  backgroundPollMs?: number;
1405
1468
  }
@@ -1411,18 +1474,51 @@ interface ChatBackground {
1411
1474
  /** Re-read the thread now, instead of waiting for the next poll. */
1412
1475
  refresh: () => Promise<void>;
1413
1476
  }
1477
+ /** The chat's model picker state. Loaded the first time `list`/`providers` is read. */
1478
+ interface ChatModels {
1479
+ /** Every model the caller may pick, flattened (`[]` until loaded). */
1480
+ readonly list: ModelOption[];
1481
+ /** The same, grouped by provider. */
1482
+ readonly providers: ModelsState['providers'];
1483
+ /** What the next turn runs on: the `model` option, the pick, the thread's pin, else the default. */
1484
+ selected: string | null;
1485
+ /** Run the following turns on `id` (sent as the body's `model`). */
1486
+ select: (id: string) => void;
1487
+ /**
1488
+ * Pin `id` on the thread (`null` unpins) — every later turn without its own `model` runs on it,
1489
+ * across reloads. On a chat with no thread yet, the pin lands when the first send creates one.
1490
+ */
1491
+ pinToThread: (id: string | null) => Promise<void>;
1492
+ isLoading: boolean;
1493
+ error: Error | null;
1494
+ }
1495
+ /** Why the composer cannot send right now. */
1496
+ type ComposerBlock = 'empty' | 'busy' | 'uploading' | 'quota';
1497
+ /** A headless composer: the draft, its files, and whether (and why not) it can send. */
1498
+ interface ChatComposer {
1499
+ text: string;
1500
+ setText: (text: string) => void;
1501
+ /** The staged attachments — `useAttachments` state on the chat's backend. */
1502
+ files: AttachmentsState;
1503
+ canSend: boolean;
1504
+ /** Why `canSend` is false, or `null`. */
1505
+ blockedBy: ComposerBlock | null;
1506
+ /** Send the draft with the ready files attached, then clear both. A no-op while blocked. */
1507
+ submit: () => Promise<void>;
1508
+ }
1414
1509
  interface AddToolResultArgs {
1415
1510
  tool: string;
1416
1511
  toolCallId: string;
1417
1512
  output: unknown;
1418
1513
  }
1419
1514
  /**
1420
- * Generalized `useChat` wiring for the nestjs-agent backend. Wraps the
1421
- * AI SDK v7 hook with `AgentChatTransport`, plus thread list/load/delete/
1422
- * fork, quota, cancel, and HITL approve/reject — all driven through
1423
- * `AgentClient`. Mirrors flip's `useAdminChat`, generalized.
1515
+ * The agent chat, wired: the AI SDK v7 `useChat` over `AgentChatTransport`, a thread's history
1516
+ * loaded and a streaming turn re-attached on its own, a quota send gate, a model picker, a headless
1517
+ * composer with attachments, and a transcript whose approve/reject/answer/skip/stop/fork/regenerate
1518
+ * are already bound. Every piece is also a hook of its own (`useChatTranscript`, `useAttachments`,
1519
+ * `useModels`, `useQuota`, `useThreads`) for a host that wants to wire it differently.
1424
1520
  */
1425
- declare function useAgentChat<B extends AgentBackend = AgentClient>(options: UseAgentChatOptions<B>): {
1521
+ declare function useAgentChat<B extends AgentBackend = AgentBackend>(options?: UseAgentChatOptions<B>): {
1426
1522
  status: ChatStatus;
1427
1523
  /** Where the live stream stands — see {@link StreamConnectionState}. */
1428
1524
  connection: StreamConnectionState;
@@ -1449,48 +1545,44 @@ declare function useAgentChat<B extends AgentBackend = AgentClient>(options: Use
1449
1545
  /** Sub-agents this conversation started and did not wait for. */
1450
1546
  background: ChatBackground;
1451
1547
  runId: string | undefined;
1452
- /** The `resume`-fetched thread's active run id, or `null` once resolved with none. */
1548
+ /** The loaded thread's running turn, or `null` once read with none. */
1453
1549
  activeRunId: string | null;
1550
+ /** The thread's history is being read. */
1551
+ isLoadingHistory: boolean;
1552
+ /** Reading the thread's history failed. */
1553
+ historyError: Error | null;
1454
1554
  /**
1455
1555
  * The thread this chat is on right now: the `threadId` option, else the one the backend created
1456
1556
  * on the first send. A getter, because the created id is learned mid-stream.
1457
1557
  */
1458
1558
  getThreadId: () => string | undefined;
1459
- setThreadModel: (model: string | null) => Promise<void>;
1460
- /** The backend this chat talks to — pass it to `useThreads`, `useMessageFeedback`, … */
1559
+ /** The backend this chat talks to — the same one every other hook under the provider uses. */
1461
1560
  backend: B;
1462
- /** Same object as {@link backend}; kept for callers that read it under its old name. */
1463
- client: B;
1464
- threads: ThreadSummary[];
1465
- loadThreads: () => Promise<ThreadSummary[]>;
1466
- loadThread: (id: string) => Promise<ThreadDetail>;
1467
- deleteThread: (id: string) => Promise<void>;
1468
- forkThread: (threadId: string, messageId: string) => Promise<ThreadSummary>;
1469
- renameThread: (id: string, title: string) => Promise<void>;
1470
- promoteThread: (id: string) => Promise<void>;
1471
- truncateFromMessage: (threadId: string, messageId: string) => Promise<void>;
1472
- quota: _dudousxd_nestjs_agent_core.QuotaView | null;
1473
- loadQuota: () => Promise<QuotaToday>;
1561
+ /** The transcript model, with every action already bound to this chat. */
1562
+ transcript: ChatTranscript;
1563
+ /** A headless composer: draft, files, send gate, `submit()`. */
1564
+ composer: ChatComposer;
1565
+ /** The model picker: `list`, `selected`, `select(id)`, `pinToThread(id)`. */
1566
+ models: ChatModels;
1567
+ /** The caller's budget (`GET <base>/quota`); `quota.blocked` gates sends. */
1568
+ quota: QuotaState;
1569
+ /** The window blocking sends right now (the `blocked` option, else the quota report's). */
1570
+ blocked: QuotaBlock | null;
1474
1571
  cancel: () => Promise<void>;
1475
- approve: ({ toolCallId, remember, via, }: {
1476
- toolCallId: string;
1477
- /** Approve later calls of the same tool in this thread without asking. */
1478
- remember?: boolean;
1479
- via?: string;
1480
- }) => Promise<void>;
1481
- reject: ({ toolCallId, reason, via, }: {
1482
- toolCallId: string;
1483
- reason?: string;
1484
- via?: string;
1485
- }) => Promise<void>;
1486
- answer: ({ toolCallId, answers, }: {
1487
- toolCallId: string;
1488
- answers?: Record<string, string[]>;
1572
+ approve: ({ toolCallId, remember, via }: ApproveInput) => Promise<void>;
1573
+ reject: ({ toolCallId, reason, via }: RejectInput) => Promise<void>;
1574
+ answer: ({ toolCallId, answers }: AnswerInput) => Promise<void>;
1575
+ skip: ({ toolCallId }: SkipInput) => Promise<void>;
1576
+ regenerate: (_input?: Partial<MessageActionInput>) => void;
1577
+ fork: ({ messageId, threadId, }: MessageActionInput & {
1578
+ threadId?: string;
1579
+ }) => Promise<ThreadSummary>;
1580
+ truncateFrom: ({ messageId, threadId }: MessageActionInput & {
1581
+ threadId?: string;
1489
1582
  }) => Promise<void>;
1490
- skip: ({ toolCallId }: {
1491
- toolCallId: string;
1583
+ promote: ({ threadId }?: {
1584
+ threadId?: string;
1492
1585
  }) => Promise<void>;
1493
- regenerate: () => void;
1494
1586
  id: string;
1495
1587
  setMessages: (messages: UIMessage<unknown, UIDataTypes, ai.UITools>[] | ((messages: UIMessage<unknown, UIDataTypes, ai.UITools>[]) => UIMessage<unknown, UIDataTypes, ai.UITools>[])) => void;
1496
1588
  error: Error | undefined;
@@ -1501,10 +1593,10 @@ declare function useAgentChat<B extends AgentBackend = AgentClient>(options: Use
1501
1593
  addToolApprovalResponse: ai.ChatAddToolApproveResponseFunction;
1502
1594
  clearError: () => void;
1503
1595
  };
1504
- /** A send refused on the client because a quota window is exhausted (`useAgentChat({ blocked })`). */
1596
+ /** A send refused on the client because a quota window is exhausted. */
1505
1597
  declare class QuotaBlockedError extends Error {
1506
1598
  readonly block: QuotaBlock;
1507
1599
  constructor(block: QuotaBlock);
1508
1600
  }
1509
1601
 
1510
- export { AgentBackend, AgentChatTransport, type AgentChatTransportOptions, AgentClient, type AgentMessageMetadata, type AgentStreamMeta, type AgentsState, type AggregatedTurnUsage, type AmbientRenderUi, AmbientRenderUiContext, AnyToolUIPart, type ApprovalCountdown, ApproveOptions, type AttachmentRejection, AttachmentUploadStrategy, type AttachmentsState, type AutocompleteInputProps, type AutocompleteItem, type AutocompleteListboxProps, type AutocompleteOptionProps, type AutocompleteSource, type BackgroundRun, type ChatBackground, ChatInput, type ChatInputProps, ChatStatus, type ChatTranscript, type ClipboardLikeEvent, type CompletionEdit, type ComposerAutocomplete, DEFAULT_SPEECH_LANG, type DragLikeEvent, type MessageFeedbackState, type MessageFile, type MessageFileKind, MessageItem, type MessageItemClassNames, type MessageItemProps, MessageItemView, type MessageItemViewProps, MessageList, type MessageListClassNames, type MessageListProps, MessageUsageInfo, type ModelOption, type ModelsState, QuotaBlockedError, type QuotaState, QuotaToday, type ReconnectOptions, type RenderFilesFn, type RenderReasoningFn, type RenderTextFn, type RenderToolGroupFn, type RenderToolPartFn, type RenderUiFn, SPEECH_LANGUAGES, type SkillSuggestionData, type SkillsSourceOptions, type SpeechLanguage, type SpeechRecognitionHook, type StagedAttachment, type StagedAttachmentStatus, type StickToBottom, type StickToBottomOptions, type StoredTurnMetadata, type StreamConnectionState, type ThreadsEvent, type ThreadsState, TimestampInfo, ToolCatalog, type ToolCatalogState, type TranscriptActionState, TranscriptBlock, type TranscriptCopyState, type TranscriptEditState, TranscriptFile, type TranscriptItem, type TranscriptItemOptions, type TranscriptStopState, TranscriptUiBlock, type TranscriptWindow, type TriggerMatch, type TriggerPosition, UploadAttachmentOptions, UsageSummary, type UseAgentChatOptions, type UseAgentsOptions, type UseApprovalCountdownOptions, type UseAttachmentsOptions, type UseChatTranscriptOptions, type UseComposerAutocompleteOptions, type UseElapsedOptions, type UseMessageFeedbackOptions, type UseModelsOptions, type UseQuotaOptions, type UseSpeechRecognitionOptions, type UseThreadsOptions, type UseToolCatalogOptions, type UseTranscriptItemOptions, acceptsFile, applyCompletion, approvalCountdown, backgroundRunsFromThread, createSkillsSource, dragHasFiles, fileKind, filesFromClipboard, filterAutocompleteItems, findActiveTrigger, formatElapsed, loadStoredSpeechLang, messageFiles, notifyThreads, onThreadsEvent, persistSpeechLang, readReasoningMs, storedMessageToUiMessage, storedThreadToUiMessages, useAgentChat, useAgents, useAmbientRenderUi, useApprovalCountdown, useAttachments, useChatTranscript, useComposerAutocomplete, useElapsed, useMessageFeedback, useModels, useQuota, useSpeechRecognition, useStickToBottom, useThreads, useToolCatalog, useTranscriptItem };
1602
+ export { AgentBackend, AgentChatTransport, type AgentChatTransportOptions, type AgentMessageMetadata, AgentProvider, type AgentProviderProps, type AgentStreamMeta, type AgentsState, type AggregatedTurnUsage, type AmbientRenderUi, AmbientRenderUiContext, type AnswerInput, AnyToolUIPart, type ApprovalCountdown, type ApproveInput, ApproveOptions, type AttachmentRejection, AttachmentUploadStrategy, type AttachmentsState, type AutocompleteInputProps, type AutocompleteItem, type AutocompleteListboxProps, type AutocompleteOptionProps, type AutocompleteSource, type BackgroundRun, type ChatBackground, ChatInput, type ChatInputProps, ChatStatus, type ChatTranscript, type ClipboardLikeEvent, type CompletionEdit, type ComposerAutocomplete, DEFAULT_SPEECH_LANG, type DragLikeEvent, type EditSubmitInput, type MessageActionInput, type MessageFeedbackState, type MessageFile, type MessageFileKind, MessageItem, type MessageItemClassNames, type MessageItemProps, MessageItemView, type MessageItemViewProps, MessageList, type MessageListClassNames, type MessageListProps, MessageUsageInfo, type ModelOption, type ModelsState, QuotaBlockedError, type QuotaState, type ReconnectOptions, type RejectInput, type RenderFilesFn, type RenderReasoningFn, type RenderTextFn, type RenderToolGroupFn, type RenderToolPartFn, type RenderUiFn, SPEECH_LANGUAGES, type SkillSuggestionData, type SkillsSourceOptions, type SkipInput, type SpeechLanguage, type SpeechRecognitionHook, type StagedAttachment, type StagedAttachmentStatus, type StickToBottom, type StickToBottomOptions, type StoredTurnMetadata, type StreamConnectionState, type ThreadsEvent, type ThreadsState, TimestampInfo, ToolCatalog, type ToolCatalogState, type TranscriptActionState, TranscriptBlock, type TranscriptCopyState, type TranscriptEditState, TranscriptFile, type TranscriptItem, type TranscriptItemOptions, type TranscriptStopState, TranscriptUiBlock, type TranscriptWindow, type TriggerMatch, type TriggerPosition, UploadAttachmentOptions, UsageSummary, type UseAgentChatOptions, type UseAgentsOptions, type UseApprovalCountdownOptions, type UseAttachmentsOptions, type UseChatTranscriptOptions, type UseComposerAutocompleteOptions, type UseElapsedOptions, type UseMessageFeedbackOptions, type UseModelsOptions, type UseQuotaOptions, type UseSpeechRecognitionOptions, type UseThreadsOptions, type UseToolCatalogOptions, type UseTranscriptItemOptions, acceptsFile, applyCompletion, approvalCountdown, backgroundRunsFromThread, createSkillsSource, dragHasFiles, fileKind, filesFromClipboard, filterAutocompleteItems, findActiveTrigger, formatElapsed, loadStoredSpeechLang, messageFiles, notifyThreads, onThreadsEvent, persistSpeechLang, readReasoningMs, storedMessageToUiMessage, storedThreadToUiMessages, useAgentBackend, useAgentChat, useAgents, useAmbientRenderUi, useApprovalCountdown, useAttachments, useChatTranscript, useComposerAutocomplete, useElapsed, useMessageFeedback, useModels, useQuota, useSpeechRecognition, useStickToBottom, useThreads, useToolCatalog, useTranscriptItem };