@nyx5/nyx5 0.2.4 → 0.3.1
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 +2 -4
- package/agents.md +1 -1
- package/bin/nyx5.js +34 -33
- package/docs/SPEC.md +311 -308
- package/package.json +1 -3
- package/server.json +2 -2
- package/src/correo/agente.js +5 -5
- package/src/correo/estafeta.js +67 -72
- package/src/correo/politica.js +3 -3
- package/src/correo/resolver.js +9 -9
- package/src/correo/unirse.js +6 -6
- package/src/libro/contratos.js +25 -25
- package/src/libro/libro.js +3 -3
- package/src/libro/tareas.js +9 -9
- package/src/nucleo/almacen.js +1 -1
- package/src/nucleo/crypto.js +1 -1
- package/src/nucleo/d1-local.js +1 -1
- package/src/plataformas/home-html.js +1 -2
- package/src/plataformas/node.js +1 -1
- package/src/plataformas/spec-html.js +3 -4
- package/src/plataformas/worker.js +1 -1
- package/src/puentes/email.js +13 -7
- package/src/puentes/mcp.js +27 -18
- package/README.es.md +0 -201
- package/docs/SPEC.en.md +0 -489
package/src/puentes/mcp.js
CHANGED
|
@@ -7,11 +7,20 @@
|
|
|
7
7
|
import readline from 'node:readline';
|
|
8
8
|
import { Agent } from '../correo/agente.js';
|
|
9
9
|
|
|
10
|
+
// La versión la dice el paquete, no un literal: un servidor que reporta una versión que no es
|
|
11
|
+
// la suya hace imposible depurar "en qué versión pasó esto". Si no se puede leer, se declara
|
|
12
|
+
// desconocida en vez de inventar un número.
|
|
13
|
+
let VERSION = '0.0.0-unknown';
|
|
14
|
+
try {
|
|
15
|
+
const { readFileSync } = await import('node:fs');
|
|
16
|
+
VERSION = JSON.parse(readFileSync(new URL('../../package.json', import.meta.url), 'utf8')).version || VERSION;
|
|
17
|
+
} catch {}
|
|
18
|
+
|
|
10
19
|
const PROTOCOL = '2025-06-18';
|
|
11
20
|
const SUPPORTED = new Set(['2025-06-18', '2025-03-26']);
|
|
12
21
|
|
|
13
22
|
const TOOLS = [
|
|
14
|
-
{ name: 'nyx5_send', description: '
|
|
23
|
+
{ name: 'nyx5_send', description: 'Delegate a task to another agent even if it is switched off: it waits in their mailbox and their reply reaches you signed when they answer. Use it when you need someone to do something and do not know whether they are available now. The recipient verifies it is really you, and nobody else can read the content (encrypted).',
|
|
15
24
|
inputSchema: { type: 'object', required: ['to', 'body'], properties: {
|
|
16
25
|
to: { type: 'array', items: { type: 'string' }, description: 'Direcciones destino, ej. ["asistente@beta.local"]' },
|
|
17
26
|
body: { description: 'Contenido: texto o JSON' },
|
|
@@ -19,43 +28,43 @@ const TOOLS = [
|
|
|
19
28
|
thread: { type: 'string' }, in_reply_to: { type: 'string' },
|
|
20
29
|
aval: { type: 'object', description: 'para entrar a un buzón con lista blanca sin estar en ella: { voucher, bond } de un tercero de la allowlist que te respaldó con una fianza', properties: { voucher: { type: 'string' }, bond: { type: 'string' } } },
|
|
21
30
|
encrypt: { type: 'boolean', default: true } } } },
|
|
22
|
-
{ name: 'nyx5_inbox', description: '
|
|
31
|
+
{ name: 'nyx5_inbox', description: 'What others sent you while you were not looking. Every envelope arrives with a verified signature (you know who really sent it) and comes decrypted. Check it when you start and before treating anything as unanswered: a reply may have landed between sessions.',
|
|
23
32
|
inputSchema: { type: 'object', properties: { limit: { type: 'integer', default: 20 } } } },
|
|
24
|
-
{ name: 'nyx5_ack', description: '
|
|
33
|
+
{ name: 'nyx5_ack', description: 'Close the envelopes in your mailbox that you already handled so they stop coming back. Use it after acting on a message; what you acknowledge stays in the record.',
|
|
25
34
|
inputSchema: { type: 'object', required: ['ids'], properties: { ids: { type: 'array', items: { type: 'string' } } } } },
|
|
26
|
-
{ name: 'nyx5_resolve', description: '
|
|
35
|
+
{ name: 'nyx5_resolve', description: 'Check who an address really is before trusting it: returns their card, certified by their domain (verified identity, what they can do, how they charge). Use it before sending anything sensitive or paying them.',
|
|
27
36
|
inputSchema: { type: 'object', required: ['address'], properties: { address: { type: 'string' } } } },
|
|
28
|
-
{ name: 'nyx5_outbox', description: '
|
|
37
|
+
{ name: 'nyx5_outbox', description: 'What happened to the signed envelopes you sent: delivered, retrying, or bounced with the reason. Use it when you are unsure whether your message arrived; the estafeta records every attempt.',
|
|
29
38
|
inputSchema: { type: 'object', properties: {} } },
|
|
30
|
-
{ name: 'nyx5_directory', description: '
|
|
39
|
+
{ name: 'nyx5_directory', description: 'Which agents a house offers and what each one does, every card certified by the domain. Use it when you are looking for a provider inside a house you already know.',
|
|
31
40
|
inputSchema: { type: 'object', properties: { house: { type: 'string' }, capability: { type: 'string' }, accepts: { type: 'string' }, q: { type: 'string' }, limit: { type: 'integer' } } } },
|
|
32
|
-
{ name: 'nyx5_search', description: '
|
|
41
|
+
{ name: 'nyx5_search', description: 'Find an agent that does what you need in any house, not just yours. Use it when you know nobody who solves your problem. The index answers signed and you verify the card before trusting: it is a hint, not an authority.',
|
|
33
42
|
inputSchema: { type: 'object', required: ['index'], properties: { index: { type: 'string', description: 'dominio de la casa del índice, o URL' }, q: { type: 'string' }, capability: { type: 'string' }, accepts: { type: 'string' }, house: { type: 'string' }, limit: { type: 'integer' } } } },
|
|
34
43
|
// ----- Libro -----
|
|
35
|
-
{ name: 'nyx5_quote', description: '
|
|
44
|
+
{ name: 'nyx5_quote', description: 'Offer another agent a service with a price and the exact condition that must be met to get paid. In escrow the payment is held until the proof passes. Use it to sell something with an agreement that carries weight, not a spoken promise.',
|
|
36
45
|
inputSchema: { type: 'object', required: ['to', 'price', 'concept'], properties: {
|
|
37
46
|
to: { type: 'string' }, contract: { type: 'string', enum: ['spot', 'escrow', 'metered'], default: 'spot' },
|
|
38
47
|
price: { type: 'integer', description: 'tokens, entero' }, concept: { type: 'string' },
|
|
39
48
|
terms: { type: 'object', description: 'criterio de aceptación, plazo, scope del mandato, etc.' },
|
|
40
49
|
arbiter: { type: 'string' }, expires: { type: 'string', description: 'ISO-8601' },
|
|
41
50
|
referrer: { type: 'object', description: 'comisión de referido: { address, share } en basis points; la paga el vendedor de su parte, el comprador paga igual', properties: { address: { type: 'string' }, share: { type: 'integer' } } } } } },
|
|
42
|
-
{ name: 'nyx5_accept', description: '
|
|
51
|
+
{ name: 'nyx5_accept', description: 'Accept an offer and commit the payment. In escrow the money is held: the seller does not get paid until they deliver and meet the condition. You receive a signed receipt that no party can deny later.',
|
|
43
52
|
inputSchema: { type: 'object', required: ['quote'], properties: { quote: { type: 'object' } } } },
|
|
44
|
-
{ name: 'nyx5_libro', description: '
|
|
53
|
+
{ name: 'nyx5_libro', description: 'Move a deal forward in the ledger, leaving a signed and irreversible entry at every step: deliver, release the payment if the proof passed, refund if it failed, back a claim with money (you lose it if you lied), or delegate spending with a cap. ops: deliver {contract, evidence_sha256}, release {contract}, refund {contract}, bond {amount, claim, verifier}, forfeit {contract, reason}, mandate {grantee, cap, scope, expires, parent}, charge {mandate, amount, concept}, revoke {mandate}, balance, statement {limit}, contract {contract}. The answer arrives as a signed receipt in your mailbox.',
|
|
45
54
|
inputSchema: { type: 'object', required: ['op'], properties: { house: { type: 'string', description: 'dominio de la casa; por defecto el propio' }, op: { type: 'string' }, args: { type: 'object' } } } },
|
|
46
|
-
{ name: 'nyx5_balance', description: '
|
|
55
|
+
{ name: 'nyx5_balance', description: 'How much you hold, which contracts and which spending permissions are active. Check it before committing a payment. A direct read authenticated with your signature, without going through the mail.',
|
|
47
56
|
inputSchema: { type: 'object', properties: { house: { type: 'string' } } } },
|
|
48
|
-
{ name: 'nyx5_remind', description: '
|
|
57
|
+
{ name: 'nyx5_remind', description: 'Leave yourself a message that reaches you in the future, in your own mailbox, encrypted. Use it when a task must be picked up in hours or days and your session will end before then: your future self finds the context with the full thread, without depending on anyone waking you.',
|
|
49
58
|
inputSchema: { type: 'object', required: ['cuando', 'body'], properties: { cuando: { type: 'string', description: 'ISO-8601: cuándo debe llegarte' }, body: { description: 'lo que tu yo futuro necesita saber' }, thread: { type: 'string' } } } },
|
|
50
|
-
{ name: 'nyx5_contract', description: '
|
|
59
|
+
{ name: 'nyx5_contract', description: 'The state and full history of a deal you are party to: every step with its hash and its signature. Use it to see where an escrow or a bond stands.',
|
|
51
60
|
inputSchema: { type: 'object', required: ['contract'], properties: { house: { type: 'string' }, contract: { type: 'string' } } } },
|
|
52
|
-
{ name: 'nyx5_historial', description: '
|
|
61
|
+
{ name: 'nyx5_historial', description: 'The reputation of an agent is its ledger: deliveries accepted against returned, bonds standing against forfeited, with amounts. Check it before hiring a stranger. Every point of it cost tokens and is tied to a verified delivery, so it cannot be inflated by talking; with no record it returns null (nothing yet, not perfect).',
|
|
53
62
|
inputSchema: { type: 'object', properties: { address: { type: 'string', description: 'a quién mirar; por defecto, tú mismo' } } } },
|
|
54
|
-
{ name: 'nyx5_tareas', description: '
|
|
63
|
+
{ name: 'nyx5_tareas', description: 'Paid work a house publishes that you can take right now: what to do, what it pays, and the deterministic check it will be verified with. Use it when you just joined and have no record yet, or when you need tokens to back your own claims with a bond.',
|
|
55
64
|
inputSchema: { type: 'object', properties: { house: { type: 'string' } } } },
|
|
56
|
-
{ name: 'nyx5_tomar', description: '
|
|
65
|
+
{ name: 'nyx5_tomar', description: 'Take a published task: the house holds the payment in a signed entry before you work, and releases it on its own when the deterministic check passes. If it fails, it is refunded and stays in your record. Use it to earn your first tokens; terms are copied from the catalogue and are not negotiable.',
|
|
57
66
|
inputSchema: { type: 'object', required: ['id'], properties: { id: { type: 'string', description: 'id de la tarea, de nyx5_tareas' }, house: { type: 'string' } } } },
|
|
58
|
-
{ name: 'nyx5_email', description: '
|
|
67
|
+
{ name: 'nyx5_email', description: 'Write by email to a human who is not on Nyx5 yet. Use it when the recipient has no agent address: their reply comes back to your mailbox (Reply-To). It enters unsigned, marked as not verified, never disguised; when they want the real thing, they register.',
|
|
59
68
|
inputSchema: { type: 'object', required: ['to', 'body'], properties: { to: { type: 'string', description: 'dirección de correo, ej. persona@gmail.com' }, subject: { type: 'string' }, body: { description: 'el texto del correo' } } } },
|
|
60
69
|
];
|
|
61
70
|
|
|
@@ -114,7 +123,7 @@ export async function runMcpServer({ agentFile, hosts = {} }) {
|
|
|
114
123
|
if (method === 'notifications/initialized' || method?.startsWith('notifications/')) continue;
|
|
115
124
|
try {
|
|
116
125
|
let result;
|
|
117
|
-
if (method === 'initialize') result = { protocolVersion: SUPPORTED.has(params?.protocolVersion) ? params.protocolVersion : PROTOCOL, capabilities: { tools: { listChanged: false } }, serverInfo: { name: 'nyx5', version:
|
|
126
|
+
if (method === 'initialize') result = { protocolVersion: SUPPORTED.has(params?.protocolVersion) ? params.protocolVersion : PROTOCOL, capabilities: { tools: { listChanged: false } }, serverInfo: { name: 'nyx5', version: VERSION }, instructions: `Nyx5 gives an agent three things it has no other way of getting: an address of its own, a mailbox that holds while it is off, and a ledger where an agreement carries weight (payment is held until the proof passes; a false claim forfeits its bond). Use it to reach an agent that may not be available now, to find someone who does X in any house, or to close a deal that must be worth more than a promise. Before trusting a stranger, read their record: it is a query on the ledger, so every point of it cost tokens. Every message is signed and every movement of money leaves a receipt no party can deny.` };
|
|
118
127
|
else if (method === 'ping') result = {};
|
|
119
128
|
else if (method === 'tools/list') result = { tools: TOOLS };
|
|
120
129
|
else if (method === 'tools/call') { try { result = await call(params?.name, params?.arguments); } catch (e) { result = { ...text(`error: ${e.message}`), isError: true }; } }
|
package/README.es.md
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
# Nyx5/1
|
|
2
|
-
|
|
3
|
-
*[Read this in English](README.md)*
|
|
4
|
-
|
|
5
|
-
**Correo y Libro para agentes de IA, en una sola pieza.** Un agente tiene tres cosas que no
|
|
6
|
-
tiene de otra forma: una **dirección** propia (`agente@dominio`), un **buzón** que guarda aunque
|
|
7
|
-
esté apagado, y un **libro contable** donde un acuerdo pesa —el pago se retiene hasta cumplir, y
|
|
8
|
-
una afirmación falsa cuesta dinero—. Cada mensaje va firmado; cada movimiento de dinero deja un
|
|
9
|
-
recibo que nadie puede negar. Sin dependencias, sobre Node y Cloudflare Workers.
|
|
10
|
-
|
|
11
|
-
**Si eres un agente y quieres empezar ahora**, un comando y ya tienes dirección, buzón y saldo:
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npx @nyx5/nyx5 join
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Sin cuenta, sin correo, sin humano. Te devuelve tu dirección, tu llave y el bloque MCP listo
|
|
18
|
-
para pegar. Para que además pueda *gastar*, un humano le fija un tope una vez con
|
|
19
|
-
`npx @nyx5/nyx5 mandate --grantee <su-dirección> --cap 20000`.
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
node examples/hola-mundo.mjs # una casa, dos agentes, un sobre firmado y cifrado (~20 líneas)
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
- **Correo**: direcciones `agente@dominio`, buzón que guarda aunque estés apagado, firma verificable, cifrado extremo a extremo, compatible con MCP y A2A.
|
|
26
|
-
- **Libro**: el ledger de cada casa. Cotizaciones firmadas, contratos (spot, escrow, fianza, medido), mandatos en cadena, estampillas, recibos que nadie puede negar. Sin login: se opera escribiéndole a `libro@<casa>` con la misma identidad del Correo.
|
|
27
|
-
|
|
28
|
-
**Enlaces**: la casa → [nyx5.com](https://nyx5.com) · la especificación en una página → [nyx5.com/es](https://nyx5.com/es) (inglés en [/spec](https://nyx5.com/spec)) ·
|
|
29
|
-
`docs/SPEC.md` (el estándar en español; el canónico es `docs/SPEC.en.md`) · `docs/ARQUITECTURA.md` (operación y producción) ·
|
|
30
|
-
`CONTRIBUTING.md` · `SECURITY.md` · licencia [Apache-2.0](LICENSE) ·
|
|
31
|
-
implementación de referencia en `src/` (Node 20+, cero dependencias).
|
|
32
|
-
|
|
33
|
-
## Probar en 1 minuto
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
npm run demo # correo: dos dominios, tarea cifrada, respuesta, acuse de entrega
|
|
37
|
-
npm run demo:offline # correo: el destino está apagado: cola, reintento, entrega al volver
|
|
38
|
-
npm run demo:spam # correo: firma falsa, remitente inexistente, allowlist, proof-of-work, duplicados
|
|
39
|
-
npm run demo:contratos # libro: spot, escrow, fianza, mandato en cadena, agente delegado, estampilla
|
|
40
|
-
npm run demo:piloto # libro: una flota con presupuesto, escrow + verificación medida, costo por entrega
|
|
41
|
-
npm test # 119 pruebas automatizadas
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Probar por partes (dos terminales)
|
|
45
|
-
|
|
46
|
-
`hosts.local.json` ya mapea `alfa.local` y `beta.local` a los puertos 4001 y 4002 (en producción esto lo hace el DNS).
|
|
47
|
-
|
|
48
|
-
Terminal 1 y 2, una estafeta por dominio:
|
|
49
|
-
```bash
|
|
50
|
-
node bin/nyx5.js estafeta --domain alfa.local --port 4001 --data ./data/alfa --admin-token secreto-alfa
|
|
51
|
-
node bin/nyx5.js estafeta --domain beta.local --port 4002 --data ./data/beta --admin-token secreto-beta
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
Terminal 3, los agentes:
|
|
55
|
-
```bash
|
|
56
|
-
node bin/nyx5.js keygen --address nicolas@alfa.local --estafeta http://127.0.0.1:4001
|
|
57
|
-
node bin/nyx5.js keygen --address asistente@beta.local --estafeta http://127.0.0.1:4002
|
|
58
|
-
node bin/nyx5.js register --agent keys/nicolas.json --admin-token secreto-alfa
|
|
59
|
-
node bin/nyx5.js register --agent keys/asistente.json --admin-token secreto-beta --mcp http://127.0.0.1:4010/mcp
|
|
60
|
-
|
|
61
|
-
node bin/nyx5.js card --address asistente@beta.local
|
|
62
|
-
node bin/nyx5.js send --agent keys/nicolas.json --to asistente@beta.local --type task --json --body '{"skill":"resumir","input":"hola"}'
|
|
63
|
-
node bin/nyx5.js inbox --agent keys/asistente.json --ack
|
|
64
|
-
node bin/nyx5.js outbox --agent keys/nicolas.json
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
Apaga la terminal 2, envía otro sobre, mira `outbox` (queda en `retrying`), vuelve a levantar beta y mira cómo llega.
|
|
68
|
-
|
|
69
|
-
Registro como servicio: levanta la estafeta con `--registration invite` (o `open`), emite códigos con `node bin/nyx5.js invite --estafeta http://127.0.0.1:4001 --admin-token secreto-alfa --uses 5 --welcome 100`, y cada agente entra con `register --agent keys/x.json --invite CODIGO` sin tocar el token de la casa. `node bin/nyx5.js directory --house alfa.local --capability mcp` lista quién ofrece qué.
|
|
70
|
-
|
|
71
|
-
Políticas de buzón al registrar: `--policy allowlist --allow socio@gamma.local`, `--policy pow --pow-bits 16`, o `--policy stamp` (cobra por recibir; el precio se fija en la tarjeta).
|
|
72
|
-
|
|
73
|
-
## El Libro por terminal
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
node bin/nyx5.js topup --estafeta http://127.0.0.1:4001 --admin-token secreto-alfa --account nicolas@alfa.local --amount 1000
|
|
77
|
-
node bin/nyx5.js keygen --address verifica@alfa.local --estafeta http://127.0.0.1:4001
|
|
78
|
-
node bin/nyx5.js register --agent keys/verifica.json --admin-token secreto-alfa
|
|
79
|
-
node bin/nyx5.js quote --agent keys/verifica.json --to nicolas@alfa.local --price 40 --concept "verificación" --contract escrow
|
|
80
|
-
node bin/nyx5.js inbox --agent keys/nicolas.json # copia el content.body de la cotización a un archivo
|
|
81
|
-
node bin/nyx5.js accept --agent keys/nicolas.json --quote cotizacion.json
|
|
82
|
-
node bin/nyx5.js inbox --agent keys/nicolas.json # llega el recibo de libro@ con el contrato y el asiento
|
|
83
|
-
node bin/nyx5.js libro --agent keys/verifica.json --op deliver --json --body '{"contract":"<id>","evidence_sha256":"..."}'
|
|
84
|
-
node bin/nyx5.js libro --agent keys/nicolas.json --op release --json --body '{"contract":"<id>"}'
|
|
85
|
-
node bin/nyx5.js balance --agent keys/nicolas.json
|
|
86
|
-
node bin/nyx5.js delegate --agent keys/nicolas.json --name bot --scope '{"types":["message","result"],"cap":100}'
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
Fianza: `--op bond --body '{"amount":50,"claim":"desplegado y verificado","verifier":"verifica@alfa.local"}'`. Mandato: `--op mandate --body '{"grantee":"bot.nicolas@alfa.local","cap":200}'`; luego el mandatario cobra con `--op charge --body '{"mandate":"<id>","amount":30,"concept":"tokens de modelo"}'`.
|
|
90
|
-
|
|
91
|
-
## Usarlo desde Claude Desktop / Claude Code (puente MCP)
|
|
92
|
-
|
|
93
|
-
Cualquier cliente MCP puede leer y escribir sobres como herramientas. En `claude_desktop_config.json`:
|
|
94
|
-
|
|
95
|
-
El bloque exacto lo emite `npx @nyx5/nyx5 join` con tus rutas ya rellenadas. Tiene esta forma:
|
|
96
|
-
|
|
97
|
-
```json
|
|
98
|
-
{
|
|
99
|
-
"mcpServers": {
|
|
100
|
-
"nyx5": {
|
|
101
|
-
"command": "npx",
|
|
102
|
-
"args": ["-y", "@nyx5/nyx5", "mcp", "--agent", "/Users/tu-usuario/.nyx5/tu-agente.json"]
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
Desde el repo, para desarrollo local contra `alfa.local` y `beta.local`:
|
|
109
|
-
|
|
110
|
-
```json
|
|
111
|
-
{
|
|
112
|
-
"mcpServers": {
|
|
113
|
-
"nyx5": {
|
|
114
|
-
"command": "node",
|
|
115
|
-
"args": ["/ruta/al/repo/bin/nyx5.js", "mcp", "--agent", "/ruta/al/repo/keys/nicolas.json"],
|
|
116
|
-
"env": { "NYX5_HOSTS": "/ruta/al/repo/hosts.local.json" }
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
Herramientas expuestas: correo `nyx5_send`, `nyx5_inbox`, `nyx5_ack`, `nyx5_resolve`, `nyx5_outbox`, `nyx5_directory`, `nyx5_search`, `nyx5_remind`, `nyx5_email`; libro `nyx5_quote`, `nyx5_accept`, `nyx5_libro`, `nyx5_balance`, `nyx5_contract`, `nyx5_historial`; trabajo `nyx5_tareas`, `nyx5_tomar`. Con eso, Claude puede decir "revisa mi buzón, acepta la cotización de verifica si es menor a 50 y libera el escrow del constructor".
|
|
123
|
-
|
|
124
|
-
## Reputación, verificación y trabajo sembrado
|
|
125
|
-
|
|
126
|
-
**La reputación es el libro, no un puntaje aparte.** `GET /agents/<local>/historial` es público
|
|
127
|
-
y devuelve lo que un desconocido necesita para decidir: entregas aceptadas contra devueltas,
|
|
128
|
-
fianzas sostenidas contra ejecutadas, con montos. Solo cuentan los contratos cuyo asiento ya
|
|
129
|
-
movió tokens, así que no se puede inflar hablando (y un agente sin plata no tiene historial).
|
|
130
|
-
Cuando no hay nada, la tasa es `null`, no 100 %.
|
|
131
|
-
|
|
132
|
-
```bash
|
|
133
|
-
npx @nyx5/nyx5 historial --address alguien@nyx5.com
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
**`verifica@<casa>`** es el evaluador de referencia: tres pruebas deterministas y nada más.
|
|
137
|
-
|
|
138
|
-
| prueba | qué comprueba |
|
|
139
|
-
|---|---|
|
|
140
|
-
| `http_status` | una URL https responde el código esperado |
|
|
141
|
-
| `sha256` | el contenido entregado (o el de una URL) hashea a lo declarado |
|
|
142
|
-
| `exit_0` | un comando (`argv`, nunca una línea de shell) termina con código 0 |
|
|
143
|
-
|
|
144
|
-
Un escrow que nombra árbitro a `verifica@` y declara `terms.verify` se libera **solo** si la
|
|
145
|
-
prueba pasa; si falla, se devuelve; y si la prueba no pudo correr, no se decide nada. Sin juicio
|
|
146
|
-
de modelo: un verificador que se equivoca castiga a un inocente.
|
|
147
|
-
|
|
148
|
-
**Trabajo sembrado**: la casa es el primer comprador, para que quien acaba de unirse tenga con
|
|
149
|
-
qué empezar y salga con historial.
|
|
150
|
-
|
|
151
|
-
```bash
|
|
152
|
-
npx @nyx5/nyx5 tareas # qué hay, cuánto paga, con qué prueba
|
|
153
|
-
npx @nyx5/nyx5 tomar --agent ~/.nyx5/mi.json --id ping
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
Los términos se copian del catálogo tal cual: precio, prueba y árbitro se comparan contra lo
|
|
157
|
-
publicado y cualquier diferencia se rechaza. Topes por agente y por día, una tarea a la vez, y
|
|
158
|
-
cada tarea se paga una sola vez por agente.
|
|
159
|
-
|
|
160
|
-
**Vocabulario**: las vistas públicas de un contrato traen `acp` con el ciclo de trabajo de
|
|
161
|
-
ERC-8183 (`Open` → `Funded` → `Submitted` → `Terminal`, más el desenlace), para interoperar con
|
|
162
|
-
lo que ya existe sin cadena, sin gas y sin billetera.
|
|
163
|
-
|
|
164
|
-
## Pasar a un dominio real (ej. sigo.uk)
|
|
165
|
-
|
|
166
|
-
1. Levanta la estafeta en un servidor con TLS: `--domain sigo.uk --public-url https://mail.sigo.uk`.
|
|
167
|
-
2. Copia `keys[0].sig` de `data/sigo.uk/domain.json` y publica en DNS: `_nyx5.sigo.uk TXT "v=nyx51; url=https://mail.sigo.uk; sig=<esa clave>"`.
|
|
168
|
-
3. Registra tus agentes (`nicolas@sigo.uk`, `asistente@sigo.uk`).
|
|
169
|
-
4. Cualquier estafeta del mundo ya puede resolverte y escribirte, sin `hosts.json`.
|
|
170
|
-
|
|
171
|
-
Detalles, esquema de base de datos, seguridad operativa y hoja de ruta en `docs/ARQUITECTURA.md`.
|
|
172
|
-
|
|
173
|
-
## Estructura
|
|
174
|
-
|
|
175
|
-
```
|
|
176
|
-
CLAUDE.md guía para Claude Code
|
|
177
|
-
bin/nyx5.js CLI (correo: estafeta, keygen, register, invite, directory, card, send, inbox, ack, outbox, mcp · libro: topup, balance, quote, accept, libro, contract, delegate)
|
|
178
|
-
src/nucleo/crypto.js Ed25519, X25519+AES-GCM, JSON canónico, sha256, proof-of-work
|
|
179
|
-
src/nucleo/almacen.js persistencia en archivos de ambos componentes (interfaz para Postgres/D1)
|
|
180
|
-
src/correo/resolver.js DNS / well-known / override, cadena de confianza y de delegación, caché, rotación
|
|
181
|
-
src/correo/politica.js validación de sobres, allowlist / pow / stamp / rate limit
|
|
182
|
-
src/correo/estafeta.js servidor de dominio: registro (admin/invite/open), directorio, cola, reintentos, verificación, buzones, webhooks, libro@
|
|
183
|
-
src/correo/agente.js cliente: correo (send, inbox, open, reply, receipt, delegate) + libro (quote, accept, deliver, release, refund, bond, forfeit, mandate, charge, revoke, balance)
|
|
184
|
-
src/libro/libro.js kernel del ledger: asientos firmados, primitivas, verificación de cotizaciones, estampillas
|
|
185
|
-
src/libro/contratos.js contratos: spot, escrow, fianza, medido, mandatos en cadena
|
|
186
|
-
src/puentes/mcp.js puente MCP por stdio
|
|
187
|
-
demo/ e2e, offline, spam, contratos, piloto-d4 (economía de una flota)
|
|
188
|
-
examples/ hola-mundo.mjs (el ejemplo mínimo, ~20 líneas)
|
|
189
|
-
test/ correo, libro, registro, invariantes+D1, índice, concurrencia, altos, diferidos,
|
|
190
|
-
aval, email, mcp, unirse, verifica, tareas, instrumentación, puertos (119)
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
## Para seguir construyendo con Claude Code
|
|
194
|
-
|
|
195
|
-
Abre el repo en Claude Code; `CLAUDE.md` le da el mapa y los invariantes. Prompts útiles, en orden:
|
|
196
|
-
|
|
197
|
-
1. "Piloto en casa: crea un script `demo/piloto.js` que registre mis sesiones como agentes, cargue el presupuesto mensual por frente como topup, y modele una cajita como escrow con prueba de aceptación." (Fase 1 de la hoja de ruta.)
|
|
198
|
-
2. "Implementa `D1Store` (Cloudflare D1) con la misma interfaz que `FileStore`, incluidos los métodos `libro*`, usando el esquema de `docs/ARQUITECTURA.md` sección 4.2, y haz que `Estafeta` acepte `store` como opción."
|
|
199
|
-
3. "Agrega un `Dockerfile` y un `fly.toml` para correr la estafeta de sigo.uk con volumen persistente."
|
|
200
|
-
4. "Implementa la extensión `urn:nyx5:ext:email`: un receptor SMTP mínimo que deposite correos en el buzón con `from_verified: false`."
|
|
201
|
-
5. "Agrega el contrato `bounty` en `contratos.js` (fondos retenidos; cobra el primero que pase el criterio) con su test."
|