Bläddra i källkod

主机:简化 Planner 与批量创作工具参数合同

新增 Planner 精简输入、Direction client_key、批量 Paragraph 创建更新和 Validator evidence 参数 schema,移除模型填写机械 Artifact 字段的旧入口,并更新参数归一化测试。
SamLee 1 dag sedan
förälder
incheckning
05c05bc970

+ 11 - 0
script_build_host/src/script_build_host/tools/contracts.py

@@ -11,6 +11,8 @@ from __future__ import annotations
 from collections.abc import Mapping, Sequence
 from typing import Any, Protocol
 
+from agent.orchestration import ArtifactRef
+
 from script_build_host.domain.phase_two_ports import AttemptManifest
 
 
@@ -34,6 +36,7 @@ class ScriptPlannerToolPort(Protocol):
         validation_id: str | None,
         replacement_contract: Mapping[str, Any] | None,
         child_contracts: Sequence[Mapping[str, Any]],
+        selected_decision_ids: Sequence[str],
         context: Mapping[str, Any],
     ) -> Mapping[str, Any]: ...
 
@@ -64,6 +67,10 @@ class ScriptCandidateToolPort(Protocol):
         self, *, context: Mapping[str, Any]
     ) -> Sequence[Mapping[str, Any]]: ...
 
+    async def validation_evidence_refs(
+        self, *, context: Mapping[str, Any]
+    ) -> Sequence[ArtifactRef]: ...
+
     async def view_frozen_images(
         self,
         *,
@@ -147,6 +154,10 @@ class RootDeliveryToolPort(Protocol):
         self, *, context: Mapping[str, Any]
     ) -> Sequence[Mapping[str, Any]]: ...
 
+    async def validation_evidence_refs(
+        self, *, context: Mapping[str, Any]
+    ) -> Sequence[ArtifactRef]: ...
+
 
 __all__ = [
     "AttemptManifest",

+ 14 - 5
script_build_host/tests/test_tool_argument_normalization.py

@@ -3,7 +3,6 @@ from __future__ import annotations
 from typing import Any
 
 import pytest
-
 from agent import ToolRegistry
 
 from script_build_host.tools.registry import (
@@ -35,7 +34,7 @@ def test_structured_arguments_enforce_item_and_byte_limits() -> None:
         _structured_object({"value": "x" * (2 * 1024 * 1024)}, "payload")
 
 
-def test_planner_schema_exposes_the_complete_contract_shape() -> None:
+def test_planner_schema_exposes_only_semantic_inputs_and_decision_ids() -> None:
     from script_build_host.tools.registry import register_script_tools
 
     registry = ToolRegistry()
@@ -46,8 +45,18 @@ def test_planner_schema_exposes_the_complete_contract_shape() -> None:
     contract = contracts["items"]
 
     assert contracts["type"] == "array"
-    assert contract["properties"]["schema_version"]["const"] == "script-task-contract/v1"
-    assert "schema_version" in contract["required"]
+    assert "schema_version" not in contract["properties"]
+    assert "input_decision_ids" in contract["required"]
+    for derived in (
+        "input_decision_refs",
+        "base_artifact_ref",
+        "write_scope",
+        "output_schema",
+        "budget",
+        "candidate_closure_decision_refs",
+        "compose_order",
+    ):
+        assert derived not in contract["properties"]
     assert contract["properties"]["task_kind"]["enum"] == [
         "direction",
         "pattern-retrieval",
@@ -83,7 +92,7 @@ async def test_retrieval_tool_freezes_and_submits_in_one_terminal_call() -> None
     gateway = Gateway()
     registry = ToolRegistry()
     register_script_tools(registry, gateway)  # type: ignore[arg-type]
-    tool = registry._tools["search_knowledge"]["func"]  # noqa: SLF001
+    tool = registry._tools["search_knowledge"]["func"]
 
     result = await tool(keyword="hard tech", max_count=3, context={"task_id": "task-1"})