@dudousxd/nestjs-agent-react 0.31.5 → 0.33.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/{client-BuobfZtx.d.cts → client-B6EE8-AC.d.cts} +39 -2
- package/dist/{client-BuobfZtx.d.ts → client-B6EE8-AC.d.ts} +39 -2
- package/dist/{generative-ui-VTZ1EADD.d.cts → generative-ui-DOe2RsoO.d.cts} +35 -9
- package/dist/{generative-ui-VTZ1EADD.d.ts → generative-ui-DOe2RsoO.d.ts} +35 -9
- package/dist/genui-json-render.cjs +51 -8
- package/dist/genui-json-render.cjs.map +1 -1
- package/dist/genui-json-render.d.cts +1 -1
- package/dist/genui-json-render.d.ts +1 -1
- package/dist/genui-json-render.js +51 -8
- package/dist/genui-json-render.js.map +1 -1
- package/dist/genui.cjs +51 -8
- package/dist/genui.cjs.map +1 -1
- package/dist/genui.d.cts +2 -2
- package/dist/genui.d.ts +2 -2
- package/dist/genui.js +51 -8
- package/dist/genui.js.map +1 -1
- package/dist/index.cjs +581 -124
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +56 -12
- package/dist/index.d.ts +56 -12
- package/dist/index.js +625 -171
- 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,15 @@
|
|
|
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-
|
|
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-
|
|
5
|
-
import { MessageAttachment, AgentClientConfig, AgentCatalogEntry, 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-B6EE8-AC.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-B6EE8-AC.cjs';
|
|
5
|
+
import { MessageAttachment, AgentClientConfig, AgentCatalogEntry, PersonaCatalogEntry, ModelCatalogEntry, ModelCatalogView, ModelCatalogLock, QuotaReport, QuotaWindow, QuotaBlock, QuotaWarning, MessageFeedback, MessageFeedbackValue, ThreadSummary, StoredMessage, QueuePause, ToolCatalogEntry, ActionProposal } 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 {
|
|
10
|
-
export {
|
|
9
|
+
import { UiCapabilities } from '@dudousxd/nestjs-agent-core/genui';
|
|
10
|
+
export { UiCapabilities } from '@dudousxd/nestjs-agent-core/genui';
|
|
11
|
+
import { o as GenuiProviderValue, T as TranscriptUiBlock, A as ApproveOptions, t as ApprovalTarget, v as TranscriptBlock, U as UsageSummary, w as TimestampInfo, C as ChatStatus, x as TranscriptFile, M as MessageUsageInfo, y as ToolCatalog, z as AnyToolUIPart } from './generative-ui-DOe2RsoO.cjs';
|
|
12
|
+
export { B as ApprovalBlockOptions, D as BuildBlocksOptions, E as CoercibleQuestion, F as DescribeToolCallOptions, H as ElicitationBlockOptions, I as GroupToolActivityOptions, J as RawAnswer, K as ResolvedReading, L as ResolvedResultView, N as RetrievedPassage, S as SettleAction, O as ToolActivityGroup, P as ToolCallDescription, Q as ToolCallState, V as ToolCallStatus, W as TranscriptApproval, X as TranscriptApprovalStatus, Y as TranscriptElicitationBlock, Z as TranscriptElicitationOutcome, _ as TranscriptFilesBlock, $ as TranscriptQuestion, a0 as TranscriptQuestionOption, a1 as TranscriptReasoningBlock, a2 as TranscriptSettleState, a3 as TranscriptSource, a4 as TranscriptSourcesBlock, a5 as TranscriptTextBlock, a6 as TranscriptToolBlock, a7 as TranscriptToolCall, a8 as buildTranscriptBlocks, a9 as coerceAnswer, aa as correctedCallIds, ab as describeTimestamp, ac as describeToolCall, ad as describeUsage, ae as extractMessageText, af as fillTemplate, ag as formatRelativeTime, ah as groupToolActivity, ai as inferResultView, aj as isActionCall, ak as phraseFor, al as proposalNeedsPolling, am as readPath, an as reconcileProposalMessages, ao as resolveResultView, ap as toolCallState, aq as toolCatalogFrom } from './generative-ui-DOe2RsoO.cjs';
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* The `code`s this library's own loop closes a failed run's stream with (`event: error`). A client
|
|
@@ -107,6 +109,8 @@ interface AgentChatTransportOptions {
|
|
|
107
109
|
credentials?: RequestCredentials;
|
|
108
110
|
/** Named agent to run the turn (backend `agent` field). */
|
|
109
111
|
agent?: string;
|
|
112
|
+
/** One of the agent's personas to answer as (backend `persona` field). */
|
|
113
|
+
persona?: string;
|
|
110
114
|
/**
|
|
111
115
|
* Extra body fields evaluated per send — the hook injects `threadId`
|
|
112
116
|
* and `pageContext` through this. Returned object is spread into the
|
|
@@ -406,7 +410,7 @@ interface AgUiChatStreamOptions {
|
|
|
406
410
|
/** Defaults to the global `fetch`, with `credentials: 'same-origin'`. */
|
|
407
411
|
fetch?: typeof fetch;
|
|
408
412
|
/**
|
|
409
|
-
* Shape `forwardedProps` from the send's body. Default: `{ pageContext, agent, model }` from the
|
|
413
|
+
* Shape `forwardedProps` from the send's body. Default: `{ pageContext, agent, model, persona, uiCapabilities }` from the
|
|
410
414
|
* body, whichever are present.
|
|
411
415
|
*/
|
|
412
416
|
forwardedProps?: (body: Record<string, unknown>) => unknown;
|
|
@@ -453,6 +457,8 @@ declare function reframeAgUiStream(source: ReadableStream<Uint8Array>, ids: {
|
|
|
453
457
|
}): ReadableStream<Uint8Array>;
|
|
454
458
|
|
|
455
459
|
interface AgentProviderProps {
|
|
460
|
+
/** Advertise exact supported component versions; omission keeps legacy support, [] is text only. */
|
|
461
|
+
uiCapabilities?: UiCapabilities;
|
|
456
462
|
/**
|
|
457
463
|
* A backend of your own — see {@link AgentBackend}. Omitted → an {@link AgentClient} over this
|
|
458
464
|
* library's REST routes, built from the connection props below (which are ignored when a backend
|
|
@@ -505,7 +511,7 @@ interface AgentProviderProps {
|
|
|
505
511
|
*
|
|
506
512
|
* Without a provider every hook shares one same-origin client on `/agent`.
|
|
507
513
|
*/
|
|
508
|
-
declare function AgentProvider({ backend, baseUrl, path, headers, getHeaders, credentials, fetch, onHttpError, attachments, genui, children, }: AgentProviderProps): React.JSX.Element;
|
|
514
|
+
declare function AgentProvider({ backend, uiCapabilities, baseUrl, path, headers, getHeaders, credentials, fetch, onHttpError, attachments, genui, children, }: AgentProviderProps): React.JSX.Element;
|
|
509
515
|
/**
|
|
510
516
|
* The backend a hook talks to: `own` when given, else the enclosing {@link AgentProvider}'s, else a
|
|
511
517
|
* shared same-origin client on `/agent`. For your own hooks over the same connection.
|
|
@@ -542,13 +548,21 @@ interface AgentsState {
|
|
|
542
548
|
agents: AgentCatalogEntry[];
|
|
543
549
|
/** The agent a turn runs as when none is named. */
|
|
544
550
|
defaultAgent: string | null;
|
|
551
|
+
/**
|
|
552
|
+
* An agent's personas — the data behind a persona picker. `agent` omitted → the default agent's.
|
|
553
|
+
* `[]` for an agent that declares none (or before the list loads).
|
|
554
|
+
*/
|
|
555
|
+
personasOf: (agent?: string) => PersonaCatalogEntry[];
|
|
556
|
+
/** The persona `agent` (default: the default agent) runs under when a send names none, or `null`. */
|
|
557
|
+
defaultPersonaOf: (agent?: string) => string | null;
|
|
545
558
|
isLoading: boolean;
|
|
546
559
|
error: Error | null;
|
|
547
560
|
refresh: () => Promise<void>;
|
|
548
561
|
}
|
|
549
562
|
/**
|
|
550
|
-
* The registered agents (`GET <base>/agents`) — the data behind an agent picker
|
|
551
|
-
* `useAgentChat({ agent })`, or pin it on
|
|
563
|
+
* The registered agents (`GET <base>/agents`) — the data behind an agent picker, and each agent's
|
|
564
|
+
* personas behind a persona picker. Send the pick as `useAgentChat({ agent, persona })`, or pin it on
|
|
565
|
+
* a thread with `PATCH <base>/threads/:id { defaultAgent, persona }`.
|
|
552
566
|
*/
|
|
553
567
|
declare function useAgents(options?: UseAgentsOptions): AgentsState;
|
|
554
568
|
|
|
@@ -966,12 +980,14 @@ interface SkipInput {
|
|
|
966
980
|
}
|
|
967
981
|
/** Approving a tool call parked on a human. */
|
|
968
982
|
interface ApproveInput extends ApproveOptions {
|
|
983
|
+
target?: ApprovalTarget;
|
|
969
984
|
toolCallId: string;
|
|
970
985
|
/** The surface the decision came through; the server records `'web'` when omitted. */
|
|
971
986
|
via?: string;
|
|
972
987
|
}
|
|
973
988
|
/** Rejecting a tool call parked on a human. */
|
|
974
989
|
interface RejectInput {
|
|
990
|
+
target?: ApprovalTarget;
|
|
975
991
|
toolCallId: string;
|
|
976
992
|
reason?: string;
|
|
977
993
|
via?: string;
|
|
@@ -1653,6 +1669,10 @@ interface AgentMessageMetadata extends Partial<StoredTurnMetadata> {
|
|
|
1653
1669
|
costUsd?: number | null;
|
|
1654
1670
|
/** ISO timestamp: the stored row's `createdAt` (a merged turn: its first row's), or when a live turn started streaming. */
|
|
1655
1671
|
createdAt?: string;
|
|
1672
|
+
/** The agent that wrote a replayed message, when the row names one (`StoredMessage.agentName`). */
|
|
1673
|
+
agentName?: string;
|
|
1674
|
+
/** The persona the turn that wrote a replayed message ran under (`StoredMessage.persona`). */
|
|
1675
|
+
persona?: string;
|
|
1656
1676
|
/** Host-defined keys: `StoredMessage.metadata` and the stream's `message-metadata` frames. */
|
|
1657
1677
|
[key: string]: unknown;
|
|
1658
1678
|
}
|
|
@@ -1697,6 +1717,10 @@ interface AgentMessageMetadata extends Partial<StoredTurnMetadata> {
|
|
|
1697
1717
|
declare function storedThreadToUiMessages(messages: StoredMessage[]): UIMessage[];
|
|
1698
1718
|
|
|
1699
1719
|
interface UseAgentChatOptions<B extends AgentBackend = AgentBackend> {
|
|
1720
|
+
uiCapabilities?: UiCapabilities;
|
|
1721
|
+
proposalPollMs?: number;
|
|
1722
|
+
/** Enable proposal reads even when history and resume are both disabled. */
|
|
1723
|
+
proposals?: boolean;
|
|
1700
1724
|
/**
|
|
1701
1725
|
* What the chat talks to — see {@link AgentBackend}. Omitted → the enclosing `<AgentProvider>`'s,
|
|
1702
1726
|
* else a same-origin client on `/agent`. Must be stable across renders.
|
|
@@ -1710,6 +1734,13 @@ interface UseAgentChatOptions<B extends AgentBackend = AgentBackend> {
|
|
|
1710
1734
|
reconnect?: ReconnectOptions | false;
|
|
1711
1735
|
/** Named agent to run each turn. */
|
|
1712
1736
|
agent?: string;
|
|
1737
|
+
/**
|
|
1738
|
+
* One of the agent's personas (`GET <base>/agents` lists them) to answer as. Read per send, so a
|
|
1739
|
+
* picker can switch it between messages; the server pins it on the thread, and `threadPersona`
|
|
1740
|
+
* reports it back. Omitted → the thread's pinned persona, else the agent's default. A single send
|
|
1741
|
+
* can name its own: `sendMessage(message, { body: { persona } })`.
|
|
1742
|
+
*/
|
|
1743
|
+
persona?: string;
|
|
1713
1744
|
/**
|
|
1714
1745
|
* Thread this chat is bound to. Omitted → the backend creates one on the first send
|
|
1715
1746
|
* ({@link UseAgentChatOptions.onThreadCreated}). Changing it switches the chat to that thread:
|
|
@@ -1939,6 +1970,7 @@ declare function useAgentChat<B extends AgentBackend = AgentBackend>(options?: U
|
|
|
1939
1970
|
addToolResult: ({ tool, toolCallId, output }: AddToolResultArgs) => void | PromiseLike<void>;
|
|
1940
1971
|
/** Sub-agents this conversation started and did not wait for. */
|
|
1941
1972
|
background: ChatBackground;
|
|
1973
|
+
proposals: ActionProposalsState;
|
|
1942
1974
|
runId: string | undefined;
|
|
1943
1975
|
/** The loaded thread's running turn, or `null` once read with none. */
|
|
1944
1976
|
activeRunId: string | null;
|
|
@@ -1971,13 +2003,18 @@ declare function useAgentChat<B extends AgentBackend = AgentBackend>(options?: U
|
|
|
1971
2003
|
queue: ChatQueue;
|
|
1972
2004
|
/** The model picker: `list`, `selected`, `select(id)`, `pinToThread(id)`. */
|
|
1973
2005
|
models: ChatModels;
|
|
2006
|
+
/**
|
|
2007
|
+
* The persona pinned on this thread (`ThreadSummary.persona`), or `null` when none is — what a
|
|
2008
|
+
* persona picker on a reopened thread starts from (`?? agent.defaultPersona`).
|
|
2009
|
+
*/
|
|
2010
|
+
threadPersona: string | null;
|
|
1974
2011
|
/** The caller's budget (`GET <base>/quota`); `quota.blocked` gates sends. */
|
|
1975
2012
|
quota: QuotaState;
|
|
1976
2013
|
/** The window blocking sends right now (the `blocked` option, else the quota report's). */
|
|
1977
2014
|
blocked: QuotaBlock | null;
|
|
1978
2015
|
cancel: () => Promise<void>;
|
|
1979
|
-
approve: ({ toolCallId, remember, via }: ApproveInput) => Promise<void>;
|
|
1980
|
-
reject: ({ toolCallId, reason, via }: RejectInput) => Promise<void>;
|
|
2016
|
+
approve: ({ toolCallId, target, remember, via }: ApproveInput) => Promise<void>;
|
|
2017
|
+
reject: ({ toolCallId, target, reason, via }: RejectInput) => Promise<void>;
|
|
1981
2018
|
answer: ({ toolCallId, answers, via }: AnswerInput) => Promise<void>;
|
|
1982
2019
|
skip: ({ toolCallId, via }: SkipInput) => Promise<void>;
|
|
1983
2020
|
regenerate: (_input?: Partial<MessageActionInput>) => void;
|
|
@@ -2006,4 +2043,11 @@ declare class QuotaBlockedError extends Error {
|
|
|
2006
2043
|
constructor(block: QuotaBlock);
|
|
2007
2044
|
}
|
|
2008
2045
|
|
|
2009
|
-
|
|
2046
|
+
interface ActionProposalsState {
|
|
2047
|
+
items: ActionProposal[];
|
|
2048
|
+
error: Error | null;
|
|
2049
|
+
refresh(): Promise<void>;
|
|
2050
|
+
}
|
|
2051
|
+
declare function useActionProposals(backend: AgentBackend, threadId: string | undefined, setMessages: (update: (current: UIMessage[]) => UIMessage[]) => void, refreshKey: string, pollMs?: number): ActionProposalsState;
|
|
2052
|
+
|
|
2053
|
+
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, useAgents, useAmbientRenderUi, useApprovalCountdown, useAttachments, useChatTranscript, useComposerAutocomplete, useElapsed, useMessageFeedback, useModels, useQuota, useSpeechRecognition, useStickToBottom, useThreads, useToolCatalog, useTranscriptItem };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
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-
|
|
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-
|
|
5
|
-
import { MessageAttachment, AgentClientConfig, AgentCatalogEntry, 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-B6EE8-AC.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-B6EE8-AC.js';
|
|
5
|
+
import { MessageAttachment, AgentClientConfig, AgentCatalogEntry, PersonaCatalogEntry, ModelCatalogEntry, ModelCatalogView, ModelCatalogLock, QuotaReport, QuotaWindow, QuotaBlock, QuotaWarning, MessageFeedback, MessageFeedbackValue, ThreadSummary, StoredMessage, QueuePause, ToolCatalogEntry, ActionProposal } 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 {
|
|
10
|
-
export {
|
|
9
|
+
import { UiCapabilities } from '@dudousxd/nestjs-agent-core/genui';
|
|
10
|
+
export { UiCapabilities } from '@dudousxd/nestjs-agent-core/genui';
|
|
11
|
+
import { o as GenuiProviderValue, T as TranscriptUiBlock, A as ApproveOptions, t as ApprovalTarget, v as TranscriptBlock, U as UsageSummary, w as TimestampInfo, C as ChatStatus, x as TranscriptFile, M as MessageUsageInfo, y as ToolCatalog, z as AnyToolUIPart } from './generative-ui-DOe2RsoO.js';
|
|
12
|
+
export { B as ApprovalBlockOptions, D as BuildBlocksOptions, E as CoercibleQuestion, F as DescribeToolCallOptions, H as ElicitationBlockOptions, I as GroupToolActivityOptions, J as RawAnswer, K as ResolvedReading, L as ResolvedResultView, N as RetrievedPassage, S as SettleAction, O as ToolActivityGroup, P as ToolCallDescription, Q as ToolCallState, V as ToolCallStatus, W as TranscriptApproval, X as TranscriptApprovalStatus, Y as TranscriptElicitationBlock, Z as TranscriptElicitationOutcome, _ as TranscriptFilesBlock, $ as TranscriptQuestion, a0 as TranscriptQuestionOption, a1 as TranscriptReasoningBlock, a2 as TranscriptSettleState, a3 as TranscriptSource, a4 as TranscriptSourcesBlock, a5 as TranscriptTextBlock, a6 as TranscriptToolBlock, a7 as TranscriptToolCall, a8 as buildTranscriptBlocks, a9 as coerceAnswer, aa as correctedCallIds, ab as describeTimestamp, ac as describeToolCall, ad as describeUsage, ae as extractMessageText, af as fillTemplate, ag as formatRelativeTime, ah as groupToolActivity, ai as inferResultView, aj as isActionCall, ak as phraseFor, al as proposalNeedsPolling, am as readPath, an as reconcileProposalMessages, ao as resolveResultView, ap as toolCallState, aq as toolCatalogFrom } from './generative-ui-DOe2RsoO.js';
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* The `code`s this library's own loop closes a failed run's stream with (`event: error`). A client
|
|
@@ -107,6 +109,8 @@ interface AgentChatTransportOptions {
|
|
|
107
109
|
credentials?: RequestCredentials;
|
|
108
110
|
/** Named agent to run the turn (backend `agent` field). */
|
|
109
111
|
agent?: string;
|
|
112
|
+
/** One of the agent's personas to answer as (backend `persona` field). */
|
|
113
|
+
persona?: string;
|
|
110
114
|
/**
|
|
111
115
|
* Extra body fields evaluated per send — the hook injects `threadId`
|
|
112
116
|
* and `pageContext` through this. Returned object is spread into the
|
|
@@ -406,7 +410,7 @@ interface AgUiChatStreamOptions {
|
|
|
406
410
|
/** Defaults to the global `fetch`, with `credentials: 'same-origin'`. */
|
|
407
411
|
fetch?: typeof fetch;
|
|
408
412
|
/**
|
|
409
|
-
* Shape `forwardedProps` from the send's body. Default: `{ pageContext, agent, model }` from the
|
|
413
|
+
* Shape `forwardedProps` from the send's body. Default: `{ pageContext, agent, model, persona, uiCapabilities }` from the
|
|
410
414
|
* body, whichever are present.
|
|
411
415
|
*/
|
|
412
416
|
forwardedProps?: (body: Record<string, unknown>) => unknown;
|
|
@@ -453,6 +457,8 @@ declare function reframeAgUiStream(source: ReadableStream<Uint8Array>, ids: {
|
|
|
453
457
|
}): ReadableStream<Uint8Array>;
|
|
454
458
|
|
|
455
459
|
interface AgentProviderProps {
|
|
460
|
+
/** Advertise exact supported component versions; omission keeps legacy support, [] is text only. */
|
|
461
|
+
uiCapabilities?: UiCapabilities;
|
|
456
462
|
/**
|
|
457
463
|
* A backend of your own — see {@link AgentBackend}. Omitted → an {@link AgentClient} over this
|
|
458
464
|
* library's REST routes, built from the connection props below (which are ignored when a backend
|
|
@@ -505,7 +511,7 @@ interface AgentProviderProps {
|
|
|
505
511
|
*
|
|
506
512
|
* Without a provider every hook shares one same-origin client on `/agent`.
|
|
507
513
|
*/
|
|
508
|
-
declare function AgentProvider({ backend, baseUrl, path, headers, getHeaders, credentials, fetch, onHttpError, attachments, genui, children, }: AgentProviderProps): React.JSX.Element;
|
|
514
|
+
declare function AgentProvider({ backend, uiCapabilities, baseUrl, path, headers, getHeaders, credentials, fetch, onHttpError, attachments, genui, children, }: AgentProviderProps): React.JSX.Element;
|
|
509
515
|
/**
|
|
510
516
|
* The backend a hook talks to: `own` when given, else the enclosing {@link AgentProvider}'s, else a
|
|
511
517
|
* shared same-origin client on `/agent`. For your own hooks over the same connection.
|
|
@@ -542,13 +548,21 @@ interface AgentsState {
|
|
|
542
548
|
agents: AgentCatalogEntry[];
|
|
543
549
|
/** The agent a turn runs as when none is named. */
|
|
544
550
|
defaultAgent: string | null;
|
|
551
|
+
/**
|
|
552
|
+
* An agent's personas — the data behind a persona picker. `agent` omitted → the default agent's.
|
|
553
|
+
* `[]` for an agent that declares none (or before the list loads).
|
|
554
|
+
*/
|
|
555
|
+
personasOf: (agent?: string) => PersonaCatalogEntry[];
|
|
556
|
+
/** The persona `agent` (default: the default agent) runs under when a send names none, or `null`. */
|
|
557
|
+
defaultPersonaOf: (agent?: string) => string | null;
|
|
545
558
|
isLoading: boolean;
|
|
546
559
|
error: Error | null;
|
|
547
560
|
refresh: () => Promise<void>;
|
|
548
561
|
}
|
|
549
562
|
/**
|
|
550
|
-
* The registered agents (`GET <base>/agents`) — the data behind an agent picker
|
|
551
|
-
* `useAgentChat({ agent })`, or pin it on
|
|
563
|
+
* The registered agents (`GET <base>/agents`) — the data behind an agent picker, and each agent's
|
|
564
|
+
* personas behind a persona picker. Send the pick as `useAgentChat({ agent, persona })`, or pin it on
|
|
565
|
+
* a thread with `PATCH <base>/threads/:id { defaultAgent, persona }`.
|
|
552
566
|
*/
|
|
553
567
|
declare function useAgents(options?: UseAgentsOptions): AgentsState;
|
|
554
568
|
|
|
@@ -966,12 +980,14 @@ interface SkipInput {
|
|
|
966
980
|
}
|
|
967
981
|
/** Approving a tool call parked on a human. */
|
|
968
982
|
interface ApproveInput extends ApproveOptions {
|
|
983
|
+
target?: ApprovalTarget;
|
|
969
984
|
toolCallId: string;
|
|
970
985
|
/** The surface the decision came through; the server records `'web'` when omitted. */
|
|
971
986
|
via?: string;
|
|
972
987
|
}
|
|
973
988
|
/** Rejecting a tool call parked on a human. */
|
|
974
989
|
interface RejectInput {
|
|
990
|
+
target?: ApprovalTarget;
|
|
975
991
|
toolCallId: string;
|
|
976
992
|
reason?: string;
|
|
977
993
|
via?: string;
|
|
@@ -1653,6 +1669,10 @@ interface AgentMessageMetadata extends Partial<StoredTurnMetadata> {
|
|
|
1653
1669
|
costUsd?: number | null;
|
|
1654
1670
|
/** ISO timestamp: the stored row's `createdAt` (a merged turn: its first row's), or when a live turn started streaming. */
|
|
1655
1671
|
createdAt?: string;
|
|
1672
|
+
/** The agent that wrote a replayed message, when the row names one (`StoredMessage.agentName`). */
|
|
1673
|
+
agentName?: string;
|
|
1674
|
+
/** The persona the turn that wrote a replayed message ran under (`StoredMessage.persona`). */
|
|
1675
|
+
persona?: string;
|
|
1656
1676
|
/** Host-defined keys: `StoredMessage.metadata` and the stream's `message-metadata` frames. */
|
|
1657
1677
|
[key: string]: unknown;
|
|
1658
1678
|
}
|
|
@@ -1697,6 +1717,10 @@ interface AgentMessageMetadata extends Partial<StoredTurnMetadata> {
|
|
|
1697
1717
|
declare function storedThreadToUiMessages(messages: StoredMessage[]): UIMessage[];
|
|
1698
1718
|
|
|
1699
1719
|
interface UseAgentChatOptions<B extends AgentBackend = AgentBackend> {
|
|
1720
|
+
uiCapabilities?: UiCapabilities;
|
|
1721
|
+
proposalPollMs?: number;
|
|
1722
|
+
/** Enable proposal reads even when history and resume are both disabled. */
|
|
1723
|
+
proposals?: boolean;
|
|
1700
1724
|
/**
|
|
1701
1725
|
* What the chat talks to — see {@link AgentBackend}. Omitted → the enclosing `<AgentProvider>`'s,
|
|
1702
1726
|
* else a same-origin client on `/agent`. Must be stable across renders.
|
|
@@ -1710,6 +1734,13 @@ interface UseAgentChatOptions<B extends AgentBackend = AgentBackend> {
|
|
|
1710
1734
|
reconnect?: ReconnectOptions | false;
|
|
1711
1735
|
/** Named agent to run each turn. */
|
|
1712
1736
|
agent?: string;
|
|
1737
|
+
/**
|
|
1738
|
+
* One of the agent's personas (`GET <base>/agents` lists them) to answer as. Read per send, so a
|
|
1739
|
+
* picker can switch it between messages; the server pins it on the thread, and `threadPersona`
|
|
1740
|
+
* reports it back. Omitted → the thread's pinned persona, else the agent's default. A single send
|
|
1741
|
+
* can name its own: `sendMessage(message, { body: { persona } })`.
|
|
1742
|
+
*/
|
|
1743
|
+
persona?: string;
|
|
1713
1744
|
/**
|
|
1714
1745
|
* Thread this chat is bound to. Omitted → the backend creates one on the first send
|
|
1715
1746
|
* ({@link UseAgentChatOptions.onThreadCreated}). Changing it switches the chat to that thread:
|
|
@@ -1939,6 +1970,7 @@ declare function useAgentChat<B extends AgentBackend = AgentBackend>(options?: U
|
|
|
1939
1970
|
addToolResult: ({ tool, toolCallId, output }: AddToolResultArgs) => void | PromiseLike<void>;
|
|
1940
1971
|
/** Sub-agents this conversation started and did not wait for. */
|
|
1941
1972
|
background: ChatBackground;
|
|
1973
|
+
proposals: ActionProposalsState;
|
|
1942
1974
|
runId: string | undefined;
|
|
1943
1975
|
/** The loaded thread's running turn, or `null` once read with none. */
|
|
1944
1976
|
activeRunId: string | null;
|
|
@@ -1971,13 +2003,18 @@ declare function useAgentChat<B extends AgentBackend = AgentBackend>(options?: U
|
|
|
1971
2003
|
queue: ChatQueue;
|
|
1972
2004
|
/** The model picker: `list`, `selected`, `select(id)`, `pinToThread(id)`. */
|
|
1973
2005
|
models: ChatModels;
|
|
2006
|
+
/**
|
|
2007
|
+
* The persona pinned on this thread (`ThreadSummary.persona`), or `null` when none is — what a
|
|
2008
|
+
* persona picker on a reopened thread starts from (`?? agent.defaultPersona`).
|
|
2009
|
+
*/
|
|
2010
|
+
threadPersona: string | null;
|
|
1974
2011
|
/** The caller's budget (`GET <base>/quota`); `quota.blocked` gates sends. */
|
|
1975
2012
|
quota: QuotaState;
|
|
1976
2013
|
/** The window blocking sends right now (the `blocked` option, else the quota report's). */
|
|
1977
2014
|
blocked: QuotaBlock | null;
|
|
1978
2015
|
cancel: () => Promise<void>;
|
|
1979
|
-
approve: ({ toolCallId, remember, via }: ApproveInput) => Promise<void>;
|
|
1980
|
-
reject: ({ toolCallId, reason, via }: RejectInput) => Promise<void>;
|
|
2016
|
+
approve: ({ toolCallId, target, remember, via }: ApproveInput) => Promise<void>;
|
|
2017
|
+
reject: ({ toolCallId, target, reason, via }: RejectInput) => Promise<void>;
|
|
1981
2018
|
answer: ({ toolCallId, answers, via }: AnswerInput) => Promise<void>;
|
|
1982
2019
|
skip: ({ toolCallId, via }: SkipInput) => Promise<void>;
|
|
1983
2020
|
regenerate: (_input?: Partial<MessageActionInput>) => void;
|
|
@@ -2006,4 +2043,11 @@ declare class QuotaBlockedError extends Error {
|
|
|
2006
2043
|
constructor(block: QuotaBlock);
|
|
2007
2044
|
}
|
|
2008
2045
|
|
|
2009
|
-
|
|
2046
|
+
interface ActionProposalsState {
|
|
2047
|
+
items: ActionProposal[];
|
|
2048
|
+
error: Error | null;
|
|
2049
|
+
refresh(): Promise<void>;
|
|
2050
|
+
}
|
|
2051
|
+
declare function useActionProposals(backend: AgentBackend, threadId: string | undefined, setMessages: (update: (current: UIMessage[]) => UIMessage[]) => void, refreshKey: string, pollMs?: number): ActionProposalsState;
|
|
2052
|
+
|
|
2053
|
+
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, useAgents, useAmbientRenderUi, useApprovalCountdown, useAttachments, useChatTranscript, useComposerAutocomplete, useElapsed, useMessageFeedback, useModels, useQuota, useSpeechRecognition, useStickToBottom, useThreads, useToolCatalog, useTranscriptItem };
|