svrnty-hermes-webui-plugin/static/bte.css
Svrnty 0b19fdd7d0
Some checks failed
plugin-tests / test (push) Failing after 5s
feat(plugin): Adwright + BTE Command Center panels (v0.4.0)
Two new tool panels surfaced inside hermes-webui via inject_script/
inject_stylesheet. Both vanilla JS + CSS, no frameworks, WebUI CSS-vars
only (no hardcoded colors), light/dark inherits free.

## Adwright panel (static/adwright.{js,css} + routes/adwright.py)

5 tabs: Overview · Cycles · Audience · Targeting · Connections.
Layout: 60/40 panel/chat split via CSS :has() selector.
Always-visible, soft-disabled when active profile isn't `cmo*`.

Action wiring (READ path — agent-mediated per governance):
1. Panel button → fires custom event
2. Handler synthesizes /adwright <cmd> chat message
3. Posts via existing btnSend pathway → message visible in chat
4. CMO sees + calls mcp_adwright_<tool>
5. Panel polls /api/adwright/last-panel-update for structured payload
6. Mock payload returned v1; real session-DB reader plugs in when
   adwright-mcp gains writer

Connections WRITE path (governance exception, NO secrets in chat):
- POST /api/adwright/provision-creds with form fields
- Plugin invokes credctl set <key> via stdin (value never on argv)
- Allowlist enforced (defense-in-depth on key names)
- Auth-gated by WebUI session cookie

Skin: .svrnty-aw-* class prefix, window.SvrntyAdwright JS namespace,
guard against double-load, scoped MutationObserver.

## BTE Command Center panel (static/bte.{js,css} + routes/bte_proxy.py)

Content-mode pills (Polished/UGC/Photorealistic/Artistic) × media toggle
(Image/Video — Video disabled v1 pending Phase 4e) × recipe family picker
(Hero Shot/Lifestyle Shot/Photoshoot/Recipe Sheet/Montage Catalog) per
canonical PLANB-RECIPE-TAXONOMY. SKU picker, variant stepper 1-12,
single/batch toggle, [Generate] button.

Asset grid with streaming thumbnails, asset detail (full-res + rate +
comment + "Use in Adwright cycle" deep link). Embedded CMO chat right rail
for re-orienting generations ("make next batch warmer / less white space").

BTE proxy route (/api/bte/proxy) with whitelisted paths
(requestPhotoshoot, assetGrid, recipeStats, assets/{id}/thumb, etc.)
prevents browser-side CORS to BTE :6001.

Skin: .svrnty-bte-* class prefix, window.SvrntyBTE JS namespace.

## Wiring

manifest_version: 0.2.0 → 0.4.0
assets registered:
- /plugins/svrnty/adwright.{js,css} + static/adwright/
- /plugins/svrnty/bte.{js,css} + static/bte/
routes registered:
- GET /api/adwright/last-panel-update (panel update channel)
- POST /api/adwright/provision-creds (governance-exception write)
- GET/POST /api/bte/proxy (BTE REST proxy with allowlist)

Karpathy 4 rules: agents reported every deviation with rationale (Python
venv interp for hermes mcp add, missing aggregate connections-status RPC
composed from two verifies, mock panel-update v1 with locked frontend
protocol so real session-DB reader is a drop-in swap), verified asset
serving + plugin route registration before claiming complete, surfaced
open questions instead of silently choosing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 12:12:27 -04:00

347 lines
10 KiB
CSS

/* ============================================================================
svrnty-bte: BTE Command Center panel — brand asset gen + rate + iterate.
Class prefix .svrnty-bte-* on EVERY selector. CSS vars only (no hex colors).
Loaded after app.css. Skin-agnostic — inherits whatever WebUI vars resolve.
============================================================================ */
/* Local scope tokens (svrnty-bte-only — keep all color values inside :root-like
blocks per app.css convention; downstream selectors reference these vars).
--svrnty-bte-on-accent: text color rendered atop --accent (brand-fixed white).
--svrnty-bte-shadow: elevation shadow (CSS-var-compatible neutral). */
.svrnty-bte-launcher,
.svrnty-bte-overlay {
--svrnty-bte-on-accent: #FFFFFF;
--svrnty-bte-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
/* ── Floating launcher button (lives at bottom-right, always-on) ──────────── */
.svrnty-bte-launcher {
position: fixed;
right: 16px;
bottom: 16px;
z-index: 9990;
display: inline-flex;
align-items: center;
gap: 8px;
padding: 10px 14px;
background: var(--accent);
color: var(--svrnty-bte-on-accent);
border: none;
border-radius: var(--radius-pill, 9999px);
font-family: var(--font-ui, sans-serif);
font-size: 13px;
font-weight: 600;
cursor: pointer;
box-shadow: var(--svrnty-bte-shadow);
}
.svrnty-bte-launcher:hover { background: var(--accent-hover); }
.svrnty-bte-launcher[hidden] { display: none; }
/* ── Full-screen overlay panel ────────────────────────────────────────────── */
.svrnty-bte-overlay {
position: fixed;
inset: 0;
z-index: 9991;
background: var(--bg);
display: grid;
grid-template-rows: auto 1fr;
font-family: var(--font-ui, sans-serif);
color: var(--text);
}
.svrnty-bte-overlay[hidden] { display: none; }
/* ── Top toolbar ──────────────────────────────────────────────────────────── */
.svrnty-bte-toolbar {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 10px 14px;
padding: 10px 16px;
background: var(--sidebar);
border-bottom: 1px solid var(--border);
}
.svrnty-bte-toolbar-title {
font-size: 13px;
font-weight: 600;
color: var(--strong);
margin-right: 4px;
}
.svrnty-bte-toolbar-group {
display: inline-flex;
align-items: center;
gap: 4px;
}
.svrnty-bte-toolbar-label {
font-size: 11px;
color: var(--muted);
margin-right: 4px;
text-transform: uppercase;
letter-spacing: 0.04em;
}
.svrnty-bte-close {
margin-left: auto;
background: none;
border: 1px solid var(--border2);
color: var(--text);
padding: 4px 10px;
border-radius: var(--radius-sm, 8px);
font-size: 12px;
cursor: pointer;
}
.svrnty-bte-close:hover { background: var(--hover-bg); }
/* ── Pills (mode / media / recipe) ────────────────────────────────────────── */
.svrnty-bte-pill {
background: var(--input-bg);
color: var(--text);
border: 1px solid var(--border2);
padding: 5px 12px;
border-radius: var(--radius-pill, 9999px);
font-size: 12px;
font-weight: 500;
cursor: pointer;
transition: background 0.12s;
}
.svrnty-bte-pill:hover:not(:disabled) { background: var(--hover-bg); }
.svrnty-bte-pill[aria-pressed="true"] {
background: var(--accent-bg-strong);
color: var(--accent-text);
border-color: var(--accent);
}
.svrnty-bte-pill:disabled {
opacity: 0.5;
cursor: not-allowed;
}
/* ── Selects + steppers ───────────────────────────────────────────────────── */
.svrnty-bte-select,
.svrnty-bte-stepper {
background: var(--input-bg);
color: var(--text);
border: 1px solid var(--border2);
border-radius: var(--radius-sm, 8px);
padding: 4px 8px;
font-size: 12px;
font-family: inherit;
}
.svrnty-bte-stepper { width: 60px; text-align: center; }
/* ── Generate button ──────────────────────────────────────────────────────── */
.svrnty-bte-generate {
background: var(--accent);
color: var(--svrnty-bte-on-accent);
border: none;
padding: 7px 18px;
border-radius: var(--radius-sm, 8px);
font-size: 13px;
font-weight: 600;
cursor: pointer;
}
.svrnty-bte-generate:hover:not(:disabled) { background: var(--accent-hover); }
.svrnty-bte-generate:disabled {
background: var(--surface);
color: var(--muted);
cursor: not-allowed;
}
/* ── Main pane: grid + right rail ─────────────────────────────────────────── */
.svrnty-bte-body {
display: grid;
grid-template-columns: 1fr 380px;
overflow: hidden;
}
.svrnty-bte-main {
overflow-y: auto;
padding: 16px;
background: var(--main-bg);
}
.svrnty-bte-rail {
border-left: 1px solid var(--border);
background: var(--surface);
overflow-y: auto;
padding: 14px;
display: flex;
flex-direction: column;
gap: 12px;
}
/* ── Status bar / banners ─────────────────────────────────────────────────── */
.svrnty-bte-banner {
padding: 8px 12px;
margin-bottom: 12px;
border-radius: var(--radius-sm, 8px);
font-size: 12px;
border: 1px solid var(--border2);
}
.svrnty-bte-banner-info {
background: var(--accent-bg);
color: var(--text);
border-color: var(--accent);
}
.svrnty-bte-banner-warn {
background: var(--input-bg);
color: var(--warning);
border-color: var(--warning);
}
/* ── Asset grid ───────────────────────────────────────────────────────────── */
.svrnty-bte-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
gap: 12px;
}
.svrnty-bte-card {
background: var(--surface);
border: 1px solid var(--border2);
border-radius: var(--radius-card, 12px);
overflow: hidden;
cursor: pointer;
display: flex;
flex-direction: column;
}
.svrnty-bte-card:hover { border-color: var(--accent); }
.svrnty-bte-card-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--focus-glow); }
.svrnty-bte-card-thumb {
aspect-ratio: 1 / 1;
background: var(--code-bg);
display: flex;
align-items: center;
justify-content: center;
color: var(--muted);
font-size: 11px;
}
.svrnty-bte-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.svrnty-bte-card-meta {
padding: 8px 10px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 6px;
font-size: 11px;
}
.svrnty-bte-status {
padding: 2px 8px;
border-radius: var(--radius-pill, 9999px);
font-size: 10px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.04em;
}
.svrnty-bte-status-generating { background: var(--accent-bg); color: var(--accent-text); }
.svrnty-bte-status-approved { background: var(--input-bg); color: var(--success); }
.svrnty-bte-status-rejected { background: var(--input-bg); color: var(--error); }
.svrnty-bte-status-golden { background: var(--input-bg); color: var(--gold); }
/* ── Rate buttons (on detail view) ────────────────────────────────────────── */
.svrnty-bte-rate-row {
display: flex;
align-items: center;
gap: 6px;
margin-top: 8px;
}
.svrnty-bte-rate-btn {
background: var(--input-bg);
color: var(--text);
border: 1px solid var(--border2);
border-radius: var(--radius-sm, 8px);
padding: 4px 10px;
font-size: 12px;
cursor: pointer;
}
.svrnty-bte-rate-btn:hover { background: var(--hover-bg); }
.svrnty-bte-rate-btn-up:hover { color: var(--success); }
.svrnty-bte-rate-btn-down:hover { color: var(--error); }
/* ── Asset detail view ───────────────────────────────────────────────────── */
.svrnty-bte-detail {
display: grid;
grid-template-columns: 2fr 1fr;
gap: 16px;
margin-top: 16px;
padding: 16px;
background: var(--surface);
border: 1px solid var(--border2);
border-radius: var(--radius-card, 12px);
}
.svrnty-bte-detail-preview {
background: var(--code-bg);
border-radius: var(--radius-sm, 8px);
display: flex;
align-items: center;
justify-content: center;
min-height: 320px;
}
.svrnty-bte-detail-preview img { max-width: 100%; max-height: 480px; }
.svrnty-bte-detail-meta { font-size: 12px; }
.svrnty-bte-detail-meta dt {
color: var(--muted);
font-size: 11px;
margin-top: 8px;
text-transform: uppercase;
letter-spacing: 0.04em;
}
.svrnty-bte-detail-meta dd {
margin: 2px 0 0;
color: var(--text);
}
.svrnty-bte-comment {
width: 100%;
margin-top: 8px;
background: var(--input-bg);
color: var(--text);
border: 1px solid var(--border2);
border-radius: var(--radius-sm, 8px);
padding: 6px 8px;
font-family: inherit;
font-size: 12px;
resize: vertical;
min-height: 60px;
}
/* ── Right rail: embedded CMO chat reference + run status ─────────────────── */
.svrnty-bte-rail-section h4 {
margin: 0 0 6px;
font-size: 12px;
font-weight: 600;
color: var(--strong);
text-transform: uppercase;
letter-spacing: 0.04em;
}
.svrnty-bte-rail-section p {
margin: 0;
font-size: 12px;
color: var(--muted);
line-height: 1.4;
}
.svrnty-bte-cmo-link {
display: inline-block;
margin-top: 6px;
padding: 5px 12px;
background: var(--accent-bg);
color: var(--accent-text);
border: 1px solid var(--accent);
border-radius: var(--radius-sm, 8px);
font-size: 12px;
cursor: pointer;
}
.svrnty-bte-cmo-link:hover { background: var(--accent-bg-strong); }
.svrnty-bte-run-log {
font-family: var(--font-ui, monospace);
font-size: 11px;
color: var(--muted);
background: var(--code-bg);
border-radius: var(--radius-sm, 8px);
padding: 8px;
max-height: 200px;
overflow-y: auto;
white-space: pre-wrap;
}
.svrnty-bte-empty {
text-align: center;
padding: 40px 20px;
color: var(--muted);
font-size: 13px;
}