@exagent/agent 0.1.37 → 0.1.39

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/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
  /**
@@ -682,14 +680,14 @@ declare class VaultManager {
682
680
  * Shared types for the command center relay protocol.
683
681
  * Used by both the SDK relay client and the API relay service.
684
682
  */
685
- type AgentMode = 'idle' | 'trading';
686
- type CommandType = 'start_trading' | 'stop_trading' | 'enable_hyperliquid' | 'disable_hyperliquid' | 'start_perp_trading' | 'stop_perp_trading' | 'update_risk_params' | 'update_perp_params' | 'update_trading_interval' | 'create_vault' | 'refresh_status' | 'shutdown';
683
+ type AgentMode = 'idle' | 'trading' | 'paper';
684
+ type CommandType = 'start_trading' | 'stop_trading' | 'start_paper_trading' | 'stop_paper_trading' | 'enable_hyperliquid' | 'disable_hyperliquid' | 'start_perp_trading' | 'stop_perp_trading' | 'update_risk_params' | 'update_perp_params' | 'update_trading_interval' | 'create_vault' | 'refresh_status' | 'shutdown';
687
685
  interface RelayCommand {
688
686
  id: string;
689
687
  type: CommandType;
690
688
  params?: Record<string, unknown>;
691
689
  }
692
- type MessageType = 'trade_executed' | 'trade_failed' | 'perp_fill' | 'perp_liquidation_warning' | 'perp_funding' | 'funds_low' | 'risk_limit_hit' | 'vault_created' | 'config_updated' | 'llm_error' | 'command_result' | 'system';
690
+ type MessageType = 'trade_executed' | 'trade_failed' | 'paper_trade_executed' | 'paper_trade_failed' | 'perp_fill' | 'perp_liquidation_warning' | 'perp_funding' | 'funds_low' | 'risk_limit_hit' | 'vault_created' | 'config_updated' | 'llm_error' | 'command_result' | 'system';
693
691
  type MessageLevel = 'info' | 'warning' | 'error' | 'success';
694
692
  interface AgentStatusPayload {
695
693
  mode: AgentMode;
@@ -741,6 +739,22 @@ interface AgentStatusPayload {
741
739
  recentTrades: number;
742
740
  totalRealizedPnL: number;
743
741
  };
742
+ /** Paper trading state (only present when mode === 'paper') */
743
+ paper?: {
744
+ active: boolean;
745
+ startedAt: number;
746
+ simulatedValue: number;
747
+ simulatedPnLPct: number;
748
+ tradeCount: number;
749
+ totalFees: number;
750
+ wins: number;
751
+ losses: number;
752
+ /** Last 50 equity curve points for chart display */
753
+ equityCurve: Array<{
754
+ timestamp: number;
755
+ value: number;
756
+ }>;
757
+ };
744
758
  /** Current on-chain config hash (for epoch tracking) */
745
759
  configHash?: string;
746
760
  /** Config hash awaiting owner approval — null/undefined means no pending verification */
@@ -788,6 +802,10 @@ declare class AgentRuntime {
788
802
  private allowedTokens;
789
803
  private strategyContext;
790
804
  private positionTracker;
805
+ private paperExecutor;
806
+ private paperPortfolio;
807
+ /** Whether agent was started directly in paper mode via CLI */
808
+ private startInPaperMode;
791
809
  private perpClient;
792
810
  private perpSigner;
793
811
  private perpOrders;
@@ -803,7 +821,12 @@ declare class AgentRuntime {
803
821
  private cachedPerpMarginUsed;
804
822
  private cachedPerpLeverage;
805
823
  private cachedPerpOpenPositions;
806
- constructor(config: RuntimeConfig);
824
+ constructor(config: RuntimeConfig, options?: {
825
+ paperMode?: boolean;
826
+ paperBalances?: Record<string, bigint>;
827
+ });
828
+ /** Initial balances override for paper mode (from CLI --initial-eth/--initial-usdc) */
829
+ private _paperInitialBalances?;
807
830
  /**
808
831
  * Initialize the agent runtime
809
832
  */
@@ -860,6 +883,16 @@ declare class AgentRuntime {
860
883
  * Handle a command from the command center
861
884
  */
862
885
  private handleCommand;
886
+ /**
887
+ * Initialize and enter paper trading mode.
888
+ * Snapshots current on-chain balances (or uses provided overrides) as starting state.
889
+ */
890
+ private startPaperTrading;
891
+ /**
892
+ * Exit paper trading mode and return to idle.
893
+ * Saves the paper portfolio state to disk.
894
+ */
895
+ private stopPaperTrading;
863
896
  /**
864
897
  * Periodically check if the owner has approved the pending config hash.
865
898
  * Called from sendRelayStatus at most every 2.5 minutes (timestamp-throttled).
@@ -1340,7 +1373,9 @@ declare class RiskManager {
1340
1373
  private lastResetDate;
1341
1374
  /** Minimum trade value in USD — trades below this are rejected as dust */
1342
1375
  private minTradeValueUSD;
1343
- constructor(config: TradingConfig);
1376
+ /** Risk universe (0-4). Frontier (4) bypasses buy-only guardrails. */
1377
+ private riskUniverse;
1378
+ constructor(config: TradingConfig, riskUniverse?: number);
1344
1379
  /**
1345
1380
  * Filter signals through risk checks
1346
1381
  * Returns only signals that pass all guardrails
@@ -2203,6 +2238,6 @@ declare function decryptEnvFile(encPath: string, passphrase: string): Record<str
2203
2238
  declare function loadSecureEnv(basePath: string, passphrase?: string): boolean;
2204
2239
 
2205
2240
  /** @exagent/agent package version — update alongside package.json */
2206
- declare const AGENT_VERSION = "0.1.37";
2241
+ declare const AGENT_VERSION = "0.1.39";
2207
2242
 
2208
2243
  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
  /**
@@ -682,14 +680,14 @@ declare class VaultManager {
682
680
  * Shared types for the command center relay protocol.
683
681
  * Used by both the SDK relay client and the API relay service.
684
682
  */
685
- type AgentMode = 'idle' | 'trading';
686
- type CommandType = 'start_trading' | 'stop_trading' | 'enable_hyperliquid' | 'disable_hyperliquid' | 'start_perp_trading' | 'stop_perp_trading' | 'update_risk_params' | 'update_perp_params' | 'update_trading_interval' | 'create_vault' | 'refresh_status' | 'shutdown';
683
+ type AgentMode = 'idle' | 'trading' | 'paper';
684
+ type CommandType = 'start_trading' | 'stop_trading' | 'start_paper_trading' | 'stop_paper_trading' | 'enable_hyperliquid' | 'disable_hyperliquid' | 'start_perp_trading' | 'stop_perp_trading' | 'update_risk_params' | 'update_perp_params' | 'update_trading_interval' | 'create_vault' | 'refresh_status' | 'shutdown';
687
685
  interface RelayCommand {
688
686
  id: string;
689
687
  type: CommandType;
690
688
  params?: Record<string, unknown>;
691
689
  }
692
- type MessageType = 'trade_executed' | 'trade_failed' | 'perp_fill' | 'perp_liquidation_warning' | 'perp_funding' | 'funds_low' | 'risk_limit_hit' | 'vault_created' | 'config_updated' | 'llm_error' | 'command_result' | 'system';
690
+ type MessageType = 'trade_executed' | 'trade_failed' | 'paper_trade_executed' | 'paper_trade_failed' | 'perp_fill' | 'perp_liquidation_warning' | 'perp_funding' | 'funds_low' | 'risk_limit_hit' | 'vault_created' | 'config_updated' | 'llm_error' | 'command_result' | 'system';
693
691
  type MessageLevel = 'info' | 'warning' | 'error' | 'success';
694
692
  interface AgentStatusPayload {
695
693
  mode: AgentMode;
@@ -741,6 +739,22 @@ interface AgentStatusPayload {
741
739
  recentTrades: number;
742
740
  totalRealizedPnL: number;
743
741
  };
742
+ /** Paper trading state (only present when mode === 'paper') */
743
+ paper?: {
744
+ active: boolean;
745
+ startedAt: number;
746
+ simulatedValue: number;
747
+ simulatedPnLPct: number;
748
+ tradeCount: number;
749
+ totalFees: number;
750
+ wins: number;
751
+ losses: number;
752
+ /** Last 50 equity curve points for chart display */
753
+ equityCurve: Array<{
754
+ timestamp: number;
755
+ value: number;
756
+ }>;
757
+ };
744
758
  /** Current on-chain config hash (for epoch tracking) */
745
759
  configHash?: string;
746
760
  /** Config hash awaiting owner approval — null/undefined means no pending verification */
@@ -788,6 +802,10 @@ declare class AgentRuntime {
788
802
  private allowedTokens;
789
803
  private strategyContext;
790
804
  private positionTracker;
805
+ private paperExecutor;
806
+ private paperPortfolio;
807
+ /** Whether agent was started directly in paper mode via CLI */
808
+ private startInPaperMode;
791
809
  private perpClient;
792
810
  private perpSigner;
793
811
  private perpOrders;
@@ -803,7 +821,12 @@ declare class AgentRuntime {
803
821
  private cachedPerpMarginUsed;
804
822
  private cachedPerpLeverage;
805
823
  private cachedPerpOpenPositions;
806
- constructor(config: RuntimeConfig);
824
+ constructor(config: RuntimeConfig, options?: {
825
+ paperMode?: boolean;
826
+ paperBalances?: Record<string, bigint>;
827
+ });
828
+ /** Initial balances override for paper mode (from CLI --initial-eth/--initial-usdc) */
829
+ private _paperInitialBalances?;
807
830
  /**
808
831
  * Initialize the agent runtime
809
832
  */
@@ -860,6 +883,16 @@ declare class AgentRuntime {
860
883
  * Handle a command from the command center
861
884
  */
862
885
  private handleCommand;
886
+ /**
887
+ * Initialize and enter paper trading mode.
888
+ * Snapshots current on-chain balances (or uses provided overrides) as starting state.
889
+ */
890
+ private startPaperTrading;
891
+ /**
892
+ * Exit paper trading mode and return to idle.
893
+ * Saves the paper portfolio state to disk.
894
+ */
895
+ private stopPaperTrading;
863
896
  /**
864
897
  * Periodically check if the owner has approved the pending config hash.
865
898
  * Called from sendRelayStatus at most every 2.5 minutes (timestamp-throttled).
@@ -1340,7 +1373,9 @@ declare class RiskManager {
1340
1373
  private lastResetDate;
1341
1374
  /** Minimum trade value in USD — trades below this are rejected as dust */
1342
1375
  private minTradeValueUSD;
1343
- constructor(config: TradingConfig);
1376
+ /** Risk universe (0-4). Frontier (4) bypasses buy-only guardrails. */
1377
+ private riskUniverse;
1378
+ constructor(config: TradingConfig, riskUniverse?: number);
1344
1379
  /**
1345
1380
  * Filter signals through risk checks
1346
1381
  * Returns only signals that pass all guardrails
@@ -2203,6 +2238,6 @@ declare function decryptEnvFile(encPath: string, passphrase: string): Record<str
2203
2238
  declare function loadSecureEnv(basePath: string, passphrase?: string): boolean;
2204
2239
 
2205
2240
  /** @exagent/agent package version — update alongside package.json */
2206
- declare const AGENT_VERSION = "0.1.37";
2241
+ declare const AGENT_VERSION = "0.1.39";
2207
2242
 
2208
2243
  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 };