@agentxv2/sdk 0.4.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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,
@@ -2132,10 +2134,11 @@ var KNOWN_CHAINS = {
2132
2134
  contracts: {
2133
2135
  identityRegistry: "0xe94ad380d3F8d08a7590eda0C84f354a93F96e5F",
2134
2136
  subscriptionManager: "0xC15fE80b9d800abb72121F353a6ae6d6E9077E63",
2135
- paymentGateway: "0x0000000000000000000000000000000000000000",
2136
- a2aProtocolRegistry: "0x0000000000000000000000000000000000000000",
2137
- reputationRegistry: "0x0000000000000000000000000000000000000000",
2138
- configurationRegistry: "0x0000000000000000000000000000000000000000"
2137
+ paymentGateway: "0x59eA58c0089314C0fCc86A4ff646fb6dAE571C96",
2138
+ a2aProtocolRegistry: "0xEdb0022c250B38e281B3EF1418037889fC5C6092",
2139
+ reputationRegistry: "0xeb6B410ea71b8d9dA0c96f6A91d35027CE143DC9",
2140
+ configurationRegistry: "0x68DcE00e4C9077c94BC68016cD14B09557faEA6c",
2141
+ multiEndpointRegistry: "0xEB5e866f186d4B73F97aa0d70B86f2C6e2e21Cb7"
2139
2142
  },
2140
2143
  ipfsGateways: ["ipfs.io", "gateway.pinata.cloud", "dweb.link", "cf-ipfs.com"]
2141
2144
  },
@@ -2144,15 +2147,17 @@ var KNOWN_CHAINS = {
2144
2147
  // Deployer: 0x8E869A0624fF9e766Df71b5B08897d00E4d260ba
2145
2148
  // RPC: http://43.156.99.215:18545
2146
2149
  // Explorer: http://43.156.99.215:18400
2150
+ // All 6 core contracts deployed 2026-07-14
2147
2151
  19505: {
2148
2152
  chainId: 19505,
2149
2153
  contracts: {
2150
- identityRegistry: "0x0292af212Ce34bbCd95BbC69F4F8c9f7ae123902",
2151
- subscriptionManager: "0x37BA9DdfE66Aa86f920a34Ae0ae268342151E249",
2154
+ identityRegistry: "0xbf5F9db266c8c97E3334466C88597Eb758AfE212",
2155
+ subscriptionManager: "0x019AC9d945467478Dd371CDbD70cb2f325800E6B",
2152
2156
  paymentGateway: "0x0000000000000000000000000000000000000000",
2153
- a2aProtocolRegistry: "0x0000000000000000000000000000000000000000",
2154
- reputationRegistry: "0x0000000000000000000000000000000000000000",
2155
- configurationRegistry: "0x0000000000000000000000000000000000000000"
2157
+ a2aProtocolRegistry: "0x61b7E7Eed21F013e35a90FC5de5c352780ec5169",
2158
+ reputationRegistry: "0x6a18C2664E1b42063860d864b6448b824d7B843F",
2159
+ configurationRegistry: "0x07280674ccc2898Fd038A9e3C22005CA83ffD2F8",
2160
+ multiEndpointRegistry: "0xB361d04F49000013FC131D3C59C41c8486C64f8c"
2156
2161
  },
2157
2162
  ipfsGateways: ["ipfs.io", "gateway.pinata.cloud", "dweb.link", "cf-ipfs.com"],
2158
2163
  rpcUrl: "http://43.156.99.215:18545"
@@ -2210,6 +2215,294 @@ var ConfigurationRegistry = class {
2210
2215
  // src/config/index.ts
2211
2216
  var CONFIG_VERSION = "0.1.0";
2212
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
+
2213
2506
  // src/react/useAgentRunner.ts
2214
2507
  var import_react = require("react");
2215
2508
  var import_wagmi = require("wagmi");
@@ -2385,11 +2678,13 @@ function useAgentRunner(config) {
2385
2678
  AgentXError,
2386
2679
  AgentXErrorCode,
2387
2680
  CONFIG_VERSION,
2681
+ ConfigurationClient,
2388
2682
  ConfigurationRegistry,
2389
2683
  IPFSFetcher,
2390
2684
  KNOWN_CHAINS,
2391
2685
  MCPConnector,
2392
2686
  MCP_VERSION,
2687
+ MultiEndpointClient,
2393
2688
  REGISTRY_VERSION,
2394
2689
  REPUTATION_VERSION,
2395
2690
  ReputationRegistry,