@pixerate/editor 0.8.1 → 0.10.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/dist/agent/index.cjs +512 -0
- package/dist/agent/index.cjs.map +1 -0
- package/dist/agent/index.d.cts +369 -0
- package/dist/agent/index.d.ts +369 -0
- package/dist/agent/index.js +471 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/canvas/index.cjs +797 -0
- package/dist/canvas/index.cjs.map +1 -0
- package/dist/canvas/index.d.cts +187 -0
- package/dist/canvas/index.d.ts +187 -0
- package/dist/canvas/index.js +731 -0
- package/dist/canvas/index.js.map +1 -0
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.d.cts +5 -27
- package/dist/extensions/index.d.ts +5 -27
- package/dist/extensions/index.js.map +1 -1
- package/dist/index.cjs +1274 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -5
- package/dist/index.d.ts +41 -5
- package/dist/index.js +1232 -6
- package/dist/index.js.map +1 -1
- package/dist/mention-Dcevh3ff.d.cts +32 -0
- package/dist/mention-Dcevh3ff.d.ts +32 -0
- package/dist/serializers/index.cjs +194 -4
- package/dist/serializers/index.cjs.map +1 -1
- package/dist/serializers/index.d.cts +89 -2
- package/dist/serializers/index.d.ts +89 -2
- package/dist/serializers/index.js +186 -3
- package/dist/serializers/index.js.map +1 -1
- package/dist/types-lGtRobRV.d.cts +213 -0
- package/dist/types-lGtRobRV.d.ts +213 -0
- package/package.json +13 -1
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
import { d as CanvasNode, b as CanvasEdge, X as XYPosition, S as Side } from '../types-lGtRobRV.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Agent presence state for visual multiplayer/agent choreography.
|
|
5
|
+
*/
|
|
6
|
+
interface AgentPresence {
|
|
7
|
+
agentId: string;
|
|
8
|
+
name: string;
|
|
9
|
+
color: string;
|
|
10
|
+
cursorPosition?: XYPosition;
|
|
11
|
+
selectedNodeIds?: string[];
|
|
12
|
+
activeNodeId?: string;
|
|
13
|
+
statusMessage?: string;
|
|
14
|
+
lastActive: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Snapshot of current editor and canvas state provided to agent planners and MCP clients.
|
|
18
|
+
*/
|
|
19
|
+
interface EditorSnapshot<TNode extends CanvasNode = CanvasNode, TEdge extends CanvasEdge = CanvasEdge> {
|
|
20
|
+
document?: {
|
|
21
|
+
text: string;
|
|
22
|
+
variables?: Record<string, any>;
|
|
23
|
+
selection?: {
|
|
24
|
+
from: number;
|
|
25
|
+
to: number;
|
|
26
|
+
};
|
|
27
|
+
isDirty?: boolean;
|
|
28
|
+
};
|
|
29
|
+
canvas?: {
|
|
30
|
+
nodes: TNode[];
|
|
31
|
+
edges: TEdge[];
|
|
32
|
+
selectedNodeIds?: string[];
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* High-level intent commands that an AI agent or remote controller can issue.
|
|
37
|
+
*/
|
|
38
|
+
type AgentCommand<TNode extends CanvasNode = CanvasNode, TEdge extends CanvasEdge = CanvasEdge> = {
|
|
39
|
+
type: 'canvas:add_node';
|
|
40
|
+
node: Omit<TNode, 'position'> & {
|
|
41
|
+
position?: XYPosition;
|
|
42
|
+
};
|
|
43
|
+
nearNodeId?: string;
|
|
44
|
+
side?: Side;
|
|
45
|
+
} | {
|
|
46
|
+
type: 'canvas:remove_nodes';
|
|
47
|
+
nodeIds: string[];
|
|
48
|
+
} | {
|
|
49
|
+
type: 'canvas:connect';
|
|
50
|
+
source: string;
|
|
51
|
+
target: string;
|
|
52
|
+
label?: string;
|
|
53
|
+
} | {
|
|
54
|
+
type: 'canvas:update_node';
|
|
55
|
+
id: string;
|
|
56
|
+
data: Partial<TNode['data']>;
|
|
57
|
+
} | {
|
|
58
|
+
type: 'canvas:layout';
|
|
59
|
+
direction?: 'LR' | 'TB' | 'RL' | 'BT';
|
|
60
|
+
incremental?: boolean;
|
|
61
|
+
} | {
|
|
62
|
+
type: 'canvas:select';
|
|
63
|
+
nodeIds: string[];
|
|
64
|
+
} | {
|
|
65
|
+
type: 'canvas:highlight';
|
|
66
|
+
nodeIds: string[];
|
|
67
|
+
color?: string;
|
|
68
|
+
durationMs?: number;
|
|
69
|
+
} | {
|
|
70
|
+
type: 'prompt:insert_text';
|
|
71
|
+
text: string;
|
|
72
|
+
at?: number;
|
|
73
|
+
} | {
|
|
74
|
+
type: 'prompt:replace_range';
|
|
75
|
+
from: number;
|
|
76
|
+
to: number;
|
|
77
|
+
text: string;
|
|
78
|
+
} | {
|
|
79
|
+
type: 'prompt:set_variable';
|
|
80
|
+
name: string;
|
|
81
|
+
value: any;
|
|
82
|
+
} | {
|
|
83
|
+
type: 'prompt:select';
|
|
84
|
+
from: number;
|
|
85
|
+
to: number;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Atomic execution steps returned by the planner.
|
|
89
|
+
*/
|
|
90
|
+
type AgentStep<TNode extends CanvasNode = CanvasNode, TEdge extends CanvasEdge = CanvasEdge> = {
|
|
91
|
+
type: 'step:canvas_add_node';
|
|
92
|
+
node: TNode;
|
|
93
|
+
} | {
|
|
94
|
+
type: 'step:canvas_remove_nodes';
|
|
95
|
+
nodeIds: string[];
|
|
96
|
+
} | {
|
|
97
|
+
type: 'step:canvas_add_edge';
|
|
98
|
+
edge: TEdge;
|
|
99
|
+
} | {
|
|
100
|
+
type: 'step:canvas_update_node';
|
|
101
|
+
id: string;
|
|
102
|
+
data: Partial<TNode['data']>;
|
|
103
|
+
} | {
|
|
104
|
+
type: 'step:canvas_move_nodes';
|
|
105
|
+
positions: Record<string, XYPosition>;
|
|
106
|
+
} | {
|
|
107
|
+
type: 'step:canvas_select';
|
|
108
|
+
nodeIds: string[];
|
|
109
|
+
} | {
|
|
110
|
+
type: 'step:canvas_highlight';
|
|
111
|
+
nodeIds: string[];
|
|
112
|
+
color: string;
|
|
113
|
+
durationMs: number;
|
|
114
|
+
} | {
|
|
115
|
+
type: 'step:prompt_insert';
|
|
116
|
+
text: string;
|
|
117
|
+
at?: number;
|
|
118
|
+
} | {
|
|
119
|
+
type: 'step:prompt_replace';
|
|
120
|
+
from: number;
|
|
121
|
+
to: number;
|
|
122
|
+
text: string;
|
|
123
|
+
} | {
|
|
124
|
+
type: 'step:prompt_set_variable';
|
|
125
|
+
name: string;
|
|
126
|
+
value: any;
|
|
127
|
+
} | {
|
|
128
|
+
type: 'step:prompt_select';
|
|
129
|
+
from: number;
|
|
130
|
+
to: number;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Plans a sequence of atomic execution steps from a high-level agent command.
|
|
135
|
+
*/
|
|
136
|
+
declare function planAgentCommand<TNode extends CanvasNode = CanvasNode, TEdge extends CanvasEdge = CanvasEdge>(command: AgentCommand<TNode, TEdge>, snapshot: EditorSnapshot<TNode, TEdge>, options?: {
|
|
137
|
+
defaultNodeSize?: {
|
|
138
|
+
width: number;
|
|
139
|
+
height: number;
|
|
140
|
+
};
|
|
141
|
+
idGenerator?: () => string;
|
|
142
|
+
}): AgentStep<TNode, TEdge>[];
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Standard MCP Tool Definitions for @pixerate/editor.
|
|
146
|
+
* Compatible with the Model Context Protocol (MCP) tool specification schema.
|
|
147
|
+
*/
|
|
148
|
+
declare const MCP_TOOL_GET_EDITOR_STATE: {
|
|
149
|
+
readonly name: "get_editor_state";
|
|
150
|
+
readonly description: "Retrieves the current state of the document, variables, selection, and canvas graph (nodes and edges).";
|
|
151
|
+
readonly inputSchema: {
|
|
152
|
+
readonly type: "object";
|
|
153
|
+
readonly properties: {
|
|
154
|
+
readonly includeDocument: {
|
|
155
|
+
readonly type: "boolean";
|
|
156
|
+
readonly description: "Whether to include the prompt document text and variables (default: true).";
|
|
157
|
+
};
|
|
158
|
+
readonly includeCanvas: {
|
|
159
|
+
readonly type: "boolean";
|
|
160
|
+
readonly description: "Whether to include the canvas nodes and edges (default: true).";
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
declare const MCP_TOOL_EDIT_CANVAS: {
|
|
166
|
+
readonly name: "edit_canvas";
|
|
167
|
+
readonly description: "Applies high-level structural operations to the visual canvas (adding nodes, connecting edges, organizing layout, or moving elements).";
|
|
168
|
+
readonly inputSchema: {
|
|
169
|
+
readonly type: "object";
|
|
170
|
+
readonly properties: {
|
|
171
|
+
readonly operation: {
|
|
172
|
+
readonly type: "string";
|
|
173
|
+
readonly enum: readonly ["add_node", "remove_nodes", "connect", "update_node", "layout", "select", "highlight"];
|
|
174
|
+
readonly description: "The canvas operation to execute.";
|
|
175
|
+
};
|
|
176
|
+
readonly node: {
|
|
177
|
+
readonly type: "object";
|
|
178
|
+
readonly description: "Node definition when operation is add_node. Can omit position to auto-place.";
|
|
179
|
+
};
|
|
180
|
+
readonly nearNodeId: {
|
|
181
|
+
readonly type: "string";
|
|
182
|
+
readonly description: "Anchor node ID to position beside using collision-aware placement.";
|
|
183
|
+
};
|
|
184
|
+
readonly side: {
|
|
185
|
+
readonly type: "string";
|
|
186
|
+
readonly enum: readonly ["top", "right", "bottom", "left"];
|
|
187
|
+
readonly description: "Side of the anchor node to place the new node beside.";
|
|
188
|
+
};
|
|
189
|
+
readonly nodeIds: {
|
|
190
|
+
readonly type: "array";
|
|
191
|
+
readonly items: {
|
|
192
|
+
readonly type: "string";
|
|
193
|
+
};
|
|
194
|
+
readonly description: "Array of node IDs for remove_nodes, select, or highlight.";
|
|
195
|
+
};
|
|
196
|
+
readonly source: {
|
|
197
|
+
readonly type: "string";
|
|
198
|
+
readonly description: "Source node ID for connect operation.";
|
|
199
|
+
};
|
|
200
|
+
readonly target: {
|
|
201
|
+
readonly type: "string";
|
|
202
|
+
readonly description: "Target node ID for connect operation.";
|
|
203
|
+
};
|
|
204
|
+
readonly label: {
|
|
205
|
+
readonly type: "string";
|
|
206
|
+
readonly description: "Optional edge label for connect operation.";
|
|
207
|
+
};
|
|
208
|
+
readonly direction: {
|
|
209
|
+
readonly type: "string";
|
|
210
|
+
readonly enum: readonly ["LR", "TB", "RL", "BT"];
|
|
211
|
+
readonly description: "Layout direction (default LR).";
|
|
212
|
+
};
|
|
213
|
+
readonly incremental: {
|
|
214
|
+
readonly type: "boolean";
|
|
215
|
+
readonly description: "Preserve existing node coordinates and blend layout (default true).";
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
readonly required: readonly ["operation"];
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
declare const MCP_TOOL_EDIT_PROMPT: {
|
|
222
|
+
readonly name: "edit_prompt";
|
|
223
|
+
readonly description: "Applies edits to the prompt template document, including inserting text, replacing ranges, and setting variables.";
|
|
224
|
+
readonly inputSchema: {
|
|
225
|
+
readonly type: "object";
|
|
226
|
+
readonly properties: {
|
|
227
|
+
readonly operation: {
|
|
228
|
+
readonly type: "string";
|
|
229
|
+
readonly enum: readonly ["insert_text", "replace_range", "set_variable", "select"];
|
|
230
|
+
readonly description: "The prompt operation to execute.";
|
|
231
|
+
};
|
|
232
|
+
readonly text: {
|
|
233
|
+
readonly type: "string";
|
|
234
|
+
readonly description: "Text to insert or replace.";
|
|
235
|
+
};
|
|
236
|
+
readonly at: {
|
|
237
|
+
readonly type: "number";
|
|
238
|
+
readonly description: "Position to insert text at.";
|
|
239
|
+
};
|
|
240
|
+
readonly from: {
|
|
241
|
+
readonly type: "number";
|
|
242
|
+
readonly description: "Start offset for replace_range or select.";
|
|
243
|
+
};
|
|
244
|
+
readonly to: {
|
|
245
|
+
readonly type: "number";
|
|
246
|
+
readonly description: "End offset for replace_range or select.";
|
|
247
|
+
};
|
|
248
|
+
readonly name: {
|
|
249
|
+
readonly type: "string";
|
|
250
|
+
readonly description: "Variable name for set_variable.";
|
|
251
|
+
};
|
|
252
|
+
readonly value: {
|
|
253
|
+
readonly description: "Variable value for set_variable.";
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
readonly required: readonly ["operation"];
|
|
257
|
+
};
|
|
258
|
+
};
|
|
259
|
+
declare const EDITOR_MCP_TOOLS: readonly [{
|
|
260
|
+
readonly name: "get_editor_state";
|
|
261
|
+
readonly description: "Retrieves the current state of the document, variables, selection, and canvas graph (nodes and edges).";
|
|
262
|
+
readonly inputSchema: {
|
|
263
|
+
readonly type: "object";
|
|
264
|
+
readonly properties: {
|
|
265
|
+
readonly includeDocument: {
|
|
266
|
+
readonly type: "boolean";
|
|
267
|
+
readonly description: "Whether to include the prompt document text and variables (default: true).";
|
|
268
|
+
};
|
|
269
|
+
readonly includeCanvas: {
|
|
270
|
+
readonly type: "boolean";
|
|
271
|
+
readonly description: "Whether to include the canvas nodes and edges (default: true).";
|
|
272
|
+
};
|
|
273
|
+
};
|
|
274
|
+
};
|
|
275
|
+
}, {
|
|
276
|
+
readonly name: "edit_canvas";
|
|
277
|
+
readonly description: "Applies high-level structural operations to the visual canvas (adding nodes, connecting edges, organizing layout, or moving elements).";
|
|
278
|
+
readonly inputSchema: {
|
|
279
|
+
readonly type: "object";
|
|
280
|
+
readonly properties: {
|
|
281
|
+
readonly operation: {
|
|
282
|
+
readonly type: "string";
|
|
283
|
+
readonly enum: readonly ["add_node", "remove_nodes", "connect", "update_node", "layout", "select", "highlight"];
|
|
284
|
+
readonly description: "The canvas operation to execute.";
|
|
285
|
+
};
|
|
286
|
+
readonly node: {
|
|
287
|
+
readonly type: "object";
|
|
288
|
+
readonly description: "Node definition when operation is add_node. Can omit position to auto-place.";
|
|
289
|
+
};
|
|
290
|
+
readonly nearNodeId: {
|
|
291
|
+
readonly type: "string";
|
|
292
|
+
readonly description: "Anchor node ID to position beside using collision-aware placement.";
|
|
293
|
+
};
|
|
294
|
+
readonly side: {
|
|
295
|
+
readonly type: "string";
|
|
296
|
+
readonly enum: readonly ["top", "right", "bottom", "left"];
|
|
297
|
+
readonly description: "Side of the anchor node to place the new node beside.";
|
|
298
|
+
};
|
|
299
|
+
readonly nodeIds: {
|
|
300
|
+
readonly type: "array";
|
|
301
|
+
readonly items: {
|
|
302
|
+
readonly type: "string";
|
|
303
|
+
};
|
|
304
|
+
readonly description: "Array of node IDs for remove_nodes, select, or highlight.";
|
|
305
|
+
};
|
|
306
|
+
readonly source: {
|
|
307
|
+
readonly type: "string";
|
|
308
|
+
readonly description: "Source node ID for connect operation.";
|
|
309
|
+
};
|
|
310
|
+
readonly target: {
|
|
311
|
+
readonly type: "string";
|
|
312
|
+
readonly description: "Target node ID for connect operation.";
|
|
313
|
+
};
|
|
314
|
+
readonly label: {
|
|
315
|
+
readonly type: "string";
|
|
316
|
+
readonly description: "Optional edge label for connect operation.";
|
|
317
|
+
};
|
|
318
|
+
readonly direction: {
|
|
319
|
+
readonly type: "string";
|
|
320
|
+
readonly enum: readonly ["LR", "TB", "RL", "BT"];
|
|
321
|
+
readonly description: "Layout direction (default LR).";
|
|
322
|
+
};
|
|
323
|
+
readonly incremental: {
|
|
324
|
+
readonly type: "boolean";
|
|
325
|
+
readonly description: "Preserve existing node coordinates and blend layout (default true).";
|
|
326
|
+
};
|
|
327
|
+
};
|
|
328
|
+
readonly required: readonly ["operation"];
|
|
329
|
+
};
|
|
330
|
+
}, {
|
|
331
|
+
readonly name: "edit_prompt";
|
|
332
|
+
readonly description: "Applies edits to the prompt template document, including inserting text, replacing ranges, and setting variables.";
|
|
333
|
+
readonly inputSchema: {
|
|
334
|
+
readonly type: "object";
|
|
335
|
+
readonly properties: {
|
|
336
|
+
readonly operation: {
|
|
337
|
+
readonly type: "string";
|
|
338
|
+
readonly enum: readonly ["insert_text", "replace_range", "set_variable", "select"];
|
|
339
|
+
readonly description: "The prompt operation to execute.";
|
|
340
|
+
};
|
|
341
|
+
readonly text: {
|
|
342
|
+
readonly type: "string";
|
|
343
|
+
readonly description: "Text to insert or replace.";
|
|
344
|
+
};
|
|
345
|
+
readonly at: {
|
|
346
|
+
readonly type: "number";
|
|
347
|
+
readonly description: "Position to insert text at.";
|
|
348
|
+
};
|
|
349
|
+
readonly from: {
|
|
350
|
+
readonly type: "number";
|
|
351
|
+
readonly description: "Start offset for replace_range or select.";
|
|
352
|
+
};
|
|
353
|
+
readonly to: {
|
|
354
|
+
readonly type: "number";
|
|
355
|
+
readonly description: "End offset for replace_range or select.";
|
|
356
|
+
};
|
|
357
|
+
readonly name: {
|
|
358
|
+
readonly type: "string";
|
|
359
|
+
readonly description: "Variable name for set_variable.";
|
|
360
|
+
};
|
|
361
|
+
readonly value: {
|
|
362
|
+
readonly description: "Variable value for set_variable.";
|
|
363
|
+
};
|
|
364
|
+
};
|
|
365
|
+
readonly required: readonly ["operation"];
|
|
366
|
+
};
|
|
367
|
+
}];
|
|
368
|
+
|
|
369
|
+
export { type AgentCommand, type AgentPresence, type AgentStep, EDITOR_MCP_TOOLS, type EditorSnapshot, MCP_TOOL_EDIT_CANVAS, MCP_TOOL_EDIT_PROMPT, MCP_TOOL_GET_EDITOR_STATE, planAgentCommand };
|