@dudko.dev/agent-web-react 0.0.42 → 0.0.44

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.ts CHANGED
@@ -2,9 +2,9 @@ import * as react from 'react';
2
2
  import { DependencyList, ReactNode, RefObject, ComponentType, CSSProperties } from 'react';
3
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
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-Dp6Fi6ZA.js';
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-Dp6Fi6ZA.js';
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.js';
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 McpAppDisplayMode, s as AppRequestAnswerOptions } from './elicitation-DCr7b6IH.js';
6
+ export { t as APP_DEFAULT_HEIGHT, u as APP_HEIGHT_CEILING, v as APP_HEIGHT_SCREENS, w as APP_MAX_HEIGHT, x as APP_MIN_HEIGHT, y as AppDownload, z as AppDownloadView, F as AppFileSaverEnv, G as AppLink, H as AppReadyDownload, I as AppResourceReader, J as ElicitationControl, K as ElicitationDraft, N as ElicitationDraftValue, O as ElicitationField, V as ElicitationFormOutcome, X as ElicitationIssue, Y as ElicitationLink, Z as ElicitationOption, _ as FetchView, $ as MCP_APP_DISPLAY_MODES, a0 as MCP_APP_MAX_ARGS_CHARS, a1 as MCP_APP_MAX_DOWNLOAD_BYTES, a2 as MCP_APP_MAX_FILE_NAME_CHARS, a3 as MCP_APP_MAX_IN_FLIGHT, a4 as MCP_APP_MAX_MESSAGE_CHARS, a5 as MCP_APP_MAX_URL_CHARS, a6 as MCP_APP_NOTIFICATIONS, a7 as MCP_APP_OPTIONAL_REQUESTS, a8 as MCP_APP_PROTOCOL_VERSION, a9 as MCP_APP_REFUSED, aa as MCP_APP_REFUSED_DOWNLOAD_EXTENSIONS, ab as MCP_APP_REFUSED_DOWNLOAD_TYPES, ac as MCP_APP_RELAY, ad as MCP_APP_REQUESTS, ae as MCP_APP_SANDBOX_FRAME_TOKENS, af as MCP_APP_SANDBOX_GRACE_MS, ag as MCP_APP_SANDBOX_SERVER, ah as MCP_APP_SANDBOX_TIMEOUT_MS, ai as McpAppBridge, aj as McpAppBridgeHandlers, ak as McpAppBridgeOptions, al as McpAppRpcError, am as McpAppRpcMessage, an as McpAppSandboxInput, ao as McpAppSandboxLink, ap as McpAppSandboxLinkOptions, aq as McpAppSandboxTarget, ar as McpElicitationFieldSchema, as as McpElicitationRequest, at as McpElicitationSchema, au as QueuedMessageView, av as ReplanState, aw as SkillConsentView, ax as StepEscalationView, ay as UseMcpAppHostOptions, az as appDisplayModeAllowed, aA as appDownloadOf, aB as appDownloadRefusal, aC as appFileExtensionOf, aD as appFileNameOf, aE as appGestureOf, aF as appHeightCap, aG as appLinkOf, aH as appMessageTextOf, aI as appMimeTypeOf, aJ as appSamplingErrorOf, aK as buildMcpAppDocument, aL as buildMcpAppSandboxShell, aM as clampAppHeight, aN as elicitationFields, aO as elicitationFormAnswer, aP as elicitationInitialDraft, aQ as elicitationLink, aR as formatCountdown, aS as grantedAppCsp, aT as isApprovalOfApp, aU as mcpAppCsp, aV as mcpAppHostCapabilities, aW as mcpAppSandboxProxyUrl, aX as mcpAppSandboxShellCsp, aY as mcpAppSandboxTarget, aZ as nextAppHeightCap, a_ as resolveAppDownload, a$ as saveAppFile, b0 as useMcpAppHost } from './elicitation-DCr7b6IH.js';
7
+ export { M as MCP_APP_POLICY_TOKEN_MAX_CHARS, a as MCP_APP_SANDBOX_PROXY_READY, b as MCP_APP_SANDBOX_RESOURCE_READY, c as MCP_APP_SCHEME_PARAM, d as McpAppColorScheme, i as isMcpAppSandboxMessage, m as mcpAppColorScheme, e as mcpAppPolicyToken } from './mcp-app-policy-BhBIsbBy.js';
8
8
 
9
9
  /**
10
10
  * The model asks the person ONE closed question (the core's `ask_user`, `config.askUser`): the
@@ -119,6 +119,17 @@ interface UseAgentOptions {
119
119
  autoStart?: boolean;
120
120
  /** Cap the retained raw event log length (default 200; 0 = unbounded). */
121
121
  maxEvents?: number;
122
+ /**
123
+ * Where "Always allow" given to an MCP App's tool is kept (the core's `appGrantKey`: the
124
+ * server's identity on its connection, the tool, the app's resource): handed to the core's
125
+ * `approveAppToolCall`, so a new agent - a `deps` change, a remount of the chat - keeps the
126
+ * grant. A new connection (the server removed and added again, reconnected, another server
127
+ * under the same name) starts with none, and a rule's 'deny' or 'read-only' still refuses.
128
+ * Default: one set for the page's life (this module's, shared by every `useAgent` of the page);
129
+ * a reload forgets it, as sampling's "Always for this app" is forgotten. Pass your own set to
130
+ * scope it differently.
131
+ */
132
+ appToolGrants?: Set<string>;
122
133
  /**
123
134
  * Route tool-consent requests into the hook (`pendingApprovals`, `approve`,
124
135
  * `deny`) when the config has no `toolApproval.onRequest` of its own
@@ -243,12 +254,15 @@ interface UseAgentReturn extends AgentUiState {
243
254
  setApprovalMode: (mode: ToolApprovalMode) => void;
244
255
  /**
245
256
  * Ask the agent's consent gate about a tool call an MCP App wants to make (the core's
246
- * `Agent.approveAppToolCall`: the same rules and modes, never silent for a write, "always
247
- * allow" kept apart from the model's). The request joins `pendingApprovals` with `app` set,
257
+ * `Agent.approveAppToolCall`: the same rules and modes as the model's calls - 'autopilot' asks
258
+ * nothing -, "always allow" kept apart from the model's and for the page's life, not the
259
+ * agent's: `appToolGrants`). The request joins `pendingApprovals` with `app` set,
248
260
  * and waits across runs - a run ending or `stop()` does not answer it; `signal` does (the
249
- * app's frame going away). Resolves when the call may go; throws when it may not.
261
+ * app's frame going away). `call.frame` (the frame's `AppView.id`) is put on the request's
262
+ * `app`, so it is drawn with THAT frame; `call.serverId` (`McpAppTool.serverId`) scopes the
263
+ * grant to the server's connection. Resolves when the call may go; throws when it may not.
250
264
  */
251
- approveAppToolCall: (call: AppToolCallRequest, signal?: AbortSignal) => Promise<void>;
265
+ approveAppToolCall: (call: AppToolCall, signal?: AbortSignal) => Promise<void>;
252
266
  /**
253
267
  * Answer a completion an MCP App asks for (its `sampling/createMessage`) with the agent's model:
254
268
  * the core's `Agent.sampleForApp` - checked, rate-limited per app, put to `approve` (shown
@@ -290,6 +304,13 @@ interface UseAgentReturn extends AgentUiState {
290
304
  * // <button disabled={!agent.isReady} onClick={() => agent.run(text)}>Run</button>
291
305
  * ```
292
306
  */
307
+ /**
308
+ * A tool call an MCP App asks for, as `approveAppToolCall` takes it: the core's request, plus
309
+ * `frame` - the host's id of the frame that asked (`AppView.id`), put on the request's `app`.
310
+ */
311
+ type AppToolCall = AppToolCallRequest & {
312
+ frame?: string;
313
+ };
293
314
  declare const useAgent: (config: BrowserAgentConfig, options?: UseAgentOptions) => UseAgentReturn;
294
315
 
295
316
  /**
@@ -1166,16 +1187,61 @@ interface ComposerAttachment {
1166
1187
  note?: string;
1167
1188
  /** A recording's length in milliseconds (a voice message). */
1168
1189
  durationMs?: number;
1190
+ /**
1191
+ * A text the host made (`convertFile`): it carries its own note and goes to the model as it is,
1192
+ * never cut to an excerpt by `longText` (the host decides how much of a document goes).
1193
+ */
1194
+ converted?: boolean;
1169
1195
  }
1170
1196
  /** The kind of an attachment from its media type and name. */
1171
1197
  declare const attachmentKindOf: (mediaType: string, name: string) => ComposerAttachment["kind"];
1198
+ /** What `withAttachments` does with a long text attachment (`<AgentComposer longText>`). */
1199
+ interface AttachmentTextOptions {
1200
+ /**
1201
+ * OFF unless given. A text attachment longer than this many characters that was saved in the
1202
+ * workspace (`path`) goes as its BEGINNING with a note naming the file that holds it whole -
1203
+ * never whole. Only for an agent that can read the file: the core's `createFileTools` over the
1204
+ * same workspace (its `fs_read`, or the name `readTool` gives). One the host converted
1205
+ * (`converted`), or one without a `path`, goes whole.
1206
+ */
1207
+ excerptChars?: number;
1208
+ /** The tool the note tells the model to read on with (default `fs_read`: `createFileTools`' prefix + `read`). */
1209
+ readTool?: string;
1210
+ }
1211
+ /** The beginning of a long text, cut at a line's end when one is in its second half. */
1212
+ interface TextExcerpt {
1213
+ text: string;
1214
+ /** The line the excerpt ends in (1-based). */
1215
+ lastLine: number;
1216
+ /** Whether that line is whole in the excerpt (false: it is cut inside it). */
1217
+ lineWhole: boolean;
1218
+ /** Lines of the whole text, counted as the core's `fs_read` counts them (a last line break
1219
+ * starts no line). */
1220
+ totalLines: number;
1221
+ }
1222
+ /** A text's lines as the core's `fs_read` counts them: a text that ends with a line break has no
1223
+ * empty last line. */
1224
+ declare const lineCountOf: (text: string) => number;
1225
+ /**
1226
+ * At most `maxChars` characters from the start of `text`: at the last line break when it is in
1227
+ * the second half of them (a model reads on by line), never in the middle of a surrogate pair.
1228
+ */
1229
+ declare const textExcerpt: (text: string, maxChars: number) => TextExcerpt;
1230
+ /**
1231
+ * The note in front of an excerpt (for the MODEL, in English like the rest of the goal): how much
1232
+ * of the text this is, and how to read on. The file's path is NOT in it - the block's heading
1233
+ * names it once (a host that renames a placed file rewrites each mention it counts).
1234
+ */
1235
+ declare const excerptNote: (excerpt: TextExcerpt, totalChars: number, readTool?: string) => string;
1172
1236
  /**
1173
1237
  * The goal the agent receives: the typed text followed by each attached TEXT
1174
1238
  * file in a fenced block. Binary attachments travel as file parts instead; the
1175
1239
  * ones saved in the workspace (`path`) are named with it, so a tool can take
1176
- * the file itself (`generate_image`'s reference pictures).
1240
+ * the file itself (`generate_image`'s reference pictures). With `excerptChars`,
1241
+ * a long text saved in the workspace goes as its beginning and the file's path
1242
+ * (`AttachmentTextOptions`).
1177
1243
  */
1178
- declare const withAttachments: (text: string, files: ComposerAttachment[]) => string;
1244
+ declare const withAttachments: (text: string, files: ComposerAttachment[], options?: AttachmentTextOptions) => string;
1179
1245
  /**
1180
1246
  * The size bounds of an attachment (`<AgentComposer attachments={…}>`; these are the defaults).
1181
1247
  * - `maxBytes`: what is SENT. A file that goes as it is, by its size; one the composer transforms
@@ -1294,6 +1360,116 @@ declare const formatClock: (ms: number) => string;
1294
1360
  declare const micProblemText: (code: string | undefined, message: string | undefined, labels: Pick<AgentLabels, "micDenied" | "micMissing" | "micBusy" | "micUnsupported" | "dictationFailed" | "microphone">) => string;
1295
1361
  /** A voice message's file name, from when it was recorded: `voice-2026-11-29-1052.webm`. */
1296
1362
  declare const voiceMessageName: (at: Date, extension: string) => string;
1363
+ /** The counter shows from this share of the limit on ("3,650 / 4,000"). */
1364
+ declare const INPUT_COUNTER_FROM = 0.9;
1365
+ /** Whether the counter is shown for `count` characters of `max`. */
1366
+ declare const inputCounterShown: (count: number, max: number) => boolean;
1367
+ /**
1368
+ * A text's length as the box will hold it: a textarea keeps every line break as one `\n` (a
1369
+ * pasted CRLF or CR becomes LF), and its value is counted in UTF-16 code units - what the
1370
+ * counter shows and the limit is judged by (an emoji is 2, a letter 1, in every browser).
1371
+ */
1372
+ declare const boxLength: (text: string) => number;
1373
+ /**
1374
+ * Whether inserting `inserted` into `current` over its selection `[start, end)` keeps the box
1375
+ * within `max` characters (`boxLength`).
1376
+ */
1377
+ declare const insertionFits: (current: string, start: number, end: number, inserted: string, max: number) => boolean;
1378
+ /**
1379
+ * Whether `text` is ONE character as a person types it: one grapheme (a letter, an emoji with its
1380
+ * modifiers, a line break) - what a key press inserts. At the limit that is typing, and it stops;
1381
+ * anything longer is never cut.
1382
+ */
1383
+ declare const isOneCharacter: (text: string) => boolean;
1384
+ /**
1385
+ * Where text goes in a box with a limit:
1386
+ * - `'insert'` - into the box: it fits (or there is no limit);
1387
+ * - `'stop'` - nowhere, silently: ONE character typed into a full box (`fromBox`: it came through
1388
+ * the box's own editing - a key, a paste of one letter) - typing stops at the limit;
1389
+ * - `'attach'` - the WHOLE of it as a text attachment (never cut);
1390
+ * - `'refuse'` - nowhere, said in words: attachments are off.
1391
+ * Dictation and a draft are not `fromBox`: a single dictated word is attached, never dropped.
1392
+ */
1393
+ declare const longTextRoute: (input: {
1394
+ current: string;
1395
+ start: number;
1396
+ end: number;
1397
+ inserted: string;
1398
+ max: number | undefined;
1399
+ attachments: boolean;
1400
+ fromBox?: boolean;
1401
+ }) => "insert" | "stop" | "attach" | "refuse";
1402
+ /**
1403
+ * What an edit the composer could not stop beforehand inserted (an IME's commit, an insertion
1404
+ * whose `beforeinput` cannot be cancelled): the part of `next` that is not in `prev`, found by
1405
+ * their common start and end - around the caret, never splitting a surrogate pair. Undefined
1406
+ * when the box is within `max`, or did not grow (a deletion is never taken back).
1407
+ */
1408
+ declare const overflowOf: (prev: string, next: string, max: number) => {
1409
+ inserted: string;
1410
+ } | undefined;
1411
+ /**
1412
+ * The name of a text attachment the composer made from a paste or a dictation, by when it was
1413
+ * made in local time: `pasted-2026-11-30-140509.txt` (`-2`, `-3`… when the message already holds
1414
+ * that name: two pastes in one second must not land in one file). `.txt`: it is plain text as it
1415
+ * was given - not Markdown (a paste of code or a log is no document) - and every reader of the
1416
+ * workspace (`fs_read`, a search index, a preview) takes it as text.
1417
+ */
1418
+ declare const longTextName: (at: Date, kind?: "pasted" | "dictation", taken?: readonly string[]) => string;
1419
+ /** What `saveAttachments` needs of a workspace (the core's `VirtualFileSystem` has it). */
1420
+ interface AttachmentFiles {
1421
+ read(path: string): Promise<unknown>;
1422
+ write(path: string, content: string, opts?: {
1423
+ mimeType?: string;
1424
+ }): Promise<unknown>;
1425
+ writeDataUrl(path: string, dataUrl: string): Promise<unknown>;
1426
+ delete(path: string): Promise<unknown>;
1427
+ /**
1428
+ * A workspace that NAMES a message's attachments itself gives this, and then it decides where
1429
+ * each one goes: it is asked for `/attachments/<name>` and answers where the file is - never
1430
+ * over another file (beside it, `-2`…; or the very same file already there, `created: false`,
1431
+ * which is then never deleted again). The composer names THAT path to the model. Without it the
1432
+ * composer picks a name no file has (`freeAttachmentPath`) and writes there.
1433
+ */
1434
+ saveAttachment?(path: string, content: string, opts: {
1435
+ mimeType: string;
1436
+ encoding: 'utf8' | 'base64';
1437
+ }): Promise<{
1438
+ path: string;
1439
+ created: boolean;
1440
+ }>;
1441
+ }
1442
+ /** A data URL's parts as the core's `writeDataUrl` reads them (base64 or URL-encoded text). */
1443
+ declare const dataUrlParts: (dataUrl: string) => {
1444
+ content: string;
1445
+ encoding: "utf8" | "base64";
1446
+ mimeType: string;
1447
+ };
1448
+ /** One path segment out of an attachment's name (`a b.txt` → `a_b.txt`). */
1449
+ declare const attachmentFileName: (name: string) => string;
1450
+ /**
1451
+ * Where an attachment goes in the workspace: `/attachments/<name>`, or - when a file is there
1452
+ * already, or this message took the path - `<stem>-2<ext>`, `-3`…: never over another file.
1453
+ */
1454
+ declare const freeAttachmentPath: (name: string, taken: (path: string) => Promise<boolean>) => Promise<string>;
1455
+ /** What `saveAttachments` did: every file written, or the ones it could not write (none kept). */
1456
+ type SavedAttachments = {
1457
+ saved: true;
1458
+ } | {
1459
+ saved: false;
1460
+ failed: string[];
1461
+ };
1462
+ /**
1463
+ * Write a message's attachments into the workspace before it is sent, each as a NEW file, and set
1464
+ * their `path`. Who names the file: the workspace, when it has `saveAttachment` (a host's policy -
1465
+ * the app keeps one file of the same bytes once); else this, by `freeAttachmentPath`. Never both:
1466
+ * a host that places a file the library already numbered writes it twice, under two names. All or
1467
+ * nothing: when one write fails (no room, over the workspace's file size, any error) the files
1468
+ * this message created are deleted again, no `path` is set, and the names of the ones that failed
1469
+ * come back - the message must not go (its text would otherwise reach the model whole, or not at
1470
+ * all).
1471
+ */
1472
+ declare const saveAttachments: (files: AttachmentFiles, items: ComposerAttachment[]) => Promise<SavedAttachments>;
1297
1473
 
1298
1474
  /**
1299
1475
  * What a workspace file is to the UI. `image` is only what the core's media tools accept
@@ -1371,6 +1547,11 @@ interface AgentLabels {
1371
1547
  dictate: string;
1372
1548
  dictateTitle: string;
1373
1549
  stopDictation: string;
1550
+ /**
1551
+ * The mic button's name while it listens: that it listens, and that a tap finishes (the title
1552
+ * stays `stopDictation`).
1553
+ */
1554
+ micListening: string;
1374
1555
  microphone: string;
1375
1556
  /** While a recording recognizer waits for its model (`useSpeechToText().finishing`). */
1376
1557
  transcribing: string;
@@ -1429,6 +1610,29 @@ interface AgentLabels {
1429
1610
  tooManyImages: (names: string, max: number) => string;
1430
1611
  /** Files left out: the message would carry more than `attachments.maxTotalBytes` (in MB). */
1431
1612
  messageTooLarge: (names: string, mb: number) => string;
1613
+ /** A paste too long for the message box, as an attachment's note (`longText`): its length. */
1614
+ pastedText: (chars: number) => string;
1615
+ /** The same for a dictation too long for the box. */
1616
+ dictatedText: (chars: number) => string;
1617
+ /** The box's counter near its limit (`longText`): "3,650 / 4,000". */
1618
+ inputCount: (count: number, max: number) => string;
1619
+ /** The counter's label (its tooltip and accessible name). */
1620
+ inputLimit: (max: number) => string;
1621
+ /** Said (politely, to a screen reader too) when the box is full. */
1622
+ inputLimitReached: (max: number) => string;
1623
+ /** The same with attachments off: no file is promised. */
1624
+ inputLimitFull: (max: number) => string;
1625
+ /** Said to a screen reader when a paste (or any insertion) became a file: its length. */
1626
+ pastedAsFile: (chars: number) => string;
1627
+ /** The same for a dictation that became a file. */
1628
+ dictatedAsFile: (chars: number) => string;
1629
+ /** A long paste with attachments off: it is not inserted, and not cut either. */
1630
+ longTextRefused: (max: number) => string;
1631
+ /**
1632
+ * An attachment could not be written into the workspace (no room, too large, an error): the
1633
+ * message was NOT sent and everything stays in the composer.
1634
+ */
1635
+ attachmentSaveFailed: (names: string) => string;
1432
1636
  commandGroups: {
1433
1637
  commands: string;
1434
1638
  consent: string;
@@ -1574,6 +1778,11 @@ interface AgentLabels {
1574
1778
  readAloudFailed: string;
1575
1779
  /** Above the chips: "3 files written in this turn". */
1576
1780
  filesWritten: (n: number) => string;
1781
+ /**
1782
+ * Above the chips of the workspace files an answer NAMES (`showNamedFiles`) - it did not write
1783
+ * them: "2 files in this answer".
1784
+ */
1785
+ filesNamed: (n: number) => string;
1577
1786
  /** In the activity summary: "3 files". */
1578
1787
  filesCount: (n: number) => string;
1579
1788
  /** The link that opens the Files panel. */
@@ -1584,6 +1793,11 @@ interface AgentLabels {
1584
1793
  fileOpen: (name: string) => string;
1585
1794
  /** The same button while the preview is open. */
1586
1795
  fileClose: (name: string) => string;
1796
+ /**
1797
+ * A link in an answer to a workspace file (`WorkspaceFileLink`): the button's accessible name,
1798
+ * from the link's words and the file's name.
1799
+ */
1800
+ fileLinkOpen: (text: string, name: string) => string;
1587
1801
  /** The download button of a chip (accessible name). */
1588
1802
  fileDownload: (name: string) => string;
1589
1803
  /** On a chip: the subagent that wrote the file. */
@@ -1729,6 +1943,10 @@ interface AgentLabels {
1729
1943
  appSandboxBroken: string;
1730
1944
  /** The badge while a request of the app waits for the user. */
1731
1945
  appWaiting: string;
1946
+ /** The "waiting for you" badge is a button: its title (it takes the focus to the prompt). */
1947
+ appWaitingFocus: string;
1948
+ /** The region of an app's prompts drawn in its panel / sheet / full screen chrome. */
1949
+ appPromptsLabel: (server: string) => string;
1732
1950
  /** The tag on the tool call an app came with, and the activity summary's count. */
1733
1951
  appTag: string;
1734
1952
  appsCount: (n: number) => string;
@@ -1744,6 +1962,8 @@ interface AgentLabels {
1744
1962
  appMenu: string;
1745
1963
  appReload: string;
1746
1964
  appOpenPanel: string;
1965
+ /** Under an inline app taller than the chat shows inline (`appHeightCap`): it scrolls inside. */
1966
+ appTaller: string;
1747
1967
  appHide: string;
1748
1968
  /** The note at the bottom of the menu. */
1749
1969
  appServedBy: (server: string, uri: string) => string;
@@ -1774,6 +1994,8 @@ interface AgentLabels {
1774
1994
  /** The app shown full screen (`<McpAppFrame allowFullscreen>`): the badge, the way back. */
1775
1995
  appFullscreenBadge: string;
1776
1996
  appFullscreenExit: string;
1997
+ /** The note under an inline app taller than the chat: show it full screen (when it may be). */
1998
+ appFullscreenEnter: string;
1777
1999
  /** The key that exits too, shown on the button. */
1778
2000
  appFullscreenKey: string;
1779
2001
  /** A file the app asks to save (`<AppRequestPrompt>`). */
@@ -2209,6 +2431,29 @@ interface AgentComposerProps {
2209
2431
  id: string;
2210
2432
  text: string;
2211
2433
  };
2434
+ /**
2435
+ * The message box's limit (default off: no limit, every text attachment inlined whole, as
2436
+ * before). `maxInputChars` (UTF-16 code units, as the counter counts): ONE character typed into
2437
+ * a full box is not inserted - typing stops there; any longer text that would take the box over
2438
+ * it - a paste, a drop, a keyboard's clipboard chip or word, the phone's own dictation, an
2439
+ * IME's commit, the mic's dictation, a `draft` - is NOT inserted and never cut: the whole of it
2440
+ * becomes a text attachment (`pasted-<date-time>.txt`, "Pasted text · N characters"), under
2441
+ * the same bounds as any file (`maxBytes`, `maxTotalBytes`: over them it is refused in words).
2442
+ * With `attachments` off it is refused in words. No `maxLength` is set: it would cut.
2443
+ *
2444
+ * `excerptChars` (off unless given): a text attachment longer than this, saved in `files`,
2445
+ * goes to the model as its beginning, a note and the file's path - the whole text is the
2446
+ * workspace's, written when the message is sent. Only for an agent with the core's
2447
+ * `createFileTools` over the same `files`: the note names `readTool` (default `fs_read`; give
2448
+ * `${prefix}read` with another `prefix`).
2449
+ */
2450
+ longText?: false | {
2451
+ maxInputChars: number;
2452
+ excerptChars?: number;
2453
+ readTool?: string;
2454
+ };
2455
+ /** The counter under the box from 90% of `longText.maxInputChars` on (default true). */
2456
+ showInputCounter?: boolean;
2212
2457
  disabled?: boolean;
2213
2458
  className?: string;
2214
2459
  }
@@ -2228,7 +2473,7 @@ interface AgentComposerProps {
2228
2473
  *
2229
2474
  * Every piece can be switched off; `<AgentChat>` uses it as its footer.
2230
2475
  */
2231
- declare const AgentComposer: ({ controller: agent, placeholder, model, thinking, labels: labelsOverride, commands, builtinCommands, skillCommands, attachments, convertFile, convert, files: vfs, dropZone, speech, voiceMessage, showTimer, showAgents, showApprovalMode, showNotices, steering, showQueued, compactWidth, toolbarExtra, toolbarEnd, renderAttachment, draft, disabled, className, }: AgentComposerProps) => react.JSX.Element;
2476
+ declare const AgentComposer: ({ controller: agent, placeholder, model, thinking, labels: labelsOverride, commands, builtinCommands, skillCommands, attachments, convertFile, convert, files: vfs, dropZone, speech, voiceMessage, showTimer, showAgents, showApprovalMode, showNotices, steering, showQueued, compactWidth, toolbarExtra, toolbarEnd, renderAttachment, draft, longText, showInputCounter, disabled, className, }: AgentComposerProps) => react.JSX.Element;
2232
2477
 
2233
2478
  interface ChatHistoryListProps {
2234
2479
  /** From `useChatHistory(agent)`. */
@@ -2242,9 +2487,15 @@ interface ChatHistoryListProps {
2242
2487
  formatTime?: (ms: number) => string;
2243
2488
  labels?: AgentLabelsOverride;
2244
2489
  className?: string;
2490
+ /**
2491
+ * Put at the end of the panel's header row, after "New chat". `<AgentChat>` passes the panel's
2492
+ * close button (×) here on a narrow chat; a component of your own that replaces this one
2493
+ * (`components.HistoryList`) receives it too.
2494
+ */
2495
+ headerEnd?: ReactNode;
2245
2496
  }
2246
2497
  /** The saved conversations: a "New chat" button, then one row per chat (newest first). */
2247
- declare const ChatHistoryList: ({ history, title, disabled, renderChat, formatTime, labels, className, }: ChatHistoryListProps) => react.JSX.Element;
2498
+ declare const ChatHistoryList: ({ history, title, disabled, renderChat, formatTime, labels, className, headerEnd, }: ChatHistoryListProps) => react.JSX.Element;
2248
2499
 
2249
2500
  interface ElicitationPromptProps {
2250
2501
  /**
@@ -2309,13 +2560,19 @@ interface FilesPanelProps {
2309
2560
  renderFile?: (file: VirtualFileInfo, fallback: ReactNode) => ReactNode;
2310
2561
  labels?: AgentLabelsOverride;
2311
2562
  className?: string;
2563
+ /**
2564
+ * Put at the end of the panel's header row. `<AgentChat>` passes the panel's close button (×)
2565
+ * here on a narrow chat; a component of your own that replaces this one
2566
+ * (`components.FilesPanel`) receives it too.
2567
+ */
2568
+ headerEnd?: ReactNode;
2312
2569
  }
2313
2570
  /**
2314
2571
  * The agent's workspace — attachments the user dropped in, files the agent
2315
2572
  * wrote with its `fs_*` tools — live, with a preview (text / image),
2316
2573
  * download, delete and upload.
2317
2574
  */
2318
- declare const FilesPanel: ({ files: vfs, prefix, title, allowUpload, allowDelete, uploadDir, onOpen, renderFile, labels, className, }: FilesPanelProps) => react.JSX.Element;
2575
+ declare const FilesPanel: ({ files: vfs, prefix, title, allowUpload, allowDelete, uploadDir, onOpen, renderFile, labels, className, headerEnd, }: FilesPanelProps) => react.JSX.Element;
2319
2576
 
2320
2577
  /** A picture the viewer shows: where it is read from (`data:` / `blob:` / a URL) and its name. */
2321
2578
  interface ViewerImage {
@@ -2404,6 +2661,14 @@ interface FileChipsProps {
2404
2661
  files?: VirtualFileSystem;
2405
2662
  /** The line above the chips - "3 files written in this turn" (default true). */
2406
2663
  showHeader?: boolean;
2664
+ /** That line's words in place of `filesWritten` (the named files' `filesNamed`). */
2665
+ heading?: ReactNode;
2666
+ /**
2667
+ * A picture opens in the image viewer over the chat (`ImageViewer`, with the other pictures of
2668
+ * its message) instead of inline under the chips (default false; inline all the same while the
2669
+ * viewer is off - `imageViewer={false}`).
2670
+ */
2671
+ imagesInViewer?: boolean;
2407
2672
  /** Shows a "Show in Files" link in that line. */
2408
2673
  onShowFiles?: () => void;
2409
2674
  /**
@@ -2432,7 +2697,7 @@ interface FileChipsProps {
2432
2697
  * a renderer), a picture as a picture, and an `.html` page in a sandboxed frame with a
2433
2698
  * Preview / Source switch (see `SandboxedFrame`).
2434
2699
  */
2435
- declare const FileChips: ({ written, files: vfs, showHeader, onShowFiles, htmlPreview, renderFile, renderFileContent, previewChars, defaultOpen, labels, className, }: FileChipsProps) => react.JSX.Element | null;
2700
+ declare const FileChips: ({ written, files: vfs, showHeader, heading, imagesInViewer, onShowFiles, htmlPreview, renderFile, renderFileContent, previewChars, defaultOpen, labels, className, }: FileChipsProps) => react.JSX.Element | null;
2436
2701
  interface FileChipProps {
2437
2702
  written: WrittenFileView;
2438
2703
  /** The type and size now (default: what the turn recorded). */
@@ -2444,10 +2709,43 @@ interface FileChipProps {
2444
2709
  gone?: boolean;
2445
2710
  open?: boolean;
2446
2711
  onToggle?: () => void;
2712
+ /**
2713
+ * A picture's thumbnail is a button that opens the image viewer, and so is its open button (no
2714
+ * inline preview: `onToggle` is not called for it) - while the viewer is on
2715
+ * (`ImageViewerProvider`); with it off, the inline preview as without `viewer`.
2716
+ */
2717
+ viewer?: boolean;
2447
2718
  labels?: AgentLabelsOverride;
2448
2719
  }
2449
2720
  /** One file: icon (a thumbnail for a picture), name, kind · size, open, download. */
2450
- declare const FileChip: ({ written, mediaType, bytes, files: vfs, gone, open, onToggle, labels, }: FileChipProps) => react.JSX.Element;
2721
+ declare const FileChip: ({ written, mediaType, bytes, files: vfs, gone, open, onToggle, viewer, labels, }: FileChipProps) => react.JSX.Element;
2722
+ interface NamedFileChipsProps {
2723
+ /** The answer's text (`ChatMessage.content`), read by `pathsNamedIn`. */
2724
+ text: string;
2725
+ /** The workspace: the only place a named path is looked up. Without it nothing is shown. */
2726
+ files?: VirtualFileSystem;
2727
+ /** Paths left out: the files the answer wrote, the media it made (they have their chips). */
2728
+ exclude?: Iterable<string>;
2729
+ /** At most this many chips (default `NAMED_FILES_MAX`, 12). */
2730
+ max?: number;
2731
+ /** The header line (default true). */
2732
+ showHeader?: boolean;
2733
+ htmlPreview?: HtmlPreviewOptions | false;
2734
+ renderFile?: FileChipsProps['renderFile'];
2735
+ renderFileContent?: FileChipsProps['renderFileContent'];
2736
+ labels?: AgentLabelsOverride;
2737
+ className?: string;
2738
+ }
2739
+ /**
2740
+ * The workspace files an answer names in its text - a path in an inline code span or as a
2741
+ * Markdown link (`pathsNamedIn`) - as chips under it, like the files it wrote: only a path that
2742
+ * is a file of the workspace's listing now (nothing is read to find out, nothing fetched), in
2743
+ * the order named, at most `max`. One that was shown and is then deleted stays, as gone. A
2744
+ * picture opens in the image viewer (inline, as the rest, with `imageViewer={false}`); the rest
2745
+ * as `FileChips` previews them. Under `<MessageList>` it reads the transcript's one listing of
2746
+ * the workspace, and draws nothing - no chip, no hook of a chip - unless a path it names is in it.
2747
+ */
2748
+ declare const NamedFileChips: (props: NamedFileChipsProps) => react.JSX.Element | null;
2451
2749
 
2452
2750
  /** Render a node yourself; `fallback` is the built-in `<li>` (with its children) — return it, or your own `<li>`. */
2453
2751
  type RenderSubagent = (node: SubagentNode, fallback: ReactNode) => ReactNode;
@@ -2619,6 +2917,16 @@ interface MessageListProps {
2619
2917
  * an `.html` file in a sandboxed frame) and download (default true). Needs `files`.
2620
2918
  */
2621
2919
  showFileChips?: boolean;
2920
+ /**
2921
+ * The workspace files a finished answer NAMES without having written them - a path in an
2922
+ * inline code span or a Markdown link (`pathsNamedIn`): an attachment, a picture of an earlier
2923
+ * turn, a file a search found - as chips under it, after the written ones ("2 files in this
2924
+ * answer"): only a path that is a file of `files` now, in the order named, at most 12; a
2925
+ * picture opens in the image viewer. Default: `showFileChips` (a host that hides file chips
2926
+ * gets no new ones). A file the answer wrote is left out only while its written chip is shown.
2927
+ * Needs `files`.
2928
+ */
2929
+ showNamedFiles?: boolean;
2622
2930
  /** The workspace generated and written files are read from (the core's `VirtualFileSystem`). */
2623
2931
  files?: VirtualFileSystem;
2624
2932
  /** How an `.html` file is previewed (see `FileChips`); `false` shows HTML as source only. */
@@ -2706,7 +3014,7 @@ declare const AttachmentView: ({ attachment: a, files, labels, }: {
2706
3014
  * subagents, consent decisions — and the tokens it spent by kind. Every part
2707
3015
  * can be hidden, relabelled or rendered by the host.
2708
3016
  */
2709
- 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, renderToolCard, showToolCards, renderApp, showApps, imageViewer, renderImageViewer, readAloud, labels, className, }: MessageListProps) => react.JSX.Element | null;
3017
+ declare const MessageList: ({ messages, empty, showActivity, showToolCalls, showUsage, showThoughts, showNotes, showLearned, showTiers, showReplanFailed, showDecisions, showSearchResults, showSubagents, showMedia, showFileChips, showNamedFiles, files, htmlPreview, onShowFiles, renderFile, renderFileContent, renderMedia, renderSubagent, onStopSubagent, activityOpen, liveExtra, renderContent, renderMessage, renderAttachment, renderToolCall, renderToolCard, showToolCards, renderApp, showApps, imageViewer, renderImageViewer, readAloud, labels, className, }: MessageListProps) => react.JSX.Element | null;
2710
3018
 
2711
3019
  interface QuestionPromptProps {
2712
3020
  /**
@@ -2763,11 +3071,15 @@ interface ToolApprovalPromptProps {
2763
3071
  }) => void;
2764
3072
  onDeny: (id: string, reason?: string) => void;
2765
3073
  /**
2766
- * Offer "Always allow" (remembers the tool for the agent's life) - and, on a request about an
3074
+ * Offer "Always allow" (remembers the tool for the agent's life - for an MCP App's request, that
3075
+ * app's tool for the page's life, `useAgent`'s `appToolGrants`) - and, on a request about an
2767
3076
  * MCP server's skill, "Always for this server" (that server's skills for the agent's life,
2768
- * nested ones excepted). Default true.
3077
+ * nested ones excepted). Default true - except on a request an explicit `'ask'` rule asked
3078
+ * (`approval.rule`): the core asks it every time, and no "always allow" answers a rule, so it
3079
+ * is not offered there. `false` offers it nowhere; a function decides per request (it may offer
3080
+ * it on a rule's request too - the grant is kept, and the rule still asks).
2769
3081
  */
2770
- allowRemember?: boolean;
3082
+ allowRemember?: boolean | ((approval: ApprovalView) => boolean);
2771
3083
  /**
2772
3084
  * On a request about an MCP server's skill: the collapsible preview of the instructions the
2773
3085
  * model would read (plain text). Default true.
@@ -2878,6 +3190,12 @@ interface AgentChatProps {
2878
3190
  * open (an inline preview - an `.html` file in a sandboxed frame) and download (default true).
2879
3191
  */
2880
3192
  showFileChips?: boolean;
3193
+ /**
3194
+ * The workspace files a finished answer names in its text without having written them (a path
3195
+ * in an inline code span or a Markdown link that is a file of `files`), as chips under it -
3196
+ * "2 files in this answer"; a picture opens in the image viewer. Default: `showFileChips`.
3197
+ */
3198
+ showNamedFiles?: MessageListProps['showNamedFiles'];
2881
3199
  /**
2882
3200
  * How an `.html` file is previewed: sandboxed, no network, scripts off by default;
2883
3201
  * `{ scripts: true }` lets its inline scripts run; `false` shows HTML as source only.
@@ -3213,6 +3531,37 @@ interface SandboxedFrameProps {
3213
3531
  */
3214
3532
  declare const SandboxedFrame: ({ html, scripts, title, label, actions, footer, height, children, className, }: SandboxedFrameProps) => react.JSX.Element;
3215
3533
 
3534
+ interface WorkspaceFileLinkProps {
3535
+ /** The workspace path the link points to (`workspacePathOf` of its destination). */
3536
+ path: string;
3537
+ /** The link's words as plain text - with the file's name, the link's accessible name. */
3538
+ text?: string;
3539
+ /** The link's words as drawn. */
3540
+ children: ReactNode;
3541
+ /** The workspace (default: the one `<MessageList files>` lists for its chips). */
3542
+ files?: VirtualFileSystem;
3543
+ /** How an `.html` file is previewed (default: the transcript's `htmlPreview`, else `{}`). */
3544
+ htmlPreview?: HtmlPreviewOptions | false;
3545
+ /** A text file rendered your way (default: the transcript's `renderFileContent`). */
3546
+ renderFileContent?: FileChipsProps['renderFileContent'];
3547
+ labels?: AgentLabelsOverride;
3548
+ className?: string;
3549
+ }
3550
+ /**
3551
+ * A link in an answer to a file of the workspace - `[the picture](/media/a.png)` - drawn as its
3552
+ * words, link-styled: a `<span role="button">` (focusable; Enter and Space open it) that breaks
3553
+ * across lines like the text around it - a `<button>` is one box, and a long link moved to the
3554
+ * next line whole the moment it became one. It opens the file IN THE PAGE: a picture in the
3555
+ * image viewer (in the preview dialog while the viewer is off), any other kind in the preview the
3556
+ * file chips use (SVG as source, HTML only in the sandboxed frame, text as text), over the chat.
3557
+ * Never an `<a href>`: nothing is navigated to, no window opened, nothing fetched - the file is
3558
+ * read from the workspace at the click. Only a file the workspace's LISTING has (the
3559
+ * transcript's one listing, nothing read to find out); a path it does not have - or no workspace
3560
+ * at all - is the link's words as plain text. Once open, the dialog keeps the file it opened: a
3561
+ * file deleted meanwhile is said there, and it opens again only on a click.
3562
+ */
3563
+ declare const WorkspaceFileLink: ({ path, text, children, files, htmlPreview, renderFileContent, labels, className, }: WorkspaceFileLinkProps) => react.JSX.Element;
3564
+
3216
3565
  /**
3217
3566
  * The sandboxed frame's security core: what untrusted HTML (a file the agent wrote, later an
3218
3567
  * MCP App) is wrapped in before it reaches an `<iframe>`. Pure strings - no React, no DOM - so
@@ -3282,6 +3631,62 @@ interface SourceToken {
3282
3631
  */
3283
3632
  declare const tokenizeHtml: (source: string) => SourceToken[];
3284
3633
 
3634
+ /**
3635
+ * The workspace files an answer NAMES in its text (`<MessageList showNamedFiles>`): pure, no
3636
+ * React, no DOM, no import. What it reads as a path, exactly:
3637
+ *
3638
+ * - an inline code span whose whole content is an absolute path - `` `/attachments/a.png` ``
3639
+ * (one or more backticks, CommonMark's rule: closed by a run of the same length; the one space
3640
+ * inside each end is dropped);
3641
+ * - the destination of a Markdown link or image - `[a](/media/a.jpg)`, `![a](/media/a.jpg "t")`,
3642
+ * `[a](</notes/my notes.md>)` - percent-decoded.
3643
+ *
3644
+ * Nothing else: a path in plain words (`see /notes.md`), in a fenced code block (``` or ~~~ - a
3645
+ * listing, a command, an example: not something the answer hands over), in an indented block or
3646
+ * in a URL (`https://…`, `//host/…`) is not read. A path is absolute, one line, at most 512
3647
+ * characters, with no empty, `.` or `..` segment, no backslash or control character and no
3648
+ * trailing slash (a folder) - it is never normalised into another path: what is looked up is what
3649
+ * the answer wrote. Then {@link namedFilesOf} keeps only the paths that EXIST in the workspace's
3650
+ * listing - the one check that matters: a path that is not a file of the workspace is nothing.
3651
+ *
3652
+ * The scan is linear in the text, whatever the text holds (it runs while a message is drawn,
3653
+ * and the text is the model's - which a fetched page can steer): code spans by one pass over the
3654
+ * runs of backticks, links by a pattern that cannot backtrack across brackets, and no more than
3655
+ * {@link NAMED_FILES_TEXT_MAX} characters of it.
3656
+ */
3657
+ /** The most files an answer is shown with (see {@link namedFilesOf}). */
3658
+ declare const NAMED_FILES_MAX = 12;
3659
+ /** The most distinct paths kept from one text (a bound on what is looked up, not on the scan). */
3660
+ declare const NAMED_FILES_SCAN_MAX = 200;
3661
+ /**
3662
+ * The most of a text that is scanned: the first 100,000 characters. That is about 25,000 tokens -
3663
+ * more than an answer that hands files over is (above most models' default output limit for one
3664
+ * answer); past it, the text is a dump (a file pasted back, a runaway answer), whose paths are a
3665
+ * listing, not files handed over. It bounds the scan's (linear) work to a few milliseconds.
3666
+ */
3667
+ declare const NAMED_FILES_TEXT_MAX = 100000;
3668
+ /** `raw` as a workspace path, or `undefined` when it is not one (see the module's rules). */
3669
+ declare const workspacePathOf: (raw: string) => string | undefined;
3670
+ /**
3671
+ * The workspace paths a text names, in the order they appear, each once, at most
3672
+ * {@link NAMED_FILES_SCAN_MAX}. Whether they exist is {@link namedFilesOf}'s question.
3673
+ */
3674
+ declare const pathsNamedIn: (text: string) => string[];
3675
+ interface NamedFilesOptions {
3676
+ /** Paths left out - the files the answer wrote, the media it made: they have chips already. */
3677
+ exclude?: Iterable<string>;
3678
+ /** At most this many (default {@link NAMED_FILES_MAX}). */
3679
+ max?: number;
3680
+ }
3681
+ /**
3682
+ * The paths of `named` (from {@link pathsNamedIn}) that are files of the workspace - `exists`
3683
+ * answers from its listing, never by reading or fetching anything -, without `exclude`, in order,
3684
+ * at most `max` (default 12: each chip of a picture reads its bytes for the thumbnail, and an
3685
+ * answer that lists a folder of two hundred files would otherwise read them all - the chips are
3686
+ * for the files the answer hands over, not a second file browser; the Files panel has them all).
3687
+ */
3688
+ declare const namedFilesOf: (named: readonly string[], exists: (path: string) => boolean, { exclude, max }?: NamedFilesOptions) => string[];
3689
+
3285
3690
  /** One result of the core's `web_search` tool, as far as a UI shows it. */
3286
3691
  interface WebSearchResultView {
3287
3692
  title: string;
@@ -3405,6 +3810,8 @@ interface ApprovalModeSwitchProps {
3405
3810
  modes?: ToolApprovalMode[];
3406
3811
  /** Override the button labels. */
3407
3812
  labels?: Partial<Record<ToolApprovalMode, string>>;
3813
+ /** Override the hints (each button's title; default: the labels' `modes[mode].hint`). */
3814
+ hints?: Partial<Record<ToolApprovalMode, string>>;
3408
3815
  disabled?: boolean;
3409
3816
  className?: string;
3410
3817
  }
@@ -3412,7 +3819,7 @@ interface ApprovalModeSwitchProps {
3412
3819
  * A segmented control for the tool-consent policy — the "autopilot" switch.
3413
3820
  * Pair it with {@link useAgent}'s `approvalMode` / `setApprovalMode`.
3414
3821
  */
3415
- declare const ApprovalModeSwitch: ({ mode, onChange, modes, labels, disabled, className, }: ApprovalModeSwitchProps) => react.JSX.Element;
3822
+ declare const ApprovalModeSwitch: ({ mode, onChange, modes, labels, hints, disabled, className, }: ApprovalModeSwitchProps) => react.JSX.Element;
3416
3823
 
3417
3824
  interface ContextMeterProps {
3418
3825
  usage: IUsage;
@@ -3501,6 +3908,20 @@ interface McpAppFrameProps {
3501
3908
  * focus kept inside. Default false: an app stays inline.
3502
3909
  */
3503
3910
  allowFullscreen?: boolean;
3911
+ /**
3912
+ * The app's pending requests (its tool calls' consent, links, messages, files, sampling) drawn
3913
+ * WHERE THE APP IS while it is in the panel / sheet or full screen: in the host's chrome, above
3914
+ * the frame - never under it, never scrolled away with the app's content - and the focus moves
3915
+ * to them when they appear. Return null when nothing waits. Inline, they stay in the
3916
+ * transcript (this is not called). Given, a full-screen app stays full screen while it waits
3917
+ * (without it the frame goes back inline, where the host's prompt is). `<AgentChat>` passes its
3918
+ * own (`renderApproval` / `renderAppRequest` apply there too).
3919
+ */
3920
+ renderPrompts?: () => ReactNode;
3921
+ /** Called when the app goes full screen or back inline (`<AgentChat>` moves its prompts). */
3922
+ onDisplayChange?: (mode: McpAppDisplayMode) => void;
3923
+ /** The "waiting for you" badge's click while the prompt is elsewhere (inline: the transcript). */
3924
+ onFocusPrompt?: () => void;
3504
3925
  labels?: AgentLabelsOverride;
3505
3926
  className?: string;
3506
3927
  }
@@ -3511,10 +3932,13 @@ interface McpAppFrameProps {
3511
3932
  * `mcp-app.ts` builds: an opaque origin - or, with `host.sandbox`, an origin of its own behind the
3512
3933
  * sandbox page (falling back to the opaque frame when that page does not answer) - network only
3513
3934
  * where its resource declared it, no navigation, and every request that does something (a tool
3514
- * call, a link, a message) put to the user through the host. Its height is its wish, clamped to
3515
- * 120 - 800 px.
3935
+ * call, a link, a message) put to the user through the host. Inline, its height is its wish -
3936
+ * the whole of it, so the transcript is the one scroller - up to a cap of a few screens of the
3937
+ * chat (`appHeightCap`, never less than 800 px), which the app is told as
3938
+ * `containerDimensions.maxHeight`; an app taller than that scrolls inside, and the chrome offers
3939
+ * the panel.
3516
3940
  */
3517
- declare const McpAppFrame: ({ app, host, variant, theme, defaultCollapsed, onOpenPanel, onClosePanel, showCalls, allowFullscreen, labels, className, }: McpAppFrameProps) => react.JSX.Element;
3941
+ declare const McpAppFrame: ({ app, host, variant, theme, defaultCollapsed, onOpenPanel, onClosePanel, showCalls, allowFullscreen, renderPrompts, onDisplayChange, onFocusPrompt, labels, className, }: McpAppFrameProps) => react.JSX.Element;
3518
3942
  interface McpAppLineProps {
3519
3943
  app: AppView;
3520
3944
  /** What the line says after the title ("hidden", "open in the panel"). */
@@ -3553,5 +3977,59 @@ interface AppRequestPromptProps {
3553
3977
  */
3554
3978
  declare const AppRequestPrompt: ({ requests, onAnswer, renderRequest, labels, className, }: AppRequestPromptProps) => react.JSX.Element | null;
3555
3979
 
3556
- export { ASK_USER_TOOL_NAME, ATTACHMENT_BOUNDS, 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, MemoryCard, MessageList, MicError, ModelLoadBar, ModelLoadState, PendingElicitation, PlanView, QUESTION_TIMEOUT_MS, QuestionPrompt, QuestionView, RECORDING_DEFAULT_MAX_MS, RECORDING_TYPES, RemoteRunView, SandboxedFrame, SourceView, SpeechOutputError, StepList, StepView, SubagentNode, SubagentRow, SubagentTree, SubagentView, ToolApprovalPrompt, ToolCallRow, ToolCallView, TranscriptBlock, TranscriptView, UsageBadge, UserNoteRow, UserNoteView, agentStateReducer, agentStatusOf, askUserOutputKept, askUserWith, attachmentKindOf, attachmentOverLimit, attachmentRefusal, attachmentTransformOf, attachmentsText, audioExtensionOf, audioTypeOf, buildSandboxedDocument, chatTitle, clampFrameHeight, createApprovalQueue, createAudioSpeaker, createBrowserSpeaker, createInitialAgentState, createQuestionQueue, createRecordingRecognizer, createWebLLMEngine, decisionNote, defaultLabels, downscaleImage, escapeAttribute, fileKindOf, fileNameOf, filterCommands, followsAfterResize, followsAfterScroll, formatClock, formatElapsed, imageExtensionOf, imageSizeOf, languageOfText, lessonsOf, linkedFilesOf, mediaFamilyOf, menuKeyTarget, menuSections, mergeChatRecord, mergeLabels, messageOverLimit, micProblemOf, micProblemText, newChatId, noticesOf, parseSlash, pendingApprovalsOf, pickRecordingType, questionChoiceOf, questionOtherOf, questionTimeoutOf, recordingSupported, sandboxTokens, sandboxedCsp, saveChat, scriptOfLanguage, scriptOfText, settleAudioDuration, speakableText, speechSynthesisSupported, splitForSpeech, startRecording, steerIntent, stopTracks, subagentTree, tokenizeHtml, unchangedSince, usageLine, useAgent, useAgentContext, useAudioRecorder, useChatHistory, useCredentials, useFollowScroll, useLabels, useLocalModel, useOptionalAgentContext, useReadAloud, useSpeechToText, useSpeechVoices, useVirtualFiles, useWebLLMModel, voiceFor, voiceMessageName, voicesOf, webSearchOf, withAttachments, withCspFirst, withPolicyFirst, withoutOwnWords };
3557
- export type { AgentAction, AgentChatClassNames, AgentChatComponents, AgentChatProps, AgentChatSlots, AgentComposerProps, AgentLabels, AgentLabelsOverride, AgentLabelsProviderProps, AgentProviderProps, ApiKeyFormProps, AppRequestPromptProps, ApprovalModeSwitchProps, ApprovalQueue, ApproveOptions, AttachmentBounds, AttachmentOverLimit, AttachmentTexts, AttachmentTransform, AudioLike, AudioSpeakerOptions, BrowserSpeakerOptions, ChatBase, ChatHistoryListProps, ChatHistoryStoreOptions, ChatRecord, ChatSummary, ComposerAttachment, ComposerModelChip, ComposerModelOption, ComposerNotice, ComposerProps, ComposerThinkingChip, ContextMeterProps, ConvertedFile, ConvertedImage, DownscaleOptions, ElicitationPromptProps, FileChipProps, FileChipsProps, FileKind, FilesPanelProps, GeneratedMediaProps, HtmlPreviewOptions, ImageSize, ImageThumbProps, ImageViewerProps, LearnedSkillsProps, LocalModelEngine, LocalModelLoadContext, LocalModelProgress, McpAppFrameProps, McpAppLineProps, MediaRecorderConstructorLike, MediaRecorderLike, MemoryCardProps, MenuSection, MessageListProps, MicProblem, ModelLoadBarProps, NoticeTexts, PendingQuestion, PlanViewProps, QuestionOutcomeReason, QuestionPromptProps, QuestionQueue, QuestionQueueOptions, ReadAloudOptions, ReadAloudState, RecordedAudio, Recording, RecordingDeps, RecordingRecognizerOptions, RenderImageViewer, RenderSubagent, RenderToolCall, RunGoalOptions, SandboxedDocumentOptions, SandboxedFrameProps, ScrollMeasure, SlashCommand, SourceToken, SourceViewProps, SpeakText, SpeakableOptions, SpeechPlayback, SpeechRecognizerLike, SpeechScript, SpeechSynthesisLike, SpeechUtteranceLike, SpeechVoiceLike, StartRecordingOptions, SteerIntent, StepListProps, SubagentRowProps, SubagentTreeProps, SynthesizeSpeech, ToolApprovalPromptProps, ToolCallRowProps, TranscribeAudio, TranscriptBlockProps, UsageBadgeProps, UseAgentOptions, UseAgentReturn, UseAudioRecorderOptions, UseAudioRecorderReturn, UseChatHistoryOptions, UseChatHistoryReturn, UseCredentialsReturn, UseLocalModelOptions, UseLocalModelReturn, UseReadAloudReturn, UseSpeechToTextOptions, UseSpeechToTextReturn, UseVirtualFilesReturn, UseWebLLMModelOptions, UseWebLLMModelReturn, ViewerImage, WebLLMModelFactory, WebSearchResultView, WebSearchView };
3980
+ interface ArmedButtonProps {
3981
+ /** What the button does once a click counts (`createPromptArming`). */
3982
+ onActivate: () => void;
3983
+ className?: string;
3984
+ /** How long it must have been shown, still, before a click counts (default `PROMPT_ARM_MS`). */
3985
+ armMs?: number;
3986
+ title?: string;
3987
+ children: ReactNode;
3988
+ }
3989
+ /**
3990
+ * A button that says yes to an MCP App - its tool call, link, file, sampling - and takes a click
3991
+ * only once it has been on screen and still for `armMs` (`createPromptArming`): until then it is
3992
+ * `aria-disabled` and a press on it does nothing. The ones that say no are plain buttons.
3993
+ */
3994
+ declare const ArmedButton: ({ onActivate, className, armMs, title, children, }: ArmedButtonProps) => react.JSX.Element;
3995
+
3996
+ /**
3997
+ * Input protection for the buttons that SAY YES to an MCP App (its tool call's "Allow once" /
3998
+ * "Always allow", a link's "Open", a file's "Save", sampling's "Allow"): the way a browser's own
3999
+ * permission prompts guard theirs. A prompt an app causes appears when the APP chooses - while
4000
+ * the person types, holds a key or double-clicks something in the app - and where its layout
4001
+ * puts it, so an input aimed at something else must not land on "yes".
4002
+ *
4003
+ * A button is ARMED only once it has been on screen, in one place, for `PROMPT_ARM_MS`; it is
4004
+ * disarmed again the moment it moves, is covered, leaves the screen or the page is hidden. A
4005
+ * click counts only when it is armed now AND began while it was armed: its pointerdown (a
4006
+ * pointer's click) or its Enter / Space keydown (a key's) came after the arming. A key repeat
4007
+ * never counts, and a keydown that does not count is swallowed. A click with no key and no
4008
+ * pointer behind it (assistive technology activating the button) counts when it is armed.
4009
+ *
4010
+ * Pure: the clock and the button's place are passed in (`ArmedButton` reads them from the DOM).
4011
+ */
4012
+ /** How long a button must have been shown, still, before it takes a click. */
4013
+ declare const PROMPT_ARM_MS = 500;
4014
+ interface PromptArming {
4015
+ /** Armed now. */
4016
+ readonly armed: boolean;
4017
+ /**
4018
+ * One look at the button: where it is on screen (any string that changes when it moves), or
4019
+ * `undefined` when it is not shown (off screen, covered, the page hidden). Returns `armed`.
4020
+ */
4021
+ sample: (where: string | undefined, now: number) => boolean;
4022
+ /** A pointer went down on the button. */
4023
+ pointerDown: (at: number) => void;
4024
+ /** A key went down on the button. False: swallow it (`preventDefault`) - it must not act. */
4025
+ keyDown: (key: {
4026
+ key: string;
4027
+ repeat: boolean;
4028
+ }, at: number) => boolean;
4029
+ /** A click reached the button (`detail` > 0 for a pointer's). True: it may act. */
4030
+ click: (detail: number, now: number) => boolean;
4031
+ }
4032
+ declare const createPromptArming: (delayMs?: number) => PromptArming;
4033
+
4034
+ export { ASK_USER_TOOL_NAME, ATTACHMENT_BOUNDS, AgentChat, AgentComposer, AgentLabelsProvider, AgentProvider, AgentStatus, AgentUiState, ApiKeyForm, AppRequestAnswerOptions, AppRequestPrompt, AppRequestView, AppView, ApprovalModeSwitch, ApprovalView, ArmedButton, 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, INPUT_COUNTER_FROM, ImageThumb, ImageViewer, ImageViewerProvider, LearnedSkills, LessonView, McpAppDisplayMode, McpAppFrame, McpAppHost, McpAppLine, McpAppSandboxOptions, McpAppSandboxReason, McpAppsConnectionLike, McpElicitationResult, MediaView, MemoryCard, MessageList, MicError, ModelLoadBar, ModelLoadState, NAMED_FILES_MAX, NAMED_FILES_SCAN_MAX, NAMED_FILES_TEXT_MAX, NamedFileChips, PROMPT_ARM_MS, PendingElicitation, PlanView, QUESTION_TIMEOUT_MS, QuestionPrompt, QuestionView, RECORDING_DEFAULT_MAX_MS, RECORDING_TYPES, RemoteRunView, SandboxedFrame, SourceView, SpeechOutputError, StepList, StepView, SubagentNode, SubagentRow, SubagentTree, SubagentView, ToolApprovalPrompt, ToolCallRow, ToolCallView, TranscriptBlock, TranscriptView, UsageBadge, UserNoteRow, UserNoteView, WorkspaceFileLink, agentStateReducer, agentStatusOf, askUserOutputKept, askUserWith, attachmentFileName, attachmentKindOf, attachmentOverLimit, attachmentRefusal, attachmentTransformOf, attachmentsText, audioExtensionOf, audioTypeOf, boxLength, buildSandboxedDocument, chatTitle, clampFrameHeight, createApprovalQueue, createAudioSpeaker, createBrowserSpeaker, createInitialAgentState, createPromptArming, createQuestionQueue, createRecordingRecognizer, createWebLLMEngine, dataUrlParts, decisionNote, defaultLabels, downscaleImage, escapeAttribute, excerptNote, fileKindOf, fileNameOf, filterCommands, followsAfterResize, followsAfterScroll, formatClock, formatElapsed, freeAttachmentPath, imageExtensionOf, imageSizeOf, inputCounterShown, insertionFits, isOneCharacter, languageOfText, lessonsOf, lineCountOf, linkedFilesOf, longTextName, longTextRoute, mediaFamilyOf, menuKeyTarget, menuSections, mergeChatRecord, mergeLabels, messageOverLimit, micProblemOf, micProblemText, namedFilesOf, newChatId, noticesOf, overflowOf, parseSlash, pathsNamedIn, pendingApprovalsOf, pickRecordingType, questionChoiceOf, questionOtherOf, questionTimeoutOf, recordingSupported, sandboxTokens, sandboxedCsp, saveAttachments, saveChat, scriptOfLanguage, scriptOfText, settleAudioDuration, speakableText, speechSynthesisSupported, splitForSpeech, startRecording, steerIntent, stopTracks, subagentTree, textExcerpt, tokenizeHtml, unchangedSince, usageLine, useAgent, useAgentContext, useAudioRecorder, useChatHistory, useCredentials, useFollowScroll, useLabels, useLocalModel, useOptionalAgentContext, useReadAloud, useSpeechToText, useSpeechVoices, useVirtualFiles, useWebLLMModel, voiceFor, voiceMessageName, voicesOf, webSearchOf, withAttachments, withCspFirst, withPolicyFirst, withoutOwnWords, workspacePathOf };
4035
+ export type { AgentAction, AgentChatClassNames, AgentChatComponents, AgentChatProps, AgentChatSlots, AgentComposerProps, AgentLabels, AgentLabelsOverride, AgentLabelsProviderProps, AgentProviderProps, ApiKeyFormProps, AppRequestPromptProps, AppToolCall, ApprovalModeSwitchProps, ApprovalQueue, ApproveOptions, ArmedButtonProps, AttachmentBounds, AttachmentFiles, AttachmentOverLimit, AttachmentTextOptions, AttachmentTexts, AttachmentTransform, AudioLike, AudioSpeakerOptions, BrowserSpeakerOptions, ChatBase, ChatHistoryListProps, ChatHistoryStoreOptions, ChatRecord, ChatSummary, ComposerAttachment, ComposerModelChip, ComposerModelOption, ComposerNotice, ComposerProps, ComposerThinkingChip, ContextMeterProps, ConvertedFile, ConvertedImage, DownscaleOptions, ElicitationPromptProps, FileChipProps, FileChipsProps, FileKind, FilesPanelProps, GeneratedMediaProps, HtmlPreviewOptions, ImageSize, ImageThumbProps, ImageViewerProps, LearnedSkillsProps, LocalModelEngine, LocalModelLoadContext, LocalModelProgress, McpAppFrameProps, McpAppLineProps, MediaRecorderConstructorLike, MediaRecorderLike, MemoryCardProps, MenuSection, MessageListProps, MicProblem, ModelLoadBarProps, NamedFileChipsProps, NamedFilesOptions, NoticeTexts, PendingQuestion, PlanViewProps, PromptArming, QuestionOutcomeReason, QuestionPromptProps, QuestionQueue, QuestionQueueOptions, ReadAloudOptions, ReadAloudState, RecordedAudio, Recording, RecordingDeps, RecordingRecognizerOptions, RenderImageViewer, RenderSubagent, RenderToolCall, RunGoalOptions, SandboxedDocumentOptions, SandboxedFrameProps, SavedAttachments, ScrollMeasure, SlashCommand, SourceToken, SourceViewProps, SpeakText, SpeakableOptions, SpeechPlayback, SpeechRecognizerLike, SpeechScript, SpeechSynthesisLike, SpeechUtteranceLike, SpeechVoiceLike, StartRecordingOptions, SteerIntent, StepListProps, SubagentRowProps, SubagentTreeProps, SynthesizeSpeech, TextExcerpt, ToolApprovalPromptProps, ToolCallRowProps, TranscribeAudio, TranscriptBlockProps, UsageBadgeProps, UseAgentOptions, UseAgentReturn, UseAudioRecorderOptions, UseAudioRecorderReturn, UseChatHistoryOptions, UseChatHistoryReturn, UseCredentialsReturn, UseLocalModelOptions, UseLocalModelReturn, UseReadAloudReturn, UseSpeechToTextOptions, UseSpeechToTextReturn, UseVirtualFilesReturn, UseWebLLMModelOptions, UseWebLLMModelReturn, ViewerImage, WebLLMModelFactory, WebSearchResultView, WebSearchView, WorkspaceFileLinkProps };