Skip to content

feat(question): free-form questions render as text cards (amicode#245) - #113

Merged
aarontrowbridge merged 9 commits into
local/amicodefrom
amico/issue-245-text-card-questions
Aug 4, 2026
Merged

feat(question): free-form questions render as text cards (amicode#245)#113
aarontrowbridge merged 9 commits into
local/amicodefrom
amico/issue-245-text-card-questions

Conversation

@jeonghun-jj-lee

Copy link
Copy Markdown
Contributor

Refs harmoniqs/amicode#245. Design of record: docs/adr/0002-free-form-questions-render-as-text-cards.md (already on local/amicode).

What

  • Schema (v1 + v2 question shapes — agent-facing Prompt and server Info both carry it via the shared base): one new optional kind"choice" (default) | "text". An absent kind decodes as a choice question (back-compat); an unknown kind fails decoding loudly (Literal enum — never silently degrades). Legacy SDK + packages/client regenerated; kind?: "choice" | "text" is the only generated diff.
  • Renderers — a text-kind question renders a text card: header + bare text input + submit; no option rows, no "Type your own answer" pseudo-option; submit requires non-empty trimmed text; answers ride the existing typed-custom-answer path (no new plumbing); dismissal/rejection semantics unchanged.
    • App dock (session-question-dock.tsx) — additionally now honors the custom flag for choice cards (it previously appended the pseudo-option unconditionally; follows the TUI's flag check).
    • TUI (routes/session/question.tsx) and CLI (cmd/run/question.shared.ts + footer).
  • Prose guard (extracted verbatim to session/prose-guard.ts): behavior unchanged — still forces prose questions in active interviews into cards, at most one nudge per assistant message, never after a question-tool call. The nudge text is now bilingual: choice questions re-ask with options (recommended first); free-form questions re-ask with kind: "text". No classification heuristics — the model picks the shape from the question it is re-asking.
  • Question-tool description teaches the text kind for free-form questions.
  • AMICODE-PATCHES.md patch 26 records the fork-surface changes with an upstream-sync watch note (the dock is a high-conflict file).

Test evidence

  • packages/schema: 16/16 question tests (both shapes; absent→choice; explicit choice/text; unknown kind throws); typecheck clean. (Full suite has 2 pre-existing event-manifest failures that reproduce on a clean tree.)
  • packages/opencode: CLI text-card 10/10, prose-guard 10/10, tool 4/4; wire-shape snapshot diff is exactly the kind field. Full suite 3519 pass / 24 documented pre-existing fails (pasqal ×8, widgets ×15, flaky PTY ×1 — see AMICODE-PATCHES.md).
  • packages/tui: new real render tests 5/5 (testRender + stub server — typed answer submits through the custom path; empty Enter never submits; custom:false hides the row). Full suite 196/196.
  • packages/app: dock shape helpers 6/6; unit suite 783/783; tsgo -b clean.
  • packages/core 1081/1081 · packages/protocol 2/2 · packages/client 16/16 + generated-types check in sync · packages/ui 441/441.

Ships

This is the engine half of amicode#245. The extension's contract-text changes ride the next engine pin cut from this merge — the companion extension PR stays draft until it picks up that pin bump + re-vendor, per the issue's Key Decisions.


Orchestrated via amicode /develop (issue-DAG walk — single-slice unit, TDD per slice).

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.

2 participants