kimi-code/packages/agent-core/test/tools
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
..
background feat: Harden the default system prompt and built-in tool descriptions (#1102) 2026-06-26 16:56:40 +08:00
cron feat(agent-core): rework compaction to keep only user prompts and summary (#1214) 2026-07-01 01:17:30 +08:00
fixtures fix: propagate kaos env overlays (#654) 2026-06-11 17:21:32 +08:00
planning fix: require AgentSwarm to run alone (#643) 2026-06-11 13:58:35 +08:00
policies feat: rework permission decision policies (#26) 2026-05-27 20:07:24 +08:00
providers Kimi For Coding 2026-05-22 15:54:50 +08:00
agent.test.ts feat: Harden the default system prompt and built-in tool descriptions (#1102) 2026-06-26 16:56:40 +08:00
ask-user.test.ts feat(agent-core): feed AskUserQuestion answers back as question text and option labels (#1414) 2026-07-06 16:37:54 +08:00
bash-env.test.ts feat: detach foreground tasks to background (#821) 2026-06-20 21:24:22 +08:00
bash-windows-kill.test.ts Kimi For Coding 2026-05-22 15:54:50 +08:00
bash.test.ts feat: Harden the default system prompt and built-in tool descriptions (#1102) 2026-06-26 16:56:40 +08:00
builtin-current.test.ts refactor(agent-core): use ripgrep for Glob tool (#1068) 2026-06-29 17:40:58 +08:00
edit.test.ts feat: Harden the default system prompt and built-in tool descriptions (#1102) 2026-06-26 16:56:40 +08:00
enter-plan-mode.test.ts feat: Harden the default system prompt and built-in tool descriptions (#1102) 2026-06-26 16:56:40 +08:00
exit-plan-mode-options.test.ts feat: Harden the default system prompt and built-in tool descriptions (#1102) 2026-06-26 16:56:40 +08:00
exit-plan-mode.test.ts feat: Harden the default system prompt and built-in tool descriptions (#1102) 2026-06-26 16:56:40 +08:00
fetch-url.test.ts feat(agent-core): slim WebSearch to query-only; fetch page content via FetchURL (#1260) 2026-07-01 18:46:15 +08:00
file-type.test.ts refactor(agent-core): unify image extension sniff-failed detection (#974) 2026-06-22 19:31:48 +08:00
glob.test.ts chore(telemetry): add ripgrep fallback telemetry (#1203) 2026-06-29 18:30:09 +08:00
goal.test.ts feat(agent-core): rework compaction to keep only user prompts and summary (#1214) 2026-07-01 01:17:30 +08:00
grep.test.ts chore(telemetry): add ripgrep fallback telemetry (#1203) 2026-06-29 18:30:09 +08:00
image-compress.test.ts fix(agent-core): route image-compression captions through hidden system reminders (#1348) 2026-07-03 16:21:10 +08:00
image-originals.test.ts feat(agent-core): announce image compression and keep originals readable (#1304) 2026-07-02 19:07:56 +08:00
input-schema-io.test.ts feat(agent-core): feed AskUserQuestion answers back as question text and option labels (#1414) 2026-07-06 16:37:54 +08:00
list-directory.test.ts feat(agent-core): refine system prompt context (#777) 2026-06-15 18:38:42 +08:00
path-guard.test.ts feat: add workspace add-dir support (#812) 2026-06-22 19:42:13 +08:00
plan-mode-hard-block.test.ts fix: require AgentSwarm to run alone (#643) 2026-06-11 13:58:35 +08:00
read-file.test.ts Kimi For Coding 2026-05-22 15:54:50 +08:00
read-media-desc.test.ts Kimi For Coding 2026-05-22 15:54:50 +08:00
read-media.test.ts feat(agent-core): announce image compression and keep originals readable (#1304) 2026-07-02 19:07:56 +08:00
read.test.ts perf(kaos): optimize large file reads (#971) 2026-06-23 15:07:40 +08:00
result-builder.test.ts Kimi For Coding 2026-05-22 15:54:50 +08:00
rg-locator.test.ts refactor: unify path normalization with pathe (#84) 2026-05-27 11:53:24 +08:00
shell-cancel.test.ts feat: detach foreground tasks to background (#821) 2026-06-20 21:24:22 +08:00
shell-quoting.test.ts feat: detach foreground tasks to background (#821) 2026-06-20 21:24:22 +08:00
skill-tool-dispatch.test.ts refactor: decouple agent skill registry (#784) 2026-06-15 20:39:29 +08:00
skill-tool.test.ts feat: Harden the default system prompt and built-in tool descriptions (#1102) 2026-06-26 16:56:40 +08:00
todo-list.test.ts feat: Harden the default system prompt and built-in tool descriptions (#1102) 2026-06-26 16:56:40 +08:00
web-search.test.ts feat(agent-core): slim WebSearch to query-only; fetch page content via FetchURL (#1260) 2026-07-01 18:46:15 +08:00
write.test.ts feat: Harden the default system prompt and built-in tool descriptions (#1102) 2026-06-26 16:56:40 +08:00