beplus-mcp 0.43.0 → 0.44.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.
@@ -24516,8 +24516,8 @@ function probeBuffer(b, mime) {
24516
24516
  return meta;
24517
24517
  }
24518
24518
  if (mime.startsWith("audio/")) {
24519
- const seconds = probeWav(b) ?? probeFlac(b) ?? (mime === "audio/mpeg" ? probeMp3(b) : null);
24520
- return seconds ? { duration: round(seconds) } : null;
24519
+ const seconds2 = probeWav(b) ?? probeFlac(b) ?? (mime === "audio/mpeg" ? probeMp3(b) : null);
24520
+ return seconds2 ? { duration: round(seconds2) } : null;
24521
24521
  }
24522
24522
  return null;
24523
24523
  }
@@ -27410,6 +27410,17 @@ ${payload(u)}`
27410
27410
  // src/tools/canvas-run.ts
27411
27411
  import { randomUUID as randomUUID3 } from "crypto";
27412
27412
  var MAX_REMEMBERED = 50;
27413
+ var acceptedPacing = { repeats: 9, pauseMs: 1e3 };
27414
+ var sleep3 = (ms) => new Promise((r) => setTimeout(r, ms));
27415
+ var seconds = (ms) => `${new Intl.NumberFormat("pt-BR", { maximumFractionDigits: 1 }).format(ms / 1e3)} s`;
27416
+ function timingsLine(t) {
27417
+ if (!t || t.estimateMs === null && t.startMs === null) return "";
27418
+ const parts = [];
27419
+ if (t.estimateMs !== null) parts.push(`estimar ${seconds(t.estimateMs)}`);
27420
+ if (t.startMs !== null) parts.push(`come\xE7ar ${seconds(t.startMs)}`);
27421
+ return `Tempo na aba: ${parts.join(", ")}.`;
27422
+ }
27423
+ var lacksTitles = (nodes) => (nodes ?? []).some((n) => !n.title);
27413
27424
  var boardId2 = external_exports.string().uuid().describe("Id (uuid) do board.");
27414
27425
  var nodeId = external_exports.string().min(1).max(128);
27415
27426
  var fmt2 = (n) => new Intl.NumberFormat("pt-BR").format(n);
@@ -27502,15 +27513,21 @@ function registerCanvasRunTools(server, api, run) {
27502
27513
  const total = a.estimate ? `${dia(a.estimate.total)} (teto ${fmt2(max)})` : "";
27503
27514
  const again = a.repeated ? " (a aba j\xE1 tinha recebido este request_id; esta \xE9 a mesma resposta)" : "";
27504
27515
  if (a.status === "estimate") {
27505
- return [`Estimativa, nada rodou${again}. Modo ${modeText(a.mode)}. Total agora: ${total}.`, ...est, cabeLine(a, max)].filter(Boolean).join("\n");
27516
+ return [
27517
+ `Estimativa, nada rodou${again}. Modo ${modeText(a.mode)}. Total agora: ${total}.`,
27518
+ ...est,
27519
+ cabeLine(a, max),
27520
+ timingsLine(a.timings)
27521
+ ].filter(Boolean).join("\n");
27506
27522
  }
27507
27523
  if (a.status === "nothing") return `Nada para rodar${again}: ${a.message ?? "o board j\xE1 est\xE1 em dia."}`;
27508
27524
  const willRun = (a.estimate?.nodes ?? []).filter((n) => n.willRun).map((n) => n.nodeId);
27509
27525
  return [
27510
27526
  `Rodando pela sua aba do Canvas${again}. Modo ${modeText(a.mode)}. Estimativa: ${total}.`,
27511
27527
  ...est,
27512
- `request_id: ${requestId}. Andamento: canvas_run_status (board_id, request_id). Resultado: canvas_read_board com node_ids [${willRun.slice(0, 20).join(", ")}] quando terminar.`
27513
- ].join("\n");
27528
+ `request_id: ${requestId}. Andamento: canvas_run_status (board_id, request_id). Resultado: canvas_read_board com node_ids [${willRun.slice(0, 20).join(", ")}] quando terminar.`,
27529
+ timingsLine(a.timings)
27530
+ ].filter(Boolean).join("\n");
27514
27531
  }
27515
27532
  function cabeLine(a, max) {
27516
27533
  if (!a.estimate) return "";
@@ -27538,20 +27555,32 @@ function registerCanvasRunTools(server, api, run) {
27538
27555
  const target = targetOf(args);
27539
27556
  const requestId = (args.request_id ?? randomUUID3()).toLowerCase();
27540
27557
  const label = args.label ?? prettyClient(server.server.getClientVersion()?.name);
27541
- let answer;
27542
- try {
27543
- answer = await api.runRequest(args.board_id, {
27544
- requestId,
27545
- target,
27546
- maxDiamonds: args.max_diamonds,
27547
- dryRun: args.dry_run === true,
27548
- simulated: args.simulated === true,
27549
- label
27550
- });
27551
- } catch (e) {
27552
- explain2(e, requestId);
27558
+ const ask = async () => {
27559
+ try {
27560
+ return await api.runRequest(args.board_id, {
27561
+ requestId,
27562
+ target,
27563
+ maxDiamonds: args.max_diamonds,
27564
+ dryRun: args.dry_run === true,
27565
+ simulated: args.simulated === true,
27566
+ label,
27567
+ earlyAck: true
27568
+ });
27569
+ } catch (e) {
27570
+ explain2(e, requestId);
27571
+ }
27572
+ };
27573
+ let answer = await ask();
27574
+ const wasAccepted = answer.ok === true && answer.status === "accepted";
27575
+ for (let i = 0; answer.ok === true && answer.status === "accepted" && i < acceptedPacing.repeats; i++) {
27576
+ await sleep3(acceptedPacing.pauseMs);
27577
+ answer = await ask();
27578
+ }
27579
+ if (wasAccepted) answer = { ...answer, repeated: false };
27580
+ if (answer.ok === true && answer.status === "accepted") {
27581
+ return `A aba recebeu o pedido e ainda est\xE1 estimando e conferindo (board grande). request_id: ${requestId}. Acompanhe com canvas_run_status; para a resposta completa, chame canvas_run de novo com o MESMO request_id (\xE9 seguro: a aba n\xE3o roda duas vezes). N\xC3O pe\xE7a com outro id.`;
27553
27582
  }
27554
- const titleOf = await titles(args.board_id);
27583
+ const titleOf = lacksTitles(answer.estimate?.nodes) ? await titles(args.board_id) : (id) => id;
27555
27584
  if (answer.ok !== true) {
27556
27585
  const est = estimateLines(answer.estimate, titleOf);
27557
27586
  throw new CanvasToolError(
@@ -27585,7 +27614,8 @@ function registerCanvasRunTools(server, api, run) {
27585
27614
  const requestId = request_id.toLowerCase();
27586
27615
  let why = "";
27587
27616
  try {
27588
- return statusText(await api.runStatus(board_id, requestId), await titles(board_id));
27617
+ const status = await api.runStatus(board_id, requestId);
27618
+ return statusText(status, lacksTitles(status.nodes) ? await titles(board_id) : (id) => id);
27589
27619
  } catch (e) {
27590
27620
  const reason = errorRaw(e)?.reason;
27591
27621
  if (!(e instanceof ApiError) || reason !== "unknown-request" && reason !== "no-tab") explain2(e);
@@ -27639,6 +27669,8 @@ function statusText(a, titleOf) {
27639
27669
  }
27640
27670
  if (a.omitted) lines.push(`\u2026 e mais ${a.omitted} n\xF3(s) fora da lista (a resposta da aba foi cortada pelo tamanho).`);
27641
27671
  if (a.state === "done" || a.state === "failed") lines.push("Leia o resultado com canvas_read_board (node_ids).");
27672
+ const timing = timingsLine(a.timings);
27673
+ if (timing) lines.push(timing);
27642
27674
  return lines.join("\n");
27643
27675
  }
27644
27676
  function fromRuns(snap, ids) {
@@ -28755,7 +28787,7 @@ N\xF3s: ${Object.entries(ids).map(([k, v]) => `${k}=${v}`).join(" \xB7 ")}` : ""
28755
28787
  import { createRequire } from "module";
28756
28788
  var require2 = createRequire(import.meta.url);
28757
28789
  function readVersion() {
28758
- if ("0.43.0") return "0.43.0";
28790
+ if ("0.44.0") return "0.44.0";
28759
28791
  try {
28760
28792
  const pkg = require2("../package.json");
28761
28793
  return pkg.version ?? "0.0.0-unknown";