@pixerate/editor 0.44.0 → 0.46.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 (88) hide show
  1. package/README.md +29 -3
  2. package/dist/agent/index.cjs +548 -45
  3. package/dist/agent/index.cjs.map +1 -1
  4. package/dist/agent/index.d.cts +47 -17
  5. package/dist/agent/index.d.ts +47 -17
  6. package/dist/agent/index.js +536 -33
  7. package/dist/agent/index.js.map +1 -1
  8. package/dist/{builtins-BLud97fC.d.cts → builtins-CZW-aYKS.d.cts} +1 -1
  9. package/dist/{builtins-D0BDyAgw.d.ts → builtins-DghNQbT-.d.ts} +1 -1
  10. package/dist/chart/index.cjs +1984 -0
  11. package/dist/chart/index.cjs.map +1 -0
  12. package/dist/chart/index.d.cts +646 -0
  13. package/dist/chart/index.d.ts +646 -0
  14. package/dist/chart/index.js +1984 -0
  15. package/dist/chart/index.js.map +1 -0
  16. package/dist/{chunk-I6BZB5ZH.cjs → chunk-EFDCLENW.cjs} +73 -6
  17. package/dist/chunk-EFDCLENW.cjs.map +1 -0
  18. package/dist/chunk-HHQ4XJWT.js +826 -0
  19. package/dist/chunk-HHQ4XJWT.js.map +1 -0
  20. package/dist/chunk-J3R2OWOE.cjs +1465 -0
  21. package/dist/chunk-J3R2OWOE.cjs.map +1 -0
  22. package/dist/chunk-K2LVZ4FA.cjs +826 -0
  23. package/dist/chunk-K2LVZ4FA.cjs.map +1 -0
  24. package/dist/{chunk-6MDQKHRH.cjs → chunk-N4MLNJPO.cjs} +21 -899
  25. package/dist/chunk-N4MLNJPO.cjs.map +1 -0
  26. package/dist/chunk-PQM5W7ZN.js +168 -0
  27. package/dist/chunk-PQM5W7ZN.js.map +1 -0
  28. package/dist/{chunk-DDADOHJW.js → chunk-Q25ZS4F7.js} +5 -883
  29. package/dist/chunk-Q25ZS4F7.js.map +1 -0
  30. package/dist/chunk-TK2XZK6Z.js +1465 -0
  31. package/dist/chunk-TK2XZK6Z.js.map +1 -0
  32. package/dist/commands/index.cjs +3 -2
  33. package/dist/commands/index.cjs.map +1 -1
  34. package/dist/commands/index.d.cts +5 -5
  35. package/dist/commands/index.d.ts +5 -5
  36. package/dist/commands/index.js +2 -1
  37. package/dist/commands/index.js.map +1 -1
  38. package/dist/extensions/index.cjs +4 -4
  39. package/dist/extensions/index.cjs.map +1 -1
  40. package/dist/extensions/index.d.cts +3 -3
  41. package/dist/extensions/index.d.ts +3 -3
  42. package/dist/extensions/index.js +12 -12
  43. package/dist/generation/index.cjs +2 -2
  44. package/dist/generation/index.d.cts +4 -4
  45. package/dist/generation/index.d.ts +4 -4
  46. package/dist/generation/index.js +1 -1
  47. package/dist/image-editor/index.cjs +24 -24
  48. package/dist/image-editor/index.cjs.map +1 -1
  49. package/dist/image-editor/index.d.cts +2 -2
  50. package/dist/image-editor/index.d.ts +2 -2
  51. package/dist/image-editor/index.js +24 -24
  52. package/dist/image-editor/index.js.map +1 -1
  53. package/dist/{index-C6gaQRH0.d.cts → index-CfOQf70b.d.cts} +1 -1
  54. package/dist/{index-DXAv_R08.d.ts → index-jwJ_onWf.d.ts} +1 -1
  55. package/dist/index.cjs +9 -9
  56. package/dist/index.cjs.map +1 -1
  57. package/dist/index.d.cts +4 -4
  58. package/dist/index.d.ts +4 -4
  59. package/dist/index.js +12 -12
  60. package/dist/parameters/index.d.cts +2 -2
  61. package/dist/parameters/index.d.ts +2 -2
  62. package/dist/{registry-DnzpgY27.d.cts → registry-B4l-lYts.d.cts} +1 -1
  63. package/dist/{registry-DhVUZioj.d.ts → registry-BfVD-vVg.d.ts} +1 -1
  64. package/dist/{registry-BDe-vlv3.d.ts → registry-CSlH4iUn.d.ts} +1 -1
  65. package/dist/{registry-D0GADKc7.d.cts → registry-vz6HOiiy.d.cts} +1 -1
  66. package/dist/{schema-DYDGdYL9.d.cts → schema-Di0CS6Pe.d.cts} +26 -2
  67. package/dist/{schema-DYDGdYL9.d.ts → schema-Di0CS6Pe.d.ts} +26 -2
  68. package/dist/tools/index.cjs +37 -3
  69. package/dist/tools/index.cjs.map +1 -1
  70. package/dist/tools/index.d.cts +871 -11
  71. package/dist/tools/index.d.ts +871 -11
  72. package/dist/tools/index.js +36 -2
  73. package/dist/vector/index.d.cts +2 -2
  74. package/dist/vector/index.d.ts +2 -2
  75. package/package.json +6 -1
  76. package/dist/chunk-36BLROHV.js +0 -438
  77. package/dist/chunk-36BLROHV.js.map +0 -1
  78. package/dist/chunk-5H2OPMXZ.js +0 -586
  79. package/dist/chunk-5H2OPMXZ.js.map +0 -1
  80. package/dist/chunk-6MDQKHRH.cjs.map +0 -1
  81. package/dist/chunk-D6S5M7HV.js +0 -101
  82. package/dist/chunk-D6S5M7HV.js.map +0 -1
  83. package/dist/chunk-DDADOHJW.js.map +0 -1
  84. package/dist/chunk-I6BZB5ZH.cjs.map +0 -1
  85. package/dist/chunk-MC2LQN5S.cjs +0 -586
  86. package/dist/chunk-MC2LQN5S.cjs.map +0 -1
  87. package/dist/chunk-V7CC7RZ6.cjs +0 -438
  88. package/dist/chunk-V7CC7RZ6.cjs.map +0 -1
@@ -1,5 +1,6 @@
1
- export { J as JsonSchema, a as JsonSchemaType, S as SchemaValidationError, v as validateJsonSchema } from '../schema-DYDGdYL9.cjs';
2
- export { a as AgentTool, b as AgentToolHandler, A as AgentToolProvider, M as McpListToolsResult, c as McpToolContent, d as McpToolDefinition, e as McpToolResult, T as TOOL_NAMESPACE_SEPARATOR, f as ToolCallContext, g as ToolCallError, h as ToolErrorCode, i as ToolRegistry, j as ToolRegistryError, k as ToolRegistryOptions, l as createToolRegistry, t as toToolResult } from '../registry-DnzpgY27.cjs';
1
+ export { J as JsonSchema, a as JsonSchemaType, S as SchemaValidationError, v as validateJsonSchema } from '../schema-Di0CS6Pe.cjs';
2
+ import { i as ToolRegistry } from '../registry-B4l-lYts.cjs';
3
+ export { a as AgentTool, b as AgentToolHandler, A as AgentToolProvider, M as McpListToolsResult, c as McpToolContent, d as McpToolDefinition, e as McpToolResult, T as TOOL_NAMESPACE_SEPARATOR, f as ToolCallContext, g as ToolCallError, h as ToolErrorCode, j as ToolRegistryError, k as ToolRegistryOptions, l as createToolRegistry, t as toToolResult } from '../registry-B4l-lYts.cjs';
3
4
 
4
5
  /**
5
6
  * Standard MCP Tool Definitions for @pixerate/editor.
@@ -40,7 +41,7 @@ declare const MCP_TOOL_EDIT_CANVAS: {
40
41
  readonly idempotentHint: false;
41
42
  readonly openWorldHint: false;
42
43
  };
43
- readonly description: "Applies high-level structural operations to the visual canvas (adding nodes, connecting edges, organizing layout, or moving elements).";
44
+ readonly description: string;
44
45
  readonly inputSchema: {
45
46
  readonly type: "object";
46
47
  readonly properties: {
@@ -69,6 +70,23 @@ declare const MCP_TOOL_EDIT_CANVAS: {
69
70
  };
70
71
  readonly description: "Array of node IDs for remove_nodes, select, or highlight.";
71
72
  };
73
+ readonly id: {
74
+ readonly type: "string";
75
+ readonly description: "Node ID for update_node (or pass `node: { id, data }`).";
76
+ };
77
+ readonly data: {
78
+ readonly type: "object";
79
+ readonly description: "Data fields to merge into the node for update_node.";
80
+ };
81
+ readonly color: {
82
+ readonly type: "string";
83
+ readonly description: "CSS color for highlight (default #3b82f6).";
84
+ };
85
+ readonly durationMs: {
86
+ readonly type: "integer";
87
+ readonly minimum: 0;
88
+ readonly description: "How long the highlight lasts in ms (default 2000).";
89
+ };
72
90
  readonly source: {
73
91
  readonly type: "string";
74
92
  readonly description: "Source node ID for connect operation.";
@@ -118,15 +136,18 @@ declare const MCP_TOOL_EDIT_PROMPT: {
118
136
  readonly description: "Text to insert or replace.";
119
137
  };
120
138
  readonly at: {
121
- readonly type: "number";
139
+ readonly type: "integer";
140
+ readonly minimum: 0;
122
141
  readonly description: "Position to insert text at.";
123
142
  };
124
143
  readonly from: {
125
- readonly type: "number";
144
+ readonly type: "integer";
145
+ readonly minimum: 0;
126
146
  readonly description: "Start offset for replace_range or select.";
127
147
  };
128
148
  readonly to: {
129
- readonly type: "number";
149
+ readonly type: "integer";
150
+ readonly minimum: 0;
130
151
  readonly description: "End offset for replace_range or select.";
131
152
  };
132
153
  readonly name: {
@@ -171,6 +192,754 @@ declare const MCP_TOOL_VIEW_EDITOR: {
171
192
  };
172
193
  };
173
194
  };
195
+ declare const MCP_TOOL_CANVAS_ADD_NODE: {
196
+ readonly name: "canvas_add_node";
197
+ readonly title: "Add a canvas node";
198
+ readonly annotations: {
199
+ readonly readOnlyHint: false;
200
+ readonly destructiveHint: false;
201
+ readonly idempotentHint: false;
202
+ readonly openWorldHint: false;
203
+ readonly title: "Add a canvas node";
204
+ };
205
+ readonly description: string;
206
+ readonly inputSchema: {
207
+ readonly type: "object";
208
+ readonly properties: {
209
+ readonly node: {
210
+ readonly type: "object";
211
+ readonly description: "The node. Extra host-specific fields are kept.";
212
+ readonly properties: {
213
+ readonly id: {
214
+ readonly type: "string";
215
+ readonly minLength: 1;
216
+ readonly description: "Node id (default: generated). Must be unused.";
217
+ };
218
+ readonly type: {
219
+ readonly type: "string";
220
+ readonly description: "Node type registered by the host.";
221
+ };
222
+ readonly data: {
223
+ readonly type: "object";
224
+ readonly description: "Node data (e.g. { \"label\": \"...\" }).";
225
+ };
226
+ readonly position: {
227
+ readonly description: "Canvas coordinates (default: auto-placed).";
228
+ readonly type: "object";
229
+ readonly properties: {
230
+ readonly x: {
231
+ readonly type: "number";
232
+ };
233
+ readonly y: {
234
+ readonly type: "number";
235
+ };
236
+ };
237
+ readonly required: readonly ["x", "y"];
238
+ readonly additionalProperties: false;
239
+ };
240
+ readonly width: {
241
+ readonly type: "number";
242
+ readonly exclusiveMinimum: 0;
243
+ };
244
+ readonly height: {
245
+ readonly type: "number";
246
+ readonly exclusiveMinimum: 0;
247
+ };
248
+ readonly parentId: {
249
+ readonly type: "string";
250
+ readonly description: "Parent (group/frame) node id.";
251
+ };
252
+ };
253
+ };
254
+ readonly nearNodeId: {
255
+ readonly type: "string";
256
+ readonly description: "Existing node to place the new node beside and connect from.";
257
+ };
258
+ readonly side: {
259
+ readonly type: "string";
260
+ readonly enum: readonly ["top", "right", "bottom", "left"];
261
+ readonly description: "Side of `nearNodeId` to place the node on (default right).";
262
+ };
263
+ };
264
+ readonly required: readonly ["node"];
265
+ readonly additionalProperties: false;
266
+ };
267
+ };
268
+ declare const MCP_TOOL_CANVAS_REMOVE_NODES: {
269
+ readonly name: "canvas_remove_nodes";
270
+ readonly title: "Remove canvas nodes";
271
+ readonly annotations: {
272
+ readonly readOnlyHint: false;
273
+ readonly destructiveHint: true;
274
+ readonly idempotentHint: false;
275
+ readonly openWorldHint: false;
276
+ readonly title: "Remove canvas nodes";
277
+ };
278
+ readonly description: "Removes nodes (and their edges) from the canvas. Every id must exist.";
279
+ readonly inputSchema: {
280
+ readonly type: "object";
281
+ readonly properties: {
282
+ readonly nodeIds: {
283
+ readonly type: "array";
284
+ readonly items: {
285
+ readonly type: "string";
286
+ readonly minLength: 1;
287
+ };
288
+ readonly minItems: 1;
289
+ readonly uniqueItems: true;
290
+ readonly description: "Node ids (from get_editor_state).";
291
+ };
292
+ };
293
+ readonly required: readonly ["nodeIds"];
294
+ readonly additionalProperties: false;
295
+ };
296
+ };
297
+ declare const MCP_TOOL_CANVAS_CONNECT: {
298
+ readonly name: "canvas_connect";
299
+ readonly title: "Connect canvas nodes";
300
+ readonly annotations: {
301
+ readonly readOnlyHint: false;
302
+ readonly destructiveHint: false;
303
+ readonly idempotentHint: false;
304
+ readonly openWorldHint: false;
305
+ readonly title: "Connect canvas nodes";
306
+ };
307
+ readonly description: "Adds an edge from one existing node to another. Returns the new edge id.";
308
+ readonly inputSchema: {
309
+ readonly type: "object";
310
+ readonly properties: {
311
+ readonly source: {
312
+ readonly type: "string";
313
+ readonly minLength: 1;
314
+ readonly description: "Source node id.";
315
+ };
316
+ readonly target: {
317
+ readonly type: "string";
318
+ readonly minLength: 1;
319
+ readonly description: "Target node id.";
320
+ };
321
+ readonly label: {
322
+ readonly type: "string";
323
+ readonly description: "Edge label.";
324
+ };
325
+ };
326
+ readonly required: readonly ["source", "target"];
327
+ readonly additionalProperties: false;
328
+ };
329
+ };
330
+ declare const MCP_TOOL_CANVAS_UPDATE_NODE: {
331
+ readonly name: "canvas_update_node";
332
+ readonly title: "Update a canvas node";
333
+ readonly annotations: {
334
+ readonly idempotentHint: true;
335
+ readonly readOnlyHint: false;
336
+ readonly destructiveHint: true;
337
+ readonly openWorldHint: false;
338
+ readonly title: "Update a canvas node";
339
+ };
340
+ readonly description: "Merges fields into an existing node's data.";
341
+ readonly inputSchema: {
342
+ readonly type: "object";
343
+ readonly properties: {
344
+ readonly id: {
345
+ readonly type: "string";
346
+ readonly minLength: 1;
347
+ readonly description: "Node id.";
348
+ };
349
+ readonly data: {
350
+ readonly type: "object";
351
+ readonly description: "Data fields to merge (e.g. { \"label\": \"New\" }).";
352
+ };
353
+ };
354
+ readonly required: readonly ["id", "data"];
355
+ readonly additionalProperties: false;
356
+ };
357
+ };
358
+ declare const MCP_TOOL_CANVAS_LAYOUT: {
359
+ readonly name: "canvas_layout";
360
+ readonly title: "Lay out the canvas";
361
+ readonly annotations: {
362
+ readonly readOnlyHint: false;
363
+ readonly destructiveHint: false;
364
+ readonly idempotentHint: true;
365
+ readonly openWorldHint: false;
366
+ readonly title: "Lay out the canvas";
367
+ };
368
+ readonly description: "Arranges the canvas graph automatically.";
369
+ readonly inputSchema: {
370
+ readonly type: "object";
371
+ readonly properties: {
372
+ readonly direction: {
373
+ readonly type: "string";
374
+ readonly enum: readonly ["LR", "TB", "RL", "BT"];
375
+ readonly description: "Layout direction (default LR).";
376
+ };
377
+ readonly incremental: {
378
+ readonly type: "boolean";
379
+ readonly description: "Keep nodes that already have a position where they are (default true).";
380
+ };
381
+ };
382
+ readonly additionalProperties: false;
383
+ };
384
+ };
385
+ declare const MCP_TOOL_CANVAS_SELECT: {
386
+ readonly name: "canvas_select";
387
+ readonly title: "Select canvas nodes";
388
+ readonly annotations: {
389
+ readonly readOnlyHint: false;
390
+ readonly destructiveHint: false;
391
+ readonly idempotentHint: true;
392
+ readonly openWorldHint: false;
393
+ readonly title: "Select canvas nodes";
394
+ };
395
+ readonly description: "Replaces the canvas selection with these nodes (an empty list clears it).";
396
+ readonly inputSchema: {
397
+ readonly type: "object";
398
+ readonly properties: {
399
+ readonly nodeIds: {
400
+ readonly minItems: 0;
401
+ readonly type: "array";
402
+ readonly items: {
403
+ readonly type: "string";
404
+ readonly minLength: 1;
405
+ };
406
+ readonly uniqueItems: true;
407
+ readonly description: "Node ids (from get_editor_state).";
408
+ };
409
+ };
410
+ readonly required: readonly ["nodeIds"];
411
+ readonly additionalProperties: false;
412
+ };
413
+ };
414
+ declare const MCP_TOOL_CANVAS_HIGHLIGHT: {
415
+ readonly name: "canvas_highlight";
416
+ readonly title: "Highlight canvas nodes";
417
+ readonly annotations: {
418
+ readonly readOnlyHint: false;
419
+ readonly destructiveHint: false;
420
+ readonly idempotentHint: true;
421
+ readonly openWorldHint: false;
422
+ readonly title: "Highlight canvas nodes";
423
+ };
424
+ readonly description: "Briefly highlights nodes to draw the user's attention to them.";
425
+ readonly inputSchema: {
426
+ readonly type: "object";
427
+ readonly properties: {
428
+ readonly nodeIds: {
429
+ readonly type: "array";
430
+ readonly items: {
431
+ readonly type: "string";
432
+ readonly minLength: 1;
433
+ };
434
+ readonly minItems: 1;
435
+ readonly uniqueItems: true;
436
+ readonly description: "Node ids (from get_editor_state).";
437
+ };
438
+ readonly color: {
439
+ readonly type: "string";
440
+ readonly description: "CSS color (default #3b82f6).";
441
+ };
442
+ readonly durationMs: {
443
+ readonly type: "integer";
444
+ readonly minimum: 0;
445
+ readonly maximum: 60000;
446
+ readonly description: "Duration in ms (default 2000).";
447
+ };
448
+ };
449
+ readonly required: readonly ["nodeIds"];
450
+ readonly additionalProperties: false;
451
+ };
452
+ };
453
+ declare const MCP_TOOL_PROMPT_INSERT_TEXT: {
454
+ readonly name: "prompt_insert_text";
455
+ readonly title: "Insert prompt text";
456
+ readonly annotations: {
457
+ readonly readOnlyHint: false;
458
+ readonly destructiveHint: false;
459
+ readonly idempotentHint: false;
460
+ readonly openWorldHint: false;
461
+ readonly title: "Insert prompt text";
462
+ };
463
+ readonly description: "Inserts text into the prompt at a position, or at the cursor when `at` is omitted.";
464
+ readonly inputSchema: {
465
+ readonly type: "object";
466
+ readonly properties: {
467
+ readonly text: {
468
+ readonly type: "string";
469
+ readonly description: "Text to insert.";
470
+ };
471
+ readonly at: {
472
+ readonly description: "Position (as in get_editor_state `document.selection`).";
473
+ readonly type: "integer";
474
+ readonly minimum: 0;
475
+ };
476
+ };
477
+ readonly required: readonly ["text"];
478
+ readonly additionalProperties: false;
479
+ };
480
+ };
481
+ declare const MCP_TOOL_PROMPT_REPLACE_RANGE: {
482
+ readonly name: "prompt_replace_range";
483
+ readonly title: "Replace prompt text";
484
+ readonly annotations: {
485
+ readonly readOnlyHint: false;
486
+ readonly destructiveHint: true;
487
+ readonly idempotentHint: false;
488
+ readonly openWorldHint: false;
489
+ readonly title: "Replace prompt text";
490
+ };
491
+ readonly description: "Replaces the prompt text between two positions (an empty text deletes it).";
492
+ readonly inputSchema: {
493
+ readonly type: "object";
494
+ readonly properties: {
495
+ readonly from: {
496
+ readonly description: "Start position.";
497
+ readonly type: "integer";
498
+ readonly minimum: 0;
499
+ };
500
+ readonly to: {
501
+ readonly description: "End position (>= from).";
502
+ readonly type: "integer";
503
+ readonly minimum: 0;
504
+ };
505
+ readonly text: {
506
+ readonly type: "string";
507
+ readonly description: "Replacement text.";
508
+ };
509
+ };
510
+ readonly required: readonly ["from", "to", "text"];
511
+ readonly additionalProperties: false;
512
+ };
513
+ };
514
+ declare const MCP_TOOL_PROMPT_SET_VARIABLE: {
515
+ readonly name: "prompt_set_variable";
516
+ readonly title: "Set a prompt variable";
517
+ readonly annotations: {
518
+ readonly idempotentHint: true;
519
+ readonly readOnlyHint: false;
520
+ readonly destructiveHint: true;
521
+ readonly openWorldHint: false;
522
+ readonly title: "Set a prompt variable";
523
+ };
524
+ readonly description: "Sets the value of a template variable used by the prompt.";
525
+ readonly inputSchema: {
526
+ readonly type: "object";
527
+ readonly properties: {
528
+ readonly name: {
529
+ readonly type: "string";
530
+ readonly minLength: 1;
531
+ readonly description: "Variable name.";
532
+ };
533
+ readonly value: {
534
+ readonly description: "Variable value (any JSON value).";
535
+ };
536
+ };
537
+ readonly required: readonly ["name", "value"];
538
+ readonly additionalProperties: false;
539
+ };
540
+ };
541
+ declare const MCP_TOOL_PROMPT_SELECT: {
542
+ readonly name: "prompt_select";
543
+ readonly title: "Select prompt text";
544
+ readonly annotations: {
545
+ readonly readOnlyHint: false;
546
+ readonly destructiveHint: false;
547
+ readonly idempotentHint: true;
548
+ readonly openWorldHint: false;
549
+ readonly title: "Select prompt text";
550
+ };
551
+ readonly description: "Selects the prompt text between two positions (from === to places the cursor).";
552
+ readonly inputSchema: {
553
+ readonly type: "object";
554
+ readonly properties: {
555
+ readonly from: {
556
+ readonly description: "Start position.";
557
+ readonly type: "integer";
558
+ readonly minimum: 0;
559
+ };
560
+ readonly to: {
561
+ readonly description: "End position (>= from).";
562
+ readonly type: "integer";
563
+ readonly minimum: 0;
564
+ };
565
+ };
566
+ readonly required: readonly ["from", "to"];
567
+ readonly additionalProperties: false;
568
+ };
569
+ };
570
+ /** Per-operation canvas tools, the strict alternative to `edit_canvas`. */
571
+ declare const EDITOR_CANVAS_TOOLS: readonly [{
572
+ readonly name: "canvas_add_node";
573
+ readonly title: "Add a canvas node";
574
+ readonly annotations: {
575
+ readonly readOnlyHint: false;
576
+ readonly destructiveHint: false;
577
+ readonly idempotentHint: false;
578
+ readonly openWorldHint: false;
579
+ readonly title: "Add a canvas node";
580
+ };
581
+ readonly description: string;
582
+ readonly inputSchema: {
583
+ readonly type: "object";
584
+ readonly properties: {
585
+ readonly node: {
586
+ readonly type: "object";
587
+ readonly description: "The node. Extra host-specific fields are kept.";
588
+ readonly properties: {
589
+ readonly id: {
590
+ readonly type: "string";
591
+ readonly minLength: 1;
592
+ readonly description: "Node id (default: generated). Must be unused.";
593
+ };
594
+ readonly type: {
595
+ readonly type: "string";
596
+ readonly description: "Node type registered by the host.";
597
+ };
598
+ readonly data: {
599
+ readonly type: "object";
600
+ readonly description: "Node data (e.g. { \"label\": \"...\" }).";
601
+ };
602
+ readonly position: {
603
+ readonly description: "Canvas coordinates (default: auto-placed).";
604
+ readonly type: "object";
605
+ readonly properties: {
606
+ readonly x: {
607
+ readonly type: "number";
608
+ };
609
+ readonly y: {
610
+ readonly type: "number";
611
+ };
612
+ };
613
+ readonly required: readonly ["x", "y"];
614
+ readonly additionalProperties: false;
615
+ };
616
+ readonly width: {
617
+ readonly type: "number";
618
+ readonly exclusiveMinimum: 0;
619
+ };
620
+ readonly height: {
621
+ readonly type: "number";
622
+ readonly exclusiveMinimum: 0;
623
+ };
624
+ readonly parentId: {
625
+ readonly type: "string";
626
+ readonly description: "Parent (group/frame) node id.";
627
+ };
628
+ };
629
+ };
630
+ readonly nearNodeId: {
631
+ readonly type: "string";
632
+ readonly description: "Existing node to place the new node beside and connect from.";
633
+ };
634
+ readonly side: {
635
+ readonly type: "string";
636
+ readonly enum: readonly ["top", "right", "bottom", "left"];
637
+ readonly description: "Side of `nearNodeId` to place the node on (default right).";
638
+ };
639
+ };
640
+ readonly required: readonly ["node"];
641
+ readonly additionalProperties: false;
642
+ };
643
+ }, {
644
+ readonly name: "canvas_remove_nodes";
645
+ readonly title: "Remove canvas nodes";
646
+ readonly annotations: {
647
+ readonly readOnlyHint: false;
648
+ readonly destructiveHint: true;
649
+ readonly idempotentHint: false;
650
+ readonly openWorldHint: false;
651
+ readonly title: "Remove canvas nodes";
652
+ };
653
+ readonly description: "Removes nodes (and their edges) from the canvas. Every id must exist.";
654
+ readonly inputSchema: {
655
+ readonly type: "object";
656
+ readonly properties: {
657
+ readonly nodeIds: {
658
+ readonly type: "array";
659
+ readonly items: {
660
+ readonly type: "string";
661
+ readonly minLength: 1;
662
+ };
663
+ readonly minItems: 1;
664
+ readonly uniqueItems: true;
665
+ readonly description: "Node ids (from get_editor_state).";
666
+ };
667
+ };
668
+ readonly required: readonly ["nodeIds"];
669
+ readonly additionalProperties: false;
670
+ };
671
+ }, {
672
+ readonly name: "canvas_connect";
673
+ readonly title: "Connect canvas nodes";
674
+ readonly annotations: {
675
+ readonly readOnlyHint: false;
676
+ readonly destructiveHint: false;
677
+ readonly idempotentHint: false;
678
+ readonly openWorldHint: false;
679
+ readonly title: "Connect canvas nodes";
680
+ };
681
+ readonly description: "Adds an edge from one existing node to another. Returns the new edge id.";
682
+ readonly inputSchema: {
683
+ readonly type: "object";
684
+ readonly properties: {
685
+ readonly source: {
686
+ readonly type: "string";
687
+ readonly minLength: 1;
688
+ readonly description: "Source node id.";
689
+ };
690
+ readonly target: {
691
+ readonly type: "string";
692
+ readonly minLength: 1;
693
+ readonly description: "Target node id.";
694
+ };
695
+ readonly label: {
696
+ readonly type: "string";
697
+ readonly description: "Edge label.";
698
+ };
699
+ };
700
+ readonly required: readonly ["source", "target"];
701
+ readonly additionalProperties: false;
702
+ };
703
+ }, {
704
+ readonly name: "canvas_update_node";
705
+ readonly title: "Update a canvas node";
706
+ readonly annotations: {
707
+ readonly idempotentHint: true;
708
+ readonly readOnlyHint: false;
709
+ readonly destructiveHint: true;
710
+ readonly openWorldHint: false;
711
+ readonly title: "Update a canvas node";
712
+ };
713
+ readonly description: "Merges fields into an existing node's data.";
714
+ readonly inputSchema: {
715
+ readonly type: "object";
716
+ readonly properties: {
717
+ readonly id: {
718
+ readonly type: "string";
719
+ readonly minLength: 1;
720
+ readonly description: "Node id.";
721
+ };
722
+ readonly data: {
723
+ readonly type: "object";
724
+ readonly description: "Data fields to merge (e.g. { \"label\": \"New\" }).";
725
+ };
726
+ };
727
+ readonly required: readonly ["id", "data"];
728
+ readonly additionalProperties: false;
729
+ };
730
+ }, {
731
+ readonly name: "canvas_layout";
732
+ readonly title: "Lay out the canvas";
733
+ readonly annotations: {
734
+ readonly readOnlyHint: false;
735
+ readonly destructiveHint: false;
736
+ readonly idempotentHint: true;
737
+ readonly openWorldHint: false;
738
+ readonly title: "Lay out the canvas";
739
+ };
740
+ readonly description: "Arranges the canvas graph automatically.";
741
+ readonly inputSchema: {
742
+ readonly type: "object";
743
+ readonly properties: {
744
+ readonly direction: {
745
+ readonly type: "string";
746
+ readonly enum: readonly ["LR", "TB", "RL", "BT"];
747
+ readonly description: "Layout direction (default LR).";
748
+ };
749
+ readonly incremental: {
750
+ readonly type: "boolean";
751
+ readonly description: "Keep nodes that already have a position where they are (default true).";
752
+ };
753
+ };
754
+ readonly additionalProperties: false;
755
+ };
756
+ }, {
757
+ readonly name: "canvas_select";
758
+ readonly title: "Select canvas nodes";
759
+ readonly annotations: {
760
+ readonly readOnlyHint: false;
761
+ readonly destructiveHint: false;
762
+ readonly idempotentHint: true;
763
+ readonly openWorldHint: false;
764
+ readonly title: "Select canvas nodes";
765
+ };
766
+ readonly description: "Replaces the canvas selection with these nodes (an empty list clears it).";
767
+ readonly inputSchema: {
768
+ readonly type: "object";
769
+ readonly properties: {
770
+ readonly nodeIds: {
771
+ readonly minItems: 0;
772
+ readonly type: "array";
773
+ readonly items: {
774
+ readonly type: "string";
775
+ readonly minLength: 1;
776
+ };
777
+ readonly uniqueItems: true;
778
+ readonly description: "Node ids (from get_editor_state).";
779
+ };
780
+ };
781
+ readonly required: readonly ["nodeIds"];
782
+ readonly additionalProperties: false;
783
+ };
784
+ }, {
785
+ readonly name: "canvas_highlight";
786
+ readonly title: "Highlight canvas nodes";
787
+ readonly annotations: {
788
+ readonly readOnlyHint: false;
789
+ readonly destructiveHint: false;
790
+ readonly idempotentHint: true;
791
+ readonly openWorldHint: false;
792
+ readonly title: "Highlight canvas nodes";
793
+ };
794
+ readonly description: "Briefly highlights nodes to draw the user's attention to them.";
795
+ readonly inputSchema: {
796
+ readonly type: "object";
797
+ readonly properties: {
798
+ readonly nodeIds: {
799
+ readonly type: "array";
800
+ readonly items: {
801
+ readonly type: "string";
802
+ readonly minLength: 1;
803
+ };
804
+ readonly minItems: 1;
805
+ readonly uniqueItems: true;
806
+ readonly description: "Node ids (from get_editor_state).";
807
+ };
808
+ readonly color: {
809
+ readonly type: "string";
810
+ readonly description: "CSS color (default #3b82f6).";
811
+ };
812
+ readonly durationMs: {
813
+ readonly type: "integer";
814
+ readonly minimum: 0;
815
+ readonly maximum: 60000;
816
+ readonly description: "Duration in ms (default 2000).";
817
+ };
818
+ };
819
+ readonly required: readonly ["nodeIds"];
820
+ readonly additionalProperties: false;
821
+ };
822
+ }];
823
+ /** Per-operation prompt tools, the strict alternative to `edit_prompt`. */
824
+ declare const EDITOR_PROMPT_TOOLS: readonly [{
825
+ readonly name: "prompt_insert_text";
826
+ readonly title: "Insert prompt text";
827
+ readonly annotations: {
828
+ readonly readOnlyHint: false;
829
+ readonly destructiveHint: false;
830
+ readonly idempotentHint: false;
831
+ readonly openWorldHint: false;
832
+ readonly title: "Insert prompt text";
833
+ };
834
+ readonly description: "Inserts text into the prompt at a position, or at the cursor when `at` is omitted.";
835
+ readonly inputSchema: {
836
+ readonly type: "object";
837
+ readonly properties: {
838
+ readonly text: {
839
+ readonly type: "string";
840
+ readonly description: "Text to insert.";
841
+ };
842
+ readonly at: {
843
+ readonly description: "Position (as in get_editor_state `document.selection`).";
844
+ readonly type: "integer";
845
+ readonly minimum: 0;
846
+ };
847
+ };
848
+ readonly required: readonly ["text"];
849
+ readonly additionalProperties: false;
850
+ };
851
+ }, {
852
+ readonly name: "prompt_replace_range";
853
+ readonly title: "Replace prompt text";
854
+ readonly annotations: {
855
+ readonly readOnlyHint: false;
856
+ readonly destructiveHint: true;
857
+ readonly idempotentHint: false;
858
+ readonly openWorldHint: false;
859
+ readonly title: "Replace prompt text";
860
+ };
861
+ readonly description: "Replaces the prompt text between two positions (an empty text deletes it).";
862
+ readonly inputSchema: {
863
+ readonly type: "object";
864
+ readonly properties: {
865
+ readonly from: {
866
+ readonly description: "Start position.";
867
+ readonly type: "integer";
868
+ readonly minimum: 0;
869
+ };
870
+ readonly to: {
871
+ readonly description: "End position (>= from).";
872
+ readonly type: "integer";
873
+ readonly minimum: 0;
874
+ };
875
+ readonly text: {
876
+ readonly type: "string";
877
+ readonly description: "Replacement text.";
878
+ };
879
+ };
880
+ readonly required: readonly ["from", "to", "text"];
881
+ readonly additionalProperties: false;
882
+ };
883
+ }, {
884
+ readonly name: "prompt_set_variable";
885
+ readonly title: "Set a prompt variable";
886
+ readonly annotations: {
887
+ readonly idempotentHint: true;
888
+ readonly readOnlyHint: false;
889
+ readonly destructiveHint: true;
890
+ readonly openWorldHint: false;
891
+ readonly title: "Set a prompt variable";
892
+ };
893
+ readonly description: "Sets the value of a template variable used by the prompt.";
894
+ readonly inputSchema: {
895
+ readonly type: "object";
896
+ readonly properties: {
897
+ readonly name: {
898
+ readonly type: "string";
899
+ readonly minLength: 1;
900
+ readonly description: "Variable name.";
901
+ };
902
+ readonly value: {
903
+ readonly description: "Variable value (any JSON value).";
904
+ };
905
+ };
906
+ readonly required: readonly ["name", "value"];
907
+ readonly additionalProperties: false;
908
+ };
909
+ }, {
910
+ readonly name: "prompt_select";
911
+ readonly title: "Select prompt text";
912
+ readonly annotations: {
913
+ readonly readOnlyHint: false;
914
+ readonly destructiveHint: false;
915
+ readonly idempotentHint: true;
916
+ readonly openWorldHint: false;
917
+ readonly title: "Select prompt text";
918
+ };
919
+ readonly description: "Selects the prompt text between two positions (from === to places the cursor).";
920
+ readonly inputSchema: {
921
+ readonly type: "object";
922
+ readonly properties: {
923
+ readonly from: {
924
+ readonly description: "Start position.";
925
+ readonly type: "integer";
926
+ readonly minimum: 0;
927
+ };
928
+ readonly to: {
929
+ readonly description: "End position (>= from).";
930
+ readonly type: "integer";
931
+ readonly minimum: 0;
932
+ };
933
+ };
934
+ readonly required: readonly ["from", "to"];
935
+ readonly additionalProperties: false;
936
+ };
937
+ }];
938
+ /**
939
+ * Arguments each `edit_canvas` / `edit_prompt` operation needs, used to tell
940
+ * an agent exactly what is missing (the combined schemas cannot express it).
941
+ */
942
+ declare const EDIT_OPERATION_REQUIRED_ARGUMENTS: Readonly<Record<'edit_canvas' | 'edit_prompt', Readonly<Record<string, readonly string[]>>>>;
174
943
  /**
175
944
  * CSS selectors for ephemeral UI overlays (such as agent cursors, presence tags, and transient bubbles)
176
945
  * that should be excluded during canvas image export and visual snapshot generation.
@@ -210,7 +979,7 @@ declare const EDITOR_MCP_TOOLS: readonly [{
210
979
  readonly idempotentHint: false;
211
980
  readonly openWorldHint: false;
212
981
  };
213
- readonly description: "Applies high-level structural operations to the visual canvas (adding nodes, connecting edges, organizing layout, or moving elements).";
982
+ readonly description: string;
214
983
  readonly inputSchema: {
215
984
  readonly type: "object";
216
985
  readonly properties: {
@@ -239,6 +1008,23 @@ declare const EDITOR_MCP_TOOLS: readonly [{
239
1008
  };
240
1009
  readonly description: "Array of node IDs for remove_nodes, select, or highlight.";
241
1010
  };
1011
+ readonly id: {
1012
+ readonly type: "string";
1013
+ readonly description: "Node ID for update_node (or pass `node: { id, data }`).";
1014
+ };
1015
+ readonly data: {
1016
+ readonly type: "object";
1017
+ readonly description: "Data fields to merge into the node for update_node.";
1018
+ };
1019
+ readonly color: {
1020
+ readonly type: "string";
1021
+ readonly description: "CSS color for highlight (default #3b82f6).";
1022
+ };
1023
+ readonly durationMs: {
1024
+ readonly type: "integer";
1025
+ readonly minimum: 0;
1026
+ readonly description: "How long the highlight lasts in ms (default 2000).";
1027
+ };
242
1028
  readonly source: {
243
1029
  readonly type: "string";
244
1030
  readonly description: "Source node ID for connect operation.";
@@ -287,15 +1073,18 @@ declare const EDITOR_MCP_TOOLS: readonly [{
287
1073
  readonly description: "Text to insert or replace.";
288
1074
  };
289
1075
  readonly at: {
290
- readonly type: "number";
1076
+ readonly type: "integer";
1077
+ readonly minimum: 0;
291
1078
  readonly description: "Position to insert text at.";
292
1079
  };
293
1080
  readonly from: {
294
- readonly type: "number";
1081
+ readonly type: "integer";
1082
+ readonly minimum: 0;
295
1083
  readonly description: "Start offset for replace_range or select.";
296
1084
  };
297
1085
  readonly to: {
298
- readonly type: "number";
1086
+ readonly type: "integer";
1087
+ readonly minimum: 0;
299
1088
  readonly description: "End offset for replace_range or select.";
300
1089
  };
301
1090
  readonly name: {
@@ -340,4 +1129,75 @@ declare const EDITOR_MCP_TOOLS: readonly [{
340
1129
  };
341
1130
  }];
342
1131
 
343
- export { EDITOR_MCP_TOOLS, EXPORT_EXCLUDED_SELECTORS, MCP_TOOL_EDIT_CANVAS, MCP_TOOL_EDIT_PROMPT, MCP_TOOL_GET_EDITOR_STATE, MCP_TOOL_VIEW_EDITOR };
1132
+ /** MCP protocol revisions this server speaks, newest first. */
1133
+ declare const MCP_PROTOCOL_VERSIONS: readonly ["2025-06-18", "2025-03-26", "2024-11-05"];
1134
+ type JsonRpcId = string | number;
1135
+ interface JsonRpcRequest {
1136
+ jsonrpc: '2.0';
1137
+ id?: JsonRpcId | null;
1138
+ method: string;
1139
+ params?: Record<string, any>;
1140
+ }
1141
+ interface JsonRpcResponse {
1142
+ jsonrpc: '2.0';
1143
+ id: JsonRpcId | null;
1144
+ result?: unknown;
1145
+ error?: {
1146
+ code: number;
1147
+ message: string;
1148
+ data?: unknown;
1149
+ };
1150
+ }
1151
+ interface JsonRpcNotification {
1152
+ jsonrpc: '2.0';
1153
+ method: string;
1154
+ params?: Record<string, unknown>;
1155
+ }
1156
+ /** Standard JSON-RPC error codes used by the server. */
1157
+ declare const JSON_RPC_ERRORS: {
1158
+ readonly parseError: -32700;
1159
+ readonly invalidRequest: -32600;
1160
+ readonly methodNotFound: -32601;
1161
+ readonly invalidParams: -32602;
1162
+ readonly internalError: -32603;
1163
+ };
1164
+ interface McpServerOptions {
1165
+ /** `serverInfo` sent in the `initialize` result. */
1166
+ name: string;
1167
+ version: string;
1168
+ title?: string;
1169
+ /** Usage hints for the client's model, sent in the `initialize` result. */
1170
+ instructions?: string;
1171
+ /**
1172
+ * Sends server → client messages (`notifications/tools/list_changed`).
1173
+ * Without it the server still answers requests but announces nothing.
1174
+ */
1175
+ send?: (message: JsonRpcNotification) => void;
1176
+ }
1177
+ interface McpServer {
1178
+ /**
1179
+ * Handles one client message (a JSON string or a parsed object) and
1180
+ * resolves to the response to send back, or `null` for notifications.
1181
+ * Never rejects.
1182
+ */
1183
+ handle(message: string | JsonRpcRequest): Promise<JsonRpcResponse | null>;
1184
+ /** Whether the client has completed the `initialize` handshake. */
1185
+ readonly initialized: boolean;
1186
+ /** Stops list-changed notifications and aborts running tool calls. */
1187
+ close(): void;
1188
+ }
1189
+ /**
1190
+ * A transport-agnostic MCP server for a {@link ToolRegistry}: wire `handle`
1191
+ * to any transport (stdio lines, a WebSocket, `postMessage`, an HTTP POST
1192
+ * handler) and pass `send` for server → client notifications.
1193
+ *
1194
+ * Supports `initialize` (with protocol version negotiation), `ping`,
1195
+ * `tools/list`, `tools/call` and `notifications/cancelled` (aborts the
1196
+ * call's `signal`), and announces `notifications/tools/list_changed` after
1197
+ * the client sends `notifications/initialized`. An unknown tool is a
1198
+ * JSON-RPC `-32602` error, as the MCP spec asks; invalid arguments and
1199
+ * handler failures are `isError` tool results the model can read and fix.
1200
+ */
1201
+ declare function createMcpServer(registry: ToolRegistry, options: McpServerOptions): McpServer;
1202
+
1203
+ export { EDITOR_CANVAS_TOOLS, EDITOR_MCP_TOOLS, EDITOR_PROMPT_TOOLS, EDIT_OPERATION_REQUIRED_ARGUMENTS, EXPORT_EXCLUDED_SELECTORS, JSON_RPC_ERRORS, type JsonRpcId, type JsonRpcNotification, type JsonRpcRequest, type JsonRpcResponse, MCP_PROTOCOL_VERSIONS, MCP_TOOL_CANVAS_ADD_NODE, MCP_TOOL_CANVAS_CONNECT, MCP_TOOL_CANVAS_HIGHLIGHT, MCP_TOOL_CANVAS_LAYOUT, MCP_TOOL_CANVAS_REMOVE_NODES, MCP_TOOL_CANVAS_SELECT, MCP_TOOL_CANVAS_UPDATE_NODE, MCP_TOOL_EDIT_CANVAS, MCP_TOOL_EDIT_PROMPT, MCP_TOOL_GET_EDITOR_STATE, MCP_TOOL_PROMPT_INSERT_TEXT, MCP_TOOL_PROMPT_REPLACE_RANGE, MCP_TOOL_PROMPT_SELECT, MCP_TOOL_PROMPT_SET_VARIABLE, MCP_TOOL_VIEW_EDITOR, type McpServer, type McpServerOptions, ToolRegistry, createMcpServer };