Skip to content

Feat/desktop app - #546

Open
zfoong wants to merge 5 commits into
V1.4.6from
feat/desktop-app
Open

zfoong wants to merge 5 commits into
V1.4.6from
feat/desktop-app

Conversation

@zfoong

@zfoong zfoong commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator

What and why?
Created a Tauri based desktop app. With option to auto launch on startup. Intend to replace the web browser based craftbot (still available and the default if installed using clone). npm install available at https://www.npmjs.com/package/craftbot.

Note: require code-signing on Windows and Mac

A native desktop app (Rust, Tauri 2, system webview) that shows the UI
the running agent serves, in its own window with a tray icon. It
installs CraftBot when missing, starts it when stopped, and keeps the
agent running when the window is closed. Agent Apps, downloads, links,
notifications and camera/microphone requests work as in a browser.

- desktop/: the app (window, tray, install/start page, permissions).
- launcher/core/: the setup window's install, start and state code,
  moved into a library both apps share. The setup window is unchanged.
- craftbot.py: `open` and `start` open the app instead of a browser
  tab when it is installed; CRAFTBOT_DESKTOP_APP names another
  executable or turns this off.
- UI: system notifications for replies, questions and errors while
  the app's window is in the background (desktop app only).
- desktop.yml: tests and builds on Linux, Windows and macOS; on a v*
  tag, signs the installers and attaches them to the release.
- release.yml, bundle.sh: read MIN_MACOS from its new path.

Signed-off-by: zfoong <tham_yikfoong@outlook.com>
A tray checkbox starts the app at sign-in, in the tray (--hidden). Off
until turned on. Opened at login, the app leaves starting the agent to
CraftBot's own login item, and starts it only once its window opens.

The entry is the app's own ("CraftBot Desktop" on Windows and Linux,
dev.craftos.craftbot on macOS), written with auto-launch directly:
tauri-plugin-autostart writes the path unquoted, which breaks on paths
with spaces.

Tauri's Windows uninstaller deletes the Run value named after the
product, "CraftBot", which is the agent's own login entry. An
uninstaller hook keeps it and removes the app's entry instead.

Signed-off-by: zfoong <tham_yikfoong@outlook.com>
@zfoong
zfoong requested a review from ahmad-ajmal November 30, 2026 05:47
@zfoong

zfoong commented Nov 30, 2026

Copy link
Copy Markdown
Collaborator Author

Review but not merge yet

- Read craftbot.pid beside craftbot.py when the state root has none, so a
  running pre-1.4.5 install is not seen as stopped and restarted on Start.
- Show the UI only once /api/session-token answers 200 (falling back after
  60 polls), instead of as soon as the agent reports running, which showed
  "backend isn't responding" on first start.
ahmad-ajmal added a commit that referenced this pull request Dec 2, 2026
…ting

Desktop app (review of #546):
- Windows release: bundle with --no-binary-patching so the signed app exe
  is not rewritten (and its signature voided) before it is packed.
- Windows paths: std::path::absolute instead of fs::canonicalize, which
  produced \\?\ paths for every craftbot.py run.
- Windows install folder: product "CraftBot Desktop" on Windows
  (tauri.windows.conf.json), apart from CraftBot's data root; craftbot.py
  finds it through the folder the installer records; hooks.nsh simplified.
- The window follows CraftBot's UI address (ui.json ports, a second launch
  naming another CraftBot) instead of a showing/not-showing flag.
- The UI readiness check tries every address localhost resolves to (::1
  first on macOS), and the Open CraftBot button records what it shows so
  the poll does not reload it.
- auto-launch pinned to =0.6.0 (the app quotes the path itself).
- Workflow: contents: read by default, write only for the attach job.
- craftbot.py hand-over: the app no longer inherits CRAFTBOT_HOME; macOS
  uses `open -n` so a running app receives the arguments; the browser opens
  when the app does not start, and Linux without a display keeps it.

Installer: a Kanban Board registry entry whose folder is gone (the data
folder removed by hand or by the legacy uninstaller) is forgotten with
`agent-app <path> forget` and installed afresh, instead of failing the
required default-agent-app stage on every retry.

UI: the splash reads "init received" from the store. It came from a
listener the WebSocket provider adds after the first render, so an init
that arrived sooner was missed and the splash showed "backend isn't
responding" after 90 seconds on a fresh install.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ting

Desktop app (review of #546):
- Windows release: bundle with --no-binary-patching so the signed app exe
  is not rewritten (and its signature voided) before it is packed.
- Windows paths: std::path::absolute instead of fs::canonicalize, which
  produced \\?\ paths for every craftbot.py run.
- Windows install folder: product "CraftBot Desktop" on Windows
  (tauri.windows.conf.json), apart from CraftBot's data root; craftbot.py
  finds it through the folder the installer records; hooks.nsh simplified.
- The window follows CraftBot's UI address (ui.json ports, a second launch
  naming another CraftBot) instead of a showing/not-showing flag.
- The UI readiness check tries every address localhost resolves to (::1
  first on macOS), and the Open CraftBot button records what it shows so
  the poll does not reload it.
- auto-launch pinned to =0.6.0 (the app quotes the path itself).
- Workflow: contents: read by default, write only for the attach job.
- craftbot.py hand-over: the app no longer inherits CRAFTBOT_HOME; macOS
  uses `open -n` so a running app receives the arguments; the browser opens
  when the app does not start, and Linux without a display keeps it.

Installer: a Kanban Board registry entry whose folder is gone (the data
folder removed by hand or by the legacy uninstaller) is forgotten with
`agent-app <path> forget` and installed afresh, instead of failing the
required default-agent-app stage on every retry.

UI: the splash reads "init received" from the store. It came from a
listener the WebSocket provider adds after the first render, so an init
that arrived sooner was missed and the splash showed "backend isn't
responding" after 90 seconds on a fresh install.
Closing the window hides it to the tray. On macOS a full-screen window has a Space of its own, and hiding the window does not remove it, so the screen went black. The window now leaves full screen first and is hidden once AppKit posts NSWindowDidExitFullScreenNotification; showing it again in the meantime keeps it on screen.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants