@pixerate/editor 0.143.0 → 0.144.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 +6 -4
- package/dist/agent/index.js +4 -2
- package/dist/{chunk-XH32BATE.cjs → chunk-AG2EXVCR.cjs} +2 -2
- package/dist/{chunk-X2HQP7DF.cjs → chunk-D2ENR3LB.cjs} +43 -4
- package/dist/{chunk-54GVEVXS.js → chunk-HUHBJWTD.js} +43 -4
- package/dist/{chunk-Y6SGC6KO.js → chunk-SA37RU2O.js} +1 -1
- package/dist/commands/index.cjs +2 -2
- package/dist/commands/index.js +1 -1
- package/dist/tools/index.cjs +5 -3
- package/dist/tools/index.js +4 -2
- package/dist/tools/playback.d.cts +18 -4
- package/dist/tools/playback.d.ts +18 -4
- package/package.json +1 -1
- package/skills/pixerate-agent-tools/SKILL.md +7 -1
package/dist/agent/index.cjs
CHANGED
|
@@ -19,7 +19,7 @@ require('../chunk-4EFNS2HV.cjs');
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _chunkAG2EXVCRcjs = require('../chunk-AG2EXVCR.cjs');
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
@@ -54,7 +54,8 @@ var _chunkY4BWZB6Jcjs = require('../chunk-Y4BWZB6J.cjs');
|
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
|
|
58
|
+
var _chunkD2ENR3LBcjs = require('../chunk-D2ENR3LB.cjs');
|
|
58
59
|
|
|
59
60
|
|
|
60
61
|
|
|
@@ -585,7 +586,7 @@ function planCanvasPlaybackSteps(steps, nodes, rectOptions) {
|
|
|
585
586
|
const node = placed.get(id);
|
|
586
587
|
if (node) placed.set(id, { ...node, position });
|
|
587
588
|
}
|
|
588
|
-
const rect =
|
|
589
|
+
const rect = _chunkD2ENR3LBcjs.unionRects.call(void 0, moved.map(([id]) => rectOf(id)));
|
|
589
590
|
if (rect) after.push({ type: "move", to: centre(rect) }, { type: "focus", rect }, { type: "wait", ms: 450 });
|
|
590
591
|
break;
|
|
591
592
|
}
|
|
@@ -2245,4 +2246,5 @@ function createCanvasComponentToolProvider(controller, options = { id: "canvas-c
|
|
|
2245
2246
|
|
|
2246
2247
|
|
|
2247
2248
|
|
|
2248
|
-
|
|
2249
|
+
|
|
2250
|
+
exports.AgentPlayback = _chunkD2ENR3LBcjs.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 = _chunkD2ENR3LBcjs.createAgentPlayback; exports.createCanvasComponentToolProvider = createCanvasComponentToolProvider; exports.createCaptureTool = _chunkN2FGYZ4Qcjs.createCaptureTool; exports.createCaptureToolProvider = _chunkN2FGYZ4Qcjs.createCaptureToolProvider; exports.createDocumentChartTools = createDocumentChartTools; exports.createEditorMcpToolProvider = createEditorMcpToolProvider; exports.createElementCaptureSurface = _chunkSVFEVKLFcjs.createElementCaptureSurface; exports.createInstantPresenceClock = _chunkUJGAA6AKcjs.createInstantPresenceClock; exports.createMcpServer = _chunkY4BWZB6Jcjs.createMcpServer; exports.createPlaybackToolProvider = _chunkD2ENR3LBcjs.createPlaybackToolProvider; exports.createRichTextToolProvider = createRichTextToolProvider; exports.createSpreadsheetToolProvider = createSpreadsheetToolProvider; exports.createToolRegistry = _chunkY4BWZB6Jcjs.createToolRegistry; exports.derivePlaybackSteps = _chunkD2ENR3LBcjs.derivePlaybackSteps; exports.elementToSvg = _chunkSVFEVKLFcjs.elementToSvg; exports.errorResult = _chunkY4BWZB6Jcjs.errorResult; exports.isUnsafeJsonKey = _chunk2BSBFBOAcjs.isUnsafeJsonKey; exports.listSkills = _chunkY4BWZB6Jcjs.listSkills; exports.normalizeSide = normalizeSide; exports.parseSkillFrontmatter = _chunkY4BWZB6Jcjs.parseSkillFrontmatter; exports.planAgentCommand = planAgentCommand; exports.planCanvasPlaybackSteps = planCanvasPlaybackSteps; exports.planCanvasToolPlayback = planCanvasToolPlayback; exports.planToolCall = planToolCall; exports.playbackRefsFromArgs = _chunkD2ENR3LBcjs.playbackRefsFromArgs; exports.playbackRefsFromResult = _chunkD2ENR3LBcjs.playbackRefsFromResult; exports.rasterizeElement = _chunkSVFEVKLFcjs.rasterizeElement; exports.readSkillFile = _chunkY4BWZB6Jcjs.readSkillFile; exports.readingTime = _chunkD2ENR3LBcjs.readingTime; exports.realPresenceClock = _chunkUJGAA6AKcjs.realPresenceClock; exports.resolveCaptureRequest = _chunkN2FGYZ4Qcjs.resolveCaptureRequest; exports.runToolScript = _chunkAG2EXVCRcjs.runToolScript; 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.toolCallToAgentCommand = toolCallToAgentCommand; exports.toolResultError = _chunkAG2EXVCRcjs.toolResultError; exports.toolResultValue = _chunkAG2EXVCRcjs.toolResultValue; exports.toolsetInstructions = _chunkY4BWZB6Jcjs.toolsetInstructions; exports.toolsetName = _chunkY4BWZB6Jcjs.toolsetName; exports.tweenPresenceCursor = _chunkUJGAA6AKcjs.tweenPresenceCursor; exports.unionCaptureRects = _chunkN2FGYZ4Qcjs.unionCaptureRects; exports.unionRects = _chunkD2ENR3LBcjs.unionRects; exports.unknownToolMessage = _chunkY4BWZB6Jcjs.unknownToolMessage; exports.validateAgentCommand = validateAgentCommand; exports.validateJsonSchema = _chunkWOFXZ3XUcjs.validateJsonSchema;
|
package/dist/agent/index.js
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
runToolScript,
|
|
20
20
|
toolResultError,
|
|
21
21
|
toolResultValue
|
|
22
|
-
} from "../chunk-
|
|
22
|
+
} from "../chunk-SA37RU2O.js";
|
|
23
23
|
import {
|
|
24
24
|
JSON_RPC_ERRORS,
|
|
25
25
|
MCP_PROTOCOL_VERSIONS,
|
|
@@ -49,12 +49,13 @@ import {
|
|
|
49
49
|
import {
|
|
50
50
|
AgentPlayback,
|
|
51
51
|
createAgentPlayback,
|
|
52
|
+
createPlaybackToolProvider,
|
|
52
53
|
derivePlaybackSteps,
|
|
53
54
|
playbackRefsFromArgs,
|
|
54
55
|
playbackRefsFromResult,
|
|
55
56
|
readingTime,
|
|
56
57
|
unionRects
|
|
57
|
-
} from "../chunk-
|
|
58
|
+
} from "../chunk-HUHBJWTD.js";
|
|
58
59
|
import {
|
|
59
60
|
CAPTURE_EXCLUDE_SELECTOR,
|
|
60
61
|
CAPTURE_OVERLAY_SELECTORS,
|
|
@@ -2206,6 +2207,7 @@ export {
|
|
|
2206
2207
|
createElementCaptureSurface,
|
|
2207
2208
|
createInstantPresenceClock,
|
|
2208
2209
|
createMcpServer,
|
|
2210
|
+
createPlaybackToolProvider,
|
|
2209
2211
|
createRichTextToolProvider,
|
|
2210
2212
|
createSpreadsheetToolProvider,
|
|
2211
2213
|
createToolRegistry,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkD2ENR3LBcjs = require('./chunk-D2ENR3LB.cjs');
|
|
4
4
|
|
|
5
5
|
// src/tools/script.ts
|
|
6
6
|
function toolResultValue(result) {
|
|
@@ -36,7 +36,7 @@ async function runToolScript(source, script, options = {}) {
|
|
|
36
36
|
if (step.say) {
|
|
37
37
|
emit({ type: "say", step: i, text: step.say });
|
|
38
38
|
_optionalChain([options, 'access', _6 => _6.playback, 'optionalAccess', _7 => _7.say, 'call', _8 => _8(step.say, options.actor ? { actor: options.actor } : {})]);
|
|
39
|
-
await pause(
|
|
39
|
+
await pause(_chunkD2ENR3LBcjs.readingTime.call(void 0, step.say));
|
|
40
40
|
}
|
|
41
41
|
if (!step.tool) continue;
|
|
42
42
|
if (control.stopped) return finish(false);
|
|
@@ -107,7 +107,7 @@ var AgentPlayback = (_class = class {
|
|
|
107
107
|
constructor(options = {}) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);_class.prototype.__init6.call(this);_class.prototype.__init7.call(this);_class.prototype.__init8.call(this);_class.prototype.__init9.call(this);
|
|
108
108
|
this.clock = _nullishCoalesce(options.clock, () => ( _chunkUJGAA6AKcjs.realPresenceClock));
|
|
109
109
|
this.speed = _nullishCoalesce(options.speed, () => ( 1));
|
|
110
|
-
this.reads = _nullishCoalesce(options.reads, () => ( "
|
|
110
|
+
this.reads = _nullishCoalesce(options.reads, () => ( "skip"));
|
|
111
111
|
this.linger = _nullishCoalesce(options.linger, () => ( 1500));
|
|
112
112
|
this.defaultActor = _nullishCoalesce(options.actor, () => ( { id: "agent", name: "Agent" }));
|
|
113
113
|
}
|
|
@@ -143,11 +143,16 @@ var AgentPlayback = (_class = class {
|
|
|
143
143
|
surface(id) {
|
|
144
144
|
return this.surfaces.get(id);
|
|
145
145
|
}
|
|
146
|
-
/**
|
|
146
|
+
/**
|
|
147
|
+
* Shows `text` in the actor's bubble on the surface it last worked on (until its next step).
|
|
148
|
+
* Returns that surface's id, or null when the actor has no cursor on screen (nothing shown).
|
|
149
|
+
*/
|
|
147
150
|
say(text, options = {}) {
|
|
148
151
|
const actor = this.actorState(options.actor);
|
|
149
152
|
const surface = actor.surface ? this.surfaces.get(actor.surface) : void 0;
|
|
150
|
-
if (_optionalChain([surface, 'optionalAccess', _5 => _5.presence, 'access', _6 => _6.get, 'call', _7 => _7(actor.info.id)]))
|
|
153
|
+
if (!_optionalChain([surface, 'optionalAccess', _5 => _5.presence, 'access', _6 => _6.get, 'call', _7 => _7(actor.info.id)])) return null;
|
|
154
|
+
surface.presence.set({ id: actor.info.id, message: text });
|
|
155
|
+
return actor.surface;
|
|
151
156
|
}
|
|
152
157
|
/** Finishes every running performance at once (the calls still run and keep their results). */
|
|
153
158
|
stop() {
|
|
@@ -396,6 +401,40 @@ var AgentPlayback = (_class = class {
|
|
|
396
401
|
function createAgentPlayback(options = {}) {
|
|
397
402
|
return new AgentPlayback(options);
|
|
398
403
|
}
|
|
404
|
+
function createPlaybackToolProvider(playback, options = {}) {
|
|
405
|
+
const title = "Say a note by your cursor";
|
|
406
|
+
return {
|
|
407
|
+
id: _nullishCoalesce(options.id, () => ( "playback")),
|
|
408
|
+
namespace: options.namespace,
|
|
409
|
+
title: "Agent playback",
|
|
410
|
+
description: "Notes shown beside your cursor while the host plays your calls on screen.",
|
|
411
|
+
skill: "pixerate-agent-tools",
|
|
412
|
+
tools: [
|
|
413
|
+
{
|
|
414
|
+
name: "say",
|
|
415
|
+
title,
|
|
416
|
+
description: "Shows a short note in the bubble beside your cursor on the editor you last worked on, so the user can follow what you are doing; it stays until your next call. Changes no document. Returns shown (whether a cursor was on screen to show it) and surface (that editor, or null).",
|
|
417
|
+
inputSchema: {
|
|
418
|
+
type: "object",
|
|
419
|
+
properties: {
|
|
420
|
+
text: { type: "string", minLength: 1, maxLength: 200, description: "The note: one short sentence, at most 200 characters." }
|
|
421
|
+
},
|
|
422
|
+
required: ["text"],
|
|
423
|
+
additionalProperties: false
|
|
424
|
+
},
|
|
425
|
+
annotations: { title, readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
426
|
+
playback: false,
|
|
427
|
+
handler: ({ text }, context) => {
|
|
428
|
+
const note = String(text).trim();
|
|
429
|
+
if (!note) throw new Error('text is empty; pass the note to show, e.g. "Aligning the cards."');
|
|
430
|
+
const surface = playback.say(note, { actor: context.actor });
|
|
431
|
+
return { shown: surface !== null, surface };
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
]
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
|
|
399
438
|
|
|
400
439
|
|
|
401
440
|
|
|
@@ -405,4 +444,4 @@ function createAgentPlayback(options = {}) {
|
|
|
405
444
|
|
|
406
445
|
|
|
407
446
|
|
|
408
|
-
exports.playbackRefsFromArgs = playbackRefsFromArgs; exports.playbackRefsFromResult = playbackRefsFromResult; exports.derivePlaybackSteps = derivePlaybackSteps; exports.readingTime = readingTime; exports.unionRects = unionRects; exports.AgentPlayback = AgentPlayback; exports.createAgentPlayback = createAgentPlayback;
|
|
447
|
+
exports.playbackRefsFromArgs = playbackRefsFromArgs; exports.playbackRefsFromResult = playbackRefsFromResult; exports.derivePlaybackSteps = derivePlaybackSteps; exports.readingTime = readingTime; exports.unionRects = unionRects; exports.AgentPlayback = AgentPlayback; exports.createAgentPlayback = createAgentPlayback; exports.createPlaybackToolProvider = createPlaybackToolProvider;
|
|
@@ -107,7 +107,7 @@ var AgentPlayback = class {
|
|
|
107
107
|
constructor(options = {}) {
|
|
108
108
|
this.clock = options.clock ?? realPresenceClock;
|
|
109
109
|
this.speed = options.speed ?? 1;
|
|
110
|
-
this.reads = options.reads ?? "
|
|
110
|
+
this.reads = options.reads ?? "skip";
|
|
111
111
|
this.linger = options.linger ?? 1500;
|
|
112
112
|
this.defaultActor = options.actor ?? { id: "agent", name: "Agent" };
|
|
113
113
|
}
|
|
@@ -143,11 +143,16 @@ var AgentPlayback = class {
|
|
|
143
143
|
surface(id) {
|
|
144
144
|
return this.surfaces.get(id);
|
|
145
145
|
}
|
|
146
|
-
/**
|
|
146
|
+
/**
|
|
147
|
+
* Shows `text` in the actor's bubble on the surface it last worked on (until its next step).
|
|
148
|
+
* Returns that surface's id, or null when the actor has no cursor on screen (nothing shown).
|
|
149
|
+
*/
|
|
147
150
|
say(text, options = {}) {
|
|
148
151
|
const actor = this.actorState(options.actor);
|
|
149
152
|
const surface = actor.surface ? this.surfaces.get(actor.surface) : void 0;
|
|
150
|
-
if (surface?.presence.get(actor.info.id))
|
|
153
|
+
if (!surface?.presence.get(actor.info.id)) return null;
|
|
154
|
+
surface.presence.set({ id: actor.info.id, message: text });
|
|
155
|
+
return actor.surface;
|
|
151
156
|
}
|
|
152
157
|
/** Finishes every running performance at once (the calls still run and keep their results). */
|
|
153
158
|
stop() {
|
|
@@ -396,6 +401,39 @@ var AgentPlayback = class {
|
|
|
396
401
|
function createAgentPlayback(options = {}) {
|
|
397
402
|
return new AgentPlayback(options);
|
|
398
403
|
}
|
|
404
|
+
function createPlaybackToolProvider(playback, options = {}) {
|
|
405
|
+
const title = "Say a note by your cursor";
|
|
406
|
+
return {
|
|
407
|
+
id: options.id ?? "playback",
|
|
408
|
+
namespace: options.namespace,
|
|
409
|
+
title: "Agent playback",
|
|
410
|
+
description: "Notes shown beside your cursor while the host plays your calls on screen.",
|
|
411
|
+
skill: "pixerate-agent-tools",
|
|
412
|
+
tools: [
|
|
413
|
+
{
|
|
414
|
+
name: "say",
|
|
415
|
+
title,
|
|
416
|
+
description: "Shows a short note in the bubble beside your cursor on the editor you last worked on, so the user can follow what you are doing; it stays until your next call. Changes no document. Returns shown (whether a cursor was on screen to show it) and surface (that editor, or null).",
|
|
417
|
+
inputSchema: {
|
|
418
|
+
type: "object",
|
|
419
|
+
properties: {
|
|
420
|
+
text: { type: "string", minLength: 1, maxLength: 200, description: "The note: one short sentence, at most 200 characters." }
|
|
421
|
+
},
|
|
422
|
+
required: ["text"],
|
|
423
|
+
additionalProperties: false
|
|
424
|
+
},
|
|
425
|
+
annotations: { title, readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
426
|
+
playback: false,
|
|
427
|
+
handler: ({ text }, context) => {
|
|
428
|
+
const note = String(text).trim();
|
|
429
|
+
if (!note) throw new Error('text is empty; pass the note to show, e.g. "Aligning the cards."');
|
|
430
|
+
const surface = playback.say(note, { actor: context.actor });
|
|
431
|
+
return { shown: surface !== null, surface };
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
]
|
|
435
|
+
};
|
|
436
|
+
}
|
|
399
437
|
|
|
400
438
|
export {
|
|
401
439
|
playbackRefsFromArgs,
|
|
@@ -404,5 +442,6 @@ export {
|
|
|
404
442
|
readingTime,
|
|
405
443
|
unionRects,
|
|
406
444
|
AgentPlayback,
|
|
407
|
-
createAgentPlayback
|
|
445
|
+
createAgentPlayback,
|
|
446
|
+
createPlaybackToolProvider
|
|
408
447
|
};
|
package/dist/commands/index.cjs
CHANGED
|
@@ -29,7 +29,7 @@ var _chunkGLQQ2VILcjs = require('../chunk-GLQQ2VIL.cjs');
|
|
|
29
29
|
var _chunk4EFNS2HVcjs = require('../chunk-4EFNS2HV.cjs');
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _chunkD2ENR3LBcjs = require('../chunk-D2ENR3LB.cjs');
|
|
33
33
|
require('../chunk-UJGAA6AK.cjs');
|
|
34
34
|
|
|
35
35
|
|
|
@@ -608,7 +608,7 @@ function createCommandToolProvider(registry, options = {}) {
|
|
|
608
608
|
const surface = _nullishCoalesce(_nullishCoalesce(spec.playbackSurface, () => ( spec.scope)), () => ( (id.includes(".") ? id.slice(0, id.indexOf(".")) : void 0)));
|
|
609
609
|
const planned = _optionalChain([spec, 'access', _24 => _24.plan, 'optionalCall', _25 => _25(context(), _nullishCoalesce(params, () => ( {})))]);
|
|
610
610
|
const own = !planned ? [] : Array.isArray(planned) ? planned : planned.steps;
|
|
611
|
-
const steps = own.length ? own :
|
|
611
|
+
const steps = own.length ? own : _chunkD2ENR3LBcjs.derivePlaybackSteps.call(void 0, params);
|
|
612
612
|
return {
|
|
613
613
|
steps,
|
|
614
614
|
...surface ? { surface } : {},
|
package/dist/commands/index.js
CHANGED
package/dist/tools/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkAG2EXVCRcjs = require('../chunk-AG2EXVCR.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -37,7 +37,8 @@ var _chunkY4BWZB6Jcjs = require('../chunk-Y4BWZB6J.cjs');
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
|
|
41
|
+
var _chunkD2ENR3LBcjs = require('../chunk-D2ENR3LB.cjs');
|
|
41
42
|
|
|
42
43
|
|
|
43
44
|
|
|
@@ -169,4 +170,5 @@ var _chunkWOFXZ3XUcjs = require('../chunk-WOFXZ3XU.cjs');
|
|
|
169
170
|
|
|
170
171
|
|
|
171
172
|
|
|
172
|
-
|
|
173
|
+
|
|
174
|
+
exports.AgentPlayback = _chunkD2ENR3LBcjs.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 = _chunkD2ENR3LBcjs.createAgentPlayback; exports.createCaptureTool = _chunkN2FGYZ4Qcjs.createCaptureTool; exports.createCaptureToolProvider = _chunkN2FGYZ4Qcjs.createCaptureToolProvider; exports.createElementCaptureSurface = _chunkSVFEVKLFcjs.createElementCaptureSurface; exports.createInstantPresenceClock = _chunkUJGAA6AKcjs.createInstantPresenceClock; exports.createMcpServer = _chunkY4BWZB6Jcjs.createMcpServer; exports.createPlaybackToolProvider = _chunkD2ENR3LBcjs.createPlaybackToolProvider; exports.createToolRegistry = _chunkY4BWZB6Jcjs.createToolRegistry; exports.derivePlaybackSteps = _chunkD2ENR3LBcjs.derivePlaybackSteps; exports.elementToSvg = _chunkSVFEVKLFcjs.elementToSvg; exports.errorResult = _chunkY4BWZB6Jcjs.errorResult; exports.isUnsafeJsonKey = _chunk2BSBFBOAcjs.isUnsafeJsonKey; exports.listSkills = _chunkY4BWZB6Jcjs.listSkills; exports.parseSkillFrontmatter = _chunkY4BWZB6Jcjs.parseSkillFrontmatter; exports.playbackRefsFromArgs = _chunkD2ENR3LBcjs.playbackRefsFromArgs; exports.playbackRefsFromResult = _chunkD2ENR3LBcjs.playbackRefsFromResult; exports.rasterizeElement = _chunkSVFEVKLFcjs.rasterizeElement; exports.readSkillFile = _chunkY4BWZB6Jcjs.readSkillFile; exports.readingTime = _chunkD2ENR3LBcjs.readingTime; exports.realPresenceClock = _chunkUJGAA6AKcjs.realPresenceClock; exports.resolveCaptureRequest = _chunkN2FGYZ4Qcjs.resolveCaptureRequest; exports.runToolScript = _chunkAG2EXVCRcjs.runToolScript; 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.toolResultError = _chunkAG2EXVCRcjs.toolResultError; exports.toolResultValue = _chunkAG2EXVCRcjs.toolResultValue; exports.toolsetInstructions = _chunkY4BWZB6Jcjs.toolsetInstructions; exports.toolsetName = _chunkY4BWZB6Jcjs.toolsetName; exports.tweenPresenceCursor = _chunkUJGAA6AKcjs.tweenPresenceCursor; exports.unionCaptureRects = _chunkN2FGYZ4Qcjs.unionCaptureRects; exports.unionRects = _chunkD2ENR3LBcjs.unionRects; exports.unknownToolMessage = _chunkY4BWZB6Jcjs.unknownToolMessage; exports.validateJsonSchema = _chunkWOFXZ3XUcjs.validateJsonSchema;
|
package/dist/tools/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
runToolScript,
|
|
3
3
|
toolResultError,
|
|
4
4
|
toolResultValue
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-SA37RU2O.js";
|
|
6
6
|
import {
|
|
7
7
|
JSON_RPC_ERRORS,
|
|
8
8
|
MCP_PROTOCOL_VERSIONS,
|
|
@@ -32,12 +32,13 @@ import {
|
|
|
32
32
|
import {
|
|
33
33
|
AgentPlayback,
|
|
34
34
|
createAgentPlayback,
|
|
35
|
+
createPlaybackToolProvider,
|
|
35
36
|
derivePlaybackSteps,
|
|
36
37
|
playbackRefsFromArgs,
|
|
37
38
|
playbackRefsFromResult,
|
|
38
39
|
readingTime,
|
|
39
40
|
unionRects
|
|
40
|
-
} from "../chunk-
|
|
41
|
+
} from "../chunk-HUHBJWTD.js";
|
|
41
42
|
import {
|
|
42
43
|
CAPTURE_EXCLUDE_SELECTOR,
|
|
43
44
|
CAPTURE_OVERLAY_SELECTORS,
|
|
@@ -139,6 +140,7 @@ export {
|
|
|
139
140
|
createElementCaptureSurface,
|
|
140
141
|
createInstantPresenceClock,
|
|
141
142
|
createMcpServer,
|
|
143
|
+
createPlaybackToolProvider,
|
|
142
144
|
createToolRegistry,
|
|
143
145
|
derivePlaybackSteps,
|
|
144
146
|
elementToSvg,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ToolMiddleware, ToolRegistry } from './registry.cjs';
|
|
1
|
+
import type { AgentToolProvider, ToolMiddleware, ToolRegistry } from './registry.cjs';
|
|
2
2
|
import { type PresenceActorInfo, type PresenceClock, type PresenceStore } from './presence.cjs';
|
|
3
3
|
export interface PlaybackPoint {
|
|
4
4
|
x: number;
|
|
@@ -116,7 +116,7 @@ export interface AgentPlaybackOptions {
|
|
|
116
116
|
clock?: PresenceClock;
|
|
117
117
|
/** 1 = natural pace, 2 = twice as fast, `Infinity` = no animation (default 1). */
|
|
118
118
|
speed?: number;
|
|
119
|
-
/** Read-only tools: `
|
|
119
|
+
/** Read-only tools: `skip` shows only changes (default), `glance` moves to their target only, `play` plays them like writes. */
|
|
120
120
|
reads?: PlaybackReads;
|
|
121
121
|
/** Hide a cursor this long after its actor's last call (ms, default 1500; 0 keeps it). */
|
|
122
122
|
linger?: number;
|
|
@@ -183,10 +183,13 @@ export declare class AgentPlayback {
|
|
|
183
183
|
attach(id: string, surface: PlaybackSurface): () => void;
|
|
184
184
|
/** The surface attached under `id`. */
|
|
185
185
|
surface(id: string): PlaybackSurface | undefined;
|
|
186
|
-
/**
|
|
186
|
+
/**
|
|
187
|
+
* Shows `text` in the actor's bubble on the surface it last worked on (until its next step).
|
|
188
|
+
* Returns that surface's id, or null when the actor has no cursor on screen (nothing shown).
|
|
189
|
+
*/
|
|
187
190
|
say(text: string, options?: {
|
|
188
191
|
actor?: PresenceActorInfo;
|
|
189
|
-
}):
|
|
192
|
+
}): string | null;
|
|
190
193
|
/** Finishes every running performance at once (the calls still run and keep their results). */
|
|
191
194
|
stop(): void;
|
|
192
195
|
/** Collects every step played from now on (for tests). */
|
|
@@ -203,3 +206,14 @@ export declare class AgentPlayback {
|
|
|
203
206
|
}
|
|
204
207
|
/** An {@link AgentPlayback}: install it on a registry and attach editor surfaces to see calls played. */
|
|
205
208
|
export declare function createAgentPlayback(options?: AgentPlaybackOptions): AgentPlayback;
|
|
209
|
+
export interface PlaybackToolProviderOptions {
|
|
210
|
+
/** Provider id and default namespace (default `playback`, so the tool is `playback__say`). */
|
|
211
|
+
id?: string;
|
|
212
|
+
namespace?: string;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* The optional `say` tool: lets an agent put a short note in its cursor's bubble, through
|
|
216
|
+
* {@link AgentPlayback.say}. Register it only where a UI shows the cursors; it changes no document
|
|
217
|
+
* and is never played itself. Without a cursor on screen it shows nothing and says so.
|
|
218
|
+
*/
|
|
219
|
+
export declare function createPlaybackToolProvider(playback: AgentPlayback, options?: PlaybackToolProviderOptions): AgentToolProvider;
|
package/dist/tools/playback.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ToolMiddleware, ToolRegistry } from './registry.js';
|
|
1
|
+
import type { AgentToolProvider, ToolMiddleware, ToolRegistry } from './registry.js';
|
|
2
2
|
import { type PresenceActorInfo, type PresenceClock, type PresenceStore } from './presence.js';
|
|
3
3
|
export interface PlaybackPoint {
|
|
4
4
|
x: number;
|
|
@@ -116,7 +116,7 @@ export interface AgentPlaybackOptions {
|
|
|
116
116
|
clock?: PresenceClock;
|
|
117
117
|
/** 1 = natural pace, 2 = twice as fast, `Infinity` = no animation (default 1). */
|
|
118
118
|
speed?: number;
|
|
119
|
-
/** Read-only tools: `
|
|
119
|
+
/** Read-only tools: `skip` shows only changes (default), `glance` moves to their target only, `play` plays them like writes. */
|
|
120
120
|
reads?: PlaybackReads;
|
|
121
121
|
/** Hide a cursor this long after its actor's last call (ms, default 1500; 0 keeps it). */
|
|
122
122
|
linger?: number;
|
|
@@ -183,10 +183,13 @@ export declare class AgentPlayback {
|
|
|
183
183
|
attach(id: string, surface: PlaybackSurface): () => void;
|
|
184
184
|
/** The surface attached under `id`. */
|
|
185
185
|
surface(id: string): PlaybackSurface | undefined;
|
|
186
|
-
/**
|
|
186
|
+
/**
|
|
187
|
+
* Shows `text` in the actor's bubble on the surface it last worked on (until its next step).
|
|
188
|
+
* Returns that surface's id, or null when the actor has no cursor on screen (nothing shown).
|
|
189
|
+
*/
|
|
187
190
|
say(text: string, options?: {
|
|
188
191
|
actor?: PresenceActorInfo;
|
|
189
|
-
}):
|
|
192
|
+
}): string | null;
|
|
190
193
|
/** Finishes every running performance at once (the calls still run and keep their results). */
|
|
191
194
|
stop(): void;
|
|
192
195
|
/** Collects every step played from now on (for tests). */
|
|
@@ -203,3 +206,14 @@ export declare class AgentPlayback {
|
|
|
203
206
|
}
|
|
204
207
|
/** An {@link AgentPlayback}: install it on a registry and attach editor surfaces to see calls played. */
|
|
205
208
|
export declare function createAgentPlayback(options?: AgentPlaybackOptions): AgentPlayback;
|
|
209
|
+
export interface PlaybackToolProviderOptions {
|
|
210
|
+
/** Provider id and default namespace (default `playback`, so the tool is `playback__say`). */
|
|
211
|
+
id?: string;
|
|
212
|
+
namespace?: string;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* The optional `say` tool: lets an agent put a short note in its cursor's bubble, through
|
|
216
|
+
* {@link AgentPlayback.say}. Register it only where a UI shows the cursors; it changes no document
|
|
217
|
+
* and is never played itself. Without a cursor on screen it shows nothing and says so.
|
|
218
|
+
*/
|
|
219
|
+
export declare function createPlaybackToolProvider(playback: AgentPlayback, options?: PlaybackToolProviderOptions): AgentToolProvider;
|
package/package.json
CHANGED
|
@@ -65,7 +65,8 @@ editor's, or (in discovery mode) only `list_toolsets`, `search_tools`, `enable_t
|
|
|
65
65
|
|
|
66
66
|
The host may act your calls out on screen (agent playback): your cursor glides to what a call
|
|
67
67
|
names, presses, drags or types, and the change lands as one undo step. Results are the same with
|
|
68
|
-
or without it, and calls simply take a little longer while it plays.
|
|
68
|
+
or without it, and calls simply take a little longer while it plays. Only changes play by
|
|
69
|
+
default: reads return at once and do not move your cursor.
|
|
69
70
|
|
|
70
71
|
- Do not add waits or poll for the animation; each call returns once its change is applied.
|
|
71
72
|
- Name your targets with the ids read tools return (`ids`, `nodeId`, `layerId`, a range). They are
|
|
@@ -73,6 +74,10 @@ or without it, and calls simply take a little longer while it plays.
|
|
|
73
74
|
- A batch (`run_commands`) plays its steps' moves first, then applies once as one undo step.
|
|
74
75
|
- If you connect over MCP, your client's name labels your cursor; several agents get separate
|
|
75
76
|
cursors.
|
|
77
|
+
- If the host registers `say`, use it sparingly to tell the user why, before a change that
|
|
78
|
+
is not obvious from the cursor alone (one short sentence). It shows beside your cursor on the
|
|
79
|
+
editor you last changed, so call it after your first write there; `shown: false` means no
|
|
80
|
+
cursor was on screen, which is fine: carry on. Never call it instead of doing the work.
|
|
76
81
|
|
|
77
82
|
## Errors
|
|
78
83
|
|
|
@@ -102,6 +107,7 @@ Never repeat an identical failing call. Never work around a read-only refusal; t
|
|
|
102
107
|
| `list_commands` | Discover the commands an editor registers: id, label, group, params JSON Schema, shortcuts, and whether each is enabled now (with the reason when it is not). Filter with `query`; pass `enabledOnly: true` to see only what you can run now. |
|
|
103
108
|
| `run_command` | Run one command by `id` with `params` matching its schema. Disabled commands and unknown params fail with a reason; read it before retrying. |
|
|
104
109
|
| `run_commands` | Run several commands in order as `steps`. A param string `"$0.id"` or `"$last.id"` is replaced by that path of an earlier step's result, so a step can use an id an earlier step created. Pass `atomic: true` and a `label` to make the batch one undo step that rolls back entirely on failure; without it, steps before a failure stay applied. |
|
|
110
|
+
| `say` | Optional; only where the host shows your cursor. Put one short sentence (`text`, at most 200 characters) in the bubble beside your cursor so the user can follow why you are about to change something. Returns `shown` and the `surface` it appeared on (`shown: false`, `surface: null` when no cursor is on screen, which is not an error). Call it after a write on that editor, before the next one. Changes nothing. |
|
|
105
111
|
|
|
106
112
|
## Commands
|
|
107
113
|
|