@dudko.dev/agent-web-react 0.0.21 → 0.0.23

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.
Files changed (2) hide show
  1. package/README.md +26 -5
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -15,9 +15,14 @@ app with a single hook and (optionally) a set of pre-styled components:
15
15
  chip and speech to text; saved chats in IndexedDB and a workspace (virtual
16
16
  file system) panel. Everything is a prop: show/hide, labels (i18n), render
17
17
  props, slots, swappable components, theme — see [docs/chat.md](docs/chat.md).
18
+ - 🗣️ **Steering and learning** — type to the agent while it works (`send`,
19
+ `stopSubagent`; queued / delivered notes under the step that got them), and watch
20
+ it keep a notebook: lessons it wrote down as skills (`learned`, `<LearnedSkills>`,
21
+ `forgetSkill`) and the pages it fetched — see
22
+ [docs/chat.md](docs/chat.md#talking-to-the-agent-while-it-works).
18
23
  - 🧩 **Building blocks** — `<AgentComposer>`, `<MessageList>`, `<StepList>`,
19
- `<ToolApprovalPrompt>`, `<ChatHistoryList>`, `<FilesPanel>`, `<ContextMeter>`,
20
- `<ModelLoadBar>`, `<UsageBadge>`, `<ApiKeyForm>`; hooks `useChatHistory`,
24
+ `<ToolApprovalPrompt>`, `<ApprovalModeSwitch>`, `<ChatHistoryList>`, `<FilesPanel>`,
25
+ `<LearnedSkills>`, `<ContextMeter>`, `<PlanView>`, `<ModelLoadBar>`, `<UsageBadge>`, `<ApiKeyForm>`; hooks `useChatHistory`,
21
26
  `useVirtualFiles`, `useSpeechToText`; MCP hooks `useMcp` / `useMcpServers` live in
22
27
  [`@dudko.dev/agent-web-react/mcp`](#mcp-hooks-live-in-their-own-subpath).
23
28
  - 🔑 **`useCredentials`** — store BYOK API keys **encrypted at rest**
@@ -173,6 +178,9 @@ function Custom() {
173
178
  | --- | --- |
174
179
  | `run(goal, { images, files, attachments, label })` | Start a run (with attachments); resolves with the `RunResult` |
175
180
  | `stop()` | Abort the in-flight run |
181
+ | `agent` | the core `Agent` itself (or `undefined` until built): `agent.usage` / `agent.sessionUsage()` (tokens spent, counted live; core ≥ 0.0.32), `agent.listLearnedSkills()`, `agent.capabilities` |
182
+ | `forgetSkill(name)` | delete one of the agent's own lessons from its notebook |
183
+ | `sendUndelivered()` / `discardUndelivered()` | send, or drop, what a stopped run never showed the agent |
176
184
  | `send(text)`, `stopSubagent(id)` | Say something to the running agent (shown to the model at its next boundary; the replanner re-checks the plan) / stop one subagent. `queued`, `notes` and `undelivered` show where a message is — see [docs/chat.md](docs/chat.md#talking-to-the-agent-while-it-works) |
177
185
  | `reset()` | Clear the whole conversation (and the agent's memory of it) |
178
186
  | `reload()` | Rebuild the agent (e.g. after storing a new key) |
@@ -187,6 +195,9 @@ function Custom() {
187
195
  | `compact()` | summarise the stored transcript now |
188
196
  | `sessionId` / `loadChat(chat)` | the memory session; switch conversations |
189
197
  | `subagents`, `skills`, `discoveredTools`, `compactions`, `budget` | the rest of the run, folded |
198
+ | `learned`, `learnedNow`, `fetches` | the agent's notebook (`LessonView[]`, survives `reset`), what it wrote this run, and the `web_fetch` requests this run made (`FetchView[]`) |
199
+ | `queued`, `notes`, `undelivered`, `replan` | steering: messages waiting, shown (and where), left over; the last replan decision (`byUser` when a message caused it) |
200
+ | `error`, `stopped`, `events`, `seq` | the run's error text, whether it was stopped, the raw event log and its counter |
190
201
  | `modelLoad` | WebLLM download progress, when loading |
191
202
 
192
203
  **Options:** `deps` (rebuild the agent when these change — e.g. on a model
@@ -386,9 +397,11 @@ Two notes:
386
397
  core — importing these hooks is what puts it in your build.
387
398
  - `oauthSupported` is `false` on cores older than `@dudko.dev/agent-web@0.0.9`,
388
399
  which introduced `BrowserOAuthProvider`; header auth still works there. The
389
- peer floor is `>=0.0.20` — the first core with the virtual file system,
390
- attachments, consent, tool search, subagents and context editing this
391
- package's chat builds on.
400
+ peer floor is `>=0.0.30` — the first core with the learning notebook
401
+ (`forgetSkill`, `listLearnedSkills`) on top of the virtual file system,
402
+ attachments, consent, tool search, subagents, steering and context editing this
403
+ package's chat builds on. `agent.usage` / `agent.sessionUsage()` and the
404
+ window-derived output caps need `>=0.0.32`.
392
405
 
393
406
  ## Several MCP servers — `useMcpServers`
394
407
 
@@ -444,6 +457,14 @@ let state = createInitialAgentState()
444
457
  state = agentStateReducer(state, { type: 'event', event }) // fold each AgentEvent
445
458
  ```
446
459
 
460
+ The state is made of plain, exported view types you can render with your own components:
461
+ `StepView` (a step and its `ToolCallView`s), `ApprovalView`, `SubagentView`, `UserNoteView` /
462
+ `QueuedMessageView` (steering), `LessonView` / `FetchView` (the notebook and the pages fetched),
463
+ `BudgetView`, `CompactionView`, `AttachmentView`, `ChatMessage` (a transcript entry that keeps its
464
+ own steps, usage and duration). Outside `<AgentChat>`, `useAgentContext()` returns the controller of
465
+ the enclosing `<AgentProvider>` (it throws outside one; `useOptionalAgentContext()` returns
466
+ `undefined` instead), and `useLabels()` the labels in effect.
467
+
447
468
  ## How it fits together
448
469
 
449
470
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dudko.dev/agent-web-react",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "description": "React bindings for @dudko.dev/agent-web: a headless useAgent hook, an AgentProvider context, and optional pre-styled components (chat panel, plan/step view, BYOK key form, WebLLM load bar) that connect the in-browser LLM agent to any React site. UI you can drop in — or a headless reducer you can build your own around.",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -120,7 +120,7 @@
120
120
  "react-dom": ">=18"
121
121
  },
122
122
  "devDependencies": {
123
- "@dudko.dev/agent-web": "^0.0.30",
123
+ "@dudko.dev/agent-web": "^0.0.33",
124
124
  "@modelcontextprotocol/sdk": "^1.32.2",
125
125
  "@playwright/test": "^1.65.0",
126
126
  "@types/node": "^22.9.0",