@pixerate/editor 0.22.0 → 0.24.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 +175 -2
- package/THIRD_PARTY_NOTICES.md +139 -0
- package/dist/agent/index.cjs +87 -111
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +70 -211
- package/dist/agent/index.d.ts +70 -211
- package/dist/agent/index.js +78 -102
- package/dist/agent/index.js.map +1 -1
- package/dist/arrangeShortcuts-B8O3f8-P.d.cts +184 -0
- package/dist/arrangeShortcuts-sLlD2rSX.d.ts +184 -0
- package/dist/canvas/index.cjs +2075 -86
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +608 -186
- package/dist/canvas/index.d.ts +608 -186
- package/dist/canvas/index.js +2060 -71
- package/dist/canvas/index.js.map +1 -1
- package/dist/chunk-26BVFKHU.cjs +453 -0
- package/dist/chunk-26BVFKHU.cjs.map +1 -0
- package/dist/chunk-2H7ZHPEJ.js +762 -0
- package/dist/chunk-2H7ZHPEJ.js.map +1 -0
- package/dist/{chunk-DENSCKFC.js → chunk-3CN2WD3X.js} +1730 -189
- package/dist/chunk-3CN2WD3X.js.map +1 -0
- package/dist/{chunk-JJDLPEWL.js → chunk-3LV6RRPH.js} +2 -2
- package/dist/{chunk-MJZBNWG7.js → chunk-5S3Z4PPF.js} +78 -557
- package/dist/chunk-5S3Z4PPF.js.map +1 -0
- package/dist/chunk-664LQYFJ.js +115 -0
- package/dist/chunk-664LQYFJ.js.map +1 -0
- package/dist/chunk-7DWMJCAT.js +453 -0
- package/dist/chunk-7DWMJCAT.js.map +1 -0
- package/dist/chunk-ARRTP33I.js +101 -0
- package/dist/chunk-ARRTP33I.js.map +1 -0
- package/dist/chunk-CPOKFNBG.cjs +101 -0
- package/dist/chunk-CPOKFNBG.cjs.map +1 -0
- package/dist/{chunk-AA4ZEVCC.cjs → chunk-D27YFC46.cjs} +101 -580
- package/dist/chunk-D27YFC46.cjs.map +1 -0
- package/dist/chunk-D6FH2YAX.cjs +131 -0
- package/dist/chunk-D6FH2YAX.cjs.map +1 -0
- package/dist/{chunk-4SUNJZWB.cjs → chunk-FD4LPFAE.cjs} +48 -200
- package/dist/chunk-FD4LPFAE.cjs.map +1 -0
- package/dist/chunk-FODNLX5N.js +749 -0
- package/dist/chunk-FODNLX5N.js.map +1 -0
- package/dist/{chunk-OYXSKQFR.js → chunk-FPENXAEJ.js} +35 -187
- package/dist/chunk-FPENXAEJ.js.map +1 -0
- package/dist/chunk-G2I4QJOT.cjs +762 -0
- package/dist/chunk-G2I4QJOT.cjs.map +1 -0
- package/dist/chunk-HLIMTC6N.js +1 -0
- package/dist/chunk-HLIMTC6N.js.map +1 -0
- package/dist/{chunk-QGHGJ56O.js → chunk-ITBSKI26.js} +1483 -19
- package/dist/chunk-ITBSKI26.js.map +1 -0
- package/dist/{chunk-6M3BCTBD.cjs → chunk-MA2F5KHF.cjs} +470 -242
- package/dist/chunk-MA2F5KHF.cjs.map +1 -0
- package/dist/{chunk-SAZRENEZ.cjs → chunk-MCSJFWAO.cjs} +1733 -192
- package/dist/chunk-MCSJFWAO.cjs.map +1 -0
- package/dist/chunk-MKA3AHLV.cjs +256 -0
- package/dist/chunk-MKA3AHLV.cjs.map +1 -0
- package/dist/chunk-OLZJXL4R.cjs +749 -0
- package/dist/chunk-OLZJXL4R.cjs.map +1 -0
- package/dist/chunk-OXSV64JX.js +689 -0
- package/dist/chunk-OXSV64JX.js.map +1 -0
- package/dist/chunk-P3RQ5UJE.cjs +689 -0
- package/dist/chunk-P3RQ5UJE.cjs.map +1 -0
- package/dist/chunk-P6ODPZ4W.js +256 -0
- package/dist/chunk-P6ODPZ4W.js.map +1 -0
- package/dist/chunk-PGNZKFQS.js +685 -0
- package/dist/chunk-PGNZKFQS.js.map +1 -0
- package/dist/chunk-PL4JB3BF.cjs +1 -0
- package/dist/chunk-PL4JB3BF.cjs.map +1 -0
- package/dist/{chunk-GVSMRPHB.cjs → chunk-SBCZ6RN5.cjs} +1568 -104
- package/dist/chunk-SBCZ6RN5.cjs.map +1 -0
- package/dist/{chunk-CL37JGFW.cjs → chunk-SML64VJG.cjs} +4 -4
- package/dist/{chunk-CL37JGFW.cjs.map → chunk-SML64VJG.cjs.map} +1 -1
- package/dist/chunk-TNNJXF46.cjs +115 -0
- package/dist/chunk-TNNJXF46.cjs.map +1 -0
- package/dist/chunk-U5HZSFCS.js +131 -0
- package/dist/chunk-U5HZSFCS.js.map +1 -0
- package/dist/{chunk-RU52I7QO.js → chunk-U5KWZU4X.js} +388 -160
- package/dist/chunk-U5KWZU4X.js.map +1 -0
- package/dist/chunk-XNORY7M6.cjs +685 -0
- package/dist/chunk-XNORY7M6.cjs.map +1 -0
- package/dist/commands/index.cjs +860 -0
- package/dist/commands/index.cjs.map +1 -0
- package/dist/commands/index.d.cts +244 -0
- package/dist/commands/index.d.ts +244 -0
- package/dist/commands/index.js +860 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/comment-store-BEMgVlAA.d.cts +135 -0
- package/dist/comment-store-BEMgVlAA.d.ts +135 -0
- package/dist/compare/index.cjs +15 -0
- package/dist/compare/index.cjs.map +1 -0
- package/dist/compare/index.d.cts +58 -0
- package/dist/compare/index.d.ts +58 -0
- package/dist/compare/index.js +15 -0
- package/dist/compare/index.js.map +1 -0
- package/dist/{controller-B7GIybc4.d.cts → controller-BhLLAoi8.d.cts} +119 -5
- package/dist/{controller-B7GIybc4.d.ts → controller-BhLLAoi8.d.ts} +119 -5
- package/dist/documents-BQjzJNe2.d.ts +76 -0
- package/dist/documents-KRTPhvst.d.cts +76 -0
- package/dist/extensions/index.cjs +53 -5
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.d.cts +7 -3
- package/dist/extensions/index.d.ts +7 -3
- package/dist/extensions/index.js +52 -4
- package/dist/generation/index.cjs +1373 -0
- package/dist/generation/index.cjs.map +1 -0
- package/dist/generation/index.d.cts +554 -0
- package/dist/generation/index.d.ts +554 -0
- package/dist/generation/index.js +1373 -0
- package/dist/generation/index.js.map +1 -0
- package/dist/grammar/index.cjs +48 -3
- package/dist/grammar/index.cjs.map +1 -1
- package/dist/grammar/index.d.cts +322 -100
- package/dist/grammar/index.d.ts +322 -100
- package/dist/grammar/index.js +54 -9
- package/dist/history/index.cjs +12 -2
- package/dist/history/index.cjs.map +1 -1
- package/dist/history/index.d.cts +211 -7
- package/dist/history/index.d.ts +211 -7
- package/dist/history/index.js +13 -3
- package/dist/image-editor/index.cjs +2244 -38
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +742 -4
- package/dist/image-editor/index.d.ts +742 -4
- package/dist/image-editor/index.js +2222 -16
- package/dist/image-editor/index.js.map +1 -1
- package/dist/{index-CCr_z9kF.d.cts → index-BhJBSm2d.d.cts} +370 -4
- package/dist/{index-Ck6ajwXh.d.ts → index-fJrlkJCd.d.ts} +370 -4
- package/dist/index.cjs +193 -98
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -48
- package/dist/index.d.ts +17 -48
- package/dist/index.js +198 -103
- package/dist/index.js.map +1 -1
- package/dist/migrate-iTlm3a8h.d.cts +112 -0
- package/dist/migrate-iTlm3a8h.d.ts +112 -0
- package/dist/persistence/index.cjs +676 -0
- package/dist/persistence/index.cjs.map +1 -0
- package/dist/persistence/index.d.cts +347 -0
- package/dist/persistence/index.d.ts +347 -0
- package/dist/persistence/index.js +676 -0
- package/dist/persistence/index.js.map +1 -0
- package/dist/registry-BDe-vlv3.d.ts +171 -0
- package/dist/registry-D32LpIc4.d.cts +354 -0
- package/dist/registry-DnzpgY27.d.cts +171 -0
- package/dist/registry-evKTP4ls.d.ts +354 -0
- package/dist/schema-DYDGdYL9.d.cts +41 -0
- package/dist/schema-DYDGdYL9.d.ts +41 -0
- package/dist/serializers/index.cjs +4 -3
- package/dist/serializers/index.cjs.map +1 -1
- package/dist/serializers/index.d.cts +2 -1
- package/dist/serializers/index.d.ts +2 -1
- package/dist/serializers/index.js +3 -2
- package/dist/sourcemap-C8AH3MBQ.d.cts +91 -0
- package/dist/sourcemap-DA1Evhrv.d.ts +91 -0
- package/dist/spreadsheet/index.cjs +53 -3
- package/dist/spreadsheet/index.cjs.map +1 -1
- package/dist/spreadsheet/index.d.cts +247 -18
- package/dist/spreadsheet/index.d.ts +247 -18
- package/dist/spreadsheet/index.js +58 -8
- package/dist/{tokens-CyLZmIei.d.cts → tokens-D7yXvUU6.d.cts} +15 -2
- package/dist/{tokens-CyLZmIei.d.ts → tokens-D7yXvUU6.d.ts} +15 -2
- package/dist/{track-changes-BSF58RK0.d.cts → track-changes-BK5sVf4_.d.cts} +18 -136
- package/dist/{track-changes-BSF58RK0.d.ts → track-changes-CDjCrwKe.d.ts} +18 -136
- package/dist/{types-CJ4U-HHI.d.ts → types-DX4Mh4SL.d.cts} +1 -1
- package/dist/{types-CJ4U-HHI.d.cts → types-DX4Mh4SL.d.ts} +1 -1
- package/dist/types-GT5a5YAX.d.cts +86 -0
- package/dist/types-GT5a5YAX.d.ts +86 -0
- package/package.json +23 -2
- package/dist/chunk-2TWGLC5K.cjs +0 -262
- package/dist/chunk-2TWGLC5K.cjs.map +0 -1
- package/dist/chunk-4SUNJZWB.cjs.map +0 -1
- package/dist/chunk-6M3BCTBD.cjs.map +0 -1
- package/dist/chunk-AA4ZEVCC.cjs.map +0 -1
- package/dist/chunk-AXV2ZW34.cjs +0 -118
- package/dist/chunk-AXV2ZW34.cjs.map +0 -1
- package/dist/chunk-B2ZRLN4S.js +0 -118
- package/dist/chunk-B2ZRLN4S.js.map +0 -1
- package/dist/chunk-DENSCKFC.js.map +0 -1
- package/dist/chunk-GVSMRPHB.cjs.map +0 -1
- package/dist/chunk-KAADNAPF.js +0 -262
- package/dist/chunk-KAADNAPF.js.map +0 -1
- package/dist/chunk-MJZBNWG7.js.map +0 -1
- package/dist/chunk-OYXSKQFR.js.map +0 -1
- package/dist/chunk-QGHGJ56O.js.map +0 -1
- package/dist/chunk-RU52I7QO.js.map +0 -1
- package/dist/chunk-SAZRENEZ.cjs.map +0 -1
- package/dist/types-BZgcDsC5.d.cts +0 -42
- package/dist/types-BZgcDsC5.d.ts +0 -42
- /package/dist/{chunk-JJDLPEWL.js.map → chunk-3LV6RRPH.js.map} +0 -0
package/dist/agent/index.d.cts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { C as CanvasNode,
|
|
1
|
+
import { C as CanvasNode, b as CanvasEdge, X as XYPosition, S as Side } from '../types-DX4Mh4SL.cjs';
|
|
2
|
+
export { J as JsonSchema, a as JsonSchemaType, S as SchemaValidationError, v as validateJsonSchema } from '../schema-DYDGdYL9.cjs';
|
|
3
|
+
import { A as AgentToolProvider } from '../registry-DnzpgY27.cjs';
|
|
4
|
+
export { a as AgentTool, b as AgentToolHandler, M as McpListToolsResult, c as McpToolContent, d as McpToolDefinition, e as McpToolResult, T as TOOL_NAMESPACE_SEPARATOR, f as ToolCallContext, g as ToolCallError, h as ToolErrorCode, i as ToolRegistry, j as ToolRegistryError, k as ToolRegistryOptions, l as createToolRegistry, t as toToolResult } from '../registry-DnzpgY27.cjs';
|
|
2
5
|
import { Editor } from '@tiptap/core';
|
|
3
|
-
import { S as SpreadsheetController } from '../controller-
|
|
6
|
+
import { S as SpreadsheetController } from '../controller-BhLLAoi8.cjs';
|
|
4
7
|
|
|
5
8
|
/**
|
|
6
9
|
* Agent presence state for visual multiplayer/agent choreography.
|
|
@@ -196,6 +199,14 @@ declare function planToolCall<TNode extends CanvasNode = CanvasNode, TEdge exten
|
|
|
196
199
|
*/
|
|
197
200
|
declare const MCP_TOOL_GET_EDITOR_STATE: {
|
|
198
201
|
readonly name: "get_editor_state";
|
|
202
|
+
readonly title: "Get editor state";
|
|
203
|
+
readonly annotations: {
|
|
204
|
+
readonly title: "Get editor state";
|
|
205
|
+
readonly readOnlyHint: true;
|
|
206
|
+
readonly destructiveHint: false;
|
|
207
|
+
readonly idempotentHint: true;
|
|
208
|
+
readonly openWorldHint: false;
|
|
209
|
+
};
|
|
199
210
|
readonly description: "Retrieves the current state of the document, variables, selection, and canvas graph (nodes and edges).";
|
|
200
211
|
readonly inputSchema: {
|
|
201
212
|
readonly type: "object";
|
|
@@ -213,6 +224,14 @@ declare const MCP_TOOL_GET_EDITOR_STATE: {
|
|
|
213
224
|
};
|
|
214
225
|
declare const MCP_TOOL_EDIT_CANVAS: {
|
|
215
226
|
readonly name: "edit_canvas";
|
|
227
|
+
readonly title: "Edit the canvas";
|
|
228
|
+
readonly annotations: {
|
|
229
|
+
readonly title: "Edit the canvas";
|
|
230
|
+
readonly readOnlyHint: false;
|
|
231
|
+
readonly destructiveHint: true;
|
|
232
|
+
readonly idempotentHint: false;
|
|
233
|
+
readonly openWorldHint: false;
|
|
234
|
+
};
|
|
216
235
|
readonly description: "Applies high-level structural operations to the visual canvas (adding nodes, connecting edges, organizing layout, or moving elements).";
|
|
217
236
|
readonly inputSchema: {
|
|
218
237
|
readonly type: "object";
|
|
@@ -269,6 +288,14 @@ declare const MCP_TOOL_EDIT_CANVAS: {
|
|
|
269
288
|
};
|
|
270
289
|
declare const MCP_TOOL_EDIT_PROMPT: {
|
|
271
290
|
readonly name: "edit_prompt";
|
|
291
|
+
readonly title: "Edit the prompt";
|
|
292
|
+
readonly annotations: {
|
|
293
|
+
readonly title: "Edit the prompt";
|
|
294
|
+
readonly readOnlyHint: false;
|
|
295
|
+
readonly destructiveHint: true;
|
|
296
|
+
readonly idempotentHint: false;
|
|
297
|
+
readonly openWorldHint: false;
|
|
298
|
+
};
|
|
272
299
|
readonly description: "Applies edits to the prompt template document, including inserting text, replacing ranges, and setting variables.";
|
|
273
300
|
readonly inputSchema: {
|
|
274
301
|
readonly type: "object";
|
|
@@ -307,6 +334,14 @@ declare const MCP_TOOL_EDIT_PROMPT: {
|
|
|
307
334
|
};
|
|
308
335
|
declare const MCP_TOOL_VIEW_EDITOR: {
|
|
309
336
|
readonly name: "view_editor";
|
|
337
|
+
readonly title: "View the editor";
|
|
338
|
+
readonly annotations: {
|
|
339
|
+
readonly title: "View the editor";
|
|
340
|
+
readonly readOnlyHint: true;
|
|
341
|
+
readonly destructiveHint: false;
|
|
342
|
+
readonly idempotentHint: true;
|
|
343
|
+
readonly openWorldHint: false;
|
|
344
|
+
};
|
|
310
345
|
readonly description: "Captures a visual image snapshot (JPEG or PNG) of the editor canvas or viewport for multimodal evaluation. Active agent cursor indicators are automatically excluded from the snapshot.";
|
|
311
346
|
readonly inputSchema: {
|
|
312
347
|
readonly type: "object";
|
|
@@ -335,6 +370,14 @@ declare const MCP_TOOL_VIEW_EDITOR: {
|
|
|
335
370
|
declare const EXPORT_EXCLUDED_SELECTORS: readonly [".pixerate-presence", ".agent-presence", ".ursula-presence"];
|
|
336
371
|
declare const EDITOR_MCP_TOOLS: readonly [{
|
|
337
372
|
readonly name: "get_editor_state";
|
|
373
|
+
readonly title: "Get editor state";
|
|
374
|
+
readonly annotations: {
|
|
375
|
+
readonly title: "Get editor state";
|
|
376
|
+
readonly readOnlyHint: true;
|
|
377
|
+
readonly destructiveHint: false;
|
|
378
|
+
readonly idempotentHint: true;
|
|
379
|
+
readonly openWorldHint: false;
|
|
380
|
+
};
|
|
338
381
|
readonly description: "Retrieves the current state of the document, variables, selection, and canvas graph (nodes and edges).";
|
|
339
382
|
readonly inputSchema: {
|
|
340
383
|
readonly type: "object";
|
|
@@ -351,6 +394,14 @@ declare const EDITOR_MCP_TOOLS: readonly [{
|
|
|
351
394
|
};
|
|
352
395
|
}, {
|
|
353
396
|
readonly name: "edit_canvas";
|
|
397
|
+
readonly title: "Edit the canvas";
|
|
398
|
+
readonly annotations: {
|
|
399
|
+
readonly title: "Edit the canvas";
|
|
400
|
+
readonly readOnlyHint: false;
|
|
401
|
+
readonly destructiveHint: true;
|
|
402
|
+
readonly idempotentHint: false;
|
|
403
|
+
readonly openWorldHint: false;
|
|
404
|
+
};
|
|
354
405
|
readonly description: "Applies high-level structural operations to the visual canvas (adding nodes, connecting edges, organizing layout, or moving elements).";
|
|
355
406
|
readonly inputSchema: {
|
|
356
407
|
readonly type: "object";
|
|
@@ -406,6 +457,14 @@ declare const EDITOR_MCP_TOOLS: readonly [{
|
|
|
406
457
|
};
|
|
407
458
|
}, {
|
|
408
459
|
readonly name: "edit_prompt";
|
|
460
|
+
readonly title: "Edit the prompt";
|
|
461
|
+
readonly annotations: {
|
|
462
|
+
readonly title: "Edit the prompt";
|
|
463
|
+
readonly readOnlyHint: false;
|
|
464
|
+
readonly destructiveHint: true;
|
|
465
|
+
readonly idempotentHint: false;
|
|
466
|
+
readonly openWorldHint: false;
|
|
467
|
+
};
|
|
409
468
|
readonly description: "Applies edits to the prompt template document, including inserting text, replacing ranges, and setting variables.";
|
|
410
469
|
readonly inputSchema: {
|
|
411
470
|
readonly type: "object";
|
|
@@ -443,6 +502,14 @@ declare const EDITOR_MCP_TOOLS: readonly [{
|
|
|
443
502
|
};
|
|
444
503
|
}, {
|
|
445
504
|
readonly name: "view_editor";
|
|
505
|
+
readonly title: "View the editor";
|
|
506
|
+
readonly annotations: {
|
|
507
|
+
readonly title: "View the editor";
|
|
508
|
+
readonly readOnlyHint: true;
|
|
509
|
+
readonly destructiveHint: false;
|
|
510
|
+
readonly idempotentHint: true;
|
|
511
|
+
readonly openWorldHint: false;
|
|
512
|
+
};
|
|
446
513
|
readonly description: "Captures a visual image snapshot (JPEG or PNG) of the editor canvas or viewport for multimodal evaluation. Active agent cursor indicators are automatically excluded from the snapshot.";
|
|
447
514
|
readonly inputSchema: {
|
|
448
515
|
readonly type: "object";
|
|
@@ -465,214 +532,6 @@ declare const EDITOR_MCP_TOOLS: readonly [{
|
|
|
465
532
|
};
|
|
466
533
|
}];
|
|
467
534
|
|
|
468
|
-
/**
|
|
469
|
-
* JSON-Schema-lite: the subset of JSON Schema used by MCP tool `inputSchema`s,
|
|
470
|
-
* plus a small validator for tool-call arguments. Unknown keywords are ignored.
|
|
471
|
-
*/
|
|
472
|
-
type JsonSchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null';
|
|
473
|
-
interface JsonSchema {
|
|
474
|
-
type?: JsonSchemaType | readonly JsonSchemaType[];
|
|
475
|
-
description?: string;
|
|
476
|
-
title?: string;
|
|
477
|
-
enum?: readonly unknown[];
|
|
478
|
-
const?: unknown;
|
|
479
|
-
default?: unknown;
|
|
480
|
-
properties?: {
|
|
481
|
-
readonly [key: string]: JsonSchema;
|
|
482
|
-
};
|
|
483
|
-
required?: readonly string[];
|
|
484
|
-
additionalProperties?: boolean | JsonSchema;
|
|
485
|
-
items?: JsonSchema;
|
|
486
|
-
minItems?: number;
|
|
487
|
-
maxItems?: number;
|
|
488
|
-
minimum?: number;
|
|
489
|
-
maximum?: number;
|
|
490
|
-
minLength?: number;
|
|
491
|
-
maxLength?: number;
|
|
492
|
-
pattern?: string;
|
|
493
|
-
[keyword: string]: unknown;
|
|
494
|
-
}
|
|
495
|
-
interface SchemaValidationError {
|
|
496
|
-
/** JSON-pointer-like path to the offending value, e.g. `/node/id` (`""` is the root). */
|
|
497
|
-
path: string;
|
|
498
|
-
message: string;
|
|
499
|
-
}
|
|
500
|
-
/**
|
|
501
|
-
* Validates `value` against `schema` and returns every error found (an empty
|
|
502
|
-
* array means valid). Supports `type` (incl. arrays of types), `enum`, `const`,
|
|
503
|
-
* `properties`, `required`, `additionalProperties`, `items`, `minItems`,
|
|
504
|
-
* `maxItems`, `minimum`, `maximum`, `minLength`, `maxLength` and `pattern`.
|
|
505
|
-
*/
|
|
506
|
-
declare function validateJsonSchema(value: unknown, schema: JsonSchema | undefined, path?: string): SchemaValidationError[];
|
|
507
|
-
|
|
508
|
-
/**
|
|
509
|
-
* MCP-shaped tool definition, as returned by `tools/list`.
|
|
510
|
-
*/
|
|
511
|
-
interface McpToolDefinition {
|
|
512
|
-
name: string;
|
|
513
|
-
title?: string;
|
|
514
|
-
description?: string;
|
|
515
|
-
inputSchema: JsonSchema & {
|
|
516
|
-
type: 'object';
|
|
517
|
-
};
|
|
518
|
-
outputSchema?: JsonSchema;
|
|
519
|
-
annotations?: {
|
|
520
|
-
title?: string;
|
|
521
|
-
readOnlyHint?: boolean;
|
|
522
|
-
destructiveHint?: boolean;
|
|
523
|
-
idempotentHint?: boolean;
|
|
524
|
-
openWorldHint?: boolean;
|
|
525
|
-
[key: string]: unknown;
|
|
526
|
-
};
|
|
527
|
-
}
|
|
528
|
-
type McpToolContent = {
|
|
529
|
-
type: 'text';
|
|
530
|
-
text: string;
|
|
531
|
-
} | {
|
|
532
|
-
type: 'image';
|
|
533
|
-
data: string;
|
|
534
|
-
mimeType: string;
|
|
535
|
-
} | {
|
|
536
|
-
type: string;
|
|
537
|
-
[key: string]: unknown;
|
|
538
|
-
};
|
|
539
|
-
/** MCP `tools/call` result. */
|
|
540
|
-
interface McpToolResult {
|
|
541
|
-
content: McpToolContent[];
|
|
542
|
-
structuredContent?: Record<string, unknown>;
|
|
543
|
-
isError?: boolean;
|
|
544
|
-
}
|
|
545
|
-
/** MCP `tools/list` result. */
|
|
546
|
-
interface McpListToolsResult {
|
|
547
|
-
tools: McpToolDefinition[];
|
|
548
|
-
}
|
|
549
|
-
interface ToolCallContext {
|
|
550
|
-
/** Name the tool was called by (possibly namespaced). */
|
|
551
|
-
name: string;
|
|
552
|
-
/** Id of the provider that owns the tool. */
|
|
553
|
-
providerId: string;
|
|
554
|
-
signal?: AbortSignal;
|
|
555
|
-
}
|
|
556
|
-
/**
|
|
557
|
-
* Handler return values are normalized into an {@link McpToolResult}: a full
|
|
558
|
-
* result (`{ content: [...] }`) is passed through, a string becomes a text
|
|
559
|
-
* block, `undefined` becomes an empty result, and anything else is returned
|
|
560
|
-
* as `structuredContent` (plain objects) plus a JSON text block.
|
|
561
|
-
*/
|
|
562
|
-
type AgentToolHandler = (args: Record<string, any>, context: ToolCallContext) => unknown | Promise<unknown>;
|
|
563
|
-
interface AgentTool extends McpToolDefinition {
|
|
564
|
-
handler: AgentToolHandler;
|
|
565
|
-
}
|
|
566
|
-
/**
|
|
567
|
-
* A source of tools, typically one per mounted editor, spreadsheet or canvas.
|
|
568
|
-
*/
|
|
569
|
-
interface AgentToolProvider {
|
|
570
|
-
/** Unique id within a registry, e.g. `doc-1`. Used as the namespace on collisions. */
|
|
571
|
-
id: string;
|
|
572
|
-
/** Always prefix this provider's tools with `<namespace>__`. */
|
|
573
|
-
namespace?: string;
|
|
574
|
-
/** Tools, or a function returning the current tools (re-read on every `listTools`). */
|
|
575
|
-
tools: readonly AgentTool[] | (() => readonly AgentTool[]);
|
|
576
|
-
/** Lets the provider signal that its tool list changed; returns an unsubscribe function. */
|
|
577
|
-
subscribe?: (notify: () => void) => () => void;
|
|
578
|
-
}
|
|
579
|
-
type ToolErrorCode = 'unknown_tool' | 'invalid_arguments' | 'tool_failed';
|
|
580
|
-
/** Structured error carried in `structuredContent.error` of a failed call. */
|
|
581
|
-
interface ToolCallError {
|
|
582
|
-
code: ToolErrorCode;
|
|
583
|
-
message: string;
|
|
584
|
-
tool: string;
|
|
585
|
-
details?: SchemaValidationError[];
|
|
586
|
-
}
|
|
587
|
-
declare class ToolRegistryError extends Error {
|
|
588
|
-
readonly code: 'duplicate_provider' | 'name_collision' | 'invalid_tool';
|
|
589
|
-
constructor(code: ToolRegistryError['code'], message: string);
|
|
590
|
-
}
|
|
591
|
-
interface ToolRegistryOptions {
|
|
592
|
-
/**
|
|
593
|
-
* What to do when two providers contribute the same tool name:
|
|
594
|
-
* `namespace` (default) exposes every colliding tool as `<providerId>__<name>`;
|
|
595
|
-
* `error` makes `register` throw.
|
|
596
|
-
*/
|
|
597
|
-
onCollision?: 'namespace' | 'error';
|
|
598
|
-
/** Coalescing window for `listChanged` notifications in ms (default 0: same tick). */
|
|
599
|
-
listChangedDelayMs?: number;
|
|
600
|
-
/** Validate arguments against `inputSchema` before calling handlers (default `true`). */
|
|
601
|
-
validateArguments?: boolean;
|
|
602
|
-
}
|
|
603
|
-
/** Separator between namespace and tool name; valid in MCP and LLM tool-name charsets. */
|
|
604
|
-
declare const TOOL_NAMESPACE_SEPARATOR = "__";
|
|
605
|
-
/** Normalizes a handler's return value into an MCP `tools/call` result. */
|
|
606
|
-
declare function toToolResult(value: unknown): McpToolResult;
|
|
607
|
-
/**
|
|
608
|
-
* Transport-agnostic registry of agent tools contributed by live providers.
|
|
609
|
-
*
|
|
610
|
-
* `listTools()` and `callTool()` return MCP `tools/list` / `tools/call`
|
|
611
|
-
* result shapes, and `onListChanged` fires (coalesced) whenever the exposed
|
|
612
|
-
* tool list changes, mirroring MCP's `notifications/tools/list_changed`, so an
|
|
613
|
-
* MCP server can be a thin wrapper around it.
|
|
614
|
-
*/
|
|
615
|
-
declare class ToolRegistry {
|
|
616
|
-
/** MCP server capabilities this registry supports. */
|
|
617
|
-
readonly capabilities: {
|
|
618
|
-
readonly tools: {
|
|
619
|
-
readonly listChanged: true;
|
|
620
|
-
};
|
|
621
|
-
};
|
|
622
|
-
private readonly entries;
|
|
623
|
-
private readonly listeners;
|
|
624
|
-
private readonly options;
|
|
625
|
-
private timer;
|
|
626
|
-
private lastSignature;
|
|
627
|
-
constructor(options?: ToolRegistryOptions);
|
|
628
|
-
/**
|
|
629
|
-
* Registers a provider and returns a function that unregisters it.
|
|
630
|
-
* Throws a {@link ToolRegistryError} for a duplicate provider id, an invalid
|
|
631
|
-
* tool name, or (with `onCollision: 'error'`) a tool name collision.
|
|
632
|
-
*/
|
|
633
|
-
register(provider: AgentToolProvider): () => void;
|
|
634
|
-
/** Removes a provider by id or instance. Returns whether it was registered. */
|
|
635
|
-
unregister(providerOrId: string | AgentToolProvider): boolean;
|
|
636
|
-
/** Registered provider ids in registration order. */
|
|
637
|
-
providerIds(): string[];
|
|
638
|
-
/**
|
|
639
|
-
* Resolves exposed names. Tools are ordered by provider registration, then
|
|
640
|
-
* by their order within the provider.
|
|
641
|
-
*/
|
|
642
|
-
private resolve;
|
|
643
|
-
/** MCP `tools/list` result for the current providers. */
|
|
644
|
-
listTools(): McpListToolsResult;
|
|
645
|
-
/** Whether a tool with this exposed name exists. */
|
|
646
|
-
hasTool(name: string): boolean;
|
|
647
|
-
/** Looks up a tool definition by exposed name. */
|
|
648
|
-
getTool(name: string): McpToolDefinition | undefined;
|
|
649
|
-
/**
|
|
650
|
-
* Calls a tool by exposed name and returns an MCP `tools/call` result.
|
|
651
|
-
* Never rejects: unknown tools, invalid arguments and handler errors come
|
|
652
|
-
* back as `isError: true` results with a {@link ToolCallError} in
|
|
653
|
-
* `structuredContent.error` (MCP transports may map `unknown_tool` to a
|
|
654
|
-
* JSON-RPC `-32602` error instead).
|
|
655
|
-
*/
|
|
656
|
-
callTool(name: string, args?: Record<string, unknown>, options?: {
|
|
657
|
-
signal?: AbortSignal;
|
|
658
|
-
}): Promise<McpToolResult>;
|
|
659
|
-
/**
|
|
660
|
-
* Subscribes to tool-list changes. Notifications are coalesced: many
|
|
661
|
-
* registrations or provider signals within the delay window produce one
|
|
662
|
-
* call, and none if the exposed list ends up unchanged (e.g. a provider
|
|
663
|
-
* unmounted and remounted). Returns an unsubscribe function.
|
|
664
|
-
*/
|
|
665
|
-
onListChanged(listener: (tools: McpToolDefinition[]) => void): () => void;
|
|
666
|
-
/** Schedules a coalesced `listChanged` check; providers may call it directly. */
|
|
667
|
-
notifyListChanged(): void;
|
|
668
|
-
/** Runs a pending `listChanged` check immediately. */
|
|
669
|
-
flush(): void;
|
|
670
|
-
private signature;
|
|
671
|
-
/** Unregisters every provider and listener and cancels pending notifications. */
|
|
672
|
-
dispose(): void;
|
|
673
|
-
}
|
|
674
|
-
declare function createToolRegistry(options?: ToolRegistryOptions): ToolRegistry;
|
|
675
|
-
|
|
676
535
|
interface ToolProviderOptions {
|
|
677
536
|
/** Provider id (unique per registry). */
|
|
678
537
|
id: string;
|
|
@@ -723,4 +582,4 @@ interface EditorMcpToolProviderOptions<TNode extends CanvasNode = CanvasNode, TE
|
|
|
723
582
|
*/
|
|
724
583
|
declare function createEditorMcpToolProvider<TNode extends CanvasNode = CanvasNode, TEdge extends CanvasEdge = CanvasEdge>(options: EditorMcpToolProviderOptions<TNode, TEdge>): AgentToolProvider;
|
|
725
584
|
|
|
726
|
-
export { type AgentCommand, type AgentPresence, type AgentStep,
|
|
585
|
+
export { type AgentCommand, type AgentPresence, type AgentStep, AgentToolProvider, EDITOR_MCP_TOOLS, EXPORT_EXCLUDED_SELECTORS, type EditorMcpToolProviderOptions, type EditorSnapshot, MCP_TOOL_EDIT_CANVAS, MCP_TOOL_EDIT_PROMPT, MCP_TOOL_GET_EDITOR_STATE, MCP_TOOL_VIEW_EDITOR, type RichTextToolTarget, type ToolProviderOptions, createEditorMcpToolProvider, createRichTextToolProvider, createSpreadsheetToolProvider, normalizeSide, planAgentCommand, planToolCall, toolCallToAgentCommand };
|