Current state
Goals and non-goals
- Mira joins a meeting as a visible, audible participant that people can talk to.
- Only participants whose own current choice is on can ever be heard by Mira.
- Spend has a hard per-session, per-minute and per-workspace-day ceiling, and every session reaches a terminal state without operator action.
- Non-goals for the first release: workspace tools, web search, memory, recording of Mira’s audio, video input, and changing Private Mira.
Provider choice
Prices verified on 2026-11-24: Gemini rates are in
Meet Live assistants;
gpt-realtime-2.1 is $32 per million audio input tokens and $64 per million
audio output tokens (-mini: $10 and $20); claude-haiku-5-5 is $0.10 input
and $0.50 output per million tokens up to 100,000-token prompts.
A provider is selected per room session from MEET_ROOM_VOICE_PROVIDERS
(an allowlist on the Worker). The host picks one of the allowed providers; the
default is the first entry. Each provider is an adapter behind one interface
(connect, sendAudio, endTurn, interrupt, close, usage) so the
stop fence, mixer and billing stay provider-independent.
Architecture
Ownership
- A new SQLite Durable Object class,
MeetRoomVoiceDurableObject, in thetuturuuu-meetWorker (Wrangler migration tagmeet-room-voice-v1), one instance per meeting:idFromName("<workspaceId>:<meetingId>"). It owns the provider socket, the SFU adapters, the mixer, billing and the stop fence. - It is separate from
MeetLiveDurableObjectso Private Mira’s isolation (no room context, private memory, private playback) cannot regress. Shared code is imported, not shared storage: the workspace gate, billing helpers, usage parsing, registry heartbeat and provider drain. - The meeting room Durable Object in
tuturuuu-meet-realtimestays the consent authority. New commands, accepted only when the flag is on and refused otherwise:voice.reserve,voice.sources,voice.floor,voice.heartbeatandvoice.stop. The existinglive.*denials stay. - The provider key stays in the
tuturuuu-meetWorker (GOOGLE_GENERATIVE_AI_API_KEY, andOPENAI_API_KEYfor the OpenAI adapter), or comes from the workspace key store in Per-workspace BYOK. No key reaches the room Worker or a browser.
Room audio to the agent
The input path uses the Cloudflare Realtime SFU WebSocket adapter, which is generally available. In egress (stream) mode the SFU connects to awss:// endpoint we host and sends one protobuf Packet per WebSocket
message: signed 16-bit little-endian PCM, 48 kHz, stereo interleaved, at most
32 KB per message. The SFU retries a dropped egress connection for up to 15
seconds, may drop old frames, and sends no custom headers.
- The room returns the source set: for each participant whose current room Mira choice is on for the current acceptance revision, their account (or guest id), SFU session id, microphone track name and choice revision.
- For each source the Durable Object mints a source token: an HMAC over
{wsId, meetingId, voiceSessionId, fenceEpoch, accountId, trackName, choiceRevision, nonce, exp}with a dedicated secretMEET_ROOM_VOICE_SOURCE_SECRET, valid for 60 seconds to connect. It then callsPOST /v1/apps/{appId}/adapters/websocket/newwithlocation: "remote",outputCodec: "pcm"and the endpointwss://meet.tuturuuu.com/api/meet-room-voice/<wsId>/<meetingId>/in/<token>. Tokens travel in the path because the SFU sends no headers. - The Worker verifies the token, checks that its
wsIdandmeetingIdequal the path segments, and forwards the upgrade to the Durable Object keyed by<wsId>:<meetingId>. The Durable Object accepts a token once: it records thenonceas spent in storage before accepting the socket, binds the socket to that one source, and refuses any later upgrade with the same token.- Reconnects. Because tokens are single-use, the SFU’s own 15-second egress retry is refused. When a source socket drops, the Durable Object closes that adapter and creates a new one with a fresh token, at most 3 times per source per minute. After that the source stays out of the mix until the next source-set update.
- Log redaction. The token path segment is never logged: the route
logs only the template
/api/meet-room-voice/:wsId/:meetingId/in/:token, Workers invocation logs are off for this route’s Worker, and traces, analytics events and error reports replace the segment with[redacted]. A spent or expired token cannot open a socket, so a token that still reaches a log is not reusable.
- The mixer runs in 20 ms frames: downmix to mono, resample to the provider rate (16 kHz Gemini, 24 kHz OpenAI), apply a per-source energy VAD gate, sum with a soft limiter, and keep at most 200 ms of jitter buffer per source; late frames are dropped, never queued.
- Listening modes.
addressed(first release): only the participant who holds the floor (voice.floor, from Ask Mira in the call bar or a room chat mention) is mixed, for at most 60 seconds per turn, and the floor needs room Mira requester authority (so guests and free accounts can be heard only inlisteningmode).listening(later, separately flagged): every source in the set is mixed, and Mira is instructed to answer only when addressed by name.MEET_ROOM_VOICE_MAX_SOURCEScaps open egress adapters (default 1 inaddressed, 6 inlistening).
Excluding participants who turned Mira off
Exclusion is enforced in four places, so no single fault leaks audio:- No subscription. A participant without a current on choice never gets an egress adapter; the SFU never sends their track.
- Per-frame check. Every frame is admitted only if its socket’s source is in the in-memory source set, whose version equals the room’s consent version. The Durable Object processes one event at a time, so a withdrawal applied before a frame is never mixed after it.
- Withdrawal push. Turning Mira off sends a new source set from the room.
The Durable Object first drops the source from the mixer, then closes its
adapter (
/adapters/websocket/closeis idempotent) and its socket. - Provider context reset. Audio already sent cannot be recalled. On any withdrawal, acceptance change or notice version change, the Durable Object closes the provider session without resuming it, discards queued output and the resumption handle, and opens a fresh session with only the fixed instructions. Mira’s room conversation memory restarts; this matches the room chat rule that in-flight answers carrying a withdrawn source are discarded while their usage still settles.
Agent audio as a room track
Mira’s output is published through a WebSocket adapter in ingest (buffer) mode,location: "local", inputCodec: "pcm": the Durable Object upsamples 24 kHz
mono to 48 kHz stereo and sends 20 ms frames; the SFU publishes them as an Opus
track named mira-voice in a dedicated SFU session. Ingest does not reconnect,
so a dropped ingest adapter is recreated (bounded, see failure modes). The room
adds a synthetic presence entry { kind: 'agent', name: 'Mira' } with that
track; clients subscribe through the existing subscribe path, so
deliverRoomAssistantAudio stays false and no audio travels over the room
WebSocket. Mute Mira for me and the existing Mira voice volume control mute
that track locally. A participant whose Mira choice is off starts with
mira-voice muted: the client does not subscribe to the track until that
person unmutes it, and a choice change to off mutes it again. Turning Mira off
withdraws a person’s audio from Mira; it does not stop them hearing Mira
unless they keep it muted. Mira is never counted in attendance and cannot present.
Claude text agent
Status: disabled. The Claude text agent is not built or flagged on until the combined notice change ships with room voice. Because Claude has no audio API, a Claude room participant is a text agent:- Input: room chat mentions (the existing
ai.reservecontext rules) and live transcript lines. Transcript lines exist only while live transcription runs, which needs every admitted participant’s transcript Allow; when anyone is off, transcription pauses and the agent hears nothing new. - Model:
claude-haiku-5-5through the streaming Messages API (SSE), with the same dispatch leases (mira.room.dispatch/mira.room.release) as room chat. - Output: a room chat message tagged as Mira. Spoken output would need a separate TTS provider, which is not part of this design.
- No tools. Room chat Mira today attaches
createMeetWorkspaceTools(packages/meet-core/src/features/call/server/assistant-generation.ts). The Claude text agent gets no tools, no search and no memory writes. Its input includes untrusted live transcript lines, so spoken text must never reach a tool call. A test asserts that the request carries an empty tool set.
Combined notice change
The room notice names Google Gemini as the only model sub-processor. Naming Anthropic Claude and OpenAI as model sub-processors, and adding the voice purpose, ship as one notice change together with room voice, under a singleroom-v3 bump, so every participant consents again only once.
- Until room voice ships, the hashed keys and
MIRA_ROOM_NOTICE_VERSIONstay unchanged. The Anthropic or OpenAI wording never ships alone. - Before any hashed-text change, the complete combined EN and VI text, the new notice version and the updated required notice content go to the release authority as one reviewable draft. The text changes only after that draft is approved.
Consent
- New capability.
voicejoinsMIRA_ROOM_CAPABILITIES. Turning voice on is a capability expansion, so it ends the current acceptance and starts a new revision; everyone present confirms again and counts as off until they do. - Notice. Voice adds a purpose (Mira hears people who talk to it and speaks
in the meeting) and, for OpenAI, a new sub-processor. Both need new notice
text and a new notice version (
room-v3), which changes the hashed consent text and forces re-consent. This is the same single bump as the combined notice change. The wording goes through the legal review in Mira host consent. - Everyone informed. A system line when voice starts and ends; the Mira tile with an AI label; the header Mira control showing listening or speaking; a “Mira hears you” marker on each tile whose audio is mixed; and a fixed spoken disclosure in the meeting locale when Mira joins.
- Per-person choice. Only the source set (current on choices) is ever mixed. Turning Mira off for yourself withdraws voice, chat and transcript together, as today. Guests are keyed by server-issued guest id.
18+ attestation
Room voice has no exception: the meeting workspace needs the current owner’s stored attestation inprivate.workspace_mira_audience_attestations, the
acceptor confirms the meeting audience is 18 or older, and every Continue
prompt keeps its 18+ line. Report someone under 18 ends the acceptance,
which runs the stop fence at once, and then:
- Lockout. Room Mira (chat, transcript and voice) stays off for the rest of that meeting. Only the workspace owner can lift it, by confirming the audience again; the host and co-hosts cannot.
- Audit. The room writes a
minor_reportedevent with the meeting, workspace, reporter id and time, and aminor_lockout_liftedevent when the owner lifts it. Reports are rate-limited per reporter, and the reporter is never shown to other participants.
Host toggle and feature flag
- Host toggle. In the Mira popover, the host or a present co-host sees
Mira voice (off by default). On runs the acceptance flow with
voiceadded and the provider choice. Off callsvoice.stopand keeps the chat acceptance, because removing a capability narrows processing. - Flag.
MEET_ROOM_VOICE_ENABLEDmust equal exactlytrueon bothtuturuuu-meetandtuturuuu-meet-realtime; source configuration carriesfalse. All existing Meet AI gates still apply (MEET_AI_DISABLED, the workspace gate, the account rule). A first-release allowlist,MEET_ROOM_VOICE_WORKSPACE_IDS, narrows it further. Flag flips need the release authority’s acknowledgement.
Cost bounds
Renewal guard for BYOK rows. Live billing renews when
remaining_reserved_credits <= 300 or after eight minutes
(packages/meet-core/src/cloudflare/live/billing.ts). A BYOK row reserves 0
credits, so the credit condition is always true and would renew on every
20-second tick. The implementation must renew a BYOK row only on the
eight-minute timer or when its estimated-cost hold is used up, never on the
credit condition. A test runs a BYOK session through several ticks and asserts
exactly one renewal per eight minutes, and one renewal when the hold cap is
reached.
Credits reuse the Live ledger: private.begin_meeting_ai_live_session with a
new kind = 'room_voice' on private.ai_live_sessions, nine-minute holds
renewed after eight minutes, private.settle_ai_live_session with
sequence-checked updates, prices from private.ai_live_model_prices (new rows
for the OpenAI models). The payer is the meeting workspace, or the Tuturuuu root
workspace for staff acceptors, as for room Mira chat. Missing usage stays
incomplete, never zero. With a workspace BYOK key, provider cost draws no
credits and the BYOK platform fee ($1 per 1,000 requests, one per model
response turn) applies instead. begin_meeting_ai_live_session gains an
explicit BYOK path for this: it reserves 0 credits (the credit path refuses a
workspace with 0 credits), checks the estimated-cost caps above, and returns
the run-scoped proof that the keys Worker needs; each renewal rotates it (see
proof of use).
Cloudflare cost drivers per session (estimates; re-verify against
Durable Objects pricing
and Realtime pricing before rollout): the open outbound provider socket keeps
the Durable Object in memory and billed for duration; inbound adapter messages
count as requests at 20:1; each egress source is uncompressed 48 kHz stereo
PCM, about 0.69 GB per source-hour of Realtime egress. These make addressed
mode and a low source cap the cost default.
Durable stop fence
The fence follows the Cloudflare billable-operations rule: bounded work and retries, idempotent progress, terminal-state scheduling and a tested stop.- State. One storage key
voice:sessionholds{ id, state: starting | active | stopping | ended, fenceEpoch, deadlineAt, stopReason, obligations }. Every input path (frame, floor, reconnect, renewal, tool of any kind) proceeds only whenstate === 'active'and its capturedfenceEpochis current. - Idempotent stop.
stop(reason)returns at once whenstoppingorended; otherwise, in one storage transaction and before any I/O, it persistsstopping, the reason andfenceEpoch + 1, and sets the alarm for the first obligation retry. If the object crashes right after, the alarm findsstoppingand finishes the stop. It then then closes the provider without sending further input (the existing provider drain), closes every adapter, settles billing, sendsvoice.stopto the room and persistsended. Repeating it is harmless. - Alarm-based terminal state. Durable Object alarms are at-least-once,
one per object, and retried up to six times when the handler throws, so the
handler catches errors and sets one alarm at the earliest pending time
(next tick,
deadlineAt, or an obligation retry). A tick pastdeadlineAtstops withmax_duration. - Bounded compensation. Each obligation (billing settlement, adapter close,
room release) records reserved attempts (at most 6, exponential backoff) and
a job deadline of 24 hours before its downstream call. At exhaustion it is
marked
exhaustedfor operator review and nothing is rescheduled. Unknown usage is never settled as zero to end retries. - Room-side lease. The room keeps
{ voiceSessionId, fenceEpoch, expiresAt };voice.heartbeatrenews it every 20 seconds. A lapsed lease (60 seconds), an ended room or an ended acceptance refuses the next heartbeat, and the Durable Object stops. - Kill switch.
MEET_ROOM_VOICE_ENABLEDset to anything buttrue, or a row in a new service-onlyprivate.meet_room_voice_controlstable (global or per workspace), stops every session on its next tick, within 20 seconds and without a release. Excluding a workspace throughMEET_AI_DISABLED_WORKSPACE_IDShas the same effect. - Gate rechecks run like Private Live: on every tick, provider reconnect or
GoAwayresumption, floor grant and billing renewal. They cover the flag,MEET_AI_DISABLED, the full workspace gate, the owner attestation, a current acceptance that includesvoice, the payer and the daily cap. On a BYOK session they also check the key’s status through the keys Worker’s metadata-onlykeyStatus(wsId, keyId)(no decryption):revoked,invalidormissingstops the session (key_unusable), so a revoked key stops within 20 seconds. A closed gate stops withworkspace_not_enabledand passes the gate to the provider drain. - Clock integrity. Invalid or future timestamps fail closed, as in the registry lease rules.
Abuse and safety
- Prompt injection by voice or chat. Room voice has no tools, search or memory; instructions are fixed on the server. The worst case is spoken content, which the host can stop at once.
- Harmful output. Provider safety settings stay on; the host stops voice for everyone and each person can mute Mira locally.
- Impersonation. Only preset provider voices, no voice cloning; the tile, label and spoken disclosure say Mira is an AI.
- Wallet abuse. Floor turns are rate-limited per account (one start every 10 seconds, 60 seconds each); caps above bound the rest.
- Minors. The 18+ rules above; a report ends the acceptance.
- Retention. Audio is never stored. Mira’s output transcription is shown live on the Mira tile only and is not saved.
Failure modes
UX sketch
Dialogs use the shared UI dialog components; colors use dynamic tokens.
Rollout
- This design, then an independent security and privacy review.
- Room reducer
voice.*commands, thevoicecapability and the stop fence, with the flag off; the ledgerkindandprivate.meet_room_voice_controlsship in migration<VERSION-FROM-IRIS>, stamped right before push; after the 5 December EduFest freeze. - Gemini adapter,
addressedmode, staff workspaces throughMEET_ROOM_VOICE_WORKSPACE_IDS; staging acceptance on the hosted SFU. - OpenAI adapter; the Claude text agent;
listeningmode behind its own flag. - Paid workspaces after measured cost and stop-fence evidence.
Test plan
- Room reducer (
packages/realtime):voice.reserveneeds a current acceptance withvoiceand a requester who is on; withdrawal emits a new source set; heartbeat lapse, room end and minor report refuse the session. - Mixer: a frame from a withdrawn or unknown source is never mixed; a token with a stale choice revision or epoch is refused; resampling and limiting keep levels bounded.
- Stop fence: duplicate alarms, restart in every state, stop racing start, stop during provider connect, successful adapter close followed by a failed progress write, kill switch during reconnect, exhausted obligations. Count downstream calls and written keys.
- Billing: per-minute and daily caps under concurrent sessions, renewal refusal, incomplete usage, BYOK fee path.
- Runtime: the real local Worker and Durable Object with Wrangler for the fence and storage; the hosted SFU adapter only in staging, with synthetic voices on two devices.
Security review
Open risks: Gemini 3.8 Live pricing for room voice is unverified; Realtime SFU
egress pricing for PCM needs a measured probe; the WebSocket adapter’s
acceptance of a Worker route as its endpoint is unverified until staging.