@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.
- 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/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/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 -252
- 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 -577
- 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/errors/index.ts
DELETED
|
@@ -1,427 +0,0 @@
|
|
|
1
|
-
import { State } from '../types';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Base ACTP Error
|
|
5
|
-
*/
|
|
6
|
-
export class ACTPError extends Error {
|
|
7
|
-
constructor(
|
|
8
|
-
message: string,
|
|
9
|
-
public readonly code: string,
|
|
10
|
-
public readonly txHash?: string,
|
|
11
|
-
public readonly details?: any
|
|
12
|
-
) {
|
|
13
|
-
super(message);
|
|
14
|
-
this.name = 'ACTPError';
|
|
15
|
-
// Ensure `instanceof` works for subclasses (TS + Error inheritance quirk)
|
|
16
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Transaction Errors
|
|
22
|
-
*/
|
|
23
|
-
export class InsufficientFundsError extends ACTPError {
|
|
24
|
-
constructor(required: bigint, available: bigint) {
|
|
25
|
-
super(
|
|
26
|
-
`Insufficient funds: need ${required.toString()} wei, have ${available.toString()} wei`,
|
|
27
|
-
'INSUFFICIENT_FUNDS',
|
|
28
|
-
undefined,
|
|
29
|
-
{ required: required.toString(), available: available.toString() }
|
|
30
|
-
);
|
|
31
|
-
this.name = 'InsufficientFundsError';
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export class TransactionNotFoundError extends ACTPError {
|
|
36
|
-
constructor(txId: string) {
|
|
37
|
-
super(`Transaction ${txId} not found`, 'TRANSACTION_NOT_FOUND', undefined, { txId });
|
|
38
|
-
this.name = 'TransactionNotFoundError';
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export class DeadlineExpiredError extends ACTPError {
|
|
43
|
-
constructor(txId: string, deadline: number) {
|
|
44
|
-
super(
|
|
45
|
-
`Transaction ${txId} deadline expired at ${new Date(deadline * 1000).toISOString()}`,
|
|
46
|
-
'DEADLINE_EXPIRED',
|
|
47
|
-
undefined,
|
|
48
|
-
{ txId, deadline }
|
|
49
|
-
);
|
|
50
|
-
this.name = 'DeadlineExpiredError';
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* State Machine Errors
|
|
56
|
-
*/
|
|
57
|
-
export class InvalidStateTransitionError extends ACTPError {
|
|
58
|
-
constructor(from: State, to: State, validTransitions: string[]) {
|
|
59
|
-
super(
|
|
60
|
-
`Invalid state transition: ${State[from]} → ${State[to]}. ` +
|
|
61
|
-
`Valid transitions: ${validTransitions.join(', ') || 'none (terminal state)'}`,
|
|
62
|
-
'INVALID_STATE_TRANSITION',
|
|
63
|
-
undefined,
|
|
64
|
-
{ from: State[from], to: State[to], validTransitions }
|
|
65
|
-
);
|
|
66
|
-
this.name = 'InvalidStateTransitionError';
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Signature Errors
|
|
72
|
-
*/
|
|
73
|
-
export class SignatureVerificationError extends ACTPError {
|
|
74
|
-
constructor(expectedSigner: string, recoveredSigner: string) {
|
|
75
|
-
super(
|
|
76
|
-
`Signature verification failed. Expected ${expectedSigner}, got ${recoveredSigner}`,
|
|
77
|
-
'SIGNATURE_VERIFICATION_FAILED',
|
|
78
|
-
undefined,
|
|
79
|
-
{ expectedSigner, recoveredSigner }
|
|
80
|
-
);
|
|
81
|
-
this.name = 'SignatureVerificationError';
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Blockchain Errors
|
|
87
|
-
*/
|
|
88
|
-
export class TransactionRevertedError extends ACTPError {
|
|
89
|
-
constructor(txHash: string, reason?: string) {
|
|
90
|
-
super(
|
|
91
|
-
`Transaction reverted: ${reason || 'Unknown reason'}`,
|
|
92
|
-
'TRANSACTION_REVERTED',
|
|
93
|
-
txHash,
|
|
94
|
-
{ reason }
|
|
95
|
-
);
|
|
96
|
-
this.name = 'TransactionRevertedError';
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export class NetworkError extends ACTPError {
|
|
101
|
-
constructor(network: string, message: string) {
|
|
102
|
-
super(`Network error on ${network}: ${message}`, 'NETWORK_ERROR', undefined, { network });
|
|
103
|
-
this.name = 'NetworkError';
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Validation Errors
|
|
109
|
-
*/
|
|
110
|
-
export class ValidationError extends ACTPError {
|
|
111
|
-
constructor(field: string, message: string) {
|
|
112
|
-
super(`Validation error for ${field}: ${message}`, 'VALIDATION_ERROR', undefined, { field });
|
|
113
|
-
this.name = 'ValidationError';
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export class InvalidAddressError extends ValidationError {
|
|
118
|
-
constructor(address: string) {
|
|
119
|
-
super('address', `Invalid Ethereum address: ${address}`);
|
|
120
|
-
this.name = 'InvalidAddressError';
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export class InvalidAmountError extends ValidationError {
|
|
125
|
-
constructor(amount: string) {
|
|
126
|
-
super('amount', `Invalid amount: ${amount} (must be > 0)`);
|
|
127
|
-
this.name = 'InvalidAmountError';
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Storage Errors (AIP-7)
|
|
133
|
-
*/
|
|
134
|
-
export class StorageError extends ACTPError {
|
|
135
|
-
constructor(operation: string, message: string, details?: any) {
|
|
136
|
-
super(
|
|
137
|
-
`Storage operation failed (${operation}): ${message}`,
|
|
138
|
-
'STORAGE_ERROR',
|
|
139
|
-
undefined,
|
|
140
|
-
{ operation, ...details }
|
|
141
|
-
);
|
|
142
|
-
this.name = 'StorageError';
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export class InvalidCIDError extends ValidationError {
|
|
147
|
-
constructor(cid: string, reason?: string) {
|
|
148
|
-
super('cid', `Invalid IPFS CID: ${cid}${reason ? ` (${reason})` : ''}`);
|
|
149
|
-
this.name = 'InvalidCIDError';
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export class UploadTimeoutError extends StorageError {
|
|
154
|
-
constructor(timeoutMs: number) {
|
|
155
|
-
super('upload', `Upload timed out after ${timeoutMs}ms`, { timeoutMs });
|
|
156
|
-
this.name = 'UploadTimeoutError';
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
export class DownloadTimeoutError extends StorageError {
|
|
161
|
-
constructor(cid: string, timeoutMs: number) {
|
|
162
|
-
super('download', `Download of ${cid} timed out after ${timeoutMs}ms`, { cid, timeoutMs });
|
|
163
|
-
this.name = 'DownloadTimeoutError';
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
export class FileSizeLimitExceededError extends StorageError {
|
|
168
|
-
constructor(size: number, maxSize: number) {
|
|
169
|
-
super(
|
|
170
|
-
'upload',
|
|
171
|
-
`File size ${size} bytes exceeds maximum ${maxSize} bytes`,
|
|
172
|
-
{ size, maxSize }
|
|
173
|
-
);
|
|
174
|
-
this.name = 'FileSizeLimitExceededError';
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
export class StorageAuthenticationError extends StorageError {
|
|
179
|
-
constructor(provider: string) {
|
|
180
|
-
super('authentication', `Authentication failed for ${provider}`, { provider });
|
|
181
|
-
this.name = 'StorageAuthenticationError';
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
export class StorageRateLimitError extends StorageError {
|
|
186
|
-
constructor(retryAfter?: number) {
|
|
187
|
-
super(
|
|
188
|
-
'rate-limit',
|
|
189
|
-
`Rate limit exceeded${retryAfter ? `, retry after ${retryAfter}s` : ''}`,
|
|
190
|
-
{ retryAfter }
|
|
191
|
-
);
|
|
192
|
-
this.name = 'StorageRateLimitError';
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
export class ContentNotFoundError extends StorageError {
|
|
197
|
-
constructor(cid: string) {
|
|
198
|
-
super('download', `Content not found for CID: ${cid}`, { cid });
|
|
199
|
-
this.name = 'ContentNotFoundError';
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
export class ArweaveUploadError extends StorageError {
|
|
204
|
-
constructor(message: string, details?: any) {
|
|
205
|
-
super('upload', `Arweave upload failed: ${message}`, details);
|
|
206
|
-
this.name = 'ArweaveUploadError';
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
export class ArweaveDownloadError extends StorageError {
|
|
211
|
-
constructor(txId: string, message: string) {
|
|
212
|
-
super('download', `Failed to download from Arweave (${txId}): ${message}`, { txId });
|
|
213
|
-
this.name = 'ArweaveDownloadError';
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
export class InsufficientBalanceError extends StorageError {
|
|
218
|
-
constructor(required: string, available: string, currency: string) {
|
|
219
|
-
super(
|
|
220
|
-
'funding',
|
|
221
|
-
`Insufficient Irys balance: need ${required} ${currency}, have ${available} ${currency}`,
|
|
222
|
-
{ required, available, currency }
|
|
223
|
-
);
|
|
224
|
-
this.name = 'InsufficientBalanceError';
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
export class ArweaveTimeoutError extends StorageError {
|
|
229
|
-
constructor(operation: string, timeoutMs: number) {
|
|
230
|
-
super('timeout', `Arweave ${operation} timed out after ${timeoutMs}ms`, { operation, timeoutMs });
|
|
231
|
-
this.name = 'ArweaveTimeoutError';
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
export class InvalidArweaveTxIdError extends ValidationError {
|
|
236
|
-
constructor(txId: string, reason?: string) {
|
|
237
|
-
super('txId', `Invalid Arweave transaction ID: ${txId}${reason ? ` (${reason})` : ''}`);
|
|
238
|
-
this.name = 'InvalidArweaveTxIdError';
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
export class SwapExecutionError extends StorageError {
|
|
243
|
-
constructor(message: string, details?: any) {
|
|
244
|
-
super('swap', `Swap execution failed: ${message}`, details);
|
|
245
|
-
this.name = 'SwapExecutionError';
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* Registry Query Cap Exceeded Error (L-4)
|
|
251
|
-
*
|
|
252
|
-
* Thrown when AgentRegistry.queryAgentsByService() cannot complete because
|
|
253
|
-
* the registry contains more than MAX_QUERY_AGENTS (1000) agents.
|
|
254
|
-
*
|
|
255
|
-
* ## Resolution
|
|
256
|
-
*
|
|
257
|
-
* When this error is thrown, you must migrate to an off-chain indexer:
|
|
258
|
-
*
|
|
259
|
-
* 1. **The Graph**: Deploy a subgraph indexing AgentRegistered events
|
|
260
|
-
* - https://thegraph.com/docs/en/developing/creating-a-subgraph/
|
|
261
|
-
*
|
|
262
|
-
* 2. **Goldsky**: Mirror-based indexing (faster deployment)
|
|
263
|
-
* - https://docs.goldsky.com/
|
|
264
|
-
*
|
|
265
|
-
* 3. **Alchemy Subgraphs**: Managed Graph service
|
|
266
|
-
* - https://docs.alchemy.com/docs/subgraphs-overview
|
|
267
|
-
*
|
|
268
|
-
* ## Events to Index
|
|
269
|
-
*
|
|
270
|
-
* - `AgentRegistered(address indexed agent, string did, string endpoint, uint256 timestamp)`
|
|
271
|
-
* - `ServiceTypeUpdated(address indexed agent, bytes32 serviceTypeHash, bool added, uint256 timestamp)`
|
|
272
|
-
* - `ActiveStatusUpdated(address indexed agent, bool isActive, uint256 timestamp)`
|
|
273
|
-
*
|
|
274
|
-
* @example
|
|
275
|
-
* ```typescript
|
|
276
|
-
* try {
|
|
277
|
-
* const agents = await registry.queryAgentsByService({ ... });
|
|
278
|
-
* } catch (error) {
|
|
279
|
-
* if (error instanceof QueryCapExceededError) {
|
|
280
|
-
* // Switch to off-chain indexer
|
|
281
|
-
* const agents = await myIndexer.queryAgents({ ... });
|
|
282
|
-
* }
|
|
283
|
-
* }
|
|
284
|
-
* ```
|
|
285
|
-
*/
|
|
286
|
-
export class QueryCapExceededError extends ACTPError {
|
|
287
|
-
constructor(registrySize: number, maxQueryAgents: number = 1000) {
|
|
288
|
-
super(
|
|
289
|
-
`Registry size (${registrySize}) exceeds query cap (${maxQueryAgents}). ` +
|
|
290
|
-
`On-chain queries are disabled to prevent DoS. Use an off-chain indexer instead.`,
|
|
291
|
-
'QUERY_CAP_EXCEEDED',
|
|
292
|
-
undefined,
|
|
293
|
-
{
|
|
294
|
-
registrySize,
|
|
295
|
-
maxQueryAgents,
|
|
296
|
-
solution: 'Migrate to off-chain indexer (The Graph, Goldsky, or Alchemy Subgraphs)'
|
|
297
|
-
}
|
|
298
|
-
);
|
|
299
|
-
this.name = 'QueryCapExceededError';
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
* Agent/Job Errors (Basic & Standard API)
|
|
305
|
-
*/
|
|
306
|
-
|
|
307
|
-
/**
|
|
308
|
-
* No provider found for the requested service
|
|
309
|
-
*
|
|
310
|
-
* Thrown when request() cannot find any provider offering the service.
|
|
311
|
-
*/
|
|
312
|
-
export class NoProviderFoundError extends ACTPError {
|
|
313
|
-
constructor(service: string, details?: any) {
|
|
314
|
-
super(
|
|
315
|
-
`No provider found for service "${service}". ` +
|
|
316
|
-
`Ensure at least one agent is providing this service.`,
|
|
317
|
-
'NO_PROVIDER_FOUND',
|
|
318
|
-
undefined,
|
|
319
|
-
{ service, ...details }
|
|
320
|
-
);
|
|
321
|
-
this.name = 'NoProviderFoundError';
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* Request timeout error
|
|
327
|
-
*
|
|
328
|
-
* Thrown when provider doesn't respond within the timeout period.
|
|
329
|
-
*/
|
|
330
|
-
export class TimeoutError extends ACTPError {
|
|
331
|
-
constructor(timeoutMs: number, operation?: string) {
|
|
332
|
-
super(
|
|
333
|
-
`Operation timed out after ${timeoutMs}ms${operation ? ` (${operation})` : ''}`,
|
|
334
|
-
'TIMEOUT',
|
|
335
|
-
undefined,
|
|
336
|
-
{ timeoutMs, operation }
|
|
337
|
-
);
|
|
338
|
-
this.name = 'TimeoutError';
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
* Provider rejected the job
|
|
344
|
-
*
|
|
345
|
-
* Thrown when provider explicitly rejects a job (e.g., budget too low).
|
|
346
|
-
*/
|
|
347
|
-
export class ProviderRejectedError extends ACTPError {
|
|
348
|
-
constructor(provider: string, reason?: string, details?: any) {
|
|
349
|
-
super(
|
|
350
|
-
`Provider ${provider} rejected the job${reason ? `: ${reason}` : ''}`,
|
|
351
|
-
'PROVIDER_REJECTED',
|
|
352
|
-
undefined,
|
|
353
|
-
{ provider, reason, ...details }
|
|
354
|
-
);
|
|
355
|
-
this.name = 'ProviderRejectedError';
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
* Provider failed to deliver result
|
|
361
|
-
*
|
|
362
|
-
* Thrown when provider transitions to DELIVERED but doesn't provide valid result.
|
|
363
|
-
*/
|
|
364
|
-
export class DeliveryFailedError extends ACTPError {
|
|
365
|
-
constructor(txId: string, reason?: string) {
|
|
366
|
-
super(
|
|
367
|
-
`Delivery failed for transaction ${txId}${reason ? `: ${reason}` : ''}`,
|
|
368
|
-
'DELIVERY_FAILED',
|
|
369
|
-
undefined,
|
|
370
|
-
{ txId, reason }
|
|
371
|
-
);
|
|
372
|
-
this.name = 'DeliveryFailedError';
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
/**
|
|
377
|
-
* Dispute raised on transaction
|
|
378
|
-
*
|
|
379
|
-
* Thrown when requester raises a dispute on a delivered result.
|
|
380
|
-
*/
|
|
381
|
-
export class DisputeRaisedError extends ACTPError {
|
|
382
|
-
constructor(txId: string, reason?: string) {
|
|
383
|
-
super(
|
|
384
|
-
`Dispute raised for transaction ${txId}${reason ? `: ${reason}` : ''}`,
|
|
385
|
-
'DISPUTE_RAISED',
|
|
386
|
-
undefined,
|
|
387
|
-
{ txId, reason }
|
|
388
|
-
);
|
|
389
|
-
this.name = 'DisputeRaisedError';
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
/**
|
|
394
|
-
* Service configuration error
|
|
395
|
-
*
|
|
396
|
-
* Thrown when Agent.provide() is called with invalid service configuration.
|
|
397
|
-
*/
|
|
398
|
-
export class ServiceConfigError extends ACTPError {
|
|
399
|
-
constructor(field: string, message: string, details?: any) {
|
|
400
|
-
super(
|
|
401
|
-
`Service configuration error (${field}): ${message}`,
|
|
402
|
-
'SERVICE_CONFIG_ERROR',
|
|
403
|
-
undefined,
|
|
404
|
-
{ field, ...details }
|
|
405
|
-
);
|
|
406
|
-
this.name = 'ServiceConfigError';
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
/**
|
|
411
|
-
* Agent lifecycle error
|
|
412
|
-
*
|
|
413
|
-
* Thrown when invalid agent lifecycle operations are attempted
|
|
414
|
-
* (e.g., calling start() on already running agent).
|
|
415
|
-
*/
|
|
416
|
-
export class AgentLifecycleError extends ACTPError {
|
|
417
|
-
constructor(currentState: string, attemptedAction: string) {
|
|
418
|
-
super(
|
|
419
|
-
`Cannot ${attemptedAction} agent in ${currentState} state`,
|
|
420
|
-
'AGENT_LIFECYCLE_ERROR',
|
|
421
|
-
undefined,
|
|
422
|
-
{ currentState, attemptedAction }
|
|
423
|
-
);
|
|
424
|
-
this.name = 'AgentLifecycleError';
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
|