myshell-tools 1.0.0 → 2.0.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.
- package/CHANGELOG.md +44 -69
- package/LICENSE +21 -21
- package/README.md +178 -318
- package/dist/cli.d.ts +8 -0
- package/dist/cli.js +130 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/cost.d.ts +36 -0
- package/dist/commands/cost.js +103 -0
- package/dist/commands/cost.js.map +1 -0
- package/dist/commands/doctor.d.ts +36 -0
- package/dist/commands/doctor.js +115 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/login.d.ts +20 -0
- package/dist/commands/login.js +60 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/core/assess.d.ts +25 -0
- package/dist/core/assess.js +142 -0
- package/dist/core/assess.js.map +1 -0
- package/dist/core/classify.d.ts +19 -0
- package/dist/core/classify.js +80 -0
- package/dist/core/classify.js.map +1 -0
- package/dist/core/escalate.d.ts +32 -0
- package/dist/core/escalate.js +57 -0
- package/dist/core/escalate.js.map +1 -0
- package/dist/core/index.d.ts +13 -0
- package/dist/core/index.js +12 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/orchestrate.d.ts +42 -0
- package/dist/core/orchestrate.js +439 -0
- package/dist/core/orchestrate.js.map +1 -0
- package/dist/core/policy.d.ts +9 -0
- package/dist/core/policy.js +27 -0
- package/dist/core/policy.js.map +1 -0
- package/dist/core/prompt.d.ts +26 -0
- package/dist/core/prompt.js +125 -0
- package/dist/core/prompt.js.map +1 -0
- package/dist/core/review.d.ts +46 -0
- package/dist/core/review.js +148 -0
- package/dist/core/review.js.map +1 -0
- package/dist/core/route.d.ts +28 -0
- package/dist/core/route.js +52 -0
- package/dist/core/route.js.map +1 -0
- package/dist/core/types.d.ts +141 -0
- package/dist/core/types.js +14 -0
- package/dist/core/types.js.map +1 -0
- package/dist/infra/atomic.d.ts +53 -0
- package/dist/infra/atomic.js +171 -0
- package/dist/infra/atomic.js.map +1 -0
- package/dist/infra/clock.d.ts +9 -0
- package/dist/infra/clock.js +15 -0
- package/dist/infra/clock.js.map +1 -0
- package/dist/infra/index.d.ts +9 -0
- package/dist/infra/index.js +7 -0
- package/dist/infra/index.js.map +1 -0
- package/dist/infra/ledger.d.ts +49 -0
- package/dist/infra/ledger.js +90 -0
- package/dist/infra/ledger.js.map +1 -0
- package/dist/infra/paths.d.ts +28 -0
- package/dist/infra/paths.js +38 -0
- package/dist/infra/paths.js.map +1 -0
- package/dist/infra/pricing.d.ts +47 -0
- package/dist/infra/pricing.js +151 -0
- package/dist/infra/pricing.js.map +1 -0
- package/dist/infra/session.d.ts +28 -0
- package/dist/infra/session.js +61 -0
- package/dist/infra/session.js.map +1 -0
- package/dist/interface/render.d.ts +27 -0
- package/dist/interface/render.js +134 -0
- package/dist/interface/render.js.map +1 -0
- package/dist/interface/repl.d.ts +23 -0
- package/dist/interface/repl.js +90 -0
- package/dist/interface/repl.js.map +1 -0
- package/dist/interface/run.d.ts +20 -0
- package/dist/interface/run.js +31 -0
- package/dist/interface/run.js.map +1 -0
- package/dist/providers/claude-parse.d.ts +24 -0
- package/dist/providers/claude-parse.js +113 -0
- package/dist/providers/claude-parse.js.map +1 -0
- package/dist/providers/claude.d.ts +45 -0
- package/dist/providers/claude.js +122 -0
- package/dist/providers/claude.js.map +1 -0
- package/dist/providers/codex-parse.d.ts +32 -0
- package/dist/providers/codex-parse.js +145 -0
- package/dist/providers/codex-parse.js.map +1 -0
- package/dist/providers/codex.d.ts +44 -0
- package/dist/providers/codex.js +124 -0
- package/dist/providers/codex.js.map +1 -0
- package/dist/providers/detect.d.ts +49 -0
- package/dist/providers/detect.js +125 -0
- package/dist/providers/detect.js.map +1 -0
- package/dist/providers/errors.d.ts +49 -0
- package/dist/providers/errors.js +189 -0
- package/dist/providers/errors.js.map +1 -0
- package/dist/providers/index.d.ts +9 -0
- package/dist/providers/index.js +7 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/port.d.ts +74 -0
- package/dist/providers/port.js +16 -0
- package/dist/providers/port.js.map +1 -0
- package/dist/providers/registry.d.ts +21 -0
- package/dist/providers/registry.js +34 -0
- package/dist/providers/registry.js.map +1 -0
- package/dist/ui/banner.d.ts +19 -0
- package/dist/ui/banner.js +32 -0
- package/dist/ui/banner.js.map +1 -0
- package/dist/ui/spinner.d.ts +27 -0
- package/dist/ui/spinner.js +67 -0
- package/dist/ui/spinner.js.map +1 -0
- package/dist/ui/theme.d.ts +32 -0
- package/dist/ui/theme.js +56 -0
- package/dist/ui/theme.js.map +1 -0
- package/package.json +55 -49
- package/data/orchestrator.json +0 -113
- package/src/auth/recovery.mjs +0 -328
- package/src/auth/refresh.mjs +0 -373
- package/src/chef.mjs +0 -348
- package/src/cli/doctor.mjs +0 -568
- package/src/cli/reset.mjs +0 -447
- package/src/cli/status.mjs +0 -379
- package/src/cli.mjs +0 -429
- package/src/commands/doctor.mjs +0 -375
- package/src/commands/help.mjs +0 -324
- package/src/commands/status.mjs +0 -331
- package/src/monitor/health.mjs +0 -486
- package/src/monitor/performance.mjs +0 -442
- package/src/monitor/report.mjs +0 -535
- package/src/orchestrator/classify.mjs +0 -391
- package/src/orchestrator/confidence.mjs +0 -151
- package/src/orchestrator/handoffs.mjs +0 -231
- package/src/orchestrator/review.mjs +0 -222
- package/src/providers/balance.mjs +0 -201
- package/src/providers/claude.mjs +0 -236
- package/src/providers/codex.mjs +0 -255
- package/src/providers/detect.mjs +0 -185
- package/src/providers/errors.mjs +0 -373
- package/src/providers/select.mjs +0 -162
- package/src/repl-enhanced.mjs +0 -417
- package/src/repl.mjs +0 -321
- package/src/state/archive.mjs +0 -366
- package/src/state/atomic.mjs +0 -116
- package/src/state/cleanup.mjs +0 -440
- package/src/state/recovery.mjs +0 -461
- package/src/state/session.mjs +0 -147
- package/src/ui/errors.mjs +0 -456
- package/src/ui/formatter.mjs +0 -327
- package/src/ui/icons.mjs +0 -318
- package/src/ui/progress.mjs +0 -468
- package/templates/prompts/confidence-format.txt +0 -14
- package/templates/prompts/ic-with-feedback.txt +0 -41
- package/templates/prompts/ic.txt +0 -13
- package/templates/prompts/manager-review.txt +0 -40
- package/templates/prompts/manager.txt +0 -14
- package/templates/prompts/worker.txt +0 -12
package/src/repl-enhanced.mjs
DELETED
|
@@ -1,417 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* repl-enhanced.mjs — Enhanced REPL with dual-brain style orchestration display
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as readline from 'readline';
|
|
6
|
-
import { fmt, separator, formatTier, formatDuration, timeAgo } from './ui/formatter.mjs';
|
|
7
|
-
import { status, tier, session as sessionIcons, progress } from './ui/icons.mjs';
|
|
8
|
-
import { HierarchicalProgress, createSpinner } from './ui/progress.mjs';
|
|
9
|
-
import { displayError, handleError } from './ui/errors.mjs';
|
|
10
|
-
import { chef } from './chef.mjs';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Enhanced REPL loop with visual orchestration
|
|
14
|
-
*/
|
|
15
|
-
export async function startEnhancedREPL(context) {
|
|
16
|
-
const rl = createReadlineInterface();
|
|
17
|
-
|
|
18
|
-
displayWelcome(context);
|
|
19
|
-
displaySessionResume();
|
|
20
|
-
|
|
21
|
-
console.log(''); // Add spacing before prompt
|
|
22
|
-
|
|
23
|
-
while (true) {
|
|
24
|
-
try {
|
|
25
|
-
const userInput = await askUser(rl);
|
|
26
|
-
|
|
27
|
-
if (!userInput.trim()) continue;
|
|
28
|
-
|
|
29
|
-
// Handle built-in commands
|
|
30
|
-
if (userInput.startsWith('/')) {
|
|
31
|
-
const handled = await handleCommand(userInput.trim(), context);
|
|
32
|
-
if (handled) continue;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// Exit commands
|
|
36
|
-
if (['exit', 'quit', '/exit', '/quit'].includes(userInput.toLowerCase())) {
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Process user input through AI orchestration
|
|
41
|
-
await processWithOrchestration(userInput, context);
|
|
42
|
-
|
|
43
|
-
} catch (error) {
|
|
44
|
-
handleError(error, { operation: 'user input processing' });
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Graceful shutdown
|
|
49
|
-
const shutdownSpinner = createSpinner('Saving session...');
|
|
50
|
-
shutdownSpinner.start();
|
|
51
|
-
|
|
52
|
-
setTimeout(() => {
|
|
53
|
-
shutdownSpinner.success('Session saved');
|
|
54
|
-
console.log(fmt.success('Goodbye! 👋'));
|
|
55
|
-
rl.close();
|
|
56
|
-
}, 500);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Create readline interface with enhanced features
|
|
61
|
-
*/
|
|
62
|
-
function createReadlineInterface() {
|
|
63
|
-
const rl = readline.createInterface({
|
|
64
|
-
input: process.stdin,
|
|
65
|
-
output: process.stdout,
|
|
66
|
-
prompt: fmt.dim('You: '),
|
|
67
|
-
history: [],
|
|
68
|
-
historySize: 100
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
// Enhanced Ctrl+C handling
|
|
72
|
-
rl.on('SIGINT', () => {
|
|
73
|
-
console.log('\n');
|
|
74
|
-
const spinner = createSpinner('Finalizing session...');
|
|
75
|
-
spinner.start();
|
|
76
|
-
|
|
77
|
-
setTimeout(() => {
|
|
78
|
-
spinner.success('Session finalized');
|
|
79
|
-
console.log(fmt.success('Session saved. Goodbye! 👋'));
|
|
80
|
-
process.exit(0);
|
|
81
|
-
}, 500);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
return rl;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Display welcome message with context
|
|
89
|
-
*/
|
|
90
|
-
function displayWelcome(context) {
|
|
91
|
-
const { environment, availableModels } = context;
|
|
92
|
-
|
|
93
|
-
console.log('');
|
|
94
|
-
console.log(fmt.bold('🎯 Ready for AI orchestration'));
|
|
95
|
-
|
|
96
|
-
// Show available capabilities
|
|
97
|
-
const capabilities = [];
|
|
98
|
-
if (availableModels.manager.length > 0) capabilities.push('🏢 Strategic planning');
|
|
99
|
-
if (availableModels.ic.length > 0) capabilities.push('⚡ Code implementation');
|
|
100
|
-
if (availableModels.worker.length > 0) capabilities.push('🔍 Quick lookups');
|
|
101
|
-
|
|
102
|
-
if (capabilities.length > 0) {
|
|
103
|
-
console.log(` ${fmt.dim('Available:')} ${capabilities.join(', ')}`);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
console.log(` ${fmt.dim('Tip: Commands start with')} ${fmt.cyan('/')} ${fmt.dim('• Press')} ${fmt.cyan('Ctrl+C')} ${fmt.dim('to exit')}`);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Ask user for input with enhanced prompt
|
|
111
|
-
*/
|
|
112
|
-
async function askUser(rl) {
|
|
113
|
-
return new Promise((resolve) => {
|
|
114
|
-
rl.question('', (answer) => {
|
|
115
|
-
resolve(answer);
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Handle built-in slash commands
|
|
122
|
-
*/
|
|
123
|
-
async function handleCommand(command, context) {
|
|
124
|
-
const [cmd, ...args] = command.split(' ');
|
|
125
|
-
|
|
126
|
-
switch (cmd.toLowerCase()) {
|
|
127
|
-
case '/help':
|
|
128
|
-
displayHelpCommands();
|
|
129
|
-
return true;
|
|
130
|
-
|
|
131
|
-
case '/clear':
|
|
132
|
-
console.clear();
|
|
133
|
-
displayWelcome(context);
|
|
134
|
-
displaySessionResume();
|
|
135
|
-
return true;
|
|
136
|
-
|
|
137
|
-
case '/status':
|
|
138
|
-
displaySessionStatus();
|
|
139
|
-
return true;
|
|
140
|
-
|
|
141
|
-
case '/models':
|
|
142
|
-
displayAvailableModels(context.availableModels);
|
|
143
|
-
return true;
|
|
144
|
-
|
|
145
|
-
case '/balance':
|
|
146
|
-
displayProviderBalance();
|
|
147
|
-
return true;
|
|
148
|
-
|
|
149
|
-
case '/reset':
|
|
150
|
-
const resetSpinner = createSpinner('Resetting session...');
|
|
151
|
-
resetSpinner.start();
|
|
152
|
-
setTimeout(() => {
|
|
153
|
-
resetSpinner.success('Session reset');
|
|
154
|
-
console.log(fmt.success('Session cleared. Starting fresh! ✨'));
|
|
155
|
-
}, 1000);
|
|
156
|
-
return true;
|
|
157
|
-
|
|
158
|
-
default:
|
|
159
|
-
console.log(fmt.warning(`Unknown command: ${cmd}`));
|
|
160
|
-
console.log(fmt.dim('Type /help to see available commands'));
|
|
161
|
-
return true;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Process user input with visual orchestration
|
|
167
|
-
*/
|
|
168
|
-
async function processWithOrchestration(userInput, context) {
|
|
169
|
-
console.log('');
|
|
170
|
-
|
|
171
|
-
// Create hierarchical progress display
|
|
172
|
-
const orchestration = new HierarchicalProgress();
|
|
173
|
-
|
|
174
|
-
try {
|
|
175
|
-
// Start with initial agent
|
|
176
|
-
const initialTier = determineInitialTier(userInput);
|
|
177
|
-
const agentId = 'agent-' + Date.now();
|
|
178
|
-
|
|
179
|
-
orchestration.addAgent(agentId, {
|
|
180
|
-
tier: initialTier,
|
|
181
|
-
text: `${initialTier.toUpperCase()}: Processing request`,
|
|
182
|
-
status: 'thinking'
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
// Simulate AI processing with realistic delays
|
|
186
|
-
await simulateAIWork(orchestration, agentId, userInput, context);
|
|
187
|
-
|
|
188
|
-
// Show completion
|
|
189
|
-
orchestration.complete(agentId, 'Task completed successfully');
|
|
190
|
-
|
|
191
|
-
} catch (error) {
|
|
192
|
-
console.log('\n');
|
|
193
|
-
handleError(error, {
|
|
194
|
-
operation: 'AI orchestration',
|
|
195
|
-
tier: 'unknown'
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Determine the initial tier based on user input complexity
|
|
202
|
-
*/
|
|
203
|
-
function determineInitialTier(input) {
|
|
204
|
-
const words = input.toLowerCase();
|
|
205
|
-
|
|
206
|
-
// Manager tier triggers
|
|
207
|
-
if (words.includes('architecture') || words.includes('design') ||
|
|
208
|
-
words.includes('strategy') || words.includes('review') ||
|
|
209
|
-
words.includes('security') || words.includes('complex')) {
|
|
210
|
-
return 'manager';
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
// Worker tier triggers
|
|
214
|
-
if (words.includes('find') || words.includes('search') ||
|
|
215
|
-
words.includes('list') || words.includes('show') ||
|
|
216
|
-
words.includes('grep') || words.includes('what is')) {
|
|
217
|
-
return 'worker';
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
// Default to IC tier
|
|
221
|
-
return 'ic';
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* Simulate AI work with realistic orchestration patterns
|
|
226
|
-
*/
|
|
227
|
-
async function simulateAIWork(orchestration, agentId, input, context) {
|
|
228
|
-
const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
|
229
|
-
|
|
230
|
-
// Initial thinking phase
|
|
231
|
-
await delay(800);
|
|
232
|
-
orchestration.updateAgent(agentId, { status: 'working' });
|
|
233
|
-
|
|
234
|
-
// Simulate complexity check - sometimes escalate
|
|
235
|
-
await delay(1200);
|
|
236
|
-
|
|
237
|
-
const shouldEscalate = Math.random() > 0.7; // 30% chance
|
|
238
|
-
const shouldDelegate = Math.random() > 0.8; // 20% chance
|
|
239
|
-
|
|
240
|
-
if (shouldEscalate) {
|
|
241
|
-
// Escalate to manager
|
|
242
|
-
const managerId = 'manager-' + Date.now();
|
|
243
|
-
orchestration.escalate(agentId, managerId, 'manager', 'Complexity detected - requesting manager review');
|
|
244
|
-
|
|
245
|
-
await delay(1500);
|
|
246
|
-
orchestration.updateAgent(managerId, {
|
|
247
|
-
status: 'working',
|
|
248
|
-
text: 'MANAGER: Analyzing requirements and creating plan'
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
await delay(2000);
|
|
252
|
-
|
|
253
|
-
if (shouldDelegate) {
|
|
254
|
-
// Delegate subtask to worker
|
|
255
|
-
const workerId = 'worker-' + Date.now();
|
|
256
|
-
orchestration.delegate(managerId, workerId, 'worker', 'Gathering preliminary information');
|
|
257
|
-
|
|
258
|
-
await delay(1000);
|
|
259
|
-
orchestration.updateAgent(workerId, { status: 'working' });
|
|
260
|
-
|
|
261
|
-
await delay(1500);
|
|
262
|
-
orchestration.complete(workerId, 'Information gathered');
|
|
263
|
-
|
|
264
|
-
await delay(500);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
orchestration.complete(managerId, 'Strategic analysis complete');
|
|
268
|
-
await delay(300);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
await delay(500);
|
|
272
|
-
|
|
273
|
-
// Show realistic response
|
|
274
|
-
console.log('\n' + separator(60, '═', fmt.green('')));
|
|
275
|
-
console.log(`${status.success} ${fmt.green('Response generated successfully')}`);
|
|
276
|
-
|
|
277
|
-
// Mock AI response based on input
|
|
278
|
-
const response = generateMockResponse(input);
|
|
279
|
-
console.log('\n' + response);
|
|
280
|
-
console.log('\n' + fmt.dim('───────────────────────────────────────────────────────────'));
|
|
281
|
-
|
|
282
|
-
// Show model info
|
|
283
|
-
const usedModel = context.availableModels.ic[0] || context.availableModels.worker[0] || context.availableModels.manager[0];
|
|
284
|
-
if (usedModel) {
|
|
285
|
-
console.log(`${fmt.dim('Model:')} ${fmt.formatModel(usedModel.provider, usedModel.model)}`);
|
|
286
|
-
console.log(`${fmt.dim('Confidence:')} ${fmt.green('87%')}`);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
console.log('');
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Generate a mock response based on input type
|
|
294
|
-
*/
|
|
295
|
-
function generateMockResponse(input) {
|
|
296
|
-
const lower = input.toLowerCase();
|
|
297
|
-
|
|
298
|
-
if (lower.includes('find') || lower.includes('search')) {
|
|
299
|
-
return `🔍 Found 3 relevant files:\n • src/components/auth.tsx\n • lib/auth-utils.ts\n • tests/auth.spec.ts`;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
if (lower.includes('fix') || lower.includes('bug')) {
|
|
303
|
-
return `🔧 I've identified the issue and created a fix:\n\n1. The authentication token wasn't being properly refreshed\n2. Added token validation middleware\n3. Updated error handling for expired sessions\n\nThe fix has been applied to your codebase.`;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
if (lower.includes('architecture') || lower.includes('design')) {
|
|
307
|
-
return `🏗️ Here's a recommended architecture:\n\n**Frontend Layer:**\n• Next.js with TypeScript\n• React Query for state management\n• TailwindCSS for styling\n\n**API Layer:**\n• Express.js REST API\n• JWT authentication\n• Rate limiting middleware\n\n**Database Layer:**\n• PostgreSQL for relational data\n• Redis for caching\n• Database migrations with Prisma`;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
if (lower.includes('explain') || lower.includes('how')) {
|
|
311
|
-
return `💡 Let me break this down:\n\n**How it works:**\n1. The system uses a three-tier architecture\n2. Requests flow through authentication middleware\n3. Business logic is handled in service layers\n4. Data persistence uses the repository pattern\n\nThis design provides separation of concerns and makes the codebase maintainable.`;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
// Default response
|
|
315
|
-
return `✅ I've processed your request. The implementation follows best practices and includes proper error handling, logging, and documentation.`;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
/**
|
|
319
|
-
* Display help for slash commands
|
|
320
|
-
*/
|
|
321
|
-
function displayHelpCommands() {
|
|
322
|
-
console.log('\n' + fmt.bold('📋 Available Commands:'));
|
|
323
|
-
console.log(separator(50, '─'));
|
|
324
|
-
|
|
325
|
-
const commands = [
|
|
326
|
-
{ cmd: '/help', desc: 'Show this help message' },
|
|
327
|
-
{ cmd: '/clear', desc: 'Clear screen and show session info' },
|
|
328
|
-
{ cmd: '/status', desc: 'Show current session statistics' },
|
|
329
|
-
{ cmd: '/models', desc: 'Show available AI models by tier' },
|
|
330
|
-
{ cmd: '/balance', desc: 'Show provider usage balance' },
|
|
331
|
-
{ cmd: '/reset', desc: 'Reset current session' },
|
|
332
|
-
{ cmd: '/quit or /exit', desc: 'Exit Cortex' }
|
|
333
|
-
];
|
|
334
|
-
|
|
335
|
-
for (const { cmd, desc } of commands) {
|
|
336
|
-
console.log(` ${fmt.cyan(cmd.padEnd(15))} ${fmt.dim('—')} ${desc}`);
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
console.log('');
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
* Display current session status
|
|
344
|
-
*/
|
|
345
|
-
function displaySessionStatus() {
|
|
346
|
-
console.log('\n' + fmt.bold('📊 Session Status:'));
|
|
347
|
-
console.log(separator(50, '─'));
|
|
348
|
-
|
|
349
|
-
console.log(` ${fmt.dim('Messages:')} ${fmt.bold('12')} exchanges`);
|
|
350
|
-
console.log(` ${fmt.dim('Duration:')} ${fmt.bold('8m 23s')}`);
|
|
351
|
-
console.log(` ${fmt.dim('Models used:')} Worker: 3, IC: 7, Manager: 2`);
|
|
352
|
-
console.log(` ${fmt.dim('Last activity:')} ${fmt.bold('just now')}`);
|
|
353
|
-
console.log(` ${fmt.dim('Session ID:')} ${fmt.cyan('sess-abc123...')}`);
|
|
354
|
-
|
|
355
|
-
console.log('');
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
/**
|
|
359
|
-
* Display available models by tier
|
|
360
|
-
*/
|
|
361
|
-
function displayAvailableModels(models) {
|
|
362
|
-
console.log('\n' + fmt.bold('🤖 Available Models:'));
|
|
363
|
-
console.log(separator(50, '─'));
|
|
364
|
-
|
|
365
|
-
const tiers = [
|
|
366
|
-
{ name: 'MANAGER', key: 'manager', icon: tier.manager, color: fmt.red },
|
|
367
|
-
{ name: 'IC', key: 'ic', icon: tier.ic, color: fmt.yellow },
|
|
368
|
-
{ name: 'WORKER', key: 'worker', icon: tier.worker, color: fmt.blue }
|
|
369
|
-
];
|
|
370
|
-
|
|
371
|
-
for (const tierInfo of tiers) {
|
|
372
|
-
const tierModels = models[tierInfo.key] || [];
|
|
373
|
-
console.log(`\n ${tierInfo.icon} ${tierInfo.color(fmt.bold(tierInfo.name))} (${tierModels.length} available)`);
|
|
374
|
-
|
|
375
|
-
for (const model of tierModels) {
|
|
376
|
-
const modelDisplay = `${model.provider}/${model.model}`;
|
|
377
|
-
console.log(` ${fmt.dim('├─')} ${fmt.formatModel(model.provider, model.model)}`);
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
if (tierModels.length === 0) {
|
|
381
|
-
console.log(` ${fmt.dim('└─')} ${fmt.red('No models available')}`);
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
console.log('');
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
/**
|
|
389
|
-
* Display provider balance (mock for now)
|
|
390
|
-
*/
|
|
391
|
-
function displayProviderBalance() {
|
|
392
|
-
console.log('\n' + fmt.bold('⚖️ Provider Balance:'));
|
|
393
|
-
console.log(separator(50, '─'));
|
|
394
|
-
|
|
395
|
-
console.log(` ${fmt.providerBalanceBar(45, 55)}`);
|
|
396
|
-
console.log(` ${fmt.dim('Total calls today:')} ${fmt.bold('23')}`);
|
|
397
|
-
console.log(` ${fmt.dim('Status:')} ${fmt.green('Well balanced')}`);
|
|
398
|
-
|
|
399
|
-
console.log('');
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
/**
|
|
403
|
-
* Enhanced session resume display
|
|
404
|
-
*/
|
|
405
|
-
function displaySessionResume() {
|
|
406
|
-
// Mock session data - would come from actual session state
|
|
407
|
-
const sessionActive = Math.random() > 0.5;
|
|
408
|
-
|
|
409
|
-
if (sessionActive) {
|
|
410
|
-
console.log(`\n${sessionIcons.active} ${fmt.cyan('Resuming active session')}`);
|
|
411
|
-
console.log(` ${fmt.dim('Messages:')} 8 exchanges • ${fmt.dim('Duration:')} 5m 12s`);
|
|
412
|
-
console.log(` ${fmt.dim('Last:')} "Fix the authentication bug in login.ts"`);
|
|
413
|
-
} else {
|
|
414
|
-
console.log(`\n${sessionIcons.new} ${fmt.green('Starting fresh session')}`);
|
|
415
|
-
console.log(` ${fmt.dim('AI orchestration ready for your requests')}`);
|
|
416
|
-
}
|
|
417
|
-
}
|