claqueta-mcp 0.11.3 → 0.11.4

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/cli.js +14 -3
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -50,7 +50,7 @@ function ayudaConexionTodas(plataforma = process.platform) {
50
50
  }
51
51
 
52
52
  // src/config.ts
53
- var VERSION = true ? "0.11.3" : "dev";
53
+ var VERSION = true ? "0.11.4" : "dev";
54
54
  var construirAyuda = (plataforma = process.platform) => `claqueta-mcp ${VERSION}: puente stdio hacia el servidor MCP remoto de Claqueta.
55
55
 
56
56
  Uso:
@@ -2356,6 +2356,18 @@ function extensionDe(a) {
2356
2356
  const porMime = { "image/png": ".png", "image/jpeg": ".jpg", "image/webp": ".webp", "image/gif": ".gif", "image/svg+xml": ".svg" };
2357
2357
  return porMime[a.mime ?? ""] ?? "";
2358
2358
  }
2359
+ function verificarIntegridad(id, esperado, datos) {
2360
+ if (!esperado) return;
2361
+ if (esperado.startsWith("etag:")) {
2362
+ const etag = esperado.slice(5).replace(/"/g, "").toLowerCase();
2363
+ if (!/^[0-9a-f]{32}$/.test(etag)) return;
2364
+ const md5 = createHash2("md5").update(datos).digest("hex");
2365
+ if (md5 !== etag) throw new ErrorMedia(`el asset ${id} no coincide con su ETag (baj\xF3 md5 ${md5.slice(0, 12)}\u2026, esperado ${etag.slice(0, 12)}\u2026)`, true);
2366
+ return;
2367
+ }
2368
+ const sha = createHash2("sha256").update(datos).digest("hex");
2369
+ if (sha !== esperado) throw new ErrorMedia(`el asset ${id} no coincide con su sha256 (baj\xF3 ${sha.slice(0, 12)}\u2026, esperado ${esperado.slice(0, 12)}\u2026)`, true);
2370
+ }
2359
2371
  async function descargarMedia(media, pedidoDir, descargar2 = (u, senal2) => fetch(u, senal2 ? { signal: senal2 } : {}), senal) {
2360
2372
  const salida = {};
2361
2373
  const ids = Object.keys(media ?? {}).filter((id) => TIPOS_DESCARGABLES.includes(media[id].tipo));
@@ -2375,8 +2387,7 @@ async function descargarMedia(media, pedidoDir, descargar2 = (u, senal2) => fetc
2375
2387
  if (senal?.aborted) throw new ErrorMedia(`descarga cancelada (${id})`, true);
2376
2388
  const datos = Buffer.from(await r2.arrayBuffer());
2377
2389
  if (a.bytes > 0 && datos.length !== a.bytes) throw new ErrorMedia(`el asset ${id} baj\xF3 con ${datos.length} bytes y deber\xEDa tener ${a.bytes}`, true);
2378
- const sha = createHash2("sha256").update(datos).digest("hex");
2379
- if (a.sha256 && sha !== a.sha256) throw new ErrorMedia(`el asset ${id} no coincide con su sha256 (baj\xF3 ${sha.slice(0, 12)}\u2026, esperado ${a.sha256.slice(0, 12)}\u2026)`, true);
2390
+ verificarIntegridad(id, a.sha256, datos);
2380
2391
  const ruta = `media/${id}${extensionDe(a)}`;
2381
2392
  await writeFile(join9(pedidoDir, ruta), datos);
2382
2393
  salida[id] = { ruta, tipo: a.tipo, nombre: a.nombre, mime: a.mime };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claqueta-mcp",
3
- "version": "0.11.3",
3
+ "version": "0.11.4",
4
4
  "description": "Cliente de Claqueta: puente stdio para el servidor MCP remoto, comando setup y worker de la cola. Úsalo con npx en Claude Desktop o Claude Code.",
5
5
  "type": "module",
6
6
  "bin": {