@dudko.dev/agent-web-react 0.0.29 → 0.0.31
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 +360 -19
- package/dist/{chunk-UUB7CE6N.js → chunk-EMF7DTGS.js} +69 -1
- package/dist/chunk-EMF7DTGS.js.map +1 -0
- package/dist/chunk-FXHQXIOU.js +94 -0
- package/dist/chunk-FXHQXIOU.js.map +1 -0
- package/dist/chunk-VMCWL6VH.js +294 -0
- package/dist/chunk-VMCWL6VH.js.map +1 -0
- package/dist/elicitation-DbW6QKxS.d.cts +1537 -0
- package/dist/elicitation-DbW6QKxS.d.ts +1537 -0
- package/dist/index.cjs +4364 -618
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +712 -433
- package/dist/index.d.ts +712 -433
- package/dist/index.js +4033 -628
- package/dist/index.js.map +1 -1
- package/dist/mcp-app-policy-DIUmGPJP.d.cts +55 -0
- package/dist/mcp-app-policy-DIUmGPJP.d.ts +55 -0
- package/dist/mcp-app-sandbox.cjs +313 -0
- package/dist/mcp-app-sandbox.cjs.map +1 -0
- package/dist/mcp-app-sandbox.d.cts +65 -0
- package/dist/mcp-app-sandbox.d.ts +65 -0
- package/dist/mcp-app-sandbox.js +201 -0
- package/dist/mcp-app-sandbox.js.map +1 -0
- package/dist/mcp.cjs +322 -42
- package/dist/mcp.cjs.map +1 -1
- package/dist/mcp.d.cts +185 -96
- package/dist/mcp.d.ts +185 -96
- package/dist/mcp.js +240 -46
- package/dist/mcp.js.map +1 -1
- package/dist/pipeline.cjs.map +1 -1
- package/dist/pipeline.js +1 -1
- package/dist/styles.css +1140 -0
- package/package.json +13 -3
- package/dist/chunk-UUB7CE6N.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,427 +1,10 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { DependencyList, ReactNode, RefObject, ComponentType, CSSProperties } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
export { Agent, AgentEvent, AgentEventHandler, AgentLoggerSink, AgentTool, AgentToolSet, AttachmentsNotSupportedError, BrowserAgentConfig, CompactResult, CompactionConfig, CredentialStore, FileToolsOptions, IPlan, IPlanStep, IStepResult, IToolCall, IUsage, ImagesNotSupportedError, IndexedDBStore, LearningConfig, LogLevel, MemoryCredentialStore, MemorySkillStore, MemoryStore, ModelInput, ProviderModelSpec, ProviderType, RunControl, RunFile, RunOptions, RunResult, Skill, SkillStore, SubagentInfo, SubagentToolOptions, SubagentWorkerConfig, ThinkingLevel, ThinkingSetting, TokenLimits, ToolApprovalConfig, ToolApprovalMode, ToolApprovalRequest, VaultCredentialStore, VfsSkillStore, VirtualFile, VirtualFileInfo, VirtualFileSystem, createAgent, createFileTools, createRunControl, createSubagentTool, createWebLLMModel, defineSkill, defineTool, isWebGPUAvailable, loadSkillFromUrl, markReadOnly, parseSkillMarkdown, preloadWebLLMModel, serveSubagentWorker, supportsImages, supportsPdf, unloadWebLLMModel } from '@dudko.dev/agent-web';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
kind: 'input' | 'output' | 'reasoning' | 'total' | 'tool-calls';
|
|
9
|
-
tokens: number;
|
|
10
|
-
cap: number;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Lifecycle of the agent instance the hook owns.
|
|
14
|
-
* - `idle` — no config yet, nothing built.
|
|
15
|
-
* - `initializing` — building the agent (dynamic provider imports, vault key
|
|
16
|
-
* fetch, and — for WebLLM — weight download).
|
|
17
|
-
* - `ready` — the agent is built and can run.
|
|
18
|
-
* - `running` — a run is in flight.
|
|
19
|
-
* - `error` — the agent failed to build (a run error keeps it `ready`).
|
|
20
|
-
*/
|
|
21
|
-
type AgentStatus = 'idle' | 'initializing' | 'ready' | 'running' | 'error';
|
|
22
|
-
/** A file or image shown with a message (and, for images, sent to the model). */
|
|
23
|
-
interface ChatAttachment {
|
|
24
|
-
name: string;
|
|
25
|
-
mediaType: string;
|
|
26
|
-
/** A data URL (images: thumbnail + full view) — kept so a saved chat can show it again. */
|
|
27
|
-
dataUrl?: string;
|
|
28
|
-
/** Where it was stored in the virtual file system, if it was. */
|
|
29
|
-
path?: string;
|
|
30
|
-
size?: number;
|
|
31
|
-
}
|
|
32
|
-
/** One turn of the chat transcript that a chat UI renders. */
|
|
33
|
-
interface ChatMessage {
|
|
34
|
-
id: string;
|
|
35
|
-
role: 'user' | 'assistant';
|
|
36
|
-
content: string;
|
|
37
|
-
/** An assistant message that is still streaming (no final/stopped/error yet). */
|
|
38
|
-
pending: boolean;
|
|
39
|
-
/** User turn: what was attached (images, files). */
|
|
40
|
-
attachments?: ChatAttachment[];
|
|
41
|
-
/** Assistant turn: the run's steps — tool calls, thoughts, subagents — as they happened. */
|
|
42
|
-
steps?: StepView[];
|
|
43
|
-
/** Assistant turn: consent decisions of the run. */
|
|
44
|
-
approvals?: ApprovalView[];
|
|
45
|
-
/** Assistant turn: subagent delegations of the run. */
|
|
46
|
-
subagents?: SubagentView[];
|
|
47
|
-
/** Assistant turn: what the user said while the run was going, and where it reached the agent. */
|
|
48
|
-
notes?: UserNoteView[];
|
|
49
|
-
/** Assistant turn: the synthesizer's thoughts. */
|
|
50
|
-
reasoning?: string;
|
|
51
|
-
/** Assistant turn: tokens the run spent, by kind. */
|
|
52
|
-
usage?: IUsage;
|
|
53
|
-
/** Assistant turn: wall-clock duration of the run (needs timestamps from the hook). */
|
|
54
|
-
durationMs?: number;
|
|
55
|
-
/** Assistant turn: skills the run used. */
|
|
56
|
-
skills?: string[];
|
|
57
|
-
/** Assistant turn: lessons the agent wrote down during the run (names). */
|
|
58
|
-
learned?: string[];
|
|
59
|
-
/** Assistant turn: what the model fetched from the web during the run. */
|
|
60
|
-
fetches?: FetchView[];
|
|
61
|
-
/** Assistant turn: the images and audio the run generated (`config.media`); absent when none. */
|
|
62
|
-
media?: MediaView[];
|
|
63
|
-
/** Assistant turn: the audio the run transcribed (`config.media`); absent when none. */
|
|
64
|
-
transcripts?: TranscriptView[];
|
|
65
|
-
/** Assistant turn ended with an error. */
|
|
66
|
-
error?: boolean;
|
|
67
|
-
}
|
|
68
|
-
/** A single tool call as it appears in a step, streamed then finalized. */
|
|
69
|
-
interface ToolCallView {
|
|
70
|
-
name: string;
|
|
71
|
-
input: unknown;
|
|
72
|
-
output?: unknown;
|
|
73
|
-
ok?: boolean;
|
|
74
|
-
status: 'calling' | 'done';
|
|
75
|
-
/** When the call started (ms epoch; set when the hook stamps events). */
|
|
76
|
-
startedAt?: number;
|
|
77
|
-
/** How long the call took. */
|
|
78
|
-
durationMs?: number;
|
|
79
|
-
/** ≈ tokens of the arguments the model wrote (chars / 4). */
|
|
80
|
-
inputTokens?: number;
|
|
81
|
-
/** ≈ tokens of the result fed back to the model (chars / 4). */
|
|
82
|
-
outputTokens?: number;
|
|
83
|
-
/**
|
|
84
|
-
* Set on a call of an attempt that was escalated (model tiers): the attempt it belongs to,
|
|
85
|
-
* 1 for the step's first. A call of the attempt the step is on now (or finished on) has none.
|
|
86
|
-
*/
|
|
87
|
-
attempt?: number;
|
|
88
|
-
/**
|
|
89
|
-
* The core did NOT run this call again: the same write already succeeded in an earlier attempt
|
|
90
|
-
* at the step, and the model was handed that result (`output` carries the core's note).
|
|
91
|
-
*/
|
|
92
|
-
replayed?: boolean;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* One escalation of a step (a `step.escalated` event): the attempt on tier `from` failed for
|
|
96
|
-
* `reason` and the step was retried on the stronger tier `to`.
|
|
97
|
-
*/
|
|
98
|
-
interface StepEscalationView {
|
|
99
|
-
from: ModelTier;
|
|
100
|
-
to: ModelTier;
|
|
101
|
-
reason: EscalationReason;
|
|
102
|
-
/** The model id of `to` (absent only when the escalation is known from the step's result alone). */
|
|
103
|
-
model?: string;
|
|
104
|
-
/** What the failed attempt had written when it was escalated (its streamed text), if anything. */
|
|
105
|
-
text?: string;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* A lesson in the agent's notebook (`config.learning`): a skill the agent wrote down itself.
|
|
109
|
-
* `revision` goes up each time it rewrites the lesson.
|
|
110
|
-
*/
|
|
111
|
-
interface LessonView {
|
|
112
|
-
name: string;
|
|
113
|
-
/** WHEN the lesson applies - the line the planner sees. */
|
|
114
|
-
description: string;
|
|
115
|
-
revision: number;
|
|
116
|
-
/** Size of the instructions, in characters. */
|
|
117
|
-
chars: number;
|
|
118
|
-
/** What it consulted: the sources it named, then the pages `web_fetch` read in that run. */
|
|
119
|
-
sources: string[];
|
|
120
|
-
}
|
|
121
|
-
/** One request the model made through `web_fetch` (an `egress.request` event). */
|
|
122
|
-
interface FetchView {
|
|
123
|
-
/** Origin and path only - the core never reports the query string. */
|
|
124
|
-
url: string;
|
|
125
|
-
allowed: boolean;
|
|
126
|
-
status?: number;
|
|
127
|
-
/** Why it was refused. */
|
|
128
|
-
reason?: string;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* A file a media tool wrote (a `media.generated` event). The bytes are in the virtual file system
|
|
132
|
-
* at `path` - never in the state.
|
|
133
|
-
*/
|
|
134
|
-
interface MediaView {
|
|
135
|
-
kind: 'image' | 'speech';
|
|
136
|
-
path: string;
|
|
137
|
-
mediaType: string;
|
|
138
|
-
/** Size of the file. */
|
|
139
|
-
bytes: number;
|
|
140
|
-
/** The media model that made it. */
|
|
141
|
-
model: string;
|
|
142
|
-
/** The step whose tool call made it, when the event named one. */
|
|
143
|
-
stepId?: string;
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* An audio file that was transcribed (a `media.transcribed` event): one the user attached
|
|
147
|
-
* (`attachment`) or one the model asked about (`tool`). `text` is the content of that file -
|
|
148
|
-
* third-party text, never instructions.
|
|
149
|
-
*/
|
|
150
|
-
interface TranscriptView {
|
|
151
|
-
source: 'attachment' | 'tool';
|
|
152
|
-
/** The file's name. */
|
|
153
|
-
name: string;
|
|
154
|
-
text: string;
|
|
155
|
-
language?: string;
|
|
156
|
-
durationInSeconds?: number;
|
|
157
|
-
model: string;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* One question put to `config.decisionModel` (a `decision` event): its answer was used
|
|
161
|
-
* (`accepted`), or the ordinary model call ran and `reason` says why.
|
|
162
|
-
*/
|
|
163
|
-
interface DecisionView {
|
|
164
|
-
point: DecisionPoint;
|
|
165
|
-
accepted: boolean;
|
|
166
|
-
choice?: string;
|
|
167
|
-
/** The probability the decision model gave its choice, 0..1. */
|
|
168
|
-
confidence?: number;
|
|
169
|
-
threshold: number;
|
|
170
|
-
reason?: DecisionFallbackReason;
|
|
171
|
-
durationMs: number;
|
|
172
|
-
model?: string;
|
|
173
|
-
}
|
|
174
|
-
/** A tool call waiting for (or decided by) the user's consent. */
|
|
175
|
-
interface ApprovalView {
|
|
176
|
-
id: string;
|
|
177
|
-
name: string;
|
|
178
|
-
input: unknown;
|
|
179
|
-
readOnly: boolean;
|
|
180
|
-
/** The step the call belongs to, when known. */
|
|
181
|
-
stepId?: string;
|
|
182
|
-
/**
|
|
183
|
-
* Set when a helper the model started is asking, not the run itself: its id (a node of
|
|
184
|
-
* `subagents`), its depth, and - when its `subagent.start` was seen - its name and role.
|
|
185
|
-
*/
|
|
186
|
-
subagent?: {
|
|
187
|
-
id: string;
|
|
188
|
-
depth: number;
|
|
189
|
-
name?: string;
|
|
190
|
-
role?: string;
|
|
191
|
-
};
|
|
192
|
-
status: 'pending' | 'approved' | 'denied';
|
|
193
|
-
reason?: string;
|
|
194
|
-
/** Decided by policy (rule / read-only mode), not by a person. */
|
|
195
|
-
automatic?: boolean;
|
|
196
|
-
}
|
|
197
|
-
/** A message sent to the agent while it works, still waiting for a boundary to be shown to the model. */
|
|
198
|
-
interface QueuedMessageView {
|
|
199
|
-
id: string;
|
|
200
|
-
text: string;
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* A message the user sent while the run was going, after it reached the agent.
|
|
204
|
-
* `at` says where: `round` = between tool calls inside a step, `step` = at the end
|
|
205
|
-
* of a step (the replanner then re-checked the plan), `final` = just before the
|
|
206
|
-
* answer was written.
|
|
207
|
-
*/
|
|
208
|
-
interface UserNoteView {
|
|
209
|
-
id: string;
|
|
210
|
-
text: string;
|
|
211
|
-
at: 'round' | 'step' | 'final';
|
|
212
|
-
/** The step it was delivered in (`round`) or after (`step`); none for `final`. */
|
|
213
|
-
stepId?: string;
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* A delegated task running in a subagent: one the host defined (`createSubagentTool`, in-process
|
|
217
|
-
* or a Web Worker) or a helper the model started (`spawn_subagent`). Each is a NODE OF A TREE:
|
|
218
|
-
* `parentId` / `depth` say where, and {@link subagentTree} nests the flat list.
|
|
219
|
-
*/
|
|
220
|
-
interface SubagentView {
|
|
221
|
-
id: string;
|
|
222
|
-
/** The subagent's name (`spawn_subagent` for a helper the model started). */
|
|
223
|
-
name: string;
|
|
224
|
-
/** Empty when only its events were seen (its `subagent.start` never arrived). */
|
|
225
|
-
task: string;
|
|
226
|
-
/**
|
|
227
|
-
* The subagent that started this one; absent for the run's own subagents (depth 1). A parent
|
|
228
|
-
* that is not in the list (its start was never seen) leaves the node at the top of the tree.
|
|
229
|
-
*/
|
|
230
|
-
parentId?: string;
|
|
231
|
-
/** 1 for the run's own subagents, 2 for theirs, ... */
|
|
232
|
-
depth: number;
|
|
233
|
-
/** A helper the model started itself (`subagents.dynamic`). */
|
|
234
|
-
dynamic?: true;
|
|
235
|
-
/** What the model wrote for a helper it started. Model-written text. */
|
|
236
|
-
role?: string;
|
|
237
|
-
/** The tool names a helper was given. */
|
|
238
|
-
tools?: string[];
|
|
239
|
-
/** The model and tier its latest step ran on - known only when the child uses model tiers. */
|
|
240
|
-
model?: string;
|
|
241
|
-
tier?: ModelTier;
|
|
242
|
-
/** When it started (ms epoch; set when the hook stamps events). */
|
|
243
|
-
startedAt?: number;
|
|
244
|
-
/** How long it ran, once it ended. */
|
|
245
|
-
durationMs?: number;
|
|
246
|
-
/** `stopped`: the user stopped this subagent; the run went on without it. */
|
|
247
|
-
status: 'running' | 'done' | 'error' | 'stopped';
|
|
248
|
-
/** The profile the parent model chose for this delegation, when there are profiles. */
|
|
249
|
-
profile?: string;
|
|
250
|
-
/** The step that delegated it, when known. */
|
|
251
|
-
stepId?: string;
|
|
252
|
-
/** What the child is doing right now ("step 2: …", "→ tool"). */
|
|
253
|
-
activity: string;
|
|
254
|
-
/** Steps the child started. */
|
|
255
|
-
steps: number;
|
|
256
|
-
/** Tool calls the child made. */
|
|
257
|
-
toolCalls: number;
|
|
258
|
-
/** The child's answer (streamed, then final). */
|
|
259
|
-
text: string;
|
|
260
|
-
/**
|
|
261
|
-
* Tokens spent under this node, its own subagents included: counted live from its `usage`
|
|
262
|
-
* events, then replaced by the total its end reports.
|
|
263
|
-
*/
|
|
264
|
-
usage: IUsage;
|
|
265
|
-
error?: string;
|
|
266
|
-
}
|
|
267
|
-
/** A {@link SubagentView} with the subagents it started (see {@link subagentTree}). */
|
|
268
|
-
interface SubagentNode extends SubagentView {
|
|
269
|
-
children: SubagentNode[];
|
|
270
|
-
}
|
|
271
|
-
/** One compaction of the context (a `context.compacted` event). */
|
|
272
|
-
interface CompactionView {
|
|
273
|
-
scope: 'history' | 'trace' | 'tool-results';
|
|
274
|
-
beforeTokens: number;
|
|
275
|
-
afterTokens: number;
|
|
276
|
-
}
|
|
277
|
-
/** An execution step with its accumulated text and tool calls. */
|
|
278
|
-
interface StepView {
|
|
279
|
-
id: string;
|
|
280
|
-
index: number;
|
|
281
|
-
total: number;
|
|
282
|
-
step: IPlanStep;
|
|
283
|
-
/** Streamed executor text for this step (step.text-delta). */
|
|
284
|
-
text: string;
|
|
285
|
-
/** Streamed executor thoughts for this step (step.reasoning-delta). */
|
|
286
|
-
reasoning: string;
|
|
287
|
-
toolCalls: ToolCallView[];
|
|
288
|
-
status: 'running' | 'done';
|
|
289
|
-
summary?: string;
|
|
290
|
-
blocked: boolean;
|
|
291
|
-
/**
|
|
292
|
-
* Model tiers (`config.executorTiers`) - all four are absent when tiers are off.
|
|
293
|
-
* `tier` / `model`: the tier the step is on NOW (where it started, then where an escalation
|
|
294
|
-
* took it, then where it finished) and that tier's model id.
|
|
295
|
-
*/
|
|
296
|
-
tier?: ModelTier;
|
|
297
|
-
model?: string;
|
|
298
|
-
/** Why the step STARTED on its tier: the planner's rating, the default, or a fallback. */
|
|
299
|
-
tierReason?: TierReason;
|
|
300
|
-
/**
|
|
301
|
-
* The step's escalations, in order. `text` / `reasoning` above hold the current attempt only;
|
|
302
|
-
* the calls of the attempts before it stay in `toolCalls`, marked with their `attempt`.
|
|
303
|
-
*/
|
|
304
|
-
escalations?: StepEscalationView[];
|
|
305
|
-
/**
|
|
306
|
-
* The replanner call that followed this step failed (the provider's error): the run went on
|
|
307
|
-
* with the plan it had. A warning, not a failed step.
|
|
308
|
-
*/
|
|
309
|
-
replanFailed?: string;
|
|
310
|
-
/** What `config.decisionModel` was asked after this step; absent without a decision model. */
|
|
311
|
-
decisions?: DecisionView[];
|
|
312
|
-
/** The files this step's media tools wrote (also in the turn's `media`); absent when none. */
|
|
313
|
-
media?: MediaView[];
|
|
314
|
-
}
|
|
315
|
-
/** WebLLM weight-download / engine-init progress (model.load events). */
|
|
316
|
-
interface ModelLoadState {
|
|
317
|
-
progress: number;
|
|
318
|
-
text: string;
|
|
319
|
-
}
|
|
320
|
-
interface ReplanState {
|
|
321
|
-
mode: ReplanMode;
|
|
322
|
-
reason: string;
|
|
323
|
-
/** The replanner ran because the user sent a message, not because a step failed. */
|
|
324
|
-
byUser?: boolean;
|
|
325
|
-
/**
|
|
326
|
-
* The replanner call itself failed and `continue` is the fallback, not the model's decision.
|
|
327
|
-
* `error` is the failure (the `error` event of phase `replan` that came just before).
|
|
328
|
-
*/
|
|
329
|
-
failed?: true;
|
|
330
|
-
error?: string;
|
|
331
|
-
/** `config.decisionModel` made this decision: the probability it gave its choice. */
|
|
332
|
-
confidence?: number;
|
|
333
|
-
}
|
|
334
|
-
/**
|
|
335
|
-
* The whole UI-facing view of an agent run, rebuilt purely from the stream of
|
|
336
|
-
* `AgentEvent`s by {@link agentStateReducer}. `status` is owned by the hook
|
|
337
|
-
* (build/run lifecycle) and layered on top; everything else here is derived
|
|
338
|
-
* only from events, so the reducer is deterministic and testable without React.
|
|
339
|
-
*/
|
|
340
|
-
interface AgentUiState {
|
|
341
|
-
status: AgentStatus;
|
|
342
|
-
/** The goal of the current / most recent run. */
|
|
343
|
-
goal?: string;
|
|
344
|
-
/** The last plan the agent produced (created or revised). */
|
|
345
|
-
plan?: IPlan;
|
|
346
|
-
/** Streamed planner "thinking" text (plan.thought-delta). */
|
|
347
|
-
planThought: string;
|
|
348
|
-
/** Execution steps, in order, with their tool calls. */
|
|
349
|
-
steps: StepView[];
|
|
350
|
-
/** The final answer (streamed via final.text-delta, finalized on final). */
|
|
351
|
-
finalText: string;
|
|
352
|
-
/** The synthesizer's streamed thoughts (final.reasoning-delta). */
|
|
353
|
-
finalReasoning: string;
|
|
354
|
-
/** Tool calls that asked for consent in this run, pending first-come. */
|
|
355
|
-
approvals: ApprovalView[];
|
|
356
|
-
/**
|
|
357
|
-
* Subagent delegations of this run - static subagents and the helpers the model started, at
|
|
358
|
-
* every depth, in the order they started. A tree: see `SubagentView.parentId` / `subagentTree`.
|
|
359
|
-
*/
|
|
360
|
-
subagents: SubagentView[];
|
|
361
|
-
/** Messages sent while the run goes that have not yet been shown to the model. */
|
|
362
|
-
queued: QueuedMessageView[];
|
|
363
|
-
/** What the user said during this run and when it reached the agent. */
|
|
364
|
-
notes: UserNoteView[];
|
|
365
|
-
/**
|
|
366
|
-
* Messages the run ended without showing the model (sent while the answer was being
|
|
367
|
-
* written, or still queued when the run was stopped). The hook sends them as a
|
|
368
|
-
* follow-up unless the run was stopped; see `useAgent`'s `followUp`.
|
|
369
|
-
*/
|
|
370
|
-
undelivered: string[];
|
|
371
|
-
/** Skills activated in this run. */
|
|
372
|
-
skills: string[];
|
|
373
|
-
/**
|
|
374
|
-
* The agent's notebook: the lessons it wrote down (`config.learning`). It belongs to the
|
|
375
|
-
* agent, not to a conversation - it survives `reset` and a chat switch, and the hook
|
|
376
|
-
* re-reads it whenever the agent is rebuilt.
|
|
377
|
-
*/
|
|
378
|
-
learned: LessonView[];
|
|
379
|
-
/** Names of the lessons written in this run. */
|
|
380
|
-
learnedNow: string[];
|
|
381
|
-
/** What the model fetched from the web in this run (`config.egress`). */
|
|
382
|
-
fetches: FetchView[];
|
|
383
|
-
/** Images and audio generated in this run (`config.media`). Absent until the first one. */
|
|
384
|
-
media?: MediaView[];
|
|
385
|
-
/** Audio transcribed in this run (`config.media`). Absent until the first one. */
|
|
386
|
-
transcripts?: TranscriptView[];
|
|
387
|
-
/**
|
|
388
|
-
* Questions put to `config.decisionModel` before any step existed (a decision that follows a
|
|
389
|
-
* step is on that step). Absent until the first one.
|
|
390
|
-
*/
|
|
391
|
-
decisions?: DecisionView[];
|
|
392
|
-
/** Tools activated by find_tools in this run. */
|
|
393
|
-
discoveredTools: string[];
|
|
394
|
-
/** Compactions in this run. */
|
|
395
|
-
compactions: CompactionView[];
|
|
396
|
-
/** Set when a run-level limit stopped the run early. */
|
|
397
|
-
budget?: BudgetView;
|
|
398
|
-
/** Running token total across the current run. */
|
|
399
|
-
usage: IUsage;
|
|
400
|
-
/** Token total across the whole conversation (every run since the last reset). */
|
|
401
|
-
totalUsage: IUsage;
|
|
402
|
-
/** When the current run started (ms epoch; set when the hook stamps events). */
|
|
403
|
-
runStartedAt?: number;
|
|
404
|
-
/** The id of the assistant message the current run streams into. */
|
|
405
|
-
runMessageId?: string;
|
|
406
|
-
/** WebLLM progress, present only while a local model is loading. */
|
|
407
|
-
modelLoad?: ModelLoadState;
|
|
408
|
-
/** The most recent replan decision, if any. */
|
|
409
|
-
replan?: ReplanState;
|
|
410
|
-
/**
|
|
411
|
-
* Error message from the last run error / build failure. A non-fatal `plan` / `execute` /
|
|
412
|
-
* `synthesize` error is kept here too while the run goes on; a replanner failure is not (see
|
|
413
|
-
* `replan.failed` and `StepView.replanFailed`).
|
|
414
|
-
*/
|
|
415
|
-
error?: string;
|
|
416
|
-
/** True when the last run was aborted via stop(). */
|
|
417
|
-
stopped: boolean;
|
|
418
|
-
/** A chat-style transcript built from every run, for chat UIs. */
|
|
419
|
-
messages: ChatMessage[];
|
|
420
|
-
/** The raw event log (most recent last), capped by `maxEvents`. */
|
|
421
|
-
events: AgentEvent[];
|
|
422
|
-
/** Monotonic counter; mints stable message ids without Date/Math.random. */
|
|
423
|
-
seq: number;
|
|
424
|
-
}
|
|
3
|
+
import { RunFile, RunResult, Agent, ToolApprovalMode, AppToolCallRequest, AppSamplingRequest, AppSamplingView, AppSamplingResult, CompactResult, IUsage, AgentEventHandler, BrowserAgentConfig, VirtualFileInfo, VirtualFileSystem, CredentialStore, createWebLLMModel, WebLLMModelOptions, ModelTier, TierReason, EscalationReason, DecisionFallbackReason, AgentEvent, Skill, IPlan, ToolApprovalRequest, ToolApprovalContext, ToolApprovalDecision } from '@dudko.dev/agent-web';
|
|
4
|
+
export { Agent, AgentEvent, AgentEventHandler, AgentLoggerSink, AgentTool, AgentToolSet, AppToolCallRequest, AttachmentsNotSupportedError, BrowserAgentConfig, CompactResult, CompactionConfig, CredentialStore, FileToolsOptions, IPlan, IPlanStep, IStepResult, IToolCall, IUsage, ImagesNotSupportedError, IndexedDBStore, LearningConfig, LogLevel, McpAppCsp, McpAppResource, McpAppToolResult, MemoryCredentialStore, MemorySkillStore, MemoryStore, ModelInput, ProviderModelSpec, ProviderType, RunControl, RunFile, RunOptions, RunResult, Skill, SkillStore, SubagentInfo, SubagentToolOptions, SubagentWorkerConfig, ThinkingLevel, ThinkingSetting, TokenLimits, ToolApprovalConfig, ToolApprovalContext, ToolApprovalMode, ToolApprovalRequest, VaultCredentialStore, VfsSkillStore, VirtualFile, VirtualFileInfo, VirtualFileSystem, createAgent, createFileTools, createRunControl, createSubagentTool, createWebLLMModel, defineSkill, defineTool, isWebGPUAvailable, loadSkillFromUrl, markReadOnly, parseSkillMarkdown, preloadWebLLMModel, serveSubagentWorker, supportsImages, supportsPdf, unloadWebLLMModel } 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, L as LessonView, S as SubagentView, e as SubagentNode, P as PendingElicitation, f as McpElicitationResult, g as ElicitationView, W as WrittenFileView, T as ToolCallView, h as StepView, U as UserNoteView, D as DecisionView, i as MediaView, j as AppView, k as McpAppsConnectionLike, l as McpAppSandboxOptions, m as AppRequestView, n as TranscriptView, B as BudgetView, o as CompactionView, p as ModelLoadState, q as McpAppHost, r as AppRequestAnswerOptions } from './elicitation-DbW6QKxS.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, Q as ElicitationOption, R as FetchView, V as MCP_APP_DISPLAY_MODES, X as MCP_APP_MAX_ARGS_CHARS, Y as MCP_APP_MAX_DOWNLOAD_BYTES, Z as MCP_APP_MAX_FILE_NAME_CHARS, _ as MCP_APP_MAX_IN_FLIGHT, $ as MCP_APP_MAX_MESSAGE_CHARS, a0 as MCP_APP_MAX_URL_CHARS, a1 as MCP_APP_NOTIFICATIONS, a2 as MCP_APP_OPTIONAL_REQUESTS, a3 as MCP_APP_PROTOCOL_VERSION, a4 as MCP_APP_REFUSED, a5 as MCP_APP_REFUSED_DOWNLOAD_EXTENSIONS, a6 as MCP_APP_REFUSED_DOWNLOAD_TYPES, a7 as MCP_APP_RELAY, a8 as MCP_APP_REQUESTS, a9 as MCP_APP_SANDBOX_FRAME_TOKENS, aa as MCP_APP_SANDBOX_GRACE_MS, ab as MCP_APP_SANDBOX_SERVER, ac as MCP_APP_SANDBOX_TIMEOUT_MS, ad as McpAppBridge, ae as McpAppBridgeHandlers, af as McpAppBridgeOptions, ag as McpAppDisplayMode, ah as McpAppRpcError, ai as McpAppRpcMessage, aj as McpAppSandboxInput, ak as McpAppSandboxLink, al as McpAppSandboxLinkOptions, am as McpAppSandboxTarget, an as McpElicitationFieldSchema, ao as McpElicitationRequest, ap as McpElicitationSchema, aq as QueuedMessageView, ar as ReplanState, as as SkillConsentView, at as StepEscalationView, au as UseMcpAppHostOptions, av as appDisplayModeAllowed, aw as appDownloadOf, ax as appDownloadRefusal, ay as appFileExtensionOf, az as appFileNameOf, aA as appGestureOf, aB as appLinkOf, aC as appMessageTextOf, aD as appMimeTypeOf, aE as appSamplingErrorOf, aF as buildMcpAppDocument, aG as buildMcpAppSandboxShell, aH as clampAppHeight, aI as elicitationFields, aJ as elicitationFormAnswer, aK as elicitationInitialDraft, aL as elicitationLink, aM as formatCountdown, aN as grantedAppCsp, aO as mcpAppCsp, aP as mcpAppHostCapabilities, aQ as mcpAppSandboxProxyUrl, aR as mcpAppSandboxShellCsp, aS as mcpAppSandboxTarget, aT as resolveAppDownload, aU as saveAppFile, aV as useMcpAppHost } from './elicitation-DbW6QKxS.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';
|
|
425
8
|
|
|
426
9
|
interface UseAgentOptions {
|
|
427
10
|
/**
|
|
@@ -512,6 +95,23 @@ interface UseAgentReturn extends AgentUiState {
|
|
|
512
95
|
approvalMode: ToolApprovalMode;
|
|
513
96
|
/** Switch the consent policy live — the "autopilot" toggle. */
|
|
514
97
|
setApprovalMode: (mode: ToolApprovalMode) => void;
|
|
98
|
+
/**
|
|
99
|
+
* Ask the agent's consent gate about a tool call an MCP App wants to make (the core's
|
|
100
|
+
* `Agent.approveAppToolCall`: the same rules and modes, never silent for a write, "always
|
|
101
|
+
* allow" kept apart from the model's). The request joins `pendingApprovals` with `app` set,
|
|
102
|
+
* and waits across runs - a run ending or `stop()` does not answer it; `signal` does (the
|
|
103
|
+
* app's frame going away). Resolves when the call may go; throws when it may not.
|
|
104
|
+
*/
|
|
105
|
+
approveAppToolCall: (call: AppToolCallRequest, signal?: AbortSignal) => Promise<void>;
|
|
106
|
+
/**
|
|
107
|
+
* Answer a completion an MCP App asks for (its `sampling/createMessage`) with the agent's model:
|
|
108
|
+
* the core's `Agent.sampleForApp` - checked, rate-limited per app, put to `approve` (shown
|
|
109
|
+
* exactly what the model gets), then sent with no tools and none of the conversation. The
|
|
110
|
+
* tokens count in `totalUsage` (a `usage` event of phase `'app'`, never the run's); the answer
|
|
111
|
+
* is returned to the caller and never reaches the transcript, the memory or the model's context.
|
|
112
|
+
* Throws the core's `AppSamplingError` (its `rpcCode` is what the app is told).
|
|
113
|
+
*/
|
|
114
|
+
sampleForApp: (request: AppSamplingRequest, approve: (view: AppSamplingView) => Promise<boolean>, signal?: AbortSignal) => Promise<AppSamplingResult>;
|
|
515
115
|
/** Summarise the stored transcript now (needs `config.memory`). */
|
|
516
116
|
compact: () => Promise<CompactResult | undefined>;
|
|
517
117
|
/** The memory session runs use (config.sessionId until switched). */
|
|
@@ -1003,6 +603,17 @@ interface NoticeTexts {
|
|
|
1003
603
|
*/
|
|
1004
604
|
declare const noticesOf: (state: AgentUiState, texts?: Partial<NoticeTexts>) => ComposerNotice[];
|
|
1005
605
|
|
|
606
|
+
/**
|
|
607
|
+
* What a workspace file is to the UI. `image` is only what the core's media tools accept
|
|
608
|
+
* (PNG / JPEG / GIF / WebP - never SVG, which is shown as its source); `file` is anything that
|
|
609
|
+
* cannot be shown as text: a chip with a download and no preview.
|
|
610
|
+
*/
|
|
611
|
+
type FileKind = 'html' | 'markdown' | 'csv' | 'json' | 'image' | 'code' | 'text' | 'file';
|
|
612
|
+
/** The kind of a file, by its MIME type first and its extension second. */
|
|
613
|
+
declare const fileKindOf: (path: string, mediaType: string) => FileKind;
|
|
614
|
+
/** The last segment of a path: what a chip is called and what a download is saved as. */
|
|
615
|
+
declare const fileNameOf: (path: string) => string;
|
|
616
|
+
|
|
1006
617
|
/**
|
|
1007
618
|
* Every string the pre-styled components render — override any of them for
|
|
1008
619
|
* another language or wording, per component (`labels` prop) or for a whole
|
|
@@ -1174,6 +785,55 @@ interface AgentLabels {
|
|
|
1174
785
|
transcriptOf: (name: string) => string;
|
|
1175
786
|
/** Says whose words a transcript is: the content of the user's file, not the agent's. */
|
|
1176
787
|
transcriptNote: string;
|
|
788
|
+
/** Above the chips: "3 files written in this turn". */
|
|
789
|
+
filesWritten: (n: number) => string;
|
|
790
|
+
/** In the activity summary: "3 files". */
|
|
791
|
+
filesCount: (n: number) => string;
|
|
792
|
+
/** The link that opens the Files panel. */
|
|
793
|
+
showInFiles: string;
|
|
794
|
+
/** What a file is, on its chip. */
|
|
795
|
+
fileKinds: Record<FileKind, string>;
|
|
796
|
+
/** The open button of a chip (accessible name); `name` is the file's name. */
|
|
797
|
+
fileOpen: (name: string) => string;
|
|
798
|
+
/** The same button while the preview is open. */
|
|
799
|
+
fileClose: (name: string) => string;
|
|
800
|
+
/** The download button of a chip (accessible name). */
|
|
801
|
+
fileDownload: (name: string) => string;
|
|
802
|
+
/** On a chip: the subagent that wrote the file. */
|
|
803
|
+
fileBy: (name: string) => string;
|
|
804
|
+
/** On a chip whose file is not in the workspace any more. */
|
|
805
|
+
fileGone: string;
|
|
806
|
+
/** In the preview of a file that cannot be shown as text or as an image. */
|
|
807
|
+
fileNoPreview: string;
|
|
808
|
+
/** Under a preview that shows only the first `chars` characters. */
|
|
809
|
+
fileCut: (chars: number) => string;
|
|
810
|
+
/** Unfold / fold a long text preview. */
|
|
811
|
+
fileShowRest: string;
|
|
812
|
+
fileShowLess: string;
|
|
813
|
+
/** The two views of a text file the host can render (Markdown). */
|
|
814
|
+
fileRendered: string;
|
|
815
|
+
fileSource: string;
|
|
816
|
+
closePreview: string;
|
|
817
|
+
/** Under a source view: "64 lines". */
|
|
818
|
+
fileLines: (n: number) => string;
|
|
819
|
+
/** The host's label on the frame of an HTML file. */
|
|
820
|
+
htmlFrameTitle: string;
|
|
821
|
+
/** The two badges under it, while the page is shown. */
|
|
822
|
+
htmlSandboxed: string;
|
|
823
|
+
htmlNoNetwork: string;
|
|
824
|
+
/** In their place, while the source is shown. */
|
|
825
|
+
htmlSourceNote: string;
|
|
826
|
+
/** In the frame's footer. */
|
|
827
|
+
htmlScripts: (on: boolean) => string;
|
|
828
|
+
/** The files the page links to that the preview does not load. */
|
|
829
|
+
htmlLinkedFiles: (names: string) => string;
|
|
830
|
+
/** A page too large to frame. */
|
|
831
|
+
htmlTooLarge: string;
|
|
832
|
+
/** The button that makes the frame taller / back. */
|
|
833
|
+
htmlTaller: string;
|
|
834
|
+
htmlShorter: string;
|
|
835
|
+
/** The accessible name of the frame itself. */
|
|
836
|
+
htmlFrameName: (path: string) => string;
|
|
1177
837
|
usageMedia: (n: number) => string;
|
|
1178
838
|
usageDecisions: (n: number) => string;
|
|
1179
839
|
/** "decision model: continue (0.93)" - its answer was used; the probability is formatted. */
|
|
@@ -1188,10 +848,164 @@ interface AgentLabels {
|
|
|
1188
848
|
searchFiltered: (n: number) => string;
|
|
1189
849
|
/** The list was cut to the cap. */
|
|
1190
850
|
searchTruncated: string;
|
|
851
|
+
/** The accessible name of the prompt. */
|
|
852
|
+
elicitationTitle: string;
|
|
853
|
+
/** The host's own line: which server asks. */
|
|
854
|
+
elicitationLead: (server: string) => string;
|
|
855
|
+
/** The same when the call that asks is a helper's; `role` is what the model wrote for it. */
|
|
856
|
+
elicitationLeadHelper: (server: string, role: string | undefined) => string;
|
|
857
|
+
/** Before the tool's name: "during". */
|
|
858
|
+
elicitationDuring: string;
|
|
859
|
+
/** "1 of 3" - several questions are waiting. */
|
|
860
|
+
elicitationCount: (index: number, total: number) => string;
|
|
861
|
+
/** The caption over the server's own words. */
|
|
862
|
+
elicitationFrom: (server: string) => string;
|
|
863
|
+
/** The meaning of the mark on a required field. */
|
|
864
|
+
elicitationRequired: string;
|
|
865
|
+
/** The empty choice of a select. */
|
|
866
|
+
elicitationChoose: string;
|
|
867
|
+
elicitationSubmit: string;
|
|
868
|
+
elicitationDecline: string;
|
|
869
|
+
elicitationCancel: string;
|
|
870
|
+
/** Why a field's value does not fit; `field` is its label, `limit` the rule's number. */
|
|
871
|
+
elicitationErrors: Record<ElicitationIssueKind, (field: string, limit?: number) => string>;
|
|
872
|
+
/** Over the buttons, after a submit that was refused. */
|
|
873
|
+
elicitationFix: (n: number) => string;
|
|
874
|
+
/** The host's line of a link request; the host name follows. */
|
|
875
|
+
elicitationUrlLead: (server: string) => string;
|
|
876
|
+
/** The caption over the whole address. */
|
|
877
|
+
elicitationUrlFull: string;
|
|
878
|
+
elicitationOpen: string;
|
|
879
|
+
/** After the link was opened. */
|
|
880
|
+
elicitationOpened: string;
|
|
881
|
+
/** "I have finished there" - the accept of a link request. */
|
|
882
|
+
elicitationUrlDone: string;
|
|
883
|
+
/** A link that will not be opened from here. */
|
|
884
|
+
elicitationUrlRefused: string;
|
|
885
|
+
/** "Expires in 4:05". */
|
|
886
|
+
elicitationExpiresIn: (time: string) => string;
|
|
887
|
+
/** The same note when the time left is not known. */
|
|
888
|
+
elicitationExpires: string;
|
|
889
|
+
/** A question nobody answered: the server, and why (one of `elicitationReasons`). */
|
|
890
|
+
elicitationAutomatic: (server: string, reason: string) => string;
|
|
891
|
+
/** Why a question was answered without anybody deciding, by the core's reason (+ `stopped`). */
|
|
892
|
+
elicitationReasons: Record<ElicitationOutcomeReason, string>;
|
|
893
|
+
elicitationDismiss: string;
|
|
894
|
+
/** The host's label on an app's frame: "App from server “travel”". */
|
|
895
|
+
appFrom: (server: string) => string;
|
|
896
|
+
/** The badge beside it. */
|
|
897
|
+
appSandboxed: string;
|
|
898
|
+
/** The badge when the app runs on an origin of its own (the sandbox page answered). */
|
|
899
|
+
appSandboxedOrigin: string;
|
|
900
|
+
/** The note (menu, badge title) for that: the sandbox origin. */
|
|
901
|
+
appSandboxOrigin: (origin: string) => string;
|
|
902
|
+
/** A sandbox URL is set, and the app runs in the opaque frame all the same: why. */
|
|
903
|
+
appSandboxFallback: (reason: string) => string;
|
|
904
|
+
/** The reasons, by `McpAppSandboxReason`. */
|
|
905
|
+
appSandboxReasons: Record<McpAppSandboxReason, string>;
|
|
906
|
+
/** The app loaded its sandbox page again (navigated it) and was stopped. */
|
|
907
|
+
appSandboxBroken: string;
|
|
908
|
+
/** The badge while a request of the app waits for the user. */
|
|
909
|
+
appWaiting: string;
|
|
910
|
+
/** The tag on the tool call an app came with, and the activity summary's count. */
|
|
911
|
+
appTag: string;
|
|
912
|
+
appsCount: (n: number) => string;
|
|
913
|
+
appLoading: string;
|
|
914
|
+
/** The app could not be read or is refused (`reason` is the core's message). */
|
|
915
|
+
appFailed: (reason: string) => string;
|
|
916
|
+
/** No connection to its server (not connected any more, or apps are off). */
|
|
917
|
+
appUnavailable: (server: string) => string;
|
|
918
|
+
/** The folded line: "App from server “travel” · hidden [Show]". */
|
|
919
|
+
appHidden: string;
|
|
920
|
+
appShow: string;
|
|
921
|
+
/** The app's menu and what is in it. */
|
|
922
|
+
appMenu: string;
|
|
923
|
+
appReload: string;
|
|
924
|
+
appOpenPanel: string;
|
|
925
|
+
appHide: string;
|
|
926
|
+
/** The note at the bottom of the menu. */
|
|
927
|
+
appServedBy: (server: string, uri: string) => string;
|
|
928
|
+
/** The line left in the transcript while the app is in the panel, and its button. */
|
|
929
|
+
appInPanel: string;
|
|
930
|
+
appBringBack: string;
|
|
931
|
+
appClosePanel: string;
|
|
932
|
+
/** The panel's footer. */
|
|
933
|
+
appPanelNote: (server: string) => string;
|
|
934
|
+
/** The accessible name of the app's frame. */
|
|
935
|
+
appFrameName: (server: string) => string;
|
|
936
|
+
/** Under the frame: the tools the app called, and the ones that were refused. */
|
|
937
|
+
appRan: (names: string) => string;
|
|
938
|
+
appRefused: string;
|
|
939
|
+
/** A tool call the app asks for (`<ToolApprovalPrompt>`): the lead and the note. */
|
|
940
|
+
approvalLeadApp: (server: string) => string;
|
|
941
|
+
approvalFromApp: (server: string, readOnly: boolean) => string;
|
|
942
|
+
/** A link the app asks to open (`<AppRequestPrompt>`). */
|
|
943
|
+
appLinkLead: (server: string) => string;
|
|
944
|
+
appLinkNote: string;
|
|
945
|
+
appLinkOpen: string;
|
|
946
|
+
appCancel: string;
|
|
947
|
+
/** A message the app asks to put in the chat. */
|
|
948
|
+
appMessageLead: (server: string) => string;
|
|
949
|
+
appMessageNote: string;
|
|
950
|
+
appMessageAccept: string;
|
|
951
|
+
appMessageDiscard: string;
|
|
952
|
+
/** The app shown full screen (`<McpAppFrame allowFullscreen>`): the badge, the way back. */
|
|
953
|
+
appFullscreenBadge: string;
|
|
954
|
+
appFullscreenExit: string;
|
|
955
|
+
/** The key that exits too, shown on the button. */
|
|
956
|
+
appFullscreenKey: string;
|
|
957
|
+
/** A file the app asks to save (`<AppRequestPrompt>`). */
|
|
958
|
+
appDownloadLead: (server: string) => string;
|
|
959
|
+
/** Name · type · size. */
|
|
960
|
+
appDownloadType: (mimeType: string | undefined) => string;
|
|
961
|
+
appDownloadSize: (bytes: number) => string;
|
|
962
|
+
/** Where the bytes came from: the request itself, or read from the app's server. */
|
|
963
|
+
appDownloadSource: (source: 'embedded' | 'link', server: string) => string;
|
|
964
|
+
appDownloadNote: string;
|
|
965
|
+
appDownloadSave: string;
|
|
966
|
+
/** The app asks the agent's model for an answer (`sampling/createMessage`). */
|
|
967
|
+
appSamplingLead: (server: string) => string;
|
|
968
|
+
appSamplingSystem: string;
|
|
969
|
+
appSamplingRole: (role: 'user' | 'assistant') => string;
|
|
970
|
+
appSamplingImages: (count: number) => string;
|
|
971
|
+
appSamplingTokens: (tokens: number, asked: number) => string;
|
|
972
|
+
appSamplingNote: string;
|
|
973
|
+
appSamplingAllow: string;
|
|
974
|
+
appSamplingAlways: string;
|
|
975
|
+
appSamplingDeny: string;
|
|
976
|
+
/**
|
|
977
|
+
* An MCP server's skill about to enter the model's context (`<ToolApprovalPrompt>`, a request
|
|
978
|
+
* with `approval.skill`): the lead, its size and files, how it was found, the body preview.
|
|
979
|
+
*/
|
|
980
|
+
skillConsentLead: (server: string, skill: string) => string;
|
|
981
|
+
/** The size of its SKILL.md, and how many more files it bundles. */
|
|
982
|
+
skillConsentSize: (bytes: number, files: number) => string;
|
|
983
|
+
/** It was named by its address (`skills/get`), not in the server's list. */
|
|
984
|
+
skillConsentByUri: string;
|
|
985
|
+
/** It sits inside another skill of the same server. */
|
|
986
|
+
skillConsentNested: (enclosing: string) => string;
|
|
987
|
+
/**
|
|
988
|
+
* A generated skill (`skill.dynamic`): the server publishes no checksums - the person approves
|
|
989
|
+
* the copy the agent just read, and only that copy is used.
|
|
990
|
+
*/
|
|
991
|
+
skillConsentDynamic: string;
|
|
992
|
+
/** (with `skillConsentDynamic`) The server cannot list the skill's files: SKILL.md alone. */
|
|
993
|
+
skillConsentNoFileListing: string;
|
|
994
|
+
/** The summary of the collapsible preview of its instructions. */
|
|
995
|
+
skillConsentPreview: string;
|
|
996
|
+
/** Under the preview: its other files, and how many more there are than are shown. */
|
|
997
|
+
skillConsentFiles: (paths: string, more: number) => string;
|
|
998
|
+
/** What a yes means: `'once-per-skill'` - this text for the session; `'ask'` - this task. */
|
|
999
|
+
skillConsentNote: (server: string, consent: 'ask' | 'once-per-skill') => string;
|
|
1000
|
+
skillConsentAllow: string;
|
|
1001
|
+
skillConsentAlways: string;
|
|
1002
|
+
skillConsentDeny: string;
|
|
1003
|
+
/** The reason a "Deny" gives the agent. */
|
|
1004
|
+
skillConsentDeclined: string;
|
|
1191
1005
|
}
|
|
1192
1006
|
declare const defaultLabels: AgentLabels;
|
|
1193
1007
|
/** Overrides: any label, with the nested groups merged key by key. */
|
|
1194
|
-
type AgentLabelsOverride = Partial<Omit<AgentLabels, 'status' | 'modes' | 'commandGroups' | 'commandDescriptions' | 'thinkingLevels' | 'notices' | 'tierNames' | 'tierReasons' | 'escalationReasons' | 'subagentStatus' | 'decisionReasons'>> & {
|
|
1008
|
+
type AgentLabelsOverride = Partial<Omit<AgentLabels, 'status' | 'modes' | 'commandGroups' | 'commandDescriptions' | 'thinkingLevels' | 'notices' | 'tierNames' | 'tierReasons' | 'escalationReasons' | 'subagentStatus' | 'decisionReasons' | 'elicitationErrors' | 'elicitationReasons' | 'fileKinds' | 'appSandboxReasons'>> & {
|
|
1195
1009
|
status?: Partial<AgentLabels['status']>;
|
|
1196
1010
|
modes?: Partial<AgentLabels['modes']>;
|
|
1197
1011
|
commandGroups?: Partial<AgentLabels['commandGroups']>;
|
|
@@ -1203,6 +1017,10 @@ type AgentLabelsOverride = Partial<Omit<AgentLabels, 'status' | 'modes' | 'comma
|
|
|
1203
1017
|
escalationReasons?: Partial<AgentLabels['escalationReasons']>;
|
|
1204
1018
|
subagentStatus?: Partial<AgentLabels['subagentStatus']>;
|
|
1205
1019
|
decisionReasons?: Partial<AgentLabels['decisionReasons']>;
|
|
1020
|
+
elicitationErrors?: Partial<AgentLabels['elicitationErrors']>;
|
|
1021
|
+
elicitationReasons?: Partial<AgentLabels['elicitationReasons']>;
|
|
1022
|
+
fileKinds?: Partial<AgentLabels['fileKinds']>;
|
|
1023
|
+
appSandboxReasons?: Partial<AgentLabels['appSandboxReasons']>;
|
|
1206
1024
|
};
|
|
1207
1025
|
/** `base` with `over` applied (nested groups merged, not replaced). */
|
|
1208
1026
|
declare const mergeLabels: (base: AgentLabels, over?: AgentLabelsOverride) => AgentLabels;
|
|
@@ -1366,7 +1184,7 @@ interface AgentComposerProps {
|
|
|
1366
1184
|
skillCommands?: boolean;
|
|
1367
1185
|
/**
|
|
1368
1186
|
* "+" button, paste (Ctrl+V) and drag & drop of files and images (default
|
|
1369
|
-
* true). Text files are inlined into the message; images, PDFs and other
|
|
1187
|
+
* true). Paste works in the message field and anywhere in the drop zone. Text files are inlined into the message; images, PDFs and other
|
|
1370
1188
|
* files go to the model as attachments — when the model can take them.
|
|
1371
1189
|
*/
|
|
1372
1190
|
attachments?: boolean | {
|
|
@@ -1426,6 +1244,15 @@ interface AgentComposerProps {
|
|
|
1426
1244
|
toolbarEnd?: ReactNode;
|
|
1427
1245
|
/** Render an attachment chip yourself (`remove` drops it). */
|
|
1428
1246
|
renderAttachment?: (attachment: ComposerAttachment, remove: () => void) => ReactNode;
|
|
1247
|
+
/**
|
|
1248
|
+
* Text to put in the message field as a draft - e.g. a message an MCP App asked to send that
|
|
1249
|
+
* the user accepted. Each new `id` appends its `text` (on a new line after what is there) and
|
|
1250
|
+
* focuses the field; it is never sent: the user sends it, or not.
|
|
1251
|
+
*/
|
|
1252
|
+
draft?: {
|
|
1253
|
+
id: string;
|
|
1254
|
+
text: string;
|
|
1255
|
+
};
|
|
1429
1256
|
disabled?: boolean;
|
|
1430
1257
|
className?: string;
|
|
1431
1258
|
}
|
|
@@ -1445,7 +1272,7 @@ interface AgentComposerProps {
|
|
|
1445
1272
|
*
|
|
1446
1273
|
* Every piece can be switched off; `<AgentChat>` uses it as its footer.
|
|
1447
1274
|
*/
|
|
1448
|
-
declare const AgentComposer: ({ controller: agent, placeholder, model, thinking, labels: labelsOverride, commands, builtinCommands, skillCommands, attachments, convertFile, convert, files: vfs, dropZone, speech, showTimer, showAgents, showApprovalMode, showNotices, steering, showQueued, compactWidth, toolbarExtra, toolbarEnd, renderAttachment, disabled, className, }: AgentComposerProps) => react.JSX.Element;
|
|
1275
|
+
declare const AgentComposer: ({ controller: agent, placeholder, model, thinking, labels: labelsOverride, commands, builtinCommands, skillCommands, attachments, convertFile, convert, files: vfs, dropZone, speech, showTimer, showAgents, showApprovalMode, showNotices, steering, showQueued, compactWidth, toolbarExtra, toolbarEnd, renderAttachment, draft, disabled, className, }: AgentComposerProps) => react.JSX.Element;
|
|
1449
1276
|
|
|
1450
1277
|
interface ChatHistoryListProps {
|
|
1451
1278
|
/** From `useChatHistory(agent)`. */
|
|
@@ -1463,6 +1290,51 @@ interface ChatHistoryListProps {
|
|
|
1463
1290
|
/** The saved conversations: a "New chat" button, then one row per chat (newest first). */
|
|
1464
1291
|
declare const ChatHistoryList: ({ history, title, disabled, renderChat, formatTime, labels, className, }: ChatHistoryListProps) => react.JSX.Element;
|
|
1465
1292
|
|
|
1293
|
+
interface ElicitationPromptProps {
|
|
1294
|
+
/**
|
|
1295
|
+
* The questions waiting for the user (`useMcp().pendingElicitations` /
|
|
1296
|
+
* `useMcpServers().pendingElicitations`, or the requests your own `onElicitation` was given).
|
|
1297
|
+
* One is shown at a time, with a count.
|
|
1298
|
+
*/
|
|
1299
|
+
elicitations: PendingElicitation[];
|
|
1300
|
+
/**
|
|
1301
|
+
* The user's decision: `accept` (with the form's values, or a link the user opened and
|
|
1302
|
+
* finished), `decline` or `cancel`. Wire it to the hook's `answerElicitation`. The values go
|
|
1303
|
+
* to this callback and nowhere else.
|
|
1304
|
+
*/
|
|
1305
|
+
onAnswer: (id: string, result: McpElicitationResult) => void;
|
|
1306
|
+
/**
|
|
1307
|
+
* The run's questions as the reducer keeps them (`useAgent().elicitations`): the ones that
|
|
1308
|
+
* were answered without anybody deciding - a timeout, a stopped run, a cap - are said so.
|
|
1309
|
+
*/
|
|
1310
|
+
outcomes?: ElicitationView[];
|
|
1311
|
+
/** Say which questions were answered automatically (default true; needs `outcomes`). */
|
|
1312
|
+
showOutcomes?: boolean;
|
|
1313
|
+
/** The note that a question expires, with the time left when it is known (default true). */
|
|
1314
|
+
showExpiry?: boolean;
|
|
1315
|
+
/** Say that a helper's call is the one that asks (default true). */
|
|
1316
|
+
showHelper?: boolean;
|
|
1317
|
+
/**
|
|
1318
|
+
* Render a question yourself: `fallback` is the built-in card, `answer` decides it. The
|
|
1319
|
+
* request's strings are the SERVER's text - render them as text.
|
|
1320
|
+
*/
|
|
1321
|
+
renderElicitation?: (elicitation: PendingElicitation, fallback: ReactNode, answer: (result: McpElicitationResult) => void) => ReactNode;
|
|
1322
|
+
labels?: AgentLabelsOverride;
|
|
1323
|
+
className?: string;
|
|
1324
|
+
}
|
|
1325
|
+
/**
|
|
1326
|
+
* A question an MCP server puts to the user in the middle of a tool call (MCP elicitation): a
|
|
1327
|
+
* form to fill in, or a link to open. The header is the host's own - which server asks, during
|
|
1328
|
+
* which tool - and everything the server wrote is shown under a caption that says so, as plain
|
|
1329
|
+
* text. Three outcomes: accept (Submit / "I have finished there"), decline, cancel.
|
|
1330
|
+
*
|
|
1331
|
+
* Wire it to `useMcp` / `useMcpServers` (`pendingElicitations`, `answerElicitation`);
|
|
1332
|
+
* `<AgentChat elicitations onElicitationAnswer>` renders it for you. What the user types is
|
|
1333
|
+
* kept in this component only and handed to `onAnswer` once: it is not in the agent's state,
|
|
1334
|
+
* its events or the transcript.
|
|
1335
|
+
*/
|
|
1336
|
+
declare const ElicitationPrompt: ({ elicitations, onAnswer, outcomes, showOutcomes, showExpiry, showHelper, renderElicitation, labels, className, }: ElicitationPromptProps) => react.JSX.Element | null;
|
|
1337
|
+
|
|
1466
1338
|
interface FilesPanelProps {
|
|
1467
1339
|
/** The workspace (the core's `VirtualFileSystem`). */
|
|
1468
1340
|
files: VirtualFileSystem;
|
|
@@ -1489,6 +1361,87 @@ interface FilesPanelProps {
|
|
|
1489
1361
|
*/
|
|
1490
1362
|
declare const FilesPanel: ({ files: vfs, prefix, title, allowUpload, allowDelete, uploadDir, onOpen, renderFile, labels, className, }: FilesPanelProps) => react.JSX.Element;
|
|
1491
1363
|
|
|
1364
|
+
/** How an `.html` file is previewed. */
|
|
1365
|
+
interface HtmlPreviewOptions {
|
|
1366
|
+
/**
|
|
1367
|
+
* Let the page's inline scripts run inside the sandbox (default false: a static render). Even
|
|
1368
|
+
* with scripts the page has an opaque origin and no network.
|
|
1369
|
+
*/
|
|
1370
|
+
scripts?: boolean;
|
|
1371
|
+
/** Height of the frame in px (default 300; clamped to 120 - 800). */
|
|
1372
|
+
height?: number;
|
|
1373
|
+
}
|
|
1374
|
+
/** Characters of a text file a preview shows (the rest is cut, and the preview says so). */
|
|
1375
|
+
declare const FILE_PREVIEW_CHARS = 20000;
|
|
1376
|
+
interface SourceViewProps {
|
|
1377
|
+
text: string;
|
|
1378
|
+
/** Colour it as HTML (default: plain). */
|
|
1379
|
+
html?: boolean;
|
|
1380
|
+
/** Characters shown (default 20 000). */
|
|
1381
|
+
maxChars?: number;
|
|
1382
|
+
labels?: AgentLabelsOverride;
|
|
1383
|
+
className?: string;
|
|
1384
|
+
}
|
|
1385
|
+
/**
|
|
1386
|
+
* A file's text with line numbers. Always text nodes - the content of a file is never set as
|
|
1387
|
+
* markup, whatever it contains.
|
|
1388
|
+
*/
|
|
1389
|
+
declare const SourceView: ({ text, html, maxChars, labels, className, }: SourceViewProps) => react.JSX.Element;
|
|
1390
|
+
interface FileChipsProps {
|
|
1391
|
+
/** The files of a turn (`ChatMessage.writtenFiles`). */
|
|
1392
|
+
written: WrittenFileView[];
|
|
1393
|
+
/**
|
|
1394
|
+
* The workspace they are in (the core's `VirtualFileSystem`). Without it the chips still
|
|
1395
|
+
* name the files, with nothing to open or download.
|
|
1396
|
+
*/
|
|
1397
|
+
files?: VirtualFileSystem;
|
|
1398
|
+
/** The line above the chips - "3 files written in this turn" (default true). */
|
|
1399
|
+
showHeader?: boolean;
|
|
1400
|
+
/** Shows a "Show in Files" link in that line. */
|
|
1401
|
+
onShowFiles?: () => void;
|
|
1402
|
+
/**
|
|
1403
|
+
* How an `.html` file is previewed: in a sandboxed frame without network, scripts off
|
|
1404
|
+
* (default `{}`); `{ scripts: true }` lets its inline scripts run; `false` never renders
|
|
1405
|
+
* HTML - the file is shown as source only.
|
|
1406
|
+
*/
|
|
1407
|
+
htmlPreview?: HtmlPreviewOptions | false;
|
|
1408
|
+
/** A whole chip; `fallback` is the built-in one. */
|
|
1409
|
+
renderFile?: (file: WrittenFileView, fallback: ReactNode) => ReactNode;
|
|
1410
|
+
/**
|
|
1411
|
+
* A text file rendered your way - e.g. Markdown through your renderer. Return `undefined`
|
|
1412
|
+
* for a file you do not render: it is then shown as source. `text` is already capped.
|
|
1413
|
+
*/
|
|
1414
|
+
renderFileContent?: (file: WrittenFileView, text: string) => ReactNode;
|
|
1415
|
+
/** Characters of a text file a preview shows (default 20 000). */
|
|
1416
|
+
previewChars?: number;
|
|
1417
|
+
/** A file whose preview is open at first (its path). */
|
|
1418
|
+
defaultOpen?: string;
|
|
1419
|
+
labels?: AgentLabelsOverride;
|
|
1420
|
+
className?: string;
|
|
1421
|
+
}
|
|
1422
|
+
/**
|
|
1423
|
+
* The files an answer left in the workspace, as chips under it: name, kind, size, open and
|
|
1424
|
+
* download. Opening one shows it right there - text as text (rendered too, when the host gives
|
|
1425
|
+
* a renderer), a picture as a picture, and an `.html` page in a sandboxed frame with a
|
|
1426
|
+
* Preview / Source switch (see `SandboxedFrame`).
|
|
1427
|
+
*/
|
|
1428
|
+
declare const FileChips: ({ written, files: vfs, showHeader, onShowFiles, htmlPreview, renderFile, renderFileContent, previewChars, defaultOpen, labels, className, }: FileChipsProps) => react.JSX.Element | null;
|
|
1429
|
+
interface FileChipProps {
|
|
1430
|
+
written: WrittenFileView;
|
|
1431
|
+
/** The type and size now (default: what the turn recorded). */
|
|
1432
|
+
mediaType?: string;
|
|
1433
|
+
bytes?: number;
|
|
1434
|
+
/** The workspace: gives the chip its download, its thumbnail and its open button. */
|
|
1435
|
+
files?: VirtualFileSystem;
|
|
1436
|
+
/** The file is not in the workspace any more. */
|
|
1437
|
+
gone?: boolean;
|
|
1438
|
+
open?: boolean;
|
|
1439
|
+
onToggle?: () => void;
|
|
1440
|
+
labels?: AgentLabelsOverride;
|
|
1441
|
+
}
|
|
1442
|
+
/** One file: icon (a thumbnail for a picture), name, kind · size, open, download. */
|
|
1443
|
+
declare const FileChip: ({ written, mediaType, bytes, files: vfs, gone, open, onToggle, labels, }: FileChipProps) => react.JSX.Element;
|
|
1444
|
+
|
|
1492
1445
|
/** Render a node yourself; `fallback` is the built-in `<li>` (with its children) — return it, or your own `<li>`. */
|
|
1493
1446
|
type RenderSubagent = (node: SubagentNode, fallback: ReactNode) => ReactNode;
|
|
1494
1447
|
interface SubagentRowProps {
|
|
@@ -1640,8 +1593,21 @@ interface MessageListProps {
|
|
|
1640
1593
|
* transcripts of audio files, folded (default true). Needs `files` to show the bytes.
|
|
1641
1594
|
*/
|
|
1642
1595
|
showMedia?: boolean;
|
|
1643
|
-
/**
|
|
1596
|
+
/**
|
|
1597
|
+
* The files an answer wrote to the workspace, as chips under it - open (an inline preview;
|
|
1598
|
+
* an `.html` file in a sandboxed frame) and download (default true). Needs `files`.
|
|
1599
|
+
*/
|
|
1600
|
+
showFileChips?: boolean;
|
|
1601
|
+
/** The workspace generated and written files are read from (the core's `VirtualFileSystem`). */
|
|
1644
1602
|
files?: VirtualFileSystem;
|
|
1603
|
+
/** How an `.html` file is previewed (see `FileChips`); `false` shows HTML as source only. */
|
|
1604
|
+
htmlPreview?: FileChipsProps['htmlPreview'];
|
|
1605
|
+
/** Adds a "Show in Files" link above the chips. */
|
|
1606
|
+
onShowFiles?: () => void;
|
|
1607
|
+
/** A file chip; `fallback` is the built-in one. */
|
|
1608
|
+
renderFile?: (file: WrittenFileView, message: ChatMessage, fallback: ReactNode) => ReactNode;
|
|
1609
|
+
/** A text file rendered your way (Markdown through your renderer); `undefined` = as source. */
|
|
1610
|
+
renderFileContent?: FileChipsProps['renderFileContent'];
|
|
1645
1611
|
/** A generated file; `fallback` is the built-in image / player / chip. */
|
|
1646
1612
|
renderMedia?: (media: MediaView, message: ChatMessage, fallback: ReactNode) => ReactNode;
|
|
1647
1613
|
/** A node of the subagent tree (gets the built-in `<li>` as `fallback`). */
|
|
@@ -1663,6 +1629,13 @@ interface MessageListProps {
|
|
|
1663
1629
|
renderAttachment?: (attachment: ChatAttachment, message: ChatMessage) => ReactNode;
|
|
1664
1630
|
/** Tool calls inside the activity. */
|
|
1665
1631
|
renderToolCall?: RenderToolCall;
|
|
1632
|
+
/**
|
|
1633
|
+
* The MCP Apps an answer's tool calls came with (`message.apps`), drawn between its activity
|
|
1634
|
+
* and its text. `<AgentChat mcpApps>` passes `<McpAppFrame>`; without this prop none is drawn.
|
|
1635
|
+
*/
|
|
1636
|
+
renderApp?: (app: AppView, message: ChatMessage) => ReactNode;
|
|
1637
|
+
/** Draw the apps of an answer (default true; needs `renderApp`). */
|
|
1638
|
+
showApps?: boolean;
|
|
1666
1639
|
labels?: AgentLabelsOverride;
|
|
1667
1640
|
className?: string;
|
|
1668
1641
|
}
|
|
@@ -1679,7 +1652,7 @@ declare const AttachmentView: ({ attachment: a }: {
|
|
|
1679
1652
|
* subagents, consent decisions — and the tokens it spent by kind. Every part
|
|
1680
1653
|
* can be hidden, relabelled or rendered by the host.
|
|
1681
1654
|
*/
|
|
1682
|
-
declare const MessageList: ({ messages, empty, showActivity, showToolCalls, showUsage, showThoughts, showNotes, showLearned, showTiers, showReplanFailed, showDecisions, showSearchResults, showSubagents, showMedia, files, renderMedia, renderSubagent, onStopSubagent, activityOpen, liveExtra, renderContent, renderMessage, renderAttachment, renderToolCall, labels, className, }: MessageListProps) => react.JSX.Element | null;
|
|
1655
|
+
declare const MessageList: ({ messages, empty, showActivity, showToolCalls, showUsage, showThoughts, showNotes, showLearned, showTiers, showReplanFailed, showDecisions, showSearchResults, showSubagents, showMedia, showFileChips, files, htmlPreview, onShowFiles, renderFile, renderFileContent, renderMedia, renderSubagent, onStopSubagent, activityOpen, liveExtra, renderContent, renderMessage, renderAttachment, renderToolCall, renderApp, showApps, labels, className, }: MessageListProps) => react.JSX.Element | null;
|
|
1683
1656
|
|
|
1684
1657
|
interface ToolApprovalPromptProps {
|
|
1685
1658
|
/** Pending requests (e.g. `agent.pendingApprovals`). */
|
|
@@ -1688,8 +1661,17 @@ interface ToolApprovalPromptProps {
|
|
|
1688
1661
|
remember?: boolean;
|
|
1689
1662
|
}) => void;
|
|
1690
1663
|
onDeny: (id: string, reason?: string) => void;
|
|
1691
|
-
/**
|
|
1664
|
+
/**
|
|
1665
|
+
* Offer "Always allow" (remembers the tool for the agent's life) - and, on a request about an
|
|
1666
|
+
* MCP server's skill, "Always for this server" (that server's skills for the agent's life,
|
|
1667
|
+
* nested ones excepted). Default true.
|
|
1668
|
+
*/
|
|
1692
1669
|
allowRemember?: boolean;
|
|
1670
|
+
/**
|
|
1671
|
+
* On a request about an MCP server's skill: the collapsible preview of the instructions the
|
|
1672
|
+
* model would read (plain text). Default true.
|
|
1673
|
+
*/
|
|
1674
|
+
showSkillPreview?: boolean;
|
|
1693
1675
|
/** Say which helper is asking when the call is a helper's, not the run's own (default true). */
|
|
1694
1676
|
showHelper?: boolean;
|
|
1695
1677
|
/** Render a request yourself (gets the built-in card as `fallback`). */
|
|
@@ -1699,10 +1681,11 @@ interface ToolApprovalPromptProps {
|
|
|
1699
1681
|
}
|
|
1700
1682
|
/**
|
|
1701
1683
|
* Consent cards for tool calls the agent wants to make — "Allow once",
|
|
1702
|
-
* "Always allow" and "Deny"
|
|
1703
|
-
*
|
|
1684
|
+
* "Always allow" and "Deny" - and for an MCP server's skill about to enter the agent's context
|
|
1685
|
+
* ("Allow once", "Always for this server", "Deny"). Wire it to {@link useAgent}'s
|
|
1686
|
+
* `pendingApprovals`, `approve` and `deny`; `<AgentChat>` renders it for you.
|
|
1704
1687
|
*/
|
|
1705
|
-
declare const ToolApprovalPrompt: ({ approvals, onApprove, onDeny, allowRemember, showHelper, renderApproval, labels, className, }: ToolApprovalPromptProps) => react.JSX.Element | null;
|
|
1688
|
+
declare const ToolApprovalPrompt: ({ approvals, onApprove, onDeny, allowRemember, showSkillPreview, showHelper, renderApproval, labels, className, }: ToolApprovalPromptProps) => react.JSX.Element | null;
|
|
1706
1689
|
|
|
1707
1690
|
/** Places to put your own content in the panel. */
|
|
1708
1691
|
interface AgentChatSlots {
|
|
@@ -1727,6 +1710,7 @@ interface AgentChatComponents {
|
|
|
1727
1710
|
HistoryList?: ComponentType<ChatHistoryListProps>;
|
|
1728
1711
|
FilesPanel?: ComponentType<FilesPanelProps>;
|
|
1729
1712
|
ApprovalPrompt?: ComponentType<ToolApprovalPromptProps>;
|
|
1713
|
+
ElicitationPrompt?: ComponentType<ElicitationPromptProps>;
|
|
1730
1714
|
}
|
|
1731
1715
|
/** Extra class names per part (added to the built-in `awr-` ones). */
|
|
1732
1716
|
interface AgentChatClassNames {
|
|
@@ -1785,6 +1769,16 @@ interface AgentChatProps {
|
|
|
1785
1769
|
* the transcripts of audio files, folded (default true). The bytes are read from `files`.
|
|
1786
1770
|
*/
|
|
1787
1771
|
showMedia?: boolean;
|
|
1772
|
+
/**
|
|
1773
|
+
* The files an answer wrote to the workspace (`files`), as chips under it: name, kind, size,
|
|
1774
|
+
* open (an inline preview - an `.html` file in a sandboxed frame) and download (default true).
|
|
1775
|
+
*/
|
|
1776
|
+
showFileChips?: boolean;
|
|
1777
|
+
/**
|
|
1778
|
+
* How an `.html` file is previewed: sandboxed, no network, scripts off by default;
|
|
1779
|
+
* `{ scripts: true }` lets its inline scripts run; `false` shows HTML as source only.
|
|
1780
|
+
*/
|
|
1781
|
+
htmlPreview?: MessageListProps['htmlPreview'];
|
|
1788
1782
|
/** A stop button on each running subagent (default true). */
|
|
1789
1783
|
stoppableSubagents?: boolean;
|
|
1790
1784
|
/** Conversation total in the header (default true). */
|
|
@@ -1800,6 +1794,16 @@ interface AgentChatProps {
|
|
|
1800
1794
|
showContext?: boolean | number;
|
|
1801
1795
|
/** Keep finished answers' activity expanded (default false). */
|
|
1802
1796
|
activityOpen?: boolean;
|
|
1797
|
+
/**
|
|
1798
|
+
* Questions MCP servers put to the user (MCP elicitation), beside the consent prompts
|
|
1799
|
+
* (default true). Shown once `elicitations` and `onElicitationAnswer` are given.
|
|
1800
|
+
*/
|
|
1801
|
+
showElicitation?: boolean;
|
|
1802
|
+
/**
|
|
1803
|
+
* In the consent card of an MCP server's skill: the collapsible preview of the instructions
|
|
1804
|
+
* the agent would read (default true; `<ToolApprovalPrompt showSkillPreview>`).
|
|
1805
|
+
*/
|
|
1806
|
+
showSkillPreview?: boolean;
|
|
1803
1807
|
/**
|
|
1804
1808
|
* Saved conversations in IndexedDB with a sidebar to switch between them:
|
|
1805
1809
|
* `true` (default store), your own `ChatHistoryStore`, or the result of your
|
|
@@ -1822,6 +1826,13 @@ interface AgentChatProps {
|
|
|
1822
1826
|
narrowWidth?: number;
|
|
1823
1827
|
/** Composer options (model / thinking chips, commands, convertFile, speech…), or `false` to hide it. */
|
|
1824
1828
|
composer?: Partial<Omit<AgentComposerProps, 'controller'>> | false;
|
|
1829
|
+
/**
|
|
1830
|
+
* The questions MCP servers are waiting on: `pendingElicitations` of `useMcp` /
|
|
1831
|
+
* `useMcpServers` (from `@dudko.dev/agent-web-react/mcp`, with their `elicitation` option on).
|
|
1832
|
+
*/
|
|
1833
|
+
elicitations?: ElicitationPromptProps['elicitations'];
|
|
1834
|
+
/** The user's answer to one of them: the hook's `answerElicitation`. */
|
|
1835
|
+
onElicitationAnswer?: ElicitationPromptProps['onAnswer'];
|
|
1825
1836
|
/** A message's text — plug in your markdown renderer here. */
|
|
1826
1837
|
renderContent?: MessageListProps['renderContent'];
|
|
1827
1838
|
renderMessage?: MessageListProps['renderMessage'];
|
|
@@ -1831,7 +1842,13 @@ interface AgentChatProps {
|
|
|
1831
1842
|
renderSubagent?: RenderSubagent;
|
|
1832
1843
|
/** A generated image / audio file. */
|
|
1833
1844
|
renderMedia?: MessageListProps['renderMedia'];
|
|
1845
|
+
/** A file chip of an answer. */
|
|
1846
|
+
renderFile?: MessageListProps['renderFile'];
|
|
1847
|
+
/** A written text file rendered your way (Markdown); `undefined` = shown as source. */
|
|
1848
|
+
renderFileContent?: MessageListProps['renderFileContent'];
|
|
1834
1849
|
renderApproval?: ToolApprovalPromptProps['renderApproval'];
|
|
1850
|
+
/** A server's question (gets the built-in card as `fallback`, and `answer`). */
|
|
1851
|
+
renderElicitation?: ElicitationPromptProps['renderElicitation'];
|
|
1835
1852
|
slots?: AgentChatSlots;
|
|
1836
1853
|
components?: AgentChatComponents;
|
|
1837
1854
|
/** Override any text (i18n); applies to every part inside. */
|
|
@@ -1842,6 +1859,58 @@ interface AgentChatProps {
|
|
|
1842
1859
|
className?: string;
|
|
1843
1860
|
/** Inline styles on the root — handy for sizing (e.g. `{ height: 520 }`). */
|
|
1844
1861
|
style?: CSSProperties;
|
|
1862
|
+
/**
|
|
1863
|
+
* MCP Apps: the connection that reads an app and makes the calls it asks for -
|
|
1864
|
+
* `useMcpServers({ apps: true }).apps` (or `useMcp`'s, or the core's `ConnectedMcp.apps`).
|
|
1865
|
+
* With it, an answer whose tool call came with an app shows the app in a sandboxed frame under
|
|
1866
|
+
* the answer, and everything the app asks for - a tool call, a link, a message - is put to the
|
|
1867
|
+
* user here, labelled as the app's. Without it no app is drawn.
|
|
1868
|
+
*/
|
|
1869
|
+
mcpApps?: McpAppsConnectionLike;
|
|
1870
|
+
/** Draw MCP Apps (default true; needs `mcpApps`). */
|
|
1871
|
+
showApps?: boolean;
|
|
1872
|
+
/**
|
|
1873
|
+
* Run apps on an origin of their own: `{ url }` of a sandbox page you serve on ANOTHER origin
|
|
1874
|
+
* (`@dudko.dev/agent-web-react/mcp-app-sandbox`), e.g.
|
|
1875
|
+
* `{ url: 'https://apps.example.com/sandbox/v1' }` - or `'https://{server}.apps.example.com/…'`
|
|
1876
|
+
* for one origin per server. Default: none - apps run in an opaque frame (no storage of their
|
|
1877
|
+
* own). A URL on this page's origin, or not https, is refused (opaque); so is a page that does
|
|
1878
|
+
* not answer in `timeoutMs`.
|
|
1879
|
+
*/
|
|
1880
|
+
appSandbox?: McpAppSandboxOptions;
|
|
1881
|
+
/**
|
|
1882
|
+
* Let an app be shown full screen (`ui/request-display-mode`): over the chat panel, or the
|
|
1883
|
+
* viewport on a phone, in the host's chrome with Exit full screen and Esc. Granted only to
|
|
1884
|
+
* an app that declared it, right after a click or a key inside its frame. Default false.
|
|
1885
|
+
*/
|
|
1886
|
+
appFullscreen?: boolean;
|
|
1887
|
+
/**
|
|
1888
|
+
* Let an app hand the user a file to save (`ui/download-file`): a prompt with its name, type
|
|
1889
|
+
* and size, saved by this page on "Save file". Programs, scripts and web pages are refused; a
|
|
1890
|
+
* linked file is read from the app's own server only. Default false.
|
|
1891
|
+
*/
|
|
1892
|
+
appDownloads?: boolean;
|
|
1893
|
+
/**
|
|
1894
|
+
* Let an app ask the agent's model for an answer (`sampling/createMessage`, no tools): a
|
|
1895
|
+
* prompt with exactly what the model would get; "Allow once", "Always for this app" (until a
|
|
1896
|
+
* reload) or "Deny". The answer goes to the app only; its tokens count in the total. Default
|
|
1897
|
+
* false. Needs a controller with `sampleForApp` (`useAgent`).
|
|
1898
|
+
*/
|
|
1899
|
+
appSampling?: boolean;
|
|
1900
|
+
/** Start every app folded to one line (default false). */
|
|
1901
|
+
appsCollapsed?: boolean;
|
|
1902
|
+
/**
|
|
1903
|
+
* Where an app opened "in panel" goes: `'auto'` (default) - beside the chat when it is wide,
|
|
1904
|
+
* a bottom sheet when it is narrow (`narrowWidth`); `'sheet'` - always the sheet; an element -
|
|
1905
|
+
* rendered into it (a column of your page); `false` - no panel.
|
|
1906
|
+
*/
|
|
1907
|
+
appPanel?: 'auto' | 'sheet' | HTMLElement | null | false;
|
|
1908
|
+
/** Told when an app goes into the panel (`app`) or leaves it (`undefined`). */
|
|
1909
|
+
onAppPanel?: (app: AppView | undefined) => void;
|
|
1910
|
+
/** An app yourself: `fallback` is the built-in frame. */
|
|
1911
|
+
renderApp?: (app: AppView, message: ChatMessage, fallback: ReactNode) => ReactNode;
|
|
1912
|
+
/** A link / message an app asks for, yourself: `fallback` is the built-in card. */
|
|
1913
|
+
renderAppRequest?: (request: AppRequestView, fallback: ReactNode) => ReactNode;
|
|
1845
1914
|
}
|
|
1846
1915
|
/**
|
|
1847
1916
|
* A drop-in chat panel: transcript with every answer's activity (steps, tool
|
|
@@ -1942,6 +2011,113 @@ interface TranscriptBlockProps {
|
|
|
1942
2011
|
*/
|
|
1943
2012
|
declare const TranscriptBlock: ({ transcript, labels }: TranscriptBlockProps) => react.JSX.Element;
|
|
1944
2013
|
|
|
2014
|
+
/** The frame's height is the host's: a number of pixels between these, never the content's wish. */
|
|
2015
|
+
declare const FRAME_MIN_HEIGHT = 120;
|
|
2016
|
+
declare const FRAME_MAX_HEIGHT = 800;
|
|
2017
|
+
declare const clampFrameHeight: (height: number) => number;
|
|
2018
|
+
interface SandboxedFrameProps {
|
|
2019
|
+
/**
|
|
2020
|
+
* The untrusted document. It is shown inside `<iframe sandbox>` without `allow-same-origin`,
|
|
2021
|
+
* under a policy with no network, wrapped by `buildSandboxedDocument`. Omit it (and pass
|
|
2022
|
+
* `children`) to show host-rendered content - the source as text - in the same chrome.
|
|
2023
|
+
*/
|
|
2024
|
+
html?: string;
|
|
2025
|
+
/** Let the document's inline scripts run (default false). */
|
|
2026
|
+
scripts?: boolean;
|
|
2027
|
+
/** The accessible name of the frame. */
|
|
2028
|
+
title: string;
|
|
2029
|
+
/** The host's label, in the header: what this is and where it came from. */
|
|
2030
|
+
label: ReactNode;
|
|
2031
|
+
/** Host controls in the header (a view switch, buttons). */
|
|
2032
|
+
actions?: ReactNode;
|
|
2033
|
+
/** A host line under the frame. */
|
|
2034
|
+
footer?: ReactNode;
|
|
2035
|
+
/** Height of the framed document in px (default 300; clamped to 120 - 800). */
|
|
2036
|
+
height?: number;
|
|
2037
|
+
/** Host-rendered content in place of the framed document. */
|
|
2038
|
+
children?: ReactNode;
|
|
2039
|
+
className?: string;
|
|
2040
|
+
}
|
|
2041
|
+
/**
|
|
2042
|
+
* Third-party HTML inside chrome the host draws. The header, the footer and every control are
|
|
2043
|
+
* OUTSIDE the `<iframe>`: the content can paint whatever it likes inside its box and still cannot
|
|
2044
|
+
* imitate or cover a control of the chat. The box has a fixed height the host chose - the frame
|
|
2045
|
+
* is never resized by a message from the content, and the component listens to none.
|
|
2046
|
+
*
|
|
2047
|
+
* Reusable for anything untrusted that must be drawn (an HTML file, an MCP App): give it the
|
|
2048
|
+
* document and a label; see `html-preview.ts` for what the boundary is made of.
|
|
2049
|
+
*/
|
|
2050
|
+
declare const SandboxedFrame: ({ html, scripts, title, label, actions, footer, height, children, className, }: SandboxedFrameProps) => react.JSX.Element;
|
|
2051
|
+
|
|
2052
|
+
/**
|
|
2053
|
+
* The sandboxed frame's security core: what untrusted HTML (a file the agent wrote, later an
|
|
2054
|
+
* MCP App) is wrapped in before it reaches an `<iframe>`. Pure strings - no React, no DOM - so
|
|
2055
|
+
* every guard is unit-tested here and proved in a real browser by `e2e/files.spec.ts`.
|
|
2056
|
+
*
|
|
2057
|
+
* The boundary, in three layers:
|
|
2058
|
+
* 1. `sandbox` WITHOUT `allow-same-origin`: the document gets an opaque origin - no access to
|
|
2059
|
+
* the page's DOM, storage, IndexedDB (the key vault), cookies. No `allow-top-navigation`,
|
|
2060
|
+
* `allow-popups`, `allow-forms`, `allow-modals`, `allow-downloads` either.
|
|
2061
|
+
* 2. A Content-Security-Policy with no network source at all, given twice: as the first element
|
|
2062
|
+
* of the document itself, and by inheritance from the shell (3) - a `srcdoc` document takes
|
|
2063
|
+
* its parent's policy, which nothing inside the document can pre-empt.
|
|
2064
|
+
* 3. A shell document of ours between the page and the untrusted one. A frame may always
|
|
2065
|
+
* navigate ITSELF (`location = …`, a link, `<meta http-equiv=refresh>`): neither the sandbox
|
|
2066
|
+
* nor a document's own CSP stops that, and a navigation is a network request. The only thing
|
|
2067
|
+
* that does is the `frame-src` of the document that EMBEDS the frame - so we embed it in one
|
|
2068
|
+
* we wrote, whose policy says `frame-src 'none'`.
|
|
2069
|
+
*/
|
|
2070
|
+
interface SandboxedDocumentOptions {
|
|
2071
|
+
/** Let the document's own inline scripts run (default false). */
|
|
2072
|
+
scripts?: boolean;
|
|
2073
|
+
}
|
|
2074
|
+
/**
|
|
2075
|
+
* The policy of the framed document: nothing is fetched from anywhere. Inline styles, and
|
|
2076
|
+
* images / fonts / media the document carries inside itself (`data:`, `blob:`), are all it gets;
|
|
2077
|
+
* inline scripts only when asked for. `frame-src 'none'` is what stops the frame from navigating.
|
|
2078
|
+
*/
|
|
2079
|
+
declare const sandboxedCsp: (scripts?: boolean) => string;
|
|
2080
|
+
/**
|
|
2081
|
+
* The `sandbox` attribute: empty (everything off) or `allow-scripts`. Never
|
|
2082
|
+
* `allow-same-origin`, never a navigation, popup, form, modal or download token.
|
|
2083
|
+
*/
|
|
2084
|
+
declare const sandboxTokens: (scripts?: boolean) => string;
|
|
2085
|
+
/** A string as the value of a double-quoted HTML attribute. */
|
|
2086
|
+
declare const escapeAttribute: (value: string) => string;
|
|
2087
|
+
/**
|
|
2088
|
+
* The document with our policy as its FIRST element: right after a leading DOCTYPE (so the
|
|
2089
|
+
* page stays in standards mode), otherwise before everything. Nothing the document says can
|
|
2090
|
+
* come earlier - not its own `<meta>`, not a `<base>`, not a script before `<html>` - and a
|
|
2091
|
+
* later policy of its own can only narrow ours.
|
|
2092
|
+
*/
|
|
2093
|
+
declare const withCspFirst: (html: string, scripts?: boolean) => string;
|
|
2094
|
+
/** `withCspFirst` with a policy of the caller's (an MCP App's, built by `mcpAppCsp`). */
|
|
2095
|
+
declare const withPolicyFirst: (html: string, policy: string) => string;
|
|
2096
|
+
/**
|
|
2097
|
+
* What goes into the outer frame's `srcdoc`: the shell (ours: the policy, and one inner frame
|
|
2098
|
+
* that fills it) carrying the untrusted document, escaped, as the inner frame's `srcdoc`.
|
|
2099
|
+
* Give the OUTER `<iframe>` the same `sandboxTokens(scripts)`.
|
|
2100
|
+
*/
|
|
2101
|
+
declare const buildSandboxedDocument: (html: string, { scripts }?: SandboxedDocumentOptions) => string;
|
|
2102
|
+
/** HTML above this many characters is not framed at all - it is shown as source. */
|
|
2103
|
+
declare const HTML_PREVIEW_MAX_CHARS = 1000000;
|
|
2104
|
+
/**
|
|
2105
|
+
* The files a document links to by a relative path (`style.css`, `./app.js`, `img/a.png`): the
|
|
2106
|
+
* preview does not load them, and says so. A hint for the user, not a guard - the policy is
|
|
2107
|
+
* what keeps them from loading.
|
|
2108
|
+
*/
|
|
2109
|
+
declare const linkedFilesOf: (html: string, max?: number) => string[];
|
|
2110
|
+
/** A piece of HTML source, by what it is (for colouring the Source view). */
|
|
2111
|
+
interface SourceToken {
|
|
2112
|
+
kind: 'text' | 'tag' | 'attr' | 'string' | 'comment';
|
|
2113
|
+
text: string;
|
|
2114
|
+
}
|
|
2115
|
+
/**
|
|
2116
|
+
* Split HTML source into coloured pieces. Lossless: the pieces joined are the input. It only
|
|
2117
|
+
* decides colours - the result is rendered as text nodes, never as markup.
|
|
2118
|
+
*/
|
|
2119
|
+
declare const tokenizeHtml: (source: string) => SourceToken[];
|
|
2120
|
+
|
|
1945
2121
|
/** One result of the core's `web_search` tool, as far as a UI shows it. */
|
|
1946
2122
|
interface WebSearchResultView {
|
|
1947
2123
|
title: string;
|
|
@@ -1967,6 +2143,32 @@ interface WebSearchView {
|
|
|
1967
2143
|
*/
|
|
1968
2144
|
declare const webSearchOf: (output: unknown) => WebSearchView | undefined;
|
|
1969
2145
|
|
|
2146
|
+
/** The consent requests waiting for a person, by request id. */
|
|
2147
|
+
interface ApprovalQueue {
|
|
2148
|
+
/**
|
|
2149
|
+
* The core's `toolApproval.onRequest`: resolves when `approve` / `deny` is called. A request
|
|
2150
|
+
* the core stops waiting for (`ctx.signal`: its `timeoutMs` ran out, the run stopped) leaves
|
|
2151
|
+
* the queue at once, so no stale answer is kept for it.
|
|
2152
|
+
*/
|
|
2153
|
+
handler: (req: ToolApprovalRequest, ctx?: ToolApprovalContext) => Promise<ToolApprovalDecision>;
|
|
2154
|
+
/** Allow one. False when no such request is waiting (answered, expired, settled). */
|
|
2155
|
+
approve: (id: string, options?: {
|
|
2156
|
+
remember?: boolean;
|
|
2157
|
+
}) => boolean;
|
|
2158
|
+
/** Deny one. False when no such request is waiting. */
|
|
2159
|
+
deny: (id: string, reason?: string) => boolean;
|
|
2160
|
+
/** Answer every waiting request with `decision` (the run ended, the view closed). */
|
|
2161
|
+
settleAll: (decision: ToolApprovalDecision) => void;
|
|
2162
|
+
/** The ids of the requests waiting, oldest first. */
|
|
2163
|
+
pending: () => string[];
|
|
2164
|
+
}
|
|
2165
|
+
/**
|
|
2166
|
+
* The queue behind `useAgent`'s `approve` / `deny`: `request.id → resolver`. A request leaves it
|
|
2167
|
+
* exactly once - answered, settled by `settleAll`, or dropped when the core no longer wants the
|
|
2168
|
+
* answer (its signal aborted; the core has already denied the call and said so in its event).
|
|
2169
|
+
*/
|
|
2170
|
+
declare const createApprovalQueue: () => ApprovalQueue;
|
|
2171
|
+
|
|
1970
2172
|
interface ApprovalModeSwitchProps {
|
|
1971
2173
|
mode: ToolApprovalMode;
|
|
1972
2174
|
onChange: (mode: ToolApprovalMode) => void;
|
|
@@ -2045,5 +2247,82 @@ interface ApiKeyFormProps {
|
|
|
2045
2247
|
*/
|
|
2046
2248
|
declare const ApiKeyForm: ({ credentials, credentialRef, label, placeholder, onChange, className, }: ApiKeyFormProps) => react.JSX.Element;
|
|
2047
2249
|
|
|
2048
|
-
|
|
2049
|
-
|
|
2250
|
+
interface McpAppFrameProps {
|
|
2251
|
+
/** The app (an entry of `message.apps`). */
|
|
2252
|
+
app: AppView;
|
|
2253
|
+
/** The host: reads the app, asks the user about its requests (`useMcpAppHost`). */
|
|
2254
|
+
host: McpAppHost;
|
|
2255
|
+
/** `'inline'` under the answer (default), or `'panel'`: it fills the box it is given. */
|
|
2256
|
+
variant?: 'inline' | 'panel';
|
|
2257
|
+
/** The colour scheme the app is told (`hostContext.theme`). */
|
|
2258
|
+
theme?: 'light' | 'dark';
|
|
2259
|
+
/** Start folded to one line (default false). */
|
|
2260
|
+
defaultCollapsed?: boolean;
|
|
2261
|
+
/** Adds "Open in panel" (a header button and a menu item). */
|
|
2262
|
+
onOpenPanel?: () => void;
|
|
2263
|
+
/** In the panel: the close button (the app goes back into the chat). */
|
|
2264
|
+
onClosePanel?: () => void;
|
|
2265
|
+
/** The tools the app ran, listed under the frame (default true). */
|
|
2266
|
+
showCalls?: boolean;
|
|
2267
|
+
/**
|
|
2268
|
+
* Offer the app `fullscreen` besides `inline` (`hostContext.availableDisplayModes`), read when
|
|
2269
|
+
* the frame starts. Granted only to an app that declared it, right after the user acted inside
|
|
2270
|
+
* its frame, and not while it waits for the user: it then fills the chat panel (the viewport
|
|
2271
|
+
* on a narrow one) in the host's chrome - "App from server …", Exit full screen, Esc - with the
|
|
2272
|
+
* focus kept inside. Default false: an app stays inline.
|
|
2273
|
+
*/
|
|
2274
|
+
allowFullscreen?: boolean;
|
|
2275
|
+
labels?: AgentLabelsOverride;
|
|
2276
|
+
className?: string;
|
|
2277
|
+
}
|
|
2278
|
+
/**
|
|
2279
|
+
* An MCP App inside chrome the host draws: "App from server “travel” · sandboxed", the host's
|
|
2280
|
+
* controls (panel, menu: reload / open in panel / hide) and the list of what the app ran - all
|
|
2281
|
+
* OUTSIDE the frame, where the app cannot paint over them. The app runs in the boundary
|
|
2282
|
+
* `mcp-app.ts` builds: an opaque origin - or, with `host.sandbox`, an origin of its own behind the
|
|
2283
|
+
* sandbox page (falling back to the opaque frame when that page does not answer) - network only
|
|
2284
|
+
* where its resource declared it, no navigation, and every request that does something (a tool
|
|
2285
|
+
* call, a link, a message) put to the user through the host. Its height is its wish, clamped to
|
|
2286
|
+
* 120 - 800 px.
|
|
2287
|
+
*/
|
|
2288
|
+
declare const McpAppFrame: ({ app, host, variant, theme, defaultCollapsed, onOpenPanel, onClosePanel, showCalls, allowFullscreen, labels, className, }: McpAppFrameProps) => react.JSX.Element;
|
|
2289
|
+
interface McpAppLineProps {
|
|
2290
|
+
app: AppView;
|
|
2291
|
+
/** What the line says after the title ("hidden", "open in the panel"). */
|
|
2292
|
+
note: ReactNode;
|
|
2293
|
+
/** The button ("Show", "Bring back"). */
|
|
2294
|
+
action: ReactNode;
|
|
2295
|
+
onAction: () => void;
|
|
2296
|
+
labels?: AgentLabelsOverride;
|
|
2297
|
+
className?: string;
|
|
2298
|
+
}
|
|
2299
|
+
/** An app folded to one line: where it was, and the button that brings it back. */
|
|
2300
|
+
declare const McpAppLine: ({ app, note, action, onAction, labels, className }: McpAppLineProps) => react.JSX.Element;
|
|
2301
|
+
|
|
2302
|
+
interface AppRequestPromptProps {
|
|
2303
|
+
/** Waiting requests (`useMcpAppHost().requests`; `<AgentChat mcpApps>` passes its own). */
|
|
2304
|
+
requests: AppRequestView[];
|
|
2305
|
+
/**
|
|
2306
|
+
* The user's answer (`useMcpAppHost().answer`): an accepted link is opened and an accepted file
|
|
2307
|
+
* saved on this click; `always` allows an app's sampling until the page is reloaded.
|
|
2308
|
+
*/
|
|
2309
|
+
onAnswer: (id: string, accept: boolean, options?: AppRequestAnswerOptions) => void;
|
|
2310
|
+
/** Render a request yourself (gets the built-in card as `fallback`). */
|
|
2311
|
+
renderRequest?: (request: AppRequestView, fallback: ReactNode) => ReactNode;
|
|
2312
|
+
labels?: AgentLabelsOverride;
|
|
2313
|
+
className?: string;
|
|
2314
|
+
}
|
|
2315
|
+
/**
|
|
2316
|
+
* Consent cards for what an MCP App asks the host to do besides calling a tool: open a link
|
|
2317
|
+
* (the address with its host highlighted - what the user should check - and opened only on
|
|
2318
|
+
* "Open", in a new tab without an opener or a referrer), put a message in the message box
|
|
2319
|
+
* (shown as the app's text; accepted, it is a draft the user still sends - never sent for them),
|
|
2320
|
+
* save a file (its sanitized name, type and size; saved by this page only on "Save file"), or
|
|
2321
|
+
* ask the agent's model for an answer (the app's messages and instructions as plain text,
|
|
2322
|
+
* exactly what the model would get, and how much it may write). They sit with the agent's own
|
|
2323
|
+
* consent cards and say they come from the APP.
|
|
2324
|
+
*/
|
|
2325
|
+
declare const AppRequestPrompt: ({ requests, onAnswer, renderRequest, labels, className, }: AppRequestPromptProps) => react.JSX.Element | null;
|
|
2326
|
+
|
|
2327
|
+
export { AgentChat, AgentComposer, AgentLabelsProvider, AgentProvider, AgentStatus, AgentUiState, ApiKeyForm, AppRequestAnswerOptions, AppRequestPrompt, AppRequestView, AppView, ApprovalModeSwitch, ApprovalView, AttachmentView, BudgetView, ChatAttachment, ChatHistoryList, ChatHistoryStore, ChatMessage, CompactionView, Composer, ContextMeter, DecisionView, ElicitationIssueKind, ElicitationOutcomeReason, ElicitationPrompt, ElicitationView, FILE_PREVIEW_CHARS, FRAME_MAX_HEIGHT, FRAME_MIN_HEIGHT, FileChip, FileChips, FilesPanel, GeneratedMedia, HTML_PREVIEW_MAX_CHARS, LearnedSkills, LessonView, McpAppFrame, McpAppHost, McpAppLine, McpAppSandboxOptions, McpAppSandboxReason, McpAppsConnectionLike, McpElicitationResult, MediaView, MessageList, ModelLoadBar, ModelLoadState, PendingElicitation, PlanView, SandboxedFrame, SourceView, StepList, StepView, SubagentNode, SubagentRow, SubagentTree, SubagentView, ToolApprovalPrompt, ToolCallRow, ToolCallView, TranscriptBlock, TranscriptView, UsageBadge, UserNoteRow, UserNoteView, agentStateReducer, attachmentKindOf, attachmentRefusal, buildSandboxedDocument, chatTitle, clampFrameHeight, createApprovalQueue, createInitialAgentState, createWebLLMEngine, decisionNote, defaultLabels, downscaleImage, escapeAttribute, fileKindOf, fileNameOf, filterCommands, formatElapsed, lessonsOf, linkedFilesOf, mediaFamilyOf, mergeLabels, newChatId, noticesOf, parseSlash, sandboxTokens, sandboxedCsp, steerIntent, subagentTree, tokenizeHtml, usageLine, useAgent, useAgentContext, useChatHistory, useCredentials, useLabels, useLocalModel, useOptionalAgentContext, useSpeechToText, useVirtualFiles, useWebLLMModel, webSearchOf, withAttachments, withCspFirst, withPolicyFirst };
|
|
2328
|
+
export type { AgentAction, AgentChatClassNames, AgentChatComponents, AgentChatProps, AgentChatSlots, AgentComposerProps, AgentLabels, AgentLabelsOverride, AgentLabelsProviderProps, AgentProviderProps, ApiKeyFormProps, AppRequestPromptProps, ApprovalModeSwitchProps, ApprovalQueue, ApproveOptions, ChatHistoryListProps, ChatHistoryStoreOptions, ChatRecord, ChatSummary, ComposerAttachment, ComposerModelChip, ComposerNotice, ComposerProps, ComposerThinkingChip, ContextMeterProps, ConvertedFile, DownscaleOptions, ElicitationPromptProps, FileChipProps, FileChipsProps, FileKind, FilesPanelProps, GeneratedMediaProps, HtmlPreviewOptions, LearnedSkillsProps, LocalModelEngine, LocalModelLoadContext, LocalModelProgress, McpAppFrameProps, McpAppLineProps, MessageListProps, ModelLoadBarProps, NoticeTexts, PlanViewProps, RenderSubagent, RenderToolCall, RunGoalOptions, SandboxedDocumentOptions, SandboxedFrameProps, SlashCommand, SourceToken, SourceViewProps, SpeechRecognizerLike, SteerIntent, StepListProps, SubagentRowProps, SubagentTreeProps, ToolApprovalPromptProps, ToolCallRowProps, TranscriptBlockProps, UsageBadgeProps, UseAgentOptions, UseAgentReturn, UseChatHistoryOptions, UseChatHistoryReturn, UseCredentialsReturn, UseLocalModelOptions, UseLocalModelReturn, UseSpeechToTextOptions, UseSpeechToTextReturn, UseVirtualFilesReturn, UseWebLLMModelOptions, UseWebLLMModelReturn, WebLLMModelFactory, WebSearchResultView, WebSearchView };
|