evoltagent 1.1.1 → 1.1.2

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,1052 @@
1
+ /**
2
+ * Post-run hooks for agent output processing
3
+ *
4
+ * PostProcessor allows transformation of agent output from raw string response
5
+ * to structured data (e.g., JSON parsing, data validation, formatting)
6
+ */
7
+ /**
8
+ * PostProcessor function type
9
+ *
10
+ * Takes the raw string response from an agent and transforms it into
11
+ * any desired format. Commonly used for:
12
+ * - Parsing JSON responses
13
+ * - Extracting structured data
14
+ * - Validating and transforming output
15
+ * - Converting to domain-specific types
16
+ *
17
+ * @param response - Raw string response from agent
18
+ * @returns Transformed output (any type)
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * // JSON parser post-processor
23
+ * const jsonParser: PostProcessor = async (text) => {
24
+ * const match = text.match(/```json\n([\s\S]+?)\n```/);
25
+ * return match ? JSON.parse(match[1]) : JSON.parse(text);
26
+ * };
27
+ *
28
+ * const agent = new Agent({
29
+ * name: "DataAgent",
30
+ * post_processor: jsonParser
31
+ * });
32
+ *
33
+ * const data = await agent.run("Generate user data");
34
+ * // Returns: { name: "John", age: 30 }
35
+ * ```
36
+ */
37
+ type PostProcessor = (response: string) => Promise<any>;
38
+
39
+ /**
40
+ * Core type definitions for evoltagent
41
+ */
42
+
43
+ interface Message$1 {
44
+ role: 'system' | 'user' | 'assistant';
45
+ content: string;
46
+ images?: string | string[];
47
+ type?: string;
48
+ }
49
+ interface ToolCall {
50
+ type: 'system' | 'user';
51
+ extractedResult: () => string;
52
+ }
53
+ interface ModelResponse$1 {
54
+ type: 'system' | 'user' | 'TaskCompletion';
55
+ extractedResult: () => string | any[] | Record<string, any>;
56
+ rawContentFromLlm?: string;
57
+ }
58
+ interface ToolDescription {
59
+ desc: string;
60
+ execute: (...args: any[]) => Promise<any>;
61
+ argNames: string[];
62
+ serverName?: string;
63
+ inputSchema?: Record<string, any>;
64
+ }
65
+ interface ToolStore {
66
+ addTool: (name: string, desc: string, execute: (...args: any[]) => Promise<any>, argNames: string[], serverName?: string, inputSchema?: Record<string, any>) => void;
67
+ addMcpTools: (agentName: string, serverName: string, stack: any) => Promise<void>;
68
+ getMcpToolsSchemas: (agentName: string, serverName: string, provider: string) => any[];
69
+ getTool: (name: string) => ToolDescription | undefined;
70
+ hasTool: (name: string) => boolean;
71
+ listTools: () => string[];
72
+ toDict?: (provider?: string) => any[];
73
+ contains: (name: string) => boolean;
74
+ getItem: (name: string) => ToolDescription;
75
+ items: () => [string, ToolDescription][];
76
+ keys: () => string[];
77
+ readonly length: number;
78
+ toToolSchema: (name: string, tool: ToolDescription, provider?: string) => any;
79
+ getToolcallSchema: (toolName: string, provider?: string) => any;
80
+ }
81
+ interface ModelConfig {
82
+ provider: string;
83
+ model: string;
84
+ apiKey: string;
85
+ baseUrl: string;
86
+ contextWindowTokens: number;
87
+ maxOutputTokens?: number;
88
+ temperature?: number;
89
+ topP?: number;
90
+ stream?: boolean;
91
+ [key: string]: any;
92
+ }
93
+ interface AgentConfig {
94
+ name: string;
95
+ profile: string;
96
+ system?: string;
97
+ tools?: string[];
98
+ subAgents?: any[];
99
+ mcpServerNames?: string[];
100
+ modelConfig?: string | ModelConfig;
101
+ verbose?: boolean | number;
102
+ useFunctionCalling?: boolean;
103
+ postProcessor?: PostProcessor;
104
+ toolcallManagerPoolSize?: number;
105
+ }
106
+ interface EnvironmentConfig {
107
+ workspace?: string;
108
+ [key: string]: any;
109
+ }
110
+ declare class EvoltError extends Error {
111
+ constructor(message: string);
112
+ }
113
+ declare class ToolExecutionError extends EvoltError {
114
+ constructor(message: string);
115
+ }
116
+ declare class ModelError extends EvoltError {
117
+ constructor(message: string);
118
+ }
119
+
120
+ /**
121
+ * Tool storage and management
122
+ *
123
+ * Python Evolt v0.1.5 Parity - Unified ToolStore implementation
124
+ */
125
+
126
+ declare const SystemToolStore: ToolStore;
127
+ declare const FunctionCallingStore: ToolStore;
128
+ /**
129
+ * @deprecated Use FunctionCallingStore instead. This alias will be removed in v2.0.0
130
+ */
131
+ declare const UserToolStore: ToolStore;
132
+
133
+ /**
134
+ * Tool configuration types
135
+ * TypeScript-native way to define tool descriptions
136
+ */
137
+ /**
138
+ * Tool parameter configuration
139
+ */
140
+ interface ToolParam {
141
+ name: string;
142
+ type: string;
143
+ description: string;
144
+ optional?: boolean;
145
+ }
146
+ /**
147
+ * Tool return configuration
148
+ */
149
+ interface ToolReturn {
150
+ type: string;
151
+ description: string;
152
+ }
153
+ /**
154
+ * Tool method configuration
155
+ */
156
+ interface ToolMethodConfig {
157
+ description: string;
158
+ params?: ToolParam[];
159
+ returns?: ToolReturn;
160
+ examples?: string[];
161
+ }
162
+ /**
163
+ * Complete tool configuration
164
+ * Key is the method name (e.g., 'execute')
165
+ */
166
+ type ToolConfig = Record<string, ToolMethodConfig>;
167
+
168
+ /**
169
+ * TypeScript-native tool registration system
170
+ * Uses configuration objects instead of docstring parsing
171
+ */
172
+
173
+ /**
174
+ * Unified tool registration decorator (Python parity)
175
+ * Registers methods to BOTH SystemToolStore and FunctionCallingStore
176
+ *
177
+ * This simplifies tool registration compared to using separate decorators.
178
+ * The decorator automatically handles both XML (system) and OpenAI (user) formats.
179
+ *
180
+ * @param config - Tool configuration with method definitions
181
+ * @returns Class decorator
182
+ *
183
+ * @example
184
+ * ```typescript
185
+ * @tools({
186
+ * execute: {
187
+ * description: "Tool description",
188
+ * params: [{ name: "param1", type: "string", description: "..." }],
189
+ * returns: { type: "string", description: "..." }
190
+ * }
191
+ * })
192
+ * export class MyTool {
193
+ * async execute(param1: string): Promise<string> { ... }
194
+ * }
195
+ * ```
196
+ */
197
+ declare function tools(config: ToolConfig): ClassDecorator;
198
+ /**
199
+ * Register Agent as tool to SystemToolStore
200
+ */
201
+ declare function registerAgentAsTool(agents: any, verbose?: boolean): string[];
202
+
203
+ /**
204
+ * ThinkTool - Tool for internal reasoning without executing external actions
205
+ *
206
+ * TypeScript-native version using configuration objects
207
+ */
208
+ /**
209
+ * ThinkTool class for internal reasoning
210
+ */
211
+ declare class ThinkTool {
212
+ execute(thought: string): Promise<string>;
213
+ }
214
+
215
+ /**
216
+ * CommandTool - Command line tool for executing bash commands in background
217
+ *
218
+ * Converts Python's cmd_tool.py to TypeScript
219
+ */
220
+ /**
221
+ * CommandTool class for executing commands in background
222
+ */
223
+ declare class CommandLineTool {
224
+ execute(command: string, cwd?: string, env?: Record<string, string>): Promise<string>;
225
+ /**
226
+ * List all background processes.
227
+ *
228
+ * Returns:
229
+ * str: The natural language description of the background process list
230
+ */
231
+ list(): Promise<string>;
232
+ /**
233
+ * Stop the specified background process.
234
+ *
235
+ * Args:
236
+ * process_id (str): The process ID to stop
237
+ * force (bool): Whether to force kill the process (using SIGKILL)
238
+ *
239
+ * Returns:
240
+ * str: Natural language description of the operation result
241
+ */
242
+ stop(processId: string, force?: boolean): Promise<string>;
243
+ /**
244
+ * Clean up all background processes.
245
+ *
246
+ * Returns:
247
+ * str: The natural language description of the cleanup result
248
+ */
249
+ cleanup(): Promise<string>;
250
+ }
251
+
252
+ /**
253
+ * FileEditor - Async file reader and editor
254
+ *
255
+ * Converts Python's file_tool.py to TypeScript
256
+ */
257
+ /**
258
+ * FileEditor class for async file operations
259
+ */
260
+ declare class FileEditor {
261
+ read(path: string, lineRange?: string): Promise<string>;
262
+ write(path: string, content: string): Promise<string>;
263
+ find(path: string, pattern: string): Promise<string>;
264
+ findAndReplace(path: string, pattern: string, replacement: string): Promise<string>;
265
+ insert(path: string, content: string, line?: number): Promise<string>;
266
+ }
267
+
268
+ /**
269
+ * ExtendStateMachineTool - Tool for writing ESM content to YAML files
270
+ *
271
+ * Converts Python's esm_tool.py to TypeScript
272
+ */
273
+ /**
274
+ * ExtendStateMachineTool class for writing ESM content
275
+ */
276
+ declare class ExtendStateMachineTool {
277
+ writeEsm(esmContent: string, filepath: string): Promise<string>;
278
+ }
279
+
280
+ /**
281
+ * ApiTool - Tool for writing API files and generating Golang files
282
+ *
283
+ * Converts Python's api_tool.py to TypeScript
284
+ */
285
+ /**
286
+ * ApiTool class for API file operations
287
+ */
288
+ declare class ApiTool {
289
+ write(apiFilePath: string, apiContent: string): Promise<string>;
290
+ generateGolangFilesFromApi(apiFilePath: string, dir: string): Promise<string>;
291
+ }
292
+
293
+ /**
294
+ * Reply2HumanTool - Tool for sending final human-facing replies
295
+ *
296
+ * Converts Python's reply2human.py to TypeScript
297
+ */
298
+ /**
299
+ * Reply2HumanTool class for sending human-facing replies
300
+ */
301
+ declare class Reply2HumanTool {
302
+ reply(reply: string): Promise<string>;
303
+ }
304
+
305
+ /**
306
+ * TodoListTool - Tool for editing todo list file for project
307
+ *
308
+ * Converts Python's todo_list.py to TypeScript
309
+ */
310
+ /**
311
+ * TodoListTool class for managing todo lists
312
+ */
313
+ declare class TodoListTool {
314
+ write(projectName: string, todoList: string, projectDir: string): Promise<string>;
315
+ }
316
+
317
+ /**
318
+ * WriteUIDesignDocument - Tool for writing UI Design Document files
319
+ *
320
+ * Converts Python's design_ui.py to TypeScript
321
+ */
322
+ /**
323
+ * WriteUIDesignDocument class for UI design document operations
324
+ */
325
+ declare class WriteUIDesignDocument {
326
+ write(uiDesignDocumentFileDir: string, elements: Record<string, any>[], composites: Record<string, any>[], pages: Record<string, any>[], functions: Record<string, any>[], styles: Record<string, any>[]): Promise<string>;
327
+ }
328
+
329
+ /**
330
+ * ReflectTool - Tool for reflecting on the state
331
+ *
332
+ * Converts Python's reflect.py to TypeScript
333
+ */
334
+ /**
335
+ * ReflectTool class for state reflection
336
+ */
337
+ declare class ReflectTool {
338
+ reflect(state: string): Promise<string>;
339
+ /**
340
+ * Set the reflection for agent to see.
341
+ */
342
+ setReflection(reflection: string): string;
343
+ }
344
+
345
+ /**
346
+ * SkillsTool - Tool for managing skills
347
+ *
348
+ * Converts Python's tools/skills.py to TypeScript
349
+ */
350
+ /**
351
+ * SkillsTool class for managing skills
352
+ */
353
+ declare class SkillsTool {
354
+ /**
355
+ * Skills directory
356
+ */
357
+ skillsDir: string;
358
+ constructor(skillsDir?: string);
359
+ /**
360
+ * Read the content of the skill description file.
361
+ *
362
+ * Args:
363
+ * name (str): The name of the skill
364
+ *
365
+ * Returns:
366
+ * str: The content of the skill description file
367
+ */
368
+ readSkillDescription(name: string): Promise<string>;
369
+ /**
370
+ * List the skills in the skills root directory
371
+ */
372
+ listSkills(): Promise<string>;
373
+ }
374
+
375
+ declare class GitTool {
376
+ /**
377
+ * Helper method to execute git commands.
378
+ */
379
+ private _executeGitCommand;
380
+ /**
381
+ * Get current branch name.
382
+ */
383
+ private _getCurrentBranch;
384
+ init(cwd?: string, bare?: boolean, initialBranch?: string, config?: Record<string, string>): Promise<string>;
385
+ status(cwd?: string, config?: Record<string, string>): Promise<string>;
386
+ add(files: string, cwd?: string, config?: Record<string, string>): Promise<string>;
387
+ commit(message: string, cwd?: string, allowEmpty?: boolean, config?: Record<string, string>): Promise<string>;
388
+ push(remote?: string, branch?: string, cwd?: string, force?: boolean, config?: Record<string, string>): Promise<string>;
389
+ pull(remote?: string, branch?: string, cwd?: string, config?: Record<string, string>): Promise<string>;
390
+ checkout(target: string, cwd?: string, createBranch?: boolean, config?: Record<string, string>): Promise<string>;
391
+ branch(name?: string, cwd?: string, deleteBranch?: boolean, config?: Record<string, string>): Promise<string>;
392
+ log(cwd?: string, maxCount?: number, oneline?: boolean, filePath?: string, config?: Record<string, string>): Promise<string>;
393
+ diff(cwd?: string, staged?: boolean, filePath?: string, commit1?: string, commit2?: string, config?: Record<string, string>): Promise<string>;
394
+ remote(action?: string, name?: string, url?: string, cwd?: string, config?: Record<string, string>): Promise<string>;
395
+ clone(url: string, directory?: string, cwd?: string, config?: Record<string, string>): Promise<string>;
396
+ fetch(remote?: string, cwd?: string, config?: Record<string, string>): Promise<string>;
397
+ merge(branch: string, cwd?: string, config?: Record<string, string>): Promise<string>;
398
+ show(object?: string, cwd?: string, stat?: boolean, nameOnly?: boolean, format?: string, config?: Record<string, string>): Promise<string>;
399
+ tag(name?: string, cwd?: string, message?: string, deleteTag?: boolean, listAll?: boolean, annotate?: boolean, config?: Record<string, string>): Promise<string>;
400
+ revert(commit: string, cwd?: string, noCommit?: boolean, noEdit?: boolean, mainline?: number, config?: Record<string, string>): Promise<string>;
401
+ }
402
+
403
+ /**
404
+ * Main Agent class with tool use capabilities
405
+ *
406
+ * Converts Python's agent.py to TypeScript
407
+ */
408
+
409
+ /**
410
+ * Main Agent class
411
+ */
412
+ declare class Agent {
413
+ name: string;
414
+ private profile;
415
+ private system;
416
+ private tools;
417
+ private functionCallingTools;
418
+ private mcpServerNames;
419
+ private modelConfig;
420
+ private verbose;
421
+ private model;
422
+ private history;
423
+ private subAgents;
424
+ private toolcallManagerPoolSize;
425
+ private postProcessor;
426
+ private useFunctionCalling;
427
+ constructor(config: AgentConfig);
428
+ /**
429
+ * Get the current system prompt
430
+ */
431
+ get systemPrompt(): string;
432
+ /**
433
+ * Set the system prompt and update history
434
+ */
435
+ set systemPrompt(value: string);
436
+ /**
437
+ * Set the system prompt with system tools descriptions
438
+ * @private
439
+ */
440
+ private setSystem;
441
+ /**
442
+ * Set up function calling tools for OpenAI-style function calling
443
+ * @private
444
+ */
445
+ private setFunctionCallingTools;
446
+ /**
447
+ * Agent loop - processes user input and handles tool calls
448
+ * @private
449
+ */
450
+ private _agentLoop;
451
+ /**
452
+ * Run the agent with given instruction
453
+ */
454
+ run(instruction: string, images?: string | string[]): Promise<string | any>;
455
+ /**
456
+ * Get agent profile
457
+ */
458
+ getProfile(): string;
459
+ /**
460
+ * Get tools
461
+ */
462
+ getTools(): string[];
463
+ /**
464
+ * Get function calling tools schemas
465
+ */
466
+ getFunctionCallingTools(): any[];
467
+ /**
468
+ * Get MCP server names
469
+ */
470
+ getMcpServerNames(): string[];
471
+ /**
472
+ * Get model config (string or ModelConfig object)
473
+ */
474
+ getModelConfig(): string | ModelConfig;
475
+ /**
476
+ * Get model name (for backward compatibility)
477
+ */
478
+ getModelName(): string;
479
+ /**
480
+ * Get verbose setting
481
+ */
482
+ getVerbose(): boolean | number;
483
+ /**
484
+ * Get sub-agents
485
+ */
486
+ getSubAgents(): any[];
487
+ }
488
+
489
+ /**
490
+ * Model abstraction layer using official SDKs
491
+ *
492
+ * Provides a unified interface for multiple LLM providers:
493
+ * - OpenAI (and compatible APIs like DeepSeek)
494
+ * - Anthropic Claude
495
+ * - Google Gemini
496
+ */
497
+
498
+ /**
499
+ * Model response interface
500
+ */
501
+ interface ModelResponse {
502
+ type: 'system' | 'user' | 'TaskCompletion';
503
+ extractedResult: () => string | any[] | Record<string, any>;
504
+ rawContentFromLlm?: string;
505
+ }
506
+ /**
507
+ * Model class for interacting with LLM providers
508
+ * Uses official SDKs for better reliability and type safety
509
+ */
510
+ declare class Model {
511
+ private modelName;
512
+ private config;
513
+ private openaiClient?;
514
+ private anthropicClient?;
515
+ private geminiClient?;
516
+ constructor(model?: string | ModelConfig);
517
+ /**
518
+ * Initialize the appropriate SDK client based on provider
519
+ */
520
+ private _initializeClient;
521
+ /**
522
+ * Asynchronous chat completion
523
+ */
524
+ achat(messages: any[], tools?: any[], stream?: boolean): Promise<ModelResponse[]>;
525
+ /**
526
+ * Call OpenAI-compatible API (OpenAI, DeepSeek, etc.)
527
+ */
528
+ private _callOpenAICompatible;
529
+ /**
530
+ * Call Anthropic API
531
+ */
532
+ private _callAnthropic;
533
+ /**
534
+ * Call Google Gemini API
535
+ */
536
+ private _callGemini;
537
+ /**
538
+ * Convert OpenAI format messages to Gemini format
539
+ */
540
+ private _convertMessagesToGeminiFormat;
541
+ /**
542
+ * Get model configuration
543
+ */
544
+ getConfig(): ModelConfig;
545
+ /**
546
+ * Get model name
547
+ */
548
+ getName(): string;
549
+ /**
550
+ * Check if model supports tool calling
551
+ */
552
+ supportsToolCalling(): boolean;
553
+ }
554
+
555
+ /**
556
+ * Message class for conversation history
557
+ *
558
+ * Converts Python's message.py to TypeScript
559
+ */
560
+
561
+ /**
562
+ * Message class representing a single message in conversation
563
+ */
564
+ declare class Message implements Message$1 {
565
+ role: 'system' | 'user' | 'assistant';
566
+ content: string;
567
+ images?: string | string[];
568
+ type?: string;
569
+ constructor(role: 'system' | 'user' | 'assistant', content: string, images?: string | string[], type?: string);
570
+ /**
571
+ * Create message from user input
572
+ */
573
+ static fromUserMsg(content: string, images?: string | string[]): Message;
574
+ /**
575
+ * Create message from assistant response
576
+ */
577
+ static fromAssistantMsg(content: string): Message;
578
+ /**
579
+ * Create system message
580
+ */
581
+ static fromSystemMsg(content: string): Message;
582
+ /**
583
+ * Convert to plain object for API calls
584
+ */
585
+ toObject(): any;
586
+ /**
587
+ * Check if message contains images
588
+ */
589
+ hasImages(): boolean;
590
+ /**
591
+ * Get message content length
592
+ */
593
+ getContentLength(): number;
594
+ /**
595
+ * Convert to string representation
596
+ */
597
+ toString(): string;
598
+ /**
599
+ * Convert to OpenAI Vision API format with base64-encoded images
600
+ * This method handles:
601
+ * - HTTP/HTTPS URLs: Downloads and converts to base64
602
+ * - Local file paths: Reads file and converts to base64
603
+ * - Already base64 strings: Passes through
604
+ */
605
+ toChatMessage(): Promise<Record<string, any>>;
606
+ /**
607
+ * Get MIME type from file path or URL
608
+ */
609
+ private getMimeType;
610
+ /**
611
+ * Encode local file to base64
612
+ */
613
+ private encodeLocalFile;
614
+ /**
615
+ * Fetch and encode HTTP image to base64
616
+ */
617
+ private encodeHttpImage;
618
+ }
619
+
620
+ /**
621
+ * Toolcall class and types
622
+ *
623
+ * Extracted from src/utils/toolUtil.ts to mirror Python evolt/schemas/toolcall.py
624
+ */
625
+ /**
626
+ * Toolcall execution state
627
+ */
628
+ type ToolcallState = 'pending' | 'running' | 'success' | 'failed';
629
+ /**
630
+ * Toolcall type
631
+ */
632
+ type ToolcallType = 'system' | 'user' | 'TaskCompletion';
633
+ /**
634
+ * Toolcall class representing a single tool call
635
+ */
636
+ declare class Toolcall {
637
+ name: string;
638
+ input: Record<string, any>;
639
+ isExtractedSuccess: boolean;
640
+ failedExtractedReason?: string;
641
+ executedState: ToolcallState;
642
+ executedContent?: string;
643
+ toolCallId: string;
644
+ type: ToolcallType;
645
+ rawContentFromLlm?: string;
646
+ constructor(config: {
647
+ name: string;
648
+ input?: Record<string, any>;
649
+ isExtractedSuccess?: boolean;
650
+ failedExtractedReason?: string;
651
+ executedState?: ToolcallState;
652
+ executedContent?: string;
653
+ toolCallId?: string;
654
+ type?: ToolcallType;
655
+ rawContentFromLlm?: string;
656
+ });
657
+ /**
658
+ * Toolcall extraction result description
659
+ */
660
+ extractedResult(): string | Record<string, any> | Record<string, any>[];
661
+ /**
662
+ * Toolcall execution result: Feedback to LLM
663
+ */
664
+ executedResult(): string | Record<string, any>;
665
+ }
666
+
667
+ /**
668
+ * Message history management
669
+ *
670
+ * Converts Python's message_history.py to TypeScript
671
+ */
672
+
673
+ /**
674
+ * Message history class for managing conversation context
675
+ */
676
+ declare class MessageHistory {
677
+ private messages;
678
+ private systemPrompt;
679
+ private model;
680
+ private contextWindowTokens;
681
+ private currentTokens;
682
+ constructor(model: string, system: string, contextWindowTokens: number);
683
+ /**
684
+ * Add a message to history
685
+ */
686
+ addMessage(message: Message): void;
687
+ addMessage(role: 'system' | 'user' | 'assistant' | 'tool', content: string): void;
688
+ addMessage(messageObject: any): void;
689
+ /**
690
+ * Get all messages
691
+ */
692
+ getMessages(): (Message | Record<string, any>)[];
693
+ /**
694
+ * Get messages formatted for API calls
695
+ * Async version to handle base64 image encoding
696
+ */
697
+ formatForApi(): Promise<any[]>;
698
+ /**
699
+ * Update system prompt
700
+ */
701
+ updateSystem(system: string): void;
702
+ /**
703
+ * Truncate history to fit context window
704
+ * Preserves tool call chains: assistant(with tool_calls) → tool messages
705
+ */
706
+ truncate(): void;
707
+ /**
708
+ * Clear all messages except system
709
+ */
710
+ clear(): void;
711
+ /**
712
+ * Get the last message
713
+ */
714
+ getLastMessage(): Message | Record<string, any> | null;
715
+ /**
716
+ * Get message count
717
+ */
718
+ getMessageCount(): number;
719
+ /**
720
+ * Get formatted context usage information
721
+ */
722
+ get formattedContextUsage(): string;
723
+ /**
724
+ * Estimate tokens for text (simplified implementation)
725
+ */
726
+ private estimateTokens;
727
+ /**
728
+ * Get conversation as string
729
+ */
730
+ toString(): string;
731
+ }
732
+
733
+ /**
734
+ * Base environment for agent management
735
+ *
736
+ * Converts Python's environment/base.py to TypeScript
737
+ */
738
+
739
+ /**
740
+ * Instruction type enumeration
741
+ */
742
+ declare enum InstructionType {
743
+ VALID = "valid",
744
+ QUIT = "quit",
745
+ SEND_TO_ALL = "sendToAll",
746
+ NO_AGENT_NAME = "noAgentName",
747
+ NO_AVAILABLE_AGENT_NAME = "noAvailableAgentName"
748
+ }
749
+ /**
750
+ * Environment for the agent
751
+ */
752
+ declare class BaseEnvironment {
753
+ /**
754
+ * List of agents in the environment
755
+ */
756
+ agents: Agent[];
757
+ /**
758
+ * Assign skills to agent with their names
759
+ */
760
+ agentSkills: Record<string, string[]>;
761
+ constructor(agents?: Agent[], agentSkills?: Record<string, string[]>);
762
+ /**
763
+ * Set agent skills after initialization
764
+ */
765
+ private setAgentSkills;
766
+ /**
767
+ * Check if instruction has agent name
768
+ */
769
+ hasAgentName(instruction: string): boolean;
770
+ /**
771
+ * Post process instruction
772
+ */
773
+ postProcessInstruction(instruction: string, agentNames: string[]): [InstructionType, string];
774
+ /**
775
+ * Run with a single goal until completion (non-interactive mode)
776
+ */
777
+ runGoal(goal: string): Promise<void>;
778
+ /**
779
+ * Run the environment (interactive mode)
780
+ */
781
+ run(): Promise<void>;
782
+ }
783
+
784
+ /**
785
+ * Coding environment for agent management
786
+ *
787
+ * Converts Python's environment/coding.py to TypeScript
788
+ */
789
+
790
+ /**
791
+ * Environment for coding
792
+ */
793
+ declare class CodingEnvironment extends BaseEnvironment {
794
+ /**
795
+ * Workspace directory
796
+ */
797
+ workspaceDir: string;
798
+ constructor(agents?: Agent[], agentSkills?: Record<string, string[]>, workspaceDir?: string);
799
+ /**
800
+ * Set workspace directory after initialization
801
+ */
802
+ private setWorkspaceDir;
803
+ }
804
+
805
+ /**
806
+ * Model configuration loader
807
+ *
808
+ * Converts Python's config_loader.py to TypeScript
809
+ */
810
+
811
+ /**
812
+ * Load model configuration from YAML file
813
+ */
814
+ declare function loadModelConfig(modelName?: string): ModelConfig;
815
+
816
+ /**
817
+ * Application constants
818
+ *
819
+ * Converts Python's constants.py to TypeScript
820
+ */
821
+ /**
822
+ * Default configuration values
823
+ */
824
+ declare const DEFAULT_CONFIG: {
825
+ MODEL: string;
826
+ PROVIDER: string;
827
+ CONTEXT_WINDOW: number;
828
+ MAX_OUTPUT_TOKENS: number;
829
+ TEMPERATURE: number;
830
+ TOP_P: number;
831
+ };
832
+ /**
833
+ * Tool-related constants
834
+ */
835
+ declare const TOOL_CONSTANTS: {
836
+ SYSTEM_TOOL_PREFIX: string;
837
+ USER_TOOL_PREFIX: string;
838
+ AGENT_TOOL_PREFIX: string;
839
+ MCP_TOOL_PREFIX: string;
840
+ };
841
+ /**
842
+ * Message role constants
843
+ */
844
+ declare const MESSAGE_ROLES: {
845
+ readonly SYSTEM: "system";
846
+ readonly USER: "user";
847
+ readonly ASSISTANT: "assistant";
848
+ };
849
+ /**
850
+ * Tool call types
851
+ */
852
+ declare const TOOL_CALL_TYPES: {
853
+ readonly SYSTEM: "system";
854
+ readonly USER: "user";
855
+ };
856
+ /**
857
+ * Environment variables
858
+ */
859
+ declare const ENV_VARS: {
860
+ EVOLT_CONFIG_PATH: string;
861
+ DEEPSEEK_API_KEY: string;
862
+ DEEPSEEK_BASE_URL: string;
863
+ OPENAI_API_KEY: string;
864
+ ANTHROPIC_API_KEY: string;
865
+ };
866
+ /**
867
+ * Error messages
868
+ */
869
+ declare const ERROR_MESSAGES: {
870
+ CONFIG_LOAD_FAILED: string;
871
+ MODEL_NOT_FOUND: string;
872
+ TOOL_NOT_REGISTERED: string;
873
+ INVALID_MESSAGE_FORMAT: string;
874
+ TOOL_EXECUTION_FAILED: string;
875
+ };
876
+ /**
877
+ * Logging levels
878
+ */
879
+ declare const LOG_LEVELS: {
880
+ readonly DEBUG: 0;
881
+ readonly INFO: 1;
882
+ readonly WARNING: 2;
883
+ readonly ERROR: 3;
884
+ };
885
+
886
+ /**
887
+ * Path configuration and utilities
888
+ *
889
+ * Converts Python's paths.py to TypeScript
890
+ */
891
+ /**
892
+ * Get workspace directory
893
+ */
894
+ declare function getWorkspaceDir(): string;
895
+ /**
896
+ * Get configuration directory
897
+ */
898
+ declare function getConfigDir(): string;
899
+ /**
900
+ * Get logs directory
901
+ */
902
+ declare function getLogsDir(): string;
903
+ /**
904
+ * Get cache directory
905
+ */
906
+ declare function getCacheDir(): string;
907
+ /**
908
+ * Get skills directory
909
+ */
910
+ declare function getSkillsDir(): string;
911
+ /**
912
+ * Ensure directory exists
913
+ */
914
+ declare function ensureDir(dirPath: string): void;
915
+ /**
916
+ * Get absolute path relative to workspace
917
+ */
918
+ declare function getWorkspacePath(relativePath: string): string;
919
+ /**
920
+ * Get absolute path relative to config directory
921
+ */
922
+ declare function getConfigPath(relativePath: string): string;
923
+ /**
924
+ * Check if path is within workspace
925
+ */
926
+ declare function isInWorkspace(filePath: string): boolean;
927
+ /**
928
+ * Normalize path for cross-platform compatibility
929
+ */
930
+ declare function normalizePath(filePath: string): string;
931
+ /**
932
+ * Get file extension
933
+ */
934
+ declare function getFileExtension(filePath: string): string;
935
+ /**
936
+ * Check if file exists
937
+ */
938
+ declare function fileExists(filePath: string): boolean;
939
+ /**
940
+ * Create temporary file path
941
+ */
942
+ declare function getTempFilePath(prefix?: string): string;
943
+ declare const WORKSPACE_DIR: string;
944
+ declare const SKILLS_DIR: string;
945
+
946
+ /**
947
+ * Application settings and runtime configuration
948
+ *
949
+ * Converts Python's settings.py to TypeScript
950
+ */
951
+ /**
952
+ * Application settings interface
953
+ */
954
+ interface AppSettings {
955
+ logLevel: number;
956
+ verbose: boolean;
957
+ debug: boolean;
958
+ workspace: string;
959
+ maxRetries: number;
960
+ timeout: number;
961
+ enableCache: boolean;
962
+ enableTelemetry: boolean;
963
+ }
964
+ /**
965
+ * Default application settings
966
+ */
967
+ declare const DEFAULT_SETTINGS: AppSettings;
968
+ /**
969
+ * Global settings instance
970
+ */
971
+ declare class SettingsManager {
972
+ private settings;
973
+ /**
974
+ * Update settings
975
+ */
976
+ update(newSettings: Partial<AppSettings>): void;
977
+ /**
978
+ * Get current settings
979
+ */
980
+ get(): AppSettings;
981
+ /**
982
+ * Reset to default settings
983
+ */
984
+ reset(): void;
985
+ /**
986
+ * Get specific setting value
987
+ */
988
+ getValue<K extends keyof AppSettings>(key: K): AppSettings[K];
989
+ /**
990
+ * Set specific setting value
991
+ */
992
+ setValue<K extends keyof AppSettings>(key: K, value: AppSettings[K]): void;
993
+ }
994
+ declare const settings: SettingsManager;
995
+ /**
996
+ * Initialize settings from environment variables
997
+ */
998
+ declare function initializeSettings(): void;
999
+ /**
1000
+ * Get current settings (convenience function)
1001
+ */
1002
+ declare function getSettings(): AppSettings;
1003
+ /**
1004
+ * Update settings (convenience function)
1005
+ */
1006
+ declare function updateSettings(newSettings: Partial<AppSettings>): void;
1007
+
1008
+ /**
1009
+ * Winston logger configuration
1010
+ *
1011
+ * Provides a centralized logging solution to replace console calls
1012
+ * Format inspired by loguru for better readability
1013
+ */
1014
+ declare const _default: {
1015
+ enhancedLogger: {
1016
+ error: (message?: any, ...meta: any[]) => void;
1017
+ warn: (message?: any, ...meta: any[]) => void;
1018
+ info: (message?: any, ...meta: any[]) => void;
1019
+ debug: (message?: any, ...meta: any[]) => void;
1020
+ http: (message?: any, ...meta: any[]) => void;
1021
+ verbose: (message?: any, ...meta: any[]) => void;
1022
+ silly: (message?: any, ...meta: any[]) => void;
1023
+ };
1024
+ dummyLogger: {
1025
+ error: () => void;
1026
+ warn: () => void;
1027
+ info: () => void;
1028
+ debug: () => void;
1029
+ http: () => void;
1030
+ verbose: () => void;
1031
+ silly: () => void;
1032
+ };
1033
+ streamLogger: {
1034
+ /**
1035
+ * Write content directly to stdout without formatting
1036
+ * Used for streaming output where content comes in chunks
1037
+ */
1038
+ info: (message: string) => void;
1039
+ /**
1040
+ * Write error content to stderr
1041
+ */
1042
+ error: (message: string) => void;
1043
+ /**
1044
+ * Write content with newline
1045
+ */
1046
+ log: (message: string) => void;
1047
+ debug: (message: string) => void;
1048
+ };
1049
+ getDisableLog: () => boolean;
1050
+ };
1051
+
1052
+ export { Agent, type AgentConfig, ApiTool, type AppSettings, BaseEnvironment, CodingEnvironment, CommandLineTool, DEFAULT_CONFIG, DEFAULT_SETTINGS, ENV_VARS, ERROR_MESSAGES, type EnvironmentConfig, EvoltError, ExtendStateMachineTool, FileEditor, FunctionCallingStore, GitTool, LOG_LEVELS, MESSAGE_ROLES, Message, MessageHistory, Model, type ModelConfig, ModelError, type ModelResponse$1 as ModelResponse, type PostProcessor, ReflectTool, Reply2HumanTool, SKILLS_DIR, SkillsTool, SystemToolStore, TOOL_CALL_TYPES, TOOL_CONSTANTS, ThinkTool, TodoListTool, type ToolCall, type ToolDescription, ToolExecutionError, type ToolStore, Toolcall, type ToolcallState, type ToolcallType, UserToolStore, WORKSPACE_DIR, WriteUIDesignDocument, ensureDir, fileExists, getCacheDir, getConfigDir, getConfigPath, getFileExtension, getLogsDir, getSettings, getSkillsDir, getTempFilePath, getWorkspaceDir, getWorkspacePath, initializeSettings, isInWorkspace, loadModelConfig, _default as logger, normalizePath, registerAgentAsTool, settings, tools, updateSettings };