import importlib.util
from pathlib import Path
s=importlib.util.spec_from_file_location('prior_ops','/tmp/codex/ltb1021/2026-09-23_pr13-ready_r01/ops.py')
m=importlib.util.module_from_spec(s);s.loader.exec_module(m)
globals().update({k:v for k,v in vars(m).items() if not k.startswith('_')})
HERE=Path(__file__).parent
PRIVATE=Path('/workspace/contextra-runtime-config/sender-training-20260927-r01')
def save(name,data,private=False):
    with ((PRIVATE if private else HERE)/name).open('x') as f:json.dump(data,f,indent=2)

def training(method='GET',body=None):
    token=Path('/workspace/contextra-runtime-config/secure-bridge/control-token').read_text().strip()
    r=urllib.request.Request('http://127.0.0.1:35000/internal/secure-control/training/settings',
        data=json.dumps(body).encode() if body else None,method=method,
        headers={'Authorization':'Bearer '+token,'Content-Type':'application/json'})
    with urllib.request.urlopen(r,timeout=5) as response:return json.load(response)
