@dudko.dev/agent-web-react 0.0.31 → 0.0.33

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 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 the in-flight run |
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` |
@@ -207,12 +209,14 @@ function Custom() {
207
209
  | `learned`, `learnedNow`, `fetches` | the agent's notebook (`LessonView[]`, survives `reset`), what it wrote this run, and the `web_fetch` requests this run made (`FetchView[]`) |
208
210
  | `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) |
209
211
  | `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) |
210
- | `error`, `stopped`, `events`, `seq` | the run's error text (a replanner failure is not one: see `replan.failed`), whether it was stopped, the raw event log and its counter |
212
+ | `error`, `errorCode`, `stopped`, `events`, `seq` | the run's error text (a replanner failure is not one: see `replan.failed`); the core's code for an error a host may say in its own words - `'no-plan'` (the planner returned nothing readable) or `'no-answer'` (the model wrote no answer); whether it was stopped, the raw event log and its counter |
211
213
  | `modelLoad` | WebLLM download progress, when loading |
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). The queue behind `approve` /
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()`.
@@ -532,7 +536,7 @@ 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.41` — the first core with MCP Apps (`approveAppToolCall`,
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
@@ -792,7 +796,7 @@ use them standalone. The full guide: [docs/chat.md](docs/chat.md).
792
796
 
793
797
  | Component | Purpose |
794
798
  | --- | --- |
795
- | `<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`). |
796
800
  | `<AgentComposer>` | The input and its toolbar: attachments, commands, timer, agents, model/thinking, consent, mic, send/stop. |
797
801
  | `<MessageList>` | The transcript; each answer with its steps, tool calls, thoughts, usage. |
798
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`). |
@@ -805,7 +809,7 @@ use them standalone. The full guide: [docs/chat.md](docs/chat.md).
805
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). |
806
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). |
807
811
  | `<ApprovalModeSwitch>` | Segmented consent-mode switch. |
808
- | `<ChatHistoryList>` | Saved chats (from `useChatHistory`). |
812
+ | `<ChatHistoryList>` | Saved chats (from `useChatHistory`; the list follows what other tabs of the site save). |
809
813
  | `<FilesPanel>` | A `VirtualFileSystem`, live: preview, download, delete, upload. |
810
814
  | `<LearnedSkills>` | The agent's notebook (`learning`): its lessons, where each came from, forget. |
811
815
  | `<ContextMeter>` | Tokens by kind, budget bar, last compaction, Compact. |
@@ -913,6 +917,29 @@ the control each is drawn as), `elicitationInitialDraft` (the defaults), `elicit
913
917
  (the answer, or an issue per field), `elicitationLink` (host, address, whether it may be opened)
914
918
  and `formatCountdown`.
915
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
+
916
943
  ## How it fits together
917
944
 
918
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-EMF7DTGS.js.map
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,KAAK,MAAM,EAAE,CAAC;AACvC,MAAI,KAAK,IAAQ,QAAO,IAAI,KAAK,KAAM,QAAQ,KAAK,MAAS,IAAI,CAAC,CAAC;AACnE,QAAM,IAAI,K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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
@@ -874,6 +874,11 @@ interface ChatMessage {
874
874
  content: string;
875
875
  /** An assistant message that is still streaming (no final/stopped/error yet). */
876
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;
877
882
  /** User turn: what was attached (images, files). */
878
883
  attachments?: ChatAttachment[];
879
884
  /** Assistant turn: the run's steps — tool calls, thoughts, subagents — as they happened. */
@@ -1102,6 +1107,12 @@ interface ApprovalView {
1102
1107
  tool: string;
1103
1108
  resourceUri: string;
1104
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;
1105
1116
  /**
1106
1117
  * Set when the request is about an MCP server's skill about to enter the model's context, not
1107
1118
  * a tool call (the core's `ToolApprovalRequest.skill`): the server, the skill, its description,
@@ -1134,6 +1145,8 @@ interface ElicitationView {
1134
1145
  requestedSchema?: McpElicitationSchema;
1135
1146
  /** URL mode: the link the server wants opened. Nothing opens it for the user. */
1136
1147
  url?: string;
1148
+ /** Asked in another tab, by a run followed here (`AgentUiState.remote`): answered there. */
1149
+ remote?: true;
1137
1150
  /** The step the tool call belongs to, when known. */
1138
1151
  stepId?: string;
1139
1152
  /** Set when a helper (a subagent) is the one whose call asks. */
@@ -1155,6 +1168,8 @@ interface ElicitationView {
1155
1168
  interface QueuedMessageView {
1156
1169
  id: string;
1157
1170
  text: string;
1171
+ /** Another tab of the site sent it to this run (the core's session relay). */
1172
+ origin?: 'another-tab';
1158
1173
  }
1159
1174
  /**
1160
1175
  * A message the user sent while the run was going, after it reached the agent.
@@ -1168,6 +1183,8 @@ interface UserNoteView {
1168
1183
  at: 'round' | 'step' | 'final';
1169
1184
  /** The step it was delivered in (`round`) or after (`step`); none for `final`. */
1170
1185
  stepId?: string;
1186
+ /** Another tab of the site sent it (the core's session relay). */
1187
+ origin?: 'another-tab';
1171
1188
  }
1172
1189
  /**
1173
1190
  * A delegated task running in a subagent: one the host defined (`createSubagentTool`, in-process
@@ -1380,6 +1397,12 @@ interface AgentUiState {
1380
1397
  * `replan.failed` and `StepView.replanFailed`).
1381
1398
  */
1382
1399
  error?: string;
1400
+ /**
1401
+ * The core's code of a run error a host may want to say in its own words: `'no-plan'` (the
1402
+ * planner returned nothing readable) or `'no-answer'` (the model wrote no answer). Absent for
1403
+ * every other error.
1404
+ */
1405
+ errorCode?: 'no-plan' | 'no-answer';
1383
1406
  /** True when the last run was aborted via stop(). */
1384
1407
  stopped: boolean;
1385
1408
  /** A chat-style transcript built from every run, for chat UIs. */
@@ -1388,6 +1411,42 @@ interface AgentUiState {
1388
1411
  events: AgentEvent[];
1389
1412
  /** Monotonic counter; mints stable message ids without Date/Math.random. */
1390
1413
  seq: number;
1414
+ /**
1415
+ * The run in view is another tab's: this conversation runs in another tab of the origin, and
1416
+ * `useAgent` follows it (the core's `watchSession`) - its steps, answer and usage are folded
1417
+ * into the rest of the state like a run of this tab's. Absent once a run of this tab starts or
1418
+ * a chat is loaded.
1419
+ */
1420
+ remote?: RemoteRunView;
1421
+ /**
1422
+ * This tab's run waits for the session: another run of it is going (`session.busy`) - in
1423
+ * another tab, or in this one. Cleared when it gets the session, or is stopped.
1424
+ */
1425
+ sessionBusy?: {
1426
+ heldBy: SessionHolder;
1427
+ goal?: string;
1428
+ };
1429
+ /**
1430
+ * The turn the user just sent, shown at once while the run gets going (its `run.start` comes
1431
+ * after the session's lock is granted - a round trip to the browser's lock manager): the ids of
1432
+ * its user and pending assistant messages. `run.start` replaces them; a wait for the session
1433
+ * turns the text into a queued item instead.
1434
+ */
1435
+ submitted?: {
1436
+ userId: string;
1437
+ assistantId: string;
1438
+ };
1439
+ }
1440
+ /** Another tab's run of this conversation, as this tab sees it. */
1441
+ interface RemoteRunView {
1442
+ /** It is going now (`useAgent` reports `isRunning`; `send` / `stop` go to that tab). */
1443
+ running: boolean;
1444
+ runId?: string;
1445
+ /**
1446
+ * How it ended: `done`, `stopped`, or `gone` - that tab closed or crashed before it said so
1447
+ * (its answer, if any, is what had arrived).
1448
+ */
1449
+ ended?: 'done' | 'stopped' | 'gone';
1391
1450
  }
1392
1451
 
1393
1452
  /**
@@ -1533,5 +1592,5 @@ type ElicitationOutcomeReason = 'timeout' | 'step-timeout' | 'aborted' | 'stoppe
1533
1592
  /** "4:05" - what is left of a question's time. */
1534
1593
  declare const formatCountdown: (ms: number) => string;
1535
1594
 
1536
- export { MCP_APP_MAX_MESSAGE_CHARS as $, MCP_APP_DISPLAY_MODES as V, MCP_APP_MAX_ARGS_CHARS as X, MCP_APP_MAX_DOWNLOAD_BYTES as Y, MCP_APP_MAX_FILE_NAME_CHARS as Z, MCP_APP_MAX_IN_FLIGHT as _, MCP_APP_MAX_URL_CHARS as a0, MCP_APP_NOTIFICATIONS as a1, MCP_APP_OPTIONAL_REQUESTS as a2, MCP_APP_PROTOCOL_VERSION as a3, MCP_APP_REFUSED as a4, MCP_APP_REFUSED_DOWNLOAD_EXTENSIONS as a5, MCP_APP_REFUSED_DOWNLOAD_TYPES as a6, MCP_APP_RELAY as a7, MCP_APP_REQUESTS as a8, MCP_APP_SANDBOX_FRAME_TOKENS as a9, appGestureOf as aA, appLinkOf as aB, appMessageTextOf as aC, appMimeTypeOf as aD, appSamplingErrorOf as aE, buildMcpAppDocument as aF, buildMcpAppSandboxShell as aG, clampAppHeight as aH, elicitationFields as aI, elicitationFormAnswer as aJ, elicitationInitialDraft as aK, elicitationLink as aL, formatCountdown as aM, grantedAppCsp as aN, mcpAppCsp as aO, mcpAppHostCapabilities as aP, mcpAppSandboxProxyUrl as aQ, mcpAppSandboxShellCsp as aR, mcpAppSandboxTarget as aS, resolveAppDownload as aT, saveAppFile as aU, useMcpAppHost as aV, MCP_APP_SANDBOX_GRACE_MS as aa, MCP_APP_SANDBOX_SERVER as ab, MCP_APP_SANDBOX_TIMEOUT_MS as ac, McpAppBridge as ad, McpAppRpcError as ah, McpAppSandboxLink as ak, appDisplayModeAllowed as av, appDownloadOf as aw, appDownloadRefusal as ax, appFileExtensionOf as ay, appFileNameOf as az, createElicitationQueue as ba, elicitationConnectOptions as bb, elicitationSettings as bc, elicitationTimeoutOf as bd, APP_DEFAULT_HEIGHT as s, APP_MAX_HEIGHT as t, APP_MIN_HEIGHT as u };
1537
- 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, FetchView as R, SubagentView as S, ToolCallView as T, UserNoteView as U, WrittenFileView as W, ApprovalView as a, McpOAuthRegistrationKind as a$, McpOAuthRegistration as aW, McpProtocolMode as aX, McpElicitationOptions as aY, McpCatalogEntry as aZ, McpServerProtocol as a_, McpAppBridgeHandlers as ae, McpAppBridgeOptions as af, McpAppDisplayMode as ag, McpAppRpcMessage as ai, McpAppSandboxInput as aj, McpAppSandboxLinkOptions as al, McpAppSandboxTarget as am, McpElicitationFieldSchema as an, McpElicitationRequest as ao, McpElicitationSchema as ap, QueuedMessageView as aq, ReplanState as ar, SkillConsentView as as, StepEscalationView as at, UseMcpAppHostOptions as au, ChatMessage as b, McpOAuthCallback as b0, McpServerResult as b1, McpModule as b2, ConnectedMcp as b3, BrowserOAuthProviderOptions as b4, BrowserOAuthProvider as b5, ElicitationQueue as b6, ElicitationQueueOptions as b7, McpElicitationHandler as b8, McpServerInstructions as b9, 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 };
1595
+ 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 };
1596
+ 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
@@ -874,6 +874,11 @@ interface ChatMessage {
874
874
  content: string;
875
875
  /** An assistant message that is still streaming (no final/stopped/error yet). */
876
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;
877
882
  /** User turn: what was attached (images, files). */
878
883
  attachments?: ChatAttachment[];
879
884
  /** Assistant turn: the run's steps — tool calls, thoughts, subagents — as they happened. */
@@ -1102,6 +1107,12 @@ interface ApprovalView {
1102
1107
  tool: string;
1103
1108
  resourceUri: string;
1104
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;
1105
1116
  /**
1106
1117
  * Set when the request is about an MCP server's skill about to enter the model's context, not
1107
1118
  * a tool call (the core's `ToolApprovalRequest.skill`): the server, the skill, its description,
@@ -1134,6 +1145,8 @@ interface ElicitationView {
1134
1145
  requestedSchema?: McpElicitationSchema;
1135
1146
  /** URL mode: the link the server wants opened. Nothing opens it for the user. */
1136
1147
  url?: string;
1148
+ /** Asked in another tab, by a run followed here (`AgentUiState.remote`): answered there. */
1149
+ remote?: true;
1137
1150
  /** The step the tool call belongs to, when known. */
1138
1151
  stepId?: string;
1139
1152
  /** Set when a helper (a subagent) is the one whose call asks. */
@@ -1155,6 +1168,8 @@ interface ElicitationView {
1155
1168
  interface QueuedMessageView {
1156
1169
  id: string;
1157
1170
  text: string;
1171
+ /** Another tab of the site sent it to this run (the core's session relay). */
1172
+ origin?: 'another-tab';
1158
1173
  }
1159
1174
  /**
1160
1175
  * A message the user sent while the run was going, after it reached the agent.
@@ -1168,6 +1183,8 @@ interface UserNoteView {
1168
1183
  at: 'round' | 'step' | 'final';
1169
1184
  /** The step it was delivered in (`round`) or after (`step`); none for `final`. */
1170
1185
  stepId?: string;
1186
+ /** Another tab of the site sent it (the core's session relay). */
1187
+ origin?: 'another-tab';
1171
1188
  }
1172
1189
  /**
1173
1190
  * A delegated task running in a subagent: one the host defined (`createSubagentTool`, in-process
@@ -1380,6 +1397,12 @@ interface AgentUiState {
1380
1397
  * `replan.failed` and `StepView.replanFailed`).
1381
1398
  */
1382
1399
  error?: string;
1400
+ /**
1401
+ * The core's code of a run error a host may want to say in its own words: `'no-plan'` (the
1402
+ * planner returned nothing readable) or `'no-answer'` (the model wrote no answer). Absent for
1403
+ * every other error.
1404
+ */
1405
+ errorCode?: 'no-plan' | 'no-answer';
1383
1406
  /** True when the last run was aborted via stop(). */
1384
1407
  stopped: boolean;
1385
1408
  /** A chat-style transcript built from every run, for chat UIs. */
@@ -1388,6 +1411,42 @@ interface AgentUiState {
1388
1411
  events: AgentEvent[];
1389
1412
  /** Monotonic counter; mints stable message ids without Date/Math.random. */
1390
1413
  seq: number;
1414
+ /**
1415
+ * The run in view is another tab's: this conversation runs in another tab of the origin, and
1416
+ * `useAgent` follows it (the core's `watchSession`) - its steps, answer and usage are folded
1417
+ * into the rest of the state like a run of this tab's. Absent once a run of this tab starts or
1418
+ * a chat is loaded.
1419
+ */
1420
+ remote?: RemoteRunView;
1421
+ /**
1422
+ * This tab's run waits for the session: another run of it is going (`session.busy`) - in
1423
+ * another tab, or in this one. Cleared when it gets the session, or is stopped.
1424
+ */
1425
+ sessionBusy?: {
1426
+ heldBy: SessionHolder;
1427
+ goal?: string;
1428
+ };
1429
+ /**
1430
+ * The turn the user just sent, shown at once while the run gets going (its `run.start` comes
1431
+ * after the session's lock is granted - a round trip to the browser's lock manager): the ids of
1432
+ * its user and pending assistant messages. `run.start` replaces them; a wait for the session
1433
+ * turns the text into a queued item instead.
1434
+ */
1435
+ submitted?: {
1436
+ userId: string;
1437
+ assistantId: string;
1438
+ };
1439
+ }
1440
+ /** Another tab's run of this conversation, as this tab sees it. */
1441
+ interface RemoteRunView {
1442
+ /** It is going now (`useAgent` reports `isRunning`; `send` / `stop` go to that tab). */
1443
+ running: boolean;
1444
+ runId?: string;
1445
+ /**
1446
+ * How it ended: `done`, `stopped`, or `gone` - that tab closed or crashed before it said so
1447
+ * (its answer, if any, is what had arrived).
1448
+ */
1449
+ ended?: 'done' | 'stopped' | 'gone';
1391
1450
  }
1392
1451
 
1393
1452
  /**
@@ -1533,5 +1592,5 @@ type ElicitationOutcomeReason = 'timeout' | 'step-timeout' | 'aborted' | 'stoppe
1533
1592
  /** "4:05" - what is left of a question's time. */
1534
1593
  declare const formatCountdown: (ms: number) => string;
1535
1594
 
1536
- export { MCP_APP_MAX_MESSAGE_CHARS as $, MCP_APP_DISPLAY_MODES as V, MCP_APP_MAX_ARGS_CHARS as X, MCP_APP_MAX_DOWNLOAD_BYTES as Y, MCP_APP_MAX_FILE_NAME_CHARS as Z, MCP_APP_MAX_IN_FLIGHT as _, MCP_APP_MAX_URL_CHARS as a0, MCP_APP_NOTIFICATIONS as a1, MCP_APP_OPTIONAL_REQUESTS as a2, MCP_APP_PROTOCOL_VERSION as a3, MCP_APP_REFUSED as a4, MCP_APP_REFUSED_DOWNLOAD_EXTENSIONS as a5, MCP_APP_REFUSED_DOWNLOAD_TYPES as a6, MCP_APP_RELAY as a7, MCP_APP_REQUESTS as a8, MCP_APP_SANDBOX_FRAME_TOKENS as a9, appGestureOf as aA, appLinkOf as aB, appMessageTextOf as aC, appMimeTypeOf as aD, appSamplingErrorOf as aE, buildMcpAppDocument as aF, buildMcpAppSandboxShell as aG, clampAppHeight as aH, elicitationFields as aI, elicitationFormAnswer as aJ, elicitationInitialDraft as aK, elicitationLink as aL, formatCountdown as aM, grantedAppCsp as aN, mcpAppCsp as aO, mcpAppHostCapabilities as aP, mcpAppSandboxProxyUrl as aQ, mcpAppSandboxShellCsp as aR, mcpAppSandboxTarget as aS, resolveAppDownload as aT, saveAppFile as aU, useMcpAppHost as aV, MCP_APP_SANDBOX_GRACE_MS as aa, MCP_APP_SANDBOX_SERVER as ab, MCP_APP_SANDBOX_TIMEOUT_MS as ac, McpAppBridge as ad, McpAppRpcError as ah, McpAppSandboxLink as ak, appDisplayModeAllowed as av, appDownloadOf as aw, appDownloadRefusal as ax, appFileExtensionOf as ay, appFileNameOf as az, createElicitationQueue as ba, elicitationConnectOptions as bb, elicitationSettings as bc, elicitationTimeoutOf as bd, APP_DEFAULT_HEIGHT as s, APP_MAX_HEIGHT as t, APP_MIN_HEIGHT as u };
1537
- 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, FetchView as R, SubagentView as S, ToolCallView as T, UserNoteView as U, WrittenFileView as W, ApprovalView as a, McpOAuthRegistrationKind as a$, McpOAuthRegistration as aW, McpProtocolMode as aX, McpElicitationOptions as aY, McpCatalogEntry as aZ, McpServerProtocol as a_, McpAppBridgeHandlers as ae, McpAppBridgeOptions as af, McpAppDisplayMode as ag, McpAppRpcMessage as ai, McpAppSandboxInput as aj, McpAppSandboxLinkOptions as al, McpAppSandboxTarget as am, McpElicitationFieldSchema as an, McpElicitationRequest as ao, McpElicitationSchema as ap, QueuedMessageView as aq, ReplanState as ar, SkillConsentView as as, StepEscalationView as at, UseMcpAppHostOptions as au, ChatMessage as b, McpOAuthCallback as b0, McpServerResult as b1, McpModule as b2, ConnectedMcp as b3, BrowserOAuthProviderOptions as b4, BrowserOAuthProvider as b5, ElicitationQueue as b6, ElicitationQueueOptions as b7, McpElicitationHandler as b8, McpServerInstructions as b9, 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 };
1595
+ 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 };
1596
+ 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 };