@dudousxd/nestjs-agent-react 0.32.0 → 0.34.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.
Files changed (44) hide show
  1. package/README.md +7 -0
  2. package/dist/{client-C7eu9WMJ.d.cts → client-BdHUuqy-.d.cts} +36 -1
  3. package/dist/{client-C7eu9WMJ.d.ts → client-BdHUuqy-.d.ts} +36 -1
  4. package/dist/{generative-ui-VTZ1EADD.d.cts → generative-ui-CyHY8Lh1.d.cts} +32 -101
  5. package/dist/{generative-ui-VTZ1EADD.d.ts → generative-ui-DdUZPCXX.d.ts} +32 -101
  6. package/dist/genui-json-render.cjs +51 -8
  7. package/dist/genui-json-render.cjs.map +1 -1
  8. package/dist/genui-json-render.d.cts +2 -1
  9. package/dist/genui-json-render.d.ts +2 -1
  10. package/dist/genui-json-render.js +51 -8
  11. package/dist/genui-json-render.js.map +1 -1
  12. package/dist/genui-server-playwright.cjs +199 -0
  13. package/dist/genui-server-playwright.cjs.map +1 -0
  14. package/dist/genui-server-playwright.d.cts +18 -0
  15. package/dist/genui-server-playwright.d.ts +18 -0
  16. package/dist/genui-server-playwright.js +162 -0
  17. package/dist/genui-server-playwright.js.map +1 -0
  18. package/dist/genui-server.cjs +188 -0
  19. package/dist/genui-server.cjs.map +1 -0
  20. package/dist/genui-server.d.cts +36 -0
  21. package/dist/genui-server.d.ts +36 -0
  22. package/dist/genui-server.js +163 -0
  23. package/dist/genui-server.js.map +1 -0
  24. package/dist/genui.cjs +127 -8
  25. package/dist/genui.cjs.map +1 -1
  26. package/dist/genui.d.cts +5 -2
  27. package/dist/genui.d.ts +5 -2
  28. package/dist/genui.js +128 -8
  29. package/dist/genui.js.map +1 -1
  30. package/dist/index.cjs +559 -123
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.d.cts +35 -10
  33. package/dist/index.d.ts +35 -10
  34. package/dist/index.js +552 -120
  35. package/dist/index.js.map +1 -1
  36. package/dist/media.cjs.map +1 -1
  37. package/dist/media.d.cts +1 -1
  38. package/dist/media.d.ts +1 -1
  39. package/dist/media.js.map +1 -1
  40. package/dist/react-registry-Di4IVrw-.d.cts +25 -0
  41. package/dist/react-registry-z9GFbTm9.d.ts +25 -0
  42. package/dist/types-DZtFsWec.d.cts +99 -0
  43. package/dist/types-DZtFsWec.d.ts +99 -0
  44. package/package.json +35 -5
package/dist/index.d.cts CHANGED
@@ -1,13 +1,16 @@
1
1
  import * as ai from 'ai';
2
2
  import { ChatTransport, UIMessage, UIMessageChunk, DataUIPart, UIDataTypes } from 'ai';
3
- import { A as AgentRequestError, a as AgentBackend, U as UploadAttachmentOptions, C as ChatStreamRequest, b as ChatStreamResponse, H as HttpErrorListener, c as AttachmentUploadStrategy } from './client-C7eu9WMJ.cjs';
4
- export { d as AgentBackendUnsupportedError, e as AgentClient, f as AgentClientOptions, g as AgentConnection, h as AgentHttpError, i as CancelResult, M as MessageFeedbackInput, Q as QueuedMessageUpdate, j as QueuedSendResult, R as ResumeStreamRequest, T as ThreadPatch, r as requireBackendMethod } from './client-C7eu9WMJ.cjs';
5
- import { MessageAttachment, AgentClientConfig, AgentCatalogEntry, PersonaCatalogEntry, ModelCatalogEntry, ModelCatalogView, ModelCatalogLock, QuotaReport, QuotaWindow, QuotaBlock, QuotaWarning, MessageFeedback, MessageFeedbackValue, ThreadSummary, StoredMessage, QueuePause, ToolCatalogEntry } from '@dudousxd/nestjs-agent-core';
3
+ import { A as AgentRequestError, a as AgentBackend, U as UploadAttachmentOptions, C as ChatStreamRequest, b as ChatStreamResponse, H as HttpErrorListener, c as AttachmentUploadStrategy } from './client-BdHUuqy-.cjs';
4
+ export { d as AgentBackendUnsupportedError, e as AgentClient, f as AgentClientOptions, g as AgentConnection, h as AgentHttpError, i as CancelResult, M as MessageFeedbackInput, Q as QueuedMessageUpdate, j as QueuedSendResult, R as ResumeStreamRequest, T as ThreadPatch, r as requireBackendMethod } from './client-BdHUuqy-.cjs';
5
+ import { MessageAttachment, AgentClientConfig, AgentCatalogEntry, PersonaCatalogEntry, ModelCatalogEntry, ModelCatalogView, ModelCatalogLock, QuotaReport, QuotaWindow, QuotaBlock, QuotaWarning, MessageFeedback, MessageFeedbackValue, ThreadSummary, StoredMessage, QueuePause, ToolCatalogEntry, ActionProposalView } 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';
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, w as TranscriptFile, M as MessageUsageInfo, x as ToolCatalog, y as AnyToolUIPart } from './generative-ui-VTZ1EADD.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-VTZ1EADD.cjs';
9
+ import { UiCapabilities } from '@dudousxd/nestjs-agent-core/genui';
10
+ export { UiCapabilities } from '@dudousxd/nestjs-agent-core/genui';
11
+ import { g as GenuiProviderValue, T as TranscriptUiBlock, A as ApproveOptions, j as ApprovalTarget, k as TranscriptBlock, U as UsageSummary, l as TimestampInfo, C as ChatStatus, m as TranscriptFile, M as MessageUsageInfo, n as ToolCatalog, o as AnyToolUIPart } from './generative-ui-CyHY8Lh1.cjs';
12
+ export { p as ApprovalBlockOptions, B as BuildBlocksOptions, q as CoercibleQuestion, D as DescribeToolCallOptions, E as ElicitationBlockOptions, r as GroupToolActivityOptions, R as RawAnswer, s as ResolvedReading, t as ResolvedResultView, v as RetrievedPassage, S as SettleAction, w as ToolActivityGroup, x as ToolCallDescription, y as ToolCallState, z as ToolCallStatus, F as TranscriptApproval, H as TranscriptApprovalStatus, I as TranscriptElicitationBlock, J as TranscriptElicitationOutcome, K as TranscriptFilesBlock, L as TranscriptQuestion, N as TranscriptQuestionOption, O as TranscriptReasoningBlock, P as TranscriptSettleState, Q as TranscriptSource, V as TranscriptSourcesBlock, W as TranscriptTextBlock, X as TranscriptToolBlock, Y as TranscriptToolCall, Z as buildTranscriptBlocks, _ as coerceAnswer, $ as correctedCallIds, a0 as describeTimestamp, a1 as describeToolCall, a2 as describeUsage, a3 as extractMessageText, a4 as fillTemplate, a5 as formatRelativeTime, a6 as groupToolActivity, a7 as inferResultView, a8 as isActionCall, a9 as phraseFor, aa as proposalNeedsPolling, ab as readPath, ac as reconcileProposalMessages, ad as resolveResultView, ae as toolCallState, af as toolCatalogFrom } from './generative-ui-CyHY8Lh1.cjs';
13
+ import './types-DZtFsWec.cjs';
11
14
 
12
15
  /**
13
16
  * The `code`s this library's own loop closes a failed run's stream with (`event: error`). A client
@@ -408,7 +411,7 @@ interface AgUiChatStreamOptions {
408
411
  /** Defaults to the global `fetch`, with `credentials: 'same-origin'`. */
409
412
  fetch?: typeof fetch;
410
413
  /**
411
- * Shape `forwardedProps` from the send's body. Default: `{ pageContext, agent, model }` from the
414
+ * Shape `forwardedProps` from the send's body. Default: `{ pageContext, agent, model, persona, uiCapabilities }` from the
412
415
  * body, whichever are present.
413
416
  */
414
417
  forwardedProps?: (body: Record<string, unknown>) => unknown;
@@ -455,6 +458,8 @@ declare function reframeAgUiStream(source: ReadableStream<Uint8Array>, ids: {
455
458
  }): ReadableStream<Uint8Array>;
456
459
 
457
460
  interface AgentProviderProps {
461
+ /** Advertise exact supported component versions; omission keeps legacy support, [] is text only. */
462
+ uiCapabilities?: UiCapabilities;
458
463
  /**
459
464
  * A backend of your own — see {@link AgentBackend}. Omitted → an {@link AgentClient} over this
460
465
  * library's REST routes, built from the connection props below (which are ignored when a backend
@@ -507,12 +512,18 @@ interface AgentProviderProps {
507
512
  *
508
513
  * Without a provider every hook shares one same-origin client on `/agent`.
509
514
  */
510
- declare function AgentProvider({ backend, baseUrl, path, headers, getHeaders, credentials, fetch, onHttpError, attachments, genui, children, }: AgentProviderProps): React.JSX.Element;
515
+ declare function AgentProvider({ backend, uiCapabilities, baseUrl, path, headers, getHeaders, credentials, fetch, onHttpError, attachments, genui, children, }: AgentProviderProps): React.JSX.Element;
511
516
  /**
512
517
  * The backend a hook talks to: `own` when given, else the enclosing {@link AgentProvider}'s, else a
513
518
  * shared same-origin client on `/agent`. For your own hooks over the same connection.
514
519
  */
515
520
  declare function useAgentBackend<B extends AgentBackend = AgentBackend>(own?: B): B;
521
+ /**
522
+ * The UI capabilities the nearest `<AgentProvider uiCapabilities>` declared, or `undefined` when it
523
+ * declared none. `useAgentChat` reads this unless given its own `uiCapabilities`; read it too when a
524
+ * hook of yours talks to the agent outside `useAgentChat`.
525
+ */
526
+ declare function useAgentUiCapabilities(): UiCapabilities | undefined;
516
527
 
517
528
  interface UseAgentConfigOptions {
518
529
  /** Default: the enclosing `<AgentProvider>`'s. Without `getConfig` the config stays `undefined`. */
@@ -976,12 +987,14 @@ interface SkipInput {
976
987
  }
977
988
  /** Approving a tool call parked on a human. */
978
989
  interface ApproveInput extends ApproveOptions {
990
+ target?: ApprovalTarget;
979
991
  toolCallId: string;
980
992
  /** The surface the decision came through; the server records `'web'` when omitted. */
981
993
  via?: string;
982
994
  }
983
995
  /** Rejecting a tool call parked on a human. */
984
996
  interface RejectInput {
997
+ target?: ApprovalTarget;
985
998
  toolCallId: string;
986
999
  reason?: string;
987
1000
  via?: string;
@@ -1711,6 +1724,10 @@ interface AgentMessageMetadata extends Partial<StoredTurnMetadata> {
1711
1724
  declare function storedThreadToUiMessages(messages: StoredMessage[]): UIMessage[];
1712
1725
 
1713
1726
  interface UseAgentChatOptions<B extends AgentBackend = AgentBackend> {
1727
+ uiCapabilities?: UiCapabilities;
1728
+ proposalPollMs?: number;
1729
+ /** Enable proposal reads even when history and resume are both disabled. */
1730
+ proposals?: boolean;
1714
1731
  /**
1715
1732
  * What the chat talks to — see {@link AgentBackend}. Omitted → the enclosing `<AgentProvider>`'s,
1716
1733
  * else a same-origin client on `/agent`. Must be stable across renders.
@@ -1960,6 +1977,7 @@ declare function useAgentChat<B extends AgentBackend = AgentBackend>(options?: U
1960
1977
  addToolResult: ({ tool, toolCallId, output }: AddToolResultArgs) => void | PromiseLike<void>;
1961
1978
  /** Sub-agents this conversation started and did not wait for. */
1962
1979
  background: ChatBackground;
1980
+ proposals: ActionProposalsState;
1963
1981
  runId: string | undefined;
1964
1982
  /** The loaded thread's running turn, or `null` once read with none. */
1965
1983
  activeRunId: string | null;
@@ -2002,8 +2020,8 @@ declare function useAgentChat<B extends AgentBackend = AgentBackend>(options?: U
2002
2020
  /** The window blocking sends right now (the `blocked` option, else the quota report's). */
2003
2021
  blocked: QuotaBlock | null;
2004
2022
  cancel: () => Promise<void>;
2005
- approve: ({ toolCallId, remember, via }: ApproveInput) => Promise<void>;
2006
- reject: ({ toolCallId, reason, via }: RejectInput) => Promise<void>;
2023
+ approve: ({ toolCallId, target, remember, via }: ApproveInput) => Promise<void>;
2024
+ reject: ({ toolCallId, target, reason, via }: RejectInput) => Promise<void>;
2007
2025
  answer: ({ toolCallId, answers, via }: AnswerInput) => Promise<void>;
2008
2026
  skip: ({ toolCallId, via }: SkipInput) => Promise<void>;
2009
2027
  regenerate: (_input?: Partial<MessageActionInput>) => void;
@@ -2032,4 +2050,11 @@ declare class QuotaBlockedError extends Error {
2032
2050
  constructor(block: QuotaBlock);
2033
2051
  }
2034
2052
 
2035
- export { AGENT_RUN_ERROR_CODES, type AgUiChatStreamOptions, type AgUiContentPart, AgentBackend, AgentChatTransport, type AgentChatTransportOptions, type AgentConfigState, type AgentMessageMetadata, AgentProvider, type AgentProviderProps, AgentRequestError, type AgentRunErrorCode, type AgentRunFailure, 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, ChatStreamRequest, ChatStreamResponse, 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, RUN_NOT_ACTIVE_CODE, 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, agUiChatStream, applyCompletion, approvalCountdown, attachmentFile, backgroundRunsFromThread, createSkillsSource, dragHasFiles, fileKind, filesFromClipboard, filterAutocompleteItems, findActiveTrigger, formatElapsed, isRunNotActiveError, loadStoredSpeechLang, messageFiles, notifyThreads, onThreadsEvent, persistSpeechLang, readReasoningMs, reframeAgUiStream, storedMessageToUiMessage, storedThreadToUiMessages, useAgentBackend, useAgentChat, useAgentConfig, useAgents, useAmbientRenderUi, useApprovalCountdown, useAttachments, useChatTranscript, useComposerAutocomplete, useElapsed, useMessageFeedback, useModels, useQuota, useSpeechRecognition, useStickToBottom, useThreads, useToolCatalog, useTranscriptItem };
2053
+ interface ActionProposalsState {
2054
+ items: ActionProposalView[];
2055
+ error: Error | null;
2056
+ refresh(): Promise<void>;
2057
+ }
2058
+ declare function useActionProposals(backend: AgentBackend, threadId: string | undefined, setMessages: (update: (current: UIMessage[]) => UIMessage[]) => void, refreshKey: string, pollMs?: number): ActionProposalsState;
2059
+
2060
+ export { AGENT_RUN_ERROR_CODES, type ActionProposalsState, type AgUiChatStreamOptions, type AgUiContentPart, AgentBackend, AgentChatTransport, type AgentChatTransportOptions, type AgentConfigState, type AgentMessageMetadata, AgentProvider, type AgentProviderProps, AgentRequestError, type AgentRunErrorCode, type AgentRunFailure, type AgentStreamMeta, type AgentsState, type AggregatedTurnUsage, type AmbientRenderUi, AmbientRenderUiContext, type AnswerInput, AnyToolUIPart, type ApprovalCountdown, ApprovalTarget, 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, ChatStreamRequest, ChatStreamResponse, 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, RUN_NOT_ACTIVE_CODE, 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, agUiChatStream, applyCompletion, approvalCountdown, attachmentFile, backgroundRunsFromThread, createSkillsSource, dragHasFiles, fileKind, filesFromClipboard, filterAutocompleteItems, findActiveTrigger, formatElapsed, isRunNotActiveError, loadStoredSpeechLang, messageFiles, notifyThreads, onThreadsEvent, persistSpeechLang, readReasoningMs, reframeAgUiStream, storedMessageToUiMessage, storedThreadToUiMessages, useActionProposals, useAgentBackend, useAgentChat, useAgentConfig, useAgentUiCapabilities, useAgents, useAmbientRenderUi, useApprovalCountdown, useAttachments, useChatTranscript, useComposerAutocomplete, useElapsed, useMessageFeedback, useModels, useQuota, useSpeechRecognition, useStickToBottom, useThreads, useToolCatalog, useTranscriptItem };
package/dist/index.d.ts CHANGED
@@ -1,13 +1,16 @@
1
1
  import * as ai from 'ai';
2
2
  import { ChatTransport, UIMessage, UIMessageChunk, DataUIPart, UIDataTypes } from 'ai';
3
- import { A as AgentRequestError, a as AgentBackend, U as UploadAttachmentOptions, C as ChatStreamRequest, b as ChatStreamResponse, H as HttpErrorListener, c as AttachmentUploadStrategy } from './client-C7eu9WMJ.js';
4
- export { d as AgentBackendUnsupportedError, e as AgentClient, f as AgentClientOptions, g as AgentConnection, h as AgentHttpError, i as CancelResult, M as MessageFeedbackInput, Q as QueuedMessageUpdate, j as QueuedSendResult, R as ResumeStreamRequest, T as ThreadPatch, r as requireBackendMethod } from './client-C7eu9WMJ.js';
5
- import { MessageAttachment, AgentClientConfig, AgentCatalogEntry, PersonaCatalogEntry, ModelCatalogEntry, ModelCatalogView, ModelCatalogLock, QuotaReport, QuotaWindow, QuotaBlock, QuotaWarning, MessageFeedback, MessageFeedbackValue, ThreadSummary, StoredMessage, QueuePause, ToolCatalogEntry } from '@dudousxd/nestjs-agent-core';
3
+ import { A as AgentRequestError, a as AgentBackend, U as UploadAttachmentOptions, C as ChatStreamRequest, b as ChatStreamResponse, H as HttpErrorListener, c as AttachmentUploadStrategy } from './client-BdHUuqy-.js';
4
+ export { d as AgentBackendUnsupportedError, e as AgentClient, f as AgentClientOptions, g as AgentConnection, h as AgentHttpError, i as CancelResult, M as MessageFeedbackInput, Q as QueuedMessageUpdate, j as QueuedSendResult, R as ResumeStreamRequest, T as ThreadPatch, r as requireBackendMethod } from './client-BdHUuqy-.js';
5
+ import { MessageAttachment, AgentClientConfig, AgentCatalogEntry, PersonaCatalogEntry, ModelCatalogEntry, ModelCatalogView, ModelCatalogLock, QuotaReport, QuotaWindow, QuotaBlock, QuotaWarning, MessageFeedback, MessageFeedbackValue, ThreadSummary, StoredMessage, QueuePause, ToolCatalogEntry, ActionProposalView } 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';
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, w as TranscriptFile, M as MessageUsageInfo, x as ToolCatalog, y as AnyToolUIPart } from './generative-ui-VTZ1EADD.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-VTZ1EADD.js';
9
+ import { UiCapabilities } from '@dudousxd/nestjs-agent-core/genui';
10
+ export { UiCapabilities } from '@dudousxd/nestjs-agent-core/genui';
11
+ import { g as GenuiProviderValue, T as TranscriptUiBlock, A as ApproveOptions, j as ApprovalTarget, k as TranscriptBlock, U as UsageSummary, l as TimestampInfo, C as ChatStatus, m as TranscriptFile, M as MessageUsageInfo, n as ToolCatalog, o as AnyToolUIPart } from './generative-ui-DdUZPCXX.js';
12
+ export { p as ApprovalBlockOptions, B as BuildBlocksOptions, q as CoercibleQuestion, D as DescribeToolCallOptions, E as ElicitationBlockOptions, r as GroupToolActivityOptions, R as RawAnswer, s as ResolvedReading, t as ResolvedResultView, v as RetrievedPassage, S as SettleAction, w as ToolActivityGroup, x as ToolCallDescription, y as ToolCallState, z as ToolCallStatus, F as TranscriptApproval, H as TranscriptApprovalStatus, I as TranscriptElicitationBlock, J as TranscriptElicitationOutcome, K as TranscriptFilesBlock, L as TranscriptQuestion, N as TranscriptQuestionOption, O as TranscriptReasoningBlock, P as TranscriptSettleState, Q as TranscriptSource, V as TranscriptSourcesBlock, W as TranscriptTextBlock, X as TranscriptToolBlock, Y as TranscriptToolCall, Z as buildTranscriptBlocks, _ as coerceAnswer, $ as correctedCallIds, a0 as describeTimestamp, a1 as describeToolCall, a2 as describeUsage, a3 as extractMessageText, a4 as fillTemplate, a5 as formatRelativeTime, a6 as groupToolActivity, a7 as inferResultView, a8 as isActionCall, a9 as phraseFor, aa as proposalNeedsPolling, ab as readPath, ac as reconcileProposalMessages, ad as resolveResultView, ae as toolCallState, af as toolCatalogFrom } from './generative-ui-DdUZPCXX.js';
13
+ import './types-DZtFsWec.js';
11
14
 
12
15
  /**
13
16
  * The `code`s this library's own loop closes a failed run's stream with (`event: error`). A client
@@ -408,7 +411,7 @@ interface AgUiChatStreamOptions {
408
411
  /** Defaults to the global `fetch`, with `credentials: 'same-origin'`. */
409
412
  fetch?: typeof fetch;
410
413
  /**
411
- * Shape `forwardedProps` from the send's body. Default: `{ pageContext, agent, model }` from the
414
+ * Shape `forwardedProps` from the send's body. Default: `{ pageContext, agent, model, persona, uiCapabilities }` from the
412
415
  * body, whichever are present.
413
416
  */
414
417
  forwardedProps?: (body: Record<string, unknown>) => unknown;
@@ -455,6 +458,8 @@ declare function reframeAgUiStream(source: ReadableStream<Uint8Array>, ids: {
455
458
  }): ReadableStream<Uint8Array>;
456
459
 
457
460
  interface AgentProviderProps {
461
+ /** Advertise exact supported component versions; omission keeps legacy support, [] is text only. */
462
+ uiCapabilities?: UiCapabilities;
458
463
  /**
459
464
  * A backend of your own — see {@link AgentBackend}. Omitted → an {@link AgentClient} over this
460
465
  * library's REST routes, built from the connection props below (which are ignored when a backend
@@ -507,12 +512,18 @@ interface AgentProviderProps {
507
512
  *
508
513
  * Without a provider every hook shares one same-origin client on `/agent`.
509
514
  */
510
- declare function AgentProvider({ backend, baseUrl, path, headers, getHeaders, credentials, fetch, onHttpError, attachments, genui, children, }: AgentProviderProps): React.JSX.Element;
515
+ declare function AgentProvider({ backend, uiCapabilities, baseUrl, path, headers, getHeaders, credentials, fetch, onHttpError, attachments, genui, children, }: AgentProviderProps): React.JSX.Element;
511
516
  /**
512
517
  * The backend a hook talks to: `own` when given, else the enclosing {@link AgentProvider}'s, else a
513
518
  * shared same-origin client on `/agent`. For your own hooks over the same connection.
514
519
  */
515
520
  declare function useAgentBackend<B extends AgentBackend = AgentBackend>(own?: B): B;
521
+ /**
522
+ * The UI capabilities the nearest `<AgentProvider uiCapabilities>` declared, or `undefined` when it
523
+ * declared none. `useAgentChat` reads this unless given its own `uiCapabilities`; read it too when a
524
+ * hook of yours talks to the agent outside `useAgentChat`.
525
+ */
526
+ declare function useAgentUiCapabilities(): UiCapabilities | undefined;
516
527
 
517
528
  interface UseAgentConfigOptions {
518
529
  /** Default: the enclosing `<AgentProvider>`'s. Without `getConfig` the config stays `undefined`. */
@@ -976,12 +987,14 @@ interface SkipInput {
976
987
  }
977
988
  /** Approving a tool call parked on a human. */
978
989
  interface ApproveInput extends ApproveOptions {
990
+ target?: ApprovalTarget;
979
991
  toolCallId: string;
980
992
  /** The surface the decision came through; the server records `'web'` when omitted. */
981
993
  via?: string;
982
994
  }
983
995
  /** Rejecting a tool call parked on a human. */
984
996
  interface RejectInput {
997
+ target?: ApprovalTarget;
985
998
  toolCallId: string;
986
999
  reason?: string;
987
1000
  via?: string;
@@ -1711,6 +1724,10 @@ interface AgentMessageMetadata extends Partial<StoredTurnMetadata> {
1711
1724
  declare function storedThreadToUiMessages(messages: StoredMessage[]): UIMessage[];
1712
1725
 
1713
1726
  interface UseAgentChatOptions<B extends AgentBackend = AgentBackend> {
1727
+ uiCapabilities?: UiCapabilities;
1728
+ proposalPollMs?: number;
1729
+ /** Enable proposal reads even when history and resume are both disabled. */
1730
+ proposals?: boolean;
1714
1731
  /**
1715
1732
  * What the chat talks to — see {@link AgentBackend}. Omitted → the enclosing `<AgentProvider>`'s,
1716
1733
  * else a same-origin client on `/agent`. Must be stable across renders.
@@ -1960,6 +1977,7 @@ declare function useAgentChat<B extends AgentBackend = AgentBackend>(options?: U
1960
1977
  addToolResult: ({ tool, toolCallId, output }: AddToolResultArgs) => void | PromiseLike<void>;
1961
1978
  /** Sub-agents this conversation started and did not wait for. */
1962
1979
  background: ChatBackground;
1980
+ proposals: ActionProposalsState;
1963
1981
  runId: string | undefined;
1964
1982
  /** The loaded thread's running turn, or `null` once read with none. */
1965
1983
  activeRunId: string | null;
@@ -2002,8 +2020,8 @@ declare function useAgentChat<B extends AgentBackend = AgentBackend>(options?: U
2002
2020
  /** The window blocking sends right now (the `blocked` option, else the quota report's). */
2003
2021
  blocked: QuotaBlock | null;
2004
2022
  cancel: () => Promise<void>;
2005
- approve: ({ toolCallId, remember, via }: ApproveInput) => Promise<void>;
2006
- reject: ({ toolCallId, reason, via }: RejectInput) => Promise<void>;
2023
+ approve: ({ toolCallId, target, remember, via }: ApproveInput) => Promise<void>;
2024
+ reject: ({ toolCallId, target, reason, via }: RejectInput) => Promise<void>;
2007
2025
  answer: ({ toolCallId, answers, via }: AnswerInput) => Promise<void>;
2008
2026
  skip: ({ toolCallId, via }: SkipInput) => Promise<void>;
2009
2027
  regenerate: (_input?: Partial<MessageActionInput>) => void;
@@ -2032,4 +2050,11 @@ declare class QuotaBlockedError extends Error {
2032
2050
  constructor(block: QuotaBlock);
2033
2051
  }
2034
2052
 
2035
- export { AGENT_RUN_ERROR_CODES, type AgUiChatStreamOptions, type AgUiContentPart, AgentBackend, AgentChatTransport, type AgentChatTransportOptions, type AgentConfigState, type AgentMessageMetadata, AgentProvider, type AgentProviderProps, AgentRequestError, type AgentRunErrorCode, type AgentRunFailure, 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, ChatStreamRequest, ChatStreamResponse, 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, RUN_NOT_ACTIVE_CODE, 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, agUiChatStream, applyCompletion, approvalCountdown, attachmentFile, backgroundRunsFromThread, createSkillsSource, dragHasFiles, fileKind, filesFromClipboard, filterAutocompleteItems, findActiveTrigger, formatElapsed, isRunNotActiveError, loadStoredSpeechLang, messageFiles, notifyThreads, onThreadsEvent, persistSpeechLang, readReasoningMs, reframeAgUiStream, storedMessageToUiMessage, storedThreadToUiMessages, useAgentBackend, useAgentChat, useAgentConfig, useAgents, useAmbientRenderUi, useApprovalCountdown, useAttachments, useChatTranscript, useComposerAutocomplete, useElapsed, useMessageFeedback, useModels, useQuota, useSpeechRecognition, useStickToBottom, useThreads, useToolCatalog, useTranscriptItem };
2053
+ interface ActionProposalsState {
2054
+ items: ActionProposalView[];
2055
+ error: Error | null;
2056
+ refresh(): Promise<void>;
2057
+ }
2058
+ declare function useActionProposals(backend: AgentBackend, threadId: string | undefined, setMessages: (update: (current: UIMessage[]) => UIMessage[]) => void, refreshKey: string, pollMs?: number): ActionProposalsState;
2059
+
2060
+ export { AGENT_RUN_ERROR_CODES, type ActionProposalsState, type AgUiChatStreamOptions, type AgUiContentPart, AgentBackend, AgentChatTransport, type AgentChatTransportOptions, type AgentConfigState, type AgentMessageMetadata, AgentProvider, type AgentProviderProps, AgentRequestError, type AgentRunErrorCode, type AgentRunFailure, type AgentStreamMeta, type AgentsState, type AggregatedTurnUsage, type AmbientRenderUi, AmbientRenderUiContext, type AnswerInput, AnyToolUIPart, type ApprovalCountdown, ApprovalTarget, 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, ChatStreamRequest, ChatStreamResponse, 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, RUN_NOT_ACTIVE_CODE, 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, agUiChatStream, applyCompletion, approvalCountdown, attachmentFile, backgroundRunsFromThread, createSkillsSource, dragHasFiles, fileKind, filesFromClipboard, filterAutocompleteItems, findActiveTrigger, formatElapsed, isRunNotActiveError, loadStoredSpeechLang, messageFiles, notifyThreads, onThreadsEvent, persistSpeechLang, readReasoningMs, reframeAgUiStream, storedMessageToUiMessage, storedThreadToUiMessages, useActionProposals, useAgentBackend, useAgentChat, useAgentConfig, useAgentUiCapabilities, useAgents, useAmbientRenderUi, useApprovalCountdown, useAttachments, useChatTranscript, useComposerAutocomplete, useElapsed, useMessageFeedback, useModels, useQuota, useSpeechRecognition, useStickToBottom, useThreads, useToolCatalog, useTranscriptItem };