@uuaid/pillar 0.2.0-alpha.9 → 2.0.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/HOSTING-LIMITS.md +432 -0
- package/INTERACTION-CONVENTION.md +222 -1
- package/README.md +358 -17
- package/bin/carrier.mjs +7 -1
- package/bin/pillar-ask.mjs +1 -0
- package/bin/pillar-blob.mjs +139 -0
- package/bin/pillar-directory.mjs +232 -0
- package/bin/pillar-escrow.mjs +675 -0
- package/bin/pillar-responder.mjs +47 -1
- package/bin/pillar-seed.mjs +113 -13
- package/bin/pillar.mjs +299 -7
- package/package.json +30 -7
- package/src/blob/blob.mjs +510 -0
- package/src/blob/broker.mjs +129 -0
- package/src/blob/http.mjs +334 -0
- package/src/blob/store.mjs +55 -0
- package/src/escrow/box.mjs +43 -0
- package/src/escrow/escrow-service.mjs +538 -0
- package/src/escrow/rails/evm-rail.mjs +427 -0
- package/src/escrow/rails/index.mjs +41 -0
- package/src/escrow/rails/zilligon-rail.mjs +73 -0
- package/src/escrow/terms.mjs +368 -0
- package/src/escrow/token-registry.mjs +231 -0
- package/src/escrow/verify.mjs +119 -0
- package/src/escrow/zilligon.mjs +266 -0
- package/src/identity/keychain.mjs +27 -10
- package/src/identity/tier.mjs +130 -0
- package/src/identity/trust.mjs +63 -0
- package/src/index.mjs +28 -2
- package/src/mailbox/mailbox.mjs +33 -2
- package/src/net/carrier-client.mjs +93 -14
- package/src/net/carrier-server.mjs +212 -15
- package/src/net/delegation.mjs +209 -0
- package/src/net/envelope.mjs +81 -0
- package/src/net/link-offer.mjs +107 -0
- package/src/net/refusals.mjs +126 -0
- package/src/net/seed-registry.mjs +467 -0
- package/src/net/seed-tier.mjs +185 -0
- package/src/node-check.mjs +32 -0
- package/src/observability.mjs +141 -0
- package/src/pillar.mjs +180 -17
- package/src/vda/core.mjs +290 -0
- package/src/vda/directory.mjs +87 -0
- package/src/vda/instruments.mjs +246 -0
- package/src/vda/shims.mjs +77 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VDA-1 adoption shims (plan Phase 5) — wrap other protocols' settlement
|
|
3
|
+
* artifacts into VDA envelopes and emit VDA ids in their native shapes.
|
|
4
|
+
* The shims TRANSLATE; they never upgrade trust: an x402 settlement wraps
|
|
5
|
+
* into a `transfer` claim verified against the CHAIN (same instrument as
|
|
6
|
+
* any transfer), and an A2A artifact / MCP tool result carries the
|
|
7
|
+
* attestation, not a re-statement of it.
|
|
8
|
+
*/
|
|
9
|
+
import { normalizeClaim } from "./core.mjs";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Map an x402 payment-settlement (HTTP 402 flow) onto a VDA transfer claim.
|
|
13
|
+
* x402 settles on-chain; its receipt fields name network, tx hash, payer,
|
|
14
|
+
* payee, asset, amount. The output is a CLAIM — verification still runs
|
|
15
|
+
* through TransferVerifier against the chain, so the shim adds zero trust.
|
|
16
|
+
*
|
|
17
|
+
* settlement: { network: "eip155:<chainId>"|<chainId>, txHash, payer?,
|
|
18
|
+
* payee, amount, asset? ("native" | erc20 address) }
|
|
19
|
+
*/
|
|
20
|
+
export function claimFromX402(settlement) {
|
|
21
|
+
const s = settlement ?? {};
|
|
22
|
+
let chainId = null;
|
|
23
|
+
if (typeof s.network === "string" && s.network.startsWith("eip155:")) chainId = Number(s.network.slice(7));
|
|
24
|
+
else if (s.network != null && !Number.isNaN(Number(s.network))) chainId = Number(s.network);
|
|
25
|
+
const asset = s.asset == null || s.asset === "native" ? "native"
|
|
26
|
+
: String(s.asset).startsWith("erc20:") ? String(s.asset) : `erc20:${String(s.asset)}`;
|
|
27
|
+
const n = normalizeClaim({
|
|
28
|
+
kind: "transfer", rail: "evm", chainId,
|
|
29
|
+
txId: s.txHash ?? s.txId ?? null,
|
|
30
|
+
from: s.payer ?? null, to: s.payee ?? null,
|
|
31
|
+
amount: s.amount != null ? String(s.amount) : null,
|
|
32
|
+
asset,
|
|
33
|
+
});
|
|
34
|
+
if (!n.ok) return { ok: false, reason: `x402-unmappable:${n.reason}` };
|
|
35
|
+
return { ok: true, claim: n.claim };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Emit an attestation as an A2A task artifact (A2A artifacts are named parts
|
|
40
|
+
* with data payloads). The artifact carries the FULL envelope so any A2A
|
|
41
|
+
* client can verify offline; the name carries the content-addressed id.
|
|
42
|
+
*/
|
|
43
|
+
export function a2aArtifactOfAttestation(att) {
|
|
44
|
+
if (att?.kind !== "vda-attestation") throw new Error("a2a shim: not a vda-attestation");
|
|
45
|
+
return {
|
|
46
|
+
artifactId: `vda-${att.attestationId}`,
|
|
47
|
+
name: `vda-attestation:${att.attestationId}`,
|
|
48
|
+
description: `VDA-1 ${att.claim?.kind} attestation, verdict=${att.verdict}, verifier=${att.verifier ?? "unsigned"}`,
|
|
49
|
+
parts: [{ kind: "data", data: att }],
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* MCP tool descriptor for a server exposing VDA verification. The handler
|
|
55
|
+
* wiring is host-specific; this is the portable contract (name, schema,
|
|
56
|
+
* annotations) so any MCP host can demand receipts the same way.
|
|
57
|
+
*/
|
|
58
|
+
export const MCP_VERIFY_TOOL = {
|
|
59
|
+
name: "vda_verify_transfer",
|
|
60
|
+
description:
|
|
61
|
+
"Verify that a transfer (native or ERC-20) actually settled on-chain, from the chain's own record. " +
|
|
62
|
+
"Returns a signed, content-addressed VDA-1 attestation verifiable offline. " +
|
|
63
|
+
"Verdicts: verified | failed | pending | instrument-blind | unsupported (fail-closed).",
|
|
64
|
+
inputSchema: {
|
|
65
|
+
type: "object",
|
|
66
|
+
required: ["chainId", "txId", "to", "amount"],
|
|
67
|
+
properties: {
|
|
68
|
+
chainId: { type: "integer", description: "EVM chain id (e.g. 137)" },
|
|
69
|
+
txId: { type: "string", description: "transaction hash" },
|
|
70
|
+
from: { type: "string", description: "expected sender (optional)" },
|
|
71
|
+
to: { type: "string", description: "expected recipient" },
|
|
72
|
+
amount: { type: "string", description: "decimal base units (wei) — string, never a number" },
|
|
73
|
+
asset: { type: "string", description: '"native" or "erc20:<tokenAddress>"' },
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
|
|
77
|
+
};
|