@dudko.dev/agent-web-react 0.0.18 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
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, AgentToolSet, createWebLLMModel, WebLLMModelOptions } from '@dudko.dev/agent-web';
4
- export { Agent, AgentEvent, AgentEventHandler, AgentLoggerSink, AgentTool, AgentToolSet, AttachmentsNotSupportedError, BrowserAgentConfig, CompactResult, CompactionConfig, CredentialStore, FileToolsOptions, IPlan, IPlanStep, IStepResult, IToolCall, IUsage, ImagesNotSupportedError, IndexedDBStore, LogLevel, MemoryCredentialStore, MemoryStore, ModelInput, ProviderModelSpec, ProviderType, RunFile, RunOptions, RunResult, Skill, SubagentToolOptions, SubagentWorkerConfig, ThinkingLevel, ThinkingSetting, TokenLimits, ToolApprovalConfig, ToolApprovalMode, ToolApprovalRequest, VaultCredentialStore, VirtualFile, VirtualFileInfo, VirtualFileSystem, createAgent, createFileTools, createSubagentTool, createWebLLMModel, defineSkill, defineTool, isWebGPUAvailable, loadSkillFromUrl, markReadOnly, parseSkillMarkdown, preloadWebLLMModel, serveSubagentWorker, supportsImages, supportsPdf, unloadWebLLMModel } from '@dudko.dev/agent-web';
3
+ import { IPlan, IPlanStep, IUsage, ReplanMode, AgentEvent, RunFile, RunResult, Agent, ToolApprovalMode, CompactResult, AgentEventHandler, BrowserAgentConfig, VirtualFileInfo, VirtualFileSystem, CredentialStore, createWebLLMModel, WebLLMModelOptions } from '@dudko.dev/agent-web';
4
+ export { Agent, AgentEvent, AgentEventHandler, AgentLoggerSink, AgentTool, AgentToolSet, AttachmentsNotSupportedError, BrowserAgentConfig, CompactResult, CompactionConfig, CredentialStore, FileToolsOptions, IPlan, IPlanStep, IStepResult, IToolCall, IUsage, ImagesNotSupportedError, IndexedDBStore, LogLevel, MemoryCredentialStore, MemoryStore, ModelInput, ProviderModelSpec, ProviderType, RunControl, RunFile, RunOptions, RunResult, Skill, SubagentInfo, SubagentToolOptions, SubagentWorkerConfig, ThinkingLevel, ThinkingSetting, TokenLimits, ToolApprovalConfig, ToolApprovalMode, ToolApprovalRequest, VaultCredentialStore, 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). */
7
7
  interface BudgetView {
@@ -44,6 +44,8 @@ interface ChatMessage {
44
44
  approvals?: ApprovalView[];
45
45
  /** Assistant turn: subagent delegations of the run. */
46
46
  subagents?: SubagentView[];
47
+ /** Assistant turn: what the user said while the run was going, and where it reached the agent. */
48
+ notes?: UserNoteView[];
47
49
  /** Assistant turn: the synthesizer's thoughts. */
48
50
  reasoning?: string;
49
51
  /** Assistant turn: tokens the run spent, by kind. */
@@ -84,12 +86,33 @@ interface ApprovalView {
84
86
  /** Decided by policy (rule / read-only mode), not by a person. */
85
87
  automatic?: boolean;
86
88
  }
89
+ /** A message sent to the agent while it works, still waiting for a boundary to be shown to the model. */
90
+ interface QueuedMessageView {
91
+ id: string;
92
+ text: string;
93
+ }
94
+ /**
95
+ * A message the user sent while the run was going, after it reached the agent.
96
+ * `at` says where: `round` = between tool calls inside a step, `step` = at the end
97
+ * of a step (the replanner then re-checked the plan), `final` = just before the
98
+ * answer was written.
99
+ */
100
+ interface UserNoteView {
101
+ id: string;
102
+ text: string;
103
+ at: 'round' | 'step' | 'final';
104
+ /** The step it was delivered in (`round`) or after (`step`); none for `final`. */
105
+ stepId?: string;
106
+ }
87
107
  /** A delegated task running in a subagent (in-process or a Web Worker). */
88
108
  interface SubagentView {
89
109
  id: string;
90
110
  name: string;
91
111
  task: string;
92
- status: 'running' | 'done' | 'error';
112
+ /** `stopped`: the user stopped this subagent; the run went on without it. */
113
+ status: 'running' | 'done' | 'error' | 'stopped';
114
+ /** The profile the parent model chose for this delegation, when there are profiles. */
115
+ profile?: string;
93
116
  /** The step that delegated it, when known. */
94
117
  stepId?: string;
95
118
  /** What the child is doing right now ("step 2: …", "→ tool"). */
@@ -132,6 +155,8 @@ interface ModelLoadState {
132
155
  interface ReplanState {
133
156
  mode: ReplanMode;
134
157
  reason: string;
158
+ /** The replanner ran because the user sent a message, not because a step failed. */
159
+ byUser?: boolean;
135
160
  }
136
161
  /**
137
162
  * The whole UI-facing view of an agent run, rebuilt purely from the stream of
@@ -157,6 +182,16 @@ interface AgentUiState {
157
182
  approvals: ApprovalView[];
158
183
  /** Subagent delegations of this run. */
159
184
  subagents: SubagentView[];
185
+ /** Messages sent while the run goes that have not yet been shown to the model. */
186
+ queued: QueuedMessageView[];
187
+ /** What the user said during this run and when it reached the agent. */
188
+ notes: UserNoteView[];
189
+ /**
190
+ * Messages the run ended without showing the model (sent while the answer was being
191
+ * written, or still queued when the run was stopped). The hook sends them as a
192
+ * follow-up unless the run was stopped; see `useAgent`'s `followUp`.
193
+ */
194
+ undelivered: string[];
160
195
  /** Skills activated in this run. */
161
196
  skills: string[];
162
197
  /** Tools activated by find_tools in this run. */
@@ -212,6 +247,13 @@ interface UseAgentOptions {
212
247
  * (default true). Render them with `<ToolApprovalPrompt>`, or your own UI.
213
248
  */
214
249
  approvals?: boolean;
250
+ /**
251
+ * What the run never showed the agent — a message sent while the answer was being
252
+ * written — is sent as the next message, once the run has ended (default true).
253
+ * A run the user stopped never does this: those messages stay in `undelivered`
254
+ * for the UI to offer (`sendUndelivered` / `discardUndelivered`).
255
+ */
256
+ followUp?: boolean;
215
257
  }
216
258
  interface ApproveOptions {
217
259
  /** Also allow this tool for the rest of the agent's life ("always allow"). */
@@ -235,6 +277,19 @@ interface UseAgentReturn extends AgentUiState {
235
277
  run: (goal: string, options?: RunGoalOptions) => Promise<RunResult | undefined>;
236
278
  /** Abort the in-flight run (observed between phases and mid-stream). */
237
279
  stop: () => void;
280
+ /**
281
+ * Say something to the agent while it works. It is shown to the model at the next
282
+ * boundary (between tool calls, or when the step ends — where the replanner then
283
+ * re-checks the plan), never cutting a tool call short. `false` when no run is in
284
+ * flight or the text is empty — then use `run`. Watch `queued` / `notes`.
285
+ */
286
+ send: (text: string) => boolean;
287
+ /** Stop ONE running subagent (`SubagentView.id`); the run and its siblings go on. */
288
+ stopSubagent: (id: string) => boolean;
289
+ /** Send the `undelivered` messages (a stopped run's leftovers) as a new message. */
290
+ sendUndelivered: () => void;
291
+ /** Drop the `undelivered` messages. */
292
+ discardUndelivered: () => void;
238
293
  /** Clear the whole conversation — transcript, current run, and the agent's memory. */
239
294
  reset: () => void;
240
295
  /** Rebuild the agent now (e.g. after the user stores a new API key). */
@@ -465,267 +520,6 @@ interface UseCredentialsReturn {
465
520
  */
466
521
  declare const useCredentials: (store?: CredentialStore) => UseCredentialsReturn;
467
522
 
468
- /**
469
- * Structural types for the core's OPTIONAL `@dudko.dev/agent-web/mcp` subpath.
470
- *
471
- * The subpath is loaded with a dynamic import and typed here rather than
472
- * imported, for two reasons: it drags in `@modelcontextprotocol/sdk` (an
473
- * optional peer of the core, which apps without MCP must not have to install),
474
- * and the OAuth half only exists in newer cores while this package supports
475
- * `@dudko.dev/agent-web >= 0.0.6`. `useMcp` feature-detects at runtime and
476
- * reports `oauthSupported: false` on an older core instead of crashing.
477
- */
478
- interface McpCatalogEntry {
479
- name: string;
480
- description: string;
481
- server: string;
482
- /** The server marked the tool read-only (newer cores). */
483
- readOnly?: boolean;
484
- }
485
- interface McpServerResult {
486
- name: string;
487
- connected: boolean;
488
- error?: string;
489
- needsAuthorization?: boolean;
490
- }
491
- interface ConnectedMcp {
492
- tools: AgentToolSet;
493
- catalog: McpCatalogEntry[];
494
- results: McpServerResult[];
495
- refreshServer?: (name: string) => Promise<void>;
496
- close: () => Promise<void>;
497
- }
498
- interface McpHttpServerConfig {
499
- url: string;
500
- headers?: Record<string, string>;
501
- authProvider?: unknown;
502
- /** Per-server connect deadline (newer cores; ignored by older ones). */
503
- connectTimeoutMs?: number;
504
- }
505
- interface McpOAuthCallback {
506
- code?: string;
507
- state?: string;
508
- error?: string;
509
- errorDescription?: string;
510
- }
511
- interface BrowserOAuthProvider {
512
- serverUrl: string;
513
- authorizationUrl?: URL;
514
- isAuthorized(): Promise<boolean>;
515
- reset(): Promise<void>;
516
- }
517
- interface BrowserOAuthProviderOptions {
518
- serverUrl: string;
519
- redirectUrl: string;
520
- clientName?: string;
521
- scope?: string;
522
- }
523
- /** The shape of the subpath module, as far as this package uses it. */
524
- interface McpModule {
525
- connectMcpHttp: (servers: Record<string, McpHttpServerConfig>, opts?: {
526
- clientName?: string;
527
- onLog?: (level: string, message: string) => void;
528
- connectTimeoutMs?: number;
529
- }) => Promise<ConnectedMcp>;
530
- BrowserOAuthProvider?: new (opts: BrowserOAuthProviderOptions) => BrowserOAuthProvider;
531
- readOAuthCallback?: (input?: string | URL) => McpOAuthCallback | undefined;
532
- finishMcpOAuth?: (provider: BrowserOAuthProvider, callback: McpOAuthCallback) => Promise<void>;
533
- /**
534
- * The SDK's error class, re-exported by the core so an authorization failure
535
- * can be recognised by identity. Absent on cores older than 0.0.12.
536
- */
537
- UnauthorizedError?: new (message?: string) => Error;
538
- }
539
-
540
- type McpStatus = 'idle' | 'connecting' | 'connected' | 'needs-authorization' | 'error';
541
- interface McpConnectOptions {
542
- /** The server's StreamableHTTP endpoint. */
543
- url: string;
544
- /** Prefix for the discovered tool names ("<name>__<tool>"). Default 'mcp'. */
545
- name?: string;
546
- /** Static headers, e.g. `{ Authorization: 'Bearer …' }`. Ignored when `oauth` is set. */
547
- headers?: Record<string, string>;
548
- /**
549
- * Authenticate with OAuth 2.1 + dynamic client registration. Requires a core
550
- * that ships the OAuth provider; check `oauthSupported` before offering it.
551
- */
552
- oauth?: boolean | {
553
- redirectUrl?: string;
554
- scope?: string;
555
- clientName?: string;
556
- };
557
- }
558
- interface UseMcpOptions {
559
- /** Client name reported to the MCP server during initialize. */
560
- clientName?: string;
561
- /** Called with connector log lines — handy while debugging a server. */
562
- onLog?: (level: string, message: string) => void;
563
- }
564
- interface UseMcpReturn {
565
- status: McpStatus;
566
- /** Merge into `BrowserAgentConfig.tools` once `status === 'connected'`. */
567
- tools?: AgentToolSet;
568
- catalog: McpCatalogEntry[];
569
- error?: string;
570
- /** Where to send the user when `status === 'needs-authorization'`. */
571
- authorizationUrl?: string;
572
- /**
573
- * Whether the installed core exposes the OAuth API. `undefined` until the
574
- * optional subpath has been loaded once — call `checkOAuthSupport()` to
575
- * resolve it before offering OAuth in your UI.
576
- */
577
- oauthSupported?: boolean;
578
- /** True while an OAuth redirect is being finished on mount. */
579
- completingAuthorization: boolean;
580
- connect: (options: McpConnectOptions) => Promise<void>;
581
- disconnect: () => Promise<void>;
582
- /** Navigate to the authorization server. Call it from a user gesture. */
583
- authorize: () => void;
584
- /** Drop the stored tokens and dynamic registration for the current server. */
585
- forgetAuthorization: () => Promise<void>;
586
- /** Load the optional subpath and report whether it can do OAuth. */
587
- checkOAuthSupport: () => Promise<boolean>;
588
- }
589
- /** Map a single server's connect outcome onto the hook's status. Pure. */
590
- declare const describeMcpResult: (result: McpServerResult | undefined) => {
591
- status: McpStatus;
592
- error?: string;
593
- };
594
- /**
595
- * Read the authorization-code parameters out of a URL **synchronously**.
596
- *
597
- * The core exports an equivalent, but it lives behind a dynamic import: by the
598
- * time that import resolves, React has flushed the rest of the app's effects,
599
- * and any one of them may have rewritten `location` (the demo's own view
600
- * router did exactly that). The callback has to be captured before the first
601
- * await, so this parser is duplicated here on purpose.
602
- *
603
- * Reads the query string and, for hash-routed apps, the fragment. Returns
604
- * undefined when neither a `code` nor an `error` is present.
605
- */
606
- declare const readCallbackParams: (href?: string) => McpOAuthCallback | undefined;
607
- /**
608
- * Remove the OAuth response parameters from a URL, leaving the rest intact —
609
- * query string and fragment alike. The code is single-use and lands in history,
610
- * referrers and screenshots, so it goes as soon as it has been read.
611
- */
612
- declare const stripOAuthParams: (href: string) => string;
613
- declare const claimOAuthCallback: (callback: McpOAuthCallback) => boolean;
614
- /**
615
- * Did this error come from the server refusing our authorization?
616
- *
617
- * Identity, not strings: the SDK's `UnauthorizedError` never assigns
618
- * `this.name` (so it reads as "Error"), and its message would also match a
619
- * tool whose own error text mentions "unauthorized" — the connector throws a
620
- * failing tool's text verbatim. The class is re-exported by the core's `./mcp`
621
- * subpath for exactly this; `constructor.name` is the fallback for a core too
622
- * old to export it.
623
- */
624
- declare const isUnauthorizedError: (err: unknown, mod?: McpModule) => boolean;
625
- /**
626
- * Connect the browser agent to a remote MCP server the user names at runtime —
627
- * static header, or full OAuth 2.1 with dynamic client registration.
628
- *
629
- * The OAuth round-trip leaves the page, so the hook persists what it needs to
630
- * resume: on mount it detects `?code=…`, finishes the exchange, cleans the URL
631
- * and reconnects, all before the app renders anything MCP-related.
632
- *
633
- * ```tsx
634
- * const mcp = useMcp()
635
- * // await mcp.connect({ url, oauth: true })
636
- * // mcp.status === 'needs-authorization' && <button onClick={mcp.authorize}>Authorize</button>
637
- * // <AgentProvider config={{ model, tools: { ...local, ...mcp.tools } }}>
638
- * ```
639
- */
640
- declare const useMcp: (options?: UseMcpOptions) => UseMcpReturn;
641
-
642
- type McpAuthMode = 'none' | 'bearer' | 'oauth';
643
- /** One server the user wants connected. */
644
- interface McpServerSpec {
645
- /**
646
- * Unique name; also the tool prefix ("<name>__<tool>"). Sanitised to
647
- * `[a-zA-Z0-9_-]`; a taken name gets a numeric suffix.
648
- */
649
- name: string;
650
- /** The server's StreamableHTTP endpoint. */
651
- url: string;
652
- auth?: McpAuthMode;
653
- /** Bearer token for `auth: 'bearer'` — kept in memory only, never persisted. */
654
- token?: string;
655
- /** OAuth details for `auth: 'oauth'`. */
656
- oauth?: {
657
- redirectUrl?: string;
658
- scope?: string;
659
- clientName?: string;
660
- };
661
- }
662
- /** A server's live state. */
663
- interface McpServerView {
664
- name: string;
665
- url: string;
666
- auth: McpAuthMode;
667
- status: McpStatus;
668
- error?: string;
669
- /** Where to send the user when `status === 'needs-authorization'`. */
670
- authorizationUrl?: string;
671
- catalog: McpCatalogEntry[];
672
- }
673
- interface UseMcpServersOptions extends UseMcpOptions {
674
- /**
675
- * Remember the server list (never tokens) in localStorage so it survives a
676
- * reload — and the OAuth redirect, which IS a reload (default true).
677
- */
678
- persist?: boolean;
679
- /** localStorage key of the list (default 'agent-web-react:mcp-servers'). */
680
- storageKey?: string;
681
- /** Reconnect remembered servers on mount (default true). Bearer servers wait for their token. */
682
- autoConnect?: boolean;
683
- /** Per-server connect deadline in ms (default: the core's, 30 s). */
684
- connectTimeoutMs?: number;
685
- }
686
- interface UseMcpServersReturn {
687
- servers: McpServerView[];
688
- /** Tools of every connected server, merged — pass to `BrowserAgentConfig.tools`. */
689
- tools: AgentToolSet;
690
- /** Catalogue of every connected server, merged. */
691
- catalog: McpCatalogEntry[];
692
- connectedCount: number;
693
- /** True while an OAuth redirect is being finished on mount. */
694
- completingAuthorization: boolean;
695
- /** Whether the installed core can do OAuth (undefined until checked). */
696
- oauthSupported?: boolean;
697
- checkOAuthSupport: () => Promise<boolean>;
698
- /** Add (or replace, by name) a server and connect it. Resolves with the final name. */
699
- add: (spec: McpServerSpec) => Promise<string>;
700
- /** Disconnect and forget a server. */
701
- remove: (name: string) => Promise<void>;
702
- /** Connect again — optionally with a fresh bearer token. */
703
- reconnect: (name: string, token?: string) => Promise<void>;
704
- /** Navigate to the server's authorization page. Call it from a user gesture. */
705
- authorize: (name: string) => void;
706
- /** Drop a server's stored OAuth tokens and registration. */
707
- forgetAuthorization: (name: string) => Promise<void>;
708
- }
709
- /**
710
- * Connect the browser agent to SEVERAL remote MCP servers at once, each with
711
- * its own auth (none, a bearer token, or OAuth 2.1 + dynamic registration).
712
- * Every server is its own connection — adding or removing one never touches
713
- * the others — and their tools merge into one `tools` set, prefixed by server
714
- * name. The list is remembered across reloads (tokens excepted), and an OAuth
715
- * round-trip resumes on return.
716
- *
717
- * ```tsx
718
- * const mcp = useMcpServers()
719
- * // await mcp.add({ name: 'github', url, auth: 'oauth' })
720
- * // await mcp.add({ name: 'docs', url, auth: 'bearer', token })
721
- * const agent = useAgent({ model, tools: { ...local, ...mcp.tools } }, { deps: [mcp.tools] })
722
- * ```
723
- *
724
- * With many servers the merged catalogue can reach hundreds of tools; the core
725
- * switches to tool search above `toolSearchThreshold` automatically.
726
- */
727
- declare const useMcpServers: (options?: UseMcpServersOptions) => UseMcpServersReturn;
728
-
729
523
  /** An AI SDK `LanguageModel` (the type, via the core — no `ai` import here). */
730
524
  type LanguageModel = Awaited<ReturnType<typeof createWebLLMModel>>;
731
525
  /** Download / initialisation progress of a local model. */
@@ -921,6 +715,28 @@ declare const parseSlash: (text: string) => {
921
715
  name: string;
922
716
  args: string;
923
717
  } | undefined;
718
+ /** What pressing Enter does while the agent is working (see {@link steerIntent}). */
719
+ type SteerIntent =
720
+ /** The agent is idle: submit as usual. */
721
+ 'idle'
722
+ /** Say it to the running agent. */
723
+ | 'steer'
724
+ /** There are attachments, which cannot be added to a run that is going. */
725
+ | 'attachments'
726
+ /** Nothing to do (empty, a slash command, or steering is switched off). */
727
+ | 'ignore';
728
+ /**
729
+ * Decide what Enter means while the agent works: text goes to the running agent,
730
+ * files cannot (they are sent with the next message), a "/command" is not a message,
731
+ * and a host that switched steering off gets the old behaviour (nothing happens).
732
+ */
733
+ declare const steerIntent: (input: {
734
+ /** The trimmed text. */
735
+ raw: string;
736
+ busy: boolean;
737
+ steering: boolean;
738
+ hasAttachments: boolean;
739
+ }) => SteerIntent;
924
740
  /** Commands matching what was typed after "/" — name prefix first, then substring. */
925
741
  declare const filterCommands: (commands: SlashCommand[], query: string) => SlashCommand[];
926
742
  /**
@@ -1083,6 +899,22 @@ interface AgentLabels {
1083
899
  consentWaiting: string;
1084
900
  consentAllowed: string;
1085
901
  consentDenied: (reason?: string) => string;
902
+ /** Composer placeholder while the agent works (what you type is sent to it). */
903
+ placeholderBusy: string;
904
+ /** The send button while the agent works. */
905
+ steer: string;
906
+ /** Shown when files are attached while the agent works (they can't be added then). */
907
+ noAttachmentsWhileBusy: string;
908
+ /** A message waiting to reach the agent. */
909
+ queuedWaiting: string;
910
+ /** Where a note landed: between tool calls / after a step / before the answer. */
911
+ noteAt: Record<'round' | 'step' | 'final', string>;
912
+ /** Messages the run ended without delivering, offered for sending. */
913
+ undelivered: (n: number) => string;
914
+ sendUndelivered: string;
915
+ discardUndelivered: string;
916
+ stopSubagent: string;
917
+ subagentStopped: string;
1086
918
  failed: string;
1087
919
  toolCostTitle: string;
1088
920
  }
@@ -1180,6 +1012,15 @@ type AgentAction =
1180
1012
  type: 'load';
1181
1013
  messages: ChatMessage[];
1182
1014
  totalUsage?: IUsage;
1015
+ }
1016
+ /**
1017
+ * The run is over and these messages never reached the model (`RunResult.undelivered`,
1018
+ * or what was still queued when it was stopped). Clears the queue. An empty list
1019
+ * clears `undelivered` too (the follow-up was sent, or the user discarded them).
1020
+ */
1021
+ | {
1022
+ type: 'undelivered';
1023
+ texts: string[];
1183
1024
  };
1184
1025
  /** A fresh, empty view. */
1185
1026
  declare const createInitialAgentState: () => AgentUiState;
@@ -1275,6 +1116,14 @@ interface AgentComposerProps {
1275
1116
  showApprovalMode?: boolean;
1276
1117
  /** Banners for limits, compaction and errors above the input (default true). */
1277
1118
  showNotices?: boolean;
1119
+ /**
1120
+ * Let the user type to the agent while it works (default true): Enter sends the text
1121
+ * to the running agent, which sees it at its next boundary (see `useAgent().send`).
1122
+ * Off: the input does nothing while a run is going, as before.
1123
+ */
1124
+ steering?: boolean;
1125
+ /** Messages waiting for the agent, and the ones a stopped run left undelivered (default true). */
1126
+ showQueued?: boolean;
1278
1127
  /** Below this width (px) the toolbar chips show icons and numbers only (default 460). */
1279
1128
  compactWidth?: number;
1280
1129
  /** Extra content in the toolbar, after the "/" button. */
@@ -1302,7 +1151,7 @@ interface AgentComposerProps {
1302
1151
  *
1303
1152
  * Every piece can be switched off; `<AgentChat>` uses it as its footer.
1304
1153
  */
1305
- declare const AgentComposer: ({ controller: agent, placeholder, model, thinking, labels: labelsOverride, commands, builtinCommands, skillCommands, attachments, convertFile, convert, files: vfs, dropZone, speech, showTimer, showAgents, showApprovalMode, showNotices, compactWidth, toolbarExtra, toolbarEnd, renderAttachment, disabled, className, }: AgentComposerProps) => react.JSX.Element;
1154
+ 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;
1306
1155
 
1307
1156
  interface ChatHistoryListProps {
1308
1157
  /** From `useChatHistory(agent)`. */
@@ -1355,9 +1204,19 @@ interface ToolCallRowProps {
1355
1204
  }
1356
1205
  /** One tool call: name, arguments, status — and optionally its cost and any images it returned. */
1357
1206
  declare const ToolCallRow: ({ call, showUsage, labels }: ToolCallRowProps) => react.JSX.Element;
1358
- /** A subagent delegation: name, task, live activity, and its answer when done. */
1359
- declare const SubagentRow: ({ sub, labels, }: {
1207
+ /**
1208
+ * A subagent delegation: name, task, live activity, and its answer when done. With
1209
+ * `onStop`, a running one gets a stop button (the run and its siblings go on).
1210
+ */
1211
+ declare const SubagentRow: ({ sub, onStop, labels, }: {
1360
1212
  sub: SubagentView;
1213
+ /** Stop this subagent (`useAgent().stopSubagent`); the button shows while it runs. */
1214
+ onStop?: (id: string) => void;
1215
+ labels?: AgentLabelsOverride;
1216
+ }) => react.JSX.Element;
1217
+ /** What the user said while the run was going, and where it reached the agent. */
1218
+ declare const UserNoteRow: ({ note, labels, }: {
1219
+ note: UserNoteView;
1361
1220
  labels?: AgentLabelsOverride;
1362
1221
  }) => react.JSX.Element;
1363
1222
  interface StepListProps {
@@ -1366,6 +1225,12 @@ interface StepListProps {
1366
1225
  subagents?: SubagentView[];
1367
1226
  /** Consent decisions (`agent.approvals`) — shown under their step. */
1368
1227
  approvals?: ApprovalView[];
1228
+ /** What the user said mid-run (`agent.notes`) — shown under the step it reached. */
1229
+ notes?: UserNoteView[];
1230
+ /** Show those notes (default true). */
1231
+ showNotes?: boolean;
1232
+ /** Give a running subagent a stop button (`agent.stopSubagent`). */
1233
+ onStopSubagent?: (id: string) => void;
1369
1234
  /** Show each tool call (default true). */
1370
1235
  showToolCalls?: boolean;
1371
1236
  /** Show each tool call's ≈tokens and duration (default true). */
@@ -1381,7 +1246,7 @@ interface StepListProps {
1381
1246
  * The live execution: each step, its thoughts, streamed text, tool calls,
1382
1247
  * consent decisions and subagent delegations.
1383
1248
  */
1384
- declare const StepList: ({ steps, subagents, approvals, showToolCalls, showUsage, showThoughts, renderToolCall, labels, className, }: StepListProps) => react.JSX.Element | null;
1249
+ declare const StepList: ({ steps, subagents, approvals, notes, showNotes, onStopSubagent, showToolCalls, showUsage, showThoughts, renderToolCall, labels, className, }: StepListProps) => react.JSX.Element | null;
1385
1250
 
1386
1251
  interface MessageListProps {
1387
1252
  messages: ChatMessage[];
@@ -1395,6 +1260,10 @@ interface MessageListProps {
1395
1260
  showUsage?: boolean;
1396
1261
  /** Thoughts (step + answer) when the model thinks (default true). */
1397
1262
  showThoughts?: boolean;
1263
+ /** What the user said while the agent worked, under the step it reached (default true). */
1264
+ showNotes?: boolean;
1265
+ /** Give a running subagent a stop button (`useAgent().stopSubagent`). */
1266
+ onStopSubagent?: (id: string) => void;
1398
1267
  /** Open the activity of finished answers too (default: only while it runs). */
1399
1268
  activityOpen?: boolean;
1400
1269
  /** Extra content under the latest assistant turn while it streams (plan thought, …). */
@@ -1426,7 +1295,7 @@ declare const AttachmentView: ({ attachment: a }: {
1426
1295
  * subagents, consent decisions — and the tokens it spent by kind. Every part
1427
1296
  * can be hidden, relabelled or rendered by the host.
1428
1297
  */
1429
- declare const MessageList: ({ messages, empty, showActivity, showToolCalls, showUsage, showThoughts, activityOpen, liveExtra, renderContent, renderMessage, renderAttachment, renderToolCall, labels, className, }: MessageListProps) => react.JSX.Element | null;
1298
+ declare const MessageList: ({ messages, empty, showActivity, showToolCalls, showUsage, showThoughts, showNotes, onStopSubagent, activityOpen, liveExtra, renderContent, renderMessage, renderAttachment, renderToolCall, labels, className, }: MessageListProps) => react.JSX.Element | null;
1430
1299
 
1431
1300
  interface ToolApprovalPromptProps {
1432
1301
  /** Pending requests (e.g. `agent.pendingApprovals`). */
@@ -1502,6 +1371,10 @@ interface AgentChatProps {
1502
1371
  showUsage?: boolean;
1503
1372
  /** Thoughts, when the model thinks (default true). */
1504
1373
  showThoughts?: boolean;
1374
+ /** What you said while the agent worked, under the step it reached (default true). */
1375
+ showNotes?: boolean;
1376
+ /** A stop button on each running subagent (default true). */
1377
+ stoppableSubagents?: boolean;
1505
1378
  /** Conversation total in the header (default true). */
1506
1379
  showTotalUsage?: boolean;
1507
1380
  /** Status dot in the header (default true). */
@@ -1668,5 +1541,5 @@ interface ApiKeyFormProps {
1668
1541
  */
1669
1542
  declare const ApiKeyForm: ({ credentials, credentialRef, label, placeholder, onChange, className, }: ApiKeyFormProps) => react.JSX.Element;
1670
1543
 
1671
- export { AgentChat, AgentComposer, AgentLabelsProvider, AgentProvider, ApiKeyForm, ApprovalModeSwitch, AttachmentView, ChatHistoryList, ChatHistoryStore, Composer, ContextMeter, FilesPanel, MessageList, ModelLoadBar, PlanView, StepList, SubagentRow, ToolApprovalPrompt, ToolCallRow, UsageBadge, agentStateReducer, attachmentKindOf, attachmentRefusal, chatTitle, claimOAuthCallback, createInitialAgentState, createWebLLMEngine, defaultLabels, describeMcpResult, downscaleImage, filterCommands, formatElapsed, isUnauthorizedError, mergeLabels, newChatId, noticesOf, parseSlash, readCallbackParams, stripOAuthParams, usageLine, useAgent, useAgentContext, useChatHistory, useCredentials, useLabels, useLocalModel, useMcp, useMcpServers, useOptionalAgentContext, useSpeechToText, useVirtualFiles, useWebLLMModel, withAttachments };
1672
- 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, ConnectedMcp, ContextMeterProps, ConvertedFile, DownscaleOptions, FilesPanelProps, LocalModelEngine, LocalModelLoadContext, LocalModelProgress, McpAuthMode, McpCatalogEntry, McpConnectOptions, McpModule, McpOAuthCallback, McpServerResult, McpServerSpec, McpServerView, McpStatus, MessageListProps, ModelLoadBarProps, ModelLoadState, NoticeTexts, PlanViewProps, RenderToolCall, ReplanState, RunGoalOptions, SlashCommand, SpeechRecognizerLike, StepListProps, StepView, SubagentView, ToolApprovalPromptProps, ToolCallRowProps, ToolCallView, UsageBadgeProps, UseAgentOptions, UseAgentReturn, UseChatHistoryOptions, UseChatHistoryReturn, UseCredentialsReturn, UseLocalModelOptions, UseLocalModelReturn, UseMcpOptions, UseMcpReturn, UseMcpServersOptions, UseMcpServersReturn, UseSpeechToTextOptions, UseSpeechToTextReturn, UseVirtualFilesReturn, UseWebLLMModelOptions, UseWebLLMModelReturn, WebLLMModelFactory };
1544
+ export { AgentChat, AgentComposer, AgentLabelsProvider, AgentProvider, ApiKeyForm, ApprovalModeSwitch, AttachmentView, ChatHistoryList, ChatHistoryStore, Composer, ContextMeter, FilesPanel, MessageList, ModelLoadBar, PlanView, StepList, SubagentRow, ToolApprovalPrompt, ToolCallRow, UsageBadge, UserNoteRow, agentStateReducer, attachmentKindOf, attachmentRefusal, chatTitle, createInitialAgentState, createWebLLMEngine, defaultLabels, downscaleImage, filterCommands, formatElapsed, mergeLabels, newChatId, noticesOf, parseSlash, steerIntent, usageLine, useAgent, useAgentContext, useChatHistory, useCredentials, useLabels, useLocalModel, useOptionalAgentContext, useSpeechToText, useVirtualFiles, useWebLLMModel, withAttachments };
1545
+ 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, FilesPanelProps, 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 };