beplus-mcp 0.45.0 → 0.47.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/README.md +19 -2
- package/dist/index.js +565 -43
- package/dist/index.js.map +1 -1
- package/dist/remote-server.js +565 -43
- package/dist/remote-server.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -24301,7 +24301,7 @@ var BeplusClient = class {
|
|
|
24301
24301
|
const started = Date.now();
|
|
24302
24302
|
for (let attempt = 0; ; attempt++) {
|
|
24303
24303
|
let res = null;
|
|
24304
|
-
let
|
|
24304
|
+
let failure2 = null;
|
|
24305
24305
|
try {
|
|
24306
24306
|
res = await fetchWithAuth(
|
|
24307
24307
|
this.cfg,
|
|
@@ -24316,11 +24316,11 @@ var BeplusClient = class {
|
|
|
24316
24316
|
);
|
|
24317
24317
|
} catch (e) {
|
|
24318
24318
|
if (!(e instanceof ApiError) || e.httpStatus !== 0) throw e;
|
|
24319
|
-
|
|
24319
|
+
failure2 = e;
|
|
24320
24320
|
}
|
|
24321
24321
|
const status = res ? res.status : 0;
|
|
24322
24322
|
if (!retry || !RETRYABLE.has(status)) {
|
|
24323
|
-
if (
|
|
24323
|
+
if (failure2) throw failure2;
|
|
24324
24324
|
return this.read(res, path);
|
|
24325
24325
|
}
|
|
24326
24326
|
const step = Math.min(p.capMs, p.baseMs * 2 ** attempt);
|
|
@@ -24401,7 +24401,12 @@ var BeplusClient = class {
|
|
|
24401
24401
|
offset: query.offset,
|
|
24402
24402
|
// Only send when true — the backend treats truthy as "constrain".
|
|
24403
24403
|
favorite: query.favorite ? "true" : void 0,
|
|
24404
|
-
approved: query.approved ? "true" : void 0
|
|
24404
|
+
approved: query.approved ? "true" : void 0,
|
|
24405
|
+
project: query.project,
|
|
24406
|
+
user: query.user,
|
|
24407
|
+
scope: query.scope,
|
|
24408
|
+
type: query.type,
|
|
24409
|
+
cursor: query.cursor
|
|
24405
24410
|
}
|
|
24406
24411
|
});
|
|
24407
24412
|
}
|
|
@@ -24438,6 +24443,29 @@ var BeplusClient = class {
|
|
|
24438
24443
|
);
|
|
24439
24444
|
return r?.state ?? null;
|
|
24440
24445
|
}
|
|
24446
|
+
// `retry: false` nas leituras de apoio: 503 aqui é "não configurado" e não pode segurar list_models nem check_generation.
|
|
24447
|
+
elevenLabsCatalog(opts = {}) {
|
|
24448
|
+
return this.request("GET", "/elevenlabs/catalog", { timeoutMs: 15e3, ...opts });
|
|
24449
|
+
}
|
|
24450
|
+
elevenLabsVoices(query) {
|
|
24451
|
+
return this.request("GET", "/elevenlabs/voices", { query, timeoutMs: 2e4 });
|
|
24452
|
+
}
|
|
24453
|
+
deleteElevenLabsVoice(id) {
|
|
24454
|
+
return this.request("DELETE", `/elevenlabs/voices/${encodeURIComponent(id)}`, { timeoutMs: 3e4 });
|
|
24455
|
+
}
|
|
24456
|
+
saveElevenLabsVoice(body2) {
|
|
24457
|
+
return this.request("POST", "/elevenlabs/voices/design/save", { body: body2, timeoutMs: 6e4 });
|
|
24458
|
+
}
|
|
24459
|
+
elevenLabsEstimate(body2) {
|
|
24460
|
+
return this.request("POST", "/elevenlabs/estimate", { body: body2, timeoutMs: 6e4 });
|
|
24461
|
+
}
|
|
24462
|
+
// Sem repetição: este POST cobra. Ferramenta longa volta `processing` logo, a rápida segura até a resposta.
|
|
24463
|
+
elevenLabsGenerate(body2) {
|
|
24464
|
+
return this.request("POST", "/elevenlabs/generate", { body: body2, timeoutMs: 18e4 });
|
|
24465
|
+
}
|
|
24466
|
+
elevenLabsJob(id, opts = {}) {
|
|
24467
|
+
return this.request("GET", `/elevenlabs/generations/${encodeURIComponent(id)}`, { timeoutMs: 15e3, ...opts });
|
|
24468
|
+
}
|
|
24441
24469
|
models() {
|
|
24442
24470
|
return this.request("GET", "/models");
|
|
24443
24471
|
}
|
|
@@ -24835,6 +24863,11 @@ async function uploadBytes(cfg, file) {
|
|
|
24835
24863
|
}
|
|
24836
24864
|
return fileUrl;
|
|
24837
24865
|
}
|
|
24866
|
+
async function toStorageUrl(cfg, ref) {
|
|
24867
|
+
if (!isRemoteRef(ref)) return uploadBytes(cfg, await loadLocal(ref));
|
|
24868
|
+
if (new URL(ref).host === BEPLUS_STORAGE_HOST) return ref;
|
|
24869
|
+
return uploadBytes(cfg, await loadRemote(ref));
|
|
24870
|
+
}
|
|
24838
24871
|
async function uploadFile(cfg, ref) {
|
|
24839
24872
|
return uploadBytes(cfg, await loadLocal(ref));
|
|
24840
24873
|
}
|
|
@@ -25130,6 +25163,19 @@ var ASPECT_RATIOS = ["1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "4:5", "
|
|
|
25130
25163
|
var VIDEO_ASPECT_RATIOS = [...ASPECT_RATIOS, "adaptive"];
|
|
25131
25164
|
var IMAGE_RESOLUTIONS = ["1K", "2K", "4K"];
|
|
25132
25165
|
var VIDEO_RESOLUTIONS = ["480p", "720p", "1080p", "4K"];
|
|
25166
|
+
var ELEVENLABS_TOOLS = [
|
|
25167
|
+
"tts",
|
|
25168
|
+
"dialogue",
|
|
25169
|
+
"sfx",
|
|
25170
|
+
"isolate",
|
|
25171
|
+
"voice_change",
|
|
25172
|
+
"transcribe",
|
|
25173
|
+
"align",
|
|
25174
|
+
"music",
|
|
25175
|
+
"stems",
|
|
25176
|
+
"video_music",
|
|
25177
|
+
"voice_design"
|
|
25178
|
+
];
|
|
25133
25179
|
var DEFAULTS = {
|
|
25134
25180
|
imageModel: "google/nano-banana-2.1",
|
|
25135
25181
|
imageAspect: "1:1",
|
|
@@ -25388,6 +25434,433 @@ function formatToolResult(state, fullWords) {
|
|
|
25388
25434
|
return lines.join("\n") || "(sem resultado)";
|
|
25389
25435
|
}
|
|
25390
25436
|
|
|
25437
|
+
// src/tools/elevenlabs.ts
|
|
25438
|
+
import { randomUUID } from "crypto";
|
|
25439
|
+
var elevenLabsPolling = {
|
|
25440
|
+
intervalMs: 3e3,
|
|
25441
|
+
budgetMs: 9e4,
|
|
25442
|
+
sleep: (ms) => new Promise((r) => setTimeout(r, ms))
|
|
25443
|
+
};
|
|
25444
|
+
var MAX_TEXT_CHARS = 2e4;
|
|
25445
|
+
var SITE_ONLY_TOOLS = /* @__PURE__ */ new Set(["dub", "voice_clone"]);
|
|
25446
|
+
var SITE_ONLY_LABEL = "s\xF3 no site da BePlus, na aba \xC1udio do IA Lab";
|
|
25447
|
+
var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
25448
|
+
var DESTINATION_NOTE = " Vai para o cliente e projeto ativos: confirme o destino com o usu\xE1rio antes (list_clients, list_projects).";
|
|
25449
|
+
var COST_NOTE = " Gasta diamantes; dry_run: true mostra o custo sem gastar.";
|
|
25450
|
+
var SOURCE_HELP = "Arquivo local (s\xF3 no stdio), URL ou id de uma gera\xE7\xE3o sua. Arquivo e URL de fora sobem para a BePlus antes (at\xE9 95 MB; acima disso, s\xF3 pelo site).";
|
|
25451
|
+
var TOO_LARGE_MESSAGE = "Este arquivo passa de 95 MB, o limite de envio por aqui. Use a mesma ferramenta no site da BePlus, na aba \xC1udio do IA Lab, que aceita arquivos maiores.";
|
|
25452
|
+
var COMMON_FIELDS = {
|
|
25453
|
+
project: external_exports.string().max(64).optional().describe("Projeto (uuid ou code curto). Omita para usar o projeto ativo."),
|
|
25454
|
+
billing: external_exports.enum(["personal"]).optional().describe('"personal" cobra do seu saldo pessoal e ignora o projeto, mesmo o ativo. Incompat\xEDvel com project.'),
|
|
25455
|
+
dry_run: external_exports.boolean().optional().describe("true devolve o custo em diamantes sem gerar nem gastar.")
|
|
25456
|
+
};
|
|
25457
|
+
function contractMessage(e) {
|
|
25458
|
+
if (!(e instanceof ApiError)) return void 0;
|
|
25459
|
+
const body2 = e.body;
|
|
25460
|
+
const message = body2?.error?.message ?? body2?.result?.error?.message;
|
|
25461
|
+
return typeof message === "string" && message ? message : void 0;
|
|
25462
|
+
}
|
|
25463
|
+
async function failure(client, e) {
|
|
25464
|
+
const ready = contractMessage(e);
|
|
25465
|
+
const raw = ready ?? (e instanceof Error ? e.message : "");
|
|
25466
|
+
if (isTeamGatingError(raw)) return errorResult(await buildPickProjectMessage(client));
|
|
25467
|
+
const text = ready ?? apiErrorToUserMessage(e);
|
|
25468
|
+
return errorResult(isBudgetBlockedError(raw) ? `${text}
|
|
25469
|
+
${BUDGET_BLOCKED_GUIDANCE}` : text);
|
|
25470
|
+
}
|
|
25471
|
+
var VOICE_ORIGIN = { premade: "padr\xE3o", library: "biblioteca", mine: "sua" };
|
|
25472
|
+
function voiceLine(v) {
|
|
25473
|
+
const traits = [v.language, v.gender, v.accent].filter(Boolean).join(", ");
|
|
25474
|
+
const description = v.description ? ` | ${v.description.length > 110 ? `${v.description.slice(0, 107)}...` : v.description}` : "";
|
|
25475
|
+
return `${v.id} | ${v.name} | ${VOICE_ORIGIN[v.source]}${traits ? ` | ${traits}` : ""}${description}`;
|
|
25476
|
+
}
|
|
25477
|
+
function jobFooter(job) {
|
|
25478
|
+
const balance = job.balance === void 0 ? "" : ` \xB7 Saldo: ${job.balance} \u{1F48E}`;
|
|
25479
|
+
return `Gera\xE7\xE3o: ${job.generationId}
|
|
25480
|
+
Custo: ${job.diamonds} \u{1F48E}${balance}`;
|
|
25481
|
+
}
|
|
25482
|
+
function formatJob(job) {
|
|
25483
|
+
if (job.status === "failed") return errorResult(`${job.error?.message ?? "A gera\xE7\xE3o falhou."}
|
|
25484
|
+
${jobFooter(job)}`);
|
|
25485
|
+
if (job.status === "processing") {
|
|
25486
|
+
return textResult(
|
|
25487
|
+
`\u23F3 Ainda em processamento. N\xE3o gere de novo: use check_generation com o id abaixo.
|
|
25488
|
+
${jobFooter(job)}`
|
|
25489
|
+
);
|
|
25490
|
+
}
|
|
25491
|
+
const out = job.output ?? {};
|
|
25492
|
+
const lines = [`\u2705 Pronto (${job.tool}).`];
|
|
25493
|
+
for (const f of out.files ?? []) {
|
|
25494
|
+
const duration3 = f.durationSec === void 0 ? "" : ` (${f.durationSec.toFixed(1)}s)`;
|
|
25495
|
+
lines.push(`${f.label ? `${f.label}: ` : ""}${f.url}${duration3}`);
|
|
25496
|
+
}
|
|
25497
|
+
if (out.text) {
|
|
25498
|
+
const cut = out.text.length > MAX_TEXT_CHARS;
|
|
25499
|
+
lines.push(cut ? `${out.text.slice(0, MAX_TEXT_CHARS)}
|
|
25500
|
+
[texto cortado em ${MAX_TEXT_CHARS} caracteres]` : out.text);
|
|
25501
|
+
}
|
|
25502
|
+
if (out.words?.length) {
|
|
25503
|
+
const speakers = new Set(out.words.map((w) => w.speaker).filter(Boolean)).size;
|
|
25504
|
+
lines.push(`${out.words.length} palavras com tempo${speakers ? `, ${speakers} locutores` : ""}.`);
|
|
25505
|
+
}
|
|
25506
|
+
if (out.srtUrl) lines.push(`Legenda: ${out.srtUrl}`);
|
|
25507
|
+
if (out.previews?.length) {
|
|
25508
|
+
lines.push("Pr\xE9vias (id | \xE1udio):", ...out.previews.map((p) => `${p.id} | ${p.url}`));
|
|
25509
|
+
lines.push("Mostre as pr\xE9vias ao usu\xE1rio. A escolhida vira voz com elevenlabs_voice_design_save.");
|
|
25510
|
+
}
|
|
25511
|
+
if (out.voice) lines.push(`Voz: ${voiceLine(out.voice)}`);
|
|
25512
|
+
lines.push(jobFooter(job));
|
|
25513
|
+
return textResult(lines.join("\n"));
|
|
25514
|
+
}
|
|
25515
|
+
async function waitForJob(client, first) {
|
|
25516
|
+
const { intervalMs, budgetMs, sleep: sleep4 } = elevenLabsPolling;
|
|
25517
|
+
let job = first;
|
|
25518
|
+
for (let waited = 0; job.status === "processing" && waited < budgetMs; waited += intervalMs) {
|
|
25519
|
+
await sleep4(intervalMs);
|
|
25520
|
+
try {
|
|
25521
|
+
job = await client.elevenLabsJob(first.generationId);
|
|
25522
|
+
} catch {
|
|
25523
|
+
return job;
|
|
25524
|
+
}
|
|
25525
|
+
}
|
|
25526
|
+
return job;
|
|
25527
|
+
}
|
|
25528
|
+
async function toSource(cfg, ref) {
|
|
25529
|
+
if (UUID.test(ref)) return { generationId: ref };
|
|
25530
|
+
try {
|
|
25531
|
+
return { fileUrl: await toStorageUrl(cfg, ref) };
|
|
25532
|
+
} catch (e) {
|
|
25533
|
+
if (e instanceof ApiError && e.httpStatus === 413) throw new ApiError(413, TOO_LARGE_MESSAGE);
|
|
25534
|
+
throw e;
|
|
25535
|
+
}
|
|
25536
|
+
}
|
|
25537
|
+
function uploadedHint(body2) {
|
|
25538
|
+
const url = body2.source?.fileUrl;
|
|
25539
|
+
return url ? `
|
|
25540
|
+
Arquivo na BePlus: ${url}. Use esta URL em source para n\xE3o subir de novo.` : "";
|
|
25541
|
+
}
|
|
25542
|
+
async function estimate(client, body2) {
|
|
25543
|
+
const res = await client.elevenLabsEstimate(body2);
|
|
25544
|
+
const duration3 = res.durationSec === void 0 ? "" : ` para ${res.durationSec.toFixed(1)}s`;
|
|
25545
|
+
return textResult(`Custo estimado: ${res.diamonds} \u{1F48E}${duration3}. Nada foi gerado nem cobrado.${uploadedHint(body2)}`);
|
|
25546
|
+
}
|
|
25547
|
+
async function generate(client, body2) {
|
|
25548
|
+
let job;
|
|
25549
|
+
try {
|
|
25550
|
+
job = await client.elevenLabsGenerate({ ...body2, idempotencyKey: randomUUID() });
|
|
25551
|
+
} catch (e) {
|
|
25552
|
+
if (e instanceof ApiError && (e.httpStatus === 0 || e.httpStatus === 408)) {
|
|
25553
|
+
return errorResult(
|
|
25554
|
+
"A resposta n\xE3o chegou, ent\xE3o a gera\xE7\xE3o pode ter come\xE7ado e sido cobrada. N\xE3o repita: confira em list_generations antes."
|
|
25555
|
+
);
|
|
25556
|
+
}
|
|
25557
|
+
throw e;
|
|
25558
|
+
}
|
|
25559
|
+
return formatJob(await waitForJob(client, job));
|
|
25560
|
+
}
|
|
25561
|
+
async function estimateElevenLabsModel(client, cfg, model, params, file) {
|
|
25562
|
+
const [, tool, variant] = model.split("/");
|
|
25563
|
+
if (!ELEVENLABS_TOOLS.includes(tool ?? "")) {
|
|
25564
|
+
return errorResult(`Ferramenta desconhecida em "${model}". Use elevenlabs/<ferramenta>: ${ELEVENLABS_TOOLS.join(", ")}.`);
|
|
25565
|
+
}
|
|
25566
|
+
try {
|
|
25567
|
+
const body2 = { ...params, tool };
|
|
25568
|
+
if (variant) body2.model = variant;
|
|
25569
|
+
if (file) body2.source = await toSource(cfg, file);
|
|
25570
|
+
return await estimate(client, body2);
|
|
25571
|
+
} catch (e) {
|
|
25572
|
+
return failure(client, e);
|
|
25573
|
+
}
|
|
25574
|
+
}
|
|
25575
|
+
function elevenLabsCatalogBlock(catalog) {
|
|
25576
|
+
if (!catalog?.enabled) return "";
|
|
25577
|
+
const lines = catalog.tools.filter((t) => t.available).map((t) => {
|
|
25578
|
+
if (SITE_ONLY_TOOLS.has(t.tool)) return `\u2022 ${t.label}: ${SITE_ONLY_LABEL}.`;
|
|
25579
|
+
const models = t.models?.length ? ` Modelos: ${t.models.map((m) => m.id).join(", ")}.` : "";
|
|
25580
|
+
return `\u2022 elevenlabs_${t.tool}: ${t.label}, ${t.diamondsPerUnitHint}.${models}`;
|
|
25581
|
+
});
|
|
25582
|
+
return lines.length ? `
|
|
25583
|
+
|
|
25584
|
+
ElevenLabs (detalhes e limites em elevenlabs_catalog):
|
|
25585
|
+
${lines.join("\n")}` : "";
|
|
25586
|
+
}
|
|
25587
|
+
function registerElevenLabsTools(server, client, cfg) {
|
|
25588
|
+
function spendTool(name, title, description, shape, build2) {
|
|
25589
|
+
server.registerTool(
|
|
25590
|
+
name,
|
|
25591
|
+
{
|
|
25592
|
+
title,
|
|
25593
|
+
description: description + COST_NOTE + DESTINATION_NOTE,
|
|
25594
|
+
inputSchema: { ...shape, ...COMMON_FIELDS },
|
|
25595
|
+
annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: true }
|
|
25596
|
+
},
|
|
25597
|
+
(async (args) => {
|
|
25598
|
+
try {
|
|
25599
|
+
const body2 = compact({
|
|
25600
|
+
...await build2(args),
|
|
25601
|
+
project: resolveProjectArg(args.project, args.billing, cfg.activeProject),
|
|
25602
|
+
billing: args.billing
|
|
25603
|
+
});
|
|
25604
|
+
return await (args.dry_run ? estimate(client, body2) : generate(client, body2));
|
|
25605
|
+
} catch (e) {
|
|
25606
|
+
return failure(client, e);
|
|
25607
|
+
}
|
|
25608
|
+
})
|
|
25609
|
+
);
|
|
25610
|
+
}
|
|
25611
|
+
const modelField = (example) => external_exports.string().min(1).describe(`Id do modelo, ex.: ${example}. A lista sai de elevenlabs_catalog.`);
|
|
25612
|
+
const voiceField = external_exports.string().min(1).describe("Id de uma voz de elevenlabs_list_voices. Outra voz \xE9 recusada.");
|
|
25613
|
+
const sourceField = external_exports.string().min(1).describe(SOURCE_HELP);
|
|
25614
|
+
server.registerTool(
|
|
25615
|
+
"elevenlabs_catalog",
|
|
25616
|
+
{
|
|
25617
|
+
title: "ElevenLabs: ferramentas e modelos",
|
|
25618
|
+
description: "Mostra o que a ElevenLabs oferece agora na BePlus: ferramentas ligadas, modelos, pre\xE7o aproximado e limites. Chame antes da primeira gera\xE7\xE3o para escolher o model. Somente leitura, sem custo.",
|
|
25619
|
+
inputSchema: {},
|
|
25620
|
+
annotations: { readOnlyHint: true, openWorldHint: false }
|
|
25621
|
+
},
|
|
25622
|
+
async () => {
|
|
25623
|
+
try {
|
|
25624
|
+
const catalog = await client.elevenLabsCatalog();
|
|
25625
|
+
if (!catalog.enabled) return textResult("A ElevenLabs est\xE1 desligada na plataforma agora.");
|
|
25626
|
+
const lines = catalog.tools.map((t) => {
|
|
25627
|
+
if (SITE_ONLY_TOOLS.has(t.tool)) return `${t.label}: ${SITE_ONLY_LABEL}. N\xE3o h\xE1 tool para isso aqui.`;
|
|
25628
|
+
const head = `elevenlabs_${t.tool} | ${t.label} | ${t.available ? t.diamondsPerUnitHint : "indispon\xEDvel agora"}`;
|
|
25629
|
+
const models = (t.models ?? []).map((m) => ` ${m.id}: ${m.label}. ${m.description}`);
|
|
25630
|
+
return [head, ` ${t.description}`, ` Limites: ${JSON.stringify(t.limits)}`, ...models].join("\n");
|
|
25631
|
+
});
|
|
25632
|
+
return textResult(lines.join("\n"));
|
|
25633
|
+
} catch (e) {
|
|
25634
|
+
return failure(client, e);
|
|
25635
|
+
}
|
|
25636
|
+
}
|
|
25637
|
+
);
|
|
25638
|
+
server.registerTool(
|
|
25639
|
+
"elevenlabs_list_voices",
|
|
25640
|
+
{
|
|
25641
|
+
title: "ElevenLabs: listar vozes",
|
|
25642
|
+
description: "Lista as vozes que voc\xEA pode usar nas ferramentas elevenlabs_*: as da biblioteca, as padr\xE3o e as que voc\xEA criou. N\xE3o serve para generate_audio, que tem vozes pr\xF3prias. Somente leitura, sem custo.",
|
|
25643
|
+
inputSchema: {
|
|
25644
|
+
search: external_exports.string().max(100).optional().describe("Texto livre: nome, descri\xE7\xE3o, sotaque."),
|
|
25645
|
+
language: external_exports.string().max(12).optional().describe("Idioma, ex.: pt, en."),
|
|
25646
|
+
gender: external_exports.string().max(20).optional(),
|
|
25647
|
+
page: external_exports.number().int().min(1).optional().describe("Padr\xE3o 1.")
|
|
25648
|
+
},
|
|
25649
|
+
annotations: { readOnlyHint: true, openWorldHint: false }
|
|
25650
|
+
},
|
|
25651
|
+
async (args) => {
|
|
25652
|
+
try {
|
|
25653
|
+
const res = await client.elevenLabsVoices(compact(args));
|
|
25654
|
+
if (!res.voices.length) return textResult("Nenhuma voz encontrada com esses filtros.");
|
|
25655
|
+
const more = res.hasMore ? `
|
|
25656
|
+
Use page=${res.page + 1} para ver mais.` : "";
|
|
25657
|
+
return textResult(`Vozes, p\xE1gina ${res.page} (id | nome | origem | detalhes):
|
|
25658
|
+
${res.voices.map(voiceLine).join("\n")}${more}`);
|
|
25659
|
+
} catch (e) {
|
|
25660
|
+
return failure(client, e);
|
|
25661
|
+
}
|
|
25662
|
+
}
|
|
25663
|
+
);
|
|
25664
|
+
server.registerTool(
|
|
25665
|
+
"elevenlabs_delete_voice",
|
|
25666
|
+
{
|
|
25667
|
+
title: "ElevenLabs: apagar voz sua",
|
|
25668
|
+
description: "DESTRUTIVO e sem volta: apaga uma voz que voc\xEA criou e libera a vaga. \xC1udios j\xE1 gerados continuam tocando. N\xE3o devolve diamantes. Confirme com o usu\xE1rio antes.",
|
|
25669
|
+
inputSchema: { id: external_exports.string().min(1).describe('Id da voz em elevenlabs_list_voices, com origem "sua".') },
|
|
25670
|
+
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: true }
|
|
25671
|
+
},
|
|
25672
|
+
async ({ id }) => {
|
|
25673
|
+
try {
|
|
25674
|
+
await client.deleteElevenLabsVoice(id);
|
|
25675
|
+
return textResult(`\u2705 Voz ${id} apagada.`);
|
|
25676
|
+
} catch (e) {
|
|
25677
|
+
return failure(client, e);
|
|
25678
|
+
}
|
|
25679
|
+
}
|
|
25680
|
+
);
|
|
25681
|
+
server.registerTool(
|
|
25682
|
+
"elevenlabs_voice_design_save",
|
|
25683
|
+
{
|
|
25684
|
+
title: "ElevenLabs: salvar voz criada",
|
|
25685
|
+
description: "Transforma uma pr\xE9via de elevenlabs_voice_design em voz sua, para usar nas ferramentas elevenlabs_*. Ocupa uma vaga de voz: salve s\xF3 a pr\xE9via que o usu\xE1rio escolheu.",
|
|
25686
|
+
inputSchema: {
|
|
25687
|
+
preview_id: external_exports.string().min(1).describe("Id da pr\xE9via escolhida."),
|
|
25688
|
+
name: external_exports.string().min(1).max(40).describe("Nome da voz.")
|
|
25689
|
+
},
|
|
25690
|
+
annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: true }
|
|
25691
|
+
},
|
|
25692
|
+
async ({ preview_id, name }) => {
|
|
25693
|
+
try {
|
|
25694
|
+
const voice = await client.saveElevenLabsVoice({ previewId: preview_id, name });
|
|
25695
|
+
return textResult(`\u2705 Voz salva.
|
|
25696
|
+
${voiceLine(voice)}`);
|
|
25697
|
+
} catch (e) {
|
|
25698
|
+
return failure(client, e);
|
|
25699
|
+
}
|
|
25700
|
+
}
|
|
25701
|
+
);
|
|
25702
|
+
spendTool(
|
|
25703
|
+
"elevenlabs_tts",
|
|
25704
|
+
"ElevenLabs: texto em fala",
|
|
25705
|
+
"Narra\xE7\xE3o com uma voz s\xF3, com a qualidade da ElevenLabs. Para duas ou mais vozes conversando use elevenlabs_dialogue. Para o TTS do Gemini e o SeedAudio use generate_audio.",
|
|
25706
|
+
{
|
|
25707
|
+
text: external_exports.string().min(1).describe("Texto a falar. O teto depende do modelo."),
|
|
25708
|
+
voice: voiceField,
|
|
25709
|
+
model: modelField("eleven_v4"),
|
|
25710
|
+
language: external_exports.string().max(12).optional().describe("Idioma do texto, ex.: pt."),
|
|
25711
|
+
stability: external_exports.number().min(0).max(1).optional(),
|
|
25712
|
+
similarity: external_exports.number().min(0).max(1).optional(),
|
|
25713
|
+
style: external_exports.number().min(0).max(1).optional().describe("N\xE3o vale nos modelos eleven_v4."),
|
|
25714
|
+
speed: external_exports.number().positive().optional().describe("N\xE3o vale nos modelos eleven_v4.")
|
|
25715
|
+
},
|
|
25716
|
+
({ text, voice, model, language, stability, similarity, style, speed }) => {
|
|
25717
|
+
if (model.startsWith("eleven_v4") && (style !== void 0 || speed !== void 0)) {
|
|
25718
|
+
throw new Error("Os modelos eleven_v4 n\xE3o aceitam style nem speed. Tire esses campos ou troque o modelo.");
|
|
25719
|
+
}
|
|
25720
|
+
const settings = compact({ stability, similarity, style, speed });
|
|
25721
|
+
return { tool: "tts", text, voice, model, language, settings: Object.keys(settings).length ? settings : void 0 };
|
|
25722
|
+
}
|
|
25723
|
+
);
|
|
25724
|
+
spendTool(
|
|
25725
|
+
"elevenlabs_dialogue",
|
|
25726
|
+
"ElevenLabs: di\xE1logo",
|
|
25727
|
+
"Conversa entre duas ou mais vozes num \xE1udio s\xF3, na ordem das falas. Para uma voz s\xF3 use elevenlabs_tts.",
|
|
25728
|
+
{
|
|
25729
|
+
lines: external_exports.array(external_exports.object({ voice: voiceField, text: external_exports.string().min(1) })).min(2).describe("Falas em ordem, cada uma com a sua voz. At\xE9 2.000 caracteres somando todas."),
|
|
25730
|
+
model: modelField("eleven_v3")
|
|
25731
|
+
},
|
|
25732
|
+
({ lines, model }) => ({ tool: "dialogue", lines, model })
|
|
25733
|
+
);
|
|
25734
|
+
spendTool(
|
|
25735
|
+
"elevenlabs_sfx",
|
|
25736
|
+
"ElevenLabs: efeito sonoro",
|
|
25737
|
+
"Cria um efeito sonoro a partir de uma descri\xE7\xE3o (porta batendo, chuva, whoosh). Para trilha musical use elevenlabs_music.",
|
|
25738
|
+
{
|
|
25739
|
+
text: external_exports.string().min(1).describe("Descri\xE7\xE3o do som."),
|
|
25740
|
+
model: modelField("eleven_text_to_sound_v2"),
|
|
25741
|
+
duration_sec: external_exports.number().positive().optional().describe("De 0,5 a 30 s. Omita para o modelo decidir."),
|
|
25742
|
+
loop: external_exports.boolean().optional().describe("true faz o som emendar sem corte."),
|
|
25743
|
+
prompt_influence: external_exports.number().min(0).max(1).optional().describe("Quanto seguir a descri\xE7\xE3o ao p\xE9 da letra.")
|
|
25744
|
+
},
|
|
25745
|
+
({ text, model, duration_sec, loop, prompt_influence }) => ({
|
|
25746
|
+
tool: "sfx",
|
|
25747
|
+
text,
|
|
25748
|
+
model,
|
|
25749
|
+
durationSec: duration_sec,
|
|
25750
|
+
loop,
|
|
25751
|
+
promptInfluence: prompt_influence
|
|
25752
|
+
})
|
|
25753
|
+
);
|
|
25754
|
+
spendTool(
|
|
25755
|
+
"elevenlabs_isolate",
|
|
25756
|
+
"ElevenLabs: isolar voz",
|
|
25757
|
+
"Tira ru\xEDdo e fundo de uma grava\xE7\xE3o e deixa s\xF3 a voz. Para separar instrumentos de uma m\xFAsica use elevenlabs_stems.",
|
|
25758
|
+
{ source: sourceField },
|
|
25759
|
+
async ({ source }) => ({ tool: "isolate", source: await toSource(cfg, source) })
|
|
25760
|
+
);
|
|
25761
|
+
spendTool(
|
|
25762
|
+
"elevenlabs_voice_change",
|
|
25763
|
+
"ElevenLabs: trocar a voz",
|
|
25764
|
+
"Refala uma grava\xE7\xE3o com outra voz, mantendo ritmo e emo\xE7\xE3o. Use s\xF3 em grava\xE7\xE3o que o usu\xE1rio pode alterar.",
|
|
25765
|
+
{
|
|
25766
|
+
source: sourceField,
|
|
25767
|
+
voice: voiceField,
|
|
25768
|
+
model: external_exports.string().min(1).optional().describe("Id do modelo, ex.: eleven_multilingual_sts_v2."),
|
|
25769
|
+
remove_noise: external_exports.boolean().optional().describe("true limpa o ru\xEDdo da grava\xE7\xE3o antes.")
|
|
25770
|
+
},
|
|
25771
|
+
async ({ source, voice, model, remove_noise }) => ({
|
|
25772
|
+
tool: "voice_change",
|
|
25773
|
+
source: await toSource(cfg, source),
|
|
25774
|
+
voice,
|
|
25775
|
+
model,
|
|
25776
|
+
removeNoise: remove_noise
|
|
25777
|
+
})
|
|
25778
|
+
);
|
|
25779
|
+
spendTool(
|
|
25780
|
+
"elevenlabs_transcribe",
|
|
25781
|
+
"ElevenLabs: transcrever",
|
|
25782
|
+
"Transforma \xE1udio ou v\xEDdeo em texto, com tempo por palavra e legenda. Se j\xE1 tem o texto e s\xF3 quer o tempo, use elevenlabs_align. Reuni\xE3o gravada da equipe j\xE1 est\xE1 em search_calls.",
|
|
25783
|
+
{
|
|
25784
|
+
source: sourceField,
|
|
25785
|
+
language: external_exports.string().max(12).optional().describe("Idioma falado. Omita para detectar."),
|
|
25786
|
+
diarize: external_exports.boolean().optional().describe("true separa quem falou o qu\xEA."),
|
|
25787
|
+
num_speakers: external_exports.number().int().min(1).optional().describe("Quantas pessoas falam, se souber."),
|
|
25788
|
+
audio_events: external_exports.boolean().optional().describe("true marca risos, palmas e outros sons."),
|
|
25789
|
+
keyterms: external_exports.array(external_exports.string().min(1)).optional().describe("Nomes e termos dif\xEDceis para acertar a grafia.")
|
|
25790
|
+
},
|
|
25791
|
+
async ({ source, language, diarize, num_speakers, audio_events, keyterms }) => ({
|
|
25792
|
+
tool: "transcribe",
|
|
25793
|
+
source: await toSource(cfg, source),
|
|
25794
|
+
language,
|
|
25795
|
+
diarize,
|
|
25796
|
+
numSpeakers: num_speakers,
|
|
25797
|
+
audioEvents: audio_events,
|
|
25798
|
+
keyterms
|
|
25799
|
+
})
|
|
25800
|
+
);
|
|
25801
|
+
spendTool(
|
|
25802
|
+
"elevenlabs_align",
|
|
25803
|
+
"ElevenLabs: alinhar texto ao \xE1udio",
|
|
25804
|
+
"Recebe o \xE1udio e o texto j\xE1 pronto e devolve o tempo de cada palavra, para legenda exata. Sem o texto, use elevenlabs_transcribe.",
|
|
25805
|
+
{ source: sourceField, text: external_exports.string().min(1).describe("Texto exato do que \xE9 falado.") },
|
|
25806
|
+
async ({ source, text }) => ({ tool: "align", source: await toSource(cfg, source), text })
|
|
25807
|
+
);
|
|
25808
|
+
spendTool(
|
|
25809
|
+
"elevenlabs_music",
|
|
25810
|
+
"ElevenLabs: m\xFAsica",
|
|
25811
|
+
"Cria m\xFAsica a partir de uma descri\xE7\xE3o, com letra ou instrumental. Para Suno use generate_music. Para trilha casada com um v\xEDdeo use elevenlabs_video_music.",
|
|
25812
|
+
{
|
|
25813
|
+
prompt: external_exports.string().min(1).describe("Estilo, clima e instrumentos."),
|
|
25814
|
+
model: external_exports.string().min(1).optional().describe("Id do modelo. Omita para o padr\xE3o."),
|
|
25815
|
+
duration_sec: external_exports.number().min(3).optional().describe("Dura\xE7\xE3o em segundos, m\xEDnimo 3."),
|
|
25816
|
+
instrumental: external_exports.boolean().optional(),
|
|
25817
|
+
lyrics: external_exports.string().min(1).optional().describe("Letra pr\xF3pria.")
|
|
25818
|
+
},
|
|
25819
|
+
({ prompt, model, duration_sec, instrumental, lyrics }) => ({
|
|
25820
|
+
tool: "music",
|
|
25821
|
+
prompt,
|
|
25822
|
+
model,
|
|
25823
|
+
durationSec: duration_sec,
|
|
25824
|
+
instrumental,
|
|
25825
|
+
lyrics
|
|
25826
|
+
})
|
|
25827
|
+
);
|
|
25828
|
+
spendTool(
|
|
25829
|
+
"elevenlabs_stems",
|
|
25830
|
+
"ElevenLabs: separar faixas",
|
|
25831
|
+
"Separa uma m\xFAsica em faixas (voz, bateria, baixo e outras). Para limpar uma fala gravada use elevenlabs_isolate.",
|
|
25832
|
+
{ source: sourceField },
|
|
25833
|
+
async ({ source }) => ({ tool: "stems", source: await toSource(cfg, source) })
|
|
25834
|
+
);
|
|
25835
|
+
spendTool(
|
|
25836
|
+
"elevenlabs_video_music",
|
|
25837
|
+
"ElevenLabs: trilha para v\xEDdeo",
|
|
25838
|
+
"Cria trilha que acompanha um v\xEDdeo existente. Para m\xFAsica sem v\xEDdeo use elevenlabs_music.",
|
|
25839
|
+
{
|
|
25840
|
+
source: sourceField,
|
|
25841
|
+
description: external_exports.string().min(1).optional().describe("Clima desejado."),
|
|
25842
|
+
add_sfx: external_exports.boolean().optional().describe("true acrescenta efeitos sonoros.")
|
|
25843
|
+
},
|
|
25844
|
+
async ({ source, description, add_sfx }) => ({
|
|
25845
|
+
tool: "video_music",
|
|
25846
|
+
source: await toSource(cfg, source),
|
|
25847
|
+
description,
|
|
25848
|
+
addSfx: add_sfx
|
|
25849
|
+
})
|
|
25850
|
+
);
|
|
25851
|
+
spendTool(
|
|
25852
|
+
"elevenlabs_voice_design",
|
|
25853
|
+
"ElevenLabs: criar voz por descri\xE7\xE3o",
|
|
25854
|
+
"Gera pr\xE9vias de uma voz nova a partir de uma descri\xE7\xE3o. N\xE3o cria a voz ainda: mostre as pr\xE9vias e salve a escolhida com elevenlabs_voice_design_save. Para vozes do Gemini use design_voice.",
|
|
25855
|
+
{
|
|
25856
|
+
description: external_exports.string().min(20).describe("Idade, timbre, sotaque e jeito de falar. M\xEDnimo 20 caracteres."),
|
|
25857
|
+
text: external_exports.string().min(1).optional().describe("Frase que as pr\xE9vias v\xE3o falar."),
|
|
25858
|
+
model: external_exports.string().min(1).optional().describe("Id do modelo. Omita para o padr\xE3o.")
|
|
25859
|
+
},
|
|
25860
|
+
({ description, text, model }) => ({ tool: "voice_design", description, text, model })
|
|
25861
|
+
);
|
|
25862
|
+
}
|
|
25863
|
+
|
|
25391
25864
|
// src/tools/generation.ts
|
|
25392
25865
|
var IMAGE_BUDGET_MS = 9e4;
|
|
25393
25866
|
var VIDEO_BUDGET_MS = 12e4;
|
|
@@ -25920,13 +26393,15 @@ ${BUDGET_BLOCKED_GUIDANCE}`);
|
|
|
25920
26393
|
"check_generation",
|
|
25921
26394
|
{
|
|
25922
26395
|
title: "Checar gera\xE7\xE3o",
|
|
25923
|
-
description: "Consulta o status de uma gera\xE7\xE3o ass\xEDncrona (imagem
|
|
26396
|
+
description: "Consulta o status de uma gera\xE7\xE3o ass\xEDncrona (imagem, v\xEDdeo ou ElevenLabs) pelo id. Use depois de generate_video, de um generate_image que estourou o tempo ou de uma elevenlabs_* em processamento. Retorna status, progresso e (quando pronto) as URLs.",
|
|
25924
26397
|
inputSchema: {
|
|
25925
|
-
generation_id: external_exports.string().min(1).describe("O id retornado por generate_image
|
|
26398
|
+
generation_id: external_exports.string().min(1).describe("O id retornado por generate_image, generate_video ou elevenlabs_*.")
|
|
25926
26399
|
}
|
|
25927
26400
|
},
|
|
25928
26401
|
async ({ generation_id }) => {
|
|
25929
26402
|
try {
|
|
26403
|
+
const job = await client.elevenLabsJob(generation_id, { retry: false }).catch(() => null);
|
|
26404
|
+
if (job?.generationId) return formatJob(job);
|
|
25930
26405
|
const status = await client.getStatus(generation_id);
|
|
25931
26406
|
if (status.status === "completed") {
|
|
25932
26407
|
const urls = outputUrls(status);
|
|
@@ -25955,34 +26430,44 @@ ${list}${flagsLine(status)}${draftHint}` }, ...blocks] };
|
|
|
25955
26430
|
"list_generations",
|
|
25956
26431
|
{
|
|
25957
26432
|
title: "Listar gera\xE7\xF5es",
|
|
25958
|
-
description: 'Lista
|
|
26433
|
+
description: 'Lista gera\xE7\xF5es. Sem filtro, traz as suas, com os flags de favorito ("like") e de plano aprovado (filtros favorite=true / approved=true, que valem s\xF3 para as suas). Com project, traz o projeto inteiro, de toda a equipe, e user filtra uma pessoa dentro dele. scope="team" traz as gera\xE7\xF5es conclu\xEDdas da equipe toda, e user sem project traz uma pessoa da equipe: os dois s\xE3o s\xF3 para admin. Retorna id, modelo, tipo, status, data, autor, um trecho do prompt e (quando h\xE1) a URL. Fora das suas, pagine com o cursor devolvido no fim da resposta.',
|
|
25959
26434
|
inputSchema: {
|
|
25960
26435
|
limit: external_exports.number().int().min(1).max(100).optional().describe("Quantas trazer (padr\xE3o 20, m\xE1x 100)."),
|
|
25961
26436
|
offset: external_exports.number().int().min(0).optional().describe("Deslocamento para paginar (padr\xE3o 0)."),
|
|
25962
26437
|
favorite: external_exports.boolean().optional().describe('S\xF3 as favoritadas ("like"). Padr\xE3o: todas.'),
|
|
25963
|
-
approved: external_exports.boolean().optional().describe("S\xF3 as com plano aprovado. Padr\xE3o: todas.")
|
|
26438
|
+
approved: external_exports.boolean().optional().describe("S\xF3 as com plano aprovado. Padr\xE3o: todas."),
|
|
26439
|
+
project: external_exports.string().optional().describe('C\xF3digo ou id do projeto (ex.: "EP2-26"). Lista o projeto inteiro.'),
|
|
26440
|
+
user: external_exports.string().optional().describe("E-mail ou id da pessoa. Sem project, s\xF3 admin."),
|
|
26441
|
+
scope: external_exports.enum(["team"]).optional().describe('"team": toda a equipe, com ou sem projeto. S\xF3 admin.'),
|
|
26442
|
+
type: external_exports.enum(["image", "video", "audio", "music", "upscale"]).optional().describe("Filtra por tipo, junto de project, user ou scope."),
|
|
26443
|
+
cursor: external_exports.string().optional().describe("Pr\xF3xima p\xE1gina, devolvido na resposta anterior.")
|
|
25964
26444
|
}
|
|
25965
26445
|
},
|
|
25966
|
-
async ({ limit, offset, favorite, approved }) => {
|
|
26446
|
+
async ({ limit, offset, favorite, approved, project, user, scope, type, cursor }) => {
|
|
25967
26447
|
try {
|
|
25968
|
-
const { generations } = await client.listGenerations({ limit, offset, favorite, approved });
|
|
26448
|
+
const { generations, nextCursor } = await client.listGenerations({ limit, offset, favorite, approved, project, user, scope, type, cursor });
|
|
25969
26449
|
if (!generations.length) {
|
|
25970
|
-
const
|
|
25971
|
-
return textResult(`Nenhuma gera\xE7\xE3o${
|
|
26450
|
+
const filterLabel = favorite && approved ? " (favoritadas + aprovadas)" : favorite ? " favoritadas" : approved ? " aprovadas" : "";
|
|
26451
|
+
return textResult(`Nenhuma gera\xE7\xE3o${filterLabel} encontrada.`);
|
|
25972
26452
|
}
|
|
25973
26453
|
const lines = generations.map((g, i) => {
|
|
25974
|
-
const
|
|
26454
|
+
const kind = g.model?.startsWith("topaz/upscale") ? "upscale" : g.generation_type || "image";
|
|
25975
26455
|
const when = g.created_at ? new Date(g.created_at).toISOString().slice(0, 10) : "\u2014";
|
|
25976
26456
|
const prompt = (g.prompt || "").replace(/\s+/g, " ").slice(0, 80);
|
|
25977
26457
|
const url = firstOutputUrl(g.output);
|
|
25978
26458
|
const marks = [g.is_favorite ? "\u2B50" : null, g.is_approved_plan ? "\u2714\uFE0F" : null].filter(Boolean).join(" ");
|
|
25979
26459
|
const marksSuffix = marks ? ` ${marks}` : "";
|
|
25980
|
-
|
|
26460
|
+
const authorName = [g.author?.first_name, g.author?.last_name].filter(Boolean).join(" ");
|
|
26461
|
+
const authorSuffix = authorName ? ` \xB7 ${authorName}` : "";
|
|
26462
|
+
return `${i + 1}. ${kind} \xB7 ${g.status} \xB7 ${when} \xB7 ${g.model}${authorSuffix}${marksSuffix}
|
|
25981
26463
|
${g.id}
|
|
25982
26464
|
"${prompt}"${url ? `
|
|
25983
26465
|
${url}` : ""}`;
|
|
25984
26466
|
});
|
|
25985
|
-
|
|
26467
|
+
const more = nextCursor ? `
|
|
26468
|
+
|
|
26469
|
+
Pr\xF3xima p\xE1gina: cursor "${nextCursor}"` : "";
|
|
26470
|
+
return textResult(lines.join("\n\n") + more);
|
|
25986
26471
|
} catch (e) {
|
|
25987
26472
|
return errorResult(apiErrorToUserMessage(e));
|
|
25988
26473
|
}
|
|
@@ -26002,6 +26487,7 @@ ${list}${flagsLine(status)}${draftHint}` }, ...blocks] };
|
|
|
26002
26487
|
await client.cancel(generation_id);
|
|
26003
26488
|
return textResult(`\u2705 Gera\xE7\xE3o ${generation_id} cancelada (diamantes estornados quando aplic\xE1vel).`);
|
|
26004
26489
|
} catch (e) {
|
|
26490
|
+
if (e instanceof ApiError && e.httpStatus === 409) return textResult(e.message);
|
|
26005
26491
|
return errorResult(apiErrorToUserMessage(e));
|
|
26006
26492
|
}
|
|
26007
26493
|
}
|
|
@@ -26897,7 +27383,7 @@ Use o valor de "voice" no generate_audio com um modelo 3.8 (sem multi_speaker).`
|
|
|
26897
27383
|
}
|
|
26898
27384
|
|
|
26899
27385
|
// src/tools/account.ts
|
|
26900
|
-
function registerAccountTools(server, client,
|
|
27386
|
+
function registerAccountTools(server, client, cfg) {
|
|
26901
27387
|
server.registerTool(
|
|
26902
27388
|
"whoami",
|
|
26903
27389
|
{
|
|
@@ -26954,14 +27440,17 @@ ${budget}` : "")
|
|
|
26954
27440
|
},
|
|
26955
27441
|
async () => {
|
|
26956
27442
|
try {
|
|
26957
|
-
const m = await
|
|
27443
|
+
const [m, elevenLabs] = await Promise.all([
|
|
27444
|
+
client.models(),
|
|
27445
|
+
client.elevenLabsCatalog({ retry: false }).catch(() => null)
|
|
27446
|
+
]);
|
|
26958
27447
|
const lines = m.models.map((x) => {
|
|
26959
27448
|
const price = typeof x.pricing === "number" ? `$${x.pricing}` : JSON.stringify(x.pricing);
|
|
26960
27449
|
return `\u2022 ${x.model} \u2014 ${price} (base USD)`;
|
|
26961
27450
|
});
|
|
26962
27451
|
const analyzeBlock = analyzeCatalogBlock(m.analyze);
|
|
26963
27452
|
const txt = `Modelos de gera\xE7\xE3o:
|
|
26964
|
-
${lines.join("\n") || "(nenhum)"}` + analyzeBlock + `
|
|
27453
|
+
${lines.join("\n") || "(nenhum)"}` + analyzeBlock + elevenLabsCatalogBlock(elevenLabs) + `
|
|
26965
27454
|
|
|
26966
27455
|
Limites simult\xE2neos por usu\xE1rio: imagem=${m.limits.perUserMaxImage}, v\xEDdeo=${m.limits.perUserMaxVideo}, \xE1udio=${m.limits.perUserMaxAudio}.
|
|
26967
27456
|
1 \u{1F48E} \u2248 $${m.pricing.diamondValueUsd} (margem ${m.pricing.diamondMargin}x, m\xEDn ${m.pricing.minDiamonds} \u{1F48E}). Use estimate_cost para o custo exato em diamantes (gera\xE7\xE3o).`;
|
|
@@ -26975,9 +27464,10 @@ Limites simult\xE2neos por usu\xE1rio: imagem=${m.limits.perUserMaxImage}, v\xED
|
|
|
26975
27464
|
"estimate_cost",
|
|
26976
27465
|
{
|
|
26977
27466
|
title: "Estimar custo",
|
|
26978
|
-
description: "Retorna o custo autoritativo em diamantes ANTES de gerar. Para \xE1udio (TTS) o custo \xE9 por segundo e s\xF3 \xE9 conhecido ap\xF3s a s\xEDntese.",
|
|
27467
|
+
description: "Retorna o custo autoritativo em diamantes ANTES de gerar. Para \xE1udio (TTS) o custo \xE9 por segundo e s\xF3 \xE9 conhecido ap\xF3s a s\xEDntese. ElevenLabs: model = elevenlabs/<ferramenta>[/<modelo>], os campos da gera\xE7\xE3o em elevenlabs_params e o arquivo em file (ou dry_run: true na pr\xF3pria ferramenta elevenlabs_*).",
|
|
26979
27468
|
inputSchema: {
|
|
26980
27469
|
model: external_exports.string().min(1).describe("Id do modelo (ex.: google/nano-banana-pro, bytedance/seedance-2.0)."),
|
|
27470
|
+
elevenlabs_params: external_exports.record(external_exports.unknown()).optional().describe('[ElevenLabs] Campos do pedido no formato da API, ex.: { "voice": "...", "text": "..." }.'),
|
|
26981
27471
|
resolution: external_exports.string().optional(),
|
|
26982
27472
|
duration: external_exports.number().int().optional(),
|
|
26983
27473
|
mode: external_exports.string().optional(),
|
|
@@ -27003,6 +27493,9 @@ Limites simult\xE2neos por usu\xE1rio: imagem=${m.limits.perUserMaxImage}, v\xED
|
|
|
27003
27493
|
}
|
|
27004
27494
|
},
|
|
27005
27495
|
async (args) => {
|
|
27496
|
+
if (args.model.startsWith("elevenlabs/")) {
|
|
27497
|
+
return estimateElevenLabsModel(client, cfg, args.model, args.elevenlabs_params, args.file);
|
|
27498
|
+
}
|
|
27006
27499
|
try {
|
|
27007
27500
|
let width2 = args.source_width;
|
|
27008
27501
|
let height = args.source_height;
|
|
@@ -27744,6 +28237,33 @@ var KINDS = {
|
|
|
27744
28237
|
outputs: ["audio", "approved"],
|
|
27745
28238
|
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"
|
|
27746
28239
|
},
|
|
28240
|
+
"audio-tools": {
|
|
28241
|
+
title: "Ferramentas de \xE1udio",
|
|
28242
|
+
size: { w: 320, h: 212 },
|
|
28243
|
+
data: {
|
|
28244
|
+
tool: "sfx",
|
|
28245
|
+
model: null,
|
|
28246
|
+
voice: null,
|
|
28247
|
+
durationSec: null,
|
|
28248
|
+
loop: false,
|
|
28249
|
+
instrumental: true,
|
|
28250
|
+
removeNoise: false,
|
|
28251
|
+
language: null,
|
|
28252
|
+
diarize: true,
|
|
28253
|
+
audioEvents: false,
|
|
28254
|
+
targetLang: "en",
|
|
28255
|
+
sourceLang: null,
|
|
28256
|
+
dubMode: "v1",
|
|
28257
|
+
history: [],
|
|
28258
|
+
pinned: null,
|
|
28259
|
+
results: [],
|
|
28260
|
+
pinnedResult: null
|
|
28261
|
+
},
|
|
28262
|
+
inputs: ["prompt", "lyrics", "source"],
|
|
28263
|
+
outputs: ["audio", "approved", "text", "subtitle", "video"],
|
|
28264
|
+
dynamic: "as portas mudam com data.tool (sfx, isolate, voice_change, music, stems, transcribe, dub)",
|
|
28265
|
+
main: "tool"
|
|
28266
|
+
},
|
|
27747
28267
|
music: {
|
|
27748
28268
|
title: "Trilha",
|
|
27749
28269
|
size: { w: 320, h: 212 },
|
|
@@ -27834,6 +28354,7 @@ function ratioOfAspect(aspect) {
|
|
|
27834
28354
|
const height = Number(match[2]);
|
|
27835
28355
|
return width2 > 0 && height > 0 ? width2 / height : null;
|
|
27836
28356
|
}
|
|
28357
|
+
var DUB_NOTE = "Dublagem no Canvas exige clique de pessoa: agente n\xE3o roda. ";
|
|
27837
28358
|
function isGeneratorKind(kind) {
|
|
27838
28359
|
return kind === "image" || kind === "video";
|
|
27839
28360
|
}
|
|
@@ -27856,7 +28377,7 @@ function knownPort(kind, side, port) {
|
|
|
27856
28377
|
}
|
|
27857
28378
|
|
|
27858
28379
|
// src/canvas/core.ts
|
|
27859
|
-
import { randomBytes, randomUUID } from "crypto";
|
|
28380
|
+
import { randomBytes, randomUUID as randomUUID2 } from "crypto";
|
|
27860
28381
|
var SCHEMA_VERSION = 1;
|
|
27861
28382
|
var MAX_ENVELOPES_PER_COMMIT = 200;
|
|
27862
28383
|
var MAX_OP_BYTES = 64 * 1024;
|
|
@@ -27942,7 +28463,7 @@ function checkOp(op) {
|
|
|
27942
28463
|
}
|
|
27943
28464
|
}
|
|
27944
28465
|
function envelope(boardId4, op, actorId) {
|
|
27945
|
-
return { id:
|
|
28466
|
+
return { id: randomUUID2(), boardId: boardId4, clientId: CLIENT_ID, actorId, seq: null, ts: Date.now(), op };
|
|
27946
28467
|
}
|
|
27947
28468
|
function checkEnvelope(env) {
|
|
27948
28469
|
const bad = checkOp(env.op);
|
|
@@ -27954,7 +28475,7 @@ function checkEnvelope(env) {
|
|
|
27954
28475
|
}
|
|
27955
28476
|
function emptyBoard(title, now = Date.now()) {
|
|
27956
28477
|
return {
|
|
27957
|
-
id:
|
|
28478
|
+
id: randomUUID2(),
|
|
27958
28479
|
schemaVersion: SCHEMA_VERSION,
|
|
27959
28480
|
title,
|
|
27960
28481
|
ownerId: "",
|
|
@@ -27971,7 +28492,7 @@ function emptyBoard(title, now = Date.now()) {
|
|
|
27971
28492
|
function makeNode(init) {
|
|
27972
28493
|
const now = init.now ?? Date.now();
|
|
27973
28494
|
return {
|
|
27974
|
-
id: init.id ??
|
|
28495
|
+
id: init.id ?? randomUUID2(),
|
|
27975
28496
|
type: init.type,
|
|
27976
28497
|
position: { x: init.position.x, y: init.position.y },
|
|
27977
28498
|
size: { w: init.size.w, h: init.size.h },
|
|
@@ -27985,7 +28506,7 @@ function makeNode(init) {
|
|
|
27985
28506
|
}
|
|
27986
28507
|
function makeEdge(init) {
|
|
27987
28508
|
return {
|
|
27988
|
-
id:
|
|
28509
|
+
id: randomUUID2(),
|
|
27989
28510
|
source: init.source,
|
|
27990
28511
|
sourcePort: init.sourcePort,
|
|
27991
28512
|
target: init.target,
|
|
@@ -29223,7 +29744,7 @@ ${text}`;
|
|
|
29223
29744
|
}
|
|
29224
29745
|
|
|
29225
29746
|
// src/canvas/upload.ts
|
|
29226
|
-
import { randomUUID as
|
|
29747
|
+
import { randomUUID as randomUUID3 } from "crypto";
|
|
29227
29748
|
import { basename as basename2, extname as extname3 } from "path";
|
|
29228
29749
|
function kindOfMime(mime) {
|
|
29229
29750
|
if (mime.startsWith("image/")) return "image";
|
|
@@ -29263,7 +29784,7 @@ async function uploadMedia(cfg, source, name) {
|
|
|
29263
29784
|
meta: meta ?? {},
|
|
29264
29785
|
measuredBy,
|
|
29265
29786
|
reused,
|
|
29266
|
-
assetId: `asset_${
|
|
29787
|
+
assetId: `asset_${randomUUID3()}`
|
|
29267
29788
|
};
|
|
29268
29789
|
}
|
|
29269
29790
|
function mediaItem(u) {
|
|
@@ -29445,7 +29966,7 @@ ${payload(u)}`
|
|
|
29445
29966
|
}
|
|
29446
29967
|
|
|
29447
29968
|
// src/tools/canvas-run.ts
|
|
29448
|
-
import { randomUUID as
|
|
29969
|
+
import { randomUUID as randomUUID4 } from "crypto";
|
|
29449
29970
|
var MAX_REMEMBERED = 50;
|
|
29450
29971
|
var acceptedPacing = { repeats: 8, pauseMs: 2e3 };
|
|
29451
29972
|
var statusPacing = {
|
|
@@ -29474,23 +29995,23 @@ function prettyClient(name) {
|
|
|
29474
29995
|
function modeText(mode) {
|
|
29475
29996
|
return mode === "simulated" ? "Simulado (n\xE3o gasta)" : mode === "live" ? "Real" : mode ?? "?";
|
|
29476
29997
|
}
|
|
29477
|
-
function estimateLines(
|
|
29478
|
-
if (!
|
|
29998
|
+
function estimateLines(estimate2, titleOf) {
|
|
29999
|
+
if (!estimate2) return [];
|
|
29479
30000
|
const lines = [];
|
|
29480
|
-
const nodes =
|
|
30001
|
+
const nodes = estimate2.nodes ?? [];
|
|
29481
30002
|
const now = nodes.filter((n) => n.willRun);
|
|
29482
30003
|
for (const n of now) {
|
|
29483
30004
|
const cost = n.error ? `estimativa falhou (${n.error})` : dia(n.diamonds);
|
|
29484
30005
|
lines.push(`- ${n.title ?? titleOf(n.nodeId)} (${n.nodeId}): ${cost}`);
|
|
29485
30006
|
}
|
|
29486
|
-
if (
|
|
29487
|
-
lines.push(`\u2026 e mais ${
|
|
30007
|
+
if (estimate2.omitted) {
|
|
30008
|
+
lines.push(`\u2026 e mais ${estimate2.omitted} n\xF3(s) fora da lista (a resposta da aba foi cortada pelo tamanho; o total vale para todos).`);
|
|
29488
30009
|
}
|
|
29489
|
-
const cached2 =
|
|
30010
|
+
const cached2 = estimate2.cached ?? nodes.filter((n) => !n.willRun && !n.afterApproval).length;
|
|
29490
30011
|
if (cached2) lines.push(`Em cache (n\xE3o rodam): ${cached2}.`);
|
|
29491
|
-
const later =
|
|
29492
|
-
if (later) lines.push(`Esperando aprova\xE7\xE3o no board depois disso: ${later} n\xF3(s), \u2248 ${dia(
|
|
29493
|
-
const unknown2 =
|
|
30012
|
+
const later = estimate2.counts?.later ?? estimate2.later?.nodes?.length ?? 0;
|
|
30013
|
+
if (later) lines.push(`Esperando aprova\xE7\xE3o no board depois disso: ${later} n\xF3(s), \u2248 ${dia(estimate2.later?.total ?? 0)} (fora desta conta).`);
|
|
30014
|
+
const unknown2 = estimate2.counts?.unknown ?? estimate2.unknown?.length ?? 0;
|
|
29494
30015
|
if (unknown2) {
|
|
29495
30016
|
lines.push(`Sem estimativa: ${unknown2} n\xF3(s) (texto cobra por token; o total \xE9 piso).`);
|
|
29496
30017
|
}
|
|
@@ -29596,7 +30117,7 @@ function registerCanvasRunTools(server, api, run) {
|
|
|
29596
30117
|
},
|
|
29597
30118
|
async (args) => run(async () => {
|
|
29598
30119
|
const target = targetOf(args);
|
|
29599
|
-
const requestId = (args.request_id ??
|
|
30120
|
+
const requestId = (args.request_id ?? randomUUID4()).toLowerCase();
|
|
29600
30121
|
const label = args.label ?? prettyClient(server.server.getClientVersion()?.name);
|
|
29601
30122
|
const ask = async () => {
|
|
29602
30123
|
try {
|
|
@@ -30461,7 +30982,7 @@ N\xF3s: ${Object.entries(ids).map(([k, v]) => `${k}=${v}`).join(" \xB7 ")}` : ""
|
|
|
30461
30982
|
"canvas_add_node",
|
|
30462
30983
|
{
|
|
30463
30984
|
title: "Canvas: adicionar n\xF3",
|
|
30464
|
-
description: `Adiciona um n\xF3 (n\xE3o executa). ${READ}kind: ${kindList()}. data completa o padr\xE3o do tipo; label d\xE1 o nome. Sem position, nasce ao lado do n\xF3 ligado ou \xE0 direita do board (com aba, no fim do conte\xFAdo da aba); aba grava data.abaId. Texto livre (label) sem size {w} nasce na largura do tamanho do texto: titulo 2000, subtitulo 1200, corpo 320. Prompt sem size nasce com 1024 \xD7 516; gerador de imagem ou v\xEDdeo, com altura 516 e a largura do aspect_ratio (16:9 917, 9:16 290, 1:1 516). inputs/outputs j\xE1 ligam o n\xF3 no mesmo passo. ` + MENTION_NOTE + MONTAGE_NOTE,
|
|
30985
|
+
description: `Adiciona um n\xF3 (n\xE3o executa). ${READ}kind: ${kindList()}. data completa o padr\xE3o do tipo; label d\xE1 o nome. Sem position, nasce ao lado do n\xF3 ligado ou \xE0 direita do board (com aba, no fim do conte\xFAdo da aba); aba grava data.abaId. Texto livre (label) sem size {w} nasce na largura do tamanho do texto: titulo 2000, subtitulo 1200, corpo 320. Prompt sem size nasce com 1024 \xD7 516; gerador de imagem ou v\xEDdeo, com altura 516 e a largura do aspect_ratio (16:9 917, 9:16 290, 1:1 516). inputs/outputs j\xE1 ligam o n\xF3 no mesmo passo. ` + DUB_NOTE + MENTION_NOTE + MONTAGE_NOTE,
|
|
30465
30986
|
inputSchema: {
|
|
30466
30987
|
board_id: boardId3,
|
|
30467
30988
|
kind: external_exports.string().min(1).max(40),
|
|
@@ -30526,7 +31047,7 @@ N\xF3s: ${Object.entries(ids).map(([k, v]) => `${k}=${v}`).join(" \xB7 ")}` : ""
|
|
|
30526
31047
|
"canvas_update_node",
|
|
30527
31048
|
{
|
|
30528
31049
|
title: "Canvas: editar n\xF3",
|
|
30529
|
-
description: `Muda campos do data de um n\xF3, chave a chave (null apaga a chave), sem executar. ${READ}label renomeia; position move; size {w, h} muda a caixa (piso: o cart\xE3o cresce com o conte\xFAdo). N\xE3o troca o tipo. Cada chave \xE9 gravada inteira: leia antes com canvas_read_node e mande o valor completo j\xE1 revisado, para n\xE3o apagar o que outra pessoa escreveu. Para mudar partes de uma estrutura grande (clipes da timeline), use canvas_patch_node, por caminho; v\xE1rios n\xF3s de uma vez, canvas_update_nodes. ` + MENTION_NOTE + MONTAGE_NOTE,
|
|
31050
|
+
description: `Muda campos do data de um n\xF3, chave a chave (null apaga a chave), sem executar. ${READ}label renomeia; position move; size {w, h} muda a caixa (piso: o cart\xE3o cresce com o conte\xFAdo). N\xE3o troca o tipo. Cada chave \xE9 gravada inteira: leia antes com canvas_read_node e mande o valor completo j\xE1 revisado, para n\xE3o apagar o que outra pessoa escreveu. Para mudar partes de uma estrutura grande (clipes da timeline), use canvas_patch_node, por caminho; v\xE1rios n\xF3s de uma vez, canvas_update_nodes. ` + DUB_NOTE + MENTION_NOTE + MONTAGE_NOTE,
|
|
30530
31051
|
inputSchema: {
|
|
30531
31052
|
board_id: boardId3,
|
|
30532
31053
|
node_id: nodeIdArg2,
|
|
@@ -30554,7 +31075,7 @@ N\xF3s: ${Object.entries(ids).map(([k, v]) => `${k}=${v}`).join(" \xB7 ")}` : ""
|
|
|
30554
31075
|
"canvas_update_nodes",
|
|
30555
31076
|
{
|
|
30556
31077
|
title: "Canvas: editar v\xE1rios n\xF3s",
|
|
30557
|
-
description: 'Muda v\xE1rios n\xF3s num passo s\xF3, cada um como no canvas_update_node (position, size, label, data com null apagando). layout_only: true aceita s\xF3 position e size {w, h}, n\xE3o exige leitura e n\xE3o recusa por "outra pessoa mexeu" (nesses dois campos vale quem grava por \xFAltimo). Sem layout_only, exige canvas_read_board nesta sess\xE3o e recusa se outra pessoa mexeu em algum desses n\xF3s. Quebra em envelopes de at\xE9 64 KB e relata cada um. Para arrumar linhas inteiras (t\xEDtulo, prompt, refer\xEAncia, gerador), use canvas_arrange_rows.',
|
|
31078
|
+
description: 'Muda v\xE1rios n\xF3s num passo s\xF3, cada um como no canvas_update_node (position, size, label, data com null apagando). layout_only: true aceita s\xF3 position e size {w, h}, n\xE3o exige leitura e n\xE3o recusa por "outra pessoa mexeu" (nesses dois campos vale quem grava por \xFAltimo). Sem layout_only, exige canvas_read_board nesta sess\xE3o e recusa se outra pessoa mexeu em algum desses n\xF3s. Quebra em envelopes de at\xE9 64 KB e relata cada um. Para arrumar linhas inteiras (t\xEDtulo, prompt, refer\xEAncia, gerador), use canvas_arrange_rows. ' + DUB_NOTE,
|
|
30558
31079
|
inputSchema: {
|
|
30559
31080
|
board_id: boardId3,
|
|
30560
31081
|
nodes: external_exports.array(
|
|
@@ -30606,7 +31127,7 @@ N\xF3s: ${Object.entries(ids).map(([k, v]) => `${k}=${v}`).join(" \xB7 ")}` : ""
|
|
|
30606
31127
|
"canvas_patch_node",
|
|
30607
31128
|
{
|
|
30608
31129
|
title: "Canvas: gravar por caminho",
|
|
30609
|
-
description: `Grava v\xE1rios caminhos dentro do data de um n\xF3, sem executar: {path, value} grava, {path, unset: true} apaga. ${READ}O caminho atravessa objetos (o n\xEDvel que falta \xE9 criado) e n\xE3o entra em lista: para mudar um item de lista, grave a lista inteira. Quebra sozinho em envelopes de at\xE9 64 KB, em ordem, e devolve o resultado de cada um; entre envelopes n\xE3o h\xE1 atomicidade (o que entrou fica). Serve para mexer em partes de uma estrutura grande, como clipes da timeline da Montagem, sem reenviar tudo. Leia antes com canvas_read_node. ` + MENTION_NOTE + MONTAGE_NOTE,
|
|
31130
|
+
description: `Grava v\xE1rios caminhos dentro do data de um n\xF3, sem executar: {path, value} grava, {path, unset: true} apaga. ${READ}O caminho atravessa objetos (o n\xEDvel que falta \xE9 criado) e n\xE3o entra em lista: para mudar um item de lista, grave a lista inteira. Quebra sozinho em envelopes de at\xE9 64 KB, em ordem, e devolve o resultado de cada um; entre envelopes n\xE3o h\xE1 atomicidade (o que entrou fica). Serve para mexer em partes de uma estrutura grande, como clipes da timeline da Montagem, sem reenviar tudo. Leia antes com canvas_read_node. ` + DUB_NOTE + MENTION_NOTE + MONTAGE_NOTE,
|
|
30610
31131
|
inputSchema: {
|
|
30611
31132
|
board_id: boardId3,
|
|
30612
31133
|
node_id: nodeIdArg2,
|
|
@@ -30846,7 +31367,7 @@ N\xF3s: ${Object.entries(ids).map(([k, v]) => `${k}=${v}`).join(" \xB7 ")}` : ""
|
|
|
30846
31367
|
import { createRequire } from "module";
|
|
30847
31368
|
var require2 = createRequire(import.meta.url);
|
|
30848
31369
|
function readVersion() {
|
|
30849
|
-
if ("0.
|
|
31370
|
+
if ("0.47.0") return "0.47.0";
|
|
30850
31371
|
try {
|
|
30851
31372
|
const pkg = require2("../package.json");
|
|
30852
31373
|
return pkg.version ?? "0.0.0-unknown";
|
|
@@ -30859,7 +31380,7 @@ var VERSION = readVersion();
|
|
|
30859
31380
|
// src/server.ts
|
|
30860
31381
|
var SERVER_INSTRUCTIONS = [
|
|
30861
31382
|
"BePlus: tudo roda pela conta do usu\xE1rio (diamantes, limites e hist\xF3rico na plataforma).",
|
|
30862
|
-
'M\xEDdia: generate_*
|
|
31383
|
+
'M\xEDdia: generate_* e elevenlabs_* gastam diamantes; confira com estimate_cost antes de lotes grandes. Sem project, a gera\xE7\xE3o cai no projeto ativo; billing:"personal" cobra do usu\xE1rio.',
|
|
30863
31384
|
"Calls: search_calls acha, get_call traz a transcri\xE7\xE3o.",
|
|
30864
31385
|
"Canvas online (canvas_*): leia com canvas_read_board antes de editar e siga o estado lido. Cada edi\xE7\xE3o vai num passo s\xF3; se outra pessoa mexeu nos mesmos n\xF3s, a ferramenta recusa e pede releitura. As canvas_* n\xE3o geram m\xEDdia, exceto canvas_run: roda n\xF3s pela aba do Canvas aberta do usu\xE1rio e gasta diamantes; max_diamonds \xE9 o teto que o usu\xE1rio autorizou (dry_run s\xF3 estima). D\xEA nome (label) aos n\xF3s, n\xE3o invente tipos nem portas, e confirme antes de canvas_delete.",
|
|
30865
31386
|
"Cada aba \xE9 um plano: ao criar, passe aba (id da se\xE7\xE3o) em canvas_add_node e canvas_upload_media, sen\xE3o o cart\xE3o pode cair em Avulsos. canvas_read_board com aba l\xEA uma aba s\xF3.",
|
|
@@ -30874,6 +31395,7 @@ function buildServer(cfg) {
|
|
|
30874
31395
|
registerUpscaleTools(server, client, cfg);
|
|
30875
31396
|
registerAudioTools(server, client, cfg);
|
|
30876
31397
|
registerMusicTools(server, client, cfg);
|
|
31398
|
+
registerElevenLabsTools(server, client, cfg);
|
|
30877
31399
|
registerAccountTools(server, client, cfg);
|
|
30878
31400
|
registerAnalyzeTools(server, client, cfg);
|
|
30879
31401
|
registerProjectTools(server, client, cfg);
|