Support bridge-owned TALK layers and recover free P4a candidate

This commit is contained in:
zenord
2026-10-13 04:35:33 +08:00
parent fcc55b8370
commit a53600db92
22 changed files with 18696 additions and 43 deletions
+31
View File
@@ -52,6 +52,37 @@ fun conversationPackageCheck() {
val oversized=listOf("neutral","happy","sad","idle1","idle2").associateWith { large }
check(read(root(oversized),oversized)==null);rejected++
// Optional bridge-own runtime admission: own body SHA and every timing field.
val bridgeOwn=dynamicPack(12,24,pin)
val reference=mapOf("path" to "bridge/manifest.json","sha256" to bridgeOwn.manifestSha)
val talkGraph=graph.map { it+mapOf("mouthRuntimeManifest" to reference,"mouthAllowed" to true) }
fun bridgeRead(edges: List<Map<String,Any?>>,own: ContinuousAvatarPack=bridgeOwn)=
EmotionActionManifest.read(meta+("edges" to edges),pin,pin) { path,hash ->
(if(path=="bridge/manifest.json") own else packs[path.substringBefore('/')])?.takeIf { it.manifestSha==hash }
}
check(bridgeRead(talkGraph)?.edges?.all { it.mouthRuntime?.body?.frameCount==12 }==true)
var bridgeRejected=0
for(own in listOf(bridgeOwn.copy(body=bridgeOwn.body.copy(sha256="a".repeat(64))),
bridgeOwn.copy(body=bridgeOwn.body.copy(ptsUs=bridgeOwn.body.ptsUs.mapIndexed { i,t->t+if(i==1) 1 else 0 })),
bridgeOwn.copy(body=bridgeOwn.body.copy(durationUs=500001)),
bridgeOwn.copy(body=bridgeOwn.body.copy(fpsNumerator=30)),
bridgeOwn.copy(body=bridgeOwn.body.copy(frameCount=11)),
bridgeOwn.copy(body=bridgeOwn.body.copy(width=481)),
bridgeOwn.copy(apertureMode=false),bridgeOwn.copy(patches=bridgeOwn.patches.dropLast(1)))) {
check(bridgeRead(talkGraph,own)==null);bridgeRejected++
}
for(change in listOf(mapOf("mouthAllowed" to false),mapOf("nativeLoop" to true),
mapOf("mouthRuntimeManifest" to reference+("path" to "../bridge/manifest.json")),
mapOf("mouthRuntimeManifest" to reference+("sha256" to "a".repeat(64))))) {
check(bridgeRead(listOf(talkGraph[0]+change)+talkGraph.drop(1))==null);bridgeRejected++
}
check(read(meta+("edges" to graph.map { it+("mouthAllowed" to true) }))==null);bridgeRejected++
val inflated=bridgeOwn.copy(patches=bridgeOwn.patches.map { it.copy(width=128,height=128) })
// Each runtime remains below8MB; bridge resources together exceed32MB.
val overGraph=List(40) { i->talkGraph[0]+("id" to "extra-$i") }+talkGraph
check(inflated.rgbaBytes<BodyTimeline.MAX_RGBA_BYTES && bridgeRead(overGraph,inflated)==null);bridgeRejected++
println("PASS: bridge-own optional runtime binding and $bridgeRejected SHA/PTS/N/fps/duration/shape/path/flag/cache rejection cases; old silent graph compatible, no self approval")
val planner=ConversationPackagePlanner(index)
planner.newTurn(10)
fun expression(emotion: RoleEmotion,seq: Long=1,intensity: Int=1)=PreparedExpression(10,seq,emotion,intensity)