Руководства
Установка и настройка SDK для Windows
Установите версионированный SDK для Windows, настройте идентификацию и разрешение на микрофон и соберите пример приложения.
На этой странице
Integrate Busymate AI in a Windows desktop app using the official Windows SDK distribution 1.0.1: a .NET 8 library for Microsoft Edge WebView2, with WPF and WinForms controls. 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
- Download the
.nupkgattached to the 1.0.1 release into a local folder, add that folder as a NuGet source, then add the package at version1.0.1as the README shows. The package is not on nuget.org. Alternatively, clone the repository at tag1.0.1and add aProjectReferenceto the library project undersrc/. - Target
net8.0-windowson Windows 10 or 11 with the WebView2 Runtime installed (Windows 11 ships it). The package depends onMicrosoft.Web.WebView21.0.2903.40 or a compatible newer version. - Use the SDK's WPF chat view or WinForms chat panel and call
StartAsync(chatUrl, options). On an existingCoreWebView2, call the SDK'sAttachAsync(core, options)beforeNavigate. Both bridges are installed before the first navigation.
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
The chat options take Identity (null keeps a guest chat), Microphone (null denies microphone and camera), RestrictNavigation, NavigationOrigins, OpenExternal and UserDataFolder. The identity configuration takes:
| Setting | Purpose |
|---|---|
Assistant | Required assistant slug. |
Origins | Extra exact HTTPS chat origins. |
Account | Current account ID, or null when signed out. |
Mint | Required backend callback (request, CancellationToken) returning a fresh token and matching nonce. |
OnAction | Optional app action handler; return true only when handled. |
OnClose | Optional host dismissal callback. |
AppId | Optional stable app id that salts the account hash. |
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 AccountChanged() after login, logout and account switches. The control reports window re-activation as resume and recovers from renderer and browser process failures.
Desktop Windows apps get no per-app runtime prompt. The adapter re-reads Settings › Privacy & security › Microphone (device access, microphone access and desktop-app access) on every tap. It can optionally await your own Confirm consent dialog, and allows only WebView2 microphone requests from an allowed origin. Camera is always denied. Reuse the identity origins for the adapter with the SDK's ForAssistant(assistant, origins) helper.
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
On Windows with the .NET 8 SDK, run the WPF project in example-app/ with dotnet run --project. Its settings panel changes the chat URL, locale, origins, guest or identified mint, microphone, consent dialog and close callbacks. 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.
Вопросы
Which version should I install?
Windows SDK distribution 1.0.1, the NuGet package attached to the release. There is no legacy v1 identity bridge on Windows.
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.