From 56d83186ae524c3ae5786294292ab0c459d6253d Mon Sep 17 00:00:00 2001 From: Eric Law <39393654+acn-ericlaw@users.noreply.github.com> Date: Thu, 19 Nov 2026 17:47:37 +0800 Subject: [PATCH 1/3] feat(agent-question): the page separates what waits from the history - a sticky header, a waiting section and a scrollable History panel In lockstep with the Node pack, the generated page byte-identical. The React UI that follows is built in the Node pack only; the README points there. Co-Authored-By: Claude Fable 5.1 --- CHANGELOG.md | 10 +++++- extensions/agent-question/README.md | 8 ++++- extensions/agent-question/agent_question.py | 37 +++++++++++++++------ memory/continuity.md | 4 +++ memory/sessions/2026-11-19-094736.md | 25 ++++++++++++++ tests/test_agent_question.py | 4 ++- 6 files changed, 75 insertions(+), 13 deletions(-) create mode 100644 memory/sessions/2026-11-19-094736.md diff --git a/CHANGELOG.md b/CHANGELOG.md index ebd3ef0..2361491 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -155,7 +155,15 @@ ### Changed -1. **`web.crawl` accepts a relative `include`.** A prefix that does not start with `/` now matches anywhere in a link's path, +1. **The agent-question page separates what waits from the history (Eric, 2026-11-19).** A sticky header carries the + person's name and the count of open cards (also in the tab's title); *Waiting for you* lists the cases with an open + card - a wait to decide or an advice to read - newest activity first; *History* is a scrollable panel with the closed + cases, newest first, that keeps its scroll position while new cards arrive, so the whole inbox stays in reach without + pushing the open work away. The page is one vanilla HTML file still, byte-identical in the Node.js twin. Its successor, + a small React app, is on the Node.js pack's backlog (Eric: one app to maintain in one place, mercury-nodejs + `extensions/agent-question`); this pack will point to it and keep the vanilla page as the fallback. + +2. **`web.crawl` accepts a relative `include`.** A prefix that does not start with `/` now matches anywhere in a link's path, since a model names a section as `guides/` as often as `/guides/`: the live drive of the Playground's `site-notes` graph showed a crawl returning the start page alone because the model's `include` was relative. The README's Event-over-HTTP example lists one route per entry - the engines' map takes no comma-separated list. diff --git a/extensions/agent-question/README.md b/extensions/agent-question/README.md index f7cf6e3..9524db2 100644 --- a/extensions/agent-question/README.md +++ b/extensions/agent-question/README.md @@ -10,7 +10,9 @@ application is one of those routes. It is a standalone application on the packag wait (`kind` `approval` or `question`) is **upserted** on `(graph_id, correlation_id, turn)` - a re-advice for the same turn updates the card rather than adding one - and an **advice** (a status update, an acknowledgement, an outcome) is **appended**, since those accumulate. Write first: the row is committed before any push to a browser. -- **The person's side**, under the pack's host: `GET /questions/app` is the page; `GET /questions?since=` the +- **The person's side**, under the pack's host: `GET /questions/app` is the page - a sticky header with the person's + name and the count of open cards, the cases that wait for a decision or a look first, and the closed cases in a + scrollable History panel that keeps its place while new cards arrive; `GET /questions?since=` the **replay** a reconnecting device calls first - every row that changed since its cursor, waits and advices alike, with the cursor to continue from; `GET /questions/events` the **stream** a connected device holds, each event carrying a changed row, `Last-Event-ID` the same cursor, so a browser's reconnect misses nothing. The person selects which card @@ -25,6 +27,10 @@ application is one of those routes. It is a standalone application on the packag never overwrites it (the live drive of 2026-11-19). Rows are never deleted here; `schema/purge.sql` is the installation's. +A richer person's side - a small React app over the same three endpoints and the same stream - is planned in the +Node.js pack only, so there is one app to maintain in one place (Eric, 2026-11-19): use it from mercury-nodejs +`extensions/agent-question` against this app's inbox when it lands; the vanilla page here stays as the fallback. + The Node.js twin (mercury-nodejs `extensions/agent-question`) serves the same route, the same page and the same schema, pinned by the same vector file. diff --git a/extensions/agent-question/agent_question.py b/extensions/agent-question/agent_question.py index 13e9462..e3011b9 100644 --- a/extensions/agent-question/agent_question.py +++ b/extensions/agent-question/agent_question.py @@ -1006,6 +1006,7 @@ async def mark_seen(request: web.Request) -> web.Response: "textarea,input[type=text]{width:100%;box-sizing:border-box;margin:.2rem 0}button{padding:.4rem 1rem;border-radius:6px;" "border:1px solid #556;background:#fff;cursor:pointer}button.primary{background:#1f2a44;color:#fff}" ".outcome{font-size:.85rem;color:#334;margin-top:.4rem}.empty{color:#667;padding:2rem;text-align:center}" + "header{position:sticky;top:0;z-index:2}.section{display:flex;align-items:center;gap:.5rem;font-size:.95rem;color:#445;margin:1.2rem 0 .4rem}.count{background:#e0a800;color:#222;border-radius:999px;padding:0 .5rem;font-size:.8rem;min-width:1.2rem;text-align:center}.count:empty{display:none}#history-section .count{background:#dde;color:#334}.panel{max-height:45vh;overflow-y:auto;border:1px solid #dde;border-radius:10px;background:#fafbfc;padding:0 .8rem}.panel .case{margin:.6rem 0}" ) SCRIPT = r""" @@ -1054,17 +1055,29 @@ async def mark_seen(request: web.Request) -> web.Response: } return body + ''; } +function caseHtml(list) { + list.sort((a, b) => a.seq - b.seq); + const first = list[0]; + return '

' + esc(first.description) + '

' + esc(first.graph_id) + ' · ' + esc(first.correlation_id) + '
' + list.map(card).join('') + '
'; +} function render() { - const main = document.getElementById('cases'); - if (!rows.size) { main.innerHTML = '
Nothing waits for you.
'; return; } + // what waits for the person first - every case with an open card - and the closed cases in the history panel, + // newest activity first on both sides; the panel keeps its scroll position across updates + const waiting = document.getElementById('cases'), history = document.getElementById('history'); const groups = new Map(); for (const r of rows.values()) { const key = r.graph_id + '\u0000' + r.correlation_id; if (!groups.has(key)) groups.set(key, []); groups.get(key).push(r); } - const ordered = [...groups.entries()].sort((a, b) => Math.max(...b[1].map(r => r.seq)) - Math.max(...a[1].map(r => r.seq))); - main.innerHTML = ordered.map(([key, list]) => { - list.sort((a, b) => a.seq - b.seq); - const first = list[0]; - return '

' + esc(first.description) + '

' + esc(first.graph_id) + ' · ' + esc(first.correlation_id) + '
' + list.map(card).join('') + '
'; - }).join(''); + const newest = (list) => Math.max(...list.map(r => r.seq)); + const ordered = [...groups.values()].sort((a, b) => newest(b) - newest(a)); + const open = ordered.filter(list => list.some(r => r.state === 'open')); + const closed = ordered.filter(list => !list.some(r => r.state === 'open')); + const openCards = open.reduce((n, list) => n + list.filter(r => r.state === 'open').length, 0); + document.getElementById('waiting-count').textContent = openCards ? String(openCards) : ''; + document.getElementById('history-count').textContent = closed.length ? String(closed.length) : ''; + document.title = (openCards ? '(' + openCards + ') ' : '') + TITLE; + waiting.innerHTML = open.length ? open.map(caseHtml).join('') : '
Nothing waits for you.
'; + const keep = history.scrollTop; + history.innerHTML = closed.length ? closed.map(caseHtml).join('') : '
Nothing yet.
'; + history.scrollTop = keep; } document.getElementById('cases').addEventListener('click', async (ev) => { const seen = ev.target.closest('button[data-seen]'); @@ -1102,8 +1115,12 @@ def page(title: str) -> str: f"{html.escape(title)}\n\n\n\n" f"

{html.escape(title)}

connecting...
\n" - "
Loading...
\n" - f"\n" + "

Waiting for you

Loading...
\n" + "

History " + "

Loading...
\n" + f"\n" "\n\n" ) diff --git a/memory/continuity.md b/memory/continuity.md index c802d7f..405f700 100644 --- a/memory/continuity.md +++ b/memory/continuity.md @@ -285,6 +285,10 @@ never deleted by the app; a new card state is a change to `state_after` and the schema's check constraint in both packs; a wait decided elsewhere stays open on a card until a device tries it (410 → expired) or it expires - the acknowledgement advice beside it tells the person. + **The person's side (Eric, 2026-11-19):** the page is one vanilla file, byte-identical in both packs - since 2026-11-19 + a sticky header with the count of open cards, *Waiting for you* and a scrollable *History* panel; its successor, a + small React app, is built and maintained in the Node pack only (mercury-nodejs thread `agent-question-react-ui`) for + both packs' inboxes, and this pack points to it - never a second UI here. ## Conventions diff --git a/memory/sessions/2026-11-19-094736.md b/memory/sessions/2026-11-19-094736.md new file mode 100644 index 0000000..ed9bf92 --- /dev/null +++ b/memory/sessions/2026-11-19-094736.md @@ -0,0 +1,25 @@ +# Session (2026-11-19T09:47:36.000Z) + +**Agent:** Claude Code +**Title:** The agent-question page separates what waits from the history; the React UI lives in the Node pack +**User:** Eric - "The agent-question UI is a bit primitive. Please add a backlog to upgrade it to a small React app ... Could you allow the user to scroll the panel to see history?" and "putting it only in the mercury-nodejs language pack so there is one app to maintain in one place. Add a reference pointer in the mercury-python repo". + +## What We Did + +- **The page** (`extensions/agent-question/agent_question.py`; the Node twin's generated page is byte-identical): a + sticky header with the person's name and the count of open cards (also in the tab's title); *Waiting for you* lists + the cases with an open card - a wait to decide or an advice to read - newest activity first; *History* is a scrollable + panel (45vh) with the closed cases, newest first, that keeps its scroll position across the re-render every event + causes. Checked under a minimal DOM shim run on Node: two open cards and one closed case from five rows landed where + they belong, the title read "(2) Agent questions", the panel's scroll position survived a render. +- **The React UI is the Node pack's** (Eric's ruling: one app to maintain in one place): the backlog thread is + mercury-nodejs `agent-question-react-ui`; this pack's README and CHANGELOG point there, the fact + [[agent-question-app]] records the rule - never a second UI here - and the vanilla page stays as the fallback. +- **Gates:** ruff OK, basedpyright 0 errors, the agent-question suite 48 passed (the page test now checks the two + sections). CHANGELOG Unreleased/Changed 1; README. + +## Memory References + +- Referenced: agent-question-app (edited: the person's side and the React UI's home) +- Created: (none) +- Superseded: (none) diff --git a/tests/test_agent_question.py b/tests/test_agent_question.py index b4b1eb8..333a008 100644 --- a/tests/test_agent_question.py +++ b/tests/test_agent_question.py @@ -338,7 +338,9 @@ async def test_the_replay_lists_every_change_since_the_cursor( async with http.get(f"{host}/questions?since=x") as response: assert response.status == 400 async with http.get(f"{host}/questions/app") as response: - assert response.status == 200 and "Agent questions" in await response.text() + text = await response.text() + assert response.status == 200 and "Agent questions" in text + assert 'id="history"' in text and "Waiting for you" in text, "the page separates what waits from the history" async def test_the_stream_replays_then_follows_the_changes_with_keep_alives( From 375c2a6a88d451d3cf459f5f1fb18a395c06c05d Mon Sep 17 00:00:00 2001 From: Eric Law <39393654+acn-ericlaw@users.noreply.github.com> Date: Thu, 19 Nov 2026 17:47:48 +0800 Subject: [PATCH 2/3] memory: the history panel opened as PR #72 Co-Authored-By: Claude Fable 5.1 --- memory/sessions/2026-11-19-094736.md | 1 + 1 file changed, 1 insertion(+) diff --git a/memory/sessions/2026-11-19-094736.md b/memory/sessions/2026-11-19-094736.md index ed9bf92..78091f0 100644 --- a/memory/sessions/2026-11-19-094736.md +++ b/memory/sessions/2026-11-19-094736.md @@ -17,6 +17,7 @@ [[agent-question-app]] records the rule - never a second UI here - and the vanilla page stays as the fallback. - **Gates:** ruff OK, basedpyright 0 errors, the agent-question suite 48 passed (the page test now checks the two sections). CHANGELOG Unreleased/Changed 1; README. +- Opened as PR #72. ## Memory References From d4fa3f4483791b6660669340ded3fafef003b50b Mon Sep 17 00:00:00 2001 From: Eric Law <39393654+acn-ericlaw@users.noreply.github.com> Date: Thu, 19 Nov 2026 17:49:01 +0800 Subject: [PATCH 3/3] docs(agent-question): the app is the backend in both packs, the React UI the one front-end (Eric) Co-Authored-By: Claude Fable 5.1 --- CHANGELOG.md | 8 +++++--- extensions/agent-question/README.md | 7 ++++--- memory/continuity.md | 7 ++++--- memory/sessions/2026-11-19-094736.md | 7 ++++--- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2361491..1a6fb52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -159,9 +159,11 @@ person's name and the count of open cards (also in the tab's title); *Waiting for you* lists the cases with an open card - a wait to decide or an advice to read - newest activity first; *History* is a scrollable panel with the closed cases, newest first, that keeps its scroll position while new cards arrive, so the whole inbox stays in reach without - pushing the open work away. The page is one vanilla HTML file still, byte-identical in the Node.js twin. Its successor, - a small React app, is on the Node.js pack's backlog (Eric: one app to maintain in one place, mercury-nodejs - `extensions/agent-question`); this pack will point to it and keep the vanilla page as the fallback. + pushing the open work away. The page is one vanilla HTML file still, byte-identical in the Node.js twin. The + agent-question app of each pack is the backend - the inbox, the endpoints, the stream - and the front-end that will + replace this page, a small React app pointed at either backend, is on the Node.js pack's backlog (Eric: one front-end + to maintain in one place, mercury-nodejs `extensions/agent-question`); this pack points to it and keeps the vanilla + page as the fallback. 2. **`web.crawl` accepts a relative `include`.** A prefix that does not start with `/` now matches anywhere in a link's path, since a model names a section as `guides/` as often as `/guides/`: the live drive of the Playground's `site-notes` graph diff --git a/extensions/agent-question/README.md b/extensions/agent-question/README.md index 9524db2..6b586e4 100644 --- a/extensions/agent-question/README.md +++ b/extensions/agent-question/README.md @@ -27,9 +27,10 @@ application is one of those routes. It is a standalone application on the packag never overwrites it (the live drive of 2026-11-19). Rows are never deleted here; `schema/purge.sql` is the installation's. -A richer person's side - a small React app over the same three endpoints and the same stream - is planned in the -Node.js pack only, so there is one app to maintain in one place (Eric, 2026-11-19): use it from mercury-nodejs -`extensions/agent-question` against this app's inbox when it lands; the vanilla page here stays as the fallback. +This app is the backend - the inbox, the endpoints, the stream; the page is its vanilla front-end. The front-end that +will replace it, a small React app pointed at either pack's backend, is built and maintained in the Node.js pack only, so +there is one app to maintain in one place (Eric, 2026-11-19): use it from mercury-nodejs `extensions/agent-question` +against this backend when it lands; the vanilla page here stays as the fallback. The Node.js twin (mercury-nodejs `extensions/agent-question`) serves the same route, the same page and the same schema, pinned by the same vector file. diff --git a/memory/continuity.md b/memory/continuity.md index 405f700..63c1bf0 100644 --- a/memory/continuity.md +++ b/memory/continuity.md @@ -286,9 +286,10 @@ packs; a wait decided elsewhere stays open on a card until a device tries it (410 → expired) or it expires - the acknowledgement advice beside it tells the person. **The person's side (Eric, 2026-11-19):** the page is one vanilla file, byte-identical in both packs - since 2026-11-19 - a sticky header with the count of open cards, *Waiting for you* and a scrollable *History* panel; its successor, a - small React app, is built and maintained in the Node pack only (mercury-nodejs thread `agent-question-react-ui`) for - both packs' inboxes, and this pack points to it - never a second UI here. + a sticky header with the count of open cards, *Waiting for you* and a scrollable *History* panel. This app is the + backend in both packs; the front-end that replaces the page, a small React app pointed at either backend, is built and + maintained in the Node pack only (mercury-nodejs thread `agent-question-react-ui`), and this pack points to it - never a + second front-end here. ## Conventions diff --git a/memory/sessions/2026-11-19-094736.md b/memory/sessions/2026-11-19-094736.md index 78091f0..2180733 100644 --- a/memory/sessions/2026-11-19-094736.md +++ b/memory/sessions/2026-11-19-094736.md @@ -12,9 +12,10 @@ panel (45vh) with the closed cases, newest first, that keeps its scroll position across the re-render every event causes. Checked under a minimal DOM shim run on Node: two open cards and one closed case from five rows landed where they belong, the title read "(2) Agent questions", the panel's scroll position survived a render. -- **The React UI is the Node pack's** (Eric's ruling: one app to maintain in one place): the backlog thread is - mercury-nodejs `agent-question-react-ui`; this pack's README and CHANGELOG point there, the fact - [[agent-question-app]] records the rule - never a second UI here - and the vanilla page stays as the fallback. +- **The React UI is the Node pack's** (Eric's rulings: the agent-question app is the backend in both packs, the React UI + the one front-end, pointed at either backend; one app to maintain in one place): the backlog thread is mercury-nodejs + `agent-question-react-ui`; this pack's README and CHANGELOG point there, the fact [[agent-question-app]] records the + rule - never a second front-end here - and the vanilla page stays as the fallback. - **Gates:** ruff OK, basedpyright 0 errors, the agent-question suite 48 passed (the page test now checks the two sections). CHANGELOG Unreleased/Changed 1; README. - Opened as PR #72.