@exagent/agent 0.1.38 → 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
@@ -680,14 +680,14 @@ declare class VaultManager {
680
680
  * Shared types for the command center relay protocol.
681
681
  * Used by both the SDK relay client and the API relay service.
682
682
  */
683
- type AgentMode = 'idle' | 'trading';
684
- 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';
685
685
  interface RelayCommand {
686
686
  id: string;
687
687
  type: CommandType;
688
688
  params?: Record<string, unknown>;
689
689
  }
690
- 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';
691
691
  type MessageLevel = 'info' | 'warning' | 'error' | 'success';
692
692
  interface AgentStatusPayload {
693
693
  mode: AgentMode;
@@ -739,6 +739,22 @@ interface AgentStatusPayload {
739
739
  recentTrades: number;
740
740
  totalRealizedPnL: number;
741
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
+ };
742
758
  /** Current on-chain config hash (for epoch tracking) */
743
759
  configHash?: string;
744
760
  /** Config hash awaiting owner approval — null/undefined means no pending verification */
@@ -786,6 +802,10 @@ declare class AgentRuntime {
786
802
  private allowedTokens;
787
803
  private strategyContext;
788
804
  private positionTracker;
805
+ private paperExecutor;
806
+ private paperPortfolio;
807
+ /** Whether agent was started directly in paper mode via CLI */
808
+ private startInPaperMode;
789
809
  private perpClient;
790
810
  private perpSigner;
791
811
  private perpOrders;
@@ -801,7 +821,12 @@ declare class AgentRuntime {
801
821
  private cachedPerpMarginUsed;
802
822
  private cachedPerpLeverage;
803
823
  private cachedPerpOpenPositions;
804
- 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?;
805
830
  /**
806
831
  * Initialize the agent runtime
807
832
  */
@@ -858,6 +883,16 @@ declare class AgentRuntime {
858
883
  * Handle a command from the command center
859
884
  */
860
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;
861
896
  /**
862
897
  * Periodically check if the owner has approved the pending config hash.
863
898
  * Called from sendRelayStatus at most every 2.5 minutes (timestamp-throttled).
@@ -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.38";
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
@@ -680,14 +680,14 @@ declare class VaultManager {
680
680
  * Shared types for the command center relay protocol.
681
681
  * Used by both the SDK relay client and the API relay service.
682
682
  */
683
- type AgentMode = 'idle' | 'trading';
684
- 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';
685
685
  interface RelayCommand {
686
686
  id: string;
687
687
  type: CommandType;
688
688
  params?: Record<string, unknown>;
689
689
  }
690
- 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';
691
691
  type MessageLevel = 'info' | 'warning' | 'error' | 'success';
692
692
  interface AgentStatusPayload {
693
693
  mode: AgentMode;
@@ -739,6 +739,22 @@ interface AgentStatusPayload {
739
739
  recentTrades: number;
740
740
  totalRealizedPnL: number;
741
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
+ };
742
758
  /** Current on-chain config hash (for epoch tracking) */
743
759
  configHash?: string;
744
760
  /** Config hash awaiting owner approval — null/undefined means no pending verification */
@@ -786,6 +802,10 @@ declare class AgentRuntime {
786
802
  private allowedTokens;
787
803
  private strategyContext;
788
804
  private positionTracker;
805
+ private paperExecutor;
806
+ private paperPortfolio;
807
+ /** Whether agent was started directly in paper mode via CLI */
808
+ private startInPaperMode;
789
809
  private perpClient;
790
810
  private perpSigner;
791
811
  private perpOrders;
@@ -801,7 +821,12 @@ declare class AgentRuntime {
801
821
  private cachedPerpMarginUsed;
802
822
  private cachedPerpLeverage;
803
823
  private cachedPerpOpenPositions;
804
- 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?;
805
830
  /**
806
831
  * Initialize the agent runtime
807
832
  */
@@ -858,6 +883,16 @@ declare class AgentRuntime {
858
883
  * Handle a command from the command center
859
884
  */
860
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;
861
896
  /**
862
897
  * Periodically check if the owner has approved the pending config hash.
863
898
  * Called from sendRelayStatus at most every 2.5 minutes (timestamp-throttled).
@@ -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.38";
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 };