@dudousxd/nestjs-agent-react 0.26.0 → 0.28.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/README.md +51 -1
- package/dist/{client-D4ZSbZJ8.d.cts → client-CKwSMitS.d.cts} +88 -2
- package/dist/{client-D4ZSbZJ8.d.ts → client-CKwSMitS.d.ts} +88 -2
- package/dist/{generative-ui-BejHxxbR.d.cts → generative-ui-jT9TYfCi.d.cts} +1 -1
- package/dist/{generative-ui-BejHxxbR.d.ts → generative-ui-jT9TYfCi.d.ts} +1 -1
- package/dist/genui-json-render.cjs +202 -370
- package/dist/genui-json-render.cjs.map +1 -1
- package/dist/genui-json-render.d.cts +1 -1
- package/dist/genui-json-render.d.ts +1 -1
- package/dist/genui-json-render.js +209 -373
- package/dist/genui-json-render.js.map +1 -1
- package/dist/genui.cjs +178 -320
- package/dist/genui.cjs.map +1 -1
- package/dist/genui.d.cts +2 -2
- package/dist/genui.d.ts +2 -2
- package/dist/genui.js +185 -323
- package/dist/genui.js.map +1 -1
- package/dist/index.cjs +2266 -2479
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +193 -13
- package/dist/index.d.ts +193 -13
- package/dist/index.js +2292 -2487
- package/dist/index.js.map +1 -1
- package/dist/markdown.cjs +23 -36
- package/dist/markdown.cjs.map +1 -1
- package/dist/markdown.js +23 -28
- package/dist/markdown.js.map +1 -1
- package/dist/media.cjs +46 -79
- package/dist/media.cjs.map +1 -1
- package/dist/media.d.cts +1 -1
- package/dist/media.d.ts +1 -1
- package/dist/media.js +46 -81
- package/dist/media.js.map +1 -1
- package/package.json +3 -2
package/dist/index.d.ts
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, H as HttpErrorListener, a as AttachmentUploadStrategy } from './client-
|
|
4
|
-
export { b as AgentBackendUnsupportedError, c as AgentClient, d as AgentClientOptions, e as AgentConnection, f as AgentHttpError, g as AgentRequestError, C as CancelResult, h as ChatStreamRequest, i as ChatStreamResponse, M as MessageFeedbackInput, R as ResumeStreamRequest, T as ThreadPatch, r as requireBackendMethod } from './client-
|
|
5
|
-
import { MessageAttachment, AgentClientConfig, AgentCatalogEntry, ModelCatalogEntry, ModelCatalogView, ModelCatalogLock, QuotaReport, QuotaWindow, QuotaBlock, QuotaWarning, MessageFeedback, MessageFeedbackValue, ThreadSummary, StoredMessage, ToolCatalogEntry } from '@dudousxd/nestjs-agent-core';
|
|
6
|
-
export { ALL_AGENTS, ElicitationInput, ElicitationInputType, validateElicitationAnswer as validateAnswer, validateElicitationValue as validateAnswerValue } from '@dudousxd/nestjs-agent-core';
|
|
3
|
+
import { A as AgentBackend, U as UploadAttachmentOptions, H as HttpErrorListener, a as AttachmentUploadStrategy } from './client-CKwSMitS.js';
|
|
4
|
+
export { b as AgentBackendUnsupportedError, c as AgentClient, d as AgentClientOptions, e as AgentConnection, f as AgentHttpError, g as AgentRequestError, C as CancelResult, h as ChatStreamRequest, i as ChatStreamResponse, M as MessageFeedbackInput, Q as QueuedMessageUpdate, j as QueuedSendResult, R as ResumeStreamRequest, T as ThreadPatch, r as requireBackendMethod } from './client-CKwSMitS.js';
|
|
5
|
+
import { MessageAttachment, AgentClientConfig, AgentCatalogEntry, ModelCatalogEntry, ModelCatalogView, ModelCatalogLock, QuotaReport, QuotaWindow, QuotaBlock, QuotaWarning, MessageFeedback, MessageFeedbackValue, ThreadSummary, StoredMessage, QueuePause, ToolCatalogEntry } from '@dudousxd/nestjs-agent-core';
|
|
6
|
+
export { ALL_AGENTS, ChatQueueState, ElicitationInput, ElicitationInputType, QueuePause, QueuePauseReason, QueuedMessageView, validateElicitationAnswer as validateAnswer, validateElicitationValue as validateAnswerValue } from '@dudousxd/nestjs-agent-core';
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import React__default, { ReactNode, Context } from 'react';
|
|
9
|
-
import { o as GenuiProviderValue, T as TranscriptUiBlock, A as ApproveOptions, t as TranscriptBlock, U as UsageSummary, v as TimestampInfo, C as ChatStatus,
|
|
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-
|
|
9
|
+
import { o as GenuiProviderValue, T as TranscriptUiBlock, A as ApproveOptions, t as TranscriptBlock, U as UsageSummary, v as TimestampInfo, C as ChatStatus, w as TranscriptFile, M as MessageUsageInfo, x as ToolCatalog, y as AnyToolUIPart } from './generative-ui-jT9TYfCi.js';
|
|
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-jT9TYfCi.js';
|
|
11
11
|
|
|
12
12
|
/** Identity surfaced by the backend's `meta` SSE frame / response headers. */
|
|
13
13
|
interface AgentStreamMeta {
|
|
@@ -94,6 +94,12 @@ interface AgentChatTransportOptions {
|
|
|
94
94
|
* an early failure (no meta ever arrives) to a PRIOR attempt's id.
|
|
95
95
|
*/
|
|
96
96
|
onAttemptStart?: () => void;
|
|
97
|
+
/**
|
|
98
|
+
* A resume found nothing streaming under the run id (the backend answered 404): the run already
|
|
99
|
+
* ended. The SDK is told there is nothing to resume, so the caller is the one that has to reload
|
|
100
|
+
* what the run wrote — `useAgentChat` re-reads the thread.
|
|
101
|
+
*/
|
|
102
|
+
onResumeGone?: (runId: string) => void;
|
|
97
103
|
/** Injectable for tests / non-browser runtimes. Defaults to global fetch. */
|
|
98
104
|
fetch?: typeof fetch;
|
|
99
105
|
}
|
|
@@ -120,7 +126,9 @@ interface AgentChatTransportOptions {
|
|
|
120
126
|
* native `tool-approval-request` (the part moves to `approval-requested`)
|
|
121
127
|
* - `approval-settled` → `data-approval-settled` part keyed by the call id (who decided, through
|
|
122
128
|
* what, remembered or not); the outcome still rides the call's own output
|
|
123
|
-
* - `title`, `cancelled` → transient `data-title` / `data-cancelled` (never
|
|
129
|
+
* - `title`, `cancelled`, `queue` → transient `data-title` / `data-cancelled` / `data-queue` (never
|
|
130
|
+
* stored on the message). A send the server queued (`202`) is reported
|
|
131
|
+
* as a transient `data-queue` too, carrying `queuedSend`
|
|
124
132
|
* - any other kind → `data-<kind>` part carrying the frame minus `kind`, keyed by its `id`
|
|
125
133
|
* when it has one — forwarded, never dropped
|
|
126
134
|
* `parentId` on a tool frame rides the part's `toolMetadata` next to `toolKind`.
|
|
@@ -187,6 +195,11 @@ interface MessageFile {
|
|
|
187
195
|
}
|
|
188
196
|
/** The {@link MessageFileKind} of a MIME type. */
|
|
189
197
|
declare function fileKind(mediaType: string): MessageFileKind;
|
|
198
|
+
/**
|
|
199
|
+
* An uploaded attachment as the {@link MessageFile} it is once its message is sent — so a message
|
|
200
|
+
* still waiting (in the queue, in the composer) draws its files with the same code a sent one does.
|
|
201
|
+
*/
|
|
202
|
+
declare function attachmentFile(attachment: MessageAttachment): MessageFile;
|
|
190
203
|
/**
|
|
191
204
|
* The files on a message — the user's attachments (live, or replayed from `StoredMessage.attachments`
|
|
192
205
|
* by `storedMessageToUiMessage`) and any the model produced — in part order. Data only: pair it with
|
|
@@ -645,6 +658,77 @@ interface ChatInputProps {
|
|
|
645
658
|
*/
|
|
646
659
|
declare function ChatInput({ onSubmit, disabled, placeholder, rows, enableSpeech, speechLang, sendLabel, onStop, isStreaming, stopLabel, className, textareaClassName, sendButtonClassName, micButtonClassName, stopButtonClassName, renderMic, }: ChatInputProps): React__default.JSX.Element;
|
|
647
660
|
|
|
661
|
+
/**
|
|
662
|
+
* What the composer (and `sendMessage`) does with a message sent while a turn is still running:
|
|
663
|
+
* - `'queue'` (default) — it waits in the thread's queue and runs when the turn settles.
|
|
664
|
+
* - `'interrupt'` — the running turn is cancelled and this message runs next.
|
|
665
|
+
* - `'block'` — the composer refuses it (`blockedBy: 'busy'`), as before queues existed.
|
|
666
|
+
*/
|
|
667
|
+
type WhileRunning = 'queue' | 'interrupt' | 'block';
|
|
668
|
+
/**
|
|
669
|
+
* A per-call answer to "a turn is still running" — `composer.submit({ mode })`,
|
|
670
|
+
* `sendMessage(message, { mode })`. It overrides the chat's `whileRunning` for that one send
|
|
671
|
+
* (including `'block'`), and means nothing when no turn is running: the message is simply sent.
|
|
672
|
+
*/
|
|
673
|
+
interface SendWhileRunning {
|
|
674
|
+
/** `'queue'` — wait for the running turn. `'interrupt'` — cancel it and run this next. */
|
|
675
|
+
mode?: 'queue' | 'interrupt';
|
|
676
|
+
}
|
|
677
|
+
/** A message waiting in the thread's queue, as the chat shows it. */
|
|
678
|
+
interface QueuedChatMessage {
|
|
679
|
+
/** The server's id once it is queued; a local id while `state` is `'sending'`. */
|
|
680
|
+
id: string;
|
|
681
|
+
text: string;
|
|
682
|
+
/** The uploaded attachments as they were queued — what a re-send carries. */
|
|
683
|
+
attachments: MessageAttachment[];
|
|
684
|
+
/**
|
|
685
|
+
* The same attachments as {@link MessageFile}s — the shape `messageFiles()` gives for a sent
|
|
686
|
+
* message, so one renderer draws the files of a waiting message and of a sent one.
|
|
687
|
+
*/
|
|
688
|
+
files: MessageFile[];
|
|
689
|
+
/**
|
|
690
|
+
* `'sending'` — on its way to the server (it has no server id yet, so it cannot be edited).
|
|
691
|
+
* `'queued'` — waiting its turn.
|
|
692
|
+
*/
|
|
693
|
+
state: 'sending' | 'queued';
|
|
694
|
+
/** Queued by an interrupt: it runs as soon as the cancelled turn settles. */
|
|
695
|
+
interrupt: boolean;
|
|
696
|
+
createdAt: string;
|
|
697
|
+
}
|
|
698
|
+
/** `chat.queue` — the thread's queue of waiting messages, and what can be done to it. */
|
|
699
|
+
interface ChatQueue {
|
|
700
|
+
/** Waiting messages, in the order they will run. */
|
|
701
|
+
items: QueuedChatMessage[];
|
|
702
|
+
/** Why the queue stopped draining (a failed turn, a Stop, the quota), or `null`. */
|
|
703
|
+
paused: QueuePause | null;
|
|
704
|
+
/** The backend can queue (`enqueueMessage`). Without it sends made mid-turn are refused. */
|
|
705
|
+
isSupported: boolean;
|
|
706
|
+
/**
|
|
707
|
+
* Queue `text` (with already-uploaded `attachments`) on this chat's thread. `mode: 'interrupt'`
|
|
708
|
+
* cancels the running turn and runs it next. Starts at once when nothing is running.
|
|
709
|
+
*/
|
|
710
|
+
add: (text: string, options?: {
|
|
711
|
+
attachments?: MessageAttachment[];
|
|
712
|
+
mode?: 'queue' | 'interrupt';
|
|
713
|
+
}) => Promise<void>;
|
|
714
|
+
remove: (id: string) => Promise<void>;
|
|
715
|
+
/**
|
|
716
|
+
* Run a waiting message now: it moves to the head as an interrupt and the running turn is
|
|
717
|
+
* cancelled for it (with nothing running, it starts at once). One server call — the message keeps
|
|
718
|
+
* its id and never leaves the queue, unlike a `remove` followed by an `add`. Needs a backend with
|
|
719
|
+
* `interruptQueuedMessage`.
|
|
720
|
+
*/
|
|
721
|
+
interrupt: (id: string) => Promise<void>;
|
|
722
|
+
edit: (id: string, text: string) => Promise<void>;
|
|
723
|
+
/** Move a waiting message to `index` (0 → next). */
|
|
724
|
+
move: (id: string, index: number) => Promise<void>;
|
|
725
|
+
clear: () => Promise<void>;
|
|
726
|
+
/** Lift a pause; the head starts when nothing is running. */
|
|
727
|
+
resume: () => Promise<void>;
|
|
728
|
+
/** The last queue operation that failed, or `null`. */
|
|
729
|
+
error: Error | null;
|
|
730
|
+
}
|
|
731
|
+
|
|
648
732
|
interface StickToBottomOptions {
|
|
649
733
|
/**
|
|
650
734
|
* Changes whenever the rendered content grows — the signal to re-pin. A string rather than the
|
|
@@ -840,6 +924,47 @@ interface UseChatTranscriptOptions extends TranscriptItemOptions {
|
|
|
840
924
|
/** Suggested follow-ups. The model only decides WHETHER they belong on screen. */
|
|
841
925
|
followUps?: string[] | null;
|
|
842
926
|
stickToBottomThreshold?: number;
|
|
927
|
+
/**
|
|
928
|
+
* Messages waiting in the thread's queue — `chat.queue` (`useAgentChat` wires it). They render
|
|
929
|
+
* after the transcript as {@link ChatTranscript.queued}: pending user messages, not yet sent.
|
|
930
|
+
*/
|
|
931
|
+
queue?: {
|
|
932
|
+
/** `files` may be left out by a host that builds these itself: it is derived from `attachments`. */
|
|
933
|
+
items: Array<Omit<QueuedChatMessage, 'files'> & {
|
|
934
|
+
files?: MessageFile[];
|
|
935
|
+
}>;
|
|
936
|
+
paused: QueuePause | null;
|
|
937
|
+
remove?: (id: string) => void | Promise<void>;
|
|
938
|
+
} | null;
|
|
939
|
+
}
|
|
940
|
+
/** One file on a waiting message: a sent message's {@link MessageFile}, and a `TranscriptFile`. */
|
|
941
|
+
type TranscriptQueuedFile = MessageFile & TranscriptFile;
|
|
942
|
+
/**
|
|
943
|
+
* A message waiting in the thread's queue, as the transcript shows it: a user message that has not
|
|
944
|
+
* been sent to the model yet. Render it after {@link ChatTranscript.items}, dimmed or tagged.
|
|
945
|
+
*/
|
|
946
|
+
interface TranscriptQueuedItem {
|
|
947
|
+
id: string;
|
|
948
|
+
role: 'user';
|
|
949
|
+
text: string;
|
|
950
|
+
/**
|
|
951
|
+
* The message's files, in the shape a sent message's have: a {@link MessageFile} (what
|
|
952
|
+
* `messageFiles()` gives — `kind`, `extension`, `mediaId`) that is also a `TranscriptFile`
|
|
953
|
+
* (`isImage`), so either renderer takes it as it is.
|
|
954
|
+
*/
|
|
955
|
+
files: TranscriptQueuedFile[];
|
|
956
|
+
/**
|
|
957
|
+
* `'sending'` — on its way to the server. `'queued'` — waiting for the running turn.
|
|
958
|
+
* `'paused'` — waiting, but the queue is paused (see {@link ChatTranscript.queuePaused}).
|
|
959
|
+
*/
|
|
960
|
+
state: 'sending' | 'queued' | 'paused';
|
|
961
|
+
/** 0-based place in the queue. */
|
|
962
|
+
position: number;
|
|
963
|
+
/** Runs next. */
|
|
964
|
+
isNext: boolean;
|
|
965
|
+
/** Queued by an interrupt — it runs as soon as the cancelled turn settles. */
|
|
966
|
+
interrupt: boolean;
|
|
967
|
+
remove: TranscriptActionState;
|
|
843
968
|
}
|
|
844
969
|
interface ChatTranscript {
|
|
845
970
|
/** The mounted window, oldest first. `window.hiddenCount` says what is held back. */
|
|
@@ -857,6 +982,10 @@ interface ChatTranscript {
|
|
|
857
982
|
window: TranscriptWindow;
|
|
858
983
|
scroll: StickToBottom;
|
|
859
984
|
stop: TranscriptStopState;
|
|
985
|
+
/** Messages waiting in the thread's queue, in run order — render after `items`. */
|
|
986
|
+
queued: TranscriptQueuedItem[];
|
|
987
|
+
/** Why the queue is not draining, or `null`. */
|
|
988
|
+
queuePaused: QueuePause | null;
|
|
860
989
|
}
|
|
861
990
|
/**
|
|
862
991
|
* The model behind a chat transcript: messages normalized into items with their parts grouped into
|
|
@@ -980,6 +1109,14 @@ interface MessageListClassNames {
|
|
|
980
1109
|
errorRetry?: string;
|
|
981
1110
|
followUps?: string;
|
|
982
1111
|
followUpChip?: string;
|
|
1112
|
+
/** The block of waiting (queued) messages after the transcript. */
|
|
1113
|
+
queue?: string;
|
|
1114
|
+
/** One waiting message; it also carries `data-state="sending|queued|paused"`. */
|
|
1115
|
+
queuedItem?: string;
|
|
1116
|
+
queuedRemove?: string;
|
|
1117
|
+
/** The "queue paused" line and its resume button. */
|
|
1118
|
+
queuePaused?: string;
|
|
1119
|
+
queueResume?: string;
|
|
983
1120
|
message?: MessageItemClassNames;
|
|
984
1121
|
}
|
|
985
1122
|
interface MessageListProps {
|
|
@@ -1023,6 +1160,11 @@ interface MessageListProps {
|
|
|
1023
1160
|
/** Last turn's error — paired with `onRetry`, renders a retry banner. */
|
|
1024
1161
|
error?: Error | null;
|
|
1025
1162
|
onRetry?: () => void | Promise<void>;
|
|
1163
|
+
/**
|
|
1164
|
+
* `chat.queue` — messages sent while a turn was running, drawn after the transcript as pending
|
|
1165
|
+
* user messages (with a remove button), and a resume button while the queue is paused.
|
|
1166
|
+
*/
|
|
1167
|
+
queue?: ChatQueue;
|
|
1026
1168
|
classNames?: MessageListClassNames;
|
|
1027
1169
|
}
|
|
1028
1170
|
/**
|
|
@@ -1034,7 +1176,7 @@ interface MessageListProps {
|
|
|
1034
1176
|
* Every decision here comes from `useChatTranscript`; the file below it is markup. A host that
|
|
1035
1177
|
* wants a different layout drives that hook directly and never imports this component.
|
|
1036
1178
|
*/
|
|
1037
|
-
declare function MessageList({ messages, status, renderToolPart, renderToolGroup, renderText, renderReasoning, renderFiles, renderUi, reasoningLabel, getMeta, readOnly, onFork, editable, onEditSubmit, regeneratable, onRegenerate, getUsage, getCreatedAt, emptyState, typingIndicator, followUps, onFollowUpClick, error, onRetry, classNames, }: MessageListProps): React__default.JSX.Element;
|
|
1179
|
+
declare function MessageList({ messages, status, renderToolPart, renderToolGroup, renderText, renderReasoning, renderFiles, renderUi, reasoningLabel, getMeta, readOnly, onFork, editable, onEditSubmit, regeneratable, onRegenerate, getUsage, getCreatedAt, emptyState, typingIndicator, followUps, onFollowUpClick, error, onRetry, queue, classNames, }: MessageListProps): React__default.JSX.Element;
|
|
1038
1180
|
|
|
1039
1181
|
/**
|
|
1040
1182
|
* Languages the dictation mic offers. The Web Speech API expects a
|
|
@@ -1482,6 +1624,15 @@ interface UseAgentChatOptions<B extends AgentBackend = AgentBackend> {
|
|
|
1482
1624
|
blocked?: QuotaBlock | null;
|
|
1483
1625
|
/** Validation and upload for `chat.composer.files` — see `useAttachments`. */
|
|
1484
1626
|
composer?: Omit<UseAttachmentsOptions, 'backend'>;
|
|
1627
|
+
/**
|
|
1628
|
+
* What `composer.submit()` and `sendMessage` do while a turn is still running. Default `'queue'`:
|
|
1629
|
+
* the message waits in the thread's queue (server-side — it survives a reload) and runs when the
|
|
1630
|
+
* turn settles; `chat.queue` lists and edits what is waiting. `'interrupt'` cancels the running
|
|
1631
|
+
* turn and runs the message next. `'block'` refuses the send (`composer.blockedBy === 'busy'`).
|
|
1632
|
+
* A backend without `enqueueMessage` behaves as `'block'`. One send can answer differently:
|
|
1633
|
+
* `composer.submit({ mode })`, `sendMessage(message, { mode })`.
|
|
1634
|
+
*/
|
|
1635
|
+
whileRunning?: WhileRunning;
|
|
1485
1636
|
/**
|
|
1486
1637
|
* Overrides for `chat.transcript` — anything `useChatTranscript` takes (`sources`, `editable` +
|
|
1487
1638
|
* `onEditSubmit`, `followUps`, `getUsage`, a `toolCatalog` of your own, `onApprove: null`, …).
|
|
@@ -1591,8 +1742,14 @@ interface ChatComposer {
|
|
|
1591
1742
|
canSend: boolean;
|
|
1592
1743
|
/** Why `canSend` is false, or `null`. */
|
|
1593
1744
|
blockedBy: ComposerBlock | null;
|
|
1594
|
-
/**
|
|
1595
|
-
|
|
1745
|
+
/**
|
|
1746
|
+
* Send the draft with the ready files attached, then clear both. A no-op while blocked.
|
|
1747
|
+
*
|
|
1748
|
+
* `submit({ mode })` says what to do if a turn is running, for this send only — `'interrupt'`
|
|
1749
|
+
* for a "send now" button next to a plain send that queues. It overrides `whileRunning`
|
|
1750
|
+
* (`'block'` included) and clears the draft like any other submit.
|
|
1751
|
+
*/
|
|
1752
|
+
submit: (options?: SendWhileRunning) => Promise<void>;
|
|
1596
1753
|
}
|
|
1597
1754
|
interface AddToolResultArgs {
|
|
1598
1755
|
tool: string;
|
|
@@ -1610,7 +1767,25 @@ declare function useAgentChat<B extends AgentBackend = AgentBackend>(options?: U
|
|
|
1610
1767
|
status: ChatStatus;
|
|
1611
1768
|
/** Where the live stream stands — see {@link StreamConnectionState}. */
|
|
1612
1769
|
connection: StreamConnectionState;
|
|
1613
|
-
sendMessage: (message?: (Omit<UIMessage<unknown, UIDataTypes, ai.UITools>, "id" | "role"> & {
|
|
1770
|
+
sendMessage: (message?: Parameters<(message?: (Omit<UIMessage<unknown, UIDataTypes, ai.UITools>, "id" | "role"> & {
|
|
1771
|
+
id?: string;
|
|
1772
|
+
role?: "user" | "assistant" | "system";
|
|
1773
|
+
} & {
|
|
1774
|
+
text?: never;
|
|
1775
|
+
files?: never;
|
|
1776
|
+
messageId?: string;
|
|
1777
|
+
}) | {
|
|
1778
|
+
text: string;
|
|
1779
|
+
files?: FileList | ai.FileUIPart[];
|
|
1780
|
+
metadata?: unknown;
|
|
1781
|
+
parts?: never;
|
|
1782
|
+
messageId?: string;
|
|
1783
|
+
} | {
|
|
1784
|
+
files: FileList | ai.FileUIPart[];
|
|
1785
|
+
metadata?: unknown;
|
|
1786
|
+
parts?: never;
|
|
1787
|
+
messageId?: string;
|
|
1788
|
+
} | undefined, options?: ai.ChatRequestOptions) => Promise<void>>[0], options?: Parameters<(message?: (Omit<UIMessage<unknown, UIDataTypes, ai.UITools>, "id" | "role"> & {
|
|
1614
1789
|
id?: string;
|
|
1615
1790
|
role?: "user" | "assistant" | "system";
|
|
1616
1791
|
} & {
|
|
@@ -1628,7 +1803,7 @@ declare function useAgentChat<B extends AgentBackend = AgentBackend>(options?: U
|
|
|
1628
1803
|
metadata?: unknown;
|
|
1629
1804
|
parts?: never;
|
|
1630
1805
|
messageId?: string;
|
|
1631
|
-
} | undefined, options?: ai.ChatRequestOptions) => Promise<void>;
|
|
1806
|
+
} | undefined, options?: ai.ChatRequestOptions) => Promise<void>>[1] & SendWhileRunning) => Promise<void>;
|
|
1632
1807
|
addToolResult: ({ tool, toolCallId, output }: AddToolResultArgs) => void | PromiseLike<void>;
|
|
1633
1808
|
/** Sub-agents this conversation started and did not wait for. */
|
|
1634
1809
|
background: ChatBackground;
|
|
@@ -1650,6 +1825,11 @@ declare function useAgentChat<B extends AgentBackend = AgentBackend>(options?: U
|
|
|
1650
1825
|
transcript: ChatTranscript;
|
|
1651
1826
|
/** A headless composer: draft, files, send gate, `submit()`. */
|
|
1652
1827
|
composer: ChatComposer;
|
|
1828
|
+
/**
|
|
1829
|
+
* Messages sent while a turn was running, waiting their turn (server-side): list, edit, move,
|
|
1830
|
+
* remove, clear, and resume a paused queue.
|
|
1831
|
+
*/
|
|
1832
|
+
queue: ChatQueue;
|
|
1653
1833
|
/** The model picker: `list`, `selected`, `select(id)`, `pinToThread(id)`. */
|
|
1654
1834
|
models: ChatModels;
|
|
1655
1835
|
/** The caller's budget (`GET <base>/quota`); `quota.blocked` gates sends. */
|
|
@@ -1687,4 +1867,4 @@ declare class QuotaBlockedError extends Error {
|
|
|
1687
1867
|
constructor(block: QuotaBlock);
|
|
1688
1868
|
}
|
|
1689
1869
|
|
|
1690
|
-
export { AgentBackend, AgentChatTransport, type AgentChatTransportOptions, type AgentConfigState, 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, HttpErrorListener, 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 UseAgentConfigOptions, 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, useAgentConfig, useAgents, useAmbientRenderUi, useApprovalCountdown, useAttachments, useChatTranscript, useComposerAutocomplete, useElapsed, useMessageFeedback, useModels, useQuota, useSpeechRecognition, useStickToBottom, useThreads, useToolCatalog, useTranscriptItem };
|
|
1870
|
+
export { AgentBackend, AgentChatTransport, type AgentChatTransportOptions, type AgentConfigState, 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, type ChatQueue, ChatStatus, type ChatTranscript, type ClipboardLikeEvent, type CompletionEdit, type ComposerAutocomplete, DEFAULT_SPEECH_LANG, type DragLikeEvent, type EditSubmitInput, HttpErrorListener, 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, type QueuedChatMessage, QuotaBlockedError, type QuotaState, type ReconnectOptions, type RejectInput, type RenderFilesFn, type RenderReasoningFn, type RenderTextFn, type RenderToolGroupFn, type RenderToolPartFn, type RenderUiFn, SPEECH_LANGUAGES, type SendWhileRunning, 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 TranscriptQueuedFile, type TranscriptQueuedItem, type TranscriptStopState, TranscriptUiBlock, type TranscriptWindow, type TriggerMatch, type TriggerPosition, UploadAttachmentOptions, UsageSummary, type UseAgentChatOptions, type UseAgentConfigOptions, 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, type WhileRunning, acceptsFile, applyCompletion, approvalCountdown, attachmentFile, backgroundRunsFromThread, createSkillsSource, dragHasFiles, fileKind, filesFromClipboard, filterAutocompleteItems, findActiveTrigger, formatElapsed, loadStoredSpeechLang, messageFiles, notifyThreads, onThreadsEvent, persistSpeechLang, readReasoningMs, storedMessageToUiMessage, storedThreadToUiMessages, useAgentBackend, useAgentChat, useAgentConfig, useAgents, useAmbientRenderUi, useApprovalCountdown, useAttachments, useChatTranscript, useComposerAutocomplete, useElapsed, useMessageFeedback, useModels, useQuota, useSpeechRecognition, useStickToBottom, useThreads, useToolCatalog, useTranscriptItem };
|