@pixerate/editor 0.53.0 → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/index.cjs +14 -6
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +4 -3
- package/dist/agent/index.d.ts +4 -3
- package/dist/agent/index.js +12 -4
- package/dist/agent/index.js.map +1 -1
- package/dist/animation/index.cjs +15 -1
- package/dist/animation/index.cjs.map +1 -1
- package/dist/animation/index.d.cts +3 -226
- package/dist/animation/index.d.ts +3 -226
- package/dist/animation/index.js +14 -0
- package/dist/bridge/cli.cjs +36 -0
- package/dist/bridge/cli.cjs.map +1 -0
- package/dist/bridge/cli.d.cts +1 -0
- package/dist/bridge/cli.d.ts +1 -0
- package/dist/bridge/cli.js +36 -0
- package/dist/bridge/cli.js.map +1 -0
- package/dist/bridge/index.cjs +16 -0
- package/dist/bridge/index.cjs.map +1 -0
- package/dist/bridge/index.d.cts +65 -0
- package/dist/bridge/index.d.ts +65 -0
- package/dist/bridge/index.js +16 -0
- package/dist/bridge/index.js.map +1 -0
- package/dist/bridge-client-C5OziCRK.d.cts +148 -0
- package/dist/bridge-client-C5dRjrz5.d.ts +148 -0
- package/dist/canvas/index.cjs +1308 -528
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +309 -5
- package/dist/canvas/index.d.ts +309 -5
- package/dist/canvas/index.js +1295 -515
- package/dist/canvas/index.js.map +1 -1
- package/dist/chart/index.cjs +34 -76
- package/dist/chart/index.cjs.map +1 -1
- package/dist/chart/index.d.cts +9 -38
- package/dist/chart/index.d.ts +9 -38
- package/dist/chart/index.js +23 -65
- package/dist/chart/index.js.map +1 -1
- package/dist/chunk-AWKPSOSX.js +401 -0
- package/dist/chunk-AWKPSOSX.js.map +1 -0
- package/dist/chunk-B6DSIEXA.js +96 -0
- package/dist/chunk-B6DSIEXA.js.map +1 -0
- package/dist/chunk-EGFUVXKK.cjs +96 -0
- package/dist/chunk-EGFUVXKK.cjs.map +1 -0
- package/dist/{chunk-AMWXSYCI.js → chunk-GPWNYQ7R.js} +2 -370
- package/dist/chunk-GPWNYQ7R.js.map +1 -0
- package/dist/chunk-H5K77C7Y.cjs +3848 -0
- package/dist/chunk-H5K77C7Y.cjs.map +1 -0
- package/dist/chunk-K73CKYUM.cjs +458 -0
- package/dist/chunk-K73CKYUM.cjs.map +1 -0
- package/dist/chunk-NV22EMOZ.cjs +401 -0
- package/dist/chunk-NV22EMOZ.cjs.map +1 -0
- package/dist/chunk-PTMIGXZ2.js +467 -0
- package/dist/chunk-PTMIGXZ2.js.map +1 -0
- package/dist/chunk-QIWFEEWG.cjs +467 -0
- package/dist/chunk-QIWFEEWG.cjs.map +1 -0
- package/dist/chunk-WWJNC7SX.js +3848 -0
- package/dist/chunk-WWJNC7SX.js.map +1 -0
- package/dist/commands/index.d.cts +1 -1
- package/dist/commands/index.d.ts +1 -1
- package/dist/diagram/index.cjs +1146 -0
- package/dist/diagram/index.cjs.map +1 -0
- package/dist/diagram/index.d.cts +787 -0
- package/dist/diagram/index.d.ts +787 -0
- package/dist/diagram/index.js +1146 -0
- package/dist/diagram/index.js.map +1 -0
- package/dist/{easing-DTmX99QG.d.cts → easing-CNGk-W6d.d.cts} +1 -1
- package/dist/{easing-DTmX99QG.d.ts → easing-CNGk-W6d.d.ts} +1 -1
- package/dist/generation/index.d.cts +2 -2
- package/dist/generation/index.d.ts +2 -2
- package/dist/image-editor/index.d.cts +1 -1
- package/dist/image-editor/index.d.ts +1 -1
- package/dist/parameters/index.d.cts +1 -1
- package/dist/parameters/index.d.ts +1 -1
- package/dist/player-DSMjdgQ9.d.cts +225 -0
- package/dist/player-DdfVrKWq.d.ts +225 -0
- package/dist/presence-Cb6WhcrQ.d.cts +77 -0
- package/dist/presence-Cb6WhcrQ.d.ts +77 -0
- package/dist/{registry-CSlH4iUn.d.ts → registry-7AZFuand.d.ts} +1 -1
- package/dist/{registry-B4l-lYts.d.cts → registry-DIpIaCkH.d.cts} +1 -1
- package/dist/tools/index.cjs +10 -2
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.d.cts +3 -74
- package/dist/tools/index.d.ts +3 -74
- package/dist/tools/index.js +12 -4
- package/dist/types-BULrFyuQ.d.cts +316 -0
- package/dist/types-BULrFyuQ.d.ts +316 -0
- package/dist/vector/index.d.cts +1 -1
- package/dist/vector/index.d.ts +1 -1
- package/package.json +14 -1
- package/dist/chunk-AMWXSYCI.js.map +0 -1
- package/dist/chunk-XFYUFVAX.cjs +0 -826
- package/dist/chunk-XFYUFVAX.cjs.map +0 -1
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { b as AnimationEasing } from './easing-CNGk-W6d.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Colour interpolation in OKLab (Björn Ottosson's perceptual space, as CSS Color 4 uses for
|
|
5
|
+
* `color-mix(in oklab, …)`), with premultiplied alpha so a fade to `transparent` does not
|
|
6
|
+
* darken through black.
|
|
7
|
+
*/
|
|
8
|
+
interface OklabColor {
|
|
9
|
+
/** Lightness, 0–1. */
|
|
10
|
+
l: number;
|
|
11
|
+
a: number;
|
|
12
|
+
b: number;
|
|
13
|
+
/** Alpha, 0–1. */
|
|
14
|
+
alpha: number;
|
|
15
|
+
}
|
|
16
|
+
/** sRGB channels (0–1) to OKLab. */
|
|
17
|
+
declare function rgbToOklab(r: number, g: number, b: number, alpha?: number): OklabColor;
|
|
18
|
+
/** OKLab to sRGB channels (0–1, clamped into gamut). */
|
|
19
|
+
declare function oklabToRgb(color: OklabColor): {
|
|
20
|
+
r: number;
|
|
21
|
+
g: number;
|
|
22
|
+
b: number;
|
|
23
|
+
a: number;
|
|
24
|
+
};
|
|
25
|
+
/** Parses a CSS colour (hex, `rgb()` / `rgba()`, `transparent`, `black`, `white`) to OKLab, or `null`. */
|
|
26
|
+
declare function parseOklab(input: unknown): OklabColor | null;
|
|
27
|
+
/** Formats OKLab as `#rrggbb` (or `#rrggbbaa` when translucent). */
|
|
28
|
+
declare function formatOklab(color: OklabColor): string;
|
|
29
|
+
/**
|
|
30
|
+
* Mixes two colours at `t` (0 = `from`, 1 = `to`) in OKLab with premultiplied alpha.
|
|
31
|
+
* Returns `null` when either is not a readable colour.
|
|
32
|
+
*/
|
|
33
|
+
declare function mixColorsOklab(from: unknown, to: unknown, t: number): string | null;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Keyframe tracks, independent of what they animate: each track is a list of keyframes
|
|
37
|
+
* `{ time (ms), value, easing }`, where the easing governs the segment *leaving* the keyframe
|
|
38
|
+
* (filmcraft / After Effects convention).
|
|
39
|
+
*/
|
|
40
|
+
/** Keyframe times closer than this (ms) are the same time. */
|
|
41
|
+
declare const ANIMATION_TIME_EPSILON = 0.000001;
|
|
42
|
+
/** A keyframe value: a number, or a CSS colour for colour properties. */
|
|
43
|
+
type AnimationValue = number | string;
|
|
44
|
+
interface AnimationKeyframe {
|
|
45
|
+
/** Time in milliseconds from the start of the timeline. */
|
|
46
|
+
time: number;
|
|
47
|
+
value: AnimationValue;
|
|
48
|
+
/** Easing of the segment from this keyframe to the next (default `linear`). */
|
|
49
|
+
easing?: AnimationEasing;
|
|
50
|
+
}
|
|
51
|
+
interface AnimationTrack {
|
|
52
|
+
keyframes: AnimationKeyframe[];
|
|
53
|
+
/** Disabled tracks keep their keyframes but do not animate (default `true`). */
|
|
54
|
+
enabled?: boolean;
|
|
55
|
+
}
|
|
56
|
+
/** How a track's values interpolate: numbers linearly, colours in OKLab. */
|
|
57
|
+
type AnimationValueType = 'number' | 'color';
|
|
58
|
+
/** Whether `value` is a well-formed keyframe. */
|
|
59
|
+
declare function isAnimationKeyframe(value: unknown): value is AnimationKeyframe;
|
|
60
|
+
/**
|
|
61
|
+
* Keyframes sorted by time, invalid entries dropped and duplicate times merged (the *later*
|
|
62
|
+
* entry in the array wins, so appending a keyframe replaces one at the same time). Cached per
|
|
63
|
+
* array (revalidated by element identity), so evaluating every frame does not re-sort; treat
|
|
64
|
+
* keyframe objects as immutable.
|
|
65
|
+
*/
|
|
66
|
+
declare function normalizeKeyframes(keyframes: readonly AnimationKeyframe[] | undefined | null): AnimationKeyframe[];
|
|
67
|
+
|
|
68
|
+
/** How time past the end of the timeline maps back into it. */
|
|
69
|
+
type AnimationLoopMode = 'none' | 'loop' | 'ping-pong';
|
|
70
|
+
/**
|
|
71
|
+
* Interpolates between two keyframe values: numbers linearly, colours in OKLab (premultiplied
|
|
72
|
+
* alpha). Mismatched or unreadable values hold `from` until `t` reaches 1.
|
|
73
|
+
*/
|
|
74
|
+
declare function interpolateAnimationValue(from: AnimationValue, to: AnimationValue, t: number, type?: AnimationValueType): AnimationValue;
|
|
75
|
+
/**
|
|
76
|
+
* A track's value at `time`. Before the first keyframe it holds the first value, after the
|
|
77
|
+
* last the last value. Keyframes may be unsorted or share times (see `normalizeKeyframes`).
|
|
78
|
+
* Returns `undefined` for a track without valid keyframes.
|
|
79
|
+
*/
|
|
80
|
+
declare function evaluateTrack(track: AnimationTrack | readonly AnimationKeyframe[] | undefined | null, time: number, type?: AnimationValueType): AnimationValue | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Maps a running time onto the timeline `[0, duration]`: clamped (`none`), wrapped (`loop`)
|
|
83
|
+
* or bounced (`ping-pong`).
|
|
84
|
+
*/
|
|
85
|
+
declare function wrapAnimationTime(time: number, duration: number, loop?: AnimationLoopMode): number;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The time source that animations (and canvas agent performances) play on.
|
|
89
|
+
*
|
|
90
|
+
* Defaults to `realClock` (requestAnimationFrame and setTimeout).
|
|
91
|
+
* A `ManualClock` moves only when told to via `advance(ms)` or `tick(fps)`,
|
|
92
|
+
* enabling deterministic frame-by-frame stepping for testing, video generation,
|
|
93
|
+
* or headless server environments.
|
|
94
|
+
*/
|
|
95
|
+
interface Clock {
|
|
96
|
+
/** Current time in milliseconds. */
|
|
97
|
+
now(): number;
|
|
98
|
+
/** Resolves on the next animation frame. */
|
|
99
|
+
frame(): Promise<void>;
|
|
100
|
+
/** Resolves after `ms` milliseconds of this clock's time. */
|
|
101
|
+
sleep(ms: number): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* Whether the clock follows wall time. Live clocks stop or degrade when the
|
|
104
|
+
* tab is in the background (browsers pause animation frames), so transitions
|
|
105
|
+
* can commit immediately rather than leaving operations hanging.
|
|
106
|
+
*/
|
|
107
|
+
readonly live: boolean;
|
|
108
|
+
}
|
|
109
|
+
/** Whether the browser tab is hidden (where RAF pauses). */
|
|
110
|
+
declare const pageHidden: () => boolean;
|
|
111
|
+
/** Real-time clock using requestAnimationFrame and setTimeout. */
|
|
112
|
+
declare const realClock: Clock;
|
|
113
|
+
/**
|
|
114
|
+
* A deterministic clock that only moves forward when `advance` or `tick` is called.
|
|
115
|
+
* Allows step-by-step frame testing and video rendering without waiting for real time.
|
|
116
|
+
*/
|
|
117
|
+
declare class ManualClock implements Clock {
|
|
118
|
+
readonly live = false;
|
|
119
|
+
private time;
|
|
120
|
+
private frames;
|
|
121
|
+
private sleepers;
|
|
122
|
+
private seq;
|
|
123
|
+
constructor(start?: number);
|
|
124
|
+
now(): number;
|
|
125
|
+
frame(): Promise<void>;
|
|
126
|
+
sleep(ms: number): Promise<void>;
|
|
127
|
+
/** Whether any frames or sleep timers are currently pending. */
|
|
128
|
+
get pending(): boolean;
|
|
129
|
+
/** Advances time by `ms`, resolving due sleep timers in order, followed by queued frames. */
|
|
130
|
+
advance(ms: number): Promise<void>;
|
|
131
|
+
/** Convenience method to advance by 1 frame at a given fps (default: 60fps = 16.67ms). */
|
|
132
|
+
tick(fps?: number): Promise<void>;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
interface AnimationPlayerState {
|
|
136
|
+
/** Playhead time in ms, inside `[0, duration]`. */
|
|
137
|
+
time: number;
|
|
138
|
+
playing: boolean;
|
|
139
|
+
/** True between `scrub` and `endScrub`. */
|
|
140
|
+
scrubbing: boolean;
|
|
141
|
+
loop: AnimationLoopMode;
|
|
142
|
+
/** Speed multiplier (negative plays backwards). */
|
|
143
|
+
playbackRate: number;
|
|
144
|
+
duration: number;
|
|
145
|
+
}
|
|
146
|
+
interface AnimationPlayerOptions {
|
|
147
|
+
/** Time source (default `realClock`: requestAnimationFrame). Pass a `ManualClock` in tests or for rendering. */
|
|
148
|
+
clock?: Clock;
|
|
149
|
+
/** Timeline length in ms, or a getter (e.g. the last keyframe time). Default 1000. */
|
|
150
|
+
duration?: number | (() => number);
|
|
151
|
+
loop?: AnimationLoopMode;
|
|
152
|
+
playbackRate?: number;
|
|
153
|
+
/** Initial playhead time (default 0). */
|
|
154
|
+
time?: number;
|
|
155
|
+
/** Called whenever the playhead moves (playback, seek, scrub). */
|
|
156
|
+
onTime?: (time: number) => void;
|
|
157
|
+
/** Called when non-looping playback reaches the end (or the start, playing backwards). */
|
|
158
|
+
onEnd?: () => void;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Plays a timeline on an injectable `Clock`: play / pause / seek / scrub with looping,
|
|
162
|
+
* ping-pong and playback rate. It only asks the clock for frames while playing, so a
|
|
163
|
+
* `ManualClock` steps it deterministically and the real clock's requestAnimationFrame is the
|
|
164
|
+
* only place wall time enters.
|
|
165
|
+
*
|
|
166
|
+
* `getState()` returns a cached snapshot replaced on change (usable with `useSyncExternalStore`).
|
|
167
|
+
*/
|
|
168
|
+
declare class AnimationPlayer {
|
|
169
|
+
private readonly clock;
|
|
170
|
+
private durationSource;
|
|
171
|
+
private onTime?;
|
|
172
|
+
private onEnd?;
|
|
173
|
+
private time;
|
|
174
|
+
private playing;
|
|
175
|
+
private scrubbing;
|
|
176
|
+
private resumeAfterScrub;
|
|
177
|
+
private loop;
|
|
178
|
+
private rate;
|
|
179
|
+
/** Unwrapped time at `anchorAt` (keeps the ping-pong direction across frames). */
|
|
180
|
+
private anchorRaw;
|
|
181
|
+
private anchorAt;
|
|
182
|
+
private generation;
|
|
183
|
+
private cached;
|
|
184
|
+
private listeners;
|
|
185
|
+
constructor(options?: AnimationPlayerOptions);
|
|
186
|
+
/** Current timeline length (ms). */
|
|
187
|
+
get duration(): number;
|
|
188
|
+
get currentTime(): number;
|
|
189
|
+
get isPlaying(): boolean;
|
|
190
|
+
getState(): AnimationPlayerState;
|
|
191
|
+
subscribe(listener: (state: AnimationPlayerState) => void): () => void;
|
|
192
|
+
/** Replaces the callbacks (hooks keep them current without recreating the player). */
|
|
193
|
+
setCallbacks(callbacks: {
|
|
194
|
+
onTime?: (time: number) => void;
|
|
195
|
+
onEnd?: () => void;
|
|
196
|
+
}): void;
|
|
197
|
+
setDuration(duration: number | (() => number)): void;
|
|
198
|
+
setLoop(loop: AnimationLoopMode): void;
|
|
199
|
+
setPlaybackRate(rate: number): void;
|
|
200
|
+
/** Starts playing from the playhead (from the start again when a one-shot play had ended). */
|
|
201
|
+
play(): void;
|
|
202
|
+
pause(): void;
|
|
203
|
+
toggle(): void;
|
|
204
|
+
/** Pauses and returns to the start. */
|
|
205
|
+
stop(): void;
|
|
206
|
+
/** Moves the playhead (clamped to the timeline); playback continues from there. */
|
|
207
|
+
seek(time: number): void;
|
|
208
|
+
/** Seeks while dragging the playhead: playback pauses until `endScrub`. */
|
|
209
|
+
scrub(time: number): void;
|
|
210
|
+
/** Ends a scrub, resuming playback if it was playing when the scrub began. */
|
|
211
|
+
endScrub(): void;
|
|
212
|
+
/** Stops scheduling frames and drops listeners. */
|
|
213
|
+
destroy(): void;
|
|
214
|
+
private clamp;
|
|
215
|
+
private reanchor;
|
|
216
|
+
private rawNow;
|
|
217
|
+
private schedule;
|
|
218
|
+
/** Advances the playhead to the clock's time; `notify` emits the change. */
|
|
219
|
+
private tick;
|
|
220
|
+
private snapshot;
|
|
221
|
+
private emit;
|
|
222
|
+
}
|
|
223
|
+
declare function createAnimationPlayer(options?: AnimationPlayerOptions): AnimationPlayer;
|
|
224
|
+
|
|
225
|
+
export { ANIMATION_TIME_EPSILON as A, type Clock as C, ManualClock as M, type OklabColor as O, type AnimationKeyframe as a, type AnimationLoopMode as b, AnimationPlayer as c, type AnimationPlayerOptions as d, type AnimationPlayerState as e, type AnimationTrack as f, type AnimationValue as g, type AnimationValueType as h, createAnimationPlayer as i, evaluateTrack as j, formatOklab as k, interpolateAnimationValue as l, isAnimationKeyframe as m, mixColorsOklab as n, normalizeKeyframes as o, oklabToRgb as p, pageHidden as q, parseOklab as r, realClock as s, rgbToOklab as t, wrapAnimationTime as w };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
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
|
+
}
|
|
13
|
+
interface PresenceState {
|
|
14
|
+
actors: readonly PresenceActor[];
|
|
15
|
+
}
|
|
16
|
+
declare const PRESENCE_COLORS: readonly string[];
|
|
17
|
+
/** Cursor positions and notes of agents acting on a surface, for an overlay. */
|
|
18
|
+
declare class PresenceStore {
|
|
19
|
+
private state;
|
|
20
|
+
private readonly listeners;
|
|
21
|
+
getState: () => PresenceState;
|
|
22
|
+
subscribe: (listener: (state: PresenceState) => void) => (() => void);
|
|
23
|
+
/** The actor with `id`, if it is on the surface. */
|
|
24
|
+
get(id: string): PresenceActor | undefined;
|
|
25
|
+
/** Adds or changes an actor. */
|
|
26
|
+
set(actor: Pick<PresenceActor, 'id'> & Partial<PresenceActor>): void;
|
|
27
|
+
remove(id: string): void;
|
|
28
|
+
}
|
|
29
|
+
/** Time for performances: real timers, or an instant clock for tests and recordings. */
|
|
30
|
+
interface PresenceClock {
|
|
31
|
+
now(): number;
|
|
32
|
+
wait(ms: number): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
declare const realPresenceClock: PresenceClock;
|
|
35
|
+
/** A clock whose waits finish at once while its time still advances (repeatable performances). */
|
|
36
|
+
declare function createInstantPresenceClock(start?: number): PresenceClock & {
|
|
37
|
+
elapsed(): number;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Glides an actor's cursor from `from` to `to` over `ms` (ease-out cubic, ~60 frames a second),
|
|
41
|
+
* calling `each` with the eased progress after every frame (e.g. to drag a value along).
|
|
42
|
+
*/
|
|
43
|
+
declare function tweenPresenceCursor(presence: PresenceStore, clock: PresenceClock, id: string, from: {
|
|
44
|
+
x: number;
|
|
45
|
+
y: number;
|
|
46
|
+
}, to: {
|
|
47
|
+
x: number;
|
|
48
|
+
y: number;
|
|
49
|
+
}, ms: number, each?: (t: number) => void): Promise<void>;
|
|
50
|
+
interface PresenceActorInfo {
|
|
51
|
+
id: string;
|
|
52
|
+
name?: string;
|
|
53
|
+
color?: string;
|
|
54
|
+
}
|
|
55
|
+
interface PerformanceQueueOptions {
|
|
56
|
+
clock: PresenceClock;
|
|
57
|
+
/** Hide each actor's cursor this long after its last call (ms, default 1500; 0 keeps it). */
|
|
58
|
+
linger?: number;
|
|
59
|
+
/** Called around each call so everything it changes is one undo step. */
|
|
60
|
+
beginGesture?: (key: string) => void;
|
|
61
|
+
endGesture?: () => void;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Runs performances one after another per actor (different actors run side by side). Each
|
|
65
|
+
* call shows the actor's cursor, wraps the call in one gesture (one undo step), clears the
|
|
66
|
+
* note when it ends, and hides the cursor after `linger` unless another call followed.
|
|
67
|
+
*/
|
|
68
|
+
declare class PerformanceQueue {
|
|
69
|
+
readonly presence: PresenceStore;
|
|
70
|
+
private readonly options;
|
|
71
|
+
private readonly queues;
|
|
72
|
+
private calls;
|
|
73
|
+
constructor(presence: PresenceStore, options: PerformanceQueueOptions);
|
|
74
|
+
run<T>(actor: PresenceActorInfo, perform: () => Promise<T>): Promise<T>;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export { PRESENCE_COLORS as P, PerformanceQueue as a, type PerformanceQueueOptions as b, type PresenceActor as c, type PresenceActorInfo as d, type PresenceClock as e, type PresenceState as f, PresenceStore as g, createInstantPresenceClock as h, realPresenceClock as r, tweenPresenceCursor as t };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
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
|
+
}
|
|
13
|
+
interface PresenceState {
|
|
14
|
+
actors: readonly PresenceActor[];
|
|
15
|
+
}
|
|
16
|
+
declare const PRESENCE_COLORS: readonly string[];
|
|
17
|
+
/** Cursor positions and notes of agents acting on a surface, for an overlay. */
|
|
18
|
+
declare class PresenceStore {
|
|
19
|
+
private state;
|
|
20
|
+
private readonly listeners;
|
|
21
|
+
getState: () => PresenceState;
|
|
22
|
+
subscribe: (listener: (state: PresenceState) => void) => (() => void);
|
|
23
|
+
/** The actor with `id`, if it is on the surface. */
|
|
24
|
+
get(id: string): PresenceActor | undefined;
|
|
25
|
+
/** Adds or changes an actor. */
|
|
26
|
+
set(actor: Pick<PresenceActor, 'id'> & Partial<PresenceActor>): void;
|
|
27
|
+
remove(id: string): void;
|
|
28
|
+
}
|
|
29
|
+
/** Time for performances: real timers, or an instant clock for tests and recordings. */
|
|
30
|
+
interface PresenceClock {
|
|
31
|
+
now(): number;
|
|
32
|
+
wait(ms: number): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
declare const realPresenceClock: PresenceClock;
|
|
35
|
+
/** A clock whose waits finish at once while its time still advances (repeatable performances). */
|
|
36
|
+
declare function createInstantPresenceClock(start?: number): PresenceClock & {
|
|
37
|
+
elapsed(): number;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Glides an actor's cursor from `from` to `to` over `ms` (ease-out cubic, ~60 frames a second),
|
|
41
|
+
* calling `each` with the eased progress after every frame (e.g. to drag a value along).
|
|
42
|
+
*/
|
|
43
|
+
declare function tweenPresenceCursor(presence: PresenceStore, clock: PresenceClock, id: string, from: {
|
|
44
|
+
x: number;
|
|
45
|
+
y: number;
|
|
46
|
+
}, to: {
|
|
47
|
+
x: number;
|
|
48
|
+
y: number;
|
|
49
|
+
}, ms: number, each?: (t: number) => void): Promise<void>;
|
|
50
|
+
interface PresenceActorInfo {
|
|
51
|
+
id: string;
|
|
52
|
+
name?: string;
|
|
53
|
+
color?: string;
|
|
54
|
+
}
|
|
55
|
+
interface PerformanceQueueOptions {
|
|
56
|
+
clock: PresenceClock;
|
|
57
|
+
/** Hide each actor's cursor this long after its last call (ms, default 1500; 0 keeps it). */
|
|
58
|
+
linger?: number;
|
|
59
|
+
/** Called around each call so everything it changes is one undo step. */
|
|
60
|
+
beginGesture?: (key: string) => void;
|
|
61
|
+
endGesture?: () => void;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Runs performances one after another per actor (different actors run side by side). Each
|
|
65
|
+
* call shows the actor's cursor, wraps the call in one gesture (one undo step), clears the
|
|
66
|
+
* note when it ends, and hides the cursor after `linger` unless another call followed.
|
|
67
|
+
*/
|
|
68
|
+
declare class PerformanceQueue {
|
|
69
|
+
readonly presence: PresenceStore;
|
|
70
|
+
private readonly options;
|
|
71
|
+
private readonly queues;
|
|
72
|
+
private calls;
|
|
73
|
+
constructor(presence: PresenceStore, options: PerformanceQueueOptions);
|
|
74
|
+
run<T>(actor: PresenceActorInfo, perform: () => Promise<T>): Promise<T>;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export { PRESENCE_COLORS as P, PerformanceQueue as a, type PerformanceQueueOptions as b, type PresenceActor as c, type PresenceActorInfo as d, type PresenceClock as e, type PresenceState as f, PresenceStore as g, createInstantPresenceClock as h, realPresenceClock as r, tweenPresenceCursor as t };
|
|
@@ -168,4 +168,4 @@ declare class ToolRegistry {
|
|
|
168
168
|
}
|
|
169
169
|
declare function createToolRegistry(options?: ToolRegistryOptions): ToolRegistry;
|
|
170
170
|
|
|
171
|
-
export { type AgentToolProvider as A, type
|
|
171
|
+
export { type AgentToolProvider as A, type McpToolDefinition as M, ToolRegistry as T, type McpToolResult as a, type AgentTool as b, type AgentToolHandler as c, type McpListToolsResult as d, type McpToolContent as e, TOOL_NAMESPACE_SEPARATOR as f, type ToolCallContext as g, type ToolCallError as h, type ToolErrorCode as i, ToolRegistryError as j, type ToolRegistryOptions as k, createToolRegistry as l, toToolResult as t };
|
|
@@ -168,4 +168,4 @@ declare class ToolRegistry {
|
|
|
168
168
|
}
|
|
169
169
|
declare function createToolRegistry(options?: ToolRegistryOptions): ToolRegistry;
|
|
170
170
|
|
|
171
|
-
export { type AgentToolProvider as A, type
|
|
171
|
+
export { type AgentToolProvider as A, type McpToolDefinition as M, ToolRegistry as T, type McpToolResult as a, type AgentTool as b, type AgentToolHandler as c, type McpListToolsResult as d, type McpToolContent as e, TOOL_NAMESPACE_SEPARATOR as f, type ToolCallContext as g, type ToolCallError as h, type ToolErrorCode as i, ToolRegistryError as j, type ToolRegistryOptions as k, createToolRegistry as l, toToolResult as t };
|
package/dist/tools/index.cjs
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
|
+
var _chunkK73CKYUMcjs = require('../chunk-K73CKYUM.cjs');
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
|
|
@@ -27,7 +28,11 @@
|
|
|
27
28
|
|
|
28
29
|
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
var _chunkQIWFEEWGcjs = require('../chunk-QIWFEEWG.cjs');
|
|
31
36
|
|
|
32
37
|
|
|
33
38
|
var _chunkRIWPYSKUcjs = require('../chunk-RIWPYSKU.cjs');
|
|
@@ -61,5 +66,8 @@ var _chunkRIWPYSKUcjs = require('../chunk-RIWPYSKU.cjs');
|
|
|
61
66
|
|
|
62
67
|
|
|
63
68
|
|
|
64
|
-
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
exports.EDITOR_CANVAS_TOOLS = _chunkK73CKYUMcjs.EDITOR_CANVAS_TOOLS; exports.EDITOR_MCP_TOOLS = _chunkK73CKYUMcjs.EDITOR_MCP_TOOLS; exports.EDITOR_PROMPT_TOOLS = _chunkK73CKYUMcjs.EDITOR_PROMPT_TOOLS; exports.EDIT_OPERATION_REQUIRED_ARGUMENTS = _chunkK73CKYUMcjs.EDIT_OPERATION_REQUIRED_ARGUMENTS; exports.EXPORT_EXCLUDED_SELECTORS = _chunkK73CKYUMcjs.EXPORT_EXCLUDED_SELECTORS; exports.JSON_RPC_ERRORS = _chunkQIWFEEWGcjs.JSON_RPC_ERRORS; exports.MCP_PROTOCOL_VERSIONS = _chunkQIWFEEWGcjs.MCP_PROTOCOL_VERSIONS; exports.MCP_TOOL_CANVAS_ADD_NODE = _chunkK73CKYUMcjs.MCP_TOOL_CANVAS_ADD_NODE; exports.MCP_TOOL_CANVAS_CONNECT = _chunkK73CKYUMcjs.MCP_TOOL_CANVAS_CONNECT; exports.MCP_TOOL_CANVAS_HIGHLIGHT = _chunkK73CKYUMcjs.MCP_TOOL_CANVAS_HIGHLIGHT; exports.MCP_TOOL_CANVAS_LAYOUT = _chunkK73CKYUMcjs.MCP_TOOL_CANVAS_LAYOUT; exports.MCP_TOOL_CANVAS_REMOVE_NODES = _chunkK73CKYUMcjs.MCP_TOOL_CANVAS_REMOVE_NODES; exports.MCP_TOOL_CANVAS_SELECT = _chunkK73CKYUMcjs.MCP_TOOL_CANVAS_SELECT; exports.MCP_TOOL_CANVAS_UPDATE_NODE = _chunkK73CKYUMcjs.MCP_TOOL_CANVAS_UPDATE_NODE; exports.MCP_TOOL_EDIT_CANVAS = _chunkK73CKYUMcjs.MCP_TOOL_EDIT_CANVAS; exports.MCP_TOOL_EDIT_PROMPT = _chunkK73CKYUMcjs.MCP_TOOL_EDIT_PROMPT; exports.MCP_TOOL_GET_EDITOR_STATE = _chunkK73CKYUMcjs.MCP_TOOL_GET_EDITOR_STATE; exports.MCP_TOOL_PROMPT_INSERT_TEXT = _chunkK73CKYUMcjs.MCP_TOOL_PROMPT_INSERT_TEXT; exports.MCP_TOOL_PROMPT_REPLACE_RANGE = _chunkK73CKYUMcjs.MCP_TOOL_PROMPT_REPLACE_RANGE; exports.MCP_TOOL_PROMPT_SELECT = _chunkK73CKYUMcjs.MCP_TOOL_PROMPT_SELECT; exports.MCP_TOOL_PROMPT_SET_VARIABLE = _chunkK73CKYUMcjs.MCP_TOOL_PROMPT_SET_VARIABLE; exports.MCP_TOOL_VIEW_EDITOR = _chunkK73CKYUMcjs.MCP_TOOL_VIEW_EDITOR; exports.TOOL_BRIDGE_DEFAULT_PORT = _chunkQIWFEEWGcjs.TOOL_BRIDGE_DEFAULT_PORT; exports.TOOL_BRIDGE_PROTOCOL = _chunkQIWFEEWGcjs.TOOL_BRIDGE_PROTOCOL; exports.TOOL_NAMESPACE_SEPARATOR = _chunkQIWFEEWGcjs.TOOL_NAMESPACE_SEPARATOR; exports.ToolRegistry = _chunkQIWFEEWGcjs.ToolRegistry; exports.ToolRegistryError = _chunkQIWFEEWGcjs.ToolRegistryError; exports.connectToolBridge = _chunkQIWFEEWGcjs.connectToolBridge; exports.createMcpServer = _chunkQIWFEEWGcjs.createMcpServer; exports.createToolRegistry = _chunkQIWFEEWGcjs.createToolRegistry; exports.toToolResult = _chunkQIWFEEWGcjs.toToolResult; exports.validateJsonSchema = _chunkRIWPYSKUcjs.validateJsonSchema;
|
|
65
73
|
//# sourceMappingURL=index.cjs.map
|
package/dist/tools/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/editor/editor/packages/core/dist/tools/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/editor/editor/packages/core/dist/tools/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,6zEAAC","file":"/home/runner/work/editor/editor/packages/core/dist/tools/index.cjs"}
|
package/dist/tools/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { J as JsonSchema, a as JsonSchemaType, S as SchemaValidationError, v as validateJsonSchema } from '../schema-Di0CS6Pe.cjs';
|
|
2
|
-
|
|
3
|
-
export {
|
|
2
|
+
export { b as AgentTool, c as AgentToolHandler, A as AgentToolProvider, d as McpListToolsResult, e as McpToolContent, M as McpToolDefinition, a as McpToolResult, f as TOOL_NAMESPACE_SEPARATOR, g as ToolCallContext, h as ToolCallError, i as ToolErrorCode, T as ToolRegistry, j as ToolRegistryError, k as ToolRegistryOptions, l as createToolRegistry, t as toToolResult } from '../registry-DIpIaCkH.cjs';
|
|
3
|
+
export { C as ConnectToolBridgeOptions, J as JSON_RPC_ERRORS, b as JsonRpcId, c as JsonRpcNotification, d as JsonRpcRequest, e as JsonRpcResponse, f as MCP_PROTOCOL_VERSIONS, M as McpServer, g as McpServerOptions, T as TOOL_BRIDGE_DEFAULT_PORT, a as TOOL_BRIDGE_PROTOCOL, h as ToolBridgeConnection, i as ToolBridgeEditorMessage, j as ToolBridgeServerMessage, k as ToolBridgeSocket, l as ToolBridgeStatus, m as connectToolBridge, n as createMcpServer } from '../bridge-client-C5OziCRK.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Standard MCP Tool Definitions for @pixerate/editor.
|
|
@@ -1129,75 +1129,4 @@ declare const EDITOR_MCP_TOOLS: readonly [{
|
|
|
1129
1129
|
};
|
|
1130
1130
|
}];
|
|
1131
1131
|
|
|
1132
|
-
|
|
1133
|
-
declare const MCP_PROTOCOL_VERSIONS: readonly ["2025-06-18", "2025-03-26", "2024-11-05"];
|
|
1134
|
-
type JsonRpcId = string | number;
|
|
1135
|
-
interface JsonRpcRequest {
|
|
1136
|
-
jsonrpc: '2.0';
|
|
1137
|
-
id?: JsonRpcId | null;
|
|
1138
|
-
method: string;
|
|
1139
|
-
params?: Record<string, any>;
|
|
1140
|
-
}
|
|
1141
|
-
interface JsonRpcResponse {
|
|
1142
|
-
jsonrpc: '2.0';
|
|
1143
|
-
id: JsonRpcId | null;
|
|
1144
|
-
result?: unknown;
|
|
1145
|
-
error?: {
|
|
1146
|
-
code: number;
|
|
1147
|
-
message: string;
|
|
1148
|
-
data?: unknown;
|
|
1149
|
-
};
|
|
1150
|
-
}
|
|
1151
|
-
interface JsonRpcNotification {
|
|
1152
|
-
jsonrpc: '2.0';
|
|
1153
|
-
method: string;
|
|
1154
|
-
params?: Record<string, unknown>;
|
|
1155
|
-
}
|
|
1156
|
-
/** Standard JSON-RPC error codes used by the server. */
|
|
1157
|
-
declare const JSON_RPC_ERRORS: {
|
|
1158
|
-
readonly parseError: -32700;
|
|
1159
|
-
readonly invalidRequest: -32600;
|
|
1160
|
-
readonly methodNotFound: -32601;
|
|
1161
|
-
readonly invalidParams: -32602;
|
|
1162
|
-
readonly internalError: -32603;
|
|
1163
|
-
};
|
|
1164
|
-
interface McpServerOptions {
|
|
1165
|
-
/** `serverInfo` sent in the `initialize` result. */
|
|
1166
|
-
name: string;
|
|
1167
|
-
version: string;
|
|
1168
|
-
title?: string;
|
|
1169
|
-
/** Usage hints for the client's model, sent in the `initialize` result. */
|
|
1170
|
-
instructions?: string;
|
|
1171
|
-
/**
|
|
1172
|
-
* Sends server → client messages (`notifications/tools/list_changed`).
|
|
1173
|
-
* Without it the server still answers requests but announces nothing.
|
|
1174
|
-
*/
|
|
1175
|
-
send?: (message: JsonRpcNotification) => void;
|
|
1176
|
-
}
|
|
1177
|
-
interface McpServer {
|
|
1178
|
-
/**
|
|
1179
|
-
* Handles one client message (a JSON string or a parsed object) and
|
|
1180
|
-
* resolves to the response to send back, or `null` for notifications.
|
|
1181
|
-
* Never rejects.
|
|
1182
|
-
*/
|
|
1183
|
-
handle(message: string | JsonRpcRequest): Promise<JsonRpcResponse | null>;
|
|
1184
|
-
/** Whether the client has completed the `initialize` handshake. */
|
|
1185
|
-
readonly initialized: boolean;
|
|
1186
|
-
/** Stops list-changed notifications and aborts running tool calls. */
|
|
1187
|
-
close(): void;
|
|
1188
|
-
}
|
|
1189
|
-
/**
|
|
1190
|
-
* A transport-agnostic MCP server for a {@link ToolRegistry}: wire `handle`
|
|
1191
|
-
* to any transport (stdio lines, a WebSocket, `postMessage`, an HTTP POST
|
|
1192
|
-
* handler) and pass `send` for server → client notifications.
|
|
1193
|
-
*
|
|
1194
|
-
* Supports `initialize` (with protocol version negotiation), `ping`,
|
|
1195
|
-
* `tools/list`, `tools/call` and `notifications/cancelled` (aborts the
|
|
1196
|
-
* call's `signal`), and announces `notifications/tools/list_changed` after
|
|
1197
|
-
* the client sends `notifications/initialized`. An unknown tool is a
|
|
1198
|
-
* JSON-RPC `-32602` error, as the MCP spec asks; invalid arguments and
|
|
1199
|
-
* handler failures are `isError` tool results the model can read and fix.
|
|
1200
|
-
*/
|
|
1201
|
-
declare function createMcpServer(registry: ToolRegistry, options: McpServerOptions): McpServer;
|
|
1202
|
-
|
|
1203
|
-
export { EDITOR_CANVAS_TOOLS, EDITOR_MCP_TOOLS, EDITOR_PROMPT_TOOLS, EDIT_OPERATION_REQUIRED_ARGUMENTS, EXPORT_EXCLUDED_SELECTORS, JSON_RPC_ERRORS, type JsonRpcId, type JsonRpcNotification, type JsonRpcRequest, type JsonRpcResponse, MCP_PROTOCOL_VERSIONS, MCP_TOOL_CANVAS_ADD_NODE, MCP_TOOL_CANVAS_CONNECT, MCP_TOOL_CANVAS_HIGHLIGHT, MCP_TOOL_CANVAS_LAYOUT, MCP_TOOL_CANVAS_REMOVE_NODES, MCP_TOOL_CANVAS_SELECT, MCP_TOOL_CANVAS_UPDATE_NODE, MCP_TOOL_EDIT_CANVAS, MCP_TOOL_EDIT_PROMPT, MCP_TOOL_GET_EDITOR_STATE, MCP_TOOL_PROMPT_INSERT_TEXT, MCP_TOOL_PROMPT_REPLACE_RANGE, MCP_TOOL_PROMPT_SELECT, MCP_TOOL_PROMPT_SET_VARIABLE, MCP_TOOL_VIEW_EDITOR, type McpServer, type McpServerOptions, ToolRegistry, createMcpServer };
|
|
1132
|
+
export { EDITOR_CANVAS_TOOLS, EDITOR_MCP_TOOLS, EDITOR_PROMPT_TOOLS, EDIT_OPERATION_REQUIRED_ARGUMENTS, EXPORT_EXCLUDED_SELECTORS, MCP_TOOL_CANVAS_ADD_NODE, MCP_TOOL_CANVAS_CONNECT, MCP_TOOL_CANVAS_HIGHLIGHT, MCP_TOOL_CANVAS_LAYOUT, MCP_TOOL_CANVAS_REMOVE_NODES, MCP_TOOL_CANVAS_SELECT, MCP_TOOL_CANVAS_UPDATE_NODE, MCP_TOOL_EDIT_CANVAS, MCP_TOOL_EDIT_PROMPT, MCP_TOOL_GET_EDITOR_STATE, MCP_TOOL_PROMPT_INSERT_TEXT, MCP_TOOL_PROMPT_REPLACE_RANGE, MCP_TOOL_PROMPT_SELECT, MCP_TOOL_PROMPT_SET_VARIABLE, MCP_TOOL_VIEW_EDITOR };
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { J as JsonSchema, a as JsonSchemaType, S as SchemaValidationError, v as validateJsonSchema } from '../schema-Di0CS6Pe.js';
|
|
2
|
-
|
|
3
|
-
export {
|
|
2
|
+
export { b as AgentTool, c as AgentToolHandler, A as AgentToolProvider, d as McpListToolsResult, e as McpToolContent, M as McpToolDefinition, a as McpToolResult, f as TOOL_NAMESPACE_SEPARATOR, g as ToolCallContext, h as ToolCallError, i as ToolErrorCode, T as ToolRegistry, j as ToolRegistryError, k as ToolRegistryOptions, l as createToolRegistry, t as toToolResult } from '../registry-7AZFuand.js';
|
|
3
|
+
export { C as ConnectToolBridgeOptions, J as JSON_RPC_ERRORS, b as JsonRpcId, c as JsonRpcNotification, d as JsonRpcRequest, e as JsonRpcResponse, f as MCP_PROTOCOL_VERSIONS, M as McpServer, g as McpServerOptions, T as TOOL_BRIDGE_DEFAULT_PORT, a as TOOL_BRIDGE_PROTOCOL, h as ToolBridgeConnection, i as ToolBridgeEditorMessage, j as ToolBridgeServerMessage, k as ToolBridgeSocket, l as ToolBridgeStatus, m as connectToolBridge, n as createMcpServer } from '../bridge-client-C5dRjrz5.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Standard MCP Tool Definitions for @pixerate/editor.
|
|
@@ -1129,75 +1129,4 @@ declare const EDITOR_MCP_TOOLS: readonly [{
|
|
|
1129
1129
|
};
|
|
1130
1130
|
}];
|
|
1131
1131
|
|
|
1132
|
-
|
|
1133
|
-
declare const MCP_PROTOCOL_VERSIONS: readonly ["2025-06-18", "2025-03-26", "2024-11-05"];
|
|
1134
|
-
type JsonRpcId = string | number;
|
|
1135
|
-
interface JsonRpcRequest {
|
|
1136
|
-
jsonrpc: '2.0';
|
|
1137
|
-
id?: JsonRpcId | null;
|
|
1138
|
-
method: string;
|
|
1139
|
-
params?: Record<string, any>;
|
|
1140
|
-
}
|
|
1141
|
-
interface JsonRpcResponse {
|
|
1142
|
-
jsonrpc: '2.0';
|
|
1143
|
-
id: JsonRpcId | null;
|
|
1144
|
-
result?: unknown;
|
|
1145
|
-
error?: {
|
|
1146
|
-
code: number;
|
|
1147
|
-
message: string;
|
|
1148
|
-
data?: unknown;
|
|
1149
|
-
};
|
|
1150
|
-
}
|
|
1151
|
-
interface JsonRpcNotification {
|
|
1152
|
-
jsonrpc: '2.0';
|
|
1153
|
-
method: string;
|
|
1154
|
-
params?: Record<string, unknown>;
|
|
1155
|
-
}
|
|
1156
|
-
/** Standard JSON-RPC error codes used by the server. */
|
|
1157
|
-
declare const JSON_RPC_ERRORS: {
|
|
1158
|
-
readonly parseError: -32700;
|
|
1159
|
-
readonly invalidRequest: -32600;
|
|
1160
|
-
readonly methodNotFound: -32601;
|
|
1161
|
-
readonly invalidParams: -32602;
|
|
1162
|
-
readonly internalError: -32603;
|
|
1163
|
-
};
|
|
1164
|
-
interface McpServerOptions {
|
|
1165
|
-
/** `serverInfo` sent in the `initialize` result. */
|
|
1166
|
-
name: string;
|
|
1167
|
-
version: string;
|
|
1168
|
-
title?: string;
|
|
1169
|
-
/** Usage hints for the client's model, sent in the `initialize` result. */
|
|
1170
|
-
instructions?: string;
|
|
1171
|
-
/**
|
|
1172
|
-
* Sends server → client messages (`notifications/tools/list_changed`).
|
|
1173
|
-
* Without it the server still answers requests but announces nothing.
|
|
1174
|
-
*/
|
|
1175
|
-
send?: (message: JsonRpcNotification) => void;
|
|
1176
|
-
}
|
|
1177
|
-
interface McpServer {
|
|
1178
|
-
/**
|
|
1179
|
-
* Handles one client message (a JSON string or a parsed object) and
|
|
1180
|
-
* resolves to the response to send back, or `null` for notifications.
|
|
1181
|
-
* Never rejects.
|
|
1182
|
-
*/
|
|
1183
|
-
handle(message: string | JsonRpcRequest): Promise<JsonRpcResponse | null>;
|
|
1184
|
-
/** Whether the client has completed the `initialize` handshake. */
|
|
1185
|
-
readonly initialized: boolean;
|
|
1186
|
-
/** Stops list-changed notifications and aborts running tool calls. */
|
|
1187
|
-
close(): void;
|
|
1188
|
-
}
|
|
1189
|
-
/**
|
|
1190
|
-
* A transport-agnostic MCP server for a {@link ToolRegistry}: wire `handle`
|
|
1191
|
-
* to any transport (stdio lines, a WebSocket, `postMessage`, an HTTP POST
|
|
1192
|
-
* handler) and pass `send` for server → client notifications.
|
|
1193
|
-
*
|
|
1194
|
-
* Supports `initialize` (with protocol version negotiation), `ping`,
|
|
1195
|
-
* `tools/list`, `tools/call` and `notifications/cancelled` (aborts the
|
|
1196
|
-
* call's `signal`), and announces `notifications/tools/list_changed` after
|
|
1197
|
-
* the client sends `notifications/initialized`. An unknown tool is a
|
|
1198
|
-
* JSON-RPC `-32602` error, as the MCP spec asks; invalid arguments and
|
|
1199
|
-
* handler failures are `isError` tool results the model can read and fix.
|
|
1200
|
-
*/
|
|
1201
|
-
declare function createMcpServer(registry: ToolRegistry, options: McpServerOptions): McpServer;
|
|
1202
|
-
|
|
1203
|
-
export { EDITOR_CANVAS_TOOLS, EDITOR_MCP_TOOLS, EDITOR_PROMPT_TOOLS, EDIT_OPERATION_REQUIRED_ARGUMENTS, EXPORT_EXCLUDED_SELECTORS, JSON_RPC_ERRORS, type JsonRpcId, type JsonRpcNotification, type JsonRpcRequest, type JsonRpcResponse, MCP_PROTOCOL_VERSIONS, MCP_TOOL_CANVAS_ADD_NODE, MCP_TOOL_CANVAS_CONNECT, MCP_TOOL_CANVAS_HIGHLIGHT, MCP_TOOL_CANVAS_LAYOUT, MCP_TOOL_CANVAS_REMOVE_NODES, MCP_TOOL_CANVAS_SELECT, MCP_TOOL_CANVAS_UPDATE_NODE, MCP_TOOL_EDIT_CANVAS, MCP_TOOL_EDIT_PROMPT, MCP_TOOL_GET_EDITOR_STATE, MCP_TOOL_PROMPT_INSERT_TEXT, MCP_TOOL_PROMPT_REPLACE_RANGE, MCP_TOOL_PROMPT_SELECT, MCP_TOOL_PROMPT_SET_VARIABLE, MCP_TOOL_VIEW_EDITOR, type McpServer, type McpServerOptions, ToolRegistry, createMcpServer };
|
|
1132
|
+
export { EDITOR_CANVAS_TOOLS, EDITOR_MCP_TOOLS, EDITOR_PROMPT_TOOLS, EDIT_OPERATION_REQUIRED_ARGUMENTS, EXPORT_EXCLUDED_SELECTORS, MCP_TOOL_CANVAS_ADD_NODE, MCP_TOOL_CANVAS_CONNECT, MCP_TOOL_CANVAS_HIGHLIGHT, MCP_TOOL_CANVAS_LAYOUT, MCP_TOOL_CANVAS_REMOVE_NODES, MCP_TOOL_CANVAS_SELECT, MCP_TOOL_CANVAS_UPDATE_NODE, MCP_TOOL_EDIT_CANVAS, MCP_TOOL_EDIT_PROMPT, MCP_TOOL_GET_EDITOR_STATE, MCP_TOOL_PROMPT_INSERT_TEXT, MCP_TOOL_PROMPT_REPLACE_RANGE, MCP_TOOL_PROMPT_SELECT, MCP_TOOL_PROMPT_SET_VARIABLE, MCP_TOOL_VIEW_EDITOR };
|
package/dist/tools/index.js
CHANGED
|
@@ -4,8 +4,6 @@ import {
|
|
|
4
4
|
EDITOR_PROMPT_TOOLS,
|
|
5
5
|
EDIT_OPERATION_REQUIRED_ARGUMENTS,
|
|
6
6
|
EXPORT_EXCLUDED_SELECTORS,
|
|
7
|
-
JSON_RPC_ERRORS,
|
|
8
|
-
MCP_PROTOCOL_VERSIONS,
|
|
9
7
|
MCP_TOOL_CANVAS_ADD_NODE,
|
|
10
8
|
MCP_TOOL_CANVAS_CONNECT,
|
|
11
9
|
MCP_TOOL_CANVAS_HIGHLIGHT,
|
|
@@ -20,14 +18,21 @@ import {
|
|
|
20
18
|
MCP_TOOL_PROMPT_REPLACE_RANGE,
|
|
21
19
|
MCP_TOOL_PROMPT_SELECT,
|
|
22
20
|
MCP_TOOL_PROMPT_SET_VARIABLE,
|
|
23
|
-
MCP_TOOL_VIEW_EDITOR
|
|
21
|
+
MCP_TOOL_VIEW_EDITOR
|
|
22
|
+
} from "../chunk-GPWNYQ7R.js";
|
|
23
|
+
import {
|
|
24
|
+
JSON_RPC_ERRORS,
|
|
25
|
+
MCP_PROTOCOL_VERSIONS,
|
|
26
|
+
TOOL_BRIDGE_DEFAULT_PORT,
|
|
27
|
+
TOOL_BRIDGE_PROTOCOL,
|
|
24
28
|
TOOL_NAMESPACE_SEPARATOR,
|
|
25
29
|
ToolRegistry,
|
|
26
30
|
ToolRegistryError,
|
|
31
|
+
connectToolBridge,
|
|
27
32
|
createMcpServer,
|
|
28
33
|
createToolRegistry,
|
|
29
34
|
toToolResult
|
|
30
|
-
} from "../chunk-
|
|
35
|
+
} from "../chunk-PTMIGXZ2.js";
|
|
31
36
|
import {
|
|
32
37
|
validateJsonSchema
|
|
33
38
|
} from "../chunk-4FX5ACVG.js";
|
|
@@ -54,9 +59,12 @@ export {
|
|
|
54
59
|
MCP_TOOL_PROMPT_SELECT,
|
|
55
60
|
MCP_TOOL_PROMPT_SET_VARIABLE,
|
|
56
61
|
MCP_TOOL_VIEW_EDITOR,
|
|
62
|
+
TOOL_BRIDGE_DEFAULT_PORT,
|
|
63
|
+
TOOL_BRIDGE_PROTOCOL,
|
|
57
64
|
TOOL_NAMESPACE_SEPARATOR,
|
|
58
65
|
ToolRegistry,
|
|
59
66
|
ToolRegistryError,
|
|
67
|
+
connectToolBridge,
|
|
60
68
|
createMcpServer,
|
|
61
69
|
createToolRegistry,
|
|
62
70
|
toToolResult,
|