@agentxv2/sdk 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # @agentxv2/sdk v0.2.0
1
+ # @agentxv2/sdk v0.5.1
2
2
 
3
- **Decentralized AI Agent Platform SDK** — E2E encryption, on-chain subscriptions, MCP tool execution.
3
+ **Decentralized AI Agent Platform SDK** — E2E encryption, on-chain subscriptions, MCP tool execution, A2A delegation.
4
4
 
5
5
  ```
6
6
  Agent = Prompt + Skills[] + MCP
@@ -82,17 +82,21 @@ const packResult = packAgentForPublish(agentPayload, publicKey, aesKey)
82
82
  ## Architecture
83
83
 
84
84
  ```
85
- ┌────────────────────────────────────────────────────┐
86
- @agentxv2/sdk
87
- ├──────────┬──────────┬──────────┬──────────────────┤
88
- │ Core │ Agent │ MCP │ React
89
- │ crypto │ Runner │ Connector│ useAgentRunner
90
- │ types │ useAgent │ callTool │
91
- ├──────────┼──────────┼──────────┼──────────────────┤
92
- │ Registry │ Subscrip │ A2A │ Reputation
93
- │ register │ subscribe│ protocolgiveFeedback
94
- │ query │ verify │
95
- └──────────┴──────────┴──────────┴──────────────────┘
85
+ ┌──────────────────────────────────────────────────────────────────┐
86
+ @agentxv2/sdk
87
+ ├──────────┬──────────┬──────────┬──────────┬──────────────────────┤
88
+ │ Core │ Agent │ MCP │ React A2A │
89
+ │ crypto │ Runner │ Connector│ hooks Agent-to-Agent │
90
+ │ types │ useAgent │ callTool │ createTask/complete │
91
+ ├──────────┼──────────┼──────────┼──────────┼──────────────────────┤
92
+ │ Registry │ Subscrip │ A2A-X402 │ Reputation│ Endpoint │
93
+ │ register │ subscribe│ auto-payfeedback MultiEndpoint │
94
+ │ query │ verify │ gate stats pickBestEndpoint │
95
+ ├──────────┼──────────┼──────────┼──────────┼──────────────────────┤
96
+ │ Config │ Config- │ │ │ │
97
+ │ store │ uration │ │ │ │
98
+ │ (kv) │ Client │ │ │ │
99
+ └──────────┴──────────┴──────────┴──────────┴──────────────────────┘
96
100
  ```
97
101
 
98
102
  ## API Reference
@@ -111,6 +115,10 @@ const packResult = packAgentForPublish(agentPayload, publicKey, aesKey)
111
115
  | `SubscriptionManager` | Subscribe (ETH/ERC20), verify, cancel, trial refund, releaseFunds |
112
116
  | `AgentX402` | Auto-subscription gate + X402 payment bridge |
113
117
  | `A2AProtocol` | Agent-to-Agent task protocol |
118
+ | `ReputationRegistry` | Give feedback + query reputation |
119
+ | `MultiEndpointClient` | Read/select agent endpoints (HTTP, WebSocket, gRPC) |
120
+ | `ConfigurationClient` | Agent on-chain key-value config store |
121
+ | `ConfigurationRegistry` | Platform-wide config registry (KV store) |
114
122
 
115
123
  ### Agent Composition (A2A Skills)
116
124
 
@@ -128,9 +136,10 @@ An Agent's Skill can delegate to **another Agent**. Set `execution.type = "a2a"`
128
136
  }
129
137
  ```
130
138
 
131
- When executed, the SDK loads Agent #42's prompt + skills, decrypts them,
132
- and returns the full sub-Agent context to the calling LLM.
133
- | `ReputationRegistry` | Give feedback + query reputation |
139
+ When executed, the SDK:
140
+ 1. Loads Agent #42's metadata from IPFS
141
+ 2. Decrypts with ECIES+AES-256-GCM
142
+ 3. Returns the sub-Agent's prompt + skills to the calling LLM
134
143
 
135
144
  ### `@agentxv2/sdk/react`
136
145
 
@@ -194,10 +203,44 @@ Auto-detected via `KNOWN_CHAINS[chainId]`. Pass `chainId` in AgentX constructor
194
203
 
195
204
  ## On-Chain Contracts
196
205
 
197
- | Contract | Sepolia | OxaChain L1 |
198
- |----------|---------|-------------|
199
- | IdentityRegistry | `0xe94a...96e5F` | `0x0292...3902` |
200
- | SubscriptionManager v3 | `0xC15f...7E63` | `0x37BA...E249` |
206
+ | # | Contract | Sepolia | OxaChain L1 |
207
+ |---|----------|---------|-------------|
208
+ | 1 | IdentityRegistry | `0xe94a...96e5F` | `0xbf5F...E212` |
209
+ | 2 | SubscriptionManager v3 | `0xC15f...7E63` | `0x019A...0E6B` |
210
+ | 3 | ReputationRegistry | `0xeb6B...3DC9` | `0x6a18...843F` |
211
+ | 4 | A2AProtocolRegistry | `0xEdb0...6092` | `0x61b7...5169` |
212
+ | 5 | ConfigurationRegistry | `0x68Dc...EA6c` | `0x0728...D2F8` |
213
+ | 6 | MultiEndpointRegistry | `0xEB5e...21Cb7` | `0xB361...f64c` |
214
+
215
+ Full addresses in `KNOWN_CHAINS` inside `config.ts`.
216
+
217
+ ## Changelog
218
+
219
+ ### v0.5.1 (2026-07-14)
220
+ - New: `MultiEndpointClient` — getActiveEndpoints, pickBestEndpoint, getBestMCPUrl
221
+ - New: `ConfigurationClient` — get, getAll, getKeys, exists
222
+ - `ChainConfig.contracts` added `multiEndpointRegistry`
223
+ - OxaChain L1 all 6 core contracts deployed
224
+
225
+ ### v0.5.0 (2026-07-14)
226
+ - OxaChain L1 full deployment: `KNOWN_CHAINS[19505]` 6 contract addresses
227
+
228
+ ### v0.4.0 (2026-07-13)
229
+ - Integration test fixes
230
+ - OxaChain L1 added to `KNOWN_CHAINS`
231
+ - IdentityRegistry + SubscriptionManager v3 deployed to OxaChain L1
232
+
233
+ ### v0.3.1 (2026-07-13)
234
+ - Fixed ESM directory import error on Node.js 22 (tsup single-file bundling)
235
+
236
+ ### v0.3.0 (2026-07-12)
237
+ - AgentX402 auto-subscription gate
238
+ - SubscriptionManager v3 (ReentrancyGuard, platformFee=250bps, trial escrow)
239
+
240
+ ### v0.2.0 (2026-07-11)
241
+ - Initial public release
242
+ - AgentRunner, MCPConnector, AgentRegistry, SubscriptionManager, ReputationRegistry
243
+ - ECIES + AES-256-GCM encryption pipeline
201
244
 
202
245
  ## License
203
246
 
package/dist/index.js CHANGED
@@ -354,11 +354,13 @@ __export(index_exports, {
354
354
  AgentXError: () => AgentXError,
355
355
  AgentXErrorCode: () => AgentXErrorCode,
356
356
  CONFIG_VERSION: () => CONFIG_VERSION,
357
+ ConfigurationClient: () => ConfigurationClient,
357
358
  ConfigurationRegistry: () => ConfigurationRegistry,
358
359
  IPFSFetcher: () => IPFSFetcher,
359
360
  KNOWN_CHAINS: () => KNOWN_CHAINS,
360
361
  MCPConnector: () => MCPConnector,
361
362
  MCP_VERSION: () => MCP_VERSION,
363
+ MultiEndpointClient: () => MultiEndpointClient,
362
364
  REGISTRY_VERSION: () => REGISTRY_VERSION,
363
365
  REPUTATION_VERSION: () => REPUTATION_VERSION,
364
366
  ReputationRegistry: () => ReputationRegistry,
@@ -2135,7 +2137,8 @@ var KNOWN_CHAINS = {
2135
2137
  paymentGateway: "0x59eA58c0089314C0fCc86A4ff646fb6dAE571C96",
2136
2138
  a2aProtocolRegistry: "0xEdb0022c250B38e281B3EF1418037889fC5C6092",
2137
2139
  reputationRegistry: "0xeb6B410ea71b8d9dA0c96f6A91d35027CE143DC9",
2138
- configurationRegistry: "0x68DcE00e4C9077c94BC68016cD14B09557faEA6c"
2140
+ configurationRegistry: "0x68DcE00e4C9077c94BC68016cD14B09557faEA6c",
2141
+ multiEndpointRegistry: "0xEB5e866f186d4B73F97aa0d70B86f2C6e2e21Cb7"
2139
2142
  },
2140
2143
  ipfsGateways: ["ipfs.io", "gateway.pinata.cloud", "dweb.link", "cf-ipfs.com"]
2141
2144
  },
@@ -2153,7 +2156,8 @@ var KNOWN_CHAINS = {
2153
2156
  paymentGateway: "0x0000000000000000000000000000000000000000",
2154
2157
  a2aProtocolRegistry: "0x61b7E7Eed21F013e35a90FC5de5c352780ec5169",
2155
2158
  reputationRegistry: "0x6a18C2664E1b42063860d864b6448b824d7B843F",
2156
- configurationRegistry: "0x07280674ccc2898Fd038A9e3C22005CA83ffD2F8"
2159
+ configurationRegistry: "0x07280674ccc2898Fd038A9e3C22005CA83ffD2F8",
2160
+ multiEndpointRegistry: "0xB361d04F49000013FC131D3C59C41c8486C64f8c"
2157
2161
  },
2158
2162
  ipfsGateways: ["ipfs.io", "gateway.pinata.cloud", "dweb.link", "cf-ipfs.com"],
2159
2163
  rpcUrl: "http://43.156.99.215:18545"
@@ -2211,6 +2215,294 @@ var ConfigurationRegistry = class {
2211
2215
  // src/config/index.ts
2212
2216
  var CONFIG_VERSION = "0.1.0";
2213
2217
 
2218
+ // src/endpoint/multi-endpoint.ts
2219
+ var ABI = [
2220
+ {
2221
+ name: "getActiveAgentEndpoints",
2222
+ type: "function",
2223
+ stateMutability: "view",
2224
+ inputs: [{ name: "agentId", type: "uint256" }],
2225
+ outputs: [{
2226
+ type: "tuple[]",
2227
+ components: [
2228
+ { name: "endpointId", type: "uint256" },
2229
+ { name: "agentId", type: "uint256" },
2230
+ { name: "name", type: "string" },
2231
+ { name: "endpointType", type: "string" },
2232
+ { name: "protocol", type: "string" },
2233
+ { name: "url", type: "string" },
2234
+ { name: "description", type: "string" },
2235
+ { name: "isActive", type: "bool" },
2236
+ { name: "createdAt", type: "uint256" },
2237
+ { name: "updatedAt", type: "uint256" },
2238
+ { name: "createdBy", type: "address" }
2239
+ ]
2240
+ }]
2241
+ },
2242
+ {
2243
+ name: "getAgentEndpoints",
2244
+ type: "function",
2245
+ stateMutability: "view",
2246
+ inputs: [{ name: "agentId", type: "uint256" }],
2247
+ outputs: [{
2248
+ type: "tuple[]",
2249
+ components: [
2250
+ { name: "endpointId", type: "uint256" },
2251
+ { name: "agentId", type: "uint256" },
2252
+ { name: "name", type: "string" },
2253
+ { name: "endpointType", type: "string" },
2254
+ { name: "protocol", type: "string" },
2255
+ { name: "url", type: "string" },
2256
+ { name: "description", type: "string" },
2257
+ { name: "isActive", type: "bool" },
2258
+ { name: "createdAt", type: "uint256" },
2259
+ { name: "updatedAt", type: "uint256" },
2260
+ { name: "createdBy", type: "address" }
2261
+ ]
2262
+ }]
2263
+ },
2264
+ {
2265
+ name: "createEndpoint",
2266
+ type: "function",
2267
+ stateMutability: "nonpayable",
2268
+ inputs: [
2269
+ { name: "agentId", type: "uint256" },
2270
+ { name: "name", type: "string" },
2271
+ { name: "endpointType", type: "string" },
2272
+ { name: "protocol", type: "string" },
2273
+ { name: "url", type: "string" },
2274
+ { name: "description", type: "string" }
2275
+ ],
2276
+ outputs: [{ name: "endpointId", type: "uint256" }]
2277
+ },
2278
+ {
2279
+ name: "getEndpoint",
2280
+ type: "function",
2281
+ stateMutability: "view",
2282
+ inputs: [{ name: "endpointId", type: "uint256" }],
2283
+ outputs: [{
2284
+ type: "tuple",
2285
+ components: [
2286
+ { name: "endpointId", type: "uint256" },
2287
+ { name: "agentId", type: "uint256" },
2288
+ { name: "name", type: "string" },
2289
+ { name: "endpointType", type: "string" },
2290
+ { name: "protocol", type: "string" },
2291
+ { name: "url", type: "string" },
2292
+ { name: "description", type: "string" },
2293
+ { name: "isActive", type: "bool" },
2294
+ { name: "createdAt", type: "uint256" },
2295
+ { name: "updatedAt", type: "uint256" },
2296
+ { name: "createdBy", type: "address" }
2297
+ ]
2298
+ }]
2299
+ },
2300
+ {
2301
+ name: "getSupportedProtocols",
2302
+ type: "function",
2303
+ stateMutability: "view",
2304
+ inputs: [],
2305
+ outputs: [{ type: "string[]" }]
2306
+ },
2307
+ {
2308
+ name: "getAgentEndpointStats",
2309
+ type: "function",
2310
+ stateMutability: "view",
2311
+ inputs: [{ name: "agentId", type: "uint256" }],
2312
+ outputs: [
2313
+ { name: "totalEndpoints", type: "uint256" },
2314
+ { name: "activeEndpoints", type: "uint256" },
2315
+ { name: "httpEndpoints", type: "uint256" },
2316
+ { name: "websocketEndpoints", type: "uint256" },
2317
+ { name: "grpcEndpoints", type: "uint256" }
2318
+ ]
2319
+ }
2320
+ ];
2321
+ var MultiEndpointClient = class {
2322
+ address;
2323
+ publicClient;
2324
+ constructor(config, publicClient) {
2325
+ this.address = config.address;
2326
+ this.publicClient = publicClient ?? null;
2327
+ }
2328
+ setPublicClient(client) {
2329
+ this.publicClient = client;
2330
+ }
2331
+ async getActiveEndpoints(agentId) {
2332
+ if (!this.publicClient) throw new Error("publicClient not set");
2333
+ return await this.publicClient.readContract({
2334
+ address: this.address,
2335
+ abi: ABI,
2336
+ functionName: "getActiveAgentEndpoints",
2337
+ args: [agentId]
2338
+ });
2339
+ }
2340
+ async getAllEndpoints(agentId) {
2341
+ if (!this.publicClient) throw new Error("publicClient not set");
2342
+ return await this.publicClient.readContract({
2343
+ address: this.address,
2344
+ abi: ABI,
2345
+ functionName: "getAgentEndpoints",
2346
+ args: [agentId]
2347
+ });
2348
+ }
2349
+ async getEndpoint(endpointId) {
2350
+ if (!this.publicClient) throw new Error("publicClient not set");
2351
+ return await this.publicClient.readContract({
2352
+ address: this.address,
2353
+ abi: ABI,
2354
+ functionName: "getEndpoint",
2355
+ args: [endpointId]
2356
+ });
2357
+ }
2358
+ async getStats(agentId) {
2359
+ if (!this.publicClient) throw new Error("publicClient not set");
2360
+ return await this.publicClient.readContract({
2361
+ address: this.address,
2362
+ abi: ABI,
2363
+ functionName: "getAgentEndpointStats",
2364
+ args: [agentId]
2365
+ });
2366
+ }
2367
+ /** Pick best active endpoint for the agent — prefer HTTP, take first active */
2368
+ async pickBestEndpoint(agentId) {
2369
+ const endpoints = await this.getActiveEndpoints(agentId);
2370
+ if (endpoints.length === 0) return null;
2371
+ const http = endpoints.find((e) => e.protocol === "HTTP");
2372
+ return http ?? endpoints[0];
2373
+ }
2374
+ /** Pick any active endpoint URL — for MCP connector */
2375
+ async getBestMCPUrl(agentId) {
2376
+ const best = await this.pickBestEndpoint(agentId);
2377
+ return best?.url ?? null;
2378
+ }
2379
+ };
2380
+
2381
+ // src/configuration/configuration.ts
2382
+ var ABI2 = [
2383
+ {
2384
+ name: "getConfig",
2385
+ type: "function",
2386
+ stateMutability: "view",
2387
+ inputs: [
2388
+ { name: "agentId", type: "uint256" },
2389
+ { name: "configKey", type: "string" }
2390
+ ],
2391
+ outputs: [{
2392
+ type: "tuple",
2393
+ components: [
2394
+ { name: "agentId", type: "uint256" },
2395
+ { name: "key", type: "string" },
2396
+ { name: "value", type: "string" },
2397
+ { name: "dataType", type: "string" },
2398
+ { name: "updatedAt", type: "uint256" },
2399
+ { name: "updatedBy", type: "address" }
2400
+ ]
2401
+ }]
2402
+ },
2403
+ {
2404
+ name: "getAgentConfigs",
2405
+ type: "function",
2406
+ stateMutability: "view",
2407
+ inputs: [{ name: "agentId", type: "uint256" }],
2408
+ outputs: [{
2409
+ type: "tuple[]",
2410
+ components: [
2411
+ { name: "agentId", type: "uint256" },
2412
+ { name: "key", type: "string" },
2413
+ { name: "value", type: "string" },
2414
+ { name: "dataType", type: "string" },
2415
+ { name: "updatedAt", type: "uint256" },
2416
+ { name: "updatedBy", type: "address" }
2417
+ ]
2418
+ }]
2419
+ },
2420
+ {
2421
+ name: "getConfigKeys",
2422
+ type: "function",
2423
+ stateMutability: "view",
2424
+ inputs: [{ name: "agentId", type: "uint256" }],
2425
+ outputs: [{ type: "string[]" }]
2426
+ },
2427
+ {
2428
+ name: "getConfigCount",
2429
+ type: "function",
2430
+ stateMutability: "view",
2431
+ inputs: [{ name: "agentId", type: "uint256" }],
2432
+ outputs: [{ type: "uint256" }]
2433
+ },
2434
+ {
2435
+ name: "configExists",
2436
+ type: "function",
2437
+ stateMutability: "view",
2438
+ inputs: [
2439
+ { name: "agentId", type: "uint256" },
2440
+ { name: "configKey", type: "string" }
2441
+ ],
2442
+ outputs: [{ type: "bool" }]
2443
+ }
2444
+ ];
2445
+ var ConfigurationClient = class {
2446
+ address;
2447
+ publicClient;
2448
+ constructor(config, publicClient) {
2449
+ this.address = config.address;
2450
+ this.publicClient = publicClient ?? null;
2451
+ }
2452
+ setPublicClient(client) {
2453
+ this.publicClient = client;
2454
+ }
2455
+ async get(agentId, key) {
2456
+ if (!this.publicClient) throw new Error("publicClient not set");
2457
+ try {
2458
+ return await this.publicClient.readContract({
2459
+ address: this.address,
2460
+ abi: ABI2,
2461
+ functionName: "getConfig",
2462
+ args: [agentId, key]
2463
+ });
2464
+ } catch {
2465
+ return null;
2466
+ }
2467
+ }
2468
+ async getAll(agentId) {
2469
+ if (!this.publicClient) throw new Error("publicClient not set");
2470
+ return await this.publicClient.readContract({
2471
+ address: this.address,
2472
+ abi: ABI2,
2473
+ functionName: "getAgentConfigs",
2474
+ args: [agentId]
2475
+ });
2476
+ }
2477
+ async getKeys(agentId) {
2478
+ if (!this.publicClient) throw new Error("publicClient not set");
2479
+ return await this.publicClient.readContract({
2480
+ address: this.address,
2481
+ abi: ABI2,
2482
+ functionName: "getConfigKeys",
2483
+ args: [agentId]
2484
+ });
2485
+ }
2486
+ async getCount(agentId) {
2487
+ if (!this.publicClient) throw new Error("publicClient not set");
2488
+ return await this.publicClient.readContract({
2489
+ address: this.address,
2490
+ abi: ABI2,
2491
+ functionName: "getConfigCount",
2492
+ args: [agentId]
2493
+ });
2494
+ }
2495
+ async exists(agentId, key) {
2496
+ if (!this.publicClient) throw new Error("publicClient not set");
2497
+ return await this.publicClient.readContract({
2498
+ address: this.address,
2499
+ abi: ABI2,
2500
+ functionName: "configExists",
2501
+ args: [agentId, key]
2502
+ });
2503
+ }
2504
+ };
2505
+
2214
2506
  // src/react/useAgentRunner.ts
2215
2507
  var import_react = require("react");
2216
2508
  var import_wagmi = require("wagmi");
@@ -2386,11 +2678,13 @@ function useAgentRunner(config) {
2386
2678
  AgentXError,
2387
2679
  AgentXErrorCode,
2388
2680
  CONFIG_VERSION,
2681
+ ConfigurationClient,
2389
2682
  ConfigurationRegistry,
2390
2683
  IPFSFetcher,
2391
2684
  KNOWN_CHAINS,
2392
2685
  MCPConnector,
2393
2686
  MCP_VERSION,
2687
+ MultiEndpointClient,
2394
2688
  REGISTRY_VERSION,
2395
2689
  REPUTATION_VERSION,
2396
2690
  ReputationRegistry,