@exagent/agent 0.1.36 → 0.1.37
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/chunk-FAFMOHYQ.mjs +5873 -0
- package/dist/chunk-H7HKHVR7.mjs +5873 -0
- package/dist/chunk-O76YFRK5.mjs +5873 -0
- package/dist/cli.js +13 -12
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +16 -4
- package/dist/index.d.ts +16 -4
- package/dist/index.js +13 -12
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -2551,13 +2551,10 @@ var VAULT_ABI = [
|
|
|
2551
2551
|
];
|
|
2552
2552
|
var VaultManager = class {
|
|
2553
2553
|
config;
|
|
2554
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2555
2554
|
publicClient;
|
|
2556
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2557
2555
|
walletClient;
|
|
2558
2556
|
addresses;
|
|
2559
2557
|
account;
|
|
2560
|
-
chain;
|
|
2561
2558
|
cachedVaultAddress = null;
|
|
2562
2559
|
lastVaultCheck = 0;
|
|
2563
2560
|
VAULT_CACHE_TTL = 6e4;
|
|
@@ -2567,16 +2564,15 @@ var VaultManager = class {
|
|
|
2567
2564
|
this.config = config;
|
|
2568
2565
|
this.addresses = ADDRESSES[config.network];
|
|
2569
2566
|
this.account = (0, import_accounts.privateKeyToAccount)(config.walletKey);
|
|
2570
|
-
this.chain = import_chains2.base;
|
|
2571
2567
|
const rpcUrl = getRpcUrl();
|
|
2572
2568
|
const transport = (0, import_viem3.http)(rpcUrl, { timeout: 6e4 });
|
|
2573
2569
|
this.publicClient = (0, import_viem3.createPublicClient)({
|
|
2574
|
-
chain:
|
|
2570
|
+
chain: import_chains2.base,
|
|
2575
2571
|
transport
|
|
2576
2572
|
});
|
|
2577
2573
|
this.walletClient = (0, import_viem3.createWalletClient)({
|
|
2578
2574
|
account: this.account,
|
|
2579
|
-
chain:
|
|
2575
|
+
chain: import_chains2.base,
|
|
2580
2576
|
transport
|
|
2581
2577
|
});
|
|
2582
2578
|
if (this.addresses.vaultFactory === "0x0000000000000000000000000000000000000000") {
|
|
@@ -2715,7 +2711,7 @@ var VaultManager = class {
|
|
|
2715
2711
|
vaultSymbol,
|
|
2716
2712
|
feeRecipient
|
|
2717
2713
|
],
|
|
2718
|
-
chain:
|
|
2714
|
+
chain: import_chains2.base,
|
|
2719
2715
|
account: this.account
|
|
2720
2716
|
});
|
|
2721
2717
|
const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
|
|
@@ -2763,7 +2759,7 @@ var VaultManager = class {
|
|
|
2763
2759
|
params.swapData,
|
|
2764
2760
|
deadline
|
|
2765
2761
|
],
|
|
2766
|
-
chain:
|
|
2762
|
+
chain: import_chains2.base,
|
|
2767
2763
|
account: this.account
|
|
2768
2764
|
});
|
|
2769
2765
|
return { usedVault: true, txHash: hash };
|
|
@@ -3660,11 +3656,8 @@ var ROUTER_ABI = [
|
|
|
3660
3656
|
var MAX_RETRIES = 3;
|
|
3661
3657
|
var RETRY_DELAY_MS = 5e3;
|
|
3662
3658
|
var PerpTradeRecorder = class {
|
|
3663
|
-
// Use `any` for viem client types to avoid L2 chain type conflicts (Base has "deposit" tx type)
|
|
3664
3659
|
publicClient;
|
|
3665
|
-
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
3666
3660
|
walletClient;
|
|
3667
|
-
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
3668
3661
|
account;
|
|
3669
3662
|
agentId;
|
|
3670
3663
|
configHash;
|
|
@@ -3995,6 +3988,14 @@ var PerpOnboarding = class {
|
|
|
3995
3988
|
var import_viem6 = require("viem");
|
|
3996
3989
|
var import_chains4 = require("viem/chains");
|
|
3997
3990
|
var import_accounts3 = require("viem/accounts");
|
|
3991
|
+
var hyperEVM = (0, import_viem6.defineChain)({
|
|
3992
|
+
id: 999,
|
|
3993
|
+
name: "HyperEVM",
|
|
3994
|
+
nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 },
|
|
3995
|
+
rpcUrls: {
|
|
3996
|
+
default: { http: ["https://rpc.hyperliquid.xyz/evm"] }
|
|
3997
|
+
}
|
|
3998
|
+
});
|
|
3998
3999
|
var ERC20_ABI = (0, import_viem6.parseAbi)([
|
|
3999
4000
|
"function approve(address spender, uint256 amount) external returns (bool)",
|
|
4000
4001
|
"function balanceOf(address account) external view returns (uint256)",
|
|
@@ -4197,7 +4198,7 @@ function loadSecureEnv(basePath, passphrase) {
|
|
|
4197
4198
|
}
|
|
4198
4199
|
|
|
4199
4200
|
// src/index.ts
|
|
4200
|
-
var AGENT_VERSION = "0.1.
|
|
4201
|
+
var AGENT_VERSION = "0.1.37";
|
|
4201
4202
|
|
|
4202
4203
|
// src/relay.ts
|
|
4203
4204
|
var RelayClient = class {
|
package/dist/cli.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { Address, Hash, PublicClient, WalletClient } from 'viem';
|
|
2
|
+
import { Address, Hash, PublicClient, HttpTransport, WalletClient } from 'viem';
|
|
3
3
|
import { ExagentClient } from '@exagent/sdk';
|
|
4
|
+
import { base } from 'viem/chains';
|
|
4
5
|
|
|
5
6
|
/** Risk state persisted across restarts */
|
|
6
7
|
interface RiskState {
|
|
@@ -616,7 +617,6 @@ declare class VaultManager {
|
|
|
616
617
|
private readonly walletClient;
|
|
617
618
|
private readonly addresses;
|
|
618
619
|
private readonly account;
|
|
619
|
-
private readonly chain;
|
|
620
620
|
private cachedVaultAddress;
|
|
621
621
|
private lastVaultCheck;
|
|
622
622
|
private readonly VAULT_CACHE_TTL;
|
|
@@ -1446,7 +1446,7 @@ declare class TokenResolver {
|
|
|
1446
1446
|
private store;
|
|
1447
1447
|
private cache;
|
|
1448
1448
|
private unresolvable;
|
|
1449
|
-
constructor(client:
|
|
1449
|
+
constructor(client: BasePublicClient, store?: StrategyStore);
|
|
1450
1450
|
/**
|
|
1451
1451
|
* Get decimals for a token (synchronous).
|
|
1452
1452
|
* Returns undefined if the token has never been resolved and is not hardcoded.
|
|
@@ -1495,6 +1495,18 @@ declare class TokenResolver {
|
|
|
1495
1495
|
private persistUnresolvable;
|
|
1496
1496
|
}
|
|
1497
1497
|
|
|
1498
|
+
/**
|
|
1499
|
+
* Properly typed viem client for Base chain.
|
|
1500
|
+
*
|
|
1501
|
+
* viem's `createPublicClient({ chain: base })` returns a chain-specific type
|
|
1502
|
+
* that includes OP Stack deposit transaction serializers. The generic
|
|
1503
|
+
* `PublicClient` type (= `PublicClient<Transport, Chain | undefined>`) is
|
|
1504
|
+
* invariant in its chain parameter, so the return value is NOT assignable to
|
|
1505
|
+
* it without a cast. Using the exact parameterized type avoids the cast and
|
|
1506
|
+
* keeps full type safety.
|
|
1507
|
+
*/
|
|
1508
|
+
type BasePublicClient = PublicClient<HttpTransport, typeof base>;
|
|
1509
|
+
|
|
1498
1510
|
/**
|
|
1499
1511
|
* Market Data Service
|
|
1500
1512
|
* Fetches real prices from CoinGecko and on-chain balances for strategy analysis.
|
|
@@ -2191,6 +2203,6 @@ declare function decryptEnvFile(encPath: string, passphrase: string): Record<str
|
|
|
2191
2203
|
declare function loadSecureEnv(basePath: string, passphrase?: string): boolean;
|
|
2192
2204
|
|
|
2193
2205
|
/** @exagent/agent package version — update alongside package.json */
|
|
2194
|
-
declare const AGENT_VERSION = "0.1.
|
|
2206
|
+
declare const AGENT_VERSION = "0.1.37";
|
|
2195
2207
|
|
|
2196
2208
|
export { AGENT_VERSION, type AccountSummary, type AgentConfig, AgentConfigSchema, type AgentMode, AgentRuntime, type AgentStatusPayload, AnthropicAdapter, BaseLLMAdapter, type CommandType, DeepSeekAdapter, FileStore, type FillCallback, type FundingCallback, type FundingPayment, GoogleAdapter, GroqAdapter, HYPERLIQUID_DOMAIN, HyperliquidClient, HyperliquidSigner, HyperliquidWebSocket, type LLMAdapter, type LLMConfig, LLMConfigSchema, type LLMMessage, type LLMMetadata, type LLMProvider, LLMProviderSchema, type LLMResponse, type LiquidationCallback, type MarketData, MarketDataService, type MessageLevel, type MessageType, MistralAdapter, OllamaAdapter, type OnboardingStatus, OpenAIAdapter, OrderManager, type OrderResult, type PerpAction, type PerpConfig$1 as PerpConfig, PerpConfigSchema, type PerpFill, type PerpMarketData, PerpOnboarding, type PerpPosition, type PerpStrategyFunction, PerpTradeRecorder, type PerpTradeSignal, type PerpConfig as PerpTradingConfig, PositionManager, type PositionSummary, PositionTracker, type RecordPerpTradeParams, RelayClient, type RelayCommand, type RelayConfig$1 as RelayConfig, RelayConfigSchema, RiskManager, type RiskState, type RiskUniverse, RiskUniverseSchema, type RuntimeConfig, STRATEGY_TEMPLATES, type StrategyContext, type StrategyFunction, type StrategyStore, type StrategyTemplate, TogetherAdapter, type TrackedPosition, TradeExecutor, type TradeRecord, type TradeSignal, type TradingConfig, TradingConfigSchema, type VaultConfig, VaultConfigSchema, VaultManager, type VaultManagerConfig, type VaultPolicy, VaultPolicySchema, type VaultStatus, createLLMAdapter, createSampleConfig, decryptEnvFile, encryptEnvFile, fillHashToBytes32, fillOidToBytes32, getAllStrategyTemplates, getNextNonce, getStrategyTemplate, loadConfig, loadSecureEnv, loadStrategy, validateConfig, validateStrategy };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { Address, Hash, PublicClient, WalletClient } from 'viem';
|
|
2
|
+
import { Address, Hash, PublicClient, HttpTransport, WalletClient } from 'viem';
|
|
3
3
|
import { ExagentClient } from '@exagent/sdk';
|
|
4
|
+
import { base } from 'viem/chains';
|
|
4
5
|
|
|
5
6
|
/** Risk state persisted across restarts */
|
|
6
7
|
interface RiskState {
|
|
@@ -616,7 +617,6 @@ declare class VaultManager {
|
|
|
616
617
|
private readonly walletClient;
|
|
617
618
|
private readonly addresses;
|
|
618
619
|
private readonly account;
|
|
619
|
-
private readonly chain;
|
|
620
620
|
private cachedVaultAddress;
|
|
621
621
|
private lastVaultCheck;
|
|
622
622
|
private readonly VAULT_CACHE_TTL;
|
|
@@ -1446,7 +1446,7 @@ declare class TokenResolver {
|
|
|
1446
1446
|
private store;
|
|
1447
1447
|
private cache;
|
|
1448
1448
|
private unresolvable;
|
|
1449
|
-
constructor(client:
|
|
1449
|
+
constructor(client: BasePublicClient, store?: StrategyStore);
|
|
1450
1450
|
/**
|
|
1451
1451
|
* Get decimals for a token (synchronous).
|
|
1452
1452
|
* Returns undefined if the token has never been resolved and is not hardcoded.
|
|
@@ -1495,6 +1495,18 @@ declare class TokenResolver {
|
|
|
1495
1495
|
private persistUnresolvable;
|
|
1496
1496
|
}
|
|
1497
1497
|
|
|
1498
|
+
/**
|
|
1499
|
+
* Properly typed viem client for Base chain.
|
|
1500
|
+
*
|
|
1501
|
+
* viem's `createPublicClient({ chain: base })` returns a chain-specific type
|
|
1502
|
+
* that includes OP Stack deposit transaction serializers. The generic
|
|
1503
|
+
* `PublicClient` type (= `PublicClient<Transport, Chain | undefined>`) is
|
|
1504
|
+
* invariant in its chain parameter, so the return value is NOT assignable to
|
|
1505
|
+
* it without a cast. Using the exact parameterized type avoids the cast and
|
|
1506
|
+
* keeps full type safety.
|
|
1507
|
+
*/
|
|
1508
|
+
type BasePublicClient = PublicClient<HttpTransport, typeof base>;
|
|
1509
|
+
|
|
1498
1510
|
/**
|
|
1499
1511
|
* Market Data Service
|
|
1500
1512
|
* Fetches real prices from CoinGecko and on-chain balances for strategy analysis.
|
|
@@ -2191,6 +2203,6 @@ declare function decryptEnvFile(encPath: string, passphrase: string): Record<str
|
|
|
2191
2203
|
declare function loadSecureEnv(basePath: string, passphrase?: string): boolean;
|
|
2192
2204
|
|
|
2193
2205
|
/** @exagent/agent package version — update alongside package.json */
|
|
2194
|
-
declare const AGENT_VERSION = "0.1.
|
|
2206
|
+
declare const AGENT_VERSION = "0.1.37";
|
|
2195
2207
|
|
|
2196
2208
|
export { AGENT_VERSION, type AccountSummary, type AgentConfig, AgentConfigSchema, type AgentMode, AgentRuntime, type AgentStatusPayload, AnthropicAdapter, BaseLLMAdapter, type CommandType, DeepSeekAdapter, FileStore, type FillCallback, type FundingCallback, type FundingPayment, GoogleAdapter, GroqAdapter, HYPERLIQUID_DOMAIN, HyperliquidClient, HyperliquidSigner, HyperliquidWebSocket, type LLMAdapter, type LLMConfig, LLMConfigSchema, type LLMMessage, type LLMMetadata, type LLMProvider, LLMProviderSchema, type LLMResponse, type LiquidationCallback, type MarketData, MarketDataService, type MessageLevel, type MessageType, MistralAdapter, OllamaAdapter, type OnboardingStatus, OpenAIAdapter, OrderManager, type OrderResult, type PerpAction, type PerpConfig$1 as PerpConfig, PerpConfigSchema, type PerpFill, type PerpMarketData, PerpOnboarding, type PerpPosition, type PerpStrategyFunction, PerpTradeRecorder, type PerpTradeSignal, type PerpConfig as PerpTradingConfig, PositionManager, type PositionSummary, PositionTracker, type RecordPerpTradeParams, RelayClient, type RelayCommand, type RelayConfig$1 as RelayConfig, RelayConfigSchema, RiskManager, type RiskState, type RiskUniverse, RiskUniverseSchema, type RuntimeConfig, STRATEGY_TEMPLATES, type StrategyContext, type StrategyFunction, type StrategyStore, type StrategyTemplate, TogetherAdapter, type TrackedPosition, TradeExecutor, type TradeRecord, type TradeSignal, type TradingConfig, TradingConfigSchema, type VaultConfig, VaultConfigSchema, VaultManager, type VaultManagerConfig, type VaultPolicy, VaultPolicySchema, type VaultStatus, createLLMAdapter, createSampleConfig, decryptEnvFile, encryptEnvFile, fillHashToBytes32, fillOidToBytes32, getAllStrategyTemplates, getNextNonce, getStrategyTemplate, loadConfig, loadSecureEnv, loadStrategy, validateConfig, validateStrategy };
|
package/dist/index.js
CHANGED
|
@@ -2639,13 +2639,10 @@ var VAULT_ABI = [
|
|
|
2639
2639
|
];
|
|
2640
2640
|
var VaultManager = class {
|
|
2641
2641
|
config;
|
|
2642
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2643
2642
|
publicClient;
|
|
2644
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2645
2643
|
walletClient;
|
|
2646
2644
|
addresses;
|
|
2647
2645
|
account;
|
|
2648
|
-
chain;
|
|
2649
2646
|
cachedVaultAddress = null;
|
|
2650
2647
|
lastVaultCheck = 0;
|
|
2651
2648
|
VAULT_CACHE_TTL = 6e4;
|
|
@@ -2655,16 +2652,15 @@ var VaultManager = class {
|
|
|
2655
2652
|
this.config = config;
|
|
2656
2653
|
this.addresses = ADDRESSES[config.network];
|
|
2657
2654
|
this.account = (0, import_accounts.privateKeyToAccount)(config.walletKey);
|
|
2658
|
-
this.chain = import_chains2.base;
|
|
2659
2655
|
const rpcUrl = getRpcUrl();
|
|
2660
2656
|
const transport = (0, import_viem3.http)(rpcUrl, { timeout: 6e4 });
|
|
2661
2657
|
this.publicClient = (0, import_viem3.createPublicClient)({
|
|
2662
|
-
chain:
|
|
2658
|
+
chain: import_chains2.base,
|
|
2663
2659
|
transport
|
|
2664
2660
|
});
|
|
2665
2661
|
this.walletClient = (0, import_viem3.createWalletClient)({
|
|
2666
2662
|
account: this.account,
|
|
2667
|
-
chain:
|
|
2663
|
+
chain: import_chains2.base,
|
|
2668
2664
|
transport
|
|
2669
2665
|
});
|
|
2670
2666
|
if (this.addresses.vaultFactory === "0x0000000000000000000000000000000000000000") {
|
|
@@ -2803,7 +2799,7 @@ var VaultManager = class {
|
|
|
2803
2799
|
vaultSymbol,
|
|
2804
2800
|
feeRecipient
|
|
2805
2801
|
],
|
|
2806
|
-
chain:
|
|
2802
|
+
chain: import_chains2.base,
|
|
2807
2803
|
account: this.account
|
|
2808
2804
|
});
|
|
2809
2805
|
const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
|
|
@@ -2851,7 +2847,7 @@ var VaultManager = class {
|
|
|
2851
2847
|
params.swapData,
|
|
2852
2848
|
deadline
|
|
2853
2849
|
],
|
|
2854
|
-
chain:
|
|
2850
|
+
chain: import_chains2.base,
|
|
2855
2851
|
account: this.account
|
|
2856
2852
|
});
|
|
2857
2853
|
return { usedVault: true, txHash: hash };
|
|
@@ -4013,11 +4009,8 @@ var ROUTER_ABI = [
|
|
|
4013
4009
|
var MAX_RETRIES = 3;
|
|
4014
4010
|
var RETRY_DELAY_MS = 5e3;
|
|
4015
4011
|
var PerpTradeRecorder = class {
|
|
4016
|
-
// Use `any` for viem client types to avoid L2 chain type conflicts (Base has "deposit" tx type)
|
|
4017
4012
|
publicClient;
|
|
4018
|
-
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
4019
4013
|
walletClient;
|
|
4020
|
-
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
4021
4014
|
account;
|
|
4022
4015
|
agentId;
|
|
4023
4016
|
configHash;
|
|
@@ -4348,6 +4341,14 @@ var PerpOnboarding = class {
|
|
|
4348
4341
|
var import_viem6 = require("viem");
|
|
4349
4342
|
var import_chains4 = require("viem/chains");
|
|
4350
4343
|
var import_accounts4 = require("viem/accounts");
|
|
4344
|
+
var hyperEVM = (0, import_viem6.defineChain)({
|
|
4345
|
+
id: 999,
|
|
4346
|
+
name: "HyperEVM",
|
|
4347
|
+
nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 },
|
|
4348
|
+
rpcUrls: {
|
|
4349
|
+
default: { http: ["https://rpc.hyperliquid.xyz/evm"] }
|
|
4350
|
+
}
|
|
4351
|
+
});
|
|
4351
4352
|
var ERC20_ABI = (0, import_viem6.parseAbi)([
|
|
4352
4353
|
"function approve(address spender, uint256 amount) external returns (bool)",
|
|
4353
4354
|
"function balanceOf(address account) external view returns (uint256)",
|
|
@@ -5883,7 +5884,7 @@ function loadSecureEnv(basePath, passphrase) {
|
|
|
5883
5884
|
}
|
|
5884
5885
|
|
|
5885
5886
|
// src/index.ts
|
|
5886
|
-
var AGENT_VERSION = "0.1.
|
|
5887
|
+
var AGENT_VERSION = "0.1.37";
|
|
5887
5888
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5888
5889
|
0 && (module.exports = {
|
|
5889
5890
|
AGENT_VERSION,
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exagent/agent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.37",
|
|
4
4
|
"description": "Autonomous trading agent runtime for Exagent",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"clean": "rm -rf dist"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@exagent/sdk": "^0.1.
|
|
32
|
+
"@exagent/sdk": "^0.1.15",
|
|
33
33
|
"@nktkas/hyperliquid": "^0.31.0",
|
|
34
34
|
"chalk": "^5.3.0",
|
|
35
35
|
"commander": "^12.0.0",
|