Skip to content

Desktop shell (Electron): graphics backend, translation, Creality Scan projects, agent on the open window - #67

Open
opoeta wants to merge 4 commits into
CNCKitchen:mainfrom
opoeta:feat/desktop-shell
Open

opoeta wants to merge 4 commits into
CNCKitchen:mainfrom
opoeta:feat/desktop-shell

Conversation

@opoeta

@opoeta opoeta commented Nov 1, 2026

Copy link
Copy Markdown

What

A desktop/ folder with an Electron shell around the local build — Windows x64 for now, self-contained (own package.json; nothing in src/ changes):

  • Graphics backend — Help → Hardware picks what ANGLE translates WebGL to: DirectX 11 (default), DirectX 12, Vulkan or OpenGL, and shows GPU, WebGPU, thread count, cross-origin isolation and WebNN. Applies on restart.
  • Translation at run time — the page's English text is swapped from desktop/i18n/<lang>.json, node by node, and kept translated as React redraws (MutationObserver), so the app source needs no i18n plumbing. pt-BR today; the first language follows the OS, the Language menu switches. Canvas text and run-time numbers are not covered.
  • Creality Scan projects — project.obp opens from menu, command line, drag & drop and the file picker, resolving to the project's result/Mesh.ply (or the newest session's Fused.ply); File → Watch Creality Scan folder… offers each new mesh the scanner writes.
  • Agents on the open window — the app starts the relay itself and writes agent.json (port, token) in its user-data folder; scanruler-mcp.cmd next to the exe joins that app, so claude mcp add …scanruler-mcp.cmd drives the window the user is looking at instead of a background copy.
  • File associations: .scanruler .stl .ply .obj .3mf .step .obp.

Dependencies

electron (MIT), electron-builder (MIT), puppeteer-core (Apache-2.0), dev-only. New files carry the SPDX header. Everything written from scratch.

Checks (Windows 11, Node 24)

  • npm test in desktop/: smoke (isolated, 24 threads, WebGL2, WebGPU) and Creality watcher — ok
  • node test/i18n.mjs — ok; node test/e2e-agent.mjs — relay connected, page reached
  • Not run: CI (the root workflow does not touch desktop/), macOS/Linux packaging.

Happy to split this into smaller PRs (shell alone, then translation, Creality, agent pairing) if that is easier to review.

🤖 Generated with Claude Code

opoeta and others added 2 commits November 1, 2026 14:17
…ity projects and agent pairing

desktop/ wraps the local build in Electron (Windows x64):
- Help → Hardware picks the ANGLE backend (DirectX 11 default, DirectX 12,
  Vulkan, OpenGL) and shows GPU, WebGPU, threads, isolation and WebNN.
- The page is translated at run time from i18n/<lang>.json, node by node,
  and kept translated as React redraws; pt-BR today, first language from
  the OS, Language menu to switch. The app source is not touched.
- Creality Scan project.obp opens from menu, CLI, drop or file picker,
  resolving to result/Mesh.ply; a folder watcher offers each new mesh.
- The app runs the relay itself and writes agent.json; scanruler-mcp.cmd
  next to the exe joins that app so agents drive the open window.
- Tests: smoke (isolation, threads, WebGL2, WebGPU), Creality watcher,
  i18n overlay, agent relay end to end; each on its own user-data dir.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…the title, relay leaves with the app

- i18n: a language is a file in i18n/ (de, es, fr, it, ja, pt-BR, zh-CN);
  each carries _name, _menu and _hw so the native menu and the Hardware
  panel follow the page. First language from the OS locale; English
  fallback. pt-BR reviewed (Extrudar, Contrair/expandir, manipulador…).
  test/dicts.mjs checks every dictionary against the English keys.
- The window title names the graphics API in use (ScanRuler — Vulkan);
  the Hardware panel words its rows from the dictionary.
- agent-bridge.mjs exits when the app's agent.json disappears, so a
  relay started for the app cannot take its port over after it quits;
  the app also closes its HTTP server on quit.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@opoeta

opoeta commented Nov 1, 2026

Copy link
Copy Markdown
Author

Pushed a second commit: dictionaries for de, es, fr, it, ja, pt-BR and zh-CN (each file also carries the shell's menu and Hardware-panel strings; test/dicts.mjs checks them against the English keys), the graphics API shown in the window title, and the relay entry exiting when the app quits so it never takes the app's port over.

electron-builder bundles 7-Zip (LGPL), which CONTRIBUTING.md's dependency
policy does not allow and the licence check cannot see — the same reason
PR CNCKitchen#66 avoids it. scripts/package.mjs stages the shell, copies the web
build, the agent server and the bridge into resources/, and puts
scanruler-mcp.cmd beside the exe, in the same release/win-unpacked layout.
The electron-builder file associations went with it (they only applied
through an installer).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@opoeta

opoeta commented Nov 1, 2026

Copy link
Copy Markdown
Author

Relation to #66 (Mearman's per-platform builds, tray app and installers): the two overlap only in "an Electron window on the local build, paired with the agent relay". #66 is the distribution side — detached background server, tray, installers, CI matrix across six platforms; this one is the feature side — graphics backend choice (DirectX 11/12, Vulkan, OpenGL, shown in the title and in Help → Hardware), run-time translation in seven languages, Creality Scan project.obp, and the agent attached to the open window.

To make them easier to take together I switched this PR to @electron/packager as well (electron-builder's bundled 7-Zip is LGPL — same reasoning as in #66). The features here live in their own modules (settings.js for the GPU switches, i18n.js for the page translation, creality.js for .obp, hardware.html + preload.cjs for the panel), so they can sit on top of #66's electron/main.ts shell with little change. If #66 is the shell you want, I am happy to rebase these onto it as a follow-up rather than keep a second shell.

One behavioural difference worth deciding: #66's background server outlives the window and even the tray's Quit; here the relay ends with the app (the agent entry exits once agent.json is gone), so a closed app never keeps port 7317.

Chromium on Windows hands out no WebGPU adapter under the Vulkan or OpenGL
ANGLE backends, whatever --use-webgpu-adapter asks for (checked on Chromium
156 with every value, Skia-on-Vulkan included). The Hardware panel now says
so in each language instead of a bare "unavailable"; the app draws with
WebGL2 and does not use WebGPU. Dictionaries re-indented uniformly.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant