Files
b9f1ca1041 feat(cloud): key/value store, sessions, and route docs on the console
/v1/kv is the store the console has always had a panel for: one key per
org, each write carrying its own revision, over the same cek-opened
SQLite that base and tasks use. clients/session was already in the tree
and is now named in Wire(). The console reads the summary and
description the live document gives a route and shows them above the
runner.

kv resolves its org through principal.Org, the read an untyped handler
uses. The picked version called principal.Tenant, which takes the caller
off a context that a *zip.Ctx handler does not carry, so every org — and
every caller with no principal at all — shared one empty namespace.
kv_test covers a key's life, the org boundary, and the refusal.

Left out of the pick:

  - apps/sandbox: its runtime imports github.com/hanzoai/cloud/apps/k8s,
    a package that exists in no tree, along with authz and the k8s
    client libraries this module does not depend on. Nothing else in the
    commit refers to it.
  - /v1/sql, which ran caller-supplied SQL against base.db with no org
    predicate, over the store whose isolation is that predicate.
  - /v1/graphql, which answered every query with one fixed object and a
    hand-written __schema, and claimed /graphql off the /v1 plane.
  - the exec rewrite, which ran sh -c in this process instead of
    forwarding to the executor, and did so whenever CODE_EXEC_UPSTREAM
    was unset. The executor is the isolation boundary; cloud proxies it.
  - plugin manifest discovery from the working directory: an unset
    manifest mounts nothing, not even introspection, which is what
    TestMountWithoutManifestMountsNothing states.
  - the Hanzo mark, title and links in the console, and the per-subsystem
    docs.hanzo.ai registry behind the doc card. One binary serves
    console.lux.cloud and console.zoo.cloud (HIP-0111), so the brand
    comes from the live document.

(cherry picked from commit 770df24781e82d551f1774f29670430041cce0cd)

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-04 00:02:05 -07:00

350 lines
8.9 KiB
CSS

/* Dev console styling. One palette, expressed as variables, resolved three ways:
the light default, the system preference, and an explicit choice on <html>. */
:root {
--font-sans: "Zen Sans", "Zen Kaku Gothic New", "Zen Maru Gothic", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
--font-mono: "Zen Mono", "Geist Mono", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
--bg: #fafafa;
--panel: #ffffff;
--sunk: #f4f4f5;
--line: #e4e4e7;
--fg: #09090b;
--muted: #71717a;
--accent: #18181b;
--accent-fg: #ffffff;
--ok: #16a34a;
--info: #2563eb;
--warn: #d97706;
--down: #dc2626;
--purple: #7c3aed;
--shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
--bg: #09090b;
--panel: #121215;
--sunk: #18181b;
--line: #27272a;
--fg: #f4f4f5;
--muted: #a1a1aa;
--accent: #ffffff;
--accent-fg: #09090b;
--ok: #22c55e;
--info: #3b82f6;
--warn: #f59e0b;
--down: #ef4444;
--purple: #a855f7;
--shadow: none;
}
}
:root[data-theme="dark"] {
--bg: #09090b;
--panel: #121215;
--sunk: #18181b;
--line: #27272a;
--fg: #f4f4f5;
--muted: #a1a1aa;
--accent: #ffffff;
--accent-fg: #09090b;
--ok: #22c55e;
--info: #3b82f6;
--warn: #f59e0b;
--down: #ef4444;
--purple: #a855f7;
--shadow: none;
}
* { box-sizing: border-box; }
body {
margin: 0;
background: var(--bg);
color: var(--fg);
font: 13px/1.5 var(--font-sans);
-webkit-font-smoothing: antialiased;
}
code, pre, input, textarea, select, .chip, .pill, .route, .out {
font-family: var(--font-mono);
}
/* ---- header ------------------------------------------------------------- */
.bar {
position: sticky;
top: 0;
z-index: 5;
display: flex;
align-items: center;
gap: 10px;
padding: 0 14px;
height: 48px;
background: var(--panel);
border-bottom: 1px solid var(--line);
box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 8px; letter-spacing: -.2px; }
.brand b { font-weight: 600; }
.brand .sub { color: var(--muted); }
.mark {
width: 10px; height: 10px;
background: var(--accent);
border-radius: 2px;
transform: rotate(45deg);
}
.chip {
padding: 2px 7px;
border: 1px solid var(--line);
border-radius: 999px;
color: var(--muted);
font-size: 11px;
white-space: nowrap;
}
.tabs { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; }
.tabs button {
background: none;
border: 0;
border-bottom: 2px solid transparent;
color: var(--muted);
font: inherit;
padding: 6px 10px;
cursor: pointer;
}
.tabs button:hover { color: var(--fg); }
.tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); }
.tabs button.off { opacity: .5; }
/* ---- health strip ------------------------------------------------------- */
.health {
display: flex;
flex-wrap: wrap;
gap: 6px;
padding: 8px 14px;
border-bottom: 1px solid var(--line);
background: var(--panel);
}
.pill {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 2px 9px;
border: 1px solid var(--line);
border-radius: 999px;
font-size: 11px;
color: var(--muted);
background: var(--bg);
}
.pill b { color: var(--fg); font-weight: 500; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.down { background: var(--down); }
/* ---- layout ------------------------------------------------------------- */
main { padding: 14px; }
.view[hidden] { display: none; }
.api {
display: grid;
grid-template-columns: 300px minmax(0, 1fr);
gap: 14px;
align-items: start;
}
.routes, .runner, .panel {
background: var(--panel);
border: 1px solid var(--line);
border-radius: 8px;
padding: 10px;
}
.routes { position: sticky; top: 62px; }
.tree { max-height: calc(100vh - 190px); overflow: auto; margin: 8px -4px 0; }
.count { color: var(--muted); font-size: 11px; padding-top: 8px; border-top: 1px solid var(--line); margin-top: 8px; }
details.group { margin-bottom: 2px; }
details.group > summary {
cursor: pointer;
padding: 4px;
border-radius: 5px;
color: var(--fg);
list-style: none;
}
details.group > summary::-webkit-details-marker { display: none; }
details.group > summary:hover { background: var(--sunk); }
details.group > summary .n { color: var(--muted); font-size: 11px; margin-left: 6px; }
.route {
display: grid;
grid-template-columns: 46px minmax(0, 1fr);
gap: 6px;
align-items: baseline;
width: 100%;
text-align: left;
background: none;
border: 0;
border-radius: 5px;
color: var(--fg);
font: inherit;
padding: 3px 4px;
cursor: pointer;
}
.route:hover { background: var(--sunk); }
.route[aria-current="true"] { background: var(--sunk); box-shadow: inset 2px 0 0 var(--accent); }
.route span.p { overflow-wrap: anywhere; }
.route .arg { color: var(--accent); }
.m { font-size: 10px; font-weight: 600; letter-spacing: .3px; color: var(--muted); }
.m-GET { color: var(--ok); }
.m-POST { color: var(--info); }
.m-PUT { color: var(--warn); }
.m-PATCH { color: var(--purple); }
.m-DELETE { color: var(--down); }
/* ---- documentation card ------------------------------------------------ */
.doc-card {
border: 1px solid var(--line);
border-radius: 8px;
background: var(--panel);
padding: 12px 14px;
margin-bottom: 14px;
display: flex;
flex-direction: column;
gap: 8px;
}
.doc-head {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
}
.doc-title {
font-weight: 600;
font-size: 14px;
color: var(--fg);
}
.doc-pkg {
font-family: var(--font-mono);
font-size: 11px;
color: var(--muted);
background: var(--sunk);
padding: 2px 6px;
border-radius: 4px;
}
.doc-desc {
font-size: 13px;
color: var(--muted);
line-height: 1.4;
margin: 0;
}
/* ---- controls ----------------------------------------------------------- */
.line { display: flex; gap: 8px; align-items: center; }
.line.thin { margin: 12px 0 6px; color: var(--muted); }
.grow { flex: 1; }
input, textarea, select {
background: var(--bg);
color: var(--fg);
border: 1px solid var(--line);
border-radius: 6px;
font: inherit;
padding: 6px 8px;
width: 100%;
}
textarea { resize: vertical; }
select { width: auto; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input.bad { border-color: var(--down); }
button { font: inherit; cursor: pointer; }
.primary {
background: var(--accent);
color: var(--accent-fg);
border: 1px solid var(--accent);
border-radius: 6px;
padding: 6px 14px;
}
.ghost {
background: none;
color: var(--muted);
border: 1px solid var(--line);
border-radius: 6px;
padding: 5px 9px;
}
.ghost:hover:not([disabled]) { color: var(--fg); border-color: var(--muted); }
button[disabled] { opacity: .45; cursor: not-allowed; }
.params { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.params label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.params input { width: 190px; }
details.opt { margin-top: 10px; }
details.opt > summary { cursor: pointer; color: var(--muted); }
details.opt > summary:hover { color: var(--fg); }
details.opt textarea { margin-top: 6px; }
/* ---- results ------------------------------------------------------------ */
.out { margin-top: 12px; }
.out .muted { margin: 0; }
.status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.code {
padding: 2px 8px;
border-radius: 5px;
font-weight: 600;
color: var(--accent-fg);
background: var(--muted);
}
.code.ok { background: var(--ok); }
.code.info { background: var(--info); }
.code.warn { background: var(--warn); }
.code.down { background: var(--down); }
pre {
margin: 0;
padding: 10px;
background: var(--sunk);
border: 1px solid var(--line);
border-radius: 6px;
max-height: 52vh;
overflow: auto;
white-space: pre-wrap;
overflow-wrap: anywhere;
}
.muted { color: var(--muted); }
.note {
margin: 0 0 8px;
padding: 7px 9px;
border-left: 2px solid var(--warn);
background: var(--sunk);
color: var(--muted);
}
/* ---- primitive panels --------------------------------------------------- */
.panel { max-width: 940px; margin: 0 auto 14px; }
.panel h2 { margin: 0 0 2px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.panel h2 code { color: var(--muted); font-weight: 400; font-size: 12px; }
.panel > p { margin: 0 0 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.links { margin-top: 12px; }
.links > summary { cursor: pointer; color: var(--muted); }
.links .route { grid-template-columns: 46px minmax(0, 1fr); }
@media (max-width: 900px) {
.api { grid-template-columns: minmax(0, 1fr); }
.routes { position: static; }
.tree { max-height: 260px; }
.bar { flex-wrap: wrap; height: auto; padding: 8px 12px; }
.tabs { margin-left: 0; width: 100%; }
}