feat(observer): v8 full-DOM unconditional dump — body tree capture at 5s/15s/60s with depth 15, indexed dump files, deep-inspect overhaul #task-619

This commit is contained in:
Variet Worker
2026-04-12 07:37:25 +09:00
parent 353265bed8
commit 0e03b3a300
3 changed files with 155 additions and 73 deletions

View File

@@ -126,9 +126,12 @@ export function startHttpBridge(ctx: HttpBridgeContext, sdk: any): Promise<numbe
req.on('data', (c: string) => dumpBody += c);
req.on('end', () => {
try {
const fs = require('fs');
const path = require('path');
// Save indexed dump for history + latest as dump_html.json
let idx = 1;
try { const parsed = JSON.parse(dumpBody); idx = parsed.dumpIndex || idx; } catch {}
fs.writeFileSync(path.join(ctx.bridgePath, `dump_html_${idx}.json`), dumpBody, 'utf-8');
fs.writeFileSync(path.join(ctx.bridgePath, 'dump_html.json'), dumpBody, 'utf-8');
ctx.logToFile(`[HTTP] DOM dump #${idx} saved (${dumpBody.length} bytes)`);
} catch (e) { }
res.writeHead(200); res.end('ok');
});