@pixerate/editor 0.140.4 → 0.142.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/dist/agent/canvasPlayback.d.cts +15 -0
  2. package/dist/agent/canvasPlayback.d.ts +15 -0
  3. package/dist/agent/index.cjs +173 -33
  4. package/dist/agent/index.d.cts +1 -0
  5. package/dist/agent/index.d.ts +1 -0
  6. package/dist/agent/index.js +147 -7
  7. package/dist/agent/providers.d.cts +12 -1
  8. package/dist/agent/providers.d.ts +12 -1
  9. package/dist/agent/types.d.cts +3 -0
  10. package/dist/agent/types.d.ts +3 -0
  11. package/dist/animation/index.cjs +2 -2
  12. package/dist/animation/index.js +1 -1
  13. package/dist/animation/presence.d.cts +1 -75
  14. package/dist/animation/presence.d.ts +1 -75
  15. package/dist/animation-editor/index.cjs +69 -19
  16. package/dist/animation-editor/index.d.cts +1 -0
  17. package/dist/animation-editor/index.d.ts +1 -0
  18. package/dist/animation-editor/index.js +54 -4
  19. package/dist/animation-editor/playback.d.cts +10 -0
  20. package/dist/animation-editor/playback.d.ts +10 -0
  21. package/dist/bridge/cli.cjs +3 -3
  22. package/dist/bridge/cli.js +2 -2
  23. package/dist/bridge/index.cjs +3 -3
  24. package/dist/bridge/index.js +2 -2
  25. package/dist/canvas/index.cjs +336 -646
  26. package/dist/canvas/index.d.cts +1 -0
  27. package/dist/canvas/index.d.ts +1 -0
  28. package/dist/canvas/index.js +44 -354
  29. package/dist/canvas/playback.d.cts +14 -0
  30. package/dist/canvas/playback.d.ts +14 -0
  31. package/dist/chart/index.cjs +255 -171
  32. package/dist/chart/index.d.cts +1 -0
  33. package/dist/chart/index.d.ts +1 -0
  34. package/dist/chart/index.js +244 -160
  35. package/dist/chart/playback.d.cts +22 -0
  36. package/dist/chart/playback.d.ts +22 -0
  37. package/dist/chunk-54GVEVXS.js +408 -0
  38. package/dist/{chunk-E747F3D5.js → chunk-CC6WKVIH.js} +86 -5
  39. package/dist/chunk-DW4CV5H4.js +591 -0
  40. package/dist/{chunk-UMS6YFA6.js → chunk-EAQ4BGNS.js} +1 -1
  41. package/dist/{chunk-AGCD3EHB.cjs → chunk-ENIZYNEF.cjs} +7 -7
  42. package/dist/{chunk-BSGPXPTW.js → chunk-PEEP2YR7.js} +1 -1
  43. package/dist/{chunk-VTY64I6H.cjs → chunk-QSM3MDDJ.cjs} +85 -85
  44. package/dist/{chunk-2RUNJYOX.cjs → chunk-QZFEX2N4.cjs} +86 -5
  45. package/dist/{chunk-RB62U6MS.js → chunk-RFBFTLVN.js} +27 -5
  46. package/dist/chunk-UBRYHNRU.cjs +591 -0
  47. package/dist/{chunk-GEY73RUW.cjs → chunk-UJGAA6AK.cjs} +1 -1
  48. package/dist/{chunk-LMSFXRAJ.js → chunk-VGJTUCWM.js} +1 -1
  49. package/dist/chunk-X2HQP7DF.cjs +408 -0
  50. package/dist/chunk-XH32BATE.cjs +68 -0
  51. package/dist/{chunk-HDK3T2QS.cjs → chunk-Y4BWZB6J.cjs} +29 -7
  52. package/dist/chunk-Y6SGC6KO.js +68 -0
  53. package/dist/commands/index.cjs +37 -1
  54. package/dist/commands/index.js +36 -0
  55. package/dist/commands/registry.d.cts +11 -0
  56. package/dist/commands/registry.d.ts +11 -0
  57. package/dist/diagram/index.cjs +7 -7
  58. package/dist/diagram/index.js +1 -1
  59. package/dist/image-editor/index.cjs +108 -16
  60. package/dist/image-editor/index.d.cts +1 -0
  61. package/dist/image-editor/index.d.ts +1 -0
  62. package/dist/image-editor/index.js +107 -15
  63. package/dist/image-editor/playback.d.cts +22 -0
  64. package/dist/image-editor/playback.d.ts +22 -0
  65. package/dist/index.cjs +7 -3
  66. package/dist/index.js +6 -2
  67. package/dist/paint-editor/index.cjs +73 -25
  68. package/dist/paint-editor/index.d.cts +1 -0
  69. package/dist/paint-editor/index.d.ts +1 -0
  70. package/dist/paint-editor/index.js +68 -20
  71. package/dist/paint-editor/playback.d.cts +16 -0
  72. package/dist/paint-editor/playback.d.ts +16 -0
  73. package/dist/parameters/index.cjs +32 -8
  74. package/dist/parameters/index.d.cts +1 -0
  75. package/dist/parameters/index.d.ts +1 -0
  76. package/dist/parameters/index.js +28 -4
  77. package/dist/parameters/playback.d.cts +10 -0
  78. package/dist/parameters/playback.d.ts +10 -0
  79. package/dist/spreadsheet/index.cjs +7 -3
  80. package/dist/spreadsheet/index.d.cts +1 -0
  81. package/dist/spreadsheet/index.d.ts +1 -0
  82. package/dist/spreadsheet/index.js +6 -2
  83. package/dist/spreadsheet/playback.d.cts +15 -0
  84. package/dist/spreadsheet/playback.d.ts +15 -0
  85. package/dist/tools/index.cjs +40 -3
  86. package/dist/tools/index.d.cts +3 -0
  87. package/dist/tools/index.d.ts +3 -0
  88. package/dist/tools/index.js +39 -2
  89. package/dist/tools/playback.d.cts +205 -0
  90. package/dist/tools/playback.d.ts +205 -0
  91. package/dist/tools/presence.d.cts +82 -0
  92. package/dist/tools/presence.d.ts +82 -0
  93. package/dist/tools/registry.d.cts +45 -6
  94. package/dist/tools/registry.d.ts +45 -6
  95. package/dist/tools/script.d.cts +77 -0
  96. package/dist/tools/script.d.ts +77 -0
  97. package/dist/tools/view.d.cts +2 -4
  98. package/dist/tools/view.d.ts +2 -4
  99. package/dist/vector/index.cjs +217 -100
  100. package/dist/vector/index.d.cts +1 -0
  101. package/dist/vector/index.d.ts +1 -0
  102. package/dist/vector/index.js +140 -23
  103. package/dist/vector/playback.d.cts +13 -0
  104. package/dist/vector/playback.d.ts +13 -0
  105. package/dist/video-editor/index.cjs +81 -28
  106. package/dist/video-editor/index.d.cts +1 -0
  107. package/dist/video-editor/index.d.ts +1 -0
  108. package/dist/video-editor/index.js +58 -5
  109. package/dist/video-editor/playback.d.cts +20 -0
  110. package/dist/video-editor/playback.d.ts +20 -0
  111. package/package.json +1 -1
  112. package/skills/pixerate-agent-tools/SKILL.md +13 -0
  113. package/skills/pixerate-animation-editor/SKILL.md +1 -0
  114. package/skills/pixerate-canvas/SKILL.md +3 -0
  115. package/skills/pixerate-chart/SKILL.md +1 -0
  116. package/skills/pixerate-image-editor/SKILL.md +2 -2
  117. package/skills/pixerate-paint-editor/SKILL.md +1 -0
  118. package/skills/pixerate-parameters/SKILL.md +1 -0
  119. package/skills/pixerate-spreadsheet/SKILL.md +1 -0
  120. package/skills/pixerate-vector/SKILL.md +5 -0
  121. package/skills/pixerate-video-editor/SKILL.md +1 -0
  122. package/dist/chunk-BTZS3KZY.js +0 -221
  123. package/dist/chunk-K73HMKQP.js +0 -0
  124. package/dist/chunk-LACYURUW.cjs +0 -1
  125. package/dist/chunk-MRD3NXKR.cjs +0 -221
@@ -25,6 +25,7 @@
25
25
 
26
26
 
27
27
 
28
+
28
29
 
29
30
 
30
31
  var _chunk55AKPTLMcjs = require('./chunk-55AKPTLM.cjs');
@@ -2947,16 +2948,16 @@ var FormulaEvaluator = (_class2 = class {
2947
2948
  const value = this.evaluateNode(argument);
2948
2949
  if (!Array.isArray(value)) return value;
2949
2950
  if (value.length <= 1) return firstValue(value);
2950
- const cell = _optionalChain([this, 'access', _5 => _5.context, 'access', _6 => _6.getFormulaCell, 'optionalCall', _7 => _7()]);
2951
- if (argument.type === "Range" && cell) {
2951
+ const cell2 = _optionalChain([this, 'access', _5 => _5.context, 'access', _6 => _6.getFormulaCell, 'optionalCall', _7 => _7()]);
2952
+ if (argument.type === "Range" && cell2) {
2952
2953
  const range = _chunk55AKPTLMcjs.toFormulaRange.call(void 0, value);
2953
2954
  const top = Math.min(argument.startRow, argument.endRow);
2954
2955
  const left = Math.min(_chunk55AKPTLMcjs.colNameToIndex.call(void 0, argument.startCol), _chunk55AKPTLMcjs.colNameToIndex.call(void 0, argument.endCol));
2955
2956
  if (range.cols === 1) {
2956
- const r = cell.row - top;
2957
+ const r = cell2.row - top;
2957
2958
  if (r >= 0 && r < range.rows) return range.values[r];
2958
2959
  } else if (range.rows === 1) {
2959
- const c = _chunk55AKPTLMcjs.colNameToIndex.call(void 0, cell.col) - left;
2960
+ const c = _chunk55AKPTLMcjs.colNameToIndex.call(void 0, cell2.col) - left;
2960
2961
  if (c >= 0 && c < range.cols) return range.values[c];
2961
2962
  }
2962
2963
  return this.fail("#VALUE!", `The @ operator found no cell of ${argument.raw} in the formula's row or column.`);
@@ -3757,6 +3758,86 @@ function getFillDirection(source, target) {
3757
3758
  return null;
3758
3759
  }
3759
3760
 
3761
+ // src/spreadsheet/playback.ts
3762
+ var CELL = /^\s*\$?([A-Za-z]{1,3})\$?(\d+)\s*$/;
3763
+ var COL = /^\s*([A-Za-z]{1,3})\s*$/;
3764
+ var ROW = /^\s*(\d+)\s*$/;
3765
+ function parseSpreadsheetPlaybackRef(ref) {
3766
+ const [a, b = a] = ref.id.split(":");
3767
+ if (!a) return null;
3768
+ if (ref.kind === "cell") {
3769
+ const s = CELL.exec(a);
3770
+ const e = CELL.exec(b);
3771
+ if (!s || !e) return null;
3772
+ const r = [Number(s[2]) - 1, Number(e[2]) - 1];
3773
+ const c = [_chunk55AKPTLMcjs.colNameToIndex.call(void 0, s[1].toUpperCase()), _chunk55AKPTLMcjs.colNameToIndex.call(void 0, e[1].toUpperCase())];
3774
+ return { startRow: Math.min(r[0], r[1]), endRow: Math.max(r[0], r[1]), startCol: Math.min(c[0], c[1]), endCol: Math.max(c[0], c[1]) };
3775
+ }
3776
+ if (ref.kind === "row") {
3777
+ const s = ROW.exec(a);
3778
+ const e = ROW.exec(b);
3779
+ if (!s || !e) return null;
3780
+ return { startRow: Math.min(+s[1], +e[1]) - 1, endRow: Math.max(+s[1], +e[1]) - 1, startCol: null, endCol: null };
3781
+ }
3782
+ if (ref.kind === "column") {
3783
+ const s = COL.exec(a);
3784
+ const e = COL.exec(b);
3785
+ if (!s || !e) return null;
3786
+ const c = [_chunk55AKPTLMcjs.colNameToIndex.call(void 0, s[1].toUpperCase()), _chunk55AKPTLMcjs.colNameToIndex.call(void 0, e[1].toUpperCase())];
3787
+ return { startRow: null, endRow: null, startCol: Math.min(c[0], c[1]), endCol: Math.max(c[0], c[1]) };
3788
+ }
3789
+ return null;
3790
+ }
3791
+ var cell = (id) => ({ kind: "cell", id });
3792
+ var shown = (v) => {
3793
+ if (v === null || v === void 0 || v === "") return null;
3794
+ const text = String(v);
3795
+ return text.length > 40 ? `${text.slice(0, 39)}\u2026` : text;
3796
+ };
3797
+ function planSpreadsheetToolPlayback(tool, args) {
3798
+ const count = Number.isInteger(args.count) && args.count > 0 ? args.count : 1;
3799
+ switch (tool) {
3800
+ case "set_cell": {
3801
+ if (typeof args.cell !== "string") return null;
3802
+ const value = shown(args.value);
3803
+ return [{ type: "target", ref: cell(args.cell) }, { type: "press" }, { type: "release" }, ...value ? [{ type: "type", text: value }] : []];
3804
+ }
3805
+ case "set_range": {
3806
+ const start = typeof args.start === "string" ? CELL.exec(args.start) : null;
3807
+ const rows = Array.isArray(args.values) ? args.values : [];
3808
+ if (!start || !rows.length) return null;
3809
+ const width = Math.max(1, ...rows.map((r) => Array.isArray(r) ? r.length : 1));
3810
+ const col = _chunk55AKPTLMcjs.colNameToIndex.call(void 0, start[1].toUpperCase());
3811
+ const end = `${_chunk55AKPTLMcjs.indexToColName.call(void 0, col + width - 1)}${Number(start[2]) + rows.length - 1}`;
3812
+ const first = shown(rows.flat().find((v) => v !== null && v !== void 0 && v !== ""));
3813
+ return [
3814
+ { type: "target", ref: cell(args.start) },
3815
+ { type: "press" },
3816
+ { type: "target", ref: cell(`${args.start}:${end}`) },
3817
+ { type: "release" },
3818
+ ...first ? [{ type: "type", text: first }] : []
3819
+ ];
3820
+ }
3821
+ case "insert_rows":
3822
+ case "delete_rows": {
3823
+ const from = Number(tool === "insert_rows" ? args.before : args.start);
3824
+ if (!Number.isInteger(from) || from < 1) return null;
3825
+ return [{ type: "target", ref: { kind: "row", id: `${from}:${from + count - 1}` } }, { type: "press" }, { type: "release" }];
3826
+ }
3827
+ case "insert_columns":
3828
+ case "delete_columns": {
3829
+ const from = String(tool === "insert_columns" ? args.before : _nullishCoalesce(args.start, () => ( "")));
3830
+ if (!COL.test(from)) return null;
3831
+ const index = _chunk55AKPTLMcjs.colNameToIndex.call(void 0, from.trim().toUpperCase());
3832
+ return [{ type: "target", ref: { kind: "column", id: `${_chunk55AKPTLMcjs.indexToColName.call(void 0, index)}:${_chunk55AKPTLMcjs.indexToColName.call(void 0, index + count - 1)}` } }, { type: "press" }, { type: "release" }];
3833
+ }
3834
+ default:
3835
+ return null;
3836
+ }
3837
+ }
3838
+
3839
+
3840
+
3760
3841
 
3761
3842
 
3762
3843
 
@@ -3795,4 +3876,4 @@ function getFillDirection(source, target) {
3795
3876
 
3796
3877
 
3797
3878
 
3798
- exports.tokenizeFormula = tokenizeFormula; exports.WHOLE_COLUMN_END_ROW = WHOLE_COLUMN_END_ROW; exports.parseCellReference = parseCellReference; exports.parseRange = parseRange; exports.FormulaParser = FormulaParser; exports.parseFormula = parseFormula; exports.FormulaLambda = FormulaLambda; exports.isFormulaLambda = isFormulaLambda; exports.MAX_LAMBDA_DEPTH = MAX_LAMBDA_DEPTH; exports.wildcardToRegExp = wildcardToRegExp; exports.parseCriteria = parseCriteria; exports.registerFormulaFunction = registerFormulaFunction; exports.unregisterFormulaFunction = unregisterFormulaFunction; exports.getFormulaFunction = getFormulaFunction; exports.listFormulaFunctions = listFormulaFunctions; exports.searchFormulaFunctions = searchFormulaFunctions; exports.getFormulaArgumentSpecIndex = getFormulaArgumentSpecIndex; exports.checkFormulaArgumentCount = checkFormulaArgumentCount; exports.getFormulaSignatureParts = getFormulaSignatureParts; exports.getFormulaSignature = getFormulaSignature; exports.describeFormulaError = describeFormulaError; exports.MAX_FORMULA_ARRAY_SIZE = MAX_FORMULA_ARRAY_SIZE; exports.FormulaEvaluator = FormulaEvaluator; exports.normalizeRange = normalizeRange; exports.rangeContains = rangeContains; exports.rangesIntersect = rangesIntersect; exports.rangeContainsRange = rangeContainsRange; exports.isSingleCellRange = isSingleCellRange; exports.isBlankValue = isBlankValue; exports.toNumber = toNumber2; exports.compareCellValues = compareCellValues; exports.matchesFilterRule = matchesFilterRule; exports.aggregateValues = aggregateValues; exports.roundFloat = roundFloat; exports.fillSeries = fillSeries; exports.computeFillTarget = computeFillTarget; exports.getFillDirection = getFillDirection;
3879
+ exports.tokenizeFormula = tokenizeFormula; exports.WHOLE_COLUMN_END_ROW = WHOLE_COLUMN_END_ROW; exports.parseCellReference = parseCellReference; exports.parseRange = parseRange; exports.FormulaParser = FormulaParser; exports.parseFormula = parseFormula; exports.FormulaLambda = FormulaLambda; exports.isFormulaLambda = isFormulaLambda; exports.MAX_LAMBDA_DEPTH = MAX_LAMBDA_DEPTH; exports.wildcardToRegExp = wildcardToRegExp; exports.parseCriteria = parseCriteria; exports.registerFormulaFunction = registerFormulaFunction; exports.unregisterFormulaFunction = unregisterFormulaFunction; exports.getFormulaFunction = getFormulaFunction; exports.listFormulaFunctions = listFormulaFunctions; exports.searchFormulaFunctions = searchFormulaFunctions; exports.getFormulaArgumentSpecIndex = getFormulaArgumentSpecIndex; exports.checkFormulaArgumentCount = checkFormulaArgumentCount; exports.getFormulaSignatureParts = getFormulaSignatureParts; exports.getFormulaSignature = getFormulaSignature; exports.describeFormulaError = describeFormulaError; exports.MAX_FORMULA_ARRAY_SIZE = MAX_FORMULA_ARRAY_SIZE; exports.FormulaEvaluator = FormulaEvaluator; exports.normalizeRange = normalizeRange; exports.rangeContains = rangeContains; exports.rangesIntersect = rangesIntersect; exports.rangeContainsRange = rangeContainsRange; exports.isSingleCellRange = isSingleCellRange; exports.isBlankValue = isBlankValue; exports.toNumber = toNumber2; exports.compareCellValues = compareCellValues; exports.matchesFilterRule = matchesFilterRule; exports.aggregateValues = aggregateValues; exports.roundFloat = roundFloat; exports.fillSeries = fillSeries; exports.computeFillTarget = computeFillTarget; exports.getFillDirection = getFillDirection; exports.parseSpreadsheetPlaybackRef = parseSpreadsheetPlaybackRef; exports.planSpreadsheetToolPlayback = planSpreadsheetToolPlayback;
@@ -413,7 +413,7 @@ function readTools(provider) {
413
413
  return typeof provider.tools === "function" ? provider.tools() : provider.tools;
414
414
  }
415
415
  function toDefinition2(name, tool) {
416
- const { handler: _handler, name: _name, ...rest } = tool;
416
+ const { handler: _handler, name: _name, plan: _plan, playback: _playback, ...rest } = tool;
417
417
  return { name, ...rest };
418
418
  }
419
419
  function errorResult(error) {
@@ -442,6 +442,7 @@ var ToolRegistry = class {
442
442
  capabilities = { tools: { listChanged: true } };
443
443
  entries = [];
444
444
  listeners = /* @__PURE__ */ new Set();
445
+ middleware = [];
445
446
  options;
446
447
  timer = null;
447
448
  lastSignature;
@@ -502,6 +503,17 @@ var ToolRegistry = class {
502
503
  this.notifyListChanged();
503
504
  return true;
504
505
  }
506
+ /**
507
+ * Adds a middleware that wraps every tool call (first added runs outermost), e.g. agent
508
+ * playback's `playback.middleware`. Returns a function that removes it.
509
+ */
510
+ use(middleware) {
511
+ this.middleware.push(middleware);
512
+ return () => {
513
+ const index = this.middleware.indexOf(middleware);
514
+ if (index !== -1) this.middleware.splice(index, 1);
515
+ };
516
+ }
505
517
  /** Registered provider ids in registration order. */
506
518
  providerIds() {
507
519
  return this.entries.map((e) => e.provider.id);
@@ -609,11 +621,16 @@ var ToolRegistry = class {
609
621
  }
610
622
  }
611
623
  try {
612
- const value = await found.tool.handler(input, {
624
+ const context = {
613
625
  name,
614
626
  providerId: found.provider.id,
615
- signal: options.signal
616
- });
627
+ signal: options.signal,
628
+ ...options.actor ? { actor: options.actor } : {}
629
+ };
630
+ const call = { name, tool: found.tool, provider: found.provider, args: input, context };
631
+ const chain = [...this.middleware];
632
+ const run = async (i) => i < chain.length ? chain[i](call, () => run(i + 1)) : found.tool.handler(call.args, context);
633
+ const value = await run(0);
617
634
  return toToolResult(value);
618
635
  } catch (error) {
619
636
  return errorResult({
@@ -896,6 +913,7 @@ function createMcpServer(registry, options) {
896
913
  };
897
914
  const readSkillPath = (path) => skillFiles?.[path] ?? skillFiles?.[`./${path}`];
898
915
  let initialized = false;
916
+ let actor;
899
917
  let unsubscribe = null;
900
918
  const running = /* @__PURE__ */ new Map();
901
919
  const startNotifications = () => {
@@ -909,6 +927,10 @@ function createMcpServer(registry, options) {
909
927
  const params = request.params ?? {};
910
928
  switch (request.method) {
911
929
  case "initialize": {
930
+ const client = params.clientInfo;
931
+ if (client && typeof client.name === "string" && client.name) {
932
+ actor = { id: `mcp:${client.name}`, name: typeof client.title === "string" && client.title ? client.title : client.name };
933
+ }
912
934
  const instructions = typeof options.instructions === "function" ? options.instructions(registry) : options.instructions;
913
935
  const requested = String(params.protocolVersion ?? "");
914
936
  const protocolVersion = MCP_PROTOCOL_VERSIONS.includes(requested) ? requested : MCP_PROTOCOL_VERSIONS[0];
@@ -951,7 +973,7 @@ function createMcpServer(registry, options) {
951
973
  const controller = new AbortController();
952
974
  if (!isNotification) running.set(id, controller);
953
975
  try {
954
- const result = await registry.callTool(name, args ?? {}, { signal: controller.signal });
976
+ const result = await registry.callTool(name, args ?? {}, { signal: controller.signal, ...actor ? { actor } : {} });
955
977
  if (controller.signal.aborted) return null;
956
978
  return { jsonrpc: "2.0", id, result };
957
979
  } finally {