Carry a question in the event model, not in one provider's JSON

A question is now fully described by the event that reports it: the tag
it was asked under, each option's label, what it means, and the sample of
what picking it would produce, plus whether several may be picked at
once. The app renders from that alone.

It had been reading Claude Code's tool input to find the parts the event
dropped -- that dialect's schema, written out a second time in Kotlin,
where no other provider could reach it and where it would drift the
first time the schema moved. Echo could not describe an option at all,
and llama never will.

Answers travel as a list for the same reason. A question that takes one
answer sends a list of one rather than being a different shape, and the
one place that flattens it is where the CLI is spoken to: its answers
map holds a string, so several choices are joined there. That join was
in the phone.

Also here because it is the same rule: the permission ask reuses the
question body rather than owning a second one, so Allow/Deny renders and
resolves through exactly the code an AskUserQuestion does.

Verified against both, since a refactor that only satisfies the case it
was written for has been tried on the half that cannot fail: a two
question `/ask` answered from the phone, one option and then two, and a
real sonnet session's `rm -f` permission asked, allowed, and run.
This commit is contained in:
iris committed 2026-08-29 16:46:43 -04:00
1 parent fea8e7e92b
commit bebaae7a94
13 files changed
+419 -237

No files matched your search

+5 -3
View File
@@ -186,7 +186,7 @@ pub fn read_after(path: &Path, after: u64) -> Result<Vec<SeqEvent>> {
#[cfg(test)]
mod tests {
use super::*;
use crate::session::driver::SessionStatus;
use crate::session::driver::{QuestionOption, SessionStatus};
fn text(delta: &str) -> Event {
Event::AssistantText {
@@ -337,12 +337,14 @@ mod tests {
Event::Question {
id: "q1".into(),
prompt: "Allow?".into(),
options: vec!["Yes".into(), "No".into()],
header: None,
options: vec![QuestionOption::plain("Yes"), QuestionOption::plain("No")],
multi_select: false,
about: None,
},
Event::Answered {
id: "q1".into(),
answer: "Yes".into(),
answers: vec!["Yes".into()],
},
Event::Status {
state: SessionStatus::Idle,