Integrate exact user-authorized correct03 720 debug assets with isolated admission

This commit is contained in:
zenord
2026-10-13 20:53:23 +08:00
parent c3fe22b8bf
commit e4e063baa3
23 changed files with 485 additions and 28 deletions
+1
View File
@@ -12,3 +12,4 @@ __pycache__/
.runtime/
app/src/main/assets/avatar/
app/src/main/res/drawable-nodpi/startup_poster.png
app/src/main/res/drawable-nodpi/startup_black_tulle_poster.png
+15 -3
View File
@@ -18,6 +18,7 @@ def avatarNatural = providers.gradleProperty('avatarNatural').orNull == 'true'
def avatarUiCandidate = providers.gradleProperty('avatarUiCandidate').orNull == 'true'
def avatarMouthCandidate = providers.gradleProperty('avatarMouthCandidate').orNull == 'true'
def avatarActionCandidate = providers.gradleProperty('avatarActionCandidate').orNull == 'true'
def avatarUserAssetCandidate = providers.gradleProperty('avatarUserAssetCandidate').orNull == 'true'
def avatarStartupFix = providers.gradleProperty('avatarStartupFix').orNull == 'true'
def cameraCompatibilityFix = providers.gradleProperty('cameraCompatibilityFix').orNull == 'true'
def cameraDirectYuv = providers.gradleProperty('cameraDirectYuv').orNull == 'true'
@@ -51,7 +52,8 @@ if (cameraPreviewStream && (!cameraDirectYuv || actionVersionCode < 27)) throw n
if (faceDiagnosticsFix && (!presenceCandidate || actionVersionCode < 24)) throw new GradleException('Face diagnostics fix requires presence and fresh code >=24')
if (presenceCandidate && (!avatarStartupFix || actionVersionCode < 23)) throw new GradleException('Presence candidate requires startup fix and fresh code >=23')
if (avatarStartupFix && (!avatarPlaybackClockFix || actionVersionCode < 22)) throw new GradleException('Startup fix requires repaired playback and fresh code >=22')
if (avatarPlaybackClockFix && (!avatarFullActionCandidate || actionVersionCode < 21 || emotionManifestSha != '987e125a7d7a2cde99121b5f5246c82f4dbe36c4899d3d49eaffd1a68bafb887')) throw new GradleException('Playback clock fix requires frozen full graph and fresh code >=21')
if (avatarUserAssetCandidate && (!avatarStartupFix || !cameraProbeDiagnostic || actionVersionCode < 30 || emotionManifestSha != '208f703ed92bf795bfeb78a1cef89b67bed2e45da80038a56157fd1ecd4cfa93')) throw new GradleException('User asset debug candidate requires exact authorized correct03, startup and current diagnostics, fresh code >=30')
if (!avatarUserAssetCandidate && avatarPlaybackClockFix && (!avatarFullActionCandidate || actionVersionCode < 21 || emotionManifestSha != '987e125a7d7a2cde99121b5f5246c82f4dbe36c4899d3d49eaffd1a68bafb887')) throw new GradleException('Playback clock fix requires frozen full graph and fresh code >=21')
if (avatarPlaybackDiagnostic && (!avatarFullActionCandidate || actionVersionCode < 20 || emotionManifestSha != '987e125a7d7a2cde99121b5f5246c82f4dbe36c4899d3d49eaffd1a68bafb887')) throw new GradleException('Playback diagnostic requires frozen full graph and fresh code >=20')
if (avatarRuntimeFix && (!avatarFullActionCandidate || actionVersionCode < 19)) throw new GradleException('Runtime fix requires full pinned graph and fresh code >=19')
if (avatarNatural && !(naturalManifestSha ==~ /[0-9a-f]{64}/)) {
@@ -89,7 +91,9 @@ def stagePackagedAssets = tasks.register('stagePackagedAssets', Sync) {
from('src/main/assets')
exclude 'avatar/a01-v1/**', 'avatar/a01-standing-v2/**'
if (!avatarMouthCandidate) exclude 'avatar/a01-neutral-graph-v1/runtime-04/**'
if (!avatarStartupFix) exclude 'avatar/startup-white-01/**'
if (!avatarStartupFix || avatarUserAssetCandidate) exclude 'avatar/startup-white-01/**'
if (!avatarUserAssetCandidate) exclude 'avatar/startup-black-tulle-correct03/**', 'avatar/a01-black-tulle-roomy720-correct03/**'
if (avatarUserAssetCandidate) exclude 'avatar/a01-expression-action-v1/**'
if (!emotionManifestSha) exclude 'avatar/a01-expression-action-v1/**'
into(packagedAssets)
}
@@ -103,7 +107,7 @@ android {
targetSdk 34
testInstrumentationRunner 'com.gorios.lanvoice.AvatarCleanUiInstrumentation'
versionCode avatarActionCandidate ? actionVersionCode : (avatarMouthCandidate ? 15 : (avatarUiCandidate ? 14 : (avatarNatural ? 13 : 12)))
versionName = cameraProbeDiagnostic ? '0.7.11' : cameraPreviewStream ? '0.7.9' : cameraDirectYuv ? '0.7.8' : cameraCompatibilityFix ? '0.7.7' : faceDiagnosticsFix ? '0.7.6' : presenceCandidate ? '0.7.5' : avatarStartupFix ? '0.7.4' : avatarPlaybackClockFix ? '0.7.3' : avatarPlaybackDiagnostic ? '0.7.2' : avatarRuntimeFix ? '0.7.1' : (avatarActionCandidate ? '0.7.0' : ((avatarUiCandidate || avatarMouthCandidate) ? '0.6.2' : '0.6.1'))
versionName = avatarUserAssetCandidate ? '0.7.12' : cameraProbeDiagnostic ? '0.7.11' : cameraPreviewStream ? '0.7.9' : cameraDirectYuv ? '0.7.8' : cameraCompatibilityFix ? '0.7.7' : faceDiagnosticsFix ? '0.7.6' : presenceCandidate ? '0.7.5' : avatarStartupFix ? '0.7.4' : avatarPlaybackClockFix ? '0.7.3' : avatarPlaybackDiagnostic ? '0.7.2' : avatarRuntimeFix ? '0.7.1' : (avatarActionCandidate ? '0.7.0' : ((avatarUiCandidate || avatarMouthCandidate) ? '0.6.2' : '0.6.1'))
ndk { abiFilters 'arm64-v8a' }
}
compileOptions { sourceCompatibility JavaVersion.VERSION_17; targetCompatibility JavaVersion.VERSION_17 }
@@ -118,6 +122,10 @@ android {
else if (avatarUiCandidate) versionNameSuffix '-ui-dev'
else if (avatarNatural) versionNameSuffix '-natural-dev'
else if (avatarEngineering) versionNameSuffix '-dev'
buildConfigField 'boolean', 'AVATAR_USER_ASSET_CANDIDATE', avatarUserAssetCandidate ? 'true' : 'false'
buildConfigField 'String', 'EMOTION_ASSET_ROOT', '"' + (avatarUserAssetCandidate ? 'avatar/a01-black-tulle-roomy720-correct03/' : 'avatar/a01-expression-action-v1/') + '"'
buildConfigField 'String', 'STARTUP_ASSET_ROOT', '"' + (avatarUserAssetCandidate ? 'avatar/startup-black-tulle-correct03/' : 'avatar/startup-white-01/') + '"'
buildConfigField 'String', 'STARTUP_MANIFEST_SHA', '"' + (avatarUserAssetCandidate ? '29669529887db78e0d64d2e7afd89cb8866aefc84e2523195d4bb936ec2ae382' : '461f5cfc10036de5f10ca3ce765fb8d9998697d3fd035aa9b1862d2ccfc3eaa2') + '"'
buildConfigField 'boolean', 'CAMERA_PROBE_DIAGNOSTIC', cameraProbeDiagnostic ? 'true' : 'false'
buildConfigField 'boolean', 'AVATAR_STARTUP_FIX', avatarStartupFix ? 'true' : 'false'
buildConfigField 'boolean', 'AVATAR_ENGINEERING', (avatarEngineering || avatarNatural) ? 'true' : 'false'
@@ -127,6 +135,10 @@ android {
buildConfigField 'String', 'EMOTION_MANIFEST_SHA', '"' + emotionManifestSha + '"'
}
release {
buildConfigField 'boolean', 'AVATAR_USER_ASSET_CANDIDATE', 'false'
buildConfigField 'String', 'EMOTION_ASSET_ROOT', '"avatar/a01-expression-action-v1/"'
buildConfigField 'String', 'STARTUP_ASSET_ROOT', '"avatar/startup-white-01/"'
buildConfigField 'String', 'STARTUP_MANIFEST_SHA', '"461f5cfc10036de5f10ca3ce765fb8d9998697d3fd035aa9b1862d2ccfc3eaa2"'
buildConfigField 'boolean', 'CAMERA_PROBE_DIAGNOSTIC', 'false'
buildConfigField 'boolean', 'AVATAR_STARTUP_FIX', 'false'
buildConfigField 'boolean', 'AVATAR_ENGINEERING', 'false'
@@ -232,8 +232,8 @@ class MainActivity : ComponentActivity() {
onConnectionLog = { connectionLogs = (connectionLogs + it).takeLast(10) },
onPreparePlayback = audioOutput::prepare,
onVoiceStopped = audioOutput::release,
reviewedActionPack = avatarPack?.emotionAction?.actionPack?.takeIf { !BuildConfig.AVATAR_STARTUP_FIX || mediaReady },
pendingActionPackSha = { if(BuildConfig.AVATAR_STARTUP_FIX) BuildConfig.EMOTION_MANIFEST_SHA else null },
reviewedActionPack = avatarPack?.emotionAction?.actionPack?.takeIf { !BuildConfig.AVATAR_USER_ASSET_CANDIDATE && (!BuildConfig.AVATAR_STARTUP_FIX || mediaReady) },
pendingActionPackSha = { if(BuildConfig.AVATAR_STARTUP_FIX && !BuildConfig.AVATAR_USER_ASSET_CANDIDATE) BuildConfig.EMOTION_MANIFEST_SHA else null },
actionPlayer = avatarMedia,
onPrepareExpression = avatarMedia::prepare,
)
@@ -251,7 +251,7 @@ class MainActivity : ComponentActivity() {
presenceEnabled=preferences().getBoolean("presenceEnabled",false)
session.setPresence(presenceEnabled,false)
if(inForeground) session.foreground(connectAutomatically=false)
if(mediaReady) avatarPack?.emotionAction?.actionPack?.let(session::installReviewedActions)
if(mediaReady && !BuildConfig.AVATAR_USER_ASSET_CANDIDATE) avatarPack?.emotionAction?.actionPack?.let(session::installReviewedActions)
scheduleEntry()
}
private fun startShell() {
@@ -282,7 +282,7 @@ class MainActivity : ComponentActivity() {
}
private fun startupVisible() {
mediaReady=true;startupStage="ready"
if(!offlineAvatarPreview && ::session.isInitialized)
if(!offlineAvatarPreview && ::session.isInitialized && !BuildConfig.AVATAR_USER_ASSET_CANDIDATE)
avatarPack?.emotionAction?.actionPack?.let(session::installReviewedActions)
}
@@ -28,7 +28,7 @@ data class AvatarPack(val idle: String = "", val talk: String = "", val fallback
if(BuildConfig.DEBUG && BuildConfig.EMOTION_MANIFEST_SHA.isNotEmpty()) {
var stage="index_read_or_hash"
val admitted=try {
val root="avatar/a01-expression-action-v1/"
val root=BuildConfig.EMOTION_ASSET_ROOT
val parsedAt=SystemClock.elapsedRealtime()
val raw=read(context,root+"manifest.json",2_000_000)
check(sha(raw)==BuildConfig.EMOTION_MANIFEST_SHA)
@@ -44,7 +44,8 @@ data class AvatarPack(val idle: String = "", val talk: String = "", val fallback
val bytes=read(context,root+path,2_000_000)
check(sha(bytes)==hash)
stage="runtime_schema"
val runtime=checkNotNull(ContinuousAvatarManifest.read(jsonMap(JSONObject(String(bytes,Charsets.UTF_8))),hash,hash,true,runtimeRoot))
val runtime=checkNotNull(ContinuousAvatarManifest.read(jsonMap(JSONObject(String(bytes,Charsets.UTF_8))),hash,hash,true,runtimeRoot,
userAuthorizedDebug=BuildConfig.AVATAR_USER_ASSET_CANDIDATE))
stage="runtime_body_patch_hash_or_shape"
if(!immutableReceipt) verifyRuntime(context,runtime,verified)
stage="index_schema_or_binding";runtime
@@ -69,7 +70,7 @@ data class AvatarPack(val idle: String = "", val talk: String = "", val fallback
}
}
StartupTrace.mark(StartupTrace.Phase.MEDIA_VERIFY,mediaAt)
static.copy(continuous=index.packages.getValue(index.fallbackId),emotionAction=index,motionStatus="externally_pinned_emotion_graph",emotionAdmission="accepted")
static.copy(continuous=index.packages.getValue(index.fallbackId),emotionAction=index,motionStatus=if(BuildConfig.AVATAR_USER_ASSET_CANDIDATE) "user_authorized_debug_assets_review_pending" else "externally_pinned_emotion_graph",emotionAdmission="accepted")
} catch(_: Exception) {
static=static.copy(emotionAdmission=stage)
DiagnosticLog.record("avatar_loader","result=rejected reason=$stage pin=${BuildConfig.EMOTION_MANIFEST_SHA.take(12)}")
@@ -168,6 +168,7 @@ fun CallScreen(state: VoiceUiState,entry: EntryPhase,permissionMessage: String?,
Text("当前画面:${visualEmotion?.label ?: if(pack?.emotionAction!=null) "过渡或未呈现" else "中立"} · ${video.actual}",fontSize=12.sp)
Text("视觉选择:${mediaBinding?.selection?.let { "${it.visualEmotion.wire}/${it.visualIntensity}" } ?: "未选择"} · ${mediaBinding?.visualStatus ?: "旧中立素材"}",fontSize=12.sp)
if(pack?.emotionAction!=null) Text("整合候选 · 动态自然度、音乐听审及真机未测;表达可能等待 2–4 秒出口和约 1 秒过渡",fontSize=12.sp)
if(BuildConfig.AVATAR_USER_ASSET_CANDIDATE) Text("用户授权素材调试候选 · 联网舞蹈未开放 · 音乐听审与真机自然度待验",fontSize=12.sp)
Text("版本 ${com.gorios.lanvoice.BuildConfig.VERSION_NAME} · code ${com.gorios.lanvoice.BuildConfig.VERSION_CODE} · pin ${com.gorios.lanvoice.BuildConfig.EMOTION_MANIFEST_SHA.take(12)}",fontSize=12.sp)
if(BuildConfig.VERSION_NAME=="0.7.2") Text("播放诊断版:未确认手机根因;可离线检查两段原舞蹈并发送状态报告",fontSize=12.sp)
Text("素材准入:${pack?.emotionAdmission ?: "unavailable"} · ${mediaBinding?.diagnosticState ?: "legacy_neutral"}",fontSize=11.sp)
@@ -44,7 +44,7 @@ object BodyTimeline {
object ContinuousAvatarManifest {
@Suppress("UNCHECKED_CAST")
fun read(root: Map<String,Any?>,sha: String,expectedSha: String,debug: Boolean,pathRoot: String,
onReject: ((String)->Unit)? = null): ContinuousAvatarPack? {
onReject: ((String)->Unit)? = null, userAuthorizedDebug: Boolean=false): ContinuousAvatarPack? {
if(!debug || !expectedSha.matches(Regex("[0-9a-f]{64}")) || sha!=expectedSha) {
onReject?.invoke("externalPin");return null
}
@@ -60,7 +60,10 @@ object ContinuousAvatarManifest {
require(integer(root["schemaVersion"])==(if(dynamic) 2L else 1L) && root["identityId"]=="a01" &&
(apertureMode || root["packId"]=="a01-neutral-graph-v1-runtime-03"))
field="publishApproval/runtimeReady"
require(root["publishApproval"]==false && root["runtimeReady"]==true)
// A candidate is accepted only by an explicit caller bound to the verified
// user-authorized parent index. Self metadata cannot open this path.
require(root["publishApproval"]==false && (root["runtimeReady"]==true ||
userAuthorizedDebug && dynamic && root["runtimeReady"]==false))
field="body"
val b=obj(root["body"])
val count=smallInt(b["frameCount"]);require(count in 2..BodyTimeline.MAX_TALK_FRAMES)
@@ -87,7 +90,11 @@ object ContinuousAvatarManifest {
val rows=root["patches"] as List<Map<String,Any?>>; require(rows.size==count)
val patches=rows.mapIndexed { index,p ->
field="patches[$index]"
val patch=RegisteredMouthPatch(smallInt(p["frameIndex"]),integer(p["ptsUs"]),p["path"] as String,hash(p["sha256"]),
// Schema2 five-level tracks may omit redundant top-level L4 aliases.
// Explicit aliases remain strict, and every level is validated below.
val alias=if(dynamic && !p.containsKey("path") && !p.containsKey("sha256"))
obj((p["levels"] as List<*>).last()) else p
val patch=RegisteredMouthPatch(smallInt(p["frameIndex"]),integer(p["ptsUs"]),alias["path"] as String,hash(alias["sha256"]),
finite(p["x"]),finite(p["y"]),smallInt(p["width"]),smallInt(p["height"]))
require(patch.frameIndex==index && if(dynamic) patch.ptsUs==pts[index] else kotlin.math.abs(patch.ptsUs-pts[index])<=2)
require(patch.path.matches(Regex("patches/[a-zA-Z0-9_.-]+\\.png")))
@@ -14,8 +14,8 @@ import java.util.concurrent.Executors
/** Immutable APK cache; no Activity, Surface, GL texture or camera retained. */
object StartupAvatarRepository {
const val BASIC_SHA="461f5cfc10036de5f10ca3ce765fb8d9998697d3fd035aa9b1862d2ccfc3eaa2"
private const val ROOT="avatar/startup-white-01/"
private val BASIC_SHA get()=BuildConfig.STARTUP_MANIFEST_SHA
private val ROOT get()=BuildConfig.STARTUP_ASSET_ROOT
private val worker=Executors.newSingleThreadExecutor { Thread(it,"avatar-validation").apply { isDaemon=true } }
private val main=Handler(Looper.getMainLooper())
private val full=StartupLoadCache<AvatarPack>(worker)
@@ -30,7 +30,7 @@ object StartupAvatarRepository {
val app=context.applicationContext
val info=app.packageManager.getPackageInfo(app.packageName,0)
val key=StartupAssetKey(info.versionCode.toLong(),info.lastUpdateTime,BuildConfig.EMOTION_MANIFEST_SHA,
"avatar/a01-expression-action-v1/",2)
BuildConfig.EMOTION_ASSET_ROOT,3)
var cancelled=false
var basicFailed=false
// Both requests use one serial IO worker: the tiny baseline is prioritized.
@@ -41,7 +41,7 @@ object StartupAvatarRepository {
val json=JSONObject(String(raw,Charsets.UTF_8))
check(json.getString("sourceIndexSha256")==BuildConfig.EMOTION_MANIFEST_SHA)
val b=json.getJSONObject("body")
val path=b.getString("path");check(path=="avatar/a01-expression-action-v1/runtime/neutral/body/idle.mp4")
val path=b.getString("path");check(path==BuildConfig.EMOTION_ASSET_ROOT+"runtime/neutral/body/idle.mp4")
val bytes=readBounded(app.assets.open(path),64_000_000);check(bytes.size<=64_000_000 && sha(bytes)==b.getString("sha256"))
val poster=readBounded(app.assets.open(ROOT+"poster.png"),100_000);check(poster.size<=100_000 && sha(poster)==json.getString("posterSha256"))
val pts=b.getJSONArray("ptsUs");val timeline=List(pts.length()) { pts.getLong(it) }
@@ -15,7 +15,7 @@ class StartupAvatarView(context: Context,private val binding: AvatarMediaBinding
private val report: (VideoPresentation)->Unit,private val fullVisible: ()->Unit,private val failed: ()->Unit={}): FrameLayout(context) {
private val poster=ImageView(context).apply {
scaleType=ImageView.ScaleType.FIT_CENTER
setImageResource(R.drawable.startup_poster)
setImageResource(if(com.gorios.lanvoice.BuildConfig.AVATAR_USER_ASSET_CANDIDATE) R.drawable.startup_black_tulle_poster else R.drawable.startup_poster)
}
private val surface=TextureView(context).apply { isOpaque=false;alpha=0f }
private var basic: ContinuousAvatarPack?=null
@@ -12,7 +12,9 @@ import java.util.concurrent.Executor
data class StartupAssetKey(val versionCode: Long,val installedAt: Long,val pin: String,
val root: String,val validator: Int) {
init { require(versionCode>0 && installedAt>0 && pin.matches(Regex("[0-9a-f]{64}")) &&
root=="avatar/a01-expression-action-v1/" && validator>0) }
(root=="avatar/a01-expression-action-v1/" ||
root=="avatar/a01-black-tulle-roomy720-correct03/" &&
pin=="208f703ed92bf795bfeb78a1cef89b67bed2e45da80038a56157fd1ecd4cfa93" && validator>=3) && validator>0) }
val fingerprint: String get() = digest("$versionCode/$installedAt/$pin/$root/$validator")
}
private fun digest(value: String): String = MessageDigest.getInstance("SHA-256").digest(value.toByteArray())
+10
View File
@@ -221,3 +221,13 @@ end/stop/release and restored A, not metadata elapsed time. Idle variant selecti
waits2–3 completed neutral cycles; speech/model expression/action has priority.
Dance selection prefers a different variant3:1, allowing random repeats rather than
forcing an alternating playlist. The model chooses only kind dance.
User-authorized debug integration (2026-10-13): a separately compiled exact user
revision may import a schema2 candidate with runtimeReady:false without inventing
Pi approval. Default admission remains strict; publishApproval must stay false.
For five-level schema2 tracks, top-level patch path/sha256 L4 aliases may both be
omitted; if supplied they must both match levels[4]. All five levels/own-body/N/PTS/
shape/hash/cache checks remain mandatory. This path admits local media only, never
network dance capability. Current exact revision and restoration instructions:
`docs/BLACK_TULLE_CORRECT03_INTEGRATION.md`. Source pack bytes stay immutable.
+63
View File
@@ -0,0 +1,63 @@
# correct-03 用户授权 debug 接入
本次用户明确授权接入黑纱 roomy720 correct-03,授权来自用户精确版本指令及交付的 `CORRECT03_APP_INTEGRATION_REQUEST.md`。这是 debug 素材整合授权,不是独立 Pi pin、音乐听审、真机自然度或商业发布审批。起点 clean main `c3fe22b8bface28911394d2e662ba0060390f1b6`。
唯一 index SHA256:`208f703ed92bf795bfeb78a1cef89b67bed2e45da80038a56157fd1ecd4cfa93`。
来源:`.runtime/avatar-imports/a01-black-tulle-roomy720-correct03-208f703ed92b/candidate-roomy720-correct-03/manifest.json`。
Happy runtime SHA:`ccb376b2d80c5b570e78992ad37893d68ef011b14249b294173b6181698e739f`;没有导入 correct-02 happy 嘴层。源素材目录全程只读,没有改 metadata、像素、音轨或生成账本。
## 准入与实现
独立核验 transfer marker 对应路径、manifest SHA、3465 个 indexed 文件 bytes/hash 均通过。原发布 parser 首次拒绝全部13 runtime 的 `publishApproval/runtimeReady`:交付诚实标 `publishApproval:false/runtimeReady:false`。新增明确 debug 调用参数,仅在已核验的用户授权 parent index 下允许 schema2 candidate;默认、非debug、未知 pin、自行宣称 publishApproval 的路径仍拒绝,不更改 source metadata。
其次,生产 Kotlin 旧实现要求每条五档 patch 重复顶层 `path/sha256` L4 别名,但 schema2 合同和机器检查使用 `levels[0..4]` 各自 path/hash,新包没有冗余别名。现 parser 从完整五档 L4 取内部兼容字段;若显式给别名必须两字段齐全且精确等于L4。五档顺序、独立hash/path、ownbody/N/实际PTS/shape、state curve clock 与所有cache上限继续严格校验。这是支持合同中的合法表达,不是宽松接受缺嘴层。
生产 full gate:5 个97帧 body、8 个25帧 own-mouth桥、13条边、2个193帧正常H264+AAC动作。共3454个运行引用文件(包含index),额外12个审核文件不入APK。全部13 runtime mouths合计26,022,820 RGBA bytes,逐runtime≤8,000,000、合计≤32,000,000,未扩大限制。720 body/bridge/action共同shape,嘴坐标按各自720 sourcepx解释,不再1.5×缩放,不改素材作者gap/幅度。非零档opacity1,L0绕过;既有source actualPTS、桥TALK、idle轮换、music完成/释放/回A与旧epoch门禁保留。
新运行根为 `avatar/a01-black-tulle-roomy720-correct03/`,旧白衣 `avatar/a01-expression-action-v1/` 保留原样在导入目录和已发布旧APK,新的APK不把两个完整包同时打入。旧pin `987e125a7d7a2cde99121b5f5246c82f4dbe36c4899d3d49eaffd1a68bafb887` 没有被覆盖或授权新素材。
从精确 neutral source frame0 免费CPU派生180×320、41,697B poster与同一body bootstrap。bootstrap SHA `29669529887db78e0d64d2e7afd89cb8866aefc84e2523195d4bb936ec2ae382`,poster SHA `dc073c8b476f63d9c1d06da193448c6edbaad5a166f47bb3aaf4367efcd5c879`。保持 shell先draw、后台严格校验、相同body/source0→full已ready目标0交接及基本decoder实际释放。receipt validator=3,与APK版本/安装标识/assetroot/pin共同绑定;旧校验receipt失效,失败不缓存为成功。
正常联网:不发送动作HELLO能力、pending action pin或 capabilities.ready,不向VoiceSession安装新actionPack。服务器reviewregistry保持旧pin,未改或重启gateway。模型时间、provider、TTS声音/参数、ASR/VAD未动。离线设置里的两个舞蹈检查可使用已机验媒体,不联网、不启mic/cam;它不代表舞蹈进出接缝、听审或真机GPU通过。主画面继续角色+gear,待验信息只在设置。
## 可复现导入与构建
先确认交付 `TRANSFER_VERIFIED.json`,独立核验精确index/all inventory;不得替换未知文件或修改asset owner目录。新 evidence 目录须不存在。
```sh
python3 scripts/package-avatar-user-candidate.py \
--manifest .runtime/avatar-imports/a01-black-tulle-roomy720-correct03-208f703ed92b/candidate-roomy720-correct-03/manifest.json \
--user-authorized-sha 208f703ed92bf795bfeb78a1cef89b67bed2e45da80038a56157fd1ecd4cfa93 \
--output logs/black-tulle-correct03/new-check --import-only
```
此入口不接受 `--pi-pin`/live action registry,不冒充审批。全机验后只复制引用文件,原bytes不变。poster重建入口是 `scripts/prepare-user-avatar-startup.py --source <candidate>`,已有输出不符则拒绝覆盖。`manifests/startup-black-tulle-correct03.json` 记录恢复provenance;人物PNG/video仍Git ignored。旧Pi发布入口及白衣资产字节保护不变。
完成真实回归、记录 source fingerprints 到 ignored `logs/black-tulle-correct03/checks.json` 后,同一入口 `--build --version-code <fresh-code> --output <fresh-dir>` 构建0.7.12;本次最终候选code31;版本占用则拒绝,绝不覆盖旧APK。实际包需验签/badging、精确pin和3454引用文件hash/bytes、bootstrap、媒体未压缩、审核文件排除、旧非替换资产原字节与HTTP bytes。
## 验证边界与后续
机器结果和宿主callback回放记录在 ignored `logs/black-tulle-correct03/`。宿主 Android/EGL/MediaPlayer/采集确认是doubles;GLES像素校验用实际source body/patch解码+生产shader在软件Mesa,OES采样器替换2D。两者均不等于手机GPU、音轨真实stop、TTS或相机测试。
尚待音乐人类听审/无唱语义、新neutral舞蹈进入与返回接缝、真人设备解码/GPU/启动性能/温度/自然度及画像音乐权利。没有安装或采集用户手机。舞蹈联网开放需另行独立review和精确server registry;本次没有该准入。
本step paid/model/generation calls=0;不改变资产owner账本。code29诊断器与code21播放器时钟修复保留,相机仍是诊断候选,不借新素材声明相机已修好。
## 实际回归与交付记录
- 11 JVM/UI入口全部通过,包括新增candidate默认拒绝/非debug拒绝/精确hash与self-approval门禁、schema2五档无冗余别名解析、partial alias/错L4/缺level拒绝。cache新增严格新目录+精确pin+validator3准入;unknown root、错pin和旧validator拒绝。
- 53包装通过;网关110通过+1既有Silero模型不随源码归档的skip,没有下载/运行额外模型。
- 13套实际720 runtime解码+生产shader:520软件GLES像素案例通过,涵盖五档/L0精确body/Fit/OES替代的UV与alpha。
- Gradle assembleDebug和instrumentation Kotlin编译通过;instrumentation未在设备运行。
- 实际APK loader/宿主播放回放通过:happy1/sad1、反复新轮的idle合法返回、从neutral/happy出发动作193帧层独占,native completion后释放并回neutral0。此包声明returnFrame0,与旧白衣return96不同;严按新index执行,不复制旧锚点。record/surface/native音轨均为doubles,不声称真机接缝或听审通过。
- 首个内部code30包在启动repository回放发现cache key旧目录硬编码,未作为可用交付。code30 hash文件保留、不可用于安装验收;补齐严格目录/pin门禁并回归,最终采用新code31,不覆盖code30。
- 修后实际包assets的startup repository宿主cold/receipt回放:main_asset_reads=0;cold3425patch校验、receipt0patch读取;同进程reload0。不是手机性能数值。
协调安装后先普通launcher看新poster→新neutral loop→full ready;再用设置“离线预览”检查新happy/sad、idle ownmouth和两个8秒音乐动作。normal联网只能表情/idle/TALK,新pin不发送舞蹈能力;没有服务器动作allowlist准入。不要把离线检查当正常网络舞蹈已开放。normal启动会沿用当前权限/连接行为,code29常规相机暂缓的诊断策略未改。
如果需要回滚角色/应用,使用保留的code29或更早白衣包;Android降版安装由coord按用户现有授权决定,不自动清数据、不开无线调试。源码备份和导入目录不含素材Git提交。
最终 APK:`http://192.168.31.124:8080/lan-voice-v0712-black-tulle-correct03-code31-arm64-debug.apk`,0.7.12/code31,SHA256 `28ad1b3cb9bf91a82b14b9f451ef71e565fcf75b57d7936976218fafd5a364be`。
同debugcert `b9608336bc1ed1de3269bb4594f9fe718daaa5439511c5187aa385d2b799dcf1`,包com.gorios.lanvoice/arm64/min26/target34。3454新运行引用文件+2bootstrap+594原非替换avatar文件=4050 avatar files,review0。APK与checksum HTTP bytes均独立核验。未实际安装或运行新包手机。
最终回执可由coord转交Local w8:p1/v-i-asset;当前远端Codex任务列表没有该Local agent,不能声称已直接送达。回执为实际采用上述index、parser/import/build通过、code31候选及上述未测边界,不要求asset方修原metadata或重做付费素材。
@@ -0,0 +1,118 @@
{
"schemaVersion": 1,
"sourceIndexSha256": "208f703ed92bf795bfeb78a1cef89b67bed2e45da80038a56157fd1ecd4cfa93",
"posterSha256": "dc073c8b476f63d9c1d06da193448c6edbaad5a166f47bb3aaf4367efcd5c879",
"posterWidth": 180,
"posterHeight": 320,
"provenance": "Exact decoded neutral source frame0; CPU downsample, no generated media; user-authorized debug integration, not Pi certification",
"body": {
"path": "avatar/a01-black-tulle-roomy720-correct03/runtime/neutral/body/idle.mp4",
"sha256": "f51effea0f3b957fe223e6a6f3587bb80a13bf2b4ff7ac9fd863cbcf06139090",
"width": 720,
"height": 1280,
"frameCount": 97,
"ptsUs": [
0,
41667,
83333,
125000,
166667,
208333,
250000,
291667,
333333,
375000,
416667,
458333,
500000,
541667,
583333,
625000,
666667,
708333,
750000,
791667,
833333,
875000,
916667,
958333,
1000000,
1041667,
1083333,
1125000,
1166667,
1208333,
1250000,
1291667,
1333333,
1375000,
1416667,
1458333,
1500000,
1541667,
1583333,
1625000,
1666667,
1708333,
1750000,
1791667,
1833333,
1875000,
1916667,
1958333,
2000000,
2041667,
2083333,
2125000,
2166667,
2208333,
2250000,
2291667,
2333333,
2375000,
2416667,
2458333,
2500000,
2541667,
2583333,
2625000,
2666667,
2708333,
2750000,
2791667,
2833333,
2875000,
2916667,
2958333,
3000000,
3041667,
3083333,
3125000,
3166667,
3208333,
3250000,
3291667,
3333333,
3375000,
3416667,
3458333,
3500000,
3541667,
3583333,
3625000,
3666667,
3708333,
3750000,
3791667,
3833333,
3875000,
3916667,
3958333,
4000000
],
"durationUs": 4041667,
"fpsNumerator": 24,
"fpsDenominator": 1,
"hasAudio": false
}
}
+19 -4
View File
@@ -4,11 +4,12 @@ Android EGL/codec/music/record confirmations are doubles; no device or sockets.
"""
from pathlib import Path
import ast,subprocess,tempfile,json,hashlib
import argparse
import argparse, zipfile
parser=argparse.ArgumentParser(description=__doc__)
parser.add_argument('--apk',type=Path,required=True)
parser.add_argument('--sha256',required=True)
parser.add_argument('--startup-loader',action='store_true',help='Production background repository over actual APK bytes, isolated private receipt, no rendering/connection')
parser.add_argument('--user-asset-candidate',action='store_true',help='Exact user-authorized correct03 APK: network dance disabled; local media callbacks are doubles')
args=parser.parse_args()
assert hashlib.sha256(args.apk.read_bytes()).hexdigest()==args.sha256, 'APK hash drift'
ROOT=Path(__file__).resolve().parents[1];script=ROOT/'scripts/check-reply-regressions.py'
@@ -93,6 +94,19 @@ object BuildConfig { const val AVATAR_STARTUP_FIX=false;const val DEBUG=true;con
const val EMOTION_MANIFEST_SHA="987e125a7d7a2cde99121b5f5246c82f4dbe36c4899d3d49eaffd1a68bafb887"
const val NATURAL_MANIFEST_SHA="0a3c4918ba746019cf1df885bec66e5858a8950997dac4f64e7d37094be64dad"
}'''
if args.user_asset_candidate:
import importlib.util
spec=importlib.util.spec_from_file_location('user_startup',ROOT/'scripts/prepare-user-avatar-startup.py');asset_config=importlib.util.module_from_spec(spec);spec.loader.exec_module(asset_config)
with zipfile.ZipFile(args.apk) as archive:
raw=archive.read('assets/'+asset_config.ASSET_ROOT+'manifest.json');assert hashlib.sha256(raw).hexdigest()==asset_config.PIN
index=json.loads(raw);refs=[p['runtimeManifest'] for p in index['conversationPackages']]+[e['mouthRuntimeManifest'] for e in index['edges'] if 'mouthRuntimeManifest' in e]
patch_count=sum(len(json.loads(archive.read('assets/'+asset_config.ASSET_ROOT+r['path']))['patches'])*5 for r in refs)
build=build.replace('const val EMOTION_MANIFEST_SHA="987e125a7d7a2cde99121b5f5246c82f4dbe36c4899d3d49eaffd1a68bafb887"','const val EMOTION_MANIFEST_SHA="'+asset_config.PIN+'"')
build=build.replace('const val AVATAR_STARTUP_FIX=false','const val AVATAR_STARTUP_FIX=true')
build=build.replace('object BuildConfig {','object BuildConfig { const val AVATAR_USER_ASSET_CANDIDATE=true;const val EMOTION_ASSET_ROOT="'+asset_config.ASSET_ROOT+'";const val STARTUP_ASSET_ROOT="'+asset_config.BASIC_ROOT+'";const val STARTUP_MANIFEST_SHA="'+hashlib.sha256((ROOT/'manifests/startup-black-tulle-correct03.json').read_bytes()).hexdigest()+'";')
else:
patch_count=3185
build=build.replace('object BuildConfig {','object BuildConfig { const val AVATAR_USER_ASSET_CANDIDATE=false;const val EMOTION_ASSET_ROOT="avatar/a01-expression-action-v1/";const val STARTUP_ASSET_ROOT="avatar/startup-white-01/";const val STARTUP_MANIFEST_SHA="461f5cfc10036de5f10ca3ce765fb8d9998697d3fd035aa9b1862d2ccfc3eaa2";')
main=r'''
import com.gorios.lanvoice.avatar.*
import com.gorios.lanvoice.dialogue.*
@@ -107,7 +121,7 @@ fun main(args: Array<String>) {
println("LOADER|status=${pack.motionStatus}|full=${pack.emotionAction!=null}|actions=${pack.emotionAction?.actionPack?.assets?.size}")
val index=checkNotNull(pack.emotionAction)
fun rig(): Triple<EmotionActionAvatarView,AvatarMediaBinding,MutableList<Pair<Long,VideoPresentation>>> {
TestScheduler.reset();CodecFixture.reset();MediaPlayer.created.clear();CodecFixture.emitNativeSurface=true
TestScheduler.reset();CodecFixture.reset();CodecFixture.width=pack.continuous!!.body.width;CodecFixture.height=pack.continuous!!.body.height;MediaPlayer.created.clear();CodecFixture.emitNativeSurface=true
index.packages.values.forEach { CodecFixture.timelines[it.root+it.body.path]=it.body.ptsUs }
index.edges.mapNotNull { it.mouthRuntime }.forEach { CodecFixture.timelines[it.root+it.body.path]=it.body.ptsUs }
index.actionPack?.assets?.mapNotNull { it.media }?.forEach { CodecFixture.timelines[it.root+it.path]=it.ptsUs;CodecFixture.audioPaths.add(it.root+it.path) }
@@ -179,7 +193,7 @@ fun main(args: Array<String>) {
}
check(textures[3].alpha==1f && textures.take(3).all { it.alpha==0f })
}
println("DANCE_OWNER|initial=${initial.wire}|frames=241|music_visible=241|conversation_visible=0|state=${binding.diagnosticState}")
println("DANCE_OWNER|initial=${initial.wire}|frames=${index.actionPack.assets.first().media!!.ptsUs.size}|music_visible=${index.actionPack.assets.first().media!!.ptsUs.size}|conversation_visible=0|state=${binding.diagnosticState}")
TestScheduler.advanceBy(50);movie.completion!!(movie);TestScheduler.until(15000) { statuses.last().status!="started" }
println("DANCE|ended=${statuses.last().status}|released=${movie.released}|return=${binding.currentPackageId}")
printTrace("dance_${initial.wire}",trace);check(statuses.last().status=="completed");check(binding.currentPackageId=="neutral-01");view.dispose();TestScheduler.advanceBy(100)
@@ -212,11 +226,12 @@ fun main(args: Array<String>) {
with tempfile.TemporaryDirectory(prefix='baji-runtime-audit-') as td:
tmp=Path(td);files=[]
for path in (ROOT/'tests/avatar').glob('*.kt'):
if path.name not in ('Pack.kt','Context.kt','Graphics.kt') and not(args.startup_loader and path.name=='Clock.kt'):files.append(path)
if path.name not in ('Pack.kt','Context.kt','Graphics.kt','BuildConfig.kt') and not(args.startup_loader and path.name=='Clock.kt'):files.append(path)
if args.startup_loader:
clock=(ROOT/'tests/avatar/Clock.kt').read_text().replace('fun getMainLooper() = main','private val owner=Thread.currentThread();fun myLooper(): Looper?=if(Thread.currentThread()===owner) main else null;fun getMainLooper() = main')
clock=clock.replace(' fun add(', ' @Synchronized fun add(').replace(' fun remove(', ' @Synchronized fun remove(').replace(' fun advanceBy(', ' @Synchronized fun advanceBy(')
p=tmp/'Clock.kt';p.write_text(clock);files.append(p)
startup_main=startup_main.replace("3185",str(patch_count))
for name,txt in [('Json.kt',json_adapter),('Context.kt',context),('Graphics.kt',graphics),('BuildConfig.kt',build),('Audit.kt',startup_main if args.startup_loader else main)]:
p=tmp/name;p.write_text(txt);files.append(p)
files+=real+[ROOT/'app/src/main/java/com/gorios/lanvoice'/p for p in ('avatar/AvatarPack.kt','avatar/StartupAvatarView.kt','avatar/StartupLoadCache.kt','diag/StartupTrace.kt')]
+4 -1
View File
@@ -35,9 +35,11 @@ parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--suite', choices=[name for name, _, _ in suites])
parser.add_argument('--runtime-manifest',type=Path,help='Additionally exercise real continuous parser with actual offline manifest metadata')
parser.add_argument('--index-manifest',type=Path,help='Additionally admit an exact offline v2 index and each referenced runtime through production parsers; no activation')
parser.add_argument('--user-authorized-debug-sha',help='Explicit exact user-authorized parent index for debug candidate admission; not Pi publication or network actions')
parser.add_argument('--metadata-only',action='store_true',help='Only the actual manifest admission, without repeating fixtures')
parser.add_argument('--rejection-report',type=Path,help='New bounded structural field report; no raw values')
args = parser.parse_args()
if args.user_authorized_debug_sha and (not args.index_manifest or args.user_authorized_debug_sha!='208f703ed92bf795bfeb78a1cef89b67bed2e45da80038a56157fd1ecd4cfa93'): parser.error('Exact authorized correct03 index required')
if args.index_manifest and args.runtime_manifest: parser.error('Choose runtime or index manifest, not both')
if args.metadata_only and not (args.index_manifest or args.runtime_manifest): parser.error('Actual manifest required')
if args.rejection_report and (not args.index_manifest or args.rejection_report.exists()): parser.error('Index and new rejection report required')
@@ -79,6 +81,7 @@ for name, main, real in suites:
else:
index_path=args.index_manifest.resolve(strict=True)
raw=index_path.read_bytes();digest=hashlib.sha256(raw).hexdigest()
if args.user_authorized_debug_sha and digest!=args.user_authorized_debug_sha: raise ValueError('User authorized index drift')
data=json.loads(raw);runtimes={};hashes={}
references=[row['runtimeManifest'] for row in data['conversationPackages']]
references += [edge['mouthRuntimeManifest'] for edge in data['edges'] if 'mouthRuntimeManifest' in edge]
@@ -95,7 +98,7 @@ for name, main, real in suites:
'fun main() {\nval root='+index_literal+'\nval runtimes='+runtime_literal+'\nval hashes='+hash_literal+'\n'+
'val parsed=runtimes.mapValues { (path,value) ->\nval hash=hashes.getValue(path) as String\n'+
'@Suppress("UNCHECKED_CAST")\nContinuousAvatarManifest.read(value as Map<String,Any?>,hash,hash,true,"fixture/"+path.substringBeforeLast(47.toChar())+"/",'+
'onReject={ field -> println("REJECT_FIELD|"+path+"|"+field) })\n}\n'+
'onReject={ field -> println("REJECT_FIELD|"+path+"|"+field) },userAuthorizedDebug='+str(bool(args.user_authorized_debug_sha)).lower()+')\n}\n'+
'val index=checkNotNull(EmotionActionManifest.read(root,"'+digest+'","'+digest+'","fixture/",'+
'onReject={ field -> println("REJECT_FIELD|manifest.json|"+field) }) { path,hash ->\n'+
'check(hashes[path]==hash)\nparsed[path]\n})\n'+
+4 -3
View File
@@ -114,7 +114,7 @@ def probe_music_clip(path):
'nearFullScaleSamples':sum(abs(x)>=0.999 for x in samples),'humanListening':'not_run'}
def check_bundle(manifest,expected,output):
def check_bundle(manifest,expected,output,user_authorized_debug=False):
manifest=manifest.resolve(strict=True);root=manifest.parent
require(re.fullmatch('[0-9a-f]{64}',expected) and file_sha(manifest)==expected,'candidate index drift')
index=read_json(manifest)
@@ -175,14 +175,15 @@ def check_bundle(manifest,expected,output):
require(p.stat().st_size==row['bytes'] and p.stat().st_size<=128_000_000 and file_sha(p)==row['sha256'],'declared file mismatch: '+name)
table[name]={'sha256':row['sha256'],'bytes':row['bytes']}
require(all(table.get(name)==row for name,row in files.items()),'inventory missing/mismatching referenced file')
require(not user_authorized_debug or expected=='208f703ed92bf795bfeb78a1cef89b67bed2e45da80038a56157fd1ecd4cfa93','exact user-authorized debug index required')
log=output/'production-index-tests.txt'
with log.open('x') as f:
result=subprocess.run([sys.executable,str(ROOT/'scripts/check-reply-regressions.py'),'--suite','avatar','--index-manifest',str(manifest)],stdout=f,stderr=subprocess.STDOUT,timeout=180)
result=subprocess.run([sys.executable,str(ROOT/'scripts/check-reply-regressions.py'),'--suite','avatar','--index-manifest',str(manifest),*(['--user-authorized-debug-sha',expected] if user_authorized_debug else [])],stdout=f,stderr=subprocess.STDOUT,timeout=180)
require(result.returncode==0 and 'PASS: actual exported v2 index parsed' in log.read_text(),'production index admission failed; see '+str(log))
files['manifest.json']={'sha256':expected,'bytes':manifest.stat().st_size}
for name,row in files.items(): require(file_sha(locate(root,name))==row['sha256'],'bundle changed during gate')
report={'status':'passed','scope':'read_only_machine_gate_no_approval_no_activation','manifest_sha256':expected,
'runtime_packages':runtimes,'combined_rgba_bytes':rgba,'referenced_files':len(files),'preview_files_not_packaged':len(table.keys()-files.keys()),
'user_authorized_debug':user_authorized_debug,'runtime_packages':runtimes,'combined_rgba_bytes':rgba,'referenced_files':len(files),'preview_files_not_packaged':len(table.keys()-files.keys()),
'edge_count':len(index['edges']),'action_count':len(actions),'dance_available':False,
'candidate_dance_validated':bool(actions),'action_measurements':action_measurements,'production_kotlin_index':'passed',
'naturalness':'not_certified','real_device':'not_run','files':files}
+92
View File
@@ -0,0 +1,92 @@
#!/usr/bin/env python3
"""Exact user-authorized correct03 debug import/build; no Pi spoof or network dance admission.
Keep the separate Pi-reviewed white publication workflow unchanged. Owner media is read-only.
"""
import argparse, importlib.util, json, re, shutil, subprocess, urllib.request, zipfile
from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
def module(name,path):
spec=importlib.util.spec_from_file_location(name,path);obj=importlib.util.module_from_spec(spec);spec.loader.exec_module(obj);return obj
pack=module('pack',ROOT/'scripts/package-avatar-emotion.py')
startup=module('startup',ROOT/'scripts/prepare-user-avatar-startup.py')
PIN=startup.PIN
WHITE_PIN=pack.RUNTIME_FIX_PIN
OLD=ROOT/'artifacts/lan-voice-v0711-camera-matrix-code29-arm64-debug.apk'
OLD_SHA='34905e98534d3b93b769717dd895183e2b06a87e70b564c0ac50c856f8ffa8de'
require=pack.require
def authorization(pin,pi_pin=None,registry=None):
require(pin==PIN,'exact user authorization required')
require(pi_pin is None and registry is None,'user debug path cannot label Pi approval or install a dance registry')
return {'authorization':'user_exact_revision_debug_integration','manifest_sha256':PIN,
'independent_pi_pin':False,'network_dance_available':False,'music_listening':'not_run','device':'not_run'}
def verify_apk(apk,report):
require(pack.file_sha(OLD)==OLD_SHA,'code29 rollback drift')
with zipfile.ZipFile(OLD) as old,zipfile.ZipFile(apk) as new:
paths=lambda z:{n for n in z.namelist() if n.startswith('assets/avatar/') and not n.endswith('/')}
retained={n for n in paths(old) if not n.startswith(('assets/'+pack.ASSET_ROOT,'assets/avatar/startup-white-01/'))}
actual={'assets/'+startup.ASSET_ROOT+n for n in report['files']}
basic={'assets/'+startup.BASIC_ROOT+n for n in ('manifest.json','poster.png')}
require(paths(new)==retained|actual|basic,'unreferenced/missing avatar files')
for n in retained:require(new.read(n)==old.read(n),'rollback asset changed: '+n)
for n,row in report['files'].items():
data=new.read('assets/'+startup.ASSET_ROOT+n)
require(len(data)==row['bytes'] and pack.sha(data)==row['sha256'],'packaged hash/bytes mismatch: '+n)
meta=(ROOT/'manifests/startup-black-tulle-correct03.json').read_bytes();m=json.loads(meta)
require(new.read('assets/'+startup.BASIC_ROOT+'manifest.json')==meta and m['sourceIndexSha256']==PIN,'bootstrap index mismatch')
require(pack.sha(new.read('assets/'+startup.BASIC_ROOT+'poster.png'))==m['posterSha256'],'poster mismatch')
for n in paths(new):
if n.endswith('.mp4'):require(new.getinfo(n).compress_type==zipfile.ZIP_STORED,'compressed video')
return {'runtime_referenced_files':len(actual),'retained_legacy_avatar_files':len(retained),'bootstrap_files':2,'all_avatar_files':len(paths(new)),'review_files_packaged':0}
def publish(report,output,version):
checks=pack.read_json(ROOT/'logs/black-tulle-correct03/checks.json')
require(checks['status']=='passed' and checks['jvm_entry_points']==11 and checks['gateway_passed']>=110 and checks['gateway_skipped']==1 and checks['packaging_passed']>=48 and checks['gles_cases']>=200,'actual completed regression evidence required')
for name,digest in checks['hashes'].items():require(pack.file_sha(ROOT/name)==digest,'untested source: '+name)
require(version>=30 and version>=pack.next_version((ROOT/'artifacts').glob('*.apk')),'version occupied')
flags=['-PavatarUserAssetCandidate=true','-PavatarActionCandidate=true','-PavatarNatural=true','-PavatarMouthCandidate=true',
'-PnaturalManifestSha='+pack.LEGACY_PIN,'-PemotionManifestSha='+PIN,'-PactionVersionCode='+str(version)]
flags += ['-P'+name+'=true' for name in ('avatarFullActionCandidate','avatarPlaybackClockFix','avatarStartupFix','presenceCandidate','faceDiagnosticsFix','cameraCompatibilityFix','cameraDirectYuv','cameraPreviewStream','cameraProbeDiagnostic')]
subprocess.run([str(ROOT/'scripts/build.sh'),'assembleDebug','compileDebugAndroidTestKotlin',*flags],check=True,cwd=ROOT)
built=ROOT/'app/build/outputs/apk/debug/app-debug.apk';badge=pack.badging(built)
for value in ("name='com.gorios.lanvoice'",f"versionCode='{version}'","versionName='0.7.12'","sdkVersion:'26'","targetSdkVersion:'34'"):
require(value in badge,'APK metadata: '+value)
require(re.search(r'^native-code: (.+)$',badge,re.M)[1].strip()=="'arm64-v8a'",'APK ABI')
cert=subprocess.check_output([str(pack.TOOLS/'apksigner'),'verify','--verbose','--print-certs',str(built)],text=True)
require(re.search(r'Signer #1 certificate SHA-256 digest: (\w+)',cert)[1]==pack.CERT,'same debug certificate required')
inventory=verify_apk(built,report)
config=(ROOT/'app/build/generated/source/buildConfig/debug/com/gorios/lanvoice/BuildConfig.java').read_text()
for value in ('AVATAR_USER_ASSET_CANDIDATE = true','AVATAR_STARTUP_FIX = true','EMOTION_MANIFEST_SHA = "'+PIN+'"','EMOTION_ASSET_ROOT = "'+startup.ASSET_ROOT+'"','STARTUP_MANIFEST_SHA = "'+pack.file_sha(ROOT/'manifests/startup-black-tulle-correct03.json')+'"'):
require(value in config,'BuildConfig mismatch: '+value)
artifact=ROOT/f'artifacts/lan-voice-v0712-black-tulle-correct03-code{version}-arm64-debug.apk'
with artifact.open('xb') as f,built.open('rb') as source:shutil.copyfileobj(source,f)
digest=pack.file_sha(artifact);checksum=f'{digest} {artifact.name}\n'.encode()
with artifact.with_suffix('.apk.sha256').open('xb') as f:f.write(checksum)
url='http://192.168.31.124:8080/'+artifact.name
opener=urllib.request.build_opener(urllib.request.ProxyHandler({}))
with opener.open(url,timeout=30) as r:require(r.status==200 and pack.sha(r.read())==digest,'HTTP bytes mismatch')
with opener.open(url+'.sha256',timeout=15) as r:require(r.status==200 and r.read()==checksum,'HTTP checksum mismatch')
delivery={'status':'user_authorized_debug_asset_candidate','version_name':'0.7.12','version_code':version,'url':url,'sha256':digest,
'certificate_sha256':pack.CERT,**authorization(PIN),**inventory,'combined_rgba_bytes':report['combined_rgba_bytes'],
'http_bytes_verified':True,'gateway_deployed':False,'paid_calls':0,'naturalness':'not_certified'}
(output/'delivery.json').write_text(json.dumps(delivery,indent=2)+'\n');return delivery
def main():
parser=argparse.ArgumentParser(description=__doc__)
parser.add_argument('--manifest',type=Path,required=True);parser.add_argument('--user-authorized-sha',required=True)
parser.add_argument('--output',type=Path,required=True);parser.add_argument('--import-only',action='store_true');parser.add_argument('--build',action='store_true')
parser.add_argument('--version-code',type=int,default=30);args=parser.parse_args()
auth=authorization(args.user_authorized_sha);manifest=args.manifest.resolve(strict=True);out=args.output.resolve()
require(not out.exists() and not out.is_relative_to(manifest.parent),'fresh evidence outside owner storage required')
out.mkdir(parents=True)
report=pack.check_bundle(manifest,PIN,out,user_authorized_debug=True)
if args.import_only or args.build:
pack.import_files(manifest.parent,report['files'],ROOT/'app/src/main/assets'/startup.ASSET_ROOT)
basic=startup.prepare(manifest.parent)
(out/'import.json').write_text(json.dumps({**auth,'files':len(report['files']),'asset_root':startup.ASSET_ROOT,'bootstrap':basic},indent=2)+'\n')
result=publish(report,out,args.version_code) if args.build else report
print(json.dumps({k:v for k,v in result.items() if k not in ('files','runtime_packages')},indent=2))
if __name__=='__main__':
try:main()
except Exception as e:raise SystemExit('FAIL: user asset integration: '+str(e))
+43
View File
@@ -0,0 +1,43 @@
#!/usr/bin/env python3
"""Derive a bounded poster/bootstrap from the exact user-authorized immutable pack.
CPU decode only. Portrait outputs stay ignored; the metadata records exact provenance.
"""
import argparse, hashlib, io, json, subprocess
from pathlib import Path
from PIL import Image
ROOT=Path(__file__).resolve().parents[1]
PIN='208f703ed92bf795bfeb78a1cef89b67bed2e45da80038a56157fd1ecd4cfa93'
ASSET_ROOT='avatar/a01-black-tulle-roomy720-correct03/'
BASIC_ROOT='avatar/startup-black-tulle-correct03/'
sha=lambda data:hashlib.sha256(data).hexdigest()
def derive(source):
index=source/'manifest.json';assert sha(index.read_bytes())==PIN,'exact index drift'
m=json.loads(index.read_bytes());row=next(r for r in m['conversationPackages'] if r['id']==m['fallbackPackageId'])
runtime=source/row['runtimeManifest']['path'];assert sha(runtime.read_bytes())==row['runtimeManifest']['sha256']
body=json.loads(runtime.read_bytes())['body'];name=str(Path(row['runtimeManifest']['path']).parent/body['path'])
path=source/name;assert sha(path.read_bytes())==body['sha256']
assert (body['width'],body['height'])==(720,1280) and body['ptsUs'][0]==0 and body['hasAudio'] is False
native=subprocess.check_output(['/home/ubuntu/gori-bin/ffmpeg','-v','error','-i',str(path),'-frames:v','1','-f','image2pipe','-vcodec','png','-'],timeout=30)
image=Image.open(io.BytesIO(native)).convert('RGB').resize((180,320),Image.Resampling.LANCZOS)
out=io.BytesIO();image.save(out,format='PNG',optimize=True);poster=out.getvalue();assert len(poster)<=100_000
meta={'schemaVersion':1,'sourceIndexSha256':PIN,'posterSha256':sha(poster),'posterWidth':180,'posterHeight':320,
'provenance':'Exact decoded neutral source frame0; CPU downsample, no generated media; user-authorized debug integration, not Pi certification',
'body':{**body,'path':ASSET_ROOT+name}}
return (json.dumps(meta,indent=2)+'\n').encode(),poster
def prepare(source,verify_only=False):
raw,poster=derive(source)
outputs={ROOT/'manifests/startup-black-tulle-correct03.json':raw,
ROOT/'app/src/main/assets'/BASIC_ROOT/'manifest.json':raw,
ROOT/'app/src/main/assets'/BASIC_ROOT/'poster.png':poster,
ROOT/'app/src/main/res/drawable-nodpi/startup_black_tulle_poster.png':poster}
for path,data in outputs.items():
if path.exists():assert path.read_bytes()==data,'Unknown bootstrap bytes preserved: '+str(path)
else:
assert not verify_only,'missing bootstrap: '+str(path)
path.parent.mkdir(parents=True,exist_ok=True);path.write_bytes(data)
return {'status':'passed','index_sha256':PIN,'bootstrap_sha256':sha(raw),'poster_sha256':sha(poster),'poster_bytes':len(poster),'paid_calls':0}
if __name__=='__main__':
parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--source',type=Path,required=True);parser.add_argument('--verify-only',action='store_true')
args=parser.parse_args();print(json.dumps(prepare(args.source,args.verify_only),indent=2))
+1
View File
@@ -11,6 +11,7 @@ fun main() {
reportedActionClockCheck()
playbackDiagnosticCheck()
boundedRuntimeDiagnosticCheck()
userCandidateAdmissionCheck()
dynamicBodyCheck()
actionCheck()
emotionActionCheck()
+2
View File
@@ -0,0 +1,2 @@
package com.gorios.lanvoice
object BuildConfig { const val AVATAR_USER_ASSET_CANDIDATE=false }
+1 -1
View File
@@ -1,2 +1,2 @@
package com.gorios.lanvoice
object R { object drawable { const val startup_poster=1 } }
object R { object drawable { const val startup_poster=1;const val startup_black_tulle_poster=2 } }
+7
View File
@@ -26,6 +26,13 @@ fun startupCacheCheck() {
receipt.complete(key(install=2));check(!receipt.contains(key()) && receipt.contains(key(install=2)))
} finally { folder.deleteRecursively() }
} finally { worker.shutdownNow() }
val userPin="208f703ed92bf795bfeb78a1cef89b67bed2e45da80038a56157fd1ecd4cfa93"
val userKey=StartupAssetKey(31,1,userPin,"avatar/a01-black-tulle-roomy720-correct03/",3)
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))) {
check(runCatching { StartupAssetKey(31,1,pin,root,version) }.isFailure)
}
println("PASS: production startup shared-future concurrency/cancel/cache/failure-retry and atomic immutable APK receipt corruption/install/pin/version/validator invalidation")
}
+23
View File
@@ -0,0 +1,23 @@
import com.gorios.lanvoice.avatar.*
@Suppress("UNCHECKED_CAST")
fun userCandidateAdmissionCheck() {
val hash="c".repeat(64);val root=dynamicRuntimeFixture(97,24,1,hash,720,1280)
val rows=root["patches"] as List<Map<String,Any?>>
val compact=root+("patches" to rows.map { it-"path"-"sha256" })
fun read(m: Map<String,Any?>,user: Boolean=false,debug: Boolean=true,expected: String=hash)=
ContinuousAvatarManifest.read(m,hash,expected,debug,"fixture/",userAuthorizedDebug=user)
val admitted=checkNotNull(read(compact));check(admitted.textureImages.size==485 && admitted.patches.first().path.endsWith("l4.png"))
val candidate=compact+("runtimeReady" to false)
check(read(candidate)==null);checkNotNull(read(candidate,true))
check(read(candidate,true,false)==null);check(read(candidate,true,true,"b".repeat(64))==null)
check(read(candidate+("publishApproval" to true),true)==null)
check(read(candidate-"runtimeReady",true)==null)
check(read(continuousFixture()+("runtimeReady" to false),true)==null)
check(read(compact+("patches" to listOf(rows[0]+("path" to "patches/wrong.png"))+rows.drop(1)))==null)
check(read(compact+("patches" to listOf(rows[0]-"sha256")+rows.drop(1)))==null)
check(read(compact+("patches" to listOf(rows[0]-"path")+rows.drop(1)))==null)
val levels=rows[0]["levels"] as List<Map<String,Any?>>
check(read(compact+("patches" to listOf((rows[0]-"path"-"sha256")+("levels" to levels.dropLast(1)))+rows.drop(1)))==null)
check(read(candidate+("body" to (root["body"] as Map<String,Any?>)+("width" to 480)),true)==null)
println("PASS: user-authorized debug-only candidate admission; default/release/hash/self-approval/legacy fences retained; schema2 level-only tracks and explicit-alias consistency, malformed levels rejected")
}
@@ -0,0 +1,55 @@
"""User debug authorization is separate from Pi/network action approval; preserve exact source bytes."""
import importlib.util, json, tempfile, unittest
from pathlib import Path
from unittest.mock import patch
ROOT=Path(__file__).resolve().parents[2]
spec=importlib.util.spec_from_file_location('user_pack',ROOT/'scripts/package-avatar-user-candidate.py')
pack=importlib.util.module_from_spec(spec);spec.loader.exec_module(pack)
class UserAssetPackageTests(unittest.TestCase):
def test_authorization_is_exact_not_pi_or_live(self):
a=pack.authorization(pack.PIN);self.assertFalse(a['independent_pi_pin']);self.assertFalse(a['network_dance_available'])
for pin,pi,registry in [('0'*64,None,None),(pack.PIN,pack.PIN,None),(pack.PIN,None,Path('registry'))]:
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("if (!avatarUserAssetCandidate && avatarPlaybackClockFix",s)
for root in ('avatar/a01-expression-action-v1/**','avatar/startup-white-01/**','avatar/a01-black-tulle-roomy720-correct03/**'):self.assertIn(root,s)
activity=(ROOT/'app/src/main/java/com/gorios/lanvoice/MainActivity.kt').read_text()
self.assertIn('reviewedActionPack = avatarPack?.emotionAction?.actionPack?.takeIf { !BuildConfig.AVATAR_USER_ASSET_CANDIDATE',activity)
self.assertIn('if(BuildConfig.AVATAR_STARTUP_FIX && !BuildConfig.AVATAR_USER_ASSET_CANDIDATE) BuildConfig.EMOTION_MANIFEST_SHA else null',activity)
self.assertIn('if(mediaReady && !BuildConfig.AVATAR_USER_ASSET_CANDIDATE)',activity)
self.assertIn('if(!offlineAvatarPreview && ::session.isInitialized && !BuildConfig.AVATAR_USER_ASSET_CANDIDATE)\n',activity)
self.assertIn('if(!offlineAvatarPreview && ::session.isInitialized) session.foreground',activity)
offline=(ROOT/'app/src/main/java/com/gorios/lanvoice/avatar/CallScreen.kt').read_text()
self.assertIn('OfflineDancePreview(pack?.emotionAction?.actionPack?',offline)
def test_level_only_alias_support_does_not_mutate_metadata(self):
parser=(ROOT/'app/src/main/java/com/gorios/lanvoice/avatar/ContinuousAvatarManifest.kt').read_text()
self.assertIn('!p.containsKey("path") && !p.containsKey("sha256")',parser)
self.assertIn('patch.path==levels[4].path && patch.sha256==levels[4].sha256',parser)
def test_bootstrap_exact_source_and_bound(self):
meta=json.loads((ROOT/'manifests/startup-black-tulle-correct03.json').read_bytes())
self.assertEqual(meta['sourceIndexSha256'],pack.PIN);self.assertEqual((meta['posterWidth'],meta['posterHeight']),(180,320))
self.assertTrue(meta['body']['path'].startswith(pack.startup.ASSET_ROOT));self.assertEqual(meta['body']['ptsUs'][0],0)
self.assertEqual((meta['body']['width'],meta['body']['height']),(720,1280))
# Bootstrap recreator rejects changed bytes rather than overwriting a previous image.
self.assertIn('Unknown bootstrap bytes preserved',(ROOT/'scripts/prepare-user-avatar-startup.py').read_text())
def test_packaged_inventory_rejects_review_and_correct02(self):
import zipfile
with tempfile.TemporaryDirectory() as directory:
old=Path(directory)/'old.apk';new=Path(directory)/'new.apk'
prefix='assets/'+pack.startup.ASSET_ROOT;meta=(ROOT/'manifests/startup-black-tulle-correct03.json').read_bytes()
poster=(ROOT/'app/src/main/assets'/pack.startup.BASIC_ROOT/'poster.png').read_bytes()
rows={prefix+'manifest.json':b'exact candidate',prefix+'own.png':b'own patches'}
report={'files':{n[len(prefix):]:{'sha256':pack.pack.sha(b),'bytes':len(b)} for n,b in rows.items()}}
basic={'assets/'+pack.startup.BASIC_ROOT+'manifest.json':meta,'assets/'+pack.startup.BASIC_ROOT+'poster.png':poster}
def write(path,files):
with zipfile.ZipFile(path,'w') as z:
for n,b in files.items():z.writestr(n,b)
write(old,{'assets/avatar/legacy/kept.png':b'rollback','assets/'+pack.pack.ASSET_ROOT+'manifest.json':b'old','assets/avatar/startup-white-01/poster.png':b'old'})
with patch.object(pack,'OLD',old),patch.object(pack,'OLD_SHA',pack.pack.file_sha(old)):
expected={'assets/avatar/legacy/kept.png':b'rollback',**rows,**basic};write(new,expected)
self.assertEqual(pack.verify_apk(new,report)['runtime_referenced_files'],2)
for n,b in [(prefix+'review.png',b'extra'),(prefix+'own.png',b'correct02'),('assets/avatar/legacy/kept.png',b'changed'),('assets/'+pack.startup.BASIC_ROOT+'poster.png',b'wrong')]:
write(new,{**expected,n:b})
with self.subTest(file=n),self.assertRaises(ValueError):pack.verify_apk(new,report)