Files
baji-vc/docs/AVATAR_PACK_V2_CONTRACT.md
T

7.2 KiB
Raw Blame History

Action/emotion runtime v2 contract

Development baseline: e3ee004d29ac472997a813fbdb641ba4983fa5ce (clean, remote main matched). This contract reserves the interface; it grants no naturalness/publication approval.

Asset owner: Localv-i-asset w8:p1. Code/importer owner: baji-action-emotion. No paid calls by code owner. Existing owner directories/previews are read only.

Deliver a new directory, manifest.json exact bytes SHA256 and preview/evidence paths. Manifest schemaVersion:2, identityId:a01, packId, fallbackPackageId, conversationPackages, edges, actions, files. Paths are relative without ../URLs; every file has SHA256/bytes. Pi approval pins exact manifest SHA outside the manifest. Self-authored approved/status fields never enable runtime capabilities.

Each conversation package: unique id, emotion:neutral|happy|sad, visualIntensity:0|1, mouthBodySha256, runtimeManifest:{path,sha256} referencing runtime04 format (continuous body + own actual N PTS registered frames × five RGBA aperture levels, own curves/anchors/coordinates). Body SHA, frame count and decoded PTS bind every mouth track to that exact body; no cross-body patches/masks/coordinates reuse. Happy/sad are slightly only, including model intensity2. Body is silent. No layer means whole-package fallback, never a neutral mouth over another body. Pi selected 1.1 source pixels for the candidate, based on fixed comparisons; dynamic naturalness review is still pending. Do not treat a numeric gap as approval.

Edges: id, from, to, fromAnchor, toAnchor, fromFrame, toFrame, clip:{path,sha256,width,height,frameCount,ptsUs,durationUs,fpsNumerator,fpsDenominator,hasAudio:false}. Edges also bind fromPtsUs and toPtsUs to the exact source/target body frame; fromFrame must be in that source package's legalExitFrames. Each package declares entryAnchor, exitAnchor, legalExitFrames, loopEdge. Frame indices/PTS are actual decoded values. Every changed body phase requires a reviewed edge, no arbitrary alpha cut. Supply dense seam frames, real-speed loops and full-scale/close previews, not just matching endpoints.

Actions: exactly asset_01, asset_02, kind:dance, mouthAllowed:false, disallowTALK:true, entryAnchor:A, returnAnchor:A, clip with file SHA/dimensions/frameCount/PTS/ duration/audio track metadata, audioEndUs, reviewEvidence. Use a single complete video including entry, music dance and return A, or list explicitly hashed sequential segments with reviewed edges. Music must actually exist, end naturally, and actor must not talk/sing. Source/music provenance and job/fee ledger stay in owner storage; Git stores metadata only.

Client advertises only Pi-pinned, machine-validated packs: action_protocol:1, action_pack_sha256, action_kinds:[dance]. Server has independent exact SHA allowlist/duration; unknown clients/packs get no actions. Server creates opaque action_id, connection generation/turn binding and TTL; never accepts URLs from LLM. action.plan is emitted only after pre-reply playback.drained. Client stops and confirms AudioRecord before playing; action.status started/completed/cancelled/ failed echoes action_id/turn_id. Completed requires video_ended, audio_stopped, idle_restored, mic_stopped, and minimum reviewed duration elapsed. Settings cancel, background, disconnect, new turn and expiry discard the after reply.

Asset handoff required first: slight happy/sad TALK samples and own runtime04 mouths/entry-exit evidence. Pi reviews exact manifest + timed previews; only then expand idle variants and two music dances. Gate1 and deterministic mock traces cannot certify naturalness or device AudioRecord/GPU/≤1s perception.

Runtime selection keeps selectedEmotion/selectedIntensity (model) distinct from visualEmotion/visualIntensity/packageId/degraded/reason (admitted visual). User camera cues are independent and never select these role packages. Production runtime04 parser: app/src/main/java/com/gorios/lanvoice/avatar/ContinuousAvatarManifest.kt; v2 index parser: app/src/main/java/com/gorios/lanvoice/avatar/EmotionActionManifest.kt. Each package should use packId:a01-expression-action-v1-<packageId>-runtime-04; New per-package runtime manifests use schemaVersion:2; only the old neutral runtime03/04 schemaVersion1 retains its fixed97@24 constraints. Each new body's frameCount:N, durationUs, fpsNumerator/fpsDenominator, ptsUs:[actual decoded presentation timestamps] are mandatory. No truncation/padding to97, no neutral track reuse. Counts121/49 and rational frame rates are supported independently. Current GLES shape remains480×848 (new shapes require renderer extension). N is bounded2..720, fps1..60, duration0.1..30s; body PTS starts0, strictly increases, remains below duration and agrees with measured duration/nominal fps within one nominal frame. Nonuniform actual PTS is accepted within two nominal frame intervals. Machine gate must compare decoded PTS/duration to declarations, not infer PTS. patchFormat.bodySha256 must equal body.sha256; patches has exactlyN entries, each frameIndex:i, ptsUs:body.ptsUs[i], own coordinates/mask and five independent level paths/hashes. Patch format remains straight RGBA8, [0,.25,.5,.75,1]; nearest level, nonzero opacity1, zero bypass. Each patch≤128×128, totalRGBA≤8MB/runtime; all packages combined≤32MB, ≤12packages. These are admission bounds, not GPU proof. Each of the five mouth states supplies own actual ptsUs, frameCount, fps ratio, durationMs (100..1000), alpha values and A/B anchors; curve timing no longer assumes24fps. Runtime04 mouthStates/stateRouting names and anchor rules stay intact. Entry/return bridges carry actual decoded frame PTS; audioEndUs records measured last audio timestamp, completion also waits actual media stop and restored A.

Current asset snapshot: happy/sad001 sources each actually97 frames; sad002 must be measured independently. 121/49 are compatibility test counts, not a claim about those files. The happy-01 draft hash 518865589fcff36259b864226cdc9651f742d6f56f3b58eeb98f241ef03d48e3 still used schema1/a01-slight-happy-01/body.framePTSUs at the read-only check; it is rejected, not silently relabeled or modified. Export schema2, packId a01-expression-action-v1-happy-01-runtime-04, body.ptsUs, patchFormat.bodySha256, and each mouth state's ptsUs. Use the same format for sad/neutral, independently measured. A frame0 enter bridge is legal only when its source declares frame0 in legalExitFrames; do not inherit old last-frame exits.

Read-only handoff check (new evidence file, does not import/activate): python3 scripts/check-avatar-runtime.py --manifest <runtime>/manifest.json --sha256 <exact-candidate-sha> --output logs/action-emotion/<new-evidence>.json. It checks file hashes, complete video decode, actual PTS/duration/fps, PNG RGBA shape/cache and production Kotlin admission. It rejects concurrent file drift. Deliver corrected runtime paths/hashes plus complete index hash, reviewed loop/ enter/return clip paths/hashes, timed seam previews and Pi's external exact pin. Conversation planning retains clip metadata and assigns each bridge execution a unique serial; stale completion cannot authorize a later bridge with the same id. Playback driver integration and capability activation remain separate work.