feat(readmymind): rethink steer note (phase 3 part 2)

Adds the optional free-text steer note to the Read My Mind modal: a
dashed input under the suggestions ("no, I meant the mobile bug") that
rides along as `steer` on every Rethink. The API already accepted it;
this wires the frontend end of the contract.

- Shown whenever Rethink is live (ready AND empty-result phases),
  hidden only while a prediction runs; typed text survives re-runs.
- Enter in the field triggers Rethink, mirroring the prompt field's
  Enter-to-send; a fresh open clears it with the rethink memory.
- Trimmed and capped to the schema's 2000 chars on the way out; a
  plain open still sends an empty body (neither steer nor rejected).
- zh-CN strings for the placeholder and aria-label, phone-sized
  touch target in mobile.css, static guards in the phase-3 test.

Verified with a browser E2E against a live dev server (stubbed predict
endpoint): payload contents, phase visibility, Enter wiring, and
reset-on-reopen all asserted with real keystrokes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer
2026-08-10 10:41:39 +02:00
parent 752374abc7
commit 831af88579
9 changed files with 78 additions and 8 deletions
+16
View File
@@ -73,4 +73,20 @@ describe('read my mind phone key + alternates (static guards)', () => {
expect(ui).toContain('readMyMindAlternates');
expect(ui).toMatch(/\.textContent = suggestion\.prompt/);
});
// Phase 3 part 2: the Rethink steer note (docs/readmymind-plan.md phase 3).
it('wires the rethink steer note end to end: field, payload, phase visibility, reset', () => {
// The field lives in the modal, capped to the schema's 2000-char limit,
// and Enter in it triggers a rethink (mirroring the prompt field's
// Enter-to-send).
expect(html).toMatch(/id="readMyMindSteer"[^>]*maxlength="2000"/);
expect(html).toMatch(/id="readMyMindSteer"[^>]*onkeydown="[^"]*rethinkReadMyMind\(\)"/);
// Predict sends the trimmed note as `steer`, bounded to the schema cap.
expect(ui).toMatch(/body\.steer = steer\.slice\(0, 2000\)/);
// The row hides ONLY during loading: Rethink is live in both the ready
// and the empty-result phases, so the note must be reachable in both.
expect(ui).toMatch(/steerRow\.style\.display = phase === 'loading' \? 'none' : ''/);
// A fresh open resets the note along with the rethink memory.
expect(ui).toMatch(/steer\.value = ''/);
});
});