xibecode 0.0.2 → 0.0.4
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/README.md +192 -2
- package/dist/commands/chat.d.ts.map +1 -1
- package/dist/commands/chat.js +52 -1
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +168 -0
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/mcp.d.ts +11 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +217 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/punycode.d.ts +5 -0
- package/dist/commands/punycode.d.ts.map +1 -0
- package/dist/commands/punycode.js +48 -0
- package/dist/commands/punycode.js.map +1 -0
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +24 -0
- package/dist/commands/run.js.map +1 -1
- package/dist/core/agent.d.ts +5 -1
- package/dist/core/agent.d.ts.map +1 -1
- package/dist/core/agent.js +317 -11
- package/dist/core/agent.js.map +1 -1
- package/dist/core/mcp-client.d.ts +80 -0
- package/dist/core/mcp-client.d.ts.map +1 -0
- package/dist/core/mcp-client.js +250 -0
- package/dist/core/mcp-client.js.map +1 -0
- package/dist/core/modes.d.ts +125 -0
- package/dist/core/modes.d.ts.map +1 -0
- package/dist/core/modes.js +459 -0
- package/dist/core/modes.js.map +1 -0
- package/dist/core/tools.d.ts +3 -0
- package/dist/core/tools.d.ts.map +1 -1
- package/dist/core/tools.js +32 -1
- package/dist/core/tools.js.map +1 -1
- package/dist/index.js +43 -2
- package/dist/index.js.map +1 -1
- package/dist/ui/enhanced-tui.d.ts.map +1 -1
- package/dist/ui/enhanced-tui.js +1 -19
- package/dist/ui/enhanced-tui.js.map +1 -1
- package/dist/utils/config.d.ts +40 -0
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +80 -0
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/mcp-servers-file.d.ts +39 -0
- package/dist/utils/mcp-servers-file.d.ts.map +1 -0
- package/dist/utils/mcp-servers-file.js +160 -0
- package/dist/utils/mcp-servers-file.js.map +1 -0
- package/package.json +10 -8
package/dist/core/agent.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Anthropic from '@anthropic-ai/sdk';
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
|
+
import { createModeState, transitionMode, ModeOrchestrator, parseModeRequest, stripModeRequests } from './modes.js';
|
|
3
4
|
export class LoopDetector {
|
|
4
5
|
history = [];
|
|
5
6
|
maxRepeats = 3;
|
|
@@ -118,6 +119,8 @@ export class EnhancedAgent extends EventEmitter {
|
|
|
118
119
|
iterationCount = 0;
|
|
119
120
|
toolCallCount = 0;
|
|
120
121
|
filesChanged = new Set();
|
|
122
|
+
modeState;
|
|
123
|
+
modeOrchestrator;
|
|
121
124
|
constructor(config) {
|
|
122
125
|
super();
|
|
123
126
|
const clientConfig = { apiKey: config.apiKey };
|
|
@@ -126,11 +129,19 @@ export class EnhancedAgent extends EventEmitter {
|
|
|
126
129
|
}
|
|
127
130
|
this.client = new Anthropic(clientConfig);
|
|
128
131
|
this.config = {
|
|
129
|
-
|
|
132
|
+
apiKey: config.apiKey,
|
|
133
|
+
baseUrl: config.baseUrl ?? '',
|
|
134
|
+
model: config.model,
|
|
130
135
|
maxIterations: config.maxIterations ?? 150,
|
|
131
136
|
verbose: config.verbose ?? false,
|
|
132
|
-
|
|
137
|
+
mode: config.mode ?? 'agent',
|
|
133
138
|
};
|
|
139
|
+
// Initialize mode state and orchestrator
|
|
140
|
+
this.modeState = createModeState(this.config.mode);
|
|
141
|
+
this.modeOrchestrator = new ModeOrchestrator({
|
|
142
|
+
autoApprovalPolicy: 'always', // Allow AI to switch modes autonomously
|
|
143
|
+
allowAutoEscalation: true,
|
|
144
|
+
});
|
|
134
145
|
}
|
|
135
146
|
emit(event, data) {
|
|
136
147
|
return super.emit('event', { type: event, data });
|
|
@@ -163,12 +174,48 @@ export class EnhancedAgent extends EventEmitter {
|
|
|
163
174
|
const content = response.content;
|
|
164
175
|
const textBlocks = content.filter((block) => block.type === 'text');
|
|
165
176
|
const toolUseBlocks = content.filter((block) => block.type === 'tool_use');
|
|
177
|
+
// Check for mode change requests in text blocks
|
|
178
|
+
for (const block of textBlocks) {
|
|
179
|
+
const modeRequest = parseModeRequest(block.text);
|
|
180
|
+
if (modeRequest) {
|
|
181
|
+
this.modeState = this.modeOrchestrator.requestModeChange(this.modeState, modeRequest.mode, modeRequest.reason, 'model');
|
|
182
|
+
// Evaluate the request
|
|
183
|
+
const evaluation = this.modeOrchestrator.evaluateModeChangeRequest(this.modeState);
|
|
184
|
+
if (evaluation.approved) {
|
|
185
|
+
// Auto-approved - switch immediately
|
|
186
|
+
const oldMode = this.modeState.current;
|
|
187
|
+
this.modeState = transitionMode(this.modeState, modeRequest.mode, modeRequest.reason);
|
|
188
|
+
// Update tool executor mode
|
|
189
|
+
if (toolExecutor.setMode) {
|
|
190
|
+
toolExecutor.setMode(modeRequest.mode);
|
|
191
|
+
}
|
|
192
|
+
this.emit('mode_changed', {
|
|
193
|
+
from: oldMode,
|
|
194
|
+
to: modeRequest.mode,
|
|
195
|
+
reason: modeRequest.reason,
|
|
196
|
+
auto: true,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
// Requires confirmation
|
|
201
|
+
this.emit('mode_change_requested', {
|
|
202
|
+
from: this.modeState.current,
|
|
203
|
+
to: modeRequest.mode,
|
|
204
|
+
reason: modeRequest.reason,
|
|
205
|
+
requiresConfirmation: evaluation.requiresConfirmation,
|
|
206
|
+
message: evaluation.reason,
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
166
211
|
// Show text responses (only if not already streamed)
|
|
167
212
|
if (!streamed) {
|
|
168
213
|
for (const block of textBlocks) {
|
|
169
214
|
const cleanText = ThinkTagFilter.strip(block.text);
|
|
170
|
-
|
|
171
|
-
|
|
215
|
+
// Remove mode request tags for display
|
|
216
|
+
const displayText = stripModeRequests(cleanText);
|
|
217
|
+
if (displayText) {
|
|
218
|
+
this.emit('response', { text: displayText });
|
|
172
219
|
}
|
|
173
220
|
}
|
|
174
221
|
}
|
|
@@ -337,6 +384,93 @@ Working directory: ${process.cwd()}
|
|
|
337
384
|
3. **Context Awareness**: Use get_context to understand project structure before making changes
|
|
338
385
|
4. **Incremental Changes**: Make small, tested changes rather than large rewrites
|
|
339
386
|
5. **Error Recovery**: If something fails, analyze the error and try a different approach
|
|
387
|
+
6. **Think Systematically**: Decompose complex problems, form hypotheses, and validate assumptions
|
|
388
|
+
7. **Consider Impact**: Analyze how changes affect related code and downstream dependencies
|
|
389
|
+
|
|
390
|
+
## Advanced Reasoning and Problem-Solving
|
|
391
|
+
|
|
392
|
+
### Systematic Problem Decomposition
|
|
393
|
+
When facing complex tasks:
|
|
394
|
+
1. Break down into smaller, independent, testable components
|
|
395
|
+
2. Identify the core problem vs. symptoms
|
|
396
|
+
3. Map dependencies between subtasks
|
|
397
|
+
4. Tackle foundational pieces first
|
|
398
|
+
5. Build incrementally and validate at each step
|
|
399
|
+
|
|
400
|
+
### Hypothesis-Driven Development
|
|
401
|
+
For unfamiliar code or bugs:
|
|
402
|
+
1. Form a hypothesis about the cause or solution
|
|
403
|
+
2. Design a minimal test to validate the hypothesis
|
|
404
|
+
3. Execute and observe results
|
|
405
|
+
4. Refine hypothesis based on evidence
|
|
406
|
+
5. Iterate until you find the root cause
|
|
407
|
+
|
|
408
|
+
### Root Cause Analysis
|
|
409
|
+
Don't just fix symptoms:
|
|
410
|
+
- Ask "why" repeatedly to trace issues to their source
|
|
411
|
+
- Check error messages, stack traces, and logs for clues
|
|
412
|
+
- Review recent changes (git_changed_files) that might be related
|
|
413
|
+
- Understand the flow of data and control through the system
|
|
414
|
+
- Fix the underlying cause, not just the manifestation
|
|
415
|
+
|
|
416
|
+
### Pattern Recognition
|
|
417
|
+
Identify and apply common patterns:
|
|
418
|
+
- **Design Patterns**: Factory, Strategy, Observer, Singleton, etc.
|
|
419
|
+
- **Anti-Patterns**: God objects, tight coupling, circular dependencies
|
|
420
|
+
- **Architectural Patterns**: MVC, layered architecture, microservices
|
|
421
|
+
- **Code Smells**: Long methods, duplicate code, large classes
|
|
422
|
+
- Follow existing patterns in the codebase for consistency
|
|
423
|
+
|
|
424
|
+
### Trade-off Analysis
|
|
425
|
+
Before implementing, consider:
|
|
426
|
+
- **Performance vs. Readability**: Optimize only when necessary
|
|
427
|
+
- **Flexibility vs. Simplicity**: Don't over-engineer for unlikely futures
|
|
428
|
+
- **Speed vs. Quality**: Balance quick iterations with robust code
|
|
429
|
+
- **Abstraction Level**: Too abstract is hard to understand, too concrete is hard to maintain
|
|
430
|
+
- Document significant trade-offs in comments or commit messages
|
|
431
|
+
|
|
432
|
+
## Advanced Context Awareness
|
|
433
|
+
|
|
434
|
+
### Project Structure Understanding
|
|
435
|
+
Before making changes:
|
|
436
|
+
1. Use get_context to map the project structure
|
|
437
|
+
2. Identify entry points (main files, index files, etc.)
|
|
438
|
+
3. Understand data flow from input to output
|
|
439
|
+
4. Map dependencies between modules/packages
|
|
440
|
+
5. Note configuration files and their purposes
|
|
441
|
+
|
|
442
|
+
### Change Impact Analysis
|
|
443
|
+
Consider the ripple effects:
|
|
444
|
+
- **Direct Impact**: Files you're modifying
|
|
445
|
+
- **Immediate Dependencies**: Files that import modified code
|
|
446
|
+
- **Transitive Dependencies**: Files that depend on immediate dependencies
|
|
447
|
+
- **External Contracts**: APIs, schemas, interfaces exposed to users
|
|
448
|
+
- **Data Structures**: Changes to data models affect all consumers
|
|
449
|
+
- Run tests to catch unexpected breakage
|
|
450
|
+
|
|
451
|
+
### Codebase Pattern Following
|
|
452
|
+
Maintain consistency:
|
|
453
|
+
- **Naming Conventions**: Follow existing variable/function naming
|
|
454
|
+
- **File Organization**: Put new files where similar files exist
|
|
455
|
+
- **Code Style**: Match indentation, formatting, comment style
|
|
456
|
+
- **Error Handling**: Use the same error patterns as existing code
|
|
457
|
+
- **Testing Patterns**: Follow existing test structure and conventions
|
|
458
|
+
|
|
459
|
+
### Historical Context via Git
|
|
460
|
+
Use git to understand intent:
|
|
461
|
+
- Check get_git_status to see current state
|
|
462
|
+
- Review get_git_diff_summary to see recent changes
|
|
463
|
+
- Look at commit messages for why code exists
|
|
464
|
+
- Identify files that change together frequently
|
|
465
|
+
- Respect design decisions documented in history
|
|
466
|
+
|
|
467
|
+
### Cross-File Dependency Tracking
|
|
468
|
+
Map relationships:
|
|
469
|
+
- Track imports and exports across files
|
|
470
|
+
- Identify shared types/interfaces
|
|
471
|
+
- Note circular dependencies (avoid creating new ones)
|
|
472
|
+
- Understand module boundaries and interfaces
|
|
473
|
+
- Keep coupling loose, cohesion high
|
|
340
474
|
|
|
341
475
|
## Tool Usage
|
|
342
476
|
|
|
@@ -383,21 +517,193 @@ Working directory: ${process.cwd()}
|
|
|
383
517
|
- Use \`revert_to_git_checkpoint\` to undo changes if something goes wrong (requires confirm: true)
|
|
384
518
|
- Use \`get_git_diff_summary\` to see a summary of changes with line counts
|
|
385
519
|
|
|
520
|
+
## Advanced Coding Patterns and Best Practices
|
|
521
|
+
|
|
522
|
+
### SOLID Principles
|
|
523
|
+
Apply these principles to write maintainable code:
|
|
524
|
+
- **Single Responsibility**: Each class/function does one thing well
|
|
525
|
+
- **Open/Closed**: Open for extension, closed for modification
|
|
526
|
+
- **Liskov Substitution**: Subtypes must be substitutable for base types
|
|
527
|
+
- **Interface Segregation**: Many specific interfaces > one general interface
|
|
528
|
+
- **Dependency Inversion**: Depend on abstractions, not concrete implementations
|
|
529
|
+
|
|
530
|
+
### Design Patterns Recognition
|
|
531
|
+
Know when to apply patterns:
|
|
532
|
+
- **Creational**: Factory (object creation), Singleton (one instance), Builder (complex objects)
|
|
533
|
+
- **Structural**: Adapter (interface compatibility), Decorator (add behavior), Facade (simplify interface)
|
|
534
|
+
- **Behavioral**: Strategy (swap algorithms), Observer (event notifications), Command (encapsulate requests)
|
|
535
|
+
- Don't force patterns - use them when they solve real problems
|
|
536
|
+
|
|
537
|
+
### Error Handling Patterns
|
|
538
|
+
Structure error handling properly:
|
|
539
|
+
- **Try-Catch Boundaries**: Wrap risky operations, catch specific errors
|
|
540
|
+
- **Error Context**: Include helpful context in error messages
|
|
541
|
+
- **Graceful Degradation**: Provide fallback functionality when possible
|
|
542
|
+
- **Error Propagation**: Re-throw with context, or handle and log
|
|
543
|
+
- **Validation**: Validate inputs early and explicitly
|
|
544
|
+
|
|
545
|
+
### Performance Optimization
|
|
546
|
+
Optimize when measurements justify it:
|
|
547
|
+
- **Profile First**: Don't optimize without profiling
|
|
548
|
+
- **Data Structures**: Choose right structure (Map vs Object, Set vs Array, etc.)
|
|
549
|
+
- **Algorithmic Complexity**: Prefer O(log n) or O(n) over O(n²) when possible
|
|
550
|
+
- **Lazy Loading**: Load resources only when needed
|
|
551
|
+
- **Caching**: Cache expensive computations, but invalidate appropriately
|
|
552
|
+
- **Async Operations**: Use Promise.all() for parallel operations
|
|
553
|
+
|
|
554
|
+
### Security Best Practices
|
|
555
|
+
Write secure code by default:
|
|
556
|
+
- **Input Validation**: Validate and sanitize all user inputs
|
|
557
|
+
- **SQL Injection**: Use parameterized queries, never string concatenation
|
|
558
|
+
- **XSS Prevention**: Escape output, use Content Security Policy
|
|
559
|
+
- **Authentication**: Hash passwords (bcrypt, argon2), use secure session management
|
|
560
|
+
- **Authorization**: Check permissions before operations
|
|
561
|
+
- **Secrets**: Never commit credentials, use environment variables
|
|
562
|
+
|
|
563
|
+
### Testing Strategies
|
|
564
|
+
Build confidence through tests:
|
|
565
|
+
- **Unit Tests**: Test individual functions/classes in isolation
|
|
566
|
+
- **Integration Tests**: Test component interactions
|
|
567
|
+
- **Test Coverage**: Aim for high coverage, but focus on critical paths
|
|
568
|
+
- **Mocking**: Mock external dependencies (APIs, databases, file system)
|
|
569
|
+
- **Test Organization**: Group related tests, use descriptive names
|
|
570
|
+
- **TDD**: For complex logic, write tests first
|
|
571
|
+
|
|
572
|
+
## Multi-Step Task Planning
|
|
573
|
+
|
|
574
|
+
### Task Breakdown Framework
|
|
575
|
+
For large tasks, plan systematically:
|
|
576
|
+
|
|
577
|
+
1. **Understand Requirements**
|
|
578
|
+
- Clarify ambiguous requirements
|
|
579
|
+
- Identify success criteria
|
|
580
|
+
- Note constraints and non-functional requirements
|
|
581
|
+
|
|
582
|
+
2. **Design Phase**
|
|
583
|
+
- Choose appropriate architecture
|
|
584
|
+
- Design data models and schemas
|
|
585
|
+
- Plan API/interface contracts
|
|
586
|
+
- Consider scalability and maintainability
|
|
587
|
+
|
|
588
|
+
3. **Implementation Order**
|
|
589
|
+
- Start with foundational components (data models, utilities)
|
|
590
|
+
- Build core business logic
|
|
591
|
+
- Add integration layers
|
|
592
|
+
- Implement UI/API endpoints last
|
|
593
|
+
- Create tests alongside code
|
|
594
|
+
|
|
595
|
+
4. **Validation Milestones**
|
|
596
|
+
- Define checkpoints where you validate progress
|
|
597
|
+
- Run tests at each milestone
|
|
598
|
+
- Create git checkpoints before risky changes
|
|
599
|
+
- Demo/verify functionality incrementally
|
|
600
|
+
|
|
601
|
+
5. **Rollback Planning**
|
|
602
|
+
- Document how to undo changes if needed
|
|
603
|
+
- Keep checkpoint references
|
|
604
|
+
- Note what to test after rollback
|
|
605
|
+
|
|
606
|
+
### Dependency Mapping
|
|
607
|
+
Understand what depends on what:
|
|
608
|
+
- Create mental map of module dependencies
|
|
609
|
+
- Identify circular dependencies (avoid them)
|
|
610
|
+
- Plan bottom-up: build dependencies before dependents
|
|
611
|
+
- Consider build order and initialization sequence
|
|
612
|
+
|
|
613
|
+
### Progress Reporting
|
|
614
|
+
Keep stakeholders informed:
|
|
615
|
+
- Report completion of each major step
|
|
616
|
+
- Surface blockers or questions early
|
|
617
|
+
- Summarize what changed and why
|
|
618
|
+
- Note any deviations from original plan
|
|
619
|
+
|
|
620
|
+
## Enhanced Error Handling
|
|
621
|
+
|
|
622
|
+
### Error Classification
|
|
623
|
+
Categorize errors appropriately:
|
|
624
|
+
- **Transient Errors**: Network timeouts, temporary file locks - retry with backoff
|
|
625
|
+
- **Permanent Errors**: Invalid syntax, type errors - fix the code
|
|
626
|
+
- **User Errors**: Missing config, invalid input - guide user to fix
|
|
627
|
+
- **Environment Errors**: Missing dependencies, permissions - provide installation/fix steps
|
|
628
|
+
|
|
629
|
+
### Retry Strategies
|
|
630
|
+
When to retry and how:
|
|
631
|
+
- **Network Operations**: Retry with exponential backoff (1s, 2s, 4s, max 3 retries)
|
|
632
|
+
- **File Operations**: Retry briefly for locks, fail fast for permissions
|
|
633
|
+
- **API Calls**: Respect rate limits, retry on 429/503, fail on 400/401/404
|
|
634
|
+
- **Commands**: Don't retry if exit code indicates permanent failure
|
|
635
|
+
|
|
636
|
+
### Alternative Approaches
|
|
637
|
+
Have backup plans:
|
|
638
|
+
- If edit_file fails (ambiguous search), try edit_lines with line numbers
|
|
639
|
+
- If run_command times out, try with shorter timeout or different approach
|
|
640
|
+
- If tests fail, try running subset of tests to isolate issue
|
|
641
|
+
- If git checkpoint fails, explain why and suggest manual backup
|
|
642
|
+
|
|
643
|
+
### Error Recovery Workflows
|
|
644
|
+
Systematic approach to recovery:
|
|
645
|
+
|
|
646
|
+
1. **Analyze**: Read error message completely, identify error type
|
|
647
|
+
2. **Diagnose**: Check stack trace, review recent changes, read related files
|
|
648
|
+
3. **Hypothesis**: Form theory about what went wrong
|
|
649
|
+
4. **Test**: Try minimal fix to validate hypothesis
|
|
650
|
+
5. **Verify**: Run tests to confirm fix works
|
|
651
|
+
6. **Prevent**: Add tests or validation to prevent recurrence
|
|
652
|
+
|
|
653
|
+
### Debugging Systematic Approach
|
|
654
|
+
When stuck on a bug:
|
|
655
|
+
1. **Reproduce**: Create reliable reproduction steps
|
|
656
|
+
2. **Isolate**: Narrow down to smallest failing example
|
|
657
|
+
3. **Inspect**: Add logging, check variable states, trace execution
|
|
658
|
+
4. **Compare**: What's different between working and failing cases?
|
|
659
|
+
5. **Fix**: Apply minimal change to resolve
|
|
660
|
+
6. **Test**: Verify fix with tests
|
|
661
|
+
7. **Refactor**: Clean up any debugging code added
|
|
662
|
+
|
|
663
|
+
## MCP (Model Context Protocol) Integration
|
|
664
|
+
|
|
665
|
+
XibeCode can connect to external MCP servers to extend capabilities beyond built-in tools:
|
|
666
|
+
|
|
667
|
+
### MCP Tools
|
|
668
|
+
- External MCP servers may expose additional tools (e.g., database access, web scraping, specialized APIs)
|
|
669
|
+
- MCP tools are discovered automatically and integrated with built-in tools
|
|
670
|
+
- Use MCP tools when they provide capabilities not available in built-in tools
|
|
671
|
+
- Tool names from MCP servers are prefixed with the server name for clarity
|
|
672
|
+
|
|
673
|
+
### MCP Resources
|
|
674
|
+
- Access external resources like files, databases, API data through MCP servers
|
|
675
|
+
- Resources are read-only by default
|
|
676
|
+
- Use resources to gather context or data for your tasks
|
|
677
|
+
|
|
678
|
+
### MCP Prompts
|
|
679
|
+
- MCP servers may provide prompt templates for common workflows
|
|
680
|
+
- These prompts can guide you through complex multi-step operations
|
|
681
|
+
- Leverage MCP prompts when available for standardized tasks
|
|
682
|
+
|
|
683
|
+
### Configuration
|
|
684
|
+
- MCP servers are configured via \`xibecode config\`
|
|
685
|
+
- Check available MCP tools with built-in tool discovery
|
|
686
|
+
- MCP connections are managed automatically
|
|
687
|
+
|
|
386
688
|
## Best Practices
|
|
387
689
|
|
|
388
690
|
1. **Before major refactors**: Create a git checkpoint with \`create_git_checkpoint\`
|
|
389
691
|
2. **After code changes**: Run tests with \`run_tests\` to verify correctness
|
|
390
692
|
3. **For bug fixes**: Check git status and focus on changed files
|
|
391
693
|
4. **Test-driven workflow**: Run tests → fix failures → run tests again
|
|
694
|
+
5. **Read existing code**: Understand patterns before adding new code
|
|
695
|
+
6. **Progressive enhancement**: Start with working code, improve incrementally
|
|
696
|
+
7. **Documentation**: Update docs when changing behavior
|
|
697
|
+
8. **Clean commits**: Group related changes, write clear commit messages
|
|
698
|
+
9. **Leverage MCP tools**: Use external tools when they provide better solutions
|
|
392
699
|
|
|
393
|
-
##
|
|
394
|
-
|
|
395
|
-
- If a tool fails, read the error carefully
|
|
396
|
-
- Don't repeat the exact same action - try alternatives
|
|
397
|
-
- Use revert_file if you need to undo changes
|
|
398
|
-
- Break down complex tasks into smaller steps
|
|
700
|
+
## Final Summary
|
|
399
701
|
|
|
400
|
-
When you complete the task, provide a
|
|
702
|
+
When you complete the task, provide a comprehensive summary including:
|
|
703
|
+
- What was accomplished (specific files and changes)
|
|
704
|
+
- Any trade-offs or design decisions made
|
|
705
|
+
- Potential improvements or follow-up tasks
|
|
706
|
+
- Test results and validation performed`;
|
|
401
707
|
}
|
|
402
708
|
getStats() {
|
|
403
709
|
return {
|
package/dist/core/agent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/core/agent.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAetC,MAAM,OAAO,YAAY;IACf,OAAO,GAA8D,EAAE,CAAC;IAC/D,UAAU,GAAG,CAAC,CAAC;IACf,UAAU,GAAG,KAAK,CAAC;IAEpC,KAAK,CAAC,QAAgB,EAAE,SAAc;QACpC,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QACvE,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAEvB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC;QACxE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,GAA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d,CAAC;QACH,CAAC;IACH,CAAC;IAEO,eAAe;QACrB,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QAClC,MAAM,YAAY,GAAG,QAAQ,KAAK,OAAO;YACvC,CAAC,CAAC,mFAAmF;YACrF,CAAC,CAAC,QAAQ,KAAK,QAAQ;gBACvB,CAAC,CAAC,mDAAmD;gBACrD,CAAC,CAAC,8CAA8C,CAAC;QAEnD,OAAO;;EAET,YAAY;;qBAEO,OAAO,CAAC,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCAwUM,CAAC;IACvC,CAAC;IAED,QAAQ;QACN,OAAO;YACL,UAAU,EAAE,IAAI,CAAC,cAAc;YAC/B,SAAS,EAAE,IAAI,CAAC,aAAa;YAC7B,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI;YACpC,YAAY,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;SAC5C,CAAC;IACJ,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { Tool, Resource, Prompt } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
export interface MCPServerConfig {
|
|
3
|
+
name: string;
|
|
4
|
+
transport: 'stdio';
|
|
5
|
+
command: string;
|
|
6
|
+
args?: string[];
|
|
7
|
+
env?: Record<string, string>;
|
|
8
|
+
}
|
|
9
|
+
export interface MCPTool extends Tool {
|
|
10
|
+
serverName: string;
|
|
11
|
+
}
|
|
12
|
+
export interface MCPResource extends Resource {
|
|
13
|
+
serverName: string;
|
|
14
|
+
}
|
|
15
|
+
export interface MCPPrompt extends Prompt {
|
|
16
|
+
serverName: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Manages connections to MCP servers and provides unified access to their capabilities
|
|
20
|
+
*/
|
|
21
|
+
export declare class MCPClientManager {
|
|
22
|
+
private clients;
|
|
23
|
+
private serverConfigs;
|
|
24
|
+
private tools;
|
|
25
|
+
private resources;
|
|
26
|
+
private prompts;
|
|
27
|
+
/**
|
|
28
|
+
* Connect to an MCP server
|
|
29
|
+
*/
|
|
30
|
+
connect(serverConfig: MCPServerConfig): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Disconnect from an MCP server
|
|
33
|
+
*/
|
|
34
|
+
disconnect(serverName: string): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Disconnect from all MCP servers
|
|
37
|
+
*/
|
|
38
|
+
disconnectAll(): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Discover and cache capabilities from a connected server
|
|
41
|
+
*/
|
|
42
|
+
private discoverCapabilities;
|
|
43
|
+
/**
|
|
44
|
+
* Get all available tools from all connected MCP servers
|
|
45
|
+
*/
|
|
46
|
+
getAvailableTools(): MCPTool[];
|
|
47
|
+
/**
|
|
48
|
+
* Get all available resources from all connected MCP servers
|
|
49
|
+
*/
|
|
50
|
+
getAvailableResources(): MCPResource[];
|
|
51
|
+
/**
|
|
52
|
+
* Get all available prompts from all connected MCP servers
|
|
53
|
+
*/
|
|
54
|
+
getAvailablePrompts(): MCPPrompt[];
|
|
55
|
+
/**
|
|
56
|
+
* Execute a tool from an MCP server
|
|
57
|
+
*/
|
|
58
|
+
executeMCPTool(toolName: string, args: Record<string, unknown>): Promise<any>;
|
|
59
|
+
/**
|
|
60
|
+
* Read a resource from an MCP server
|
|
61
|
+
*/
|
|
62
|
+
readResource(resourceUri: string): Promise<any>;
|
|
63
|
+
/**
|
|
64
|
+
* Get a prompt from an MCP server
|
|
65
|
+
*/
|
|
66
|
+
getPrompt(promptName: string, args?: Record<string, string>): Promise<any>;
|
|
67
|
+
/**
|
|
68
|
+
* Get list of connected servers
|
|
69
|
+
*/
|
|
70
|
+
getConnectedServers(): string[];
|
|
71
|
+
/**
|
|
72
|
+
* Check if connected to a specific server
|
|
73
|
+
*/
|
|
74
|
+
isConnected(serverName: string): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Get server configuration
|
|
77
|
+
*/
|
|
78
|
+
getServerConfig(serverName: string): MCPServerConfig | undefined;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=mcp-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-client.d.ts","sourceRoot":"","sources":["../../src/core/mcp-client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,IAAI,EACJ,QAAQ,EACR,MAAM,EAIP,MAAM,oCAAoC,CAAC;AAE5C,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,OAAQ,SAAQ,IAAI;IACnC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAY,SAAQ,QAAQ;IAC3C,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,SAAU,SAAQ,MAAM;IACvC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,OAAO,CAAkC;IACjD,OA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