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/remote-server.js
CHANGED
|
@@ -25199,7 +25199,7 @@ var BeplusClient = class {
|
|
|
25199
25199
|
const started = Date.now();
|
|
25200
25200
|
for (let attempt = 0; ; attempt++) {
|
|
25201
25201
|
let res = null;
|
|
25202
|
-
let
|
|
25202
|
+
let failure2 = null;
|
|
25203
25203
|
try {
|
|
25204
25204
|
res = await fetchWithAuth(
|
|
25205
25205
|
this.cfg,
|
|
@@ -25214,11 +25214,11 @@ var BeplusClient = class {
|
|
|
25214
25214
|
);
|
|
25215
25215
|
} catch (e) {
|
|
25216
25216
|
if (!(e instanceof ApiError) || e.httpStatus !== 0) throw e;
|
|
25217
|
-
|
|
25217
|
+
failure2 = e;
|
|
25218
25218
|
}
|
|
25219
25219
|
const status = res ? res.status : 0;
|
|
25220
25220
|
if (!retry || !RETRYABLE.has(status)) {
|
|
25221
|
-
if (
|
|
25221
|
+
if (failure2) throw failure2;
|
|
25222
25222
|
return this.read(res, path);
|
|
25223
25223
|
}
|
|
25224
25224
|
const step = Math.min(p.capMs, p.baseMs * 2 ** attempt);
|
|
@@ -25299,7 +25299,12 @@ var BeplusClient = class {
|
|
|
25299
25299
|
offset: query.offset,
|
|
25300
25300
|
// Only send when true — the backend treats truthy as "constrain".
|
|
25301
25301
|
favorite: query.favorite ? "true" : void 0,
|
|
25302
|
-
approved: query.approved ? "true" : void 0
|
|
25302
|
+
approved: query.approved ? "true" : void 0,
|
|
25303
|
+
project: query.project,
|
|
25304
|
+
user: query.user,
|
|
25305
|
+
scope: query.scope,
|
|
25306
|
+
type: query.type,
|
|
25307
|
+
cursor: query.cursor
|
|
25303
25308
|
}
|
|
25304
25309
|
});
|
|
25305
25310
|
}
|
|
@@ -25336,6 +25341,29 @@ var BeplusClient = class {
|
|
|
25336
25341
|
);
|
|
25337
25342
|
return r?.state ?? null;
|
|
25338
25343
|
}
|
|
25344
|
+
// `retry: false` nas leituras de apoio: 503 aqui é "não configurado" e não pode segurar list_models nem check_generation.
|
|
25345
|
+
elevenLabsCatalog(opts = {}) {
|
|
25346
|
+
return this.request("GET", "/elevenlabs/catalog", { timeoutMs: 15e3, ...opts });
|
|
25347
|
+
}
|
|
25348
|
+
elevenLabsVoices(query) {
|
|
25349
|
+
return this.request("GET", "/elevenlabs/voices", { query, timeoutMs: 2e4 });
|
|
25350
|
+
}
|
|
25351
|
+
deleteElevenLabsVoice(id) {
|
|
25352
|
+
return this.request("DELETE", `/elevenlabs/voices/${encodeURIComponent(id)}`, { timeoutMs: 3e4 });
|
|
25353
|
+
}
|
|
25354
|
+
saveElevenLabsVoice(body2) {
|
|
25355
|
+
return this.request("POST", "/elevenlabs/voices/design/save", { body: body2, timeoutMs: 6e4 });
|
|
25356
|
+
}
|
|
25357
|
+
elevenLabsEstimate(body2) {
|
|
25358
|
+
return this.request("POST", "/elevenlabs/estimate", { body: body2, timeoutMs: 6e4 });
|
|
25359
|
+
}
|
|
25360
|
+
// Sem repetição: este POST cobra. Ferramenta longa volta `processing` logo, a rápida segura até a resposta.
|
|
25361
|
+
elevenLabsGenerate(body2) {
|
|
25362
|
+
return this.request("POST", "/elevenlabs/generate", { body: body2, timeoutMs: 18e4 });
|
|
25363
|
+
}
|
|
25364
|
+
elevenLabsJob(id, opts = {}) {
|
|
25365
|
+
return this.request("GET", `/elevenlabs/generations/${encodeURIComponent(id)}`, { timeoutMs: 15e3, ...opts });
|
|
25366
|
+
}
|
|
25339
25367
|
models() {
|
|
25340
25368
|
return this.request("GET", "/models");
|
|
25341
25369
|
}
|
|
@@ -25736,6 +25764,11 @@ async function uploadBytes(cfg, file) {
|
|
|
25736
25764
|
}
|
|
25737
25765
|
return fileUrl;
|
|
25738
25766
|
}
|
|
25767
|
+
async function toStorageUrl(cfg, ref) {
|
|
25768
|
+
if (!isRemoteRef(ref)) return uploadBytes(cfg, await loadLocal(ref));
|
|
25769
|
+
if (new URL(ref).host === BEPLUS_STORAGE_HOST) return ref;
|
|
25770
|
+
return uploadBytes(cfg, await loadRemote(ref));
|
|
25771
|
+
}
|
|
25739
25772
|
async function uploadFile(cfg, ref) {
|
|
25740
25773
|
return uploadBytes(cfg, await loadLocal(ref));
|
|
25741
25774
|
}
|
|
@@ -26027,6 +26060,19 @@ var ASPECT_RATIOS = ["1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "4:5", "
|
|
|
26027
26060
|
var VIDEO_ASPECT_RATIOS = [...ASPECT_RATIOS, "adaptive"];
|
|
26028
26061
|
var IMAGE_RESOLUTIONS = ["1K", "2K", "4K"];
|
|
26029
26062
|
var VIDEO_RESOLUTIONS = ["480p", "720p", "1080p", "4K"];
|
|
26063
|
+
var ELEVENLABS_TOOLS = [
|
|
26064
|
+
"tts",
|
|
26065
|
+
"dialogue",
|
|
26066
|
+
"sfx",
|
|
26067
|
+
"isolate",
|
|
26068
|
+
"voice_change",
|
|
26069
|
+
"transcribe",
|
|
26070
|
+
"align",
|
|
26071
|
+
"music",
|
|
26072
|
+
"stems",
|
|
26073
|
+
"video_music",
|
|
26074
|
+
"voice_design"
|
|
26075
|
+
];
|
|
26030
26076
|
var DEFAULTS = {
|
|
26031
26077
|
imageModel: "google/nano-banana-2.1",
|
|
26032
26078
|
imageAspect: "1:1",
|
|
@@ -26285,6 +26331,433 @@ function formatToolResult(state, fullWords) {
|
|
|
26285
26331
|
return lines.join("\n") || "(sem resultado)";
|
|
26286
26332
|
}
|
|
26287
26333
|
|
|
26334
|
+
// src/tools/elevenlabs.ts
|
|
26335
|
+
import { randomUUID } from "crypto";
|
|
26336
|
+
var elevenLabsPolling = {
|
|
26337
|
+
intervalMs: 3e3,
|
|
26338
|
+
budgetMs: 9e4,
|
|
26339
|
+
sleep: (ms) => new Promise((r) => setTimeout(r, ms))
|
|
26340
|
+
};
|
|
26341
|
+
var MAX_TEXT_CHARS = 2e4;
|
|
26342
|
+
var SITE_ONLY_TOOLS = /* @__PURE__ */ new Set(["dub", "voice_clone"]);
|
|
26343
|
+
var SITE_ONLY_LABEL = "s\xF3 no site da BePlus, na aba \xC1udio do IA Lab";
|
|
26344
|
+
var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
26345
|
+
var DESTINATION_NOTE = " Vai para o cliente e projeto ativos: confirme o destino com o usu\xE1rio antes (list_clients, list_projects).";
|
|
26346
|
+
var COST_NOTE = " Gasta diamantes; dry_run: true mostra o custo sem gastar.";
|
|
26347
|
+
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).";
|
|
26348
|
+
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.";
|
|
26349
|
+
var COMMON_FIELDS = {
|
|
26350
|
+
project: external_exports.string().max(64).optional().describe("Projeto (uuid ou code curto). Omita para usar o projeto ativo."),
|
|
26351
|
+
billing: external_exports.enum(["personal"]).optional().describe('"personal" cobra do seu saldo pessoal e ignora o projeto, mesmo o ativo. Incompat\xEDvel com project.'),
|
|
26352
|
+
dry_run: external_exports.boolean().optional().describe("true devolve o custo em diamantes sem gerar nem gastar.")
|
|
26353
|
+
};
|
|
26354
|
+
function contractMessage(e) {
|
|
26355
|
+
if (!(e instanceof ApiError)) return void 0;
|
|
26356
|
+
const body2 = e.body;
|
|
26357
|
+
const message = body2?.error?.message ?? body2?.result?.error?.message;
|
|
26358
|
+
return typeof message === "string" && message ? message : void 0;
|
|
26359
|
+
}
|
|
26360
|
+
async function failure(client, e) {
|
|
26361
|
+
const ready = contractMessage(e);
|
|
26362
|
+
const raw = ready ?? (e instanceof Error ? e.message : "");
|
|
26363
|
+
if (isTeamGatingError(raw)) return errorResult(await buildPickProjectMessage(client));
|
|
26364
|
+
const text = ready ?? apiErrorToUserMessage(e);
|
|
26365
|
+
return errorResult(isBudgetBlockedError(raw) ? `${text}
|
|
26366
|
+
${BUDGET_BLOCKED_GUIDANCE}` : text);
|
|
26367
|
+
}
|
|
26368
|
+
var VOICE_ORIGIN = { premade: "padr\xE3o", library: "biblioteca", mine: "sua" };
|
|
26369
|
+
function voiceLine(v) {
|
|
26370
|
+
const traits = [v.language, v.gender, v.accent].filter(Boolean).join(", ");
|
|
26371
|
+
const description = v.description ? ` | ${v.description.length > 110 ? `${v.description.slice(0, 107)}...` : v.description}` : "";
|
|
26372
|
+
return `${v.id} | ${v.name} | ${VOICE_ORIGIN[v.source]}${traits ? ` | ${traits}` : ""}${description}`;
|
|
26373
|
+
}
|
|
26374
|
+
function jobFooter(job) {
|
|
26375
|
+
const balance = job.balance === void 0 ? "" : ` \xB7 Saldo: ${job.balance} \u{1F48E}`;
|
|
26376
|
+
return `Gera\xE7\xE3o: ${job.generationId}
|
|
26377
|
+
Custo: ${job.diamonds} \u{1F48E}${balance}`;
|
|
26378
|
+
}
|
|
26379
|
+
function formatJob(job) {
|
|
26380
|
+
if (job.status === "failed") return errorResult(`${job.error?.message ?? "A gera\xE7\xE3o falhou."}
|
|
26381
|
+
${jobFooter(job)}`);
|
|
26382
|
+
if (job.status === "processing") {
|
|
26383
|
+
return textResult(
|
|
26384
|
+
`\u23F3 Ainda em processamento. N\xE3o gere de novo: use check_generation com o id abaixo.
|
|
26385
|
+
${jobFooter(job)}`
|
|
26386
|
+
);
|
|
26387
|
+
}
|
|
26388
|
+
const out = job.output ?? {};
|
|
26389
|
+
const lines = [`\u2705 Pronto (${job.tool}).`];
|
|
26390
|
+
for (const f of out.files ?? []) {
|
|
26391
|
+
const duration3 = f.durationSec === void 0 ? "" : ` (${f.durationSec.toFixed(1)}s)`;
|
|
26392
|
+
lines.push(`${f.label ? `${f.label}: ` : ""}${f.url}${duration3}`);
|
|
26393
|
+
}
|
|
26394
|
+
if (out.text) {
|
|
26395
|
+
const cut = out.text.length > MAX_TEXT_CHARS;
|
|
26396
|
+
lines.push(cut ? `${out.text.slice(0, MAX_TEXT_CHARS)}
|
|
26397
|
+
[texto cortado em ${MAX_TEXT_CHARS} caracteres]` : out.text);
|
|
26398
|
+
}
|
|
26399
|
+
if (out.words?.length) {
|
|
26400
|
+
const speakers = new Set(out.words.map((w) => w.speaker).filter(Boolean)).size;
|
|
26401
|
+
lines.push(`${out.words.length} palavras com tempo${speakers ? `, ${speakers} locutores` : ""}.`);
|
|
26402
|
+
}
|
|
26403
|
+
if (out.srtUrl) lines.push(`Legenda: ${out.srtUrl}`);
|
|
26404
|
+
if (out.previews?.length) {
|
|
26405
|
+
lines.push("Pr\xE9vias (id | \xE1udio):", ...out.previews.map((p) => `${p.id} | ${p.url}`));
|
|
26406
|
+
lines.push("Mostre as pr\xE9vias ao usu\xE1rio. A escolhida vira voz com elevenlabs_voice_design_save.");
|
|
26407
|
+
}
|
|
26408
|
+
if (out.voice) lines.push(`Voz: ${voiceLine(out.voice)}`);
|
|
26409
|
+
lines.push(jobFooter(job));
|
|
26410
|
+
return textResult(lines.join("\n"));
|
|
26411
|
+
}
|
|
26412
|
+
async function waitForJob(client, first) {
|
|
26413
|
+
const { intervalMs, budgetMs, sleep: sleep4 } = elevenLabsPolling;
|
|
26414
|
+
let job = first;
|
|
26415
|
+
for (let waited = 0; job.status === "processing" && waited < budgetMs; waited += intervalMs) {
|
|
26416
|
+
await sleep4(intervalMs);
|
|
26417
|
+
try {
|
|
26418
|
+
job = await client.elevenLabsJob(first.generationId);
|
|
26419
|
+
} catch {
|
|
26420
|
+
return job;
|
|
26421
|
+
}
|
|
26422
|
+
}
|
|
26423
|
+
return job;
|
|
26424
|
+
}
|
|
26425
|
+
async function toSource(cfg, ref) {
|
|
26426
|
+
if (UUID.test(ref)) return { generationId: ref };
|
|
26427
|
+
try {
|
|
26428
|
+
return { fileUrl: await toStorageUrl(cfg, ref) };
|
|
26429
|
+
} catch (e) {
|
|
26430
|
+
if (e instanceof ApiError && e.httpStatus === 413) throw new ApiError(413, TOO_LARGE_MESSAGE);
|
|
26431
|
+
throw e;
|
|
26432
|
+
}
|
|
26433
|
+
}
|
|
26434
|
+
function uploadedHint(body2) {
|
|
26435
|
+
const url = body2.source?.fileUrl;
|
|
26436
|
+
return url ? `
|
|
26437
|
+
Arquivo na BePlus: ${url}. Use esta URL em source para n\xE3o subir de novo.` : "";
|
|
26438
|
+
}
|
|
26439
|
+
async function estimate(client, body2) {
|
|
26440
|
+
const res = await client.elevenLabsEstimate(body2);
|
|
26441
|
+
const duration3 = res.durationSec === void 0 ? "" : ` para ${res.durationSec.toFixed(1)}s`;
|
|
26442
|
+
return textResult(`Custo estimado: ${res.diamonds} \u{1F48E}${duration3}. Nada foi gerado nem cobrado.${uploadedHint(body2)}`);
|
|
26443
|
+
}
|
|
26444
|
+
async function generate(client, body2) {
|
|
26445
|
+
let job;
|
|
26446
|
+
try {
|
|
26447
|
+
job = await client.elevenLabsGenerate({ ...body2, idempotencyKey: randomUUID() });
|
|
26448
|
+
} catch (e) {
|
|
26449
|
+
if (e instanceof ApiError && (e.httpStatus === 0 || e.httpStatus === 408)) {
|
|
26450
|
+
return errorResult(
|
|
26451
|
+
"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."
|
|
26452
|
+
);
|
|
26453
|
+
}
|
|
26454
|
+
throw e;
|
|
26455
|
+
}
|
|
26456
|
+
return formatJob(await waitForJob(client, job));
|
|
26457
|
+
}
|
|
26458
|
+
async function estimateElevenLabsModel(client, cfg, model, params, file) {
|
|
26459
|
+
const [, tool, variant] = model.split("/");
|
|
26460
|
+
if (!ELEVENLABS_TOOLS.includes(tool ?? "")) {
|
|
26461
|
+
return errorResult(`Ferramenta desconhecida em "${model}". Use elevenlabs/<ferramenta>: ${ELEVENLABS_TOOLS.join(", ")}.`);
|
|
26462
|
+
}
|
|
26463
|
+
try {
|
|
26464
|
+
const body2 = { ...params, tool };
|
|
26465
|
+
if (variant) body2.model = variant;
|
|
26466
|
+
if (file) body2.source = await toSource(cfg, file);
|
|
26467
|
+
return await estimate(client, body2);
|
|
26468
|
+
} catch (e) {
|
|
26469
|
+
return failure(client, e);
|
|
26470
|
+
}
|
|
26471
|
+
}
|
|
26472
|
+
function elevenLabsCatalogBlock(catalog) {
|
|
26473
|
+
if (!catalog?.enabled) return "";
|
|
26474
|
+
const lines = catalog.tools.filter((t) => t.available).map((t) => {
|
|
26475
|
+
if (SITE_ONLY_TOOLS.has(t.tool)) return `\u2022 ${t.label}: ${SITE_ONLY_LABEL}.`;
|
|
26476
|
+
const models = t.models?.length ? ` Modelos: ${t.models.map((m) => m.id).join(", ")}.` : "";
|
|
26477
|
+
return `\u2022 elevenlabs_${t.tool}: ${t.label}, ${t.diamondsPerUnitHint}.${models}`;
|
|
26478
|
+
});
|
|
26479
|
+
return lines.length ? `
|
|
26480
|
+
|
|
26481
|
+
ElevenLabs (detalhes e limites em elevenlabs_catalog):
|
|
26482
|
+
${lines.join("\n")}` : "";
|
|
26483
|
+
}
|
|
26484
|
+
function registerElevenLabsTools(server, client, cfg) {
|
|
26485
|
+
function spendTool(name, title, description, shape, build2) {
|
|
26486
|
+
server.registerTool(
|
|
26487
|
+
name,
|
|
26488
|
+
{
|
|
26489
|
+
title,
|
|
26490
|
+
description: description + COST_NOTE + DESTINATION_NOTE,
|
|
26491
|
+
inputSchema: { ...shape, ...COMMON_FIELDS },
|
|
26492
|
+
annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: true }
|
|
26493
|
+
},
|
|
26494
|
+
(async (args) => {
|
|
26495
|
+
try {
|
|
26496
|
+
const body2 = compact({
|
|
26497
|
+
...await build2(args),
|
|
26498
|
+
project: resolveProjectArg(args.project, args.billing, cfg.activeProject),
|
|
26499
|
+
billing: args.billing
|
|
26500
|
+
});
|
|
26501
|
+
return await (args.dry_run ? estimate(client, body2) : generate(client, body2));
|
|
26502
|
+
} catch (e) {
|
|
26503
|
+
return failure(client, e);
|
|
26504
|
+
}
|
|
26505
|
+
})
|
|
26506
|
+
);
|
|
26507
|
+
}
|
|
26508
|
+
const modelField = (example) => external_exports.string().min(1).describe(`Id do modelo, ex.: ${example}. A lista sai de elevenlabs_catalog.`);
|
|
26509
|
+
const voiceField = external_exports.string().min(1).describe("Id de uma voz de elevenlabs_list_voices. Outra voz \xE9 recusada.");
|
|
26510
|
+
const sourceField = external_exports.string().min(1).describe(SOURCE_HELP);
|
|
26511
|
+
server.registerTool(
|
|
26512
|
+
"elevenlabs_catalog",
|
|
26513
|
+
{
|
|
26514
|
+
title: "ElevenLabs: ferramentas e modelos",
|
|
26515
|
+
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.",
|
|
26516
|
+
inputSchema: {},
|
|
26517
|
+
annotations: { readOnlyHint: true, openWorldHint: false }
|
|
26518
|
+
},
|
|
26519
|
+
async () => {
|
|
26520
|
+
try {
|
|
26521
|
+
const catalog = await client.elevenLabsCatalog();
|
|
26522
|
+
if (!catalog.enabled) return textResult("A ElevenLabs est\xE1 desligada na plataforma agora.");
|
|
26523
|
+
const lines = catalog.tools.map((t) => {
|
|
26524
|
+
if (SITE_ONLY_TOOLS.has(t.tool)) return `${t.label}: ${SITE_ONLY_LABEL}. N\xE3o h\xE1 tool para isso aqui.`;
|
|
26525
|
+
const head = `elevenlabs_${t.tool} | ${t.label} | ${t.available ? t.diamondsPerUnitHint : "indispon\xEDvel agora"}`;
|
|
26526
|
+
const models = (t.models ?? []).map((m) => ` ${m.id}: ${m.label}. ${m.description}`);
|
|
26527
|
+
return [head, ` ${t.description}`, ` Limites: ${JSON.stringify(t.limits)}`, ...models].join("\n");
|
|
26528
|
+
});
|
|
26529
|
+
return textResult(lines.join("\n"));
|
|
26530
|
+
} catch (e) {
|
|
26531
|
+
return failure(client, e);
|
|
26532
|
+
}
|
|
26533
|
+
}
|
|
26534
|
+
);
|
|
26535
|
+
server.registerTool(
|
|
26536
|
+
"elevenlabs_list_voices",
|
|
26537
|
+
{
|
|
26538
|
+
title: "ElevenLabs: listar vozes",
|
|
26539
|
+
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.",
|
|
26540
|
+
inputSchema: {
|
|
26541
|
+
search: external_exports.string().max(100).optional().describe("Texto livre: nome, descri\xE7\xE3o, sotaque."),
|
|
26542
|
+
language: external_exports.string().max(12).optional().describe("Idioma, ex.: pt, en."),
|
|
26543
|
+
gender: external_exports.string().max(20).optional(),
|
|
26544
|
+
page: external_exports.number().int().min(1).optional().describe("Padr\xE3o 1.")
|
|
26545
|
+
},
|
|
26546
|
+
annotations: { readOnlyHint: true, openWorldHint: false }
|
|
26547
|
+
},
|
|
26548
|
+
async (args) => {
|
|
26549
|
+
try {
|
|
26550
|
+
const res = await client.elevenLabsVoices(compact(args));
|
|
26551
|
+
if (!res.voices.length) return textResult("Nenhuma voz encontrada com esses filtros.");
|
|
26552
|
+
const more = res.hasMore ? `
|
|
26553
|
+
Use page=${res.page + 1} para ver mais.` : "";
|
|
26554
|
+
return textResult(`Vozes, p\xE1gina ${res.page} (id | nome | origem | detalhes):
|
|
26555
|
+
${res.voices.map(voiceLine).join("\n")}${more}`);
|
|
26556
|
+
} catch (e) {
|
|
26557
|
+
return failure(client, e);
|
|
26558
|
+
}
|
|
26559
|
+
}
|
|
26560
|
+
);
|
|
26561
|
+
server.registerTool(
|
|
26562
|
+
"elevenlabs_delete_voice",
|
|
26563
|
+
{
|
|
26564
|
+
title: "ElevenLabs: apagar voz sua",
|
|
26565
|
+
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.",
|
|
26566
|
+
inputSchema: { id: external_exports.string().min(1).describe('Id da voz em elevenlabs_list_voices, com origem "sua".') },
|
|
26567
|
+
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: true }
|
|
26568
|
+
},
|
|
26569
|
+
async ({ id }) => {
|
|
26570
|
+
try {
|
|
26571
|
+
await client.deleteElevenLabsVoice(id);
|
|
26572
|
+
return textResult(`\u2705 Voz ${id} apagada.`);
|
|
26573
|
+
} catch (e) {
|
|
26574
|
+
return failure(client, e);
|
|
26575
|
+
}
|
|
26576
|
+
}
|
|
26577
|
+
);
|
|
26578
|
+
server.registerTool(
|
|
26579
|
+
"elevenlabs_voice_design_save",
|
|
26580
|
+
{
|
|
26581
|
+
title: "ElevenLabs: salvar voz criada",
|
|
26582
|
+
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.",
|
|
26583
|
+
inputSchema: {
|
|
26584
|
+
preview_id: external_exports.string().min(1).describe("Id da pr\xE9via escolhida."),
|
|
26585
|
+
name: external_exports.string().min(1).max(40).describe("Nome da voz.")
|
|
26586
|
+
},
|
|
26587
|
+
annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: true }
|
|
26588
|
+
},
|
|
26589
|
+
async ({ preview_id, name }) => {
|
|
26590
|
+
try {
|
|
26591
|
+
const voice = await client.saveElevenLabsVoice({ previewId: preview_id, name });
|
|
26592
|
+
return textResult(`\u2705 Voz salva.
|
|
26593
|
+
${voiceLine(voice)}`);
|
|
26594
|
+
} catch (e) {
|
|
26595
|
+
return failure(client, e);
|
|
26596
|
+
}
|
|
26597
|
+
}
|
|
26598
|
+
);
|
|
26599
|
+
spendTool(
|
|
26600
|
+
"elevenlabs_tts",
|
|
26601
|
+
"ElevenLabs: texto em fala",
|
|
26602
|
+
"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.",
|
|
26603
|
+
{
|
|
26604
|
+
text: external_exports.string().min(1).describe("Texto a falar. O teto depende do modelo."),
|
|
26605
|
+
voice: voiceField,
|
|
26606
|
+
model: modelField("eleven_v4"),
|
|
26607
|
+
language: external_exports.string().max(12).optional().describe("Idioma do texto, ex.: pt."),
|
|
26608
|
+
stability: external_exports.number().min(0).max(1).optional(),
|
|
26609
|
+
similarity: external_exports.number().min(0).max(1).optional(),
|
|
26610
|
+
style: external_exports.number().min(0).max(1).optional().describe("N\xE3o vale nos modelos eleven_v4."),
|
|
26611
|
+
speed: external_exports.number().positive().optional().describe("N\xE3o vale nos modelos eleven_v4.")
|
|
26612
|
+
},
|
|
26613
|
+
({ text, voice, model, language, stability, similarity, style, speed }) => {
|
|
26614
|
+
if (model.startsWith("eleven_v4") && (style !== void 0 || speed !== void 0)) {
|
|
26615
|
+
throw new Error("Os modelos eleven_v4 n\xE3o aceitam style nem speed. Tire esses campos ou troque o modelo.");
|
|
26616
|
+
}
|
|
26617
|
+
const settings = compact({ stability, similarity, style, speed });
|
|
26618
|
+
return { tool: "tts", text, voice, model, language, settings: Object.keys(settings).length ? settings : void 0 };
|
|
26619
|
+
}
|
|
26620
|
+
);
|
|
26621
|
+
spendTool(
|
|
26622
|
+
"elevenlabs_dialogue",
|
|
26623
|
+
"ElevenLabs: di\xE1logo",
|
|
26624
|
+
"Conversa entre duas ou mais vozes num \xE1udio s\xF3, na ordem das falas. Para uma voz s\xF3 use elevenlabs_tts.",
|
|
26625
|
+
{
|
|
26626
|
+
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."),
|
|
26627
|
+
model: modelField("eleven_v3")
|
|
26628
|
+
},
|
|
26629
|
+
({ lines, model }) => ({ tool: "dialogue", lines, model })
|
|
26630
|
+
);
|
|
26631
|
+
spendTool(
|
|
26632
|
+
"elevenlabs_sfx",
|
|
26633
|
+
"ElevenLabs: efeito sonoro",
|
|
26634
|
+
"Cria um efeito sonoro a partir de uma descri\xE7\xE3o (porta batendo, chuva, whoosh). Para trilha musical use elevenlabs_music.",
|
|
26635
|
+
{
|
|
26636
|
+
text: external_exports.string().min(1).describe("Descri\xE7\xE3o do som."),
|
|
26637
|
+
model: modelField("eleven_text_to_sound_v2"),
|
|
26638
|
+
duration_sec: external_exports.number().positive().optional().describe("De 0,5 a 30 s. Omita para o modelo decidir."),
|
|
26639
|
+
loop: external_exports.boolean().optional().describe("true faz o som emendar sem corte."),
|
|
26640
|
+
prompt_influence: external_exports.number().min(0).max(1).optional().describe("Quanto seguir a descri\xE7\xE3o ao p\xE9 da letra.")
|
|
26641
|
+
},
|
|
26642
|
+
({ text, model, duration_sec, loop, prompt_influence }) => ({
|
|
26643
|
+
tool: "sfx",
|
|
26644
|
+
text,
|
|
26645
|
+
model,
|
|
26646
|
+
durationSec: duration_sec,
|
|
26647
|
+
loop,
|
|
26648
|
+
promptInfluence: prompt_influence
|
|
26649
|
+
})
|
|
26650
|
+
);
|
|
26651
|
+
spendTool(
|
|
26652
|
+
"elevenlabs_isolate",
|
|
26653
|
+
"ElevenLabs: isolar voz",
|
|
26654
|
+
"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.",
|
|
26655
|
+
{ source: sourceField },
|
|
26656
|
+
async ({ source }) => ({ tool: "isolate", source: await toSource(cfg, source) })
|
|
26657
|
+
);
|
|
26658
|
+
spendTool(
|
|
26659
|
+
"elevenlabs_voice_change",
|
|
26660
|
+
"ElevenLabs: trocar a voz",
|
|
26661
|
+
"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.",
|
|
26662
|
+
{
|
|
26663
|
+
source: sourceField,
|
|
26664
|
+
voice: voiceField,
|
|
26665
|
+
model: external_exports.string().min(1).optional().describe("Id do modelo, ex.: eleven_multilingual_sts_v2."),
|
|
26666
|
+
remove_noise: external_exports.boolean().optional().describe("true limpa o ru\xEDdo da grava\xE7\xE3o antes.")
|
|
26667
|
+
},
|
|
26668
|
+
async ({ source, voice, model, remove_noise }) => ({
|
|
26669
|
+
tool: "voice_change",
|
|
26670
|
+
source: await toSource(cfg, source),
|
|
26671
|
+
voice,
|
|
26672
|
+
model,
|
|
26673
|
+
removeNoise: remove_noise
|
|
26674
|
+
})
|
|
26675
|
+
);
|
|
26676
|
+
spendTool(
|
|
26677
|
+
"elevenlabs_transcribe",
|
|
26678
|
+
"ElevenLabs: transcrever",
|
|
26679
|
+
"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.",
|
|
26680
|
+
{
|
|
26681
|
+
source: sourceField,
|
|
26682
|
+
language: external_exports.string().max(12).optional().describe("Idioma falado. Omita para detectar."),
|
|
26683
|
+
diarize: external_exports.boolean().optional().describe("true separa quem falou o qu\xEA."),
|
|
26684
|
+
num_speakers: external_exports.number().int().min(1).optional().describe("Quantas pessoas falam, se souber."),
|
|
26685
|
+
audio_events: external_exports.boolean().optional().describe("true marca risos, palmas e outros sons."),
|
|
26686
|
+
keyterms: external_exports.array(external_exports.string().min(1)).optional().describe("Nomes e termos dif\xEDceis para acertar a grafia.")
|
|
26687
|
+
},
|
|
26688
|
+
async ({ source, language, diarize, num_speakers, audio_events, keyterms }) => ({
|
|
26689
|
+
tool: "transcribe",
|
|
26690
|
+
source: await toSource(cfg, source),
|
|
26691
|
+
language,
|
|
26692
|
+
diarize,
|
|
26693
|
+
numSpeakers: num_speakers,
|
|
26694
|
+
audioEvents: audio_events,
|
|
26695
|
+
keyterms
|
|
26696
|
+
})
|
|
26697
|
+
);
|
|
26698
|
+
spendTool(
|
|
26699
|
+
"elevenlabs_align",
|
|
26700
|
+
"ElevenLabs: alinhar texto ao \xE1udio",
|
|
26701
|
+
"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.",
|
|
26702
|
+
{ source: sourceField, text: external_exports.string().min(1).describe("Texto exato do que \xE9 falado.") },
|
|
26703
|
+
async ({ source, text }) => ({ tool: "align", source: await toSource(cfg, source), text })
|
|
26704
|
+
);
|
|
26705
|
+
spendTool(
|
|
26706
|
+
"elevenlabs_music",
|
|
26707
|
+
"ElevenLabs: m\xFAsica",
|
|
26708
|
+
"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.",
|
|
26709
|
+
{
|
|
26710
|
+
prompt: external_exports.string().min(1).describe("Estilo, clima e instrumentos."),
|
|
26711
|
+
model: external_exports.string().min(1).optional().describe("Id do modelo. Omita para o padr\xE3o."),
|
|
26712
|
+
duration_sec: external_exports.number().min(3).optional().describe("Dura\xE7\xE3o em segundos, m\xEDnimo 3."),
|
|
26713
|
+
instrumental: external_exports.boolean().optional(),
|
|
26714
|
+
lyrics: external_exports.string().min(1).optional().describe("Letra pr\xF3pria.")
|
|
26715
|
+
},
|
|
26716
|
+
({ prompt, model, duration_sec, instrumental, lyrics }) => ({
|
|
26717
|
+
tool: "music",
|
|
26718
|
+
prompt,
|
|
26719
|
+
model,
|
|
26720
|
+
durationSec: duration_sec,
|
|
26721
|
+
instrumental,
|
|
26722
|
+
lyrics
|
|
26723
|
+
})
|
|
26724
|
+
);
|
|
26725
|
+
spendTool(
|
|
26726
|
+
"elevenlabs_stems",
|
|
26727
|
+
"ElevenLabs: separar faixas",
|
|
26728
|
+
"Separa uma m\xFAsica em faixas (voz, bateria, baixo e outras). Para limpar uma fala gravada use elevenlabs_isolate.",
|
|
26729
|
+
{ source: sourceField },
|
|
26730
|
+
async ({ source }) => ({ tool: "stems", source: await toSource(cfg, source) })
|
|
26731
|
+
);
|
|
26732
|
+
spendTool(
|
|
26733
|
+
"elevenlabs_video_music",
|
|
26734
|
+
"ElevenLabs: trilha para v\xEDdeo",
|
|
26735
|
+
"Cria trilha que acompanha um v\xEDdeo existente. Para m\xFAsica sem v\xEDdeo use elevenlabs_music.",
|
|
26736
|
+
{
|
|
26737
|
+
source: sourceField,
|
|
26738
|
+
description: external_exports.string().min(1).optional().describe("Clima desejado."),
|
|
26739
|
+
add_sfx: external_exports.boolean().optional().describe("true acrescenta efeitos sonoros.")
|
|
26740
|
+
},
|
|
26741
|
+
async ({ source, description, add_sfx }) => ({
|
|
26742
|
+
tool: "video_music",
|
|
26743
|
+
source: await toSource(cfg, source),
|
|
26744
|
+
description,
|
|
26745
|
+
addSfx: add_sfx
|
|
26746
|
+
})
|
|
26747
|
+
);
|
|
26748
|
+
spendTool(
|
|
26749
|
+
"elevenlabs_voice_design",
|
|
26750
|
+
"ElevenLabs: criar voz por descri\xE7\xE3o",
|
|
26751
|
+
"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.",
|
|
26752
|
+
{
|
|
26753
|
+
description: external_exports.string().min(20).describe("Idade, timbre, sotaque e jeito de falar. M\xEDnimo 20 caracteres."),
|
|
26754
|
+
text: external_exports.string().min(1).optional().describe("Frase que as pr\xE9vias v\xE3o falar."),
|
|
26755
|
+
model: external_exports.string().min(1).optional().describe("Id do modelo. Omita para o padr\xE3o.")
|
|
26756
|
+
},
|
|
26757
|
+
({ description, text, model }) => ({ tool: "voice_design", description, text, model })
|
|
26758
|
+
);
|
|
26759
|
+
}
|
|
26760
|
+
|
|
26288
26761
|
// src/tools/generation.ts
|
|
26289
26762
|
var IMAGE_BUDGET_MS = 9e4;
|
|
26290
26763
|
var VIDEO_BUDGET_MS = 12e4;
|
|
@@ -26817,13 +27290,15 @@ ${BUDGET_BLOCKED_GUIDANCE}`);
|
|
|
26817
27290
|
"check_generation",
|
|
26818
27291
|
{
|
|
26819
27292
|
title: "Checar gera\xE7\xE3o",
|
|
26820
|
-
description: "Consulta o status de uma gera\xE7\xE3o ass\xEDncrona (imagem
|
|
27293
|
+
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.",
|
|
26821
27294
|
inputSchema: {
|
|
26822
|
-
generation_id: external_exports.string().min(1).describe("O id retornado por generate_image
|
|
27295
|
+
generation_id: external_exports.string().min(1).describe("O id retornado por generate_image, generate_video ou elevenlabs_*.")
|
|
26823
27296
|
}
|
|
26824
27297
|
},
|
|
26825
27298
|
async ({ generation_id }) => {
|
|
26826
27299
|
try {
|
|
27300
|
+
const job = await client.elevenLabsJob(generation_id, { retry: false }).catch(() => null);
|
|
27301
|
+
if (job?.generationId) return formatJob(job);
|
|
26827
27302
|
const status = await client.getStatus(generation_id);
|
|
26828
27303
|
if (status.status === "completed") {
|
|
26829
27304
|
const urls = outputUrls(status);
|
|
@@ -26852,34 +27327,44 @@ ${list}${flagsLine(status)}${draftHint}` }, ...blocks] };
|
|
|
26852
27327
|
"list_generations",
|
|
26853
27328
|
{
|
|
26854
27329
|
title: "Listar gera\xE7\xF5es",
|
|
26855
|
-
description: 'Lista
|
|
27330
|
+
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.',
|
|
26856
27331
|
inputSchema: {
|
|
26857
27332
|
limit: external_exports.number().int().min(1).max(100).optional().describe("Quantas trazer (padr\xE3o 20, m\xE1x 100)."),
|
|
26858
27333
|
offset: external_exports.number().int().min(0).optional().describe("Deslocamento para paginar (padr\xE3o 0)."),
|
|
26859
27334
|
favorite: external_exports.boolean().optional().describe('S\xF3 as favoritadas ("like"). Padr\xE3o: todas.'),
|
|
26860
|
-
approved: external_exports.boolean().optional().describe("S\xF3 as com plano aprovado. Padr\xE3o: todas.")
|
|
27335
|
+
approved: external_exports.boolean().optional().describe("S\xF3 as com plano aprovado. Padr\xE3o: todas."),
|
|
27336
|
+
project: external_exports.string().optional().describe('C\xF3digo ou id do projeto (ex.: "EP2-26"). Lista o projeto inteiro.'),
|
|
27337
|
+
user: external_exports.string().optional().describe("E-mail ou id da pessoa. Sem project, s\xF3 admin."),
|
|
27338
|
+
scope: external_exports.enum(["team"]).optional().describe('"team": toda a equipe, com ou sem projeto. S\xF3 admin.'),
|
|
27339
|
+
type: external_exports.enum(["image", "video", "audio", "music", "upscale"]).optional().describe("Filtra por tipo, junto de project, user ou scope."),
|
|
27340
|
+
cursor: external_exports.string().optional().describe("Pr\xF3xima p\xE1gina, devolvido na resposta anterior.")
|
|
26861
27341
|
}
|
|
26862
27342
|
},
|
|
26863
|
-
async ({ limit, offset, favorite, approved }) => {
|
|
27343
|
+
async ({ limit, offset, favorite, approved, project, user, scope, type, cursor }) => {
|
|
26864
27344
|
try {
|
|
26865
|
-
const { generations } = await client.listGenerations({ limit, offset, favorite, approved });
|
|
27345
|
+
const { generations, nextCursor } = await client.listGenerations({ limit, offset, favorite, approved, project, user, scope, type, cursor });
|
|
26866
27346
|
if (!generations.length) {
|
|
26867
|
-
const
|
|
26868
|
-
return textResult(`Nenhuma gera\xE7\xE3o${
|
|
27347
|
+
const filterLabel = favorite && approved ? " (favoritadas + aprovadas)" : favorite ? " favoritadas" : approved ? " aprovadas" : "";
|
|
27348
|
+
return textResult(`Nenhuma gera\xE7\xE3o${filterLabel} encontrada.`);
|
|
26869
27349
|
}
|
|
26870
27350
|
const lines = generations.map((g, i) => {
|
|
26871
|
-
const
|
|
27351
|
+
const kind = g.model?.startsWith("topaz/upscale") ? "upscale" : g.generation_type || "image";
|
|
26872
27352
|
const when = g.created_at ? new Date(g.created_at).toISOString().slice(0, 10) : "\u2014";
|
|
26873
27353
|
const prompt = (g.prompt || "").replace(/\s+/g, " ").slice(0, 80);
|
|
26874
27354
|
const url = firstOutputUrl(g.output);
|
|
26875
27355
|
const marks = [g.is_favorite ? "\u2B50" : null, g.is_approved_plan ? "\u2714\uFE0F" : null].filter(Boolean).join(" ");
|
|
26876
27356
|
const marksSuffix = marks ? ` ${marks}` : "";
|
|
26877
|
-
|
|
27357
|
+
const authorName = [g.author?.first_name, g.author?.last_name].filter(Boolean).join(" ");
|
|
27358
|
+
const authorSuffix = authorName ? ` \xB7 ${authorName}` : "";
|
|
27359
|
+
return `${i + 1}. ${kind} \xB7 ${g.status} \xB7 ${when} \xB7 ${g.model}${authorSuffix}${marksSuffix}
|
|
26878
27360
|
${g.id}
|
|
26879
27361
|
"${prompt}"${url ? `
|
|
26880
27362
|
${url}` : ""}`;
|
|
26881
27363
|
});
|
|
26882
|
-
|
|
27364
|
+
const more = nextCursor ? `
|
|
27365
|
+
|
|
27366
|
+
Pr\xF3xima p\xE1gina: cursor "${nextCursor}"` : "";
|
|
27367
|
+
return textResult(lines.join("\n\n") + more);
|
|
26883
27368
|
} catch (e) {
|
|
26884
27369
|
return errorResult(apiErrorToUserMessage(e));
|
|
26885
27370
|
}
|
|
@@ -26899,6 +27384,7 @@ ${list}${flagsLine(status)}${draftHint}` }, ...blocks] };
|
|
|
26899
27384
|
await client.cancel(generation_id);
|
|
26900
27385
|
return textResult(`\u2705 Gera\xE7\xE3o ${generation_id} cancelada (diamantes estornados quando aplic\xE1vel).`);
|
|
26901
27386
|
} catch (e) {
|
|
27387
|
+
if (e instanceof ApiError && e.httpStatus === 409) return textResult(e.message);
|
|
26902
27388
|
return errorResult(apiErrorToUserMessage(e));
|
|
26903
27389
|
}
|
|
26904
27390
|
}
|
|
@@ -27794,7 +28280,7 @@ Use o valor de "voice" no generate_audio com um modelo 3.8 (sem multi_speaker).`
|
|
|
27794
28280
|
}
|
|
27795
28281
|
|
|
27796
28282
|
// src/tools/account.ts
|
|
27797
|
-
function registerAccountTools(server, client,
|
|
28283
|
+
function registerAccountTools(server, client, cfg) {
|
|
27798
28284
|
server.registerTool(
|
|
27799
28285
|
"whoami",
|
|
27800
28286
|
{
|
|
@@ -27851,14 +28337,17 @@ ${budget}` : "")
|
|
|
27851
28337
|
},
|
|
27852
28338
|
async () => {
|
|
27853
28339
|
try {
|
|
27854
|
-
const m = await
|
|
28340
|
+
const [m, elevenLabs] = await Promise.all([
|
|
28341
|
+
client.models(),
|
|
28342
|
+
client.elevenLabsCatalog({ retry: false }).catch(() => null)
|
|
28343
|
+
]);
|
|
27855
28344
|
const lines = m.models.map((x) => {
|
|
27856
28345
|
const price = typeof x.pricing === "number" ? `$${x.pricing}` : JSON.stringify(x.pricing);
|
|
27857
28346
|
return `\u2022 ${x.model} \u2014 ${price} (base USD)`;
|
|
27858
28347
|
});
|
|
27859
28348
|
const analyzeBlock = analyzeCatalogBlock(m.analyze);
|
|
27860
28349
|
const txt = `Modelos de gera\xE7\xE3o:
|
|
27861
|
-
${lines.join("\n") || "(nenhum)"}` + analyzeBlock + `
|
|
28350
|
+
${lines.join("\n") || "(nenhum)"}` + analyzeBlock + elevenLabsCatalogBlock(elevenLabs) + `
|
|
27862
28351
|
|
|
27863
28352
|
Limites simult\xE2neos por usu\xE1rio: imagem=${m.limits.perUserMaxImage}, v\xEDdeo=${m.limits.perUserMaxVideo}, \xE1udio=${m.limits.perUserMaxAudio}.
|
|
27864
28353
|
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).`;
|
|
@@ -27872,9 +28361,10 @@ Limites simult\xE2neos por usu\xE1rio: imagem=${m.limits.perUserMaxImage}, v\xED
|
|
|
27872
28361
|
"estimate_cost",
|
|
27873
28362
|
{
|
|
27874
28363
|
title: "Estimar custo",
|
|
27875
|
-
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.",
|
|
28364
|
+
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_*).",
|
|
27876
28365
|
inputSchema: {
|
|
27877
28366
|
model: external_exports.string().min(1).describe("Id do modelo (ex.: google/nano-banana-pro, bytedance/seedance-2.0)."),
|
|
28367
|
+
elevenlabs_params: external_exports.record(external_exports.unknown()).optional().describe('[ElevenLabs] Campos do pedido no formato da API, ex.: { "voice": "...", "text": "..." }.'),
|
|
27878
28368
|
resolution: external_exports.string().optional(),
|
|
27879
28369
|
duration: external_exports.number().int().optional(),
|
|
27880
28370
|
mode: external_exports.string().optional(),
|
|
@@ -27900,6 +28390,9 @@ Limites simult\xE2neos por usu\xE1rio: imagem=${m.limits.perUserMaxImage}, v\xED
|
|
|
27900
28390
|
}
|
|
27901
28391
|
},
|
|
27902
28392
|
async (args) => {
|
|
28393
|
+
if (args.model.startsWith("elevenlabs/")) {
|
|
28394
|
+
return estimateElevenLabsModel(client, cfg, args.model, args.elevenlabs_params, args.file);
|
|
28395
|
+
}
|
|
27903
28396
|
try {
|
|
27904
28397
|
let width2 = args.source_width;
|
|
27905
28398
|
let height = args.source_height;
|
|
@@ -28641,6 +29134,33 @@ var KINDS = {
|
|
|
28641
29134
|
outputs: ["audio", "approved"],
|
|
28642
29135
|
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"
|
|
28643
29136
|
},
|
|
29137
|
+
"audio-tools": {
|
|
29138
|
+
title: "Ferramentas de \xE1udio",
|
|
29139
|
+
size: { w: 320, h: 212 },
|
|
29140
|
+
data: {
|
|
29141
|
+
tool: "sfx",
|
|
29142
|
+
model: null,
|
|
29143
|
+
voice: null,
|
|
29144
|
+
durationSec: null,
|
|
29145
|
+
loop: false,
|
|
29146
|
+
instrumental: true,
|
|
29147
|
+
removeNoise: false,
|
|
29148
|
+
language: null,
|
|
29149
|
+
diarize: true,
|
|
29150
|
+
audioEvents: false,
|
|
29151
|
+
targetLang: "en",
|
|
29152
|
+
sourceLang: null,
|
|
29153
|
+
dubMode: "v1",
|
|
29154
|
+
history: [],
|
|
29155
|
+
pinned: null,
|
|
29156
|
+
results: [],
|
|
29157
|
+
pinnedResult: null
|
|
29158
|
+
},
|
|
29159
|
+
inputs: ["prompt", "lyrics", "source"],
|
|
29160
|
+
outputs: ["audio", "approved", "text", "subtitle", "video"],
|
|
29161
|
+
dynamic: "as portas mudam com data.tool (sfx, isolate, voice_change, music, stems, transcribe, dub)",
|
|
29162
|
+
main: "tool"
|
|
29163
|
+
},
|
|
28644
29164
|
music: {
|
|
28645
29165
|
title: "Trilha",
|
|
28646
29166
|
size: { w: 320, h: 212 },
|
|
@@ -28731,6 +29251,7 @@ function ratioOfAspect(aspect) {
|
|
|
28731
29251
|
const height = Number(match[2]);
|
|
28732
29252
|
return width2 > 0 && height > 0 ? width2 / height : null;
|
|
28733
29253
|
}
|
|
29254
|
+
var DUB_NOTE = "Dublagem no Canvas exige clique de pessoa: agente n\xE3o roda. ";
|
|
28734
29255
|
function isGeneratorKind(kind) {
|
|
28735
29256
|
return kind === "image" || kind === "video";
|
|
28736
29257
|
}
|
|
@@ -28753,7 +29274,7 @@ function knownPort(kind, side, port) {
|
|
|
28753
29274
|
}
|
|
28754
29275
|
|
|
28755
29276
|
// src/canvas/core.ts
|
|
28756
|
-
import { randomBytes, randomUUID } from "crypto";
|
|
29277
|
+
import { randomBytes, randomUUID as randomUUID2 } from "crypto";
|
|
28757
29278
|
var SCHEMA_VERSION = 1;
|
|
28758
29279
|
var MAX_ENVELOPES_PER_COMMIT = 200;
|
|
28759
29280
|
var MAX_OP_BYTES = 64 * 1024;
|
|
@@ -28839,7 +29360,7 @@ function checkOp(op) {
|
|
|
28839
29360
|
}
|
|
28840
29361
|
}
|
|
28841
29362
|
function envelope(boardId4, op, actorId) {
|
|
28842
|
-
return { id:
|
|
29363
|
+
return { id: randomUUID2(), boardId: boardId4, clientId: CLIENT_ID, actorId, seq: null, ts: Date.now(), op };
|
|
28843
29364
|
}
|
|
28844
29365
|
function checkEnvelope(env) {
|
|
28845
29366
|
const bad = checkOp(env.op);
|
|
@@ -28851,7 +29372,7 @@ function checkEnvelope(env) {
|
|
|
28851
29372
|
}
|
|
28852
29373
|
function emptyBoard(title, now = Date.now()) {
|
|
28853
29374
|
return {
|
|
28854
|
-
id:
|
|
29375
|
+
id: randomUUID2(),
|
|
28855
29376
|
schemaVersion: SCHEMA_VERSION,
|
|
28856
29377
|
title,
|
|
28857
29378
|
ownerId: "",
|
|
@@ -28868,7 +29389,7 @@ function emptyBoard(title, now = Date.now()) {
|
|
|
28868
29389
|
function makeNode(init) {
|
|
28869
29390
|
const now = init.now ?? Date.now();
|
|
28870
29391
|
return {
|
|
28871
|
-
id: init.id ??
|
|
29392
|
+
id: init.id ?? randomUUID2(),
|
|
28872
29393
|
type: init.type,
|
|
28873
29394
|
position: { x: init.position.x, y: init.position.y },
|
|
28874
29395
|
size: { w: init.size.w, h: init.size.h },
|
|
@@ -28882,7 +29403,7 @@ function makeNode(init) {
|
|
|
28882
29403
|
}
|
|
28883
29404
|
function makeEdge(init) {
|
|
28884
29405
|
return {
|
|
28885
|
-
id:
|
|
29406
|
+
id: randomUUID2(),
|
|
28886
29407
|
source: init.source,
|
|
28887
29408
|
sourcePort: init.sourcePort,
|
|
28888
29409
|
target: init.target,
|
|
@@ -30120,7 +30641,7 @@ ${text}`;
|
|
|
30120
30641
|
}
|
|
30121
30642
|
|
|
30122
30643
|
// src/canvas/upload.ts
|
|
30123
|
-
import { randomUUID as
|
|
30644
|
+
import { randomUUID as randomUUID3 } from "crypto";
|
|
30124
30645
|
import { basename as basename2, extname as extname3 } from "path";
|
|
30125
30646
|
function kindOfMime(mime) {
|
|
30126
30647
|
if (mime.startsWith("image/")) return "image";
|
|
@@ -30160,7 +30681,7 @@ async function uploadMedia(cfg, source, name) {
|
|
|
30160
30681
|
meta: meta ?? {},
|
|
30161
30682
|
measuredBy,
|
|
30162
30683
|
reused,
|
|
30163
|
-
assetId: `asset_${
|
|
30684
|
+
assetId: `asset_${randomUUID3()}`
|
|
30164
30685
|
};
|
|
30165
30686
|
}
|
|
30166
30687
|
function mediaItem(u) {
|
|
@@ -30342,7 +30863,7 @@ ${payload(u)}`
|
|
|
30342
30863
|
}
|
|
30343
30864
|
|
|
30344
30865
|
// src/tools/canvas-run.ts
|
|
30345
|
-
import { randomUUID as
|
|
30866
|
+
import { randomUUID as randomUUID4 } from "crypto";
|
|
30346
30867
|
var MAX_REMEMBERED = 50;
|
|
30347
30868
|
var acceptedPacing = { repeats: 8, pauseMs: 2e3 };
|
|
30348
30869
|
var statusPacing = {
|
|
@@ -30371,23 +30892,23 @@ function prettyClient(name) {
|
|
|
30371
30892
|
function modeText(mode) {
|
|
30372
30893
|
return mode === "simulated" ? "Simulado (n\xE3o gasta)" : mode === "live" ? "Real" : mode ?? "?";
|
|
30373
30894
|
}
|
|
30374
|
-
function estimateLines(
|
|
30375
|
-
if (!
|
|
30895
|
+
function estimateLines(estimate2, titleOf) {
|
|
30896
|
+
if (!estimate2) return [];
|
|
30376
30897
|
const lines = [];
|
|
30377
|
-
const nodes =
|
|
30898
|
+
const nodes = estimate2.nodes ?? [];
|
|
30378
30899
|
const now = nodes.filter((n) => n.willRun);
|
|
30379
30900
|
for (const n of now) {
|
|
30380
30901
|
const cost = n.error ? `estimativa falhou (${n.error})` : dia(n.diamonds);
|
|
30381
30902
|
lines.push(`- ${n.title ?? titleOf(n.nodeId)} (${n.nodeId}): ${cost}`);
|
|
30382
30903
|
}
|
|
30383
|
-
if (
|
|
30384
|
-
lines.push(`\u2026 e mais ${
|
|
30904
|
+
if (estimate2.omitted) {
|
|
30905
|
+
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).`);
|
|
30385
30906
|
}
|
|
30386
|
-
const cached2 =
|
|
30907
|
+
const cached2 = estimate2.cached ?? nodes.filter((n) => !n.willRun && !n.afterApproval).length;
|
|
30387
30908
|
if (cached2) lines.push(`Em cache (n\xE3o rodam): ${cached2}.`);
|
|
30388
|
-
const later =
|
|
30389
|
-
if (later) lines.push(`Esperando aprova\xE7\xE3o no board depois disso: ${later} n\xF3(s), \u2248 ${dia(
|
|
30390
|
-
const unknown2 =
|
|
30909
|
+
const later = estimate2.counts?.later ?? estimate2.later?.nodes?.length ?? 0;
|
|
30910
|
+
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).`);
|
|
30911
|
+
const unknown2 = estimate2.counts?.unknown ?? estimate2.unknown?.length ?? 0;
|
|
30391
30912
|
if (unknown2) {
|
|
30392
30913
|
lines.push(`Sem estimativa: ${unknown2} n\xF3(s) (texto cobra por token; o total \xE9 piso).`);
|
|
30393
30914
|
}
|
|
@@ -30493,7 +31014,7 @@ function registerCanvasRunTools(server, api, run) {
|
|
|
30493
31014
|
},
|
|
30494
31015
|
async (args) => run(async () => {
|
|
30495
31016
|
const target = targetOf(args);
|
|
30496
|
-
const requestId = (args.request_id ??
|
|
31017
|
+
const requestId = (args.request_id ?? randomUUID4()).toLowerCase();
|
|
30497
31018
|
const label = args.label ?? prettyClient(server.server.getClientVersion()?.name);
|
|
30498
31019
|
const ask = async () => {
|
|
30499
31020
|
try {
|
|
@@ -31358,7 +31879,7 @@ N\xF3s: ${Object.entries(ids).map(([k, v]) => `${k}=${v}`).join(" \xB7 ")}` : ""
|
|
|
31358
31879
|
"canvas_add_node",
|
|
31359
31880
|
{
|
|
31360
31881
|
title: "Canvas: adicionar n\xF3",
|
|
31361
|
-
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,
|
|
31882
|
+
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,
|
|
31362
31883
|
inputSchema: {
|
|
31363
31884
|
board_id: boardId3,
|
|
31364
31885
|
kind: external_exports.string().min(1).max(40),
|
|
@@ -31423,7 +31944,7 @@ N\xF3s: ${Object.entries(ids).map(([k, v]) => `${k}=${v}`).join(" \xB7 ")}` : ""
|
|
|
31423
31944
|
"canvas_update_node",
|
|
31424
31945
|
{
|
|
31425
31946
|
title: "Canvas: editar n\xF3",
|
|
31426
|
-
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,
|
|
31947
|
+
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,
|
|
31427
31948
|
inputSchema: {
|
|
31428
31949
|
board_id: boardId3,
|
|
31429
31950
|
node_id: nodeIdArg2,
|
|
@@ -31451,7 +31972,7 @@ N\xF3s: ${Object.entries(ids).map(([k, v]) => `${k}=${v}`).join(" \xB7 ")}` : ""
|
|
|
31451
31972
|
"canvas_update_nodes",
|
|
31452
31973
|
{
|
|
31453
31974
|
title: "Canvas: editar v\xE1rios n\xF3s",
|
|
31454
|
-
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.',
|
|
31975
|
+
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,
|
|
31455
31976
|
inputSchema: {
|
|
31456
31977
|
board_id: boardId3,
|
|
31457
31978
|
nodes: external_exports.array(
|
|
@@ -31503,7 +32024,7 @@ N\xF3s: ${Object.entries(ids).map(([k, v]) => `${k}=${v}`).join(" \xB7 ")}` : ""
|
|
|
31503
32024
|
"canvas_patch_node",
|
|
31504
32025
|
{
|
|
31505
32026
|
title: "Canvas: gravar por caminho",
|
|
31506
|
-
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,
|
|
32027
|
+
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,
|
|
31507
32028
|
inputSchema: {
|
|
31508
32029
|
board_id: boardId3,
|
|
31509
32030
|
node_id: nodeIdArg2,
|
|
@@ -31743,7 +32264,7 @@ N\xF3s: ${Object.entries(ids).map(([k, v]) => `${k}=${v}`).join(" \xB7 ")}` : ""
|
|
|
31743
32264
|
import { createRequire } from "module";
|
|
31744
32265
|
var require2 = createRequire(import.meta.url);
|
|
31745
32266
|
function readVersion() {
|
|
31746
|
-
if ("0.
|
|
32267
|
+
if ("0.47.0") return "0.47.0";
|
|
31747
32268
|
try {
|
|
31748
32269
|
const pkg = require2("../package.json");
|
|
31749
32270
|
return pkg.version ?? "0.0.0-unknown";
|
|
@@ -31756,7 +32277,7 @@ var VERSION = readVersion();
|
|
|
31756
32277
|
// src/server.ts
|
|
31757
32278
|
var SERVER_INSTRUCTIONS = [
|
|
31758
32279
|
"BePlus: tudo roda pela conta do usu\xE1rio (diamantes, limites e hist\xF3rico na plataforma).",
|
|
31759
|
-
'M\xEDdia: generate_*
|
|
32280
|
+
'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.',
|
|
31760
32281
|
"Calls: search_calls acha, get_call traz a transcri\xE7\xE3o.",
|
|
31761
32282
|
"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.",
|
|
31762
32283
|
"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.",
|
|
@@ -31771,6 +32292,7 @@ function buildServer(cfg) {
|
|
|
31771
32292
|
registerUpscaleTools(server, client, cfg);
|
|
31772
32293
|
registerAudioTools(server, client, cfg);
|
|
31773
32294
|
registerMusicTools(server, client, cfg);
|
|
32295
|
+
registerElevenLabsTools(server, client, cfg);
|
|
31774
32296
|
registerAccountTools(server, client, cfg);
|
|
31775
32297
|
registerAnalyzeTools(server, client, cfg);
|
|
31776
32298
|
registerProjectTools(server, client, cfg);
|