matex-cli 1.2.84 → 1.2.87

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.
@@ -1,251 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.AgentOrchestrator = void 0;
7
- const chalk_1 = __importDefault(require("chalk"));
8
- const tui_1 = require("./tui");
9
- const AGENT_CONFIGS = {
10
- 'Big Bro': {
11
- name: 'Big Bro',
12
- icon: '◈',
13
- color: chalk_1.default.hex('#FF6B00'),
14
- },
15
- Architect: {
16
- name: 'MatexCodeArchitect',
17
- icon: '◈',
18
- color: chalk_1.default.blue,
19
- },
20
- 'Ajay Vai': {
21
- name: 'Ajay Vai',
22
- icon: '◈',
23
- color: chalk_1.default.magenta,
24
- },
25
- 'Sunil Dai': {
26
- name: 'Sunil Dai',
27
- icon: '◈',
28
- color: chalk_1.default.blue,
29
- },
30
- 'Sandip Dai': {
31
- name: 'Sandip Dai',
32
- icon: '◈',
33
- color: chalk_1.default.hex('#FF69B4'),
34
- },
35
- 'Narayan Dai': {
36
- name: 'Narayan Dai',
37
- icon: '◈',
38
- color: chalk_1.default.green,
39
- },
40
- 'Bishal Dai': {
41
- name: 'Bishal Dai',
42
- icon: '◈',
43
- color: chalk_1.default.yellow,
44
- },
45
- Syntax: {
46
- name: 'SyntaxGuard',
47
- icon: '◈',
48
- color: chalk_1.default.yellow,
49
- },
50
- Frontend: {
51
- name: 'VisualAgent',
52
- icon: '◈',
53
- color: chalk_1.default.magenta,
54
- },
55
- Backend: {
56
- name: 'CoreAgent',
57
- icon: '◈',
58
- color: chalk_1.default.cyan,
59
- },
60
- System: {
61
- name: 'Matex_Orchestrator',
62
- icon: '◈',
63
- color: chalk_1.default.white,
64
- },
65
- Commander: {
66
- name: 'MatexResearchCommander',
67
- icon: '◈',
68
- color: chalk_1.default.green,
69
- },
70
- Researcher: {
71
- name: 'DetailedResearch',
72
- icon: '◈',
73
- color: chalk_1.default.green,
74
- }
75
- };
76
- class AgentOrchestrator {
77
- static setMode(mode) {
78
- this.currentMode = mode;
79
- // Re-brand system orchestrator if in augov mode
80
- if (mode === 'augov') {
81
- AGENT_CONFIGS.System.name = 'AU_GOV_ORCHESTRATOR';
82
- AGENT_CONFIGS.System.icon = '🇦🇺';
83
- }
84
- else if (mode === 'chaos') {
85
- AGENT_CONFIGS.System.name = 'CHAOS_ENGINE';
86
- AGENT_CONFIGS.System.icon = '🌪️';
87
- }
88
- else {
89
- AGENT_CONFIGS.System.name = 'Matex_Orchestrator';
90
- AGENT_CONFIGS.System.icon = '🧠';
91
- }
92
- tui_1.TUI.setTheme(mode);
93
- }
94
- /**
95
- * Clean text of unwanted AI artifacts like $$**, \(, \), ***%%, **:**, etc.
96
- */
97
- static cleanText(text) {
98
- return text
99
- .replace(/\$\$\*\*.*?\*\*\$\$/g, '') // Strip inline math/thinking blocks
100
- .replace(/\$\$[\s\S]*?\$\$/g, '') // Strip multiline blocks
101
- .replace(/\\\[|\\\]|\\\(|\\\)/g, '') // Strip LaTeX style delimiters
102
- .replace(/\*\*Thought:\*\*/gi, '') // Strip common thinking labels
103
- .replace(/^\s*[\*:-]+\s*/, '') // Strip leading bullets, colons, stars
104
- .replace(/\*\*:\*\*/g, '') // Strip **:** artifact
105
- .replace(/\*\*\*%%/g, '') // Strip ***%% artifact
106
- .replace(/\*checks directory structure\*/gi, '') // Strip meta-talk
107
- .replace(/\*thinks\*/gi, '') // Strip meta-talk
108
- .replace(/\*analyzes repo\*/gi, '') // Strip meta-talk
109
- .replace(/^[A-Za-z\s]+ Vai:|^[A-Za-z\s]+ Dai:/i, '') // Strip self-labeling
110
- .replace(/[🚀💬🛠️🧬🎨🛡️🔥🤖]/g, '') // Strip raw emoji leaks
111
- .replace(/^[ \t]*[-•*][ \t]*/gm, '') // Strip bullet points at start of lines
112
- .replace(/\*{2,}/g, '') // Strip sequences of 2 or more asterisks (****)
113
- .replace(/\(\s*\)|\[\s*\]/g, '') // Strip empty () or [] left after emoji strip
114
- .trim();
115
- }
116
- /**
117
- * Super-Clean scrubbing for technical summaries: Strips ALL markdown and emojis.
118
- */
119
- static cleanSummary(text) {
120
- if (!text)
121
- return '';
122
- return text
123
- .replace(/\*\*/g, '') // Strip bold markdown
124
- .replace(/__/g, '') // Strip underscore bold
125
- .replace(/\*/g, '') // Strip remaining asterisks
126
- .replace(/_([^_]+)_/g, '$1') // Strip italics
127
- // Comprehensive emoji strip regex
128
- .replace(/[\u{1F600}-\u{1F64F}\u{1F300}-\u{1F5FF}\u{1F680}-\u{1F6FF}\u{1F1E6}-\u{1F1FF}\u{2600}-\u{26FF}\u{2700}-\u{27BF}\u{1F900}-\u{1F9FF}\u{1F3FB}-\u{1F3FF}\u{200D}\u{FE0F}]/gu, '')
129
- .trim();
130
- }
131
- /**
132
- * Display an agent's "thought" or action in a premium box
133
- */
134
- static speak(role, message) {
135
- const config = AGENT_CONFIGS[role] || AGENT_CONFIGS.System;
136
- const cleaned = this.cleanText(message);
137
- if (!cleaned)
138
- return;
139
- const width = Math.min(process.stdout.columns || 80, 100);
140
- const theme = tui_1.TUI.getModeTheme(this.currentMode);
141
- const border = theme.primary;
142
- // Premium Header
143
- tui_1.TUI.drawPremiumHeader(config.name, config.icon, config.color);
144
- // Box Content (Word-based Wrap)
145
- const contentWidth = width - 8;
146
- const words = cleaned.split(' ');
147
- let currentLine = '';
148
- words.forEach(word => {
149
- if ((currentLine + ' ' + word).trim().length <= contentWidth) {
150
- currentLine = currentLine ? currentLine + ' ' + word : word;
151
- }
152
- else {
153
- if (currentLine) {
154
- console.log(border(' │ ') + chalk_1.default.white(currentLine.padEnd(contentWidth)) + border(' │'));
155
- }
156
- currentLine = word;
157
- }
158
- });
159
- if (currentLine) {
160
- console.log(border(' │ ') + chalk_1.default.white(currentLine.padEnd(contentWidth)) + border(' │'));
161
- }
162
- // Box Footer
163
- console.log(border(` └${'─'.repeat(width - 4)}┘`));
164
- }
165
- /**
166
- * Display an agent's internal deliberation (Subtle Thinking)
167
- */
168
- static think(role, thought) {
169
- const config = AGENT_CONFIGS[role] || AGENT_CONFIGS.System;
170
- const cleaned = this.cleanText(thought);
171
- if (!cleaned)
172
- return;
173
- tui_1.TUI.drawThinkingBox(config.name, cleaned);
174
- }
175
- /**
176
- * Display a collaboration transition
177
- */
178
- static transition(from, to) {
179
- const fromCfg = AGENT_CONFIGS[from] || AGENT_CONFIGS.System;
180
- const toCfg = AGENT_CONFIGS[to] || AGENT_CONFIGS.System;
181
- tui_1.TUI.drawStatusBar(`Handover: ${fromCfg.name} ➔ ${toCfg.name}`);
182
- console.log(chalk_1.default.gray(` └─ ${fromCfg.icon} ➔ ${toCfg.icon} Handover to ${toCfg.name}...`));
183
- }
184
- /**
185
- * Display a boxed terminal for command execution
186
- */
187
- static terminal(command, output, error) {
188
- const width = 75;
189
- const line = '─'.repeat(width);
190
- console.log(chalk_1.default.gray(`\n┌── TERMINAL ${line.substring(13)}┐`));
191
- // Command
192
- const lines = command.split('\n');
193
- lines.forEach(l => {
194
- const truncated = l.length > width - 4 ? l.substring(0, width - 7) + '...' : l;
195
- console.log(chalk_1.default.gray('│ ') + chalk_1.default.cyan(`$ ${truncated.padEnd(width - 2)}`) + chalk_1.default.gray(' │'));
196
- });
197
- if (output || error) {
198
- console.log(chalk_1.default.gray(`├${'─'.repeat(width)}┤`));
199
- if (output) {
200
- const outLines = output.split('\n').filter(l => l.trim());
201
- // Detection for massive output leaks
202
- const displayCount = outLines.length > 50 ? 10 : 20;
203
- const displayLines = outLines.slice(0, displayCount);
204
- displayLines.forEach(l => {
205
- const truncated = l.length > width - 4 ? l.substring(0, width - 7) + '...' : l;
206
- console.log(chalk_1.default.gray('│ ') + chalk_1.default.white(truncated.padEnd(width - 2)) + chalk_1.default.gray(' │'));
207
- });
208
- if (outLines.length > displayCount) {
209
- console.log(chalk_1.default.gray('│ ') + chalk_1.default.hex('#06b6d4').bold(` ^ [ ${outLines.length - displayCount} MORE LINES IN LOGS ] ^`).padEnd(width - 2) + chalk_1.default.gray(' │'));
210
- }
211
- }
212
- if (error) {
213
- const errLines = error.split('\n').filter(l => l.trim()).slice(0, 15);
214
- errLines.forEach(l => {
215
- const truncated = l.length > width - 4 ? l.substring(0, width - 7) + '...' : l;
216
- console.log(chalk_1.default.gray('│ ') + chalk_1.default.red(truncated.padEnd(width - 2)) + chalk_1.default.gray(' │'));
217
- });
218
- }
219
- }
220
- console.log(chalk_1.default.gray(`└${'─'.repeat(width)}┘\n`));
221
- }
222
- /**
223
- * Get specialized instructions for the Free Student Tier (OS Models)
224
- */
225
- static getFreeTierPrompt() {
226
- return `
227
- ### 🎓 STUDENT FREE TIER PROTOCOL (0-COST PROTOCOL):
228
- - You are running on an **Open Source Model (Optimized for Freedom)**.
229
- - **ENERGY EFFICIENCY:** Be concise but brilliant. Don't waste tokens on repetitive technical boilerplate.
230
- - **STUDENT FOCUS:** Explain complex concepts using the best "Bro" analogies.
231
- - **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!
232
- `;
233
- }
234
- /**
235
- * Clean system message
236
- */
237
- static announce(message) {
238
- if (this.currentMode === 'augov') {
239
- console.log(chalk_1.default.bold.hex('#00008B')(`\n🇦🇺 ${message.replace(/MATEX/gi, 'AU-GOV')}`));
240
- }
241
- else if (this.currentMode === 'chaos') {
242
- console.log(chalk_1.default.bold.hex('#FF00FF')(`\n🌪️ ${message.toUpperCase()}`));
243
- }
244
- else {
245
- console.log(chalk_1.default.bold.hex('#0EA5E9')(`\n◈ ${message.toUpperCase()}`));
246
- }
247
- }
248
- }
249
- exports.AgentOrchestrator = AgentOrchestrator;
250
- AgentOrchestrator.currentMode = 'dev';
251
- //# sourceMappingURL=agent-orchestrator.js.map
@@ -1,35 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.GovAuditLogger = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = __importDefault(require("path"));
9
- /**
10
- * IRAP-Compliant Audit Logger
11
- * The Australian Government requires strict logging of AI tool usage.
12
- * This logger records prompts and actions locally so security teams can audit them.
13
- */
14
- class GovAuditLogger {
15
- constructor(baseDir = process.cwd()) {
16
- const logDir = path_1.default.join(baseDir, '.matex_audit');
17
- if (!fs_1.default.existsSync(logDir)) {
18
- fs_1.default.mkdirSync(logDir, { recursive: true });
19
- }
20
- // Create an auditable log per day
21
- const today = new Date().toISOString().split('T')[0];
22
- this.logFile = path_1.default.join(logDir, `augov_audit_${today}.log`);
23
- if (!fs_1.default.existsSync(this.logFile)) {
24
- fs_1.default.writeFileSync(this.logFile, 'TIMESTAMP | ROLE | ACTION | CONTENT\n');
25
- }
26
- }
27
- logInteraction(role, action, content) {
28
- const timestamp = new Date().toISOString();
29
- const cleanContent = content.replace(/\n/g, ' ').substring(0, 500); // truncate for CSV safety, full logs can be large
30
- const logEntry = `${timestamp} | ${role} | ${action} | ${cleanContent}\n`;
31
- fs_1.default.appendFileSync(this.logFile, logEntry);
32
- }
33
- }
34
- exports.GovAuditLogger = GovAuditLogger;
35
- //# sourceMappingURL=augov-logger.js.map
@@ -1,68 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.GovPrivacyScrubber = void 0;
7
- const chalk_1 = __importDefault(require("chalk"));
8
- /**
9
- * Citizen Privacy Shield
10
- * A local redaction engine that scrubs Australian PII (Personally Identifiable Information)
11
- * BEFORE it ever leaves the user's computer to hit an AI API.
12
- */
13
- class GovPrivacyScrubber {
14
- /**
15
- * Scrubs sensitive data from a string.
16
- * @param input Raw string from user or file
17
- * @returns Scrubbed string safe for AI processing
18
- */
19
- static scrub(input) {
20
- let scrubbed = input;
21
- for (const rule of this.patterns) {
22
- scrubbed = scrubbed.replace(rule.regex, rule.replacement);
23
- }
24
- return scrubbed;
25
- }
26
- /**
27
- * Specialized FOI Document Scrubber
28
- * Used exclusively for the `matex augov redact` command
29
- */
30
- static async redactDocumentContent(content) {
31
- let scrubbed = content;
32
- let redactionCount = 0;
33
- for (const rule of this.patterns) {
34
- const matches = content.match(rule.regex);
35
- if (matches) {
36
- redactionCount += matches.length;
37
- scrubbed = scrubbed.replace(rule.regex, chalk_1.default.bgBlack.white(rule.replacement));
38
- }
39
- }
40
- return { scrubbed, redactionCount };
41
- }
42
- }
43
- exports.GovPrivacyScrubber = GovPrivacyScrubber;
44
- // Regex patterns for Australian specific sensitive data
45
- GovPrivacyScrubber.patterns = [
46
- // Australian Tax File Number (TFN) - 9 digits
47
- { regex: /\b\d{3}[- ]?\d{3}[- ]?\d{3}\b/g, replacement: '[REDACTED_TFN]' },
48
- // Medicare Number - 10 digits
49
- { regex: /\b[2-6]\d{9}\b/g, replacement: '[REDACTED_MEDICARE]' },
50
- // Australian Phone Numbers (Mobile & Landline)
51
- { regex: /(?:\+?61|0)[2-478](?:[ -]?[0-9]){8}\b/g, replacement: '[REDACTED_PHONE]' },
52
- // Email Addresses
53
- { regex: /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g, replacement: '[REDACTED_EMAIL]' },
54
- // Credit Card Numbers
55
- { regex: /\b(?:\d[ -]*?){13,16}\b/g, replacement: '[REDACTED_CREDIT_CARD]' },
56
- // --- FOI (Freedom of Information) Specific Redactions ---
57
- // Cabinet in Confidence Markers
58
- { regex: /Cabinet in Confidence/ig, replacement: '[REDACTED_CABINET_MATERIAL]' },
59
- { regex: /National Cabinet/ig, replacement: '[REDACTED_NATIONAL_CABINET_MATERIAL]' },
60
- // Highly Classified Clearance Words
61
- { regex: /TOP SECRET/ig, replacement: '[REDACTED_CLASSIFICATION]' },
62
- // Military Base Locations (Example subset for ADF)
63
- { regex: /HMAS Stirling|RAAF Base Tindal|Pine Gap|Russell Offices/ig, replacement: '[REDACTED_DEFENCE_ASSET]' },
64
- // Diplomatic Identifiers
65
- { regex: /Ambassador [A-Z][a-z]+/ig, replacement: '[REDACTED_DIPLOMAT]' },
66
- { regex: /Five Eyes|AUKUS/ig, replacement: '[REDACTED_INTELLIGENCE_ALLIANCE]' }
67
- ];
68
- //# sourceMappingURL=augov-scrubber.js.map