Portal Shared Engine — the ONE place behavior lives
Created 2026-06-03 (Grand Central consolidation). The fix for the disease Sam named: "improvements get built into ONE page and don't propagate." Now there is a single shared layer every portal surface imports, so a fix propagates instead of being hand-copied.
The two shared files (in outputs/)
| File | What it owns | Page uses it via |
|---|---|---|
hs-core.js |
ops-api base URL, inbox(cmd), cards(json), ok(json)/errOf(json), esc(s), peek(sym), plaid(fresh), health(), hebrew(), skin(name) |
<script src="hs-core.js"></script> then call HS.* |
hs-theme.css |
the palette, per audience, as CSS tokens scoped by <body data-skin="sam\|chanie\|mildred\|briefings"> |
<link rel="stylesheet" href="hs-theme.css"> + set data-skin |
HS is a global (window.HS). Load hs-core.js synchronously before a page's inline JS so HS exists when it runs.
Why this kills the drift
- Logic drift (the
response.routed.cardsbug, the always-true.okbug, two differentesc()): fixed once inHS.cards/HS.ok/HS.esc→ every adopter inherits the fix. - Palette drift (warm vs slate vs navy-gold hand-edited per page): one token sheet. To re-skin a page change its
data-skin, not its colors. To tune a palette for everyone on that skin, ediths-theme.cssonce.
Adoption status (migrate incrementally — never a big-bang rewrite)
- ✅ home.html (canonical Sam home) — loads
hs-core.js; delegates base URL +inboxCmd→HS.inbox,esc→HS.esc,W→HS.API. Theme sheet linked but not yet applied (home keeps its own styles until a deliberate re-skin; the sheet is opt-in, so it can't restyle a page that hasn't setdata-skin). - ⬜ chanie-home.html → adopt
HS.*for the thread/queue calls; setdata-skin="chanie", drop its inline palette. - ⬜ mildred.html →
HS.*;data-skin="mildred". - ⬜ family-kiosk.html →
HS.inboxfor GLIST/BOUGHT. - ⬜ briefings.html generator (
scripts/build_index.py) → emitdata-skin="briefings"+ link the sheet.
The rule
When you fix a portal behavior or color, fix it in hs-core.js / hs-theme.css and let pages inherit. Don't hand-edit the same fix into multiple pages — that is the exact thing this engine exists to end. See docs/HOME_DIRECTIVE.md (canonical home = home.html).