File size: 1,558 Bytes
5873600 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | """Stage observational Full-Pi recovery evidence before task source identity."""
from __future__ import annotations
import hashlib
import shutil
from pathlib import Path
AUDIT_PATH = "/logs/agent/pi/provider-private.jsonl"
def capture_configuration(source_package: Path) -> dict:
extension = source_package / "pi-capture.js"
return {
"schema_version": 1,
"mode": "private-lossless-provider-and-pi-state-v1",
"extension_sha256": hashlib.sha256(extension.read_bytes()).hexdigest(),
"provider_audit": AUDIT_PATH,
"signature_map": "/logs/agent/pi/google-thought-signatures.json",
"restoration_state": "/logs/agent/pi/pi-restoration-state.json",
"private_mode": "0600",
"authentication_headers_exported": False,
"filesystem_checkpoint_marker_only": True,
"model_prompts_tools_parameters_changed": False,
}
def stage_capture(source_package: Path, agent: Path) -> None:
target = agent / "collab_harbor/pi-capture.js"
target.parent.mkdir(parents=True, exist_ok=True)
shutil.copyfile(source_package / "pi-capture.js", target)
target.chmod(0o644)
def docker_capture_lines() -> str:
# The filename loads after collab-google.js so the saved request is the wire
# payload after its unchanged opaque-metadata projection.
return (
"COPY collab_harbor/pi-capture.js /tmp/harbor-pi-agent/extensions/zz-provider-capture.js\n"
f"ENV CI_PI_PROVIDER_PRIVATE_AUDIT={AUDIT_PATH}\n"
"ENV CI_PI_RESTORED_COMPLETED_TURNS=0\n"
)
|