@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.ts
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.js';
|
|
2
|
+
export { J as JsonSchema, a as JsonSchemaType, S as SchemaValidationError, v as validateJsonSchema } from '../schema-DYDGdYL9.js';
|
|
3
|
+
import { A as AgentToolProvider } from '../registry-BDe-vlv3.js';
|
|
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-BDe-vlv3.js';
|
|
2
5
|
import { Editor } from '@tiptap/core';
|
|
3
|
-
import { S as SpreadsheetController } from '../controller-
|
|
6
|
+
import { S as SpreadsheetController } from '../controller-BhLLAoi8.js';
|
|
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 };
|
package/dist/agent/index.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
validateJsonSchema
|
|
3
|
+
} from "../chunk-ARRTP33I.js";
|
|
1
4
|
import {
|
|
2
5
|
getEditorMarkdown,
|
|
3
6
|
getEditorText,
|
|
4
7
|
plainTextToSlice
|
|
5
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-PGNZKFQS.js";
|
|
9
|
+
import "../chunk-5S3Z4PPF.js";
|
|
6
10
|
import {
|
|
7
11
|
colNameToIndex,
|
|
8
12
|
indexToColName,
|
|
9
13
|
isFormulaError
|
|
10
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-3CN2WD3X.js";
|
|
11
15
|
import {
|
|
12
16
|
ensureLayout,
|
|
13
17
|
getLayoutedNodes,
|
|
@@ -276,6 +280,14 @@ function planToolCall(name, args, snapshot, options) {
|
|
|
276
280
|
// src/agent/tools.ts
|
|
277
281
|
var MCP_TOOL_GET_EDITOR_STATE = {
|
|
278
282
|
name: "get_editor_state",
|
|
283
|
+
title: "Get editor state",
|
|
284
|
+
annotations: {
|
|
285
|
+
title: "Get editor state",
|
|
286
|
+
readOnlyHint: true,
|
|
287
|
+
destructiveHint: false,
|
|
288
|
+
idempotentHint: true,
|
|
289
|
+
openWorldHint: false
|
|
290
|
+
},
|
|
279
291
|
description: "Retrieves the current state of the document, variables, selection, and canvas graph (nodes and edges).",
|
|
280
292
|
inputSchema: {
|
|
281
293
|
type: "object",
|
|
@@ -293,6 +305,14 @@ var MCP_TOOL_GET_EDITOR_STATE = {
|
|
|
293
305
|
};
|
|
294
306
|
var MCP_TOOL_EDIT_CANVAS = {
|
|
295
307
|
name: "edit_canvas",
|
|
308
|
+
title: "Edit the canvas",
|
|
309
|
+
annotations: {
|
|
310
|
+
title: "Edit the canvas",
|
|
311
|
+
readOnlyHint: false,
|
|
312
|
+
destructiveHint: true,
|
|
313
|
+
idempotentHint: false,
|
|
314
|
+
openWorldHint: false
|
|
315
|
+
},
|
|
296
316
|
description: "Applies high-level structural operations to the visual canvas (adding nodes, connecting edges, organizing layout, or moving elements).",
|
|
297
317
|
inputSchema: {
|
|
298
318
|
type: "object",
|
|
@@ -355,6 +375,14 @@ var MCP_TOOL_EDIT_CANVAS = {
|
|
|
355
375
|
};
|
|
356
376
|
var MCP_TOOL_EDIT_PROMPT = {
|
|
357
377
|
name: "edit_prompt",
|
|
378
|
+
title: "Edit the prompt",
|
|
379
|
+
annotations: {
|
|
380
|
+
title: "Edit the prompt",
|
|
381
|
+
readOnlyHint: false,
|
|
382
|
+
destructiveHint: true,
|
|
383
|
+
idempotentHint: false,
|
|
384
|
+
openWorldHint: false
|
|
385
|
+
},
|
|
358
386
|
description: "Applies edits to the prompt template document, including inserting text, replacing ranges, and setting variables.",
|
|
359
387
|
inputSchema: {
|
|
360
388
|
type: "object",
|
|
@@ -393,6 +421,14 @@ var MCP_TOOL_EDIT_PROMPT = {
|
|
|
393
421
|
};
|
|
394
422
|
var MCP_TOOL_VIEW_EDITOR = {
|
|
395
423
|
name: "view_editor",
|
|
424
|
+
title: "View the editor",
|
|
425
|
+
annotations: {
|
|
426
|
+
title: "View the editor",
|
|
427
|
+
readOnlyHint: true,
|
|
428
|
+
destructiveHint: false,
|
|
429
|
+
idempotentHint: true,
|
|
430
|
+
openWorldHint: false
|
|
431
|
+
},
|
|
396
432
|
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.",
|
|
397
433
|
inputSchema: {
|
|
398
434
|
type: "object",
|
|
@@ -426,103 +462,6 @@ var EDITOR_MCP_TOOLS = [
|
|
|
426
462
|
MCP_TOOL_VIEW_EDITOR
|
|
427
463
|
];
|
|
428
464
|
|
|
429
|
-
// src/agent/schema.ts
|
|
430
|
-
function typeOf(value) {
|
|
431
|
-
if (value === null) return "null";
|
|
432
|
-
if (Array.isArray(value)) return "array";
|
|
433
|
-
if (typeof value === "number") return Number.isInteger(value) ? "integer" : "number";
|
|
434
|
-
if (typeof value === "string" || typeof value === "boolean" || typeof value === "object") {
|
|
435
|
-
return typeof value;
|
|
436
|
-
}
|
|
437
|
-
return "undefined";
|
|
438
|
-
}
|
|
439
|
-
function matchesType(value, type) {
|
|
440
|
-
const actual = typeOf(value);
|
|
441
|
-
if (type === "number") return actual === "number" || actual === "integer";
|
|
442
|
-
return actual === type;
|
|
443
|
-
}
|
|
444
|
-
var isEqual = (a, b) => a === b || JSON.stringify(a) === JSON.stringify(b);
|
|
445
|
-
function validateJsonSchema(value, schema, path = "") {
|
|
446
|
-
if (!schema || typeof schema !== "object") return [];
|
|
447
|
-
const errors = [];
|
|
448
|
-
const at = path || "/";
|
|
449
|
-
if (schema.type !== void 0) {
|
|
450
|
-
const types = Array.isArray(schema.type) ? schema.type : [schema.type];
|
|
451
|
-
if (!types.some((t) => matchesType(value, t))) {
|
|
452
|
-
errors.push({ path: at, message: `Expected ${types.join(" | ")}, got ${typeOf(value)}.` });
|
|
453
|
-
return errors;
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
if (schema.const !== void 0 && !isEqual(value, schema.const)) {
|
|
457
|
-
errors.push({ path: at, message: `Expected ${JSON.stringify(schema.const)}.` });
|
|
458
|
-
}
|
|
459
|
-
if (schema.enum && !schema.enum.some((option) => isEqual(value, option))) {
|
|
460
|
-
errors.push({
|
|
461
|
-
path: at,
|
|
462
|
-
message: `Expected one of ${schema.enum.map((o) => JSON.stringify(o)).join(", ")}, got ${JSON.stringify(value)}.`
|
|
463
|
-
});
|
|
464
|
-
}
|
|
465
|
-
if (typeof value === "string") {
|
|
466
|
-
if (schema.minLength !== void 0 && value.length < schema.minLength) {
|
|
467
|
-
errors.push({ path: at, message: `Must be at least ${schema.minLength} characters.` });
|
|
468
|
-
}
|
|
469
|
-
if (schema.maxLength !== void 0 && value.length > schema.maxLength) {
|
|
470
|
-
errors.push({ path: at, message: `Must be at most ${schema.maxLength} characters.` });
|
|
471
|
-
}
|
|
472
|
-
if (schema.pattern !== void 0) {
|
|
473
|
-
let regex = null;
|
|
474
|
-
try {
|
|
475
|
-
regex = new RegExp(schema.pattern, "u");
|
|
476
|
-
} catch {
|
|
477
|
-
}
|
|
478
|
-
if (regex && !regex.test(value)) {
|
|
479
|
-
errors.push({ path: at, message: `Must match pattern ${schema.pattern}.` });
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
if (typeof value === "number") {
|
|
484
|
-
if (schema.minimum !== void 0 && value < schema.minimum) {
|
|
485
|
-
errors.push({ path: at, message: `Must be >= ${schema.minimum}.` });
|
|
486
|
-
}
|
|
487
|
-
if (schema.maximum !== void 0 && value > schema.maximum) {
|
|
488
|
-
errors.push({ path: at, message: `Must be <= ${schema.maximum}.` });
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
if (Array.isArray(value)) {
|
|
492
|
-
if (schema.minItems !== void 0 && value.length < schema.minItems) {
|
|
493
|
-
errors.push({ path: at, message: `Must have at least ${schema.minItems} items.` });
|
|
494
|
-
}
|
|
495
|
-
if (schema.maxItems !== void 0 && value.length > schema.maxItems) {
|
|
496
|
-
errors.push({ path: at, message: `Must have at most ${schema.maxItems} items.` });
|
|
497
|
-
}
|
|
498
|
-
if (schema.items) {
|
|
499
|
-
value.forEach((item, index) => {
|
|
500
|
-
errors.push(...validateJsonSchema(item, schema.items, `${path}/${index}`));
|
|
501
|
-
});
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
if (typeOf(value) === "object") {
|
|
505
|
-
const obj = value;
|
|
506
|
-
for (const key of schema.required ?? []) {
|
|
507
|
-
if (obj[key] === void 0) {
|
|
508
|
-
errors.push({ path: `${path}/${key}`, message: `Missing required property "${key}".` });
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
const properties = schema.properties ?? {};
|
|
512
|
-
for (const [key, child] of Object.entries(obj)) {
|
|
513
|
-
if (child === void 0) continue;
|
|
514
|
-
if (key in properties) {
|
|
515
|
-
errors.push(...validateJsonSchema(child, properties[key], `${path}/${key}`));
|
|
516
|
-
} else if (schema.additionalProperties === false) {
|
|
517
|
-
errors.push({ path: `${path}/${key}`, message: `Unknown property "${key}".` });
|
|
518
|
-
} else if (typeof schema.additionalProperties === "object") {
|
|
519
|
-
errors.push(...validateJsonSchema(child, schema.additionalProperties, `${path}/${key}`));
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
return errors;
|
|
524
|
-
}
|
|
525
|
-
|
|
526
465
|
// src/agent/registry.ts
|
|
527
466
|
var ToolRegistryError = class extends Error {
|
|
528
467
|
code;
|
|
@@ -773,6 +712,7 @@ function createRichTextToolProvider(target, options) {
|
|
|
773
712
|
const editor = () => toEditor(target);
|
|
774
713
|
const getText = {
|
|
775
714
|
name: "get_text",
|
|
715
|
+
title: "Get document text",
|
|
776
716
|
description: "Returns the document content (plain text by default, or HTML / markdown) and the current selection.",
|
|
777
717
|
inputSchema: {
|
|
778
718
|
type: "object",
|
|
@@ -785,7 +725,13 @@ function createRichTextToolProvider(target, options) {
|
|
|
785
725
|
},
|
|
786
726
|
additionalProperties: false
|
|
787
727
|
},
|
|
788
|
-
annotations: {
|
|
728
|
+
annotations: {
|
|
729
|
+
title: "Get document text",
|
|
730
|
+
readOnlyHint: true,
|
|
731
|
+
destructiveHint: false,
|
|
732
|
+
idempotentHint: true,
|
|
733
|
+
openWorldHint: false
|
|
734
|
+
},
|
|
789
735
|
handler: ({ format = "text" }) => {
|
|
790
736
|
const ed = editor();
|
|
791
737
|
const content = format === "html" ? ed.getHTML() : format === "markdown" ? getEditorMarkdown(ed) : getEditorText(ed);
|
|
@@ -794,6 +740,7 @@ function createRichTextToolProvider(target, options) {
|
|
|
794
740
|
};
|
|
795
741
|
const insertText = {
|
|
796
742
|
name: "insert_text",
|
|
743
|
+
title: "Insert text",
|
|
797
744
|
description: "Inserts literal text (newlines start new paragraphs) at a document position, or at the cursor when `at` is omitted.",
|
|
798
745
|
inputSchema: {
|
|
799
746
|
type: "object",
|
|
@@ -804,6 +751,13 @@ function createRichTextToolProvider(target, options) {
|
|
|
804
751
|
required: ["text"],
|
|
805
752
|
additionalProperties: false
|
|
806
753
|
},
|
|
754
|
+
annotations: {
|
|
755
|
+
title: "Insert text",
|
|
756
|
+
readOnlyHint: false,
|
|
757
|
+
destructiveHint: false,
|
|
758
|
+
idempotentHint: false,
|
|
759
|
+
openWorldHint: false
|
|
760
|
+
},
|
|
807
761
|
handler: ({ text, at }) => {
|
|
808
762
|
const ed = editor();
|
|
809
763
|
const size = ed.state.doc.content.size;
|
|
@@ -817,6 +771,7 @@ function createRichTextToolProvider(target, options) {
|
|
|
817
771
|
};
|
|
818
772
|
const replaceSelection = {
|
|
819
773
|
name: "replace_selection",
|
|
774
|
+
title: "Replace selection",
|
|
820
775
|
description: "Replaces the selected content with literal text (an empty string deletes the selection).",
|
|
821
776
|
inputSchema: {
|
|
822
777
|
type: "object",
|
|
@@ -824,7 +779,13 @@ function createRichTextToolProvider(target, options) {
|
|
|
824
779
|
required: ["text"],
|
|
825
780
|
additionalProperties: false
|
|
826
781
|
},
|
|
827
|
-
annotations: {
|
|
782
|
+
annotations: {
|
|
783
|
+
title: "Replace selection",
|
|
784
|
+
readOnlyHint: false,
|
|
785
|
+
destructiveHint: true,
|
|
786
|
+
idempotentHint: false,
|
|
787
|
+
openWorldHint: false
|
|
788
|
+
},
|
|
828
789
|
handler: ({ text }) => {
|
|
829
790
|
const ed = editor();
|
|
830
791
|
const { from, to } = ed.state.selection;
|
|
@@ -865,6 +826,7 @@ function createSpreadsheetToolProvider(controller, options) {
|
|
|
865
826
|
};
|
|
866
827
|
const getRange = {
|
|
867
828
|
name: "get_range",
|
|
829
|
+
title: "Read cells",
|
|
868
830
|
description: 'Reads a cell range in A1 notation (e.g. "A1:C5" or "B2") and returns computed values, raw input and errors.',
|
|
869
831
|
inputSchema: {
|
|
870
832
|
type: "object",
|
|
@@ -874,7 +836,13 @@ function createSpreadsheetToolProvider(controller, options) {
|
|
|
874
836
|
required: ["range"],
|
|
875
837
|
additionalProperties: false
|
|
876
838
|
},
|
|
877
|
-
annotations: {
|
|
839
|
+
annotations: {
|
|
840
|
+
title: "Read cells",
|
|
841
|
+
readOnlyHint: true,
|
|
842
|
+
destructiveHint: false,
|
|
843
|
+
idempotentHint: true,
|
|
844
|
+
openWorldHint: false
|
|
845
|
+
},
|
|
878
846
|
handler: ({ range }) => {
|
|
879
847
|
const [startRef, endRef = startRef] = String(range).split(":");
|
|
880
848
|
const start = parseCell(startRef);
|
|
@@ -913,6 +881,7 @@ function createSpreadsheetToolProvider(controller, options) {
|
|
|
913
881
|
};
|
|
914
882
|
const setCell = {
|
|
915
883
|
name: "set_cell",
|
|
884
|
+
title: "Set a cell",
|
|
916
885
|
description: 'Sets the raw input of one cell (A1 notation). Values starting with "=" are formulas.',
|
|
917
886
|
inputSchema: {
|
|
918
887
|
type: "object",
|
|
@@ -923,6 +892,13 @@ function createSpreadsheetToolProvider(controller, options) {
|
|
|
923
892
|
required: ["cell", "value"],
|
|
924
893
|
additionalProperties: false
|
|
925
894
|
},
|
|
895
|
+
annotations: {
|
|
896
|
+
title: "Set a cell",
|
|
897
|
+
readOnlyHint: false,
|
|
898
|
+
destructiveHint: true,
|
|
899
|
+
idempotentHint: true,
|
|
900
|
+
openWorldHint: false
|
|
901
|
+
},
|
|
926
902
|
handler: ({ cell, value }) => {
|
|
927
903
|
const { row, col } = parseCell(cell);
|
|
928
904
|
const found = lookup(row, col);
|