Guias
Instalar e configurar o SDK para Tauri
Instale o SDK para Tauri com versão fixa, configure a identidade e a permissão de microfone e compile o app de exemplo.
Nesta página
Integrate Busymate AI in a Tauri v2 app using the official Tauri SDK distribution 1.0.1: the tauri-plugin-busymate-ai Rust crate and the optional tauri-plugin-busymate-ai-api JavaScript bindings. Source, the configuration reference and a buildable demo live in the public repository, released as 1.0.1. Identity uses protocol v2 / bridge build 2.0.0; microphone uses protocol v1 / adapter 1.0.0. The release manifest pins the source hashes. Its CONTRACT-v2.md hash matches https://busymate.ai/sdk/v2/2.0.0/SHA256SUMS.
1. Install the pinned version
- Add
tauri-plugin-busymate-ai = { git = "https://github.com/serebano/busymate-ai-sdk-tauri", tag = "1.0.1" }tosrc-tauri/Cargo.toml, or download the.cratefile from the 1.0.1 release and depend on it by path. Nothing is published to crates.io or npm. The optional frontend bindings install from the release's.tgztogether with@tauri-apps/api. - The SDK requires Tauri 2.12 or later and Rust 1.77.2 or later.
- Register the plugin's
Builderwith youraccount,mintandon_closecallbacks, add.on_permission_request(…)with the plugin'spermission_handler, and open the chat window with the plugin'sopen_chat(ChatOptions { url, assistant, origins, .. }). On macOS, also forwardon_web_content_process_terminatetoweb_content_process_terminated. The chat opens in its own webview window, and the bridge is answered from your app's Rust side. - Add the plugin's
defaultpermission only to your own local window's capability. Never addallow-bridgeorallow-microphoneto a capability: the plugin grants them at runtime to the chat window only, for its exact HTTPS origins.
Read the versioned installation instructions before wiring callbacks.
2. Load the chat as the window's page
Use the chat URL and assistant slug from your workspace, for example https://YOUR_ASSISTANT.busymate.ai/?channel=desktop_sdk&locale=en. Keep the URL's supported parameters and set channel=desktop_sdk. The chat is the window's top-level page: it uses the normal chat layout and shows your locale from the first frame. Do not use channel=embed, which needs an allowed parent web page and refuses to start as a window, or channel=desktop, which is reserved for the Busymate AI desktop app.
Allow only exact HTTPS origins, without wildcards. The assistant slug adds exactly https://<assistant>.busymate.ai. Add https://busymate.ai when you load a /support/<assistant> URL, and add your mapped support host if you have one.
3. Configure every supported callback
ChatOptions takes url, assistant, origins, identity (default on), microphone (default on), title, width and height. The plugin builder takes:
| Setting | Purpose |
|---|---|
account | Current account ID, or None when signed out; only its salted hash reaches the chat. |
mint | Required async backend callback returning a fresh token and matching nonce. |
on_action | Optional app action handler; return true only when handled. |
on_close | Optional host dismissal callback, for example close_chat. |
open_url | Optional handler for HTTPS opens; the default is the system browser. |
app_info | Optional hello.app override; its id salts the account key. |
Your backend must sign the supplied nonce with ES256, a unique jti and an expiry within 120 seconds. Never ship signing keys, cache launch tokens or log tokens. See backend signing and the complete configuration reference.
4. Wire the OS microphone callback
Call account_changed() (or accountChanged() from JavaScript) after login, logout and account switches.
The on_permission_request hook is required for the microphone. On macOS, add NSMicrophoneUsageDescription to src-tauri/Info.plist; hardened-runtime and App Store builds also need com.apple.security.device.audio-input. On Windows, the adapter reads the desktop-app microphone privacy settings. On Linux, unsandboxed apps need a working PipeWire or PulseAudio input. The handler allows the microphone only, and only for an allowed origin.
A mic or voice tap sends busymate.microphone.v1.request with id and source. The SDK obtains OS permission and returns { id, granted }. Chat waits for that reply before capture or voice token minting. Denial and timeout fail closed, and cancellation prevents a delayed grant from starting a cancelled session. Opening the chat never asks. See microphone lifecycle and troubleshooting.
5. Build and test the demo
Run cd example-app && npm ci && npm run tauri dev. Its settings view changes the chat URL, locale, assistant, origins, guest or identified mint, identity bridge, microphone and close handling. Follow the example-app build instructions. Guest chat needs no fake identity, and authenticated tests use your own backend. The event log helps with integration troubleshooting without exposing credentials.
Knowledge, tools, handoff, branding and voice availability are workspace features. Locale and appearance follow the supported hosted chat parameters. The SDK does not invent native flags for these services.
Verify
- Build the example app and verify guest chat, loaded with
channel=desktop_sdk. - Load
?channel=desktop_sdk&locale=de: the first frame is in German and the chat fills the window with no extra title-bar inset. - Use your backend to test sign-in, logout and account switching without history leakage.
- On a real machine, test the first mic/voice grant, denial, retry after changing the OS setting, and cancellation while the prompt is open.
- Test external links, close/action callbacks, window re-activation and renderer recovery.
Perguntas
Which version should I install?
Tauri SDK distribution 1.0.1, pinned by git tag. A Tauri window's own
__TAURI_INTERNALS__never makes it a Busymate AI shell: the chat keeps its normal layout.Does the demo authenticate without my backend?
No. Guest mode works when your workspace allows it; authenticated mode requires your real backend and a current session.
Which updates require an app release?
SDK changes, OS permission declarations and native capabilities require an app release. Hosted chat changes arrive from the service.