diff --git a/engine262/src/ask262-debug.mts b/engine262/src/ask262-debug.mts index eaacbad..c93cfed 100644 --- a/engine262/src/ask262-debug.mts +++ b/engine262/src/ask262-debug.mts @@ -113,6 +113,17 @@ class Ask262Debug { stopImportant() { this._important = false; } + + /** + * Resets all captured marks and internal state. + * Clears marks array, mark index map, and resets flags. + */ + reset() { + this.marks = []; + this._markIndex.clear(); + this._important = false; + this._captureEnabled = false; + } } export const ask262Debug = new Ask262Debug(); diff --git a/src/agent-tools/evaluateInEngine262.ts b/src/agent-tools/evaluateInEngine262.ts index 4be59e8..b82cd4a 100644 --- a/src/agent-tools/evaluateInEngine262.ts +++ b/src/agent-tools/evaluateInEngine262.ts @@ -142,6 +142,7 @@ export function createEvaluateInEngine262Tool() { stopTrace: () => void; startImportant: () => void; stopImportant: () => void; + reset: () => void; }; const Agent = engine.Agent; const ManagedRealm = engine.ManagedRealm; @@ -152,9 +153,8 @@ export function createEvaluateInEngine262Tool() { const Value = engine.Value; const skipDebugger = engine.skipDebugger; - // TODO: Add reset method, allow making instances and use that. - // Reset marks from previous runs - ask262Debug.marks = []; + // Reset state from previous runs + ask262Debug.reset(); // Array to capture console output const consoleOutput: ConsoleEntry[] = [];