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
+1 -1
View File
@@ -1,2 +1,2 @@
package com.gorios.lanvoice
object BuildConfig { const val AVATAR_USER_ASSET_CANDIDATE=false }
object BuildConfig { const val AVATAR_USER_ASSET_CANDIDATE=false;const val STARTUP_POSTER_RES_ID=1 }
+1 -1
View File
@@ -1,2 +1,2 @@
package com.gorios.lanvoice
object R { object drawable { const val startup_poster=1;const val startup_black_tulle_poster=2 } }
object R { object drawable { const val startup_poster=1;const val startup_black_tulle_poster=2;const val startup_char_expressions_r02_poster=3 } }
+6
View File
@@ -28,6 +28,12 @@ fun startupCacheCheck() {
} finally { worker.shutdownNow() }
val userPin="208f703ed92bf795bfeb78a1cef89b67bed2e45da80038a56157fd1ecd4cfa93"
val userKey=StartupAssetKey(31,1,userPin,"avatar/a01-black-tulle-roomy720-correct03/",3)
val charPin="f8a69041da51e1a551c6991bfad6d7f034f0f320f726f58568afd43d81cb9604"
val charKey=StartupAssetKey(36,1,charPin,"avatar/char-expressions-r02/",3)
check(charKey.fingerprint!=userKey.fingerprint)
check(runCatching { StartupAssetKey(36,1,userPin,charKey.root,3) }.isFailure)
check(runCatching { StartupAssetKey(36,1,charPin,userKey.root,3) }.isFailure)
check(runCatching { StartupAssetKey(36,1,charPin,charKey.root,2) }.isFailure)
check(userKey.fingerprint!=key(pin=userPin,validator=3).fingerprint)
for((root,pin,version) in listOf(Triple("avatar/unknown/",userPin,3),
Triple(userKey.root,"b".repeat(64),3),Triple(userKey.root,userPin,2))) {
+18
View File
@@ -52,6 +52,24 @@ fun main() {
check(socket.sent.size==count)
client.release();Handler.drain()
}
val unreviewed=System.getProperty("character.unreviewedPin","")
if(unreviewed.isNotEmpty()) {
check(unreviewed.matches(Regex("[0-9a-f]{64}")))
for(mode in listOf("disabled","unknown_ready","unknown_pending")) {
val client=DialogueClient("localhost",5011,{},persona="liam",
actionPackSha={if(mode=="unknown_ready") unreviewed else null},
pendingActionPackSha={if(mode=="unknown_pending") unreviewed else null})
val socket=Socket();client.field("socket",socket);val listener=client.listener(0)
listener.onMessage(socket,"""{"type":"auth","state":"ok"}""");Handler.drain()
check(socket.sent.size==1);val hello=socket.sent.single()
check("\"persona\":\"liam\"" in hello && "voice_id" !in hello && "conversation_id" !in hello)
if(mode=="disabled")check("action_pack_sha256" !in hello && "action_pending_pack_sha256" !in hello)
wires.add(hello)
listener.onMessage(socket,"""{"type":"hello","action_available":false,"action_pending":false}""");Handler.drain()
check(client.actionNegotiation=="unavailable" && !client.capabilitiesReady())
client.disconnect();client.release();Handler.drain();check(socket.cancelled)
}
}
java.io.File(checkNotNull(System.getProperty("character.helloFile"))).writeText(wires.joinToString("\n")+"\n")
println("PASS: "+wires.size+" actual DialogueClient AUTH→production HELLO persona/media offers, pending readiness, duplicate AUTH and retired socket fences; transport/main/JSON adapters, device not_run")
}
@@ -120,3 +120,51 @@ class CharacterProfilesTests(unittest.TestCase):
self.assertIn('-PcharacterProfile=liam-test',pack.flags('liam-test',35))
self.assertEqual(select.catalog()['profiles']['liam-test']['minimumVersionCode'],35)
with self.assertRaises(ValueError):pack.artifact_name('main',35)
def char(self,profile='liam-test',**changes):
media=select.catalog()['mediaBundles']['char-expressions-r02']
flags=dict(emotion_sha=media['indexSha256'],user_assets=True,mouth=True,startup=True,
media_bundle='char-expressions-r02')
flags.update(changes)
return select.selection(ASSETS,profile,**flags)
def test_char_is_explicit_liam_only_and_does_not_mix_black_pack(self):
selected=self.char()
self.assertEqual(selected['file_count'],3190)
self.assertEqual((selected['persona'],selected['media_identity']),('liam','a01'))
self.assertEqual(sum(n.startswith('avatar/char-expressions-r02/') for n in selected['files']),2593)
self.assertFalse(any('black-tulle' in n or 'startup-white' in n for n in selected['files']))
for profile in ('main','lvbu-test'):
with self.subTest(profile=profile),self.assertRaises(ValueError):self.char(profile)
for profile in ('main','lvbu-test','liam-test'):
self.assertFalse(any('char-expressions' in n for n in self.full(profile)['files']))
def test_char_pin_bootstrap_and_poster_cannot_be_mixed(self):
media=select.catalog()['mediaBundles']['char-expressions-r02']
with self.assertRaises(ValueError):self.char(emotion_sha=select.catalog()['mediaBundles']['black-correct03']['indexSha256'])
original=Path.read_bytes
for target in (ASSETS/media['assetRoot']/'manifest.json',
ASSETS/media['bootstrapRoot']/'manifest.json',
ROOT/media['resourceDirectory']/'drawable-nodpi'/(media['posterResource']+'.png')):
with self.subTest(target=target),patch.object(Path,'read_bytes',lambda p:b'corrupt' if p==target else original(p)),self.assertRaises(ValueError):self.char()
def test_char_retains_transparent_sections_and_runtime_not_ready(self):
from PIL import Image
media=select.catalog()['mediaBundles']['char-expressions-r02']
for name,restricted in [('happy',range(7,70)),('sad',range(24,55))]:
root=ASSETS/media['assetRoot']/'conversation'/name
runtime=json.loads((root/'manifest.json').read_bytes())
self.assertIs(runtime['runtimeReady'],False)
for frame in restricted:
for level in runtime['patches'][frame]['levels'][1:]:
with Image.open(root/level['path']) as image:
self.assertEqual(image.getchannel('A').getextrema(),(0,0))
def test_char_has_no_network_dance_authorization(self):
spec=importlib.util.spec_from_file_location('char_pack',ROOT/'scripts/package-character-test.py')
pack=importlib.util.module_from_spec(spec);spec.loader.exec_module(pack)
flags=pack.flags('liam-test',36,'char-expressions-r02')
self.assertIn('-PavatarUserNetworkActions=false',flags)
self.assertIn('-PcharacterMediaBundle=char-expressions-r02',flags)
self.assertFalse(select.catalog()['mediaBundles']['char-expressions-r02']['networkActionsAllowed'])
self.assertIn('Network dance requires separate reviewed media registration',(ROOT/'app/build.gradle').read_text())
+2 -1
View File
@@ -12,7 +12,8 @@ class UserAssetPackageTests(unittest.TestCase):
with self.subTest(pin=pin),self.assertRaises(ValueError):pack.authorization(pin,pi,registry)
def test_buildconfig_exact_pin_isolated_roots_and_network_guards(self):
s=(ROOT/'app/build.gradle').read_text()
self.assertIn("emotionManifestSha != '"+pack.PIN+"'",s)
self.assertIn("emotionManifestSha != characterMedia.indexSha256",s)
self.assertIn("characterMedia.userAuthorizedDebug != true",s)
self.assertIn("if (!avatarUserAssetCandidate && avatarPlaybackClockFix",s)
self.assertIn("sourceSets.main.assets.setSrcDirs([packagedAssets])",s)
self.assertIn("scripts/select-character-assets.py",s)