Repository navigation
feat: editable plan card, step progress and pause/stop for browser plans (E2.3, E2.4) - #695
Conversation
… OSARuntime.plan Pure functions for the propose_plan flow (E2.3, E2.4): normalize a proposal, edit, add and remove steps within 1 to 8, build the PlanDecision, attribute runs to steps (two attempts a step) and derive the progress. Rebuilt the bundle and its integrity hash. Tested by the bundle test, which holds the minified logic to the source's; the card tests follow.
…E2.3, E2.4) The widget declares propose_plan once the runtime bundle loads and answers it with a card (edit, add, remove, run mode, approve, ask for changes) via /chat/resume. An approved plan is consent for its steps (the gate answers Run, controller untouched); runs are attributed to steps and stored with step, attempt, stepTitle and elapsedMs; run cards get step headers, a strip, a bar with Run step N, Change step N and Stop plan; a reload restores the plan read-only. Tested in happy-dom against the real widget and bundle (test-widget-plan-card.js, wired into CI); all other frontend suites pass; checked at 400 px in light and dark in real Chrome by hand.
Drives the real widget through the card in several scenarios and parses what it posts with ResumeRequest, PlanDecision and build_plan_tool_message; also holds the card's limits to the server's. Tested: 19 pytest cases pass.
…es propose_plan Documentation and a YAML comment only (the stale note that the widget does not declare propose_plan). Not run beyond the tests/test_frontend embed hygiene check.
Preview Deployment
This preview will be updated automatically when you push new commits. |
…lan fixture imports happy-dom
…, announce progress, clip by code point Review round 1 on the plan card: a failed /chat/resume after Approve or Ask for changes returns the plan to Not answered; a planned run with status denied reads Step N failed with the retry line; a live region says where the plan stands; focus moves to the card heading after a decision and to the strip after Run step N; Edit, Remove and bar buttons are 44 px; formatStepElapsed no longer prints 1 min 60 s; limits cut by code point; the status vocabulary and step cleaning are checked against osa-plan.js. Tested: frontend/test-widget-plan-card.js (261 passed), bundle --check.
…oint limits) Tested: tests/test_frontend (165 passed).
…the undone decision; fix the stale propose_plan note Documentation only.
|
Review round 1: outcome for each finding. Fixes are commits 9f0eb91, eb3603d, b1cc1e8 and c15dc74 on this branch.
No finding concerned code this PR did not touch, so no issues were filed. Tests rerun: |
…t cannot outlive its render. Tested: all frontend suites pass
|
Review round 2 outcomes (fix commit 8f6e4ed):
Tested: all |
|
Project manager verdict: ready. All acceptance criteria are covered by the diff and tests (plan card suite 264 passed, all other frontend suites, bundle --check, node --check and tests/test_frontend 166 passed, rerun locally). Every review finding from both rounds has an outcome. All checks pass. Merging with squash. |
Summary
The NEMAR widget now answers the server's
propose_plancall with an editable plan card (E2.3, board A2), and shows step headers, a progress strip, a paused bar and Stop plan (E2.4, board A3).propose_planis added toclient_toolson/chatand/chat/resumeonly once the runtime bundle that carriesOSARuntime.planhas loaded.Proposed plan · N steps,Largest step needs about N MB(no budget named), the steps with Edit, Remove (down to 1) and+ Add a step(up to 8), the run-mode radios (Pause default, Run all), Approve and run step 1 and Ask for changes (optional note, 1000 characters). Approve and Ask for changes are 44 px tall; every field has a label; model and reader text is escaped.{session_id, result: {call_id, decision, steps, run_mode, feedback?}, client_tools}. Ask for changes postschanges_requestedand runs no code.askToRunCode, soosa-controller.jsis unchanged. A run that is the plan's next step, or the second attempt of a failed step, skips the permission card. Anything else asks, including a third attempt, a request after the last step, and every request after Stop plan or Ask for changes.step,attempt,stepTitleandelapsedMs. Run cards readStep N · titleorStep N failed · ErrorType: messagewith the elapsed time. A strip saysPlan · step N of Mwith M segments andPauses after each steporRuns all steps. The bar offers Run step N (sendsContinue with step N.), Change step N (prefills the input) and Stop plan, and saysStep N+1 waits until step N works.while a failed step retries.buildConversationNotebooknames steps by their plan titles.frontend/osa-plan.js(pure logic,OSARuntime.plan); the DOM and CSS are one block inosa-chat-widget.js;frontend/test-widget-plan-card.jsis wired into the frontend-tests job after the History panel step. Also the stale comment insrc/assistants/nemar/config.yaml,docs/community-widget.mdandCHANGELOG.md.No change to
src/other than that comment, and none toosa-controller.js.Closes #662
Closes #671
Commands run
bun installbun frontend/test-widget-plan-card.js: 219 passed, 0 failedfrontend/test-widget-tools.js(443),test-widget-run-card.js(261),test-widget-history-store.js(212),test-widget-history-panel.js(200),test-widget-handover-events.js(9),test-controller.js(144),test-runtime-bundle.js(39): all pass. The other frontend suites (widget, worker core, workspace, data lane, notebook builder, egress, output, lifecycle, streaming, markdown) also pass.bun scripts/build-runtime-bundle.js && bun scripts/build-runtime-bundle.js --check: bundle is currentnode --check frontend/osa-chat-widget.jsuv run pytest tests/test_frontend tests/test_api/test_propose_plan.py tests/test_api/test_tool_results.py -q: 261 passed (including the 19 cases of the newtests/test_frontend/test_plan_resume_payload.py)uv run ruff check . && uv run ruff format --check .: cleanI also looked at the card, the editor, the paused bar and a failed step at 400 px in light and dark in real Chrome by hand, with a throwaway script that is not part of this PR (no harness screenshots attached, since no browser-harness check is added). Approve, Ask for changes and the bar buttons measured 44 and 36 px tall, with no sideways scroll.
Notes for the reviewer
test-widget-plan-card.jsandbuild_plan_payload_fixture.jssharefrontend/test-support/plan-widget-harness.js, so the payload the Python test parses is the one the widget really posts. A body carriespage_contextwhen the reader shares the page; the tests that assert the exact body turn that off, and one scenario keeps it on.frontend/test-workers/executing.jsgains aFAIL:<Type>: <message>directive (a run that raised, in the runtime's stderr shape); existing directives are unchanged.test-widget-tools.jsnow expectspropose_planin the declared tools once the real bundle is loaded.