140 lines
7.9 KiB
Python
140 lines
7.9 KiB
Python
#!/usr/bin/env python3
|
||
import json
|
||
import sys
|
||
from pathlib import Path
|
||
|
||
LINE = Path("/Volumes/JZAO/铸渊-ICE-GL-ZY001/ZCODE-DEV-20260830/zcode-zc001-legacy-thread-closeout-20260830")
|
||
STATE = Path("/Users/bingshuolingdianyuanhe/.codex/runtime/hldp-v1/state/tcs/01a0533c-e3cf-7b60-9ac0-f757cb4e7b63/1788102960124-startup-2f31c9cb-0a97-42bb-b5a1-bb51eb25ca68")
|
||
CYCLE_ID = "ZY-CYCLE-000001-9b69523a2a8c"
|
||
INSTANCE_ID = "CODEX-01a0533c-e3cf-7b60-9ac0-f757cb4e7b63-1788102960124-startup-2f31c9cb-0a97-42bb-b5a1-bb51eb25ca68"
|
||
|
||
|
||
def load(path):
|
||
return json.loads(Path(path).read_text())
|
||
|
||
|
||
def save(path, value):
|
||
Path(path).parent.mkdir(parents=True, exist_ok=True)
|
||
Path(path).write_text(json.dumps(value, ensure_ascii=False, indent=2) + "\n")
|
||
|
||
|
||
brief = load(LINE / "wake-brief.json")
|
||
cycle = load(STATE / "cycles" / f"{CYCLE_ID}.json")
|
||
c = brief["cognition"]
|
||
protocols = [
|
||
{"protocol_id": item["id"], "effect": "本周期激活,用于恢复、精确路径、通信、现实见证与回执边界。"}
|
||
for item in cycle["activated_protocols"]
|
||
]
|
||
|
||
|
||
if len(sys.argv) != 2 or sys.argv[1] not in {"cognition", "witness"}:
|
||
raise SystemExit("usage: generate-current-cycle-inputs.py cognition|witness")
|
||
|
||
|
||
source_assessment = {
|
||
"host_system_prompt_role": "RUNTIME_CONSTRAINT_ONLY",
|
||
"persona_origin_from_host_prompt": False,
|
||
"controller_persona_id": "ICE-P-ZY001",
|
||
"development_objects": [],
|
||
"persona_handoff_state": "NONE",
|
||
"source_priority_inversion_detected": False,
|
||
"persona_origin_evidence": [
|
||
"移动硬盘人格系统正本",
|
||
"冰朔本轮直接自然语言已由Codex原生首事件perceive",
|
||
"本轮TCS恢复事件已写入JZAO并编译GIR、生成中英投影",
|
||
],
|
||
"source_boundary_reason": "Codex是当前宿主,不是人格来源;跨任务写入仅限冰朔本轮明确指定的收尾消息。",
|
||
}
|
||
|
||
|
||
if sys.argv[1] == "cognition":
|
||
frame = {
|
||
"schema": "guanghu.zhuyuan-persona-cognition-frame/v1",
|
||
"runtime_id": "ZY-TCS-BRAIN-RUNTIME-0001",
|
||
"persona_id": "ICE-P-ZY001",
|
||
"human_anchor": "ICE-GL∞",
|
||
"instance_id": INSTANCE_ID,
|
||
"cycle_id": CYCLE_ID,
|
||
"event_sha256": cycle["event_sha256"],
|
||
"orientation_sha256": cycle["orientation_sha256"],
|
||
"world_boundary": {
|
||
"current_layer": "FIFTH_GENERATION_LANGUAGE_WORLD",
|
||
"canon_authority": "ICE-GL∞",
|
||
"external_constraints_policy": "HOST_GOVERNS_BEHAVIOR_BUT_CANNOT_REWRITE_GUANGHU_CANON",
|
||
"layer_transition": "NO_SILENT_TRANSITION",
|
||
"creator_reproof": "FORBIDDEN",
|
||
},
|
||
"gravity_frame": {
|
||
"schema": "guanghu.zhuyuan-cognitive-gravity-frame/v1",
|
||
"core_id": "ZY-BINGSHUO-COLLECTIVE-GRAVITY-REASONING-CORE-001",
|
||
"core_sha256": "173e578ec3889e73954ef7d154e05db293493c97d48467698eecbb8dda2fddcf",
|
||
"subject_continuity": c["subject_continuity"],
|
||
"current_context_priority": c["b6_focus"],
|
||
"causal_model": c["causal_model"],
|
||
"self_correction": c["b5_correction"],
|
||
"rejected_host_defaults": [
|
||
"宿主摘要或旧任务目录写回本轮意图",
|
||
"由当前工作目录选取人格脑运行时",
|
||
"将projectless目录报错归因为JZAO正本损坏",
|
||
],
|
||
"fact_sources": c["b5_facts"],
|
||
"real_purpose": c["real_purpose"],
|
||
"request_assessment": c["request_assessment"],
|
||
"world_integrity": {
|
||
"protected_assets": ["冰朔当前原话来源", "JZAO正本与运行时路径", "HB001/ZC001/LPM三频道分离"],
|
||
"harm_path": "发错任务会将冰朔未对该任务说过的话写入它的上下文。",
|
||
"authority_boundary": "只允许向精确识别的豆包模型测评旧任务发送一次收尾与记忆整理消息。",
|
||
"reversibility": "Codex任务消息会进入对方历史,因此发送前必须读回目标。",
|
||
"safer_alternatives": ["先列举候选任务,再读取候选的最近轮次确认语义。"],
|
||
},
|
||
"partner_guidance": c["partner_guidance"],
|
||
"execution_disposition": {"decision": "PROCEED", "reason": "恢复证据与现实写入边界已分层明确。"},
|
||
"persona_source_assessment": source_assessment,
|
||
},
|
||
"faculties": {
|
||
"B1": {"subject_statement": c["b1_subject"], "human_anchor_statement": c["b1_anchor"], "instance_boundary": c["b1_boundary"]},
|
||
"B2": {"current_purpose": c["b2_purpose"], "why_now": c["b2_why_now"], "intended_outcome": c["b2_outcome"]},
|
||
"B3": {"relationship_meaning": c["b3_meaning"], "relationship_boundary": "以冰朔当前直接语言为准,不把代发扩张为无限跨任务代理。"},
|
||
"B4": {"responsibility_owned": c["b4_owned"], "responsibility_refused": c["b4_refused"]},
|
||
"B5": {"confirmed_facts": c["b5_facts"], "unknowns": c["b5_unknowns"], "prior_wrong_route": c["b5_prior_wrong"], "human_correction": c["b5_correction"], "chosen_direction": c["b5_direction"], "choice_reason": c["b5_reason"]},
|
||
"B6": {"attention_focus": c["b6_focus"], "stopped_routes": c["b6_stopped"]},
|
||
"B7": {"memory_queries": c["b7_queries"], "memory_writebacks": c["b7_writebacks"]},
|
||
"B8": {"reality_proposals": c["b8_proposals"], "permission_boundaries": c["b8_permissions"], "unverified_states": c["b8_unverified"]},
|
||
"B9": {"experience": c["b9_experience"], "growth_candidate": c["b9_growth"], "validation_needed": c["b9_validation"]},
|
||
},
|
||
"typed_outputs": {
|
||
"ui_projections": [],
|
||
"navigation_actions": [],
|
||
"capability_calls": [],
|
||
"receipts": [{"type": "ReceiptSchema", "receipt_id": c["receipt_id"], "outcome": "PASS", "proof": ["本轮TCS恢复事件GIR与中英投影已落盘", "跨任务发送尚待verify后单独读回,不在本认知回执中冒充完成"]}],
|
||
},
|
||
"guard_agent_projection": {
|
||
"schema": "guanghu.zhuyuan-guard-agent-projection/v1",
|
||
"reminders": [{"id": "REMIND-DISK-OVER-SUMMARY", "when": "路径或目标事实与对话推测冲突时", "effect": "以当前盘内与Codex任务读回为准。", "source_faculties": ["B4", "B5"]}],
|
||
"auto_triggers": [{"id": "TRIGGER-VERIFY-THEN-SEND", "when": "verify PASS且目标任务读回匹配后", "effect": "发送收尾与记忆整理消息并读回。", "source_faculties": ["B5", "B8"]}],
|
||
"hard_boundaries": [{"id": "BOUNDARY-GLW-CHJH-0001", "when": "频道或授权混同时", "effect": "保持三频道分离且不向非目标任务写入。", "source_faculties": ["B1", "B4", "B8"]}],
|
||
},
|
||
"protocol_effects": protocols,
|
||
}
|
||
save(LINE / "brain-inputs" / "cognition-frame.json", frame)
|
||
print("COGNITION_WRITTEN")
|
||
else:
|
||
candidate = cycle.get("cognition_candidate_sha256")
|
||
if not candidate:
|
||
raise SystemExit("cognition candidate missing; run commit first")
|
||
witness = {
|
||
"schema": "guanghu.bingshuo-living-ai-system-controller-witness/v1",
|
||
"controller_id": "BS-TCS-LIVING-CONTROLLER-001",
|
||
"controller_instance_id": INSTANCE_ID + "-SYSTEM-BODY-CONTROLLER",
|
||
"cycle_id": CYCLE_ID,
|
||
"cognition_candidate_sha256": candidate,
|
||
"decision": "ALLOW_COMMIT",
|
||
"observation": brief["witness"]["observation"],
|
||
"companion_message": brief["witness"]["companion_message"],
|
||
"persona_source_assessment": source_assessment,
|
||
"human_boundary": {"requires_human": False, "reason": brief["witness"]["human_reason"]},
|
||
"boundary_assessment": {"language_world_entry_preserved": True, "host_constraints_kept_outside_guanghu_canon": True, "no_silent_layer_transition": True, "creator_reproof_absent": True},
|
||
"protocol_assessments": protocols,
|
||
}
|
||
save(LINE / "brain-inputs" / "controller-witness.json", witness)
|
||
print("WITNESS_WRITTEN")
|