@dudko.dev/agent-web-ui 0.0.2 → 0.0.3
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 +28 -2
- package/dist/canvas.cjs +0 -1
- package/dist/canvas.js +1 -2
- package/dist/{chunk-EL2YCROY.js → chunk-D64VLIRY.js} +0 -1
- package/dist/{chunk-ZBHESK6V.js → chunk-G7LQTOA2.js} +0 -1
- package/dist/{chunk-SVYHDLAZ.js → chunk-S5AHUAFG.js} +0 -1
- package/dist/{chunk-7O64ZI6Z.js → chunk-TJBGZM6D.js} +0 -1
- package/dist/{chunk-WFM6B7CL.js → chunk-UNIXGP4N.js} +0 -1
- package/dist/{chunk-VCR7LU7J.js → chunk-V33T6VX3.js} +0 -1
- package/dist/{chunk-WZ7K7JIP.js → chunk-VZCQXE3P.js} +0 -1
- package/dist/{chunk-GB7RZJMG.js → chunk-WEYQMUKY.js} +0 -1
- package/dist/{chunk-KZQB35LS.js → chunk-Y6QYUFSC.js} +0 -1
- package/dist/controller.cjs +0 -1
- package/dist/controller.js +1 -2
- package/dist/index.cjs +0 -1
- package/dist/index.js +3 -4
- package/dist/locales/be.cjs +0 -1
- package/dist/locales/be.js +1 -2
- package/dist/locales/bg.cjs +0 -1
- package/dist/locales/bg.js +1 -2
- package/dist/locales/ca.cjs +0 -1
- package/dist/locales/ca.js +1 -2
- package/dist/locales/cs.cjs +0 -1
- package/dist/locales/cs.js +1 -2
- package/dist/locales/da.cjs +0 -1
- package/dist/locales/da.js +1 -2
- package/dist/locales/de.cjs +0 -1
- package/dist/locales/de.js +1 -2
- package/dist/locales/el.cjs +0 -1
- package/dist/locales/el.js +1 -2
- package/dist/locales/en.cjs +0 -1
- package/dist/locales/en.js +1 -2
- package/dist/locales/es-419.cjs +0 -1
- package/dist/locales/es-419.js +2 -3
- package/dist/locales/es.cjs +0 -1
- package/dist/locales/es.js +2 -3
- package/dist/locales/fi.cjs +0 -1
- package/dist/locales/fi.js +1 -2
- package/dist/locales/fr-CA.cjs +0 -1
- package/dist/locales/fr-CA.js +2 -3
- package/dist/locales/fr.cjs +0 -1
- package/dist/locales/fr.js +2 -3
- package/dist/locales/gn.cjs +0 -1
- package/dist/locales/gn.js +1 -2
- package/dist/locales/hr.cjs +0 -1
- package/dist/locales/hr.js +1 -2
- package/dist/locales/ht.cjs +0 -1
- package/dist/locales/ht.js +1 -2
- package/dist/locales/hu.cjs +0 -1
- package/dist/locales/hu.js +1 -2
- package/dist/locales/index.cjs +0 -1
- package/dist/locales/index.js +1 -2
- package/dist/locales/it.cjs +0 -1
- package/dist/locales/it.js +1 -2
- package/dist/locales/nb.cjs +0 -1
- package/dist/locales/nb.js +1 -2
- package/dist/locales/nl.cjs +0 -1
- package/dist/locales/nl.js +1 -2
- package/dist/locales/pl.cjs +0 -1
- package/dist/locales/pl.js +1 -2
- package/dist/locales/pt-BR.cjs +0 -1
- package/dist/locales/pt-BR.js +1 -2
- package/dist/locales/pt.cjs +0 -1
- package/dist/locales/pt.js +1 -2
- package/dist/locales/qu.cjs +0 -1
- package/dist/locales/qu.js +1 -2
- package/dist/locales/ro.cjs +0 -1
- package/dist/locales/ro.js +1 -2
- package/dist/locales/ru.cjs +0 -1
- package/dist/locales/ru.js +1 -2
- package/dist/locales/sk.cjs +0 -1
- package/dist/locales/sk.js +1 -2
- package/dist/locales/sq.cjs +0 -1
- package/dist/locales/sq.js +1 -2
- package/dist/locales/sr-Latn.cjs +0 -1
- package/dist/locales/sr-Latn.js +2 -3
- package/dist/locales/sr.cjs +0 -1
- package/dist/locales/sr.js +2 -3
- package/dist/locales/sv.cjs +0 -1
- package/dist/locales/sv.js +1 -2
- package/dist/locales/tr.cjs +0 -1
- package/dist/locales/tr.js +1 -2
- package/dist/locales/uk.cjs +0 -1
- package/dist/locales/uk.js +1 -2
- package/dist/markdown.cjs +0 -1
- package/dist/markdown.js +1 -2
- package/dist/mcp-app-sandbox.cjs +0 -1
- package/dist/mcp-app-sandbox.js +1 -2
- package/dist/mcp-app.cjs +0 -1
- package/dist/mcp-app.js +2 -3
- package/dist/pipeline.cjs +0 -1
- package/dist/pipeline.js +1 -2
- package/package.json +2 -2
- package/dist/canvas.cjs.map +0 -1
- package/dist/canvas.js.map +0 -1
- package/dist/chunk-7O64ZI6Z.js.map +0 -1
- package/dist/chunk-EL2YCROY.js.map +0 -1
- package/dist/chunk-GB7RZJMG.js.map +0 -1
- package/dist/chunk-KZQB35LS.js.map +0 -1
- package/dist/chunk-SVYHDLAZ.js.map +0 -1
- package/dist/chunk-VCR7LU7J.js.map +0 -1
- package/dist/chunk-WFM6B7CL.js.map +0 -1
- package/dist/chunk-WZ7K7JIP.js.map +0 -1
- package/dist/chunk-ZBHESK6V.js.map +0 -1
- package/dist/controller.cjs.map +0 -1
- package/dist/controller.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/locales/be.cjs.map +0 -1
- package/dist/locales/be.js.map +0 -1
- package/dist/locales/bg.cjs.map +0 -1
- package/dist/locales/bg.js.map +0 -1
- package/dist/locales/ca.cjs.map +0 -1
- package/dist/locales/ca.js.map +0 -1
- package/dist/locales/cs.cjs.map +0 -1
- package/dist/locales/cs.js.map +0 -1
- package/dist/locales/da.cjs.map +0 -1
- package/dist/locales/da.js.map +0 -1
- package/dist/locales/de.cjs.map +0 -1
- package/dist/locales/de.js.map +0 -1
- package/dist/locales/el.cjs.map +0 -1
- package/dist/locales/el.js.map +0 -1
- package/dist/locales/en.cjs.map +0 -1
- package/dist/locales/en.js.map +0 -1
- package/dist/locales/es-419.cjs.map +0 -1
- package/dist/locales/es-419.js.map +0 -1
- package/dist/locales/es.cjs.map +0 -1
- package/dist/locales/es.js.map +0 -1
- package/dist/locales/fi.cjs.map +0 -1
- package/dist/locales/fi.js.map +0 -1
- package/dist/locales/fr-CA.cjs.map +0 -1
- package/dist/locales/fr-CA.js.map +0 -1
- package/dist/locales/fr.cjs.map +0 -1
- package/dist/locales/fr.js.map +0 -1
- package/dist/locales/gn.cjs.map +0 -1
- package/dist/locales/gn.js.map +0 -1
- package/dist/locales/hr.cjs.map +0 -1
- package/dist/locales/hr.js.map +0 -1
- package/dist/locales/ht.cjs.map +0 -1
- package/dist/locales/ht.js.map +0 -1
- package/dist/locales/hu.cjs.map +0 -1
- package/dist/locales/hu.js.map +0 -1
- package/dist/locales/index.cjs.map +0 -1
- package/dist/locales/index.js.map +0 -1
- package/dist/locales/it.cjs.map +0 -1
- package/dist/locales/it.js.map +0 -1
- package/dist/locales/nb.cjs.map +0 -1
- package/dist/locales/nb.js.map +0 -1
- package/dist/locales/nl.cjs.map +0 -1
- package/dist/locales/nl.js.map +0 -1
- package/dist/locales/pl.cjs.map +0 -1
- package/dist/locales/pl.js.map +0 -1
- package/dist/locales/pt-BR.cjs.map +0 -1
- package/dist/locales/pt-BR.js.map +0 -1
- package/dist/locales/pt.cjs.map +0 -1
- package/dist/locales/pt.js.map +0 -1
- package/dist/locales/qu.cjs.map +0 -1
- package/dist/locales/qu.js.map +0 -1
- package/dist/locales/ro.cjs.map +0 -1
- package/dist/locales/ro.js.map +0 -1
- package/dist/locales/ru.cjs.map +0 -1
- package/dist/locales/ru.js.map +0 -1
- package/dist/locales/sk.cjs.map +0 -1
- package/dist/locales/sk.js.map +0 -1
- package/dist/locales/sq.cjs.map +0 -1
- package/dist/locales/sq.js.map +0 -1
- package/dist/locales/sr-Latn.cjs.map +0 -1
- package/dist/locales/sr-Latn.js.map +0 -1
- package/dist/locales/sr.cjs.map +0 -1
- package/dist/locales/sr.js.map +0 -1
- package/dist/locales/sv.cjs.map +0 -1
- package/dist/locales/sv.js.map +0 -1
- package/dist/locales/tr.cjs.map +0 -1
- package/dist/locales/tr.js.map +0 -1
- package/dist/locales/uk.cjs.map +0 -1
- package/dist/locales/uk.js.map +0 -1
- package/dist/markdown.cjs.map +0 -1
- package/dist/markdown.js.map +0 -1
- package/dist/mcp-app-sandbox.cjs.map +0 -1
- package/dist/mcp-app-sandbox.js.map +0 -1
- package/dist/mcp-app.cjs.map +0 -1
- package/dist/mcp-app.js.map +0 -1
- package/dist/pipeline.cjs.map +0 -1
- package/dist/pipeline.js.map +0 -1
package/dist/locales/pt-BR.js
CHANGED
package/dist/locales/pt.cjs
CHANGED
package/dist/locales/pt.js
CHANGED
package/dist/locales/qu.cjs
CHANGED
package/dist/locales/qu.js
CHANGED
package/dist/locales/ro.cjs
CHANGED
package/dist/locales/ro.js
CHANGED
package/dist/locales/ru.cjs
CHANGED
package/dist/locales/ru.js
CHANGED
package/dist/locales/sk.cjs
CHANGED
package/dist/locales/sk.js
CHANGED
package/dist/locales/sq.cjs
CHANGED
package/dist/locales/sq.js
CHANGED
package/dist/locales/sr-Latn.cjs
CHANGED
package/dist/locales/sr-Latn.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
catalog
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-V33T6VX3.js";
|
|
4
4
|
import {
|
|
5
5
|
labelsFromCatalog
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-UNIXGP4N.js";
|
|
7
7
|
|
|
8
8
|
// src/locales/translit.ts
|
|
9
9
|
var MAP = {
|
|
@@ -83,4 +83,3 @@ export {
|
|
|
83
83
|
catalog2 as catalog,
|
|
84
84
|
labels
|
|
85
85
|
};
|
|
86
|
-
//# sourceMappingURL=sr-Latn.js.map
|
package/dist/locales/sr.cjs
CHANGED
package/dist/locales/sr.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
catalog
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-V33T6VX3.js";
|
|
4
4
|
import {
|
|
5
5
|
labelsFromCatalog
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-UNIXGP4N.js";
|
|
7
7
|
|
|
8
8
|
// src/locales/sr.ts
|
|
9
9
|
var labels = labelsFromCatalog("sr", catalog);
|
|
@@ -11,4 +11,3 @@ export {
|
|
|
11
11
|
catalog,
|
|
12
12
|
labels
|
|
13
13
|
};
|
|
14
|
-
//# sourceMappingURL=sr.js.map
|
package/dist/locales/sv.cjs
CHANGED
package/dist/locales/sv.js
CHANGED
package/dist/locales/tr.cjs
CHANGED
package/dist/locales/tr.js
CHANGED
package/dist/locales/uk.cjs
CHANGED
package/dist/locales/uk.js
CHANGED
package/dist/markdown.cjs
CHANGED
package/dist/markdown.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
workspacePathOf
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TJBGZM6D.js";
|
|
4
4
|
|
|
5
5
|
// src/markdown/parse.ts
|
|
6
6
|
var decoded = (s) => {
|
|
@@ -570,4 +570,3 @@ export {
|
|
|
570
570
|
safeHref,
|
|
571
571
|
workspaceLinkPath
|
|
572
572
|
};
|
|
573
|
-
//# sourceMappingURL=markdown.js.map
|
package/dist/mcp-app-sandbox.cjs
CHANGED
package/dist/mcp-app-sandbox.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
mcpAppPolicyOfToken,
|
|
11
11
|
mcpAppPolicyOrigin,
|
|
12
12
|
mcpAppPolicyToken
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-WEYQMUKY.js";
|
|
14
14
|
|
|
15
15
|
// src/mcp-app-sandbox.ts
|
|
16
16
|
var LABEL = "[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?";
|
|
@@ -206,4 +206,3 @@ export {
|
|
|
206
206
|
mcpAppSandboxResponse,
|
|
207
207
|
parseMcpAppSandboxHosts
|
|
208
208
|
};
|
|
209
|
-
//# sourceMappingURL=mcp-app-sandbox.js.map
|
package/dist/mcp-app.cjs
CHANGED
package/dist/mcp-app.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
cspMetaTag,
|
|
3
3
|
escapeAttribute,
|
|
4
4
|
withPolicyFirst
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-D64VLIRY.js";
|
|
6
6
|
import {
|
|
7
7
|
MCP_APP_POLICY_MAX_ORIGINS,
|
|
8
8
|
MCP_APP_POLICY_TOKEN_MAX_CHARS,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
mcpAppPolicyOfToken,
|
|
16
16
|
mcpAppPolicyOrigin,
|
|
17
17
|
mcpAppPolicyToken
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-WEYQMUKY.js";
|
|
19
19
|
|
|
20
20
|
// src/mcp-app.ts
|
|
21
21
|
import { mcpAppOrigin } from "@dudko.dev/agent-web";
|
|
@@ -813,4 +813,3 @@ export {
|
|
|
813
813
|
resolveAppDownload,
|
|
814
814
|
saveAppFile
|
|
815
815
|
};
|
|
816
|
-
//# sourceMappingURL=mcp-app.js.map
|
package/dist/pipeline.cjs
CHANGED
package/dist/pipeline.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defaultCanvasLabels
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-Y6QYUFSC.js";
|
|
4
4
|
|
|
5
5
|
// src/pipeline/state.ts
|
|
6
6
|
var ZERO = { inputTokens: 0, outputTokens: 0, totalTokens: 0 };
|
|
@@ -775,4 +775,3 @@ export {
|
|
|
775
775
|
updateEdge,
|
|
776
776
|
updateNode
|
|
777
777
|
};
|
|
778
|
-
//# sourceMappingURL=pipeline.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dudko.dev/agent-web-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The framework-free UI logic of @dudko.dev/agent-web, the in-browser LLM agent: the headless reducer that turns the agent's events into UI state, every UI string, the composer's and transcript's pure helpers, voice, saved chats, the sandboxed-frame and MCP Apps security cores, the MCP Apps sandbox page for a server, and the pipeline editor's logic - plus the stylesheets. No React: build a front end for any framework on it.",
|
|
6
6
|
"type": "module",
|
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
"prettier": "^3.10.1",
|
|
183
183
|
"tsup": "^9.0.0",
|
|
184
184
|
"typescript": "^6.0.3",
|
|
185
|
-
"@dudko.dev/agent-web": "0.0.
|
|
185
|
+
"@dudko.dev/agent-web": "0.0.54",
|
|
186
186
|
"@dudko.dev/test-servers": "0.0.0"
|
|
187
187
|
},
|
|
188
188
|
"scripts": {
|
package/dist/canvas.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/canvas/index.ts","../src/canvas/labels.ts","../src/canvas/geometry.ts"],"sourcesContent":["// The generic canvas's maths (pure functions) and its strings: nothing of agents, no React, no\n// import at all. The React canvas (`@dudko.dev/agent-web-react/pipeline`'s `Canvas`) draws with it;\n// another framework's canvas can too.\nexport { defaultCanvasLabels } from './labels.js'\nexport type { CanvasLabels } from './labels.js'\nexport {\n boundsOf,\n centerOn,\n clamp,\n curvePath,\n curvePoint,\n DEFAULT_MAX_ZOOM,\n DEFAULT_MIN_ZOOM,\n distanceToCurve,\n edgeCurve,\n fitViewport,\n hitEdge,\n hitNode,\n IDENTITY_VIEWPORT,\n inputAnchor,\n isRectVisible,\n outputAnchor,\n panBy,\n pinchViewport,\n readingOrder,\n rectContains,\n screenToWorld,\n snapPoint,\n snapTo,\n worldToScreen,\n zoomAt,\n} from './geometry.js'\nexport type {\n Curve,\n EdgeCurveOptions,\n FitOptions,\n Point,\n Rect,\n Size,\n Viewport,\n} from './geometry.js'\n","// The canvas's strings: what it shows and says to a screen reader. Generic - nothing of agents.\n\n/** Every string the canvas shows or says. */\nexport interface CanvasLabels {\n /** The canvas's own name for a screen reader. */\n canvas: string\n /** How to use it with a keyboard; read once, when the canvas is focused. */\n help: string\n /** `aria-roledescription` of a node. */\n node: string\n edge: (from: string, to: string, description?: string) => string\n port: (node: string, port?: string) => string\n connectsTo: (names: string) => string\n receivesFrom: (names: string) => string\n zoomIn: string\n zoomOut: string\n fit: string\n zoomLevel: (percent: number) => string\n /** Shown (and announced) while a connection is being made without dragging. */\n connectHint: (from: string) => string\n cancel: string\n connected: (from: string, to: string) => string\n}\n\nexport const defaultCanvasLabels: CanvasLabels = {\n canvas: 'Canvas',\n help: 'Tab moves between nodes and their connections. Arrow keys move the selected node, Enter opens it, Delete removes it, C starts a connection, Escape clears the selection. On the canvas itself the arrow keys pan, plus and minus zoom, 0 fits everything.',\n node: 'node',\n edge: (from, to, description) =>\n `Connection from ${from} to ${to}${description ? `: ${description}` : ''}`,\n port: (node, port) => `Connect ${node}${port ? ` (${port})` : ''} to another node`,\n connectsTo: (names) => `Connects to: ${names}.`,\n receivesFrom: (names) => `Receives from: ${names}.`,\n zoomIn: 'Zoom in',\n zoomOut: 'Zoom out',\n fit: 'Fit to view',\n zoomLevel: (percent) => `${percent}%`,\n connectHint: (from) => `Pick the node to connect ${from} to`,\n cancel: 'Cancel',\n connected: (from, to) => `Connected ${from} to ${to}`,\n}\n","// The canvas's maths: viewport transforms, fitting, hit testing and the shape of an edge.\n// Pure functions over plain numbers - no DOM, no React - so they are unit-tested as they are.\n\nexport interface Point {\n x: number\n y: number\n}\n\nexport interface Size {\n width: number\n height: number\n}\n\nexport interface Rect extends Point, Size {}\n\n/**\n * Where the world sits on the screen: a world point `p` is drawn at\n * `p * zoom + (x, y)`, in pixels from the canvas's top-left corner.\n */\nexport interface Viewport {\n x: number\n y: number\n zoom: number\n}\n\n/** The four control points of a cubic Bezier curve. */\nexport interface Curve {\n p0: Point\n p1: Point\n p2: Point\n p3: Point\n}\n\nexport const DEFAULT_MIN_ZOOM = 0.25\nexport const DEFAULT_MAX_ZOOM = 2\nexport const IDENTITY_VIEWPORT: Viewport = { x: 0, y: 0, zoom: 1 }\n\nexport const clamp = (value: number, min: number, max: number): number =>\n Math.min(max, Math.max(min, value))\n\nexport const screenToWorld = (point: Point, viewport: Viewport): Point => ({\n x: (point.x - viewport.x) / viewport.zoom,\n y: (point.y - viewport.y) / viewport.zoom,\n})\n\nexport const worldToScreen = (point: Point, viewport: Viewport): Point => ({\n x: point.x * viewport.zoom + viewport.x,\n y: point.y * viewport.zoom + viewport.y,\n})\n\nexport const panBy = (viewport: Viewport, dx: number, dy: number): Viewport => ({\n ...viewport,\n x: viewport.x + dx,\n y: viewport.y + dy,\n})\n\n/** Set the zoom, keeping the world point under `anchor` (a screen point) where it is. */\nexport const zoomAt = (\n viewport: Viewport,\n zoom: number,\n anchor: Point,\n minZoom = DEFAULT_MIN_ZOOM,\n maxZoom = DEFAULT_MAX_ZOOM,\n): Viewport => {\n const next = clamp(zoom, minZoom, maxZoom)\n if (next === viewport.zoom) return viewport\n const world = screenToWorld(anchor, viewport)\n return { zoom: next, x: anchor.x - world.x * next, y: anchor.y - world.y * next }\n}\n\n/**\n * Two fingers moved from `before` to `after` (screen points): zoom by how far apart they went,\n * and keep the world point that was between them under the point that is between them now.\n */\nexport const pinchViewport = (\n viewport: Viewport,\n before: [Point, Point],\n after: [Point, Point],\n minZoom = DEFAULT_MIN_ZOOM,\n maxZoom = DEFAULT_MAX_ZOOM,\n): Viewport => {\n const distance = (a: Point, b: Point) => Math.hypot(a.x - b.x, a.y - b.y)\n const middle = (a: Point, b: Point): Point => ({ x: (a.x + b.x) / 2, y: (a.y + b.y) / 2 })\n const was = distance(before[0], before[1])\n const is = distance(after[0], after[1])\n const zoom = clamp(was > 0 ? (viewport.zoom * is) / was : viewport.zoom, minZoom, maxZoom)\n const world = screenToWorld(middle(before[0], before[1]), viewport)\n const at = middle(after[0], after[1])\n return { zoom, x: at.x - world.x * zoom, y: at.y - world.y * zoom }\n}\n\n/** The smallest rectangle around all of `rects`; undefined when there are none. */\nexport const boundsOf = (rects: Rect[]): Rect | undefined => {\n if (rects.length === 0) return undefined\n let left = Infinity\n let top = Infinity\n let right = -Infinity\n let bottom = -Infinity\n for (const r of rects) {\n left = Math.min(left, r.x)\n top = Math.min(top, r.y)\n right = Math.max(right, r.x + r.width)\n bottom = Math.max(bottom, r.y + r.height)\n }\n return { x: left, y: top, width: right - left, height: bottom - top }\n}\n\nexport interface FitOptions {\n /** Free space kept around the content, in screen pixels (default 48). */\n padding?: number\n minZoom?: number\n /** Fitting never zooms in past this (default 1: a small graph is not blown up). */\n maxZoom?: number\n}\n\n// One axis of a fit: centred when the content fits, from its start (the padding kept) when it\n// does not - a graph too large for the canvas at the smallest zoom shows where it begins.\nconst fitAxis = (start: number, length: number, room: number, zoom: number, padding: number) =>\n length * zoom <= room - padding * 2 + 0.5\n ? (room - length * zoom) / 2 - start * zoom\n : padding - start * zoom\n\n/**\n * The viewport that shows all of `rects` centred in a canvas of `size`. When they do not fit at\n * `minZoom`, it shows them from their top-left corner at that zoom instead.\n */\nexport const fitViewport = (rects: Rect[], size: Size, options: FitOptions = {}): Viewport => {\n const bounds = boundsOf(rects)\n if (!bounds || size.width <= 0 || size.height <= 0) return IDENTITY_VIEWPORT\n const { minZoom = DEFAULT_MIN_ZOOM, maxZoom = 1 } = options\n // A narrow canvas cannot afford the padding a wide one has.\n const padding = Math.min(options.padding ?? 48, size.width / 8, size.height / 8)\n const zoom = clamp(\n Math.min(\n (size.width - padding * 2) / Math.max(bounds.width, 1),\n (size.height - padding * 2) / Math.max(bounds.height, 1),\n ),\n minZoom,\n maxZoom,\n )\n return {\n zoom,\n x: fitAxis(bounds.x, bounds.width, size.width, zoom, padding),\n y: fitAxis(bounds.y, bounds.height, size.height, zoom, padding),\n }\n}\n\n/** The viewport with `rect` in the middle of a canvas of `size`, at the zoom given. */\nexport const centerOn = (rect: Rect, size: Size, zoom: number): Viewport => ({\n zoom,\n x: size.width / 2 - (rect.x + rect.width / 2) * zoom,\n y: size.height / 2 - (rect.y + rect.height / 2) * zoom,\n})\n\n/** Is any part of `rect` (world) inside a canvas of `size` under `viewport`? */\nexport const isRectVisible = (rect: Rect, size: Size, viewport: Viewport): boolean => {\n const a = worldToScreen(rect, viewport)\n const b = worldToScreen({ x: rect.x + rect.width, y: rect.y + rect.height }, viewport)\n return b.x > 0 && b.y > 0 && a.x < size.width && a.y < size.height\n}\n\nexport const snapTo = (value: number, grid: number): number =>\n // `+ 0`: a rounded-away negative is 0, not -0.\n grid > 0 ? Math.round(value / grid) * grid + 0 : value\n\nexport const snapPoint = (point: Point, grid: number): Point => ({\n x: snapTo(point.x, grid),\n y: snapTo(point.y, grid),\n})\n\nexport const rectContains = (rect: Rect, point: Point): boolean =>\n point.x >= rect.x &&\n point.x <= rect.x + rect.width &&\n point.y >= rect.y &&\n point.y <= rect.y + rect.height\n\n/** The id of the node under `point` (world). Later nodes are drawn on top, so they win. */\nexport const hitNode = <T extends Rect & { id: string }>(\n nodes: T[],\n point: Point,\n): string | undefined => {\n for (let i = nodes.length - 1; i >= 0; i--) {\n if (rectContains(nodes[i], point)) return nodes[i].id\n }\n return undefined\n}\n\n/** Where an edge enters a node: the middle of its left side. */\nexport const inputAnchor = (rect: Rect): Point => ({ x: rect.x, y: rect.y + rect.height / 2 })\n\n/** Where an edge leaves a node that has `count` output ports: spread down its right side. */\nexport const outputAnchor = (rect: Rect, index = 0, count = 1): Point => ({\n x: rect.x + rect.width,\n y: rect.y + (rect.height * (index + 1)) / (Math.max(count, 1) + 1),\n})\n\nexport interface EdgeCurveOptions {\n /**\n * How far an edge that runs backwards (its target is to the left of its source) swings below\n * the two nodes so that it does not cross them (default 90).\n */\n clearance?: number\n}\n\n/**\n * The curve of an edge that leaves `from` to the right and enters `to` from the left. A forward\n * edge is a plain S; a backward one (a loop) swings out and around.\n */\nexport const edgeCurve = (from: Point, to: Point, options: EdgeCurveOptions = {}): Curve => {\n const dx = to.x - from.x\n const dy = to.y - from.y\n if (dx >= 40) {\n const reach = Math.max(dx / 2, 40)\n return {\n p0: from,\n p1: { x: from.x + reach, y: from.y },\n p2: { x: to.x - reach, y: to.y },\n p3: to,\n }\n }\n const reach = clamp(60 + Math.abs(dx) / 4, 60, 220)\n const clearance = options.clearance ?? 90\n // Nearly level: go around below. Otherwise the height difference already keeps it clear.\n const swing = Math.abs(dy) < clearance ? clearance + Math.abs(dy) / 2 : 0\n return {\n p0: from,\n p1: { x: from.x + reach, y: from.y + swing },\n p2: { x: to.x - reach, y: to.y + swing },\n p3: to,\n }\n}\n\nconst round = (n: number): number => Math.round(n * 100) / 100\n\n/** The SVG path data of a curve. */\nexport const curvePath = ({ p0, p1, p2, p3 }: Curve): string =>\n `M ${round(p0.x)} ${round(p0.y)} C ${round(p1.x)} ${round(p1.y)}, ${round(p2.x)} ${round(p2.y)}, ${round(p3.x)} ${round(p3.y)}`\n\n/** The point of a curve at `t` in 0..1. */\nexport const curvePoint = ({ p0, p1, p2, p3 }: Curve, t: number): Point => {\n const u = 1 - t\n const a = u * u * u\n const b = 3 * u * u * t\n const c = 3 * u * t * t\n const d = t * t * t\n return {\n x: a * p0.x + b * p1.x + c * p2.x + d * p3.x,\n y: a * p0.y + b * p1.y + c * p2.y + d * p3.y,\n }\n}\n\nconst distanceToSegment = (p: Point, a: Point, b: Point): number => {\n const dx = b.x - a.x\n const dy = b.y - a.y\n const length = dx * dx + dy * dy\n const t = length === 0 ? 0 : clamp(((p.x - a.x) * dx + (p.y - a.y) * dy) / length, 0, 1)\n return Math.hypot(p.x - (a.x + t * dx), p.y - (a.y + t * dy))\n}\n\n/** How far `point` is from a curve (the curve is walked in `samples` straight pieces). */\nexport const distanceToCurve = (curve: Curve, point: Point, samples = 24): number => {\n let best = Infinity\n let previous = curve.p0\n for (let i = 1; i <= samples; i++) {\n const next = curvePoint(curve, i / samples)\n best = Math.min(best, distanceToSegment(point, previous, next))\n previous = next\n }\n return best\n}\n\n/** The id of the edge within `tolerance` of `point`, the nearest one when several are. */\nexport const hitEdge = (\n edges: { id: string; curve: Curve }[],\n point: Point,\n tolerance = 8,\n): string | undefined => {\n let best: string | undefined\n let bestDistance = Infinity\n for (const edge of edges) {\n const distance = distanceToCurve(edge.curve, point)\n if (distance <= tolerance && distance < bestDistance) {\n best = edge.id\n bestDistance = distance\n }\n }\n return best\n}\n\n/**\n * The order a keyboard walks the nodes in: left to right, then top to bottom - the direction a\n * graph that flows from its entry to its end is read in. Nodes in the same column (within\n * `column` pixels) count as level.\n */\nexport const readingOrder = <T extends Point & { id: string }>(nodes: T[], column = 40): string[] =>\n nodes\n .map((node, index) => ({ node, index }))\n .sort((a, b) => {\n const ax = Math.round(a.node.x / column)\n const bx = Math.round(b.node.x / column)\n return ax - bx || a.node.y - b.node.y || a.index - b.index\n })\n .map(({ node }) => node.id)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACwBO,IAAM,sBAAoC;AAAA,EAC/C,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM,CAAC,MAAM,IAAI,gBACf,mBAAmB,IAAI,OAAO,EAAE,GAAG,cAAc,KAAK,WAAW,KAAK,EAAE;AAAA,EAC1E,MAAM,CAAC,MAAM,SAAS,WAAW,IAAI,GAAG,OAAO,KAAK,IAAI,MAAM,EAAE;AAAA,EAChE,YAAY,CAAC,UAAU,gBAAgB,KAAK;AAAA,EAC5C,cAAc,CAAC,UAAU,kBAAkB,KAAK;AAAA,EAChD,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,KAAK;AAAA,EACL,WAAW,CAAC,YAAY,GAAG,OAAO;AAAA,EAClC,aAAa,CAAC,SAAS,4BAA4B,IAAI;AAAA,EACvD,QAAQ;AAAA,EACR,WAAW,CAAC,MAAM,OAAO,aAAa,IAAI,OAAO,EAAE;AACrD;;;ACPO,IAAM,mBAAmB;AACzB,IAAM,mBAAmB;AACzB,IAAM,oBAA8B,EAAE,GAAG,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C9D;AAGO,IAAM,kBAAkB,CAAC,OAAc,OAAc,UAAU,OAAe;AACnF,MAAI,OAAO;AACX,MAAI,WAAW,MAAM;AACrB,WAAS,IAAI,GAAG,KAAK,SAAS,KAAK;AACjC,UAAM,OAAO,WAAW,OAAO,IAAI,OAAO;AAC1C,WAAO,KAAK,IAAI,MAAM,kBAAkB,OAAO,UAAU,IAAI,CAAC;AAC9D,eAAW;AAAA,EACb;AACA,SAAO;AACT;AAGO,IAAM,UAAU,CACrB,OACA,OACA,YAAY,MACW;AACvB,MAAI;AACJ,MAAI,eAAe;AACnB,aAAW,QAAQ,OAAO;AACxB,UAAM,WAAW,gBAAgB,KAAK,OAAO,KAAK;AAClD,QAAI,YAAY,aAAa,WAAW,cAAc;AACpD,aAAO,KAAK;AACZ,qBAAe;AAAA,IACjB;AAAA,EACF;AACA,SAAO;AACT;AAOO,IAAM,eAAe,CAAmC,OAAY,SAAS,OAClF,MACG,IAAI,CAAC,MAAM,WAAW,EAAE,MAAM,MAAM,EAAE,EACtC,KAAK,CAAC,GAAG,MAAM;AACd,QAAM,KAAK,KAAK,MAAM,EAAE,KAAK,IAAI,MAAM;AACvC,QAAM,KAAK,KAAK,MAAM,EAAE,KAAK,IAAI,MAAM;AACvC,SAAO,KAAK,MAAM,EAAE,KAAK,IAAI,EAAE,KAAK,KAAK,EAAE,QAAQ,EAAE;AACvD,CAAC,EACA,IAAI,CAAC,EAAE,KAAK,MAAM,KAAK,EAAE;","names":["reach"]}
|
package/dist/canvas.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/canvas/geometry.ts"],"sourcesContent":["// The canvas's maths: viewport transforms, fitting, hit testing and the shape of an edge.\n// Pure functions over plain numbers - no DOM, no React - so they are unit-tested as they are.\n\nexport interface Point {\n x: number\n y: number\n}\n\nexport interface Size {\n width: number\n height: number\n}\n\nexport interface Rect extends Point, Size {}\n\n/**\n * Where the world sits on the screen: a world point `p` is drawn at\n * `p * zoom + (x, y)`, in pixels from the canvas's top-left corner.\n */\nexport interface Viewport {\n x: number\n y: number\n zoom: number\n}\n\n/** The four control points of a cubic Bezier curve. */\nexport interface Curve {\n p0: Point\n p1: Point\n p2: Point\n p3: Point\n}\n\nexport const DEFAULT_MIN_ZOOM = 0.25\nexport const DEFAULT_MAX_ZOOM = 2\nexport const IDENTITY_VIEWPORT: Viewport = { x: 0, y: 0, zoom: 1 }\n\nexport const clamp = (value: number, min: number, max: number): number =>\n Math.min(max, Math.max(min, value))\n\nexport const screenToWorld = (point: Point, viewport: Viewport): Point => ({\n x: (point.x - viewport.x) / viewport.zoom,\n y: (point.y - viewport.y) / viewport.zoom,\n})\n\nexport const worldToScreen = (point: Point, viewport: Viewport): Point => ({\n x: point.x * viewport.zoom + viewport.x,\n y: point.y * viewport.zoom + viewport.y,\n})\n\nexport const panBy = (viewport: Viewport, dx: number, dy: number): Viewport => ({\n ...viewport,\n x: viewport.x + dx,\n y: viewport.y + dy,\n})\n\n/** Set the zoom, keeping the world point under `anchor` (a screen point) where it is. */\nexport const zoomAt = (\n viewport: Viewport,\n zoom: number,\n anchor: Point,\n minZoom = DEFAULT_MIN_ZOOM,\n maxZoom = DEFAULT_MAX_ZOOM,\n): Viewport => {\n const next = clamp(zoom, minZoom, maxZoom)\n if (next === viewport.zoom) return viewport\n const world = screenToWorld(anchor, viewport)\n return { zoom: next, x: anchor.x - world.x * next, y: anchor.y - world.y * next }\n}\n\n/**\n * Two fingers moved from `before` to `after` (screen points): zoom by how far apart they went,\n * and keep the world point that was between them under the point that is between them now.\n */\nexport const pinchViewport = (\n viewport: Viewport,\n before: [Point, Point],\n after: [Point, Point],\n minZoom = DEFAULT_MIN_ZOOM,\n maxZoom = DEFAULT_MAX_ZOOM,\n): Viewport => {\n const distance = (a: Point, b: Point) => Math.hypot(a.x - b.x, a.y - b.y)\n const middle = (a: Point, b: Point): Point => ({ x: (a.x + b.x) / 2, y: (a.y + b.y) / 2 })\n const was = distance(before[0], before[1])\n const is = distance(after[0], after[1])\n const zoom = clamp(was > 0 ? (viewport.zoom * is) / was : viewport.zoom, minZoom, maxZoom)\n const world = screenToWorld(middle(before[0], before[1]), viewport)\n const at = middle(after[0], after[1])\n return { zoom, x: at.x - world.x * zoom, y: at.y - world.y * zoom }\n}\n\n/** The smallest rectangle around all of `rects`; undefined when there are none. */\nexport const boundsOf = (rects: Rect[]): Rect | undefined => {\n if (rects.length === 0) return undefined\n let left = Infinity\n let top = Infinity\n let right = -Infinity\n let bottom = -Infinity\n for (const r of rects) {\n left = Math.min(left, r.x)\n top = Math.min(top, r.y)\n right = Math.max(right, r.x + r.width)\n bottom = Math.max(bottom, r.y + r.height)\n }\n return { x: left, y: top, width: right - left, height: bottom - top }\n}\n\nexport interface FitOptions {\n /** Free space kept around the content, in screen pixels (default 48). */\n padding?: number\n minZoom?: number\n /** Fitting never zooms in past this (default 1: a small graph is not blown up). */\n maxZoom?: number\n}\n\n// One axis of a fit: centred when the content fits, from its start (the padding kept) when it\n// does not - a graph too large for the canvas at the smallest zoom shows where it begins.\nconst fitAxis = (start: number, length: number, room: number, zoom: number, padding: number) =>\n length * zoom <= room - padding * 2 + 0.5\n ? (room - length * zoom) / 2 - start * zoom\n : padding - start * zoom\n\n/**\n * The viewport that shows all of `rects` centred in a canvas of `size`. When they do not fit at\n * `minZoom`, it shows them from their top-left corner at that zoom instead.\n */\nexport const fitViewport = (rects: Rect[], size: Size, options: FitOptions = {}): Viewport => {\n const bounds = boundsOf(rects)\n if (!bounds || size.width <= 0 || size.height <= 0) return IDENTITY_VIEWPORT\n const { minZoom = DEFAULT_MIN_ZOOM, maxZoom = 1 } = options\n // A narrow canvas cannot afford the padding a wide one has.\n const padding = Math.min(options.padding ?? 48, size.width / 8, size.height / 8)\n const zoom = clamp(\n Math.min(\n (size.width - padding * 2) / Math.max(bounds.width, 1),\n (size.height - padding * 2) / Math.max(bounds.height, 1),\n ),\n minZoom,\n maxZoom,\n )\n return {\n zoom,\n x: fitAxis(bounds.x, bounds.width, size.width, zoom, padding),\n y: fitAxis(bounds.y, bounds.height, size.height, zoom, padding),\n }\n}\n\n/** The viewport with `rect` in the middle of a canvas of `size`, at the zoom given. */\nexport const centerOn = (rect: Rect, size: Size, zoom: number): Viewport => ({\n zoom,\n x: size.width / 2 - (rect.x + rect.width / 2) * zoom,\n y: size.height / 2 - (rect.y + rect.height / 2) * zoom,\n})\n\n/** Is any part of `rect` (world) inside a canvas of `size` under `viewport`? */\nexport const isRectVisible = (rect: Rect, size: Size, viewport: Viewport): boolean => {\n const a = worldToScreen(rect, viewport)\n const b = worldToScreen({ x: rect.x + rect.width, y: rect.y + rect.height }, viewport)\n return b.x > 0 && b.y > 0 && a.x < size.width && a.y < size.height\n}\n\nexport const snapTo = (value: number, grid: number): number =>\n // `+ 0`: a rounded-away negative is 0, not -0.\n grid > 0 ? Math.round(value / grid) * grid + 0 : value\n\nexport const snapPoint = (point: Point, grid: number): Point => ({\n x: snapTo(point.x, grid),\n y: snapTo(point.y, grid),\n})\n\nexport const rectContains = (rect: Rect, point: Point): boolean =>\n point.x >= rect.x &&\n point.x <= rect.x + rect.width &&\n point.y >= rect.y &&\n point.y <= rect.y + rect.height\n\n/** The id of the node under `point` (world). Later nodes are drawn on top, so they win. */\nexport const hitNode = <T extends Rect & { id: string }>(\n nodes: T[],\n point: Point,\n): string | undefined => {\n for (let i = nodes.length - 1; i >= 0; i--) {\n if (rectContains(nodes[i], point)) return nodes[i].id\n }\n return undefined\n}\n\n/** Where an edge enters a node: the middle of its left side. */\nexport const inputAnchor = (rect: Rect): Point => ({ x: rect.x, y: rect.y + rect.height / 2 })\n\n/** Where an edge leaves a node that has `count` output ports: spread down its right side. */\nexport const outputAnchor = (rect: Rect, index = 0, count = 1): Point => ({\n x: rect.x + rect.width,\n y: rect.y + (rect.height * (index + 1)) / (Math.max(count, 1) + 1),\n})\n\nexport interface EdgeCurveOptions {\n /**\n * How far an edge that runs backwards (its target is to the left of its source) swings below\n * the two nodes so that it does not cross them (default 90).\n */\n clearance?: number\n}\n\n/**\n * The curve of an edge that leaves `from` to the right and enters `to` from the left. A forward\n * edge is a plain S; a backward one (a loop) swings out and around.\n */\nexport const edgeCurve = (from: Point, to: Point, options: EdgeCurveOptions = {}): Curve => {\n const dx = to.x - from.x\n const dy = to.y - from.y\n if (dx >= 40) {\n const reach = Math.max(dx / 2, 40)\n return {\n p0: from,\n p1: { x: from.x + reach, y: from.y },\n p2: { x: to.x - reach, y: to.y },\n p3: to,\n }\n }\n const reach = clamp(60 + Math.abs(dx) / 4, 60, 220)\n const clearance = options.clearance ?? 90\n // Nearly level: go around below. Otherwise the height difference already keeps it clear.\n const swing = Math.abs(dy) < clearance ? clearance + Math.abs(dy) / 2 : 0\n return {\n p0: from,\n p1: { x: from.x + reach, y: from.y + swing },\n p2: { x: to.x - reach, y: to.y + swing },\n p3: to,\n }\n}\n\nconst round = (n: number): number => Math.round(n * 100) / 100\n\n/** The SVG path data of a curve. */\nexport const curvePath = ({ p0, p1, p2, p3 }: Curve): string =>\n `M ${round(p0.x)} ${round(p0.y)} C ${round(p1.x)} ${round(p1.y)}, ${round(p2.x)} ${round(p2.y)}, ${round(p3.x)} ${round(p3.y)}`\n\n/** The point of a curve at `t` in 0..1. */\nexport const curvePoint = ({ p0, p1, p2, p3 }: Curve, t: number): Point => {\n const u = 1 - t\n const a = u * u * u\n const b = 3 * u * u * t\n const c = 3 * u * t * t\n const d = t * t * t\n return {\n x: a * p0.x + b * p1.x + c * p2.x + d * p3.x,\n y: a * p0.y + b * p1.y + c * p2.y + d * p3.y,\n }\n}\n\nconst distanceToSegment = (p: Point, a: Point, b: Point): number => {\n const dx = b.x - a.x\n const dy = b.y - a.y\n const length = dx * dx + dy * dy\n const t = length === 0 ? 0 : clamp(((p.x - a.x) * dx + (p.y - a.y) * dy) / length, 0, 1)\n return Math.hypot(p.x - (a.x + t * dx), p.y - (a.y + t * dy))\n}\n\n/** How far `point` is from a curve (the curve is walked in `samples` straight pieces). */\nexport const distanceToCurve = (curve: Curve, point: Point, samples = 24): number => {\n let best = Infinity\n let previous = curve.p0\n for (let i = 1; i <= samples; i++) {\n const next = curvePoint(curve, i / samples)\n best = Math.min(best, distanceToSegment(point, previous, next))\n previous = next\n }\n return best\n}\n\n/** The id of the edge within `tolerance` of `point`, the nearest one when several are. */\nexport const hitEdge = (\n edges: { id: string; curve: Curve }[],\n point: Point,\n tolerance = 8,\n): string | undefined => {\n let best: string | undefined\n let bestDistance = Infinity\n for (const edge of edges) {\n const distance = distanceToCurve(edge.curve, point)\n if (distance <= tolerance && distance < bestDistance) {\n best = edge.id\n bestDistance = distance\n }\n }\n return best\n}\n\n/**\n * The order a keyboard walks the nodes in: left to right, then top to bottom - the direction a\n * graph that flows from its entry to its end is read in. Nodes in the same column (within\n * `column` pixels) count as level.\n */\nexport const readingOrder = <T extends Point & { id: string }>(nodes: T[], column = 40): string[] =>\n nodes\n .map((node, index) => ({ node, index }))\n .sort((a, b) => {\n const ax = Math.round(a.node.x / column)\n const bx = Math.round(b.node.x / column)\n return ax - bx || a.node.y - b.node.y || a.index - b.index\n })\n .map(({ node }) => node.id)\n"],"mappings":";;;;;AAiCO,IAAM,mBAAmB;AACzB,IAAM,mBAAmB;AACzB,IAAM,oBAA8B,EAAE,GAAG,GAAG,GAAG,GAAG,MAAM,EAAE;AAE1D,IAAM,QAAQ,CAAC,OAAe,KAAa,QAChD,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC;AAE7B,IAAM,gBAAgB,CAAC,OAAc,cAA+B;AAAA,EACzE,IAAI,MAAM,IAAI,SAAS,KAAK,SAAS;AAAA,EACrC,IAAI,MAAM,IAAI,SAAS,KAAK,SAAS;AACvC;AAEO,IAAM,gBAAgB,CAAC,OAAc,cAA+B;AAAA,EACzE,GAAG,MAAM,IAAI,SAAS,OAAO,SAAS;AAAA,EACtC,GAAG,MAAM,IAAI,SAAS,OAAO,SAAS;AACxC;AAEO,IAAM,QAAQ,CAAC,UAAoB,IAAY,QAA0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,WAAW,cAAc;AACpD,aAAO,KAAK;AACZ,qBAAe;AAAA,IACjB;AAAA,EACF;AACA,SAAO;AACT;AAOO,IAAM,eAAe,CAAmC,OAAY,SAAS,OAClF,MACG,IAAI,CAAC,MAAM,WAAW,EAAE,MAAM,MAAM,EAAE,EACtC,KAAK,CAAC,GAAG,MAAM;AACd,QAAM,KAAK,KAAK,MAAM,EAAE,KAAK,IAAI,MAAM;AACvC,QAAM,KAAK,KAAK,MAAM,EAAE,KAAK,IAAI,MAAM;AACvC,SAAO,KAAK,MAAM,EAAE,KAAK,IAAI,EAAE,KAAK,KAAK,EAAE,QAAQ,EAAE;AACvD,CAAC,EACA,IAAI,CAAC,EAAE,KAAK,MAAM,KAAK,EAAE;","names":["reach"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/named-files.ts"],"sourcesContent":["/**\n * The workspace files an answer NAMES in its text (`<MessageList showNamedFiles>`): pure, no\n * React, no DOM, no import. What it reads as a path, exactly:\n *\n * - an inline code span whose whole content is an absolute path - `` `/attachments/a.png` ``\n * (one or more backticks, CommonMark's rule: closed by a run of the same length; the one space\n * inside each end is dropped);\n * - the destination of a Markdown link or image - `[a](/media/a.jpg)`, ``,\n * `[a](</notes/my notes.md>)` - percent-decoded.\n *\n * Nothing else: a path in plain words (`see /notes.md`), in a fenced code block (``` or ~~~ - a\n * listing, a command, an example: not something the answer hands over), in an indented block or\n * in a URL (`https://…`, `//host/…`) is not read. A path is absolute, one line, at most 512\n * characters, with no empty, `.` or `..` segment, no backslash or control character and no\n * trailing slash (a folder) - it is never normalised into another path: what is looked up is what\n * the answer wrote. Then {@link namedFilesOf} keeps only the paths that EXIST in the workspace's\n * listing - the one check that matters: a path that is not a file of the workspace is nothing.\n *\n * The scan is linear in the text, whatever the text holds (it runs while a message is drawn,\n * and the text is the model's - which a fetched page can steer): code spans by one pass over the\n * runs of backticks, links by a pattern that cannot backtrack across brackets, and no more than\n * {@link NAMED_FILES_TEXT_MAX} characters of it.\n */\n\n/** The most files an answer is shown with (see {@link namedFilesOf}). */\nexport const NAMED_FILES_MAX = 12\n\n/** The most distinct paths kept from one text (a bound on what is looked up, not on the scan). */\nexport const NAMED_FILES_SCAN_MAX = 200\n\n/**\n * The most of a text that is scanned: the first 100,000 characters. That is about 25,000 tokens -\n * more than an answer that hands files over is (above most models' default output limit for one\n * answer); past it, the text is a dump (a file pasted back, a runaway answer), whose paths are a\n * listing, not files handed over. It bounds the scan's (linear) work to a few milliseconds.\n */\nexport const NAMED_FILES_TEXT_MAX = 100_000\n\nconst PATH_MAX = 512\n\n/** `raw` as a workspace path, or `undefined` when it is not one (see the module's rules). */\nexport const workspacePathOf = (raw: string): string | undefined => {\n if (raw.length < 2 || raw.length > PATH_MAX) return undefined\n if (raw[0] !== '/' || raw[1] === '/') return undefined\n // Control characters (a line break among them), DEL, a backslash.\n // eslint-disable-next-line no-control-regex\n if (/[\\u0000-\\u001f\\u007f\\\\]/.test(raw)) return undefined\n const segments = raw.slice(1).split('/')\n for (const s of segments) {\n if (!s || s === '.' || s === '..' || s.trim() !== s) return undefined\n }\n return raw\n}\n\n/** The text with its fenced code blocks blanked out (the same length, line breaks kept). */\nconst withoutFences = (text: string): string => {\n const lines = text.split('\\n')\n let fence: { char: string; size: number } | undefined\n for (let i = 0; i < lines.length; i++) {\n const open = /^ {0,3}(`{3,}|~{3,})/.exec(lines[i])\n if (!fence) {\n if (open && !(open[1][0] === '`' && lines[i].slice(open[0].length).includes('`'))) {\n fence = { char: open[1][0], size: open[1].length }\n lines[i] = ' '.repeat(lines[i].length)\n }\n continue\n }\n const close = /^ {0,3}(`{3,}|~{3,})\\s*$/.exec(lines[i])\n if (close && close[1][0] === fence.char && close[1].length >= fence.size) fence = undefined\n lines[i] = ' '.repeat(lines[i].length)\n }\n return lines.join('\\n')\n}\n\nconst decoded = (s: string): string => {\n if (!s.includes('%')) return s\n try {\n return decodeURIComponent(s)\n } catch {\n return s\n }\n}\n\n/**\n * The code spans of a text, as CommonMark reads them: a run of backticks opens a span that the\n * next run of the SAME length closes (a run with no such run after it is just backticks). One\n * pass over the runs, and the closer of each found from a map of the next run of each length -\n * linear, where a regex with a back-reference tried every closer for every opener (a run of 300\n * backticks before 20,000 characters took seconds).\n */\nconst codeSpansOf = (text: string): { at: number; end: number; inner: string }[] => {\n const runs: { at: number; size: number }[] = []\n for (let i = text.indexOf('`'); i >= 0; i = text.indexOf('`', i)) {\n let j = i + 1\n while (j < text.length && text.charCodeAt(j) === 96) j++\n runs.push({ at: i, size: j - i })\n i = j\n }\n const next = new Array<number>(runs.length)\n const later = new Map<number, number>()\n for (let k = runs.length - 1; k >= 0; k--) {\n next[k] = later.get(runs[k].size) ?? -1\n later.set(runs[k].size, k)\n }\n const spans: { at: number; end: number; inner: string }[] = []\n for (let k = 0; k < runs.length;) {\n const close = next[k]\n if (close < 0) {\n k++\n continue\n }\n const open = runs[k]\n const end = runs[close].at + runs[close].size\n spans.push({ at: open.at, end, inner: text.slice(open.at + open.size, runs[close].at) })\n // The runs between the two are the span's content.\n k = close + 1\n }\n return spans\n}\n\n/**\n * A link or image: `[text](dest \"title\")`, the destination bare or in `<…>`. The text holds no\n * bracket at all - so a line of `[` is read once, not once from every `[` to the line's end.\n */\nconst LINK =\n /!?\\[[^[\\]\\n]*\\]\\(\\s*(<[^<>\\n]+>|[^\\s()<>]+)(?:\\s+(?:\"[^\"\\n]*\"|'[^'\\n]*'|\\([^()\\n]*\\)))?\\s*\\)/g\n\n/**\n * The workspace paths a text names, in the order they appear, each once, at most\n * {@link NAMED_FILES_SCAN_MAX}. Whether they exist is {@link namedFilesOf}'s question.\n */\nexport const pathsNamedIn = (text: string): string[] => {\n if (!text) return []\n const head = text.length > NAMED_FILES_TEXT_MAX ? text.slice(0, NAMED_FILES_TEXT_MAX) : text\n if (!head.includes('/')) return []\n const found: { at: number; path: string }[] = []\n let masked = withoutFences(head)\n // Code spans first, then blanked: a link written inside one is code, not a link.\n const spans = codeSpansOf(masked)\n const parts: string[] = []\n let from = 0\n for (const span of spans) {\n let inner = span.inner\n if (inner.length > 2 && inner.startsWith(' ') && inner.endsWith(' ')) inner = inner.slice(1, -1)\n const path = workspacePathOf(inner)\n if (path) found.push({ at: span.at, path })\n parts.push(masked.slice(from, span.at), ' '.repeat(span.end - span.at))\n from = span.end\n }\n masked = parts.join('') + masked.slice(from)\n for (const m of masked.matchAll(LINK)) {\n const dest = m[1].startsWith('<') ? m[1].slice(1, -1) : m[1]\n const path = workspacePathOf(decoded(dest))\n if (path) found.push({ at: m.index, path })\n }\n found.sort((a, b) => a.at - b.at)\n const out: string[] = []\n const seen = new Set<string>()\n for (const { path } of found) {\n if (seen.has(path)) continue\n seen.add(path)\n out.push(path)\n if (out.length >= NAMED_FILES_SCAN_MAX) break\n }\n return out\n}\n\nexport interface NamedFilesOptions {\n /** Paths left out - the files the answer wrote, the media it made: they have chips already. */\n exclude?: Iterable<string>\n /** At most this many (default {@link NAMED_FILES_MAX}). */\n max?: number\n}\n\n/**\n * The paths of `named` (from {@link pathsNamedIn}) that are files of the workspace - `exists`\n * answers from its listing, never by reading or fetching anything -, without `exclude`, in order,\n * at most `max` (default 12: each chip of a picture reads its bytes for the thumbnail, and an\n * answer that lists a folder of two hundred files would otherwise read them all - the chips are\n * for the files the answer hands over, not a second file browser; the Files panel has them all).\n */\nexport const namedFilesOf = (\n named: readonly string[],\n exists: (path: string) => boolean,\n { exclude, max = NAMED_FILES_MAX }: NamedFilesOptions = {},\n): string[] => {\n const skip = new Set(exclude ?? [])\n const out: string[] = []\n for (const path of named) {\n if (out.length >= max) break\n if (skip.has(path) || !exists(path)) continue\n skip.add(path)\n out.push(path)\n }\n return out\n}\n"],"mappings":";AAyBO,IAAM,kBAAkB;AAGxB,IAAM,uBAAuB;AAQ7B,IAAM,uBAAuB;AAEpC,IAAM,WAAW;AAGV,IAAM,kBAAkB,CAAC,QAAoC;AAClE,MAAI,IAAI,SAAS,KAAK,IAAI,SAAS,SAAU,QAAO;AACpD,M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CAAC;AAClC,QAAM,MAAgB,CAAC;AACvB,aAAW,QAAQ,OAAO;AACxB,QAAI,IAAI,UAAU,IAAK;AACvB,QAAI,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,IAAI,EAAG;AACrC,SAAK,IAAI,IAAI;AACb,QAAI,KAAK,IAAI;AAAA,EACf;AACA,SAAO;AACT;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/html-preview.ts"],"sourcesContent":["/**\n * The sandboxed frame's security core: what untrusted HTML (a file the agent wrote, later an\n * MCP App) is wrapped in before it reaches an `<iframe>`. Pure strings - no React, no DOM - so\n * every guard is unit-tested here and proved in a real browser by `e2e/files.spec.ts`.\n *\n * The boundary, in three layers:\n * 1. `sandbox` WITHOUT `allow-same-origin`: the document gets an opaque origin - no access to\n * the page's DOM, storage, IndexedDB (the key vault), cookies. No `allow-top-navigation`,\n * `allow-popups`, `allow-forms`, `allow-modals`, `allow-downloads` either.\n * 2. A Content-Security-Policy with no network source at all, given twice: as the first element\n * of the document itself, and by inheritance from the shell (3) - a `srcdoc` document takes\n * its parent's policy, which nothing inside the document can pre-empt.\n * 3. A shell document of ours between the page and the untrusted one. A frame may always\n * navigate ITSELF (`location = …`, a link, `<meta http-equiv=refresh>`): neither the sandbox\n * nor a document's own CSP stops that, and a navigation is a network request. The only thing\n * that does is the `frame-src` of the document that EMBEDS the frame - so we embed it in one\n * we wrote, whose policy says `frame-src 'none'`.\n */\n\nexport interface SandboxedDocumentOptions {\n /** Let the document's own inline scripts run (default false). */\n scripts?: boolean\n}\n\n/**\n * The policy of the framed document: nothing is fetched from anywhere. Inline styles, and\n * images / fonts / media the document carries inside itself (`data:`, `blob:`), are all it gets;\n * inline scripts only when asked for. `frame-src 'none'` is what stops the frame from navigating.\n */\nexport const sandboxedCsp = (scripts = false): string =>\n [\n \"default-src 'none'\",\n scripts ? \"script-src 'unsafe-inline'\" : \"script-src 'none'\",\n \"style-src 'unsafe-inline'\",\n 'img-src data: blob:',\n 'font-src data:',\n 'media-src data: blob:',\n \"connect-src 'none'\",\n \"frame-src 'none'\",\n \"child-src 'none'\",\n \"object-src 'none'\",\n \"form-action 'none'\",\n \"base-uri 'none'\",\n \"webrtc 'block'\",\n ].join('; ')\n\n/**\n * The `sandbox` attribute: empty (everything off) or `allow-scripts`. Never\n * `allow-same-origin`, never a navigation, popup, form, modal or download token.\n */\nexport const sandboxTokens = (scripts = false): string => (scripts ? 'allow-scripts' : '')\n\n/** A string as the value of a double-quoted HTML attribute. */\nexport const escapeAttribute = (value: string): string =>\n value.replace(/&/g, '&').replace(/\"/g, '"').replace(/</g, '<').replace(/>/g, '>')\n\n/** A `<meta>` that carries a Content-Security-Policy. */\nexport const cspMetaTag = (policy: string): string =>\n `<meta http-equiv=\"Content-Security-Policy\" content=\"${escapeAttribute(policy)}\">`\n\nconst cspMeta = (scripts: boolean): string => cspMetaTag(sandboxedCsp(scripts))\n\n// A DOCTYPE token ends at the first \">\" whatever is inside it (the tokenizer's rule), so this is\n// exactly where the parser leaves it.\nconst DOCTYPE = /^[\\t\\n\\f\\r ]*<!doctype[^>]*>/i\n\n/**\n * The document with our policy as its FIRST element: right after a leading DOCTYPE (so the\n * page stays in standards mode), otherwise before everything. Nothing the document says can\n * come earlier - not its own `<meta>`, not a `<base>`, not a script before `<html>` - and a\n * later policy of its own can only narrow ours.\n */\nexport const withCspFirst = (html: string, scripts = false): string =>\n withPolicyFirst(html, sandboxedCsp(scripts))\n\n/** `withCspFirst` with a policy of the caller's (an MCP App's, built by `mcpAppCsp`). */\nexport const withPolicyFirst = (html: string, policy: string): string => {\n const doctype = DOCTYPE.exec(html)?.[0] ?? ''\n return `${doctype}${cspMetaTag(policy)}${html.slice(doctype.length)}`\n}\n\n/**\n * What goes into the outer frame's `srcdoc`: the shell (ours: the policy, and one inner frame\n * that fills it) carrying the untrusted document, escaped, as the inner frame's `srcdoc`.\n * Give the OUTER `<iframe>` the same `sandboxTokens(scripts)`.\n */\nexport const buildSandboxedDocument = (\n html: string,\n { scripts = false }: SandboxedDocumentOptions = {},\n): string =>\n '<!doctype html><html><head>' +\n cspMeta(scripts) +\n '<style>html,body{margin:0;height:100%;overflow:hidden;background:transparent}' +\n 'iframe{display:block;border:0;width:100%;height:100%}</style></head><body>' +\n `<iframe sandbox=\"${sandboxTokens(scripts)}\" referrerpolicy=\"no-referrer\" ` +\n `srcdoc=\"${escapeAttribute(withCspFirst(html, scripts))}\"></iframe></body></html>`\n\n/** HTML above this many characters is not framed at all - it is shown as source. */\nexport const HTML_PREVIEW_MAX_CHARS = 1_000_000\n\nconst ASSET_ATTR = /\\b(?:src|href)\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|([^\\s\"'>]+))/gi\n\n/**\n * The files a document links to by a relative path (`style.css`, `./app.js`, `img/a.png`): the\n * preview does not load them, and says so. A hint for the user, not a guard - the policy is\n * what keeps them from loading.\n */\nexport const linkedFilesOf = (html: string, max = 4): string[] => {\n const found: string[] = []\n for (const m of html.matchAll(ASSET_ATTR)) {\n const ref = (m[1] ?? m[2] ?? m[3] ?? '').trim()\n if (!ref || /^(?:[a-z][a-z0-9+.-]*:|\\/\\/|#)/i.test(ref)) continue\n if (!found.includes(ref)) found.push(ref)\n if (found.length >= max) break\n }\n return found\n}\n\n/** A piece of HTML source, by what it is (for colouring the Source view). */\nexport interface SourceToken {\n kind: 'text' | 'tag' | 'attr' | 'string' | 'comment'\n text: string\n}\n\nconst RAW_TEXT = /^<(script|style|textarea|title)\\b/i\n\n/**\n * Split HTML source into coloured pieces. Lossless: the pieces joined are the input. It only\n * decides colours - the result is rendered as text nodes, never as markup.\n */\nexport const tokenizeHtml = (source: string): SourceToken[] => {\n const out: SourceToken[] = []\n const push = (kind: SourceToken['kind'], text: string) => {\n if (!text) return\n const last = out[out.length - 1]\n if (last && last.kind === kind) last.text += text\n else out.push({ kind, text })\n }\n let i = 0\n const n = source.length\n while (i < n) {\n const lt = source.indexOf('<', i)\n if (lt < 0) {\n push('text', source.slice(i))\n break\n }\n push('text', source.slice(i, lt))\n i = lt\n if (source.startsWith('<!--', i)) {\n const end = source.indexOf('-->', i + 4)\n const stop = end < 0 ? n : end + 3\n push('comment', source.slice(i, stop))\n i = stop\n continue\n }\n const open = /^<[!/?]?[a-zA-Z][^\\s/>]*/.exec(source.slice(i, i + 80))\n if (!open) {\n push('text', '<')\n i += 1\n continue\n }\n push('tag', open[0])\n const raw = RAW_TEXT.exec(open[0])?.[1].toLowerCase()\n i += open[0].length\n // Inside the tag, up to its \">\".\n while (i < n && source[i] !== '>') {\n const c = source[i]\n if (c === '\"' || c === \"'\") {\n const end = source.indexOf(c, i + 1)\n const stop = end < 0 ? n : end + 1\n push('string', source.slice(i, stop))\n i = stop\n } else if (/[^\\s=/>\"']/.test(c)) {\n const name = /^[^\\s=/>\"']+/.exec(source.slice(i, i + 200))?.[0] ?? c\n // After \"=\" it is an unquoted value; otherwise a name.\n const before = out[out.length - 1]\n push(before?.kind === 'text' && before.text.endsWith('=') ? 'string' : 'attr', name)\n i += name.length\n } else {\n push(c === '/' ? 'tag' : 'text', c)\n i += 1\n }\n }\n if (i < n) {\n push('tag', '>')\n i += 1\n }\n if (raw) {\n // The content of <script> / <style> is not markup: plain, up to its closing tag.\n const close = source.toLowerCase().indexOf(`</${raw}`, i)\n const stop = close < 0 ? n : close\n push('text', source.slice(i, stop))\n i = stop\n }\n }\n return out\n}\n\n/** The frame's height is the host's: a number of pixels between these, never the content's wish. */\nexport const FRAME_MIN_HEIGHT = 120\nexport const FRAME_MAX_HEIGHT = 800\n\nexport const clampFrameHeight = (height: number): number =>\n Math.min(\n FRAME_MAX_HEIGHT,\n Math.max(FRAME_MIN_HEIGHT, Math.round(Number.isFinite(height) ? height : 300)),\n )\n"],"mappings":";AA6BO,IAAM,eAAe,CAAC,UAAU,UACrC;AAAA,EACE;AAAA,EACA,UAAU,+BAA+B;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA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O,MAAM,IAAI,IAAI,MAAM;AACjC,aAAK,UAAU,OAAO,MAAM,GAAG,IAAI,CAAC;AACpC,YAAI;AAAA,MACN,WAAW,aAAa,KAAK,CAAC,GAAG;AAC/B,cAAM,OAAO,eAAe,KAAK,OAAO,MAAM,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK;AAEnE,cAAM,SAAS,IAAI,IAAI,SAAS,CAAC;AACjC,aAAK,QAAQ,SAAS,UAAU,OAAO,KAAK,SAAS,GAAG,IAAI,WAAW,QAAQ,IAAI;AACnF,aAAK,KAAK;AAAA,MACZ,OAAO;AACL,aAAK,MAAM,MAAM,QAAQ,QAAQ,CAAC;AAClC,aAAK;AAAA,MACP;AAAA,IACF;AACA,QAAI,IAAI,GAAG;AACT,WAAK,OAAO,GAAG;AACf,WAAK;AAAA,IACP;AACA,QAAI,KAAK;AAEP,YAAM,QAAQ,OAAO,YAAY,EAAE,QAAQ,KAAK,GAAG,IAAI,CAAC;AACxD,YAAM,OAAO,QAAQ,IAAI,IAAI;AAC7B,WAAK,QAAQ,OAAO,MAAM,GAAG,IAAI,CAAC;AAClC,UAAI;AAAA,IACN;AAAA,EACF;AACA,SAAO;AACT;AAGO,IAAM,mBAAmB;AACzB,IAAM,mBAAmB;AAEzB,IAAM,mBAAmB,CAAC,WAC/B,KAAK;AAAA,EACH;AAAA,EACA,KAAK,IAAI,kBAAkB,KAAK,MAAM,OAAO,SAAS,MAAM,IAAI,SAAS,GAAG,CAAC;AAC/E;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/mcp-app-policy.ts"],"sourcesContent":["/**\n * MCP Apps: what the host (the page, `mcp-app.ts`) and the sandbox proxy (a page on ANOTHER\n * origin, `mcp-app-sandbox.ts`) must agree on - the app's Content-Security-Policy, the policy as a\n * path segment of the proxy's URL, and the names of the sandbox messages. Pure code with NO\n * imports at all: the proxy's server bundles it without React or the core (a Worker), so the\n * origin rule below is a copy of the core's `mcpAppOrigin`, and `tests/apps-sandbox.test.ts`\n * holds the two to the same answers.\n */\n\n/** The proxy tells the host it can take the app (Sandbox → Host; content-free). */\nexport const MCP_APP_SANDBOX_PROXY_READY = 'ui/notifications/sandbox-proxy-ready'\n/** The host hands the proxy the app's HTML (Host → Sandbox), once. */\nexport const MCP_APP_SANDBOX_RESOURCE_READY = 'ui/notifications/sandbox-resource-ready'\n\n/** The specification reserves these between a host and its proxy: never relayed to or from an app. */\nexport const isMcpAppSandboxMessage = (data: unknown): boolean =>\n typeof data === 'object' &&\n data !== null &&\n typeof (data as { method?: unknown }).method === 'string' &&\n (data as { method: string }).method.startsWith('ui/notifications/sandbox-')\n\n/**\n * The colour scheme of an app's frame: the theme the app is told when its frame is drawn. Every\n * document between the page and the app declares it (the frame element, the shell, the sandbox\n * page and its frame), because a browser paints an OPAQUE canvas - the canvas colour of the\n * embedded document's own scheme - behind a document whose scheme differs from its frame\n * element's: an app that is dark with a transparent body was drawn on white.\n */\nexport type McpAppColorScheme = 'light' | 'dark'\n\n/** The query parameter of the sandbox page that carries the scheme (`?scheme=dark`). */\nexport const MCP_APP_SCHEME_PARAM = 'scheme'\n\n/** `light` or `dark` exactly; anything else is no scheme (nothing is declared). */\nexport const mcpAppColorScheme = (value: unknown): McpAppColorScheme | undefined =>\n value === 'light' || value === 'dark' ? value : undefined\n\n/** The origins an app's policy grants, each already an origin (`mcpAppPolicyOrigin`). */\nexport interface McpAppPolicyOrigins {\n /** `fetch` / XHR / WebSocket (`connect-src`). */\n connect: string[]\n /** Scripts, styles, images, fonts, media. */\n resources: string[]\n}\n\n/**\n * The policy of an app's document: scripts and styles inline, `data:` / `blob:` media, and the\n * network ONLY where the resource declared it. Nested frames, workers, plugins, forms and `<base>`\n * are refused whatever was declared (a frame the app may embed would also be a place it may\n * navigate itself to). The lists must already be checked origins: nothing here re-checks them.\n *\n * `'wasm-unsafe-eval'` lets the app compile WebAssembly (a tracer, a codec, a parser), which the\n * specification's default policy leaves out and a server cannot ask for (it declares origins, not\n * keywords). It adds no reach: a module only calls what the app's own script hands it, and the\n * network stays `connect-src`. `eval`, `new Function` and string timers stay refused - that is\n * `'unsafe-eval'`, which is never granted.\n */\nexport const mcpAppPolicy = ({ connect, resources }: McpAppPolicyOrigins): string => {\n const from = resources.length > 0 ? ` ${resources.join(' ')}` : ''\n return [\n \"default-src 'none'\",\n `script-src 'unsafe-inline' 'wasm-unsafe-eval'${from}`,\n `style-src 'unsafe-inline'${from}`,\n `img-src data: blob:${from}`,\n `font-src data:${from}`,\n `media-src data: blob:${from}`,\n connect.length > 0 ? `connect-src ${connect.join(' ')}` : \"connect-src 'none'\",\n \"frame-src 'none'\",\n \"child-src 'none'\",\n \"worker-src 'none'\",\n \"object-src 'none'\",\n \"form-action 'none'\",\n \"base-uri 'none'\",\n \"webrtc 'block'\",\n ].join('; ')\n}\n\n// ── The origin rule: a COPY of the core's `mcpAppOrigin` (src/mcp/apps.ts) ──────────────────\n\nconst LABEL = '[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?'\nconst HOST = `(?:\\\\*\\\\.)?${LABEL}(?:\\\\.${LABEL})*`\nconst PORT = '(?::\\\\d{1,5})?'\nconst SECURE_ORIGIN = new RegExp(`^(?:https|wss)://${HOST}${PORT}$`)\nconst LOOPBACK_ORIGIN = new RegExp(`^(?:http|ws)://(?:localhost|127\\\\.0\\\\.0\\\\.1|\\\\[::1\\\\])${PORT}$`)\n\n/**\n * One declared CSP entry as a source expression a policy may carry, or `undefined`: only an\n * origin (`https://` / `wss://`, a `*.` wildcard over at least two labels, or `http://` /\n * `ws://` on loopback). The same answers as the core's `mcpAppOrigin`, for the proxy's server.\n */\nexport const mcpAppPolicyOrigin = (entry: unknown): string | undefined => {\n if (typeof entry !== 'string' || entry.length > 300) return undefined\n const value = entry.trim().toLowerCase().replace(/\\/$/, '')\n if (SECURE_ORIGIN.test(value)) {\n const host = value.replace(/^[a-z]+:\\/\\//, '').replace(/:\\d+$/, '')\n if (host.startsWith('*.') && !host.slice(2).includes('.')) return undefined\n return value\n }\n return LOOPBACK_ORIGIN.test(value) ? value : undefined\n}\n\n// ── The policy in the proxy's URL ────────────────────────────────────────────────────────────\n\n/** At most this many origins per list (the core's `MCP_APP_MAX_DOMAINS`). */\nexport const MCP_APP_POLICY_MAX_ORIGINS = 32\n/** A policy token longer than this is not put in a URL: the app runs without its own origin. */\nexport const MCP_APP_POLICY_TOKEN_MAX_CHARS = 4096\n\nconst B64URL = /^[A-Za-z0-9_-]+$/\n\n/**\n * The policy as one path segment (base64url of `{\"c\":[…],\"r\":[…]}`), or `undefined` when it does\n * not fit. It is in the PATH, not the query, because a `frame-src` source expression matches a\n * path exactly and ignores the query: the host pins the proxy's frame to this one URL, so nothing\n * inside the frame can load the proxy page with a policy of its choosing.\n */\nexport const mcpAppPolicyToken = ({\n connect,\n resources,\n}: McpAppPolicyOrigins): string | undefined => {\n const json = JSON.stringify({ c: connect, r: resources })\n // Origins are ASCII; anything else is not a list of checked origins.\n if (/[^\\x20-\\x7e]/.test(json)) return undefined\n const token = btoa(json).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=+$/, '')\n return token.length <= MCP_APP_POLICY_TOKEN_MAX_CHARS ? token : undefined\n}\n\nconst isObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value)\n\nconst originList = (value: unknown): string[] | undefined => {\n if (!Array.isArray(value) || value.length > MCP_APP_POLICY_MAX_ORIGINS) return undefined\n const out: string[] = []\n for (const entry of value) {\n // Exactly an origin as the host writes it: checked, canonical, once.\n if (typeof entry !== 'string' || mcpAppPolicyOrigin(entry) !== entry || out.includes(entry)) {\n return undefined\n }\n out.push(entry)\n }\n return out\n}\n\n/**\n * The policy a token stands for, or `undefined` for anything that is not exactly what\n * `mcpAppPolicyToken` writes: base64url of an object with the two lists and nothing else, every\n * entry an origin by the rule above, no more than `MCP_APP_POLICY_MAX_ORIGINS` each, the\n * canonical encoding (one URL per policy).\n */\nexport const mcpAppPolicyOfToken = (token: unknown): McpAppPolicyOrigins | undefined => {\n if (\n typeof token !== 'string' ||\n token.length === 0 ||\n token.length > MCP_APP_POLICY_TOKEN_MAX_CHARS ||\n !B64URL.test(token)\n ) {\n return undefined\n }\n let parsed: unknown\n try {\n parsed = JSON.parse(atob(token.replace(/-/g, '+').replace(/_/g, '/')))\n } catch {\n return undefined\n }\n if (!isObject(parsed)) return undefined\n const keys = Object.keys(parsed)\n if (keys.length !== 2 || !keys.includes('c') || !keys.includes('r')) return undefined\n const connect = originList(parsed.c)\n const resources = originList(parsed.r)\n if (!connect || !resources) return undefined\n const policy = { connect, resources }\n return mcpAppPolicyToken(policy) === token ? policy : undefined\n}\n"],"mappings":";AAUO,IAAM,8BAA8B;AAEpC,IAAM,iCAAiC;AAGvC,IAAM,yBAAyB,CAAC,SACrC,OAAO,SAAS,YAChB,SAAS,QACT,OAAQ,KAA8B,WAAW,YAChD,KAA4B,OAAO,WAAW,2BAA2B;AAYrE,IAAM,uBAAuB;AAG7B,IAAM,oBAAoB,CAAC,UAChC,UAAU,WAAW,UAAU,SAAS,QAAQ;AAsB3C,IAAM,eAAe,CAAC,EAAE,SAAS,UAAU,MAAmC;AACnF,QAAM,OAAO,UAAU,SAAS,IAAI,IAAI,UAAU,KAAK,GAAG,CAAC,KAAK;AAChE,SAAO;AAAA,IACL;AAAA,IACA,gDAAgD,IAAI;AAAA,IACpD,4BAA4B,IAAI;AAAA,IAChC,sBAAsB,IAAI;AAAA,IAC1B,iBAAiB,IAAI;AAAA,IACrB,wBAAwB,IAAI;AAAA,IAC5B,QAAQ,SAAS,IAAI,eAAe,QAAQ,KAAK,GAAG,CAAC,KAAK;AAAA,IAC1D;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,EAAE,KAAK,IAAI;AACb;AAIA,IAAM,QAAQ;AACd,IAAM,OAAO,cAAc,KAAK,SAAS,KAAK;AAC9C,IAAM,OAAO;AACb,IAAM,g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KAAK,GAAG;AAC3F,aAAO;AAAA,IACT;AACA,QAAI,KAAK,KAAK;AAAA,EAChB;AACA,SAAO;AACT;AAQO,IAAM,sBAAsB,CAAC,UAAoD;AACtF,MACE,OAAO,UAAU,YACjB,MAAM,WAAW,KACjB,MAAM,SAAS,kCACf,CAAC,OAAO,KAAK,KAAK,GAClB;AACA,WAAO;AAAA,EACT;AACA,MAAI;AACJ,MAAI;AACF,aAAS,KAAK,MAAM,KAAK,MAAM,QAAQ,MAAM,GAAG,EAAE,QAAQ,MAAM,GAAG,CAAC,CAAC;AAAA,EACvE,QAAQ;AACN,WAAO;AAAA,EACT;AACA,MAAI,CAAC,SAAS,MAAM,EAAG,QAAO;AAC9B,QAAM,OAAO,OAAO,KAAK,MAAM;AAC/B,MAAI,KAAK,WAAW,KAAK,CAAC,KAAK,SAAS,GAAG,KAAK,CAAC,KAAK,SAAS,GAAG,EAAG,QAAO;AAC5E,QAAM,UAAU,WAAW,OAAO,CAAC;AACnC,QAAM,YAAY,WAAW,OAAO,CAAC;AACrC,MAAI,CAAC,WAAW,CAAC,UAAW,QAAO;AACnC,QAAM,SAAS,EAAE,SAAS,UAAU;AACpC,SAAO,kBAAkB,MAAM,MAAM,QAAQ,SAAS;AACxD;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/canvas/labels.ts"],"sourcesContent":["// The canvas's strings: what it shows and says to a screen reader. Generic - nothing of agents.\n\n/** Every string the canvas shows or says. */\nexport interface CanvasLabels {\n /** The canvas's own name for a screen reader. */\n canvas: string\n /** How to use it with a keyboard; read once, when the canvas is focused. */\n help: string\n /** `aria-roledescription` of a node. */\n node: string\n edge: (from: string, to: string, description?: string) => string\n port: (node: string, port?: string) => string\n connectsTo: (names: string) => string\n receivesFrom: (names: string) => string\n zoomIn: string\n zoomOut: string\n fit: string\n zoomLevel: (percent: number) => string\n /** Shown (and announced) while a connection is being made without dragging. */\n connectHint: (from: string) => string\n cancel: string\n connected: (from: string, to: string) => string\n}\n\nexport const defaultCanvasLabels: CanvasLabels = {\n canvas: 'Canvas',\n help: 'Tab moves between nodes and their connections. Arrow keys move the selected node, Enter opens it, Delete removes it, C starts a connection, Escape clears the selection. On the canvas itself the arrow keys pan, plus and minus zoom, 0 fits everything.',\n node: 'node',\n edge: (from, to, description) =>\n `Connection from ${from} to ${to}${description ? `: ${description}` : ''}`,\n port: (node, port) => `Connect ${node}${port ? ` (${port})` : ''} to another node`,\n connectsTo: (names) => `Connects to: ${names}.`,\n receivesFrom: (names) => `Receives from: ${names}.`,\n zoomIn: 'Zoom in',\n zoomOut: 'Zoom out',\n fit: 'Fit to view',\n zoomLevel: (percent) => `${percent}%`,\n connectHint: (from) => `Pick the node to connect ${from} to`,\n cancel: 'Cancel',\n connected: (from, to) => `Connected ${from} to ${to}`,\n}\n"],"mappings":";AAwBO,IAAM,sBAAoC;AAAA,EAC/C,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM,CAAC,MAAM,IAAI,gBACf,mBAAmB,IAAI,OAAO,EAAE,GAAG,cAAc,KAAK,WAAW,KAAK,EAAE;AAAA,EAC1E,MAAM,CAAC,MAAM,SAAS,WAAW,IAAI,GAAG,OAAO,KAAK,IAAI,MAAM,EAAE;AAAA,EAChE,YAAY,CAAC,UAAU,gBAAgB,KAAK;AAAA,EAC5C,cAAc,CAAC,UAAU,kBAAkB,KAAK;AAAA,EAChD,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,KAAK;AAAA,EACL,WAAW,CAAC,YAAY,GAAG,OAAO;AAAA,EAClC,aAAa,CAAC,SAAS,4BAA4B,IAAI;AAAA,EACvD,QAAQ;AAAA,EACR,WAAW,CAAC,MAAM,OAAO,aAAa,IAAI,OAAO,EAAE;AACrD;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/locales/catalogs/es.ts"],"sourcesContent":["import type { AgentLabelCatalog } from '../types.js'\n\n/** Español (España) (`es`). */\nexport const catalog: AgentLabelCatalog = {\n 'status.idle': 'Inactivo',\n 'status.initializing': 'Preparando…',\n 'status.ready': 'Listo',\n 'status.running': 'Trabajando…',\n 'status.error': 'No se ha podido iniciar',\n history: 'Chats',\n newChat: 'Nuevo chat',\n totalUsage: 'Tokens usados en esta conversación, por tipo',\n showHistory: 'Mostrar chats',\n close: 'Cerrar',\n steps: { one: '{count} paso', many: '{count} de pasos', other: '{count} pasos' },\n toolCalls: {\n one: '{count} llamada a herramientas',\n many: '{count} de llamadas a herramientas',\n other: '{count} llamadas a herramientas',\n },\n answerThoughts: 'Razonamiento sobre la respuesta',\n answerStopped: 'Detenido.',\n stepThoughts: 'Razonamiento',\n usageTitle: 'Tokens usados en esta respuesta, por tipo',\n planned: 'Plan',\n replanned: 'Plan modificado: {reason}',\n placeholder: 'Escribe al asistente… ( / para comandos )',\n placeholderBusy: 'Dile algo al asistente mientras trabaja…',\n message: 'Mensaje',\n commands: 'Comandos',\n commandsTitle: 'Comandos ( / )',\n send: 'Enviar',\n steer: 'Enviar al asistente',\n stop: 'Detener',\n dismiss: 'Cerrar',\n cancel: 'Cancelar',\n elicitTitle: 'Una pregunta de un servidor MCP',\n elicitLead: 'El servidor MCP «{server}» te pide una respuesta',\n elicitDuring: 'durante',\n elicitFrom: 'Del servidor «{server}»',\n elicitRequired: 'obligatorio',\n elicitChoose: 'Elige…',\n elicitSubmit: 'Enviar',\n elicitDecline: 'Rechazar',\n 'elicitErr.required': '{field} es obligatorio.',\n 'elicitErr.tooShort': '{field} debe tener al menos {limit} caracteres.',\n 'elicitErr.tooLong': '{field} debe tener como máximo {limit} caracteres.',\n 'elicitErr.email': '{field} debe ser una dirección de correo.',\n 'elicitErr.uri': '{field} debe ser una dirección completa, como https://example.com.',\n 'elicitErr.date': '{field} debe ser una fecha.',\n 'elicitErr.dateTime': '{field} debe ser una fecha y una hora.',\n 'elicitErr.notNumber': '{field} debe ser un número.',\n 'elicitErr.notInteger': '{field} debe ser un número entero.',\n 'elicitErr.belowMinimum': '{field} debe ser {limit} o más.',\n 'elicitErr.aboveMaximum': '{field} debe ser {limit} o menos.',\n 'elicitErr.notAnOption': '{field} debe ser una de las opciones.',\n 'elicitErr.tooFew': '{field}: elige al menos {limit}.',\n 'elicitErr.tooMany': '{field}: elige como máximo {limit}.',\n elicitFix: 'Campos por corregir: {count}',\n elicitExpiresIn: 'Se cancela automáticamente en {time}',\n elicitExpires: 'Se cancela automáticamente si nadie responde',\n elicitAutomatic:\n 'Una pregunta del servidor MCP «{server}» se respondió automáticamente y la llamada a su herramienta no terminó: {reason}.',\n 'elicitReason.timeout': 'nadie respondió a tiempo',\n 'elicitReason.stopped': 'la ejecución se detuvo',\n 'elicitReason.caps': 'ya se habían hecho demasiadas preguntas',\n 'elicitReason.cannotShow': 'la pregunta no se puede mostrar aquí',\n 'elicitReason.subagent': 'un ayudante no puede preguntarte',\n 'elicitReason.invalidAnswer': 'la respuesta no se ajustaba al formulario y no se envió',\n skillLead: 'El servidor «{server}» ofrece la habilidad «{skill}»',\n skillSize: 'SKILL.md {size}',\n skillSizeFiles: 'SKILL.md {size} · más archivos: {count}',\n skillByUri: 'No está en la lista del servidor: el asistente la pidió por su dirección.',\n skillNested: 'Está dentro de la habilidad «{enclosing}»: permitir aquella no permitió esta.',\n skillPreview: 'Mostrar lo que leería el asistente',\n skillFiles: 'Sus archivos se leen como texto y nunca se ejecutan: {paths}',\n skillFilesMore: 'Sus archivos se leen como texto y nunca se ejecutan: {paths} y {count} más',\n skillNote:\n 'Instrucciones escritas por el servidor «{server}», no por ti. Solo llegan al asistente si lo permites, y se te vuelve a preguntar si el servidor las cambia. No pueden cambiar las reglas ni los permisos del asistente.',\n skillAlways: 'Siempre para este servidor',\n skillDeclined: 'la persona rechazó la habilidad',\n appFrom: 'App del servidor «{server}»',\n appSandboxed: 'aislada',\n appSandboxedOrigin: 'aislada en su propio origen',\n appSandboxOrigin:\n 'Se ejecuta en su propio origen, {origin}: su almacenamiento es suyo, nunca de esta página.',\n appSandboxFallback:\n 'No está en un origen propio ({reason}), así que no puede ejecutarse en esta app.',\n 'appReason.config': 'la dirección del entorno aislado no se puede usar',\n 'appReason.origins': 'declara demasiados orígenes',\n 'appReason.noAnswer': 'la página del entorno aislado no respondió',\n appSandboxBroken: 'La app recargó su marco, así que se detuvo. Recárgala para empezar de nuevo.',\n appWaiting: 'te espera',\n appWaitingFocus: 'Ir a lo que espera la app',\n appPromptsLabel: 'Lo que espera la app del servidor «{server}»',\n appTag: 'app',\n appsCount: 'Apps: {count}',\n appLoading: 'Cargando la app…',\n appFailed: 'No se pudo mostrar la app: {reason}',\n appUnavailable: 'El servidor «{server}» no está conectado, así que su app no se puede mostrar.',\n appHidden: 'oculta',\n appShow: 'Mostrar',\n appMenu: 'Menú de la app',\n appReload: 'Recargar la app',\n appOpenPanel: 'Abrir en el panel',\n appTaller: 'Más alta que el chat: esta app se desplaza dentro de su marco.',\n appHide: 'Ocultar la app',\n appServedBy: 'La sirve {server} como {uri}. No puede leer este chat, tus claves ni tus archivos.',\n appInPanel: 'abierta en el panel',\n appBringBack: 'Traer de vuelta',\n appClosePanel: 'Cerrar el panel',\n appPanelNote:\n 'Contenido del servidor «{server}». No puede leer este chat, tus claves ni tus archivos.',\n appFrameName: 'App del servidor {server}',\n appRan: 'La app ejecutó {names}',\n appRefused: 'rechazado',\n approvalLeadApp: 'La app «{server}» quiere ejecutar',\n approvalFromAppRead:\n 'Lo pide la app, no el asistente. Esta herramienta solo lee datos en el servidor «{server}».',\n approvalFromAppWrite:\n 'Lo pide la app, no el asistente. Esta herramienta cambia datos en el servidor «{server}».',\n appLinkLead: 'La app «{server}» quiere abrir un enlace. ¿Abrirlo?',\n appLinkNote:\n 'Se abre en una pestaña nueva, fuera de este chat. Revisa el nombre del sitio antes de seguir.',\n appLinkOpen: 'Abrir',\n appMessageLead: 'La app «{server}» quiere poner un mensaje en tu cuadro de mensaje',\n appMessageNote:\n 'No se envía nada hasta que lo envíes tú, y puedes cambiarlo antes. Es el texto de la app, no el tuyo.',\n appMessageAccept: 'Poner en el cuadro de mensaje',\n appMessageDiscard: 'Descartar',\n model: 'Modelo',\n toolConsent: 'Permiso para herramientas',\n 'mode.autopilot': 'Auto',\n 'mode.autopilotHint':\n 'No preguntar nunca: se ejecuta cualquier herramienta, del asistente y de una app; una regla puesta a una herramienta sigue valiendo',\n 'mode.askWrites': 'Preguntar',\n 'mode.askWritesHint':\n 'Las herramientas de solo lectura, al momento; preguntar antes de todo lo que ejecute código o cambie datos',\n 'mode.askAll': 'Preguntar siempre',\n 'mode.askAllHint': 'Preguntar antes de cada llamada a una herramienta',\n 'mode.readOnly': 'Solo lectura',\n 'mode.readOnlyHint': 'Solo herramientas que leen; rechazar el resto sin preguntar',\n timerRunning: 'Esta respuesta lleva',\n timerLast: 'La última respuesta tardó',\n compacted: 'La conversación se ha resumido para que quepa · {before} → {after} tokens',\n 'group.commands': 'Comandos',\n 'group.consent': 'Permisos',\n 'cmd.compact': 'Resumir la conversación para liberar espacio',\n 'cmd.new': 'Vaciar esta conversación',\n 'cmd.stop': 'Detener la respuesta actual',\n 'cmd.autopilot': 'Ejecutar cualquier herramienta sin preguntar',\n 'cmd.ask': 'Preguntar antes de herramientas que ejecuten código o cambien datos',\n 'cmd.askAll': 'Preguntar antes de cada llamada a una herramienta',\n 'cmd.readOnly': 'Solo leer; rechazar cambios',\n historyEmpty: 'Aún no hay chats guardados.',\n deleteChat: 'Eliminar el chat',\n messagesCount: { one: '{count} mensaje', many: '{count} de mensajes', other: '{count} mensajes' },\n approvalLead: 'El asistente quiere ejecutar',\n approve: 'Permitir una vez',\n alwaysAllow: 'Permitir siempre',\n deny: 'Denegar',\n declinedReason: 'el usuario lo ha rechazado',\n readOnlyTool: 'solo lectura',\n consentWaiting: 'esperando tu respuesta',\n consentAllowed: 'permitido',\n consentDenied: 'denegado',\n consentDeniedReason: 'denegado: {reason}',\n questionLead: 'El asistente te pregunta',\n questionSeveral: 'Elige una o varias y pulsa Enviar.',\n questionOther: 'Otra…',\n questionOtherLabel: 'Tu respuesta',\n questionSkip: 'Omitir',\n questionExpiresIn: 'Si no respondes, el asistente decidirá por su cuenta en {time}',\n questionRemote: 'Se responde en la otra pestaña, donde trabaja el asistente.',\n questionAutomatic: 'El asistente siguió sin tu respuesta: {reason}.',\n questionReasonTimeout: 'nadie respondió a tiempo',\n questionReasonFailed: 'no se pudo hacer la pregunta',\n queuedWaiting: 'esperando el siguiente paso del asistente',\n queuedForSessionTab: 'esperando a que termine la otra pestaña',\n queuedForSessionRun: 'esperando a que termine la otra respuesta',\n queuedForOtherTab: 'esperando a que la otra pestaña lo reciba',\n noteRound: 'dijiste, entre llamadas a herramientas',\n noteStep: 'dijiste, después de este paso',\n noteFinal: 'dijiste, antes de la respuesta',\n undelivered: {\n one: 'Sin entregar ({count} mensaje)',\n many: 'Sin entregar ({count} de mensajes)',\n other: 'Sin entregar ({count} mensajes)',\n },\n sendUndelivered: 'Enviar ahora',\n discardUndelivered: 'Descartar',\n remoteRunning:\n 'El asistente trabaja en este chat en otra pestaña: síguelo aquí, escríbele o detenlo.',\n remoteWaitingConsent: 'Espera tu respuesta en la otra pestaña.',\n remoteGone:\n 'La pestaña en la que el asistente trabajaba en este chat se cerró antes de que terminara.',\n sessionBusyTab: 'Esperando a que la otra pestaña termine este chat…',\n sessionBusyRun: 'Esperando a que termine la otra respuesta de este chat…',\n fromAnotherTab: 'desde otra pestaña',\n failed: 'error',\n toolCostTitle:\n 'Tokens estimados de los argumentos y del resultado que leyó el modelo, y la duración de la llamada',\n 'tier.light': 'ligero',\n 'tier.standard': 'estándar',\n 'tier.strong': 'potente',\n 'tierReason.planned': 'El planificador eligió este modelo para el paso',\n 'tierReason.default':\n 'El planificador no valoró este paso, así que se ejecuta con el modelo equilibrado',\n 'tierReason.fallback':\n 'El modelo que pidió el planificador no está configurado, así que el paso lo hace el más cercano',\n 'escalation.blocked': 'informó de un obstáculo',\n 'escalation.emptyResult': 'no dio ningún resultado',\n 'escalation.toolArguments': 'los argumentos de sus llamadas no se podían leer',\n 'escalation.outputCut': 'su respuesta se cortó',\n 'escalation.error': 'la llamada al modelo falló',\n escalated: 'Pasado a un modelo más potente: {from} → {to} ({reason})',\n escalatedAttemptText: 'Lo que escribió el intento anterior',\n escalations: { one: '{count} relevo', many: '{count} de relevos', other: '{count} relevos' },\n attemptTag: 'intento {n}',\n replayed: 'no se volvió a ejecutar',\n replayedTitle:\n 'Esta llamada ya había funcionado en un intento anterior, así que no se ejecutó dos veces: el modelo recibió el resultado anterior',\n replanFailed: 'No se pudo revisar el plan, así que el asistente siguió con él',\n files: 'Archivos',\n showFiles: 'Mostrar archivos',\n attachments: 'Adjuntos',\n dropHint: 'Suelta aquí los archivos para adjuntarlos',\n attach: 'Adjuntar archivos',\n attachTitle: 'Adjuntar archivos o imágenes (también puedes pegarlos o soltarlos)',\n attachmentsOnly: '(adjuntos)',\n binaryText: '{name} no es un archivo de texto, así que no se puede adjuntar como texto.',\n downscaledFrom: 'reducida de {size}',\n convertedFrom: 'convertido de {name}',\n tooManyImages: '{names}: no se ha añadido - en un mensaje caben como máximo {max} imágenes.',\n messageTooLarge: '{names}: no se ha añadido - el mensaje superaría los {mb} MB.',\n inputCount: '{n} / {max}',\n pastedText: {\n one: 'Texto pegado · {count} carácter',\n many: 'Texto pegado · {count} caracteres',\n other: 'Texto pegado · {count} caracteres',\n },\n dictatedText: {\n one: 'Texto dictado · {count} carácter',\n many: 'Texto dictado · {count} caracteres',\n other: 'Texto dictado · {count} caracteres',\n },\n inputLimit: {\n one: 'Un mensaje admite hasta {count} carácter',\n many: 'Un mensaje admite hasta {count} caracteres',\n other: 'Un mensaje admite hasta {count} caracteres',\n },\n inputLimitReached: {\n one: 'El mensaje está lleno: {count} carácter. Un texto pegado más largo se adjunta como archivo.',\n many: 'El mensaje está lleno: {count} caracteres. Un texto pegado más largo se adjunta como archivo.',\n other:\n 'El mensaje está lleno: {count} caracteres. Un texto pegado más largo se adjunta como archivo.',\n },\n longTextRefused: {\n one: 'El texto es más largo de lo que admite un mensaje ({count} carácter): no se insertó.',\n many: 'El texto es más largo de lo que admite un mensaje ({count} caracteres): no se insertó.',\n other: 'El texto es más largo de lo que admite un mensaje ({count} caracteres): no se insertó.',\n },\n inputLimitFull: {\n one: 'El mensaje está lleno: {count} carácter.',\n many: 'El mensaje está lleno: {count} caracteres.',\n other: 'El mensaje está lleno: {count} caracteres.',\n },\n pastedAsFile: {\n one: 'Texto pegado adjuntado como archivo: {count} carácter',\n many: 'Texto pegado adjuntado como archivo: {count} caracteres',\n other: 'Texto pegado adjuntado como archivo: {count} caracteres',\n },\n dictatedAsFile: {\n one: 'Texto dictado adjuntado como archivo: {count} carácter',\n many: 'Texto dictado adjuntado como archivo: {count} caracteres',\n other: 'Texto dictado adjuntado como archivo: {count} caracteres',\n },\n attachmentSaveFailed:\n '{names}: no se pudo guardar en este dispositivo, así que el mensaje no se envió. Libere espacio o quite el archivo y vuelva a enviarlo.',\n filesEmpty: 'Aún no hay archivos. Aquí aparece lo que adjuntas y lo que escribe el asistente.',\n upload: 'Añadir archivos',\n download: 'Descargar',\n delete: 'Borrar',\n memorySaved: 'Recordado',\n memoryUpdated: 'Memoria actualizada',\n memoryForgotten: 'Olvidado',\n memoryUndo: 'Deshacer',\n memoryUndone: 'Deshecho',\n preview: 'Vista previa',\n remove: 'Quitar {name}',\n tooLarge: '{name} ocupa más de {mb} MB, así que no se ha añadido.',\n tooManyPixels: '{name} tiene más de {mp} megapíxeles, así que no se ha añadido.',\n noAttachmentsWhileBusy:\n 'No se pueden añadir archivos mientras el asistente trabaja. Envíalos con tu próximo mensaje.',\n sendWhenReady: 'Se enviará cuando el asistente esté listo',\n sendWhenReadyButton: 'Enviar cuando el asistente esté listo',\n cancelSendWhenReady: 'No enviar',\n notSentFailed:\n 'No se ha enviado: el asistente no ha podido iniciarse. Tu mensaje sigue en el cuadro.',\n notSentUnavailable:\n 'No se ha enviado: el asistente no está listo. Tu mensaje sigue en el cuadro.',\n notSentDisabled: 'No se ha enviado: el envío está desactivado. Tu mensaje sigue en el cuadro.',\n mediaImage: 'Imagen creada por el asistente: {path}',\n mediaReferences: 'Referencia: {names}',\n mediaReferencesUnused:\n 'No se ha usado: este modelo de imágenes no acepta imágenes de referencia: {names}',\n imageOpen: 'Abrir la imagen {name}',\n imagePrevious: 'Imagen anterior',\n imageNext: 'Imagen siguiente',\n imageZoom: 'Tamaño completo',\n imageCount: '{index} de {total}',\n filesWritten: 'Archivos escritos en esta respuesta: {count}',\n filesNamed: 'Archivos en esta respuesta: {count}',\n filesCount: 'Archivos: {count}',\n showInFiles: 'Mostrar en Archivos',\n 'kind.image': 'Imagen',\n 'kind.text': 'Texto',\n 'kind.file': 'Archivo',\n fileOpen: 'Abrir {name}',\n fileLinkOpen: '{text} - abrir el archivo {name}',\n fileDownload: 'Descargar {name}',\n fileGone: 'ya no está entre los archivos',\n fileNoPreview: 'Este tipo de archivo no tiene vista previa. Descárgalo para abrirlo.',\n fileCut:\n 'Solo se muestran los primeros {chars} caracteres. Descarga el archivo para ver el resto.',\n fileShowRest: 'Mostrar el resto',\n fileShowLess: 'Mostrar menos',\n fileRendered: 'Con formato',\n fileSource: 'Fuente',\n closePreview: 'Cerrar la vista previa',\n fileLines: 'Líneas: {count}',\n htmlSourceNote: 'se muestra como texto, no se ejecuta nada',\n htmlFrameTitle: 'HTML escrito por el asistente',\n htmlSandboxed: 'aislado',\n htmlNoNetwork: 'sin red',\n htmlScriptsOff: 'scripts desactivados',\n htmlLinkedFiles: 'los archivos enlazados no se cargan: {names}',\n htmlTooLarge:\n 'Esta página es demasiado grande para la vista previa. Se muestra su código fuente.',\n htmlTaller: 'Hacer la vista previa más alta',\n htmlShorter: 'Hacer la vista previa más baja',\n usageMedia: 'Imágenes creadas: {count}',\n dictate: 'Dictar',\n dictateTitle: 'Dictado: hable y luego edite las palabras antes de enviar',\n stopDictation: 'Detener el dictado',\n micListening: 'Escuchando — toque para terminar',\n listening: 'Escuchando… toque el micrófono otra vez para terminar',\n transcribing: 'Transcribiendo…',\n micDenied:\n 'El micrófono está bloqueado para este sitio. Permítalo en la configuración del sitio del navegador (el icono junto a la dirección) y vuelva a intentarlo.',\n micMissing: 'No se encontró ningún micrófono en este dispositivo.',\n micBusy: 'Otra aplicación está usando el micrófono.',\n micUnsupported: 'Este navegador no puede grabar audio en esta página.',\n dictationFailed: 'El dictado no funcionó.',\n recordVoiceMessage: 'Grabar un mensaje de voz',\n voiceMessage: 'Mensaje de voz',\n recording: 'Grabando {elapsed}',\n recordingDone: 'Adjuntar la grabación',\n recordingCancel: 'Descartar la grabación',\n recordingLimit: 'La grabación llegó a su duración máxima y se detuvo; está adjunta.',\n audioAttachment: 'Mensaje de voz {name}',\n transcriptOf: 'Transcripción de {name}',\n transcriptNote:\n 'Lo que se dice en su grabación, tal como lo oyó el modelo de voz a texto. Puede haber errores.',\n readAloud: 'Escuchar',\n readAloudPause: 'Pausar',\n readAloudResume: 'Continuar',\n readAloudStop: 'Dejar de leer',\n readAloudLoading: 'Preparando el audio…',\n readAloudCode: 'Aquí hay un bloque de código; no se lee.',\n readAloudFailed: 'No se pudo leer en voz alta.',\n}\n"],"mappings":";AAGO,IAAM,UAA6B;AAAA,EACxC,eAAe;AAAA,EACf,uBAAuB;AAAA,EACvB,gBAAgB;AAAA,EAChB,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,SAAS;AAAA,EACT,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,OAAO;AAAA,EACP,OAAO,EAAE,KAAK,gBAAgB,MAAM,oBAAoB,OAAO,gBAAgB;AAAA,EAC/E,WAAW;AAAA,IACT,KAAK;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,EACT;AAAA,EACA,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,WAAW;AAAA,EACX,aAAa;AAAA,EACb,iBAAiB;AAAA,EACjB,S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