chore(v2): 从兴邦预审v2白名单抽取独立可运行基座
按 docs/v2/05-implementation-plan.md §1 候选迁移表与 claude_use/T00 白名单, 从 55e2cdb 抽取 224 个文件(2.48 MB)到独立目录 F:/mini-OpenClaw-v2。 - 排除:凭据(.env/server-deploy.conf/旧DELIVERY.md)、运行数据(xingbang_data 等 4 个 SQLite)、依赖(venv/node_modules 符号链接)、归档(_backup*/test-evidence/ ori_file)、Office 临时文件 - 目标目录独立 git 仓库,初始恢复点;Gitea 远程与分支待 OQ-06 Q2 定案 - 未部署、未启动服务、未调用模型 Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
"""Read-only project index and cross-agent snapshot linkage."""
|
||||
from fastapi import APIRouter, Depends, Request
|
||||
from api import risk_agent_config as risk
|
||||
from api.collateral_agent import decorated, existing_rows, storage
|
||||
from api.risk_agent_access import authorize
|
||||
|
||||
router = APIRouter(prefix="/api/xingbang/risk-agent/workspace", dependencies=[Depends(authorize)])
|
||||
|
||||
|
||||
@router.get("/projects")
|
||||
def projects(request: Request):
|
||||
with risk._db() as db:
|
||||
storage(db)
|
||||
objects = {}
|
||||
for table, key in (("runs", "risk"), ("report_documents", "report"), ("coordination_projects", "coordination"), ("collateral_cases", "collateral")):
|
||||
for obj in existing_rows(db, table):
|
||||
project_id = obj["project_id"]
|
||||
user = request.state.identity
|
||||
if "*" not in user.get("projects", []) and project_id not in user.get("projects", []):
|
||||
continue
|
||||
entry = objects.setdefault(project_id, {"project_id": project_id, "risk": None, "report": None, "coordination": None, "collateral": None})
|
||||
if entry[key] is not None:
|
||||
continue
|
||||
if key == "risk":
|
||||
entry[key] = {"id": obj["id"], "time": obj["time"], "findings": len(obj["findings"]), "customer": obj.get("values", {}).get("customer.name", "")}
|
||||
elif key == "report":
|
||||
entry[key] = {"id": obj["id"], "status": obj["status"], "version": obj["version"], "source_id": obj["source_id"]}
|
||||
elif key == "coordination":
|
||||
entry[key] = {"id": obj["id"], "stage": obj["stage"], "owner": obj["owner_name"], "open_tasks": sum(t["status"] != "已解决" for t in obj["tasks"]), "plan_version": len(obj["plans"])}
|
||||
else:
|
||||
case = decorated(db, obj)
|
||||
entry[key] = {"id": obj["id"], "stale": case["stale"], "open_checks": sum(c["status"] != "pass" for c in (obj.get("result") or {}).get("checks", [])), "has_result": bool(obj.get("result"))}
|
||||
return {"projects": list(objects.values()), "identity": request.state.identity}
|
||||
|
||||
|
||||
def report_links(db, project_id, source_id):
|
||||
from api.collateral_agent import current_plan
|
||||
coord, plan = current_plan(db, project_id)
|
||||
case = next((c for c in existing_rows(db, "collateral_cases") if c["project_id"] == project_id and c["source_id"] == source_id and c.get("result") and not decorated(db, c)["stale"]), None)
|
||||
return {"coordination_id": coord["id"] if coord else None, "plan": plan,
|
||||
"verification": {"case_id": case["id"], "result": case["result"]} if case else None}
|
||||
Reference in New Issue
Block a user