fix(gateway): constrain verified Qwen replies to emotion schema
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Restore only exact v050-deployed files, from its own backup; no model/container actions."""
|
||||
"""Restore only exact deployed files, from their own backup; no model/container actions."""
|
||||
import json,subprocess
|
||||
from pathlib import Path
|
||||
REMOTE=r'''
|
||||
@@ -8,7 +8,7 @@ from pathlib import Path
|
||||
root=Path('/home/gorios-spark-2/lan-voice');backup=Path(record['backup']).resolve()
|
||||
assert backup.is_relative_to((root/'.runtime/backups').resolve())
|
||||
for name,expected in record['hashes'].items():
|
||||
assert name.endswith('.py') and not Path(name).is_absolute() and '..' not in Path(name).parts
|
||||
assert (name.endswith('.py') or name in ('personas/lvbu.lorebook.json','personas/yangmi.lorebook.json')) and not Path(name).is_absolute() and '..' not in Path(name).parts
|
||||
assert hashlib.sha256((root/name).read_bytes()).hexdigest()==expected, 'concurrent source change: refusing rollback'
|
||||
ctx=ssl.create_default_context(cafile=str(root/'.runtime/gateway-cert.pem'))
|
||||
opener=urllib.request.build_opener(urllib.request.ProxyHandler({}),urllib.request.HTTPSHandler(context=ctx))
|
||||
@@ -20,6 +20,9 @@ metadata=json.loads((backup/'metadata.json').read_text())
|
||||
assert hashlib.sha256(subprocess.check_output(['systemctl','--user','cat','lan-voice-gateway.service'])).hexdigest()==metadata['unit_sha256'], 'unit changed: refusing rollback'
|
||||
for name,row in metadata['private_files'].items():
|
||||
assert hashlib.sha256(Path(name).read_bytes()).hexdigest()==row['sha256'], 'private environment changed: refusing rollback'
|
||||
assert not health().get('busy'), 'busy before restore: refusing restart'
|
||||
for name,expected in record['hashes'].items():
|
||||
assert hashlib.sha256((root/name).read_bytes()).hexdigest()==expected, 'source changed before restore'
|
||||
for name,present in manifest.items():
|
||||
path=root/name
|
||||
if present:
|
||||
|
||||
Reference in New Issue
Block a user