@pixerate/editor 0.140.4 → 0.142.1
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/canvasPlayback.d.cts +15 -0
- package/dist/agent/canvasPlayback.d.ts +15 -0
- package/dist/agent/index.cjs +173 -33
- package/dist/agent/index.d.cts +1 -0
- package/dist/agent/index.d.ts +1 -0
- package/dist/agent/index.js +147 -7
- package/dist/agent/providers.d.cts +12 -1
- package/dist/agent/providers.d.ts +12 -1
- package/dist/agent/types.d.cts +3 -0
- package/dist/agent/types.d.ts +3 -0
- package/dist/animation/index.cjs +2 -2
- package/dist/animation/index.js +1 -1
- package/dist/animation/presence.d.cts +1 -75
- package/dist/animation/presence.d.ts +1 -75
- package/dist/animation-editor/index.cjs +69 -19
- package/dist/animation-editor/index.d.cts +1 -0
- package/dist/animation-editor/index.d.ts +1 -0
- package/dist/animation-editor/index.js +54 -4
- package/dist/animation-editor/playback.d.cts +10 -0
- package/dist/animation-editor/playback.d.ts +10 -0
- package/dist/bridge/cli.cjs +3 -3
- package/dist/bridge/cli.js +2 -2
- package/dist/bridge/index.cjs +3 -3
- package/dist/bridge/index.js +2 -2
- package/dist/canvas/index.cjs +336 -646
- package/dist/canvas/index.d.cts +1 -0
- package/dist/canvas/index.d.ts +1 -0
- package/dist/canvas/index.js +44 -354
- package/dist/canvas/playback.d.cts +14 -0
- package/dist/canvas/playback.d.ts +14 -0
- package/dist/chart/index.cjs +255 -171
- package/dist/chart/index.d.cts +1 -0
- package/dist/chart/index.d.ts +1 -0
- package/dist/chart/index.js +244 -160
- package/dist/chart/playback.d.cts +22 -0
- package/dist/chart/playback.d.ts +22 -0
- package/dist/chunk-54GVEVXS.js +408 -0
- package/dist/{chunk-E747F3D5.js → chunk-CC6WKVIH.js} +86 -5
- package/dist/chunk-DW4CV5H4.js +591 -0
- package/dist/{chunk-UMS6YFA6.js → chunk-EAQ4BGNS.js} +1 -1
- package/dist/{chunk-AGCD3EHB.cjs → chunk-ENIZYNEF.cjs} +7 -7
- package/dist/{chunk-BSGPXPTW.js → chunk-PEEP2YR7.js} +1 -1
- package/dist/{chunk-VTY64I6H.cjs → chunk-QSM3MDDJ.cjs} +85 -85
- package/dist/{chunk-2RUNJYOX.cjs → chunk-QZFEX2N4.cjs} +86 -5
- package/dist/{chunk-RB62U6MS.js → chunk-RFBFTLVN.js} +27 -5
- package/dist/chunk-UBRYHNRU.cjs +591 -0
- package/dist/{chunk-GEY73RUW.cjs → chunk-UJGAA6AK.cjs} +1 -1
- package/dist/{chunk-LMSFXRAJ.js → chunk-VGJTUCWM.js} +1 -1
- package/dist/chunk-X2HQP7DF.cjs +408 -0
- package/dist/chunk-XH32BATE.cjs +68 -0
- package/dist/{chunk-HDK3T2QS.cjs → chunk-Y4BWZB6J.cjs} +29 -7
- package/dist/chunk-Y6SGC6KO.js +68 -0
- package/dist/commands/index.cjs +37 -1
- package/dist/commands/index.js +36 -0
- package/dist/commands/registry.d.cts +11 -0
- package/dist/commands/registry.d.ts +11 -0
- package/dist/diagram/index.cjs +7 -7
- package/dist/diagram/index.js +1 -1
- package/dist/image-editor/index.cjs +108 -16
- package/dist/image-editor/index.d.cts +1 -0
- package/dist/image-editor/index.d.ts +1 -0
- package/dist/image-editor/index.js +107 -15
- package/dist/image-editor/playback.d.cts +22 -0
- package/dist/image-editor/playback.d.ts +22 -0
- package/dist/index.cjs +7 -3
- package/dist/index.js +6 -2
- package/dist/paint-editor/index.cjs +73 -25
- package/dist/paint-editor/index.d.cts +1 -0
- package/dist/paint-editor/index.d.ts +1 -0
- package/dist/paint-editor/index.js +68 -20
- package/dist/paint-editor/playback.d.cts +16 -0
- package/dist/paint-editor/playback.d.ts +16 -0
- package/dist/parameters/index.cjs +32 -8
- package/dist/parameters/index.d.cts +1 -0
- package/dist/parameters/index.d.ts +1 -0
- package/dist/parameters/index.js +28 -4
- package/dist/parameters/playback.d.cts +10 -0
- package/dist/parameters/playback.d.ts +10 -0
- package/dist/spreadsheet/index.cjs +7 -3
- package/dist/spreadsheet/index.d.cts +1 -0
- package/dist/spreadsheet/index.d.ts +1 -0
- package/dist/spreadsheet/index.js +6 -2
- package/dist/spreadsheet/playback.d.cts +15 -0
- package/dist/spreadsheet/playback.d.ts +15 -0
- package/dist/tools/index.cjs +40 -3
- package/dist/tools/index.d.cts +3 -0
- package/dist/tools/index.d.ts +3 -0
- package/dist/tools/index.js +39 -2
- package/dist/tools/playback.d.cts +205 -0
- package/dist/tools/playback.d.ts +205 -0
- package/dist/tools/presence.d.cts +82 -0
- package/dist/tools/presence.d.ts +82 -0
- package/dist/tools/registry.d.cts +45 -6
- package/dist/tools/registry.d.ts +45 -6
- package/dist/tools/script.d.cts +77 -0
- package/dist/tools/script.d.ts +77 -0
- package/dist/tools/view.d.cts +2 -4
- package/dist/tools/view.d.ts +2 -4
- package/dist/vector/index.cjs +217 -100
- package/dist/vector/index.d.cts +1 -0
- package/dist/vector/index.d.ts +1 -0
- package/dist/vector/index.js +140 -23
- package/dist/vector/playback.d.cts +13 -0
- package/dist/vector/playback.d.ts +13 -0
- package/dist/video-editor/index.cjs +81 -28
- package/dist/video-editor/index.d.cts +1 -0
- package/dist/video-editor/index.d.ts +1 -0
- package/dist/video-editor/index.js +58 -5
- package/dist/video-editor/playback.d.cts +20 -0
- package/dist/video-editor/playback.d.ts +20 -0
- package/package.json +1 -1
- package/skills/pixerate-agent-tools/SKILL.md +13 -0
- package/skills/pixerate-animation-editor/SKILL.md +1 -0
- package/skills/pixerate-canvas/SKILL.md +3 -0
- package/skills/pixerate-chart/SKILL.md +1 -0
- package/skills/pixerate-image-editor/SKILL.md +2 -2
- package/skills/pixerate-paint-editor/SKILL.md +1 -0
- package/skills/pixerate-parameters/SKILL.md +1 -0
- package/skills/pixerate-spreadsheet/SKILL.md +1 -0
- package/skills/pixerate-vector/SKILL.md +5 -0
- package/skills/pixerate-video-editor/SKILL.md +1 -0
- package/dist/chunk-BTZS3KZY.js +0 -221
- package/dist/chunk-K73HMKQP.js +0 -0
- package/dist/chunk-LACYURUW.cjs +0 -1
- package/dist/chunk-MRD3NXKR.cjs +0 -221
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import type { ToolMiddleware, ToolRegistry } from './registry.cjs';
|
|
2
|
+
import { type PresenceActorInfo, type PresenceClock, type PresenceStore } from './presence.cjs';
|
|
3
|
+
export interface PlaybackPoint {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
}
|
|
7
|
+
export interface PlaybackRect {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Something a surface can find: `{ kind: 'node', id }`, `{ kind: 'layer', id }`, a cell range
|
|
15
|
+
* `{ kind: 'cell', id: 'B7:G7' }` or one of the editor's own controls `{ kind: 'control', id: 'title' }`.
|
|
16
|
+
*/
|
|
17
|
+
export interface PlaybackRef {
|
|
18
|
+
kind: string;
|
|
19
|
+
id: string;
|
|
20
|
+
}
|
|
21
|
+
/** One thing the cursor does. Points and rectangles are in the surface's own coordinates. */
|
|
22
|
+
export type PlaybackStep = {
|
|
23
|
+
type: 'move';
|
|
24
|
+
to: PlaybackPoint;
|
|
25
|
+
ms?: number;
|
|
26
|
+
}
|
|
27
|
+
/** Glide to whatever the surface locates for `ref`, and ring it. Skipped when nothing is found. */
|
|
28
|
+
| {
|
|
29
|
+
type: 'target';
|
|
30
|
+
ref: PlaybackRef;
|
|
31
|
+
ms?: number;
|
|
32
|
+
} | {
|
|
33
|
+
type: 'focus';
|
|
34
|
+
rect: PlaybackRect | null;
|
|
35
|
+
} | {
|
|
36
|
+
type: 'say';
|
|
37
|
+
text: string;
|
|
38
|
+
ms?: number;
|
|
39
|
+
} | {
|
|
40
|
+
type: 'press';
|
|
41
|
+
} | {
|
|
42
|
+
type: 'release';
|
|
43
|
+
}
|
|
44
|
+
/** Move with the button down (the cursor only; the change lands at `commit`). */
|
|
45
|
+
| {
|
|
46
|
+
type: 'drag';
|
|
47
|
+
to: PlaybackPoint;
|
|
48
|
+
ms?: number;
|
|
49
|
+
} | {
|
|
50
|
+
type: 'type';
|
|
51
|
+
text: string;
|
|
52
|
+
ms?: number;
|
|
53
|
+
} | {
|
|
54
|
+
type: 'wait';
|
|
55
|
+
ms: number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Bring a part of the editor into view (a panel or tab): glide to what `ref` locates, click it,
|
|
59
|
+
* and let the surface's `open(ref)` show it. Skipped when the surface has no `open`.
|
|
60
|
+
*/
|
|
61
|
+
| {
|
|
62
|
+
type: 'open';
|
|
63
|
+
ref: PlaybackRef;
|
|
64
|
+
ms?: number;
|
|
65
|
+
}
|
|
66
|
+
/** The handler runs here, exactly once (appended when a plan leaves it out). */
|
|
67
|
+
| {
|
|
68
|
+
type: 'commit';
|
|
69
|
+
};
|
|
70
|
+
export interface PlaybackPlanResult {
|
|
71
|
+
steps: PlaybackStep[];
|
|
72
|
+
/** The surface to play on, when it is not the provider's (e.g. commands of one editor). */
|
|
73
|
+
surface?: string;
|
|
74
|
+
/** Treat the call as a read: a glance, no press and no undo gesture. */
|
|
75
|
+
readOnly?: boolean;
|
|
76
|
+
}
|
|
77
|
+
export type PlaybackPlan = PlaybackStep[] | PlaybackPlanResult | null | undefined;
|
|
78
|
+
/** What a planner may read besides the arguments. */
|
|
79
|
+
export interface PlaybackPlanState {
|
|
80
|
+
/** The surface the provider plays on, if one is attached. */
|
|
81
|
+
surfaceId: string | null;
|
|
82
|
+
/** Finds a ref on that surface (surface coordinates), or null. */
|
|
83
|
+
locate(ref: PlaybackRef): PlaybackRect | null;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* A pure function from a call's validated arguments (and the state before the call) to the
|
|
87
|
+
* cursor steps that act it out. Ids the call creates do not exist yet: plan toward where the
|
|
88
|
+
* change lands. A throw, `null` or no steps falls back to the ids in the arguments.
|
|
89
|
+
*/
|
|
90
|
+
export type ToolPlanner = (args: Record<string, any>, state: PlaybackPlanState) => PlaybackPlan;
|
|
91
|
+
/** An editor's surface, attached by its React / Svelte component while it is on screen. */
|
|
92
|
+
export interface PlaybackSurface {
|
|
93
|
+
/** The cursors on this surface; the editor's presence layer draws it. */
|
|
94
|
+
presence: PresenceStore;
|
|
95
|
+
/** Where `ref` is, in surface coordinates. */
|
|
96
|
+
locate?(ref: PlaybackRef): PlaybackRect | null;
|
|
97
|
+
/** The visible part of the surface (surface coordinates), where a cursor enters. */
|
|
98
|
+
bounds?(): PlaybackRect | null;
|
|
99
|
+
/** Whether the surface is on screen now (default true). Hidden surfaces play instantly. */
|
|
100
|
+
visible?(): boolean;
|
|
101
|
+
/** Surface → viewport (client pixels) and back, so a cursor can move between surfaces. */
|
|
102
|
+
toViewport?(point: PlaybackPoint): PlaybackPoint;
|
|
103
|
+
fromViewport?(point: PlaybackPoint): PlaybackPoint;
|
|
104
|
+
/** Group what a call changes into one undo step (optional; most handlers already do). */
|
|
105
|
+
beginGesture?(key: string): void;
|
|
106
|
+
endGesture?(): void;
|
|
107
|
+
/** Bring the surface on screen (switch to its tab) before playing. */
|
|
108
|
+
reveal?(): void | Promise<void>;
|
|
109
|
+
/** Show a part of the editor (a panel or tab) for an `open` step, e.g. by clicking its tab. */
|
|
110
|
+
open?(ref: PlaybackRef): void | Promise<void>;
|
|
111
|
+
/** The kind of a bare `id` / `ids` argument on this surface (e.g. `node`, `vector`). */
|
|
112
|
+
defaultKind?: string;
|
|
113
|
+
}
|
|
114
|
+
export type PlaybackReads = 'glance' | 'skip' | 'play';
|
|
115
|
+
export interface AgentPlaybackOptions {
|
|
116
|
+
clock?: PresenceClock;
|
|
117
|
+
/** 1 = natural pace, 2 = twice as fast, `Infinity` = no animation (default 1). */
|
|
118
|
+
speed?: number;
|
|
119
|
+
/** Read-only tools: `glance` moves to their target only (default), `skip` doesn't, `play` plays them like writes. */
|
|
120
|
+
reads?: PlaybackReads;
|
|
121
|
+
/** Hide a cursor this long after its actor's last call (ms, default 1500; 0 keeps it). */
|
|
122
|
+
linger?: number;
|
|
123
|
+
/** The actor for calls that name none (default `{ id: 'agent', name: 'Agent' }`). */
|
|
124
|
+
actor?: PresenceActorInfo;
|
|
125
|
+
}
|
|
126
|
+
/** A step as played, for tests (`playback.record()`). */
|
|
127
|
+
export interface PlaybackRecord {
|
|
128
|
+
actor: string;
|
|
129
|
+
surface: string;
|
|
130
|
+
tool: string;
|
|
131
|
+
step: PlaybackStep;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* The things a call's arguments name, by convention: `id` / `ids` (the surface's default kind),
|
|
135
|
+
* `nodeId(s)`, `layerId(s)`, `clipId(s)`, `trackId(s)`, `seriesId`, `parameterId`, `keyframeId`,
|
|
136
|
+
* `range` / `cell` (A1, kind `cell`), and the same inside a command's `params`.
|
|
137
|
+
*/
|
|
138
|
+
export declare function playbackRefsFromArgs(args: unknown, defaultKind?: string): PlaybackRef[];
|
|
139
|
+
/**
|
|
140
|
+
* The things a write's result names: `id`, `ids`, `node.id`, `layerId`, `layer.id`, `created` (a list, or `{ nodes, edges }`),
|
|
141
|
+
* also inside a command result's `result`. Used to point at what a call created.
|
|
142
|
+
*/
|
|
143
|
+
export declare function playbackRefsFromResult(value: unknown, defaultKind?: string): PlaybackRef[];
|
|
144
|
+
/**
|
|
145
|
+
* The default performance: visit what the arguments name (at most 8), press, commit. Bare ids get
|
|
146
|
+
* kind `item` unless `defaultKind` is given; a surface reads `item` as its own `defaultKind`.
|
|
147
|
+
*/
|
|
148
|
+
export declare function derivePlaybackSteps(args: unknown, defaultKind?: string): PlaybackStep[];
|
|
149
|
+
/** Time to read a note: about 15 characters a second, between 0.6 s and 2.2 s. */
|
|
150
|
+
export declare function readingTime(text: string): number;
|
|
151
|
+
/** Smallest rectangle around `rects`, or null. */
|
|
152
|
+
export declare function unionRects(rects: readonly (PlaybackRect | null | undefined)[]): PlaybackRect | null;
|
|
153
|
+
/**
|
|
154
|
+
* Acts out tool calls on attached surfaces. Install it on a registry (`registry.use(playback.middleware)`
|
|
155
|
+
* or `playback.install(registry)`); editors attach their surfaces while mounted. Results never change:
|
|
156
|
+
* a call returns the same value or error with or without playback.
|
|
157
|
+
*/
|
|
158
|
+
export declare class AgentPlayback {
|
|
159
|
+
/** 1 = natural pace; `Infinity` plays nothing (calls run instantly). Takes effect on the next step. */
|
|
160
|
+
speed: number;
|
|
161
|
+
reads: PlaybackReads;
|
|
162
|
+
readonly clock: PresenceClock;
|
|
163
|
+
private readonly linger;
|
|
164
|
+
private readonly defaultActor;
|
|
165
|
+
private readonly surfaces;
|
|
166
|
+
private readonly actors;
|
|
167
|
+
private readonly recordings;
|
|
168
|
+
private readonly installed;
|
|
169
|
+
private readonly listeners;
|
|
170
|
+
private generation;
|
|
171
|
+
private running;
|
|
172
|
+
private calls;
|
|
173
|
+
constructor(options?: AgentPlaybackOptions);
|
|
174
|
+
/** The registry middleware that plays each call. */
|
|
175
|
+
readonly middleware: ToolMiddleware;
|
|
176
|
+
/** Adds the middleware to `registry` once (later calls with the same registry do nothing). */
|
|
177
|
+
install(registry: ToolRegistry): void;
|
|
178
|
+
/** Whether a performance is playing now (e.g. to make the editor read-only meanwhile). */
|
|
179
|
+
get active(): boolean;
|
|
180
|
+
/** Called when `active` changes. Returns an unsubscribe function. */
|
|
181
|
+
subscribe(listener: () => void): () => void;
|
|
182
|
+
/** Attaches a surface under a provider id (or the id providers name as `playbackSurface`). */
|
|
183
|
+
attach(id: string, surface: PlaybackSurface): () => void;
|
|
184
|
+
/** The surface attached under `id`. */
|
|
185
|
+
surface(id: string): PlaybackSurface | undefined;
|
|
186
|
+
/** Shows `text` in the actor's bubble on the surface it last worked on (until its next step). */
|
|
187
|
+
say(text: string, options?: {
|
|
188
|
+
actor?: PresenceActorInfo;
|
|
189
|
+
}): void;
|
|
190
|
+
/** Finishes every running performance at once (the calls still run and keep their results). */
|
|
191
|
+
stop(): void;
|
|
192
|
+
/** Collects every step played from now on (for tests). */
|
|
193
|
+
record(): PlaybackRecord[];
|
|
194
|
+
private actorState;
|
|
195
|
+
private enqueue;
|
|
196
|
+
private surfaceFor;
|
|
197
|
+
private perform;
|
|
198
|
+
private play;
|
|
199
|
+
private scheduleLinger;
|
|
200
|
+
private step;
|
|
201
|
+
/** Glides along a slight arc with ease-out, by elapsed time (fewer frames in a throttled tab, never longer). */
|
|
202
|
+
private glide;
|
|
203
|
+
}
|
|
204
|
+
/** An {@link AgentPlayback}: install it on a registry and attach editor surfaces to see calls played. */
|
|
205
|
+
export declare function createAgentPlayback(options?: AgentPlaybackOptions): AgentPlayback;
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import type { ToolMiddleware, ToolRegistry } from './registry.js';
|
|
2
|
+
import { type PresenceActorInfo, type PresenceClock, type PresenceStore } from './presence.js';
|
|
3
|
+
export interface PlaybackPoint {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
}
|
|
7
|
+
export interface PlaybackRect {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Something a surface can find: `{ kind: 'node', id }`, `{ kind: 'layer', id }`, a cell range
|
|
15
|
+
* `{ kind: 'cell', id: 'B7:G7' }` or one of the editor's own controls `{ kind: 'control', id: 'title' }`.
|
|
16
|
+
*/
|
|
17
|
+
export interface PlaybackRef {
|
|
18
|
+
kind: string;
|
|
19
|
+
id: string;
|
|
20
|
+
}
|
|
21
|
+
/** One thing the cursor does. Points and rectangles are in the surface's own coordinates. */
|
|
22
|
+
export type PlaybackStep = {
|
|
23
|
+
type: 'move';
|
|
24
|
+
to: PlaybackPoint;
|
|
25
|
+
ms?: number;
|
|
26
|
+
}
|
|
27
|
+
/** Glide to whatever the surface locates for `ref`, and ring it. Skipped when nothing is found. */
|
|
28
|
+
| {
|
|
29
|
+
type: 'target';
|
|
30
|
+
ref: PlaybackRef;
|
|
31
|
+
ms?: number;
|
|
32
|
+
} | {
|
|
33
|
+
type: 'focus';
|
|
34
|
+
rect: PlaybackRect | null;
|
|
35
|
+
} | {
|
|
36
|
+
type: 'say';
|
|
37
|
+
text: string;
|
|
38
|
+
ms?: number;
|
|
39
|
+
} | {
|
|
40
|
+
type: 'press';
|
|
41
|
+
} | {
|
|
42
|
+
type: 'release';
|
|
43
|
+
}
|
|
44
|
+
/** Move with the button down (the cursor only; the change lands at `commit`). */
|
|
45
|
+
| {
|
|
46
|
+
type: 'drag';
|
|
47
|
+
to: PlaybackPoint;
|
|
48
|
+
ms?: number;
|
|
49
|
+
} | {
|
|
50
|
+
type: 'type';
|
|
51
|
+
text: string;
|
|
52
|
+
ms?: number;
|
|
53
|
+
} | {
|
|
54
|
+
type: 'wait';
|
|
55
|
+
ms: number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Bring a part of the editor into view (a panel or tab): glide to what `ref` locates, click it,
|
|
59
|
+
* and let the surface's `open(ref)` show it. Skipped when the surface has no `open`.
|
|
60
|
+
*/
|
|
61
|
+
| {
|
|
62
|
+
type: 'open';
|
|
63
|
+
ref: PlaybackRef;
|
|
64
|
+
ms?: number;
|
|
65
|
+
}
|
|
66
|
+
/** The handler runs here, exactly once (appended when a plan leaves it out). */
|
|
67
|
+
| {
|
|
68
|
+
type: 'commit';
|
|
69
|
+
};
|
|
70
|
+
export interface PlaybackPlanResult {
|
|
71
|
+
steps: PlaybackStep[];
|
|
72
|
+
/** The surface to play on, when it is not the provider's (e.g. commands of one editor). */
|
|
73
|
+
surface?: string;
|
|
74
|
+
/** Treat the call as a read: a glance, no press and no undo gesture. */
|
|
75
|
+
readOnly?: boolean;
|
|
76
|
+
}
|
|
77
|
+
export type PlaybackPlan = PlaybackStep[] | PlaybackPlanResult | null | undefined;
|
|
78
|
+
/** What a planner may read besides the arguments. */
|
|
79
|
+
export interface PlaybackPlanState {
|
|
80
|
+
/** The surface the provider plays on, if one is attached. */
|
|
81
|
+
surfaceId: string | null;
|
|
82
|
+
/** Finds a ref on that surface (surface coordinates), or null. */
|
|
83
|
+
locate(ref: PlaybackRef): PlaybackRect | null;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* A pure function from a call's validated arguments (and the state before the call) to the
|
|
87
|
+
* cursor steps that act it out. Ids the call creates do not exist yet: plan toward where the
|
|
88
|
+
* change lands. A throw, `null` or no steps falls back to the ids in the arguments.
|
|
89
|
+
*/
|
|
90
|
+
export type ToolPlanner = (args: Record<string, any>, state: PlaybackPlanState) => PlaybackPlan;
|
|
91
|
+
/** An editor's surface, attached by its React / Svelte component while it is on screen. */
|
|
92
|
+
export interface PlaybackSurface {
|
|
93
|
+
/** The cursors on this surface; the editor's presence layer draws it. */
|
|
94
|
+
presence: PresenceStore;
|
|
95
|
+
/** Where `ref` is, in surface coordinates. */
|
|
96
|
+
locate?(ref: PlaybackRef): PlaybackRect | null;
|
|
97
|
+
/** The visible part of the surface (surface coordinates), where a cursor enters. */
|
|
98
|
+
bounds?(): PlaybackRect | null;
|
|
99
|
+
/** Whether the surface is on screen now (default true). Hidden surfaces play instantly. */
|
|
100
|
+
visible?(): boolean;
|
|
101
|
+
/** Surface → viewport (client pixels) and back, so a cursor can move between surfaces. */
|
|
102
|
+
toViewport?(point: PlaybackPoint): PlaybackPoint;
|
|
103
|
+
fromViewport?(point: PlaybackPoint): PlaybackPoint;
|
|
104
|
+
/** Group what a call changes into one undo step (optional; most handlers already do). */
|
|
105
|
+
beginGesture?(key: string): void;
|
|
106
|
+
endGesture?(): void;
|
|
107
|
+
/** Bring the surface on screen (switch to its tab) before playing. */
|
|
108
|
+
reveal?(): void | Promise<void>;
|
|
109
|
+
/** Show a part of the editor (a panel or tab) for an `open` step, e.g. by clicking its tab. */
|
|
110
|
+
open?(ref: PlaybackRef): void | Promise<void>;
|
|
111
|
+
/** The kind of a bare `id` / `ids` argument on this surface (e.g. `node`, `vector`). */
|
|
112
|
+
defaultKind?: string;
|
|
113
|
+
}
|
|
114
|
+
export type PlaybackReads = 'glance' | 'skip' | 'play';
|
|
115
|
+
export interface AgentPlaybackOptions {
|
|
116
|
+
clock?: PresenceClock;
|
|
117
|
+
/** 1 = natural pace, 2 = twice as fast, `Infinity` = no animation (default 1). */
|
|
118
|
+
speed?: number;
|
|
119
|
+
/** Read-only tools: `glance` moves to their target only (default), `skip` doesn't, `play` plays them like writes. */
|
|
120
|
+
reads?: PlaybackReads;
|
|
121
|
+
/** Hide a cursor this long after its actor's last call (ms, default 1500; 0 keeps it). */
|
|
122
|
+
linger?: number;
|
|
123
|
+
/** The actor for calls that name none (default `{ id: 'agent', name: 'Agent' }`). */
|
|
124
|
+
actor?: PresenceActorInfo;
|
|
125
|
+
}
|
|
126
|
+
/** A step as played, for tests (`playback.record()`). */
|
|
127
|
+
export interface PlaybackRecord {
|
|
128
|
+
actor: string;
|
|
129
|
+
surface: string;
|
|
130
|
+
tool: string;
|
|
131
|
+
step: PlaybackStep;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* The things a call's arguments name, by convention: `id` / `ids` (the surface's default kind),
|
|
135
|
+
* `nodeId(s)`, `layerId(s)`, `clipId(s)`, `trackId(s)`, `seriesId`, `parameterId`, `keyframeId`,
|
|
136
|
+
* `range` / `cell` (A1, kind `cell`), and the same inside a command's `params`.
|
|
137
|
+
*/
|
|
138
|
+
export declare function playbackRefsFromArgs(args: unknown, defaultKind?: string): PlaybackRef[];
|
|
139
|
+
/**
|
|
140
|
+
* The things a write's result names: `id`, `ids`, `node.id`, `layerId`, `layer.id`, `created` (a list, or `{ nodes, edges }`),
|
|
141
|
+
* also inside a command result's `result`. Used to point at what a call created.
|
|
142
|
+
*/
|
|
143
|
+
export declare function playbackRefsFromResult(value: unknown, defaultKind?: string): PlaybackRef[];
|
|
144
|
+
/**
|
|
145
|
+
* The default performance: visit what the arguments name (at most 8), press, commit. Bare ids get
|
|
146
|
+
* kind `item` unless `defaultKind` is given; a surface reads `item` as its own `defaultKind`.
|
|
147
|
+
*/
|
|
148
|
+
export declare function derivePlaybackSteps(args: unknown, defaultKind?: string): PlaybackStep[];
|
|
149
|
+
/** Time to read a note: about 15 characters a second, between 0.6 s and 2.2 s. */
|
|
150
|
+
export declare function readingTime(text: string): number;
|
|
151
|
+
/** Smallest rectangle around `rects`, or null. */
|
|
152
|
+
export declare function unionRects(rects: readonly (PlaybackRect | null | undefined)[]): PlaybackRect | null;
|
|
153
|
+
/**
|
|
154
|
+
* Acts out tool calls on attached surfaces. Install it on a registry (`registry.use(playback.middleware)`
|
|
155
|
+
* or `playback.install(registry)`); editors attach their surfaces while mounted. Results never change:
|
|
156
|
+
* a call returns the same value or error with or without playback.
|
|
157
|
+
*/
|
|
158
|
+
export declare class AgentPlayback {
|
|
159
|
+
/** 1 = natural pace; `Infinity` plays nothing (calls run instantly). Takes effect on the next step. */
|
|
160
|
+
speed: number;
|
|
161
|
+
reads: PlaybackReads;
|
|
162
|
+
readonly clock: PresenceClock;
|
|
163
|
+
private readonly linger;
|
|
164
|
+
private readonly defaultActor;
|
|
165
|
+
private readonly surfaces;
|
|
166
|
+
private readonly actors;
|
|
167
|
+
private readonly recordings;
|
|
168
|
+
private readonly installed;
|
|
169
|
+
private readonly listeners;
|
|
170
|
+
private generation;
|
|
171
|
+
private running;
|
|
172
|
+
private calls;
|
|
173
|
+
constructor(options?: AgentPlaybackOptions);
|
|
174
|
+
/** The registry middleware that plays each call. */
|
|
175
|
+
readonly middleware: ToolMiddleware;
|
|
176
|
+
/** Adds the middleware to `registry` once (later calls with the same registry do nothing). */
|
|
177
|
+
install(registry: ToolRegistry): void;
|
|
178
|
+
/** Whether a performance is playing now (e.g. to make the editor read-only meanwhile). */
|
|
179
|
+
get active(): boolean;
|
|
180
|
+
/** Called when `active` changes. Returns an unsubscribe function. */
|
|
181
|
+
subscribe(listener: () => void): () => void;
|
|
182
|
+
/** Attaches a surface under a provider id (or the id providers name as `playbackSurface`). */
|
|
183
|
+
attach(id: string, surface: PlaybackSurface): () => void;
|
|
184
|
+
/** The surface attached under `id`. */
|
|
185
|
+
surface(id: string): PlaybackSurface | undefined;
|
|
186
|
+
/** Shows `text` in the actor's bubble on the surface it last worked on (until its next step). */
|
|
187
|
+
say(text: string, options?: {
|
|
188
|
+
actor?: PresenceActorInfo;
|
|
189
|
+
}): void;
|
|
190
|
+
/** Finishes every running performance at once (the calls still run and keep their results). */
|
|
191
|
+
stop(): void;
|
|
192
|
+
/** Collects every step played from now on (for tests). */
|
|
193
|
+
record(): PlaybackRecord[];
|
|
194
|
+
private actorState;
|
|
195
|
+
private enqueue;
|
|
196
|
+
private surfaceFor;
|
|
197
|
+
private perform;
|
|
198
|
+
private play;
|
|
199
|
+
private scheduleLinger;
|
|
200
|
+
private step;
|
|
201
|
+
/** Glides along a slight arc with ease-out, by elapsed time (fewer frames in a throttled tab, never longer). */
|
|
202
|
+
private glide;
|
|
203
|
+
}
|
|
204
|
+
/** An {@link AgentPlayback}: install it on a registry and attach editor surfaces to see calls played. */
|
|
205
|
+
export declare function createAgentPlayback(options?: AgentPlaybackOptions): AgentPlayback;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export interface PresenceActor {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
color: string;
|
|
5
|
+
/** Cursor position in the surface's own coordinates (scene / canvas). */
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
/** The button is down (dragging). */
|
|
9
|
+
pressed: boolean;
|
|
10
|
+
/** A short note shown next to the cursor (what the agent is doing). */
|
|
11
|
+
message?: string;
|
|
12
|
+
/** A rectangle (surface coordinates) the agent is working on, drawn as a highlight ring. */
|
|
13
|
+
focus?: {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface PresenceState {
|
|
21
|
+
actors: readonly PresenceActor[];
|
|
22
|
+
}
|
|
23
|
+
export declare const PRESENCE_COLORS: readonly string[];
|
|
24
|
+
/** Cursor positions and notes of agents acting on a surface, for an overlay. */
|
|
25
|
+
export declare class PresenceStore {
|
|
26
|
+
private state;
|
|
27
|
+
private readonly listeners;
|
|
28
|
+
getState: () => PresenceState;
|
|
29
|
+
subscribe: (listener: (state: PresenceState) => void) => (() => void);
|
|
30
|
+
/** The actor with `id`, if it is on the surface. */
|
|
31
|
+
get(id: string): PresenceActor | undefined;
|
|
32
|
+
/** Adds or changes an actor. */
|
|
33
|
+
set(actor: Pick<PresenceActor, 'id'> & Partial<PresenceActor>): void;
|
|
34
|
+
remove(id: string): void;
|
|
35
|
+
}
|
|
36
|
+
/** Time for performances: real timers, or an instant clock for tests and recordings. */
|
|
37
|
+
export interface PresenceClock {
|
|
38
|
+
now(): number;
|
|
39
|
+
wait(ms: number): Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
export declare const realPresenceClock: PresenceClock;
|
|
42
|
+
/** A clock whose waits finish at once while its time still advances (repeatable performances). */
|
|
43
|
+
export declare function createInstantPresenceClock(start?: number): PresenceClock & {
|
|
44
|
+
elapsed(): number;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Glides an actor's cursor from `from` to `to` over `ms` (ease-out cubic, ~60 frames a second),
|
|
48
|
+
* calling `each` with the eased progress after every frame (e.g. to drag a value along).
|
|
49
|
+
*/
|
|
50
|
+
export declare function tweenPresenceCursor(presence: PresenceStore, clock: PresenceClock, id: string, from: {
|
|
51
|
+
x: number;
|
|
52
|
+
y: number;
|
|
53
|
+
}, to: {
|
|
54
|
+
x: number;
|
|
55
|
+
y: number;
|
|
56
|
+
}, ms: number, each?: (t: number) => void): Promise<void>;
|
|
57
|
+
export interface PresenceActorInfo {
|
|
58
|
+
id: string;
|
|
59
|
+
name?: string;
|
|
60
|
+
color?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface PerformanceQueueOptions {
|
|
63
|
+
clock: PresenceClock;
|
|
64
|
+
/** Hide each actor's cursor this long after its last call (ms, default 1500; 0 keeps it). */
|
|
65
|
+
linger?: number;
|
|
66
|
+
/** Called around each call so everything it changes is one undo step. */
|
|
67
|
+
beginGesture?: (key: string) => void;
|
|
68
|
+
endGesture?: () => void;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Runs performances one after another per actor (different actors run side by side). Each
|
|
72
|
+
* call shows the actor's cursor, wraps the call in one gesture (one undo step), clears the
|
|
73
|
+
* note when it ends, and hides the cursor after `linger` unless another call followed.
|
|
74
|
+
*/
|
|
75
|
+
export declare class PerformanceQueue {
|
|
76
|
+
readonly presence: PresenceStore;
|
|
77
|
+
private readonly options;
|
|
78
|
+
private readonly queues;
|
|
79
|
+
private calls;
|
|
80
|
+
constructor(presence: PresenceStore, options: PerformanceQueueOptions);
|
|
81
|
+
run<T>(actor: PresenceActorInfo, perform: () => Promise<T>): Promise<T>;
|
|
82
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export interface PresenceActor {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
color: string;
|
|
5
|
+
/** Cursor position in the surface's own coordinates (scene / canvas). */
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
/** The button is down (dragging). */
|
|
9
|
+
pressed: boolean;
|
|
10
|
+
/** A short note shown next to the cursor (what the agent is doing). */
|
|
11
|
+
message?: string;
|
|
12
|
+
/** A rectangle (surface coordinates) the agent is working on, drawn as a highlight ring. */
|
|
13
|
+
focus?: {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface PresenceState {
|
|
21
|
+
actors: readonly PresenceActor[];
|
|
22
|
+
}
|
|
23
|
+
export declare const PRESENCE_COLORS: readonly string[];
|
|
24
|
+
/** Cursor positions and notes of agents acting on a surface, for an overlay. */
|
|
25
|
+
export declare class PresenceStore {
|
|
26
|
+
private state;
|
|
27
|
+
private readonly listeners;
|
|
28
|
+
getState: () => PresenceState;
|
|
29
|
+
subscribe: (listener: (state: PresenceState) => void) => (() => void);
|
|
30
|
+
/** The actor with `id`, if it is on the surface. */
|
|
31
|
+
get(id: string): PresenceActor | undefined;
|
|
32
|
+
/** Adds or changes an actor. */
|
|
33
|
+
set(actor: Pick<PresenceActor, 'id'> & Partial<PresenceActor>): void;
|
|
34
|
+
remove(id: string): void;
|
|
35
|
+
}
|
|
36
|
+
/** Time for performances: real timers, or an instant clock for tests and recordings. */
|
|
37
|
+
export interface PresenceClock {
|
|
38
|
+
now(): number;
|
|
39
|
+
wait(ms: number): Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
export declare const realPresenceClock: PresenceClock;
|
|
42
|
+
/** A clock whose waits finish at once while its time still advances (repeatable performances). */
|
|
43
|
+
export declare function createInstantPresenceClock(start?: number): PresenceClock & {
|
|
44
|
+
elapsed(): number;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Glides an actor's cursor from `from` to `to` over `ms` (ease-out cubic, ~60 frames a second),
|
|
48
|
+
* calling `each` with the eased progress after every frame (e.g. to drag a value along).
|
|
49
|
+
*/
|
|
50
|
+
export declare function tweenPresenceCursor(presence: PresenceStore, clock: PresenceClock, id: string, from: {
|
|
51
|
+
x: number;
|
|
52
|
+
y: number;
|
|
53
|
+
}, to: {
|
|
54
|
+
x: number;
|
|
55
|
+
y: number;
|
|
56
|
+
}, ms: number, each?: (t: number) => void): Promise<void>;
|
|
57
|
+
export interface PresenceActorInfo {
|
|
58
|
+
id: string;
|
|
59
|
+
name?: string;
|
|
60
|
+
color?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface PerformanceQueueOptions {
|
|
63
|
+
clock: PresenceClock;
|
|
64
|
+
/** Hide each actor's cursor this long after its last call (ms, default 1500; 0 keeps it). */
|
|
65
|
+
linger?: number;
|
|
66
|
+
/** Called around each call so everything it changes is one undo step. */
|
|
67
|
+
beginGesture?: (key: string) => void;
|
|
68
|
+
endGesture?: () => void;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Runs performances one after another per actor (different actors run side by side). Each
|
|
72
|
+
* call shows the actor's cursor, wraps the call in one gesture (one undo step), clears the
|
|
73
|
+
* note when it ends, and hides the cursor after `linger` unless another call followed.
|
|
74
|
+
*/
|
|
75
|
+
export declare class PerformanceQueue {
|
|
76
|
+
readonly presence: PresenceStore;
|
|
77
|
+
private readonly options;
|
|
78
|
+
private readonly queues;
|
|
79
|
+
private calls;
|
|
80
|
+
constructor(presence: PresenceStore, options: PerformanceQueueOptions);
|
|
81
|
+
run<T>(actor: PresenceActorInfo, perform: () => Promise<T>): Promise<T>;
|
|
82
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type JsonSchema, type SchemaValidationError } from './schema.cjs';
|
|
2
2
|
import { ToolRegistryView, type ToolViewOptions } from './view.cjs';
|
|
3
|
+
import type { ToolPlanner } from './playback.cjs';
|
|
4
|
+
import type { PresenceActorInfo } from './presence.cjs';
|
|
3
5
|
/**
|
|
4
6
|
* MCP-shaped tool definition, as returned by `tools/list`.
|
|
5
7
|
*/
|
|
@@ -47,6 +49,14 @@ export interface ToolCallContext {
|
|
|
47
49
|
/** Id of the provider that owns the tool. */
|
|
48
50
|
providerId: string;
|
|
49
51
|
signal?: AbortSignal;
|
|
52
|
+
/** Who is calling (an MCP client, a scripted agent), for agent playback's cursors and queues. */
|
|
53
|
+
actor?: PresenceActorInfo;
|
|
54
|
+
}
|
|
55
|
+
/** Options for `callTool`. */
|
|
56
|
+
export interface ToolCallOptions {
|
|
57
|
+
signal?: AbortSignal;
|
|
58
|
+
/** Who is calling; agent playback gives each actor its own cursor and queue. */
|
|
59
|
+
actor?: PresenceActorInfo;
|
|
50
60
|
}
|
|
51
61
|
/**
|
|
52
62
|
* Handler return values are normalized into an {@link McpToolResult}: a full
|
|
@@ -57,6 +67,17 @@ export interface ToolCallContext {
|
|
|
57
67
|
export type AgentToolHandler = (args: Record<string, any>, context: ToolCallContext) => unknown | Promise<unknown>;
|
|
58
68
|
export interface AgentTool extends McpToolDefinition {
|
|
59
69
|
handler: AgentToolHandler;
|
|
70
|
+
/**
|
|
71
|
+
* How agent playback acts this tool out (see `createAgentPlayback`): `'self'` when the
|
|
72
|
+
* handler drives its own cursor (a director), `false` to never play it. Default: play it
|
|
73
|
+
* from `plan`, or from the ids in its arguments and result.
|
|
74
|
+
*/
|
|
75
|
+
playback?: 'self' | false;
|
|
76
|
+
/**
|
|
77
|
+
* Pure planner for agent playback: the cursor steps (surface coordinates) that act out a
|
|
78
|
+
* call with these arguments, given the state before the call. Not sent to clients.
|
|
79
|
+
*/
|
|
80
|
+
plan?: ToolPlanner;
|
|
60
81
|
}
|
|
61
82
|
/**
|
|
62
83
|
* A source of tools, typically one per mounted editor, spreadsheet or canvas.
|
|
@@ -83,7 +104,23 @@ export interface AgentToolProvider {
|
|
|
83
104
|
tools: readonly AgentTool[] | (() => readonly AgentTool[]);
|
|
84
105
|
/** Lets the provider signal that its tool list changed; returns an unsubscribe function. */
|
|
85
106
|
subscribe?: (notify: () => void) => () => void;
|
|
107
|
+
/** The playback surface its calls are acted out on (default: the provider id). */
|
|
108
|
+
playbackSurface?: string;
|
|
86
109
|
}
|
|
110
|
+
/** A tool call as a {@link ToolMiddleware} sees it (arguments already validated). */
|
|
111
|
+
export interface ToolMiddlewareCall {
|
|
112
|
+
/** The exposed (possibly namespaced) name. */
|
|
113
|
+
name: string;
|
|
114
|
+
tool: AgentTool;
|
|
115
|
+
provider: AgentToolProvider;
|
|
116
|
+
args: Record<string, any>;
|
|
117
|
+
context: ToolCallContext;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Wraps every tool call of a registry (`registry.use`): call `next()` to run the handler (or
|
|
121
|
+
* the next middleware) and return its value. A throw becomes an `isError` result.
|
|
122
|
+
*/
|
|
123
|
+
export type ToolMiddleware = (call: ToolMiddlewareCall, next: () => Promise<unknown>) => Promise<unknown>;
|
|
87
124
|
export type ToolErrorCode = 'unknown_tool' | 'invalid_arguments' | 'tool_failed';
|
|
88
125
|
/** Structured error carried in `structuredContent.error` of a failed call. */
|
|
89
126
|
export interface ToolCallError {
|
|
@@ -152,9 +189,7 @@ export interface ToolSource {
|
|
|
152
189
|
listTools(): McpListToolsResult;
|
|
153
190
|
hasTool(name: string): boolean;
|
|
154
191
|
getTool(name: string): McpToolDefinition | undefined;
|
|
155
|
-
callTool(name: string, args?: Record<string, unknown>, options?:
|
|
156
|
-
signal?: AbortSignal;
|
|
157
|
-
}): Promise<McpToolResult>;
|
|
192
|
+
callTool(name: string, args?: Record<string, unknown>, options?: ToolCallOptions): Promise<McpToolResult>;
|
|
158
193
|
onListChanged(listener: (tools: McpToolDefinition[]) => void): () => void;
|
|
159
194
|
/** The toolsets behind `listTools()`, in listing order. */
|
|
160
195
|
toolsets(): ToolsetInfo[];
|
|
@@ -182,6 +217,7 @@ export declare class ToolRegistry implements ToolSource {
|
|
|
182
217
|
};
|
|
183
218
|
private readonly entries;
|
|
184
219
|
private readonly listeners;
|
|
220
|
+
private readonly middleware;
|
|
185
221
|
private readonly options;
|
|
186
222
|
private timer;
|
|
187
223
|
private lastSignature;
|
|
@@ -194,6 +230,11 @@ export declare class ToolRegistry implements ToolSource {
|
|
|
194
230
|
register(provider: AgentToolProvider): () => void;
|
|
195
231
|
/** Removes a provider by id or instance. Returns whether it was registered. */
|
|
196
232
|
unregister(providerOrId: string | AgentToolProvider): boolean;
|
|
233
|
+
/**
|
|
234
|
+
* Adds a middleware that wraps every tool call (first added runs outermost), e.g. agent
|
|
235
|
+
* playback's `playback.middleware`. Returns a function that removes it.
|
|
236
|
+
*/
|
|
237
|
+
use(middleware: ToolMiddleware): () => void;
|
|
197
238
|
/** Registered provider ids in registration order. */
|
|
198
239
|
providerIds(): string[];
|
|
199
240
|
/**
|
|
@@ -222,9 +263,7 @@ export declare class ToolRegistry implements ToolSource {
|
|
|
222
263
|
* `structuredContent.error` (MCP transports may map `unknown_tool` to a
|
|
223
264
|
* JSON-RPC `-32602` error instead).
|
|
224
265
|
*/
|
|
225
|
-
callTool(name: string, args?: Record<string, unknown>, options?:
|
|
226
|
-
signal?: AbortSignal;
|
|
227
|
-
}): Promise<McpToolResult>;
|
|
266
|
+
callTool(name: string, args?: Record<string, unknown>, options?: ToolCallOptions): Promise<McpToolResult>;
|
|
228
267
|
/**
|
|
229
268
|
* Subscribes to tool-list changes. Notifications are coalesced: many
|
|
230
269
|
* registrations or provider signals within the delay window produce one
|