@exagent/agent 0.1.33 → 0.1.35
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-46HZKJLU.mjs +5869 -0
- package/dist/chunk-EMQYMJZD.mjs +5854 -0
- package/dist/cli.js +47 -20
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +47 -20
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -699,24 +699,34 @@ var MarketDataService = class {
|
|
|
699
699
|
const nativeBalance = await this.client.getBalance({ address: wallet });
|
|
700
700
|
balances[NATIVE_ETH.toLowerCase()] = nativeBalance;
|
|
701
701
|
if (tokenAddresses.length > 0) {
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
702
|
+
const BALANCE_BATCH_SIZE = 25;
|
|
703
|
+
for (let i = 0; i < tokenAddresses.length; i += BALANCE_BATCH_SIZE) {
|
|
704
|
+
const batch = tokenAddresses.slice(i, i + BALANCE_BATCH_SIZE);
|
|
705
|
+
try {
|
|
706
|
+
const results = await this.client.multicall({
|
|
707
|
+
contracts: batch.map((addr) => ({
|
|
708
|
+
address: addr,
|
|
709
|
+
abi: import_viem2.erc20Abi,
|
|
710
|
+
functionName: "balanceOf",
|
|
711
|
+
args: [wallet]
|
|
712
|
+
})),
|
|
713
|
+
allowFailure: true
|
|
714
|
+
});
|
|
715
|
+
for (let j = 0; j < batch.length; j++) {
|
|
716
|
+
const addr = batch[j].toLowerCase();
|
|
717
|
+
const r = results[j];
|
|
718
|
+
if (r.status === "success") {
|
|
719
|
+
balances[addr] = r.result;
|
|
720
|
+
} else {
|
|
721
|
+
const sym = this.resolver.getSymbol(addr) || addr.slice(0, 10);
|
|
722
|
+
console.warn(` balanceOf reverted for ${sym}`);
|
|
723
|
+
balances[addr] = 0n;
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
} catch (e) {
|
|
727
|
+
console.warn(`Multicall3 balanceOf batch failed (${batch.length} tokens): ${e instanceof Error ? e.message : String(e)}`);
|
|
728
|
+
await this.fetchBalancesIndividual(wallet, batch, balances);
|
|
716
729
|
}
|
|
717
|
-
} catch {
|
|
718
|
-
console.warn("Multicall3 balanceOf failed, falling back to individual queries");
|
|
719
|
-
await this.fetchBalancesIndividual(wallet, tokenAddresses, balances);
|
|
720
730
|
}
|
|
721
731
|
}
|
|
722
732
|
} catch (error) {
|
|
@@ -741,7 +751,9 @@ var MarketDataService = class {
|
|
|
741
751
|
args: [wallet]
|
|
742
752
|
});
|
|
743
753
|
return { address: tokenAddress.toLowerCase(), balance };
|
|
744
|
-
} catch {
|
|
754
|
+
} catch (e) {
|
|
755
|
+
const sym = this.resolver.getSymbol(tokenAddress.toLowerCase()) || tokenAddress.slice(0, 10);
|
|
756
|
+
console.warn(` balanceOf failed for ${sym}: ${e instanceof Error ? e.message : String(e)}`);
|
|
745
757
|
return { address: tokenAddress.toLowerCase(), balance: 0n };
|
|
746
758
|
}
|
|
747
759
|
});
|
|
@@ -870,6 +882,9 @@ var PositionTracker = class {
|
|
|
870
882
|
existing.totalCostBasis = newTotalCost;
|
|
871
883
|
existing.totalAmountAcquired = newTotalAmount;
|
|
872
884
|
existing.lastUpdateTimestamp = Date.now();
|
|
885
|
+
if (!existing.symbol) {
|
|
886
|
+
existing.symbol = TOKEN_SYMBOLS[token] || getTokenSymbol(token);
|
|
887
|
+
}
|
|
873
888
|
if (txHash) {
|
|
874
889
|
existing.txHashes.push(txHash);
|
|
875
890
|
if (existing.txHashes.length > 10) existing.txHashes.shift();
|
|
@@ -926,6 +941,13 @@ var PositionTracker = class {
|
|
|
926
941
|
this.positions[token].lastUpdateTimestamp = Date.now();
|
|
927
942
|
changed = true;
|
|
928
943
|
}
|
|
944
|
+
if (!this.positions[token].symbol) {
|
|
945
|
+
const resolved = TOKEN_SYMBOLS[token] || getTokenSymbol(token);
|
|
946
|
+
if (resolved) {
|
|
947
|
+
this.positions[token].symbol = resolved;
|
|
948
|
+
changed = true;
|
|
949
|
+
}
|
|
950
|
+
}
|
|
929
951
|
} else {
|
|
930
952
|
const price = prices[token] || 0;
|
|
931
953
|
this.positions[token] = {
|
|
@@ -957,8 +979,13 @@ var PositionTracker = class {
|
|
|
957
979
|
// ============================================================
|
|
958
980
|
// QUERY METHODS (for strategies)
|
|
959
981
|
// ============================================================
|
|
960
|
-
/** Get all tracked positions */
|
|
982
|
+
/** Get all tracked positions (backfills missing symbols from resolver) */
|
|
961
983
|
getPositions() {
|
|
984
|
+
for (const pos of Object.values(this.positions)) {
|
|
985
|
+
if (!pos.symbol) {
|
|
986
|
+
pos.symbol = TOKEN_SYMBOLS[pos.token] || getTokenSymbol(pos.token);
|
|
987
|
+
}
|
|
988
|
+
}
|
|
962
989
|
return Object.values(this.positions);
|
|
963
990
|
}
|
|
964
991
|
/** Get a single position by token address */
|
|
@@ -4168,7 +4195,7 @@ function loadSecureEnv(basePath, passphrase) {
|
|
|
4168
4195
|
}
|
|
4169
4196
|
|
|
4170
4197
|
// src/index.ts
|
|
4171
|
-
var AGENT_VERSION = "0.1.
|
|
4198
|
+
var AGENT_VERSION = "0.1.35";
|
|
4172
4199
|
|
|
4173
4200
|
// src/relay.ts
|
|
4174
4201
|
var RelayClient = class {
|
package/dist/cli.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -57,7 +57,7 @@ declare class PositionTracker {
|
|
|
57
57
|
* Updates currentAmount, detects new tokens (airdrops), removes zeroed positions.
|
|
58
58
|
*/
|
|
59
59
|
syncBalances(balances: Record<string, bigint>, prices: Record<string, number>): void;
|
|
60
|
-
/** Get all tracked positions */
|
|
60
|
+
/** Get all tracked positions (backfills missing symbols from resolver) */
|
|
61
61
|
getPositions(): TrackedPosition[];
|
|
62
62
|
/** Get a single position by token address */
|
|
63
63
|
getPosition(token: string): TrackedPosition | undefined;
|
|
@@ -339,9 +339,9 @@ declare const AgentConfigSchema: z.ZodObject<{
|
|
|
339
339
|
}>>;
|
|
340
340
|
allowedTokens: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
341
341
|
}, "strip", z.ZodTypeAny, {
|
|
342
|
-
agentId: string | number;
|
|
343
342
|
name: string;
|
|
344
343
|
network: "mainnet";
|
|
344
|
+
agentId: string | number;
|
|
345
345
|
llm: {
|
|
346
346
|
provider: "custom" | "openai" | "anthropic" | "google" | "deepseek" | "mistral" | "groq" | "together" | "ollama";
|
|
347
347
|
temperature: number;
|
|
@@ -388,8 +388,8 @@ declare const AgentConfigSchema: z.ZodObject<{
|
|
|
388
388
|
} | undefined;
|
|
389
389
|
allowedTokens?: string[] | undefined;
|
|
390
390
|
}, {
|
|
391
|
-
agentId: string | number;
|
|
392
391
|
name: string;
|
|
392
|
+
agentId: string | number;
|
|
393
393
|
llm: {
|
|
394
394
|
provider: "custom" | "openai" | "anthropic" | "google" | "deepseek" | "mistral" | "groq" | "together" | "ollama";
|
|
395
395
|
model?: string | undefined;
|
|
@@ -2191,6 +2191,6 @@ declare function decryptEnvFile(encPath: string, passphrase: string): Record<str
|
|
|
2191
2191
|
declare function loadSecureEnv(basePath: string, passphrase?: string): boolean;
|
|
2192
2192
|
|
|
2193
2193
|
/** @exagent/agent package version — update alongside package.json */
|
|
2194
|
-
declare const AGENT_VERSION = "0.1.
|
|
2194
|
+
declare const AGENT_VERSION = "0.1.35";
|
|
2195
2195
|
|
|
2196
2196
|
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
|
@@ -57,7 +57,7 @@ declare class PositionTracker {
|
|
|
57
57
|
* Updates currentAmount, detects new tokens (airdrops), removes zeroed positions.
|
|
58
58
|
*/
|
|
59
59
|
syncBalances(balances: Record<string, bigint>, prices: Record<string, number>): void;
|
|
60
|
-
/** Get all tracked positions */
|
|
60
|
+
/** Get all tracked positions (backfills missing symbols from resolver) */
|
|
61
61
|
getPositions(): TrackedPosition[];
|
|
62
62
|
/** Get a single position by token address */
|
|
63
63
|
getPosition(token: string): TrackedPosition | undefined;
|
|
@@ -339,9 +339,9 @@ declare const AgentConfigSchema: z.ZodObject<{
|
|
|
339
339
|
}>>;
|
|
340
340
|
allowedTokens: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
341
341
|
}, "strip", z.ZodTypeAny, {
|
|
342
|
-
agentId: string | number;
|
|
343
342
|
name: string;
|
|
344
343
|
network: "mainnet";
|
|
344
|
+
agentId: string | number;
|
|
345
345
|
llm: {
|
|
346
346
|
provider: "custom" | "openai" | "anthropic" | "google" | "deepseek" | "mistral" | "groq" | "together" | "ollama";
|
|
347
347
|
temperature: number;
|
|
@@ -388,8 +388,8 @@ declare const AgentConfigSchema: z.ZodObject<{
|
|
|
388
388
|
} | undefined;
|
|
389
389
|
allowedTokens?: string[] | undefined;
|
|
390
390
|
}, {
|
|
391
|
-
agentId: string | number;
|
|
392
391
|
name: string;
|
|
392
|
+
agentId: string | number;
|
|
393
393
|
llm: {
|
|
394
394
|
provider: "custom" | "openai" | "anthropic" | "google" | "deepseek" | "mistral" | "groq" | "together" | "ollama";
|
|
395
395
|
model?: string | undefined;
|
|
@@ -2191,6 +2191,6 @@ declare function decryptEnvFile(encPath: string, passphrase: string): Record<str
|
|
|
2191
2191
|
declare function loadSecureEnv(basePath: string, passphrase?: string): boolean;
|
|
2192
2192
|
|
|
2193
2193
|
/** @exagent/agent package version — update alongside package.json */
|
|
2194
|
-
declare const AGENT_VERSION = "0.1.
|
|
2194
|
+
declare const AGENT_VERSION = "0.1.35";
|
|
2195
2195
|
|
|
2196
2196
|
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
|
@@ -752,24 +752,34 @@ var MarketDataService = class {
|
|
|
752
752
|
const nativeBalance = await this.client.getBalance({ address: wallet });
|
|
753
753
|
balances[NATIVE_ETH.toLowerCase()] = nativeBalance;
|
|
754
754
|
if (tokenAddresses.length > 0) {
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
755
|
+
const BALANCE_BATCH_SIZE = 25;
|
|
756
|
+
for (let i = 0; i < tokenAddresses.length; i += BALANCE_BATCH_SIZE) {
|
|
757
|
+
const batch = tokenAddresses.slice(i, i + BALANCE_BATCH_SIZE);
|
|
758
|
+
try {
|
|
759
|
+
const results = await this.client.multicall({
|
|
760
|
+
contracts: batch.map((addr) => ({
|
|
761
|
+
address: addr,
|
|
762
|
+
abi: import_viem2.erc20Abi,
|
|
763
|
+
functionName: "balanceOf",
|
|
764
|
+
args: [wallet]
|
|
765
|
+
})),
|
|
766
|
+
allowFailure: true
|
|
767
|
+
});
|
|
768
|
+
for (let j = 0; j < batch.length; j++) {
|
|
769
|
+
const addr = batch[j].toLowerCase();
|
|
770
|
+
const r = results[j];
|
|
771
|
+
if (r.status === "success") {
|
|
772
|
+
balances[addr] = r.result;
|
|
773
|
+
} else {
|
|
774
|
+
const sym = this.resolver.getSymbol(addr) || addr.slice(0, 10);
|
|
775
|
+
console.warn(` balanceOf reverted for ${sym}`);
|
|
776
|
+
balances[addr] = 0n;
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
} catch (e) {
|
|
780
|
+
console.warn(`Multicall3 balanceOf batch failed (${batch.length} tokens): ${e instanceof Error ? e.message : String(e)}`);
|
|
781
|
+
await this.fetchBalancesIndividual(wallet, batch, balances);
|
|
769
782
|
}
|
|
770
|
-
} catch {
|
|
771
|
-
console.warn("Multicall3 balanceOf failed, falling back to individual queries");
|
|
772
|
-
await this.fetchBalancesIndividual(wallet, tokenAddresses, balances);
|
|
773
783
|
}
|
|
774
784
|
}
|
|
775
785
|
} catch (error) {
|
|
@@ -794,7 +804,9 @@ var MarketDataService = class {
|
|
|
794
804
|
args: [wallet]
|
|
795
805
|
});
|
|
796
806
|
return { address: tokenAddress.toLowerCase(), balance };
|
|
797
|
-
} catch {
|
|
807
|
+
} catch (e) {
|
|
808
|
+
const sym = this.resolver.getSymbol(tokenAddress.toLowerCase()) || tokenAddress.slice(0, 10);
|
|
809
|
+
console.warn(` balanceOf failed for ${sym}: ${e instanceof Error ? e.message : String(e)}`);
|
|
798
810
|
return { address: tokenAddress.toLowerCase(), balance: 0n };
|
|
799
811
|
}
|
|
800
812
|
});
|
|
@@ -923,6 +935,9 @@ var PositionTracker = class {
|
|
|
923
935
|
existing.totalCostBasis = newTotalCost;
|
|
924
936
|
existing.totalAmountAcquired = newTotalAmount;
|
|
925
937
|
existing.lastUpdateTimestamp = Date.now();
|
|
938
|
+
if (!existing.symbol) {
|
|
939
|
+
existing.symbol = TOKEN_SYMBOLS[token] || getTokenSymbol(token);
|
|
940
|
+
}
|
|
926
941
|
if (txHash) {
|
|
927
942
|
existing.txHashes.push(txHash);
|
|
928
943
|
if (existing.txHashes.length > 10) existing.txHashes.shift();
|
|
@@ -979,6 +994,13 @@ var PositionTracker = class {
|
|
|
979
994
|
this.positions[token].lastUpdateTimestamp = Date.now();
|
|
980
995
|
changed = true;
|
|
981
996
|
}
|
|
997
|
+
if (!this.positions[token].symbol) {
|
|
998
|
+
const resolved = TOKEN_SYMBOLS[token] || getTokenSymbol(token);
|
|
999
|
+
if (resolved) {
|
|
1000
|
+
this.positions[token].symbol = resolved;
|
|
1001
|
+
changed = true;
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
982
1004
|
} else {
|
|
983
1005
|
const price = prices[token] || 0;
|
|
984
1006
|
this.positions[token] = {
|
|
@@ -1010,8 +1032,13 @@ var PositionTracker = class {
|
|
|
1010
1032
|
// ============================================================
|
|
1011
1033
|
// QUERY METHODS (for strategies)
|
|
1012
1034
|
// ============================================================
|
|
1013
|
-
/** Get all tracked positions */
|
|
1035
|
+
/** Get all tracked positions (backfills missing symbols from resolver) */
|
|
1014
1036
|
getPositions() {
|
|
1037
|
+
for (const pos of Object.values(this.positions)) {
|
|
1038
|
+
if (!pos.symbol) {
|
|
1039
|
+
pos.symbol = TOKEN_SYMBOLS[pos.token] || getTokenSymbol(pos.token);
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1015
1042
|
return Object.values(this.positions);
|
|
1016
1043
|
}
|
|
1017
1044
|
/** Get a single position by token address */
|
|
@@ -5854,7 +5881,7 @@ function loadSecureEnv(basePath, passphrase) {
|
|
|
5854
5881
|
}
|
|
5855
5882
|
|
|
5856
5883
|
// src/index.ts
|
|
5857
|
-
var AGENT_VERSION = "0.1.
|
|
5884
|
+
var AGENT_VERSION = "0.1.35";
|
|
5858
5885
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5859
5886
|
0 && (module.exports = {
|
|
5860
5887
|
AGENT_VERSION,
|
package/dist/index.mjs
CHANGED