CandyCodeWeb
Browser UI for candy-code's server mode
The browser face of CandyCode's WebSocket server mode: a Vite + Vue 3 + TypeScript + Pinia app, built once and committed as dist/, plus a one-class PHP shim that tells candy-code serve where the bundle lives. PHP users get the UI from composer require alone and never need Node. First-party — inspired by the opencode web UI and the OpenClaw Control UI.
Multi-session. Over the candy-code.v1 protocol: a sessions sidebar, a virtualised transcript with tool cards and diffs, permission cards, a composer that queues, steers or interrupts, and a status bar with a changeable permission mode; tabs and a tiled grid of up to nine live sessions; a server-wide approvals drawer; a settings form generated from the server's schema with a diff preview before saving; the Agents (with an agent view to message, pause or cancel a run), Todo, Background, Workflows, Memory, Rules, Catalog, Changes, Files, Context, Generate and Usage panels; a command palette (Ctrl+K); a folder picker for a new session's project directory when the server runs with --allow-dir-browse; and reconnect-and-resume from a gap-free event cursor.
Install
composer require sugarcraft/candy-code-web
Quickstart
candy-code serve
It prints a one-time sign-in URL; open it and the browser UI takes over — users never write a line of PHP. The locator class exists so the server can find the bundle and a distributor can verify a build's identity:
use SugarCraft\CodeWeb\Assets;
$root = Assets::distPath(); // absolute, realpath()-resolved dist/ directory
$manifest = Assets::manifest(); // Vite manifest: 'index.html' => ['file' => 'assets/index-….js', …]
echo Assets::version(), PHP_EOL; // bundle version stamped into dist/build-info.json
How it ships
Developing the UI
cd candy-code-web
npm ci
npm run dev # Vite dev server; proxies /ws and /api to 127.0.0.1:7420
npm run build # rewrites dist/ — commit it with the source change
Source
API
| Class | Method | Description |
|---|---|---|
| Assets | static distPath(): string | Absolute, realpath()-resolved path of the committed bundle; throws RuntimeException when dist/index.html is missing (a broken install) |
| Assets | static tryDistPath(): ?string | Soft probe of the same location: null instead of a throw, for callers that degrade (a UI-less serve keeps the API + WebSocket up) |
| Assets | static manifest(): array | The decoded Vite manifest (dist/manifest.json): source entry => file, css, isEntry |
| Assets | static version(): string | The bundle's release version from dist/build-info.json (package.json is not shipped to Packagist) |
| Assets | static diagnose(string $packageRoot): array | Structured {dist, manifest, version, error} health report for any package root (the directory holding src/ and dist/) — the failure surface of the three above made observable, never an exception |