@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/README.md CHANGED
@@ -200,6 +200,7 @@ function Custom() {
200
200
  | `finalText` / `finalReasoning` | the streamed answer and its thoughts |
201
201
  | `usage` / `totalUsage` | tokens of this run / of the conversation, by kind - plus `mediaCalls` and `decisionCalls` (calls, not tokens) when the run made some |
202
202
  | `pendingApprovals`, `approve(id, { remember })`, `deny(id)` | tool consent (a request made by a helper the model started carries `subagent: { id, depth, name?, role? }`). A request the core stops waiting for - no decision within `toolApproval.timeoutMs` (default five minutes), the run stopped - is settled by the core and leaves the list; a late `approve` does nothing |
203
+ | `pendingQuestions`, `answerQuestion(id, answer)` | the model's questions to the person (the core's `ask_user`, with `askUser` on in the config - see [Questions from the agent](#questions-from-the-agent--ask_user)): the ones waiting in THIS tab, oldest first (`PendingQuestion`: the core's request - `id`, `question`, `options`, `multiple`, `allowOther`, `step?`, `subagent?` - plus `expiresAt`). `answerQuestion` takes `{ choice: [label] }`, `{ other: text }` or `{ declined: true }` and returns false when the question is no longer waiting. How each ended is `questions` (`QuestionView[]`; never what was typed) |
203
204
  | `approvalMode` / `setApprovalMode(mode)` | the autopilot switch, live |
204
205
  | `approveAppToolCall(call, signal)` / `sampleForApp(request, approve, signal)` | for MCP Apps: an app's tool call through the agent's consent gate; an app's `sampling/createMessage` answered by the agent's model (the core's `Agent.sampleForApp`: checked, rate-limited, put to `approve`, no tools, none of the chat; its tokens count in `totalUsage` only, the answer goes to the caller only) - `<AgentChat>` wires both |
205
206
  | `compact()` | summarise the stored transcript now |
@@ -214,7 +215,9 @@ function Custom() {
214
215
 
215
216
  **Options:** `deps` (rebuild the agent when these change — e.g. on a model
216
217
  switch), `onEvent` (tap the raw event stream), `autoStart`, `maxEvents`,
217
- `approvals` (route consent requests into the hook; default true), `watch` (follow the
218
+ `approvals` (route consent requests into the hook; default true), `questions` (answer the
219
+ model's `ask_user` questions in the hook when `askUser` is on without an `onQuestion` of the
220
+ host's; default true), `watch` (follow the
218
221
  conversation's run in another tab of the site - default true; needs a `memory` the tabs share,
219
222
  `IndexedDBStore`). The queue behind `approve` /
220
223
  `deny` is exported for a host that builds the core's agent itself: `createApprovalQueue()` gives
@@ -536,7 +539,7 @@ Two notes:
536
539
  hooks is what puts it in your build.
537
540
  - `oauthSupported` is `false` on cores older than `@dudko.dev/agent-web@0.0.9`,
538
541
  which introduced `BrowserOAuthProvider`; header auth still works there. The
539
- peer floor is `>=0.0.44` — the first core with several tabs (`onStorageChange`, `watchSession`, the session lock), after MCP Apps (`approveAppToolCall`,
542
+ peer floor is `>=0.0.46` — the first core with `askUser` (the model's questions: `ask_user`, `user.question-*`), after several tabs (`onStorageChange`, `watchSession`, the session lock), MCP Apps (`approveAppToolCall`,
540
543
  `sampleForApp`), MCP skills with consent, `file.written`, elicitation and the
541
544
  OAuth `registration` choice this package's chat and hooks use, on top of model
542
545
  tiers, dynamic subagents, media and decision models, pipelines, the learning
@@ -725,6 +728,51 @@ A host that calls the core's `connectMcpHttp` itself can use the same queue the
725
728
  > NAMES only), its events, the transcript, a saved chat or a log. The core sends it to the server
726
729
  > that asked and nowhere else - never to the model.
727
730
 
731
+ ## Questions from the agent — `ask_user`
732
+
733
+ With the core's `askUser` on, the **model** may ask the person ONE closed question with 2-6
734
+ options instead of guessing (the core's built-in `ask_user` tool; off by default - see the
735
+ [core's docs](https://github.com/dudko-dev/agents/blob/main/packages/agent-web/docs/capabilities.md#asking-the-user-a-question-with-choices)).
736
+ `useAgent` answers it when the config turns it on without a handler of its own:
737
+
738
+ ```tsx
739
+ const agent = useAgent({ model, tools, askUser: true }) // or { timeoutMs, maxPerRun }
740
+ <AgentChat controller={agent} /> // the question card appears where the consent cards are
741
+ // or anywhere: <QuestionPrompt questions={agent.pendingQuestions}
742
+ // onAnswer={agent.answerQuestion} outcomes={agent.questions} />
743
+ ```
744
+
745
+ - **Who answers.** `askUser: true` (or an object without `onQuestion`) makes the hook supply
746
+ `onQuestion` - its queue (`createQuestionQueue`, exported for a host that builds the agent
747
+ itself) - and the questions land in `pendingQuestions`. A host's own `askUser.onQuestion` wins
748
+ (then nothing reaches `pendingQuestions`); `askUser` off stays off, and the core mounts no tool.
749
+ `useAgent(config, { questions: false })` keeps the hook out of it.
750
+ - **`<QuestionPrompt>`** draws one question at a time, with a count: the host's own line ("The
751
+ agent asks you", or which helper asks), the model's question, one button per option with its
752
+ description under it, and **Skip**. A single choice is answered by its button; with `multiple`
753
+ the options are toggles and **Send** sends them; with `allowOther` an **Other…** button opens a
754
+ field for the person's own words. Keys 1-6 pick an option while the card has the focus (Tab
755
+ reaches every button, Enter presses it, Esc closes the field), the card is a `role="group"`
756
+ named by the question, every target is at least 40 px tall, and nothing scrolls sideways at
757
+ 320 px. Under it: the time left ("If you do not answer, the agent decides by itself in 4:59").
758
+ - **Without an answer.** A question waits the core's `askUser.timeoutMs` (default five minutes;
759
+ the step's own limit stops meanwhile); then the core tells the model the person did not answer,
760
+ and the card says the agent went on without the answer, and why - as it does for a handler that
761
+ failed. Stop ends the wait at once (and the card goes, without a note). A run ending takes every
762
+ question still open down.
763
+ - **Several tabs.** A question is answered only in the tab that runs the agent: a tab following
764
+ that run shows the question without its buttons ("Answered in the other tab…"), and "It waits
765
+ for an answer in the other tab." above the composer.
766
+
767
+ > **Security.** The question and every option are the MODEL's text (the core cleans them of
768
+ > control and bidirectional characters): the card shows them as text nodes, never as markup.
769
+ > What the person types in Other… stays in the card's own state until Send hands it to
770
+ > `answerQuestion`, which passes it to the core and keeps nothing. The core gives it to the model
771
+ > as the tool's result; the reducer takes it out of everything it keeps (`withoutOwnWords`: an
772
+ > `ask_user` result that is not known to hold labels only loses its `output` in the steps, the
773
+ > transcript, a saved chat and the event log), and the core's `user.question-answered` event never
774
+ > carries it. A host tapping `onEvent` sees the core's raw `step.tool-result`, words included.
775
+
728
776
  ## MCP Apps — a server's interface in the chat
729
777
 
730
778
  `apps: true` (on `useMcp` or `useMcpServers`) declares the [MCP Apps](https://github.com/modelcontextprotocol/ext-apps)
@@ -797,7 +845,7 @@ use them standalone. The full guide: [docs/chat.md](docs/chat.md).
797
845
  | Component | Purpose |
798
846
  | --- | --- |
799
847
  | `<AgentChat>` | Full panel: transcript with per-answer activity + composer + optional history and files panels. Reads a `controller` prop or the `<AgentProvider>` context. Says when the conversation runs in another tab of the site, waits for an answer there, or waits for it (`showOtherTabs`). |
800
- | `<AgentComposer>` | The input and its toolbar: attachments, commands, timer, agents, model/thinking, consent, mic, send/stop. |
848
+ | `<AgentComposer>` | The input and its toolbar: attachments, commands, timer, agents, model/thinking, consent, mic, send/stop. The model menu takes `section` per option (a heading over each run of options, e.g. one per provider); both chip menus work from the keyboard (arrows, Home / End, Escape) - see [docs/chat.md](docs/chat.md#the-model-menu-sections-and-keys). |
801
849
  | `<MessageList>` | The transcript; each answer with its steps, tool calls, thoughts, usage. |
802
850
  | `<StepList>` / `<ToolCallRow>` | Execution steps / one tool call with its cost and images. With model tiers: the tier / model badge, the escalation line, the earlier attempt's calls (`showTiers`); a replanner failure as a warning (`showReplanFailed`); the decision model's note (`showDecisions`); the subagent tree under its step (`showSubagents`); a `web_search` call's results as plain text and safe links (`showSearchResults`). |
803
851
  | `<SubagentTree>` / `<SubagentRow>` | The run's subagents - static ones and the helpers the model started - as an indented tree: status, model, tokens, time and a Stop button per node (`onStop`, `showUsage`, `showTools`, `renderSubagent`). |
@@ -807,6 +855,7 @@ use them standalone. The full guide: [docs/chat.md](docs/chat.md).
807
855
  | `<SandboxedFrame>` / `<SourceView>` | Untrusted HTML inside chrome the host draws: `<iframe sandbox>` without `allow-same-origin`, by `srcdoc`, no network, fixed height (`html`, `scripts`, `title`, `label`, `actions`, `footer`, `height`) / a file's text with line numbers, never markup. See [the boundary](#the-html-preview-is-a-security-boundary). |
808
856
  | `<ToolApprovalPrompt>` | Consent cards (Allow once / Always / Deny); a helper's request says which helper asks (`showHelper`); an MCP App's says the APP asks, with the server's own tool name; an MCP server's skill gets its own card (the server, the skill, a collapsed preview of its text - `showSkillPreview` - and Allow once / Always for this server / Deny). |
809
857
  | `<ElicitationPrompt>` | A question an MCP server puts to the user during a tool call: a form (Submit / Decline / Cancel, checked by the core's rules) or a link opened only by a click, one at a time with a count, the time left, and the questions nobody answered (`elicitations`, `onAnswer`, `outcomes`, `showOutcomes`, `showExpiry`, `showHelper`, `renderElicitation`). See [MCP elicitation](#mcp-elicitation--a-server-asks-the-user). |
858
+ | `<QuestionPrompt>` | A question the agent's model puts to the person (`ask_user`): its options as buttons (a description under each), toggles and Send when several may be picked, Other… for an answer in the person's own words, Skip, keys 1-6, the time left, and the questions the agent went on without; another tab's question without buttons (`questions`, `onAnswer`, `outcomes`, `showOutcomes`, `showExpiry`, `showHelper`, `showRemote`, `numberKeys`, `renderQuestion`). See [Questions from the agent](#questions-from-the-agent--ask_user). |
810
859
  | `<McpAppFrame>` / `<McpAppLine>` | An MCP App in host-drawn chrome ("App from server “travel” · sandboxed", panel, menu: reload / open in panel / hide): an opaque-origin frame - or, with `host.sandbox` (`useMcpAppHost({ sandbox })`, `<AgentChat appSandbox>`), an origin of its own behind your sandbox page ("· sandboxed on its own origin") - network only to the origins its resource declared, a bridge with an allow-list; inline, folded, in a panel or - with `allowFullscreen`, asked for by the app after a click in it - full screen over the chat with Exit / Esc (`app`, `host`, `variant`, `theme`, `defaultCollapsed`, `onOpenPanel`, `onClosePanel`, `showCalls`, `allowFullscreen`). `<AgentChat mcpApps>` places them under the answer. See [the boundary](#an-mcp-app-is-a-security-boundary). |
811
860
  | `<AppRequestPrompt>` | What an MCP App asks for besides a tool call: a link (its host highlighted, opened only on the user's click), a message (put in the message box as a draft, never sent for the user), a file (its sanitized name, type and size; saved by the page on Save file) or an answer of the agent's model (the app's text as text, the token cap; Allow once / Always for this app / Deny). |
812
861
  | `<ApprovalModeSwitch>` | Segmented consent-mode switch. |
@@ -1,4 +1,4 @@
1
- import { McpAppCsp, McpAppResource, McpAppToolResult, AppSamplingView, AppToolCallRequest, AppSamplingRequest, AppSamplingResult, AgentToolSet, IPlan, IPlanStep, ModelTier, TierReason, EscalationReason, DecisionPoint, DecisionFallbackReason, McpSkillConsentView, IUsage, ReplanMode, AgentEvent, SessionHolder } from '@dudko.dev/agent-web';
1
+ import { McpAppCsp, McpAppResource, McpAppToolResult, AppSamplingView, AppToolCallRequest, AppSamplingRequest, AppSamplingResult, AgentToolSet, IPlan, IPlanStep, ModelTier, TierReason, EscalationReason, DecisionPoint, DecisionFallbackReason, McpSkillConsentView, IUsage, AskUserOption, AskUserAction, ReplanMode, AgentEvent, SessionHolder } from '@dudko.dev/agent-web';
2
2
 
3
3
  /**
4
4
  * MCP Apps, the host's side: the security core of `<McpAppFrame>`, as pure code - no React, no
@@ -1164,6 +1164,44 @@ interface ElicitationView {
1164
1164
  /** The names of the fields an accepted form was answered with. */
1165
1165
  fields?: string[];
1166
1166
  }
1167
+ /**
1168
+ * A question the MODEL put to the person (the core's `ask_user`, `config.askUser`; its
1169
+ * `user.question-*` events): the question and the options are the model's text, cleaned - show
1170
+ * them as plain text, never as markup. The view never holds what the person typed: an answer in
1171
+ * their own words is `status: 'other'` and nothing more; `choice` holds labels that were offered.
1172
+ */
1173
+ interface QuestionView {
1174
+ /** The question's id: the same as `AskUserRequest.id` handed to `onQuestion`. */
1175
+ id: string;
1176
+ question: string;
1177
+ options: AskUserOption[];
1178
+ /** The person may pick several options. */
1179
+ multiple: boolean;
1180
+ /** The person may answer in their own words. */
1181
+ allowOther: boolean;
1182
+ /** The step whose tool call asks (for a helper's question: the step that delegated it). */
1183
+ stepId?: string;
1184
+ /**
1185
+ * Set when a helper or a subagent asks, not the run itself: its id (a node of `subagents`), its
1186
+ * depth, and - when its `subagent.start` was seen - its name and role.
1187
+ */
1188
+ subagent?: {
1189
+ id: string;
1190
+ depth: number;
1191
+ name?: string;
1192
+ role?: string;
1193
+ };
1194
+ /** Asked in another tab, by a run followed here (`AgentUiState.remote`): answered there only. */
1195
+ remote?: true;
1196
+ /** `pending`, then how it ended (the core's `AskUserAction`). */
1197
+ status: 'pending' | AskUserAction;
1198
+ /** Ended without anybody deciding: a time limit, a stop, a failed handler, an unusable answer. */
1199
+ automatic?: boolean;
1200
+ /** `status: 'choice'`: the labels picked. */
1201
+ choice?: string[];
1202
+ /** Why it ended `declined` automatically (the core's `AskUserReason`), or `stopped`. */
1203
+ reason?: string;
1204
+ }
1167
1205
  /** A message sent to the agent while it works, still waiting for a boundary to be shown to the model. */
1168
1206
  interface QueuedMessageView {
1169
1207
  id: string;
@@ -1343,6 +1381,12 @@ interface AgentUiState {
1343
1381
  * transcript, so a saved conversation never holds a server's form.
1344
1382
  */
1345
1383
  elicitations?: ElicitationView[];
1384
+ /**
1385
+ * Questions the model put to the person in this run (`ask_user`, `config.askUser`), in the
1386
+ * order they were asked, a helper's included; absent until the first one. Per-run view only:
1387
+ * they are not copied into the transcript, and none holds what the person typed.
1388
+ */
1389
+ questions?: QuestionView[];
1346
1390
  /** Messages sent while the run goes that have not yet been shown to the model. */
1347
1391
  queued: QueuedMessageView[];
1348
1392
  /** What the user said during this run and when it reached the agent. */
@@ -1597,5 +1641,5 @@ type ElicitationOutcomeReason = 'timeout' | 'step-timeout' | 'aborted' | 'stoppe
1597
1641
  /** "4:05" - what is left of a question's time. */
1598
1642
  declare const formatCountdown: (ms: number) => string;
1599
1643
 
1600
- export { MCP_APP_MAX_IN_FLIGHT as $, MCP_APP_DISPLAY_MODES as X, MCP_APP_MAX_ARGS_CHARS as Y, MCP_APP_MAX_DOWNLOAD_BYTES as Z, MCP_APP_MAX_FILE_NAME_CHARS as _, MCP_APP_MAX_MESSAGE_CHARS as a0, MCP_APP_MAX_URL_CHARS as a1, MCP_APP_NOTIFICATIONS as a2, MCP_APP_OPTIONAL_REQUESTS as a3, MCP_APP_PROTOCOL_VERSION as a4, MCP_APP_REFUSED as a5, MCP_APP_REFUSED_DOWNLOAD_EXTENSIONS as a6, MCP_APP_REFUSED_DOWNLOAD_TYPES as a7, MCP_APP_RELAY as a8, MCP_APP_REQUESTS as a9, appFileNameOf as aA, appGestureOf as aB, appLinkOf as aC, appMessageTextOf as aD, appMimeTypeOf as aE, appSamplingErrorOf as aF, buildMcpAppDocument as aG, buildMcpAppSandboxShell as aH, clampAppHeight as aI, elicitationFields as aJ, elicitationFormAnswer as aK, elicitationInitialDraft as aL, elicitationLink as aM, formatCountdown as aN, grantedAppCsp as aO, mcpAppCsp as aP, mcpAppHostCapabilities as aQ, mcpAppSandboxProxyUrl as aR, mcpAppSandboxShellCsp as aS, mcpAppSandboxTarget as aT, resolveAppDownload as aU, saveAppFile as aV, useMcpAppHost as aW, MCP_APP_SANDBOX_FRAME_TOKENS as aa, MCP_APP_SANDBOX_GRACE_MS as ab, MCP_APP_SANDBOX_SERVER as ac, MCP_APP_SANDBOX_TIMEOUT_MS as ad, McpAppBridge as ae, McpAppRpcError as ai, McpAppSandboxLink as al, appDisplayModeAllowed as aw, appDownloadOf as ax, appDownloadRefusal as ay, appFileExtensionOf as az, createElicitationQueue as bb, elicitationConnectOptions as bc, elicitationSettings as bd, elicitationTimeoutOf as be, APP_DEFAULT_HEIGHT as s, APP_MAX_HEIGHT as t, APP_MIN_HEIGHT as u };
1601
- export type { AgentUiState as A, BudgetView as B, ChatAttachment as C, DecisionView as D, ElicitationIssueKind as E, AppResourceReader as F, ElicitationControl as G, ElicitationDraft as H, ElicitationDraftValue as I, ElicitationField as J, ElicitationFormOutcome as K, LessonView as L, McpAppSandboxReason as M, ElicitationIssue as N, ElicitationLink as O, PendingElicitation as P, ElicitationOption as Q, RemoteRunView as R, SubagentView as S, ToolCallView as T, UserNoteView as U, FetchView as V, WrittenFileView as W, ApprovalView as a, McpServerProtocol as a$, McpOAuthRegistration as aX, McpProtocolMode as aY, McpElicitationOptions as aZ, McpCatalogEntry as a_, McpAppBridgeHandlers as af, McpAppBridgeOptions as ag, McpAppDisplayMode as ah, McpAppRpcMessage as aj, McpAppSandboxInput as ak, McpAppSandboxLinkOptions as am, McpAppSandboxTarget as an, McpElicitationFieldSchema as ao, McpElicitationRequest as ap, McpElicitationSchema as aq, QueuedMessageView as ar, ReplanState as as, SkillConsentView as at, StepEscalationView as au, UseMcpAppHostOptions as av, ChatMessage as b, McpOAuthRegistrationKind as b0, McpOAuthCallback as b1, McpServerResult as b2, McpModule as b3, ConnectedMcp as b4, BrowserOAuthProviderOptions as b5, BrowserOAuthProvider as b6, ElicitationQueue as b7, ElicitationQueueOptions as b8, McpElicitationHandler as b9, McpServerInstructions as ba, AgentStatus as c, ElicitationOutcomeReason as d, SubagentNode as e, McpElicitationResult as f, ElicitationView as g, StepView as h, MediaView as i, AppView as j, McpAppsConnectionLike as k, McpAppSandboxOptions as l, AppRequestView as m, TranscriptView as n, CompactionView as o, ModelLoadState as p, McpAppHost as q, AppRequestAnswerOptions as r, AppDownload as v, AppDownloadView as w, AppFileSaverEnv as x, AppLink as y, AppReadyDownload as z };
1644
+ export { MCP_APP_MAX_FILE_NAME_CHARS as $, MCP_APP_DISPLAY_MODES as Y, MCP_APP_MAX_ARGS_CHARS as Z, MCP_APP_MAX_DOWNLOAD_BYTES as _, MCP_APP_MAX_IN_FLIGHT as a0, MCP_APP_MAX_MESSAGE_CHARS as a1, MCP_APP_MAX_URL_CHARS as a2, MCP_APP_NOTIFICATIONS as a3, MCP_APP_OPTIONAL_REQUESTS as a4, MCP_APP_PROTOCOL_VERSION as a5, MCP_APP_REFUSED as a6, MCP_APP_REFUSED_DOWNLOAD_EXTENSIONS as a7, MCP_APP_REFUSED_DOWNLOAD_TYPES as a8, MCP_APP_RELAY as a9, appFileExtensionOf as aA, appFileNameOf as aB, appGestureOf as aC, appLinkOf as aD, appMessageTextOf as aE, appMimeTypeOf as aF, appSamplingErrorOf as aG, buildMcpAppDocument as aH, buildMcpAppSandboxShell as aI, clampAppHeight as aJ, elicitationFields as aK, elicitationFormAnswer as aL, elicitationInitialDraft as aM, elicitationLink as aN, formatCountdown as aO, grantedAppCsp as aP, mcpAppCsp as aQ, mcpAppHostCapabilities as aR, mcpAppSandboxProxyUrl as aS, mcpAppSandboxShellCsp as aT, mcpAppSandboxTarget as aU, resolveAppDownload as aV, saveAppFile as aW, useMcpAppHost as aX, MCP_APP_REQUESTS as aa, MCP_APP_SANDBOX_FRAME_TOKENS as ab, MCP_APP_SANDBOX_GRACE_MS as ac, MCP_APP_SANDBOX_SERVER as ad, MCP_APP_SANDBOX_TIMEOUT_MS as ae, McpAppBridge as af, McpAppRpcError as aj, McpAppSandboxLink as am, appDisplayModeAllowed as ax, appDownloadOf as ay, appDownloadRefusal as az, createElicitationQueue as bc, elicitationConnectOptions as bd, elicitationSettings as be, elicitationTimeoutOf as bf, APP_DEFAULT_HEIGHT as s, APP_MAX_HEIGHT as t, APP_MIN_HEIGHT as u };
1645
+ export type { AgentUiState as A, BudgetView as B, ChatAttachment as C, DecisionView as D, ElicitationIssueKind as E, AppResourceReader as F, ElicitationControl as G, ElicitationDraft as H, ElicitationDraftValue as I, ElicitationField as J, ElicitationFormOutcome as K, LessonView as L, McpAppSandboxReason as M, ElicitationIssue as N, ElicitationLink as O, PendingElicitation as P, QuestionView as Q, RemoteRunView as R, SubagentView as S, ToolCallView as T, UserNoteView as U, ElicitationOption as V, WrittenFileView as W, FetchView as X, ApprovalView as a, McpCatalogEntry as a$, McpOAuthRegistration as aY, McpProtocolMode as aZ, McpElicitationOptions as a_, McpAppBridgeHandlers as ag, McpAppBridgeOptions as ah, McpAppDisplayMode as ai, McpAppRpcMessage as ak, McpAppSandboxInput as al, McpAppSandboxLinkOptions as an, McpAppSandboxTarget as ao, McpElicitationFieldSchema as ap, McpElicitationRequest as aq, McpElicitationSchema as ar, QueuedMessageView as as, ReplanState as at, SkillConsentView as au, StepEscalationView as av, UseMcpAppHostOptions as aw, ChatMessage as b, McpServerProtocol as b0, McpOAuthRegistrationKind as b1, McpOAuthCallback as b2, McpServerResult as b3, McpModule as b4, ConnectedMcp as b5, BrowserOAuthProviderOptions as b6, BrowserOAuthProvider as b7, ElicitationQueue as b8, ElicitationQueueOptions as b9, McpElicitationHandler as ba, McpServerInstructions as bb, AgentStatus as c, ElicitationOutcomeReason as d, SubagentNode as e, McpElicitationResult as f, ElicitationView as g, StepView as h, MediaView as i, AppView as j, McpAppsConnectionLike as k, McpAppSandboxOptions as l, AppRequestView as m, TranscriptView as n, CompactionView as o, ModelLoadState as p, McpAppHost as q, AppRequestAnswerOptions as r, AppDownload as v, AppDownloadView as w, AppFileSaverEnv as x, AppLink as y, AppReadyDownload as z };
@@ -1,4 +1,4 @@
1
- import { McpAppCsp, McpAppResource, McpAppToolResult, AppSamplingView, AppToolCallRequest, AppSamplingRequest, AppSamplingResult, AgentToolSet, IPlan, IPlanStep, ModelTier, TierReason, EscalationReason, DecisionPoint, DecisionFallbackReason, McpSkillConsentView, IUsage, ReplanMode, AgentEvent, SessionHolder } from '@dudko.dev/agent-web';
1
+ import { McpAppCsp, McpAppResource, McpAppToolResult, AppSamplingView, AppToolCallRequest, AppSamplingRequest, AppSamplingResult, AgentToolSet, IPlan, IPlanStep, ModelTier, TierReason, EscalationReason, DecisionPoint, DecisionFallbackReason, McpSkillConsentView, IUsage, AskUserOption, AskUserAction, ReplanMode, AgentEvent, SessionHolder } from '@dudko.dev/agent-web';
2
2
 
3
3
  /**
4
4
  * MCP Apps, the host's side: the security core of `<McpAppFrame>`, as pure code - no React, no
@@ -1164,6 +1164,44 @@ interface ElicitationView {
1164
1164
  /** The names of the fields an accepted form was answered with. */
1165
1165
  fields?: string[];
1166
1166
  }
1167
+ /**
1168
+ * A question the MODEL put to the person (the core's `ask_user`, `config.askUser`; its
1169
+ * `user.question-*` events): the question and the options are the model's text, cleaned - show
1170
+ * them as plain text, never as markup. The view never holds what the person typed: an answer in
1171
+ * their own words is `status: 'other'` and nothing more; `choice` holds labels that were offered.
1172
+ */
1173
+ interface QuestionView {
1174
+ /** The question's id: the same as `AskUserRequest.id` handed to `onQuestion`. */
1175
+ id: string;
1176
+ question: string;
1177
+ options: AskUserOption[];
1178
+ /** The person may pick several options. */
1179
+ multiple: boolean;
1180
+ /** The person may answer in their own words. */
1181
+ allowOther: boolean;
1182
+ /** The step whose tool call asks (for a helper's question: the step that delegated it). */
1183
+ stepId?: string;
1184
+ /**
1185
+ * Set when a helper or a subagent asks, not the run itself: its id (a node of `subagents`), its
1186
+ * depth, and - when its `subagent.start` was seen - its name and role.
1187
+ */
1188
+ subagent?: {
1189
+ id: string;
1190
+ depth: number;
1191
+ name?: string;
1192
+ role?: string;
1193
+ };
1194
+ /** Asked in another tab, by a run followed here (`AgentUiState.remote`): answered there only. */
1195
+ remote?: true;
1196
+ /** `pending`, then how it ended (the core's `AskUserAction`). */
1197
+ status: 'pending' | AskUserAction;
1198
+ /** Ended without anybody deciding: a time limit, a stop, a failed handler, an unusable answer. */
1199
+ automatic?: boolean;
1200
+ /** `status: 'choice'`: the labels picked. */
1201
+ choice?: string[];
1202
+ /** Why it ended `declined` automatically (the core's `AskUserReason`), or `stopped`. */
1203
+ reason?: string;
1204
+ }
1167
1205
  /** A message sent to the agent while it works, still waiting for a boundary to be shown to the model. */
1168
1206
  interface QueuedMessageView {
1169
1207
  id: string;
@@ -1343,6 +1381,12 @@ interface AgentUiState {
1343
1381
  * transcript, so a saved conversation never holds a server's form.
1344
1382
  */
1345
1383
  elicitations?: ElicitationView[];
1384
+ /**
1385
+ * Questions the model put to the person in this run (`ask_user`, `config.askUser`), in the
1386
+ * order they were asked, a helper's included; absent until the first one. Per-run view only:
1387
+ * they are not copied into the transcript, and none holds what the person typed.
1388
+ */
1389
+ questions?: QuestionView[];
1346
1390
  /** Messages sent while the run goes that have not yet been shown to the model. */
1347
1391
  queued: QueuedMessageView[];
1348
1392
  /** What the user said during this run and when it reached the agent. */
@@ -1597,5 +1641,5 @@ type ElicitationOutcomeReason = 'timeout' | 'step-timeout' | 'aborted' | 'stoppe
1597
1641
  /** "4:05" - what is left of a question's time. */
1598
1642
  declare const formatCountdown: (ms: number) => string;
1599
1643
 
1600
- export { MCP_APP_MAX_IN_FLIGHT as $, MCP_APP_DISPLAY_MODES as X, MCP_APP_MAX_ARGS_CHARS as Y, MCP_APP_MAX_DOWNLOAD_BYTES as Z, MCP_APP_MAX_FILE_NAME_CHARS as _, MCP_APP_MAX_MESSAGE_CHARS as a0, MCP_APP_MAX_URL_CHARS as a1, MCP_APP_NOTIFICATIONS as a2, MCP_APP_OPTIONAL_REQUESTS as a3, MCP_APP_PROTOCOL_VERSION as a4, MCP_APP_REFUSED as a5, MCP_APP_REFUSED_DOWNLOAD_EXTENSIONS as a6, MCP_APP_REFUSED_DOWNLOAD_TYPES as a7, MCP_APP_RELAY as a8, MCP_APP_REQUESTS as a9, appFileNameOf as aA, appGestureOf as aB, appLinkOf as aC, appMessageTextOf as aD, appMimeTypeOf as aE, appSamplingErrorOf as aF, buildMcpAppDocument as aG, buildMcpAppSandboxShell as aH, clampAppHeight as aI, elicitationFields as aJ, elicitationFormAnswer as aK, elicitationInitialDraft as aL, elicitationLink as aM, formatCountdown as aN, grantedAppCsp as aO, mcpAppCsp as aP, mcpAppHostCapabilities as aQ, mcpAppSandboxProxyUrl as aR, mcpAppSandboxShellCsp as aS, mcpAppSandboxTarget as aT, resolveAppDownload as aU, saveAppFile as aV, useMcpAppHost as aW, MCP_APP_SANDBOX_FRAME_TOKENS as aa, MCP_APP_SANDBOX_GRACE_MS as ab, MCP_APP_SANDBOX_SERVER as ac, MCP_APP_SANDBOX_TIMEOUT_MS as ad, McpAppBridge as ae, McpAppRpcError as ai, McpAppSandboxLink as al, appDisplayModeAllowed as aw, appDownloadOf as ax, appDownloadRefusal as ay, appFileExtensionOf as az, createElicitationQueue as bb, elicitationConnectOptions as bc, elicitationSettings as bd, elicitationTimeoutOf as be, APP_DEFAULT_HEIGHT as s, APP_MAX_HEIGHT as t, APP_MIN_HEIGHT as u };
1601
- export type { AgentUiState as A, BudgetView as B, ChatAttachment as C, DecisionView as D, ElicitationIssueKind as E, AppResourceReader as F, ElicitationControl as G, ElicitationDraft as H, ElicitationDraftValue as I, ElicitationField as J, ElicitationFormOutcome as K, LessonView as L, McpAppSandboxReason as M, ElicitationIssue as N, ElicitationLink as O, PendingElicitation as P, ElicitationOption as Q, RemoteRunView as R, SubagentView as S, ToolCallView as T, UserNoteView as U, FetchView as V, WrittenFileView as W, ApprovalView as a, McpServerProtocol as a$, McpOAuthRegistration as aX, McpProtocolMode as aY, McpElicitationOptions as aZ, McpCatalogEntry as a_, McpAppBridgeHandlers as af, McpAppBridgeOptions as ag, McpAppDisplayMode as ah, McpAppRpcMessage as aj, McpAppSandboxInput as ak, McpAppSandboxLinkOptions as am, McpAppSandboxTarget as an, McpElicitationFieldSchema as ao, McpElicitationRequest as ap, McpElicitationSchema as aq, QueuedMessageView as ar, ReplanState as as, SkillConsentView as at, StepEscalationView as au, UseMcpAppHostOptions as av, ChatMessage as b, McpOAuthRegistrationKind as b0, McpOAuthCallback as b1, McpServerResult as b2, McpModule as b3, ConnectedMcp as b4, BrowserOAuthProviderOptions as b5, BrowserOAuthProvider as b6, ElicitationQueue as b7, ElicitationQueueOptions as b8, McpElicitationHandler as b9, McpServerInstructions as ba, AgentStatus as c, ElicitationOutcomeReason as d, SubagentNode as e, McpElicitationResult as f, ElicitationView as g, StepView as h, MediaView as i, AppView as j, McpAppsConnectionLike as k, McpAppSandboxOptions as l, AppRequestView as m, TranscriptView as n, CompactionView as o, ModelLoadState as p, McpAppHost as q, AppRequestAnswerOptions as r, AppDownload as v, AppDownloadView as w, AppFileSaverEnv as x, AppLink as y, AppReadyDownload as z };
1644
+ export { MCP_APP_MAX_FILE_NAME_CHARS as $, MCP_APP_DISPLAY_MODES as Y, MCP_APP_MAX_ARGS_CHARS as Z, MCP_APP_MAX_DOWNLOAD_BYTES as _, MCP_APP_MAX_IN_FLIGHT as a0, MCP_APP_MAX_MESSAGE_CHARS as a1, MCP_APP_MAX_URL_CHARS as a2, MCP_APP_NOTIFICATIONS as a3, MCP_APP_OPTIONAL_REQUESTS as a4, MCP_APP_PROTOCOL_VERSION as a5, MCP_APP_REFUSED as a6, MCP_APP_REFUSED_DOWNLOAD_EXTENSIONS as a7, MCP_APP_REFUSED_DOWNLOAD_TYPES as a8, MCP_APP_RELAY as a9, appFileExtensionOf as aA, appFileNameOf as aB, appGestureOf as aC, appLinkOf as aD, appMessageTextOf as aE, appMimeTypeOf as aF, appSamplingErrorOf as aG, buildMcpAppDocument as aH, buildMcpAppSandboxShell as aI, clampAppHeight as aJ, elicitationFields as aK, elicitationFormAnswer as aL, elicitationInitialDraft as aM, elicitationLink as aN, formatCountdown as aO, grantedAppCsp as aP, mcpAppCsp as aQ, mcpAppHostCapabilities as aR, mcpAppSandboxProxyUrl as aS, mcpAppSandboxShellCsp as aT, mcpAppSandboxTarget as aU, resolveAppDownload as aV, saveAppFile as aW, useMcpAppHost as aX, MCP_APP_REQUESTS as aa, MCP_APP_SANDBOX_FRAME_TOKENS as ab, MCP_APP_SANDBOX_GRACE_MS as ac, MCP_APP_SANDBOX_SERVER as ad, MCP_APP_SANDBOX_TIMEOUT_MS as ae, McpAppBridge as af, McpAppRpcError as aj, McpAppSandboxLink as am, appDisplayModeAllowed as ax, appDownloadOf as ay, appDownloadRefusal as az, createElicitationQueue as bc, elicitationConnectOptions as bd, elicitationSettings as be, elicitationTimeoutOf as bf, APP_DEFAULT_HEIGHT as s, APP_MAX_HEIGHT as t, APP_MIN_HEIGHT as u };
1645
+ export type { AgentUiState as A, BudgetView as B, ChatAttachment as C, DecisionView as D, ElicitationIssueKind as E, AppResourceReader as F, ElicitationControl as G, ElicitationDraft as H, ElicitationDraftValue as I, ElicitationField as J, ElicitationFormOutcome as K, LessonView as L, McpAppSandboxReason as M, ElicitationIssue as N, ElicitationLink as O, PendingElicitation as P, QuestionView as Q, RemoteRunView as R, SubagentView as S, ToolCallView as T, UserNoteView as U, ElicitationOption as V, WrittenFileView as W, FetchView as X, ApprovalView as a, McpCatalogEntry as a$, McpOAuthRegistration as aY, McpProtocolMode as aZ, McpElicitationOptions as a_, McpAppBridgeHandlers as ag, McpAppBridgeOptions as ah, McpAppDisplayMode as ai, McpAppRpcMessage as ak, McpAppSandboxInput as al, McpAppSandboxLinkOptions as an, McpAppSandboxTarget as ao, McpElicitationFieldSchema as ap, McpElicitationRequest as aq, McpElicitationSchema as ar, QueuedMessageView as as, ReplanState as at, SkillConsentView as au, StepEscalationView as av, UseMcpAppHostOptions as aw, ChatMessage as b, McpServerProtocol as b0, McpOAuthRegistrationKind as b1, McpOAuthCallback as b2, McpServerResult as b3, McpModule as b4, ConnectedMcp as b5, BrowserOAuthProviderOptions as b6, BrowserOAuthProvider as b7, ElicitationQueue as b8, ElicitationQueueOptions as b9, McpElicitationHandler as ba, McpServerInstructions as bb, AgentStatus as c, ElicitationOutcomeReason as d, SubagentNode as e, McpElicitationResult as f, ElicitationView as g, StepView as h, MediaView as i, AppView as j, McpAppsConnectionLike as k, McpAppSandboxOptions as l, AppRequestView as m, TranscriptView as n, CompactionView as o, ModelLoadState as p, McpAppHost as q, AppRequestAnswerOptions as r, AppDownload as v, AppDownloadView as w, AppFileSaverEnv as x, AppLink as y, AppReadyDownload as z };