From 6ea76f4e151bd3061785fc7351b5b4c568c58a75 Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Sat, 4 Jul 2026 16:36:09 +0000 Subject: [PATCH] feat(m3.7): trace and replay (tron trace / tron replay) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Records automation commands into a .trontrace bundle and replays them (PRD §19). tron trace start [path] tron trace stop tron trace status tron replay - browser-core/automation/trace.ts: the bundle format — metadata.json, commands.jsonl (values redacted), snapshots/NNNN.json, errors.jsonl. Recording is cross-process via an active-trace pointer under the data dir. - automate-cli: `trace` (start/stop/status) and `replay` commands; snapshot/ click/fill now append to the active trace (a fresh snapshot per command). Form values are redacted by default (fill/type -> "[redacted]"). - replay re-runs clicks and non-redacted fills in order, skips redacted fills and snapshots, and stops at the first failing command with its seq. - install.sh routes `tron trace` / `tron replay` to the automation runtime. Tests (+10): the trace library (start/record/stop/read, redaction, errors) and the CLI trace/replay flow (record between start/stop, redaction persisted, status, replay clicks + skip redacted fills). Verified end-to-end via a WS CDP stub: recorded snapshot/click/fill, finalized bundle with per-command snapshots, replayed the click and skipped the redacted fill. Full workspace suite green. Network/console summaries (§19) need a persistent listener and are a follow-up. Co-Authored-By: Claude Opus 4.8 --- apps/web/public/install.sh | 6 +- docs/trace-replay.md | 53 ++++++++ packages/browser-core/src/automate-cli.ts | 96 ++++++++++++- .../browser-core/src/automate-trace.test.ts | 104 ++++++++++++++ packages/browser-core/src/automation/index.ts | 3 + .../browser-core/src/automation/trace.test.ts | 78 +++++++++++ packages/browser-core/src/automation/trace.ts | 128 ++++++++++++++++++ 7 files changed, 464 insertions(+), 4 deletions(-) create mode 100644 docs/trace-replay.md create mode 100644 packages/browser-core/src/automate-trace.test.ts create mode 100644 packages/browser-core/src/automation/trace.test.ts create mode 100644 packages/browser-core/src/automation/trace.ts diff --git a/apps/web/public/install.sh b/apps/web/public/install.sh index e842fd1..95e4304 100755 --- a/apps/web/public/install.sh +++ b/apps/web/public/install.sh @@ -93,6 +93,8 @@ Usage: tron run