Repository navigation
Widget: host API and center-stage dialog (E6.1) - #705
Conversation
…alog
Adds widget.center_start (up to three capability cards and a footer note) and
widget.analysis_docs (https docs link) to WidgetConfig, the widget config
response and NEMAR's config. Tested: validators, GET /{community}, and every
registered community's docs link.
Adds open, close, ask, setMode and on to OSAChatWidget (queued before init), the modal AI Mode dialog on the same window (inert page, scroll lock, Tab trap, Escape and Move to corner dock it, Close restores focus), setDataset title, and the start screen driven by widget.center_start and widget.analysis_docs. Tested: test-widget-host-api.js, all widget suites, center-stage-check.mjs.
208 checks over the real widget in happy-dom: API shape, queue replay, refused calls, events and throwing handlers, ask through sendMessage, the dialog, trap, docking, focus return, the start screen and the docs link. Passing.
Real Tab key, Escape, viewport, 44 px targets and contrast at 1280x900 and 390x844 in light and dark, and both new test files as frontend-tests steps. Passing locally in Chrome 157.
…list Tested: test_embed_snippet_hygiene.py passes.
…istered community (tested)
…screen keeps the disclaimer and feedback link; bounded host queue, pop-out warnings, new-tab hint, iframe in the Tab cycle; tests and docs (tested: host-api suite, all widget suites, center-stage harness in Chrome)
|
Review round 1: outcomes (fixes pushed to this branch as 63ecea8 and the merge commit before it).
|
|
Worker changes detected. After merging to Manual deployment (if needed): cd workers/osa-worker
wrangler deploy --env dev # for develop branch
wrangler deploy # for main branch |
Preview Deployment
This preview will be updated automatically when you push new commits. |
…dow first; test, docs and changelog (tested: notebook-entry suite fails without the fix, all widget suites, center-stage harness in Chrome)
…lls input listeners when the draft returns (tested: host-api suite, all widget suites)
|
Review round 2, outcomes (fix commits on this branch):
Tested: all 27 widget suites in |
|
PM verdict: ready. Acceptance criteria checked against the diff (host API suite, dialog and start-screen coverage, config validation and registry-wide https test, center-stage Chrome harness, CI wiring, docs and changelog); review rounds 1 and 2 have outcomes; branch updated with develop and every check passes. Merging (squash). This PR says 'Part of #701', so #701 stays open for PR 2. |
Summary
PR 1 of 2 for E6.1: the host API, the center-stage AI Mode dialog, the C2 start screen and the config that feeds it.
The diff without the runtime bundle is about 2,800 lines, over the 1,500-line limit, so the plan rail and Continue in notebook (board C3) follow as PR 2 on
feature/issue-701-plan-rail, which closes #701.OSAChatWidget.open({mode}?),close(),ask(text, {mode}?),setMode('corner' | 'center'),on(event, fn)(eventsopen,close,modechange {mode},send {text}). Calls beforeinit()are queued and replayed in order; bad input warns and does nothing;askgoes throughsendMessage; a throwing handler cannot break the widget;onreturns an unsubscribe.setModeis a no-op in the pop-out..osa-chat-windowwith anosa-centerclass and a scrim:role="dialog",aria-modal, inert page, scroll lock, Tab trap, Escape (History or Settings first, then dock), Move to corner, Close restores focus. Full screen at 600 px and under.titlefromsetDataset(1 to 200 characters), History, Move to corner, Settings, Close.suggestionsToShow, cards, footer); the thread in a centered 760 px column otherwise.widget.center_start {capabilities (max 3), note}andwidget.analysis_docs {title, url}inWidgetConfig(validators,resolve()),WidgetConfigResponseand the widget'sCONFIG; NEMAR sets them. The footer "How it works" link and a Settings row open the docs in a new tab withrel="noopener noreferrer", and do not exist when unset.docs/community-widget.md, a CHANGELOG entry, and both new test files wired into thefrontend-testsjob.Part of #701
Commands run
bun frontend/test-widget-host-api.js: 208 passed, 0 failedbun frontend/browser-harness/center-stage-check.mjs: all checks passed in Chrome 157 at 1280x900 and 390x844, light and dark (real Tab key, Escape, viewport, 44 px targets, contrast)frontend/test-widget-*.jsand the otherfrontend/test-*.js: exit 0bun scripts/build-runtime-bundle.js && bun scripts/build-runtime-bundle.js --check: bundle is current (the runtime entry is unchanged)node --check frontend/osa-chat-widget.js: okuv run ruff check . && uv run ruff format --check .: cleanuv run pytest tests/test_api tests/test_core tests/test_frontend: 3,522 passed, 6 skipped (tests/test_core/test_llm_service.pydoes not collect under the local Python 3.14 venv, a litellm/pydantic v1 issue that predates this change, so it was ignored)curl -sI https://docs.nemar.org/web/analyze-in-browser/: HTTP/2 200Not run here: the end-to-end check against develop-demo.osc.earth, which needs this branch deployed.