kimi-code/packages
Kai c12f30951f
feat(agent-core): feed AskUserQuestion answers back as question text and option labels (#1414)
* feat(agent-core): feed AskUserQuestion answers back as question text and option labels

The flattened answers record the model receives was keyed by synthesized
ids (q_0 / opt_0_1), forcing a cross-message positional lookup against the
original tool call to understand what the user picked — both unreadable in
transcripts and a real model-misreads-the-choice badcase.

- toAgentCoreResponse now takes the original broker request and translates
  wire ids back to question text (keys) and option labels (values);
  unknown ids are kept verbatim, missing request falls back to raw ids
- wire protocol unchanged: clients still answer with option ids; the
  resolve route reads the pending request before settling it
- question texts must be unique per call and option labels unique per
  question, enforced in the tool execution path (AJV cannot express the
  zod refine) and mirrored on the exported schemas
- web transcript card resolves both the new label form and legacy id
  transcripts; TUI and ACP paths already produced the text form

* fix(agent-core): align multi-select answer join across clients and harden question schema

- Join multi-select labels with ', ' in the server translator, matching
  what the TUI reverse-RPC path already emits, so the model sees one
  format regardless of which client answered
- Trim segments in the web transcript resolver before label matching:
  TUI-answered multi-select transcripts (', '-joined) previously lost
  their highlight to a spurious leading-space Other row
- Move the question-text/legacy-q_<i> answer lookup out of the SFC into
  askUserToolParse as answerFor(), per that module's testability intent
- Require non-empty question text and option labels (.min(1)) so empty
  strings are rejected by AJV at the tool boundary instead of failing
  deeper in the protocol layer

* fix(agent-core): resolve option ids only within the answered question

The translator's option-id lookup was a single flat map across all
questions, so a stale or malformed response pairing one question with
another question's option id (q_1 + opt_0_0) was silently translated
into a label that was never offered for that question. Scope the lookup
to the answered question's own options; cross-question and unknown ids
now both pass through verbatim, staying diagnosable.
2026-07-06 16:37:54 +08:00
..
acp-adapter feat(agent-core): announce image compression and keep originals readable (#1304) 2026-07-02 19:07:56 +08:00
agent-core feat(agent-core): feed AskUserQuestion answers back as question text and option labels (#1414) 2026-07-06 16:37:54 +08:00
kaos fix(kaos): enrich PATH from the user's login shell at startup (#1339) 2026-07-03 15:20:38 +08:00
kosong feat(agent-core): progressive tool disclosure via select_tools (#1369) 2026-07-06 15:51:08 +08:00
migration-legacy chore(agent-core): remove experimental micro compaction (#1317) 2026-07-02 19:50:51 +08:00
node-sdk feat(agent-core): progressive tool disclosure via select_tools (#1369) 2026-07-06 15:51:08 +08:00
oauth feat: add model alias overrides (#1262) 2026-07-01 19:57:13 +08:00
pi-tui fix(tui): complete @ file mentions across additional workspace roots with fd (#1408) 2026-07-06 15:02:02 +08:00
protocol feat(server): add --dangerous-bypass-auth and --keep-alive flags (#1368) 2026-07-04 18:03:50 +08:00
server feat(agent-core): feed AskUserQuestion answers back as question text and option labels (#1414) 2026-07-06 16:37:54 +08:00
server-e2e fix(web): stop auto-dismissing pending questions and approvals on a timeout (#1070) 2026-06-24 19:15:06 +08:00
telemetry ci: run unit tests on windows (#1037) 2026-06-26 11:56:41 +08:00