@pixerate/editor 0.167.0 → 0.169.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.
@@ -25,7 +25,7 @@ require('../chunk-4EFNS2HV.cjs');
25
25
 
26
26
 
27
27
 
28
- var _chunkZ2UQYMPScjs = require('../chunk-Z2UQYMPS.cjs');
28
+ var _chunkNJGFSOPPcjs = require('../chunk-NJGFSOPP.cjs');
29
29
 
30
30
 
31
31
 
@@ -63,7 +63,7 @@ var _chunkAMX23CSNcjs = require('../chunk-AMX23CSN.cjs');
63
63
 
64
64
 
65
65
 
66
- var _chunkGMWNBSBScjs = require('../chunk-GMWNBSBS.cjs');
66
+ var _chunk5EMS4BZGcjs = require('../chunk-5EMS4BZG.cjs');
67
67
 
68
68
 
69
69
 
@@ -601,7 +601,7 @@ function planCanvasPlaybackSteps(steps, nodes, rectOptions) {
601
601
  const node = placed.get(id);
602
602
  if (node) placed.set(id, { ...node, position });
603
603
  }
604
- const rect = _chunkGMWNBSBScjs.unionRects.call(void 0, moved.map(([id]) => rectOf(id)));
604
+ const rect = _chunk5EMS4BZGcjs.unionRects.call(void 0, moved.map(([id]) => rectOf(id)));
605
605
  if (rect) after.push({ type: "move", to: centre(rect) }, { type: "focus", rect }, { type: "wait", ms: 450 });
606
606
  break;
607
607
  }
@@ -2271,4 +2271,4 @@ function createCanvasComponentToolProvider(controller, options = { id: "canvas-c
2271
2271
 
2272
2272
 
2273
2273
 
2274
- exports.AgentPlayback = _chunkGMWNBSBScjs.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 = _chunkAMX23CSNcjs.JSON_RPC_ERRORS; exports.MCP_PROTOCOL_VERSIONS = _chunkAMX23CSNcjs.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 = _chunkSWTUM32Hcjs.PRESENCE_COLORS; exports.PerformanceQueue = _chunkSWTUM32Hcjs.PerformanceQueue; exports.PresenceStore = _chunkSWTUM32Hcjs.PresenceStore; exports.TOOL_BRIDGE_DEFAULT_PORT = _chunkAMX23CSNcjs.TOOL_BRIDGE_DEFAULT_PORT; exports.TOOL_BRIDGE_PROTOCOL = _chunkAMX23CSNcjs.TOOL_BRIDGE_PROTOCOL; exports.TOOL_DISCOVERY_TOOLS = _chunkAMX23CSNcjs.TOOL_DISCOVERY_TOOLS; exports.TOOL_NAMESPACE_SEPARATOR = _chunkAMX23CSNcjs.TOOL_NAMESPACE_SEPARATOR; exports.ToolRegistry = _chunkAMX23CSNcjs.ToolRegistry; exports.ToolRegistryError = _chunkAMX23CSNcjs.ToolRegistryError; exports.ToolRegistryView = _chunkAMX23CSNcjs.ToolRegistryView; exports.UNSAFE_JSON_KEYS = _chunk2BSBFBOAcjs.UNSAFE_JSON_KEYS; exports.baseToolName = _chunkAMX23CSNcjs.baseToolName; exports.captureInputSchema = _chunkN2FGYZ4Qcjs.captureInputSchema; exports.captureOutputSize = _chunkN2FGYZ4Qcjs.captureOutputSize; exports.cloneElementWithStyles = _chunkSVFEVKLFcjs.cloneElementWithStyles; exports.connectToolBridge = _chunkAMX23CSNcjs.connectToolBridge; exports.createAgentPlayback = _chunkGMWNBSBScjs.createAgentPlayback; exports.createCanvasComponentToolProvider = createCanvasComponentToolProvider; exports.createCaptureTool = _chunkN2FGYZ4Qcjs.createCaptureTool; exports.createCaptureToolProvider = _chunkN2FGYZ4Qcjs.createCaptureToolProvider; exports.createDocumentChartTools = createDocumentChartTools; exports.createEditorMcpToolProvider = createEditorMcpToolProvider; exports.createElementCaptureSurface = _chunkSVFEVKLFcjs.createElementCaptureSurface; exports.createInstantPresenceClock = _chunkSWTUM32Hcjs.createInstantPresenceClock; exports.createMcpServer = _chunkAMX23CSNcjs.createMcpServer; exports.createPlaybackToolProvider = _chunkGMWNBSBScjs.createPlaybackToolProvider; exports.createRichTextToolProvider = createRichTextToolProvider; exports.createSpreadsheetToolProvider = createSpreadsheetToolProvider; exports.createStyleResolver = _chunkZ2UQYMPScjs.createStyleResolver; exports.createStyleToolProvider = _chunkZ2UQYMPScjs.createStyleToolProvider; exports.createToolRegistry = _chunkAMX23CSNcjs.createToolRegistry; exports.derivePlaybackSteps = _chunkGMWNBSBScjs.derivePlaybackSteps; exports.elementToSvg = _chunkSVFEVKLFcjs.elementToSvg; exports.errorResult = _chunkAMX23CSNcjs.errorResult; exports.isUnsafeJsonKey = _chunk2BSBFBOAcjs.isUnsafeJsonKey; exports.listSkills = _chunkAMX23CSNcjs.listSkills; exports.locatePlaybackChrome = _chunkGMWNBSBScjs.locatePlaybackChrome; exports.memoryStyleStore = _chunkZ2UQYMPScjs.memoryStyleStore; exports.normalizeSide = normalizeSide; exports.parseSkillFrontmatter = _chunkAMX23CSNcjs.parseSkillFrontmatter; exports.parseStyleDomains = _chunkZ2UQYMPScjs.parseStyleDomains; exports.planAgentCommand = planAgentCommand; exports.planCanvasPlaybackSteps = planCanvasPlaybackSteps; exports.planCanvasToolPlayback = planCanvasToolPlayback; exports.planToolCall = planToolCall; exports.playbackRectFromClient = _chunkGMWNBSBScjs.playbackRectFromClient; exports.playbackRefsFromArgs = _chunkGMWNBSBScjs.playbackRefsFromArgs; exports.playbackRefsFromResult = _chunkGMWNBSBScjs.playbackRefsFromResult; exports.rasterizeElement = _chunkSVFEVKLFcjs.rasterizeElement; exports.readSkillFile = _chunkAMX23CSNcjs.readSkillFile; exports.readingTime = _chunkGMWNBSBScjs.readingTime; exports.realPresenceClock = _chunkSWTUM32Hcjs.realPresenceClock; exports.renderStyle = _chunkZ2UQYMPScjs.renderStyle; exports.resolveCaptureRequest = _chunkN2FGYZ4Qcjs.resolveCaptureRequest; exports.runStyleChecks = _chunkZ2UQYMPScjs.runStyleChecks; exports.runToolScript = _chunkZ2UQYMPScjs.runToolScript; exports.searchTokens = _chunkAMX23CSNcjs.searchTokens; exports.searchTools = _chunkAMX23CSNcjs.searchTools; exports.stripPrototypeKeys = _chunk2BSBFBOAcjs.stripPrototypeKeys; exports.summarize = _chunkAMX23CSNcjs.summarize; exports.toCapturedImageData = _chunkN2FGYZ4Qcjs.toCapturedImageData; exports.toToolResult = _chunkAMX23CSNcjs.toToolResult; exports.toolCallToAgentCommand = toolCallToAgentCommand; exports.toolResultError = _chunkZ2UQYMPScjs.toolResultError; exports.toolResultValue = _chunkZ2UQYMPScjs.toolResultValue; exports.toolsetInstructions = _chunkAMX23CSNcjs.toolsetInstructions; exports.toolsetName = _chunkAMX23CSNcjs.toolsetName; exports.trackPresenceDrag = _chunkSWTUM32Hcjs.trackPresenceDrag; exports.tweenPresenceCursor = _chunkSWTUM32Hcjs.tweenPresenceCursor; exports.unionCaptureRects = _chunkN2FGYZ4Qcjs.unionCaptureRects; exports.unionRects = _chunkGMWNBSBScjs.unionRects; exports.unknownToolMessage = _chunkAMX23CSNcjs.unknownToolMessage; exports.validateAgentCommand = validateAgentCommand; exports.validateJsonSchema = _chunkWOFXZ3XUcjs.validateJsonSchema;
2274
+ exports.AgentPlayback = _chunk5EMS4BZGcjs.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 = _chunkAMX23CSNcjs.JSON_RPC_ERRORS; exports.MCP_PROTOCOL_VERSIONS = _chunkAMX23CSNcjs.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 = _chunkSWTUM32Hcjs.PRESENCE_COLORS; exports.PerformanceQueue = _chunkSWTUM32Hcjs.PerformanceQueue; exports.PresenceStore = _chunkSWTUM32Hcjs.PresenceStore; exports.TOOL_BRIDGE_DEFAULT_PORT = _chunkAMX23CSNcjs.TOOL_BRIDGE_DEFAULT_PORT; exports.TOOL_BRIDGE_PROTOCOL = _chunkAMX23CSNcjs.TOOL_BRIDGE_PROTOCOL; exports.TOOL_DISCOVERY_TOOLS = _chunkAMX23CSNcjs.TOOL_DISCOVERY_TOOLS; exports.TOOL_NAMESPACE_SEPARATOR = _chunkAMX23CSNcjs.TOOL_NAMESPACE_SEPARATOR; exports.ToolRegistry = _chunkAMX23CSNcjs.ToolRegistry; exports.ToolRegistryError = _chunkAMX23CSNcjs.ToolRegistryError; exports.ToolRegistryView = _chunkAMX23CSNcjs.ToolRegistryView; exports.UNSAFE_JSON_KEYS = _chunk2BSBFBOAcjs.UNSAFE_JSON_KEYS; exports.baseToolName = _chunkAMX23CSNcjs.baseToolName; exports.captureInputSchema = _chunkN2FGYZ4Qcjs.captureInputSchema; exports.captureOutputSize = _chunkN2FGYZ4Qcjs.captureOutputSize; exports.cloneElementWithStyles = _chunkSVFEVKLFcjs.cloneElementWithStyles; exports.connectToolBridge = _chunkAMX23CSNcjs.connectToolBridge; exports.createAgentPlayback = _chunk5EMS4BZGcjs.createAgentPlayback; exports.createCanvasComponentToolProvider = createCanvasComponentToolProvider; exports.createCaptureTool = _chunkN2FGYZ4Qcjs.createCaptureTool; exports.createCaptureToolProvider = _chunkN2FGYZ4Qcjs.createCaptureToolProvider; exports.createDocumentChartTools = createDocumentChartTools; exports.createEditorMcpToolProvider = createEditorMcpToolProvider; exports.createElementCaptureSurface = _chunkSVFEVKLFcjs.createElementCaptureSurface; exports.createInstantPresenceClock = _chunkSWTUM32Hcjs.createInstantPresenceClock; exports.createMcpServer = _chunkAMX23CSNcjs.createMcpServer; exports.createPlaybackToolProvider = _chunk5EMS4BZGcjs.createPlaybackToolProvider; exports.createRichTextToolProvider = createRichTextToolProvider; exports.createSpreadsheetToolProvider = createSpreadsheetToolProvider; exports.createStyleResolver = _chunkNJGFSOPPcjs.createStyleResolver; exports.createStyleToolProvider = _chunkNJGFSOPPcjs.createStyleToolProvider; exports.createToolRegistry = _chunkAMX23CSNcjs.createToolRegistry; exports.derivePlaybackSteps = _chunk5EMS4BZGcjs.derivePlaybackSteps; exports.elementToSvg = _chunkSVFEVKLFcjs.elementToSvg; exports.errorResult = _chunkAMX23CSNcjs.errorResult; exports.isUnsafeJsonKey = _chunk2BSBFBOAcjs.isUnsafeJsonKey; exports.listSkills = _chunkAMX23CSNcjs.listSkills; exports.locatePlaybackChrome = _chunk5EMS4BZGcjs.locatePlaybackChrome; exports.memoryStyleStore = _chunkNJGFSOPPcjs.memoryStyleStore; exports.normalizeSide = normalizeSide; exports.parseSkillFrontmatter = _chunkAMX23CSNcjs.parseSkillFrontmatter; exports.parseStyleDomains = _chunkNJGFSOPPcjs.parseStyleDomains; exports.planAgentCommand = planAgentCommand; exports.planCanvasPlaybackSteps = planCanvasPlaybackSteps; exports.planCanvasToolPlayback = planCanvasToolPlayback; exports.planToolCall = planToolCall; exports.playbackRectFromClient = _chunk5EMS4BZGcjs.playbackRectFromClient; exports.playbackRefsFromArgs = _chunk5EMS4BZGcjs.playbackRefsFromArgs; exports.playbackRefsFromResult = _chunk5EMS4BZGcjs.playbackRefsFromResult; exports.rasterizeElement = _chunkSVFEVKLFcjs.rasterizeElement; exports.readSkillFile = _chunkAMX23CSNcjs.readSkillFile; exports.readingTime = _chunk5EMS4BZGcjs.readingTime; exports.realPresenceClock = _chunkSWTUM32Hcjs.realPresenceClock; exports.renderStyle = _chunkNJGFSOPPcjs.renderStyle; exports.resolveCaptureRequest = _chunkN2FGYZ4Qcjs.resolveCaptureRequest; exports.runStyleChecks = _chunkNJGFSOPPcjs.runStyleChecks; exports.runToolScript = _chunkNJGFSOPPcjs.runToolScript; exports.searchTokens = _chunkAMX23CSNcjs.searchTokens; exports.searchTools = _chunkAMX23CSNcjs.searchTools; exports.stripPrototypeKeys = _chunk2BSBFBOAcjs.stripPrototypeKeys; exports.summarize = _chunkAMX23CSNcjs.summarize; exports.toCapturedImageData = _chunkN2FGYZ4Qcjs.toCapturedImageData; exports.toToolResult = _chunkAMX23CSNcjs.toToolResult; exports.toolCallToAgentCommand = toolCallToAgentCommand; exports.toolResultError = _chunkNJGFSOPPcjs.toolResultError; exports.toolResultValue = _chunkNJGFSOPPcjs.toolResultValue; exports.toolsetInstructions = _chunkAMX23CSNcjs.toolsetInstructions; exports.toolsetName = _chunkAMX23CSNcjs.toolsetName; exports.trackPresenceDrag = _chunkSWTUM32Hcjs.trackPresenceDrag; exports.tweenPresenceCursor = _chunkSWTUM32Hcjs.tweenPresenceCursor; exports.unionCaptureRects = _chunkN2FGYZ4Qcjs.unionCaptureRects; exports.unionRects = _chunk5EMS4BZGcjs.unionRects; exports.unknownToolMessage = _chunkAMX23CSNcjs.unknownToolMessage; exports.validateAgentCommand = validateAgentCommand; exports.validateJsonSchema = _chunkWOFXZ3XUcjs.validateJsonSchema;
@@ -25,7 +25,7 @@ import {
25
25
  runToolScript,
26
26
  toolResultError,
27
27
  toolResultValue
28
- } from "../chunk-HIDFL5LQ.js";
28
+ } from "../chunk-ZXTO6U7T.js";
29
29
  import {
30
30
  JSON_RPC_ERRORS,
31
31
  MCP_PROTOCOL_VERSIONS,
@@ -63,7 +63,7 @@ import {
63
63
  playbackRefsFromResult,
64
64
  readingTime,
65
65
  unionRects
66
- } from "../chunk-6DXDUVSL.js";
66
+ } from "../chunk-WL4IN36A.js";
67
67
  import {
68
68
  CAPTURE_EXCLUDE_SELECTOR,
69
69
  CAPTURE_OVERLAY_SELECTORS,
@@ -102,7 +102,31 @@ function normalizePlan(plan) {
102
102
  var isErrorResult = (value) => !!value && typeof value === "object" && value.isError === true;
103
103
  var center = (r) => ({ x: r.x + r.width / 2, y: r.y + r.height / 2 });
104
104
  var finiteRect = (r) => r && [r.x, r.y, r.width, r.height].every(Number.isFinite) ? r : null;
105
- var GLANCE_STEPS = /* @__PURE__ */ new Set(["move", "target", "focus", "say", "wait", "commit"]);
105
+ var GLANCE_STEPS = /* @__PURE__ */ new Set(["move", "target", "focus", "say", "wait", "commit", "stage"]);
106
+ function createStageGate() {
107
+ let credits = 0;
108
+ let opened = false;
109
+ const waiting = [];
110
+ return {
111
+ wait: () => {
112
+ if (opened) return Promise.resolve();
113
+ if (credits > 0) {
114
+ credits--;
115
+ return Promise.resolve();
116
+ }
117
+ return new Promise((resolve) => waiting.push(resolve));
118
+ },
119
+ release() {
120
+ const next = waiting.shift();
121
+ if (next) next();
122
+ else credits++;
123
+ },
124
+ open() {
125
+ opened = true;
126
+ waiting.splice(0).forEach((resolve) => resolve());
127
+ }
128
+ };
129
+ }
106
130
  var AgentPlayback = (_class = class {
107
131
  /** 1 = natural pace; `Infinity` plays nothing (calls run instantly). Takes effect on the next step. */
108
132
 
@@ -268,13 +292,25 @@ var AgentPlayback = (_class = class {
268
292
  if (!readOnly) _optionalChain([surface, 'access', _36 => _36.beginGesture, 'optionalCall', _37 => _37(`agent:${id}:${++this.calls}`)]);
269
293
  let result;
270
294
  let committed = false;
295
+ const gate = run.steps.some((s) => s.type === "stage") ? createStageGate() : null;
296
+ if (gate) call.context.stage = gate.wait;
297
+ let pending = null;
271
298
  try {
272
299
  for (const step of run.steps) {
273
300
  record(step);
274
301
  if (step.type === "commit") {
275
302
  if (committed) continue;
276
303
  committed = true;
277
- result = await next();
304
+ if (gate) {
305
+ pending = next();
306
+ pending.catch(() => {
307
+ });
308
+ } else result = await next();
309
+ continue;
310
+ }
311
+ if (step.type === "stage") {
312
+ _optionalChain([gate, 'optionalAccess', _38 => _38.release, 'call', _39 => _39()]);
313
+ await wait(120);
278
314
  continue;
279
315
  }
280
316
  if (step.type === "open") {
@@ -294,18 +330,23 @@ var AgentPlayback = (_class = class {
294
330
  }
295
331
  if (!committed) {
296
332
  record({ type: "commit" });
297
- result = await next();
333
+ pending = next();
334
+ }
335
+ if (pending) {
336
+ _optionalChain([gate, 'optionalAccess', _40 => _40.open, 'call', _41 => _41()]);
337
+ result = await pending;
298
338
  }
299
339
  } catch (error) {
340
+ _optionalChain([gate, 'optionalAccess', _42 => _42.open, 'call', _43 => _43()]);
300
341
  presence.set({ id, pressed: false, message: `\u2717 ${error instanceof Error ? error.message : String(error)}`.slice(0, 140) });
301
342
  await wait(900);
302
343
  throw error;
303
344
  } finally {
304
- if (!readOnly) _optionalChain([surface, 'access', _38 => _38.endGesture, 'optionalCall', _39 => _39()]);
345
+ if (!readOnly) _optionalChain([surface, 'access', _44 => _44.endGesture, 'optionalCall', _45 => _45()]);
305
346
  presence.set({ id, pressed: false });
306
347
  }
307
348
  if (isErrorResult(result)) {
308
- const text = _nullishCoalesce(_optionalChain([result, 'access', _40 => _40.content, 'optionalAccess', _41 => _41.find, 'call', _42 => _42((c) => c.type === "text"), 'optionalAccess', _43 => _43.text]), () => ( "The tool failed."));
349
+ const text = _nullishCoalesce(_optionalChain([result, 'access', _46 => _46.content, 'optionalAccess', _47 => _47.find, 'call', _48 => _48((c) => c.type === "text"), 'optionalAccess', _49 => _49.text]), () => ( "The tool failed."));
309
350
  presence.set({ id, message: `\u2717 ${text}`.slice(0, 140) });
310
351
  await wait(900);
311
352
  } else if (!readOnly) {
@@ -192,9 +192,11 @@ async function createEffectAuthoringSession(source, options) {
192
192
  let playing = false;
193
193
  let cancelSchedule = null;
194
194
  let lastScheduleTime = null;
195
- let playheadTime = 0;
196
195
  let duration = _nullishCoalesce(_nullishCoalesce(_optionalChain([initialDoc, 'optionalAccess', _ => _.duration]), () => ( description.duration)), () => ( 1e3));
197
196
  if (!(duration > 0)) duration = 1e3;
197
+ const start = options.startTime;
198
+ let playheadTime = typeof start === "number" && Number.isFinite(start) ? Math.max(0, Math.min(duration, start)) : duration / 2;
199
+ let previewError = null;
198
200
  let loop = _nullishCoalesce(_nullishCoalesce(_optionalChain([initialDoc, 'optionalAccess', _2 => _2.loop]), () => ( description.loop)), () => ( false));
199
201
  let compiled = null;
200
202
  let savedPresets = initialDoc ? [..._nullishCoalesce(initialDoc.presets, () => ( []))] : [];
@@ -258,6 +260,7 @@ async function createEffectAuthoringSession(source, options) {
258
260
  tracks: { ...tracks },
259
261
  issues: [],
260
262
  compiled,
263
+ previewError,
261
264
  time: playheadTime,
262
265
  duration,
263
266
  loop,
@@ -704,8 +707,23 @@ async function createEffectAuthoringSession(source, options) {
704
707
  if (disposed) {
705
708
  throw new (0, _chunkRUZQMYXHcjs.EffectDisposedError)(effectId);
706
709
  }
707
- const renderer = await provider.createRenderer(effectId, opts);
710
+ let renderer;
711
+ try {
712
+ renderer = await provider.createRenderer(effectId, opts);
713
+ } catch (e) {
714
+ const message = e instanceof Error ? e.message : String(e);
715
+ const reason = description.kind === "vector" ? `No pixel preview for this vector effect: ${message}` : `No pixel preview: ${message}`;
716
+ if (previewError !== reason) {
717
+ previewError = reason;
718
+ invalidateState();
719
+ }
720
+ throw e;
721
+ }
708
722
  livePreviews.add(renderer);
723
+ if (previewError !== null) {
724
+ previewError = null;
725
+ invalidateState();
726
+ }
709
727
  const preview = {
710
728
  effectId: renderer.effectId,
711
729
  width: renderer.width,
@@ -192,9 +192,11 @@ async function createEffectAuthoringSession(source, options) {
192
192
  let playing = false;
193
193
  let cancelSchedule = null;
194
194
  let lastScheduleTime = null;
195
- let playheadTime = 0;
196
195
  let duration = initialDoc?.duration ?? description.duration ?? 1e3;
197
196
  if (!(duration > 0)) duration = 1e3;
197
+ const start = options.startTime;
198
+ let playheadTime = typeof start === "number" && Number.isFinite(start) ? Math.max(0, Math.min(duration, start)) : duration / 2;
199
+ let previewError = null;
198
200
  let loop = initialDoc?.loop ?? description.loop ?? false;
199
201
  let compiled = null;
200
202
  let savedPresets = initialDoc ? [...initialDoc.presets ?? []] : [];
@@ -258,6 +260,7 @@ async function createEffectAuthoringSession(source, options) {
258
260
  tracks: { ...tracks },
259
261
  issues: [],
260
262
  compiled,
263
+ previewError,
261
264
  time: playheadTime,
262
265
  duration,
263
266
  loop,
@@ -704,8 +707,23 @@ async function createEffectAuthoringSession(source, options) {
704
707
  if (disposed) {
705
708
  throw new EffectDisposedError(effectId);
706
709
  }
707
- const renderer = await provider.createRenderer(effectId, opts);
710
+ let renderer;
711
+ try {
712
+ renderer = await provider.createRenderer(effectId, opts);
713
+ } catch (e) {
714
+ const message = e instanceof Error ? e.message : String(e);
715
+ const reason = description.kind === "vector" ? `No pixel preview for this vector effect: ${message}` : `No pixel preview: ${message}`;
716
+ if (previewError !== reason) {
717
+ previewError = reason;
718
+ invalidateState();
719
+ }
720
+ throw e;
721
+ }
708
722
  livePreviews.add(renderer);
723
+ if (previewError !== null) {
724
+ previewError = null;
725
+ invalidateState();
726
+ }
709
727
  const preview = {
710
728
  effectId: renderer.effectId,
711
729
  width: renderer.width,
@@ -3,7 +3,7 @@
3
3
  var _chunkAMX23CSNcjs = require('./chunk-AMX23CSN.cjs');
4
4
 
5
5
 
6
- var _chunkGMWNBSBScjs = require('./chunk-GMWNBSBS.cjs');
6
+ var _chunk5EMS4BZGcjs = require('./chunk-5EMS4BZG.cjs');
7
7
 
8
8
 
9
9
  var _chunkWOFXZ3XUcjs = require('./chunk-WOFXZ3XU.cjs');
@@ -46,7 +46,7 @@ async function runToolScript(source, script, options = {}) {
46
46
  if (step.say) {
47
47
  emit({ type: "say", step: i, text: step.say });
48
48
  _optionalChain([options, 'access', _6 => _6.playback, 'optionalAccess', _7 => _7.say, 'call', _8 => _8(step.say, options.actor ? { actor: options.actor } : {})]);
49
- await pause(_chunkGMWNBSBScjs.readingTime.call(void 0, step.say));
49
+ await pause(_chunk5EMS4BZGcjs.readingTime.call(void 0, step.say));
50
50
  }
51
51
  if (!step.tool) continue;
52
52
  if (control.stopped) return finish(false);
@@ -102,7 +102,31 @@ function normalizePlan(plan) {
102
102
  var isErrorResult = (value) => !!value && typeof value === "object" && value.isError === true;
103
103
  var center = (r) => ({ x: r.x + r.width / 2, y: r.y + r.height / 2 });
104
104
  var finiteRect = (r) => r && [r.x, r.y, r.width, r.height].every(Number.isFinite) ? r : null;
105
- var GLANCE_STEPS = /* @__PURE__ */ new Set(["move", "target", "focus", "say", "wait", "commit"]);
105
+ var GLANCE_STEPS = /* @__PURE__ */ new Set(["move", "target", "focus", "say", "wait", "commit", "stage"]);
106
+ function createStageGate() {
107
+ let credits = 0;
108
+ let opened = false;
109
+ const waiting = [];
110
+ return {
111
+ wait: () => {
112
+ if (opened) return Promise.resolve();
113
+ if (credits > 0) {
114
+ credits--;
115
+ return Promise.resolve();
116
+ }
117
+ return new Promise((resolve) => waiting.push(resolve));
118
+ },
119
+ release() {
120
+ const next = waiting.shift();
121
+ if (next) next();
122
+ else credits++;
123
+ },
124
+ open() {
125
+ opened = true;
126
+ waiting.splice(0).forEach((resolve) => resolve());
127
+ }
128
+ };
129
+ }
106
130
  var AgentPlayback = class {
107
131
  /** 1 = natural pace; `Infinity` plays nothing (calls run instantly). Takes effect on the next step. */
108
132
  speed;
@@ -268,13 +292,25 @@ var AgentPlayback = class {
268
292
  if (!readOnly) surface.beginGesture?.(`agent:${id}:${++this.calls}`);
269
293
  let result;
270
294
  let committed = false;
295
+ const gate = run.steps.some((s) => s.type === "stage") ? createStageGate() : null;
296
+ if (gate) call.context.stage = gate.wait;
297
+ let pending = null;
271
298
  try {
272
299
  for (const step of run.steps) {
273
300
  record(step);
274
301
  if (step.type === "commit") {
275
302
  if (committed) continue;
276
303
  committed = true;
277
- result = await next();
304
+ if (gate) {
305
+ pending = next();
306
+ pending.catch(() => {
307
+ });
308
+ } else result = await next();
309
+ continue;
310
+ }
311
+ if (step.type === "stage") {
312
+ gate?.release();
313
+ await wait(120);
278
314
  continue;
279
315
  }
280
316
  if (step.type === "open") {
@@ -294,9 +330,14 @@ var AgentPlayback = class {
294
330
  }
295
331
  if (!committed) {
296
332
  record({ type: "commit" });
297
- result = await next();
333
+ pending = next();
334
+ }
335
+ if (pending) {
336
+ gate?.open();
337
+ result = await pending;
298
338
  }
299
339
  } catch (error) {
340
+ gate?.open();
300
341
  presence.set({ id, pressed: false, message: `\u2717 ${error instanceof Error ? error.message : String(error)}`.slice(0, 140) });
301
342
  await wait(900);
302
343
  throw error;
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-XZB3TJ6K.js";
4
4
  import {
5
5
  readingTime
6
- } from "./chunk-6DXDUVSL.js";
6
+ } from "./chunk-WL4IN36A.js";
7
7
  import {
8
8
  validateJsonSchema
9
9
  } from "./chunk-V2ZCJRDM.js";
@@ -29,7 +29,7 @@ var _chunkGLQQ2VILcjs = require('../chunk-GLQQ2VIL.cjs');
29
29
  var _chunk4EFNS2HVcjs = require('../chunk-4EFNS2HV.cjs');
30
30
 
31
31
 
32
- var _chunkGMWNBSBScjs = require('../chunk-GMWNBSBS.cjs');
32
+ var _chunk5EMS4BZGcjs = require('../chunk-5EMS4BZG.cjs');
33
33
  require('../chunk-SWTUM32H.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 : _chunkGMWNBSBScjs.derivePlaybackSteps.call(void 0, params);
611
+ const steps = own.length ? own : _chunk5EMS4BZGcjs.derivePlaybackSteps.call(void 0, params);
612
612
  return {
613
613
  steps,
614
614
  ...surface ? { surface } : {},
@@ -29,7 +29,7 @@ import {
29
29
  } from "../chunk-7KZ2HKKC.js";
30
30
  import {
31
31
  derivePlaybackSteps
32
- } from "../chunk-6DXDUVSL.js";
32
+ } from "../chunk-WL4IN36A.js";
33
33
  import "../chunk-O2ANJFUF.js";
34
34
  import {
35
35
  validateJsonSchema
@@ -17,6 +17,11 @@ export interface GenericAuthoringOptions {
17
17
  schedule?: (frame: (now: number) => void) => () => void;
18
18
  /** Ms within which `setValue` calls on one control with no gesture merge (default 400). */
19
19
  mergeWindowMs?: number;
20
+ /**
21
+ * Where the playhead starts (ms, clamped to 0..duration). Default: half the duration, as
22
+ * catalog thumbnails do, so entrance-style effects and transitions open on a frame that shows them.
23
+ */
24
+ startTime?: number;
20
25
  }
21
26
  /**
22
27
  * Creates an effect authoring session with values, presets, keyframes, timing and undo
@@ -17,6 +17,11 @@ export interface GenericAuthoringOptions {
17
17
  schedule?: (frame: (now: number) => void) => () => void;
18
18
  /** Ms within which `setValue` calls on one control with no gesture merge (default 400). */
19
19
  mergeWindowMs?: number;
20
+ /**
21
+ * Where the playhead starts (ms, clamped to 0..duration). Default: half the duration, as
22
+ * catalog thumbnails do, so entrance-style effects and transitions open on a frame that shows them.
23
+ */
24
+ startTime?: number;
20
25
  }
21
26
  /**
22
27
  * Creates an effect authoring session with values, presets, keyframes, timing and undo
@@ -65,6 +65,12 @@ export interface EffectAuthoringState {
65
65
  issues: readonly EffectAuthoringIssue[];
66
66
  /** Whether the source compiled: true, false, or null when that is not known yet (no preview has compiled it). */
67
67
  compiled: boolean | null;
68
+ /**
69
+ * Why `createPreview` could not make a pixel preview (for example a vector effect whose provider
70
+ * only draws it as SVG), or null when it could or has not been asked yet. Optional for sessions
71
+ * that never fail to preview.
72
+ */
73
+ previewError?: string | null;
68
74
  /** Current playhead position (ms). */
69
75
  time: number;
70
76
  /** Length of one play (ms). */
@@ -65,6 +65,12 @@ export interface EffectAuthoringState {
65
65
  issues: readonly EffectAuthoringIssue[];
66
66
  /** Whether the source compiled: true, false, or null when that is not known yet (no preview has compiled it). */
67
67
  compiled: boolean | null;
68
+ /**
69
+ * Why `createPreview` could not make a pixel preview (for example a vector effect whose provider
70
+ * only draws it as SVG), or null when it could or has not been asked yet. Optional for sessions
71
+ * that never fail to preview.
72
+ */
73
+ previewError?: string | null;
68
74
  /** Current playhead position (ms). */
69
75
  time: number;
70
76
  /** Length of one play (ms). */
@@ -3,7 +3,7 @@
3
3
  var _chunkFKUKJ3XAcjs = require('../chunk-FKUKJ3XA.cjs');
4
4
 
5
5
 
6
- var _chunk6DM3PUQDcjs = require('../chunk-6DM3PUQD.cjs');
6
+ var _chunkCYKWYP6Dcjs = require('../chunk-CYKWYP6D.cjs');
7
7
 
8
8
 
9
9
  var _chunkPY4GWSE2cjs = require('../chunk-PY4GWSE2.cjs');
@@ -568,7 +568,7 @@ function createFakeEffectProvider(options = {}) {
568
568
  };
569
569
  },
570
570
  ...supportsAuthoring ? {
571
- openAuthoring: (from) => _chunk6DM3PUQDcjs.createEffectAuthoringSession.call(void 0, from, { provider })
571
+ openAuthoring: (from) => _chunkCYKWYP6Dcjs.createEffectAuthoringSession.call(void 0, from, { provider })
572
572
  } : {}
573
573
  };
574
574
  return provider;
@@ -738,7 +738,7 @@ function createEffectAuthoringToolProvider(host, options) {
738
738
  const describeTool = {
739
739
  name: "effect_authoring_describe",
740
740
  title: "Describe open effect",
741
- description: "Describes the effect currently open for authoring: name, kind, source language, controls schema and current values, presets, animated tracks with keyframe counts, duration, loop, and compile issues.",
741
+ description: "Describes the effect currently open for authoring: name, kind, source language, controls schema and current values, presets, animated tracks with keyframe counts, playhead time, duration, loop, compile issues, and previewError: why there is no pixel preview (e.g. a vector effect the provider only draws as SVG), or null.",
742
742
  inputSchema: object({}),
743
743
  annotations: { title: "Describe open effect", ...ANNOTATIONS.read },
744
744
  handler: () => {
@@ -755,9 +755,11 @@ function createEffectAuthoringToolProvider(host, options) {
755
755
  control,
756
756
  keyframes: track.length
757
757
  })),
758
+ time: state.time,
758
759
  duration: state.duration,
759
760
  loop: state.loop,
760
- issues: state.issues
761
+ issues: state.issues,
762
+ previewError: _nullishCoalesce(state.previewError, () => ( null))
761
763
  };
762
764
  }
763
765
  };
@@ -1013,7 +1015,7 @@ function createEffectAuthoringToolProvider(host, options) {
1013
1015
  const viewTool = {
1014
1016
  name: "effect_authoring_view",
1015
1017
  title: "View effect preview image",
1016
- description: "Captures an image of the effect preview at the current playhead time or at a specified time in milliseconds.",
1018
+ description: "Captures an image of the effect preview at the current playhead time or at a specified time in milliseconds. Refused, with the reason, when the effect has no pixel preview (see previewError in effect_authoring_describe).",
1017
1019
  inputSchema: object({
1018
1020
  time: { type: "number", minimum: 0, description: "Optional time in milliseconds to view the preview at. Moves playhead to this time before capturing." }
1019
1021
  }),
@@ -1021,6 +1023,10 @@ function createEffectAuthoringToolProvider(host, options) {
1021
1023
  handler: async (args) => {
1022
1024
  const session = requireSession();
1023
1025
  if (!host.capture) throw new Error("Capturing a preview image is not supported by this host.");
1026
+ const previewError = session.getState().previewError;
1027
+ if (previewError) {
1028
+ throw new Error(`${previewError} The other effect authoring tools still work; check values with effect_authoring_describe.`);
1029
+ }
1024
1030
  if (args.time !== void 0) {
1025
1031
  if (typeof args.time !== "number" || !Number.isFinite(args.time) || args.time < 0) {
1026
1032
  throw new Error("time must be a finite non-negative number.");
@@ -1107,4 +1113,4 @@ function createEffectAuthoringToolProvider(host, options) {
1107
1113
 
1108
1114
 
1109
1115
 
1110
- exports.EFFECT_ERROR_CODES = _chunkRUZQMYXHcjs.EFFECT_ERROR_CODES; exports.EFFECT_KINDS = _chunkRUZQMYXHcjs.EFFECT_KINDS; exports.EFFECT_USES = _chunkRUZQMYXHcjs.EFFECT_USES; exports.EFFECT_USE_LABELS = EFFECT_USE_LABELS; exports.EffectControlError = _chunkRUZQMYXHcjs.EffectControlError; exports.EffectDisposedError = _chunkRUZQMYXHcjs.EffectDisposedError; exports.EffectError = _chunkRUZQMYXHcjs.EffectError; exports.EffectRendererPool = _chunkPY4GWSE2cjs.EffectRendererPool; exports.EffectUnsupportedError = _chunkRUZQMYXHcjs.EffectUnsupportedError; exports.EffectsSlot = _chunkRUZQMYXHcjs.EffectsSlot; exports.NoEffectsProviderError = _chunkRUZQMYXHcjs.NoEffectsProviderError; exports.UnknownEffectError = _chunkRUZQMYXHcjs.UnknownEffectError; exports.applyEffectMask = _chunkRUZQMYXHcjs.applyEffectMask; exports.checkEffectProvider = checkEffectProvider; exports.createEffectAuthoringSession = _chunk6DM3PUQDcjs.createEffectAuthoringSession; exports.createEffectAuthoringToolProvider = createEffectAuthoringToolProvider; exports.createEffectPixels = _chunkRUZQMYXHcjs.createEffectPixels; exports.createEffectToolProvider = _chunkRUZQMYXHcjs.createEffectToolProvider; exports.createFakeEffectProvider = createFakeEffectProvider; exports.effectControlField = effectControlField; exports.effectFieldValue = effectFieldValue; exports.effectFontFamilies = effectFontFamilies; exports.effectParameterFields = effectParameterFields; exports.effectSampleInputs = effectSampleInputs; exports.effectSamplePicture = effectSamplePicture; exports.effectValueErrors = _chunkRUZQMYXHcjs.effectValueErrors; exports.encodeEffectFloat = _chunkRUZQMYXHcjs.encodeEffectFloat; exports.groupEffectsByCategory = groupEffectsByCategory; exports.isEffectError = _chunkRUZQMYXHcjs.isEffectError; exports.isEffectFontControl = isEffectFontControl; exports.isEffectPixels = _chunkRUZQMYXHcjs.isEffectPixels; exports.linearToSrgb = _chunkRUZQMYXHcjs.linearToSrgb; exports.renderEffectThumbnail = renderEffectThumbnail; exports.resolveEffectValues = _chunkRUZQMYXHcjs.resolveEffectValues; exports.searchEffectSummaries = _chunkRUZQMYXHcjs.searchEffectSummaries; exports.srgbToLinear = _chunkRUZQMYXHcjs.srgbToLinear;
1116
+ exports.EFFECT_ERROR_CODES = _chunkRUZQMYXHcjs.EFFECT_ERROR_CODES; exports.EFFECT_KINDS = _chunkRUZQMYXHcjs.EFFECT_KINDS; exports.EFFECT_USES = _chunkRUZQMYXHcjs.EFFECT_USES; exports.EFFECT_USE_LABELS = EFFECT_USE_LABELS; exports.EffectControlError = _chunkRUZQMYXHcjs.EffectControlError; exports.EffectDisposedError = _chunkRUZQMYXHcjs.EffectDisposedError; exports.EffectError = _chunkRUZQMYXHcjs.EffectError; exports.EffectRendererPool = _chunkPY4GWSE2cjs.EffectRendererPool; exports.EffectUnsupportedError = _chunkRUZQMYXHcjs.EffectUnsupportedError; exports.EffectsSlot = _chunkRUZQMYXHcjs.EffectsSlot; exports.NoEffectsProviderError = _chunkRUZQMYXHcjs.NoEffectsProviderError; exports.UnknownEffectError = _chunkRUZQMYXHcjs.UnknownEffectError; exports.applyEffectMask = _chunkRUZQMYXHcjs.applyEffectMask; exports.checkEffectProvider = checkEffectProvider; exports.createEffectAuthoringSession = _chunkCYKWYP6Dcjs.createEffectAuthoringSession; exports.createEffectAuthoringToolProvider = createEffectAuthoringToolProvider; exports.createEffectPixels = _chunkRUZQMYXHcjs.createEffectPixels; exports.createEffectToolProvider = _chunkRUZQMYXHcjs.createEffectToolProvider; exports.createFakeEffectProvider = createFakeEffectProvider; exports.effectControlField = effectControlField; exports.effectFieldValue = effectFieldValue; exports.effectFontFamilies = effectFontFamilies; exports.effectParameterFields = effectParameterFields; exports.effectSampleInputs = effectSampleInputs; exports.effectSamplePicture = effectSamplePicture; exports.effectValueErrors = _chunkRUZQMYXHcjs.effectValueErrors; exports.encodeEffectFloat = _chunkRUZQMYXHcjs.encodeEffectFloat; exports.groupEffectsByCategory = groupEffectsByCategory; exports.isEffectError = _chunkRUZQMYXHcjs.isEffectError; exports.isEffectFontControl = isEffectFontControl; exports.isEffectPixels = _chunkRUZQMYXHcjs.isEffectPixels; exports.linearToSrgb = _chunkRUZQMYXHcjs.linearToSrgb; exports.renderEffectThumbnail = renderEffectThumbnail; exports.resolveEffectValues = _chunkRUZQMYXHcjs.resolveEffectValues; exports.searchEffectSummaries = _chunkRUZQMYXHcjs.searchEffectSummaries; exports.srgbToLinear = _chunkRUZQMYXHcjs.srgbToLinear;
@@ -3,7 +3,7 @@ import {
3
3
  } from "../chunk-CJE5MOIS.js";
4
4
  import {
5
5
  createEffectAuthoringSession
6
- } from "../chunk-ZGOHKS3X.js";
6
+ } from "../chunk-HCC2LBCW.js";
7
7
  import {
8
8
  EffectRendererPool
9
9
  } from "../chunk-EHLOCVWB.js";
@@ -738,7 +738,7 @@ function createEffectAuthoringToolProvider(host, options) {
738
738
  const describeTool = {
739
739
  name: "effect_authoring_describe",
740
740
  title: "Describe open effect",
741
- description: "Describes the effect currently open for authoring: name, kind, source language, controls schema and current values, presets, animated tracks with keyframe counts, duration, loop, and compile issues.",
741
+ description: "Describes the effect currently open for authoring: name, kind, source language, controls schema and current values, presets, animated tracks with keyframe counts, playhead time, duration, loop, compile issues, and previewError: why there is no pixel preview (e.g. a vector effect the provider only draws as SVG), or null.",
742
742
  inputSchema: object({}),
743
743
  annotations: { title: "Describe open effect", ...ANNOTATIONS.read },
744
744
  handler: () => {
@@ -755,9 +755,11 @@ function createEffectAuthoringToolProvider(host, options) {
755
755
  control,
756
756
  keyframes: track.length
757
757
  })),
758
+ time: state.time,
758
759
  duration: state.duration,
759
760
  loop: state.loop,
760
- issues: state.issues
761
+ issues: state.issues,
762
+ previewError: state.previewError ?? null
761
763
  };
762
764
  }
763
765
  };
@@ -1013,7 +1015,7 @@ function createEffectAuthoringToolProvider(host, options) {
1013
1015
  const viewTool = {
1014
1016
  name: "effect_authoring_view",
1015
1017
  title: "View effect preview image",
1016
- description: "Captures an image of the effect preview at the current playhead time or at a specified time in milliseconds.",
1018
+ description: "Captures an image of the effect preview at the current playhead time or at a specified time in milliseconds. Refused, with the reason, when the effect has no pixel preview (see previewError in effect_authoring_describe).",
1017
1019
  inputSchema: object({
1018
1020
  time: { type: "number", minimum: 0, description: "Optional time in milliseconds to view the preview at. Moves playhead to this time before capturing." }
1019
1021
  }),
@@ -1021,6 +1023,10 @@ function createEffectAuthoringToolProvider(host, options) {
1021
1023
  handler: async (args) => {
1022
1024
  const session = requireSession();
1023
1025
  if (!host.capture) throw new Error("Capturing a preview image is not supported by this host.");
1026
+ const previewError = session.getState().previewError;
1027
+ if (previewError) {
1028
+ throw new Error(`${previewError} The other effect authoring tools still work; check values with effect_authoring_describe.`);
1029
+ }
1024
1030
  if (args.time !== void 0) {
1025
1031
  if (typeof args.time !== "number" || !Number.isFinite(args.time) || args.time < 0) {
1026
1032
  throw new Error("time must be a finite non-negative number.");
@@ -1168,6 +1168,17 @@ var ImageCache = (_class = class {constructor() { _class.prototype.__init.call(t
1168
1168
  }
1169
1169
  }, _class);
1170
1170
  var globalImageCache = new ImageCache();
1171
+ var OVERLAY_HANDLE_EDGE = "#0284c7";
1172
+ function drawOverlayHandles(ctx, points) {
1173
+ const size = 10;
1174
+ ctx.fillStyle = "#ffffff";
1175
+ ctx.strokeStyle = OVERLAY_HANDLE_EDGE;
1176
+ ctx.lineWidth = 1.5;
1177
+ for (const h of points) {
1178
+ ctx.fillRect(h.x - size / 2, h.y - size / 2, size, size);
1179
+ ctx.strokeRect(h.x - size / 2, h.y - size / 2, size, size);
1180
+ }
1181
+ }
1171
1182
  var ImageEditorRenderer = (_class2 = class {constructor() { _class2.prototype.__init2.call(this);_class2.prototype.__init3.call(this);_class2.prototype.__init4.call(this);_class2.prototype.__init5.call(this);_class2.prototype.__init6.call(this);_class2.prototype.__init7.call(this);_class2.prototype.__init8.call(this);_class2.prototype.__init9.call(this);_class2.prototype.__init10.call(this);_class2.prototype.__init11.call(this);_class2.prototype.__init12.call(this);_class2.prototype.__init13.call(this);_class2.prototype.__init14.call(this);_class2.prototype.__init15.call(this);_class2.prototype.__init16.call(this);_class2.prototype.__init17.call(this);_class2.prototype.__init18.call(this);_class2.prototype.__init19.call(this);_class2.prototype.__init20.call(this);_class2.prototype.__init21.call(this);_class2.prototype.__init22.call(this); }
1172
1183
  __init2() {this.imageCache = globalImageCache}
1173
1184
  __init3() {this.cachedBaseCanvas = null}
@@ -1447,38 +1458,29 @@ var ImageEditorRenderer = (_class2 = class {constructor() { _class2.prototype.__
1447
1458
  outline.forEach((p, i) => i ? ctx.lineTo(p.x, p.y) : ctx.moveTo(p.x, p.y));
1448
1459
  ctx.closePath();
1449
1460
  }
1450
- ctx.lineWidth = 3;
1451
- ctx.strokeStyle = "rgba(0,0,0,0.5)";
1461
+ ctx.lineWidth = 4;
1462
+ ctx.strokeStyle = "rgba(0,0,0,0.25)";
1452
1463
  ctx.stroke();
1453
- ctx.lineWidth = 1;
1464
+ ctx.lineWidth = 2;
1454
1465
  ctx.strokeStyle = "#ffffff";
1455
1466
  ctx.stroke();
1456
- for (const h of [...t.handles, ..._nullishCoalesce(_optionalChain([t, 'access', _25 => _25.warp, 'optionalAccess', _26 => _26.anchors]), () => ( []))].map(scr)) {
1457
- ctx.fillStyle = "#ffffff";
1458
- ctx.strokeStyle = "#1e293b";
1459
- ctx.fillRect(h.x - 4, h.y - 4, 8, 8);
1460
- ctx.strokeRect(h.x - 4, h.y - 4, 8, 8);
1461
- }
1467
+ drawOverlayHandles(ctx, [...t.handles, ..._nullishCoalesce(_optionalChain([t, 'access', _25 => _25.warp, 'optionalAccess', _26 => _26.anchors]), () => ( []))].map(scr));
1462
1468
  for (const h of (_nullishCoalesce(_optionalChain([t, 'access', _27 => _27.warp, 'optionalAccess', _28 => _28.handles]), () => ( []))).map((w) => scr(w.point))) {
1463
1469
  ctx.beginPath();
1464
- ctx.arc(h.x, h.y, 3, 0, Math.PI * 2);
1470
+ ctx.arc(h.x, h.y, 3.5, 0, Math.PI * 2);
1465
1471
  ctx.fillStyle = "#ffffff";
1466
1472
  ctx.fill();
1467
- ctx.strokeStyle = "#1e293b";
1473
+ ctx.lineWidth = 1.5;
1474
+ ctx.strokeStyle = OVERLAY_HANDLE_EDGE;
1468
1475
  ctx.stroke();
1469
1476
  }
1470
1477
  const r = scr(t.reference);
1471
1478
  ctx.beginPath();
1472
- ctx.arc(r.x, r.y, 5, 0, Math.PI * 2);
1473
- ctx.moveTo(r.x - 8, r.y);
1474
- ctx.lineTo(r.x + 8, r.y);
1475
- ctx.moveTo(r.x, r.y - 8);
1476
- ctx.lineTo(r.x, r.y + 8);
1477
- ctx.lineWidth = 3;
1478
- ctx.strokeStyle = "rgba(0,0,0,0.5)";
1479
- ctx.stroke();
1480
- ctx.lineWidth = 1;
1481
- ctx.strokeStyle = "#ffffff";
1479
+ ctx.arc(r.x, r.y, 3.5, 0, Math.PI * 2);
1480
+ ctx.fillStyle = "rgba(255,255,255,0.9)";
1481
+ ctx.fill();
1482
+ ctx.lineWidth = 1.5;
1483
+ ctx.strokeStyle = OVERLAY_HANDLE_EDGE;
1482
1484
  ctx.stroke();
1483
1485
  } catch (e7) {
1484
1486
  }
@@ -2040,11 +2042,7 @@ var ImageEditorRenderer = (_class2 = class {constructor() { _class2.prototype.__
2040
2042
  ctx.moveTo(startX, startY + cropBoxH * 2 / 3);
2041
2043
  ctx.lineTo(startX + cropBoxW, startY + cropBoxH * 2 / 3);
2042
2044
  ctx.stroke();
2043
- ctx.fillStyle = "#ffffff";
2044
- ctx.strokeStyle = "#0284c7";
2045
- ctx.lineWidth = 1.5;
2046
- const handleSize = 10;
2047
- const handles = [
2045
+ drawOverlayHandles(ctx, [
2048
2046
  // Corners
2049
2047
  { x: startX, y: startY },
2050
2048
  { x: startX + cropBoxW, y: startY },
@@ -2055,11 +2053,7 @@ var ImageEditorRenderer = (_class2 = class {constructor() { _class2.prototype.__
2055
2053
  { x: startX + cropBoxW / 2, y: startY + cropBoxH },
2056
2054
  { x: startX, y: startY + cropBoxH / 2 },
2057
2055
  { x: startX + cropBoxW, y: startY + cropBoxH / 2 }
2058
- ];
2059
- for (const h of handles) {
2060
- ctx.fillRect(h.x - handleSize / 2, h.y - handleSize / 2, handleSize, handleSize);
2061
- ctx.strokeRect(h.x - handleSize / 2, h.y - handleSize / 2, handleSize, handleSize);
2062
- }
2056
+ ]);
2063
2057
  ctx.restore();
2064
2058
  }
2065
2059
  drawFittedImage(ctx, img, imgW, imgH, vpW, vpH, zoom, pan, fit = "margin") {
@@ -1168,6 +1168,17 @@ var ImageCache = class {
1168
1168
  }
1169
1169
  };
1170
1170
  var globalImageCache = new ImageCache();
1171
+ var OVERLAY_HANDLE_EDGE = "#0284c7";
1172
+ function drawOverlayHandles(ctx, points) {
1173
+ const size = 10;
1174
+ ctx.fillStyle = "#ffffff";
1175
+ ctx.strokeStyle = OVERLAY_HANDLE_EDGE;
1176
+ ctx.lineWidth = 1.5;
1177
+ for (const h of points) {
1178
+ ctx.fillRect(h.x - size / 2, h.y - size / 2, size, size);
1179
+ ctx.strokeRect(h.x - size / 2, h.y - size / 2, size, size);
1180
+ }
1181
+ }
1171
1182
  var ImageEditorRenderer = class {
1172
1183
  imageCache = globalImageCache;
1173
1184
  cachedBaseCanvas = null;
@@ -1447,38 +1458,29 @@ var ImageEditorRenderer = class {
1447
1458
  outline.forEach((p, i) => i ? ctx.lineTo(p.x, p.y) : ctx.moveTo(p.x, p.y));
1448
1459
  ctx.closePath();
1449
1460
  }
1450
- ctx.lineWidth = 3;
1451
- ctx.strokeStyle = "rgba(0,0,0,0.5)";
1461
+ ctx.lineWidth = 4;
1462
+ ctx.strokeStyle = "rgba(0,0,0,0.25)";
1452
1463
  ctx.stroke();
1453
- ctx.lineWidth = 1;
1464
+ ctx.lineWidth = 2;
1454
1465
  ctx.strokeStyle = "#ffffff";
1455
1466
  ctx.stroke();
1456
- for (const h of [...t.handles, ...t.warp?.anchors ?? []].map(scr)) {
1457
- ctx.fillStyle = "#ffffff";
1458
- ctx.strokeStyle = "#1e293b";
1459
- ctx.fillRect(h.x - 4, h.y - 4, 8, 8);
1460
- ctx.strokeRect(h.x - 4, h.y - 4, 8, 8);
1461
- }
1467
+ drawOverlayHandles(ctx, [...t.handles, ...t.warp?.anchors ?? []].map(scr));
1462
1468
  for (const h of (t.warp?.handles ?? []).map((w) => scr(w.point))) {
1463
1469
  ctx.beginPath();
1464
- ctx.arc(h.x, h.y, 3, 0, Math.PI * 2);
1470
+ ctx.arc(h.x, h.y, 3.5, 0, Math.PI * 2);
1465
1471
  ctx.fillStyle = "#ffffff";
1466
1472
  ctx.fill();
1467
- ctx.strokeStyle = "#1e293b";
1473
+ ctx.lineWidth = 1.5;
1474
+ ctx.strokeStyle = OVERLAY_HANDLE_EDGE;
1468
1475
  ctx.stroke();
1469
1476
  }
1470
1477
  const r = scr(t.reference);
1471
1478
  ctx.beginPath();
1472
- ctx.arc(r.x, r.y, 5, 0, Math.PI * 2);
1473
- ctx.moveTo(r.x - 8, r.y);
1474
- ctx.lineTo(r.x + 8, r.y);
1475
- ctx.moveTo(r.x, r.y - 8);
1476
- ctx.lineTo(r.x, r.y + 8);
1477
- ctx.lineWidth = 3;
1478
- ctx.strokeStyle = "rgba(0,0,0,0.5)";
1479
- ctx.stroke();
1480
- ctx.lineWidth = 1;
1481
- ctx.strokeStyle = "#ffffff";
1479
+ ctx.arc(r.x, r.y, 3.5, 0, Math.PI * 2);
1480
+ ctx.fillStyle = "rgba(255,255,255,0.9)";
1481
+ ctx.fill();
1482
+ ctx.lineWidth = 1.5;
1483
+ ctx.strokeStyle = OVERLAY_HANDLE_EDGE;
1482
1484
  ctx.stroke();
1483
1485
  } catch {
1484
1486
  }
@@ -2040,11 +2042,7 @@ var ImageEditorRenderer = class {
2040
2042
  ctx.moveTo(startX, startY + cropBoxH * 2 / 3);
2041
2043
  ctx.lineTo(startX + cropBoxW, startY + cropBoxH * 2 / 3);
2042
2044
  ctx.stroke();
2043
- ctx.fillStyle = "#ffffff";
2044
- ctx.strokeStyle = "#0284c7";
2045
- ctx.lineWidth = 1.5;
2046
- const handleSize = 10;
2047
- const handles = [
2045
+ drawOverlayHandles(ctx, [
2048
2046
  // Corners
2049
2047
  { x: startX, y: startY },
2050
2048
  { x: startX + cropBoxW, y: startY },
@@ -2055,11 +2053,7 @@ var ImageEditorRenderer = class {
2055
2053
  { x: startX + cropBoxW / 2, y: startY + cropBoxH },
2056
2054
  { x: startX, y: startY + cropBoxH / 2 },
2057
2055
  { x: startX + cropBoxW, y: startY + cropBoxH / 2 }
2058
- ];
2059
- for (const h of handles) {
2060
- ctx.fillRect(h.x - handleSize / 2, h.y - handleSize / 2, handleSize, handleSize);
2061
- ctx.strokeRect(h.x - handleSize / 2, h.y - handleSize / 2, handleSize, handleSize);
2062
- }
2056
+ ]);
2063
2057
  ctx.restore();
2064
2058
  }
2065
2059
  drawFittedImage(ctx, img, imgW, imgH, vpW, vpH, zoom, pan, fit = "margin") {
@@ -84,10 +84,6 @@ declare class ImageCache {
84
84
  clear(): void;
85
85
  }
86
86
  export declare const globalImageCache: ImageCache;
87
- /**
88
- * Renders an image with all its transformations, filters, depth masks, and annotations
89
- * to a target HTMLCanvasElement.
90
- */
91
87
  export declare class ImageEditorRenderer {
92
88
  imageCache: ImageCache;
93
89
  private cachedBaseCanvas;
@@ -84,10 +84,6 @@ declare class ImageCache {
84
84
  clear(): void;
85
85
  }
86
86
  export declare const globalImageCache: ImageCache;
87
- /**
88
- * Renders an image with all its transformations, filters, depth masks, and annotations
89
- * to a target HTMLCanvasElement.
90
- */
91
87
  export declare class ImageEditorRenderer {
92
88
  imageCache: ImageCache;
93
89
  private cachedBaseCanvas;
@@ -8,7 +8,7 @@
8
8
 
9
9
 
10
10
 
11
- var _chunkZ2UQYMPScjs = require('../chunk-Z2UQYMPS.cjs');
11
+ var _chunkNJGFSOPPcjs = require('../chunk-NJGFSOPP.cjs');
12
12
 
13
13
 
14
14
 
@@ -46,7 +46,7 @@ var _chunkAMX23CSNcjs = require('../chunk-AMX23CSN.cjs');
46
46
 
47
47
 
48
48
 
49
- var _chunkGMWNBSBScjs = require('../chunk-GMWNBSBS.cjs');
49
+ var _chunk5EMS4BZGcjs = require('../chunk-5EMS4BZG.cjs');
50
50
 
51
51
 
52
52
 
@@ -189,4 +189,4 @@ var _chunk2BSBFBOAcjs = require('../chunk-2BSBFBOA.cjs');
189
189
 
190
190
 
191
191
 
192
- exports.AgentPlayback = _chunkGMWNBSBScjs.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 = _chunkAMX23CSNcjs.JSON_RPC_ERRORS; exports.MCP_PROTOCOL_VERSIONS = _chunkAMX23CSNcjs.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 = _chunkSWTUM32Hcjs.PRESENCE_COLORS; exports.PerformanceQueue = _chunkSWTUM32Hcjs.PerformanceQueue; exports.PresenceStore = _chunkSWTUM32Hcjs.PresenceStore; exports.TOOL_BRIDGE_DEFAULT_PORT = _chunkAMX23CSNcjs.TOOL_BRIDGE_DEFAULT_PORT; exports.TOOL_BRIDGE_PROTOCOL = _chunkAMX23CSNcjs.TOOL_BRIDGE_PROTOCOL; exports.TOOL_DISCOVERY_TOOLS = _chunkAMX23CSNcjs.TOOL_DISCOVERY_TOOLS; exports.TOOL_NAMESPACE_SEPARATOR = _chunkAMX23CSNcjs.TOOL_NAMESPACE_SEPARATOR; exports.ToolRegistry = _chunkAMX23CSNcjs.ToolRegistry; exports.ToolRegistryError = _chunkAMX23CSNcjs.ToolRegistryError; exports.ToolRegistryView = _chunkAMX23CSNcjs.ToolRegistryView; exports.UNSAFE_JSON_KEYS = _chunk2BSBFBOAcjs.UNSAFE_JSON_KEYS; exports.baseToolName = _chunkAMX23CSNcjs.baseToolName; exports.captureInputSchema = _chunkN2FGYZ4Qcjs.captureInputSchema; exports.captureOutputSize = _chunkN2FGYZ4Qcjs.captureOutputSize; exports.cloneElementWithStyles = _chunkSVFEVKLFcjs.cloneElementWithStyles; exports.connectToolBridge = _chunkAMX23CSNcjs.connectToolBridge; exports.createAgentPlayback = _chunkGMWNBSBScjs.createAgentPlayback; exports.createCaptureTool = _chunkN2FGYZ4Qcjs.createCaptureTool; exports.createCaptureToolProvider = _chunkN2FGYZ4Qcjs.createCaptureToolProvider; exports.createElementCaptureSurface = _chunkSVFEVKLFcjs.createElementCaptureSurface; exports.createInstantPresenceClock = _chunkSWTUM32Hcjs.createInstantPresenceClock; exports.createMcpServer = _chunkAMX23CSNcjs.createMcpServer; exports.createPlaybackToolProvider = _chunkGMWNBSBScjs.createPlaybackToolProvider; exports.createStyleResolver = _chunkZ2UQYMPScjs.createStyleResolver; exports.createStyleToolProvider = _chunkZ2UQYMPScjs.createStyleToolProvider; exports.createToolRegistry = _chunkAMX23CSNcjs.createToolRegistry; exports.derivePlaybackSteps = _chunkGMWNBSBScjs.derivePlaybackSteps; exports.elementToSvg = _chunkSVFEVKLFcjs.elementToSvg; exports.errorResult = _chunkAMX23CSNcjs.errorResult; exports.isUnsafeJsonKey = _chunk2BSBFBOAcjs.isUnsafeJsonKey; exports.listSkills = _chunkAMX23CSNcjs.listSkills; exports.locatePlaybackChrome = _chunkGMWNBSBScjs.locatePlaybackChrome; exports.memoryStyleStore = _chunkZ2UQYMPScjs.memoryStyleStore; exports.parseSkillFrontmatter = _chunkAMX23CSNcjs.parseSkillFrontmatter; exports.parseStyleDomains = _chunkZ2UQYMPScjs.parseStyleDomains; exports.playbackRectFromClient = _chunkGMWNBSBScjs.playbackRectFromClient; exports.playbackRefsFromArgs = _chunkGMWNBSBScjs.playbackRefsFromArgs; exports.playbackRefsFromResult = _chunkGMWNBSBScjs.playbackRefsFromResult; exports.rasterizeElement = _chunkSVFEVKLFcjs.rasterizeElement; exports.readSkillFile = _chunkAMX23CSNcjs.readSkillFile; exports.readingTime = _chunkGMWNBSBScjs.readingTime; exports.realPresenceClock = _chunkSWTUM32Hcjs.realPresenceClock; exports.renderStyle = _chunkZ2UQYMPScjs.renderStyle; exports.resolveCaptureRequest = _chunkN2FGYZ4Qcjs.resolveCaptureRequest; exports.runStyleChecks = _chunkZ2UQYMPScjs.runStyleChecks; exports.runToolScript = _chunkZ2UQYMPScjs.runToolScript; exports.searchTokens = _chunkAMX23CSNcjs.searchTokens; exports.searchTools = _chunkAMX23CSNcjs.searchTools; exports.stripPrototypeKeys = _chunk2BSBFBOAcjs.stripPrototypeKeys; exports.summarize = _chunkAMX23CSNcjs.summarize; exports.toCapturedImageData = _chunkN2FGYZ4Qcjs.toCapturedImageData; exports.toToolResult = _chunkAMX23CSNcjs.toToolResult; exports.toolResultError = _chunkZ2UQYMPScjs.toolResultError; exports.toolResultValue = _chunkZ2UQYMPScjs.toolResultValue; exports.toolsetInstructions = _chunkAMX23CSNcjs.toolsetInstructions; exports.toolsetName = _chunkAMX23CSNcjs.toolsetName; exports.trackPresenceDrag = _chunkSWTUM32Hcjs.trackPresenceDrag; exports.tweenPresenceCursor = _chunkSWTUM32Hcjs.tweenPresenceCursor; exports.unionCaptureRects = _chunkN2FGYZ4Qcjs.unionCaptureRects; exports.unionRects = _chunkGMWNBSBScjs.unionRects; exports.unknownToolMessage = _chunkAMX23CSNcjs.unknownToolMessage; exports.validateJsonSchema = _chunkWOFXZ3XUcjs.validateJsonSchema;
192
+ exports.AgentPlayback = _chunk5EMS4BZGcjs.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 = _chunkAMX23CSNcjs.JSON_RPC_ERRORS; exports.MCP_PROTOCOL_VERSIONS = _chunkAMX23CSNcjs.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 = _chunkSWTUM32Hcjs.PRESENCE_COLORS; exports.PerformanceQueue = _chunkSWTUM32Hcjs.PerformanceQueue; exports.PresenceStore = _chunkSWTUM32Hcjs.PresenceStore; exports.TOOL_BRIDGE_DEFAULT_PORT = _chunkAMX23CSNcjs.TOOL_BRIDGE_DEFAULT_PORT; exports.TOOL_BRIDGE_PROTOCOL = _chunkAMX23CSNcjs.TOOL_BRIDGE_PROTOCOL; exports.TOOL_DISCOVERY_TOOLS = _chunkAMX23CSNcjs.TOOL_DISCOVERY_TOOLS; exports.TOOL_NAMESPACE_SEPARATOR = _chunkAMX23CSNcjs.TOOL_NAMESPACE_SEPARATOR; exports.ToolRegistry = _chunkAMX23CSNcjs.ToolRegistry; exports.ToolRegistryError = _chunkAMX23CSNcjs.ToolRegistryError; exports.ToolRegistryView = _chunkAMX23CSNcjs.ToolRegistryView; exports.UNSAFE_JSON_KEYS = _chunk2BSBFBOAcjs.UNSAFE_JSON_KEYS; exports.baseToolName = _chunkAMX23CSNcjs.baseToolName; exports.captureInputSchema = _chunkN2FGYZ4Qcjs.captureInputSchema; exports.captureOutputSize = _chunkN2FGYZ4Qcjs.captureOutputSize; exports.cloneElementWithStyles = _chunkSVFEVKLFcjs.cloneElementWithStyles; exports.connectToolBridge = _chunkAMX23CSNcjs.connectToolBridge; exports.createAgentPlayback = _chunk5EMS4BZGcjs.createAgentPlayback; exports.createCaptureTool = _chunkN2FGYZ4Qcjs.createCaptureTool; exports.createCaptureToolProvider = _chunkN2FGYZ4Qcjs.createCaptureToolProvider; exports.createElementCaptureSurface = _chunkSVFEVKLFcjs.createElementCaptureSurface; exports.createInstantPresenceClock = _chunkSWTUM32Hcjs.createInstantPresenceClock; exports.createMcpServer = _chunkAMX23CSNcjs.createMcpServer; exports.createPlaybackToolProvider = _chunk5EMS4BZGcjs.createPlaybackToolProvider; exports.createStyleResolver = _chunkNJGFSOPPcjs.createStyleResolver; exports.createStyleToolProvider = _chunkNJGFSOPPcjs.createStyleToolProvider; exports.createToolRegistry = _chunkAMX23CSNcjs.createToolRegistry; exports.derivePlaybackSteps = _chunk5EMS4BZGcjs.derivePlaybackSteps; exports.elementToSvg = _chunkSVFEVKLFcjs.elementToSvg; exports.errorResult = _chunkAMX23CSNcjs.errorResult; exports.isUnsafeJsonKey = _chunk2BSBFBOAcjs.isUnsafeJsonKey; exports.listSkills = _chunkAMX23CSNcjs.listSkills; exports.locatePlaybackChrome = _chunk5EMS4BZGcjs.locatePlaybackChrome; exports.memoryStyleStore = _chunkNJGFSOPPcjs.memoryStyleStore; exports.parseSkillFrontmatter = _chunkAMX23CSNcjs.parseSkillFrontmatter; exports.parseStyleDomains = _chunkNJGFSOPPcjs.parseStyleDomains; exports.playbackRectFromClient = _chunk5EMS4BZGcjs.playbackRectFromClient; exports.playbackRefsFromArgs = _chunk5EMS4BZGcjs.playbackRefsFromArgs; exports.playbackRefsFromResult = _chunk5EMS4BZGcjs.playbackRefsFromResult; exports.rasterizeElement = _chunkSVFEVKLFcjs.rasterizeElement; exports.readSkillFile = _chunkAMX23CSNcjs.readSkillFile; exports.readingTime = _chunk5EMS4BZGcjs.readingTime; exports.realPresenceClock = _chunkSWTUM32Hcjs.realPresenceClock; exports.renderStyle = _chunkNJGFSOPPcjs.renderStyle; exports.resolveCaptureRequest = _chunkN2FGYZ4Qcjs.resolveCaptureRequest; exports.runStyleChecks = _chunkNJGFSOPPcjs.runStyleChecks; exports.runToolScript = _chunkNJGFSOPPcjs.runToolScript; exports.searchTokens = _chunkAMX23CSNcjs.searchTokens; exports.searchTools = _chunkAMX23CSNcjs.searchTools; exports.stripPrototypeKeys = _chunk2BSBFBOAcjs.stripPrototypeKeys; exports.summarize = _chunkAMX23CSNcjs.summarize; exports.toCapturedImageData = _chunkN2FGYZ4Qcjs.toCapturedImageData; exports.toToolResult = _chunkAMX23CSNcjs.toToolResult; exports.toolResultError = _chunkNJGFSOPPcjs.toolResultError; exports.toolResultValue = _chunkNJGFSOPPcjs.toolResultValue; exports.toolsetInstructions = _chunkAMX23CSNcjs.toolsetInstructions; exports.toolsetName = _chunkAMX23CSNcjs.toolsetName; exports.trackPresenceDrag = _chunkSWTUM32Hcjs.trackPresenceDrag; exports.tweenPresenceCursor = _chunkSWTUM32Hcjs.tweenPresenceCursor; exports.unionCaptureRects = _chunkN2FGYZ4Qcjs.unionCaptureRects; exports.unionRects = _chunk5EMS4BZGcjs.unionRects; exports.unknownToolMessage = _chunkAMX23CSNcjs.unknownToolMessage; exports.validateJsonSchema = _chunkWOFXZ3XUcjs.validateJsonSchema;
@@ -8,7 +8,7 @@ import {
8
8
  runToolScript,
9
9
  toolResultError,
10
10
  toolResultValue
11
- } from "../chunk-HIDFL5LQ.js";
11
+ } from "../chunk-ZXTO6U7T.js";
12
12
  import {
13
13
  JSON_RPC_ERRORS,
14
14
  MCP_PROTOCOL_VERSIONS,
@@ -46,7 +46,7 @@ import {
46
46
  playbackRefsFromResult,
47
47
  readingTime,
48
48
  unionRects
49
- } from "../chunk-6DXDUVSL.js";
49
+ } from "../chunk-WL4IN36A.js";
50
50
  import {
51
51
  CAPTURE_EXCLUDE_SELECTOR,
52
52
  CAPTURE_OVERLAY_SELECTORS,
@@ -66,6 +66,14 @@ export type PlaybackStep = {
66
66
  /** The handler runs here, exactly once (appended when a plan leaves it out). */
67
67
  | {
68
68
  type: 'commit';
69
+ }
70
+ /**
71
+ * One part of a staged change lands here. A plan with `stage` steps starts the handler at
72
+ * `commit` and keeps playing; each `stage` lets one `await context.stage()` in the handler
73
+ * through, so a call that adds several things adds them one by one under the cursor.
74
+ */
75
+ | {
76
+ type: 'stage';
69
77
  };
70
78
  export interface PlaybackPlanResult {
71
79
  steps: PlaybackStep[];
@@ -66,6 +66,14 @@ export type PlaybackStep = {
66
66
  /** The handler runs here, exactly once (appended when a plan leaves it out). */
67
67
  | {
68
68
  type: 'commit';
69
+ }
70
+ /**
71
+ * One part of a staged change lands here. A plan with `stage` steps starts the handler at
72
+ * `commit` and keeps playing; each `stage` lets one `await context.stage()` in the handler
73
+ * through, so a call that adds several things adds them one by one under the cursor.
74
+ */
75
+ | {
76
+ type: 'stage';
69
77
  };
70
78
  export interface PlaybackPlanResult {
71
79
  steps: PlaybackStep[];
@@ -51,6 +51,12 @@ export interface ToolCallContext {
51
51
  signal?: AbortSignal;
52
52
  /** Who is calling (an MCP client, a scripted agent), for agent playback's cursors and queues. */
53
53
  actor?: PresenceActorInfo;
54
+ /**
55
+ * Set by agent playback when the tool's plan has `stage` steps: resolves when the cursor
56
+ * reaches the next one. A handler that adds several things awaits it before each
57
+ * (`await context.stage?.()`), so they appear one by one; without playback it is absent.
58
+ */
59
+ stage?: () => Promise<void>;
54
60
  }
55
61
  /** Options for `callTool`. */
56
62
  export interface ToolCallOptions {
@@ -51,6 +51,12 @@ export interface ToolCallContext {
51
51
  signal?: AbortSignal;
52
52
  /** Who is calling (an MCP client, a scripted agent), for agent playback's cursors and queues. */
53
53
  actor?: PresenceActorInfo;
54
+ /**
55
+ * Set by agent playback when the tool's plan has `stage` steps: resolves when the cursor
56
+ * reaches the next one. A handler that adds several things awaits it before each
57
+ * (`await context.stage?.()`), so they appear one by one; without playback it is absent.
58
+ */
59
+ stage?: () => Promise<void>;
54
60
  }
55
61
  /** Options for `callTool`. */
56
62
  export interface ToolCallOptions {
@@ -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; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7;
2
2
 
3
- var _chunk6DM3PUQDcjs = require('../chunk-6DM3PUQD.cjs');
3
+ var _chunkCYKWYP6Dcjs = require('../chunk-CYKWYP6D.cjs');
4
4
 
5
5
 
6
6
 
@@ -6136,7 +6136,7 @@ async function openVideoClipEffectAuthoring(controller, clip, instance, options
6136
6136
  const at = _chunk3OSXHLITcjs.findVideoClip.call(void 0, controller.getProject(), clip);
6137
6137
  if (!at) throw new Error(`There is no clip "${clip}".`);
6138
6138
  const doc = videoClipEffectDocument(at.clip, instance, provider.id);
6139
- const session = await _chunk6DM3PUQDcjs.createEffectAuthoringSession.call(void 0, { document: doc }, { ...options, provider });
6139
+ const session = await _chunkCYKWYP6Dcjs.createEffectAuthoringSession.call(void 0, { document: doc }, { ...options, provider });
6140
6140
  return {
6141
6141
  clip,
6142
6142
  instance,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createEffectAuthoringSession
3
- } from "../chunk-ZGOHKS3X.js";
3
+ } from "../chunk-HCC2LBCW.js";
4
4
  import {
5
5
  VIDEO_ADJUSTMENT_SCOPES,
6
6
  VIDEO_BLEND_MODES,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor",
3
- "version": "0.167.0",
3
+ "version": "0.169.0",
4
4
  "description": "UI-agnostic rich text and media editing core library",
5
5
  "author": "Pixerate",
6
6
  "license": "MIT",
@@ -21,7 +21,9 @@ For general error reporting and undo conventions, see `pixerate-agent-tools`.
21
21
 
22
22
  1. **Inspect first.** Run `effect_authoring_describe` to inspect the effect name, kind, source
23
23
  language (`glsl`, `svg`, or null when the effect has no source to edit), control parameter schemas, current
24
- values, existing tracks, and compile issues.
24
+ values, existing tracks, playhead `time`, compile issues and `previewError`.
25
+ A session opens with its playhead at half the effect's length (where entrance-style effects and
26
+ transitions show), so values set on an animated control key that time unless you seek first.
25
27
  2. **Read or update source code.** If `sourceLanguage` is non-null, use `effect_authoring_get_source`
26
28
  to read the shader or script code. Use `effect_authoring_set_source` to recompile with new code
27
29
  and immediately inspect any reported syntax or compilation issues with line numbers.
@@ -38,7 +40,10 @@ For general error reporting and undo conventions, see `pixerate-agent-tools`.
38
40
  6. **Save presets.** When an interesting look is achieved, save it with `effect_authoring_save_preset`
39
41
  or restore known presets with `effect_authoring_apply_preset`.
40
42
  7. **Verify visually.** When `effect_authoring_view` is available, capture rendered preview frames
41
- at specific times to visually confirm effect appearance.
43
+ at specific times to visually confirm effect appearance. When `effect_authoring_describe` reports a
44
+ `previewError` (typically a `vector` effect whose provider only draws it as SVG), there is no pixel
45
+ preview: `effect_authoring_view` is refused with that reason, but values, presets, keyframes and
46
+ timing still work. Judge the result from the values instead of retrying the view.
42
47
 
43
48
  ## Best practices
44
49
 
@@ -56,7 +61,7 @@ For general error reporting and undo conventions, see `pixerate-agent-tools`.
56
61
 
57
62
  | Tool | Description and usage |
58
63
  | --- | --- |
59
- | `effect_authoring_describe` | Reads the currently open effect session: name, kind, source language, controls schema and current values, presets, animated tracks with keyframe counts, duration, loop, and compile issues. |
64
+ | `effect_authoring_describe` | Reads the currently open effect session: name, kind, source language, controls schema and current values, presets, animated tracks with keyframe counts, playhead `time`, duration, loop, compile issues, and `previewError` (why there is no pixel preview, or null). Call it first. |
60
65
  | `effect_authoring_get_source` | Retrieves shader or script source code and language for code-backed effects. Refused if `sourceLanguage` is null. |
61
66
  | `effect_authoring_set_source` | Recompiles the effect with new shader or script source code. Returns compiler issues with line numbers and messages. Available only when supported by the session. |
62
67
  | `effect_authoring_set_values` | Sets one or more control values at the current playhead time as a single undo step. Rejects all changes if any control name or value is invalid. |
@@ -70,11 +75,13 @@ For general error reporting and undo conventions, see `pixerate-agent-tools`.
70
75
  | `effect_authoring_seek` | Moves the preview playhead to a specific timeline position in milliseconds (clamped to 0..duration) and returns values at that time. |
71
76
  | `effect_authoring_undo` | Undoes the most recent edit in the authoring session. |
72
77
  | `effect_authoring_redo` | Redoes the most recently undone edit in the authoring session. |
73
- | `effect_authoring_view` | Captures a preview image of the effect at the current playhead or a specified timestamp. Available when preview capture is supported. |
78
+ | `effect_authoring_view` | Captures a preview image of the effect at the current playhead or a specified timestamp. Available when preview capture is supported. Refused, with the reason, when `effect_authoring_describe` shows a `previewError`. |
74
79
 
75
80
  ## Pitfalls
76
81
 
77
82
  - Calling authoring tools when no authoring session is open returns an error explaining that a session must be opened first.
78
83
  - Animated controls calculate their values dynamically from keyframes; clearing a track reverts the parameter to static behavior.
79
84
  - Compiling invalid shader code produces issues in `effect_authoring_set_source`; inspect the line numbers and messages to correct syntax.
85
+ - A `vector` effect may have no pixel preview (the provider refuses a pixel renderer); check `previewError` rather than reading a blank capture as a broken effect.
86
+ - The playhead does not start at 0. Pass explicit `time`s to `effect_authoring_set_keyframe`, or `effect_authoring_seek` before setting values on an animated control.
80
87
  - Control values must match their schema types and bounds; colours must be `#rrggbb` (or `#rrggbbaa`), and numbers must fall within `[min, max]`.