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.
Files changed (214) hide show
  1. package/.env.example +260 -0
  2. package/CHANGELOG.md +54 -0
  3. package/CODE_OF_CONDUCT.md +56 -0
  4. package/CONTRIBUTING.md +54 -0
  5. package/Dockerfile +36 -0
  6. package/LICENSE +644 -0
  7. package/README.md +201 -0
  8. package/SECURITY.md +95 -0
  9. package/dist/personality/komaai-expressions.js +12 -0
  10. package/dist/profiles/balanced.json +33 -0
  11. package/dist/profiles/code_focus.json +33 -0
  12. package/dist/profiles/full.json +33 -0
  13. package/dist/profiles/minimal.json +33 -0
  14. package/dist/profiles/research_power.json +33 -0
  15. package/dist/scripts/build-profiles.js +46 -0
  16. package/dist/src/application/services/focus/FocusModeRegistry.js +46 -0
  17. package/dist/src/application/services/focus/FocusTool.service.js +109 -0
  18. package/dist/src/application/services/focus/ModeRegistry.js +46 -0
  19. package/dist/src/application/services/focus/modes/focus-deep.mode.js +27 -0
  20. package/dist/src/application/services/focus/modes/status.mode.js +50 -0
  21. package/dist/src/application/services/focus/modes/tachibot-status.mode.js +50 -0
  22. package/dist/src/collaborative-orchestrator.js +391 -0
  23. package/dist/src/config/model-constants.js +188 -0
  24. package/dist/src/config/model-defaults.js +57 -0
  25. package/dist/src/config/model-preferences.js +382 -0
  26. package/dist/src/config/timeout-config.js +130 -0
  27. package/dist/src/config.js +173 -0
  28. package/dist/src/domain/interfaces/IFocusMode.js +5 -0
  29. package/dist/src/domain/interfaces/IProvider.js +6 -0
  30. package/dist/src/domain/interfaces/ITool.js +5 -0
  31. package/dist/src/focus-deep.js +245 -0
  32. package/dist/src/infrastructure/ascii/art/robots.ascii.js +16 -0
  33. package/dist/src/mcp-client.js +90 -0
  34. package/dist/src/memory/index.js +17 -0
  35. package/dist/src/memory/memory-config.js +135 -0
  36. package/dist/src/memory/memory-interface.js +174 -0
  37. package/dist/src/memory/memory-manager.js +383 -0
  38. package/dist/src/memory/providers/devlog-provider.js +385 -0
  39. package/dist/src/memory/providers/hybrid-provider.js +399 -0
  40. package/dist/src/memory/providers/local-provider.js +388 -0
  41. package/dist/src/memory/providers/mem0-provider.js +337 -0
  42. package/dist/src/modes/architect.js +477 -0
  43. package/dist/src/modes/auditor.js +362 -0
  44. package/dist/src/modes/challenger.js +841 -0
  45. package/dist/src/modes/code-reviewer.js +382 -0
  46. package/dist/src/modes/commit-guardian.js +424 -0
  47. package/dist/src/modes/documentation-writer.js +572 -0
  48. package/dist/src/modes/scout.js +587 -0
  49. package/dist/src/modes/shared/helpers/challenger-helpers.js +454 -0
  50. package/dist/src/modes/shared/helpers/index.js +17 -0
  51. package/dist/src/modes/shared/helpers/scout-helpers.js +270 -0
  52. package/dist/src/modes/shared/helpers/verifier-helpers.js +332 -0
  53. package/dist/src/modes/test-architect.js +767 -0
  54. package/dist/src/modes/verifier.js +378 -0
  55. package/dist/src/monitoring/performance-monitor.js +435 -0
  56. package/dist/src/optimization/batch-executor.js +121 -0
  57. package/dist/src/optimization/context-pruner.js +196 -0
  58. package/dist/src/optimization/cost-monitor.js +338 -0
  59. package/dist/src/optimization/index.js +65 -0
  60. package/dist/src/optimization/model-router.js +264 -0
  61. package/dist/src/optimization/result-cache.js +114 -0
  62. package/dist/src/optimization/token-optimizer.js +257 -0
  63. package/dist/src/optimization/token-tracker.js +118 -0
  64. package/dist/src/orchestrator-instructions.js +128 -0
  65. package/dist/src/orchestrator-lite.js +139 -0
  66. package/dist/src/orchestrator.js +191 -0
  67. package/dist/src/orchestrators/collaborative/interfaces/IToolExecutionEngine.js +1 -0
  68. package/dist/src/orchestrators/collaborative/interfaces/IToolExecutionStrategy.js +5 -0
  69. package/dist/src/orchestrators/collaborative/interfaces/IVisualizationRenderer.js +1 -0
  70. package/dist/src/orchestrators/collaborative/registries/ModelProviderRegistry.js +95 -0
  71. package/dist/src/orchestrators/collaborative/registries/ToolAdapterRegistry.js +64 -0
  72. package/dist/src/orchestrators/collaborative/services/tool-execution/ToolExecutionService.js +502 -0
  73. package/dist/src/orchestrators/collaborative/services/visualization/VisualizationService.js +206 -0
  74. package/dist/src/orchestrators/collaborative/types/session-types.js +5 -0
  75. package/dist/src/profiles/balanced.js +37 -0
  76. package/dist/src/profiles/code_focus.js +37 -0
  77. package/dist/src/profiles/debug_intensive.js +59 -0
  78. package/dist/src/profiles/full.js +37 -0
  79. package/dist/src/profiles/minimal.js +37 -0
  80. package/dist/src/profiles/research_code.js +59 -0
  81. package/dist/src/profiles/research_power.js +37 -0
  82. package/dist/src/profiles/types.js +5 -0
  83. package/dist/src/profiles/workflow_builder.js +53 -0
  84. package/dist/src/prompt-engineer-lite.js +78 -0
  85. package/dist/src/prompt-engineer.js +399 -0
  86. package/dist/src/reasoning-chain.js +508 -0
  87. package/dist/src/sequential-thinking.js +291 -0
  88. package/dist/src/server-diagnostic.js +74 -0
  89. package/dist/src/server-raw.js +158 -0
  90. package/dist/src/server-simple.js +58 -0
  91. package/dist/src/server.js +514 -0
  92. package/dist/src/session/session-logger.js +617 -0
  93. package/dist/src/session/session-manager.js +571 -0
  94. package/dist/src/session/session-tools.js +400 -0
  95. package/dist/src/tools/advanced-modes.js +200 -0
  96. package/dist/src/tools/claude-integration.js +356 -0
  97. package/dist/src/tools/consolidated/ai-router.js +174 -0
  98. package/dist/src/tools/consolidated/ai-tool.js +48 -0
  99. package/dist/src/tools/consolidated/brainstorm-tool.js +87 -0
  100. package/dist/src/tools/consolidated/environment-detector.js +80 -0
  101. package/dist/src/tools/consolidated/index.js +50 -0
  102. package/dist/src/tools/consolidated/search-tool.js +110 -0
  103. package/dist/src/tools/consolidated/workflow-tool.js +238 -0
  104. package/dist/src/tools/gemini-tools.js +329 -0
  105. package/dist/src/tools/grok-enhanced.js +376 -0
  106. package/dist/src/tools/grok-tools.js +299 -0
  107. package/dist/src/tools/lmstudio-tools.js +223 -0
  108. package/dist/src/tools/openai-tools.js +498 -0
  109. package/dist/src/tools/openrouter-tools.js +317 -0
  110. package/dist/src/tools/optimized-wrapper.js +204 -0
  111. package/dist/src/tools/perplexity-tools.js +294 -0
  112. package/dist/src/tools/pingpong-tool.js +343 -0
  113. package/dist/src/tools/qwen-wrapper.js +74 -0
  114. package/dist/src/tools/tool-router.js +444 -0
  115. package/dist/src/tools/unified-ai-provider.js +260 -0
  116. package/dist/src/tools/workflow-runner.js +425 -0
  117. package/dist/src/tools/workflow-validator-tool.js +107 -0
  118. package/dist/src/types.js +23 -0
  119. package/dist/src/utils/input-validator.js +130 -0
  120. package/dist/src/utils/model-router.js +91 -0
  121. package/dist/src/utils/progress-stream.js +255 -0
  122. package/dist/src/utils/provider-router.js +88 -0
  123. package/dist/src/utils/smart-api-client.js +146 -0
  124. package/dist/src/utils/table-builder.js +218 -0
  125. package/dist/src/utils/timestamp-formatter.js +134 -0
  126. package/dist/src/utils/tool-compressor.js +257 -0
  127. package/dist/src/utils/tool-config.js +201 -0
  128. package/dist/src/validators/dependency-graph-validator.js +147 -0
  129. package/dist/src/validators/interpolation-validator.js +222 -0
  130. package/dist/src/validators/output-usage-validator.js +151 -0
  131. package/dist/src/validators/syntax-validator.js +102 -0
  132. package/dist/src/validators/tool-registry-validator.js +123 -0
  133. package/dist/src/validators/tool-types.js +97 -0
  134. package/dist/src/validators/types.js +8 -0
  135. package/dist/src/validators/workflow-validator.js +134 -0
  136. package/dist/src/visualizer-lite.js +42 -0
  137. package/dist/src/visualizer.js +179 -0
  138. package/dist/src/workflows/circuit-breaker.js +199 -0
  139. package/dist/src/workflows/custom-workflows.js +451 -0
  140. package/dist/src/workflows/engine/AutoSynthesizer.js +97 -0
  141. package/dist/src/workflows/engine/StepParameterResolver.js +74 -0
  142. package/dist/src/workflows/engine/VariableInterpolator.js +123 -0
  143. package/dist/src/workflows/engine/WorkflowDiscovery.js +125 -0
  144. package/dist/src/workflows/engine/WorkflowExecutionEngine.js +485 -0
  145. package/dist/src/workflows/engine/WorkflowExecutor.js +113 -0
  146. package/dist/src/workflows/engine/WorkflowFileManager.js +244 -0
  147. package/dist/src/workflows/engine/WorkflowHelpers.js +114 -0
  148. package/dist/src/workflows/engine/WorkflowOutputFormatter.js +83 -0
  149. package/dist/src/workflows/engine/events/WorkflowEventBus.js +132 -0
  150. package/dist/src/workflows/engine/events/interfaces/IEventBus.js +5 -0
  151. package/dist/src/workflows/engine/handlers/ErrorRecoveryHandler.js +162 -0
  152. package/dist/src/workflows/engine/handlers/PromptEnhancementHandler.js +115 -0
  153. package/dist/src/workflows/engine/handlers/SessionPersistenceHandler.js +167 -0
  154. package/dist/src/workflows/engine/handlers/StepExecutionHandler.js +231 -0
  155. package/dist/src/workflows/engine/handlers/ToolInvocationHandler.js +46 -0
  156. package/dist/src/workflows/engine/interfaces/IAutoSynthesizer.js +5 -0
  157. package/dist/src/workflows/engine/interfaces/IStepParameterResolver.js +5 -0
  158. package/dist/src/workflows/engine/interfaces/IVariableInterpolator.js +5 -0
  159. package/dist/src/workflows/engine/interfaces/IWorkflowDiscovery.js +4 -0
  160. package/dist/src/workflows/engine/interfaces/IWorkflowFileManager.js +5 -0
  161. package/dist/src/workflows/engine/interfaces/IWorkflowOutputFormatter.js +5 -0
  162. package/dist/src/workflows/engine/state/WorkflowStateMachine.js +194 -0
  163. package/dist/src/workflows/engine/state/interfaces/IStateMachine.js +17 -0
  164. package/dist/src/workflows/fallback-strategies.js +373 -0
  165. package/dist/src/workflows/message-queue.js +455 -0
  166. package/dist/src/workflows/model-router.js +189 -0
  167. package/dist/src/workflows/orchestrator-examples.js +174 -0
  168. package/dist/src/workflows/orchestrator-integration.js +200 -0
  169. package/dist/src/workflows/self-healing.js +524 -0
  170. package/dist/src/workflows/tool-mapper.js +407 -0
  171. package/dist/src/workflows/tool-orchestrator.js +796 -0
  172. package/dist/src/workflows/workflow-engine.js +573 -0
  173. package/dist/src/workflows/workflow-parser.js +283 -0
  174. package/dist/src/workflows/workflow-types.js +95 -0
  175. package/dist/src/workflows.js +568 -0
  176. package/dist/test-workflow-file-output.js +93 -0
  177. package/docs/API_KEYS.md +570 -0
  178. package/docs/CLAUDE_CODE_SETUP.md +181 -0
  179. package/docs/CLAUDE_DESKTOP_MANUAL.md +127 -0
  180. package/docs/CONFIGURATION.md +745 -0
  181. package/docs/FOCUS_MODES.md +240 -0
  182. package/docs/INSTALLATION_BOTH.md +145 -0
  183. package/docs/TERMS.md +352 -0
  184. package/docs/TOOLS_REFERENCE.md +1622 -0
  185. package/docs/TOOL_PARAMETERS.md +496 -0
  186. package/docs/TOOL_PROFILES.md +236 -0
  187. package/docs/WORKFLOWS.md +987 -0
  188. package/docs/WORKFLOW_OUTPUT.md +198 -0
  189. package/docs/WORKFLOW_PROGRESS_TRACKING.md +305 -0
  190. package/docs/workflows/design-brainstorm.md +335 -0
  191. package/package.json +97 -0
  192. package/profiles/balanced.json +37 -0
  193. package/profiles/code_focus.json +37 -0
  194. package/profiles/debug_intensive.json +34 -0
  195. package/profiles/full.json +37 -0
  196. package/profiles/minimal.json +37 -0
  197. package/profiles/research_power.json +37 -0
  198. package/profiles/workflow_builder.json +37 -0
  199. package/smithery.yaml +66 -0
  200. package/start.sh +8 -0
  201. package/tools.config.json +81 -0
  202. package/tsconfig.json +18 -0
  203. package/workflows/accessibility-code-audit.yaml +92 -0
  204. package/workflows/code-architecture-review.yaml +202 -0
  205. package/workflows/code-review.yaml +142 -0
  206. package/workflows/core/iterative-problem-solver.yaml +283 -0
  207. package/workflows/creative-brainstorm-yaml.yaml +215 -0
  208. package/workflows/pingpong.yaml +141 -0
  209. package/workflows/system/README.md +412 -0
  210. package/workflows/system/challenger.yaml +175 -0
  211. package/workflows/system/scout.yaml +164 -0
  212. package/workflows/system/verifier.yaml +133 -0
  213. package/workflows/ultra-creative-brainstorm.yaml +318 -0
  214. package/workflows/ux-research-flow.yaml +92 -0
@@ -0,0 +1,206 @@
1
+ import { ReasoningMode, REASONING_TEMPLATES, MODEL_PERSONAS } from "../../../../reasoning-chain.js";
2
+ /**
3
+ * Visualization Service
4
+ * Handles rendering of orchestration plans, progress, and TachiBot visualizations
5
+ * Extracted from CollaborativeOrchestrator for better separation of concerns
6
+ */
7
+ export class VisualizationService {
8
+ constructor(options) {
9
+ this.modelTurnTaking = options?.modelTurnTaking ?? true;
10
+ this.enableVisualization = options?.enableVisualization ?? true;
11
+ }
12
+ /**
13
+ * Generate visual orchestration plan for a session
14
+ */
15
+ generateOrchestrationPlan(session) {
16
+ const steps = session.chain.steps;
17
+ const personas = MODEL_PERSONAS;
18
+ let plan = `# 🧠 Collaborative Reasoning Session\n\n`;
19
+ plan += `**Objective**: ${session.objective}\n`;
20
+ plan += `**Domain**: ${session.domain}\n`;
21
+ plan += `**Session ID**: ${session.id}\n\n`;
22
+ if (session.metadata?.templateName) {
23
+ plan += `**Template**: ${session.metadata.templateDescription}\n\n`;
24
+ }
25
+ plan += `## 🔄 Reasoning Chain\n\n`;
26
+ // Visual flow diagram
27
+ plan += "```\n";
28
+ steps.forEach((step, index) => {
29
+ const persona = Object.values(personas).find(p => p.model === step.model);
30
+ const arrow = index < steps.length - 1 ? " ──► " : "";
31
+ const icon = this.getModeIcon(step.mode);
32
+ if (index % 3 === 0 && index > 0)
33
+ plan += "\n ⬇\n";
34
+ plan += `[${icon} ${step.model}]${arrow}`;
35
+ });
36
+ plan += "\n```\n\n";
37
+ // Detailed steps
38
+ plan += `## 📋 Execution Steps\n\n`;
39
+ steps.forEach((step, index) => {
40
+ const persona = Object.values(personas).find(p => p.model === step.model);
41
+ const icon = this.getModeIcon(step.mode);
42
+ plan += `### Step ${index + 1}: ${icon} ${step.mode.toUpperCase()}\n`;
43
+ plan += `**Model**: ${step.model}`;
44
+ if (persona) {
45
+ plan += ` (${persona.role})`;
46
+ }
47
+ plan += `\n`;
48
+ plan += `**Prompt**: ${step.prompt}\n\n`;
49
+ });
50
+ // Execution instructions
51
+ plan += `## 🚀 To Execute This Chain:\n\n`;
52
+ plan += `1. Each model will process the prompt with context from previous responses\n`;
53
+ plan += `2. Models will ${this.modelTurnTaking ? 'take turns' : 'work in parallel when possible'}\n`;
54
+ plan += `3. Final synthesis will combine all insights\n`;
55
+ plan += `4. Use \`focus --mode focus-deep-execute --session ${session.id}\` to run\n\n`;
56
+ // TachiBot visualization
57
+ if (this.enableVisualization) {
58
+ plan += this.generateTachiBotVisualization(session);
59
+ }
60
+ return plan;
61
+ }
62
+ /**
63
+ * Generate TachiBot visualization for the session
64
+ */
65
+ generateTachiBotVisualization(session) {
66
+ const stage = session.currentStep;
67
+ const totalSteps = session.chain.steps.length;
68
+ let viz = `## 🤖 TachiBot Collective Status\n\n`;
69
+ viz += "```\n";
70
+ // Different TachiBot expressions based on reasoning mode
71
+ const currentMode = session.chain.steps[stage]?.mode || ReasoningMode.BRAINSTORM;
72
+ switch (currentMode) {
73
+ case ReasoningMode.BRAINSTORM:
74
+ viz += `@@@@@@@@@@@@@@@
75
+ @ ★ ★ @ 💡 Brainstorming...
76
+ @ ! @
77
+ @ \\\\___// @
78
+ @@@@@@@@@@@@@@@`;
79
+ break;
80
+ case ReasoningMode.CRITIQUE:
81
+ viz += `@@@@@@@@@@@@@@@
82
+ @ ◉ ◉ @ 🔍 Analyzing critically...
83
+ @ ~ @
84
+ @ ----- @
85
+ @@@@@@@@@@@@@@@`;
86
+ break;
87
+ case ReasoningMode.ENHANCE:
88
+ viz += `@@@@@@@@@@@@@@@
89
+ @ ◎ ◎ @ ⚡ Enhancing ideas...
90
+ @ ^ @
91
+ @ \\__/ @
92
+ @@@@@@@@@@@@@@@`;
93
+ break;
94
+ case ReasoningMode.DEEP_REASONING:
95
+ viz += `@@@@@@@@@@@@@@@
96
+ @ ◉ ◉ @ 🧠 DEEP REASONING...
97
+ @ ≈ @
98
+ @ ===== @
99
+ @@@@@@@@@@@@@@@`;
100
+ break;
101
+ default:
102
+ viz += `@@@@@@@@@@@@@@@
103
+ @ ● ● @ 🤔 Processing...
104
+ @ ∧ @
105
+ @ ___ @
106
+ @@@@@@@@@@@@@@@`;
107
+ }
108
+ viz += `\n\nProgress: [${'█'.repeat(stage)}${'░'.repeat(totalSteps - stage)}] ${stage}/${totalSteps}\n`;
109
+ viz += "```\n\n";
110
+ return viz;
111
+ }
112
+ /**
113
+ * Get icon for reasoning mode
114
+ */
115
+ getModeIcon(mode) {
116
+ const icons = {
117
+ [ReasoningMode.BRAINSTORM]: "💡",
118
+ [ReasoningMode.CRITIQUE]: "🔍",
119
+ [ReasoningMode.ENHANCE]: "⚡",
120
+ [ReasoningMode.VALIDATE]: "✅",
121
+ [ReasoningMode.SYNTHESIZE]: "🎯",
122
+ [ReasoningMode.DEBATE]: "⚔️",
123
+ [ReasoningMode.CONSENSUS]: "🤝",
124
+ [ReasoningMode.DEEP_REASONING]: "🧠",
125
+ [ReasoningMode.PINGPONG]: "🏓"
126
+ };
127
+ return icons[mode] || "🤖";
128
+ }
129
+ /**
130
+ * Generate example workflows for different technical domains
131
+ */
132
+ getExampleWorkflows() {
133
+ let examples = `# 🎯 Example Collaborative Workflows\n\n`;
134
+ examples += `## 1. Deep Reasoning for System Design\n`;
135
+ examples += `\`\`\`typescript\n`;
136
+ examples += `focus --mode deep-reasoning "Design a distributed cache system"\n`;
137
+ examples += `// Gemini brainstorms → Claude critiques → Grok enhances → Perplexity validates → Claude synthesizes\n`;
138
+ examples += `\`\`\`\n\n`;
139
+ examples += `## 2. Architecture Debate\n`;
140
+ examples += `\`\`\`typescript\n`;
141
+ examples += `focus --mode architecture-debate "Microservices vs Monolith for startup MVP"\n`;
142
+ examples += `// Models debate pros/cons → Grok analyzes → DeepSeek optimizes → Claude consensus\n`;
143
+ examples += `\`\`\`\n\n`;
144
+ examples += `## 3. Algorithm Optimization Chain\n`;
145
+ examples += `\`\`\`typescript\n`;
146
+ examples += `focus --mode algorithm-optimize "Optimize graph traversal for social network"\n`;
147
+ examples += `// Claude implements → Grok optimizes time → Gemini optimizes space → Claude validates\n`;
148
+ examples += `\`\`\`\n\n`;
149
+ examples += `## 4. Security Audit Council\n`;
150
+ examples += `\`\`\`typescript\n`;
151
+ examples += `focus --mode security-audit "Review authentication system"\n`;
152
+ examples += `// Claude finds vulnerabilities → Grok analyzes vectors → Perplexity researches → Gemini fixes\n`;
153
+ examples += `\`\`\`\n\n`;
154
+ examples += `## 5. Custom Chain Builder\n`;
155
+ examples += `\`\`\`typescript\n`;
156
+ examples += `const chain = createReasoningChain(\n`;
157
+ examples += ` TechnicalDomain.API_DESIGN,\n`;
158
+ examples += ` "Design GraphQL API for e-commerce"\n`;
159
+ examples += `)\n`;
160
+ examples += `.addBrainstorm("claude-sonnet", "Design schema and types")\n`;
161
+ examples += `.addDebate("gemini", "grok", "REST vs GraphQL for this use case")\n`;
162
+ examples += `.addEnhancement("claude-opus", "Add security and performance")\n`;
163
+ examples += `.addValidation("perplexity")\n`;
164
+ examples += `.addSynthesis("claude-sonnet")\n`;
165
+ examples += `.build();\n`;
166
+ examples += `\`\`\`\n\n`;
167
+ examples += `## 6. Debugging Detective Squad\n`;
168
+ examples += `\`\`\`typescript\n`;
169
+ examples += `focus --mode debug-detective "Memory leak in React app after route changes"\n`;
170
+ examples += `// Claude identifies causes → Grok traces flow → Perplexity finds solutions → Claude fixes\n`;
171
+ examples += `\`\`\`\n\n`;
172
+ examples += `## 7. Performance Council\n`;
173
+ examples += `\`\`\`typescript\n`;
174
+ examples += `focus --mode performance-council "Optimize database queries for dashboard"\n`;
175
+ examples += `// Gemini profiles → Claude adds caching → Grok improves algorithms → DeepSeek benchmarks\n`;
176
+ examples += `\`\`\`\n`;
177
+ return examples;
178
+ }
179
+ /**
180
+ * Get available templates
181
+ */
182
+ getAvailableTemplates() {
183
+ let output = `# 🎨 Available Reasoning Templates\n\n`;
184
+ Object.entries(REASONING_TEMPLATES).forEach(([key, template]) => {
185
+ output += `## ${template.name}\n`;
186
+ output += `**Key**: \`${key}\`\n`;
187
+ output += `**Description**: ${template.description}\n`;
188
+ output += `**Chain Length**: ${template.chain.length} steps\n`;
189
+ output += `**Models**: ${Array.from(new Set(template.chain.map(s => s.model))).join(", ")}\n\n`;
190
+ });
191
+ return output;
192
+ }
193
+ /**
194
+ * Update settings
195
+ */
196
+ updateSettings(options) {
197
+ if (options.modelTurnTaking !== undefined) {
198
+ this.modelTurnTaking = options.modelTurnTaking;
199
+ }
200
+ if (options.enableVisualization !== undefined) {
201
+ this.enableVisualization = options.enableVisualization;
202
+ }
203
+ }
204
+ }
205
+ // Singleton instance for convenience
206
+ export const visualizationService = new VisualizationService();
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Shared types for Collaborative Orchestrator
3
+ * Extracted to break circular dependency between CollaborativeOrchestrator and VisualizationService
4
+ */
5
+ export {};
@@ -0,0 +1,37 @@
1
+ export const balancedProfile = {
2
+ description: "Balanced set for general use (~Xk tokens, 18 tools)",
3
+ tools: {
4
+ think: true,
5
+ focus: true,
6
+ nextThought: true,
7
+ perplexity_ask: true,
8
+ perplexity_reason: true,
9
+ perplexity_research: false,
10
+ grok_reason: true,
11
+ grok_code: true,
12
+ grok_debug: false,
13
+ grok_architect: false,
14
+ grok_brainstorm: false,
15
+ grok_search: true,
16
+ openai_gpt5_reason: true,
17
+ openai_compare: false,
18
+ openai_brainstorm: true,
19
+ openai_code_review: false,
20
+ openai_explain: false,
21
+ gemini_brainstorm: true,
22
+ gemini_analyze_code: true,
23
+ gemini_analyze_text: false,
24
+ qwen_coder: true,
25
+ kimi_thinking: true,
26
+ qwen_competitive: false,
27
+ workflow: true,
28
+ list_workflows: true,
29
+ create_workflow: true,
30
+ visualize_workflow: true,
31
+ workflow_start: false,
32
+ continue_workflow: false,
33
+ workflow_status: false,
34
+ validate_workflow: false,
35
+ validate_workflow_file: false,
36
+ }
37
+ };
@@ -0,0 +1,37 @@
1
+ export const codeFocusProfile = {
2
+ description: "Code-heavy work with debugging and analysis (~Xk tokens, 15 tools)",
3
+ tools: {
4
+ think: true,
5
+ focus: true,
6
+ nextThought: true,
7
+ perplexity_ask: true,
8
+ perplexity_reason: false,
9
+ perplexity_research: false,
10
+ grok_reason: true,
11
+ grok_code: true,
12
+ grok_debug: true,
13
+ grok_architect: false,
14
+ grok_brainstorm: false,
15
+ grok_search: false,
16
+ openai_gpt5_reason: false,
17
+ openai_compare: false,
18
+ openai_brainstorm: false,
19
+ openai_code_review: true,
20
+ openai_explain: false,
21
+ gemini_brainstorm: true,
22
+ gemini_analyze_code: true,
23
+ gemini_analyze_text: false,
24
+ qwen_coder: true,
25
+ kimi_thinking: true,
26
+ qwen_competitive: false,
27
+ workflow: true,
28
+ list_workflows: true,
29
+ create_workflow: false,
30
+ visualize_workflow: false,
31
+ workflow_start: false,
32
+ continue_workflow: false,
33
+ workflow_status: false,
34
+ validate_workflow: true,
35
+ validate_workflow_file: false,
36
+ }
37
+ };
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Debug Intensive Profile
3
+ * ~12-14k tokens, 14 tools
4
+ *
5
+ * Deep debugging and forensic code analysis
6
+ *
7
+ * Best for:
8
+ * - Complex bug hunting
9
+ * - Race conditions and concurrency issues
10
+ * - Memory leaks and performance bottlenecks
11
+ * - Security vulnerabilities
12
+ * - Production incident analysis
13
+ */
14
+ export const debugIntensiveProfile = {
15
+ description: "Deep debugging and forensic code analysis (~12-14k tokens, 14 tools)",
16
+ tools: {
17
+ // Core reasoning
18
+ think: true,
19
+ focus: true,
20
+ nextThought: true,
21
+ // Grok's debugging arsenal
22
+ grok_code: true,
23
+ grok_debug: true,
24
+ // Code analysis
25
+ gemini_analyze_code: true,
26
+ // Code generation and analysis
27
+ qwen_coder: true,
28
+ // Deep reasoning for complex issues
29
+ kimi_thinking: true,
30
+ // Advanced exploration tools
31
+ hunter: true,
32
+ scout: true,
33
+ // Verification and validation
34
+ verifier: true,
35
+ challenger: true,
36
+ // Workflow execution (not creation)
37
+ workflow: true,
38
+ list_workflows: true,
39
+ // Disabled tools
40
+ perplexity_ask: false,
41
+ perplexity_reason: false,
42
+ perplexity_research: false,
43
+ grok_reason: false,
44
+ grok_architect: false,
45
+ grok_brainstorm: false,
46
+ grok_search: false,
47
+ openai_compare: false,
48
+ openai_brainstorm: false,
49
+ openai_code_review: false,
50
+ gemini_brainstorm: false,
51
+ gemini_analyze_text: false,
52
+ create_workflow: false,
53
+ visualize_workflow: false,
54
+ validate_workflow: false,
55
+ validate_workflow_file: false,
56
+ pingpong: false,
57
+ qwen_competitive: false,
58
+ }
59
+ };
@@ -0,0 +1,37 @@
1
+ export const fullProfile = {
2
+ description: "All tools enabled for maximum capability (~Xk tokens, 32 tools)",
3
+ tools: {
4
+ think: true,
5
+ focus: true,
6
+ nextThought: true,
7
+ perplexity_ask: true,
8
+ perplexity_reason: true,
9
+ perplexity_research: true,
10
+ grok_reason: true,
11
+ grok_code: true,
12
+ grok_debug: true,
13
+ grok_architect: true,
14
+ grok_brainstorm: true,
15
+ grok_search: true,
16
+ openai_gpt5_reason: true,
17
+ openai_compare: true,
18
+ openai_brainstorm: true,
19
+ openai_code_review: true,
20
+ openai_explain: true,
21
+ gemini_brainstorm: true,
22
+ gemini_analyze_code: true,
23
+ gemini_analyze_text: true,
24
+ qwen_coder: true,
25
+ kimi_thinking: true,
26
+ qwen_competitive: true,
27
+ workflow: true,
28
+ list_workflows: true,
29
+ create_workflow: true,
30
+ visualize_workflow: true,
31
+ workflow_start: true,
32
+ continue_workflow: true,
33
+ workflow_status: true,
34
+ validate_workflow: true,
35
+ validate_workflow_file: true,
36
+ }
37
+ };
@@ -0,0 +1,37 @@
1
+ export const minimalProfile = {
2
+ description: "Minimal essential tools for basic tasks (~Xk tokens, 8 tools)",
3
+ tools: {
4
+ think: true,
5
+ focus: true,
6
+ nextThought: true,
7
+ perplexity_ask: true,
8
+ perplexity_reason: false,
9
+ perplexity_research: false,
10
+ grok_reason: true,
11
+ grok_code: false,
12
+ grok_debug: false,
13
+ grok_architect: false,
14
+ grok_brainstorm: false,
15
+ grok_search: false,
16
+ openai_gpt5_reason: false,
17
+ openai_compare: false,
18
+ openai_brainstorm: false,
19
+ openai_code_review: false,
20
+ openai_explain: false,
21
+ gemini_brainstorm: true,
22
+ gemini_analyze_code: false,
23
+ gemini_analyze_text: false,
24
+ qwen_coder: true,
25
+ kimi_thinking: false,
26
+ qwen_competitive: false,
27
+ workflow: true,
28
+ list_workflows: false,
29
+ create_workflow: false,
30
+ visualize_workflow: false,
31
+ workflow_start: false,
32
+ continue_workflow: false,
33
+ workflow_status: false,
34
+ validate_workflow: false,
35
+ validate_workflow_file: false,
36
+ }
37
+ };
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Research Code Profile
3
+ * ~9-10k tokens, 13 tools
4
+ *
5
+ * Research + code analysis with minimal tokens
6
+ *
7
+ * Best for:
8
+ * - Technical research while coding
9
+ * - Learning new frameworks and libraries
10
+ * - API documentation exploration
11
+ * - Code exploration with web search
12
+ * - Balanced research and development work
13
+ */
14
+ export const researchCodeProfile = {
15
+ description: "Research + code analysis with minimal tokens (~9-10k tokens, 12 tools)",
16
+ tools: {
17
+ // Core reasoning
18
+ think: true,
19
+ focus: true,
20
+ nextThought: true,
21
+ // Perplexity for research
22
+ perplexity_ask: true,
23
+ perplexity_research: true,
24
+ // Grok for search and code
25
+ grok_search: true,
26
+ grok_code: true,
27
+ // OpenAI code review
28
+ openai_code_review: true,
29
+ // Gemini code analysis
30
+ gemini_analyze_code: true,
31
+ // Code generation
32
+ qwen_coder: true,
33
+ // Deep reasoning
34
+ kimi_thinking: true,
35
+ // Workflow execution
36
+ workflow: true,
37
+ list_workflows: true,
38
+ // Disabled tools
39
+ perplexity_reason: false,
40
+ grok_reason: false,
41
+ grok_debug: false,
42
+ grok_architect: false,
43
+ grok_brainstorm: false,
44
+ openai_compare: false,
45
+ openai_brainstorm: false,
46
+ gemini_brainstorm: false,
47
+ gemini_analyze_text: false,
48
+ hunter: false,
49
+ verifier: false,
50
+ scout: false,
51
+ challenger: false,
52
+ create_workflow: false,
53
+ visualize_workflow: false,
54
+ validate_workflow: false,
55
+ validate_workflow_file: false,
56
+ pingpong: false,
57
+ qwen_competitive: false,
58
+ }
59
+ };
@@ -0,0 +1,37 @@
1
+ export const researchPowerProfile = {
2
+ description: "Research-focused with Grok search + all Perplexity + brainstorming (~Xk tokens, 13 tools)",
3
+ tools: {
4
+ think: true,
5
+ focus: true,
6
+ nextThought: true,
7
+ perplexity_ask: true,
8
+ perplexity_reason: true,
9
+ perplexity_research: true,
10
+ grok_reason: true,
11
+ grok_code: false,
12
+ grok_debug: false,
13
+ grok_architect: false,
14
+ grok_brainstorm: false,
15
+ grok_search: true,
16
+ openai_gpt5_reason: false,
17
+ openai_compare: false,
18
+ openai_brainstorm: true,
19
+ openai_code_review: false,
20
+ openai_explain: false,
21
+ gemini_brainstorm: true,
22
+ gemini_analyze_code: false,
23
+ gemini_analyze_text: false,
24
+ qwen_coder: true,
25
+ kimi_thinking: true,
26
+ qwen_competitive: false,
27
+ workflow: true,
28
+ list_workflows: false,
29
+ create_workflow: false,
30
+ visualize_workflow: false,
31
+ workflow_start: false,
32
+ continue_workflow: false,
33
+ workflow_status: false,
34
+ validate_workflow: false,
35
+ validate_workflow_file: false,
36
+ }
37
+ };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Profile configuration types
3
+ * Defines the structure for tool profiles
4
+ */
5
+ export {};
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Workflow Builder Profile
3
+ * ~6-7k tokens, 10 tools
4
+ *
5
+ * Workflow creation, testing, and management
6
+ *
7
+ * Best for:
8
+ * - Creating custom workflows
9
+ * - Testing workflow YAML/JSON
10
+ * - Validating workflow logic
11
+ * - Designing multi-model orchestrations
12
+ */
13
+ export const workflowBuilderProfile = {
14
+ description: "Workflow creation, testing, and management (~7-8k tokens, 8 tools)",
15
+ tools: {
16
+ // Core reasoning
17
+ think: true,
18
+ focus: true,
19
+ nextThought: true,
20
+ // Brainstorming for workflow design
21
+ gemini_brainstorm: true,
22
+ // All workflow tools
23
+ workflow: true,
24
+ list_workflows: true,
25
+ create_workflow: true,
26
+ visualize_workflow: true,
27
+ validate_workflow: true,
28
+ validate_workflow_file: true,
29
+ // Disabled tools
30
+ perplexity_ask: false,
31
+ perplexity_reason: false,
32
+ perplexity_research: false,
33
+ grok_reason: false,
34
+ grok_code: false,
35
+ grok_debug: false,
36
+ grok_architect: false,
37
+ grok_brainstorm: false,
38
+ grok_search: false,
39
+ openai_compare: false,
40
+ openai_brainstorm: false,
41
+ openai_code_review: false,
42
+ gemini_analyze_code: false,
43
+ gemini_analyze_text: false,
44
+ qwen_coder: false,
45
+ kimi_thinking: false,
46
+ verifier: false,
47
+ scout: false,
48
+ challenger: false,
49
+ hunter: false,
50
+ pingpong: false,
51
+ qwen_competitive: false,
52
+ }
53
+ };
@@ -0,0 +1,78 @@
1
+ export class PromptEngineerLite {
2
+ constructor() {
3
+ this.t = new Map([
4
+ // Creative
5
+ ['what_if', (q) => `What if "${q}" had no limits? Explore wild possibilities.`],
6
+ ['alt_view', (q) => `"${q}" from 5 angles: child, scientist, artist, strategist, futurist.`],
7
+ ['creative_use', (q, c) => `Creative applications of "${q}"${c ? ' findings' : ''} across domains.`],
8
+ ['innovate', (q) => `Generate creative, unconventional solutions for "${q}". Consider multiple approaches: rethinking existing processes, drawing inspiration from other domains, removing constraints, and combining different methods. Provide 3+ novel, practical approaches.`],
9
+ // Research
10
+ ['investigate', (q) => `5W1H analysis of "${q}": Who/What/When/Where/Why/How + recent developments.`],
11
+ ['evidence', (q, c) => `Evidence for "${q}": support, contradict, cases, stats, experts.`],
12
+ // Analytical
13
+ ['analyze', (q, c) => `"${q}" systematic: components→relationships→patterns→strengths/risks→conclusions.`],
14
+ ['first_prin', (q) => `"${q}" first principles: truths→assumptions→atomic units→rebuild.`],
15
+ ['feasible', (q, c) => `"${q}" feasibility: technical/economic/time/resources/risks/metrics.`],
16
+ // Reflective
17
+ ['reflect', (q, c) => `"${q}" reflection: patterns, surprises, key insight, gaps, next steps.`],
18
+ ['patterns', (q, c) => `"${q}" patterns: themes, causality, cycles, anomalies, system insights.`],
19
+ ['decompose', (q) => `"${q}" breakdown: core→sub-problems→dependencies→constraints→steps.`],
20
+ ['integrate', (q) => `"${q}" synthesis: convergent themes, complements, contradictions, meta-pattern.`]
21
+ ]);
22
+ // Compact technique mapping
23
+ this.techniqueMap = {
24
+ 'what_if_speculation': 'what_if',
25
+ 'alternative_perspectives': 'alt_view',
26
+ 'creative_applications': 'creative_use',
27
+ 'innovative_solutions': 'innovate',
28
+ 'comprehensive_investigation': 'investigate',
29
+ 'evidence_gathering': 'evidence',
30
+ 'systematic_analysis': 'analyze',
31
+ 'first_principles': 'first_prin',
32
+ 'feasibility_analysis': 'feasible',
33
+ 'quick_reflection': 'reflect',
34
+ 'pattern_recognition': 'patterns',
35
+ 'problem_decomposition': 'decompose',
36
+ 'integration_reflection': 'integrate'
37
+ };
38
+ }
39
+ applyTechnique(tool, technique, query, prev) {
40
+ const key = this.techniqueMap[technique] || technique;
41
+ const handler = this.t.get(key) || ((q) => q);
42
+ const context = prev?.length ? this.extractContext(prev[prev.length - 1].output) : undefined;
43
+ return this.adaptForTool(tool, handler(query, context));
44
+ }
45
+ extractContext(output) {
46
+ const lines = output.split('\n').filter(l => l.trim());
47
+ const keyLine = lines.findIndex(l => /(summary|key|conclusion)/i.test(l));
48
+ return keyLine >= 0 ? lines.slice(keyLine, keyLine + 3).join(' ') : lines.slice(0, 2).join(' ');
49
+ }
50
+ adaptForTool(tool, prompt) {
51
+ const suffix = {
52
+ 'gemini_brainstorm': ' Think creatively.',
53
+ 'perplexity_research': ' Find concrete data.',
54
+ 'openai_reason': ' Structure clearly.',
55
+ 'openai_brainstorm': ' Explore alternatives.'
56
+ };
57
+ return prompt + (suffix[tool] || '');
58
+ }
59
+ getTechniqueDescription(technique) {
60
+ const desc = {
61
+ 'what_if': 'What if...',
62
+ 'alt_view': 'Multi-angle',
63
+ 'creative_use': 'Applications',
64
+ 'innovate': 'Innovation',
65
+ 'investigate': '5W1H',
66
+ 'evidence': 'Evidence',
67
+ 'analyze': 'Analysis',
68
+ 'first_prin': 'First principles',
69
+ 'feasible': 'Feasibility',
70
+ 'reflect': 'Reflection',
71
+ 'patterns': 'Patterns',
72
+ 'decompose': 'Breakdown',
73
+ 'integrate': 'Synthesis'
74
+ };
75
+ const key = this.techniqueMap[technique] || technique;
76
+ return desc[key] || technique;
77
+ }
78
+ }