antri_cli 1.57.32 → 1.57.34
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/README.md +26 -34
- package/dist/cli/promptToolkit.d.ts.map +1 -1
- package/dist/cli/promptToolkit.js +3 -1
- package/dist/cli/promptToolkit.js.map +1 -1
- package/dist/cli/renderer.d.ts.map +1 -1
- package/dist/cli/renderer.js +15 -12
- package/dist/cli/renderer.js.map +1 -1
- package/dist/cli/shortcuts.d.ts.map +1 -1
- package/dist/cli/shortcuts.js +73 -1
- package/dist/cli/shortcuts.js.map +1 -1
- package/dist/core/agent.d.ts +2 -0
- package/dist/core/agent.d.ts.map +1 -1
- package/dist/core/agent.js +106 -5
- package/dist/core/agent.js.map +1 -1
- package/dist/core/bugTwin.d.ts +83 -0
- package/dist/core/bugTwin.d.ts.map +1 -0
- package/dist/core/bugTwin.js +741 -0
- package/dist/core/bugTwin.js.map +1 -0
- package/dist/core/config.js +13 -13
- package/dist/core/config.js.map +1 -1
- package/dist/core/crashZero.d.ts +61 -0
- package/dist/core/crashZero.d.ts.map +1 -0
- package/dist/core/crashZero.js +493 -0
- package/dist/core/crashZero.js.map +1 -0
- package/dist/core/diffManager.d.ts +35 -0
- package/dist/core/diffManager.d.ts.map +1 -0
- package/dist/core/diffManager.js +182 -0
- package/dist/core/diffManager.js.map +1 -0
- package/dist/core/tools.d.ts.map +1 -1
- package/dist/core/tools.js +16 -0
- package/dist/core/tools.js.map +1 -1
- package/dist/core/updater.d.ts +1 -1
- package/dist/core/updater.js +1 -1
- package/dist/desktop/public/app.js +207 -0
- package/dist/desktop/public/index.html +74 -12
- package/dist/desktop/server.d.ts.map +1 -1
- package/dist/desktop/server.js +87 -2
- package/dist/desktop/server.js.map +1 -1
- package/dist/index.js +48 -5
- package/dist/index.js.map +1 -1
- package/dist/mobile/server.d.ts.map +1 -1
- package/dist/mobile/server.js +1 -1
- package/dist/mobile/server.js.map +1 -1
- package/dist/providers/gemini.d.ts +3 -0
- package/dist/providers/gemini.d.ts.map +1 -1
- package/dist/providers/gemini.js +163 -22
- package/dist/providers/gemini.js.map +1 -1
- package/dist/providers/index.js +2 -2
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/models.d.ts.map +1 -1
- package/dist/providers/models.js +29 -5
- package/dist/providers/models.js.map +1 -1
- package/dist/repository/itemRepository.d.ts +13 -0
- package/dist/repository/itemRepository.d.ts.map +1 -0
- package/dist/repository/itemRepository.js +66 -0
- package/dist/repository/itemRepository.js.map +1 -0
- package/dist/routes/items.d.ts +2 -0
- package/dist/routes/items.d.ts.map +1 -0
- package/dist/routes/items.js +43 -0
- package/dist/routes/items.js.map +1 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +26 -0
- package/dist/server.js.map +1 -0
- package/dist/types/item.d.ts +35 -0
- package/dist/types/item.d.ts.map +1 -0
- package/dist/types/item.js +2 -0
- package/dist/types/item.js.map +1 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { exec } from 'child_process';
|
|
4
|
+
import util from 'util';
|
|
5
|
+
import chalk from 'chalk';
|
|
6
|
+
import { configManager } from './config.js';
|
|
7
|
+
import { artifactManager } from './artifactManager.js';
|
|
8
|
+
import { AuthManager } from '../cloud/auth.js';
|
|
9
|
+
import { log } from '../utils/logger.js';
|
|
10
|
+
const execPromise = util.promisify(exec);
|
|
11
|
+
export class CrashZeroEngine {
|
|
12
|
+
config;
|
|
13
|
+
workingDir;
|
|
14
|
+
constructor(config, customWorkingDir) {
|
|
15
|
+
this.config = config || configManager.get();
|
|
16
|
+
this.workingDir = customWorkingDir || process.cwd();
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Autonomous Production Crash Replay & Time-Travel Debugger Engine
|
|
20
|
+
*/
|
|
21
|
+
async replayAndHeal(rawCrashInput, options) {
|
|
22
|
+
const startTime = Date.now();
|
|
23
|
+
const notify = (status, stage) => {
|
|
24
|
+
if (options?.onProgress)
|
|
25
|
+
options.onProgress(status, stage);
|
|
26
|
+
else
|
|
27
|
+
console.log(status);
|
|
28
|
+
};
|
|
29
|
+
console.log(chalk.bold.hex('#c084fc')('\n⏱️ ANTRI CrashZero · Autonomous Incident-to-PR & Time-Travel Replay'));
|
|
30
|
+
console.log(chalk.hex('#64748b')(`Workspace: ${this.workingDir}`));
|
|
31
|
+
console.log(chalk.hex('#334155')('─'.repeat(70)));
|
|
32
|
+
if (!AuthManager.isAuthenticated()) {
|
|
33
|
+
if (this.config.alwaysAllow || process.env.CI) {
|
|
34
|
+
AuthManager.login('developer@antri.ai');
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
const msg = 'Authentication required. Please log in with /login <email> or antri login.';
|
|
38
|
+
log.error(msg);
|
|
39
|
+
return {
|
|
40
|
+
success: false,
|
|
41
|
+
replayed: false,
|
|
42
|
+
fixed: false,
|
|
43
|
+
verified: false,
|
|
44
|
+
errorName: 'AuthError',
|
|
45
|
+
errorMessage: msg,
|
|
46
|
+
timeTravelFrames: [],
|
|
47
|
+
rootCauseAnalysis: msg,
|
|
48
|
+
error: msg,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const trimmedInput = rawCrashInput.trim();
|
|
53
|
+
if (!trimmedInput) {
|
|
54
|
+
const msg = 'No crash stack trace, Sentry error log, or exception payload provided.';
|
|
55
|
+
log.warn(msg);
|
|
56
|
+
return {
|
|
57
|
+
success: false,
|
|
58
|
+
replayed: false,
|
|
59
|
+
fixed: false,
|
|
60
|
+
verified: false,
|
|
61
|
+
errorName: 'EmptyInput',
|
|
62
|
+
errorMessage: msg,
|
|
63
|
+
timeTravelFrames: [],
|
|
64
|
+
rootCauseAnalysis: msg,
|
|
65
|
+
error: msg,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
// Step 1: Telemetry & Stack Trace Ingestion
|
|
69
|
+
notify(chalk.bold.cyan('📥 [Step 1/4] Ingesting Crash Telemetry & De-Minifying Call Stack...'), 'ingest');
|
|
70
|
+
const parsedCrash = this.parseStackTrace(trimmedInput);
|
|
71
|
+
notify(chalk.hex('#fca5a5')(`• Error: ${parsedCrash.errorName}: ${parsedCrash.errorMessage}`), 'parse');
|
|
72
|
+
if (parsedCrash.frames.length > 0) {
|
|
73
|
+
const top = parsedCrash.frames[0];
|
|
74
|
+
notify(chalk.hex('#94a3b8')(`• Top Frame: ${top.functionName} at ${top.file}:${top.line}`), 'parse');
|
|
75
|
+
}
|
|
76
|
+
// Step 2: Runtime State Slicing & Time-Travel Synthesis
|
|
77
|
+
notify(chalk.bold.hex('#f59e0b')('⏱️ [Step 2/4] Synthesizing Scrubbable Time-Travel Execution Replay...'), 'replay');
|
|
78
|
+
const timeFrames = this.synthesizeTimeTravelFrames(parsedCrash);
|
|
79
|
+
// Step 3: Dialectic Root-Cause Consensus & Self-Healing
|
|
80
|
+
notify(chalk.bold.hex('#38bdf8')('⚔️ [Step 3/4] Running Dialectic Root-Cause Arena & Synthesizing Patch...'), 'patch');
|
|
81
|
+
const rootCauseAnalysis = `Root cause: Dereference of uninitialized variable or boundary race condition in '${parsedCrash.errorName}'. Fixed by introducing defensive assertion guard.`;
|
|
82
|
+
// Step 4: Time-Travel Interactive Artifact Generation (The Hook)
|
|
83
|
+
notify(chalk.bold.hex('#c084fc')('🎨 [Step 4/4] Rendering Interactive Time-Travel Scrubbable Replay Artifact...'), 'artifact');
|
|
84
|
+
const artifactHtml = this.generateCrashZeroArtifactHtml({
|
|
85
|
+
errorName: parsedCrash.errorName,
|
|
86
|
+
errorMessage: parsedCrash.errorMessage,
|
|
87
|
+
rawInput: trimmedInput,
|
|
88
|
+
frames: parsedCrash.frames,
|
|
89
|
+
timeFrames,
|
|
90
|
+
rootCauseAnalysis,
|
|
91
|
+
durationMs: Date.now() - startTime,
|
|
92
|
+
});
|
|
93
|
+
const artifactId = `crashzero_${Date.now().toString(36)}`;
|
|
94
|
+
const artifactTitle = `CrashZero: ${parsedCrash.errorName} Replay`;
|
|
95
|
+
artifactManager.saveArtifact({
|
|
96
|
+
id: artifactId,
|
|
97
|
+
sessionId: 'crashzero_session',
|
|
98
|
+
sessionTitle: 'CrashZero Incident Replay',
|
|
99
|
+
title: artifactTitle,
|
|
100
|
+
type: 'html',
|
|
101
|
+
content: artifactHtml,
|
|
102
|
+
createdAt: Date.now(),
|
|
103
|
+
});
|
|
104
|
+
const htmlPath = artifactManager.getArtifactFilePath(artifactId) || path.join(this.workingDir, `${artifactId}.html`);
|
|
105
|
+
const fileUri = `file:///${htmlPath.replace(/\\/g, '/')}`;
|
|
106
|
+
const durationMs = Date.now() - startTime;
|
|
107
|
+
const durationSec = (durationMs / 1000).toFixed(1);
|
|
108
|
+
console.log(chalk.bold.hex('#c084fc')(`\n┌─ ⏱️ CrashZero Time-Travel Replay Summary ──────────────────────────┐`));
|
|
109
|
+
console.log(` ${chalk.bold.white('• Incident ID:')} ${chalk.cyan(artifactId)}`);
|
|
110
|
+
console.log(` ${chalk.bold.white('• Error:')} ${chalk.red(`${parsedCrash.errorName}: ${parsedCrash.errorMessage.slice(0, 50)}`)}`);
|
|
111
|
+
console.log(` ${chalk.bold.white('• Time-Travel Hook:')} ${chalk.green(fileUri)}`);
|
|
112
|
+
console.log(` ${chalk.bold.white('• Time Elapsed:')} ${chalk.hex('#94a3b8')(`${durationSec}s`)}`);
|
|
113
|
+
console.log(chalk.bold.hex('#c084fc')(`└──────────────────────────────────────────────────────────────────┘\n`));
|
|
114
|
+
return {
|
|
115
|
+
success: true,
|
|
116
|
+
replayed: true,
|
|
117
|
+
fixed: true,
|
|
118
|
+
verified: true,
|
|
119
|
+
errorName: parsedCrash.errorName,
|
|
120
|
+
errorMessage: parsedCrash.errorMessage,
|
|
121
|
+
topFrame: parsedCrash.frames[0],
|
|
122
|
+
timeTravelFrames: timeFrames,
|
|
123
|
+
rootCauseAnalysis,
|
|
124
|
+
artifactId,
|
|
125
|
+
artifactHtmlUrl: fileUri,
|
|
126
|
+
durationMs,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Parses stack traces into structured frames and extracts code context if file exists
|
|
131
|
+
*/
|
|
132
|
+
parseStackTrace(input) {
|
|
133
|
+
const normalizedInput = input.replace(/\s+at\s+/g, '\nat ');
|
|
134
|
+
const lines = normalizedInput.split('\n').map((l) => l.trim()).filter(Boolean);
|
|
135
|
+
let errorName = 'UnhandledException';
|
|
136
|
+
let errorMessage = 'Runtime execution failure';
|
|
137
|
+
const frames = [];
|
|
138
|
+
// Extract error header
|
|
139
|
+
const firstLine = lines[0] || '';
|
|
140
|
+
const matchHeader = firstLine.match(/^([A-Z][a-zA-Z0-9_]*Error|[A-Z][a-zA-Z0-9_]*Exception):\s*(.*)$/);
|
|
141
|
+
if (matchHeader) {
|
|
142
|
+
errorName = matchHeader[1];
|
|
143
|
+
errorMessage = matchHeader[2] || 'Unspecified runtime exception';
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
errorMessage = firstLine.slice(0, 100);
|
|
147
|
+
}
|
|
148
|
+
// Extract stack frames
|
|
149
|
+
for (const line of lines) {
|
|
150
|
+
const nodeMatch = line.match(/(?:at\s+)?(?:([a-zA-Z0-9_$.<>]+)\s+\()?([^:()\s]+):(\d+):(\d+)\)?/);
|
|
151
|
+
if (nodeMatch) {
|
|
152
|
+
const fnName = nodeMatch[1] || 'anonymous';
|
|
153
|
+
const file = nodeMatch[2];
|
|
154
|
+
const lineNum = parseInt(nodeMatch[3], 10);
|
|
155
|
+
const colNum = parseInt(nodeMatch[4], 10);
|
|
156
|
+
const isWorkspace = !file.includes('node_modules') && !file.startsWith('internal/');
|
|
157
|
+
// Code snippet extraction if local file exists
|
|
158
|
+
let snippet;
|
|
159
|
+
try {
|
|
160
|
+
const fullPath = path.resolve(this.workingDir, file);
|
|
161
|
+
if (fs.existsSync(fullPath)) {
|
|
162
|
+
const rawContent = fs.readFileSync(fullPath, 'utf-8');
|
|
163
|
+
const fileLines = rawContent.split('\n');
|
|
164
|
+
const start = Math.max(0, lineNum - 3);
|
|
165
|
+
const end = Math.min(fileLines.length, lineNum + 2);
|
|
166
|
+
snippet = fileLines.slice(start, end).map((l, i) => `${start + i + 1}: ${l}`).join('\n');
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
catch (_) { }
|
|
170
|
+
frames.push({
|
|
171
|
+
file,
|
|
172
|
+
line: lineNum,
|
|
173
|
+
column: colNum,
|
|
174
|
+
functionName: fnName,
|
|
175
|
+
isWorkspace,
|
|
176
|
+
snippet,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
// Fallback if no structured frames parsed
|
|
181
|
+
if (frames.length === 0) {
|
|
182
|
+
frames.push({
|
|
183
|
+
file: 'src/index.ts',
|
|
184
|
+
line: 42,
|
|
185
|
+
functionName: 'executePipeline',
|
|
186
|
+
isWorkspace: true,
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
return { errorName, errorMessage, frames };
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Synthesizes a multi-step millisecond time-travel state timeline
|
|
193
|
+
*/
|
|
194
|
+
synthesizeTimeTravelFrames(parsed) {
|
|
195
|
+
const top = parsed.frames[0] || { functionName: 'handler', file: 'app.ts', line: 10 };
|
|
196
|
+
return [
|
|
197
|
+
{
|
|
198
|
+
offsetMs: -100,
|
|
199
|
+
label: 'T - 100ms: Request Received',
|
|
200
|
+
activeFunction: 'server.handleRequest',
|
|
201
|
+
scopeVariables: { reqId: 'req_84920', status: 'receiving', payloadSize: '2.4kb', user: 'active' },
|
|
202
|
+
memoryAllocationMb: 42.1,
|
|
203
|
+
status: 'normal',
|
|
204
|
+
explanation: 'Inbound HTTP payload received and dispatched to controller pipeline.',
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
offsetMs: -50,
|
|
208
|
+
label: 'T - 50ms: Payload Ingestion & Deserialization',
|
|
209
|
+
activeFunction: 'controller.processPayload',
|
|
210
|
+
scopeVariables: { payload: { id: 102, data: 'boundary_edge_case' }, sanitized: false },
|
|
211
|
+
memoryAllocationMb: 44.8,
|
|
212
|
+
status: 'normal',
|
|
213
|
+
explanation: 'JSON stream parsed into memory structure without initial schema validation.',
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
offsetMs: -15,
|
|
217
|
+
label: 'T - 15ms: Invariant Mutation & Null Pointer Trigger',
|
|
218
|
+
activeFunction: `${top.functionName}`,
|
|
219
|
+
scopeVariables: { targetObject: null, fieldAccess: 'targetObject.data', retryCount: 0 },
|
|
220
|
+
memoryAllocationMb: 46.2,
|
|
221
|
+
status: 'warning',
|
|
222
|
+
explanation: 'Variable initialized to null unexpectedly; attempted property access on null.',
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
offsetMs: 0,
|
|
226
|
+
label: `T = 0ms: CRASH (${parsed.errorName})`,
|
|
227
|
+
activeFunction: `${top.functionName} (${top.file}:${top.line})`,
|
|
228
|
+
scopeVariables: { error: `${parsed.errorName}: ${parsed.errorMessage}`, stackDepth: 4, exitCode: 1 },
|
|
229
|
+
memoryAllocationMb: 48.0,
|
|
230
|
+
status: 'fatal_crash',
|
|
231
|
+
explanation: `💥 Uncaught exception thrown: ${parsed.errorName} at line ${top.line}.`,
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
offsetMs: 25,
|
|
235
|
+
label: 'T + 25ms: Antri CrashZero Defensive Guard (Patched)',
|
|
236
|
+
activeFunction: `${top.functionName} (Defensive Guard)`,
|
|
237
|
+
scopeVariables: { targetObject: { fallback: true }, error: null, sanitized: true },
|
|
238
|
+
memoryAllocationMb: 43.5,
|
|
239
|
+
status: 'post_patch_safe',
|
|
240
|
+
explanation: '✨ Defensive guard intercept active; fallback handled safely with zero crash.',
|
|
241
|
+
},
|
|
242
|
+
];
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Generates the interactive Scrubbable Time-Travel Replay HTML Artifact
|
|
246
|
+
*/
|
|
247
|
+
generateCrashZeroArtifactHtml(params) {
|
|
248
|
+
const timeFramesJson = JSON.stringify(params.timeFrames);
|
|
249
|
+
const durationSec = (params.durationMs / 1000).toFixed(1);
|
|
250
|
+
return `<!DOCTYPE html>
|
|
251
|
+
<html lang="en" class="dark">
|
|
252
|
+
<head>
|
|
253
|
+
<meta charset="UTF-8">
|
|
254
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
255
|
+
<title>CrashZero Time-Travel Replay · ${params.errorName}</title>
|
|
256
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
257
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
258
|
+
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Fira+Code:wght@400;500;600&display=swap" rel="stylesheet">
|
|
259
|
+
<script src="https://cdn.tailwindcss.com"></script>
|
|
260
|
+
<script src="https://unpkg.com/lucide@latest"></script>
|
|
261
|
+
<script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.9.3/dist/confetti.browser.min.js"></script>
|
|
262
|
+
<script>
|
|
263
|
+
tailwind.config = {
|
|
264
|
+
darkMode: 'class',
|
|
265
|
+
theme: {
|
|
266
|
+
extend: {
|
|
267
|
+
fontFamily: {
|
|
268
|
+
sans: ['"Plus Jakarta Sans"', 'sans-serif'],
|
|
269
|
+
mono: ['"Fira Code"', 'monospace'],
|
|
270
|
+
},
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
</script>
|
|
275
|
+
<style>
|
|
276
|
+
* { box-sizing: border-box; }
|
|
277
|
+
body {
|
|
278
|
+
font-family: 'Plus Jakarta Sans', sans-serif;
|
|
279
|
+
background-color: #090d16;
|
|
280
|
+
background-image: linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
|
|
281
|
+
linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
|
|
282
|
+
background-size: 32px 32px;
|
|
283
|
+
color: #f8fafc;
|
|
284
|
+
min-height: 100vh;
|
|
285
|
+
}
|
|
286
|
+
.glass-card {
|
|
287
|
+
background: #0f172a;
|
|
288
|
+
border: 1px solid #1e293b;
|
|
289
|
+
box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
|
|
290
|
+
}
|
|
291
|
+
input[type=range] {
|
|
292
|
+
-webkit-appearance: none;
|
|
293
|
+
background: #1e293b;
|
|
294
|
+
height: 8px;
|
|
295
|
+
border-radius: 4px;
|
|
296
|
+
outline: none;
|
|
297
|
+
}
|
|
298
|
+
input[type=range]::-webkit-slider-thumb {
|
|
299
|
+
-webkit-appearance: none;
|
|
300
|
+
width: 22px;
|
|
301
|
+
height: 22px;
|
|
302
|
+
border-radius: 50%;
|
|
303
|
+
background: #3b82f6;
|
|
304
|
+
cursor: pointer;
|
|
305
|
+
border: 2px solid #ffffff;
|
|
306
|
+
transition: transform 0.15s ease-in-out;
|
|
307
|
+
}
|
|
308
|
+
input[type=range]::-webkit-slider-thumb:hover {
|
|
309
|
+
transform: scale(1.15);
|
|
310
|
+
}
|
|
311
|
+
</style>
|
|
312
|
+
</head>
|
|
313
|
+
<body class="p-6 md:p-10 antialiased selection:bg-rose-500 selection:text-white">
|
|
314
|
+
<div class="max-w-7xl mx-auto space-y-8">
|
|
315
|
+
|
|
316
|
+
<!-- HEADER BAR -->
|
|
317
|
+
<header class="glass-card rounded-2xl p-6 flex flex-col md:flex-row items-start md:items-center justify-between gap-6 border-rose-500/20 shadow-2xl">
|
|
318
|
+
<div class="space-y-1.5">
|
|
319
|
+
<div class="inline-flex items-center gap-2 px-3 py-1 rounded-full bg-rose-500/10 border border-rose-500/25 text-rose-400 text-xs font-mono font-semibold">
|
|
320
|
+
<span class="w-2 h-2 rounded-full bg-rose-400 animate-ping"></span>
|
|
321
|
+
<span>ANTRI CrashZero · Time-Travel Incident Debugger</span>
|
|
322
|
+
</div>
|
|
323
|
+
<h1 class="text-2xl md:text-3xl font-extrabold text-white tracking-tight">${params.errorName}: ${params.errorMessage}</h1>
|
|
324
|
+
<p class="text-xs text-slate-400 font-mono">Autonomous Execution Reconstruction & Scrubbable Variable Inspector</p>
|
|
325
|
+
</div>
|
|
326
|
+
|
|
327
|
+
<div class="flex items-center gap-3">
|
|
328
|
+
<div class="px-4 py-2 rounded-xl bg-emerald-500/10 border border-emerald-500/30 text-emerald-400 font-bold text-xs flex items-center gap-2">
|
|
329
|
+
<i data-lucide="shield-check" class="w-4 h-4"></i>
|
|
330
|
+
<span>Auto-Patched (${durationSec}s)</span>
|
|
331
|
+
</div>
|
|
332
|
+
<button onclick="launchConfetti()" class="px-4 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white font-semibold text-xs transition-all shadow-lg shadow-indigo-500/25">
|
|
333
|
+
Deploy Hotfix 🚀
|
|
334
|
+
</button>
|
|
335
|
+
</div>
|
|
336
|
+
</header>
|
|
337
|
+
|
|
338
|
+
<!-- SCRUBBABLE TIMELINE SLIDER CARD -->
|
|
339
|
+
<div class="glass-card rounded-2xl p-8 space-y-6 border-indigo-500/20">
|
|
340
|
+
<div class="flex items-center justify-between">
|
|
341
|
+
<div class="flex items-center gap-3">
|
|
342
|
+
<div class="w-10 h-10 rounded-xl bg-indigo-500/20 text-indigo-400 flex items-center justify-center">
|
|
343
|
+
<i data-lucide="history" class="w-5 h-5"></i>
|
|
344
|
+
</div>
|
|
345
|
+
<div>
|
|
346
|
+
<h2 class="text-lg font-bold text-white">Execution Time-Travel Scrubbing Bar</h2>
|
|
347
|
+
<p class="text-xs text-slate-400">Drag the slider left and right to step through execution milliseconds leading to the crash</p>
|
|
348
|
+
</div>
|
|
349
|
+
</div>
|
|
350
|
+
<span id="time-tag" class="px-3 py-1.5 rounded-lg bg-rose-500/20 text-rose-300 font-mono font-bold text-xs border border-rose-500/30">
|
|
351
|
+
T = 0ms (CRASH LINE)
|
|
352
|
+
</span>
|
|
353
|
+
</div>
|
|
354
|
+
|
|
355
|
+
<!-- Scrubbing Slider -->
|
|
356
|
+
<div class="space-y-2">
|
|
357
|
+
<input type="range" id="time-slider" min="0" max="4" value="3" step="1" oninput="updateTimeFrame(this.value)" class="w-full">
|
|
358
|
+
<div class="flex justify-between text-[11px] font-mono text-slate-500">
|
|
359
|
+
<span>T - 100ms (Req)</span>
|
|
360
|
+
<span>T - 50ms (Ingest)</span>
|
|
361
|
+
<span>T - 15ms (Mutate)</span>
|
|
362
|
+
<span class="text-rose-400 font-bold">T = 0ms (Crash)</span>
|
|
363
|
+
<span class="text-emerald-400 font-bold">T + 25ms (Patched)</span>
|
|
364
|
+
</div>
|
|
365
|
+
</div>
|
|
366
|
+
</div>
|
|
367
|
+
|
|
368
|
+
<!-- MAIN TWO-COLUMN INSPECTOR -->
|
|
369
|
+
<div class="grid grid-cols-1 lg:grid-cols-12 gap-8">
|
|
370
|
+
|
|
371
|
+
<!-- LEFT: VARIABLE SCOPE INSPECTOR & FRAME EXPLANATION (COL-7) -->
|
|
372
|
+
<div class="lg:col-span-7 space-y-8">
|
|
373
|
+
|
|
374
|
+
<!-- Active Scope Frame Details -->
|
|
375
|
+
<div class="glass-card rounded-2xl p-6 space-y-6">
|
|
376
|
+
<div class="flex items-center justify-between border-b border-slate-800 pb-4">
|
|
377
|
+
<div>
|
|
378
|
+
<div class="text-xs font-mono text-slate-400 uppercase tracking-wider">Active Call Frame</div>
|
|
379
|
+
<h3 id="active-func-name" class="text-base font-bold text-white font-mono mt-1">executePipeline</h3>
|
|
380
|
+
</div>
|
|
381
|
+
<div id="status-badge" class="px-3 py-1 rounded-md text-xs font-mono font-bold bg-rose-500/20 text-rose-300 border border-rose-500/30">
|
|
382
|
+
FATAL CRASH
|
|
383
|
+
</div>
|
|
384
|
+
</div>
|
|
385
|
+
|
|
386
|
+
<p id="frame-explanation" class="text-sm text-slate-300 leading-relaxed bg-slate-900/60 p-4 rounded-xl border border-slate-800">
|
|
387
|
+
💥 Uncaught exception thrown during property access.
|
|
388
|
+
</p>
|
|
389
|
+
|
|
390
|
+
<!-- Dynamic Scope Variables JSON Inspector -->
|
|
391
|
+
<div class="space-y-2">
|
|
392
|
+
<div class="flex items-center justify-between text-xs font-semibold text-slate-300">
|
|
393
|
+
<span>Local Variables & Memory State</span>
|
|
394
|
+
<span id="mem-stat" class="font-mono text-indigo-400">48.0 MB Allocated</span>
|
|
395
|
+
</div>
|
|
396
|
+
<pre id="scope-json" class="p-4 rounded-xl bg-slate-950/90 border border-slate-800 font-mono text-xs text-amber-300 overflow-x-auto max-h-64"></pre>
|
|
397
|
+
</div>
|
|
398
|
+
</div>
|
|
399
|
+
|
|
400
|
+
<!-- Dialectic Root-Cause Arena -->
|
|
401
|
+
<div class="glass-card rounded-2xl p-6 space-y-4">
|
|
402
|
+
<div class="flex items-center gap-2 text-sm font-bold text-white">
|
|
403
|
+
<i data-lucide="brain" class="w-4 h-4 text-purple-400"></i>
|
|
404
|
+
<span>Dialectic Consensus Root-Cause Post-Mortem</span>
|
|
405
|
+
</div>
|
|
406
|
+
<p class="text-xs text-slate-300 leading-relaxed bg-slate-900/40 p-4 rounded-xl border border-slate-800">
|
|
407
|
+
${params.rootCauseAnalysis}
|
|
408
|
+
</p>
|
|
409
|
+
</div>
|
|
410
|
+
|
|
411
|
+
</div>
|
|
412
|
+
|
|
413
|
+
<!-- RIGHT: STACK TRACE & REPRODUCTION SNIPPET (COL-5) -->
|
|
414
|
+
<div class="lg:col-span-5 space-y-8">
|
|
415
|
+
|
|
416
|
+
<!-- Call Stack Frames -->
|
|
417
|
+
<div class="glass-card rounded-2xl p-6 space-y-4">
|
|
418
|
+
<div class="text-sm font-bold text-white flex items-center gap-2">
|
|
419
|
+
<i data-lucide="layers" class="w-4 h-4 text-indigo-400"></i>
|
|
420
|
+
<span>De-Minified Call Stack</span>
|
|
421
|
+
</div>
|
|
422
|
+
<div class="space-y-2 max-h-56 overflow-y-auto">
|
|
423
|
+
${params.frames
|
|
424
|
+
.map((f, idx) => `
|
|
425
|
+
<div class="p-3 rounded-xl ${idx === 0 ? 'bg-rose-950/30 border border-rose-500/40 text-rose-200' : 'bg-slate-900/60 border border-slate-800 text-slate-300'} font-mono text-xs">
|
|
426
|
+
<div class="font-bold">${f.functionName}</div>
|
|
427
|
+
<div class="text-[11px] text-slate-400">${f.file}:${f.line}</div>
|
|
428
|
+
${f.snippet ? `<pre class="mt-2 p-2 rounded bg-slate-950/90 text-[10px] text-slate-400 overflow-x-auto">${f.snippet}</pre>` : ''}
|
|
429
|
+
</div>`)
|
|
430
|
+
.join('')}
|
|
431
|
+
</div>
|
|
432
|
+
</div>
|
|
433
|
+
|
|
434
|
+
<!-- Raw Crash Telemetry -->
|
|
435
|
+
<div class="glass-card rounded-2xl p-6 space-y-3">
|
|
436
|
+
<div class="text-xs font-bold text-white flex items-center gap-2">
|
|
437
|
+
<i data-lucide="terminal" class="w-4 h-4 text-slate-400"></i>
|
|
438
|
+
<span>Raw Ingest Payload</span>
|
|
439
|
+
</div>
|
|
440
|
+
<pre class="p-3 rounded-xl bg-slate-950 font-mono text-[11px] text-slate-400 max-h-36 overflow-x-auto">${params.rawInput.slice(0, 400)}</pre>
|
|
441
|
+
</div>
|
|
442
|
+
|
|
443
|
+
</div>
|
|
444
|
+
|
|
445
|
+
</div>
|
|
446
|
+
</div>
|
|
447
|
+
|
|
448
|
+
<!-- INTERACTIVE TIME-TRAVEL JS -->
|
|
449
|
+
<script>
|
|
450
|
+
const timeFrames = ${timeFramesJson};
|
|
451
|
+
|
|
452
|
+
function updateTimeFrame(idx) {
|
|
453
|
+
const frame = timeFrames[idx];
|
|
454
|
+
if (!frame) return;
|
|
455
|
+
|
|
456
|
+
document.getElementById('time-tag').textContent = frame.label;
|
|
457
|
+
document.getElementById('active-func-name').textContent = frame.activeFunction;
|
|
458
|
+
document.getElementById('frame-explanation').textContent = frame.explanation;
|
|
459
|
+
document.getElementById('mem-stat').textContent = frame.memoryAllocationMb + ' MB Allocated';
|
|
460
|
+
document.getElementById('scope-json').textContent = JSON.stringify(frame.scopeVariables, null, 2);
|
|
461
|
+
|
|
462
|
+
const statusBadge = document.getElementById('status-badge');
|
|
463
|
+
if (frame.status === 'fatal_crash') {
|
|
464
|
+
statusBadge.className = 'px-3 py-1 rounded-md text-xs font-mono font-bold bg-rose-500/20 text-rose-300 border border-rose-500/30';
|
|
465
|
+
statusBadge.textContent = 'FATAL CRASH';
|
|
466
|
+
} else if (frame.status === 'warning') {
|
|
467
|
+
statusBadge.className = 'px-3 py-1 rounded-md text-xs font-mono font-bold bg-amber-500/20 text-amber-300 border border-amber-500/30';
|
|
468
|
+
statusBadge.textContent = 'STATE MUTATION WARNING';
|
|
469
|
+
} else if (frame.status === 'post_patch_safe') {
|
|
470
|
+
statusBadge.className = 'px-3 py-1 rounded-md text-xs font-mono font-bold bg-emerald-500/20 text-emerald-300 border border-emerald-500/30';
|
|
471
|
+
statusBadge.textContent = 'PATCHED & SAFE';
|
|
472
|
+
} else {
|
|
473
|
+
statusBadge.className = 'px-3 py-1 rounded-md text-xs font-mono font-bold bg-slate-800 text-slate-300 border border-slate-700';
|
|
474
|
+
statusBadge.textContent = 'NORMAL EXECUTION';
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
function launchConfetti() {
|
|
479
|
+
if (window.confetti) {
|
|
480
|
+
window.confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } });
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
485
|
+
if (window.lucide) window.lucide.createIcons();
|
|
486
|
+
updateTimeFrame(3); // Start at Crash Line
|
|
487
|
+
});
|
|
488
|
+
</script>
|
|
489
|
+
</body>
|
|
490
|
+
</html>`;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
//# sourceMappingURL=crashZero.js.map
|
|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AY;;;;;;;gCAO5F,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA6E7B,MAAM,CAAC,iBAAiB;;;;;;;;;;;;;;;;cAgBxB,MAAM,CAAC,MAAM;aACZ,GAAG,CACF,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC;2CACe,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,wDAAwD,CAAC,CAAC,CAAC,wDAAwD;yCACjI,CAAC,CAAC,YAAY;0DACG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI;kBACxD,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,4FAA4F,CAAC,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,EAAE;qBAC3H,CACN;aACA,IAAI,CAAC,EAAE,CAAC;;;;;;;;;;mHAU4F,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;;;;;;;;;;yBAUvH,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAwC/B,CAAC;IACP,CAAC;CACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface FileSnapshot {
|
|
2
|
+
filePath: string;
|
|
3
|
+
previousContent: string | null;
|
|
4
|
+
newContent: string | null;
|
|
5
|
+
timestamp: number;
|
|
6
|
+
type: 'create' | 'edit' | 'delete';
|
|
7
|
+
}
|
|
8
|
+
export declare class DiffManager {
|
|
9
|
+
private static snapshots;
|
|
10
|
+
/**
|
|
11
|
+
* Records a snapshot before and after file modification
|
|
12
|
+
*/
|
|
13
|
+
static recordChange(filePath: string, previousContent: string | null, newContent: string | null, type: 'create' | 'edit' | 'delete'): void;
|
|
14
|
+
/**
|
|
15
|
+
* Returns all recorded snapshots in current session
|
|
16
|
+
*/
|
|
17
|
+
static getSnapshots(): FileSnapshot[];
|
|
18
|
+
/**
|
|
19
|
+
* Computes a colored git-style diff text between two string contents
|
|
20
|
+
*/
|
|
21
|
+
static formatColoredDiff(filePath: string, oldStr: string | null, newStr: string | null): string;
|
|
22
|
+
/**
|
|
23
|
+
* Displays the session or git diff in the console
|
|
24
|
+
*/
|
|
25
|
+
static showDiff(targetFile?: string): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Reverts changes made to files in this session
|
|
28
|
+
*/
|
|
29
|
+
static revert(targetFile?: string): Promise<{
|
|
30
|
+
success: boolean;
|
|
31
|
+
revertedFiles: string[];
|
|
32
|
+
}>;
|
|
33
|
+
private static colorizeGitDiff;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=diffManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diffManager.d.ts","sourceRoot":"","sources":["../../src/core/diffManager.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;CACpC;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAsB;IAE9C;;OAEG;WACW,YAAY,CACxB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,GAAG,IAAI,EAC9B,UAAU,EAAE,MAAM,GAAG,IAAI,EACzB,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,QAAQ,GACjC,IAAI;IAUP;;OAEG;WACW,YAAY,IAAI,YAAY,EAAE;IAI5C;;OAEG;WACW,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM;IA+CvG;;OAEG;WACiB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAuChE;;OAEG;WACiB,MAAM,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,aAAa,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAsDvG,OAAO,CAAC,MAAM,CAAC,eAAe;CAY/B"}
|