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

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,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, 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';
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 {
@@ -54,6 +54,10 @@ interface ChatMessage {
54
54
  durationMs?: number;
55
55
  /** Assistant turn: skills the run used. */
56
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[];
57
61
  /** Assistant turn ended with an error. */
58
62
  error?: boolean;
59
63
  }
@@ -73,6 +77,29 @@ interface ToolCallView {
73
77
  /** ≈ tokens of the result fed back to the model (chars / 4). */
74
78
  outputTokens?: number;
75
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
+ }
76
103
  /** A tool call waiting for (or decided by) the user's consent. */
77
104
  interface ApprovalView {
78
105
  id: string;
@@ -194,6 +221,16 @@ interface AgentUiState {
194
221
  undelivered: string[];
195
222
  /** Skills activated in this run. */
196
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[];
197
234
  /** Tools activated by find_tools in this run. */
198
235
  discoveredTools: string[];
199
236
  /** Compactions in this run. */
@@ -286,6 +323,11 @@ interface UseAgentReturn extends AgentUiState {
286
323
  send: (text: string) => boolean;
287
324
  /** Stop ONE running subagent (`SubagentView.id`); the run and its siblings go on. */
288
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>;
289
331
  /** Send the `undelivered` messages (a stopped run's leftovers) as a new message. */
290
332
  sendUndelivered: () => void;
291
333
  /** Drop the `undelivered` messages. */
@@ -819,12 +861,24 @@ interface AgentLabels {
819
861
  toolCalls: (n: number) => string;
820
862
  subagents: (n: number) => string;
821
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;
822
870
  answerThoughts: string;
823
871
  stepThoughts: string;
824
872
  usageTitle: string;
825
873
  attachments: string;
826
874
  planned: string;
827
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;
828
882
  placeholder: string;
829
883
  listening: string;
830
884
  message: string;
@@ -1007,6 +1061,14 @@ type AgentAction =
1007
1061
  at?: number;
1008
1062
  attachments?: ChatAttachment[];
1009
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
+ }
1010
1072
  /** Replace the transcript with a saved conversation (chat history). */
1011
1073
  | {
1012
1074
  type: 'load';
@@ -1022,6 +1084,11 @@ type AgentAction =
1022
1084
  type: 'undelivered';
1023
1085
  texts: string[];
1024
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[];
1025
1092
  /** A fresh, empty view. */
1026
1093
  declare const createInitialAgentState: () => AgentUiState;
1027
1094
  declare const agentStateReducer: (state: AgentUiState, action: AgentAction) => AgentUiState;
@@ -1262,6 +1329,8 @@ interface MessageListProps {
1262
1329
  showThoughts?: boolean;
1263
1330
  /** What the user said while the agent worked, under the step it reached (default true). */
1264
1331
  showNotes?: boolean;
1332
+ /** The lessons the agent wrote down during the answer, and the pages it fetched (default true). */
1333
+ showLearned?: boolean;
1265
1334
  /** Give a running subagent a stop button (`useAgent().stopSubagent`). */
1266
1335
  onStopSubagent?: (id: string) => void;
1267
1336
  /** Open the activity of finished answers too (default: only while it runs). */
@@ -1295,7 +1364,7 @@ declare const AttachmentView: ({ attachment: a }: {
1295
1364
  * subagents, consent decisions — and the tokens it spent by kind. Every part
1296
1365
  * can be hidden, relabelled or rendered by the host.
1297
1366
  */
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;
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;
1299
1368
 
1300
1369
  interface ToolApprovalPromptProps {
1301
1370
  /** Pending requests (e.g. `agent.pendingApprovals`). */
@@ -1373,6 +1442,8 @@ interface AgentChatProps {
1373
1442
  showThoughts?: boolean;
1374
1443
  /** What you said while the agent worked, under the step it reached (default true). */
1375
1444
  showNotes?: boolean;
1445
+ /** The lessons the agent wrote down during an answer, and the pages it fetched (default true). */
1446
+ showLearned?: boolean;
1376
1447
  /** A stop button on each running subagent (default true). */
1377
1448
  stoppableSubagents?: boolean;
1378
1449
  /** Conversation total in the header (default true). */
@@ -1446,6 +1517,35 @@ interface AgentChatProps {
1446
1517
  */
1447
1518
  declare const AgentChat: (props: AgentChatProps) => react.JSX.Element;
1448
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
+
1449
1549
  interface ComposerProps {
1450
1550
  /** Called with the trimmed text when the user submits. */
1451
1551
  onSubmit: (text: string) => void;
@@ -1541,5 +1641,5 @@ interface ApiKeyFormProps {
1541
1641
  */
1542
1642
  declare const ApiKeyForm: ({ credentials, credentialRef, label, placeholder, onChange, className, }: ApiKeyFormProps) => react.JSX.Element;
1543
1643
 
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 };
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 };
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, 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';
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 {
@@ -54,6 +54,10 @@ interface ChatMessage {
54
54
  durationMs?: number;
55
55
  /** Assistant turn: skills the run used. */
56
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[];
57
61
  /** Assistant turn ended with an error. */
58
62
  error?: boolean;
59
63
  }
@@ -73,6 +77,29 @@ interface ToolCallView {
73
77
  /** ≈ tokens of the result fed back to the model (chars / 4). */
74
78
  outputTokens?: number;
75
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
+ }
76
103
  /** A tool call waiting for (or decided by) the user's consent. */
77
104
  interface ApprovalView {
78
105
  id: string;
@@ -194,6 +221,16 @@ interface AgentUiState {
194
221
  undelivered: string[];
195
222
  /** Skills activated in this run. */
196
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[];
197
234
  /** Tools activated by find_tools in this run. */
198
235
  discoveredTools: string[];
199
236
  /** Compactions in this run. */
@@ -286,6 +323,11 @@ interface UseAgentReturn extends AgentUiState {
286
323
  send: (text: string) => boolean;
287
324
  /** Stop ONE running subagent (`SubagentView.id`); the run and its siblings go on. */
288
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>;
289
331
  /** Send the `undelivered` messages (a stopped run's leftovers) as a new message. */
290
332
  sendUndelivered: () => void;
291
333
  /** Drop the `undelivered` messages. */
@@ -819,12 +861,24 @@ interface AgentLabels {
819
861
  toolCalls: (n: number) => string;
820
862
  subagents: (n: number) => string;
821
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;
822
870
  answerThoughts: string;
823
871
  stepThoughts: string;
824
872
  usageTitle: string;
825
873
  attachments: string;
826
874
  planned: string;
827
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;
828
882
  placeholder: string;
829
883
  listening: string;
830
884
  message: string;
@@ -1007,6 +1061,14 @@ type AgentAction =
1007
1061
  at?: number;
1008
1062
  attachments?: ChatAttachment[];
1009
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
+ }
1010
1072
  /** Replace the transcript with a saved conversation (chat history). */
1011
1073
  | {
1012
1074
  type: 'load';
@@ -1022,6 +1084,11 @@ type AgentAction =
1022
1084
  type: 'undelivered';
1023
1085
  texts: string[];
1024
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[];
1025
1092
  /** A fresh, empty view. */
1026
1093
  declare const createInitialAgentState: () => AgentUiState;
1027
1094
  declare const agentStateReducer: (state: AgentUiState, action: AgentAction) => AgentUiState;
@@ -1262,6 +1329,8 @@ interface MessageListProps {
1262
1329
  showThoughts?: boolean;
1263
1330
  /** What the user said while the agent worked, under the step it reached (default true). */
1264
1331
  showNotes?: boolean;
1332
+ /** The lessons the agent wrote down during the answer, and the pages it fetched (default true). */
1333
+ showLearned?: boolean;
1265
1334
  /** Give a running subagent a stop button (`useAgent().stopSubagent`). */
1266
1335
  onStopSubagent?: (id: string) => void;
1267
1336
  /** Open the activity of finished answers too (default: only while it runs). */
@@ -1295,7 +1364,7 @@ declare const AttachmentView: ({ attachment: a }: {
1295
1364
  * subagents, consent decisions — and the tokens it spent by kind. Every part
1296
1365
  * can be hidden, relabelled or rendered by the host.
1297
1366
  */
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;
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;
1299
1368
 
1300
1369
  interface ToolApprovalPromptProps {
1301
1370
  /** Pending requests (e.g. `agent.pendingApprovals`). */
@@ -1373,6 +1442,8 @@ interface AgentChatProps {
1373
1442
  showThoughts?: boolean;
1374
1443
  /** What you said while the agent worked, under the step it reached (default true). */
1375
1444
  showNotes?: boolean;
1445
+ /** The lessons the agent wrote down during an answer, and the pages it fetched (default true). */
1446
+ showLearned?: boolean;
1376
1447
  /** A stop button on each running subagent (default true). */
1377
1448
  stoppableSubagents?: boolean;
1378
1449
  /** Conversation total in the header (default true). */
@@ -1446,6 +1517,35 @@ interface AgentChatProps {
1446
1517
  */
1447
1518
  declare const AgentChat: (props: AgentChatProps) => react.JSX.Element;
1448
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
+
1449
1549
  interface ComposerProps {
1450
1550
  /** Called with the trimmed text when the user submits. */
1451
1551
  onSubmit: (text: string) => void;
@@ -1541,5 +1641,5 @@ interface ApiKeyFormProps {
1541
1641
  */
1542
1642
  declare const ApiKeyForm: ({ credentials, credentialRef, label, placeholder, onChange, className, }: ApiKeyFormProps) => react.JSX.Element;
1543
1643
 
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 };
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 };