@dudousxd/nestjs-agent-react 0.27.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/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
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-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';
3
+ import { A as AgentBackend, U as UploadAttachmentOptions, H as HttpErrorListener, a as AttachmentUploadStrategy } from './client-CKwSMitS.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-CKwSMitS.cjs';
5
5
  import { MessageAttachment, AgentClientConfig, AgentCatalogEntry, ModelCatalogEntry, ModelCatalogView, ModelCatalogLock, QuotaReport, QuotaWindow, QuotaBlock, QuotaWarning, MessageFeedback, MessageFeedbackValue, ThreadSummary, StoredMessage, QueuePause, ToolCatalogEntry } from '@dudousxd/nestjs-agent-core';
6
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';
@@ -195,6 +195,11 @@ interface MessageFile {
195
195
  }
196
196
  /** The {@link MessageFileKind} of a MIME type. */
197
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;
198
203
  /**
199
204
  * The files on a message — the user's attachments (live, or replayed from `StoredMessage.attachments`
200
205
  * by `storedMessageToUiMessage`) and any the model produced — in part order. Data only: pair it with
@@ -660,12 +665,27 @@ declare function ChatInput({ onSubmit, disabled, placeholder, rows, enableSpeech
660
665
  * - `'block'` — the composer refuses it (`blockedBy: 'busy'`), as before queues existed.
661
666
  */
662
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
+ }
663
677
  /** A message waiting in the thread's queue, as the chat shows it. */
664
678
  interface QueuedChatMessage {
665
679
  /** The server's id once it is queued; a local id while `state` is `'sending'`. */
666
680
  id: string;
667
681
  text: string;
682
+ /** The uploaded attachments as they were queued — what a re-send carries. */
668
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[];
669
689
  /**
670
690
  * `'sending'` — on its way to the server (it has no server id yet, so it cannot be edited).
671
691
  * `'queued'` — waiting its turn.
@@ -692,6 +712,13 @@ interface ChatQueue {
692
712
  mode?: 'queue' | 'interrupt';
693
713
  }) => Promise<void>;
694
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>;
695
722
  edit: (id: string, text: string) => Promise<void>;
696
723
  /** Move a waiting message to `index` (0 → next). */
697
724
  move: (id: string, index: number) => Promise<void>;
@@ -902,11 +929,16 @@ interface UseChatTranscriptOptions extends TranscriptItemOptions {
902
929
  * after the transcript as {@link ChatTranscript.queued}: pending user messages, not yet sent.
903
930
  */
904
931
  queue?: {
905
- items: QueuedChatMessage[];
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
+ }>;
906
936
  paused: QueuePause | null;
907
937
  remove?: (id: string) => void | Promise<void>;
908
938
  } | null;
909
939
  }
940
+ /** One file on a waiting message: a sent message's {@link MessageFile}, and a `TranscriptFile`. */
941
+ type TranscriptQueuedFile = MessageFile & TranscriptFile;
910
942
  /**
911
943
  * A message waiting in the thread's queue, as the transcript shows it: a user message that has not
912
944
  * been sent to the model yet. Render it after {@link ChatTranscript.items}, dimmed or tagged.
@@ -915,7 +947,12 @@ interface TranscriptQueuedItem {
915
947
  id: string;
916
948
  role: 'user';
917
949
  text: string;
918
- files: TranscriptFile[];
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[];
919
956
  /**
920
957
  * `'sending'` — on its way to the server. `'queued'` — waiting for the running turn.
921
958
  * `'paused'` — waiting, but the queue is paused (see {@link ChatTranscript.queuePaused}).
@@ -1592,7 +1629,8 @@ interface UseAgentChatOptions<B extends AgentBackend = AgentBackend> {
1592
1629
  * the message waits in the thread's queue (server-side — it survives a reload) and runs when the
1593
1630
  * turn settles; `chat.queue` lists and edits what is waiting. `'interrupt'` cancels the running
1594
1631
  * turn and runs the message next. `'block'` refuses the send (`composer.blockedBy === 'busy'`).
1595
- * A backend without `enqueueMessage` behaves as `'block'`.
1632
+ * A backend without `enqueueMessage` behaves as `'block'`. One send can answer differently:
1633
+ * `composer.submit({ mode })`, `sendMessage(message, { mode })`.
1596
1634
  */
1597
1635
  whileRunning?: WhileRunning;
1598
1636
  /**
@@ -1704,8 +1742,14 @@ interface ChatComposer {
1704
1742
  canSend: boolean;
1705
1743
  /** Why `canSend` is false, or `null`. */
1706
1744
  blockedBy: ComposerBlock | null;
1707
- /** Send the draft with the ready files attached, then clear both. A no-op while blocked. */
1708
- submit: () => Promise<void>;
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>;
1709
1753
  }
1710
1754
  interface AddToolResultArgs {
1711
1755
  tool: string;
@@ -1723,7 +1767,25 @@ declare function useAgentChat<B extends AgentBackend = AgentBackend>(options?: U
1723
1767
  status: ChatStatus;
1724
1768
  /** Where the live stream stands — see {@link StreamConnectionState}. */
1725
1769
  connection: StreamConnectionState;
1726
- 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"> & {
1727
1789
  id?: string;
1728
1790
  role?: "user" | "assistant" | "system";
1729
1791
  } & {
@@ -1741,7 +1803,7 @@ declare function useAgentChat<B extends AgentBackend = AgentBackend>(options?: U
1741
1803
  metadata?: unknown;
1742
1804
  parts?: never;
1743
1805
  messageId?: string;
1744
- } | undefined, options?: ai.ChatRequestOptions) => Promise<void>;
1806
+ } | undefined, options?: ai.ChatRequestOptions) => Promise<void>>[1] & SendWhileRunning) => Promise<void>;
1745
1807
  addToolResult: ({ tool, toolCallId, output }: AddToolResultArgs) => void | PromiseLike<void>;
1746
1808
  /** Sub-agents this conversation started and did not wait for. */
1747
1809
  background: ChatBackground;
@@ -1805,4 +1867,4 @@ declare class QuotaBlockedError extends Error {
1805
1867
  constructor(block: QuotaBlock);
1806
1868
  }
1807
1869
 
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 };
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 };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
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-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';
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
5
  import { MessageAttachment, AgentClientConfig, AgentCatalogEntry, ModelCatalogEntry, ModelCatalogView, ModelCatalogLock, QuotaReport, QuotaWindow, QuotaBlock, QuotaWarning, MessageFeedback, MessageFeedbackValue, ThreadSummary, StoredMessage, QueuePause, ToolCatalogEntry } from '@dudousxd/nestjs-agent-core';
6
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';
@@ -195,6 +195,11 @@ interface MessageFile {
195
195
  }
196
196
  /** The {@link MessageFileKind} of a MIME type. */
197
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;
198
203
  /**
199
204
  * The files on a message — the user's attachments (live, or replayed from `StoredMessage.attachments`
200
205
  * by `storedMessageToUiMessage`) and any the model produced — in part order. Data only: pair it with
@@ -660,12 +665,27 @@ declare function ChatInput({ onSubmit, disabled, placeholder, rows, enableSpeech
660
665
  * - `'block'` — the composer refuses it (`blockedBy: 'busy'`), as before queues existed.
661
666
  */
662
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
+ }
663
677
  /** A message waiting in the thread's queue, as the chat shows it. */
664
678
  interface QueuedChatMessage {
665
679
  /** The server's id once it is queued; a local id while `state` is `'sending'`. */
666
680
  id: string;
667
681
  text: string;
682
+ /** The uploaded attachments as they were queued — what a re-send carries. */
668
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[];
669
689
  /**
670
690
  * `'sending'` — on its way to the server (it has no server id yet, so it cannot be edited).
671
691
  * `'queued'` — waiting its turn.
@@ -692,6 +712,13 @@ interface ChatQueue {
692
712
  mode?: 'queue' | 'interrupt';
693
713
  }) => Promise<void>;
694
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>;
695
722
  edit: (id: string, text: string) => Promise<void>;
696
723
  /** Move a waiting message to `index` (0 → next). */
697
724
  move: (id: string, index: number) => Promise<void>;
@@ -902,11 +929,16 @@ interface UseChatTranscriptOptions extends TranscriptItemOptions {
902
929
  * after the transcript as {@link ChatTranscript.queued}: pending user messages, not yet sent.
903
930
  */
904
931
  queue?: {
905
- items: QueuedChatMessage[];
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
+ }>;
906
936
  paused: QueuePause | null;
907
937
  remove?: (id: string) => void | Promise<void>;
908
938
  } | null;
909
939
  }
940
+ /** One file on a waiting message: a sent message's {@link MessageFile}, and a `TranscriptFile`. */
941
+ type TranscriptQueuedFile = MessageFile & TranscriptFile;
910
942
  /**
911
943
  * A message waiting in the thread's queue, as the transcript shows it: a user message that has not
912
944
  * been sent to the model yet. Render it after {@link ChatTranscript.items}, dimmed or tagged.
@@ -915,7 +947,12 @@ interface TranscriptQueuedItem {
915
947
  id: string;
916
948
  role: 'user';
917
949
  text: string;
918
- files: TranscriptFile[];
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[];
919
956
  /**
920
957
  * `'sending'` — on its way to the server. `'queued'` — waiting for the running turn.
921
958
  * `'paused'` — waiting, but the queue is paused (see {@link ChatTranscript.queuePaused}).
@@ -1592,7 +1629,8 @@ interface UseAgentChatOptions<B extends AgentBackend = AgentBackend> {
1592
1629
  * the message waits in the thread's queue (server-side — it survives a reload) and runs when the
1593
1630
  * turn settles; `chat.queue` lists and edits what is waiting. `'interrupt'` cancels the running
1594
1631
  * turn and runs the message next. `'block'` refuses the send (`composer.blockedBy === 'busy'`).
1595
- * A backend without `enqueueMessage` behaves as `'block'`.
1632
+ * A backend without `enqueueMessage` behaves as `'block'`. One send can answer differently:
1633
+ * `composer.submit({ mode })`, `sendMessage(message, { mode })`.
1596
1634
  */
1597
1635
  whileRunning?: WhileRunning;
1598
1636
  /**
@@ -1704,8 +1742,14 @@ interface ChatComposer {
1704
1742
  canSend: boolean;
1705
1743
  /** Why `canSend` is false, or `null`. */
1706
1744
  blockedBy: ComposerBlock | null;
1707
- /** Send the draft with the ready files attached, then clear both. A no-op while blocked. */
1708
- submit: () => Promise<void>;
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>;
1709
1753
  }
1710
1754
  interface AddToolResultArgs {
1711
1755
  tool: string;
@@ -1723,7 +1767,25 @@ declare function useAgentChat<B extends AgentBackend = AgentBackend>(options?: U
1723
1767
  status: ChatStatus;
1724
1768
  /** Where the live stream stands — see {@link StreamConnectionState}. */
1725
1769
  connection: StreamConnectionState;
1726
- 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"> & {
1727
1789
  id?: string;
1728
1790
  role?: "user" | "assistant" | "system";
1729
1791
  } & {
@@ -1741,7 +1803,7 @@ declare function useAgentChat<B extends AgentBackend = AgentBackend>(options?: U
1741
1803
  metadata?: unknown;
1742
1804
  parts?: never;
1743
1805
  messageId?: string;
1744
- } | undefined, options?: ai.ChatRequestOptions) => Promise<void>;
1806
+ } | undefined, options?: ai.ChatRequestOptions) => Promise<void>>[1] & SendWhileRunning) => Promise<void>;
1745
1807
  addToolResult: ({ tool, toolCallId, output }: AddToolResultArgs) => void | PromiseLike<void>;
1746
1808
  /** Sub-agents this conversation started and did not wait for. */
1747
1809
  background: ChatBackground;
@@ -1805,4 +1867,4 @@ declare class QuotaBlockedError extends Error {
1805
1867
  constructor(block: QuotaBlock);
1806
1868
  }
1807
1869
 
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 };
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 };