@pixerate/editor 0.139.1 → 0.140.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 (152) hide show
  1. package/README.md +25 -4
  2. package/dist/agent/formatTools.d.cts +15 -0
  3. package/dist/agent/formatTools.d.ts +15 -0
  4. package/dist/agent/index.cjs +408 -49
  5. package/dist/agent/index.js +375 -16
  6. package/dist/agent/providers.d.cts +5 -3
  7. package/dist/agent/providers.d.ts +5 -3
  8. package/dist/animation-editor/effect-tools.d.cts +1 -1
  9. package/dist/animation-editor/effect-tools.d.ts +1 -1
  10. package/dist/animation-editor/index.cjs +250 -116
  11. package/dist/animation-editor/index.js +228 -94
  12. package/dist/animation-editor/instructions.d.cts +1 -1
  13. package/dist/animation-editor/instructions.d.ts +1 -1
  14. package/dist/animation-editor/parse.d.cts +3 -1
  15. package/dist/animation-editor/parse.d.ts +3 -1
  16. package/dist/animation-editor/tools.d.cts +8 -3
  17. package/dist/animation-editor/tools.d.ts +8 -3
  18. package/dist/bridge/cli.cjs +4 -3
  19. package/dist/bridge/cli.js +3 -2
  20. package/dist/bridge/index.cjs +8 -3
  21. package/dist/bridge/index.d.cts +7 -0
  22. package/dist/bridge/index.d.ts +7 -0
  23. package/dist/bridge/index.js +9 -4
  24. package/dist/bridge/skills.d.cts +9 -0
  25. package/dist/bridge/skills.d.ts +9 -0
  26. package/dist/canvas/effect-tools.d.cts +1 -1
  27. package/dist/canvas/effect-tools.d.ts +1 -1
  28. package/dist/canvas/index.cjs +22 -17
  29. package/dist/canvas/index.js +8 -3
  30. package/dist/chart/file-tools.d.cts +1 -1
  31. package/dist/chart/file-tools.d.ts +1 -1
  32. package/dist/chart/index.cjs +7 -1
  33. package/dist/chart/index.js +7 -1
  34. package/dist/chart/tools.d.cts +1 -1
  35. package/dist/chart/tools.d.ts +1 -1
  36. package/dist/chunk-2BSBFBOA.cjs +46 -0
  37. package/dist/{chunk-SWZTQWY7.js → chunk-2INPJDNY.js} +1 -1
  38. package/dist/{chunk-CCKP4XAN.cjs → chunk-34RQAGWI.cjs} +27 -7
  39. package/dist/{chunk-HXCBQ7A6.cjs → chunk-3AJMR7EG.cjs} +7 -4
  40. package/dist/{chunk-BKMU3V6K.js → chunk-5ED73EC6.js} +8 -1
  41. package/dist/{chunk-NKBUVQJW.cjs → chunk-5WOY52O6.cjs} +15 -15
  42. package/dist/{chunk-VRIR53SW.js → chunk-6GAYGQDC.js} +10 -8
  43. package/dist/{chunk-HZZXBTLB.js → chunk-6IN474P4.js} +25 -5
  44. package/dist/{chunk-KHMVB3SJ.js → chunk-7KWJEYIK.js} +4 -1
  45. package/dist/{chunk-R47NQICB.cjs → chunk-AGCD3EHB.cjs} +47 -10
  46. package/dist/{chunk-6I63VZ45.js → chunk-CXXKJBQZ.js} +5 -1
  47. package/dist/{chunk-6NXVDJDR.cjs → chunk-G43MNQ4C.cjs} +5 -5
  48. package/dist/chunk-HDK3T2QS.cjs +1159 -0
  49. package/dist/chunk-HF5QZS7Z.js +46 -0
  50. package/dist/{chunk-S7I3RI5Z.cjs → chunk-HMGWFXEC.cjs} +27 -24
  51. package/dist/{chunk-6NCBFBXA.js → chunk-IQ6KKXOU.js} +1 -1
  52. package/dist/{chunk-T6Y5FV7G.cjs → chunk-L434J57V.cjs} +10 -8
  53. package/dist/{chunk-UCRL6JEV.cjs → chunk-L5OWG2NA.cjs} +8 -3
  54. package/dist/{chunk-CZRWP6IW.cjs → chunk-N2FGYZ4Q.cjs} +8 -1
  55. package/dist/{chunk-GUPQ5BNA.cjs → chunk-PUR6BZFA.cjs} +112 -111
  56. package/dist/chunk-RB62U6MS.js +1159 -0
  57. package/dist/{chunk-3V746PF4.cjs → chunk-RUZQMYXH.cjs} +4 -1
  58. package/dist/{chunk-HGHXGCKG.cjs → chunk-SVFEVKLF.cjs} +1 -1
  59. package/dist/{chunk-PCNCT4ZY.js → chunk-UMS6YFA6.js} +40 -3
  60. package/dist/{chunk-4LGWAJDI.js → chunk-V5OOP74P.js} +5 -2
  61. package/dist/{chunk-BWT4IWLK.cjs → chunk-VKF3PWKR.cjs} +7 -7
  62. package/dist/{chunk-PQMADRCI.js → chunk-WBJ6BG4R.js} +23 -22
  63. package/dist/{chunk-WIYAOZZU.js → chunk-WHKNYFM2.js} +7 -2
  64. package/dist/{chunk-TBSPPVTT.js → chunk-XCK7QK5D.js} +1 -1
  65. package/dist/{chunk-F652BKMS.cjs → chunk-YN6JKAUE.cjs} +6 -2
  66. package/dist/{chunk-YTGF4TJR.js → chunk-ZLZKGHSZ.js} +5 -2
  67. package/dist/{chunk-USU2FL3N.js → chunk-ZNHB5RG6.js} +1 -1
  68. package/dist/commands/agentTools.d.cts +1 -1
  69. package/dist/commands/agentTools.d.ts +1 -1
  70. package/dist/commands/index.cjs +3 -0
  71. package/dist/commands/index.js +3 -0
  72. package/dist/compare/index.cjs +4 -3
  73. package/dist/compare/index.js +3 -2
  74. package/dist/diagram/index.cjs +3 -0
  75. package/dist/diagram/index.js +3 -0
  76. package/dist/diagram/tools.d.cts +1 -1
  77. package/dist/diagram/tools.d.ts +1 -1
  78. package/dist/effects/index.cjs +32 -32
  79. package/dist/effects/index.js +1 -1
  80. package/dist/effects/tools.d.cts +5 -1
  81. package/dist/effects/tools.d.ts +5 -1
  82. package/dist/export/index.cjs +4 -3
  83. package/dist/export/index.js +3 -2
  84. package/dist/extensions/index.cjs +11 -8
  85. package/dist/extensions/index.d.cts +1 -0
  86. package/dist/extensions/index.d.ts +1 -0
  87. package/dist/extensions/index.js +10 -7
  88. package/dist/extensions/safe-merge-attributes.d.cts +10 -0
  89. package/dist/extensions/safe-merge-attributes.d.ts +10 -0
  90. package/dist/generation/index.cjs +7 -1
  91. package/dist/generation/index.js +7 -1
  92. package/dist/image-editor/index.cjs +25 -18
  93. package/dist/image-editor/index.js +10 -3
  94. package/dist/image-editor/provider-effect-tools.d.cts +1 -1
  95. package/dist/image-editor/provider-effect-tools.d.ts +1 -1
  96. package/dist/image-editor/tools.d.cts +1 -1
  97. package/dist/image-editor/tools.d.ts +1 -1
  98. package/dist/index.cjs +42 -29
  99. package/dist/index.d.cts +1 -0
  100. package/dist/index.d.ts +1 -0
  101. package/dist/index.js +22 -9
  102. package/dist/paint-editor/effect-tools.d.cts +1 -1
  103. package/dist/paint-editor/effect-tools.d.ts +1 -1
  104. package/dist/paint-editor/index.cjs +18 -8
  105. package/dist/paint-editor/index.js +13 -3
  106. package/dist/paint-editor/tools.d.cts +1 -1
  107. package/dist/paint-editor/tools.d.ts +1 -1
  108. package/dist/persistence/index.cjs +3 -2
  109. package/dist/persistence/index.js +2 -1
  110. package/dist/serializers/index.cjs +5 -4
  111. package/dist/serializers/index.js +4 -3
  112. package/dist/tools/bridge-client.d.cts +3 -3
  113. package/dist/tools/bridge-client.d.ts +3 -3
  114. package/dist/tools/capture.d.cts +5 -1
  115. package/dist/tools/capture.d.ts +5 -1
  116. package/dist/tools/definitions.d.cts +2 -2
  117. package/dist/tools/definitions.d.ts +2 -2
  118. package/dist/tools/index.cjs +39 -5
  119. package/dist/tools/index.d.cts +4 -0
  120. package/dist/tools/index.d.ts +4 -0
  121. package/dist/tools/index.js +39 -5
  122. package/dist/tools/mcp-server.d.cts +24 -6
  123. package/dist/tools/mcp-server.d.ts +24 -6
  124. package/dist/tools/registry.d.cts +81 -6
  125. package/dist/tools/registry.d.ts +81 -6
  126. package/dist/tools/safe-json.d.cts +27 -0
  127. package/dist/tools/safe-json.d.ts +27 -0
  128. package/dist/tools/search.d.cts +30 -0
  129. package/dist/tools/search.d.ts +30 -0
  130. package/dist/tools/skills.d.cts +26 -0
  131. package/dist/tools/skills.d.ts +26 -0
  132. package/dist/tools/view.d.cts +95 -0
  133. package/dist/tools/view.d.ts +95 -0
  134. package/dist/vector/effect-tools.d.cts +1 -1
  135. package/dist/vector/effect-tools.d.ts +1 -1
  136. package/dist/vector/index.cjs +13 -7
  137. package/dist/vector/index.js +8 -2
  138. package/dist/video-editor/effect-tools.d.cts +1 -1
  139. package/dist/video-editor/effect-tools.d.ts +1 -1
  140. package/dist/video-editor/index.cjs +275 -269
  141. package/dist/video-editor/index.js +8 -2
  142. package/dist/video-editor/tools.d.cts +1 -1
  143. package/dist/video-editor/tools.d.ts +1 -1
  144. package/package.json +31 -29
  145. package/skills/README.md +8 -3
  146. package/skills/pixerate-agent-tools/SKILL.md +33 -7
  147. package/skills/pixerate-animation-editor/SKILL.md +7 -0
  148. package/skills/pixerate-rich-text/SKILL.md +18 -4
  149. package/dist/chunk-5RRYDFU2.js +0 -466
  150. package/dist/chunk-SPVIXXIB.cjs +0 -466
  151. /package/dist/{chunk-SMJK5HBJ.js → chunk-K73HMKQP.js} +0 -0
  152. /package/dist/{chunk-DDF6WQ62.cjs → chunk-LACYURUW.cjs} +0 -0
@@ -12,7 +12,7 @@ var _chunkGLQQ2VILcjs = require('../chunk-GLQQ2VIL.cjs');
12
12
 
13
13
  var _chunkMRD3NXKRcjs = require('../chunk-MRD3NXKR.cjs');
14
14
  require('../chunk-4EFNS2HV.cjs');
15
- require('../chunk-DDF6WQ62.cjs');
15
+ require('../chunk-LACYURUW.cjs');
16
16
 
17
17
 
18
18
 
@@ -25,7 +25,6 @@ require('../chunk-DDF6WQ62.cjs');
25
25
 
26
26
 
27
27
 
28
- var _chunkSPVIXXIBcjs = require('../chunk-SPVIXXIB.cjs');
29
28
 
30
29
 
31
30
 
@@ -39,6 +38,7 @@ var _chunkSPVIXXIBcjs = require('../chunk-SPVIXXIB.cjs');
39
38
 
40
39
 
41
40
 
41
+ var _chunkHDK3T2QScjs = require('../chunk-HDK3T2QS.cjs');
42
42
 
43
43
 
44
44
 
@@ -53,7 +53,6 @@ var _chunkSPVIXXIBcjs = require('../chunk-SPVIXXIB.cjs');
53
53
 
54
54
 
55
55
 
56
- var _chunkHGHXGCKGcjs = require('../chunk-HGHXGCKG.cjs');
57
56
 
58
57
 
59
58
 
@@ -62,12 +61,12 @@ var _chunkHGHXGCKGcjs = require('../chunk-HGHXGCKG.cjs');
62
61
 
63
62
 
64
63
 
65
- var _chunkCZRWP6IWcjs = require('../chunk-CZRWP6IW.cjs');
66
64
 
67
65
 
68
66
 
69
67
 
70
68
 
69
+ var _chunkSVFEVKLFcjs = require('../chunk-SVFEVKLF.cjs');
71
70
 
72
71
 
73
72
 
@@ -76,6 +75,7 @@ var _chunkCZRWP6IWcjs = require('../chunk-CZRWP6IW.cjs');
76
75
 
77
76
 
78
77
 
78
+ var _chunkN2FGYZ4Qcjs = require('../chunk-N2FGYZ4Q.cjs');
79
79
 
80
80
 
81
81
 
@@ -83,7 +83,20 @@ var _chunkCZRWP6IWcjs = require('../chunk-CZRWP6IW.cjs');
83
83
 
84
84
 
85
85
 
86
- var _chunkT6Y5FV7Gcjs = require('../chunk-T6Y5FV7G.cjs');
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+ var _chunkL434J57Vcjs = require('../chunk-L434J57V.cjs');
87
100
 
88
101
 
89
102
  var _chunkXQ33O5BCcjs = require('../chunk-XQ33O5BC.cjs');
@@ -95,9 +108,14 @@ var _chunkUR37VCIRcjs = require('../chunk-UR37VCIR.cjs');
95
108
 
96
109
 
97
110
 
98
- var _chunk6NXVDJDRcjs = require('../chunk-6NXVDJDR.cjs');
111
+ var _chunkG43MNQ4Ccjs = require('../chunk-G43MNQ4C.cjs');
99
112
  require('../chunk-JG5VGCKP.cjs');
100
- require('../chunk-CCKP4XAN.cjs');
113
+ require('../chunk-34RQAGWI.cjs');
114
+
115
+
116
+
117
+
118
+ var _chunk2BSBFBOAcjs = require('../chunk-2BSBFBOA.cjs');
101
119
 
102
120
 
103
121
 
@@ -439,9 +457,10 @@ function planToolCall(name, args, snapshot, options) {
439
457
 
440
458
  // src/agent/providers.ts
441
459
  var _state = require('@tiptap/pm/state');
460
+ var _history = require('@tiptap/pm/history');
442
461
 
443
462
  // src/agent/documentChartTools.ts
444
- var _history = require('@tiptap/pm/history');
463
+
445
464
  var READ = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
446
465
  var WRITE = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false };
447
466
  var WRITE_IDEMPOTENT = { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false };
@@ -493,7 +512,7 @@ function describe(chart, includeSpec) {
493
512
  function sparklines(doc) {
494
513
  const found = [];
495
514
  doc.descendants((node, pos) => {
496
- if (node.type.name === "sparkline") found.push({ pos, kind: node.attrs.kind, values: node.attrs.values, label: _chunkT6Y5FV7Gcjs.sparklineLabel.call(void 0, node) });
515
+ if (node.type.name === "sparkline") found.push({ pos, kind: node.attrs.kind, values: node.attrs.values, label: _chunkL434J57Vcjs.sparklineLabel.call(void 0, node) });
497
516
  });
498
517
  return found;
499
518
  }
@@ -504,7 +523,7 @@ function checkPosition(editor, at) {
504
523
  function createDocumentChartTools(editor) {
505
524
  const chartType = () => editor().schema.nodes.chart;
506
525
  const findChart = (args) => {
507
- const charts = _chunkT6Y5FV7Gcjs.getDocumentCharts.call(void 0, editor().state.doc);
526
+ const charts = _chunkL434J57Vcjs.getDocumentCharts.call(void 0, editor().state.doc);
508
527
  const list = charts.map((c) => `"${c.id}" at ${c.pos}`).join(", ") || "none; add one with insert_chart";
509
528
  if (args.chartId !== void 0) {
510
529
  const chart = charts.find((c) => c.id === args.chartId);
@@ -531,7 +550,7 @@ function createDocumentChartTools(editor) {
531
550
  annotations: { title: "List charts in the document", ...READ },
532
551
  handler: ({ includeSpec = false }) => {
533
552
  const doc = editor().state.doc;
534
- return { charts: _chunkT6Y5FV7Gcjs.getDocumentCharts.call(void 0, doc).map((c) => describe(c, includeSpec)), sparklines: editor().schema.nodes.sparkline ? sparklines(doc) : [] };
553
+ return { charts: _chunkL434J57Vcjs.getDocumentCharts.call(void 0, doc).map((c) => describe(c, includeSpec)), sparklines: editor().schema.nodes.sparkline ? sparklines(doc) : [] };
535
554
  }
536
555
  };
537
556
  const insertChart = {
@@ -558,7 +577,7 @@ function createDocumentChartTools(editor) {
558
577
  const node = { type: "chart", attrs: { id, spec, width, ...height !== void 0 ? { height } : {} } };
559
578
  const chain = ed.chain().command(({ tr }) => (_history.closeHistory.call(void 0, tr), true));
560
579
  const ok = (at !== void 0 ? chain.insertContentAt(at, node) : chain.insertContent(node)).run();
561
- const chart = _chunkT6Y5FV7Gcjs.getDocumentCharts.call(void 0, ed.state.doc).find((c) => c.id === id);
580
+ const chart = _chunkL434J57Vcjs.getDocumentCharts.call(void 0, ed.state.doc).find((c) => c.id === id);
562
581
  if (!ok || !chart) throw new Error(`A chart cannot go at ${_nullishCoalesce(at, () => ( ed.state.selection.from))}; pass a position between blocks or inside a paragraph.`);
563
582
  return { id: chart.id, pos: chart.pos, spec: chart.spec, width: chart.node.attrs.width, height: chart.node.attrs.height };
564
583
  }
@@ -605,8 +624,8 @@ function createDocumentChartTools(editor) {
605
624
  inputSchema: {
606
625
  type: "object",
607
626
  properties: {
608
- values: { type: "array", items: _chunkFLUTRPLYcjs.VALUE, minItems: 1, maxItems: _chunkT6Y5FV7Gcjs.MAX_SPARKLINE_VALUES, description: "Values in order (null for a gap)." },
609
- kind: { type: "string", enum: [..._chunkT6Y5FV7Gcjs.SPARKLINE_KINDS], description: "line (default), column, or win-loss (sign only)." },
627
+ values: { type: "array", items: _chunkFLUTRPLYcjs.VALUE, minItems: 1, maxItems: _chunkL434J57Vcjs.MAX_SPARKLINE_VALUES, description: "Values in order (null for a gap)." },
628
+ kind: { type: "string", enum: [..._chunkL434J57Vcjs.SPARKLINE_KINDS], description: "line (default), column, or win-loss (sign only)." },
610
629
  at: { type: "integer", minimum: 0, description: "Document position inside a paragraph (default: the selection)." },
611
630
  width: { type: "number", minimum: 4, maximum: 1e3, description: "Width in pixels (default 80)." },
612
631
  height: { type: "number", minimum: 4, maximum: 200, description: "Height in pixels (default 18)." },
@@ -625,7 +644,7 @@ function createDocumentChartTools(editor) {
625
644
  if (bad >= 0) throw new Error(`values[${bad}] ("${String(values[bad])}") is not a number; pass numbers, numeric text or null. Nothing was inserted.`);
626
645
  const pos = _nullishCoalesce(at, () => ( ed.state.selection.from));
627
646
  if (!ed.state.doc.resolve(pos).parent.inlineContent) throw new Error(`Position ${pos} is between blocks; a sparkline goes inside a paragraph (use a position from get_text {blocks: true}).`);
628
- const stored = _chunkT6Y5FV7Gcjs.normalizeSparklineValues.call(void 0, parsed);
647
+ const stored = _chunkL434J57Vcjs.normalizeSparklineValues.call(void 0, parsed);
629
648
  ed.chain().command(({ tr }) => (_history.closeHistory.call(void 0, tr), true)).insertContentAt(pos, { type: "sparkline", attrs: { values: stored, kind, width, height, color, label } }).run();
630
649
  return { pos, kind, values: stored };
631
650
  }
@@ -636,6 +655,309 @@ function createDocumentChartTools(editor) {
636
655
  };
637
656
  }
638
657
 
658
+ // src/agent/formatTools.ts
659
+
660
+
661
+ var WRITE_IDEMPOTENT2 = { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false };
662
+ var TOGGLE_MARKS = [
663
+ ["bold", "bold", "Bold (strong) text."],
664
+ ["italic", "italic", "Italic (emphasis)."],
665
+ ["underline", "underline", "Underlined text."],
666
+ ["strike", "strike", "Struck-through text."],
667
+ ["code", "code", "Inline code (monospace; in most schemas it removes the other marks)."],
668
+ ["subscript", "subscript", "Subscript."],
669
+ ["superscript", "superscript", "Superscript."]
670
+ ];
671
+ var BLOCK_TYPES = [
672
+ ["paragraph", "paragraph", "a plain paragraph (also takes the blocks out of lists, quotes and code blocks)"],
673
+ ["heading", "heading", "a heading of `level`"],
674
+ ["bullet_list", "bulletList", "items of a bulleted list"],
675
+ ["ordered_list", "orderedList", "items of a numbered list"],
676
+ ["task_list", "taskList", "items of a checklist"],
677
+ ["blockquote", "blockquote", "a quote"],
678
+ ["code_block", "codeBlock", "a code block (plain text: marks are dropped)"]
679
+ ];
680
+ var LIST_ITEMS = { bulletList: "listItem", orderedList: "listItem", taskList: "taskItem" };
681
+ var UNSAFE_LINK = /^\s*(javascript|data|vbscript):/i;
682
+ var RANGE_PROPERTIES = {
683
+ from: { type: "integer", minimum: 0, description: "Start document position (from find_text or get_text `blocks`). Default: the selection." },
684
+ to: { type: "integer", minimum: 0, description: "End document position. Default: the selection." }
685
+ };
686
+ function targetRange(editor, args, allowEmpty) {
687
+ if (args.from === void 0 !== (args.to === void 0)) throw new Error('Pass both "from" and "to", or neither to use the selection.');
688
+ const { from, to } = args.from === void 0 ? editor.state.selection : { from: args.from, to: args.to };
689
+ const size = editor.state.doc.content.size;
690
+ if (from > to) throw new Error(`"from" (${from}) must not be after "to" (${to}).`);
691
+ if (to > size) throw new Error(`Position ${to} is outside the document (size ${size}).`);
692
+ if (!allowEmpty && from === to) {
693
+ throw new Error('The range is empty: pass "from" and "to" around the text (find_text returns them), or select it first.');
694
+ }
695
+ return { from, to };
696
+ }
697
+ function checkEditable(editor) {
698
+ if (!editor.isEditable) throw new Error("The document is read-only, so it cannot be formatted.");
699
+ }
700
+ function selectionGuard(editor, range) {
701
+ const before = editor.state.selection;
702
+ return {
703
+ select: ({ tr }) => {
704
+ _history.closeHistory.call(void 0, tr);
705
+ tr.setSelection(_state.TextSelection.between(tr.doc.resolve(range.from), tr.doc.resolve(range.to)));
706
+ return true;
707
+ },
708
+ restore: ({ tr }) => {
709
+ const anchor = tr.mapping.map(before.anchor);
710
+ const head = tr.mapping.map(before.head);
711
+ tr.setSelection(_state.TextSelection.between(tr.doc.resolve(anchor), tr.doc.resolve(head)));
712
+ return true;
713
+ },
714
+ /** The acted-on range in the changed document. */
715
+ mapped: (tr) => ({ from: tr.mapping.map(range.from, -1), to: tr.mapping.map(range.to, 1) })
716
+ };
717
+ }
718
+ function blocksIn(doc, from, to) {
719
+ const blocks = [];
720
+ doc.nodesBetween(from, Math.max(to, from + 1), (node, pos, parent) => {
721
+ if (!node.isTextblock) return true;
722
+ const $pos = doc.resolve(pos + 1);
723
+ let wrapper;
724
+ for (let d = $pos.depth - 1; d > 0; d--) {
725
+ const name = $pos.node(d).type.name;
726
+ if (name === "bulletList" || name === "orderedList" || name === "taskList" || name === "blockquote") {
727
+ wrapper = name;
728
+ break;
729
+ }
730
+ }
731
+ blocks.push({
732
+ type: node.type.name,
733
+ from: pos + 1,
734
+ to: pos + 1 + node.content.size,
735
+ text: node.textContent,
736
+ ...node.attrs.level !== void 0 ? { level: node.attrs.level } : {},
737
+ ...node.attrs.textAlign ? { align: node.attrs.textAlign } : {},
738
+ ...wrapper ? { in: wrapper } : {},
739
+ ...parent && parent.type.name === "taskItem" ? { checked: !!parent.attrs.checked } : {}
740
+ });
741
+ return false;
742
+ });
743
+ return blocks;
744
+ }
745
+ function marksOn(doc, schema, from, to) {
746
+ const out = {};
747
+ for (const [arg, mark] of TOGGLE_MARKS) {
748
+ const type = schema.marks[mark];
749
+ if (!type) continue;
750
+ let all = true;
751
+ let any = false;
752
+ doc.nodesBetween(from, to, (node) => {
753
+ if (!node.isText) return true;
754
+ if (type.isInSet(node.marks)) any = true;
755
+ else all = false;
756
+ return false;
757
+ });
758
+ if (any) out[arg] = all ? true : "partly";
759
+ }
760
+ const attrOf = (markName, attr) => {
761
+ const values = /* @__PURE__ */ new Set();
762
+ doc.nodesBetween(from, to, (node) => {
763
+ if (!node.isText) return true;
764
+ const mark = node.marks.find((m) => m.type.name === markName);
765
+ values.add(mark ? _nullishCoalesce(mark.attrs[attr], () => ( null)) : null);
766
+ return false;
767
+ });
768
+ const [only] = values;
769
+ return values.size === 1 ? only : values.size > 1 ? "mixed" : null;
770
+ };
771
+ if (schema.marks.link) {
772
+ const href = attrOf("link", "href");
773
+ if (href !== null) out.link = href;
774
+ }
775
+ if (schema.marks.highlight) {
776
+ const color = attrOf("highlight", "color");
777
+ if (color !== null) out.highlight = color;
778
+ }
779
+ if (schema.marks.textStyle) {
780
+ const color = attrOf("textStyle", "color");
781
+ if (color !== null) out.color = color;
782
+ const size = attrOf("textStyle", "fontSize");
783
+ if (size !== null) out.fontSize = size;
784
+ }
785
+ return out;
786
+ }
787
+ function createDocumentFormatTools(editor, changed) {
788
+ const formatText = (ed) => {
789
+ const { schema } = ed;
790
+ const has = (name) => !!schema.marks[name];
791
+ const hasAttr = (mark, attr) => !!_optionalChain([schema, 'access', _23 => _23.marks, 'access', _24 => _24[mark], 'optionalAccess', _25 => _25.spec, 'access', _26 => _26.attrs, 'optionalAccess', _27 => _27[attr]]);
792
+ const properties = { ...RANGE_PROPERTIES };
793
+ for (const [arg, mark, what] of TOGGLE_MARKS) {
794
+ if (has(mark)) properties[arg] = { type: "boolean", description: `${what} true sets it, false clears it; omit to leave it.` };
795
+ }
796
+ if (has("link")) {
797
+ properties.link = {
798
+ type: ["string", "null"],
799
+ minLength: 1,
800
+ description: "Link the text to this URL (https://\u2026, mailto:\u2026), or null to remove links. Omit to leave links."
801
+ };
802
+ }
803
+ if (has("highlight")) {
804
+ properties.highlight = {
805
+ type: ["string", "null"],
806
+ minLength: 1,
807
+ maxLength: 64,
808
+ description: 'Highlight (background) colour as a CSS colour, e.g. "#fef08a" or "yellow", or null to remove it.'
809
+ };
810
+ }
811
+ if (hasAttr("textStyle", "color")) {
812
+ properties.color = { type: ["string", "null"], minLength: 1, maxLength: 64, description: "Text colour as a CSS colour, or null for the default colour." };
813
+ }
814
+ if (hasAttr("textStyle", "fontSize")) {
815
+ properties.fontSize = { type: ["string", "null"], pattern: "^\\d+(\\.\\d+)?(px|pt|em|rem|%)$", description: 'Font size with a unit, e.g. "18px" or "1.25em", or null for the default size.' };
816
+ }
817
+ const formatting = Object.keys(properties).filter((k) => k !== "from" && k !== "to");
818
+ if (formatting.length === 0) return null;
819
+ return {
820
+ name: "format_text",
821
+ title: "Format text",
822
+ description: `Sets or clears inline formatting on a range of text (or the selection): ${formatting.join(", ")}. Only the properties you pass change. Positions come from find_text or get_text \`blocks\`. One undo step; the selection is left where it was. Returns the \`range\` and the formatting now on it (\`partly\` / \`mixed\` where only some of the text has it). For headings and lists use set_block_type.`,
823
+ inputSchema: { type: "object", properties, additionalProperties: false },
824
+ annotations: { title: "Format text", ...WRITE_IDEMPOTENT2 },
825
+ handler: (args) => {
826
+ const ed2 = editor();
827
+ checkEditable(ed2);
828
+ const asked = formatting.filter((k) => args[k] !== void 0);
829
+ if (asked.length === 0) throw new Error(`Pass at least one formatting property: ${formatting.join(", ")}.`);
830
+ const range = targetRange(ed2, args, false);
831
+ if (typeof args.link === "string" && UNSAFE_LINK.test(args.link)) {
832
+ throw new Error("Links may not use javascript:, data: or vbscript: URLs. Nothing was changed.");
833
+ }
834
+ const guard = selectionGuard(ed2, range);
835
+ let tr = null;
836
+ let chain = ed2.chain().command(guard.select);
837
+ for (const [arg, mark] of TOGGLE_MARKS) {
838
+ if (args[arg] === true) chain = chain.setMark(mark);
839
+ else if (args[arg] === false) chain = chain.unsetMark(mark, { extendEmptyMarkRange: false });
840
+ }
841
+ if (args.link === null) chain = chain.unsetMark("link");
842
+ else if (typeof args.link === "string") chain = chain.setMark("link", { href: args.link.trim() });
843
+ if (args.highlight === null) chain = chain.unsetMark("highlight");
844
+ else if (typeof args.highlight === "string") chain = chain.setMark("highlight", { color: args.highlight });
845
+ const style = {};
846
+ if (args.color !== void 0) style.color = args.color;
847
+ if (args.fontSize !== void 0) style.fontSize = args.fontSize;
848
+ if (Object.keys(style).length) {
849
+ chain = chain.setMark("textStyle", style);
850
+ if (Object.values(style).includes(null)) chain = chain.removeEmptyTextStyle();
851
+ }
852
+ chain.command((props) => {
853
+ tr = props.tr;
854
+ return guard.restore(props);
855
+ }).run();
856
+ const after = tr ? guard.mapped(tr) : range;
857
+ changed([after]);
858
+ const doc = ed2.state.doc;
859
+ return { range: after, text: doc.textBetween(after.from, after.to, "\n"), formatting: marksOn(doc, ed2.schema, after.from, after.to) };
860
+ }
861
+ };
862
+ };
863
+ const blockTypes = (ed) => BLOCK_TYPES.filter(([, node]) => !!ed.schema.nodes[node] && (!LIST_ITEMS[node] || !!ed.schema.nodes[LIST_ITEMS[node]]));
864
+ const headingLevels = (ed) => {
865
+ const ext = ed.extensionManager.extensions.find((e) => e.name === "heading");
866
+ return _nullishCoalesce(_optionalChain([ext, 'optionalAccess', _28 => _28.options, 'optionalAccess', _29 => _29.levels]), () => ( [1, 2, 3, 4, 5, 6]));
867
+ };
868
+ const setBlockType = (ed) => {
869
+ const types = blockTypes(ed);
870
+ if (types.length < 2) return null;
871
+ const levels = ed.schema.nodes.heading ? headingLevels(ed) : [];
872
+ return {
873
+ name: "set_block_type",
874
+ title: "Set the block type",
875
+ description: "Turns every paragraph the range touches (or the one at the cursor) into " + types.map(([value, , what]) => `${value} (${what})`).join(", ") + ". The blocks are first taken out of any list, quote or code block, so one call switches between kinds. One undo step; the selection is left where it was. Returns the resulting `blocks` with their type, positions, text, level, alignment and the list or quote they are in.",
876
+ inputSchema: {
877
+ type: "object",
878
+ properties: {
879
+ ...RANGE_PROPERTIES,
880
+ type: { type: "string", enum: types.map(([value]) => value), description: "What the blocks become." },
881
+ ...levels.length ? { level: { type: "integer", enum: levels, description: `Heading level for type "heading" (${levels.join(", ")}; 1 is the largest).` } } : {}
882
+ },
883
+ required: ["type"],
884
+ additionalProperties: false
885
+ },
886
+ annotations: { title: "Set the block type", ...WRITE_IDEMPOTENT2 },
887
+ handler: (args) => {
888
+ const ed2 = editor();
889
+ checkEditable(ed2);
890
+ const type = args.type;
891
+ if (type === "heading" && args.level === void 0) throw new Error(`Pass a heading "level" (${levels.join(", ")}).`);
892
+ if (type !== "heading" && args.level !== void 0) throw new Error('"level" only applies to type "heading".');
893
+ const range = targetRange(ed2, args, true);
894
+ const node = BLOCK_TYPES.find(([value]) => value === type)[1];
895
+ const guard = selectionGuard(ed2, range);
896
+ let tr = null;
897
+ let chain = ed2.chain().command(guard.select).clearNodes();
898
+ if (type === "heading") chain = chain.setNode("heading", { level: args.level });
899
+ else if (type === "code_block") chain = chain.setNode("codeBlock");
900
+ else if (type === "blockquote") chain = chain.wrapIn("blockquote");
901
+ else if (LIST_ITEMS[node]) chain = chain.toggleList(node, LIST_ITEMS[node]);
902
+ const ok = chain.command((props) => {
903
+ tr = props.tr;
904
+ return guard.restore(props);
905
+ }).run();
906
+ if (!ok || !tr) throw new Error(`Those blocks cannot become ${type} here (for example inside a table cell or a code block). Nothing was changed.`);
907
+ const after = guard.mapped(tr);
908
+ changed([after]);
909
+ return { type, range: after, blocks: blocksIn(ed2.state.doc, after.from, after.to) };
910
+ }
911
+ };
912
+ };
913
+ const setTextAlign = (ed) => {
914
+ const ext = ed.extensionManager.extensions.find((e) => e.name === "textAlign");
915
+ if (!ext) return null;
916
+ const alignments = (_nullishCoalesce(_optionalChain([ext, 'access', _30 => _30.options, 'optionalAccess', _31 => _31.alignments]), () => ( ["left", "center", "right", "justify"]))).slice();
917
+ const types = _nullishCoalesce(_optionalChain([ext, 'access', _32 => _32.options, 'optionalAccess', _33 => _33.types]), () => ( ["heading", "paragraph"]));
918
+ return {
919
+ name: "set_text_align",
920
+ title: "Align text",
921
+ description: `Aligns every ${types.join(" and ")} the range touches (or the one at the cursor): ${alignments.join(", ")}, or null for the default. One undo step; the selection is left where it was. Returns the resulting \`blocks\` with their alignment.`,
922
+ inputSchema: {
923
+ type: "object",
924
+ properties: {
925
+ ...RANGE_PROPERTIES,
926
+ align: { type: ["string", "null"], enum: [...alignments, null], description: "The alignment, or null for the default (usually left)." }
927
+ },
928
+ required: ["align"],
929
+ additionalProperties: false
930
+ },
931
+ annotations: { title: "Align text", ...WRITE_IDEMPOTENT2 },
932
+ handler: (args) => {
933
+ const ed2 = editor();
934
+ checkEditable(ed2);
935
+ const range = targetRange(ed2, args, true);
936
+ const blocks = blocksIn(ed2.state.doc, range.from, range.to);
937
+ if (!blocks.some((b) => types.includes(b.type))) {
938
+ throw new Error(`Only ${types.join(" and ")} blocks can be aligned; the range has ${[...new Set(blocks.map((b) => b.type))].join(", ") || "no text blocks"}.`);
939
+ }
940
+ const guard = selectionGuard(ed2, range);
941
+ let tr = null;
942
+ const chain = ed2.chain().command(guard.select);
943
+ (args.align === null ? chain.unsetTextAlign() : chain.setTextAlign(args.align)).command((props) => {
944
+ tr = props.tr;
945
+ return guard.restore(props);
946
+ }).run();
947
+ const after = tr ? guard.mapped(tr) : range;
948
+ changed([after]);
949
+ return { align: args.align, range: after, blocks: blocksIn(ed2.state.doc, after.from, after.to) };
950
+ }
951
+ };
952
+ };
953
+ return {
954
+ /** The formatting tools this editor's schema supports. */
955
+ tools(ed) {
956
+ return [formatText(ed), setBlockType(ed), setTextAlign(ed)].filter((t) => t !== null);
957
+ }
958
+ };
959
+ }
960
+
639
961
  // src/agent/providers.ts
640
962
  var toEditor = (target) => "commands" in target ? target : target.editor;
641
963
  function selectionInfo(editor) {
@@ -659,13 +981,13 @@ function textBlocks(editor) {
659
981
  function createTextPresence(editor, providerId, option) {
660
982
  const config = option === false ? null : option === true || option === void 0 ? {} : option;
661
983
  const caret = {
662
- id: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _23 => _23.id]), () => ( providerId)),
663
- name: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _24 => _24.name]), () => ( _chunkT6Y5FV7Gcjs.DEFAULT_AGENT_CARET_NAME)),
664
- color: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _25 => _25.color]), () => ( _chunkT6Y5FV7Gcjs.DEFAULT_AGENT_CARET_COLOR))
984
+ id: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _34 => _34.id]), () => ( providerId)),
985
+ name: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _35 => _35.name]), () => ( _chunkL434J57Vcjs.DEFAULT_AGENT_CARET_NAME)),
986
+ color: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _36 => _36.color]), () => ( _chunkL434J57Vcjs.DEFAULT_AGENT_CARET_COLOR))
665
987
  };
666
- const typing = !_optionalChain([config, 'optionalAccess', _26 => _26.typing]) ? null : config.typing === true ? {} : config.typing;
667
- const idleMs = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _27 => _27.idleMs]), () => ( 12e3));
668
- const changedMs = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _28 => _28.changedMs]), () => ( 1500));
988
+ const typing = !_optionalChain([config, 'optionalAccess', _37 => _37.typing]) ? null : config.typing === true ? {} : config.typing;
989
+ const idleMs = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _38 => _38.idleMs]), () => ( 12e3));
990
+ const changedMs = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _39 => _39.changedMs]), () => ( 1500));
669
991
  let idleTimer;
670
992
  let tintTimer;
671
993
  const live = () => {
@@ -674,19 +996,19 @@ function createTextPresence(editor, providerId, option) {
674
996
  };
675
997
  const touch = () => {
676
998
  clearTimeout(idleTimer);
677
- if (idleMs > 0) idleTimer = setTimeout(() => live() && _chunkT6Y5FV7Gcjs.clearAgentCaret.call(void 0, live(), caret.id), idleMs);
999
+ if (idleMs > 0) idleTimer = setTimeout(() => live() && _chunkL434J57Vcjs.clearAgentCaret.call(void 0, live(), caret.id), idleMs);
678
1000
  };
679
1001
  const tint = (ed, ranges) => {
680
1002
  clearTimeout(tintTimer);
681
- _chunkT6Y5FV7Gcjs.markAgentChanges.call(void 0, ed, caret.id, ranges);
682
- if (changedMs > 0 && ranges.length) tintTimer = setTimeout(() => live() && _chunkT6Y5FV7Gcjs.markAgentChanges.call(void 0, live(), caret.id, []), changedMs);
1003
+ _chunkL434J57Vcjs.markAgentChanges.call(void 0, ed, caret.id, ranges);
1004
+ if (changedMs > 0 && ranges.length) tintTimer = setTimeout(() => live() && _chunkL434J57Vcjs.markAgentChanges.call(void 0, live(), caret.id, []), changedMs);
683
1005
  };
684
1006
  return {
685
1007
  /** Puts the caret at `head`, selecting from `anchor`. */
686
1008
  show(anchor, head = anchor) {
687
1009
  const ed = live();
688
1010
  if (!ed) return;
689
- _chunkT6Y5FV7Gcjs.setAgentCaret.call(void 0, ed, { ...caret, from: anchor, to: head });
1011
+ _chunkL434J57Vcjs.setAgentCaret.call(void 0, ed, { ...caret, from: anchor, to: head });
690
1012
  touch();
691
1013
  },
692
1014
  /** Shows the caret after ranges just changed by a tool, tinting them. */
@@ -694,7 +1016,7 @@ function createTextPresence(editor, providerId, option) {
694
1016
  const ed = live();
695
1017
  if (!ed || !ranges.length) return;
696
1018
  const last = ranges[ranges.length - 1];
697
- _chunkT6Y5FV7Gcjs.setAgentCaret.call(void 0, ed, { ...caret, from: last.to });
1019
+ _chunkL434J57Vcjs.setAgentCaret.call(void 0, ed, { ...caret, from: last.to });
698
1020
  tint(ed, ranges);
699
1021
  touch();
700
1022
  },
@@ -702,12 +1024,12 @@ function createTextPresence(editor, providerId, option) {
702
1024
  async write(ed, from, to, text, signal) {
703
1025
  if (live() && typing) {
704
1026
  clearTimeout(tintTimer);
705
- const range2 = await _chunkT6Y5FV7Gcjs.typeAgentText.call(void 0, ed, { ...typing, from, to, text, caret, signal });
706
- if (changedMs > 0) tintTimer = setTimeout(() => live() && _chunkT6Y5FV7Gcjs.markAgentChanges.call(void 0, live(), caret.id, []), changedMs);
1027
+ const range2 = await _chunkL434J57Vcjs.typeAgentText.call(void 0, ed, { ...typing, from, to, text, caret, signal });
1028
+ if (changedMs > 0) tintTimer = setTimeout(() => live() && _chunkL434J57Vcjs.markAgentChanges.call(void 0, live(), caret.id, []), changedMs);
707
1029
  touch();
708
1030
  return range2;
709
1031
  }
710
- const tr = _chunkT6Y5FV7Gcjs.replaceWithTextTransaction.call(void 0, ed.state, from, to, text);
1032
+ const tr = _history.closeHistory.call(void 0, _chunkL434J57Vcjs.replaceWithTextTransaction.call(void 0, ed.state, from, to, text));
711
1033
  const end = tr.mapping.map(to, 1);
712
1034
  const range = { from: Math.min(tr.mapping.map(from, -1), end), to: end };
713
1035
  ed.view.dispatch(tr.scrollIntoView());
@@ -736,7 +1058,7 @@ function findMatches(editor, query, args, replacement) {
736
1058
  wholeWord: !!args.wholeWord,
737
1059
  ...args.regex ? { regex: true } : { literal: true }
738
1060
  };
739
- const result = _chunkT6Y5FV7Gcjs.searchDocument.call(void 0, editor.state.doc, query, options, replacement !== void 0 ? { replacement } : {});
1061
+ const result = _chunkL434J57Vcjs.searchDocument.call(void 0, editor.state.doc, query, options, replacement !== void 0 ? { replacement } : {});
740
1062
  if (result.error) throw new Error(`Invalid search pattern: ${result.error.message}`);
741
1063
  return { matches: result.matches, truncated: result.truncated };
742
1064
  }
@@ -744,6 +1066,7 @@ function createRichTextToolProvider(target, options) {
744
1066
  const editor = () => toEditor(target);
745
1067
  const charts = createDocumentChartTools(editor);
746
1068
  const presence = createTextPresence(editor, options.id, options.presence);
1069
+ const formatting = createDocumentFormatTools(editor, (ranges) => presence.changed(ranges.filter((r) => r.from < r.to)));
747
1070
  const getText = {
748
1071
  name: "get_text",
749
1072
  title: "Get document text",
@@ -772,7 +1095,7 @@ function createRichTextToolProvider(target, options) {
772
1095
  },
773
1096
  handler: ({ format = "text", blocks = false }) => {
774
1097
  const ed = editor();
775
- const content = format === "html" ? ed.getHTML() : format === "markdown" ? _chunk6NXVDJDRcjs.getEditorMarkdown.call(void 0, ed) : _chunk6NXVDJDRcjs.getEditorText.call(void 0, ed);
1098
+ const content = format === "html" ? ed.getHTML() : format === "markdown" ? _chunkG43MNQ4Ccjs.getEditorMarkdown.call(void 0, ed) : _chunkG43MNQ4Ccjs.getEditorText.call(void 0, ed);
776
1099
  return {
777
1100
  format,
778
1101
  content,
@@ -889,8 +1212,8 @@ function createRichTextToolProvider(target, options) {
889
1212
  ...m,
890
1213
  replacement: String(replace).replace(/\r\n?|\n/g, "\r")
891
1214
  }));
892
- const tr = ed.state.tr;
893
- const ends = _chunkT6Y5FV7Gcjs.applyReplacements.call(void 0, tr, chosen);
1215
+ const tr = _history.closeHistory.call(void 0, ed.state.tr);
1216
+ const ends = _chunkL434J57Vcjs.applyReplacements.call(void 0, tr, chosen);
894
1217
  ed.view.dispatch(tr.scrollIntoView());
895
1218
  const ranges = chosen.map((m, i) => ({ from: tr.mapping.map(m.from, -1), to: ends[i] }));
896
1219
  presence.changed(ranges.filter((r) => r.from < r.to));
@@ -991,7 +1314,7 @@ function createRichTextToolProvider(target, options) {
991
1314
  inputSchema: {
992
1315
  type: "object",
993
1316
  properties: {
994
- operation: { type: "string", enum: _chunkT6Y5FV7Gcjs.TABLE_ACTIONS.map((a) => a.action), description: "Table operation." },
1317
+ operation: { type: "string", enum: _chunkL434J57Vcjs.TABLE_ACTIONS.map((a) => a.action), description: "Table operation." },
995
1318
  at: { type: "integer", minimum: 0, description: "Document position to place the cursor first (e.g. inside a cell)." },
996
1319
  rows: { type: "integer", minimum: 1, maximum: 100, description: "insertTable: rows (default 3)." },
997
1320
  cols: { type: "integer", minimum: 1, maximum: 50, description: "insertTable: columns (default 3)." },
@@ -1021,10 +1344,10 @@ function createRichTextToolProvider(target, options) {
1021
1344
  ed.view.dispatch(ed.state.tr.setSelection(_state.TextSelection.near(ed.state.doc.resolve(at))));
1022
1345
  }
1023
1346
  const action = operation;
1024
- const state = _chunkT6Y5FV7Gcjs.getTableActionState.call(void 0, ed, action, params);
1347
+ const state = _chunkL434J57Vcjs.getTableActionState.call(void 0, ed, action, params);
1025
1348
  if (state !== true) throw new Error(state);
1026
- _chunkT6Y5FV7Gcjs.runTableAction.call(void 0, ed, action, params);
1027
- const table = _chunkT6Y5FV7Gcjs.getTableState.call(void 0, ed);
1349
+ _chunkL434J57Vcjs.runTableAction.call(void 0, ed, action, params);
1350
+ const table = _chunkL434J57Vcjs.getTableState.call(void 0, ed);
1028
1351
  return {
1029
1352
  operation,
1030
1353
  table: table.inTable ? { rows: table.rows, columns: table.columns, row: table.row, column: table.column } : null,
@@ -1035,12 +1358,15 @@ function createRichTextToolProvider(target, options) {
1035
1358
  return {
1036
1359
  id: options.id,
1037
1360
  namespace: options.namespace,
1361
+ title: "Document",
1362
+ description: "A rich text document: read and find text, insert, replace and format it, tables, and charts in the document.",
1363
+ skill: "pixerate-rich-text",
1038
1364
  tools: () => {
1039
1365
  const ed = editor();
1040
1366
  if (!ed || ed.isDestroyed) return [];
1041
1367
  if (!ed.isEditable) return [getText, findText, ...charts.read()];
1042
- const tools = [getText, findText, insertText, replaceText, replaceRange, replaceSelection, setSelection];
1043
- return [...tools, ..._chunkT6Y5FV7Gcjs.isTableEnabled.call(void 0, ed) ? [editTable] : [], ...charts.read(), ...charts.write()];
1368
+ const tools = [getText, findText, insertText, replaceText, replaceRange, replaceSelection, setSelection, ...formatting.tools(ed)];
1369
+ return [...tools, ..._chunkL434J57Vcjs.isTableEnabled.call(void 0, ed) ? [editTable] : [], ...charts.read(), ...charts.write()];
1044
1370
  },
1045
1371
  subscribe: (notify) => {
1046
1372
  const ed = editor();
@@ -1387,14 +1713,17 @@ function createSpreadsheetToolProvider(controller, options) {
1387
1713
  return {
1388
1714
  id: options.id,
1389
1715
  namespace: options.namespace,
1716
+ title: "Spreadsheet",
1717
+ description: "A spreadsheet: read and set cells and ranges, insert and delete rows and columns, merge and transpose.",
1718
+ skill: "pixerate-spreadsheet",
1390
1719
  tools: [getRange, setCell, setRange, insertRows, deleteRows, insertColumns, deleteColumns, mergeCells, unmergeCells, transposeRange]
1391
1720
  };
1392
1721
  }
1393
1722
  function missingArgumentsMessage(name, args) {
1394
- const required = _chunkHGHXGCKGcjs.EDIT_OPERATION_REQUIRED_ARGUMENTS[name][args.operation];
1723
+ const required = _chunkSVFEVKLFcjs.EDIT_OPERATION_REQUIRED_ARGUMENTS[name][args.operation];
1395
1724
  if (!required) return `Unknown operation "${args.operation}".`;
1396
1725
  const missing = required.filter(
1397
- (key) => key === "id" ? args.id === void 0 && _optionalChain([args, 'access', _29 => _29.node, 'optionalAccess', _30 => _30.id]) === void 0 : args[key] === void 0
1726
+ (key) => key === "id" ? args.id === void 0 && _optionalChain([args, 'access', _40 => _40.node, 'optionalAccess', _41 => _41.id]) === void 0 : args[key] === void 0
1398
1727
  );
1399
1728
  return missing.length ? `Operation "${args.operation}" requires ${required.join(", ")}; missing: ${missing.join(", ")}.` : `Operation "${args.operation}" has invalid arguments (expected ${required.join(", ")} with the types in the schema).`;
1400
1729
  }
@@ -1426,12 +1755,12 @@ function createEditorMcpToolProvider(options) {
1426
1755
  await options.applySteps(steps);
1427
1756
  return describeSteps(steps);
1428
1757
  };
1429
- const canvas = _nullishCoalesce(_optionalChain([options, 'access', _31 => _31.surfaces, 'optionalAccess', _32 => _32.canvas]), () => ( true));
1430
- const prompt = _nullishCoalesce(_optionalChain([options, 'access', _33 => _33.surfaces, 'optionalAccess', _34 => _34.prompt]), () => ( true));
1431
- const editTools = options.toolStyle === "combined" ? [...canvas ? [_chunkHGHXGCKGcjs.MCP_TOOL_EDIT_CANVAS] : [], ...prompt ? [_chunkHGHXGCKGcjs.MCP_TOOL_EDIT_PROMPT] : []] : [...canvas ? _chunkHGHXGCKGcjs.EDITOR_CANVAS_TOOLS : [], ...prompt ? _chunkHGHXGCKGcjs.EDITOR_PROMPT_TOOLS : []];
1758
+ const canvas = _nullishCoalesce(_optionalChain([options, 'access', _42 => _42.surfaces, 'optionalAccess', _43 => _43.canvas]), () => ( true));
1759
+ const prompt = _nullishCoalesce(_optionalChain([options, 'access', _44 => _44.surfaces, 'optionalAccess', _45 => _45.prompt]), () => ( true));
1760
+ const editTools = options.toolStyle === "combined" ? [...canvas ? [_chunkSVFEVKLFcjs.MCP_TOOL_EDIT_CANVAS] : [], ...prompt ? [_chunkSVFEVKLFcjs.MCP_TOOL_EDIT_PROMPT] : []] : [...canvas ? _chunkSVFEVKLFcjs.EDITOR_CANVAS_TOOLS : [], ...prompt ? _chunkSVFEVKLFcjs.EDITOR_PROMPT_TOOLS : []];
1432
1761
  const tools = [
1433
1762
  {
1434
- ..._chunkHGHXGCKGcjs.MCP_TOOL_GET_EDITOR_STATE,
1763
+ ..._chunkSVFEVKLFcjs.MCP_TOOL_GET_EDITOR_STATE,
1435
1764
  handler: ({ includeDocument = true, includeCanvas = true }) => {
1436
1765
  const snapshot = options.getSnapshot();
1437
1766
  return {
@@ -1445,14 +1774,21 @@ function createEditorMcpToolProvider(options) {
1445
1774
  if (options.captureView) {
1446
1775
  const capture = options.captureView;
1447
1776
  tools.push({
1448
- ..._chunkHGHXGCKGcjs.MCP_TOOL_VIEW_EDITOR,
1777
+ ..._chunkSVFEVKLFcjs.MCP_TOOL_VIEW_EDITOR,
1449
1778
  handler: async (args) => {
1450
1779
  const image = await capture(args);
1451
1780
  return { content: [{ type: "image", data: image.data, mimeType: image.mimeType }] };
1452
1781
  }
1453
1782
  });
1454
1783
  }
1455
- return { id: options.id, namespace: options.namespace, tools };
1784
+ return {
1785
+ id: options.id,
1786
+ namespace: options.namespace,
1787
+ title: "Canvas and prompt editor",
1788
+ description: "The node canvas and the prompt: editor state, nodes and edges, layout, prompt text, and a view of the editor.",
1789
+ skill: "pixerate-canvas",
1790
+ tools
1791
+ };
1456
1792
  }
1457
1793
 
1458
1794
  // src/agent/componentTools.ts
@@ -1648,7 +1984,14 @@ function createCanvasComponentToolProvider(controller, options = { id: "canvas-c
1648
1984
  )
1649
1985
  );
1650
1986
  }
1651
- return { id: options.id, namespace: options.namespace, tools };
1987
+ return {
1988
+ id: options.id,
1989
+ namespace: options.namespace,
1990
+ title: "Canvas components",
1991
+ description: "Reusable canvas components: define them, place instances, manage variants and overrides.",
1992
+ skill: "pixerate-canvas",
1993
+ tools
1994
+ };
1652
1995
  }
1653
1996
 
1654
1997
 
@@ -1706,4 +2049,20 @@ function createCanvasComponentToolProvider(controller, options = { id: "canvas-c
1706
2049
 
1707
2050
 
1708
2051
 
1709
- exports.CAPTURE_EXCLUDE_SELECTOR = _chunkHGHXGCKGcjs.CAPTURE_EXCLUDE_SELECTOR; exports.CAPTURE_OVERLAY_SELECTORS = _chunkHGHXGCKGcjs.CAPTURE_OVERLAY_SELECTORS; exports.EDITOR_CANVAS_TOOLS = _chunkHGHXGCKGcjs.EDITOR_CANVAS_TOOLS; exports.EDITOR_MCP_TOOLS = _chunkHGHXGCKGcjs.EDITOR_MCP_TOOLS; exports.EDITOR_PROMPT_TOOLS = _chunkHGHXGCKGcjs.EDITOR_PROMPT_TOOLS; exports.EDIT_OPERATION_REQUIRED_ARGUMENTS = _chunkHGHXGCKGcjs.EDIT_OPERATION_REQUIRED_ARGUMENTS; exports.EXPORT_EXCLUDED_SELECTORS = _chunkHGHXGCKGcjs.EXPORT_EXCLUDED_SELECTORS; exports.JSON_RPC_ERRORS = _chunkSPVIXXIBcjs.JSON_RPC_ERRORS; exports.MCP_PROTOCOL_VERSIONS = _chunkSPVIXXIBcjs.MCP_PROTOCOL_VERSIONS; exports.MCP_TOOL_CANVAS_ADD_NODE = _chunkHGHXGCKGcjs.MCP_TOOL_CANVAS_ADD_NODE; exports.MCP_TOOL_CANVAS_CONNECT = _chunkHGHXGCKGcjs.MCP_TOOL_CANVAS_CONNECT; exports.MCP_TOOL_CANVAS_HIGHLIGHT = _chunkHGHXGCKGcjs.MCP_TOOL_CANVAS_HIGHLIGHT; exports.MCP_TOOL_CANVAS_LAYOUT = _chunkHGHXGCKGcjs.MCP_TOOL_CANVAS_LAYOUT; exports.MCP_TOOL_CANVAS_REMOVE_NODES = _chunkHGHXGCKGcjs.MCP_TOOL_CANVAS_REMOVE_NODES; exports.MCP_TOOL_CANVAS_SELECT = _chunkHGHXGCKGcjs.MCP_TOOL_CANVAS_SELECT; exports.MCP_TOOL_CANVAS_UPDATE_NODE = _chunkHGHXGCKGcjs.MCP_TOOL_CANVAS_UPDATE_NODE; exports.MCP_TOOL_EDIT_CANVAS = _chunkHGHXGCKGcjs.MCP_TOOL_EDIT_CANVAS; exports.MCP_TOOL_EDIT_PROMPT = _chunkHGHXGCKGcjs.MCP_TOOL_EDIT_PROMPT; exports.MCP_TOOL_GET_EDITOR_STATE = _chunkHGHXGCKGcjs.MCP_TOOL_GET_EDITOR_STATE; exports.MCP_TOOL_PROMPT_INSERT_TEXT = _chunkHGHXGCKGcjs.MCP_TOOL_PROMPT_INSERT_TEXT; exports.MCP_TOOL_PROMPT_REPLACE_RANGE = _chunkHGHXGCKGcjs.MCP_TOOL_PROMPT_REPLACE_RANGE; exports.MCP_TOOL_PROMPT_SELECT = _chunkHGHXGCKGcjs.MCP_TOOL_PROMPT_SELECT; exports.MCP_TOOL_PROMPT_SET_VARIABLE = _chunkHGHXGCKGcjs.MCP_TOOL_PROMPT_SET_VARIABLE; exports.MCP_TOOL_VIEW_EDITOR = _chunkHGHXGCKGcjs.MCP_TOOL_VIEW_EDITOR; exports.TOOL_BRIDGE_DEFAULT_PORT = _chunkSPVIXXIBcjs.TOOL_BRIDGE_DEFAULT_PORT; exports.TOOL_BRIDGE_PROTOCOL = _chunkSPVIXXIBcjs.TOOL_BRIDGE_PROTOCOL; exports.TOOL_NAMESPACE_SEPARATOR = _chunkSPVIXXIBcjs.TOOL_NAMESPACE_SEPARATOR; exports.ToolRegistry = _chunkSPVIXXIBcjs.ToolRegistry; exports.ToolRegistryError = _chunkSPVIXXIBcjs.ToolRegistryError; exports.captureInputSchema = _chunkCZRWP6IWcjs.captureInputSchema; exports.captureOutputSize = _chunkCZRWP6IWcjs.captureOutputSize; exports.cloneElementWithStyles = _chunkHGHXGCKGcjs.cloneElementWithStyles; exports.connectToolBridge = _chunkSPVIXXIBcjs.connectToolBridge; exports.createCanvasComponentToolProvider = createCanvasComponentToolProvider; exports.createCaptureTool = _chunkCZRWP6IWcjs.createCaptureTool; exports.createCaptureToolProvider = _chunkCZRWP6IWcjs.createCaptureToolProvider; exports.createDocumentChartTools = createDocumentChartTools; exports.createEditorMcpToolProvider = createEditorMcpToolProvider; exports.createElementCaptureSurface = _chunkHGHXGCKGcjs.createElementCaptureSurface; exports.createMcpServer = _chunkSPVIXXIBcjs.createMcpServer; exports.createRichTextToolProvider = createRichTextToolProvider; exports.createSpreadsheetToolProvider = createSpreadsheetToolProvider; exports.createToolRegistry = _chunkSPVIXXIBcjs.createToolRegistry; exports.elementToSvg = _chunkHGHXGCKGcjs.elementToSvg; exports.normalizeSide = normalizeSide; exports.planAgentCommand = planAgentCommand; exports.planToolCall = planToolCall; exports.rasterizeElement = _chunkHGHXGCKGcjs.rasterizeElement; exports.resolveCaptureRequest = _chunkCZRWP6IWcjs.resolveCaptureRequest; exports.toCapturedImageData = _chunkCZRWP6IWcjs.toCapturedImageData; exports.toToolResult = _chunkSPVIXXIBcjs.toToolResult; exports.toolCallToAgentCommand = toolCallToAgentCommand; exports.unionCaptureRects = _chunkCZRWP6IWcjs.unionCaptureRects; exports.validateAgentCommand = validateAgentCommand; exports.validateJsonSchema = _chunkWOFXZ3XUcjs.validateJsonSchema;
2052
+
2053
+
2054
+
2055
+
2056
+
2057
+
2058
+
2059
+
2060
+
2061
+
2062
+
2063
+
2064
+
2065
+
2066
+
2067
+
2068
+ exports.CAPTURE_EXCLUDE_SELECTOR = _chunkSVFEVKLFcjs.CAPTURE_EXCLUDE_SELECTOR; exports.CAPTURE_OVERLAY_SELECTORS = _chunkSVFEVKLFcjs.CAPTURE_OVERLAY_SELECTORS; exports.EDITOR_CANVAS_TOOLS = _chunkSVFEVKLFcjs.EDITOR_CANVAS_TOOLS; exports.EDITOR_MCP_TOOLS = _chunkSVFEVKLFcjs.EDITOR_MCP_TOOLS; exports.EDITOR_PROMPT_TOOLS = _chunkSVFEVKLFcjs.EDITOR_PROMPT_TOOLS; exports.EDIT_OPERATION_REQUIRED_ARGUMENTS = _chunkSVFEVKLFcjs.EDIT_OPERATION_REQUIRED_ARGUMENTS; exports.EXPORT_EXCLUDED_SELECTORS = _chunkSVFEVKLFcjs.EXPORT_EXCLUDED_SELECTORS; exports.JSON_RPC_ERRORS = _chunkHDK3T2QScjs.JSON_RPC_ERRORS; exports.MCP_PROTOCOL_VERSIONS = _chunkHDK3T2QScjs.MCP_PROTOCOL_VERSIONS; exports.MCP_TOOL_CANVAS_ADD_NODE = _chunkSVFEVKLFcjs.MCP_TOOL_CANVAS_ADD_NODE; exports.MCP_TOOL_CANVAS_CONNECT = _chunkSVFEVKLFcjs.MCP_TOOL_CANVAS_CONNECT; exports.MCP_TOOL_CANVAS_HIGHLIGHT = _chunkSVFEVKLFcjs.MCP_TOOL_CANVAS_HIGHLIGHT; exports.MCP_TOOL_CANVAS_LAYOUT = _chunkSVFEVKLFcjs.MCP_TOOL_CANVAS_LAYOUT; exports.MCP_TOOL_CANVAS_REMOVE_NODES = _chunkSVFEVKLFcjs.MCP_TOOL_CANVAS_REMOVE_NODES; exports.MCP_TOOL_CANVAS_SELECT = _chunkSVFEVKLFcjs.MCP_TOOL_CANVAS_SELECT; exports.MCP_TOOL_CANVAS_UPDATE_NODE = _chunkSVFEVKLFcjs.MCP_TOOL_CANVAS_UPDATE_NODE; exports.MCP_TOOL_EDIT_CANVAS = _chunkSVFEVKLFcjs.MCP_TOOL_EDIT_CANVAS; exports.MCP_TOOL_EDIT_PROMPT = _chunkSVFEVKLFcjs.MCP_TOOL_EDIT_PROMPT; exports.MCP_TOOL_GET_EDITOR_STATE = _chunkSVFEVKLFcjs.MCP_TOOL_GET_EDITOR_STATE; exports.MCP_TOOL_PROMPT_INSERT_TEXT = _chunkSVFEVKLFcjs.MCP_TOOL_PROMPT_INSERT_TEXT; exports.MCP_TOOL_PROMPT_REPLACE_RANGE = _chunkSVFEVKLFcjs.MCP_TOOL_PROMPT_REPLACE_RANGE; exports.MCP_TOOL_PROMPT_SELECT = _chunkSVFEVKLFcjs.MCP_TOOL_PROMPT_SELECT; exports.MCP_TOOL_PROMPT_SET_VARIABLE = _chunkSVFEVKLFcjs.MCP_TOOL_PROMPT_SET_VARIABLE; exports.MCP_TOOL_VIEW_EDITOR = _chunkSVFEVKLFcjs.MCP_TOOL_VIEW_EDITOR; exports.TOOL_BRIDGE_DEFAULT_PORT = _chunkHDK3T2QScjs.TOOL_BRIDGE_DEFAULT_PORT; exports.TOOL_BRIDGE_PROTOCOL = _chunkHDK3T2QScjs.TOOL_BRIDGE_PROTOCOL; exports.TOOL_DISCOVERY_TOOLS = _chunkHDK3T2QScjs.TOOL_DISCOVERY_TOOLS; exports.TOOL_NAMESPACE_SEPARATOR = _chunkHDK3T2QScjs.TOOL_NAMESPACE_SEPARATOR; exports.ToolRegistry = _chunkHDK3T2QScjs.ToolRegistry; exports.ToolRegistryError = _chunkHDK3T2QScjs.ToolRegistryError; exports.ToolRegistryView = _chunkHDK3T2QScjs.ToolRegistryView; exports.UNSAFE_JSON_KEYS = _chunk2BSBFBOAcjs.UNSAFE_JSON_KEYS; exports.baseToolName = _chunkHDK3T2QScjs.baseToolName; exports.captureInputSchema = _chunkN2FGYZ4Qcjs.captureInputSchema; exports.captureOutputSize = _chunkN2FGYZ4Qcjs.captureOutputSize; exports.cloneElementWithStyles = _chunkSVFEVKLFcjs.cloneElementWithStyles; exports.connectToolBridge = _chunkHDK3T2QScjs.connectToolBridge; exports.createCanvasComponentToolProvider = createCanvasComponentToolProvider; exports.createCaptureTool = _chunkN2FGYZ4Qcjs.createCaptureTool; exports.createCaptureToolProvider = _chunkN2FGYZ4Qcjs.createCaptureToolProvider; exports.createDocumentChartTools = createDocumentChartTools; exports.createEditorMcpToolProvider = createEditorMcpToolProvider; exports.createElementCaptureSurface = _chunkSVFEVKLFcjs.createElementCaptureSurface; exports.createMcpServer = _chunkHDK3T2QScjs.createMcpServer; exports.createRichTextToolProvider = createRichTextToolProvider; exports.createSpreadsheetToolProvider = createSpreadsheetToolProvider; exports.createToolRegistry = _chunkHDK3T2QScjs.createToolRegistry; exports.elementToSvg = _chunkSVFEVKLFcjs.elementToSvg; exports.errorResult = _chunkHDK3T2QScjs.errorResult; exports.isUnsafeJsonKey = _chunk2BSBFBOAcjs.isUnsafeJsonKey; exports.listSkills = _chunkHDK3T2QScjs.listSkills; exports.normalizeSide = normalizeSide; exports.parseSkillFrontmatter = _chunkHDK3T2QScjs.parseSkillFrontmatter; exports.planAgentCommand = planAgentCommand; exports.planToolCall = planToolCall; exports.rasterizeElement = _chunkSVFEVKLFcjs.rasterizeElement; exports.readSkillFile = _chunkHDK3T2QScjs.readSkillFile; exports.resolveCaptureRequest = _chunkN2FGYZ4Qcjs.resolveCaptureRequest; exports.searchTokens = _chunkHDK3T2QScjs.searchTokens; exports.searchTools = _chunkHDK3T2QScjs.searchTools; exports.stripPrototypeKeys = _chunk2BSBFBOAcjs.stripPrototypeKeys; exports.summarize = _chunkHDK3T2QScjs.summarize; exports.toCapturedImageData = _chunkN2FGYZ4Qcjs.toCapturedImageData; exports.toToolResult = _chunkHDK3T2QScjs.toToolResult; exports.toolCallToAgentCommand = toolCallToAgentCommand; exports.toolsetInstructions = _chunkHDK3T2QScjs.toolsetInstructions; exports.toolsetName = _chunkHDK3T2QScjs.toolsetName; exports.unionCaptureRects = _chunkN2FGYZ4Qcjs.unionCaptureRects; exports.unknownToolMessage = _chunkHDK3T2QScjs.unknownToolMessage; exports.validateAgentCommand = validateAgentCommand; exports.validateJsonSchema = _chunkWOFXZ3XUcjs.validateJsonSchema;