Agent Mesh
Go a2aa2a-protocolagent-meshagentic-aiinferencemcpmeshmesh-networknetwork-securitynetworking-aip2p-network
sdk: discover services and call tools, milestone 3
Antonio Ojea55bc1a4dd3b4
diff --git a/sdk/README.md b/sdk/README.mdindex 35d3f6d1..6ca2fb48 100644--- a/sdk/README.md+++ b/sdk/README.md@@ -21,7 +21,7 @@ node and to the control plane, a `sam-node`.## What exists today-Milestones 1 and 2 are implemented and tested in both languages:+Milestones 1 to 3 are implemented and tested in both languages:| Capability | JS | Python || --- | --- | --- |@@ -35,10 +35,13 @@ Milestones 1 and 2 are implemented and tested in both languages:| libp2p host as `sam-node` configures it (TCP, TLS, yamux) | yes | yes || `/sam/auth/1.0.0`, both sides; join = handshake with a router and check its role | yes | yes || Circuit relay v2 reservation on the router; dial and accept through it | yes | yes |+| Service discovery in the mesh DHT (`/sam/kad/1.0.0`) | yes | yes |+| `/sam/mcp/1.0.0` client: list and call a provider's tools, or its catalog | yes | yes |+| Caller-side label requirements on the provider's credential | yes | yes |-A member built this way is on the mesh: authenticated with a router,-reachable through it, verifying every peer that dials it and every peer it-dials. It cannot yet discover or call tools.+A member built this way is on the mesh and uses it: it finds a service in+the DHT and calls its tools through the router, verifying the provider on+every call. It cannot yet serve tools of its own.Facts about the libp2p implementations that the SDKs work around, eachpinned by a test:@@ -64,6 +67,14 @@ pinned by a test:`<relay>/p2p-circuit`, and a router refuses that before the authhandshake. The JS SDK starts the listener after the handshake, through thetransport manager, which is not on the public `Libp2p` interface.+- py-libp2p's Kademlia client takes a protocol prefix but its provider+ lookups still speak `/ipfs/kad/1.0.0`, so it cannot reach the mesh DHT.+ The Python SDK does a bounded GET_PROVIDERS walk itself on+ `/sam/kad/1.0.0`, seeded by the routers (`agent_mesh/discovery.py`).+ js-libp2p's `@libp2p/kad-dht` takes the protocol and works as is.+- go-libp2p-kad-dht keys provider records by the multihash, not the CID.+ `sdk/testdata/service_keys.json` pins the keys both SDKs derive against+ `internal/node/service.go`.## Wire contract@@ -226,22 +237,30 @@ holds against the control plane's records.does the same and sends a forged frame; an address behind the router fora peer that is not on the mesh fails. About 7 seconds.-### Milestone 3 — call tools--- Kademlia client with prefix `/sam` (JS: `@libp2p/kad-dht`; Python:- `libp2p.kad_dht`, to be checked against go-libp2p the way the relay was),- lookup by service type and name.-- `/sam/mcp/1.0.0` client: send the `AuthFrame` with the target service,- verify the provider's biscuit, then run an MCP client over the- varint-framed stream. JS: a `Transport` for `@modelcontextprotocol/sdk`;- Python: a read/write stream pair for `mcp`.-- Caller-side label requirements (`checkPeerLabels`) on the provider's- biscuit.-- Public API: `session.discover(type, name)`,- `session.callTool("mcp://svc/tool", args)`, `session.listTools(peer, service)`.-- Test: the mesh of `sdk_mesh_test.go` gains an MCP backend on the- `sam-node`; each SDK member discovers it and calls a tool through the- router, and the runners' command protocol gains `discover` and `call`.+### Milestone 3 — call tools (done)++- Discovery: `session.discover(type, name)` looks the mesh DHT up for the+ service key `internal/node/service.go` derives. JS: `@libp2p/kad-dht` in+ client mode on `/sam/kad/1.0.0`; Python: the SDK's own bounded+ GET_PROVIDERS walk on the same protocol (see the facts above).+- `/sam/mcp/1.0.0` client: `session.openMCP(addr, "mcp://<name>")` sends+ the `AuthFrame` naming the service, verifies the provider's credential+ and the caller's required labels (`checkPeerLabels`), then runs the+ official MCP client over the varint-framed stream. JS: a `Transport` for+ `@modelcontextprotocol/sdk`; Python: a pair of memory streams pumped to+ and from the libp2p stream for `mcp.ClientSession`. `""` as the target is+ the provider's own catalog (`list_local_services`, `get_mesh_info`).+- `session.listTools(addr, service)` and `session.callTool(addr, service,+ tool, args)` on top of that.+- Tests. Unit: each SDK calls a tool on an in-process provider that serves+ `/sam/mcp/1.0.0` as `sam-node` does with the official MCP server behind+ it, reads its catalog, and is refused for missing labels, an untrusted+ provider, a forged caller credential and an unknown service. Integration:+ the mesh of `sdk_mesh_test.go` has an MCP backend behind the `sam-node`+ (`calc`, tool `add`); each SDK member discovers it in the DHT, lists and+ calls `add` through the router, reads the node's catalog and is refused a+ service the node does not have. The runners took `discover`, `tools` and+ `call` commands for it.### Milestone 4 — serve tools@@ -298,8 +317,9 @@ whose toolchain is missing, and CI (`.github/workflows/sdk.yml`) installsboth so nothing skips there. The SDK members in the mesh test are therunners `sdk/js/src/conformance-join.ts` and`sdk/python/src/agent_mesh/conformance_join.py`: each joins, prints what it-holds, then takes JSON commands on stdin (`auth`, `peers`, `quit`) so the Go-test can drive both languages through the same script.+holds, then takes JSON commands on stdin (`auth`, `discover`, `tools`,+`call`, `peers`, `quit`) so the Go test can drive both languages through the+same script.Interoperability facts that the tests pin: `sdk/testdata/identity_vectors.json`holds key encodings, peer IDs and challenge signatures produced withdiff --git a/sdk/js/README.md b/sdk/js/README.mdindex 37b244ee..dfba1b95 100644--- a/sdk/js/README.md+++ b/sdk/js/README.md@@ -3,9 +3,10 @@Native JavaScript SDK for joining a SAM agent mesh from inside the agentprocess. It replaces the `sam-node` sidecar for agents written for Node.js.-Status: **milestone 2** (identity, enrollment, credential refresh, joining-the mesh over libp2p with mutual authentication). Discovering and calling-tools are the next milestones; see [../README.md](../README.md) for the plan.+Status: **milestone 3** (identity, enrollment, credential refresh, joining+the mesh over libp2p with mutual authentication, discovering services and+calling their tools). Serving tools is the next milestone; see+[../README.md](../README.md) for the plan.## Install@@ -14,9 +15,10 @@ cd sdk/js && npm ci && npm run build```Requires Node.js 22.18 or later. Runtime dependencies are-`@bufbuild/protobuf`, `@biscuit-auth/biscuit-wasm` and the js-libp2p-packages (`libp2p`, `@libp2p/tcp`, `@libp2p/tls`, `@chainsafe/libp2p-yamux`,-`@libp2p/circuit-relay-v2`, `@libp2p/identify`).+`@bufbuild/protobuf`, `@biscuit-auth/biscuit-wasm`, `@modelcontextprotocol/sdk`+and the js-libp2p packages (`libp2p`, `@libp2p/tcp`, `@libp2p/tls`,+`@chainsafe/libp2p-yamux`, `@libp2p/circuit-relay-v2`, `@libp2p/identify`,+`@libp2p/kad-dht`, `@libp2p/ping`).## Use@@ -38,6 +40,13 @@ console.log(session.relayAddresses.map(String));// Reach another member (directly or through a router) and verify it.const peer = await session.authenticate("/ip4/.../p2p/<router>/p2p-circuit/p2p/<peer>");console.log(peer.roles, peer.labels, peer.expiration);++// Find a service in the mesh DHT and call one of its tools.+const [provider] = await session.discover("mcp", "calc");+const addr = `${session.routers[0].addr}/p2p-circuit/p2p/${provider.peerId}`;+console.log(await session.listTools(addr, "mcp://calc"));+const result = await session.callTool(addr, "mcp://calc", "add", { a: 1, b: 2 }, { requiredLabels: { region: "eu" } });+console.log(result.text);await session.close();// Later, in a new process:@@ -65,6 +74,8 @@ A plaintext `http://` control plane is accepted only on loopback. Pass- `src/host.ts`, `src/auth.ts`, `src/session.ts`: the libp2p host, the`/sam/auth/1.0.0` handshake on both sides, `MeshSession` with the relayreservation and the refresh loop.+- `src/discovery.ts`, `src/mcp.ts`: service keys for the mesh DHT, and MCP+ over `/sam/mcp/1.0.0` (a `Transport` for the official MCP client).- `src/gen/`: generated from `api/sam.proto` by `hack/gen-sdk-proto.sh`.## Testdiff --git a/sdk/js/package-lock.json b/sdk/js/package-lock.jsonindex 0b4614ce..24f5bb97 100644--- a/sdk/js/package-lock.json+++ b/sdk/js/package-lock.json@@ -16,16 +16,21 @@"@libp2p/crypto": "^5.1.23","@libp2p/identify": "^4.1.14","@libp2p/interface": "^3.3.0",+ "@libp2p/kad-dht": "^16.4.5",+ "@libp2p/ping": "^3.1.13","@libp2p/tcp": "^11.0.28","@libp2p/tls": "^3.1.10","@libp2p/utils": "^7.4.1",+ "@modelcontextprotocol/sdk": "^1.30.1","@multiformats/multiaddr": "^13.0.3",- "libp2p": "^3.3.11"+ "libp2p": "^3.3.11",+ "multiformats": "^14.0.5"},"devDependencies": {"@bufbuild/protoc-gen-es": "^2.15.0","@types/node": "^22.19.0",- "typescript": "^5.9.3"+ "typescript": "^5.9.3",+ "zod": "^4.6.5"},"engines": {"node": ">=22.18"@@ -137,6 +142,18 @@"node": ">=6"}},+ "node_modules/@hono/node-server": {+ "version": "2.1.1",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/@hono/node-server/-/node-server-2.1.1.tgz",+ "integrity": "sha512-ELuehkj5VCBdgEw9zs+ivkKwyzzUCSQuE96YmiPvn1ECBoZCczbFXJLeEGMTYjphP6gydh4pHMqEYPVMYUVgQg==",+ "license": "MIT",+ "engines": {+ "node": ">=20"+ },+ "peerDependencies": {+ "hono": "^4"+ }+ },"node_modules/@leichtgewicht/ip-codec": {"version": "2.0.5","resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/@leichtgewicht/ip-codec/-/ip-codec-2.0.5.tgz",@@ -268,6 +285,54 @@"uint8arrays": "^6.0.0"}},+ "node_modules/@libp2p/kad-dht": {+ "version": "16.4.5",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/@libp2p/kad-dht/-/kad-dht-16.4.5.tgz",+ "integrity": "sha512-Pxmk3pIfe5Ih1xr+CY1uzw8AXRY+2VI6p3iebM4ljueu+dovEPIahW8tq4F2iNHIQftuc9Svncw4JikwrU7I1w==",+ "license": "Apache-2.0 OR MIT",+ "dependencies": {+ "@libp2p/crypto": "^5.1.23",+ "@libp2p/interface": "^3.3.0",+ "@libp2p/interface-internal": "^3.1.13",+ "@libp2p/peer-collections": "^7.0.28",+ "@libp2p/peer-id": "^6.0.15",+ "@libp2p/ping": "^3.1.13",+ "@libp2p/record": "^4.0.15",+ "@libp2p/utils": "^7.4.1",+ "@multiformats/multiaddr": "^13.0.3",+ "@multiformats/multiaddr-matcher": "^3.0.2",+ "any-signal": "^4.1.1",+ "interface-datastore": "^10.0.1",+ "it-all": "^3.0.9",+ "it-drain": "^3.0.10",+ "it-length": "^3.0.9",+ "it-map": "^3.1.4",+ "it-merge": "^3.0.12",+ "it-parallel": "^3.0.13",+ "it-pipe": "^3.0.1",+ "it-pushable": "^3.2.3",+ "it-take": "^3.0.9",+ "main-event": "^1.0.1",+ "multiformats": "^14.0.0",+ "p-defer": "^4.0.1",+ "p-event": "^7.0.0",+ "progress-events": "^1.0.1",+ "protons-runtime": "^7.0.0",+ "race-signal": "^2.0.0",+ "uint8-varint": "^3.0.0",+ "uint8arraylist": "^3.0.2",+ "uint8arrays": "^6.1.1"+ }+ },+ "node_modules/@libp2p/kad-dht/node_modules/uint8arraylist": {+ "version": "3.0.2",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/uint8arraylist/-/uint8arraylist-3.0.2.tgz",+ "integrity": "sha512-LDVoq9BQaGJzGDUovEnoX6rpKCvnY/Jbtws4ikwnBzjRbq5qBAFpBZevUEbSmMM87aO0Sp+wOZy2ZXf5yODmXQ==",+ "license": "Apache-2.0 OR MIT",+ "dependencies": {+ "uint8arrays": "^6.0.0"+ }+ },"node_modules/@libp2p/logger": {"version": "6.2.13","resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/@libp2p/logger/-/logger-6.2.13.tgz",@@ -384,6 +449,49 @@"uint8arrays": "^6.0.0"}},+ "node_modules/@libp2p/ping": {+ "version": "3.1.13",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/@libp2p/ping/-/ping-3.1.13.tgz",+ "integrity": "sha512-zB0TYbxWD73z3kqHrC2PDk7CAX0wQ0smz6mZ9okE4MoFgJv+XtMaIB2pB/4eT7xjWwdc2w3mYRmq+lMyXl3nXQ==",+ "license": "Apache-2.0 OR MIT",+ "dependencies": {+ "@libp2p/interface": "^3.3.0",+ "@libp2p/interface-internal": "^3.1.13",+ "p-event": "^7.0.0",+ "race-signal": "^2.0.0",+ "uint8arraylist": "^3.0.2",+ "uint8arrays": "^6.1.1"+ }+ },+ "node_modules/@libp2p/ping/node_modules/uint8arraylist": {+ "version": "3.0.2",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/uint8arraylist/-/uint8arraylist-3.0.2.tgz",+ "integrity": "sha512-LDVoq9BQaGJzGDUovEnoX6rpKCvnY/Jbtws4ikwnBzjRbq5qBAFpBZevUEbSmMM87aO0Sp+wOZy2ZXf5yODmXQ==",+ "license": "Apache-2.0 OR MIT",+ "dependencies": {+ "uint8arrays": "^6.0.0"+ }+ },+ "node_modules/@libp2p/record": {+ "version": "4.0.15",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/@libp2p/record/-/record-4.0.15.tgz",+ "integrity": "sha512-EaHFtQAlZuM9vCpd+0KnZhTVgV26Uzje7DkyUseGNKTy+Wit9Q94C/+wDThpZuRHnK1FH/CvPxJ4kLj7AoQ1WA==",+ "license": "Apache-2.0 OR MIT",+ "dependencies": {+ "protons-runtime": "^7.0.0",+ "uint8arraylist": "^3.0.2",+ "uint8arrays": "^6.1.1"+ }+ },+ "node_modules/@libp2p/record/node_modules/uint8arraylist": {+ "version": "3.0.2",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/uint8arraylist/-/uint8arraylist-3.0.2.tgz",+ "integrity": "sha512-LDVoq9BQaGJzGDUovEnoX6rpKCvnY/Jbtws4ikwnBzjRbq5qBAFpBZevUEbSmMM87aO0Sp+wOZy2ZXf5yODmXQ==",+ "license": "Apache-2.0 OR MIT",+ "dependencies": {+ "uint8arrays": "^6.0.0"+ }+ },"node_modules/@libp2p/tcp": {"version": "11.0.28","resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/@libp2p/tcp/-/tcp-11.0.28.tgz",@@ -482,6 +590,46 @@"uint8arrays": "^6.0.0"}},+ "node_modules/@modelcontextprotocol/sdk": {+ "version": "1.30.1",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/@modelcontextprotocol/sdk/-/sdk-1.30.1.tgz",+ "integrity": "sha512-H2HxLvC3HDNybePJaLdSrU1hhUK5iQw+WvV1b01myFyI7sdVGe1u/IPTE5D9fGCiJDVtgMV/lmFkQXLmQyIFYA==",+ "license": "MIT",+ "dependencies": {+ "@hono/node-server": "^1.19.9 || ^2.0.5",+ "ajv": "^8.17.1",+ "ajv-formats": "^3.0.1",+ "content-type": "^1.0.5",+ "cors": "^2.8.5",+ "cross-spawn": "^7.0.5",+ "eventsource": "^3.0.2",+ "eventsource-parser": "^3.0.0",+ "express": "^5.2.1",+ "express-rate-limit": "^8.2.1",+ "hono": "^4.11.4",+ "jose": "^6.1.3",+ "json-schema-typed": "^8.0.2",+ "pkce-challenge": "^5.0.0",+ "raw-body": "^3.0.0",+ "zod": "^3.25 || ^4.0",+ "zod-to-json-schema": "^3.25.1"+ },+ "engines": {+ "node": ">=18"+ },+ "peerDependencies": {+ "@cfworker/json-schema": "^4.1.1",+ "zod": "^3.25 || ^4.0"+ },+ "peerDependenciesMeta": {+ "@cfworker/json-schema": {+ "optional": true+ },+ "zod": {+ "optional": false+ }+ }+ },"node_modules/@multiformats/dns": {"version": "1.0.15","resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/@multiformats/dns/-/dns-1.0.15.tgz",@@ -832,6 +980,52 @@"integrity": "sha512-lVgvB2NyPLqbXXhVmXcYFTC1x5K7CiVdPgdY7LGgFQWC8506oN01sPN3i9cl9ynuwF4iJ0TS9exnR7cZ9FuX4w==","license": "Apache-2.0 OR MIT"},+ "node_modules/accepts": {+ "version": "2.0.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/accepts/-/accepts-2.0.0.tgz",+ "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==",+ "license": "MIT",+ "dependencies": {+ "mime-types": "^3.0.0",+ "negotiator": "^1.0.0"+ },+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/ajv": {+ "version": "8.20.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/ajv/-/ajv-8.20.0.tgz",+ "integrity": "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==",+ "license": "MIT",+ "dependencies": {+ "fast-deep-equal": "^3.1.3",+ "fast-uri": "^3.0.1",+ "json-schema-traverse": "^1.0.0",+ "require-from-string": "^2.0.2"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/epoberezkin"+ }+ },+ "node_modules/ajv-formats": {+ "version": "3.0.1",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/ajv-formats/-/ajv-formats-3.0.1.tgz",+ "integrity": "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==",+ "license": "MIT",+ "dependencies": {+ "ajv": "^8.0.0"+ },+ "peerDependencies": {+ "ajv": "^8.0.0"+ },+ "peerDependenciesMeta": {+ "ajv": {+ "optional": true+ }+ }+ },"node_modules/any-signal": {"version": "4.2.0","resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/any-signal/-/any-signal-4.2.0.tgz",@@ -856,6 +1050,81 @@"node": ">=12.0.0"}},+ "node_modules/body-parser": {+ "version": "2.3.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/body-parser/-/body-parser-2.3.0.tgz",+ "integrity": "sha512-2cGmJupaNgg+QUwVLAucDuWuoMZ6EX9iHDRswZ5lsNYEmwPaRknMPCLZz07yTzVq/83p4o/wzbDZbBrTvGGTIw==",+ "license": "MIT",+ "dependencies": {+ "bytes": "^3.1.2",+ "content-type": "^2.0.0",+ "debug": "^4.4.3",+ "http-errors": "^2.0.1",+ "iconv-lite": "^0.7.2",+ "on-finished": "^2.4.1",+ "qs": "^6.15.2",+ "raw-body": "^3.0.2",+ "type-is": "^2.1.0"+ },+ "engines": {+ "node": ">=18"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/body-parser/node_modules/content-type": {+ "version": "2.1.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/content-type/-/content-type-2.1.0.tgz",+ "integrity": "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==",+ "license": "MIT",+ "engines": {+ "node": ">=18"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/bytes": {+ "version": "3.1.2",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/bytes/-/bytes-3.1.2.tgz",+ "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/call-bind-apply-helpers": {+ "version": "1.0.2",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",+ "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",+ "license": "MIT",+ "dependencies": {+ "es-errors": "^1.3.0",+ "function-bind": "^1.1.2"+ },+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/call-bound": {+ "version": "1.0.4",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/call-bound/-/call-bound-1.0.4.tgz",+ "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",+ "license": "MIT",+ "dependencies": {+ "call-bind-apply-helpers": "^1.0.2",+ "get-intrinsic": "^1.3.0"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },"node_modules/cborg": {"version": "6.1.2","resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/cborg/-/cborg-6.1.2.tgz",@@ -865,6 +1134,77 @@"cborg": "lib/bin.js"}},+ "node_modules/content-disposition": {+ "version": "1.1.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/content-disposition/-/content-disposition-1.1.0.tgz",+ "integrity": "sha512-5jRCH9Z/+DRP7rkvY83B+yGIGX96OYdJmzngqnw2SBSxqCFPd0w2km3s5iawpGX8krnwSGmF0FW5Nhr0Hfai3g==",+ "license": "MIT",+ "engines": {+ "node": ">=18"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/content-type": {+ "version": "1.0.5",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/content-type/-/content-type-1.0.5.tgz",+ "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/cookie": {+ "version": "0.7.2",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/cookie/-/cookie-0.7.2.tgz",+ "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/cookie-signature": {+ "version": "1.2.2",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/cookie-signature/-/cookie-signature-1.2.2.tgz",+ "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==",+ "license": "MIT",+ "engines": {+ "node": ">=6.6.0"+ }+ },+ "node_modules/cors": {+ "version": "2.8.6",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/cors/-/cors-2.8.6.tgz",+ "integrity": "sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==",+ "license": "MIT",+ "dependencies": {+ "object-assign": "^4",+ "vary": "^1"+ },+ "engines": {+ "node": ">= 0.10"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/cross-spawn": {+ "version": "7.0.6",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/cross-spawn/-/cross-spawn-7.0.6.tgz",+ "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",+ "license": "MIT",+ "dependencies": {+ "path-key": "^3.1.0",+ "shebang-command": "^2.0.0",+ "which": "^2.0.1"+ },+ "engines": {+ "node": ">= 8"+ }+ },"node_modules/datastore-core": {"version": "12.0.1","resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/datastore-core/-/datastore-core-12.0.1.tgz",@@ -888,7 +1228,6 @@"version": "4.4.3","resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/debug/-/debug-4.4.3.tgz","integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",- "dev": true,"license": "MIT","dependencies": {"ms": "^2.1.3"@@ -918,59 +1257,449 @@"url": "https://github.com/sponsors/sindresorhus"}},- "node_modules/eventemitter3": {- "version": "5.0.4",- "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/eventemitter3/-/eventemitter3-5.0.4.tgz",- "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==",- "license": "MIT"+ "node_modules/depd": {+ "version": "2.0.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/depd/-/depd-2.0.0.tgz",+ "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }},- "node_modules/hashlru": {- "version": "2.3.0",- "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/hashlru/-/hashlru-2.3.0.tgz",- "integrity": "sha512-0cMsjjIC8I+D3M44pOQdsy0OHXGLVz6Z0beRuufhKa0KfaD2wGwAev6jILzXsd3/vpnNQJmWyZtIILqM1N+n5A==",+ "node_modules/dunder-proto": {+ "version": "1.0.1",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/dunder-proto/-/dunder-proto-1.0.1.tgz",+ "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",+ "license": "MIT",+ "dependencies": {+ "call-bind-apply-helpers": "^1.0.1",+ "es-errors": "^1.3.0",+ "gopd": "^1.2.0"+ },+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/ee-first": {+ "version": "1.1.1",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/ee-first/-/ee-first-1.1.1.tgz",+ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==","license": "MIT"},- "node_modules/interface-datastore": {- "version": "10.0.1",- "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/interface-datastore/-/interface-datastore-10.0.1.tgz",- "integrity": "sha512-DYMj/Og5Cz1Qwkx6/x5KRvR8SYEX7rVAv3KKCm2NzTwWSfpNAC4PahjcYbHyoZBP6zPWrhQv5n5wE+vaDdgSAg==",- "license": "Apache-2.0 OR MIT",- "dependencies": {- "abort-error": "^1.0.2",- "interface-store": "^8.0.0",- "uint8arrays": "^6.1.1"+ "node_modules/encodeurl": {+ "version": "2.0.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/encodeurl/-/encodeurl-2.0.0.tgz",+ "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"}},- "node_modules/interface-store": {- "version": "8.0.0",- "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/interface-store/-/interface-store-8.0.0.tgz",- "integrity": "sha512-e2+s3EEROzM+Wlas4hU3zveTUscvVMf1BOvdsJfpzFm19SoEXLVadpACjWOnM491HqGpvtfFnevyiaN8W+I6Eg==",- "license": "Apache-2.0 OR MIT",+ "node_modules/es-define-property": {+ "version": "1.0.1",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/es-define-property/-/es-define-property-1.0.1.tgz",+ "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/es-errors": {+ "version": "1.3.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/es-errors/-/es-errors-1.3.0.tgz",+ "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/es-object-atoms": {+ "version": "1.1.2",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/es-object-atoms/-/es-object-atoms-1.1.2.tgz",+ "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==",+ "license": "MIT","dependencies": {- "abort-error": "^1.0.2"+ "es-errors": "^1.3.0"+ },+ "engines": {+ "node": ">= 0.4"}},- "node_modules/is-loopback-addr": {- "version": "2.1.0",- "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/is-loopback-addr/-/is-loopback-addr-2.1.0.tgz",- "integrity": "sha512-77bB59Coq+vGTibZlnuYVU1bUuiboGZ62ZJ7TqmgYKb+hko9dSlqS5OfqvmPZhwJys48At4y4D1UJP3GuvoXtQ==",+ "node_modules/escape-html": {+ "version": "1.0.3",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/escape-html/-/escape-html-1.0.3.tgz",+ "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==","license": "MIT"},- "node_modules/is-network-error": {- "version": "1.3.2",- "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/is-network-error/-/is-network-error-1.3.2.tgz",- "integrity": "sha512-PhBY86zaxNZUuWP6h13Vu5oFe0XY6/UlKzQnYFELzGVHygP3MxmvTfYSG7GN3aIab/iWudSMgjSnG9Dq+nHrgA==",+ "node_modules/etag": {+ "version": "1.8.1",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/etag/-/etag-1.8.1.tgz",+ "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==","license": "MIT","engines": {- "node": ">=16"- },- "funding": {- "url": "https://github.com/sponsors/sindresorhus"+ "node": ">= 0.6"}},- "node_modules/it-all": {- "version": "3.0.11",- "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/it-all/-/it-all-3.0.11.tgz",+ "node_modules/eventemitter3": {+ "version": "5.0.4",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/eventemitter3/-/eventemitter3-5.0.4.tgz",+ "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==",+ "license": "MIT"+ },+ "node_modules/eventsource": {+ "version": "3.0.7",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/eventsource/-/eventsource-3.0.7.tgz",+ "integrity": "sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==",+ "license": "MIT",+ "dependencies": {+ "eventsource-parser": "^3.0.1"+ },+ "engines": {+ "node": ">=18.0.0"+ }+ },+ "node_modules/eventsource-parser": {+ "version": "3.1.1",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/eventsource-parser/-/eventsource-parser-3.1.1.tgz",+ "integrity": "sha512-EKN1vKAMcZ8MlYMpaNuxN6R9yakzH6uajHcHVTqWJzvu5pWw9DyhbP35HH8MVBQ+dZjAfDxk+A8NiR9KWaXiyQ==",+ "license": "MIT",+ "engines": {+ "node": ">=18.0.0"+ }+ },+ "node_modules/express": {+ "version": "5.2.1",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/express/-/express-5.2.1.tgz",+ "integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==",+ "license": "MIT",+ "dependencies": {+ "accepts": "^2.0.0",+ "body-parser": "^2.2.1",+ "content-disposition": "^1.0.0",+ "content-type": "^1.0.5",+ "cookie": "^0.7.1",+ "cookie-signature": "^1.2.1",+ "debug": "^4.4.0",+ "depd": "^2.0.0",+ "encodeurl": "^2.0.0",+ "escape-html": "^1.0.3",+ "etag": "^1.8.1",+ "finalhandler": "^2.1.0",+ "fresh": "^2.0.0",+ "http-errors": "^2.0.0",+ "merge-descriptors": "^2.0.0",+ "mime-types": "^3.0.0",+ "on-finished": "^2.4.1",+ "once": "^1.4.0",+ "parseurl": "^1.3.3",+ "proxy-addr": "^2.0.7",+ "qs": "^6.14.0",+ "range-parser": "^1.2.1",+ "router": "^2.2.0",+ "send": "^1.1.0",+ "serve-static": "^2.2.0",+ "statuses": "^2.0.1",+ "type-is": "^2.0.1",+ "vary": "^1.1.2"+ },+ "engines": {+ "node": ">= 18"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/express-rate-limit": {+ "version": "8.7.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/express-rate-limit/-/express-rate-limit-8.7.0.tgz",+ "integrity": "sha512-hOwV7WOxXfjRpAM1DSJWZDXx3GhplwD8IfwuwvogD8i1Qnkgosw/H45s4ZnFAUHDAhPjlY9hLBvJhKmGMyY26g==",+ "license": "MIT",+ "dependencies": {+ "debug": "^4.4.3",+ "ip-address": "^10.2.0"+ },+ "engines": {+ "node": ">= 16"+ },+ "funding": {+ "url": "https://github.com/sponsors/express-rate-limit"+ },+ "peerDependencies": {+ "express": ">= 4.11"+ }+ },+ "node_modules/fast-deep-equal": {+ "version": "3.1.3",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",+ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",+ "license": "MIT"+ },+ "node_modules/fast-uri": {+ "version": "3.1.8",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/fast-uri/-/fast-uri-3.1.8.tgz",+ "integrity": "sha512-GZMtZUTNRpOVIECoXwLNZS5xUGE+mVNbTB8h/7Rwh2TFWcBQiPzTgyZi05BF9UMZKkLJv8XBRJTlU7zg8+ZfMg==",+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/fastify"+ },+ {+ "type": "opencollective",+ "url": "https://opencollective.com/fastify"+ }+ ],+ "license": "BSD-3-Clause"+ },+ "node_modules/finalhandler": {+ "version": "2.1.1",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/finalhandler/-/finalhandler-2.1.1.tgz",+ "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==",+ "license": "MIT",+ "dependencies": {+ "debug": "^4.4.0",+ "encodeurl": "^2.0.0",+ "escape-html": "^1.0.3",+ "on-finished": "^2.4.1",+ "parseurl": "^1.3.3",+ "statuses": "^2.0.1"+ },+ "engines": {+ "node": ">= 18.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/forwarded": {+ "version": "0.2.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/forwarded/-/forwarded-0.2.0.tgz",+ "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/fresh": {+ "version": "2.0.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/fresh/-/fresh-2.0.0.tgz",+ "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/function-bind": {+ "version": "1.1.2",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/function-bind/-/function-bind-1.1.2.tgz",+ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",+ "license": "MIT",+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/get-intrinsic": {+ "version": "1.3.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/get-intrinsic/-/get-intrinsic-1.3.0.tgz",+ "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",+ "license": "MIT",+ "dependencies": {+ "call-bind-apply-helpers": "^1.0.2",+ "es-define-property": "^1.0.1",+ "es-errors": "^1.3.0",+ "es-object-atoms": "^1.1.1",+ "function-bind": "^1.1.2",+ "get-proto": "^1.0.1",+ "gopd": "^1.2.0",+ "has-symbols": "^1.1.0",+ "hasown": "^2.0.2",+ "math-intrinsics": "^1.1.0"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/get-proto": {+ "version": "1.0.1",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/get-proto/-/get-proto-1.0.1.tgz",+ "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",+ "license": "MIT",+ "dependencies": {+ "dunder-proto": "^1.0.1",+ "es-object-atoms": "^1.0.0"+ },+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/gopd": {+ "version": "1.2.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/gopd/-/gopd-1.2.0.tgz",+ "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/has-symbols": {+ "version": "1.1.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/has-symbols/-/has-symbols-1.1.0.tgz",+ "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/hashlru": {+ "version": "2.3.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/hashlru/-/hashlru-2.3.0.tgz",+ "integrity": "sha512-0cMsjjIC8I+D3M44pOQdsy0OHXGLVz6Z0beRuufhKa0KfaD2wGwAev6jILzXsd3/vpnNQJmWyZtIILqM1N+n5A==",+ "license": "MIT"+ },+ "node_modules/hasown": {+ "version": "2.0.4",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/hasown/-/hasown-2.0.4.tgz",+ "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==",+ "license": "MIT",+ "dependencies": {+ "function-bind": "^1.1.2"+ },+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/hono": {+ "version": "4.13.9",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/hono/-/hono-4.13.9.tgz",+ "integrity": "sha512-7dMkQmZoC4E6F7AtaQSPhlWAdnBti+j7rreMZl8QB4jFiEhP9TWbGWUMi8WYzBCgmgulxuvLQupKqo+Co6Omyg==",+ "license": "MIT",+ "engines": {+ "node": ">=16.9.0"+ }+ },+ "node_modules/http-errors": {+ "version": "2.0.1",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/http-errors/-/http-errors-2.0.1.tgz",+ "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",+ "license": "MIT",+ "dependencies": {+ "depd": "~2.0.0",+ "inherits": "~2.0.4",+ "setprototypeof": "~1.2.0",+ "statuses": "~2.0.2",+ "toidentifier": "~1.0.1"+ },+ "engines": {+ "node": ">= 0.8"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/iconv-lite": {+ "version": "0.7.3",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/iconv-lite/-/iconv-lite-0.7.3.tgz",+ "integrity": "sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ==",+ "license": "MIT",+ "dependencies": {+ "safer-buffer": ">= 2.1.2 < 3.0.0"+ },+ "engines": {+ "node": ">=0.10.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/inherits": {+ "version": "2.0.4",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/inherits/-/inherits-2.0.4.tgz",+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",+ "license": "ISC"+ },+ "node_modules/interface-datastore": {+ "version": "10.0.1",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/interface-datastore/-/interface-datastore-10.0.1.tgz",+ "integrity": "sha512-DYMj/Og5Cz1Qwkx6/x5KRvR8SYEX7rVAv3KKCm2NzTwWSfpNAC4PahjcYbHyoZBP6zPWrhQv5n5wE+vaDdgSAg==",+ "license": "Apache-2.0 OR MIT",+ "dependencies": {+ "abort-error": "^1.0.2",+ "interface-store": "^8.0.0",+ "uint8arrays": "^6.1.1"+ }+ },+ "node_modules/interface-store": {+ "version": "8.0.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/interface-store/-/interface-store-8.0.0.tgz",+ "integrity": "sha512-e2+s3EEROzM+Wlas4hU3zveTUscvVMf1BOvdsJfpzFm19SoEXLVadpACjWOnM491HqGpvtfFnevyiaN8W+I6Eg==",+ "license": "Apache-2.0 OR MIT",+ "dependencies": {+ "abort-error": "^1.0.2"+ }+ },+ "node_modules/ip-address": {+ "version": "10.7.2",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/ip-address/-/ip-address-10.7.2.tgz",+ "integrity": "sha512-7H/2gFSIitxc0hG3nOI1glS8QLo/EHBFFLk8vEUjXY/xu0AdL8jZ9U1IzO2PUm0d2D/ofQcAifb0g6OBkt8U7w==",+ "license": "MIT",+ "engines": {+ "node": ">= 12"+ }+ },+ "node_modules/ipaddr.js": {+ "version": "1.9.1",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/ipaddr.js/-/ipaddr.js-1.9.1.tgz",+ "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.10"+ }+ },+ "node_modules/is-loopback-addr": {+ "version": "2.1.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/is-loopback-addr/-/is-loopback-addr-2.1.0.tgz",+ "integrity": "sha512-77bB59Coq+vGTibZlnuYVU1bUuiboGZ62ZJ7TqmgYKb+hko9dSlqS5OfqvmPZhwJys48At4y4D1UJP3GuvoXtQ==",+ "license": "MIT"+ },+ "node_modules/is-network-error": {+ "version": "1.3.2",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/is-network-error/-/is-network-error-1.3.2.tgz",+ "integrity": "sha512-PhBY86zaxNZUuWP6h13Vu5oFe0XY6/UlKzQnYFELzGVHygP3MxmvTfYSG7GN3aIab/iWudSMgjSnG9Dq+nHrgA==",+ "license": "MIT",+ "engines": {+ "node": ">=16"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/is-promise": {+ "version": "4.0.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/is-promise/-/is-promise-4.0.0.tgz",+ "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==",+ "license": "MIT"+ },+ "node_modules/isexe": {+ "version": "2.0.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/isexe/-/isexe-2.0.0.tgz",+ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",+ "license": "ISC"+ },+ "node_modules/it-all": {+ "version": "3.0.11",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/it-all/-/it-all-3.0.11.tgz","integrity": "sha512-Gvqj6MO4GMLnFdtE68HZRpGBskNC+9+GQ+JevTGNYLyhjUuPhjDLU3jN1LpBemXJDW1bRSkczqA/qGyKlPKrcQ==","license": "Apache-2.0 OR MIT"},@@ -989,6 +1718,12 @@"it-peekable": "^3.0.0"}},+ "node_modules/it-length": {+ "version": "3.0.11",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/it-length/-/it-length-3.0.11.tgz",+ "integrity": "sha512-j0uukHdr3zoLm4dcozDoyv5khQrOI8dfXMSSEqaxorfOtleh1KwRVbdnTmzj6HVkHgTM1jcx+bhAcnTkbpHl+g==",+ "license": "Apache-2.0 OR MIT"+ },"node_modules/it-length-prefixed": {"version": "11.0.1","resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/it-length-prefixed/-/it-length-prefixed-11.0.1.tgz",@@ -1132,6 +1867,27 @@"integrity": "sha512-zvoeEjLViGFyhYT5KNCgmcIH90Si8lCve4aTMvgej/ZQRfB9YzrcJW3UHIJjbQ9TiAnsT4vsWDImEFQNk5xmnA==","license": "Apache-2.0 OR MIT"},+ "node_modules/jose": {+ "version": "6.2.12",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/jose/-/jose-6.2.12.tgz",+ "integrity": "sha512-9NiFmJEex0sy2Dk58j2UGBSHgUs2ypF9eZSu4L6vjOX3Dp96Sw1F3uL+H+D1sx02jZZdzUT0HgvCy59CuvXcWw==",+ "license": "MIT",+ "funding": {+ "url": "https://github.com/sponsors/panva"+ }+ },+ "node_modules/json-schema-traverse": {+ "version": "1.0.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",+ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",+ "license": "MIT"+ },+ "node_modules/json-schema-typed": {+ "version": "8.0.2",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/json-schema-typed/-/json-schema-typed-8.0.2.tgz",+ "integrity": "sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA==",+ "license": "BSD-2-Clause"+ },"node_modules/libp2p": {"version": "3.3.11","resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/libp2p/-/libp2p-3.3.11.tgz",@@ -1173,6 +1929,65 @@"integrity": "sha512-4l9z8r7Q446mhhVTwdHmfPksOYBwN2xa7ewEW2yxPVNQapIaAf57ORFLMB91SpMEMa4wXowect7fq3uMLjDnGA==","license": "Apache-2.0 OR MIT"},+ "node_modules/math-intrinsics": {+ "version": "1.1.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/math-intrinsics/-/math-intrinsics-1.1.0.tgz",+ "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/media-typer": {+ "version": "1.1.1",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/media-typer/-/media-typer-1.1.1.tgz",+ "integrity": "sha512-yz3xRaG20c6/BOzvYoDaGtPmGscs7YivItZEEqe6GbwNfHuxu9YNmvnEkMzKldAGY4/80pRcQRZSEnhquk9XuQ==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/merge-descriptors": {+ "version": "2.0.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/merge-descriptors/-/merge-descriptors-2.0.0.tgz",+ "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==",+ "license": "MIT",+ "engines": {+ "node": ">=18"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/mime-db": {+ "version": "1.54.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/mime-db/-/mime-db-1.54.0.tgz",+ "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/mime-types": {+ "version": "3.0.2",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/mime-types/-/mime-types-3.0.2.tgz",+ "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==",+ "license": "MIT",+ "dependencies": {+ "mime-db": "^1.54.0"+ },+ "engines": {+ "node": ">=18"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },"node_modules/mortice": {"version": "3.3.1","resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/mortice/-/mortice-3.3.1.tgz",@@ -1188,7 +2003,6 @@"version": "2.1.3","resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/ms/-/ms-2.1.3.tgz","integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",- "dev": true,"license": "MIT"},"node_modules/multiformats": {@@ -1215,6 +2029,35 @@"node": "^22 || ^24 || >=26"}},+ "node_modules/negotiator": {+ "version": "1.1.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/negotiator/-/negotiator-1.1.0.tgz",+ "integrity": "sha512-NMPBRMJgiQHjbd8phG3Vebdx4kZ1H121rbl5IkMqeOsahptB9BKo/d7oJ3zTXqTgagn2bWlNSXkh0QUGM31RYg==",+ "license": "MIT",+ "dependencies": {+ "content-type": "^2.1.0"+ },+ "engines": {+ "node": ">=18"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/negotiator/node_modules/content-type": {+ "version": "2.1.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/content-type/-/content-type-2.1.0.tgz",+ "integrity": "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==",+ "license": "MIT",+ "engines": {+ "node": ">=18"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },"node_modules/netmask": {"version": "2.1.1","resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/netmask/-/netmask-2.1.1.tgz",@@ -1224,6 +2067,48 @@"node": ">= 0.4.0"}},+ "node_modules/object-assign": {+ "version": "4.1.1",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/object-assign/-/object-assign-4.1.1.tgz",+ "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/object-inspect": {+ "version": "1.13.4",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/object-inspect/-/object-inspect-1.13.4.tgz",+ "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/on-finished": {+ "version": "2.4.1",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/on-finished/-/on-finished-2.4.1.tgz",+ "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",+ "license": "MIT",+ "dependencies": {+ "ee-first": "1.1.1"+ },+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/once": {+ "version": "1.4.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/once/-/once-1.4.0.tgz",+ "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",+ "license": "ISC",+ "dependencies": {+ "wrappy": "1"+ }+ },"node_modules/p-defer": {"version": "4.0.1","resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/p-defer/-/p-defer-4.0.1.tgz",@@ -1294,6 +2179,43 @@"url": "https://github.com/sponsors/sindresorhus"}},+ "node_modules/parseurl": {+ "version": "1.3.3",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/parseurl/-/parseurl-1.3.3.tgz",+ "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/path-key": {+ "version": "3.1.1",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/path-key/-/path-key-3.1.1.tgz",+ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/path-to-regexp": {+ "version": "8.4.2",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/path-to-regexp/-/path-to-regexp-8.4.2.tgz",+ "integrity": "sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA==",+ "license": "MIT",+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/pkce-challenge": {+ "version": "5.0.1",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/pkce-challenge/-/pkce-challenge-5.0.1.tgz",+ "integrity": "sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ==",+ "license": "MIT",+ "engines": {+ "node": ">=16.20.0"+ }+ },"node_modules/progress-events": {"version": "1.1.0","resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/progress-events/-/progress-events-1.1.0.tgz",@@ -1320,6 +2242,23 @@"uint8arrays": "^6.0.0"}},+ "node_modules/proxy-addr": {+ "version": "2.0.8",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/proxy-addr/-/proxy-addr-2.0.8.tgz",+ "integrity": "sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ==",+ "license": "MIT",+ "dependencies": {+ "forwarded": "0.2.0",+ "ipaddr.js": "1.9.1"+ },+ "engines": {+ "node": ">= 0.10"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },"node_modules/pvtsutils": {"version": "1.3.6","resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/pvtsutils/-/pvtsutils-1.3.6.tgz",@@ -1338,6 +2277,22 @@"node": ">=16.0.0"}},+ "node_modules/qs": {+ "version": "6.16.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/qs/-/qs-6.16.0.tgz",+ "integrity": "sha512-h6fhOIaRrID2CbEY2fqs+7t+UXZo+MLAnU5gRIq85uFtdiUPCdsApMlHhXogKVM4HM2DVbIjGNTTYH2OcmP1vA==",+ "license": "BSD-3-Clause",+ "dependencies": {+ "es-define-property": "^1.0.1",+ "side-channel": "^1.1.1"+ },+ "engines": {+ "node": ">=0.6"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },"node_modules/race-event": {"version": "1.6.1","resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/race-event/-/race-event-1.6.1.tgz",@@ -1365,18 +2320,230 @@"url": "https://github.com/sponsors/sindresorhus"}},+ "node_modules/range-parser": {+ "version": "1.3.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/range-parser/-/range-parser-1.3.0.tgz",+ "integrity": "sha512-hek2mFQpPuI4E1BBKrSto+BU3e3x4xuarsbiwr3+lf7p44juvFMV0XFWQAP3xUyqXA4RrXLIoaSUGbSt056ZMw==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/raw-body": {+ "version": "3.0.2",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/raw-body/-/raw-body-3.0.2.tgz",+ "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==",+ "license": "MIT",+ "dependencies": {+ "bytes": "~3.1.2",+ "http-errors": "~2.0.1",+ "iconv-lite": "~0.7.0",+ "unpipe": "~1.0.0"+ },+ "engines": {+ "node": ">= 0.10"+ }+ },"node_modules/reflect-metadata": {"version": "0.2.2","resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/reflect-metadata/-/reflect-metadata-0.2.2.tgz","integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==","license": "Apache-2.0"},+ "node_modules/require-from-string": {+ "version": "2.0.2",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/require-from-string/-/require-from-string-2.0.2.tgz",+ "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==",+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },"node_modules/retimeable-signal": {"version": "1.0.1","resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/retimeable-signal/-/retimeable-signal-1.0.1.tgz","integrity": "sha512-Cy26CYfbWnYu8HMoJeDhaMpW/EYFIbne3vMf6G9RSrOyWYXbPehja/BEdzpqmM84uy2bfBD7NPZhoQ4GZEtgvg==","license": "Apache-2.0 OR MIT"},+ "node_modules/router": {+ "version": "2.2.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/router/-/router-2.2.0.tgz",+ "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==",+ "license": "MIT",+ "dependencies": {+ "debug": "^4.4.0",+ "depd": "^2.0.0",+ "is-promise": "^4.0.0",+ "parseurl": "^1.3.3",+ "path-to-regexp": "^8.0.0"+ },+ "engines": {+ "node": ">= 18"+ }+ },+ "node_modules/safer-buffer": {+ "version": "2.1.2",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/safer-buffer/-/safer-buffer-2.1.2.tgz",+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",+ "license": "MIT"+ },+ "node_modules/send": {+ "version": "1.2.1",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/send/-/send-1.2.1.tgz",+ "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==",+ "license": "MIT",+ "dependencies": {+ "debug": "^4.4.3",+ "encodeurl": "^2.0.0",+ "escape-html": "^1.0.3",+ "etag": "^1.8.1",+ "fresh": "^2.0.0",+ "http-errors": "^2.0.1",+ "mime-types": "^3.0.2",+ "ms": "^2.1.3",+ "on-finished": "^2.4.1",+ "range-parser": "^1.2.1",+ "statuses": "^2.0.2"+ },+ "engines": {+ "node": ">= 18"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/serve-static": {+ "version": "2.2.1",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/serve-static/-/serve-static-2.2.1.tgz",+ "integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==",+ "license": "MIT",+ "dependencies": {+ "encodeurl": "^2.0.0",+ "escape-html": "^1.0.3",+ "parseurl": "^1.3.3",+ "send": "^1.2.0"+ },+ "engines": {+ "node": ">= 18"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/setprototypeof": {+ "version": "1.2.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/setprototypeof/-/setprototypeof-1.2.0.tgz",+ "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",+ "license": "ISC"+ },+ "node_modules/shebang-command": {+ "version": "2.0.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/shebang-command/-/shebang-command-2.0.0.tgz",+ "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",+ "license": "MIT",+ "dependencies": {+ "shebang-regex": "^3.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/shebang-regex": {+ "version": "3.0.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/shebang-regex/-/shebang-regex-3.0.0.tgz",+ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/side-channel": {+ "version": "1.1.1",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/side-channel/-/side-channel-1.1.1.tgz",+ "integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==",+ "license": "MIT",+ "dependencies": {+ "es-errors": "^1.3.0",+ "object-inspect": "^1.13.4",+ "side-channel-list": "^1.0.1",+ "side-channel-map": "^1.0.1",+ "side-channel-weakmap": "^1.0.2"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/side-channel-list": {+ "version": "1.0.1",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/side-channel-list/-/side-channel-list-1.0.1.tgz",+ "integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==",+ "license": "MIT",+ "dependencies": {+ "es-errors": "^1.3.0",+ "object-inspect": "^1.13.4"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/side-channel-map": {+ "version": "1.0.1",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/side-channel-map/-/side-channel-map-1.0.1.tgz",+ "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",+ "license": "MIT",+ "dependencies": {+ "call-bound": "^1.0.2",+ "es-errors": "^1.3.0",+ "get-intrinsic": "^1.2.5",+ "object-inspect": "^1.13.3"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/side-channel-weakmap": {+ "version": "1.0.2",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",+ "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",+ "license": "MIT",+ "dependencies": {+ "call-bound": "^1.0.2",+ "es-errors": "^1.3.0",+ "get-intrinsic": "^1.2.5",+ "object-inspect": "^1.13.3",+ "side-channel-map": "^1.0.1"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/statuses": {+ "version": "2.0.2",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/statuses/-/statuses-2.0.2.tgz",+ "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },"node_modules/supports-color": {"version": "10.2.2","resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/supports-color/-/supports-color-10.2.2.tgz",@@ -1389,6 +2556,15 @@"url": "https://github.com/chalk/supports-color?sponsor=1"}},+ "node_modules/toidentifier": {+ "version": "1.0.1",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/toidentifier/-/toidentifier-1.0.1.tgz",+ "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",+ "license": "MIT",+ "engines": {+ "node": ">=0.6"+ }+ },"node_modules/tslib": {"version": "2.8.1","resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/tslib/-/tslib-2.8.1.tgz",@@ -1413,6 +2589,37 @@"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==","license": "0BSD"},+ "node_modules/type-is": {+ "version": "2.1.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/type-is/-/type-is-2.1.0.tgz",+ "integrity": "sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA==",+ "license": "MIT",+ "dependencies": {+ "content-type": "^2.0.0",+ "media-typer": "^1.1.0",+ "mime-types": "^3.0.0"+ },+ "engines": {+ "node": ">= 18"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/type-is/node_modules/content-type": {+ "version": "2.1.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/content-type/-/content-type-2.1.0.tgz",+ "integrity": "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==",+ "license": "MIT",+ "engines": {+ "node": ">=18"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },"node_modules/typescript": {"version": "5.9.3","resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/typescript/-/typescript-5.9.3.tgz",@@ -1498,12 +2705,30 @@"url": "https://github.com/sponsors/sindresorhus"}},+ "node_modules/unpipe": {+ "version": "1.0.0",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/unpipe/-/unpipe-1.0.0.tgz",+ "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },"node_modules/utf8-codec": {"version": "1.0.0","resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/utf8-codec/-/utf8-codec-1.0.0.tgz","integrity": "sha512-S/QSLezp3qvG4ld5PUfXiH7mCFxLKjSVZRFkB3DOjgwHuJPFDkInAXc/anf7BAbHt/D38ozDzL+QMZ6/7gsI6w==","license": "MIT"},+ "node_modules/vary": {+ "version": "1.1.2",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/vary/-/vary-1.1.2.tgz",+ "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },"node_modules/weald": {"version": "1.1.3","resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/weald/-/weald-1.1.3.tgz",@@ -1535,6 +2760,45 @@"asn1js": "^3.0.10","tslib": "^2.8.1"}+ },+ "node_modules/which": {+ "version": "2.0.2",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/which/-/which-2.0.2.tgz",+ "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",+ "license": "ISC",+ "dependencies": {+ "isexe": "^2.0.0"+ },+ "bin": {+ "node-which": "bin/node-which"+ },+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/wrappy": {+ "version": "1.0.2",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/wrappy/-/wrappy-1.0.2.tgz",+ "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",+ "license": "ISC"+ },+ "node_modules/zod": {+ "version": "4.6.5",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/zod/-/zod-4.6.5.tgz",+ "integrity": "sha512-v5l/aFXZQeai4awLbOpSoHecE9UiMrnfx75tEXLjNonXVARxQ5mOeipTjROUchszUNCqnE+hqAMujRsRHsut2Q==",+ "license": "MIT",+ "funding": {+ "url": "https://github.com/sponsors/colinhacks"+ }+ },+ "node_modules/zod-to-json-schema": {+ "version": "3.25.2",+ "resolved": "http://airlock-proxy.uplink.goog:999/npm/artifact-foundry-prod/ah-3p-staging-npm/zod-to-json-schema/-/zod-to-json-schema-3.25.2.tgz",+ "integrity": "sha512-O/PgfnpT1xKSDeQYSCfRI5Gy3hPf91mKVDuYLUHZJMiDFptvP41MSnWofm8dnCm0256ZNfZIM7DSzuSMAFnjHA==",+ "license": "ISC",+ "peerDependencies": {+ "zod": "^3.25.28 || ^4"+ }}}}diff --git a/sdk/js/package.json b/sdk/js/package.jsonindex 93b4059c..4e768aa5 100644--- a/sdk/js/package.json+++ b/sdk/js/package.json@@ -36,15 +36,20 @@"@libp2p/crypto": "^5.1.23","@libp2p/identify": "^4.1.14","@libp2p/interface": "^3.3.0",+ "@libp2p/kad-dht": "^16.4.5",+ "@libp2p/ping": "^3.1.13","@libp2p/tcp": "^11.0.28","@libp2p/tls": "^3.1.10","@libp2p/utils": "^7.4.1",+ "@modelcontextprotocol/sdk": "^1.30.1","@multiformats/multiaddr": "^13.0.3",- "libp2p": "^3.3.11"+ "libp2p": "^3.3.11",+ "multiformats": "^14.0.5"},"devDependencies": {"@bufbuild/protoc-gen-es": "^2.15.0","@types/node": "^22.19.0",- "typescript": "^5.9.3"+ "typescript": "^5.9.3",+ "zod": "^4.6.5"}}diff --git a/sdk/js/src/conformance-join.ts b/sdk/js/src/conformance-join.tsindex c2be17a9..b725f3f2 100644--- a/sdk/js/src/conformance-join.ts+++ b/sdk/js/src/conformance-join.ts@@ -20,6 +20,12 @@// {"cmd": "auth", "addr": "<multiaddr>"} connect (through a relay when the// address says /p2p-circuit) and// run the auth handshake+// {"cmd": "discover", "type": "mcp", "name": "calc"}+// DHT lookup for a service's providers+// {"cmd": "tools", "addr": "<multiaddr>", "service": "mcp://calc"}+// list a provider's tools+// {"cmd": "call", "addr": "<multiaddr>", "service": "mcp://calc",+// "tool": "add", "args": {...}} call one tool// {"cmd": "peers"} peers that authenticated to us// {"cmd": "quit"} leave the mesh and exit//@@ -27,9 +33,20 @@// the Python SDK ships the same runner (python -m agent_mesh.conformance_join).import { createInterface } from "node:readline";+import type { ServiceType } from "./discovery.ts";import { AgentMesh } from "./mesh.ts";import type { MeshSession } from "./session.ts";+interface Command {+ cmd?: string;+ addr?: string;+ type?: string;+ name?: string;+ service?: string;+ tool?: string;+ args?: Record<string, unknown>;+}+function requireEnv(name: string): string {const v = process.env[name];if (!v) {@@ -42,10 +59,14 @@ function emit(obj: unknown): void {process.stdout.write(JSON.stringify(obj) + "\n");}-async function handle(session: MeshSession, command: { cmd?: string; addr?: string }): Promise<unknown> {- switch (command.cmd) {- case "auth": {- try {+function failure(cmd: string | undefined, err: unknown): unknown {+ return { cmd, ok: false, error: err instanceof Error ? `${err.name}: ${err.message}` : String(err) };+}++async function handle(session: MeshSession, command: Command): Promise<unknown> {+ try {+ switch (command.cmd) {+ case "auth": {const verified = await session.authenticate(command.addr ?? "", AbortSignal.timeout(15_000));return {cmd: "auth",@@ -55,14 +76,26 @@ async function handle(session: MeshSession, command: { cmd?: string; addr?: strilabels: verified.labels,expiration: Math.floor(verified.expiration.getTime() / 1000),};- } catch (err) {- return { cmd: "auth", ok: false, error: err instanceof Error ? `${err.name}: ${err.message}` : String(err) };}+ case "discover": {+ const providers = await session.discover((command.type ?? "mcp") as ServiceType, command.name);+ return { cmd: "discover", ok: true, providers: providers.map((p) => ({ peer_id: p.peerId, addrs: p.addrs })) };+ }+ case "tools": {+ const tools = await session.listTools(command.addr ?? "", command.service ?? "", { signal: AbortSignal.timeout(15_000) });+ return { cmd: "tools", ok: true, tools: tools.map((t) => t.name) };+ }+ case "call": {+ const result = await session.callTool(command.addr ?? "", command.service ?? "", command.tool ?? "", command.args ?? {}, { signal: AbortSignal.timeout(15_000) });+ return { cmd: "call", ok: true, is_error: result.isError, text: result.text };+ }+ case "peers":+ return { cmd: "peers", authenticated_peers: [...session.authenticatedPeers.keys()].sort() };+ default:+ return failure(command.cmd, new Error(`unknown command ${JSON.stringify(command.cmd)}`));}- case "peers":- return { cmd: "peers", authenticated_peers: [...session.authenticatedPeers.keys()].sort() };- default:- return { cmd: command.cmd, ok: false, error: `unknown command ${JSON.stringify(command.cmd)}` };+ } catch (err) {+ return failure(command.cmd, err);}}@@ -89,9 +122,9 @@ async function main(): Promise<void> {if (line.trim() === "") {continue;}- let command: { cmd?: string; addr?: string };+ let command: Command;try {- command = JSON.parse(line) as { cmd?: string; addr?: string };+ command = JSON.parse(line) as Command;} catch (err) {emit({ ok: false, error: `not JSON: ${err instanceof Error ? err.message : String(err)}` });continue;diff --git a/sdk/js/src/discovery.ts b/sdk/js/src/discovery.tsnew file mode 100644index 00000000..e66372b5--- /dev/null+++ b/sdk/js/src/discovery.ts@@ -0,0 +1,43 @@+// Copyright 2026 Google LLC+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++// Service discovery as sam-node does it (internal/node/service.go): a+// provider record in the mesh DHT under a CID derived from the service key.++import { CID } from "multiformats/cid";+import * as raw from "multiformats/codecs/raw";+import { sha256 } from "multiformats/hashes/sha2";++/** The DHT protocol, go-libp2p-kad-dht with dht.ProtocolPrefix("/sam"). */+export const DHT_PROTOCOL = "/sam/kad/1.0.0";++export type ServiceType = "mcp" | "inference" | "a2a";++/** The DHT key of a service: by type and name, or by type alone when name is omitted. */+export async function serviceCID(type: ServiceType, name?: string): Promise<CID> {+ const key = ["sam:service", type, ...(name !== undefined && name !== "" ? [name] : [])].join(":");+ return CID.createV1(raw.code, await sha256.digest(new TextEncoder().encode(key)));+}++/** Splits "mcp://calculator" into its type and name; "" is the node's own catalog. */+export function parseServiceTarget(target: string): { type: ServiceType | "" ; name: string } {+ if (target === "") {+ return { type: "", name: "" };+ }+ const m = /^(mcp|inference|a2a):\/\/(.+)$/.exec(target);+ if (!m) {+ throw new Error(`service target must look like mcp://<name>, got ${JSON.stringify(target)}`);+ }+ return { type: m[1] as ServiceType, name: m[2] as string };+}diff --git a/sdk/js/src/host.ts b/sdk/js/src/host.tsindex b973da64..a9df2ba8 100644--- a/sdk/js/src/host.ts+++ b/sdk/js/src/host.ts@@ -22,10 +22,13 @@ import { circuitRelayTransport } from "@libp2p/circuit-relay-v2";import { privateKeyFromProtobuf } from "@libp2p/crypto/keys";import { identify } from "@libp2p/identify";import type { Libp2p } from "@libp2p/interface";+import { kadDHT, passthroughMapper } from "@libp2p/kad-dht";+import { ping } from "@libp2p/ping";import { tcp } from "@libp2p/tcp";import { tls } from "@libp2p/tls";import type { Multiaddr } from "@multiformats/multiaddr";import { createLibp2p } from "libp2p";+import { DHT_PROTOCOL } from "./discovery.ts";import type { Identity } from "./identity.ts";export interface MeshHostOptions {@@ -43,7 +46,14 @@ export async function createMeshHost(identity: Identity, options: MeshHostOptiontransports: [tcp(), circuitRelayTransport()],connectionEncrypters: [tls()],streamMuxers: [yamux()],- services: { identify: identify() },+ services: {+ identify: identify(),+ ping: ping(),+ // A client of the mesh DHT: it looks providers up and does not hold+ // records. Peers keep their private addresses; a mesh member often+ // is one, and the router relays to it.+ dht: kadDHT({ protocol: DHT_PROTOCOL, clientMode: true, peerInfoMapper: passthroughMapper }),+ },});}diff --git a/sdk/js/src/index.ts b/sdk/js/src/index.tsindex 904e6d9c..d5987082 100644--- a/sdk/js/src/index.ts+++ b/sdk/js/src/index.ts@@ -38,7 +38,9 @@ export {type MeshCredential,} from "./credential.ts";export { enrollChallenge, enrollStatusChallenge, refreshChallenge, registerChallenge } from "./challenges.ts";-export { MeshSession, type AdmittedRouter, type JoinOptions } from "./session.ts";+export { MeshSession, type AdmittedRouter, type DiscoveredProvider, type JoinOptions, type ToolCallResult } from "./session.ts";export { BiscuitVerificationError, ROLE_ROUTER, requireRole, verifyPeerBiscuit, type VerifiedBiscuit } from "./biscuit.ts";export { AUTH_HANDLER_OPTIONS, AUTH_PROTOCOL, MCP_PROTOCOL, AuthRejectedError, authenticateWithPeer, authStreamHandler } from "./auth.ts";export { createMeshHost, type MeshHostOptions } from "./host.ts";+export { DHT_PROTOCOL, parseServiceTarget, serviceCID, type ServiceType } from "./discovery.ts";+export { LabelsNotSatisfiedError, StreamTransport, openMCPSession, requireLabels, type MCPSession, type MCPSessionOptions } from "./mcp.ts";diff --git a/sdk/js/src/mcp.test.ts b/sdk/js/src/mcp.test.tsnew file mode 100644index 00000000..18d36183--- /dev/null+++ b/sdk/js/src/mcp.test.ts@@ -0,0 +1,190 @@+// Copyright 2026 Google LLC+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++// A provider in one process: a js-libp2p host that serves /sam/mcp/1.0.0+// the way sam-node does (AuthFrame in, AuthResponse out, then MCP over the+// stream) with the official MCP server behind it. The real sam-node is+// exercised by tests/integration/sdk_mesh_test.go.++import { create, fromBinary, toBinary } from "@bufbuild/protobuf";+import { yamux } from "@chainsafe/libp2p-yamux";+import { identify } from "@libp2p/identify";+import type { Connection, Libp2p, Stream } from "@libp2p/interface";+import { tcp } from "@libp2p/tcp";+import { tls } from "@libp2p/tls";+import { lpStream } from "@libp2p/utils";+import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";+import { createLibp2p } from "libp2p";+import assert from "node:assert/strict";+import { readFileSync } from "node:fs";+import { after, before, test } from "node:test";+import { z } from "zod";+import { AuthRejectedError, MAX_AUTH_FRAME_BYTES, MCP_PROTOCOL } from "./auth.ts";+import { loadBiscuit, verifyPeerBiscuit } from "./biscuit.ts";+import { ROLE_NODE } from "./controlplane.ts";+import { parseServiceTarget, serviceCID } from "./discovery.ts";+import { AuthFrameSchema, AuthResponseSchema } from "./gen/sam_pb.ts";+import { Identity } from "./identity.ts";+import { LabelsNotSatisfiedError, StreamTransport, openMCPSession, requireLabels } from "./mcp.ts";++type Wasm = Awaited<ReturnType<typeof loadBiscuit>>;++let wasm: Wasm;+let cpKeyPair: InstanceType<Wasm["KeyPair"]>;+let cpKey: Uint8Array;+let provider: Libp2p;+let providerBiscuit: Uint8Array;+let caller: Libp2p;+let callerBiscuit: Uint8Array;+const servedTargets: string[] = [];++function mint(peerId: string, role: string, labels: Record<string, string> = {}): Uint8Array {+ const b = wasm.Biscuit.builder();+ b.addFact(wasm.Fact.fromString(`node(${JSON.stringify(peerId)})`));+ b.addFact(wasm.Fact.fromString("expiration(2035-01-01T00:00:00Z)"));+ b.addFact(wasm.Fact.fromString(`role(${JSON.stringify(role)})`));+ for (const [k, v] of Object.entries(labels)) {+ b.addFact(wasm.Fact.fromString(`label(${JSON.stringify(k)}, ${JSON.stringify(v)})`));+ }+ return b.build(cpKeyPair.getPrivateKey()).toBytes();+}++function newHost(): Promise<Libp2p> {+ return createLibp2p({+ addresses: { listen: ["/ip4/127.0.0.1/tcp/0"] },+ transports: [tcp()],+ connectionEncrypters: [tls()],+ streamMuxers: [yamux()],+ services: { identify: identify() },+ });+}++/** sam-node's WithBiscuitAuth(HandleMCPStream) in miniature. */+async function serveMCP(stream: Stream, connection: Connection): Promise<void> {+ const auth = lpStream(stream, { maxDataLength: MAX_AUTH_FRAME_BYTES });+ const frame = fromBinary(AuthFrameSchema, (await auth.read()).subarray());+ try {+ await verifyPeerBiscuit(frame.biscuit, connection.remotePeer.toString(), [cpKey]);+ } catch {+ await stream.close();+ return;+ }+ const { type, name } = parseServiceTarget(frame.targetService);+ if (type !== "" && name !== "calc") {+ // An unknown service closes the stream after the frame, as sam-node does.+ await auth.write(toBinary(AuthResponseSchema, create(AuthResponseSchema, { success: true, biscuit: providerBiscuit })));+ await stream.close();+ return;+ }+ servedTargets.push(frame.targetService);+ await auth.write(toBinary(AuthResponseSchema, create(AuthResponseSchema, { success: true, biscuit: providerBiscuit })));++ const server = new McpServer({ name: type === "" ? "catalog" : "calc", version: "0.0.1" });+ if (type === "") {+ server.tool("list_local_services", async () => ({ content: [{ type: "text", text: JSON.stringify([{ type: "mcp", name: "calc" }]) }] }));+ } else {+ server.tool("add", { a: z.number(), b: z.number() }, async ({ a, b }) => ({ content: [{ type: "text", text: String(a + b) }] }));+ }+ await server.connect(new StreamTransport(stream));+}++before(async () => {+ wasm = await loadBiscuit();+ cpKeyPair = new wasm.KeyPair(wasm.SignatureAlgorithm.Ed25519);+ cpKey = new Uint8Array(Buffer.from(cpKeyPair.getPublicKey().toString().replace(/^ed25519\//, ""), "hex"));+ provider = await newHost();+ providerBiscuit = mint(provider.peerId.toString(), ROLE_NODE, { region: "eu" });+ await provider.handle(MCP_PROTOCOL, (stream, connection) => void serveMCP(stream, connection), { runOnLimitedConnection: true });+ caller = await newHost();+ callerBiscuit = mint(caller.peerId.toString(), ROLE_NODE);+});++after(async () => {+ await caller.stop();+ await provider.stop();+});++function frame(target: string, biscuit = callerBiscuit): Uint8Array {+ return toBinary(AuthFrameSchema, create(AuthFrameSchema, { biscuit, targetService: target }));+}++test("service keys match internal/node/service.go", async () => {+ const fixture = JSON.parse(readFileSync(new URL("../../testdata/service_keys.json", import.meta.url), "utf8")) as {+ services: Array<{ type: "mcp" | "inference" | "a2a"; name: string; cid: string; multihash: string }>;+ };+ for (const s of fixture.services) {+ const cid = await serviceCID(s.type, s.name);+ assert.equal(cid.toString(), s.cid, `${s.type}:${s.name}`);+ assert.equal(Buffer.from(cid.multihash.bytes).toString("hex"), s.multihash);+ }+ assert.deepEqual(parseServiceTarget("mcp://calc"), { type: "mcp", name: "calc" });+ assert.deepEqual(parseServiceTarget(""), { type: "", name: "" });+ assert.throws(() => parseServiceTarget("calc"), /must look like/);+});++test("a tool is listed and called over the mesh stream, and the provider is verified", async () => {+ const conn = await caller.dial(provider.getMultiaddrs()[0] as Parameters<typeof caller.dial>[0]);+ const mcp = await openMCPSession(conn, frame("mcp://calc"), [cpKey]);+ try {+ assert.equal(mcp.provider.peerId, provider.peerId.toString());+ assert.deepEqual(mcp.provider.labels, { region: "eu" });+ const { tools } = await mcp.client.listTools();+ assert.deepEqual(tools.map((t) => t.name), ["add"]);+ const result = await mcp.client.callTool({ name: "add", arguments: { a: 2, b: 3 } });+ assert.deepEqual(result.content, [{ type: "text", text: "5" }]);+ } finally {+ await mcp.close();+ }+ assert.ok(servedTargets.includes("mcp://calc"));+});++test("the empty target is the provider's own catalog", async () => {+ const conn = await caller.dial(provider.getMultiaddrs()[0] as Parameters<typeof caller.dial>[0]);+ const mcp = await openMCPSession(conn, frame(""), [cpKey]);+ try {+ const result = await mcp.client.callTool({ name: "list_local_services", arguments: {} });+ assert.match(JSON.stringify(result.content), /calc/);+ } finally {+ await mcp.close();+ }+});++test("required labels are checked on the provider's credential", async () => {+ const conn = await caller.dial(provider.getMultiaddrs()[0] as Parameters<typeof caller.dial>[0]);+ const ok = await openMCPSession(conn, frame("mcp://calc"), [cpKey], { requiredLabels: { region: "eu" } });+ await ok.close();+ await assert.rejects(openMCPSession(conn, frame("mcp://calc"), [cpKey], { requiredLabels: { region: "us" } }), LabelsNotSatisfiedError);+ assert.throws(() => requireLabels({ peerId: "p", expiration: new Date(), verifyingKey: cpKey, roles: [], labels: {} }, { team: "x" }), /team=x/);+});++test("a caller the provider cannot verify gets no session", async () => {+ const conn = await caller.dial(provider.getMultiaddrs()[0] as Parameters<typeof caller.dial>[0]);+ const forged = new wasm.KeyPair(wasm.SignatureAlgorithm.Ed25519);+ const fb = wasm.Biscuit.builder();+ fb.addFact(wasm.Fact.fromString(`node(${JSON.stringify(caller.peerId.toString())})`));+ fb.addFact(wasm.Fact.fromString("expiration(2035-01-01T00:00:00Z)"));+ await assert.rejects(openMCPSession(conn, frame("mcp://calc", fb.build(forged.getPrivateKey()).toBytes()), [cpKey], { signal: AbortSignal.timeout(3000) }));+});++test("a provider whose credential the caller does not trust is rejected", async () => {+ const conn = await caller.dial(provider.getMultiaddrs()[0] as Parameters<typeof caller.dial>[0]);+ const other = new wasm.KeyPair(wasm.SignatureAlgorithm.Ed25519);+ const otherKey = new Uint8Array(Buffer.from(other.getPublicKey().toString().replace(/^ed25519\//, ""), "hex"));+ await assert.rejects(openMCPSession(conn, frame("mcp://calc"), [otherKey]), AuthRejectedError);+});++test("a service the provider does not have ends the session before MCP starts", async () => {+ const conn = await caller.dial(provider.getMultiaddrs()[0] as Parameters<typeof caller.dial>[0]);+ await assert.rejects(openMCPSession(conn, frame("mcp://no-such-service"), [cpKey], { signal: AbortSignal.timeout(3000) }));+});diff --git a/sdk/js/src/mcp.ts b/sdk/js/src/mcp.tsnew file mode 100644index 00000000..2e46b17d--- /dev/null+++ b/sdk/js/src/mcp.ts@@ -0,0 +1,168 @@+// Copyright 2026 Google LLC+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++// MCP over a mesh stream, the client side of sam-node's /sam/mcp/1.0.0+// (internal/node/gate.go): an AuthFrame naming the service, the provider's+// AuthResponse, then JSON-RPC messages each with a varint length prefix.++import type { Connection, Stream } from "@libp2p/interface";+import { lpStream } from "@libp2p/utils";+import { Client } from "@modelcontextprotocol/sdk/client/index.js";+import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";+import { JSONRPCMessageSchema, type JSONRPCMessage } from "@modelcontextprotocol/sdk/types.js";+import { AUTH_HANDSHAKE_TIMEOUT_MS, AuthRejectedError, MAX_AUTH_FRAME_BYTES, MCP_PROTOCOL } from "./auth.ts";+import { BiscuitVerificationError, verifyPeerBiscuit, type VerifiedBiscuit } from "./biscuit.ts";+import { decodeAuthResponse } from "./credential.ts";++/** go-msgio's default message cap, which sam-node's StreamTransport uses. */+export const MAX_MCP_MESSAGE_BYTES = 8 * 1024 * 1024;++/** The MCP client the SDK identifies itself as. */+export const MCP_CLIENT_INFO = { name: "agent-mesh-sdk", version: "0.1.0" };++/**+ * A Transport for @modelcontextprotocol/sdk over a libp2p stream that has+ * already passed the auth handshake.+ */+export class StreamTransport implements Transport {+ onclose?: () => void;+ onerror?: (error: Error) => void;+ onmessage?: (message: JSONRPCMessage) => void;+ readonly #lp: ReturnType<typeof lpStream>;+ readonly #stream: Stream;+ #closed = false;++ constructor(stream: Stream) {+ this.#stream = stream;+ this.#lp = lpStream(stream, { maxDataLength: MAX_MCP_MESSAGE_BYTES });+ }++ async start(): Promise<void> {+ void this.#readLoop();+ }++ async #readLoop(): Promise<void> {+ const decoder = new TextDecoder();+ try {+ while (!this.#closed) {+ const frame = await this.#lp.read();+ const message = JSONRPCMessageSchema.parse(JSON.parse(decoder.decode(frame.subarray())));+ this.onmessage?.(message);+ }+ } catch (err) {+ if (!this.#closed) {+ this.onerror?.(err instanceof Error ? err : new Error(String(err)));+ }+ } finally {+ if (!this.#closed) {+ this.#closed = true;+ this.onclose?.();+ }+ }+ }++ async send(message: JSONRPCMessage): Promise<void> {+ await this.#lp.write(new TextEncoder().encode(JSON.stringify(message)));+ }++ async close(): Promise<void> {+ if (this.#closed) {+ return;+ }+ this.#closed = true;+ await this.#stream.close().catch(() => this.#stream.abort(new Error("mcp stream close failed")));+ this.onclose?.();+ }+}++export interface MCPSessionOptions {+ /** Labels the provider's credential must carry, e.g. { region: "eu" }. */+ requiredLabels?: Record<string, string>;+ /** The agent this call is made for; attribution beside the token, as in sam-node. */+ agent?: string;+ signal?: AbortSignal;+}++/** An open MCP session with a provider on the mesh. */+export interface MCPSession {+ client: Client;+ /** The provider's verified credential. */+ provider: VerifiedBiscuit;+ close(): Promise<void>;+}++/** The provider's credential lacks a label the caller requires (checkPeerLabels). */+export class LabelsNotSatisfiedError extends Error {+ constructor(peerId: string, missing: string[]) {+ super(`peer ${peerId} does not carry the required labels: ${missing.join(", ")}`);+ this.name = "LabelsNotSatisfiedError";+ }+}++export function requireLabels(provider: VerifiedBiscuit, required: Record<string, string> | undefined): void {+ if (!required) {+ return;+ }+ const missing = Object.entries(required)+ .filter(([k, v]) => provider.labels[k] !== v)+ .map(([k, v]) => `${k}=${v}`);+ if (missing.length > 0) {+ throw new LabelsNotSatisfiedError(provider.peerId, missing);+ }+}++/**+ * Opens /sam/mcp/1.0.0 to a connected provider for targetService ("" is the+ * provider's own catalog), verifies the provider, and returns a connected+ * MCP client. frame is this member's AuthFrame for that service.+ */+export async function openMCPSession(+ conn: Connection,+ frame: Uint8Array,+ trustedKeys: Uint8Array[],+ options: MCPSessionOptions = {},+): Promise<MCPSession> {+ const signal = options.signal ?? AbortSignal.timeout(AUTH_HANDSHAKE_TIMEOUT_MS);+ const stream = await conn.newStream(MCP_PROTOCOL, { signal, runOnLimitedConnection: true });+ let provider: VerifiedBiscuit;+ try {+ // The handshake frames are small; the MCP messages after them are not.+ const auth = lpStream(stream, { maxDataLength: MAX_AUTH_FRAME_BYTES });+ await auth.write(frame, { signal });+ const resp = decodeAuthResponse((await auth.read({ signal })).subarray());+ if (!resp.success) {+ throw new AuthRejectedError(conn.remotePeer.toString(), resp.error || "no reason given");+ }+ provider = await verifyPeerBiscuit(resp.biscuit, conn.remotePeer.toString(), trustedKeys);+ requireLabels(provider, options.requiredLabels);+ } catch (err) {+ await stream.close().catch(() => stream.abort(err instanceof Error ? err : new Error(String(err))));+ if (err instanceof BiscuitVerificationError) {+ throw new AuthRejectedError(conn.remotePeer.toString(), `provider credential rejected: ${err.message}`);+ }+ throw err;+ }++ const transport = new StreamTransport(stream);+ const client = new Client(MCP_CLIENT_INFO);+ await client.connect(transport, { signal });+ return {+ client,+ provider,+ close: async () => {+ await client.close();+ await transport.close();+ },+ };+}diff --git a/sdk/js/src/session.ts b/sdk/js/src/session.tsindex 1b313316..dc5fc2e5 100644--- a/sdk/js/src/session.ts+++ b/sdk/js/src/session.ts@@ -16,7 +16,9 @@ import type { Connection, Libp2p } from "@libp2p/interface";import { multiaddr, type Multiaddr } from "@multiformats/multiaddr";import { AUTH_HANDLER_OPTIONS, AUTH_PROTOCOL, authenticateWithPeer, authStreamHandler } from "./auth.ts";import { ROLE_ROUTER, requireRole, type VerifiedBiscuit } from "./biscuit.ts";+import { serviceCID, type ServiceType } from "./discovery.ts";import { createMeshHost, listenThroughRelay, type MeshHostOptions } from "./host.ts";+import { openMCPSession, type MCPSession, type MCPSessionOptions } from "./mcp.ts";import type { AgentMesh } from "./mesh.ts";export interface JoinOptions extends MeshHostOptions {@@ -40,6 +42,24 @@ export interface AdmittedRouter {credential: VerifiedBiscuit;}+/** A peer the DHT names as offering a service. */+export interface DiscoveredProvider {+ peerId: string;+ /** Addresses the provider advertised; may be empty when the record carried none. */+ addrs: string[];+}++/** A tool call's outcome, as MCP reports it. */+export interface ToolCallResult {+ isError: boolean;+ /** Text content blocks, in order; other block types are left out. */+ text: string[];+ /** The raw MCP result. */+ raw: unknown;+}++const DISCOVERY_TIMEOUT_MS = 5_000;+const DEFAULT_REFRESH_LEAD_MS = 60 * 60 * 1000;const DEFAULT_REFRESH_RETRY_MS = 30 * 1000;const MIN_REFRESH_DELAY_MS = 2_000;@@ -99,6 +119,78 @@ export class MeshSession {return authenticateWithPeer(conn, this.mesh.authFrame(), this.mesh.credential.controlPlaneKeys);}+ /**+ * Looks the DHT up for peers offering a service, by type and name, or by+ * type alone when name is omitted. Bounded by the timeout; the DHT walk+ * itself is what sam-node's discover does.+ */+ async discover(type: ServiceType, name?: string, options: { timeoutMs?: number; limit?: number } = {}): Promise<DiscoveredProvider[]> {+ const cid = await serviceCID(type, name);+ const signal = AbortSignal.timeout(options.timeoutMs ?? DISCOVERY_TIMEOUT_MS);+ const found = new Map<string, DiscoveredProvider>();+ try {+ for await (const provider of this.node.contentRouting.findProviders(cid, { signal })) {+ const peerId = provider.id.toString();+ if (peerId === this.peerId) {+ continue;+ }+ const entry = found.get(peerId) ?? { peerId, addrs: [] };+ for (const ma of provider.multiaddrs) {+ const text = ma.toString();+ if (!entry.addrs.includes(text)) {+ entry.addrs.push(text);+ }+ }+ found.set(peerId, entry);+ if (found.size >= (options.limit ?? 20)) {+ break;+ }+ }+ } catch (err) {+ // The lookup ended on its deadline; what was found so far is the answer.+ if (!(err instanceof Error && err.name === "TimeoutError") && !signal.aborted) {+ throw err;+ }+ }+ return [...found.values()];+ }++ /**+ * Opens an MCP session with the provider at addr for targetService+ * ("mcp://<name>", or "" for the provider's own catalog tools).+ */+ async openMCP(addr: string | Multiaddr, targetService: string, options: MCPSessionOptions = {}): Promise<MCPSession> {+ const conn = await this.connect(addr, options.signal);+ return openMCPSession(conn, this.mesh.authFrame(targetService, options.agent ?? ""), this.mesh.credential.controlPlaneKeys, options);+ }++ /** Lists the tools a provider serves for a service. */+ async listTools(addr: string | Multiaddr, targetService: string, options: MCPSessionOptions = {}): Promise<{ name: string; description?: string }[]> {+ const mcp = await this.openMCP(addr, targetService, options);+ try {+ const { tools } = await mcp.client.listTools();+ return tools.map((t) => (t.description !== undefined ? { name: t.name, description: t.description } : { name: t.name }));+ } finally {+ await mcp.close();+ }+ }++ /** Calls one tool on a provider's service. */+ async callTool(addr: string | Multiaddr, targetService: string, tool: string, args: Record<string, unknown> = {}, options: MCPSessionOptions = {}): Promise<ToolCallResult> {+ const mcp = await this.openMCP(addr, targetService, options);+ try {+ const result = await mcp.client.callTool({ name: tool, arguments: args });+ const content = Array.isArray(result.content) ? (result.content as Array<{ type: string; text?: string }>) : [];+ return {+ isError: result.isError === true,+ text: content.filter((c) => c.type === "text" && typeof c.text === "string").map((c) => c.text as string),+ raw: result,+ };+ } finally {+ await mcp.close();+ }+ }+/** Refreshes now and reschedules; exposed so a caller can force it. */async refresh(): Promise<void> {await this.mesh.refresh();diff --git a/sdk/python/README.md b/sdk/python/README.mdindex be28157b..2b7f0b04 100644--- a/sdk/python/README.md+++ b/sdk/python/README.md@@ -4,9 +4,10 @@ Native Python SDK for joining a SAM agent mesh from inside the agentprocess. It replaces the `sam-node` sidecar for agents written in Python.Import it as `agent_mesh`.-Status: **milestone 2** (identity, enrollment, credential refresh, joining-the mesh over libp2p with mutual authentication). Discovering and calling-tools are the next milestones; see [../README.md](../README.md) for the plan.+Status: **milestone 3** (identity, enrollment, credential refresh, joining+the mesh over libp2p with mutual authentication, discovering services and+calling their tools). Serving tools is the next milestone; see+[../README.md](../README.md) for the plan.## Install@@ -15,7 +16,9 @@ pip install -e 'sdk/python[test]'```Runtime dependencies are `cryptography`, `protobuf`, `biscuit-python`,-`libp2p` (py-libp2p 0.7, trio-based) and `multiaddr`. Python 3.11 or later.+`libp2p` (py-libp2p 0.7, trio-based), `multiaddr` and `mcp` (2.x). Python+3.11 or later. py-libp2p's `fastecdsa` builds from source against GMP+(`libgmp-dev` on Debian).## Use@@ -40,6 +43,13 @@ async def main():peer = await session.authenticate("/ip4/.../p2p/<router>/p2p-circuit/p2p/<peer>")print(peer.roles, peer.labels, peer.expiration)+ # Find a service in the mesh DHT and call one of its tools.+ provider = (await session.discover("mcp", "calc"))[0]+ addr = f"{session.routers[0].addr}/p2p-circuit/p2p/{provider.peer_id}"+ print(await session.list_tools(addr, "mcp://calc"))+ result = await session.call_tool(addr, "mcp://calc", "add", {"a": 1, "b": 2}, required_labels={"region": "eu"})+ print(result.text)+trio.run(main)@@ -72,6 +82,9 @@ A plaintext `http://` control plane is accepted only on loopback. Pass`agent_mesh.session`: the libp2p host, the `/sam/auth/1.0.0` handshake onboth sides, the circuit relay v2 client (reservation, dial, accept) and`MeshSession` with the refresh loop.+- `agent_mesh.discovery`, `agent_mesh.mcp_client`: the bounded+ GET_PROVIDERS walk on the mesh DHT, and MCP over `/sam/mcp/1.0.0` for+ `mcp.ClientSession`.- `agent_mesh._proto`: generated from `api/sam.proto` and`sdk/python/proto/circuit.proto` by `hack/gen-sdk-proto.sh`.diff --git a/sdk/python/pyproject.toml b/sdk/python/pyproject.tomlindex 757a710f..6c1f9769 100644--- a/sdk/python/pyproject.toml+++ b/sdk/python/pyproject.toml@@ -10,9 +10,11 @@ readme = "README.md"license = "Apache-2.0"requires-python = ">=3.11"dependencies = [+ "anyio>=4","biscuit-python>=0.4","cryptography>=42","libp2p>=0.7,<0.8",+ "mcp>=2,<3","multiaddr>=0.2",# py-libp2p requires protobuf<7; stay co-installable."protobuf>=4.25,<7",diff --git a/sdk/python/src/agent_mesh/__init__.py b/sdk/python/src/agent_mesh/__init__.pyindex b5b1f466..37c079b8 100644--- a/sdk/python/src/agent_mesh/__init__.py+++ b/sdk/python/src/agent_mesh/__init__.py@@ -29,7 +29,9 @@ from .controlplane import (verify_keys_response,)from .credential import MeshCredential, decode_auth_response, encode_auth_frame+from .discovery import DHT_PROTOCOL, DiscoveredProvider, find_providers, parse_service_target, service_keyfrom .identity import Identity, libp2p_public_key, peer_id_from_public_key, verify_ed25519+from .mcp_client import LabelsNotSatisfiedError, ToolCallResult, open_mcp_session, require_labelsfrom .mesh import AgentMeshfrom .relay import dial_through_relay, reserve_relayfrom .session import AdmittedRouter, MeshSession@@ -44,16 +46,20 @@ __all__ = ["BiscuitVerificationError","ControlPlaneClient","ControlPlaneError",+ "DHT_PROTOCOL",+ "DiscoveredProvider","Enrollment","EnrollmentRejectedError","Identity","InsecureControlPlaneURLError",+ "LabelsNotSatisfiedError","MCP_PROTOCOL","MeshCredential","MeshSession","ROLE_NODE","ROLE_ROUTER","RefreshResult",+ "ToolCallResult","VerifiedBiscuit","auth_stream_handler","authenticate_with_peer",@@ -62,12 +68,17 @@ __all__ = ["encode_auth_frame","enroll_challenge","enroll_status_challenge",+ "find_providers","libp2p_public_key",+ "open_mcp_session",+ "parse_service_target","peer_id_from_public_key","refresh_challenge","register_challenge",+ "require_labels","require_role","reserve_relay",+ "service_key","validate_control_plane_url","verify_ed25519","verify_keys_response",diff --git a/sdk/python/src/agent_mesh/conformance_join.py b/sdk/python/src/agent_mesh/conformance_join.pyindex bddbce2e..721165af 100644--- a/sdk/python/src/agent_mesh/conformance_join.py+++ b/sdk/python/src/agent_mesh/conformance_join.py@@ -19,6 +19,12 @@ then takes JSON commands on stdin, one per line, until stdin closes:{"cmd": "auth", "addr": "<multiaddr>"} connect (through a relay when theaddress says /p2p-circuit) and runthe auth handshake+ {"cmd": "discover", "type": "mcp", "name": "calc"}+ DHT lookup for a service's providers+ {"cmd": "tools", "addr": "<multiaddr>", "service": "mcp://calc"}+ list a provider's tools+ {"cmd": "call", "addr": "<multiaddr>", "service": "mcp://calc",+ "tool": "add", "args": {...}} call one tool{"cmd": "peers"} peers that authenticated to us{"cmd": "quit"} leave the mesh and exit@@ -31,6 +37,7 @@ import jsonimport loggingimport osimport sys+import tracebackimport trio@@ -49,24 +56,46 @@ def _emit(obj: dict) -> None:print(json.dumps(obj), flush=True)+def _root_cause(err: BaseException) -> BaseException:+ # trio wraps a failure in one ExceptionGroup per nursery it crossed.+ while isinstance(err, BaseExceptionGroup) and len(err.exceptions) == 1:+ err = err.exceptions[0]+ return err++async def _handle(session: MeshSession, command: dict) -> dict:cmd = command.get("cmd")- if cmd == "auth":- try:+ try:+ if cmd == "auth":verified = await session.authenticate(command["addr"])- except Exception as err: # noqa: BLE001 - the driver wants the failure, not a dead runner- return {"cmd": cmd, "ok": False, "error": f"{type(err).__name__}: {err}"}- return {- "cmd": cmd,- "ok": True,- "peer_id": verified.peer_id,- "roles": verified.roles,- "labels": verified.labels,- "expiration": int(verified.expiration.timestamp()),- }- if cmd == "peers":- return {"cmd": cmd, "authenticated_peers": sorted(session.authenticated_peers)}- return {"cmd": cmd, "ok": False, "error": f"unknown command {cmd!r}"}+ return {+ "cmd": cmd,+ "ok": True,+ "peer_id": verified.peer_id,+ "roles": verified.roles,+ "labels": verified.labels,+ "expiration": int(verified.expiration.timestamp()),+ }+ if cmd == "discover":+ providers = await session.discover(command.get("type", "mcp"), command.get("name"))+ return {"cmd": cmd, "ok": True, "providers": [{"peer_id": p.peer_id, "addrs": p.addrs} for p in providers]}+ if cmd == "tools":+ with trio.fail_after(15):+ tools = await session.list_tools(command["addr"], command.get("service", ""))+ return {"cmd": cmd, "ok": True, "tools": tools}+ if cmd == "call":+ with trio.fail_after(15):+ result = await session.call_tool(command["addr"], command.get("service", ""), command["tool"], command.get("args") or {})+ return {"cmd": cmd, "ok": True, "is_error": result.is_error, "text": result.text}+ if cmd == "peers":+ return {"cmd": cmd, "authenticated_peers": sorted(session.authenticated_peers)}+ return {"cmd": cmd, "ok": False, "error": f"unknown command {cmd!r}"}+ except BaseException as err: # noqa: BLE001 - the driver wants the failure, not a dead runner+ if isinstance(err, (KeyboardInterrupt, SystemExit, trio.Cancelled)):+ raise+ cause = _root_cause(err)+ traceback.print_exception(err, file=sys.stderr)+ return {"cmd": cmd, "ok": False, "error": f"{type(cause).__name__}: {cause}"}async def main() -> None:diff --git a/sdk/python/src/agent_mesh/discovery.py b/sdk/python/src/agent_mesh/discovery.pynew file mode 100644index 00000000..70c654c3--- /dev/null+++ b/sdk/python/src/agent_mesh/discovery.py@@ -0,0 +1,143 @@+# Copyright 2026 Google LLC+#+# Licensed under the Apache License, Version 2.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.++"""Service discovery as sam-node does it (internal/node/service.go): a provider+record in the mesh DHT under a key derived from the service. The lookup is a+bounded Kademlia GET_PROVIDERS walk spoken directly on go-libp2p-kad-dht's+protocol: py-libp2p 0.7's DHT client hardcodes the /ipfs prefix and the mesh+uses /sam."""++from __future__ import annotations++import hashlib+import logging+from dataclasses import dataclass, field+from typing import Iterable, Literal++import multiaddr+import trio+from libp2p.abc import IHost+from libp2p.custom_types import TProtocol+from libp2p.kad_dht.pb import kademlia_pb2 as kad+from libp2p.peer.id import ID+from libp2p.peer.peerinfo import PeerInfo+from libp2p.utils.varint import encode_varint_prefixed, read_varint_prefixed_bytes++logger = logging.getLogger("agent_mesh")++# go-libp2p-kad-dht with dht.ProtocolPrefix("/sam").+DHT_PROTOCOL = TProtocol("/sam/kad/1.0.0")++ServiceType = Literal["mcp", "inference", "a2a"]++_QUERY_TIMEOUT = 5.0+_MAX_ROUNDS = 3+_MAX_PEERS_PER_ROUND = 8+++@dataclass+class DiscoveredProvider:+ """A peer the DHT names as offering a service."""++ peer_id: str+ # Addresses the provider advertised; may be empty when the record carried none.+ addrs: list[str] = field(default_factory=list)+++def service_key(service_type: ServiceType, name: str | None = None) -> bytes:+ """The DHT key of a service: the sha256 multihash of "sam:service:<type>[:<name>]".+ go-libp2p-kad-dht keys provider records by the multihash, not the CID."""+ parts = ["sam:service", service_type] + ([name] if name else [])+ digest = hashlib.sha256(":".join(parts).encode()).digest()+ return b"\x12\x20" + digest+++def parse_service_target(target: str) -> tuple[str, str]:+ """Splits "mcp://calculator" into ("mcp", "calculator"); "" is the node's own catalog."""+ if target == "":+ return "", ""+ scheme, sep, name = target.partition("://")+ if not sep or scheme not in ("mcp", "inference", "a2a") or not name:+ raise ValueError(f"service target must look like mcp://<name>, got {target!r}")+ return scheme, name+++async def _get_providers(host: IHost, peer_id: ID, key: bytes) -> kad.Message | None:+ try:+ stream = await host.new_stream(peer_id, [DHT_PROTOCOL])+ except Exception as err: # noqa: BLE001 - a peer that does not serve the DHT is skipped+ logger.debug("dht: %s does not answer %s: %s", peer_id, DHT_PROTOCOL, err)+ return None+ try:+ with trio.fail_after(_QUERY_TIMEOUT):+ req = kad.Message(type=kad.Message.GET_PROVIDERS, key=key)+ await stream.write(encode_varint_prefixed(req.SerializeToString()))+ resp = kad.Message.FromString(await read_varint_prefixed_bytes(stream))+ except Exception as err: # noqa: BLE001+ logger.debug("dht: query to %s failed: %s", peer_id, err)+ return None+ finally:+ await stream.close()+ return resp if resp.type == kad.Message.GET_PROVIDERS else None+++def _peer_infos(peers: Iterable[kad.Message.Peer]) -> list[PeerInfo]:+ out = []+ for p in peers:+ try:+ addrs = [multiaddr.Multiaddr(a) for a in p.addrs]+ out.append(PeerInfo(ID(p.id), addrs))+ except Exception: # noqa: BLE001 - a malformed entry from a peer is dropped, not fatal+ continue+ return out+++async def find_providers(host: IHost, key: bytes, seeds: Iterable[ID], limit: int = 20) -> list[DiscoveredProvider]:+ """Asks the seed peers (the routers we are connected to) for providers of+ key and follows the closer peers they name for a few rounds."""+ found: dict[str, DiscoveredProvider] = {}+ asked: set[ID] = set()+ frontier: list[ID] = list(seeds)+ self_id = host.get_id()+ for _ in range(_MAX_ROUNDS):+ batch = [p for p in frontier if p not in asked and p != self_id][:_MAX_PEERS_PER_ROUND]+ if not batch:+ break+ frontier = []+ for peer_id in batch:+ asked.add(peer_id)+ resp = await _get_providers(host, peer_id, key)+ if resp is None:+ continue+ for info in _peer_infos(resp.providerPeers):+ if info.peer_id == self_id:+ continue+ entry = found.setdefault(str(info.peer_id), DiscoveredProvider(peer_id=str(info.peer_id)))+ for ma in info.addrs:+ if str(ma) not in entry.addrs:+ entry.addrs.append(str(ma))+ if len(found) >= limit:+ return list(found.values())+ for info in _peer_infos(resp.closerPeers):+ if info.peer_id in asked or info.peer_id == self_id:+ continue+ if info.peer_id not in host.get_connected_peers():+ try:+ await host.connect(info)+ except Exception: # noqa: BLE001 - unreachable closer peers are skipped+ continue+ frontier.append(info.peer_id)+ if found:+ break+ return list(found.values())diff --git a/sdk/python/src/agent_mesh/mcp_client.py b/sdk/python/src/agent_mesh/mcp_client.pynew file mode 100644index 00000000..5048aa08--- /dev/null+++ b/sdk/python/src/agent_mesh/mcp_client.py@@ -0,0 +1,161 @@+# Copyright 2026 Google LLC+#+# Licensed under the Apache License, Version 2.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.++"""MCP over a mesh stream, the client side of sam-node's /sam/mcp/1.0.0+(internal/node/gate.go): an AuthFrame naming the service, the provider's+AuthResponse, then JSON-RPC messages each with a varint length prefix."""++from __future__ import annotations++import logging+from contextlib import asynccontextmanager+from dataclasses import dataclass+from typing import AsyncIterator, Mapping, Optional, Sequence++import anyio+import mcp_types+import trio+from libp2p.abc import IHost, INetStream+from libp2p.peer.id import ID+from libp2p.utils.varint import encode_varint_prefixed, read_varint_prefixed_bytes+from mcp import ClientSession+from mcp.shared.message import SessionMessage++from ._proto import sam_pb2 as pb+from .auth import AUTH_HANDSHAKE_TIMEOUT, MAX_AUTH_FRAME_BYTES, MCP_PROTOCOL, AuthRejectedError+from .biscuit import BiscuitVerificationError, VerifiedBiscuit, verify_peer_biscuit++logger = logging.getLogger("agent_mesh")++# go-msgio's default message cap, which sam-node's StreamTransport uses.+MAX_MCP_MESSAGE_BYTES = 8 * 1024 * 1024++MCP_CLIENT_INFO = mcp_types.Implementation(name="agent-mesh-sdk", version="0.1.0")+++class LabelsNotSatisfiedError(Exception):+ """The provider's credential lacks a label the caller requires (checkPeerLabels)."""++ def __init__(self, peer_id: str, missing: Sequence[str]):+ super().__init__(f"peer {peer_id} does not carry the required labels: {', '.join(missing)}")+++def require_labels(provider: VerifiedBiscuit, required: Optional[Mapping[str, str]]) -> None:+ if not required:+ return+ missing = [f"{k}={v}" for k, v in required.items() if provider.labels.get(k) != v]+ if missing:+ raise LabelsNotSatisfiedError(provider.peer_id, missing)+++@dataclass+class ToolCallResult:+ """A tool call's outcome, as MCP reports it."""++ is_error: bool+ # Text content blocks, in order; other block types are left out.+ text: list[str]+ raw: mcp_types.CallToolResult+++async def _read_frame(stream: INetStream) -> bytes:+ data = await read_varint_prefixed_bytes(stream)+ if len(data) > MAX_MCP_MESSAGE_BYTES:+ raise ValueError(f"frame of {len(data)} bytes exceeds the {MAX_MCP_MESSAGE_BYTES} byte cap")+ return data+++@asynccontextmanager+async def open_mcp_session(+ host: IHost,+ peer_id: ID,+ frame: bytes,+ trusted_keys: Sequence[bytes],+ *,+ required_labels: Optional[Mapping[str, str]] = None,+) -> AsyncIterator[tuple[ClientSession, VerifiedBiscuit]]:+ """Opens /sam/mcp/1.0.0 to a connected provider with `frame`, this member's+ AuthFrame naming the service, verifies the provider and yields an+ initialized MCP ClientSession with the provider's credential."""+ stream = await host.new_stream(peer_id, [MCP_PROTOCOL])+ try:+ with trio.fail_after(AUTH_HANDSHAKE_TIMEOUT):+ await stream.write(encode_varint_prefixed(frame))+ data = await read_varint_prefixed_bytes(stream)+ if len(data) > MAX_AUTH_FRAME_BYTES:+ raise AuthRejectedError(str(peer_id), "oversized auth response")+ resp = pb.AuthResponse.FromString(data)+ if not resp.success:+ raise AuthRejectedError(str(peer_id), resp.error or "no reason given")+ try:+ provider = verify_peer_biscuit(resp.biscuit, str(peer_id), trusted_keys)+ except BiscuitVerificationError as err:+ raise AuthRejectedError(str(peer_id), f"provider credential rejected: {err}") from err+ require_labels(provider, required_labels)+ except trio.TooSlowError as err:+ await stream.close()+ raise AuthRejectedError(str(peer_id), "handshake timed out") from err+ except BaseException:+ await stream.close()+ raise++ # The mcp client speaks over a pair of memory streams; two tasks move+ # frames between them and the libp2p stream.+ read_writer, read_stream = anyio.create_memory_object_stream[SessionMessage | Exception](0)+ write_stream, write_reader = anyio.create_memory_object_stream[SessionMessage](0)++ async def pump_in() -> None:+ try:+ async with read_writer:+ while True:+ data = await _read_frame(stream)+ try:+ message = mcp_types.jsonrpc_message_adapter.validate_json(data, by_name=False)+ except ValueError as exc:+ await read_writer.send(exc)+ continue+ await read_writer.send(SessionMessage(message))+ except (anyio.ClosedResourceError, anyio.BrokenResourceError):+ pass+ except Exception as err: # noqa: BLE001 - the stream ended; the session sees the closed read side+ logger.debug("mcp stream from %s ended: %s", peer_id, err)++ async def pump_out() -> None:+ try:+ async with write_reader:+ async for session_message in write_reader:+ data = session_message.message.model_dump_json(by_alias=True, exclude_unset=True).encode()+ await stream.write(encode_varint_prefixed(data))+ except (anyio.ClosedResourceError, anyio.BrokenResourceError):+ pass++ async with trio.open_nursery() as nursery:+ nursery.start_soon(pump_in)+ nursery.start_soon(pump_out)+ try:+ async with ClientSession(read_stream, write_stream, client_info=MCP_CLIENT_INFO) as session:+ await session.initialize()+ yield session, provider+ finally:+ await stream.close()+ nursery.cancel_scope.cancel()+++def tool_call_result(result: mcp_types.CallToolResult) -> ToolCallResult:+ text = [c.text for c in result.content if isinstance(c, mcp_types.TextContent)]+ # mcp_types 2.x names the field is_error; 1.x named it isError.+ is_error = getattr(result, "is_error", None)+ if is_error is None:+ is_error = getattr(result, "isError", False)+ return ToolCallResult(is_error=bool(is_error), text=text, raw=result)diff --git a/sdk/python/src/agent_mesh/session.py b/sdk/python/src/agent_mesh/session.pyindex 1c1c2315..1fa9b74b 100644--- a/sdk/python/src/agent_mesh/session.py+++ b/sdk/python/src/agent_mesh/session.py@@ -19,18 +19,21 @@ import timefrom contextlib import asynccontextmanagerfrom dataclasses import dataclass, fieldfrom datetime import datetime-from typing import TYPE_CHECKING, AsyncIterator, Sequence+from typing import TYPE_CHECKING, Any, AsyncIterator, Mapping, Optional, Sequenceimport multiaddrimport triofrom libp2p.abc import IHostfrom libp2p.peer.id import IDfrom libp2p.peer.peerinfo import info_from_p2p_addr+from mcp import ClientSessionfrom ._proto import circuit_pb2 as circuitfrom .auth import AUTH_PROTOCOL, auth_stream_handler, authenticate_with_peerfrom .biscuit import ROLE_ROUTER, VerifiedBiscuit, require_role+from .discovery import DiscoveredProvider, ServiceType, find_providers, service_keyfrom .host import create_mesh_host+from .mcp_client import ToolCallResult, open_mcp_session, tool_call_resultfrom .relay import STOP_PROTOCOL, dial_through_relay, reserve_relay, split_circuit_address, stop_stream_handlerif TYPE_CHECKING:@@ -107,6 +110,50 @@ class MeshSession:peer_id = await self.connect(addr)return await authenticate_with_peer(self.host, peer_id, self.mesh.auth_frame(), self.mesh.credential.control_plane_keys)+ async def discover(self, service_type: ServiceType, name: str | None = None, limit: int = 20) -> list[DiscoveredProvider]:+ """Looks the DHT up for peers offering a service, by type and name, or by+ type alone. The routers we are connected to seed the walk."""+ seeds = [ID.from_base58(r.peer_id) for r in self.routers]+ return await find_providers(self.host, service_key(service_type, name), seeds, limit)++ def open_mcp(+ self,+ addr: str | multiaddr.Multiaddr,+ target_service: str,+ *,+ required_labels: Optional[Mapping[str, str]] = None,+ agent: str = "",+ ): # type: ignore[no-untyped-def]+ """Opens an MCP session with the provider at addr for target_service+ ("mcp://<name>", or "" for the provider's own catalog tools):++ async with session.open_mcp(addr, "mcp://calc") as (mcp, provider): ...+ """++ @asynccontextmanager+ async def opened() -> AsyncIterator[tuple[ClientSession, VerifiedBiscuit]]:+ peer_id = await self.connect(addr)+ frame = self.mesh.auth_frame(target_service, agent)+ async with open_mcp_session(self.host, peer_id, frame, self.mesh.credential.control_plane_keys, required_labels=required_labels) as opened_session:+ yield opened_session++ return opened()++ async def list_tools(self, addr: str | multiaddr.Multiaddr, target_service: str, **options: Any) -> list[str]:+ """Lists the tools a provider serves for a service."""+ async with self.open_mcp(addr, target_service, **options) as (mcp, _):+ return [t.name for t in (await mcp.list_tools()).tools]++ async def call_tool(+ self, addr: str | multiaddr.Multiaddr, target_service: str, tool: str, args: Optional[Mapping[str, Any]] = None, **options: Any+ ) -> ToolCallResult:+ """Calls one tool on a provider's service."""+ async with self.open_mcp(addr, target_service, **options) as (mcp, _):+ result = await mcp.call_tool(tool, dict(args or {}))+ if not hasattr(result, "content"):+ raise RuntimeError(f"tool {tool} answered with {type(result).__name__}, not a result")+ return tool_call_result(result) # type: ignore[arg-type]+async def _refresh_loop(mesh: "AgentMesh", lead: float, retry: float) -> None:while True:diff --git a/sdk/python/tests/__init__.py b/sdk/python/tests/__init__.pynew file mode 100644index 00000000..e69de29bdiff --git a/sdk/python/tests/test_mcp.py b/sdk/python/tests/test_mcp.pynew file mode 100644index 00000000..7a96e49f--- /dev/null+++ b/sdk/python/tests/test_mcp.py@@ -0,0 +1,218 @@+# Copyright 2026 Google LLC+#+# Licensed under the Apache License, Version 2.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.++"""A provider in one process: a py-libp2p host that serves /sam/mcp/1.0.0 the+way sam-node does (AuthFrame in, AuthResponse out, then MCP over the stream)+with the official MCP server behind it. The real sam-node is exercised by+tests/integration/sdk_mesh_test.go."""++import json+from pathlib import Path++import anyio+import biscuit_auth as ba+import multiaddr+import mcp_types+import pytest+import trio+from libp2p.peer.peerinfo import info_from_p2p_addr+from libp2p.utils.varint import encode_varint_prefixed, read_varint_prefixed_bytes+from mcp.server.mcpserver import MCPServer+from mcp.shared.message import SessionMessage++from agent_mesh._proto import sam_pb2 as pb+from agent_mesh.auth import MCP_PROTOCOL, AuthRejectedError+from agent_mesh.biscuit import verify_peer_biscuit+from agent_mesh.controlplane import ROLE_NODE+from agent_mesh.discovery import parse_service_target, service_key+from agent_mesh.identity import Identity+from agent_mesh.mcp_client import LabelsNotSatisfiedError, open_mcp_session, tool_call_result++from .test_session import CP, CP_KEY, libp2p_host++FIXTURE = json.loads((Path(__file__).resolve().parents[2] / "testdata" / "service_keys.json").read_text())+++def mint(peer_id: str, role: str, labels: dict[str, str] | None = None) -> bytes:+ code = "node({p}); expiration(2035-01-01T00:00:00Z); role({r});"+ params = {"p": peer_id, "r": role}+ for i, (k, v) in enumerate((labels or {}).items()):+ code += f" label({{k{i}}}, {{v{i}}});"+ params[f"k{i}"] = k+ params[f"v{i}"] = v+ return ba.BiscuitBuilder(code, params).build(CP.private_key).to_bytes()+++def calc_server() -> MCPServer:+ server = MCPServer("calc")++ @server.tool()+ def add(a: int, b: int) -> str:+ return str(a + b)++ return server+++def catalog_server() -> MCPServer:+ server = MCPServer("catalog")++ @server.tool()+ def list_local_services() -> str:+ return json.dumps([{"type": "mcp", "name": "calc"}])++ return server+++def mcp_stream_handler(provider_biscuit: bytes, served: list[str]):+ """sam-node's WithBiscuitAuth(HandleMCPStream) in miniature."""++ async def handle(stream) -> None:+ peer_id = str(stream.muxed_conn.peer_id)+ frame = pb.AuthFrame.FromString(await read_varint_prefixed_bytes(stream))+ try:+ verify_peer_biscuit(frame.biscuit, peer_id, [CP_KEY])+ except Exception: # noqa: BLE001 - refused callers get a closed stream+ await stream.close()+ return+ service_type, name = parse_service_target(frame.target_service)+ await stream.write(encode_varint_prefixed(pb.AuthResponse(success=True, biscuit=provider_biscuit).SerializeToString()))+ if service_type != "" and name != "calc":+ # An unknown service closes the stream after the frame, as sam-node does.+ await stream.close()+ return+ served.append(frame.target_service)+ server = catalog_server() if service_type == "" else calc_server()+ low = server._lowlevel_server # noqa: SLF001 - the only way to run it over custom streams++ read_writer, read_stream = anyio.create_memory_object_stream[SessionMessage | Exception](0)+ write_stream, write_reader = anyio.create_memory_object_stream[SessionMessage](0)++ async def pump_in():+ try:+ async with read_writer:+ while True:+ data = await read_varint_prefixed_bytes(stream)+ await read_writer.send(SessionMessage(mcp_types.jsonrpc_message_adapter.validate_json(data, by_name=False)))+ except Exception: # noqa: BLE001 - the caller went away+ pass++ async def pump_out():+ try:+ async with write_reader:+ async for message in write_reader:+ await stream.write(encode_varint_prefixed(message.message.model_dump_json(by_alias=True, exclude_unset=True).encode()))+ except Exception: # noqa: BLE001+ pass++ async with trio.open_nursery() as nursery:+ nursery.start_soon(pump_in)+ nursery.start_soon(pump_out)+ try:+ await low.run(read_stream, write_stream, low.create_initialization_options())+ except Exception: # noqa: BLE001 - the session ended with the stream+ pass+ finally:+ await stream.close()+ nursery.cancel_scope.cancel()++ return handle+++async def start_provider(nursery, labels=None):+ identity = Identity.generate()+ host = libp2p_host(identity)+ biscuit = mint(identity.peer_id, ROLE_NODE, labels)+ served: list[str] = []+ host.set_stream_handler(MCP_PROTOCOL, mcp_stream_handler(biscuit, served))+ started = trio.Event()+ addr_box = []++ async def run():+ async with host.run(listen_addrs=[multiaddr.Multiaddr("/ip4/127.0.0.1/tcp/0")]):+ addr_box.append(multiaddr.Multiaddr(f"{host.get_addrs()[0]}"))+ started.set()+ await trio.sleep_forever()++ nursery.start_soon(run)+ await started.wait()+ return host, addr_box[0], served+++def frame(biscuit: bytes, target: str) -> bytes:+ return pb.AuthFrame(biscuit=biscuit, target_service=target).SerializeToString()+++def test_service_keys_match_internal_node_service():+ for s in FIXTURE["services"]:+ assert service_key(s["type"], s["name"] or None).hex() == s["multihash"], f"{s['type']}:{s['name']}"+ assert parse_service_target("mcp://calc") == ("mcp", "calc")+ assert parse_service_target("") == ("", "")+ with pytest.raises(ValueError, match="must look like"):+ parse_service_target("calc")+++def test_tools_over_the_mesh_stream():+ async def main():+ async with trio.open_nursery() as nursery:+ provider, addr, served = await start_provider(nursery, labels={"region": "eu"})+ caller_identity = Identity.generate()+ caller = libp2p_host(caller_identity)+ caller_biscuit = mint(caller_identity.peer_id, ROLE_NODE)+ async with caller.run(listen_addrs=[]):+ await caller.connect(info_from_p2p_addr(addr))+ pid = provider.get_id()++ async with open_mcp_session(caller, pid, frame(caller_biscuit, "mcp://calc"), [CP_KEY]) as (mcp, verified):+ assert verified.peer_id == str(pid)+ assert verified.labels == {"region": "eu"}+ assert [t.name for t in (await mcp.list_tools()).tools] == ["add"]+ result = tool_call_result(await mcp.call_tool("add", {"a": 2, "b": 3}))+ assert result.text == ["5"] and not result.is_error+ assert served == ["mcp://calc"]++ # The empty target is the provider's own catalog.+ async with open_mcp_session(caller, pid, frame(caller_biscuit, ""), [CP_KEY]) as (mcp, _):+ result = tool_call_result(await mcp.call_tool("list_local_services", {}))+ assert "calc" in result.text[0]++ # Required labels are checked on the provider's credential.+ async with open_mcp_session(caller, pid, frame(caller_biscuit, "mcp://calc"), [CP_KEY], required_labels={"region": "eu"}):+ pass+ with pytest.raises(LabelsNotSatisfiedError):+ async with open_mcp_session(caller, pid, frame(caller_biscuit, "mcp://calc"), [CP_KEY], required_labels={"region": "us"}):+ pass++ # A provider whose credential the caller does not trust is rejected.+ with pytest.raises(AuthRejectedError):+ async with open_mcp_session(caller, pid, frame(caller_biscuit, "mcp://calc"), [ba.KeyPair().public_key.to_bytes()]):+ pass++ # A caller the provider cannot verify gets no session.+ forged = ba.BiscuitBuilder("node({p}); expiration(2035-01-01T00:00:00Z);", {"p": caller_identity.peer_id}).build(ba.KeyPair().private_key).to_bytes()+ with pytest.raises(Exception):+ async with open_mcp_session(caller, pid, frame(forged, "mcp://calc"), [CP_KEY]):+ pass++ # A service the provider does not have ends the session before MCP starts.+ with pytest.raises(Exception):+ with trio.fail_after(5):+ async with open_mcp_session(caller, pid, frame(caller_biscuit, "mcp://no-such-service"), [CP_KEY]):+ pass+ nursery.cancel_scope.cancel()++ async def with_timeout():+ with trio.fail_after(60):+ await main()++ trio.run(with_timeout)diff --git a/sdk/testdata/service_keys.json b/sdk/testdata/service_keys.jsonnew file mode 100644index 00000000..93be7257--- /dev/null+++ b/sdk/testdata/service_keys.json@@ -0,0 +1,9 @@+{+ "_comment": "Service discovery keys as internal/node/service.go derives them: cid = cidv1(raw, sha256(\"sam:service:<type>[:<name>]\")); go-libp2p-kad-dht keys the provider record by the multihash (hex).",+ "services": [+ { "type": "mcp", "name": "calc", "cid": "bafkreihp6rcivmw3pt27d4d6m73zeblbqueoo5cju6vcqyphqxcnmp563a", "multihash": "1220eff4448ab2db7cf5f1f07e67f79205618508e77449a7aa2861e785c4d63fbed8" },+ { "type": "mcp", "name": "", "cid": "bafkreigld2lseddb5lpjmdy7drpmgzf5nle6gam4yjwdbvximrodw4mwre", "multihash": "1220cb1e97220c61eade960f1f1c5ec364bd6ac9e3019cc26c30d6e8645c3b719689" },+ { "type": "inference", "name": "gpt", "cid": "bafkreifg2wo7urhcxh6vuv7q2tsvgo4agtjc52fbfxprc53d6ivtmlwkni", "multihash": "1220a6d59dfa44e2b9fd5a57f0d4e5533b8034d22ee8a12ddf117763f22b362eca6a" },+ { "type": "a2a", "name": "echo", "cid": "bafkreiheyiafb5vwp6njr6jctvoeji5yavj7st74vfoarsh47u462azeze", "multihash": "1220e4c20050f6b67f9a98f9229d5c44a3b80553f94ffca95c08c8fcfd39ed0324c9" }+ ]+}diff --git a/tests/integration/sdk_mesh_test.go b/tests/integration/sdk_mesh_test.goindex cb60e552..7dcc2f17 100644--- a/tests/integration/sdk_mesh_test.go+++ b/tests/integration/sdk_mesh_test.go@@ -24,6 +24,7 @@ import ("fmt""io""net"+ "net/http/httptest""os""os/exec""path/filepath"@@ -116,16 +117,19 @@ var sdkMemberLaunchers = []sdkRunner{}// TestNativeSDKsMesh runs one mesh: a control plane, a sam-router, a-// sam-node and one member per SDK, all real. It then walks the connectivity-// matrix. Every member authenticates with the router and gets a relay-// reservation, which the router grants only to admitted peers. Each SDK-// member reaches the sam-node directly and the other SDK member both-// directly and through the router, and on every path both ends verify each-// other's credential with the /sam/auth/1.0.0 handshake. The sam-node-// reaches each SDK member through the router. A Go peer that is itself-// admitted does the same and also checks that a forged credential gets no-// answer. Any SDK whose toolchain is missing is skipped, and the matrix-// shrinks to the members present.+// sam-node serving an MCP service, and one member per SDK, all real. It+// then walks the connectivity matrix. Every member authenticates with the+// router and gets a relay reservation, which the router grants only to+// admitted peers. Each SDK member reaches the sam-node directly and the+// other SDK member both directly and through the router, and on every path+// both ends verify each other's credential with the /sam/auth/1.0.0+// handshake. The sam-node reaches each SDK member through the router. A Go+// peer that is itself admitted does the same and also checks that a forged+// credential gets no answer. Then each SDK member discovers the sam-node's+// service in the DHT, lists and calls its tools over /sam/mcp/1.0.0 through+// the router, reads the node's own catalog, and is refused a service the+// node does not have. Any SDK whose toolchain is missing is skipped, and+// the matrix shrinks to the members present.func TestNativeSDKsMesh(t *testing.T) {root := repoRoot(t)oidcURL, mintToken := startCustomMockOIDC(t)@@ -156,9 +160,26 @@ func TestNativeSDKsMesh(t *testing.T) {cpPort, _ := strconv.Atoi(portStr)// The router enrolls through OIDC with group "routers" and the node with- // user mock-user; the policy binds both to their roles.+ // user mock-user. Every member holds the node role, which may reach any+ // service on any target; the SDK members get it from their bootstrap+ // token and the node from its binding.policyFile := filepath.Join(t.TempDir(), "policy.yaml")- writePolicyWithRouter(t, policyFile, fmt.Sprintf("bindings:\n - members: [\"user:mock-user\"]\n role: %s\nroles: []\n", api.RoleNode))+ policy := fmt.Sprintf(`roles:+ - name: %s+ allowed_services: []+ allowed_targets: ["*"]+ - name: %s+ allowed_services: ["*"]+ allowed_targets: ["*"]+bindings:+ - role: %s+ members: ["group:routers"]+ - role: %s+ members: ["user:mock-user"]+`, api.RoleRouter, api.RoleNode, api.RoleRouter, api.RoleNode)+ if err := os.WriteFile(policyFile, []byte(policy), 0o600); err != nil {+ t.Fatal(err)+ }injectPolicyYAML(t, cpPort, adminToken, policyFile)routerAddr, _ := startRouter(t, t.TempDir(), cpPort, mintToken, "router")@@ -170,9 +191,16 @@ func TestNativeSDKsMesh(t *testing.T) {t.Fatalf("failed to load control plane signing key: %v", err)}- // The Go node: a sam-node enrolled through OIDC, listening on loopback.+ // The Go node: a sam-node enrolled through OIDC, listening on loopback,+ // serving the MCP service "calc" from a backend this test runs.+ const serviceName = "calc"+ backend := httptest.NewServer(newBoundaryMCPHandler(t))+ t.Cleanup(backend.Close)nodeBin := buildBinary(t, "./cmd/sam-node")nodeHome := filepath.Join(t.TempDir(), "node")+ if err := os.MkdirAll(nodeHome, 0o755); err != nil {+ t.Fatal(err)+ }samNode := launchNode(t, nodeBin,append(os.Environ(), "HOME="+nodeHome, "XDG_CONFIG_HOME="+filepath.Join(nodeHome, ".config")),nodeHome, "run",@@ -180,6 +208,8 @@ func TestNativeSDKsMesh(t *testing.T) {"--jwt", mintToken(map[string]interface{}{"sub": "mock-user", "roles": []string{api.RoleNode}}),"--allow-loopback","--api-token-path", tokenPath(t, "node-token"),+ "--discovery-interval", "100ms",+ "--config", writeNodeConfig(t, nodeHome, nil, svcDecl{Type: "mcp", Name: serviceName, TargetURL: backend.URL}),"--log-level", "debug",)nodeAPI := samNode.waitForAPI(t)@@ -264,6 +294,32 @@ func TestNativeSDKsMesh(t *testing.T) {if res := m.authRaw(t, routerAddr+"/p2p-circuit/p2p/"+stranger.String()); res.OK {t.Fatalf("%s reached a peer that is not on the mesh", m.name)}++ // Services. The node advertises calc in the DHT once its backend+ // answered a probe; the member finds it there and calls it through+ // the router, the way sam-node's call_remote_tool would.+ providers := m.discoverUntil(t, "mcp", serviceName, samNode.peerID.String(), 20*time.Second)+ if len(providers) != 1 {+ t.Fatalf("%s discovered %+v for %s, want only the node", m.name, providers, serviceName)+ }+ nodeRelayAddr := routerAddr + "/p2p-circuit/p2p/" + samNode.peerID.String()+ if tools := m.tools(t, nodeRelayAddr, "mcp://"+serviceName); !contains(tools, "add") {+ t.Fatalf("%s listed %v on mcp://%s, want add", m.name, tools, serviceName)+ }+ if res := m.call(t, nodeRelayAddr, "mcp://"+serviceName, "add", map[string]any{"a": 1, "b": 2}); res.IsError || !contains(res.Text, "fake-result:add") {+ t.Fatalf("%s calling add: %+v", m.name, res)+ }+ // The node's own catalog is the empty target.+ if tools := m.tools(t, samNode.p2pAddr, ""); !contains(tools, "list_local_services") {+ t.Fatalf("%s listed %v on the node's catalog", m.name, tools)+ }+ if res := m.call(t, samNode.p2pAddr, "", "list_local_services", nil); res.IsError || !strings.Contains(strings.Join(res.Text, "\n"), serviceName) {+ t.Fatalf("%s list_local_services: %+v", m.name, res)+ }+ // A service the node does not have gets the stream closed on it.+ if res := m.callRaw(t, nodeRelayAddr, "mcp://no-such-service", "add", nil); res.OK {+ t.Fatalf("%s called a service the node does not serve: %+v", m.name, res)+ }})}@@ -388,6 +444,94 @@ func (m *sdkMember) peers(t *testing.T) []string {return res.AuthenticatedPeers}+// sdkProvider is one entry of a {"cmd":"discover"} answer.+type sdkProvider struct {+ PeerID string `json:"peer_id"`+ Addrs []string `json:"addrs"`+}++// discoverUntil repeats the DHT lookup until wantPeer is among the providers+// or the deadline passes; a node advertises a service only after probing+// its backend, on its own schedule.+func (m *sdkMember) discoverUntil(t *testing.T, serviceType, name, wantPeer string, timeout time.Duration) []sdkProvider {+ t.Helper()+ deadline := time.Now().Add(timeout)+ var last []sdkProvider+ for {+ var res struct {+ OK bool `json:"ok"`+ Error string `json:"error"`+ Providers []sdkProvider `json:"providers"`+ }+ if line := m.send(t, map[string]string{"cmd": "discover", "type": serviceType, "name": name}); json.Unmarshal(line, &res) != nil {+ t.Fatalf("%s member: discover answered %q", m.name, line)+ }+ if !res.OK {+ t.Fatalf("%s member: discover failed: %s", m.name, res.Error)+ }+ last = res.Providers+ for _, p := range res.Providers {+ if p.PeerID == wantPeer {+ return res.Providers+ }+ }+ if time.Now().After(deadline) {+ t.Fatalf("%s member never discovered %s as a provider of %s://%s; last answer %+v", m.name, wantPeer, serviceType, name, last)+ }+ time.Sleep(500 * time.Millisecond)+ }+}++func (m *sdkMember) tools(t *testing.T, addr, service string) []string {+ t.Helper()+ var res struct {+ OK bool `json:"ok"`+ Error string `json:"error"`+ Tools []string `json:"tools"`+ }+ if line := m.send(t, map[string]string{"cmd": "tools", "addr": addr, "service": service}); json.Unmarshal(line, &res) != nil {+ t.Fatalf("%s member: tools answered %q", m.name, line)+ }+ if !res.OK {+ t.Fatalf("%s member could not list tools of %q at %s: %s", m.name, service, addr, res.Error)+ }+ return res.Tools+}++// sdkCallResult answers a {"cmd":"call"} command.+type sdkCallResult struct {+ OK bool `json:"ok"`+ Error string `json:"error"`+ IsError bool `json:"is_error"`+ Text []string `json:"text"`+}++func (m *sdkMember) callRaw(t *testing.T, addr, service, tool string, args map[string]any) sdkCallResult {+ t.Helper()+ if args == nil {+ args = map[string]any{}+ }+ line, _ := json.Marshal(map[string]any{"cmd": "call", "addr": addr, "service": service, "tool": tool, "args": args})+ if _, err := m.stdin.Write(append(line, '\n')); err != nil {+ t.Fatalf("%s member: write command: %v", m.name, err)+ }+ var res sdkCallResult+ if answer := m.readLine(t, 20*time.Second); json.Unmarshal(answer, &res) != nil {+ t.Fatalf("%s member: call answered %q", m.name, answer)+ }+ return res+}++// call is callRaw that must reach the tool.+func (m *sdkMember) call(t *testing.T, addr, service, tool string, args map[string]any) sdkCallResult {+ t.Helper()+ res := m.callRaw(t, addr, service, tool, args)+ if !res.OK {+ t.Fatalf("%s member could not call %s on %q at %s: %s", m.name, tool, service, addr, res.Error)+ }+ return res+}+func (m *sdkMember) quit(t *testing.T) {t.Helper()m.send(t, map[string]string{"cmd": "quit"})