beplus-mcp 0.12.0 → 0.13.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.
Files changed (2) hide show
  1. package/dist/index.js +50 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -189,7 +189,18 @@ var BeplusClient = class {
189
189
  return this.request("POST", "/analyze-media", { body, timeoutMs: 3e5 });
190
190
  }
191
191
  searchCalls(query) {
192
- return this.request("GET", "/calls", { query });
192
+ return this.request("GET", "/calls", {
193
+ query: {
194
+ query: query.query,
195
+ project: query.project,
196
+ client: query.client,
197
+ company: query.company,
198
+ visibility: query.visibility,
199
+ speaker: query.speaker,
200
+ mine: query.mine ? "true" : void 0,
201
+ limit: query.limit
202
+ }
203
+ });
193
204
  }
194
205
  getCall(id) {
195
206
  return this.request("GET", `/calls/${id}`);
@@ -371,6 +382,25 @@ function logError(...args) {
371
382
  }
372
383
 
373
384
  // src/format.ts
385
+ function fmtResetDate(iso) {
386
+ const [, m, d] = iso.split("-");
387
+ return d && m ? `${d}/${m}` : iso;
388
+ }
389
+ function weeklyAllowanceLine(wa) {
390
+ if (!wa || !wa.enabled) return "";
391
+ if (wa.unlimited) return "\u267E\uFE0F Limite semanal: ilimitado (sua conta \xE9 isenta).";
392
+ const pct = wa.percentUsed;
393
+ const icon = pct >= 100 ? "\u{1F6D1}" : pct >= wa.warnThresholdPercent ? "\u26A0\uFE0F" : "\u{1F4CA}";
394
+ let line = `${icon} Limite semanal: ${pct}% usado \xB7 ${wa.remaining} de ${wa.quota} restantes`;
395
+ if (pct >= 100) {
396
+ line += `
397
+ \u{1F6D1} Limite semanal atingido \u2014 reseta em ${fmtResetDate(wa.periodEnd)}.`;
398
+ } else if (pct >= wa.warnThresholdPercent) {
399
+ line += `
400
+ \u26A0\uFE0F Seu limite semanal est\xE1 acabando \u2014 reseta em ${fmtResetDate(wa.periodEnd)}.`;
401
+ }
402
+ return line;
403
+ }
374
404
  function textResult(s) {
375
405
  return { content: [{ type: "text", text: s }] };
376
406
  }
@@ -398,6 +428,9 @@ ${footer}`;
398
428
  footer = footer ? `${proj}
399
429
  ${footer}` : proj;
400
430
  }
431
+ const wa = weeklyAllowanceLine(start.weekly_allowance);
432
+ if (wa) footer = footer ? `${footer}
433
+ ${wa}` : wa;
401
434
  return footer;
402
435
  }
403
436
  function outputUrls(status) {
@@ -956,10 +989,12 @@ function registerAudioTools(server, client, cfg) {
956
989
  if (res.diamonds_refunded) parts.push(`Estorno: ${res.diamonds_refunded} \u{1F48E}`);
957
990
  const projLine = res.project_code ? `
958
991
  \u{1F4C1} Projeto: ${res.project_code}${res.project_name ? ` \u2014 ${res.project_name}` : ""}` : "";
992
+ const wa = weeklyAllowanceLine(res.weekly_allowance);
959
993
  return textResult(
960
994
  `\u2705 \xC1udio gerado (${res.model}, voz ${res.voice}, ${res.duration_sec.toFixed(1)}s).
961
995
  ${res.url}
962
- ${parts.join(" \xB7 ")}${projLine}`
996
+ ${parts.join(" \xB7 ")}${projLine}` + (wa ? `
997
+ ${wa}` : "")
963
998
  );
964
999
  } catch (e) {
965
1000
  const msg = e instanceof ApiError ? e.message : e instanceof Error ? e.message : "";
@@ -1066,9 +1101,11 @@ function registerAccountTools(server, client, _cfg) {
1066
1101
  async () => {
1067
1102
  try {
1068
1103
  const me = await client.me();
1104
+ const wa = weeklyAllowanceLine(me.weekly_allowance);
1069
1105
  return textResult(
1070
1106
  `\u{1F464} ${me.name ?? "(sem nome)"} <${me.email ?? "sem email"}>
1071
- Saldo: ${me.diamonds} \u{1F48E} \xB7 auth: ${me.authType}`
1107
+ Saldo: ${me.diamonds} \u{1F48E} \xB7 auth: ${me.authType}` + (wa ? `
1108
+ ${wa}` : "")
1072
1109
  );
1073
1110
  } catch (e) {
1074
1111
  return errorResult(apiErrorToUserMessage(e));
@@ -1079,13 +1116,15 @@ Saldo: ${me.diamonds} \u{1F48E} \xB7 auth: ${me.authType}`
1079
1116
  "get_balance",
1080
1117
  {
1081
1118
  title: "Saldo de diamantes",
1082
- description: "Mostra o saldo atual de diamantes da conta vinculada.",
1119
+ description: "Mostra o saldo atual de diamantes e, para membros da equipe, o cr\xE9dito semanal (% usado, quanto resta e quando reseta).",
1083
1120
  inputSchema: {}
1084
1121
  },
1085
1122
  async () => {
1086
1123
  try {
1087
1124
  const b = await client.balance();
1088
- return textResult(`Saldo: ${b.diamonds} \u{1F48E}`);
1125
+ const wa = weeklyAllowanceLine(b.weekly_allowance);
1126
+ return textResult(`Saldo: ${b.diamonds} \u{1F48E}` + (wa ? `
1127
+ ${wa}` : ""));
1089
1128
  } catch (e) {
1090
1129
  return errorResult(apiErrorToUserMessage(e));
1091
1130
  }
@@ -1373,12 +1412,13 @@ function fmtDate(iso) {
1373
1412
  return iso ? iso.slice(0, 10) : "";
1374
1413
  }
1375
1414
  function callLine(c) {
1415
+ const company = c.company_name ? ` \xB7 ${c.company_name}` : "";
1376
1416
  const proj = c.project_name ? ` \xB7 ${c.client_name ? c.client_name + " / " : ""}${c.project_name}` : "";
1377
1417
  const who = c.speakers.length ? ` \xB7 ${c.speakers.join(", ")}` : c.participant_count ? ` \xB7 ${c.participant_count} falantes` : "";
1378
1418
  const vis = VIS_LABEL[c.visibility] ?? c.visibility;
1379
1419
  const flag = c.status !== "ready" ? ` [${c.status}]` : "";
1380
1420
  return `\u2022 ${c.title ?? "(sem t\xEDtulo)"}${flag}
1381
- ${fmtDate(c.date)} \xB7 ${fmtDuration(c.duration_sec)} \xB7 ${vis}${proj}${who}
1421
+ ${fmtDate(c.date)} \xB7 ${fmtDuration(c.duration_sec)} \xB7 ${vis}${company}${proj}${who}
1382
1422
  id: ${c.id}`;
1383
1423
  }
1384
1424
  function renderCall(c) {
@@ -1388,6 +1428,7 @@ function renderCall(c) {
1388
1428
  if (c.date) meta.push(fmtDate(c.date));
1389
1429
  meta.push(fmtDuration(c.duration_sec));
1390
1430
  meta.push(VIS_LABEL[c.visibility] ?? c.visibility);
1431
+ if (c.company_name) meta.push(c.company_name);
1391
1432
  if (c.project_name) meta.push(`${c.client_name ? c.client_name + " / " : ""}${c.project_name}`);
1392
1433
  if (c.status !== "ready") meta.push(`status: ${c.status}`);
1393
1434
  lines.push(meta.join(" \xB7 "));
@@ -1418,13 +1459,15 @@ function registerCallTools(server, client, _cfg) {
1418
1459
  "search_calls",
1419
1460
  {
1420
1461
  title: "Buscar calls",
1421
- description: "Busca nas calls (reuni\xF5es gravadas e transcritas) vis\xEDveis pra conta \u2014 suas, da equipe e compartilhadas. Todos os filtros s\xE3o opcionais e combin\xE1veis: `query` (texto no t\xEDtulo/projeto/cliente/falante), `project` (code/uuid/nome), `client` (code/nome), `visibility` (team|private|workspace|link), `speaker` (nome do falante). Retorna uma lista resumida \u2014 use get_call com o id pra ler a transcri\xE7\xE3o completa.",
1462
+ description: 'Busca nas calls (reuni\xF5es gravadas e transcritas) vis\xEDveis pra conta \u2014 suas, da equipe e compartilhadas. Todos os filtros s\xE3o opcionais e combin\xE1veis: `query` (texto no t\xEDtulo/projeto/cliente/falante), `project` (code/uuid/nome), `client` (code/nome), `company` (empresa/equipe do dono, ex.: "BePlus"), `visibility` (team|private|workspace|link), `speaker` (nome do falante), `mine` (s\xF3 as que EU gravei). Retorna uma lista resumida \u2014 use get_call com o id pra ler a transcri\xE7\xE3o completa.',
1422
1463
  inputSchema: {
1423
1464
  query: z8.string().max(200).optional().describe("Texto livre \u2014 casa t\xEDtulo, projeto, cliente ou falante."),
1424
1465
  project: z8.string().max(64).optional().describe('Projeto: code (ex.: "CONTEUDO-INS"), uuid ou parte do nome.'),
1425
1466
  client: z8.string().max(128).optional().describe("Cliente: code ou parte do nome."),
1467
+ company: z8.string().max(128).optional().describe('Empresa/equipe do dono da call (ex.: "BePlus"). Filtra por parte do nome.'),
1426
1468
  visibility: z8.enum(["team", "private", "workspace", "link"]).optional().describe("Privacidade: team (equipe), private (privada), workspace (projeto) ou link."),
1427
1469
  speaker: z8.string().max(128).optional().describe("Nome do falante."),
1470
+ mine: z8.boolean().optional().describe('true = s\xF3 as calls que EU gravei (sou o dono). Use pra "minhas grava\xE7\xF5es".'),
1428
1471
  limit: z8.number().int().min(1).max(50).optional().describe("M\xE1ximo de resultados (padr\xE3o 20).")
1429
1472
  }
1430
1473
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "beplus-mcp",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Conector MCP da equipe BePlus — gere imagens/vídeos/áudio e consulte calls, projetos e clientes pela sua conta BePlus (diamantes, limites e histórico aplicados pela plataforma).",
5
5
  "type": "module",
6
6
  "bin": {