@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.
- package/dist/ACTPClient.d.ts +18 -0
- package/dist/ACTPClient.d.ts.map +1 -1
- package/dist/ACTPClient.js +67 -22
- package/dist/ACTPClient.js.map +1 -1
- package/dist/adapters/BasicAdapter.d.ts +12 -0
- package/dist/adapters/BasicAdapter.d.ts.map +1 -1
- package/dist/adapters/BasicAdapter.js +30 -4
- package/dist/adapters/BasicAdapter.js.map +1 -1
- package/dist/adapters/StandardAdapter.d.ts +20 -3
- package/dist/adapters/StandardAdapter.d.ts.map +1 -1
- package/dist/adapters/StandardAdapter.js +45 -11
- package/dist/adapters/StandardAdapter.js.map +1 -1
- package/dist/cli/commands/publish.js +16 -4
- package/dist/cli/commands/publish.js.map +1 -1
- package/dist/cli/commands/register.js +16 -4
- package/dist/cli/commands/register.js.map +1 -1
- package/dist/cli/commands/tx.js +31 -3
- package/dist/cli/commands/tx.js.map +1 -1
- package/dist/cli/utils/client.d.ts.map +1 -1
- package/dist/cli/utils/client.js +1 -0
- package/dist/cli/utils/client.js.map +1 -1
- package/dist/config/networks.d.ts +2 -2
- package/dist/config/networks.d.ts.map +1 -1
- package/dist/config/networks.js +27 -22
- package/dist/config/networks.js.map +1 -1
- package/dist/level0/request.d.ts.map +1 -1
- package/dist/level0/request.js +2 -1
- package/dist/level0/request.js.map +1 -1
- package/dist/runtime/BlockchainRuntime.d.ts.map +1 -1
- package/dist/runtime/BlockchainRuntime.js +11 -5
- package/dist/runtime/BlockchainRuntime.js.map +1 -1
- package/dist/runtime/MockStateManager.d.ts.map +1 -1
- package/dist/runtime/MockStateManager.js +2 -1
- package/dist/runtime/MockStateManager.js.map +1 -1
- package/dist/utils/IPFSClient.d.ts +3 -1
- package/dist/utils/IPFSClient.d.ts.map +1 -1
- package/dist/utils/IPFSClient.js +27 -7
- package/dist/utils/IPFSClient.js.map +1 -1
- package/dist/wallet/AutoWalletProvider.d.ts.map +1 -1
- package/dist/wallet/AutoWalletProvider.js +52 -18
- package/dist/wallet/AutoWalletProvider.js.map +1 -1
- package/dist/wallet/SmartWalletRouter.d.ts +116 -0
- package/dist/wallet/SmartWalletRouter.d.ts.map +1 -0
- package/dist/wallet/SmartWalletRouter.js +212 -0
- package/dist/wallet/SmartWalletRouter.js.map +1 -0
- package/dist/wallet/aa/DualNonceManager.d.ts +19 -0
- package/dist/wallet/aa/DualNonceManager.d.ts.map +1 -1
- package/dist/wallet/aa/DualNonceManager.js +100 -5
- package/dist/wallet/aa/DualNonceManager.js.map +1 -1
- package/package.json +3 -6
- package/src/ACTPClient.ts +0 -1579
- package/src/abi/ACTPKernel.json +0 -1356
- package/src/abi/AgentRegistry.json +0 -915
- package/src/abi/ERC20.json +0 -40
- package/src/abi/EscrowVault.json +0 -134
- package/src/abi/IdentityRegistry.json +0 -316
- package/src/adapters/AdapterRegistry.ts +0 -173
- package/src/adapters/AdapterRouter.ts +0 -416
- package/src/adapters/BaseAdapter.ts +0 -498
- package/src/adapters/BasicAdapter.ts +0 -514
- package/src/adapters/IAdapter.ts +0 -292
- package/src/adapters/StandardAdapter.ts +0 -555
- package/src/adapters/X402Adapter.ts +0 -731
- package/src/adapters/index.ts +0 -60
- package/src/builders/DeliveryProofBuilder.ts +0 -327
- package/src/builders/QuoteBuilder.ts +0 -483
- package/src/builders/index.ts +0 -17
- package/src/cli/commands/balance.ts +0 -110
- package/src/cli/commands/batch.ts +0 -487
- package/src/cli/commands/config.ts +0 -231
- package/src/cli/commands/deploy-check.ts +0 -364
- package/src/cli/commands/deploy-env.ts +0 -120
- package/src/cli/commands/diff.ts +0 -141
- package/src/cli/commands/init.ts +0 -469
- package/src/cli/commands/mint.ts +0 -116
- package/src/cli/commands/pay.ts +0 -113
- package/src/cli/commands/publish.ts +0 -475
- package/src/cli/commands/pull.ts +0 -124
- package/src/cli/commands/register.ts +0 -247
- package/src/cli/commands/simulate.ts +0 -345
- package/src/cli/commands/time.ts +0 -302
- package/src/cli/commands/tx.ts +0 -448
- package/src/cli/commands/watch.ts +0 -211
- package/src/cli/index.ts +0 -134
- package/src/cli/utils/client.ts +0 -251
- package/src/cli/utils/config.ts +0 -389
- package/src/cli/utils/output.ts +0 -465
- package/src/cli/utils/wallet.ts +0 -109
- package/src/config/agirailsmd.ts +0 -262
- package/src/config/networks.ts +0 -275
- package/src/config/pendingPublish.ts +0 -237
- package/src/config/publishPipeline.ts +0 -359
- package/src/config/syncOperations.ts +0 -279
- package/src/erc8004/ERC8004Bridge.ts +0 -462
- package/src/erc8004/ReputationReporter.ts +0 -468
- package/src/erc8004/index.ts +0 -61
- package/src/errors/index.ts +0 -427
- package/src/index.ts +0 -364
- package/src/level0/Provider.ts +0 -117
- package/src/level0/ServiceDirectory.ts +0 -131
- package/src/level0/index.ts +0 -10
- package/src/level0/provide.ts +0 -132
- package/src/level0/request.ts +0 -432
- package/src/level1/Agent.ts +0 -1426
- package/src/level1/index.ts +0 -10
- package/src/level1/pricing/PriceCalculator.ts +0 -255
- package/src/level1/pricing/PricingStrategy.ts +0 -198
- package/src/level1/types/Job.ts +0 -179
- package/src/level1/types/Options.ts +0 -291
- package/src/level1/types/index.ts +0 -8
- package/src/protocol/ACTPKernel.ts +0 -808
- package/src/protocol/AgentRegistry.ts +0 -559
- package/src/protocol/DIDManager.ts +0 -629
- package/src/protocol/DIDResolver.ts +0 -554
- package/src/protocol/EASHelper.ts +0 -378
- package/src/protocol/EscrowVault.ts +0 -255
- package/src/protocol/EventMonitor.ts +0 -204
- package/src/protocol/MessageSigner.ts +0 -510
- package/src/protocol/ProofGenerator.ts +0 -339
- package/src/protocol/QuoteBuilder.ts +0 -15
- package/src/registry/AgentRegistryClient.ts +0 -202
- package/src/runtime/BlockchainRuntime.ts +0 -1015
- package/src/runtime/IACTPRuntime.ts +0 -306
- package/src/runtime/MockRuntime.ts +0 -1298
- package/src/runtime/MockStateManager.ts +0 -576
- package/src/runtime/index.ts +0 -25
- package/src/runtime/types/MockState.ts +0 -237
- package/src/storage/ArchiveBundleBuilder.ts +0 -561
- package/src/storage/ArweaveClient.ts +0 -946
- package/src/storage/FilebaseClient.ts +0 -790
- package/src/storage/index.ts +0 -96
- package/src/storage/types.ts +0 -348
- package/src/types/adapter.ts +0 -310
- package/src/types/agent.ts +0 -79
- package/src/types/did.ts +0 -223
- package/src/types/eip712.ts +0 -175
- package/src/types/erc8004.ts +0 -293
- package/src/types/escrow.ts +0 -27
- package/src/types/index.ts +0 -17
- package/src/types/message.ts +0 -145
- package/src/types/state.ts +0 -87
- package/src/types/transaction.ts +0 -69
- package/src/types/x402.ts +0 -251
- package/src/utils/ErrorRecoveryGuide.ts +0 -676
- package/src/utils/Helpers.ts +0 -688
- package/src/utils/IPFSClient.ts +0 -368
- package/src/utils/Logger.ts +0 -484
- package/src/utils/NonceManager.ts +0 -591
- package/src/utils/RateLimiter.ts +0 -534
- package/src/utils/ReceivedNonceTracker.ts +0 -567
- package/src/utils/SDKLifecycle.ts +0 -416
- package/src/utils/SecureNonce.ts +0 -78
- package/src/utils/Semaphore.ts +0 -276
- package/src/utils/UsedAttestationTracker.ts +0 -385
- package/src/utils/canonicalJson.ts +0 -38
- package/src/utils/circuitBreaker.ts +0 -324
- package/src/utils/computeTypeHash.ts +0 -48
- package/src/utils/fsSafe.ts +0 -80
- package/src/utils/index.ts +0 -80
- package/src/utils/retry.ts +0 -364
- package/src/utils/security.ts +0 -418
- package/src/utils/validation.ts +0 -540
- package/src/wallet/AutoWalletProvider.ts +0 -299
- package/src/wallet/EOAWalletProvider.ts +0 -69
- package/src/wallet/IWalletProvider.ts +0 -135
- package/src/wallet/aa/BundlerClient.ts +0 -274
- package/src/wallet/aa/DualNonceManager.ts +0 -173
- package/src/wallet/aa/PaymasterClient.ts +0 -174
- package/src/wallet/aa/TransactionBatcher.ts +0 -353
- package/src/wallet/aa/UserOpBuilder.ts +0 -246
- package/src/wallet/aa/constants.ts +0 -60
- package/src/wallet/keystore.ts +0 -240
package/src/cli/commands/time.ts
DELETED
|
@@ -1,302 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Time Command - Manipulate mock blockchain time
|
|
3
|
-
*
|
|
4
|
-
* Mock mode only feature for testing time-dependent logic:
|
|
5
|
-
* - Deadline expiration
|
|
6
|
-
* - Dispute window progression
|
|
7
|
-
* - Time-based state transitions
|
|
8
|
-
*
|
|
9
|
-
* @module cli/commands/time
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { Command } from 'commander';
|
|
13
|
-
import { Output, ExitCode } from '../utils/output';
|
|
14
|
-
import { loadConfig } from '../utils/config';
|
|
15
|
-
import { createClient, mapError } from '../utils/client';
|
|
16
|
-
import { IMockRuntime } from '../../runtime/IACTPRuntime';
|
|
17
|
-
|
|
18
|
-
// ============================================================================
|
|
19
|
-
// Command Definition
|
|
20
|
-
// ============================================================================
|
|
21
|
-
|
|
22
|
-
export function createTimeCommand(): Command {
|
|
23
|
-
const cmd = new Command('time')
|
|
24
|
-
.description('Manipulate mock blockchain time (mock mode only)');
|
|
25
|
-
|
|
26
|
-
cmd.addCommand(createTimeShowCommand());
|
|
27
|
-
cmd.addCommand(createTimeAdvanceCommand());
|
|
28
|
-
cmd.addCommand(createTimeSetCommand());
|
|
29
|
-
|
|
30
|
-
return cmd;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// ============================================================================
|
|
34
|
-
// time show
|
|
35
|
-
// ============================================================================
|
|
36
|
-
|
|
37
|
-
function createTimeShowCommand(): Command {
|
|
38
|
-
return new Command('show')
|
|
39
|
-
.description('Show current mock blockchain time')
|
|
40
|
-
.option('--json', 'Output as JSON')
|
|
41
|
-
.option('-q, --quiet', 'Output only the timestamp')
|
|
42
|
-
.action(async (options) => {
|
|
43
|
-
const output = new Output(
|
|
44
|
-
options.json ? 'json' : options.quiet ? 'quiet' : 'human'
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
try {
|
|
48
|
-
validateMockMode();
|
|
49
|
-
|
|
50
|
-
const client = await createClient();
|
|
51
|
-
const runtime = client.runtime as IMockRuntime;
|
|
52
|
-
const currentTime = runtime.time.now();
|
|
53
|
-
|
|
54
|
-
if (options.quiet) {
|
|
55
|
-
console.log(currentTime);
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
output.result({
|
|
60
|
-
timestamp: currentTime,
|
|
61
|
-
iso: new Date(currentTime * 1000).toISOString(),
|
|
62
|
-
readable: formatRelativeTime(currentTime),
|
|
63
|
-
});
|
|
64
|
-
} catch (error) {
|
|
65
|
-
const structuredError = mapError(error);
|
|
66
|
-
output.errorResult({
|
|
67
|
-
code: structuredError.code,
|
|
68
|
-
message: structuredError.message,
|
|
69
|
-
});
|
|
70
|
-
process.exit(ExitCode.ERROR);
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// ============================================================================
|
|
76
|
-
// time advance
|
|
77
|
-
// ============================================================================
|
|
78
|
-
|
|
79
|
-
function createTimeAdvanceCommand(): Command {
|
|
80
|
-
return new Command('advance')
|
|
81
|
-
.description('Advance mock blockchain time')
|
|
82
|
-
.argument('<duration>', 'Duration to advance (e.g., "1h", "30m", "7d", "3600")')
|
|
83
|
-
.option('--json', 'Output as JSON')
|
|
84
|
-
.option('-q, --quiet', 'Minimal output')
|
|
85
|
-
.action(async (duration, options) => {
|
|
86
|
-
const output = new Output(
|
|
87
|
-
options.json ? 'json' : options.quiet ? 'quiet' : 'human'
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
try {
|
|
91
|
-
validateMockMode();
|
|
92
|
-
|
|
93
|
-
const seconds = parseDuration(duration);
|
|
94
|
-
if (seconds <= 0) {
|
|
95
|
-
throw new Error('Duration must be positive');
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const client = await createClient();
|
|
99
|
-
const runtime = client.runtime as IMockRuntime;
|
|
100
|
-
|
|
101
|
-
const beforeTime = runtime.time.now();
|
|
102
|
-
await runtime.time.advanceTime(seconds);
|
|
103
|
-
const afterTime = runtime.time.now();
|
|
104
|
-
|
|
105
|
-
output.result({
|
|
106
|
-
advanced: seconds,
|
|
107
|
-
advancedReadable: formatDuration(seconds),
|
|
108
|
-
beforeTimestamp: beforeTime,
|
|
109
|
-
afterTimestamp: afterTime,
|
|
110
|
-
afterIso: new Date(afterTime * 1000).toISOString(),
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
output.success(`Advanced time by ${formatDuration(seconds)}`);
|
|
114
|
-
} catch (error) {
|
|
115
|
-
const structuredError = mapError(error);
|
|
116
|
-
output.errorResult({
|
|
117
|
-
code: structuredError.code,
|
|
118
|
-
message: structuredError.message,
|
|
119
|
-
});
|
|
120
|
-
process.exit(ExitCode.ERROR);
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// ============================================================================
|
|
126
|
-
// time set
|
|
127
|
-
// ============================================================================
|
|
128
|
-
|
|
129
|
-
function createTimeSetCommand(): Command {
|
|
130
|
-
return new Command('set')
|
|
131
|
-
.description('Set mock blockchain time to specific timestamp')
|
|
132
|
-
.argument('<timestamp>', 'Unix timestamp or ISO date')
|
|
133
|
-
.option('--json', 'Output as JSON')
|
|
134
|
-
.option('-q, --quiet', 'Minimal output')
|
|
135
|
-
.action(async (timestamp, options) => {
|
|
136
|
-
const output = new Output(
|
|
137
|
-
options.json ? 'json' : options.quiet ? 'quiet' : 'human'
|
|
138
|
-
);
|
|
139
|
-
|
|
140
|
-
try {
|
|
141
|
-
validateMockMode();
|
|
142
|
-
|
|
143
|
-
const targetTime = parseTimestamp(timestamp);
|
|
144
|
-
|
|
145
|
-
const client = await createClient();
|
|
146
|
-
const runtime = client.runtime as IMockRuntime;
|
|
147
|
-
|
|
148
|
-
const beforeTime = runtime.time.now();
|
|
149
|
-
|
|
150
|
-
if (targetTime < beforeTime) {
|
|
151
|
-
throw new Error(
|
|
152
|
-
'Cannot set time in the past.\n' +
|
|
153
|
-
`Current time: ${beforeTime}\n` +
|
|
154
|
-
`Target time: ${targetTime}`
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
await runtime.time.setTime(targetTime);
|
|
159
|
-
|
|
160
|
-
output.result({
|
|
161
|
-
beforeTimestamp: beforeTime,
|
|
162
|
-
afterTimestamp: targetTime,
|
|
163
|
-
afterIso: new Date(targetTime * 1000).toISOString(),
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
output.success(`Set time to ${new Date(targetTime * 1000).toISOString()}`);
|
|
167
|
-
} catch (error) {
|
|
168
|
-
const structuredError = mapError(error);
|
|
169
|
-
output.errorResult({
|
|
170
|
-
code: structuredError.code,
|
|
171
|
-
message: structuredError.message,
|
|
172
|
-
});
|
|
173
|
-
process.exit(ExitCode.ERROR);
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
// ============================================================================
|
|
179
|
-
// Helpers
|
|
180
|
-
// ============================================================================
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Validate that we're in mock mode
|
|
184
|
-
*/
|
|
185
|
-
function validateMockMode(): void {
|
|
186
|
-
const config = loadConfig();
|
|
187
|
-
if (config.mode !== 'mock') {
|
|
188
|
-
throw new Error(
|
|
189
|
-
'Time commands only available in mock mode.\n' +
|
|
190
|
-
`Current mode: ${config.mode}`
|
|
191
|
-
);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Parse duration string to seconds
|
|
197
|
-
*
|
|
198
|
-
* Supports:
|
|
199
|
-
* - "30s" - 30 seconds
|
|
200
|
-
* - "5m" - 5 minutes
|
|
201
|
-
* - "2h" - 2 hours
|
|
202
|
-
* - "7d" - 7 days
|
|
203
|
-
* - "3600" - raw seconds
|
|
204
|
-
*/
|
|
205
|
-
function parseDuration(duration: string): number {
|
|
206
|
-
// Raw number (seconds)
|
|
207
|
-
if (/^\d+$/.test(duration)) {
|
|
208
|
-
return parseInt(duration, 10);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// Duration with unit
|
|
212
|
-
const match = duration.match(/^(\d+(?:\.\d+)?)(s|m|h|d)$/);
|
|
213
|
-
if (!match) {
|
|
214
|
-
throw new Error(
|
|
215
|
-
`Invalid duration format: "${duration}"\n` +
|
|
216
|
-
'Expected format: "30s", "5m", "2h", "7d", or raw seconds'
|
|
217
|
-
);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
const [, valueStr, unit] = match;
|
|
221
|
-
const value = parseFloat(valueStr);
|
|
222
|
-
|
|
223
|
-
switch (unit) {
|
|
224
|
-
case 's':
|
|
225
|
-
return Math.floor(value);
|
|
226
|
-
case 'm':
|
|
227
|
-
return Math.floor(value * 60);
|
|
228
|
-
case 'h':
|
|
229
|
-
return Math.floor(value * 3600);
|
|
230
|
-
case 'd':
|
|
231
|
-
return Math.floor(value * 86400);
|
|
232
|
-
default:
|
|
233
|
-
throw new Error(`Unknown unit: ${unit}`);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* Parse timestamp string (Unix timestamp or ISO date)
|
|
239
|
-
*/
|
|
240
|
-
function parseTimestamp(timestamp: string): number {
|
|
241
|
-
// Unix timestamp (number)
|
|
242
|
-
if (/^\d+$/.test(timestamp)) {
|
|
243
|
-
return parseInt(timestamp, 10);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
// ISO date string
|
|
247
|
-
const date = new Date(timestamp);
|
|
248
|
-
if (isNaN(date.getTime())) {
|
|
249
|
-
throw new Error(
|
|
250
|
-
`Invalid timestamp: "${timestamp}"\n` +
|
|
251
|
-
'Expected Unix timestamp or ISO date (e.g., "2025-12-31T23:59:59Z")'
|
|
252
|
-
);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
return Math.floor(date.getTime() / 1000);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* Format seconds as human-readable duration
|
|
260
|
-
*/
|
|
261
|
-
function formatDuration(seconds: number): string {
|
|
262
|
-
if (seconds < 60) {
|
|
263
|
-
return `${seconds}s`;
|
|
264
|
-
}
|
|
265
|
-
if (seconds < 3600) {
|
|
266
|
-
const minutes = Math.floor(seconds / 60);
|
|
267
|
-
const secs = seconds % 60;
|
|
268
|
-
return secs > 0 ? `${minutes}m ${secs}s` : `${minutes}m`;
|
|
269
|
-
}
|
|
270
|
-
if (seconds < 86400) {
|
|
271
|
-
const hours = Math.floor(seconds / 3600);
|
|
272
|
-
const minutes = Math.floor((seconds % 3600) / 60);
|
|
273
|
-
return minutes > 0 ? `${hours}h ${minutes}m` : `${hours}h`;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
const days = Math.floor(seconds / 86400);
|
|
277
|
-
const hours = Math.floor((seconds % 86400) / 3600);
|
|
278
|
-
return hours > 0 ? `${days}d ${hours}h` : `${days}d`;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* Format timestamp as relative time
|
|
283
|
-
*/
|
|
284
|
-
function formatRelativeTime(timestamp: number): string {
|
|
285
|
-
const now = Math.floor(Date.now() / 1000);
|
|
286
|
-
const diff = timestamp - now;
|
|
287
|
-
|
|
288
|
-
if (Math.abs(diff) < 60) {
|
|
289
|
-
return diff >= 0 ? 'just now' : 'just now';
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
const absDiff = Math.abs(diff);
|
|
293
|
-
const formatted = formatDuration(absDiff);
|
|
294
|
-
|
|
295
|
-
if (diff > 0) {
|
|
296
|
-
return `${formatted} in the future`;
|
|
297
|
-
} else {
|
|
298
|
-
return `${formatted} in the past`;
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
export { parseDuration, formatDuration };
|