Commit graph

800 commits

Author SHA1 Message Date
github-actions[bot]
caf7d4e2fe
ci: release packages (#3862)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-09-18 21:10:03 +08:00
Grapedge
3cc6b2a330
feat(kimi-code): carry turn trace id and copilot stats in rating surveys (#3907) 2026-09-18 19:49:19 +08:00
7Sageer
c1047a6bbe
fix(cli): keep print mode alive while a cron-steered turn is in flight (#3875)
The print background policy only watched goals, future cron fires, and
background tasks, so a turn steered by a cron fire was invisible to it:

- a fired one-shot task is deleted from the schedule at once, so the
  policy saw an empty schedule and returned; teardown then cancelled the
  steered turn mid-flight
- a recurring task whose fire comes due during a long turn keeps
  reporting the same past fire time (the tick waits for the loop to go
  idle), so the anti-spin guard misread a held fire as a wedged tick and
  gave up on cron

The policy now checks turnActive (the same loop-state predicate the cron
tick uses) at the top of every round and waits the in-flight turn out
before drawing any quiescence or wedge conclusion.
2026-09-17 23:52:20 +08:00
7Sageer
c5ad17f06a
feat(agent-core-v2): support api_key_env for provider credentials (#3762)
* feat(agent-core-v2): support api_key_env for provider credentials

Providers can declare api_key_env = "VAR" in config.toml to read their
Bearer token from an environment variable instead of storing it inline.
The value is resolved per request (rotation-friendly); an unset or empty
variable fails with config.invalid naming the provider and variable.
apiKey+apiKeyEnv and apiKeyEnv+oauth are rejected as conflicts.

The /models refresh path resolves the same chain (inline apiKey ->
apiKeyEnv -> env sub-table); a provider whose variable is unset lands in
failed[] without affecting others, and open-platform providers keep the
env declaration instead of persisting the resolved secret.

Custom registries: applyCustomRegistryProvider consumes the api.json env
field — imported providers get apiKeyEnv, the legacy inline apiKey is
dropped, and a hand-edited apiKeyEnv survives refreshes (tracked via
source.envKey). kimi provider add --api-key and the TUI registry token
field are now optional so public registries import without a key.

* docs: document api_key_env provider credentials

* fix(oauth): preserve hand-edited apiKeyEnv on registry refresh and address review nits

* fix(oauth): validate apiKeyEnv conflicts during refresh and address review nits

* fix(oauth): mirror apiKeyEnv in the klient provider contract and harden refresh validation

* fix(oauth): stop auto-binding registry env names to provider credentials

* fix(oauth): preserve hand-edited apiKeyEnv across registry re-imports

* fix(oauth): scope apiKeyEnv preservation to the owning registry

* fix(agent-core-v2): preserve apiKeyEnv across models.dev catalog re-imports

* fix(kap-server): drop apiKeyEnv when the provider update route receives a replacement key

* fix(agent-core-v2): replace provider credential fields on TOML writeback

* fix(kap-server): normalize whitespace-only api_key in the provider update route

* refactor(oauth): unify provider credential rules into shared primitives

A new provider-credential module in the oauth package owns the credential
precedence chain, the mutual-exclusion conflicts, the user-facing messages,
and the write-side tri-state reconciliation; the refresh orchestrator,
agent-core-v2 (model-auth, catalog, auth readiness), and the kap-server
provider routes compose it instead of re-deriving the rules per layer.

applyOpenPlatformConfig now takes credential: {apiKey}|{apiKeyEnv} and
merges onto the existing record, so open-platform refreshes no longer drop
hand-written fields (customHeaders, the env sub-table) on the inline-key
path either, and the refresh's write-then-undo block is gone.

Registry imports converge on removeCustomRegistryEntries +
applyCustomRegistryEntries (prior-snapshot provenance): the exported
capture/restore helpers are gone, the CLI persists a re-import with a
single setConfig instead of per-id removeProvider RPCs, and
default_model/default_provider survive a re-import whenever they still
resolve. kap-server's importCustomRegistry keeps the purge-then-rewrite
two-phase replace the config service's raw-merging writeback requires.

kap-server create/replace routes accept api_key_env (tri-state, mutually
exclusive with api_key), and GET /config plus the provider catalog item
expose the binding. A declared-but-unset api_key_env now fails readiness
checks with config.invalid (was auth.token_missing), matching request-time
behavior. Registry 401/403 without a key prints an authentication hint.

* fix(cli): persist registry re-import removals on both harness generations

The v2 harness's setConfig deep-merges per domain (retaining omitted keys
and skipping undefined defaults), so a shrunk re-import left removed
providers and aliases in config.toml and kept a cleared default dangling.
The CLI and TUI registry flows now share persistRegistryImport: on v2 the
removal phase and the rebuilt records go out as two atomic
replaceConfigSections writes (the writeback merges alias fields from raw
TOML, so the purge must be persisted first); on v1 the removeProvider RPC
cascades the removals before one merge write. defaultModel/defaultProvider
snapshots are captured before any removal so the restore works on both
paths.

* fix(oauth): reject oauth before the legacy env fallback and persist cleared thinking on re-import

refreshProviderModels' env sub-table fallback now throws the same
apiKey+oauth conflict the chat path rejects, instead of authenticating
with the fallback key and rewriting the provider to drop oauth.

persistRegistryImport writes the cleared thinking section through the
replacement payload, and drops the v1 fallback branch — registry imports
always persist through replaceConfigSections, so the removal phase no
longer needs per-id removeProvider RPCs.

* chore: consolidate provider credential changesets into one entry

* chore: trim changeset to the api_key_env entry

* fix: harden provider credential status and registry imports

* fix(oauth): expose browser-safe provider credential rules

* fix(node-sdk): replace serialized provider credentials

* fix(oauth): reject credential conflicts during refresh

* fix: harden custom registry re-imports

Reject reserved provider collisions and credential endpoint drift before mutation. Replace registry-owned sections atomically with compare-and-set guards, and carry the replacement contract through klient and node-sdk.

* refactor(registry): centralize custom registry import ownership

Route CLI and TUI imports through the engine via the typed SDK and Klient operation. Keep registry replacement policy inside the engine and preserve credential edits made while fetching the registry.

Cover the shared entry point with real configuration storage and memory/IPC transport tests.

* test: trim redundant api_key_env and registry-import coverage

* fix(cli): reuse the stored registry key on keyless re-import

Both first-party clients encoded "no key given" as an empty string, but
the engine's fallback chain (options.apiKey ?? registryKeyFromExisting)
only reuses the key parked in the provider's source blob when the option
is undefined. A keyless re-import of a private registry therefore went
out without an Authorization header and failed with 401 from the CLI
and the TUI dialog, while the kap-server REST route (which passes
undefined) reused the stored key fine.

Pass undefined from the CLI handler and the TUI import dialog instead
of normalizing to ''. The dialog's result type now marks apiKey
optional, matching the engine contract.

* test: pin CAS rejection and credential-conflict behavior

The coverage trim went past redundancy in three places, leaving the
PR's headline guards untested. Restore the compare-and-set rejection
path (guarded value changed on disk -> retry error, no write) and the
absent-section guard normalization in config.test.ts, the
apiKey+apiKeyEnv / apiKeyEnv+oauth conflict rejections at runtime
resolution (modelAuth) and at the refresh orchestrator (discovery,
with per-provider failure isolation), and the open-platform refresh
through api_key_env proving the resolved secret never lands in the
provider record. Also add the first direct unit tests for the shared
declaredProviderCredential / reconcileProviderCredentialUpdate
primitives.

* refactor(oauth): share reserved provider id rules between import and refresh

* Delete .changeset/registry-import-concurrent-credentials.md

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

* test: trim cross-layer duplicate registry and credential coverage

---------

Signed-off-by: 7Sageer <sag77r@hotmail.com>
2026-09-17 22:02:53 +08:00
qer
25dd4ce973
feat(cli): rename the install-app subcommand to install-desktop (#3864)
install-app stays registered as a hidden alias so existing usage keeps working.
2026-09-17 14:42:11 +08:00
Grapedge
bbcdde0b13
feat(vscode): wire the extension into the shared telemetry pipeline (#3852) 2026-09-17 13:45:59 +08:00
github-actions[bot]
1b89e4b039
ci: release packages (#3797)
* ci: release packages

* chore: bump kimi-code release version to 2.0.0

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: liruifengv <liruifeng1024@gmail.com>
2026-09-17 13:20:26 +08:00
Grapedge
faec32c7e7
feat(tui): render mermaid code blocks as diagrams in the terminal (#3851) 2026-09-17 12:56:40 +08:00
liruifengv
95d4a9d041
ci: sign Windows CLI binaries with Azure Artifact Signing (#3858)
* ci: sign Windows CLI binaries with Azure Artifact Signing

* fix: resolve signtool from Windows SDK when removing SEA binary signature
2026-09-17 12:42:59 +08:00
liruifengv
4e813cf71e
chore: sync web dist from code-app (#3859)
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 / Publish native release assets (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
Publish VS Code extension / Publish VSIX to marketplaces (push) Waiting to run
code-app: 3f3f3b2e52115eb0b79bc04ed4fcc2d45b30fe5d
2026-09-17 12:15:56 +08:00
liruifengv
d9d1f59804
chore: sync web dist from code-app (#3850)
code-app: 3d1122617a5f16d96f4eb8308e76271e21f82c92
2026-09-16 22:12:28 +08:00
Grapedge
b4d0b8a388
fix(tui): recut live @ mention token when accepting stale completion (#3848) 2026-09-16 21:30:09 +08:00
qer
34ec5d2a17
feat(cli): add /desktop slash command and kimi install-app subcommand (#3849)
* feat(cli): add /desktop slash command and kimi install-app subcommand

Both entry points print the Kimi Code desktop app page
(https://www.kimi.com/code) and open it in the default browser:
the kimi install-app subcommand from the shell, and /desktop
(alias /install-desktop) from the TUI.

* fix(cli): derive the desktop app page from the active region

Replace the hardcoded .com URL with the existing region-aware
kimiCodeOfficialInstallUrl() resolved at invocation time, so
global-region users land on the .ai site and region changes are
respected.

* docs(cli): describe the desktop app page URL as region-dependent
2026-09-16 20:53:35 +08:00
7Sageer
da31c472a2
feat(agent-core-v2): add skill scopes and mark custom-theme as tui-only (#3843)
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
* feat(agent-core-v2): add skill scopes and mark custom-theme as tui-only

Builtin skills can now declare a scopes whitelist (tui | web); skills
without scopes stay visible everywhere. The value is carried through
SkillSummary, the klient RPC contract, and the kap-server REST wire,
and the TUI slash commands filter by it. HTTP clients (code-app) drop
skills whose scopes exclude their own UI mode, so TUI-only skills like
/custom-theme no longer leak into app/web.

* fix: filter scoped skills from the acp and vscode palettes

ACP slash commands and the VS Code GetSlashCommands handler also
project SkillSummary lists; both now drop skills that carry a scopes
restriction so tui-scoped skills stay out of non-tui clients.
2026-09-16 19:14:22 +08:00
7Sageer
5653c739b9
feat(agent-core-v2): upload images as file references for Kimi models (#3784)
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
* feat(agent-core-v2): upload images as file references for Kimi models

* fix(agent-core-v2): scope media upload cache by endpoint and recognize SDK auth error status

* fix(agent-core-v2): restore the stripped /v1 for kimi files uploads on the anthropic route

* feat(agent-core-v2): omit oldest media when accumulated inline media exceed the request budget

* fix(agent-core-v2): key the media upload cache by the stable JWT subject

* fix(agent-core-v2): harden media request recovery

* fix(agent-core-v2): correct image memo accounting

* feat(agent-core-v2): include saved paths in dropped media placeholders

* docs: drop the saved-path re-read guarantee from the media budget note

The guarantee does not hold for inline data-URL media (no persisted
path exists), and the runtime warning already conveys path availability
when it applies. Addresses the codex P2 review suggestion by removal.
2026-09-15 21:32:42 +08:00
liruifengv
19ce4b3f06
fix(tui): stop /usage and /status from prompting login before the first message (#3818)
* fix(tui): stop /usage and /status from prompting login before the first message

* docs(changeset): simplify the /usage fix entry

* fix(tui): mute the session-usage error line and cover the session-less path in tests

* docs(changeset): restore the confirmed wording
2026-09-15 20:51:00 +08:00
HydrogenE7
7d174ac933
perf(agent-core-v2): evict completed subagent scopes behind an LRU cache (#3778)
* perf(tui): batch and cache agent swarm progress rendering

* perf(agent-core-v2): evict completed subagent scopes behind an LRU cache

* fix(agent-core-v2): stop the agent actor in the session machine when its scope is removed

* fix(agent-core-v2): emit a terminal event for the final rate-limited run and defer eviction while background tasks run

* fix(agent-core-v2): include in-flight retries when abandoning suspended agents

* fix(agent-core-v2): roll back the closing flag when scope removal fails and wait per the configured eviction timeout

* fix(agent-core-v2): terminalize subagents spawned after batch cancellation and report task timeouts as failures

* chore: restore upstream/main state of files mangled by lint-staged autofix in the merge commit

oxlint --fix rewrites (prefer-set-has, catch-error-name, prefer toSorted/.at(-1)/toReversed)
touched seven files the branch never modified; one of them (oauth managed-kimi-code.ts)
no longer typechecks. Restore all seven to their exact upstream/main state. Committed
with --no-verify so the same autofix does not re-mangle them.

* fix(agent-core-v2): retry deferred scope evictions without exhausting the attempt budget, dedupe terminal events for starting retries, and patch-level the changeset

* fix(agent-core-v2): finish scope teardown instead of reactivating a partially torn-down scope

* fix(agent-core-v2): terminalize subagent-start hook cancellations and re-acquire resume targets after metadata reads

* fix(tui): record cancelled background agents in the transcript

* fix(agent-core-v2): route mirror terminal events through the batch exactly-once guard

* fix(tui): guard terminal swarm members from re-cancellation and deliver terminal status to cancelled foreground subagent cards

* fix(agent-core-v2): classify eviction as removed when teardown already closed the scope

* Merge remote-tracking branch 'upstream/main' into perf/subagent-scope-eviction

Skip lint-staged for this merge: its oxlint --fix pass rewrites unrelated files
(prefer-set-has etc. mangled seven files in the previous merge commit), while the
merge content is upstream's lint-clean code plus conflict resolutions already
verified by oxlint.

* chore: restore upstream/main changes dropped by a stash roundtrip during the merge

A git stash/pop cycle used to isolate an unrelated flaky test reverted 82 files of the
merge result to the pre-merge branch state, so commit 375ff2a4a missed them. The
working tree already held the correct merged content; this commit restores it.

* fix(agent-core-v2): propagate the cancellation reason from turn abort to tool signals

Cancelling a turn aborted the turn's llm scope and every tool scope
without a reason, so tools and subagents only ever saw the default
AbortError and could not tell a user cancellation from a system abort.
With the swarm terminal-event classification this surfaced as
`subagent.failed` ("This operation was aborted") on Ctrl+C instead of
`subagent.cancelled`.

Carry the reason end to end: `MachineEngine.abort(reason)` sends it on
`input.abort`, the agent machine remembers it for the turn and forwards
it to `turn.abort` and to every tool scope it aborts, the turn machine
passes it to the llm scope, and the loop service hands its cancellation
(a `UserCancellationError` by default) to the engine.

* fix(agent-core-v2): stop rebuilding an evicted subagent after its caller aborts

`createAgentAwaitingClose` polled for the previous scope to finish
closing without ever looking at the caller's abort signal, so cancelling
an `Agent` or `AgentSwarm` resume during that wait still recreated the
scope afterwards. In the `Agent` path the run then rejected before any
terminal event was mirrored, leaving an idle scope that the scope cache
no longer tracked.

Thread the caller's signal into the helper and check it before every
attempt; the Agent tool passes its call controller and the swarm service
passes the attempt signal. Also trim the eviction changeset to the one
sentence the changeset rules ask for.

* fix(agent-core-v2): report task-manager aborts of a subagent as cancelled

When the task manager times out or stops a background subagent it aborts
the run with a plain reason ('Timed out', the TaskStop reason), and the
run rejects with that raw reason. The task manager therefore classifies
the task as timed_out or killed, but the mirror only recognised
`UserCancellationError` as a cancellation and emitted `subagent.failed`,
so the transcript recorded a failure before the authoritative
`background.task.terminated` event could land.

Classify a terminated run by the shape of its abort reason: a real
Error that is not an AbortError (the swarm's own per-item timeout) stays
a failure, everything else that aborted the run is a cancellation. The
swarm's start-failure path uses the same rule.

* fix(agent-core-v2): flush the wire before evicting a subagent scope and re-pick LRU candidates

Two gaps in the scope-cache eviction pass:

- `AgentLifecycleService.remove()` swallows a failed wire flush and still
  tears the scope down, so an eviction that hit a disk-full or transient
  I/O error would drop the in-memory scope and let a later resume rebuild
  from a stale wire. Flush the agent's wire explicitly before removing;
  if that fails, keep the scope resident and retry on a later pass. The
  idle and task checks are repeated after the flush so a resume that
  started meanwhile is not cancelled by the removal.
- The pass snapshotted its candidates up front and re-validated them by
  attempt count only, so a scope that was resumed and completed again
  while an earlier eviction was awaited kept matching with attempts 0 and
  was evicted despite now being the most recently used. Pick the oldest
  eligible entry from the live map on every step instead, skipping only
  the entries this pass already tried.

---------

Co-authored-by: Kaiyi <me@kaiyi.cool>
2026-09-15 20:33:24 +08:00
Kimi Agent
39a74556a6
fix(plugins): rename WebBridge display name to Kimi Browser Extension (#3803)
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
* fix(plugins): rename WebBridge display name to Kimi Browser Extension

The product has renamed WebBridge to Kimi Browser Extension in work and
Chrome. Update the user-facing display name across the built-in
capability entry, TUI plugins selector, managed plugin manifest,
marketplace catalog, skill docs, and user docs to match. Internal ids,
binary names, CDN paths, and daemon references are unchanged.

* fix(plugins): bump webbridge to 1.11.4 and keep legacy docs anchor

Address review: point the changeset at the scoped CLI package, bump the
renamed plugin's manifest/catalog/docs version so installed users are
offered the renamed package as an update, and preserve the published
#kimi-webbridge documentation anchor beside the renamed heading.

* docs(plugins): match only the known extension-update error messages

Broadening the version-mismatch trigger to the generic prefix 'Please
update the' would misclassify unrelated tool errors as an outdated
browser extension; match the two known full messages instead.

---------

Co-authored-by: kimi-agent-bot <kimi-agent-bot@users.noreply.github.com>
2026-09-15 18:13:51 +08:00
Grapedge
c72a20270e
feat(kimi-code): highlight diff code blocks (#3802) 2026-09-15 17:35:03 +08:00
Grapedge
a7bdabbe82
feat(kimi-code): gate and report feedback surveys by resolved kfc model id (#3795) 2026-09-15 16:02:43 +08:00
github-actions[bot]
75ac010bcb
ci: release packages (#3770)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-09-15 14:49:11 +08:00
liruifengv
26a2841926
chore: sync web dist from code-app (#3792)
code-app: dba2aef9827a8756ce66722da8793383da4a7203
2026-09-15 14:22:12 +08:00
liruifengv
bb0c66a15b
feat(oauth): switch the managed usage payload to the quota model (#3787)
The platform /usages payload now serves per-window used ratios
(goods_version, a usages map of limit5h/limit7d/monthTotal/monthCode
entries with used_ratio/reset_time, and boosterWallet) instead of
absolute used/limit rows.

- oauth: parse and fetch the quota model; keep the platform helpers
- toolkit / agent-core-v2 / node-sdk: getManagedUsage returns the quota
- kap-server: /oauth/usage passes the camelCase quota shape through
  (the legacy snake_case wire is gone)
- TUI /usage: plan rows are presence-driven from the quota payload;
  the monthly row carries a kimi/code breakdown line
- docs: server-api reference updated for the new response shape
2026-09-15 13:33:20 +08:00
HydrogenE7
dc76b0caaa
perf(tui): batch and cache agent swarm progress rendering (#3777)
* perf(tui): batch and cache agent swarm progress rendering

* perf(tui): honor the render-cache escape hatch for cell memoization

* fix(tui): stop swarm frame ticks after tool call end and cap retained label code units

* fix(tui): house swarm label caps in TUI constants and stop splitting surrogate pairs

* fix(tui): close OSC 8 hyperlinks sliced by the swarm label storage cap

* fix(tui): reset SGR styling sliced by the swarm label storage cap

* fix(tui): back the swarm label storage cap off to grapheme cluster boundaries

* test(tui): verify swarm terminal-state retention through the render seam
2026-09-15 12:24:01 +08:00
HydrogenE7
f2486241fb
perf(agent-core-v2): shard the session event bus by agent id (#3775)
* perf(agent-core-v2): shard the session event bus by agent id

* fix(agent-core-v2): preserve full-stream-before-typed ordering in agent channels and render perAgent counts in the inspector

* fix(agent-core-v2): deliver agent full streams before session typed handlers and dispose sharded channels with the bus

* fix(agent-core-v2): prevent rebuilding agent channels after the event bus is disposed

* fix(agent-core-v2): isolate agent channels on generation replace and keep typed handlers on the shared per-type channel

* fix(agent-core-v2): require the active lifecycle context before firing an agent full-stream channel

* fix(agent-core-v2): reject stale lifecycle contexts when subscribing to an agent full-stream channel

* fix(agent-core-v2): honor the agent context in typed subscribeAgent subscriptions
2026-09-15 12:18:20 +08:00
Grapedge
486dcd26c7
feat(kimi-code): re-baseline pi-tui on upstream v0.85.1 (#3780)
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
2026-09-15 03:21:29 +08:00
github-actions[bot]
ffa94fae85
ci: release packages (#3677)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-09-14 20:01:15 +08:00
Haozhe
cd0d4a1d3e
fix(agent-core-v2): display reasoning_content over reasoning_details summary in chat completions (#3735) 2026-09-14 19:51:33 +08:00
liruifengv
dd6a4116dd
chore: sync web dist from code-app (#3763)
code-app: 185e62e02668a7513e469587404ef1a001e1f440
2026-09-14 19:32:51 +08:00
Haozhe
4623395379
refactor(agent-core-v2): fold the prompt queue into the agent loop service (#3747)
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
* refactor(agent-core-v2): fold the prompt queue into the agent loop service

Delete AgentPromptService/IAgentPromptService: prompt submit/queue/steer/
abort now ride the agent machine queue through IAgentLoopService's extended
surface (submitPrompt/submitSteerPrompt/enqueuePrompt/steerPrompts/
abortPrompt/drainPrompts/injectPrompt/retryPrompt/promptQueue plus
hooks.onBeforeSubmitPrompt and the promptAdmission reservation slot).

Durable prompt.* event classes move to agent/prompt/promptEvents.ts and keep
their registrations; promptAdmissionKey keeps its fold. Dead assets go away:
promptResolutionKey, PROMPT_ALREADY_COMPLETED (kap-server 40903 path),
promptLaunchingKey and clear(). Compaction gating (queue while compacting,
resume on finish) moves into the loop reservation drain.

The 'agentPromptService' wire name keeps its shape: a thin AgentPromptChannel
facade (same decorator id) forwards submit/submitSteer to the loop, so
klient memory/ipc/debug transports and the kap-server dispatcher are
unchanged.

* test(agent-core-v2): re-pin prompt queue semantics on the loop service

Rewrite promptService.test.ts (25 cases, count unchanged) against the real
AgentLoopService with the scripted-LLM harness, fold the launch-window
reservation out of promptQueue().pending to match the old snapshot contract
exactly, and update the debug-channels pin to the facade's submit/submitSteer
surface.

* refactor(agent-core-v2): lint-align the loop prompt queue surface

* fix(agent-core-v2): settle prompt completions on the turn-result chain

Match the deleted service's microtask position: prompt.completed/aborted and
the completion deferreds fire from a result.then chain attached at bind time
instead of synchronously inside endTurn, so wire/emit ordering with
post-turn producers (tool unregister, next-prompt launch) stays identical to
the baseline snapshots. Steered children move onto the reservation so the
chain can settle them after the active turn is gone.

* refactor(agent-core-v2): move the prompt-submit gate into the agent machine

* refactor(agent-core-v2): keep image compression captions inline in prompt messages

* refactor(agent-core-v2): drop the durable prompt admission facility

* refactor(kap-server): resolve prompt auth at turn runtime instead of submit time

* refactor(agent-core-v2): teach the agent machine queue metadata, multi-id steer, gate rewrite, and pause

* refactor(agent-core-v2): converge prompt submission on machine queue user entries

* refactor(agent-core-v2): replace loop prompt records with a waiter registry fed by machine events
2026-09-14 15:07:18 +08:00
Haozhe
64505e36e3
feat(kap-server): add flat entity message protocol (v3 WS + history API) (#3532)
* feat(kap-server): add flat entity message protocol (v3 WS + history API)

* feat(kap-server): add task notification user messages, skill origins, and history has_more

* fix(kap-server): page history by turns so oversized turns stay reachable

* fix(kap-server): synthesize foreground subagent tasks in the cold fold when no task records exist

* fix(kap-server): dedupe queued prompts for turn records without a prompt id

* fix(kap-server): adapt v3 projection to agent-core-v2 API changes and filter empty thinking

* feat(kap-server): align v3 protocol with design revision 1094 and add agent.state

---------

Co-authored-by: liruifengv <liruifeng1024@gmail.com>
2026-09-10 19:08:27 +08:00
Haozhe
42998cfc13
feat(updater): add -y/--yes to skip the upgrade confirmation prompt (#3702)
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
2026-09-10 17:22:28 +08:00
Haozhe
d3dc594554
fix(remote-control): carry server token in rc local UI link (#3696)
* fix(remote-control): carry server token in rc local UI link

- add required localServerToken to RemoteControlOutputOptions
- render the Local UI line with buildOpenableUrl and dim the #token= fragment like the ready banner
- pass the resolved token at both rc call sites (kimi web --rc, TUI /rc)

* chore(changeset): add changeset for rc local UI token fix

* fix(remote-control): align rc output test with token-bearing local UI link

- assert the Local UI line carries the #token= fragment
- scope the token-free ban to the relay and session URLs, which must never leak the local server token
2026-09-10 15:00:21 +08:00
Haozhe
56ed9549c6
refactor(agent-core-v2): remove AgentActivityView and project v1 agent phase at kap-server edge (#3678)
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
2026-09-09 17:18:36 +08:00
Haozhe
27b7349ebb
refactor(agent-core-v2): rewire the model catalog runtime onto the provider-catalog state machine (#3606)
The human/llm provider-catalog state machine becomes the single source of
truth for the runtime model/provider directory. IModelCatalog's data plane
reads through a new llm-adapter catalog-runtime adapter that mirrors config
section diffs into catalog upserts, and CatalogEntry cache invalidation is
driven precisely by the machine's changed events instead of a blunt clear.
The persistence layer is untouched: config.toml stays the full source of
truth and refresh results keep being written to it.

Also remove the model resolution trace/inspect stack end to end:
ResolutionTraceCollector, the llm-adapter model/contract inspection modules,
IModelCatalog.inspect, the capability explainability indirection, and the
kimi-inspect model inspector panel.
2026-09-09 15:37:44 +08:00
Haozhe
68f8984a7c
refactor(agent-core-v2): single producer for turn and step ids (#3662)
- the human agent state machine now assigns turn ids and echoes the drained queue item in turn.started; the facade adopts machine ids instead of reserving its own
- the turn machine produces the step ordinal and surfaces it via a first-class step.started fact; the llm requester layer stays step-agnostic
- turn.prompt wire records carry an explicit turnId; turnKey and transcript foldFacts read it directly with a counting fallback for legacy records
- queued prompts are addressed by promptId: cancel(turnId) is active-turn only, cancelQueued targets queue entries, Turn.id resolves once the turn starts
- drop PromptPayload.disabledTools and its klient/node-sdk pass-through (no client consumer)
2026-09-09 15:24:02 +08:00
Grapedge
a9efbe053f
feat: delete sessions from the session picker (#3670) 2026-09-09 15:21:02 +08:00
github-actions[bot]
6954d2c8bf
ci: release packages (#3574)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-09-09 14:22:47 +08:00
liruifengv
e6bc8b8ad9
chore: sync web dist from code-app (#3671)
code-app: e83e5eba9260cc51231ef8f76c63c5a6432a6cac
2026-09-09 14:01:59 +08:00
qer
f8c606e7d7
fix(updater): support zstd manifest entries (#3669) 2026-09-09 12:59:52 +08:00
cyk-ms
0b67511291
feat(agent-core-v2): nudge silent agents to post NotifyUser updates (#3651)
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
2026-09-09 01:02:29 +08:00
Kai
ff7371b70a
fix(glob): allow retrieving matches beyond the default page (#3658)
* fix(glob): allow retrieving matches beyond the default page

* test: decouple compaction checks from Glob tool schema size

* test: refresh registered tool snapshots for Glob pagination

* fix(glob): preserve complete result pages and render pagination notices
2026-09-09 00:29:54 +08:00
Kai
80480c01d2
feat(agent-core-v2): accept HEIC, HEIF, and BMP images for Kimi models (#3649)
* feat(agent-core-v2): accept HEIC, HEIF, and BMP images for Kimi models

Key the accepted image MIME set by the provider the agent is bound to
instead of a single global allowlist: Kimi accepts PNG/JPEG/GIF/WebP plus
BMP/HEIC/HEIF, every other provider keeps the baseline set. The provider
image policy lives in the human layer (`llm/media/image-formats`) so both
the agent-side gates and the Anthropic protocol lowering share it.

- thread the provider type through every ingestion gate: ReadMediaFile,
  prompt entry, MCP tool results, session media references, kap-server
  prompt/skill routes; expose it via IAgentProfileService.getModelProviderType
- ReadMediaFile sends accepted formats it cannot re-encode locally inline
  up to the provider's per-image budget (5MB for Kimi, 3.75MB otherwise)
  and points at a conversion command above that; full_resolution uses the
  same provider budget
- acp-server no longer gates formats itself and leaves the decision to the
  engine prompt pipeline, which knows the bound provider
- the Anthropic lowering allowlist follows the bound provider so Kimi over
  the Anthropic-compatible protocol no longer rejects HEIC client-side

* fix(agent-core-v2): resolve the image format policy on the production paths

Follow-ups from review of the provider-aware image formats:

- the Anthropic lowering read the policy from `LlmModel.provider`, which
  the adapter registry sets to the route id (`anthropic`) rather than the
  model's provider type, so Kimi over the Anthropic-compatible protocol
  still rejected HEIC client-side; the accepted set now comes from a
  `ProtocolTrait.acceptedImageMimes` hook that the Kimi traits implement,
  and the test goes through the real trait with the routed provider id
- kap-server prompt ingestion gated media against the currently bound
  model even when the same request selected another model; the profile
  service now resolves the provider type for a requested alias
- the session media memo served a cached inline image to a provider that
  does not accept its format; memo hits are re-judged against the current
  provider before being returned
- the media tools registrar keyed ReadMediaFile only by alias and
  capabilities, so a reload that changed the alias's provider type or
  protocol kept the stale tool; both now take part in the key

* test(kap-server): keep the optional chain the lint autofix dropped
2026-09-08 19:28:23 +08:00
Haozhe
14cc78611d
refactor(agent-core-v2): replace interaction DI services with a global human singleton (#3644)
* refactor(interaction): replace per-agent InteractionService with human-native session facade

- add human/interaction: global interaction machine + tag-query facade (enqueue/respond/findAll/findOne/wait)
- add session-scope SessionInteractionService owning one interaction actor per session
- rewire approval/question/userTool/sessionActivity to the session facade and delete features/interaction

* refactor(interaction): rewire kap-server, klient and node-sdk to the session interaction facade

- kap-server routes, ws broadcaster and transcript binding read ISessionInteractionService (tags replace origin)
- klient memory dispatcher delegates to the session service; zod contract mirrors origin -> tags
- node-sdk session wiring subscribes the session service directly
- register interaction wire events in their new home and regenerate the wire manifest

* refactor(agent-core-v2): replace interaction DI services with a global human singleton

resolve rebase conflicts
2026-09-08 17:39:16 +08:00
Haozhe
324774d812
test: stabilize the full suite on macOS developer machines (#3643)
Some checks are pending
CI / lint (push) Waiting to run
CI / test-windows (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-vscode-legacy (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 / Native release artifact (push) Blocked by required conditions
Release / Release (push) Waiting to run
Release / Deploy docs (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
- scrub all ambient KIMI_CODE_* env vars in the agent-core-v2 and
  kap-server test setups so developer shell env cannot leak in
- drop the load-sensitive stepRetry fake-timer cases and the three
  FSEvents-based skill catalog watch cases
- give node-sdk, klient and the vscode extension project an explicit
  15s testTimeout matching their integration-test nature
- retry temp-dir removal in taskManager teardown to absorb async
  terminal-effect writes
2026-09-08 16:21:16 +08:00
7Sageer
e56df4e134
fix(telemetry): stop silently dropping key event attributes (#3638)
* fix(telemetry): stop silently dropping key event attributes

- turn_ended now carries error_type (the engine error code) when a turn
  fails, matching the v2 event catalog definition that no emitter set
- TelemetryClient reports properties dropped by sanitizeProperties via a
  new onUnexpectedError hook, wired to the CLI, web, and v2-print logs
- session_started client attribution keys emit empty strings instead of
  null so they survive payload flattening

* fix(telemetry): sanitize at sink accept time and guard the drop handler

Addresses review on #3638:

- Properties are sanitized when the sink accepts the event (at track time
  on the direct path, at drain time for the pre-init queue), so drops on
  events queued before initialization are reported once
  onUnexpectedError is installed
- The onUnexpectedError hook is invoked behind a guard, mirroring the
  agent-core-v2 unexpectedError path, so a faulty host handler cannot
  abort track()

* fix(telemetry): snapshot queued properties at track time

Addresses review on #3638: the pre-init queue now stores the sanitized
snapshot taken at track time (only primitives survive, so the snapshot
is exact), and the dropped keys ride along as pending diagnostics that
are replayed once the handler is installed. Callers mutating a reused
properties object between track() and initialization can no longer
alter the emitted event or its drop reports
2026-09-08 14:37:19 +08:00
Kai
f6a9c39e22
feat(kimi-code): NotifyUser tool and mid-turn update panel (#3524)
* feat(kimi-code): two-line collapsed tool cards with width-aware headers

Collapsed cards now show the call on line one and a single dim outcome
row on line two: a Bash command's last output line (the live tail while
running) with a line-count chip, a Grep/Glob path sample, or a generic
tool's first output line. Read groups stay header-only and honor the
global expand state; failed calls keep their preview. Headers split into
head / flexible / tail segments so a long command fills the terminal
width before the chip.

* feat(kimi-code): NotifyUser tool and mid-turn update panel

Add an experimental NotifyUser tool (flag notify_user, off by default)
that agent-core-v2 offers only when the host declares the update_panel
UI capability at bootstrap; the TUI declares it through the SDK harness
options. The system prompt's guidance to send updates is injected only
when the tool is active for the agent. The TUI renders the turn's
updates in a panel above the editor (stacked, 8-row window, Ctrl+N pages
back) that the next turn clears, and keeps a one-line card in the
transcript.

* feat: add subagent updates and bidirectional paging

* fix: preserve session tools and prompts when toggling updates

* fix: correct notification delivery and CI regressions
2026-09-08 13:47:23 +08:00
7Sageer
e831fd1ea9
feat(secondary-model): drop the experimental flag from the subagent model pool (#3634)
* feat(secondary-model): drop the experimental flag from the subagent model pool

* feat(secondary-model): sync the web bundle without the experimental gate
2026-09-08 11:37:03 +08:00
qer
fa87d040c3
feat(kap-server): expose session deletion with serialized cleanup (#3630)
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
2026-09-08 03:00:40 +08:00
7Sageer
f12d59e089
feat(agent-core-v2): anchor compaction resumption on the latest user message (#3537)
Some checks are pending
CI / test-windows (push) Waiting to run
CI / lint (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-vscode-legacy (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 / Publish native release assets (push) Blocked by required conditions
Release / Native release artifact (push) Blocked by required conditions
Release / Release (push) Waiting to run
Release / Deploy docs (push) Blocked by required conditions
Publish VS Code extension / Publish VSIX to marketplaces (push) Waiting to run
* feat(agent-core-v2): anchor compaction resumption on the latest user message

* fix(agent-core-v2): count the continuation anchor in tokensAfter

* fix(agent-core-v2): simplify the continuation anchor to a single statement

* fix(agent-core-v2): avoid absolute claims in the compaction continuation texts

* fix(agent-core-v2): flag the continuation anchor in compaction records so old records replay unchanged

* fix(agent-core-v2): replay the continuation anchor unconditionally, drop hasContinuation

The anchor is an injection (policy, not history): like the system prompt
and other reminders, it is re-rendered by current code at replay time, so
pre-anchor compaction records gain it on resume. The divergence is
self-limiting (only records written before this change, absorbed on first
resume) and needs no per-record format flag. Fold-length accounting counts
the anchor unconditionally to stay at parity with the rebuilt context.

* fix(vis): align the context projector with the compaction continuation anchor

Locate the compaction summary by origin instead of assuming it is the last
shape message (the anchor now follows it), and pin the anchor in the
projection expectations.
2026-09-07 21:44:24 +08:00