feat(ui): add browser console served by the daemon
CI / Type Check & Lint (push) Successful in 8s
CI / Build Test (Current Platform) (push) Successful in 9s
CI / Build All Platforms (push) Successful in 39s

Introduce a minimal operations console reachable on a dedicated UI port
(default 8081), kept separate from the OpenAI-compatible API port.

- ts_web/ holds the SPA shell (index.html, app.css, vanilla app.js) with
  sidebar navigation for all views from readme.ui.md and a working
  Overview page backed by a new /_ui/overview JSON endpoint.
- scripts/bundle-ui.ts walks ts_web/ and emits ts_bundled/bundle.ts, a
  single generated module exporting every asset as base64. Mirrors the
  @stack.gallery/registry pattern so deno compile binaries embed the
  entire UI with no external filesystem dependency at runtime.
- ts/ui/server.ts (UiServer) serves assets from either the bundled map
  (default, prod) or directly from ts_web/ on disk (dev). The source is
  chosen per-config and can be overridden by UI_ASSET_SOURCE=disk|bundle.
  SPA fallback routes unknown extensionless paths to index.html.
- IModelGridConfig.ui block with enabled/port/host/assetSource defaults;
  config init writes the block, the normalizer fills in defaults on
  load, and the daemon starts/stops the UI server alongside the API.
- deno.json gains a bundle:ui task; compile:all now depends on it so
  released binaries always contain an up-to-date bundle. dev task sets
  UI_ASSET_SOURCE=disk for hot edits.
- ts_bundled/ is gitignored (generated on build).
- test/ui-server.smoke.ts exercises bundle and disk modes end to end
  (index, app.js, SPA fallback, /_ui/overview, 404).
This commit is contained in:
2026-04-21 10:01:44 +00:00
parent 9c9c0c90ae
commit 3b2a16b151
13 changed files with 945 additions and 2 deletions
+187
View File
@@ -0,0 +1,187 @@
:root {
color-scheme: dark;
--bg: #000;
--bg-1: #0b0b0d;
--bg-2: #14141a;
--fg: #e6e6ea;
--fg-dim: #8a8a92;
--border: #23232b;
--accent: #4357d9;
--ok: #2ecc71;
--warn: #f1c40f;
--err: #e74c3c;
}
* { box-sizing: border-box; }
html, body {
margin: 0;
padding: 0;
height: 100%;
background: var(--bg);
color: var(--fg);
font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
font-size: 14px;
}
body {
display: grid;
grid-template-columns: 220px 1fr;
}
a { color: inherit; text-decoration: none; }
.dim { color: var(--fg-dim); }
.nav {
background: var(--bg-1);
border-right: 1px solid var(--border);
display: flex;
flex-direction: column;
height: 100vh;
position: sticky;
top: 0;
}
.nav-brand {
padding: 20px 16px 12px;
font-size: 15px;
font-weight: 600;
letter-spacing: 0.02em;
border-bottom: 1px solid var(--border);
}
.nav-items {
display: flex;
flex-direction: column;
padding: 8px 0;
flex: 1;
overflow-y: auto;
}
.nav-items a {
padding: 8px 16px;
color: var(--fg-dim);
border-left: 2px solid transparent;
transition: color 0.1s, background 0.1s, border-color 0.1s;
}
.nav-items a:hover {
color: var(--fg);
background: var(--bg-2);
}
.nav-items a.active {
color: var(--fg);
background: var(--bg-2);
border-left-color: var(--accent);
}
.nav-footer {
padding: 12px 16px;
border-top: 1px solid var(--border);
font-size: 12px;
}
main {
padding: 24px 32px;
overflow-y: auto;
height: 100vh;
}
h1 {
font-size: 18px;
font-weight: 600;
margin: 0 0 20px;
letter-spacing: 0.01em;
}
.cards {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 12px;
margin-bottom: 24px;
}
.card {
background: var(--bg-1);
border: 1px solid var(--border);
border-radius: 6px;
padding: 16px;
}
.card-label {
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--fg-dim);
margin-bottom: 8px;
}
.card-value {
font-size: 22px;
font-weight: 600;
}
.card-sub {
font-size: 12px;
color: var(--fg-dim);
margin-top: 4px;
}
.status-dot {
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
margin-right: 6px;
vertical-align: middle;
}
.status-dot.ok { background: var(--ok); }
.status-dot.warn{ background: var(--warn); }
.status-dot.err { background: var(--err); }
table {
width: 100%;
border-collapse: collapse;
background: var(--bg-1);
border: 1px solid var(--border);
border-radius: 6px;
overflow: hidden;
}
th, td {
text-align: left;
padding: 10px 14px;
border-bottom: 1px solid var(--border);
font-weight: normal;
}
th {
color: var(--fg-dim);
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.08em;
background: var(--bg-2);
}
tr:last-child td { border-bottom: none; }
.placeholder {
padding: 40px;
text-align: center;
color: var(--fg-dim);
background: var(--bg-1);
border: 1px dashed var(--border);
border-radius: 6px;
}
.error {
background: var(--bg-1);
border: 1px solid var(--err);
color: var(--err);
padding: 12px 16px;
border-radius: 6px;
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
font-size: 12px;
}