Commit graph

1269 commits

Author SHA1 Message Date
7Sageer
e83511a711
fix: surface provider auth error for unavailable models (#1506)
* fix: surface provider auth error for unavailable models

When an OAuth-managed model returns 401 after a forced token refresh, the token is valid but the provider rejected it for that model (the account lacks access). Emit provider.auth_error carrying the provider's message instead of auth.login_required with a misleading "OAuth login expired. Send /login" prompt.

* fix(agent-core): preserve provider auth errors through compaction

Treat provider.auth_error like auth.login_required in the compaction path so an auth rejection during compaction surfaces the provider's message instead of being wrapped as a generic compaction failure.
2026-07-08 21:16:44 +08:00
_Kerman
68e07c9be6 fix(agent-core-v2): remember observed compaction context window 2026-07-08 21:16:25 +08:00
7Sageer
e5ec0fb005 fix(agent-core-v2): align v1 wire records 2026-07-08 20:54:21 +08:00
_Kerman
a8a134f64a fix(agent-core-v2): align full compaction with v1 2026-07-08 20:44:37 +08:00
_Kerman
3ea9f8474f Merge branch 'kimi-code-v2' of https://github.com/MoonshotAI/kimi-code into kimi-code-v2 2026-07-08 20:43:37 +08:00
_Kerman
8072f6e547 fix: align background agent guidance 2026-07-08 20:42:50 +08:00
qer
6bdad1328e chore: webSearch & FetchUrl Sync #1260 2026-07-08 20:40:31 +08:00
_Kerman
1be4e0b100 fix(agent-core-v2): align task wait timeout behavior 2026-07-08 20:22:11 +08:00
_Kerman
3bbb8b62f2 Merge branch 'kimi-code-v2' of https://github.com/MoonshotAI/kimi-code into kimi-code-v2 2026-07-08 20:17:21 +08:00
_Kerman
d0af37bbc6 fix: v2 full compaction 2026-07-08 20:16:49 +08:00
_Kerman
f6aa8a8e7b fix: align v2 task observable behavior 2026-07-08 20:02:21 +08:00
Kai
a3f738dd91
fix(agent-core-v2): port v1 Bash tool output cap, saved-output reference, and background gating (#1503) 2026-07-08 20:02:20 +08:00
haozhe.yang
de8a48975a fix(agent-core-v2): read todos from wire model, sanitize replay
- make SessionTodoService a stateless facade over the main agent's TodoModel:
  getTodos reads wire.getModel(TodoModel) live, setTodos only dispatches a
  todo.set op, and onDidChange is bridged from wire.subscribe(TodoModel); the
  in-memory list copy is gone so the live and post-replay views cannot drift
- sanitize todo.set payloads in apply via readTodoItems, so replayed or
  hand-written records cannot poison the model or downstream renders
- update todo tests to a sanitizing/notifying/replaying wire stub and cover
  malformed todo.set replay and main-absent reads
- record the main-agent-wire persistence debt for the ISessionWireService move
2026-07-08 19:37:54 +08:00
_Kerman
157704b82a fix(agent-core-v2): preserve tail in windowed compaction 2026-07-08 19:33:29 +08:00
_Kerman
9b00e799f2 fix(agent-core-v2): align manual compaction tool projection 2026-07-08 19:26:46 +08:00
_Kerman
ad38fd12de fix(agent-core-v2): align blocked compaction failures 2026-07-08 19:15:39 +08:00
7Sageer
e6d3b370f7 Merge branch 'kimi-code-v2' of https://github.com/MoonshotAI/kimi-code into kimi-code-v2 2026-07-08 19:11:42 +08:00
7Sageer
a6b05b2128 fix(agent-core-v2): align MCP tool results with v1 2026-07-08 19:09:52 +08:00
_Kerman
c91c03d4e4 test(agent-core-v2): align truncated compaction retry 2026-07-08 19:07:57 +08:00
haozhe.yang
dd162c7dde fix(agent-core-v2): restore fs.grep streaming early-kill and symlink reporting
- stream `rg --json` in fs.grep and SIGKILL once max_total_matches/max_files is reached, restoring v1 early-stop instead of buffering the whole output
- report symlinks as kind 'symlink' in fs search/list/stat via lstat and never descend into symlinked directories
- remove the unused os grepSearch helper (dead, non-streaming, bypassed ISessionProcessRunner)
2026-07-08 19:04:43 +08:00
haozhe.yang
d11d9b87b7 fix(agent-core-v2): route task timeouts through SIGTERM grace + SIGKILL
- add terminateWithGrace shared by stop, timeoutMs, detachTimeoutMs, and
  track deadlines: cancel/SIGTERM -> 5s grace -> forceStop (SIGKILL)
- coerce a post-abort self-settled `killed` to `timed_out` so a deadline
  stays reported as timed_out, matching v1 settlementForOutcome
- add manager tests for SIGTERM-ignored escalation, graceful-exit within
  the grace window, and detachTimeout teardown
2026-07-08 18:56:27 +08:00
haozhe.yang
3272e22eac fix(agent-core-v2): restore web search source site and citation reminders
- surface source site: add WebSearchResult.siteName, map site_name in the
  Moonshot provider, and render the Site: line in tool output
- restore the per-search inline citation reminder alongside the results
- align web-search.md with v1: source-site/result-summary guidance and the
  static citation reminder
2026-07-08 18:52:08 +08:00
_Kerman
b1cdaf4c6c fix(agent-core-v2): align compaction empty retry 2026-07-08 18:50:03 +08:00
_Kerman
61131840c3 fix(agent-core-v2): align task tool prompts with v1 2026-07-08 18:22:48 +08:00
haozhe.yang
c6b6c30bd4 fix(agent-core-v2): restore native append for Write append mode
- add IHostFileSystem.appendText backed by fs.appendFile (O_APPEND)
- route WriteTool append through it instead of read-then-rewrite, so
  existing content is never read, truncated, or clobbered by concurrent
  writers and a crash mid-append can only lose the new bytes
- update typed host-fs test fakes and WriteTool append assertions
2026-07-08 18:21:03 +08:00
github-actions[bot]
989ca43ff7 ci: release packages (#1468)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-07-08 18:21:03 +08:00
qer
fbedbcd4d7 feat(web): prefix skill slash commands with skill: to distinguish them from built-in commands (#1492) 2026-07-08 18:21:03 +08:00
qer
839715f9e2 fix(web): composer model switch also updates global default model (#1491)
* fix(web): composer model switch also updates global default model

The composer model switcher still switches the active session's model via
POST /sessions/{id}/profile (awaited, so the model pill reflects the result),
and additionally fires POST /api/v1/config with { default_model } as a
fire-and-forget side effect so new sessions inherit the chosen default. The
config request is skipped when the model already matches the current default.

* fix(web): route ModelPicker overlay selection through the default-model update

The overlay opened from the composer's "More models" row (and /model) is a
continuation of the same switch flow, so its selection now also bumps the
global default model instead of only switching the active session.

* fix(web): only persist the default model after a confirmed session switch

setModel now returns whether the switch was accepted (true for the draft
path), so the composer flow no longer writes a stale or invalid model alias
into the global config when the session-level switch failed and rolled back.
2026-07-08 18:21:03 +08:00
liruifengv
4f1f6032d2 feat(web): redesign cron reminder as a message bubble (#1480)
* feat(web): redesign cron reminder as a message bubble

Restyle the cron trigger notice as a right-aligned user-style message bubble that shows the scheduled prompt in full (wrapping across lines), with a small meta row beneath it for the schedule, status, job id and run time. Extract a shared MessageTime component used by both user messages and the cron reminder so the timestamp format and click-to-expand behavior stay consistent, and give the CronCreate/CronList/CronDelete tools distinct calendar icons.

* refactor(web): render cron reminders only as standalone turns

Remove the embedded cron block path from the web transcript projector so cron reminder fires always render through the standalone right-aligned bubble path.

* chore(web): simplify cron redesign changeset
2026-07-08 18:21:03 +08:00
qer
597b2278dd feat(web): support Enter key to confirm archive and other dialogs (#1490) 2026-07-08 18:21:03 +08:00
qer
a26f00ebb5 feat(plugins): add Vercel plugin to marketplace (#1489) 2026-07-08 18:21:03 +08:00
qer
58d923f1bc fix(kimi-code): exit 1 when a headless (-p) turn fails (#1483)
Headless (`kimi -p`) failures could exit with code 0 when the event loop
drained during the shutdown cleanup (e.g. telemetry's unref'd retry backoff
when the network is blocked), because the rejection never reached the
process.exit(1) call. Set the failure exit code before any await in both
the run-prompt catch and the main catch, and keep the cleanup timeout ref'd
so the loop stays alive long enough for the rejection to propagate.
2026-07-08 18:21:03 +08:00
STAR-QUAKE
11cdf2e1c3 feat(agent-core): discard loaded tool schemas on compaction (#1471)
Align progressive tool disclosure with the discard-on-compaction model:
compaction no longer rebuilds loaded dynamic tool schemas. The boundary
announcement re-lists every loadable name, the model re-selects what it
still needs, and a from-memory call to a no-longer-loaded tool is
rejected by preflight with select guidance.

This removes the keep-all rebuild and its half-trigger budget heuristics
entirely: the post-compaction floor is back to users + summary, which is
structurally outside the auto-compaction trigger band, and the guard
baseline degenerates to summary + reinjected reminders. Every downstream
mechanism already treated the empty loaded set as its consistent base
state (ledger scan, pending clear at the compaction boundary, deferred
extras, preflight wording), so this is a strict simplification.

Co-authored-by: fengchenchen <fengchenchen@moonshot.ai>
2026-07-08 18:21:03 +08:00
Luyu Cheng
5c760bebab fix: clarify goal blocked audit guidance (#1481) 2026-07-08 18:21:03 +08:00
_Kerman
42d648e100 feat(kosong): support structured response formats (#1397) 2026-07-08 18:21:03 +08:00
Luyu Cheng
a7a4a1dec7 fix: count goal creation turn (#1477) 2026-07-08 18:21:03 +08:00
Kai
e9b34adc5f fix(agent-core): report EXIF-rotated image dimensions and raise edge cap to 3000px (#1460)
* fix(agent-core): report EXIF-rotated image dimensions and raise edge cap to 3000px

Image compression now reports original dimensions in the decoded
(EXIF-rotated) space, matching the coordinate system of the sent image
and of ReadMediaFile region readback; previously portrait JPEGs
(orientation 5-8) got swapped width/height in captions. The longest-edge
downscale cap rises from 2000px to 3000px, and the default jimp resize
path is documented as the anti-aliased area-average one so it is not
accidentally switched to a point-sampled interpolation mode.

* test: shrink oversized image fixtures to fit CI timeouts

The 3600x3600 fixtures introduced for the 3000px edge cap nearly doubled
the pixel area jimp has to decode and deflate, pushing the slowest
compression tests past the 5s vitest timeout on CI runners. 3600x1800
keeps every fixture over the cap while restoring roughly the workload of
the old 2600x2600 fixtures that CI handled comfortably.

* test: pin anti-aliased downscale quality with executable guards

A 1px checkerboard probe pins the compressor to full-coverage averaging
at integer and fractional ratios, with jimp's point-sampled BILINEAR
mode kept as the executable aliasing counter-example (it collapses the
50%-gray pattern to solid black at 4:1). Also guards the other classic
downscale bugs: transparent-pixel color bleed, mean-brightness drift,
iterative recompression degradation, and zero-size collapse on extreme
aspect ratios.

* fix(agent-core): report decoded EXIF-rotated dimensions in ReadMediaFile notes

The media note derived its original-dimensions line from the header
sniff, which reports pre-rotation values for EXIF orientation 5-8
JPEGs. The sent image and region readback both live in the decoded
(rotated) space, so portrait photos got axis-swapped coordinate
guidance. Once a decode has happened — compression or crop — its
dimensions now overwrite the sniffed ones.

* fix(agent-core): improve handling of EXIF orientation in image dimensions and metadata

* fix(agent-core): sniff EXIF orientation and step budget fallback through 2000px

Two follow-ups to the EXIF and 3000px-cap changes:

sniffImageDimensions now reads the JPEG EXIF Orientation tag (pure
header parse, both byte orders) and reports display-space dimensions
for orientations 5-8. Passthrough images — never decoded — previously
kept the pre-rotation header size in compression results and media
read notes, disagreeing with the decoded space that region readback
uses.

encodeWithinBudget steps the over-budget fallback through 2000px
before the 1000px last resort. Raising the cap to 3000px had left a
regression window: an image whose 2000px encode fits the byte budget
was sent at 1000px where the old 2000px cap used to send it at
2000px.

* fix(kimi-code): record pasted image dimensions in display space

The TUI paste path recorded attachment and original dimensions from its
raw header parser, which ignores EXIF orientation. For a portrait JPEG
the submit-time caption then contradicted the sent image's aspect and
region readback coordinates were axis-swapped. Dimensions now come from
the compression result, which reports display space on both the
compressed and passthrough paths; parseImageMeta remains only the
format/mime gate.

* feat(agent-core): add image compression and crop telemetry

Every image ingestion path now reports an image_compress event —
outcome (compressed / passthrough fast, guard, unsupported, unhelpful,
error), input/output formats, byte and pixel sizes, EXIF transposition,
and duration — and region readback reports an image_crop event with a
failure classification and the region's share of the original area.

Wiring is per call site via a new CompressImageOptions.telemetry
option, so the outcome split and timing are measured inside the
compressor while each caller only names its source: ReadMediaFile
(tool construction, like GrepTool), MCP tool results (McpOutputOptions),
server prompt ingestion (ICoreProcessService now exposes the host
telemetry client), ACP prompts (session track adapter), and TUI paste
(host.track adapter). Properties are numeric/enum only — never paths
or content — and a throwing client can never affect the compression
result.

* fix(agent-core): run the full JPEG quality ladder at fallback sizes

The fallback rescales encoded only at quality 20, so a JPEG whose
ladder failed at the fitted size collapsed straight to the lowest
quality even when the smaller size left budget headroom for a higher
rung (the realistic window is the 1000px step, where the 4x pixel
drop pays for q80/q60). Each fallback edge now walks the same
q80-to-q20 ladder as the fitted size.

* test: shrink heavy JPEG fixtures and add explicit timeouts

The fallback-ladder test runs ~11 pure-JS JPEG encodes and the EXIF
paste test decodes, rotates, and re-encodes a 6.5MP frame; both sat at
the edge of the 5s vitest timeout on CI runners. Narrower fixtures cut
the pixel area (the ladder test keeps its width above 2000px so the
full fallback chain still runs) and explicit 15s timeouts absorb runner
variance.

* fix(server): scope prompt image compression telemetry to the session

The prompt-ingestion image_compress events were emitted with the bare
host telemetry client, while every agent-side source inherits a
session-scoped client — so prompt_inline/prompt_file events could not
be correlated with their session. The route now wraps the client with
withTelemetryContext({ sessionId }) like rpc/core-impl does for
session telemetry.

* chore(changeset): consolidate image compression changesets

One entry covering the cap raise and the EXIF dimension fix, listed
for both the CLI and the SDK so the SDK changelog's compression
description (previously pinned at 2000px) stays accurate.
2026-07-08 18:21:03 +08:00
_Kerman
31d8adec49 test(agent-core-v2): cover concurrent agent background limit 2026-07-08 18:16:20 +08:00
_Kerman
f3adee7037 Merge branch 'kimi-code-v2' of https://github.com/MoonshotAI/kimi-code into kimi-code-v2 2026-07-08 18:15:56 +08:00
_Kerman
5c076183ac fix(agent-core-v2): preserve compaction hook session 2026-07-08 18:14:07 +08:00
Kaiyi
0dfc99daf2 fix(agent-core-v2): align AskUserQuestion tool chain with v1
- translate wire ids back to question text / option labels when resolving
  a question over REST, joining multi-select labels with ', '
- enforce unique question texts / option labels and non-empty strings at
  both the schema and the execution path
- cancel pending questions on turn abort or background task stop by
  dismissing the parked entry (resolves null, v1 broker semantics)
- restore the unsupported-client fallback and dismissed-error handling
- pass empty header / option description through verbatim and align the
  model-facing tool description byte-for-byte with v1
- drop the synthetic expires_at field from the question wire shape
2026-07-08 18:14:01 +08:00
7Sageer
4977ccb445 Merge branch 'kimi-code-v2' of https://github.com/MoonshotAI/kimi-code into kimi-code-v2 2026-07-08 18:12:35 +08:00
7Sageer
8bd9dcd5af feat(agent-core-v2): record llm request traces 2026-07-08 18:11:58 +08:00
_Kerman
65ad6ab5ac fix(agent-core-v2): restore task resume parity 2026-07-08 18:07:44 +08:00
_Kerman
d1c70e53db chore: remove agent swarm changeset 2026-07-08 18:06:43 +08:00
_Kerman
d1a275de8f fix: align v2 grep behavior with v1 2026-07-08 18:00:44 +08:00
_Kerman
ca237a0264 fix: align v2 compaction auth guards 2026-07-08 17:58:52 +08:00
_Kerman
e3fb6d249e Merge branch 'kimi-code-v2' of https://github.com/MoonshotAI/kimi-code into kimi-code-v2 2026-07-08 17:54:50 +08:00
7Sageer
b9362ccfe4 fix: align MCP discovery and output with v1 2026-07-08 17:51:16 +08:00
_Kerman
c34eeb75bd fix: report v2 compaction retry telemetry 2026-07-08 17:50:54 +08:00