@agentxv2/sdk 0.3.0
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 +195 -0
- package/dist/a2a/a2a.d.ts +37 -0
- package/dist/a2a/a2a.d.ts.map +1 -0
- package/dist/a2a/a2a.js +252 -0
- package/dist/a2a/a2a.js.map +1 -0
- package/dist/a2a/index.d.ts +4 -0
- package/dist/a2a/index.d.ts.map +1 -0
- package/dist/a2a/index.js +4 -0
- package/dist/a2a/index.js.map +1 -0
- package/dist/agent/agent-runner.d.ts +124 -0
- package/dist/agent/agent-runner.d.ts.map +1 -0
- package/dist/agent/agent-runner.js +249 -0
- package/dist/agent/agent-runner.js.map +1 -0
- package/dist/agent/index.d.ts +3 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +3 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/config/config.d.ts +31 -0
- package/dist/config/config.d.ts.map +1 -0
- package/dist/config/config.js +95 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/index.d.ts +4 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +4 -0
- package/dist/config/index.js.map +1 -0
- package/dist/core/crypto.d.ts +62 -0
- package/dist/core/crypto.d.ts.map +1 -0
- package/dist/core/crypto.js +291 -0
- package/dist/core/crypto.js.map +1 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +4 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/types.d.ts +296 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +30 -0
- package/dist/core/types.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/connector.d.ts +43 -0
- package/dist/mcp/connector.d.ts.map +1 -0
- package/dist/mcp/connector.js +79 -0
- package/dist/mcp/connector.js.map +1 -0
- package/dist/mcp/index.d.ts +4 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +4 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/react/index.d.ts +4 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +3 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/useAgentRunner.d.ts +16 -0
- package/dist/react/useAgentRunner.d.ts.map +1 -0
- package/dist/react/useAgentRunner.js +204 -0
- package/dist/react/useAgentRunner.js.map +1 -0
- package/dist/registry/agent-registry.d.ts +52 -0
- package/dist/registry/agent-registry.d.ts.map +1 -0
- package/dist/registry/agent-registry.js +221 -0
- package/dist/registry/agent-registry.js.map +1 -0
- package/dist/registry/index.d.ts +7 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +6 -0
- package/dist/registry/index.js.map +1 -0
- package/dist/registry/ipfs-fetcher.d.ts +39 -0
- package/dist/registry/ipfs-fetcher.d.ts.map +1 -0
- package/dist/registry/ipfs-fetcher.js +139 -0
- package/dist/registry/ipfs-fetcher.js.map +1 -0
- package/dist/reputation/index.d.ts +4 -0
- package/dist/reputation/index.d.ts.map +1 -0
- package/dist/reputation/index.js +4 -0
- package/dist/reputation/index.js.map +1 -0
- package/dist/reputation/reputation.d.ts +26 -0
- package/dist/reputation/reputation.d.ts.map +1 -0
- package/dist/reputation/reputation.js +113 -0
- package/dist/reputation/reputation.js.map +1 -0
- package/dist/subscription/agent-x402.d.ts +33 -0
- package/dist/subscription/agent-x402.d.ts.map +1 -0
- package/dist/subscription/agent-x402.js +144 -0
- package/dist/subscription/agent-x402.js.map +1 -0
- package/dist/subscription/index.d.ts +6 -0
- package/dist/subscription/index.d.ts.map +1 -0
- package/dist/subscription/index.js +5 -0
- package/dist/subscription/index.js.map +1 -0
- package/dist/subscription/subscription.d.ts +67 -0
- package/dist/subscription/subscription.d.ts.map +1 -0
- package/dist/subscription/subscription.js +346 -0
- package/dist/subscription/subscription.js.map +1 -0
- package/package.json +69 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// @agentx/sdk — Agent Registry
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
// Wraps IdentityRegistry contract interactions (on-chain agent CRUD).
|
|
5
|
+
//
|
|
6
|
+
// Design:
|
|
7
|
+
// - Takes a viem PublicClient + WalletClient (chain-agnostic).
|
|
8
|
+
// - No wagmi dependency — works with any wallet provider that implements
|
|
9
|
+
// the WalletClient interface.
|
|
10
|
+
// - Methods match the existing ERC8004 IdentityRegistry ABI.
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
import { stringToHex, hexToString } from 'viem';
|
|
13
|
+
// ── Minimal ABI Fragments ──────────────────────────────────────────────────
|
|
14
|
+
const IDENTITY_REGISTRY_ABI = {
|
|
15
|
+
// Register
|
|
16
|
+
register: {
|
|
17
|
+
inputs: [],
|
|
18
|
+
name: 'register',
|
|
19
|
+
outputs: [{ name: 'agentId', type: 'uint256' }],
|
|
20
|
+
stateMutability: 'payable',
|
|
21
|
+
type: 'function',
|
|
22
|
+
},
|
|
23
|
+
registerWithTokenURI: {
|
|
24
|
+
inputs: [{ name: 'tokenURI', type: 'string' }],
|
|
25
|
+
name: 'register',
|
|
26
|
+
outputs: [{ name: 'agentId', type: 'uint256' }],
|
|
27
|
+
stateMutability: 'payable',
|
|
28
|
+
type: 'function',
|
|
29
|
+
},
|
|
30
|
+
registerWithMetadata: {
|
|
31
|
+
inputs: [
|
|
32
|
+
{ name: 'tokenURI', type: 'string' },
|
|
33
|
+
{
|
|
34
|
+
name: 'metadata',
|
|
35
|
+
type: 'tuple[]',
|
|
36
|
+
components: [
|
|
37
|
+
{ name: 'key', type: 'string' },
|
|
38
|
+
{ name: 'value', type: 'bytes' },
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
name: 'registerWithMetadata',
|
|
43
|
+
outputs: [{ name: 'agentId', type: 'uint256' }],
|
|
44
|
+
stateMutability: 'payable',
|
|
45
|
+
type: 'function',
|
|
46
|
+
},
|
|
47
|
+
// Queries
|
|
48
|
+
getAgentsByOwner: {
|
|
49
|
+
inputs: [{ name: 'owner', type: 'address' }],
|
|
50
|
+
name: 'getAgentsByOwner',
|
|
51
|
+
outputs: [{ name: '', type: 'uint256[]' }],
|
|
52
|
+
stateMutability: 'view',
|
|
53
|
+
type: 'function',
|
|
54
|
+
},
|
|
55
|
+
getCurrentAgentId: {
|
|
56
|
+
inputs: [],
|
|
57
|
+
name: 'getCurrentAgentId',
|
|
58
|
+
outputs: [{ name: '', type: 'uint256' }],
|
|
59
|
+
stateMutability: 'view',
|
|
60
|
+
type: 'function',
|
|
61
|
+
},
|
|
62
|
+
agentExists: {
|
|
63
|
+
inputs: [{ name: 'agentId', type: 'uint256' }],
|
|
64
|
+
name: 'agentExists',
|
|
65
|
+
outputs: [{ name: '', type: 'bool' }],
|
|
66
|
+
stateMutability: 'view',
|
|
67
|
+
type: 'function',
|
|
68
|
+
},
|
|
69
|
+
tokenURI: {
|
|
70
|
+
inputs: [{ name: 'tokenId', type: 'uint256' }],
|
|
71
|
+
name: 'tokenURI',
|
|
72
|
+
outputs: [{ name: '', type: 'string' }],
|
|
73
|
+
stateMutability: 'view',
|
|
74
|
+
type: 'function',
|
|
75
|
+
},
|
|
76
|
+
getAgentMetadata: {
|
|
77
|
+
inputs: [{ name: 'agentId', type: 'uint256' }],
|
|
78
|
+
name: 'getAgentMetadata',
|
|
79
|
+
outputs: [{ name: '', type: 'tuple[]', components: [{ name: 'key', type: 'string' }, { name: 'value', type: 'bytes' }] }],
|
|
80
|
+
stateMutability: 'view',
|
|
81
|
+
type: 'function',
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
// ── Agent Registry ─────────────────────────────────────────────────────────
|
|
85
|
+
export class AgentRegistry {
|
|
86
|
+
address;
|
|
87
|
+
publicClient;
|
|
88
|
+
walletClient;
|
|
89
|
+
constructor(config) {
|
|
90
|
+
this.address = config.contractAddress;
|
|
91
|
+
this.publicClient = config.publicClient;
|
|
92
|
+
this.walletClient = config.walletClient;
|
|
93
|
+
}
|
|
94
|
+
// ── Write: Register Agent ───────────────────────────────────────────────
|
|
95
|
+
/**
|
|
96
|
+
* Register a new Agent NFT on-chain.
|
|
97
|
+
*
|
|
98
|
+
* @param tokenURI IPFS URI of the public metadata (ipfs://...)
|
|
99
|
+
* @param metadata Key-value metadata (encryptedPayloadCid, eciesEncryptedKey, etc.)
|
|
100
|
+
* @param valueWei Optional: native currency to send with registration
|
|
101
|
+
* @returns { agentId: number, txHash: Hash }
|
|
102
|
+
*/
|
|
103
|
+
async register(tokenURI, metadata, valueWei) {
|
|
104
|
+
const [account] = await this.walletClient.getAddresses();
|
|
105
|
+
if (!account)
|
|
106
|
+
throw new Error('Wallet not connected');
|
|
107
|
+
const encodedMetadata = metadata.map(m => ({
|
|
108
|
+
key: m.key,
|
|
109
|
+
value: stringToHex(m.value),
|
|
110
|
+
}));
|
|
111
|
+
const { request } = await this.publicClient.simulateContract({
|
|
112
|
+
account,
|
|
113
|
+
address: this.address,
|
|
114
|
+
abi: [IDENTITY_REGISTRY_ABI.registerWithMetadata],
|
|
115
|
+
functionName: 'registerWithMetadata',
|
|
116
|
+
args: [tokenURI, encodedMetadata],
|
|
117
|
+
value: valueWei,
|
|
118
|
+
});
|
|
119
|
+
const hash = await this.walletClient.writeContract(request);
|
|
120
|
+
const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
|
|
121
|
+
// Parse agentId from Transfer event (ERC-721)
|
|
122
|
+
const agentId = this._parseAgentIdFromReceipt(receipt);
|
|
123
|
+
return { agentId, txHash: hash };
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Simple register — just a tokenURI, no extra metadata.
|
|
127
|
+
*/
|
|
128
|
+
async registerSimple(tokenURI, valueWei) {
|
|
129
|
+
const [account] = await this.walletClient.getAddresses();
|
|
130
|
+
if (!account)
|
|
131
|
+
throw new Error('Wallet not connected');
|
|
132
|
+
const abi = tokenURI
|
|
133
|
+
? [IDENTITY_REGISTRY_ABI.registerWithTokenURI]
|
|
134
|
+
: [IDENTITY_REGISTRY_ABI.register];
|
|
135
|
+
const args = tokenURI ? [tokenURI] : [];
|
|
136
|
+
const { request } = await this.publicClient.simulateContract({
|
|
137
|
+
account,
|
|
138
|
+
address: this.address,
|
|
139
|
+
abi: abi,
|
|
140
|
+
functionName: 'register',
|
|
141
|
+
args: args,
|
|
142
|
+
value: valueWei,
|
|
143
|
+
});
|
|
144
|
+
const hash = await this.walletClient.writeContract(request);
|
|
145
|
+
const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
|
|
146
|
+
const agentId = this._parseAgentIdFromReceipt(receipt);
|
|
147
|
+
return { agentId, txHash: hash };
|
|
148
|
+
}
|
|
149
|
+
// ── Read: Query ──────────────────────────────────────────────────────────
|
|
150
|
+
/** Get all agent IDs owned by an address. */
|
|
151
|
+
async getAgentsByOwner(owner) {
|
|
152
|
+
const result = await this.publicClient.readContract({
|
|
153
|
+
address: this.address,
|
|
154
|
+
abi: [IDENTITY_REGISTRY_ABI.getAgentsByOwner],
|
|
155
|
+
functionName: 'getAgentsByOwner',
|
|
156
|
+
args: [owner],
|
|
157
|
+
});
|
|
158
|
+
return result.map(Number);
|
|
159
|
+
}
|
|
160
|
+
/** Get the current total agent count. */
|
|
161
|
+
async getCurrentAgentId() {
|
|
162
|
+
const result = await this.publicClient.readContract({
|
|
163
|
+
address: this.address,
|
|
164
|
+
abi: [IDENTITY_REGISTRY_ABI.getCurrentAgentId],
|
|
165
|
+
functionName: 'getCurrentAgentId',
|
|
166
|
+
});
|
|
167
|
+
return Number(result);
|
|
168
|
+
}
|
|
169
|
+
/** Check if an agent exists. */
|
|
170
|
+
async agentExists(agentId) {
|
|
171
|
+
const result = await this.publicClient.readContract({
|
|
172
|
+
address: this.address,
|
|
173
|
+
abi: [IDENTITY_REGISTRY_ABI.agentExists],
|
|
174
|
+
functionName: 'agentExists',
|
|
175
|
+
args: [BigInt(agentId)],
|
|
176
|
+
});
|
|
177
|
+
return result;
|
|
178
|
+
}
|
|
179
|
+
/** Get the tokenURI for an agent. */
|
|
180
|
+
async tokenURI(agentId) {
|
|
181
|
+
const result = await this.publicClient.readContract({
|
|
182
|
+
address: this.address,
|
|
183
|
+
abi: [IDENTITY_REGISTRY_ABI.tokenURI],
|
|
184
|
+
functionName: 'tokenURI',
|
|
185
|
+
args: [BigInt(agentId)],
|
|
186
|
+
});
|
|
187
|
+
return result;
|
|
188
|
+
}
|
|
189
|
+
/** Get all metadata attributes for an agent as key-value pairs. */
|
|
190
|
+
async getAttributes(agentId) {
|
|
191
|
+
const result = await this.publicClient.readContract({
|
|
192
|
+
address: this.address,
|
|
193
|
+
abi: [IDENTITY_REGISTRY_ABI.getAgentMetadata],
|
|
194
|
+
functionName: 'getAgentMetadata',
|
|
195
|
+
args: [BigInt(agentId)],
|
|
196
|
+
});
|
|
197
|
+
const attrs = {};
|
|
198
|
+
for (const item of result) {
|
|
199
|
+
attrs[item.key] = hexToString(item.value);
|
|
200
|
+
}
|
|
201
|
+
return attrs;
|
|
202
|
+
}
|
|
203
|
+
// ── Helpers ──────────────────────────────────────────────────────────────
|
|
204
|
+
/** Extract tokenId from the Transfer event in the receipt. */
|
|
205
|
+
_parseAgentIdFromReceipt(receipt) {
|
|
206
|
+
for (const log of receipt.logs) {
|
|
207
|
+
// ERC-721 Transfer event: keccak("Transfer(address,address,uint256)")
|
|
208
|
+
const transferTopic = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef';
|
|
209
|
+
if (log.topics[0] === transferTopic && log.topics.length >= 4) {
|
|
210
|
+
return Number(BigInt(log.topics[3]));
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
throw new Error('Could not parse agentId from Transfer event in receipt');
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
// ── Utility ─────────────────────────────────────────────────────────────────
|
|
217
|
+
/** Extract IPFS CID from an ipfs:// URI. */
|
|
218
|
+
export function cidFromURI(uri) {
|
|
219
|
+
return uri.replace(/^ipfs:\/\//, '');
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=agent-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-registry.js","sourceRoot":"","sources":["../../src/registry/agent-registry.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,+BAA+B;AAC/B,8EAA8E;AAC9E,sEAAsE;AACtE,EAAE;AACF,UAAU;AACV,iEAAiE;AACjE,2EAA2E;AAC3E,kCAAkC;AAClC,+DAA+D;AAC/D,8EAA8E;AAE9E,OAAO,EAA2C,WAAW,EAAE,WAAW,EAAE,MAAM,MAAM,CAAA;AAIxF,8EAA8E;AAE9E,MAAM,qBAAqB,GAAG;IAC5B,WAAW;IACX,QAAQ,EAAE;QACR,MAAM,EAAE,EAAW;QACnB,IAAI,EAAE,UAAmB;QACzB,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,CAAU;QACxD,eAAe,EAAE,SAAkB;QACnC,IAAI,EAAE,UAAmB;KAC1B;IACD,oBAAoB,EAAE;QACpB,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAU;QACvD,IAAI,EAAE,UAAmB;QACzB,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,CAAU;QACxD,eAAe,EAAE,SAAkB;QACnC,IAAI,EAAE,UAAmB;KAC1B;IACD,oBAAoB,EAAE;QACpB,MAAM,EAAE;YACN,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE;YACpC;gBACE,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,SAAS;gBACf,UAAU,EAAE;oBACV,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE;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A;YAC1F,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,aAAa,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;gBAC9D,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,CAAC,CAAA;YACvC,CAAC;QACH,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;IAC3E,CAAC;CACF;AAED,+EAA+E;AAE/E,4CAA4C;AAC5C,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,OAAO,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAA;AACtC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { AgentRegistry, cidFromURI } from './agent-registry';
|
|
2
|
+
export type { AgentRegistryConfig } from './agent-registry';
|
|
3
|
+
export { IPFSFetcher, defaultIPFSFetcher } from './ipfs-fetcher';
|
|
4
|
+
export type { IPFSFetcherConfig } from './ipfs-fetcher';
|
|
5
|
+
export type { RegisteredAgent, AgentSearchQuery, AgentSearchResult, OnChainAgentMetadata, } from '../core/types';
|
|
6
|
+
export declare const REGISTRY_VERSION = "0.1.0";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/registry/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC5D,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAE3D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAChE,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAGvD,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,eAAe,CAAA;AAEtB,eAAO,MAAM,gBAAgB,UAAU,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// @agentx/sdk — Registry module
|
|
2
|
+
// Agent registration, query, and IPFS fetching.
|
|
3
|
+
export { AgentRegistry, cidFromURI } from './agent-registry';
|
|
4
|
+
export { IPFSFetcher, defaultIPFSFetcher } from './ipfs-fetcher';
|
|
5
|
+
export const REGISTRY_VERSION = '0.1.0';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/registry/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,gDAAgD;AAEhD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAG5D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAWhE,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { EncryptedPayload } from '../core/types';
|
|
2
|
+
export interface IPFSFetcherConfig {
|
|
3
|
+
/** Primary IPFS gateway (default: ipfs.io) */
|
|
4
|
+
gateway?: string;
|
|
5
|
+
/** Fallback gateways in order of preference */
|
|
6
|
+
fallbackGateways?: string[];
|
|
7
|
+
/** Request timeout in ms (default: 10_000) */
|
|
8
|
+
timeoutMs?: number;
|
|
9
|
+
/** Max cached entries (LRU-like eviction, default: 200) */
|
|
10
|
+
maxCache?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare class IPFSFetcher {
|
|
13
|
+
private gateway;
|
|
14
|
+
private fallbackGateways;
|
|
15
|
+
private timeoutMs;
|
|
16
|
+
private cache;
|
|
17
|
+
private maxCache;
|
|
18
|
+
private pending;
|
|
19
|
+
private failed;
|
|
20
|
+
constructor(config?: IPFSFetcherConfig);
|
|
21
|
+
/** Fetch JSON from a single IPFS CID. */
|
|
22
|
+
fetchJSON<T = unknown>(cid: string): Promise<T>;
|
|
23
|
+
/** Fetch encrypted agent payload (validates algorithm). */
|
|
24
|
+
fetchEncryptedPayload(cid: string): Promise<EncryptedPayload>;
|
|
25
|
+
/** Batch fetch multiple CIDs with concurrency control. */
|
|
26
|
+
fetchBatch<T = unknown>(cids: string[], concurrency?: number): Promise<Map<string, T>>;
|
|
27
|
+
/** Check if a string looks like a valid IPFS CID. */
|
|
28
|
+
isValidCID(cid: string): boolean;
|
|
29
|
+
/** Clear cache (optionally for a specific CID). */
|
|
30
|
+
clearCache(cid?: string): void;
|
|
31
|
+
/** Number of cached entries. */
|
|
32
|
+
get cacheSize(): number;
|
|
33
|
+
private _doFetch;
|
|
34
|
+
private _fetchFrom;
|
|
35
|
+
private _cacheSet;
|
|
36
|
+
}
|
|
37
|
+
/** Singleton-friendly default instance. */
|
|
38
|
+
export declare const defaultIPFSFetcher: IPFSFetcher;
|
|
39
|
+
//# sourceMappingURL=ipfs-fetcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ipfs-fetcher.d.ts","sourceRoot":"","sources":["../../src/registry/ipfs-fetcher.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAIrD,MAAM,WAAW,iBAAiB;IAChC,8CAA8C;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,+CAA+C;IAC/C,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AASD,qBAAa,WAAW;IACtB,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,gBAAgB,CAAU;IAClC,OAAO,CAAC,SAAS,CAAQ;IAEzB,OAAO,CAAC,KAAK,CAAyC;IACtD,OAAO,CAAC,QAAQ,CAAQ;IACxB,OAAO,CAAC,OAAO,CAAsC;IACrD,OAAO,CAAC,MAAM,CAAoB;gBAEtB,MAAM,GAAE,iBAAsB;IAa1C,yCAAyC;IACnC,SAAS,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAwBrD,2DAA2D;IACrD,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAQnE,0DAA0D;IACpD,UAAU,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,WAAW,SAAI,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAmBvF,qDAAqD;IACrD,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIhC,mDAAmD;IACnD,UAAU,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI;IAS9B,gCAAgC;IAChC,IAAI,SAAS,IAAI,MAAM,CAEtB;YAIa,QAAQ;YAsBR,UAAU;IAUxB,OAAO,CAAC,SAAS;CAUlB;AAED,2CAA2C;AAC3C,eAAO,MAAM,kBAAkB,aAAoB,CAAA"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// @agentx/sdk — IPFS Fetcher
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
// Multi-gateway IPFS fetcher with in-memory cache, deduplication, and
|
|
5
|
+
// automatic fallback. Compatible with the EncryptedPayload wire format.
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
// ── Implementation ─────────────────────────────────────────────────────────
|
|
8
|
+
export class IPFSFetcher {
|
|
9
|
+
gateway;
|
|
10
|
+
fallbackGateways;
|
|
11
|
+
timeoutMs;
|
|
12
|
+
cache = new Map();
|
|
13
|
+
maxCache;
|
|
14
|
+
pending = new Map();
|
|
15
|
+
failed = new Set();
|
|
16
|
+
constructor(config = {}) {
|
|
17
|
+
this.gateway = config.gateway ?? 'ipfs.io';
|
|
18
|
+
this.fallbackGateways = config.fallbackGateways ?? [
|
|
19
|
+
'gateway.pinata.cloud',
|
|
20
|
+
'dweb.link',
|
|
21
|
+
'cf-ipfs.com',
|
|
22
|
+
];
|
|
23
|
+
this.timeoutMs = config.timeoutMs ?? 10_000;
|
|
24
|
+
this.maxCache = config.maxCache ?? 200;
|
|
25
|
+
}
|
|
26
|
+
// ── Public API ──────────────────────────────────────────────────────────
|
|
27
|
+
/** Fetch JSON from a single IPFS CID. */
|
|
28
|
+
async fetchJSON(cid) {
|
|
29
|
+
const cached = this.cache.get(cid);
|
|
30
|
+
if (cached)
|
|
31
|
+
return cached.data;
|
|
32
|
+
if (this.failed.has(cid))
|
|
33
|
+
throw new Error(`CID ${cid} previously failed`);
|
|
34
|
+
const pending = this.pending.get(cid);
|
|
35
|
+
if (pending)
|
|
36
|
+
return pending;
|
|
37
|
+
const promise = this._doFetch(cid);
|
|
38
|
+
this.pending.set(cid, promise);
|
|
39
|
+
try {
|
|
40
|
+
const data = await promise;
|
|
41
|
+
this._cacheSet(cid, data);
|
|
42
|
+
return data;
|
|
43
|
+
}
|
|
44
|
+
catch (e) {
|
|
45
|
+
this.failed.add(cid);
|
|
46
|
+
throw e;
|
|
47
|
+
}
|
|
48
|
+
finally {
|
|
49
|
+
this.pending.delete(cid);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/** Fetch encrypted agent payload (validates algorithm). */
|
|
53
|
+
async fetchEncryptedPayload(cid) {
|
|
54
|
+
const raw = await this.fetchJSON(cid);
|
|
55
|
+
if (!raw.encrypted || raw.algorithm !== 'AES-256-GCM' || typeof raw.data !== 'string') {
|
|
56
|
+
throw new Error(`Invalid EncryptedPayload at CID ${cid}`);
|
|
57
|
+
}
|
|
58
|
+
return raw;
|
|
59
|
+
}
|
|
60
|
+
/** Batch fetch multiple CIDs with concurrency control. */
|
|
61
|
+
async fetchBatch(cids, concurrency = 5) {
|
|
62
|
+
const results = new Map();
|
|
63
|
+
const unique = [...new Set(cids)].filter(c => this.isValidCID(c));
|
|
64
|
+
for (let i = 0; i < unique.length; i += concurrency) {
|
|
65
|
+
const batch = unique.slice(i, i + concurrency);
|
|
66
|
+
const settled = await Promise.allSettled(batch.map(cid => this.fetchJSON(cid)));
|
|
67
|
+
settled.forEach((r, j) => {
|
|
68
|
+
if (r.status === 'fulfilled')
|
|
69
|
+
results.set(batch[j], r.value);
|
|
70
|
+
});
|
|
71
|
+
if (i + concurrency < unique.length) {
|
|
72
|
+
await new Promise(r => setTimeout(r, 200));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return results;
|
|
76
|
+
}
|
|
77
|
+
/** Check if a string looks like a valid IPFS CID. */
|
|
78
|
+
isValidCID(cid) {
|
|
79
|
+
return /^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[a-z2-7]{58,}|[A-Za-z0-9+/]{46,})$/.test(cid);
|
|
80
|
+
}
|
|
81
|
+
/** Clear cache (optionally for a specific CID). */
|
|
82
|
+
clearCache(cid) {
|
|
83
|
+
if (cid) {
|
|
84
|
+
this.cache.delete(cid);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
this.cache.clear();
|
|
88
|
+
}
|
|
89
|
+
this.failed.clear();
|
|
90
|
+
}
|
|
91
|
+
/** Number of cached entries. */
|
|
92
|
+
get cacheSize() {
|
|
93
|
+
return this.cache.size;
|
|
94
|
+
}
|
|
95
|
+
// ── Internal ─────────────────────────────────────────────────────────────
|
|
96
|
+
async _doFetch(cid) {
|
|
97
|
+
if (!this.isValidCID(cid))
|
|
98
|
+
throw new Error(`Invalid CID: ${cid}`);
|
|
99
|
+
// Try primary gateway
|
|
100
|
+
try {
|
|
101
|
+
return await this._fetchFrom(cid, this.gateway, this.timeoutMs);
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
// fall through to alternatives
|
|
105
|
+
}
|
|
106
|
+
// Try fallback gateways
|
|
107
|
+
for (const gw of this.fallbackGateways) {
|
|
108
|
+
try {
|
|
109
|
+
return await this._fetchFrom(cid, gw, this.timeoutMs);
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
// try next
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
throw new Error(`All IPFS gateways failed for CID ${cid}`);
|
|
116
|
+
}
|
|
117
|
+
async _fetchFrom(cid, gateway, timeoutMs) {
|
|
118
|
+
const url = `https://${gateway}/ipfs/${cid}`;
|
|
119
|
+
const res = await fetch(url, {
|
|
120
|
+
headers: { Accept: 'application/json' },
|
|
121
|
+
signal: AbortSignal.timeout(timeoutMs),
|
|
122
|
+
});
|
|
123
|
+
if (!res.ok)
|
|
124
|
+
throw new Error(`HTTP ${res.status}`);
|
|
125
|
+
return (await res.json());
|
|
126
|
+
}
|
|
127
|
+
_cacheSet(cid, data) {
|
|
128
|
+
this.cache.set(cid, { data, timestamp: Date.now() });
|
|
129
|
+
// Simple LRU-like eviction
|
|
130
|
+
if (this.cache.size > this.maxCache) {
|
|
131
|
+
const oldest = [...this.cache.entries()].sort((a, b) => a[1].timestamp - b[1].timestamp)[0];
|
|
132
|
+
if (oldest)
|
|
133
|
+
this.cache.delete(oldest[0]);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/** Singleton-friendly default instance. */
|
|
138
|
+
export const defaultIPFSFetcher = new IPFSFetcher();
|
|
139
|
+
//# sourceMappingURL=ipfs-fetcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ipfs-fetcher.js","sourceRoot":"","sources":["../../src/registry/ipfs-fetcher.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,6BAA6B;AAC7B,8EAA8E;AAC9E,sEAAsE;AACtE,yEAAyE;AACzE,8EAA8E;AAsB9E,8EAA8E;AAE9E,MAAM,OAAO,WAAW;IACd,OAAO,CAAQ;IACf,gBAAgB,CAAU;IAC1B,SAAS,CAAQ;IAE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EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAC1C,CAAC,CAAC,CAAC,CAAA;YACJ,IAAI,MAAM;gBAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;QAC1C,CAAC;IACH,CAAC;CACF;AAED,2CAA2C;AAC3C,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,WAAW,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/reputation/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACjD,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AACpD,eAAO,MAAM,kBAAkB,UAAU,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/reputation/index.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAEjD,MAAM,CAAC,MAAM,kBAAkB,GAAG,OAAO,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { PublicClient, WalletClient, Address, Hash } from 'viem';
|
|
2
|
+
import type { AgentReputation, AgentReview } from '../core/types';
|
|
3
|
+
export interface ReputationConfig {
|
|
4
|
+
contractAddress: Address;
|
|
5
|
+
publicClient: PublicClient;
|
|
6
|
+
walletClient: WalletClient;
|
|
7
|
+
}
|
|
8
|
+
export declare class ReputationRegistry {
|
|
9
|
+
private address;
|
|
10
|
+
private publicClient;
|
|
11
|
+
private walletClient;
|
|
12
|
+
constructor(config: ReputationConfig);
|
|
13
|
+
private get account();
|
|
14
|
+
/** Submit a rating (1-5) with optional comment. */
|
|
15
|
+
rate(agentId: number, rating: number, comment?: string): Promise<Hash>;
|
|
16
|
+
/** Get average rating and total count. */
|
|
17
|
+
getRating(agentId: number): Promise<{
|
|
18
|
+
averageRating: number;
|
|
19
|
+
totalRatings: number;
|
|
20
|
+
}>;
|
|
21
|
+
/** Get all reviews for an agent. */
|
|
22
|
+
getReviews(agentId: number): Promise<AgentReview[]>;
|
|
23
|
+
/** Get full reputation summary. */
|
|
24
|
+
getReputation(agentId: number): Promise<AgentReputation>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=reputation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reputation.d.ts","sourceRoot":"","sources":["../../src/reputation/reputation.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AA4CjE,MAAM,WAAW,gBAAgB;IAC/B,eAAe,EAAE,OAAO,CAAA;IACxB,YAAY,EAAE,YAAY,CAAA;IAC1B,YAAY,EAAE,YAAY,CAAA;CAC3B;AAED,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,YAAY,CAAc;IAClC,OAAO,CAAC,YAAY,CAAc;gBAEtB,MAAM,EAAE,gBAAgB;IAMpC,OAAO,KAAK,OAAO,GAKlB;IAED,mDAAmD;IAC7C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,SAAK,GAAG,OAAO,CAAC,IAAI,CAAC;IAaxE,0CAA0C;IACpC,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;IAW1F,oCAAoC;IAC9B,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAgBzD,mCAAmC;IAC7B,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;CAO/D"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// @agentx/sdk — Reputation
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
// Wraps ReputationRegistry contract for agent ratings and reviews.
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
const REPUTATION_ABI = {
|
|
7
|
+
rateAgent: {
|
|
8
|
+
inputs: [
|
|
9
|
+
{ name: 'agentId', type: 'uint256' },
|
|
10
|
+
{ name: 'rating', type: 'uint8' },
|
|
11
|
+
{ name: 'comment', type: 'string' },
|
|
12
|
+
],
|
|
13
|
+
name: 'rateAgent',
|
|
14
|
+
outputs: [],
|
|
15
|
+
stateMutability: 'nonpayable',
|
|
16
|
+
type: 'function',
|
|
17
|
+
},
|
|
18
|
+
getRating: {
|
|
19
|
+
inputs: [{ name: 'agentId', type: 'uint256' }],
|
|
20
|
+
name: 'getRating',
|
|
21
|
+
outputs: [
|
|
22
|
+
{ name: 'averageRating', type: 'uint256' },
|
|
23
|
+
{ name: 'totalRatings', type: 'uint256' },
|
|
24
|
+
],
|
|
25
|
+
stateMutability: 'view',
|
|
26
|
+
type: 'function',
|
|
27
|
+
},
|
|
28
|
+
getReviews: {
|
|
29
|
+
inputs: [{ name: 'agentId', type: 'uint256' }],
|
|
30
|
+
name: 'getReviews',
|
|
31
|
+
outputs: [
|
|
32
|
+
{
|
|
33
|
+
name: '',
|
|
34
|
+
type: 'tuple[]',
|
|
35
|
+
components: [
|
|
36
|
+
{ name: 'reviewer', type: 'address' },
|
|
37
|
+
{ name: 'rating', type: 'uint8' },
|
|
38
|
+
{ name: 'comment', type: 'string' },
|
|
39
|
+
{ name: 'timestamp', type: 'uint256' },
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
stateMutability: 'view',
|
|
44
|
+
type: 'function',
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
export class ReputationRegistry {
|
|
48
|
+
address;
|
|
49
|
+
publicClient;
|
|
50
|
+
walletClient;
|
|
51
|
+
constructor(config) {
|
|
52
|
+
this.address = config.contractAddress;
|
|
53
|
+
this.publicClient = config.publicClient;
|
|
54
|
+
this.walletClient = config.walletClient;
|
|
55
|
+
}
|
|
56
|
+
get account() {
|
|
57
|
+
return this.walletClient.getAddresses().then(a => {
|
|
58
|
+
if (!a[0])
|
|
59
|
+
throw new Error('Wallet not connected');
|
|
60
|
+
return a[0];
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/** Submit a rating (1-5) with optional comment. */
|
|
64
|
+
async rate(agentId, rating, comment = '') {
|
|
65
|
+
if (rating < 1 || rating > 5)
|
|
66
|
+
throw new Error('Rating must be 1-5');
|
|
67
|
+
const acct = await this.account;
|
|
68
|
+
const { request } = await this.publicClient.simulateContract({
|
|
69
|
+
account: acct,
|
|
70
|
+
address: this.address,
|
|
71
|
+
abi: [REPUTATION_ABI.rateAgent],
|
|
72
|
+
functionName: 'rateAgent',
|
|
73
|
+
args: [BigInt(agentId), rating, comment],
|
|
74
|
+
});
|
|
75
|
+
return this.walletClient.writeContract(request);
|
|
76
|
+
}
|
|
77
|
+
/** Get average rating and total count. */
|
|
78
|
+
async getRating(agentId) {
|
|
79
|
+
const r = await this.publicClient.readContract({
|
|
80
|
+
address: this.address,
|
|
81
|
+
abi: [REPUTATION_ABI.getRating],
|
|
82
|
+
functionName: 'getRating',
|
|
83
|
+
args: [BigInt(agentId)],
|
|
84
|
+
});
|
|
85
|
+
const [avg, total] = r;
|
|
86
|
+
return { averageRating: Number(avg), totalRatings: Number(total) };
|
|
87
|
+
}
|
|
88
|
+
/** Get all reviews for an agent. */
|
|
89
|
+
async getReviews(agentId) {
|
|
90
|
+
const r = await this.publicClient.readContract({
|
|
91
|
+
address: this.address,
|
|
92
|
+
abi: [REPUTATION_ABI.getReviews],
|
|
93
|
+
functionName: 'getReviews',
|
|
94
|
+
args: [BigInt(agentId)],
|
|
95
|
+
});
|
|
96
|
+
return r
|
|
97
|
+
.map(x => ({
|
|
98
|
+
reviewer: x.reviewer,
|
|
99
|
+
rating: x.rating,
|
|
100
|
+
comment: x.comment,
|
|
101
|
+
timestamp: Number(x.timestamp),
|
|
102
|
+
}));
|
|
103
|
+
}
|
|
104
|
+
/** Get full reputation summary. */
|
|
105
|
+
async getReputation(agentId) {
|
|
106
|
+
const [rating, reviews] = await Promise.all([
|
|
107
|
+
this.getRating(agentId),
|
|
108
|
+
this.getReviews(agentId),
|
|
109
|
+
]);
|
|
110
|
+
return { agentId, ...rating, reviews };
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=reputation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reputation.js","sourceRoot":"","sources":["../../src/reputation/reputation.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,2BAA2B;AAC3B,8EAA8E;AAC9E,mEAAmE;AACnE,8EAA8E;AAK9E,MAAM,cAAc,GAAG;IACrB,SAAS,EAAE;QACT,MAAM,EAAE;YACN,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;YACpC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE;YACjC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE;SAC3B;QACV,IAAI,EAAE,WAAoB;QAC1B,OAAO,EAAE,EAAW;QACpB,eAAe,EAAE,YAAqB;QACtC,IAAI,EAAE,UAAmB;KAC1B;IACD,SAAS,EAAE;QACT,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,CAAU;QACvD,IAAI,EAAE,WAAoB;QAC1B,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,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