Skip to content

Widget: plan rail and Continue in notebook in the center-stage dialog (E6.1) - #709

Merged
neuromechanist merged 13 commits into
developfrom
feature/issue-701-plan-rail
Nov 11, 2026
Merged

neuromechanist merged 13 commits into
developfrom
feature/issue-701-plan-rail

Conversation

@neuromechanist

Copy link
Copy Markdown
Member

Summary

Second pull request of E6.1: board C3 in the center-stage dialog, on top of the merged host API (#705).

  • Plan rail. In the center dialog an <aside aria-label="Plan"> with an <ol> sits beside the thread, 280 px wide, in the widget's own --osa-* tokens (dark mode and community themes carry over). Heading Plan · 3 of 5 done (uppercase by CSS), Proposed plan for a draft, Plan stopped · N of M done for a stopped plan. Rows: check for done, highlighted row with a ringed circle for the current step (aria-current="step"), empty circle for pending, a distinct icon for failed and for stopped; every row also says its state in words for a screen reader (Step 3, done). A row whose step has a run card is a button that scrolls to and focuses the newest card of that step (run cards now carry data-plan-step) and never touches location.hash; other rows are plain text. The foot shows the run mode read-only and Memory budget 512 MB · change, which opens Settings with focus on the memory choice that is on.
  • Shown for draft, approved, stopped and done plans; hidden for none, changes_requested and unanswered, in the corner, and at 900 px and under (the strip and the bar carry the same state there). While the rail shows, the strip in the thread is hidden and the paused bar stays.
  • Layout. The window (for a capsule community, the chat view inside it) is a grid only while it has a rail (osa-center-has-rail): header on top, rail in the left column down the thread rows, footer and disclaimer across both. The rail is inserted before .osa-chat-messages and removed on docking; the thread is never redrawn or reparented. Tab order is header, rail, thread, input.
  • Logic. New frontend/osa-plan-rail.js (pure, no DOM): planRailOf(messages, {active}) reuses currentPlan, progressOf, PLAN_STATUS, PROGRESS_STATE and RUN_MODE from osa-plan.js and adds no second progress model. Exported as OSARuntime.planRail; the bundle and its integrity line are rebuilt.
  • Continue in notebook in the center header (osa-center-notebook-btn, before Move to corner, icon only at 600 px and under). Shown only when notebookContinueState(datasetId).offered is true, its reason is empty and hasSuccessfulRun(activeConversationRecord()) holds; it runs the card's path (runNotebookImport), is disabled with aria-busy while importing, and the existing flow docks the dialog (with a modechange event) when the notebook tab opens. Refreshed wherever refreshNotebookEntry refreshes the card. Plain ask, History and the corner panel are unchanged.

Glue is in one // BEGIN plan-rail ... // END plan-rail block after host-api; existing functions only got one-line hooks (renderPlanChrome, applyHostMode, refreshNotebookEntry, saveSettings, bindCenterStage), plus the data-plan-step attribute on done run cards and the header button markup.

Screenshots (real Chrome, from center-stage-check.mjs)

Capsule launcher (what NEMAR uses), 1280 x 900, light and dark:

capsule light
capsule dark

Bubble launcher, 1280 x 900, light and dark (no notebook tab, so no Continue in notebook):

bubble light
bubble dark

Phone, 390 x 844 (no rail, the strip and the bar show, the header button is an icon), light and dark; and the docked window:

phone light
phone dark
docked

Deviations from the brief and the board

  • Run mode is read-only text, not the board's checkbox. The mode goes to the model once, in the PlanDecision (src/api/tool_results.py), and there is no channel to change it after approval. The rail shows it from the same two strings as the plan card (Pauses after each step, Runs all steps); while the plan is still a draft it follows the card's radio.
  • Heading keeps the board's middle dot (Plan · 3 of 5 done) and is uppercased by CSS, so the text a screen reader gets is ordinary case.
  • Rail text uses --osa-text, not the board's slate greys. --osa-text-light on --osa-assistant-bg is 4.33:1 in the light scheme, under the 4.5:1 the brief asks for; the circle icons use --osa-text-light (non-text 3:1). The change button is underlined --osa-text for the same reason (NEMAR's accent measured 4.46:1 there).
  • Capsule communities. applyLauncherMode moves the chat's elements into .osa-view-chat, so for a capsule widget that view is the grid, not the window. The rail is still inserted before .osa-chat-messages; the harness checks both a capsule and a bubble widget.
  • Continue in notebook is also disabled while a reply is loading, as the History row's Continue is (continueHistoryConversation), in addition to the brief's importing state. Because the notebook tab docks the dialog as soon as an import starts, the busy state is visible when the dialog is raised again during the import; the test does exactly that.
  • Pending and current rows without a run card are plain text (the brief names pending only); a failed or stopped step is a button once it has a card.
  • planRail returns mode as well as modeLabel (the spec lists modeLabel; mode costs nothing and keeps the label from being parsed back).
  • Closing Settings after change does not return focus to the rail button, as it does not for the Settings gear today.
  • The screenshots live on the orphan branch screenshots/issue-701-plan-rail, as earlier PRs did, and can be deleted after merge.

Verification

  • bun frontend/test-plan-rail.js: 54 passed
  • bun frontend/test-widget-plan-rail.js: 143 passed
  • bun frontend/test-widget-plan-card.js: 264 passed; bun frontend/test-widget-host-api.js: 243 passed; bun frontend/test-widget-notebook-entry.js: 190 passed
  • bun scripts/build-runtime-bundle.js run, then --check passes; bun frontend/test-runtime-bundle.js: 43 passed (new planRail export and source/bundle parity)
  • bun frontend/browser-harness/center-stage-check.mjs: 221 checks ok in headless Chrome 157 (approved plan at 1280 x 900 on capsule and bubble: rail 280 px, no sideways scroll, rows and change at least 36 px, text 4.5:1 light and dark, real Tab order, row click focuses the card with the address unchanged, change opens Settings, docking keeps the thread nodes; at 390 x 844 the rail is hidden and nothing scrolls sideways)
  • Every other frontend/test-*.js suite passes
  • uv run --extra dev --extra server pytest tests/test_frontend: 172 passed (this caught two quoted attribute interpolations in selectors, fixed); uv run ruff check .: all checks passed (ruff format --check reports 8 files, none touched here)

Closes #701

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Preview Deployment

Name Link
Preview URL https://feature-issue-701-plan-rail-demo.osc.earth
Branch feature/issue-701-plan-rail
Commit e4c0952

This preview will be updated automatically when you push new commits.

…ng fallback, pin every state (tested: test-plan-rail.js 78 passed)
…w always has an effect, role=list, reuse prefersReducedMotion (tested: test-widget-plan-rail.js 156 passed)
…step N focus in a real browser (tested: center-stage-check 262 ok, 0 FAIL)
@neuromechanist

Copy link
Copy Markdown
Member Author

Review round 1: outcomes (pushed to feature/issue-701-plan-rail, five commits on top of the previous head).

  • CONFLICTING with develop (CHANGELOG.md, widget, tests.yml): fixed. Merged origin/develop into the branch (5ee6650); the [Unreleased] conflict is resolved keeping the plan rail entry, this PR's host API entry (without the "follow in a second pull request" clause) and develop's privacy page entry. The branch is now up to date with develop (0 commits behind). Tested on the merged result: build-runtime-bundle.js --check, test-runtime-bundle.js (43), test-plan-rail.js, test-widget-plan-rail.js, test-widget-plan-card.js (264), test-widget-host-api.js (243), every other frontend/test-*.js (all pass), test_embed_snippet_hygiene.py (17), and center-stage-check.mjs in headless Chrome 157 (262 ok, 0 FAIL, including the new checks below).
  • Focus after Run step N lands on a display:none strip: fixed. renderPlanChrome now draws the rail first, then, when the wanted element exists but has no client rects, sends focus to the rail (<aside tabindex="-1">), then to the thread. Elements that were never found still get no focus, as before. New happy-dom tests emulate "no boxes under display:none" (rail case, the 900 px case where the strip still takes focus) and a real-Chrome check (checkRunStepFocus) clicks Run step 4 with the rail showing and reads document.activeElement while the reply is held back and again after it. One correction to the report: in real Chrome the old code did not drop focus to body; sendMessage had already put it on the message input, so the strip's job (focus says what runs) was lost rather than the reader's place. The Chrome check therefore asserts focus is inside the dialog, not on body, and on the rail; the rail assertion is the one the old behaviour fails.
  • goToPlanStep re-implements reduced motion: fixed, now prefersReducedMotion() (which also guards matchMedia throwing).
  • goToPlanStep silent no-op when no card exists: fixed. With no card for the step it goes to the newest run card, or the thread when there is none, so a row drawn as a button always scrolls and focuses something. New test removes the card and clicks the row. I kept hasCard coming from the plan's runs rather than the DOM, so the model stays the single source and the fallback covers the gap. Documented in docs/community-widget.md.
  • <ol> with list-style:none loses list semantics in Safari/VoiceOver: fixed with role="list" on the <ol> in planRailHtml; asserted in the rail test.
  • Pure module: recomputed mode and silent pending fallback: fixed. Non-draft plans take mode from progressOf; the local computation stays only for drafts. The KNOWN_STATES fallback is dropped and the rows carry progressOf's segments as they are; a new test runs six plan shapes, with and without active, and asserts every row state is one of the five rail states and every label is Step N, <words>, so a segment added to progressOf without a word here fails instead of reading as "not started". The existing "rows equal progressOf's segments" test is kept.
  • Chrome contrast misses failed and stopped rows and the rings: fixed. center-stage-check.mjs now has failed and stopped fixtures (/plan?variant=failed|stopped) and measures, in light and dark, the failed and stopped titles at 4.5:1, the failed, stopped and check marks and the pending ring at 3:1, and, in the paused fixture, the current and pending rings (new property argument on CONTRAST_OF for borderTopColor). All pass.
  • Hard-coded #15803d / #4ade80 do not adapt to a community theme: rejected as a design choice, with the measurement added. There is no global success token (the only other users are the same literal pair in --osa-run-ok, scoped to .osa-run-card), and --osa-assistant-bg is a fixed token (defined once for light and once for dark, never set from a community's theme colors), so the contrast of these colors against it cannot drift per community; the new Chrome checks hold the check mark to 3:1 in both schemes.

The runtime bundle was rebuilt after the pure-module change (--check current).

…il's shared heading id (tested)

renderPlanChrome set tabindex=-1 on every focus target, taking Edit, Add step and the plan inputs out of the Tab order; it now does so only for the rail/thread fallback. The rail heading id and aria-labelledby are removed so two widgets on one page cannot collide; the aside keeps aria-label. Tests assert no tabindex on the focused control.
@neuromechanist

Copy link
Copy Markdown
Member Author

Review round 2 outcomes (fix commit e4fcaea on this branch):

  • important, frontend/osa-chat-widget.js: tabindex -1 added to every focus target - fixed. renderPlanChrome now sets tabindex="-1" only on the rail/thread fallback (when the wanted control is not drawn); Edit, Add step, Ask for changes and the plan inputs keep their natural Tab order. Added assertions in frontend/test-widget-plan-card.js that the focused Edit button, .osa-plan-input and .osa-plan-add carry no tabindex; they fail without the fix (2 failures) and pass with it.
  • suggestion, planRailHtml fixed id osa-plan-rail-heading - fixed. Removed the id and the list's aria-labelledby; the aside keeps aria-label="Plan", so there is no duplicate id with several widgets on one page.

Tested: bun test-widget-plan-card.js (266 passed, 0 failed) and bun test-widget-plan-rail.js (156 passed, 0 failed).

@neuromechanist
neuromechanist merged commit 1bb30b6 into develop Nov 11, 2026
8 checks passed
@neuromechanist
neuromechanist deleted the feature/issue-701-plan-rail branch November 11, 2026 10:39
@neuromechanist

Copy link
Copy Markdown
Member Author

Verdict: ready and merged. All acceptance criteria checked against the diff and tests, every review finding from rounds 1 and 2 has an outcome in a comment, branch was up to date with develop, and all checks passed (Lint, Test 3.11/3.12, Frontend Tests, deploy; Integration Tests skipping). Squash-merged into develop; #701 closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant