@pixerate/editor 0.81.0 → 0.83.0

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.
Files changed (67) hide show
  1. package/dist/agent/index.cjs +36 -7
  2. package/dist/agent/index.cjs.map +1 -1
  3. package/dist/agent/index.d.cts +5 -3
  4. package/dist/agent/index.d.ts +5 -3
  5. package/dist/agent/index.js +43 -14
  6. package/dist/agent/index.js.map +1 -1
  7. package/dist/animation-editor/index.d.cts +1 -1
  8. package/dist/animation-editor/index.d.ts +1 -1
  9. package/dist/bridge/index.d.cts +3 -3
  10. package/dist/bridge/index.d.ts +3 -3
  11. package/dist/{bridge-client-C5dRjrz5.d.ts → bridge-client-CMGfnjTl.d.ts} +1 -1
  12. package/dist/{bridge-client-C5OziCRK.d.cts → bridge-client-VpnICVxP.d.cts} +1 -1
  13. package/dist/canvas/index.cjs +235 -104
  14. package/dist/canvas/index.cjs.map +1 -1
  15. package/dist/canvas/index.d.cts +59 -1
  16. package/dist/canvas/index.d.ts +59 -1
  17. package/dist/canvas/index.js +234 -103
  18. package/dist/canvas/index.js.map +1 -1
  19. package/dist/capture-DFEMFmVt.d.cts +133 -0
  20. package/dist/capture-wwNGaW05.d.ts +133 -0
  21. package/dist/chart/index.d.cts +1 -1
  22. package/dist/chart/index.d.ts +1 -1
  23. package/dist/{chunk-K73CKYUM.cjs → chunk-EI2MOVQ3.cjs} +198 -3
  24. package/dist/chunk-EI2MOVQ3.cjs.map +1 -0
  25. package/dist/chunk-FURT6ZFZ.cjs +1 -0
  26. package/dist/chunk-FURT6ZFZ.cjs.map +1 -0
  27. package/dist/{chunk-GPWNYQ7R.js → chunk-O2W2SP3C.js} +197 -2
  28. package/dist/chunk-O2W2SP3C.js.map +1 -0
  29. package/dist/chunk-REOJJIY3.js +201 -0
  30. package/dist/chunk-REOJJIY3.js.map +1 -0
  31. package/dist/chunk-RJ2BFKEN.js +1 -0
  32. package/dist/chunk-RJ2BFKEN.js.map +1 -0
  33. package/dist/chunk-VJUVNERT.cjs +201 -0
  34. package/dist/chunk-VJUVNERT.cjs.map +1 -0
  35. package/dist/commands/index.d.cts +1 -1
  36. package/dist/commands/index.d.ts +1 -1
  37. package/dist/diagram/index.d.cts +1 -1
  38. package/dist/diagram/index.d.ts +1 -1
  39. package/dist/dom-capture-7Wvf6Tyg.d.ts +59 -0
  40. package/dist/dom-capture-GyYuE-zq.d.cts +59 -0
  41. package/dist/generation/index.d.cts +2 -2
  42. package/dist/generation/index.d.ts +2 -2
  43. package/dist/image-editor/index.cjs +97 -1
  44. package/dist/image-editor/index.cjs.map +1 -1
  45. package/dist/image-editor/index.d.cts +24 -2
  46. package/dist/image-editor/index.d.ts +24 -2
  47. package/dist/image-editor/index.js +96 -0
  48. package/dist/image-editor/index.js.map +1 -1
  49. package/dist/{registry-DIpIaCkH.d.cts → registry-BqA1AZt0.d.cts} +1 -1
  50. package/dist/{registry-7AZFuand.d.ts → registry-D-4fit9C.d.ts} +1 -1
  51. package/dist/tools/index.cjs +33 -4
  52. package/dist/tools/index.cjs.map +1 -1
  53. package/dist/tools/index.d.cts +4 -2
  54. package/dist/tools/index.d.ts +4 -2
  55. package/dist/tools/index.js +43 -14
  56. package/dist/video-editor/index.cjs +557 -99
  57. package/dist/video-editor/index.cjs.map +1 -1
  58. package/dist/video-editor/index.d.cts +211 -6
  59. package/dist/video-editor/index.d.ts +211 -6
  60. package/dist/video-editor/index.js +493 -35
  61. package/dist/video-editor/index.js.map +1 -1
  62. package/package.json +1 -1
  63. package/skills/pixerate-canvas/SKILL.md +1 -0
  64. package/skills/pixerate-image-editor/SKILL.md +1 -0
  65. package/skills/pixerate-video-editor/SKILL.md +24 -6
  66. package/dist/chunk-GPWNYQ7R.js.map +0 -1
  67. package/dist/chunk-K73CKYUM.cjs.map +0 -1
@@ -433,6 +433,195 @@ var EDITOR_MCP_TOOLS = [
433
433
  MCP_TOOL_VIEW_EDITOR
434
434
  ];
435
435
 
436
+ // src/tools/dom-capture.ts
437
+ var NO_DOM = "Capturing needs a browser DOM (document, Image, XMLSerializer and a 2D canvas); it is not available in this environment.";
438
+ var SKIPPED_TAGS = /* @__PURE__ */ new Set(["SCRIPT", "NOSCRIPT", "TEMPLATE", "LINK", "META", "STYLE"]);
439
+ function styleText(style) {
440
+ let text = "";
441
+ for (let i = 0; i < style.length; i++) {
442
+ const name = style[i];
443
+ const priority = style.getPropertyPriority(name);
444
+ text += `${name}:${style.getPropertyValue(name)}${priority ? ` !${priority}` : ""};`;
445
+ }
446
+ return text;
447
+ }
448
+ function imageSnapshot(source, doc) {
449
+ try {
450
+ if (source.tagName === "CANVAS") return source.toDataURL("image/png");
451
+ const img = source;
452
+ if (!img.complete || !img.naturalWidth || img.src.startsWith("data:")) return null;
453
+ const canvas = doc.createElement("canvas");
454
+ canvas.width = img.naturalWidth;
455
+ canvas.height = img.naturalHeight;
456
+ const context = canvas.getContext("2d");
457
+ if (!context) return null;
458
+ context.drawImage(img, 0, 0);
459
+ return canvas.toDataURL("image/png");
460
+ } catch {
461
+ return null;
462
+ }
463
+ }
464
+ function cloneElementWithStyles(element, exclude = []) {
465
+ const doc = element.ownerDocument;
466
+ const view = doc.defaultView;
467
+ if (!view) throw new Error(NO_DOM);
468
+ const selector = exclude.join(",");
469
+ const copy = (source) => {
470
+ if (source.nodeType === 3) return source.cloneNode(false);
471
+ if (source.nodeType !== 1) return null;
472
+ const el = source;
473
+ if (SKIPPED_TAGS.has(el.tagName.toUpperCase()) || selector && el.matches(selector)) return null;
474
+ let clone;
475
+ if (el.tagName === "CANVAS") {
476
+ clone = doc.createElement("img");
477
+ const url = imageSnapshot(el, doc);
478
+ if (url) clone.setAttribute("src", url);
479
+ } else {
480
+ clone = el.cloneNode(false);
481
+ if (el.tagName === "IMG") {
482
+ const url = imageSnapshot(el, doc);
483
+ if (url) clone.setAttribute("src", url);
484
+ clone.removeAttribute("srcset");
485
+ }
486
+ }
487
+ clone.setAttribute("style", styleText(view.getComputedStyle(el)));
488
+ if (el.tagName === "INPUT") {
489
+ const input = el;
490
+ clone.setAttribute("value", input.value);
491
+ if (input.checked) clone.setAttribute("checked", "");
492
+ else clone.removeAttribute("checked");
493
+ } else if (el.tagName === "TEXTAREA") {
494
+ clone.textContent = el.value;
495
+ return clone;
496
+ } else if (el.tagName === "SELECT") {
497
+ const value = el.value;
498
+ for (const child of Array.from(el.childNodes)) {
499
+ const option = copy(child);
500
+ if (option && option.tagName === "OPTION" && option.value === value) {
501
+ option.setAttribute("selected", "");
502
+ }
503
+ if (option) clone.appendChild(option);
504
+ }
505
+ return clone;
506
+ }
507
+ for (const child of Array.from(el.childNodes)) {
508
+ const next = copy(child);
509
+ if (next) clone.appendChild(next);
510
+ }
511
+ return clone;
512
+ };
513
+ const root = copy(element);
514
+ if (!root) throw new Error("The element to capture is excluded by the exclude selectors.");
515
+ return root;
516
+ }
517
+ function elementToSvg(clone, width, height) {
518
+ const doc = clone.ownerDocument;
519
+ const Serializer = doc.defaultView?.XMLSerializer ?? globalThis.XMLSerializer;
520
+ if (!Serializer) throw new Error(NO_DOM);
521
+ clone.setAttribute("xmlns", "http://www.w3.org/1999/xhtml");
522
+ const xml = new Serializer().serializeToString(clone);
523
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}"><foreignObject x="0" y="0" width="100%" height="100%">${xml}</foreignObject></svg>`;
524
+ }
525
+ async function rasterizeElement(element, options = {}) {
526
+ const doc = element.ownerDocument;
527
+ const view = doc?.defaultView;
528
+ if (!view?.Image) throw new Error(NO_DOM);
529
+ const width = Math.max(1, Math.round(options.width ?? element.clientWidth));
530
+ const height = Math.max(1, Math.round(options.height ?? element.clientHeight));
531
+ const pixelWidth = Math.max(1, Math.round(options.pixelWidth ?? width));
532
+ const pixelHeight = Math.max(1, Math.round(options.pixelHeight ?? height));
533
+ const format = options.format ?? "png";
534
+ const clone = cloneElementWithStyles(element, options.exclude);
535
+ const background = options.background ?? view.getComputedStyle(element).backgroundColor;
536
+ clone.style.width = `${width}px`;
537
+ clone.style.height = `${height}px`;
538
+ clone.style.margin = "0";
539
+ clone.style.position = "relative";
540
+ clone.style.left = "0";
541
+ clone.style.top = "0";
542
+ clone.style.transform = "none";
543
+ clone.style.overflow = "hidden";
544
+ options.prepare?.(clone);
545
+ const svg = elementToSvg(clone, width, height);
546
+ const canvas = doc.createElement("canvas");
547
+ canvas.width = pixelWidth;
548
+ canvas.height = pixelHeight;
549
+ let context = null;
550
+ try {
551
+ context = canvas.getContext("2d");
552
+ } catch {
553
+ context = null;
554
+ }
555
+ if (!context) throw new Error(NO_DOM);
556
+ const image = new view.Image();
557
+ await new Promise((resolve, reject) => {
558
+ image.onload = () => resolve();
559
+ image.onerror = () => reject(new Error("The captured view could not be drawn as an image."));
560
+ image.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
561
+ });
562
+ const transparent = !background || background === "transparent" || /rgba\([^)]*,\s*0\)$/.test(background);
563
+ if (!transparent || format === "jpeg") {
564
+ context.fillStyle = transparent ? "#ffffff" : background;
565
+ context.fillRect(0, 0, pixelWidth, pixelHeight);
566
+ }
567
+ context.drawImage(image, 0, 0, pixelWidth, pixelHeight);
568
+ try {
569
+ return canvas.toDataURL(format === "jpeg" ? "image/jpeg" : "image/png", options.quality ?? 0.85);
570
+ } catch {
571
+ throw new Error("The browser refused to export the captured view (the canvas is tainted by cross-origin content).");
572
+ }
573
+ }
574
+ var CAPTURE_OVERLAY_SELECTORS = [...EXPORT_EXCLUDED_SELECTORS, '[data-capture="overlay"]'];
575
+ var CAPTURE_EXCLUDE_SELECTOR = '[data-capture="exclude"]';
576
+ function createElementCaptureSurface(options) {
577
+ const getElement = () => (typeof options.element === "function" ? options.element() : options.element) ?? null;
578
+ const require2 = () => {
579
+ const el = getElement();
580
+ if (!el || !el.isConnected) throw new Error("The view is not mounted, so there is nothing to capture.");
581
+ return el;
582
+ };
583
+ const visible = () => {
584
+ const el = getElement();
585
+ if (!el || !el.clientWidth || !el.clientHeight) return null;
586
+ return { x: el.scrollLeft, y: el.scrollTop, width: el.clientWidth, height: el.clientHeight };
587
+ };
588
+ const overlays = options.overlaySelectors ?? CAPTURE_OVERLAY_SELECTORS;
589
+ return {
590
+ units: "CSS pixels",
591
+ viewport: visible,
592
+ content: () => {
593
+ const el = getElement();
594
+ if (!el || !el.scrollWidth || !el.scrollHeight) return null;
595
+ return { x: 0, y: 0, width: el.scrollWidth, height: el.scrollHeight };
596
+ },
597
+ overlays: "agent cursors and presence tags",
598
+ maxScale: 2,
599
+ render: (request) => {
600
+ const el = require2();
601
+ const exclude = [CAPTURE_EXCLUDE_SELECTOR, ...options.exclude ?? [], ...request.includeOverlays ? [] : overlays];
602
+ const rasterize = options.rasterize ?? rasterizeElement;
603
+ return rasterize(el, {
604
+ width: request.rect.width,
605
+ height: request.rect.height,
606
+ pixelWidth: request.width,
607
+ pixelHeight: request.height,
608
+ format: request.format,
609
+ quality: request.quality,
610
+ background: options.background,
611
+ exclude,
612
+ // Scrolling does not survive cloning: shift the content so the rect's corner is at the top left.
613
+ prepare: (clone) => {
614
+ const shift = `translate(${-request.rect.x}px, ${-request.rect.y}px)`;
615
+ const inner = clone.ownerDocument.createElement("div");
616
+ inner.setAttribute("style", `transform:${shift};transform-origin:0 0;width:${el.scrollWidth}px;height:${el.scrollHeight}px`);
617
+ while (clone.firstChild) inner.appendChild(clone.firstChild);
618
+ clone.appendChild(inner);
619
+ }
620
+ });
621
+ }
622
+ };
623
+ }
624
+
436
625
  export {
437
626
  MCP_TOOL_GET_EDITOR_STATE,
438
627
  MCP_TOOL_EDIT_CANVAS,
@@ -453,6 +642,12 @@ export {
453
642
  EDITOR_PROMPT_TOOLS,
454
643
  EDIT_OPERATION_REQUIRED_ARGUMENTS,
455
644
  EXPORT_EXCLUDED_SELECTORS,
456
- EDITOR_MCP_TOOLS
645
+ EDITOR_MCP_TOOLS,
646
+ cloneElementWithStyles,
647
+ elementToSvg,
648
+ rasterizeElement,
649
+ CAPTURE_OVERLAY_SELECTORS,
650
+ CAPTURE_EXCLUDE_SELECTOR,
651
+ createElementCaptureSurface
457
652
  };
458
- //# sourceMappingURL=chunk-GPWNYQ7R.js.map
653
+ //# sourceMappingURL=chunk-O2W2SP3C.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/tools/definitions.ts","../src/tools/dom-capture.ts"],"sourcesContent":["/**\n * Standard MCP Tool Definitions for @pixerate/editor.\n * Compatible with the Model Context Protocol (MCP) tool specification schema.\n */\n\nexport const MCP_TOOL_GET_EDITOR_STATE = {\n\tname: 'get_editor_state',\n\ttitle: 'Get editor state',\n\tannotations: {\n\t\ttitle: 'Get editor state',\n\t\treadOnlyHint: true,\n\t\tdestructiveHint: false,\n\t\tidempotentHint: true,\n\t\topenWorldHint: false\n\t},\n\tdescription:\n\t\t'Retrieves the current state of the document, variables, selection, and canvas graph (nodes and edges).',\n\tinputSchema: {\n\t\ttype: 'object',\n\t\tproperties: {\n\t\t\tincludeDocument: {\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdescription: 'Whether to include the prompt document text and variables (default: true).'\n\t\t\t},\n\t\t\tincludeCanvas: {\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdescription: 'Whether to include the canvas nodes and edges (default: true).'\n\t\t\t}\n\t\t}\n\t}\n} as const;\n\nexport const MCP_TOOL_EDIT_CANVAS = {\n\tname: 'edit_canvas',\n\ttitle: 'Edit the canvas',\n\tannotations: {\n\t\ttitle: 'Edit the canvas',\n\t\treadOnlyHint: false,\n\t\tdestructiveHint: true,\n\t\tidempotentHint: false,\n\t\topenWorldHint: false\n\t},\n\tdescription:\n\t\t'Applies high-level structural operations to the visual canvas (adding nodes, connecting edges, organizing layout, or moving elements). ' +\n\t\t'Prefer the per-operation canvas_* tools when the host exposes them. Returns the ids of created nodes and edges.',\n\tinputSchema: {\n\t\ttype: 'object',\n\t\tproperties: {\n\t\t\toperation: {\n\t\t\t\ttype: 'string',\n\t\t\t\tenum: [\n\t\t\t\t\t'add_node',\n\t\t\t\t\t'remove_nodes',\n\t\t\t\t\t'connect',\n\t\t\t\t\t'update_node',\n\t\t\t\t\t'layout',\n\t\t\t\t\t'select',\n\t\t\t\t\t'highlight'\n\t\t\t\t],\n\t\t\t\tdescription: 'The canvas operation to execute.'\n\t\t\t},\n\t\t\tnode: {\n\t\t\t\ttype: 'object',\n\t\t\t\tdescription: 'Node definition when operation is add_node. Can omit position to auto-place.'\n\t\t\t},\n\t\t\tnearNodeId: {\n\t\t\t\ttype: 'string',\n\t\t\t\tdescription: 'Anchor node ID to position beside using collision-aware placement.'\n\t\t\t},\n\t\t\tside: {\n\t\t\t\ttype: 'string',\n\t\t\t\tenum: ['top', 'right', 'bottom', 'left'],\n\t\t\t\tdescription: 'Side of the anchor node to place the new node beside.'\n\t\t\t},\n\t\t\tnodeIds: {\n\t\t\t\ttype: 'array',\n\t\t\t\titems: { type: 'string' },\n\t\t\t\tdescription: 'Array of node IDs for remove_nodes, select, or highlight.'\n\t\t\t},\n\t\t\tid: {\n\t\t\t\ttype: 'string',\n\t\t\t\tdescription: 'Node ID for update_node (or pass `node: { id, data }`).'\n\t\t\t},\n\t\t\tdata: {\n\t\t\t\ttype: 'object',\n\t\t\t\tdescription: 'Data fields to merge into the node for update_node.'\n\t\t\t},\n\t\t\tcolor: {\n\t\t\t\ttype: 'string',\n\t\t\t\tdescription: 'CSS color for highlight (default #3b82f6).'\n\t\t\t},\n\t\t\tdurationMs: {\n\t\t\t\ttype: 'integer',\n\t\t\t\tminimum: 0,\n\t\t\t\tdescription: 'How long the highlight lasts in ms (default 2000).'\n\t\t\t},\n\t\t\tsource: {\n\t\t\t\ttype: 'string',\n\t\t\t\tdescription: 'Source node ID for connect operation.'\n\t\t\t},\n\t\t\ttarget: {\n\t\t\t\ttype: 'string',\n\t\t\t\tdescription: 'Target node ID for connect operation.'\n\t\t\t},\n\t\t\tlabel: {\n\t\t\t\ttype: 'string',\n\t\t\t\tdescription: 'Optional edge label for connect operation.'\n\t\t\t},\n\t\t\tdirection: {\n\t\t\t\ttype: 'string',\n\t\t\t\tenum: ['LR', 'TB', 'RL', 'BT'],\n\t\t\t\tdescription: 'Layout direction (default LR).'\n\t\t\t},\n\t\t\tincremental: {\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdescription: 'Preserve existing node coordinates and blend layout (default true).'\n\t\t\t}\n\t\t},\n\t\trequired: ['operation']\n\t}\n} as const;\n\nexport const MCP_TOOL_EDIT_PROMPT = {\n\tname: 'edit_prompt',\n\ttitle: 'Edit the prompt',\n\tannotations: {\n\t\ttitle: 'Edit the prompt',\n\t\treadOnlyHint: false,\n\t\tdestructiveHint: true,\n\t\tidempotentHint: false,\n\t\topenWorldHint: false\n\t},\n\tdescription:\n\t\t'Applies edits to the prompt template document, including inserting text, replacing ranges, and setting variables.',\n\tinputSchema: {\n\t\ttype: 'object',\n\t\tproperties: {\n\t\t\toperation: {\n\t\t\t\ttype: 'string',\n\t\t\t\tenum: ['insert_text', 'replace_range', 'set_variable', 'select'],\n\t\t\t\tdescription: 'The prompt operation to execute.'\n\t\t\t},\n\t\t\ttext: {\n\t\t\t\ttype: 'string',\n\t\t\t\tdescription: 'Text to insert or replace.'\n\t\t\t},\n\t\t\tat: {\n\t\t\t\ttype: 'integer',\n\t\t\t\tminimum: 0,\n\t\t\t\tdescription: 'Position to insert text at.'\n\t\t\t},\n\t\t\tfrom: {\n\t\t\t\ttype: 'integer',\n\t\t\t\tminimum: 0,\n\t\t\t\tdescription: 'Start offset for replace_range or select.'\n\t\t\t},\n\t\t\tto: {\n\t\t\t\ttype: 'integer',\n\t\t\t\tminimum: 0,\n\t\t\t\tdescription: 'End offset for replace_range or select.'\n\t\t\t},\n\t\t\tname: {\n\t\t\t\ttype: 'string',\n\t\t\t\tdescription: 'Variable name for set_variable.'\n\t\t\t},\n\t\t\tvalue: {\n\t\t\t\tdescription: 'Variable value for set_variable.'\n\t\t\t}\n\t\t},\n\t\trequired: ['operation']\n\t}\n} as const;\n\nexport const MCP_TOOL_VIEW_EDITOR = {\n\tname: 'view_editor',\n\ttitle: 'View the editor',\n\tannotations: {\n\t\ttitle: 'View the editor',\n\t\treadOnlyHint: true,\n\t\tdestructiveHint: false,\n\t\tidempotentHint: true,\n\t\topenWorldHint: false\n\t},\n\tdescription:\n\t\t'Captures a visual image snapshot (JPEG or PNG) of the editor canvas or viewport for multimodal evaluation. Active agent cursor indicators are automatically excluded from the snapshot.',\n\tinputSchema: {\n\t\ttype: 'object',\n\t\tproperties: {\n\t\t\tscope: {\n\t\t\t\ttype: 'string',\n\t\t\t\tenum: ['viewport', 'canvas'],\n\t\t\t\tdescription: 'Whether to capture only the visible viewport or the full canvas bounding box (default: viewport).'\n\t\t\t},\n\t\t\tformat: {\n\t\t\t\ttype: 'string',\n\t\t\t\tenum: ['jpeg', 'png'],\n\t\t\t\tdescription: 'Image format of the base64 snapshot (default: jpeg).'\n\t\t\t},\n\t\t\tmaxEdge: {\n\t\t\t\ttype: 'integer',\n\t\t\t\tdescription: 'Maximum width or height dimension in pixels (default: 1024).'\n\t\t\t}\n\t\t}\n\t}\n} as const;\n\n// ---------------------------------------------------------------------------\n// Per-operation tools: one strict schema per canvas / prompt operation.\n// ---------------------------------------------------------------------------\n\nconst WRITE_ANNOTATIONS = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false } as const;\nconst DESTRUCTIVE_ANNOTATIONS = { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false } as const;\nconst IDEMPOTENT_ANNOTATIONS = { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false } as const;\n\nconst NODE_IDS = {\n\ttype: 'array',\n\titems: { type: 'string', minLength: 1 },\n\tminItems: 1,\n\tuniqueItems: true,\n\tdescription: 'Node ids (from get_editor_state).'\n} as const;\n\nconst POSITION = {\n\ttype: 'object',\n\tproperties: { x: { type: 'number' }, y: { type: 'number' } },\n\trequired: ['x', 'y'],\n\tadditionalProperties: false\n} as const;\n\nconst DOC_POSITION = { type: 'integer', minimum: 0 } as const;\n\nexport const MCP_TOOL_CANVAS_ADD_NODE = {\n\tname: 'canvas_add_node',\n\ttitle: 'Add a canvas node',\n\tannotations: { title: 'Add a canvas node', ...WRITE_ANNOTATIONS },\n\tdescription:\n\t\t'Adds a node to the canvas. Without `position` it is placed without overlaps beside `nearNodeId` (and connected from it) ' +\n\t\t'or beside the last node. Returns the new node id (generated unless you pass `node.id`) and the id of the connecting edge.',\n\tinputSchema: {\n\t\ttype: 'object',\n\t\tproperties: {\n\t\t\tnode: {\n\t\t\t\ttype: 'object',\n\t\t\t\tdescription: 'The node. Extra host-specific fields are kept.',\n\t\t\t\tproperties: {\n\t\t\t\t\tid: { type: 'string', minLength: 1, description: 'Node id (default: generated). Must be unused.' },\n\t\t\t\t\ttype: { type: 'string', description: 'Node type registered by the host.' },\n\t\t\t\t\tdata: { type: 'object', description: 'Node data (e.g. { \"label\": \"...\" }).' },\n\t\t\t\t\tposition: { ...POSITION, description: 'Canvas coordinates (default: auto-placed).' },\n\t\t\t\t\twidth: { type: 'number', exclusiveMinimum: 0 },\n\t\t\t\t\theight: { type: 'number', exclusiveMinimum: 0 },\n\t\t\t\t\tparentId: { type: 'string', description: 'Parent (group/frame) node id.' }\n\t\t\t\t}\n\t\t\t},\n\t\t\tnearNodeId: { type: 'string', description: 'Existing node to place the new node beside and connect from.' },\n\t\t\tside: {\n\t\t\t\ttype: 'string',\n\t\t\t\tenum: ['top', 'right', 'bottom', 'left'],\n\t\t\t\tdescription: 'Side of `nearNodeId` to place the node on (default right).'\n\t\t\t}\n\t\t},\n\t\trequired: ['node'],\n\t\tadditionalProperties: false\n\t}\n} as const;\n\nexport const MCP_TOOL_CANVAS_REMOVE_NODES = {\n\tname: 'canvas_remove_nodes',\n\ttitle: 'Remove canvas nodes',\n\tannotations: { title: 'Remove canvas nodes', ...DESTRUCTIVE_ANNOTATIONS },\n\tdescription: 'Removes nodes (and their edges) from the canvas. Every id must exist.',\n\tinputSchema: {\n\t\ttype: 'object',\n\t\tproperties: { nodeIds: NODE_IDS },\n\t\trequired: ['nodeIds'],\n\t\tadditionalProperties: false\n\t}\n} as const;\n\nexport const MCP_TOOL_CANVAS_CONNECT = {\n\tname: 'canvas_connect',\n\ttitle: 'Connect canvas nodes',\n\tannotations: { title: 'Connect canvas nodes', ...WRITE_ANNOTATIONS },\n\tdescription: 'Adds an edge from one existing node to another. Returns the new edge id.',\n\tinputSchema: {\n\t\ttype: 'object',\n\t\tproperties: {\n\t\t\tsource: { type: 'string', minLength: 1, description: 'Source node id.' },\n\t\t\ttarget: { type: 'string', minLength: 1, description: 'Target node id.' },\n\t\t\tlabel: { type: 'string', description: 'Edge label.' }\n\t\t},\n\t\trequired: ['source', 'target'],\n\t\tadditionalProperties: false\n\t}\n} as const;\n\nexport const MCP_TOOL_CANVAS_UPDATE_NODE = {\n\tname: 'canvas_update_node',\n\ttitle: 'Update a canvas node',\n\tannotations: { title: 'Update a canvas node', ...DESTRUCTIVE_ANNOTATIONS, idempotentHint: true },\n\tdescription: \"Merges fields into an existing node's data.\",\n\tinputSchema: {\n\t\ttype: 'object',\n\t\tproperties: {\n\t\t\tid: { type: 'string', minLength: 1, description: 'Node id.' },\n\t\t\tdata: { type: 'object', description: 'Data fields to merge (e.g. { \"label\": \"New\" }).' }\n\t\t},\n\t\trequired: ['id', 'data'],\n\t\tadditionalProperties: false\n\t}\n} as const;\n\nexport const MCP_TOOL_CANVAS_LAYOUT = {\n\tname: 'canvas_layout',\n\ttitle: 'Lay out the canvas',\n\tannotations: { title: 'Lay out the canvas', ...IDEMPOTENT_ANNOTATIONS },\n\tdescription: 'Arranges the canvas graph automatically.',\n\tinputSchema: {\n\t\ttype: 'object',\n\t\tproperties: {\n\t\t\tdirection: { type: 'string', enum: ['LR', 'TB', 'RL', 'BT'], description: 'Layout direction (default LR).' },\n\t\t\tincremental: {\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdescription: 'Keep nodes that already have a position where they are (default true).'\n\t\t\t}\n\t\t},\n\t\tadditionalProperties: false\n\t}\n} as const;\n\nexport const MCP_TOOL_CANVAS_SELECT = {\n\tname: 'canvas_select',\n\ttitle: 'Select canvas nodes',\n\tannotations: { title: 'Select canvas nodes', ...IDEMPOTENT_ANNOTATIONS },\n\tdescription: 'Replaces the canvas selection with these nodes (an empty list clears it).',\n\tinputSchema: {\n\t\ttype: 'object',\n\t\tproperties: { nodeIds: { ...NODE_IDS, minItems: 0 } },\n\t\trequired: ['nodeIds'],\n\t\tadditionalProperties: false\n\t}\n} as const;\n\nexport const MCP_TOOL_CANVAS_HIGHLIGHT = {\n\tname: 'canvas_highlight',\n\ttitle: 'Highlight canvas nodes',\n\tannotations: { title: 'Highlight canvas nodes', ...IDEMPOTENT_ANNOTATIONS },\n\tdescription: 'Briefly highlights nodes to draw the user\\'s attention to them.',\n\tinputSchema: {\n\t\ttype: 'object',\n\t\tproperties: {\n\t\t\tnodeIds: NODE_IDS,\n\t\t\tcolor: { type: 'string', description: 'CSS color (default #3b82f6).' },\n\t\t\tdurationMs: { type: 'integer', minimum: 0, maximum: 60000, description: 'Duration in ms (default 2000).' }\n\t\t},\n\t\trequired: ['nodeIds'],\n\t\tadditionalProperties: false\n\t}\n} as const;\n\nexport const MCP_TOOL_PROMPT_INSERT_TEXT = {\n\tname: 'prompt_insert_text',\n\ttitle: 'Insert prompt text',\n\tannotations: { title: 'Insert prompt text', ...WRITE_ANNOTATIONS },\n\tdescription: 'Inserts text into the prompt at a position, or at the cursor when `at` is omitted.',\n\tinputSchema: {\n\t\ttype: 'object',\n\t\tproperties: {\n\t\t\ttext: { type: 'string', description: 'Text to insert.' },\n\t\t\tat: { ...DOC_POSITION, description: 'Position (as in get_editor_state `document.selection`).' }\n\t\t},\n\t\trequired: ['text'],\n\t\tadditionalProperties: false\n\t}\n} as const;\n\nexport const MCP_TOOL_PROMPT_REPLACE_RANGE = {\n\tname: 'prompt_replace_range',\n\ttitle: 'Replace prompt text',\n\tannotations: { title: 'Replace prompt text', ...DESTRUCTIVE_ANNOTATIONS },\n\tdescription: 'Replaces the prompt text between two positions (an empty text deletes it).',\n\tinputSchema: {\n\t\ttype: 'object',\n\t\tproperties: {\n\t\t\tfrom: { ...DOC_POSITION, description: 'Start position.' },\n\t\t\tto: { ...DOC_POSITION, description: 'End position (>= from).' },\n\t\t\ttext: { type: 'string', description: 'Replacement text.' }\n\t\t},\n\t\trequired: ['from', 'to', 'text'],\n\t\tadditionalProperties: false\n\t}\n} as const;\n\nexport const MCP_TOOL_PROMPT_SET_VARIABLE = {\n\tname: 'prompt_set_variable',\n\ttitle: 'Set a prompt variable',\n\tannotations: { title: 'Set a prompt variable', ...DESTRUCTIVE_ANNOTATIONS, idempotentHint: true },\n\tdescription: 'Sets the value of a template variable used by the prompt.',\n\tinputSchema: {\n\t\ttype: 'object',\n\t\tproperties: {\n\t\t\tname: { type: 'string', minLength: 1, description: 'Variable name.' },\n\t\t\tvalue: { description: 'Variable value (any JSON value).' }\n\t\t},\n\t\trequired: ['name', 'value'],\n\t\tadditionalProperties: false\n\t}\n} as const;\n\nexport const MCP_TOOL_PROMPT_SELECT = {\n\tname: 'prompt_select',\n\ttitle: 'Select prompt text',\n\tannotations: { title: 'Select prompt text', ...IDEMPOTENT_ANNOTATIONS },\n\tdescription: 'Selects the prompt text between two positions (from === to places the cursor).',\n\tinputSchema: {\n\t\ttype: 'object',\n\t\tproperties: {\n\t\t\tfrom: { ...DOC_POSITION, description: 'Start position.' },\n\t\t\tto: { ...DOC_POSITION, description: 'End position (>= from).' }\n\t\t},\n\t\trequired: ['from', 'to'],\n\t\tadditionalProperties: false\n\t}\n} as const;\n\n/** Per-operation canvas tools, the strict alternative to `edit_canvas`. */\nexport const EDITOR_CANVAS_TOOLS = [\n\tMCP_TOOL_CANVAS_ADD_NODE,\n\tMCP_TOOL_CANVAS_REMOVE_NODES,\n\tMCP_TOOL_CANVAS_CONNECT,\n\tMCP_TOOL_CANVAS_UPDATE_NODE,\n\tMCP_TOOL_CANVAS_LAYOUT,\n\tMCP_TOOL_CANVAS_SELECT,\n\tMCP_TOOL_CANVAS_HIGHLIGHT\n] as const;\n\n/** Per-operation prompt tools, the strict alternative to `edit_prompt`. */\nexport const EDITOR_PROMPT_TOOLS = [\n\tMCP_TOOL_PROMPT_INSERT_TEXT,\n\tMCP_TOOL_PROMPT_REPLACE_RANGE,\n\tMCP_TOOL_PROMPT_SET_VARIABLE,\n\tMCP_TOOL_PROMPT_SELECT\n] as const;\n\n/**\n * Arguments each `edit_canvas` / `edit_prompt` operation needs, used to tell\n * an agent exactly what is missing (the combined schemas cannot express it).\n */\nexport const EDIT_OPERATION_REQUIRED_ARGUMENTS: Readonly<Record<'edit_canvas' | 'edit_prompt', Readonly<Record<string, readonly string[]>>>> = {\n\tedit_canvas: {\n\t\tadd_node: ['node'],\n\t\tremove_nodes: ['nodeIds'],\n\t\tconnect: ['source', 'target'],\n\t\tupdate_node: ['id'],\n\t\tlayout: [],\n\t\tselect: ['nodeIds'],\n\t\thighlight: ['nodeIds']\n\t},\n\tedit_prompt: {\n\t\tinsert_text: ['text'],\n\t\treplace_range: ['from', 'to', 'text'],\n\t\tset_variable: ['name'],\n\t\tselect: ['from', 'to']\n\t}\n};\n\n/**\n * CSS selectors for ephemeral UI overlays (such as agent cursors, presence tags, and transient bubbles)\n * that should be excluded during canvas image export and visual snapshot generation.\n */\nexport const EXPORT_EXCLUDED_SELECTORS = [\n\t'.pixerate-presence',\n\t'.agent-presence',\n\t'.ursula-presence'\n] as const;\n\nexport const EDITOR_MCP_TOOLS = [\n\tMCP_TOOL_GET_EDITOR_STATE,\n\tMCP_TOOL_EDIT_CANVAS,\n\tMCP_TOOL_EDIT_PROMPT,\n\tMCP_TOOL_VIEW_EDITOR\n] as const;\n\n","import type { CaptureFormat, CaptureRect, CaptureSurface, CapturedImage } from './capture.js';\nimport { EXPORT_EXCLUDED_SELECTORS } from './definitions.js';\n\nexport interface RasterizeElementOptions {\n\t/** CSS size of the drawn box (default: the element's client size). */\n\twidth?: number;\n\theight?: number;\n\t/** Output size in pixels (default: the CSS size). */\n\tpixelWidth?: number;\n\tpixelHeight?: number;\n\tformat?: CaptureFormat;\n\t/** JPEG quality, 0-1 (default 0.85). */\n\tquality?: number;\n\t/** Fill behind the element (default: its computed background, else white for JPEG and transparent for PNG). */\n\tbackground?: string;\n\t/** Selectors of elements (and their subtrees) to leave out. */\n\texclude?: readonly string[];\n\t/** Adjusts the styled clone before it is drawn (e.g. moves a viewport transform). */\n\tprepare?: (clone: HTMLElement) => void;\n}\n\nconst NO_DOM =\n\t'Capturing needs a browser DOM (document, Image, XMLSerializer and a 2D canvas); it is not available in this environment.';\n\nconst SKIPPED_TAGS = new Set(['SCRIPT', 'NOSCRIPT', 'TEMPLATE', 'LINK', 'META', 'STYLE']);\n\nfunction styleText(style: CSSStyleDeclaration): string {\n\tlet text = '';\n\tfor (let i = 0; i < style.length; i++) {\n\t\tconst name = style[i];\n\t\tconst priority = style.getPropertyPriority(name);\n\t\ttext += `${name}:${style.getPropertyValue(name)}${priority ? ` !${priority}` : ''};`;\n\t}\n\treturn text;\n}\n\nfunction imageSnapshot(source: HTMLCanvasElement | HTMLImageElement, doc: Document): string | null {\n\ttry {\n\t\tif (source.tagName === 'CANVAS') return (source as HTMLCanvasElement).toDataURL('image/png');\n\t\tconst img = source as HTMLImageElement;\n\t\tif (!img.complete || !img.naturalWidth || img.src.startsWith('data:')) return null;\n\t\tconst canvas = doc.createElement('canvas');\n\t\tcanvas.width = img.naturalWidth;\n\t\tcanvas.height = img.naturalHeight;\n\t\tconst context = canvas.getContext('2d');\n\t\tif (!context) return null;\n\t\tcontext.drawImage(img, 0, 0);\n\t\treturn canvas.toDataURL('image/png');\n\t} catch {\n\t\t// Cross-origin pixels taint the canvas; the image is drawn blank instead.\n\t\treturn null;\n\t}\n}\n\n/**\n * Deep-clones `element` with every computed style inlined, so the copy looks\n * the same outside the page's stylesheets (inside an SVG `<foreignObject>`).\n * Elements matching `exclude` are left out, canvases become images, and\n * same-origin images and form values are copied in.\n */\nexport function cloneElementWithStyles(element: Element, exclude: readonly string[] = []): HTMLElement {\n\tconst doc = element.ownerDocument;\n\tconst view = doc.defaultView;\n\tif (!view) throw new Error(NO_DOM);\n\tconst selector = exclude.join(',');\n\tconst copy = (source: Node): Node | null => {\n\t\tif (source.nodeType === 3) return source.cloneNode(false);\n\t\tif (source.nodeType !== 1) return null;\n\t\tconst el = source as Element;\n\t\tif (SKIPPED_TAGS.has(el.tagName.toUpperCase()) || (selector && el.matches(selector))) return null;\n\t\tlet clone: Element;\n\t\tif (el.tagName === 'CANVAS') {\n\t\t\tclone = doc.createElement('img');\n\t\t\tconst url = imageSnapshot(el as HTMLCanvasElement, doc);\n\t\t\tif (url) clone.setAttribute('src', url);\n\t\t} else {\n\t\t\tclone = el.cloneNode(false) as Element;\n\t\t\tif (el.tagName === 'IMG') {\n\t\t\t\tconst url = imageSnapshot(el as HTMLImageElement, doc);\n\t\t\t\tif (url) clone.setAttribute('src', url);\n\t\t\t\tclone.removeAttribute('srcset');\n\t\t\t}\n\t\t}\n\t\tclone.setAttribute('style', styleText(view.getComputedStyle(el)));\n\t\tif (el.tagName === 'INPUT') {\n\t\t\tconst input = el as HTMLInputElement;\n\t\t\tclone.setAttribute('value', input.value);\n\t\t\tif (input.checked) clone.setAttribute('checked', '');\n\t\t\telse clone.removeAttribute('checked');\n\t\t} else if (el.tagName === 'TEXTAREA') {\n\t\t\tclone.textContent = (el as HTMLTextAreaElement).value;\n\t\t\treturn clone;\n\t\t} else if (el.tagName === 'SELECT') {\n\t\t\t// Options are copied below; mark the chosen one.\n\t\t\tconst value = (el as HTMLSelectElement).value;\n\t\t\tfor (const child of Array.from(el.childNodes)) {\n\t\t\t\tconst option = copy(child);\n\t\t\t\tif (option && (option as Element).tagName === 'OPTION' && (option as HTMLOptionElement).value === value) {\n\t\t\t\t\t(option as Element).setAttribute('selected', '');\n\t\t\t\t}\n\t\t\t\tif (option) clone.appendChild(option);\n\t\t\t}\n\t\t\treturn clone;\n\t\t}\n\t\tfor (const child of Array.from(el.childNodes)) {\n\t\t\tconst next = copy(child);\n\t\t\tif (next) clone.appendChild(next);\n\t\t}\n\t\treturn clone;\n\t};\n\tconst root = copy(element);\n\tif (!root) throw new Error('The element to capture is excluded by the exclude selectors.');\n\treturn root as HTMLElement;\n}\n\n/** Wraps a styled clone in a standalone SVG of `width` × `height` CSS pixels. */\nexport function elementToSvg(clone: Element, width: number, height: number): string {\n\tconst doc = clone.ownerDocument;\n\tconst Serializer = (doc.defaultView as (Window & typeof globalThis) | null)?.XMLSerializer ?? (globalThis as { XMLSerializer?: typeof XMLSerializer }).XMLSerializer;\n\tif (!Serializer) throw new Error(NO_DOM);\n\tclone.setAttribute('xmlns', 'http://www.w3.org/1999/xhtml');\n\tconst xml = new Serializer().serializeToString(clone);\n\treturn (\n\t\t`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${width}\" height=\"${height}\" viewBox=\"0 0 ${width} ${height}\">` +\n\t\t`<foreignObject x=\"0\" y=\"0\" width=\"100%\" height=\"100%\">${xml}</foreignObject></svg>`\n\t);\n}\n\n/**\n * Draws a DOM element into an image in the browser: its styled clone goes\n * into an SVG `<foreignObject>`, which is drawn onto a canvas. Web fonts that\n * are not installed locally fall back, pseudo-elements (`::before`) are not\n * drawn, and cross-origin images come out blank. Returns a `data:` URL.\n */\nexport async function rasterizeElement(element: HTMLElement, options: RasterizeElementOptions = {}): Promise<string> {\n\tconst doc = element.ownerDocument;\n\tconst view = doc?.defaultView as (Window & typeof globalThis) | null;\n\tif (!view?.Image) throw new Error(NO_DOM);\n\tconst width = Math.max(1, Math.round(options.width ?? element.clientWidth));\n\tconst height = Math.max(1, Math.round(options.height ?? element.clientHeight));\n\tconst pixelWidth = Math.max(1, Math.round(options.pixelWidth ?? width));\n\tconst pixelHeight = Math.max(1, Math.round(options.pixelHeight ?? height));\n\tconst format = options.format ?? 'png';\n\n\tconst clone = cloneElementWithStyles(element, options.exclude);\n\tconst background = options.background ?? view.getComputedStyle(element).backgroundColor;\n\tclone.style.width = `${width}px`;\n\tclone.style.height = `${height}px`;\n\tclone.style.margin = '0';\n\tclone.style.position = 'relative';\n\tclone.style.left = '0';\n\tclone.style.top = '0';\n\tclone.style.transform = 'none';\n\tclone.style.overflow = 'hidden';\n\toptions.prepare?.(clone);\n\tconst svg = elementToSvg(clone, width, height);\n\n\tconst canvas = doc.createElement('canvas');\n\tcanvas.width = pixelWidth;\n\tcanvas.height = pixelHeight;\n\tlet context: CanvasRenderingContext2D | null = null;\n\ttry {\n\t\tcontext = canvas.getContext('2d');\n\t} catch {\n\t\tcontext = null;\n\t}\n\tif (!context) throw new Error(NO_DOM);\n\tconst image = new view.Image();\n\tawait new Promise<void>((resolve, reject) => {\n\t\timage.onload = () => resolve();\n\t\timage.onerror = () => reject(new Error('The captured view could not be drawn as an image.'));\n\t\timage.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;\n\t});\n\tconst transparent = !background || background === 'transparent' || /rgba\\([^)]*,\\s*0\\)$/.test(background);\n\tif (!transparent || format === 'jpeg') {\n\t\tcontext.fillStyle = transparent ? '#ffffff' : background;\n\t\tcontext.fillRect(0, 0, pixelWidth, pixelHeight);\n\t}\n\tcontext.drawImage(image, 0, 0, pixelWidth, pixelHeight);\n\ttry {\n\t\treturn canvas.toDataURL(format === 'jpeg' ? 'image/jpeg' : 'image/png', options.quality ?? 0.85);\n\t} catch {\n\t\tthrow new Error('The browser refused to export the captured view (the canvas is tainted by cross-origin content).');\n\t}\n}\n\nexport interface ElementCaptureSurfaceOptions {\n\t/** The element to capture, or a getter (re-read on every call). */\n\telement: HTMLElement | null | undefined | (() => HTMLElement | null | undefined);\n\t/** Selectors left out of every capture (default none). */\n\texclude?: readonly string[];\n\t/** Selectors of transient overlays, left out unless `includeOverlays` (default `CAPTURE_OVERLAY_SELECTORS`). */\n\toverlaySelectors?: readonly string[];\n\t/** Fill behind the element (default its computed background). */\n\tbackground?: string;\n\t/** Swaps the drawing step (tests, or a library such as html-to-image). */\n\trasterize?: (element: HTMLElement, options: RasterizeElementOptions) => Promise<CapturedImage>;\n}\n\n/** Overlays left out of captures by default: agent cursors and presence tags. */\nexport const CAPTURE_OVERLAY_SELECTORS: readonly string[] = [...EXPORT_EXCLUDED_SELECTORS, '[data-capture=\"overlay\"]'];\n\n/** Elements marked `data-capture=\"exclude\"` are never captured. */\nexport const CAPTURE_EXCLUDE_SELECTOR = '[data-capture=\"exclude\"]';\n\n/**\n * A capture surface for any DOM element (a rich-text editor, a spreadsheet, a\n * panel): units are CSS pixels from the element's top-left corner; `viewport`\n * is its visible box and `content` its full scrollable area.\n */\nexport function createElementCaptureSurface(options: ElementCaptureSurfaceOptions): CaptureSurface {\n\tconst getElement = () => (typeof options.element === 'function' ? options.element() : options.element) ?? null;\n\tconst require = () => {\n\t\tconst el = getElement();\n\t\tif (!el || !el.isConnected) throw new Error('The view is not mounted, so there is nothing to capture.');\n\t\treturn el;\n\t};\n\tconst visible = (): CaptureRect | null => {\n\t\tconst el = getElement();\n\t\tif (!el || !el.clientWidth || !el.clientHeight) return null;\n\t\treturn { x: el.scrollLeft, y: el.scrollTop, width: el.clientWidth, height: el.clientHeight };\n\t};\n\tconst overlays = options.overlaySelectors ?? CAPTURE_OVERLAY_SELECTORS;\n\treturn {\n\t\tunits: 'CSS pixels',\n\t\tviewport: visible,\n\t\tcontent: () => {\n\t\t\tconst el = getElement();\n\t\t\tif (!el || !el.scrollWidth || !el.scrollHeight) return null;\n\t\t\treturn { x: 0, y: 0, width: el.scrollWidth, height: el.scrollHeight };\n\t\t},\n\t\toverlays: 'agent cursors and presence tags',\n\t\tmaxScale: 2,\n\t\trender: (request) => {\n\t\t\tconst el = require();\n\t\t\tconst exclude = [CAPTURE_EXCLUDE_SELECTOR, ...(options.exclude ?? []), ...(request.includeOverlays ? [] : overlays)];\n\t\t\tconst rasterize = options.rasterize ?? rasterizeElement;\n\t\t\treturn rasterize(el, {\n\t\t\t\twidth: request.rect.width,\n\t\t\t\theight: request.rect.height,\n\t\t\t\tpixelWidth: request.width,\n\t\t\t\tpixelHeight: request.height,\n\t\t\t\tformat: request.format,\n\t\t\t\tquality: request.quality,\n\t\t\t\tbackground: options.background,\n\t\t\t\texclude,\n\t\t\t\t// Scrolling does not survive cloning: shift the content so the rect's corner is at the top left.\n\t\t\t\tprepare: (clone) => {\n\t\t\t\t\tconst shift = `translate(${-request.rect.x}px, ${-request.rect.y}px)`;\n\t\t\t\t\tconst inner = clone.ownerDocument.createElement('div');\n\t\t\t\t\tinner.setAttribute('style', `transform:${shift};transform-origin:0 0;width:${el.scrollWidth}px;height:${el.scrollHeight}px`);\n\t\t\t\t\twhile (clone.firstChild) inner.appendChild(clone.firstChild);\n\t\t\t\t\tclone.appendChild(inner);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t};\n}\n"],"mappings":";AAKO,IAAM,4BAA4B;AAAA,EACxC,MAAM;AAAA,EACN,OAAO;AAAA,EACP,aAAa;AAAA,IACZ,OAAO;AAAA,IACP,cAAc;AAAA,IACd,iBAAiB;AAAA,IACjB,gBAAgB;AAAA,IAChB,eAAe;AAAA,EAChB;AAAA,EACA,aACC;AAAA,EACD,aAAa;AAAA,IACZ,MAAM;AAAA,IACN,YAAY;AAAA,MACX,iBAAiB;AAAA,QAChB,MAAM;AAAA,QACN,aAAa;AAAA,MACd;AAAA,MACA,eAAe;AAAA,QACd,MAAM;AAAA,QACN,aAAa;AAAA,MACd;AAAA,IACD;AAAA,EACD;AACD;AAEO,IAAM,uBAAuB;AAAA,EACnC,MAAM;AAAA,EACN,OAAO;AAAA,EACP,aAAa;AAAA,IACZ,OAAO;AAAA,IACP,cAAc;AAAA,IACd,iBAAiB;AAAA,IACjB,gBAAgB;AAAA,IAChB,eAAe;AAAA,EAChB;AAAA,EACA,aACC;AAAA,EAED,aAAa;AAAA,IACZ,MAAM;AAAA,IACN,YAAY;AAAA,MACX,WAAW;AAAA,QACV,MAAM;AAAA,QACN,MAAM;AAAA,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N,OAAO;AAAA,IACP,UAAU;AAAA,IACV,SAAS,MAAM;AACd,YAAM,KAAK,WAAW;AACtB,UAAI,CAAC,MAAM,CAAC,GAAG,eAAe,CAAC,GAAG,aAAc,QAAO;AACvD,aAAO,EAAE,GAAG,GAAG,GAAG,GAAG,OAAO,GAAG,aAAa,QAAQ,GAAG,aAAa;AAAA,IACrE;AAAA,IACA,UAAU;AAAA,IACV,UAAU;AAAA,IACV,QAAQ,CAAC,YAAY;AACpB,YAAM,KAAKA,SAAQ;AACnB,YAAM,UAAU,CAAC,0BAA0B,GAAI,QAAQ,WAAW,CAAC,GAAI,GAAI,QAAQ,kBAAkB,CAAC,IAAI,QAAS;AACnH,YAAM,YAAY,QAAQ,aAAa;AACvC,aAAO,UAAU,IAAI;AAAA,QACpB,OAAO,QAAQ,KAAK;AAAA,QACpB,QAAQ,QAAQ,KAAK;AAAA,QACrB,YAAY,QAAQ;AAAA,QACpB,aAAa,QAAQ;AAAA,QACrB,QAAQ,QAAQ;AAAA,QAChB,SAAS,QAAQ;AAAA,QACjB,YAAY,QAAQ;AAAA,QACpB;AAAA;AAAA,QAEA,SAAS,CAAC,UAAU;AACnB,gBAAM,QAAQ,aAAa,CAAC,QAAQ,KAAK,CAAC,OAAO,CAAC,QAAQ,KAAK,CAAC;AAChE,gBAAM,QAAQ,MAAM,cAAc,cAAc,KAAK;AACrD,gBAAM,aAAa,SAAS,aAAa,KAAK,+BAA+B,GAAG,WAAW,aAAa,GAAG,YAAY,IAAI;AAC3H,iBAAO,MAAM,WAAY,OAAM,YAAY,MAAM,UAAU;AAC3D,gBAAM,YAAY,KAAK;AAAA,QACxB;AAAA,MACD,CAAC;AAAA,IACF;AAAA,EACD;AACD;","names":["require"]}
@@ -0,0 +1,201 @@
1
+ // src/tools/capture.ts
2
+ function unionCaptureRects(rects) {
3
+ let minX = Infinity;
4
+ let minY = Infinity;
5
+ let maxX = -Infinity;
6
+ let maxY = -Infinity;
7
+ for (const r of rects) {
8
+ if (!r) continue;
9
+ minX = Math.min(minX, r.x);
10
+ minY = Math.min(minY, r.y);
11
+ maxX = Math.max(maxX, r.x + r.width);
12
+ maxY = Math.max(maxY, r.y + r.height);
13
+ }
14
+ return minX === Infinity ? null : { x: minX, y: minY, width: maxX - minX, height: maxY - minY };
15
+ }
16
+ function captureOutputSize(rect, maxEdge, maxScale = 2) {
17
+ const longest = Math.max(rect.width, rect.height);
18
+ const scale = Math.min(maxScale, maxEdge / longest);
19
+ return {
20
+ width: Math.max(1, Math.round(rect.width * scale)),
21
+ height: Math.max(1, Math.round(rect.height * scale)),
22
+ scale
23
+ };
24
+ }
25
+ function toCapturedImageData(image, fallbackMimeType) {
26
+ if (typeof image !== "string") return image;
27
+ if (!image.startsWith("data:")) return { data: image, mimeType: fallbackMimeType };
28
+ const match = /^data:([^;,]*)(?:;[^,]*)?,(.*)$/s.exec(image);
29
+ if (!match?.[1] || !match[2]) throw new Error("The surface returned an empty image; rendering may not be available in this environment.");
30
+ return { data: match[2], mimeType: match[1] };
31
+ }
32
+ var round = (n) => Math.round(n * 100) / 100;
33
+ var roundRect = (r) => ({ x: round(r.x), y: round(r.y), width: round(r.width), height: round(r.height) });
34
+ var pad = (r, p) => ({ x: r.x - p, y: r.y - p, width: r.width + 2 * p, height: r.height + 2 * p });
35
+ function regionsOf(surface) {
36
+ return [
37
+ ...surface.viewport ? ["viewport"] : [],
38
+ "content",
39
+ ...surface.selection ? ["selection"] : [],
40
+ ...surface.items ? [surface.items.region] : [],
41
+ "rect"
42
+ ];
43
+ }
44
+ function captureInputSchema(surface, options = {}) {
45
+ const regions = regionsOf(surface);
46
+ const units = surface.units;
47
+ const properties = {
48
+ region: {
49
+ type: "string",
50
+ enum: regions,
51
+ description: `What to capture (default ${regions[0]}): ` + [
52
+ surface.viewport ? '"viewport" is what is on screen now' : "",
53
+ '"content" is everything',
54
+ surface.selection ? '"selection" is the selected items' : "",
55
+ surface.items ? `"${surface.items.region}" is the ${surface.items.noun}s in "ids"` : "",
56
+ `"rect" is the area in "rect"`
57
+ ].filter(Boolean).join(", ") + "."
58
+ },
59
+ ...surface.items ? {
60
+ ids: {
61
+ type: "array",
62
+ items: { type: "string" },
63
+ minItems: 1,
64
+ description: `With region "${surface.items.region}": ids of the ${surface.items.noun}s to frame${surface.items.source ? ` (from ${surface.items.source})` : ""}.`
65
+ }
66
+ } : {},
67
+ rect: {
68
+ type: "object",
69
+ properties: {
70
+ x: { type: "number", description: `Left edge in ${units}.` },
71
+ y: { type: "number", description: `Top edge in ${units}.` },
72
+ width: { type: "number", exclusiveMinimum: 0, description: `Width in ${units}.` },
73
+ height: { type: "number", exclusiveMinimum: 0, description: `Height in ${units}.` }
74
+ },
75
+ required: ["x", "y", "width", "height"],
76
+ additionalProperties: false,
77
+ description: `With region "rect": the area to capture, in ${units}.`
78
+ },
79
+ padding: {
80
+ type: "number",
81
+ minimum: 0,
82
+ description: `Margin around content, selection${surface.items ? ` and ${surface.items.region}` : ""} regions, in ${units} (default ${options.defaultPadding ?? 16}).`
83
+ },
84
+ maxEdge: {
85
+ type: "integer",
86
+ minimum: 64,
87
+ maximum: 4096,
88
+ description: `Longest side of the image in pixels (default ${options.defaultMaxEdge ?? 1024}). Small regions are not enlarged beyond ${surface.maxScale ?? 2} pixels per unit.`
89
+ },
90
+ format: { type: "string", enum: ["png", "jpeg"], description: "Image format (default png; jpeg is smaller for photos)." },
91
+ quality: { type: "number", minimum: 0.1, maximum: 1, description: "JPEG quality from 0.1 to 1 (default 0.85). Ignored for png." },
92
+ ...surface.overlays ? { includeOverlays: { type: "boolean", description: `Also draw ${surface.overlays} (default false).` } } : {}
93
+ };
94
+ return { type: "object", properties, additionalProperties: false };
95
+ }
96
+ function resolveCaptureRequest(surface, args, options = {}) {
97
+ const regions = regionsOf(surface);
98
+ const region = args.region ?? regions[0];
99
+ if (!regions.includes(region)) throw new Error(`Unknown region "${region}". Use one of: ${regions.join(", ")}.`);
100
+ if (args.rect !== void 0 && region !== "rect") throw new Error(`"rect" only applies with region "rect"; drop it or set region to "rect".`);
101
+ if (args.ids !== void 0 && region !== surface.items?.region) {
102
+ throw new Error(`"ids" only applies with region "${surface.items?.region ?? "items"}"; drop it or change the region.`);
103
+ }
104
+ const padding = typeof args.padding === "number" ? args.padding : options.defaultPadding ?? 16;
105
+ let rect;
106
+ let ids;
107
+ if (region === "viewport") {
108
+ rect = surface.viewport();
109
+ if (!rect) throw new Error('The view is not on screen (not mounted or zero size). Use region "content" instead.');
110
+ } else if (region === "content") {
111
+ const content = surface.content();
112
+ if (!content) throw new Error("There is nothing to capture: the surface is empty.");
113
+ rect = pad(content, padding);
114
+ } else if (region === "selection") {
115
+ const selection = surface.selection();
116
+ if (!selection.rect) throw new Error('Nothing is selected. Select something first, or use region "content".');
117
+ rect = pad(selection.rect, padding);
118
+ ids = selection.ids;
119
+ } else if (region === "rect") {
120
+ if (!args.rect) throw new Error(`Region "rect" needs "rect": {"x", "y", "width", "height"} in ${surface.units}.`);
121
+ rect = { x: args.rect.x, y: args.rect.y, width: args.rect.width, height: args.rect.height };
122
+ } else {
123
+ const items = surface.items;
124
+ const wanted = Array.isArray(args.ids) ? args.ids : [];
125
+ if (!wanted.length) throw new Error(`Region "${items.region}" needs "ids": the ${items.noun} ids to frame.`);
126
+ const found = items.bounds(wanted);
127
+ if (found.missing.length) {
128
+ throw new Error(
129
+ `Unknown ${items.noun} id(s): ${found.missing.join(", ")}.${items.source ? ` Read the current ids with ${items.source}.` : ""}`
130
+ );
131
+ }
132
+ if (!found.rect) throw new Error(`The ${items.noun}s ${wanted.join(", ")} have no size yet; try again once they are drawn.`);
133
+ rect = pad(found.rect, padding);
134
+ ids = wanted;
135
+ }
136
+ if (!(rect.width > 0) || !(rect.height > 0)) {
137
+ throw new Error(`The ${region} region is empty (${rect.width} \xD7 ${rect.height} ${surface.units}); capture a larger area.`);
138
+ }
139
+ const maxEdge = typeof args.maxEdge === "number" ? args.maxEdge : options.defaultMaxEdge ?? 1024;
140
+ const size = captureOutputSize(rect, maxEdge, surface.maxScale ?? 2);
141
+ return {
142
+ region,
143
+ rect,
144
+ ...size,
145
+ format: args.format === "jpeg" ? "jpeg" : "png",
146
+ quality: typeof args.quality === "number" ? args.quality : 0.85,
147
+ includeOverlays: !!surface.overlays && args.includeOverlays === true,
148
+ ...ids ? { ids } : {}
149
+ };
150
+ }
151
+ function createCaptureTool(surface, options = {}) {
152
+ const title = options.title ?? "Capture a screenshot";
153
+ const subject = options.subject ?? "the view";
154
+ return {
155
+ name: options.name ?? "capture_view",
156
+ title,
157
+ description: `Takes a screenshot of ${subject} so you can check how it looks, without changing anything. Captures the ${regionsOf(surface).join(", ")} region and returns the image plus the captured rect (in ${surface.units}) and the pixel scale, so a point (px, py) in the image is at (rect.x + px / scale, rect.y + py / scale).` + (surface.overlays ? ` Transient overlays (${surface.overlays}) are left out unless includeOverlays is true.` : ""),
158
+ inputSchema: captureInputSchema(surface, options),
159
+ annotations: { title, readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
160
+ handler: async (args, context) => {
161
+ const { ids, ...request } = resolveCaptureRequest(surface, args, options);
162
+ const mimeType = request.format === "jpeg" ? "image/jpeg" : "image/png";
163
+ const image = toCapturedImageData(await surface.render({ ...request, signal: context.signal }), mimeType);
164
+ const rect = roundRect(request.rect);
165
+ const meta = {
166
+ region: request.region,
167
+ rect,
168
+ units: surface.units,
169
+ width: request.width,
170
+ height: request.height,
171
+ scale: round(request.scale),
172
+ mimeType: image.mimeType,
173
+ ...ids ? { ids } : {}
174
+ };
175
+ return {
176
+ content: [
177
+ { type: "image", data: image.data, mimeType: image.mimeType },
178
+ {
179
+ type: "text",
180
+ text: `Captured ${request.region} at ${request.width}\xD7${request.height} px: x ${rect.x}, y ${rect.y}, ${rect.width}\xD7${rect.height} ${surface.units} (${meta.scale} px per unit).`
181
+ }
182
+ ],
183
+ structuredContent: meta
184
+ };
185
+ }
186
+ };
187
+ }
188
+ function createCaptureToolProvider(surface, options = {}) {
189
+ return { id: options.id ?? "capture", namespace: options.namespace, tools: [createCaptureTool(surface, options)] };
190
+ }
191
+
192
+ export {
193
+ unionCaptureRects,
194
+ captureOutputSize,
195
+ toCapturedImageData,
196
+ captureInputSchema,
197
+ resolveCaptureRequest,
198
+ createCaptureTool,
199
+ createCaptureToolProvider
200
+ };
201
+ //# sourceMappingURL=chunk-REOJJIY3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/tools/capture.ts"],"sourcesContent":["import type { AgentTool, AgentToolProvider, McpToolResult } from './registry.js';\nimport type { JsonSchema } from './schema.js';\n\n/** A rectangle in a surface's own units (canvas units, image pixels, CSS pixels). */\nexport interface CaptureRect {\n\tx: number;\n\ty: number;\n\twidth: number;\n\theight: number;\n}\n\n/**\n * What to capture: what is on screen (`viewport`), everything (`content`), the\n * selection, the bounds of some items by id (the surface's `items.region`,\n * e.g. `nodes`), or an explicit `rect`.\n */\nexport type CaptureRegion = 'viewport' | 'content' | 'selection' | 'rect' | (string & {});\n\nexport type CaptureFormat = 'png' | 'jpeg';\n\n/** What a surface is asked to draw. */\nexport interface CaptureRenderRequest {\n\t/** Region name the agent asked for. */\n\tregion: CaptureRegion;\n\t/** The area to draw, in surface units. */\n\trect: CaptureRect;\n\t/** Output size in pixels. */\n\twidth: number;\n\theight: number;\n\t/** Output pixels per surface unit (`width / rect.width`). */\n\tscale: number;\n\tformat: CaptureFormat;\n\t/** JPEG quality, 0-1. */\n\tquality: number;\n\t/** Draw selection boxes, presence cursors and other transient overlays too. */\n\tincludeOverlays: boolean;\n\tsignal?: AbortSignal;\n}\n\n/** A rendered image: base64 data with its MIME type, or a `data:` URL. */\nexport type CapturedImage = { data: string; mimeType: string } | string;\n\n/**\n * Something an agent can take a screenshot of. Bounds are in the surface's\n * own units; `render` draws a rectangle of it at a given pixel size.\n */\nexport interface CaptureSurface {\n\t/** Name of the coordinate space, used in the tool description and results (e.g. `canvas units`). */\n\tunits: string;\n\t/** What is on screen now. Omit when the surface has no viewport. */\n\tviewport?: () => CaptureRect | null;\n\t/** Bounds of everything, or `null` when the surface is empty. */\n\tcontent: () => CaptureRect | null;\n\t/** Bounds of the selection (`null` when nothing is selected) and the selected ids. */\n\tselection?: () => { rect: CaptureRect | null; ids?: string[] };\n\t/** Capture by item ids, e.g. canvas nodes. */\n\titems?: {\n\t\t/** Region name, e.g. `nodes`. */\n\t\tregion: string;\n\t\t/** Singular noun for messages, e.g. `node`. */\n\t\tnoun: string;\n\t\t/** Where the ids come from, for error messages (e.g. `get_editor_state`). */\n\t\tsource?: string;\n\t\t/** Bounds of the found items and the ids that were not found. */\n\t\tbounds: (ids: string[]) => { rect: CaptureRect | null; missing: string[] };\n\t};\n\t/** Describes the overlays `includeOverlays` adds; omit when the surface has none. */\n\toverlays?: string;\n\t/** Largest output pixels per surface unit (default 2). */\n\tmaxScale?: number;\n\trender: (request: CaptureRenderRequest) => CapturedImage | Promise<CapturedImage>;\n}\n\nexport interface CaptureToolOptions {\n\t/** Tool name (default `capture_view`). */\n\tname?: string;\n\t/** Tool title (default `Capture a screenshot`). */\n\ttitle?: string;\n\t/** What is being captured, for the description (default `the view`). */\n\tsubject?: string;\n\t/** Longest output side when the agent passes no `maxEdge` (default 1024). */\n\tdefaultMaxEdge?: number;\n\t/** Margin around `content`, `selection` and item regions when the agent passes no `padding` (default 16 units). */\n\tdefaultPadding?: number;\n}\n\nexport interface CaptureToolProviderOptions extends CaptureToolOptions {\n\t/** Provider id (unique per registry, default `capture`). */\n\tid?: string;\n\t/** Always prefix tool names with `<namespace>__`. */\n\tnamespace?: string;\n}\n\n/** Bounds of the capture: union of rects, `null` for none. */\nexport function unionCaptureRects(rects: readonly (CaptureRect | null | undefined)[]): CaptureRect | null {\n\tlet minX = Infinity;\n\tlet minY = Infinity;\n\tlet maxX = -Infinity;\n\tlet maxY = -Infinity;\n\tfor (const r of rects) {\n\t\tif (!r) continue;\n\t\tminX = Math.min(minX, r.x);\n\t\tminY = Math.min(minY, r.y);\n\t\tmaxX = Math.max(maxX, r.x + r.width);\n\t\tmaxY = Math.max(maxY, r.y + r.height);\n\t}\n\treturn minX === Infinity ? null : { x: minX, y: minY, width: maxX - minX, height: maxY - minY };\n}\n\n/**\n * Output pixel size for `rect`: the longest side at most `maxEdge`, never more\n * than `maxScale` pixels per unit, at least 1 × 1.\n */\nexport function captureOutputSize(rect: CaptureRect, maxEdge: number, maxScale = 2): { width: number; height: number; scale: number } {\n\tconst longest = Math.max(rect.width, rect.height);\n\tconst scale = Math.min(maxScale, maxEdge / longest);\n\treturn {\n\t\twidth: Math.max(1, Math.round(rect.width * scale)),\n\t\theight: Math.max(1, Math.round(rect.height * scale)),\n\t\tscale\n\t};\n}\n\n/** Splits a `data:` URL or plain base64 into base64 data and MIME type. */\nexport function toCapturedImageData(image: CapturedImage, fallbackMimeType: string): { data: string; mimeType: string } {\n\tif (typeof image !== 'string') return image;\n\tif (!image.startsWith('data:')) return { data: image, mimeType: fallbackMimeType };\n\tconst match = /^data:([^;,]*)(?:;[^,]*)?,(.*)$/s.exec(image);\n\tif (!match?.[1] || !match[2]) throw new Error('The surface returned an empty image; rendering may not be available in this environment.');\n\treturn { data: match[2], mimeType: match[1] };\n}\n\nconst round = (n: number) => Math.round(n * 100) / 100;\nconst roundRect = (r: CaptureRect): CaptureRect => ({ x: round(r.x), y: round(r.y), width: round(r.width), height: round(r.height) });\nconst pad = (r: CaptureRect, p: number): CaptureRect => ({ x: r.x - p, y: r.y - p, width: r.width + 2 * p, height: r.height + 2 * p });\n\nfunction regionsOf(surface: CaptureSurface): string[] {\n\treturn [\n\t\t...(surface.viewport ? ['viewport'] : []),\n\t\t'content',\n\t\t...(surface.selection ? ['selection'] : []),\n\t\t...(surface.items ? [surface.items.region] : []),\n\t\t'rect'\n\t];\n}\n\n/** JSON Schema of the capture tool's arguments for a surface (only the options it supports). */\nexport function captureInputSchema(surface: CaptureSurface, options: CaptureToolOptions = {}): JsonSchema & { type: 'object' } {\n\tconst regions = regionsOf(surface);\n\tconst units = surface.units;\n\tconst properties: Record<string, JsonSchema> = {\n\t\tregion: {\n\t\t\ttype: 'string',\n\t\t\tenum: regions,\n\t\t\tdescription:\n\t\t\t\t`What to capture (default ${regions[0]}): ` +\n\t\t\t\t[\n\t\t\t\t\tsurface.viewport ? '\"viewport\" is what is on screen now' : '',\n\t\t\t\t\t'\"content\" is everything',\n\t\t\t\t\tsurface.selection ? '\"selection\" is the selected items' : '',\n\t\t\t\t\tsurface.items ? `\"${surface.items.region}\" is the ${surface.items.noun}s in \"ids\"` : '',\n\t\t\t\t\t`\"rect\" is the area in \"rect\"`\n\t\t\t\t]\n\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t.join(', ') +\n\t\t\t\t'.'\n\t\t},\n\t\t...(surface.items\n\t\t\t? {\n\t\t\t\t\tids: {\n\t\t\t\t\t\ttype: 'array',\n\t\t\t\t\t\titems: { type: 'string' },\n\t\t\t\t\t\tminItems: 1,\n\t\t\t\t\t\tdescription: `With region \"${surface.items.region}\": ids of the ${surface.items.noun}s to frame${surface.items.source ? ` (from ${surface.items.source})` : ''}.`\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t: {}),\n\t\trect: {\n\t\t\ttype: 'object',\n\t\t\tproperties: {\n\t\t\t\tx: { type: 'number', description: `Left edge in ${units}.` },\n\t\t\t\ty: { type: 'number', description: `Top edge in ${units}.` },\n\t\t\t\twidth: { type: 'number', exclusiveMinimum: 0, description: `Width in ${units}.` },\n\t\t\t\theight: { type: 'number', exclusiveMinimum: 0, description: `Height in ${units}.` }\n\t\t\t},\n\t\t\trequired: ['x', 'y', 'width', 'height'],\n\t\t\tadditionalProperties: false,\n\t\t\tdescription: `With region \"rect\": the area to capture, in ${units}.`\n\t\t},\n\t\tpadding: {\n\t\t\ttype: 'number',\n\t\t\tminimum: 0,\n\t\t\tdescription: `Margin around content, selection${surface.items ? ` and ${surface.items.region}` : ''} regions, in ${units} (default ${options.defaultPadding ?? 16}).`\n\t\t},\n\t\tmaxEdge: {\n\t\t\ttype: 'integer',\n\t\t\tminimum: 64,\n\t\t\tmaximum: 4096,\n\t\t\tdescription: `Longest side of the image in pixels (default ${options.defaultMaxEdge ?? 1024}). Small regions are not enlarged beyond ${surface.maxScale ?? 2} pixels per unit.`\n\t\t},\n\t\tformat: { type: 'string', enum: ['png', 'jpeg'], description: 'Image format (default png; jpeg is smaller for photos).' },\n\t\tquality: { type: 'number', minimum: 0.1, maximum: 1, description: 'JPEG quality from 0.1 to 1 (default 0.85). Ignored for png.' },\n\t\t...(surface.overlays\n\t\t\t? { includeOverlays: { type: 'boolean', description: `Also draw ${surface.overlays} (default false).` } }\n\t\t\t: {})\n\t};\n\treturn { type: 'object', properties, additionalProperties: false };\n}\n\n/**\n * Works out the rectangle and pixel size for a capture call, checking the\n * arguments against the surface. Throws an error that says how to fix the call.\n */\nexport function resolveCaptureRequest(\n\tsurface: CaptureSurface,\n\targs: Record<string, any>,\n\toptions: CaptureToolOptions = {}\n): Omit<CaptureRenderRequest, 'signal'> & { ids?: string[] } {\n\tconst regions = regionsOf(surface);\n\tconst region: string = args.region ?? regions[0];\n\tif (!regions.includes(region)) throw new Error(`Unknown region \"${region}\". Use one of: ${regions.join(', ')}.`);\n\tif (args.rect !== undefined && region !== 'rect') throw new Error(`\"rect\" only applies with region \"rect\"; drop it or set region to \"rect\".`);\n\tif (args.ids !== undefined && region !== surface.items?.region) {\n\t\tthrow new Error(`\"ids\" only applies with region \"${surface.items?.region ?? 'items'}\"; drop it or change the region.`);\n\t}\n\tconst padding = typeof args.padding === 'number' ? args.padding : (options.defaultPadding ?? 16);\n\tlet rect: CaptureRect | null;\n\tlet ids: string[] | undefined;\n\tif (region === 'viewport') {\n\t\trect = surface.viewport!();\n\t\tif (!rect) throw new Error('The view is not on screen (not mounted or zero size). Use region \"content\" instead.');\n\t} else if (region === 'content') {\n\t\tconst content = surface.content();\n\t\tif (!content) throw new Error('There is nothing to capture: the surface is empty.');\n\t\trect = pad(content, padding);\n\t} else if (region === 'selection') {\n\t\tconst selection = surface.selection!();\n\t\tif (!selection.rect) throw new Error('Nothing is selected. Select something first, or use region \"content\".');\n\t\trect = pad(selection.rect, padding);\n\t\tids = selection.ids;\n\t} else if (region === 'rect') {\n\t\tif (!args.rect) throw new Error(`Region \"rect\" needs \"rect\": {\"x\", \"y\", \"width\", \"height\"} in ${surface.units}.`);\n\t\trect = { x: args.rect.x, y: args.rect.y, width: args.rect.width, height: args.rect.height };\n\t} else {\n\t\tconst items = surface.items!;\n\t\tconst wanted = Array.isArray(args.ids) ? (args.ids as string[]) : [];\n\t\tif (!wanted.length) throw new Error(`Region \"${items.region}\" needs \"ids\": the ${items.noun} ids to frame.`);\n\t\tconst found = items.bounds(wanted);\n\t\tif (found.missing.length) {\n\t\t\tthrow new Error(\n\t\t\t\t`Unknown ${items.noun} id(s): ${found.missing.join(', ')}.${items.source ? ` Read the current ids with ${items.source}.` : ''}`\n\t\t\t);\n\t\t}\n\t\tif (!found.rect) throw new Error(`The ${items.noun}s ${wanted.join(', ')} have no size yet; try again once they are drawn.`);\n\t\trect = pad(found.rect, padding);\n\t\tids = wanted;\n\t}\n\tif (!(rect.width > 0) || !(rect.height > 0)) {\n\t\tthrow new Error(`The ${region} region is empty (${rect.width} × ${rect.height} ${surface.units}); capture a larger area.`);\n\t}\n\tconst maxEdge = typeof args.maxEdge === 'number' ? args.maxEdge : (options.defaultMaxEdge ?? 1024);\n\tconst size = captureOutputSize(rect, maxEdge, surface.maxScale ?? 2);\n\treturn {\n\t\tregion,\n\t\trect,\n\t\t...size,\n\t\tformat: args.format === 'jpeg' ? 'jpeg' : 'png',\n\t\tquality: typeof args.quality === 'number' ? args.quality : 0.85,\n\t\tincludeOverlays: !!surface.overlays && args.includeOverlays === true,\n\t\t...(ids ? { ids } : {})\n\t};\n}\n\n/**\n * The `capture_view` agent tool for a surface: renders a region as an image\n * the model can look at. The result has the image and a text block, and\n * `structuredContent` with the captured `rect` (surface units), the pixel\n * size and `scale`, so a point in the image maps back with\n * `x = rect.x + px / scale`.\n */\nexport function createCaptureTool(surface: CaptureSurface, options: CaptureToolOptions = {}): AgentTool {\n\tconst title = options.title ?? 'Capture a screenshot';\n\tconst subject = options.subject ?? 'the view';\n\treturn {\n\t\tname: options.name ?? 'capture_view',\n\t\ttitle,\n\t\tdescription:\n\t\t\t`Takes a screenshot of ${subject} so you can check how it looks, without changing anything. ` +\n\t\t\t`Captures the ${regionsOf(surface).join(', ')} region and returns the image plus the captured rect (in ${surface.units}) and the pixel scale, ` +\n\t\t\t'so a point (px, py) in the image is at (rect.x + px / scale, rect.y + py / scale).' +\n\t\t\t(surface.overlays ? ` Transient overlays (${surface.overlays}) are left out unless includeOverlays is true.` : ''),\n\t\tinputSchema: captureInputSchema(surface, options),\n\t\tannotations: { title, readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n\t\thandler: async (args, context): Promise<McpToolResult> => {\n\t\t\tconst { ids, ...request } = resolveCaptureRequest(surface, args, options);\n\t\t\tconst mimeType = request.format === 'jpeg' ? 'image/jpeg' : 'image/png';\n\t\t\tconst image = toCapturedImageData(await surface.render({ ...request, signal: context.signal }), mimeType);\n\t\t\tconst rect = roundRect(request.rect);\n\t\t\tconst meta = {\n\t\t\t\tregion: request.region,\n\t\t\t\trect,\n\t\t\t\tunits: surface.units,\n\t\t\t\twidth: request.width,\n\t\t\t\theight: request.height,\n\t\t\t\tscale: round(request.scale),\n\t\t\t\tmimeType: image.mimeType,\n\t\t\t\t...(ids ? { ids } : {})\n\t\t\t};\n\t\t\treturn {\n\t\t\t\tcontent: [\n\t\t\t\t\t{ type: 'image', data: image.data, mimeType: image.mimeType },\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\ttext: `Captured ${request.region} at ${request.width}×${request.height} px: x ${rect.x}, y ${rect.y}, ${rect.width}×${rect.height} ${surface.units} (${meta.scale} px per unit).`\n\t\t\t\t\t}\n\t\t\t\t],\n\t\t\t\tstructuredContent: meta\n\t\t\t};\n\t\t}\n\t};\n}\n\n/** A provider with just the `capture_view` tool for a surface. */\nexport function createCaptureToolProvider(surface: CaptureSurface, options: CaptureToolProviderOptions = {}): AgentToolProvider {\n\treturn { id: options.id ?? 'capture', namespace: options.namespace, tools: [createCaptureTool(surface, options)] };\n}\n"],"mappings":";AA8FO,SAAS,kBAAkB,OAAwE;AACzG,MAAI,OAAO;AACX,MAAI,OAAO;AACX,MAAI,OAAO;AACX,MAAI,OAAO;AACX,aAAW,KAAK,OAAO;AACtB,QAAI,CAAC,EAAG;AACR,WAAO,KAAK,IAAI,MAAM,EAAE,CAAC;AACzB,WAAO,KAAK,IAAI,MAAM,EAAE,CAAC;AACzB,WAAO,KAAK,IAAI,MAAM,EAAE,IAAI,EAAE,KAAK;AACnC,WAAO,KAAK,IAAI,MAAM,EAAE,IAAI,EAAE,MAAM;AAAA,EACrC;AACA,SAAO,SAAS,WAAW,OAAO,EAAE,GAAG,MAAM,GAAG,MAAM,OAAO,OAAO,MAAM,QAAQ,OAAO,KAAK;AAC/F;AAMO,SAAS,kBAAkB,MAAmB,SAAiB,WAAW,GAAqD;AACrI,QAAM,UAAU,KAAK,IAAI,KAAK,OAAO,KAAK,MAAM;AAChD,QAAM,QAAQ,KAAK,IAAI,UAAU,UAAU,OAAO;AAClD,SAAO;AAAA,IACN,OAAO,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,QAAQ,KAAK,CAAC;AAAA,IACjD,QAAQ,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,SAAS,KAAK,CAAC;AAAA,IACnD;AAAA,EACD;AACD;AAGO,SAAS,oBAAoB,OAAsB,kBAA8D;AACvH,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,MAAI,CAAC,MAAM,WAAW,OAAO,EAAG,QAAO,EAAE,MAAM,OAAO,UAAU,iBAAiB;AACjF,QAAM,QAAQ,mCAAmC,KAAK,KAAK;AAC3D,MAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,EAAG,OAAM,IAAI,MAAM,0FAA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