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.
- package/dist/index.js +52 -20
- package/dist/index.js.map +1 -1
- package/dist/remote-server.js +52 -20
- package/dist/remote-server.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -23619,8 +23619,8 @@ function probeBuffer(b, mime) {
|
|
|
23619
23619
|
return meta;
|
|
23620
23620
|
}
|
|
23621
23621
|
if (mime.startsWith("audio/")) {
|
|
23622
|
-
const
|
|
23623
|
-
return
|
|
23622
|
+
const seconds2 = probeWav(b) ?? probeFlac(b) ?? (mime === "audio/mpeg" ? probeMp3(b) : null);
|
|
23623
|
+
return seconds2 ? { duration: round(seconds2) } : null;
|
|
23624
23624
|
}
|
|
23625
23625
|
return null;
|
|
23626
23626
|
}
|
|
@@ -26513,6 +26513,17 @@ ${payload(u)}`
|
|
|
26513
26513
|
// src/tools/canvas-run.ts
|
|
26514
26514
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
26515
26515
|
var MAX_REMEMBERED = 50;
|
|
26516
|
+
var acceptedPacing = { repeats: 9, pauseMs: 1e3 };
|
|
26517
|
+
var sleep3 = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
26518
|
+
var seconds = (ms) => `${new Intl.NumberFormat("pt-BR", { maximumFractionDigits: 1 }).format(ms / 1e3)} s`;
|
|
26519
|
+
function timingsLine(t) {
|
|
26520
|
+
if (!t || t.estimateMs === null && t.startMs === null) return "";
|
|
26521
|
+
const parts = [];
|
|
26522
|
+
if (t.estimateMs !== null) parts.push(`estimar ${seconds(t.estimateMs)}`);
|
|
26523
|
+
if (t.startMs !== null) parts.push(`come\xE7ar ${seconds(t.startMs)}`);
|
|
26524
|
+
return `Tempo na aba: ${parts.join(", ")}.`;
|
|
26525
|
+
}
|
|
26526
|
+
var lacksTitles = (nodes) => (nodes ?? []).some((n) => !n.title);
|
|
26516
26527
|
var boardId2 = external_exports.string().uuid().describe("Id (uuid) do board.");
|
|
26517
26528
|
var nodeId = external_exports.string().min(1).max(128);
|
|
26518
26529
|
var fmt2 = (n) => new Intl.NumberFormat("pt-BR").format(n);
|
|
@@ -26605,15 +26616,21 @@ function registerCanvasRunTools(server, api, run) {
|
|
|
26605
26616
|
const total = a.estimate ? `${dia(a.estimate.total)} (teto ${fmt2(max)})` : "";
|
|
26606
26617
|
const again = a.repeated ? " (a aba j\xE1 tinha recebido este request_id; esta \xE9 a mesma resposta)" : "";
|
|
26607
26618
|
if (a.status === "estimate") {
|
|
26608
|
-
return [
|
|
26619
|
+
return [
|
|
26620
|
+
`Estimativa, nada rodou${again}. Modo ${modeText(a.mode)}. Total agora: ${total}.`,
|
|
26621
|
+
...est,
|
|
26622
|
+
cabeLine(a, max),
|
|
26623
|
+
timingsLine(a.timings)
|
|
26624
|
+
].filter(Boolean).join("\n");
|
|
26609
26625
|
}
|
|
26610
26626
|
if (a.status === "nothing") return `Nada para rodar${again}: ${a.message ?? "o board j\xE1 est\xE1 em dia."}`;
|
|
26611
26627
|
const willRun = (a.estimate?.nodes ?? []).filter((n) => n.willRun).map((n) => n.nodeId);
|
|
26612
26628
|
return [
|
|
26613
26629
|
`Rodando pela sua aba do Canvas${again}. Modo ${modeText(a.mode)}. Estimativa: ${total}.`,
|
|
26614
26630
|
...est,
|
|
26615
|
-
`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
|
|
26616
|
-
|
|
26631
|
+
`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.`,
|
|
26632
|
+
timingsLine(a.timings)
|
|
26633
|
+
].filter(Boolean).join("\n");
|
|
26617
26634
|
}
|
|
26618
26635
|
function cabeLine(a, max) {
|
|
26619
26636
|
if (!a.estimate) return "";
|
|
@@ -26641,20 +26658,32 @@ function registerCanvasRunTools(server, api, run) {
|
|
|
26641
26658
|
const target = targetOf(args);
|
|
26642
26659
|
const requestId = (args.request_id ?? randomUUID3()).toLowerCase();
|
|
26643
26660
|
const label = args.label ?? prettyClient(server.server.getClientVersion()?.name);
|
|
26644
|
-
|
|
26645
|
-
|
|
26646
|
-
|
|
26647
|
-
|
|
26648
|
-
|
|
26649
|
-
|
|
26650
|
-
|
|
26651
|
-
|
|
26652
|
-
|
|
26653
|
-
|
|
26654
|
-
|
|
26655
|
-
|
|
26661
|
+
const ask = async () => {
|
|
26662
|
+
try {
|
|
26663
|
+
return await api.runRequest(args.board_id, {
|
|
26664
|
+
requestId,
|
|
26665
|
+
target,
|
|
26666
|
+
maxDiamonds: args.max_diamonds,
|
|
26667
|
+
dryRun: args.dry_run === true,
|
|
26668
|
+
simulated: args.simulated === true,
|
|
26669
|
+
label,
|
|
26670
|
+
earlyAck: true
|
|
26671
|
+
});
|
|
26672
|
+
} catch (e) {
|
|
26673
|
+
explain2(e, requestId);
|
|
26674
|
+
}
|
|
26675
|
+
};
|
|
26676
|
+
let answer = await ask();
|
|
26677
|
+
const wasAccepted = answer.ok === true && answer.status === "accepted";
|
|
26678
|
+
for (let i = 0; answer.ok === true && answer.status === "accepted" && i < acceptedPacing.repeats; i++) {
|
|
26679
|
+
await sleep3(acceptedPacing.pauseMs);
|
|
26680
|
+
answer = await ask();
|
|
26681
|
+
}
|
|
26682
|
+
if (wasAccepted) answer = { ...answer, repeated: false };
|
|
26683
|
+
if (answer.ok === true && answer.status === "accepted") {
|
|
26684
|
+
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.`;
|
|
26656
26685
|
}
|
|
26657
|
-
const titleOf = await titles(args.board_id);
|
|
26686
|
+
const titleOf = lacksTitles(answer.estimate?.nodes) ? await titles(args.board_id) : (id) => id;
|
|
26658
26687
|
if (answer.ok !== true) {
|
|
26659
26688
|
const est = estimateLines(answer.estimate, titleOf);
|
|
26660
26689
|
throw new CanvasToolError(
|
|
@@ -26688,7 +26717,8 @@ function registerCanvasRunTools(server, api, run) {
|
|
|
26688
26717
|
const requestId = request_id.toLowerCase();
|
|
26689
26718
|
let why = "";
|
|
26690
26719
|
try {
|
|
26691
|
-
|
|
26720
|
+
const status = await api.runStatus(board_id, requestId);
|
|
26721
|
+
return statusText(status, lacksTitles(status.nodes) ? await titles(board_id) : (id) => id);
|
|
26692
26722
|
} catch (e) {
|
|
26693
26723
|
const reason = errorRaw(e)?.reason;
|
|
26694
26724
|
if (!(e instanceof ApiError) || reason !== "unknown-request" && reason !== "no-tab") explain2(e);
|
|
@@ -26742,6 +26772,8 @@ function statusText(a, titleOf) {
|
|
|
26742
26772
|
}
|
|
26743
26773
|
if (a.omitted) lines.push(`\u2026 e mais ${a.omitted} n\xF3(s) fora da lista (a resposta da aba foi cortada pelo tamanho).`);
|
|
26744
26774
|
if (a.state === "done" || a.state === "failed") lines.push("Leia o resultado com canvas_read_board (node_ids).");
|
|
26775
|
+
const timing = timingsLine(a.timings);
|
|
26776
|
+
if (timing) lines.push(timing);
|
|
26745
26777
|
return lines.join("\n");
|
|
26746
26778
|
}
|
|
26747
26779
|
function fromRuns(snap, ids) {
|
|
@@ -27858,7 +27890,7 @@ N\xF3s: ${Object.entries(ids).map(([k, v]) => `${k}=${v}`).join(" \xB7 ")}` : ""
|
|
|
27858
27890
|
import { createRequire } from "module";
|
|
27859
27891
|
var require2 = createRequire(import.meta.url);
|
|
27860
27892
|
function readVersion() {
|
|
27861
|
-
if ("0.
|
|
27893
|
+
if ("0.44.0") return "0.44.0";
|
|
27862
27894
|
try {
|
|
27863
27895
|
const pkg = require2("../package.json");
|
|
27864
27896
|
return pkg.version ?? "0.0.0-unknown";
|