kimi-code/packages/server/test
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
..
__snapshots__ feat(server): add GUI store API mirroring localStorage (#1231) 2026-06-30 21:04:59 +08:00
helpers feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
svc ci: run unit tests on windows (#1037) 2026-06-26 11:56:41 +08:00
anti-corruption.test.ts feat(web): introduce Kimi web app and daemon gateway (#625) 2026-06-17 20:53:46 +08:00
api-surface.snapshot.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
approval.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
auth-middleware.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
auth-wiring.e2e.test.ts ci: run unit tests on windows (#1037) 2026-06-26 11:56:41 +08:00
auth.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
authTokenService.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
bindClassify.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
config.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
connections.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
debug-nonloopback.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
defineRoute.test.ts feat(web): introduce Kimi web app and daemon gateway (#625) 2026-06-17 20:53:46 +08:00
error-handler.test.ts feat(web): introduce Kimi web app and daemon gateway (#625) 2026-06-17 20:53:46 +08:00
fileLaunch.test.ts feat(web): introduce Kimi web app and daemon gateway (#625) 2026-06-17 20:53:46 +08:00
files.e2e.test.ts ci: run unit tests on windows (#1037) 2026-06-26 11:56:41 +08:00
fs-basic.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
fs-batch.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
fs-browse.e2e.test.ts ci: run unit tests on windows (#1037) 2026-06-26 11:56:41 +08:00
fs-download.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
fs-git.e2e.test.ts ci: run unit tests on windows (#1037) 2026-06-26 11:56:41 +08:00
fs-mkdir.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
fs-path-safety.test.ts ci: run unit tests on windows (#1037) 2026-06-26 11:56:41 +08:00
fs-search.e2e.test.ts chore(telemetry): add ripgrep fallback telemetry (#1203) 2026-06-29 18:30:09 +08:00
fs-watch.e2e.test.ts ci: run unit tests on windows (#1037) 2026-06-26 11:56:41 +08:00
guiStore.e2e.test.ts feat(server): add GUI store API mirroring localStorage (#1231) 2026-06-30 21:04:59 +08:00
host-exposure.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
host-origin.e2e.test.ts feat(server): add --allowed-host flag for DNS-rebinding allowlist (#1128) 2026-06-26 17:06:01 +08:00
hostnames.test.ts feat(server): add --allowed-host flag for DNS-rebinding allowlist (#1128) 2026-06-26 17:06:01 +08:00
lock.test.ts ci: run unit tests on windows (#1037) 2026-06-26 11:56:41 +08:00
messages.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
meta.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
model-catalog-refresh-scheduler.test.ts feat(server): auto-refresh provider model catalog and push change events (#1207) 2026-06-30 12:29:10 +08:00
model-catalog.e2e.test.ts feat(server): auto-refresh provider model catalog and push change events (#1207) 2026-06-30 12:29:10 +08:00
oauth.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
origin.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
prompt.e2e.test.ts feat(agent-core): announce image compression and keep originals readable (#1304) 2026-07-02 19:07:56 +08:00
question.e2e.test.ts ci: run unit tests on windows (#1037) 2026-06-26 11:56:41 +08:00
rate-limit.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
security-headers.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
services-auth.test.ts fix(server): skip Unix-only permission check on Windows for server token (#1135) 2026-06-26 18:38:24 +08:00
services.test.ts ci: run unit tests on windows (#1037) 2026-06-26 11:56:41 +08:00
sessions-workspace.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
sessions.e2e.test.ts feat(agent-core): rework compaction to keep only user prompts and summary (#1214) 2026-07-01 01:17:30 +08:00
skills.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
snapshot.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
snapshot.perf.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
snapshot.smoke.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
snapshotService.unit.test.ts feat(agent-core): rework compaction to keep only user prompts and summary (#1214) 2026-07-01 01:17:30 +08:00
start.test.ts ci: run unit tests on windows (#1037) 2026-06-26 11:56:41 +08:00
swagger.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
tasks.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
terminals.e2e.test.ts ci: run unit tests on windows (#1037) 2026-06-26 11:56:41 +08:00
terminalTestBackend.ts feat(web): introduce Kimi web app and daemon gateway (#625) 2026-06-17 20:53:46 +08:00
tools.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
workspaces.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
ws-abort.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
ws-auth.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
ws-broadcast.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
ws-handshake.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
ws-resync.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
ws-terminal.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00