@dudko.dev/agent-web-react 0.0.34 → 0.0.36

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,11 +1,107 @@
1
1
  import * as react from 'react';
2
2
  import { DependencyList, ReactNode, RefObject, ComponentType, CSSProperties } from 'react';
3
- import { RunFile, RunResult, Agent, ToolApprovalMode, AppToolCallRequest, AppSamplingRequest, AppSamplingView, AppSamplingResult, CompactResult, IUsage, AgentEventHandler, BrowserAgentConfig, VirtualFileInfo, VirtualFileSystem, CredentialStore, createWebLLMModel, WebLLMModelOptions, ModelTier, TierReason, EscalationReason, DecisionFallbackReason, AgentEvent, Skill, IPlan, ToolApprovalRequest, ToolApprovalContext, ToolApprovalDecision } from '@dudko.dev/agent-web';
4
- export { Agent, AgentEvent, AgentEventHandler, AgentLoggerSink, AgentTool, AgentToolSet, AppToolCallRequest, AttachmentsNotSupportedError, BrowserAgentConfig, CompactResult, CompactionConfig, CredentialStore, FileToolsOptions, IPlan, IPlanStep, IStepResult, IToolCall, IUsage, ImagesNotSupportedError, IndexedDBStore, LearningConfig, LogLevel, McpAppCsp, McpAppResource, McpAppToolResult, MemoryCredentialStore, MemorySkillStore, MemoryStore, ModelInput, ProviderModelSpec, ProviderType, RunControl, RunFile, RunOptions, RunResult, SessionBusyError, SessionHolder, SessionLockMode, SessionRunState, SessionWatch, Skill, SkillStore, StorageChange, StorageChangeKind, StorageChangeOp, SubagentInfo, SubagentToolOptions, SubagentWorkerConfig, ThinkingLevel, ThinkingSetting, TokenLimits, ToolApprovalConfig, ToolApprovalContext, ToolApprovalMode, ToolApprovalRequest, VaultCredentialStore, VfsSkillStore, VirtualFile, VirtualFileInfo, VirtualFileSystem, WatchSessionOptions, createAgent, createFileTools, createRunControl, createSubagentTool, createWebLLMModel, defineSkill, defineTool, isWebGPUAvailable, loadSkillFromUrl, markReadOnly, onStorageChange, parseSkillMarkdown, postStorageChange, preloadWebLLMModel, serveSubagentWorker, supportsImages, supportsPdf, unloadWebLLMModel, watchSession } from '@dudko.dev/agent-web';
5
- import { A as AgentUiState, C as ChatAttachment, a as ApprovalView, b as ChatMessage, c as AgentStatus, E as ElicitationIssueKind, d as ElicitationOutcomeReason, M as McpAppSandboxReason, R as RemoteRunView, L as LessonView, S as SubagentView, e as SubagentNode, P as PendingElicitation, f as McpElicitationResult, g as ElicitationView, W as WrittenFileView, T as ToolCallView, h as StepView, U as UserNoteView, D as DecisionView, i as MediaView, j as AppView, k as McpAppsConnectionLike, l as McpAppSandboxOptions, m as AppRequestView, n as TranscriptView, B as BudgetView, o as CompactionView, p as ModelLoadState, q as McpAppHost, r as AppRequestAnswerOptions } from './elicitation-BTrJ5t3c.cjs';
6
- export { s as APP_DEFAULT_HEIGHT, t as APP_MAX_HEIGHT, u as APP_MIN_HEIGHT, v as AppDownload, w as AppDownloadView, x as AppFileSaverEnv, y as AppLink, z as AppReadyDownload, F as AppResourceReader, G as ElicitationControl, H as ElicitationDraft, I as ElicitationDraftValue, J as ElicitationField, K as ElicitationFormOutcome, N as ElicitationIssue, O as ElicitationLink, Q as ElicitationOption, V as FetchView, X as MCP_APP_DISPLAY_MODES, Y as MCP_APP_MAX_ARGS_CHARS, Z as MCP_APP_MAX_DOWNLOAD_BYTES, _ as MCP_APP_MAX_FILE_NAME_CHARS, $ as MCP_APP_MAX_IN_FLIGHT, a0 as MCP_APP_MAX_MESSAGE_CHARS, a1 as MCP_APP_MAX_URL_CHARS, a2 as MCP_APP_NOTIFICATIONS, a3 as MCP_APP_OPTIONAL_REQUESTS, a4 as MCP_APP_PROTOCOL_VERSION, a5 as MCP_APP_REFUSED, a6 as MCP_APP_REFUSED_DOWNLOAD_EXTENSIONS, a7 as MCP_APP_REFUSED_DOWNLOAD_TYPES, a8 as MCP_APP_RELAY, a9 as MCP_APP_REQUESTS, aa as MCP_APP_SANDBOX_FRAME_TOKENS, ab as MCP_APP_SANDBOX_GRACE_MS, ac as MCP_APP_SANDBOX_SERVER, ad as MCP_APP_SANDBOX_TIMEOUT_MS, ae as McpAppBridge, af as McpAppBridgeHandlers, ag as McpAppBridgeOptions, ah as McpAppDisplayMode, ai as McpAppRpcError, aj as McpAppRpcMessage, ak as McpAppSandboxInput, al as McpAppSandboxLink, am as McpAppSandboxLinkOptions, an as McpAppSandboxTarget, ao as McpElicitationFieldSchema, ap as McpElicitationRequest, aq as McpElicitationSchema, ar as QueuedMessageView, as as ReplanState, at as SkillConsentView, au as StepEscalationView, av as UseMcpAppHostOptions, aw as appDisplayModeAllowed, ax as appDownloadOf, ay as appDownloadRefusal, az as appFileExtensionOf, aA as appFileNameOf, aB as appGestureOf, aC as appLinkOf, aD as appMessageTextOf, aE as appMimeTypeOf, aF as appSamplingErrorOf, aG as buildMcpAppDocument, aH as buildMcpAppSandboxShell, aI as clampAppHeight, aJ as elicitationFields, aK as elicitationFormAnswer, aL as elicitationInitialDraft, aM as elicitationLink, aN as formatCountdown, aO as grantedAppCsp, aP as mcpAppCsp, aQ as mcpAppHostCapabilities, aR as mcpAppSandboxProxyUrl, aS as mcpAppSandboxShellCsp, aT as mcpAppSandboxTarget, aU as resolveAppDownload, aV as saveAppFile, aW as useMcpAppHost } from './elicitation-BTrJ5t3c.cjs';
3
+ import { AskUserRequest, AskUserContext, AskUserAnswer, AskUserConfig, AskUserHandler, AgentEvent, RunFile, RunResult, Agent, ToolApprovalMode, AppToolCallRequest, AppSamplingRequest, AppSamplingView, AppSamplingResult, CompactResult, IUsage, AgentEventHandler, BrowserAgentConfig, VirtualFileInfo, VirtualFileSystem, CredentialStore, createWebLLMModel, WebLLMModelOptions, ModelTier, TierReason, EscalationReason, DecisionFallbackReason, Skill, IPlan, ToolApprovalRequest, ToolApprovalContext, ToolApprovalDecision } from '@dudko.dev/agent-web';
4
+ export { Agent, AgentEvent, AgentEventHandler, AgentLoggerSink, AgentTool, AgentToolSet, AppToolCallRequest, AskUserAnswer, AskUserConfig, AskUserContext, AskUserHandler, AskUserOption, AskUserRequest, AttachmentsNotSupportedError, BrowserAgentConfig, CompactResult, CompactionConfig, CredentialStore, FileToolsOptions, IPlan, IPlanStep, IStepResult, IToolCall, IUsage, ImagesNotSupportedError, IndexedDBStore, LearningConfig, LogLevel, McpAppCsp, McpAppResource, McpAppToolResult, MemoryCredentialStore, MemorySkillStore, MemoryStore, ModelInput, ProviderModelSpec, ProviderType, RunControl, RunFile, RunOptions, RunResult, SessionBusyError, SessionHolder, SessionLockMode, SessionRunState, SessionWatch, Skill, SkillStore, StorageChange, StorageChangeKind, StorageChangeOp, SubagentInfo, SubagentToolOptions, SubagentWorkerConfig, ThinkingLevel, ThinkingSetting, TokenLimits, ToolApprovalConfig, ToolApprovalContext, ToolApprovalMode, ToolApprovalRequest, VaultCredentialStore, VfsSkillStore, VirtualFile, VirtualFileInfo, VirtualFileSystem, WatchSessionOptions, createAgent, createFileTools, createRunControl, createSubagentTool, createWebLLMModel, defineSkill, defineTool, isWebGPUAvailable, loadSkillFromUrl, markReadOnly, onStorageChange, parseSkillMarkdown, postStorageChange, preloadWebLLMModel, serveSubagentWorker, supportsImages, supportsPdf, unloadWebLLMModel, watchSession } from '@dudko.dev/agent-web';
5
+ import { A as AgentUiState, C as ChatAttachment, a as ApprovalView, b as ChatMessage, c as AgentStatus, E as ElicitationIssueKind, d as ElicitationOutcomeReason, M as McpAppSandboxReason, R as RemoteRunView, L as LessonView, S as SubagentView, e as SubagentNode, P as PendingElicitation, f as McpElicitationResult, g as ElicitationView, W as WrittenFileView, T as ToolCallView, h as StepView, U as UserNoteView, D as DecisionView, i as MediaView, j as AppView, Q as QuestionView, k as McpAppsConnectionLike, l as McpAppSandboxOptions, m as AppRequestView, n as TranscriptView, B as BudgetView, o as CompactionView, p as ModelLoadState, q as McpAppHost, r as AppRequestAnswerOptions } from './elicitation-xMLll5W9.cjs';
6
+ export { s as APP_DEFAULT_HEIGHT, t as APP_MAX_HEIGHT, u as APP_MIN_HEIGHT, v as AppDownload, w as AppDownloadView, x as AppFileSaverEnv, y as AppLink, z as AppReadyDownload, F as AppResourceReader, G as ElicitationControl, H as ElicitationDraft, I as ElicitationDraftValue, J as ElicitationField, K as ElicitationFormOutcome, N as ElicitationIssue, O as ElicitationLink, V as ElicitationOption, X as FetchView, Y as MCP_APP_DISPLAY_MODES, Z as MCP_APP_MAX_ARGS_CHARS, _ as MCP_APP_MAX_DOWNLOAD_BYTES, $ as MCP_APP_MAX_FILE_NAME_CHARS, a0 as MCP_APP_MAX_IN_FLIGHT, a1 as MCP_APP_MAX_MESSAGE_CHARS, a2 as MCP_APP_MAX_URL_CHARS, a3 as MCP_APP_NOTIFICATIONS, a4 as MCP_APP_OPTIONAL_REQUESTS, a5 as MCP_APP_PROTOCOL_VERSION, a6 as MCP_APP_REFUSED, a7 as MCP_APP_REFUSED_DOWNLOAD_EXTENSIONS, a8 as MCP_APP_REFUSED_DOWNLOAD_TYPES, a9 as MCP_APP_RELAY, aa as MCP_APP_REQUESTS, ab as MCP_APP_SANDBOX_FRAME_TOKENS, ac as MCP_APP_SANDBOX_GRACE_MS, ad as MCP_APP_SANDBOX_SERVER, ae as MCP_APP_SANDBOX_TIMEOUT_MS, af as McpAppBridge, ag as McpAppBridgeHandlers, ah as McpAppBridgeOptions, ai as McpAppDisplayMode, aj as McpAppRpcError, ak as McpAppRpcMessage, al as McpAppSandboxInput, am as McpAppSandboxLink, an as McpAppSandboxLinkOptions, ao as McpAppSandboxTarget, ap as McpElicitationFieldSchema, aq as McpElicitationRequest, ar as McpElicitationSchema, as as QueuedMessageView, at as ReplanState, au as SkillConsentView, av as StepEscalationView, aw as UseMcpAppHostOptions, ax as appDisplayModeAllowed, ay as appDownloadOf, az as appDownloadRefusal, aA as appFileExtensionOf, aB as appFileNameOf, aC as appGestureOf, aD as appLinkOf, aE as appMessageTextOf, aF as appMimeTypeOf, aG as appSamplingErrorOf, aH as buildMcpAppDocument, aI as buildMcpAppSandboxShell, aJ as clampAppHeight, aK as elicitationFields, aL as elicitationFormAnswer, aM as elicitationInitialDraft, aN as elicitationLink, aO as formatCountdown, aP as grantedAppCsp, aQ as mcpAppCsp, aR as mcpAppHostCapabilities, aS as mcpAppSandboxProxyUrl, aT as mcpAppSandboxShellCsp, aU as mcpAppSandboxTarget, aV as resolveAppDownload, aW as saveAppFile, aX as useMcpAppHost } from './elicitation-xMLll5W9.cjs';
7
7
  export { M as MCP_APP_POLICY_TOKEN_MAX_CHARS, a as MCP_APP_SANDBOX_PROXY_READY, b as MCP_APP_SANDBOX_RESOURCE_READY, i as isMcpAppSandboxMessage, m as mcpAppPolicyToken } from './mcp-app-policy-DIUmGPJP.cjs';
8
8
 
9
+ /**
10
+ * The model asks the person ONE closed question (the core's `ask_user`, `config.askUser`): the
11
+ * part of it that is not React - the queue the hook hands the core as `askUser.onQuestion`, the
12
+ * answer a prompt builds, and what of a question's tool result may be kept.
13
+ *
14
+ * Pure: no React, no clock of its own (the queue takes `now`), no import of the core at run time
15
+ * (types only), so the main entry still loads next to an older core.
16
+ *
17
+ * Nothing here keeps, logs or returns what the person typed (`{ other }`) except to the one caller
18
+ * that hands it to the core: the queue passes an answer straight to the core's resolver, and
19
+ * {@link withoutOwnWords} takes the person's words out of the events before a view keeps them.
20
+ */
21
+ /** The core's tool name (`ASK_USER_TOOL`). */
22
+ declare const ASK_USER_TOOL_NAME = "ask_user";
23
+ /** The core's default for `askUser.timeoutMs` (`ASK_USER_TIMEOUT_MS`). */
24
+ declare const QUESTION_TIMEOUT_MS = 300000;
25
+ /**
26
+ * A question waiting for the person: the core's request (the question and every option are the
27
+ * MODEL's text, cleaned - show them as plain text), and when the core stops waiting for it.
28
+ */
29
+ interface PendingQuestion extends AskUserRequest {
30
+ /** Epoch ms after which the core answers it by itself ("did not answer in time"); absent: no limit. */
31
+ expiresAt?: number;
32
+ }
33
+ /**
34
+ * How long the core waits for an answer with this `askUser`; `undefined` = no limit of its own
35
+ * (`0`, `Infinity`, more than a timer holds - the core's own rules).
36
+ */
37
+ declare const questionTimeoutOf: (askUser: boolean | AskUserConfig | undefined) => number | undefined;
38
+ /**
39
+ * `config.askUser` as `useAgent` builds the agent with it: on without a handler of its own
40
+ * (`true`, `{ timeoutMs, maxPerRun }`) it gets `handler`; a host's own `onQuestion` wins, and off
41
+ * (absent, `false`) stays off - nothing is added, so the core mounts no tool.
42
+ */
43
+ declare const askUserWith: (askUser: boolean | AskUserConfig | undefined, handler: AskUserHandler) => boolean | AskUserConfig | undefined;
44
+ interface QuestionQueueOptions {
45
+ /**
46
+ * How long the core waits (ms), for `expiresAt`; `undefined` = no limit. A function is read when
47
+ * a question arrives (the settings of the agent that asks).
48
+ */
49
+ timeoutMs?: number | (() => number | undefined);
50
+ /** Called whenever the list of waiting questions changed. */
51
+ onChange?: (pending: PendingQuestion[]) => void;
52
+ /** The clock (tests). */
53
+ now?: () => number;
54
+ }
55
+ interface QuestionQueue {
56
+ /** The core's `askUser.onQuestion`: resolves when the person answers, or as `{ declined: true }`. */
57
+ handler: (request: AskUserRequest, ctx?: AskUserContext) => Promise<AskUserAnswer>;
58
+ /** The questions waiting, oldest first. */
59
+ pending: () => PendingQuestion[];
60
+ /** Answer one. False when no such question is waiting (answered, expired, cancelled). */
61
+ answer: (id: string, answer: AskUserAnswer) => boolean;
62
+ /**
63
+ * Take the waiting questions down - all of them, or those `match` picks - as declined (the run
64
+ * ended, it was stopped). The core has usually stopped waiting already; this only makes sure no
65
+ * resolver is left.
66
+ */
67
+ cancel: (match?: (question: PendingQuestion) => boolean) => void;
68
+ /** Cancel everything and stop reporting: the owner is gone. A later question is declined at once. */
69
+ dispose: () => void;
70
+ }
71
+ /**
72
+ * The questions the model is waiting on: `request.id → resolver`. A question leaves the queue
73
+ * exactly once - answered by the person, dropped because the core no longer wants the answer
74
+ * (`ctx.signal`: its time ran out, the run stopped), or cancelled by its owner (the run ended, an
75
+ * unmount) - and the queue never holds an answer: `answer` passes it straight to the resolver.
76
+ */
77
+ declare const createQuestionQueue: (options?: QuestionQueueOptions) => QuestionQueue;
78
+ /**
79
+ * Why a question ended without the person deciding: the core's `AskUserReason`
80
+ * (`handler-error`, `invalid-answer`, `cannot-park`), or its action (`timeout`, `stopped`).
81
+ */
82
+ type QuestionOutcomeReason = 'timeout' | 'stopped' | 'handler-error' | 'invalid-answer' | 'cannot-park';
83
+ /**
84
+ * The person's picks as the core's answer: the labels that were offered, in the order they were
85
+ * offered, each once - and one only unless the question allows several. `undefined` when nothing
86
+ * that was offered is picked (Send stays off).
87
+ */
88
+ declare const questionChoiceOf: (question: Pick<AskUserRequest, "options" | "multiple">, picked: readonly string[]) => AskUserAnswer | undefined;
89
+ /**
90
+ * The person's own words as the core's answer, when the question allows them and there is
91
+ * anything but spaces; `undefined` otherwise (Send stays off). The text goes to the caller only.
92
+ */
93
+ declare const questionOtherOf: (question: Pick<AskUserRequest, "allowOther">, text: string) => AskUserAnswer | undefined;
94
+ /** Whether an `ask_user` result may be kept by a view: it holds no word the person typed. */
95
+ declare const askUserOutputKept: (output: unknown, ok: boolean) => boolean;
96
+ /**
97
+ * The event with the person's own words taken out: the result of an `ask_user` call that is not
98
+ * known to hold labels only (an answer in their own words) loses its `output` - in
99
+ * `step.tool-result`, in `step.complete`'s tool calls, and in a subagent's events at any depth.
100
+ * Everything else comes back as it was (the same object). The model was given the words; the
101
+ * view, the saved chat and the event log are not.
102
+ */
103
+ declare const withoutOwnWords: (event: AgentEvent) => AgentEvent;
104
+
9
105
  interface UseAgentOptions {
10
106
  /**
11
107
  * Rebuild the agent when any of these values change — compared like a
@@ -29,6 +125,13 @@ interface UseAgentOptions {
29
125
  * (default true). Render them with `<ToolApprovalPrompt>`, or your own UI.
30
126
  */
31
127
  approvals?: boolean;
128
+ /**
129
+ * Route the model's questions (`ask_user`) into the hook (`pendingQuestions`,
130
+ * `answerQuestion`) when the config turns `askUser` on without an `onQuestion` of its own
131
+ * (`askUser: true`, or `{ timeoutMs, maxPerRun }`; default true). A host's own `onQuestion` wins;
132
+ * `askUser` off stays off. Render them with `<QuestionPrompt>`, or your own UI.
133
+ */
134
+ questions?: boolean;
32
135
  /**
33
136
  * What the run never showed the agent — a message sent while the answer was being
34
137
  * written — is sent as the next message, once the run has ended (default true).
@@ -119,6 +222,18 @@ interface UseAgentReturn extends AgentUiState {
119
222
  approve: (id: string, options?: ApproveOptions) => void;
120
223
  /** Refuse a pending call; the model is told and works around it. */
121
224
  deny: (id: string, reason?: string) => void;
225
+ /**
226
+ * The model's questions waiting for the person in THIS tab (`ask_user`, when the hook answers
227
+ * them - see `UseAgentOptions.questions`), oldest first, each with `expiresAt` when the core
228
+ * stops waiting. Another tab's questions are in `questions` (marked `remote`), never here.
229
+ */
230
+ pendingQuestions: PendingQuestion[];
231
+ /**
232
+ * Answer one: `{ choice: [label] }` (labels as offered; several only when `multiple`),
233
+ * `{ other: text }` (only when `allowOther`) or `{ declined: true }`. False when no such question
234
+ * is waiting (answered, expired, stopped). The answer goes to the core and is not kept here.
235
+ */
236
+ answerQuestion: (id: string, answer: AskUserAnswer) => boolean;
122
237
  /** The consent policy in effect. */
123
238
  approvalMode: ToolApprovalMode;
124
239
  /** Switch the consent policy live — the "autopilot" toggle. */
@@ -659,6 +774,25 @@ declare const attachmentRefusal: (kind: ComposerAttachment["kind"], caps: {
659
774
  pdf?: boolean;
660
775
  files?: boolean;
661
776
  } | undefined, canConvertPdf?: boolean) => string | undefined;
777
+ /** One run of a chip menu's rows that share a `section` (none: rows drawn without a heading). */
778
+ interface MenuSection<T> {
779
+ section?: string;
780
+ options: T[];
781
+ }
782
+ /**
783
+ * A chip menu's rows as the menu draws them: each run of rows that share a `section` under one
784
+ * heading, in the order given (the host orders them - the keyboard goes the same way). A section
785
+ * that comes back later is a new run: rows are never moved. Pure.
786
+ */
787
+ declare const menuSections: <T extends {
788
+ section?: string;
789
+ }>(options: readonly T[]) => MenuSection<T>[];
790
+ /**
791
+ * The row a key moves to in a menu of `count` rows from row `index` (-1: none focused): ArrowDown /
792
+ * ArrowUp to the next / previous (around the ends), Home / End to the first / last. Undefined for
793
+ * any other key, or an empty menu. Pure.
794
+ */
795
+ declare const menuKeyTarget: (key: string, index: number, count: number) => number | undefined;
662
796
  /** 950 → "0s", 61_000 → "1m 1s", 3_725_000 → "1h 2m". */
663
797
  declare const formatElapsed: (ms: number) => string;
664
798
  /** A banner above the input. */
@@ -996,6 +1130,31 @@ interface AgentLabels {
996
1130
  /** Why a question was answered without anybody deciding, by the core's reason (+ `stopped`). */
997
1131
  elicitationReasons: Record<ElicitationOutcomeReason, string>;
998
1132
  elicitationDismiss: string;
1133
+ /** The host's own line over the model's question. */
1134
+ questionLead: string;
1135
+ /** The same when a helper asks; `role` is what the model wrote for it. */
1136
+ questionLeadHelper: (role: string | undefined, depth: number) => string;
1137
+ /** "1 of 2" - several questions are waiting. */
1138
+ questionCount: (index: number, total: number) => string;
1139
+ /** Under a question that takes several options. */
1140
+ questionSeveral: string;
1141
+ /** Sends the options picked, or the person's own words. */
1142
+ questionSend: string;
1143
+ /** Opens the field for an answer in the person's own words. */
1144
+ questionOther: string;
1145
+ /** That field's label. */
1146
+ questionOtherLabel: string;
1147
+ /** No answer: the agent goes on with its best judgment. */
1148
+ questionSkip: string;
1149
+ /** "...in 4:05": when the agent stops waiting. */
1150
+ questionExpiresIn: (time: string) => string;
1151
+ /** A question asked by the run in another tab: shown here, answered there. */
1152
+ questionRemote: string;
1153
+ /** The agent went on without an answer; `reason` is one of `questionReasons`. */
1154
+ questionAutomatic: (reason: string) => string;
1155
+ /** Why, by the core's reason (+ `timeout`, `stopped`). */
1156
+ questionReasons: Record<QuestionOutcomeReason, string>;
1157
+ questionDismiss: string;
999
1158
  /** The host's label on an app's frame: "App from server “travel”". */
1000
1159
  appFrom: (server: string) => string;
1001
1160
  /** The badge beside it. */
@@ -1110,7 +1269,7 @@ interface AgentLabels {
1110
1269
  }
1111
1270
  declare const defaultLabels: AgentLabels;
1112
1271
  /** Overrides: any label, with the nested groups merged key by key. */
1113
- type AgentLabelsOverride = Partial<Omit<AgentLabels, 'status' | 'modes' | 'commandGroups' | 'commandDescriptions' | 'thinkingLevels' | 'notices' | 'tierNames' | 'tierReasons' | 'escalationReasons' | 'subagentStatus' | 'decisionReasons' | 'elicitationErrors' | 'elicitationReasons' | 'fileKinds' | 'appSandboxReasons'>> & {
1272
+ type AgentLabelsOverride = Partial<Omit<AgentLabels, 'status' | 'modes' | 'commandGroups' | 'commandDescriptions' | 'thinkingLevels' | 'notices' | 'tierNames' | 'tierReasons' | 'escalationReasons' | 'subagentStatus' | 'decisionReasons' | 'elicitationErrors' | 'elicitationReasons' | 'questionReasons' | 'fileKinds' | 'appSandboxReasons'>> & {
1114
1273
  status?: Partial<AgentLabels['status']>;
1115
1274
  modes?: Partial<AgentLabels['modes']>;
1116
1275
  commandGroups?: Partial<AgentLabels['commandGroups']>;
@@ -1124,6 +1283,7 @@ type AgentLabelsOverride = Partial<Omit<AgentLabels, 'status' | 'modes' | 'comma
1124
1283
  decisionReasons?: Partial<AgentLabels['decisionReasons']>;
1125
1284
  elicitationErrors?: Partial<AgentLabels['elicitationErrors']>;
1126
1285
  elicitationReasons?: Partial<AgentLabels['elicitationReasons']>;
1286
+ questionReasons?: Partial<AgentLabels['questionReasons']>;
1127
1287
  fileKinds?: Partial<AgentLabels['fileKinds']>;
1128
1288
  appSandboxReasons?: Partial<AgentLabels['appSandboxReasons']>;
1129
1289
  };
@@ -1276,15 +1436,24 @@ declare const pendingApprovalsOf: (state: Pick<AgentUiState, "approvals">) => Ap
1276
1436
  declare const agentStatusOf: (state: Pick<AgentUiState, "status" | "remote">) => AgentUiState["status"];
1277
1437
  declare const agentStateReducer: (state: AgentUiState, action: AgentAction) => AgentUiState;
1278
1438
 
1439
+ /** One row of the model chip's menu. */
1440
+ interface ComposerModelOption {
1441
+ id: string;
1442
+ label: string;
1443
+ /** A short note at the end of the row (a family, the roles it plays...). */
1444
+ group?: string;
1445
+ /**
1446
+ * The section the row is drawn in: consecutive rows with the same `section` go under one
1447
+ * heading (a `role="group"` named by it), in the order given - the arrow keys go the same way.
1448
+ * Rows without one are drawn without a heading.
1449
+ */
1450
+ section?: string;
1451
+ }
1279
1452
  interface ComposerModelChip {
1280
1453
  /** What the chip says, e.g. "Gemini 3.5 Flash". */
1281
1454
  label: string;
1282
1455
  /** Models to switch to from the chip's menu (omit for a read-only label). */
1283
- options?: {
1284
- id: string;
1285
- label: string;
1286
- group?: string;
1287
- }[];
1456
+ options?: ComposerModelOption[];
1288
1457
  value?: string;
1289
1458
  onSelect?: (id: string) => void;
1290
1459
  }
@@ -1850,6 +2019,53 @@ declare const AttachmentView: ({ attachment: a }: {
1850
2019
  */
1851
2020
  declare const MessageList: ({ messages, empty, showActivity, showToolCalls, showUsage, showThoughts, showNotes, showLearned, showTiers, showReplanFailed, showDecisions, showSearchResults, showSubagents, showMedia, showFileChips, files, htmlPreview, onShowFiles, renderFile, renderFileContent, renderMedia, renderSubagent, onStopSubagent, activityOpen, liveExtra, renderContent, renderMessage, renderAttachment, renderToolCall, renderApp, showApps, imageViewer, renderImageViewer, labels, className, }: MessageListProps) => react.JSX.Element | null;
1852
2021
 
2022
+ interface QuestionPromptProps {
2023
+ /**
2024
+ * The model's questions waiting for the person (`useAgent().pendingQuestions`, or the requests
2025
+ * your own `askUser.onQuestion` was given). One is shown at a time, oldest first, with a count.
2026
+ */
2027
+ questions: PendingQuestion[];
2028
+ /**
2029
+ * The person's answer: `{ choice: [label, ...] }`, `{ other: text }` or `{ declined: true }`.
2030
+ * Wire it to `useAgent().answerQuestion`. What was typed goes to this callback and nowhere else.
2031
+ */
2032
+ onAnswer: (id: string, answer: AskUserAnswer) => void;
2033
+ /**
2034
+ * The run's questions as the reducer keeps them (`useAgent().questions`): the ones the agent
2035
+ * went on without (no answer in time, a failure) are said so, a helper's role is named, and
2036
+ * one asked in another tab is shown without its buttons.
2037
+ */
2038
+ outcomes?: QuestionView[];
2039
+ /** Say which questions the agent went on without (default true; needs `outcomes`). */
2040
+ showOutcomes?: boolean;
2041
+ /** The note of when the agent stops waiting, with the time left (default true). */
2042
+ showExpiry?: boolean;
2043
+ /** Say that a helper is the one that asks (default true). */
2044
+ showHelper?: boolean;
2045
+ /** Show a question asked by the run in another tab, without buttons (default true). */
2046
+ showRemote?: boolean;
2047
+ /** Keys 1-6 pick an option while the card has the focus (default true). */
2048
+ numberKeys?: boolean;
2049
+ /**
2050
+ * Render a question yourself: `fallback` is the built-in card, `answer` decides it. The
2051
+ * question and its options are the MODEL's text - render them as text.
2052
+ */
2053
+ renderQuestion?: (question: PendingQuestion, fallback: ReactNode, answer: (answer: AskUserAnswer) => void) => ReactNode;
2054
+ labels?: AgentLabelsOverride;
2055
+ className?: string;
2056
+ }
2057
+ /**
2058
+ * A question the agent's MODEL puts to the person (the core's `ask_user`, `config.askUser`): the
2059
+ * question, one button per option, "Other…" for an answer in their own words when the model
2060
+ * allowed one, and Skip. Shown in the transcript where the run is, not as a modal; keys 1-6 pick
2061
+ * an option while the card has the focus. Everything the model wrote is plain text.
2062
+ *
2063
+ * Wire it to {@link useAgent}'s `pendingQuestions` and `answerQuestion` (with `askUser` on in its
2064
+ * config); `<AgentChat>` renders it for you. What the person types is kept in the card only and
2065
+ * handed to `onAnswer` once: it is not in the agent's state, its events or the transcript.
2066
+ */
2067
+ declare const QuestionPrompt: ({ questions, onAnswer, outcomes, showOutcomes, showExpiry, showHelper, showRemote, numberKeys, renderQuestion, labels, className, }: QuestionPromptProps) => react.JSX.Element | null;
2068
+
1853
2069
  interface ToolApprovalPromptProps {
1854
2070
  /** Pending requests (e.g. `agent.pendingApprovals`). */
1855
2071
  approvals: ApprovalView[];
@@ -1907,6 +2123,7 @@ interface AgentChatComponents {
1907
2123
  FilesPanel?: ComponentType<FilesPanelProps>;
1908
2124
  ApprovalPrompt?: ComponentType<ToolApprovalPromptProps>;
1909
2125
  ElicitationPrompt?: ComponentType<ElicitationPromptProps>;
2126
+ QuestionPrompt?: ComponentType<QuestionPromptProps>;
1910
2127
  }
1911
2128
  /** Extra class names per part (added to the built-in `awr-` ones). */
1912
2129
  interface AgentChatClassNames {
@@ -1997,6 +2214,13 @@ interface AgentChatProps {
1997
2214
  * (default true). Shown once `elicitations` and `onElicitationAnswer` are given.
1998
2215
  */
1999
2216
  showElicitation?: boolean;
2217
+ /**
2218
+ * The questions the agent's model puts to the person (`ask_user`, with `askUser` on in the
2219
+ * agent's config), where the consent cards are (default true): the question, its options as
2220
+ * buttons, Other… and Skip. In a tab that follows another tab's run, the question is shown
2221
+ * without buttons - it is answered there.
2222
+ */
2223
+ showQuestions?: boolean;
2000
2224
  /**
2001
2225
  * In the consent card of an MCP server's skill: the collapsible preview of the instructions
2002
2226
  * the agent would read (default true; `<ToolApprovalPrompt showSkillPreview>`).
@@ -2053,6 +2277,8 @@ interface AgentChatProps {
2053
2277
  renderApproval?: ToolApprovalPromptProps['renderApproval'];
2054
2278
  /** A server's question (gets the built-in card as `fallback`, and `answer`). */
2055
2279
  renderElicitation?: ElicitationPromptProps['renderElicitation'];
2280
+ /** A question of the agent's (gets the built-in card as `fallback`, and `answer`). */
2281
+ renderQuestion?: QuestionPromptProps['renderQuestion'];
2056
2282
  slots?: AgentChatSlots;
2057
2283
  /**
2058
2284
  * How a picture in the transcript opens: in the image viewer over the chat (default true),
@@ -2600,5 +2826,5 @@ interface AppRequestPromptProps {
2600
2826
  */
2601
2827
  declare const AppRequestPrompt: ({ requests, onAnswer, renderRequest, labels, className, }: AppRequestPromptProps) => react.JSX.Element | null;
2602
2828
 
2603
- export { AgentChat, AgentComposer, AgentLabelsProvider, AgentProvider, AgentStatus, AgentUiState, ApiKeyForm, AppRequestAnswerOptions, AppRequestPrompt, AppRequestView, AppView, ApprovalModeSwitch, ApprovalView, AttachmentView, BudgetView, ChatAttachment, ChatHistoryList, ChatHistoryStore, ChatMessage, CompactionView, Composer, ContextMeter, DecisionView, ElicitationIssueKind, ElicitationOutcomeReason, ElicitationPrompt, ElicitationView, FILE_PREVIEW_CHARS, FOLLOW_LEAVE_PX, FOLLOW_REJOIN_PX, FRAME_MAX_HEIGHT, FRAME_MIN_HEIGHT, FileChip, FileChips, FilesPanel, GeneratedMedia, HTML_PREVIEW_MAX_CHARS, ImageThumb, ImageViewer, ImageViewerProvider, LearnedSkills, LessonView, McpAppFrame, McpAppHost, McpAppLine, McpAppSandboxOptions, McpAppSandboxReason, McpAppsConnectionLike, McpElicitationResult, MediaView, MessageList, ModelLoadBar, ModelLoadState, PendingElicitation, PlanView, RemoteRunView, SandboxedFrame, SourceView, StepList, StepView, SubagentNode, SubagentRow, SubagentTree, SubagentView, ToolApprovalPrompt, ToolCallRow, ToolCallView, TranscriptBlock, TranscriptView, UsageBadge, UserNoteRow, UserNoteView, agentStateReducer, agentStatusOf, attachmentKindOf, attachmentRefusal, buildSandboxedDocument, chatTitle, clampFrameHeight, createApprovalQueue, createInitialAgentState, createWebLLMEngine, decisionNote, defaultLabels, downscaleImage, escapeAttribute, fileKindOf, fileNameOf, filterCommands, followsAfterResize, followsAfterScroll, formatElapsed, imageExtensionOf, lessonsOf, linkedFilesOf, mediaFamilyOf, mergeChatRecord, mergeLabels, newChatId, noticesOf, parseSlash, pendingApprovalsOf, sandboxTokens, sandboxedCsp, saveChat, steerIntent, subagentTree, tokenizeHtml, unchangedSince, usageLine, useAgent, useAgentContext, useChatHistory, useCredentials, useFollowScroll, useLabels, useLocalModel, useOptionalAgentContext, useSpeechToText, useVirtualFiles, useWebLLMModel, webSearchOf, withAttachments, withCspFirst, withPolicyFirst };
2604
- export type { AgentAction, AgentChatClassNames, AgentChatComponents, AgentChatProps, AgentChatSlots, AgentComposerProps, AgentLabels, AgentLabelsOverride, AgentLabelsProviderProps, AgentProviderProps, ApiKeyFormProps, AppRequestPromptProps, ApprovalModeSwitchProps, ApprovalQueue, ApproveOptions, ChatBase, ChatHistoryListProps, ChatHistoryStoreOptions, ChatRecord, ChatSummary, ComposerAttachment, ComposerModelChip, ComposerNotice, ComposerProps, ComposerThinkingChip, ContextMeterProps, ConvertedFile, DownscaleOptions, ElicitationPromptProps, FileChipProps, FileChipsProps, FileKind, FilesPanelProps, GeneratedMediaProps, HtmlPreviewOptions, ImageThumbProps, ImageViewerProps, LearnedSkillsProps, LocalModelEngine, LocalModelLoadContext, LocalModelProgress, McpAppFrameProps, McpAppLineProps, MessageListProps, ModelLoadBarProps, NoticeTexts, PlanViewProps, RenderImageViewer, RenderSubagent, RenderToolCall, RunGoalOptions, SandboxedDocumentOptions, SandboxedFrameProps, ScrollMeasure, SlashCommand, SourceToken, SourceViewProps, SpeechRecognizerLike, SteerIntent, StepListProps, SubagentRowProps, SubagentTreeProps, ToolApprovalPromptProps, ToolCallRowProps, TranscriptBlockProps, UsageBadgeProps, UseAgentOptions, UseAgentReturn, UseChatHistoryOptions, UseChatHistoryReturn, UseCredentialsReturn, UseLocalModelOptions, UseLocalModelReturn, UseSpeechToTextOptions, UseSpeechToTextReturn, UseVirtualFilesReturn, UseWebLLMModelOptions, UseWebLLMModelReturn, ViewerImage, WebLLMModelFactory, WebSearchResultView, WebSearchView };
2829
+ export { ASK_USER_TOOL_NAME, AgentChat, AgentComposer, AgentLabelsProvider, AgentProvider, AgentStatus, AgentUiState, ApiKeyForm, AppRequestAnswerOptions, AppRequestPrompt, AppRequestView, AppView, ApprovalModeSwitch, ApprovalView, AttachmentView, BudgetView, ChatAttachment, ChatHistoryList, ChatHistoryStore, ChatMessage, CompactionView, Composer, ContextMeter, DecisionView, ElicitationIssueKind, ElicitationOutcomeReason, ElicitationPrompt, ElicitationView, FILE_PREVIEW_CHARS, FOLLOW_LEAVE_PX, FOLLOW_REJOIN_PX, FRAME_MAX_HEIGHT, FRAME_MIN_HEIGHT, FileChip, FileChips, FilesPanel, GeneratedMedia, HTML_PREVIEW_MAX_CHARS, ImageThumb, ImageViewer, ImageViewerProvider, LearnedSkills, LessonView, McpAppFrame, McpAppHost, McpAppLine, McpAppSandboxOptions, McpAppSandboxReason, McpAppsConnectionLike, McpElicitationResult, MediaView, MessageList, ModelLoadBar, ModelLoadState, PendingElicitation, PlanView, QUESTION_TIMEOUT_MS, QuestionPrompt, QuestionView, RemoteRunView, SandboxedFrame, SourceView, StepList, StepView, SubagentNode, SubagentRow, SubagentTree, SubagentView, ToolApprovalPrompt, ToolCallRow, ToolCallView, TranscriptBlock, TranscriptView, UsageBadge, UserNoteRow, UserNoteView, agentStateReducer, agentStatusOf, askUserOutputKept, askUserWith, attachmentKindOf, attachmentRefusal, buildSandboxedDocument, chatTitle, clampFrameHeight, createApprovalQueue, createInitialAgentState, createQuestionQueue, createWebLLMEngine, decisionNote, defaultLabels, downscaleImage, escapeAttribute, fileKindOf, fileNameOf, filterCommands, followsAfterResize, followsAfterScroll, formatElapsed, imageExtensionOf, lessonsOf, linkedFilesOf, mediaFamilyOf, menuKeyTarget, menuSections, mergeChatRecord, mergeLabels, newChatId, noticesOf, parseSlash, pendingApprovalsOf, questionChoiceOf, questionOtherOf, questionTimeoutOf, sandboxTokens, sandboxedCsp, saveChat, steerIntent, subagentTree, tokenizeHtml, unchangedSince, usageLine, useAgent, useAgentContext, useChatHistory, useCredentials, useFollowScroll, useLabels, useLocalModel, useOptionalAgentContext, useSpeechToText, useVirtualFiles, useWebLLMModel, webSearchOf, withAttachments, withCspFirst, withPolicyFirst, withoutOwnWords };
2830
+ export type { AgentAction, AgentChatClassNames, AgentChatComponents, AgentChatProps, AgentChatSlots, AgentComposerProps, AgentLabels, AgentLabelsOverride, AgentLabelsProviderProps, AgentProviderProps, ApiKeyFormProps, AppRequestPromptProps, ApprovalModeSwitchProps, ApprovalQueue, ApproveOptions, ChatBase, ChatHistoryListProps, ChatHistoryStoreOptions, ChatRecord, ChatSummary, ComposerAttachment, ComposerModelChip, ComposerModelOption, ComposerNotice, ComposerProps, ComposerThinkingChip, ContextMeterProps, ConvertedFile, DownscaleOptions, ElicitationPromptProps, FileChipProps, FileChipsProps, FileKind, FilesPanelProps, GeneratedMediaProps, HtmlPreviewOptions, ImageThumbProps, ImageViewerProps, LearnedSkillsProps, LocalModelEngine, LocalModelLoadContext, LocalModelProgress, McpAppFrameProps, McpAppLineProps, MenuSection, MessageListProps, ModelLoadBarProps, NoticeTexts, PendingQuestion, PlanViewProps, QuestionOutcomeReason, QuestionPromptProps, QuestionQueue, QuestionQueueOptions, RenderImageViewer, RenderSubagent, RenderToolCall, RunGoalOptions, SandboxedDocumentOptions, SandboxedFrameProps, ScrollMeasure, SlashCommand, SourceToken, SourceViewProps, SpeechRecognizerLike, SteerIntent, StepListProps, SubagentRowProps, SubagentTreeProps, ToolApprovalPromptProps, ToolCallRowProps, TranscriptBlockProps, UsageBadgeProps, UseAgentOptions, UseAgentReturn, UseChatHistoryOptions, UseChatHistoryReturn, UseCredentialsReturn, UseLocalModelOptions, UseLocalModelReturn, UseSpeechToTextOptions, UseSpeechToTextReturn, UseVirtualFilesReturn, UseWebLLMModelOptions, UseWebLLMModelReturn, ViewerImage, WebLLMModelFactory, WebSearchResultView, WebSearchView };