feat(webui): dashboard-aware chat — Archie sees the page, points you there

The web chat is now a persistent slide-over drawer available on any page
(not just the /chat route), and the agent is told which dashboard page the
operator is on so it can point them to the relevant page with a clickable chip.

Backend (gateway):
- Message gains a per-message Page field; the system prompt renders it in
  the <env> block (Current page), so Archie knows where the operator is.
- New dashboard_tools.go: a DashboardPages registry plus two web-only tools
  — page_index (lists every page and what it shows) and dashboard_navigate
  (validates a path, returns {path,label}; rejects unknown/empty paths).
- The web chat sink emits a dedicated navigate stream event when the model
  calls dashboard_navigate, independent of ShowToolCalls.

Frontend (webui):
- chat sends currentPage() (location.hash) with each stream request; a
  dashboard_navigate result renders as a clickable link chip (href=#/path).
- The chat is mounted once in a slide-over drawer with a topbar launcher,
  scrim and Esc-to-close; /chat opens the drawer instead of a second page.
- ui/dist rebuilt (committed) with the bundled changes.
- .gitignore: ignore .impeccable/ (impeccable tool critique snapshots).

New capability (per scope discipline): designed in
docs/prds/dashboard-aware-chat-navigation.md.

Tests: dashboard_tools_test (registry, resolve/reject, web-only gating),
prompt page-line cases, webui Message.Page + navigate-frame capture, and
chat-tools chip tests. task check is green.
This commit is contained in:
sam committed 2026-08-28 22:28:10 +10:00
1 parent 3ffc4df8d6
commit ea1017af94
21 files changed
+743 -15

No files matched your search

+69
View File
@@ -192,6 +192,75 @@ body {
overflow-x: hidden;
}
/* ── Chat drawer ─────────────────────────────────────────────────────── */
/* The chat is a persistent slide-over, not a route: it is mounted once and
opened from the topbar, so the operator can talk to Archie from any page
without leaving the work that prompted the question. It overlays the
layout rather than replacing it, and the navigation/outlet stay interactive
behind the scrim. */
.chat-drawer {
position: fixed;
inset: var(--sp-4);
display: flex;
align-items: stretch;
justify-content: flex-end;
pointer-events: none;
z-index: 40;
}
.chat-drawer-panel {
pointer-events: auto;
position: relative;
z-index: 1;
display: grid;
grid-template-rows: auto minmax(0, 1fr);
width: min(430px, 100%);
height: 100%;
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
box-shadow: var(--shadow-md);
overflow: hidden;
opacity: 0;
transform: translateX(1.2rem);
transition: opacity var(--transition), transform var(--transition);
}
/* A closed (opacity-0, still mounted) panel must not block the page behind
it: opacity does not disable hit-testing, so without this the invisible
430px panel would make the whole right column unclickable at z-index 40. */
.chat-drawer:not(.is-open) .chat-drawer-panel {
pointer-events: none;
}
.chat-drawer.is-open .chat-drawer-panel {
opacity: 1;
transform: none;
}
.chat-drawer-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--sp-2);
padding: var(--sp-3) var(--sp-4);
border-bottom: 1px solid var(--border);
}
.chat-scrim {
position: fixed;
inset: 0;
background: color-mix(in srgb, var(--bg) 40%, transparent);
opacity: 0;
pointer-events: none;
transition: opacity var(--transition);
}
/* The scrim shows and closes from outside clicks only when the drawer is
open; it is driven by the drawer's own state so it can never be on top of
a closed drawer. */
.chat-drawer.is-open .chat-scrim {
opacity: 1;
pointer-events: auto;
}
body.chat-open {
overflow: hidden;
}
/* ── Constrained desktop ────────────────────────────────────────────────── */
@media (max-width: 1220px) and (min-width: 901px) {