@agirails/sdk 2.5.2 → 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 (172) 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/cli/utils/client.d.ts.map +1 -1
  20. package/dist/cli/utils/client.js +1 -0
  21. package/dist/cli/utils/client.js.map +1 -1
  22. package/dist/config/networks.d.ts +2 -2
  23. package/dist/config/networks.d.ts.map +1 -1
  24. package/dist/config/networks.js +27 -22
  25. package/dist/config/networks.js.map +1 -1
  26. package/dist/level0/request.d.ts.map +1 -1
  27. package/dist/level0/request.js +2 -1
  28. package/dist/level0/request.js.map +1 -1
  29. package/dist/runtime/BlockchainRuntime.d.ts.map +1 -1
  30. package/dist/runtime/BlockchainRuntime.js +11 -5
  31. package/dist/runtime/BlockchainRuntime.js.map +1 -1
  32. package/dist/runtime/MockStateManager.d.ts.map +1 -1
  33. package/dist/runtime/MockStateManager.js +2 -1
  34. package/dist/runtime/MockStateManager.js.map +1 -1
  35. package/dist/utils/IPFSClient.d.ts +3 -1
  36. package/dist/utils/IPFSClient.d.ts.map +1 -1
  37. package/dist/utils/IPFSClient.js +27 -7
  38. package/dist/utils/IPFSClient.js.map +1 -1
  39. package/dist/wallet/AutoWalletProvider.d.ts.map +1 -1
  40. package/dist/wallet/AutoWalletProvider.js +52 -18
  41. package/dist/wallet/AutoWalletProvider.js.map +1 -1
  42. package/dist/wallet/SmartWalletRouter.d.ts +116 -0
  43. package/dist/wallet/SmartWalletRouter.d.ts.map +1 -0
  44. package/dist/wallet/SmartWalletRouter.js +212 -0
  45. package/dist/wallet/SmartWalletRouter.js.map +1 -0
  46. package/dist/wallet/aa/DualNonceManager.d.ts +19 -0
  47. package/dist/wallet/aa/DualNonceManager.d.ts.map +1 -1
  48. package/dist/wallet/aa/DualNonceManager.js +100 -5
  49. package/dist/wallet/aa/DualNonceManager.js.map +1 -1
  50. package/package.json +3 -6
  51. package/src/ACTPClient.ts +0 -1579
  52. package/src/abi/ACTPKernel.json +0 -1356
  53. package/src/abi/AgentRegistry.json +0 -915
  54. package/src/abi/ERC20.json +0 -40
  55. package/src/abi/EscrowVault.json +0 -134
  56. package/src/abi/IdentityRegistry.json +0 -316
  57. package/src/adapters/AdapterRegistry.ts +0 -173
  58. package/src/adapters/AdapterRouter.ts +0 -416
  59. package/src/adapters/BaseAdapter.ts +0 -498
  60. package/src/adapters/BasicAdapter.ts +0 -514
  61. package/src/adapters/IAdapter.ts +0 -292
  62. package/src/adapters/StandardAdapter.ts +0 -555
  63. package/src/adapters/X402Adapter.ts +0 -731
  64. package/src/adapters/index.ts +0 -60
  65. package/src/builders/DeliveryProofBuilder.ts +0 -327
  66. package/src/builders/QuoteBuilder.ts +0 -483
  67. package/src/builders/index.ts +0 -17
  68. package/src/cli/commands/balance.ts +0 -110
  69. package/src/cli/commands/batch.ts +0 -487
  70. package/src/cli/commands/config.ts +0 -231
  71. package/src/cli/commands/deploy-check.ts +0 -364
  72. package/src/cli/commands/deploy-env.ts +0 -120
  73. package/src/cli/commands/diff.ts +0 -141
  74. package/src/cli/commands/init.ts +0 -469
  75. package/src/cli/commands/mint.ts +0 -116
  76. package/src/cli/commands/pay.ts +0 -113
  77. package/src/cli/commands/publish.ts +0 -475
  78. package/src/cli/commands/pull.ts +0 -124
  79. package/src/cli/commands/register.ts +0 -247
  80. package/src/cli/commands/simulate.ts +0 -345
  81. package/src/cli/commands/time.ts +0 -302
  82. package/src/cli/commands/tx.ts +0 -448
  83. package/src/cli/commands/watch.ts +0 -211
  84. package/src/cli/index.ts +0 -134
  85. package/src/cli/utils/client.ts +0 -251
  86. package/src/cli/utils/config.ts +0 -389
  87. package/src/cli/utils/output.ts +0 -465
  88. package/src/cli/utils/wallet.ts +0 -109
  89. package/src/config/agirailsmd.ts +0 -262
  90. package/src/config/networks.ts +0 -275
  91. package/src/config/pendingPublish.ts +0 -237
  92. package/src/config/publishPipeline.ts +0 -359
  93. package/src/config/syncOperations.ts +0 -279
  94. package/src/erc8004/ERC8004Bridge.ts +0 -462
  95. package/src/erc8004/ReputationReporter.ts +0 -468
  96. package/src/erc8004/index.ts +0 -61
  97. package/src/errors/index.ts +0 -427
  98. package/src/index.ts +0 -364
  99. package/src/level0/Provider.ts +0 -117
  100. package/src/level0/ServiceDirectory.ts +0 -131
  101. package/src/level0/index.ts +0 -10
  102. package/src/level0/provide.ts +0 -132
  103. package/src/level0/request.ts +0 -432
  104. package/src/level1/Agent.ts +0 -1426
  105. package/src/level1/index.ts +0 -10
  106. package/src/level1/pricing/PriceCalculator.ts +0 -255
  107. package/src/level1/pricing/PricingStrategy.ts +0 -198
  108. package/src/level1/types/Job.ts +0 -179
  109. package/src/level1/types/Options.ts +0 -291
  110. package/src/level1/types/index.ts +0 -8
  111. package/src/protocol/ACTPKernel.ts +0 -808
  112. package/src/protocol/AgentRegistry.ts +0 -559
  113. package/src/protocol/DIDManager.ts +0 -629
  114. package/src/protocol/DIDResolver.ts +0 -554
  115. package/src/protocol/EASHelper.ts +0 -378
  116. package/src/protocol/EscrowVault.ts +0 -255
  117. package/src/protocol/EventMonitor.ts +0 -204
  118. package/src/protocol/MessageSigner.ts +0 -510
  119. package/src/protocol/ProofGenerator.ts +0 -339
  120. package/src/protocol/QuoteBuilder.ts +0 -15
  121. package/src/registry/AgentRegistryClient.ts +0 -202
  122. package/src/runtime/BlockchainRuntime.ts +0 -1015
  123. package/src/runtime/IACTPRuntime.ts +0 -306
  124. package/src/runtime/MockRuntime.ts +0 -1298
  125. package/src/runtime/MockStateManager.ts +0 -576
  126. package/src/runtime/index.ts +0 -25
  127. package/src/runtime/types/MockState.ts +0 -237
  128. package/src/storage/ArchiveBundleBuilder.ts +0 -561
  129. package/src/storage/ArweaveClient.ts +0 -946
  130. package/src/storage/FilebaseClient.ts +0 -790
  131. package/src/storage/index.ts +0 -96
  132. package/src/storage/types.ts +0 -348
  133. package/src/types/adapter.ts +0 -310
  134. package/src/types/agent.ts +0 -79
  135. package/src/types/did.ts +0 -223
  136. package/src/types/eip712.ts +0 -175
  137. package/src/types/erc8004.ts +0 -293
  138. package/src/types/escrow.ts +0 -27
  139. package/src/types/index.ts +0 -17
  140. package/src/types/message.ts +0 -145
  141. package/src/types/state.ts +0 -87
  142. package/src/types/transaction.ts +0 -69
  143. package/src/types/x402.ts +0 -251
  144. package/src/utils/ErrorRecoveryGuide.ts +0 -676
  145. package/src/utils/Helpers.ts +0 -688
  146. package/src/utils/IPFSClient.ts +0 -368
  147. package/src/utils/Logger.ts +0 -484
  148. package/src/utils/NonceManager.ts +0 -591
  149. package/src/utils/RateLimiter.ts +0 -534
  150. package/src/utils/ReceivedNonceTracker.ts +0 -567
  151. package/src/utils/SDKLifecycle.ts +0 -416
  152. package/src/utils/SecureNonce.ts +0 -78
  153. package/src/utils/Semaphore.ts +0 -276
  154. package/src/utils/UsedAttestationTracker.ts +0 -385
  155. package/src/utils/canonicalJson.ts +0 -38
  156. package/src/utils/circuitBreaker.ts +0 -324
  157. package/src/utils/computeTypeHash.ts +0 -48
  158. package/src/utils/fsSafe.ts +0 -80
  159. package/src/utils/index.ts +0 -80
  160. package/src/utils/retry.ts +0 -364
  161. package/src/utils/security.ts +0 -418
  162. package/src/utils/validation.ts +0 -540
  163. package/src/wallet/AutoWalletProvider.ts +0 -299
  164. package/src/wallet/EOAWalletProvider.ts +0 -69
  165. package/src/wallet/IWalletProvider.ts +0 -135
  166. package/src/wallet/aa/BundlerClient.ts +0 -274
  167. package/src/wallet/aa/DualNonceManager.ts +0 -173
  168. package/src/wallet/aa/PaymasterClient.ts +0 -174
  169. package/src/wallet/aa/TransactionBatcher.ts +0 -353
  170. package/src/wallet/aa/UserOpBuilder.ts +0 -246
  171. package/src/wallet/aa/constants.ts +0 -60
  172. package/src/wallet/keystore.ts +0 -240
@@ -1,237 +0,0 @@
1
- /**
2
- * Mock State Type Definitions
3
- *
4
- * These interfaces define the structure of the persistent mock blockchain state
5
- * stored in `.actp/mock-state.json`. This state is shared across CLI commands,
6
- * SDK library usage, and Dashboard.
7
- *
8
- * @module runtime/types/MockState
9
- * @see ADR-001 (Mock State Persistence Strategy)
10
- * @see MOCK_STATE_MANAGER_SPEC.md
11
- */
12
-
13
- /**
14
- * ACTP Transaction State enum matching the smart contract states.
15
- *
16
- * State machine:
17
- * - INITIATED (0) -> QUOTED (1, optional) -> COMMITTED (2) -> IN_PROGRESS (3, mandatory)
18
- * -> DELIVERED (4) -> SETTLED (5)
19
- * - Dispute path: DELIVERED -> DISPUTED (6) -> SETTLED or CANCELLED (admin)
20
- * - Cancel path: Any pre-DELIVERED state -> CANCELLED (7)
21
- *
22
- * AUDIT FIX (2026-02): IN_PROGRESS is now mandatory per contract. Direct
23
- * COMMITTED -> DELIVERED transitions are rejected on-chain.
24
- */
25
- export type TransactionState =
26
- | 'INITIATED'
27
- | 'QUOTED'
28
- | 'COMMITTED'
29
- | 'IN_PROGRESS'
30
- | 'DELIVERED'
31
- | 'SETTLED'
32
- | 'DISPUTED'
33
- | 'CANCELLED';
34
-
35
- /**
36
- * Numeric state values matching the smart contract enum.
37
- */
38
- export const TransactionStateValue: Record<TransactionState, number> = {
39
- INITIATED: 0,
40
- QUOTED: 1,
41
- COMMITTED: 2,
42
- IN_PROGRESS: 3,
43
- DELIVERED: 4,
44
- SETTLED: 5,
45
- DISPUTED: 6,
46
- CANCELLED: 7,
47
- };
48
-
49
- /**
50
- * Mock blockchain event recorded during transaction lifecycle.
51
- *
52
- * Events are stored for debugging and can be queried to simulate
53
- * blockchain event subscriptions.
54
- */
55
- export interface MockEvent {
56
- /** Event type (e.g., 'TransactionCreated', 'EscrowLinked', 'StateTransitioned') */
57
- type: string;
58
-
59
- /** Unix timestamp (seconds) when event was emitted */
60
- timestamp: number;
61
-
62
- /** Block number when event was included */
63
- blockNumber: number;
64
-
65
- /** Event-specific data payload */
66
- data: Record<string, unknown>;
67
- }
68
-
69
- /**
70
- * Mock transaction representing an ACTP transaction in the mock blockchain.
71
- *
72
- * Mirrors the on-chain Transaction struct but stored as JSON for human-readability.
73
- * BigNumber values are stored as strings to preserve precision.
74
- */
75
- export interface MockTransaction {
76
- /** Unique transaction identifier (bytes32 hex string) */
77
- id: string;
78
-
79
- /** Requester's Ethereum address (checksummed) */
80
- requester: string;
81
-
82
- /** Provider's Ethereum address (checksummed) */
83
- provider: string;
84
-
85
- /** Transaction amount in USDC wei (string for BigNumber precision, 6 decimals) */
86
- amount: string;
87
-
88
- /** Current transaction state */
89
- state: TransactionState;
90
-
91
- /** Unix timestamp (seconds) when transaction was created */
92
- createdAt: number;
93
-
94
- /** Unix timestamp (seconds) when transaction was last updated */
95
- updatedAt: number;
96
-
97
- /** Unix timestamp (seconds) deadline for transaction acceptance */
98
- deadline: number;
99
-
100
- /** Dispute window duration in seconds */
101
- disputeWindow: number;
102
-
103
- /** Unix timestamp (seconds) when transaction was completed (null if not completed) */
104
- completedAt: number | null;
105
-
106
- /** Linked escrow ID (null if not linked yet) */
107
- escrowId: string | null;
108
-
109
- /** Service description or metadata hash */
110
- serviceDescription: string;
111
-
112
- /** Delivery proof hash (null if not delivered) */
113
- deliveryProof: string | null;
114
-
115
- /** List of events emitted during transaction lifecycle */
116
- events: MockEvent[];
117
-
118
- /**
119
- * ERC-8004 agent ID (optional).
120
- * If set, can be used for reputation reporting after settlement.
121
- * Stored as string representation of uint256.
122
- */
123
- agentId?: string;
124
- }
125
-
126
- /**
127
- * Mock escrow representing funds locked for a transaction.
128
- *
129
- * In mock mode, escrow is simulated without actual token transfers.
130
- */
131
- export interface MockEscrow {
132
- /** Unique escrow identifier */
133
- id: string;
134
-
135
- /** Current escrow balance in USDC wei (string for BigNumber precision) */
136
- balance: string;
137
-
138
- /** Whether funds are currently locked (cannot be withdrawn) */
139
- locked: boolean;
140
-
141
- /** List of transaction IDs using this escrow */
142
- transactions: string[];
143
-
144
- /** Unix timestamp (seconds) when escrow was created */
145
- createdAt: number;
146
- }
147
-
148
- /**
149
- * Mock account representing a user's wallet state.
150
- *
151
- * Tracks USDC balance for testing without real tokens.
152
- */
153
- export interface MockAccount {
154
- /** Ethereum address (checksummed) */
155
- address: string;
156
-
157
- /** USDC balance in wei (string for BigNumber precision, 6 decimals) */
158
- usdcBalance: string;
159
-
160
- /** Optional label for easier identification in tests */
161
- label?: string;
162
- }
163
-
164
- /**
165
- * Mock blockchain state simulating chain parameters.
166
- *
167
- * Allows time manipulation and block progression for testing
168
- * deadline-based logic and dispute windows.
169
- */
170
- export interface MockBlockchain {
171
- /** Current simulated Unix timestamp (seconds) */
172
- currentTime: number;
173
-
174
- /** Current block number */
175
- blockNumber: number;
176
-
177
- /** Chain ID (84532 for Base Sepolia, 8453 for Base Mainnet) */
178
- chainId: number;
179
-
180
- /** Average block time in seconds (for time progression calculations) */
181
- blockTime: number;
182
- }
183
-
184
- /**
185
- * Complete mock state persisted to `.actp/mock-state.json`.
186
- *
187
- * This is the root interface for all mock blockchain state.
188
- * Loaded/saved by MockStateManager.
189
- */
190
- export interface MockState {
191
- /** State schema version (e.g., "1.0") for migrations */
192
- version: string;
193
-
194
- /** Always "mock" for mock mode */
195
- mode: 'mock';
196
-
197
- /** Simulated blockchain parameters */
198
- blockchain: MockBlockchain;
199
-
200
- /** All mock transactions indexed by transaction ID */
201
- transactions: Record<string, MockTransaction>;
202
-
203
- /** All mock escrows indexed by escrow ID */
204
- escrows: Record<string, MockEscrow>;
205
-
206
- /** All mock accounts indexed by address */
207
- accounts: Record<string, MockAccount>;
208
-
209
- /**
210
- * Global event log for all events (optional for backwards compatibility).
211
- *
212
- * SECURITY FIX (L-4): Events are now persisted to state file for
213
- * debugging and audit purposes. This allows event history to survive
214
- * across CLI invocations.
215
- */
216
- events?: MockEvent[];
217
- }
218
-
219
- /**
220
- * Default values for creating new mock state.
221
- */
222
- export const MOCK_STATE_DEFAULTS = {
223
- /** Current state schema version */
224
- VERSION: '1.0',
225
-
226
- /** Default chain ID (Base Sepolia testnet) */
227
- CHAIN_ID: 84532,
228
-
229
- /** Default starting block number */
230
- INITIAL_BLOCK_NUMBER: 1000,
231
-
232
- /** Default block time in seconds (Base L2 ~2 seconds) */
233
- BLOCK_TIME: 2,
234
-
235
- /** Default initial USDC balance for new accounts (10,000 USDC = 10_000_000_000 wei) */
236
- DEFAULT_USDC_BALANCE: '10000000000',
237
- } as const;