Skip to content

Step-by-step trace events + debug mode with screenshots - #8

Merged
kmjones1979 merged 1 commit into
1clawAI:mainfrom
redbotster:feat/trace-and-debug-mode
Sep 9, 2026
Merged

kmjones1979 merged 1 commit into
1clawAI:mainfrom
redbotster:feat/trace-and-debug-mode

Conversation

@redbotster

Copy link
Copy Markdown
Contributor

Summary

  • Adds TraceEvent (src/trace.ts): a new operator-only step-by-step record, emitted via an injectable onStep callback on FillEngine, RegistrationEngine and CaptureEngine, and threaded through startBridge's BridgeOptions. Deliberately separate from AuditEvent (a driver's own coarse compliance record) and from onError (which stays the "why did this fail" channel) — see the doc comment in trace.ts for why merging them would have compromised both.
  • Each engine traces its real steps (navigate, type_username/type_extra_field, wait_for_field, focus, type_secret, submit, settle, closed/committed/error) and screenshots two coarse checkpoints via the already-allowlisted Page.captureScreenshot — never the step where a secret is on the page. type_secret is traced but never pictured, on principle. CaptureEngine is stricter still: it screenshots only navigate, before a generated value can exist, and nothing from read_value onward.
  • 1claw-browser-bridge --debug <dir> / ONECLAW_BRIDGE_DEBUG (bin/debug-trace.mjs) is the reference consumer: one timestamped run directory per invocation, a trace.jsonl line per step, and a numbered PNG for every step that carries a screenshot. This is also the shape a future 1Claw dashboard would consume for run playback — an ordered trace of named steps with checkpoint screenshots is enough to reconstruct a scrubbable timeline without recording full video or risking the recording itself becoming a leak vector.
  • trace.test.ts (new) asserts the property that matters most: across all three engines, no detail string and no screenshot ever contains the fill/registration secret, a capture's generated value, or a registration's extraFields value — including on the error path.
  • README: new "Debug mode" section plus a roadmap entry.

Test plan

  • pnpm typecheck clean
  • pnpm typecheck:tests clean
  • pnpm build clean
  • pnpm test — 276 passed, 6 skipped, 30 files (was 267/29 before this change; +9 new trace tests, zero regressions)
  • Manually smoke-tested bin/debug-trace.mjs end to end (trace.jsonl + PNG written correctly for a synthetic event stream)

🤖 Generated with Claude Code

https://claude.ai/code/session_01WqPU5z6K3maS9J6LrcsEic

Adds TraceEvent, a new op-only channel (separate from AuditEvent, which
crosses to a driver's central log, and separate from onError, which stays
the "why did this fail" channel) emitted via an injectable onStep callback
on FillEngine, RegistrationEngine and CaptureEngine.

Each engine traces its real steps (navigate, type_username, type_secret,
submit, settle, etc.) and screenshots two coarse checkpoints — never the
step where a secret is on the page. CaptureEngine is stricter still: it
screenshots only before the generated value can exist.

1claw-browser-bridge --debug <dir> (or ONECLAW_BRIDGE_DEBUG) is the
reference consumer: one JSONL trace plus numbered PNGs per run, in
bin/debug-trace.mjs. This is also the shape a future 1Claw dashboard would
consume for run playback.

trace.test.ts asserts the property that matters most here: no detail string
or screenshot from any of the three engines ever contains the secret, the
generated capture value, or a registration extraFields value.

276 tests passing (was 267), typecheck and build clean.
@kmjones1979
kmjones1979 force-pushed the feat/trace-and-debug-mode branch from cf90a28 to bacb9d1 Compare September 9, 2026 14:09
@kmjones1979
kmjones1979 merged commit afa021f into 1clawAI:main Sep 9, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants