@pixerate/editor 0.44.0 → 0.45.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 (82) hide show
  1. package/README.md +27 -2
  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/{chunk-I6BZB5ZH.cjs → chunk-EFDCLENW.cjs} +73 -6
  11. package/dist/chunk-EFDCLENW.cjs.map +1 -0
  12. package/dist/chunk-HHQ4XJWT.js +826 -0
  13. package/dist/chunk-HHQ4XJWT.js.map +1 -0
  14. package/dist/chunk-J3R2OWOE.cjs +1465 -0
  15. package/dist/chunk-J3R2OWOE.cjs.map +1 -0
  16. package/dist/chunk-K2LVZ4FA.cjs +826 -0
  17. package/dist/chunk-K2LVZ4FA.cjs.map +1 -0
  18. package/dist/{chunk-6MDQKHRH.cjs → chunk-N4MLNJPO.cjs} +21 -899
  19. package/dist/chunk-N4MLNJPO.cjs.map +1 -0
  20. package/dist/chunk-PQM5W7ZN.js +168 -0
  21. package/dist/chunk-PQM5W7ZN.js.map +1 -0
  22. package/dist/{chunk-DDADOHJW.js → chunk-Q25ZS4F7.js} +5 -883
  23. package/dist/chunk-Q25ZS4F7.js.map +1 -0
  24. package/dist/chunk-TK2XZK6Z.js +1465 -0
  25. package/dist/chunk-TK2XZK6Z.js.map +1 -0
  26. package/dist/commands/index.cjs +3 -2
  27. package/dist/commands/index.cjs.map +1 -1
  28. package/dist/commands/index.d.cts +5 -5
  29. package/dist/commands/index.d.ts +5 -5
  30. package/dist/commands/index.js +2 -1
  31. package/dist/commands/index.js.map +1 -1
  32. package/dist/extensions/index.cjs +4 -4
  33. package/dist/extensions/index.cjs.map +1 -1
  34. package/dist/extensions/index.d.cts +3 -3
  35. package/dist/extensions/index.d.ts +3 -3
  36. package/dist/extensions/index.js +12 -12
  37. package/dist/generation/index.cjs +2 -2
  38. package/dist/generation/index.d.cts +4 -4
  39. package/dist/generation/index.d.ts +4 -4
  40. package/dist/generation/index.js +1 -1
  41. package/dist/image-editor/index.cjs +24 -24
  42. package/dist/image-editor/index.cjs.map +1 -1
  43. package/dist/image-editor/index.d.cts +2 -2
  44. package/dist/image-editor/index.d.ts +2 -2
  45. package/dist/image-editor/index.js +24 -24
  46. package/dist/image-editor/index.js.map +1 -1
  47. package/dist/{index-C6gaQRH0.d.cts → index-CfOQf70b.d.cts} +1 -1
  48. package/dist/{index-DXAv_R08.d.ts → index-jwJ_onWf.d.ts} +1 -1
  49. package/dist/index.cjs +9 -9
  50. package/dist/index.cjs.map +1 -1
  51. package/dist/index.d.cts +4 -4
  52. package/dist/index.d.ts +4 -4
  53. package/dist/index.js +12 -12
  54. package/dist/parameters/index.d.cts +2 -2
  55. package/dist/parameters/index.d.ts +2 -2
  56. package/dist/{registry-DnzpgY27.d.cts → registry-B4l-lYts.d.cts} +1 -1
  57. package/dist/{registry-DhVUZioj.d.ts → registry-BfVD-vVg.d.ts} +1 -1
  58. package/dist/{registry-BDe-vlv3.d.ts → registry-CSlH4iUn.d.ts} +1 -1
  59. package/dist/{registry-D0GADKc7.d.cts → registry-vz6HOiiy.d.cts} +1 -1
  60. package/dist/{schema-DYDGdYL9.d.cts → schema-Di0CS6Pe.d.cts} +26 -2
  61. package/dist/{schema-DYDGdYL9.d.ts → schema-Di0CS6Pe.d.ts} +26 -2
  62. package/dist/tools/index.cjs +37 -3
  63. package/dist/tools/index.cjs.map +1 -1
  64. package/dist/tools/index.d.cts +871 -11
  65. package/dist/tools/index.d.ts +871 -11
  66. package/dist/tools/index.js +36 -2
  67. package/dist/vector/index.d.cts +2 -2
  68. package/dist/vector/index.d.ts +2 -2
  69. package/package.json +1 -1
  70. package/dist/chunk-36BLROHV.js +0 -438
  71. package/dist/chunk-36BLROHV.js.map +0 -1
  72. package/dist/chunk-5H2OPMXZ.js +0 -586
  73. package/dist/chunk-5H2OPMXZ.js.map +0 -1
  74. package/dist/chunk-6MDQKHRH.cjs.map +0 -1
  75. package/dist/chunk-D6S5M7HV.js +0 -101
  76. package/dist/chunk-D6S5M7HV.js.map +0 -1
  77. package/dist/chunk-DDADOHJW.js.map +0 -1
  78. package/dist/chunk-I6BZB5ZH.cjs.map +0 -1
  79. package/dist/chunk-MC2LQN5S.cjs +0 -586
  80. package/dist/chunk-MC2LQN5S.cjs.map +0 -1
  81. package/dist/chunk-V7CC7RZ6.cjs +0 -438
  82. package/dist/chunk-V7CC7RZ6.cjs.map +0 -1
package/README.md CHANGED
@@ -206,7 +206,32 @@ registry.onListChanged((tools) => server.sendToolListChanged());
206
206
  await registry.callTool("insert_text", { text: "Hello" }); // { content: [...], structuredContent }
207
207
  ```
208
208
 
209
- `createEditorMcpToolProvider` exposes the static tools (`get_editor_state`, `edit_canvas`, `edit_prompt`, `view_editor`) through the registry, and `planToolCall` turns any tool call into planner steps (`step:tool_call` for registry tools).
209
+ Built-in providers:
210
+
211
+ | Provider | Tools |
212
+ | :--- | :--- |
213
+ | `createRichTextToolProvider(editor, { id })` | `get_text` (`format`, `blocks: true` for every paragraph's positions), `find_text`, `insert_text`, `replace_text` (all matches or the n-th, one undo step), `replace_range`, `replace_selection`, `set_selection`, `edit_table` (when tables are on). Read-only editors get `get_text` and `find_text`. |
214
+ | `createSpreadsheetToolProvider(controller, { id })` | `get_range`, `set_cell`, `set_range` (2D block, one undo step, refuses read-only targets), `insert_rows`, `delete_rows`, `insert_columns`, `delete_columns` |
215
+ | `createEditorMcpToolProvider({ id, getSnapshot, applySteps })` | `get_editor_state`, `canvas_add_node`, `canvas_remove_nodes`, `canvas_connect`, `canvas_update_node`, `canvas_layout`, `canvas_select`, `canvas_highlight`, `prompt_insert_text`, `prompt_replace_range`, `prompt_set_variable`, `prompt_select`, `view_editor` (with `captureView`) |
216
+ | `createCanvasComponentToolProvider`, `createCommandToolProvider`, `createImageEditorToolProvider`, `createGenerationToolProvider` | See the canvas, commands, image editor and generation docs |
217
+
218
+ Text tools take ProseMirror document positions, not plain-text offsets: `find_text` and `get_text { blocks: true }` return them. The canvas tools check node ids against `getSnapshot()` (unknown ids, an id that already exists, self-edges and unordered ranges are tool errors the model can fix) and return what they created: `{ applied, steps, created: { nodes: [{ id, position }], edges: [{ id, source, target }] } }`. Pass `toolStyle: "combined"` for the older `edit_canvas` / `edit_prompt` tools with an `operation` argument, and `surfaces: { canvas: false }` to expose only the prompt tools. `planToolCall` turns any tool call into planner steps (`step:tool_call` for registry tools), and `validateAgentCommand` runs the same checks for hosts that drive the planner directly.
219
+
220
+ Tool `inputSchema`s are validated by `validateJsonSchema`, which supports `type`, `enum`, `const`, `properties`, `required`, `additionalProperties`, `items`, `minItems` / `maxItems`, `uniqueItems`, `minimum` / `maximum`, `exclusiveMinimum` / `exclusiveMaximum`, `multipleOf`, `minLength` / `maxLength`, `pattern`, `anyOf`, `oneOf`, `allOf`, `not` and local `$ref`s (`#/$defs/...`). Other keywords are ignored.
221
+
222
+ ### Serving the registry over MCP
223
+
224
+ `createMcpServer(registry, { name, version, send })` (in `/tools`, no dependencies) answers MCP JSON-RPC messages from any transport: stdio lines, a WebSocket, `postMessage` or an HTTP handler. It handles `initialize` (protocol version negotiation), `ping`, `tools/list`, `tools/call` and `notifications/cancelled` (aborts the call's `signal`), and sends `notifications/tools/list_changed` through `send` once the client is initialized.
225
+
226
+ ```ts
227
+ import { createMcpServer } from "@pixerate/editor/tools";
228
+
229
+ const server = createMcpServer(registry, { name: "my-app", version: "1.0.0", send: (msg) => socket.send(JSON.stringify(msg)) });
230
+ socket.onmessage = async (event) => {
231
+ const response = await server.handle(event.data);
232
+ if (response) socket.send(JSON.stringify(response));
233
+ };
234
+ ```
210
235
 
211
236
  ### Without TipTap: `@pixerate/editor/tools`
212
237
 
@@ -223,7 +248,7 @@ const list = registry.listTools(); // MCP tools/list result
223
248
  const result = await registry.callTool(name, args); // MCP tools/call result
224
249
  ```
225
250
 
226
- It exports `ToolRegistry`, `createToolRegistry`, `ToolRegistryError`, the tool types (`AgentTool`, `AgentToolProvider`, `AgentToolHandler`, `ToolCallContext`, `McpToolDefinition`, `McpToolResult`, `McpListToolsResult`, `ToolCallError`), `validateJsonSchema` / `SchemaValidationError`, and the static `EDITOR_MCP_TOOLS` definitions. `/agent` re-exports all of it, so existing imports keep working. `createEditorMcpToolProvider` stays in `/agent` because its `layout` operation runs dagre.
251
+ It exports `ToolRegistry`, `createToolRegistry`, `ToolRegistryError`, the tool types (`AgentTool`, `AgentToolProvider`, `AgentToolHandler`, `ToolCallContext`, `McpToolDefinition`, `McpToolResult`, `McpListToolsResult`, `ToolCallError`), `validateJsonSchema` / `SchemaValidationError`, the static tool definitions (`EDITOR_MCP_TOOLS`, `EDITOR_CANVAS_TOOLS`, `EDITOR_PROMPT_TOOLS`) and `createMcpServer`. `/agent` re-exports all of it, so existing imports keep working. `createEditorMcpToolProvider` stays in `/agent` because its `layout` operation runs dagre.
227
252
 
228
253
  ## Commands, shortcuts and the command palette
229
254