Integrate corrected char expressions into Liam code36

This commit is contained in:
zenord
2026-10-14 20:46:10 +08:00
parent 0c386ac8ec
commit 99a03e0487
23 changed files with 607 additions and 59 deletions
+11 -3
View File
@@ -19,7 +19,11 @@ ROOT=Path(__file__).resolve().parents[1]
parser=argparse.ArgumentParser(description=__doc__)
parser.add_argument('--gateway-source',type=Path,default=ROOT/'gateway',
help='Existing canonical source or read-only snapshot; never changes/deploys the gateway')
parser.add_argument('--unreviewed-index-sha',default='',help='Also replay actual no-action Liam HELLO and ready/pending offers of this unregistered pin')
args=parser.parse_args()
if args.unreviewed_index_sha:
import re
assert re.fullmatch('[0-9a-f]{64}',args.unreviewed_index_sha)
gateway_root=args.gateway_source.resolve(strict=True)
snapshot=gateway_root/'SNAPSHOT.json'
if snapshot.exists():
@@ -52,6 +56,7 @@ with tempfile.TemporaryDirectory(prefix='character-handshake-') as folder:
'-d',str(stage/'classes'),*map(str,files)],check=True)
hello_file=stage/'hello.jsonl'
subprocess.run([ns['JAVA'],'-Dcharacter.helloFile='+str(hello_file),
'-Dcharacter.unreviewedPin='+args.unreviewed_index_sha,
'-Dcharacter.personas='+','.join(personas),'-cp',
str(stage/'classes')+':'+ns['cp'],'HandshakeCheckKt'],check=True,timeout=30)
hellos=[json.loads(row) for row in hello_file.read_text().splitlines()]
@@ -69,6 +74,7 @@ from pathlib import Path
from unittest.mock import patch
from fastapi.testclient import TestClient
import gateway
from action_protocol import configured_packs,negotiate,pending_pin
from history import History
from guest_sessions import GuestSessions
@@ -100,8 +106,10 @@ for hello in hellos:
expected_voice='synthetic-'+(persona if persona!='default' else 'yangmi_fiction')
assert ack['voice_id']==expected_voice
assert profile.call_count==(1 if persona=='default' else 0)
assert ack['action_available']==('action_pack_sha256' in hello)
assert ack['action_pending']==('action_pending_pack_sha256' in hello)
assert ack['action_available']==bool(negotiate(hello,configured_packs()))
assert ack['action_pending']==bool(pending_pin(hello,configured_packs()))
if hello.get('action_pack_sha256')==UNREVIEWED or hello.get('action_pending_pack_sha256')==UNREVIEWED:
assert not ack['action_available'] and not ack['action_pending']
assert ack['conversation_id'] not in ids;ids.append(ack['conversation_id'])
assert ws.receive_json()['type']=='history'
assert sessions[-1]==('yangmi_fiction' if persona=='default' else persona,
@@ -119,5 +127,5 @@ for persona in sorted({x['persona'] for x in hellos}-{'default'}):
ws.receive_json();ids.append(ack['conversation_id'])
assert state.busy is False
print('PASS: '+str(len(ids))+' canonical ASGI WS handshakes from actual Android HELLO; personas='+','.join(sorted({x["persona"] for x in hellos}))+'; explicit persona ignores active_profile, server-locks voice/language, fresh CID, ready/pending exact pin and disconnect busy cleanup; 0 ASR/LLM/TTS calls, synthetic-only')
'''
'''.replace('UNREVIEWED',repr(args.unreviewed_index_sha))
subprocess.run([sys.executable,'-c',runner],cwd=stage,check=True,timeout=30)