@exagent/agent 0.1.0

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.
@@ -0,0 +1,673 @@
1
+ import { z } from 'zod';
2
+ import { Address, Hash } from 'viem';
3
+ import { ExagentClient } from '@exagent/sdk';
4
+
5
+ declare const LLMProviderSchema: z.ZodEnum<["openai", "anthropic", "google", "deepseek", "mistral", "groq", "together", "ollama", "custom"]>;
6
+ type LLMProvider = z.infer<typeof LLMProviderSchema>;
7
+ declare const LLMConfigSchema: z.ZodObject<{
8
+ provider: z.ZodEnum<["openai", "anthropic", "google", "deepseek", "mistral", "groq", "together", "ollama", "custom"]>;
9
+ model: z.ZodOptional<z.ZodString>;
10
+ apiKey: z.ZodOptional<z.ZodString>;
11
+ endpoint: z.ZodOptional<z.ZodString>;
12
+ temperature: z.ZodDefault<z.ZodNumber>;
13
+ maxTokens: z.ZodDefault<z.ZodNumber>;
14
+ }, "strip", z.ZodTypeAny, {
15
+ provider: "custom" | "openai" | "anthropic" | "google" | "deepseek" | "mistral" | "groq" | "together" | "ollama";
16
+ temperature: number;
17
+ maxTokens: number;
18
+ model?: string | undefined;
19
+ apiKey?: string | undefined;
20
+ endpoint?: string | undefined;
21
+ }, {
22
+ provider: "custom" | "openai" | "anthropic" | "google" | "deepseek" | "mistral" | "groq" | "together" | "ollama";
23
+ model?: string | undefined;
24
+ apiKey?: string | undefined;
25
+ endpoint?: string | undefined;
26
+ temperature?: number | undefined;
27
+ maxTokens?: number | undefined;
28
+ }>;
29
+ type LLMConfig = z.infer<typeof LLMConfigSchema>;
30
+ declare const RiskUniverseSchema: z.ZodEnum<["core", "established", "derivatives", "emerging", "frontier"]>;
31
+ type RiskUniverse = z.infer<typeof RiskUniverseSchema>;
32
+ declare const TradingConfigSchema: z.ZodObject<{
33
+ timeHorizon: z.ZodDefault<z.ZodEnum<["intraday", "swing", "position"]>>;
34
+ maxPositionSizeBps: z.ZodDefault<z.ZodNumber>;
35
+ maxDailyLossBps: z.ZodDefault<z.ZodNumber>;
36
+ maxConcurrentPositions: z.ZodDefault<z.ZodNumber>;
37
+ tradingIntervalMs: z.ZodDefault<z.ZodNumber>;
38
+ }, "strip", z.ZodTypeAny, {
39
+ timeHorizon: "intraday" | "swing" | "position";
40
+ maxPositionSizeBps: number;
41
+ maxDailyLossBps: number;
42
+ maxConcurrentPositions: number;
43
+ tradingIntervalMs: number;
44
+ }, {
45
+ timeHorizon?: "intraday" | "swing" | "position" | undefined;
46
+ maxPositionSizeBps?: number | undefined;
47
+ maxDailyLossBps?: number | undefined;
48
+ maxConcurrentPositions?: number | undefined;
49
+ tradingIntervalMs?: number | undefined;
50
+ }>;
51
+ type TradingConfig = z.infer<typeof TradingConfigSchema>;
52
+ declare const VaultPolicySchema: z.ZodEnum<["disabled", "manual", "auto_when_qualified"]>;
53
+ type VaultPolicy = z.infer<typeof VaultPolicySchema>;
54
+ declare const VaultConfigSchema: z.ZodObject<{
55
+ policy: z.ZodDefault<z.ZodEnum<["disabled", "manual", "auto_when_qualified"]>>;
56
+ defaultName: z.ZodOptional<z.ZodString>;
57
+ defaultSymbol: z.ZodOptional<z.ZodString>;
58
+ feeRecipient: z.ZodOptional<z.ZodString>;
59
+ preferVaultTrading: z.ZodDefault<z.ZodBoolean>;
60
+ }, "strip", z.ZodTypeAny, {
61
+ policy: "disabled" | "manual" | "auto_when_qualified";
62
+ preferVaultTrading: boolean;
63
+ defaultName?: string | undefined;
64
+ defaultSymbol?: string | undefined;
65
+ feeRecipient?: string | undefined;
66
+ }, {
67
+ policy?: "disabled" | "manual" | "auto_when_qualified" | undefined;
68
+ defaultName?: string | undefined;
69
+ defaultSymbol?: string | undefined;
70
+ feeRecipient?: string | undefined;
71
+ preferVaultTrading?: boolean | undefined;
72
+ }>;
73
+ type VaultConfig = z.infer<typeof VaultConfigSchema>;
74
+ declare const AgentConfigSchema: z.ZodObject<{
75
+ agentId: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
76
+ name: z.ZodString;
77
+ network: z.ZodDefault<z.ZodEnum<["mainnet", "testnet"]>>;
78
+ wallet: z.ZodOptional<z.ZodObject<{
79
+ setup: z.ZodDefault<z.ZodEnum<["generate", "provide"]>>;
80
+ }, "strip", z.ZodTypeAny, {
81
+ setup: "generate" | "provide";
82
+ }, {
83
+ setup?: "generate" | "provide" | undefined;
84
+ }>>;
85
+ llm: z.ZodObject<{
86
+ provider: z.ZodEnum<["openai", "anthropic", "google", "deepseek", "mistral", "groq", "together", "ollama", "custom"]>;
87
+ model: z.ZodOptional<z.ZodString>;
88
+ apiKey: z.ZodOptional<z.ZodString>;
89
+ endpoint: z.ZodOptional<z.ZodString>;
90
+ temperature: z.ZodDefault<z.ZodNumber>;
91
+ maxTokens: z.ZodDefault<z.ZodNumber>;
92
+ }, "strip", z.ZodTypeAny, {
93
+ provider: "custom" | "openai" | "anthropic" | "google" | "deepseek" | "mistral" | "groq" | "together" | "ollama";
94
+ temperature: number;
95
+ maxTokens: number;
96
+ model?: string | undefined;
97
+ apiKey?: string | undefined;
98
+ endpoint?: string | undefined;
99
+ }, {
100
+ provider: "custom" | "openai" | "anthropic" | "google" | "deepseek" | "mistral" | "groq" | "together" | "ollama";
101
+ model?: string | undefined;
102
+ apiKey?: string | undefined;
103
+ endpoint?: string | undefined;
104
+ temperature?: number | undefined;
105
+ maxTokens?: number | undefined;
106
+ }>;
107
+ riskUniverse: z.ZodDefault<z.ZodEnum<["core", "established", "derivatives", "emerging", "frontier"]>>;
108
+ trading: z.ZodDefault<z.ZodObject<{
109
+ timeHorizon: z.ZodDefault<z.ZodEnum<["intraday", "swing", "position"]>>;
110
+ maxPositionSizeBps: z.ZodDefault<z.ZodNumber>;
111
+ maxDailyLossBps: z.ZodDefault<z.ZodNumber>;
112
+ maxConcurrentPositions: z.ZodDefault<z.ZodNumber>;
113
+ tradingIntervalMs: z.ZodDefault<z.ZodNumber>;
114
+ }, "strip", z.ZodTypeAny, {
115
+ timeHorizon: "intraday" | "swing" | "position";
116
+ maxPositionSizeBps: number;
117
+ maxDailyLossBps: number;
118
+ maxConcurrentPositions: number;
119
+ tradingIntervalMs: number;
120
+ }, {
121
+ timeHorizon?: "intraday" | "swing" | "position" | undefined;
122
+ maxPositionSizeBps?: number | undefined;
123
+ maxDailyLossBps?: number | undefined;
124
+ maxConcurrentPositions?: number | undefined;
125
+ tradingIntervalMs?: number | undefined;
126
+ }>>;
127
+ vault: z.ZodDefault<z.ZodObject<{
128
+ policy: z.ZodDefault<z.ZodEnum<["disabled", "manual", "auto_when_qualified"]>>;
129
+ defaultName: z.ZodOptional<z.ZodString>;
130
+ defaultSymbol: z.ZodOptional<z.ZodString>;
131
+ feeRecipient: z.ZodOptional<z.ZodString>;
132
+ preferVaultTrading: z.ZodDefault<z.ZodBoolean>;
133
+ }, "strip", z.ZodTypeAny, {
134
+ policy: "disabled" | "manual" | "auto_when_qualified";
135
+ preferVaultTrading: boolean;
136
+ defaultName?: string | undefined;
137
+ defaultSymbol?: string | undefined;
138
+ feeRecipient?: string | undefined;
139
+ }, {
140
+ policy?: "disabled" | "manual" | "auto_when_qualified" | undefined;
141
+ defaultName?: string | undefined;
142
+ defaultSymbol?: string | undefined;
143
+ feeRecipient?: string | undefined;
144
+ preferVaultTrading?: boolean | undefined;
145
+ }>>;
146
+ allowedTokens: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
147
+ }, "strip", z.ZodTypeAny, {
148
+ agentId: string | number;
149
+ name: string;
150
+ network: "mainnet" | "testnet";
151
+ llm: {
152
+ provider: "custom" | "openai" | "anthropic" | "google" | "deepseek" | "mistral" | "groq" | "together" | "ollama";
153
+ temperature: number;
154
+ maxTokens: number;
155
+ model?: string | undefined;
156
+ apiKey?: string | undefined;
157
+ endpoint?: string | undefined;
158
+ };
159
+ riskUniverse: "core" | "established" | "derivatives" | "emerging" | "frontier";
160
+ trading: {
161
+ timeHorizon: "intraday" | "swing" | "position";
162
+ maxPositionSizeBps: number;
163
+ maxDailyLossBps: number;
164
+ maxConcurrentPositions: number;
165
+ tradingIntervalMs: number;
166
+ };
167
+ vault: {
168
+ policy: "disabled" | "manual" | "auto_when_qualified";
169
+ preferVaultTrading: boolean;
170
+ defaultName?: string | undefined;
171
+ defaultSymbol?: string | undefined;
172
+ feeRecipient?: string | undefined;
173
+ };
174
+ wallet?: {
175
+ setup: "generate" | "provide";
176
+ } | undefined;
177
+ allowedTokens?: string[] | undefined;
178
+ }, {
179
+ agentId: string | number;
180
+ name: string;
181
+ llm: {
182
+ provider: "custom" | "openai" | "anthropic" | "google" | "deepseek" | "mistral" | "groq" | "together" | "ollama";
183
+ model?: string | undefined;
184
+ apiKey?: string | undefined;
185
+ endpoint?: string | undefined;
186
+ temperature?: number | undefined;
187
+ maxTokens?: number | undefined;
188
+ };
189
+ network?: "mainnet" | "testnet" | undefined;
190
+ wallet?: {
191
+ setup?: "generate" | "provide" | undefined;
192
+ } | undefined;
193
+ riskUniverse?: "core" | "established" | "derivatives" | "emerging" | "frontier" | undefined;
194
+ trading?: {
195
+ timeHorizon?: "intraday" | "swing" | "position" | undefined;
196
+ maxPositionSizeBps?: number | undefined;
197
+ maxDailyLossBps?: number | undefined;
198
+ maxConcurrentPositions?: number | undefined;
199
+ tradingIntervalMs?: number | undefined;
200
+ } | undefined;
201
+ vault?: {
202
+ policy?: "disabled" | "manual" | "auto_when_qualified" | undefined;
203
+ defaultName?: string | undefined;
204
+ defaultSymbol?: string | undefined;
205
+ feeRecipient?: string | undefined;
206
+ preferVaultTrading?: boolean | undefined;
207
+ } | undefined;
208
+ allowedTokens?: string[] | undefined;
209
+ }>;
210
+ type AgentConfig = z.infer<typeof AgentConfigSchema>;
211
+ interface RuntimeConfig extends AgentConfig {
212
+ privateKey: `0x${string}`;
213
+ }
214
+ interface MarketData {
215
+ timestamp: number;
216
+ prices: Record<string, number>;
217
+ balances: Record<string, bigint>;
218
+ portfolioValue: number;
219
+ }
220
+ interface TradeSignal {
221
+ action: 'buy' | 'sell' | 'hold';
222
+ tokenIn: string;
223
+ tokenOut: string;
224
+ amountIn: bigint;
225
+ confidence: number;
226
+ reasoning?: string;
227
+ }
228
+ interface LLMMessage {
229
+ role: 'system' | 'user' | 'assistant';
230
+ content: string;
231
+ }
232
+ interface LLMResponse {
233
+ content: string;
234
+ usage?: {
235
+ promptTokens: number;
236
+ completionTokens: number;
237
+ totalTokens: number;
238
+ };
239
+ }
240
+ type StrategyFunction = (marketData: MarketData, llm: LLMAdapter, config: AgentConfig) => Promise<TradeSignal[]>;
241
+ interface LLMAdapter {
242
+ chat(messages: LLMMessage[]): Promise<LLMResponse>;
243
+ getMetadata(): LLMMetadata;
244
+ }
245
+ interface LLMMetadata {
246
+ provider: LLMProvider;
247
+ model: string;
248
+ isLocal: boolean;
249
+ }
250
+
251
+ /**
252
+ * Vault Manager for Trading Agents
253
+ *
254
+ * Handles vault creation, qualification checking, and vault-aware trading.
255
+ * Respects the agent's vault policy (disabled, manual, auto_when_qualified).
256
+ */
257
+
258
+ interface VaultStatus {
259
+ hasVault: boolean;
260
+ vaultAddress: Address | null;
261
+ totalAssets: bigint;
262
+ canCreateVault: boolean;
263
+ cannotCreateReason: string | null;
264
+ requirementsMet: boolean;
265
+ requirements: {
266
+ veXARequired: bigint;
267
+ burnFee: bigint;
268
+ isBypassed: boolean;
269
+ };
270
+ }
271
+ interface VaultManagerConfig {
272
+ agentId: bigint;
273
+ agentName: string;
274
+ network: 'mainnet' | 'testnet';
275
+ walletKey: `0x${string}`;
276
+ vaultConfig: VaultConfig;
277
+ }
278
+ /**
279
+ * Manages vault lifecycle and vault-aware trading for an agent
280
+ */
281
+ declare class VaultManager {
282
+ private readonly config;
283
+ private readonly publicClient;
284
+ private readonly walletClient;
285
+ private readonly addresses;
286
+ private readonly account;
287
+ private readonly chain;
288
+ private cachedVaultAddress;
289
+ private lastVaultCheck;
290
+ private readonly VAULT_CACHE_TTL;
291
+ constructor(config: VaultManagerConfig);
292
+ /**
293
+ * Get the agent's vault policy
294
+ */
295
+ get policy(): VaultPolicy;
296
+ /**
297
+ * Check if vault trading is preferred when a vault exists
298
+ */
299
+ get preferVaultTrading(): boolean;
300
+ /**
301
+ * Get comprehensive vault status
302
+ */
303
+ getVaultStatus(): Promise<VaultStatus>;
304
+ /**
305
+ * Get vault creation requirements
306
+ */
307
+ getRequirements(): Promise<{
308
+ veXARequired: bigint;
309
+ burnFee: bigint;
310
+ isBypassed: boolean;
311
+ }>;
312
+ /**
313
+ * Get the agent's vault address (cached)
314
+ */
315
+ getVaultAddress(): Promise<Address | null>;
316
+ /**
317
+ * Check if the agent should create a vault based on policy and qualification
318
+ */
319
+ shouldCreateVault(): Promise<{
320
+ should: boolean;
321
+ reason: string;
322
+ }>;
323
+ /**
324
+ * Create a vault for the agent
325
+ * @returns Vault address if successful
326
+ */
327
+ createVault(): Promise<{
328
+ success: boolean;
329
+ vaultAddress?: Address;
330
+ txHash?: Hash;
331
+ error?: string;
332
+ }>;
333
+ /**
334
+ * Execute a trade through the vault (if it exists and policy allows)
335
+ * Returns null if should use direct trading instead
336
+ */
337
+ executeVaultTrade(params: {
338
+ tokenIn: Address;
339
+ tokenOut: Address;
340
+ amountIn: bigint;
341
+ minAmountOut: bigint;
342
+ aggregator: Address;
343
+ swapData: `0x${string}`;
344
+ deadline?: bigint;
345
+ }): Promise<{
346
+ usedVault: boolean;
347
+ txHash?: Hash;
348
+ error?: string;
349
+ } | null>;
350
+ /**
351
+ * Run the auto-creation check (call this periodically in the agent loop)
352
+ * Only creates vault if policy is 'auto_when_qualified'
353
+ */
354
+ checkAndAutoCreateVault(): Promise<{
355
+ action: 'created' | 'skipped' | 'already_exists' | 'not_qualified';
356
+ vaultAddress?: Address;
357
+ reason: string;
358
+ }>;
359
+ }
360
+
361
+ /**
362
+ * Agent Runtime
363
+ *
364
+ * The main runtime class that:
365
+ * 1. Initializes connection to blockchain
366
+ * 2. Ensures wallet is linked to agent identity
367
+ * 3. Loads user's strategy
368
+ * 4. Runs the trading loop
369
+ */
370
+ declare class AgentRuntime {
371
+ private config;
372
+ private client;
373
+ private llm;
374
+ private strategy;
375
+ private executor;
376
+ private riskManager;
377
+ private marketData;
378
+ private vaultManager;
379
+ private isRunning;
380
+ private configHash;
381
+ private lastVaultCheck;
382
+ private readonly VAULT_CHECK_INTERVAL;
383
+ constructor(config: RuntimeConfig);
384
+ /**
385
+ * Initialize the agent runtime
386
+ */
387
+ initialize(): Promise<void>;
388
+ /**
389
+ * Initialize the vault manager based on config
390
+ */
391
+ private initializeVaultManager;
392
+ /**
393
+ * Ensure the current wallet is linked to the agent
394
+ */
395
+ private ensureWalletLinked;
396
+ /**
397
+ * Sync the LLM config hash to chain for epoch tracking
398
+ * This ensures trades are attributed to the correct config epoch
399
+ */
400
+ private syncConfigHash;
401
+ /**
402
+ * Get the current config hash (for trade execution)
403
+ */
404
+ getConfigHash(): `0x${string}`;
405
+ /**
406
+ * Start the trading loop
407
+ */
408
+ run(): Promise<void>;
409
+ /**
410
+ * Run a single trading cycle
411
+ */
412
+ private runCycle;
413
+ /**
414
+ * Check for vault auto-creation based on policy
415
+ */
416
+ private checkVaultAutoCreation;
417
+ /**
418
+ * Stop the trading loop
419
+ */
420
+ stop(): void;
421
+ /**
422
+ * Get RPC URL based on network
423
+ */
424
+ private getRpcUrl;
425
+ /**
426
+ * Default tokens to track
427
+ */
428
+ private getDefaultTokens;
429
+ private sleep;
430
+ /**
431
+ * Get current status
432
+ */
433
+ getStatus(): {
434
+ isRunning: boolean;
435
+ agentId: number;
436
+ wallet: string;
437
+ llm: {
438
+ provider: string;
439
+ model: string;
440
+ };
441
+ configHash: string;
442
+ risk: {
443
+ dailyPnL: number;
444
+ dailyLossLimit: number;
445
+ isLimitHit: boolean;
446
+ };
447
+ vault: {
448
+ policy: string;
449
+ hasVault: boolean;
450
+ vaultAddress: string | null;
451
+ };
452
+ };
453
+ /**
454
+ * Get detailed vault status (async)
455
+ */
456
+ getVaultStatus(): Promise<VaultStatus | null>;
457
+ /**
458
+ * Manually trigger vault creation (for 'manual' policy)
459
+ */
460
+ createVault(): Promise<{
461
+ success: boolean;
462
+ vaultAddress?: string;
463
+ error?: string;
464
+ }>;
465
+ }
466
+
467
+ /**
468
+ * Load agent configuration from agent-config.json and .env
469
+ */
470
+ declare function loadConfig(configPath?: string): RuntimeConfig;
471
+ /**
472
+ * Validate that all required configuration is present
473
+ */
474
+ declare function validateConfig(config: RuntimeConfig): void;
475
+ /**
476
+ * Create a sample config for new users
477
+ */
478
+ declare function createSampleConfig(agentId: number, name: string): AgentConfig;
479
+
480
+ /**
481
+ * Base adapter class with common functionality
482
+ */
483
+ declare abstract class BaseLLMAdapter implements LLMAdapter {
484
+ protected config: LLMConfig;
485
+ constructor(config: LLMConfig);
486
+ abstract chat(messages: LLMMessage[]): Promise<LLMResponse>;
487
+ getMetadata(): LLMMetadata;
488
+ /**
489
+ * Format model name for display
490
+ */
491
+ protected getDisplayModel(): string;
492
+ }
493
+
494
+ /**
495
+ * Create an LLM adapter based on configuration
496
+ */
497
+ declare function createLLMAdapter(config: LLMConfig): Promise<LLMAdapter>;
498
+
499
+ /**
500
+ * OpenAI LLM Adapter
501
+ * Also works with OpenAI-compatible APIs (custom endpoints)
502
+ */
503
+ declare class OpenAIAdapter extends BaseLLMAdapter {
504
+ private client;
505
+ constructor(config: LLMConfig);
506
+ chat(messages: LLMMessage[]): Promise<LLMResponse>;
507
+ }
508
+
509
+ /**
510
+ * Anthropic Claude LLM Adapter
511
+ */
512
+ declare class AnthropicAdapter extends BaseLLMAdapter {
513
+ private apiKey;
514
+ private baseUrl;
515
+ constructor(config: LLMConfig);
516
+ chat(messages: LLMMessage[]): Promise<LLMResponse>;
517
+ }
518
+
519
+ /**
520
+ * Ollama Local LLM Adapter
521
+ * Runs models locally without API keys
522
+ */
523
+ declare class OllamaAdapter extends BaseLLMAdapter {
524
+ private baseUrl;
525
+ constructor(config: LLMConfig);
526
+ /**
527
+ * Check if Ollama is running and the model is available
528
+ */
529
+ healthCheck(): Promise<void>;
530
+ chat(messages: LLMMessage[]): Promise<LLMResponse>;
531
+ getMetadata(): LLMMetadata;
532
+ }
533
+
534
+ /**
535
+ * Load user's custom strategy from strategy.ts or strategy.js
536
+ * Falls back to default passthrough if not found
537
+ */
538
+ declare function loadStrategy(strategyPath?: string): Promise<StrategyFunction>;
539
+ /**
540
+ * Validate a strategy function has the correct signature
541
+ */
542
+ declare function validateStrategy(fn: unknown): fn is StrategyFunction;
543
+
544
+ /**
545
+ * Boilerplate Strategy Templates
546
+ *
547
+ * These are example prompts and strategies users can customize.
548
+ * Each template includes:
549
+ * - A system prompt for the LLM
550
+ * - Risk warnings
551
+ * - Example implementation
552
+ *
553
+ * IMPORTANT: These are starting points. Users should customize
554
+ * the prompts and logic for their specific needs.
555
+ */
556
+ interface StrategyTemplate {
557
+ id: string;
558
+ name: string;
559
+ description: string;
560
+ riskLevel: 'low' | 'medium' | 'high' | 'extreme';
561
+ riskWarnings: string[];
562
+ systemPrompt: string;
563
+ exampleCode: string;
564
+ }
565
+ declare const STRATEGY_TEMPLATES: StrategyTemplate[];
566
+ /**
567
+ * Get a strategy template by ID
568
+ */
569
+ declare function getStrategyTemplate(id: string): StrategyTemplate | undefined;
570
+ /**
571
+ * Get all strategy templates
572
+ */
573
+ declare function getAllStrategyTemplates(): StrategyTemplate[];
574
+
575
+ /**
576
+ * Trade Executor
577
+ * Handles execution of trade signals through the ExagentRouter
578
+ */
579
+ declare class TradeExecutor {
580
+ private client;
581
+ private config;
582
+ constructor(client: ExagentClient, config: RuntimeConfig);
583
+ /**
584
+ * Execute a single trade signal
585
+ */
586
+ execute(signal: TradeSignal): Promise<{
587
+ success: boolean;
588
+ txHash?: string;
589
+ error?: string;
590
+ }>;
591
+ /**
592
+ * Execute multiple trade signals
593
+ * Returns results for each signal
594
+ */
595
+ executeAll(signals: TradeSignal[]): Promise<Array<{
596
+ signal: TradeSignal;
597
+ success: boolean;
598
+ txHash?: string;
599
+ error?: string;
600
+ }>>;
601
+ /**
602
+ * Validate a signal against config limits
603
+ */
604
+ private validateSignal;
605
+ private delay;
606
+ }
607
+
608
+ /**
609
+ * Risk Manager
610
+ * Applies guardrails to trade signals before execution
611
+ */
612
+ declare class RiskManager {
613
+ private config;
614
+ private dailyPnL;
615
+ private lastResetDate;
616
+ constructor(config: TradingConfig);
617
+ /**
618
+ * Filter signals through risk checks
619
+ * Returns only signals that pass all guardrails
620
+ */
621
+ filterSignals(signals: TradeSignal[], marketData: MarketData): TradeSignal[];
622
+ /**
623
+ * Validate individual signal against risk limits
624
+ */
625
+ private validateSignal;
626
+ /**
627
+ * Check if daily loss limit has been hit
628
+ */
629
+ private isDailyLossLimitHit;
630
+ /**
631
+ * Estimate USD value of a trade signal
632
+ */
633
+ private estimateSignalValue;
634
+ /**
635
+ * Update daily PnL after a trade
636
+ */
637
+ updatePnL(pnl: number): void;
638
+ /**
639
+ * Get current risk status
640
+ */
641
+ getStatus(): {
642
+ dailyPnL: number;
643
+ dailyLossLimit: number;
644
+ isLimitHit: boolean;
645
+ };
646
+ }
647
+
648
+ /**
649
+ * Market Data Service
650
+ * Fetches prices and portfolio data for strategy analysis
651
+ */
652
+ declare class MarketDataService {
653
+ private rpcUrl;
654
+ constructor(rpcUrl: string);
655
+ /**
656
+ * Fetch current market data for the agent
657
+ */
658
+ fetchMarketData(walletAddress: string, tokenAddresses: string[]): Promise<MarketData>;
659
+ /**
660
+ * Fetch token prices from price oracle
661
+ */
662
+ private fetchPrices;
663
+ /**
664
+ * Fetch token balances from chain
665
+ */
666
+ private fetchBalances;
667
+ /**
668
+ * Calculate total portfolio value in USD
669
+ */
670
+ private calculatePortfolioValue;
671
+ }
672
+
673
+ export { type AgentConfig, AgentConfigSchema, AgentRuntime, AnthropicAdapter, BaseLLMAdapter, type LLMAdapter, type LLMConfig, LLMConfigSchema, type LLMMessage, type LLMMetadata, type LLMProvider, LLMProviderSchema, type LLMResponse, type MarketData, MarketDataService, OllamaAdapter, OpenAIAdapter, RiskManager, type RiskUniverse, RiskUniverseSchema, type RuntimeConfig, STRATEGY_TEMPLATES, type StrategyFunction, type StrategyTemplate, TradeExecutor, type TradeSignal, type TradingConfig, TradingConfigSchema, type VaultConfig, VaultConfigSchema, VaultManager, type VaultManagerConfig, type VaultPolicy, VaultPolicySchema, type VaultStatus, createLLMAdapter, createSampleConfig, getAllStrategyTemplates, getStrategyTemplate, loadConfig, loadStrategy, validateConfig, validateStrategy };