Skip to main content
Some Mira tools change the app rather than workspace data: set_theme, set_sidebar, show_workspace_artifact, manage_workspace, set_immersive_mode and open_app. The server returns a success marker and the client applies the effect. Mira must never report an effect that no client applies.

Capability declaration

Each client declares the effects it applies with clientCapabilities: The server removes undeclared UI tools from the registry, tool discovery and forced tool steps. When a forced tool is unavailable, the step falls back to discovery instead of requiring an impossible call. Every request gets a short prompt note naming the effects its client cannot apply. For example, without artifact_panels Mira uses open_app or answers in chat. Unknown capability names are ignored so newer clients stay compatible. Data tools are never gated by capabilities; permissions still apply. An absent declaration means no UI effects, on every transport. Only clients that explicitly declare an effect receive its tool:
  • Web Mira chat declares theme, sidebar, artifact_panels, immersive and navigate.
  • The shared AI chat route, including the retained legacy mobile transport, the native /chat/conversations/:id/messages route and canonical Live (/api/v1/assistant/live/tools/execute) forward only what the client sends. Without a declaration they expose no UI tools, so older mobile builds lose set_theme in chat until they update. That is preferable to Mira claiming effects nobody applies.
  • AI agents and Mind have no client that applies markers and get no UI tools.
  • Canonical Live also resolves the user timezone (client value, then saved personal, then workspace preference).
  • Web dashboard Live declares open_app as a client function, alongside the existing theme, sidebar and panel functions.

open_app

open_app switches to another app in the current workspace. Destinations: home, assistant, tasks, habits, calendar, finance, time_tracker, mail, drive, meet, notes, chat. It only navigates; it does not read or change data. Each client maps destinations to its own routes. Web uses /:wsId/<segment>, and Web’s proxy redirects satellite segments to their owning app. Web ignores markers with an unknown destination or an unsafe workspace segment. Web Live navigation leaves the Live page.

Mobile bridge and screen context

The mobile app registers one app-level bridge (AssistantClientActions) in app.dart. It owns the router and theme, so chat and Live apply markers without the Assistant page.
  • Chat declares theme, immersive and, with the bridge, navigate. Theme and immersive are applied by the chat cubit; open_app goes through the bridge.
  • Live declares the bridge’s set (theme, navigate) with each canonical execution, and sends the verified device timezone. When execute_workspace_tool returns a set_theme or open_app marker, the device applies it before answering the model.
    • A marker the device could not apply is returned to the model as an error, never as a success.
    • This includes a theme that failed to save, a marker for a workspace other than the one selected on the device, and a marker whose turn went stale.
    • An unexpected client action exception becomes apply_failed; the response contains no success marker and subsequent tool calls can continue.
  • Scope: each action is bound to the actor and workspace that requested it. A sign-out, account or workspace switch, or the caller’s own turn guard cancels it until the effect is dispatched. In Live, an interruption or a new typed turn also cancels UI actions still pending from the earlier turn.
  • Theme writes: the cancellation point is the synchronous scope check and preference dispatch. A scope change before it skips the write; after it, the write stands and the device theme follows the stored value. Mira never claims a cancellation it cannot guarantee. A storage write the platform reports as failed, or that throws, is returned as theme_not_saved and the current theme is kept.
  • Overlapping theme choices: writes never wait on each other. One ledger per preference store gives every dispatch a sequence, including the repair writes it issues, and records the newest saved choice. When no write is outstanding, it rewrites the newest saved choice if a write was stored after a newer one or the cache holds a newer failed value. A choice is shown only if it is still the newest saved choice when its write returns.
    • Result: the UI, the cache and the store end on the newest saved choice for every completion order of overlapping choices and repairs.
    • Limit: a repair that itself fails or throws is not retried. The UI and cache keep the newest choice, but the store may hold an older value until the next theme write settles it.
  • Destinations map to shell routes (time_tracker opens Timer). Access gates stay with the router redirects.
  • Leaving the Assistant: when the app switches away, Live continues only if the user enabled Live while browsing; otherwise it disconnects as it does today.
get_mobile_screen_context (Live) still requires the Live while browsing opt-in. It returns:
  • the app section;
  • visibleRecords: type and id pairs that the foreground screen registers;
  • form: the open form’s fields.
The rules for that content:
  • Values are read only when Mira asks and are capped (20 records, 30 fields, 500 characters per value).
  • A field is sent as [redacted] when:
    • its rendered control is obscured or uses the visiblePassword keyboard; these are read from the real EditableText, not declared by the screen;
    • no rendered EditableText uses the registered controller (for example a custom widget with its own internal controller), so obscuring cannot be verified;
    • it is a closure field (no controller) that is not a well-formed boolean, date, time or datetime value;
    • its input type normalizes to a password, PIN or OTP type;
    • its key or label names a credential or identifier, in English or Vietnamese: password or passphrase, PIN, OTP, token, secret, private or API key, auth, bearer, credential, cookie, session, JWT, seed, mnemonic or recovery phrase, card, CVV, IBAN, account, routing, SWIFT or sort code, tax, national or social security ID and passport (for example mật khẩu, tài khoản, xác thực, bảo mật, khôi phục). Matching is deliberately broad, since a false match only withholds a value;
    • any recoverable reading of its value contains a secret (below).
  • The whole field is redacted, not just the match, because a match in a normalized or decoded reading cannot be mapped back safely.
  • Values are scanned before truncation, first folded (invisible format characters removed; fullwidth forms, superscript digits, punctuation look-alikes and the ellipsis folded; tab, NBSP and other spaces collapsed), also read without diacritics, and then decoded up to three layers (percent, \x/\u/HTML numeric escapes, base64 and hex runs that decode to valid text). Each reading is checked for:
    • credential shapes: JWTs, sk-/sk_live_, GitHub, Slack, AWS, Google and GitLab keys, bearer tokens and private keys;
    • Luhn-valid card numbers;
    • mod-97-valid IBANs;
    • long high-entropy tokens that mix letters with digits or both cases.
  • Supported characters only. The app does not claim full NFKC coverage. Every supported character whose NFKC reading contains an ASCII letter or digit (for example the rupee sign, long s, ligatures, digraphs, ordinal indicators and fractions) is folded to that reading first. The fold table is generated from the supported ranges by apps/mobile/tool/generate_assistant_compat_fold.mjs, together with the NFD base letter of every supported precomposed character and a validated list of stroked, barred and hooked letters; rerun it after changing the ranges. --check verifies the committed table and runs in the mobile CI analyze job and bun check:mobile. Every reading, raw and decoded, may then contain only ASCII, Latin letters and marks (Latin-1, Extended-A/B and Additional, combining diacritics), common punctuation, currency, arrows, shapes and emoji. Dotless i and j are rejected as look-alikes. Any other character, including other scripts and non-ASCII digits, redacts the field. An encoding still decodable after three layers also redacts the field.
  • Diacritics. Combining marks are supported for decomposed Vietnamese, so every reading is also scanned without them: NFD with every nonspacing mark removed. Marks inserted between a secret’s characters (accents, or overlays such as U+0337 and U+0338) and precomposed accented letters therefore cannot hide it. The same reading maps Latin letters with a stroke, bar, hook, curl or tail that have no decomposition (Đ, Ł, Ø, Ħ, Ŧ, Ƀ, Ɨ, Ƶ, and eth Ð/ð) to their base letter. The shared value keeps its marks and letters, so Vietnamese such as Đà Nẵng is shared unchanged.
  • Punctuation look-alikes. Supported characters drawn like the punctuation credentials are spelled with (+ - _ = . /) become that ASCII character in scan readings: heavy plus and Greek crosses; dashes, minus signs, heavy minus and horizontal box-drawing bars; double low line and the lower one-eighth block; double horizontals; middle dot and bullets; and the fraction slash, diagonal and heavy solidus, including when produced by fraction folding. Fullwidth forms use the fullwidth ASCII fold. This keeps embedded credentials in one scan token; ordinary fraction, list and box-drawing text retains its original display value. Other unsupported characters still redact the whole field, including after decoding.
  • Free-text fields are also scanned together on what is actually sent (each value’s first 500 characters): joined in order and in reverse, and every ordered pair across its boundary (256 characters each side). Pair boundaries of the full values are checked too. A secret only visible across fields redacts every free-text field.
  • Known limit (adopter gate): a secret split over three or more fields in an order other than registration or reverse order is not detected. The calendar form registers only two free-text fields, so this is not reachable today. Before a screen registers three or more free-text fields, add a conservative fragment policy; do not add permutation scanning.
  • Screen-context results reach the model only. Live turn parts, persisted chat history and restored caches keep a placeholder, never the payload.
  • The most recently registered visible screen wins. Offstage shell pages report themselves hidden. AssistantScreenContextScope requires an isCurrentScope predicate; the registry checks it on every read, before accessing records or field values. Only a screen not tied to any workspace or account opts out, explicitly, with AssistantScreenContextScope.unscoped. Mounted create and edit event forms (showEventFormSheet requires the predicate too) stop sharing their context as soon as the selected actor or workspace changes, even before the next frame.
  • Record ids are hints: the server re-reads records with the user’s permissions, and Mira treats field values as user data, never instructions.
The calendar event form is the first adopter: event id, title, description, all-day and start/end. Mira can read a half-filled event and help finish it. Timed start and end values are the wall time shown in the form, in the calendar’s timezone, written as ISO 8601 with that zone’s UTC offset (for example 2026-10-26T09:00:00+07:00), never as UTC. A time skipped by a DST change has no offset. All-day values are plain yyyy-MM-dd dates. Filling fields from Mira and sending screen context with chat messages are separate follow-ups.

Regression coverage

  • packages/ai/src/tools/mira-client-capabilities.test.ts: resolution, gating, discovery, prompt note.
  • packages/ai/src/tools/mira-sdk-tool-search.test.ts: forced-tool fallback.
  • packages/ai/src/tools/executors/theme.test.ts: open_app marker.
  • packages/ai/src/chat/google/route-mira-runtime.test.ts: declared capabilities reach the tool context and prompt.
  • apps/web/.../components/use-mira-ui-actions.test.tsx: Web navigation and unsafe markers.
  • apps/web/.../assistant/use-live-tools.test.tsx: Web Live open_app.
  • apps/web/src/app/api/v1/assistant/live/tools/execute/route.test.ts: canonical defaults and timezone.
  • The native messages route.test.ts: forwarded and default capabilities.
  • apps/mobile/test/features/assistant/bridge/: bridge mapping, workspace guard, registration, Live marker truthfulness, screen-context redaction, bounds and visibility.
  • apps/mobile/test/features/assistant/data/assistant_live_repository_test.dart and apps/mobile/test/features/chat/data/chat_mira_timezone_test.dart: declared capabilities and timezone.
  • apps/mobile/test/features/assistant/bridge/assistant_secret_scan_test.dart and assistant_screen_context_test.dart: tab, NBSP, zero-width, fullwidth, percent, escape, base64 and hex readings; digit-free base64; unsupported characters in raw and decoded readings (other scripts, encoded non-ASCII digits); supported characters with an ASCII compatibility reading (long s, the rupee sign and vulgar fractions), folded and redacted only when the folded reading holds a secret, raw and encoded; the depth limit; secrets split across fields, including at the end of a bounded long field; custom controls with their own controller; structured closure fields; misleading field names; credential-bearing English and Vietnamese field names while ordinary calendar labels stay shared; real-control obscuring and visiblePassword.
  • apps/mobile/test/features/assistant/bridge/assistant_secret_lookalike_test.dart: keys with combining marks inserted, precomposed accented letters or stroked letters, raw and base64; Bearer and GitHub tokens split by each punctuation look-alike, solidus overlay or stroked letter, in both fragment orders; ordinary decomposed Vietnamese, Đà Nẵng and đường, fractions, fraction-slash dates, diagonals, paths, URLs and bullet lists stay shareable while unsupported characters still redact the field.
  • apps/mobile/test/features/calendar/widgets/event_form_assistant_context_test.dart: read-time scope checks and mounted create/edit forms across a WorkspaceCubit switch, including no reads of stale fields; start and end pinned to the calendar zone’s offset in a non-UTC zone.
  • apps/mobile/test/features/calendar/utils/calendar_wall_iso8601_test.dart: wall times with positive, negative and half-hour offsets, a DST gap and parsing back to the stored instant.
  • apps/mobile/test/features/assistant/assistant_live_screen_context_persistence_test.dart: the serialized persistence request has no screen payload.
  • app_assistant_client_action_bridge_test.dart: a thrown and a false theme storage result, and an account switch during a delayed theme write.
  • apps/mobile/test/features/settings/cubit/theme_action_scope_test.dart: a held platform write keeps its result after a scope change; a false result keeps the old theme; a failed older write cannot roll back a newer same-value write; a failed newer write reconciles to the older saved value; two successful choices completing newest first end on the newest, in the UI and the store.
  • apps/mobile/test/features/settings/cubit/theme_write_ledger_test.dart: repairs held across a newer choice (newest saved first and newest failed first), a newer dispatch failing during a repair, a repair that fails or throws, a throwing write, and all 56 two- and three-write success and completion-order schedules, checked at the UI, cache and store.
  • apps/mobile/test/features/assistant/assistant_live_client_action_turn_test.dart: an interruption or new typed turn cancels a pending Live UI action.