feat(avatar): add AvatarMetrics#1537
Conversation
🦋 Changeset detectedLatest commit: 9cea79b The changes in this PR will be included in the next version bump. This PR includes changesets to release 31 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| */ | ||
| signal?: AbortSignal; | ||
| }): Promise<RemoteTrackPublication> { | ||
| includeLocal?: boolean; |
There was a problem hiding this comment.
🟡 waitForTrackPublication second overload uses includeLocal?: boolean instead of includeLocal?: false, creating a type-safety hole
The second overload of waitForTrackPublication at agents/src/utils.ts:1101 declares includeLocal?: boolean, while the analogous second overload of waitForParticipant at agents/src/utils.ts:975 correctly uses includeLocal?: false. This inconsistency creates a type-safety hole: when a caller passes a boolean variable (not a literal true), TypeScript's overload resolution skips the first overload (includeLocal: true) because boolean is not assignable to the literal true, and matches the second overload instead, returning Promise<RemoteTrackPublication>. However, the implementation may actually return a LocalTrackPublication at runtime since includeLocal is truthy.
Example showing the type hole
const flag: boolean = getIncludeLocal(); // evaluates to true
// TypeScript resolves to second overload → Promise<RemoteTrackPublication>
const pub = await waitForTrackPublication({ room, kind, includeLocal: flag });
// pub is typed as RemoteTrackPublication but could be LocalTrackPublication
pub.subscribed; // property that may not exist on LocalTrackPublication| includeLocal?: boolean; | |
| includeLocal?: false; |
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
AvatarMetricsemittingavatar_join_latency(session start → avatar participant joined with video track) andplayback_latency(first audio frame forwarded → playback started).AvatarSessionso all avatar plugins emitmetrics_collectedwithout per-plugin code.avatar_identityan abstract property and add an overridableproviderproperty; apply both across all 13 avatar plugins (tavus, bey, anam, simli, avatario, avatartalk, liveavatar, lemonslice, runway, keyframe, did, trugen, bithuman).