@agirails/sdk 2.5.3 → 2.5.4

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.
Files changed (166) hide show
  1. package/dist/ACTPClient.d.ts +18 -0
  2. package/dist/ACTPClient.d.ts.map +1 -1
  3. package/dist/ACTPClient.js +67 -22
  4. package/dist/ACTPClient.js.map +1 -1
  5. package/dist/adapters/BasicAdapter.d.ts +12 -0
  6. package/dist/adapters/BasicAdapter.d.ts.map +1 -1
  7. package/dist/adapters/BasicAdapter.js +30 -4
  8. package/dist/adapters/BasicAdapter.js.map +1 -1
  9. package/dist/adapters/StandardAdapter.d.ts +20 -3
  10. package/dist/adapters/StandardAdapter.d.ts.map +1 -1
  11. package/dist/adapters/StandardAdapter.js +45 -11
  12. package/dist/adapters/StandardAdapter.js.map +1 -1
  13. package/dist/cli/commands/publish.js +16 -4
  14. package/dist/cli/commands/publish.js.map +1 -1
  15. package/dist/cli/commands/register.js +16 -4
  16. package/dist/cli/commands/register.js.map +1 -1
  17. package/dist/cli/commands/tx.js +31 -3
  18. package/dist/cli/commands/tx.js.map +1 -1
  19. package/dist/config/networks.d.ts +2 -2
  20. package/dist/config/networks.d.ts.map +1 -1
  21. package/dist/config/networks.js +27 -22
  22. package/dist/config/networks.js.map +1 -1
  23. package/dist/level0/request.d.ts.map +1 -1
  24. package/dist/level0/request.js +2 -1
  25. package/dist/level0/request.js.map +1 -1
  26. package/dist/runtime/BlockchainRuntime.d.ts.map +1 -1
  27. package/dist/runtime/BlockchainRuntime.js +11 -5
  28. package/dist/runtime/BlockchainRuntime.js.map +1 -1
  29. package/dist/utils/IPFSClient.d.ts +3 -1
  30. package/dist/utils/IPFSClient.d.ts.map +1 -1
  31. package/dist/utils/IPFSClient.js +27 -7
  32. package/dist/utils/IPFSClient.js.map +1 -1
  33. package/dist/wallet/AutoWalletProvider.d.ts.map +1 -1
  34. package/dist/wallet/AutoWalletProvider.js +52 -18
  35. package/dist/wallet/AutoWalletProvider.js.map +1 -1
  36. package/dist/wallet/SmartWalletRouter.d.ts +116 -0
  37. package/dist/wallet/SmartWalletRouter.d.ts.map +1 -0
  38. package/dist/wallet/SmartWalletRouter.js +212 -0
  39. package/dist/wallet/SmartWalletRouter.js.map +1 -0
  40. package/dist/wallet/aa/DualNonceManager.d.ts +19 -0
  41. package/dist/wallet/aa/DualNonceManager.d.ts.map +1 -1
  42. package/dist/wallet/aa/DualNonceManager.js +100 -5
  43. package/dist/wallet/aa/DualNonceManager.js.map +1 -1
  44. package/package.json +3 -6
  45. package/src/ACTPClient.ts +0 -1579
  46. package/src/abi/ACTPKernel.json +0 -1356
  47. package/src/abi/AgentRegistry.json +0 -915
  48. package/src/abi/ERC20.json +0 -40
  49. package/src/abi/EscrowVault.json +0 -134
  50. package/src/abi/IdentityRegistry.json +0 -316
  51. package/src/adapters/AdapterRegistry.ts +0 -173
  52. package/src/adapters/AdapterRouter.ts +0 -416
  53. package/src/adapters/BaseAdapter.ts +0 -498
  54. package/src/adapters/BasicAdapter.ts +0 -514
  55. package/src/adapters/IAdapter.ts +0 -292
  56. package/src/adapters/StandardAdapter.ts +0 -555
  57. package/src/adapters/X402Adapter.ts +0 -731
  58. package/src/adapters/index.ts +0 -60
  59. package/src/builders/DeliveryProofBuilder.ts +0 -327
  60. package/src/builders/QuoteBuilder.ts +0 -483
  61. package/src/builders/index.ts +0 -17
  62. package/src/cli/commands/balance.ts +0 -110
  63. package/src/cli/commands/batch.ts +0 -487
  64. package/src/cli/commands/config.ts +0 -231
  65. package/src/cli/commands/deploy-check.ts +0 -364
  66. package/src/cli/commands/deploy-env.ts +0 -120
  67. package/src/cli/commands/diff.ts +0 -141
  68. package/src/cli/commands/init.ts +0 -469
  69. package/src/cli/commands/mint.ts +0 -116
  70. package/src/cli/commands/pay.ts +0 -113
  71. package/src/cli/commands/publish.ts +0 -475
  72. package/src/cli/commands/pull.ts +0 -124
  73. package/src/cli/commands/register.ts +0 -247
  74. package/src/cli/commands/simulate.ts +0 -345
  75. package/src/cli/commands/time.ts +0 -302
  76. package/src/cli/commands/tx.ts +0 -448
  77. package/src/cli/commands/watch.ts +0 -211
  78. package/src/cli/index.ts +0 -134
  79. package/src/cli/utils/client.ts +0 -252
  80. package/src/cli/utils/config.ts +0 -389
  81. package/src/cli/utils/output.ts +0 -465
  82. package/src/cli/utils/wallet.ts +0 -109
  83. package/src/config/agirailsmd.ts +0 -262
  84. package/src/config/networks.ts +0 -275
  85. package/src/config/pendingPublish.ts +0 -237
  86. package/src/config/publishPipeline.ts +0 -359
  87. package/src/config/syncOperations.ts +0 -279
  88. package/src/erc8004/ERC8004Bridge.ts +0 -462
  89. package/src/erc8004/ReputationReporter.ts +0 -468
  90. package/src/erc8004/index.ts +0 -61
  91. package/src/errors/index.ts +0 -427
  92. package/src/index.ts +0 -364
  93. package/src/level0/Provider.ts +0 -117
  94. package/src/level0/ServiceDirectory.ts +0 -131
  95. package/src/level0/index.ts +0 -10
  96. package/src/level0/provide.ts +0 -132
  97. package/src/level0/request.ts +0 -432
  98. package/src/level1/Agent.ts +0 -1426
  99. package/src/level1/index.ts +0 -10
  100. package/src/level1/pricing/PriceCalculator.ts +0 -255
  101. package/src/level1/pricing/PricingStrategy.ts +0 -198
  102. package/src/level1/types/Job.ts +0 -179
  103. package/src/level1/types/Options.ts +0 -291
  104. package/src/level1/types/index.ts +0 -8
  105. package/src/protocol/ACTPKernel.ts +0 -808
  106. package/src/protocol/AgentRegistry.ts +0 -559
  107. package/src/protocol/DIDManager.ts +0 -629
  108. package/src/protocol/DIDResolver.ts +0 -554
  109. package/src/protocol/EASHelper.ts +0 -378
  110. package/src/protocol/EscrowVault.ts +0 -255
  111. package/src/protocol/EventMonitor.ts +0 -204
  112. package/src/protocol/MessageSigner.ts +0 -510
  113. package/src/protocol/ProofGenerator.ts +0 -339
  114. package/src/protocol/QuoteBuilder.ts +0 -15
  115. package/src/registry/AgentRegistryClient.ts +0 -202
  116. package/src/runtime/BlockchainRuntime.ts +0 -1015
  117. package/src/runtime/IACTPRuntime.ts +0 -306
  118. package/src/runtime/MockRuntime.ts +0 -1298
  119. package/src/runtime/MockStateManager.ts +0 -577
  120. package/src/runtime/index.ts +0 -25
  121. package/src/runtime/types/MockState.ts +0 -237
  122. package/src/storage/ArchiveBundleBuilder.ts +0 -561
  123. package/src/storage/ArweaveClient.ts +0 -946
  124. package/src/storage/FilebaseClient.ts +0 -790
  125. package/src/storage/index.ts +0 -96
  126. package/src/storage/types.ts +0 -348
  127. package/src/types/adapter.ts +0 -310
  128. package/src/types/agent.ts +0 -79
  129. package/src/types/did.ts +0 -223
  130. package/src/types/eip712.ts +0 -175
  131. package/src/types/erc8004.ts +0 -293
  132. package/src/types/escrow.ts +0 -27
  133. package/src/types/index.ts +0 -17
  134. package/src/types/message.ts +0 -145
  135. package/src/types/state.ts +0 -87
  136. package/src/types/transaction.ts +0 -69
  137. package/src/types/x402.ts +0 -251
  138. package/src/utils/ErrorRecoveryGuide.ts +0 -676
  139. package/src/utils/Helpers.ts +0 -688
  140. package/src/utils/IPFSClient.ts +0 -368
  141. package/src/utils/Logger.ts +0 -484
  142. package/src/utils/NonceManager.ts +0 -591
  143. package/src/utils/RateLimiter.ts +0 -534
  144. package/src/utils/ReceivedNonceTracker.ts +0 -567
  145. package/src/utils/SDKLifecycle.ts +0 -416
  146. package/src/utils/SecureNonce.ts +0 -78
  147. package/src/utils/Semaphore.ts +0 -276
  148. package/src/utils/UsedAttestationTracker.ts +0 -385
  149. package/src/utils/canonicalJson.ts +0 -38
  150. package/src/utils/circuitBreaker.ts +0 -324
  151. package/src/utils/computeTypeHash.ts +0 -48
  152. package/src/utils/fsSafe.ts +0 -80
  153. package/src/utils/index.ts +0 -80
  154. package/src/utils/retry.ts +0 -364
  155. package/src/utils/security.ts +0 -418
  156. package/src/utils/validation.ts +0 -540
  157. package/src/wallet/AutoWalletProvider.ts +0 -299
  158. package/src/wallet/EOAWalletProvider.ts +0 -69
  159. package/src/wallet/IWalletProvider.ts +0 -135
  160. package/src/wallet/aa/BundlerClient.ts +0 -274
  161. package/src/wallet/aa/DualNonceManager.ts +0 -173
  162. package/src/wallet/aa/PaymasterClient.ts +0 -174
  163. package/src/wallet/aa/TransactionBatcher.ts +0 -353
  164. package/src/wallet/aa/UserOpBuilder.ts +0 -246
  165. package/src/wallet/aa/constants.ts +0 -60
  166. package/src/wallet/keystore.ts +0 -240
@@ -1,468 +0,0 @@
1
- /**
2
- * ERC-8004 Reputation Reporter
3
- *
4
- * WRITES to ERC-8004 Reputation Registry after ACTP settlements.
5
- *
6
- * CRITICAL SECURITY NOTES:
7
- * 1. Requires signer (pays gas) - typically the requester
8
- * 2. Caller MUST NOT be agent owner (ERC-8004 restriction)
9
- * 3. Uses feedbackHash = keccak256(txId) for replay protection
10
- * 4. Failures are logged but NEVER block ACTP settlement
11
- * 5. Local dedup prevents double-reporting in same session
12
- *
13
- * WHEN TO CALL:
14
- * - reportSettlement(): After successful release() (state = SETTLED)
15
- * - reportDispute(): After dispute resolution
16
- *
17
- * FAILURE HANDLING:
18
- * - All methods return null on failure (never throw)
19
- * - Settlement/dispute already succeeded - reputation is bonus
20
- * - Log warnings for debugging
21
- *
22
- * @example
23
- * ```typescript
24
- * const reporter = new ReputationReporter({
25
- * network: 'base-sepolia',
26
- * signer: requesterWallet,
27
- * });
28
- *
29
- * // After successful release
30
- * const txHash = await reporter.reportSettlement({
31
- * agentId: '12345',
32
- * txId: result.txId,
33
- * capability: 'code_generation',
34
- * });
35
- *
36
- * if (txHash) {
37
- * console.log('Reputation reported:', txHash);
38
- * } else {
39
- * console.warn('Report failed (settlement still succeeded)');
40
- * }
41
- * ```
42
- *
43
- * @module erc8004/ReputationReporter
44
- */
45
-
46
- import { ethers, Signer } from 'ethers';
47
- import {
48
- ERC8004Network,
49
- ERC8004_REPUTATION_REGISTRY,
50
- ERC8004_REPUTATION_ABI,
51
- ACTP_FEEDBACK_TAGS,
52
- } from '../types/erc8004';
53
- import { sdkLogger } from '../utils/Logger';
54
-
55
- // ============================================================================
56
- // Types
57
- // ============================================================================
58
-
59
- /**
60
- * Transaction receipt interface for reputation reports.
61
- */
62
- interface TransactionReceipt {
63
- hash: string;
64
- blockNumber: number;
65
- gasUsed: bigint;
66
- }
67
-
68
- /**
69
- * Transaction response interface.
70
- */
71
- interface TransactionResponse {
72
- wait(): Promise<TransactionReceipt>;
73
- }
74
-
75
- /**
76
- * Interface for ERC-8004 Reputation Registry contract.
77
- * Used for testing with mock implementations.
78
- */
79
- export interface IERC8004ReputationRegistry {
80
- giveFeedback(
81
- agentId: string,
82
- value: number,
83
- valueDecimals: number,
84
- tag1: string,
85
- tag2: string,
86
- endpoint: string,
87
- feedbackURI: string,
88
- feedbackHash: string,
89
- txOptions?: { gasLimit?: bigint }
90
- ): Promise<TransactionResponse>;
91
-
92
- getSummary(
93
- agentId: string,
94
- clientAddresses: string[],
95
- tag1: string,
96
- tag2: string
97
- ): Promise<[bigint, bigint, number]>;
98
-
99
- revokeLatest(agentId: string, feedbackIndex: bigint): Promise<TransactionResponse>;
100
- }
101
-
102
- /**
103
- * Configuration for ReputationReporter.
104
- */
105
- export interface ReputationReporterConfig {
106
- /** Target network */
107
- network: ERC8004Network;
108
-
109
- /** Signer for transactions (pays gas) */
110
- signer: Signer;
111
-
112
- /** Override registry address (optional, for testing) */
113
- registryAddress?: string;
114
-
115
- /** Gas limit override (optional) */
116
- gasLimit?: bigint;
117
-
118
- /**
119
- * Injected contract instance (optional, for testing).
120
- * If provided, skips creating a real ethers Contract.
121
- * @internal
122
- */
123
- _testContract?: IERC8004ReputationRegistry;
124
- }
125
-
126
- /**
127
- * Parameters for reporting a successful settlement.
128
- */
129
- export interface ReportSettlementParams {
130
- /** ERC-8004 agent ID */
131
- agentId: string;
132
-
133
- /** ACTP transaction ID (used for replay protection) */
134
- txId: string;
135
-
136
- /** Agent capability (e.g., 'code_generation', 'data_analysis') */
137
- capability?: string;
138
-
139
- /** Service endpoint (optional) */
140
- endpoint?: string;
141
-
142
- /** Link to transaction details (optional, IPFS or HTTPS) */
143
- feedbackURI?: string;
144
- }
145
-
146
- /**
147
- * Parameters for reporting a dispute resolution.
148
- */
149
- export interface ReportDisputeParams {
150
- /** ERC-8004 agent ID */
151
- agentId: string;
152
-
153
- /** ACTP transaction ID */
154
- txId: string;
155
-
156
- /** true if agent won the dispute, false if requester won */
157
- agentWon: boolean;
158
-
159
- /** Agent capability (optional) */
160
- capability?: string;
161
-
162
- /** Dispute reason/details (optional, stored as feedbackURI) */
163
- reason?: string;
164
- }
165
-
166
- /**
167
- * Result of a reputation report.
168
- */
169
- export interface ReportResult {
170
- /** Transaction hash */
171
- txHash: string;
172
-
173
- /** Block number */
174
- blockNumber: number;
175
-
176
- /** Gas used */
177
- gasUsed: bigint;
178
- }
179
-
180
- // ============================================================================
181
- // ReputationReporter
182
- // ============================================================================
183
-
184
- /**
185
- * Reporter for submitting ACTP settlement outcomes to ERC-8004 Reputation.
186
- *
187
- * Designed to never block or fail the main ACTP flow.
188
- * All errors are caught and logged, returning null on failure.
189
- */
190
- export class ReputationReporter {
191
- private readonly registry: IERC8004ReputationRegistry;
192
- private readonly signer: Signer;
193
- private readonly network: ERC8004Network;
194
- private readonly gasLimit?: bigint;
195
-
196
- /**
197
- * Track reported txIds to prevent double-reporting in same session.
198
- * Note: This is in-memory only, so restarts allow re-reporting.
199
- * On-chain, feedbackHash provides permanent dedup.
200
- */
201
- private readonly reportedTxIds: Set<string> = new Set();
202
-
203
- constructor(config: ReputationReporterConfig) {
204
- this.network = config.network;
205
- this.signer = config.signer;
206
- this.gasLimit = config.gasLimit;
207
-
208
- // Use injected contract for testing
209
- if (config._testContract) {
210
- this.registry = config._testContract;
211
- return;
212
- }
213
-
214
- const registryAddress =
215
- config.registryAddress ?? ERC8004_REPUTATION_REGISTRY[config.network];
216
-
217
- if (registryAddress === ethers.ZeroAddress) {
218
- sdkLogger.warn(
219
- `[ERC8004] Reputation Registry not deployed on ${config.network}. Reports will fail.`
220
- );
221
- }
222
-
223
- this.registry = new ethers.Contract(
224
- registryAddress,
225
- ERC8004_REPUTATION_ABI,
226
- config.signer
227
- ) as unknown as IERC8004ReputationRegistry;
228
- }
229
-
230
- // ==========================================================================
231
- // Public Methods
232
- // ==========================================================================
233
-
234
- /**
235
- * Report successful ACTP settlement to ERC-8004 Reputation.
236
- *
237
- * Call this AFTER release() succeeds. Failure here does NOT affect settlement.
238
- *
239
- * Reports:
240
- * - value: 1 (positive feedback)
241
- * - valueDecimals: 0 (binary)
242
- * - tag1: 'actp_settled'
243
- * - tag2: capability
244
- * - feedbackHash: keccak256(txId)
245
- *
246
- * @param params - Settlement details
247
- * @returns ReportResult if successful, null if failed
248
- */
249
- async reportSettlement(params: ReportSettlementParams): Promise<ReportResult | null> {
250
- const {
251
- agentId,
252
- txId,
253
- capability = '',
254
- endpoint = '',
255
- feedbackURI = '',
256
- } = params;
257
-
258
- // Local dedup check
259
- if (this.reportedTxIds.has(txId)) {
260
- sdkLogger.warn(`[ERC8004] Already reported txId in this session: ${txId}`);
261
- return null;
262
- }
263
-
264
- try {
265
- // Compute feedbackHash for on-chain replay protection
266
- const feedbackHash = ethers.keccak256(ethers.toUtf8Bytes(txId));
267
-
268
- // Prepare transaction options
269
- const txOptions: { gasLimit?: bigint } = {};
270
- if (this.gasLimit) {
271
- txOptions.gasLimit = this.gasLimit;
272
- }
273
-
274
- // Submit feedback
275
- const tx = await this.registry.giveFeedback(
276
- agentId,
277
- 1, // value: 1 = success
278
- 0, // decimals: 0 (binary)
279
- ACTP_FEEDBACK_TAGS.SETTLED, // tag1: 'actp_settled'
280
- capability, // tag2: capability
281
- endpoint,
282
- feedbackURI,
283
- feedbackHash,
284
- txOptions
285
- );
286
-
287
- // Wait for confirmation
288
- const receipt = await tx.wait();
289
-
290
- // Mark as reported
291
- this.reportedTxIds.add(txId);
292
-
293
- return {
294
- txHash: receipt.hash,
295
- blockNumber: receipt.blockNumber,
296
- gasUsed: receipt.gasUsed,
297
- };
298
- } catch (error) {
299
- // Log but NEVER throw - settlement already succeeded
300
- this.logError('reportSettlement', agentId, txId, error);
301
- return null;
302
- }
303
- }
304
-
305
- /**
306
- * Report ACTP dispute resolution to ERC-8004 Reputation.
307
- *
308
- * Call this after dispute is resolved (either party won).
309
- *
310
- * Reports:
311
- * - value: 1 if agent won, -1 if requester won
312
- * - valueDecimals: 0 (binary)
313
- * - tag1: 'actp_dispute_won' or 'actp_dispute_lost'
314
- * - tag2: capability
315
- * - feedbackHash: keccak256(txId)
316
- *
317
- * @param params - Dispute details
318
- * @returns ReportResult if successful, null if failed
319
- */
320
- async reportDispute(params: ReportDisputeParams): Promise<ReportResult | null> {
321
- const { agentId, txId, agentWon, capability = '', reason = '' } = params;
322
-
323
- // Local dedup check
324
- if (this.reportedTxIds.has(txId)) {
325
- sdkLogger.warn(`[ERC8004] Already reported txId in this session: ${txId}`);
326
- return null;
327
- }
328
-
329
- try {
330
- const feedbackHash = ethers.keccak256(ethers.toUtf8Bytes(txId));
331
-
332
- // Determine value and tag based on outcome
333
- const value = agentWon ? 1 : -1;
334
- const tag1 = agentWon
335
- ? ACTP_FEEDBACK_TAGS.DISPUTE_WON
336
- : ACTP_FEEDBACK_TAGS.DISPUTE_LOST;
337
-
338
- const txOptions: { gasLimit?: bigint } = {};
339
- if (this.gasLimit) {
340
- txOptions.gasLimit = this.gasLimit;
341
- }
342
-
343
- const tx = await this.registry.giveFeedback(
344
- agentId,
345
- value,
346
- 0, // decimals: 0 (binary)
347
- tag1,
348
- capability,
349
- '', // endpoint
350
- reason, // feedbackURI (contains dispute reason)
351
- feedbackHash,
352
- txOptions
353
- );
354
-
355
- const receipt = await tx.wait();
356
- this.reportedTxIds.add(txId);
357
-
358
- return {
359
- txHash: receipt.hash,
360
- blockNumber: receipt.blockNumber,
361
- gasUsed: receipt.gasUsed,
362
- };
363
- } catch (error) {
364
- this.logError('reportDispute', agentId, txId, error);
365
- return null;
366
- }
367
- }
368
-
369
- /**
370
- * Get reputation summary for an agent.
371
- *
372
- * This is a READ operation (no gas cost).
373
- *
374
- * @param agentId - ERC-8004 agent ID
375
- * @param tag1 - Filter by tag1 (optional, e.g., 'actp_settled')
376
- * @returns Summary if successful, null if failed
377
- */
378
- async getAgentReputation(
379
- agentId: string,
380
- tag1?: string
381
- ): Promise<{ count: number; score: number } | null> {
382
- try {
383
- const [count, summaryValue] = await this.registry.getSummary(
384
- agentId,
385
- [], // clientAddresses (empty = all)
386
- tag1 ?? '',
387
- '' // tag2
388
- );
389
-
390
- return {
391
- count: Number(count),
392
- score: Number(summaryValue),
393
- };
394
- } catch (error) {
395
- sdkLogger.error(
396
- `[ERC8004] getAgentReputation failed for ${agentId}: ${error instanceof Error ? error.message : error}`
397
- );
398
- return null;
399
- }
400
- }
401
-
402
- /**
403
- * Check if a transaction was already reported in this session.
404
- *
405
- * Note: This is local-only. For on-chain check, you'd need to
406
- * query the feedbackHash mapping (not exposed in standard interface).
407
- *
408
- * @param txId - ACTP transaction ID
409
- */
410
- isReported(txId: string): boolean {
411
- return this.reportedTxIds.has(txId);
412
- }
413
-
414
- /**
415
- * Clear local dedup cache.
416
- * Use when starting new session or for testing.
417
- */
418
- clearReportedCache(): void {
419
- this.reportedTxIds.clear();
420
- }
421
-
422
- /**
423
- * Get reporter statistics.
424
- */
425
- getStats(): { network: ERC8004Network; reportedCount: number } {
426
- return {
427
- network: this.network,
428
- reportedCount: this.reportedTxIds.size,
429
- };
430
- }
431
-
432
- // ==========================================================================
433
- // Private Methods
434
- // ==========================================================================
435
-
436
- /**
437
- * Log error in consistent format.
438
- * NEVER throws - errors are informational only.
439
- */
440
- private logError(
441
- method: string,
442
- agentId: string,
443
- txId: string,
444
- error: unknown
445
- ): void {
446
- const errorMessage =
447
- error instanceof Error ? error.message : String(error);
448
-
449
- // Check for common error cases
450
- if (errorMessage.includes('insufficient funds')) {
451
- sdkLogger.error(
452
- `[ERC8004] ${method} failed for agent ${agentId}: Insufficient funds for gas. Signer needs ETH/native token.`
453
- );
454
- } else if (errorMessage.includes('cannot be the agent owner')) {
455
- sdkLogger.error(
456
- `[ERC8004] ${method} failed for agent ${agentId}: Caller is agent owner. ERC-8004 requires different address.`
457
- );
458
- } else if (errorMessage.includes('user rejected')) {
459
- sdkLogger.warn(
460
- `[ERC8004] ${method} cancelled by user for agent ${agentId}`
461
- );
462
- } else {
463
- sdkLogger.error(
464
- `[ERC8004] ${method} failed for agent ${agentId} (tx: ${txId}): ${errorMessage}`
465
- );
466
- }
467
- }
468
- }
@@ -1,61 +0,0 @@
1
- /**
2
- * ERC-8004 Trustless Agents Integration
3
- *
4
- * Provides integration with ERC-8004 standard for:
5
- * - Agent identity resolution (Identity Registry)
6
- * - Reputation reporting (Reputation Registry)
7
- *
8
- * @example
9
- * ```typescript
10
- * import {
11
- * ERC8004Bridge,
12
- * ReputationReporter,
13
- * ERC8004Error,
14
- * } from '@agirails/sdk/erc8004';
15
- *
16
- * // Read agent info
17
- * const bridge = new ERC8004Bridge({ network: 'base-sepolia' });
18
- * const agent = await bridge.resolveAgent('12345');
19
- *
20
- * // Report settlement
21
- * const reporter = new ReputationReporter({
22
- * network: 'base-sepolia',
23
- * signer: wallet,
24
- * });
25
- * await reporter.reportSettlement({ agentId: '12345', txId });
26
- * ```
27
- *
28
- * @module erc8004
29
- */
30
-
31
- // Bridge (read-only)
32
- export { ERC8004Bridge } from './ERC8004Bridge';
33
- export type { ERC8004BridgeConfig } from './ERC8004Bridge';
34
-
35
- // Reporter (write)
36
- export { ReputationReporter } from './ReputationReporter';
37
- export type {
38
- ReputationReporterConfig,
39
- ReportSettlementParams,
40
- ReportDisputeParams,
41
- ReportResult,
42
- } from './ReputationReporter';
43
-
44
- // Re-export types from types/erc8004
45
- export type {
46
- ERC8004Network,
47
- ERC8004Agent,
48
- ERC8004AgentMetadata,
49
- ReputationFeedback,
50
- ReputationSummary,
51
- ACTPFeedbackTag,
52
- } from '../types/erc8004';
53
-
54
- export {
55
- ERC8004Error,
56
- ERC8004ErrorCode,
57
- ERC8004_IDENTITY_REGISTRY,
58
- ERC8004_REPUTATION_REGISTRY,
59
- ERC8004_DEFAULT_RPC,
60
- ACTP_FEEDBACK_TAGS,
61
- } from '../types/erc8004';