@dudko.dev/agent-web-react 0.0.26 β†’ 0.0.28

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
@@ -23,6 +23,10 @@ app with a single hook and (optionally) a set of pre-styled components:
23
23
  chip and speech to text; saved chats in IndexedDB and a workspace (virtual
24
24
  file system) panel. Everything is a prop: show/hide, labels (i18n), render
25
25
  props, slots, swappable components, theme β€” see [docs/chat.md](docs/chat.md).
26
+ - πŸ•ΈοΈ **Pipeline editor** β€” draw a graph of agents on a canvas (our own: no canvas or
27
+ graph library), connect them with conditions and loops, run it with live statuses,
28
+ copy it as code: `<PipelineEditor>` and `usePipeline`, behind
29
+ `@dudko.dev/agent-web-react/pipeline` β€” see [docs/pipeline.md](docs/pipeline.md).
26
30
  - πŸ—£οΈ **Steering and learning** β€” type to the agent while it works (`send`,
27
31
  `stopSubagent`; queued / delivered notes under the step that got them), and watch
28
32
  it keep a notebook: lessons it wrote down as skills (`learned`, `<LearnedSkills>`,
@@ -48,7 +52,7 @@ app with a single hook and (optionally) a set of pre-styled components:
48
52
  > local WebGPU, all in your browser. Settings turn on tool consent, thinking, token
49
53
  > and step limits, compaction, skills - the agent's own **notebook** (it writes down
50
54
  > what it figured out, in the workspace, across reloads) and **web access** limited
51
- > to hosts you list. Type to the agent while it works. Source in [`demo/`](demo/).
55
+ > to hosts you list. Type to the agent while it works. Source in [`apps/demo`](https://github.com/dudko-dev/agents/tree/main/apps/demo).
52
56
 
53
57
  ## Install
54
58
 
@@ -192,15 +196,17 @@ function Custom() {
192
196
  | `messages` | transcript; each assistant message keeps its steps, tool calls, thoughts, approvals, subagents, usage and duration |
193
197
  | `plan` / `steps` | the live plan and per-step tool calls (with timing) |
194
198
  | `finalText` / `finalReasoning` | the streamed answer and its thoughts |
195
- | `usage` / `totalUsage` | tokens of this run / of the conversation, by kind |
196
- | `pendingApprovals`, `approve(id, { remember })`, `deny(id)` | tool consent |
199
+ | `usage` / `totalUsage` | tokens of this run / of the conversation, by kind - plus `mediaCalls` and `decisionCalls` (calls, not tokens) when the run made some |
200
+ | `pendingApprovals`, `approve(id, { remember })`, `deny(id)` | tool consent (a request made by a helper the model started carries `subagent: { id, depth, name?, role? }`) |
197
201
  | `approvalMode` / `setApprovalMode(mode)` | the autopilot switch, live |
198
202
  | `compact()` | summarise the stored transcript now |
199
203
  | `sessionId` / `loadChat(chat)` | the memory session; switch conversations |
200
- | `subagents`, `skills`, `discoveredTools`, `compactions`, `budget` | the rest of the run, folded |
204
+ | `subagents`, `skills`, `discoveredTools`, `compactions`, `budget` | the rest of the run, folded. `subagents` is a **tree**: static subagents and the helpers the model started (`subagents.dynamic`), each node with `parentId` / `depth`, status, model, tokens, tool calls and time; `subagentTree(subagents)` nests it - see [docs/chat.md](docs/chat.md#subagents-and-helpers-the-tree) |
205
+ | `media`, `transcripts`, `decisions` | absent until there is one: the files the run generated (`MediaView[]`: a path in the workspace, never bytes), the audio it transcribed (`TranscriptView[]`), and the decision model's answers that came before any step (`DecisionView[]`; later ones are on their step) |
201
206
  | `learned`, `learnedNow`, `fetches` | the agent's notebook (`LessonView[]`, survives `reset`), what it wrote this run, and the `web_fetch` requests this run made (`FetchView[]`) |
202
- | `queued`, `notes`, `undelivered`, `replan` | steering: messages waiting, shown (and where), left over; the last replan decision (`byUser` when a message caused it) |
203
- | `error`, `stopped`, `events`, `seq` | the run's error text, whether it was stopped, the raw event log and its counter |
207
+ | `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) |
208
+ | `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) |
209
+ | `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 |
204
210
  | `modelLoad` | WebLLM download progress, when loading |
205
211
 
206
212
  **Options:** `deps` (rebuild the agent when these change β€” e.g. on a model
@@ -291,7 +297,7 @@ const local = useLocalModel(option.model, option.builtIn ? builtIn : webllm, {
291
297
  ```
292
298
 
293
299
  The demo runs WebLLM, Chrome's Gemini Nano and transformers.js this way β€” see
294
- [`demo/src/local-engines.ts`](demo/src/local-engines.ts).
300
+ [`apps/demo/src/local-engines.ts`](https://github.com/dudko-dev/agents/blob/main/apps/demo/src/local-engines.ts).
295
301
 
296
302
  ## Models in a bundler (Vite, Next, CRA)
297
303
 
@@ -334,8 +340,8 @@ function CloudAgent() {
334
340
  **Local** β€” pass a statically-imported `webLLM` factory via `useWebLLMModel`'s
335
341
  `create` option (see the WebLLM example above).
336
342
 
337
- The [`demo/`](demo/) app does exactly this β€” see
338
- [`demo/src/providers.ts`](demo/src/providers.ts).
343
+ The [`apps/demo`](https://github.com/dudko-dev/agents/tree/main/apps/demo) app does exactly this β€” see
344
+ [`apps/demo/src/providers.ts`](https://github.com/dudko-dev/agents/blob/main/apps/demo/src/providers.ts).
339
345
 
340
346
  ## MCP hooks live in their own subpath
341
347
 
@@ -361,6 +367,37 @@ subpath the decision is yours:
361
367
  > `describeMcpResult`, `isUnauthorizedError`) and types (`McpStatus`,
362
368
  > `McpAuthMode`, `McpServerView`, …) moved: change the import path, nothing else.
363
369
 
370
+ ## Pipelines: an editor on a canvas
371
+
372
+ ```tsx
373
+ import { PipelineEditor, usePipeline } from '@dudko.dev/agent-web-react/pipeline'
374
+ import '@dudko.dev/agent-web-react/pipeline.css'
375
+
376
+ const pipeline = usePipeline(definition, { base: { model, credentials }, tools: { files } })
377
+ return <PipelineEditor value={definition} onChange={setDefinition} controller={pipeline} />
378
+ ```
379
+
380
+ The editor for the core's [pipelines](https://github.com/dudko-dev/agents/blob/main/packages/agent-web/docs/capabilities.md#pipelines-a-graph-of-agents)
381
+ (a graph of agents in plain JSON) lives in its own entry, like MCP and for a similar reason: a
382
+ chat host should not carry a canvas, an inspector and a code generator, nor need a core new
383
+ enough to have `createPipeline`. Nothing in the main entry references it. Its stylesheet,
384
+ `pipeline.css`, is separate too and stands on its own. It adds **no dependency**: the canvas is
385
+ this package's own code.
386
+
387
+ | Export | What it is |
388
+ | --- | --- |
389
+ | `usePipeline(definition, options)` | Builds the pipeline with the core (`resolveNode`, or the registries of `nodeResolver`: `base`, `models`, `skills`, `tools`, `mcpServers`), and returns `run(input)`, `stop()`, `reset()`, `isRunning`, `validation`, `result` plus the state below. |
390
+ | `pipelineStateReducer`, `createInitialPipelineState`, `pipelineNodeView` | The pure event β†’ state reducer: per-node status and visits, which edges fired, what each node's agent is doing, outputs, usage, `stoppedBy`, the error. |
391
+ | `<PipelineEditor>` | The editor: canvas, node cards, inspector, toolbar, validation, run bar, results. Controlled (`value`, `onChange`). |
392
+ | `<PipelineNodeCard>`, `<PipelineInspector>`, `<PipelineResults>`, `<PipelineIssues>`, `<PipelineCodeDialog>` | Its parts, to compose your own. |
393
+ | `<Canvas>`, `<CanvasPort>` and the canvas maths | The generic node-and-edge canvas underneath: pan, zoom, drag, connect, keyboard, screen readers. |
394
+ | `addNode`, `removeNode`, `renameNode`, `addEdge`, `updateEdge`, `removeEdge`, `setEntry`, `autoLayout`, `parsePipelineJson`, ... | Editing a definition, as pure functions. |
395
+ | `pipelineToCode(definition, { target })` | "Copy as code": a snippet for the browser package or for the Node one. |
396
+ | `PipelineLabelsProvider`, `defaultPipelineLabels`, `usePipelineLabels` | Every string of the editor (its own labels object, not `AgentLabels`). |
397
+
398
+ The full guide, with every prop, state field and label: [docs/pipeline.md](docs/pipeline.md).
399
+ Live: <https://agent.dudko.dev/pipeline/>.
400
+
364
401
  ## The `useMcp` hook β€” connect a remote MCP server
365
402
 
366
403
  Let the user name their own MCP server at runtime and hand its tools to the
@@ -382,16 +419,58 @@ await mcp.connect({ url, oauth: true }) // or { url, headers: { Authorizat
382
419
  const config = { model, tools: { ...myTools, ...mcp.tools } }
383
420
  ```
384
421
 
385
- `useMcp` returns `{ status, tools, catalog, error, authorizationUrl,
422
+ `useMcp` returns `{ status, tools, catalog, instructions, error, authorizationUrl,
386
423
  oauthSupported, completingAuthorization, connect, disconnect, authorize,
387
424
  forgetAuthorization, checkOAuthSupport }`. `status` is
388
425
  `idle | connecting | connected | needs-authorization | error`.
389
426
 
427
+ `instructions` is what the connected server told the agent in its handshake (MCP `instructions`),
428
+ when it sent any. The core puts that text into the system prompt of an agent that uses the
429
+ server's tools, and it is **third-party text**: with bring-your-own servers, show it to the user,
430
+ labelled as the server's words (`useMcpServers().servers[i].instructions` is the same per server;
431
+ `mcpInstructionsOf(connection, name)` reads it from a `ConnectedMcp`).
432
+
390
433
  The OAuth round-trip navigates away from your app, so the hook persists what it
391
- needs and, on the way back, finishes the code exchange, strips `?code=…` from
392
- the address bar and reconnects before rendering β€” `completingAuthorization`
434
+ needs and, on the way back, finishes the code exchange (passing `iss` to the
435
+ core, which refuses a response from another authorization server - RFC 9207),
436
+ strips `?code=…` from the address bar and reconnects before rendering β€” `completingAuthorization`
393
437
  covers that window.
394
438
 
439
+ Options:
440
+
441
+ | | |
442
+ | --- | --- |
443
+ | `useMcp({ clientName })` | the MCP client name, and the `client_name` of a dynamic registration |
444
+ | `useMcp({ clientMetadataUrl })` | the URL of a **client ID metadata document** (CIMD) your app hosts, for every OAuth server - see below |
445
+ | `useMcp({ onLog })` | connector log lines |
446
+ | `connect({ url, name, headers })` | the endpoint, the tool prefix (`"<name>__<tool>"`, default `mcp`), static headers |
447
+ | `connect({ oauth })` | `true`, or `{ redirectUrl, scope, clientName, clientMetadataUrl }` (`McpOAuthOptions`) - each overrides the hook-level value for this server |
448
+
449
+ **`clientMetadataUrl` (CIMD).** Instead of registering itself with every authorization server, an
450
+ app can publish one JSON document that describes it and use that document's URL as its
451
+ `client_id`:
452
+
453
+ ```tsx
454
+ const mcp = useMcp({
455
+ clientName: 'my-app',
456
+ clientMetadataUrl: 'https://my-app.example/oauth/client.json',
457
+ })
458
+ await mcp.connect({ url, oauth: true })
459
+ // or for one server only: connect({ url, oauth: { clientMetadataUrl: '…' } })
460
+ ```
461
+
462
+ The hooks pass the URL to the core's OAuth provider unchanged. An authorization server that
463
+ advertises `client_id_metadata_document_supported` takes it as the `client_id` and no registration
464
+ request is made; any other server gets dynamic registration as before, and a registration already
465
+ stored for the server wins over both (`forgetAuthorization` drops it). The URL must be https with a
466
+ path of its own, and the document served there must list the `redirectUrl` (by default this page,
467
+ without query or hash) in its `redirect_uris` - the core refuses any other URL before a request is
468
+ made, and the server ends in `status: 'error'` with the reason. The URL is public and is remembered
469
+ with the rest of the server's OAuth details across the redirect and reloads. The core's
470
+ [README](https://github.com/dudko-dev/agents/blob/main/packages/agent-web/README.md) and
471
+ [security notes](https://github.com/dudko-dev/agents/blob/main/packages/agent-web/docs/security.md)
472
+ say what the document must contain.
473
+
395
474
  Two notes:
396
475
 
397
476
  - The connector lives in the core's optional `@dudko.dev/agent-web/mcp` subpath
@@ -400,11 +479,11 @@ Two notes:
400
479
  core β€” importing these hooks is what puts it in your build.
401
480
  - `oauthSupported` is `false` on cores older than `@dudko.dev/agent-web@0.0.9`,
402
481
  which introduced `BrowserOAuthProvider`; header auth still works there. The
403
- peer floor is `>=0.0.30` β€” the first core with the learning notebook
404
- (`forgetSkill`, `listLearnedSkills`) on top of the virtual file system,
405
- attachments, consent, tool search, subagents, steering and context editing this
406
- package's chat builds on. `agent.usage` / `agent.sessionUsage()` and the
407
- window-derived output caps need `>=0.0.32`.
482
+ peer floor is `>=0.0.39` β€” the first core with model tiers, dynamic subagents,
483
+ media and decision models, whose helpers and constants this package imports
484
+ (`isReplayedToolOutput`, the media type lists), on top of pipelines, the learning
485
+ notebook, the virtual file system, attachments, consent, tool search, subagents,
486
+ steering and context editing this package's chat builds on.
408
487
 
409
488
  ## Several MCP servers β€” `useMcpServers`
410
489
 
@@ -413,10 +492,20 @@ import { useMcpServers } from '@dudko.dev/agent-web-react/mcp'
413
492
 
414
493
  const mcp = useMcpServers({ clientName: 'my-app' }) // the list persists; reconnects on load
415
494
  await mcp.add({ name: 'docs', url, auth: 'oauth' }) // 'none' | 'bearer' (+ token) | 'oauth'
416
- mcp.servers // [{ name, url, status, catalog, error, … }]
495
+ mcp.servers // [{ name, url, status, catalog, instructions, error, … }]
417
496
  const config = { model, tools: { ...myTools, ...mcp.tools } } // "<name>__<tool>"
418
497
  ```
419
498
 
499
+ `useMcpServers` takes the options of `useMcp` (`clientName`, `clientMetadataUrl`, `onLog`) plus
500
+ `persist`, `storageKey`, `autoConnect` and `connectTimeoutMs`. A server added with
501
+ `auth: 'oauth'` may carry its own `oauth: { redirectUrl, scope, clientName, clientMetadataUrl }`,
502
+ which wins over the hook-level values and is remembered with the list:
503
+
504
+ ```tsx
505
+ const mcp = useMcpServers({ clientMetadataUrl: 'https://my-app.example/oauth/client.json' })
506
+ await mcp.add({ name: 'docs', url, auth: 'oauth' }) // CIMD where the server supports it, DCR elsewhere
507
+ ```
508
+
420
509
  Servers connect in parallel, each with its own deadline; paginated tool lists
421
510
  are read to the end; tools a server marks read-only skip the "ask before
422
511
  changes" prompt. With hundreds of tools the core switches to **tool search**
@@ -435,8 +524,10 @@ use them standalone. The full guide: [docs/chat.md](docs/chat.md).
435
524
  | `<AgentChat>` | Full panel: transcript with per-answer activity + composer + optional history and files panels. Reads a `controller` prop or the `<AgentProvider>` context. |
436
525
  | `<AgentComposer>` | The input and its toolbar: attachments, commands, timer, agents, model/thinking, consent, mic, send/stop. |
437
526
  | `<MessageList>` | The transcript; each answer with its steps, tool calls, thoughts, usage. |
438
- | `<StepList>` / `<ToolCallRow>` | Execution steps / one tool call with its cost and images. |
439
- | `<ToolApprovalPrompt>` | Consent cards (Allow once / Always / Deny). |
527
+ | `<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`). |
528
+ | `<SubagentTree>` / `<SubagentRow>` | The run's subagents - static ones and the helpers the model started - as an indented tree: status, model, tokens, time and a Stop button per node (`onStop`, `showUsage`, `showTools`, `renderSubagent`). |
529
+ | `<GeneratedMedia>` / `<TranscriptBlock>` | A file a media tool wrote, read from the workspace: an image inline or a native audio player (only the types the core generates; never SVG) / a folded "Transcript of …" block. `<MessageList files showMedia renderMedia>` places them in the answer. |
530
+ | `<ToolApprovalPrompt>` | Consent cards (Allow once / Always / Deny); a helper's request says which helper asks (`showHelper`). |
440
531
  | `<ApprovalModeSwitch>` | Segmented consent-mode switch. |
441
532
  | `<ChatHistoryList>` | Saved chats (from `useChatHistory`). |
442
533
  | `<FilesPanel>` | A `VirtualFileSystem`, live: preview, download, delete, upload. |
@@ -444,9 +535,10 @@ use them standalone. The full guide: [docs/chat.md](docs/chat.md).
444
535
  | `<ContextMeter>` | Tokens by kind, budget bar, last compaction, Compact. |
445
536
  | `<PlanView>` | A plan's reasoning + step list. |
446
537
  | `<ModelLoadBar>` | WebLLM download/init progress. |
447
- | `<UsageBadge>` | Compact token readout. |
538
+ | `<UsageBadge>` | Compact token readout; media and decision calls when there were some (`showCalls`). |
448
539
  | `<ApiKeyForm>` | BYOK key entry that writes to the encrypted vault. |
449
540
  | `<Composer>` | The minimal textarea + send/stop (kept for existing apps). |
541
+ | `<PipelineEditor>` and its parts | The pipeline editor - from `@dudko.dev/agent-web-react/pipeline`, styled by `pipeline.css`. See [Pipelines](#pipelines-an-editor-on-a-canvas). |
450
542
 
451
543
  ### Build your own UI
452
544
 
@@ -461,7 +553,7 @@ state = agentStateReducer(state, { type: 'event', event }) // fold each AgentEve
461
553
  ```
462
554
 
463
555
  The state is made of plain, exported view types you can render with your own components:
464
- `StepView` (a step and its `ToolCallView`s), `ApprovalView`, `SubagentView`, `UserNoteView` /
556
+ `StepView` (a step and its `ToolCallView`s; `StepEscalationView` for its escalations), `ApprovalView`, `SubagentView`, `UserNoteView` /
465
557
  `QueuedMessageView` (steering), `LessonView` / `FetchView` (the notebook and the pages fetched),
466
558
  `BudgetView`, `CompactionView`, `AttachmentView`, `ChatMessage` (a transcript entry that keeps its
467
559
  own steps, usage and duration). Outside `<AgentChat>`, `useAgentContext()` returns the controller of
@@ -507,7 +599,14 @@ from one place.
507
599
  is read, a metadata address is refused). The MCP and authorization servers it
508
600
  talks to are started on loopback by [`e2e/servers.ts`](e2e/servers.ts), CORS
509
601
  headers included β€” so the test also pins the deployment requirement that the
510
- challenge header be exposed.
602
+ challenge header be exposed;
603
+ - the pipeline editor at `/pipeline/` ([`e2e/pipeline.spec.ts`](e2e/pipeline.spec.ts)): a node
604
+ added, dragged and connected with the mouse and with the keyboard alone, a three-node
605
+ pipeline run for real against the scripted endpoint (nodes light up in order, the route is
606
+ taken, the loop runs once, the result is shown), stop and a failing node, import / export /
607
+ copy as code, the definition surviving a reload, the vault shared with the demo, and a phone:
608
+ no sideways scroll, the inspector as a bottom sheet, one finger panning and two zooming the
609
+ canvas while the page stays put.
511
610
 
512
611
  These cover what unit tests structurally cannot: effect ordering across a real
513
612
  render, a real navigation away and back, and IndexedDB.
@@ -527,6 +626,9 @@ pnpm --filter demo dev
527
626
  The demo aliases `@dudko.dev/agent-web-react` to this package's built `dist`, so rebuild the
528
627
  library after changing its source.
529
628
 
629
+ The same Vite project has a second page, the pipeline editor (`apps/demo/pipeline/index.html`),
630
+ served at `/pipeline/`: <http://localhost:5173/pipeline/> in dev.
631
+
530
632
  ## License
531
633
 
532
634
  MIT Β© Siarhei Dudko
@@ -0,0 +1,196 @@
1
+ // src/components/format.ts
2
+ var previewValue = (value, max = 140) => {
3
+ if (value === void 0) return "";
4
+ let text2;
5
+ if (typeof value === "string") text2 = value;
6
+ else {
7
+ try {
8
+ text2 = JSON.stringify(value);
9
+ } catch {
10
+ text2 = String(value);
11
+ }
12
+ }
13
+ text2 = text2.replace(/\s+/g, " ").trim();
14
+ return text2.length > max ? `${text2.slice(0, max - 1)}\u2026` : text2;
15
+ };
16
+ var formatTokens = (n) => n >= 1e3 ? `${(n / 1e3).toFixed(n >= 1e4 ? 0 : 1)}k` : String(n);
17
+ var formatDuration = (ms) => {
18
+ if (ms < 1e3) return `${Math.round(ms)} ms`;
19
+ if (ms < 6e4) return `${(ms / 1e3).toFixed(ms < 1e4 ? 1 : 0)} s`;
20
+ const s = Math.round(ms / 1e3);
21
+ return `${Math.floor(s / 60)}m ${s % 60}s`;
22
+ };
23
+ var isDataImage = (v) => typeof v === "string" && /^data:image\/[\w.+-]+;base64,/.test(v);
24
+ var imagesInOutput = (output, depth = 0) => {
25
+ if (depth > 2 || output == null) return [];
26
+ if (isDataImage(output)) return [output];
27
+ if (Array.isArray(output)) return output.flatMap((v) => imagesInOutput(v, depth + 1));
28
+ if (typeof output === "object") {
29
+ const o = output;
30
+ if (o.type === "image" && typeof o.data === "string") {
31
+ const mime = typeof o.mimeType === "string" ? o.mimeType : "image/png";
32
+ return [o.data.startsWith("data:") ? o.data : `data:${mime};base64,${o.data}`];
33
+ }
34
+ for (const key of ["dataUrl", "url", "image"])
35
+ if (isDataImage(o[key])) return [o[key]];
36
+ if (depth < 2) return Object.values(o).flatMap((v) => imagesInOutput(v, depth + 1));
37
+ }
38
+ return [];
39
+ };
40
+ var text = (v, max) => typeof v === "string" ? v.replace(/\s+/g, " ").trim().slice(0, max) : "";
41
+ var webSearchOf = (output) => {
42
+ let value = output;
43
+ if (typeof value === "string") {
44
+ try {
45
+ value = JSON.parse(value);
46
+ } catch {
47
+ return void 0;
48
+ }
49
+ }
50
+ if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
51
+ const o = value;
52
+ if (typeof o.query !== "string" || !Array.isArray(o.results)) return void 0;
53
+ const results = [];
54
+ for (const r of o.results.slice(0, 10)) {
55
+ if (!r || typeof r !== "object") continue;
56
+ const item = r;
57
+ if (typeof item.url !== "string") continue;
58
+ let url;
59
+ try {
60
+ url = new URL(item.url);
61
+ } catch {
62
+ continue;
63
+ }
64
+ if (url.protocol !== "https:" && url.protocol !== "http:") continue;
65
+ const date = text(item.date, 40);
66
+ results.push({
67
+ title: text(item.title, 200) || url.host,
68
+ url: url.href,
69
+ host: url.host,
70
+ snippet: text(item.snippet, 400),
71
+ ...date ? { date } : {}
72
+ });
73
+ }
74
+ return {
75
+ query: text(o.query, 300),
76
+ results,
77
+ filtered: typeof o.filtered === "number" && o.filtered > 0 ? o.filtered : 0,
78
+ truncated: o.truncated === true
79
+ };
80
+ };
81
+ var formatProbability = (p) => String(Math.round(p * 100) / 100);
82
+
83
+ // src/util.ts
84
+ var errMessage = (err) => err instanceof Error ? err.message : String(err);
85
+
86
+ // src/components/icons.tsx
87
+ import { jsx, jsxs } from "react/jsx-runtime";
88
+ var base = (size = 16) => ({
89
+ width: size,
90
+ height: size,
91
+ viewBox: "0 0 24 24",
92
+ fill: "none",
93
+ stroke: "currentColor",
94
+ strokeWidth: 2,
95
+ strokeLinecap: "round",
96
+ strokeLinejoin: "round",
97
+ "aria-hidden": true
98
+ });
99
+ var SendIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
100
+ /* @__PURE__ */ jsx("path", { d: "M22 2 11 13" }),
101
+ /* @__PURE__ */ jsx("path", { d: "M22 2 15 22l-4-9-9-4Z" })
102
+ ] });
103
+ var StopIcon = ({ size, className }) => /* @__PURE__ */ jsx("svg", { ...base(size), className, children: /* @__PURE__ */ jsx("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" }) });
104
+ var SpinnerIcon = ({ size, className }) => /* @__PURE__ */ jsx("svg", { ...base(size), className: ["awr-spin", className].filter(Boolean).join(" "), children: /* @__PURE__ */ jsx("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }) });
105
+ var CheckIcon = ({ size, className }) => /* @__PURE__ */ jsx("svg", { ...base(size), className, children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" }) });
106
+ var AlertIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
107
+ /* @__PURE__ */ jsx("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" }),
108
+ /* @__PURE__ */ jsx("path", { d: "M12 9v4" }),
109
+ /* @__PURE__ */ jsx("path", { d: "M12 17h.01" })
110
+ ] });
111
+ var ArrowUpIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
112
+ /* @__PURE__ */ jsx("path", { d: "M12 19V5" }),
113
+ /* @__PURE__ */ jsx("path", { d: "m5 12 7-7 7 7" })
114
+ ] });
115
+ var ToolIcon = ({ size, className }) => /* @__PURE__ */ jsx("svg", { ...base(size), className, children: /* @__PURE__ */ jsx("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" }) });
116
+ var ChevronIcon = ({ size, className }) => /* @__PURE__ */ jsx("svg", { ...base(size), className, children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" }) });
117
+ var ShieldIcon = ({ size, className }) => /* @__PURE__ */ jsx("svg", { ...base(size), className, children: /* @__PURE__ */ jsx("path", { d: "M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z" }) });
118
+ var BrainIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
119
+ /* @__PURE__ */ jsx("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" }),
120
+ /* @__PURE__ */ jsx("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" })
121
+ ] });
122
+ var BotIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
123
+ /* @__PURE__ */ jsx("rect", { x: "4", y: "8", width: "16", height: "12", rx: "3" }),
124
+ /* @__PURE__ */ jsx("path", { d: "M12 8V4" }),
125
+ /* @__PURE__ */ jsx("path", { d: "M9 14h.01M15 14h.01" })
126
+ ] });
127
+ var PlusIcon = ({ size, className }) => /* @__PURE__ */ jsx("svg", { ...base(size), className, children: /* @__PURE__ */ jsx("path", { d: "M12 5v14M5 12h14" }) });
128
+ var SlashIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
129
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "3", width: "18", height: "18", rx: "3" }),
130
+ /* @__PURE__ */ jsx("path", { d: "m15 7-6 10" })
131
+ ] });
132
+ var ClockIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
133
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "9" }),
134
+ /* @__PURE__ */ jsx("path", { d: "M12 7v5l3 2" })
135
+ ] });
136
+ var MicIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
137
+ /* @__PURE__ */ jsx("rect", { x: "9", y: "3", width: "6", height: "11", rx: "3" }),
138
+ /* @__PURE__ */ jsx("path", { d: "M5 11a7 7 0 0 0 14 0M12 18v3" })
139
+ ] });
140
+ var BoltIcon = ({ size, className }) => /* @__PURE__ */ jsx("svg", { ...base(size), className, children: /* @__PURE__ */ jsx("path", { d: "M13 2 4 14h7l-1 8 9-12h-7Z" }) });
141
+ var EyeIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
142
+ /* @__PURE__ */ jsx("path", { d: "M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12Z" }),
143
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "3" })
144
+ ] });
145
+ var XIcon = ({ size, className }) => /* @__PURE__ */ jsx("svg", { ...base(size), className, children: /* @__PURE__ */ jsx("path", { d: "M18 6 6 18M6 6l12 12" }) });
146
+ var FileIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
147
+ /* @__PURE__ */ jsx("path", { d: "M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9Z" }),
148
+ /* @__PURE__ */ jsx("path", { d: "M14 3v6h6" })
149
+ ] });
150
+ var HistoryIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
151
+ /* @__PURE__ */ jsx("path", { d: "M3 12a9 9 0 1 0 3-6.7L3 8" }),
152
+ /* @__PURE__ */ jsx("path", { d: "M3 3v5h5M12 7v5l3 2" })
153
+ ] });
154
+ var BookIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
155
+ /* @__PURE__ */ jsx("path", { d: "M4 5a2 2 0 0 1 2-2h13v16H6a2 2 0 0 0-2 2Z" }),
156
+ /* @__PURE__ */ jsx("path", { d: "M4 19V5M9 7h6" })
157
+ ] });
158
+ var GlobeIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
159
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "9" }),
160
+ /* @__PURE__ */ jsx("path", { d: "M3 12h18M12 3c3 3.2 3 14.8 0 18M12 3c-3 3.2-3 14.8 0 18" })
161
+ ] });
162
+ var DownloadIcon = ({ size, className }) => /* @__PURE__ */ jsx("svg", { ...base(size), className, children: /* @__PURE__ */ jsx("path", { d: "M12 3v12m-5-5 5 5 5-5M5 21h14" }) });
163
+
164
+ export {
165
+ errMessage,
166
+ SendIcon,
167
+ StopIcon,
168
+ SpinnerIcon,
169
+ CheckIcon,
170
+ AlertIcon,
171
+ ArrowUpIcon,
172
+ ToolIcon,
173
+ ChevronIcon,
174
+ ShieldIcon,
175
+ BrainIcon,
176
+ BotIcon,
177
+ PlusIcon,
178
+ SlashIcon,
179
+ ClockIcon,
180
+ MicIcon,
181
+ BoltIcon,
182
+ EyeIcon,
183
+ XIcon,
184
+ FileIcon,
185
+ HistoryIcon,
186
+ BookIcon,
187
+ GlobeIcon,
188
+ DownloadIcon,
189
+ previewValue,
190
+ formatTokens,
191
+ formatDuration,
192
+ imagesInOutput,
193
+ webSearchOf,
194
+ formatProbability
195
+ };
196
+ //# sourceMappingURL=chunk-UUB7CE6N.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","// 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"],"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,KAAK,MAAM,KAAK,GAAI;AAC9B,SAAO,GAAG,KAAK,MAAM,IAAI,EAAE,CAAC,KAAK,IAAI,EAAE;AACzC;AAEA,IAAM,cAAc,CAAC,MACnB,O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