kimi-code/packages/agent-core/test/tools
Kai 0fc0ae380b
feat(agent-core): announce image compression and keep originals readable (#1304)
* feat(agent-core): announce image compression and keep originals readable

Every image ingestion point (ReadMediaFile, MCP tool results, clipboard
paste, REST upload/inline base64, ACP) now places a <system> caption next
to a compressed image stating the original vs. delivered dimensions, byte
size, and format, so downsampling is never silent to the model.

Originals stay readable: file uploads point at the stored blob, and
in-memory images are persisted into the session's media-originals dir
(content-addressed, size-capped, removed with the session; temp-dir
fallback when no session is known).

ReadMediaFile gains region (crop in original-image pixel coordinates,
delivered at full fidelity) and full_resolution (skip downscaling, with
an explicit error over the per-image byte limit), so the model can zoom
into fine detail instead of silently degrading on large images.

* fix(agent-core): exempt compression captions from the MCP text budget

The caption announcing an image's compression was inserted before the
shared 100K text budget was applied, so a chatty MCP result (page text +
screenshot) consumed the budget first and the caption was evicted — or
sliced mid-string into an unclosed <system> fragment — while the
downsampled image survived, silently reintroducing the exact degradation
the caption exists to report, and orphaning the persisted original.

Split the size-limit pass in two and reorder the pipeline: the text
budget now runs on the tool's own text BEFORE compression inserts
captions (exempt by construction), and the per-part binary cap still
runs after compression so compressible screenshots are kept.

* fix(agent-core): harden crop error reporting and document readback semantics

- cropImageForModel rejects non-finite region coordinates with a clean
  message instead of surfacing the codec's internal validation dump
- the full_resolution and cropped-region over-budget errors now include
  exact byte counts alongside the rounded sizes, so a file a hair over
  budget no longer reads "is 3.8 MB, over the 3.8 MB limit"
- read-media.md notes that re-reading a file without region or
  full_resolution reproduces the same downsampled image
2026-07-02 19:07:56 +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: release experimental features (#569) 2026-06-09 11:42:50 +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 feat(agent-core): announce image compression and keep originals readable (#1304) 2026-07-02 19:07:56 +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: Add persistent experimental feature toggles and a TUI panel (#420) 2026-06-04 18:35:41 +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