feat: runner-workspace executor on the live dispatch contract + CLI mount flip (Closes #1602)#1604
Merged
Merged
Conversation
8b0521f to
7075cc4
Compare
Give the WP Codebox runner a codebox-owned git + GitHub + file agent-tool surface so it no longer depends on Data Machine Code for those tools. - WP_Codebox_Runner_Workspace_Tools: WordPress-independent engine for the agent-facing file tools (read/ls/grep/write/edit/apply-patch), git tools (status/diff/add/commit, push construction) and GitHub request construction (create PR/issue, comment PR) with env-token auth, bound to one workspace root with path-escape confinement. - WP_Codebox_Runner_Workspace_Executor (target wp-codebox/runner-workspace): implements the Agents API WP_Agent_Tool_Executor contract, mapping tool names to the engine and resolving the workspace root from call input, client context, a runner constant, or a filter. - Deterministic smoke test on a real temp git repo (no DMC, no network): write->read->edit->grep, status->add->commit->diff, apply-patch, push argv construction, GitHub request construction, and executor target_id + workspace-root resolution. Wired into npm + the policy smoke group. - docs/runner-workspace-git-tools.md: scope findings, the tool-resolution seam, the GitHub env-token auth finding, the mirrored-vs-dropped subset map, and the phased plan (CLI mount swap + conversation-loop wiring deferred).
…+ flip CLI mount (Refs #1602) Phase 2: shed the external coding-agent plugin dependency on the runner path by serving the runner agent's file/git/GitHub tool surface from the codebox-native runner-workspace executor through the now-live Agents API tool-executor contract. - Register WP_Codebox_Runner_Workspace_Executor onto the canonical Agents API filters, mirroring the merged git-less sandbox executor: - agents_api_tool_sources declares the 14 file/git/GitHub tools under the `wp-codebox-runner` source, each carrying runtime.executor_target = wp-codebox/runner-workspace and a host executor kind, with per-tool capability + side-effect metadata. - agents_api_executor_targets / agents_api_execution_targets register the wp-codebox/runner-workspace target descriptor. - agents_api_tool_executors registers the executor instance under the target id so WP_Agent_Tool_Execution_Core's registry-based dispatch routes matching calls here. The runner conversation loop already runs through that core, so no loop change is needed. register() gates on substrate_exists() (both the executor interface AND the source registry must be loaded) and is invoked next to the sandbox executor in WP_Codebox_Abilities. - Flip the CLI default runner mount: defaultRuntimeComponentSources() in both packages/cli/src/agent-sandbox.ts and packages/runtime-core/src/agent-task-recipe.ts stops mounting the external coding-agent plugin (and the data-machine plugin it sat beside). Only the Agents API runtime is mounted by default, alongside the bundled wp-codebox plugin that registers the runner executor. Hosts opt extra substrate back in via CONTAINED_RUNTIME_COMPONENT_PATHS / WP_CODEBOX_AGENT_RUNTIME_COMPONENT_PATHS. clone/worktree-add stay on the host runner-workspace backend filter (orchestration, not an in-runner agent tool). - Decouple wp-codebox from naming the data-machine plugins on the runner path: Agents API resolves from explicit WP_CODEBOX_AGENTS_API_PATH, then a generic vendoring root via WP_CODEBOX_AGENTS_API_VENDOR_ROOT (<root>/vendor/wordpress/agents-api), then a sibling agents-api checkout. - Add scripts/php-runner-workspace-executor-dispatch-smoke.php: drives the REAL Agents API WP_Agent_Tool_Execution_Core + WP_Agent_Tool_Executor_Registry against a real temp git repo and proves a runner-targeted tool routes to the runner executor (not the default) while an untargeted tool falls back. Wired into npm + the policy smoke group; skips cleanly when no real agents-api checkout is resolvable rather than faking a pass. - Update tests/agent-runtime-components.test.ts to encode the flipped contract: default runtime mounts only agents-api (+ bundled wp-codebox), no data-machine plugins; opt-in components still mount; agents-api resolves via the vendoring root with no product-specific name.
7075cc4 to
e70aa44
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Gives the WP Codebox runner a codebox-owned git + GitHub + file agent-tool surface and wires it onto the now-live Agents API tool-executor dispatch contract, so the runner no longer depends on an external coding-agent plugin (Data Machine Code) for its agent-facing tools.
Closes #1602
Phase 1 — Runner-native tool engine + executor (foundation)
WP_Codebox_Runner_Workspace_Tools: WordPress-independent engine for the agent-facing file tools (read/ls/grep/write/edit/apply-patch), git tools (status/diff/add/commit, push construction) and GitHub request construction (create PR/issue, comment PR) with env-token auth, bound to one workspace root with path-escape confinement.WP_Codebox_Runner_Workspace_Executor(targetwp-codebox/runner-workspace): implements the Agents APIWP_Agent_Tool_Executorcontract, mapping tool names to the engine and resolving the workspace root from call input / client context / a runner constant / a filter.Phase 2 — Wire onto the live contract + flip the CLI mount (the dependency shed)
Mirrors the merged git-less sandbox executor (#1605):
WP_Codebox_Runner_Workspace_Executor::register()registers onto the canonical Agents API filters:agents_api_tool_sourcesdeclares the 14 file/git/GitHub tools under thewp-codebox-runnersource, each carryingruntime.executor_target = wp-codebox/runner-workspace(host executor kind) + per-tool capability/side-effect metadata.agents_api_executor_targets/agents_api_execution_targetsregister the target descriptor.agents_api_tool_executorsregisters the executor instance under the target id, soWP_Agent_Tool_Execution_Core's registry-based dispatch (executePreparedTool→resolveExecutorForTool) routes matching calls here.register()gates onsubstrate_exists()(both theWP_Agent_Tool_Executorinterface andWP_Agent_Tool_Source_Registrymust be loaded — the gotcha the merged sandbox harness surfaced) and is invoked next to the sandbox executor inWP_Codebox_Abilities.WP_Agent_Tool_Execution_Coreand callsexecutePreparedTool. That path builds the executor registry fromagents_api_tool_executors, so registering the executor is sufficient — no conversation-loop change is needed.CLI mount flip
defaultRuntimeComponentSources()in bothpackages/cli/src/agent-sandbox.tsandpackages/runtime-core/src/agent-task-recipe.tsstops mounting the external coding-agent plugin (and the data-machine plugin it sat beside) for the runner. Only the Agents API runtime is mounted by default, alongside the bundled wp-codebox plugin (wordpress-plugin) that registers the runner executor. A host/deploy that still needs extra substrate opts back in throughCONTAINED_RUNTIME_COMPONENT_PATHS/WP_CODEBOX_AGENT_RUNTIME_COMPONENT_PATHS.clone/worktree-addstay on the host-side runner-workspace backend filter (orchestration, not an in-runner agent tool), so the flip strips no agent-called surface.Decoupling from data-machine names
wp-codebox no longer names the data-machine plugins on the runner path. Agents API resolves from explicit
WP_CODEBOX_AGENTS_API_PATH, then a generic vendoring root viaWP_CODEBOX_AGENTS_API_VENDOR_ROOT(<root>/vendor/wordpress/agents-api), then a siblingagents-apicheckout.Verification
scripts/php-runner-workspace-executor-dispatch-smoke.phpdrives the real Agents APIWP_Agent_Tool_Execution_Core+WP_Agent_Tool_Executor_Registry(no shims for the registry/core) against a real temp git repo: a tool withruntime.executor_target = wp-codebox/runner-workspaceroutes to the runner executor (NOT the default), returns real workspace content/git state, and an untargeted control tool falls back to the default executor (backward compat). 64 assertions pass against the merged agents-api contract. Wired into npm + the policy smoke group; skips cleanly (no fake pass) when no real agents-api checkout is resolvable.WP_Codebox_Runner_Workspace_Adapterhandlesclone/worktree-add/ prepare / publish through thewp_codebox_runner_workspace_backendfilter — host orchestration, not an in-runner agent tool — so dropping the default mount strips no agent-called surface.tests/agent-runtime-components.test.tsupdated to encode the flipped contract: default runtime mounts only agents-api (+ bundled wp-codebox), no data-machine plugins; opt-in components still mount; agents-api resolves via the vendoring root with no product-specific name.npm ci+npm run buildclean. Smoke groups policy (incl. the dispatch proof + runner-workspace tools) and agent (incl. the agents-api adapter contract, sandbox executor, execution targets) pass.production-boundary-enforcementpasses.origin/main(not introduced here):command-registry-smokefails onwordpress.editor-validate-blocksoutputShape (feat: add wordpress.editor-validate-blocks command (real wp.blocks.validateBlock on imported content) #1597), anddocs-boundary-languagefails on a READMEagents-api/reference. Both reproduce with this PR's changes stashed.Follow-ups (deferred)
git pushagainst a throwaway remote.AI assistance