Commit graph

225 commits

Author SHA1 Message Date
Haozhe
3eafa79f39
feat(acp): implement ACP server with session lifecycle, tool streaming, and IDE integration (#368)
This commit scaffolds the @moonshot-ai/acp-adapter package and introduces
the full ACP (Agent Communication Protocol) server implementation for
Kimi Code CLI, including:

- Scaffold @moonshot-ai/acp-adapter workspace package with build skeleton
- `kimi acp` CLI subcommand and stdout-safe logging
- ACP version negotiation and AgentSideConnection wrapper
- Auth gate for session creation
- Session lifecycle: new, list, load with history replay
- Prompt content conversion (text, image, embedded resources, resource links)
- Assistant streaming with thinking support and end-turn handling
- Tool call streaming (started, delta, progress) with result conversion (text / diff)
- Approval handling with diff/text display blocks mapped to ACP options
- Kaos read/write interface (AcpKaos) for unsaved buffer access
- Session mode (yolo/auto) and model management
- Config options builder with thinking toggle
- MCP server forwarding from ACP to harness
- Agent plan updates and available commands updates
- AskUserQuestion bridged to session/request_permission
- Plan review options surfaced through requestPermission
- Error mapping, ext_method stubs, and graceful shutdown
- IDE integration guide (Zed + JetBrains)
- End-to-end tests against ACP TS SDK client
2026-06-03 21:11:30 +08:00
_Kerman
8639105313
fix: resume subagents lazily (#380) 2026-06-03 20:16:43 +08:00
liruifengv
90879f37af
feat(cli): unify TUI dialog interaction and visuals (#363)
* feat(cli): unify TUI dialog interaction and visuals

Align every list dialog and selector to a single spec: shared selection
pointer and current-item marker, single-border header with a (type to
search) title suffix, consistent search line, and a uniform keyboard-hint
vocabulary. Replace ad-hoc exit wording (close/back/exit/dismiss) with
cancel, hardcoded pointers with the shared constant, and ▲▼ with ↑↓.

Also add fuzzy search to /provider, restyle the /model provider tabs, and
require a token with multi-field navigation in the custom-registry import.

Introduce the write-tui skill (carrying the DESIGN.md spec) and refresh
the apps/kimi-code development guide to match the current TUI architecture.

* feat(cli): drop arrow-key navigation in the plugins selector

The plugins overview and its marketplace/MCP sub-views used Left/Right to
enter and exit details. Remove that hierarchy navigation: Enter opens a
detail, Esc returns, and the arrow keys no longer jump between levels.
Update the sub-view hints from `←/Esc cancel` to `Esc cancel`.

* feat(cli): install marketplace plugins on Enter only

The marketplace install action also fired on Space, which collides with
the Space-toggle convention used elsewhere. Bind install to Enter only and
update the hint to `Enter install/update`.

* feat(cli): reword the plugin inline change hint

The inline badge shown on a changed plugin row read `pending /new`, which
was cryptic. Reword it to `require run /new to apply`. Also switch the
marketplace-install message-flow tests to Enter, matching the Enter-only
install binding.

* fix(cli): stop the editor flash when toggling a plugin

Each plugin picker's onSelect unconditionally restored the editor before
the handler re-mounted the refreshed picker, so an in-place action like
Space-toggling a plugin flashed: picker → editor → picker. Drop the
pre-restore from the overview/marketplace/MCP onSelect callbacks and let
each handler branch mount its next view; the two branches that close to the
editor (show-list, info) restore it themselves.

* feat(cli): drop /provider search and delete with D

Remove the fuzzy filter from the provider manager: no query state, search
line, or type-to-search title suffix, and Esc closes directly. With no
type-to-search to clash with, bind delete to the D key (matching /plugins)
instead of Del/Ctrl+D. Update the write-tui spec to specify D as the
delete shortcut.

* fix(cli): default thinking-capable models to thinking on

The model selector seeded a single thinking draft from the global thinking
flag, so highlighting a thinking-capable model showed Off whenever the
active model had thinking off (e.g. a non-thinking current model). Compute
the draft per model instead: the active model keeps its live state, any
other thinking-capable model defaults to On, and a ←/→ toggle is remembered
per model.
2026-06-03 19:31:07 +08:00
_Kerman
e0d28b4941
feat: allow empty /btw command (#378) 2026-06-03 19:04:45 +08:00
Luyu Cheng
6a2252343a
fix: simplify goal budget schema and fix output caps (#365) 2026-06-03 15:55:14 +08:00
_Kerman
ba7dd736a3
feat: add btw side-channel command (#338) 2026-06-03 15:54:31 +08:00
_Kerman
a6b16ce6b4
refactor: split SDK RPC client (#339) 2026-06-03 15:30:38 +08:00
jiang1997
7d1f889d3d
fix: remove hardcoded /bin/sh for external editor on Windows (#246)
Run the external editor through Node's platform shell instead of spawning
/bin/sh directly. Quote the appended temp file path per platform so Ctrl+G
works on Windows while preserving shell-style editor commands.

Co-authored-by: liruifengv <liruifeng1024@gmail.com>
2026-06-03 15:02:25 +08:00
Haozhe
9e6972423e
feat(agent-core): detect and escalate repeated tool calls to prevent infinite loops (#364)
* feat(agent-core): add dead-end detection for repeated tool calls

- inject stronger dead-end reminder at streak 10 and force-stop turn at streak 15
- emit `tool_call_repeat` telemetry events for streak >= 2
- pass telemetry client from TurnFlow to ToolCallDeduplicator
- add comprehensive tests for dead-end stop and telemetry behavior

* fix(agent-core): tune tool-dedup thresholds and preserve isError state

- Lower repeat-reminder thresholds to 3, 5, 8 and force-stop to 12
- Force-stop no longer overrides successful tool results to isError
- Move stopTurn field into ExecutableToolSuccessResult for explicit loop-control without requiring isError
2026-06-03 14:16:14 +08:00
_Kerman
33496bd031
test: disable harness log writes by default (#362) 2026-06-03 12:55:54 +08:00
_Kerman
179aecf423
feat: log enabled experimental flags (#357) 2026-06-03 11:35:29 +08:00
liruifengv
9143fdadf6
docs(changelog): sync 0.8.0 from apps/kimi-code/CHANGELOG.md (#342) 2026-06-02 23:07:56 +08:00
github-actions[bot]
14cd8d098b
ci: release packages (#296)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-06-02 22:54:57 +08:00
Luyu Cheng
ac37d74484
feat: pursue a goal autonomously (#270) 2026-06-02 22:52:23 +08:00
_Kerman
191059d400
feat: add background ask user questions (#315) 2026-06-02 22:12:25 +08:00
qer
3502d870fc
chore: scrub internal identifiers from public text (#340) 2026-06-02 21:54:42 +08:00
Haozhe
7284f30479
fix(oauth): fix multi-provider custom registry import losing providers (#335)
- Add `applyCustomRegistryEntries` helper to apply all entries in-memory before a single write
- Update CLI Add Platform flow to use it, replacing interleaved in-memory mutations with removeProvider RPCs
- Add regression tests for repeated imports and provider field refreshing
2026-06-02 20:05:00 +08:00
qer
7cda9c3866
feat: add permission approval hooks (#336) 2026-06-02 19:57:10 +08:00
Haozhe
80164c2e97
fix(glob): normalize pattern before brace expansion (#311)
* fix(glob): normalize pattern before brace expansion

* fix(glob): preserve backslash-escaped metacharacters and normalize braces correctly

- expand braces before normalizing to prevent `..` from collapsing across brace groups
- skip normalization for patterns containing backslash-escaped glob metacharacters
- add test coverage for escaped braces and nested `..` inside alternatives
2026-06-02 19:30:32 +08:00
liruifengv
eeefa98083
feat(cli): add automatic and manual upgrades (#334) 2026-06-02 18:39:50 +08:00
7Sageer
7ffb5dd9b3
fix: drop unsigned thinking for Claude replay (#331) 2026-06-02 18:20:10 +08:00
liruifengv
1178c5cd14
feat: add todo list reminder injection (#333) 2026-06-02 18:12:38 +08:00
_Kerman
7a47045af2
fix: inherit custom tools in subagents (#330) 2026-06-02 17:16:59 +08:00
7Sageer
8809f3eb11
fix: normalize tool call ids across providers (#327) 2026-06-02 16:42:40 +08:00
_Kerman
fe7db4a7e3
feat: append TODO list as markdown to compaction summary (#319) 2026-06-02 16:20:52 +08:00
qer
0e57e739c7
docs: refine datasource skill description (#322)
* docs: refine datasource skill description

* chore: bump datasource plugin version
2026-06-02 16:07:33 +08:00
liruifengv
1f8c36af28
fix: improve tool output preview rendering in TUI (#317)
* fix: trim trailing empty lines from shell output previews

* fix: append … to multi-line Bash command header previews

* fix: truncate tool output by visual wrapped lines instead of raw newlines

* chore: add changeset for tool output preview fixes
2026-06-02 15:07:21 +08:00
7Sageer
3c5dee8836
feat(cli): add kimi provider subcommand for non-interactive provider management (#313)
* feat(cli): add `kimi provider` subcommand

Add a non-interactive equivalent of the TUI `/provider` command:

- `kimi provider add <url> --api-key <key>` imports every provider in a
  custom api.json registry, persisting `source` so the next TUI launch
  refreshes the model list automatically.
- `kimi provider remove <id>` deletes a provider and its model aliases.
- `kimi provider list [--json]` prints configured providers with model
  counts and source labels.
- `kimi provider catalog list [providerId] [--filter] [--url] [--json]`
  browses the public models.dev catalog.
- `kimi provider catalog add <providerId> --api-key <key> [--default-model]`
  imports a known provider straight from the catalog.

All actions reuse `fetchCustomRegistry`, `applyCustomRegistryProvider`,
`fetchCatalog`, and `applyCatalogProvider` from the existing oauth/SDK
helpers.

* fix(cli): satisfy oxlint rules in provider subcommand

- Use `Array#toSorted()` instead of `Array#sort()` to avoid mutating
  arrays returned from `Object.keys()` / `Object.entries()`.
- Drop redundant boolean-literal comparisons on `model.capability.*`
  fields (already typed as `boolean | undefined`).
- Remove the unnecessary `source as Record<string, unknown>` assertion
  in `providerSourceLabel` — `ProviderConfig.source` is already typed
  that way in the schema.
- Drop the empty-object fallback in `{ ...(config.models ?? {}) }`
  inside the test harness.

* fix(cli): address review findings on provider subcommand

P1 — `provider add`: `harness.removeProvider` re-reads the config from
disk (see `agent-core/src/rpc/core-impl.ts removeKimiProvider`), so
calling it mid-loop discarded providers we had already applied in
memory but not yet persisted. Importing a registry that added a new
provider then replaced an existing one silently lost the new one.
Drop every stale id up front in a single batch, then apply each entry
against the resulting fresh config.

P2 — `catalog add`: `applyCatalogProvider` always writes
`defaultThinking`. Hardcoding `false` would silently disable thinking
for thinking-capable models when the user had it on. Thread the prior
`defaultThinking` through.

P2 — `catalog add`: `removeProvider` clears `defaultModel` when it
pointed at one of the provider's aliases, so capturing
`previousDefaultModel` AFTER the removal yielded `undefined`. Capture
both `defaultModel` and `defaultThinking` BEFORE the removal so
re-importing a configured provider (e.g. to rotate the api key)
preserves the user's chosen default.

Tests:

- `makeHarness` now models the on-disk semantics of `removeProvider`
  (clears `defaultModel` when an alias matches, returns fresh disk
  view), so behavior that depended on the buggy in-memory mock is
  exercised honestly.
- Three new regression tests, each verified to fail against the
  pre-fix handler.

* fix(cli): address follow-up review on catalog default semantics

Two more findings on `catalog add`:

P2 — `default_thinking` fallback to `false` was wrong even after the
previous fix. `resolveThinkingLevel` (agent-core/.../thinking.ts:23)
treats `defaultThinking === false` as an explicit "off" request and
silently disables thinking before per-model defaults kick in. A
first-time `kimi provider catalog add anthropic --default-model
claude-opus-4-7` was therefore still persisting `default_thinking =
false` for thinking-capable models. The handler now always restores
the previous `defaultThinking` (including `undefined`) — the only
way to let the runtime resolver pick the per-model default.

P2 — Restoring `default_model` was unconditional, even when the
refreshed catalog no longer ships that model. `applyCatalogProvider`
drops the old aliases and only populates the current catalog, so
restoring an alias the catalog no longer contains would point
`default_model` at a non-existent entry and break the next session.
The handler now checks whether the alias still resolves and clears
it otherwise.

Test harness:

- The fake `setConfig` now mirrors the real `mergeConfigPatch`
  semantics (deep-merge with `undefined` keys skipped), so tests can
  honestly assert that `setConfig({defaultModel: undefined})` does
  NOT wipe a key from disk — only `removeProvider` can.

Two new regression tests, each verified to fail against the pre-fix
handler.

---------

Co-authored-by: 7Sageer <158020838+7Sageer@users.noreply.github.com>
2026-06-02 14:58:47 +08:00
Haozhe
0d074f1bae
feat(agent-core): propagate app version into agent record metadata (#308)
* feat(agent-core): propagate app version into agent record metadata

- add appVersion option to AgentOptions, SessionOptions, and KimiCoreOptions
- forward appVersion through Agent, Session, and SDKRpcClient
- include app_version in agent record metadata events
2026-06-02 14:54:29 +08:00
caiji
58e2915c0f
fix(tui): clamp session picker lines to terminal width to fix narrow-terminal crash (#247)
* fix(tui): clamp session picker lines to terminal width

The /sessions picker drew long session ids, the inline time/(current)
badge, and long prompts past the terminal edge on narrow terminals. The
pi-tui renderer enforces that no line exceeds the terminal width and
threw 'Rendered line exceeds terminal width', crashing the app.

Clamp every line the picker emits to the terminal width via
truncateToWidth so it degrades gracefully instead of crashing.

Fixes #240

* fix(tui): simplify changeset and de-CJK session picker test

Address review feedback on #247:
- shorten the changeset to a single sentence
- replace the Chinese test title with an English one

---------

Co-authored-by: liruifengv <liruifeng1024@gmail.com>
2026-06-02 14:53:47 +08:00
liruifengv
6de3d97d82
fix(tui): drain terminal input before exit (#314) 2026-06-02 14:04:17 +08:00
qer
a10cb94bc0
feat(tui): hint the /dance easter egg and highlight its sub-commands (#312)
- Add a footer rotation tip that surfaces the otherwise-hidden /dance command.
- Paint /dance on|off in the status hint so the sub-command reads as a command instead of blending into the dimmed text.
2026-06-02 13:36:36 +08:00
liruifengv
a4511ffc87
fix: show full model name in footer without truncating provider prefix (#310) 2026-06-02 13:19:29 +08:00
_Kerman
8b392a9c26
fix: restore main typecheck (#307) 2026-06-02 13:06:59 +08:00
_Kerman
a217ff09aa
feat: add /undo slash command and keep replay in sync (#277) 2026-06-02 12:48:59 +08:00
_Kerman
573c56e829
refactor: background task manager persistence (#285) 2026-06-02 12:48:31 +08:00
_Kerman
91b292e898
fix: allow glob outside workspace (#283) 2026-06-02 12:36:16 +08:00
ArkhAngelLifeJiggy
fb35bca032
fix: replace chalk.yellow with theme-aware hex in session-directory warning (#229)
* fix: replace chalk.yellow with theme-aware hex in session-directory warning

* fix: address Codex review — fold theme tests into existing suite, fix guard test bugs

- Move theme-colors.test.ts assertions into existing terminal-theme.test.ts to
  avoid a generic feature test file (Codex P2)
- Fix chalk-named-color-guard.test.ts:
  - Replace require('fs') with ESM import (readdirSync) (P1)
  - Fix over-broad comment-skip logic — use proper inBlockComment state
    tracker instead of line.includes('*') which silently skipped valid
    code lines containing asterisks (P1)
  - Remove dead code (const entries = [['dir', '']]) (P2)

---------

Co-authored-by: liruifengv <liruifeng1024@gmail.com>
2026-06-02 12:15:06 +08:00
liruifengv
3d7e20e697
fix(tui): replace stale /connect hints with /provider (#303) 2026-06-02 12:04:12 +08:00
opbr
d912053b0d
fix(kaos): search usr\bin\bash.exe paths for Git Bash on Windows (#145)
Some Git for Windows installations have bash.exe only at
<root>\usr\bin\bash.exe while <root>\bin\bash.exe does not exist.
Add usr\bin\bash.exe candidates alongside each bin\bash.exe entry in
both the hardcoded fallback list and the git.exe inference logic.

Also add @moonshot-ai/kimi-code-sdk to the changeset since the SDK
bundles agent-core code and calls detectEnvironmentFromNode() on
session creation, so Windows SDK users also need this fix.
2026-06-02 11:41:19 +08:00
liruifengv
e2ce6b9687
docs(changelog): sync 0.7.0 from apps/kimi-code/CHANGELOG.md (#298) 2026-06-02 11:31:20 +08:00
Yifan Song
4c7b173c12
docs: add Ctrl-J as newline alternative in keyboard shortcuts (#288)
Co-authored-by: liruifengv <liruifeng1024@gmail.com>
2026-06-02 11:24:22 +08:00
zha-ji-tui
0071b63fc8
fix(skill): wrap slash-activated skill content in system-reminder tags (#135) 2026-06-02 11:20:54 +08:00
_Kerman
811f252625
feat(tui): show MCP server summary in welcome panel and update /mcp hints (#223) 2026-06-02 11:09:10 +08:00
github-actions[bot]
121a6dd2a1
ci: release packages (#237)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-06-02 10:22:31 +08:00
Haozhe
a580cd3a98
feat(glob): add brace expansion, fix backslash escaping, and lower match cap (#282)
* feat(glob): add brace expansion and fix backslash escaping

- add brace expansion support for glob patterns with up to 64 sub-pattern cap
- remove up-front rejection of pure-wildcard and **/ prefix patterns; rely on 100-match cap\n- fix backslash escape handling in globPatternToRegex and inside character classes
- include matched count in truncation messages\n- show glob pattern, path, and include_dirs in TUI tool-call headers

* fix(kaos): use charAt to avoid TS strict undefined index error
2026-06-01 21:36:33 +08:00
qer
178827db47
feat: add hidden dance easter egg (#260)
* feat: add hidden dance easter egg

* chore: update dance changeset

* fix: dispose dance easter egg on stop

* chore: clarify dance disposer naming

* chore: simplify dance lifecycle cleanup
2026-06-01 21:02:36 +08:00
_Kerman
ab546419c8
refactor: move Kimi for Coding provider to SDK (#281) 2026-06-01 20:44:36 +08:00
Haozhe
42bb9141d8
feat(tui): add /provider command, custom registry import, and tabbed model selector (#264)
* feat(tui): add /provider command, custom registry import, and tabbed model selector

- add "/provider" slash command for managing AI providers with CRUD UI
- add custom registry import via api.json URL and Bearer token
- introduce tabbed model selector grouped by provider
- add fetchCustomRegistry and applyCustomRegistryProvider in oauth package
- replace deprecated "/connect" command with unified "/provider" flow
- update provider and slash-command documentation

* feat(tui): background provider model refresh at startup

- add `refreshAllProviderModels` utility supporting managed OAuth, open platforms and custom registries
- wire background refresh into `KimiTUI` startup via `AuthFlowController`
- add `providerSwitchHint` option to `ModelSelector` and enable it in `TabbedModelSelector`
- update `TabbedModelSelector` hint wording from "switch" to "provider"
2026-06-01 18:46:40 +08:00
qer
a1dfbfeb16
fix: clarify Kimi Platform login copy (#274) 2026-06-01 18:43:01 +08:00