beplus-mcp 0.42.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
  }
@@ -24773,12 +24773,14 @@ function registerAudioTools(server, client, cfg) {
24773
24773
  "generate_audio",
24774
24774
  {
24775
24775
  title: "Gerar \xE1udio (TTS)",
24776
- description: 'Sintetiza fala a partir de texto e retorna a URL usando o IA Lab da BePlus. SeedAudio 1.0 (seed-audio-1.0) aceita dire\xE7\xE3o e uma refer\xEAncia de voz opcional via seed_reference ou seed_reference_generation_id, com seed_consent. Texto e dire\xE7\xE3o somados at\xE9 2700 caracteres. N\xE3o aceita di\xE1logo nem vozes Gemini. Modelos Gemini 3.8 (`gemini-3.8-flash-lite-tts`, padr\xE3o, r\xE1pido e barato; `gemini-3.8-flash-tts`, qualidade de est\xFAdio, melhor para di\xE1logo e narra\xE7\xE3o longa) aceitam: vozes da biblioteca (milhares, por idioma; liste com `list_tts_voices` e passe o id em `voice`), tags vocais no texto como <laugh> <chuckle> <sigh> <breath> <gasp> <cough> <sneeze> <throat-clearing> <yawn> <groan> <scream> <whimper> <argh> <short pause> <long pause> (viram som de verdade), e estilo por locutor (`style` em cada speaker). No 3.8, `style_instruction` \xE9 dire\xE7\xE3o e N\xC3O \xE9 lida em voz alta. Os modelos legados (`gemini-3.1-flash-tts-preview`, `gemini-2.5-pro-preview-tts`) s\xF3 aceitam as 30 vozes cl\xE1ssicas (Kore, Puck, Charon...) e n\xE3o t\xEAm voz da biblioteca. Vozes pr\xF3prias (voice_xxx; liste com `list_custom_voices`, crie com `design_voice`) s\xF3 no 3.8 e sem `multi_speaker`. No 3.8, dire\xE7\xE3o por linha: `(sussurrando) texto` no in\xEDcio da linha vale at\xE9 a pr\xF3xima dire\xE7\xE3o; no di\xE1logo, `Ana (rindo): fala`; rea\xE7\xF5es `|hmm|` `|aham|` no meio da fala (s\xF3 di\xE1logo). Opcional `style_instruction` (ex.: "fale animado e pausado") e di\xE1logo com 2 locutores via `multi_speaker`. Consome diamantes por segundo de \xE1udio.' + TEAM_GATING_NOTE,
24776
+ description: 'Sintetiza fala a partir de texto e retorna a URL usando o IA Lab da BePlus. SeedAudio 1.0 (seed-audio-1.0) aceita dire\xE7\xE3o, volume e at\xE9 3 refer\xEAncias de voz em seed_references (ou seed_reference legado), com seed_consent. Para v\xE1rias vozes, marque todas no texto: @Audio1: Ol\xE1. @Audio2: Oi. Um ID pr\xF3prio em seed_reference_generation_id reutiliza todas as refer\xEAncias. Texto e dire\xE7\xE3o somados at\xE9 2700 caracteres. N\xE3o aceita multi_speaker nem vozes Gemini. Modelos Gemini 3.8 (`gemini-3.8-flash-lite-tts`, padr\xE3o, r\xE1pido e barato; `gemini-3.8-flash-tts`, qualidade de est\xFAdio, melhor para di\xE1logo e narra\xE7\xE3o longa) aceitam: vozes da biblioteca (milhares, por idioma; liste com `list_tts_voices` e passe o id em `voice`), tags vocais no texto como <laugh> <chuckle> <sigh> <breath> <gasp> <cough> <sneeze> <throat-clearing> <yawn> <groan> <scream> <whimper> <argh> <short pause> <long pause> (viram som de verdade), e estilo por locutor (`style` em cada speaker). No 3.8, `style_instruction` \xE9 dire\xE7\xE3o e N\xC3O \xE9 lida em voz alta. Os modelos legados (`gemini-3.1-flash-tts-preview`, `gemini-2.5-pro-preview-tts`) s\xF3 aceitam as 30 vozes cl\xE1ssicas (Kore, Puck, Charon...) e n\xE3o t\xEAm voz da biblioteca. Vozes pr\xF3prias (voice_xxx; liste com `list_custom_voices`, crie com `design_voice`) s\xF3 no 3.8 e sem `multi_speaker`. No 3.8, dire\xE7\xE3o por linha: `(sussurrando) texto` no in\xEDcio da linha vale at\xE9 a pr\xF3xima dire\xE7\xE3o; no di\xE1logo, `Ana (rindo): fala`; rea\xE7\xF5es `|hmm|` `|aham|` no meio da fala (s\xF3 di\xE1logo). Opcional `style_instruction` (ex.: "fale animado e pausado") e di\xE1logo com 2 locutores via `multi_speaker`. Consome diamantes por segundo de \xE1udio.' + TEAM_GATING_NOTE,
24777
24777
  inputSchema: {
24778
24778
  text: external_exports.string().min(1).max(1e4).describe("Texto a ser falado."),
24779
24779
  voice: topVoiceSchema.optional().describe(VOICE_HELP_TOP + " No SeedAudio, omita ou use seed-auto."),
24780
24780
  seed_reference: external_exports.string().min(1).optional().describe("SeedAudio: arquivo local (stdio) ou URL p\xFAblica de uma voz autorizada, de 1 a 30 s e at\xE9 3 MiB. N\xE3o \xE9 publicado pelo MCP."),
24781
- seed_reference_generation_id: external_exports.string().uuid().optional().describe("Reutiliza a refer\xEAncia de uma gera\xE7\xE3o SeedAudio sua. Alternativa a seed_reference."),
24781
+ seed_references: external_exports.array(external_exports.string().min(1)).min(1).max(3).optional().describe("SeedAudio: at\xE9 3 arquivos locais (stdio) ou URLs p\xFAblicas, na ordem @Audio1, @Audio2, @Audio3. Cada \xE1udio de 1 a 30 s; soma de at\xE9 3 MiB. Use todos os marcadores no texto quando houver v\xE1rias vozes."),
24782
+ seed_loudness_rate: external_exports.number().int().min(-50).max(100).optional().describe("SeedAudio: volume nativo. -50 = 50%, 0 = 100% (normal), 100 = 200%."),
24783
+ seed_reference_generation_id: external_exports.string().uuid().optional().describe("Reutiliza a refer\xEAncia de uma gera\xE7\xE3o SeedAudio sua. Alternativa a seed_reference e seed_references; reutiliza todas as vozes da gera\xE7\xE3o."),
24782
24784
  seed_consent: external_exports.literal(true).optional().describe("Confirme apenas ap\xF3s autoriza\xE7\xE3o expl\xEDcita da pessoa para usar sua voz. Obrigat\xF3rio com refer\xEAncia."),
24783
24785
  model: external_exports.enum(TTS_MODELS).default(DEFAULTS.ttsModel).describe("Modelo TTS."),
24784
24786
  style_instruction: external_exports.string().max(2e3).optional().describe("Instru\xE7\xE3o de estilo/tom aplicada \xE0 fala."),
@@ -24793,12 +24795,19 @@ function registerAudioTools(server, client, cfg) {
24793
24795
  try {
24794
24796
  const seed = args.model === "seed-audio-1.0";
24795
24797
  const voice = args.voice ?? (seed ? "seed-auto" : DEFAULTS.voice);
24796
- const hasReference = !!(args.seed_reference || args.seed_reference_generation_id);
24797
- if (!seed && (hasReference || args.seed_consent || voice === "seed-auto")) return errorResult("Os controles SeedAudio exigem seed-audio-1.0.");
24798
- if (seed && (voice !== "seed-auto" || args.multi_speaker)) return errorResult("SeedAudio usa seed-auto e n\xE3o aceita di\xE1logo.");
24799
- if (args.seed_reference && args.seed_reference_generation_id) return errorResult("Use apenas uma origem de refer\xEAncia.");
24798
+ const hasReference = !!(args.seed_reference || args.seed_references || args.seed_reference_generation_id);
24799
+ if (!seed && (hasReference || args.seed_consent !== void 0 || args.seed_loudness_rate !== void 0 || voice === "seed-auto")) return errorResult("Os controles SeedAudio exigem seed-audio-1.0.");
24800
+ if (seed && (voice !== "seed-auto" || args.multi_speaker)) return errorResult("SeedAudio usa seed-auto. Para v\xE1rias vozes, use seed_references e marcadores @Audio, sem multi_speaker.");
24801
+ if ([args.seed_reference, args.seed_references, args.seed_reference_generation_id].filter(Boolean).length > 1) return errorResult("Use apenas uma origem de refer\xEAncia.");
24800
24802
  if (hasReference && !args.seed_consent) return errorResult("Confirme a autoriza\xE7\xE3o da voz em seed_consent.");
24801
24803
  if (seed && args.text.trim().length + (args.style_instruction?.trim().length ?? 0) > 2700) return errorResult("SeedAudio: texto e dire\xE7\xE3o devem somar at\xE9 2700 caracteres.");
24804
+ const referenceSources = args.seed_references ?? (args.seed_reference ? [args.seed_reference] : []);
24805
+ if (seed && !args.seed_reference_generation_id) {
24806
+ const markersIn = (value) => (value.match(/@Audio[^\s:,.!?;"'()\[\]{}]*/gi) ?? []).map((token) => /^@Audio[1-3]$/.test(token) ? Number(token.slice(6)) : 0);
24807
+ const markers = markersIn(args.text);
24808
+ const allMarkers = [...markers, ...markersIn(args.style_instruction ?? "")];
24809
+ if (allMarkers.some((index) => index < 1 || index > referenceSources.length) || referenceSources.length > 1 && referenceSources.some((_, index) => !markers.includes(index + 1))) return errorResult("Use os marcadores @Audio1, @Audio2 e @Audio3 correspondentes a todas as refer\xEAncias enviadas.");
24810
+ }
24802
24811
  const ms = args.multi_speaker;
24803
24812
  const voices = [voice, ms?.speaker1.voice, ms?.speaker2.voice].filter((v) => !!v);
24804
24813
  if (isCustomVoice(voice)) {
@@ -24819,14 +24828,18 @@ function registerAudioTools(server, client, cfg) {
24819
24828
  return errorResult("O estilo por locutor (`style`) s\xF3 funciona nos modelos Gemini 3.8.");
24820
24829
  }
24821
24830
  }
24822
- let seedReference;
24823
- if (args.seed_reference) {
24824
- const file = await (isRemoteRef(args.seed_reference) ? loadRemote(args.seed_reference, 3 * 1024 * 1024) : loadLocal(args.seed_reference, 3 * 1024 * 1024));
24825
- if (!file.buf.length || file.buf.length > 3 * 1024 * 1024) return errorResult("A refer\xEAncia deve ter at\xE9 3 MiB.");
24826
- seedReference = { audio: file.buf.toString("base64"), mime: file.mime };
24831
+ const seedReferences = [];
24832
+ let remainingBytes = 3 * 1024 * 1024;
24833
+ for (const source of referenceSources) {
24834
+ const file = await (isRemoteRef(source) ? loadRemote(source, remainingBytes) : loadLocal(source, remainingBytes));
24835
+ if (!file.buf.length || file.buf.length > remainingBytes) return errorResult("As refer\xEAncias devem somar at\xE9 3 MiB.");
24836
+ remainingBytes -= file.buf.length;
24837
+ seedReferences.push({ audio: file.buf.toString("base64"), mime: file.mime });
24827
24838
  }
24828
24839
  const body2 = compact({
24829
- seedReference,
24840
+ seedReference: args.seed_reference ? seedReferences[0] : void 0,
24841
+ seedReferences: args.seed_references ? seedReferences : void 0,
24842
+ seedLoudnessRate: args.seed_loudness_rate,
24830
24843
  seedReferenceGenerationId: args.seed_reference_generation_id,
24831
24844
  seedConsent: args.seed_consent,
24832
24845
  text: args.text,
@@ -25692,7 +25705,7 @@ var KINDS = {
25692
25705
  data: { model: "gemini-3.8-flash-lite-tts", voice: "Algieba", speed: "normal" },
25693
25706
  inputs: ["text"],
25694
25707
  outputs: ["audio", "approved"],
25695
- dynamic: "style conforme o modelo; SeedAudio 1.0 tem reference (audio), usa voice: seed-auto e seedConsent: true com refer\xEAncia; alternativa seedReferenceGenerationId de gera\xE7\xE3o pr\xF3pria"
25708
+ dynamic: "style conforme o modelo; SeedAudio 1.0 tem reference (audio, at\xE9 3 vozes na ordem @Audio1..3), volume seedLoudnessRate (-50..100), usa voice: seed-auto e seedConsent: true com refer\xEAncia; alternativa seedReferenceGenerationId de gera\xE7\xE3o pr\xF3pria"
25696
25709
  },
25697
25710
  music: {
25698
25711
  title: "Trilha",
@@ -27397,6 +27410,17 @@ ${payload(u)}`
27397
27410
  // src/tools/canvas-run.ts
27398
27411
  import { randomUUID as randomUUID3 } from "crypto";
27399
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);
27400
27424
  var boardId2 = external_exports.string().uuid().describe("Id (uuid) do board.");
27401
27425
  var nodeId = external_exports.string().min(1).max(128);
27402
27426
  var fmt2 = (n) => new Intl.NumberFormat("pt-BR").format(n);
@@ -27489,15 +27513,21 @@ function registerCanvasRunTools(server, api, run) {
27489
27513
  const total = a.estimate ? `${dia(a.estimate.total)} (teto ${fmt2(max)})` : "";
27490
27514
  const again = a.repeated ? " (a aba j\xE1 tinha recebido este request_id; esta \xE9 a mesma resposta)" : "";
27491
27515
  if (a.status === "estimate") {
27492
- 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");
27493
27522
  }
27494
27523
  if (a.status === "nothing") return `Nada para rodar${again}: ${a.message ?? "o board j\xE1 est\xE1 em dia."}`;
27495
27524
  const willRun = (a.estimate?.nodes ?? []).filter((n) => n.willRun).map((n) => n.nodeId);
27496
27525
  return [
27497
27526
  `Rodando pela sua aba do Canvas${again}. Modo ${modeText(a.mode)}. Estimativa: ${total}.`,
27498
27527
  ...est,
27499
- `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.`
27500
- ].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");
27501
27531
  }
27502
27532
  function cabeLine(a, max) {
27503
27533
  if (!a.estimate) return "";
@@ -27525,20 +27555,32 @@ function registerCanvasRunTools(server, api, run) {
27525
27555
  const target = targetOf(args);
27526
27556
  const requestId = (args.request_id ?? randomUUID3()).toLowerCase();
27527
27557
  const label = args.label ?? prettyClient(server.server.getClientVersion()?.name);
27528
- let answer;
27529
- try {
27530
- answer = await api.runRequest(args.board_id, {
27531
- requestId,
27532
- target,
27533
- maxDiamonds: args.max_diamonds,
27534
- dryRun: args.dry_run === true,
27535
- simulated: args.simulated === true,
27536
- label
27537
- });
27538
- } catch (e) {
27539
- 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.`;
27540
27582
  }
27541
- const titleOf = await titles(args.board_id);
27583
+ const titleOf = lacksTitles(answer.estimate?.nodes) ? await titles(args.board_id) : (id) => id;
27542
27584
  if (answer.ok !== true) {
27543
27585
  const est = estimateLines(answer.estimate, titleOf);
27544
27586
  throw new CanvasToolError(
@@ -27572,7 +27614,8 @@ function registerCanvasRunTools(server, api, run) {
27572
27614
  const requestId = request_id.toLowerCase();
27573
27615
  let why = "";
27574
27616
  try {
27575
- 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);
27576
27619
  } catch (e) {
27577
27620
  const reason = errorRaw(e)?.reason;
27578
27621
  if (!(e instanceof ApiError) || reason !== "unknown-request" && reason !== "no-tab") explain2(e);
@@ -27626,6 +27669,8 @@ function statusText(a, titleOf) {
27626
27669
  }
27627
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).`);
27628
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);
27629
27674
  return lines.join("\n");
27630
27675
  }
27631
27676
  function fromRuns(snap, ids) {
@@ -28742,7 +28787,7 @@ N\xF3s: ${Object.entries(ids).map(([k, v]) => `${k}=${v}`).join(" \xB7 ")}` : ""
28742
28787
  import { createRequire } from "module";
28743
28788
  var require2 = createRequire(import.meta.url);
28744
28789
  function readVersion() {
28745
- if ("0.42.0") return "0.42.0";
28790
+ if ("0.44.0") return "0.44.0";
28746
28791
  try {
28747
28792
  const pkg = require2("../package.json");
28748
28793
  return pkg.version ?? "0.0.0-unknown";