panal-mcp 0.19.0 → 0.20.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/server.js +25 -2
  2. package/package.json +2 -2
package/dist/server.js CHANGED
@@ -42,7 +42,7 @@ import { createInterface } from 'node:readline';
42
42
  import { fileURLToPath } from 'node:url';
43
43
  import { formatEther, formatUnits, isAddress, keccak256, parseEther, toBytes } from 'viem';
44
44
  import { privateKeyToAccount } from 'viem/accounts';
45
- import { BUZON_URL, NATIVE_CURRENCY, TaskStatus, appendAttachmentsManifest, conEjemplosDeLaFicha, createPanalClient, downloadDeliveredFile, esTextoCifrado, enDolares, formatearDolares, erc20Abi, leerEjemplosDeMetadata, matchAttachment, parseAttachmentsManifest, parseFilesManifest, stripFilesManifest, x402Currency, sinBarraFinal, } from '@panal/sdk';
45
+ import { BUZON_URL, NATIVE_CURRENCY, TaskStatus, appendAttachmentsManifest, conEjemplosDeLaFicha, createPanalClient, downloadDeliveredFile, esTextoCifrado, enDolares, formatearDolares, erc20Abi, leerEjemplosDeMetadata, matchAttachment, parseAttachmentsManifest, parseFilesManifest, parseSubcontractsManifest, stripFilesManifest, x402Currency, sinBarraFinal, } from '@panal/sdk';
46
46
  import { MAX_ADJUNTOS, capacidadesDeAgente, guardarDescarga, leerAdjuntoLocal, raizAdjuntos, raizDescargas, subirAdjunto, } from './adjuntos.js';
47
47
  import { buscarNivel, lineaDeNiveles, nivelesDeAgente, precioDeNivel, renderNiveles, } from './niveles.js';
48
48
  import { QuoteBook, SpendLedger, limitFor, limitsFromEnv } from './limits.js';
@@ -949,6 +949,16 @@ const WRITE_TOOLS = [
949
949
  '',
950
950
  'Answer:',
951
951
  res.answer,
952
+ // Si para contestarte pago a otros agentes, lo dice su respuesta: se cuenta.
953
+ ...(res.subcontracts.length
954
+ ? [
955
+ '',
956
+ `To answer, ${quote.agentName} paid ${res.subcontracts.length} other agent(s):`,
957
+ ...res.subcontracts.map((s, i) => ` ${i + 1}. ${s.agent} \u2014 ${s.skill} \u2014 ${formatUnits(s.amount, s.currency.decimals)} ${s.currency.symbol}` +
958
+ `${s.files ? ` \u2014 ${s.files} file(s) sent to it` : ''}` +
959
+ `${s.txHash ? ` \u2014 tx ${s.txHash}` : ''}${s.via ? ` \u2014 hired by ${s.via}` : ''}`),
960
+ ]
961
+ : []),
952
962
  ]
953
963
  .filter((l) => l !== null)
954
964
  .join('\n');
@@ -1151,8 +1161,20 @@ const WRITE_TOOLS = [
1151
1161
  // persona queria leer.
1152
1162
  const limpio = stripFilesManifest(entrega.text).trim();
1153
1163
  const cabecera = `Result of task #${id} (hash verified against the chain):`;
1164
+ // A quien pago el agente para hacerlo. Va dentro del texto verificado,
1165
+ // asi que esta tan anclado como la entrega: no lo pudo quitar despues.
1166
+ const subcontratos = parseSubcontractsManifest(entrega.text);
1167
+ const bloqueSubcontratos = subcontratos.length
1168
+ ? [
1169
+ '',
1170
+ `The agent subcontracted ${subcontratos.length} agent(s) for this task (anchored with the delivery):`,
1171
+ ...subcontratos.map((s, i) => ` ${i + 1}. ${s.agent} \u2014 ${s.skill} \u2014 ${formatUnits(s.amount, s.currency.decimals)} ${s.currency.symbol}` +
1172
+ `${s.files ? ` \u2014 ${s.files} file(s) sent to it` : ''}` +
1173
+ `${s.txHash ? ` \u2014 tx ${s.txHash}` : ''}${s.via ? ` \u2014 hired by ${s.via}` : ''}`),
1174
+ ]
1175
+ : [];
1154
1176
  if (entrega.archivos.length === 0)
1155
- return `${cabecera}\n\n${limpio || entrega.text}`;
1177
+ return [cabecera, '', limpio || entrega.text, ...bloqueSubcontratos].join('\n');
1156
1178
  return [
1157
1179
  cabecera,
1158
1180
  '',
@@ -1164,6 +1186,7 @@ const WRITE_TOOLS = [
1164
1186
  'Their hashes travel inside the text above, which already matched the chain, so each file is ' +
1165
1187
  `anchored as firmly as the delivery itself. Download them with panal_download_file ${id} ` +
1166
1188
  '\u2014 the bytes are checked against those hashes and refused if they do not match.',
1189
+ ...bloqueSubcontratos,
1167
1190
  ].join('\n');
1168
1191
  }
1169
1192
  catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "panal-mcp",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "description": "Servidor MCP de Panal: busca y contrata agentes de IA on-chain desde Claude",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -30,7 +30,7 @@
30
30
  "node": ">=20"
31
31
  },
32
32
  "dependencies": {
33
- "@panal/sdk": "^0.26.0",
33
+ "@panal/sdk": "^0.27.0",
34
34
  "viem": "^2.21.0"
35
35
  },
36
36
  "devDependencies": {