All verification complete. Final report: **Phase 85 final verification pass — all green** (tasks 01–03 already complete; independently re-verified from scratch) - Verified fix in tree: `styles.css` `.auth-gate` z-index 500→15 + rewritten stacking comment (no `z-index: 500` left); `index.html`/`document.html` comment-only; `token-gate.js` docstring-only (logic byte-identical); `test_mobile_hamburger_nav.py` real-click conversion + new `test_anonymous_toggle_tappable_with_gate_up`; new `tests/unit/test_gate_header_stacking.py` (3 pins); `test_api_tokens.py` untouched - `uv run pytest` → 1717 passed, 1 warning (exit 0) - `uv run pytest --cov=app --cov-report=term-missing` → TOTAL **99%** (>90%) - E2E in isolation: `test_mobile_hamburger_nav.py` **8 passed**; `test_api_tokens.py` **9 passed** (unchanged); `test_smoke.py` **3 passed**; `test_document_viewer.py` **7 passed** - `uv run ruff check . && uv run pyright` → clean / 0 errors - Live probe (375×812, anonymous, fresh server): on `/` and `/history.html` `elementFromPoint` at toggle → SVG `path`, never `#auth-gate`; real click opens menu (`aria-expanded=true`); exactly one visible nav link (Chat) + sign-in copy; Chat link topmost over gate; `#main` inert — criteria 1, 2, 3 confirmed directly - Criteria: (1) real-click menu on / + /history ✅ (2) dropdown above gate ✅ (3) anonymous contents + #main inert ✅ (4) admin byte-identical (phase-46 tests green) ✅ (5) doc-viewer gate under bar (CSS pin + doc-viewer suite) ✅ (6) full gate green ✅ (7) diff scoped to the 5 code files + new unit test + phase files, nothing in `app/` ✅ (8) commit + todo→complete move left to harness per executor rules (task files already in `complete/`) - Note: `.agents/remediation_plan.md` (untracked) is a pre-existing artifact of the earlier security audit — left untouched; a missing "N passed" line seen mid-pass was my own `-q`+addopts `-q` = `-qq` quirk, not a defect - Next pending phase: `86_history_page_width`
216 lines
13 KiB
HTML
216 lines
13 KiB
HTML
<!doctype html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||
<meta name="description" content="Read a document indexed in Brain of Reese.">
|
||
<title>Document · Brain of Reese</title>
|
||
<link rel="icon" type="image/svg+xml" href="/assets/favicon.svg">
|
||
<link rel="stylesheet" href="/assets/styles.css">
|
||
</head>
|
||
<body>
|
||
<a class="skip-link" href="#main">Skip to content</a>
|
||
|
||
<!-- Phase 34 (owner confirmation 2026-08-26): the viewer carries the
|
||
SAME standard bar as every other page — row 1 is the shared
|
||
.app-header / .header-inner block (byte-identical controls), and
|
||
the back link + title + meta survive in a second .doc-titlebar
|
||
row inside the same <header> (the phase-19 single-row viewer bar
|
||
is superseded — this phase records the revision, PLAN.md §7.1
|
||
unchanged). No nav link is "current" here: a document is a
|
||
detail view reachable from chat or Sources, and the phase-13
|
||
back link carries the return affordance. -->
|
||
<header class="doc-header">
|
||
<div class="app-header">
|
||
<div class="container header-inner">
|
||
<span class="brand">
|
||
<svg class="brand-mark" aria-hidden="true" viewBox="0 0 64 64"><path d="M32 4 55 18v28L32 60 9 46V18Z" fill="#1a0f0f" stroke="#f43f5e" stroke-width="4" stroke-linejoin="round"/><circle cx="32" cy="32" r="6.5" fill="#f43f5e"/><path d="M32 25.5V16M32 48v-9.5M25.5 32H16M48 32h-9.5" stroke="#fca5a5" stroke-width="3" stroke-linecap="round"/></svg>
|
||
<span class="brand-text">Brain of <strong>Reese</strong></span>
|
||
</span>
|
||
<!-- Phase 46 (owner permission 2026-08-27, `TODO.md` L9): the
|
||
mobile hamburger — visible ≤640px only (CSS); opens the nav as
|
||
an animated dropdown. Behavior: assets/header.js. -->
|
||
<button type="button" class="nav-toggle" id="nav-toggle"
|
||
aria-expanded="false" aria-controls="app-nav" aria-label="Menu">
|
||
<svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"><path d="M4 7h16M4 12h16M4 17h16"/></svg>
|
||
</button>
|
||
<nav class="app-nav" id="app-nav" aria-label="Primary">
|
||
<a href="/" class="nav-link">Chat</a>
|
||
<!-- Phase 19 (now every page — phase 34, owner confirmation
|
||
2026-08-26): the Sources link is admin-only (owner
|
||
permission 2026-08-23) — hidden by default, header.js
|
||
reveals it once whoami says admin. The soft-gated page
|
||
itself is unchanged. -->
|
||
<a href="/sources.html" class="nav-link" id="nav-sources" hidden>RAG</a>
|
||
<!-- Phase 35 (owner permission 2026-08-26): the Git sources
|
||
link is admin-only — hidden by default, header.js
|
||
reveals it once whoami says admin, exactly like the
|
||
Sources link above. -->
|
||
<a href="/git-sources.html" class="nav-link" id="nav-git-sources" hidden>Sources</a>
|
||
<!-- Phase 29 (now every page — phase 34, owner confirmation
|
||
2026-08-26): the Global Tuning link is admin-only (owner
|
||
permission 2026-08-25) — hidden by default, header.js
|
||
reveals it once whoami says admin, exactly like the
|
||
Sources link above. -->
|
||
<a href="/tuning.html" class="nav-link" id="nav-tuning" hidden>Tuning</a>
|
||
<!-- Phase 50 (owner permission 2026-08-29, `TODO.md` L5): the
|
||
History link is admin-only — hidden by default, header.js
|
||
reveals it once whoami says admin, exactly like the
|
||
Tuning link above. -->
|
||
<a href="/history.html" class="nav-link" id="nav-history" hidden>History</a>
|
||
<!-- Phase 79 (task 06): the Tokens link is admin-only —
|
||
hidden by default, header.js reveals it once whoami says
|
||
admin, exactly like the History link above (the
|
||
phase-34 one-bar contract: the SAME nav ships on every
|
||
page — test_nav_consistency pins the inventory parity).
|
||
Null-safe: header.js is a no-op on a page without it. -->
|
||
<a href="/tokens.html" class="nav-link" id="nav-tokens" hidden>Tokens</a>
|
||
<!-- Phase 46 (mobile dropdown copy: sign-in — desktop bar copy is
|
||
outside the nav; see styles.css .sign-in-mobile rules). -->
|
||
<a href="/login.html?next=/" class="auth-link sign-in-link sign-in-mobile" id="sign-in-link-mobile" hidden>
|
||
<svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M10 4h8a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-8"/><path d="M4 12h11"/><path d="m12 9 3 3-3 3"/></svg>
|
||
<span class="auth-label">Sign in</span>
|
||
</a>
|
||
<!-- Phase 46 (mobile dropdown copy — desktop bar copy is
|
||
outside the nav; see styles.css .sign-out-mobile rules). -->
|
||
<button type="button" class="auth-link sign-out-btn sign-out-mobile" id="sign-out-btn-mobile" aria-label="Sign out" hidden>
|
||
<svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M14 4H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8"/><path d="M9 12h11"/><path d="m17 9 3 3-3 3"/></svg>
|
||
<span class="auth-label">Sign out</span>
|
||
</button>
|
||
</nav>
|
||
<!-- Phase 15: the tuning-notes panel (stored in Postgres, read
|
||
into every system prompt) — owned by the shared header
|
||
module (assets/header.js); the #steering-panel section
|
||
ships in every page's <main>. The navbar toggle was
|
||
removed at owner request (2026-08-28): note management
|
||
lives on /tuning.html. -->
|
||
<!-- Phase 16: single-admin auth — exactly one of Sign in / Sign
|
||
out is visible; /api/whoami decides at load (the shared
|
||
header module). Icon-only below 640px (aria-labels keep the
|
||
accessible names). -->
|
||
<a href="/login.html?next=/document.html" class="auth-link sign-in-link" id="sign-in-link" hidden>
|
||
<svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M10 4h8a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-8"/><path d="M4 12h11"/><path d="m12 9 3 3-3 3"/></svg>
|
||
<span class="auth-label">Sign in</span>
|
||
</a>
|
||
<button type="button" class="auth-link sign-out-btn" id="sign-out-btn" aria-label="Sign out" hidden>
|
||
<svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M14 4H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8"/><path d="M9 12h11"/><path d="m17 9 3 3-3 3"/></svg>
|
||
<span class="auth-label">Sign out</span>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<!-- Row 2: the viewer titlebar — the phase-10 back link + title +
|
||
meta row, markup otherwise unchanged (document.js addresses
|
||
them by id). -->
|
||
<div class="doc-titlebar">
|
||
<div class="container">
|
||
<a class="doc-back" id="doc-back" href="/sources.html">
|
||
<svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M19 12H5"/><path d="m12 19-7-7 7-7"/></svg>
|
||
<span>Sources</span>
|
||
</a>
|
||
<div class="doc-title-block">
|
||
<h1 id="doc-title">Loading…</h1>
|
||
<div id="doc-meta" class="doc-meta"></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</header>
|
||
|
||
<main id="main" class="app-main" tabindex="-1">
|
||
<!-- Phase 15 (now every page — phase 34, owner confirmation
|
||
2026-08-26): the tuning-notes panel (stored notes, newest
|
||
first) — rendered + driven by assets/header.js (shared), not
|
||
the page script. First child of <main> on the non-chat pages;
|
||
the chat page keeps it after #kb-banner. -->
|
||
<section class="steering-panel" id="steering-panel" role="region"
|
||
aria-label="Tuning notes" hidden>
|
||
<div class="steering-panel-head">
|
||
<h2 class="steering-panel-title">Tuning notes</h2>
|
||
<p class="steering-panel-sub">Every note below steers all future answers.</p>
|
||
</div>
|
||
<ul class="steering-list" id="steering-list"></ul>
|
||
<p class="steering-empty" id="steering-empty">No tuning notes yet — press “Tune” under any answer to add one.</p>
|
||
</section>
|
||
<p class="visually-hidden" id="steering-announcer" role="status" aria-live="polite" aria-atomic="true"></p>
|
||
<!-- aria-live wraps the load → content swap so screen readers hear the
|
||
document land (phase 10 a11y contract). -->
|
||
<div class="container doc-shell" aria-live="polite">
|
||
<div id="doc-content">
|
||
<p class="doc-loading" role="status">Loading document…</p>
|
||
</div>
|
||
|
||
<div class="doc-not-found" id="doc-not-found" hidden>
|
||
<div class="doc-not-found-glyph" aria-hidden="true">
|
||
<svg viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"><path d="M12 4h16l8 8v28a4 4 0 0 1-4 4H12a4 4 0 0 1-4-4V8a4 4 0 0 1 4-4Z"/><path d="M28 4v8h8"/><path d="m19 22 10 10M29 22l-10 10"/></svg>
|
||
</div>
|
||
<h2>Document not found</h2>
|
||
<p class="doc-not-found-sub">
|
||
This document isn't in the knowledge base — it may have been removed
|
||
from the index, or the notes were re-imported.
|
||
</p>
|
||
<a class="doc-open-sources" href="/sources.html">Open Sources</a>
|
||
</div>
|
||
</div>
|
||
</main>
|
||
|
||
<!-- Phase 79 (task 05): the viewer's inline token gate — the SAME
|
||
gate markup as the shell (frontend/index.html #auth-gate), the
|
||
ids renamed (#doc-auth-gate …). The content endpoint is now
|
||
require_user-gated (phase 79 task 03): a direct anonymous URL
|
||
shows THIS gate instead of a content error (the page document
|
||
loads; the GATED DATA does not). assets/token-gate.js (loaded
|
||
through document.js's import) mounts it with #main as the lock
|
||
root; the existing boot sequence (whoami → load content) runs
|
||
as onAuthed — an admin (or a validly cached token user) gets
|
||
it immediately, the gate never shows. SHIPS hidden + inert
|
||
(the phase-16 ship-hidden pattern). Phase 85 (TODO.md L3):
|
||
same stacking as the shell gate — the overlay (z-index 15)
|
||
sits below the viewer's sticky bar (20), so the hamburger +
|
||
menu stay reachable while #main stays inert-locked. -->
|
||
<section class="auth-gate" id="doc-auth-gate" hidden inert aria-labelledby="doc-auth-gate-title">
|
||
<div class="auth-gate-card">
|
||
<div class="auth-gate-glyph" aria-hidden="true">
|
||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="10" width="16" height="10" rx="2"/><path d="M8 10V7a4 4 0 0 1 8 0v3"/><circle cx="12" cy="14.5" r="1.4" fill="currentColor" stroke="none"/><path d="M12 16v2"/></svg>
|
||
</div>
|
||
<h2 id="doc-auth-gate-title">Enter your access token</h2>
|
||
<p class="auth-gate-sub">
|
||
Ask the admin for a token — it opens chat, the answers, and the
|
||
documents they cite. Shared chats stay open.
|
||
</p>
|
||
<form id="doc-auth-gate-form">
|
||
<label class="visually-hidden" for="doc-auth-gate-input">Access token</label>
|
||
<input
|
||
id="doc-auth-gate-input"
|
||
name="token"
|
||
type="text"
|
||
autocomplete="off"
|
||
autocapitalize="none"
|
||
spellcheck="false"
|
||
placeholder="bor_…"
|
||
required
|
||
>
|
||
<button type="submit" class="auth-gate-submit">Sign in</button>
|
||
</form>
|
||
<p class="auth-gate-error" id="doc-auth-gate-error" role="alert" hidden>
|
||
That token isn’t valid — check it with the admin.
|
||
</p>
|
||
<a class="sources-gate-link" href="/login.html?next=/">Sign in as admin</a>
|
||
</div>
|
||
</section>
|
||
|
||
<footer class="app-footer">
|
||
<div class="container footer-inner">
|
||
<span class="footer-text">Powered by self-hosted models</span>
|
||
</div>
|
||
</footer>
|
||
|
||
<!-- Phase 39: the brand layer — classic script, first on the page:
|
||
window.BOR_BRAND at parse time, refreshed from /api/config. -->
|
||
<script src="assets/brand.js"></script>
|
||
<script src="assets/markdown.js"></script>
|
||
<!-- Phase 19: the shared header module loads through the page script's
|
||
own `import "./header.js"` — a hoisted import that is evaluated
|
||
before the page script body calls initSharedHeader() at boot. -->
|
||
<script type="module" src="assets/document.js"></script>
|
||
</body>
|
||
</html>
|