Files
baji-vc/docs/AVATAR_SAFE_TRANSITIONS.md
T
zenord 9ea5eb31c1 feat: deliver clean avatar home in 0.6.2 UI debug candidate
Keep the avatar mounted while all connection, permission, privacy and diagnostic controls live in a settings sheet. Save the tested continuous-body renderer, safe transition driver and foreground HELLO/permission workflow from this session. Pin runtime03 for the code14 UI-only candidate; mouth deformation remains unresolved. Add source UI contracts, an optional sensor-free device probe, exact asset import and candidate packaging checks. Portrait binaries and diagnostics remain private and untracked.
2026-10-12 22:19:56 +08:00

10 KiB
Raw Blame History

Safe avatar transition interface — implementation and synthetic tests, not material approval

PCM native playback activity provides the latest desired mouth mode. It does not change video visibility. SafeTransitionPlanner is a pure state machine with no audio/network dependency. Audio abort and capture stop remain immediate; visual closing uses reviewed edges and may lag. No waiting policy delays audio or adds an audio startup buffer. Neither 200ms nor a 4s visual wait is accepted or claimed.

Optional manifest extension

SafeAvatarManifest.read(Map, actualManifestSha256, approvedManifestHashes) supports an optional schemaVersion:1 extension, safeTransitions.version:1. No extension gives LEGACY_UNANNOTATED and no runnable graph. Pending/unknown review gives REVIEW_PENDING and no graph even when times are omitted; inventing intervals to make a candidate parse is forbidden. Malformed approved metadata gives INVALID. Approved metadata needs the coordinator-approved exact SHA256 allowlist too; by default that list is empty. The current AvatarPack loader performs JSON-to-Map conversion, bounded byte/hash validation and fixed neutral graph completeness checks. The target is a01-neutral-graph-v1; its exact manifest hash allowlist is currently empty. See AVATAR_SAFE_061.md and AVATAR_NEUTRAL_GRAPH_INTERFACE.md for the current integration boundary.

A minimal honest candidate extension, with no synthetic timestamps:

{
  "version": 1,
  "reviewStatus": "pending",
  "anchors": [],
  "clips": [],
  "transitions": []
}

For a reviewed extension the following fields are required:

Object Fields and meaning
Graph reviewStatus, initialAssetId, initialEntryId, anchors, clips, transitions
Anchor id, closedMouth (reviewed entry observation), reviewStatus
Clip assetId referencing a declared id/path; role idle/opening/talk/closing/waiting; durationMs, frameCount, fpsNumerator/fpsDenominator; entryAnchors, safeExitWindows; reviewStatus, loop, loopSeamReviewStatus, seekReviewStatus
Entry/exit interval id, anchorId, startMs/endMs, startFrame/endFrame, reviewStatus; both ends are exclusive at end, frame indices start at0
Transition id, sourceAssetId, sourceWindowId, targetAssetId, targetEntryId, reviewStatus, earliestPolicy=next_safe_window, latestPolicy=next_reviewed_loop or hold, earliestWaitMs, optional latestWaitMs

Limits:32 clips,64 anchors,128 edges,32 entries/exits per clip, ≤60s duration and wait budget, ≤3600 frames, bounded safe identifiers and relative paths under videos/frames/delivery. Time/index annotations must agree within frame rounding. Source window and target entry refer to the same reviewed anchor ID. A shared ID asserts that every allowed source/entry frame combination and motion junction was inspected, not that a single still looked similar. Shorter windows or explicit distinct anchors/edges are necessary if only specific frame pairs match. Frame0 or final frame is not automatically safe. Displayed head/eyes/mouth/body/hands/feet/background/shadow and motion speed/direction all matter.

Opening and closing are explicit actual clip nodes: idle→opening→talk→closing→idle, only if each junction is approved. No opaque bridgeAssetId shortcut is accepted. An already visible bridge follows a reviewed route for the newest intention; a reversal may require finishing its short path before closing. More poses/idle variations use pre-authored anchor IDs and assets, never the user's camera head pose. No complete emotion/pose cross-product is required. Review state is unknown/pending/approved/rejected; unknowns and rejected edges stay unusable.

latestWaitMs is a diagnostic budget only; exceeding it cannot authorize a cut. Clip lengths and budgets are metadata/configuration, never hardcoded4s. next_reviewed_loop can retry a missed window only when the source clip and its seam are approved. hold refuses to carry the offered edge into another loop. A talk segment cut out of an otherwise continuous source still needs its own approved tail→head loop. Matching first/last stills is insufficient to certify the seam or arbitrary-time transitions.

Driver contract

  1. Set a monotonic generation/revision/turn-scoped MouthIntent. Latest valid intent cancels staged old targets/offers. Wrong-turn PCM, old generations/revisions and old callbacks are fenced. Callbacks never write mouth intent. Abort/disconnect/drained desire idle; the legacy hangup planner case desires waiting but the latest UX has no hangup control.
  2. tick consumes fresh actual video positions and actual displayed-frame indices, loop ordinal, serial and continuity status. ActualClipCursor only tracks successive actual samples; it requires a separately observed displayedFrame, not a predicted frame. Wrap is recognized only near last/first two frames. Backward jitter, a seek or a gap long enough to miss a loop makes continuity unknown until reset. Position-derived frame estimates alone cannot prove that the target texture is showing that frame.
  3. On Stage, pause and seek/preload the hidden target at its approved entry. Await seek completion and a latched displayed texture frame in the interval. Do not advance an unrelated hidden clip phase. MEDIA_INFO_VIDEO_RENDERING_START alone is inadequate. Actual MediaPlayer/SurfaceTexture seek and texture timestamp behavior, decoder/GOP support, seek cost and target drift must be verified before connecting this contract to production UI.
  4. An OfferCut is only a proposal. Immediately before revealing, obtain a second fresh source observation still inside the same source window/loop and revalidate the paused target. commit returning Reveal is the only switch permission. A missed/stale/expired offer yields Hold; do not apply a delayed alpha change or crossfade. Default sample freshness40ms is configurable1–100ms; it is sample validity, not a synchronization SLA.
  5. A bridge may continue through approved junctions to the latest desired state. No reviewed path means keep the current mode and report NO_REVIEWED_EDGE; no invented closed pose, timeout cut, double-face crossfade or fake loop. An unreviewed loop cannot run forever; the future driver must stop advancing across its seam and report unavailable/hold according to explicit failure UX. Holding a final frame or emergency static fallback is an exception, not a reviewed continuous animation. Background releases immediately and invalidates renderer epochs. Foreground requires a new generation and an explicitly staged, verified neutral startup entry.

Optional reviewed mouthStateWindows (active/closed_stable with frame/time intervals) measure actual displayed mouth events, independently of role/reveal. Missing events leave completed response latency null; an ongoing wait is never reported as completed closure. Snapshot diagnostics include desired/actual role, generation/revision, finite reason, full pending visual wait, closing-entry lag, pending exit, switch/cancel counts. TransitionDiagnostics emits≤1Hz and clamps reported times to60s; snapshots retain full wait for local evaluation. Closing lag measures arrival at a reviewed closed-mouth entry, not a phoneme or every intervening frame. No chat, PCM, images, coefficients or raw error text. Requested reply expression remains separately real; neutral resolved fallback never rewrites it.

Current integration boundary and materials

The planner, strict optional manifest reader, cursor and diagnostics are implemented and tested against synthetic1s/20fps graph fixtures, which are not annotations for a01 material. They are now wired to SafeVideoDriver and the native CodecAnchorVideoPort with actual codec PTS/TextureView timestamp gates; deterministic API-double tests cover the adapter, while hardware/device rendering remains pending. The old arbitrary phase-switch renderer has been removed from current code. The latest UI supplies no seated motion pack. No approved safe graph is packaged. Audio/permission UX can therefore be tested independently; visual production completion still requires real reviewed assets and driver/device acceptance.

a01-v1 original materials and the published0.6.0 APK remain intact. Seated a01-v2, arms-down standing-v3, crossed-arms v2/v3-motion and the single3s raw experiment are archives with no usable approved graph. The latest accepted original crossed-arms reference SHA is36a078ad9e1d2929612e9baa2af524bda90dafceddc4515dd448fc08121d7dd2. The owner is producing a01-neutral-graph-v1 under the bounded five-call budget; quality gates and actual windows are pending. Do not promote first/last constraints, similarity rankings or static identity approval into safe motion approval.

Necessary material evidence before integration: accepted reference identity; actual decoded frame/time intervals for each entry/exit; approved edges including real opening/closing bridges if needed; approved idle/talk loop seams and ability to stage entry on target device; short dense ±0.5s junction sequences plus full-speed repeated loops and transitions; explicit latency tradeoff approval if safe exits are sparse. The number/cost of candidates is finite and separately agreed; no additional video generation is initiated here.

Available archived seated candidate previews (not standing materials):

  • .runtime/avatar-imports/a01-v2/review/switch-boundary-only-candidate.mp4 — complete-cycle candidate,20s.
  • .runtime/avatar-imports/a01-v2/review/switch-boundary-only.gif — convenience240px/12fps reduction, not acceptance at delivery spec.
  • .runtime/avatar-imports/a01-v2/review/boundary-idle-to-talk-dense-24.png
  • .runtime/avatar-imports/a01-v2/review/boundary-talk-to-idle-dense-24.png
  • .runtime/avatar-imports/a01-v2/review/idle-loop-5x.mp4
  • .runtime/avatar-imports/a01-v2/review/talk-loop-3x.mp4

Coordinator has local copies under /mnt/d/baji-vc-install/avatar-review/a01-v2/. Existing NumPy/Pillow interpreter is /home/ubuntu/miniconda3/bin/python3; ffmpeg /home/ubuntu/gori-bin/ffmpeg. No installation required. Viewing sampled PNGs or decoding frames does not establish full-speed visual or device approval.