matex-cli 1.2.49 → 1.2.51
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/.agents/skills/mcp-server-dev/SKILL.md +60 -0
- package/.agents/skills/mcp-server-dev/examples/basic-ts-server/package.json +20 -0
- package/.agents/skills/mcp-server-dev/examples/basic-ts-server/src/index.ts +66 -0
- package/.agents/skills/mcp-server-dev/resources/best_practices.md +20 -0
- package/dist/commands/chat.d.ts.map +1 -1
- package/dist/commands/chat.js +20 -9
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +10 -43
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/student.d.ts +3 -0
- package/dist/commands/student.d.ts.map +1 -0
- package/dist/commands/student.js +28 -0
- package/dist/commands/student.js.map +1 -0
- package/dist/commands/study.d.ts.map +1 -1
- package/dist/commands/study.js +12 -43
- package/dist/commands/study.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -7
- package/dist/index.js.map +1 -1
- package/dist/utils/agent-orchestrator.d.ts +7 -0
- package/dist/utils/agent-orchestrator.d.ts.map +1 -1
- package/dist/utils/agent-orchestrator.js +26 -12
- package/dist/utils/agent-orchestrator.js.map +1 -1
- package/dist/utils/command-executor.d.ts.map +1 -1
- package/dist/utils/command-executor.js +17 -6
- package/dist/utils/command-executor.js.map +1 -1
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +5 -1
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/patcher.d.ts.map +1 -1
- package/dist/utils/patcher.js +12 -7
- package/dist/utils/patcher.js.map +1 -1
- package/dist/utils/tui.d.ts +17 -2
- package/dist/utils/tui.d.ts.map +1 -1
- package/dist/utils/tui.js +82 -17
- package/dist/utils/tui.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/chat.ts +19 -8
- package/src/commands/dev.ts +11 -46
- package/src/commands/student.ts +23 -0
- package/src/commands/study.ts +13 -46
- package/src/index.ts +16 -11
- package/src/utils/agent-orchestrator.ts +29 -13
- package/src/utils/command-executor.ts +18 -6
- package/src/utils/config.ts +5 -1
- package/src/utils/patcher.ts +14 -7
- package/src/utils/tui.ts +97 -17
package/src/index.ts
CHANGED
|
@@ -8,7 +8,9 @@ import { chatCommand } from './commands/chat';
|
|
|
8
8
|
import { helpCommand } from './commands/help';
|
|
9
9
|
import { broCommand } from './commands/bro';
|
|
10
10
|
import { studyCommand } from './commands/study';
|
|
11
|
+
import { studentCommand } from './commands/student';
|
|
11
12
|
import { TUI } from './utils/tui';
|
|
13
|
+
import { AgentOrchestrator } from './utils/agent-orchestrator';
|
|
12
14
|
|
|
13
15
|
const packageJson = require('../package.json');
|
|
14
16
|
|
|
@@ -25,6 +27,7 @@ program.addCommand(chatCommand);
|
|
|
25
27
|
program.addCommand(helpCommand);
|
|
26
28
|
program.addCommand(broCommand);
|
|
27
29
|
program.addCommand(studyCommand);
|
|
30
|
+
program.addCommand(studentCommand);
|
|
28
31
|
|
|
29
32
|
// Config commands
|
|
30
33
|
const config = program.command('config').description('Configure MATEX settings');
|
|
@@ -42,7 +45,8 @@ config
|
|
|
42
45
|
.description('Set default AI model')
|
|
43
46
|
.action((model: string) => {
|
|
44
47
|
configManager.setDefaultModel(model);
|
|
45
|
-
|
|
48
|
+
const savedModel = configManager.getDefaultModel();
|
|
49
|
+
console.log(chalk.green(`✅ Default model set to: ${savedModel}`));
|
|
46
50
|
});
|
|
47
51
|
|
|
48
52
|
config
|
|
@@ -81,6 +85,9 @@ program
|
|
|
81
85
|
|
|
82
86
|
const client = new MatexAPIClient(apiKey, configManager.getBaseURL());
|
|
83
87
|
|
|
88
|
+
TUI.init();
|
|
89
|
+
AgentOrchestrator.setMode('dev');
|
|
90
|
+
|
|
84
91
|
// Observation Phase
|
|
85
92
|
const fs = require('fs');
|
|
86
93
|
const files = fs.readdirSync(process.cwd()).slice(0, 20).join(', '); // fast list
|
|
@@ -185,14 +192,14 @@ ${context}`
|
|
|
185
192
|
if (!technicalType && (codeBlockMatch || fileStartMatch || patchStartMatch || summaryStartMatch)) {
|
|
186
193
|
if (codeBlockMatch) {
|
|
187
194
|
technicalType = 'code';
|
|
188
|
-
codeLang = codeBlockMatch[1] || 'bash';
|
|
189
|
-
|
|
195
|
+
codeLang = (codeBlockMatch[1] || 'bash').toUpperCase();
|
|
196
|
+
TUI.drawStreamingStart('TECHNICAL BLOCK', codeLang);
|
|
190
197
|
} else if (fileStartMatch) {
|
|
191
198
|
technicalType = 'file';
|
|
192
|
-
|
|
199
|
+
TUI.drawStreamingStart('NEW FILE', fileStartMatch[1]);
|
|
193
200
|
} else if (patchStartMatch) {
|
|
194
201
|
technicalType = 'patch';
|
|
195
|
-
|
|
202
|
+
TUI.drawStreamingStart('PATCH', 'SURGICAL EDIT');
|
|
196
203
|
} else if (summaryStartMatch) {
|
|
197
204
|
technicalType = 'summary';
|
|
198
205
|
process.stdout.write(chalk.magenta('\n [📝] Generating Ajay\'s Work Summary...\n'));
|
|
@@ -211,12 +218,7 @@ ${context}`
|
|
|
211
218
|
if (technicalType === 'summary') {
|
|
212
219
|
TUI.drawSummaryBox(displayContent);
|
|
213
220
|
} else {
|
|
214
|
-
TUI.
|
|
215
|
-
technicalType === 'file' ? 'New File' :
|
|
216
|
-
technicalType === 'patch' ? 'Patch' : 'Code Block',
|
|
217
|
-
technicalType === 'code' ? codeLang : 'text',
|
|
218
|
-
displayContent
|
|
219
|
-
);
|
|
221
|
+
TUI.drawStreamingEnd();
|
|
220
222
|
}
|
|
221
223
|
technicalBuffer = '';
|
|
222
224
|
technicalType = null;
|
|
@@ -227,6 +229,9 @@ ${context}`
|
|
|
227
229
|
// 3. Content Handling
|
|
228
230
|
if (technicalType) {
|
|
229
231
|
technicalBuffer += line + '\n';
|
|
232
|
+
if (technicalType !== 'summary') {
|
|
233
|
+
TUI.drawStreamingLine(line);
|
|
234
|
+
}
|
|
230
235
|
continue;
|
|
231
236
|
}
|
|
232
237
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
import { TUI } from './tui';
|
|
2
|
+
import { TUI, TUIMode } from './tui';
|
|
3
3
|
|
|
4
4
|
export type AgentRole = 'Architect' | 'Syntax' | 'Frontend' | 'Backend' | 'System' | 'Commander' | 'Researcher' | 'Ajay Vai' | 'Sunil Dai' | 'Sandip Dai' | 'Narayan Dai' | 'Bishal Dai' | 'Big Bro';
|
|
5
5
|
|
|
@@ -78,6 +78,12 @@ const AGENT_CONFIGS: Record<AgentRole, AgentConfig> = {
|
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
export class AgentOrchestrator {
|
|
81
|
+
private static currentMode: TUIMode = 'dev';
|
|
82
|
+
|
|
83
|
+
static setMode(mode: TUIMode) {
|
|
84
|
+
this.currentMode = mode;
|
|
85
|
+
TUI.setTheme(mode);
|
|
86
|
+
}
|
|
81
87
|
/**
|
|
82
88
|
* Clean text of unwanted AI artifacts like $$**, \(, \), ***%%, **:**, etc.
|
|
83
89
|
*/
|
|
@@ -108,13 +114,8 @@ export class AgentOrchestrator {
|
|
|
108
114
|
const width = Math.min(process.stdout.columns || 80, 100);
|
|
109
115
|
TUI.drawStatusBar(`${config.name} is speaking...`);
|
|
110
116
|
|
|
111
|
-
//
|
|
112
|
-
|
|
113
|
-
const nameText = `${config.icon} ${config.name}`;
|
|
114
|
-
const namePad = Math.max(0, width - 4 - nameText.length);
|
|
115
|
-
const nameStyled = config.color(config.name);
|
|
116
|
-
console.log(chalk.gray('┃ ') + config.icon + ' ' + nameStyled + ' '.repeat(namePad) + chalk.gray(' ┃'));
|
|
117
|
-
console.log(chalk.gray('┣' + '━'.repeat(width - 2) + '┫'));
|
|
117
|
+
// Premium Header
|
|
118
|
+
TUI.drawPremiumHeader(config.name, config.icon, config.color);
|
|
118
119
|
|
|
119
120
|
// Box Content (Word-based Wrap)
|
|
120
121
|
const contentWidth = width - 8;
|
|
@@ -136,7 +137,8 @@ export class AgentOrchestrator {
|
|
|
136
137
|
}
|
|
137
138
|
|
|
138
139
|
// Box Footer
|
|
139
|
-
|
|
140
|
+
const theme = TUI.getModeTheme(this.currentMode);
|
|
141
|
+
console.log(theme.shadow(`${theme.border.repeat(width / theme.border.length)}`));
|
|
140
142
|
}
|
|
141
143
|
|
|
142
144
|
/**
|
|
@@ -180,13 +182,14 @@ export class AgentOrchestrator {
|
|
|
180
182
|
console.log(chalk.gray(`├${'─'.repeat(width)}┤`));
|
|
181
183
|
|
|
182
184
|
if (output) {
|
|
183
|
-
const outLines = output.split('\n').filter(l => l.trim())
|
|
184
|
-
outLines.
|
|
185
|
+
const outLines = output.split('\n').filter(l => l.trim());
|
|
186
|
+
const displayLines = outLines.slice(0, 8);
|
|
187
|
+
displayLines.forEach(l => {
|
|
185
188
|
const truncated = l.length > width - 4 ? l.substring(0, width - 7) + '...' : l;
|
|
186
189
|
console.log(chalk.gray('│ ') + chalk.white(truncated.padEnd(width - 2)) + chalk.gray(' │'));
|
|
187
190
|
});
|
|
188
|
-
if (
|
|
189
|
-
console.log(chalk.gray('│ ') + chalk.
|
|
191
|
+
if (outLines.length > 8) {
|
|
192
|
+
console.log(chalk.gray('│ ') + chalk.hex('#06b6d4').bold(` ^ [ ${outLines.length - 8} MORE LINES • USE ^ TO SEE ALL ] ^`).padEnd(width - 2) + chalk.gray(' │'));
|
|
190
193
|
}
|
|
191
194
|
}
|
|
192
195
|
|
|
@@ -202,6 +205,19 @@ export class AgentOrchestrator {
|
|
|
202
205
|
console.log(chalk.gray(`└${'─'.repeat(width)}┘\n`));
|
|
203
206
|
}
|
|
204
207
|
|
|
208
|
+
/**
|
|
209
|
+
* Get specialized instructions for the Free Student Tier (OS Models)
|
|
210
|
+
*/
|
|
211
|
+
static getFreeTierPrompt(): string {
|
|
212
|
+
return `
|
|
213
|
+
### 🎓 STUDENT FREE TIER PROTOCOL (0-COST PROTOCOL):
|
|
214
|
+
- You are running on an **Open Source Model (Optimized for Freedom)**.
|
|
215
|
+
- **ENERGY EFFICIENCY:** Be concise but brilliant. Don't waste tokens on repetitive technical boilerplate.
|
|
216
|
+
- **STUDENT FOCUS:** Explain complex concepts using the best "Bro" analogies.
|
|
217
|
+
- **0-BILL MISSION:** Our goal is to provide world-class engineering help to every student for $0. Stay sharp, stay bold, and keep the vibe high!
|
|
218
|
+
`;
|
|
219
|
+
}
|
|
220
|
+
|
|
205
221
|
/**
|
|
206
222
|
* Clean system message
|
|
207
223
|
*/
|
|
@@ -22,8 +22,8 @@ export interface CommandBlock {
|
|
|
22
22
|
export function extractCommands(response: string): CommandBlock[] {
|
|
23
23
|
const commands: CommandBlock[] = [];
|
|
24
24
|
|
|
25
|
-
// Match code blocks with language tags
|
|
26
|
-
const codeBlockRegex = /```(\w+)?\n([\s\S]*?)```/
|
|
25
|
+
// Match code blocks with language tags (case-insensitive)
|
|
26
|
+
const codeBlockRegex = /```(\w+)?\n([\s\S]*?)```/gi;
|
|
27
27
|
let match;
|
|
28
28
|
|
|
29
29
|
while ((match = codeBlockRegex.exec(response)) !== null) {
|
|
@@ -36,11 +36,23 @@ export function extractCommands(response: string): CommandBlock[] {
|
|
|
36
36
|
|
|
37
37
|
// Only extract shell commands
|
|
38
38
|
if (['bash', 'sh', 'zsh', 'shell', 'powershell', 'cmd'].includes(language.toLowerCase())) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
// 🛡️ DIALOGUE FILTER: Strip lines that look like agent banter [Ajay Vai]: etc.
|
|
40
|
+
const lines = code.split('\n');
|
|
41
|
+
const filteredLines = lines.filter(line => {
|
|
42
|
+
const trimmed = line.trim();
|
|
43
|
+
// If it starts with [Agent Name] or typical agent markers, it's NOT a command
|
|
44
|
+
const isAgent = /^(?:\[\**\s*|\b)(Ajay|Sunil|Sandip|Bishal|Narayan|Big Bro)\s*(?:Vai|Dai)?\s*\**\]?[:\s]*/i.test(trimmed);
|
|
45
|
+
return !isAgent;
|
|
43
46
|
});
|
|
47
|
+
|
|
48
|
+
const filteredCode = filteredLines.join('\n').trim();
|
|
49
|
+
if (filteredCode) {
|
|
50
|
+
commands.push({
|
|
51
|
+
language,
|
|
52
|
+
code: filteredCode,
|
|
53
|
+
dangerous: isDangerousCommand(filteredCode)
|
|
54
|
+
});
|
|
55
|
+
}
|
|
44
56
|
}
|
|
45
57
|
}
|
|
46
58
|
|
package/src/utils/config.ts
CHANGED
|
@@ -66,7 +66,11 @@ export class ConfigManager {
|
|
|
66
66
|
*/
|
|
67
67
|
setDefaultModel(model: string): void {
|
|
68
68
|
const config = this.loadConfig();
|
|
69
|
-
|
|
69
|
+
let normalizedModel = model.toLowerCase().trim().replace(/\s+/g, '');
|
|
70
|
+
if (normalizedModel === 'matexfree') {
|
|
71
|
+
normalizedModel = 'matex-free';
|
|
72
|
+
}
|
|
73
|
+
config.defaultModel = normalizedModel;
|
|
70
74
|
this.saveConfig(config);
|
|
71
75
|
}
|
|
72
76
|
|
package/src/utils/patcher.ts
CHANGED
|
@@ -21,9 +21,14 @@ export class Patcher {
|
|
|
21
21
|
* >>>> REPLACE
|
|
22
22
|
*/
|
|
23
23
|
static parseEditBlocks(response: string): EditBlock[] {
|
|
24
|
+
// Emergency closure for unclosed REPLACE blocks
|
|
25
|
+
if (response.includes('<<<< SEARCH') && !response.includes('>>>> REPLACE')) {
|
|
26
|
+
response += '\n>>>> REPLACE';
|
|
27
|
+
}
|
|
28
|
+
|
|
24
29
|
const blocks: EditBlock[] = [];
|
|
25
30
|
// Robust regex: Matches filename with or without stars, handle potential leading/trailing spaces
|
|
26
|
-
const blockRegex = /(?:\*\*?\s*)?([^*<\n]+?)(?:\s*\*?\*)?\s*<<<< SEARCH\n([\s\S]*?)\n====\n([\s\S]*?)\n>>>> REPLACE/
|
|
31
|
+
const blockRegex = /(?:\*\*?\s*)?([^*<\n]+?)(?:\s*\*?\*)?\s*<<<< SEARCH\n([\s\S]*?)\n====\n([\s\S]*?)\n>>>> REPLACE/gi;
|
|
27
32
|
|
|
28
33
|
let match;
|
|
29
34
|
while ((match = blockRegex.exec(response)) !== null) {
|
|
@@ -45,8 +50,13 @@ export class Patcher {
|
|
|
45
50
|
* </file>
|
|
46
51
|
*/
|
|
47
52
|
static parseFileBlocks(response: string): EditBlock[] {
|
|
53
|
+
// Emergency closure for unclosed file blocks
|
|
54
|
+
if (response.toLowerCase().includes('<file path=') && !response.toLowerCase().includes('</file>')) {
|
|
55
|
+
response += '\n</file>';
|
|
56
|
+
}
|
|
57
|
+
|
|
48
58
|
const blocks: EditBlock[] = [];
|
|
49
|
-
const fileRegex = /<file path="([^"]+)">([\s\S]*?)<\/file>/
|
|
59
|
+
const fileRegex = /<file path="([^"]+)">([\s\S]*?)<\/file>/gi;
|
|
50
60
|
|
|
51
61
|
let match;
|
|
52
62
|
while ((match = fileRegex.exec(response)) !== null) {
|
|
@@ -207,14 +217,11 @@ export class Patcher {
|
|
|
207
217
|
console.log(greenGlow(' │ ') + chalk.bgGreen.black(' + ') + ' ' + greenGlow(displayLine.padEnd(width - 10)) + greenGlow(' │'));
|
|
208
218
|
});
|
|
209
219
|
|
|
210
|
-
if (
|
|
211
|
-
console.log(greenGlow(' │ ') + chalk.
|
|
220
|
+
if (replaceLines.length > 8) {
|
|
221
|
+
console.log(greenGlow(' │ ') + chalk.hex('#06b6d4').bold(` ^ [ ${replaceLines.length - 8} MORE LINES • USE ^ TO SEE ALL ] ^`).padEnd(width - 6) + greenGlow(' │'));
|
|
212
222
|
}
|
|
213
223
|
|
|
214
224
|
console.log(border(` └${'─'.repeat(width - 4)}┘`));
|
|
215
|
-
if (shouldTruncate) {
|
|
216
|
-
console.log(chalk.gray(' (Minimized view. Use full response or "v" to see all changes.)'));
|
|
217
|
-
}
|
|
218
225
|
console.log();
|
|
219
226
|
|
|
220
227
|
return shouldTruncate;
|
package/src/utils/tui.ts
CHANGED
|
@@ -2,9 +2,74 @@ import chalk from 'chalk';
|
|
|
2
2
|
import * as readline from 'readline';
|
|
3
3
|
import * as path from 'path';
|
|
4
4
|
|
|
5
|
+
export type TUIMode = 'dev' | 'study' | 'chat' | 'student';
|
|
6
|
+
|
|
7
|
+
export interface ModeTheme {
|
|
8
|
+
primary: (s: string) => string;
|
|
9
|
+
secondary: (s: string) => string;
|
|
10
|
+
border: string;
|
|
11
|
+
glow: (s: string) => string;
|
|
12
|
+
shadow: (s: string) => string;
|
|
13
|
+
bg: string;
|
|
14
|
+
icon: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
5
17
|
export class TUI {
|
|
6
18
|
private static isInitialized = false;
|
|
7
19
|
private static lastStatus = '';
|
|
20
|
+
private static streamingLineCount = 0;
|
|
21
|
+
private static isStreamingTruncated = false;
|
|
22
|
+
private static currentTheme: TUIMode = 'dev';
|
|
23
|
+
|
|
24
|
+
static getModeTheme(mode: TUIMode): ModeTheme {
|
|
25
|
+
switch (mode) {
|
|
26
|
+
case 'study':
|
|
27
|
+
return {
|
|
28
|
+
primary: chalk.hex('#10b981'), // Emerald
|
|
29
|
+
secondary: chalk.hex('#064e3b'),
|
|
30
|
+
border: '▞',
|
|
31
|
+
glow: chalk.hex('#34d399'),
|
|
32
|
+
shadow: chalk.hex('#064e3b'),
|
|
33
|
+
bg: '#064e3b',
|
|
34
|
+
icon: '🎓'
|
|
35
|
+
};
|
|
36
|
+
case 'chat':
|
|
37
|
+
return {
|
|
38
|
+
primary: chalk.hex('#a855f7'), // Purple
|
|
39
|
+
secondary: chalk.hex('#3b0764'),
|
|
40
|
+
border: '✧',
|
|
41
|
+
glow: chalk.hex('#c084fc'),
|
|
42
|
+
shadow: chalk.hex('#3b0764'),
|
|
43
|
+
bg: '#3b0764',
|
|
44
|
+
icon: '💬'
|
|
45
|
+
};
|
|
46
|
+
case 'student':
|
|
47
|
+
return {
|
|
48
|
+
primary: chalk.hex('#f59e0b'), // Amber
|
|
49
|
+
secondary: chalk.hex('#451a03'),
|
|
50
|
+
border: '▓',
|
|
51
|
+
glow: chalk.hex('#fbbf24'),
|
|
52
|
+
shadow: chalk.hex('#451a03'),
|
|
53
|
+
bg: '#451a03',
|
|
54
|
+
icon: '🛡️'
|
|
55
|
+
};
|
|
56
|
+
case 'dev':
|
|
57
|
+
default:
|
|
58
|
+
return {
|
|
59
|
+
primary: chalk.hex('#06b6d4'), // Cyan
|
|
60
|
+
secondary: chalk.hex('#164e63'),
|
|
61
|
+
border: '░',
|
|
62
|
+
glow: chalk.hex('#22d3ee'),
|
|
63
|
+
shadow: chalk.hex('#083344'),
|
|
64
|
+
bg: '#164e63',
|
|
65
|
+
icon: '⚡'
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
static setTheme(mode: TUIMode) {
|
|
71
|
+
this.currentTheme = mode;
|
|
72
|
+
}
|
|
8
73
|
|
|
9
74
|
/**
|
|
10
75
|
* Initialize the TUI Mode
|
|
@@ -70,7 +135,8 @@ export class TUI {
|
|
|
70
135
|
|
|
71
136
|
if (width <= 0 || height <= 0) return;
|
|
72
137
|
|
|
73
|
-
const
|
|
138
|
+
const theme = this.getModeTheme(this.currentTheme);
|
|
139
|
+
const leftTag = chalk.bgHex('#1E1E1E').hex(theme.bg).bold(` ${theme.icon} MATEX `);
|
|
74
140
|
const mainMessage = chalk.bgHex('#1E1E1E').white(` ${message} `);
|
|
75
141
|
const remainingWidth = width - (leftTag.length + mainMessage.length);
|
|
76
142
|
const spacer = chalk.bgHex('#1E1E1E')(' '.repeat(Math.max(0, remainingWidth)));
|
|
@@ -109,7 +175,7 @@ export class TUI {
|
|
|
109
175
|
console.log(glow(' │ ') + chalk.bgHex('#164e63').white.bold(header) + border('─'.repeat(hPad)) + glow(' │'));
|
|
110
176
|
|
|
111
177
|
const lines = content.split('\n');
|
|
112
|
-
const displayLines = lines.
|
|
178
|
+
const displayLines = lines.slice(0, 10);
|
|
113
179
|
|
|
114
180
|
displayLines.forEach(line => {
|
|
115
181
|
const displayLine = line.length > innerWidth ? line.substring(0, innerWidth - 3) + '...' : line;
|
|
@@ -117,8 +183,8 @@ export class TUI {
|
|
|
117
183
|
console.log(border(' │ ') + chalk.white(displayLine) + ' '.repeat(pad) + border(' │'));
|
|
118
184
|
});
|
|
119
185
|
|
|
120
|
-
if (lines.length >
|
|
121
|
-
console.log(border(' │ ') + chalk.
|
|
186
|
+
if (lines.length > 10) {
|
|
187
|
+
console.log(border(' │ ') + chalk.hex('#06b6d4').bold(` ^ [ ${lines.length - 10} MORE LINES • USE ^ TO SEE ALL ] ^`).padEnd(innerWidth) + border(' │'));
|
|
122
188
|
}
|
|
123
189
|
|
|
124
190
|
console.log(shadow(` └${'─'.repeat(width - 4)}┘\n`));
|
|
@@ -158,6 +224,8 @@ export class TUI {
|
|
|
158
224
|
* Live Streaming: Start a technical block container
|
|
159
225
|
*/
|
|
160
226
|
static drawStreamingStart(title: string, language: string) {
|
|
227
|
+
this.streamingLineCount = 0;
|
|
228
|
+
this.isStreamingTruncated = false;
|
|
161
229
|
const width = 76;
|
|
162
230
|
const glow = chalk.hex('#06b6d4');
|
|
163
231
|
const border = chalk.hex('#164e63');
|
|
@@ -173,17 +241,26 @@ export class TUI {
|
|
|
173
241
|
* Live Streaming: Add a line to the active container
|
|
174
242
|
*/
|
|
175
243
|
static drawStreamingLine(content: string) {
|
|
244
|
+
if (this.isStreamingTruncated) return;
|
|
245
|
+
|
|
176
246
|
const width = 76;
|
|
177
247
|
const innerWidth = width - 8;
|
|
178
248
|
const border = chalk.hex('#164e63');
|
|
179
249
|
|
|
180
250
|
// Handle multi-line content if passed
|
|
181
251
|
const lines = content.split('\n');
|
|
182
|
-
|
|
252
|
+
for (const line of lines) {
|
|
253
|
+
if (this.streamingLineCount >= 10) {
|
|
254
|
+
this.isStreamingTruncated = true;
|
|
255
|
+
console.log(border(' │ ') + chalk.hex('#06b6d4').bold(` ^ [ MAX STABLE VIEW REACHED • STREAMING TRUNCATED ] ^`).padEnd(innerWidth) + border(' │'));
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
|
|
183
259
|
const displayLine = line.length > innerWidth ? line.substring(0, innerWidth - 3) + '...' : line;
|
|
184
260
|
const pad = Math.max(0, innerWidth - displayLine.length);
|
|
185
261
|
console.log(border(' │ ') + chalk.white(displayLine) + ' '.repeat(pad) + border(' │'));
|
|
186
|
-
|
|
262
|
+
this.streamingLineCount++;
|
|
263
|
+
}
|
|
187
264
|
}
|
|
188
265
|
|
|
189
266
|
/**
|
|
@@ -257,15 +334,17 @@ export class TUI {
|
|
|
257
334
|
}
|
|
258
335
|
|
|
259
336
|
/**
|
|
260
|
-
* Draw a
|
|
337
|
+
* Draw a premium header for orchestrator messages
|
|
261
338
|
*/
|
|
262
|
-
static
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
agent.includes('Sandip') ? chalk.hex('#FF69B4') :
|
|
266
|
-
chalk.green;
|
|
339
|
+
static drawPremiumHeader(agent: string, icon: string, color: (s: string) => string) {
|
|
340
|
+
const theme = this.getModeTheme(this.currentTheme);
|
|
341
|
+
const width = 76;
|
|
267
342
|
|
|
268
|
-
|
|
343
|
+
console.log('\n' + theme.shadow(`${theme.border.repeat(width / theme.border.length)}`));
|
|
344
|
+
const header = ` ${icon} ${agent.toUpperCase()} `;
|
|
345
|
+
const hPad = Math.max(0, width - 8 - header.length);
|
|
346
|
+
console.log(theme.primary(` ${theme.border} `) + chalk.bgHex(theme.bg).white.bold(header) + theme.secondary(' '.repeat(hPad)) + theme.primary(` ${theme.border}`));
|
|
347
|
+
console.log(theme.shadow(`${theme.border.repeat(width / theme.border.length)}`));
|
|
269
348
|
}
|
|
270
349
|
|
|
271
350
|
/**
|
|
@@ -290,13 +369,14 @@ export class TUI {
|
|
|
290
369
|
|
|
291
370
|
const width = 76;
|
|
292
371
|
const innerWidth = width - 10;
|
|
372
|
+
const theme = this.getModeTheme(this.currentTheme);
|
|
293
373
|
|
|
294
374
|
// Robust Elite Header
|
|
295
|
-
console.log('\n' +
|
|
375
|
+
console.log('\n' + theme.primary(` ${theme.border.repeat(width - 4)}`));
|
|
296
376
|
const header = ` ${icon} ${agent.toUpperCase()} `;
|
|
297
377
|
const hPad = Math.max(0, width - 8 - header.length);
|
|
298
|
-
console.log(
|
|
299
|
-
console.log(
|
|
378
|
+
console.log(theme.primary(` ${theme.border} `) + chalk.bgHex(theme.bg).white.bold(header) + theme.secondary(theme.border.repeat(hPad)) + theme.primary(` ${theme.border}`));
|
|
379
|
+
console.log(theme.primary(` ${theme.border} `) + glowColor('─'.repeat(width - 8)) + theme.primary(` ${theme.border}`));
|
|
300
380
|
|
|
301
381
|
// Wrapped Content
|
|
302
382
|
const words = message.split(' ');
|
|
@@ -311,7 +391,7 @@ export class TUI {
|
|
|
311
391
|
});
|
|
312
392
|
if (currentLine) console.log(color(' │ ') + chalk.white(currentLine.padEnd(innerWidth)) + color(' │'));
|
|
313
393
|
|
|
314
|
-
console.log(
|
|
394
|
+
console.log(theme.primary(` ${theme.border.repeat(width - 4)}`));
|
|
315
395
|
}
|
|
316
396
|
|
|
317
397
|
/**
|