Skip to content

mxyhi/ok-skills / browser-trace

browser-trace

Verified

Capture a full DevTools-protocol trace of any browser automation — CDP firehose, screenshots, and DOM dumps — then bisect the stream into per-page searchable buckets. Use when the user wants to debug a failed run, audit network/console/DOM activity, attach a trace to an in-progress session, or feed structured per-page summaries back into an agent loop so its next iteration learns from the last one.

FileKindSize
EXAMPLES.mdmarkdown8.4 KB
LICENSE.txtmarkdown1.0 KB
REFERENCE.mdmarkdown20.1 KB
SKILL.mdskill md14.7 KB
package.jsonmanifest91 B
scripts/bb-capture.mjsexecutablescript3.7 KB
scripts/bb-finalize.mjsexecutablescript3.2 KB
scripts/bisect-cdp.mjsexecutablescript7.6 KB
scripts/lib.mjsexecutablescript4.2 KB
scripts/query.mjsexecutablescript8.6 KB
scripts/snapshot-loop.mjsexecutablescript2.6 KB
scripts/start-capture.mjsexecutablescript2.9 KB
scripts/stop-capture.mjsexecutablescript1.5 KB

scripts/stop-capture.mjs

View on GitHub
#!/usr/bin/env node
// Stop an in-progress capture and stamp the manifest with stopped_at.
//
// Usage:
//   node scripts/stop-capture.mjs <run-id>

import fs from 'node:fs';
import path from 'node:path';

import { runDir, readJson, writeJson, isoUtcSeconds, isAlive, sleepMs } from './lib.mjs';

const [runId] = process.argv.slice(2);
if (!runId) {
  console.error('usage: stop-capture.mjs <run-id>');
  process.exit(2);
}

const RD = runDir(runId);
if (!fs.existsSync(RD)) {
  console.error(`run dir not found: ${RD}`);
  process.exit(1);
}

for (const pidFile of ['.cdp.pid', '.loop.pid']) {
  const p = path.join(RD, pidFile);
  if (!fs.existsSync(p)) continue;
  const pid = parseInt(fs.readFileSync(p, 'utf8').trim(), 10);
  if (!Number.isInteger(pid)) { fs.unlinkSync(p); continue; }

  try { process.kill(pid, 'SIGTERM'); } catch {}
  for (let i = 0; i < 3 && isAlive(pid); i++) {
    await sleepMs(1000);
  }
  if (isAlive(pid)) {
    try { process.kill(pid, 'SIGKILL'); } catch {}
  }
  fs.unlinkSync(p);
}

const manifestPath = path.join(RD, 'manifest.json');
const manifest = readJson(manifestPath);
if (manifest) {
  manifest.stopped_at = isoUtcSeconds();
  writeJson(manifestPath, manifest);
}

// Sweep half-written DOM dumps if the loop got SIGTERM'd mid-write.
const domDir = path.join(RD, 'dom');
if (fs.existsSync(domDir)) {
  for (const f of fs.readdirSync(domDir)) {
    if (f.endsWith('.partial')) {
      try { fs.unlinkSync(path.join(domDir, f)); } catch {}
    }
  }
}

console.log(`stopped: ${RD}`);
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall