GOOGLE_GENERATIVE_AI_API_KEY must remain server-side. The model is selected by
/api/v1/live/token and passed to the client. Google documents the protocol in the
Live API guide.
Voice input providers
Deepgram was removed on 21 November 2026. The legacy Web and Workspace chat composers offer typed messages. For voice, use Mira Live on Web or mobile, which uses Gemini for audio and transcripts. Meet transcription and mobile Notes voice analysis use their own Gemini transcription flows. The repository regression test checks for Deepgram SDK imports, dependencies, hosts and environment keys.Native local text models
See Assistant local models for mobile installation, compatibility, preparation recovery, and the separate inference gate.Experience
On mobile, Live keeps mic, camera, keyboard and exit in four fixed slots in the shell’s floating navbar. The shared navbar keeps its material as Chat navigation hands off to Live controls. Idle mic starts; setup and reconnect keep visible media controls with truthful disabled states and Cancel. Active capture remains stoppable. Each start gets one microphone attempt; late permission, token or connection results cannot unmute or replace a newer attempt. Camera needs a connection. Keyboard returns to Chat and disconnects by default, with opt-in browsing retention; Exit cancels startup, hangs up or returns to Chat after ending. One scrollable blob, status and transcript stage stays mounted through reconnect and ending. Speaking uses admitted assistant audio and spectrum; reduced motion keeps it static. Recovery detail and retry remain inline.assistant_live_dock_lifecycle_test.dart, assistant_live_state_presentation_test.dart and assistant_live_microphone_restart_test.dart cover these rules.

assistant_conversation_shell_test.dart covers dock and keyboard geometry,
direct links, retry, draft retention, and archive handling.
Live capture requests PCM16 mono, gain control, echo cancellation and noise suppression.
Android uses the communication source/mode and speaker route; the pinned iOS recorder enables native voice processing, and playback preserves its category/options.
Disconnect stops owned capture and releases playback without immediately initializing it again; this does not claim global iOS audio-session deactivation.
Permission-only cancellation avoids native capture queries serialized behind an unanswered OS dialog. Generation fences discard late grants and obsolete setup/frame work.
A pending native capture start still retains cleanup ownership. Old results cannot connect or clear a replacement attempt; microphone restart remains explicit.
Device verification still covers speaker, headset and Bluetooth routes and echo reduction.
Regression coverage includes assistant_live_dock_lifecycle_test.dart, assistant_live_calling_view_test.dart, assistant_live_recorder_test.dart,
assistant_live_recorder_lifecycle_test.dart, assistant_live_disconnect_audio_test.dart and assistant_live_microphone_restart_test.dart.
The Chat composer replaces the text field with recording controls during
voice capture. Cancel discards the recording and restores the text draft.
An untouched actor/workspace scope with no envelope, legacy selection/context,
creation marker or in-process hold receives one serialized, acknowledged fresh
envelope. Its first Send creates the chat without a reset dialog and retains the
draft until the user-message acknowledgement. Legacy selection or context alone
also receives a clear envelope that keeps them. An unresolved legacy creation
marker, a vanished inspected envelope, pending creation and a recorded unconfirmed
attempt still require informed recovery; a stored hold that records no attempt is
released when the workspace loads. If a
text-only send has no selected conversation and local creation authority needs
recovery, Send opens the existing informed New Chat confirmation. Cancel
retains the draft without creating or sending anything. Confirmation resets the
held selection, retains the unchanged draft, and sends it once; only a persisted
user-message acknowledgement clears it. Unknown writes still require informed
recovery and are never silently replayed. Remote-model preference hydration does
not show a temporary local-model status in the navbar; a resolved local choice or
preparation failure still shows its status. These mobile-only rules are covered
by assistant_send_recovery_test.dart and assistant_fresh_scope_test.dart.

search_tools, select_tools, no_action_needed)
never count as steps, so a turn with only those renders no accordion; while such a
turn is still streaming without reply text, a subtle working row appears instead.
Expanded steps show a friendly label and short summary; the raw input and output
JSON stays behind a per-step Details control. Unmapped tools fall back to a
humanized name. No additional hidden reasoning is requested or inferred. These
rules apply to mobile Mira’s timeline; other clients retain their own
presentation. Accordion regressions are in assistant_activity_accordion_test.dart
and assistant_tool_accordion_test.dart. The transcript’s scroll-to-bottom
action clears the dock using the shell viewport’s inherited clearance; the outer
shell consumes the keyboard inset once. Regressions cover controller and capture
transitions, retained dock identity, transparent tool inspection, and actual shell
geometry in apps/mobile/test/features/assistant/widgets/.
Mobile message actions and appearance
Long-press a message for Copy. Saved messages in native Assistant conversations also offer Reply and reactions. The reply preview stays inside the existing floating composer and can be cancelled before sending. Native replies retain the original target through retries; reactions reuseprivate.chat_message_reactions
and the authenticated Chat API, so native web Chat and mobile see the same data.
The server derives the actor from authentication and validates conversation access;
one actor can remove only their own reaction. Optimistic rows, Live drafts and
local-only model messages cannot receive persisted reactions or reply references.
Legacy ai-chat-* and legacy-ai-* conversations keep Copy, but cannot use private
Chat message IDs. Legacy dashboard Mira reaction/reply parity requires its own
adapter work; IDs must never be stripped or guessed to enable it.
Retained Live text cannot carry replies. A selected reply blocks sending and keeps its draft and
target; end the call or cancel the reply first. The reply reference is never silently discarded.
Changing or cancelling a reply during timezone resolution keeps the unsent draft and current target available for review, with a notice in the same composer scope.
An admitted native turn consumes its acknowledgement even if a later draft selects another reply.


apps/mobile/test/features/assistant/theme/.
Native mobile reaction operations
Mobile persists reactions only for acknowledged messages in native Assistant conversations. It uses the actor-scoped private Chat model and PUT on the conversation reactions endpoint with a stableopId, emoji and desired
present value. The reaction and operation receipt commit atomically; repeating
an operation acknowledges it without applying it again, including after a newer
operation. Existing web Chat POST callers retain toggle behavior. Old servers
without PUT reject the new request before any reaction write; mobile never falls
back to a toggle. Apply the operation migration before enabling this client.
Before dispatch, an independent Hive journal must acknowledge and flush the
intent. Failed storage adds no uncertainty. Scope retirement before dispatch
removes the matching unsent marker. A valid terminal receipt cleans its exact
operation even after navigation or a client timeout; it cannot erase a successor.
Unknown outcomes retain the original operation. Refresh reactions retries
that same idempotent intent and reads the exact message, so older messages do not
depend on the latest history page. Reads alone never prove a mutation terminal.
Sign-out retires dispatch admission synchronously, including auth-event logout,
and removes actor/message/workspace/emoji journal metadata. Only hashed actor
keys and unresolved operation IDs remain as a minimal retirement fence. Before
that actor can submit another reaction, bounded authenticated retirement batches
mark those IDs terminal on the server; delayed original requests cannot restore
an old reaction after a later choice. Failed retirement retains the fence for an
explicit retry. No reaction operation enters the offline queue.
Coverage: chat-reaction-operations.sql, the reactions/retire route tests,
assistant_reaction_lifecycle_review_test.dart,
api_client_operation_review_test.dart, and the journal/flush regression suites.
Age-based cleanup is disabled. The retention proposal
requires server-enforced expiry before bounded Cloudflare cleanup can remove operation or retirement records.
Web dashboard Live
On the web dashboard, start or stop Live with the waveform icon in the chat composer. Live keeps the same message timeline visible, with a compact gradient visualization and media controls above it. Spoken turns, typed prompts, tool calls, and search sources appear in that timeline and share the workspace artifacts. Close Live or press Escape to stop media capture and continue typing. Finalized Live turns are saved to the same chat through the owner-checked/api/ai/chat/live-messages endpoint. The server assigns new live chats an ID
scoped to the signed-in user. Message IDs are scoped to the conversation so
retries update the same turns. Ordered parts keep text and tools interleaved
after refresh. The legacy workspace usage card excludes temporary native chat
shadow records. Complete transcript
text lives in canonical parts metadata; the separate search/fallback content field
is capped at 10,000 Unicode characters to satisfy its database limits of
10,000 characters and 40,000 bytes. Pending saves finish
before a subsequent typed request. Failed saves show a retry action; keep the page
open until they succeed. In-progress speech remains provisional until the turn
finishes or the session closes. Audio and video are not stored as chat attachments.
Live starts with up to 64,000 characters of conversation context: bounded earlier
excerpts preserve original roles alongside recent turns and compact tool results.
This is deterministic compaction, not a generated summary. This bound does not remove older saved messages. Temporary session notes
remain separate from workspace documents.
Chat and Live share a persistent composer panel in the page layout. Switching
modes swaps the toolset and preserves the text draft. Chat shows its model and
credit controls without a redundant mode label. Screen/camera sharing uses a
compact thumbnail that expands on demand; the composer does not cover messages.
Transitions respect reduced-motion preferences.
The assistant opens tasks, calendar, finance, and meetings next to the conversation
through tool calls. The chat toolbar has no product, sidebar, or layout controls. One artifact splits the available space in half; multiple
artifacts automatically use a four-cell grid with chat in one cell. Side-by-side,
stacked, and grid controls override the arrangement. Narrow containers stack
panels so sidebar width is included in the responsive decision. Up to three
artifacts remain open; opening a fourth replaces the oldest. Artifacts are scoped
to the workspace selected when opened and can be refreshed or closed individually.
Task previews use the Tasks app’s personal feed, showing 12 rows at a time with
Show more. Calendar previews cover the next seven days, and wallet balances retain
their own currencies. APIs remain the
permission boundary and panels expose loading, empty, and retry states.
The assistant can call show_workspace_artifact, set_sidebar (expanded,
collapsed, hover, minimal), and set_theme (light, dark, system) in chat and Live.
Chat applies UI commands when the streamed tool output arrives, independently of
whether the result card is visible. Restoring history does not replay old UI
commands. Sidebar changes use the existing preference provider and respect its
local/account synchronization settings. Ask the assistant to restore navigation
when it is hidden.
Meeting panels provide a creation form to eligible @tuturuuu.com accounts using
createWorkspaceMeeting. The existing meeting API authenticates the account,
checks workspace membership, and enforces the domain policy. Opening the panel is
not meeting creation; success is shown only after the creation request succeeds.
No meeting API or database policy changes are part of this interface update.
Live mode displays both speakers’ streamed transcripts, task visualizations,
Google Search sources, tool activity, and temporary session notes. Typed prompts
and voice share one session. Camera and screen sharing require an explicit media
control action; a preview indicates what is shared. Microphone mute sends
audioStreamEnd, and interruption stops queued assistant playback.
Workspace artifacts remain beside the shared conversation. Tool results and Google
Search sources stay in the message timeline. Temporary notes are not workspace
documents. The existing five-minute credit authorization limit remains in force;
expiration ends media capture and keeps the saved conversation available.
Mobile audio capture
On mobile, open Live from the Assistant header’s More menu. Chat and Live share the page background. Live keeps the floating bottom navigation visible. Its idle start action is the icon-only Call Mira button beside that navigation; the top header opens Live settings in a sheet with the Keep Live while browsing switch. The idle screen does not show an availability badge or a second start button. During a session, connected call controls replace navigation inside the same dock and provide camera, microphone, typing, and end actions. A connecting call retains navigation and offers cancel. Connection problems show retry without changing the page background. Starting mobile Live with the microphone enabled requests permission and captures speech while the connection initializes. A memory-only FIFO holds at most 30 seconds of 16 kHz mono PCM. Once ready, chunks drain in order; cancelling capture or leaving the session discards unsent audio. Connection errors do not persist this buffer to disk. The normal mobile chat microphone replaces the text field with a real microphone waveform inside the page composer. It opens no recording sheet. Pause reveals restart, attach, send, and resume; the two-minute limit pauses capture rather than discarding it. Restart erases only the current unsent local recording. Attach keeps the text draft and uploads through the existing attachment flow; send explicitly attaches and submits it. Backgrounding pauses capture. Leaving the Assistant, switching actors or workspaces, and disposal cancel the unsent recording. Async completion cannot attach or send into a different scope. Mobile assistant Markdown renders directly against the app background. Text, reasoning, and separate tool activity follow canonical persisted part order after history restoration. User messages keep their own bubble. Chat and Live both expose the shared quick-settings action. Regression coverage lives in the voice capture, composer dock, and transcript bubble tests underapps/mobile/test/features/assistant/.
Flash and Pro
Local QA dashboard Flash triesgemini-4-live first and falls back to
gemini-3.8-live on a verified provider or admission refusal. Production
dashboard Flash uses Gemini 3.8 Live. Enable the QA path with
GOOGLE_LIVE_MODEL=gemini-4-live and the loopback relay under
apps/web/cloudflare/live-qa. Use WEB_LIVE_QA_RELAY_URL for the relay
origin and one private WEB_LIVE_QA_RELAY_KEY in both local processes. The
relay config listens on port 8799. From the relay directory, start it with
bun x --no-install vp dev and provide its key through the local secret file.
Use a local Wave 1-compatible test database,
an eligible QA account and the exact model prices needed by the admission RPC.
The relay opens the Google session before issuing a browser ticket. A signed,
token-bound model refusal lets the Web server close that attempt’s unused
billing session and open one Gemini 3.8 Live replacement under the same mint
lease. The browser gets the model and billing session that reached setup.
Model refusals at mint or setup cache by credential and model. Eligibility and
pricing refusals cache by access workspace, billing workspace and model. Each
cache expires after ten minutes. The QA relay tickets are single-use and start
sessions without resumption. The native and workspace clients use the existing
direct transport. Live Translate has a separate audio translation contract.
Native Flash uses gemini-3.8-live. Pro uses
gemini-3.8-live-extended-thinking with high background reasoning. Existing
saved Fast/Thinking preferences remain compatible. Live starts with that
preference and offers its own Flash/Pro control. Switching restarts authorization
and media capture, preserves the shared conversation, and uses a separate
resumption scope for each model.
Both models declare tools as NON_BLOCKING. Each incoming tool batch runs up to
four calls concurrently, so pending approval does not hold up independent reads.
Speech interruptions stop audio without falsely cancelling background tools;
provider cancellation IDs or disconnects end those calls. Gemini 3.8 Flash omits
thinkingConfig. Gemini 4 Live starts with minimal thinking.
Pro never uses MINIMAL or function-response scheduling. Pro’s turnComplete
ends an utterance, while interactionStatus: IDLE finalizes the interaction.
The UI shows background work until that signal, allowing further speech and tools.
Both modes compress context at 100,000 tokens toward a 64,000-token window,
using more of the new models’ 131,072-token input capacity.
Proactive audio stays enabled by the provider. Camera and screen frames remain
opt-in, and mutation approval/cancellation checks still apply.
Before deploying this upgrade, apply
20260916100000_mira_live_38_models.sql through the database release process.
It registers model pricing and extends existing Live model allowlists. Without
these rows new sessions fail closed; they do not silently bill another model.
Production migration application is user-operated. Existing sessions keep their
original pricing snapshot. The installed @google/genai 2.22 SDK already supports
interaction status and asynchronous tool declarations.
Google’s migration guide
and Thinking guide
define the session contract. Rates come from the
pricing table.
First-party tools
Calendar reads require an explicit ISO date range of at most 31 days and return
at most 50 events to Gemini. Event creation validates timestamps and text lengths.
Model arguments cannot select a different workspace or calendar provider. Existing
calendar APIs enforce authentication and workspace permissions. Calendar tools
themselves require no additional schema changes.
The dashboard token has its own expanded tool declarations and instructions.
Legacy assistant voice clients retain their original tool catalog.
Task mutations and calendar creation wait for approval of an on-screen argument
preview. This is a user-interaction gate; server-side authorization remains the
security boundary. Calls are deduplicated by provider ID, cancellation includes
queued calls, and late cancelled results are not sent back or displayed. Stopping
a request cannot roll back a mutation already accepted by the server. Failed
mutations are not retried automatically; verify their result before retrying.
Recovery and billing
The client forwardssessionResumption.handle even with ephemeral authorization,
without supplying replacements for server-constrained tools or instructions.
GoAway schedules reconnection, and unexpected closure attempts recovery at most
three times. Explicit disconnect and unmount invalidate pending connections and
retries. Manual restart obtains fresh authorization. Paid dashboard sessions retain recovery handles in memory for the current billing
reservation only, so a fresh authorization cannot replay cumulative usage from a
previous reservation. Legacy unmetered consumers retain workspace/conversation
scoping through the existing session API.
Mobile Live reconnects a dropped call automatically with backoff: 0.8 s, doubling
to at most 15 s. Each attempt fetches a fresh token, so a streak of drops is capped
at five automatic attempts; Live then shows a retryable error. A connection that
stayed ready for at least 60 seconds (for example, before a routine provider
GoAway) starts a fresh budget, and so does any start or Retry the user makes.
Regression coverage: assistant_live_reconnect_backoff_test.dart.
Paid-only Live and eligibility
Scope: Mira Live voice on Web (/api/v1/live/token) and mobile
(/api/v1/assistant/live/token). Default: Live is for paid plans only.
Web Live eligibility and token mint use the selected workspace as the access
context when a Personal dashboard request explicitly selects workspace credits.
Both verify full membership there before checking or reserving credits. When
a request names a concrete access workspace, its workspace credit selection
must match it. Personal credits continue to bill the actor’s Personal workspace.
The Web Live eligibility and token route tests cover each case.
-
One server decision,
resolveLiveEligibility(apps/web/src/lib/live/eligibility.ts), decides for the billed workspace, never the workspace on screen. Mobile always bills the actor’s personal workspace; Web bills the dashboard credit source. A workspace on Plus, Pro or Enterprise (anactivesubscription whose product tier is paid, the same rule as_resolve_workspace_tier) or with an unexpired paid credit pack may start Live. The free tier is refused whileLIVE_MINT_KILL_SWITCHis on, which is its default. Live also needs at least 500 credits, thebegin_ai_live_sessionminimum. -
Pre-check:
GET /api/v1/live/eligibility(Web) andPOST /api/v1/assistant/live/eligibility(mobile) run the same decision without reserving a mint, credits or provider token. Responses areno-storebecause they name the billed workspace; clients cache them in memory only, keyed by actor and workspace. The token routes re-decide on every start. -
Fail closed: the tier is read strictly (an
activesubscription’s product tier, else FREE) and credits from read-only balance and credit-pack rows. A failed tier or credit read refuses withpaused(“temporarily unavailable”) instead of assuming FREE or admitting; so does an active subscription with no product. Credits mirrorbegin_ai_live_sessionexactly: the balance row comes from the sameget_or_create_credit_balance(billed workspace, actor)call, packs count only on a paid plan and only when active, unexpired and positive, and Live is admitted whenleast(2000, floor(included + packs))is at least 500. A passed pre-check therefore cannot be refused for credits at mint. The mobile access-workspace tier is read the same strict way. -
Paid plans only: a credit pack never makes a FREE workspace eligible. A
FREE workspace with packs is refused with
plan_required(“Live is included with paid plans”); packs only extend a paid plan’s budget, in the pre-check and inprivate.reserve_live_ai_creditsalike. -
The web pre-check cache is keyed by the server-verified session actor and
sign-in revision. A different actor or a new sign-in by the same actor (a
new
last_sign_in_at) drops it and discards in-flight results; a token refresh keeps it. -
Purchased credit packs help Live on paid plans:
private.reserve_live_ai_creditsholds the reservation from the included balance first, then from active packs (earliest expiry first), recording each pack draw and the pack grant (granted_at) it came from inprivate.ai_credit_reservation_pack_draws. Start, settlement and the expiry sweep lock in one order: the balance row, then packs in a single batch sorted by id, then the reservation, then the Live session. Settlement locates its balance with unlocked reads and rechecks every row under lock. The sweep skips reservations another transaction holds. Concurrent work on one workspace therefore serializes without deadlock, and a pack never goes negative (tokens_remaining >= 0). Settlement and reservation expiry return unused credits in reverse order: packs, last drawn first, then the included balance of the period row the hold came from. A pack refund goes back only to the same grant while it is retained; after a renewal or a cancellation the refund is forfeited, so an old hold never credits a new grant. Closing an already closed session returnsRESERVATION_NOT_ACTIVEand refunds nothing. The sweep never waits on a Studio run or API key another transaction holds; it leaves those for a later sweep. Other reservations draw no packs and are unchanged. -
Polar credit-pack webhooks project through
private.sync_credit_pack_purchase, one locked, relative update ordered by the subscription period: an event from a period before the stored grant is ignored, the same grant keeps its current balance (clamped to the grant), a renewal starts a new grant, and a non-retained status zeroes it. A zeroed grant stays closed for the rest of its period: a delayed or replayed retained event from the same period never reopens it, so no hold refund can land on it. It never writes back atokens_remainingsnapshot, so a hold taken while an event is in flight is not restored, and a delayed revocation from a previous period never touches a renewed grant. -
Only that projection sets a pack’s status. Depleting or expiring a pack is
not a revocation: embedding reservations and metered deductions leave the
status alone. Embedding holds record the grant each pack draw came from and
refund through the same
private.refund_credit_pack_holdrule as Live (same retained grant, else forfeit, never reactivate); holds taken before grant tracking refund only when the current grant predates the hold. Every pack writer locks the balance row, then packs in one id-sorted batch, then the hold; embedding release and commit locate the hold without locking it and take the balance first, so they never hold a reservation while waiting on a balance the sweep holds. The refund helpers are internal and not executable byservice_role. Coverage:mira-live-credit-pack-reservation.sqlandmira-live-credit-pack-concurrency.sql. -
The staff-only
/api/v1/mira/tokenroute is retired: after its auth, membership and staff gates it answers 410LIVE_ROUTE_RETIREDand never mints. -
Wire shape:
Reasons are
plan_required(403),credits_exhausted(402),limit_reached(429, from the mint cap, withresetAtfrom Retry-After),role_not_allowed(403) andpaused(503, the paid stop). Clients map reasons to copy; server text is never shown. There is no region or device reason. -
Clients: the Live entry is locked with a short reason before Start, and a
blocked sheet explains the reason with one primary action and “Not now”,
plus
Billed to: <workspace>. Limit, role and pause refusals never upsell. The iOS and Mac App Store v1 builds ship without in-app purchases. Their Live entry, refusal sheet and credit errors report access without upgrade, top-up, pricing or external billing prompts. The refusal sheet shows Got it. Signing in uses the existing eligibility decision for the personal workspace. Android retains its existing billing action. A failed pre-check leaves Start open and the token route decides.
eligibility.test.ts (Pro personal fixture, plans,
paid credit packs, credits floor, paid stop, wire shape),
assistant/live/token/route.test.ts (production defaults mint for Pro and
refuse Free with plan_required, limit reset), assistant/live/eligibility/route.test.ts,
mobile assistant_live_eligibility_test.dart, assistant_live_blocked_sheet_test.dart
(one test per reason, English and Vietnamese, light and dark renders),
assistant_live_apple_copy_test.dart (iOS and macOS, English and Vietnamese), and
assistant_live_locked_entry_test.dart.
Live voice admission cap
Every Live token mint (Web/api/v1/live/token and mobile
/api/v1/assistant/live/token) passes one admission check before any provider
token is issued. Scope and defaults:
- FREE Live shares a global budget of USD 50 per ICT day, first come, first served. Each mint reserves its full 180 s lease at the configured rate (USD 0.0368/min). There is no early refund, and FREE leases end at ICT midnight. Exhaustion pauses FREE Live until 00:00 ICT. Budget alerts go out once per threshold per day at 80% and 100%.
- Every tier keeps a per-actor cap of 10 mints per rolling 24 h and one concurrent lease. Paid tiers skip the FREE budget only. If Web fails before returning a token, it releases the matching concurrency slot without refunding the actor’s daily mint or FREE budget. Issued tokens hold their slot until expiry plus grace, including after a client disconnect.
LIVE_MINT_KILL_SWITCHis on unless explicitlyfalse. It refuses free-tier mints before any store call; paid mints are unaffected. Rollback is setting it back totrue.LIVE_PAID_KILL_SWITCHis off unless explicitlytrue. It is the emergency stop for paid mints and answers 503 before any store call.- The store is the
livefamily of thetuturuuu-abuse-guardWorker: one SQLite Durable Object partition holds the budget and every actor row, so a mint is checked and charged atomically. Web reaches it over signed HTTPS (ABUSE_GUARD_URL,ABUSE_GUARD_SECRET,ABUSE_GUARD_KEY_PEPPER,ABUSE_GUARD_FAMILIESincludinglive). Actor ids leave Web only as peppered HMAC digests, and the mint id is the idempotent operation id. - Fail closed: an unreachable, stopped or exhausted guard, or an invalid
decision, returns 503
LIVE_MINT_STORE_UNAVAILABLEorLIVE_MINT_STORE_INVALIDfor every tier. A guard outage is therefore a paid Live outage too. An assigned family never falls back to Upstash. Upstash is only the legacy path whileliveis unassigned. - Cost fence: each mint makes one Worker request. A failed mint with an
acknowledged reservation makes at most one additional release request.
Each request uses at most two Durable Object calls and the same operation
budget and stop fence. The
livefamily gets 5% of the guard’s daily operation budget (warning logged at 80%), and the operator stop fence halts it durably.
apps/web/src/lib/live/mint-cap*.test.ts (configuration,
store selection, fail-closed, legacy Lua on a disposable Redis) and
apps/abuse-guard/src/live-mint*.test.ts (atomic budget, day rollover,
concurrency, bounded storage, replay, auth rejection, op budget and operator
stop in workerd).
Credit reservation and cumulative usage settlement run on the Next.js backend
(apps/web), the only active runtime for these routes. The paused Rust backend
and TanStack app are not current runtimes; their retained route tracking is
historical, not deployment evidence.
Verification
Fromapps/web, run focused Vitest tests under the dashboard assistant directory,
src/__tests__/assistant-live-token-routes.test.ts, and
src/__tests__/live/token-builder.test.ts. Run internal API live-tool tests from
packages/internal-api, followed by bun validate at the root and bun run build
in apps/web.
Authenticated runtime acceptance requires a configured Gemini key, available AI
credits, and microphone permissions. Verify spoken input/output, interruption,
mute, camera/screen stop, task and calendar permission failures, approval/decline,
provider cancellation, reconnect, expiration, Flash/Pro switching, Pro background
status after an utterance, and export at desktop and mobile
sizes. Component or mocked protocol checks do not prove provider audio quality,
credit settlement, or authenticated production delivery.
Artifact panels replace the dashboard’s former server-loaded task and calendar insight slots. Full-view links preserve the active language; meeting links open the Meet app. Meeting creation checks the authenticated account’s verified email and provides a retry if account lookup fails. The live panel follows measured header and composer sizes as attachments, text, and narrow layouts change.
Platform forwards /api/v1/workspaces/:wsId/calendar/events and its event-detail path to the Calendar app. Calendar remains responsible for membership, manage_calendar, and event encryption. Keep these forwarding rules when changing dashboard artifacts or Live calendar tools; a missing rule returns a Platform HTML 404 before Calendar authorization runs. The empty chat reserves space for the composer, allowing welcome actions to scroll independently in compact panels.
Compact product panels
The Tasks artifact uses the same personal task feed as the Tasks app. A Personal context includes tasks across workspaces and applies personal overrides; a team context stays scoped to that workspace. Compact cards reuse Tasks label colors, priority icons, estimation mappings, and assignee avatars. Due-date filters and board links keep the task feed actionable. Search filters the loaded panel, and Show more reveals additional tasks without discarding the rest of the feed. Calendar shows a seven-day strip and an agenda, including events spanning multiple days. Finance keeps currencies separate and compares absolute wallet balances, marking negative values; totals reflect the displayed wallets. Meetings separates upcoming and past entries from the latest 30 records and keeps creation in an expandable form for eligible accounts. Each panel retains refresh, error recovery, and full-app navigation.Assistant-managed workspace
Useshow_workspace_artifact to open or update a panel. Its optional presentation carries a concise title plus search, taskStatus, currency, date, or itemIds filters. Scope captions and assistant explanation blocks are omitted so product cards have the space. Legacy descriptions and highlights remain accepted for compatibility but are not rendered. Calendar dates start a seven-day local range. Keep explanations in chat, grounded in tool data, and only use IDs already returned by data tools. Artifacts fetch their own authorized data; presentation text never grants access or changes source records.
Use manage_workspace with close_artifact, focus_artifact, close_all, or set_layout to manage screen space as the task changes. Opening a new panel automatically collapses expanded navigation; collapsed, hover, and minimal modes are preserved. Updating an existing panel leaves navigation alone. Opening or updating a panel without a layout preserves the current arrangement. Focusing retains that panel’s presentation and closes the others; closing all restores full-width chat. The user can still search, filter, refresh, open the full product, and close each artifact directly. Distinct theme-aware product accents distinguish task urgency, calendar days, wallet balances, and meetings.
For artifact orchestration, a successful UI command is complete: issue only the remaining requested actions and then answer. Replacing one panel uses close_artifact and show_workspace_artifact; focus_artifact deliberately closes the others. Opening a panel does not return its data to the model. Use a title-only presentation until a relevant data-read tool supplies facts; the panel itself displays authoritative counts and balances.
Chat capability discovery and reliable actions
Chat starts with a small discovery set.search_tools returns at most eight authorized matches plus focused domain guidance and activates them for the next step. select_tools supports a working set of at most twelve known operations. Add tool definitions, directory metadata, permission mapping, and an executor together; discovery indexes the directory automatically. This is progressive tool loading, not arbitrary code execution or automatic access to external MCP servers.
Workspace verification fails closed before context reads. Mutation permissions are resolved for the selected workspace, and operations retain that authorized workspace if another concurrent call changes context. The per-turn runtime ends repeated identical read/discovery/UI cycles and repeated failures. Gemini native search reports server:GOOGLE_SEARCH_WEB; recognize it alongside google_search before forcing another search, and do not retry a wrapper that already returned grounded sources. Identical task creations share their first result within a turn, including concurrent calls. This is not cross-request idempotency. Task creation saves creator, start/due dates, and estimates, then reads the saved task location. Assignment or readback failures return an incomplete result with the created ID; recover that task rather than inserting another. get_task and paginated search_tasks locate saved tasks in the current workspace. Existing label, project, assignee, and task mutation tools remain available.
Chat Calendar automation and event writes forward the authenticated request through the existing Calendar API, including selected Google/Microsoft destinations. It can inspect connection health, provide Google OAuth authorization, sync connected calendars, lock/unlock events, read schedulable tasks, and preview/apply scheduling. Apply requires a successful same-workspace/window preview in the current turn and uses safe apply; the Calendar service recomputes availability and rejects unresolved warnings. Provider authorization and locked commitments remain enforced by Calendar. These new automation tools are not exposed in legacy Live/Meet sessions without the corresponding authenticated execution path.
When debugging a reported false completion, inspect the stored tool result and returned task ID first, then read that ID in its recorded workspace. A chat confirmation or artifact opening alone is not evidence of a product write. Runtime verification of provider sync or scheduling requires an authorized test account; mocked tests only verify dispatch and failure handling.
Native search completion
Mira keepsgoogle_search as an executable function tool. Do not override it
with a provider-native tool in the main mixed tool set: Gemini maps required
tool choice to ANY, which can issue many server-side searches inside one
provider step without answering. The outer step guard cannot interrupt that
provider-step loop.
Explicit search requests require the search executor before proceeding. The
executor uses native Google search through the direct Google provider used by chat, with
automatic tool choice, a 30-second deadline, one provider step, and at most one
grounding retry. It requires grounding evidence and a nonempty final answer.
Other required workspace and task tools keep their required-tool policy.
Verify a real grounded answer and visible sources after orchestration changes;
mocked tool events alone are insufficient.
The search executor must use the configured direct Google connection, like the
chat route. Routing only search through AI Gateway adds a separate credit and
authentication dependency; a gateway 403 does not mean Google search is down.
Conversation chronology and native presentation
On mobile, Assistant chat inherits the shell background, branded top title and single floating navigation dock. Back stays in that dock. The prompt retains its height on focus, grows with its content up to five lines, and Enter inserts a newline; the side primary action sends. The transcript jump action uses measured composer height and shell dock/safe-area clearance, including the resized keyboard viewport. Streaming output follows only while the reader is near the bottom; reading earlier messages preserves the scroll position. User receipts show semibold Delivered only after the existing saved-user acknowledgement replaces an optimistic request ID. Read means a subsequent Assistant response has begun processing that turn, not that a person read it. A newly observed Read transition holds Delivered for 700 milliseconds before showing Read. Timestamps use lightHH:mm; assistant replies and live drafts have
no delivery timestamp. History without acknowledgement provenance and optimistic
or failed sends remain timestamp-only. These presentation rules do not establish
backend persistence; messages whose saved and request IDs match also remain
unlabelled until explicit receipt state is available.
assistant_composer_multiline_test.dart, assistant_composer_geometry_test.dart,
assistant_scroll_overlay_test.dart, and assistant_message_receipt_test.dart
cover editing, dock/keyboard clearance and receipt states. Settings retain the
single branded header labelled Assistant Settings, compact content spacing and a
bottom Back control; assistant_settings_layout_test.dart covers safe areas and
enlarged text. Widget rasters do not replace installed-device acceptance.
Assistant history stores the ordered provider content for every generation step in
metadata.ai.parts. Tool results update their original call slot, including failed
and unfinished calls; they do not move to completion order. The message content
column contains text segments in order, up to its database limit of 10,000 Unicode
characters and 40,000 bytes. Longer completed replies retain their full text in
metadata.ai.parts, with metadata.ai.contentTruncated=true marking the bounded
column as a preview. This applies to Web Mira and native mobile Assistant text
conversations. Native Chat copies retain the same full parts and preview marker.
History loading prefers canonical parts over legacy text/tool arrays, and only
adjacent tool activity is grouped. Follow-ups restore the full assistant text;
model preparation splits long assistant text into bounded parts without raising
the user prompt limit. User message content never comes from this preview marker.
When metadata must be compacted, text spans reference the content column only if
that column contains the complete reply. Overflow text stays inline. Tool payload
previews shrink while later timeline entries remain present; the fallback omits
the detailed context breakdown. The current schema allows 10 MiB of AI message
metadata. Persistence errors still fail the send; an emitted terminal event alone
is not evidence of a saved reply. Old records that already lost text or
interleaving cannot have their original content reconstructed.
Regression evidence: stream-finish-reopen.test.ts enforces the content limits;
assistant-followup-context.test.ts retains full generated context and rejects an
oversized user prompt. native-ai-reopen.test.ts exercises save, history GET,
follow-up, and history GET with the real finish saver and model preparation.
Mobile assistant_history_ai_parts_test.dart covers canonical parts and compact
offsets; assistant_chat_persistence_contract_test.dart covers creation, two sends,
fresh-repository reloads, saved replies, attachment ownership, and request identity.
Native Chat treats an upstream SSE error as inconclusive until the bounded
readback of that request’s saved reply finishes. The readback uses the service
client, scoped to the server-derived shadow chat of the actor’s own persisted user
message, because session clients hold no table SELECT on ai_chat_messages; a
session-client read would report a saved, billed reply as unsaved. A saved reply is copied through
the actor/workspace-authorized idempotent batch; no receipt means the turn still
fails. Leaving the stream does not revoke an accepted save. Mobile reconciles all
rows of the terminal batch from canonical parts, including long split replies.
On entry, a cached Assistant snapshot renders immediately and authorized history
revalidation updates that same selection unless navigation, a settings change, or a new local turn
has superseded it. Live audio keeps its separate turn-save contract.
Regression coverage: native-ai-stream-persistence.test.ts covers upstream errors,
missing saves, disconnects and replay. assistant_chat_saved_batch_test.dart and
assistant_chat_revalidation_test.dart cover batch reconciliation and visible
cache refresh with navigation fences.
These use database/provider fixtures. Authenticated Web and installed Android/iOS
verification with real attachments and a provider remains a release check.
Explicit requests to show tasks, calendar, finance, or meetings activate the native
artifact opener directly. Follow-ups such as “show it in an artifact” use recent
conversation context. Product panels fetch their own data; a task-data read or
Markdown table must never be described as an opened artifact. Workspace resolution
still precedes presentation when a named workspace needs to be selected.
Reading retried tool chains
The collapsed action summary counts unresolved failed attempts, rather than all calls in a chain. A later successful call with the same tool name and normalized input changes the summary to “Completed after retry”. The original failed attempt remains expandable, labeled as recovered. Different inputs and missing inputs do not establish recovery. A logical failure output is not a successful retry; a later verified success can recover either a transport error or a logical failure. This outcome is derived from ordered message parts, so restoring a conversation produces the same summary; assistant prose is never used as proof of success. Presentation destinations such as “in the task panel” are not workspace names. An explicitly requested artifact can still open after repeated discovery calls, subject to the existing three-attempt artifact limit.Composer and session timeline
Mira keeps Live controls in the chat composer. Voice starts with text entry collapsed; opening text entry adds the prompt below the Live controls without hiding them. The shared conversation stays visible at every artifact layout size. Session start/end notices are canonicaldata-live-session parts and are restored alongside text and tool results. They describe session state, not a guarantee that an outstanding save has completed; save failures retain the existing retry notification.
Context bounds are described under Experience; media verification remains covered under Verification.
Shared Chat and Live personalization
Chat and both Live token endpoints usepackages/ai/src/chat/mira-prompt.ts for the same Mira identity, behavior, workspace context and scoped memory prompt. Live loads the authenticated user’s saved name, personality, tone, boundaries and memories on session creation; saved language, accent and speaking-pace preferences are passed to the model as instructions. These are behavioral preferences, not a separate selectable provider voice ID.
apps/web/src/lib/live/mira-prompt.ts adds only spoken-delivery and actual Live tool constraints. Do not restore a static “You are Mira” prompt or duplicate the Chat context loader. Live’s smaller tool catalog does not support Chat’s memory/settings writes: it must not claim to persist changes using session notes. Dashboard personalization is resolved before reserving credits, and a prompt-loading failure prevents an unpersonalized token from being minted. End and restart Live after changing saved preferences; an ongoing connection retains its session instructions.
Mira chat tool discovery
Mira chat uses AI SDKtoolSearch() with deferred tool definitions (AI SDK
7.0.107 or later). The first step exposes only the selected control tools.
Search results make matching capabilities available on the next model step;
searching does not perform the operation or approve a mutation. Explicit tool
selection remains supported for clients that already know the tool names.
The per-generation discovery adapter rechecks workspace permissions before each
step, while the existing executors authorize writes independently. A workspace
change during permission resolution fails closed. Forced artifact/workspace
steps and terminal loop guards retain their restricted tool sets. Definitions
are never mutated in the shared registry. This change applies to streamed Mira
chat; live voice retains its separate tool protocol.
Run the SDK-backed tests in packages/ai/src/tools/mira-sdk-tool-search.test.ts
when changing discovery. They exercise real SDK model steps with a mock provider,
including deferred loading, denied permissions, workspace changes, explicit
selection, and approval-gated writes. These tests do not replace authenticated
provider or meeting-invitation round trips.
Mobile text dock modes
Normal mobile Assistant text chat uses one floating bottom dock. Navigation mode shows the existing section icons with a chat-bubble primary action. Composing replaces that same slot with a single-row plus menu, prompt, microphone/send and hamburger primary action. The hamburger returns to navigation; it does not place navigation above the prompt. The draft and selection survive a toggle. Opening chat focuses the prompt; returning to navigation, opening the menu or microphone, leaving the page, and tapping outside release prompt focus and dismiss the IME. Both modes use the same default 52 logical pixel rail, theme-derived glass and outline; prompt height grows for accessible text. Reduced-motion settings remove mode animation. The anchored plus popover uses one matching glass surface and consistent icon/title rows for attachments, model, credit source and closing the prompt; existing per-attachment previews/removal remain available. Live mode keeps its explicit entry and transport behavior. This rule applies to normal native mobile text chat, not web chat or Live stage controls. Regression coverage is inassistant_morphing_dock_test.dart and
assistant_composer_dock_test.dart; installed-device appearance/keyboard checks
remain part of release verification.
Decision (2026-11-25), under the owner’s mobile-web parity directive: native
mobile text chat offers web’s Fast/Thinking response-mode selector beside the
model control. As on web, every session (account and workspace) starts at Fast
and ignores any stored mode (see the Mira dashboard chat rule in structured
data); an explicit choice applies for the rest of
that session and to its new chats. The selector is absent for on-device models
and for chatgpt/ subscription models, which use their provider’s defaults.
Because the native message endpoint sends with a conversation’s stored settings,
an opened conversation shows and uses its own mode, including when the workspace
finishes loading after the conversation restores or refreshes; another account
in the same workspace never inherits it, and a new chat returns to the session’s
mode. An open conversation acknowledges a change through its AI settings, a new
chat carries the mode in its creation receipt, and a legacy conversation, which
sends the mode with each request, changes it locally without a settings write.
The selector waits while a reply is in flight or messages are queued, so a
change never stops a reply or drops queued messages, and a change still being
saved wins over a workspace refresh that lands meanwhile; the refresh waits up
to three seconds for it, and a change that settles later still applies itself. A
new session starts without the previous workspace’s model, credits, workspace
context or conversation, and a new account also starts without the previous
account’s assistant profile and personal workspace, so nothing shown or sent
while it loads carries them; a new chat waits until the session has loaded its
credits. A typed first message sent during that load stays in the composer. A
voice note or attachment that creates its chat waits up to 20 seconds for the
session and any settings save, then creates it with the model then selected,
unless every waiting attachment was removed or an earlier first send’s outcome
is still unknown, which only New chat resolves, and adds it to Recent chats. An
attachment whose upload stops while its chip stays in the draft, as when the app
is backgrounded or another chat opens during that wait, fails retryably instead
of spinning. Every file picked together shows its chip at once and uploads in
turn, so one whose turn comes after that also stays retryable instead of being
dropped, and a file that cannot be read is reported after the files before it
upload; a
first message sent before it exists, or whose timezone resolves after it
exists, sends with the settings it stores, and a
note sent while a first message creates the chat shows once it exists. Voice
notes in a chat send one at a time, in the order they were sent, with the
settings their chat stores, each after the previous reply settles, any earlier send’s receipt
arrives and any settings change or cloud model switch is saved, never
interrupting a reply and waiting for them, apart from its own upload, at most
two minutes in all; retrying the send whose receipt holds the chat goes first,
and a send started before the chat was last opened, which no Retry can resend
any more, holds nothing back. A note whose send never started, as when its upload is refused, never
holds back a typed message. A note in an
open chat does not wait for the session to load, since the chat stores its
settings, and a note stopped during its upload gives up its turn at once.
A note refused, unready, still blocked, dropped before it sends, or stopped by
opening Assistant settings or switching to an on-device model before its receipt
arrives fails retryably,
keeping a finished upload for Retry, and a draft’s failed note follows the chat
a later send creates. Retry on the chat retries a voice note whose receipt holds
the chat first, then the message sent last, which can be a note shown above a
later message, skipping a note whose send never started, and keeps retrying the
message it last resent until another send starts. It retries a voice note through its own Retry,
which resends its audio. A model, mode or credit change made while an attachment’s chat
is being created with its settings is refused before it starts, since it could
not reach that chat, so the creation stays current. A reply refused for plan,
credits or access restores only that send’s own typed message to an empty
composer, never a voice note or another message (assistant_voice_new_chat_test.dart, assistant_voice_send_order_test.dart,
assistant_voice_retry_test.dart, assistant_attachment_new_chat_test.dart). The model and mode controls wait
until the session’s workspace settings load successfully, so no change is built
from another session’s model or credit
source, and in a workspace with locked credits every new chat uses personal
credits, while an open conversation keeps the credit source it stores, which its
sends must match; a new chat after it returns to the session’s credit choice.
Live keeps its own model choice. Regression coverage:
assistant_shell_recovery_test.dart, assistant_shell_kept_settings_test.dart,
assistant_shell_session_gate_test.dart,
assistant_shell_locked_credits_test.dart,
assistant_session_load_send_test.dart, assistant_legacy_chat_test.dart,
assistant_thinking_mode_switch_test.dart and
assistant_home_render_test.dart.
Model selection defaults to hiding locked or disabled models; users can reveal
them for inspection but cannot select them. Model and attachment sheets use the
dock glass material. Add attachments offers Files, Photos & Videos Library, and
Capture & Record. Camera photo/video capture appears on Android and iOS only;
recorded audio uses the existing microphone permission/recording flow.
Cancelling a system picker adds nothing. Regression coverage includes the native
request payload, model default filter and source availability.
Root mobile destinations and Assistant share 12px horizontal insets, an 8px
bottom gap, and fixed 52px primary-action columns. A second column is reserved
on viewports at least 400px wide, regardless of whether an action is present.
Narrow phones keep secondary dock actions in the top navbar so five root
navigation targets retain at least 44px. Apps and Assistant use the same rail;
chat/navigation toggling changes content without moving the primary action.
The fixed empty action columns apply to the five root destinations (Home, Apps,
Assistant, Notifications, and Profile). Mini-app navigation intentionally keeps
its available width when it has no actions, including six-item docks on narrow
phones. Registered mini-app actions consume space only when present; secondary
actions remain reachable from the top navbar on narrow screens. The six-item
320px no-action regression checks that touch targets stay at least 44px; this
does not claim every possible mini-app/action combination has that width.
Native attachment requests retain the workspace version captured before opening
a picker or recording. They reject a workspace switch, including a switch back,
before decoding, adding a pending attachment, creating a chat, or starting an
upload. An upload already in flight retains its original workspace and does not
update a replacement composer. Voice send-now also checks the original scope.
Delayed file decoding and stale pre-timezone scope are covered by
assistant_chat_restore_test.dart.
Mobile Live calling surface
Mira Live inherits the app background and follows the shared calling behavior. It reflects connection and speaking state without a second control rail, provider-latency claims or on-device model execution. The in-shell Live view has one primary action. When idle it shows the orb and a Start talking button (the orb is also tappable); it does not repeat the assistant name, which the navbar already shows, and has no idle helper copy. During a call it shows one status line (calling, speaking, listening or muted), recovery states keep their localized detail and Retry, and the transcript appears only once a turn or draft exists. The dock microphone shows a crossed-out icon only when muted in a call. Scope: mobile in-shell Live; the full-screen call surface below is unchanged. Regression coverage:assistant_live_mode_view_test.dart (including the idle Start talking button and orb, and the absent empty transcript) and assistant_live_call_controls_test.dart cover narrow/landscape and enlarged-text layouts, real connection-state action availability, and the absence of a body-owned control rail. shared_navbar_large_text_test.dart exercises the actual shell at enlarged text size and verifies the same dock Material element survives Chat, Live, global-navigation and full-screen transitions.
Full-screen call
Starting a call (not unmuting) opens a full-screen call surface on the root navigator, above the app shell, as a system-like flow. It keeps the gradient and blob appearance backdrops, and it adds no navbar or second shell.- Identity and status. The surface shows the assistant’s voice-reactive orb, name and one status line: Connecting…, the elapsed time, Reconnecting…, “Call ended · mm:ss”, or “Couldn’t connect”.
- Elapsed time. Shown as mm:ss, then h:mm:ss from one hour. Only the timer redraws each second, and screen readers get it as “Call duration”. The call clock starts on the first connection, keeps running through reconnects and transient errors, records the duration on disconnect, and resets when a new call starts.
- Controls. 64 dp circular controls: Mute, Camera, Keyboard, Captions, a 72 dp red End, and Minimize. Labels wrap only between words; at large text sizes a single long word scales down instead of breaking. In-call controls stay in place, disabled, while connecting; End stays available and cancels a connecting call. Mute appears toggled only while connected.
- Captions. An optional drawer shows the latest turns and live drafts.
- Orb. The orb always moves while visible and reduced motion is off: a slow flow at rest, a faster swirl while connecting or reconnecting, a pulse that follows the microphone while listening, a spectrum ripple from admitted assistant PCM while speaking, and a dim error-tone flow after a failure. Reduced motion renders a still frame. Colours come from the theme’s primary, secondary, tertiary and error tokens.
- Activity. While connected and unmuted, a line under the timer reads Listening or Speaking.
- Failure reasons. A failed or reconnecting call explains why under its status, from a fixed token set (
AssistantLiveFailure): Live paused (LIVE_MINT_*admission refusals, including the kill switch), today’s free time used, another call open, not enough credits, not in this plan, session expired, offline, timed out, server problem, connection dropped, microphone or camera access off, or no workspace. Server and exception text never reaches the surface. - After a call. Ended and failed calls offer Close plus Call again or Retry. A microphone or camera permission failure offers Settings (the system app settings) instead of Retry.
- Minimizing. Minimize or system Back keeps the call running and returns to the in-shell Live view, whose Return to call control reopens the surface; if the call dropped in the meantime, the reopened surface shows it ended. The dock call controls stay the in-shell control set.
- Lifecycle. The surface opens before its session starts and reads as Connecting… until then; if the start attempt settles without a session (for example, a refused microphone permission), the surface closes. After the session starts, any disconnect ends the call on the surface, including page-initiated disconnects without a final turn such as backgrounding the app: on return it shows “Call ended” with Call again and Close, never a stuck Connecting… with live controls. Nothing reconnects such a call automatically.
- Teardown. Dismissal always closes the call’s own route, even when another route covers it. A workspace switch or a signed-in account change dismisses the surface, because its actions belong to the previous workspace. A start that is still waiting for its token checks the selected workspace directly, so a token answered during the switch never opens a call for the previous workspace. The provider handshake times out after 10 seconds, so a disconnect (and the next connect, which waits for that close) cannot hang on an unanswered socket. Disposing the page closes the session, which also dismisses the surface.
- Speaker routing. Live keeps its existing speaker and Bluetooth routing. A speaker/earpiece toggle, CallKit/ConnectionService, an Android microphone foreground service and proximity dimming are follow-ups that need native work and device verification.
assistant_live_failure_test.dart (token route codes, transport and timeout mapping, distinct EN/VI labels), assistant_live_call_states_test.dart (failure reason, Settings instead of Retry, listening/speaking, connecting orb), assistant_live_playback_blob_test.dart (continuous motion in every mode, still frame under reduced motion), and assistant_live_call_render_test.dart (light/dark renders written to DESIGN_RENDER_DIR).
Mobile chat reply failures name their cause from safe diagnostics only (offline, timed out, session expired, credits or access, busy, interrupted stream, server problem, or reload needed), and hide Retry when retrying the same request cannot succeed. Coverage: assistant_reply_failure_test.dart.
Regression coverage: live_call/assistant_live_call_model_test.dart (duration format, call clock, phases, captions), live_call/assistant_live_call_view_test.dart (timer ticks without rebuilding peers, labels and tap targets, connecting/muted/ended states, and the 390×844 and 820×1180 light/dark/blob render matrix written to MIRA_LIVE_CALL_RENDER_DIR), live_call/assistant_live_call_route_test.dart (opens above the host, Minimize keeps the call, Return to call, dismissal on session close, a disconnect without a final turn shows the ended summary, and an unstarted start attempt closes the surface), and assistant_live_keyboard_startup_test.dart (backgrounding a presented call shows it ended on resume; a workspace switch dismisses it and leaves Live disconnected). The view test also checks that landscape and 2x text with captions open scroll without overflow.
Mobile draft editing and previews
The mobile prompt grows inline through five lines and preserves text selection. Enter inserts a newline; the side action sends through the guarded submission path. Attachment previews sit above the prompt. Images and videos open media previews; audio opens playback controls without automatic playback. Uploading and failed attachments remain identified and removable. Previews are bounded and scrollable on narrow screens and at enlarged text sizes. Assistant settings and its field editors reuse the existing custom floating navigation for Back. Other settings frames retain their current navigation. Settings are grouped sections in this order: Personality, Memory, Live, Model source and On-device models. Model source offers Remote models and On device as peer choices with one check; On device selects the first installed model and says “Download a model below” until one exists. Each downloadable model row keeps one trailing action (Download, Import or Use) and opens a menu for the license, the publisher and removal. Live-browsing and memory explanations are supporting lines under their toggles; the storage, hardware, background and history notes sit behind one information control on the On-device caption. Hardware, upload/download progress, errors and recovery controls remain visible. Personality values use two-line previews with the full value retained for accessibility and field editing. The central Assistant tile waits for completed authentication; this presentation does not grant new permissions. Regression coverage:assistant_composer_draft_test.dart observes focused input
height, control order, draft/selection/focus return, preview state updates and
blocked submission. assistant_settings_ux_test.dart covers authentication
readiness; existing routed settings tests cover Back and safe-area clearance.
Widget evidence uses synthetic data and does not establish installed-device
performance, chat persistence, or provider operation.
Central mobile Mira settings
On mobile, Settings → Apps → Assistant opens the same live-browsing preference used by Mira quick settings. The shared shell supplies the title and back dock; the editor adds no second navbar. The preference defaults to off and remains scoped to the signed-in actor and workspace. Switching either scope invalidates the open editor and prevents late reads or writes from publishing into the replacement scope. An unreadable preference shows retry without an editable guessed value; a failed save retains the last confirmed value. This surface configures the existing live-browsing setting only, not local-model installation or provider credentials. Regression coverage:assistant_settings_cubit_test.dart, assistant_settings_hub_test.dart, and assistant_preferences_test.dart cover persisted values, shared shell publication, failed reads/writes, and async scope invalidation.
Mobile tool ordering and session ownership
Mobile Live runs the currently declared workspace tools on the authenticated server API; only screen context is resolved locally. Tool batches execute in provider receipt order. Finalizing a turn waits for its pending tool results, including errors, before saving ordered text/tool parts. Both canonical Chat history and legacy Assistant history restore those parts without replaying tools. Provider text and output transcription are alternate streams: text takes priority when both are present, preventing duplicated replies. Each batch belongs to the actor, workspace, and connection generation captured when received. Disconnecting, replacing the session, or changing actor discards late output and prevents remaining calls from executing or reaching a new socket. An already dispatched server mutation cannot be undone by client cancellation. Starting a new typed turn keeps the completed previous turn’s original text and attachment metadata; its pending output cannot overwrite the new draft. Regression evidence lives inassistant_live_persistence_test.dart and
assistant_live_turn_parts_test.dart. These are lifecycle and metadata checks;
provider latency and live device connectivity require separate runtime evidence.
Mobile startup measurements
After the authenticated token arrives, mobile starts binding the visible conversation and, in parallel, initializes its native audio player and then opens the provider socket. The token envelope already carries seed history and the server owns the chat, so binding never gates the provider handshake: the call connects (and buffered startup speech drains) while the transcript is still restoring. A binding failure stays in the chat view and never fails the call; an audio failure still prevents connection.prepareSession still returns only
after binding settles, so a typed send captured from the visible conversation
dispatches only once that conversation is bound: a namespace switch can still
retire it. A retired preparation may already have opened a provider connection;
it is closed without sending user content. Cancellation or an actor/workspace
epoch change prevents later connection and timing publication. Native playback
initialization and disposal retain their existing serial queue.
Live state records monotonic millisecond durations for token minting, history
binding, audio initialization, socket connection, provider readiness, and the
whole attempt. These measurements contain no tokens, account identifiers, message
content, or error payloads and are not uploaded automatically. Concurrent stage
durations must not be added to estimate total latency. Failed attempts retain
only completed phase timings; obsolete attempts publish none.
assistant_live_startup_phases_test.dart verifies that binding overlaps the
handshake, that binding failures keep the call, that audio failures do not
connect, cancelled scope fencing, and immutable measurements. The total phase is
the time to a connected call; a slower binding publishes its duration after it
settles.
The Live information action in the shared shell opens the existing info sheet.
It shows the most recent attempt’s recorded phase durations in milliseconds,
including partial failed attempts, in a fixed phase order. Missing phases are
omitted. Measurements stay in memory on the current device: no account IDs,
request IDs, credentials, message content, persistence, or automatic uploads.
History overlaps the other phases, so phase durations do not sum to total time.
The sheet scrolls on small screens and with enlarged text. Widget regression
coverage is in assistant_live_startup_diagnostics_test.dart.
This removes serial client-side waiting; actual device/provider speed remains a
runtime measurement rather than a promised fixed latency reduction.
The mobile token route (/api/v1/assistant/live/token) returns a
Server-Timing header with durations only: auth, session, workspace,
access (membership and tier together), prompt and history (overlapped),
mint, and total. Use it to split the client’s “Session authorization” phase
into server stages and network time. Membership and the tier lookup run
concurrently; prompt personalization runs alongside chat binding and history,
both only after both access gates pass. The token is minted only when both
succeed, and the response is private, no-store. Timings are returned only on
successful responses, and session is absent under temporary AI authentication,
which resolves the actor without a Supabase session. Overlapped durations do not
sum to total.
Fresh sessions read at most the newest 60 stored rows in one ownership-joined
query and replay the newest text that fits a 32,000-character budget. Rows with
other roles or no text use query slots but not budget. A single oversized latest
message keeps only its tail. Replay is text only and does not keep user/assistant
pairs together, so the oldest kept turn can be an assistant reply.
Tier lookups canonicalize workspace UUIDs (trimmed, lowercase) before reading
subscriptions, so uppercase input still resolves a paid tier. The Voice Assistant
feature policy currently admits every tier; the PRO tier still matters for plan
model allocation and other PRO-gated features.
Per-chat message reads use ai_chat_messages_chat_created_idx (chat_id, created_at, id), built CONCURRENTLY. An interrupted concurrent build
leaves an INVALID index that IF NOT EXISTS then skips, so the migration
can be recorded as applied without the performance fix. After promotion, confirm
the index is valid before treating it as done:
(chat_id, created_at, id) on public.ai_chat_messages. If either flag is false,
the authorized database owner drops the index with DROP INDEX CONCURRENTLY and
rebuilds it with the same statement. Do not replay the migration and count its
NOTICE as a successful build.
Coverage: assistant-live-token-routes.test.ts (stage overlap with deferred
promises, access gates, timing header), assistant-live-token-tier.test.ts
(uppercase UUID keeps a pinned PRO requirement admitted),
resolve-plan-model-tier.test.ts (PRO allocation for uppercase input),
workspace-tier-admin.test.ts (canonical tier lookup),
assistant-history.test.ts (budget and ownership join), and
ai-chat-messages-chat-order-index.sql (index and ordered plan).
Canonical mobile Live capabilities
New mobile clients request thecanonical-v1 tool protocol. The token response
selects the protocol; an absent or unsupported response value keeps the legacy
execution route. Existing clients keep legacy declarations and execution. A
canonical session discovers authorized operations through search_workspace_tools
and executes their validated input through execute_workspace_tool. Schemas come
from the same Mira registry used by Chat, so registered capabilities do not need
a second manually maintained mobile tool declaration list.
Every canonical request authenticates the actor, verifies workspace membership
and the voice tier, and executes through the canonical permission-aware factory.
This transport stays in the session workspace; workspace switching, interactive
rendered UI, and approval-gated tools are unavailable. Screen metadata remains a
local, opt-in capability. Discovery does not authorize a later request: execution
rechecks access. A tool error is retained as an error rather than represented as
a completed action. Provider call identifiers are preserved; this does not claim
network-wide mutation deduplication or cancellation of dispatched writes.
Resumption handles use protocol-specific, UUID-validated chat scopes so a
canonical connection cannot restore legacy tool declarations, or vice versa.
Both scopes still require ownership of the same conversation. apps/web is the
only active runtime for this validation; the paused Rust backend’s session port
is historical and is not evidence for current behavior.
canonical-tool-bridge.test.ts, the canonical execution route tests,
session-scope.test.ts, and assistant_live_repository_test.dart cover schema
validation, permissions, unavailable tools, scope separation, and compatibility.
Provider calls and latency still require authenticated runtime verification.
Mobile remote reply lifecycle
An admitted mobile Chat reply keeps streaming while the app is temporarily backgrounded and can complete or report its error before the user returns. Foreground admission still applies to new prompts, attachments, history actions, and Live controls. Account and workspace changes, including leaving and returning to the same identity, and an explicit local/remote mode change invalidate the old reply lease. Local runtime unload/reload alone does not invalidate that lease; selecting a local model still stops remote work before local interaction.assistant_background_reply_test.dart exercises the actual page and shell dock
through pause, completion/error, active resume, and account/workspace/mode ABA.
assistant_local_chat_cubit_test.dart verifies that semantic mode selection and
transient runtime epochs remain separate. These injected stream tests do not
guarantee that an operating system keeps a suspended app’s network connection
alive; device and provider delivery remain separate evidence.
A replacement prompt accepted before pause remains accepted while cancellation
of the previous reply finishes. The composer clears only that captured prompt
under the same durable account/workspace/mode and attachment lease; a newer
unsent edit remains intact. Account departure clears private drafts through the
existing account reset, and mode/account ABA refuses the stale replacement.
assistant_durable_acceptance_test.dart exercises deferred real cancellation,
pause/resume, newer edits, and mode/account refusal through the actual dock.
Mobile playback, transcript and call completion
The Live stage uses a layered gradient blob driven by the assistant’s signed 16-bit, little-endian 24 kHz mono PCM admitted to the native playback queue. Microphone input, text events and byte counts do not synthesize speaking energy. Spectrum work and visual updates are bounded; a native drained-buffer callback, interruption or teardown resets activity. Reduced motion keeps the shape static. These controls do not establish physical speaker output or provider/device timing. A received completed turn is sealed before waiting for tools, persistence or history refresh. Subsequent spoken turns receive distinct identities and remain in receipt order. Pending turns remain visible until scoped history confirms them; restored Live identities prevent duplicate pending/history rows and preserve order when server retries receive later timestamps. Failed synchronization stays marked as unsynchronized and retries use the same turn identity. A successful write does not remove the visible snapshot until restored history confirms every saved role for that exact turn, workspace and conversation. A failed history restore retries restoration without issuing another successful write. Pending snapshots are in memory; process termination does not guarantee recovery of unsaved content. Explicit End seals the currently observed partial turn before closing the call, keeps Live selected and presents centered Call again and View transcript actions. Calling again remains an explicit consent/admission action. Account, workspace and conversation epochs refuse stale persistence and End callbacks. Logout or other privacy teardown clears local drafts without flushing them to a remote conversation. Reconnect does not authorize an old actor’s work. Queued provider frames carry an internal connection generation and are checked at delivery; replacing or closing a connection also invalidates its raw listeners. A deferred old close cannot revive or close a newer connection. Disposal closes admission before native teardown awaits, clears retained retry closures and refuses new session, microphone, camera or screen-capture admission. Repeated disposal shares one completion; a native cleanup failure still closes the state and attempts the remaining cleanup. This is separate from explicit End, which may finish the current admitted turn. Connected controls use the same shell action button geometry and styling as the normal navbar, within its existing material. Buttons retain semantic toggle and busy states and use the shared haptic preference. Calling uses the branded pending indicator and respects reduced motion. No automatic sound is enabled by this presentation change. Regression coverage is inassistant_live_persistence_test.dart,
assistant_live_audio_player_test.dart, assistant_playback_spectrum_test.dart,
assistant_live_transcript_section_test.dart, assistant_live_post_call_view_test.dart,
assistant_live_history_confirmation_cases.dart, assistant_live_socket_test.dart
and the Live dock/calling widget tests. Device audio quality, suspended-process
survival and published mobile builds require separate delivery evidence.
Pinned local runtime configuration
On-device preparation resolves only the app-owned<catalog-id>.litertlm
filename after store integrity verification. The pinned Qwen 3 0.6B artifact
uses its publisher-declared 4096-token context; Gemma and SmolLM2 retain the
existing 2048-token configuration. CPU, general-model interpretation, one
concurrent session and 256 output tokens remain unchanged. The Qwen context
is documented by its immutable publisher README.
assistant_litert_configuration_test.dart checks actual adapter configuration,
unknown filename rejection, real import/verification through a fresh store,
saved selection reload and late native-result disposal after session ABA.
assistant_local_reselection_test.dart checks that held preparation is disposed
before the newest local choice activates. Synthetic bytes and native factories
prove persistence and configuration wiring only; they do not prove device
format compatibility or successful inference. Failed local prompts remain local
with visible recovery and never silently fall back to a remote provider.
Mobile name confirmation and offline intent
The mobile header uses the confirmed assistant name, with Mira as its display default when no verified snapshot exists. An offline rename keeps the confirmed header and records a separate local name intent. Queued, conflicted and failed intents remain available through the existing offline changes sheet; they are never automatically discarded or promoted to confirmed names. Explicit pending name presentation is a separate UI step. Verified Soul snapshots use an account-owned cache envelope. Legacy optimistic name caches are not evidence of server confirmation, and disappearance of a queue record alone does not confirm its value. A validated server receipt establishes confirmation. Account departure and cache-clear epochs fence held reads and writes, including same-account restoration. Genuine permission and transport errors remain errors on explicit refresh.assistant_soul_provenance_test.dart exercises real encrypted cache and queue
restart, all three pending statuses, held account/clear boundaries, malformed and
foreign receipts, permission failure, and the Shell header’s offline rename.
These tests establish source behavior, not device or deployed-runtime proof.