Skip to content

Commit e539c21

Browse files
committed
fix(google-meet): satisfy prefer-const in realtime engine wiring
1 parent 179efbd commit e539c21

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

extensions/google-meet/src/realtime.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,6 @@ export async function startMeetAgentRealtimeEngine(params: {
241241
fullConfig: params.fullConfig,
242242
providers: params.providers,
243243
});
244-
let harness: RealtimeVoiceSessionHarness;
245244
params.logger.info(
246245
formatGoogleMeetAgentAudioModelLog({
247246
provider: resolved.provider,
@@ -325,7 +324,9 @@ export async function startMeetAgentRealtimeEngine(params: {
325324
});
326325
};
327326

328-
harness = createRealtimeVoiceSessionHarness({
327+
// The closures above only run after harness creation; they capture this later `const`.
328+
// Annotated because the consult closure references harness inside its own initializer.
329+
const harness: RealtimeVoiceSessionHarness = createRealtimeVoiceSessionHarness({
329330
talk: {
330331
sessionId: `google-meet:${params.meetingSessionId}:agent`,
331332
mode: "stt-tts",
@@ -485,8 +486,9 @@ export async function startMeetRealtimeEngine(params: {
485486
providers?: RealtimeVoiceProviderPlugin[];
486487
}): Promise<MeetRealtimeAudioEngineHandle> {
487488
let stopped = false;
488-
let bridge: RealtimeVoiceBridgeSession | undefined;
489-
let harness: RealtimeVoiceSessionHarness;
489+
// Not const: the synchronous onFatal replay can run stop() (and its bridge?.close())
490+
// before createBridge() below executes; a later `const` would throw at that read.
491+
let bridge: RealtimeVoiceBridgeSession | undefined = undefined;
490492
let realtimeReady = false;
491493
let lastClearAt: string | undefined;
492494
let clearCount = 0;
@@ -571,7 +573,9 @@ export async function startMeetRealtimeEngine(params: {
571573
: { meetingSessionId: params.meetingSessionId };
572574
const reasonTalkPayload = (reason: string) =>
573575
params.talkContext ? { bridgeId: params.talkContext.bridgeId, reason } : { reason };
574-
harness = createRealtimeVoiceSessionHarness({
576+
// The closures above only run after harness creation; they capture this later `const`.
577+
// Annotated because the consult closure references harness inside its own initializer.
578+
const harness: RealtimeVoiceSessionHarness = createRealtimeVoiceSessionHarness({
575579
talk: {
576580
sessionId: params.talkSessionId ?? `google-meet:${params.meetingSessionId}:command-realtime`,
577581
mode: "realtime",

0 commit comments

Comments
 (0)