Problem
WP Codebox still embeds large generated PHP runner fragments inside host/runtime orchestration files. That makes the surrounding abstraction hard to read, hard to test in isolation, and easy to regress when escaping, payload encoding, or runtime bootstrap assumptions change.
A previous issue handled PHPUnit template duplication, but this is broader than PHPUnit.
Evidence
packages/wordpress-plugin/src/trait-wp-codebox-abilities-browser-runner.php contains a large inline PHP browser runner string in browser_agent_runner_php().
packages/wordpress-plugin/src/class-wp-codebox-agent-sandbox-runner.php still builds recipe commands, agent runtime payloads, parent-site seed exports, and runtime fragments in the same host adapter class.
packages/runtime-playground/src/bench-command-handlers.ts, phpunit-command-handlers.ts, and related command handlers also mix runtime orchestration with generated PHP snippets.
- Existing issue
#770 covered PHPUnit command template fragments only; it does not cover browser runner / agent runner / generic generated PHP template boundaries.
Desired shape
Create focused template/builder modules for generated PHP runners, with explicit input contracts and small smoke coverage.
Possible slices:
- Browser materializer/agent runner PHP template builder.
- Agent sandbox runtime PHP template builder.
- Benchmark/runtime command PHP template helpers, where reusable.
- Shared escaping/encoding conventions for template inputs.
Acceptance criteria
- Large inline PHP strings are moved out of orchestration classes/command handlers into named template builders.
- Template builders have narrow inputs and return strings only.
- Existing behavior and artifact shapes remain unchanged.
- At least one smoke test proves the extracted browser/agent runner template still executes.
Related
Problem
WP Codebox still embeds large generated PHP runner fragments inside host/runtime orchestration files. That makes the surrounding abstraction hard to read, hard to test in isolation, and easy to regress when escaping, payload encoding, or runtime bootstrap assumptions change.
A previous issue handled PHPUnit template duplication, but this is broader than PHPUnit.
Evidence
packages/wordpress-plugin/src/trait-wp-codebox-abilities-browser-runner.phpcontains a large inline PHP browser runner string inbrowser_agent_runner_php().packages/wordpress-plugin/src/class-wp-codebox-agent-sandbox-runner.phpstill builds recipe commands, agent runtime payloads, parent-site seed exports, and runtime fragments in the same host adapter class.packages/runtime-playground/src/bench-command-handlers.ts,phpunit-command-handlers.ts, and related command handlers also mix runtime orchestration with generated PHP snippets.#770covered PHPUnit command template fragments only; it does not cover browser runner / agent runner / generic generated PHP template boundaries.Desired shape
Create focused template/builder modules for generated PHP runners, with explicit input contracts and small smoke coverage.
Possible slices:
Acceptance criteria
Related