feat: 安徽运八需求全流水线输出同步 + 知识库/agents/资源文件更新
This commit is contained in:
@@ -229,3 +229,71 @@ def validate_all_agents() -> dict[str, Any]:
|
||||
result["empty"].append(agent_id)
|
||||
result["valid"] = False
|
||||
return result
|
||||
|
||||
|
||||
def build_agent_invocation_context(base_name: str, agent_id: str) -> dict[str, Any]:
|
||||
"""为 AI Agent 调用构建完整的上下文注入字典。"""
|
||||
from fleet_manifest import ZONE_ORDER, load_manifest_safe
|
||||
|
||||
info = AGENT_REGISTRY.get(agent_id, {})
|
||||
zone = info.get("zone", "")
|
||||
|
||||
context: dict[str, Any] = {
|
||||
"base_name": base_name,
|
||||
"agent_id": agent_id,
|
||||
"agent_zone": zone,
|
||||
"repo_root": str(REPO_ROOT),
|
||||
"output_dir": str(REPO_ROOT / "output"),
|
||||
"manifests_dir": str(REPO_ROOT / "output" / "manifests"),
|
||||
"knowledge_base_dir": str(REPO_ROOT / "knowledge_base"),
|
||||
"fleet_config_path": str(REPO_ROOT / "fleet_config.yml"),
|
||||
"PROJECT_PROFILE": str(REPO_ROOT / "knowledge_base" / "00_project" / "project_profile.md"),
|
||||
"FLEET_CONFIG": str(REPO_ROOT / "fleet_config.yml"),
|
||||
}
|
||||
|
||||
for prev_zone in ZONE_ORDER:
|
||||
manifest = load_manifest_safe(base_name, prev_zone)
|
||||
if manifest is None:
|
||||
continue
|
||||
context[f"manifest_{prev_zone}"] = manifest
|
||||
for key, value in manifest.items():
|
||||
if key.endswith("_file") or key.endswith("_files"):
|
||||
context[key] = value
|
||||
if prev_zone == zone:
|
||||
break
|
||||
|
||||
return context
|
||||
|
||||
|
||||
def get_agent_input_files(base_name: str, agent_id: str) -> list[str]:
|
||||
"""返回 Agent 需要的所有输入文件路径列表。"""
|
||||
from fleet_manifest import ZONE_ORDER, load_manifest_safe
|
||||
|
||||
info = AGENT_REGISTRY.get(agent_id, {})
|
||||
zone = info.get("zone", "")
|
||||
input_files: list[str] = []
|
||||
|
||||
for prev_zone in ZONE_ORDER:
|
||||
if prev_zone == zone:
|
||||
break
|
||||
manifest = load_manifest_safe(base_name, prev_zone)
|
||||
if manifest is None:
|
||||
continue
|
||||
for key in manifest:
|
||||
if key.endswith("_file") or key.endswith("_files"):
|
||||
value = manifest[key]
|
||||
if isinstance(value, str):
|
||||
input_files.append(value)
|
||||
elif isinstance(value, list):
|
||||
input_files.extend(v for v in value if isinstance(v, str))
|
||||
|
||||
kb_files = [
|
||||
str(REPO_ROOT / "knowledge_base" / "00_project" / "project_profile.md"),
|
||||
str(REPO_ROOT / "knowledge_base" / "01_standards" / "test_case_template.md"),
|
||||
str(REPO_ROOT / "knowledge_base" / "01_standards" / "review_checklist.md"),
|
||||
str(REPO_ROOT / "knowledge_base" / "01_standards" / "definition_of_done.md"),
|
||||
str(REPO_ROOT / "fleet_config.yml"),
|
||||
]
|
||||
input_files.extend(kb_files)
|
||||
|
||||
return sorted(set(input_files))
|
||||
|
||||
Reference in New Issue
Block a user