tachibot-mcp 2.0.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.
- package/.env.example +260 -0
- package/CHANGELOG.md +54 -0
- package/CODE_OF_CONDUCT.md +56 -0
- package/CONTRIBUTING.md +54 -0
- package/Dockerfile +36 -0
- package/LICENSE +644 -0
- package/README.md +201 -0
- package/SECURITY.md +95 -0
- package/dist/personality/komaai-expressions.js +12 -0
- package/dist/profiles/balanced.json +33 -0
- package/dist/profiles/code_focus.json +33 -0
- package/dist/profiles/full.json +33 -0
- package/dist/profiles/minimal.json +33 -0
- package/dist/profiles/research_power.json +33 -0
- package/dist/scripts/build-profiles.js +46 -0
- package/dist/src/application/services/focus/FocusModeRegistry.js +46 -0
- package/dist/src/application/services/focus/FocusTool.service.js +109 -0
- package/dist/src/application/services/focus/ModeRegistry.js +46 -0
- package/dist/src/application/services/focus/modes/focus-deep.mode.js +27 -0
- package/dist/src/application/services/focus/modes/status.mode.js +50 -0
- package/dist/src/application/services/focus/modes/tachibot-status.mode.js +50 -0
- package/dist/src/collaborative-orchestrator.js +391 -0
- package/dist/src/config/model-constants.js +188 -0
- package/dist/src/config/model-defaults.js +57 -0
- package/dist/src/config/model-preferences.js +382 -0
- package/dist/src/config/timeout-config.js +130 -0
- package/dist/src/config.js +173 -0
- package/dist/src/domain/interfaces/IFocusMode.js +5 -0
- package/dist/src/domain/interfaces/IProvider.js +6 -0
- package/dist/src/domain/interfaces/ITool.js +5 -0
- package/dist/src/focus-deep.js +245 -0
- package/dist/src/infrastructure/ascii/art/robots.ascii.js +16 -0
- package/dist/src/mcp-client.js +90 -0
- package/dist/src/memory/index.js +17 -0
- package/dist/src/memory/memory-config.js +135 -0
- package/dist/src/memory/memory-interface.js +174 -0
- package/dist/src/memory/memory-manager.js +383 -0
- package/dist/src/memory/providers/devlog-provider.js +385 -0
- package/dist/src/memory/providers/hybrid-provider.js +399 -0
- package/dist/src/memory/providers/local-provider.js +388 -0
- package/dist/src/memory/providers/mem0-provider.js +337 -0
- package/dist/src/modes/architect.js +477 -0
- package/dist/src/modes/auditor.js +362 -0
- package/dist/src/modes/challenger.js +841 -0
- package/dist/src/modes/code-reviewer.js +382 -0
- package/dist/src/modes/commit-guardian.js +424 -0
- package/dist/src/modes/documentation-writer.js +572 -0
- package/dist/src/modes/scout.js +587 -0
- package/dist/src/modes/shared/helpers/challenger-helpers.js +454 -0
- package/dist/src/modes/shared/helpers/index.js +17 -0
- package/dist/src/modes/shared/helpers/scout-helpers.js +270 -0
- package/dist/src/modes/shared/helpers/verifier-helpers.js +332 -0
- package/dist/src/modes/test-architect.js +767 -0
- package/dist/src/modes/verifier.js +378 -0
- package/dist/src/monitoring/performance-monitor.js +435 -0
- package/dist/src/optimization/batch-executor.js +121 -0
- package/dist/src/optimization/context-pruner.js +196 -0
- package/dist/src/optimization/cost-monitor.js +338 -0
- package/dist/src/optimization/index.js +65 -0
- package/dist/src/optimization/model-router.js +264 -0
- package/dist/src/optimization/result-cache.js +114 -0
- package/dist/src/optimization/token-optimizer.js +257 -0
- package/dist/src/optimization/token-tracker.js +118 -0
- package/dist/src/orchestrator-instructions.js +128 -0
- package/dist/src/orchestrator-lite.js +139 -0
- package/dist/src/orchestrator.js +191 -0
- package/dist/src/orchestrators/collaborative/interfaces/IToolExecutionEngine.js +1 -0
- package/dist/src/orchestrators/collaborative/interfaces/IToolExecutionStrategy.js +5 -0
- package/dist/src/orchestrators/collaborative/interfaces/IVisualizationRenderer.js +1 -0
- package/dist/src/orchestrators/collaborative/registries/ModelProviderRegistry.js +95 -0
- package/dist/src/orchestrators/collaborative/registries/ToolAdapterRegistry.js +64 -0
- package/dist/src/orchestrators/collaborative/services/tool-execution/ToolExecutionService.js +502 -0
- package/dist/src/orchestrators/collaborative/services/visualization/VisualizationService.js +206 -0
- package/dist/src/orchestrators/collaborative/types/session-types.js +5 -0
- package/dist/src/profiles/balanced.js +37 -0
- package/dist/src/profiles/code_focus.js +37 -0
- package/dist/src/profiles/debug_intensive.js +59 -0
- package/dist/src/profiles/full.js +37 -0
- package/dist/src/profiles/minimal.js +37 -0
- package/dist/src/profiles/research_code.js +59 -0
- package/dist/src/profiles/research_power.js +37 -0
- package/dist/src/profiles/types.js +5 -0
- package/dist/src/profiles/workflow_builder.js +53 -0
- package/dist/src/prompt-engineer-lite.js +78 -0
- package/dist/src/prompt-engineer.js +399 -0
- package/dist/src/reasoning-chain.js +508 -0
- package/dist/src/sequential-thinking.js +291 -0
- package/dist/src/server-diagnostic.js +74 -0
- package/dist/src/server-raw.js +158 -0
- package/dist/src/server-simple.js +58 -0
- package/dist/src/server.js +514 -0
- package/dist/src/session/session-logger.js +617 -0
- package/dist/src/session/session-manager.js +571 -0
- package/dist/src/session/session-tools.js +400 -0
- package/dist/src/tools/advanced-modes.js +200 -0
- package/dist/src/tools/claude-integration.js +356 -0
- package/dist/src/tools/consolidated/ai-router.js +174 -0
- package/dist/src/tools/consolidated/ai-tool.js +48 -0
- package/dist/src/tools/consolidated/brainstorm-tool.js +87 -0
- package/dist/src/tools/consolidated/environment-detector.js +80 -0
- package/dist/src/tools/consolidated/index.js +50 -0
- package/dist/src/tools/consolidated/search-tool.js +110 -0
- package/dist/src/tools/consolidated/workflow-tool.js +238 -0
- package/dist/src/tools/gemini-tools.js +329 -0
- package/dist/src/tools/grok-enhanced.js +376 -0
- package/dist/src/tools/grok-tools.js +299 -0
- package/dist/src/tools/lmstudio-tools.js +223 -0
- package/dist/src/tools/openai-tools.js +498 -0
- package/dist/src/tools/openrouter-tools.js +317 -0
- package/dist/src/tools/optimized-wrapper.js +204 -0
- package/dist/src/tools/perplexity-tools.js +294 -0
- package/dist/src/tools/pingpong-tool.js +343 -0
- package/dist/src/tools/qwen-wrapper.js +74 -0
- package/dist/src/tools/tool-router.js +444 -0
- package/dist/src/tools/unified-ai-provider.js +260 -0
- package/dist/src/tools/workflow-runner.js +425 -0
- package/dist/src/tools/workflow-validator-tool.js +107 -0
- package/dist/src/types.js +23 -0
- package/dist/src/utils/input-validator.js +130 -0
- package/dist/src/utils/model-router.js +91 -0
- package/dist/src/utils/progress-stream.js +255 -0
- package/dist/src/utils/provider-router.js +88 -0
- package/dist/src/utils/smart-api-client.js +146 -0
- package/dist/src/utils/table-builder.js +218 -0
- package/dist/src/utils/timestamp-formatter.js +134 -0
- package/dist/src/utils/tool-compressor.js +257 -0
- package/dist/src/utils/tool-config.js +201 -0
- package/dist/src/validators/dependency-graph-validator.js +147 -0
- package/dist/src/validators/interpolation-validator.js +222 -0
- package/dist/src/validators/output-usage-validator.js +151 -0
- package/dist/src/validators/syntax-validator.js +102 -0
- package/dist/src/validators/tool-registry-validator.js +123 -0
- package/dist/src/validators/tool-types.js +97 -0
- package/dist/src/validators/types.js +8 -0
- package/dist/src/validators/workflow-validator.js +134 -0
- package/dist/src/visualizer-lite.js +42 -0
- package/dist/src/visualizer.js +179 -0
- package/dist/src/workflows/circuit-breaker.js +199 -0
- package/dist/src/workflows/custom-workflows.js +451 -0
- package/dist/src/workflows/engine/AutoSynthesizer.js +97 -0
- package/dist/src/workflows/engine/StepParameterResolver.js +74 -0
- package/dist/src/workflows/engine/VariableInterpolator.js +123 -0
- package/dist/src/workflows/engine/WorkflowDiscovery.js +125 -0
- package/dist/src/workflows/engine/WorkflowExecutionEngine.js +485 -0
- package/dist/src/workflows/engine/WorkflowExecutor.js +113 -0
- package/dist/src/workflows/engine/WorkflowFileManager.js +244 -0
- package/dist/src/workflows/engine/WorkflowHelpers.js +114 -0
- package/dist/src/workflows/engine/WorkflowOutputFormatter.js +83 -0
- package/dist/src/workflows/engine/events/WorkflowEventBus.js +132 -0
- package/dist/src/workflows/engine/events/interfaces/IEventBus.js +5 -0
- package/dist/src/workflows/engine/handlers/ErrorRecoveryHandler.js +162 -0
- package/dist/src/workflows/engine/handlers/PromptEnhancementHandler.js +115 -0
- package/dist/src/workflows/engine/handlers/SessionPersistenceHandler.js +167 -0
- package/dist/src/workflows/engine/handlers/StepExecutionHandler.js +231 -0
- package/dist/src/workflows/engine/handlers/ToolInvocationHandler.js +46 -0
- package/dist/src/workflows/engine/interfaces/IAutoSynthesizer.js +5 -0
- package/dist/src/workflows/engine/interfaces/IStepParameterResolver.js +5 -0
- package/dist/src/workflows/engine/interfaces/IVariableInterpolator.js +5 -0
- package/dist/src/workflows/engine/interfaces/IWorkflowDiscovery.js +4 -0
- package/dist/src/workflows/engine/interfaces/IWorkflowFileManager.js +5 -0
- package/dist/src/workflows/engine/interfaces/IWorkflowOutputFormatter.js +5 -0
- package/dist/src/workflows/engine/state/WorkflowStateMachine.js +194 -0
- package/dist/src/workflows/engine/state/interfaces/IStateMachine.js +17 -0
- package/dist/src/workflows/fallback-strategies.js +373 -0
- package/dist/src/workflows/message-queue.js +455 -0
- package/dist/src/workflows/model-router.js +189 -0
- package/dist/src/workflows/orchestrator-examples.js +174 -0
- package/dist/src/workflows/orchestrator-integration.js +200 -0
- package/dist/src/workflows/self-healing.js +524 -0
- package/dist/src/workflows/tool-mapper.js +407 -0
- package/dist/src/workflows/tool-orchestrator.js +796 -0
- package/dist/src/workflows/workflow-engine.js +573 -0
- package/dist/src/workflows/workflow-parser.js +283 -0
- package/dist/src/workflows/workflow-types.js +95 -0
- package/dist/src/workflows.js +568 -0
- package/dist/test-workflow-file-output.js +93 -0
- package/docs/API_KEYS.md +570 -0
- package/docs/CLAUDE_CODE_SETUP.md +181 -0
- package/docs/CLAUDE_DESKTOP_MANUAL.md +127 -0
- package/docs/CONFIGURATION.md +745 -0
- package/docs/FOCUS_MODES.md +240 -0
- package/docs/INSTALLATION_BOTH.md +145 -0
- package/docs/TERMS.md +352 -0
- package/docs/TOOLS_REFERENCE.md +1622 -0
- package/docs/TOOL_PARAMETERS.md +496 -0
- package/docs/TOOL_PROFILES.md +236 -0
- package/docs/WORKFLOWS.md +987 -0
- package/docs/WORKFLOW_OUTPUT.md +198 -0
- package/docs/WORKFLOW_PROGRESS_TRACKING.md +305 -0
- package/docs/workflows/design-brainstorm.md +335 -0
- package/package.json +97 -0
- package/profiles/balanced.json +37 -0
- package/profiles/code_focus.json +37 -0
- package/profiles/debug_intensive.json +34 -0
- package/profiles/full.json +37 -0
- package/profiles/minimal.json +37 -0
- package/profiles/research_power.json +37 -0
- package/profiles/workflow_builder.json +37 -0
- package/smithery.yaml +66 -0
- package/start.sh +8 -0
- package/tools.config.json +81 -0
- package/tsconfig.json +18 -0
- package/workflows/accessibility-code-audit.yaml +92 -0
- package/workflows/code-architecture-review.yaml +202 -0
- package/workflows/code-review.yaml +142 -0
- package/workflows/core/iterative-problem-solver.yaml +283 -0
- package/workflows/creative-brainstorm-yaml.yaml +215 -0
- package/workflows/pingpong.yaml +141 -0
- package/workflows/system/README.md +412 -0
- package/workflows/system/challenger.yaml +175 -0
- package/workflows/system/scout.yaml +164 -0
- package/workflows/system/verifier.yaml +133 -0
- package/workflows/ultra-creative-brainstorm.yaml +318 -0
- package/workflows/ux-research-flow.yaml +92 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { ToolOrchestrator } from './tool-orchestrator.js';
|
|
2
|
+
// Example usage of the intelligent tool orchestrator
|
|
3
|
+
export async function demonstrateToolOrchestrator() {
|
|
4
|
+
const orchestrator = new ToolOrchestrator();
|
|
5
|
+
console.error('🎯 Tool Orchestrator Demo\n');
|
|
6
|
+
// Example 1: Simple question
|
|
7
|
+
const example1 = "What is TypeScript?";
|
|
8
|
+
console.error(`📝 Query: "${example1}"`);
|
|
9
|
+
const rec1 = orchestrator.recommendTools(example1);
|
|
10
|
+
console.error('🤖 Recommended workflow:');
|
|
11
|
+
rec1.workflow.forEach((step, i) => {
|
|
12
|
+
console.error(` ${i + 1}. ${step.toolId}: ${step.reason}`);
|
|
13
|
+
});
|
|
14
|
+
console.error(`📊 Analysis: ${rec1.analysis.category}, ${rec1.analysis.complexity}, ${rec1.analysis.timeConstraint}\n`);
|
|
15
|
+
// Example 2: Complex technical analysis
|
|
16
|
+
const example2 = "Analyze my React application architecture for performance bottlenecks and security vulnerabilities";
|
|
17
|
+
console.error(`📝 Query: "${example2}"`);
|
|
18
|
+
const rec2 = orchestrator.recommendTools(example2);
|
|
19
|
+
console.error('🤖 Recommended workflow:');
|
|
20
|
+
rec2.workflow.forEach((step, i) => {
|
|
21
|
+
console.error(` ${i + 1}. ${step.toolId}: ${step.reason}`);
|
|
22
|
+
});
|
|
23
|
+
console.error(`📊 Analysis: ${rec2.analysis.category}, ${rec2.analysis.complexity}, ${rec2.analysis.timeConstraint}\n`);
|
|
24
|
+
// Example 3: Research project
|
|
25
|
+
const example3 = "I need comprehensive research on current AI safety practices for deployment in production systems";
|
|
26
|
+
console.error(`📝 Query: "${example3}"`);
|
|
27
|
+
const rec3 = orchestrator.recommendTools(example3);
|
|
28
|
+
console.error('🤖 Recommended workflow:');
|
|
29
|
+
rec3.workflow.forEach((step, i) => {
|
|
30
|
+
console.error(` ${i + 1}. ${step.toolId}: ${step.reason}`);
|
|
31
|
+
});
|
|
32
|
+
console.error(`📊 Analysis: ${rec3.analysis.category}, ${rec3.analysis.complexity}, ${rec3.analysis.timeConstraint}\n`);
|
|
33
|
+
// Example 4: Urgent simple task
|
|
34
|
+
const example4 = "Quickly validate this code snippet for security issues";
|
|
35
|
+
console.error(`📝 Query: "${example4}"`);
|
|
36
|
+
const rec4 = orchestrator.recommendTools(example4);
|
|
37
|
+
console.error('🤖 Recommended workflow:');
|
|
38
|
+
rec4.workflow.forEach((step, i) => {
|
|
39
|
+
console.error(` ${i + 1}. ${step.toolId}: ${step.reason}`);
|
|
40
|
+
});
|
|
41
|
+
console.error(`📊 Analysis: ${rec4.analysis.category}, ${rec4.analysis.complexity}, ${rec4.analysis.timeConstraint}\n`);
|
|
42
|
+
// Show orchestrator capabilities
|
|
43
|
+
console.error('🔧 Orchestrator Status:');
|
|
44
|
+
const status = orchestrator.getStatus();
|
|
45
|
+
console.error(` Available tools: ${status.totalTools}`);
|
|
46
|
+
console.error(` Categories: ${status.categories.join(', ')}`);
|
|
47
|
+
console.error(` Tools: ${status.availableTools.join(', ')}`);
|
|
48
|
+
}
|
|
49
|
+
// Smart workflow examples for different scenarios
|
|
50
|
+
export const ORCHESTRATION_SCENARIOS = {
|
|
51
|
+
// Quick fact-checking
|
|
52
|
+
factCheck: {
|
|
53
|
+
query: "What is the latest version of Node.js?",
|
|
54
|
+
expectedFlow: ['perplexity_ask'],
|
|
55
|
+
reason: "Simple factual question needs quick, current answer"
|
|
56
|
+
},
|
|
57
|
+
// Initial exploration
|
|
58
|
+
exploration: {
|
|
59
|
+
query: "I want to understand microservices architecture",
|
|
60
|
+
expectedFlow: ['scout', 'think'],
|
|
61
|
+
reason: "Exploration task needs context gathering, then reflection"
|
|
62
|
+
},
|
|
63
|
+
// Complex technical analysis
|
|
64
|
+
technicalAnalysis: {
|
|
65
|
+
query: "Analyze this codebase for architectural improvements and security issues",
|
|
66
|
+
expectedFlow: ['scout', 'architect', 'focus', 'challenger', 'verifier'],
|
|
67
|
+
reason: "Complex technical task needs comprehensive analysis and validation"
|
|
68
|
+
},
|
|
69
|
+
// Research project
|
|
70
|
+
researchProject: {
|
|
71
|
+
query: "Comprehensive research on quantum computing applications in cryptography",
|
|
72
|
+
expectedFlow: ['perplexity_research', 'focus', 'challenger'],
|
|
73
|
+
reason: "Research task needs deep investigation, reasoning, and validation"
|
|
74
|
+
},
|
|
75
|
+
// Code review
|
|
76
|
+
codeReview: {
|
|
77
|
+
query: "Review this React component for bugs and improvements",
|
|
78
|
+
expectedFlow: ['code_reviewer', 'challenger', 'test_architect'],
|
|
79
|
+
reason: "Code review needs specialized analysis, challenges, and test recommendations"
|
|
80
|
+
},
|
|
81
|
+
// Urgent debugging
|
|
82
|
+
urgentDebugging: {
|
|
83
|
+
query: "Quickly debug this production error in our API",
|
|
84
|
+
expectedFlow: ['scout', 'nextThought', 'challenger'],
|
|
85
|
+
reason: "Urgent task needs fast context, structured thinking, validation"
|
|
86
|
+
},
|
|
87
|
+
// System design
|
|
88
|
+
systemDesign: {
|
|
89
|
+
query: "Design a scalable e-commerce platform architecture",
|
|
90
|
+
expectedFlow: ['scout', 'architect', 'focus', 'challenger', 'verifier'],
|
|
91
|
+
reason: "Design task needs research, architecture, reasoning, validation"
|
|
92
|
+
},
|
|
93
|
+
// Data-driven decision
|
|
94
|
+
dataDecision: {
|
|
95
|
+
query: "Should we migrate from MongoDB to PostgreSQL based on current performance data?",
|
|
96
|
+
expectedFlow: ['perplexity_reason', 'architect', 'challenger'],
|
|
97
|
+
reason: "Decision needs current data, technical analysis, critical evaluation"
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
// Test the orchestrator's decision making
|
|
101
|
+
export function testOrchestrationLogic() {
|
|
102
|
+
const orchestrator = new ToolOrchestrator();
|
|
103
|
+
console.error('🧪 Testing Orchestration Logic\n');
|
|
104
|
+
Object.entries(ORCHESTRATION_SCENARIOS).forEach(([scenario, config]) => {
|
|
105
|
+
console.error(`📋 Scenario: ${scenario}`);
|
|
106
|
+
console.error(` Query: "${config.query}"`);
|
|
107
|
+
const recommendations = orchestrator.recommendTools(config.query);
|
|
108
|
+
const actualFlow = recommendations.workflow.map(step => step.toolId);
|
|
109
|
+
console.error(` Expected: [${config.expectedFlow.join(', ')}]`);
|
|
110
|
+
console.error(` Actual: [${actualFlow.join(', ')}]`);
|
|
111
|
+
console.error(` Reason: ${config.reason}`);
|
|
112
|
+
// Check if key tools are included
|
|
113
|
+
const hasKeyTools = config.expectedFlow.some(tool => actualFlow.includes(tool));
|
|
114
|
+
console.error(` ✅ Has key tools: ${hasKeyTools}`);
|
|
115
|
+
console.error('');
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
// Example integration with YAML workflows
|
|
119
|
+
export function generateDynamicWorkflow(query, context) {
|
|
120
|
+
const orchestrator = new ToolOrchestrator();
|
|
121
|
+
const recommendations = orchestrator.recommendTools(query, context);
|
|
122
|
+
// Generate YAML workflow dynamically
|
|
123
|
+
const workflow = {
|
|
124
|
+
name: "Dynamic AI Orchestrated Workflow",
|
|
125
|
+
version: "1.0",
|
|
126
|
+
description: `Automatically orchestrated workflow for: ${query}`,
|
|
127
|
+
tags: ["dynamic", "ai-orchestrated", recommendations.analysis.category],
|
|
128
|
+
ai_enhancements: {
|
|
129
|
+
circuit_breakers: true,
|
|
130
|
+
intelligent_orchestration: true,
|
|
131
|
+
adaptive_routing: true
|
|
132
|
+
},
|
|
133
|
+
steps: recommendations.workflow.map((step, index) => ({
|
|
134
|
+
id: `step_${index + 1}`,
|
|
135
|
+
type: step.toolId.includes('perplexity') ? 'tachibot-mcp-tool' :
|
|
136
|
+
step.toolId.includes('focus') ? 'tachibot-mcp-tool' :
|
|
137
|
+
'tachibot-mcp-tool',
|
|
138
|
+
tool: step.toolId,
|
|
139
|
+
config: {
|
|
140
|
+
reason: step.reason,
|
|
141
|
+
auto_selected: true
|
|
142
|
+
},
|
|
143
|
+
circuit_breaker: {
|
|
144
|
+
failure_threshold: 3,
|
|
145
|
+
recovery_timeout: '10s'
|
|
146
|
+
}
|
|
147
|
+
})),
|
|
148
|
+
metadata: {
|
|
149
|
+
generated_by: "ToolOrchestrator",
|
|
150
|
+
analysis: recommendations.analysis,
|
|
151
|
+
timestamp: new Date().toISOString()
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
return workflow;
|
|
155
|
+
}
|
|
156
|
+
// CLI-like interface for testing
|
|
157
|
+
export function orchestratorCLI(query) {
|
|
158
|
+
const orchestrator = new ToolOrchestrator();
|
|
159
|
+
const recommendations = orchestrator.recommendTools(query);
|
|
160
|
+
let output = `🎯 Orchestration for: "${query}"\n\n`;
|
|
161
|
+
output += `📊 Analysis:\n`;
|
|
162
|
+
output += ` Category: ${recommendations.analysis.category}\n`;
|
|
163
|
+
output += ` Complexity: ${recommendations.analysis.complexity}\n`;
|
|
164
|
+
output += ` Domain: ${recommendations.analysis.domain}\n`;
|
|
165
|
+
output += ` Time Constraint: ${recommendations.analysis.timeConstraint}\n`;
|
|
166
|
+
output += ` Quality Requirement: ${recommendations.analysis.qualityRequirement}\n\n`;
|
|
167
|
+
output += `🤖 Recommended Workflow:\n`;
|
|
168
|
+
recommendations.workflow.forEach((step, index) => {
|
|
169
|
+
output += ` ${index + 1}. ${step.toolId}\n`;
|
|
170
|
+
output += ` └─ ${step.reason}\n`;
|
|
171
|
+
});
|
|
172
|
+
output += `\n💡 Primary Tools: ${recommendations.primary.map(p => p.toolId).join(', ')}\n`;
|
|
173
|
+
return output;
|
|
174
|
+
}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { ToolOrchestrator } from './tool-orchestrator.js';
|
|
2
|
+
export class OrchestratorIntegration {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.orchestrator = new ToolOrchestrator();
|
|
5
|
+
}
|
|
6
|
+
async executeOrchestratorStep(step, context) {
|
|
7
|
+
const query = context.metadata.get('input_query') || context.query;
|
|
8
|
+
const contextStr = context.metadata.get('input_context') || '';
|
|
9
|
+
// Get recommendations from orchestrator
|
|
10
|
+
const recommendations = this.orchestrator.recommendTools(query, contextStr);
|
|
11
|
+
// Transform to workflow-compatible format
|
|
12
|
+
const result = {
|
|
13
|
+
analysis: {
|
|
14
|
+
category: recommendations.analysis.category,
|
|
15
|
+
complexity: recommendations.analysis.complexity,
|
|
16
|
+
domain: recommendations.analysis.domain,
|
|
17
|
+
timeConstraint: recommendations.analysis.timeConstraint,
|
|
18
|
+
qualityRequirement: recommendations.analysis.qualityRequirement,
|
|
19
|
+
keywords: recommendations.analysis.keywords
|
|
20
|
+
},
|
|
21
|
+
recommended_tools: {
|
|
22
|
+
primary: recommendations.primary.map(p => p.toolId),
|
|
23
|
+
primary_agent: this.selectPrimaryAgent(recommendations.analysis)
|
|
24
|
+
},
|
|
25
|
+
workflow_plan: {
|
|
26
|
+
tools: recommendations.workflow,
|
|
27
|
+
agent_reason: this.getAgentReason(recommendations.analysis),
|
|
28
|
+
research_reason: recommendations.workflow.find(w => w.toolId.includes('scout') || w.toolId.includes('perplexity'))?.reason || 'Context gathering',
|
|
29
|
+
reasoning_reason: recommendations.workflow.find(w => w.toolId.includes('focus') || w.toolId.includes('think'))?.reason || 'Problem solving',
|
|
30
|
+
validation_reasons: recommendations.workflow.filter(w => w.toolId.includes('challenger') || w.toolId.includes('verifier')).map(w => w.reason)
|
|
31
|
+
},
|
|
32
|
+
research_tool: this.extractResearchTool(recommendations.workflow),
|
|
33
|
+
research_variant: this.getResearchVariant(recommendations.workflow),
|
|
34
|
+
reasoning_tool: this.extractReasoningTool(recommendations.workflow),
|
|
35
|
+
reasoning_mode: this.getReasoningMode(recommendations.analysis),
|
|
36
|
+
reasoning_rounds: this.getReasoningRounds(recommendations.analysis),
|
|
37
|
+
recommended_models: this.getRecommendedModels(recommendations.analysis),
|
|
38
|
+
validation_tools: this.extractValidationTools(recommendations.workflow)
|
|
39
|
+
};
|
|
40
|
+
// Store orchestrator result in context for other steps to use
|
|
41
|
+
context.metadata.set('orchestrator_result', result);
|
|
42
|
+
context.metadata.set('tool_analysis', recommendations.analysis);
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
selectPrimaryAgent(analysis) {
|
|
46
|
+
if (analysis.domain === 'technical' && analysis.keywords.includes('code')) {
|
|
47
|
+
return 'code-quality-reviewer';
|
|
48
|
+
}
|
|
49
|
+
if (analysis.keywords.includes('architecture') || analysis.keywords.includes('system')) {
|
|
50
|
+
return 'atlassian-forge-architect';
|
|
51
|
+
}
|
|
52
|
+
if (analysis.keywords.includes('ui') || analysis.keywords.includes('design')) {
|
|
53
|
+
return 'responsive-ui-designer';
|
|
54
|
+
}
|
|
55
|
+
return 'code-quality-reviewer'; // Default
|
|
56
|
+
}
|
|
57
|
+
getAgentReason(analysis) {
|
|
58
|
+
return `Selected based on ${analysis.domain} domain and ${analysis.complexity} complexity`;
|
|
59
|
+
}
|
|
60
|
+
extractResearchTool(workflow) {
|
|
61
|
+
const researchStep = workflow.find(step => ['scout', 'perplexity_ask', 'perplexity_research', 'focus_deep_research'].includes(step.toolId));
|
|
62
|
+
return researchStep?.toolId || 'scout';
|
|
63
|
+
}
|
|
64
|
+
getResearchVariant(workflow) {
|
|
65
|
+
const researchTool = this.extractResearchTool(workflow);
|
|
66
|
+
if (researchTool === 'scout')
|
|
67
|
+
return 'research_scout';
|
|
68
|
+
return undefined; // Other tools don't need variants
|
|
69
|
+
}
|
|
70
|
+
extractReasoningTool(workflow) {
|
|
71
|
+
const reasoningStep = workflow.find(step => ['focus', 'think', 'nextThought', 'perplexity_reason'].includes(step.toolId));
|
|
72
|
+
return reasoningStep?.toolId || 'focus';
|
|
73
|
+
}
|
|
74
|
+
getReasoningMode(analysis) {
|
|
75
|
+
const tool = this.extractReasoningTool([]);
|
|
76
|
+
if (tool === 'focus') {
|
|
77
|
+
if (analysis.complexity === 'complex')
|
|
78
|
+
return 'deep-reasoning';
|
|
79
|
+
if (analysis.domain === 'technical')
|
|
80
|
+
return 'code-brainstorm';
|
|
81
|
+
return 'simple';
|
|
82
|
+
}
|
|
83
|
+
return 'simple'; // Default to simple mode
|
|
84
|
+
}
|
|
85
|
+
getReasoningRounds(analysis) {
|
|
86
|
+
if (analysis.complexity === 'complex')
|
|
87
|
+
return 3;
|
|
88
|
+
if (analysis.complexity === 'medium')
|
|
89
|
+
return 2;
|
|
90
|
+
return 1;
|
|
91
|
+
}
|
|
92
|
+
getRecommendedModels(analysis) {
|
|
93
|
+
if (analysis.complexity === 'complex') {
|
|
94
|
+
return ['grok', 'gemini', 'openai'];
|
|
95
|
+
}
|
|
96
|
+
if (analysis.domain === 'technical') {
|
|
97
|
+
return ['grok', 'qwen'];
|
|
98
|
+
}
|
|
99
|
+
return ['gemini', 'openai'];
|
|
100
|
+
}
|
|
101
|
+
extractValidationTools(workflow) {
|
|
102
|
+
return workflow
|
|
103
|
+
.filter(step => ['challenger', 'verifier', 'auditor'].includes(step.toolId))
|
|
104
|
+
.map(step => step.toolId);
|
|
105
|
+
}
|
|
106
|
+
// Method to be called from workflow engine
|
|
107
|
+
static async executeStep(step, context) {
|
|
108
|
+
const integration = new OrchestratorIntegration();
|
|
109
|
+
return integration.executeOrchestratorStep(step, context);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// Export for workflow engine registration
|
|
113
|
+
export const orchestratorStepHandler = {
|
|
114
|
+
type: 'tool-orchestrator',
|
|
115
|
+
execute: OrchestratorIntegration.executeStep
|
|
116
|
+
};
|
|
117
|
+
// Usage examples
|
|
118
|
+
export const ORCHESTRATOR_USAGE_EXAMPLES = {
|
|
119
|
+
// How to call the orchestrated workflow from CLI
|
|
120
|
+
cli_usage: `
|
|
121
|
+
# Use the AI-orchestrated problem solver
|
|
122
|
+
focus workflow run agent-scout-solve-iterate "Fix performance issues in my React app"
|
|
123
|
+
|
|
124
|
+
# The orchestrator will automatically:
|
|
125
|
+
# 1. Analyze: technical domain, medium complexity, performance focus
|
|
126
|
+
# 2. Select: scout (quick research), focus (code-brainstorm), challenger
|
|
127
|
+
# 3. Execute: Optimized workflow based on analysis
|
|
128
|
+
`,
|
|
129
|
+
// How to use in code
|
|
130
|
+
programmatic_usage: `
|
|
131
|
+
import { ToolOrchestrator } from './tool-orchestrator.js';
|
|
132
|
+
|
|
133
|
+
const orchestrator = new ToolOrchestrator();
|
|
134
|
+
const recommendations = orchestrator.recommendTools(
|
|
135
|
+
"Debug memory leaks in Node.js application",
|
|
136
|
+
"Production environment, urgent fix needed"
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
// Results:
|
|
140
|
+
// - analysis: { category: 'analysis', complexity: 'medium', timeConstraint: 'urgent' }
|
|
141
|
+
// - workflow: [{ toolId: 'scout', reason: '...' }, { toolId: 'nextThought', reason: '...' }]
|
|
142
|
+
// - primary: [{ toolId: 'architect', reason: '...' }]
|
|
143
|
+
`,
|
|
144
|
+
// How to test orchestrator decisions
|
|
145
|
+
testing_usage: `
|
|
146
|
+
import { testOrchestrationLogic, orchestratorCLI } from './orchestrator-examples.js';
|
|
147
|
+
|
|
148
|
+
// Test all scenarios
|
|
149
|
+
testOrchestrationLogic();
|
|
150
|
+
|
|
151
|
+
// Quick CLI test
|
|
152
|
+
console.error(orchestratorCLI("Research AI safety best practices"));
|
|
153
|
+
|
|
154
|
+
// Output shows:
|
|
155
|
+
# 📊 Analysis: research, complex, general, normal, high
|
|
156
|
+
# 🤖 Recommended Workflow:
|
|
157
|
+
# 1. perplexity_research
|
|
158
|
+
# └─ Comprehensive research with evidence gathering
|
|
159
|
+
# 2. focus
|
|
160
|
+
# └─ Deep multi-AI collaborative reasoning
|
|
161
|
+
`
|
|
162
|
+
};
|
|
163
|
+
// Smart workflow templates that use orchestration
|
|
164
|
+
export const ORCHESTRATED_WORKFLOW_TEMPLATES = {
|
|
165
|
+
smart_code_review: `
|
|
166
|
+
name: "Smart Code Review (Orchestrated)"
|
|
167
|
+
steps:
|
|
168
|
+
- id: orchestrator
|
|
169
|
+
type: tool-orchestrator
|
|
170
|
+
- id: dynamic_analysis
|
|
171
|
+
type: tachibot-mcp-tool
|
|
172
|
+
tool: \${orchestrator.reasoning_tool}
|
|
173
|
+
config:
|
|
174
|
+
selected_by_ai: true
|
|
175
|
+
`,
|
|
176
|
+
adaptive_research: `
|
|
177
|
+
name: "Adaptive Research (Orchestrated)"
|
|
178
|
+
steps:
|
|
179
|
+
- id: orchestrator
|
|
180
|
+
type: tool-orchestrator
|
|
181
|
+
- id: intelligent_research
|
|
182
|
+
type: tachibot-mcp-tool
|
|
183
|
+
tool: \${orchestrator.research_tool}
|
|
184
|
+
variant: \${orchestrator.research_variant}
|
|
185
|
+
`,
|
|
186
|
+
context_aware_problem_solving: `
|
|
187
|
+
name: "Context-Aware Problem Solving"
|
|
188
|
+
steps:
|
|
189
|
+
- id: orchestrator
|
|
190
|
+
type: tool-orchestrator
|
|
191
|
+
config:
|
|
192
|
+
analyze_task: true
|
|
193
|
+
adaptive_selection: true
|
|
194
|
+
- id: contextual_solution
|
|
195
|
+
type: tachibot-mcp-tool
|
|
196
|
+
tool: \${orchestrator.reasoning_tool}
|
|
197
|
+
models: \${orchestrator.recommended_models}
|
|
198
|
+
rounds: \${orchestrator.reasoning_rounds}
|
|
199
|
+
`
|
|
200
|
+
};
|