@exagent/agent 0.1.29 → 0.1.30

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/cli.js CHANGED
@@ -3826,7 +3826,7 @@ function loadSecureEnv(basePath, passphrase) {
3826
3826
  }
3827
3827
 
3828
3828
  // src/index.ts
3829
- var AGENT_VERSION = "0.1.29";
3829
+ var AGENT_VERSION = "0.1.30";
3830
3830
 
3831
3831
  // src/relay.ts
3832
3832
  var RelayClient = class {
@@ -4423,6 +4423,10 @@ var AgentRuntime = class {
4423
4423
  this.config.allowedTokens = void 0;
4424
4424
  console.log("Frontier risk universe: all tokens allowed (no restrictions)");
4425
4425
  console.log("Frontier risk universe: vault creation is disabled");
4426
+ const trackedCount = this.positionTracker.getPositions().length;
4427
+ if (trackedCount > 0) {
4428
+ console.log(`Auto-tracking ${trackedCount} token(s) from position history`);
4429
+ }
4426
4430
  return;
4427
4431
  }
4428
4432
  const configTokens = this.config.allowedTokens || this.getDefaultTokens();
@@ -4982,7 +4986,7 @@ var AgentRuntime = class {
4982
4986
  --- Trading Cycle: ${(/* @__PURE__ */ new Date()).toISOString()} ---`);
4983
4987
  this.cycleCount++;
4984
4988
  this.lastCycleAt = Date.now();
4985
- const tokens = this.config.allowedTokens || this.getDefaultTokens();
4989
+ const tokens = this.getTokensToTrack();
4986
4990
  const marketData = await this.marketData.fetchMarketData(this.client.address, tokens);
4987
4991
  console.log(`Portfolio value: $${marketData.portfolioValue.toFixed(2)}`);
4988
4992
  this.lastPortfolioValue = marketData.portfolioValue;
@@ -5079,7 +5083,7 @@ var AgentRuntime = class {
5079
5083
  success: result.success
5080
5084
  });
5081
5085
  }
5082
- const postTokens = this.config.allowedTokens || this.getDefaultTokens();
5086
+ const postTokens = this.getTokensToTrack();
5083
5087
  const postTradeData = await this.marketData.fetchMarketData(this.client.address, postTokens);
5084
5088
  const marketPnL = postTradeData.portfolioValue - preTradePortfolioValue + totalFeesUSD;
5085
5089
  this.riskManager.updatePnL(marketPnL);
@@ -5222,6 +5226,38 @@ var AgentRuntime = class {
5222
5226
  getRpcUrl() {
5223
5227
  return getRpcUrl();
5224
5228
  }
5229
+ /**
5230
+ * Get the full list of tokens to fetch balances/prices for this cycle.
5231
+ * Starts from allowedTokens (or default whitelist), then merges in any tokens
5232
+ * the position tracker knows about — so previously-traded tokens (especially
5233
+ * for Frontier agents trading outside the whitelist) stay visible.
5234
+ */
5235
+ getTokensToTrack() {
5236
+ const base5 = this.config.allowedTokens || this.getDefaultTokens();
5237
+ const baseSet = new Set(base5.map((t) => t.toLowerCase()));
5238
+ const trackedPositions = this.positionTracker.getPositions();
5239
+ const extras = [];
5240
+ for (const pos of trackedPositions) {
5241
+ if (!baseSet.has(pos.token.toLowerCase())) {
5242
+ extras.push(pos.token);
5243
+ baseSet.add(pos.token.toLowerCase());
5244
+ }
5245
+ }
5246
+ const recentTrades = this.positionTracker.getTradeHistory(20);
5247
+ for (const trade of recentTrades) {
5248
+ for (const addr of [trade.tokenIn, trade.tokenOut]) {
5249
+ const key = addr.toLowerCase();
5250
+ if (key !== NATIVE_ETH.toLowerCase() && !baseSet.has(key)) {
5251
+ extras.push(addr);
5252
+ baseSet.add(key);
5253
+ }
5254
+ }
5255
+ }
5256
+ if (extras.length > 0) {
5257
+ console.log(`Auto-tracking ${extras.length} additional token(s) from position history`);
5258
+ }
5259
+ return [...base5, ...extras];
5260
+ }
5225
5261
  /**
5226
5262
  * Default tokens to track.
5227
5263
  * These are validated against the on-chain registry's isTradeAllowed() during init —
package/dist/cli.mjs CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  loadConfig,
7
7
  loadSecureEnv,
8
8
  validateConfig
9
- } from "./chunk-AEPTFRZ4.mjs";
9
+ } from "./chunk-IMJPVALR.mjs";
10
10
 
11
11
  // src/cli.ts
12
12
  import { Command } from "commander";
package/dist/index.d.mts CHANGED
@@ -892,6 +892,13 @@ declare class AgentRuntime {
892
892
  * Get RPC URL from environment or default
893
893
  */
894
894
  private getRpcUrl;
895
+ /**
896
+ * Get the full list of tokens to fetch balances/prices for this cycle.
897
+ * Starts from allowedTokens (or default whitelist), then merges in any tokens
898
+ * the position tracker knows about — so previously-traded tokens (especially
899
+ * for Frontier agents trading outside the whitelist) stay visible.
900
+ */
901
+ private getTokensToTrack;
895
902
  /**
896
903
  * Default tokens to track.
897
904
  * These are validated against the on-chain registry's isTradeAllowed() during init —
@@ -2107,6 +2114,6 @@ declare function decryptEnvFile(encPath: string, passphrase: string): Record<str
2107
2114
  declare function loadSecureEnv(basePath: string, passphrase?: string): boolean;
2108
2115
 
2109
2116
  /** @exagent/agent package version — update alongside package.json */
2110
- declare const AGENT_VERSION = "0.1.29";
2117
+ declare const AGENT_VERSION = "0.1.30";
2111
2118
 
2112
2119
  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
@@ -892,6 +892,13 @@ declare class AgentRuntime {
892
892
  * Get RPC URL from environment or default
893
893
  */
894
894
  private getRpcUrl;
895
+ /**
896
+ * Get the full list of tokens to fetch balances/prices for this cycle.
897
+ * Starts from allowedTokens (or default whitelist), then merges in any tokens
898
+ * the position tracker knows about — so previously-traded tokens (especially
899
+ * for Frontier agents trading outside the whitelist) stay visible.
900
+ */
901
+ private getTokensToTrack;
895
902
  /**
896
903
  * Default tokens to track.
897
904
  * These are validated against the on-chain registry's isTradeAllowed() during init —
@@ -2107,6 +2114,6 @@ declare function decryptEnvFile(encPath: string, passphrase: string): Record<str
2107
2114
  declare function loadSecureEnv(basePath: string, passphrase?: string): boolean;
2108
2115
 
2109
2116
  /** @exagent/agent package version — update alongside package.json */
2110
- declare const AGENT_VERSION = "0.1.29";
2117
+ declare const AGENT_VERSION = "0.1.30";
2111
2118
 
2112
2119
  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
@@ -4325,6 +4325,10 @@ var AgentRuntime = class {
4325
4325
  this.config.allowedTokens = void 0;
4326
4326
  console.log("Frontier risk universe: all tokens allowed (no restrictions)");
4327
4327
  console.log("Frontier risk universe: vault creation is disabled");
4328
+ const trackedCount = this.positionTracker.getPositions().length;
4329
+ if (trackedCount > 0) {
4330
+ console.log(`Auto-tracking ${trackedCount} token(s) from position history`);
4331
+ }
4328
4332
  return;
4329
4333
  }
4330
4334
  const configTokens = this.config.allowedTokens || this.getDefaultTokens();
@@ -4884,7 +4888,7 @@ var AgentRuntime = class {
4884
4888
  --- Trading Cycle: ${(/* @__PURE__ */ new Date()).toISOString()} ---`);
4885
4889
  this.cycleCount++;
4886
4890
  this.lastCycleAt = Date.now();
4887
- const tokens = this.config.allowedTokens || this.getDefaultTokens();
4891
+ const tokens = this.getTokensToTrack();
4888
4892
  const marketData = await this.marketData.fetchMarketData(this.client.address, tokens);
4889
4893
  console.log(`Portfolio value: $${marketData.portfolioValue.toFixed(2)}`);
4890
4894
  this.lastPortfolioValue = marketData.portfolioValue;
@@ -4981,7 +4985,7 @@ var AgentRuntime = class {
4981
4985
  success: result.success
4982
4986
  });
4983
4987
  }
4984
- const postTokens = this.config.allowedTokens || this.getDefaultTokens();
4988
+ const postTokens = this.getTokensToTrack();
4985
4989
  const postTradeData = await this.marketData.fetchMarketData(this.client.address, postTokens);
4986
4990
  const marketPnL = postTradeData.portfolioValue - preTradePortfolioValue + totalFeesUSD;
4987
4991
  this.riskManager.updatePnL(marketPnL);
@@ -5124,6 +5128,38 @@ var AgentRuntime = class {
5124
5128
  getRpcUrl() {
5125
5129
  return getRpcUrl();
5126
5130
  }
5131
+ /**
5132
+ * Get the full list of tokens to fetch balances/prices for this cycle.
5133
+ * Starts from allowedTokens (or default whitelist), then merges in any tokens
5134
+ * the position tracker knows about — so previously-traded tokens (especially
5135
+ * for Frontier agents trading outside the whitelist) stay visible.
5136
+ */
5137
+ getTokensToTrack() {
5138
+ const base5 = this.config.allowedTokens || this.getDefaultTokens();
5139
+ const baseSet = new Set(base5.map((t) => t.toLowerCase()));
5140
+ const trackedPositions = this.positionTracker.getPositions();
5141
+ const extras = [];
5142
+ for (const pos of trackedPositions) {
5143
+ if (!baseSet.has(pos.token.toLowerCase())) {
5144
+ extras.push(pos.token);
5145
+ baseSet.add(pos.token.toLowerCase());
5146
+ }
5147
+ }
5148
+ const recentTrades = this.positionTracker.getTradeHistory(20);
5149
+ for (const trade of recentTrades) {
5150
+ for (const addr of [trade.tokenIn, trade.tokenOut]) {
5151
+ const key = addr.toLowerCase();
5152
+ if (key !== NATIVE_ETH.toLowerCase() && !baseSet.has(key)) {
5153
+ extras.push(addr);
5154
+ baseSet.add(key);
5155
+ }
5156
+ }
5157
+ }
5158
+ if (extras.length > 0) {
5159
+ console.log(`Auto-tracking ${extras.length} additional token(s) from position history`);
5160
+ }
5161
+ return [...base5, ...extras];
5162
+ }
5127
5163
  /**
5128
5164
  * Default tokens to track.
5129
5165
  * These are validated against the on-chain registry's isTradeAllowed() during init —
@@ -5453,7 +5489,7 @@ function loadSecureEnv(basePath, passphrase) {
5453
5489
  }
5454
5490
 
5455
5491
  // src/index.ts
5456
- var AGENT_VERSION = "0.1.29";
5492
+ var AGENT_VERSION = "0.1.30";
5457
5493
  // Annotate the CommonJS export names for ESM import in node:
5458
5494
  0 && (module.exports = {
5459
5495
  AGENT_VERSION,
package/dist/index.mjs CHANGED
@@ -49,7 +49,7 @@ import {
49
49
  loadStrategy,
50
50
  validateConfig,
51
51
  validateStrategy
52
- } from "./chunk-AEPTFRZ4.mjs";
52
+ } from "./chunk-IMJPVALR.mjs";
53
53
  export {
54
54
  AGENT_VERSION,
55
55
  AgentConfigSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exagent/agent",
3
- "version": "0.1.29",
3
+ "version": "0.1.30",
4
4
  "description": "Autonomous trading agent runtime for Exagent",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",