@dudko.dev/agent-web-react 0.0.19 → 0.0.21
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 +10 -2
- package/dist/index.cjs +396 -53
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +244 -10
- package/dist/index.d.ts +244 -10
- package/dist/index.js +394 -54
- package/dist/index.js.map +1 -1
- package/dist/styles.css +203 -0
- package/package.json +3 -3
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, 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, Skill } 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, 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). */
|
|
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. */
|
|
@@ -52,6 +54,10 @@ interface ChatMessage {
|
|
|
52
54
|
durationMs?: number;
|
|
53
55
|
/** Assistant turn: skills the run used. */
|
|
54
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[];
|
|
55
61
|
/** Assistant turn ended with an error. */
|
|
56
62
|
error?: boolean;
|
|
57
63
|
}
|
|
@@ -71,6 +77,29 @@ interface ToolCallView {
|
|
|
71
77
|
/** ≈ tokens of the result fed back to the model (chars / 4). */
|
|
72
78
|
outputTokens?: number;
|
|
73
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* A lesson in the agent's notebook (`config.learning`): a skill the agent wrote down itself.
|
|
82
|
+
* `revision` goes up each time it rewrites the lesson.
|
|
83
|
+
*/
|
|
84
|
+
interface LessonView {
|
|
85
|
+
name: string;
|
|
86
|
+
/** WHEN the lesson applies - the line the planner sees. */
|
|
87
|
+
description: string;
|
|
88
|
+
revision: number;
|
|
89
|
+
/** Size of the instructions, in characters. */
|
|
90
|
+
chars: number;
|
|
91
|
+
/** What it consulted: the sources it named, then the pages `web_fetch` read in that run. */
|
|
92
|
+
sources: string[];
|
|
93
|
+
}
|
|
94
|
+
/** One request the model made through `web_fetch` (an `egress.request` event). */
|
|
95
|
+
interface FetchView {
|
|
96
|
+
/** Origin and path only - the core never reports the query string. */
|
|
97
|
+
url: string;
|
|
98
|
+
allowed: boolean;
|
|
99
|
+
status?: number;
|
|
100
|
+
/** Why it was refused. */
|
|
101
|
+
reason?: string;
|
|
102
|
+
}
|
|
74
103
|
/** A tool call waiting for (or decided by) the user's consent. */
|
|
75
104
|
interface ApprovalView {
|
|
76
105
|
id: string;
|
|
@@ -84,12 +113,33 @@ interface ApprovalView {
|
|
|
84
113
|
/** Decided by policy (rule / read-only mode), not by a person. */
|
|
85
114
|
automatic?: boolean;
|
|
86
115
|
}
|
|
116
|
+
/** A message sent to the agent while it works, still waiting for a boundary to be shown to the model. */
|
|
117
|
+
interface QueuedMessageView {
|
|
118
|
+
id: string;
|
|
119
|
+
text: string;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* A message the user sent while the run was going, after it reached the agent.
|
|
123
|
+
* `at` says where: `round` = between tool calls inside a step, `step` = at the end
|
|
124
|
+
* of a step (the replanner then re-checked the plan), `final` = just before the
|
|
125
|
+
* answer was written.
|
|
126
|
+
*/
|
|
127
|
+
interface UserNoteView {
|
|
128
|
+
id: string;
|
|
129
|
+
text: string;
|
|
130
|
+
at: 'round' | 'step' | 'final';
|
|
131
|
+
/** The step it was delivered in (`round`) or after (`step`); none for `final`. */
|
|
132
|
+
stepId?: string;
|
|
133
|
+
}
|
|
87
134
|
/** A delegated task running in a subagent (in-process or a Web Worker). */
|
|
88
135
|
interface SubagentView {
|
|
89
136
|
id: string;
|
|
90
137
|
name: string;
|
|
91
138
|
task: string;
|
|
92
|
-
|
|
139
|
+
/** `stopped`: the user stopped this subagent; the run went on without it. */
|
|
140
|
+
status: 'running' | 'done' | 'error' | 'stopped';
|
|
141
|
+
/** The profile the parent model chose for this delegation, when there are profiles. */
|
|
142
|
+
profile?: string;
|
|
93
143
|
/** The step that delegated it, when known. */
|
|
94
144
|
stepId?: string;
|
|
95
145
|
/** What the child is doing right now ("step 2: …", "→ tool"). */
|
|
@@ -132,6 +182,8 @@ interface ModelLoadState {
|
|
|
132
182
|
interface ReplanState {
|
|
133
183
|
mode: ReplanMode;
|
|
134
184
|
reason: string;
|
|
185
|
+
/** The replanner ran because the user sent a message, not because a step failed. */
|
|
186
|
+
byUser?: boolean;
|
|
135
187
|
}
|
|
136
188
|
/**
|
|
137
189
|
* The whole UI-facing view of an agent run, rebuilt purely from the stream of
|
|
@@ -157,8 +209,28 @@ interface AgentUiState {
|
|
|
157
209
|
approvals: ApprovalView[];
|
|
158
210
|
/** Subagent delegations of this run. */
|
|
159
211
|
subagents: SubagentView[];
|
|
212
|
+
/** Messages sent while the run goes that have not yet been shown to the model. */
|
|
213
|
+
queued: QueuedMessageView[];
|
|
214
|
+
/** What the user said during this run and when it reached the agent. */
|
|
215
|
+
notes: UserNoteView[];
|
|
216
|
+
/**
|
|
217
|
+
* Messages the run ended without showing the model (sent while the answer was being
|
|
218
|
+
* written, or still queued when the run was stopped). The hook sends them as a
|
|
219
|
+
* follow-up unless the run was stopped; see `useAgent`'s `followUp`.
|
|
220
|
+
*/
|
|
221
|
+
undelivered: string[];
|
|
160
222
|
/** Skills activated in this run. */
|
|
161
223
|
skills: string[];
|
|
224
|
+
/**
|
|
225
|
+
* The agent's notebook: the lessons it wrote down (`config.learning`). It belongs to the
|
|
226
|
+
* agent, not to a conversation - it survives `reset` and a chat switch, and the hook
|
|
227
|
+
* re-reads it whenever the agent is rebuilt.
|
|
228
|
+
*/
|
|
229
|
+
learned: LessonView[];
|
|
230
|
+
/** Names of the lessons written in this run. */
|
|
231
|
+
learnedNow: string[];
|
|
232
|
+
/** What the model fetched from the web in this run (`config.egress`). */
|
|
233
|
+
fetches: FetchView[];
|
|
162
234
|
/** Tools activated by find_tools in this run. */
|
|
163
235
|
discoveredTools: string[];
|
|
164
236
|
/** Compactions in this run. */
|
|
@@ -212,6 +284,13 @@ interface UseAgentOptions {
|
|
|
212
284
|
* (default true). Render them with `<ToolApprovalPrompt>`, or your own UI.
|
|
213
285
|
*/
|
|
214
286
|
approvals?: boolean;
|
|
287
|
+
/**
|
|
288
|
+
* What the run never showed the agent — a message sent while the answer was being
|
|
289
|
+
* written — is sent as the next message, once the run has ended (default true).
|
|
290
|
+
* A run the user stopped never does this: those messages stay in `undelivered`
|
|
291
|
+
* for the UI to offer (`sendUndelivered` / `discardUndelivered`).
|
|
292
|
+
*/
|
|
293
|
+
followUp?: boolean;
|
|
215
294
|
}
|
|
216
295
|
interface ApproveOptions {
|
|
217
296
|
/** Also allow this tool for the rest of the agent's life ("always allow"). */
|
|
@@ -235,6 +314,24 @@ interface UseAgentReturn extends AgentUiState {
|
|
|
235
314
|
run: (goal: string, options?: RunGoalOptions) => Promise<RunResult | undefined>;
|
|
236
315
|
/** Abort the in-flight run (observed between phases and mid-stream). */
|
|
237
316
|
stop: () => void;
|
|
317
|
+
/**
|
|
318
|
+
* Say something to the agent while it works. It is shown to the model at the next
|
|
319
|
+
* boundary (between tool calls, or when the step ends — where the replanner then
|
|
320
|
+
* re-checks the plan), never cutting a tool call short. `false` when no run is in
|
|
321
|
+
* flight or the text is empty — then use `run`. Watch `queued` / `notes`.
|
|
322
|
+
*/
|
|
323
|
+
send: (text: string) => boolean;
|
|
324
|
+
/** Stop ONE running subagent (`SubagentView.id`); the run and its siblings go on. */
|
|
325
|
+
stopSubagent: (id: string) => boolean;
|
|
326
|
+
/**
|
|
327
|
+
* Delete one of the agent's own lessons (`learned`), e.g. one gone stale. Resolves false when
|
|
328
|
+
* there is no such lesson (or no agent yet). Needs `config.learning`.
|
|
329
|
+
*/
|
|
330
|
+
forgetSkill: (name: string) => Promise<boolean>;
|
|
331
|
+
/** Send the `undelivered` messages (a stopped run's leftovers) as a new message. */
|
|
332
|
+
sendUndelivered: () => void;
|
|
333
|
+
/** Drop the `undelivered` messages. */
|
|
334
|
+
discardUndelivered: () => void;
|
|
238
335
|
/** Clear the whole conversation — transcript, current run, and the agent's memory. */
|
|
239
336
|
reset: () => void;
|
|
240
337
|
/** Rebuild the agent now (e.g. after the user stores a new API key). */
|
|
@@ -660,6 +757,28 @@ declare const parseSlash: (text: string) => {
|
|
|
660
757
|
name: string;
|
|
661
758
|
args: string;
|
|
662
759
|
} | undefined;
|
|
760
|
+
/** What pressing Enter does while the agent is working (see {@link steerIntent}). */
|
|
761
|
+
type SteerIntent =
|
|
762
|
+
/** The agent is idle: submit as usual. */
|
|
763
|
+
'idle'
|
|
764
|
+
/** Say it to the running agent. */
|
|
765
|
+
| 'steer'
|
|
766
|
+
/** There are attachments, which cannot be added to a run that is going. */
|
|
767
|
+
| 'attachments'
|
|
768
|
+
/** Nothing to do (empty, a slash command, or steering is switched off). */
|
|
769
|
+
| 'ignore';
|
|
770
|
+
/**
|
|
771
|
+
* Decide what Enter means while the agent works: text goes to the running agent,
|
|
772
|
+
* files cannot (they are sent with the next message), a "/command" is not a message,
|
|
773
|
+
* and a host that switched steering off gets the old behaviour (nothing happens).
|
|
774
|
+
*/
|
|
775
|
+
declare const steerIntent: (input: {
|
|
776
|
+
/** The trimmed text. */
|
|
777
|
+
raw: string;
|
|
778
|
+
busy: boolean;
|
|
779
|
+
steering: boolean;
|
|
780
|
+
hasAttachments: boolean;
|
|
781
|
+
}) => SteerIntent;
|
|
663
782
|
/** Commands matching what was typed after "/" — name prefix first, then substring. */
|
|
664
783
|
declare const filterCommands: (commands: SlashCommand[], query: string) => SlashCommand[];
|
|
665
784
|
/**
|
|
@@ -742,12 +861,24 @@ interface AgentLabels {
|
|
|
742
861
|
toolCalls: (n: number) => string;
|
|
743
862
|
subagents: (n: number) => string;
|
|
744
863
|
skillsUsed: (names: string) => string;
|
|
864
|
+
/** "learned: a, b" - lessons the agent wrote down in this run. */
|
|
865
|
+
learnedNow: (names: string) => string;
|
|
866
|
+
/** "2 web requests" - what the model fetched in this run. */
|
|
867
|
+
fetches: (n: number) => string;
|
|
868
|
+
/** Why a web request was refused. */
|
|
869
|
+
fetchRefused: (reason: string) => string;
|
|
745
870
|
answerThoughts: string;
|
|
746
871
|
stepThoughts: string;
|
|
747
872
|
usageTitle: string;
|
|
748
873
|
attachments: string;
|
|
749
874
|
planned: string;
|
|
750
875
|
replanned: (mode: string, reason: string) => string;
|
|
876
|
+
notebookTitle: string;
|
|
877
|
+
notebookEmpty: string;
|
|
878
|
+
notebookForget: string;
|
|
879
|
+
notebookRevision: (n: number) => string;
|
|
880
|
+
/** Before the sources a lesson came from. */
|
|
881
|
+
notebookFrom: string;
|
|
751
882
|
placeholder: string;
|
|
752
883
|
listening: string;
|
|
753
884
|
message: string;
|
|
@@ -822,6 +953,22 @@ interface AgentLabels {
|
|
|
822
953
|
consentWaiting: string;
|
|
823
954
|
consentAllowed: string;
|
|
824
955
|
consentDenied: (reason?: string) => string;
|
|
956
|
+
/** Composer placeholder while the agent works (what you type is sent to it). */
|
|
957
|
+
placeholderBusy: string;
|
|
958
|
+
/** The send button while the agent works. */
|
|
959
|
+
steer: string;
|
|
960
|
+
/** Shown when files are attached while the agent works (they can't be added then). */
|
|
961
|
+
noAttachmentsWhileBusy: string;
|
|
962
|
+
/** A message waiting to reach the agent. */
|
|
963
|
+
queuedWaiting: string;
|
|
964
|
+
/** Where a note landed: between tool calls / after a step / before the answer. */
|
|
965
|
+
noteAt: Record<'round' | 'step' | 'final', string>;
|
|
966
|
+
/** Messages the run ended without delivering, offered for sending. */
|
|
967
|
+
undelivered: (n: number) => string;
|
|
968
|
+
sendUndelivered: string;
|
|
969
|
+
discardUndelivered: string;
|
|
970
|
+
stopSubagent: string;
|
|
971
|
+
subagentStopped: string;
|
|
825
972
|
failed: string;
|
|
826
973
|
toolCostTitle: string;
|
|
827
974
|
}
|
|
@@ -914,12 +1061,34 @@ type AgentAction =
|
|
|
914
1061
|
at?: number;
|
|
915
1062
|
attachments?: ChatAttachment[];
|
|
916
1063
|
}
|
|
1064
|
+
/**
|
|
1065
|
+
* The agent's notebook as it is now (the hook sends it when the agent is built: lessons a
|
|
1066
|
+
* persistent store brought back). Later `skill.learned` / `skill.forgotten` events keep it current.
|
|
1067
|
+
*/
|
|
1068
|
+
| {
|
|
1069
|
+
type: 'notebook';
|
|
1070
|
+
lessons: LessonView[];
|
|
1071
|
+
}
|
|
917
1072
|
/** Replace the transcript with a saved conversation (chat history). */
|
|
918
1073
|
| {
|
|
919
1074
|
type: 'load';
|
|
920
1075
|
messages: ChatMessage[];
|
|
921
1076
|
totalUsage?: IUsage;
|
|
1077
|
+
}
|
|
1078
|
+
/**
|
|
1079
|
+
* The run is over and these messages never reached the model (`RunResult.undelivered`,
|
|
1080
|
+
* or what was still queued when it was stopped). Clears the queue. An empty list
|
|
1081
|
+
* clears `undelivered` too (the follow-up was sent, or the user discarded them).
|
|
1082
|
+
*/
|
|
1083
|
+
| {
|
|
1084
|
+
type: 'undelivered';
|
|
1085
|
+
texts: string[];
|
|
922
1086
|
};
|
|
1087
|
+
/**
|
|
1088
|
+
* The notebook view of the agent's own skills (`agent.listLearnedSkills()`): what the core stored
|
|
1089
|
+
* about each lesson, in the shape the UI keeps current from `skill.learned` events.
|
|
1090
|
+
*/
|
|
1091
|
+
declare const lessonsOf: (skills: Skill[]) => LessonView[];
|
|
923
1092
|
/** A fresh, empty view. */
|
|
924
1093
|
declare const createInitialAgentState: () => AgentUiState;
|
|
925
1094
|
declare const agentStateReducer: (state: AgentUiState, action: AgentAction) => AgentUiState;
|
|
@@ -1014,6 +1183,14 @@ interface AgentComposerProps {
|
|
|
1014
1183
|
showApprovalMode?: boolean;
|
|
1015
1184
|
/** Banners for limits, compaction and errors above the input (default true). */
|
|
1016
1185
|
showNotices?: boolean;
|
|
1186
|
+
/**
|
|
1187
|
+
* Let the user type to the agent while it works (default true): Enter sends the text
|
|
1188
|
+
* to the running agent, which sees it at its next boundary (see `useAgent().send`).
|
|
1189
|
+
* Off: the input does nothing while a run is going, as before.
|
|
1190
|
+
*/
|
|
1191
|
+
steering?: boolean;
|
|
1192
|
+
/** Messages waiting for the agent, and the ones a stopped run left undelivered (default true). */
|
|
1193
|
+
showQueued?: boolean;
|
|
1017
1194
|
/** Below this width (px) the toolbar chips show icons and numbers only (default 460). */
|
|
1018
1195
|
compactWidth?: number;
|
|
1019
1196
|
/** Extra content in the toolbar, after the "/" button. */
|
|
@@ -1041,7 +1218,7 @@ interface AgentComposerProps {
|
|
|
1041
1218
|
*
|
|
1042
1219
|
* Every piece can be switched off; `<AgentChat>` uses it as its footer.
|
|
1043
1220
|
*/
|
|
1044
|
-
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;
|
|
1221
|
+
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;
|
|
1045
1222
|
|
|
1046
1223
|
interface ChatHistoryListProps {
|
|
1047
1224
|
/** From `useChatHistory(agent)`. */
|
|
@@ -1094,9 +1271,19 @@ interface ToolCallRowProps {
|
|
|
1094
1271
|
}
|
|
1095
1272
|
/** One tool call: name, arguments, status — and optionally its cost and any images it returned. */
|
|
1096
1273
|
declare const ToolCallRow: ({ call, showUsage, labels }: ToolCallRowProps) => react.JSX.Element;
|
|
1097
|
-
/**
|
|
1098
|
-
|
|
1274
|
+
/**
|
|
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).
|
|
1277
|
+
*/
|
|
1278
|
+
declare const SubagentRow: ({ sub, onStop, labels, }: {
|
|
1099
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;
|
|
1284
|
+
/** What the user said while the run was going, and where it reached the agent. */
|
|
1285
|
+
declare const UserNoteRow: ({ note, labels, }: {
|
|
1286
|
+
note: UserNoteView;
|
|
1100
1287
|
labels?: AgentLabelsOverride;
|
|
1101
1288
|
}) => react.JSX.Element;
|
|
1102
1289
|
interface StepListProps {
|
|
@@ -1105,6 +1292,12 @@ interface StepListProps {
|
|
|
1105
1292
|
subagents?: SubagentView[];
|
|
1106
1293
|
/** Consent decisions (`agent.approvals`) — shown under their step. */
|
|
1107
1294
|
approvals?: ApprovalView[];
|
|
1295
|
+
/** What the user said mid-run (`agent.notes`) — shown under the step it reached. */
|
|
1296
|
+
notes?: UserNoteView[];
|
|
1297
|
+
/** Show those notes (default true). */
|
|
1298
|
+
showNotes?: boolean;
|
|
1299
|
+
/** Give a running subagent a stop button (`agent.stopSubagent`). */
|
|
1300
|
+
onStopSubagent?: (id: string) => void;
|
|
1108
1301
|
/** Show each tool call (default true). */
|
|
1109
1302
|
showToolCalls?: boolean;
|
|
1110
1303
|
/** Show each tool call's ≈tokens and duration (default true). */
|
|
@@ -1120,7 +1313,7 @@ interface StepListProps {
|
|
|
1120
1313
|
* The live execution: each step, its thoughts, streamed text, tool calls,
|
|
1121
1314
|
* consent decisions and subagent delegations.
|
|
1122
1315
|
*/
|
|
1123
|
-
declare const StepList: ({ steps, subagents, approvals, showToolCalls, showUsage, showThoughts, renderToolCall, labels, className, }: StepListProps) => react.JSX.Element | null;
|
|
1316
|
+
declare const StepList: ({ steps, subagents, approvals, notes, showNotes, onStopSubagent, showToolCalls, showUsage, showThoughts, renderToolCall, labels, className, }: StepListProps) => react.JSX.Element | null;
|
|
1124
1317
|
|
|
1125
1318
|
interface MessageListProps {
|
|
1126
1319
|
messages: ChatMessage[];
|
|
@@ -1134,6 +1327,12 @@ interface MessageListProps {
|
|
|
1134
1327
|
showUsage?: boolean;
|
|
1135
1328
|
/** Thoughts (step + answer) when the model thinks (default true). */
|
|
1136
1329
|
showThoughts?: boolean;
|
|
1330
|
+
/** What the user said while the agent worked, under the step it reached (default true). */
|
|
1331
|
+
showNotes?: boolean;
|
|
1332
|
+
/** The lessons the agent wrote down during the answer, and the pages it fetched (default true). */
|
|
1333
|
+
showLearned?: boolean;
|
|
1334
|
+
/** Give a running subagent a stop button (`useAgent().stopSubagent`). */
|
|
1335
|
+
onStopSubagent?: (id: string) => void;
|
|
1137
1336
|
/** Open the activity of finished answers too (default: only while it runs). */
|
|
1138
1337
|
activityOpen?: boolean;
|
|
1139
1338
|
/** Extra content under the latest assistant turn while it streams (plan thought, …). */
|
|
@@ -1165,7 +1364,7 @@ declare const AttachmentView: ({ attachment: a }: {
|
|
|
1165
1364
|
* subagents, consent decisions — and the tokens it spent by kind. Every part
|
|
1166
1365
|
* can be hidden, relabelled or rendered by the host.
|
|
1167
1366
|
*/
|
|
1168
|
-
declare const MessageList: ({ messages, empty, showActivity, showToolCalls, showUsage, showThoughts, activityOpen, liveExtra, renderContent, renderMessage, renderAttachment, renderToolCall, labels, className, }: MessageListProps) => react.JSX.Element | null;
|
|
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;
|
|
1169
1368
|
|
|
1170
1369
|
interface ToolApprovalPromptProps {
|
|
1171
1370
|
/** Pending requests (e.g. `agent.pendingApprovals`). */
|
|
@@ -1241,6 +1440,12 @@ interface AgentChatProps {
|
|
|
1241
1440
|
showUsage?: boolean;
|
|
1242
1441
|
/** Thoughts, when the model thinks (default true). */
|
|
1243
1442
|
showThoughts?: boolean;
|
|
1443
|
+
/** What you said while the agent worked, under the step it reached (default true). */
|
|
1444
|
+
showNotes?: boolean;
|
|
1445
|
+
/** The lessons the agent wrote down during an answer, and the pages it fetched (default true). */
|
|
1446
|
+
showLearned?: boolean;
|
|
1447
|
+
/** A stop button on each running subagent (default true). */
|
|
1448
|
+
stoppableSubagents?: boolean;
|
|
1244
1449
|
/** Conversation total in the header (default true). */
|
|
1245
1450
|
showTotalUsage?: boolean;
|
|
1246
1451
|
/** Status dot in the header (default true). */
|
|
@@ -1312,6 +1517,35 @@ interface AgentChatProps {
|
|
|
1312
1517
|
*/
|
|
1313
1518
|
declare const AgentChat: (props: AgentChatProps) => react.JSX.Element;
|
|
1314
1519
|
|
|
1520
|
+
interface LearnedSkillsProps {
|
|
1521
|
+
/**
|
|
1522
|
+
* An explicit controller from {@link useAgent}. If omitted, the component reads the shared
|
|
1523
|
+
* controller from an enclosing `<AgentProvider>`. Or pass `lessons` yourself.
|
|
1524
|
+
*/
|
|
1525
|
+
controller?: UseAgentReturn;
|
|
1526
|
+
/** The lessons to show (default: the controller's `learned`). */
|
|
1527
|
+
lessons?: LessonView[];
|
|
1528
|
+
/**
|
|
1529
|
+
* Delete a lesson (default: the controller's `forgetSkill`). `false` hides the button -
|
|
1530
|
+
* a read-only view of what the agent wrote.
|
|
1531
|
+
*/
|
|
1532
|
+
onForget?: ((name: string) => void | Promise<unknown>) | false;
|
|
1533
|
+
/** Show what each lesson came from - the sources it named, the pages it read (default true). */
|
|
1534
|
+
showSources?: boolean;
|
|
1535
|
+
/** Shown when there are no lessons (default: a short sentence from the labels). */
|
|
1536
|
+
empty?: ReactNode;
|
|
1537
|
+
/** Hide the title row (default false). */
|
|
1538
|
+
hideTitle?: boolean;
|
|
1539
|
+
labels?: AgentLabelsOverride;
|
|
1540
|
+
className?: string;
|
|
1541
|
+
}
|
|
1542
|
+
/**
|
|
1543
|
+
* The agent's notebook: the lessons it wrote down itself (`config.learning`), each with when it
|
|
1544
|
+
* applies, how many times it was rewritten and where it came from - and a button to forget one.
|
|
1545
|
+
* Updates live as the agent learns.
|
|
1546
|
+
*/
|
|
1547
|
+
declare const LearnedSkills: ({ controller, lessons, onForget, showSources, empty, hideTitle, labels, className, }: LearnedSkillsProps) => react.JSX.Element;
|
|
1548
|
+
|
|
1315
1549
|
interface ComposerProps {
|
|
1316
1550
|
/** Called with the trimmed text when the user submits. */
|
|
1317
1551
|
onSubmit: (text: string) => void;
|
|
@@ -1407,5 +1641,5 @@ interface ApiKeyFormProps {
|
|
|
1407
1641
|
*/
|
|
1408
1642
|
declare const ApiKeyForm: ({ credentials, credentialRef, label, placeholder, onChange, className, }: ApiKeyFormProps) => react.JSX.Element;
|
|
1409
1643
|
|
|
1410
|
-
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, createInitialAgentState, createWebLLMEngine, defaultLabels, downscaleImage, filterCommands, formatElapsed, mergeLabels, newChatId, noticesOf, parseSlash, usageLine, useAgent, useAgentContext, useChatHistory, useCredentials, useLabels, useLocalModel, useOptionalAgentContext, useSpeechToText, useVirtualFiles, useWebLLMModel, withAttachments };
|
|
1411
|
-
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, RenderToolCall, ReplanState, RunGoalOptions, SlashCommand, SpeechRecognizerLike, StepListProps, StepView, SubagentView, ToolApprovalPromptProps, ToolCallRowProps, ToolCallView, UsageBadgeProps, UseAgentOptions, UseAgentReturn, UseChatHistoryOptions, UseChatHistoryReturn, UseCredentialsReturn, UseLocalModelOptions, UseLocalModelReturn, UseSpeechToTextOptions, UseSpeechToTextReturn, UseVirtualFilesReturn, UseWebLLMModelOptions, UseWebLLMModelReturn, WebLLMModelFactory };
|
|
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 };
|