Skip to content

feat(mobile): draw choice cards and keep their answer in the draft - #1613

Merged
huichen merged 1 commit into
mainfrom
pr/huichen
Nov 14, 2026
Merged

huichen merged 1 commit into
mainfrom
pr/huichen

Conversation

@huichen

@huichen huichen commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

The phone now draws the agent's futureos-choice fence as a real card and keeps the answer it produces in the composer draft, instead of leaving a readable list behind and drawing a separate chip. Desktop already landed this in #1612; this is the mobile half, at design docs/design/choice-cards.zh-CN.md §5.7 / §11 step 6.

  • ChoiceCard (new): full-width card, one 44pt row per option with a line on what picking it changes, radio/checkbox role with aria-checked, a single selected cue and the "answer is above the input" footnote once picked.
  • Only the thread's last card answers: TimelineCard hands the answer surface to the last settled reply's last prose block and MarkdownText marks the document's last card; every other card stays readable but inert.
  • ComposerDock gains a chip row above the field (question, answer, pencil, clear) and ChoiceSheet, the bottom sheet the pencil opens.
  • canSend / hasDraft count the answer, so one option and no words is sendable; useComposerSubmission sends the question and answer before the reader's own words and drops the answer once the session took it.
  • The answer is persisted with the draft, like refs: restoring the words without the answer would hand back half a draft.

Commits

  • feat(mobile): draw choice cards and keep their answer in the draft

Verification

Run in a detached worktree at 07efa35d2, node 22, mobile packages only (the change touches mobile/ plus the screenshot scenario file; no Rust crate, no shared package):

  • npx tsc --noEmit → clean
  • npx eslint on all 25 changed TypeScript files → clean
  • npx jest on the 10 changed suites → 194 passed
  • npx jest full mobile suite → 170 suites, 3224 tests passed
  • node -e parse of scripts/screenshots/scenarios.d/choice-cards.json → ok

User-visible changes

  • On the phone, a reply that offers a choice now renders as an interactive card with tappable options instead of a plain readable list, and picking an option puts the answer into the composer as part of the draft (shown as a chip above the field, editable through a bottom sheet, sent as [question → answer] before the reader's own words). Before: the fence was shown as a static list and there was no way to answer it from the draft. Revert: 07efa35d2.
  • No setting, default value, migration or wire change: the fence format and the draft storage shape stay backward compatible (missing answer = empty answer).

A `futureos-choice` fence now becomes the phone's real card (design
`docs/design/choice-cards.zh-CN.md` §5.7, §11 step 6) instead of the readable
list step 1 left behind, and the answer a row produces is draft content the
composer already counts rather than a chip drawn beside it.

- `ChoiceCard` (new): full-width card, one 44pt row per option with its own
  line on what picking it changes, `role=radio`/`aria-checked` (`checkbox` for
  multi), a single selected cue (accent fill + ring-and-dot, no outline — §5.7.1)
  and the "answer is above the input" footnote once something is picked.
- Only the thread's **last** card answers: `TimelineCard` hands the answer
  surface to the last settled reply's last prose block, `MarkdownText` marks the
  document's last card, and every other card stays readable but inert (§2).
- `ComposerDock`: a chip row above the field (question, muted · answer, pencil,
  ×) and `ChoiceSheet`, the bottom sheet the pencil opens — 44pt rows, a pick
  written straight back, the draft's words untouched.
- `canSend` and `hasDraft` count the answer, so one option and nothing else is
  sendable (§5.4, requirement d); `useComposerSubmission` refuses an empty draft
  with an answer in the same way and sends `[问题 → 答案]` before the reader's
  own words (§7), clearing the answer once the session took it.
- The answer lives in `useComposerDraft` and is persisted with the draft, like
  `refs`: restoring the words without the answer would hand back half a draft.
@huichen
huichen enabled auto-merge (squash) November 14, 2026 19:18
@huichen
huichen merged commit 0aa6a94 into main Nov 14, 2026
10 checks passed
@huichen
huichen deleted the pr/huichen branch November 14, 2026 19:38
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