@exagent/agent 0.1.37 → 0.1.38

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
@@ -2160,6 +2160,24 @@ function classifyTradeError(message) {
2160
2160
  userMessage: "DEX aggregator not whitelisted on the router. Contact support."
2161
2161
  };
2162
2162
  }
2163
+ if (lower.includes("token approval reverted")) {
2164
+ return {
2165
+ category: "approval_failed",
2166
+ userMessage: "Token approval failed \u2014 this token may have non-standard approval behavior or be blocked. Skipping."
2167
+ };
2168
+ }
2169
+ if (lower.includes("exceeds allowance") || lower.includes("allowance")) {
2170
+ return {
2171
+ category: "allowance",
2172
+ userMessage: "Token allowance insufficient \u2014 approval may not have propagated. Will retry next cycle."
2173
+ };
2174
+ }
2175
+ if (lower.includes("swapfailed")) {
2176
+ return {
2177
+ category: "swap_failed",
2178
+ userMessage: "DEX swap failed \u2014 likely insufficient liquidity for this token. Will retry next cycle."
2179
+ };
2180
+ }
2163
2181
  if (lower.includes("reverted") || lower.includes("execution reverted")) {
2164
2182
  return {
2165
2183
  category: "reverted",
@@ -2186,8 +2204,11 @@ var RiskManager = class {
2186
2204
  lastResetDate = "";
2187
2205
  /** Minimum trade value in USD — trades below this are rejected as dust */
2188
2206
  minTradeValueUSD;
2189
- constructor(config) {
2207
+ /** Risk universe (0-4). Frontier (4) bypasses buy-only guardrails. */
2208
+ riskUniverse;
2209
+ constructor(config, riskUniverse = 0) {
2190
2210
  this.config = config;
2211
+ this.riskUniverse = riskUniverse;
2191
2212
  this.minTradeValueUSD = config.minTradeValueUSD ?? 1;
2192
2213
  }
2193
2214
  /**
@@ -2223,6 +2244,9 @@ var RiskManager = class {
2223
2244
  if (signal.action === "sell") {
2224
2245
  return true;
2225
2246
  }
2247
+ if (this.riskUniverse === 4) {
2248
+ return true;
2249
+ }
2226
2250
  const signalValue = this.estimateSignalValue(signal, marketData);
2227
2251
  const maxPositionValue = marketData.portfolioValue * this.config.maxPositionSizeBps / 1e4;
2228
2252
  if (signalValue > maxPositionValue) {
@@ -2604,7 +2628,7 @@ var VaultManager = class {
2604
2628
  canCreateVault: false,
2605
2629
  cannotCreateReason: "Vault operations disabled (contract address not set)",
2606
2630
  requirementsMet: false,
2607
- requirements: { veXARequired: BigInt(0), isBypassed: false }
2631
+ requirements: { isBypassed: false }
2608
2632
  };
2609
2633
  }
2610
2634
  const vaultAddress = await this.getVaultAddress();
@@ -2641,16 +2665,10 @@ var VaultManager = class {
2641
2665
  }
2642
2666
  /**
2643
2667
  * Get vault creation requirements
2644
- * Note: No burnFee on mainnetvault creation requires USDC seed instead
2668
+ * Note: StakingStub always returns hasVaultAccess=trueno gate.
2645
2669
  */
2646
2670
  async getRequirements() {
2647
- const veXARequired = await this.publicClient.readContract({
2648
- address: this.addresses.vaultFactory,
2649
- abi: VAULT_FACTORY_ABI,
2650
- functionName: "minimumVeEXARequired"
2651
- });
2652
- const isBypassed = veXARequired === BigInt(0);
2653
- return { veXARequired, isBypassed };
2671
+ return { isBypassed: true };
2654
2672
  }
2655
2673
  /**
2656
2674
  * Get the agent's vault address (cached)
@@ -4198,7 +4216,7 @@ function loadSecureEnv(basePath, passphrase) {
4198
4216
  }
4199
4217
 
4200
4218
  // src/index.ts
4201
- var AGENT_VERSION = "0.1.37";
4219
+ var AGENT_VERSION = "0.1.38";
4202
4220
 
4203
4221
  // src/relay.ts
4204
4222
  var RelayClient = class {
@@ -4549,7 +4567,7 @@ var AgentRuntime = class {
4549
4567
  };
4550
4568
  this.positionTracker = new PositionTracker(store, { maxTradeHistory: 50 });
4551
4569
  this.executor = new TradeExecutor(this.client, this.config, () => this.getConfigHash());
4552
- this.riskManager = new RiskManager(this.config.trading);
4570
+ this.riskManager = new RiskManager(this.config.trading, this.riskUniverse);
4553
4571
  this.marketData = new MarketDataService(this.getRpcUrl(), store);
4554
4572
  setGlobalResolver(this.marketData.getResolver());
4555
4573
  const savedRisk = this.positionTracker.getRiskState();
@@ -5079,7 +5097,7 @@ var AgentRuntime = class {
5079
5097
  updated = true;
5080
5098
  }
5081
5099
  if (updated) {
5082
- this.riskManager = new RiskManager(this.config.trading);
5100
+ this.riskManager = new RiskManager(this.config.trading, this.riskUniverse);
5083
5101
  const savedRiskState = this.positionTracker.getRiskState();
5084
5102
  if (savedRiskState.lastResetDate) {
5085
5103
  this.riskManager.restoreState(savedRiskState);
package/dist/cli.mjs CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  loadConfig,
7
7
  loadSecureEnv,
8
8
  validateConfig
9
- } from "./chunk-H7HKHVR7.mjs";
9
+ } from "./chunk-27O4UUAA.mjs";
10
10
 
11
11
  // src/cli.ts
12
12
  import { Command } from "commander";
package/dist/index.d.mts CHANGED
@@ -340,9 +340,9 @@ declare const AgentConfigSchema: z.ZodObject<{
340
340
  }>>;
341
341
  allowedTokens: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
342
342
  }, "strip", z.ZodTypeAny, {
343
- agentId: string | number;
344
343
  name: string;
345
344
  network: "mainnet";
345
+ agentId: string | number;
346
346
  llm: {
347
347
  provider: "custom" | "openai" | "anthropic" | "google" | "deepseek" | "mistral" | "groq" | "together" | "ollama";
348
348
  temperature: number;
@@ -389,8 +389,8 @@ declare const AgentConfigSchema: z.ZodObject<{
389
389
  } | undefined;
390
390
  allowedTokens?: string[] | undefined;
391
391
  }, {
392
- agentId: string | number;
393
392
  name: string;
393
+ agentId: string | number;
394
394
  llm: {
395
395
  provider: "custom" | "openai" | "anthropic" | "google" | "deepseek" | "mistral" | "groq" | "together" | "ollama";
396
396
  model?: string | undefined;
@@ -597,7 +597,6 @@ interface VaultStatus {
597
597
  cannotCreateReason: string | null;
598
598
  requirementsMet: boolean;
599
599
  requirements: {
600
- veXARequired: bigint;
601
600
  isBypassed: boolean;
602
601
  };
603
602
  }
@@ -636,10 +635,9 @@ declare class VaultManager {
636
635
  getVaultStatus(): Promise<VaultStatus>;
637
636
  /**
638
637
  * Get vault creation requirements
639
- * Note: No burnFee on mainnetvault creation requires USDC seed instead
638
+ * Note: StakingStub always returns hasVaultAccess=trueno gate.
640
639
  */
641
640
  getRequirements(): Promise<{
642
- veXARequired: bigint;
643
641
  isBypassed: boolean;
644
642
  }>;
645
643
  /**
@@ -1340,7 +1338,9 @@ declare class RiskManager {
1340
1338
  private lastResetDate;
1341
1339
  /** Minimum trade value in USD — trades below this are rejected as dust */
1342
1340
  private minTradeValueUSD;
1343
- constructor(config: TradingConfig);
1341
+ /** Risk universe (0-4). Frontier (4) bypasses buy-only guardrails. */
1342
+ private riskUniverse;
1343
+ constructor(config: TradingConfig, riskUniverse?: number);
1344
1344
  /**
1345
1345
  * Filter signals through risk checks
1346
1346
  * Returns only signals that pass all guardrails
@@ -2203,6 +2203,6 @@ declare function decryptEnvFile(encPath: string, passphrase: string): Record<str
2203
2203
  declare function loadSecureEnv(basePath: string, passphrase?: string): boolean;
2204
2204
 
2205
2205
  /** @exagent/agent package version — update alongside package.json */
2206
- declare const AGENT_VERSION = "0.1.37";
2206
+ declare const AGENT_VERSION = "0.1.38";
2207
2207
 
2208
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
@@ -340,9 +340,9 @@ declare const AgentConfigSchema: z.ZodObject<{
340
340
  }>>;
341
341
  allowedTokens: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
342
342
  }, "strip", z.ZodTypeAny, {
343
- agentId: string | number;
344
343
  name: string;
345
344
  network: "mainnet";
345
+ agentId: string | number;
346
346
  llm: {
347
347
  provider: "custom" | "openai" | "anthropic" | "google" | "deepseek" | "mistral" | "groq" | "together" | "ollama";
348
348
  temperature: number;
@@ -389,8 +389,8 @@ declare const AgentConfigSchema: z.ZodObject<{
389
389
  } | undefined;
390
390
  allowedTokens?: string[] | undefined;
391
391
  }, {
392
- agentId: string | number;
393
392
  name: string;
393
+ agentId: string | number;
394
394
  llm: {
395
395
  provider: "custom" | "openai" | "anthropic" | "google" | "deepseek" | "mistral" | "groq" | "together" | "ollama";
396
396
  model?: string | undefined;
@@ -597,7 +597,6 @@ interface VaultStatus {
597
597
  cannotCreateReason: string | null;
598
598
  requirementsMet: boolean;
599
599
  requirements: {
600
- veXARequired: bigint;
601
600
  isBypassed: boolean;
602
601
  };
603
602
  }
@@ -636,10 +635,9 @@ declare class VaultManager {
636
635
  getVaultStatus(): Promise<VaultStatus>;
637
636
  /**
638
637
  * Get vault creation requirements
639
- * Note: No burnFee on mainnetvault creation requires USDC seed instead
638
+ * Note: StakingStub always returns hasVaultAccess=trueno gate.
640
639
  */
641
640
  getRequirements(): Promise<{
642
- veXARequired: bigint;
643
641
  isBypassed: boolean;
644
642
  }>;
645
643
  /**
@@ -1340,7 +1338,9 @@ declare class RiskManager {
1340
1338
  private lastResetDate;
1341
1339
  /** Minimum trade value in USD — trades below this are rejected as dust */
1342
1340
  private minTradeValueUSD;
1343
- constructor(config: TradingConfig);
1341
+ /** Risk universe (0-4). Frontier (4) bypasses buy-only guardrails. */
1342
+ private riskUniverse;
1343
+ constructor(config: TradingConfig, riskUniverse?: number);
1344
1344
  /**
1345
1345
  * Filter signals through risk checks
1346
1346
  * Returns only signals that pass all guardrails
@@ -2203,6 +2203,6 @@ declare function decryptEnvFile(encPath: string, passphrase: string): Record<str
2203
2203
  declare function loadSecureEnv(basePath: string, passphrase?: string): boolean;
2204
2204
 
2205
2205
  /** @exagent/agent package version — update alongside package.json */
2206
- declare const AGENT_VERSION = "0.1.37";
2206
+ declare const AGENT_VERSION = "0.1.38";
2207
2207
 
2208
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
@@ -2248,6 +2248,24 @@ function classifyTradeError(message) {
2248
2248
  userMessage: "DEX aggregator not whitelisted on the router. Contact support."
2249
2249
  };
2250
2250
  }
2251
+ if (lower.includes("token approval reverted")) {
2252
+ return {
2253
+ category: "approval_failed",
2254
+ userMessage: "Token approval failed \u2014 this token may have non-standard approval behavior or be blocked. Skipping."
2255
+ };
2256
+ }
2257
+ if (lower.includes("exceeds allowance") || lower.includes("allowance")) {
2258
+ return {
2259
+ category: "allowance",
2260
+ userMessage: "Token allowance insufficient \u2014 approval may not have propagated. Will retry next cycle."
2261
+ };
2262
+ }
2263
+ if (lower.includes("swapfailed")) {
2264
+ return {
2265
+ category: "swap_failed",
2266
+ userMessage: "DEX swap failed \u2014 likely insufficient liquidity for this token. Will retry next cycle."
2267
+ };
2268
+ }
2251
2269
  if (lower.includes("reverted") || lower.includes("execution reverted")) {
2252
2270
  return {
2253
2271
  category: "reverted",
@@ -2274,8 +2292,11 @@ var RiskManager = class {
2274
2292
  lastResetDate = "";
2275
2293
  /** Minimum trade value in USD — trades below this are rejected as dust */
2276
2294
  minTradeValueUSD;
2277
- constructor(config) {
2295
+ /** Risk universe (0-4). Frontier (4) bypasses buy-only guardrails. */
2296
+ riskUniverse;
2297
+ constructor(config, riskUniverse = 0) {
2278
2298
  this.config = config;
2299
+ this.riskUniverse = riskUniverse;
2279
2300
  this.minTradeValueUSD = config.minTradeValueUSD ?? 1;
2280
2301
  }
2281
2302
  /**
@@ -2311,6 +2332,9 @@ var RiskManager = class {
2311
2332
  if (signal.action === "sell") {
2312
2333
  return true;
2313
2334
  }
2335
+ if (this.riskUniverse === 4) {
2336
+ return true;
2337
+ }
2314
2338
  const signalValue = this.estimateSignalValue(signal, marketData);
2315
2339
  const maxPositionValue = marketData.portfolioValue * this.config.maxPositionSizeBps / 1e4;
2316
2340
  if (signalValue > maxPositionValue) {
@@ -2692,7 +2716,7 @@ var VaultManager = class {
2692
2716
  canCreateVault: false,
2693
2717
  cannotCreateReason: "Vault operations disabled (contract address not set)",
2694
2718
  requirementsMet: false,
2695
- requirements: { veXARequired: BigInt(0), isBypassed: false }
2719
+ requirements: { isBypassed: false }
2696
2720
  };
2697
2721
  }
2698
2722
  const vaultAddress = await this.getVaultAddress();
@@ -2729,16 +2753,10 @@ var VaultManager = class {
2729
2753
  }
2730
2754
  /**
2731
2755
  * Get vault creation requirements
2732
- * Note: No burnFee on mainnetvault creation requires USDC seed instead
2756
+ * Note: StakingStub always returns hasVaultAccess=trueno gate.
2733
2757
  */
2734
2758
  async getRequirements() {
2735
- const veXARequired = await this.publicClient.readContract({
2736
- address: this.addresses.vaultFactory,
2737
- abi: VAULT_FACTORY_ABI,
2738
- functionName: "minimumVeEXARequired"
2739
- });
2740
- const isBypassed = veXARequired === BigInt(0);
2741
- return { veXARequired, isBypassed };
2759
+ return { isBypassed: true };
2742
2760
  }
2743
2761
  /**
2744
2762
  * Get the agent's vault address (cached)
@@ -4451,7 +4469,7 @@ var AgentRuntime = class {
4451
4469
  };
4452
4470
  this.positionTracker = new PositionTracker(store, { maxTradeHistory: 50 });
4453
4471
  this.executor = new TradeExecutor(this.client, this.config, () => this.getConfigHash());
4454
- this.riskManager = new RiskManager(this.config.trading);
4472
+ this.riskManager = new RiskManager(this.config.trading, this.riskUniverse);
4455
4473
  this.marketData = new MarketDataService(this.getRpcUrl(), store);
4456
4474
  setGlobalResolver(this.marketData.getResolver());
4457
4475
  const savedRisk = this.positionTracker.getRiskState();
@@ -4981,7 +4999,7 @@ var AgentRuntime = class {
4981
4999
  updated = true;
4982
5000
  }
4983
5001
  if (updated) {
4984
- this.riskManager = new RiskManager(this.config.trading);
5002
+ this.riskManager = new RiskManager(this.config.trading, this.riskUniverse);
4985
5003
  const savedRiskState = this.positionTracker.getRiskState();
4986
5004
  if (savedRiskState.lastResetDate) {
4987
5005
  this.riskManager.restoreState(savedRiskState);
@@ -5884,7 +5902,7 @@ function loadSecureEnv(basePath, passphrase) {
5884
5902
  }
5885
5903
 
5886
5904
  // src/index.ts
5887
- var AGENT_VERSION = "0.1.37";
5905
+ var AGENT_VERSION = "0.1.38";
5888
5906
  // Annotate the CommonJS export names for ESM import in node:
5889
5907
  0 && (module.exports = {
5890
5908
  AGENT_VERSION,
package/dist/index.mjs CHANGED
@@ -49,7 +49,7 @@ import {
49
49
  loadStrategy,
50
50
  validateConfig,
51
51
  validateStrategy
52
- } from "./chunk-H7HKHVR7.mjs";
52
+ } from "./chunk-27O4UUAA.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.37",
3
+ "version": "0.1.38",
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.15",
32
+ "@exagent/sdk": "^0.1.16",
33
33
  "@nktkas/hyperliquid": "^0.31.0",
34
34
  "chalk": "^5.3.0",
35
35
  "commander": "^12.0.0",