@dudko.dev/agent-web-react 0.0.21 → 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.
Files changed (2) hide show
  1. package/README.md +21 -2
  2. package/package.json +1 -1
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), `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
@@ -444,6 +455,14 @@ let state = createInitialAgentState()
444
455
  state = agentStateReducer(state, { type: 'event', event }) // fold each AgentEvent
445
456
  ```
446
457
 
458
+ The state is made of plain, exported view types you can render with your own components:
459
+ `StepView` (a step and its `ToolCallView`s), `ApprovalView`, `SubagentView`, `UserNoteView` /
460
+ `QueuedMessageView` (steering), `LessonView` / `FetchView` (the notebook and the pages fetched),
461
+ `BudgetView`, `CompactionView`, `AttachmentView`, `ChatMessage` (a transcript entry that keeps its
462
+ own steps, usage and duration). Outside `<AgentChat>`, `useAgentContext()` returns the controller of
463
+ the enclosing `<AgentProvider>` (it throws outside one; `useOptionalAgentContext()` returns
464
+ `undefined` instead), and `useLabels()` the labels in effect.
465
+
447
466
  ## How it fits together
448
467
 
449
468
  ```
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.22",
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": [