@pixerate/editor 0.140.4 → 0.142.1

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 (125) hide show
  1. package/dist/agent/canvasPlayback.d.cts +15 -0
  2. package/dist/agent/canvasPlayback.d.ts +15 -0
  3. package/dist/agent/index.cjs +173 -33
  4. package/dist/agent/index.d.cts +1 -0
  5. package/dist/agent/index.d.ts +1 -0
  6. package/dist/agent/index.js +147 -7
  7. package/dist/agent/providers.d.cts +12 -1
  8. package/dist/agent/providers.d.ts +12 -1
  9. package/dist/agent/types.d.cts +3 -0
  10. package/dist/agent/types.d.ts +3 -0
  11. package/dist/animation/index.cjs +2 -2
  12. package/dist/animation/index.js +1 -1
  13. package/dist/animation/presence.d.cts +1 -75
  14. package/dist/animation/presence.d.ts +1 -75
  15. package/dist/animation-editor/index.cjs +69 -19
  16. package/dist/animation-editor/index.d.cts +1 -0
  17. package/dist/animation-editor/index.d.ts +1 -0
  18. package/dist/animation-editor/index.js +54 -4
  19. package/dist/animation-editor/playback.d.cts +10 -0
  20. package/dist/animation-editor/playback.d.ts +10 -0
  21. package/dist/bridge/cli.cjs +3 -3
  22. package/dist/bridge/cli.js +2 -2
  23. package/dist/bridge/index.cjs +3 -3
  24. package/dist/bridge/index.js +2 -2
  25. package/dist/canvas/index.cjs +336 -646
  26. package/dist/canvas/index.d.cts +1 -0
  27. package/dist/canvas/index.d.ts +1 -0
  28. package/dist/canvas/index.js +44 -354
  29. package/dist/canvas/playback.d.cts +14 -0
  30. package/dist/canvas/playback.d.ts +14 -0
  31. package/dist/chart/index.cjs +255 -171
  32. package/dist/chart/index.d.cts +1 -0
  33. package/dist/chart/index.d.ts +1 -0
  34. package/dist/chart/index.js +244 -160
  35. package/dist/chart/playback.d.cts +22 -0
  36. package/dist/chart/playback.d.ts +22 -0
  37. package/dist/chunk-54GVEVXS.js +408 -0
  38. package/dist/{chunk-E747F3D5.js → chunk-CC6WKVIH.js} +86 -5
  39. package/dist/chunk-DW4CV5H4.js +591 -0
  40. package/dist/{chunk-UMS6YFA6.js → chunk-EAQ4BGNS.js} +1 -1
  41. package/dist/{chunk-AGCD3EHB.cjs → chunk-ENIZYNEF.cjs} +7 -7
  42. package/dist/{chunk-BSGPXPTW.js → chunk-PEEP2YR7.js} +1 -1
  43. package/dist/{chunk-VTY64I6H.cjs → chunk-QSM3MDDJ.cjs} +85 -85
  44. package/dist/{chunk-2RUNJYOX.cjs → chunk-QZFEX2N4.cjs} +86 -5
  45. package/dist/{chunk-RB62U6MS.js → chunk-RFBFTLVN.js} +27 -5
  46. package/dist/chunk-UBRYHNRU.cjs +591 -0
  47. package/dist/{chunk-GEY73RUW.cjs → chunk-UJGAA6AK.cjs} +1 -1
  48. package/dist/{chunk-LMSFXRAJ.js → chunk-VGJTUCWM.js} +1 -1
  49. package/dist/chunk-X2HQP7DF.cjs +408 -0
  50. package/dist/chunk-XH32BATE.cjs +68 -0
  51. package/dist/{chunk-HDK3T2QS.cjs → chunk-Y4BWZB6J.cjs} +29 -7
  52. package/dist/chunk-Y6SGC6KO.js +68 -0
  53. package/dist/commands/index.cjs +37 -1
  54. package/dist/commands/index.js +36 -0
  55. package/dist/commands/registry.d.cts +11 -0
  56. package/dist/commands/registry.d.ts +11 -0
  57. package/dist/diagram/index.cjs +7 -7
  58. package/dist/diagram/index.js +1 -1
  59. package/dist/image-editor/index.cjs +108 -16
  60. package/dist/image-editor/index.d.cts +1 -0
  61. package/dist/image-editor/index.d.ts +1 -0
  62. package/dist/image-editor/index.js +107 -15
  63. package/dist/image-editor/playback.d.cts +22 -0
  64. package/dist/image-editor/playback.d.ts +22 -0
  65. package/dist/index.cjs +7 -3
  66. package/dist/index.js +6 -2
  67. package/dist/paint-editor/index.cjs +73 -25
  68. package/dist/paint-editor/index.d.cts +1 -0
  69. package/dist/paint-editor/index.d.ts +1 -0
  70. package/dist/paint-editor/index.js +68 -20
  71. package/dist/paint-editor/playback.d.cts +16 -0
  72. package/dist/paint-editor/playback.d.ts +16 -0
  73. package/dist/parameters/index.cjs +32 -8
  74. package/dist/parameters/index.d.cts +1 -0
  75. package/dist/parameters/index.d.ts +1 -0
  76. package/dist/parameters/index.js +28 -4
  77. package/dist/parameters/playback.d.cts +10 -0
  78. package/dist/parameters/playback.d.ts +10 -0
  79. package/dist/spreadsheet/index.cjs +7 -3
  80. package/dist/spreadsheet/index.d.cts +1 -0
  81. package/dist/spreadsheet/index.d.ts +1 -0
  82. package/dist/spreadsheet/index.js +6 -2
  83. package/dist/spreadsheet/playback.d.cts +15 -0
  84. package/dist/spreadsheet/playback.d.ts +15 -0
  85. package/dist/tools/index.cjs +40 -3
  86. package/dist/tools/index.d.cts +3 -0
  87. package/dist/tools/index.d.ts +3 -0
  88. package/dist/tools/index.js +39 -2
  89. package/dist/tools/playback.d.cts +205 -0
  90. package/dist/tools/playback.d.ts +205 -0
  91. package/dist/tools/presence.d.cts +82 -0
  92. package/dist/tools/presence.d.ts +82 -0
  93. package/dist/tools/registry.d.cts +45 -6
  94. package/dist/tools/registry.d.ts +45 -6
  95. package/dist/tools/script.d.cts +77 -0
  96. package/dist/tools/script.d.ts +77 -0
  97. package/dist/tools/view.d.cts +2 -4
  98. package/dist/tools/view.d.ts +2 -4
  99. package/dist/vector/index.cjs +217 -100
  100. package/dist/vector/index.d.cts +1 -0
  101. package/dist/vector/index.d.ts +1 -0
  102. package/dist/vector/index.js +140 -23
  103. package/dist/vector/playback.d.cts +13 -0
  104. package/dist/vector/playback.d.ts +13 -0
  105. package/dist/video-editor/index.cjs +81 -28
  106. package/dist/video-editor/index.d.cts +1 -0
  107. package/dist/video-editor/index.d.ts +1 -0
  108. package/dist/video-editor/index.js +58 -5
  109. package/dist/video-editor/playback.d.cts +20 -0
  110. package/dist/video-editor/playback.d.ts +20 -0
  111. package/package.json +1 -1
  112. package/skills/pixerate-agent-tools/SKILL.md +13 -0
  113. package/skills/pixerate-animation-editor/SKILL.md +1 -0
  114. package/skills/pixerate-canvas/SKILL.md +3 -0
  115. package/skills/pixerate-chart/SKILL.md +1 -0
  116. package/skills/pixerate-image-editor/SKILL.md +2 -2
  117. package/skills/pixerate-paint-editor/SKILL.md +1 -0
  118. package/skills/pixerate-parameters/SKILL.md +1 -0
  119. package/skills/pixerate-spreadsheet/SKILL.md +1 -0
  120. package/skills/pixerate-vector/SKILL.md +5 -0
  121. package/skills/pixerate-video-editor/SKILL.md +1 -0
  122. package/dist/chunk-BTZS3KZY.js +0 -221
  123. package/dist/chunk-K73HMKQP.js +0 -0
  124. package/dist/chunk-LACYURUW.cjs +0 -1
  125. package/dist/chunk-MRD3NXKR.cjs +0 -221
@@ -7,12 +7,18 @@ import {
7
7
  hasVariantCommands
8
8
  } from "../chunk-3TNA7JKI.js";
9
9
  import {
10
+ createNodeLookup,
10
11
  ensureLayout,
11
12
  getLayoutedNodes,
13
+ getNodeRect,
12
14
  placeBeside
13
- } from "../chunk-BTZS3KZY.js";
15
+ } from "../chunk-DW4CV5H4.js";
14
16
  import "../chunk-7KZ2HKKC.js";
15
- import "../chunk-K73HMKQP.js";
17
+ import {
18
+ runToolScript,
19
+ toolResultError,
20
+ toolResultValue
21
+ } from "../chunk-Y6SGC6KO.js";
16
22
  import {
17
23
  JSON_RPC_ERRORS,
18
24
  MCP_PROTOCOL_VERSIONS,
@@ -38,7 +44,16 @@ import {
38
44
  toolsetInstructions,
39
45
  toolsetName,
40
46
  unknownToolMessage
41
- } from "../chunk-RB62U6MS.js";
47
+ } from "../chunk-RFBFTLVN.js";
48
+ import {
49
+ AgentPlayback,
50
+ createAgentPlayback,
51
+ derivePlaybackSteps,
52
+ playbackRefsFromArgs,
53
+ playbackRefsFromResult,
54
+ readingTime,
55
+ unionRects
56
+ } from "../chunk-54GVEVXS.js";
42
57
  import {
43
58
  CAPTURE_EXCLUDE_SELECTOR,
44
59
  CAPTURE_OVERLAY_SELECTORS,
@@ -119,15 +134,24 @@ import {
119
134
  import {
120
135
  isSingleCellRange,
121
136
  normalizeRange,
137
+ planSpreadsheetToolPlayback,
122
138
  rangeContainsRange,
123
139
  rangesIntersect
124
- } from "../chunk-E747F3D5.js";
140
+ } from "../chunk-CC6WKVIH.js";
125
141
  import {
126
142
  colNameToIndex,
127
143
  indexToColName,
128
144
  isFormulaError
129
145
  } from "../chunk-II2WIF5Z.js";
130
146
  import "../chunk-WJSD3MAZ.js";
147
+ import {
148
+ PRESENCE_COLORS,
149
+ PerformanceQueue,
150
+ PresenceStore,
151
+ createInstantPresenceClock,
152
+ realPresenceClock,
153
+ tweenPresenceCursor
154
+ } from "../chunk-PEEP2YR7.js";
131
155
  import {
132
156
  validateJsonSchema
133
157
  } from "../chunk-V2ZCJRDM.js";
@@ -459,6 +483,87 @@ function planToolCall(name, args, snapshot, options) {
459
483
  import { TextSelection as TextSelection2 } from "@tiptap/pm/state";
460
484
  import { closeHistory as closeHistory3 } from "@tiptap/pm/history";
461
485
 
486
+ // src/agent/canvasPlayback.ts
487
+ var centre = (r) => ({ x: r.x + r.width / 2, y: r.y + r.height / 2 });
488
+ var labelOf = (data) => {
489
+ const label = data?.label ?? data?.title ?? data?.text;
490
+ return typeof label === "string" && label.trim() ? label : null;
491
+ };
492
+ function planCanvasPlaybackSteps(steps, nodes, rectOptions) {
493
+ const placed = new Map(createNodeLookup(nodes));
494
+ const rectOf = (id) => {
495
+ const node = placed.get(id);
496
+ return node ? getNodeRect(node, placed, rectOptions) : null;
497
+ };
498
+ const before = [];
499
+ const after = [];
500
+ const click = (rect) => rect ? [{ type: "move", to: centre(rect) }, { type: "focus", rect }, { type: "press" }, { type: "release" }] : [];
501
+ for (const step of steps) {
502
+ switch (step.type) {
503
+ case "step:canvas_add_node": {
504
+ placed.set(step.node.id, step.node);
505
+ const rect = rectOf(step.node.id);
506
+ const label = labelOf(step.node.data);
507
+ before.push(...click(rect), ...label ? [{ type: "type", text: label }] : []);
508
+ break;
509
+ }
510
+ case "step:canvas_add_edge": {
511
+ const a = rectOf(step.edge.source);
512
+ const b = rectOf(step.edge.target);
513
+ if (!a || !b) break;
514
+ const label = typeof step.edge.label === "string" ? step.edge.label : labelOf(step.edge.data);
515
+ before.push(
516
+ { type: "move", to: { x: a.x + a.width, y: a.y + a.height / 2 } },
517
+ { type: "press" },
518
+ { type: "drag", to: { x: b.x, y: b.y + b.height / 2 } },
519
+ { type: "release" },
520
+ ...label ? [{ type: "type", text: label }] : []
521
+ );
522
+ break;
523
+ }
524
+ case "step:canvas_update_node": {
525
+ const rect = rectOf(step.id);
526
+ const label = labelOf(step.data);
527
+ before.push(...click(rect), ...rect && label ? [{ type: "type", text: label }] : []);
528
+ break;
529
+ }
530
+ case "step:canvas_remove_nodes":
531
+ for (const id of step.nodeIds.slice(0, 8)) before.push(...click(rectOf(id)));
532
+ break;
533
+ case "step:canvas_select":
534
+ for (const id of step.nodeIds.slice(0, 8)) before.push(...click(rectOf(id)));
535
+ break;
536
+ case "step:canvas_highlight":
537
+ for (const id of step.nodeIds.slice(0, 8)) {
538
+ const rect = rectOf(id);
539
+ if (rect) before.push({ type: "move", to: centre(rect) }, { type: "focus", rect });
540
+ }
541
+ break;
542
+ case "step:canvas_move_nodes": {
543
+ const moved = Object.entries(step.positions);
544
+ for (const [id, position] of moved) {
545
+ const node = placed.get(id);
546
+ if (node) placed.set(id, { ...node, position });
547
+ }
548
+ const rect = unionRects(moved.map(([id]) => rectOf(id)));
549
+ if (rect) after.push({ type: "move", to: centre(rect) }, { type: "focus", rect }, { type: "wait", ms: 450 });
550
+ break;
551
+ }
552
+ default:
553
+ break;
554
+ }
555
+ }
556
+ if (!before.length && !after.length) return [];
557
+ return [...before, { type: "commit" }, ...after];
558
+ }
559
+ function planCanvasToolPlayback(name, args, snapshot, plannerOptions, rectOptions) {
560
+ const command = toolCallToAgentCommand(name, args);
561
+ if (!command || !command.type.startsWith("canvas:") || validateAgentCommand(command, snapshot)) return null;
562
+ const steps = planAgentCommand(command, snapshot, plannerOptions);
563
+ const planned = planCanvasPlaybackSteps(steps, snapshot.canvas?.nodes ?? [], rectOptions);
564
+ return planned.length ? planned : null;
565
+ }
566
+
462
567
  // src/agent/documentChartTools.ts
463
568
  import { closeHistory } from "@tiptap/pm/history";
464
569
  var READ = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
@@ -1065,6 +1170,13 @@ function findMatches(editor, query, args, replacement) {
1065
1170
  function createRichTextToolProvider(target, options) {
1066
1171
  const editor = () => toEditor(target);
1067
1172
  const charts = createDocumentChartTools(editor);
1173
+ const withCaret = (tool) => tool.name !== "insert_chart" ? tool : {
1174
+ ...tool,
1175
+ handler: (args, context) => {
1176
+ if (typeof args.at === "number") presence.show(args.at);
1177
+ return tool.handler(args, context);
1178
+ }
1179
+ };
1068
1180
  const presence = createTextPresence(editor, options.id, options.presence);
1069
1181
  const formatting = createDocumentFormatTools(editor, (ranges) => presence.changed(ranges.filter((r) => r.from < r.to)));
1070
1182
  const getText = {
@@ -1366,7 +1478,7 @@ function createRichTextToolProvider(target, options) {
1366
1478
  if (!ed || ed.isDestroyed) return [];
1367
1479
  if (!ed.isEditable) return [getText, findText, ...charts.read()];
1368
1480
  const tools = [getText, findText, insertText, replaceText, replaceRange, replaceSelection, setSelection, ...formatting.tools(ed)];
1369
- return [...tools, ...isTableEnabled(ed) ? [editTable] : [], ...charts.read(), ...charts.write()];
1481
+ return [...tools, ...isTableEnabled(ed) ? [editTable] : [], ...charts.read(), ...charts.write().map(withCaret)];
1370
1482
  },
1371
1483
  subscribe: (notify) => {
1372
1484
  const ed = editor();
@@ -1716,7 +1828,11 @@ function createSpreadsheetToolProvider(controller, options) {
1716
1828
  title: "Spreadsheet",
1717
1829
  description: "A spreadsheet: read and set cells and ranges, insert and delete rows and columns, merge and transpose.",
1718
1830
  skill: "pixerate-spreadsheet",
1719
- tools: [getRange, setCell, setRange, insertRows, deleteRows, insertColumns, deleteColumns, mergeCells, unmergeCells, transposeRange]
1831
+ // Agent playback: `<SpreadsheetEditor playback>` attaches as `spreadsheet` and finds the cells.
1832
+ playbackSurface: options.playbackSurface ?? "spreadsheet",
1833
+ tools: [getRange, setCell, setRange, insertRows, deleteRows, insertColumns, deleteColumns, mergeCells, unmergeCells, transposeRange].map(
1834
+ (tool) => ({ ...tool, plan: (args) => planSpreadsheetToolPlayback(tool.name, args) })
1835
+ )
1720
1836
  };
1721
1837
  }
1722
1838
  function missingArgumentsMessage(name, args) {
@@ -1769,7 +1885,12 @@ function createEditorMcpToolProvider(options) {
1769
1885
  };
1770
1886
  }
1771
1887
  },
1772
- ...editTools.map((definition) => ({ ...definition, handler: edit(definition.name) }))
1888
+ ...editTools.map((definition) => ({
1889
+ ...definition,
1890
+ handler: edit(definition.name),
1891
+ // The cursor goes where the planner puts the change (see `planCanvasToolPlayback`).
1892
+ plan: (args) => planCanvasToolPlayback(definition.name, args, options.getSnapshot(), options.plannerOptions, options.rectOptions)
1893
+ }))
1773
1894
  ];
1774
1895
  if (options.captureView) {
1775
1896
  const capture = options.captureView;
@@ -1787,6 +1908,7 @@ function createEditorMcpToolProvider(options) {
1787
1908
  title: "Canvas and prompt editor",
1788
1909
  description: "The node canvas and the prompt: editor state, nodes and edges, layout, prompt text, and a view of the editor.",
1789
1910
  skill: "pixerate-canvas",
1911
+ ...options.playbackSurface ? { playbackSurface: options.playbackSurface } : {},
1790
1912
  tools
1791
1913
  };
1792
1914
  }
@@ -1994,6 +2116,7 @@ function createCanvasComponentToolProvider(controller, options = { id: "canvas-c
1994
2116
  };
1995
2117
  }
1996
2118
  export {
2119
+ AgentPlayback,
1997
2120
  CAPTURE_EXCLUDE_SELECTOR,
1998
2121
  CAPTURE_OVERLAY_SELECTORS,
1999
2122
  EDITOR_CANVAS_TOOLS,
@@ -2018,6 +2141,9 @@ export {
2018
2141
  MCP_TOOL_PROMPT_SELECT,
2019
2142
  MCP_TOOL_PROMPT_SET_VARIABLE,
2020
2143
  MCP_TOOL_VIEW_EDITOR,
2144
+ PRESENCE_COLORS,
2145
+ PerformanceQueue,
2146
+ PresenceStore,
2021
2147
  TOOL_BRIDGE_DEFAULT_PORT,
2022
2148
  TOOL_BRIDGE_PROTOCOL,
2023
2149
  TOOL_DISCOVERY_TOOLS,
@@ -2031,16 +2157,19 @@ export {
2031
2157
  captureOutputSize,
2032
2158
  cloneElementWithStyles,
2033
2159
  connectToolBridge,
2160
+ createAgentPlayback,
2034
2161
  createCanvasComponentToolProvider,
2035
2162
  createCaptureTool,
2036
2163
  createCaptureToolProvider,
2037
2164
  createDocumentChartTools,
2038
2165
  createEditorMcpToolProvider,
2039
2166
  createElementCaptureSurface,
2167
+ createInstantPresenceClock,
2040
2168
  createMcpServer,
2041
2169
  createRichTextToolProvider,
2042
2170
  createSpreadsheetToolProvider,
2043
2171
  createToolRegistry,
2172
+ derivePlaybackSteps,
2044
2173
  elementToSvg,
2045
2174
  errorResult,
2046
2175
  isUnsafeJsonKey,
@@ -2048,10 +2177,17 @@ export {
2048
2177
  normalizeSide,
2049
2178
  parseSkillFrontmatter,
2050
2179
  planAgentCommand,
2180
+ planCanvasPlaybackSteps,
2181
+ planCanvasToolPlayback,
2051
2182
  planToolCall,
2183
+ playbackRefsFromArgs,
2184
+ playbackRefsFromResult,
2052
2185
  rasterizeElement,
2053
2186
  readSkillFile,
2187
+ readingTime,
2188
+ realPresenceClock,
2054
2189
  resolveCaptureRequest,
2190
+ runToolScript,
2055
2191
  searchTokens,
2056
2192
  searchTools,
2057
2193
  stripPrototypeKeys,
@@ -2059,9 +2195,13 @@ export {
2059
2195
  toCapturedImageData,
2060
2196
  toToolResult,
2061
2197
  toolCallToAgentCommand,
2198
+ toolResultError,
2199
+ toolResultValue,
2062
2200
  toolsetInstructions,
2063
2201
  toolsetName,
2202
+ tweenPresenceCursor,
2064
2203
  unionCaptureRects,
2204
+ unionRects,
2065
2205
  unknownToolMessage,
2066
2206
  validateAgentCommand,
2067
2207
  validateJsonSchema
@@ -1,6 +1,7 @@
1
1
  import type { Editor } from '@tiptap/core';
2
2
  import type { SpreadsheetController } from '../spreadsheet/controller.cjs';
3
3
  import { type planToolCall } from './planner.cjs';
4
+ import type { NodeRectOptions } from '../canvas/arrange.cjs';
4
5
  import type { AgentToolProvider } from '../tools/registry.cjs';
5
6
  import type { AgentStep, EditorSnapshot } from './types.cjs';
6
7
  import type { CanvasEdge, CanvasNode } from '../canvas/types.cjs';
@@ -64,7 +65,10 @@ export declare function createRichTextToolProvider(target: RichTextToolTarget, o
64
65
  * `unmerge_cells` / `transpose_range` on an A1 range (not the user's
65
66
  * selection), checked against merges and read-only cells first.
66
67
  */
67
- export declare function createSpreadsheetToolProvider(controller: SpreadsheetController, options: ToolProviderOptions): AgentToolProvider;
68
+ export declare function createSpreadsheetToolProvider(controller: SpreadsheetController, options: ToolProviderOptions & {
69
+ /** The agent playback surface its calls are acted out on (default `spreadsheet`, where `SpreadsheetEditor` attaches). */
70
+ playbackSurface?: string;
71
+ }): AgentToolProvider;
68
72
  export interface EditorMcpToolProviderOptions<TNode extends CanvasNode = CanvasNode, TEdge extends CanvasEdge = CanvasEdge> extends ToolProviderOptions {
69
73
  /** Current editor / canvas state. */
70
74
  getSnapshot: () => EditorSnapshot<TNode, TEdge>;
@@ -95,6 +99,13 @@ export interface EditorMcpToolProviderOptions<TNode extends CanvasNode = CanvasN
95
99
  canvas?: boolean;
96
100
  prompt?: boolean;
97
101
  };
102
+ /**
103
+ * The agent playback surface the canvas edits are acted out on (default: the provider id).
104
+ * Attach it with `useCanvasPlaybackSurface` / `createCanvasPlaybackSurface`.
105
+ */
106
+ playbackSurface?: string;
107
+ /** Node size resolution for the cursor's targets (match the canvas' own). */
108
+ rectOptions?: NodeRectOptions;
98
109
  }
99
110
  /**
100
111
  * Exposes the editor MCP tools (`get_editor_state`, the canvas and prompt
@@ -1,6 +1,7 @@
1
1
  import type { Editor } from '@tiptap/core';
2
2
  import type { SpreadsheetController } from '../spreadsheet/controller.js';
3
3
  import { type planToolCall } from './planner.js';
4
+ import type { NodeRectOptions } from '../canvas/arrange.js';
4
5
  import type { AgentToolProvider } from '../tools/registry.js';
5
6
  import type { AgentStep, EditorSnapshot } from './types.js';
6
7
  import type { CanvasEdge, CanvasNode } from '../canvas/types.js';
@@ -64,7 +65,10 @@ export declare function createRichTextToolProvider(target: RichTextToolTarget, o
64
65
  * `unmerge_cells` / `transpose_range` on an A1 range (not the user's
65
66
  * selection), checked against merges and read-only cells first.
66
67
  */
67
- export declare function createSpreadsheetToolProvider(controller: SpreadsheetController, options: ToolProviderOptions): AgentToolProvider;
68
+ export declare function createSpreadsheetToolProvider(controller: SpreadsheetController, options: ToolProviderOptions & {
69
+ /** The agent playback surface its calls are acted out on (default `spreadsheet`, where `SpreadsheetEditor` attaches). */
70
+ playbackSurface?: string;
71
+ }): AgentToolProvider;
68
72
  export interface EditorMcpToolProviderOptions<TNode extends CanvasNode = CanvasNode, TEdge extends CanvasEdge = CanvasEdge> extends ToolProviderOptions {
69
73
  /** Current editor / canvas state. */
70
74
  getSnapshot: () => EditorSnapshot<TNode, TEdge>;
@@ -95,6 +99,13 @@ export interface EditorMcpToolProviderOptions<TNode extends CanvasNode = CanvasN
95
99
  canvas?: boolean;
96
100
  prompt?: boolean;
97
101
  };
102
+ /**
103
+ * The agent playback surface the canvas edits are acted out on (default: the provider id).
104
+ * Attach it with `useCanvasPlaybackSurface` / `createCanvasPlaybackSurface`.
105
+ */
106
+ playbackSurface?: string;
107
+ /** Node size resolution for the cursor's targets (match the canvas' own). */
108
+ rectOptions?: NodeRectOptions;
98
109
  }
99
110
  /**
100
111
  * Exposes the editor MCP tools (`get_editor_state`, the canvas and prompt
@@ -1,6 +1,9 @@
1
1
  import type { CanvasEdge, CanvasNode, Side, XYPosition } from '../canvas/types.cjs';
2
2
  /**
3
3
  * Agent presence state for visual multiplayer/agent choreography.
4
+ *
5
+ * @deprecated Agent playback (`createAgentPlayback` in `@pixerate/editor/tools`) keeps cursors in a
6
+ * `PresenceStore` per surface and plays every tool call; draw them with `PresenceLayer`.
4
7
  */
5
8
  export interface AgentPresence {
6
9
  agentId: string;
@@ -1,6 +1,9 @@
1
1
  import type { CanvasEdge, CanvasNode, Side, XYPosition } from '../canvas/types.js';
2
2
  /**
3
3
  * Agent presence state for visual multiplayer/agent choreography.
4
+ *
5
+ * @deprecated Agent playback (`createAgentPlayback` in `@pixerate/editor/tools`) keeps cursors in a
6
+ * `PresenceStore` per surface and plays every tool call; draw them with `PresenceLayer`.
4
7
  */
5
8
  export interface AgentPresence {
6
9
  agentId: string;
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var _chunkGEY73RUWcjs = require('../chunk-GEY73RUW.cjs');
8
+ var _chunkUJGAA6AKcjs = require('../chunk-UJGAA6AK.cjs');
9
9
 
10
10
 
11
11
 
@@ -98,4 +98,4 @@ require('../chunk-A6QWKBJP.cjs');
98
98
 
99
99
 
100
100
 
101
- exports.ANIMATION_EASING_LABELS = _chunkDWJJI6RTcjs.ANIMATION_EASING_LABELS; exports.ANIMATION_EASING_PRESETS = _chunkDWJJI6RTcjs.ANIMATION_EASING_PRESETS; exports.ANIMATION_TIME_EPSILON = _chunkSVR5FR7Bcjs.ANIMATION_TIME_EPSILON; exports.AnimationPlayer = _chunkSVR5FR7Bcjs.AnimationPlayer; exports.CUBIC_BEZIER_PRESETS = _chunkDWJJI6RTcjs.CUBIC_BEZIER_PRESETS; exports.MOTION_BEHAVIORS = _chunk7B5GTJXBcjs.MOTION_BEHAVIORS; exports.ManualClock = _chunkSVR5FR7Bcjs.ManualClock; exports.PRESENCE_COLORS = _chunkGEY73RUWcjs.PRESENCE_COLORS; exports.PerformanceQueue = _chunkGEY73RUWcjs.PerformanceQueue; exports.PresenceStore = _chunkGEY73RUWcjs.PresenceStore; exports.SPRING_PRESETS = _chunkDWJJI6RTcjs.SPRING_PRESETS; exports.behaviorProgress = _chunk7B5GTJXBcjs.behaviorProgress; exports.createAnimationPlayer = _chunkSVR5FR7Bcjs.createAnimationPlayer; exports.createInstantPresenceClock = _chunkGEY73RUWcjs.createInstantPresenceClock; exports.cubicBezierAt = _chunkDWJJI6RTcjs.cubicBezierAt; exports.easingFromInfluence = _chunkDWJJI6RTcjs.easingFromInfluence; exports.easingLabel = _chunkDWJJI6RTcjs.easingLabel; exports.easingToCss = _chunkDWJJI6RTcjs.easingToCss; exports.elasticAt = _chunkDWJJI6RTcjs.elasticAt; exports.evaluateEasing = _chunkDWJJI6RTcjs.evaluateEasing; exports.evaluateTrack = _chunkSVR5FR7Bcjs.evaluateTrack; exports.formatOklab = _chunk5FXOR7F2cjs.formatOklab; exports.fractalWiggle = _chunk7B5GTJXBcjs.fractalWiggle; exports.interpolateAnimationValue = _chunkSVR5FR7Bcjs.interpolateAnimationValue; exports.isAnimationEasing = _chunkDWJJI6RTcjs.isAnimationEasing; exports.isAnimationKeyframe = _chunkSVR5FR7Bcjs.isAnimationKeyframe; exports.isMotionBehavior = _chunk7B5GTJXBcjs.isMotionBehavior; exports.mixColorsOklab = _chunk5FXOR7F2cjs.mixColorsOklab; exports.motionSeedFromId = _chunk7B5GTJXBcjs.motionSeedFromId; exports.normalizeKeyframes = _chunkSVR5FR7Bcjs.normalizeKeyframes; exports.oklabToRgb = _chunk5FXOR7F2cjs.oklabToRgb; exports.pageHidden = _chunkSVR5FR7Bcjs.pageHidden; exports.parseCssEasing = _chunkDWJJI6RTcjs.parseCssEasing; exports.parseOklab = _chunk5FXOR7F2cjs.parseOklab; exports.quinticFade = _chunk7B5GTJXBcjs.quinticFade; exports.realClock = _chunkSVR5FR7Bcjs.realClock; exports.realPresenceClock = _chunkGEY73RUWcjs.realPresenceClock; exports.resolveEasing = _chunkDWJJI6RTcjs.resolveEasing; exports.reverseCubicBezier = _chunkDWJJI6RTcjs.reverseCubicBezier; exports.rgbToOklab = _chunk5FXOR7F2cjs.rgbToOklab; exports.springAt = _chunkDWJJI6RTcjs.springAt; exports.springSettleMs = _chunkDWJJI6RTcjs.springSettleMs; exports.tweenPresenceCursor = _chunkGEY73RUWcjs.tweenPresenceCursor; exports.wrapAnimationTime = _chunkSVR5FR7Bcjs.wrapAnimationTime;
101
+ exports.ANIMATION_EASING_LABELS = _chunkDWJJI6RTcjs.ANIMATION_EASING_LABELS; exports.ANIMATION_EASING_PRESETS = _chunkDWJJI6RTcjs.ANIMATION_EASING_PRESETS; exports.ANIMATION_TIME_EPSILON = _chunkSVR5FR7Bcjs.ANIMATION_TIME_EPSILON; exports.AnimationPlayer = _chunkSVR5FR7Bcjs.AnimationPlayer; exports.CUBIC_BEZIER_PRESETS = _chunkDWJJI6RTcjs.CUBIC_BEZIER_PRESETS; exports.MOTION_BEHAVIORS = _chunk7B5GTJXBcjs.MOTION_BEHAVIORS; exports.ManualClock = _chunkSVR5FR7Bcjs.ManualClock; exports.PRESENCE_COLORS = _chunkUJGAA6AKcjs.PRESENCE_COLORS; exports.PerformanceQueue = _chunkUJGAA6AKcjs.PerformanceQueue; exports.PresenceStore = _chunkUJGAA6AKcjs.PresenceStore; exports.SPRING_PRESETS = _chunkDWJJI6RTcjs.SPRING_PRESETS; exports.behaviorProgress = _chunk7B5GTJXBcjs.behaviorProgress; exports.createAnimationPlayer = _chunkSVR5FR7Bcjs.createAnimationPlayer; exports.createInstantPresenceClock = _chunkUJGAA6AKcjs.createInstantPresenceClock; exports.cubicBezierAt = _chunkDWJJI6RTcjs.cubicBezierAt; exports.easingFromInfluence = _chunkDWJJI6RTcjs.easingFromInfluence; exports.easingLabel = _chunkDWJJI6RTcjs.easingLabel; exports.easingToCss = _chunkDWJJI6RTcjs.easingToCss; exports.elasticAt = _chunkDWJJI6RTcjs.elasticAt; exports.evaluateEasing = _chunkDWJJI6RTcjs.evaluateEasing; exports.evaluateTrack = _chunkSVR5FR7Bcjs.evaluateTrack; exports.formatOklab = _chunk5FXOR7F2cjs.formatOklab; exports.fractalWiggle = _chunk7B5GTJXBcjs.fractalWiggle; exports.interpolateAnimationValue = _chunkSVR5FR7Bcjs.interpolateAnimationValue; exports.isAnimationEasing = _chunkDWJJI6RTcjs.isAnimationEasing; exports.isAnimationKeyframe = _chunkSVR5FR7Bcjs.isAnimationKeyframe; exports.isMotionBehavior = _chunk7B5GTJXBcjs.isMotionBehavior; exports.mixColorsOklab = _chunk5FXOR7F2cjs.mixColorsOklab; exports.motionSeedFromId = _chunk7B5GTJXBcjs.motionSeedFromId; exports.normalizeKeyframes = _chunkSVR5FR7Bcjs.normalizeKeyframes; exports.oklabToRgb = _chunk5FXOR7F2cjs.oklabToRgb; exports.pageHidden = _chunkSVR5FR7Bcjs.pageHidden; exports.parseCssEasing = _chunkDWJJI6RTcjs.parseCssEasing; exports.parseOklab = _chunk5FXOR7F2cjs.parseOklab; exports.quinticFade = _chunk7B5GTJXBcjs.quinticFade; exports.realClock = _chunkSVR5FR7Bcjs.realClock; exports.realPresenceClock = _chunkUJGAA6AKcjs.realPresenceClock; exports.resolveEasing = _chunkDWJJI6RTcjs.resolveEasing; exports.reverseCubicBezier = _chunkDWJJI6RTcjs.reverseCubicBezier; exports.rgbToOklab = _chunk5FXOR7F2cjs.rgbToOklab; exports.springAt = _chunkDWJJI6RTcjs.springAt; exports.springSettleMs = _chunkDWJJI6RTcjs.springSettleMs; exports.tweenPresenceCursor = _chunkUJGAA6AKcjs.tweenPresenceCursor; exports.wrapAnimationTime = _chunkSVR5FR7Bcjs.wrapAnimationTime;
@@ -5,7 +5,7 @@ import {
5
5
  createInstantPresenceClock,
6
6
  realPresenceClock,
7
7
  tweenPresenceCursor
8
- } from "../chunk-BSGPXPTW.js";
8
+ } from "../chunk-PEEP2YR7.js";
9
9
  import {
10
10
  MOTION_BEHAVIORS,
11
11
  behaviorProgress,
@@ -1,75 +1 @@
1
- export interface PresenceActor {
2
- id: string;
3
- name: string;
4
- color: string;
5
- /** Cursor position in the surface's own coordinates (scene / canvas). */
6
- x: number;
7
- y: number;
8
- /** The button is down (dragging). */
9
- pressed: boolean;
10
- /** A short note shown next to the cursor (what the agent is doing). */
11
- message?: string;
12
- }
13
- export interface PresenceState {
14
- actors: readonly PresenceActor[];
15
- }
16
- export declare const PRESENCE_COLORS: readonly string[];
17
- /** Cursor positions and notes of agents acting on a surface, for an overlay. */
18
- export declare class PresenceStore {
19
- private state;
20
- private readonly listeners;
21
- getState: () => PresenceState;
22
- subscribe: (listener: (state: PresenceState) => void) => (() => void);
23
- /** The actor with `id`, if it is on the surface. */
24
- get(id: string): PresenceActor | undefined;
25
- /** Adds or changes an actor. */
26
- set(actor: Pick<PresenceActor, 'id'> & Partial<PresenceActor>): void;
27
- remove(id: string): void;
28
- }
29
- /** Time for performances: real timers, or an instant clock for tests and recordings. */
30
- export interface PresenceClock {
31
- now(): number;
32
- wait(ms: number): Promise<void>;
33
- }
34
- export declare const realPresenceClock: PresenceClock;
35
- /** A clock whose waits finish at once while its time still advances (repeatable performances). */
36
- export declare function createInstantPresenceClock(start?: number): PresenceClock & {
37
- elapsed(): number;
38
- };
39
- /**
40
- * Glides an actor's cursor from `from` to `to` over `ms` (ease-out cubic, ~60 frames a second),
41
- * calling `each` with the eased progress after every frame (e.g. to drag a value along).
42
- */
43
- export declare function tweenPresenceCursor(presence: PresenceStore, clock: PresenceClock, id: string, from: {
44
- x: number;
45
- y: number;
46
- }, to: {
47
- x: number;
48
- y: number;
49
- }, ms: number, each?: (t: number) => void): Promise<void>;
50
- export interface PresenceActorInfo {
51
- id: string;
52
- name?: string;
53
- color?: string;
54
- }
55
- export interface PerformanceQueueOptions {
56
- clock: PresenceClock;
57
- /** Hide each actor's cursor this long after its last call (ms, default 1500; 0 keeps it). */
58
- linger?: number;
59
- /** Called around each call so everything it changes is one undo step. */
60
- beginGesture?: (key: string) => void;
61
- endGesture?: () => void;
62
- }
63
- /**
64
- * Runs performances one after another per actor (different actors run side by side). Each
65
- * call shows the actor's cursor, wraps the call in one gesture (one undo step), clears the
66
- * note when it ends, and hides the cursor after `linger` unless another call followed.
67
- */
68
- export declare class PerformanceQueue {
69
- readonly presence: PresenceStore;
70
- private readonly options;
71
- private readonly queues;
72
- private calls;
73
- constructor(presence: PresenceStore, options: PerformanceQueueOptions);
74
- run<T>(actor: PresenceActorInfo, perform: () => Promise<T>): Promise<T>;
75
- }
1
+ export * from '../tools/presence.cjs';
@@ -1,75 +1 @@
1
- export interface PresenceActor {
2
- id: string;
3
- name: string;
4
- color: string;
5
- /** Cursor position in the surface's own coordinates (scene / canvas). */
6
- x: number;
7
- y: number;
8
- /** The button is down (dragging). */
9
- pressed: boolean;
10
- /** A short note shown next to the cursor (what the agent is doing). */
11
- message?: string;
12
- }
13
- export interface PresenceState {
14
- actors: readonly PresenceActor[];
15
- }
16
- export declare const PRESENCE_COLORS: readonly string[];
17
- /** Cursor positions and notes of agents acting on a surface, for an overlay. */
18
- export declare class PresenceStore {
19
- private state;
20
- private readonly listeners;
21
- getState: () => PresenceState;
22
- subscribe: (listener: (state: PresenceState) => void) => (() => void);
23
- /** The actor with `id`, if it is on the surface. */
24
- get(id: string): PresenceActor | undefined;
25
- /** Adds or changes an actor. */
26
- set(actor: Pick<PresenceActor, 'id'> & Partial<PresenceActor>): void;
27
- remove(id: string): void;
28
- }
29
- /** Time for performances: real timers, or an instant clock for tests and recordings. */
30
- export interface PresenceClock {
31
- now(): number;
32
- wait(ms: number): Promise<void>;
33
- }
34
- export declare const realPresenceClock: PresenceClock;
35
- /** A clock whose waits finish at once while its time still advances (repeatable performances). */
36
- export declare function createInstantPresenceClock(start?: number): PresenceClock & {
37
- elapsed(): number;
38
- };
39
- /**
40
- * Glides an actor's cursor from `from` to `to` over `ms` (ease-out cubic, ~60 frames a second),
41
- * calling `each` with the eased progress after every frame (e.g. to drag a value along).
42
- */
43
- export declare function tweenPresenceCursor(presence: PresenceStore, clock: PresenceClock, id: string, from: {
44
- x: number;
45
- y: number;
46
- }, to: {
47
- x: number;
48
- y: number;
49
- }, ms: number, each?: (t: number) => void): Promise<void>;
50
- export interface PresenceActorInfo {
51
- id: string;
52
- name?: string;
53
- color?: string;
54
- }
55
- export interface PerformanceQueueOptions {
56
- clock: PresenceClock;
57
- /** Hide each actor's cursor this long after its last call (ms, default 1500; 0 keeps it). */
58
- linger?: number;
59
- /** Called around each call so everything it changes is one undo step. */
60
- beginGesture?: (key: string) => void;
61
- endGesture?: () => void;
62
- }
63
- /**
64
- * Runs performances one after another per actor (different actors run side by side). Each
65
- * call shows the actor's cursor, wraps the call in one gesture (one undo step), clears the
66
- * note when it ends, and hides the cursor after `linger` unless another call followed.
67
- */
68
- export declare class PerformanceQueue {
69
- readonly presence: PresenceStore;
70
- private readonly options;
71
- private readonly queues;
72
- private calls;
73
- constructor(presence: PresenceStore, options: PerformanceQueueOptions);
74
- run<T>(actor: PresenceActorInfo, perform: () => Promise<T>): Promise<T>;
75
- }
1
+ export * from '../tools/presence.js';