@dudousxd/nestjs-agent-react 0.25.0 → 0.27.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 +53 -6
- package/dist/{client-D4ZSbZJ8.d.cts → client-DNM5Qm5N.d.cts} +70 -2
- package/dist/{client-D4ZSbZJ8.d.ts → client-DNM5Qm5N.d.ts} +70 -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.d.cts +1 -1
- package/dist/genui-json-render.d.ts +1 -1
- package/dist/genui.d.cts +2 -2
- package/dist/genui.d.ts +2 -2
- package/dist/index.cjs +572 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +147 -10
- package/dist/index.d.ts +147 -10
- package/dist/index.js +569 -37
- package/dist/index.js.map +1 -1
- 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.map +1 -1
- package/package.json +2 -2
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, 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 { 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-DNM5Qm5N.cjs';
|
|
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-DNM5Qm5N.cjs';
|
|
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.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-jT9TYfCi.cjs';
|
|
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`.
|
|
@@ -645,6 +653,55 @@ interface ChatInputProps {
|
|
|
645
653
|
*/
|
|
646
654
|
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
655
|
|
|
656
|
+
/**
|
|
657
|
+
* What the composer (and `sendMessage`) does with a message sent while a turn is still running:
|
|
658
|
+
* - `'queue'` (default) — it waits in the thread's queue and runs when the turn settles.
|
|
659
|
+
* - `'interrupt'` — the running turn is cancelled and this message runs next.
|
|
660
|
+
* - `'block'` — the composer refuses it (`blockedBy: 'busy'`), as before queues existed.
|
|
661
|
+
*/
|
|
662
|
+
type WhileRunning = 'queue' | 'interrupt' | 'block';
|
|
663
|
+
/** A message waiting in the thread's queue, as the chat shows it. */
|
|
664
|
+
interface QueuedChatMessage {
|
|
665
|
+
/** The server's id once it is queued; a local id while `state` is `'sending'`. */
|
|
666
|
+
id: string;
|
|
667
|
+
text: string;
|
|
668
|
+
attachments: MessageAttachment[];
|
|
669
|
+
/**
|
|
670
|
+
* `'sending'` — on its way to the server (it has no server id yet, so it cannot be edited).
|
|
671
|
+
* `'queued'` — waiting its turn.
|
|
672
|
+
*/
|
|
673
|
+
state: 'sending' | 'queued';
|
|
674
|
+
/** Queued by an interrupt: it runs as soon as the cancelled turn settles. */
|
|
675
|
+
interrupt: boolean;
|
|
676
|
+
createdAt: string;
|
|
677
|
+
}
|
|
678
|
+
/** `chat.queue` — the thread's queue of waiting messages, and what can be done to it. */
|
|
679
|
+
interface ChatQueue {
|
|
680
|
+
/** Waiting messages, in the order they will run. */
|
|
681
|
+
items: QueuedChatMessage[];
|
|
682
|
+
/** Why the queue stopped draining (a failed turn, a Stop, the quota), or `null`. */
|
|
683
|
+
paused: QueuePause | null;
|
|
684
|
+
/** The backend can queue (`enqueueMessage`). Without it sends made mid-turn are refused. */
|
|
685
|
+
isSupported: boolean;
|
|
686
|
+
/**
|
|
687
|
+
* Queue `text` (with already-uploaded `attachments`) on this chat's thread. `mode: 'interrupt'`
|
|
688
|
+
* cancels the running turn and runs it next. Starts at once when nothing is running.
|
|
689
|
+
*/
|
|
690
|
+
add: (text: string, options?: {
|
|
691
|
+
attachments?: MessageAttachment[];
|
|
692
|
+
mode?: 'queue' | 'interrupt';
|
|
693
|
+
}) => Promise<void>;
|
|
694
|
+
remove: (id: string) => Promise<void>;
|
|
695
|
+
edit: (id: string, text: string) => Promise<void>;
|
|
696
|
+
/** Move a waiting message to `index` (0 → next). */
|
|
697
|
+
move: (id: string, index: number) => Promise<void>;
|
|
698
|
+
clear: () => Promise<void>;
|
|
699
|
+
/** Lift a pause; the head starts when nothing is running. */
|
|
700
|
+
resume: () => Promise<void>;
|
|
701
|
+
/** The last queue operation that failed, or `null`. */
|
|
702
|
+
error: Error | null;
|
|
703
|
+
}
|
|
704
|
+
|
|
648
705
|
interface StickToBottomOptions {
|
|
649
706
|
/**
|
|
650
707
|
* Changes whenever the rendered content grows — the signal to re-pin. A string rather than the
|
|
@@ -761,6 +818,16 @@ interface RejectInput {
|
|
|
761
818
|
via?: string;
|
|
762
819
|
}
|
|
763
820
|
interface TranscriptItemOptions {
|
|
821
|
+
/**
|
|
822
|
+
* A transcript nobody acts on (an audit view, a shared or archived conversation): no approve /
|
|
823
|
+
* reject, answer / skip, edit, fork, regenerate or stop — whatever handlers or backend are in
|
|
824
|
+
* scope. Parked approvals and question sets still render, with their actions unavailable.
|
|
825
|
+
*
|
|
826
|
+
* Without it the decision handlers DEFAULT to the in-scope backend (`<AgentProvider>`'s), so a
|
|
827
|
+
* parked call is actionable with no wiring; a read-only surface would otherwise have to pass
|
|
828
|
+
* `onApprove: null`, `onReject: null`, `onAnswer: null` and `onSkip: null` one by one.
|
|
829
|
+
*/
|
|
830
|
+
readOnly?: boolean;
|
|
764
831
|
/** User messages get an inline edit-and-resubmit machine. */
|
|
765
832
|
editable?: boolean;
|
|
766
833
|
onEditSubmit?: (input: EditSubmitInput) => void | Promise<void>;
|
|
@@ -830,6 +897,37 @@ interface UseChatTranscriptOptions extends TranscriptItemOptions {
|
|
|
830
897
|
/** Suggested follow-ups. The model only decides WHETHER they belong on screen. */
|
|
831
898
|
followUps?: string[] | null;
|
|
832
899
|
stickToBottomThreshold?: number;
|
|
900
|
+
/**
|
|
901
|
+
* Messages waiting in the thread's queue — `chat.queue` (`useAgentChat` wires it). They render
|
|
902
|
+
* after the transcript as {@link ChatTranscript.queued}: pending user messages, not yet sent.
|
|
903
|
+
*/
|
|
904
|
+
queue?: {
|
|
905
|
+
items: QueuedChatMessage[];
|
|
906
|
+
paused: QueuePause | null;
|
|
907
|
+
remove?: (id: string) => void | Promise<void>;
|
|
908
|
+
} | null;
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* A message waiting in the thread's queue, as the transcript shows it: a user message that has not
|
|
912
|
+
* been sent to the model yet. Render it after {@link ChatTranscript.items}, dimmed or tagged.
|
|
913
|
+
*/
|
|
914
|
+
interface TranscriptQueuedItem {
|
|
915
|
+
id: string;
|
|
916
|
+
role: 'user';
|
|
917
|
+
text: string;
|
|
918
|
+
files: TranscriptFile[];
|
|
919
|
+
/**
|
|
920
|
+
* `'sending'` — on its way to the server. `'queued'` — waiting for the running turn.
|
|
921
|
+
* `'paused'` — waiting, but the queue is paused (see {@link ChatTranscript.queuePaused}).
|
|
922
|
+
*/
|
|
923
|
+
state: 'sending' | 'queued' | 'paused';
|
|
924
|
+
/** 0-based place in the queue. */
|
|
925
|
+
position: number;
|
|
926
|
+
/** Runs next. */
|
|
927
|
+
isNext: boolean;
|
|
928
|
+
/** Queued by an interrupt — it runs as soon as the cancelled turn settles. */
|
|
929
|
+
interrupt: boolean;
|
|
930
|
+
remove: TranscriptActionState;
|
|
833
931
|
}
|
|
834
932
|
interface ChatTranscript {
|
|
835
933
|
/** The mounted window, oldest first. `window.hiddenCount` says what is held back. */
|
|
@@ -847,6 +945,10 @@ interface ChatTranscript {
|
|
|
847
945
|
window: TranscriptWindow;
|
|
848
946
|
scroll: StickToBottom;
|
|
849
947
|
stop: TranscriptStopState;
|
|
948
|
+
/** Messages waiting in the thread's queue, in run order — render after `items`. */
|
|
949
|
+
queued: TranscriptQueuedItem[];
|
|
950
|
+
/** Why the queue is not draining, or `null`. */
|
|
951
|
+
queuePaused: QueuePause | null;
|
|
850
952
|
}
|
|
851
953
|
/**
|
|
852
954
|
* The model behind a chat transcript: messages normalized into items with their parts grouped into
|
|
@@ -970,6 +1072,14 @@ interface MessageListClassNames {
|
|
|
970
1072
|
errorRetry?: string;
|
|
971
1073
|
followUps?: string;
|
|
972
1074
|
followUpChip?: string;
|
|
1075
|
+
/** The block of waiting (queued) messages after the transcript. */
|
|
1076
|
+
queue?: string;
|
|
1077
|
+
/** One waiting message; it also carries `data-state="sending|queued|paused"`. */
|
|
1078
|
+
queuedItem?: string;
|
|
1079
|
+
queuedRemove?: string;
|
|
1080
|
+
/** The "queue paused" line and its resume button. */
|
|
1081
|
+
queuePaused?: string;
|
|
1082
|
+
queueResume?: string;
|
|
973
1083
|
message?: MessageItemClassNames;
|
|
974
1084
|
}
|
|
975
1085
|
interface MessageListProps {
|
|
@@ -987,6 +1097,11 @@ interface MessageListProps {
|
|
|
987
1097
|
reasoningLabel?: React__default.ReactNode;
|
|
988
1098
|
/** Extra content for one message's action row — e.g. a badge naming which agent answered. */
|
|
989
1099
|
getMeta?: (message: UIMessage) => React__default.ReactNode;
|
|
1100
|
+
/**
|
|
1101
|
+
* Nobody acts on this list (an audit or shared view): parked approvals and question sets render
|
|
1102
|
+
* without their actions, and no fork / edit / regenerate — see `useChatTranscript({ readOnly })`.
|
|
1103
|
+
*/
|
|
1104
|
+
readOnly?: boolean;
|
|
990
1105
|
/** When set, every message gets a "Fork" affordance calling back with its id. */
|
|
991
1106
|
onFork?: (input: MessageActionInput) => void | Promise<void>;
|
|
992
1107
|
/** User messages get an inline edit-and-resubmit affordance. */
|
|
@@ -1008,6 +1123,11 @@ interface MessageListProps {
|
|
|
1008
1123
|
/** Last turn's error — paired with `onRetry`, renders a retry banner. */
|
|
1009
1124
|
error?: Error | null;
|
|
1010
1125
|
onRetry?: () => void | Promise<void>;
|
|
1126
|
+
/**
|
|
1127
|
+
* `chat.queue` — messages sent while a turn was running, drawn after the transcript as pending
|
|
1128
|
+
* user messages (with a remove button), and a resume button while the queue is paused.
|
|
1129
|
+
*/
|
|
1130
|
+
queue?: ChatQueue;
|
|
1011
1131
|
classNames?: MessageListClassNames;
|
|
1012
1132
|
}
|
|
1013
1133
|
/**
|
|
@@ -1019,7 +1139,7 @@ interface MessageListProps {
|
|
|
1019
1139
|
* Every decision here comes from `useChatTranscript`; the file below it is markup. A host that
|
|
1020
1140
|
* wants a different layout drives that hook directly and never imports this component.
|
|
1021
1141
|
*/
|
|
1022
|
-
declare function MessageList({ messages, status, renderToolPart, renderToolGroup, renderText, renderReasoning, renderFiles, renderUi, reasoningLabel, getMeta, onFork, editable, onEditSubmit, regeneratable, onRegenerate, getUsage, getCreatedAt, emptyState, typingIndicator, followUps, onFollowUpClick, error, onRetry, classNames, }: MessageListProps): React__default.JSX.Element;
|
|
1142
|
+
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;
|
|
1023
1143
|
|
|
1024
1144
|
/**
|
|
1025
1145
|
* Languages the dictation mic offers. The Web Speech API expects a
|
|
@@ -1256,7 +1376,11 @@ interface UseToolCatalogOptions {
|
|
|
1256
1376
|
* (the shared copy is keyed by it): a backend constructed inline refetches every render.
|
|
1257
1377
|
*/
|
|
1258
1378
|
backend?: ToolsBackend;
|
|
1259
|
-
/**
|
|
1379
|
+
/**
|
|
1380
|
+
* The agent whose tools to list. Omitted → the server's default agent. {@link ALL_AGENTS} (`'*'`)
|
|
1381
|
+
* → every tool the actor reaches through any agent, each once — for an app with several agents
|
|
1382
|
+
* whose conversations one surface shows.
|
|
1383
|
+
*/
|
|
1260
1384
|
agent?: string;
|
|
1261
1385
|
/** `false` holds the request (e.g. until the user is signed in). Default `true`. */
|
|
1262
1386
|
enabled?: boolean;
|
|
@@ -1463,6 +1587,14 @@ interface UseAgentChatOptions<B extends AgentBackend = AgentBackend> {
|
|
|
1463
1587
|
blocked?: QuotaBlock | null;
|
|
1464
1588
|
/** Validation and upload for `chat.composer.files` — see `useAttachments`. */
|
|
1465
1589
|
composer?: Omit<UseAttachmentsOptions, 'backend'>;
|
|
1590
|
+
/**
|
|
1591
|
+
* What `composer.submit()` and `sendMessage` do while a turn is still running. Default `'queue'`:
|
|
1592
|
+
* the message waits in the thread's queue (server-side — it survives a reload) and runs when the
|
|
1593
|
+
* turn settles; `chat.queue` lists and edits what is waiting. `'interrupt'` cancels the running
|
|
1594
|
+
* turn and runs the message next. `'block'` refuses the send (`composer.blockedBy === 'busy'`).
|
|
1595
|
+
* A backend without `enqueueMessage` behaves as `'block'`.
|
|
1596
|
+
*/
|
|
1597
|
+
whileRunning?: WhileRunning;
|
|
1466
1598
|
/**
|
|
1467
1599
|
* Overrides for `chat.transcript` — anything `useChatTranscript` takes (`sources`, `editable` +
|
|
1468
1600
|
* `onEditSubmit`, `followUps`, `getUsage`, a `toolCatalog` of your own, `onApprove: null`, …).
|
|
@@ -1631,6 +1763,11 @@ declare function useAgentChat<B extends AgentBackend = AgentBackend>(options?: U
|
|
|
1631
1763
|
transcript: ChatTranscript;
|
|
1632
1764
|
/** A headless composer: draft, files, send gate, `submit()`. */
|
|
1633
1765
|
composer: ChatComposer;
|
|
1766
|
+
/**
|
|
1767
|
+
* Messages sent while a turn was running, waiting their turn (server-side): list, edit, move,
|
|
1768
|
+
* remove, clear, and resume a paused queue.
|
|
1769
|
+
*/
|
|
1770
|
+
queue: ChatQueue;
|
|
1634
1771
|
/** The model picker: `list`, `selected`, `select(id)`, `pinToThread(id)`. */
|
|
1635
1772
|
models: ChatModels;
|
|
1636
1773
|
/** The caller's budget (`GET <base>/quota`); `quota.blocked` gates sends. */
|
|
@@ -1668,4 +1805,4 @@ declare class QuotaBlockedError extends Error {
|
|
|
1668
1805
|
constructor(block: QuotaBlock);
|
|
1669
1806
|
}
|
|
1670
1807
|
|
|
1671
|
-
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 };
|
|
1808
|
+
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 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 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, 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 };
|
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 { 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-DNM5Qm5N.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-DNM5Qm5N.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`.
|
|
@@ -645,6 +653,55 @@ interface ChatInputProps {
|
|
|
645
653
|
*/
|
|
646
654
|
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
655
|
|
|
656
|
+
/**
|
|
657
|
+
* What the composer (and `sendMessage`) does with a message sent while a turn is still running:
|
|
658
|
+
* - `'queue'` (default) — it waits in the thread's queue and runs when the turn settles.
|
|
659
|
+
* - `'interrupt'` — the running turn is cancelled and this message runs next.
|
|
660
|
+
* - `'block'` — the composer refuses it (`blockedBy: 'busy'`), as before queues existed.
|
|
661
|
+
*/
|
|
662
|
+
type WhileRunning = 'queue' | 'interrupt' | 'block';
|
|
663
|
+
/** A message waiting in the thread's queue, as the chat shows it. */
|
|
664
|
+
interface QueuedChatMessage {
|
|
665
|
+
/** The server's id once it is queued; a local id while `state` is `'sending'`. */
|
|
666
|
+
id: string;
|
|
667
|
+
text: string;
|
|
668
|
+
attachments: MessageAttachment[];
|
|
669
|
+
/**
|
|
670
|
+
* `'sending'` — on its way to the server (it has no server id yet, so it cannot be edited).
|
|
671
|
+
* `'queued'` — waiting its turn.
|
|
672
|
+
*/
|
|
673
|
+
state: 'sending' | 'queued';
|
|
674
|
+
/** Queued by an interrupt: it runs as soon as the cancelled turn settles. */
|
|
675
|
+
interrupt: boolean;
|
|
676
|
+
createdAt: string;
|
|
677
|
+
}
|
|
678
|
+
/** `chat.queue` — the thread's queue of waiting messages, and what can be done to it. */
|
|
679
|
+
interface ChatQueue {
|
|
680
|
+
/** Waiting messages, in the order they will run. */
|
|
681
|
+
items: QueuedChatMessage[];
|
|
682
|
+
/** Why the queue stopped draining (a failed turn, a Stop, the quota), or `null`. */
|
|
683
|
+
paused: QueuePause | null;
|
|
684
|
+
/** The backend can queue (`enqueueMessage`). Without it sends made mid-turn are refused. */
|
|
685
|
+
isSupported: boolean;
|
|
686
|
+
/**
|
|
687
|
+
* Queue `text` (with already-uploaded `attachments`) on this chat's thread. `mode: 'interrupt'`
|
|
688
|
+
* cancels the running turn and runs it next. Starts at once when nothing is running.
|
|
689
|
+
*/
|
|
690
|
+
add: (text: string, options?: {
|
|
691
|
+
attachments?: MessageAttachment[];
|
|
692
|
+
mode?: 'queue' | 'interrupt';
|
|
693
|
+
}) => Promise<void>;
|
|
694
|
+
remove: (id: string) => Promise<void>;
|
|
695
|
+
edit: (id: string, text: string) => Promise<void>;
|
|
696
|
+
/** Move a waiting message to `index` (0 → next). */
|
|
697
|
+
move: (id: string, index: number) => Promise<void>;
|
|
698
|
+
clear: () => Promise<void>;
|
|
699
|
+
/** Lift a pause; the head starts when nothing is running. */
|
|
700
|
+
resume: () => Promise<void>;
|
|
701
|
+
/** The last queue operation that failed, or `null`. */
|
|
702
|
+
error: Error | null;
|
|
703
|
+
}
|
|
704
|
+
|
|
648
705
|
interface StickToBottomOptions {
|
|
649
706
|
/**
|
|
650
707
|
* Changes whenever the rendered content grows — the signal to re-pin. A string rather than the
|
|
@@ -761,6 +818,16 @@ interface RejectInput {
|
|
|
761
818
|
via?: string;
|
|
762
819
|
}
|
|
763
820
|
interface TranscriptItemOptions {
|
|
821
|
+
/**
|
|
822
|
+
* A transcript nobody acts on (an audit view, a shared or archived conversation): no approve /
|
|
823
|
+
* reject, answer / skip, edit, fork, regenerate or stop — whatever handlers or backend are in
|
|
824
|
+
* scope. Parked approvals and question sets still render, with their actions unavailable.
|
|
825
|
+
*
|
|
826
|
+
* Without it the decision handlers DEFAULT to the in-scope backend (`<AgentProvider>`'s), so a
|
|
827
|
+
* parked call is actionable with no wiring; a read-only surface would otherwise have to pass
|
|
828
|
+
* `onApprove: null`, `onReject: null`, `onAnswer: null` and `onSkip: null` one by one.
|
|
829
|
+
*/
|
|
830
|
+
readOnly?: boolean;
|
|
764
831
|
/** User messages get an inline edit-and-resubmit machine. */
|
|
765
832
|
editable?: boolean;
|
|
766
833
|
onEditSubmit?: (input: EditSubmitInput) => void | Promise<void>;
|
|
@@ -830,6 +897,37 @@ interface UseChatTranscriptOptions extends TranscriptItemOptions {
|
|
|
830
897
|
/** Suggested follow-ups. The model only decides WHETHER they belong on screen. */
|
|
831
898
|
followUps?: string[] | null;
|
|
832
899
|
stickToBottomThreshold?: number;
|
|
900
|
+
/**
|
|
901
|
+
* Messages waiting in the thread's queue — `chat.queue` (`useAgentChat` wires it). They render
|
|
902
|
+
* after the transcript as {@link ChatTranscript.queued}: pending user messages, not yet sent.
|
|
903
|
+
*/
|
|
904
|
+
queue?: {
|
|
905
|
+
items: QueuedChatMessage[];
|
|
906
|
+
paused: QueuePause | null;
|
|
907
|
+
remove?: (id: string) => void | Promise<void>;
|
|
908
|
+
} | null;
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* A message waiting in the thread's queue, as the transcript shows it: a user message that has not
|
|
912
|
+
* been sent to the model yet. Render it after {@link ChatTranscript.items}, dimmed or tagged.
|
|
913
|
+
*/
|
|
914
|
+
interface TranscriptQueuedItem {
|
|
915
|
+
id: string;
|
|
916
|
+
role: 'user';
|
|
917
|
+
text: string;
|
|
918
|
+
files: TranscriptFile[];
|
|
919
|
+
/**
|
|
920
|
+
* `'sending'` — on its way to the server. `'queued'` — waiting for the running turn.
|
|
921
|
+
* `'paused'` — waiting, but the queue is paused (see {@link ChatTranscript.queuePaused}).
|
|
922
|
+
*/
|
|
923
|
+
state: 'sending' | 'queued' | 'paused';
|
|
924
|
+
/** 0-based place in the queue. */
|
|
925
|
+
position: number;
|
|
926
|
+
/** Runs next. */
|
|
927
|
+
isNext: boolean;
|
|
928
|
+
/** Queued by an interrupt — it runs as soon as the cancelled turn settles. */
|
|
929
|
+
interrupt: boolean;
|
|
930
|
+
remove: TranscriptActionState;
|
|
833
931
|
}
|
|
834
932
|
interface ChatTranscript {
|
|
835
933
|
/** The mounted window, oldest first. `window.hiddenCount` says what is held back. */
|
|
@@ -847,6 +945,10 @@ interface ChatTranscript {
|
|
|
847
945
|
window: TranscriptWindow;
|
|
848
946
|
scroll: StickToBottom;
|
|
849
947
|
stop: TranscriptStopState;
|
|
948
|
+
/** Messages waiting in the thread's queue, in run order — render after `items`. */
|
|
949
|
+
queued: TranscriptQueuedItem[];
|
|
950
|
+
/** Why the queue is not draining, or `null`. */
|
|
951
|
+
queuePaused: QueuePause | null;
|
|
850
952
|
}
|
|
851
953
|
/**
|
|
852
954
|
* The model behind a chat transcript: messages normalized into items with their parts grouped into
|
|
@@ -970,6 +1072,14 @@ interface MessageListClassNames {
|
|
|
970
1072
|
errorRetry?: string;
|
|
971
1073
|
followUps?: string;
|
|
972
1074
|
followUpChip?: string;
|
|
1075
|
+
/** The block of waiting (queued) messages after the transcript. */
|
|
1076
|
+
queue?: string;
|
|
1077
|
+
/** One waiting message; it also carries `data-state="sending|queued|paused"`. */
|
|
1078
|
+
queuedItem?: string;
|
|
1079
|
+
queuedRemove?: string;
|
|
1080
|
+
/** The "queue paused" line and its resume button. */
|
|
1081
|
+
queuePaused?: string;
|
|
1082
|
+
queueResume?: string;
|
|
973
1083
|
message?: MessageItemClassNames;
|
|
974
1084
|
}
|
|
975
1085
|
interface MessageListProps {
|
|
@@ -987,6 +1097,11 @@ interface MessageListProps {
|
|
|
987
1097
|
reasoningLabel?: React__default.ReactNode;
|
|
988
1098
|
/** Extra content for one message's action row — e.g. a badge naming which agent answered. */
|
|
989
1099
|
getMeta?: (message: UIMessage) => React__default.ReactNode;
|
|
1100
|
+
/**
|
|
1101
|
+
* Nobody acts on this list (an audit or shared view): parked approvals and question sets render
|
|
1102
|
+
* without their actions, and no fork / edit / regenerate — see `useChatTranscript({ readOnly })`.
|
|
1103
|
+
*/
|
|
1104
|
+
readOnly?: boolean;
|
|
990
1105
|
/** When set, every message gets a "Fork" affordance calling back with its id. */
|
|
991
1106
|
onFork?: (input: MessageActionInput) => void | Promise<void>;
|
|
992
1107
|
/** User messages get an inline edit-and-resubmit affordance. */
|
|
@@ -1008,6 +1123,11 @@ interface MessageListProps {
|
|
|
1008
1123
|
/** Last turn's error — paired with `onRetry`, renders a retry banner. */
|
|
1009
1124
|
error?: Error | null;
|
|
1010
1125
|
onRetry?: () => void | Promise<void>;
|
|
1126
|
+
/**
|
|
1127
|
+
* `chat.queue` — messages sent while a turn was running, drawn after the transcript as pending
|
|
1128
|
+
* user messages (with a remove button), and a resume button while the queue is paused.
|
|
1129
|
+
*/
|
|
1130
|
+
queue?: ChatQueue;
|
|
1011
1131
|
classNames?: MessageListClassNames;
|
|
1012
1132
|
}
|
|
1013
1133
|
/**
|
|
@@ -1019,7 +1139,7 @@ interface MessageListProps {
|
|
|
1019
1139
|
* Every decision here comes from `useChatTranscript`; the file below it is markup. A host that
|
|
1020
1140
|
* wants a different layout drives that hook directly and never imports this component.
|
|
1021
1141
|
*/
|
|
1022
|
-
declare function MessageList({ messages, status, renderToolPart, renderToolGroup, renderText, renderReasoning, renderFiles, renderUi, reasoningLabel, getMeta, onFork, editable, onEditSubmit, regeneratable, onRegenerate, getUsage, getCreatedAt, emptyState, typingIndicator, followUps, onFollowUpClick, error, onRetry, classNames, }: MessageListProps): React__default.JSX.Element;
|
|
1142
|
+
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;
|
|
1023
1143
|
|
|
1024
1144
|
/**
|
|
1025
1145
|
* Languages the dictation mic offers. The Web Speech API expects a
|
|
@@ -1256,7 +1376,11 @@ interface UseToolCatalogOptions {
|
|
|
1256
1376
|
* (the shared copy is keyed by it): a backend constructed inline refetches every render.
|
|
1257
1377
|
*/
|
|
1258
1378
|
backend?: ToolsBackend;
|
|
1259
|
-
/**
|
|
1379
|
+
/**
|
|
1380
|
+
* The agent whose tools to list. Omitted → the server's default agent. {@link ALL_AGENTS} (`'*'`)
|
|
1381
|
+
* → every tool the actor reaches through any agent, each once — for an app with several agents
|
|
1382
|
+
* whose conversations one surface shows.
|
|
1383
|
+
*/
|
|
1260
1384
|
agent?: string;
|
|
1261
1385
|
/** `false` holds the request (e.g. until the user is signed in). Default `true`. */
|
|
1262
1386
|
enabled?: boolean;
|
|
@@ -1463,6 +1587,14 @@ interface UseAgentChatOptions<B extends AgentBackend = AgentBackend> {
|
|
|
1463
1587
|
blocked?: QuotaBlock | null;
|
|
1464
1588
|
/** Validation and upload for `chat.composer.files` — see `useAttachments`. */
|
|
1465
1589
|
composer?: Omit<UseAttachmentsOptions, 'backend'>;
|
|
1590
|
+
/**
|
|
1591
|
+
* What `composer.submit()` and `sendMessage` do while a turn is still running. Default `'queue'`:
|
|
1592
|
+
* the message waits in the thread's queue (server-side — it survives a reload) and runs when the
|
|
1593
|
+
* turn settles; `chat.queue` lists and edits what is waiting. `'interrupt'` cancels the running
|
|
1594
|
+
* turn and runs the message next. `'block'` refuses the send (`composer.blockedBy === 'busy'`).
|
|
1595
|
+
* A backend without `enqueueMessage` behaves as `'block'`.
|
|
1596
|
+
*/
|
|
1597
|
+
whileRunning?: WhileRunning;
|
|
1466
1598
|
/**
|
|
1467
1599
|
* Overrides for `chat.transcript` — anything `useChatTranscript` takes (`sources`, `editable` +
|
|
1468
1600
|
* `onEditSubmit`, `followUps`, `getUsage`, a `toolCatalog` of your own, `onApprove: null`, …).
|
|
@@ -1631,6 +1763,11 @@ declare function useAgentChat<B extends AgentBackend = AgentBackend>(options?: U
|
|
|
1631
1763
|
transcript: ChatTranscript;
|
|
1632
1764
|
/** A headless composer: draft, files, send gate, `submit()`. */
|
|
1633
1765
|
composer: ChatComposer;
|
|
1766
|
+
/**
|
|
1767
|
+
* Messages sent while a turn was running, waiting their turn (server-side): list, edit, move,
|
|
1768
|
+
* remove, clear, and resume a paused queue.
|
|
1769
|
+
*/
|
|
1770
|
+
queue: ChatQueue;
|
|
1634
1771
|
/** The model picker: `list`, `selected`, `select(id)`, `pinToThread(id)`. */
|
|
1635
1772
|
models: ChatModels;
|
|
1636
1773
|
/** The caller's budget (`GET <base>/quota`); `quota.blocked` gates sends. */
|
|
@@ -1668,4 +1805,4 @@ declare class QuotaBlockedError extends Error {
|
|
|
1668
1805
|
constructor(block: QuotaBlock);
|
|
1669
1806
|
}
|
|
1670
1807
|
|
|
1671
|
-
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 };
|
|
1808
|
+
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 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 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, 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 };
|