@dudko.dev/agent-web-react 0.0.43 → 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/README.md +25 -11
- package/dist/{elicitation-B5t9hdaJ.d.cts → elicitation-B-1TS-pY.d.cts} +64 -7
- package/dist/{elicitation-rJu93Z3o.d.ts → elicitation-DCr7b6IH.d.ts} +64 -7
- package/dist/index.cjs +2412 -1215
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +375 -20
- package/dist/index.d.ts +375 -20
- package/dist/index.js +2070 -897
- package/dist/index.js.map +1 -1
- package/dist/mcp.d.cts +2 -2
- package/dist/mcp.d.ts +2 -2
- package/dist/styles.css +323 -11
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ 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-
|
|
6
|
-
export {
|
|
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
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
|
/**
|
|
@@ -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
|
|
247
|
-
* allow" kept apart from the model's
|
|
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).
|
|
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:
|
|
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
|
|
@@ -1434,6 +1610,29 @@ interface AgentLabels {
|
|
|
1434
1610
|
tooManyImages: (names: string, max: number) => string;
|
|
1435
1611
|
/** Files left out: the message would carry more than `attachments.maxTotalBytes` (in MB). */
|
|
1436
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;
|
|
1437
1636
|
commandGroups: {
|
|
1438
1637
|
commands: string;
|
|
1439
1638
|
consent: string;
|
|
@@ -1594,6 +1793,11 @@ interface AgentLabels {
|
|
|
1594
1793
|
fileOpen: (name: string) => string;
|
|
1595
1794
|
/** The same button while the preview is open. */
|
|
1596
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;
|
|
1597
1801
|
/** The download button of a chip (accessible name). */
|
|
1598
1802
|
fileDownload: (name: string) => string;
|
|
1599
1803
|
/** On a chip: the subagent that wrote the file. */
|
|
@@ -1739,6 +1943,10 @@ interface AgentLabels {
|
|
|
1739
1943
|
appSandboxBroken: string;
|
|
1740
1944
|
/** The badge while a request of the app waits for the user. */
|
|
1741
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;
|
|
1742
1950
|
/** The tag on the tool call an app came with, and the activity summary's count. */
|
|
1743
1951
|
appTag: string;
|
|
1744
1952
|
appsCount: (n: number) => string;
|
|
@@ -1754,6 +1962,8 @@ interface AgentLabels {
|
|
|
1754
1962
|
appMenu: string;
|
|
1755
1963
|
appReload: string;
|
|
1756
1964
|
appOpenPanel: string;
|
|
1965
|
+
/** Under an inline app taller than the chat shows inline (`appHeightCap`): it scrolls inside. */
|
|
1966
|
+
appTaller: string;
|
|
1757
1967
|
appHide: string;
|
|
1758
1968
|
/** The note at the bottom of the menu. */
|
|
1759
1969
|
appServedBy: (server: string, uri: string) => string;
|
|
@@ -1784,6 +1994,8 @@ interface AgentLabels {
|
|
|
1784
1994
|
/** The app shown full screen (`<McpAppFrame allowFullscreen>`): the badge, the way back. */
|
|
1785
1995
|
appFullscreenBadge: string;
|
|
1786
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;
|
|
1787
1999
|
/** The key that exits too, shown on the button. */
|
|
1788
2000
|
appFullscreenKey: string;
|
|
1789
2001
|
/** A file the app asks to save (`<AppRequestPrompt>`). */
|
|
@@ -2219,6 +2431,29 @@ interface AgentComposerProps {
|
|
|
2219
2431
|
id: string;
|
|
2220
2432
|
text: string;
|
|
2221
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;
|
|
2222
2457
|
disabled?: boolean;
|
|
2223
2458
|
className?: string;
|
|
2224
2459
|
}
|
|
@@ -2238,7 +2473,7 @@ interface AgentComposerProps {
|
|
|
2238
2473
|
*
|
|
2239
2474
|
* Every piece can be switched off; `<AgentChat>` uses it as its footer.
|
|
2240
2475
|
*/
|
|
2241
|
-
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;
|
|
2242
2477
|
|
|
2243
2478
|
interface ChatHistoryListProps {
|
|
2244
2479
|
/** From `useChatHistory(agent)`. */
|
|
@@ -2252,9 +2487,15 @@ interface ChatHistoryListProps {
|
|
|
2252
2487
|
formatTime?: (ms: number) => string;
|
|
2253
2488
|
labels?: AgentLabelsOverride;
|
|
2254
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;
|
|
2255
2496
|
}
|
|
2256
2497
|
/** The saved conversations: a "New chat" button, then one row per chat (newest first). */
|
|
2257
|
-
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;
|
|
2258
2499
|
|
|
2259
2500
|
interface ElicitationPromptProps {
|
|
2260
2501
|
/**
|
|
@@ -2319,13 +2560,19 @@ interface FilesPanelProps {
|
|
|
2319
2560
|
renderFile?: (file: VirtualFileInfo, fallback: ReactNode) => ReactNode;
|
|
2320
2561
|
labels?: AgentLabelsOverride;
|
|
2321
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;
|
|
2322
2569
|
}
|
|
2323
2570
|
/**
|
|
2324
2571
|
* The agent's workspace — attachments the user dropped in, files the agent
|
|
2325
2572
|
* wrote with its `fs_*` tools — live, with a preview (text / image),
|
|
2326
2573
|
* download, delete and upload.
|
|
2327
2574
|
*/
|
|
2328
|
-
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;
|
|
2329
2576
|
|
|
2330
2577
|
/** A picture the viewer shows: where it is read from (`data:` / `blob:` / a URL) and its name. */
|
|
2331
2578
|
interface ViewerImage {
|
|
@@ -2824,11 +3071,15 @@ interface ToolApprovalPromptProps {
|
|
|
2824
3071
|
}) => void;
|
|
2825
3072
|
onDeny: (id: string, reason?: string) => void;
|
|
2826
3073
|
/**
|
|
2827
|
-
* Offer "Always allow" (remembers the tool for the agent's life
|
|
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
|
|
2828
3076
|
* MCP server's skill, "Always for this server" (that server's skills for the agent's life,
|
|
2829
|
-
* 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).
|
|
2830
3081
|
*/
|
|
2831
|
-
allowRemember?: boolean;
|
|
3082
|
+
allowRemember?: boolean | ((approval: ApprovalView) => boolean);
|
|
2832
3083
|
/**
|
|
2833
3084
|
* On a request about an MCP server's skill: the collapsible preview of the instructions the
|
|
2834
3085
|
* model would read (plain text). Default true.
|
|
@@ -3280,6 +3531,37 @@ interface SandboxedFrameProps {
|
|
|
3280
3531
|
*/
|
|
3281
3532
|
declare const SandboxedFrame: ({ html, scripts, title, label, actions, footer, height, children, className, }: SandboxedFrameProps) => react.JSX.Element;
|
|
3282
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
|
+
|
|
3283
3565
|
/**
|
|
3284
3566
|
* The sandboxed frame's security core: what untrusted HTML (a file the agent wrote, later an
|
|
3285
3567
|
* MCP App) is wrapped in before it reaches an `<iframe>`. Pure strings - no React, no DOM - so
|
|
@@ -3528,6 +3810,8 @@ interface ApprovalModeSwitchProps {
|
|
|
3528
3810
|
modes?: ToolApprovalMode[];
|
|
3529
3811
|
/** Override the button labels. */
|
|
3530
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>>;
|
|
3531
3815
|
disabled?: boolean;
|
|
3532
3816
|
className?: string;
|
|
3533
3817
|
}
|
|
@@ -3535,7 +3819,7 @@ interface ApprovalModeSwitchProps {
|
|
|
3535
3819
|
* A segmented control for the tool-consent policy — the "autopilot" switch.
|
|
3536
3820
|
* Pair it with {@link useAgent}'s `approvalMode` / `setApprovalMode`.
|
|
3537
3821
|
*/
|
|
3538
|
-
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;
|
|
3539
3823
|
|
|
3540
3824
|
interface ContextMeterProps {
|
|
3541
3825
|
usage: IUsage;
|
|
@@ -3624,6 +3908,20 @@ interface McpAppFrameProps {
|
|
|
3624
3908
|
* focus kept inside. Default false: an app stays inline.
|
|
3625
3909
|
*/
|
|
3626
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;
|
|
3627
3925
|
labels?: AgentLabelsOverride;
|
|
3628
3926
|
className?: string;
|
|
3629
3927
|
}
|
|
@@ -3634,10 +3932,13 @@ interface McpAppFrameProps {
|
|
|
3634
3932
|
* `mcp-app.ts` builds: an opaque origin - or, with `host.sandbox`, an origin of its own behind the
|
|
3635
3933
|
* sandbox page (falling back to the opaque frame when that page does not answer) - network only
|
|
3636
3934
|
* where its resource declared it, no navigation, and every request that does something (a tool
|
|
3637
|
-
* call, a link, a message) put to the user through the host.
|
|
3638
|
-
*
|
|
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.
|
|
3639
3940
|
*/
|
|
3640
|
-
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;
|
|
3641
3942
|
interface McpAppLineProps {
|
|
3642
3943
|
app: AppView;
|
|
3643
3944
|
/** What the line says after the title ("hidden", "open in the panel"). */
|
|
@@ -3676,5 +3977,59 @@ interface AppRequestPromptProps {
|
|
|
3676
3977
|
*/
|
|
3677
3978
|
declare const AppRequestPrompt: ({ requests, onAnswer, renderRequest, labels, className, }: AppRequestPromptProps) => react.JSX.Element | null;
|
|
3678
3979
|
|
|
3679
|
-
|
|
3680
|
-
|
|
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 };
|