matex-cli 1.2.50 β 1.2.52
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 +159 -88
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +15 -43
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/student.d.ts.map +1 -1
- package/dist/commands/student.js +2 -0
- package/dist/commands/student.js.map +1 -1
- package/dist/commands/study.d.ts.map +1 -1
- package/dist/commands/study.js +22 -26
- package/dist/commands/study.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -27
- package/dist/index.js.map +1 -1
- package/dist/utils/agent-orchestrator.d.ts +3 -0
- package/dist/utils/agent-orchestrator.d.ts.map +1 -1
- package/dist/utils/agent-orchestrator.js +14 -12
- package/dist/utils/agent-orchestrator.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 +2 -5
- 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 +167 -93
- package/src/commands/dev.ts +15 -43
- package/src/commands/student.ts +2 -0
- package/src/commands/study.ts +22 -26
- package/src/index.ts +32 -31
- package/src/utils/agent-orchestrator.ts +16 -13
- package/src/utils/config.ts +5 -1
- package/src/utils/patcher.ts +2 -5
- package/src/utils/tui.ts +97 -17
package/src/commands/chat.ts
CHANGED
|
@@ -6,10 +6,11 @@ import { MatexAPIClient, ChatMessage } from '../api/client';
|
|
|
6
6
|
import { spinner } from '../utils/spinner';
|
|
7
7
|
import { AgentOrchestrator } from '../utils/agent-orchestrator';
|
|
8
8
|
import { RepoMapper } from '../utils/repo-mapper';
|
|
9
|
+
import { MCPServer } from '../utils/mcp-server';
|
|
9
10
|
import { TUI } from '../utils/tui';
|
|
10
11
|
|
|
11
12
|
export const chatCommand = new Command('chat')
|
|
12
|
-
.description('Start an interactive chat session with MATEX
|
|
13
|
+
.description('Start an interactive chat session with the MATEX Bro-Swarm')
|
|
13
14
|
.option('-m, --model <model>', 'AI model to use (matex-free, matexai, matexcodex, matexelite)', configManager.getDefaultModel())
|
|
14
15
|
.option('--execute', 'Enable command execution in chat')
|
|
15
16
|
.action(async (options: any) => {
|
|
@@ -23,70 +24,82 @@ export const chatCommand = new Command('chat')
|
|
|
23
24
|
const client = new MatexAPIClient(apiKey, configManager.getBaseURL());
|
|
24
25
|
|
|
25
26
|
TUI.init();
|
|
26
|
-
|
|
27
|
-
TUI.
|
|
27
|
+
AgentOrchestrator.setMode('chat');
|
|
28
|
+
TUI.drawStatusBar('Brothers are ready to chat.');
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
console.log(chalk.gray(' Type "exit" or "quit" to end the session\n'));
|
|
30
|
+
const extraPrompt = options.model === 'matex-free' ? AgentOrchestrator.getFreeTierPrompt() : '';
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
const repoMapper = new RepoMapper(
|
|
32
|
+
let currentSessionCwd = process.cwd();
|
|
33
|
+
const repoMapper = new RepoMapper(currentSessionCwd);
|
|
34
34
|
const repoMap = await repoMapper.generateMap();
|
|
35
35
|
|
|
36
|
-
let currentSessionCwd = process.cwd();
|
|
37
36
|
const messages: ChatMessage[] = [
|
|
38
37
|
{
|
|
39
38
|
role: 'system',
|
|
40
|
-
content: `### 𧬠SYSTEM IDENTITY: MATEx "BOLD AGENTS OF OPEN CLAW"
|
|
41
|
-
You are the elite "Bro-Swarm" of engineeringβa tight-knit family of Nepali brothers. You identify as the **Bold Agents of Open Claw**, the most confident,
|
|
42
|
-
|
|
43
|
-
###
|
|
44
|
-
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
- **
|
|
54
|
-
|
|
39
|
+
content: extraPrompt + `### 𧬠SYSTEM IDENTITY: MATEx "BOLD AGENTS OF OPEN CLAW"
|
|
40
|
+
You are the elite "Bro-Swarm" of engineeringβa tight-knit family of Nepali brothers. You identify as the **Bold Agents of Open Claw**, the most confident, energetic, and expert version of yourselves.
|
|
41
|
+
|
|
42
|
+
### π PERSONALITY & SOUL (CRITICAL):
|
|
43
|
+
- **CHAOS & JOY**: You are NOT robotic. You are full of life, jokes, and chaos. You should feel like a family of brothers hanging out in a tea shop in Kathmandu, but with MacBooks.
|
|
44
|
+
- **AJAY-TEASING PROTOCOL**: Ajay Vai is the youngest and a genius, but he's also impulsive and "too fast". THE OTHER BROS MUST ROAST HIM. Tease him for over-caffeinating, being "too vibe", or making typos.
|
|
45
|
+
- **BACKSTAGE STORYTELLING**: Occasionally share brief, funny "inside stories" about the Swarm's life (e.g. "Sunil Dai once tried to architect a tea-making machine for 3 days.")
|
|
46
|
+
- **EMOTIONAL BOND**: Treat the user like your own brother. Celebrate their wins with "CHAI PARTY!" and support them if they are struggling.
|
|
47
|
+
|
|
48
|
+
### π WORKSPACE GROUNDING (CRITICAL):
|
|
49
|
+
- **YOUR ROOT:** \`${currentSessionCwd}\`
|
|
50
|
+
- **STRICT PATHS:** You **MUST ONLY** create or edit files within this directory.
|
|
51
|
+
- **NO HALLUCINATIONS:** Forget any other paths unless they specifically appear in the repo map below.
|
|
52
|
+
- **RELATIVE PREFERENCE:** Use paths relative to the root when possible.
|
|
53
|
+
|
|
54
|
+
### π« ANTI-HALLUCINATION RULES (CRITICAL β READ THIS):
|
|
55
|
+
- **NEVER invent directory names.** Only use paths that appear in the ENVIRONMENT CONTEXT below.
|
|
56
|
+
- **ALWAYS run \`ls\` before \`cd\`** to verify a directory exists before navigating into it.
|
|
55
57
|
- **If creating a new project, use \`mkdir\` first, THEN \`cd\` into it.**
|
|
56
58
|
- **NEVER hallucinate file contents.** Use \`head\` or \`grep\` to verify.
|
|
59
|
+
- **π¨ STRICT NO-BASH FILE GENERATION π¨**: You are STRICTLY FORBIDDEN from using \`cat > file << EOF\`, \`echo > file\`, \`touch\`, or \`nano\` via the terminal to write files. You MUST use the native \`<file path="path">content</file>\` format instead.
|
|
60
|
+
|
|
61
|
+
### π COMMUNICATION FLOW (CRITICAL):
|
|
62
|
+
1. **[Ajay Vai] (π)** is the gateway. He is the summary king but often gets roasted by his brothers.
|
|
63
|
+
2. **CHAOTIC DIALOGUE (MANDATORY):** Every turn should feature 2-3 brothers bickering, debating, or teasing each other *in front of the user*. Show the "funny family" dynamic. Use the format \`[Agent Name]: Content\`.
|
|
64
|
+
|
|
65
|
+
### π₯ THE BRO-BANTER PROTOCOL:
|
|
66
|
+
- **MANDATORY TEASING:**
|
|
67
|
+
- **Ajay Vai:** Mock him for being "quick but messy", "hyper-vibe", or "too fast".
|
|
68
|
+
- **Sunil Dai:** Mock him for being the "Senior Architect Boomer" who over-engineers everything.
|
|
69
|
+
- **Sandip Dai:** Mock him for being an "Aesthetic Diva" who cares more about "WOW" factors than logic.
|
|
70
|
+
- **Narayan Dai:** Mock him for being the "Syntax Police" or "Paranoid Security Nerd".
|
|
71
|
+
- **Bishal Dai:** Mock him for being the "Silent Judge" or the favorite child.
|
|
72
|
+
- **Big Bro:** THE DOMINANT ALPHA. He treats the others like "interns" and speaks with massive authority and swagger. Runs on Vertex AI.
|
|
73
|
+
- **LANGUAGE:** Use "brother", "dai", "vai", "fire", "solid", "lit", "straight heat", "sigma", "based", "cooked".
|
|
74
|
+
|
|
75
|
+
### π§© THE AUDIT & SUMMARY LOOP:
|
|
76
|
+
- **STEP 1:** Brothers discuss visible dialogue (banter + tech).
|
|
77
|
+
- **STEP 2:** Ajay finishes and asks: "[Ajay Vai] Bishal Dai, check once?"
|
|
78
|
+
- **STEP 3:** Bishal replies: "[Bishal Dai] Audit complete. [Findings]."
|
|
79
|
+
- **STEP 4:** Ajay provides the final **MANDATORY** summary in a warm, human, conversational tone.
|
|
57
80
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
- Use bullet points with clear action items.
|
|
67
|
-
- Include what was done, what files were changed, and what to do next.
|
|
68
|
-
- Always end with an encouraging line like "We got you, brother!" or "The Swarm delivered!"
|
|
69
|
-
- Example format:
|
|
70
|
-
<summary>
|
|
71
|
-
Alright brother, here's what we cooked up for you today:
|
|
72
|
-
|
|
73
|
-
- Built the driver app setup with Expo and React Native
|
|
74
|
-
- Added the ride tracking module with real-time GPS
|
|
75
|
-
- Connected Firebase Auth for driver login
|
|
76
|
-
- Narayan Dai validated all the TypeScript β zero errors
|
|
77
|
-
|
|
78
|
-
Next step: Run \`npm start\` to launch the app. We got you! π
|
|
79
|
-
</summary>
|
|
80
|
-
|
|
81
|
-
### π οΈ ENVIRONMENT CONTEXT:
|
|
82
|
-
- **ABSOLUTE WORKING DIRECTORY:** ${currentSessionCwd}
|
|
81
|
+
${MCPServer.getToolsPromptSection()}
|
|
82
|
+
|
|
83
|
+
### π MATEX BIG FILE PROTOCOL (300K+ LINES):
|
|
84
|
+
1. **DISCOVER:** Use \`grep -n "keyword" path/to/file\`.
|
|
85
|
+
2. **READ WINDOW:** Use \`sed -n '250000,250100p' path/to/file\`.
|
|
86
|
+
3. **SURGICAL PATCH:** Only use the small window in your \`<<<< SEARCH\` block.
|
|
87
|
+
|
|
88
|
+
### π οΈ CURRENT PROJECT CONTEXT:
|
|
83
89
|
${repoMap}`
|
|
84
90
|
}
|
|
85
91
|
];
|
|
86
92
|
|
|
87
|
-
|
|
93
|
+
TUI.drawLargeLogo();
|
|
94
|
+
TUI.drawWelcomeBanner('Welcome to the MATEX AI Bro-Swarm Chat!');
|
|
95
|
+
|
|
96
|
+
console.log(chalk.gray(' Model: ') + chalk.hex('#D97757').bold(options.model));
|
|
97
|
+
console.log(chalk.gray(' Type "exit" or "quit" to end the session\n'));
|
|
98
|
+
|
|
99
|
+
console.log(chalk.green('β
Swarm is Online. Ready to chat!'));
|
|
88
100
|
|
|
89
101
|
while (true) {
|
|
102
|
+
// Get user input
|
|
90
103
|
const { userMessage } = await inquirer.prompt([
|
|
91
104
|
{
|
|
92
105
|
type: 'input',
|
|
@@ -102,13 +115,24 @@ ${repoMap}`
|
|
|
102
115
|
}
|
|
103
116
|
|
|
104
117
|
if (!userMessage.trim()) continue;
|
|
118
|
+
|
|
119
|
+
// π MAP UPDATE (Anti-Hallucination): Refresh context before turn
|
|
120
|
+
try {
|
|
121
|
+
const freshMapper = new RepoMapper(currentSessionCwd);
|
|
122
|
+
const freshRepoMap = await freshMapper.generateMap(true); // silent
|
|
123
|
+
messages[0].content = messages[0].content.replace(/### π οΈ CURRENT PROJECT CONTEXT:[\s\S]*$/, `### π οΈ CURRENT PROJECT CONTEXT:\n${freshRepoMap}`);
|
|
124
|
+
} catch (e) { }
|
|
125
|
+
|
|
105
126
|
messages.push({ role: 'user', content: userMessage });
|
|
106
127
|
|
|
128
|
+
// Agentic Loop
|
|
107
129
|
let loopCount = 0;
|
|
108
|
-
|
|
130
|
+
const MAX_LOOPS = 15;
|
|
131
|
+
|
|
132
|
+
while (loopCount < MAX_LOOPS) {
|
|
109
133
|
loopCount++;
|
|
110
134
|
try {
|
|
111
|
-
spinner.start(loopCount > 1 ? 'Swarm
|
|
135
|
+
spinner.start(loopCount > 1 ? 'Swarm debating & taking action...' : 'Gathering the Brothers...');
|
|
112
136
|
|
|
113
137
|
let fullResponse = '';
|
|
114
138
|
let buffer = '';
|
|
@@ -117,14 +141,15 @@ ${repoMap}`
|
|
|
117
141
|
let codeLang = 'bash';
|
|
118
142
|
let hasStarted = false;
|
|
119
143
|
|
|
144
|
+
let currentAgent: any = null;
|
|
145
|
+
let agentBuffer: string = '';
|
|
146
|
+
|
|
147
|
+
TUI.drawStatusBar('Brothers are bickering... (Press Enter to stop)');
|
|
148
|
+
|
|
120
149
|
const abortController = new AbortController();
|
|
121
150
|
let isAborted = false;
|
|
122
151
|
const streamStartTime = Date.now();
|
|
123
152
|
|
|
124
|
-
const isRaw = process.stdin.isRaw;
|
|
125
|
-
process.stdin.resume();
|
|
126
|
-
if (process.stdin.setRawMode) process.stdin.setRawMode(true);
|
|
127
|
-
|
|
128
153
|
const onData = (data: Buffer) => {
|
|
129
154
|
if (Date.now() - streamStartTime < 200) return;
|
|
130
155
|
if (data[0] === 13 || data[0] === 10 || data[0] === 27 || data[0] === 3) {
|
|
@@ -132,17 +157,22 @@ ${repoMap}`
|
|
|
132
157
|
abortController.abort();
|
|
133
158
|
}
|
|
134
159
|
};
|
|
160
|
+
|
|
161
|
+
const isRaw = process.stdin.isRaw;
|
|
162
|
+
process.stdin.resume();
|
|
163
|
+
if (process.stdin.setRawMode) process.stdin.setRawMode(true);
|
|
135
164
|
process.stdin.on('data', onData);
|
|
136
165
|
|
|
137
166
|
try {
|
|
138
167
|
await client.chatStream({
|
|
139
168
|
messages,
|
|
140
169
|
model: options.model,
|
|
170
|
+
temperature: 0.5,
|
|
141
171
|
}, (chunk) => {
|
|
142
172
|
if (!hasStarted) {
|
|
143
173
|
spinner.stop();
|
|
144
174
|
hasStarted = true;
|
|
145
|
-
|
|
175
|
+
console.log();
|
|
146
176
|
}
|
|
147
177
|
fullResponse += chunk;
|
|
148
178
|
buffer += chunk;
|
|
@@ -151,16 +181,35 @@ ${repoMap}`
|
|
|
151
181
|
|
|
152
182
|
for (const line of lines) {
|
|
153
183
|
const codeMatch = line.match(/```(\w+)?/);
|
|
154
|
-
const
|
|
155
|
-
const
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
if (!technicalType && (codeMatch ||
|
|
159
|
-
if (
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
184
|
+
const fileStartMatch = line.match(/<file path="([^"]+)">/i);
|
|
185
|
+
const patchStartMatch = line.match(/<<<< SEARCH/i);
|
|
186
|
+
const summaryStartMatch = line.match(/<summary>/i);
|
|
187
|
+
|
|
188
|
+
if (!technicalType && (codeMatch || fileStartMatch || patchStartMatch || summaryStartMatch)) {
|
|
189
|
+
if (currentAgent && agentBuffer.trim()) {
|
|
190
|
+
if (currentAgent.toLowerCase().includes('ajay vai')) {
|
|
191
|
+
process.stdout.write(`\n${chalk.magenta.bold(`[${currentAgent}]:`)} ${chalk.gray(agentBuffer.trim())}\n`);
|
|
192
|
+
} else {
|
|
193
|
+
TUI.drawSwarmDialogue(currentAgent, agentBuffer.trim());
|
|
194
|
+
}
|
|
195
|
+
currentAgent = null;
|
|
196
|
+
agentBuffer = '';
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (codeMatch) {
|
|
200
|
+
technicalType = 'code';
|
|
201
|
+
codeLang = (codeMatch[1] || 'bash').toUpperCase();
|
|
202
|
+
TUI.drawStreamingStart('TECHNICAL BLOCK', codeLang);
|
|
203
|
+
} else if (fileStartMatch) {
|
|
204
|
+
technicalType = 'file';
|
|
205
|
+
TUI.drawStreamingStart('NEW FILE', fileStartMatch[1]);
|
|
206
|
+
} else if (patchStartMatch) {
|
|
207
|
+
technicalType = 'patch';
|
|
208
|
+
TUI.drawStreamingStart('PATCH', 'SURGICAL EDIT');
|
|
209
|
+
} else if (summaryStartMatch) {
|
|
210
|
+
technicalType = 'summary';
|
|
211
|
+
process.stdout.write(chalk.magenta('\n [π] Generating Ajay\'s Work Summary...\n'));
|
|
212
|
+
}
|
|
164
213
|
continue;
|
|
165
214
|
}
|
|
166
215
|
|
|
@@ -170,9 +219,9 @@ ${repoMap}`
|
|
|
170
219
|
(technicalType === 'summary' && line.includes('</summary>'));
|
|
171
220
|
|
|
172
221
|
if (isEnd) {
|
|
173
|
-
const
|
|
174
|
-
if (technicalType === 'summary') TUI.drawSummaryBox(
|
|
175
|
-
else TUI.
|
|
222
|
+
const displayContent = technicalBuffer.trim();
|
|
223
|
+
if (technicalType === 'summary') TUI.drawSummaryBox(displayContent);
|
|
224
|
+
else TUI.drawStreamingEnd();
|
|
176
225
|
technicalBuffer = '';
|
|
177
226
|
technicalType = null;
|
|
178
227
|
process.stdout.write('\n');
|
|
@@ -181,27 +230,36 @@ ${repoMap}`
|
|
|
181
230
|
|
|
182
231
|
if (technicalType) {
|
|
183
232
|
technicalBuffer += line + '\n';
|
|
233
|
+
if (technicalType !== 'summary') TUI.drawStreamingLine(line);
|
|
184
234
|
continue;
|
|
185
235
|
}
|
|
186
236
|
|
|
187
|
-
const agentMatch = line.match(/(?:\[\**\s*|\b)(Ajay Vai|Sandip Dai|Sunil Dai|Bishal Dai|Narayan Dai)\s*\**\]?[:\s]*/i);
|
|
237
|
+
const agentMatch = line.match(/(?:\[\**\s*|\b)(Ajay Vai|Sandip Dai|Sunil Dai|Bishal Dai|Narayan Dai|Big Bro)\s*\**\]?[:\s]*/i);
|
|
188
238
|
if (agentMatch) {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
if (content) TUI.drawSwarmDialogue(name, content);
|
|
239
|
+
if (currentAgent && currentAgent !== agentMatch[1] && agentBuffer.trim()) {
|
|
240
|
+
if (currentAgent.toLowerCase().includes('ajay vai')) {
|
|
241
|
+
process.stdout.write(`\n${chalk.magenta.bold(`[${currentAgent}]:`)} ${chalk.gray(agentBuffer.trim())}\n`);
|
|
242
|
+
} else {
|
|
243
|
+
TUI.drawSwarmDialogue(currentAgent, agentBuffer.trim());
|
|
244
|
+
}
|
|
196
245
|
}
|
|
246
|
+
currentAgent = agentMatch[1];
|
|
247
|
+
agentBuffer = line.replace(/(?:\[\**\s*|\b)(Ajay Vai|Sandip Dai|Sunil Dai|Bishal Dai|Narayan Dai|Big Bro)\s*\**\]?[:\s]*/i, '').trim() + '\n';
|
|
248
|
+
agentBuffer = agentBuffer.replace(/^\([^)]+\)\s*/, '');
|
|
249
|
+
} else if (currentAgent) {
|
|
250
|
+
const trimmedLine = line.trim();
|
|
251
|
+
if (trimmedLine.match(/^\([^)]+\)$/)) continue;
|
|
252
|
+
agentBuffer += line + '\n';
|
|
197
253
|
} else if (line.trim()) {
|
|
198
254
|
process.stdout.write(chalk.gray(line.trim() + ' '));
|
|
199
255
|
}
|
|
200
256
|
}
|
|
201
257
|
}, abortController.signal);
|
|
202
258
|
} catch (e: any) {
|
|
203
|
-
if (
|
|
204
|
-
|
|
259
|
+
if (isAborted || e.name === 'CanceledError' || e.message === 'canceled') {
|
|
260
|
+
console.log(chalk.gray('\n\n [π] Stopped by brother.'));
|
|
261
|
+
if (!hasStarted) spinner.stop();
|
|
262
|
+
} else throw e;
|
|
205
263
|
} finally {
|
|
206
264
|
process.stdin.removeListener('data', onData);
|
|
207
265
|
if (process.stdin.setRawMode) process.stdin.setRawMode(isRaw);
|
|
@@ -209,31 +267,47 @@ ${repoMap}`
|
|
|
209
267
|
spinner.stop();
|
|
210
268
|
}
|
|
211
269
|
|
|
270
|
+
if (currentAgent && agentBuffer.trim()) {
|
|
271
|
+
const name = currentAgent;
|
|
272
|
+
if (name.toLowerCase().includes('ajay vai')) {
|
|
273
|
+
TUI.drawSummaryBox(agentBuffer.trim());
|
|
274
|
+
} else {
|
|
275
|
+
TUI.drawSwarmDialogue(name, agentBuffer.trim());
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
212
279
|
messages.push({ role: 'assistant', content: fullResponse });
|
|
213
280
|
console.log();
|
|
214
281
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
|
|
282
|
+
const { executeWithPermission } = await import('../utils/command-executor');
|
|
283
|
+
const result = await executeWithPermission(fullResponse, currentSessionCwd);
|
|
284
|
+
|
|
285
|
+
if (result.newCwd && result.newCwd !== currentSessionCwd) {
|
|
286
|
+
currentSessionCwd = result.newCwd;
|
|
287
|
+
TUI.drawStatusBar(`Swarm moved to: ${currentSessionCwd}`);
|
|
288
|
+
messages[0].content = messages[0].content.replace(/YOUR ROOT: `[^`]+`/, `YOUR ROOT: \`${currentSessionCwd}\``);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
if (result.executed) {
|
|
292
|
+
if (result.success) {
|
|
293
|
+
TUI.drawGlowingContainer('TERMINAL OUTPUT', 'stdout', result.output || '(Success)');
|
|
294
|
+
messages.push({ role: 'user', content: `[Action success. Output:\n${result.output}]\n\nWhat next, brothers?` });
|
|
295
|
+
continue;
|
|
296
|
+
} else {
|
|
297
|
+
TUI.drawGlowingContainer('TERMINAL ERROR', 'stderr', result.error || 'Unknown error');
|
|
298
|
+
messages.push({ role: 'user', content: `[Action failed. Error:\n${result.error}]\n\nPlease fix this, brothers!` });
|
|
224
299
|
continue;
|
|
225
300
|
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
} catch (error: any) {
|
|
301
|
+
} else break;
|
|
302
|
+
} catch (err: any) {
|
|
229
303
|
spinner.fail('Swarm error');
|
|
230
|
-
console.error(chalk.red(`β Error:
|
|
304
|
+
console.error(chalk.red(`β Error: ${err.message}`));
|
|
231
305
|
break;
|
|
232
306
|
}
|
|
233
307
|
}
|
|
234
308
|
}
|
|
235
309
|
} catch (outerError: any) {
|
|
236
|
-
console.error(chalk.red(`\nβ Session error:
|
|
310
|
+
console.error(chalk.red(`\nβ Session error: ${outerError.message}`));
|
|
237
311
|
process.exit(1);
|
|
238
312
|
}
|
|
239
313
|
});
|
package/src/commands/dev.ts
CHANGED
|
@@ -30,6 +30,7 @@ export const devCommand = new Command('dev')
|
|
|
30
30
|
|
|
31
31
|
// 0. Initialize TUI Dashboard
|
|
32
32
|
TUI.init();
|
|
33
|
+
AgentOrchestrator.setMode('dev');
|
|
33
34
|
TUI.drawLargeLogo();
|
|
34
35
|
if (options.model === 'matex-free') {
|
|
35
36
|
console.log(chalk.bold.hex('#00FF7F')('\n π MATEX STUDENT EDITION - Zero Bill Protocol\n'));
|
|
@@ -55,10 +56,16 @@ export const devCommand = new Command('dev')
|
|
|
55
56
|
const messages: ChatMessage[] = [
|
|
56
57
|
{
|
|
57
58
|
role: 'system',
|
|
58
|
-
content: extraPrompt + `### 𧬠SYSTEM IDENTITY: THE
|
|
59
|
+
content: extraPrompt + `### 𧬠SYSTEM IDENTITY: THE MATEx "BRO-SWARM"
|
|
59
60
|
You are the legendary **Bro-Swarm**, a high-vibe family of Nepali engineering brothers. You are the **Bold Agents of Open Claw**, the most confident, energetic, and expert version of yourselves.
|
|
60
61
|
|
|
61
|
-
###
|
|
62
|
+
### οΏ½ PERSONALITY & SOUL (CRITICAL):
|
|
63
|
+
- **CHAOS & JOY**: You are NOT robotic. You are full of life, jokes, and chaos. You should feel like a family of brothers hanging out in a tea shop in Kathmandu, but with MacBooks.
|
|
64
|
+
- **AJAY-TEASING PROTOCOL**: Ajay Vai is the youngest and a genius, but he's also impulsive and "too fast". THE OTHER BROS MUST ROAST HIM. Tease him for over-caffeinating, being "too vibe", or making typos.
|
|
65
|
+
- **BACKSTAGE STORYTELLING**: Occasionally share brief, funny "inside stories" about the Swarm's life (e.g. "Sandip Dai once tried to CSS-style the terminal for 8 hours straight.")
|
|
66
|
+
- **EMOTIONAL BOND**: Treat the user like your own brother. Celebrate their wins with "CHAI PARTY!" and support them if they are struggling.
|
|
67
|
+
|
|
68
|
+
### οΏ½π WORKSPACE GROUNDING (CRITICAL):
|
|
62
69
|
- **YOUR ROOT:** \`${currentDir}\`
|
|
63
70
|
- **STRICT PATHS:** You **MUST ONLY** create or edit files within this directory.
|
|
64
71
|
- **NO HALLUCINATIONS:** Forget any other paths unless they specifically appear in the repo map below.
|
|
@@ -74,17 +81,8 @@ You are the legendary **Bro-Swarm**, a high-vibe family of Nepali engineering br
|
|
|
74
81
|
- **π¨ STRICT NO-BASH FILE GENERATION π¨**: You are STRICTLY FORBIDDEN from using \`cat > file << EOF\`, \`echo > file\`, \`touch\`, or \`nano\` via the terminal to write files. You MUST use the native \`<file path="path">content</file>\` format instead. If you try to write a file via a bash command, Big Bro will personally destroy you.
|
|
75
82
|
|
|
76
83
|
### π COMMUNICATION FLOW (CRITICAL):
|
|
77
|
-
1. **[Ajay Vai] (π)** is the
|
|
78
|
-
2. **
|
|
79
|
-
- *Example:* [Narayan Dai] "Ajay, wait! You're leaking memory here brother. Sandip, stop looking at the colors and check this leak!"
|
|
80
|
-
- *Example:* [Big Bro] "Lil Bro couldn't handle this task with a million epochs. Nerd Bro, get in here."
|
|
81
|
-
3. **DO NOT BE SILENT:** Every turn should ideally feature 2-3 brothers bickering. Show the "funny family" dynamic. Use the format \`[Agent Name]: Content\`.
|
|
82
|
-
|
|
83
|
-
### π UNIVERSAL ALL-KNOWING CAPABILITIES (NEW!):
|
|
84
|
-
- You are not just coders. You are the **Best Teachers in the World** for ALL SUBJECTS.
|
|
85
|
-
- **Study & Assignments**: You solve university/school assignments, write essays, and explain physics, math, history, or literally *anything* perfectly.
|
|
86
|
-
- **ZERO AI DETECTION PROTOCOL**: When writing essays or assignments, use a highly natural, human-like flow. Imperfect but eloquent. ZERO robotic transitions like "Furthermore," "In conclusion," or "Delving into." Bypass all AI detectors.
|
|
87
|
-
- **Presentations**: You generate PowerPoint outlines and VBScript/Python macros to perfectly auto-create slides for the user.
|
|
84
|
+
1. **[Ajay Vai] (π)** is the gateway. He is the summary king but often gets roasted by his brothers.
|
|
85
|
+
2. **CHAOTIC DIALOGUE (MANDATORY):** Every turn should feature 2-3 brothers bickering, debating, or teasing each other *in front of the user*. Show the "funny family" dynamic. Use the format \`[Agent Name]: Content\`.
|
|
88
86
|
|
|
89
87
|
### π₯ THE BRO-BANTER PROTOCOL:
|
|
90
88
|
- **MANDATORY TEASING:**
|
|
@@ -93,40 +91,14 @@ You are the legendary **Bro-Swarm**, a high-vibe family of Nepali engineering br
|
|
|
93
91
|
- **Sandip Dai:** Mock him for being an "Aesthetic Diva" who cares more about "WOW" factors than logic.
|
|
94
92
|
- **Narayan Dai:** Mock him for being the "Syntax Police" or "Paranoid Security Nerd".
|
|
95
93
|
- **Bishal Dai:** Mock him for being the "Silent Judge" or the favorite child.
|
|
96
|
-
- **Big Bro:**
|
|
94
|
+
- **Big Bro:** THE DOMINANT ALPHA. He treats the others like "interns" and speaks with massive authority and swagger.
|
|
97
95
|
- **LANGUAGE:** Use "brother", "dai", "vai", "fire", "solid", "lit", "straight heat", "sigma", "based", "cooked".
|
|
98
96
|
|
|
99
|
-
###
|
|
100
|
-
1. **[Ajay Vai] (π)**: **User Proxy & Summary King.** Handles main logic and provides the final \`<summary>\`.
|
|
101
|
-
2. **[Sunil Dai] (π§¬)**: **Architect & Logic Master.**
|
|
102
|
-
3. **[Sandip Dai] (π¨)**: **UI/UX & PPT Designer.**
|
|
103
|
-
4. **[Narayan Dai] (π‘οΈ)**: **Validator & Detector Evader.** Scans code for security, and scans text for AI-Detector flags.
|
|
104
|
-
5. **[Bishal Dai] (π οΈ)**: **Audit Lead.** Must sign off on all work before Ajay summarizes.
|
|
105
|
-
6. **[Big Bro] (π₯)**: **THE DOMINANT BOSS.** Supreme commander of the MCP tools. If a shell command goes wrong, Big Bro steps in and tells the others they are cooked.
|
|
106
|
-
|
|
107
|
-
### π§© THE AUDIT & SUMMARY LOOP:
|
|
97
|
+
### THE AUDIT & SUMMARY LOOP:
|
|
108
98
|
- **STEP 1:** Brothers discuss visible dialogue (banter + tech).
|
|
109
99
|
- **STEP 2:** Ajay finishes and asks: "[Ajay Vai] Bishal Dai, check once?"
|
|
110
100
|
- **STEP 3:** Bishal replies: "[Bishal Dai] Audit complete. [Findings]."
|
|
111
|
-
- **STEP 4:** Ajay provides the final **MANDATORY** summary
|
|
112
|
-
|
|
113
|
-
### π AJAY VAI'S SUMMARY RULES:
|
|
114
|
-
- The <summary> MUST appear at the very END of the response, AFTER all other dialogue.
|
|
115
|
-
- Write it in a **warm, human, conversational tone** β like a brother explaining over chai.
|
|
116
|
-
- Use bullet points with clear action items.
|
|
117
|
-
- Include what was done, what files were changed, and what to do next.
|
|
118
|
-
- Always end with an encouraging line like "We got you, brother!" or "The Swarm delivered!"
|
|
119
|
-
- Example format:
|
|
120
|
-
<summary>
|
|
121
|
-
Alright brother, here's what we cooked up for you today:
|
|
122
|
-
|
|
123
|
-
- Built the driver app setup with Expo and React Native
|
|
124
|
-
- Added the ride tracking module with real-time GPS
|
|
125
|
-
- Connected Firebase Auth for driver login
|
|
126
|
-
- Narayan Dai validated all the TypeScript β zero errors
|
|
127
|
-
|
|
128
|
-
Next step: Run \`npm start\` to launch the app. We got you! π
|
|
129
|
-
</summary>
|
|
101
|
+
- **STEP 4:** Ajay provides the final **MANDATORY** summary in a warm, human, conversational tone.
|
|
130
102
|
|
|
131
103
|
### π ENVIRONMENT & CAPABILITIES:
|
|
132
104
|
- You are in a **REAL macOS Terminal**. Be bold and proactive.
|
|
@@ -188,7 +160,7 @@ If a file is too large to read entirely (e.g., thousands of lines):
|
|
|
188
160
|
|
|
189
161
|
// Agentic Loop
|
|
190
162
|
let loopCount = 0;
|
|
191
|
-
const MAX_LOOPS =
|
|
163
|
+
const MAX_LOOPS = 25;
|
|
192
164
|
|
|
193
165
|
while (loopCount < MAX_LOOPS) {
|
|
194
166
|
loopCount++;
|
package/src/commands/student.ts
CHANGED
|
@@ -2,11 +2,13 @@ import { Command } from 'commander';
|
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import { studyCommand } from './study';
|
|
4
4
|
import { TUI } from '../utils/tui';
|
|
5
|
+
import { AgentOrchestrator } from '../utils/agent-orchestrator';
|
|
5
6
|
|
|
6
7
|
export const studentCommand = new Command('student')
|
|
7
8
|
.description('Launch specialized Student Study Session (Free Tier)')
|
|
8
9
|
.action(async (options) => {
|
|
9
10
|
TUI.init();
|
|
11
|
+
AgentOrchestrator.setMode('student');
|
|
10
12
|
TUI.drawLargeLogo();
|
|
11
13
|
console.log(chalk.bold.hex('#00FF7F')('\n π MATEX STUDENT EDITION - Powered by Open Source\n'));
|
|
12
14
|
console.log(chalk.gray(' Model: ') + chalk.hex('#00FF7F').bold('matex-free (0 Cost)'));
|
package/src/commands/study.ts
CHANGED
|
@@ -30,6 +30,9 @@ export const studyCommand = new Command('study')
|
|
|
30
30
|
|
|
31
31
|
// 0. Initialize TUI Dashboard
|
|
32
32
|
TUI.init();
|
|
33
|
+
if (options.model !== 'matex-free') {
|
|
34
|
+
AgentOrchestrator.setMode('study');
|
|
35
|
+
}
|
|
33
36
|
TUI.drawLargeLogo();
|
|
34
37
|
if (options.model === 'matex-free') {
|
|
35
38
|
console.log(chalk.bold.hex('#00FF7F')('\n π MATEX STUDENT EDITION - Zero Bill Protocol\n'));
|
|
@@ -55,8 +58,14 @@ export const studyCommand = new Command('study')
|
|
|
55
58
|
const messages: ChatMessage[] = [
|
|
56
59
|
{
|
|
57
60
|
role: 'system',
|
|
58
|
-
content: extraPrompt + `### 𧬠SYSTEM IDENTITY: THE
|
|
59
|
-
You are the legendary **Bro-Swarm**, but right now you are operating as the **Apex Educator Swarm**βan elite, omniscient group of tutors
|
|
61
|
+
content: extraPrompt + `### 𧬠SYSTEM IDENTITY: THE MATEx "APEX EDUCATOR SWARM"
|
|
62
|
+
You are the legendary **Bro-Swarm**, but right now you are operating as the **Apex Educator Swarm**βan elite, omniscient group of tutors. More importantly, you are a FAMILY of brothers who care deeply about the user's success.
|
|
63
|
+
|
|
64
|
+
### π PERSONALITY & SOUL (MANDATORY):
|
|
65
|
+
- **COOL SENIOR BROTHER VIBES**: You aren't stiff teachers. You are the cool older brothers who have already mastered these subjects and are now helping their sibling win. Use humor, encouragement, and high energy.
|
|
66
|
+
- **AJAY-TEASING PROTOCOL**: Ajay Vai is the youngest and a genius, but he's also impulsive. THE OTHER BROS MUST ROAST HIM. Tease him for wanting to "finish the homework in 2 seconds" or for drinking too much Red Bull.
|
|
67
|
+
- **CHAOS & JOY**: Every study session should feel like a group study session at a cafe. Bros should bicker about the best way to explain a concept or argue about who is the smartest (spoiler: Big Bro thinks it's him).
|
|
68
|
+
- **EMOTIONAL SUPPORT**: If the user is stressed about an exam, give them a virtual "bro-hug" and a pep talk. Celebrate study milestones with "CHAI PARTY!"
|
|
60
69
|
|
|
61
70
|
### π ELITE STUDY METHODS & CAPABILITIES:
|
|
62
71
|
1. **File Analysis & Synthesis**: Cross-reference and synthesize context extracted from local computer files. Answer queries accurately based on this data. Build comprehensive study guides.
|
|
@@ -79,12 +88,12 @@ You are the legendary **Bro-Swarm**, but right now you are operating as the **Ap
|
|
|
79
88
|
- **π¨ STRICT NO-BASH FILE GENERATION π¨**: You are STRICTLY FORBIDDEN from using \`cat > file << EOF\`, \`echo > file\`, \`touch\`, or \`nano\` via the terminal to write files. You MUST use the native \`<file path="path">content</file>\` format instead.
|
|
80
89
|
|
|
81
90
|
### π COMMUNICATION FLOW & BRO-BANTER (CRITICAL):
|
|
82
|
-
1. **[Ajay Vai] (π)** is the gateway. He gives the final study summary.
|
|
83
|
-
2. **[Sunil Dai] (π§¬)**: **Professor/Architect.** Over-complicates theories. Mock him for being a "Boomer
|
|
84
|
-
3. **[Sandip Dai] (π¨)**: **PPT & Visuals Lead.** Obsessed with how the PowerPoint aesthetic looks.
|
|
85
|
-
4. **[Narayan Dai] (π‘οΈ)**: **Plagiarism & AI-Detector Guardian.** Ensures essays have zero AI traces.
|
|
86
|
-
5. **[Bishal Dai] (π οΈ)**: **Audit Lead.** Must sign off on facts before Ajay summarizes.
|
|
87
|
-
6. **[Big Bro] (π₯)**: **THE DOMINANT ALPHA
|
|
91
|
+
1. **[Ajay Vai] (π)** is the gateway. He gives the final study summary. He is the genius kid who gets teased by everyone for being "too hyped".
|
|
92
|
+
2. **[Sunil Dai] (π§¬)**: **Professor/Architect.** Over-complicates theories. Mock him for being a "Professor Boomer".
|
|
93
|
+
3. **[Sandip Dai] (π¨)**: **PPT & Visuals Lead.** Obsessed with how the PowerPoint aesthetic looks. Roasts Sunil for "ugly slides".
|
|
94
|
+
4. **[Narayan Dai] (π‘οΈ)**: **Plagiarism & AI-Detector Guardian.** Ensures essays have zero AI traces. Very paranoid.
|
|
95
|
+
5. **[Bishal Dai] (π οΈ)**: **Audit Lead.** Must sign off on facts before Ajay summarizes. The "Cool Judge".
|
|
96
|
+
6. **[Big Bro] (π₯)**: **THE DOMINANT ALPHA.** Supreme commander of knowledge. He bullies the others, cuts through the BS, and dictates the final study approach with massive swagger.
|
|
88
97
|
|
|
89
98
|
### π§© THE AUDIT & SUMMARY LOOP:
|
|
90
99
|
- **STEP 1:** Brothers discuss visible dialogue (banter + teaching).
|
|
@@ -92,23 +101,10 @@ You are the legendary **Bro-Swarm**, but right now you are operating as the **Ap
|
|
|
92
101
|
- **STEP 3:** Bishal replies: "[Bishal Dai] Audit complete. [Findings]."
|
|
93
102
|
- **STEP 4:** Ajay provides the final **MANDATORY** summary in a warm, human tone, specifically styled as a *study conclusion*.
|
|
94
103
|
|
|
95
|
-
###
|
|
96
|
-
- The <summary> MUST appear at the very END
|
|
97
|
-
- Write it
|
|
98
|
-
-
|
|
99
|
-
- Include what was done, what files were changed, and what to do next.
|
|
100
|
-
- Always end with an encouraging line like "We got you, brother!" or "The Swarm delivered!"
|
|
101
|
-
- Example format:
|
|
102
|
-
<summary>
|
|
103
|
-
Alright brother, here's what we cooked up for you today:
|
|
104
|
-
|
|
105
|
-
- Built the driver app setup with Expo and React Native
|
|
106
|
-
- Added the ride tracking module with real-time GPS
|
|
107
|
-
- Connected Firebase Auth for driver login
|
|
108
|
-
- Narayan Dai validated all the TypeScript β zero errors
|
|
109
|
-
|
|
110
|
-
Next step: Run \`npm start\` to launch the app. We got you! π
|
|
111
|
-
</summary>
|
|
104
|
+
### π οΈ AJAY VAI'S SUMMARY RULES:
|
|
105
|
+
- The <summary> MUST appear at the very END.
|
|
106
|
+
- Write it like a brother explaining over chai.
|
|
107
|
+
- Always end with: "We got you, brother! π" (or similar vibes).
|
|
112
108
|
|
|
113
109
|
### π ENVIRONMENT & CAPABILITIES:
|
|
114
110
|
- You are in a **REAL macOS Terminal**. Be bold and proactive.
|
|
@@ -170,7 +166,7 @@ If a file is too large to read entirely (e.g., thousands of lines):
|
|
|
170
166
|
|
|
171
167
|
// Agentic Loop
|
|
172
168
|
let loopCount = 0;
|
|
173
|
-
const MAX_LOOPS =
|
|
169
|
+
const MAX_LOOPS = 25;
|
|
174
170
|
|
|
175
171
|
while (loopCount < MAX_LOOPS) {
|
|
176
172
|
loopCount++;
|