Files
Mikei386 c0bc5d3a1b Integrate Basalt telemetry and shared GPU speech runtimes
Publish the reviewed accumulated runtime, scheduler, profile, UI, native recipes and historical maintenance evidence. Includes Qwen GPU ASR correction and shared Anna/atelier ownership. Validated with 784 local tests, Python/JSON parsing and eight JavaScript syntax checks. Live GPU acceptance and full fresh-host restore limits remain documented.
2026-11-03 21:16:41 +01:00

38 lines
3.0 KiB
Python

#!/usr/bin/env python3
"""Athena host: correct owned overlay directory modes, constructor-test, finish activation."""
import importlib.util
import json
from pathlib import Path
import subprocess
import time
ROOT=Path('/opt/athena-deck-dev/basalt-deck-activation')
BASE=Path('/opt/athena-deck-dev/runtime')
CANON=Path('/opt/athena-deck-dev/source')
r=json.loads((ROOT/'activation.json').read_text())
d=json.loads(subprocess.check_output(['docker','inspect','athena-deck-dev'],text=True))[0]
assert d['Image']==r['image_id'] and (d['State']['Health']['Status']=='unhealthy' or not d['State']['Running'])
subprocess.run(['docker','stop','--timeout','10','athena-deck-dev'],check=True)
assert subprocess.check_output(['docker','image','inspect','--format','{{.Id}}',r['image_before']],text=True).strip()==r['image_id_before']
(ROOT/'image/Dockerfile').write_text('FROM '+r['image_before']+'\nUSER root\nCOPY app/ /app/\nUSER 65534:65534\n')
with (ROOT/'image-repair.log').open('w') as out:subprocess.run(['docker','build','--network','none','--pull=false','-t',r['image'],ROOT/'image'],stdout=out,stderr=subprocess.STDOUT,check=True,timeout=180)
image_id=subprocess.check_output(['docker','image','inspect','--format','{{.Id}}',r['image']],text=True).strip()
probe='''from pathlib import Path
import tempfile
from server import Server
with tempfile.TemporaryDirectory() as tmp:
s=Server(0,state_dir=Path(tmp))
s.endpoint.close();s.video.close();s.dashboard.close();s.server_close()
print('Full isolated Server constructor passed; no model or production state')
'''
subprocess.run(['docker','run','--rm','--network','none','--read-only','--user','65534:65534','--memory','512m','--pids-limit','256','--cap-drop','ALL','-e','NVIDIA_VISIBLE_DEVICES=void','-e','DECK_REQUIRE_SETUP=0','-e','DECK_NETWORK_MODE=disabled','-e','TMPDIR=/test-tmp','--mount','type=bind,src='+str(BASE/'state/basalt-runtime/tmp')+',dst=/test-tmp','--entrypoint','python3',image_id,'-B','-c',probe],check=True,timeout=45)
spec=importlib.util.spec_from_file_location('deck_install',CANON/'deploy/install.py');assert spec and spec.loader
installer=importlib.util.module_from_spec(spec);spec.loader.exec_module(installer)
config=dict(r['manifest_before'],image=r['image'],previous_image=r['image_before'],pids_limit=2048)
subprocess.run(['docker','rm','athena-deck-dev'],check=True)
installer.launch(config);installer.ready(config);installer.write_manifest(BASE,config)
a=json.loads(subprocess.check_output(['docker','inspect','athena-deck-dev'],text=True))[0];assert a['Image']==image_id and a['State']['Running']
p=next(p for p in json.loads((BASE/'state/profiles.json').read_text()) if p['id']=='0c25bfe00240414397c41a980ecbe4f0')
r.update(phase='activated; short text/vision acceptance required',image_id=image_id,profile_after=p,pids_limit=2048,updated_at=time.time(),directory_modes_corrected=True,full_constructor_verified=True)
p=ROOT/'activation.json';p.write_text(json.dumps(r,indent=2));assert json.loads(p.read_text())==r
print(json.dumps(dict(activated=True,image_id=image_id,profile='Flash Next Basalt',slots=2,context_per_slot=262144)))