Commit Graph

6 Commits

Author SHA1 Message Date
Svrnty
b75fbf48ae feat(bte panel): real SKU dropdown + contextual CMO chat handoff
Some checks failed
plugin-tests / test (push) Failing after 6s
upstream-drift / drift (push) Failing after 6s
Tranche C — BTE basics.

1. SKU dropdown now sources from Adwright's TopRecipes (top-selling
   offerings) via /api/adwright/last-panel-update?tool=adwright_list_recipes
   instead of bundled PLACEHOLDER_SKUS. Falls back to placeholders on
   any failure. state.skus drives both the toolbar select build and the
   name lookups in _openCmoChat / requestPhotoshoot. _refreshSkuOptions
   rewrites the <option> set in place so the dropdown updates without
   rebuilding the toolbar.

2. _openCmoChat now pre-fills the chat textarea with the operator's
   current BTE setup (brand, mode, media, recipe family, SKU, variants,
   selected asset) so they don't retype context every iteration.
   Switch + setTimeout(200) lets the chat panel mount before set value
   + dispatch input event. Doesn't auto-send — operator reviews then
   hits send themselves.

C3 (seed assets) closed without code: BTE backend at localhost:6001
already serves 10 real assets (1 evaluated with brandFit 4.2 ★3.8,
2 approved with hasImageData=true, 5 requested). Original "placeholder"
complaint was about the SKU dropdown, not the asset grid.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 18:02:45 -04:00
Svrnty
e9554fa051 fix(bte panel): store BTE-relative thumbUrl so renderer's PROXY_BASE wrap doesn't double-encode
Some checks failed
plugin-tests / test (push) Failing after 6s
Browser console: 'Failed to load resource: ...%252Fb6078c89...%252Fimage:0'.
_refreshGrid normalized thumbUrl as a full proxy URL, then _renderGrid +
_renderDetail wrap it again with PROXY_BASE+encodeURIComponent → %2F →
%252F. Fix: store raw BTE path; let the existing renderer wrap it once.

Karpathy 4 rules: surface root cause (double-wrap, not the encoder),
smallest fix (one expression), surgical (no other shape change).
2026-05-24 14:19:09 -04:00
Svrnty
d61f9e8d3f feat(bte panel): wire grid to live /api/query/assetDtos (replaces 404'd assetGrid)
Some checks failed
plugin-tests / test (push) Failing after 6s
JP question: 'is there any way to see the generated images by the cmo inside the bte panel app'.

The Command Center PRD §5.4 specifies `/api/query/assetGrid` for the grid;
that endpoint isn't implemented yet on BTE. But `/api/query/assetDtos`
WORKS today and returns every brand-scoped asset including the ones CMO
just generated via bte_image_generate (asset ids 664787c4-... + dbe21e15-...).

Changes:
- routes/bte_proxy.py: allowlist /api/query/assetDtos + /api/assets/{id}/image
  (the latter so panel can render real PNG thumbnails — not just /thumb stubs)
- static/bte.js: _refreshGrid now POSTs assetDtos with {pageSize:48, sortBy:createdAt desc}.
  AssetDto rows normalized to panel's existing asset shape (id, thumbUrl,
  lifecycle, scores, prompt, dims). thumbUrl points at the live image bytes
  via the new proxy allowlist entry. _renderGrid stays untouched — same
  shape it expected.

Result: BTE panel grid now shows every Plan B asset including freshly-
generated CMO images. Polling stops when no in-flight renders remain.

When BTE Command Center §5.4 ships the real assetGrid endpoint, swap
the path back — frontend won't need any other change.

Karpathy 4 rules: smallest possible adapter (normalize one shape to another,
no abstraction added), surgical (one new allowlist entry, one function body
rewritten, no other panel logic touched), verified via curl that assetDtos
returns 10 assets including the CMO-generated ones before committing.
2026-05-24 14:15:22 -04:00
Svrnty
69e575ca59 fix(plugin): hide native main-views when our panel active; BTE in-main not full-viewport
Some checks failed
plugin-tests / test (push) Failing after 5s
JP reported (Chrome) after b43e649:
- Sidebar buttons render ✓
- Adwright: useless middle black panel between sidebar and right area
- BTE: entire left sidebar disappears, only close-X recovers it

ROOT CAUSES:
1. webui CSS has `main.main:not(.showing-X):not(.showing-Y)... > #mainChat
   { display:flex }` which still matches when our class is svrnty-showing-*
   (not in webui's whitelist). Chat rendered alongside our panel → the
   empty void = "middle black panel".
2. BTE overlay was `position:fixed; inset:0; z-index:9991` — covered the
   whole viewport including sidebar + topbar.

FIXES:
- Adwright + BTE CSS now `main.main.svrnty-showing-<id> > .main-view
  { display:none !important }` — explicitly hides every native main-view
  (mainChat, mainSkills, mainTasks, ...) when our panel is active.
- BTE.css: overlay no longer position:fixed. Becomes a normal flex child
  of main when svrnty-showing-bte is active. Sidebar + topbar stay visible.
- bte.js: _openOverlay now appends to <main class="main"> instead of
  document.body. Migrates existing body-mounted overlay on first open.

Karpathy 4 rules: root-caused via direct CSS inspection (not guessing),
two-line CSS change per panel, no new abstractions.
2026-05-24 13:05:38 -04:00
Svrnty
80420e0d01 feat(plugin): sidebar nav buttons for Adwright + BTE (v0.5.0)
Some checks failed
plugin-tests / test (push) Failing after 5s
JP feedback: floating BTE launcher + always-visible Adwright panel were
"very fucked up" UX. Replaced with proper hermes-webui sidebar integration.

New static/svrnty_nav.js:
- Injects 2 nav-tab buttons into .sidebar-nav matching the existing
  data-panel + nav-tab + has-tooltip pattern
- Adwright: bullseye icon (marketing intelligence)
- BTE: sparkle/palette icon (creative studio)
- Wraps window.switchPanel to add main.svrnty-showing-{adwright,bte}
  classes so our panels participate in the existing main-view show/hide
  system without editing upstream panels.js
- Dispatches "svrnty:panel-switch" CustomEvent so panel modules can
  lazy-init / open / close based on which panel is active

Adwright panel:
- adwright.css: hidden by default; shows only when main has
  .svrnty-showing-adwright. When showing, occupies full main width
  and hides all other main children (chat etc).
- adwright.js: no change to mount logic (already mounted inside <main>).

BTE panel:
- bte.js: removed _installLauncher (no more floating bottom-right button).
  Init now listens for svrnty:panel-switch events to open/close the
  overlay. Defensively removes any stale .svrnty-bte-launcher DOM nodes
  from prior plugin versions.
- bte.css: launcher styles replaced with display:none !important.

manifest.yaml: bumped 0.4.0 → 0.5.0, svrnty_nav.js added to assets in
the correct load order (after app.js, before adwright.js + bte.js).
CONNECTION-MAP regenerated.

Karpathy 4 rules: no upstream edit, smallest possible wrap of switchPanel
to keep our panels coexisting with native panels (chat, tasks, kanban,
etc), CSS-only visibility (no DOM thrashing).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 12:45:01 -04:00
Svrnty
0b19fdd7d0 feat(plugin): Adwright + BTE Command Center panels (v0.4.0)
Some checks failed
plugin-tests / test (push) Failing after 5s
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