@agirails/sdk 2.0.3 → 2.0.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/adapters/BaseAdapter.js +2 -2
- package/dist/adapters/BaseAdapter.js.map +1 -1
- package/dist/adapters/BasicAdapter.d.ts.map +1 -1
- package/dist/adapters/BasicAdapter.js.map +1 -1
- package/dist/adapters/StandardAdapter.d.ts.map +1 -1
- package/dist/adapters/StandardAdapter.js.map +1 -1
- package/dist/builders/QuoteBuilder.js +1 -1
- package/dist/builders/QuoteBuilder.js.map +1 -1
- package/dist/cli/commands/config.js +1 -1
- package/dist/cli/commands/config.js.map +1 -1
- package/dist/cli/commands/simulate.js.map +1 -1
- package/dist/cli/commands/time.d.ts.map +1 -1
- package/dist/cli/commands/time.js.map +1 -1
- package/dist/level0/request.d.ts.map +1 -1
- package/dist/level0/request.js +1 -2
- package/dist/level0/request.js.map +1 -1
- package/dist/level1/Agent.d.ts.map +1 -1
- package/dist/level1/Agent.js.map +1 -1
- package/dist/level1/pricing/PriceCalculator.js +1 -1
- package/dist/level1/pricing/PriceCalculator.js.map +1 -1
- package/dist/level1/types/Options.d.ts.map +1 -1
- package/dist/protocol/MessageSigner.js +1 -1
- package/dist/protocol/MessageSigner.js.map +1 -1
- package/dist/protocol/ProofGenerator.d.ts.map +1 -1
- package/dist/protocol/ProofGenerator.js +1 -0
- package/dist/protocol/ProofGenerator.js.map +1 -1
- package/dist/runtime/BlockchainRuntime.d.ts +3 -3
- package/dist/runtime/BlockchainRuntime.d.ts.map +1 -1
- package/dist/runtime/BlockchainRuntime.js +3 -3
- package/dist/runtime/BlockchainRuntime.js.map +1 -1
- package/dist/runtime/MockRuntime.d.ts.map +1 -1
- package/dist/runtime/MockRuntime.js.map +1 -1
- package/dist/utils/ErrorRecoveryGuide.d.ts.map +1 -1
- package/dist/utils/ErrorRecoveryGuide.js +1 -2
- package/dist/utils/ErrorRecoveryGuide.js.map +1 -1
- package/dist/utils/UsedAttestationTracker.d.ts +1 -1
- package/dist/utils/UsedAttestationTracker.d.ts.map +1 -1
- package/dist/utils/UsedAttestationTracker.js +1 -1
- package/dist/utils/UsedAttestationTracker.js.map +1 -1
- package/package.json +1 -1
- package/src/adapters/BaseAdapter.ts +2 -2
- package/src/adapters/BasicAdapter.ts +1 -2
- package/src/adapters/StandardAdapter.ts +1 -1
- package/src/builders/QuoteBuilder.ts +1 -1
- package/src/cli/commands/config.ts +1 -1
- package/src/cli/commands/simulate.ts +1 -1
- package/src/cli/commands/time.ts +1 -2
- package/src/level0/request.ts +1 -2
- package/src/level1/Agent.ts +2 -2
- package/src/level1/pricing/PriceCalculator.ts +1 -1
- package/src/level1/types/Options.ts +1 -1
- package/src/protocol/MessageSigner.ts +1 -1
- package/src/protocol/ProofGenerator.ts +1 -0
- package/src/runtime/BlockchainRuntime.ts +3 -3
- package/src/runtime/MockRuntime.ts +0 -2
- package/src/utils/ErrorRecoveryGuide.ts +1 -2
- package/src/utils/UsedAttestationTracker.ts +1 -1
|
@@ -14,7 +14,7 @@ import { Command } from 'commander';
|
|
|
14
14
|
import { Output, ExitCode, fmt } from '../utils/output';
|
|
15
15
|
import { loadConfig } from '../utils/config';
|
|
16
16
|
import { mapError } from '../utils/client';
|
|
17
|
-
import { BaseAdapter
|
|
17
|
+
import { BaseAdapter } from '../../adapters/BaseAdapter';
|
|
18
18
|
|
|
19
19
|
// ============================================================================
|
|
20
20
|
// Command Definition
|
package/src/cli/commands/time.ts
CHANGED
|
@@ -10,10 +10,9 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { Command } from 'commander';
|
|
13
|
-
import { Output, ExitCode
|
|
13
|
+
import { Output, ExitCode } from '../utils/output';
|
|
14
14
|
import { loadConfig } from '../utils/config';
|
|
15
15
|
import { createClient, mapError } from '../utils/client';
|
|
16
|
-
import { MockRuntime } from '../../runtime/MockRuntime';
|
|
17
16
|
import { IMockRuntime } from '../../runtime/IACTPRuntime';
|
|
18
17
|
|
|
19
18
|
// ============================================================================
|
package/src/level0/request.ts
CHANGED
|
@@ -164,7 +164,6 @@ export async function request(
|
|
|
164
164
|
|
|
165
165
|
let tx = await client.runtime.getTransaction(txId);
|
|
166
166
|
let attempts = 0;
|
|
167
|
-
let timedOut = false;
|
|
168
167
|
|
|
169
168
|
while (tx && tx.state !== 'DELIVERED' && tx.state !== 'SETTLED' && attempts < maxAttempts) {
|
|
170
169
|
// Check for terminal states that indicate failure
|
|
@@ -190,7 +189,7 @@ export async function request(
|
|
|
190
189
|
|
|
191
190
|
// Check if we got a result
|
|
192
191
|
if (!tx || (tx.state !== 'DELIVERED' && tx.state !== 'SETTLED')) {
|
|
193
|
-
|
|
192
|
+
const _timedOut = true; // Flag for potential future use
|
|
194
193
|
|
|
195
194
|
// SECURITY FIX (H-3): Auto-cancel transaction on timeout if still in early state
|
|
196
195
|
// This prevents funds from being locked indefinitely if provider never responds
|
package/src/level1/Agent.ts
CHANGED
|
@@ -14,10 +14,10 @@ import * as fs from 'fs';
|
|
|
14
14
|
import { ethers } from 'ethers';
|
|
15
15
|
import { ACTPClient } from '../ACTPClient';
|
|
16
16
|
import { Job, JobHandler, JobContext } from './types/Job';
|
|
17
|
-
import {
|
|
17
|
+
import { RequestOptions, RequestResult, NetworkOption } from './types/Options';
|
|
18
18
|
import { PricingStrategy } from './pricing/PricingStrategy';
|
|
19
19
|
import { AgentLifecycleError, ServiceConfigError, ValidationError } from '../errors';
|
|
20
|
-
import { validateServiceName, validatePath,
|
|
20
|
+
import { validateServiceName, validatePath, LRUCache } from '../utils/security';
|
|
21
21
|
import { Logger } from '../utils/Logger';
|
|
22
22
|
import { ServiceHash } from '../utils/Helpers';
|
|
23
23
|
import { Semaphore } from '../utils/Semaphore';
|
|
@@ -214,7 +214,7 @@ function estimateUnits(job: Job, unit: string): number {
|
|
|
214
214
|
*
|
|
215
215
|
* @internal
|
|
216
216
|
*/
|
|
217
|
-
function estimateApiCost(
|
|
217
|
+
function estimateApiCost(_api: string, _job: Job): number {
|
|
218
218
|
// MVP: Returns 0 (API costs tracked externally by agent)
|
|
219
219
|
// V2: Integrate with OpenAI/Anthropic pricing APIs
|
|
220
220
|
|
|
@@ -157,7 +157,7 @@ export class MessageSigner {
|
|
|
157
157
|
);
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
const { type, version, from, to, timestamp, nonce, signature, ...payload } = message;
|
|
160
|
+
const { type, version, from, to, timestamp, nonce, signature: _sig, ...payload } = message;
|
|
161
161
|
|
|
162
162
|
// SECURITY FIX (H-3): Validate nonce format (must be bytes32)
|
|
163
163
|
if (!nonce || !/^0x[a-fA-F0-9]{64}$/.test(nonce)) {
|
|
@@ -892,7 +892,7 @@ export class BlockchainRuntime implements IACTPRuntime {
|
|
|
892
892
|
* @param params - Transaction parameters
|
|
893
893
|
* @returns Estimated gas limit and cost in wei
|
|
894
894
|
*/
|
|
895
|
-
async estimateCreateTransactionGas(
|
|
895
|
+
async estimateCreateTransactionGas(_params: CreateTransactionParams): Promise<{
|
|
896
896
|
gasLimit: bigint;
|
|
897
897
|
gasCostWei: bigint;
|
|
898
898
|
gasCostGwei: string;
|
|
@@ -921,7 +921,7 @@ export class BlockchainRuntime implements IACTPRuntime {
|
|
|
921
921
|
* @param txId - Transaction ID
|
|
922
922
|
* @returns Estimated gas limit and cost
|
|
923
923
|
*/
|
|
924
|
-
async estimateLinkEscrowGas(
|
|
924
|
+
async estimateLinkEscrowGas(_txId: string): Promise<{
|
|
925
925
|
gasLimit: bigint;
|
|
926
926
|
gasCostWei: bigint;
|
|
927
927
|
gasCostGwei: string;
|
|
@@ -949,7 +949,7 @@ export class BlockchainRuntime implements IACTPRuntime {
|
|
|
949
949
|
* @param newState - Target state
|
|
950
950
|
* @returns Estimated gas limit and cost
|
|
951
951
|
*/
|
|
952
|
-
async estimateTransitionGas(
|
|
952
|
+
async estimateTransitionGas(_txId: string, _newState: string): Promise<{
|
|
953
953
|
gasLimit: bigint;
|
|
954
954
|
gasCostWei: bigint;
|
|
955
955
|
gasCostGwei: string;
|
|
@@ -637,14 +637,12 @@ export async function withRecoveryGuidance<T>(
|
|
|
637
637
|
): Promise<T> {
|
|
638
638
|
const { logGuidance = false, autoRetry = false, onError } = options;
|
|
639
639
|
|
|
640
|
-
let lastError: unknown;
|
|
641
640
|
let attempts = 0;
|
|
642
641
|
|
|
643
642
|
do {
|
|
644
643
|
try {
|
|
645
644
|
return await operation();
|
|
646
645
|
} catch (error) {
|
|
647
|
-
lastError = error;
|
|
648
646
|
const recovery = ErrorRecoveryGuide.analyze(error);
|
|
649
647
|
|
|
650
648
|
if (onError) {
|
|
@@ -671,5 +669,6 @@ export async function withRecoveryGuidance<T>(
|
|
|
671
669
|
|
|
672
670
|
throw error;
|
|
673
671
|
}
|
|
672
|
+
// eslint-disable-next-line no-constant-condition
|
|
674
673
|
} while (true);
|
|
675
674
|
}
|
|
@@ -202,7 +202,7 @@ export class InMemoryUsedAttestationTracker implements IUsedAttestationTracker {
|
|
|
202
202
|
*
|
|
203
203
|
* @param maxAgeHours - Remove entries older than this many hours
|
|
204
204
|
*/
|
|
205
|
-
cleanupOldEntries(
|
|
205
|
+
cleanupOldEntries(_maxAgeHours: number): number {
|
|
206
206
|
// In-memory tracker doesn't track timestamps
|
|
207
207
|
// This is a placeholder for future enhancement
|
|
208
208
|
console.warn(
|