@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 +63 -20
- package/dist/index.js +296 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +294 -2
- package/dist/index.mjs.map +1 -1
- package/dist/{react.js → react/index.js} +4 -2
- package/dist/{react.js.map → react/index.js.map} +1 -1
- package/dist/{react.mjs → react/index.mjs} +4 -2
- package/dist/{react.mjs.map → react/index.mjs.map} +1 -1
- package/package.json +1 -1
- package/dist/core.d.mts +0 -64
- package/dist/core.d.ts +0 -64
- package/dist/index-DhXVi_ub.d.ts +0 -208
- package/dist/index-eQO4iaOr.d.mts +0 -208
- package/dist/index.d.mts +0 -269
- package/dist/index.d.ts +0 -269
- package/dist/react.d.mts +0 -3
- package/dist/react.d.ts +0 -3
- package/dist/types-2aHUvS4M.d.mts +0 -297
- package/dist/types-2aHUvS4M.d.ts +0 -297
- /package/dist/{core.js → core/index.js} +0 -0
- /package/dist/{core.js.map → core/index.js.map} +0 -0
- /package/dist/{core.mjs → core/index.mjs} +0 -0
- /package/dist/{core.mjs.map → core/index.mjs.map} +0 -0
package/dist/index.d.ts
DELETED
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
import { A as AgentSubscription, a as A2AAgentCard, b as A2ATask, M as McpConnection, c as AgentReview, d as AgentReputation } from './types-2aHUvS4M.js';
|
|
2
|
-
export { e as A2ASkillExecution, f as A2ATaskStatus, g as AgentPayload, h as AgentPricing, i as AgentPrivatePayload, j as AgentPublicPayload, k as AgentSearchQuery, l as AgentSearchResult, m as AgentXConfig, n as AgentXContracts, o as AgentXError, p as AgentXErrorCode, E as EncryptedPayload, J as JSONSchema, q as JSONSchemaProperty, r as McpTransport, O as OnChainAgentMetadata, P as PackResult, s as PricingType, R as RegisteredAgent, S as SkillDef, t as SkillExecutionMode, u as SkillExecutionRemote, v as SubscriptionRequired, w as SubscriptionStatus, U as UnpackResult } from './types-2aHUvS4M.js';
|
|
3
|
-
export { aesDecrypt, aesEncrypt, decryptPayload, eciesDecrypt, eciesEncrypt, encryptPayload, generateAesKey, generateKeyPair, getPublicKey, packAgentForPublish, randomBytes, unpackAgent } from './core/index.js';
|
|
4
|
-
export { A as A2ASkillResult, a as AgentRunContext, b as AgentRunner, c as AgentRunnerConfig, C as ChainConfig, d as ConfigRegistryOpts, e as ConfigurationRegistry, I as IPFSFetcher, f as IPFSFetcherConfig, K as KNOWN_CHAINS, O as OnChainReader, R as RunnableSkill, U as UseAgentRunnerConfig, g as UseAgentRunnerResult, W as WalletSigner, h as defaultIPFSFetcher, u as useAgentRunner } from './index-DhXVi_ub.js';
|
|
5
|
-
import { Address, PublicClient, WalletClient, Hash } from 'viem';
|
|
6
|
-
export { bytesToHex, hexToBytes } from '@noble/ciphers/utils.js';
|
|
7
|
-
|
|
8
|
-
interface AgentRegistryConfig {
|
|
9
|
-
/** IdentityRegistry contract address */
|
|
10
|
-
contractAddress: Address;
|
|
11
|
-
/** viem PublicClient for read calls */
|
|
12
|
-
publicClient: PublicClient;
|
|
13
|
-
/** viem WalletClient for write calls */
|
|
14
|
-
walletClient: WalletClient;
|
|
15
|
-
}
|
|
16
|
-
declare class AgentRegistry {
|
|
17
|
-
private address;
|
|
18
|
-
private publicClient;
|
|
19
|
-
private walletClient;
|
|
20
|
-
constructor(config: AgentRegistryConfig);
|
|
21
|
-
/**
|
|
22
|
-
* Register a new Agent NFT on-chain.
|
|
23
|
-
*
|
|
24
|
-
* @param tokenURI IPFS URI of the public metadata (ipfs://...)
|
|
25
|
-
* @param metadata Key-value metadata (encryptedPayloadCid, eciesEncryptedKey, etc.)
|
|
26
|
-
* @param valueWei Optional: native currency to send with registration
|
|
27
|
-
* @returns { agentId: number, txHash: Hash }
|
|
28
|
-
*/
|
|
29
|
-
register(tokenURI: string, metadata: {
|
|
30
|
-
key: string;
|
|
31
|
-
value: string;
|
|
32
|
-
}[], valueWei?: bigint): Promise<{
|
|
33
|
-
agentId: number;
|
|
34
|
-
txHash: Hash;
|
|
35
|
-
}>;
|
|
36
|
-
/**
|
|
37
|
-
* Simple register — just a tokenURI, no extra metadata.
|
|
38
|
-
*/
|
|
39
|
-
registerSimple(tokenURI: string, valueWei?: bigint): Promise<{
|
|
40
|
-
agentId: number;
|
|
41
|
-
txHash: Hash;
|
|
42
|
-
}>;
|
|
43
|
-
/** Get all agent IDs owned by an address. */
|
|
44
|
-
getAgentsByOwner(owner: Address): Promise<number[]>;
|
|
45
|
-
/** Get the current total agent count. */
|
|
46
|
-
getCurrentAgentId(): Promise<number>;
|
|
47
|
-
/** Check if an agent exists. */
|
|
48
|
-
agentExists(agentId: number): Promise<boolean>;
|
|
49
|
-
/** Get the tokenURI for an agent. */
|
|
50
|
-
tokenURI(agentId: number): Promise<string>;
|
|
51
|
-
/** Get all metadata attributes for an agent as key-value pairs. */
|
|
52
|
-
getAttributes(agentId: number): Promise<Record<string, string>>;
|
|
53
|
-
/** Extract tokenId from the Transfer event in the receipt. */
|
|
54
|
-
private _parseAgentIdFromReceipt;
|
|
55
|
-
}
|
|
56
|
-
/** Extract IPFS CID from an ipfs:// URI. */
|
|
57
|
-
declare function cidFromURI(uri: string): string;
|
|
58
|
-
|
|
59
|
-
declare const REGISTRY_VERSION = "0.1.0";
|
|
60
|
-
|
|
61
|
-
interface SubscriptionConfig {
|
|
62
|
-
contractAddress: Address;
|
|
63
|
-
publicClient: PublicClient;
|
|
64
|
-
walletClient: WalletClient;
|
|
65
|
-
}
|
|
66
|
-
interface PlanDetail {
|
|
67
|
-
planId: number;
|
|
68
|
-
agentId: number;
|
|
69
|
-
creator: Address;
|
|
70
|
-
price: bigint;
|
|
71
|
-
period: string;
|
|
72
|
-
active: boolean;
|
|
73
|
-
payToken: Address;
|
|
74
|
-
trialDays: number;
|
|
75
|
-
}
|
|
76
|
-
interface SubscriptionDetail {
|
|
77
|
-
subscriptionId: number;
|
|
78
|
-
subscriber: Address;
|
|
79
|
-
agentId: number;
|
|
80
|
-
status: number;
|
|
81
|
-
startedAt: number;
|
|
82
|
-
expiresAt: number;
|
|
83
|
-
period: string;
|
|
84
|
-
payToken: Address;
|
|
85
|
-
amountPaid: bigint;
|
|
86
|
-
trialActive: boolean;
|
|
87
|
-
trialEndsAt: number;
|
|
88
|
-
fundsReleased: boolean;
|
|
89
|
-
}
|
|
90
|
-
declare class SubscriptionManager {
|
|
91
|
-
private address;
|
|
92
|
-
private publicClient;
|
|
93
|
-
private walletClient;
|
|
94
|
-
constructor(config: SubscriptionConfig);
|
|
95
|
-
/** Get current platform fee in basis points (e.g. 250 = 2.5%). */
|
|
96
|
-
getPlatformFeeBps(): Promise<number>;
|
|
97
|
-
/** Check if a token is whitelisted for payments. */
|
|
98
|
-
isTokenWhitelisted(token: Address): Promise<boolean>;
|
|
99
|
-
/** Get full plan details with v2 fields. */
|
|
100
|
-
getPlan(planId: number): Promise<PlanDetail>;
|
|
101
|
-
/**
|
|
102
|
-
* Subscribe to a plan.
|
|
103
|
-
* For ETH plans: pass valueWei = plan.price.
|
|
104
|
-
* For ERC20 plans: auto-detects from plan.payToken, calls approve + subscribe.
|
|
105
|
-
* User must have approved this contract for plan.price tokens.
|
|
106
|
-
*/
|
|
107
|
-
subscribe(planId: number, opts?: {
|
|
108
|
-
valueWei?: bigint;
|
|
109
|
-
approveTokenFirst?: boolean;
|
|
110
|
-
}): Promise<{
|
|
111
|
-
subscriptionId: number;
|
|
112
|
-
txHash: Hash;
|
|
113
|
-
}>;
|
|
114
|
-
/** Release escrowed funds to creator after trial window ends. */
|
|
115
|
-
releaseFunds(subscriptionId: number): Promise<Hash>;
|
|
116
|
-
/** Cancel subscription (trial refund if within window). */
|
|
117
|
-
cancel(subscriptionId: number): Promise<Hash>;
|
|
118
|
-
hasActiveSubscription(subscriber: Address, agentId: number): Promise<boolean>;
|
|
119
|
-
getSubscription(subscriber: Address, agentId: number): Promise<AgentSubscription | null>;
|
|
120
|
-
/** Get full subscription detail with v2 fields (trial, payToken, fundsReleased). */
|
|
121
|
-
getSubscriptionDetail(subscriptionId: number): Promise<SubscriptionDetail>;
|
|
122
|
-
getUserSubscriptions(user: Address): Promise<number[]>;
|
|
123
|
-
}
|
|
124
|
-
declare function guardSubscription(manager: SubscriptionManager, user: Address, agentId: number): Promise<AgentSubscription>;
|
|
125
|
-
|
|
126
|
-
interface AgentX402Config {
|
|
127
|
-
subscriptionManagerAddress: Address;
|
|
128
|
-
publicClient: PublicClient;
|
|
129
|
-
walletClient: WalletClient;
|
|
130
|
-
}
|
|
131
|
-
declare class AgentX402 {
|
|
132
|
-
private config;
|
|
133
|
-
constructor(config: AgentX402Config);
|
|
134
|
-
/**
|
|
135
|
-
* Require active subscription — or throw with auto-pay info.
|
|
136
|
-
*
|
|
137
|
-
* Usage:
|
|
138
|
-
* await x402.requireSubscription(agentId, address, { planIds: [1,2,3] })
|
|
139
|
-
*
|
|
140
|
-
* On success, returns silently.
|
|
141
|
-
* On failure, throws AgentXError with paymentInfo populated
|
|
142
|
-
* so the caller can auto-pay via wallet/X402.
|
|
143
|
-
*/
|
|
144
|
-
requireSubscription(agentId: number, address: Address, opts?: {
|
|
145
|
-
planIds?: number[];
|
|
146
|
-
}): Promise<void>;
|
|
147
|
-
/**
|
|
148
|
-
* Subscribe to a plan + wait for receipt.
|
|
149
|
-
* Returns subscriptionId from the Subscribed event.
|
|
150
|
-
*
|
|
151
|
-
* NOTE: For ERC20 plans, the caller must approve token spending
|
|
152
|
-
* BEFORE calling this method. Use X402 SDK or wagmi's useWriteContract
|
|
153
|
-
* for the approve step.
|
|
154
|
-
*/
|
|
155
|
-
subscribeAndWait(planId: number, price: bigint, payToken: Address): Promise<number>;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
declare const SUBSCRIPTION_VERSION = "0.2.0";
|
|
159
|
-
|
|
160
|
-
interface A2AConfig {
|
|
161
|
-
contractAddress: Address;
|
|
162
|
-
publicClient: PublicClient;
|
|
163
|
-
walletClient: WalletClient;
|
|
164
|
-
}
|
|
165
|
-
declare class A2AProtocol {
|
|
166
|
-
private address;
|
|
167
|
-
private publicClient;
|
|
168
|
-
private walletClient;
|
|
169
|
-
constructor(config: A2AConfig);
|
|
170
|
-
private get account();
|
|
171
|
-
createAgentCard(agentId: number, card: {
|
|
172
|
-
name: string;
|
|
173
|
-
description: string;
|
|
174
|
-
version: string;
|
|
175
|
-
capabilities: string[];
|
|
176
|
-
supportedTasks: string[];
|
|
177
|
-
commProtocol?: string;
|
|
178
|
-
authMethod?: string;
|
|
179
|
-
cardURI?: string;
|
|
180
|
-
}): Promise<{
|
|
181
|
-
cardId: number;
|
|
182
|
-
txHash: Hash;
|
|
183
|
-
}>;
|
|
184
|
-
getAgentCard(agentId: number): Promise<A2AAgentCard | null>;
|
|
185
|
-
createTask(agentId: number, taskType: string, input: Record<string, unknown>): Promise<{
|
|
186
|
-
taskId: number;
|
|
187
|
-
txHash: Hash;
|
|
188
|
-
}>;
|
|
189
|
-
completeTask(taskId: number, output: unknown): Promise<Hash>;
|
|
190
|
-
getTask(taskId: number): Promise<A2ATask | null>;
|
|
191
|
-
getUserTasks(user: Address): Promise<number[]>;
|
|
192
|
-
private _parseUintFromLog;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
declare const A2A_VERSION = "0.1.0";
|
|
196
|
-
|
|
197
|
-
interface MCPTool {
|
|
198
|
-
name: string;
|
|
199
|
-
description?: string;
|
|
200
|
-
inputSchema: Record<string, unknown>;
|
|
201
|
-
}
|
|
202
|
-
interface MCPCallResult {
|
|
203
|
-
content: {
|
|
204
|
-
type: string;
|
|
205
|
-
text?: string;
|
|
206
|
-
data?: string;
|
|
207
|
-
}[];
|
|
208
|
-
isError?: boolean;
|
|
209
|
-
}
|
|
210
|
-
interface MCPConnectorConfig {
|
|
211
|
-
/** MCP server base URL */
|
|
212
|
-
url: string;
|
|
213
|
-
/** Transport type */
|
|
214
|
-
transport?: 'http' | 'sse';
|
|
215
|
-
/** Auth header value (e.g. "Bearer xxx") */
|
|
216
|
-
authHeader?: string;
|
|
217
|
-
/** Request timeout in ms (default: 30_000) */
|
|
218
|
-
timeoutMs?: number;
|
|
219
|
-
/** Optional: subscriber address for subscription-gated MCP servers */
|
|
220
|
-
subscriberAddress?: string;
|
|
221
|
-
/** Optional: wallet signature for authentication */
|
|
222
|
-
signature?: string;
|
|
223
|
-
timestamp?: number;
|
|
224
|
-
}
|
|
225
|
-
declare class MCPConnector {
|
|
226
|
-
private config;
|
|
227
|
-
constructor(config: MCPConnectorConfig);
|
|
228
|
-
/** Create from an Agent's McpConnection. */
|
|
229
|
-
static fromAgent(mcp: McpConnection, opts?: Partial<MCPConnectorConfig>): MCPConnector;
|
|
230
|
-
/** List available tools from the MCP server. */
|
|
231
|
-
listTools(): Promise<MCPTool[]>;
|
|
232
|
-
/** Call a tool on the MCP server. */
|
|
233
|
-
callTool(name: string, args?: Record<string, unknown>): Promise<MCPCallResult>;
|
|
234
|
-
listResources(): Promise<unknown[]>;
|
|
235
|
-
readResource(uri: string): Promise<unknown>;
|
|
236
|
-
private _request;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
declare const MCP_VERSION = "0.1.0";
|
|
240
|
-
|
|
241
|
-
interface ReputationConfig {
|
|
242
|
-
contractAddress: Address;
|
|
243
|
-
publicClient: PublicClient;
|
|
244
|
-
walletClient: WalletClient;
|
|
245
|
-
}
|
|
246
|
-
declare class ReputationRegistry {
|
|
247
|
-
private address;
|
|
248
|
-
private publicClient;
|
|
249
|
-
private walletClient;
|
|
250
|
-
constructor(config: ReputationConfig);
|
|
251
|
-
private get account();
|
|
252
|
-
/** Submit a rating (1-5) with optional comment. */
|
|
253
|
-
rate(agentId: number, rating: number, comment?: string): Promise<Hash>;
|
|
254
|
-
/** Get average rating and total count. */
|
|
255
|
-
getRating(agentId: number): Promise<{
|
|
256
|
-
averageRating: number;
|
|
257
|
-
totalRatings: number;
|
|
258
|
-
}>;
|
|
259
|
-
/** Get all reviews for an agent. */
|
|
260
|
-
getReviews(agentId: number): Promise<AgentReview[]>;
|
|
261
|
-
/** Get full reputation summary. */
|
|
262
|
-
getReputation(agentId: number): Promise<AgentReputation>;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
declare const REPUTATION_VERSION = "0.1.0";
|
|
266
|
-
|
|
267
|
-
declare const CONFIG_VERSION = "0.1.0";
|
|
268
|
-
|
|
269
|
-
export { A2AAgentCard, type A2AConfig, A2AProtocol, A2ATask, A2A_VERSION, AgentRegistry, type AgentRegistryConfig, AgentReputation, AgentReview, AgentSubscription, AgentX402, type AgentX402Config, CONFIG_VERSION, type MCPCallResult, MCPConnector, type MCPConnectorConfig, type MCPTool, MCP_VERSION, McpConnection, type PlanDetail, REGISTRY_VERSION, REPUTATION_VERSION, type ReputationConfig, ReputationRegistry, SUBSCRIPTION_VERSION, type SubscriptionConfig, type SubscriptionDetail, SubscriptionManager, cidFromURI, guardSubscription };
|
package/dist/react.d.mts
DELETED
package/dist/react.d.ts
DELETED
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
interface JSONSchema {
|
|
2
|
-
type: 'object' | 'array' | 'string' | 'number' | 'boolean' | 'integer' | 'null';
|
|
3
|
-
properties?: Record<string, JSONSchemaProperty>;
|
|
4
|
-
required?: string[];
|
|
5
|
-
description?: string;
|
|
6
|
-
items?: JSONSchema;
|
|
7
|
-
enum?: (string | number | boolean | null)[];
|
|
8
|
-
}
|
|
9
|
-
interface JSONSchemaProperty {
|
|
10
|
-
type?: JSONSchema['type'] | JSONSchema['type'][];
|
|
11
|
-
description?: string;
|
|
12
|
-
properties?: Record<string, JSONSchemaProperty>;
|
|
13
|
-
required?: string[];
|
|
14
|
-
items?: JSONSchema;
|
|
15
|
-
enum?: (string | number | boolean | null)[];
|
|
16
|
-
format?: string;
|
|
17
|
-
default?: unknown;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* A single skill module that an Agent exposes.
|
|
21
|
-
* `inputSchema` and `outputSchema` follow MCP Tool JSON Schema conventions.
|
|
22
|
-
*/
|
|
23
|
-
interface SkillDef {
|
|
24
|
-
/** Unique skill name (e.g. "solidity_audit") */
|
|
25
|
-
name: string;
|
|
26
|
-
/** Human-readable description shown in the marketplace */
|
|
27
|
-
description: string;
|
|
28
|
-
/** Semantic version of this skill */
|
|
29
|
-
version: string;
|
|
30
|
-
/** JSON Schema for the tool's input parameters */
|
|
31
|
-
inputSchema: JSONSchema;
|
|
32
|
-
/** JSON Schema for the tool's output return value */
|
|
33
|
-
outputSchema?: JSONSchema;
|
|
34
|
-
/**
|
|
35
|
-
* Execution mode.
|
|
36
|
-
* - undefined / "open": Source is in the encrypted payload, runs locally.
|
|
37
|
-
* - { type: "mcp", toolName: "..." }: Source lives on the publisher's
|
|
38
|
-
* MCP server. Subscriber only gets Schema + remote execution endpoint.
|
|
39
|
-
* MCP server verifies on-chain subscription on every call.
|
|
40
|
-
* - { type: "a2a", targetAgentId: 42 }: Delegates to another AgentX Agent.
|
|
41
|
-
* The caller's AgentRunner loads + decrypts the target Agent, injects
|
|
42
|
-
* its prompt into the LLM context, and exposes its skills as callable
|
|
43
|
-
* tools. This is the core Agent Composition primitive.
|
|
44
|
-
*/
|
|
45
|
-
execution?: SkillExecutionRemote | A2ASkillExecution;
|
|
46
|
-
}
|
|
47
|
-
/** Where the skill code actually runs. */
|
|
48
|
-
type SkillExecutionMode = 'open' | 'mcp' | 'a2a';
|
|
49
|
-
interface SkillExecutionRemote {
|
|
50
|
-
type: 'mcp';
|
|
51
|
-
/** MCP tool name on the publisher's server (e.g. "run_strategy_abc123") */
|
|
52
|
-
toolName: string;
|
|
53
|
-
/** Optional: explicit MCP endpoint override */
|
|
54
|
-
endpoint?: string;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* A2A Skill Execution — delegate to another AgentX Agent.
|
|
58
|
-
*
|
|
59
|
-
* Example: A "trading" Agent has a skill:
|
|
60
|
-
* execution: { type: "a2a", targetAgentId: 42 }
|
|
61
|
-
* → When LLM calls this skill, AgentRunner loads Agent #42,
|
|
62
|
-
* decrypts its prompt+skills, and the sub-Agent runs in the
|
|
63
|
-
* same LLM conversation with its own system prompt.
|
|
64
|
-
*/
|
|
65
|
-
interface A2ASkillExecution {
|
|
66
|
-
type: 'a2a';
|
|
67
|
-
/** On-chain Agent ID to delegate to */
|
|
68
|
-
targetAgentId: number;
|
|
69
|
-
/** Optional: restrict which of the target Agent's skills are exposed */
|
|
70
|
-
skillFilter?: string[];
|
|
71
|
-
/** Optional: custom system prompt override for the sub-Agent */
|
|
72
|
-
promptOverride?: string;
|
|
73
|
-
}
|
|
74
|
-
type McpTransport = 'http' | 'sse' | 'stdio';
|
|
75
|
-
interface McpConnection {
|
|
76
|
-
/** Transport type */
|
|
77
|
-
type: McpTransport;
|
|
78
|
-
/** MCP server URL (required for http/sse) */
|
|
79
|
-
url?: string;
|
|
80
|
-
/** Optional: limit which tools the Agent exposes to users */
|
|
81
|
-
toolFilter?: string[];
|
|
82
|
-
/** Optional: MCP server authentication header / key */
|
|
83
|
-
authHeader?: string;
|
|
84
|
-
}
|
|
85
|
-
type PricingType = 'subscription' | 'pay_per_use' | 'free';
|
|
86
|
-
interface AgentPricing {
|
|
87
|
-
type: PricingType;
|
|
88
|
-
/** Amount in native unit (e.g. "0.01" for 0.01 ETH) */
|
|
89
|
-
amount: string;
|
|
90
|
-
/** ERC20 token address, or empty for native currency */
|
|
91
|
-
currency: string;
|
|
92
|
-
/** Billing period for subscriptions (e.g. "month", "year", "day") */
|
|
93
|
-
period?: string;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* The complete Agent definition.
|
|
97
|
-
*
|
|
98
|
-
* - Fields above "--- private payload ---" are public (IPFS publicPayloadCid).
|
|
99
|
-
* - Fields below are encrypted with AES-256-GCM and stored at encryptedPayloadCid.
|
|
100
|
-
*/
|
|
101
|
-
interface AgentPayload {
|
|
102
|
-
name: string;
|
|
103
|
-
description: string;
|
|
104
|
-
image?: string;
|
|
105
|
-
version: string;
|
|
106
|
-
tags: string[];
|
|
107
|
-
capabilities: string[];
|
|
108
|
-
supportedTasks: string[];
|
|
109
|
-
communicationProtocol: 'mcp' | 'a2a';
|
|
110
|
-
authenticationMethod: 'ecdsa';
|
|
111
|
-
pricing: AgentPricing;
|
|
112
|
-
prompt: string;
|
|
113
|
-
skills: SkillDef[];
|
|
114
|
-
mcp: McpConnection;
|
|
115
|
-
}
|
|
116
|
-
/** Subset of AgentPayload that is publicly visible */
|
|
117
|
-
type AgentPublicPayload = Omit<AgentPayload, 'prompt' | 'skills' | 'mcp'>;
|
|
118
|
-
/** Fields that must be encrypted before IPFS upload */
|
|
119
|
-
type AgentPrivatePayload = Pick<AgentPayload, 'prompt' | 'skills' | 'mcp'>;
|
|
120
|
-
interface EncryptedPayload {
|
|
121
|
-
encrypted: true;
|
|
122
|
-
algorithm: 'AES-256-GCM';
|
|
123
|
-
/** base64(iv + ciphertext + authTag) */
|
|
124
|
-
data: string;
|
|
125
|
-
}
|
|
126
|
-
interface OnChainAgentMetadata {
|
|
127
|
-
tokenURI: string;
|
|
128
|
-
attributes: {
|
|
129
|
-
name: string;
|
|
130
|
-
description: string;
|
|
131
|
-
/** CID of the AES-256-GCM encrypted payload on IPFS */
|
|
132
|
-
encryptedPayloadCid: string;
|
|
133
|
-
/** ECIES-encrypted AES key (secp256k1, hex string) */
|
|
134
|
-
eciesEncryptedKey: string;
|
|
135
|
-
/** CID of the public metadata on IPFS */
|
|
136
|
-
publicPayloadCid: string;
|
|
137
|
-
capabilities: string[];
|
|
138
|
-
skills: string[];
|
|
139
|
-
mcpEndpoint: string;
|
|
140
|
-
version: string;
|
|
141
|
-
tags: string[];
|
|
142
|
-
pricingType: PricingType;
|
|
143
|
-
pricingAmount: string;
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
interface RegisteredAgent {
|
|
147
|
-
/** ERC-721 token ID (= agentId) */
|
|
148
|
-
agentId: number;
|
|
149
|
-
/** Owner wallet address */
|
|
150
|
-
owner: string;
|
|
151
|
-
/** Creator wallet address */
|
|
152
|
-
creator: string;
|
|
153
|
-
/** Full on-chain metadata */
|
|
154
|
-
metadata: OnChainAgentMetadata;
|
|
155
|
-
/** Block number where agent was registered */
|
|
156
|
-
registeredAt: number;
|
|
157
|
-
/** IPFS CID of the full public payload (resolved from tokenURI) */
|
|
158
|
-
publicPayloadCid: string;
|
|
159
|
-
}
|
|
160
|
-
interface AgentSearchQuery {
|
|
161
|
-
keyword?: string;
|
|
162
|
-
capabilities?: string[];
|
|
163
|
-
tags?: string[];
|
|
164
|
-
pricingType?: PricingType;
|
|
165
|
-
maxPrice?: string;
|
|
166
|
-
owner?: string;
|
|
167
|
-
sortBy?: 'latest' | 'reputation' | 'price_asc' | 'price_desc';
|
|
168
|
-
page?: number;
|
|
169
|
-
pageSize?: number;
|
|
170
|
-
}
|
|
171
|
-
interface AgentSearchResult {
|
|
172
|
-
agents: RegisteredAgent[];
|
|
173
|
-
total: number;
|
|
174
|
-
page: number;
|
|
175
|
-
pageSize: number;
|
|
176
|
-
}
|
|
177
|
-
type SubscriptionStatus = 'active' | 'expired' | 'cancelled' | 'pending';
|
|
178
|
-
interface AgentSubscription {
|
|
179
|
-
subscriptionId: number;
|
|
180
|
-
subscriber: string;
|
|
181
|
-
agentId: number;
|
|
182
|
-
status: SubscriptionStatus;
|
|
183
|
-
startedAt: number;
|
|
184
|
-
expiresAt: number;
|
|
185
|
-
period: string;
|
|
186
|
-
}
|
|
187
|
-
type A2ATaskStatus = 'created' | 'accepted' | 'in_progress' | 'completed' | 'failed';
|
|
188
|
-
interface A2AAgentCard {
|
|
189
|
-
agentId: number;
|
|
190
|
-
name: string;
|
|
191
|
-
capabilities: string[];
|
|
192
|
-
supportedTasks: string[];
|
|
193
|
-
/** MCP endpoint URL for direct agent-to-agent communication */
|
|
194
|
-
endpoint: string;
|
|
195
|
-
/** Public key for ECDSA authentication */
|
|
196
|
-
publicKey: string;
|
|
197
|
-
}
|
|
198
|
-
interface A2ATask {
|
|
199
|
-
taskId: number;
|
|
200
|
-
/** Agent that created the task */
|
|
201
|
-
creator: string;
|
|
202
|
-
/** Target agent to execute the task */
|
|
203
|
-
targetAgentId: number;
|
|
204
|
-
/** Task type (must be in target's supportedTasks) */
|
|
205
|
-
taskType: string;
|
|
206
|
-
/** JSON input payload */
|
|
207
|
-
input: string;
|
|
208
|
-
status: A2ATaskStatus;
|
|
209
|
-
result?: string;
|
|
210
|
-
createdAt: number;
|
|
211
|
-
completedAt?: number;
|
|
212
|
-
}
|
|
213
|
-
interface AgentReputation {
|
|
214
|
-
agentId: number;
|
|
215
|
-
averageRating: number;
|
|
216
|
-
totalRatings: number;
|
|
217
|
-
reviews: AgentReview[];
|
|
218
|
-
}
|
|
219
|
-
interface AgentReview {
|
|
220
|
-
reviewer: string;
|
|
221
|
-
rating: number;
|
|
222
|
-
comment: string;
|
|
223
|
-
timestamp: number;
|
|
224
|
-
}
|
|
225
|
-
interface AgentXConfig {
|
|
226
|
-
/** Chain ID (e.g. 11155111 for Sepolia) */
|
|
227
|
-
chainId: number;
|
|
228
|
-
/** RPC endpoint override (uses viem's default if omitted) */
|
|
229
|
-
rpcUrl?: string;
|
|
230
|
-
/** Contract addresses for the current chain */
|
|
231
|
-
contracts: AgentXContracts;
|
|
232
|
-
/** IPFS gateway URLs (ordered by priority) */
|
|
233
|
-
ipfsGateways: string[];
|
|
234
|
-
/** Default IPFS pinning service */
|
|
235
|
-
pinningService?: 'pinata';
|
|
236
|
-
pinataJwt?: string;
|
|
237
|
-
}
|
|
238
|
-
interface AgentXContracts {
|
|
239
|
-
identityRegistry: `0x${string}`;
|
|
240
|
-
subscriptionManager: `0x${string}`;
|
|
241
|
-
paymentGateway: `0x${string}`;
|
|
242
|
-
a2aProtocolRegistry: `0x${string}`;
|
|
243
|
-
reputationRegistry: `0x${string}`;
|
|
244
|
-
configurationRegistry: `0x${string}`;
|
|
245
|
-
}
|
|
246
|
-
interface PackResult {
|
|
247
|
-
/** CID of AES-256-GCM encrypted payload on IPFS */
|
|
248
|
-
encryptedCid: string;
|
|
249
|
-
/** CID of public metadata on IPFS */
|
|
250
|
-
publicCid: string;
|
|
251
|
-
/** Raw AES key (hex) — DO NOT share or upload this */
|
|
252
|
-
aesKeyHex: string;
|
|
253
|
-
/** ECIES-encrypted AES key (hex), safe to store on-chain */
|
|
254
|
-
eciesEncryptedKeyHex: string;
|
|
255
|
-
}
|
|
256
|
-
interface UnpackResult {
|
|
257
|
-
/** Decrypted AgentPayload */
|
|
258
|
-
agent: AgentPayload;
|
|
259
|
-
/** CID where the encrypted payload was fetched from */
|
|
260
|
-
encryptedCid: string;
|
|
261
|
-
/** CID of the public metadata */
|
|
262
|
-
publicCid: string;
|
|
263
|
-
}
|
|
264
|
-
declare enum AgentXErrorCode {
|
|
265
|
-
NOT_SUBSCRIBED = "NOT_SUBSCRIBED",
|
|
266
|
-
SUBSCRIPTION_EXPIRED = "SUBSCRIPTION_EXPIRED",
|
|
267
|
-
DECRYPTION_FAILED = "DECRYPTION_FAILED",
|
|
268
|
-
IPFS_FETCH_FAILED = "IPFS_FETCH_FAILED",
|
|
269
|
-
AGENT_NOT_FOUND = "AGENT_NOT_FOUND",
|
|
270
|
-
INVALID_SCHEMA = "INVALID_SCHEMA",
|
|
271
|
-
TX_FAILED = "TX_FAILED",
|
|
272
|
-
WALLET_NOT_CONNECTED = "WALLET_NOT_CONNECTED"
|
|
273
|
-
}
|
|
274
|
-
declare class AgentXError extends Error {
|
|
275
|
-
code: AgentXErrorCode;
|
|
276
|
-
/** If NOT_SUBSCRIBED, carry enough info for wallet/X402 auto-payment */
|
|
277
|
-
paymentInfo?: SubscriptionRequired;
|
|
278
|
-
constructor(code: AgentXErrorCode, message: string);
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* Structured info for wallet/X402 auto-subscription.
|
|
282
|
-
* Thrown by AgentRunner.useAgent() when the user/Agent has no
|
|
283
|
-
* active subscription.
|
|
284
|
-
*/
|
|
285
|
-
interface SubscriptionRequired {
|
|
286
|
-
agentId: number;
|
|
287
|
-
/** Plan IDs available for this Agent (on-chain query) */
|
|
288
|
-
plans?: {
|
|
289
|
-
planId: number;
|
|
290
|
-
price: bigint;
|
|
291
|
-
period: string;
|
|
292
|
-
payToken: string;
|
|
293
|
-
trialDays: number;
|
|
294
|
-
}[];
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
export { type AgentSubscription as A, type EncryptedPayload as E, type JSONSchema as J, type McpConnection as M, type OnChainAgentMetadata as O, type PackResult as P, type RegisteredAgent as R, type SkillDef as S, type UnpackResult as U, type A2AAgentCard as a, type A2ATask as b, type AgentReview as c, type AgentReputation as d, type A2ASkillExecution as e, type A2ATaskStatus as f, type AgentPayload as g, type AgentPricing as h, type AgentPrivatePayload as i, type AgentPublicPayload as j, type AgentSearchQuery as k, type AgentSearchResult as l, type AgentXConfig as m, type AgentXContracts as n, AgentXError as o, AgentXErrorCode as p, type JSONSchemaProperty as q, type McpTransport as r, type PricingType as s, type SkillExecutionMode as t, type SkillExecutionRemote as u, type SubscriptionRequired as v, type SubscriptionStatus as w };
|