Add pinned CPU engine dependencies, retained interrupted-response history, provider admission, offline evaluation and isolated browser tooling. Record Phase 2 acceptance and Phase 3/4 preparation, bounded paid-test accounting and interruption incident findings. Human interruption acceptance, paired OpenAI evaluation and rollback remain pending.
35 lines
1.3 KiB
Python
35 lines
1.3 KiB
Python
"""Use the actual engine launcher with the browser-only admission transport."""
|
|
import importlib.util
|
|
from pathlib import Path
|
|
from threading import Thread
|
|
|
|
from services.local_s2s.components import ComponentServer
|
|
import services.local_s2s.lifecycle as lifecycle
|
|
from services.local_s2s.engine import main
|
|
|
|
spec=importlib.util.spec_from_file_location('browser_budget','/checks/browser-budget.py')
|
|
module=importlib.util.module_from_spec(spec)
|
|
spec.loader.exec_module(module)
|
|
|
|
|
|
def start_components(key, timeout):
|
|
transport=module.BrowserBudget(Path('/evidence'))
|
|
class OwnedGateway(ComponentServer):
|
|
async def _run(self):
|
|
try:
|
|
await super()._run()
|
|
finally:
|
|
await transport.close_owned()
|
|
gateway=OwnedGateway(key,port=8766,transport=transport,timeout=timeout)
|
|
thread=Thread(target=gateway.serve_forever,daemon=True)
|
|
thread.start()
|
|
if not gateway.ready.wait(5):
|
|
raise RuntimeError('BROWSER_GATEWAY_NOT_READY')
|
|
return gateway,thread
|
|
|
|
lifecycle.start_components=start_components
|
|
# The key is mounted only into this engine, never Compose environment/API/browser.
|
|
import os
|
|
os.environ['OPENROUTER_API_KEY']=Path('/secret/openrouter-test.key').read_text().strip()
|
|
raise SystemExit(main())
|