@pixerate/editor 0.140.4 → 0.141.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/canvasPlayback.d.cts +15 -0
- package/dist/agent/canvasPlayback.d.ts +15 -0
- package/dist/agent/index.cjs +144 -23
- package/dist/agent/index.d.cts +1 -0
- package/dist/agent/index.d.ts +1 -0
- package/dist/agent/index.js +125 -4
- package/dist/agent/providers.d.cts +8 -0
- package/dist/agent/providers.d.ts +8 -0
- 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/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 +7 -7
- package/dist/chart/index.js +1 -1
- package/dist/chunk-6SFREX6H.cjs +406 -0
- 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-MFFE55CS.js +406 -0
- package/dist/{chunk-BSGPXPTW.js → chunk-PEEP2YR7.js} +1 -1
- 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-HDK3T2QS.cjs → chunk-Y4BWZB6J.cjs} +29 -7
- 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/paint-editor/index.cjs +6 -6
- package/dist/paint-editor/index.js +1 -1
- package/dist/tools/index.cjs +33 -3
- package/dist/tools/index.d.cts +2 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.js +32 -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/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/package.json +1 -1
- package/skills/pixerate-agent-tools/SKILL.md +13 -0
- package/skills/pixerate-canvas/SKILL.md +3 -0
- package/skills/pixerate-image-editor/SKILL.md +2 -2
- package/skills/pixerate-vector/SKILL.md +5 -0
- package/dist/chunk-BTZS3KZY.js +0 -221
- package/dist/chunk-MRD3NXKR.cjs +0 -221
- /package/dist/{chunk-K73HMKQP.js → chunk-PLKIYNJZ.js} +0 -0
- /package/dist/{chunk-LACYURUW.cjs → chunk-TNCWKC5M.cjs} +0 -0
|
@@ -9221,6 +9221,93 @@ var DEPTH_MASK_CONTROLS = [
|
|
|
9221
9221
|
}
|
|
9222
9222
|
];
|
|
9223
9223
|
|
|
9224
|
+
// src/image-editor/playback.ts
|
|
9225
|
+
var IMAGE_PLAYBACK_KIND = "layer";
|
|
9226
|
+
var PAINT = /^(paint_stroke|clone_stamp|heal_brush|spot_heal|dodge|burn|sponge|smudge|blur_stroke|sharpen_stroke|history_brush|set_clone_source|set_clone_transform|fill_pixels|clear_pixels|set_paint|set_retouch_options|load_mixer_brush|clean_mixer_brush)$/;
|
|
9227
|
+
var SELECT = /^(select_region|select_by_color|modify_selection|refine_selection|transform_selection|apply_selection_as_mask|layer_via_copy)$/;
|
|
9228
|
+
var ANNOTATE = /^(add_shape_layer|update_shape|add_shape_component|set_shape_component|remove_shape_component|merge_shape_components|add_text_layer|set_text|set_text_style|set_paragraph_style|set_text_frame|convert_text_to_shape)$/;
|
|
9229
|
+
var CROP = /^(set_crop|reset_crop|set_rotation|flip_image|transform_layer|warp_layer|flip_layer|offset_layer)$/;
|
|
9230
|
+
var ADJUST = /^(set_adjustments|add_adjustment_layer|update_adjustment_layer|remove_adjustment_layer|move_adjustment_layer)$/;
|
|
9231
|
+
function imagePlaybackPanel(tool) {
|
|
9232
|
+
if (ADJUST.test(tool)) return "adjust";
|
|
9233
|
+
if (PAINT.test(tool)) return "paint";
|
|
9234
|
+
if (SELECT.test(tool)) return "select";
|
|
9235
|
+
if (ANNOTATE.test(tool)) return "annotate";
|
|
9236
|
+
if (CROP.test(tool)) return "crop";
|
|
9237
|
+
if (/layer|effect|filter|smart|group|mask|merge|flatten|profile|colors|proof|light/.test(tool)) return "layers";
|
|
9238
|
+
return null;
|
|
9239
|
+
}
|
|
9240
|
+
function createImagePlaybackLocator(controller) {
|
|
9241
|
+
return (ref) => {
|
|
9242
|
+
if (ref.kind !== IMAGE_PLAYBACK_KIND && ref.kind !== "item") return null;
|
|
9243
|
+
const b = controller.getLayerBounds(ref.id);
|
|
9244
|
+
return b && b.width > 0 && b.height > 0 ? { x: b.x, y: b.y, width: b.width, height: b.height } : null;
|
|
9245
|
+
};
|
|
9246
|
+
}
|
|
9247
|
+
var num = (v) => typeof v === "number" && Number.isFinite(v);
|
|
9248
|
+
var isPoint = (p) => !!p && typeof p === "object" && num(p.x) && num(p.y);
|
|
9249
|
+
function trace(points, max = 32) {
|
|
9250
|
+
const list = points.length <= max ? points : Array.from({ length: max }, (_, i) => points[Math.round(i * (points.length - 1) / (max - 1))]);
|
|
9251
|
+
if (!list.length) return [];
|
|
9252
|
+
if (list.length === 1) return [{ type: "move", to: list[0] }, { type: "press" }, { type: "release" }];
|
|
9253
|
+
let total = 0;
|
|
9254
|
+
for (let i = 1; i < list.length; i++) total += Math.hypot(list[i].x - list[i - 1].x, list[i].y - list[i - 1].y);
|
|
9255
|
+
const ms = (i) => total > 0 ? Math.max(16, 900 * Math.hypot(list[i].x - list[i - 1].x, list[i].y - list[i - 1].y) / total) : 16;
|
|
9256
|
+
return [
|
|
9257
|
+
{ type: "move", to: list[0] },
|
|
9258
|
+
{ type: "press" },
|
|
9259
|
+
...list.slice(1).map((to, i) => ({ type: "drag", to, ms: ms(i + 1) })),
|
|
9260
|
+
{ type: "release" }
|
|
9261
|
+
];
|
|
9262
|
+
}
|
|
9263
|
+
function boxOf(args) {
|
|
9264
|
+
for (const o of [args, args.shape, args.box, args.rect, args.bounds]) {
|
|
9265
|
+
if (!o || typeof o !== "object") continue;
|
|
9266
|
+
if ([o.x, o.y, o.width, o.height].every(num)) return { from: { x: o.x, y: o.y }, to: { x: o.x + o.width, y: o.y + o.height } };
|
|
9267
|
+
if ([o.x1, o.y1, o.x2, o.y2].every(num)) return { from: { x: o.x1, y: o.y1 }, to: { x: o.x2, y: o.y2 } };
|
|
9268
|
+
}
|
|
9269
|
+
return null;
|
|
9270
|
+
}
|
|
9271
|
+
function layersOf(args) {
|
|
9272
|
+
const out = [];
|
|
9273
|
+
const add2 = (v) => typeof v === "string" && v && !out.includes(v) && out.push(v);
|
|
9274
|
+
add2(args.layerId);
|
|
9275
|
+
add2(args.id);
|
|
9276
|
+
add2(args.target);
|
|
9277
|
+
for (const key of ["ids", "layerIds"]) if (Array.isArray(args[key])) args[key].forEach(add2);
|
|
9278
|
+
return out.slice(0, 6);
|
|
9279
|
+
}
|
|
9280
|
+
function planImageToolPlayback(tool, args) {
|
|
9281
|
+
const steps = [];
|
|
9282
|
+
const panel = imagePlaybackPanel(tool);
|
|
9283
|
+
if (panel) steps.push({ type: "open", ref: { kind: "panel", id: panel } });
|
|
9284
|
+
const points = Array.isArray(args.points) ? args.points.filter(isPoint) : [];
|
|
9285
|
+
const box = boxOf(args);
|
|
9286
|
+
if (points.length) steps.push(...trace(points));
|
|
9287
|
+
else if (box) steps.push({ type: "move", to: box.from }, { type: "press" }, { type: "drag", to: box.to }, { type: "release" });
|
|
9288
|
+
else if (num(args.x) && num(args.y)) steps.push({ type: "move", to: { x: args.x, y: args.y } }, { type: "press" }, { type: "release" });
|
|
9289
|
+
else if (tool === "set_adjustments" && args.values && typeof args.values === "object") {
|
|
9290
|
+
for (const key of Object.keys(args.values).slice(0, 4)) {
|
|
9291
|
+
const m = /^layers\.([^.]+)\.(.+)$/.exec(key);
|
|
9292
|
+
steps.push({ type: "target", ref: m ? { kind: "control", id: m[2] } : { kind: "control", id: key } });
|
|
9293
|
+
}
|
|
9294
|
+
} else for (const id of layersOf(args)) steps.push({ type: "target", ref: { kind: IMAGE_PLAYBACK_KIND, id } });
|
|
9295
|
+
if (typeof args.text === "string" && args.text.trim()) {
|
|
9296
|
+
const line = args.text.replace(/\s+/g, " ").trim();
|
|
9297
|
+
steps.push({ type: "type", text: line.length > 60 ? `${line.slice(0, 59)}\u2026` : line });
|
|
9298
|
+
}
|
|
9299
|
+
return steps.length ? steps : null;
|
|
9300
|
+
}
|
|
9301
|
+
function withImagePlayback(provider, surface = "image") {
|
|
9302
|
+
const plan = (tool) => tool.plan || tool.playback !== void 0 ? tool : { ...tool, plan: (args) => planImageToolPlayback(tool.name, args) };
|
|
9303
|
+
const tools = provider.tools;
|
|
9304
|
+
return {
|
|
9305
|
+
...provider,
|
|
9306
|
+
playbackSurface: provider.playbackSurface ?? surface,
|
|
9307
|
+
tools: typeof tools === "function" ? () => tools().map(plan) : tools.map(plan)
|
|
9308
|
+
};
|
|
9309
|
+
}
|
|
9310
|
+
|
|
9224
9311
|
// src/image-editor/selection/tool-options.ts
|
|
9225
9312
|
var SELECTION_TOOLS = [
|
|
9226
9313
|
{ id: "wand", label: "Magic Wand" },
|
|
@@ -9271,7 +9358,7 @@ var modeSchema = {
|
|
|
9271
9358
|
enum: [...SELECTION_MODES],
|
|
9272
9359
|
description: "How the result combines with the current selection (default replace)."
|
|
9273
9360
|
};
|
|
9274
|
-
var
|
|
9361
|
+
var num2 = (v, d) => typeof v === "number" && Number.isFinite(v) ? v : d;
|
|
9275
9362
|
function summary(controller) {
|
|
9276
9363
|
const sel = controller.getSelection();
|
|
9277
9364
|
const { width, height } = controller.getState().imageDimensions;
|
|
@@ -9321,7 +9408,7 @@ function createImageSelectionTools(controller) {
|
|
|
9321
9408
|
},
|
|
9322
9409
|
annotations: writeAnnotations("Select a region", true),
|
|
9323
9410
|
handler: ({ shape, x, y, width, height, mode, feather }) => {
|
|
9324
|
-
const opts = { mode: parseSelectionMode(mode), feather:
|
|
9411
|
+
const opts = { mode: parseSelectionMode(mode), feather: num2(feather, 0) };
|
|
9325
9412
|
switch (shape) {
|
|
9326
9413
|
case "all":
|
|
9327
9414
|
controller.selectAll();
|
|
@@ -9334,7 +9421,7 @@ function createImageSelectionTools(controller) {
|
|
|
9334
9421
|
break;
|
|
9335
9422
|
case "rect":
|
|
9336
9423
|
case "ellipse": {
|
|
9337
|
-
const rect = { x:
|
|
9424
|
+
const rect = { x: num2(x, NaN), y: num2(y, NaN), width: num2(width, NaN), height: num2(height, NaN) };
|
|
9338
9425
|
if (![rect.x, rect.y, rect.width, rect.height].every(Number.isFinite)) {
|
|
9339
9426
|
throw new Error("rect and ellipse need numeric x, y, width and height.");
|
|
9340
9427
|
}
|
|
@@ -9379,9 +9466,9 @@ function createImageSelectionTools(controller) {
|
|
|
9379
9466
|
sample: sample ?? "composite"
|
|
9380
9467
|
};
|
|
9381
9468
|
if (typeof color === "string") {
|
|
9382
|
-
await controller.selectColorRange([{ color }], { ...common, fuzziness:
|
|
9469
|
+
await controller.selectColorRange([{ color }], { ...common, fuzziness: num2(fuzziness, 40) });
|
|
9383
9470
|
} else if (typeof x === "number" && typeof y === "number") {
|
|
9384
|
-
await controller.magicWand({ x, y }, { ...common, tolerance:
|
|
9471
|
+
await controller.magicWand({ x, y }, { ...common, tolerance: num2(tolerance, 32), contiguous: contiguous !== false });
|
|
9385
9472
|
} else {
|
|
9386
9473
|
throw new Error("Pass x and y (magic wand) or color (#rrggbb).");
|
|
9387
9474
|
}
|
|
@@ -9405,7 +9492,7 @@ function createImageSelectionTools(controller) {
|
|
|
9405
9492
|
handler: ({ op, radius }) => {
|
|
9406
9493
|
if (!SELECTION_MODIFY_OPS.includes(op)) throw new Error(`Unknown op "${String(op)}".`);
|
|
9407
9494
|
if (!controller.getSelection()) throw new Error("Nothing is selected.");
|
|
9408
|
-
controller.modifySelection(op, Math.min(500, Math.max(0,
|
|
9495
|
+
controller.modifySelection(op, Math.min(500, Math.max(0, num2(radius, 0))));
|
|
9409
9496
|
return summary(controller);
|
|
9410
9497
|
}
|
|
9411
9498
|
};
|
|
@@ -9429,12 +9516,12 @@ function createImageSelectionTools(controller) {
|
|
|
9429
9516
|
handler: async (params) => {
|
|
9430
9517
|
if (!controller.getSelection()) throw new Error("Nothing is selected.");
|
|
9431
9518
|
await controller.refineSelection({
|
|
9432
|
-
radius:
|
|
9519
|
+
radius: num2(params.radius, 8),
|
|
9433
9520
|
smartRadius: params.smartRadius === true,
|
|
9434
|
-
smooth:
|
|
9435
|
-
feather:
|
|
9436
|
-
contrast:
|
|
9437
|
-
shiftEdge:
|
|
9521
|
+
smooth: num2(params.smooth, 0),
|
|
9522
|
+
feather: num2(params.feather, 0),
|
|
9523
|
+
contrast: num2(params.contrast, 0),
|
|
9524
|
+
shiftEdge: num2(params.shiftEdge, 0)
|
|
9438
9525
|
});
|
|
9439
9526
|
return summary(controller);
|
|
9440
9527
|
}
|
|
@@ -13159,7 +13246,7 @@ function createImageEditorToolProvider(controller, options = {}) {
|
|
|
13159
13246
|
};
|
|
13160
13247
|
}
|
|
13161
13248
|
};
|
|
13162
|
-
return {
|
|
13249
|
+
return withImagePlayback({
|
|
13163
13250
|
id: options.id ?? "image-editor",
|
|
13164
13251
|
namespace: options.namespace,
|
|
13165
13252
|
title: "Image editor",
|
|
@@ -13186,7 +13273,7 @@ function createImageEditorToolProvider(controller, options = {}) {
|
|
|
13186
13273
|
...createPigmentTools(),
|
|
13187
13274
|
...createImagePsdTools(controller)
|
|
13188
13275
|
]
|
|
13189
|
-
};
|
|
13276
|
+
});
|
|
13190
13277
|
}
|
|
13191
13278
|
|
|
13192
13279
|
// src/image-editor/curve-editing.ts
|
|
@@ -15015,7 +15102,7 @@ function createImageEffectsToolProvider(controller, options = {}) {
|
|
|
15015
15102
|
return { target, effect: effects.find((e) => e.id === instance) ?? effects[effects.length - 1], effects, ...extra };
|
|
15016
15103
|
};
|
|
15017
15104
|
const plainValues = (v) => v;
|
|
15018
|
-
return createEffectToolProvider({
|
|
15105
|
+
return withImagePlayback(createEffectToolProvider({
|
|
15019
15106
|
id: options.id ?? "image-effects",
|
|
15020
15107
|
namespace: options.namespace,
|
|
15021
15108
|
title: "Image effects",
|
|
@@ -15083,7 +15170,7 @@ function createImageEffectsToolProvider(controller, options = {}) {
|
|
|
15083
15170
|
}
|
|
15084
15171
|
}
|
|
15085
15172
|
]
|
|
15086
|
-
});
|
|
15173
|
+
}));
|
|
15087
15174
|
}
|
|
15088
15175
|
export {
|
|
15089
15176
|
ADJUSTMENT_KEYS,
|
|
@@ -15168,6 +15255,7 @@ export {
|
|
|
15168
15255
|
IMAGE_EDITOR_STATE_VERSION,
|
|
15169
15256
|
IMAGE_EFFECT_PLACES,
|
|
15170
15257
|
IMAGE_FILTER_PRESETS,
|
|
15258
|
+
IMAGE_PLAYBACK_KIND,
|
|
15171
15259
|
INTENTS,
|
|
15172
15260
|
INTENT_OPTIONS,
|
|
15173
15261
|
INTERPOLATIONS,
|
|
@@ -15449,6 +15537,7 @@ export {
|
|
|
15449
15537
|
createImageEffectsToolProvider,
|
|
15450
15538
|
createImageLayerTools,
|
|
15451
15539
|
createImagePaintTools,
|
|
15540
|
+
createImagePlaybackLocator,
|
|
15452
15541
|
createImagePsdTools,
|
|
15453
15542
|
createImageRetouchTools,
|
|
15454
15543
|
createImageSelectionTools,
|
|
@@ -15610,6 +15699,7 @@ export {
|
|
|
15610
15699
|
identityWarpMesh,
|
|
15611
15700
|
imageEditorStateMigrations,
|
|
15612
15701
|
imageLayerAppliedEffects,
|
|
15702
|
+
imagePlaybackPanel,
|
|
15613
15703
|
imageToCanvasPoint,
|
|
15614
15704
|
importPsd,
|
|
15615
15705
|
inflate,
|
|
@@ -15788,6 +15878,7 @@ export {
|
|
|
15788
15878
|
placementAt,
|
|
15789
15879
|
placementBounds,
|
|
15790
15880
|
placementGeometry,
|
|
15881
|
+
planImageToolPlayback,
|
|
15791
15882
|
pngDataUrl,
|
|
15792
15883
|
pointerPressure,
|
|
15793
15884
|
pointerStrokeSample,
|
|
@@ -16022,6 +16113,7 @@ export {
|
|
|
16022
16113
|
whiteBalanceFromSample,
|
|
16023
16114
|
whiteBalanceMatrix,
|
|
16024
16115
|
withFilterMaskSurface,
|
|
16116
|
+
withImagePlayback,
|
|
16025
16117
|
withNewIds,
|
|
16026
16118
|
writeAdjustmentBlock,
|
|
16027
16119
|
writeDeepRegion,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AgentToolProvider } from '../tools/registry.cjs';
|
|
2
|
+
import type { PlaybackRect, PlaybackRef, PlaybackStep } from '../tools/playback.cjs';
|
|
3
|
+
import type { ImageEditorController } from './controller.cjs';
|
|
4
|
+
/** The playback kind of an image layer (`{ kind: 'layer', id }`, as in `data-layer-id`). */
|
|
5
|
+
export declare const IMAGE_PLAYBACK_KIND = "layer";
|
|
6
|
+
/** The editor's panels (its tabs), as `{ kind: 'panel', id }` refs. */
|
|
7
|
+
export type ImagePlaybackPanel = 'crop' | 'adjust' | 'layers' | 'paint' | 'select' | 'annotate';
|
|
8
|
+
/** The panel a write tool's change shows in (by its bare name), or null. */
|
|
9
|
+
export declare function imagePlaybackPanel(tool: string): ImagePlaybackPanel | null;
|
|
10
|
+
/** Finds `{ kind: 'layer', id }` (the layer's pixels, in document pixels) for agent playback. */
|
|
11
|
+
export declare function createImagePlaybackLocator(controller: Pick<ImageEditorController, 'getLayerBounds'>): (ref: PlaybackRef) => PlaybackRect | null;
|
|
12
|
+
/**
|
|
13
|
+
* The cursor steps for one image tool call (by bare name), or null to fall back to the ids it names.
|
|
14
|
+
* Steps open the tool's panel first, then act on the canvas or on the panel's controls.
|
|
15
|
+
*/
|
|
16
|
+
export declare function planImageToolPlayback(tool: string, args: Record<string, any>): PlaybackStep[] | null;
|
|
17
|
+
/**
|
|
18
|
+
* Gives an image tool provider agent playback: each write tool plans its steps with
|
|
19
|
+
* `planImageToolPlayback` and every call plays on the `surface` (default `image`, where
|
|
20
|
+
* `ImageEditor` attaches itself).
|
|
21
|
+
*/
|
|
22
|
+
export declare function withImagePlayback(provider: AgentToolProvider, surface?: string): AgentToolProvider;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AgentToolProvider } from '../tools/registry.js';
|
|
2
|
+
import type { PlaybackRect, PlaybackRef, PlaybackStep } from '../tools/playback.js';
|
|
3
|
+
import type { ImageEditorController } from './controller.js';
|
|
4
|
+
/** The playback kind of an image layer (`{ kind: 'layer', id }`, as in `data-layer-id`). */
|
|
5
|
+
export declare const IMAGE_PLAYBACK_KIND = "layer";
|
|
6
|
+
/** The editor's panels (its tabs), as `{ kind: 'panel', id }` refs. */
|
|
7
|
+
export type ImagePlaybackPanel = 'crop' | 'adjust' | 'layers' | 'paint' | 'select' | 'annotate';
|
|
8
|
+
/** The panel a write tool's change shows in (by its bare name), or null. */
|
|
9
|
+
export declare function imagePlaybackPanel(tool: string): ImagePlaybackPanel | null;
|
|
10
|
+
/** Finds `{ kind: 'layer', id }` (the layer's pixels, in document pixels) for agent playback. */
|
|
11
|
+
export declare function createImagePlaybackLocator(controller: Pick<ImageEditorController, 'getLayerBounds'>): (ref: PlaybackRef) => PlaybackRect | null;
|
|
12
|
+
/**
|
|
13
|
+
* The cursor steps for one image tool call (by bare name), or null to fall back to the ids it names.
|
|
14
|
+
* Steps open the tool's panel first, then act on the canvas or on the panel's controls.
|
|
15
|
+
*/
|
|
16
|
+
export declare function planImageToolPlayback(tool: string, args: Record<string, any>): PlaybackStep[] | null;
|
|
17
|
+
/**
|
|
18
|
+
* Gives an image tool provider agent playback: each write tool plans its steps with
|
|
19
|
+
* `planImageToolPlayback` and every call plays on the `surface` (default `image`, where
|
|
20
|
+
* `ImageEditor` attaches itself).
|
|
21
|
+
*/
|
|
22
|
+
export declare function withImagePlayback(provider: AgentToolProvider, surface?: string): AgentToolProvider;
|
|
@@ -53,7 +53,7 @@ var _chunkJLWLX52Lcjs = require('../chunk-JLWLX52L.cjs');
|
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
|
|
56
|
-
var
|
|
56
|
+
var _chunkUJGAA6AKcjs = require('../chunk-UJGAA6AK.cjs');
|
|
57
57
|
require('../chunk-HRI3ZMDM.cjs');
|
|
58
58
|
|
|
59
59
|
|
|
@@ -5889,7 +5889,7 @@ function resampleInto(src, rect, width, height) {
|
|
|
5889
5889
|
}
|
|
5890
5890
|
|
|
5891
5891
|
// src/paint-editor/presence.ts
|
|
5892
|
-
var PaintPresence = class extends
|
|
5892
|
+
var PaintPresence = class extends _chunkUJGAA6AKcjs.PresenceStore {
|
|
5893
5893
|
};
|
|
5894
5894
|
var FRAME = 16;
|
|
5895
5895
|
function strokeSchedule(points) {
|
|
@@ -5933,8 +5933,8 @@ var PaintDirector = class {
|
|
|
5933
5933
|
this.controller = controller;
|
|
5934
5934
|
this.presence = presence;
|
|
5935
5935
|
this.options = options;
|
|
5936
|
-
this.clock = _nullishCoalesce(options.clock, () => (
|
|
5937
|
-
this.queue = new (0,
|
|
5936
|
+
this.clock = _nullishCoalesce(options.clock, () => ( _chunkUJGAA6AKcjs.realPresenceClock));
|
|
5937
|
+
this.queue = new (0, _chunkUJGAA6AKcjs.PerformanceQueue)(presence, { clock: this.clock, linger: options.linger });
|
|
5938
5938
|
}
|
|
5939
5939
|
|
|
5940
5940
|
|
|
@@ -5969,7 +5969,7 @@ var PaintDirector = class {
|
|
|
5969
5969
|
this.presence.set({ id, x: to.x, y: to.y });
|
|
5970
5970
|
return;
|
|
5971
5971
|
}
|
|
5972
|
-
await
|
|
5972
|
+
await _chunkUJGAA6AKcjs.tweenPresenceCursor.call(void 0, this.presence, this.clock, id, this.where(id), to, this.ms(ms));
|
|
5973
5973
|
}
|
|
5974
5974
|
async say(id, text, ms) {
|
|
5975
5975
|
if (!text) return;
|
|
@@ -5999,7 +5999,7 @@ var PaintDirector = class {
|
|
|
5999
5999
|
await this.glide(id, path[0]);
|
|
6000
6000
|
this.presence.set({ id, pressed: true });
|
|
6001
6001
|
try {
|
|
6002
|
-
for (let i = 1; i < path.length; i++) await
|
|
6002
|
+
for (let i = 1; i < path.length; i++) await _chunkUJGAA6AKcjs.tweenPresenceCursor.call(void 0, this.presence, this.clock, id, path[i - 1], path[i], this.ms(i % 2 ? 260 : 90));
|
|
6003
6003
|
} finally {
|
|
6004
6004
|
this.presence.set({ id, pressed: false });
|
|
6005
6005
|
}
|
package/dist/tools/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-TNCWKC5M.cjs');
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
@@ -24,7 +24,16 @@
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
var
|
|
27
|
+
var _chunkY4BWZB6Jcjs = require('../chunk-Y4BWZB6J.cjs');
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
var _chunk6SFREX6Hcjs = require('../chunk-6SFREX6H.cjs');
|
|
28
37
|
|
|
29
38
|
|
|
30
39
|
|
|
@@ -69,6 +78,14 @@ var _chunkN2FGYZ4Qcjs = require('../chunk-N2FGYZ4Q.cjs');
|
|
|
69
78
|
var _chunk2BSBFBOAcjs = require('../chunk-2BSBFBOA.cjs');
|
|
70
79
|
|
|
71
80
|
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
var _chunkUJGAA6AKcjs = require('../chunk-UJGAA6AK.cjs');
|
|
87
|
+
|
|
88
|
+
|
|
72
89
|
var _chunkWOFXZ3XUcjs = require('../chunk-WOFXZ3XU.cjs');
|
|
73
90
|
|
|
74
91
|
|
|
@@ -132,4 +149,17 @@ var _chunkWOFXZ3XUcjs = require('../chunk-WOFXZ3XU.cjs');
|
|
|
132
149
|
|
|
133
150
|
|
|
134
151
|
|
|
135
|
-
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
exports.AgentPlayback = _chunk6SFREX6Hcjs.AgentPlayback; exports.CAPTURE_EXCLUDE_SELECTOR = _chunkSVFEVKLFcjs.CAPTURE_EXCLUDE_SELECTOR; exports.CAPTURE_OVERLAY_SELECTORS = _chunkSVFEVKLFcjs.CAPTURE_OVERLAY_SELECTORS; exports.EDITOR_CANVAS_TOOLS = _chunkSVFEVKLFcjs.EDITOR_CANVAS_TOOLS; exports.EDITOR_MCP_TOOLS = _chunkSVFEVKLFcjs.EDITOR_MCP_TOOLS; exports.EDITOR_PROMPT_TOOLS = _chunkSVFEVKLFcjs.EDITOR_PROMPT_TOOLS; exports.EDIT_OPERATION_REQUIRED_ARGUMENTS = _chunkSVFEVKLFcjs.EDIT_OPERATION_REQUIRED_ARGUMENTS; exports.EXPORT_EXCLUDED_SELECTORS = _chunkSVFEVKLFcjs.EXPORT_EXCLUDED_SELECTORS; exports.JSON_RPC_ERRORS = _chunkY4BWZB6Jcjs.JSON_RPC_ERRORS; exports.MCP_PROTOCOL_VERSIONS = _chunkY4BWZB6Jcjs.MCP_PROTOCOL_VERSIONS; exports.MCP_TOOL_CANVAS_ADD_NODE = _chunkSVFEVKLFcjs.MCP_TOOL_CANVAS_ADD_NODE; exports.MCP_TOOL_CANVAS_CONNECT = _chunkSVFEVKLFcjs.MCP_TOOL_CANVAS_CONNECT; exports.MCP_TOOL_CANVAS_HIGHLIGHT = _chunkSVFEVKLFcjs.MCP_TOOL_CANVAS_HIGHLIGHT; exports.MCP_TOOL_CANVAS_LAYOUT = _chunkSVFEVKLFcjs.MCP_TOOL_CANVAS_LAYOUT; exports.MCP_TOOL_CANVAS_REMOVE_NODES = _chunkSVFEVKLFcjs.MCP_TOOL_CANVAS_REMOVE_NODES; exports.MCP_TOOL_CANVAS_SELECT = _chunkSVFEVKLFcjs.MCP_TOOL_CANVAS_SELECT; exports.MCP_TOOL_CANVAS_UPDATE_NODE = _chunkSVFEVKLFcjs.MCP_TOOL_CANVAS_UPDATE_NODE; exports.MCP_TOOL_EDIT_CANVAS = _chunkSVFEVKLFcjs.MCP_TOOL_EDIT_CANVAS; exports.MCP_TOOL_EDIT_PROMPT = _chunkSVFEVKLFcjs.MCP_TOOL_EDIT_PROMPT; exports.MCP_TOOL_GET_EDITOR_STATE = _chunkSVFEVKLFcjs.MCP_TOOL_GET_EDITOR_STATE; exports.MCP_TOOL_PROMPT_INSERT_TEXT = _chunkSVFEVKLFcjs.MCP_TOOL_PROMPT_INSERT_TEXT; exports.MCP_TOOL_PROMPT_REPLACE_RANGE = _chunkSVFEVKLFcjs.MCP_TOOL_PROMPT_REPLACE_RANGE; exports.MCP_TOOL_PROMPT_SELECT = _chunkSVFEVKLFcjs.MCP_TOOL_PROMPT_SELECT; exports.MCP_TOOL_PROMPT_SET_VARIABLE = _chunkSVFEVKLFcjs.MCP_TOOL_PROMPT_SET_VARIABLE; exports.MCP_TOOL_VIEW_EDITOR = _chunkSVFEVKLFcjs.MCP_TOOL_VIEW_EDITOR; exports.PRESENCE_COLORS = _chunkUJGAA6AKcjs.PRESENCE_COLORS; exports.PerformanceQueue = _chunkUJGAA6AKcjs.PerformanceQueue; exports.PresenceStore = _chunkUJGAA6AKcjs.PresenceStore; exports.TOOL_BRIDGE_DEFAULT_PORT = _chunkY4BWZB6Jcjs.TOOL_BRIDGE_DEFAULT_PORT; exports.TOOL_BRIDGE_PROTOCOL = _chunkY4BWZB6Jcjs.TOOL_BRIDGE_PROTOCOL; exports.TOOL_DISCOVERY_TOOLS = _chunkY4BWZB6Jcjs.TOOL_DISCOVERY_TOOLS; exports.TOOL_NAMESPACE_SEPARATOR = _chunkY4BWZB6Jcjs.TOOL_NAMESPACE_SEPARATOR; exports.ToolRegistry = _chunkY4BWZB6Jcjs.ToolRegistry; exports.ToolRegistryError = _chunkY4BWZB6Jcjs.ToolRegistryError; exports.ToolRegistryView = _chunkY4BWZB6Jcjs.ToolRegistryView; exports.UNSAFE_JSON_KEYS = _chunk2BSBFBOAcjs.UNSAFE_JSON_KEYS; exports.baseToolName = _chunkY4BWZB6Jcjs.baseToolName; exports.captureInputSchema = _chunkN2FGYZ4Qcjs.captureInputSchema; exports.captureOutputSize = _chunkN2FGYZ4Qcjs.captureOutputSize; exports.cloneElementWithStyles = _chunkSVFEVKLFcjs.cloneElementWithStyles; exports.connectToolBridge = _chunkY4BWZB6Jcjs.connectToolBridge; exports.createAgentPlayback = _chunk6SFREX6Hcjs.createAgentPlayback; exports.createCaptureTool = _chunkN2FGYZ4Qcjs.createCaptureTool; exports.createCaptureToolProvider = _chunkN2FGYZ4Qcjs.createCaptureToolProvider; exports.createElementCaptureSurface = _chunkSVFEVKLFcjs.createElementCaptureSurface; exports.createInstantPresenceClock = _chunkUJGAA6AKcjs.createInstantPresenceClock; exports.createMcpServer = _chunkY4BWZB6Jcjs.createMcpServer; exports.createToolRegistry = _chunkY4BWZB6Jcjs.createToolRegistry; exports.derivePlaybackSteps = _chunk6SFREX6Hcjs.derivePlaybackSteps; exports.elementToSvg = _chunkSVFEVKLFcjs.elementToSvg; exports.errorResult = _chunkY4BWZB6Jcjs.errorResult; exports.isUnsafeJsonKey = _chunk2BSBFBOAcjs.isUnsafeJsonKey; exports.listSkills = _chunkY4BWZB6Jcjs.listSkills; exports.parseSkillFrontmatter = _chunkY4BWZB6Jcjs.parseSkillFrontmatter; exports.playbackRefsFromArgs = _chunk6SFREX6Hcjs.playbackRefsFromArgs; exports.playbackRefsFromResult = _chunk6SFREX6Hcjs.playbackRefsFromResult; exports.rasterizeElement = _chunkSVFEVKLFcjs.rasterizeElement; exports.readSkillFile = _chunkY4BWZB6Jcjs.readSkillFile; exports.readingTime = _chunk6SFREX6Hcjs.readingTime; exports.realPresenceClock = _chunkUJGAA6AKcjs.realPresenceClock; exports.resolveCaptureRequest = _chunkN2FGYZ4Qcjs.resolveCaptureRequest; exports.searchTokens = _chunkY4BWZB6Jcjs.searchTokens; exports.searchTools = _chunkY4BWZB6Jcjs.searchTools; exports.stripPrototypeKeys = _chunk2BSBFBOAcjs.stripPrototypeKeys; exports.summarize = _chunkY4BWZB6Jcjs.summarize; exports.toCapturedImageData = _chunkN2FGYZ4Qcjs.toCapturedImageData; exports.toToolResult = _chunkY4BWZB6Jcjs.toToolResult; exports.toolsetInstructions = _chunkY4BWZB6Jcjs.toolsetInstructions; exports.toolsetName = _chunkY4BWZB6Jcjs.toolsetName; exports.tweenPresenceCursor = _chunkUJGAA6AKcjs.tweenPresenceCursor; exports.unionCaptureRects = _chunkN2FGYZ4Qcjs.unionCaptureRects; exports.unionRects = _chunk6SFREX6Hcjs.unionRects; exports.unknownToolMessage = _chunkY4BWZB6Jcjs.unknownToolMessage; exports.validateJsonSchema = _chunkWOFXZ3XUcjs.validateJsonSchema;
|
package/dist/tools/index.d.cts
CHANGED
package/dist/tools/index.d.ts
CHANGED
package/dist/tools/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../chunk-
|
|
1
|
+
import "../chunk-PLKIYNJZ.js";
|
|
2
2
|
import {
|
|
3
3
|
JSON_RPC_ERRORS,
|
|
4
4
|
MCP_PROTOCOL_VERSIONS,
|
|
@@ -24,7 +24,16 @@ import {
|
|
|
24
24
|
toolsetInstructions,
|
|
25
25
|
toolsetName,
|
|
26
26
|
unknownToolMessage
|
|
27
|
-
} from "../chunk-
|
|
27
|
+
} from "../chunk-RFBFTLVN.js";
|
|
28
|
+
import {
|
|
29
|
+
AgentPlayback,
|
|
30
|
+
createAgentPlayback,
|
|
31
|
+
derivePlaybackSteps,
|
|
32
|
+
playbackRefsFromArgs,
|
|
33
|
+
playbackRefsFromResult,
|
|
34
|
+
readingTime,
|
|
35
|
+
unionRects
|
|
36
|
+
} from "../chunk-MFFE55CS.js";
|
|
28
37
|
import {
|
|
29
38
|
CAPTURE_EXCLUDE_SELECTOR,
|
|
30
39
|
CAPTURE_OVERLAY_SELECTORS,
|
|
@@ -67,10 +76,19 @@ import {
|
|
|
67
76
|
isUnsafeJsonKey,
|
|
68
77
|
stripPrototypeKeys
|
|
69
78
|
} from "../chunk-HF5QZS7Z.js";
|
|
79
|
+
import {
|
|
80
|
+
PRESENCE_COLORS,
|
|
81
|
+
PerformanceQueue,
|
|
82
|
+
PresenceStore,
|
|
83
|
+
createInstantPresenceClock,
|
|
84
|
+
realPresenceClock,
|
|
85
|
+
tweenPresenceCursor
|
|
86
|
+
} from "../chunk-PEEP2YR7.js";
|
|
70
87
|
import {
|
|
71
88
|
validateJsonSchema
|
|
72
89
|
} from "../chunk-V2ZCJRDM.js";
|
|
73
90
|
export {
|
|
91
|
+
AgentPlayback,
|
|
74
92
|
CAPTURE_EXCLUDE_SELECTOR,
|
|
75
93
|
CAPTURE_OVERLAY_SELECTORS,
|
|
76
94
|
EDITOR_CANVAS_TOOLS,
|
|
@@ -95,6 +113,9 @@ export {
|
|
|
95
113
|
MCP_TOOL_PROMPT_SELECT,
|
|
96
114
|
MCP_TOOL_PROMPT_SET_VARIABLE,
|
|
97
115
|
MCP_TOOL_VIEW_EDITOR,
|
|
116
|
+
PRESENCE_COLORS,
|
|
117
|
+
PerformanceQueue,
|
|
118
|
+
PresenceStore,
|
|
98
119
|
TOOL_BRIDGE_DEFAULT_PORT,
|
|
99
120
|
TOOL_BRIDGE_PROTOCOL,
|
|
100
121
|
TOOL_DISCOVERY_TOOLS,
|
|
@@ -108,18 +129,25 @@ export {
|
|
|
108
129
|
captureOutputSize,
|
|
109
130
|
cloneElementWithStyles,
|
|
110
131
|
connectToolBridge,
|
|
132
|
+
createAgentPlayback,
|
|
111
133
|
createCaptureTool,
|
|
112
134
|
createCaptureToolProvider,
|
|
113
135
|
createElementCaptureSurface,
|
|
136
|
+
createInstantPresenceClock,
|
|
114
137
|
createMcpServer,
|
|
115
138
|
createToolRegistry,
|
|
139
|
+
derivePlaybackSteps,
|
|
116
140
|
elementToSvg,
|
|
117
141
|
errorResult,
|
|
118
142
|
isUnsafeJsonKey,
|
|
119
143
|
listSkills,
|
|
120
144
|
parseSkillFrontmatter,
|
|
145
|
+
playbackRefsFromArgs,
|
|
146
|
+
playbackRefsFromResult,
|
|
121
147
|
rasterizeElement,
|
|
122
148
|
readSkillFile,
|
|
149
|
+
readingTime,
|
|
150
|
+
realPresenceClock,
|
|
123
151
|
resolveCaptureRequest,
|
|
124
152
|
searchTokens,
|
|
125
153
|
searchTools,
|
|
@@ -129,7 +157,9 @@ export {
|
|
|
129
157
|
toToolResult,
|
|
130
158
|
toolsetInstructions,
|
|
131
159
|
toolsetName,
|
|
160
|
+
tweenPresenceCursor,
|
|
132
161
|
unionCaptureRects,
|
|
162
|
+
unionRects,
|
|
133
163
|
unknownToolMessage,
|
|
134
164
|
validateJsonSchema
|
|
135
165
|
};
|