@pixerate/editor 0.139.1 → 0.140.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.
- package/README.md +25 -4
- package/dist/agent/formatTools.d.cts +15 -0
- package/dist/agent/formatTools.d.ts +15 -0
- package/dist/agent/index.cjs +397 -46
- package/dist/agent/index.js +365 -14
- package/dist/agent/providers.d.cts +5 -3
- package/dist/agent/providers.d.ts +5 -3
- package/dist/animation-editor/effect-tools.d.cts +1 -1
- package/dist/animation-editor/effect-tools.d.ts +1 -1
- package/dist/animation-editor/index.cjs +250 -116
- package/dist/animation-editor/index.js +228 -94
- package/dist/animation-editor/instructions.d.cts +1 -1
- package/dist/animation-editor/instructions.d.ts +1 -1
- package/dist/animation-editor/parse.d.cts +3 -1
- package/dist/animation-editor/parse.d.ts +3 -1
- package/dist/animation-editor/tools.d.cts +8 -3
- package/dist/animation-editor/tools.d.ts +8 -3
- package/dist/bridge/cli.cjs +3 -3
- package/dist/bridge/cli.js +2 -2
- package/dist/bridge/index.cjs +7 -3
- package/dist/bridge/index.d.cts +7 -0
- package/dist/bridge/index.d.ts +7 -0
- package/dist/bridge/index.js +8 -4
- package/dist/bridge/skills.d.cts +9 -0
- package/dist/bridge/skills.d.ts +9 -0
- package/dist/canvas/effect-tools.d.cts +1 -1
- package/dist/canvas/effect-tools.d.ts +1 -1
- package/dist/canvas/index.cjs +22 -17
- package/dist/canvas/index.js +8 -3
- package/dist/chart/file-tools.d.cts +1 -1
- package/dist/chart/file-tools.d.ts +1 -1
- package/dist/chart/index.cjs +7 -1
- package/dist/chart/index.js +7 -1
- package/dist/chart/tools.d.cts +1 -1
- package/dist/chart/tools.d.ts +1 -1
- package/dist/{chunk-BKMU3V6K.js → chunk-5ED73EC6.js} +8 -1
- package/dist/{chunk-VRIR53SW.js → chunk-5G3KYRER.js} +2 -1
- package/dist/{chunk-KHMVB3SJ.js → chunk-7KWJEYIK.js} +4 -1
- package/dist/{chunk-R47NQICB.cjs → chunk-HDCH35UM.cjs} +47 -10
- package/dist/{chunk-6NCBFBXA.js → chunk-IQ6KKXOU.js} +1 -1
- package/dist/{chunk-PCNCT4ZY.js → chunk-KIBEEN5K.js} +40 -3
- package/dist/{chunk-CZRWP6IW.cjs → chunk-N2FGYZ4Q.cjs} +8 -1
- package/dist/{chunk-T6Y5FV7G.cjs → chunk-RPW7YL3D.cjs} +2 -1
- package/dist/{chunk-3V746PF4.cjs → chunk-RUZQMYXH.cjs} +4 -1
- package/dist/{chunk-GUPQ5BNA.cjs → chunk-RWML7TWG.cjs} +44 -44
- package/dist/{chunk-HGHXGCKG.cjs → chunk-SVFEVKLF.cjs} +1 -1
- package/dist/{chunk-PQMADRCI.js → chunk-UOJS6PUP.js} +1 -1
- package/dist/{chunk-BWT4IWLK.cjs → chunk-VKF3PWKR.cjs} +7 -7
- package/dist/chunk-WBKLYLZE.js +1156 -0
- package/dist/{chunk-TBSPPVTT.js → chunk-XCK7QK5D.js} +1 -1
- package/dist/chunk-ZAOOIJ6I.cjs +1156 -0
- package/dist/commands/agentTools.d.cts +1 -1
- package/dist/commands/agentTools.d.ts +1 -1
- package/dist/commands/index.cjs +3 -0
- package/dist/commands/index.js +3 -0
- package/dist/diagram/index.cjs +3 -0
- package/dist/diagram/index.js +3 -0
- package/dist/diagram/tools.d.cts +1 -1
- package/dist/diagram/tools.d.ts +1 -1
- package/dist/effects/index.cjs +32 -32
- package/dist/effects/index.js +1 -1
- package/dist/effects/tools.d.cts +5 -1
- package/dist/effects/tools.d.ts +5 -1
- package/dist/extensions/index.cjs +3 -3
- package/dist/extensions/index.js +2 -2
- package/dist/generation/index.cjs +7 -1
- package/dist/generation/index.js +7 -1
- package/dist/image-editor/index.cjs +21 -15
- package/dist/image-editor/index.js +8 -2
- package/dist/image-editor/provider-effect-tools.d.cts +1 -1
- package/dist/image-editor/provider-effect-tools.d.ts +1 -1
- package/dist/image-editor/tools.d.cts +1 -1
- package/dist/image-editor/tools.d.ts +1 -1
- package/dist/index.cjs +8 -8
- package/dist/index.js +2 -2
- package/dist/paint-editor/effect-tools.d.cts +1 -1
- package/dist/paint-editor/effect-tools.d.ts +1 -1
- package/dist/paint-editor/index.cjs +18 -8
- package/dist/paint-editor/index.js +13 -3
- package/dist/paint-editor/tools.d.cts +1 -1
- package/dist/paint-editor/tools.d.ts +1 -1
- package/dist/tools/bridge-client.d.cts +3 -3
- package/dist/tools/bridge-client.d.ts +3 -3
- package/dist/tools/capture.d.cts +5 -1
- package/dist/tools/capture.d.ts +5 -1
- package/dist/tools/definitions.d.cts +2 -2
- package/dist/tools/definitions.d.ts +2 -2
- package/dist/tools/index.cjs +31 -5
- package/dist/tools/index.d.cts +3 -0
- package/dist/tools/index.d.ts +3 -0
- package/dist/tools/index.js +31 -5
- package/dist/tools/mcp-server.d.cts +24 -6
- package/dist/tools/mcp-server.d.ts +24 -6
- package/dist/tools/registry.d.cts +81 -6
- package/dist/tools/registry.d.ts +81 -6
- package/dist/tools/search.d.cts +30 -0
- package/dist/tools/search.d.ts +30 -0
- package/dist/tools/skills.d.cts +26 -0
- package/dist/tools/skills.d.ts +26 -0
- package/dist/tools/view.d.cts +95 -0
- package/dist/tools/view.d.ts +95 -0
- package/dist/vector/effect-tools.d.cts +1 -1
- package/dist/vector/effect-tools.d.ts +1 -1
- package/dist/vector/index.cjs +13 -7
- package/dist/vector/index.js +8 -2
- package/dist/video-editor/effect-tools.d.cts +1 -1
- package/dist/video-editor/effect-tools.d.ts +1 -1
- package/dist/video-editor/index.cjs +275 -269
- package/dist/video-editor/index.js +8 -2
- package/dist/video-editor/tools.d.cts +1 -1
- package/dist/video-editor/tools.d.ts +1 -1
- package/package.json +4 -2
- package/skills/README.md +8 -3
- package/skills/pixerate-agent-tools/SKILL.md +33 -7
- package/skills/pixerate-animation-editor/SKILL.md +7 -0
- package/skills/pixerate-rich-text/SKILL.md +18 -4
- package/dist/chunk-5RRYDFU2.js +0 -466
- package/dist/chunk-SPVIXXIB.cjs +0 -466
- /package/dist/{chunk-SMJK5HBJ.js → chunk-MCTQXUXR.js} +0 -0
- /package/dist/{chunk-DDF6WQ62.cjs → chunk-R6DFK5OX.cjs} +0 -0
package/README.md
CHANGED
|
@@ -193,7 +193,9 @@ registerImportAdapter({
|
|
|
193
193
|
|
|
194
194
|
## Agent tool registry
|
|
195
195
|
|
|
196
|
-
`ToolRegistry` (`@pixerate/editor/agent`) collects MCP-shaped tools from live providers, for example one per mounted editor or spreadsheet. `listTools()` and `callTool()` return MCP `tools/list` / `tools/call` result shapes, arguments are validated against each tool's `inputSchema`, and `onListChanged` fires (coalesced) when providers come and go.
|
|
196
|
+
`ToolRegistry` (`@pixerate/editor/agent`) collects MCP-shaped tools from live providers, for example one per mounted editor or spreadsheet. `listTools()` and `callTool()` return MCP `tools/list` / `tools/call` result shapes, arguments are validated against each tool's `inputSchema`, and `onListChanged` fires (coalesced) when providers come and go.
|
|
197
|
+
|
|
198
|
+
Each provider is a toolset. Its tools are exposed as `<namespace>__<name>`, where the namespace is the provider's `namespace` or else its `id` (`doc__get_text`, `sheet__set_range`), so a name never changes when another editor mounts. `callTool`, `hasTool` and `getTool` also take the bare name when only one tool has it. Pass `namespace: ''` on a provider for bare names (prefixed with the id only on a collision), or `new ToolRegistry({ namespaces: 'on-collision' })` for that across the registry. Providers also carry a `title`, `description` and `skill`, which `registry.toolsets()` reports.
|
|
197
199
|
|
|
198
200
|
```ts
|
|
199
201
|
import { ToolRegistry, createRichTextToolProvider, createSpreadsheetToolProvider } from "@pixerate/editor/agent";
|
|
@@ -203,14 +205,33 @@ const unregister = registry.register(createRichTextToolProvider(controller, { id
|
|
|
203
205
|
registry.register(createSpreadsheetToolProvider(sheet, { id: "sheet", namespace: "sheet" }));
|
|
204
206
|
registry.onListChanged((tools) => server.sendToolListChanged());
|
|
205
207
|
|
|
206
|
-
await registry.callTool("
|
|
208
|
+
await registry.callTool("doc__insert_text", { text: "Hello" }); // { content: [...], structuredContent }
|
|
207
209
|
```
|
|
208
210
|
|
|
211
|
+
### Large catalogues: scoped views and discovery
|
|
212
|
+
|
|
213
|
+
With every editor mounted the registry holds hundreds of tools, which costs a model context and makes the right one harder to pick. `registry.view(options)` is a filtered tool source to serve instead:
|
|
214
|
+
|
|
215
|
+
- `toolsets: ['chart']` (or a predicate) shows only those toolsets; call `view.setToolsets()` as the user switches editors.
|
|
216
|
+
- `readOnly: true` shows only tools annotated `readOnlyHint`. Tools outside a view are refused with the reason.
|
|
217
|
+
- `discovery: { skills }` lists only `list_toolsets`, `search_tools`, `enable_tools`, `disable_tools` and (with skill files) `get_skill` at first. The agent searches by task, enables the tools it needs, and the view announces each change through `onListChanged`. `searchTools(tools, toolsets, query)` is the ranking `search_tools` uses.
|
|
218
|
+
|
|
219
|
+
```ts
|
|
220
|
+
import { createMcpServer, toolsetInstructions } from "@pixerate/editor/tools";
|
|
221
|
+
import { loadSkillFiles } from "@pixerate/editor/bridge"; // Node; in a browser import the .md files as text
|
|
222
|
+
|
|
223
|
+
const skills = loadSkillFiles();
|
|
224
|
+
const view = registry.view({ discovery: { skills } });
|
|
225
|
+
const server = createMcpServer(view, { name: "my-app", version: "1.0.0", instructions: toolsetInstructions, skills, send });
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
`createMcpServer({ skills })` also serves the skills as MCP prompts and `skill://<name>/SKILL.md` resources. `useToolRegistryView` (React and Svelte) makes a view for a component's lifetime, and `useToolBridge` accepts one.
|
|
229
|
+
|
|
209
230
|
Built-in providers:
|
|
210
231
|
|
|
211
232
|
| Provider | Tools |
|
|
212
233
|
| :--- | :--- |
|
|
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`. |
|
|
234
|
+
| `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`, `format_text` (inline marks: bold, italic, links, colour…), `set_block_type` (paragraph, heading, lists, quote, code block), `set_text_align` (each as far as the schema supports it), `edit_table` (when tables are on). Read-only editors get `get_text` and `find_text`. |
|
|
214
235
|
| `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`, `merge_cells`, `unmerge_cells`, `transpose_range` (on an A1 range, not the user's selection) |
|
|
215
236
|
| `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
237
|
| `createCanvasComponentToolProvider`, `createCommandToolProvider`, `createImageEditorToolProvider`, `createGenerationToolProvider` | See the canvas, commands, image editor and generation docs |
|
|
@@ -221,7 +242,7 @@ Tool `inputSchema`s are validated by `validateJsonSchema`, which supports `type`
|
|
|
221
242
|
|
|
222
243
|
### Serving the registry over MCP
|
|
223
244
|
|
|
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.
|
|
245
|
+
`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`, with `skills` `resources/list` / `resources/read` / `prompts/list` / `prompts/get`, and `notifications/cancelled` (aborts the call's `signal`), and sends `notifications/tools/list_changed` through `send` once the client is initialized.
|
|
225
246
|
|
|
226
247
|
```ts
|
|
227
248
|
import { createMcpServer } from "@pixerate/editor/tools";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/core';
|
|
2
|
+
import type { AgentTool } from '../tools/registry.cjs';
|
|
3
|
+
/**
|
|
4
|
+
* The formatting tools for a rich-text editor: `format_text` (inline marks), `set_block_type`
|
|
5
|
+
* (paragraphs, headings, lists, quotes, code blocks) and `set_text_align`, each listed only when
|
|
6
|
+
* the editor's schema has something for it to do. Each call is one undo step, leaves the
|
|
7
|
+
* user's selection where it was, and returns the range it changed with its formatting after.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createDocumentFormatTools(editor: () => Editor, changed: (ranges: Array<{
|
|
10
|
+
from: number;
|
|
11
|
+
to: number;
|
|
12
|
+
}>) => void): {
|
|
13
|
+
/** The formatting tools this editor's schema supports. */
|
|
14
|
+
tools(ed: Editor): AgentTool[];
|
|
15
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/core';
|
|
2
|
+
import type { AgentTool } from '../tools/registry.js';
|
|
3
|
+
/**
|
|
4
|
+
* The formatting tools for a rich-text editor: `format_text` (inline marks), `set_block_type`
|
|
5
|
+
* (paragraphs, headings, lists, quotes, code blocks) and `set_text_align`, each listed only when
|
|
6
|
+
* the editor's schema has something for it to do. Each call is one undo step, leaves the
|
|
7
|
+
* user's selection where it was, and returns the range it changed with its formatting after.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createDocumentFormatTools(editor: () => Editor, changed: (ranges: Array<{
|
|
10
|
+
from: number;
|
|
11
|
+
to: number;
|
|
12
|
+
}>) => void): {
|
|
13
|
+
/** The formatting tools this editor's schema supports. */
|
|
14
|
+
tools(ed: Editor): AgentTool[];
|
|
15
|
+
};
|