Problem
packages/runtime-playground/src/browser-command-runners.ts has become a large browser execution god module.
Evidence on current origin/main:
- File is about 3453 lines.
- Browser probe/action/editor/scenario flows all manage overlapping browser lifecycle, capture, summary, and artifact behavior.
browserProbePreviewRouting() is defined inside this module at packages/runtime-playground/src/browser-command-runners.ts:3123.
- Preview routing is called with real args for probe/scenario at
:235 and :1037, but editor/action paths call it with [] at :1524, :2016, :2207, and :2437.
Why It Matters
Browser evidence behavior can drift between command families. Preview routing, liveness, network capture, error handling, and artifact summary generation should be consistent unless a command explicitly opts out.
Suggested Refactor
Extract focused browser primitives:
browser-preview-routing.ts for local/public/secure preview routing.
browser-capture-session.ts for launch/context/page lifecycle and common artifact writes.
- A typed browser run plan that probe/actions/editor/scenario commands can build from their input.
Keep legacy scenario/action field normalization at input boundaries only.
Acceptance Criteria
- Preview routing has one owner and all browser commands pass through it consistently.
- Browser lifecycle/capture setup is not repeated per command family.
- Existing browser smoke tests continue to pass.
Problem
packages/runtime-playground/src/browser-command-runners.tshas become a large browser execution god module.Evidence on current
origin/main:browserProbePreviewRouting()is defined inside this module atpackages/runtime-playground/src/browser-command-runners.ts:3123.:235and:1037, but editor/action paths call it with[]at:1524,:2016,:2207, and:2437.Why It Matters
Browser evidence behavior can drift between command families. Preview routing, liveness, network capture, error handling, and artifact summary generation should be consistent unless a command explicitly opts out.
Suggested Refactor
Extract focused browser primitives:
browser-preview-routing.tsfor local/public/secure preview routing.browser-capture-session.tsfor launch/context/page lifecycle and common artifact writes.Keep legacy scenario/action field normalization at input boundaries only.
Acceptance Criteria