beplus-mcp 0.35.0 → 0.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -26138,6 +26138,52 @@ function registerCanvasFocusTools(server, api, run) {
26138
26138
  );
26139
26139
  }
26140
26140
 
26141
+ // src/canvas/lock.ts
26142
+ var SECTION_LOCK_FIELD = "travada";
26143
+ var LOCKED_TEXT = "\xE1rea travada pelo dono (cadeado); pe\xE7a pra destravar";
26144
+ function isLockedSection(node) {
26145
+ return node !== void 0 && nodeKind(node) === "section" && node.data[SECTION_LOCK_FIELD] === true;
26146
+ }
26147
+ var LAYOUT_PATH = /^(position|size)(\.|$)/;
26148
+ function rectOf(node, withMeasured) {
26149
+ const h = withMeasured ? Math.max(node.size.h, readMeasured(node)?.h ?? 0) : node.size.h;
26150
+ return { x: node.position.x, y: node.position.y, w: node.size.w, h };
26151
+ }
26152
+ function contains(outer, inner) {
26153
+ return inner.x >= outer.x && inner.y >= outer.y && inner.x + inner.w <= outer.x + outer.w && inner.y + inner.h <= outer.y + outer.h;
26154
+ }
26155
+ function flatten(ops) {
26156
+ return ops.flatMap((op) => op.type === "batch" ? flatten(op.ops) : [op]);
26157
+ }
26158
+ function lockViolation(doc, ops) {
26159
+ const locked = Object.values(doc.nodes).filter(isLockedSection);
26160
+ if (!locked.length) return null;
26161
+ const name = (node) => `"${oneLine(nodeName(node), 40)}"`;
26162
+ const flat = flatten(ops);
26163
+ for (const op of flat) {
26164
+ if (op.type !== "node.set" && op.type !== "node.remove") continue;
26165
+ const node = doc.nodes[op.nodeId];
26166
+ if (!isLockedSection(node)) continue;
26167
+ if (op.type === "node.remove") return `${name(node)}: ${LOCKED_TEXT}. Nada foi apagado.`;
26168
+ if (LAYOUT_PATH.test(op.path)) return `${name(node)}: ${LOCKED_TEXT}. Nada foi aplicado.`;
26169
+ }
26170
+ const moved = /* @__PURE__ */ new Set();
26171
+ for (const op of flat) {
26172
+ if (op.type !== "node.set" || !LAYOUT_PATH.test(op.path)) continue;
26173
+ const node = doc.nodes[op.nodeId];
26174
+ if (node !== void 0 && nodeKind(node) !== "section") moved.add(op.nodeId);
26175
+ }
26176
+ if (moved.size < 2) return null;
26177
+ for (const section of locked) {
26178
+ const outer = rectOf(section, false);
26179
+ const inside = [...moved].filter((id) => contains(outer, rectOf(doc.nodes[id], true)));
26180
+ if (inside.length >= 2) {
26181
+ return `${name(section)}: ${LOCKED_TEXT}. Mudar ${inside.length} n\xF3s de dentro dela num pedido s\xF3 n\xE3o vale (um por vez segue valendo). Nada foi aplicado.`;
26182
+ }
26183
+ }
26184
+ return null;
26185
+ }
26186
+
26141
26187
  // src/canvas/mentions.ts
26142
26188
  var VIA_MENTION = "viaMention";
26143
26189
  var PROMPT_REFS_INPUT = "refs";
@@ -26348,6 +26394,8 @@ function registerCanvasTools(server, client, cfg) {
26348
26394
  const { ops, done, targets } = await build(doc, snap);
26349
26395
  if (!ops.length) return `Nada a mudar. ${done}`;
26350
26396
  if (opts.layoutOnly && !ops.every(isLayoutOp)) throw new Error("layout_only com opera\xE7\xE3o fora de posi\xE7\xE3o/tamanho");
26397
+ const locked = lockViolation(doc, ops);
26398
+ if (locked) throw new CanvasToolError(locked);
26351
26399
  let note = "";
26352
26400
  if (!opts.layoutOnly && last !== void 0 && snap.seq > last) {
26353
26401
  const since = await api.opsAfter(id, last);
@@ -27051,7 +27099,7 @@ N\xF3s: ${Object.entries(ids).map(([k, v]) => `${k}=${v}`).join(" \xB7 ")}` : ""
27051
27099
  import { createRequire } from "module";
27052
27100
  var require2 = createRequire(import.meta.url);
27053
27101
  function readVersion() {
27054
- if ("0.35.0") return "0.35.0";
27102
+ if ("0.36.0") return "0.36.0";
27055
27103
  try {
27056
27104
  const pkg = require2("../package.json");
27057
27105
  return pkg.version ?? "0.0.0-unknown";