neuro-cli 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +510 -0
  3. package/dist/advisor/advisor.d.ts +50 -0
  4. package/dist/advisor/advisor.js +178 -0
  5. package/dist/agents/base.d.ts +62 -0
  6. package/dist/agents/base.js +215 -0
  7. package/dist/agents/orchestrator.d.ts +46 -0
  8. package/dist/agents/orchestrator.js +192 -0
  9. package/dist/agents/team.d.ts +51 -0
  10. package/dist/agents/team.js +210 -0
  11. package/dist/api/models.d.ts +23 -0
  12. package/dist/api/models.js +514 -0
  13. package/dist/api/ollama.d.ts +153 -0
  14. package/dist/api/ollama.js +751 -0
  15. package/dist/api/openrouter.d.ts +55 -0
  16. package/dist/api/openrouter.js +223 -0
  17. package/dist/commands/commands.d.ts +43 -0
  18. package/dist/commands/commands.js +308 -0
  19. package/dist/config/config.d.ts +8 -0
  20. package/dist/config/config.js +311 -0
  21. package/dist/context/compaction.d.ts +54 -0
  22. package/dist/context/compaction.js +251 -0
  23. package/dist/context/custom-agents.d.ts +107 -0
  24. package/dist/context/custom-agents.js +397 -0
  25. package/dist/context/custom-tools.d.ts +120 -0
  26. package/dist/context/custom-tools.js +564 -0
  27. package/dist/context/git-checkpoint.d.ts +52 -0
  28. package/dist/context/git-checkpoint.js +240 -0
  29. package/dist/context/neuro-md.d.ts +48 -0
  30. package/dist/context/neuro-md.js +202 -0
  31. package/dist/context/neuroignore.d.ts +102 -0
  32. package/dist/context/neuroignore.js +441 -0
  33. package/dist/context/repo-map.d.ts +38 -0
  34. package/dist/context/repo-map.js +220 -0
  35. package/dist/context/skill-standard.d.ts +262 -0
  36. package/dist/context/skill-standard.js +1156 -0
  37. package/dist/context/skill-system.d.ts +75 -0
  38. package/dist/context/skill-system.js +578 -0
  39. package/dist/context/tree-sitter.d.ts +99 -0
  40. package/dist/context/tree-sitter.js +1956 -0
  41. package/dist/core/acp.d.ts +325 -0
  42. package/dist/core/acp.js +1498 -0
  43. package/dist/core/api-server.d.ts +143 -0
  44. package/dist/core/api-server.js +550 -0
  45. package/dist/core/approval.d.ts +81 -0
  46. package/dist/core/approval.js +432 -0
  47. package/dist/core/auto-compact.d.ts +127 -0
  48. package/dist/core/auto-compact.js +436 -0
  49. package/dist/core/auto-mode.d.ts +232 -0
  50. package/dist/core/auto-mode.js +831 -0
  51. package/dist/core/background-session.d.ts +166 -0
  52. package/dist/core/background-session.js +696 -0
  53. package/dist/core/cicd.d.ts +257 -0
  54. package/dist/core/cicd.js +1443 -0
  55. package/dist/core/cloud-sync.d.ts +156 -0
  56. package/dist/core/cloud-sync.js +582 -0
  57. package/dist/core/code-review.d.ts +132 -0
  58. package/dist/core/code-review.js +1191 -0
  59. package/dist/core/completion.d.ts +49 -0
  60. package/dist/core/completion.js +384 -0
  61. package/dist/core/context.d.ts +38 -0
  62. package/dist/core/context.js +144 -0
  63. package/dist/core/diff-preview.d.ts +35 -0
  64. package/dist/core/diff-preview.js +173 -0
  65. package/dist/core/doom-loop.d.ts +51 -0
  66. package/dist/core/doom-loop.js +179 -0
  67. package/dist/core/engine.d.ts +183 -0
  68. package/dist/core/engine.js +942 -0
  69. package/dist/core/extended-thinking.d.ts +103 -0
  70. package/dist/core/extended-thinking.js +269 -0
  71. package/dist/core/fallback.d.ts +54 -0
  72. package/dist/core/fallback.js +104 -0
  73. package/dist/core/git-worktree.d.ts +139 -0
  74. package/dist/core/git-worktree.js +614 -0
  75. package/dist/core/headless.d.ts +30 -0
  76. package/dist/core/headless.js +101 -0
  77. package/dist/core/i18n.d.ts +83 -0
  78. package/dist/core/i18n.js +739 -0
  79. package/dist/core/linting.d.ts +129 -0
  80. package/dist/core/linting.js +699 -0
  81. package/dist/core/model-router.d.ts +109 -0
  82. package/dist/core/model-router.js +581 -0
  83. package/dist/core/multi-model.d.ts +243 -0
  84. package/dist/core/multi-model.js +1099 -0
  85. package/dist/core/multi-session.d.ts +144 -0
  86. package/dist/core/multi-session.js +442 -0
  87. package/dist/core/multimodal.d.ts +125 -0
  88. package/dist/core/multimodal.js +286 -0
  89. package/dist/core/observability.d.ts +93 -0
  90. package/dist/core/observability.js +737 -0
  91. package/dist/core/os-sandbox.d.ts +122 -0
  92. package/dist/core/os-sandbox.js +1193 -0
  93. package/dist/core/outcome-grading.d.ts +228 -0
  94. package/dist/core/outcome-grading.js +1123 -0
  95. package/dist/core/output-styles.d.ts +57 -0
  96. package/dist/core/output-styles.js +382 -0
  97. package/dist/core/parallel-agents.d.ts +183 -0
  98. package/dist/core/parallel-agents.js +563 -0
  99. package/dist/core/plugin-bundle.d.ts +236 -0
  100. package/dist/core/plugin-bundle.js +887 -0
  101. package/dist/core/plugin-sdk.d.ts +139 -0
  102. package/dist/core/plugin-sdk.js +273 -0
  103. package/dist/core/prompt-cache.d.ts +163 -0
  104. package/dist/core/prompt-cache.js +599 -0
  105. package/dist/core/sandbox.d.ts +127 -0
  106. package/dist/core/sandbox.js +369 -0
  107. package/dist/core/scheduled-tasks.d.ts +151 -0
  108. package/dist/core/scheduled-tasks.js +502 -0
  109. package/dist/core/security-scanner.d.ts +160 -0
  110. package/dist/core/security-scanner.js +1494 -0
  111. package/dist/core/session.d.ts +83 -0
  112. package/dist/core/session.js +269 -0
  113. package/dist/core/shell-completion.d.ts +51 -0
  114. package/dist/core/shell-completion.js +674 -0
  115. package/dist/core/smart-monitor.d.ts +146 -0
  116. package/dist/core/smart-monitor.js +1199 -0
  117. package/dist/core/spec-driven.d.ts +233 -0
  118. package/dist/core/spec-driven.js +1485 -0
  119. package/dist/core/spending-warnings.d.ts +123 -0
  120. package/dist/core/spending-warnings.js +456 -0
  121. package/dist/core/sub-agent.d.ts +298 -0
  122. package/dist/core/sub-agent.js +1023 -0
  123. package/dist/core/telemetry.d.ts +157 -0
  124. package/dist/core/telemetry.js +412 -0
  125. package/dist/core/terminal-ux.d.ts +134 -0
  126. package/dist/core/terminal-ux.js +649 -0
  127. package/dist/core/testing.d.ts +146 -0
  128. package/dist/core/testing.js +1200 -0
  129. package/dist/core/types.d.ts +439 -0
  130. package/dist/core/types.js +6 -0
  131. package/dist/core/undo-redo.d.ts +112 -0
  132. package/dist/core/undo-redo.js +290 -0
  133. package/dist/core/updater.d.ts +159 -0
  134. package/dist/core/updater.js +608 -0
  135. package/dist/core/vim-mode.d.ts +151 -0
  136. package/dist/core/vim-mode.js +771 -0
  137. package/dist/core/voice.d.ts +137 -0
  138. package/dist/core/voice.js +538 -0
  139. package/dist/core/web-dashboard.d.ts +109 -0
  140. package/dist/core/web-dashboard.js +484 -0
  141. package/dist/hooks/hooks.d.ts +74 -0
  142. package/dist/hooks/hooks.js +160 -0
  143. package/dist/hooks/llm-evaluator.d.ts +165 -0
  144. package/dist/hooks/llm-evaluator.js +560 -0
  145. package/dist/index.d.ts +3 -0
  146. package/dist/index.js +1186 -0
  147. package/dist/lsp/lsp-manager.d.ts +63 -0
  148. package/dist/lsp/lsp-manager.js +351 -0
  149. package/dist/mcp/client.d.ts +133 -0
  150. package/dist/mcp/client.js +684 -0
  151. package/dist/mcp/mcp-apps.d.ts +70 -0
  152. package/dist/mcp/mcp-apps.js +1007 -0
  153. package/dist/tools/bash.d.ts +5 -0
  154. package/dist/tools/bash.js +195 -0
  155. package/dist/tools/browser.d.ts +92 -0
  156. package/dist/tools/browser.js +1570 -0
  157. package/dist/tools/extended.d.ts +6 -0
  158. package/dist/tools/extended.js +191 -0
  159. package/dist/tools/file.d.ts +10 -0
  160. package/dist/tools/file.js +382 -0
  161. package/dist/tools/github.d.ts +389 -0
  162. package/dist/tools/github.js +759 -0
  163. package/dist/tools/index.d.ts +9 -0
  164. package/dist/tools/index.js +40 -0
  165. package/dist/tools/memory.d.ts +6 -0
  166. package/dist/tools/memory.js +197 -0
  167. package/dist/tools/registry.d.ts +29 -0
  168. package/dist/tools/registry.js +64 -0
  169. package/dist/tools/web.d.ts +6 -0
  170. package/dist/tools/web.js +150 -0
  171. package/dist/ui/renderer.d.ts +97 -0
  172. package/dist/ui/renderer.js +279 -0
  173. package/dist/ui/theme.d.ts +27 -0
  174. package/dist/ui/theme.js +106 -0
  175. package/package.json +83 -0
@@ -0,0 +1,243 @@
1
+ import { OpenRouterClient, TokenUsage } from '../api/openrouter.js';
2
+ import { ToolCall } from './types.js';
3
+ export interface ModelRole {
4
+ name: string;
5
+ model: string;
6
+ fallbackModels: string[];
7
+ maxTokensPerRequest: number;
8
+ description: string;
9
+ }
10
+ export interface OrchestratorConfig {
11
+ roles: {
12
+ orchestrator: ModelRole;
13
+ worker: ModelRole;
14
+ evaluator: ModelRole;
15
+ reviewer: ModelRole;
16
+ };
17
+ costBudget: {
18
+ maxPerSession: number;
19
+ maxPerTask: number;
20
+ warnThreshold: number;
21
+ };
22
+ qualityGates: {
23
+ enabled: boolean;
24
+ evaluatorModel: string;
25
+ minConfidence: number;
26
+ };
27
+ dynamicSwitching: boolean;
28
+ }
29
+ export interface TaskClassification {
30
+ complexity: 'trivial' | 'simple' | 'moderate' | 'complex' | 'critical';
31
+ suggestedRole: string;
32
+ suggestedModel: string;
33
+ estimatedTokens: number;
34
+ reasoning: string;
35
+ }
36
+ export interface ModelResponse {
37
+ content: string;
38
+ model: string;
39
+ role: string;
40
+ usage: TokenUsage;
41
+ toolCalls: ToolCall[];
42
+ confidence?: number;
43
+ timestamp: number;
44
+ }
45
+ export interface OrchestrationResult {
46
+ plan: ModelResponse;
47
+ execution: ModelResponse;
48
+ evaluation?: ModelResponse;
49
+ review?: ModelResponse;
50
+ totalCost: number;
51
+ totalTokens: number;
52
+ phases: OrchestrationPhase[];
53
+ escalated: boolean;
54
+ escalationReason?: string;
55
+ success: boolean;
56
+ timestamp: number;
57
+ }
58
+ export interface OrchestrationPhase {
59
+ role: string;
60
+ model: string;
61
+ inputTokens: number;
62
+ outputTokens: number;
63
+ cost: number;
64
+ durationMs: number;
65
+ success: boolean;
66
+ }
67
+ export interface CostBreakdown {
68
+ total: number;
69
+ byRole: Record<string, number>;
70
+ byModel: Record<string, number>;
71
+ perTask: CostTaskEntry[];
72
+ sessionStart: number;
73
+ }
74
+ export interface CostTaskEntry {
75
+ taskDescription: string;
76
+ cost: number;
77
+ role: string;
78
+ model: string;
79
+ timestamp: number;
80
+ }
81
+ export interface WorkerFailureRecord {
82
+ model: string;
83
+ timestamp: number;
84
+ error: string;
85
+ }
86
+ export declare const DEFAULT_ORCHESTRATOR_CONFIG: OrchestratorConfig;
87
+ export declare class MultiModelOrchestrator {
88
+ private config;
89
+ private client;
90
+ private fallbackChain;
91
+ private spendingMonitor;
92
+ private roleCosts;
93
+ private modelCosts;
94
+ private taskCostEntries;
95
+ private sessionTotalCost;
96
+ private sessionTotalTokens;
97
+ private sessionStartTime;
98
+ private workerFailures;
99
+ private workerUpgradeUntil;
100
+ private effectiveModels;
101
+ private budgetExceeded;
102
+ constructor(config: OrchestratorConfig, apiClient: OpenRouterClient);
103
+ /**
104
+ * Classify a task by complexity and suggest the appropriate model role.
105
+ * Uses a lightweight LLM call when possible; falls back to local heuristics.
106
+ */
107
+ classifyTask(prompt: string, context?: string): Promise<TaskClassification>;
108
+ /**
109
+ * Route a classification to the appropriate model ID.
110
+ */
111
+ routeToModel(classification: TaskClassification): string;
112
+ /**
113
+ * Full orchestration pipeline:
114
+ * orchestrator plans -> worker executes -> evaluator checks -> reviewer reviews
115
+ *
116
+ * Quality gates can re-route to orchestrator if evaluator confidence is low.
117
+ */
118
+ orchestrateAndExecute(prompt: string, context?: string): Promise<OrchestrationResult>;
119
+ /**
120
+ * Call the orchestrator model with a prompt.
121
+ */
122
+ callOrchestrator(prompt: string): Promise<ModelResponse>;
123
+ /**
124
+ * Call the worker model with a prompt.
125
+ */
126
+ callWorker(prompt: string): Promise<ModelResponse>;
127
+ /**
128
+ * Call the evaluator model with a prompt.
129
+ */
130
+ callEvaluator(prompt: string): Promise<ModelResponse>;
131
+ /**
132
+ * Call the reviewer model with a prompt.
133
+ */
134
+ callReviewer(prompt: string): Promise<ModelResponse>;
135
+ /**
136
+ * Get the full cost breakdown for this session.
137
+ */
138
+ getSessionCost(): CostBreakdown;
139
+ /**
140
+ * Get cost grouped by role.
141
+ */
142
+ getCostByRole(): Record<string, number>;
143
+ /**
144
+ * Check whether spending is within budget.
145
+ */
146
+ isWithinBudget(): boolean;
147
+ /**
148
+ * Update role configurations partially.
149
+ */
150
+ updateRoles(roles: Partial<OrchestratorConfig['roles']>): void;
151
+ /**
152
+ * Set a new cost budget.
153
+ */
154
+ setCostBudget(budget: OrchestratorConfig['costBudget']): void;
155
+ /**
156
+ * Get the currently effective model for a given role.
157
+ * This may differ from the configured model during fallback scenarios.
158
+ */
159
+ getEffectiveModel(role: string): string;
160
+ /**
161
+ * Get the full orchestrator config.
162
+ */
163
+ getConfig(): OrchestratorConfig;
164
+ /**
165
+ * Reset session-level cost tracking and worker failure state.
166
+ */
167
+ resetSession(): void;
168
+ /**
169
+ * Call a model for a specific role, with fallback chain support.
170
+ */
171
+ private callRole;
172
+ /**
173
+ * Record a cost entry for a role/model combination.
174
+ */
175
+ private recordCost;
176
+ /**
177
+ * Parse the LLM classification response.
178
+ */
179
+ private parseClassificationResponse;
180
+ /**
181
+ * Local heuristic classification fallback.
182
+ * Used when the LLM classification call fails or is unavailable.
183
+ */
184
+ private classifyTaskHeuristic;
185
+ /**
186
+ * Parse the evaluator's confidence response.
187
+ */
188
+ private parseEvaluationResponse;
189
+ /**
190
+ * Record a worker failure for dynamic switching.
191
+ */
192
+ private recordWorkerFailure;
193
+ /**
194
+ * Check if the worker is currently upgraded to the orchestrator model.
195
+ */
196
+ private isWorkerUpgraded;
197
+ /**
198
+ * Get the cheapest available model from the registry.
199
+ * Used for classification calls to minimize cost.
200
+ */
201
+ private cheapestAvailableModel;
202
+ /**
203
+ * Get the ModelRole config for a given role name.
204
+ */
205
+ private getRoleByName;
206
+ /**
207
+ * Get a system prompt appropriate for a role.
208
+ */
209
+ private getSystemPromptForRole;
210
+ /**
211
+ * Get an appropriate temperature for a role.
212
+ */
213
+ private getTemperatureForRole;
214
+ /**
215
+ * Create an empty ModelResponse for error/budget-exceeded cases.
216
+ */
217
+ private emptyResponse;
218
+ /**
219
+ * Sum the cost of completed phases.
220
+ */
221
+ private sumPhaseCosts;
222
+ /**
223
+ * Sum the tokens of completed phases.
224
+ */
225
+ private sumPhaseTokens;
226
+ /**
227
+ * Rebuild the fallback chain when role configs change.
228
+ */
229
+ private rebuildFallbackChain;
230
+ }
231
+ /**
232
+ * Create a MultiModelOrchestrator with sensible defaults for free models.
233
+ */
234
+ export declare function createFreeOrchestrator(apiClient: OpenRouterClient): MultiModelOrchestrator;
235
+ /**
236
+ * Create a MultiModelOrchestrator with premium models for maximum capability.
237
+ */
238
+ export declare function createPremiumOrchestrator(apiClient: OpenRouterClient): MultiModelOrchestrator;
239
+ /**
240
+ * Create a MultiModelOrchestrator with a balanced mix of free and premium models.
241
+ */
242
+ export declare function createBalancedOrchestrator(apiClient: OpenRouterClient): MultiModelOrchestrator;
243
+ //# sourceMappingURL=multi-model.d.ts.map