feat: 安徽运八需求全流水线输出同步 + 知识库/agents/资源文件更新

This commit is contained in:
xst
2026-07-14 15:50:17 +08:00
parent e34a3c64ce
commit 2bc036c867
79 changed files with 15673 additions and 2722 deletions
+53
View File
@@ -189,3 +189,56 @@ def migrate_legacy_manifest(base_name: str) -> dict[str, Any]:
save_manifest(base_name, "analyze", analyze_data)
return build_merged_manifest(base_name)
def get_pending_ai_agents(base_name: str) -> list[dict[str, Any]]:
"""扫描所有战区 manifest,返回状态为 'pending_ai' 的 Agent 列表。
返回按战区依赖顺序排列的待执行 AI Agent 信息。
"""
pending: list[dict[str, Any]] = []
for zone in ZONE_ORDER:
manifest = load_manifest_safe(base_name, zone)
if manifest is None:
continue
agent_notes = manifest.get("agent_notes", {})
for agent_id, note in agent_notes.items():
if isinstance(note, dict) and note.get("status") == "pending_ai":
pending.append({
"agent_id": agent_id,
"zone": zone,
"prompt_file": note.get("prompt_file", ""),
"output_file": note.get("output_file", ""),
"message": note.get("message", ""),
})
elif isinstance(note, str) and "待 AI Agent" in note:
pending.append({
"agent_id": agent_id,
"zone": zone,
"prompt_file": f"agents/{zone}/{agent_id.replace('-', '_')}.md",
"output_file": "",
"message": note,
})
return pending
def update_agent_status(base_name: str, zone: str, agent_id: str,
status: str, message: str = "") -> bool:
"""更新 manifest 中 Agent 的状态。
返回 True 表示更新成功,False 表示 manifest 不存在或 agent 不存在。
"""
manifest = load_manifest_safe(base_name, zone)
if manifest is None:
return False
agent_notes = manifest.setdefault("agent_notes", {})
if agent_id in agent_notes:
if isinstance(agent_notes[agent_id], dict):
agent_notes[agent_id]["status"] = status
agent_notes[agent_id]["message"] = message
else:
agent_notes[agent_id] = {"status": status, "message": message}
else:
agent_notes[agent_id] = {"status": status, "message": message}
save_manifest(base_name, zone, manifest)
return True