@dudko.dev/agent-web-react 0.0.36 → 0.0.38
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 +13 -7
- package/dist/{elicitation-xMLll5W9.d.cts → elicitation-BgSf-xzh.d.cts} +25 -1
- package/dist/{elicitation-xMLll5W9.d.ts → elicitation-BgSf-xzh.d.ts} +25 -1
- package/dist/index.cjs +251 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +130 -6
- package/dist/index.d.ts +130 -6
- package/dist/index.js +246 -36
- package/dist/index.js.map +1 -1
- package/dist/mcp.d.cts +2 -2
- package/dist/mcp.d.ts +2 -2
- package/dist/styles.css +30 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -206,7 +206,7 @@ function Custom() {
|
|
|
206
206
|
| `compact()` | summarise the stored transcript now |
|
|
207
207
|
| `sessionId` / `loadChat(chat)` | the memory session; switch conversations |
|
|
208
208
|
| `subagents`, `skills`, `discoveredTools`, `compactions`, `budget` | the rest of the run, folded. `subagents` is a **tree**: static subagents and the helpers the model started (`subagents.dynamic`), each node with `parentId` / `depth`, status, model, tokens, tool calls and time; `subagentTree(subagents)` nests it - see [docs/chat.md](docs/chat.md#subagents-and-helpers-the-tree) |
|
|
209
|
-
| `media`, `transcripts`, `decisions` | absent until there is one: the files the run generated (`MediaView[]`: a path in the workspace, never bytes), the audio it transcribed (`TranscriptView[]`), and the decision model's answers that came before any step (`DecisionView[]`; later ones are on their step) |
|
|
209
|
+
| `media`, `transcripts`, `decisions` | absent until there is one: the files the run generated (`MediaView[]`: a path in the workspace, never bytes; `references` - the paths of the reference pictures a picture was made with, and whether they were `used`), the audio it transcribed (`TranscriptView[]`), and the decision model's answers that came before any step (`DecisionView[]`; later ones are on their step) |
|
|
210
210
|
| `learned`, `learnedNow`, `fetches` | the agent's notebook (`LessonView[]`, survives `reset`), what it wrote this run, and the `web_fetch` requests this run made (`FetchView[]`) |
|
|
211
211
|
| `queued`, `notes`, `undelivered`, `replan` | steering: messages waiting, shown (and where), left over; the last replan decision (`byUser` when a message caused it; `failed` + `error` when the replanner call itself failed and the run went on with its plan) |
|
|
212
212
|
| `steps[i].tier`, `.model`, `.tierReason`, `.escalations`, `.replanFailed` | with the core's `executorTiers`: the tier and model a step is on, why it started there, and its escalations (`StepEscalationView[]`); a tool call of an escalated attempt has `attempt`, a write that was not run twice `replayed`. `replanFailed`: the replanner failed after this step (a warning). All absent when tiers are off — see [docs/chat.md](docs/chat.md#model-tiers-escalation-and-a-replanner-that-failed) |
|
|
@@ -845,11 +845,11 @@ use them standalone. The full guide: [docs/chat.md](docs/chat.md).
|
|
|
845
845
|
| Component | Purpose |
|
|
846
846
|
| --- | --- |
|
|
847
847
|
| `<AgentChat>` | Full panel: transcript with per-answer activity + composer + optional history and files panels. Reads a `controller` prop or the `<AgentProvider>` context. Says when the conversation runs in another tab of the site, waits for an answer there, or waits for it (`showOtherTabs`). |
|
|
848
|
-
| `<AgentComposer>` | The input and its toolbar: attachments, commands, timer, agents, model/thinking, consent, mic, send/stop. The model menu takes `section` per option (a heading over each run of options, e.g. one per provider); both chip menus work from the keyboard (arrows, Home / End, Escape) - see [docs/chat.md](docs/chat.md#the-model-menu-sections-and-keys). |
|
|
848
|
+
| `<AgentComposer>` | The input and its toolbar: attachments, commands, timer, agents, model/thinking, consent, mic, send/stop. The model menu takes `section` per option (a heading over each run of options, e.g. one per provider); both chip menus work from the keyboard (arrows, Home / End, Escape) - see [docs/chat.md](docs/chat.md#the-model-menu-sections-and-keys). `attachments` takes `{ accept, maxBytes, imageMaxDimension, imageMaxPixels, maxSourceBytes, imageMaxSourcePixels, maxImages, maxTotalBytes }`: `maxBytes` (20 MB) is checked on what is sent, so a photo over it is downscaled (1568 px / 1.15 MP) and sent with the note "downscaled from …", and a file `convertFile` turns into text is judged by its text - neither is refused for its original; that original may be up to `maxSourceBytes` (50 MB, never below `maxBytes`), and a picture's up to `imageMaxSourcePixels` (200 MP, read from the header before decoding); one message holds at most `maxImages` pictures (20) and `maxTotalBytes` (20 MB) of attachments as they go - a file past either is left out in words, the rest kept - see [docs/chat.md](docs/chat.md#attachments-images-pdfs-files-urls). |
|
|
849
849
|
| `<MessageList>` | The transcript; each answer with its steps, tool calls, thoughts, usage. |
|
|
850
850
|
| `<StepList>` / `<ToolCallRow>` | Execution steps / one tool call with its cost and images. With model tiers: the tier / model badge, the escalation line, the earlier attempt's calls (`showTiers`); a replanner failure as a warning (`showReplanFailed`); the decision model's note (`showDecisions`); the subagent tree under its step (`showSubagents`); a `web_search` call's results as plain text and safe links (`showSearchResults`). |
|
|
851
851
|
| `<SubagentTree>` / `<SubagentRow>` | The run's subagents - static ones and the helpers the model started - as an indented tree: status, model, tokens, time and a Stop button per node (`onStop`, `showUsage`, `showTools`, `renderSubagent`). |
|
|
852
|
-
| `<GeneratedMedia>` / `<TranscriptBlock>` | A file a media tool wrote, read from the workspace: an image inline or a native audio player (only the types the core generates; never SVG) / a folded "Transcript of …" block. `<MessageList files showMedia renderMedia>` places them in the answer. |
|
|
852
|
+
| `<GeneratedMedia>` / `<TranscriptBlock>` | A file a media tool wrote, read from the workspace: an image inline or a native audio player (only the types the core generates; never SVG) - a picture made with reference pictures names them under it ("Reference: me.jpg", or that the image model took none: labels `mediaReferences` / `mediaReferencesUnused`) / a folded "Transcript of …" block. `<MessageList files showMedia renderMedia>` places them in the answer. |
|
|
853
853
|
| `<ImageViewer>` / `<ImageThumb>` | A picture opened over the chat, in the page (never in a new window): fitted to the screen, previous / next within its message (arrows, swipe), zoom, Download as a file; a modal dialog with a focus trap, Esc / backdrop / close. Every picture `<MessageList>` draws is an `<ImageThumb>`; `<AgentChat imageViewer={false}>` keeps the old link in a new tab, `renderImageViewer` draws your own. See [docs/chat.md](docs/chat.md#pictures-open-in-the-page-the-image-viewer). |
|
|
854
854
|
| `<FileChips>` / `<FileChip>` | The files an answer wrote to the workspace (the core's `file.written` / `file.deleted`), as chips: name, kind, size, open, download; an inline preview (text with line numbers, a picture, your own rendering through `renderFileContent`), and an `.html` file in a sandboxed frame with Preview / Source. `<MessageList files showFileChips htmlPreview renderFile renderFileContent>` places them under the answer. |
|
|
855
855
|
| `<SandboxedFrame>` / `<SourceView>` | Untrusted HTML inside chrome the host draws: `<iframe sandbox>` without `allow-same-origin`, by `srcdoc`, no network, fixed height (`html`, `scripts`, `title`, `label`, `actions`, `footer`, `height`) / a file's text with line numbers, never markup. See [the boundary](#the-html-preview-is-a-security-boundary). |
|
|
@@ -948,7 +948,8 @@ The state is made of plain, exported view types you can render with your own com
|
|
|
948
948
|
`StepView` (a step and its `ToolCallView`s; `StepEscalationView` for its escalations), `ApprovalView`, `ElicitationView` (a question an MCP server put to the user in the middle of a tool call - `state.elicitations`, see below), `SubagentView`, `UserNoteView` /
|
|
949
949
|
`QueuedMessageView` (steering), `LessonView` / `FetchView` (the notebook and the pages fetched),
|
|
950
950
|
`BudgetView`, `CompactionView`, `AttachmentView`, `ChatMessage` (a transcript entry that keeps its
|
|
951
|
-
own steps, usage and duration
|
|
951
|
+
own steps, usage and duration; `stopped` on an answer whose run was stopped - with no text, the chat
|
|
952
|
+
shows the `answerStopped` label: the state holds no UI text). Outside `<AgentChat>`, `useAgentContext()` returns the controller of
|
|
952
953
|
the enclosing `<AgentProvider>` (it throws outside one; `useOptionalAgentContext()` returns
|
|
953
954
|
`undefined` instead), and `useLabels()` the labels in effect.
|
|
954
955
|
|
|
@@ -981,14 +982,19 @@ the hooks keep them in step, with nothing to configure beyond a shared `memory`
|
|
|
981
982
|
chat is read again from what that tab saved. `watch: false` switches this off.
|
|
982
983
|
- **One run per conversation.** A run started here while the conversation runs elsewhere waits
|
|
983
984
|
for it (`sessionBusy`, "Waiting for the other tab to finish this conversation…", the goal shown
|
|
984
|
-
queued
|
|
985
|
-
|
|
985
|
+
queued - "waiting for the other tab to finish", `queuedForSession`, its `queued` entry marked
|
|
986
|
+
`session`, while the wait lasts) and then goes, with that turn in the agent's memory; a saved chat
|
|
987
|
+
keeps both turns, in order (`saveChat`: one transaction, merged by message identity).
|
|
988
|
+
- **Another tab deletes or upgrades the database** ("delete everything", a newer copy of the site):
|
|
989
|
+
`ChatHistoryStore` closes its connection on `versionchange`, like the core's stores, so that tab is
|
|
990
|
+
not held up; the next use opens a new, empty database (after an upgrade by a newer copy, an error
|
|
991
|
+
until a reload).
|
|
986
992
|
- **What another tab changed appears here without a reload:** a key in the vault
|
|
987
993
|
(`useCredentials().version`), the files (`useVirtualFiles`), the saved chats (`useChatHistory`),
|
|
988
994
|
the agent's notebook (`learned`, through `agent.reloadLearnedSkills()`).
|
|
989
995
|
|
|
990
996
|
`<AgentChat>` shows the notes above the composer (`showOtherTabs`; labels `remoteRunning`,
|
|
991
|
-
`remoteWaitingConsent`, `remoteGone`, `sessionBusy`, `fromAnotherTab`). Details: [docs/chat.md](docs/chat.md#several-tabs).
|
|
997
|
+
`remoteWaitingConsent`, `remoteGone`, `sessionBusy`, `queuedForSession`, `fromAnotherTab`). Details: [docs/chat.md](docs/chat.md#several-tabs).
|
|
992
998
|
|
|
993
999
|
## How it fits together
|
|
994
1000
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { McpAppCsp, McpAppResource, McpAppToolResult, AppSamplingView, AppToolCallRequest, AppSamplingRequest, AppSamplingResult, AgentToolSet, IPlan, IPlanStep, ModelTier, TierReason, EscalationReason, DecisionPoint, DecisionFallbackReason, McpSkillConsentView, IUsage, AskUserOption, AskUserAction, ReplanMode, AgentEvent
|
|
1
|
+
import { McpAppCsp, McpAppResource, McpAppToolResult, AppSamplingView, AppToolCallRequest, AppSamplingRequest, AppSamplingResult, AgentToolSet, IPlan, IPlanStep, ModelTier, TierReason, EscalationReason, DecisionPoint, DecisionFallbackReason, McpSkillConsentView, IUsage, AskUserOption, AskUserAction, SessionHolder, ReplanMode, AgentEvent } from '@dudko.dev/agent-web';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* MCP Apps, the host's side: the security core of `<McpAppFrame>`, as pure code - no React, no
|
|
@@ -918,6 +918,13 @@ interface ChatMessage {
|
|
|
918
918
|
apps?: AppView[];
|
|
919
919
|
/** Assistant turn ended with an error. */
|
|
920
920
|
error?: boolean;
|
|
921
|
+
/**
|
|
922
|
+
* Assistant turn: the run was stopped (by the user, here or in another tab) before it was done.
|
|
923
|
+
* `content` is what it had written by then - `''` when nothing: the chat shows the
|
|
924
|
+
* `answerStopped` label in its place (the reducer keeps no UI text). A chat saved before this
|
|
925
|
+
* existed has the old `'Stopped.'` as its content, and shows that.
|
|
926
|
+
*/
|
|
927
|
+
stopped?: true;
|
|
921
928
|
}
|
|
922
929
|
/** A single tool call as it appears in a step, streamed then finalized. */
|
|
923
930
|
interface ToolCallView {
|
|
@@ -1020,6 +1027,16 @@ interface MediaView {
|
|
|
1020
1027
|
bytes: number;
|
|
1021
1028
|
/** The media model that made it. */
|
|
1022
1029
|
model: string;
|
|
1030
|
+
/**
|
|
1031
|
+
* The reference pictures of a `generate_image` call that had `images`: whether they were sent
|
|
1032
|
+
* to the image model (`used`; false: it takes none, the picture was made from the text), how
|
|
1033
|
+
* many, and their paths. Never their bytes.
|
|
1034
|
+
*/
|
|
1035
|
+
references?: {
|
|
1036
|
+
used: boolean;
|
|
1037
|
+
count: number;
|
|
1038
|
+
paths: string[];
|
|
1039
|
+
};
|
|
1023
1040
|
/** The step whose tool call made it, when the event named one. */
|
|
1024
1041
|
stepId?: string;
|
|
1025
1042
|
}
|
|
@@ -1208,6 +1225,13 @@ interface QueuedMessageView {
|
|
|
1208
1225
|
text: string;
|
|
1209
1226
|
/** Another tab of the site sent it to this run (the core's session relay). */
|
|
1210
1227
|
origin?: 'another-tab';
|
|
1228
|
+
/**
|
|
1229
|
+
* What the user sent waits with a run of this tab's that waits for the SESSION (`sessionBusy`):
|
|
1230
|
+
* the other run of the conversation holds it - in another tab, or in this one. The entry is
|
|
1231
|
+
* there only while that wait lasts (the run then starts with it); the chat shows
|
|
1232
|
+
* `queuedForSession` for it, not `queuedWaiting`.
|
|
1233
|
+
*/
|
|
1234
|
+
session?: SessionHolder;
|
|
1211
1235
|
}
|
|
1212
1236
|
/**
|
|
1213
1237
|
* A message the user sent while the run was going, after it reached the agent.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { McpAppCsp, McpAppResource, McpAppToolResult, AppSamplingView, AppToolCallRequest, AppSamplingRequest, AppSamplingResult, AgentToolSet, IPlan, IPlanStep, ModelTier, TierReason, EscalationReason, DecisionPoint, DecisionFallbackReason, McpSkillConsentView, IUsage, AskUserOption, AskUserAction, ReplanMode, AgentEvent
|
|
1
|
+
import { McpAppCsp, McpAppResource, McpAppToolResult, AppSamplingView, AppToolCallRequest, AppSamplingRequest, AppSamplingResult, AgentToolSet, IPlan, IPlanStep, ModelTier, TierReason, EscalationReason, DecisionPoint, DecisionFallbackReason, McpSkillConsentView, IUsage, AskUserOption, AskUserAction, SessionHolder, ReplanMode, AgentEvent } from '@dudko.dev/agent-web';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* MCP Apps, the host's side: the security core of `<McpAppFrame>`, as pure code - no React, no
|
|
@@ -918,6 +918,13 @@ interface ChatMessage {
|
|
|
918
918
|
apps?: AppView[];
|
|
919
919
|
/** Assistant turn ended with an error. */
|
|
920
920
|
error?: boolean;
|
|
921
|
+
/**
|
|
922
|
+
* Assistant turn: the run was stopped (by the user, here or in another tab) before it was done.
|
|
923
|
+
* `content` is what it had written by then - `''` when nothing: the chat shows the
|
|
924
|
+
* `answerStopped` label in its place (the reducer keeps no UI text). A chat saved before this
|
|
925
|
+
* existed has the old `'Stopped.'` as its content, and shows that.
|
|
926
|
+
*/
|
|
927
|
+
stopped?: true;
|
|
921
928
|
}
|
|
922
929
|
/** A single tool call as it appears in a step, streamed then finalized. */
|
|
923
930
|
interface ToolCallView {
|
|
@@ -1020,6 +1027,16 @@ interface MediaView {
|
|
|
1020
1027
|
bytes: number;
|
|
1021
1028
|
/** The media model that made it. */
|
|
1022
1029
|
model: string;
|
|
1030
|
+
/**
|
|
1031
|
+
* The reference pictures of a `generate_image` call that had `images`: whether they were sent
|
|
1032
|
+
* to the image model (`used`; false: it takes none, the picture was made from the text), how
|
|
1033
|
+
* many, and their paths. Never their bytes.
|
|
1034
|
+
*/
|
|
1035
|
+
references?: {
|
|
1036
|
+
used: boolean;
|
|
1037
|
+
count: number;
|
|
1038
|
+
paths: string[];
|
|
1039
|
+
};
|
|
1023
1040
|
/** The step whose tool call made it, when the event named one. */
|
|
1024
1041
|
stepId?: string;
|
|
1025
1042
|
}
|
|
@@ -1208,6 +1225,13 @@ interface QueuedMessageView {
|
|
|
1208
1225
|
text: string;
|
|
1209
1226
|
/** Another tab of the site sent it to this run (the core's session relay). */
|
|
1210
1227
|
origin?: 'another-tab';
|
|
1228
|
+
/**
|
|
1229
|
+
* What the user sent waits with a run of this tab's that waits for the SESSION (`sessionBusy`):
|
|
1230
|
+
* the other run of the conversation holds it - in another tab, or in this one. The entry is
|
|
1231
|
+
* there only while that wait lasts (the run then starts with it); the chat shows
|
|
1232
|
+
* `queuedForSession` for it, not `queuedWaiting`.
|
|
1233
|
+
*/
|
|
1234
|
+
session?: SessionHolder;
|
|
1211
1235
|
}
|
|
1212
1236
|
/**
|
|
1213
1237
|
* A message the user sent while the run was going, after it reached the agent.
|