@dudko.dev/agent-web-react 0.0.27 → 0.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { DependencyList, ReactNode, RefObject, ComponentType, CSSProperties } from 'react';
3
- import { IPlan, IPlanStep, IUsage, ReplanMode, AgentEvent, RunFile, RunResult, Agent, ToolApprovalMode, CompactResult, AgentEventHandler, BrowserAgentConfig, VirtualFileInfo, VirtualFileSystem, CredentialStore, createWebLLMModel, WebLLMModelOptions, Skill } from '@dudko.dev/agent-web';
3
+ import { IPlan, IPlanStep, ModelTier, TierReason, EscalationReason, DecisionPoint, DecisionFallbackReason, IUsage, ReplanMode, AgentEvent, RunFile, RunResult, Agent, ToolApprovalMode, CompactResult, AgentEventHandler, BrowserAgentConfig, VirtualFileInfo, VirtualFileSystem, CredentialStore, createWebLLMModel, WebLLMModelOptions, Skill } from '@dudko.dev/agent-web';
4
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
5
 
6
6
  /** Why a run stopped early (a `budget.exceeded` event). */
@@ -58,6 +58,10 @@ interface ChatMessage {
58
58
  learned?: string[];
59
59
  /** Assistant turn: what the model fetched from the web during the run. */
60
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[];
61
65
  /** Assistant turn ended with an error. */
62
66
  error?: boolean;
63
67
  }
@@ -76,6 +80,29 @@ interface ToolCallView {
76
80
  inputTokens?: number;
77
81
  /** ≈ tokens of the result fed back to the model (chars / 4). */
78
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;
79
106
  }
80
107
  /**
81
108
  * A lesson in the agent's notebook (`config.learning`): a skill the agent wrote down itself.
@@ -100,6 +127,50 @@ interface FetchView {
100
127
  /** Why it was refused. */
101
128
  reason?: string;
102
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
+ }
103
174
  /** A tool call waiting for (or decided by) the user's consent. */
104
175
  interface ApprovalView {
105
176
  id: string;
@@ -108,6 +179,16 @@ interface ApprovalView {
108
179
  readOnly: boolean;
109
180
  /** The step the call belongs to, when known. */
110
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
+ };
111
192
  status: 'pending' | 'approved' | 'denied';
112
193
  reason?: string;
113
194
  /** Decided by policy (rule / read-only mode), not by a person. */
@@ -131,11 +212,37 @@ interface UserNoteView {
131
212
  /** The step it was delivered in (`round`) or after (`step`); none for `final`. */
132
213
  stepId?: string;
133
214
  }
134
- /** A delegated task running in a subagent (in-process or a Web Worker). */
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
+ */
135
220
  interface SubagentView {
136
221
  id: string;
222
+ /** The subagent's name (`spawn_subagent` for a helper the model started). */
137
223
  name: string;
224
+ /** Empty when only its events were seen (its `subagent.start` never arrived). */
138
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;
139
246
  /** `stopped`: the user stopped this subagent; the run went on without it. */
140
247
  status: 'running' | 'done' | 'error' | 'stopped';
141
248
  /** The profile the parent model chose for this delegation, when there are profiles. */
@@ -150,9 +257,17 @@ interface SubagentView {
150
257
  toolCalls: number;
151
258
  /** The child's answer (streamed, then final). */
152
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
+ */
153
264
  usage: IUsage;
154
265
  error?: string;
155
266
  }
267
+ /** A {@link SubagentView} with the subagents it started (see {@link subagentTree}). */
268
+ interface SubagentNode extends SubagentView {
269
+ children: SubagentNode[];
270
+ }
156
271
  /** One compaction of the context (a `context.compacted` event). */
157
272
  interface CompactionView {
158
273
  scope: 'history' | 'trace' | 'tool-results';
@@ -173,6 +288,29 @@ interface StepView {
173
288
  status: 'running' | 'done';
174
289
  summary?: string;
175
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[];
176
314
  }
177
315
  /** WebLLM weight-download / engine-init progress (model.load events). */
178
316
  interface ModelLoadState {
@@ -184,6 +322,14 @@ interface ReplanState {
184
322
  reason: string;
185
323
  /** The replanner ran because the user sent a message, not because a step failed. */
186
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;
187
333
  }
188
334
  /**
189
335
  * The whole UI-facing view of an agent run, rebuilt purely from the stream of
@@ -207,7 +353,10 @@ interface AgentUiState {
207
353
  finalReasoning: string;
208
354
  /** Tool calls that asked for consent in this run, pending first-come. */
209
355
  approvals: ApprovalView[];
210
- /** Subagent delegations of this run. */
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
+ */
211
360
  subagents: SubagentView[];
212
361
  /** Messages sent while the run goes that have not yet been shown to the model. */
213
362
  queued: QueuedMessageView[];
@@ -231,6 +380,15 @@ interface AgentUiState {
231
380
  learnedNow: string[];
232
381
  /** What the model fetched from the web in this run (`config.egress`). */
233
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[];
234
392
  /** Tools activated by find_tools in this run. */
235
393
  discoveredTools: string[];
236
394
  /** Compactions in this run. */
@@ -249,7 +407,11 @@ interface AgentUiState {
249
407
  modelLoad?: ModelLoadState;
250
408
  /** The most recent replan decision, if any. */
251
409
  replan?: ReplanState;
252
- /** Error message from the last run error / build failure. */
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
+ */
253
415
  error?: string;
254
416
  /** True when the last run was aborted via stop(). */
255
417
  stopped: boolean;
@@ -971,16 +1133,76 @@ interface AgentLabels {
971
1133
  subagentStopped: string;
972
1134
  failed: string;
973
1135
  toolCostTitle: string;
1136
+ /** The tier badge on a step. */
1137
+ tierNames: Record<ModelTier, string>;
1138
+ /** The badge's tooltip: why the step started on its tier. */
1139
+ tierReasons: Record<TierReason, string>;
1140
+ /** Why a step was retried on a stronger model. */
1141
+ escalationReasons: Record<EscalationReason, string>;
1142
+ /** "Escalated: light → strong (reported a blocker)" - the names and the reason are already labels. */
1143
+ escalated: (from: string, to: string, reason: string) => string;
1144
+ /** Opens what the failed attempt had written. */
1145
+ escalatedAttemptText: string;
1146
+ /** "1 escalation" in the activity summary. */
1147
+ escalations: (n: number) => string;
1148
+ /** On a tool call made by an attempt that was escalated. */
1149
+ attemptTag: (n: number) => string;
1150
+ /** On a write the core did not run a second time (it succeeded in an earlier attempt). */
1151
+ replayed: string;
1152
+ replayedTitle: string;
1153
+ /** The replanner call failed; the run went on with the plan it had. */
1154
+ replanFailed: string;
1155
+ /** The tag on a helper the model started itself (`spawn_subagent`). */
1156
+ subagentHelper: string;
1157
+ /** A node's status, in words. */
1158
+ subagentStatus: Record<'running' | 'done' | 'error' | 'stopped', string>;
1159
+ /** "12k tokens" - what was spent under a node; the number is already formatted. */
1160
+ subagentTokens: (tokens: string) => string;
1161
+ /** "tools: fs_read, web_fetch" - what a helper was given. */
1162
+ subagentTools: (names: string) => string;
1163
+ /** A helper that was given no tools at all (it only reasons). */
1164
+ subagentNoTools: string;
1165
+ /** The consent prompt of a helper's call: `role` is what the model wrote for it, if anything. */
1166
+ approvalLeadHelper: (role: string | undefined, depth: number) => string;
1167
+ /** Alt text of a generated image; `path` is where it is in the workspace. */
1168
+ mediaImage: (path: string) => string;
1169
+ /** The accessible name of a generated audio player. */
1170
+ mediaAudio: (path: string) => string;
1171
+ /** A generated file that cannot be shown here (no workspace, the file is gone, an unknown type). */
1172
+ mediaFile: (path: string) => string;
1173
+ /** The summary of a transcript block. */
1174
+ transcriptOf: (name: string) => string;
1175
+ /** Says whose words a transcript is: the content of the user's file, not the agent's. */
1176
+ transcriptNote: string;
1177
+ usageMedia: (n: number) => string;
1178
+ usageDecisions: (n: number) => string;
1179
+ /** "decision model: continue (0.93)" - its answer was used; the probability is formatted. */
1180
+ decisionAccepted: (choice: string, confidence: string) => string;
1181
+ /** "decision model fell back: low confidence (0.41 < 0.8)" - the ordinary model call ran. */
1182
+ decisionFellBack: (reason: string, detail: string) => string;
1183
+ decisionReasons: Record<DecisionFallbackReason, string>;
1184
+ /** Before the query of a `web_search` call. */
1185
+ searchQuery: string;
1186
+ searchNoResults: string;
1187
+ /** Results left out by the egress policy. */
1188
+ searchFiltered: (n: number) => string;
1189
+ /** The list was cut to the cap. */
1190
+ searchTruncated: string;
974
1191
  }
975
1192
  declare const defaultLabels: AgentLabels;
976
1193
  /** Overrides: any label, with the nested groups merged key by key. */
977
- type AgentLabelsOverride = Partial<Omit<AgentLabels, 'status' | 'modes' | 'commandGroups' | 'commandDescriptions' | 'thinkingLevels' | 'notices'>> & {
1194
+ type AgentLabelsOverride = Partial<Omit<AgentLabels, 'status' | 'modes' | 'commandGroups' | 'commandDescriptions' | 'thinkingLevels' | 'notices' | 'tierNames' | 'tierReasons' | 'escalationReasons' | 'subagentStatus' | 'decisionReasons'>> & {
978
1195
  status?: Partial<AgentLabels['status']>;
979
1196
  modes?: Partial<AgentLabels['modes']>;
980
1197
  commandGroups?: Partial<AgentLabels['commandGroups']>;
981
1198
  commandDescriptions?: Partial<AgentLabels['commandDescriptions']>;
982
1199
  thinkingLevels?: Partial<AgentLabels['thinkingLevels']>;
983
1200
  notices?: Partial<AgentLabels['notices']>;
1201
+ tierNames?: Partial<AgentLabels['tierNames']>;
1202
+ tierReasons?: Partial<AgentLabels['tierReasons']>;
1203
+ escalationReasons?: Partial<AgentLabels['escalationReasons']>;
1204
+ subagentStatus?: Partial<AgentLabels['subagentStatus']>;
1205
+ decisionReasons?: Partial<AgentLabels['decisionReasons']>;
984
1206
  };
985
1207
  /** `base` with `over` applied (nested groups merged, not replaced). */
986
1208
  declare const mergeLabels: (base: AgentLabels, over?: AgentLabelsOverride) => AgentLabels;
@@ -1091,6 +1313,11 @@ type AgentAction =
1091
1313
  declare const lessonsOf: (skills: Skill[]) => LessonView[];
1092
1314
  /** A fresh, empty view. */
1093
1315
  declare const createInitialAgentState: () => AgentUiState;
1316
+ /**
1317
+ * The flat `subagents` list as a tree: each node with the subagents it started, in the order
1318
+ * they started. A node whose parent is not in the list (its start was never seen) is a root.
1319
+ */
1320
+ declare const subagentTree: (subagents: SubagentView[]) => SubagentNode[];
1094
1321
  declare const agentStateReducer: (state: AgentUiState, action: AgentAction) => AgentUiState;
1095
1322
 
1096
1323
  interface ComposerModelChip {
@@ -1262,30 +1489,79 @@ interface FilesPanelProps {
1262
1489
  */
1263
1490
  declare const FilesPanel: ({ files: vfs, prefix, title, allowUpload, allowDelete, uploadDir, onOpen, renderFile, labels, className, }: FilesPanelProps) => react.JSX.Element;
1264
1491
 
1492
+ /** Render a node yourself; `fallback` is the built-in `<li>` (with its children) — return it, or your own `<li>`. */
1493
+ type RenderSubagent = (node: SubagentNode, fallback: ReactNode) => ReactNode;
1494
+ interface SubagentRowProps {
1495
+ sub: SubagentView;
1496
+ /** Stop this subagent (`useAgent().stopSubagent`); the button shows while it runs. */
1497
+ onStop?: (id: string) => void;
1498
+ /** Its status line: status, model, tokens, tool calls, time (default true). */
1499
+ showUsage?: boolean;
1500
+ /** The tools a helper was given (default true). */
1501
+ showTools?: boolean;
1502
+ labels?: AgentLabelsOverride;
1503
+ /** The subagents this one started (the tree puts them here). */
1504
+ children?: ReactNode;
1505
+ }
1506
+ /**
1507
+ * One subagent - a static one or a helper the model started: who it is, its task, its status
1508
+ * with the model, tokens and time, what it is doing, and its answer when done. With `onStop`,
1509
+ * a running one gets a stop button (the run and its siblings go on).
1510
+ */
1511
+ declare const SubagentRow: ({ sub, onStop, showUsage, showTools, labels, children, }: SubagentRowProps) => react.JSX.Element;
1512
+ interface SubagentTreeProps {
1513
+ /**
1514
+ * The subagents to draw (`agent.subagents`, or a message's): static subagents and the helpers
1515
+ * the model started, at any depth. The flat list is nested by `parentId`.
1516
+ */
1517
+ subagents: SubagentView[];
1518
+ /** Give each running node a stop button (`useAgent().stopSubagent`). */
1519
+ onStop?: (id: string) => void;
1520
+ /** Each node's status line: status, model, tokens, tool calls, time (default true). */
1521
+ showUsage?: boolean;
1522
+ /** The tools each helper was given (default true). */
1523
+ showTools?: boolean;
1524
+ /** Render a node yourself (gets the built-in `<li>` as `fallback`). */
1525
+ renderSubagent?: RenderSubagent;
1526
+ labels?: AgentLabelsOverride;
1527
+ className?: string;
1528
+ }
1529
+ /**
1530
+ * The run's subagents as an indented tree: each node with its status, model, tokens and time,
1531
+ * what it is doing, and - while it runs - a stop button. A helper's own helpers sit under it.
1532
+ * Renders nothing when there are none.
1533
+ */
1534
+ declare const SubagentTree: ({ subagents, onStop, showUsage, showTools, renderSubagent, labels, className, }: SubagentTreeProps) => ReactNode;
1535
+
1265
1536
  /** Render a tool call yourself; `fallback` is the built-in `<li>` row — return it, or your own `<li>`. */
1266
1537
  type RenderToolCall = (call: ToolCallView, fallback: ReactNode) => ReactNode;
1267
1538
  interface ToolCallRowProps {
1268
1539
  call: ToolCallView;
1269
1540
  showUsage?: boolean;
1541
+ /**
1542
+ * Mark a call of an escalated attempt ("attempt 1") and a write that was not run a second
1543
+ * time (default true). Nothing shows without model tiers.
1544
+ */
1545
+ showTiers?: boolean;
1546
+ /**
1547
+ * A `web_search` call's results as a short list under the row: the query, then title + host
1548
+ * of each result as a link and its snippet as plain text (default true).
1549
+ */
1550
+ showSearchResults?: boolean;
1270
1551
  labels?: AgentLabelsOverride;
1271
1552
  }
1272
- /** One tool call: name, arguments, status — and optionally its cost and any images it returned. */
1273
- declare const ToolCallRow: ({ call, showUsage, labels }: ToolCallRowProps) => react.JSX.Element;
1274
1553
  /**
1275
- * A subagent delegation: name, task, live activity, and its answer when done. With
1276
- * `onStop`, a running one gets a stop button (the run and its siblings go on).
1554
+ * One tool call: name, arguments, status — and optionally its cost, any images it returned and,
1555
+ * for a web search, what it found.
1277
1556
  */
1278
- declare const SubagentRow: ({ sub, onStop, labels, }: {
1279
- sub: SubagentView;
1280
- /** Stop this subagent (`useAgent().stopSubagent`); the button shows while it runs. */
1281
- onStop?: (id: string) => void;
1282
- labels?: AgentLabelsOverride;
1283
- }) => react.JSX.Element;
1557
+ declare const ToolCallRow: ({ call, showUsage, showTiers, showSearchResults, labels, }: ToolCallRowProps) => react.JSX.Element;
1284
1558
  /** What the user said while the run was going, and where it reached the agent. */
1285
1559
  declare const UserNoteRow: ({ note, labels, }: {
1286
1560
  note: UserNoteView;
1287
1561
  labels?: AgentLabelsOverride;
1288
1562
  }) => react.JSX.Element;
1563
+ /** "decision model: continue (0.93)" / "decision model fell back: low confidence (0.41 < 0.8)". */
1564
+ declare const decisionNote: (d: DecisionView, L: AgentLabels) => string;
1289
1565
  interface StepListProps {
1290
1566
  steps: StepView[];
1291
1567
  /** Subagent delegations (`agent.subagents`) — shown under the step that made them. */
@@ -1298,12 +1574,30 @@ interface StepListProps {
1298
1574
  showNotes?: boolean;
1299
1575
  /** Give a running subagent a stop button (`agent.stopSubagent`). */
1300
1576
  onStopSubagent?: (id: string) => void;
1577
+ /** The subagent tree under the step that started it (default true). */
1578
+ showSubagents?: boolean;
1579
+ /** Render a node of the subagent tree yourself (gets the built-in `<li>` as `fallback`). */
1580
+ renderSubagent?: RenderSubagent;
1301
1581
  /** Show each tool call (default true). */
1302
1582
  showToolCalls?: boolean;
1303
1583
  /** Show each tool call's ≈tokens and duration (default true). */
1304
1584
  showUsage?: boolean;
1305
1585
  /** Show each step's thoughts when the model thinks (default true). */
1306
1586
  showThoughts?: boolean;
1587
+ /**
1588
+ * Model tiers: the tier / model badge on a step, its "escalated: light → strong" line and the
1589
+ * marks on the earlier attempt's tool calls (default true; nothing shows when tiers are off).
1590
+ */
1591
+ showTiers?: boolean;
1592
+ /** The "replanning failed, continuing with the plan" warning under a step (default true). */
1593
+ showReplanFailed?: boolean;
1594
+ /**
1595
+ * The decision model's note under the step it was asked after - "decision model: continue
1596
+ * (0.93)" (default true; nothing shows without `decisionModel`).
1597
+ */
1598
+ showDecisions?: boolean;
1599
+ /** A `web_search` call's results as a list under its row (default true). */
1600
+ showSearchResults?: boolean;
1307
1601
  /** Render tool calls yourself (gets the built-in row as `fallback`). */
1308
1602
  renderToolCall?: RenderToolCall;
1309
1603
  labels?: AgentLabelsOverride;
@@ -1313,7 +1607,7 @@ interface StepListProps {
1313
1607
  * The live execution: each step, its thoughts, streamed text, tool calls,
1314
1608
  * consent decisions and subagent delegations.
1315
1609
  */
1316
- declare const StepList: ({ steps, subagents, approvals, notes, showNotes, onStopSubagent, showToolCalls, showUsage, showThoughts, renderToolCall, labels, className, }: StepListProps) => react.JSX.Element | null;
1610
+ declare const StepList: ({ steps, subagents, approvals, notes, showNotes, onStopSubagent, showToolCalls, showUsage, showThoughts, showTiers, showReplanFailed, showDecisions, showSearchResults, showSubagents, renderToolCall, renderSubagent, labels, className, }: StepListProps) => react.JSX.Element | null;
1317
1611
 
1318
1612
  interface MessageListProps {
1319
1613
  messages: ChatMessage[];
@@ -1331,6 +1625,27 @@ interface MessageListProps {
1331
1625
  showNotes?: boolean;
1332
1626
  /** The lessons the agent wrote down during the answer, and the pages it fetched (default true). */
1333
1627
  showLearned?: boolean;
1628
+ /** Model tiers: the tier badges, escalation lines and the escalation count (default true). */
1629
+ showTiers?: boolean;
1630
+ /** The "replanning failed, continuing with the plan" warning under a step (default true). */
1631
+ showReplanFailed?: boolean;
1632
+ /** The decision model's note under a step (default true; nothing shows without one). */
1633
+ showDecisions?: boolean;
1634
+ /** A `web_search` call's results as a list under its row (default true). */
1635
+ showSearchResults?: boolean;
1636
+ /** The subagent tree under the step that started it (default true). */
1637
+ showSubagents?: boolean;
1638
+ /**
1639
+ * What the run generated, in the answer: images inline, audio as a player - and the
1640
+ * transcripts of audio files, folded (default true). Needs `files` to show the bytes.
1641
+ */
1642
+ showMedia?: boolean;
1643
+ /** The workspace generated files are read from (the core's `VirtualFileSystem`). */
1644
+ files?: VirtualFileSystem;
1645
+ /** A generated file; `fallback` is the built-in image / player / chip. */
1646
+ renderMedia?: (media: MediaView, message: ChatMessage, fallback: ReactNode) => ReactNode;
1647
+ /** A node of the subagent tree (gets the built-in `<li>` as `fallback`). */
1648
+ renderSubagent?: RenderSubagent;
1334
1649
  /** Give a running subagent a stop button (`useAgent().stopSubagent`). */
1335
1650
  onStopSubagent?: (id: string) => void;
1336
1651
  /** Open the activity of finished answers too (default: only while it runs). */
@@ -1364,7 +1679,7 @@ declare const AttachmentView: ({ attachment: a }: {
1364
1679
  * subagents, consent decisions — and the tokens it spent by kind. Every part
1365
1680
  * can be hidden, relabelled or rendered by the host.
1366
1681
  */
1367
- declare const MessageList: ({ messages, empty, showActivity, showToolCalls, showUsage, showThoughts, showNotes, showLearned, onStopSubagent, activityOpen, liveExtra, renderContent, renderMessage, renderAttachment, renderToolCall, labels, className, }: MessageListProps) => react.JSX.Element | null;
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;
1368
1683
 
1369
1684
  interface ToolApprovalPromptProps {
1370
1685
  /** Pending requests (e.g. `agent.pendingApprovals`). */
@@ -1375,6 +1690,8 @@ interface ToolApprovalPromptProps {
1375
1690
  onDeny: (id: string, reason?: string) => void;
1376
1691
  /** Offer "Always allow" (remembers the tool for the agent's life). Default true. */
1377
1692
  allowRemember?: boolean;
1693
+ /** Say which helper is asking when the call is a helper's, not the run's own (default true). */
1694
+ showHelper?: boolean;
1378
1695
  /** Render a request yourself (gets the built-in card as `fallback`). */
1379
1696
  renderApproval?: (approval: ApprovalView, fallback: ReactNode) => ReactNode;
1380
1697
  labels?: AgentLabelsOverride;
@@ -1385,7 +1702,7 @@ interface ToolApprovalPromptProps {
1385
1702
  * "Always allow" and "Deny". Wire it to {@link useAgent}'s `pendingApprovals`,
1386
1703
  * `approve` and `deny`; `<AgentChat>` renders it for you.
1387
1704
  */
1388
- declare const ToolApprovalPrompt: ({ approvals, onApprove, onDeny, allowRemember, renderApproval, labels, className, }: ToolApprovalPromptProps) => react.JSX.Element | null;
1705
+ declare const ToolApprovalPrompt: ({ approvals, onApprove, onDeny, allowRemember, showHelper, renderApproval, labels, className, }: ToolApprovalPromptProps) => react.JSX.Element | null;
1389
1706
 
1390
1707
  /** Places to put your own content in the panel. */
1391
1708
  interface AgentChatSlots {
@@ -1444,6 +1761,30 @@ interface AgentChatProps {
1444
1761
  showNotes?: boolean;
1445
1762
  /** The lessons the agent wrote down during an answer, and the pages it fetched (default true). */
1446
1763
  showLearned?: boolean;
1764
+ /**
1765
+ * Model tiers (`executorTiers`): the tier / model badge on a step, the "escalated" line and
1766
+ * the escalation count (default true; nothing shows when tiers are off).
1767
+ */
1768
+ showTiers?: boolean;
1769
+ /** The "replanning failed, continuing with the plan" warning (default true). */
1770
+ showReplanFailed?: boolean;
1771
+ /**
1772
+ * The decision model's note under the step it was asked after - "decision model: continue
1773
+ * (0.93)" (default true; nothing shows without `decisionModel`).
1774
+ */
1775
+ showDecisions?: boolean;
1776
+ /** A `web_search` call's results as a short list under its row (default true). */
1777
+ showSearchResults?: boolean;
1778
+ /**
1779
+ * The subagent tree - static subagents and the helpers the model started - under the step
1780
+ * that started them (default true).
1781
+ */
1782
+ showSubagents?: boolean;
1783
+ /**
1784
+ * What a run generated (`config.media`): images inline in the answer, audio as a player, and
1785
+ * the transcripts of audio files, folded (default true). The bytes are read from `files`.
1786
+ */
1787
+ showMedia?: boolean;
1447
1788
  /** A stop button on each running subagent (default true). */
1448
1789
  stoppableSubagents?: boolean;
1449
1790
  /** Conversation total in the header (default true). */
@@ -1486,6 +1827,10 @@ interface AgentChatProps {
1486
1827
  renderMessage?: MessageListProps['renderMessage'];
1487
1828
  renderAttachment?: MessageListProps['renderAttachment'];
1488
1829
  renderToolCall?: RenderToolCall;
1830
+ /** A node of the subagent tree. */
1831
+ renderSubagent?: RenderSubagent;
1832
+ /** A generated image / audio file. */
1833
+ renderMedia?: MessageListProps['renderMedia'];
1489
1834
  renderApproval?: ToolApprovalPromptProps['renderApproval'];
1490
1835
  slots?: AgentChatSlots;
1491
1836
  components?: AgentChatComponents;
@@ -1570,6 +1915,58 @@ interface PlanViewProps {
1570
1915
  /** The plan the agent produced: its reasoning and the ordered step list. */
1571
1916
  declare const PlanView: ({ plan, showThought, className }: PlanViewProps) => react.JSX.Element | null;
1572
1917
 
1918
+ /**
1919
+ * How a generated file may be shown: only the types the core's media tools accept
1920
+ * (PNG / JPEG / GIF / WebP, and its audio list). Anything else - SVG included - is a file chip.
1921
+ */
1922
+ declare const mediaFamilyOf: (mediaType: string) => "image" | "audio" | undefined;
1923
+ interface GeneratedMediaProps {
1924
+ media: MediaView;
1925
+ /** The workspace the file is in (the core's `VirtualFileSystem`). Without it: a file chip. */
1926
+ files?: VirtualFileSystem;
1927
+ labels?: AgentLabelsOverride;
1928
+ }
1929
+ /**
1930
+ * A file a media tool wrote, read from the workspace: an image inline, audio as a native
1931
+ * player. A type the core does not generate, a missing file or no workspace gives a chip with
1932
+ * the path.
1933
+ */
1934
+ declare const GeneratedMedia: ({ media, files, labels }: GeneratedMediaProps) => react.JSX.Element;
1935
+ interface TranscriptBlockProps {
1936
+ transcript: TranscriptView;
1937
+ labels?: AgentLabelsOverride;
1938
+ }
1939
+ /**
1940
+ * What an audio file said, folded: "Transcript of memo.mp3". The text is the content of the
1941
+ * user's file - shown as plain text and marked as such.
1942
+ */
1943
+ declare const TranscriptBlock: ({ transcript, labels }: TranscriptBlockProps) => react.JSX.Element;
1944
+
1945
+ /** One result of the core's `web_search` tool, as far as a UI shows it. */
1946
+ interface WebSearchResultView {
1947
+ title: string;
1948
+ /** An http(s) address - anything else is left out. */
1949
+ url: string;
1950
+ /** The host of `url`, for the line under the title. */
1951
+ host: string;
1952
+ snippet: string;
1953
+ date?: string;
1954
+ }
1955
+ interface WebSearchView {
1956
+ query: string;
1957
+ results: WebSearchResultView[];
1958
+ /** Results the egress policy left out. */
1959
+ filtered: number;
1960
+ truncated: boolean;
1961
+ }
1962
+ /**
1963
+ * The result of the core's `web_search` tool (`{ query, results: [{ title, url, snippet, date? }],
1964
+ * filtered?, truncated?, untrusted: true }`), or undefined when `output` is not one. Titles and
1965
+ * snippets are third-party text: they come back as plain strings, to be rendered as text. A
1966
+ * result whose `url` is not http(s) is dropped, so a link can never be a `javascript:` one.
1967
+ */
1968
+ declare const webSearchOf: (output: unknown) => WebSearchView | undefined;
1969
+
1573
1970
  interface ApprovalModeSwitchProps {
1574
1971
  mode: ToolApprovalMode;
1575
1972
  onChange: (mode: ToolApprovalMode) => void;
@@ -1615,13 +2012,20 @@ interface UsageBadgeProps {
1615
2012
  usage: IUsage;
1616
2013
  /** Only in ↑ out ↓ (the rest stays in the tooltip) — for tight headers. */
1617
2014
  compact?: boolean;
2015
+ /**
2016
+ * Calls that are not tokens - to the media models and to the decision model - when there were
2017
+ * any (default true).
2018
+ */
2019
+ showCalls?: boolean;
2020
+ labels?: AgentLabelsOverride;
1618
2021
  className?: string;
1619
2022
  }
1620
2023
  /**
1621
2024
  * A compact token-usage readout: in ↑ out ↓, plus thinking (🧠) and cache-hit
1622
- * tokens when the provider reported any. The full breakdown is on hover.
2025
+ * tokens when the provider reported any, and the media / decision calls when the run made
2026
+ * some. The full breakdown is on hover.
1623
2027
  */
1624
- declare const UsageBadge: ({ usage, compact, className }: UsageBadgeProps) => react.JSX.Element | null;
2028
+ declare const UsageBadge: ({ usage, compact, showCalls, labels, className, }: UsageBadgeProps) => react.JSX.Element | null;
1625
2029
 
1626
2030
  interface ApiKeyFormProps {
1627
2031
  /** The value returned by {@link useCredentials}. */
@@ -1641,5 +2045,5 @@ interface ApiKeyFormProps {
1641
2045
  */
1642
2046
  declare const ApiKeyForm: ({ credentials, credentialRef, label, placeholder, onChange, className, }: ApiKeyFormProps) => react.JSX.Element;
1643
2047
 
1644
- export { AgentChat, AgentComposer, AgentLabelsProvider, AgentProvider, ApiKeyForm, ApprovalModeSwitch, AttachmentView, ChatHistoryList, ChatHistoryStore, Composer, ContextMeter, FilesPanel, LearnedSkills, MessageList, ModelLoadBar, PlanView, StepList, SubagentRow, ToolApprovalPrompt, ToolCallRow, UsageBadge, UserNoteRow, agentStateReducer, attachmentKindOf, attachmentRefusal, chatTitle, createInitialAgentState, createWebLLMEngine, defaultLabels, downscaleImage, filterCommands, formatElapsed, lessonsOf, mergeLabels, newChatId, noticesOf, parseSlash, steerIntent, usageLine, useAgent, useAgentContext, useChatHistory, useCredentials, useLabels, useLocalModel, useOptionalAgentContext, useSpeechToText, useVirtualFiles, useWebLLMModel, withAttachments };
1645
- export type { AgentAction, AgentChatClassNames, AgentChatComponents, AgentChatProps, AgentChatSlots, AgentComposerProps, AgentLabels, AgentLabelsOverride, AgentLabelsProviderProps, AgentProviderProps, AgentStatus, AgentUiState, ApiKeyFormProps, ApprovalModeSwitchProps, ApprovalView, ApproveOptions, BudgetView, ChatAttachment, ChatHistoryListProps, ChatHistoryStoreOptions, ChatMessage, ChatRecord, ChatSummary, CompactionView, ComposerAttachment, ComposerModelChip, ComposerNotice, ComposerProps, ComposerThinkingChip, ContextMeterProps, ConvertedFile, DownscaleOptions, FetchView, FilesPanelProps, LearnedSkillsProps, LessonView, LocalModelEngine, LocalModelLoadContext, LocalModelProgress, MessageListProps, ModelLoadBarProps, ModelLoadState, NoticeTexts, PlanViewProps, QueuedMessageView, RenderToolCall, ReplanState, RunGoalOptions, SlashCommand, SpeechRecognizerLike, SteerIntent, StepListProps, StepView, SubagentView, ToolApprovalPromptProps, ToolCallRowProps, ToolCallView, UsageBadgeProps, UseAgentOptions, UseAgentReturn, UseChatHistoryOptions, UseChatHistoryReturn, UseCredentialsReturn, UseLocalModelOptions, UseLocalModelReturn, UseSpeechToTextOptions, UseSpeechToTextReturn, UseVirtualFilesReturn, UseWebLLMModelOptions, UseWebLLMModelReturn, UserNoteView, WebLLMModelFactory };
2048
+ export { AgentChat, AgentComposer, AgentLabelsProvider, AgentProvider, ApiKeyForm, ApprovalModeSwitch, AttachmentView, ChatHistoryList, ChatHistoryStore, Composer, ContextMeter, FilesPanel, GeneratedMedia, LearnedSkills, MessageList, ModelLoadBar, PlanView, StepList, SubagentRow, SubagentTree, ToolApprovalPrompt, ToolCallRow, TranscriptBlock, UsageBadge, UserNoteRow, agentStateReducer, attachmentKindOf, attachmentRefusal, chatTitle, createInitialAgentState, createWebLLMEngine, decisionNote, defaultLabels, downscaleImage, filterCommands, formatElapsed, lessonsOf, mediaFamilyOf, mergeLabels, newChatId, noticesOf, parseSlash, steerIntent, subagentTree, usageLine, useAgent, useAgentContext, useChatHistory, useCredentials, useLabels, useLocalModel, useOptionalAgentContext, useSpeechToText, useVirtualFiles, useWebLLMModel, webSearchOf, withAttachments };
2049
+ export type { AgentAction, AgentChatClassNames, AgentChatComponents, AgentChatProps, AgentChatSlots, AgentComposerProps, AgentLabels, AgentLabelsOverride, AgentLabelsProviderProps, AgentProviderProps, AgentStatus, AgentUiState, ApiKeyFormProps, ApprovalModeSwitchProps, ApprovalView, ApproveOptions, BudgetView, ChatAttachment, ChatHistoryListProps, ChatHistoryStoreOptions, ChatMessage, ChatRecord, ChatSummary, CompactionView, ComposerAttachment, ComposerModelChip, ComposerNotice, ComposerProps, ComposerThinkingChip, ContextMeterProps, ConvertedFile, DecisionView, DownscaleOptions, FetchView, FilesPanelProps, GeneratedMediaProps, LearnedSkillsProps, LessonView, LocalModelEngine, LocalModelLoadContext, LocalModelProgress, MediaView, MessageListProps, ModelLoadBarProps, ModelLoadState, NoticeTexts, PlanViewProps, QueuedMessageView, RenderSubagent, RenderToolCall, ReplanState, RunGoalOptions, SlashCommand, SpeechRecognizerLike, SteerIntent, StepEscalationView, StepListProps, StepView, SubagentNode, SubagentRowProps, SubagentTreeProps, SubagentView, ToolApprovalPromptProps, ToolCallRowProps, ToolCallView, TranscriptBlockProps, TranscriptView, UsageBadgeProps, UseAgentOptions, UseAgentReturn, UseChatHistoryOptions, UseChatHistoryReturn, UseCredentialsReturn, UseLocalModelOptions, UseLocalModelReturn, UseSpeechToTextOptions, UseSpeechToTextReturn, UseVirtualFilesReturn, UseWebLLMModelOptions, UseWebLLMModelReturn, UserNoteView, WebLLMModelFactory, WebSearchResultView, WebSearchView };