@dudko.dev/agent-web-react 0.0.30 → 0.0.32
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 +52 -10
- package/dist/{chunk-EMF7DTGS.js → chunk-G5GGIMD4.js} +29 -1
- package/dist/chunk-G5GGIMD4.js.map +1 -0
- package/dist/{elicitation-CcZe5-EK.d.cts → elicitation-BW7R4iIw.d.cts} +60 -5
- package/dist/{elicitation-CcZe5-EK.d.ts → elicitation-BW7R4iIw.d.ts} +60 -5
- package/dist/index.cjs +501 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +149 -15
- package/dist/index.d.ts +149 -15
- package/dist/index.js +499 -68
- package/dist/index.js.map +1 -1
- package/dist/mcp.cjs +9 -2
- package/dist/mcp.cjs.map +1 -1
- package/dist/mcp.d.cts +9 -6
- package/dist/mcp.d.ts +9 -6
- package/dist/mcp.js +9 -2
- package/dist/mcp.js.map +1 -1
- package/dist/pipeline.cjs.map +1 -1
- package/dist/pipeline.js +1 -1
- package/dist/styles.css +25 -1
- package/package.json +4 -3
- package/dist/chunk-EMF7DTGS.js.map +0 -1
package/README.md
CHANGED
|
@@ -183,12 +183,14 @@ function Custom() {
|
|
|
183
183
|
|
|
184
184
|
| Field | Description |
|
|
185
185
|
| --- | --- |
|
|
186
|
-
| `run(goal, { images, files, attachments, label })` | Start a run (with attachments); resolves with the `RunResult` |
|
|
187
|
-
| `stop()` | Abort
|
|
186
|
+
| `run(goal, { images, files, attachments, label })` | Start a run (with attachments); resolves with the `RunResult`. When the conversation is running in another tab it waits for that run (`sessionBusy`), then goes with that turn in its memory |
|
|
187
|
+
| `stop()` | Abort this tab's in-flight run (going, or waiting for the session). Never another tab's: that is `stopRemote()` |
|
|
188
|
+
| `stopRemote()`, `sendRemote(text)` | Stop / write to the conversation's run in another tab (`remote?.running`). A text it refuses or never answers comes back as `undelivered`. `<AgentComposer>` uses them while it follows such a run |
|
|
188
189
|
| `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` |
|
|
189
190
|
| `forgetSkill(name)` | delete one of the agent's own lessons from its notebook |
|
|
190
191
|
| `sendUndelivered()` / `discardUndelivered()` | send, or drop, what a stopped run never showed the agent |
|
|
191
|
-
| `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) |
|
|
192
|
+
| `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). `send` is this tab's run only; another tab's is `sendRemote` |
|
|
193
|
+
| `remote`, `sessionBusy` | several tabs: `remote` (`{ running, runId?, ended? }`) - the run in view is another tab's, followed live (its steps, answer and usage fill the rest of the state; `isRunning` is true meanwhile; its consent requests are shown, never answered here); `sessionBusy` (`{ heldBy, goal? }`) - this tab's run waits for the conversation's other run (its goal shown as queued; a stop of the wait gives it back to the composer). See [docs/chat.md](docs/chat.md#several-tabs) |
|
|
192
194
|
| `reset()` | Clear the whole conversation (and the agent's memory of it) |
|
|
193
195
|
| `reload()` | Rebuild the agent (e.g. after storing a new key) |
|
|
194
196
|
| `status` | `idle` \| `initializing` \| `ready` \| `running` \| `error` |
|
|
@@ -212,7 +214,9 @@ function Custom() {
|
|
|
212
214
|
|
|
213
215
|
**Options:** `deps` (rebuild the agent when these change — e.g. on a model
|
|
214
216
|
switch), `onEvent` (tap the raw event stream), `autoStart`, `maxEvents`,
|
|
215
|
-
`approvals` (route consent requests into the hook; default true)
|
|
217
|
+
`approvals` (route consent requests into the hook; default true), `watch` (follow the
|
|
218
|
+
conversation's run in another tab of the site - default true; needs a `memory` the tabs share,
|
|
219
|
+
`IndexedDBStore`). The queue behind `approve` /
|
|
216
220
|
`deny` is exported for a host that builds the core's agent itself: `createApprovalQueue()` gives
|
|
217
221
|
`handler` (pass it as `toolApproval.onRequest`; a request whose `signal` aborts leaves the queue),
|
|
218
222
|
`approve(id, { remember })`, `deny(id, reason)`, `settleAll(decision)` and `pending()`.
|
|
@@ -472,7 +476,7 @@ Options:
|
|
|
472
476
|
| `connect({ url, name, headers })` | the endpoint, the tool prefix (`"<name>__<tool>"`, default `mcp`), static headers |
|
|
473
477
|
| `connect({ oauth })` | `true`, or `{ redirectUrl, scope, clientName, clientMetadataUrl, registration }` (`McpOAuthOptions`) - each overrides the hook-level value for this server; `registration` is below |
|
|
474
478
|
| `connect({ protocol })` | the MCP protocol revisions this connection may use: `'legacy'` (the 2025 revisions), `'auto'` (2026-07-28 when the server offers it, the 2025 ones otherwise) or `'modern'` (2026-07-28 only). Left out, nothing is passed and the core speaks the 2025 revisions, exactly as before. Kept across the OAuth redirect. See [the protocol revision](#the-protocol-revision) |
|
|
475
|
-
| `connect({ skills })` | **experimental**: load the skills the server serves (the MCP Skills extension) into the agent's skills catalog, as `<server>/<skill>`. They come with `tools` - nothing else to wire. Needs `protocol: 'auto'` or `'modern'`. `true`, or `{ consent: 'once-per-skill' \| 'ask' \| 'never' }` (when a person is asked before one of its skills enters the agent's context; `McpSkillsSetting`, `mcpSkillsSettingOf`). Off (left out) by default. Kept across the OAuth redirect. See [MCP skills](#mcp-skills-experimental) |
|
|
479
|
+
| `connect({ skills })` | **experimental**: load the skills the server serves (the MCP Skills extension) into the agent's skills catalog, as `<server>/<skill>`. They come with `tools` - nothing else to wire. Needs `protocol: 'auto'` or `'modern'`. `true`, or `{ consent: 'once-per-skill' \| 'ask' \| 'never', dynamic?: boolean }` (`consent`: when a person is asked before one of its skills enters the agent's context; `dynamic: true`: its generated skills too, no checksums - see [MCP skills](#mcp-skills-experimental); `McpSkillsSetting`, `mcpSkillsSettingOf`). Off (left out) by default. Kept across the OAuth redirect. See [MCP skills](#mcp-skills-experimental) |
|
|
476
480
|
|
|
477
481
|
**`clientMetadataUrl` (CIMD).** Instead of registering itself with every authorization server, an
|
|
478
482
|
app can publish one JSON document that describes it and use that document's URL as its
|
|
@@ -532,12 +536,13 @@ Two notes:
|
|
|
532
536
|
hooks is what puts it in your build.
|
|
533
537
|
- `oauthSupported` is `false` on cores older than `@dudko.dev/agent-web@0.0.9`,
|
|
534
538
|
which introduced `BrowserOAuthProvider`; header auth still works there. The
|
|
535
|
-
peer floor is `>=0.0.
|
|
539
|
+
peer floor is `>=0.0.44` — the first core with several tabs (`onStorageChange`, `watchSession`, the session lock), after MCP Apps (`approveAppToolCall`,
|
|
536
540
|
`sampleForApp`), MCP skills with consent, `file.written`, elicitation and the
|
|
537
541
|
OAuth `registration` choice this package's chat and hooks use, on top of model
|
|
538
542
|
tiers, dynamic subagents, media and decision models, pipelines, the learning
|
|
539
543
|
notebook, the virtual file system, attachments, consent, tool search, subagents,
|
|
540
|
-
steering and context editing.
|
|
544
|
+
steering and context editing. `skills: { dynamic: true }` needs a core 0.0.42 or
|
|
545
|
+
later: an older one declines those skills.
|
|
541
546
|
|
|
542
547
|
## Several MCP servers — `useMcpServers`
|
|
543
548
|
|
|
@@ -554,7 +559,7 @@ const config = { model, tools: { ...myTools, ...mcp.tools } } // "<name>__<tool>
|
|
|
554
559
|
`elicitation`) plus `persist`, `storageKey`, `autoConnect` and `connectTimeoutMs`, and returns
|
|
555
560
|
`{ servers, tools, catalog, protocols, connectedCount, pendingElicitations, answerElicitation, … }`.
|
|
556
561
|
A server may be added with its own `protocol` (`add({ name, url, protocol: 'auto' })`),
|
|
557
|
-
`skills: true` or `{ consent }` ([MCP skills](#mcp-skills-experimental); `servers[i].skills`) and `apps: false`
|
|
562
|
+
`skills: true` or `{ consent, dynamic }` ([MCP skills](#mcp-skills-experimental); `servers[i].skills`) and `apps: false`
|
|
558
563
|
(that server's [MCP Apps](#mcp-apps--a-servers-interface-in-the-chat) off while the others' are
|
|
559
564
|
shown; `servers[i].apps`), all remembered with the list; `servers[i].protocolMode` is what it was added with and
|
|
560
565
|
`servers[i].protocol` (`{ version, era }`) what was negotiated while it is connected - `protocols`
|
|
@@ -583,6 +588,9 @@ await mcp.add({ name: 'docs', url, protocol: 'auto', skills: true })
|
|
|
583
588
|
// the agent's catalog now has docs/<skill> entries; mcp.servers[0].skills === true
|
|
584
589
|
// a server you vetted: its skills load without asking
|
|
585
590
|
await mcp.add({ name: 'ours', url: ourUrl, protocol: 'auto', skills: { consent: 'never' } })
|
|
591
|
+
// a server you trust with its GENERATED skills (no checksums): each is read whole, and the
|
|
592
|
+
// person approves that copy
|
|
593
|
+
await mcp.add({ name: 'gen', url: genUrl, protocol: 'auto', skills: { dynamic: true } })
|
|
586
594
|
```
|
|
587
595
|
|
|
588
596
|
A server may serve **skills** (the `io.modelcontextprotocol/skills` extension, Beta): instruction
|
|
@@ -615,6 +623,17 @@ skill inside another one (nested) is asked about on its own. The agent may also
|
|
|
615
623
|
server names by its address (`skill://…/SKILL.md`, in its instructions or a skill), from that
|
|
616
624
|
server only - the card says so (`skill.byUri`).
|
|
617
625
|
|
|
626
|
+
**Generated skills** (`"resources": "dynamic"`: the server publishes no checksums) are declined
|
|
627
|
+
unless the server was added with `skills: { dynamic: true }` (remembered with the list; there is
|
|
628
|
+
no switch for every server). Then, before the person is asked, the core reads the whole skill -
|
|
629
|
+
its `SKILL.md` and, if the server can list directories, every file in them, within the
|
|
630
|
+
specification's limits (512 files, 16 MiB) - computes the digests itself and keeps that copy in
|
|
631
|
+
memory: the card shows its size and files, says so in one line (`skill.dynamic`;
|
|
632
|
+
`skillConsentDynamic`: "This server publishes no checksums for this skill: you approve the copy
|
|
633
|
+
the agent just read, and only that copy is used."), and the agent is given that copy only, never
|
|
634
|
+
a later read. A server that cannot list its files gives `SKILL.md` alone (`skill.noFileListing`,
|
|
635
|
+
`skillConsentNoFileListing`). Nothing of the copy is stored.
|
|
636
|
+
|
|
618
637
|
### The protocol revision
|
|
619
638
|
|
|
620
639
|
```tsx
|
|
@@ -777,7 +796,7 @@ use them standalone. The full guide: [docs/chat.md](docs/chat.md).
|
|
|
777
796
|
|
|
778
797
|
| Component | Purpose |
|
|
779
798
|
| --- | --- |
|
|
780
|
-
| `<AgentChat>` | Full panel: transcript with per-answer activity + composer + optional history and files panels. Reads a `controller` prop or the `<AgentProvider>` context. |
|
|
799
|
+
| `<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`). |
|
|
781
800
|
| `<AgentComposer>` | The input and its toolbar: attachments, commands, timer, agents, model/thinking, consent, mic, send/stop. |
|
|
782
801
|
| `<MessageList>` | The transcript; each answer with its steps, tool calls, thoughts, usage. |
|
|
783
802
|
| `<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`). |
|
|
@@ -790,7 +809,7 @@ use them standalone. The full guide: [docs/chat.md](docs/chat.md).
|
|
|
790
809
|
| `<McpAppFrame>` / `<McpAppLine>` | An MCP App in host-drawn chrome ("App from server “travel” · sandboxed", panel, menu: reload / open in panel / hide): an opaque-origin frame - or, with `host.sandbox` (`useMcpAppHost({ sandbox })`, `<AgentChat appSandbox>`), an origin of its own behind your sandbox page ("· sandboxed on its own origin") - network only to the origins its resource declared, a bridge with an allow-list; inline, folded, in a panel or - with `allowFullscreen`, asked for by the app after a click in it - full screen over the chat with Exit / Esc (`app`, `host`, `variant`, `theme`, `defaultCollapsed`, `onOpenPanel`, `onClosePanel`, `showCalls`, `allowFullscreen`). `<AgentChat mcpApps>` places them under the answer. See [the boundary](#an-mcp-app-is-a-security-boundary). |
|
|
791
810
|
| `<AppRequestPrompt>` | What an MCP App asks for besides a tool call: a link (its host highlighted, opened only on the user's click), a message (put in the message box as a draft, never sent for the user), a file (its sanitized name, type and size; saved by the page on Save file) or an answer of the agent's model (the app's text as text, the token cap; Allow once / Always for this app / Deny). |
|
|
792
811
|
| `<ApprovalModeSwitch>` | Segmented consent-mode switch. |
|
|
793
|
-
| `<ChatHistoryList>` | Saved chats (from `useChatHistory
|
|
812
|
+
| `<ChatHistoryList>` | Saved chats (from `useChatHistory`; the list follows what other tabs of the site save). |
|
|
794
813
|
| `<FilesPanel>` | A `VirtualFileSystem`, live: preview, download, delete, upload. |
|
|
795
814
|
| `<LearnedSkills>` | The agent's notebook (`learning`): its lessons, where each came from, forget. |
|
|
796
815
|
| `<ContextMeter>` | Tokens by kind, budget bar, last compaction, Compact. |
|
|
@@ -898,6 +917,29 @@ the control each is drawn as), `elicitationInitialDraft` (the defaults), `elicit
|
|
|
898
917
|
(the answer, or an issue per field), `elicitationLink` (host, address, whether it may be opened)
|
|
899
918
|
and `formatCountdown`.
|
|
900
919
|
|
|
920
|
+
## Several tabs
|
|
921
|
+
|
|
922
|
+
An installed PWA window and a browser tab of the same site share the agent's IndexedDB. With the
|
|
923
|
+
core's [several-tabs support](https://github.com/dudko-dev/agents/blob/main/packages/agent-web/docs/capabilities.md#several-tabs)
|
|
924
|
+
the hooks keep them in step, with nothing to configure beyond a shared `memory`
|
|
925
|
+
(`new IndexedDBStore()`):
|
|
926
|
+
|
|
927
|
+
- **The conversation's run in another tab shows here live** (`useAgent`'s `remote`): its steps and
|
|
928
|
+
answer stream in, `isRunning` is true, the composer's text goes to that run (`sendRemote`, shown
|
|
929
|
+
there "from another tab") and Stop stops it (`stopRemote`); `stop()` / `send()` stay this tab's.
|
|
930
|
+
Its consent requests are shown as waiting there and are answered only there. When it ends, the
|
|
931
|
+
chat is read again from what that tab saved. `watch: false` switches this off.
|
|
932
|
+
- **One run per conversation.** A run started here while the conversation runs elsewhere waits
|
|
933
|
+
for it (`sessionBusy`, "Waiting for the other tab to finish this conversation…", the goal shown
|
|
934
|
+
queued) and then goes, with that turn in the agent's memory; a saved chat keeps both turns, in
|
|
935
|
+
order (`saveChat`: one transaction, merged by message identity).
|
|
936
|
+
- **What another tab changed appears here without a reload:** a key in the vault
|
|
937
|
+
(`useCredentials().version`), the files (`useVirtualFiles`), the saved chats (`useChatHistory`),
|
|
938
|
+
the agent's notebook (`learned`, through `agent.reloadLearnedSkills()`).
|
|
939
|
+
|
|
940
|
+
`<AgentChat>` shows the notes above the composer (`showOtherTabs`; labels `remoteRunning`,
|
|
941
|
+
`remoteWaitingConsent`, `remoteGone`, `sessionBusy`, `fromAnotherTab`). Details: [docs/chat.md](docs/chat.md#several-tabs).
|
|
942
|
+
|
|
901
943
|
## How it fits together
|
|
902
944
|
|
|
903
945
|
```
|
|
@@ -82,6 +82,33 @@ var formatProbability = (p) => String(Math.round(p * 100) / 100);
|
|
|
82
82
|
|
|
83
83
|
// src/util.ts
|
|
84
84
|
var errMessage = (err) => err instanceof Error ? err.message : String(err);
|
|
85
|
+
var coalesce = (fn, ms = 100) => {
|
|
86
|
+
let timer;
|
|
87
|
+
return {
|
|
88
|
+
call: () => {
|
|
89
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
90
|
+
timer = setTimeout(() => {
|
|
91
|
+
timer = void 0;
|
|
92
|
+
fn();
|
|
93
|
+
}, ms);
|
|
94
|
+
},
|
|
95
|
+
cancel: () => {
|
|
96
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
97
|
+
timer = void 0;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
var listenToOtherTabs = (core, dbName, listener) => typeof core.onStorageChange === "function" && dbName ? core.onStorageChange(dbName, listener) : () => void 0;
|
|
102
|
+
var followOtherTabs = (core, dbName, accept, settle, ms = 100) => {
|
|
103
|
+
const later = coalesce(settle, ms);
|
|
104
|
+
const off = listenToOtherTabs(core, dbName, (change) => {
|
|
105
|
+
if (accept(change)) later.call();
|
|
106
|
+
});
|
|
107
|
+
return () => {
|
|
108
|
+
off();
|
|
109
|
+
later.cancel();
|
|
110
|
+
};
|
|
111
|
+
};
|
|
85
112
|
|
|
86
113
|
// src/components/icons.tsx
|
|
87
114
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -214,6 +241,7 @@ var MessageIcon = ({ size, className }) => /* @__PURE__ */ jsx("svg", { ...base(
|
|
|
214
241
|
|
|
215
242
|
export {
|
|
216
243
|
errMessage,
|
|
244
|
+
followOtherTabs,
|
|
217
245
|
SendIcon,
|
|
218
246
|
StopIcon,
|
|
219
247
|
SpinnerIcon,
|
|
@@ -261,4 +289,4 @@ export {
|
|
|
261
289
|
webSearchOf,
|
|
262
290
|
formatProbability
|
|
263
291
|
};
|
|
264
|
-
//# sourceMappingURL=chunk-
|
|
292
|
+
//# sourceMappingURL=chunk-G5GGIMD4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/format.ts","../src/util.ts","../src/components/icons.tsx"],"sourcesContent":["/** Compact one-line preview of a tool input/output value, truncated. */\nexport const previewValue = (value: unknown, max = 140): string => {\n if (value === undefined) return ''\n let text: string\n if (typeof value === 'string') text = value\n else {\n try {\n text = JSON.stringify(value)\n } catch {\n text = String(value)\n }\n }\n text = text.replace(/\\s+/g, ' ').trim()\n return text.length > max ? `${text.slice(0, max - 1)}…` : text\n}\n\n/** 1234 → \"1.2k\", 12345 → \"12k\". */\nexport const formatTokens = (n: number): string =>\n n >= 1000 ? `${(n / 1000).toFixed(n >= 10_000 ? 0 : 1)}k` : String(n)\n\n/** 340 → \"340 ms\", 4200 → \"4.2 s\", 125_000 → \"2m 5s\". */\nexport const formatDuration = (ms: number): string => {\n if (ms < 1000) return `${Math.round(ms)} ms`\n if (ms < 60_000) return `${(ms / 1000).toFixed(ms < 10_000 ? 1 : 0)} s`\n const s = Math.round(ms / 1000)\n return `${Math.floor(s / 60)}m ${s % 60}s`\n}\n\nconst isDataImage = (v: unknown): v is string =>\n typeof v === 'string' && /^data:image\\/[\\w.+-]+;base64,/.test(v)\n\n/**\n * Images inside a tool result, as data URLs: MCP image parts\n * (`{ type: 'image', data, mimeType }`), data-URL strings, and objects that\n * carry one (`{ dataUrl }` / `{ url: 'data:…' }`). Looks two levels deep.\n */\nexport const imagesInOutput = (output: unknown, depth = 0): string[] => {\n if (depth > 2 || output == null) return []\n if (isDataImage(output)) return [output]\n if (Array.isArray(output)) return output.flatMap((v) => imagesInOutput(v, depth + 1))\n if (typeof output === 'object') {\n const o = output as Record<string, unknown>\n if (o.type === 'image' && typeof o.data === 'string') {\n const mime = typeof o.mimeType === 'string' ? o.mimeType : 'image/png'\n return [o.data.startsWith('data:') ? o.data : `data:${mime};base64,${o.data}`]\n }\n for (const key of ['dataUrl', 'url', 'image'])\n if (isDataImage(o[key])) return [o[key] as string]\n if (depth < 2) return Object.values(o).flatMap((v) => imagesInOutput(v, depth + 1))\n }\n return []\n}\n\n/** One result of the core's `web_search` tool, as far as a UI shows it. */\nexport interface WebSearchResultView {\n title: string\n /** An http(s) address - anything else is left out. */\n url: string\n /** The host of `url`, for the line under the title. */\n host: string\n snippet: string\n date?: string\n}\n\nexport interface WebSearchView {\n query: string\n results: WebSearchResultView[]\n /** Results the egress policy left out. */\n filtered: number\n truncated: boolean\n}\n\nconst text = (v: unknown, max: number): string =>\n typeof v === 'string' ? v.replace(/\\s+/g, ' ').trim().slice(0, max) : ''\n\n/**\n * The result of the core's `web_search` tool (`{ query, results: [{ title, url, snippet, date? }],\n * filtered?, truncated?, untrusted: true }`), or undefined when `output` is not one. Titles and\n * snippets are third-party text: they come back as plain strings, to be rendered as text. A\n * result whose `url` is not http(s) is dropped, so a link can never be a `javascript:` one.\n */\nexport const webSearchOf = (output: unknown): WebSearchView | undefined => {\n let value = output\n if (typeof value === 'string') {\n try {\n value = JSON.parse(value)\n } catch {\n return undefined\n }\n }\n if (!value || typeof value !== 'object' || Array.isArray(value)) return undefined\n const o = value as Record<string, unknown>\n if (typeof o.query !== 'string' || !Array.isArray(o.results)) return undefined\n const results: WebSearchResultView[] = []\n for (const r of o.results.slice(0, 10)) {\n if (!r || typeof r !== 'object') continue\n const item = r as Record<string, unknown>\n if (typeof item.url !== 'string') continue\n let url: URL\n try {\n url = new URL(item.url)\n } catch {\n continue\n }\n if (url.protocol !== 'https:' && url.protocol !== 'http:') continue\n const date = text(item.date, 40)\n results.push({\n title: text(item.title, 200) || url.host,\n url: url.href,\n host: url.host,\n snippet: text(item.snippet, 400),\n ...(date ? { date } : {}),\n })\n }\n return {\n query: text(o.query, 300),\n results,\n filtered: typeof o.filtered === 'number' && o.filtered > 0 ? o.filtered : 0,\n truncated: o.truncated === true,\n }\n}\n\n/** 0.934 → \"0.93\", 0.8 → \"0.8\", 1 → \"1\". */\nexport const formatProbability = (p: number): string => String(Math.round(p * 100) / 100)\n","/** Normalize any thrown value into a message string. */\nexport const errMessage = (err: unknown): string =>\n err instanceof Error ? err.message : String(err)\n\n/**\n * Calls `fn` once, `ms` after the LAST of a burst of calls (trailing): another tab writing a file\n * per tool call, or a chat per settled run, refreshes a view once, not once per notice. `cancel`\n * drops a pending call (on unmount).\n */\nexport const coalesce = (fn: () => void, ms = 100): { call: () => void; cancel: () => void } => {\n let timer: ReturnType<typeof setTimeout> | undefined\n return {\n call: () => {\n if (timer !== undefined) clearTimeout(timer)\n timer = setTimeout(() => {\n timer = undefined\n fn()\n }, ms)\n },\n cancel: () => {\n if (timer !== undefined) clearTimeout(timer)\n timer = undefined\n },\n }\n}\n\n/**\n * The core's `onStorageChange`, or a no-op where the core predates it (the hooks then work as\n * before: this tab's own changes only). One place for the guard every hook needs.\n */\nexport const listenToOtherTabs = (\n core: { onStorageChange?: unknown },\n dbName: string | undefined,\n listener: (change: { kind: string; op: string; key?: string; namespace?: string }) => void,\n): (() => void) =>\n typeof core.onStorageChange === 'function' && dbName\n ? (core.onStorageChange as (db: string, l: typeof listener) => () => void)(dbName, listener)\n : () => undefined\n\n/**\n * Follow another tab's writes to one database: `accept` sees every notice (and says whether it\n * matters here), `settle` runs once, ~`ms` after the last accepted one of a burst. What every hook\n * that follows other tabs uses. The returned function unsubscribes and drops a pending settle.\n */\nexport const followOtherTabs = (\n core: { onStorageChange?: unknown },\n dbName: string | undefined,\n accept: (change: { kind: string; op: string; key?: string; namespace?: string }) => boolean,\n settle: () => void,\n ms = 100,\n): (() => void) => {\n const later = coalesce(settle, ms)\n const off = listenToOtherTabs(core, dbName, (change) => {\n if (accept(change)) later.call()\n })\n return () => {\n off()\n later.cancel()\n }\n}\n","// Tiny inline SVG icons — no icon-font or image dependency. Each inherits the\n// current text color (`stroke=\"currentColor\"`) and takes an optional size.\n\nexport interface IconProps {\n size?: number\n className?: string\n}\n\nconst base = (size = 16) => ({\n width: size,\n height: size,\n viewBox: '0 0 24 24',\n fill: 'none',\n stroke: 'currentColor',\n strokeWidth: 2,\n strokeLinecap: 'round' as const,\n strokeLinejoin: 'round' as const,\n 'aria-hidden': true,\n})\n\nexport const SendIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <path d=\"M22 2 11 13\" />\n <path d=\"M22 2 15 22l-4-9-9-4Z\" />\n </svg>\n)\n\nexport const StopIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <rect x=\"6\" y=\"6\" width=\"12\" height=\"12\" rx=\"2\" />\n </svg>\n)\n\nexport const SpinnerIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={['awr-spin', className].filter(Boolean).join(' ')}>\n <path d=\"M21 12a9 9 0 1 1-6.219-8.56\" />\n </svg>\n)\n\nexport const CheckIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n)\n\nexport const AlertIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <path d=\"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z\" />\n <path d=\"M12 9v4\" />\n <path d=\"M12 17h.01\" />\n </svg>\n)\n\nexport const ArrowUpIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <path d=\"M12 19V5\" />\n <path d=\"m5 12 7-7 7 7\" />\n </svg>\n)\n\nexport const ToolIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <path d=\"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76Z\" />\n </svg>\n)\n\nexport const ChevronIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n)\n\nexport const ShieldIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <path d=\"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z\" />\n </svg>\n)\n\nexport const BrainIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <path d=\"M9 3a3 3 0 0 0-3 3 3 3 0 0 0-2 5 3 3 0 0 0 2 5 3 3 0 0 0 6 1V4a3 3 0 0 0-3-1Z\" />\n <path d=\"M15 3a3 3 0 0 1 3 3 3 3 0 0 1 2 5 3 3 0 0 1-2 5 3 3 0 0 1-6 1\" />\n </svg>\n)\n\nexport const BotIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <rect x=\"4\" y=\"8\" width=\"16\" height=\"12\" rx=\"3\" />\n <path d=\"M12 8V4\" />\n <path d=\"M9 14h.01M15 14h.01\" />\n </svg>\n)\n\nexport const PlusIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <path d=\"M12 5v14M5 12h14\" />\n </svg>\n)\n\nexport const SlashIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"3\" />\n <path d=\"m15 7-6 10\" />\n </svg>\n)\n\nexport const ClockIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <circle cx=\"12\" cy=\"12\" r=\"9\" />\n <path d=\"M12 7v5l3 2\" />\n </svg>\n)\n\nexport const MicIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <rect x=\"9\" y=\"3\" width=\"6\" height=\"11\" rx=\"3\" />\n <path d=\"M5 11a7 7 0 0 0 14 0M12 18v3\" />\n </svg>\n)\n\nexport const BoltIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <path d=\"M13 2 4 14h7l-1 8 9-12h-7Z\" />\n </svg>\n)\n\nexport const EyeIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <path d=\"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12Z\" />\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n </svg>\n)\n\nexport const XIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <path d=\"M18 6 6 18M6 6l12 12\" />\n </svg>\n)\n\nexport const FileIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <path d=\"M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9Z\" />\n <path d=\"M14 3v6h6\" />\n </svg>\n)\n\nexport const HistoryIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <path d=\"M3 12a9 9 0 1 0 3-6.7L3 8\" />\n <path d=\"M3 3v5h5M12 7v5l3 2\" />\n </svg>\n)\n\nexport const BookIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <path d=\"M4 5a2 2 0 0 1 2-2h13v16H6a2 2 0 0 0-2 2Z\" />\n <path d=\"M4 19V5M9 7h6\" />\n </svg>\n)\n\nexport const GlobeIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <circle cx=\"12\" cy=\"12\" r=\"9\" />\n <path d=\"M3 12h18M12 3c3 3.2 3 14.8 0 18M12 3c-3 3.2-3 14.8 0 18\" />\n </svg>\n)\n\nexport const DownloadIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <path d=\"M12 3v12m-5-5 5 5 5-5M5 21h14\" />\n </svg>\n)\n\nexport const QuestionIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <path d=\"M21 15a2 2 0 0 1-2 2H8l-5 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2Z\" />\n <path d=\"M9.6 8a2.5 2.5 0 0 1 4.8.8c0 1.7-2.4 2-2.4 3.4\" />\n <path d=\"M12 14.6h.01\" />\n </svg>\n)\n\nexport const ExternalIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <path d=\"M15 3h6v6\" />\n <path d=\"M10 14 21 3\" />\n <path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\" />\n </svg>\n)\n\nexport const CodeIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <path d=\"m8 7-5 5 5 5M16 7l5 5-5 5\" />\n </svg>\n)\n\nexport const FileTextIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <path d=\"M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9Z\" />\n <path d=\"M14 3v6h6M8 13h8M8 17h6\" />\n </svg>\n)\n\nexport const TableIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2\" />\n <path d=\"M3 10h18M3 15h18M9 4v16M15 4v16\" />\n </svg>\n)\n\nexport const ImageIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2\" />\n <circle cx=\"9\" cy=\"10\" r=\"1.6\" />\n <path d=\"m4 18 5.5-5 4 3.5 2.5-2 4 3.5\" />\n </svg>\n)\n\nexport const ChevronUpIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <path d=\"m6 15 6-6 6 6\" />\n </svg>\n)\n\nexport const LockIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <rect x=\"5\" y=\"11\" width=\"14\" height=\"9\" rx=\"2\" />\n <path d=\"M8 11V8a4 4 0 0 1 8 0v3\" />\n </svg>\n)\n\nexport const NoNetworkIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <circle cx=\"12\" cy=\"12\" r=\"9\" />\n <path d=\"M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18M4 4l16 16\" />\n </svg>\n)\n\nexport const ExpandIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <path d=\"M8 3H4v4M16 3h4v4M8 21H4v-4M16 21h4v-4\" />\n </svg>\n)\n\n/** Four corners inward: leave full screen. */\nexport const ShrinkIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <path d=\"M4 8h4V4M20 8h-4V4M4 16h4v4M20 16h-4v4\" />\n </svg>\n)\n\n// ── MCP Apps ─────────────────────────────────────────────────────────────────\n\n/** A window: an app a server shipped. */\nexport const AppIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"3\" />\n <path d=\"M3 9h18M8 6h.01\" />\n </svg>\n)\n\nexport const MoreIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <circle cx=\"5\" cy=\"12\" r=\"1\" />\n <circle cx=\"12\" cy=\"12\" r=\"1\" />\n <circle cx=\"19\" cy=\"12\" r=\"1\" />\n </svg>\n)\n\nexport const ReloadIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <path d=\"M3 12a9 9 0 0 1 15.5-6.2L21 8M21 3v5h-5M21 12a9 9 0 0 1-15.5 6.2L3 16M3 21v-5h5\" />\n </svg>\n)\n\n/** A side panel. */\nexport const PanelIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2\" />\n <path d=\"M14 4v16\" />\n </svg>\n)\n\nexport const EyeOffIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <path d=\"M10.6 5.1A9.8 9.8 0 0 1 12 5c6.4 0 10 7 10 7a17 17 0 0 1-3 3.8M6.5 6.6A16.6 16.6 0 0 0 2 12s3.6 7 10 7a9.7 9.7 0 0 0 5.3-1.6M3 3l18 18\" />\n </svg>\n)\n\nexport const MessageIcon = ({ size, className }: IconProps) => (\n <svg {...base(size)} className={className}>\n <path d=\"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z\" />\n </svg>\n)\n"],"mappings":";AACO,IAAM,eAAe,CAAC,OAAgB,MAAM,QAAgB;AACjE,MAAI,UAAU,OAAW,QAAO;AAChC,MAAIA;AACJ,MAAI,OAAO,UAAU,SAAU,CAAAA,QAAO;AAAA,OACjC;AACH,QAAI;AACF,MAAAA,QAAO,KAAK,UAAU,KAAK;AAAA,IAC7B,QAAQ;AACN,MAAAA,QAAO,OAAO,KAAK;AAAA,IACrB;AAAA,EACF;AACA,EAAAA,QAAOA,MAAK,QAAQ,QAAQ,GAAG,EAAE,KAAK;AACtC,SAAOA,MAAK,SAAS,MAAM,GAAGA,MAAK,MAAM,GAAG,MAAM,CAAC,CAAC,WAAMA;AAC5D;AAGO,IAAM,eAAe,CAAC,MAC3B,KAAK,MAAO,IAAI,IAAI,KAAM,QAAQ,KAAK,MAAS,IAAI,CAAC,CAAC,MAAM,OAAO,CAAC;AAG/D,IAAM,iBAAiB,CAAC,OAAuB;AACpD,MAAI,KAAK,IAAM,QAAO,GAAG,K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MAAK,IAAG,MAAK,GAAE,KAAI;AAAA,GAChC;AAGK,IAAM,aAAa,CAAC,EAAE,MAAM,UAAU,MAC3C,oBAAC,SAAK,GAAG,KAAK,IAAI,GAAG,WACnB,8BAAC,UAAK,GAAE,mFAAkF,GAC5F;AAIK,IAAM,YAAY,CAAC,EAAE,MAAM,UAAU,MAC1C,qBAAC,SAAK,GAAG,KAAK,IAAI,GAAG,WACnB;AAAA,sBAAC,UAAK,GAAE,KAAI,GAAE,KAAI,OAAM,MAAK,QAAO,MAAK,IAAG,KAAI;AAAA,EAChD,oBAAC,UAAK,GAAE,YAAW;AAAA,GACrB;AAGK,IAAM,aAAa,CAAC,EAAE,MAAM,UAAU,MAC3C,oBAAC,SAAK,GAAG,KAAK,IAAI,GAAG,WACnB,8BAAC,UAAK,GAAE,0IAAyI,GACnJ;AAGK,IAAM,cAAc,CAAC,EAAE,MAAM,UAAU,MAC5C,oBAAC,SAAK,GAAG,KAAK,IAAI,GAAG,WACnB,8BAAC,UAAK,GAAE,iEAAgE,GAC1E;","names":["text"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { McpAppCsp, McpAppResource, McpAppToolResult, AppSamplingView, AppToolCallRequest, AppSamplingRequest, AppSamplingResult, AgentToolSet, IPlan, IPlanStep, ModelTier, TierReason, EscalationReason, DecisionPoint, DecisionFallbackReason, McpSkillConsentView, IUsage, ReplanMode, AgentEvent } from '@dudko.dev/agent-web';
|
|
1
|
+
import { McpAppCsp, McpAppResource, McpAppToolResult, AppSamplingView, AppToolCallRequest, AppSamplingRequest, AppSamplingResult, AgentToolSet, IPlan, IPlanStep, ModelTier, TierReason, EscalationReason, DecisionPoint, DecisionFallbackReason, McpSkillConsentView, IUsage, ReplanMode, AgentEvent, SessionHolder } 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
|
|
@@ -672,11 +672,13 @@ interface McpHttpServerConfig {
|
|
|
672
672
|
* EXPERIMENTAL: load the server's skills (the `io.modelcontextprotocol/skills` extension) into
|
|
673
673
|
* the agent's catalog, as `<server>/<skill>` (cores with MCP skills; an older one ignores the
|
|
674
674
|
* field). Needs `protocol: 'auto'` or `'modern'`. The hooks set it only for a server that was
|
|
675
|
-
* given `skills` (`true`, or `{ consent }` - a core with skill consent; an older one
|
|
676
|
-
* object as off).
|
|
675
|
+
* given `skills` (`true`, or `{ consent, dynamic }` - a core with skill consent; an older one
|
|
676
|
+
* reads any object as off). `dynamic: true` also takes the server's generated skills (a core
|
|
677
|
+
* with snapshots of them; an older one ignores it and declines them).
|
|
677
678
|
*/
|
|
678
679
|
skills?: true | {
|
|
679
680
|
consent?: 'ask' | 'once-per-skill' | 'never';
|
|
681
|
+
dynamic?: boolean;
|
|
680
682
|
};
|
|
681
683
|
/**
|
|
682
684
|
* MCP Apps for this server alone, over the connection's `apps` (cores with per-server apps;
|
|
@@ -872,6 +874,11 @@ interface ChatMessage {
|
|
|
872
874
|
content: string;
|
|
873
875
|
/** An assistant message that is still streaming (no final/stopped/error yet). */
|
|
874
876
|
pending: boolean;
|
|
877
|
+
/**
|
|
878
|
+
* A turn of a run in another tab, as relayed here (`AgentUiState.remote`): that tab saves it.
|
|
879
|
+
* `useChatHistory` saves a chat from here with that tab's own copy, never this one.
|
|
880
|
+
*/
|
|
881
|
+
remote?: true;
|
|
875
882
|
/** User turn: what was attached (images, files). */
|
|
876
883
|
attachments?: ChatAttachment[];
|
|
877
884
|
/** Assistant turn: the run's steps — tool calls, thoughts, subagents — as they happened. */
|
|
@@ -1100,6 +1107,12 @@ interface ApprovalView {
|
|
|
1100
1107
|
tool: string;
|
|
1101
1108
|
resourceUri: string;
|
|
1102
1109
|
};
|
|
1110
|
+
/**
|
|
1111
|
+
* Asked in another tab, by a run of this conversation going on there (`AgentUiState.remote`):
|
|
1112
|
+
* shown, never answered here - consent stays with the tab that runs the tool. `useAgent`'s
|
|
1113
|
+
* `pendingApprovals` leaves it out.
|
|
1114
|
+
*/
|
|
1115
|
+
remote?: true;
|
|
1103
1116
|
/**
|
|
1104
1117
|
* Set when the request is about an MCP server's skill about to enter the model's context, not
|
|
1105
1118
|
* a tool call (the core's `ToolApprovalRequest.skill`): the server, the skill, its description,
|
|
@@ -1132,6 +1145,8 @@ interface ElicitationView {
|
|
|
1132
1145
|
requestedSchema?: McpElicitationSchema;
|
|
1133
1146
|
/** URL mode: the link the server wants opened. Nothing opens it for the user. */
|
|
1134
1147
|
url?: string;
|
|
1148
|
+
/** Asked in another tab, by a run followed here (`AgentUiState.remote`): answered there. */
|
|
1149
|
+
remote?: true;
|
|
1135
1150
|
/** The step the tool call belongs to, when known. */
|
|
1136
1151
|
stepId?: string;
|
|
1137
1152
|
/** Set when a helper (a subagent) is the one whose call asks. */
|
|
@@ -1153,6 +1168,8 @@ interface ElicitationView {
|
|
|
1153
1168
|
interface QueuedMessageView {
|
|
1154
1169
|
id: string;
|
|
1155
1170
|
text: string;
|
|
1171
|
+
/** Another tab of the site sent it to this run (the core's session relay). */
|
|
1172
|
+
origin?: 'another-tab';
|
|
1156
1173
|
}
|
|
1157
1174
|
/**
|
|
1158
1175
|
* A message the user sent while the run was going, after it reached the agent.
|
|
@@ -1166,6 +1183,8 @@ interface UserNoteView {
|
|
|
1166
1183
|
at: 'round' | 'step' | 'final';
|
|
1167
1184
|
/** The step it was delivered in (`round`) or after (`step`); none for `final`. */
|
|
1168
1185
|
stepId?: string;
|
|
1186
|
+
/** Another tab of the site sent it (the core's session relay). */
|
|
1187
|
+
origin?: 'another-tab';
|
|
1169
1188
|
}
|
|
1170
1189
|
/**
|
|
1171
1190
|
* A delegated task running in a subagent: one the host defined (`createSubagentTool`, in-process
|
|
@@ -1386,6 +1405,42 @@ interface AgentUiState {
|
|
|
1386
1405
|
events: AgentEvent[];
|
|
1387
1406
|
/** Monotonic counter; mints stable message ids without Date/Math.random. */
|
|
1388
1407
|
seq: number;
|
|
1408
|
+
/**
|
|
1409
|
+
* The run in view is another tab's: this conversation runs in another tab of the origin, and
|
|
1410
|
+
* `useAgent` follows it (the core's `watchSession`) - its steps, answer and usage are folded
|
|
1411
|
+
* into the rest of the state like a run of this tab's. Absent once a run of this tab starts or
|
|
1412
|
+
* a chat is loaded.
|
|
1413
|
+
*/
|
|
1414
|
+
remote?: RemoteRunView;
|
|
1415
|
+
/**
|
|
1416
|
+
* This tab's run waits for the session: another run of it is going (`session.busy`) - in
|
|
1417
|
+
* another tab, or in this one. Cleared when it gets the session, or is stopped.
|
|
1418
|
+
*/
|
|
1419
|
+
sessionBusy?: {
|
|
1420
|
+
heldBy: SessionHolder;
|
|
1421
|
+
goal?: string;
|
|
1422
|
+
};
|
|
1423
|
+
/**
|
|
1424
|
+
* The turn the user just sent, shown at once while the run gets going (its `run.start` comes
|
|
1425
|
+
* after the session's lock is granted - a round trip to the browser's lock manager): the ids of
|
|
1426
|
+
* its user and pending assistant messages. `run.start` replaces them; a wait for the session
|
|
1427
|
+
* turns the text into a queued item instead.
|
|
1428
|
+
*/
|
|
1429
|
+
submitted?: {
|
|
1430
|
+
userId: string;
|
|
1431
|
+
assistantId: string;
|
|
1432
|
+
};
|
|
1433
|
+
}
|
|
1434
|
+
/** Another tab's run of this conversation, as this tab sees it. */
|
|
1435
|
+
interface RemoteRunView {
|
|
1436
|
+
/** It is going now (`useAgent` reports `isRunning`; `send` / `stop` go to that tab). */
|
|
1437
|
+
running: boolean;
|
|
1438
|
+
runId?: string;
|
|
1439
|
+
/**
|
|
1440
|
+
* How it ended: `done`, `stopped`, or `gone` - that tab closed or crashed before it said so
|
|
1441
|
+
* (its answer, if any, is what had arrived).
|
|
1442
|
+
*/
|
|
1443
|
+
ended?: 'done' | 'stopped' | 'gone';
|
|
1389
1444
|
}
|
|
1390
1445
|
|
|
1391
1446
|
/**
|
|
@@ -1531,5 +1586,5 @@ type ElicitationOutcomeReason = 'timeout' | 'step-timeout' | 'aborted' | 'stoppe
|
|
|
1531
1586
|
/** "4:05" - what is left of a question's time. */
|
|
1532
1587
|
declare const formatCountdown: (ms: number) => string;
|
|
1533
1588
|
|
|
1534
|
-
export {
|
|
1535
|
-
export type { AgentUiState as A, BudgetView as B, ChatAttachment as C, DecisionView as D, ElicitationIssueKind as E, AppResourceReader as F, ElicitationControl as G, ElicitationDraft as H, ElicitationDraftValue as I, ElicitationField as J, ElicitationFormOutcome as K, LessonView as L, McpAppSandboxReason as M, ElicitationIssue as N, ElicitationLink as O, PendingElicitation as P, ElicitationOption as Q,
|
|
1589
|
+
export { MCP_APP_MAX_IN_FLIGHT as $, MCP_APP_DISPLAY_MODES as X, MCP_APP_MAX_ARGS_CHARS as Y, MCP_APP_MAX_DOWNLOAD_BYTES as Z, MCP_APP_MAX_FILE_NAME_CHARS as _, MCP_APP_MAX_MESSAGE_CHARS as a0, MCP_APP_MAX_URL_CHARS as a1, MCP_APP_NOTIFICATIONS as a2, MCP_APP_OPTIONAL_REQUESTS as a3, MCP_APP_PROTOCOL_VERSION as a4, MCP_APP_REFUSED as a5, MCP_APP_REFUSED_DOWNLOAD_EXTENSIONS as a6, MCP_APP_REFUSED_DOWNLOAD_TYPES as a7, MCP_APP_RELAY as a8, MCP_APP_REQUESTS as a9, appFileNameOf as aA, appGestureOf as aB, appLinkOf as aC, appMessageTextOf as aD, appMimeTypeOf as aE, appSamplingErrorOf as aF, buildMcpAppDocument as aG, buildMcpAppSandboxShell as aH, clampAppHeight as aI, elicitationFields as aJ, elicitationFormAnswer as aK, elicitationInitialDraft as aL, elicitationLink as aM, formatCountdown as aN, grantedAppCsp as aO, mcpAppCsp as aP, mcpAppHostCapabilities as aQ, mcpAppSandboxProxyUrl as aR, mcpAppSandboxShellCsp as aS, mcpAppSandboxTarget as aT, resolveAppDownload as aU, saveAppFile as aV, useMcpAppHost as aW, MCP_APP_SANDBOX_FRAME_TOKENS as aa, MCP_APP_SANDBOX_GRACE_MS as ab, MCP_APP_SANDBOX_SERVER as ac, MCP_APP_SANDBOX_TIMEOUT_MS as ad, McpAppBridge as ae, McpAppRpcError as ai, McpAppSandboxLink as al, appDisplayModeAllowed as aw, appDownloadOf as ax, appDownloadRefusal as ay, appFileExtensionOf as az, createElicitationQueue as bb, elicitationConnectOptions as bc, elicitationSettings as bd, elicitationTimeoutOf as be, APP_DEFAULT_HEIGHT as s, APP_MAX_HEIGHT as t, APP_MIN_HEIGHT as u };
|
|
1590
|
+
export type { AgentUiState as A, BudgetView as B, ChatAttachment as C, DecisionView as D, ElicitationIssueKind as E, AppResourceReader as F, ElicitationControl as G, ElicitationDraft as H, ElicitationDraftValue as I, ElicitationField as J, ElicitationFormOutcome as K, LessonView as L, McpAppSandboxReason as M, ElicitationIssue as N, ElicitationLink as O, PendingElicitation as P, ElicitationOption as Q, RemoteRunView as R, SubagentView as S, ToolCallView as T, UserNoteView as U, FetchView as V, WrittenFileView as W, ApprovalView as a, McpServerProtocol as a$, McpOAuthRegistration as aX, McpProtocolMode as aY, McpElicitationOptions as aZ, McpCatalogEntry as a_, McpAppBridgeHandlers as af, McpAppBridgeOptions as ag, McpAppDisplayMode as ah, McpAppRpcMessage as aj, McpAppSandboxInput as ak, McpAppSandboxLinkOptions as am, McpAppSandboxTarget as an, McpElicitationFieldSchema as ao, McpElicitationRequest as ap, McpElicitationSchema as aq, QueuedMessageView as ar, ReplanState as as, SkillConsentView as at, StepEscalationView as au, UseMcpAppHostOptions as av, ChatMessage as b, McpOAuthRegistrationKind as b0, McpOAuthCallback as b1, McpServerResult as b2, McpModule as b3, ConnectedMcp as b4, BrowserOAuthProviderOptions as b5, BrowserOAuthProvider as b6, ElicitationQueue as b7, ElicitationQueueOptions as b8, McpElicitationHandler as b9, McpServerInstructions as ba, AgentStatus as c, ElicitationOutcomeReason as d, SubagentNode as e, McpElicitationResult as f, ElicitationView as g, StepView as h, MediaView as i, AppView as j, McpAppsConnectionLike as k, McpAppSandboxOptions as l, AppRequestView as m, TranscriptView as n, CompactionView as o, ModelLoadState as p, McpAppHost as q, AppRequestAnswerOptions as r, AppDownload as v, AppDownloadView as w, AppFileSaverEnv as x, AppLink as y, AppReadyDownload as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { McpAppCsp, McpAppResource, McpAppToolResult, AppSamplingView, AppToolCallRequest, AppSamplingRequest, AppSamplingResult, AgentToolSet, IPlan, IPlanStep, ModelTier, TierReason, EscalationReason, DecisionPoint, DecisionFallbackReason, McpSkillConsentView, IUsage, ReplanMode, AgentEvent } from '@dudko.dev/agent-web';
|
|
1
|
+
import { McpAppCsp, McpAppResource, McpAppToolResult, AppSamplingView, AppToolCallRequest, AppSamplingRequest, AppSamplingResult, AgentToolSet, IPlan, IPlanStep, ModelTier, TierReason, EscalationReason, DecisionPoint, DecisionFallbackReason, McpSkillConsentView, IUsage, ReplanMode, AgentEvent, SessionHolder } 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
|
|
@@ -672,11 +672,13 @@ interface McpHttpServerConfig {
|
|
|
672
672
|
* EXPERIMENTAL: load the server's skills (the `io.modelcontextprotocol/skills` extension) into
|
|
673
673
|
* the agent's catalog, as `<server>/<skill>` (cores with MCP skills; an older one ignores the
|
|
674
674
|
* field). Needs `protocol: 'auto'` or `'modern'`. The hooks set it only for a server that was
|
|
675
|
-
* given `skills` (`true`, or `{ consent }` - a core with skill consent; an older one
|
|
676
|
-
* object as off).
|
|
675
|
+
* given `skills` (`true`, or `{ consent, dynamic }` - a core with skill consent; an older one
|
|
676
|
+
* reads any object as off). `dynamic: true` also takes the server's generated skills (a core
|
|
677
|
+
* with snapshots of them; an older one ignores it and declines them).
|
|
677
678
|
*/
|
|
678
679
|
skills?: true | {
|
|
679
680
|
consent?: 'ask' | 'once-per-skill' | 'never';
|
|
681
|
+
dynamic?: boolean;
|
|
680
682
|
};
|
|
681
683
|
/**
|
|
682
684
|
* MCP Apps for this server alone, over the connection's `apps` (cores with per-server apps;
|
|
@@ -872,6 +874,11 @@ interface ChatMessage {
|
|
|
872
874
|
content: string;
|
|
873
875
|
/** An assistant message that is still streaming (no final/stopped/error yet). */
|
|
874
876
|
pending: boolean;
|
|
877
|
+
/**
|
|
878
|
+
* A turn of a run in another tab, as relayed here (`AgentUiState.remote`): that tab saves it.
|
|
879
|
+
* `useChatHistory` saves a chat from here with that tab's own copy, never this one.
|
|
880
|
+
*/
|
|
881
|
+
remote?: true;
|
|
875
882
|
/** User turn: what was attached (images, files). */
|
|
876
883
|
attachments?: ChatAttachment[];
|
|
877
884
|
/** Assistant turn: the run's steps — tool calls, thoughts, subagents — as they happened. */
|
|
@@ -1100,6 +1107,12 @@ interface ApprovalView {
|
|
|
1100
1107
|
tool: string;
|
|
1101
1108
|
resourceUri: string;
|
|
1102
1109
|
};
|
|
1110
|
+
/**
|
|
1111
|
+
* Asked in another tab, by a run of this conversation going on there (`AgentUiState.remote`):
|
|
1112
|
+
* shown, never answered here - consent stays with the tab that runs the tool. `useAgent`'s
|
|
1113
|
+
* `pendingApprovals` leaves it out.
|
|
1114
|
+
*/
|
|
1115
|
+
remote?: true;
|
|
1103
1116
|
/**
|
|
1104
1117
|
* Set when the request is about an MCP server's skill about to enter the model's context, not
|
|
1105
1118
|
* a tool call (the core's `ToolApprovalRequest.skill`): the server, the skill, its description,
|
|
@@ -1132,6 +1145,8 @@ interface ElicitationView {
|
|
|
1132
1145
|
requestedSchema?: McpElicitationSchema;
|
|
1133
1146
|
/** URL mode: the link the server wants opened. Nothing opens it for the user. */
|
|
1134
1147
|
url?: string;
|
|
1148
|
+
/** Asked in another tab, by a run followed here (`AgentUiState.remote`): answered there. */
|
|
1149
|
+
remote?: true;
|
|
1135
1150
|
/** The step the tool call belongs to, when known. */
|
|
1136
1151
|
stepId?: string;
|
|
1137
1152
|
/** Set when a helper (a subagent) is the one whose call asks. */
|
|
@@ -1153,6 +1168,8 @@ interface ElicitationView {
|
|
|
1153
1168
|
interface QueuedMessageView {
|
|
1154
1169
|
id: string;
|
|
1155
1170
|
text: string;
|
|
1171
|
+
/** Another tab of the site sent it to this run (the core's session relay). */
|
|
1172
|
+
origin?: 'another-tab';
|
|
1156
1173
|
}
|
|
1157
1174
|
/**
|
|
1158
1175
|
* A message the user sent while the run was going, after it reached the agent.
|
|
@@ -1166,6 +1183,8 @@ interface UserNoteView {
|
|
|
1166
1183
|
at: 'round' | 'step' | 'final';
|
|
1167
1184
|
/** The step it was delivered in (`round`) or after (`step`); none for `final`. */
|
|
1168
1185
|
stepId?: string;
|
|
1186
|
+
/** Another tab of the site sent it (the core's session relay). */
|
|
1187
|
+
origin?: 'another-tab';
|
|
1169
1188
|
}
|
|
1170
1189
|
/**
|
|
1171
1190
|
* A delegated task running in a subagent: one the host defined (`createSubagentTool`, in-process
|
|
@@ -1386,6 +1405,42 @@ interface AgentUiState {
|
|
|
1386
1405
|
events: AgentEvent[];
|
|
1387
1406
|
/** Monotonic counter; mints stable message ids without Date/Math.random. */
|
|
1388
1407
|
seq: number;
|
|
1408
|
+
/**
|
|
1409
|
+
* The run in view is another tab's: this conversation runs in another tab of the origin, and
|
|
1410
|
+
* `useAgent` follows it (the core's `watchSession`) - its steps, answer and usage are folded
|
|
1411
|
+
* into the rest of the state like a run of this tab's. Absent once a run of this tab starts or
|
|
1412
|
+
* a chat is loaded.
|
|
1413
|
+
*/
|
|
1414
|
+
remote?: RemoteRunView;
|
|
1415
|
+
/**
|
|
1416
|
+
* This tab's run waits for the session: another run of it is going (`session.busy`) - in
|
|
1417
|
+
* another tab, or in this one. Cleared when it gets the session, or is stopped.
|
|
1418
|
+
*/
|
|
1419
|
+
sessionBusy?: {
|
|
1420
|
+
heldBy: SessionHolder;
|
|
1421
|
+
goal?: string;
|
|
1422
|
+
};
|
|
1423
|
+
/**
|
|
1424
|
+
* The turn the user just sent, shown at once while the run gets going (its `run.start` comes
|
|
1425
|
+
* after the session's lock is granted - a round trip to the browser's lock manager): the ids of
|
|
1426
|
+
* its user and pending assistant messages. `run.start` replaces them; a wait for the session
|
|
1427
|
+
* turns the text into a queued item instead.
|
|
1428
|
+
*/
|
|
1429
|
+
submitted?: {
|
|
1430
|
+
userId: string;
|
|
1431
|
+
assistantId: string;
|
|
1432
|
+
};
|
|
1433
|
+
}
|
|
1434
|
+
/** Another tab's run of this conversation, as this tab sees it. */
|
|
1435
|
+
interface RemoteRunView {
|
|
1436
|
+
/** It is going now (`useAgent` reports `isRunning`; `send` / `stop` go to that tab). */
|
|
1437
|
+
running: boolean;
|
|
1438
|
+
runId?: string;
|
|
1439
|
+
/**
|
|
1440
|
+
* How it ended: `done`, `stopped`, or `gone` - that tab closed or crashed before it said so
|
|
1441
|
+
* (its answer, if any, is what had arrived).
|
|
1442
|
+
*/
|
|
1443
|
+
ended?: 'done' | 'stopped' | 'gone';
|
|
1389
1444
|
}
|
|
1390
1445
|
|
|
1391
1446
|
/**
|
|
@@ -1531,5 +1586,5 @@ type ElicitationOutcomeReason = 'timeout' | 'step-timeout' | 'aborted' | 'stoppe
|
|
|
1531
1586
|
/** "4:05" - what is left of a question's time. */
|
|
1532
1587
|
declare const formatCountdown: (ms: number) => string;
|
|
1533
1588
|
|
|
1534
|
-
export {
|
|
1535
|
-
export type { AgentUiState as A, BudgetView as B, ChatAttachment as C, DecisionView as D, ElicitationIssueKind as E, AppResourceReader as F, ElicitationControl as G, ElicitationDraft as H, ElicitationDraftValue as I, ElicitationField as J, ElicitationFormOutcome as K, LessonView as L, McpAppSandboxReason as M, ElicitationIssue as N, ElicitationLink as O, PendingElicitation as P, ElicitationOption as Q,
|
|
1589
|
+
export { MCP_APP_MAX_IN_FLIGHT as $, MCP_APP_DISPLAY_MODES as X, MCP_APP_MAX_ARGS_CHARS as Y, MCP_APP_MAX_DOWNLOAD_BYTES as Z, MCP_APP_MAX_FILE_NAME_CHARS as _, MCP_APP_MAX_MESSAGE_CHARS as a0, MCP_APP_MAX_URL_CHARS as a1, MCP_APP_NOTIFICATIONS as a2, MCP_APP_OPTIONAL_REQUESTS as a3, MCP_APP_PROTOCOL_VERSION as a4, MCP_APP_REFUSED as a5, MCP_APP_REFUSED_DOWNLOAD_EXTENSIONS as a6, MCP_APP_REFUSED_DOWNLOAD_TYPES as a7, MCP_APP_RELAY as a8, MCP_APP_REQUESTS as a9, appFileNameOf as aA, appGestureOf as aB, appLinkOf as aC, appMessageTextOf as aD, appMimeTypeOf as aE, appSamplingErrorOf as aF, buildMcpAppDocument as aG, buildMcpAppSandboxShell as aH, clampAppHeight as aI, elicitationFields as aJ, elicitationFormAnswer as aK, elicitationInitialDraft as aL, elicitationLink as aM, formatCountdown as aN, grantedAppCsp as aO, mcpAppCsp as aP, mcpAppHostCapabilities as aQ, mcpAppSandboxProxyUrl as aR, mcpAppSandboxShellCsp as aS, mcpAppSandboxTarget as aT, resolveAppDownload as aU, saveAppFile as aV, useMcpAppHost as aW, MCP_APP_SANDBOX_FRAME_TOKENS as aa, MCP_APP_SANDBOX_GRACE_MS as ab, MCP_APP_SANDBOX_SERVER as ac, MCP_APP_SANDBOX_TIMEOUT_MS as ad, McpAppBridge as ae, McpAppRpcError as ai, McpAppSandboxLink as al, appDisplayModeAllowed as aw, appDownloadOf as ax, appDownloadRefusal as ay, appFileExtensionOf as az, createElicitationQueue as bb, elicitationConnectOptions as bc, elicitationSettings as bd, elicitationTimeoutOf as be, APP_DEFAULT_HEIGHT as s, APP_MAX_HEIGHT as t, APP_MIN_HEIGHT as u };
|
|
1590
|
+
export type { AgentUiState as A, BudgetView as B, ChatAttachment as C, DecisionView as D, ElicitationIssueKind as E, AppResourceReader as F, ElicitationControl as G, ElicitationDraft as H, ElicitationDraftValue as I, ElicitationField as J, ElicitationFormOutcome as K, LessonView as L, McpAppSandboxReason as M, ElicitationIssue as N, ElicitationLink as O, PendingElicitation as P, ElicitationOption as Q, RemoteRunView as R, SubagentView as S, ToolCallView as T, UserNoteView as U, FetchView as V, WrittenFileView as W, ApprovalView as a, McpServerProtocol as a$, McpOAuthRegistration as aX, McpProtocolMode as aY, McpElicitationOptions as aZ, McpCatalogEntry as a_, McpAppBridgeHandlers as af, McpAppBridgeOptions as ag, McpAppDisplayMode as ah, McpAppRpcMessage as aj, McpAppSandboxInput as ak, McpAppSandboxLinkOptions as am, McpAppSandboxTarget as an, McpElicitationFieldSchema as ao, McpElicitationRequest as ap, McpElicitationSchema as aq, QueuedMessageView as ar, ReplanState as as, SkillConsentView as at, StepEscalationView as au, UseMcpAppHostOptions as av, ChatMessage as b, McpOAuthRegistrationKind as b0, McpOAuthCallback as b1, McpServerResult as b2, McpModule as b3, ConnectedMcp as b4, BrowserOAuthProviderOptions as b5, BrowserOAuthProvider as b6, ElicitationQueue as b7, ElicitationQueueOptions as b8, McpElicitationHandler as b9, McpServerInstructions as ba, AgentStatus as c, ElicitationOutcomeReason as d, SubagentNode as e, McpElicitationResult as f, ElicitationView as g, StepView as h, MediaView as i, AppView as j, McpAppsConnectionLike as k, McpAppSandboxOptions as l, AppRequestView as m, TranscriptView as n, CompactionView as o, ModelLoadState as p, McpAppHost as q, AppRequestAnswerOptions as r, AppDownload as v, AppDownloadView as w, AppFileSaverEnv as x, AppLink as y, AppReadyDownload as z };
|