Commit graph

1683 commits

Author SHA1 Message Date
qer
632359d59c fix(cli): point the resume hint at the session folder after the default moves
A session started with --default-workspace printed
kimi --default-workspace -r <id> on exit even if default_workspace.path
changed while it was open. Following that hint moved into the new default
folder and refused the session, which still lives in the old one.

Repeat the flag only while the session folder is still the default
workspace; otherwise print cd <folder> && kimi -r <id>.
2026-10-15 19:47:12 +08:00
qer
b9e13d35ce Merge branch 'qer/default-workspace-location' into qer/default-workspace-cli 2026-10-15 19:45:17 +08:00
qer
e68b4119ff fix(server): declare 40001 on PATCH /default-workspace and log failed broadcasts
The PATCH route returns 40001 when the body fails validation, but its
OpenAPI response union only listed success and 40930, so generated clients
could not model it.

When the default workspace location changed but the workspace catalog
could not be read, the publisher dropped the broadcast without a trace.
Log a warning so the missing event.workspace.updated can be diagnosed.
2026-10-15 19:45:03 +08:00
qer
89c4d610e0 Merge branch 'qer/default-workspace-unavailable-error' into qer/default-workspace-location
# Conflicts:
#	packages/agent-core-v2/src/app/defaultWorkspace/defaultWorkspaceService.ts
2026-10-15 19:43:17 +08:00
qer
e50d0d3386 Merge remote-tracking branch 'origin/qer/default-workspace-unavailable-error' into qer/default-workspace-unavailable-error 2026-10-15 19:42:21 +08:00
qer
bc3dd3a4ca fix(server): never remove a write probe the check did not create
createExclusive resolves to false when the probe name already exists. The
write check ignored that result and went on to remove the path, which is a
recursive delete of an entry it did not create. Report the folder as
unknown instead and leave the entry alone.
2026-10-15 19:42:04 +08:00
qer
be490fe3c1
Merge branch 'main' into qer/default-workspace-unavailable-error 2026-10-15 04:38:43 -07:00
qer
c1459a6184
fix(server): run agent hooks in the session's working directory (#4242)
Agent-level hooks such as PreToolUse, UserPromptSubmit, Stop and PreCompact,
plus hooks fired from the event bus, did not pass a cwd, so the runner fell
back to the directory the engine was started from. Session-level hooks
already used the session directory, and the hooks documentation says the
working directory is the session's project directory. A server hosting
several workspaces, or a CLI that changes directory after the engine starts,
ran these hooks in the wrong place.
2026-10-15 19:38:24 +08:00
qer
3503f7e58c feat(cli): add --default-workspace and expose the default workspace in the SDK
Add kimi --default-workspace to work in the shared default workspace instead
of the current directory. Both the interactive shell and print mode resolve
the folder through the engine before the session starts and change into it,
keeping PWD in sync; when the folder cannot be used, startup fails with its
path and reason. Resume hints become kimi --default-workspace -r <id> for
such sessions.

The session picker labels sessions in the default workspace as "Default
workspace" and copies a resume command without a cd for them. kimi doctor
reports the location and whether it can be used. The stty lookup excludes
both the launch directory and the new working directory, so a binary
planted in either is never executed.

The SDK gains KimiHarness.ensureDefaultWorkspace(), getDefaultWorkspacePath()
and getDefaultWorkspaceStatus(), maps default_workspace.unavailable to a
KimiError, and exports workspaceRootKey and DEFAULT_WORKSPACE_PROBLEM_MESSAGES.
2026-10-15 19:18:45 +08:00
7Sageer
85077a4190
fix: align subagent tool descriptions with availability (#4066)
* fix: align subagent tool descriptions with availability

* chore: add subagent tool availability changeset

* fix: align unrestricted subagent media tool descriptions

* fix: gate subagent dynamic tool descriptions by model support

* fix: remove per-step tool activation refresh

* fix: preserve registered tools across availability changes

* chore: revert unintended oxlint auto-fixes from merge commit

* test: trim redundant tool availability description cases
2026-10-15 19:18:13 +08:00
qer
9043cfe8aa feat(server): make the default workspace location configurable
The default workspace was fixed at <Documents>/KimiCode/Default. Users who
keep chats on another disk, or whose Documents folder is synced, had no way
to move it.

Add a default_workspace.path setting in config.toml. It accepts an absolute
path or ~/..., and on Windows only a drive path or a full UNC share; the
value is checked for writability before it is saved and is never moved
silently. An invalid value in the file is reported as invalid_path instead
of falling back to the system location.

The server exposes GET and PATCH /api/v1/default-workspace with the
effective path, the saved custom path, the system path and the folder's
health. The section is kept out of GET /api/v1/config and rejected by
POST /api/v1/config so it has a single writer. Whenever the location
changes, through PATCH or an edit to config.toml, every registered
workspace broadcasts event.workspace.updated with its current is_default.
2026-10-15 19:17:02 +08:00
qer
753ba6ef27 feat(server): report an unusable default workspace with its path and reason
Creating a session in the default workspace used to surface folder problems
as generic codes: 40409 when a file blocked the path or the Windows
Documents folder could not be located, 40411 on permission errors, and a
plain internal error for anything else. Clients could not tell the default
workspace apart from an ordinary missing directory, nor explain what to fix.

DefaultWorkspaceService now throws DefaultWorkspaceUnavailableError
(default_workspace.unavailable) carrying the folder path and one of
blocked_by_file, permission_denied, missing_parent, no_space, read_only,
invalid_path, documents_unavailable or unknown. ensure() also verifies that
a file can be created and removed in the folder, so a read-only folder is
reported before a session is placed there. The server maps the error to
40930 with { path, reason } in data.
2026-10-15 19:14:52 +08:00
Kai
da5918c0c8
fix(agent-core-v2): nudge the agent to keep its todo list current (#4239)
* fix(agent-core-v2): nudge the agent to keep its todo list current

- Remind only while the list still has pending or in_progress items, and
  drop the first-use arming gate so compaction and /undo no longer arm the
  reminder for agents that never used TodoList.
- Remind after 5 steps without an update (was 10) with text that names the
  step count, progress, and the item still in progress, instead of the
  gentle "ignore it if not applicable" wording.
- Replace the static TodoList write echo with a next step for the current
  list state.
- Drop the churn warnings that discouraged updates from the TodoList
  description, say the list is a live progress panel, and add a TodoList
  paragraph to the system prompt when the tool is active.
- Track todo_list_written, todo_reminder_shown, and todo_turn_ended.

* fix(agent-core-v2): address todo reminder review feedback

- Ask the agent to mark the last open item done only once it is finished;
  if it stays blocked or unfinished, keep it in_progress and say what
  remains in the reply.
- Emit todo_turn_ended for turns that cleared the list, so cleared lists
  count toward the stale-list ratio instead of being dropped.
2026-10-15 17:14:41 +08:00
Rick
034117338c
fix(vscode): add back navigation when AskUserQuestion (#4186) 2026-10-15 16:27:13 +08:00
7Sageer
5bab748ddd
feat(tui): auto-generate session title after the first turn (#4200)
* feat(tui): auto-generate session title after the first turn

* Update tui-auto-session-title.md

Signed-off-by: 7Sageer <sag77r@hotmail.com>

* feat(tui): gate auto session title behind a tui.toml auto_session_title toggle

---------

Signed-off-by: 7Sageer <sag77r@hotmail.com>
2026-10-15 15:31:02 +08:00
qer
6ffd193e09 fix(server): start Windows PowerShell by absolute path
The Documents lookup spawned the bare name powershell.exe, so Windows
resolved it through the current directory and PATH. In an untrusted
checkout that lets a repository-provided powershell.exe run before the
trust gate. Resolve it under SystemRoot (falling back to windir and
then C:\Windows) instead.
2026-10-15 15:16:22 +08:00
liruifengv
9f0693becb
feat(oauth): parse unified /models schema for managed Kimi Code models (#4209)
* feat(oauth): parse unified /models schema for managed Kimi Code models

* fix(oauth): treat absent reasoning metadata as non-thinking
2026-10-15 15:10:54 +08:00
qer
6ea7af42c8 test(server): assert the existing error code for a missing Windows Documents folder 2026-10-15 13:55:42 +08:00
qer
b92649b0ef fix(server): resolve Windows Documents through the shell folder API
Reading User Shell Folders with reg.exe misses the default when the value is
absent, cannot expand every variable, and is blocked where registry tools are
disabled by policy. Ask Windows for the Documents folder through PowerShell
instead, forcing UTF-8 output so non-ASCII paths survive. A reported folder
that does not exist is treated as unresolved, so garbled output can never
create a workspace in the wrong place.
2026-10-15 13:34:53 +08:00
tpoisonooo
60adab4c32
docs(tower): add description (#4216)
* docs: add Tower user guide

* docs: clarify Tower benefits and dependency gates

* docs(tower): add guides

* fix(docs): accept review advices

* docs(tower): remove keep_alive_on_exit

---------

Co-authored-by: konghuanjun <konghuanjun@moonshot.ai>
2026-10-15 12:56:05 +08:00
qer
b99f3eae4f
Merge branch 'main' into qer/default-workspace 2026-10-14 21:36:10 -07:00
Kimi Agent
b2603264ec
fix(google-genai): map thinking effort off to LOW for Gemini 4 models (#4230)
* fix(google-genai): map thinking effort off to LOW for Gemini 4 models

Gemini 4 supports only LOW/MEDIUM/HIGH thinking levels and always thinks;
sending MINIMAL for effort=off makes every request fail with a 400. Degrade
'off' to LOW (thoughts still hidden) for gemini-4 models in both the
agent-core-v2 requester and the legacy kosong provider, keeping MINIMAL for
Gemini 3.

Co-authored-by: 7Hanrui <qihanrui@moonshot.ai>

* fix(google-genai): drop comment in comment-free agent-core-v2 source

Co-authored-by: 7Hanrui <qihanrui@moonshot.ai>

* fix(google-genai): preserve effort off in thinkingEffort for Gemini 4

LOW with suppressed thoughts is the Gemini 4 encoding of 'off', so map it
back to 'off' in the thinkingEffort getter instead of reporting 'low'.

Co-authored-by: 7Hanrui <qihanrui@moonshot.ai>

* fix(google-genai): keep explicit LOW kwargs reported as low on non-Gemini-4

Only Gemini 4 encodes 'off' as LOW with suppressed thoughts, so gate the
reverse mapping on the model; a caller-supplied LOW/includeThoughts=false on
other models keeps reporting 'low'.

Co-authored-by: 7Hanrui <qihanrui@moonshot.ai>

* fix(google-genai): report LOW as low in thinkingEffort again

Gemini 4 encodes 'off' as LOW with suppressed thoughts, which is
indistinguishable from an explicit LOW/includeThoughts=false kwarg, so no
reverse mapping can serve both callers. Nothing in the repo reads this
getter to persist or display effort, so keep the derive-from-kwargs
semantics; for Gemini 4's 'off', 'low' is the honest report of what runs.

Co-authored-by: 7Hanrui <qihanrui@moonshot.ai>

* fix(google-genai): reject thinking effort off for Gemini 4 models

Gemini 4 supports only LOW/MEDIUM/HIGH thinking levels and always thinks,
so requesting effort 'off' now fails fast with a clear thinking-config
error (matching the always-reasons rejection other protocols already use)
instead of sending an invalid MINIMAL level or silently degrading to LOW.

Co-authored-by: 7Hanrui <qihanrui@moonshot.ai>

---------

Co-authored-by: kimi-agent-bot <kimi-agent-bot@users.noreply.github.com>
Co-authored-by: 7Hanrui <qihanrui@moonshot.ai>
2026-10-15 12:34:28 +08:00
qer
e0de112931 fix(server): fail instead of relocating when Windows Documents cannot be resolved
A failed registry lookup used to fall back to %USERPROFILE%\Documents, which
could silently create a second default workspace when Documents is redirected
(for example by OneDrive). The lookup now fails with 40409, the failure is not
cached so the next request retries, and is_default reports false meanwhile.
2026-10-15 12:32:43 +08:00
qer
edbe0ba85f
Merge branch 'main' into qer/default-workspace 2026-10-14 21:06:43 -07:00
Haoyang Ma
20b59915bb
fix(google-genai): use thinking level for Gemini 4 models (#4208)
* fix(google-genai): use thinking level for Gemini 4 models

The thinking parameter is picked by a hard-coded `gemini-3` name check, so
Gemini 4 model ids fall through to `thinkingBudget`, which the Gemini API
rejects with HTTP 400 ("Thinking budget is not supported for this model.
Use thinking level instead."). Add `gemini-4` to the same check in both the
engine copy and the legacy kosong provider; Gemini 3 and earlier keep their
current encoding.

* chore(changeset): keep the Gemini 4 entry to the user-facing outcome

* test(google-genai): use the real Gemini 4 model id in the thinking tests

---------

Co-authored-by: Selene <mahaoyang@corp.netease.com>
2026-10-15 11:21:44 +08:00
Kimi Agent
d4b9dc4a2d
docs(changelog): sync 2.2.0 from apps/kimi-code/CHANGELOG.md (#4223)
Some checks are pending
CI / test-vscode-legacy (push) Waiting to run
CI / release-workflow-tests (push) Waiting to run
CI / build (push) Waiting to run
CI / test (1) (push) Waiting to run
CI / test (2) (push) Waiting to run
CI / test (3) (push) Waiting to run
CI / test (4) (push) Waiting to run
CI / test (5) (push) Waiting to run
CI / test-pi-tui (push) Waiting to run
CI / test-windows (push) Waiting to run
CI / lint (push) Waiting to run
CI / typecheck (push) Waiting to run
Nix Build / Check flake.nix workspace sync (push) Waiting to run
Nix Build / nix build .#kimi-code (push) Blocked by required conditions
* docs(changelog): sync 2.2.0 from apps/kimi-code/CHANGELOG.md

* docs(changelog): restore notify_user feature entry and document fullscreen enablement

* docs(changelog): simplify notify_user enablement to /experiments panel

* docs(changelog): drop non-public KIMI_CODE_TRUST_WORKSPACE entry

* docs(changelog): drop one-line title from notify_user entry

---------

Co-authored-by: kimi-agent-bot <kimi-agent-bot@users.noreply.github.com>
2026-10-15 00:15:53 +08:00
Kimi Agent
a9e764db61
chore: sync release 2.2.0 back to main (#4222)
* feat(kap-server): add remote control device deletion (#4192) (#4195)

* feat(kap-server): add remote control device deletion

* fix(kap-server): coordinate with the local tunnel before deleting this machine's device

Co-authored-by: liruifengv <liruifeng1024@gmail.com>

* ci: enable recoverable publishing for the October release (#4218)

* ci: publish core releases from isolated release branches

* ci: simplify release recovery to the CLI package

* ci: publish VS Code from approved release commits

* test: await release test registration for type-aware lint

* test: avoid assuming order of independent tower events

* ci: limit release migration to existing publishing flow

* chore: sync web dist from code-app (#4221)

* chore: sync web dist from code-app

code-app: f828bac439ab5b9266ff8387c2afb96ecfcb59ae

* ci: retrigger (flaky rpc-events teardown ENOTEMPTY)

---------

Co-authored-by: kimi-agent-bot <kimi-agent-bot@users.noreply.github.com>

* ci: release packages (#4220)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: qer <wbxl2000@outlook.com>
Co-authored-by: liruifengv <liruifeng1024@gmail.com>
Co-authored-by: kimi-agent-bot <kimi-agent-bot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-10-15 00:14:11 +08:00
qer
5ea94e0bd8 feat(server): create sessions in a default workspace when none is chosen
POST /api/v1/sessions accepts default_workspace: true, exclusive with
workspace_id and metadata.cwd. The server resolves <Documents>/KimiCode/Default
on every request, creates it on first use, and reuses it afterwards. A path
blocked by a file fails with 40409 and a permission error with 40411; the
server never relocates silently.

Workspace payloads on REST and WebSocket events carry is_default.
2026-10-14 23:52:53 +08:00
qer
d1c3b048fd
ci: publish core releases from isolated release branches (#4217)
* ci: publish core releases from isolated release branches

* ci: simplify release recovery to the CLI package

* ci: publish VS Code from approved release commits

* test: await release test registration for type-aware lint

* test: avoid assuming order of independent tower events

* ci: limit release migration to existing publishing flow
2026-10-14 22:35:59 +08:00
Haozhe
f28c51c01f
feat(agent-core-v2): add global default for deferred MCP tool disclosure (#4210)
* feat(agent-core-v2): add global default for deferred MCP tool disclosure

* feat(agent-core-v2): capture the deferred MCP default at server connect time
2026-10-14 17:19:29 +08:00
grapedge
83a39b49ed
perf(tui): stop blocking the footer on git status (#4201) 2026-10-14 15:08:59 +08:00
7Sageer
0327e8e9a8
feat: support model migration metadata (#4171)
* feat: support model migration metadata

* chore: revert web bundle sync

* feat: persist model upgrade metadata

* fix: resolve model upgrade targets

* fix: keep model upgrade metadata consistent

* fix: complete model upgrade metadata handling

* fix: handle aliased upgrade targets and RFC3339 variants

* fix: resolve bare model upgrade targets

* feat: prompt for model migration in the TUI

* fix(tui): defer model migration until the editor is idle

* fix(tui): preserve model migration prompts and preferences

* fix(tui): hold the model migration prompt while /new replaces the session

* fix(tui): keep the resume cache hint from replacing an open dialog

* fix(tui): keep the thinking effort across a model migration when supported

* fix(tui): strip terminal control sequences from migration notices

* fix(tui): warn about prompt cache loss before a mid-conversation migration

* docs: drop the effort persistence claim from the migration wording

* test: trim redundant migration test cases

* fix: switch to the declared replacement when a registry drops the default model

A registry retires a model by dropping it after declaring `upgrade`, but
the refresh deleted the alias together with its upgrade metadata and
cleared the default, leaving users without a model and with a misleading
login hint. Refresh and re-import now move a dropped default to the
upgrade target persisted by an earlier refresh, clearing it as before
when that target is gone too. The TUI warns about the switch and moves
the live session off the dropped model once no dialog is open.

* docs: fix the /reload-tui command spelling in config-files

* fix: resolve migration placeholders at import and keep acknowledgements out of tui.toml

Migration text placeholders were only filled in by the TUI, so the model
catalog served raw templates to every other client. The registry import
now stores the final text and the TUI renders it as is.

Migration acknowledgements are display state rather than preferences, so
they now live in model-migrations.json under the data directory instead of
tui.toml; preference saves and acknowledgements no longer rewrite each
other, and /reload has nothing to sync.

Also carry the dropped model's record in the refresh result instead of
snapshotting it in the TUI, give performModelSwitch explicit persistence
modes instead of a boolean-or-mode flag, fold the Markdown notice into the
picker's notice option, and rename waitForLazyCreation to
waitForSessionAssembly now that it also waits for /new.

* refactor(tui): move the shared model switch out of the /model command

performModelSwitch and its helpers became shared once the migration
prompt and the retired-default switch started calling them, yet they
stayed in the /model command module, leaving a controller depending on
command internals. Move them unchanged to tui/utils/model-switch.ts, which
the command module and the migration controller now both import.

* feat: surface retired default model redirects in refresh results and catalog events

A registry-side retirement only existed in the OAuth orchestrator's
in-process RefreshResult, so kap-server's scheduled refreshes redirected
the default model without any client-visible signal. The refresh response
now carries an optional retired_default { from, to, from_model }, mapped
through to the REST refresh endpoints and the global
event.model_catalog.changed broadcast, and mirrored in the klient
contract.

* refactor(tui): consume the engine's provider refresh instead of orchestrating its own

The TUI ran the OAuth refresh orchestrator in-process through its own
persistence host (including a dead v1 fallback), duplicating what the
engine's discovery service already does. KimiHarness now exposes
refreshProviderModels (via the klient facade over
IProviderDiscoveryService), so the TUI deletes its orchestration glue and
reads retired_default from the engine response. Also fix the klient
facade deriving RefreshProviderModelsResponse from the OAuth login
refresh, which hid retired_default from clients.

* feat: move model retirement follow-through into the engine

The discovery service now records retirements, emits onDidRetireModel,
and answers retiredModelReplacement; agent profiles follow a retirement
live and on restore, so the TUI only shows the notice and steers the
session-less selection. The wire retired_default drops from_model in
favor of an engine-resolved from_display_name. Removes the now-dead
supportsAtomicSectionReplace / replaceConfigSections /
removeProviderFromConfig SDK exports (no remaining consumers).

* Update model migration guidance in documentation

Prompt for migration when the TUI editor is idle and switch to the declared replacement when a registry drops the default model.

Signed-off-by: 7Sageer <sag77r@hotmail.com>

* test(oauth): drop the duplicate dropped-default redirect case

---------

Signed-off-by: 7Sageer <sag77r@hotmail.com>
2026-10-14 14:24:01 +08:00
Kimi Agent
7e58f2d241
fix(kimi-code): keep the previous turn's answer visible when a task-notification turn ends (#3799) 2026-10-14 13:29:14 +08:00
liruifengv
b510fa9aec
feat(kap-server): add remote control device deletion (#4192)
Some checks failed
CI / build (push) Has been cancelled
CI / test (1) (push) Has been cancelled
CI / test (2) (push) Has been cancelled
CI / test (3) (push) Has been cancelled
CI / test (4) (push) Has been cancelled
CI / test (5) (push) Has been cancelled
CI / test-pi-tui (push) Has been cancelled
CI / test-vscode-legacy (push) Has been cancelled
CI / test-windows (push) Has been cancelled
CI / lint (push) Has been cancelled
Release / Release (push) Has been cancelled
Publish VS Code extension / Publish VSIX to marketplaces (push) Has been cancelled
CI / typecheck (push) Has been cancelled
Nix Build / Check flake.nix workspace sync (push) Has been cancelled
Release / Deploy docs (push) Has been cancelled
Release / Native release artifact (push) Has been cancelled
Nix Build / nix build .#kimi-code (push) Has been cancelled
Release / Publish native release assets (push) Has been cancelled
* feat(kap-server): add remote control device deletion

* fix(kap-server): coordinate with the local tunnel before deleting this machine's device
2026-10-13 19:58:01 +08:00
oocz
3f0857eb7d
feat(agent-core-v2): register plugin skills under qualified names and relax plugin name validation (#4188)
* feat(agent-core-v2): register plugin skills under qualified names and relax plugin name validation

* docs: document qualified plugin skill names and relaxed plugin name validation

* fix(tui): prefer plugin commands over same-named plugin skill shorthand

---------

Co-authored-by: yuchengzhen <yuchengzhen@moonshot.cn>
2026-10-13 19:41:48 +08:00
STAR-QUAKE
e4c99a3bad
feat(agent-core-v2): distinguish session-unavailable tools and explain select_tools failures (#4190)
* feat(agent-core-v2): distinguish session-unavailable tools in select_tools

* fix(agent-core-v2): explain tool selection failures and repeated guesses

* fix(agent-core-v2): keep failure counts honest in mixed select_tools batches

- Reuse the globalPolicy cache for denial checks instead of bypassing it.
- A successful name now only resets the consecutive-failure streak and
  clears its own failure record; failed names in the same batch keep
  accumulating attempts instead of being masked by sibling successes.

* fix(agent-core-v2): honor tool source in policy checks and announce empty loadable sets

- Evaluate deny globs with the registered tool's real source; only
  unregistered names fall back to the mcp__ prefix inference.
- Keep select_tools callable via the disclosure check so a profile
  allowlist omission no longer mislabels it as policy-denied.
- Announce the empty loadable state once for legacy sessions whose
  last announcement lacks it, then stay silent.
2026-10-13 19:39:31 +08:00
liruifengv
c69bd6c5a0
feat(kap-server): add remote control device management (#4169)
* feat(kap-server): add remote control device management

* feat(remote-control): tag share URLs with the caller's platform source

The share link's from query parameter was hardcoded to kimi_code_cli, so
links created by the desktop app were mislabeled as CLI traffic.

buildRemoteControlUrl now takes the source explicitly and
RemoteControlOptions carries it as urlSource; kap-server threads
hostIdentity.platform through, so desktop hosts produce
from=kimi_code_desktop while CLI hosts keep from=kimi_code_cli.

* fix(kap-server): stop the local tunnel when the current device is deactivated or deleted

The device management routes only called the cloud API. When the target
device is the machine itself, the local tunnel kept running: after the
relay drops it, the client reconnects and re-registers, so the device
came back online (or was recreated after a delete) and the local status
never returned to off.

After a successful cloud deactivate/delete of the current device, the
routes now also disable the local tunnel manager.

* feat(kap-server)!: drop the remote-control device delete route

Device removal is collapsed to a single deactivate verb: the desktop UI
deactivates devices instead of deleting them, so the DELETE
/remote-control/devices/{id} route and the device client's deleteDevice
go away before this API ever ships.

* feat(kap-server): carry the lock holder in the already-running error

The enable route now returns the RemoteControlAlreadyRunningError holder
(pid, local origin, device id, url, started_at) in the error envelope's
details, documented with a details schema, so desktop can render a
structured conflict state instead of the raw message.

* feat(kap-server): expose the lock conflict in the remote control status

The manager now surfaces the holder when its last enable error is an
already-running lock conflict, and GET /remote-control returns it as a
structured conflict field, so clients can present the conflict state
proactively instead of parsing the error message.

* feat(kap-server): resolve the remote control lock conflict live in status

GET /remote-control now re-inspects the machine lock whenever the
manager is off: a live holder is reported as the conflict even without
a prior enable attempt in this process, and a stored conflict plus its
error text are dropped once the holder's process is gone. Panel state
refreshes such as after device deactivation now reflect reality.

* feat(kap-server): wait for the lock holder to release on current-device deactivation

When the deactivated device is the machine's own and the lock is held
by another live process (e.g. a CLI instance whose tunnel the relay is
about to terminate with user_requested), the route now polls the lock
for up to two seconds before responding, so a client's immediately
following status read sees the settled conflict-free state.

* style(kap-server): silence promise-executor-return in lock release wait

* test(remote-control): pass urlSource in the close-reason cases

* feat(kap-server)!: register remote control devices with the host product name

* refactor(cli): source the remote control identity from app constants

* fix(remote-control): make starts cancellable and harden logout cleanup

* fix(remote-control): close the remaining cancellation and invalidation races

* fix(kap-server): sweep remote control cleanup once more after logout

* docs: note the lock-release failure of remote control deactivation

* fix(remote-control): key cloud sessions by credential and settle cancelled starts

* fix(kap-server): block remote control starts during logout and serialize tunnel toggles

* fix(kap-server): gate local starts during current-device deactivation

* fix(kap-server): match active tunnel ids on deactivation and re-clear sessions after logout

* fix(kap-server): serialize Kimi logouts, harden lock cleanup, and whitelist device fields

* fix(remote-control): abort pending handshakes on close and answer logout before tunnel teardown

* fix(remote-control): cancel enables that are still queued behind a pending disable

* fix(kap-server): recognize foreign logout gates and retry post-logout tunnel teardown

* fix(remote-control): verify the machine lock after disable and recheck deactivation

* feat(kap-server): export loadOrCreateServerToken for host token provisioning
2026-10-13 17:40:24 +08:00
grapedge
afd95f64a5
feat(tui): unify skill prompts and steering (#4165) 2026-10-13 12:17:14 +08:00
7Sageer
fed19d24f0
feat(agent-core-v2): report fork request prefix parity in the prompt cache probe (#4179)
* feat(agent-core-v2): report fork request prefix parity in the prompt cache probe

The fork prompt cache probe only reported the child's cache usage, so a low
hit rate could not be told apart between a client-side prefix divergence and
a server-side miss, and the hit rate itself was diluted by the new tail that
can never be cached.

The requester now keeps a snapshot of each agent's last completed turn
request (the tools and system prompt hashes it already records in
llm.request, input tokens and timing). A forked agent captures its parent's
snapshot when it is created and reports tools_match, system_prompt_match,
parent_input_tokens and parent_request_gap_ms with its first request.

* fix(agent-core-v2): clear the parent request snapshot when the context is rewritten

Undo and compaction rewrite the parent context without touching the
non-persisted snapshot, so a /btw fork made before the next turn request
compared against a request whose input the child no longer inherits.

* fix(agent-core-v2): drop stale parent baselines from the fork cache probe

The probe compared the child's first request against the parent snapshot
captured at scope creation, but a parent undo or compaction landing
before the context copy left that snapshot describing a request the
child no longer inherits, and a model switch between the parent's last
turn and the fork compared across cache namespaces that can never share
a prompt cache.

The probe now watches the parent's ContextSpliced/ContextUndone events
and drops the captured snapshot once the parent context is rewritten,
and the snapshot carries the model alias so the comparison fields and
the parent input token baseline are only reported when both sides ran
the same model.

* fix(agent-core-v2): keep the turn request snapshot across conversation undo

Undo only truncates the tail of the parent context, so the request a
/btw fork inherits is still a strict prefix of the request the parent
last cached: the server cache keeps hitting and the snapshot's hashes
stay accurate. Clearing the snapshot on undo threw away a baseline
that was still valid, and made the requester depend on the undo
domain for no benefit. Only compaction rewrites the prefix, so it
remains the sole event that clears the snapshot.

* refactor(agent-core-v2): validate the fork cache probe baseline by context prefix revision

The requester subscribed to ContextSpliced solely to keep a telemetry
snapshot fresh, which made the module understand context rewrites and
grow an event bus dependency for the probe's sake. The probe's own
subscription could not cover forks created after a compaction either,
which is the only reason the requester had to listen at all.

Context memory now exposes a prefix revision that increments on every
deleting splice, the turn request snapshot records the revision it was
taken at, and the probe compares it with the parent's current revision
at probe time. Read-time validation covers both the compact-then-fork
and the fork-then-compact windows with no subscriptions, and the
requester is back to only recording facts about its own requests.

* fix(agent-core-v2): stamp the turn request snapshot with the build-time context revision

The public SDK clearContext path has no busy check and can empty the
parent context while a turn request is in flight. Reading the revision
at completion stamped the snapshot with the post-clear value, so a
later fork saw matching revisions and hashes and silently attributed
the client-side prefix divergence to the server. The request input is
fixed by recordRequest time, so capture the revision in the same
synchronous block; a mid-flight clear then leaves the snapshot on the
pre-clear revision and the probe drops the baseline on comparison.

* fix(agent-core-v2): capture the snapshot context revision where the request messages are copied

The build-time capture still ran after the awaited media resolution,
so a clearContext or compaction landing in that window stamped the
snapshot with the post-rewrite revision for a request whose messages
were copied earlier. resolveRequest is synchronous and copies the
context messages there, so the revision captured alongside the copy
always describes the same context the request was built from.

* fix(agent-core-v2): omit the parent token baseline when the parent request reported no usage

A provider that completes without a usage event left the snapshot with
inputTokens: 0, so a later same-model fork emitted parent_input_tokens: 0
and the input_cache_read / parent_input_tokens analysis divided by zero
or treated an unknown baseline as real. The field is now optional and
absent for that snapshot, which the optional telemetry property already
allows.
2026-10-13 11:15:41 +08:00
7Sageer
cbd754049a
chore: remove unused kaos package and MCP kaos executor option (#4184)
Some checks are pending
CI / build (push) Waiting to run
CI / test (1) (push) Waiting to run
CI / test (2) (push) Waiting to run
CI / test (3) (push) Waiting to run
CI / test (4) (push) Waiting to run
CI / test (5) (push) Waiting to run
CI / test-pi-tui (push) Waiting to run
CI / test-vscode-legacy (push) Waiting to run
CI / test-windows (push) Waiting to run
CI / lint (push) Waiting to run
CI / typecheck (push) Waiting to run
Nix Build / Check flake.nix workspace sync (push) Waiting to run
Nix Build / nix build .#kimi-code (push) Blocked by required conditions
Release / Release (push) Waiting to run
Release / Deploy docs (push) Blocked by required conditions
Release / Native release artifact (push) Blocked by required conditions
Release / Publish native release assets (push) Blocked by required conditions
Publish VS Code extension / Publish VSIX to marketplaces (push) Waiting to run
* chore: remove unused kaos package and MCP kaos executor option

* chore: update nix pnpmDeps hash after kaos removal

* chore: harden resume coalesce key against legacy kaos arguments and condense changesets

* chore: strip legacy kaos options before forwarding session RPCs

* chore: drop ssh2 overrides left unused by kaos removal
2026-10-12 18:43:56 +08:00
Kai
c15638b0a1
fix: cancel in-flight video uploads when media reads are interrupted (#4183) 2026-10-12 17:02:18 +08:00
Kai
0a3a2fbafa
feat: add NotifyUser progress display to desktop and web (#4159)
* feat: show NotifyUser progress in desktop and web

Give NotifyUser a one-line title, report the latest update on the
session status, and forward subagent updates to the parent so GUI
clients can show them on subagent cards.

* feat: turn on NotifyUser progress updates by default

Flip the notify_user flag default to true; the flag stays as the opt-out
(`[experimental] notify_user = false` or KIMI_CODE_EXPERIMENTAL_NOTIFY_USER=0).
Register the new subagent.update wire record in the vis renderers and
record-type union so the manifest coverage test passes.

* refactor: trim NotifyUser surfaces to conversation progress rows

* feat: make NotifyUser title optional and enforce single-line titles

* feat: make NotifyUser opt-in via the settings lab

* docs: describe NotifyUser as off by default with the settings lab opt-in
2026-10-12 17:01:36 +08:00
Haozhe
7f0ff53c8a
fix(remote-control): exit the web server when the relay takes the device offline (#4182)
* fix(remote-control): exit the web server when the relay takes the device offline

* test(cli): satisfy the remote-control handle contract in tui web tests
2026-10-12 16:30:56 +08:00
Haozhe
c151d5a3d0
feat(agent-core-v2): add KIMI_CODE_LLM_HEADERS_TIMEOUT_MS for llm headers timeout (#4092)
* feat(agent-core-v2): add KIMI_CODE_LLM_HEADERS_TIMEOUT_MS for llm headers timeout

* fix(agent-core-v2): harden KIMI_CODE_LLM_HEADERS_TIMEOUT_MS proxy fallback and range
2026-10-12 13:51:39 +08:00
tpoisonooo
c9f01f0738
refactor(tower): coordinate missions with deterministic orchestration (#4074)
Some checks failed
CI / build (push) Has been cancelled
CI / test-pi-tui (push) Has been cancelled
CI / test-vscode-legacy (push) Has been cancelled
CI / test (2) (push) Has been cancelled
CI / test (3) (push) Has been cancelled
CI / test (4) (push) Has been cancelled
CI / test (5) (push) Has been cancelled
CI / test-windows (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / typecheck (push) Has been cancelled
Nix Build / Check flake.nix workspace sync (push) Has been cancelled
Release / Release (push) Has been cancelled
Publish VS Code extension / Publish VSIX to marketplaces (push) Has been cancelled
CI / test (1) (push) Has been cancelled
Release / Native release artifact (push) Has been cancelled
Release / Publish native release assets (push) Has been cancelled
Nix Build / nix build .#kimi-code (push) Has been cancelled
Release / Deploy docs (push) Has been cancelled
* feat(tower): coordinate missions with deterministic orchestration

* fix(tower): disable goal mode

* feat(tower): degrade gracefully on tower state loss

When .tower/comms is deleted while .tower/ survives (e.g. git clean),
tower tools no longer hard-fail with not-initialized:

- TowerStatus returns a state-lost report; never-initialized repos
  (no .tower/ at all) keep the existing not-initialized behavior
- TowerSend/TowerComplete recover a minimal state (directory skeleton,
  empty missions/roster, recoveredAt marker, base taken from the
  current checkout branch) and keep delivering; a caller whose roster
  entry was lost is re-registered as a placeholder named after its
  agent id
- TowerComplete degrades explicitly after a loss: the report is
  delivered to the tower as a completion-report-state-lost message and
  no mission is marked completed
- TowerMerge/TowerRebase and every other locked mutation fail with an
  explicit state-lost error instead of silently running against an
  empty history
- the recoveredAt marker is shown on the TowerStatus dashboard and in
  the status summary, reminding the tower to report the history loss
  to the user

* feat(tower): veto destructive bash commands in the tower main checkout

* fix(tower): allow git clean dot pathspecs inside tower worktrees

* fix(tower): restore attachment guidance for mission context

* fix(tower): engage bash guard only while the workspace has an owner

* fix(tower): veto git clean only with force and -x/-X; drop markInboxRead

* chore(tower): drop per-fix changesets to keep a single concise one

* fix(tower): check tower owner before preparing the user base

* feat(tower): show a notice when goal activation ends tower mode

* fix(tower): unify the mode-mutex exit reason across goal, plan, and swarm

* refactor(tower): drop token stamping from protocol artifacts

* fix(agent-core-v2): deny tower workers subagent delegation

Remove the Agent tool and the subagents allowlist from the tower-worker
profile so workers and reviewers cannot nest subagents inside a mission;
nested subagents bypassed the tower concurrency budget and the tower's
steering. Drop the now-unreachable reviewer-only Agent-resume veto and
its tests; the branch-lease and foreground-resume vetoes stay.

* test(tower): stub ILogService in every AgentTowerService test scope

The fork-restore tests build second DI scopes that register
AgentTowerService without stubbing ILogService, leaving this.log
undefined. When reconcileForeignTower fires a fire-and-forget exit and
the ownership release rejects, the rejection handler's this.log.warn
throws a TypeError that surfaces as an unhandled rejection in the full
suite. Add ix2.stub(ILogService, stubLog()) to all nine scopes that
lacked it, matching the existing sibling pattern.

---------

Co-authored-by: konghuanjun <konghuanjun@moonshot.ai>
2026-10-10 19:28:09 +08:00
HydrogenE7
3395f5bea6
fix: show shutdown progress and force exit on Ctrl+C during shutdown hooks (#4164) 2026-10-10 16:24:36 +08:00
7Sageer
f0bc988bbc
fix(agent-core-v2): keep fork subagent request prefix identical to parent (#4152) 2026-10-10 16:12:20 +08:00
Kimi Agent
72fc1d0a33
fix(tui): show Working… in the status spinner while thinking (#4160) 2026-10-10 15:16:37 +08:00
grapedge
e5b4b88ba9
fix: report cumulative survey user turns (#4156) 2026-10-10 14:25:06 +08:00
7Sageer
419aced0e9
fix(agent-core-v2): restore media tools after session resume (#4154)
Some checks are pending
CI / build (push) Waiting to run
CI / test (1) (push) Waiting to run
CI / test (2) (push) Waiting to run
CI / test (3) (push) Waiting to run
CI / test (4) (push) Waiting to run
CI / test-pi-tui (push) Waiting to run
CI / test-windows (push) Waiting to run
Nix Build / Check flake.nix workspace sync (push) Waiting to run
Nix Build / nix build .#kimi-code (push) Blocked by required conditions
Release / Release (push) Waiting to run
Release / Deploy docs (push) Blocked by required conditions
Release / Native release artifact (push) Blocked by required conditions
Release / Publish native release assets (push) Blocked by required conditions
CI / test (5) (push) Waiting to run
CI / test-vscode-legacy (push) Waiting to run
CI / lint (push) Waiting to run
CI / typecheck (push) Waiting to run
Publish VS Code extension / Publish VSIX to marketplaces (push) Waiting to run
* fix(agent-core-v2): restore media tools after session resume

* test(agent-core-v2): pin tool parity across session resume
2026-10-09 17:49:30 +08:00