Просмотр исходного кода

主机:更新阶段策略与 Root Goal 验收标准

Phase 2 策略改为 Goal 驱动的动态规划与 Host 机械闭包,Root 初始 criteria 增加 direction-goals-satisfied,同时保持三个阶段的边界隔离。
SamLee 12 часов назад
Родитель
Сommit
72cf351eda

+ 13 - 9
script_build_host/src/script_build_host/application/mission_factory.py

@@ -3,6 +3,7 @@
 from __future__ import annotations
 
 import json
+from collections.abc import Sequence
 from hashlib import sha256
 from math import isfinite
 
@@ -153,19 +154,20 @@ class ScriptMissionFactory:
                     "number and order of Structure, Paragraph, ElementSet, Retrieval and Compare "
                     "increments demanded by the active Direction Goals; siblings may cover "
                     "overlapping Goals. Every Phase2 contract has nonempty goal_ids, every "
-                    "creative Task pins the exact accepted Direction DecisionRef, and Compose "
-                    "and CandidatePortfolio carry all Direction Goal IDs. Retrieval needs valid "
-                    "goal_ids but need not read the whole Direction. Paragraph-first exploration "
+                    "creative Task is automatically pinned to the active accepted Direction, "
+                    "and Compose and CandidatePortfolio carry all Direction Goal IDs. "
+                    "Retrieval needs valid goal_ids but need not read the whole Direction. "
+                    "Paragraph-first exploration "
                     "may use a null base; a Paragraph patch must pin its accepted Structure, and "
                     "Compose may adopt any Paragraph only with a Structure covering its scope. "
                     "Compose and Portfolio remain non-executable containers until a REVISE "
-                    "partitions their complete accepted candidate closure and sets compose_order. "
+                    "selects accepted child Decision IDs; the Host partitions the complete "
+                    "candidate closure and freezes compose_order. "
                     "Compose adopts the creative frontier; Portfolio adopts exactly one accepted "
-                    "StructuredScript. Both container input_decision_refs also pin the active "
-                    "Direction. CandidatePortfolio and Compose write only script-build://writes; "
-                    "paragraph writers stay below script-build://writes/paragraphs and element "
-                    "writers below script-build://writes/elements. Respect the Host concurrency "
-                    "limit. After the unique Portfolio is validated and ACCEPTed, BLOCK Root "
+                    "StructuredScript. Artifact refs, digests, producer scopes, write scopes, "
+                    "schemas, budgets and closure fields are Host-owned. Respect the Host "
+                    "concurrency limit. After the unique Portfolio is validated and ACCEPTed, "
+                    "BLOCK Root "
                     "with PHASE_TWO_CANDIDATE_PORTFOLIO_READY."
                 ),
             },
@@ -208,6 +210,7 @@ class ScriptMissionFactory:
         snapshot: ScriptBuildInputSnapshotV1,
         *,
         direction_artifact_version_id: int,
+        direction_goal_ids: Sequence[str] = (),
     ) -> str:
         return json.dumps(
             {
@@ -219,6 +222,7 @@ class ScriptMissionFactory:
                 "accepted_direction_ref": (
                     f"script-build://artifact-versions/{direction_artifact_version_id}"
                 ),
+                "active_direction_goal_ids": list(direction_goal_ids),
                 "phase_boundary": "PHASE_TWO_CANDIDATE_PORTFOLIO_READY",
             },
             ensure_ascii=False,

+ 9 - 8
script_build_host/tests/test_mission_factory.py

@@ -80,20 +80,21 @@ def test_factory_reads_nested_real_topic_and_does_not_double_prefix_digest() ->
 
 def test_phase_prompts_isolate_boundaries_and_expose_dynamic_phase_two_invariants() -> None:
     factory = ScriptMissionFactory()
+    planner_prompt = " ".join(PLANNER_PROMPT.split())
     assert "PHASE_TWO_CANDIDATE_PORTFOLIO_READY" not in PLANNER_PROMPT
-    assert "using the returned Direction Task ID as `parent_task_id`" in PLANNER_PROMPT
-    assert "`PHASE_ONE_CAPABILITY_BOUNDARY` with no additional text" in PLANNER_PROMPT
+    assert "Direction 下创建并 ACCEPT 所需 Retrieval" in planner_prompt
+    assert "阶段策略给出的精确 reason" in planner_prompt
     phase_two = factory.build_phase_two_policy(_snapshot())
     assert "PHASE_TWO_CANDIDATE_PORTFOLIO_READY" in phase_two
     assert "Create exactly one CandidatePortfolio as Root's Phase2 child" in phase_two
     assert "Plan any number and order" in phase_two
     assert "Every Phase2 contract has nonempty goal_ids" in phase_two
-    assert "pins the exact accepted Direction DecisionRef" in phase_two
+    assert "automatically pinned to the active accepted Direction" in phase_two
     assert "carry all Direction Goal IDs" in phase_two
     assert "Paragraph-first exploration may use a null base" in phase_two
     assert "only with a Structure covering its scope" in phase_two
-    assert "partitions their complete accepted candidate closure" in phase_two
-    assert "CandidatePortfolio and Compose write only script-build://writes" in phase_two
-    assert "paragraph writers stay below script-build://writes/paragraphs" in phase_two
-    assert "element writers below script-build://writes/elements" in phase_two
-    assert "derive a strategy reference" in PARAGRAPH_WORKER_PROMPT
+    assert "selects accepted child Decision IDs" in phase_two
+    assert "Host partitions the complete candidate closure" in phase_two
+    assert "write scopes" in phase_two
+    assert "closure fields are Host-owned" in phase_two
+    assert "不能从名称或 objective 猜测" in PARAGRAPH_WORKER_PROMPT