8fa8c14b0b
* fix: patch pip distlib finder for frozen electron runtime * fix: use certifi CA bundle for runtime SSL requests * fix: configure certifi CA before core imports * fix: improve mac font fallback for dashboard text * fix: harden frozen pip patch and unify TLS connector * refactor: centralize dashboard CJK font fallback stacks * perf: reuse TLS context and avoid repeated frozen pip patch * refactor: bootstrap TLS setup before core imports * fix: use async confirm dialog for provider deletions * fix: replace native confirm dialogs in dashboard - Add shared confirm helper in dashboard/src/utils/confirmDialog.ts for async dialog usage with safe fallback. - Migrate provider, chat, config, session, platform, persona, MCP, backup, and knowledge-base delete/close confirmations to use the shared helper. - Remove scattered inline confirm handling to keep behavior consistent and avoid native blocking dialog focus/caret issues in Electron. * fix: capture runtime bootstrap logs after logger init - Add bootstrap record buffer in runtime_bootstrap for early TLS patch logs before logger is ready. - Flush buffered bootstrap logs to astrbot logger at process startup in main.py. - Include concrete exception details for TLS bootstrap failures to improve diagnosis. * fix: harden runtime bootstrap and unify confirm handling - Simplify bootstrap log buffering and add a public initialize hook for non-main startup paths. - Guard aiohttp TLS patching with feature/type checks and keep graceful fallback when internals are unavailable. - Standardize dashboard confirmation flow via shared confirm helpers across composition and options API components. * refactor: simplify runtime tls bootstrap and tighten confirm typing * refactor: align ssl helper namespace and confirm usage * fix: avoid frozen restart crash from multiprocessing import * fix: include missing frozen dependencies for windows backend * fix: use execv for stable backend reboot args * Revert "fix: use execv for stable backend reboot args" This reverts commit9cc27becff. * Revert "fix: include missing frozen dependencies for windows backend" This reverts commit52554bea1f. * Revert "fix: avoid frozen restart crash from multiprocessing import" This reverts commit10548645b0. * fix: reset pyinstaller onefile env before reboot * fix: unify electron restart path and tray-exit backend cleanup * fix: stabilize desktop restart detection and frozen reboot args * fix: make dashboard restart wait detection robust * fix: revert dashboard restart waiting interaction tweaks * fix: pass auth token for desktop graceful restart * fix: avoid false failure during graceful restart wait * fix: start restart waiting before electron restart call * fix: harden restart waiting and reboot arg parsing * fix: parse start_time as numeric timestamp * fix: preserve windows frozen reboot argv quoting * fix: align restart waiting with electron restart timing * fix: tighten graceful restart and unmanaged kill safety
AstrBot Desktop (Electron)
This document describes how to build the Electron desktop app from source.
What This Package Contains
- Electron desktop shell (
desktop/main.js) - Bundled WebUI static files (
desktop/resources/webui) - App assets (
desktop/assets)
Current behavior:
- Backend executable is bundled in the installer/package.
- App startup checks backend availability and auto-starts bundled backend when needed.
- Runtime data is stored under
~/.astrbotby default, not as a full AstrBot source project.
Prerequisites
- Python environment ready in repository root (
uvavailable) - Node.js available
pnpmavailable
Desktop dependency management uses pnpm with a lockfile:
desktop/pnpm-lock.yamlpnpm --dir desktop install --frozen-lockfile
Build From Scratch
Run commands from repository root:
uv sync
pnpm --dir dashboard install
pnpm --dir dashboard build
pnpm --dir desktop install --frozen-lockfile
pnpm --dir desktop run dist:full
Output files are generated under:
desktop/dist/
Local Run (Development)
Start backend first:
uv run main.py
Start Electron shell:
pnpm --dir desktop run dev
Notes
dist:fullruns WebUI build + backend build + Electron packaging.- In packaged app mode, backend data root defaults to
~/.astrbot(can be overridden byASTRBOT_ROOT). - Backend build uses
uv run --with pyinstaller ..., so no manualPyInstallerinstall is required.
Runtime Directory Layout
By default (ASTRBOT_ROOT not set), packaged desktop app uses this layout:
~/.astrbot/
data/
config/ # Main configuration
plugins/ # Installed plugins
plugin_data/ # Plugin persistent data
site-packages/ # Plugin dependency installation target in packaged mode
temp/ # Runtime temp files
skills/ # Skill-related runtime data
knowledge_base/ # Knowledge base files
backups/ # Backup data
The app does not store a full AstrBot source tree in home directory.
Troubleshooting
Startup behavior:
- Packaged app shows a local startup page first, then switches to dashboard after backend is reachable.
- If startup page never switches, check logs and timeout settings below.
Runtime logs:
- Electron shell log:
~/.astrbot/logs/electron.log - Backend stdout/stderr log:
~/.astrbot/logs/backend.log - On backend startup failure, the app dialog also shows the backend reason and backend log path.
Timeout and loading controls:
ASTRBOT_BACKEND_TIMEOUT_MScontrols how long Electron waits for backend reachability.- In packaged mode, default is
0(auto mode with a 5-minute safety cap). - In development mode, default is
20000. - If backend startup times out, app shows startup failure dialog and exits.
ASTRBOT_DASHBOARD_TIMEOUT_MScontrols dashboard page load wait time after backend is ready (default20000).- If you see
Unable to load the AstrBot dashboard., increaseASTRBOT_DASHBOARD_TIMEOUT_MS.
Startup page locale:
- Startup page language follows cached dashboard locale in
~/.astrbot/data/desktop_state.json. - Supported startup locales are
zh-CNanden-US. - Remove that file to reset locale fallback behavior.
Backend auto-start:
ASTRBOT_BACKEND_AUTO_START=0disables Electron-managed backend startup.- When disabled, backend must already be running at
ASTRBOT_BACKEND_URLbefore launching app.
If Electron download times out on restricted networks, configure mirrors before install:
export ELECTRON_MIRROR="https://npmmirror.com/mirrors/electron/"
export ELECTRON_BUILDER_BINARIES_MIRROR="https://npmmirror.com/mirrors/electron-builder-binaries/"
pnpm --dir desktop install --frozen-lockfile