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,35 @@
|
||||
"""Tools scoped to an immutable authorized risk run, not the production database."""
|
||||
import json
|
||||
from copy import deepcopy
|
||||
from langchain_core.tools import tool
|
||||
|
||||
|
||||
def create_risk_tools(context, evidence, native_skills):
|
||||
snapshot = deepcopy(context)
|
||||
sources = deepcopy(evidence)
|
||||
skills = deepcopy(native_skills)
|
||||
|
||||
@tool
|
||||
def list_data_cards() -> str:
|
||||
"""List authorized peer data-card snapshots available for this risk task."""
|
||||
return json.dumps([{"index":i,"name":d["card"],"version":d["version"],"records":len(d["records"])} for i,d in enumerate(snapshot.get("peer_datasets",[]))],ensure_ascii=False)
|
||||
|
||||
@tool
|
||||
def read_data_card(index: int) -> str:
|
||||
"""Read one authorized data-card snapshot, including periods and raw evidence."""
|
||||
cards = snapshot.get("peer_datasets", [])
|
||||
if index < 0 or index >= len(cards):
|
||||
return json.dumps({"error":"数据卡不在本次授权范围"},ensure_ascii=False)
|
||||
return json.dumps(cards[index],ensure_ascii=False)
|
||||
|
||||
@tool
|
||||
def read_checks_and_rules() -> str:
|
||||
"""Read deterministic Skill outputs, human rules and rule findings for this run."""
|
||||
return json.dumps({"values":snapshot.get("scalar_values",{}),"human_rules":snapshot.get("human_rules",[]),"findings":snapshot.get("rule_findings",[]),"evidence":sources},ensure_ascii=False)
|
||||
|
||||
@tool
|
||||
def read_selected_skill(skill_id: str) -> str:
|
||||
"""Read only a native SKILL.md explicitly selected in the published plan."""
|
||||
return skills.get(skill_id,"此 Skill 未被所选方案授权")
|
||||
|
||||
return [list_data_cards, read_data_card, read_checks_and_rules, read_selected_skill]
|
||||
Reference in New Issue
Block a user