Electron desktop application
The Electron desktop application is VoiceStudio's native distribution. It joins the desktop renderer to a local or remote backend, exposes a controlled bridge to the operating system, prepares a local runtime when the user asks, records opt-in failure diagnostics, and delivers platform packages with update metadata. Product workspace behavior belongs in Electron workspaces, reusable workflow automation belongs in desktop automation workflows, agent-driven browser work belongs in desktop agent browser, and release operations belong in deployment and operations. Compute choices connect to model compute.
Desktop system role
Desktop shell
The desktop shell coordinates the Electron main process, the renderer, and the VoiceStudio backend. The main process owns process control, native access, backend selection, account setup, distribution rules, and release behavior. The renderer uses one product surface whether work runs against a local service or a configured remote service.
The shell keeps operating-system effects outside the page. This includes files, permissions, window controls, tray actions, dictation, maintenance, terminal access, and embedded site browsing. Product workspace behavior can therefore focus on user work without receiving direct host access.
References: electron/…/index.ts• L547-670 electron/…/ipc.ts• L366-410
Desktop identity
The application presents one VoiceStudio identity across the native shell, development bundle, installer metadata, and update data. Packaging takes the product version from the root package so release artifacts and the desktop UI use one version source.
References: electron/…/app-identity.ts• L4-9 electron/…/app-identity.ts• L43-54 electron/electron-builder.config.mjs• L20-23 electron/electron-builder.config.mjs• L150-163
Main-process lifecycle
Startup sequence
The main process establishes application identity and the private app protocol before it initializes the product. After Electron is ready, it installs permission rules, restores sandbox folder access, creates opt-in diagnostic reporting and backend supervision, registers the native bridge, starts account and update services, creates the main window and tray, and begins backend attachment or launch. Repair-agent setup completes before backend launch because its environment can provide capabilities to the managed backend.
The shell uses one instance by default. A second launch focuses the live window or sends its command intent to the existing process. A terminal command can start the same process without a window. Startup first checks an already-running backend and prepares the selected runtime before it spawns a managed backend. Normal startup does not download or install the runtime. A bundled-only package launches the interpreter shipped inside its signed resources. A package that supports runtime setup shows setup only when its local runtime is not ready.
The launch path is organized as follows:
flowchart TD
A[Electron launch] --> B[Set identity and app protocol]
B --> C[Acquire single-instance lock]
C --> D[Restore grants and create backend supervisor]
D --> E[Register bridge, account, updates, window, and tray]
E --> F{Backend reachable?}
F -->|Yes| G[Attach and supervise]
F -->|No| H{Bundled-only package?}
H -->|Yes| I[Validate bundled runtime and launch]
H -->|No| J{Managed runtime ready?}
J -->|Yes| K[Stage sources and launch]
J -->|No| L[Show setup required]
I --> M[Poll health]
K --> M
G --> N[Expose ready desktop session]
M --> N
References: electron/…/index.ts• L491-585 electron/…/index.ts• L625-674 electron/…/backend.ts• L1556-1722
Headless terminal ownership
The desktop also acts as a short-lived owner for terminal commands. It starts the same backend supervisor without a window, publishes a protected discovery record for the command client, and opens a normal window when a later GUI launch arrives. An idle timer stops the background owner only when there is no window, no active request, no running backend job, and no uncertain activity state.
This keeps terminal and GUI work on the same backend and port. A later GUI launch does not create a competing backend process.
References: electron/…/headless.ts• L15-61 electron/…/headless.ts• L64-149 electron/…/index.ts• L155-179 electron/…/index.ts• L437-465
Renderer recovery
The shell checks that the trusted renderer has produced its root content after navigation. It retries an empty page a bounded number of times, then shows a small recovery page. A user action can clear the renderer cache and relaunch the app.
Navigation generations prevent an old page check from recovering a newer page.
References: electron/…/blank-window-guard.ts• L67-182 electron/…/index.ts• L385-397
Diagnostic reporting
Diagnostic reporting gives the desktop a bounded way to learn about failures without making failure handling depend on the backend. It starts with no collection until the user opts in, then records approved categories such as app, renderer, backend, setup, and operation failures.
The main process captures its own fatal events, Electron process exits, and backend status failures. The renderer can submit only the small diagnostic form exposed by the preload bridge. The reporter rebuilds values into a closed schema, scrubs approved stack locations, keeps a short local queue for offline delivery, and removes or stops using that data when consent is withdrawn. It can send approved records to the configured app intake, but a failed report never interrupts the product operation.
Durable consent, crash-session markers, and queue handoff use separate private files. A temporary read or write failure closes collection without treating unexamined evidence as corrupt. Completed producer records remain acknowledged until their cleanup is durable, so a locked file cannot cause repeated delivery or block unrelated evidence.
Each consent grant has an epoch. Capture and delivery use that epoch so an old task cannot send after opt-out or turn an old local error journal into a new report after a later opt-in. The result is support evidence that remains useful while preserving a clear user-controlled collection boundary.
References: electron/…/diagnostics.ts• L175-301 electron/…/diagnostics.ts• L397-551 electron/…/diagnostics.ts• L885-932 electron/…/diagnostics-schema.ts• L105-196 electron/…/diagnostics-schema.ts• L235-312
Window shutdown
Window close is an orderly lifecycle event. The shell gives the renderer a bounded time to flush persistent state. It then stops watchers, capture, updates, account access, repair work, diagnostic reporting, the tray, the development proxy, and backend processes before it exits. macOS can destroy the window while keeping the application open, and a terminal-started app can return to headless mode, so both paths preserve the same persistence boundary.
Closing normally quits on Windows and Linux and keeps the application open on macOS. An opt-in close-to-tray setting hides the window on every platform when a tray icon is available. Explicit quit, update installation, and operating-system session end bypass the hide path. A second launch or tray action can reopen the window while a persistence flush is pending.
The main process keeps durable records for main-process errors and backend crashes. These records are version-scoped, scrubbed, size-limited, and non-blocking. When a native crash occurred in the threaded model weight loader, later model loads can use one worker at a time on macOS and Linux. An explicit user device setting remains authoritative, and Windows already starts with serial weight loading.
References: electron/…/close-behavior.ts• L31-123 electron/…/close-behavior.test.ts• L25-167 electron/…/index.ts• L213-264 electron/…/index.ts• L333-383 electron/…/index.ts• L703-713
Backend health supervision
The backend supervisor first attaches to a healthy service and only then considers starting one. It uses the small /health contract for recurring liveness checks. Its state model separates setup, attachment, startup, readiness, temporary unresponsiveness, port conflict, crash, and failure.
Supervision probes every two seconds while the backend is starting, recovering, or showing a problem. After 30 consecutive healthy probes for a settled ready backend, it uses a six-second cadence to reduce idle work. Any missed or unhealthy probe resets the healthy streak and returns supervision to the active cadence.
Readiness has a backend-only startup budget. Work before process creation does not consume that budget. A backend that continues to print progress can receive a bounded extension, with a larger default on low-spec hosts. A silent or wedged launch still fails with evidence that identifies the port, process ownership, and recent child output. Temporary operating-system launch failures can retry without starting a competing readiness wait.
Health supervision treats a timeout as different from a dead process. A live child or an attached service can remain unresponsive while a long job runs. Consecutive refused connections can declare the service gone. A service that answers with an unhealthy result remains a recoverable unhealthy state instead of being reported as a crash.
If a managed child exits, the supervisor gives another VoiceStudio process time to claim the service before it reports a crash. Default local launches can move to a deterministic fallback port when the preferred port is denied. Explicit ports and custom commands keep their requested port contract. Local listeners must identify themselves as VoiceStudio backends before the shell attaches. Only the managed backend receives main-process bridge capabilities in its environment.
An operating-system refusal to launch the selected interpreter is reported as a launch failure rather than a broken runtime. This prevents an unnecessary repair. A refused legacy candidate can be skipped when another allowed candidate is healthy, while an explicitly configured runtime remains authoritative. The status contract carries the failure code and setup reason so the renderer can choose a safe action instead of inferring one from text.
The supervisor also proves the effective local data root before publishing its opaque data identity. It publishes that identity only for the managed child and only after that child is ready. Races during identity publication are retried; uncertain ownership stays unknown rather than being guessed.
References: electron/…/backend.ts• L119-257 electron/…/backend.ts• L1556-1722 electron/…/backend.ts• L2177-2257 electron/…/backend.ts• L2578-3013 electron/…/local-data-identity.ts• L107-187 electron/…/index.d.ts• L25-137
Native bridge
Renderer bridge
The preload layer exposes one typed window.voicestudio object through the context bridge. It offers named capabilities for backend state, runtime choice and discovery, updates, maintenance, files, permissions, account state, dictation, repair agents, watch folders, embedded browsing, terminal integration, diagnostics, and window control. The page receives no direct Node.js or operating-system access.
Actions use request-and-response calls. Status and progress use events with unsubscribe functions. Backend setup status includes its phase, progress, diagnostics, failure code, and connection checks so the renderer can explain first-run work without owning the setup process. The shared type contract keeps the main process, preload layer, and renderer aligned when a native capability changes.
References: electron/…/index.ts• L16-203 electron/…/index.d.ts• L11-16 electron/…/index.d.ts• L426-605 electron/…/ipc.ts• L366-410
Native interaction paths
The main process converts bridge requests into bounded native actions. Native dialogs control file and directory choices. Approved protocols control external links. Host permission state controls microphone and accessibility features. Model directories and media tools receive a capability only after explicit user selection and path checks.
Media-tool authorization retains the selected file grant before it gives the backend access. Sandboxed dialogs must return their authorization or the request fails closed. Native saves write to a temporary sibling and replace the destination only after the write is complete. Export names are normalized to one portable rule so a title cannot create an invalid Windows name or exceed the byte limit.
Folder watching uses a separate helper and a short-lived token. A reload, renderer crash, window close, or shutdown revokes that capability and closes the helper so a large upload cannot outlive the page that started it.
References: electron/…/ipc.ts• L162-218 electron/…/ipc.ts• L764-876 electron/…/media-authorization.ts• L1-90 electron/…/replace-file.ts• L35-79 electron/…/portable-filename.ts• L1-41 electron/…/watch-folders.ts• L8-35 electron/…/watch-folders.ts• L77-135
Sandboxed file access
Sandbox-scoped distributions use operating-system folder grants for user-selected files and directories. The shell persists opaque grants, restores them on the next launch, and releases them during shutdown. Each save or backend capability uses its grant only for the duration of the operation.
Direct-download distributions do not add sandbox dialog fields. A packaged sandbox distribution does, and it refuses an operation when the dialog does not provide the required grant.
References: electron/…/security-scoped-files.ts• L13-21 electron/…/security-scoped-files.ts• L22-155 electron/…/index.ts• L569-574
Dictation capture
Dictation has a separate native path. A tray action or global shortcut starts capture through the packaged helper. A dedicated recorder window receives capture events, while the ordinary product window cannot use recorder-only commands to type text into another application.
The capture helper, recorder window, and tray are closed together during shutdown. Product interaction patterns that use this capability belong in Electron workspaces.
References: electron/…/native-capture.ts• L23-83 electron/…/native-capture.ts• L124-220 electron/…/native-capture.ts• L255-283 electron/…/index.ts• L657-669
Embedded site browser
The desktop can show approved web pages inside an isolated browser view without giving those pages the desktop bridge. The view uses a temporary session, denies permission requests, accepts only web targets, and exposes navigation state and commands through the trusted app window.
Remote content cannot call site-browser IPC, use a preload script, open an unrestricted popup, or survive an app reload. Product behavior that uses this surface belongs in desktop agent browser.
References: electron/…/site-browser.ts• L29-45 electron/…/site-browser.ts• L70-95 electron/…/site-browser.ts• L151-197 electron/…/site-browser.test.ts• L137-205
Repair capability
The desktop shell treats repair agents as a native capability with a narrow session scope. Repair runs can use the live app workspace or a validated VoiceStudio source checkout. An app-only run uses a short-lived API bridge, while source diagnosis and fixes use the selected source workspace. Third-party agent processes do not inherit backend or account bridge credentials.
The bridge limits request size, response size, methods, paths, and time. Dubbing translation and text completion use separate restricted paths with no file or tool access.
References: electron/…/repair-agents.ts• L84-108 electron/…/repair-agents.ts• L651-699 electron/…/repair-agents.ts• L778-867 electron/…/repair-mcp-server.ts• L58-83 electron/…/llm-agent-bridge.ts• L36-159
Account and cloud boundary
Optional cloud account access is owned by the main process. The renderer can request sign-in, sign-out, profile changes, and account state through the bridge, but it does not receive refresh credentials or signed avatar links. Packaged builds use the production cloud environment when account access is enabled.
Sign-in uses OpenID Connect with a local callback and PKCE. The main process checks the discovery issuer, keeps short-lived access state in memory, and stores only the refresh credential through protected storage. Turning account access off ends the session, clears account images, stops cloud activity, and prevents later requests.
Cloud sync is a separate user switch that implies account access. The desktop tells the local backend to start or stop sync only when the combined account, sync, and signed-in state changes. See deployment and operations for the wider service boundary.
References: electron/…/cloud-config.ts• L19-98 electron/…/oidc.ts• L42-147 electron/…/index.ts• L33-133 electron/…/account-ipc.ts• L50-100
Backend provisioning and connection
Local runtime setup
For distributions that allow user runtime downloads, the user starts setup through the desktop UI when no usable local backend exists. Setup checks disk space and write access, obtains the managed runtime tool when needed, installs the locked dependency graph, verifies native imports, and marks the environment ready only after the checks pass. Normal startup does not silently install dependencies.
Setup reports its phase and download activity through the backend status stream. It can show package counts, estimated byte totals, transfer rate, active source host, and a stalled state based on actual download movement. The shell also keeps a bounded, scrubbed setup log across retries and app restarts. A setup connection check uses a sample from the active locked artifact before a large install begins.
The runtime separates replaceable application sources from the interpreter, download caches, models, and user data. The backend serves the web UI shipped with the same app version. Readiness uses dependency stamps, install markers, and an offline import probe. A slow probe is inconclusive rather than proof that a working runtime is broken. A probe that the operating system refuses to launch is different from a probe that runs and fails imports; the former reports the interpreter path and does not start repair, while the latter can lead to setup or repair. A timed or cancelled probe closes its process tree before setup can retry, so native libraries are not left in use by an old check.
Setup uses explicit proxy settings when present. On Windows it can translate enabled system proxy settings and representable bypass rules for the runtime installer and dependency tool, while preserving loopback and configured direct hosts. Unsupported bypass rules fail clearly rather than silently routing private traffic through a proxy.
The desktop can also discover Python runtimes in common system and user locations. Discovery is a bounded, read-only search that reports candidates and partial-scan warnings. Finding a path is not validation: the main process validates the selected interpreter, stages an opaque confirmation for the same trusted renderer, and only then saves the choice or offers an explicit repair plan.
Setup can resume an interrupted install without discarding completed downloads. A finished readiness marker takes precedence over a stale install marker. Native diagnosis can identify a missing or outdated system library before the shell retries a package install that cannot fix the host.
Bundled-only distributions use a different path. They validate a manifest-controlled interpreter inside the signed application resources and do not accept an external backend command or a user-managed runtime as a fallback. Mutable data, models, caches, and configuration remain in the app's user-data area. The shipped runtime also limits Python's user-site overlays and supplies the packaged media tools.
The setup selects a smaller CPU speech stack on supported hosts without an NVIDIA driver. It supports an explicit ROCm choice where the host supports it, including a separate Windows x64 ROCm runtime. The Windows ROCm path checks its target ABI and performs a model-free readiness check. NVIDIA hosts with older cards can use a CUDA 12.6 overlay; if that stack cannot drive the card, setup records the reason and falls back to CPU. Native checks fail closed when a required system library or accelerator runtime is missing.
References: electron/…/backend.ts• L1380-1411 electron/…/backend.ts• L1734-2082 electron/…/runtime-project.ts• L317-389 electron/…/runtime-project.ts• L397-439 electron/…/runtime-project.ts• L614-757 electron/…/runtime-download.ts• L26-180 electron/…/proxy-env.ts• L4-165 electron/…/setup-connection-check.ts• L14-142 electron/…/setup-hardware.ts• L44-80 electron/…/index.d.ts• L49-104
Runtime ownership and compatibility
Runtime location and ownership protect data that belongs to another installation. The app can reuse a compatible older Tauri runtime without rewriting or deleting it. If the user asks Electron to repair an unowned custom environment, Electron creates its own environment instead. Clean retry removes only an Electron-owned project and preserves shared download caches.
An explicitly configured runtime remains authoritative, even when another candidate is healthy. A refused legacy candidate does not prevent the shell from considering another compatible candidate. Uninstall lists the runtime's own folders separately when a setup-chosen location also holds user data or models.
References: electron/…/backend.ts• L2458-2487 electron/…/backend.ts• L2084-2139 electron/…/backend.ts• L2268-2329 electron/…/runtime-project.ts• L957-1025
Local and remote connection
Local and remote modes share one renderer API. Local mode points the app protocol at a supervised loopback service. Remote mode validates the supplied URL and backend identity, exchanges a key for a short-lived session, and keeps that session in main-process memory. Only the remote URL is stored for later use.
HTTP requests and supported speech and event WebSockets use the active main-process session. A remote backend must pass both liveness and an authenticated check before the desktop marks it ready. Switching to local mode clears the saved remote target and ends the remote session when possible.
References: electron/…/backend.ts• L1351-1469 electron/…/backend.ts• L2201-2257 electron/…/backend.ts• L2874-3013 electron/…/protocol.ts• L97-165 electron/…/ipc.ts• L545-567
Data relocation
The desktop can move local user data to a new location, including an existing empty directory such as a mounted volume. It stops the managed backend, copies and verifies the data, switches the data setting, restarts the backend, and removes the old source only after verification.
An existing target keeps its directory identity. The copy reserves names so concurrent files are not merged or overwritten. Rollback removes only entries that the move can prove it created, and it never follows a replaced directory. A failed move restores the setting and the new copy so the original data remains usable. The move also records the old voices root for legacy cache lookup.
References: electron/…/data-relocation.ts• L137-167 electron/…/data-relocation.ts• L323-459 electron/…/data-relocation.ts• L614-703 electron/…/ipc.ts• L600-657
Security boundaries
Renderer trust
The renderer runs with context isolation and without Node.js integration. The shell trusts only the packaged app://voicestudio page or the configured development origin. Other navigation and new-window requests are denied or passed to the operating system only for approved web or mail targets.
All main-process IPC registrations use one trust gate. The gate checks the expected window, its main frame, and the trusted renderer origin. One-way window-control events are dropped when unauthorized. Utility windows receive only the narrow capabilities assigned to them, and the registry test keeps new direct registrations from bypassing the gate.
This prevents a foreign page, subframe, embedded site, or recorder window from choosing an arbitrary native action, file path, backend target, or credential.
References: electron/…/trusted-ipc.ts• L27-121 electron/…/ipc-registry.test.ts• L33-218 electron/…/index.ts• L303-411 electron/…/site-browser.ts• L81-95 electron/…/native-capture.ts• L166-176
Backend request boundary
The private app protocol serves the renderer and proxies backend API traffic through the active connection. The renderer uses app-relative paths instead of calling the loopback port directly. The main process supplies the selected backend and session headers.
Development uses the same boundary through a loopback proxy. The proxy accepts requests only from the trusted renderer origin and loopback host. It strips client-controlled forwarding and credential headers, supplies main-owned headers, rejects paths outside the configured backend origin, and closes active connections during shutdown. Large media upload paths stream to an approved loopback backend without replaying the request at a redirect destination, while immutable renderer assets use bounded in-memory caching.
References: electron/…/protocol.ts• L41-165 electron/…/protocol.ts• L189-291 electron/…/dev-backend-proxy.ts• L24-163 electron/…/backend.ts• L1452-1460
Setup download boundary
Setup diagnostics test only an artifact selected from the packaged lock and the shell's current platform, Python, architecture, and accelerator choice. The main process accepts only HTTPS responses from the expected source host, follows a bounded number of redirects, limits the sample size and time, and scrubs the result before it reaches the renderer.
This boundary lets the setup screen distinguish a usable download path from a failed install without allowing a page to turn the diagnostic into an arbitrary network request. The same setup status carries the source host and stall state so a user can relate the result to the install that is in progress.
References: electron/…/setup-connection-check.ts• L14-50 electron/…/setup-connection-check.ts• L52-142 electron/…/backend.ts• L1380-1411 electron/…/index.d.ts• L426-434
Agent boundary
Repair agents receive only the task mode and diagnostics needed for that task. An app-only run uses a short-lived API bridge, while a source workspace is reserved for source diagnosis and fixes. Agent child environments explicitly remove backend-only capabilities.
The local completion bridge is a separate backend-only path for text completion. It requires a random bearer capability, rejects browser-origin requests, limits request size and time, serializes work, and hides provider or subprocess details from errors.
References: electron/…/repair-agents.ts• L84-108 electron/…/repair-agents.ts• L801-873 electron/…/repair-mcp-server.ts• L34-83 electron/…/llm-agent-bridge.ts• L36-159
Diagnostic boundary
Diagnostic data crosses from the desktop to a configured intake only after local consent and schema checks. The main process accepts a limited renderer input, adds desktop identity, projects approved failure fields, and rejects arbitrary paths, stacks, credentials, and source text before it stores or sends a record.
The local outbox is bounded by age, count, byte size, and repeated-failure budgets. Delivery uses short requests with no credentials from the product session. Offline or rejected delivery keeps the report local for a later attempt, while an opt-out cancels active work and purges retained evidence. Consent epochs prevent an operation that began under one grant from sending under another. A separate app-intake configuration is read from trusted packaged data and validated before use.
References: electron/…/diagnostics-schema.ts• L105-196 electron/…/diagnostics-schema.ts• L209-267 electron/…/diagnostics.ts• L843-932 electron/…/diagnostics.ts• L1073-1251
Packaging and release integration
Distribution profiles
The desktop build has maintained identities for direct download, Microsoft Store, Snap Store, and Mac App Store. A distribution profile states who owns application updates, whether runtime setup can download code, how file access is granted, and which signing model applies. The main process and packager use the same profile.
Direct and Microsoft Store packages allow user-started runtime setup and application-owned updates. Snap Store packages let the store own application updates while keeping user-started runtime setup. Mac App Store packages use store-owned updates, sandbox-scoped file access, and a bundled-only runtime path.
References: config/distributions.mjs• L1-29 electron/…/distribution.ts• L9-60 electron/electron-builder.config.mjs• L57-105 electron/…/security-scoped-files.ts• L124-139
Packaged application
The build combines the Electron shell and renderer with the backend, speech source, dependency lock files, license, brand assets, and platform-matched native helpers and runtime tools. Packages that permit runtime setup include the runtime tool when it is available for the target. The Mac App Store arm64 package can instead include its interpreter, media tools, and bundled-only runtime resources.
The package is assembled as an application archive plus resources outside that archive. The backend sources and matching web UI are therefore available to the shell and to the backend that it starts. Supported artifacts include Windows installers, macOS disk images and ZIP files, Linux AppImage and Debian packages, plus store-specific packages.
References: electron/electron-builder.config.mjs• L150-227 electron/electron-builder.config.mjs• L231-312 electron/package.json• L14-38
Version and update channels
The installer version comes from the root product package. The same version reaches the renderer, About panel, artifact name, and update metadata. Direct-download packages support Stable and Beta update channels. Store packages report updates according to store ownership.
The updater checks in the background and installs only after the renderer has flushed state and native resources have closed. Stable uses the latest release feed. Beta resolves the newest matching stable or beta release through the release API, while Microsoft Store builds remain stable-only. Transient network errors can retry through a release-asset route, and a download that stops receiving bytes is cancelled and retried. Verification failures remain visible instead of being hidden by network retry.
Installed update files are cleaned on startup only when they are the current or an older version. A newer pending update remains available, and unknown files are left untouched. This keeps the update cache from growing without deleting a download that may still be needed.
References: electron/…/updater.ts• L17-25 electron/…/updater.ts• L240-307 electron/…/updater.ts• L401-451 electron/…/updater.ts• L637-886 electron/…/updater-cache.ts• L4-91 electron/electron-builder.config.mjs• L43-55
Release workflow
Release automation builds the supported platform and architecture matrix, runs Electron checks, packages without letting the builder publish on its own, verifies packaged startup and metadata, and uploads matching artifacts and channel data to the release. A build is complete only when its resources, native helpers, platform libraries, update metadata, artifact names, and updater hashes all match.
The desktop package scripts make the same boundary clear for local work: build the web UI and Electron bundles first, then run packaging and update contract checks before producing an artifact.
References: electron/electron-builder.config.mjs• L20-105 electron/package.json• L14-38 .github/…/release.yml• L669-740 .github/…/electron-build.yml• L1-18
Change checklist
When these files or sections are changed, remember to consider these:
- Change the bridge type contract and preload exposure together with every new or removed IPC capability.
- Keep the shared trust gate aligned with the main window, recorder window, embedded site browser, account handlers, permission handlers, update handlers, and every registry entry.
- When backend lifecycle stages change, update the supervisor, reachability rules, request waiting behavior, localized failure hints, and renderer status labels together.
- When health supervision cadence changes, keep active and calm probe periods, the healthy streak threshold, miss recovery, unhealthy-state handling, and remote credential re-check timing aligned.
- When headless or terminal behavior changes, keep launch intents, single-instance handoff, discovery records, idle shutdown, and relaunch arguments aligned.
- When window close behavior changes, keep tray availability, persistence flush, session-end handling, terminal stop behavior, Dock restore behavior, and update quit installation aligned.
- When setup reporting changes, keep the backend status types, preload methods, IPC handlers, lock-selected connection check, progress rules, scrubbed setup log, and renderer setup states aligned.
- When diagnostic reporting changes, keep consent state, grant epochs, preload channels, main-process capture hooks, schema projection, bounded outbox recovery, app-intake configuration, and opt-out cleanup aligned.
- When setup download sources change, keep the packaged lock, platform and accelerator selection, proxy behavior, source-host reporting, and HTTPS sample checks aligned.
- When runtime probe cancellation changes, keep timeout and abort behavior, process-tree cleanup, close-event settlement, native-library release, and setup retry behavior aligned.
- When interpreter launch handling changes, keep operating-system launch refusals separate from missing interpreters or failed imports. Preserve candidate selection, install-doctor evidence, and repair behavior for each case.
- When accelerator or native runtime rules change, update the CPU fallback, legacy CUDA coverage, Windows ROCm ABI check, readiness stamps, import probes, packaged resources, and model-load crash fallback together.
- When bundled-only runtime resources change, keep the manifest path rules, signed resource layout, sandbox data paths, user-site isolation, media-tool paths, and external-command rejection aligned.
- When a user-selected runtime location changes, keep data, model-cache, temporary-file paths, explicit environment overrides, ownership markers, and uninstall entries aligned.
- When local data identity changes, keep effective data-root proof, child ownership, atomic metadata publication, race handling, Windows sharing retries, and renderer exposure aligned.
- When sandbox-scoped file access changes, keep bookmark persistence, restore and release timing, dialog options, media authorization, model authorization, saves, and distribution profiles aligned.
- When native capture or watch-folder behavior changes, keep helper paths, recorder ownership, short-lived tokens, reload and crash revocation, tray state, and shutdown cleanup aligned.
- When distribution profiles change, check updater ownership, runtime setup mode, file access mode, signing, builder targets, and renderer capability behavior together.
- When app identity or versioning changes, check native names, About data, development branding, artifact names, and updater metadata.
- When a native helper or platform target changes, check architecture selection, resource paths, Linux library closure, license notices, signing, and packaged smoke checks.
- When update cache or feed handling changes, preserve version parsing, pending-download retention, feed manifests, release assets, retry paths, verification reporting, and safe install timing.
- When backend-only environment capabilities change, check managed backend spawn options, account setup order, repair-agent child environments, and every process that can inherit the parent environment.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| The operating system refuses to launch the selected runtime interpreter | The app can report a broken environment and reinstall a runtime that cannot run | Preserve the named launch refusal, collect only bounded local trust facts after failure, fail without repair, and consider only allowed fallback candidates |
| Discovery returns a Python path that is not compatible with VoiceStudio | The renderer can offer a runtime that fails when the backend starts | Treat discovery as informational, validate again in the main process, and require a short-lived confirmation token tied to the trusted renderer |
| A bundled runtime manifest points outside signed resources or names a missing interpreter | A store package can launch the wrong program or fail after packaging | Validate the manifest schema, keep the executable inside the bundled runtime, and fail before launch |
| A native import is slow but not broken | A working runtime can be sent back to setup | Use long import tolerance, bounded startup budgets, and real-failure checks |
| A timed runtime probe leaves its child process or native libraries alive | A retry can race the old probe and fail again or load two native stacks at once | Stop the process tree and wait for the child close event before setup continues |
| A finished runtime keeps an old install marker | A working runtime can be shown as an interrupted install | Treat a newer ready marker as authoritative and remove the stale marker best-effort |
| Electron repairs an environment it does not own | Another installation can lose files or become unusable | Ownership markers preserve unowned environments and move repair to an Electron-owned runtime |
| A Windows proxy bypass rule cannot be represented without loss | Setup can route private or local requests through an unintended proxy, or fail with a misleading network error | Convert only representable rules, keep loopback and configured direct hosts out of the proxy, and fail clearly for unsupported rules |
| A live managed backend misses health probes during a long job | The renderer can show a terminal failure and stop work that would recover | Use the distinct unresponsive state, active probing during recovery, and a calm cadence only after a settled healthy streak |
| A backend remains alive but answers unhealthy health checks | The app can call a live service crashed or busy and take the wrong recovery action | Count answered unhealthy probes separately, report a recoverable unhealthy state, and continue probing without killing the service |
| A terminal command starts a second shell or receives stale discovery data | The command can target the wrong process or start a competing backend | Use the single-instance lock, atomic discovery records, PID ownership checks, and shared backend supervision |
| Renderer content comes from an untrusted origin, frame, or utility window | Native IPC, permissions, or backend credentials could cross the desktop boundary | Use context isolation, disabled Node integration, one shared main-frame gate, trusted-origin checks, and navigation denial |
| A sandbox dialog omits its authorization or a saved grant cannot be restored | A native operation can fail without host access, or a stale grant can be treated as a new one | Require grants in sandbox distributions, persist opaque records, restore at launch, and release every lease |
| A setup connection check uses a renderer-provided URL or the wrong locked wheel | The setup screen can report a result for an unrelated host or accelerator and hide the real install failure | Select the URL from the packaged lock, match the current host and variant, require HTTPS, and cap bytes and time |
| Setup progress trusts terminal output but not bytes written to the download cache | A large active download can look stalled while it is still moving, or a finished transfer can report false activity | Combine process events with cache-byte sampling and mark a stall only after bounded time without progress |
| Setup history keeps raw paths, credentials, or signed URLs | A support export can disclose local identity or access data | Scrub paths and URL credentials, retain a bounded head and tail, and export in-memory data when persistence fails |
| A required system library, Windows ROCm ABI, or selected accelerator build is missing or wrong | Reinstalling Python wheels repeats the failure or starts an incompatible native stack | Run native, ABI, and variant diagnostics, fail closed, and direct the user to the system or runtime fix |
| A prior native crash occurred in the threaded model weight loader | The backend can repeat the crash before the user can change the compute setting | Match the faulting thread, apply a version-scoped serial-load fallback only when the user did not set the option, and keep explicit settings authoritative |
| Data relocation copies an incomplete tree, a target changes during the move, or backend verification fails | The app can point to partial data, delete concurrent target content, or leave the user with an unusable session | Use manifest comparison, target identity checks, owned-entry rollback, setting restore, and restart verification |
| A local data identity file is copied, replaced during a read, or created for an uncertain data root | A backend can be attributed to the wrong installation or expose a false ownership identity | Bind the identity to the directory device and inode, publish atomically, retry races, and leave identity unknown on proof failure |
| A repair request exceeds its bridge scope or its JSON-RPC line limit | The agent call is refused without granting wider local access | Use session-scoped context, path and method checks, bounded request and response sizes, and timeouts |
| A recorder, watch helper, or embedded browser survives a renderer reload | A stale native capability can keep capturing, uploading, or exposing a remote page after the owner changed | Tie utility state to the owning window, revoke on reload or crash, isolate remote views, and close helpers during teardown |
| A store package offers an Electron-owned update or runtime download that the store owns | The package can conflict with store policy or fail on a bundled-only runtime | Use distribution profile gates for updater ownership, runtime setup, and file access |
| Release resources or architecture-specific helper files are missing | The installer may build but local setup or dictation fails on a target host | Use packaging resource contracts, helper closure checks, and packaged startup checks |
| A release feed stalls or a GitHub download host returns a transient error | The app can leave an update half-downloaded or show a permanent update failure | Retry transient failures, fall back to release assets when allowed, stop stalled downloads, and keep verification failures visible |
| Diagnostic consent is lost, revoked, unreadable, or read through a transient storage error | The app can send data under an old grant or delete evidence before the grant state is known | Treat consent as the local authority, fail closed while it is unreadable, use grant epochs, and serialize purge and delivery |
| A diagnostic record contains a raw path, stack, credential, or unapproved field | Support data can disclose local identity or sensitive content | Project only approved fields, scrub frames and text, validate packaged destinations, and bound the local queue |
Key files
| File | Why to read it |
|---|---|
| electron/…/index.ts | Main-process startup, single-instance behavior, GUI and headless lifecycle, native resource teardown, and update scheduling |
| electron/…/close-behavior.ts | Platform close rules, close-to-tray preference, persistence flush decisions, and terminal stop behavior |
| electron/…/headless.ts | Terminal launch intents, backend discovery, and conservative idle shutdown |
| electron/…/backend.ts | Local and remote connection choice, runtime state, health supervision, process ownership, setup reporting, failure evidence, data identity, and shutdown |
| electron/…/local-data-identity.ts | Opaque identity for a proven local data root and safe handling of concurrent publication |
| electron/…/runtime-probe.ts | Bounded runtime checks and process-tree cleanup before setup retries |
| electron/…/diagnostics.ts | User consent, durable diagnostic queue, crash-session recovery, delivery, and revocation |
| electron/…/diagnostics-capture.ts | Main-process, renderer-process, and backend-status failure capture |
| electron/…/diagnostics-schema.ts | Approved diagnostic fields, limits, scrubbing, consent epochs, and record validation |
| electron/…/supervise-cadence.ts | Active and calm health-probe cadence for the backend supervisor |
| electron/…/runtime-project.ts | Runtime compatibility, source staging, accelerator choice, download flow, native dependency checks, and readiness markers |
| electron/…/runtime-download.ts | HTTPS installer download, proxy selection, redirect limits, and transient retry behavior |
| electron/…/proxy-env.ts | Normalized explicit and Windows system proxy settings for runtime setup |
| electron/…/setup-connection-check.ts | Lock-selected HTTPS artifact checks used before runtime downloads |
| electron/…/setup-hardware.ts | Host hardware summary and the runtime build shown during setup |
| electron/…/runtime-windows-rocm.ts | Windows ROCm selection, recipe matching, and native readiness checks |
| electron/…/install-doctor.ts | Bounded local checks for operating-system launch refusals and trust facts |
| electron/…/crash-journal.ts | Native crash evidence and the safe model-load fallback |
| electron/…/setup-downloads.ts | Locked artifact hosts, in-flight download activity, and interrupted-cache cleanup |
| electron/…/setup-progress.ts | Setup phase and download progress that the renderer can show without parsing process output |
| electron/…/trusted-ipc.ts | Shared sender, frame, owner-window, and origin checks for native IPC |
| electron/…/ipc-registry.test.ts | Contract that every IPC registration uses the shared trust boundary |
| electron/…/ipc.ts | Native capability boundary, runtime confirmation, maintenance actions, backend connection commands, and file saves |
| electron/…/native-capture.ts | Recorder window, tray capture, shortcut ownership, and shutdown cleanup |
| electron/…/watch-folders.ts | Short-lived folder-watch capability and helper-backed upload lifecycle |
| electron/…/site-browser.ts | Isolated embedded browser view, URL policy, and remote-page lifecycle |
| electron/…/repair-agents.ts | Agent discovery, scoped workspaces, child-process boundaries, app bridges, and translation sessions |
| electron/…/index.ts | Public window.voicestudio bridge used by renderer workspaces |
| electron/…/index.d.ts | Shared contract for desktop capabilities, setup progress, status events, discovery results, update states, and failure states |
| electron/…/protocol.ts | Renderer serving, active-backend API proxy behavior, upload streaming, and static asset caching |
| electron/…/distribution.ts | Distribution-owned updater and runtime setup decisions |
| electron/electron-builder.config.mjs | Product identity, resources, installer targets, native helpers, signing, and update feeds |
| electron/…/updater.ts | Update channel selection, release lookup, fallback download path, update state, and safe installation timing |
| electron/…/updater-cache.ts | Safe retention and cleanup of pending update downloads |
| electron/package.json | Desktop build, packaging, typecheck, test, and contract-check entry points |
| .github/…/release.yml | Production platform matrix and Electron artifact publication |