diff --git a/.github/workflows/maintain-docs.yml b/.github/workflows/maintain-docs.yml index 1edf1ed..d42646c 100644 --- a/.github/workflows/maintain-docs.yml +++ b/.github/workflows/maintain-docs.yml @@ -2,7 +2,7 @@ name: Maintain Docs env: # Advance this revision and all package digests together when package bytes change. - DOCS_AGENT_PACKAGE_REVISION: a51e79ac698610177852170332a1135a9c315951 + DOCS_AGENT_PACKAGE_REVISION: f3d965758c6318bd900b32d7fb91ccae125c3204 # Advance independently when the post-command completion validator changes. DOCS_AGENT_COMPLETION_CONTRACT_REVISION: b136f9bc84e6f0ad9d5d0d5cdbb3df9c62e382e2 @@ -157,7 +157,7 @@ jobs: technical:bootstrap) package_path="bundles/technical-docs-agent/native/technical-docs-bootstrap-agent.agent.json" agent_slug="technical-docs-bootstrap-agent" - package_digest="sha256-bytes-v1:124924f004474d5296294a3f2c99285d0848c46ed622926b1b283ed018b2bcf0" + package_digest="sha256-bytes-v1:21b4efe1323ace3fd9c445c3eae36d42c128bc1e3d2dd0b575b89ecb38b02eae" lane_requires_pr=true default_prompt="Bootstrap source-grounded developer documentation that helps developers understand, use, and extend the code in the repository." ;; @@ -171,7 +171,7 @@ jobs: user:bootstrap) package_path="bundles/user-docs-agent/native/user-docs-bootstrap-agent.agent.json" agent_slug="user-docs-bootstrap-agent" - package_digest="sha256-bytes-v1:a3ada797a125f638364caac43004bbb47fcc8c7bdc89021f25fcfcdc4c2d502f" + package_digest="sha256-bytes-v1:526ff81a024f75445ab44fcad16910c0b9b8f8765c3cba930490469eb1af74d3" lane_requires_pr=true default_prompt="Bootstrap source-grounded product documentation for onboarding, setup, common tasks, expected outcomes, permissions, compatibility, troubleshooting, and FAQs." ;; diff --git a/README.md b/README.md index 96df92d..f2e629a 100644 --- a/README.md +++ b/README.md @@ -231,11 +231,11 @@ Docs Agent has one canonical architecture: five standalone native Agents API pac - `bundles/user-docs-agent/native/user-docs-maintenance-agent.agent.json` - `bundles/skills-agent/native/skills-maintenance-agent.agent.json` -These five `.agent.json` files are the complete executable package surface. Each package is the sole executable instruction authority for its lane. The reusable workflow maps `audience` and `run_kind` to exactly one package and its canonical agent slug; it does not select a separate manifest, flow, pipeline, or memory envelope. Every descriptor uses the package-source revision `a51e79ac698610177852170332a1135a9c315951`, independently of the revision that invokes the reusable workflow, and supplies a byte-level `sha256-bytes-v1` digest. +These five `.agent.json` files are the complete executable package surface. Each package is the sole executable instruction authority for its lane. The reusable workflow maps `audience` and `run_kind` to exactly one package and its canonical agent slug; it does not select a separate manifest, flow, pipeline, or memory envelope. Every descriptor uses the package-source revision `f3d965758c6318bd900b32d7fb91ccae125c3204`, independently of the revision that invokes the reusable workflow, and supplies a byte-level `sha256-bytes-v1` digest. Package updates advance the package-source revision and all five declared digests atomically. The immutable-source validator reads each package blob from that Git revision, recomputes its digest and canonical slug, and rejects a descriptor that does not match those historical bytes. -All five packages support direct import through `wp_agent_import_runtime_bundles()` and retain the source-grounded workspace-only editing boundary. Technical bootstrap has an Agents API completion gate that requires a workspace documentation write before it can finish, so a fresh surface cannot complete as prose only. Maintenance and the other no-change-capable lanes intentionally have no required write-tool gate; deterministic report/diff postconditions continue to reject no-op writes while allowing honest no-change maintenance. +All five packages support direct import through `wp_agent_import_runtime_bundles()` and retain the source-grounded workspace-only editing boundary. Both bootstrap lanes (technical and user) have an Agents API completion gate that requires a workspace documentation write before they can finish, so a fresh surface cannot complete as prose only. Maintenance and the other no-change-capable lanes intentionally have no required write-tool gate; deterministic report/diff postconditions continue to reject no-op writes while allowing honest no-change maintenance. ### Compatibility Impact diff --git a/bundles/user-docs-agent/native/user-docs-bootstrap-agent.agent.json b/bundles/user-docs-agent/native/user-docs-bootstrap-agent.agent.json index 3756695..3dcfef8 100644 --- a/bundles/user-docs-agent/native/user-docs-bootstrap-agent.agent.json +++ b/bundles/user-docs-agent/native/user-docs-bootstrap-agent.agent.json @@ -2,8 +2,8 @@ "schema_version": 1, "bundle_slug": "user-docs-bootstrap-agent", "bundle_version": "0.1.0", - "source_ref": "Automattic/docs-agent@02e01e6d72ee158e45413185c32fcf30a5a04724", - "source_revision": "02e01e6d72ee158e45413185c32fcf30a5a04724", + "source_ref": "Automattic/docs-agent@f3d965758c6318bd900b32d7fb91ccae125c3204", + "source_revision": "f3d965758c6318bd900b32d7fb91ccae125c3204", "agent": { "agent_slug": "user-docs-bootstrap-agent", "agent_name": "User Docs Bootstrap Agent", @@ -30,12 +30,23 @@ "workspace_git_status", "workspace_git_diff" ], - "tool_call_rules": [] + "tool_call_rules": [ + { + "id": "require-bootstrap-workspace-write", + "require_tool_use": true, + "min_tool_calls": 1, + "require_one_of": [ + "workspace_write", + "workspace_edit", + "workspace_apply_patch" + ] + } + ] }, "meta": { "source_type": "runtime-agent-package", "source_package": "user-docs-agent", - "source_version": "02e01e6d72ee158e45413185c32fcf30a5a04724", + "source_version": "f3d965758c6318bd900b32d7fb91ccae125c3204", "role": "user-docs-bootstrap", "runtime": "agents-api-native-chat", "default_provider": "openai", diff --git a/ci/docs-agent-runner-recipe.json b/ci/docs-agent-runner-recipe.json index 6052ad0..56bea06 100644 --- a/ci/docs-agent-runner-recipe.json +++ b/ci/docs-agent-runner-recipe.json @@ -5,7 +5,7 @@ "docsAgent": { "externalPackageSource": { "repository": "Automattic/docs-agent", - "revision": "a51e79ac698610177852170332a1135a9c315951", + "revision": "f3d965758c6318bd900b32d7fb91ccae125c3204", "path": "bundles/technical-docs-agent/native/technical-docs-maintenance-agent.agent.json", "digest": "sha256-bytes-v1:975c7b0a0a7aff52897c52be5ac903a7fb110ea3c33e16227f8694c74c932519" }, diff --git a/examples/runner-recipe.example.json b/examples/runner-recipe.example.json index 3a1504b..942053e 100644 --- a/examples/runner-recipe.example.json +++ b/examples/runner-recipe.example.json @@ -5,7 +5,7 @@ "docsAgent": { "externalPackageSource": { "repository": "Automattic/docs-agent", - "revision": "a51e79ac698610177852170332a1135a9c315951", + "revision": "f3d965758c6318bd900b32d7fb91ccae125c3204", "path": "bundles/technical-docs-agent/native/technical-docs-maintenance-agent.agent.json", "digest": "sha256-bytes-v1:975c7b0a0a7aff52897c52be5ac903a7fb110ea3c33e16227f8694c74c932519" }, diff --git a/tests/native-agent-import.php b/tests/native-agent-import.php index 6a8d711..be9fd7a 100644 --- a/tests/native-agent-import.php +++ b/tests/native-agent-import.php @@ -71,16 +71,17 @@ public function get_error_data(): mixed { $rules = is_array( $config['tool_call_rules'] ?? null ) ? $config['tool_call_rules'] : array(); agents_api_smoke_assert_equals( true, in_array( 'workspace_write', $config['enabled_tools'] ?? array(), true ), "{$slug} preserves the workspace write tool", $failures, $passes ); - if ( 'technical-docs-bootstrap-agent' === $slug ) { + if ( in_array( $slug, array( 'technical-docs-bootstrap-agent', 'user-docs-bootstrap-agent' ), true ) ) { + $required_path = 'user-docs-bootstrap-agent' === $slug ? 'docs/user/getting-started.md' : 'docs/README.md'; $gate = AgentsAPI\AI\WP_Agent_Tool_Call_Gate::from_config( $rules ); agents_api_smoke_assert_equals( true, $gate instanceof AgentsAPI\AI\WP_Agent_Tool_Call_Gate, "{$slug} creates a completion gate for a fresh documentation surface", $failures, $passes ); - $fresh_surface = array( AgentsAPI\AI\WP_Agent_Message::text( 'user', 'The workspace has no docs/README.md. Create the caller-required documentation paths.' ) ); + $fresh_surface = array( AgentsAPI\AI\WP_Agent_Message::text( 'user', "The workspace has no {$required_path}. Create the caller-required documentation paths." ) ); $blocked = $gate instanceof AgentsAPI\AI\WP_Agent_Tool_Call_Gate ? $gate->evaluate_completion( $fresh_surface ) : array(); agents_api_smoke_assert_equals( false, $blocked['allowed'] ?? null, "{$slug} blocks prose-only completion on a fresh documentation surface", $failures, $passes ); agents_api_smoke_assert_equals( 'require-bootstrap-workspace-write', $blocked['context']['rule_id'] ?? '', "{$slug} identifies the required bootstrap write gate", $failures, $passes ); - $after_write = array_merge( $fresh_surface, array( AgentsAPI\AI\WP_Agent_Message::toolCall( '', 'workspace_write', array( 'path' => 'docs/README.md' ), 1, array( 'tool_call_id' => 'bootstrap-docs-index' ) ) ) ); + $after_write = array_merge( $fresh_surface, array( AgentsAPI\AI\WP_Agent_Message::toolCall( '', 'workspace_write', array( 'path' => $required_path ), 1, array( 'tool_call_id' => 'bootstrap-docs-index' ) ) ) ); $allowed = $gate instanceof AgentsAPI\AI\WP_Agent_Tool_Call_Gate ? $gate->evaluate_completion( $after_write ) : array(); agents_api_smoke_assert_equals( true, $allowed['allowed'] ?? null, "{$slug} accepts completion after a required workspace write", $failures, $passes ); } else { diff --git a/tests/native-agent.validate-package-spec.json b/tests/native-agent.validate-package-spec.json index 0f41662..ddec158 100644 --- a/tests/native-agent.validate-package-spec.json +++ b/tests/native-agent.validate-package-spec.json @@ -83,9 +83,15 @@ "user-docs-bootstrap-agent.agent.json": { "package": "user-docs-agent", "agent_slug": "user-docs-bootstrap-agent", - "source_revision": "02e01e6d72ee158e45413185c32fcf30a5a04724", + "source_revision": "f3d965758c6318bd900b32d7fb91ccae125c3204", "required_tools": ["get_github_file", "workspace_read", "workspace_grep", "workspace_write", "workspace_git_status", "workspace_git_diff"], "permitted_workspace_tools": ["workspace_show", "workspace_ls", "workspace_read", "workspace_grep", "workspace_write", "workspace_edit", "workspace_apply_patch", "workspace_git_status", "workspace_git_diff"], + "required_tool_call_rule": { + "id": "require-bootstrap-workspace-write", + "require_tool_use": true, + "min_tool_calls": 1, + "require_one_of": ["workspace_write", "workspace_edit", "workspace_apply_patch"] + }, "instructions_must_contain": ["non-technical product documentation", "frontend users", "one-shot first-run user documentation generation pass", "product-facing evidence", "complete initial documentation system", "docs/user/", "consumer-declared writable paths", "required documentation write", "workspace_git_status", "workspace_git_diff"] }, "user-docs-maintenance-agent.agent.json": { diff --git a/tests/reusable-workflow-empty-called-workflow-context.fixture.json b/tests/reusable-workflow-empty-called-workflow-context.fixture.json index 789b382..0e5ab9f 100644 --- a/tests/reusable-workflow-empty-called-workflow-context.fixture.json +++ b/tests/reusable-workflow-empty-called-workflow-context.fixture.json @@ -3,5 +3,5 @@ "called_workflow_context": { "job_workflow_sha": "" }, - "expected_package_revision": "a51e79ac698610177852170332a1135a9c315951" + "expected_package_revision": "f3d965758c6318bd900b32d7fb91ccae125c3204" } diff --git a/tests/validate-docs-agent-packages.php b/tests/validate-docs-agent-packages.php index 44a1bf3..9c67a88 100644 --- a/tests/validate-docs-agent-packages.php +++ b/tests/validate-docs-agent-packages.php @@ -45,7 +45,7 @@ $assert( 'docs-agent/runner-recipe/v1' === ( $recipe['schema'] ?? null ), 'Runner recipe must use the portable Docs Agent runner recipe schema.' ); $expected_package_source = array( 'repository' => 'Automattic/docs-agent', - 'revision' => 'a51e79ac698610177852170332a1135a9c315951', + 'revision' => 'f3d965758c6318bd900b32d7fb91ccae125c3204', 'path' => 'bundles/technical-docs-agent/native/technical-docs-maintenance-agent.agent.json', 'digest' => 'sha256-bytes-v1:975c7b0a0a7aff52897c52be5ac903a7fb110ea3c33e16227f8694c74c932519', ); diff --git a/tests/validate-external-native-package-sources.php b/tests/validate-external-native-package-sources.php index f5aaf31..898c908 100644 --- a/tests/validate-external-native-package-sources.php +++ b/tests/validate-external-native-package-sources.php @@ -30,11 +30,11 @@ return $contents; }; -$package_revision = 'a51e79ac698610177852170332a1135a9c315951'; +$package_revision = 'f3d965758c6318bd900b32d7fb91ccae125c3204'; $packages = array( - 'technical:bootstrap' => array( 'path' => 'bundles/technical-docs-agent/native/technical-docs-bootstrap-agent.agent.json', 'slug' => 'technical-docs-bootstrap-agent', 'digest' => '124924f004474d5296294a3f2c99285d0848c46ed622926b1b283ed018b2bcf0' ), + 'technical:bootstrap' => array( 'path' => 'bundles/technical-docs-agent/native/technical-docs-bootstrap-agent.agent.json', 'slug' => 'technical-docs-bootstrap-agent', 'digest' => '21b4efe1323ace3fd9c445c3eae36d42c128bc1e3d2dd0b575b89ecb38b02eae' ), 'technical:maintenance' => array( 'path' => 'bundles/technical-docs-agent/native/technical-docs-maintenance-agent.agent.json', 'slug' => 'technical-docs-maintenance-agent', 'digest' => '975c7b0a0a7aff52897c52be5ac903a7fb110ea3c33e16227f8694c74c932519' ), - 'user:bootstrap' => array( 'path' => 'bundles/user-docs-agent/native/user-docs-bootstrap-agent.agent.json', 'slug' => 'user-docs-bootstrap-agent', 'digest' => 'a3ada797a125f638364caac43004bbb47fcc8c7bdc89021f25fcfcdc4c2d502f' ), + 'user:bootstrap' => array( 'path' => 'bundles/user-docs-agent/native/user-docs-bootstrap-agent.agent.json', 'slug' => 'user-docs-bootstrap-agent', 'digest' => '526ff81a024f75445ab44fcad16910c0b9b8f8765c3cba930490469eb1af74d3' ), 'user:maintenance' => array( 'path' => 'bundles/user-docs-agent/native/user-docs-maintenance-agent.agent.json', 'slug' => 'user-docs-maintenance-agent', 'digest' => '747de10fdb52d7c1543b404030e0e0a2604b6496e95d50143149f72c975a98fb' ), 'skills:maintenance' => array( 'path' => 'bundles/skills-agent/native/skills-maintenance-agent.agent.json', 'slug' => 'skills-maintenance-agent', 'digest' => '0f8d35fe0026aa62b9ddf2e86c4f9432b4d8aae90757dfbaf334d4a0671fb8a3' ), ); diff --git a/tests/validate-wp-codebox-run-agent-task-contract.php b/tests/validate-wp-codebox-run-agent-task-contract.php index bf2237b..6a28d06 100644 --- a/tests/validate-wp-codebox-run-agent-task-contract.php +++ b/tests/validate-wp-codebox-run-agent-task-contract.php @@ -236,7 +236,7 @@ $assert( isset( $caller_inputs['external_package_source'] ), 'Docs Agent must provide the required external package descriptor.' ); $assert( ! isset( $caller_inputs['agent_bundle'] ), 'Docs Agent must not pass the removed agent_bundle input.' ); -$assert( str_contains( $workflow, 'DOCS_AGENT_PACKAGE_REVISION: a51e79ac698610177852170332a1135a9c315951' ), 'Docs Agent must use the fixed native package source revision.' ); +$assert( str_contains( $workflow, 'DOCS_AGENT_PACKAGE_REVISION: f3d965758c6318bd900b32d7fb91ccae125c3204' ), 'Docs Agent must use the fixed native package source revision.' ); $assert( ! str_contains( $workflow, 'github.job_workflow_sha' ), 'Docs Agent must not depend on unavailable called-workflow provenance.' ); preg_match( "/runtime_sources='(?[^']+)'/", $workflow, $runtime_sources_match );