@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,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;