Compare commits

...

278 commits

Author SHA1 Message Date
Liu Zhongnuo
7ccac2b45b
fix(agent-core-v2): wait for MCP discovery before tool announcements (#4364)
Some checks are pending
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-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
* fix(agent-core-v2): wait for MCP discovery before tool announcements

* test(agent-core-v2): register MCP dependency in tool-select harness
2026-10-23 19:58:17 +08:00
grapedge
087db850e0
test: isolate cloud config in message flow tests (#4363) 2026-10-23 18:04:00 +08:00
Haozhe
273ddb077a
feat(oauth): infer region for logged-out installs (#4311) 2026-10-23 16:11:29 +08:00
Kimi Agent
f8925ab95e
chore: sync release/2026-10-23 (2.3.1) back to main (#4361)
* fix: decouple workspace trust from runtime initialization (#4348)

* fix(kap-server): decouple workspace trust from runtime initialization

* fix: preserve workspace trust errors

* fix: emit workspace trust recovery changes

* fix: complete workspace trust recovery

* fix(agent-core-v2): reclaim session locks from zombie processes (#4320)

(cherry picked from commit 0a90e2e8a2)

* feat: let users take over a session lock left by an exited process (#4328)

* feat: let users take over a session lock left by an exited process

Session locks judged alive by mistake (a different hostname, pid reuse, or a failed process-state probe) blocked the session with no way out. Add a takeover path: the lock service evicts another process's lock, the SDK exposes Session.takeOverLock(), kap-server adds POST /api/v1/sessions/{id}:takeover, and the TUI offers Take over once a retry is still occupied. KIMI_CODE_SESSION_LOCK=0 turns the lock off for a process.

* fix(agent-core-v2): evict the lock directly on takeover

Takeover went through the reclaim marker, so a stale marker left by a crashed reclaimer on another host made takeover a silent no-op while the API reported success. Unlink the lock file directly instead.

* fix(agent-core-v2): surface takeover failures when the lock cannot be removed

Takeover swallowed unlink errors, so a lock file another user owns in a shared sticky directory was reported as taken over while the next retry stayed occupied. Ignore only ENOENT and let other errors reach the caller. Also fix the run gate test bootstrap stub typing.

* fix(tui): simplify the session takeover copy

* fix(tui): tie the takeover warning to the takeover action

* fix(tui): drop the holder line from the takeover dialog

* refactor(tui): move the session occupancy dialogs into a controller

(cherry picked from commit e7f1a99fc5)

* chore: sync web dist from code-app

code-app: 76483646b7c46a61bff868f1473535e0a32b473d

---------

Co-authored-by: 7Sageer <sag77r@hotmail.com>

* feat: show session lock holder client names (#4356)

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

code-app: 7be8bf55306625ade7b5dbead86bc789d22d0159

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

* ci: release packages (#4353)

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

---------

Co-authored-by: liruifengv <liruifeng1024@gmail.com>
Co-authored-by: 7Sageer <sag77r@hotmail.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-23 16:09:49 +08:00
Kimi Agent
fc31d047cb
docs(changelog): sync 2.3.1 from apps/kimi-code/CHANGELOG.md (#4360)
Co-authored-by: kimi-agent-bot <kimi-agent-bot@users.noreply.github.com>
2026-10-23 15:50:51 +08:00
Kai
0325b755db
feat(agent-core-v2): leave Plan mode to the user and review every plan (#4247)
Some checks are pending
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-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
* feat(agent-core-v2): leave Plan mode to the user and review every plan

Plan mode becomes a user-controlled mode: the model no longer has a tool
to enter it, and every plan waits for the user's review before plan mode
ends, including in Never Ask mode.

- Remove the EnterPlanMode tool, its default approval and its telemetry
  event, and drop both plan tools from the coder and Tower worker profiles.
- Review ExitPlanMode in every permission mode, and keep plan mode active
  when the plan could not be shown for review.
- Tell the main agent that only the user can turn plan mode on, and to
  answer plan-first or approach questions with a recommendation before
  changing code.
- Rework the plan-mode reminders and the ExitPlanMode description: plans
  lead with context and list verification steps and assumptions; questions
  are limited to what the code cannot answer; in auto mode open decisions
  are recorded as assumptions.
- Stop the exit reminder from implying that a plan was approved after the
  user turns plan mode off.
- Make kimi -p skip default_plan_mode and refuse to resume a session that
  is still in plan mode.
- Update the Never Ask copy, the goal and swarm start dialogs, and the docs.

* chore: merge the plan mode changesets into one

* fix(agent-core-v2): never wait for a person in non-interactive runs

kimi -p declares the host non-interactive, but approvals and questions
still queued for a person with no timeout. Print mode only avoided this
because auto mode never asked. Plan reviews now ask in auto mode too, so
a subagent left in Plan mode by an older version made kimi -p wait for a
review nobody could give.

Approvals now resolve at once in non-interactive hosts and are never
treated as approved: a plain approval denies the call, the plan review
keeps Plan mode on and tells the agent not to retry, and AskUserQuestion
returns that nobody can answer.

* fix: say that plans still wait for review in Never Ask copy and docs

The goal and swarm start dialogs, the /auto tip, the VS Code Auto mode
copy and the reference docs still promised that Never Ask never
interrupts. Plans in Plan mode now wait for review in every permission
mode, so these surfaces name that exception. The agents page also no
longer says that coder subagents can enter Plan mode.

* test(agent-core-v2): pin how bindings recorded with EnterPlanMode resume

Sessions created before EnterPlanMode was removed keep their recorded
system prompt and tool list. Resuming one keeps that prompt, keeps
ExitPlanMode usable for user-started Plan mode, and answers an
EnterPlanMode call with a not-found error.

* fix(agent-core-v2): keep Plan mode on the main agent only

Only the user can turn Plan mode on, and every user-side switch targets
the main agent. Subagents in sessions from older versions could still be
restored in Plan mode, because they used to enter it themselves through
EnterPlanMode. In the TUI their plan review popped up while the main
agent was not in Plan mode, and a subagent whose tool list lacked
ExitPlanMode could not leave Plan mode at all.

The plan state now ignores plan mode entries from any agent but the main
one, live and on replay, and entering Plan mode for a subagent fails.
Restored subagents simply continue their work.

* fix: let kimi -p run sessions that are still in Plan mode

kimi -p refused to resume a session that was in Plan mode, so a session
that any older version could run in print mode now failed with exit 1.
Nobody can review a plan in print mode, but the run does not need to
stop: the plan review already returns at once in non-interactive runs.

A resumed session in Plan mode now runs as usual and stays in Plan mode.
The run can only update the plan, which waits for review the next time
the session is opened interactively, and stderr says so up front.

* chore: rewrite the plan mode changeset

* fix: stop promising that Plan-mode print runs are read-only

The note for a resumed Plan-mode session said the run could only update
the plan, but Plan mode blocks only Write and Edit outside the plan
file. Bash and delegated work follow the permission mode, as they do in
interactive Never Ask.

The note, the docs and the changeset now state what is guaranteed: the
plan cannot be approved in print mode and waits for review.

* fix(agent-core-v2): let the agent answer in text while Plan mode is on

Every Plan-mode reminder told the agent to end each turn with
AskUserQuestion or ExitPlanMode, and in auto permission mode only with
ExitPlanMode, so even a plain question in Plan mode was supposed to end
in a question or a plan review. A planning turn still ends with one of
the two, but a message that calls for an answer rather than a plan,
such as a question about the code, now gets a text answer, and Plan
mode stays on until the user approves a plan or turns it off.

The Plan-mode note in the system prompt now keeps only the facts and
the user's intent: only the user can turn Plan mode on, and when they
ask to plan first, the agent waits for their go-ahead before changing
code. It no longer treats every question about how to approach a task
as a reason to stop, and no longer prescribes the shape of the reply.

In non-interactive runs, the plan review and AskUserQuestion results
now only state that nobody can review or answer, and that Plan mode
stays on for the rest of the run, instead of telling the agent what to
do next.

* test: pin that every plan waits for review across modes and hosts

Plan reviews now run in every permission mode, so pin the cases where a
regression would most likely slip through:

- yolo mode, allow rules for ExitPlanMode, and an earlier approval for
  the whole session do not skip the review of the next plan;
- in Never Ask, kap-server surfaces the review as a pending plan_review
  approval over REST and in the transcript, and approving, revising and
  dismissing it leave Plan mode in the expected state;
- kimi -p keeps stream-json stdout parseable when the resumed session
  is still in Plan mode;
- the reminder sent after leaving Plan mode only carries out a plan the
  user approved.
2026-10-23 13:18:59 +08:00
tpoisonooo
01ef64ea92
feat(tower): improve concurrency, locking, and per-spawn model selection (#4312)
* fix(tower): remove fixed agent concurrency cap

* perf(tower): parallelize mission status processing

* fix(tower): shrink state lock critical sections

* fix(tower): preserve lock exclusion and completion idempotency

* fix(tower): serialize stale lock reclamation

* fix(tower): canonicalize reaper lock identity

* fix(tower): clarify dependency merge ordering

* feat(tower): allow per-spawn model selection

* fix(tower): simplify lock configuration and dependency prompts

* fix(tower): cap default agent concurrency at 256

* fix(tower): fall back when hard links are unavailable

* fix(tower): use bounded backoff for prepared commits

* fix(tower): serialize inbox publication with completion

---------

Co-authored-by: konghuanjun <konghuanjun@moonshot.ai>
2026-10-23 12:11:50 +08:00
Kai
759958afdf
fix(agent-core-v2): update import-from-cc-codex for current Claude Code and Codex layouts (#4331)
Some checks are pending
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-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
* fix(agent-core-v2): update import-from-cc-codex for current Claude Code and Codex layouts

Honor CLAUDE_CONFIG_DIR and CODEX_HOME, import project CLAUDE.md, CLAUDE.local.md, Claude rules, Codex AGENTS.override.md, and Claude project-local MCP servers, and map the current Claude Code and Codex MCP fields. Stop scanning .claude/AGENTS.md, .codex/AGENTS.md, and .codex/skills, which neither tool reads.

* fix: preserve imported instructions and server settings

* fix(agent-core-v2): keep placeholder examples literal in import-from-cc-codex

The skill renderer substitutes argument and KIMI placeholders anywhere in a skill body, so the migration guidance reached the model with the session ID and a builtin path in place of the Kimi placeholder names, and invocation arguments were spliced into the prose. Name the placeholders without their literal forms and pin the rendered body in a test.

---------

Co-authored-by: qer <wbxl2000@outlook.com>
2026-10-22 20:30:23 +08:00
qer
79a76ea2da
refactor: remove unused session terminal service (#4333)
* refactor: remove unused session terminal service

The terminal_* WebSocket controls lost their dispatch when the v1 connection was rewritten, so terminals could be created over REST but never attached, written to, or resized. No client uses them: the web UI has no terminal and the desktop app runs its own native PTY. Remove the REST routes, WebSocket schemas, meta capability, error code, session terminal service, host PTY backend, runtime terminal capability, and the node-pty dependency.

* chore: update nix pnpmDeps hash after node-pty removal
2026-10-22 19:57:24 +08:00
grapedge
44cdf8f403
feat(tui): allow expanding streaming thinking (#4322) 2026-10-22 15:35:30 +08:00
Kimi Agent
4c5d7d5e27
chore: upgrade to TypeScript 7 (native compiler) (#4329)
* chore: upgrade to TypeScript 7 (native compiler)

- typescript 6.0.2 -> 7.0.2, tsdown 0.22.0 -> 0.23.1 (peer range now allows typescript ^7)
- CI typecheck uses the workspace tsc (native) instead of the frozen @typescript/native-preview beta snapshot
- product entry-points test spawns the tsc binary; the JS compiler API no longer ships with typescript
- check-no-comments.mjs pins typescript-legacy (TS6) for AST access

Co-authored-by: chengluyu <2239547+chengluyu@users.noreply.github.com>

* chore: align remaining typescript pins and refresh the nix pnpmDeps hash

- apps/kimi-inspect and apps/vis/web pin their own typescript; bump to 7.0.2 (sherif multiple-dependency-versions)
- flake.nix fetchPnpmDeps hash tracked the old lockfile; recompute for the new one (fixes nix build)

Co-authored-by: chengluyu <2239547+chengluyu@users.noreply.github.com>

* test(product): fail loudly when the tsc subprocess cannot run

runTsc only scanned output text; a missing native binary, a timeout, or
a spawn failure would yield empty diagnostics and the boundary checks
would pass vacuously. Assert the spawn error and exit status first.

Co-authored-by: chengluyu <2239547+chengluyu@users.noreply.github.com>

---------

Co-authored-by: kimi-agent-bot <kimi-agent-bot@users.noreply.github.com>
Co-authored-by: chengluyu <2239547+chengluyu@users.noreply.github.com>
2026-10-22 15:14:15 +08:00
7Sageer
e7f1a99fc5
feat: let users take over a session lock left by an exited process (#4328)
* feat: let users take over a session lock left by an exited process

Session locks judged alive by mistake (a different hostname, pid reuse, or a failed process-state probe) blocked the session with no way out. Add a takeover path: the lock service evicts another process's lock, the SDK exposes Session.takeOverLock(), kap-server adds POST /api/v1/sessions/{id}:takeover, and the TUI offers Take over once a retry is still occupied. KIMI_CODE_SESSION_LOCK=0 turns the lock off for a process.

* fix(agent-core-v2): evict the lock directly on takeover

Takeover went through the reclaim marker, so a stale marker left by a crashed reclaimer on another host made takeover a silent no-op while the API reported success. Unlink the lock file directly instead.

* fix(agent-core-v2): surface takeover failures when the lock cannot be removed

Takeover swallowed unlink errors, so a lock file another user owns in a shared sticky directory was reported as taken over while the next retry stayed occupied. Ignore only ENOENT and let other errors reach the caller. Also fix the run gate test bootstrap stub typing.

* fix(tui): simplify the session takeover copy

* fix(tui): tie the takeover warning to the takeover action

* fix(tui): drop the holder line from the takeover dialog

* refactor(tui): move the session occupancy dialogs into a controller
2026-10-22 14:37:49 +08:00
HydrogenE7
874d9abb32
feat: add /provider refresh subcommand (#4316)
Some checks are pending
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
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
Nix Build / Check flake.nix workspace sync (push) Waiting to run
Nix Build / nix build .#kimi-code (push) Blocked by required conditions
CI / release-workflow-tests (push) Waiting to run
2026-10-21 20:40:00 +08:00
7Sageer
0a90e2e8a2
fix(agent-core-v2): reclaim session locks from zombie processes (#4320) 2026-10-21 20:39:00 +08:00
7Sageer
366fafbf92
feat(kap-server): reclaim idle sessions (#4284)
* feat(kap-server): reclaim idle sessions

* test: trim idle session reclaim test duplication

* test: fix idle reaper fake typing

* fix(kap-server): preserve session state during idle reclaim

* fix(kap-server): resume cold sessions for tool routes

* fix(kap-server): report failed WS session resumes

* refactor(agent-core-v2): let features declare session idle retention

Move the cron, goal, and lifecycle-hook reclaim guards out of SessionManager
into a SessionRetentionContribution collection that each feature contributes,
check retention once under the session lease, and drop the dead optional
task-service branches in the tasks route.

* refactor(agent-core-v2): measure session idle from the activity view

* refactor(agent-core-v2): reclaim idle sessions silently instead of retaining hooked sessions

* fix(kap-server): only resume explicitly requested sessions in tool routes

* refactor(agent-core-v2): inline the cron idle-reclaim guard and stop retaining active goals

* fix(kap-server): reject invalid idle reclaim timeouts

* fix(kap-server): preserve rating evaluation across idle reclaim

* test(kap-server): trim idle reclaim tests

* fix(kap-server): validate idle reclaim config early

* refactor(agent-core-v2): rename the reclaim resume source and derive lifecycle literal unions

* refactor(agent-core-v2): keep the reclaim lifecycle tags off the public lifecycle interface

* fix(agent-core-v2): drop the reclaim marker once a session is archived

* Implement session unload after 30 minutes of idle time

Updated session management to unload sessions after 30 minutes of inactivity for both web and desktop applications.

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

* fix(agent-core-v2): reclaim sessions with exited terminals

---------

Signed-off-by: 7Sageer <sag77r@hotmail.com>
2026-10-21 19:27:25 +08:00
HydrogenE7
256ce61f0c
perf(agent-core-v2): speed up large session resume (#4313) 2026-10-21 17:20:19 +08:00
Kimi Agent
4bad441fef
chore: sync release/2026-10-21 (2.3.0) back to main (#4306)
* ci: release packages (#4288)

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

* revert: remove default workspace session creation (#4295)

(cherry picked from commit 83c7909be9)

* chore: merge release/2026-10-20 into release/2026-10-21 (#4294)

Bring the cloud-gated model switch confirmation (#4286, #4292) and the
queued /compact (#4276, #4279) onto main via the release back-sync.

The two changesets that rode along with the original squash
(.changeset/model-switch-confirm-dialog.md,
.changeset/queue-compact-command.md) are excluded here: they were
consumed by the 2.3.0 release and must not be re-consumed on main.

(cherry picked from commit 3f80896a79)

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

code-app: 913137036c35c608f3a487eb2c7b4a8815b53b95

The stray .changeset/web-interaction-polish.md carried by the dist
payload is excluded: it was consumed by the 2.3.0 release and never
existed on main.

(cherry picked from commit d36071ede6)

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>
Co-authored-by: qer <wbxl2000@outlook.com>
Co-authored-by: kimi-agent-bot <kimi-agent-bot@users.noreply.github.com>
2026-10-21 14:50:45 +08:00
Kimi Agent
95eeeecf9b
docs(changelog): sync 2.3.0 from apps/kimi-code/CHANGELOG.md (#4305)
* docs(changelog): sync 2.3.0 from apps/kimi-code/CHANGELOG.md

* docs(changelog): drop VS Code 0.8.3 entry from 2.3.0 CLI changelog

---------

Co-authored-by: kimi-agent-bot <kimi-agent-bot@users.noreply.github.com>
2026-10-21 13:52:30 +08:00
Haozhe
67325c1b25
fix(transcript): realign rebuilt turn ordinals to wire ids and mark wedged turns (#4280)
Some checks are pending
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-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
* fix(transcript): realign rebuilt turn ordinals to wire ids and mark wedged turns

Cold transcript rebuilds numbered materialized turns 0..N while the live
projector assigns ordinal=wireId, so a session rebuilt after a restart got a
shifted axis that no longer aligned with what clients had cached live, and a
turn whose loop died before writing a terminal event was rebuilt as a fake
completed turn with no timestamps.

foldWireRecordFacts now reassigns every matched rebuilt turn to its wire turn
id (leaving holes for folded turns), restores startedAt from the
agent.turn.started / turn.prompt records, and marks a turn with no terminal
event as wedged (state failed + wedged flag) once a later turn prompt exists
in the wire; the tail turn is only wedged when it is not the live active one.
The live projector closes the previous running turn as wedged when a new turn
starts. The wedged marker is an additive optional field so released clients
keep parsing transcripts and render the turn as failed.

* feat(agent-core-v2): surface silent notification-delivery and persistence failures

The wedged-turn incident showed a main agent loop can stall for hours with
zero diagnostics: task notifications pooled in memory, a latched or hung wire
flush swallowed every subsequent record, and the running turn produced no
watchdog output.

- AppendLogStore warns once when an append is accepted while a storage
  failure is latched, and warns when a flush stays pending past 30s
  (repeating every 10min) with scope/key/pending counts.
- WireService routes append failures to ILogService in addition to
  onUnexpectedError so they land in the daemon log.
- AgentLoopService arms a per-turn watchdog that warns after 10min without
  observable progress (steps, streaming partials, machine phase), including
  pending notification/pause/queue state; loop.notify and nudge consumption
  log buffered/drained counts at debug level.
- AgentTaskService warns when lifecycle guards silently drop task
  notifications or terminal events, and debug-logs in-process redelivery
  suppression.
- EventDispatcherService warns once per episode when dispatch is stuck for
  over 30s and events keep queueing behind it.

* test(agent-core-v2): quiesce the spawned notification turn before counting leaked timers

With the loop turn watchdog armed, a notification-driven turn that happens
to be running at the assertion holds a legitimate interval, making the
global timer count scheduling-dependent. Cancel any spawned turn and pump
the clock until the loop is idle before counting.

* chore: add changeset for the wedged-turn transcript fix
2026-10-20 18:00:19 +08:00
7Sageer
3079e9515f
feat(agent-core-v2): add cross-process session occupancy lock (#4246)
* feat(agent-core-v2): add cross-process session occupancy lock

Multiple clients (TUI / kap-server / VS Code / ACP) running core in
separate processes could open the same session and corrupt each
other's wire.jsonl and metadata. Each session now holds a cross-process
occupancy lock ({homeDir}/locks/sessions/{id}.lock) taken only while
writing: runs acquire it on submit / compact / undo / cron / delete /
fork / cold-archive, the append log holds it before flushing, and a
stale check compares the main agent wire's on-disk length with the
length this process knows.

Collisions surface as session.occupied (holder in details); writes by
another client detected after acquire surface as session.stale and the
caller reloads before continuing. kap-server maps them to
SESSION_OCCUPIED (40903) / SESSION_STALE (40930), reloads the session
on stale, and re-attaches WS subscriptions; the TUI shows an occupancy
dialog (retry/cancel) or reloads and replays history keeping the input;
print exits with code 4 on occupied and reloads automatically on stale;
VS Code / ACP get minimal occupancy notices. Locks are released a few
seconds after the session goes idle, on close, and on process exit;
locking I/O failures degrade to unlocked operation with a warning.

* docs: document session occupancy error codes and lock directory

* fix: address codex review on session occupancy lock

- metadata: re-read state.json on the first write of each lock-hold
  epoch (holdToken), so pure-metadata changes made by another client
  (title, archive) are not clobbered by turn-end lastPrompt writes
- lifecycle: hold an explicit lease across live archive(), matching
  delete(), so the idle release timer cannot drop the lock mid-teardown
- tui: route the occupied dialog's Cancel selection through the same
  cleanup as Esc (restore input, release recalled media)
- acp: tell stale-session users to close and reopen the session
- append-log: warn when retirement drops records kept in memory because
  the session lock was unavailable

* fix: always run the staleness check in beginSessionRun

The prompt channels (AgentPromptChannel.submit/submitSteer, kap
/prompts, promptWithSkills) write prompt metadata before calling
loop.submit, and the metadata write acquires the session lock first.
beginSessionRun then short-circuited on 'already held' and skipped the
wire-length staleness check, so the main prompt path never detected
updates written by another client. Drop the already-held shortcut: the
check is a single stat and always passes while the lock is continuously
held, so every acquisition path now runs it regardless of order.

* fix(print): preserve occupied handling on the stale retry

If another client acquires the session between the reload and the
retry, the retried turn now goes through the same conflict handler:
session.occupied reports to stderr / stream-json and exits with code 4
instead of bubbling out as exit code 1.

* fix: do not mistake own in-flight writes for external modification

storage.append grows the file (writeFile) before fsync/close complete,
and knownLength only catches up afterwards; a beginSessionRun landing
in that window (steer, queued prompts, cron fires during a turn) was
misjudged as session.stale and deleted the lock file mid-turn. Track
in-flight bytes per log and compare disk against known + in-flight.
Cover the analogous rewrite window (post-rename syncDir) with an
expected-final-length marker.

* fix: bound the staleness comparison and check once per lock hold

The equality check disk !== known + inFlight moved the false-positive
window to before the append lands (mkdir/open) and into chunked
writes, so beginSessionRun during a turn (steer, cron, queued prompts)
could misjudge, delete the lock file mid-turn, and later append behind
another client. Compare known <= disk <= known + inFlight instead, and
evaluate the check only on a fresh hold (holdToken epoch): re-entrant
runs pass through without a stat, matching the RFC's 'already held
passes through' while every acquisition path still triggers the check
exactly once per hold.

Also unify the occupancy prompt copy across clients: the engine error
message is now the single user-facing text ('该会话正在被其他 Kimi
Code 进程使用;请停止其他进程中的会话或退出该进程后重试'), and the
TUI dialog, /compact /undo errors, print output, and the VS Code
fallback all display it instead of maintaining their own wordings.

* fix: address third-round codex review

- metadata: hold an explicit lease across each state.json write so the
  idle release timer cannot unlink the lock mid-write
- print: preflight the session lock before goal creation; make goal
  creation idempotent and emit the goal summary only for attempts that
  did not fail with session.stale, so a stale reload + retry neither
  duplicates the goal nor the summary
- tui: route every prompt-launch path (plain, goal steer, plugin
  command, inline skill, batch steer) through one conflict handler
  with the occupied dialog and stale reload + input restore
- tui: snapshot and restore the attachment store across stale reloads
  so pasted media placeholders still resolve after history replay

* fix: move session occupancy to a fresh error code, use English copy, release locks on exit

SESSION_OCCUPIED reused 40903, which belonged to PROMPT_ALREADY_COMPLETED until #3747 retired it, and web clients still allowlist 40903 for that old meaning; reusing it conflated the two semantics. Move session occupancy to the never-used 40931 and update the server API reference in both locales.

The occupied error message was hardcoded in Chinese while every other engine error is English, so the TUI, print mode, VS Code, and ACP clients all rendered mixed-language output; replace it with an English equivalent.

The lock release hook ran on 'beforeExit', which never fires when the process leaves through process.exit (SIGHUP in the TUI goes through emergencyTerminalExit), leaving stale lock files that could keep a session looking occupied forever after a hostname change or pid reuse. releaseAll is fully synchronous, so hook 'exit' instead.

* fix(agent-core-v2): decide prompt-derived titles after re-reading session metadata

applyPromptMetadataUpdate decided whether to derive a title from the
prompt from the in-memory metadata cache, which is only refreshed when
the session lock is re-acquired. If another client named the session in
the meantime, the stale cache still looked untitled, so the next prompt
from this client overwrote the other client's title — both on the stale
path, where the prompt is rejected afterwards, and on the fresh path,
where the other client only changed the title on disk.

Move the untitled check into SessionMetadata.applyPromptMetadata, which
runs after ensureWriteOwnership() has re-read state.json, so the
decision is based on the latest persisted metadata. The published
SessionMetaUpdated event now carries the derived title only when it was
actually written.

* fix: address fourth-round codex review

- vscode: classify session.occupied and session.stale as preflight errors so the webview toasts them instead of silently swallowing the send, and give session.occupied the same English copy the engine emits (the toast text comes from getUserMessage in the extension host).
- engine: beginSessionRun now takes the session context and agent lifecycle service, and on the first check of each lock hold it runs externallyModified over every loaded agent's wire (scope agents/<agentId>, key wire.jsonl) instead of only the main agent's, so a fork that only touched a subagent journal is detected as stale. All four call sites (loop submit, manual compaction begin, undo, print preflight) pass the extra dependency.
- tui: keep the request in flight across a stale reload instead of dropping to idle, so input submitted during the reload queues rather than racing the closing session; park the queue around switchToSession (resetSessionRuntime would clear it) and drain it into the reloaded session afterwards; when restoring the rejected text, prepend it before content the user typed during the reload instead of overwriting it.
- kap-server: clear the in-flight turn tracker and subagent roster in detachSession so a reattached session no longer reports stale in-flight turns or running subagents in REST snapshots and WS resyncs.

* fix: harden session conflict recovery

Detect external appends that race journal reads so a later run cannot miss session.stale. Keep deferred wire migrations pending and finish them before appending, while rejecting the append if migration still cannot complete. Restore the complete plugin command after an occupied cancellation, including commands without arguments.

* fix: scope session staleness cache to session context

Replace the process-global session-id map with a WeakMap keyed by ISessionContext so closed and reloaded sessions do not retain cache entries for the lifetime of the process.

* fix: document session conflicts for metadata routes

Declare SESSION_OCCUPIED and SESSION_STALE in the response schemas for profile updates, title generation, and child creation. Cover the OpenAPI declarations and the existing HTTP 200 conflict envelopes with regression tests.

* refactor: centralize session conflict handling

Move session error mapping and stale reloads into one shared route helper, reuse shared conflict response declarations, and cover skill activation conflicts. Remove the duplicate prompt, session, and skill error mappers while preserving their existing envelopes.

* fix(sdk): restate session conflict errors

* fix(tui): keep the reloaded session open and resend after a stale conflict

* fix(agent-core-v2): lazily rebuild registered agents after a session reload

* refactor: simplify session conflict handling

* refactor: hygiene fixes from session-lock review

- kap-server: move SESSION_STALE to 40932 (collided with
  DEFAULT_WORKSPACE_UNAVAILABLE at 40930) and pin ErrorCode value
  uniqueness with a test
- node-sdk: fold six catch-and-restate copies into a restate() helper
- acp-server: sync mapPromptLaunchError docstring with the
  occupied/stale branches
- replace hardcoded session.stale/session.occupied literals with
  ErrorCodes constants
- inline the single-use sessionStaleError
- restore the strict timer-leak assertion with a warmup baseline
  instead of a blanket +1 allowance
- narrow SessionState.detached to ?: true

* refactor: introduce session-level run gate

- replace the beginSessionRun free function with ISessionRunGate, a
  Session-scoped service; loop/compaction/undo now inject one
  dependency instead of four, and sessionLock.ts no longer imports
  session-layer modules
- tryHold() absorbs the duplicated try/catch hold copies in
  wireService and sessionMetadataService
- resolve IAgentLifecycleService lazily inside the gate to avoid a
  construction-time cycle with agentLifecycleService

* refactor: tighten session lock and conflict recovery structure

- Narrow ISessionLockService to hold/tryHold/release/lease/held and share
  the hold bookkeeping between the memory and node-fs backends; drop
  holdToken and the module-level exit hook state.
- Session metadata refreshes on a new hold via onDidHold and skips agent
  registration through tryHold instead of catching session.occupied.
- AppendLogStore reads sizes through IFileSystemStorageService.sizeSync and
  exposes a generic write guard instead of a session-lock binding.
- kap: reload stale sessions only at the call sites that can raise
  session.stale and log reload failures; error mapping stays side-effect free.
- TUI: recover from a stale conflict through the in-place session reload with
  history replay, removing the same-session switch special case, the media
  store snapshot, and the queue parking.
- print: bound stale reloads with a simple retry loop.

* refactor(agent-core-v2): merge session lock release into run gate

* test(agent-core-v2): reuse append log fixtures

* refactor(agent-core-v2): break run gate and agent lifecycle dependency cycle

* refactor: reload stale sessions in core instead of each host

Stale detection already lived in core, but every host re-implemented the
recovery: TUI, print, and kap each closed and resumed the session, and TUI
and web resent the rejected input themselves.

Core now exposes reloadOnStale: on session.stale it closes and resumes the
session, lets the caller refresh, then retries the call once (undo reloads
and still rejects, since its count depends on what the user saw).

- kap: prompt submit, skill activation, and compact retry in place instead
  of returning 40932; undo still returns 40932 after reloading
- print: retries through reloadOnStale on the same session id and keeps the
  original permission mode to restore
- SDK: run-starting calls reload and retry internally; Session gains
  setStaleReloadHandler so hosts refresh before the retry
- TUI: drops its own reload/resend/queue-merge path; the stale handler
  replays history and keeps in-flight messages

* docs(server-api): note that only undo returns 40932 after a stale reload

* refactor(agent-core-v2): ask each agent's wire whether it was modified externally

* refactor(agent-core-v2): clarify agent restoration helper name

* Delete .changeset/ensure-agent-lazy-rebuild.md

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

* fix(tui): wrap session occupied notice

---------

Signed-off-by: 7Sageer <sag77r@hotmail.com>
2026-10-20 17:21:18 +08:00
Kimi Agent
5fec8d19a5
test(remote-control): split the tunnel end-to-end case and make transfer limits injectable (#4290)
Co-authored-by: kimi-agent-bot <317908118+kimi-agent-bot@users.noreply.github.com>
2026-10-20 16:52:03 +08:00
grapedge
ce0834a8f3
feat: share session rating rules across CLI and server (#4272) 2026-10-20 14:20:55 +08:00
Haozhe
5710c5496a
fix(kap-server): evict session event state on session close and archive (#4281)
Some checks are pending
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-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
2026-10-19 20:24:57 +08:00
qer
e5e56bc5fe
feat(server): place the default workspace under the home folder (#4277)
Some checks are pending
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-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
The default workspace lived in <Documents>/KimiCode/Default. On macOS the
first chat there triggered a Documents privacy prompt, and a denial blocked
every later chat until the user found the setting. Documents is also synced
by iCloud and OneDrive, and covered by Windows Controlled Folder Access.

Use ~/KimiCode/Default on every platform instead. This drops the Windows
PowerShell lookup, the XDG user-dirs parsing, and the documents_unavailable
reason; the error path is now always present.
2026-10-19 16:13:43 +08:00
qer
47002256a0
feat: add a default workspace for chats without a project (#4224)
* 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.

* 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.

* 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.

* test(server): assert the existing error code for a missing Windows Documents folder

* 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.

* 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.

* 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.

* 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.

* 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.

* 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.

* 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>.

* refactor: trim the default workspace to what clients use

Keep session creation in the default workspace, the configurable
location, the 40930 error with its reason, and `kimi --default-workspace`.

Remove what no client needs:
- write probes, ancestor walks, and dangling-link checks; saving a
  location now creates the folder, and use-time errors come from mkdir
- `system_path` and `problem` in the status response
- the workspace-update publisher; clients refetch workspaces after PATCH
- special handling of `default_workspace` in GET/POST /config
- the stray FS_PERMISSION_DENIED mapping on session routes
- the session picker label, the doctor check, the extra stty exclusion,
  the moved-default resume hint, and the SDK path/status methods

Fix three gaps found along the way:
- clearing the location left `path` in config.toml, so it came back on
  reload; drop the section instead
- treat an empty or relative XDG_CONFIG_HOME as unset
- honor HostProcessOptions.timeout so a stalled PowerShell lookup ends

* refactor: drop the --default-workspace CLI flag

No CLI user needs it yet. Desktop and web reach the default workspace
through the server, so the flag, its resume hint, and the SDK's
ensureDefaultWorkspace() go away along with their changesets.

* refactor: drop the default workspace settings endpoint

The location is now changed only by editing default_workspace.path in
config.toml, which the config watcher picks up without a restart. Remove
GET/PATCH /api/v1/default-workspace and the engine's status() and
setCustomPath(). Session creation keeps mapping the unavailable error to
40930 with { path, reason }, and the reason list moves to the
POST /sessions docs.

* fix: require a drive or UNC share for a Windows default workspace path

Rooted paths such as \Chats resolve against the server's current drive,
so the same setting could point at different folders. Treat them as
invalid_path instead.
2026-10-19 12:29:51 +08:00
Kimi Agent
4a82a07f08
docs: add review scope rules to AGENTS.md (#4265)
Some checks are pending
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-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
* docs: add review scope rules to AGENTS.md

* docs: verify current code before suppressing resolved threads

---------

Co-authored-by: kimi-agent-bot <317908118+kimi-agent-bot@users.noreply.github.com>
2026-10-18 02:38:34 +08:00
liruifengv
18c6d64272
feat: notify the agent of external changes after /reload (#4019)
Some checks failed
CI / release-workflow-tests (push) Has been cancelled
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
CI / typecheck (push) Has been cancelled
Nix Build / Check flake.nix workspace sync (push) Has been cancelled
Nix Build / nix build .#kimi-code (push) Has been cancelled
* feat: notify the agent of external changes after /reload

* refactor: route watch-based AGENTS.md change alerts through the change notifier

* test: pin the missed detection of trailing AGENTS.md content deletions

* fix(agent-core-v2): anchor change-notifier comparisons to delivered beliefs

* fix(agent-core-v2): diff the full subagent model pool in change notifications

* fix(agent-core-v2): mute stale-session auto notifications during session reload

* chore(agent-core-v2): regenerate manifests and complete notifier stubs for the reload fixes

* chore: update the reload-change-reminders changeset

* test(agent-core-v2): cover the announced-then-deleted AGENTS.md sequence

* fix(vis): cover the changeNotifier.snapshot wire record

* fix(agent-core-v2): harden change-notifier beliefs for legacy wires and edge baselines

* fix(agent-core-v2): unmute the stale notifier when a session reload fails midway

* fix(agent-core-v2): seed change-notifier beliefs from the rendered snapshot

* fix(agent-core-v2): await the change-notifier snapshot dispatch

* fix(vis): harden the change-notifier snapshot renderer for legacy records

* test: isolate the reload e2e from the watch channel and tighten seed assertions

* chore(agent-core-v2): regenerate the wire manifest for optional belief fields

* chore: drop the changeset for reload change reminders

* fix(agent-core-v2): diff reload reminders against persisted beliefs first

* fix(agent-core-v2): recompute the bound subagent allowlist on catalog changes

* fix(agent-core-v2): roll back change-notifier beliefs on conversation undo

* feat(agent-core-v2): inline added profile metadata in subagent change reminders

* fix(agent-core-v2): detect legacy AGENTS.md truncation and gate skill reminders

* fix(agent-core-v2): reset change-notifier beliefs on context clear

* feat(kap-server): project the reload session action into the OpenAPI document

* fix(node-sdk): keep plugin-only reloads from refreshing workspace catalogs

* fix(agent-core-v2): gate and filter subagent change reminders

* fix(agent-core-v2): evaluate reminder gates against the persisted binding

* fix(kap-server): scope reload catalog refreshes to the target workspace

* fix(node-sdk): scope reload catalog refreshes to the target workspace

* fix(agent-core-v2): reset change-notifier beliefs on compaction

* fix(agent-core-v2): hash AGENTS.md files from one atomic snapshot

* fix(agent-core-v2): close first-watch and legacy gaps in change detection

* fix(kap-server): block reload during compaction and reconcile after failed reload

* fix(node-sdk): block reload during compaction and reconcile after failed reload
2026-10-16 15:15:57 +08:00
Kimi Agent
8fcd3326e7
fix(tui): fold previews only when collapsing saves rows (#4248) 2026-10-16 13:28:52 +08:00
Haozhe
6e7cc909da
feat(agent-core-v2): let dangerous_command_guard=false disable all built-in guard ask policies (#4250)
* feat(agent-core-v2): let dangerous_command_guard=false disable all built-in guard ask policies

* docs(agent-core-v2): name git control-path read relaxation and scope the only-ask-rules claim
2026-10-16 13:23:18 +08:00
Haozhe
ef727e5179
feat(remote-control): support chunked streaming transfers up to 100 MiB (#4214)
Some checks are pending
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-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
2026-10-15 19:41:19 +08: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
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
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
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
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
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
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
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
Kai
7091138f5e
fix(agent-core-v2): allow mid-turn progress notes and calm NotifyUser nudges (#4153)
* fix(agent-core-v2): stop discouraging mid-turn progress notes and calm NotifyUser nudges

- system prompt: drop the inaccurate "text between tool calls may not be
  shown" premise; ask for one- or two-sentence progress notes instead
- remove the mid-turn text nudge that asked the model to repost visible
  text as a NotifyUser update
- count the silence nudge in tool-call rounds (one per step) instead of
  individual tool calls, so parallel calls no longer trip it early

* feat(agent-core-v2): track NotifyUser nudges and updates

- notify_user_nudge_shown: rounds since the last update and the nudge's
  position within the current silent stretch
- notify_user_sent: rounds before the update, whether a nudge preceded
  it, message length (no content), and whether it was displayed

* chore: add changeset for mid-turn progress notes and NotifyUser nudges
2026-10-09 16:15:04 +08:00
qer
242ac23000
feat(cli): launch desktop with kimi app (#4145)
* feat(cli): launch desktop with kimi app

* fix(cli): report desktop opener failures and complete command tests

* fix(cli): resolve system openers from filesystem roots
2026-10-09 15:08:24 +08:00
liruifengv
5b93669767
feat(kap-server): add allow_ignored_globs to fs:list for un-ignoring named paths (#4058)
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(kap-server): add allow_ignored_globs to fs:list for un-ignoring named paths

The list filter keeps gitignored entries hidden unless they match the
new allow_ignored_globs request field, letting callers surface
specific ignored paths (e.g. .tmp) while the rest of gitignore still
applies.

* docs: document allow_ignored_globs in the fs:list API reference

* fix: traverse ignored ancestor directories of allow_ignored_globs matches

A nested allow glob such as ignored-dir/keep.txt or ignored-dir/** used
to be unreachable in recursive listings because the ignored parent was
skipped before any child could match. Keep an ignored entry when it is a
literal-prefix ancestor of an allowed glob (directories only), and
document that dot-path allowances additionally require show_hidden.

* fix: match ignored ancestor directories across wildcard glob segments

The literal-prefix check still dropped ancestors when a directory
segment of an allow glob contained a wildcard, e.g. ignored-*/keep.txt
or ignored-dir/**/keep.txt. Decide reachability by consuming the
candidate path segment-wise against a prefix of the glob instead.

* fix: correct and harden workspace fs glob matching

Compile **/ to (?:[^/]+/)* so recursive wildcards preserve path
segment boundaries; a/**/b no longer matches a/xxb. This affects
include_globs, exclude_globs, and allow_ignored_globs across
fs:list / fs:search / fs:suggest / fs:grep.

Match glob prefixes iteratively in globCanMatchBelow so deeply
segmented globs cannot exhaust the call stack.

* chore: add changesets for allow_ignored_globs and the glob boundary fix

* fix: satisfy noUncheckedIndexedAccess in the glob prefix grid

* fix: restrict globstar segment expansion to whole path segments

foo**/keep.txt regressed when **/ gained segment-boundary semantics:
the stars sat mid-segment but were expanded as a whole-segment
globstar. Only expand **/ when the stars open a path segment, treat
mid-segment stars as an ordinary within-segment wildcard, and keep a
trailing ** matching across segments as before.

* fix: match workspace fs globs with picomatch and probe speculative ancestors

Replace the hand-rolled glob compiler with picomatch, the standard
engine already used elsewhere in the package, which settles segment
boundary, mid-segment globstar, and deep-pattern complexity edge
cases for good. An ignored directory kept only as a possible ancestor
of an allow glob is now probed (depth and entry capped, fail-open) and
withheld when no descendant actually matches.

* fix: cast readonly glob list for picomatch isMatch

* fix: parse globs whole in the ancestor check and share the probe budget

Splitting allow globs on '/' corrupts brace and extglob constructs
that contain slashes; take path segments from picomatch.scan instead
and fall back to a conservative answer for opaque single-token globs,
letting the descendant probe decide visibility with whole-pattern
matching.

Probe budgets are now shared across one fs:list request instead of
resetting per candidate directory, so a tree full of speculative
ancestors cannot multiply filesystem operations.

* fix: tolerate empty globs and slash-bearing alternatives

picomatch throws on empty patterns where the old compiler simply
never matched, turning previously valid requests into server errors;
filter them out up front. Brace and extglob alternatives that embed
a slash inside one scanned part now fall back to the conservative
ancestor answer as well, leaving visibility to the whole-pattern
descendant probe.

* fix: disable picomatch negation in workspace fs globs

A leading exclamation mark was a literal character in the old
matcher, so exclude_globs like !foo only matched a path literally
named !foo; as a picomatch negation the same request would exclude
everything except foo. Pin the prior semantics with nonegate.

* fix: scan allowance globs with nonegate and skip empty segments

The scan call still used default negation, stripping a literal
leading bang from allowance prefixes like !foo/keep.txt. Consecutive
separators produced empty scanned segments that made picomatch throw
during prefix compilation; empty segments now simply match nothing.

---------

Co-authored-by: qer <wbxl2000@outlook.com>
2026-10-08 18:21:54 +08:00
grapedge
eec9bbd949
feat(kimi-code): support per-model survey popup overrides (#4033) 2026-10-08 15:07:13 +08:00
Duy Phan
0f052fee13
fix(tui): sanitize foreground Bash tool output (#2919) 2026-10-08 11:55:34 +08:00
Haozhe
21406fb4c8
fix(agent-core-v2): omit completion token cap unless explicitly configured (#4091)
Some checks failed
Publish VS Code extension / Publish VSIX to marketplaces (push) Has been cancelled
CI / test-windows (push) Has been cancelled
CI / lint (push) Has been cancelled
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 / typecheck (push) Has been cancelled
Nix Build / Check flake.nix workspace sync (push) Has been cancelled
Release / Release (push) Has been cancelled
Nix Build / nix build .#kimi-code (push) Has been cancelled
Release / Deploy docs (push) Has been cancelled
Release / Native release artifact (push) Has been cancelled
Release / Publish native release assets (push) Has been cancelled
2026-09-30 15:23:40 +08:00
grapedge
33e368a1ef
feat(tui): add sticky user messages in fullscreen mode (#4031) 2026-09-30 14:45:45 +08:00
Haozhe
f409caa21e
fix(agent-core-v2): clear inherited cron tasks at the fork record (#4083)
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 / 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
Fork copies the wire journal, so cron tasks persisted as cron.add
records were inherited by the fork and fired from both sessions.
Fold the forked marker record into the cron actor: the task table is
cleared at the fork point and a one-time cron_fork_cleared reminder is
delivered (tracked by a durable forkNotice flag confirmed via
ContextAppendMessage), mirroring the goal feature's fork handling.
The forked event class moves from features/goal to
session/agentLifecycle so both features share it.
2026-09-29 19:10:48 +08:00
Luyu Cheng
20a2cea72f
feat: cap WaitFor at 90s and let new input end the wait (#4061) 2026-09-29 18:52:09 +08:00
Haozhe
06ebfc821e
fix(agent-core-v2): fold UserPromptSubmit hook output into the prompt message (#4081)
* fix(agent-core-v2): fold UserPromptSubmit hook output into prompt content parts

UserPromptSubmit hook messages now merge into the user prompt message as
meta-marked text content parts (contentType text/xml, source 'user prompt
submit hook') at content position 0 instead of a standalone hook_result
user message, so one prompt always yields exactly one user message and
turn pairing can no longer shift. Structured hook JSON without a message
field (e.g. {"continue":true}) no longer injects anything; plain-text
stdout still falls through. turn.prompt records, TurnStarted prompts,
fold turn openings, and steer content keys all strip hook parts; existing
wires with standalone hook_result messages keep their current behavior.

* feat(agent-core-v2): keep UserPromptSubmit hook parts in turn records and handle them across client surfaces

* feat(agent-core-v2): meta-mark bundled skill parts and replace positional slicing

Bundled skill blocks are now constructed with meta { source: 'skill
activation' }, matching the hook-part convention. Every former
content.slice(skillActivations.length) site — turn prompt text, steer
merge/echo, session and fork titles, transcript fold, TUI replay — now
annotates then filters by meta, so prompt content no longer depends on
block positions and the loop needs no hook-part knowledge. A shared
annotate step keeps legacy wires working: leading unmarked blocks (one
per bundled activation) are marked on read before filtering.

* feat(agent-core-v2): strip hook parts from the public TurnStarted prompt at construction
2026-09-29 17:24:09 +08:00
7Sageer
395d537237
feat(kimi-code): summarize workspace trust with configuration sources (#4056)
* feat(kimi-code): show what trusting activates in the workspace trust prompt

* fix(kimi-code): keep trust prompt non-blocking and disclose only external additional dirs

* fix(kimi-code): mark trust disclosure incomplete when discovery times out or fails

* fix(kimi-code): exclude disabled MCP servers from trust disclosure and cap key lists

* fix(kimi-code): disclose disabled user MCP servers shadowed by project config

* test(kimi-code): merge redundant trust prompt disclosure cases

* test(node-sdk): merge mirrored user/project MCP override cases

* Update trust-panel-disclosure.md

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

* fix(kimi-code): disclose symlinked additional dirs by real target in the trust prompt

* fix(kimi-code): bound trust disclosure I/O and harden path containment

* fix(kimi-code): tighten trust prompt disclosure copy

* refactor(kimi-code): compute the trust disclosure inside the engine

The disclosure composition (project-origin MCP servers, additional dirs
with realpath containment, instruction sources) moves from the SDK into
agent-core-v2's workspace scope as WorkspaceTrustDisclosureService,
constructed alongside the other generation services. The SDK's
getWorkspaceTrustInfo becomes a thin forward, so the config-merge
semantics live next to the workspaceTrust gate that owns them instead
of being re-derived downstream.

Also drops the shadowed-user-server section and the per-section
deadlines with their disclosureComplete flag: the engine reads the
same loaded state session creation awaits, so the prompt needs no
timeout plumbing of its own, and the empty state stays a single honest
copy.

* refactor(kimi-code): compress trust disclosure tests and disclose only effective profiles

Merge mirrored test cases across the three suites and share fixtures;
small source trims (shared wrap helper, context.workspaceId).

The disclosed agent profiles now pass the same resolution the session
catalog applies: a workspace profile clashing with a builtin without
override: true, or losing to a higher-priority candidate, is no longer
reported as activated.

* test(kimi-code): drop the engine disclosure suite in favor of e2e coverage

The SDK e2e suite exercises the disclosure through the real engine, so
the stub-based engine unit file duplicated it; a builtin-clash agent
case moves there to keep the suppressed-profile behavior pinned.
Also folds the sanitize vectors into the MCP render case and trims the
trust type docs.

* fix(kimi-code): cap untrusted MCP target fields and correct profile wording

A crafted .mcp.json can supply arbitrarily long command/args/url
strings; each field now truncates at 80 chars before wrapping. The
profiles line no longer claims they feed the agent — a non-default
workspace profile is only made available as a subagent, the default
agent still binds the default profile.

* fix(kimi-code): honor profile overrides and reveal instruction symlinks in trust disclosure

A workspace profile with override: true replaces a same-name builtin
or higher-priority candidate in the session catalog, so the disclosure
now applies the same replace semantics instead of dropping it.

Instruction paths get the same realpath treatment as additional dirs:
a project AGENTS.md symlinked to a file outside the project renders
its real target instead of hiding behind the lexical path.

* fix(kimi-code): disclose skill roots escaping the project in the trust prompt

Read/Write/Edit/Grep/Glob all add getSkillRoots() to their allowed
roots, so a .kimi-code/skills symlink to an external directory is an
outside-project file access grant that trusting activates. The
disclosure now merges those roots (resolved via the same projectRoots()
the skill source uses) into the outside-directories list. Also caps
each displayed MCP key name, not just the key count.

* fix(kimi-code): cap the bearer-token env var label in the trust prompt

* refactor(kimi-code): disclose only real locations in the trust prompt

The path → realPath arrow is dropped; gated directories and AGENTS.md
entries are disclosed as their resolved real locations, and the pair
type collapses back to plain strings. Entries resolving to the same
real directory collapse into one.

* fix(kimi-code): tighten the trust prompt list caps to fit one screen

* fix(kimi-code): lower the trust prompt list caps further

* fix(agent-core-v2): keep explicit agent-file precedence in the trust disclosure

* Revert "fix(agent-core-v2): keep explicit agent-file precedence in the trust disclosure"

This reverts commit 6e5c45d1b69061a041cc991a0882b1c651fc6003.

* fix(agent-core-v2): preserve profile priority in trust disclosure

* fix(kimi-code): keep workspace trust choices visible

* fix(kimi-code): align trust prompt paging keys

* docs: remove trust prompt keyboard additions

* feat(kimi-code): summarize workspace trust with configuration sources

* chore(agent-core-v2): sync workspace instruction state manifest

* fix(kimi-code): recognize dot-prefixed project directories in trust summary

* refactor(kimi-code): reuse existing trust configuration sources

* fix(kimi-code): keep trust disclosure independent of skill watchers

* refactor(kimi-code): condense additional directory disclosure

---------

Signed-off-by: 7Sageer <sag77r@hotmail.com>
2026-09-29 16:24:12 +08:00
7Sageer
e3bf50c083
fix(agent-core-v2): remove interruption reminder on undo of its turn (#4076)
Some checks are pending
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
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
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-29 15:08:13 +08:00
HydrogenE7
a940f2ff04
fix(agent-core-v2): publish permission mode changes on agent.status.updated (#4057)
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 / 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-28 19:36:51 +08:00
7Sageer
1f6f0b1fa2
feat: trust workspace via KIMI_CODE_TRUST_WORKSPACE env var (#4059)
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: trust workspace via KIMI_CODE_TRUST_WORKSPACE env var

* fix: honor trust env override in MCP registry and untrust route

* test: add getEnv to mcpManagement bootstrap mock

* test: fold trust-env route case into existing workspaces suite

* fix(cli): mention KIMI_CODE_TRUST_WORKSPACE in the print-mode MCP trust warning

* docs: describe KIMI_CODE_TRUST_WORKSPACE by its semantics, not its MCP effect
2026-09-28 17:03:52 +08:00
Kai
4fbe065442
fix(agent-core-v2): stop NotifyUser nudges in hosts without the update panel (#4054)
The nudge reminders were gated on the notify_user flag and on the tool
being registered, but not on the host. A session created in the TUI keeps
the tool after it is reopened elsewhere, so a host that cannot display
updates kept telling the agent to send them while every call reported
that nothing was displayed.

Gate the reminders on the same availability check the tool uses when it
runs: the flag is on and the host declared the update_panel capability.
2026-09-28 13:20:00 +08:00
tpoisonooo
09af3b483f
feat(tower): interrupt tower wake turns on user input and harden tower operations (#3998)
- tower mode: a message sent while the agent is running aborts the in-progress inbox-wake turn and runs as its own turn; notification-seeded turn waiters now settle launched/completion
- TowerTeardown: keeps worktrees of live agents (not overridable with force), supports exclude and dry_run
- tower roster: died/revived store writes are guarded to the active tower session and attributed with session+pid; agents stopped by the user are marked dead by intent with no revival nag, and unintended deaths get diagnose-first guidance
- workers must TowerInbox before marking a mission completed: the store refuses completion with unread inbox messages, and the briefing carries the inbox-before-completion, mission re-read, and long-operation chunking instructions
- tower store: state.json read-modify-write is serialized with a cross-process lockfile (token-checked release) and written atomically via per-writer tmp + rename

Co-authored-by: konghuanjun <konghuanjun@moonshot.ai>
2026-09-28 12:35:58 +08:00
Kai
e15c4fcbdf
chore: add regression and user-impact review to the PR workflow (#4023)
* chore: add regression and user-impact review to the PR workflow

The review-pr skill now runs a separate regression pass with impact levels
and a repository-specific list of user populations and contract files, the
PR template asks authors for a behavior-change table, Code Review Rules in
AGENTS.md encode the same checks for automated review, and changesets must
name the behavior users lose when a default flips.

* chore(agents): stop instructing agents to invoke the review-pr skill

The skill is user-triggered only (disable-model-invocation), so AGENTS.md
no longer tells agents to run it; the Code Review Rules keep pointing at
surfaces.md for the population and contract list.

* chore(review): define impact levels by consequence and close inventory gaps

Impact levels are now decided in three steps from the change itself
(consequence, escape hatch, silent-input upgrade) with changeset and docs
kept in the remediation check; escape-hatch wording allows explicit
maintainer sign-off; prompt-text rule names the receiving population;
one-sided diff evidence is accepted; release and packaging CI, the klient
facade, the transcript contract, kosong providers, and all env-var access
forms are added to the surfaces inventory.
2026-09-28 11:27:24 +08:00
liruifengv
be7d5f5fea
docs(changelog): sync 2.1.1 from apps/kimi-code/CHANGELOG.md (#4018)
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
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
Nix Build / nix build .#kimi-code (push) Has been cancelled
Release / Deploy docs (push) Has been cancelled
Release / Native release artifact (push) Has been cancelled
Release / Publish native release assets (push) Has been cancelled
2026-09-24 15:47:04 +08:00
github-actions[bot]
f67e6398fb
ci: release packages (#4016)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-09-24 15:21:10 +08:00
Haozhe
c7dd84124a
feat: turn filesystem watch back on by default (#4015) 2026-09-24 14:50:10 +08:00
7Sageer
929403b6db
revert: roll back workspace trust-boundary hardening (#4013)
* revert: roll back workspace trust-boundary hardening

Roll back the hardening added in #3964 that guarded against malicious
content inside an already-trusted repository:

- background git invocations no longer override repo-local git config
  (fsmonitor, hooksPath, filters, drivers, gpg, editor)
- agent file tools no longer re-resolve paths through symlinks
- project-local local.toml applies without workspace-trust gating,
  additional_dir entries are no longer rejected for resolving to the
  home directory or filesystem root, and writing it is auto-approved
  again inside a git worktree

Kept, since they only affect the pre-trust window or the trust prompt
itself: the fail-closed trust prompt and lazy footer git detection.

* Update revert-trust-boundary-hardening.md

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

---------

Signed-off-by: 7Sageer <sag77r@hotmail.com>
2026-09-24 14:49:36 +08:00
liruifengv
a1e4c13d41
docs(changelog): sync 2.1.0 from apps/kimi-code/CHANGELOG.md (#4006)
Some checks are pending
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 / build (push) Waiting to run
CI / test (1) (push) Waiting to run
CI / test (2) (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
* docs(changelog): sync 2.1.0 from apps/kimi-code/CHANGELOG.md

* docs(changelog): shorten the fullscreen TUI entry to how to enable it

* docs(changelog): reword the fullscreen TUI entry
2026-09-23 21:08:50 +08:00
github-actions[bot]
52437299ff
ci: release packages (#3935)
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 / 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
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-09-23 20:29:26 +08:00
liruifengv
ba41d07810
chore: sync web dist from code-app (#4005)
* chore: sync web dist from code-app

code-app: 955d6b744b76630828c3d80406e16d73a7a7454f

* chore: collapse web dist sync changesets into one summary entry
2026-09-23 20:26:29 +08:00
grapedge
e17ff67928
feat(kimi-code): add TUI mode setting for fullscreen layout (#4004) 2026-09-23 20:14:52 +08:00
Haozhe
b3212fd9ab
fix(remote-control): pick credential slot and relay from login region (#3969)
* fix(remote-control): pick credential slot and relay from login region

Global login stores tokens in kimi-code-env-*.json and should use
code-rc.kimi.ai; Remote Control always read kimi-code.json and
code-rc.kimi.com. Resolve both from the persisted oauth ref.

* fix(telemetry): skip the dead global collector and keep shutdown alive

The global collector host has no DNS. Drop it from the region profile and
skip the send instead of falling back to the mainland endpoint. Keep the
shutdown timeout timer referenced so a failed flush cannot exit before the
TUI hands the process to the foreground server.

* fix(remote-control): require explicit relay origin and drop hardcoded .com defaults
2026-09-23 18:10:47 +08:00
7Sageer
a54e6f6a9b
feat(agent-core-v2): add KIMI_CODE_REPEAT_BREAKER env switch (#3995)
* feat(agent-core-v2): add repeat_breaker config switch

Add a top-level repeat_breaker boolean (default true) to config.toml,
overridable with the KIMI_CODE_REPEAT_BREAKER env var. When disabled,
the agent skips repeat reminders and forced stops on consecutively
repeated identical tool calls; same-step dedupe is unaffected.

* Update repeat-breaker-config-switch.md

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

* feat(agent-core-v2): add tool_dedupe config switch

* refactor(agent-core-v2): drop the tool_dedupe config switch

Same-step dedupe stays always on. repeat_breaker remains the only public switch.

* refactor(agent-core-v2): read the repeat breaker from the environment only

KIMI_CODE_REPEAT_BREAKER is the only switch. Unset keeps reminders and forced stops on.

---------

Signed-off-by: 7Sageer <sag77r@hotmail.com>
2026-09-23 18:00:59 +08:00
grapedge
32000d08af
feat(tui): toggle one transcript fold block with a click (#3990) 2026-09-23 17:27:33 +08:00
liruifengv
75d6767e0e
chore: restructure PR template with new sections, add write-pr and review-pr skills (#3992)
* chore: rewrite PR template in Chinese with structured sections

* chore: switch PR template to English, add write-pr and review-pr skills

* chore: add mermaid to write-pr, disable model invocation for review-pr, require write-pr skill in AGENTS.md
2026-09-23 17:00:05 +08:00
Luyu Cheng
895e9d9b86
fix: restore swarm members from persisted lifecycle events (#3970)
* fix: restore swarm members from persisted lifecycle events

* test(agent-core-v2): register subagent lifecycle records in the wire vocabulary

* chore(agent-core-v2): regenerate the wire manifest for subagent lifecycle records

The manifest inventory drives the vis wire-renderer coverage check, so vis gains a renderer for each new record type and treats them as timeline-neutral in the context projector.

* fix(transcript): associate a folded subagent with the task registered after its spawn

Some emitters register the task after publishing the spawn, so the durable
spawn record carries no task id and the cold fold keyed the member by its
agent id. A later task.started then created a second task that no subagent
terminal event ever reached, leaving a duplicate stuck in the running state.
Folding task.started now records the agent-to-task association the live
projector keeps, and terminal subagent records update both representations
when both are retained.

* fix(transcript): restore subagent token usage when folding a completed member

The durable subagent.completed record carries the member's token usage and the
live projector copies it onto the task, but the cold fold dropped it, so a
reopened conversation showed a completed member without usage metadata. The
fold now validates the payload's four counters and restores them.

* fix(kap-server): base the lost-member decision on the turn that spawned it

The cold snapshot only terminalised an unfinished foreground member when the
parent agent was idle, so a member left behind by a restart stayed marked as
running forever once the user started a new parent turn before backfill.
The restored agent refs already name the tool call that spawned each member,
so the decision now uses the turn owning that call: a member is lost when its
own loop is not running and its spawning turn is not the turn the parent is
running now.

* fix(transcript): adopt the spawn placeholder into the task registered afterwards

A spawn published before its task is registered — the Tower worker path —
carries no task id, so the fold created a placeholder keyed by the agent id
and the later task.started added a second task under the registered id. Only
the registered task was ever terminalised, and the detached placeholder was
skipped by the lost-member pass, so a restored transcript kept a duplicate
worker shown as running forever. task.started now folds the placeholder into
the registered task instead of leaving it behind.

* fix(kap-server): drain the live wire before reading a cold snapshot

The append log buffers records and writes them in batches, which is why its
own reader flushes the log first. The cold transcript reads the wire file
directly and skipped that drain, so a snapshot could stop on a stale prefix.
When the transcript binding is created after a turn has already ended, the
whole store is built from that snapshot and nothing repairs it afterwards,
leaving the turn's last tool call without its result and its member marked
lost. Reading now drains the live agent's wire first, as session export
already does before it reads the same files.
2026-09-23 14:25:40 +08:00
grapedge
a268ad775d
feat: add jump-to-bottom indicator and steady status row to the TUI (#3989) 2026-09-23 14:09:21 +08:00
tpoisonooo
f7012aa23b
feat(tower): enforce protocol invariants and deny AgentSwarm (#3976)
* feat(tower): enforce protocol invariants and deny AgentSwarm in tower mode

- split missions by functional boundary and workload; simplify spawn briefings
- flip completed missions back to active on non-clean reviews and brief respawns with review history
- refuse completed with open tasks or zero-diff build branches; cap review rounds at 5 with a task_drop escape hatch
- name the next step in review/merge/status tool results; flag unspawned missions in TowerStatus
- veto AgentSwarm execution while tower mode is active
- deflake kap-server catalog test: waitForServerState timeout 3s to 10s

* fix(spawnTool): remove striction

---------

Co-authored-by: konghuanjun <konghuanjun@moonshot.ai>
2026-09-23 13:00:32 +08:00
liruifengv
bdf8f7975d
feat(cli): support audience targeting for startup banners (#3868)
* feat(cli): support audience targeting for startup banners

* feat(cli): rename the banner audience field to kfc_audience

* chore: revert unintended oxlint autofixes introduced by the merge commit

The lint-staged oxlint --fix pass applied warning-level unicorn autofixes to
main's files during the merge (prefer-at, prefer-string-replace-all,
toSorted, catch-error-name). The catch-error-name rename also renamed object
shorthand properties (reason -> error), which no longer matches the declared
types and fails tsc. Restore main's versions of these four files; committing
with --no-verify so the same autofix does not re-apply.

* refactor(cli): type the banner wire shape concretely

* refactor(cli): narrow the banner audience fields to literal unions

* fix(cli): classify 403 as anonymous and map REGION_OVERSEA in banner audience

* refactor(cli): require banner_id for banner entries

* fix(cli): drop the banner subtext indent when it cannot fit

* fix(cli): avoid cache filename collisions across config endpoints

* fix(cli): keep banner loading from rejecting when the token lookup fails
2026-09-23 12:26:43 +08:00
7Sageer
6451f1e056
fix: harden workspace trust boundaries across git, file tools, and the local web server (#3964)
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(kap-server): reject malformed and null Origins

isOriginAllowed conflated an unparseable Origin header with an absent
one and allowed both, so a sandboxed document (Origin: null) passed the
WebSocket upgrade check and had its Origin echoed by the CORS hook.
An absent Origin is still allowed for non-browser clients, but a
present Origin that fails to parse, is null, or uses a non-http(s)
scheme is now rejected: the WS upgrade responds 403 and the CORS hook
withholds Access-Control-Allow-Origin.

* fix(kimi-code): sync web bundle for kimi_origin query gating

* fix(agent-core-v2): gate workspace local.toml behind trust and tighten additional_dir

* fix(agent-core-v2): block symlink escapes in agent file tools

* fix: harden background git invocations against repo-local config

* fix(agent-core-v2): close trust-gate gaps in add-dir and additional_dir validation

* fix: neutralize repo-configured clean and process filters in hardened git calls

* fix(agent-core-v2): fail closed when a path is too deep to verify

* fix: probe worktree-scoped filter config in hardened git calls

* fix: fail closed when git filter discovery fails and cache probes for repo subdirectories

* fix(agent-core-v2): block symlink aliases of the project-local config in write tools

* fix: neutralize smudge, merge drivers, and repo-controlled commit signing in hardened git calls

* fix: expand included git configs when discovering repo-defined drivers

* Revert "fix(kimi-code): sync web bundle for kimi_origin query gating"

This reverts commit cd6af49cf1dfebe505f0e890453c3207a74d3e80.

* fix: keep git hardening fail-closed on includes and probe failures in scanners

* fix: fail closed on uncodable driver names and disable repo-controlled signature verification

* fix: neutralize repo-controlled editors and match include sections case-insensitively

* fix: probe config names only and reject dangling symlinks in file tools

* fix: fail closed when core.worktree escapes the repository

* fix(agent-core-v2): match project config paths across separators and case

* fix: arm footer git only after workspace trust persists

* fix(agent-core-v2): check resolved sensitive targets for absolute outside paths

* fix: only skip git config caching for actual include sections

* refactor: share git config hardening primitives between agent-core-v2 and the CLI

* fix(agent-core-v2): clear trusted additional dirs synchronously on trust revocation

* fix(agent-core-v2): compare resolved write targets with Windows path semantics

* fix: fail closed when the git directory disappears during hardening probes

* refactor: move shared git hardening primitives into @moonshot-ai/git-hardening

* fix: close symlinked-gitdir and submodule-recurse gaps in git hardening

* fix(agent-core-v2): reject home-directory ancestors as additional_dir roots

* fix: compare core.worktree with Windows path semantics

* fix: skip git config probes on renders after a negative repo detection

* fix: resolve gitfile pointers against the .git file directory and match includeIf sections

* test: drop duplicated symlink and plain-file cases covered elsewhere

* fix: only treat project-config writes as aliased when the lexical path misses the config pattern

* test: move the realpath guard matrix into a module test

* test: cover git-hardening primitives in the shared package

* refactor: inline git hardening helpers and drop the shared package

Keep the constants and parsers next to the async engine spawn path and
the sync CLI spawn path instead of a third workspace package.

* refactor: drop footer git trust gate and config probing

Workspace trust is a process-level decision, so the TUI never mounts
the footer until the user has trusted. Footer git status now uses
static hardening flags only.

* refactor: route git execution through IGitService.runGit

- Add runGit(cwd, args, options) to IGitService as the public door for
  running git with repo-local config hardening applied.
- GitService implements runGit using the existing hardenedGitConfigArgs
  helper; status/diff now delegate to it.
- collectGitContext drops its own spawn/probe logic and calls
  IGitService.runGit instead, receiving the service through the
  promptPrefix context.
- Tower keeps its own git() function (accepted gap).

* refactor: move git hardening helpers to app/git/hardening

* Revert "fix(kap-server): reject malformed and null Origins"

This reverts commit b799a21d0390ff0e4e66437f0d7b90c0b8171efe.
2026-09-22 21:30:34 +08:00
Haozhe
e796bb5d48
fix: request offline_access in MCP OAuth when the authorization server advertises it (#3979) 2026-09-22 19:05:24 +08:00
Kai
bb96d80748
perf: cut CLI startup time and memory in the native binary and config reads (#3975)
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
* perf: cut CLI startup time and memory in the native binary and config reads

Ship the single-file binary with a V8 code cache and a 16 MB semi-space
(execArgv), lower dynamic import() to require() in the CommonJS bundle and
fail the native build if any survives, and stop the engine from redoing
work on every config read: env-bound sections are re-validated only when
their env values change, the tool policy service caches the global tools
section and refreshes it on section-change events, Ajv instances are built
lazily, the macOS product version is read from SystemVersion.plist instead
of spawning sw_vers, and the host time zone and date formatter are cached.

Measured on the 100-round mock benchmark: CU 4.1-4.4 -> 3.0-3.2,
CPU 2.6-2.8 -> 2.0-2.2 core-seconds, peak RSS 550-610 MB -> 370-465 MB,
`kimi --version` 0.48 s / 401 MB -> 0.33 s / 311 MB.

* fix(native): keep dynamic import() in the code-cached binary and cover plugin entries in smoke

Lowering import() to require() broke `__plugin_run_node` (the bundler dropped
the node:url binding, and require() cannot load file:// URLs or top-level-await
modules), so every plugin MCP server that runs on Node failed under the native
binary. The CommonJS SEA main script keeps a working import() with the V8 code
cache on Node 24, so the lowering and the lexer guard go away and the native
smoke now runs a plugin entry. Also assert that tool policy checks do not read
the tools section, and drop the host time zone cache.

* fix(agent-core-v2): key the env-bound config memo by section identity

A domain re-registered by a different section definition could hit the memo
entry left by the previous definition when the validated base and env values
were unchanged, returning a value parsed by the old schema.
2026-09-22 16:57:39 +08:00
liruifengv
994287acb3
fix(session): inherit titleKind for default fork titles (#3974)
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 / 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-22 13:34:50 +08:00
qer
7ad0c46682
feat(plugins): update kimi-webbridge plugin to the 2.0.11 skill (#3961)
* feat(plugins): update kimi-webbridge plugin to the 2.0.11 skill

Bring the official plugin in line with the Kimi Browser Extension 2.x
daemon: document the ok/data response envelope, self-serve daemon
recovery via start, the movable listen address (10086 is only the
default), file-body retries on macOS/Linux, and the rewritten
operations reference (CLI subcommands, disk layout, new status
fields). Sync the manifest and marketplace versions to 2.0.11 and
point the help links at the new product pages.

* fix(plugins): point the Browser Extension help links at the canonical product path

The site canonicalizes /products/kimi-webbridge to
/products/kimi-browser-extension; ship the final URL in the skill,
manifest, and docs instead of relying on the redirect.
2026-09-22 12:57:23 +08:00
Haozhe
0dc4d4fba8
feat(agent-core-v2): prepend wall-time header to persisted tool results (#3966) 2026-09-22 12:40:34 +08:00
7Sageer
0523bafb39
feat(agent-core-v2): report enabled plugins and plugin toggles in telemetry (#3963)
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 / 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): report active plugins and plugin toggles in telemetry

* fix(agent-core-v2): refresh active plugin context before recording plugin_toggle

* refactor(agent-core-v2): publish plugin telemetry from committed state

* refactor(agent-core-v2): split plugin value import from type imports

* refactor(agent-core-v2): report enabled plugins on turn and toggle events
2026-09-21 21:35:05 +08:00
liruifengv
6a52dd781b
feat(config): add auto_session_title config option (#3962)
* feat(config): add auto_session_title config option

* chore: drop changeset, changelog entry ships with kimi-code-app instead
2026-09-21 19:55:40 +08:00
liruifengv
b428bfd004
feat(transcript): include step timing and usage in cold-folded steps (#3938)
* feat(transcript): include step timing and usage in cold-folded steps

* refactor(transcript): carry only TTFT and stream duration in cold-folded steps

* refactor(transcript): rename step timing field to llmTiming
2026-09-21 19:14:53 +08:00
HydrogenE7
6a214b85e5
fix(kap-server): avoid stack overflow when caching large wire files (#3957) 2026-09-21 16:31:04 +08:00
tpoisonooo
65ae3e368c
feat(project): reject non-ASCII mission titles and record token usage (#3847)
Some checks are pending
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 / 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 / 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-20 19:04:26 +08:00
liruifengv
99eaa993ba
docs(changelog): sync 2.0.2 from apps/kimi-code/CHANGELOG.md (#3936)
Some checks failed
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
CI / typecheck (push) Has been cancelled
CI / test (2) (push) Has been cancelled
CI / build (push) Has been cancelled
CI / test (1) (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
Nix Build / nix build .#kimi-code (push) Has been cancelled
Release / Deploy docs (push) Has been cancelled
Release / Native release artifact (push) Has been cancelled
Release / Publish native release assets (push) Has been cancelled
* docs(skill): list all entries for versions with 10 or fewer upstream entries in sync-changelog

* docs(changelog): sync 2.0.2 from apps/kimi-code/CHANGELOG.md
2026-09-19 20:54:09 +08:00
Haozhe
f17a22ebf4
feat: turn off filesystem watch by default (#3931)
* feat: turn off filesystem watch by default

* test: enable filesystem watch explicitly in watch-dependent suites
2026-09-19 20:17:47 +08:00
github-actions[bot]
9d07f634be
ci: release packages (#3913)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-09-19 20:06:44 +08:00
liruifengv
2e605b10be
chore: sync web dist from code-app (#3934)
* chore: sync web dist from code-app

code-app: 44d7281c7a63ee3c7a907f9406e490efdbec7411

* chore: collapse web dist sync changesets into one summary entry
2026-09-19 20:03:44 +08:00
liruifengv
97212596f7
fix(agent-core-v2): don't record turn.steer when an unconsumed steer seeds the next turn (#3933) 2026-09-19 19:21:03 +08:00
Haozhe
7568f3118c
chore: remove the tdd skill (#3932) 2026-09-19 19:03:48 +08:00
7Hanrui
6ffdf0d579
fix(agent-core-v2): remove the project-root assertion for cwd from the system prompt (#3929)
Co-authored-by: 7Sageer <7sageer@djwcb.cn>
2026-09-19 18:27:53 +08:00
Haozhe
9df7a9ccfb
fix: keep turn ids above the wire-wide max and fold cold transcripts over the active branch (#3922)
* fix(agent-core-v2): floor the human turn clock at the wire-wide max on engine journal reset

* fix(kap-server): fold the cold transcript snapshot over the restorable branch chain

* fix(agent-core-v2): advance the human turn clock when a turn starts

* fix(kap-server): split reused wire turn ids in the live transcript projector

* fix(kap-server): adopt the completed cold tip for mid-turn attach events

Continuation deltas after a lazy transcript attach belong on the last
cold turn, not a newly split export id.
2026-09-19 17:47:22 +08:00
liruifengv
7d3f88faa4
feat(oauth): parse goods_version from the managed /me profile payload (#3921)
Some checks are pending
CI / test-windows (push) Waiting to run
CI / lint (push) Waiting to run
CI / typecheck (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
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 / 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
CI / build (push) Waiting to run
CI / test (1) (push) Waiting to run
CI / test (2) (push) Waiting to run
Release / Release (push) Waiting to run
2026-09-19 13:18:31 +08:00
Haozhe
2502d2157f
revert(kap-server): drop the flat entity message protocol (v3 WS + history API) (#3532) (#3920)
This reverts 64505e36e3.

The v1 WS + legacy REST + transcript surfaces are alive on main and remain
the single protocol surface; kimi-inspect returns to the transcript-based
data model (keeping #3747's removal of the prompt input, which adapted to
the agent-core-v2 prompt-queue fold).
2026-09-19 12:40:31 +08:00
liruifengv
2cedfaf125
fix(kap-server): deliver session-level interaction events past agent filters (#3901) 2026-09-19 12:05:34 +08:00
Grapedge
02d829e131
fix(vscode): ignore Enter during IME composition in question dialog (#3915)
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 / Release (push) Waiting to run
Release / Native release artifact (push) Blocked by required conditions
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
2026-09-19 02:51:24 +08:00
Grapedge
88a7d932f1
fix(agent-core-v2): pre-shrink compaction history to the effective model window (#3911) 2026-09-18 21:45:56 +08:00
liruifengv
1815096590
docs(changelog): sync 2.0.1 from apps/kimi-code/CHANGELOG.md (#3912) 2026-09-18 21:41:35 +08:00
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
Haozhe
7dc253c5ce
fix(agent-core-v2): restore thinking for the openrouter reasoning dialect (#3910)
Keep string reasoning fields when a reasoning_details array is present, stamp each think part by source, and replay those fields on the next request.
2026-09-18 21:06:08 +08:00
liruifengv
92c3c59b22
feat: expose resolved base_url on models.dev catalog provider items (#3909)
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 / Publish native release assets (push) Blocked by required conditions
Publish VS Code extension / Publish VSIX to marketplaces (push) Waiting to run
Release / Deploy docs (push) Blocked by required conditions
Release / Native release artifact (push) Blocked by required conditions
2026-09-18 20:43:06 +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
Haozhe
60f2a63278
fix(agent-core-v2): reuse the queued prompt id for a single steer (#3906)
* fix(agent-core-v2): reuse the queued prompt id for a single steer

A follow-up sent during a turn minted a second context id, so cancel
while the model was still requesting could show the same text twice
and make the host prompt un-undoable. Reuse the queued prompt id when
one prompt is steered, mark that user as in-turn so undo targets the
host turn, and project it as a non-anchor origin for the client.

* fix(agent-core-v2): type in-turn steer origin on the human prompt

The human PromptOrigin type rejected the inTurn field, which failed
typecheck/build and left the generated state manifest stale.
2026-09-18 18:56:08 +08:00
7Sageer
b0d0a80c32
feat: add usage telemetry for swarm, tower, external hooks, and remote control (#3897)
* feat(agent-core-v2): add tower_mode_enter telemetry for tower mode entry

* feat(agent-core-v2): add swarm_mode_entered/exited telemetry

* feat(agent-core-v2): add external_hook_resolved telemetry

* feat(agent-core-v2): add tower_mode_exit telemetry

* feat(kap-server): add remote_control_toggle telemetry

* fix(agent-core-v2): exclude aborted hooks from failure count and track tower entry errors

* fix(agent-core-v2): keep decorated params contiguous in ExternalHooksRunnerService

* fix(kap-server): classify failed remote control disables in telemetry

* fix(kap-server): ignore stale tunnel errors when disabling an already-off remote control

* fix(kap-server): distinguish a failed concurrent startup from a disable failure

* refactor: slim telemetry event payloads and outcome branches

* refactor: inline remote-control tracking and drop redundant event properties

* refactor: tighten hook failure filter and remote-control test fake

* fix(agent-core-v2): count hook spawn and wait failures in failed_count
2026-09-18 18:36:02 +08:00
Haozhe
73ebe9ab2f
fix(transcript): attach promptIds to cold-folded steer frames (#3896)
* fix(transcript): attach promptIds to cold-folded steer frames

* chore(changeset): note cold-folded steer frames after reload
2026-09-18 16:37:33 +08:00
STAR-QUAKE
5acc863ae6
feat(agent-core-v2): make select_tools failures actionable (#3885)
Co-authored-by: starquakee <starquakee@users.noreply.github.com>
2026-09-18 16:27:23 +08:00
7Sageer
910aba273e
fix(agent-core-v2): drop literal decision clauses from system prompt and auto reminder (#3894) 2026-09-18 16:21:11 +08:00
Haozhe
53e5e3fca6
fix(agent-core-v2): pair steered follow-ups by reserved message id (#3891)
Reserve the context message id when a prompt is steered, emit turn.steer only after that message is appended, and join live/cold transcript plus fork by the id instead of content.
2026-09-18 16:05:27 +08:00
Haozhe
a80fe31cff
fix(agent-core-v2): stop workspace watchers from listing a flooded project root (#3892)
* fix(agent-core-v2): avoid root watch inventory and add a kill switch

Watch concrete candidate paths so a flooded project root cannot fill the V8 heap. Allow disabling every watcher with [watch] enabled or KIMI_CODE_WATCH.

* fix(agent-core-v2): stop watching the whole .kimi-code directory

Watch missing config files on the file path itself so session writes do not reload.
2026-09-18 15:24:05 +08:00
HydrogenE7
5108cad9b6
perf: speed up session resume and session index on large workspaces (#3889)
- engine: single-pass wire restore, deferred immer freeze during replay,
  concurrent task-file reads, O(1) token-counting/file-history folds
- sdk: windowed tail-read replay fold overlapped with engine restore
- kap-server: incremental wire cache for transcript reads, bounded-concurrent
  user-messages fan-out, search sync fingerprints and capped passes
- session index: O(1) by-id lookup, dir-mtime freshness signals,
  incremental cold prepare, session_index.jsonl compaction
- cli: deduplicate the user skills watcher
2026-09-18 15:05:23 +08:00
Kai
e3f48a225b
fix(agent-core-v2): keep session deletion from hanging (#3887)
* fix(agent-core-v2): keep session deletion from hanging

Deleting a live session closes it first, and three waits on that path
had no upper bound:

- AgentLifecycleService.remove() checked its 3s quiesce deadline only
  after awaiting loop.settled() and the compaction promise, so a loop
  that never settled after cancel() blocked agent removal, session
  close and delete forever. The settle wait now races the deadline and
  falls through to the existing forced-teardown path when it expires.
- HostProcess.kill() on Windows waited for taskkill to exit with no
  bound. It now stops waiting after 5s.
- setSessionArchived() awaited a pending resume inside its lifecycle
  critical section. A resume queued behind the archive then waited for
  the archive while the archive waited for it, wedging the session's
  lifecycle chain so that every later operation on the session,
  delete included, never started. The resume is now settled before
  the critical section is entered.

* fix(agent-core-v2): terminate a taskkill that outlives its timeout

When the 5s wait on taskkill timed out, kill() returned but the spawned
taskkill child stayed alive and referenced, so every hang leaked a
taskkill.exe process and its handle could keep the CLI or server
process from exiting. Keep the handle and, when the timeout wins, unref
it and terminate it.

* fix(agent-core-v2): never apply a compaction summary that arrives after abort

Cancelling a full compaction, or removing its agent, aborts the
compaction's signal, and the abort listener records the cancellation
and detaches the compaction right away. compactionRound() never checked
the signal again after the summary request returned, so a provider
request that finished despite the abort still went on to
applyCompaction(). That rewrote the context of a cancelled compaction,
and since agent removal now stops waiting for the compaction at its
quiesce deadline, it could also write records after the agent was torn
down and recreate files under a deleted session directory. Check the
signal after the last await and before applying the summary.
2026-09-18 14:44:38 +08:00
7Sageer
f233f9de04
fix(agent-core-v2): stop advertising unregistered tools and clarify Read media errors (#3878) 2026-09-18 13:30:07 +08:00
7Sageer
1fddc16e3e
fix(agent-core-v2): drop the outside-working-directory access ban from the system prompt (#3879)
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 / 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
2026-09-18 00:55:12 +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
Haozhe
86e08208e3
feat(agent-core-v2): approve unanalyzable bash commands in yolo permission mode (#3869)
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
2026-09-17 17:44:27 +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
liruifengv
00bd3c2268
docs(changelog): sync 2.0.0 from apps/kimi-code/CHANGELOG.md (#3861)
* docs(changelog): sync 2.0.0 from apps/kimi-code/CHANGELOG.md

* docs(changelog): trim /desktop entry in English page
2026-09-17 14:08:43 +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
7Sageer
31f1b6824d
fix(agent-core-v2): mark MCP servers needs-auth when a tool call returns 401 (#3846)
* fix(agent-core-v2): mark MCP servers needs-auth when a tool call returns 401

* fix(agent-core-v2): cover retried MCP calls with unauthorized handling and recheck entry after close

* fix(agent-core-v2): bind MCP unauthorized reports to the originating client

* fix(agent-core-v2): invalidate rejected MCP OAuth tokens when entering needs-auth

* fix(agent-core-v2): preserve concurrent MCP OAuth grants and recheck entry after credential awaits

* fix(agent-core-v2): flip MCP servers to needs-auth before invalidating rejected tokens

* fix(agent-core-v2): compare-and-clear rejected MCP OAuth tokens and tolerate cleanup failures

* refactor(agent-core-v2): move rejected-grant handling into the MCP OAuth service

* fix(agent-core-v2): compare MCP OAuth grant age with the scheduler clock

* fix(agent-core-v2): reject future timestamps from the concurrent MCP grant window

* fix(agent-core-v2): distinguish concurrent MCP grants from freshly rejected ones

* fix(agent-core-v2): ignore application-level MCP errors in the unauthorized sniff

* test(agent-core-v2): trim MCP unauthorized tests to the core contract

* Delete .changeset/mcp-oauth-clear-if-current.md

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

---------

Signed-off-by: 7Sageer <sag77r@hotmail.com>
2026-09-17 11:12:20 +08:00
qer
bd06178913
fix(kap-server): avoid duplicating steered prompt content (#3853)
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 / Native release artifact (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
Publish VS Code extension / Publish VSIX to marketplaces (push) Waiting to run
* fix(kap-server): rebuild chat transcript after undo

* test(kap-server): provide undo registry in broadcaster fixtures

* fix(kap-server): preserve non-anchor steers through undo

* fix(kap-server): rebuild undo transcript after persistence completes

* test: complete restored notification origin fixture

* fix(kap-server): keep original prompt when steering

* chore: add changeset for steered prompt content fix

* fix(kap-server): keep restored prompt content after late projector attach

* fix(kap-server): prefer store prompt content after transcript backfill
2026-09-17 01:14:35 +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
Grapedge
0cf413f775
fix(kap-server): open a new turn for abort-reissued steers in cold transcripts (#3844) 2026-09-16 19:34:02 +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
Luyu Cheng
9c5e9b4863
fix(agent-core-v2): watch Windows 8.3 short paths through their long form (#3840)
* fix(agent-core-v2): watch Windows 8.3 short paths through their long form

Watching a directory given in 8.3 short form (for example
C:\Users\RUNNER~1\...) makes libuv's Windows file watcher abort the process
with "Assertion failed: !_wcsnicmp(filename, dir, dirlen)" in fs-event.c,
because change notifications arrive under the long path.

On Windows, resolve a watch root containing a short-name segment to its long
form (the nearest existing ancestor when the root does not exist yet) and map
reported changes and ignore checks back to the requested path, so callers that
compare change paths with their own keep working.

* test(agent-core-v2): keep watch tests portable to Windows runners

* test(agent-core-v2): show received events when the Windows short path watch test fails

* test(agent-core-v2): derive the Windows short path without cmd quoting

* chore: add changeset for the Windows short path watch fix

* fix(agent-core-v2): keep watch children whose names start with two dots inside the root

relative() returns "..cache/x" for a child named "..cache", which the
startsWith('..') check treated as a path outside the watched root. Mapped
change paths then kept the resolved long form, and native signal events for
such children skipped the ignore predicate. Only a bare ".." segment, ".."
followed by a separator, or an absolute result is outside the root.
2026-09-16 18:27:29 +08:00
Luyu Cheng
41eac5d2e7
feat(kap-server): keep client metadata on prompts and skill activations (#3764)
Store the optional metadata object on prompt submission and skill activation as opaque client metadata on the user or skill-activation origin, carry it through prompt events, the transcript projector, snapshots and history rebuilds, and echo it on prompt items without adding it to model content. Use display_text entries for session titles, undo labels and fork titles when every entry provides one. Project user turn payloads, live and rebuilt, through a path-free projection.
2026-09-16 17:56:43 +08:00
qer
cafd9b5a65
fix(kap-server): rebuild chat transcript after undo (#3837)
* fix(kap-server): rebuild chat transcript after undo

* test(kap-server): provide undo registry in broadcaster fixtures

* fix(kap-server): preserve non-anchor steers through undo

* fix(kap-server): rebuild undo transcript after persistence completes

* test: complete restored notification origin fixture
2026-09-16 17:15:35 +08:00
Luyu Cheng
1c7e996aa8
fix(kap-server): record user slash skill activations steered into a running turn (#3832)
Accept skill_activation origins with a user-slash trigger in onTurnSteered so a slash command sent while a turn is running gets a transcript frame, and keep those frames from draining a queued prompt's id. Project origin file attachments onto steered frames on both the immediate and deferred paths, matching onTurnStarted and the history rebuild.
2026-09-16 17:10:44 +08:00
Haozhe
f4e5822164
fix(agent-core-v2): stop aborted-operation errors from escaping to process crashes (#3838) 2026-09-16 16:41:13 +08:00
tpoisonooo
8660a07b3a
fix(tower): subagent cards still showing "completed" during rework (#3833)
Co-authored-by: konghuanjun <konghuanjun@moonshot.ai>
2026-09-16 16:20:24 +08:00
Luyu Cheng
402ee71c1a
feat(kap-server): accept text parts in skill activation attachments (#3831)
Widen activateSkillAttachmentSchema so the attachments array accepts text parts alongside image, video and file, letting a caller interleave text and media in the order the model should read them. Schema only; the route already resolves attachments as WireContent.
2026-09-16 14:02:08 +08:00
qer
2bb6e12c7e
fix: prevent duplicate steer messages in transcript clients (#3828) 2026-09-16 13:31:36 +08:00
Luyu Cheng
540133f0c7
fix(kosong): declare optional media names on image and video parts (#3827)
Media name preservation already ships: the REST schemas expose a name on
image and video content, and kap-server reads imageUrl.name and videoUrl.name
when projecting messages and prompt content. The kosong part types never
declared the field, so it survived only because object literals keep excess
properties through an assignment. Consumers that read these types directly
cannot see the name at all.

Declare it where the other optional part fields live. No runtime change; the
existing media name projection tests continue to cover the behavior.
2026-09-16 13:22:52 +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
7Sageer
cb9ce61eaa
refactor(agent-core-v2): align request and recovery stage names (#3766)
* refactor(agent-core-v2): align request and recovery stage names

* refactor(agent-core-v2): align cache key, google-genai, and recovery context names
2026-09-15 20:14:26 +08:00
7Sageer
f2f9162dc1
refactor(agent-core-v2): clarify human-layer names (#3727)
* refactor(agent-core-v2): clarify human-layer names

* refactor(agent-core-v2): name provider-holding members after their role

- LlmRequestConfig/LlmRecoveryContext/adapter Model: credentials -> credentialProvider
- requester/provider convertError option -> classifyError (matches LlmErrorClassifier)
- kimiOAuthCredentialProvider -> createKimiOAuthCredentialProvider
- ModelCatalog.buildCredentials -> buildCredentialProvider

* refactor(agent-core-v2): rename the format-layer error hook to classifyErrorHook

threads the requester's classifyError option through under a matching name

* refactor(agent-core-v2): finish the human-layer naming pass

- turn.failure.classified -> turn.failure.recovery.evaluated
- recovery proposal beforeRetry -> beforeNextAttempt
- llmRequester currentCredentials/credentialsForTurn -> currentCredentialProvider/credentialProviderForTurn
- unexport ProtocolTraitsByName (only backs ProtocolTraitFor)

* refactor(agent-core-v2): shorten the turn failure event to turn.failure.evaluated
2026-09-15 20:09:27 +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
liruifengv
3eaed4e7d5
docs(changelog): sync 0.43.1 from apps/kimi-code/CHANGELOG.md (#3805) 2026-09-15 17:28:15 +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
wenhua020201-arch
da7f7ed854
docs: add web slash commands table and fold goal mode guide into interaction page (#3772)
* docs(web): add common slash commands table and rename startup options section

* docs(interaction): fold the goal mode guide into the interaction page and remove the orphaned page
2026-09-15 12:40:45 +08:00
7Sageer
513e71edac
feat(agent-core-v2): fail fast on unsupported [secondary_model].default_effort (#3785)
* feat(agent-core-v2): fail fast on unsupported [secondary_model].default_effort

* fix(agent-core-v2): reject default_effort off for always-thinking pool models

* fix(agent-core-v2): surface adaptive_thinking on the assembled catalog model
2026-09-15 12:31:35 +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
HydrogenE7
48fad6e7d9
fix(agent-core-v2): release disposed agent scopes from the DI dependency graph (#3776)
* fix(agent-core-v2): release disposed agent scopes from the DI dependency graph

* fix(agent-core-v2): drop retired service instances from the tracked edge nodes and the dependency graph
2026-09-15 12:11:39 +08:00
HydrogenE7
82ec469e47
fix(agent-core-v2): keep swarm cancellation from crashing the CLI (#3779) 2026-09-15 12:05:04 +08:00
tpoisonooo
0725ef1ce0
fix(agent-core-v2): tower mode mistaking newly agents for previous name (#3752)
* fix(agent-core-v2): resolve tower roster identities to the latest registration

Agent ids restart from agent-0 in each session, so a freshly spawned
worker collided with the previous session's roster entry and every
find-first lookup (caller identity, write guard, death bookkeeping)
resolved to the stale entry: workers read the wrong inbox, sent under
the wrong name, and were denied their own writes, mission updates, and
reviews.

- resolveAgent picks the latest roster entry for an agent id; all
  callers (resolveCallerName, write guard, resume veto, died/revived)
  go through it
- registerAgent retires same-agent-id entries before appending
- enter() (/tower on) now adopts the workspace roster itself instead of
  relying on a manual TowerInit

* fix(agent-core-v2): adopt the tower roster when a replayed tower mode finds a dead foreign owner

A forked or restored session replays the durable TowerModeEnter into an
active tower mode without ever calling enter(), so the roster adoption
added there never ran on the restore path: with the previous owner
session gone, the fork kept the mode (and the stale roster) until a
manual TowerInit. The dead-owner branch of the restore-time
reconciliation now adopts the workspace, mirroring enter()'s takeover
of an idle owner; a live foreign owner still causes an exit.

* fix(agent-core-v2): await the outgoing tower owner's release before adopting its roster

Taking tower mode over from a live but idle owner called the owner's
synchronous exit(), whose ownership release ran fire-and-forget, and
immediately adopted the roster — two concurrent load-modify-save cycles
on .tower/comms/state.json that could lose the new owner or resurrect
the stale roster. exit() now awaits the ownership release and the
takeover awaits the owner's exit(); the remaining callers either await
(RPC/HTTP tower-mode-off) or explicitly ignore the promise (mode mutex,
restore-time self-exit).

* fix(agent-core-v2): fail tower activation when the roster adoption cannot complete

Adoption failures (unreadable or unpersistable state.json) were
swallowed into a log warning, so enter() and the stale-owner restore
both activated tower mode with the foreign owner and stale roster still
in place — the exact identity mismatch the adoption is meant to
prevent, now with a false success report. adoptTowerRoster() now throws
a TowerProtocolError with the underlying cause: enter() propagates it
before any tool is activated, and the restore path drops the replayed
tower mode instead (it must not throw inside the restore hook chain).

* fix(agent-core-v2): propagate unreadable tower state during roster adoption

adopt() treated any state.json read failure as an uninitialized
workspace via isInitialized()'s catch-all, so an existing but
unreadable state file (EACCES, EISDIR, transient I/O) reported a
successful no-op adoption and enter() activated tower mode against the
foreign state — bypassing the activation guard added in the previous
commit. Only ENOENT now means uninitialized; every other read error
propagates into the fail-activation / deactivate-on-restore paths.

---------

Co-authored-by: konghuanjun <konghuanjun@moonshot.ai>
2026-09-15 12:03:10 +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
Kimi Agent
4f45efdbfe
docs(skills): clarify flat-form skill naming and its limits (#3774)
Some checks are pending
CI / typecheck (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 / test-windows (push) Waiting to run
CI / lint (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
* docs(skills): clarify flat-form skill naming and its limits

The flat-form description "Skill name is taken from the filename (minus
.md)" read as if the on-disk file should drop the extension, which
repeatedly confused readers. Rewrite the Creating-a-Skill section with
a concrete directory layout, explicit name-derivation rules for both
forms, the directory-over-flat precedence, and the flat form's top-level
scanning and KIMI_SKILL_DIR limitations.

* docs(skills): attribute directory-form names to the required frontmatter

parseSkillText requires name in directory-form SKILL.md and always
registers under it, so the subdirectory name is only a convention, not
the source of the Skill name. Reword the derivation bullets accordingly
(flat form keeps its filename fallback).

---------

Co-authored-by: kimi-agent-bot <kimi-agent-bot@users.noreply.github.com>
2026-09-14 23:16:18 +08:00
qer
1336be3877
fix(kap-server): verify indexed search results against session sources (#3631)
* fix(kap-server): verify indexed search results against session sources

* fix(kap-server): reject unverifiable search source identities

* fix(kap-server): bound search source checks by the query deadline

* fix(search): report sessions skipped during indexing

* fix(search): bound outstanding source identity checks

* refactor(search): group source check coordination state

* test(search): isolate source check limit from background sync
2026-09-14 21:36:33 +08:00
liruifengv
f37cb3d18c
docs(changelog): sync 0.43.0 from apps/kimi-code/CHANGELOG.md (#3767) 2026-09-14 20:24:21 +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
2d4d799ac3
fix(kap-server): omit hidden thinking summaries from v1 session history fold (#3765) 2026-09-14 19:56:55 +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
Haozhe
9296e68770
feat: declare dynamically_loaded_tools for official models and add per-server MCP deferred disclosure (#3667)
* feat(oauth): add the dynamically_loaded_tools capability from the official models endpoint

* feat(agent-core-v2): support per-server deferred disclosure of MCP tools

* feat(klient): mirror per-server deferred in the MCP config contract

* fix(agent-core-v2): honor per-server deferred for the needs-auth MCP tool

* fix(agent-core-v2): register select_tools regardless of the profile tool allowlist

* feat(agent-core-v2): default MCP servers to inline tool disclosure unless deferred is enabled
2026-09-14 19:42:56 +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
7Sageer
775a6c35de
feat(agent-core-v2): make the compaction attempt limit configurable (#3750)
* feat(agent-core-v2): make the compaction attempt limit configurable

Add loop_control.compaction_max_attempts (default 5) to control the
maximum total attempts for a failing compaction request, replacing the
hardcoded MAX_COMPACTION_RETRY_ATTEMPTS constant. The value flows
through ProfileModelContext into the compaction retry loop, covering
both retryable generation errors and empty/truncated response shrinks.

* fix(agent-core-v2): bound compaction shrink attempts and compute retry delays lazily

Address codex review on #3750: the empty/truncated shrink path allowed
maxAttempts + 1 requests (throwing only when the shrink counter exceeded
the limit), and the backoff delay array was allocated eagerly with
maxAttempts - 1 entries before the first request. The shrink path now
stops at the configured limit, and each delay is computed lazily from
the retry index.

* fix(agent-core-v2): count every compaction request against the shared attempt limit

Address the second codex review round on #3750: the retryable-error and
empty/truncated recovery paths kept separate counters, and the retry
budget reset after each shrink, so alternating failure modes could issue
more requests than compaction_max_attempts. A single requestAttempts
counter now gates all recovery paths (the overflow shrink path keeps its
own tighter cap of 3), making the configured value a true maximum on
total requests per compaction round.
2026-09-14 14:44:03 +08:00
liruifengv
6126472c7a
feat(agent-core-v2): graduate AI session titles from experimental (#3749) 2026-09-14 11:53:19 +08:00
Haozhe
7d7e8de80c
refactor(agent-core-v2): rebuild wire persistence and flip agents to session-spawned actors (#3737)
Some checks are pending
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 / 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): persist the human runtime mirror as human.* records in the wire journal

Introduce mode-2 coexistence: the machine eventStore journal becomes a
tree-projection-filtered adapter over the same wire file (single writer via
the WireService append queue), the engine switches from memoryJournal to the
file journal with a seed fallback while no human records exist, and cold
readers skip the new record family constructionally. Adds downgrade
round-trip e2e coverage, whitelists agent.switched/context.undone from
unknown-record telemetry, asserts the undo switch triple after flush, and
resets the machine engine after an undo rerun so machine and wire turn
clocks stay aligned.

Squashed from:
refact(agent-core-v2): project wire journal as an in-memory branch tree behind IAgentJournal
refact(agent-core-v2): undo as branch switch with dual-emitted legacy record and restore replay
refact(agent-core-v2): queue late attachments during restore rerun and flatten fork sources to the active chain
feat(agent-core-v2): persist the human runtime mirror as human.* records in the wire journal

* feat(agent-core-v2): add full compaction to the human agent domain

* refactor(agent-core-v2): keep pending input state events out of the wire journal

* refactor(agent-core-v2): flip agent DI scope ownership to session-spawned agent actors

* refactor(agent-core-v2): build the agent wire and blob views in the session layer

* refactor(agent-core-v2): persist human domain records under the agent.* wire namespace

- replace the human. record prefix with an explicit whitelist (AGENT_WIRE_RECORD_TYPES) guarded against the Event2 vocabulary; legacy human.agent.* journals stay readable through a transition prefix
- unknown-type records skipped during restore now go to the log file instead of the console (malformed records still report to the console)
2026-09-13 23:01:45 +08:00
Kimi Agent
ee2cac102b
fix(agent-core-v2): invalidate streamed attempt state when the llm requester retries below the turn (#3734)
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
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
Nix Build / nix build .#kimi-code (push) Has been cancelled
Release / Deploy docs (push) Has been cancelled
Release / Native release artifact (push) Has been cancelled
Release / Publish native release assets (push) Has been cancelled
2026-09-12 01:27:48 +08:00
Kimi Agent
b1807253c3
feat(agent-core-v2): add KIMI_CODE_PERMISSION_MODE_REMINDER env to disable auto-mode reminders (#3728)
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-11 18:40:26 +08:00
7Sageer
72dbb9bb52
refactor(agent-core-v2): compose the llm recovery chain outside the turn machine (#3724)
* refactor(agent-core-v2): compose the llm recovery chain outside the turn machine

The turn machine hardcoded credentialsRecovery as the head of its
recovery chain and interpreted a refreshCredentials flag on proposals,
coupling the turn to the credentials domain. Strategies now return
self-describing records (strategy/action, optional messages, optional
opaque prepare effect), the turn only runs prepare and/or swaps
messages, and the engine composes the chain via chainRecoveries.

* refactor(agent-core-v2): inline the two-strategy recovery composition

With self-describing proposals the chain is a one-liner at each call
site; the named chainRecoveries combinator had only two call sites and
no third strategy to justify it.
2026-09-11 14:37:04 +08:00
Haozhe
ab9e688cd0
feat(remote-control): cache rewritten tunnel responses with ETag validation (#3718)
* feat(remote-control): cache rewritten tunnel responses with ETag validation

* fix(remote-control): weaken tunnel cache etag and drop 304 content-length

* fix(remote-control): restrict tunnel 304 to successful GET/HEAD and honor wildcard If-None-Match
2026-09-11 12:57:14 +08:00
Haozhe
306f6f6925
fix(remote-control): validate tunnel base64 linearly to avoid V8 regexp stack overflow (#3709)
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
The Remote Control HTTP tunnel validated each base64 message with a
backtracking regular expression. Requests larger than ~3.5MB (base64
~5MB) exhausted the V8 Irregexp backtracking stack and threw
RangeError, which the catch-all mapped to a 400 with an empty body,
surfacing as a generic connection failure on the web client.

Replace the regex with an O(n) character check, reject oversize
requests from the base64 length before decoding, and map non-SyntaxError
failures to 502 instead of 400.
2026-09-11 11:06:59 +08:00
Haozhe
221d112f3a
fix(agent-core-v2): suppress task notifications before loop quiescence on remove (#3720)
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 23:27:15 +08:00
Haozhe
f728cb158c
fix(agent-core-v2): rebuild session and search indexes on storage failures, journal session-index freshness (#3694)
* fix(agent-core-v2): rebuild session and search indexes on unrecoverable storage failures

* fix(agent-core-v2): propagate search sync truncation and track session count in index freshness

* fix(minidb): wipe derived stores under their own locks during rebuild

* fix(agent-core-v2): isolate wiped stores, invalidate stale projections, and account sync failures

* feat(agent-core-v2): replace session index freshness scans with a dirty journal and targeted reconciliation

* fix(agent-core-v2): split transient failures by op kind, surface failed startup reconciliation, and cool down search session skips
2026-09-10 23:23:08 +08:00
Haozhe
c250a31d06
fix(agent-core-v2): keep late task settlement silent after agent teardown (#3717)
* fix(agent-core-v2): keep late task settlement silent after agent teardown

* fix(agent-core-v2): narrow the task lifecycle guard to event dispatch
2026-09-10 22:25:24 +08:00
7Sageer
e348cf59ea
fix(agent-core-v2): stop warning on unhandled store.changed events (#3715)
* fix(agent-core-v2): stop warning on unhandled store.changed events

* Delete .changeset/silence-store-changed-warning.md

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

---------

Signed-off-by: 7Sageer <sag77r@hotmail.com>
2026-09-10 22:05:18 +08:00
Haozhe
565093f727
feat(agent-core-v2): allow rm -rf targeting only /tmp or /temp paths (#3714)
* feat(agent-core-v2): allow rm -rf targeting /tmp and /temp paths

The dangerous command guard flagged every recursive force rm regardless
of target. rm -rf now falls through without an ask when all operands are
literal paths under /tmp or /temp (segment-level prefix, no .. escape);
mixed, non-literal, or out-of-prefix targets stay dangerous.

* chore: add changeset for rm -rf temp path allowance
2026-09-10 21:51:40 +08:00
Haozhe
e409bc8ba5
feat(remote-control): compress textual tunnel responses with gzip (#3707)
* feat(remote-control): compress textual tunnel responses with gzip

* fix(remote-control): honor explicit gzip exclusion over accept-encoding wildcard

* fix(remote-control): skip gzip for 206 responses and vary by accept-encoding

* fix(remote-control): compress tunnel responses off the event loop

* fix(remote-control): vary identity responses and version compressed etags

* fix(remote-control): drop etags from gzipped tunnel responses
2026-09-10 21:39:15 +08:00
Luyu Cheng
5b3b5b6f7c
fix(goal): remove time budget cap and exclude offline time (#3657)
* fix(goal): remove time budget cap and exclude offline time

* test(goal): refresh time budget tool snapshots
2026-09-10 21:27:04 +08:00
7Sageer
18f77efad6
refactor(agent-core-v2): plug llm credentials in through request config (#3682)
* fix(agent-core-v2): honor request-level toolMessageConversion in openai formats

The requester already forwarded LlmRequestConfig.toolMessageConversion
into formatRequest, but the openai chat and openai-responses formats
only read the trait hook, so the explicit request config was silently
ignored. Resolve the mode as request config, then trait default, then
the protocol default, and pass the resolved value into lowering.

* refactor(agent-core-v2): split the protocol trait into per-protocol dialects and provider connection

The ProtocolTrait interface bundled endpoint/headers connection config,
model capability, message/params conversion hooks, and error
classification into one bag, and every format received the whole bag
whether or not it consumed each hook — hooks a protocol ignores were
accepted by the type system and silently dead at runtime.

Split it by consumer:

- ProviderConnection (protocol/connection.ts): endpoint env
  declaration and default headers, still resolved per request inside
  generate.
- Per-protocol typed dialects (OpenAIDialect, OpenAIResponsesDialect,
  AnthropicDialect, GoogleGenAIDialect): only the customization points
  each protocol actually consumes; data-shaped hooks (reasoningKey,
  toolCallIdPolicy, toolMessageConversion, strictThinkingValidation)
  are data fields, and message/history hooks use the protocol wire
  types instead of Record<string, unknown>.
- convertError moves to a requester option, capability to a provider
  variant field.

Dialects are bound when the format is created (createOpenAIFormat and
siblings), so FormatRequestInput and the stream parser carry request
data only; ProtocolTrait is deleted. The thinking hook returns the
kwargs and the preserveThinking flag together as ThinkingApplication,
and the kimi dialect emits the final thinking params directly instead
of routing them through an extra_body flatten in buildParams. The
llm-adapter layer is migrated to the same {connection, dialect,
convertError} assembly.

* refactor(agent-core-v2): compose format stages and dialect hooks in the requester pipeline

* refactor(agent-core-v2): rename protocol dialects to traits

* fix(agent-core-v2): include the system message in openai mergeHistory input

* refactor(agent-core-v2): enforce the format/trait contract boundary

- move CONTEXT_MANAGEMENT_BETA into anthropic/contract and have the kimi
  trait import wire types from each protocol's contract.ts instead of
  format/lower; export the four contract modules from human/index.ts and
  guard the boundary in check-import-boundaries
- rename protocol/trait.ts to protocol/thinking.ts and move TraitContext
  to protocol/base.ts; clean up the remaining dialect-era test variable
- type extractUsage as OpenAIRawUsage / OpenAIResponsesRawUsage instead of
  Record<string, unknown> and drop the requester-side casts

* refactor(agent-core-v2): thread the request config by spread and drop dead format types

- the four requesters spread LlmRequestConfig into the plan input instead
  of hand-enumerating fields, so a new cross-protocol config field cannot
  be silently dropped per protocol
- ProtocolFormat loses the phantom TRequest/TResponse type parameters;
  the dead OpenAIRawResponse/AnthropicRawResponse/GoogleRawChunk contract
  types go with them
- the thinking test now names the extra_body flatten behavior explicitly

* refactor(agent-core-v2): keep protocol format modules internal to the requester pipeline

- drop the four format barrels (and openai/reasoning-key) from
  human/index.ts; each base's public seam is now exactly
  contract / trait / requester
- stop re-exporting contract wire types from format/lower modules so the
  neutral vocabulary has a single home; move the *LoweredMessage staging
  types out of contract into the owning format module
- guard the seam in check-import-boundaries: only llm/requester/bases
  code and tests may import format/lower/patterns/reasoning-key

* refactor(agent-core-v2): plug llm credentials in through request config

Replace the withAuth/withAuthUpload requester decorators with a
credential contribution point on LlmRequestConfig: the llm machine's
request actor (machine path) and ModelRequesterImpl (direct path)
resolve credentials per attempt, and a recoverable 401 is recovered by
invalidating and re-resolving — emitted as llm.recovering on the turn
machine's credentials branch.

* fix(agent-core-v2): surface request-actor failures as llm.failed.remote

A rejection inside the llm machine's detached request actor (credential
resolution, message resolvers, or a throwing requester) could not reach
the machine, leaving the turn stuck in thinking. Convert it to an
llm.failed.remote event so the turn lands in its failed state.

* docs(agent-core-v2): attribute retry/recovery to the turn machine in llm.md

* refactor(agent-core-v2): unify credentials in human/credentials, turn-owned 401 recovery

* fix(agent-core-v2): credential recovery for direct paths, abort guard, turn-snapshotted credentials

* feat(agent-core-v2): IModelCatalog.generate with stream credential recovery

* refactor(agent-core-v2): inline credential recovery at call sites

Remove the attemptWithCredentialRecovery/streamWithCredentialRecovery
helpers from human/credentials; the single-retry recovery is now written
out at each direct call site (catalog ping/generate, full compaction,
media upload) so the control flow reads linearly without a wrapper hop.
The credentials module keeps only the provider factories and the
credential application helpers; recoverability and invalidation stay on
the LlmCredentialProvider itself.

* fix(agent-core-v2): settle the queued turn when a machine turn settles before gating

When the llm machine fails before requester.generate() runs — for
example when OAuth credential resolution rejects — the loop cleared the
pending machine turn marker on turnSettled without ever binding or
settling the queued reservation, leaving the submitter's ready/result
promises and settled() hanging. The loop now settles the unbound
reservation explicitly: cancelled on abort, failed otherwise, mirroring
the evaluateSettle error propagation.

* fix(agent-core-v2): bind and end pre-gate failures through the normal turn lifecycle

The direct settlement resolved turn.result without endTurn(), so no
TurnPrompt/TurnStarted/TurnEnded/AgentErrorEvent was published and the
next queued reservation was never launched. The unbound reservation is
now bound via beginActiveTurn and ended via endTurn (failed, or
cancelled on abort), chained onto afterChain when the previous turn is
still settling, so pre-gate failures get the same lifecycle events and
queue progression as any other failed turn.

* fix(agent-core-v2): settle seeded turns on pre-gate failure, preserve coded credential errors, close steps on recovering

- Notification-seeded machine turns that fail before gating now bind a
  seeded reservation and end through endTurn like queued ones, instead
  of leaving the nudge pending and settled() hanging
- The llm machine's request actor attaches the raw error to
  llm.failed.remote and the turn machine prefers it for its terminal
  failure, so coded errors (e.g. auth.login_required) survive to
  endTurn's error payload
- projectMachineEvent now closes the current machine step on recovering
  exactly as it does on retrying, keeping step.begin/step.end balanced
  when credential recovery re-enters the request

* fix(kap-server): add generate to IModelCatalog test fakes

* fix(klient): migrate examples to the credentials API

* test(agent-core-v2): drop credential recovery coverage

* refactor(agent-core-v2): fold kimi-oauth credential adapter into credentials/

* refactor(agent-core-v2): pair credential refresh with invalidate, optional Model.credentials, abort-safe request actor

- oauthCredentials.invalidate() now starts the forced refresh eagerly and
  hands the pending token to the next resolve(), so the force signal can no
  longer leak into or be consumed by unrelated resolves
- Model.credentials becomes optional, dropping the {} as never /
  staticCredentials(undefined) filler in test fakes
- the llm machine request actor swallows abort outcomes instead of
  reporting llm.failed.remote, so an aborted turn settles as aborted
  rather than failed

* refactor(agent-core-v2): credentials recovery strategy chain, shared credential-recovery executors, single-proposal failure triage

* fix(agent-core-v2): settle message-less notifications on pre-gate failure, recover credentials in media resolver uploads

* test(kap-server): add the IModelCatalog.generate stub to the history suite
2026-09-10 20:39:22 +08:00
7Sageer
1e6f6e3929
refactor(agent-core-v2): drop the llm state machine, let turn invoke the request actor directly (#3710) 2026-09-10 20:22:48 +08:00
7Sageer
4049161bfe
refactor(agent-core-v2): replace ProtocolTrait with per-protocol typed traits composed in the requester pipeline (#3641)
* fix(agent-core-v2): honor request-level toolMessageConversion in openai formats

The requester already forwarded LlmRequestConfig.toolMessageConversion
into formatRequest, but the openai chat and openai-responses formats
only read the trait hook, so the explicit request config was silently
ignored. Resolve the mode as request config, then trait default, then
the protocol default, and pass the resolved value into lowering.

* refactor(agent-core-v2): split the protocol trait into per-protocol dialects and provider connection

The ProtocolTrait interface bundled endpoint/headers connection config,
model capability, message/params conversion hooks, and error
classification into one bag, and every format received the whole bag
whether or not it consumed each hook — hooks a protocol ignores were
accepted by the type system and silently dead at runtime.

Split it by consumer:

- ProviderConnection (protocol/connection.ts): endpoint env
  declaration and default headers, still resolved per request inside
  generate.
- Per-protocol typed dialects (OpenAIDialect, OpenAIResponsesDialect,
  AnthropicDialect, GoogleGenAIDialect): only the customization points
  each protocol actually consumes; data-shaped hooks (reasoningKey,
  toolCallIdPolicy, toolMessageConversion, strictThinkingValidation)
  are data fields, and message/history hooks use the protocol wire
  types instead of Record<string, unknown>.
- convertError moves to a requester option, capability to a provider
  variant field.

Dialects are bound when the format is created (createOpenAIFormat and
siblings), so FormatRequestInput and the stream parser carry request
data only; ProtocolTrait is deleted. The thinking hook returns the
kwargs and the preserveThinking flag together as ThinkingApplication,
and the kimi dialect emits the final thinking params directly instead
of routing them through an extra_body flatten in buildParams. The
llm-adapter layer is migrated to the same {connection, dialect,
convertError} assembly.

* refactor(agent-core-v2): compose format stages and dialect hooks in the requester pipeline

* refactor(agent-core-v2): rename protocol dialects to traits

* fix(agent-core-v2): include the system message in openai mergeHistory input

* refactor(agent-core-v2): enforce the format/trait contract boundary

- move CONTEXT_MANAGEMENT_BETA into anthropic/contract and have the kimi
  trait import wire types from each protocol's contract.ts instead of
  format/lower; export the four contract modules from human/index.ts and
  guard the boundary in check-import-boundaries
- rename protocol/trait.ts to protocol/thinking.ts and move TraitContext
  to protocol/base.ts; clean up the remaining dialect-era test variable
- type extractUsage as OpenAIRawUsage / OpenAIResponsesRawUsage instead of
  Record<string, unknown> and drop the requester-side casts

* refactor(agent-core-v2): thread the request config by spread and drop dead format types

- the four requesters spread LlmRequestConfig into the plan input instead
  of hand-enumerating fields, so a new cross-protocol config field cannot
  be silently dropped per protocol
- ProtocolFormat loses the phantom TRequest/TResponse type parameters;
  the dead OpenAIRawResponse/AnthropicRawResponse/GoogleRawChunk contract
  types go with them
- the thinking test now names the extra_body flatten behavior explicitly

* refactor(agent-core-v2): keep protocol format modules internal to the requester pipeline

- drop the four format barrels (and openai/reasoning-key) from
  human/index.ts; each base's public seam is now exactly
  contract / trait / requester
- stop re-exporting contract wire types from format/lower modules so the
  neutral vocabulary has a single home; move the *LoweredMessage staging
  types out of contract into the owning format module
- guard the seam in check-import-boundaries: only llm/requester/bases
  code and tests may import format/lower/patterns/reasoning-key
2026-09-10 20:09:52 +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
Kai
5e452fc2dd
fix(agent-core-v2): let steer interrupt background task waits (#3697) 2026-09-10 17:13:13 +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
tpoisonooo
2da4aa23b0
feat(tower): reliability fixes (#3648)
* fix(agent-core-v2): tower resume, wake, teardown, and mission-resolution reliability

- Require run_in_background=true in every roster-agent resume guidance and veto foreground roster resumes, abstaining when the profile has no background task tools; resume ids are trimmed before the roster lookup.
- Wake the tower when workers send inbox messages to it or broadcast, coalesced into a single notification per batch.
- Make teardown idempotent: worktrees git no longer knows are reported as already removed instead of failing.
- Resolve branch-to-mission unambiguously (closed missions skipped, latest open wins, merges of closed-only branches refused), reject plan-time branch collisions against existing missions and unowned git refs, and reserve the protocol names tower/all.

* fix(agent-core-v2): validate reserved tower names before spawn side effects and stamp reviews with their mission

- TowerSpawn rejects the reserved protocol names tower/all up front; the roster backstop no longer fires after the worktree, subagent, and detached task already exist.
- Reviews now record the mission they were written for; TowerMerge refuses when the latest clean review was stamped for a different mission, or carries no stamp while the branch is shared with other mission records.

* fix(agent-core-v2): pin tower reviews to the mission assigned at reviewer spawn

The reviewer's roster entry now records the mission resolved when it was spawned, and submitReview stamps that assignment instead of recomputing at submit time, so a review stays pinned to the mission the reviewer was briefed on even if the branch's resolution moved on; roster-less submissions fall back to the current resolution.

* chore: drop the enable hint from the tower changeset

* refactor(agent-core-v2): omit undefined fields in tower frontmatter rendering

renderFrontmatter now accepts and skips undefined values, so callers pass optional properties (review mission, inbox scope/action/consent_ref) directly instead of using conditional spreads, per the repository rule for optional object properties.

* fix(agent-core-v2): leave reviews by unpinned tower reviewers unstamped

A roster reviewer without a recorded mission assignment (entries persisted before reviewMissionId existed) no longer gets a stamp inferred from the submission-time branch resolution, which could name a different mission than the one it was briefed on; unstamped reviews on shared branches are refused by the sibling-mission gate until a pinned re-review, while unshared branches merge as before. Tower-submitted reviews keep the resolution fallback.

* fix(agent-core-v2): probe tower worktree registration per path instead of parsing porcelain output

git worktree list --porcelain emits paths containing newlines literally, so the line-based parser truncated them and teardown misreported those worktrees as already removed; the -z flag suggested for this is unavailable on the git versions the project supports (2.34). teardown now checks each mission worktree directly: git -C <path> rev-parse --git-dir resolving under <repo>/.git/worktrees means registered, which round-trips any filesystem path on any git version.

* fix(agent-core-v2): resolve the common git dir when probing tower worktree registration

In a linked checkout repoRoot/.git is a file and worktree admin directories live under the repository's common git directory, so every mission worktree failed the containment check and teardown left them on disk; the probe now resolves git rev-parse --git-common-dir first.

* docs(agent-core-v2): permit foreground roster resumes when background task tools are inactive

* fix(agent-core-v2): reject blank or whitespace-padded tower agent names

Recipients are trimmed at send time, so a name carrying surrounding whitespace would register an unreachable agent or alias a reserved protocol name; spawn and roster registration now reject such names up front.

* fix(agent-core-v2): drop queued tower inbox wakes on tower exit

The wake notify handle is now retained and dropped by exit(), so a queued wake can no longer inject a stale TowerInbox prompt after the user leaves tower mode.

* fix(agent-core-v2): drop queued tower inbox wakes when availability changes

reconcileTowerProjection now drops a pending wake and resets the wake state whenever the effective projection turns inactive, covering live flag-disable and feature-disassembly paths that never call exit().

* fix(agent-core-v2): truncate the subject preview in tower inbox wakes

The full subject stays in the inbox file, but the synthetic wake message now caps it at 120 characters so a body-sized subject cannot flood the tower's context.

* fix(agent-core-v2): recheck branch ownership at tower spawn time

A branch created between TowerPlan and TowerSpawn is no longer silently checked out as the mission's base: addWorktree now refuses it unless the mission already has an owner (a genuine continuation) or the worktree directory exists (a retry of an earlier spawn attempt).

* fix(agent-core-v2): abort tower spawns on worktree protocol refusals

TowerSpawn used to downgrade every addWorktree failure to a continuing warning, so a branch-ownership refusal still registered the worker and recorded an owner, which then satisfied the ownership check for later spawns; protocol errors now abort the spawn while git-level reuse cases (existing worktree directory) continue as warnings.

* fix(tower): select the review stamped for the mission being merged

Review rounds are per-reviewer, so a higher-round review written for a
closed sibling mission shadowed a fresh clean review stamped for the
mission being merged, and the gate's re-review advice could not succeed
until the new reviewer exceeded the old round count. The merge gate now
prefers reviews stamped for the resolved mission and falls back to
unstamped legacy reviews only when no stamped review exists; a branch
whose reviews all belong to other missions reports 'no review'.

* fix(tower): create unowned mission branches atomically

The spawn-time branch ownership check and the subsequent worktree
creation were a check-then-act sequence: a branch created by another
process in between was silently checked out instead of created from the
recorded base, letting unrelated history into the worker's worktree.
worktreeAddNewBranch now attempts the creation directly so git itself
refuses an existing ref, and the store maps that refusal to a
TowerProtocolError so the spawn aborts instead of degrading to a
warning.

* fix(tower): weigh later legacy verdicts on unshared branches

Review rounds are per-reviewer, so ordering reviews by round said
nothing about recency across reviewers: a mission-stamped clean review
shadowed a later unstamped P1 from a legacy (unpinned) reviewer, and
the gate merged on the stale clean verdict. Reviews are now ordered by
file mtime, and on a branch with a single mission the candidate set
keeps unstamped reviews alongside stamped ones — an unstamped verdict
there is unambiguous. Shared branches keep the stamped-only preference
so the legacy ambiguity guard still applies.

* fix(tower): accept only the registered worktree as proof of a prior spawn

The spawn-time ownership refusal was bypassed by any directory entry at
the planned worktree path: an unowned branch plus a plain mkdir let the
spawn continue past the refusal (the failed git worktree add degraded
to a warning), and the unrelated branch could later reach the merge
gate. The exception now requires the path to be a registered worktree
checked out on the mission branch — exactly what a crashed first spawn
attempt leaves behind — while a plain or foreign directory is refused.

* fix(tower): warn when a tower message has no running task to deliver it

A TowerSend to an idle roster agent only writes a file — nothing wakes
the recipient, so the fleet stalls until someone happens to resume it
(seen in the field: a tower messaged a worker back for another review
round without resuming it, and the mission sat idle for hours until the
human nudged the session). When the tower messages a roster agent that
has no active task in this session, the tool result now notes that the
message sits in its inbox until it is delivered with
Agent(resume=..., run_in_background=true). Broadcasts and sends from
workers are unchanged: workers cannot resume peers — the tower relays
wake-ups.

* fix(tower): record review submission order in the review itself

Review order was derived from file mtime — filesystem metadata that
coarse-tick filesystems quantize and that copies or archive restores
can rewrite, so a newer blocking verdict could sort behind an older
clean one and let the merge gate proceed. submitReview now stamps a
store-wide monotonically increasing seq into the review frontmatter
and reviewsFor orders by it; mtime remains only as the tie-breaker for
legacy reviews that predate the field and for same-seq races between
concurrent submissions.

* chore: shorten the tower changeset and cover the merge gate

* chore: condense the tower changeset to the three fixed areas

---------

Co-authored-by: konghuanjun <konghuanjun@moonshot.ai>
2026-09-10 14:19:40 +08:00
Kai
9f7e68e8bd
fix(mcp): preserve original attachments omitted from model output (#3688)
* fix(mcp): preserve original attachments omitted from model output

* test: register session media storage in agent lifecycle fixture

* fix(mcp): retain media originals and bound attachment details

* fix(mcp): resolve session attachments and honor cancellation

* test: check concrete media references in provider requests

* fix(media): read session attachments from their owning storage

* fix(media): preserve attachment access across runtime and history changes

* fix(mime): recognize structured application text attachments
2026-09-10 10:37:31 +08:00
Haozhe
aad4a7df2f
feat(agent-core-v2): event-source the human agent state store (#3691)
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 event-sourced store core and rewire human agent/session

human/eventStore core (schema-first defineEvent factories, serial
fold-first dispatch with snapshotting, late-join slices, journal
reset), agent events/slices/historySchema, machine rewrite around a
store actor with mirror consumption, session stores with
turnIndex-boundary undo, todo slice, v2 migration to the new event
types, and the loop engine bridge.

* refactor(agent-core-v2): make the agent machine self-consistent and the store actor static

Phantom-turn root cause: local patches plus the async store.changed
mirror were two consistency models for the same data. The machine now
owns its state (every transition is a local assign plus a store.append
dual write) and consumes only store.ready/reset/error.

- store actor becomes static storeActor logic with the engine passed
  via invoke input; the session machine registers agentActor and
  spawns it by name
- SessionStores.open/fork return the engine directly
- store.reset aborts the old abort scope (cascades to in-flight
  turn/tools/background)
- no-op drain events are no longer journaled
- engine bridge seeds the initial turn id into the journal before
  folding, and resetHistory is awaited before the retry notify
- tests pass the store via machine input and wait for the log to
  catch up before store assertions; drop debug residue

* refactor(agent-core-v2): drop journal snapshots for plain full-replay event sourcing

Snapshots serialized the whole slice state every 500 events and, on
an asynchronous backend, their fire-and-forget append could still be
queued when the next dispatch read journal.nextSeq(), making the
recorded FoldContext.ref.seq one less than the persisted event's
sequence and shifting turnIndex undo boundaries. Removing the
mechanism eliminates the race and the full-state rewrite; refold now
always seeds from initial state and replays every event record
(legacy snapshot entries are ignored).
2026-09-10 00:18:48 +08:00
7Sageer
1306a9a8db
feat(agent-core-v2): warn on [models] entries missing the model field (#3681)
* feat(agent-core-v2): warn on [models] entries missing the model field

* refactor(agent-core-v2): contribute model config diagnostics from the models section

Move collectMalformedModelEntries next to ModelRecordSchema and derive
the known object-field set from the schema shape instead of hardcoding
it, so future object fields cannot drift out of sync. Sections now
contribute load-time diagnostics through a collectDiagnostics hook,
mirroring the deprecations contribution.
2026-09-09 21:18:29 +08:00
Haozhe
6299cfda70
feat(kap-server): stream raw xstate inspection events over /api/v1/debug/ws (#3687) 2026-09-09 20:20:12 +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
liruifengv
4954fabbaa
docs(changelog): sync 0.42.0 from apps/kimi-code/CHANGELOG.md (#3675)
* docs(changelog): sync 0.42.0 from apps/kimi-code/CHANGELOG.md

* docs(changelog): use absolute URL for the Remote Control guide link

* docs(changelog): use absolute URLs for the remaining doc links
2026-09-09 14:59:07 +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
91dcc2d8cd
chore: translate and polish pending changeset entries (#3674) 2026-09-09 14:20:48 +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
6de0cec174
fix(mcp): preserve distinct structured tool results (#3654)
* fix(mcp): preserve distinct structured tool results

* test(agent-core-v2): use current streaming event in thinking test
2026-09-08 21:40:29 +08:00
Kai
7f5debfa71
fix(agent-core-v2): fall back to the configured default model for image format gating (#3652) 2026-09-08 20:42:25 +08:00
Haozhe
5a84a67eef
refactor(agent-core-v2): replace stale v3 naming in human code with neutral mock text (#3653) 2026-09-08 20:40:24 +08:00
Haozhe
a0191da44e
feat(agent-core-v2): round-trip reasoning_details in chat completions (#3492) 2026-09-08 19:54:01 +08:00
Kai
5000f981c3
fix(agent-core-v2): make large file reads resumable (#3645)
* fix(agent-core-v2): avoid repeated truncation of file reads

* fix(agent-core-v2): resume reads within long lines

Add column offsets and forward recovery for bounded long-line reads. Reject malformed UTF-16 in Read instead of replacing invalid input.

* fix(agent-core-v2): warn on lossy UTF-16 reads

Return readable text after strict UTF-16 decoding fails, with a warning retained in budgeted read continuations.

* fix(agent-core-v2): avoid redundant tail scans and detect file changes
2026-09-08 19:47:27 +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
9188d03c99
refactor(protocol): remove package and relocate wire types into agent-core-v2 (#3646) 2026-09-08 17:41:41 +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
Kexin Liu
d4d20d21d7
feat(agent-core-v2): allow read-only tools in /btw side questions (#3613)
* feat(agent-core-v2): allow read-only tools in /btw side questions

The btw child agent previously vetoed every tool call. Allow the
read-only tools Read, Grep, and Glob so side questions about the
codebase can be answered from current file contents; write and
execute tools stay disabled.

* docs: address review — single-sentence changeset, inline-code tool names

* chore: drop the benefit clause from the btw changeset
2026-09-08 14:50:48 +08:00
7Sageer
1670d3a8aa
fix(agent-core-v2): clarify subagent model disclosure in Agent and AgentSwarm prompts (#3639)
* fix(agent-core-v2): clarify subagent model disclosure in Agent and AgentSwarm prompts

The Available models section annotated "primary" with its alias only
when the caller's model was already listed, and stayed anonymous exactly
when the annotation was needed. The same model was reachable three ways
with an undisclosed thinking-level difference, the [main model] marker
duplicated the primary handle under a second name, and AgentSwarm
repeated the whole list verbatim.

- primary now always names its binding: primary (= <alias>)
- drop the [main model] marker; keep [default]
- state the pool entries' thinking level in a closing note
- AgentSwarm renders a compact one-line summary instead of the full block
- keep the selection guidance only in the model parameter description

* Delete .changeset/clear-subagent-model-list.md

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

* fix(agent-core-v2): drop the hard-task guidance from the model parameter descriptions

* fix(agent-core-v2): render a disabled-thinking variant of the pool thinking note

* test(agent-core-v2): drop the added prompt-text variant tests, keep updated assertions

* fix(agent-core-v2): state the pool thinking note as one unconditional binding rule

---------

Signed-off-by: 7Sageer <sag77r@hotmail.com>
2026-09-08 14:47:03 +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
Haozhe
c156ed5ea9
test(kap-server): drop the flaky two-pass swap catalog import case (#3636) 2026-09-08 12:55:30 +08:00
Haozhe
f88ed6d45b
chore: add the tdd skill for test-driven development (#3637) 2026-09-08 12:52:09 +08:00
Grapedge
586c4c2130
chore: initialize husky git hooks (#3632) 2026-09-08 12:37:31 +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
Haozhe
0527dae160
refactor(agent-core-v2): align xstate machine naming with command/fact/streaming conventions (#3635) 2026-09-08 11:18:00 +08:00
Haozhe
6e51631c3d
fix(agent-core-v2): stop tool actor teardown from aborting sibling tools (#3626)
* fix(agent-core-v2): stop tool actor teardown from aborting sibling tools

* refactor(agent-core-v2): hoist abort signal ownership to spawn sites

* refactor(agent-core-v2): derive cancellation from a Go-like abort scope tree

* fix(agent-core-v2): bind the abort scope's child abort
2026-09-08 10:26:13 +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
Grapedge
260ac3faad
feat(cli): apply cloud-recommended default thinking effort (#3616) 2026-09-07 21:21:34 +08:00
7Sageer
1316b3f92b
refactor(agent-core-v2): drop anthropic_beta and google-vertex protocol names (#3602)
* refactor(agent-core-v2): drop anthropic_beta and google-vertex protocol names

* refactor(agent-core-v2): resolve human protocol variants at generate time
2026-09-07 21:03:40 +08:00
Haozhe
5e622e5b52
refactor(agent-core-v2): move llm retry and recovery from the llm machine to the turn state machine (#3624) 2026-09-07 21:01:25 +08:00
Haozhe
f3c75bd4d9
docs(agent-core-v2): add the llm module design guide (#3621)
* docs(agent-core-v2): add the llm module design guide

* docs(agent-core-v2): align the llm guide with the shared syntax errors, failure ends, and anthropic_beta naming
2026-09-07 20:57:13 +08:00
tpoisonooo
0d7833ee80
fix(agent-v2): tower mode fixes (#3596)
* feat(tui): show each background agent's model in the /tasks list

* fix(agent-core-v2): carry model and thinking effort in tower spawn task metadata

* fix(tower): honor subagent timeout config for tower spawn tasks

TowerSpawnTool registered its detached subagent task with the hardcoded
DEFAULT_SUBAGENT_TIMEOUT_MS, bypassing the [subagent] timeout_ms setting
and KIMI_SUBAGENT_TIMEOUT_MS. Resolve the timeout through
resolveSubagentTimeoutMs(config) like AgentTool does, keeping the 2h
default when nothing is configured.

* test(agent-core-v2): deflake the sessionIndex perf baseline under load

* feat(agent-core-v2): carry user-verbatim mission context through tower briefings

TowerPlan missions accept an optional context field holding the user's
own key sentences verbatim, rendered into the mission file and every
briefing that embeds it. Reviewer briefings now include the full mission
text and the author's review-request, with an intent-first checklist;
worker briefings escalate substantive ambiguity to the tower before
acting and reconcile completion reports task by task.

* chore: merge tower changesets into one

* refactor(tui): narrow tasks-browser host appState with Pick

* docs(agent-core-v2): correct the subagent timeout description in the Agent tool

* docs(agent-core-v2): drop the timeout bullet from the Agent tool description

---------

Co-authored-by: konghuanjun <konghuanjun@moonshot.ai>
2026-09-07 20:50:18 +08:00
Kai
34ad5137ce
feat(kimi-code): two-line collapsed tool cards with width-aware headers (#3539)
* 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): show short tool output whole and point at hidden output

Collapsed cards now show up to three output lines before falling back to
a single outcome row, the Grep chip counts files or matches according to
output_mode, and the tools' pagination and empty-result notices no longer
count as results. While the recent turns hold tool output that ctrl+o
would reveal or hide, the footer shows ctrl+o expand or ctrl+o collapse.

* feat(kimi-code): mark hidden tool output with counts and direction

A collapsed Bash card's chip now counts the hidden lines (`N more
lines`), its last-line outcome row carries a leading ellipsis, a generic
tool's first-line row a trailing one, and the Grep glance keeps its
"+N more" count in the fixed tail so width cuts drop samples, never the
count. Background Bash results identify the task by their first
metadata line instead of trailing internal hints, and header truncation
now treats ANSI escapes as atomic zero-width units and stays bounded by
the terminal width for huge arguments.

* fix(kimi-code): keep tool notices and context rows out of result counts

Glob's timeout, truncation, and warning lines no longer inflate the
file count or pose as glance samples, and unnumbered Grep content with
context flags falls back to an exact file count instead of claiming
matches it cannot distinguish. The footer's ctrl+o hint now also
appears when an outcome row is cut by the terminal width — one to three
very long lines hide the remainder that ctrl+o reveals wrapped.

* fix(kimi-code): align the ctrl+o hint with what expansion reveals

The Edit check now uses the same clustered diff render as the preview
(context rows and inter-hunk separators count toward the cap), and an
ExitPlanMode outcome card no longer reports hidden content — the plan
is fully rendered by the call preview and its result body is
expansion-independent. OUTCOME_MAX_LINES moves to the TUI constant
directory with the other shared rendering limits.

* fix(kimi-code): tighten the collapsed-card hidden-content signals

Outcome rows drop terminal control sequences before they are cut, a
failed Bash card leaves the hidden-line count to its preview trailer,
an unnumbered Grep glance lists each file once, a solo subagent card
never reports hidden content, and the glance sample cap joins the other
collapsed-card limits in the rendering constants.

* fix(kimi-code): count paginated Grep totals and wrapped error previews as hidden

The Grep chip and glance use the tool's count-mode summary and pagination
total instead of the current page, Windows drive letters stay inside
unnumbered content paths, Glob's ripgrep stderr continuation lines no
longer count as files, a background question follows the line-count rule,
and an error preview whose long line wraps past its row cap keeps the
footer's ctrl+o hint on.

* fix(kimi-code): treat spilled tool output as an envelope, not as results

An oversized result reaches the TUI as agent-core's truncation envelope;
cards now render its first line as the outcome row and carry no chip
instead of counting its metadata as files or lines. The Grep chip keeps
the count-mode totals on an empty page, and the Bash chip counts rows
the way the outcome rows do, so whitespace-only rows never claim hidden
lines.

* fix(kimi-code): widen the hidden-content signal to failed previews and ! cards

A paginated content search reports the tool's match total, a capped Edit
or Write preview counts as hidden even when the call failed, and a
user-run ! command card tells the footer about its running tail or
capped result.

* fix(kimi-code): keep result chips honest on incomplete, narrow, and cut-off cards

Grep and Glob counts read as lower bounds (`12+ files`) when the tool
reports a timeout or output cap, a header too narrow for its fixed parts
drops the middle and cuts the head before the chip, and a call whose
arguments were cut off by max_tokens no longer claims hidden content.

* fix(kimi-code): stop the expand hint lying on goal cards, ! cards, and paginated context

A pagination total only stands in for the match count when no context
flag is set, a ! command card that finished while expanded still counts
its rows past the preview cap, parsed goal snapshots and bodiless goal
updates report nothing to expand, header fitting measures graphemes
instead of trusting code-unit length, and the escape pattern and tail
window join the rendering constants.

* fix(kimi-code): read zero context flags as none and mirror the Edit cap exactly

A Grep call with -A/-B/-C set to zero produces no context rows, so its
matches stay countable; the Edit hidden-content check now renders the
preview capped and uncapped and compares them, so a body that fills the
cap exactly no longer counts as cut.

* fix(kimi-code): keep the collapse hint for expanded cards outside the window

Toggling ctrl+o off collapses every expanded card, including one that
slid before the three-turn cutoff since it was expanded, so the footer
now keeps offering collapse while any expanded card hides content. Grep
context detection follows the backend's -C precedence, where a defined
-C makes -A and -B moot.

* fix(kimi-code): render Edit and Write results the same way in both states

Their one-line success acknowledgements repeat what the header, chip and
preview already show, so they render in neither state; any other
successful output shows as an outcome row in both. The footer's expand
hint therefore depends only on the capped preview for these cards.

* fix(kimi-code): keep a Read group's failure count on narrow rows

The finished header is three segments — label, line count, `· N failed`
tail — so a narrow row drops the line count before the failure count,
which is the only sign of partial failure while the per-file body is
collapsed.

* fix(kimi-code): show cut-short empty searches and keep the hint with a status command

A Grep or Glob the tool cut short before any row renders its notice
instead of an exact-looking empty result and carries no chip, a
ReadMediaFile result that is not a media envelope follows the line-count
rule, and the footer's ctrl+o hint moves to line 2 when a
status_line.command owns line 1.

* fix(kimi-code): count unreadable directories as an incomplete Glob and stop hinting on notice-only searches

A Glob that skipped unreadable directories reports its file count as a
lower bound, and a search cut short before any row — which renders only
the tool's notice, the same way in both states — no longer makes the
footer offer ctrl+o.

* fix(kimi-code): let the ctrl+o hint displace an inline tip and count parsed WaitFor results as hidden

An inline tips slot gives way when the fixed hint would not fit beside
it, and a parsed WaitFor result — whose raw fields only render when
expanded — reports hidden content instead of falling to the line-count
rule.

* fix(kimi-code): keep spill pointers and sensitive-only notices out of counts and honor streaming previews

The per-line truncation pointer agent-core appends to an oversized
result stays out of line and file counts, byte sizes and outcome rows; a
search whose only matches were filtered as sensitive files shows the
tool's notice instead of an exact-looking empty result; and while
arguments still stream, only a Bash card (whose partial command appears
once expanded) reports hidden content.
2026-09-07 20:36:46 +08:00
Haozhe
75682b0ef1
fix(agent-core-v2): skip stray non-directory entries during session index scans (#3618) 2026-09-07 19:06:09 +08:00
Kexin Liu
fb0353a8ba
feat(agent-core-v2): watch user-level skill roots so the catalog stays fresh (#3608)
* feat(agent-core-v2): watch user-level skill roots so the catalog stays fresh

UserFileSkillSource previously only re-scanned the user skill roots
(KIMI_CODE_HOME/skills and ~/.agents/skills) on catalog load, so a skill
created while the daemon was running never appeared until a restart.

Mirror the workspace-root source: watch both user-level base directories
with a subtree filter limited to the skill-root candidates, debounce
(200ms) change events, and fire onDidChange so the catalog reloads the
'user' source automatically. Watch handles are registered on the
service's DisposableStore and disposed with the App scope.

Supersedes the skills:reload endpoint approach (#3597).

* fix(agent-core-v2): merge same-base watch candidates and drop test comments

Codex review on #3608:

- When KIMI_CODE_HOME equals the OS home dir, deduplicating watch bases
  skipped the .agents/skills candidate entirely. Group candidates by
  base instead so one watch covers both roots.
- Remove // phase labels from the catalog test: agent-core-v2 is a
  comment-free zone enforced by scripts/check-no-comments.mjs (lint was
  red on CI).
2026-09-07 17:41:16 +08:00
HydrogenE7
5eea890165
fix(agent-core-v2): attribute event-loop-busy decode time to the client (#3607)
The decode-window split measured part arrival at the moment the event
loop resumed the pending await, so any loop-busy work (rendering,
timers, GC) between parts was reported as server time. Measure loop
utilization across the decode window with perf_hooks and split it into
loop-idle wait (server), per-part processing (client), and a new
clientBlockedMs bucket (loop busy with other work), carried through to
the step events, wire record, transcript contract, and the TUI debug
timing line.
2026-09-07 16:43:44 +08:00
HydrogenE7
f1e9152776
fix(sdk): count cron turns as replay turn boundaries (#3605)
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 / 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
Resuming a session dominated by cron-fired turns mounted an unbounded
transcript: limitAgentReplayByTurns only counted human-typed prompts as
turn boundaries, so the replay limit never engaged (10,478 records for
11 'turns' on an affected session). The mounted transcript made every
render frame O(total lines), starving the event loop during streaming
and collapsing client-side drain throughput.

Treat cron_job and cron_missed replay records as turn boundaries,
matching the TUI transcript window's own boundary rule.
2026-09-07 16:05:42 +08:00
Kai
55685c58b5
feat(agent-core-v2): remove the context budget reminders (#3526)
* feat(agent-core-v2): remove the context budget reminders

PR #3423 shipped two behaviors together: the context budget reminders
(context_budget and compaction_ahead) and the compaction recovery
pointer. Remove the reminders so the recovery pointer's effect can be
measured on its own in an ablation run.

Removed: the features/contextBudget feature, the budget-only
CompactionStrategy.budget()/CompactionTriggerBudget/
IAgentFullCompactionService.budget() surface, the summarizer-input
reminder filter, and the context_budget_reminder /
compaction_ahead_reminder telemetry plus the ahead_* fields on
compaction_finished. The recovery pointer (Context Recovery footer,
wire journal line ranges, whole-line wire.jsonl reads, empty-history
compaction failure) is unchanged.

* chore: add the changeset for removing the context budget reminders
2026-09-07 16:00:15 +08:00
silentiris
ed1dc720e2
fix(kosong): tolerate undefined model name in Anthropic profile matching (#3003)
A malformed config entry (e.g. an unquoted dotted TOML key like
[models.kimi-k2.7-code]) parses into a nested object that lacks the
top-level model field. The v2 config schema marks model optional, so the
entry reaches profile matching with undefined, crashing getModels with
TypeError: Cannot read properties of undefined (reading 'toLowerCase').

matchKnownAnthropicModelProfile, matchUnknownClaudeProfile, and
parseAnthropicModelVersion now return undefined/null for undefined input
instead of throwing.

Fixes #2981

Co-authored-by: zhaopeiwen.dev <zhaopeiwen.dev@bytedance.com>
2026-09-07 15:48:24 +08:00
7Sageer
924da9cdb4
feat(agent-core-v2): add env bindings for print-mode and bash task timeout config keys (#3598)
* feat(agent-core-v2): add env bindings for print-mode and bash task timeout config keys

Wire bashTaskTimeoutS, printBackgroundMode, printWaitCeilingS, and
printMaxTurns into taskEnvBindings as KIMI_CODE_BACKGROUND_* variables
so headless/print runs (e.g. container harnesses) can bound or disable
the print background policy without mounting a config file. bashTaskTimeoutS
accepts 0 (no timeout); invalid values are ignored. Env-set values count
as set for applyPrintModeConfigDefaults and win over the print fill.

Both integer parsers use Number.isSafeInteger: zod's int() rejects
unsafe integers, and since applySectionEnvBindings validates the combined
overlay, one unsafe value would otherwise discard the whole section's
env bindings, including valid siblings.

* Delete .changeset/print-task-env-bindings.md

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

---------

Signed-off-by: 7Sageer <sag77r@hotmail.com>
2026-09-07 14:36:09 +08:00
7Sageer
00cfbb0547
fix(cli): warn in kimi -p when workspace trust skips project MCP servers (#3593)
* fix(cli): warn in kimi -p when workspace trust skips project MCP servers

* fix(cli): report project MCP overrides in trust warnings
2026-09-07 14:35:58 +08:00
Haozhe
73ff2bf6e6
fix(agent-core-v2): merge text deltas across empty reasoning stream parts (#3601) 2026-09-07 14:21:22 +08:00
Haozhe
369dbff8db
fix(remote-control): release the lock before reporting off and re-read the server token per forward (#3599)
* fix(remote-control): release the lock before reporting off and re-read the server token per forward

* fix(remote-control): pass the token provider through the manager
2026-09-07 14:15:28 +08:00
Haozhe
48f5dc9740
feat(kap-server): add remote-control runtime toggle API (#3594)
* feat(kap-server): add remote-control runtime toggle API

* feat(remote-control): manage tunnel lifecycle with an xstate state machine
2026-09-07 13:46:22 +08:00
Haozhe
3f967e1410
refactor(agent-core-v2): unify fs watching into a single xstate watch service (#3502) 2026-09-07 13:30:25 +08:00
Haozhe
c1cac3436d
fix(kap-server): stop event journal writes after server close (#3595) 2026-09-07 12:07:30 +08:00
Haozhe
f0434f2d25
feat: graduate remote-control, minidb read model and search worker from experimental flags (#3552)
- remote-control is always available: kimi rc, kimi web --remote-control and /remote-control no longer require KIMI_CODE_EXPERIMENTAL_REMOTE_CONTROL or the master flag
- add the [database] config section with base (session-index read model) and search (global search worker) kill switches, both defaulting to true
- rename the kill-switch env vars to KIMI_CODE_PERSISTENCE_MINIDB_READMODEL and KIMI_CODE_SEARCH_WORKER (precedence: env > config > default)
2026-09-07 11:28:35 +08:00
Haozhe
bb16383aa1
refactor: remove the legacy agent-core v1 package (#3542)
* refactor: remove the legacy agent-core v1 package

Delete packages/agent-core (v1 engine) and migrate node-sdk fully onto
agent-core-v2:

- node-sdk owns its public contract (error protocol, KimiConfig schema
  and file IO, process-global logging facade, telemetry client
  interface); event and interaction types re-export from
  @moonshot-ai/protocol or agent-core-v2
- createKimiHarness is now the single harness factory, backed by the
  v2 client; the v1 SDKRpcClient is deleted
- CLI and vscode run agent-core-v2 unconditionally;
  KIMI_CODE_LEGACY_FLAG and useAgentCoreV1 are removed
- the wire.jsonl replay fold moves into agent-core-v2's replayBuilder
  (foldWireRecords), and the v2 journal now persists tool-call display
  so replay restores diff/todo displays
- TUI engineV2 branches collapse to the v2 path

* test(vscode): retry temp-dir teardown in replay-resume integration test
2026-09-07 11:17:51 +08:00
Haozhe
ccf3d5d6d7
fix(agent-core-v2): deduplicate repeated tool call ids inside the turn machine (#3586)
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
* fix(agent-core-v2): deduplicate repeated tool call ids inside the turn machine

* fix(agent-core-v2): keep the raw tool call id whenever a normalizer rewrites it
2026-09-07 00:11:13 +08:00
Haozhe
00265b0974
fix(agent-core-v2): deduplicate repeated tool call ids in the loop machine requester (#3582) 2026-09-06 22:38:11 +08:00
Haozhe
485594f65e
refactor(agent-core-v2): absorb the human layer and replace the agent loop with a facade over its turn state machine (#3580)
* refactor(agent-core-v2): absorb the human layer into src/human and rename vendored kosong to llm-adapter

* feat(agent-core-v2): preserve media attachment names in human message contract

* refactor(agent-core-v2): remove llm-adapter code duplicated in human/llm

* refactor(agent-core-v2): replace the agent loop with a facade over the human turn state machine

* refactor(agent-core-v2): rename the loop adapter layer to loop/machine

* test(acp-server): implement gateway resolve in the scripted provider stub

* refactor(agent-core-v2): restore v2 batch semantics in the loop machine tools adapter

- delegate each step's tool calls to the v2 tool executor as one whole
  batch: beginBatch arms the expected call set from the llm.done entry,
  per-actor execute calls collect into a pending barrier, and the full
  batch is submitted in tool-call order once complete
- drop the serial batchChain/batchStopped/skipped approximation so the
  executor's prepare-stage stopBatchAfterThis skip, veto short-circuit,
  and ToolScheduler access-based concurrency apply natively again

* fix(build): update flake pnpmDeps hash for the post-absorb lockfile

* fix(agent-core-v2): align loop facade reservations with the machine queue by id

* fix(agent-core-v2): drain persisted wire records before turn end

* fix(agent-core-v2): route executor-level tool errors to the loop error path and backfill aborted tool results on forced abort

* fix(agent-core-v2): keep turn step retrying in the facade step numbering space
2026-09-06 22:26:35 +08:00
Kimi Agent
af81bb9221
fix(cli): open localhost instead of the wildcard bind address when auto-opening the web UI (#3560)
`kimi web --host 0.0.0.0` (or `--host ::`) auto-opened the browser on the
wildcard bind address, which is not navigable. Open localhost on the same
port instead, matching the ready banner's Local: line. Also make the ready
banner's port parsing tolerate the `::` wildcard origin, which crashed
`new URL()` at startup.

Co-authored-by: kimi-agent-bot <kimi-agent-bot@users.noreply.github.com>
Co-authored-by: qer <wbxl2000@outlook.com>
2026-09-06 17:32:20 +08:00
Luyu Cheng
baf17a8fcc
feat(protocol): preserve media attachment names (#3548)
Some checks are pending
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
CI / build (push) Waiting to run
CI / test (1) (push) Waiting to run
CI / test (2) (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
Preserve optional image and video filenames through media resolution, shared protocol schemas, turn events, and transcript reconstruction. Cover stored media reuse, unsupported image conversion, and steering with regression tests.
2026-09-06 14:30:52 +08:00
Kai
f9ca333766
fix(vis): align with current agent-core-v2 (#3540)
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
Release / Publish native release assets (push) Has been cancelled
Nix Build / nix build .#kimi-code (push) Has been cancelled
* fix(vis): align with current agent-core-v2

* fix(vis): harden partial session recovery

* fix(vis): harden file history rendering

* fix(vis): validate persisted debug payloads
2026-09-04 23:36:22 +08:00
qer
2fbb2714af
docs(changelog): sync 0.41.0 from apps/kimi-code/CHANGELOG.md (#3551)
Some checks are pending
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 / 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 / build (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
Co-authored-by: kimi-agent-bot <kimi-agent-bot@users.noreply.github.com>
2026-09-04 21:14:59 +08:00
2787 changed files with 164157 additions and 263923 deletions

View file

@ -5,7 +5,7 @@ description: Use when generating changesets in the kimi-code repository — deci
# Generate Changesets
The only user-facing published package is the CLI: `@moonshot-ai/kimi-code`. All other `@moonshot-ai/*` packages (sdk, agent-core, kosong, kaos, oauth, telemetry, and so on) are internal.
The only user-facing published package is the CLI: `@moonshot-ai/kimi-code`. All other `@moonshot-ai/*` packages (sdk, kosong, oauth, telemetry, and so on) are internal.
## 1. Whether to Write
@ -32,6 +32,7 @@ Fix occasional loss of tool call results in long conversations.
Wording:
- One short, user-facing English sentence that states only what changed. Drop trailing clauses that explain the cause, the benefit, or the mechanism.
- When a default flips or an existing behavior is removed, name the behavior users lose, not only the new default. State the escape hatch if one exists, e.g. `Stop hot-reloading config, skills, and AGENTS.md by default; set [watch] enabled = true or KIMI_CODE_WATCH=1 to turn it back on.`; if there is none, say plainly that the old behavior is no longer available.
- New features: say plainly what it is plus one line on how to use it, e.g. `Add the /foo slash command to list active sessions. Run /foo to see them.`
- Experimental features: also state how to enable them (the flag, config key, or env var).
- No file, class, or function names, and no PR numbers. No vague words like refactor, optimize, or improve. No real internal identifiers — use neutral placeholders such as `example.com` or `YOUR_API_KEY`.
@ -60,4 +61,4 @@ Wording:
4. **Show the changeset text to whoever requested the work and get their confirmation before committing.**
5. Do not guess at changes you do not understand: finish the parts that are clear, then list what is unclear and ask whether you may dig into the code.
Before a release, review the accumulated `.changeset/` entries and delete the non-user-facing ones — the release PR regenerates from `.changeset/` on main, so deleting a file removes its changelog entry without touching shipped code.
Before a release, review the accumulated `.changeset/` entries and delete the non-user-facing ones — the release PR regenerates from `.changeset/` on the selected release branch, so deleting a file removes its changelog entry without touching shipped code.

View file

@ -13,6 +13,8 @@ This skill reuses `sync-changelog`'s strip / classify / translate rules. Read `s
### 1. Locate the release PR
Select the PR targeting the intended `release/*` branch, not the legacy main version PR. Report its latest head CI link and result alongside the preview.
```bash
gh pr list --state open --search "ci: release packages in:title" \
--json number,title,url,headRefName,baseRefName

View file

@ -0,0 +1,192 @@
---
name: review-pr
description: 在 kimi-code 仓库里 review 一个 PR 时使用:按 PR 模板逐节核对描述与 diff,并单独做一轮"回归与用户影响"评审,给出影响等级与评审摘要,评审摘要用用户当前使用的语言。
disable-model-invocation: true
---
# Review PR
这个仓库过去的回归大多不是逻辑错误,而是"改动相对于自身意图是对的,但悄悄改掉了某个现有人群依赖的行为":方言分支收窄、默认值翻转、删 system prompt 句子、重构或移植时丢掉旧路径的功能、修复引入启动时序变化。通用 review 会把这类"有意的功能变更"排除在 bug 之外,所以这里把它单列成一轮。
评审判据只有一条:**改动前能工作的任何输入(配置键、环境变量、命令行参数、provider 响应形态、旧版本写的会话数据、客户端请求、hook 载荷)改动后必须行为不变,除非 PR 明确声明了这个变化并给出了退路。**
## 工作流
1. 拉 PR 元数据与描述:
```bash
gh pr view <number> --json title,body,url,files,additions,deletions,baseRefName,headRefName
```
2. 读完整 diff(大 PR 按文件分批读):
```bash
gh pr diff <number>
```
3. 读足够的周边代码来验证描述里的每个断言。只看 diff 看不出"改动前谁走到这个分支"。
4. **第一遍:定性。** 判断改动类型,决定第三遍的深度,见"第一遍:定性"。
5. **第二遍:按模板逐节核对。** 见"模板逐节核对"。
6. **第三遍:回归与用户影响。** 尽量用一个独立子 agent 跑:只给它 PR 号、base 与 head、两三句改动简介和 `surfaces.md` 的路径,不给它作者关于影响范围的结论,让它先从 diff 和代码独立列清单,回来后再与作者填的表对比。没有子 agent 能力时自己按同样顺序做:先列清单,再读作者的表。见"第三遍:回归与用户影响"。
7. 用用户当前使用的语言写评审摘要,格式见"输出"。
## 第一遍:定性
| 改动类型 | 第三遍深度 |
|---|---|
| 纯内部重构、测试、文档、测试 CI | 只需给出"没有可观测变化"的证据:哪些分支、默认值、契约文件没动 |
| 发布与打包:release、native 构建、VS Code 发布工作流,打包脚本,web 产物同步 | 全做,人群按安装方式与平台分:npm 包、各平台 native 二进制、VS Code 市场、内置 web 产物 |
| 新增功能,不动既有路径 | 只查新分支是否抢走了既有输入:新增条件是否排在旧条件之前 |
| 行为变更、默认值翻转、校验或权限收紧或放宽 | 全做 |
| prompt 文本变更:system prompt、工具描述、提醒、overlay、内置 skill | 全做,且每一句改动单独成行 |
| 移植、替换旧路径、大重构:v1 到 v2、runtime binding、协议替换 | 全做,并要求作者给出旧路径功能清单 |
| 协议、磁盘格式、SDK 导出、hook 载荷、命令行契约变化 | 全做,并点名仓库外的消费方 |
| 修复类改动改了启动顺序、生命周期、异步时序 | 全做,重点看谁依赖原来的顺序 |
一个 PR 可以同时属于多类,按最重的那类处理。
## 第三遍:回归与用户影响
### 1. 行为变化清单
列出 diff 改变的每一个可观测行为,包括作者说"不变"的和作者认为"内部"的。内部包会打进 CLI 发布包,"内部"不等于用户无感。
每一行记录:行为、变化前、变化后、变化类型(新增 / 修改 / 删除 / 默认翻转 / 收紧 / 放宽)、证据(改动前后各一个 `file:line`,一侧不存在时给可达路径)。
读法:
- 对每个被删除或被收窄的分支、条件、默认值、句子,问"改动前谁走到这里,改动后他们去哪了"。
- 对每个新增的分支或条件,问"哪些既有输入现在会先命中新分支"。#3492 的回归就是这样产生的:数组字段存在时不再读字符串字段,而 OpenRouter 形态的网关两者同时发。
- 测试里"把旧断言改成新行为"的改动是行为变化的直接证据,逐条对应到清单。
- 先看 diff 文件列表有没有命中 `surfaces.md` 的"触发线索"。命中的 surface 必须在清单里有对应行,否则就是漏项。
### 2. 受影响人群
每一行对应到 `surfaces.md` 里的具体人群,写出人群名字和"这个人群存在"的证据:文档页、issue、配置示例、provider 载荷形态。找不到人群的,不进 finding,进"待作者确认"。
### 3. 影响等级
等级只由改动的事实决定,不看 changeset、文档、测试这些补救状态。三步判定:
1. 数据丢失、安全边界放宽、老数据不可读、某人群的功能整体不可用:直接 L3。
2. 否则,可感知且有一键退路(config、env、flag):L1;可感知且无退路,旧行为不可恢复:L2;无可观测变化:L0。
3. 静默升级:用户提供的输入(配置、环境变量、数据、请求字段)被忽略或丢弃,且没有任何错误信号,用户无法自行发现:升一级,最高 L3。行为公开地变了、用户能在输出里看到的,不算静默。
广度三档,必须写出人群名字:全体用户 / 某类配置或平台人群 / 边缘环境。
每一行单独定级,PR 的等级取最高。静默升级的理由:没有信号就没有上报,回归会一直存活到有人偶然发现。
### 4. 补救核对
固定四问,逐条回答有 / 无 / 不适用,并给出证据:
- 退路开关:有没有 config、env 或 flag 能恢复旧行为。
- changeset:有没有点明用户**失去了什么**,而不只是新默认是什么;没有退路时是否明说旧行为不可恢复。
- 老数据与老客户端:旧版本写的会话、迁移来的数据、上一版发布的客户端(desktop、web、VS Code、ACP)是否仍然可用;回滚到上一版是否安全。
- guard 测试:有没有一条测试把**未被改动的人群**的旧行为钉住。
再加一问:`docs/en` 与 `docs/zh` 里对这个 surface 的承诺是否同步更新。
### 等级对应的处理要求
- L3:建议阻塞。必须补 guard 测试,并提供退路、flag 门控或迁移,缺一不可合。
- L2:需要维护者在 PR 里显式拍板;changeset 必须写明失去的行为;文档同步。
- L1:核对 changeset 与文档即可。
- L0:一句话说明为什么是 L0,给出证据。
### finding 与"待作者确认"的界线
- finding 必须同时有:改动前后各一处 `file:line` 证据,和一个具名人群及其存在证据。两者缺一,降级为"待作者确认"。新增整个文件或删除整段实现时一侧天然为空,这时给存在的那一侧加上受影响可达路径的 `file:line` 即可。
- "待作者确认"最多 5 条,按可能的影响等级排序,多出来的只报数量。
- 不要报:PR 之前就存在的问题(严重的单独一句"顺带发现")、lint 和类型检查会抓的问题、风格问题。
- 不要把这些当成"无影响"的证据:作者说"不变"、没有测试引用被删的句子、改动只在内部包。
## 模板逐节核对
输出为中文时节名用下表的译名,其他语言沿用模板原文的节名:
| English | 中文 |
|---------|------|
| Requirement or Bug | 需求或 Bug |
| Bug Reproduction Steps | Bug 复现步骤 |
| Root Cause | 根本原因 |
| Code Changes | 代码变更 |
| Behavior Changes and Affected Users | 行为变化与受影响人群 |
| Checklist | 检查清单 |
旧 PR 若仍用 `Impact Scope` 这一节,按"行为变化与受影响人群"的标准核对。
### 需求或 Bug
- 关联的 issue 是否有效、相关?
- 没有 issue 时,需求是否用一两句话说清楚了?
### Bug 复现步骤
- bug 类 PR:步骤是否清晰、可复现?
- 按步骤能否在 base 分支上确认 bug 存在?
### 根本原因
- bug 类 PR:根因解释是否令人信服?
- 描述的根因与 diff 是否一致?
- 是根本修复还是绕过,是否说清楚了?
### 代码变更
- 描述与实际 diff 是否一致?
- 可视化大纲(diff 块、调用树、文件树)是否准确、有帮助?
- 方案是否合理?有没有更简单的替代?
- 有没有作者漏掉的边界情况?
### 行为变化与受影响人群
- 把第三遍独立列出的清单与作者填的表逐行对比:作者漏列的行为就是 finding;作者写了但你没找到证据的,进"待作者确认"。
- 人群是否具名,还是只写了"部分用户"?
- 写了 `None` 的,证据是否成立?
- 受影响模块与测试覆盖是否与 diff 文件列表一致?有没有带风险的未测路径?
### 检查清单
- 适用的项是否都勾了?
- 标为"不需要"的项,你是否同意?
## 输出
用用户当前使用的语言,按下面的顺序,示例为中文:
```markdown
## 结论
一句话:可合 / 需修改 / 建议阻塞。附 PR 影响等级与改动类型。
## 回归与用户影响
- 改动类型:…
- 影响等级:Lx(广度:…;是否静默:…)
| 行为 | 变化前 | 变化后 | 受影响人群 | 证据 | 等级 | 退路 |
|---|---|---|---|---|---|---|
补救核对:
- 退路开关:…
- changeset 是否点明失去的行为:…
- 老数据与老客户端:…
- guard 测试:…
- 文档:…
待作者确认(最多 5 条):
1. …
## 模板逐节核对
逐节说明是否填写充分,指出缺失、不准确、与 diff 不一致之处。
## 需要修改的项
可执行的列表;没有则写"无"。
```
## 复盘回填
每次线上回归复盘后,把新发现的人群或触发线索补进 `surfaces.md`,并在它的"历史案例"里加一行。清单不更新就会过时。

View file

@ -0,0 +1,129 @@
# 人群与 surface 清单
`review-pr` 第三遍用的仓库专属清单:谁在依赖现有行为,diff 里碰到什么就必须列行为变化。它会过时,每次回归复盘后补一行,见 `SKILL.md` 的"复盘回填"。
## 一、人群:谁在依赖现有行为
### 客户端与入口
| 人群 | 说明 | 契约位置 |
|---|---|---|
| TUI 交互用户 | `kimi` 默认入口 | `apps/kimi-code/src/tui/` |
| print 模式用户 | `kimi -p`,含解析 `--output-format stream-json` 输出的脚本。脚本解析者算二等人群,但输出格式变化必须写进 changeset(#3146) | `apps/kimi-code/src/cli/options.ts` |
| desktop 与 web 用户 | 源码在 code-app 仓库,只消费 kap-server 的 `/api/v1` REST 与 `/api/v1/ws`。本仓 diff 看不到它们的用法,改契约时必须点名让作者去对方仓库核对 | `packages/kap-server/src/routes/`、`packages/kap-server/src/transport/ws/`、`docs/en/reference/server-api.md` |
| VS Code 扩展用户 | 走 SDK 事件适配层,webview 有自己的渲染契约(#3250:v2 不再发 `display` 字段导致卡片空白) | `apps/vscode/` |
| ACP 客户端用户 | Zed 等,`kimi acp`。stdio MCP 是 ACP 的默认传输,客户端会无条件发(#3167);能力矩阵是公开承诺(#3081) | `packages/acp-server/`、`docs/en/reference/kimi-acp.md` |
| SDK 调用方 | `@moonshot-ai/kimi-code-sdk` 的导出面;其中 `KimiForCodingProvider` 走 kosong 的 provider 实现,CLI 与服务端不用 kosong | `packages/node-sdk/src/index.ts`、`packages/node-sdk/package.json` 的 `exports`、`packages/kosong/src/providers/` |
| 远程控制用户 | `kimi web --remote-control`,凭据槽位与 relay 按登录区域选择(#3969) | `packages/remote-control/` |
### provider 方言
| 人群 | 说明 |
|---|---|
| Kimi 官方 | 默认路径,OAuth 托管登录,区域与 relay 差异 |
| `openai` Chat Completions 兼容网关 | 最杂的一群:new-api 等中转、OpenRouter 形态(`reasoning` 字符串与 `reasoning_details` 数组并存,#3900)、只发 `reasoning_content` 的、严格校验历史消息的(#2819)、第三方模型对 `anyOf` 参数的处理(#3383) |
| `anthropic`、`openai_responses`、`google-genai`、`vertexai` | 各自的 thinking、工具调用、usage 字段形态 |
| 自定义模型配置 | `api_key_env`、models.dev catalog 导入、手动配置的 thinking 参数(#3448)、`[secondary_model]` 与 subagent model pool(#3192、#3903) |
代码位置:`packages/agent-core-v2/src/human/llm/requester/bases/`。
### 平台与环境
| 人群 | 已知敏感点 |
|---|---|
| Windows | 深路径与递归监听压力(#3931 的动机)、驱动器根与 UNC(#2876)、IME 组合输入(#3915)、CSI-u 键盘序列 |
| Linux | 无 hardlink 的文件系统(#3535)、根目录海量文件导致的 OOM(#3892) |
| macOS | 默认开发环境,最容易被当成"全体用户" |
| 网络代理 | 后台子 agent 重试(#3721) |
| native 二进制 vs npm 安装 | 启动路径、更新机制不同 |
| 安装渠道 | npm 包、各平台 native 二进制、VS Code 市场包、内置 web 产物,由发布与打包工作流决定,`src/` 一行不动也能丢掉一个平台 |
### git 仓库形态
| 人群 | 已知敏感点 | 契约位置 |
|---|---|---|
| 子模块或 worktree 内启动的用户 | `core.worktree` 已设置;路径含符号链接时(macOS `/tmp`、链接的 home、Windows 映射盘)realpath 与字面路径不一致。#3964 的 git 探针在这里整体失败,已随 #4013 回滚 | `packages/agent-core-v2/src/app/git/gitService.ts` |
| git-lfs、git-crypt 用户 | `.git/config` 里的 filter 驱动带 `required = true`;任何"清空 filter 命令"的加固都会让 `git status` 对已修改的被过滤文件直接 fatal,除非同时清 `required`。#3964 踩过,已随 #4013 回滚 | 同上 |
| 大仓库用户 | 依赖 `core.fsmonitor`;footer 的后台 git 有超时预算,超时后静默当作 clean | `apps/kimi-code/src/utils/git/` |
| 要求签名提交或 husky hooks 的仓库 | 任何自动提交路径(Tower 等)关闭 hooks 或签名都会改变提交结果 | `packages/agent-core-v2/src/features/tower/` |
### 配置状态
| 人群 | 说明 | 契约位置 |
|---|---|---|
| 默认配置用户 | 任何默认值翻转对他们都是行为变更 | `packages/agent-core-v2/docs/config-manifest.toml` |
| experimental flag 用户 | `[experimental]` 与 `KIMI_CODE_EXPERIMENTAL_*`;flag 的 `default` 翻成 true 等于面向全体发布 | `packages/agent-core-v2/src/app/flag/flagRegistry.ts`、各域的 `flag.ts` |
| legacy flag 用户 | `KIMI_CODE_LEGACY_FLAG`(#3820:TUI 与 print 模式静默忽略) | |
| 自定义 agent 用户 | `--agent` 的 `disallowedTools` 等策略(#3417) | |
| 配了 hooks 的用户 | 事件名与载荷是外部脚本的契约;配了 hook 时审批面板不渲染并被静默批准(#3888)、v2 不触发 PreToolUse(#3431) | `packages/agent-core-v2/src/features/externalHooks/internal/types.ts`、`docs/en/customization/hooks.md` |
| skills、plugins、MCP 用户 | 含 stdio MCP、用户级 skill 根目录、`[watch]` 热加载(#3931 关掉默认,#4015 翻回;关掉时连带 AGENTS.md 变更提醒失效,`/reload` 只覆盖 config 与 skills) | `docs/en/customization/` |
| 环境变量用户 | 同一个变量在 TUI、print 模式、kap-server 三个入口要行为一致(#3498:三个入口两种行为) | `docs/en/configuration/env-vars.md` |
| 主题、键位、TUI 模式自定义用户 | `tui.toml` | `docs/en/customization/themes.md`、`docs/en/reference/keyboard.md` |
### 数据年代
| 人群 | 说明 | 契约位置 |
|---|---|---|
| 旧版本写的会话 | wire 日志、turn 编号、压缩后的 transcript(#3561、#3866、#3922);新版本能否读、回滚后能否读 | `packages/agent-core-v2/docs/wire-manifest.d.ts`、`packages/agent-core-v2/docs/state-manifest.d.ts` |
| `kimi migrate` 迁来的会话 | 从 `~/.kimi/` 迁到 `~/.kimi-code/` | `packages/migration-legacy/` |
| 搜索索引 | minidb 快照与 WAL | `packages/minidb/` |
| 后台任务与 cron 持久化 | 非正常退出后的恢复(#3924) | |
| 目录布局 | 任何读写 `~/.kimi-code/` 的代码 | `docs/en/configuration/data-locations.md` |
### 外部自动化
| 人群 | 契约 |
|---|---|
| 解析 `stream-json` 的脚本 | 事件形态与顺序 |
| hook 脚本 | 事件名、载荷字段、返回值语义 |
| `kimi export` 的消费者 | 导出格式 |
| 关闭遥测的用户 | `KIMI_DISABLE_TELEMETRY` 在所有入口生效 |
### 模型行为人群
prompt 文本改动影响全体用户,且没有测试能证明"无影响"。已知依赖具体句子的人群:
- 依赖"不碰工作目录外文件"的(#3879 删除了这条规则)。
- 依赖"cwd 即项目根"的(#3929 删除了这条断言)。
- plan 模式提醒节奏(#3489)。
基于外部基准分析做的 prompt 改动,本质是把一个人群的收益换成另一个人群的损失,必须写明两边各是谁。
## 二、触发线索:diff 里碰到就必须列行为变化
| diff 里出现 | 代表的 surface | 必做的检查 |
|---|---|---|
| `packages/agent-core-v2/src/app/agentProfileCatalog/system.md`,以及 `packages/agent-core-v2/src/**/*.md`(工具描述、提醒、overlay、内置 skill) | 模型行为 | 每删或改一句单独成行:这句改动前约束了什么行为,谁依赖,现在由什么来约束 |
| `packages/agent-core-v2/docs/config-manifest.toml`(由 `src/app/config/configSectionContributions.ts` 生成,`test/app/config/configManifest.test.ts` 守护同步) | 配置键、默认值、校验 | 默认翻转与校验收紧必列;改了 manifest 没改 `docs/en/configuration/config-files.md` 视为文档过时 |
| `packages/agent-core-v2/src/**/flag.ts`、`packages/agent-core-v2/src/app/flag/flagRegistry.ts` | experimental flag | `default` 翻转等于面向全体发布,按行为变更处理 |
| `packages/agent-core-v2/src/human/utils/watch.ts`(热加载开关)以及任何模块级默认常量、`?? true` / `?? false` 兜底被配置键覆盖的地方 | 默认值来源 | 默认翻转必列;退路的 config 路径要有 guard 测试,不能只靠 env;退路是否依赖 ConfigService 先于消费方构造 |
| `packages/agent-core-v2/docs/wire-manifest.d.ts`、`packages/agent-core-v2/docs/state-manifest.d.ts` | 磁盘会话格式 | 旧会话能否读、回滚到上一版能否读、有无迁移 |
| `packages/kap-server/test/__snapshots__/apiSurface.snapshot.test.ts.snap`、`packages/kap-server/src/routes/`、`packages/kap-server/src/transport/ws/` | desktop、web、VS Code 的服务端契约 | 消费方在仓库外,点名让作者去 code-app 核对;上一版客户端连新服务端是否仍可用 |
| `packages/node-sdk/src/index.ts`、`packages/node-sdk/package.json` | SDK 导出面 | 删除或改签名即破坏性变更 |
| `packages/klient/src/` | SDK 与 ACP 下面的客户端门面契约 | 只改 klient 的 PR 碰不到 node-sdk 导出面,按 SDK 调用方与 ACP 客户端两个人群核行为变化 |
| `packages/transcript/src/contract/` | kap-server 发给 desktop、web、VS Code 的 transcript 载荷契约 | 消费方在 code-app,点名让作者去核;上一版客户端能否解析新载荷 |
| `.github/workflows/release.yml`、`_native-build.yml`、`manual-native-bundle.yml`、`vscode-publish.yml`,`apps/kimi-code/scripts/native/`、`apps/kimi-code/scripts/check-web-assets.mjs` | 发布产物 | 按安装方式与平台核:npm 包内容、各平台 native 二进制、VS Code 市场包、内置 web 产物是否仍齐全 |
| `packages/acp-server/` | ACP 客户端 | 对照 `docs/en/reference/kimi-acp.md` 的能力矩阵逐项核对 |
| `apps/kimi-code/src/cli/` | 命令行参数、子命令、`--output-format` | 对照 `docs/en/reference/kimi-command.md` |
| `packages/agent-core-v2/src/features/externalHooks/` | hook 事件与载荷 | 对照 `docs/en/customization/hooks.md` 的事件参考 |
| `packages/agent-core-v2/src/human/llm/requester/bases/` | provider 方言分支 | 枚举每种上游载荷形态改动前后各走哪条分支,尤其是多个字段并存的网关 |
| `packages/agent-core-v2/src/app/git/`、`apps/kimi-code/src/utils/git/` | 后台 git 的调用方式、config 覆盖、超时 | 对照"git 仓库形态"人群逐行核:前置探针失败是否让整个后台 git 静默不可用;覆盖的 config 键是否有 `required`、`gpgSign`、`hooksPath` 这类会把"禁用"变成"失败"的键;Windows 用例是否全部 skip |
| `packages/migration-legacy/`、`packages/minidb/`、任何读写 `~/.kimi-code/` 布局的代码 | 数据年代 | 老数据是否仍可读、可迁移 |
| 任何环境变量读取点的新增、删除或语义变化,不限写法(`process.env.X`、`process.env['X']`、动态键、helper)也不限 `KIMI_` 前缀 | 环境变量 | 对照 `docs/en/configuration/env-vars.md` 的全部条目;TUI、print 模式、kap-server 三个入口是否一致 |
| `packages/agent-core-v2/src/app/scopes.ts`、`packages/agent-core-v2/src/features/featureAssemblyService.ts`、config ready 相关 | 启动顺序与生命周期 | 谁依赖原来的顺序;#3471 在合入 34 分钟后被 #3486 整体 revert |
| `docs/en/**`、`docs/zh/**` 的 reference、configuration、customization 页 | 公开承诺 | 改了行为没改文档,或改了文档没改行为,都要指出 |
| 测试里把旧断言改成新行为 | 行为变化的直接证据 | 逐条对应到行为变化清单 |
## 三、历史案例:用来校准等级
| 类型 | 案例 | 当时漏掉的问题 | 事后等级 |
|---|---|---|---|
| 方言分支收窄 | #3492 引入,#3900 用户报告,#3910 修复 | PR 正文写明"只有没有数组时才读字符串",没人问谁会两个字段同时发 | L2 无退路,输入被静默丢弃升 L3,openai 兼容网关人群 |
| 默认值翻转 | #3931,五天后 #4015 翻回默认开 | changeset 只写新默认,没写运行中编辑 config、skills、AGENTS.md、agent 文件、mcp.json 不再自动生效;AGENTS.md 变更提醒随之失效,`/reload` 与 `/new` 不重读 AGENTS.md;review 未覆盖行为变化 | L1 有退路,但改了文件不生效也无任何信号,静默升 L2;changeset 没点明失去的行为,config 路径的退路无 guard 测试 |
| prompt 删句子 | #3879、#3929 | "没有测试引用这句"被当成无影响证据 | L2 无退路,全体用户;行为公开可见,不算静默 |
| 重构丢功能 | #2961 引入,#3081、#3167 用户报告,#3183 修复 | 重构删掉了 ACP 本地执行兜底与 stdio MCP 接受,文档承诺仍在 | L3,功能整体不可用,ACP 人群,报错响亮但无退路 |
| 移植漏项 | #3498、#3098、#3250、#3431、#3820 | v1 路径有、v2 路径没有:env 变量、上下文用量、卡片字段、hook、legacy flag;没人列过旧路径功能清单 | L2 无退路,配置被静默忽略升 L3 |
| 修复引入时序变化 | #3471 合入后 34 分钟被 #3486 revert | 延迟装配改变了启动顺序 | 全体用户 |
| 输出契约无声变化 | #3146 | headless 事件输出变了,没有 changelog | L2,脚本解析者 |
| 静默批准 | #3888 | 配了 hook 时审批面板不渲染,待审调用被静默批准 | L3,安全边界 |
| 安全收紧连带 | #3964(2.1.0),两天后 #4013 整体回滚 | 盲审列出四条:后台 git 探针在子模块 + 符号链接路径下整体失败;filter 驱动 `required = true` 仓库 `git status` fatal;print、ACP、SDK 无信任入口导致 `additional_dir` 静默为空;`~` 条目让 local.toml 整文件失效并静默退出。PR 正文未列任何人群 | L3 候选,四条均无退路、changeset 未提;回滚后代码已不在 main |

View file

@ -126,7 +126,12 @@ Public-text rule: do not copy real internal endpoints, key names, account names,
### 4. Merge, Deduplicate, And Classify Entries
Before classifying, merge related entries and drop redundant ones from the user-facing changelog:
First, count the stripped upstream entries in the version range being synced. The count decides how much curation happens before the human review checkpoint:
- **10 entries or fewer: list everything and let the user decide.** Classify every entry into its section and list them all — do not fold, merge, or drop entries on your own, and do not write a catch-all line. At the human review checkpoint (step 8), present the full list with advisory notes (which entries look low-signal under the two gates below, and why) so the user decides what stays, what merges, and what folds.
- **More than 10 entries: curate first, then review.** Merge related entries and fold low-signal ones into the catch-all line before writing the page, using the rules below. The reviewer still owns the final cutoff — surface the borderline calls instead of resolving them silently.
The rules below are the shared curation standard: they drive the curator's fold/merge decisions when there are more than 10 entries, and they drive the advisory notes when there are 10 or fewer.
- **Curate for end users: collapse low-signal entries into one catch-all line.** The docs changelog is the only curated, user-facing outlet; the full entry list always remains in the upstream package changelog, so hiding detail here loses nothing. Apply two gates to every candidate entry. Gate 1, the reader-action test: **after reading this, is there something the reader must do, or something they must re-evaluate?** Gate 2, the channel test: **is the changelog the only channel that can deliver this?** The changelog is the channel of last resort — when the product itself surfaces the information in context, at the moment of need, to exactly the affected users, the entry is redundant no matter how real the improvement is. "Surfaced" means pushed into the user's path, not merely present on screen: an event-triggered card, prompt, or post-install screen forces the encounter, while a toggle, menu item, command, or settings page only waits to be found. Users do not explore — a capability that lives only in ambient UI is effectively undiscoverable, so the changelog must announce it. What in-product surfacing cannot deliver: hidden controls (env vars, config keys, opt-out flags nobody would find unprompted), invalidations of existing habits or expectations (in-product discovery comes as confusion), and capabilities users would not know to seek. An entry that fails either gate folds. Anchor both gates to the changelog's reader, never to the bug's victim: someone who hit a loud failure does not need the changelog to confirm the fix — the product working again is the notification — and a reader who never hit it gets nothing from the entry.
- `Features`: keep when users would try it or must react to it — new capabilities create demand readers did not know to seek. Collapse only behavior that takes effect solely behind an experimental flag.
@ -324,7 +329,7 @@ Check:
- Each version has the same section set and order on both pages.
- Each section has the same number of entries on both pages.
- Within each section, the most valuable, obvious, and larger entries appear before smaller or narrower entries.
- Low-signal entries were collapsed into the single catch-all line, placed last under `Bug Fixes` — or under `Polish` when nothing folded is a fix (both the reader-action test and the channel test applied); the catch-all wording matches what was folded and never claims fixes that did not happen; section sizes stay within the density defaults (about 2 Polish, 3 Bug Fixes) unless extra qualifying entries were deliberately kept and flagged for review. The catch-all line ends with the upstream changelog pointer (file link, no version anchor).
- Entry count decided the curation level: a version range with 10 or fewer upstream entries lists everything classified, with no catch-all line (fold/merge decisions deferred to the review checkpoint); with more than 10, low-signal entries were collapsed into the single catch-all line, placed last under `Bug Fixes` — or under `Polish` when nothing folded is a fix (both the reader-action test and the channel test applied); the catch-all wording matches what was folded and never claims fixes that did not happen; section sizes stay within the density defaults (about 2 Polish, 3 Bug Fixes) unless extra qualifying entries were deliberately kept and flagged for review. The catch-all line ends with the upstream changelog pointer (file link, no version anchor).
- PR links and commit hashes were stripped.
- No `Thanks ...!` credit remains (remove it every time).
- Real internal identifiers were replaced with neutral placeholders.
@ -353,7 +358,7 @@ If the user chooses review:
git diff docs/en/release-notes/changelog.md docs/zh/release-notes/changelog.md
```
2. Summarize synced versions, section counts, and anything that needed manual classification. List every entry folded into a catch-all line (short titles, one line each), any section that exceeds the density defaults, and every borderline call flagged during curation — the reviewer cannot own a cutoff they cannot see.
2. Summarize synced versions, section counts, and anything that needed manual classification. When the synced version range had 10 or fewer upstream entries and everything was listed, present the full entry list with advisory notes (which entries look low-signal and why) and ask the user to decide what stays, what merges, and what folds. When entries were folded into a catch-all line (more than 10 upstream entries), list every folded entry (short titles, one line each), any section that exceeds the density defaults, and every borderline call flagged during curation — the reviewer cannot own a cutoff they cannot see.
3. Tell the user to reply when they are done reviewing, or to ask for edits.
4. Do **not** commit, push, or open a PR until the user explicitly says review is complete, or asks to proceed.
@ -434,6 +439,7 @@ Return the PR URL to the user when done.
- Never edit upstream `apps/kimi-code/CHANGELOG.md`.
- Do not backfill unreleased `.changeset/*.md` drafts into the docs site.
- If upstream wording is wrong, leave upstream alone and fix it in a future changeset.
- A version range with 10 or fewer upstream entries is listed in full; fold/merge/drop decisions belong to the user at the review checkpoint, not the curator.
- Always sync on a `docs/changelog-sync-*` branch and open a PR; never push changelog docs sync directly to `main`.
- Wait for the human review checkpoint before committing, pushing, or opening a PR.
@ -446,7 +452,8 @@ Return the PR URL to the user when done.
| Leaving the `Thanks ...!` credit in docs | Remove it every time, including the multi-author form |
| Leaving near-duplicate micro-tweaks as separate bullets | Merge small tweaks to the same surface into one higher-level entry (e.g. composer height + font → composer's default styling) |
| Listing many narrow fixes to the same surface as separate bullets | When three or more fixes target the same UI area or the same class of problem, merge them into one higher-level fix entry; keep genuinely distinct or high-value fixes standalone |
| Listing low-signal fixes or internal changes as standalone bullets | Collapse them into the single catch-all line (`Fix several known issues.`) placed last under Bug Fixes; treat the section-size defaults (about 2 Polish, 3 Bug Fixes) as a density guard, not a quota |
| Listing low-signal fixes or internal changes as standalone bullets when curating (>10 entries) | Collapse them into the single catch-all line (`Fix several known issues.`) placed last under Bug Fixes; treat the section-size defaults (about 2 Polish, 3 Bug Fixes) as a density guard, not a quota |
| Folding, merging, or dropping entries on your own when the version range has 10 or fewer upstream entries | List everything classified, with no catch-all line, and let the user decide at the review checkpoint |
| Folding a qualifying entry just to hit the section-size default | The defaults are density guards; keep entries that genuinely pass the reader-action test and flag the overflow for the human reviewer |
| Keeping a fix because it was severe or hard-won | Severity makes the announcement redundant — the fix itself notifies whoever was hit; keep only behavior-change fixes and retrospective notices with a concrete, locatable action |
| Keeping an improvement the product surfaces in context (recovery cards, post-install guidance, progress displays) | The product is the better channel — right users, moment of need; fold it (channel test) |

View file

@ -0,0 +1,140 @@
---
name: write-pr
description: 在 kimi-code 仓库里创建或更新 PR 时使用:如何把 PR 模板的每一节写得简洁、便于 reviewer 理解,包括"行为变化与受影响人群"表。
---
# 写 PR 描述
为当前分支创建或更新 PR,描述要让 reviewer 明白这个改动为什么存在、实现长什么样、现有用户会失去什么。
## 工作流
1. 读 PR 模板:
`Read(.github/pull_request_template.md)`
2. 找到或创建 PR:
- 先查当前分支有没有 PR:`gh pr view --json url,number,title,state 2>/dev/null`。
- 没有的话,看 `git status --short --branch` 和当前分支上的提交。
- 提交剩余改动,带 upstream 推送分支,用 `gh pr create` 创建 PR。
- 遵守仓库的 git 安全规范。
3. 收集解释改动所需的上下文:
- 读关联的 issue 和相关任务产物。
- 读完整 diff(`git diff main...HEAD`)和足够的周边代码,理解行为与归属。
- PR 已存在时,用 `gh pr view` 拿元数据和改动文件列表。
4. 按模板各节写描述。描述用用户当前使用的语言,行为变化表也一样;只有三样固定:PR 标题保持英文 Conventional Commit,changeset 保持英文(见 `gen-changesets` skill),节标题沿用模板原文。
- **Requirement or Bug**:一句话,或 `Resolve #<number>`。不要多写。
- **Bug Reproduction Steps**:只有 bug 类 PR 需要;feature 写 `N/A`。步骤已在 issue 里的写 `See linked issue`。
- **Root Cause**:只有 bug 类 PR 需要;feature 写 `N/A`。说明根因,以及这是根本修复还是绕过。
- **Code Changes**:能用可视化大纲说清楚的就不要写散文,见"代码变更的可视化大纲"。
- **Behavior Changes and Affected Users**:先填行为变化表,再列受影响模块与测试覆盖,见"行为变化与受影响人群"。
- **Checklist**:勾上所有适用的项。
5. 发布描述:
- 先存到临时文件,再 `gh pr edit <number> --body-file <path>` 或 `gh pr create --body-file <path>`。
- 确认更新成功。
## 行为变化与受影响人群
这一节回答一个问题:合入之后,现有用户会失去什么。这个仓库过去的回归大多来自没人回答这个问题,而不是逻辑错误。
判据:**改动前能工作的任何输入(配置键、环境变量、命令行参数、provider 响应形态、旧版本写的会话数据、客户端请求、hook 载荷)改动后必须行为不变,除非这里明确声明了变化并给出退路。**
写法:
1. 列出 diff 改变的每一个可观测行为,一行一个。包括你认为"不变"但分支条件挪动了的:新增的条件会不会先于旧条件命中既有输入;删除或收窄的分支改动前谁在走。内部包会打进 CLI 发布包,"内部"不等于用户无感。表格用 PR 描述的语言,下面的示例用英文只是示意形状:
| Behavior | Before | After | Who relies on the old behavior | Escape hatch |
|---|---|---|---|---|
| reasoning parsing when `reasoning_details` is an array | string `reasoning` also read | string ignored | OpenAI-compatible gateways that send both (OpenRouter dialect) | none |
2. 人群要具名,不要写"部分用户"。从 `.agents/skills/review-pr/surfaces.md` 里取:客户端(TUI、print 模式、desktop 与 web、VS Code、ACP、SDK)、provider 方言、平台、配置状态、数据年代、外部脚本。
3. 改了 prompt 文本(system prompt、工具描述、提醒)的,每一句单独成行,写清这句改动前约束了什么行为、谁依赖、现在由什么来约束。"没有测试引用这句"不是无影响的证据。
4. 替换或绕过旧路径的(移植、runtime binding、协议替换),额外列出旧路径的功能清单:它认哪些环境变量、有哪些兜底、接受哪些输入,以及每一项在新路径里的位置。
5. 确实没有可观测变化的,写 `None`,并说明证据:哪些分支、默认值、契约文件没动。
6. 表后面列受影响模块与每一行对应的测试覆盖。默认翻转或删除行为的,必须有一条测试把未被改动的人群的旧行为钉住,并且 changeset 要写明用户失去了什么,见 `gen-changesets` skill;没有退路的,在 PR 里请维护者显式拍板。
## 代码变更的可视化大纲
优先用结构化视图,少用散文。用能说清实现的最小组合,没变的类别不要列。
逻辑或算法变化用伪代码 diff:
```diff
on(save)
- write content
+ if content is unchanged
+ return cached result
+ write new content
+ invalidate cache
```
运行时控制流用调用树 diff:
```diff
submitForm
createSession
persistPrompt
+ expandSkillMention
launchAgent
- navigateToSession
+ navigateToSession
+ subscribeToEvents
```
文件职责变化用浅层文件树 diff:
```diff
src/
├── commands/
+│ └── show-me.ts # expands the slash command
├── sessions/
-└── transport.ts
+└── transport/
+ ├── client.ts
+ └── stream.ts
```
组件或 UI 结构变化用树 diff:
```diff
<SessionPage>
useSessionEvents()
<SessionToolbar>
+ <RunSkillButton />
<SessionTimeline>
+ <SkillResultCard />
```
组件交互、控制流或数据流用 Mermaid,解释 bug 机制时尤其有用:
```mermaid
sequenceDiagram
participant User
participant UI
participant Daemon
User->>UI: choose command
UI->>Daemon: send expanded prompt
Daemon-->>UI: stream result
```
关键数据结构或类型变化用对应语言的代码块:
```ts
interface SessionEvents {
onTurnStart(cb: (turn: Turn) => void): void;
onTurnEnd(cb: (turn: Turn) => void): void;
}
```
可视化大纲的规则:
- 重点是"变了什么"且周边形状已存在时,用 `diff` 块。
- 大部分是新内容,或 diff 记法会掩盖归属和顺序时,用对应语言或 `text` 块给出完整目标形状。
- 按最容易理解的顺序讲:先文件还是先数据结构,哪个合适用哪个。
- 像一个人对另一个人讲话:简单、连贯、简洁。

View file

@ -23,7 +23,7 @@ For any list dialog, selector, input box, or status/toggle list, the interaction
- `editor-keyboard.ts` — editor keyboard handling, exit shortcuts, external editor, clipboard image.
- `auth-flow.ts` — login/auth orchestration (`refreshConfigAfterLogin`, etc.).
- `src/tui/commands/` — slash-command declaration, parsing, ordering, and dynamic skill-command generation. Parsing and types only; execution is dispatched from `KimiTUI`'s slash-command handler section, and complex execution sinks into `utils` or focused components.
- `src/tui/components/` — pi-tui components by UI type: `chrome/` (footer, todo, welcome, loader, device code), `dialogs/` (selectors, approval/question panels, settings popups that replace the editor), `editor/` (input box + mention provider), `media/` (image, diff, code highlight), `messages/` (transcript blocks + tool-renderers), `panes/` (activity, queue).
- `src/tui/components/` — pi-tui components by UI type: `chrome/` (footer, todo, welcome, loader, device code), `dialogs/` (selectors, approval/question panels, settings popups that replace the editor), `editor/` (input box + mention provider), `media/` (image, diff, code highlight), `markdown/` (the app's Markdown wrapper and mermaid art), `messages/` (transcript blocks + tool-renderers), `panes/` (activity, queue).
- `src/tui/reverse-rpc/` — adapts SDK approval/question callbacks into UI panel data and the user's choice back into an SDK response.
- `src/tui/theme/` — themes, color tokens, style helpers, pi-tui markdown theme, terminal-background detection. The single source of truth for color.
- `src/tui/utils/` — TUI-only utilities (need `TUIState` or a component). App-wide, UI-independent helpers go in `src/utils/`.
@ -68,7 +68,7 @@ Themes are managed centrally under `src/tui/theme/`:
- `bundle.ts` — packs `colors`, `styles`, `markdownTheme` into a `KimiTUIThemeBundle`.
- `index.ts` / `detect.ts` — theme type and auto/dark/light resolution.
> **Keep the color-token set in sync.** `ColorPalette` in `colors.ts` is the source of truth for color tokens. When you add, rename, or remove one, update its mirrors in the same change: the custom-theme JSON schema (`apps/kimi-code/src/tui/theme/theme-schema.json`), the token tables in the custom-theme docs (`docs/en/customization/themes.md` and `docs/zh/customization/themes.md`), and the token table in the `custom-theme` built-in skill (`packages/agent-core/src/skill/builtin/custom-theme.md`).
> **Keep the color-token set in sync.** `ColorPalette` in `colors.ts` is the source of truth for color tokens. When you add, rename, or remove one, update its mirrors in the same change: the custom-theme JSON schema (`apps/kimi-code/src/tui/theme/theme-schema.json`), the token tables in the custom-theme docs (`docs/en/customization/themes.md` and `docs/zh/customization/themes.md`), and the token table in the `custom-theme` built-in skill (`packages/agent-core-v2/src/features/skill/catalog/builtin/custom-theme.md`).
Apply / switch flow:

View file

@ -15,13 +15,10 @@ Current publishable packages:
All other workspace packages are private internal packages, are not published to npm, and are excluded via `ignore` in `.changeset/config.json`:
- `@moonshot-ai/agent-core`
- `@moonshot-ai/kaos`
- `@moonshot-ai/kimi-code-oauth`
- `@moonshot-ai/kimi-telemetry`
- `@moonshot-ai/kosong`
- `@moonshot-ai/migration-legacy`
- `@moonshot-ai/protocol`
- `@moonshot-ai/vis`
- `@moonshot-ai/vis-server`
- `@moonshot-ai/vis-web`
@ -102,23 +99,27 @@ Commit messages must follow Conventional Commit style. Do not include any author
### 4. CI generates the release PR
Once the changeset file is merged into `main`, `.github/workflows/release.yml` uses `changesets/action@v1` to create or update a release PR.
Changesets accumulate on `main`. Create `release/<cycle>` from the selected commit; pushes to that branch use `changesets/action@v1` to create or update its release PR. Manual **Release** runs on a release branch only prepare the PR. The workflow explicitly dispatches CI for the generated version branch.
The release PR runs:
- `pnpm changeset version`: bumps publishable package versions and updates changelogs;
- Deletes the consumed `.changeset/*.md` files;
- Uses the title `[CI]: Release packages`.
- Uses the title `ci: release packages`.
### 5. Merge the release PR
Once the release PR is merged into `main`, the same workflow runs:
Review the version PR, latest CI and CLI/extension pre-changelog together. Once the matching version PR is merged into `release/<cycle>`, publication waits for that exact commit’s push CI. Ordinary pushes do not publish. The existing publication steps then run:
- `pnpm install --frozen-lockfile`
- `pnpm build`
- `pnpm changeset publish`
The packages are then published via npm Trusted Publishing, and a GitHub Release is created.
The packages are then published via npm Trusted Publishing, and a GitHub Release is created. CLI native builds still depend on Changesets reporting a newly published CLI package; npm-succeeded/native-failed whole-run recovery is not changed by this migration.
VS Code uses the same approved release commit and CI gate, publishing only when the extension version changed in that push. It retains its existing build and marketplace checks. It no longer publishes on main pushes or through a standalone manual entry. The documentation workflow is dispatched on main after CLI artifacts are uploaded; its deployment result is tracked separately. CDN remains manual.
Migration: merge the main infrastructure PR first to disable the old publisher, then the release infrastructure PR. These PRs do not publish. Close the obsolete main version PR separately. After the actual release, synchronize versions, changelogs, lockfile and consumed changeset removals back to main, preserving later main work. Main synchronization does not publish npm or VS Code. Do not change Desktop's submodule pointer as part of this step.
## Manual Publishing (Not Recommended)
@ -143,9 +144,9 @@ The root-level `pnpm run publish` first runs typecheck, lint, sherif, test, buil
- Every PR that affects publishable-package behavior or public API should include a corresponding changeset.
- Changes under `plugins/` (the bundled official plugins such as `kimi-datasource`) do **not** need a changeset: each plugin carries its own version in `kimi.plugin.json` and `plugins/marketplace.json` and is distributed via the marketplace CDN, separately from the `@moonshot-ai/kimi-code` npm package.
- Changeset files must be committed to the repository — release PRs are only triggered after they're merged.
- Release PRs require human review and merge; they will not publish automatically.
- Release PRs require human review and approval. They do not publish before merge; merging the approved PR automatically publishes after its commit passes CI.
- Do not add release changesets for private internal packages; only select `@moonshot-ai/kimi-code` and `@moonshot-ai/kimi-code-sdk`.
- If a change in an underlying internal package alters user-visible behavior or public API of a publishable package, add a changeset to the affected publishable package. For example, when a bug fixed in `@moonshot-ai/agent-core` resolves an issue CLI users encounter, add a changeset to `@moonshot-ai/kimi-code` describing the user-visible fix.
- If a change in an underlying internal package alters user-visible behavior or public API of a publishable package, add a changeset to the affected publishable package. For example, when a bug fixed in `@moonshot-ai/kosong` resolves an issue CLI users encounter, add a changeset to `@moonshot-ai/kimi-code` describing the user-visible fix.
- `@moonshot-ai/kimi-code` is the official CLI package name; after a global install it provides the `kimi` command.
- Make sure each publishable package on npm has a Trusted Publisher configured.

View file

@ -0,0 +1,5 @@
---
"@moonshot-ai/kimi-code": minor
---
Allow expanding thinking during streaming with Ctrl-O

View file

@ -0,0 +1,5 @@
---
"@moonshot-ai/kimi-code": patch
---
Fix missing dynamically loaded MCP tools in the first conversation turn.

View file

@ -0,0 +1,5 @@
---
"@moonshot-ai/kimi-code": patch
---
Update cross-tool imports for custom homes, instruction duplicate checks, project skills, and MCP settings; stop importing standalone `.claude/AGENTS.md`, project `.codex/AGENTS.md`, `.codex/CLAUDE.md`, and loose skill files, which can still be copied manually.

View file

@ -0,0 +1,5 @@
---
"@moonshot-ai/kimi-code": minor
---
Sessions in web and desktop now unload from memory after 30 minutes idle and resume transparently on next access.

View file

@ -0,0 +1,5 @@
---
"@moonshot-ai/kimi-code": minor
---
Plan mode now starts only when you turn it on, and every plan waits for your review: the agent can no longer enter Plan mode by itself, Never Ask no longer approves plans automatically, and `kimi -p` skips `default_plan_mode` and cannot approve the plan of a session that is already in Plan mode.

View file

@ -0,0 +1,5 @@
---
"@moonshot-ai/kimi-code": minor
---
Add `/provider refresh [providerId]` to re-fetch provider model lists at runtime; unknown `/provider` subcommands now show a usage hint instead of opening the manager.

View file

@ -0,0 +1,5 @@
---
"@moonshot-ai/kimi-code": patch
---
Speed up session resume for long conversations.

View file

@ -0,0 +1,5 @@
---
"@moonshot-ai/kimi-code": minor
---
Raise Tower's default agent concurrency limit from 16 to 256, support the existing `max_running_tasks` limit and per-spawn model selection, and reduce lock contention during inbox, review, and status processing.

View file

@ -0,0 +1,5 @@
---
"@moonshot-ai/kimi-code": patch
---
Fix the conversation view freezing at an old point after restarting the app when a turn had been interrupted; interrupted turns are now marked instead of shown as completed.

View file

@ -6,24 +6,40 @@ External PRs are accepted for approved bug fixes only: link an issue that a main
See https://github.com/MoonshotAI/kimi-code/blob/main/CONTRIBUTING.md for more.
-->
## Related Issue
## Requirement or Bug
<!-- Link the issue this change came from. External PRs must link an issue approved by a maintainer (an `/approve` comment) — PRs without one may be closed. -->
<!-- If there's an issue, write Resolve #(issue_number).
If it's a requirement, describe it briefly in plain language (under 100 characters). -->
Resolve #(issue_number)
## Bug Reproduction Steps
## Problem
<!-- Required for bug PRs only; write N/A for feature PRs.
Prefer writing in the issue and linking here; if no issue exists, write directly. -->
<!-- What user need or limitation does this address? If the linked issue already covers this, write "See linked issue". -->
## Root Cause
## What changed
<!-- Required for bug PRs only. Explain the root cause.
State whether this is a fundamental fix or a workaround. -->
<!-- What did you implement, and why does this approach fit Kimi Code? -->
## Code Changes
<!-- Describe the code changes in plain, easy-to-understand language for the reviewer. -->
## Behavior Changes and Affected Users
<!-- List every observable behavior this PR changes, one row each, including behavior you
consider "unchanged" whose branch conditions moved, and prompt-text edits sentence by sentence.
| Behavior | Before | After | Who relies on the old behavior | Escape hatch |
Name affected users concretely (client, provider dialect, platform, config state, data written
by older versions, external scripts); see .agents/skills/review-pr/surfaces.md.
Write "None" with evidence if nothing observable changes.
Then list affected modules and the test coverage for each row. -->
## Checklist
- [ ] I have read the [CONTRIBUTING](https://github.com/MoonshotAI/kimi-code/blob/main/CONTRIBUTING.md) document.
- [ ] I have linked a related issue (external PRs: the issue must have a maintainer's `/approve`).
- [ ] I have linked a related issue (external PRs: issue must have a maintainer's `/approve`).
- [ ] I have added tests that prove my feature works.
- [ ] The behavior-change table above is complete, and every removed behavior or flipped default is named in the changeset and either has an escape hatch or was explicitly approved by a maintainer in this PR.
- [ ] Ran `gen-changesets` skill, or this PR needs no changeset.
- [ ] Ran `gen-docs` skill, or this PR needs no doc update.

View file

@ -18,6 +18,11 @@ on:
required: false
type: boolean
default: false
sign-windows:
description: 'Whether to sign Windows builds with Azure Artifact Signing (requires AZURE_* secrets and AZURE_TRUSTED_SIGNING_* variables)'
required: false
type: boolean
default: false
secrets:
APPLE_CERTIFICATE_P12:
required: false
@ -29,6 +34,12 @@ on:
required: false
APPLE_NOTARIZATION_ISSUER_ID:
required: false
AZURE_TENANT_ID:
required: false
AZURE_CLIENT_ID:
required: false
AZURE_CLIENT_SECRET:
required: false
permissions:
contents: read
@ -96,6 +107,14 @@ jobs:
- name: Build native executable (local profile)
if: '!(runner.os == ''macOS'' && inputs.sign-macos)'
env:
KIMI_AZURE_TRUSTED_SIGNING: ${{ runner.os == 'Windows' && inputs.sign-windows && 'true' || 'false' }}
AZURE_TRUSTED_SIGNING_ENDPOINT: ${{ vars.AZURE_TRUSTED_SIGNING_ENDPOINT }}
AZURE_TRUSTED_SIGNING_ACCOUNT_NAME: ${{ vars.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }}
AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME: ${{ vars.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
run: pnpm --filter @moonshot-ai/kimi-code run build:native:sea
- name: Notarize macOS binary

View file

@ -5,11 +5,27 @@ on:
push:
branches:
- main
- 'release/*'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}-${{ startsWith(github.ref, 'refs/heads/release/') && github.sha || '' }}
cancel-in-progress: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
jobs:
release-workflow-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
- run: node --test scripts/release-trigger.test.mjs
build:
runs-on: ubuntu-latest
@ -141,10 +157,10 @@ jobs:
- run: pnpm install --frozen-lockfile
- name: Typecheck
run: |
pnpm dlx --package @typescript/native-preview@beta tsgo --version
pnpm exec tsc --version
for config in packages/*/tsconfig.json apps/kimi-code/tsconfig.json; do
echo "Typechecking ${config}"
pnpm dlx --package @typescript/native-preview@beta tsgo -p "${config}" --noEmit
pnpm exec tsc -p "${config}" --noEmit
done
- name: Typecheck VS Code extension
run: pnpm --filter kimi-code run typecheck

View file

@ -13,9 +13,13 @@ jobs:
upload-artifact-prefix: kimi-code-native
retention-days: 3
sign-macos: true
sign-windows: true
secrets:
APPLE_CERTIFICATE_P12: ${{ secrets.APPLE_CERTIFICATE_P12 }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_NOTARIZATION_KEY_P8: ${{ secrets.APPLE_NOTARIZATION_KEY_P8 }}
APPLE_NOTARIZATION_KEY_ID: ${{ secrets.APPLE_NOTARIZATION_KEY_ID }}
APPLE_NOTARIZATION_ISSUER_ID: ${{ secrets.APPLE_NOTARIZATION_ISSUER_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}

View file

@ -2,16 +2,88 @@ name: Release
on:
push:
branches:
- main
branches: ['release/*']
workflow_dispatch:
concurrency: ${{ github.workflow }}-${{ github.ref }}
concurrency:
group: release-${{ github.ref }}-${{ github.sha }}
cancel-in-progress: false
jobs:
version:
if: github.repository_owner == 'MoonshotAI' && startsWith(github.ref, 'refs/heads/release/')
concurrency:
group: release-version-${{ github.ref }}
cancel-in-progress: false
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
actions: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
cache: pnpm
- run: pnpm install --frozen-lockfile
- uses: changesets/action@v1
id: version
with:
version: pnpm run version:release
commit: 'ci: release packages'
title: 'ci: release packages'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check version PR
if: steps.version.outputs.pullRequestNumber != ''
env:
GH_TOKEN: ${{ github.token }}
VERSION_BRANCH: changeset-release/${{ github.ref_name }}
run: gh workflow run ci.yml --ref "$VERSION_BRANCH"
candidate:
if: github.repository_owner == 'MoonshotAI' && github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/')
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: read
pull-requests: read
actions: read
checks: read
outputs:
publish: ${{ steps.trigger.outputs.publish }}
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.sha }}
- uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
- name: Wait for merged version commit CI
id: trigger
env:
GH_TOKEN: ${{ github.token }}
run: node scripts/release-trigger.mjs
vscode:
needs: candidate
if: needs.candidate.outputs.publish == 'true'
permissions:
contents: read
uses: ./.github/workflows/vscode-publish.yml
secrets:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
OVSX_PAT: ${{ secrets.OVSX_PAT }}
release:
name: Release
runs-on: ubuntu-latest
if: github.repository_owner == 'MoonshotAI'
needs: candidate
if: needs.candidate.outputs.publish == 'true'
outputs:
packages_published: ${{ steps.changesets.outputs.published }}
kimi_native_release: ${{ steps.kimi-release.outputs.should_publish }}
@ -71,16 +143,6 @@ jobs:
env:
CHANGESETS_PUBLISHED_PACKAGES: ${{ steps.changesets.outputs.publishedPackages }}
deploy-docs:
name: Deploy docs
needs: release
if: needs.release.outputs.packages_published == 'true'
uses: ./.github/workflows/docs-deploy.yml
permissions:
contents: read
pages: write
id-token: write
native-artifacts:
name: Native release artifact
needs: release
@ -90,12 +152,16 @@ jobs:
upload-artifact-prefix: kimi-code-native
retention-days: 7
sign-macos: true
sign-windows: true
secrets:
APPLE_CERTIFICATE_P12: ${{ secrets.APPLE_CERTIFICATE_P12 }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_NOTARIZATION_KEY_P8: ${{ secrets.APPLE_NOTARIZATION_KEY_P8 }}
APPLE_NOTARIZATION_KEY_ID: ${{ secrets.APPLE_NOTARIZATION_KEY_ID }}
APPLE_NOTARIZATION_ISSUER_ID: ${{ secrets.APPLE_NOTARIZATION_ISSUER_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
publish-native-assets:
name: Publish native release assets
@ -128,3 +194,15 @@ jobs:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ needs.release.outputs.kimi_release_tag }}
run: gh release upload "$RELEASE_TAG" dist-native-release/* --clobber
deploy-docs:
needs: publish-native-assets
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: Deploy existing main documentation
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: gh workflow run docs-deploy.yml --ref main

View file

@ -1,35 +1,16 @@
name: Publish VS Code extension
# 把 0.7.3 手动发版流程固化成 CI 流水线:
#
# pnpm install → package:platform(全 6 平台)→ package:verify
# → extension host 冒烟(xvfb)→ publish:vsix → publish:ovsx
#
# 触发语义(参照 kimi-code-app 仓 desktop release.yml 的判定方式):
# 只在"本次 push 改动了 apps/vscode/package.json 的 version"时发布,
# 即 changesets 版本 PR("ci: release packages")合入后自动触发;
# 普通 PR 合入不会改变版本号,不会发布。版本号比较以 push 事件的
# before SHA 为基准(git show),可覆盖一次 push 含多个 commit 的情况,
# 不依赖工作区状态。workflow_dispatch 为手动兜底,
# 跳过版本号变化检查,直接走后续幂等闸门。
#
# 幂等(两道保险,可安全重跑,失败即停不自动重试):
# 1. 发布前逐平台核验 VS Marketplace(vsce show)与 Open VSX(REST)
# 线上版本:6 个 targetPlatform(darwin/linux/win32 × x64/arm64)
# 全部在线才跳过对应发布步骤;任一平台缺失(如上次部分发布失败)
# 即放行给发布步骤补齐,重跑可补齐;
# 2. 发布脚本自身带 --skip-duplicate(vsce)/ already-exists 跳过(ovsx)。
#
# 前置条件:仓库管理员需先配置 secrets VSCE_PAT / OVSX_PAT,
# 未配置时 publish 步骤会失败,属预期。
on:
push:
branches:
- main
workflow_dispatch:
workflow_call:
secrets:
VSCE_PAT:
required: false
OVSX_PAT:
required: false
concurrency: ${{ github.workflow }}-${{ github.ref }}
concurrency:
group: vscode-publish-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: read
@ -38,13 +19,14 @@ jobs:
publish:
name: Publish VSIX to marketplaces
runs-on: ubuntu-latest
if: github.repository_owner == 'MoonshotAI'
if: github.repository_owner == 'MoonshotAI' && startsWith(github.ref, 'refs/heads/release/')
timeout-minutes: 90
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0 # 需要按 push 事件的 before SHA 取旧版本号比较
ref: ${{ github.sha }}
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v6
@ -62,7 +44,6 @@ jobs:
id: gate
shell: bash
env:
EVENT_NAME: ${{ github.event_name }}
BEFORE_SHA: ${{ github.event.before }}
run: |
set -euo pipefail
@ -71,27 +52,20 @@ jobs:
echo "version=${version}" >> "$GITHUB_OUTPUT"
echo "extension version: ${version}"
if [ "${EVENT_NAME}" = "workflow_dispatch" ]; then
echo "manual dispatch — skipping version-change check"
prev=""
if [ -n "${BEFORE_SHA}" ] && [ -n "${BEFORE_SHA//0/}" ]; then
if git show "${BEFORE_SHA}:${pkg}" > /tmp/prev-vscode-pkg.json 2> /dev/null; then
prev="$(node -p "require('/tmp/prev-vscode-pkg.json').version")"
fi
else
# 以 push 事件的 before SHA 为比较基准(覆盖多 commit 的单次 push)。
# before 为空或全 0(如新分支首推)时无法比较,prev 视为空 →
# 判定版本变化放行 —— 宁可多查一次线上闸门,不可漏发。
prev=""
if [ -n "${BEFORE_SHA}" ] && [ -n "${BEFORE_SHA//0/}" ]; then
if git show "${BEFORE_SHA}:${pkg}" > /tmp/prev-vscode-pkg.json 2> /dev/null; then
prev="$(node -p "require('/tmp/prev-vscode-pkg.json').version")"
fi
else
echo "push event has no usable before SHA ('${BEFORE_SHA}') — treating as a version change"
fi
if [ "${prev}" = "${version}" ]; then
echo "apps/vscode version unchanged in this push (${version}) — nothing to publish"
echo "should_publish=false" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "version changed ${prev:-<none>} -> ${version} — release push"
echo "push event has no usable before SHA ('${BEFORE_SHA}') — treating as a version change"
fi
if [ "${prev}" = "${version}" ]; then
echo "apps/vscode version unchanged in this push (${version}) — nothing to publish"
echo "should_publish=false" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "version changed ${prev:-<none>} -> ${version} — release push"
echo "should_publish=true" >> "$GITHUB_OUTPUT"
# 线上闸门:逐平台核验,6 个 targetPlatform 全部在线才跳过对应市场;

18
.husky/install.mjs Normal file
View file

@ -0,0 +1,18 @@
import { existsSync } from 'node:fs';
if (
process.env.NODE_ENV === 'production' ||
process.env.CI === 'true' ||
process.env.npm_config_production === 'true' ||
!existsSync('.git')
) {
process.exit(0);
}
try {
const husky = (await import('husky')).default;
console.log(husky());
} catch (error) {
if (error && error.code === 'ERR_MODULE_NOT_FOUND') process.exit(0);
throw error;
}

4
.husky/pre-commit Normal file
View file

@ -0,0 +1,4 @@
set -e
node scripts/check-no-comments.mjs
pnpm lint-staged

View file

@ -14,19 +14,18 @@ This is a TypeScript monorepo built for agent-assisted development. Keep the roo
## Project Map
- `apps/kimi-code`: the CLI / TUI application. It consumes core capabilities through `@moonshot-ai/kimi-code-sdk` and must not depend directly on `@moonshot-ai/agent-core`. When writing or modifying its terminal UI, use the `write-tui` skill (`.agents/skills/write-tui/SKILL.md`).
- `apps/kimi-code`: the CLI / TUI application. It consumes core capabilities through `@moonshot-ai/kimi-code-sdk` and must not depend directly on engine packages. When writing or modifying its terminal UI, use the `write-tui` skill (`.agents/skills/write-tui/SKILL.md`).
- the browser web UI: **its source no longer lives in this repo.** It is developed in the code-app repo (`apps/web`) and shipped as the committed, prebuilt bundle `apps/kimi-code/dist-web` (gitignored, force-added), synced from code-app with `KIMI_CODE_REPO=<this checkout> pnpm run sync:web` — sync and commit the bundle in the same change whenever the web UI should ship differently. `apps/kimi-code/scripts/check-web-assets.mjs` guards packaging against a missing bundle. To hack on the web UI against this repo's server, run `pnpm dev:server` here and point code-app's `pnpm dev:web` at it via `KIMI_SERVER_URL`.
- `apps/vis`, `apps/vis/server`, `apps/vis/web`: visual debugging tools for sessions and replays.
- `apps/kimi-inspect`: web inspector for the kap-server `/api/v1/debug` RPC surface — workspace/session browser, per-session transcript chat, per-scope Service panels, and the DI unit inspection view. See `apps/kimi-inspect/AGENTS.md`.
- `packages/agent-core`: the unified agent engine, including Agent, Session, profile, skills, tools, plan, permission, background, records, the in-process DI service layer (`src/services/`), and other core capabilities. See `packages/agent-core/AGENTS.md`.
- `packages/agent-core-v2`: the DI × Scope agent engine (the v2 port behind kap-server). Four `LifecycleScope` tiers — `App` / `Workspace` / `Session` / `Agent` (`app/scopes.ts`) — plus the L3 unit layer (`Service`/`Fiber` units, collection contribution points, the Feature seam in `src/features/`); there is no App-level session lifecycle facade — callers compose `ISessionIndex` → `IWorkspaceLifecycleService.handlerFor` → the handler.
- `packages/node-sdk`: the public TypeScript SDK and harness.
- `packages/kosong`: the LLM / provider abstraction layer.
- `packages/kaos`: the execution environment and file/process abstractions.
- `packages/oauth`: Kimi OAuth and managed auth utilities.
- `packages/telemetry`: shared client-side telemetry infrastructure.
- `packages/transcript`: the isomorphic transcript rendering data layer — L1 agent-granular store, L2 idempotent operations, L3 `off/turn/block/delta` subscription granularity, L4 framework-free view registry, plus turn-cursor pagination. Pure TypeScript (browser-safe, no engine imports); the sole owner of the transcript contract types (`src/contract/`) and the op-batch sequencing contract.
- `packages/kap-server`: the Kimi Code server, backed by `@moonshot-ai/agent-core-v2`; exposes sessions over REST + WebSocket (`/api/v1` + `/api/v1/ws`), plus the `/api/v1/debug/*` reflection RPC surface (`--debug-endpoints`, loopback bind + bearer auth).
- `packages/remote-control`: the Kimi Remote Control tunnel client — registers this machine with the relay and forwards HTTP/WebSocket traffic to the local server, with a machine-wide single-instance lock; consumed by kap-server (the `/api/v1/remote-control` toggle) and by the CLI (`kimi web --remote-control`).
- `packages/klient`: the client SDK — a contract-driven facade over agent-core-v2 (`global.*` / `session(id).*` / `agent(id).*`, zod-validated); transport via subpath entry (`@moonshot-ai/klient/ipc|memory`, both return the same `Klient`); also hosts the e2e suites. See `packages/klient/AGENTS.md`.
- `packages/tree-sitter-bash`: a pure-TypeScript bash parser (no runtime deps, no wasm); `parse(source, { timeoutMs, maxNodes })` runs under a deterministic budget and returns a discriminated `ParseResult` — callers must treat aborted/hasError trees as "cannot analyze" and degrade. Parser only, no safety judgments; see the package README's "Known differences" section.
- `packages/minidb`: the embedded JSON document store (`MiniDb`) behind kap-server's search index — snapshot + WAL persistence with an exclusive write lock, a larger-than-RAM full-text layer, and persistent index generations. See `packages/minidb/AGENTS.md`.
@ -56,6 +55,7 @@ This is a TypeScript monorepo built for agent-assisted development. Keep the roo
- YES: `interface Options { user?: User }`
- NO: `interface Options { user?: User | undefined }`
- Internal methods with only a single parameter should not be turned into options objects just for stylistic uniformity.
- Split functions only along abstraction levels: each function reads as one level of narrative (Step-down Rule), and a wrapper that adds no new abstraction level — especially one with a single call site — is inlined instead of extracted.
- Except for a package's `index.ts`, other `index.ts` files should prefer `export * from './module';`.
- Do not add too many new test files. Prefer adding tests to the existing test file of the corresponding component or module.
- When a test fails because of a user modification, default to fixing the test first; do not change the implementation to satisfy an old test unless the implementation truly has a bug.
@ -64,8 +64,7 @@ This is a TypeScript monorepo built for agent-assisted development. Keep the roo
## Experimental Features
- Gate a not-yet-public feature behind an experimental flag. Flags are env-driven and default off: `KIMI_CODE_EXPERIMENTAL_<NAME>` toggles one, `KIMI_CODE_EXPERIMENTAL_FLAG` enables all. Precedence is per-flag env > `[experimental]` config > master env > the flag's `default`. Release by flipping the entry's `default` to `true`.
- `packages/agent-core` (v1): add the flag to the central registry at `packages/agent-core/src/flags/registry.ts`, then check it with `flags.enabled('my-feature')`.
- `packages/agent-core-v2` and kap-server modules: there is no central catalog — declare the flag in the owning domain via `registerFlagDefinition` at import time, then check it with `IFlagService.enabled(id)`. Current search-index-separation flags: `persistence_minidb_readmodel` (session read model, default on) and `search_worker` (global search worker host, default on).
- `packages/agent-core-v2` and kap-server modules: there is no central catalog — declare the flag in the owning domain via `registerFlagDefinition` at import time, then check it with `IFlagService.enabled(id)`.
## Where to Update Instructions
@ -74,12 +73,17 @@ This is a TypeScript monorepo built for agent-assisted development. Keep the roo
- Project-map entries stay at 1–2 sentences; deep package docs live in the package's own `AGENTS.md`.
- Keep instruction updates focused and supported by code facts.
## Release Workflow
- `main` accumulates changesets; `release/*` maintains `ci: release packages` PRs. Merging the matching version PR authorizes publication after its merge-commit CI succeeds. Ordinary pushes do not publish.
- npm publishing and native artifacts retain the existing Changesets flow. CDN upload and routing remain separately approved operations. See `.changeset/README.md` for migration and main synchronization.
## Workflow Requirements
- Prefer `rg` / `rg --files` when reading code.
- When designing changes, follow existing boundaries and local patterns first.
- In public text and test data, replace real internal identifiers with neutral placeholders such as `example.com`, `example.test`, and `YOUR_API_KEY`. Before opening a PR, ask a read-only agent to audit the diff for context-specific internal identifiers.
- When creating a PR, the PR title must follow Conventional Commit style, e.g. `chore: remove legacy format commands`.
- When creating a PR, use the `write-pr` skill (`.agents/skills/write-pr/SKILL.md`) to write the PR description. The PR title must follow Conventional Commit style, e.g. `chore: remove legacy format commands`.
- When an AI agent opens or updates a PR, fill in `.github/pull_request_template.md` — link the related issue or explain the problem, then describe what changed. Do not leave placeholder text or submit a generic summary of the diff.
- Do not submit vague AI-generated PR text. The human author must understand the change well enough to explain the code, edge cases, and why the approach fits this repository.
- After finishing a task and before submitting a PR, you must run the `gen-changesets` skill (see `.agents/skills/gen-changesets/SKILL.md`) and generate a changeset under `.changeset/` according to its rules.
@ -90,3 +94,39 @@ This is a TypeScript monorepo built for agent-assisted development. Keep the roo
- Agent working notes or handoff/summary documents (e.g. `HANDOVER-*.md`, `HANDOFF-*.md`, `handoff.md`).
- Throwaway UI/UX prototypes or design mockups (e.g. `*-designs.html`, `*-mockup.html`, `*-demo(s).html`) at the repo root or under a `design/` folder. The only tracked `.html` files should be Vite `index.html` entrypoints.
Before committing or opening a PR, run `git status` and `git diff --staged --stat` and remove anything matching these patterns. Put scratch work under `.tmp/` (gitignored) instead of the repo root or the source tree.
## Code Review Rules
These rules apply to every pull request review, automated or human. The user populations and contract files they refer to are listed in `.agents/skills/review-pr/surfaces.md`.
### Review scope: the PR's diff, not the repo
- Review only the PR's diff against its base. A problem in code the PR does not touch (pre-existing on base) is reported as a non-blocking note, never as a blocking finding — the sole exception is pre-existing code that the PR's behavior directly triggers or amplifies.
- Report a class of issues in one pass: when a finding generalizes to several locations in the diff, list all of them at once instead of raising them across successive rounds.
- No pure style or personal-preference findings. Every finding carries a severity: P0 blocking / P1 should-fix / P2 suggestion.
- Re-reviews are incremental: review only what changed since the previous review; do not restate findings on unchanged code or re-raise resolved threads. Before treating a resolved thread as settled, verify the current code: suppress a finding only when the problem is actually fixed or the finding no longer holds.
- Domain-specific rules keep their own canonical homes — changesets (`.agents/skills/gen-changesets/SKILL.md`), comment-free zones (General Coding Rules), PR text (`write-pr` skill); review against those, not ad-hoc taste.
### Enumerate changed behavior, not just bugs
Any input that worked before the change — a config key, env var, CLI flag, provider response shape, session written by an older version, client request, or hook payload — must behave the same after it unless the PR declares the change. For every deleted or narrowed branch, condition, default, or prompt sentence, ask who reached it before and where they go now; for every new condition, ask which existing inputs now match it first. Flag a PR that calls a path "unchanged" when its branch condition moved.
### A flipped default or removed behavior needs a named loss and an escape hatch
Everyone on the old default is affected. Require the changeset to name the behavior users lose, not only the new default; a config, env, or flag escape hatch or a maintainer's explicit sign-off in the PR; and a test that pins the old behavior for the population that keeps it.
### Prompt text is behavior
Editing or deleting sentences under `packages/agent-core-v2/src/**/*.md` (system prompt, tool descriptions, reminders, overlays, built-in skills) changes agent behavior for every user who receives that prompt. "No test references the sentence" is not evidence of no impact. Require the PR to name the population that receives the text (every session, plan mode, a flag-gated feature such as Tower), what the sentence enforced, who relied on it, and what enforces it now.
### Contract files are tripwires
The manifests under `packages/agent-core-v2/docs/` (`config-manifest.toml`, `wire-manifest.d.ts`, `state-manifest.d.ts`), `packages/kap-server/test/__snapshots__/apiSurface.snapshot.test.ts.snap`, `packages/node-sdk/src/index.ts`, `packages/agent-core-v2/src/features/externalHooks/`, `packages/acp-server/`, and `apps/kimi-code/src/cli/` are consumed outside this repository: desktop and web in code-app, the VS Code extension, ACP clients such as Zed, SDK users, hook scripts, and headless-output parsers. When they change, require the PR to name the consumers and how data and clients from the previous release keep working.
### Ports and refactors carry the old path's feature inventory
When a change replaces or bypasses an existing path, require a list of what the old path did — env vars honored, fallbacks, accepted inputs — and where each item lives in the new path. A silently dropped item is a regression, not a cleanup.
### Silent failure outranks a crash
A change that makes the product silently ignore configuration, silently approve or skip an action, or silently drop data is the most severe finding: users get no signal to report.

View file

@ -30,7 +30,7 @@ This is a pnpm monorepo. The most relevant entry points are:
- `apps/vis` — session debug visualizer
- `packages/node-sdk` — public TypeScript SDK (`@moonshot-ai/kimi-code-sdk`)
- `packages/agent-core-v2` — the agent engine (v2, DI Scope architecture); `packages/agent-core` is v1 and being phased out
- `packages/klient`, `kap-server`, `protocol`, `transcript`, `kosong`, `kaos`, `oauth`, `telemetry` — internal engine packages
- `packages/klient`, `kap-server`, `protocol`, `transcript`, `kosong`, `oauth`, `telemetry` — internal engine packages
- `docs/` — VitePress bilingual docs site
For the full project map, see [AGENTS.md](AGENTS.md).
@ -60,12 +60,12 @@ All commits and PR titles must follow [Conventional Commits](https://www.convent
| Type | Use for | Example |
|----------|---------------------------------------------|-------------------------------------------|
| feat | A new feature | feat(agent-core): add tool dedup |
| feat | A new feature | feat(agent-core-v2): add tool dedup |
| fix | A bug fix | fix(tui): correct status bar alignment |
| docs | Documentation only | docs: clarify install instructions |
| chore | Tooling / housekeeping | chore: bump dependencies |
| refactor | Internal refactor without behavior change | refactor(kosong): extract retry helper |
| test | Adding or improving tests | test(agent-core): cover skill resolver |
| test | Adding or improving tests | test(agent-core-v2): cover skill resolver |
| ci | CI / build pipeline changes | ci: cache pnpm store |
| build | Build system / artifact changes | build(native): add win32-arm64 target |
| perf | Performance improvement | perf(session): batch event flushes |

View file

@ -30,7 +30,7 @@ Kimi Code 对 CLI/TUI 行为、agent 工作流和公开 API 已有自己的主
- `apps/vis` — 会话调试可视化工具
- `packages/node-sdk` — 公开 TypeScript SDK(`@moonshot-ai/kimi-code-sdk`)
- `packages/agent-core-v2` — 当前的 agent 引擎(v2,DI Scope 架构);`packages/agent-core` 为 v1,正在逐步废弃
- `packages/klient`、`kap-server`、`protocol`、`transcript`、`kosong`、`kaos`、`oauth`、`telemetry` — 内部引擎包
- `packages/klient`、`kap-server`、`protocol`、`transcript`、`kosong`、`oauth`、`telemetry` — 内部引擎包
- `docs/` — VitePress 双语文档站
完整项目地图见 [AGENTS.md](AGENTS.md)。
@ -60,12 +60,12 @@ pnpm install
| 类型 | 用途 | 示例 |
|----------|------------------------------------------|----------------------------------------|
| feat | 新功能 | feat(agent-core): add tool dedup |
| feat | 新功能 | feat(agent-core-v2): add tool dedup |
| fix | bug 修复 | fix(tui): correct status bar alignment |
| docs | 仅文档 | docs: clarify install instructions |
| chore | 工具 / 杂务 | chore: bump dependencies |
| refactor | 无行为变更的内部重构 | refactor(kosong): extract retry helper |
| test | 新增或改进测试 | test(agent-core): cover skill resolver |
| test | 新增或改进测试 | test(agent-core-v2): cover skill resolver |
| ci | CI / 构建流水线变更 | ci: cache pnpm store |
| build | 构建系统 / 产物变更 | build(native): add win32-arm64 target |
| perf | 性能优化 | perf(session): batch event flushes |

View file

@ -42,7 +42,7 @@ Main directories:
- `reverse-rpc` converts SDK approval/question requests into the data shape a UI panel/dialog needs, and converts the user's choice back into an SDK response.
- `theme` is the single source of truth for colors and styles. Components must not bypass the theme system and use chalk named colors directly.
- `utils` holds utility functions with no UI-state dependency. Logic that needs `TUIState` or a component instance must not live under app-level `src/utils`.
- `apps/kimi-code` may only use core capabilities through `@moonshot-ai/kimi-code-sdk`. Do not import `@moonshot-ai/agent-core` directly in app code.
- `apps/kimi-code` may only use core capabilities through `@moonshot-ai/kimi-code-sdk`. Do not import engine packages directly in app code.
## TUI Coding Conventions

View file

@ -1,5 +1,459 @@
# @moonshot-ai/kimi-code
## 2.3.1
### Patch Changes
- [#4348](https://github.com/MoonshotAI/kimi-code/pull/4348) [`c569bab`](https://github.com/MoonshotAI/kimi-code/commit/c569bab55d4d510b09f01205d760001d16117aff) Thanks [@liruifengv](https://github.com/liruifengv)! - Fix workspace trust failures when Git Bash is unavailable on Windows.
- [#4348](https://github.com/MoonshotAI/kimi-code/pull/4348) [`c569bab`](https://github.com/MoonshotAI/kimi-code/commit/c569bab55d4d510b09f01205d760001d16117aff) Thanks [@liruifengv](https://github.com/liruifengv)! - Fix sessions occasionally remaining occupied after an application crash on macOS and Linux.
- [#4356](https://github.com/MoonshotAI/kimi-code/pull/4356) [`0e3980e`](https://github.com/MoonshotAI/kimi-code/commit/0e3980e75e9af9d28955a5e93cff82d616b11353) Thanks [@7Sageer](https://github.com/7Sageer)! - Show the holding client's name in session-in-use errors.
- [#4348](https://github.com/MoonshotAI/kimi-code/pull/4348) [`c569bab`](https://github.com/MoonshotAI/kimi-code/commit/c569bab55d4d510b09f01205d760001d16117aff) Thanks [@liruifengv](https://github.com/liruifengv)! - Offer to take over a session that is still in use after a retry, so sessions left locked by an exited process can be used again, and add a `KIMI_CODE_SESSION_LOCK=0` switch that turns off the session lock.
- [#4348](https://github.com/MoonshotAI/kimi-code/pull/4348) [`c569bab`](https://github.com/MoonshotAI/kimi-code/commit/c569bab55d4d510b09f01205d760001d16117aff) Thanks [@liruifengv](https://github.com/liruifengv)! - web: Improved interactions and fixed known bugs.
## 2.3.0
### Minor Changes
- [#4294](https://github.com/MoonshotAI/kimi-code/pull/4294) [`3f80896`](https://github.com/MoonshotAI/kimi-code/commit/3f80896a79c5b17867898bd829b6d7a78f569f47) Thanks [@liruifengv](https://github.com/liruifengv)! - Add a confirmation dialog when switching models in a session with conversation history: start a new session, compact and continue, continue directly, or cancel. Shown only when enabled by cloud configuration.
- [#4188](https://github.com/MoonshotAI/kimi-code/pull/4188) [`3f0857e`](https://github.com/MoonshotAI/kimi-code/commit/3f0857eb7d612c4890c45dfa6acc8381f1e761c2) Thanks [@oocz](https://github.com/oocz)! - List plugin skills under their qualified `<pluginId>:<skillName>` name so same-named skills from different plugins all stay visible and invocable; invoking a plugin skill by its bare name no longer works, use the qualified name instead.
- [#4214](https://github.com/MoonshotAI/kimi-code/pull/4214) [`ef727e5`](https://github.com/MoonshotAI/kimi-code/commit/ef727e517923cb312cb48d42825c49dfacd528e7) Thanks [@sailist](https://github.com/sailist)! - Support streaming large requests and responses through remote control, raising the transfer limit from 10 MiB to 100 MiB, with concurrent transfers bounded to protect memory.
- [#4288](https://github.com/MoonshotAI/kimi-code/pull/4288) [`df0ff3c`](https://github.com/MoonshotAI/kimi-code/commit/df0ff3c5492e8f896927c4af9b4ae00b2b488607) Thanks [@github-actions](https://github.com/apps/github-actions)! - When the same session is open in multiple clients, sending from a second one now shows an occupancy prompt with retry/cancel, or reloads updates made elsewhere first and resends your message.
- [#4200](https://github.com/MoonshotAI/kimi-code/pull/4200) [`5bab748`](https://github.com/MoonshotAI/kimi-code/commit/5bab748dddaae4b2ac15822d72b83446e5fd7bf4) Thanks [@7Sageer](https://github.com/7Sageer)! - Automatically generate a session title after the first turn and show it as the terminal window title.
### Patch Changes
- [#4250](https://github.com/MoonshotAI/kimi-code/pull/4250) [`6e7cc90`](https://github.com/MoonshotAI/kimi-code/commit/6e7cc909da9084a424f822dd5a9aae5b98070b73) Thanks [@sailist](https://github.com/sailist)! - Setting `[permission] dangerous_command_guard = false` now turns off every built-in confirmation guard — dangerous commands, sensitive-file access, and git control-path access — instead of only the dangerous-command guard.
- [#4281](https://github.com/MoonshotAI/kimi-code/pull/4281) [`5710c54`](https://github.com/MoonshotAI/kimi-code/commit/5710c5496a213742ca0687f69dd8eeb5bde52dbf) Thanks [@sailist](https://github.com/sailist)! - Fix session events stopping after a session is archived and restored.
- [#4201](https://github.com/MoonshotAI/kimi-code/pull/4201) [`83a39b4`](https://github.com/MoonshotAI/kimi-code/commit/83a39b49ed62627c7a604b39e26d8e9d17ade296) Thanks [@Grapedge](https://github.com/Grapedge)! - Stop blocking the terminal while the footer reads git status.
- [#4230](https://github.com/MoonshotAI/kimi-code/pull/4230) [`b260326`](https://github.com/MoonshotAI/kimi-code/commit/b2603264ec4687cee766cf5d5e6d4976e432961c) Thanks [@kimi-agent-bot](https://github.com/kimi-agent-bot)! - Report a clear error when thinking effort is set to off for Gemini 4 models.
- [#4208](https://github.com/MoonshotAI/kimi-code/pull/4208) [`20b5991`](https://github.com/MoonshotAI/kimi-code/commit/20b59915bb11fc56ec389aa96720f1b7daac0862) Thanks [@SeleneXX](https://github.com/SeleneXX)! - Fix Gemini 4 requests always failing with a 400 error.
- [#4242](https://github.com/MoonshotAI/kimi-code/pull/4242) [`c1459a6`](https://github.com/MoonshotAI/kimi-code/commit/c1459a61845056832b85a0a220ee11a2bc5132f8) Thanks [@wbxl2000](https://github.com/wbxl2000)! - Run hooks such as `PreToolUse` and `Stop` in the session's project directory, as documented, instead of the directory the server was started from.
- [#4210](https://github.com/MoonshotAI/kimi-code/pull/4210) [`f28c51c`](https://github.com/MoonshotAI/kimi-code/commit/f28c51c01f025bba9f0d0f58f6309e7517a8cd02) Thanks [@sailist](https://github.com/sailist)! - Add the [mcp] default_deferred config key: when the experimental tool-select flag is on, set default_deferred = true in config.toml to load every MCP server's tools on demand by default; a server can opt out with deferred: false.
- [#4171](https://github.com/MoonshotAI/kimi-code/pull/4171) [`0327e8e`](https://github.com/MoonshotAI/kimi-code/commit/0327e8e9a875949fd40141ef79f902d756dfd3db) Thanks [@7Sageer](https://github.com/7Sageer)! - Support custom-registry model upgrade metadata in model configuration.
- [#4188](https://github.com/MoonshotAI/kimi-code/pull/4188) [`3f0857e`](https://github.com/MoonshotAI/kimi-code/commit/3f0857eb7d612c4890c45dfa6acc8381f1e761c2) Thanks [@oocz](https://github.com/oocz)! - Allow uppercase letters, dot-separated segments, and @ suffixes in plugin names when installing plugins.
- [#4294](https://github.com/MoonshotAI/kimi-code/pull/4294) [`3f80896`](https://github.com/MoonshotAI/kimi-code/commit/3f80896a79c5b17867898bd829b6d7a78f569f47) Thanks [@liruifengv](https://github.com/liruifengv)! - Queue /compact while the agent is busy: the command now joins the message queue and runs in order instead of failing with an error; it is skipped if the context was auto-compacted while it waited.
- [#4190](https://github.com/MoonshotAI/kimi-code/pull/4190) [`e4c99a3`](https://github.com/MoonshotAI/kimi-code/commit/e4c99a3bad19b00bd1939b1cf254f427b50061f0) Thanks [@starquakee](https://github.com/starquakee)! - Clarify unavailable tools, announce when no tools can be loaded, and discourage repeated failed tool selections.
- [#4272](https://github.com/MoonshotAI/kimi-code/pull/4272) [`ce0834a`](https://github.com/MoonshotAI/kimi-code/commit/ce0834a8f301b89cc4523499a3e074c36851de8f) Thanks [@Grapedge](https://github.com/Grapedge)! - Move the session rating opt-out from tui.toml to config.toml.
- [#4066](https://github.com/MoonshotAI/kimi-code/pull/4066) [`85077a4`](https://github.com/MoonshotAI/kimi-code/commit/85077a419001285e49ede3574924f001935aed62) Thanks [@7Sageer](https://github.com/7Sageer)! - Keep subagent tool descriptions aligned with currently available tools.
- [#3799](https://github.com/MoonshotAI/kimi-code/pull/3799) [`7e58f2d`](https://github.com/MoonshotAI/kimi-code/commit/7e58f2d2410d2b541ffd57f4501c0436bba4ccbd) Thanks [@kimi-agent-bot](https://github.com/kimi-agent-bot)! - Fix the latest reply disappearing from the transcript after a background task completion notification arrives; the fold boundary is now anchored to the notification turn itself instead of the asynchronously mounted task card.
- [#4239](https://github.com/MoonshotAI/kimi-code/pull/4239) [`da5918c`](https://github.com/MoonshotAI/kimi-code/commit/da5918c0c861a1d670f4523a9f9dd968647fe4cb) Thanks [@RealKai42](https://github.com/RealKai42)! - Remind the agent to update its todo list after 5 steps without an update instead of 10, only while the list still has unfinished items, and ask it to bring the list up to date before its final reply.
- [#4248](https://github.com/MoonshotAI/kimi-code/pull/4248) [`8fcd332`](https://github.com/MoonshotAI/kimi-code/commit/8fcd3326e7488e5e0d4c595115ef74a10c340d5b) Thanks [@kimi-agent-bot](https://github.com/kimi-agent-bot)! - Show a single overflowing preview line in full instead of swapping it for a same-height expand hint.
- [#4304](https://github.com/MoonshotAI/kimi-code/pull/4304) [`d36071e`](https://github.com/MoonshotAI/kimi-code/commit/d36071ede6ae3cbdc08cbb8a0f7daf7bc6d06f2d) Thanks [@kimi-agent-bot](https://github.com/kimi-agent-bot)! - web: Improved interactions and fixed known bugs.
## 2.2.0
### Minor Changes
- [#4159](https://github.com/MoonshotAI/kimi-code/pull/4159) [`0a3a2fb`](https://github.com/MoonshotAI/kimi-code/commit/0a3a2fbafab473df9e9f6609f825af78d2c1ce6d) Thanks [@RealKai42](https://github.com/RealKai42)! - Add an opt-in NotifyUser progress update feature (off by default): new sessions can show the agent's mid-turn progress with an optional one-line title, enabled in the TUI `/experiments` or the web/Desktop settings' Lab section; set `[experimental] notify_user = true` or `KIMI_CODE_EXPERIMENTAL_NOTIFY_USER=1` to turn it on.
- [#4145](https://github.com/MoonshotAI/kimi-code/pull/4145) [`242ac23`](https://github.com/MoonshotAI/kimi-code/commit/242ac230006447f8601e1678c49182bfbae89fe9) Thanks [@wbxl2000](https://github.com/wbxl2000)! - Add `kimi app [path]` to open a new desktop chat in the current or specified directory.
- [#4061](https://github.com/MoonshotAI/kimi-code/pull/4061) [`20a2cea`](https://github.com/MoonshotAI/kimi-code/commit/20a2cea72f5d2c4be3a3845e4ff24ce302a6630e) Thanks [@chengluyu](https://github.com/chengluyu)! - Cap the agent's in-turn wait for background tasks at 90 seconds (longer timeouts are no longer accepted), discourage repeated waits, and let a new message end the wait immediately.
- [#3998](https://github.com/MoonshotAI/kimi-code/pull/3998) [`09af3b4`](https://github.com/MoonshotAI/kimi-code/commit/09af3b483faac51a767aee50adb1bc1a8de4cc53) Thanks [@tpoisonooo](https://github.com/tpoisonooo)! - Tower mode: a message sent while the agent is running aborts the in-progress turn and runs as its own turn.
- [#4031](https://github.com/MoonshotAI/kimi-code/pull/4031) [`33e368a`](https://github.com/MoonshotAI/kimi-code/commit/33e368a1eff8d958856af8e2fb64f4db122b2247) Thanks [@Grapedge](https://github.com/Grapedge)! - Add sticky user message summaries in fullscreen mode; click a summary to jump to the original message.
- [#4074](https://github.com/MoonshotAI/kimi-code/pull/4074) [`c9f01f0`](https://github.com/MoonshotAI/kimi-code/commit/c9f01f07388abc2cdca40c9c5267f58c65086710) Thanks [@tpoisonooo](https://github.com/tpoisonooo)! - Tower mode: deterministic orchestration with TowerRebase and LLM-free status, goal/tower mutual exclusion, and workspace protection.
- [#4059](https://github.com/MoonshotAI/kimi-code/pull/4059) [`1f6f0b1`](https://github.com/MoonshotAI/kimi-code/commit/1f6f0b1fa2117cc9374c1be62c534b4a4d60e412) Thanks [@7Sageer](https://github.com/7Sageer)! - Add the KIMI_CODE_TRUST_WORKSPACE environment variable to mark the workspace as trusted.
- [#4165](https://github.com/MoonshotAI/kimi-code/pull/4165) [`afd95f6`](https://github.com/MoonshotAI/kimi-code/commit/afd95f64a5444b649a4cc33504513bf88e4c54ba) Thanks [@Grapedge](https://github.com/Grapedge)! - Replace user skill cards with highlighted prompts and support Ctrl-S for skill prompts.
### Patch Changes
- [#4183](https://github.com/MoonshotAI/kimi-code/pull/4183) [`c15638b`](https://github.com/MoonshotAI/kimi-code/commit/c15638b0a1234e5aa97659fbc625d7dc4d60d93f) Thanks [@RealKai42](https://github.com/RealKai42)! - Cancel in-flight video uploads when a media read is interrupted.
- [#4081](https://github.com/MoonshotAI/kimi-code/pull/4081) [`06ebfc8`](https://github.com/MoonshotAI/kimi-code/commit/06ebfc821e304bd4ca3f828ae739954166463d65) Thanks [@sailist](https://github.com/sailist)! - Fix shifted turns and lost replies when a UserPromptSubmit hook injects text; hook JSON output without a "message" field is no longer added to the conversation.
- [#4154](https://github.com/MoonshotAI/kimi-code/pull/4154) [`419aced`](https://github.com/MoonshotAI/kimi-code/commit/419aced0e97fa04b75f8f71b089e1667f6de6d0a) Thanks [@7Sageer](https://github.com/7Sageer)! - Fix media file reading on the first turn after resuming a session.
- [#4083](https://github.com/MoonshotAI/kimi-code/pull/4083) [`f409caa`](https://github.com/MoonshotAI/kimi-code/commit/f409caa21e71ce7beb158d29ffca1fed76216a64) Thanks [@sailist](https://github.com/sailist)! - Cron tasks from the source session no longer fire inside a forked session.
- [#4152](https://github.com/MoonshotAI/kimi-code/pull/4152) [`f0bc988`](https://github.com/MoonshotAI/kimi-code/commit/f0bc988bbc7db08d650f37ae0eaa69bcc6e90696) Thanks [@7Sageer](https://github.com/7Sageer)! - Forked subagents now inherit the parent's available agent types, including custom agents.
- [#4057](https://github.com/MoonshotAI/kimi-code/pull/4057) [`a940f2f`](https://github.com/MoonshotAI/kimi-code/commit/a940f2ff049ed57abce68c59526de7a6628a4112) Thanks [@huangzheng2016](https://github.com/huangzheng2016)! - Fix the permission mode switch in the goal-start approval prompt not taking effect on the v2 engine.
- [#4081](https://github.com/MoonshotAI/kimi-code/pull/4081) [`06ebfc8`](https://github.com/MoonshotAI/kimi-code/commit/06ebfc821e304bd4ca3f828ae739954166463d65) Thanks [@sailist](https://github.com/sailist)! - Fix messages rendering out of place in sessions with a UserPromptSubmit hook.
- [#4153](https://github.com/MoonshotAI/kimi-code/pull/4153) [`7091138`](https://github.com/MoonshotAI/kimi-code/commit/7091138f5e66289d04b9b7a5cd77f94af9308be3) Thanks [@RealKai42](https://github.com/RealKai42)! - Let the agent write one- or two-sentence progress notes between tool calls instead of bare status lines; in the experimental Updates panel (`KIMI_CODE_EXPERIMENTAL_NOTIFY_USER=1`), stop asking the agent to repost its mid-turn text as an update and remind it to post updates less often.
- [#4054](https://github.com/MoonshotAI/kimi-code/pull/4054) [`4fbe065`](https://github.com/MoonshotAI/kimi-code/commit/4fbe065442179435c43d3c3dc8d11bb408b3fd30) Thanks [@RealKai42](https://github.com/RealKai42)! - Stop prompting the agent to send NotifyUser updates when a session is opened in a host that does not display them.
- [#4091](https://github.com/MoonshotAI/kimi-code/pull/4091) [`21406fb`](https://github.com/MoonshotAI/kimi-code/commit/21406fb4c805cc8c715e6d1f16ad3fb5f25f4fe3) Thanks [@sailist](https://github.com/sailist)! - Omit max_tokens for models without an explicit output limit, fixing repeated 400 errors on strict serving stacks (e.g. bare vLLM) when the model's max output size is unknown.
- [#4184](https://github.com/MoonshotAI/kimi-code/pull/4184) [`cbd7540`](https://github.com/MoonshotAI/kimi-code/commit/cbd754049a114ee36d1b27675c82819e4963c692) Thanks [@7Sageer](https://github.com/7Sageer)! - Remove the never-implemented `executor = "kaos"` option from MCP stdio server configuration; configs using it now fail validation at load time.
- [#2919](https://github.com/MoonshotAI/kimi-code/pull/2919) [`0f052fe`](https://github.com/MoonshotAI/kimi-code/commit/0f052fee1399f34086bb6343a56867d7df9b70b5) Thanks [@duyphan154](https://github.com/duyphan154)! - Sanitize foreground Bash tool output so captured terminal escape sequences no longer change the host terminal state.
- [#4164](https://github.com/MoonshotAI/kimi-code/pull/4164) [`3395f5b`](https://github.com/MoonshotAI/kimi-code/commit/3395f5bea6c77feb6a835d1ca3f4935970f96c6b) Thanks [@huangzheng2016](https://github.com/huangzheng2016)! - Show a "Shutting down" status hint while shutdown hooks run during exit, and let a Ctrl+C during that window force an immediate exit instead of waiting for the hook timeout.
- [#4033](https://github.com/MoonshotAI/kimi-code/pull/4033) [`eec9bbd`](https://github.com/MoonshotAI/kimi-code/commit/eec9bbd94958248034f5dbf109a639970308f05e) Thanks [@Grapedge](https://github.com/Grapedge)! - Feedback surveys now appear less often.
- [#4160](https://github.com/MoonshotAI/kimi-code/pull/4160) [`72fc1d0`](https://github.com/MoonshotAI/kimi-code/commit/72fc1d0a3375b2a87dff602a1d91726a99f360e0) Thanks [@kimi-agent-bot](https://github.com/kimi-agent-bot)! - Show "Working…" in the status spinner while thinking.
- [#4056](https://github.com/MoonshotAI/kimi-code/pull/4056) [`395d537`](https://github.com/MoonshotAI/kimi-code/commit/395d537237d737de0239159b60d1cc160bdf04e6) Thanks [@7Sageer](https://github.com/7Sageer)! - Replace inline MCP commands in the workspace trust prompt with activation summaries and configuration paths for manual inspection.
- [#4076](https://github.com/MoonshotAI/kimi-code/pull/4076) [`e3bf50c`](https://github.com/MoonshotAI/kimi-code/commit/e3bf50c0831d91ceb3656acf1b7a3f480eaada56) Thanks [@7Sageer](https://github.com/7Sageer)! - Remove interruption reminders from the conversation when their interrupted turns are undone.
- [#4031](https://github.com/MoonshotAI/kimi-code/pull/4031) [`33e368a`](https://github.com/MoonshotAI/kimi-code/commit/33e368a1eff8d958856af8e2fb64f4db122b2247) Thanks [@Grapedge](https://github.com/Grapedge)! - Replace the user message bullet ✨ with ❯.
- [#4221](https://github.com/MoonshotAI/kimi-code/pull/4221) [`2e6821d`](https://github.com/MoonshotAI/kimi-code/commit/2e6821dcbd8034f128b2326a73d4704201b7c108) Thanks [@kimi-agent-bot](https://github.com/kimi-agent-bot)! - web: Improved interactions and fixed known bugs.
## 2.1.1
### Patch Changes
- [#4013](https://github.com/MoonshotAI/kimi-code/pull/4013) [`929403b`](https://github.com/MoonshotAI/kimi-code/commit/929403b6db219eae6099dd23eae2f0efa2bb2823) Thanks [@7Sageer](https://github.com/7Sageer)! - Roll back some of the overly defensive changes in 2.1.0
- [#4015](https://github.com/MoonshotAI/kimi-code/pull/4015) [`c7dd841`](https://github.com/MoonshotAI/kimi-code/commit/c7dd84124a00d2dc1a68fbbc3e54b1095ee9ac23) Thanks [@sailist](https://github.com/sailist)! - Revert filesystem watchers for config and workspace files to on by default. Set `[watch] enabled` to `false` or `KIMI_CODE_WATCH=0` to keep them off.
## 2.1.0
### Minor Changes
- [#3990](https://github.com/MoonshotAI/kimi-code/pull/3990) [`32000d0`](https://github.com/MoonshotAI/kimi-code/commit/32000d08afcd019016fa60db0d68eaf21f3e35a6) Thanks [@Grapedge](https://github.com/Grapedge)! - In fullscreen, click a folded block to open or close it.
- [#4004](https://github.com/MoonshotAI/kimi-code/pull/4004) [`e17ff67`](https://github.com/MoonshotAI/kimi-code/commit/e17ff679281e340fd328bc2ebaba1237e79a9ad3) Thanks [@Grapedge](https://github.com/Grapedge)! - Add a TUI mode setting to /settings with an experimental fullscreen layout; switching modes takes effect after restarting Kimi Code. You can also set `tui_mode` in `~/.kimi-code/tui.toml` directly: `"regular"` renders into the terminal scrollback, while `"fullscreen"` makes parts of the UI mouse-interactive for a smoother experience.
### Patch Changes
- [#3964](https://github.com/MoonshotAI/kimi-code/pull/3964) [`6451f1e`](https://github.com/MoonshotAI/kimi-code/commit/6451f1e056e90037bbf832f3578955cf8e55db64) Thanks [@7Sageer](https://github.com/7Sageer)! - Block file tools from accessing files outside the working directory through symlinks.
- [#3975](https://github.com/MoonshotAI/kimi-code/pull/3975) [`bb96d80`](https://github.com/MoonshotAI/kimi-code/commit/bb96d80748921618182369a40a6610f38fa16acb) Thanks [@RealKai42](https://github.com/RealKai42)! - Reduce the CLI's startup time and memory usage.
- [#3957](https://github.com/MoonshotAI/kimi-code/pull/3957) [`6a214b8`](https://github.com/MoonshotAI/kimi-code/commit/6a214b85e53e58a9ef6480f27bcb7b0103c0e34e) Thanks [@huangzheng2016](https://github.com/huangzheng2016)! - Fix a "Maximum call stack size exceeded" error when opening large sessions.
- [#3974](https://github.com/MoonshotAI/kimi-code/pull/3974) [`994287a`](https://github.com/MoonshotAI/kimi-code/commit/994287acb3a7428b580c09cabd5aba1b5a818aaa) Thanks [@liruifengv](https://github.com/liruifengv)! - Fix forked sessions getting their titles overwritten by auto-generated titles.
- [#3964](https://github.com/MoonshotAI/kimi-code/pull/3964) [`6451f1e`](https://github.com/MoonshotAI/kimi-code/commit/6451f1e056e90037bbf832f3578955cf8e55db64) Thanks [@7Sageer](https://github.com/7Sageer)! - Apply project-local configuration only after the workspace is trusted.
- [#3964](https://github.com/MoonshotAI/kimi-code/pull/3964) [`6451f1e`](https://github.com/MoonshotAI/kimi-code/commit/6451f1e056e90037bbf832f3578955cf8e55db64) Thanks [@7Sageer](https://github.com/7Sageer)! - Block repository git configuration from executing commands during background git operations.
- [#3969](https://github.com/MoonshotAI/kimi-code/pull/3969) [`b3212fd`](https://github.com/MoonshotAI/kimi-code/commit/b3212fd9abc1f4670fb47df16f0137957aed6f2d) Thanks [@sailist](https://github.com/sailist)! - Skip cloud telemetry on the global login until its collector is live, and keep shutdown from aborting TUI exit.
- [#3979](https://github.com/MoonshotAI/kimi-code/pull/3979) [`e796bb5`](https://github.com/MoonshotAI/kimi-code/commit/e796bb5d482ecb7976c25dad0563b74cc9ec2c68) Thanks [@sailist](https://github.com/sailist)! - Fix MCP OAuth not requesting the offline_access scope, which caused hourly browser re-authorization with providers like Vercel.
- [#3969](https://github.com/MoonshotAI/kimi-code/pull/3969) [`b3212fd`](https://github.com/MoonshotAI/kimi-code/commit/b3212fd9abc1f4670fb47df16f0137957aed6f2d) Thanks [@sailist](https://github.com/sailist)! - Fix Remote Control failing to start after `kimi login --region global`.
- [#3964](https://github.com/MoonshotAI/kimi-code/pull/3964) [`6451f1e`](https://github.com/MoonshotAI/kimi-code/commit/6451f1e056e90037bbf832f3578955cf8e55db64) Thanks [@7Sageer](https://github.com/7Sageer)! - Reject additional directories that resolve to the home directory or filesystem root.
- [#3995](https://github.com/MoonshotAI/kimi-code/pull/3995) [`a54e6f6`](https://github.com/MoonshotAI/kimi-code/commit/a54e6f6a9b36bc1346e41da576d96ff54aa557b6) Thanks [@7Sageer](https://github.com/7Sageer)! - Turn off repeat reminders and forced stops with `KIMI_CODE_REPEAT_BREAKER=0`.
- [#3970](https://github.com/MoonshotAI/kimi-code/pull/3970) [`895e9d9`](https://github.com/MoonshotAI/kimi-code/commit/895e9d9b868cf9899e444784130fa1946c6cef6c) Thanks [@chengluyu](https://github.com/chengluyu)! - Fix missing Swarm members after reopening an interrupted conversation.
- [#3989](https://github.com/MoonshotAI/kimi-code/pull/3989) [`a268ad7`](https://github.com/MoonshotAI/kimi-code/commit/a268ad775d9451d008d3c73de053655f6ab0772a) Thanks [@Grapedge](https://github.com/Grapedge)! - Show a Thinking… spinner and keep the status row height steady during streaming.
- [#3989](https://github.com/MoonshotAI/kimi-code/pull/3989) [`a268ad7`](https://github.com/MoonshotAI/kimi-code/commit/a268ad775d9451d008d3c73de053655f6ab0772a) Thanks [@Grapedge](https://github.com/Grapedge)! - Add a clickable "Jump to bottom" indicator to the fullscreen TUI.
- [#3976](https://github.com/MoonshotAI/kimi-code/pull/3976) [`f7012aa`](https://github.com/MoonshotAI/kimi-code/commit/f7012aa23b38d90d1a643166e2e78f706a606a34) Thanks [@tpoisonooo](https://github.com/tpoisonooo)! - Tower mode: smaller missions, stricter completion and review checks, and review history in rework briefings.
- [#3847](https://github.com/MoonshotAI/kimi-code/pull/3847) [`65ae3e3`](https://github.com/MoonshotAI/kimi-code/commit/65ae3e368c7cfa096242cacc12eeeb661e682977) Thanks [@tpoisonooo](https://github.com/tpoisonooo)! - Tower mode: mission titles must be ASCII, and task cards show the mission id.
- [#3931](https://github.com/MoonshotAI/kimi-code/pull/3931) [`f17a22e`](https://github.com/MoonshotAI/kimi-code/commit/f17a22ebf4e21b8196bfaaa9a2490707676bf519) Thanks [@sailist](https://github.com/sailist)! - Turn off filesystem watchers for config and workspace files by default. Set `[watch] enabled` to `true` or `KIMI_CODE_WATCH=1` to turn them back on.
- [#4005](https://github.com/MoonshotAI/kimi-code/pull/4005) [`ba41d07`](https://github.com/MoonshotAI/kimi-code/commit/ba41d07810cae37a9e529cad6b0f8e8abc8d7aaf) Thanks [@liruifengv](https://github.com/liruifengv)! - web: Improved interactions and fixed known bugs.
## 2.0.2
### Patch Changes
- [#3922](https://github.com/MoonshotAI/kimi-code/pull/3922) [`9df7a9c`](https://github.com/MoonshotAI/kimi-code/commit/9df7a9ccfb0d7d0713b51ae1ac165d0634fc40d2) Thanks [@sailist](https://github.com/sailist)! - Fix new messages occasionally landing at an old position in the conversation after resuming a session.
- [#3911](https://github.com/MoonshotAI/kimi-code/pull/3911) [`88a7d93`](https://github.com/MoonshotAI/kimi-code/commit/88a7d932f1cda95c78bf5488d34ff974a160fb08) Thanks [@Grapedge](https://github.com/Grapedge)! - Fix compaction failing after switching to a model with a smaller context window.
- [#3929](https://github.com/MoonshotAI/kimi-code/pull/3929) [`6ffdf0d`](https://github.com/MoonshotAI/kimi-code/commit/6ffdf0d579fa1a9f30c2d00c437c6c8de0c03997) Thanks [@7Hanrui](https://github.com/7Hanrui)! - The agent no longer assumes the current working directory is the project root.
- [#3933](https://github.com/MoonshotAI/kimi-code/pull/3933) [`9721259`](https://github.com/MoonshotAI/kimi-code/commit/97212596f7d694b9683046ec7aad4d1247d29468) Thanks [@liruifengv](https://github.com/liruifengv)! - Fix a message sent while the agent was running sometimes appearing twice in the chat.
- [#3934](https://github.com/MoonshotAI/kimi-code/pull/3934) [`2e605b1`](https://github.com/MoonshotAI/kimi-code/commit/2e605b10be906fb627c1f3aeaaa066b14ddbdbba) Thanks [@liruifengv](https://github.com/liruifengv)! - web: Improved interactions and fixed known bugs.
## 2.0.1
### Patch Changes
- [#3878](https://github.com/MoonshotAI/kimi-code/pull/3878) [`f233f9d`](https://github.com/MoonshotAI/kimi-code/commit/f233f9de04d71c42d27df870b18e1bc1a6605f16) Thanks [@7Sageer](https://github.com/7Sageer)! - Stop listing unavailable media tools in subagent menus and clarify Read errors for images and videos.
- [#3762](https://github.com/MoonshotAI/kimi-code/pull/3762) [`c5ad17f`](https://github.com/MoonshotAI/kimi-code/commit/c5ad17f06aa12702d2b30dff63acba9ed08f688d) Thanks [@7Sageer](https://github.com/7Sageer)! - Providers can read their API key from a named environment variable (`api_key_env` in `config.toml` or the provider API).
- [#3896](https://github.com/MoonshotAI/kimi-code/pull/3896) [`73ebe9a`](https://github.com/MoonshotAI/kimi-code/commit/73ebe9ab2fbf9bf0ffc8fe5a5375060ce8e984b5) Thanks [@sailist](https://github.com/sailist)! - Keep follow-up messages sent during a turn from appearing twice after a session reload.
- [#3889](https://github.com/MoonshotAI/kimi-code/pull/3889) [`5108cad`](https://github.com/MoonshotAI/kimi-code/commit/5108cad9b65845ae992520dcf732cbbccc6a34b9) Thanks [@huangzheng2016](https://github.com/huangzheng2016)! - Compact the session index on startup when many entries point to deleted sessions.
- [#3889](https://github.com/MoonshotAI/kimi-code/pull/3889) [`5108cad`](https://github.com/MoonshotAI/kimi-code/commit/5108cad9b65845ae992520dcf732cbbccc6a34b9) Thanks [@huangzheng2016](https://github.com/huangzheng2016)! - Start the CLI faster by removing a duplicate skills directory scan.
- [#3889](https://github.com/MoonshotAI/kimi-code/pull/3889) [`5108cad`](https://github.com/MoonshotAI/kimi-code/commit/5108cad9b65845ae992520dcf732cbbccc6a34b9) Thanks [@huangzheng2016](https://github.com/huangzheng2016)! - Open the session list and resume sessions faster on workspaces with many sessions.
- [#3889](https://github.com/MoonshotAI/kimi-code/pull/3889) [`5108cad`](https://github.com/MoonshotAI/kimi-code/commit/5108cad9b65845ae992520dcf732cbbccc6a34b9) Thanks [@huangzheng2016](https://github.com/huangzheng2016)! - Resume long sessions faster.
- [#3889](https://github.com/MoonshotAI/kimi-code/pull/3889) [`5108cad`](https://github.com/MoonshotAI/kimi-code/commit/5108cad9b65845ae992520dcf732cbbccc6a34b9) Thanks [@huangzheng2016](https://github.com/huangzheng2016)! - Index sessions for search in capped, incremental background passes, tunable via the [database] searchSyncSessionCap and searchSyncDebounceMs settings.
- [#3864](https://github.com/MoonshotAI/kimi-code/pull/3864) [`25dd4ce`](https://github.com/MoonshotAI/kimi-code/commit/25dd4ce97345c7ebfd9c036898e5eef955c45ea8) Thanks [@wbxl2000](https://github.com/wbxl2000)! - Rename the kimi install-app subcommand to kimi install-desktop; the old name keeps working as a hidden alias.
- [#3910](https://github.com/MoonshotAI/kimi-code/pull/3910) [`7dc253c`](https://github.com/MoonshotAI/kimi-code/commit/7dc253c5cefac7c277e5fc7071acf3e855fd503e) Thanks [@sailist](https://github.com/sailist)! - Restore thinking display for OpenAI-compatible providers that send a reasoning string next to an unrecognized reasoning_details array.
- [#3875](https://github.com/MoonshotAI/kimi-code/pull/3875) [`c1047a6`](https://github.com/MoonshotAI/kimi-code/commit/c1047a6bbe0e37d097e5da54d92dd3fb1b7a28da) Thanks [@7Sageer](https://github.com/7Sageer)! - Fix `kimi -p` exiting early and cancelling the active turn when a cron task fires.
- [#3894](https://github.com/MoonshotAI/kimi-code/pull/3894) [`910aba2`](https://github.com/MoonshotAI/kimi-code/commit/910aba273e2bee3a8815666a3a9c4fff609f2366) Thanks [@7Sageer](https://github.com/7Sageer)! - Drop literal decision clauses from the system prompt and the auto permission mode reminder.
- [#3889](https://github.com/MoonshotAI/kimi-code/pull/3889) [`5108cad`](https://github.com/MoonshotAI/kimi-code/commit/5108cad9b65845ae992520dcf732cbbccc6a34b9) Thanks [@huangzheng2016](https://github.com/huangzheng2016)! - Restore sessions with large file-edit histories faster.
- [#3889](https://github.com/MoonshotAI/kimi-code/pull/3889) [`5108cad`](https://github.com/MoonshotAI/kimi-code/commit/5108cad9b65845ae992520dcf732cbbccc6a34b9) Thanks [@huangzheng2016](https://github.com/huangzheng2016)! - Serve session transcript APIs faster on repeated calls.
- [#3885](https://github.com/MoonshotAI/kimi-code/pull/3885) [`5acc863`](https://github.com/MoonshotAI/kimi-code/commit/5acc863ae60c092457bd9ecdde55266b5fad7040) Thanks [@starquakee](https://github.com/starquakee)! - select_tools now points out already-available tools to call directly and suggests announced names for near-miss selections.
- [#3887](https://github.com/MoonshotAI/kimi-code/pull/3887) [`e3f48a2`](https://github.com/MoonshotAI/kimi-code/commit/e3f48a225bbedbe167b30510e67d66ee67fcb0ec) Thanks [@RealKai42](https://github.com/RealKai42)! - Fix deleting or archiving a session sometimes never finishing.
- [#3891](https://github.com/MoonshotAI/kimi-code/pull/3891) [`53e5e3f`](https://github.com/MoonshotAI/kimi-code/commit/53e5e3fca6bf377662bc4d61d220dde4ded8e7b7) Thanks [@sailist](https://github.com/sailist)! - Keep follow-up messages sent during a turn attached to that turn in the conversation history.
- [#3906](https://github.com/MoonshotAI/kimi-code/pull/3906) [`60f2a63`](https://github.com/MoonshotAI/kimi-code/commit/60f2a63278f28b77d9358cf589b2da6193bd2614) Thanks [@sailist](https://github.com/sailist)! - Keep a follow-up sent during a turn as one message, and undo the host turn instead of the follow-up alone.
- [#3879](https://github.com/MoonshotAI/kimi-code/pull/3879) [`1fddc16`](https://github.com/MoonshotAI/kimi-code/commit/1fddc16e3ea2de4c26a18acd764380adf9e2ed64) Thanks [@7Sageer](https://github.com/7Sageer)! - Remove the system-prompt rule that forbade all file access outside the working directory.
- [#3892](https://github.com/MoonshotAI/kimi-code/pull/3892) [`a80fe31`](https://github.com/MoonshotAI/kimi-code/commit/a80fe31cff0ebae686e60d7d5d0559ad2d2e843d) Thanks [@sailist](https://github.com/sailist)! - Stop workspace file watchers from scanning an unbounded project root, and add `[watch] enabled` / `KIMI_CODE_WATCH` to disable watching entirely.
- [#3869](https://github.com/MoonshotAI/kimi-code/pull/3869) [`86e0820`](https://github.com/MoonshotAI/kimi-code/commit/86e08208e3445171f6500c948234d7e3a0684324) Thanks [@sailist](https://github.com/sailist)! - Stop asking for approval of bash commands that cannot be statically analyzed in Ask When Needed permission mode.
## 2.0.0
### Major Changes
- [#3849](https://github.com/MoonshotAI/kimi-code/pull/3849) [`34ec5d2`](https://github.com/MoonshotAI/kimi-code/commit/34ec5d2a1700e540c39d2a1b6c905c9fa96af2db) Thanks [@wbxl2000](https://github.com/wbxl2000)! - Add the /desktop slash command (alias /install-desktop) and the kimi install-app subcommand to open the Kimi Code desktop app page in the browser.
### Minor Changes
- [#3851](https://github.com/MoonshotAI/kimi-code/pull/3851) [`faec32c`](https://github.com/MoonshotAI/kimi-code/commit/faec32c7e7c1df5d27b7060f75a2a665efb59268) Thanks [@Grapedge](https://github.com/Grapedge)! - Render mermaid code blocks as diagrams in the terminal; turn it off under /settings → Mermaid diagrams, or set `mermaid = "off"` in the `[markdown]` section of tui.toml.
### Patch Changes
- [#3838](https://github.com/MoonshotAI/kimi-code/pull/3838) [`f4e5822`](https://github.com/MoonshotAI/kimi-code/commit/f4e5822164800ec138f77b0f323e2374963bfe19) Thanks [@sailist](https://github.com/sailist)! - Fix an occasional crash when a running turn is canceled.
- [#3802](https://github.com/MoonshotAI/kimi-code/pull/3802) [`c72a202`](https://github.com/MoonshotAI/kimi-code/commit/c72a20270e5078987a65e63b3741d8c778f4e02e) Thanks [@Grapedge](https://github.com/Grapedge)! - Highlight diff code blocks.
- [#3844](https://github.com/MoonshotAI/kimi-code/pull/3844) [`0cf413f`](https://github.com/MoonshotAI/kimi-code/commit/0cf413f7759c314766ba30250a9875ac1af1185e) Thanks [@Grapedge](https://github.com/Grapedge)! - Fix a steered message appearing twice after interrupting the turn.
- [#3848](https://github.com/MoonshotAI/kimi-code/pull/3848) [`b4d0b8a`](https://github.com/MoonshotAI/kimi-code/commit/b4d0b8a3889c1a6f0115c527341ccd2066bd180a) Thanks [@Grapedge](https://github.com/Grapedge)! - Fix @ file mentions duplicating or dropping the path when accepting a suggestion while still typing.
- [#3828](https://github.com/MoonshotAI/kimi-code/pull/3828) [`2bb6e12`](https://github.com/MoonshotAI/kimi-code/commit/2bb6e12c7e3ecc19521d21fcffc832075ed13200) Thanks [@wbxl2000](https://github.com/wbxl2000)! - Fix duplicate user messages when steering an ongoing conversation.
- [#3832](https://github.com/MoonshotAI/kimi-code/pull/3832) [`1c7e996`](https://github.com/MoonshotAI/kimi-code/commit/1c7e996aa8bdd7a6f32447f1d89e43c0646b41bc) Thanks [@chengluyu](https://github.com/chengluyu)! - Fix files attached while steering an ongoing conversation appearing only after a reload.
- [#3853](https://github.com/MoonshotAI/kimi-code/pull/3853) [`bd06178`](https://github.com/MoonshotAI/kimi-code/commit/bd06178913d2cc4ebd229ecee6714081105e5ae1) Thanks [@wbxl2000](https://github.com/wbxl2000)! - Keep the original prompt visible when steering a running turn, instead of replacing it with the steered text.
- [#3832](https://github.com/MoonshotAI/kimi-code/pull/3832) [`1c7e996`](https://github.com/MoonshotAI/kimi-code/commit/1c7e996aa8bdd7a6f32447f1d89e43c0646b41bc) Thanks [@chengluyu](https://github.com/chengluyu)! - Fix slash commands sent while steering an ongoing conversation missing from the transcript.
- [#3837](https://github.com/MoonshotAI/kimi-code/pull/3837) [`cafd9b5`](https://github.com/MoonshotAI/kimi-code/commit/cafd9b5a65509fe57332cbc0eb1fb19f0443fb0e) Thanks [@wbxl2000](https://github.com/wbxl2000)! - Fix missing and reappearing chat messages after undoing a steered message.
- [#3818](https://github.com/MoonshotAI/kimi-code/pull/3818) [`19ce4b3`](https://github.com/MoonshotAI/kimi-code/commit/19ce4b3f0600c846e2f28828d8169829630fc666) Thanks [@liruifengv](https://github.com/liruifengv)! - Fix /usage showing a wrong error message when no session has been created yet.
- [#3784](https://github.com/MoonshotAI/kimi-code/pull/3784) [`5653c73`](https://github.com/MoonshotAI/kimi-code/commit/5653c739b9c0dbafd1e4b3d36edeb0fe44ec71f4) Thanks [@7Sageer](https://github.com/7Sageer)! - Images sent to Kimi models are uploaded as file references instead of inline data, and a warning is shown when media are dropped from a retried request.
- [#3778](https://github.com/MoonshotAI/kimi-code/pull/3778) [`7d174ac`](https://github.com/MoonshotAI/kimi-code/commit/7d174ac93352ccfc835d186ac7b8185d0194e6b5) Thanks [@huangzheng2016](https://github.com/huangzheng2016)! - Limit memory growth from finished subagents.
- [#3778](https://github.com/MoonshotAI/kimi-code/pull/3778) [`7d174ac`](https://github.com/MoonshotAI/kimi-code/commit/7d174ac93352ccfc835d186ac7b8185d0194e6b5) Thanks [@huangzheng2016](https://github.com/huangzheng2016)! - Report background subagents that time out or are stopped as cancelled instead of failed.
- [#3846](https://github.com/MoonshotAI/kimi-code/pull/3846) [`31f1b68`](https://github.com/MoonshotAI/kimi-code/commit/31f1b6824d1900aeea71b69c824c6354a0dd9019) Thanks [@7Sageer](https://github.com/7Sageer)! - Fix OAuth login never triggering for MCP servers that allow anonymous tool discovery but reject tool calls with 401.
- [#3784](https://github.com/MoonshotAI/kimi-code/pull/3784) [`5653c73`](https://github.com/MoonshotAI/kimi-code/commit/5653c739b9c0dbafd1e4b3d36edeb0fe44ec71f4) Thanks [@7Sageer](https://github.com/7Sageer)! - When accumulated images and videos exceed the request size budget, the oldest media are omitted from requests with a warning instead of failing.
- [#3778](https://github.com/MoonshotAI/kimi-code/pull/3778) [`7d174ac`](https://github.com/MoonshotAI/kimi-code/commit/7d174ac93352ccfc835d186ac7b8185d0194e6b5) Thanks [@huangzheng2016](https://github.com/huangzheng2016)! - Report tools and subagents interrupted by the user as cancelled instead of aborted or failed.
- [#3803](https://github.com/MoonshotAI/kimi-code/pull/3803) [`39a7455`](https://github.com/MoonshotAI/kimi-code/commit/39a74556a662a96293e9838663e91b31dbdc7a0b) Thanks [@kimi-agent-bot](https://github.com/kimi-agent-bot)! - The built-in browser plugin now appears as "Kimi Browser Extension" in the plugins panel, marketplace catalog, and docs, matching the product rename.
- [#3858](https://github.com/MoonshotAI/kimi-code/pull/3858) [`95d4a9d`](https://github.com/MoonshotAI/kimi-code/commit/95d4a9d0411b18f468345717c01c40f5ac996cdc) Thanks [@liruifengv](https://github.com/liruifengv)! - Sign the Windows CLI executable with a trusted publisher certificate.
- [#3795](https://github.com/MoonshotAI/kimi-code/pull/3795) [`a7bdabb`](https://github.com/MoonshotAI/kimi-code/commit/a7bdabbe82a089cd8631f6d613c252d96cbab639) Thanks [@Grapedge](https://github.com/Grapedge)! - Feedback surveys now appear at better times in long conversations.
- [#3833](https://github.com/MoonshotAI/kimi-code/pull/3833) [`8660a07`](https://github.com/MoonshotAI/kimi-code/commit/8660a07b3a0b7984971371d77f316e802e5e83fe) Thanks [@tpoisonooo](https://github.com/tpoisonooo)! - Fix tower worker cards wrongly showing "completed" during rework.
- [#3840](https://github.com/MoonshotAI/kimi-code/pull/3840) [`9c5e9b4`](https://github.com/MoonshotAI/kimi-code/commit/9c5e9b48634be1dfae921fb48f9afc3a23ffd1ad) Thanks [@chengluyu](https://github.com/chengluyu)! - Fix a Windows crash when a project or config folder is opened through a short 8.3 path.
## 0.43.1
### Patch Changes
- [#3780](https://github.com/MoonshotAI/kimi-code/pull/3780) [`486dcd2`](https://github.com/MoonshotAI/kimi-code/commit/486dcd26c76f2854fc351515a45d8f0fc2d31ed6) Thanks [@Grapedge](https://github.com/Grapedge)! - Update the terminal UI engine, fixing link colors in wrapped markdown tables and `@` file-completion ordering, and adding native clipboard support on Linux X11.
- [#3776](https://github.com/MoonshotAI/kimi-code/pull/3776) [`48fad6e`](https://github.com/MoonshotAI/kimi-code/commit/48fad6e7d9cd00511c6118e84ae6d22dafb96be9) Thanks [@huangzheng2016](https://github.com/huangzheng2016)! - Fix memory not being released when subagent scopes are disposed.
- [#3777](https://github.com/MoonshotAI/kimi-code/pull/3777) [`dc76b0c`](https://github.com/MoonshotAI/kimi-code/commit/dc76b0caaa6e0aa406bf87957e6b5f8aca722221) Thanks [@huangzheng2016](https://github.com/huangzheng2016)! - Fix progressively slower rendering on each round of large agent swarm runs.
- [#3631](https://github.com/MoonshotAI/kimi-code/pull/3631) [`1336be3`](https://github.com/MoonshotAI/kimi-code/commit/1336be38777959cc558fed2b51dc53caa07da5db) Thanks [@wbxl2000](https://github.com/wbxl2000)! - Stop returning deleted sessions from global search before the search index catches up.
- [#3775](https://github.com/MoonshotAI/kimi-code/pull/3775) [`f248624`](https://github.com/MoonshotAI/kimi-code/commit/f2486241fb5e268d7a43cb589b5c2d59af8db571) Thanks [@huangzheng2016](https://github.com/huangzheng2016)! - Reduce event-loop stalls and GC churn in sessions with many concurrent subagents.
- [#3779](https://github.com/MoonshotAI/kimi-code/pull/3779) [`82ec469`](https://github.com/MoonshotAI/kimi-code/commit/82ec469e47eed52feb664fd361e3d8dcb774596e) Thanks [@huangzheng2016](https://github.com/huangzheng2016)! - Fix pressing Ctrl+C while subagents are running exiting the whole CLI instead of just interrupting the subagents.
- [#3752](https://github.com/MoonshotAI/kimi-code/pull/3752) [`0725ef1`](https://github.com/MoonshotAI/kimi-code/commit/0725ef1ce0a7f9c15db7ffc042f57308657b3ee6) Thanks [@tpoisonooo](https://github.com/tpoisonooo)! - Fix tower mode mistaking newly spawned agents for previous sessions' roster entries.
## 0.43.0
### Minor Changes
- [#3749](https://github.com/MoonshotAI/kimi-code/pull/3749) [`6126472`](https://github.com/MoonshotAI/kimi-code/commit/6126472c7af421070f09c470c5750455dd277657) Thanks [@liruifengv](https://github.com/liruifengv)! - web: AI session titles are now always on — a title is generated after the first turn and can be regenerated from the rename field, with no experimental flag required.
- [#3670](https://github.com/MoonshotAI/kimi-code/pull/3670) [`a9efbe0`](https://github.com/MoonshotAI/kimi-code/commit/a9efbe053f966104d4b51090118da5135c084e22) Thanks [@Grapedge](https://github.com/Grapedge)! - Delete sessions from the session picker: press Ctrl+X on a session, then y to confirm.
### Patch Changes
- [#3763](https://github.com/MoonshotAI/kimi-code/pull/3763) [`dd6a411`](https://github.com/MoonshotAI/kimi-code/commit/dd6a4116ddfcc56cb3d37b0c1d526d64cb36086b) Thanks [@liruifengv](https://github.com/liruifengv)! - web: add user agreement and privacy policy entries to the Settings → About page.
- [#3750](https://github.com/MoonshotAI/kimi-code/pull/3750) [`775a6c3`](https://github.com/MoonshotAI/kimi-code/commit/775a6c35de40e6dd8cc399cc848f95818733ee7c) Thanks [@7Sageer](https://github.com/7Sageer)! - Add the `loop_control.compaction_max_attempts` config option to set the maximum total attempts for a failing compaction request (default 5).
- [#3667](https://github.com/MoonshotAI/kimi-code/pull/3667) [`9296e68`](https://github.com/MoonshotAI/kimi-code/commit/9296e6877032328fcd9cf1d145f9286bec140897) Thanks [@sailist](https://github.com/sailist)! - Add the dynamically_loaded_tools capability to official Kimi Code models when the service declares support for message-level tool declarations.
- [#3763](https://github.com/MoonshotAI/kimi-code/pull/3763) [`dd6a411`](https://github.com/MoonshotAI/kimi-code/commit/dd6a4116ddfcc56cb3d37b0c1d526d64cb36086b) Thanks [@liruifengv](https://github.com/liruifengv)! - web: fix sessions containing many brackets or backslashes getting stuck while loading.
- [#3734](https://github.com/MoonshotAI/kimi-code/pull/3734) [`ee2cac1`](https://github.com/MoonshotAI/kimi-code/commit/ee2cac102b835fcd7adb3d4b9bc3d62b0b71cdfd) Thanks [@kimi-agent-bot](https://github.com/kimi-agent-bot)! - Fix a crash that killed the process when a retried LLM request had streamed a partial tool call before disconnecting.
- [#3763](https://github.com/MoonshotAI/kimi-code/pull/3763) [`dd6a411`](https://github.com/MoonshotAI/kimi-code/commit/dd6a4116ddfcc56cb3d37b0c1d526d64cb36086b) Thanks [@liruifengv](https://github.com/liruifengv)! - web: fix persistent UI stuttering while streaming in long sessions.
- [#3763](https://github.com/MoonshotAI/kimi-code/pull/3763) [`dd6a411`](https://github.com/MoonshotAI/kimi-code/commit/dd6a4116ddfcc56cb3d37b0c1d526d64cb36086b) Thanks [@liruifengv](https://github.com/liruifengv)! - web: fix certain formulas, links, tool results, and log contents causing the UI to stutter or become unresponsive.
- [#3763](https://github.com/MoonshotAI/kimi-code/pull/3763) [`dd6a411`](https://github.com/MoonshotAI/kimi-code/commit/dd6a4116ddfcc56cb3d37b0c1d526d64cb36086b) Thanks [@liruifengv](https://github.com/liruifengv)! - web: fix the send button staying disabled when starting a new session.
- [#3763](https://github.com/MoonshotAI/kimi-code/pull/3763) [`dd6a411`](https://github.com/MoonshotAI/kimi-code/commit/dd6a4116ddfcc56cb3d37b0c1d526d64cb36086b) Thanks [@liruifengv](https://github.com/liruifengv)! - web: fix previous sessions being wrongly marked as unread and triggering "turn complete" notifications after starting a new conversation.
- [#3763](https://github.com/MoonshotAI/kimi-code/pull/3763) [`dd6a411`](https://github.com/MoonshotAI/kimi-code/commit/dd6a4116ddfcc56cb3d37b0c1d526d64cb36086b) Thanks [@liruifengv](https://github.com/liruifengv)! - web: render Markdown frontmatter metadata as key-value cards and tag lists.
- [#3688](https://github.com/MoonshotAI/kimi-code/pull/3688) [`9f7e68e`](https://github.com/MoonshotAI/kimi-code/commit/9f7e68e8bdb70d3e5cde5a924740e357ede2fc40) Thanks [@RealKai42](https://github.com/RealKai42)! - Preserve MCP attachments that cannot be delivered directly to the model.
- [#3667](https://github.com/MoonshotAI/kimi-code/pull/3667) [`9296e68`](https://github.com/MoonshotAI/kimi-code/commit/9296e6877032328fcd9cf1d145f9286bec140897) Thanks [@sailist](https://github.com/sailist)! - Add a per-server `deferred` field to MCP server configuration: when the model supports dynamic tool loading (experimental `tool-select` flag), set `deferred: true` to keep a server's tools out of the top-level tool list and load them on demand via `select_tools`; servers are exposed inline by default.
- [#3763](https://github.com/MoonshotAI/kimi-code/pull/3763) [`dd6a411`](https://github.com/MoonshotAI/kimi-code/commit/dd6a4116ddfcc56cb3d37b0c1d526d64cb36086b) Thanks [@liruifengv](https://github.com/liruifengv)! - web: drop the Changes entry from the panel new-tab menu while a diff tab is open.
- [#3657](https://github.com/MoonshotAI/kimi-code/pull/3657) [`5b3b5b6`](https://github.com/MoonshotAI/kimi-code/commit/5b3b5b6f7cfa4e9cca2a394632d52f8748dc8190) Thanks [@chengluyu](https://github.com/chengluyu)! - Exclude time spent with the session closed from goal time budgets.
- [#3728](https://github.com/MoonshotAI/kimi-code/pull/3728) [`b180725`](https://github.com/MoonshotAI/kimi-code/commit/b1807253c34e12b0ecf60c9b4da3890d0c80ce72) Thanks [@kimi-agent-bot](https://github.com/kimi-agent-bot)! - Add the `KIMI_CODE_PERMISSION_MODE_REMINDER` environment variable: set it to `0` to stop injecting the auto permission-mode reminders into the model context.
- [#3696](https://github.com/MoonshotAI/kimi-code/pull/3696) [`d3dc594`](https://github.com/MoonshotAI/kimi-code/commit/d3dc5945548d3353a5e6cfc457a3a8cf84d7da71) Thanks [@sailist](https://github.com/sailist)! - Include the server token in the Remote Control Local UI link so it opens already signed in.
- [#3709](https://github.com/MoonshotAI/kimi-code/pull/3709) [`306f6f6`](https://github.com/MoonshotAI/kimi-code/commit/306f6f69251d65fda434463433c0761758eacb16) Thanks [@sailist](https://github.com/sailist)! - Fix Remote Control uploads larger than ~3.5MB always failing with a 400 error.
- [#3718](https://github.com/MoonshotAI/kimi-code/pull/3718) [`ab9e688`](https://github.com/MoonshotAI/kimi-code/commit/ab9e688cd0c753bd3cea3406a9e9194c73ab2239) Thanks [@sailist](https://github.com/sailist)! - Reuse unchanged Remote Control assets across page loads instead of retransferring them.
- [#3657](https://github.com/MoonshotAI/kimi-code/pull/3657) [`5b3b5b6`](https://github.com/MoonshotAI/kimi-code/commit/5b3b5b6f7cfa4e9cca2a394632d52f8748dc8190) Thanks [@chengluyu](https://github.com/chengluyu)! - Remove the 24-hour limit on goal time budgets.
- [#3714](https://github.com/MoonshotAI/kimi-code/pull/3714) [`565093f`](https://github.com/MoonshotAI/kimi-code/commit/565093f727eee07e2aa05f43859fa12b9e977989) Thanks [@sailist](https://github.com/sailist)! - Skip the confirmation prompt for rm -rf commands that target only /tmp or /temp paths.
- [#3667](https://github.com/MoonshotAI/kimi-code/pull/3667) [`9296e68`](https://github.com/MoonshotAI/kimi-code/commit/9296e6877032328fcd9cf1d145f9286bec140897) Thanks [@sailist](https://github.com/sailist)! - Fix the select_tools tool never being registered because agent profiles do not list it in their tool allowlists.
- [#3763](https://github.com/MoonshotAI/kimi-code/pull/3763) [`dd6a411`](https://github.com/MoonshotAI/kimi-code/commit/dd6a4116ddfcc56cb3d37b0c1d526d64cb36086b) Thanks [@liruifengv](https://github.com/liruifengv)! - web: restructure the Settings pages — Account moves right after General, Agent is renamed to Agents & Sessions and now includes message folding, Advanced is renamed to About, and data & privacy settings move into General.
- [#3763](https://github.com/MoonshotAI/kimi-code/pull/3763) [`dd6a411`](https://github.com/MoonshotAI/kimi-code/commit/dd6a4116ddfcc56cb3d37b0c1d526d64cb36086b) Thanks [@liruifengv](https://github.com/liruifengv)! - web: fix the selected segment background flashing and shifting while the Settings segmented control loads.
- [#3697](https://github.com/MoonshotAI/kimi-code/pull/3697) [`5e452fc`](https://github.com/MoonshotAI/kimi-code/commit/5e452fc2ddf5a0d9feedfbf3c7cdde4246fc44b6) Thanks [@RealKai42](https://github.com/RealKai42)! - Allow steering messages to interrupt waits for background tasks.
- [#3763](https://github.com/MoonshotAI/kimi-code/pull/3763) [`dd6a411`](https://github.com/MoonshotAI/kimi-code/commit/dd6a4116ddfcc56cb3d37b0c1d526d64cb36086b) Thanks [@liruifengv](https://github.com/liruifengv)! - web: fix the switch thumb deforming at both ends when stretched on hover.
- [#3763](https://github.com/MoonshotAI/kimi-code/pull/3763) [`dd6a411`](https://github.com/MoonshotAI/kimi-code/commit/dd6a4116ddfcc56cb3d37b0c1d526d64cb36086b) Thanks [@liruifengv](https://github.com/liruifengv)! - web: fix tooltips popping up even when the mouse has not moved.
- [#3648](https://github.com/MoonshotAI/kimi-code/pull/3648) [`2da4aa2`](https://github.com/MoonshotAI/kimi-code/commit/2da4aa23b0d484312cc068b2d4b2a62e694a2bfe) Thanks [@tpoisonooo](https://github.com/tpoisonooo)! - Tower mode reliability fixes across messaging, worktrees, and the review-to-merge gate.
- [#3707](https://github.com/MoonshotAI/kimi-code/pull/3707) [`e409bc8`](https://github.com/MoonshotAI/kimi-code/commit/e409bc8ba582c9f390146eca08812d22790c81f8) Thanks [@sailist](https://github.com/sailist)! - Compress Remote Control tunnel responses with gzip.
- [#3702](https://github.com/MoonshotAI/kimi-code/pull/3702) [`42998cf`](https://github.com/MoonshotAI/kimi-code/commit/42998cfc13cb03914256587f0b702ec95e2d156c) Thanks [@sailist](https://github.com/sailist)! - Add `-y, --yes` to `kimi upgrade` (alias `kimi update`) to skip the confirmation prompt and install the update directly.
- [#3681](https://github.com/MoonshotAI/kimi-code/pull/3681) [`1306a9a`](https://github.com/MoonshotAI/kimi-code/commit/1306a9a8dbd5acd9532182c36edcabbc7e8de807) Thanks [@7Sageer](https://github.com/7Sageer)! - Warn at startup when a [models] entry in config.toml is missing the model field and cannot be used.
## 0.42.0
### Minor Changes
- [#3613](https://github.com/MoonshotAI/kimi-code/pull/3613) [`d4d20d2`](https://github.com/MoonshotAI/kimi-code/commit/d4d20d21d733a7942056c15ffcc2c74cce51f7d5) Thanks [@liukx0205](https://github.com/liukx0205)! - Add read-only tools to the /btw side agent.
- [#3524](https://github.com/MoonshotAI/kimi-code/pull/3524) [`f6a9c39`](https://github.com/MoonshotAI/kimi-code/commit/f6a9c39e22a63b2a231684ed8426bfe4ec406cf7) Thanks [@RealKai42](https://github.com/RealKai42)! - Add an experimental Updates panel with paginated progress messages from the main agent and subagents; enable it with `KIMI_CODE_EXPERIMENTAL_NOTIFY_USER=1`.
- [#3634](https://github.com/MoonshotAI/kimi-code/pull/3634) [`e831fd1`](https://github.com/MoonshotAI/kimi-code/commit/e831fd1ea9488ad5192bcc9d96579470cf0c4442) Thanks [@7Sageer](https://github.com/7Sageer)! - The subagent model pool (`[secondary_model]`) is now always on; the experimental secondary-model flag and the `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL` opt-out have been removed.
- [#3671](https://github.com/MoonshotAI/kimi-code/pull/3671) [`e6bc8b8`](https://github.com/MoonshotAI/kimi-code/commit/e6bc8b8ad90def151f17e8e1d4b03b408d9f69ea) Thanks [@liruifengv](https://github.com/liruifengv)! - web: support permanently deleting sessions from the session row context menu, with a confirmation prompt.
- [#3526](https://github.com/MoonshotAI/kimi-code/pull/3526) [`55685c5`](https://github.com/MoonshotAI/kimi-code/commit/55685c58b5dbff692e16c66efa65fa6d32222f61) Thanks [@RealKai42](https://github.com/RealKai42)! - Stop reminding the model of its context budget before automatic compaction.
- [#3671](https://github.com/MoonshotAI/kimi-code/pull/3671) [`e6bc8b8`](https://github.com/MoonshotAI/kimi-code/commit/e6bc8b8ad90def151f17e8e1d4b03b408d9f69ea) Thanks [@liruifengv](https://github.com/liruifengv)! - web: preview images and videos in a reorderable media rail in the composer, mention them in the text on demand, and keep the previews after queueing and sending.
### Patch Changes
- [#3671](https://github.com/MoonshotAI/kimi-code/pull/3671) [`e6bc8b8`](https://github.com/MoonshotAI/kimi-code/commit/e6bc8b8ad90def151f17e8e1d4b03b408d9f69ea) Thanks [@liruifengv](https://github.com/liruifengv)! - web: fix the conversation scrollbar being too thin to click and drag easily.
- [#3539](https://github.com/MoonshotAI/kimi-code/pull/3539) [`34ad513`](https://github.com/MoonshotAI/kimi-code/commit/34ad5137ce36f6eb03c4a42145e9bdcc8d607d87) Thanks [@RealKai42](https://github.com/RealKai42)! - Collapse finished tool calls in the transcript to a header plus one marked outcome row: short output is shown whole, hidden output is counted (`N more lines`, `+N more`) and revealed by `Ctrl+O`, which the footer advertises while it is available.
- [#3537](https://github.com/MoonshotAI/kimi-code/pull/3537) [`f12d59e`](https://github.com/MoonshotAI/kimi-code/commit/f12d59e089e2531a33fbca30b26ffeabd5862b45) Thanks [@7Sageer](https://github.com/7Sageer)! - Fix the agent resuming the wrong request after automatic context compaction in long sessions.
- [#3552](https://github.com/MoonshotAI/kimi-code/pull/3552) [`f0434f2`](https://github.com/MoonshotAI/kimi-code/commit/f0434f2d25ead11d44f5616930157a59dfd524a5) Thanks [@sailist](https://github.com/sailist)! - The minidb session-index read model and global search worker are now always on; the experimental flags have been replaced by the `[database]` config section and the `KIMI_CODE_PERSISTENCE_MINIDB_READMODEL` / `KIMI_CODE_SEARCH_WORKER` env vars.
- [#3671](https://github.com/MoonshotAI/kimi-code/pull/3671) [`e6bc8b8`](https://github.com/MoonshotAI/kimi-code/commit/e6bc8b8ad90def151f17e8e1d4b03b408d9f69ea) Thanks [@liruifengv](https://github.com/liruifengv)! - web: fix background task notifications lingering at the bottom of the session during subsequent tool calls.
- [#3658](https://github.com/MoonshotAI/kimi-code/pull/3658) [`ff7371b`](https://github.com/MoonshotAI/kimi-code/commit/ff7371b70a7ae80ec70712b610f73e6d6f29edc0) Thanks [@RealKai42](https://github.com/RealKai42)! - Allow file searches to retrieve matches beyond the first 100 results.
- [#3652](https://github.com/MoonshotAI/kimi-code/pull/3652) [`7f5debf`](https://github.com/MoonshotAI/kimi-code/commit/7f5debfa71ac9e4a23b5dab1a511aa3672677381) Thanks [@RealKai42](https://github.com/RealKai42)! - Accept HEIC, HEIF, and BMP images on a session's first prompt when the configured default model is served by Kimi and no model has been selected yet.
- [#3649](https://github.com/MoonshotAI/kimi-code/pull/3649) [`80480c0`](https://github.com/MoonshotAI/kimi-code/commit/80480c01d27a921d4660ad043e78c8b61167f82b) Thanks [@RealKai42](https://github.com/RealKai42)! - Accept HEIC, HEIF, and BMP images in ReadMediaFile and prompt attachments when the model is served by Kimi.
- [#3671](https://github.com/MoonshotAI/kimi-code/pull/3671) [`e6bc8b8`](https://github.com/MoonshotAI/kimi-code/commit/e6bc8b8ad90def151f17e8e1d4b03b408d9f69ea) Thanks [@liruifengv](https://github.com/liruifengv)! - web: fix page jank caused by hundreds of simultaneous requests when reloading a session with many background tasks.
- [#3654](https://github.com/MoonshotAI/kimi-code/pull/3654) [`6de0cec`](https://github.com/MoonshotAI/kimi-code/commit/6de0cec174ae3af44fc9f9f74b2aa8599b928fdf) Thanks [@RealKai42](https://github.com/RealKai42)! - Preserve distinct structured data in MCP tool results.
- [#3669](https://github.com/MoonshotAI/kimi-code/pull/3669) [`f8c606e`](https://github.com/MoonshotAI/kimi-code/commit/f8c606e7d7b33a43190721d47ec6c8a2076eaec6) Thanks [@wbxl2000](https://github.com/wbxl2000)! - Support compressed downloads from updated native release manifests.
- [#3671](https://github.com/MoonshotAI/kimi-code/pull/3671) [`e6bc8b8`](https://github.com/MoonshotAI/kimi-code/commit/e6bc8b8ad90def151f17e8e1d4b03b408d9f69ea) Thanks [@liruifengv](https://github.com/liruifengv)! - web: reduce jank when opening and scrolling back through long conversations, while preserving message and tool expansion state.
- [#3548](https://github.com/MoonshotAI/kimi-code/pull/3548) [`baf17a8`](https://github.com/MoonshotAI/kimi-code/commit/baf17a8fcc289f20fa6c8d85dd8f93eeb3ff0cbc) Thanks [@chengluyu](https://github.com/chengluyu)! - Preserve image and video filenames in session history.
- [#3645](https://github.com/MoonshotAI/kimi-code/pull/3645) [`5000f98`](https://github.com/MoonshotAI/kimi-code/commit/5000f981c3ef8b59560f26fd01a20fbfe030d81e) Thanks [@RealKai42](https://github.com/RealKai42)! - Add configurable character limits and resumable long-line file reads without repeated output truncation.
- [#3645](https://github.com/MoonshotAI/kimi-code/pull/3645) [`5000f98`](https://github.com/MoonshotAI/kimi-code/commit/5000f981c3ef8b59560f26fd01a20fbfe030d81e) Thanks [@RealKai42](https://github.com/RealKai42)! - Read malformed UTF-16 files with an explicit lossy-decoding warning.
- [#3645](https://github.com/MoonshotAI/kimi-code/pull/3645) [`5000f98`](https://github.com/MoonshotAI/kimi-code/commit/5000f981c3ef8b59560f26fd01a20fbfe030d81e) Thanks [@RealKai42](https://github.com/RealKai42)! - Avoid repeated scanning for common tail reads and report file changes detected during tail rereads.
- [#3616](https://github.com/MoonshotAI/kimi-code/pull/3616) [`260ac3f`](https://github.com/MoonshotAI/kimi-code/commit/260ac3faad1cf0ca84dca26173ddf66a09220841) Thanks [@Grapedge](https://github.com/Grapedge)! - Upgrade the default thinking effort to the recommended level for eligible users.
- [#3552](https://github.com/MoonshotAI/kimi-code/pull/3552) [`f0434f2`](https://github.com/MoonshotAI/kimi-code/commit/f0434f2d25ead11d44f5616930157a59dfd524a5) Thanks [@sailist](https://github.com/sailist)! - Remote Control is now always on; the experimental `KIMI_CODE_EXPERIMENTAL_REMOTE_CONTROL` flag has been removed.
- [#3618](https://github.com/MoonshotAI/kimi-code/pull/3618) [`75682b0`](https://github.com/MoonshotAI/kimi-code/commit/75682b0ef130e0340a9d16421312e2766c327be1) Thanks [@sailist](https://github.com/sailist)! - Fix recent sessions missing from the session list when the sessions directory contains stray files.
- [#3671](https://github.com/MoonshotAI/kimi-code/pull/3671) [`e6bc8b8`](https://github.com/MoonshotAI/kimi-code/commit/e6bc8b8ad90def151f17e8e1d4b03b408d9f69ea) Thanks [@liruifengv](https://github.com/liruifengv)! - web: fix skills created mid-session not appearing in the slash list until the app restarts.
- [#3671](https://github.com/MoonshotAI/kimi-code/pull/3671) [`e6bc8b8`](https://github.com/MoonshotAI/kimi-code/commit/e6bc8b8ad90def151f17e8e1d4b03b408d9f69ea) Thanks [@liruifengv](https://github.com/liruifengv)! - web: fix trailing backticks briefly flashing at the end of code blocks while they stream.
- [#3596](https://github.com/MoonshotAI/kimi-code/pull/3596) [`0d7833e`](https://github.com/MoonshotAI/kimi-code/commit/0d7833ee8019d39161f8462977a3a2713bbfd39e) Thanks [@tpoisonooo](https://github.com/tpoisonooo)! - The /tasks panel now shows each background agent's model under its task row.
- [#3607](https://github.com/MoonshotAI/kimi-code/pull/3607) [`5eea890`](https://github.com/MoonshotAI/kimi-code/commit/5eea89016511d113480755907619defafaf025cf) Thanks [@huangzheng2016](https://github.com/huangzheng2016)! - Fix the streaming debug timing attributing client-side busy time to the server.
- [#3596](https://github.com/MoonshotAI/kimi-code/pull/3596) [`0d7833e`](https://github.com/MoonshotAI/kimi-code/commit/0d7833ee8019d39161f8462977a3a2713bbfd39e) Thanks [@tpoisonooo](https://github.com/tpoisonooo)! - Tower worker and reviewer briefings now carry the full mission context, and tower agent timeouts follow the subagent timeout setting (`[subagent] timeout_ms` or `KIMI_SUBAGENT_TIMEOUT_MS`), defaulting to 2 hours. Fix the /tasks list not showing the model for tower-spawned agents.
- [#3593](https://github.com/MoonshotAI/kimi-code/pull/3593) [`00cfbb0`](https://github.com/MoonshotAI/kimi-code/commit/00cfbb0547cee6ec2650fd3fc52e15d2072c41aa) Thanks [@7Sageer](https://github.com/7Sageer)! - Print a warning in `kimi -p` when project-level MCP servers are skipped because the folder is not trusted.
- [#3608](https://github.com/MoonshotAI/kimi-code/pull/3608) [`fb0353a`](https://github.com/MoonshotAI/kimi-code/commit/fb0353a8ba5ceb7e8ae4e27f3260b3c8c8d80784) Thanks [@liukx0205](https://github.com/liukx0205)! - Watch the user-level skill roots (`~/.kimi-code/skills` and `~/.agents/skills`) so the workspace skill catalog refreshes automatically when skills are created, modified, or deleted while the daemon is running — no restart or manual reload needed.
- [#3560](https://github.com/MoonshotAI/kimi-code/pull/3560) [`af81bb9`](https://github.com/MoonshotAI/kimi-code/commit/af81bb92215dca2f933579ce0119f7add452bc96) Thanks [@kimi-agent-bot](https://github.com/kimi-agent-bot)! - Open the browser on localhost instead of the wildcard bind address for `kimi web --host 0.0.0.0`.
- [#3605](https://github.com/MoonshotAI/kimi-code/pull/3605) [`f1e9152`](https://github.com/MoonshotAI/kimi-code/commit/f1e915277655c68213cf91fe5010413bfde3cb65) Thanks [@huangzheng2016](https://github.com/huangzheng2016)! - Fix slow response streaming and rendering after resuming sessions with many scheduled cron turns.
## 0.41.0
### Minor Changes

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
import{bQ as H,M as J,aU as p,bE as S,az as O,aL as Q,s as F,v as I,I as K,bJ as W,bL as Z,aw as X,H as A,bb as ee,bB as te,g as le,au as ae,T as ne,as as Y,bR as oe}from"./index-8y9QBU_r.js";var k=(d,x,e)=>new Promise((n,s)=>{var r=i=>{try{c(e.next(i))}catch(v){s(v)}},y=i=>{try{c(e.throw(i))}catch(v){s(v)}},c=i=>i.done?n(i.value):Promise.resolve(i.value).then(r,y);c((e=e.apply(d,x)).next())});const ie=["id"],re=["data-placement"],se=H(J({__name:"Tooltip",props:{visible:{type:Boolean},anchorEl:{},content:{},placement:{},offset:{},originX:{},originY:{},id:{},isDark:{type:[Boolean,null]}},setup(d){var x;const e=d,n=p(null),s=p(null),r=p({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"}),y=p({}),c=p((x=e.placement)!=null?x:"top"),i=p(!1),v=p(!1);let E=null,M=null,R=null,P=null,w=null,f=0;function N(){return P?Promise.resolve(P):(w||(w=oe(()=>import("./floating-ui.dom-xGUaHE3m.js"),[]).then(a=>(P=a,a)).catch(a=>{throw w=null,a})),w)}function T(){E&&(E(),E=null),M=null,R=null}function D(a){return k(this,null,function*(){const t=e.anchorEl,l=n.value;if(!e.visible||!t||!l||M===t&&R===l)return;const{autoUpdate:o}=yield N();a()&&e.visible&&e.anchorEl===t&&n.value===l&&(T(),M=t,R=l,E=o(t,l,()=>{$().catch(()=>{B()})}))})}function $(){return k(this,null,function*(){var a,t;const l=e.anchorEl,o=n.value;if(!e.visible||!l||!o)return!1;const{arrow:u,computePosition:C,flip:h,offset:m,shift:b}=yield N();if(!e.visible||e.anchorEl!==l||n.value!==o)return!1;const g=[m((a=e.offset)!=null?a:6),h(),b({padding:6}),...s.value?[u({element:s.value,padding:4})]:[]],{x:j,y:q,placement:U,middlewareData:V}=yield C(l,o,{placement:(t=e.placement)!=null?t:"top",middleware:g,strategy:"fixed"});if(!e.visible||e.anchorEl!==l||n.value!==o)return!1;if(r.value.transform=`translate3d(${Math.round(j)}px, ${Math.round(q)}px, 0)`,r.value.left="0px",r.value.top="0px",c.value=U,V.arrow&&s.value){const{x:z,y:L}=V.arrow,G={top:"bottom",bottom:"top",left:"right",right:"left"}[U.split("-")[0]];y.value={left:z!=null?`${z}px`:"",top:L!=null?`${L}px`:"",[G]:"-3px"}}return!0})}function B(){var a,t;const l=e.anchorEl,o=n.value;if(!l||!o)return!1;const u=l.getBoundingClientRect(),C=o.getBoundingClientRect(),h=(a=e.offset)!=null?a:6,m=(t=e.placement)!=null?t:"top";let b=u.left,g=u.top;return m==="bottom"?g=u.bottom+h:m==="left"?b=u.left-C.width-h:m==="right"?b=u.right+h:g=u.top-C.height-h,r.value.transform=`translate3d(${Math.round(Math.max(0,b))}px, ${Math.round(Math.max(0,g))}px, 0)`,r.value.left="0px",r.value.top="0px",c.value=m,y.value={},!0}S(()=>e.visible,a=>k(null,null,function*(){const t=++f;if(a){if(i.value=!1,yield Y(),t!==f||!e.visible)return;if(e.anchorEl&&n.value)try{const l=e.anchorEl,o=n.value,u=l.getBoundingClientRect();if(!(yield $())||t!==f||!e.visible||e.anchorEl!==l||n.value!==o)return;v.value=!1,i.value=!0,yield D(()=>t===f)}catch{if(t!==f||!e.visible)return;if(i.value=B(),e.anchorEl&&n.value)try{yield D(()=>t===f)}catch{}}else i.value=!0}else T()}));let _=0;return S([()=>e.anchorEl,()=>e.placement,()=>e.content],([a],[t])=>k(null,null,function*(){v.value=!!(a&&t&&a!==t&&Math.hypot(a.getBoundingClientRect().left-t.getBoundingClientRect().left,a.getBoundingClientRect().top-t.getBoundingClientRect().top)<=120);const l=++_;if(e.visible&&e.anchorEl&&n.value){if(yield Y(),l!==_||!e.visible||!e.anchorEl||!n.value)return;try{const o=yield $();if(l!==_||!e.visible||!e.anchorEl||!n.value)return;o||B()}catch{B()}yield D(()=>l===_)}})),O(()=>{f+=1,T()}),(a,t)=>(Q(),F(ne,{to:"body"},[I("div",{class:ae(["markstream-vue",{dark:d.isDark}])},[K(le,{name:"tooltip",appear:""},{default:W(()=>[Z(I("div",{id:e.id,ref_key:"tooltip",ref:n,style:X({position:"fixed",transitionProperty:v.value?"opacity, transform":"opacity",left:r.value.left,top:r.value.top,transform:r.value.transform,visibility:i.value?"visible":"hidden",pointerEvents:i.value?void 0:"none"}),class:"tooltip-element",role:"tooltip"},[A(ee(d.content)+" ",1),I("div",{ref_key:"arrowEl",ref:s,class:"tooltip-arrow","data-placement":c.value,style:X(y.value)},null,12,re)],12,ie),[[te,d.visible]])]),_:1})],2)]))}}),[["__scopeId","data-v-c606ee4c"]]);export{se as default};

View file

@ -1 +0,0 @@
import{bQ as A,M as H,aU as b,bE as V,az as J,aL as O,s as Q,v as R,I as F,bJ as G,bL as K,aw as L,H as W,bb as Z,bB as ee,g as te,au as le,T as ae,as as B,bR as ne}from"./index-CiHMlsuo.js";var k=(h,E,e)=>new Promise((o,p)=>{var i=a=>{try{d(e.next(a))}catch(c){p(c)}},y=a=>{try{d(e.throw(a))}catch(c){p(c)}},d=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,y);d((e=e.apply(h,E)).next())});const oe=["id"],ie=["data-placement"],ue=A(H({__name:"Tooltip",props:{visible:{type:Boolean},anchorEl:{},content:{},placement:{},offset:{},originX:{},originY:{},id:{},isDark:{type:[Boolean,null]}},setup(h){var E;const e=h,o=b(null),p=b(null),i=b({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"}),y=b({}),d=b((E=e.placement)!=null?E:"top"),a=b(!1);let c=null,$=null,T=null,C=null,w=null,s=0;function X(){return C?Promise.resolve(C):(w||(w=ne(()=>import("./floating-ui.dom-xGUaHE3m.js"),[]).then(l=>(C=l,l)).catch(l=>{throw w=null,l})),w)}function D(){c&&(c(),c=null),$=null,T=null}function P(l){return k(this,null,function*(){const t=e.anchorEl,n=o.value;if(!e.visible||!t||!n||$===t&&T===n)return;const{autoUpdate:r}=yield X();l()&&e.visible&&e.anchorEl===t&&o.value===n&&(D(),$=t,T=n,c=r(t,n,()=>{N().catch(()=>{_()})}))})}function N(){return k(this,null,function*(){var l,t;const n=e.anchorEl,r=o.value;if(!e.visible||!n||!r)return!1;const{arrow:u,computePosition:m,flip:v,offset:f,shift:x}=yield X();if(!e.visible||e.anchorEl!==n||o.value!==r)return!1;const g=[f((l=e.offset)!=null?l:6),v(),x({padding:6}),...p.value?[u({element:p.value,padding:4})]:[]],{x:S,y:j,placement:Y,middlewareData:z}=yield m(n,r,{placement:(t=e.placement)!=null?t:"top",middleware:g,strategy:"fixed"});if(!e.visible||e.anchorEl!==n||o.value!==r)return!1;if(i.value.transform=`translate3d(${Math.round(S)}px, ${Math.round(j)}px, 0)`,i.value.left="0px",i.value.top="0px",d.value=Y,z.arrow&&p.value){const{x:I,y:U}=z.arrow,q={top:"bottom",bottom:"top",left:"right",right:"left"}[Y.split("-")[0]];y.value={left:I!=null?`${I}px`:"",top:U!=null?`${U}px`:"",[q]:"-3px"}}return!0})}function _(){var l,t;const n=e.anchorEl,r=o.value;if(!n||!r)return!1;const u=n.getBoundingClientRect(),m=r.getBoundingClientRect(),v=(l=e.offset)!=null?l:6,f=(t=e.placement)!=null?t:"top";let x=u.left,g=u.top;return f==="bottom"?g=u.bottom+v:f==="left"?x=u.left-m.width-v:f==="right"?x=u.right+v:g=u.top-m.height-v,i.value.transform=`translate3d(${Math.round(Math.max(0,x))}px, ${Math.round(Math.max(0,g))}px, 0)`,i.value.left="0px",i.value.top="0px",d.value=f,y.value={},!0}V(()=>e.visible,l=>k(null,null,function*(){const t=++s;if(l){if(a.value=!1,yield B(),t!==s||!e.visible)return;if(e.anchorEl&&o.value)try{const n=e.anchorEl,r=o.value,u=n.getBoundingClientRect();if(!(yield N())||t!==s||!e.visible||e.anchorEl!==n||o.value!==r)return;const m=i.value.transform;if(e.originX!=null&&e.originY!=null){const v=Math.abs(Number(e.originX)-u.left),f=Math.abs(Number(e.originY)-u.top);if(Math.hypot(v,f)>120){if(i.value.transform=`translate3d(${Math.round(e.originX)}px, ${Math.round(e.originY)}px, 0)`,yield B(),t!==s||!e.visible||(a.value=!0,yield B(),t!==s||!e.visible))return;i.value.transform=m}else a.value=!0}else a.value=!0;yield P(()=>t===s)}catch{if(t!==s||!e.visible)return;if(a.value=_(),e.anchorEl&&o.value)try{yield P(()=>t===s)}catch{}}else a.value=!0}else a.value=!1,D()}));let M=0;return V([()=>e.anchorEl,()=>e.placement,()=>e.content],()=>k(null,null,function*(){const l=++M;if(e.visible&&e.anchorEl&&o.value){if(yield B(),l!==M||!e.visible||!e.anchorEl||!o.value)return;try{const t=yield N();if(l!==M||!e.visible||!e.anchorEl||!o.value)return;t||_()}catch{_()}yield P(()=>l===M)}})),J(()=>{s+=1,D()}),(l,t)=>(O(),Q(ae,{to:"body"},[R("div",{class:le(["markstream-vue",{dark:h.isDark}])},[F(te,{name:"tooltip",appear:""},{default:G(()=>[K(R("div",{id:e.id,ref_key:"tooltip",ref:o,style:L({position:"fixed",left:i.value.left,top:i.value.top,transform:i.value.transform,visibility:a.value?"visible":"hidden",pointerEvents:a.value?void 0:"none"}),class:"tooltip-element",role:"tooltip"},[W(Z(h.content)+" ",1),R("div",{ref_key:"arrowEl",ref:p,class:"tooltip-arrow","data-placement":d.value,style:L(y.value)},null,12,ie)],12,oe),[[ee,h.visible]])]),_:1})],2)]))}}),[["__scopeId","data-v-c606ee4c"]]);export{ue as default};

View file

@ -1 +0,0 @@
function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}export{e as g};

View file

@ -1 +0,0 @@
import{g as p,r as u,d as a}from"./chunk-MOJQB5TN-DmVMZHwQ.js";import{p as f}from"./chunk-JWPE2WC7-BJMJfnyy.js";import{_ as n,l as o}from"./mermaid.core-WW7RuneT.js";import{M as c,b as d}from"./cynefin-VYW2F7L2-DI-9Z5R0.js";import"./index-CiHMlsuo.js";import"./_commonjsHelpers-CqkleIqs.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},F={parser:R,db:a,renderer:u,styles:p};export{F as diagram};

View file

@ -0,0 +1 @@
import{g as p,r as u,d as a}from"./chunk-MOJQB5TN-CClISXJW.js";import{p as f}from"./chunk-JWPE2WC7-Bgwiccxa.js";import{_ as n,l as o}from"./mermaid.core-DY8EMjrF.js";import{M as c,b as d}from"./cynefin-VYW2F7L2-rK0CO-KU.js";import"./index-8y9QBU_r.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},B={parser:R,db:a,renderer:u,styles:p};export{B as diagram};

View file

@ -1 +0,0 @@
import{P as ln,Q as an,R as j,S,T as W,V as un,W as y,X as tn,Y as C,$ as _,a0 as rn,a1 as o,a2 as on,a3 as sn,a4 as fn}from"./mermaid.core-WW7RuneT.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,E,q,v,R,X,a){var I=E-l,i=q-h,n=X-v,d=a-R,u=d*I-n*i;if(!(u*u<y))return u=(n*(h-R)-d*(l-v))/u,[l+u*I,h+u*i]}function L(l,h,E,q,v,R,X){var a=l-E,I=h-q,i=(X?R:-R)/C(a*a+I*I),n=i*I,d=-i*a,u=l+n,s=h+d,f=E+n,c=q+d,Y=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,A=m*m+g*g,T=v-R,P=u*c-f*s,O=(g<0?-1:1)*C(on(0,T*T*A-P*P)),Q=(P*g-m*O)/A,V=(-P*m-g*O)/A,w=(P*g+m*O)/A,p=(-P*m+g*O)/A,x=Q-Y,e=V-t,r=w-Y,$=p-t;return x*x+e*e>r*r+$*$&&(Q=w,V=p),{cx:Q,cy:V,x01:-n,y01:-d,x11:Q*(v/T-1),y11:V*(v/T-1)}}function hn(){var l=cn,h=yn,E=W(0),q=null,v=gn,R=dn,X=mn,a=null,I=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=R.apply(this,arguments)-un,Y=rn(c-f),t=c>f;if(a||(a=n=I()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(Y>tn-y)a.moveTo(s*j(f),s*S(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*j(c),u*S(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,A=f,T=c,P=Y,O=Y,Q=X.apply(this,arguments)/2,V=Q>y&&(q?+q.apply(this,arguments):C(u*u+s*s)),w=_(rn(s-u)/2,+E.apply(this,arguments)),p=w,x=w,e,r;if(V>y){var $=sn(V/u*S(Q)),F=sn(V/s*S(Q));(P-=$*2)>y?($*=t?1:-1,A+=$,T-=$):(P=0,A=T=(f+c)/2),(O-=F*2)>y?(F*=t?1:-1,m+=F,g-=F):(O=0,m=g=(f+c)/2)}var z=s*j(m),B=s*S(m),G=u*j(T),H=u*S(T);if(w>y){var J=s*j(g),K=s*S(g),M=u*j(A),N=u*S(A),D;if(Y<an)if(D=pn(z,B,M,N,J,K,G,H)){var U=z-D[0],Z=B-D[1],k=J-D[0],b=K-D[1],nn=1/S(fn((U*k+Z*b)/(C(U*U+Z*Z)*C(k*k+b*b)))/2),en=C(D[0]*D[0]+D[1]*D[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}O>y?x>y?(e=L(M,N,z,B,s,x,t),r=L(J,K,G,H,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(z,B),a.arc(0,0,s,m,g,!t)):a.moveTo(z,B),!(u>y)||!(P>y)?a.lineTo(G,H):p>y?(e=L(G,H,J,K,u,-p,t),r=L(z,B,M,N,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,A,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +R.apply(this,arguments))/2-an/2;return[j(d)*n,S(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:W(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:W(+n),i):h},i.cornerRadius=function(n){return arguments.length?(E=typeof n=="function"?n:W(+n),i):E},i.padRadius=function(n){return arguments.length?(q=n==null?null:typeof n=="function"?n:W(+n),i):q},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:W(+n),i):v},i.endAngle=function(n){return arguments.length?(R=typeof n=="function"?n:W(+n),i):R},i.padAngle=function(n){return arguments.length?(X=typeof n=="function"?n:W(+n),i):X},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};

View file

@ -0,0 +1 @@
import{G as ln,H as un,I as N,J as I,K as J,L as an,M as y,N as tn,O as j,P as _,Q as rn,R as o,S as on,T as sn,V as fn}from"./mermaid.core-DY8EMjrF.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,q,O,v,R,K,u){var D=q-l,i=O-h,n=K-v,d=u-R,a=d*D-n*i;if(!(a*a<y))return a=(n*(h-R)-d*(l-v))/a,[l+a*D,h+a*i]}function W(l,h,q,O,v,R,K){var u=l-q,D=h-O,i=(K?R:-R)/j(u*u+D*D),n=i*D,d=-i*u,a=l+n,s=h+d,f=q+n,c=O+d,L=(a+f)/2,t=(s+c)/2,m=f-a,g=c-s,A=m*m+g*g,T=v-R,P=a*c-f*s,E=(g<0?-1:1)*j(on(0,T*T*A-P*P)),G=(P*g-m*E)/A,H=(-P*m-g*E)/A,w=(P*g+m*E)/A,p=(-P*m+g*E)/A,x=G-L,e=H-t,r=w-L,M=p-t;return x*x+e*e>r*r+M*M&&(G=w,H=p),{cx:G,cy:H,x01:-n,y01:-d,x11:G*(v/T-1),y11:H*(v/T-1)}}function hn(){var l=cn,h=yn,q=J(0),O=null,v=gn,R=dn,K=mn,u=null,D=ln(i);function i(){var n,d,a=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=R.apply(this,arguments)-an,L=rn(c-f),t=c>f;if(u||(u=n=D()),s<a&&(d=s,s=a,a=d),!(s>y))u.moveTo(0,0);else if(L>tn-y)u.moveTo(s*N(f),s*I(f)),u.arc(0,0,s,f,c,!t),a>y&&(u.moveTo(a*N(c),a*I(c)),u.arc(0,0,a,c,f,t));else{var m=f,g=c,A=f,T=c,P=L,E=L,G=K.apply(this,arguments)/2,H=G>y&&(O?+O.apply(this,arguments):j(a*a+s*s)),w=_(rn(s-a)/2,+q.apply(this,arguments)),p=w,x=w,e,r;if(H>y){var M=sn(H/a*I(G)),z=sn(H/s*I(G));(P-=M*2)>y?(M*=t?1:-1,A+=M,T-=M):(P=0,A=T=(f+c)/2),(E-=z*2)>y?(z*=t?1:-1,m+=z,g-=z):(E=0,m=g=(f+c)/2)}var Q=s*N(m),V=s*I(m),B=a*N(T),C=a*I(T);if(w>y){var F=s*N(g),U=s*I(g),X=a*N(A),Y=a*I(A),S;if(L<un)if(S=pn(Q,V,X,Y,F,U,B,C)){var Z=Q-S[0],$=V-S[1],k=F-S[0],b=U-S[1],nn=1/I(fn((Z*k+$*b)/(j(Z*Z+$*$)*j(k*k+b*b)))/2),en=j(S[0]*S[0]+S[1]*S[1]);p=_(w,(a-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}E>y?x>y?(e=W(X,Y,Q,V,s,x,t),r=W(F,U,B,C,s,x,t),u.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?u.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(u.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),u.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),u.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(u.moveTo(Q,V),u.arc(0,0,s,m,g,!t)):u.moveTo(Q,V),!(a>y)||!(P>y)?u.lineTo(B,C):p>y?(e=W(B,C,F,U,a,-p,t),r=W(Q,V,X,Y,a,-p,t),u.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?u.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(u.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),u.arc(0,0,a,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),u.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):u.arc(0,0,a,T,A,t)}if(u.closePath(),n)return u=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +R.apply(this,arguments))/2-un/2;return[N(d)*n,I(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:J(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:J(+n),i):h},i.cornerRadius=function(n){return arguments.length?(q=typeof n=="function"?n:J(+n),i):q},i.padRadius=function(n){return arguments.length?(O=n==null?null:typeof n=="function"?n:J(+n),i):O},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:J(+n),i):v},i.endAngle=function(n){return arguments.length?(R=typeof n=="function"?n:J(+n),i):R},i.padAngle=function(n){return arguments.length?(K=typeof n=="function"?n:J(+n),i):K},i.context=function(n){return arguments.length?(u=n??null,i):u},i}export{hn as d};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1 +0,0 @@
import{U as a,O as n}from"./mermaid.core-WW7RuneT.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};

View file

@ -0,0 +1 @@
import{U as a,C as n}from"./mermaid.core-DY8EMjrF.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};

View file

@ -1 +1 @@
import{_ as i}from"./mermaid.core-WW7RuneT.js";var r=class{constructor(t){this.init=t,this.records=this.init()}static{i(this,"ImperativeState")}reset(){this.records=this.init()}};export{r as I};
import{_ as i}from"./mermaid.core-DY8EMjrF.js";var r=class{constructor(t){this.init=t,this.records=this.init()}static{i(this,"ImperativeState")}reset(){this.records=this.init()}};export{r as I};

View file

@ -1 +1 @@
import{_ as i,d as l,N as d,j as o}from"./mermaid.core-WW7RuneT.js";var x=i((r,t)=>{const e=r.append("rect");if(e.attr("x",t.x),e.attr("y",t.y),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("width",t.width),e.attr("height",t.height),t.name&&e.attr("name",t.name),t.rx&&e.attr("rx",t.rx),t.ry&&e.attr("ry",t.ry),t.attrs!==void 0)for(const s in t.attrs)e.attr(s,t.attrs[s]);return t.class&&e.attr("class",t.class),e},"drawRect"),p=i((r,t)=>{const e={x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,stroke:t.stroke,class:"rect"};x(r,e).lower()},"drawBackgroundRect"),y=i((r,t)=>{const e=t.text.replace(d," "),s=r.append("text");s.attr("x",t.x),s.attr("y",t.y),s.attr("class","legend"),s.style("text-anchor",t.anchor),t.class&&s.attr("class",t.class);const a=s.append("tspan");return a.attr("x",t.x+t.textMargin*2),a.text(e),s},"drawText"),m=i((r,t,e,s)=>{const a=r.append("image");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",n)},"drawImage"),g=i((r,t,e,s)=>{const a=r.append("use");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",`#${n}`)},"drawEmbeddedImage"),h=i(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),f=i(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),w=i(()=>{let r=l(".mermaidTooltip");return r.empty()&&(r=l("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100")),r},"createTooltip");export{p as a,f as b,g as c,x as d,m as e,w as f,h as g,y as h};
import{_ as i,d as l,n as d,j as o}from"./mermaid.core-DY8EMjrF.js";var x=i((r,t)=>{const e=r.append("rect");if(e.attr("x",t.x),e.attr("y",t.y),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("width",t.width),e.attr("height",t.height),t.name&&e.attr("name",t.name),t.rx&&e.attr("rx",t.rx),t.ry&&e.attr("ry",t.ry),t.attrs!==void 0)for(const s in t.attrs)e.attr(s,t.attrs[s]);return t.class&&e.attr("class",t.class),e},"drawRect"),p=i((r,t)=>{const e={x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,stroke:t.stroke,class:"rect"};x(r,e).lower()},"drawBackgroundRect"),y=i((r,t)=>{const e=t.text.replace(d," "),s=r.append("text");s.attr("x",t.x),s.attr("y",t.y),s.attr("class","legend"),s.style("text-anchor",t.anchor),t.class&&s.attr("class",t.class);const a=s.append("tspan");return a.attr("x",t.x+t.textMargin*2),a.text(e),s},"drawText"),m=i((r,t,e,s)=>{const a=r.append("image");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",n)},"drawImage"),g=i((r,t,e,s)=>{const a=r.append("use");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",`#${n}`)},"drawEmbeddedImage"),h=i(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),f=i(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),w=i(()=>{let r=l(".mermaidTooltip");return r.empty()&&(r=l("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100")),r},"createTooltip");export{p as a,f as b,g as c,x as d,m as e,w as f,h as g,y as h};

View file

@ -1,4 +1,4 @@
import{_ as e}from"./mermaid.core-WW7RuneT.js";var l=e(()=>`
import{_ as e}from"./mermaid.core-DY8EMjrF.js";var l=e(()=>`
/* Font Awesome icon styling - consolidated */
.label-icon {
display: inline-block;

View file

@ -1 +1 @@
import{_ as i}from"./mermaid.core-WW7RuneT.js";function t(c,e){c.accDescr&&e.setAccDescription?.(c.accDescr),c.accTitle&&e.setAccTitle?.(c.accTitle),c.title&&e.setDiagramTitle?.(c.title)}i(t,"populateCommonDb");export{t as p};
import{_ as i}from"./mermaid.core-DY8EMjrF.js";function t(c,e){c.accDescr&&e.setAccDescription?.(c.accDescr),c.accTitle&&e.setAccTitle?.(c.accTitle),c.title&&e.setDiagramTitle?.(c.title)}i(t,"populateCommonDb");export{t as p};

View file

@ -1 +1 @@
import{_ as a,e as w,l as x}from"./mermaid.core-WW7RuneT.js";var d=a((e,t,i,r)=>{e.attr("class",i);const{width:o,height:h,x:n,y:c}=u(e,t);w(e,h,o,r);const s=l(n,c,o,h,t);e.attr("viewBox",s),x.debug(`viewBox configured: ${s} with padding: ${t}`)},"setupViewPortForSVG"),u=a((e,t)=>{const i=e.node()?.getBBox()||{width:0,height:0,x:0,y:0};return{width:i.width+t*2,height:i.height+t*2,x:i.x,y:i.y}},"calculateDimensionsWithPadding"),l=a((e,t,i,r,o)=>`${e-o} ${t-o} ${i} ${r}`,"createViewBox");export{d as s};
import{_ as a,e as w,l as x}from"./mermaid.core-DY8EMjrF.js";var d=a((e,t,i,r)=>{e.attr("class",i);const{width:o,height:h,x:n,y:c}=u(e,t);w(e,h,o,r);const s=l(n,c,o,h,t);e.attr("viewBox",s),x.debug(`viewBox configured: ${s} with padding: ${t}`)},"setupViewPortForSVG"),u=a((e,t)=>{const i=e.node()?.getBBox()||{width:0,height:0,x:0,y:0};return{width:i.width+t*2,height:i.height+t*2,x:i.x,y:i.y}},"calculateDimensionsWithPadding"),l=a((e,t,i,r,o)=>`${e-o} ${t-o} ${i} ${r}`,"createViewBox");export{d as s};

View file

@ -1 +1 @@
import{_ as a,d as o}from"./mermaid.core-WW7RuneT.js";var d=a((t,e)=>{let n;return e==="sandbox"&&(n=o("#i"+t)),(e==="sandbox"?o(n.nodes()[0].contentDocument.body):o("body")).select(`[id="${t}"]`)},"getDiagramElement");export{d as g};
import{_ as a,d as o}from"./mermaid.core-DY8EMjrF.js";var d=a((t,e)=>{let n;return e==="sandbox"&&(n=o("#i"+t)),(e==="sandbox"?o(n.nodes()[0].contentDocument.body):o("body")).select(`[id="${t}"]`)},"getDiagramElement");export{d as g};

View file

@ -0,0 +1 @@
import{s as a,c as s,a as e,C as t}from"./chunk-V7JOEXUC-B6kqo8yw.js";import{_ as i}from"./mermaid.core-DY8EMjrF.js";import"./chunk-5VM5RSS4-C2_xpzY3.js";import"./chunk-XXDRQBXY-Vyf77H8-.js";import"./chunk-VR4S4FIN-Cm7c9b3N.js";import"./chunk-32BRIVSS-Bb3U5zL8.js";import"./index-8y9QBU_r.js";var n={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{n as diagram};

View file

@ -1 +0,0 @@
import{s as a,c as s,a as e,C as t}from"./chunk-V7JOEXUC-BBRs-W-z.js";import{_ as i}from"./mermaid.core-WW7RuneT.js";import"./chunk-5VM5RSS4-BJR-VYAu.js";import"./chunk-XXDRQBXY-D_bv9kM4.js";import"./chunk-VR4S4FIN-C_RujyXt.js";import"./chunk-32BRIVSS-CRTrWqUr.js";import"./index-CiHMlsuo.js";import"./_commonjsHelpers-CqkleIqs.js";var f={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{f as diagram};

View file

@ -0,0 +1 @@
import{s as a,c as s,a as e,C as t}from"./chunk-V7JOEXUC-B6kqo8yw.js";import{_ as i}from"./mermaid.core-DY8EMjrF.js";import"./chunk-5VM5RSS4-C2_xpzY3.js";import"./chunk-XXDRQBXY-Vyf77H8-.js";import"./chunk-VR4S4FIN-Cm7c9b3N.js";import"./chunk-32BRIVSS-Bb3U5zL8.js";import"./index-8y9QBU_r.js";var n={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{n as diagram};

View file

@ -1 +0,0 @@
import{s as a,c as s,a as e,C as t}from"./chunk-V7JOEXUC-BBRs-W-z.js";import{_ as i}from"./mermaid.core-WW7RuneT.js";import"./chunk-5VM5RSS4-BJR-VYAu.js";import"./chunk-XXDRQBXY-D_bv9kM4.js";import"./chunk-VR4S4FIN-C_RujyXt.js";import"./chunk-32BRIVSS-CRTrWqUr.js";import"./index-CiHMlsuo.js";import"./_commonjsHelpers-CqkleIqs.js";var f={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{f as diagram};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,4 @@
import{c as O,w as I,a as J,f as P,b as E,s as A}from"./chunk-RYQCIY6F-H_GYUYTT.js";import{_ as w,am as v,an as D,ao as H,ap as Y,l,c as _,aq as W,ar as $,ag as j,as as q,ah as R,af as F,at as z,au as K,av as G}from"./mermaid.core-DY8EMjrF.js";import{G as Q}from"./graph-DOmOIIwC.js";import{l as U}from"./layout-D-LzfAck.js";import"./map-DxJ2ADlA.js";import"./index-8y9QBU_r.js";var C=w((s,t,g)=>Math.max(t,Math.min(g,s)),"clamp"),B=w((s="TB")=>{switch(s){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";case"TB":default:return"top"}},"getDefaultSelfLoopSide"),V=w(s=>s==="flowchart"||s==="flowchart-v2"||s==="stateDiagram","shouldMergeSelfLoopSegments"),Z=w((s,t,g,y,c)=>{const o=[],r=new Set;if(g.forEach(({start:i,end:n})=>{i!==y&&r.add(i),n!==y&&r.add(n)}),r.forEach(i=>{const n=s.node(i);typeof n?.x=="number"&&typeof n?.y=="number"&&o.push(n)}),o.length===0&&g.forEach(({edge:i})=>{(i.points??[]).forEach(n=>{typeof n?.x=="number"&&typeof n?.y=="number"&&o.push(n)})}),o.length===0)return B(c);const f=o.reduce((i,n)=>({x:i.x+n.x/o.length,y:i.y+n.y/o.length}),{x:0,y:0}),h=f.x-t.x,a=f.y-t.y;return Math.abs(h)>Math.abs(a)?h>0?"right":"left":Math.abs(a)>0?a>0?"bottom":"top":B(c)},"getSelfLoopSide"),ee=w((s,t="top",g=0,y=0)=>{const c=s.x,o=s.y-g,r=s.width/2,f=s.height/2,h=Math.max(36,Math.min(100,s.width*.8)),a=C(Math.max(y,s.width*.35),36,h),i=C(Math.min(s.width,s.height)*.45,24,48);switch(t){case"bottom":{const n=o+f;return[{x:c-a/2,y:n},{x:c-a/2,y:n+i},{x:c+a/2,y:n+i},{x:c+a/2,y:n}]}case"right":{const n=c+r;return[{x:n,y:o-a/2},{x:n+i,y:o-a/2},{x:n+i,y:o+a/2},{x:n,y:o+a/2}]}case"left":{const n=c-r;return[{x:n,y:o-a/2},{x:n-i,y:o-a/2},{x:n-i,y:o+a/2},{x:n,y:o+a/2}]}case"top":default:{const n=o-f;return[{x:c-a/2,y:n},{x:c-a/2,y:n-i},{x:c+a/2,y:n-i},{x:c+a/2,y:n}]}}},"getSelfLoopPoints"),te=w((s,t,g="top",y=0,c={})=>{const r=s.x,f=s.y-y,h=c.width??0,a=c.height??0;switch(g){case"bottom":return{x:r,y:Math.max(...t.map(i=>i.y))+a/2+4};case"right":return{x:Math.max(...t.map(i=>i.x))+h/2+4,y:f};case"left":return{x:Math.min(...t.map(i=>i.x))-h/2-4,y:f};case"top":default:return{x:r,y:Math.min(...t.map(i=>i.y))-a/2-4}}},"getSelfLoopLabelPosition"),ne=w((s,t=0,{mergeSelfLoops:g=!0}={})=>{const y=new Map,c=[],o=s.graph()?.rankdir;return s.edges().forEach(r=>{const f=s.edge(r);if(g&&f.selfLoop){const h=f.selfLoop.id;y.has(h)||y.set(h,[]),y.get(h).push({edge:f,start:r.v,end:r.w})}else c.push({edge:f,start:r.v,end:r.w})}),y.forEach(r=>{if(r.length!==3){r.forEach(L=>c.push(L));return}r.sort((L,d)=>L.edge.selfLoop.order-d.edge.selfLoop.order);const[f,h,a]=r,i=f.edge.originalEdge??h.edge.originalEdge??a.edge.originalEdge??h.edge,n=s.node(i.start);if(!n){r.forEach(L=>c.push(L));return}const p={width:h.edge.width,height:h.edge.height},m=Z(s,n,r,i.start,o),X=ee(n,m,t,p.width??0),S=te(n,X,m,t,p),b={...h.edge,...i,id:i.id,points:X,start:i.start,end:i.end,x:S.x,y:S.y,width:p.width,height:p.height,labelStyle:h.edge.labelStyle,fromCluster:f.edge.fromCluster??h.edge.fromCluster??a.edge.fromCluster,toCluster:f.edge.toCluster??h.edge.toCluster??a.edge.toCluster};delete b.selfLoop,delete b.originalEdge,c.push({edge:b,start:b.start,end:b.end})}),c},"getEdgesToRender"),T=w(async(s,t,g,y,c,o)=>{l.warn("Graph in recursive render:XAX",I(t),c);const r=t.graph().rankdir;l.trace("Dir in recursive render - dir:",r);const f=s.insert("g").attr("class","root");t.nodes()?l.info("Recursive render XXX",t.nodes()):l.info("No nodes found for",t),t.edges().length>0&&l.info("Recursive edges",t.edge(t.edges()[0]));const h=f.insert("g").attr("class","clusters"),a=f.insert("g").attr("class","edgePaths"),i=f.insert("g").attr("class","edgeLabels"),n=f.insert("g").attr("class","nodes"),p=V(g);await Promise.all(t.nodes().map(async function(d){const e=t.node(d);if(c!==void 0){const u=JSON.parse(JSON.stringify(c.clusterData));l.trace(`Setting data for parent cluster XXX
Node.id = `,d,`
data=`,u.height,`
Parent cluster`,c.height),t.setNode(c.id,u),t.parent(d)||(l.trace("Setting parent",d,c.id),t.setParent(d,c.id,u))}if(l.info("(Insert) Node XXX"+d+": "+JSON.stringify(t.node(d))),e?.clusterNode){l.info("Cluster identified XBX",d,e.width,t.node(d));const{ranksep:u,nodesep:x}=t.graph();e.graph.setGraph({...e.graph.graph(),ranksep:u+25,nodesep:x});const N=await T(n,e.graph,g,y,t.node(d),o),M=N.elem;W(e,M),e.diff=N.diff||0,l.info("New compound node after recursive render XAX",d,"width",e.width,"height",e.height),$(M,e)}else t.children(d).length>0?(l.trace("Cluster - the non recursive path XBX",d,e.id,e,e.width,"Graph:",t),l.trace(P(e.id,t)),E.set(e.id,{id:P(e.id,t),node:e})):(l.trace("Node - the non recursive path XAX",d,n,t.node(d),r),await j(n,t.node(d),{config:o,dir:r}))})),await w(async()=>{const d=t.edges().map(async function(e){const u=t.edge(e.v,e.w,e.name);if(l.info("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(e)),l.info("Edge "+e.v+" -> "+e.w+": ",e," ",JSON.stringify(t.edge(e))),l.info("Fix",E,"ids:",e.v,e.w,"Translating: ",E.get(e.v),E.get(e.w)),p&&u.selfLoop){if(u.selfLoop.order!==1)return;const x=u.id;u.id=u.selfLoop.id,await G(i,u),u.id=x;return}await G(i,u)});await Promise.all(d)},"processEdges")(),l.info("Graph before layout:",JSON.stringify(I(t))),l.info("############################################# XXX"),l.info("### Layout ### XXX"),l.info("############################################# XXX"),U(t),l.info("Graph after layout:",JSON.stringify(I(t)));let X=0,{subGraphTitleTotalMargin:S}=q(o);await Promise.all(A(t).map(async function(d){const e=t.node(d);if(l.info("Position XBX => "+d+": ("+e.x,","+e.y,") width: ",e.width," height: ",e.height),e?.clusterNode)e.y+=S,l.info("A tainted cluster node XBX1",d,e.id,e.width,e.height,e.x,e.y,t.parent(d)),E.get(e.id).node=e,R(e);else if(t.children(d).length>0){l.info("A pure cluster node XBX1",d,e.id,e.x,e.y,e.width,e.height,t.parent(d)),e.height+=S,t.node(e.parentId);const u=e?.padding/2||0,x=e?.labelBBox?.height||0,N=x-u||0;l.debug("OffsetY",N,"labelHeight",x,"halfPadding",u),await F(h,e),E.get(e.id).node=e}else{const u=t.node(e.parentId);e.y+=S/2,l.info("A regular node XBX1 - using the padding",e.id,"parent",e.parentId,e.width,e.height,e.x,e.y,"offsetY",e.offsetY,"parent",u,u?.offsetY,e),R(e)}}));const b=S/2;return ne(t,b,{mergeSelfLoops:p}).forEach(function({edge:d,start:e,end:u}){l.info("Edge "+e+" -> "+u+": "+JSON.stringify(d),d),d.points.forEach(k=>k.y+=b);const x=t.node(e),N=t.node(u),M=z(a,d,E,g,x,N,y);K(d,M)}),t.nodes().forEach(function(d){const e=t.node(d);l.info(d,e.type,e.diff),e.isGroup&&(X=e.diff)}),l.warn("Returning from recursive render XAX",f,X),{elem:f,diff:X}},"recursiveRender"),ce=w(async(s,t)=>{const g=new Q({multigraph:!0,compound:!0}).setGraph({rankdir:s.direction,nodesep:s.config?.nodeSpacing||s.config?.flowchart?.nodeSpacing||s.nodeSpacing,ranksep:s.config?.rankSpacing||s.config?.flowchart?.rankSpacing||s.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),y=t.select("g");v(y,s.markers,s.type,s.diagramId),D(),H(),Y(),O(),s.nodes.forEach(o=>{g.setNode(o.id,{...o}),o.parentId&&g.setParent(o.id,o.parentId)}),l.debug("Edges:",s.edges),s.edges.forEach(o=>{if(o.start===o.end){const r=o.start,f=r+"---"+r+"---1",h=r+"---"+r+"---2",a=g.node(r);g.setNode(f,{domId:f,id:f,parentId:a.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),g.setParent(f,a.parentId),g.setNode(h,{domId:h,id:h,parentId:a.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),g.setParent(h,a.parentId);const i=structuredClone(o),n=structuredClone(o),p=structuredClone(o),m=structuredClone(o);n.originalEdge=i,n.selfLoop={id:i.id,order:0},p.originalEdge=i,p.selfLoop={id:i.id,order:1},m.originalEdge=i,m.selfLoop={id:i.id,order:2},n.label="",n.arrowTypeEnd="none",n.endLabelLeft="",n.endLabelRight="",n.startLabelLeft="",n.id=r+"-cyclic-special-1",p.startLabelRight="",p.startLabelLeft="",p.endLabelLeft="",p.endLabelRight="",p.arrowTypeStart="none",p.arrowTypeEnd="none",p.id=r+"-cyclic-special-mid",m.label="",m.startLabelRight="",m.startLabelLeft="",m.arrowTypeStart="none",a.isGroup&&(n.fromCluster=r,m.toCluster=r),m.id=r+"-cyclic-special-2",m.arrowTypeStart="none",g.setEdge(r,f,n,r+"-cyclic-special-0"),g.setEdge(f,h,p,r+"-cyclic-special-1"),g.setEdge(h,r,m,r+"-cyclic-special-2")}else g.setEdge(o.start,o.end,{...o},o.id)}),l.warn("Graph at first:",JSON.stringify(I(g))),J(g),l.warn("Graph after XAX:",JSON.stringify(I(g)));const c=_();await T(y,g,s.type,s.diagramId,void 0,c)},"render");export{ne as getEdgesToRender,ce as render};

View file

@ -1,4 +0,0 @@
import{c as O,w as I,a as J,f as P,b as E,s as A}from"./chunk-RYQCIY6F-LhAgalr3.js";import{_ as w,am as v,an as D,ao as H,ap as Y,l,c as _,aq as W,ar as $,ag as j,as as q,ah as R,af as F,at as z,au as K,av as G}from"./mermaid.core-WW7RuneT.js";import{G as Q}from"./graph-DOmOIIwC.js";import{l as U}from"./layout-D-LzfAck.js";import"./map-DxJ2ADlA.js";import"./index-CiHMlsuo.js";import"./_commonjsHelpers-CqkleIqs.js";var C=w((s,t,g)=>Math.max(t,Math.min(g,s)),"clamp"),B=w((s="TB")=>{switch(s){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";case"TB":default:return"top"}},"getDefaultSelfLoopSide"),V=w(s=>s==="flowchart"||s==="flowchart-v2"||s==="stateDiagram","shouldMergeSelfLoopSegments"),Z=w((s,t,g,m,c)=>{const o=[],r=new Set;if(g.forEach(({start:i,end:n})=>{i!==m&&r.add(i),n!==m&&r.add(n)}),r.forEach(i=>{const n=s.node(i);typeof n?.x=="number"&&typeof n?.y=="number"&&o.push(n)}),o.length===0&&g.forEach(({edge:i})=>{(i.points??[]).forEach(n=>{typeof n?.x=="number"&&typeof n?.y=="number"&&o.push(n)})}),o.length===0)return B(c);const f=o.reduce((i,n)=>({x:i.x+n.x/o.length,y:i.y+n.y/o.length}),{x:0,y:0}),h=f.x-t.x,a=f.y-t.y;return Math.abs(h)>Math.abs(a)?h>0?"right":"left":Math.abs(a)>0?a>0?"bottom":"top":B(c)},"getSelfLoopSide"),ee=w((s,t="top",g=0,m=0)=>{const c=s.x,o=s.y-g,r=s.width/2,f=s.height/2,h=Math.max(36,Math.min(100,s.width*.8)),a=C(Math.max(m,s.width*.35),36,h),i=C(Math.min(s.width,s.height)*.45,24,48);switch(t){case"bottom":{const n=o+f;return[{x:c-a/2,y:n},{x:c-a/2,y:n+i},{x:c+a/2,y:n+i},{x:c+a/2,y:n}]}case"right":{const n=c+r;return[{x:n,y:o-a/2},{x:n+i,y:o-a/2},{x:n+i,y:o+a/2},{x:n,y:o+a/2}]}case"left":{const n=c-r;return[{x:n,y:o-a/2},{x:n-i,y:o-a/2},{x:n-i,y:o+a/2},{x:n,y:o+a/2}]}case"top":default:{const n=o-f;return[{x:c-a/2,y:n},{x:c-a/2,y:n-i},{x:c+a/2,y:n-i},{x:c+a/2,y:n}]}}},"getSelfLoopPoints"),te=w((s,t,g="top",m=0,c={})=>{const r=s.x,f=s.y-m,h=c.width??0,a=c.height??0;switch(g){case"bottom":return{x:r,y:Math.max(...t.map(i=>i.y))+a/2+4};case"right":return{x:Math.max(...t.map(i=>i.x))+h/2+4,y:f};case"left":return{x:Math.min(...t.map(i=>i.x))-h/2-4,y:f};case"top":default:return{x:r,y:Math.min(...t.map(i=>i.y))-a/2-4}}},"getSelfLoopLabelPosition"),ne=w((s,t=0,{mergeSelfLoops:g=!0}={})=>{const m=new Map,c=[],o=s.graph()?.rankdir;return s.edges().forEach(r=>{const f=s.edge(r);if(g&&f.selfLoop){const h=f.selfLoop.id;m.has(h)||m.set(h,[]),m.get(h).push({edge:f,start:r.v,end:r.w})}else c.push({edge:f,start:r.v,end:r.w})}),m.forEach(r=>{if(r.length!==3){r.forEach(L=>c.push(L));return}r.sort((L,d)=>L.edge.selfLoop.order-d.edge.selfLoop.order);const[f,h,a]=r,i=f.edge.originalEdge??h.edge.originalEdge??a.edge.originalEdge??h.edge,n=s.node(i.start);if(!n){r.forEach(L=>c.push(L));return}const p={width:h.edge.width,height:h.edge.height},y=Z(s,n,r,i.start,o),X=ee(n,y,t,p.width??0),S=te(n,X,y,t,p),b={...h.edge,...i,id:i.id,points:X,start:i.start,end:i.end,x:S.x,y:S.y,width:p.width,height:p.height,labelStyle:h.edge.labelStyle,fromCluster:f.edge.fromCluster??h.edge.fromCluster??a.edge.fromCluster,toCluster:f.edge.toCluster??h.edge.toCluster??a.edge.toCluster};delete b.selfLoop,delete b.originalEdge,c.push({edge:b,start:b.start,end:b.end})}),c},"getEdgesToRender"),T=w(async(s,t,g,m,c,o)=>{l.warn("Graph in recursive render:XAX",I(t),c);const r=t.graph().rankdir;l.trace("Dir in recursive render - dir:",r);const f=s.insert("g").attr("class","root");t.nodes()?l.info("Recursive render XXX",t.nodes()):l.info("No nodes found for",t),t.edges().length>0&&l.info("Recursive edges",t.edge(t.edges()[0]));const h=f.insert("g").attr("class","clusters"),a=f.insert("g").attr("class","edgePaths"),i=f.insert("g").attr("class","edgeLabels"),n=f.insert("g").attr("class","nodes"),p=V(g);await Promise.all(t.nodes().map(async function(d){const e=t.node(d);if(c!==void 0){const u=JSON.parse(JSON.stringify(c.clusterData));l.trace(`Setting data for parent cluster XXX
Node.id = `,d,`
data=`,u.height,`
Parent cluster`,c.height),t.setNode(c.id,u),t.parent(d)||(l.trace("Setting parent",d,c.id),t.setParent(d,c.id,u))}if(l.info("(Insert) Node XXX"+d+": "+JSON.stringify(t.node(d))),e?.clusterNode){l.info("Cluster identified XBX",d,e.width,t.node(d));const{ranksep:u,nodesep:x}=t.graph();e.graph.setGraph({...e.graph.graph(),ranksep:u+25,nodesep:x});const N=await T(n,e.graph,g,m,t.node(d),o),M=N.elem;W(e,M),e.diff=N.diff||0,l.info("New compound node after recursive render XAX",d,"width",e.width,"height",e.height),$(M,e)}else t.children(d).length>0?(l.trace("Cluster - the non recursive path XBX",d,e.id,e,e.width,"Graph:",t),l.trace(P(e.id,t)),E.set(e.id,{id:P(e.id,t),node:e})):(l.trace("Node - the non recursive path XAX",d,n,t.node(d),r),await j(n,t.node(d),{config:o,dir:r}))})),await w(async()=>{const d=t.edges().map(async function(e){const u=t.edge(e.v,e.w,e.name);if(l.info("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(e)),l.info("Edge "+e.v+" -> "+e.w+": ",e," ",JSON.stringify(t.edge(e))),l.info("Fix",E,"ids:",e.v,e.w,"Translating: ",E.get(e.v),E.get(e.w)),p&&u.selfLoop){if(u.selfLoop.order!==1)return;const x=u.id;u.id=u.selfLoop.id,await G(i,u),u.id=x;return}await G(i,u)});await Promise.all(d)},"processEdges")(),l.info("Graph before layout:",JSON.stringify(I(t))),l.info("############################################# XXX"),l.info("### Layout ### XXX"),l.info("############################################# XXX"),U(t),l.info("Graph after layout:",JSON.stringify(I(t)));let X=0,{subGraphTitleTotalMargin:S}=q(o);await Promise.all(A(t).map(async function(d){const e=t.node(d);if(l.info("Position XBX => "+d+": ("+e.x,","+e.y,") width: ",e.width," height: ",e.height),e?.clusterNode)e.y+=S,l.info("A tainted cluster node XBX1",d,e.id,e.width,e.height,e.x,e.y,t.parent(d)),E.get(e.id).node=e,R(e);else if(t.children(d).length>0){l.info("A pure cluster node XBX1",d,e.id,e.x,e.y,e.width,e.height,t.parent(d)),e.height+=S,t.node(e.parentId);const u=e?.padding/2||0,x=e?.labelBBox?.height||0,N=x-u||0;l.debug("OffsetY",N,"labelHeight",x,"halfPadding",u),await F(h,e),E.get(e.id).node=e}else{const u=t.node(e.parentId);e.y+=S/2,l.info("A regular node XBX1 - using the padding",e.id,"parent",e.parentId,e.width,e.height,e.x,e.y,"offsetY",e.offsetY,"parent",u,u?.offsetY,e),R(e)}}));const b=S/2;return ne(t,b,{mergeSelfLoops:p}).forEach(function({edge:d,start:e,end:u}){l.info("Edge "+e+" -> "+u+": "+JSON.stringify(d),d),d.points.forEach(k=>k.y+=b);const x=t.node(e),N=t.node(u),M=z(a,d,E,g,x,N,m);K(d,M)}),t.nodes().forEach(function(d){const e=t.node(d);l.info(d,e.type,e.diff),e.isGroup&&(X=e.diff)}),l.warn("Returning from recursive render XAX",f,X),{elem:f,diff:X}},"recursiveRender"),le=w(async(s,t)=>{const g=new Q({multigraph:!0,compound:!0}).setGraph({rankdir:s.direction,nodesep:s.config?.nodeSpacing||s.config?.flowchart?.nodeSpacing||s.nodeSpacing,ranksep:s.config?.rankSpacing||s.config?.flowchart?.rankSpacing||s.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),m=t.select("g");v(m,s.markers,s.type,s.diagramId),D(),H(),Y(),O(),s.nodes.forEach(o=>{g.setNode(o.id,{...o}),o.parentId&&g.setParent(o.id,o.parentId)}),l.debug("Edges:",s.edges),s.edges.forEach(o=>{if(o.start===o.end){const r=o.start,f=r+"---"+r+"---1",h=r+"---"+r+"---2",a=g.node(r);g.setNode(f,{domId:f,id:f,parentId:a.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),g.setParent(f,a.parentId),g.setNode(h,{domId:h,id:h,parentId:a.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),g.setParent(h,a.parentId);const i=structuredClone(o),n=structuredClone(o),p=structuredClone(o),y=structuredClone(o);n.originalEdge=i,n.selfLoop={id:i.id,order:0},p.originalEdge=i,p.selfLoop={id:i.id,order:1},y.originalEdge=i,y.selfLoop={id:i.id,order:2},n.label="",n.arrowTypeEnd="none",n.endLabelLeft="",n.endLabelRight="",n.startLabelLeft="",n.id=r+"-cyclic-special-1",p.startLabelRight="",p.startLabelLeft="",p.endLabelLeft="",p.endLabelRight="",p.arrowTypeStart="none",p.arrowTypeEnd="none",p.id=r+"-cyclic-special-mid",y.label="",y.startLabelRight="",y.startLabelLeft="",y.arrowTypeStart="none",a.isGroup&&(n.fromCluster=r,y.toCluster=r),y.id=r+"-cyclic-special-2",y.arrowTypeStart="none",g.setEdge(r,f,n,r+"-cyclic-special-0"),g.setEdge(f,h,p,r+"-cyclic-special-1"),g.setEdge(h,r,y,r+"-cyclic-special-2")}else g.setEdge(o.start,o.end,{...o},o.id)}),l.warn("Graph at first:",JSON.stringify(I(g))),J(g),l.warn("Graph after XAX:",JSON.stringify(I(g)));const c=_();await T(m,g,s.type,s.diagramId,void 0,c)},"render");export{ne as getEdgesToRender,le as render};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,24 +0,0 @@
import{p as B}from"./chunk-JWPE2WC7-BJMJfnyy.js";import{_ as b,A as u,D as $,e as C,l as m,b as S,a as D,n as T,o as P,g as z,s as A,y as E,B as F,p as W}from"./mermaid.core-WW7RuneT.js";import{p as _}from"./cynefin-VYW2F7L2-DI-9Z5R0.js";import"./index-CiHMlsuo.js";import"./_commonjsHelpers-CqkleIqs.js";var N=F.packet,w=class{constructor(){this.packet=[],this.setAccTitle=S,this.getAccTitle=D,this.setDiagramTitle=T,this.getDiagramTitle=P,this.getAccDescription=z,this.setAccDescription=A}static{b(this,"PacketDB")}getConfig(){const t=u({...N,...E().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){W(),this.packet=[]}},L=1e4,M=b((t,e)=>{B(t,e);let r=-1,o=[],n=1;const{bitsPerRow:l}=e.getConfig();for(let{start:a,end:i,bits:d,label:c}of t.blocks){if(a!==void 0&&i!==void 0&&i<a)throw new Error(`Packet block ${a} - ${i} is invalid. End must be greater than start.`);if(a??=r+1,a!==r+1)throw new Error(`Packet block ${a} - ${i??a} is not contiguous. It should start from ${r+1}.`);if(d===0)throw new Error(`Packet block ${a} is invalid. Cannot have a zero bit field.`);for(i??=a+(d??1)-1,d??=i-a+1,r=i,m.debug(`Packet block ${a} - ${r} with label ${c}`);o.length<=l+1&&e.getPacket().length<L;){const[p,s]=Y({start:a,end:i,bits:d,label:c},n,l);if(o.push(p),p.end+1===n*l&&(e.pushWord(o),o=[],n++),!s)break;({start:a,end:i,bits:d,label:c}=s)}}e.pushWord(o)},"populate"),Y=b((t,e,r)=>{if(t.start===void 0)throw new Error("start should have been set during first phase");if(t.end===void 0)throw new Error("end should have been set during first phase");if(t.start>t.end)throw new Error(`Block start ${t.start} is greater than block end ${t.end}.`);if(t.end+1<=e*r)return[t,void 0];const o=e*r-1,n=e*r;return[{start:t.start,end:o,label:t.label,bits:o-t.start},{start:n,end:t.end,label:t.label,bits:t.end-n}]},"getNextFittingBlock"),v={parser:{yy:void 0},parse:b(async t=>{const e=await _("packet",t),r=v.parser?.yy;if(!(r instanceof w))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");m.debug(e),M(e,r)},"parse")},I=b((t,e,r,o)=>{const n=o.db,l=n.getConfig(),{rowHeight:a,paddingY:i,bitWidth:d,bitsPerRow:c}=l,p=n.getPacket(),s=n.getDiagramTitle(),h=a+i,g=h*(p.length+1)-(s?0:a),k=d*c+2,f=$(e);f.attr("viewBox",`0 0 ${k} ${g}`),C(f,g,k,l.useMaxWidth);for(const[x,y]of p.entries())O(f,y,x,l);f.append("text").text(s).attr("x",k/2).attr("y",g-h/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),O=b((t,e,r,{rowHeight:o,paddingX:n,paddingY:l,bitWidth:a,bitsPerRow:i,showBits:d})=>{const c=t.append("g"),p=r*(o+l)+l;for(const s of e){const h=s.start%i*a+1,g=(s.end-s.start+1)*a-n;if(c.append("rect").attr("x",h).attr("y",p).attr("width",g).attr("height",o).attr("class","packetBlock"),c.append("text").attr("x",h+g/2).attr("y",p+o/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(s.label),!d)continue;const k=s.end===s.start,f=p-2;c.append("text").attr("x",h+(k?g/2:0)).attr("y",f).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",k?"middle":"start").text(s.start),k||c.append("text").attr("x",h+g).attr("y",f).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(s.end)}},"drawWord"),j={draw:I},G={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},H=b(({packet:t}={})=>{const e=u(G,t);return`
.packetByte {
font-size: ${e.byteFontSize};
}
.packetByte.start {
fill: ${e.startByteColor};
}
.packetByte.end {
fill: ${e.endByteColor};
}
.packetLabel {
fill: ${e.labelColor};
font-size: ${e.labelFontSize};
}
.packetTitle {
fill: ${e.titleColor};
font-size: ${e.titleFontSize};
}
.packetBlock {
stroke: ${e.blockStrokeColor};
stroke-width: ${e.blockStrokeWidth};
fill: ${e.blockFillColor};
}
`},"styles"),J={parser:v,get db(){return new w},renderer:j,styles:H};export{J as diagram};

View file

@ -0,0 +1,24 @@
import{p as B}from"./chunk-JWPE2WC7-Bgwiccxa.js";import{_ as b,B as u,F as $,e as C,l as m,b as S,a as D,o as T,p as z,g as F,s as P,z as E,D as A,q as W}from"./mermaid.core-DY8EMjrF.js";import{p as _}from"./cynefin-VYW2F7L2-rK0CO-KU.js";import"./index-8y9QBU_r.js";var N=A.packet,w=class{constructor(){this.packet=[],this.setAccTitle=S,this.getAccTitle=D,this.setDiagramTitle=T,this.getDiagramTitle=z,this.getAccDescription=F,this.setAccDescription=P}static{b(this,"PacketDB")}getConfig(){const t=u({...N,...E().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){W(),this.packet=[]}},L=1e4,M=b((t,e)=>{B(t,e);let r=-1,s=[],n=1;const{bitsPerRow:l}=e.getConfig();for(let{start:a,end:i,bits:d,label:c}of t.blocks){if(a!==void 0&&i!==void 0&&i<a)throw new Error(`Packet block ${a} - ${i} is invalid. End must be greater than start.`);if(a??=r+1,a!==r+1)throw new Error(`Packet block ${a} - ${i??a} is not contiguous. It should start from ${r+1}.`);if(d===0)throw new Error(`Packet block ${a} is invalid. Cannot have a zero bit field.`);for(i??=a+(d??1)-1,d??=i-a+1,r=i,m.debug(`Packet block ${a} - ${r} with label ${c}`);s.length<=l+1&&e.getPacket().length<L;){const[p,o]=Y({start:a,end:i,bits:d,label:c},n,l);if(s.push(p),p.end+1===n*l&&(e.pushWord(s),s=[],n++),!o)break;({start:a,end:i,bits:d,label:c}=o)}}e.pushWord(s)},"populate"),Y=b((t,e,r)=>{if(t.start===void 0)throw new Error("start should have been set during first phase");if(t.end===void 0)throw new Error("end should have been set during first phase");if(t.start>t.end)throw new Error(`Block start ${t.start} is greater than block end ${t.end}.`);if(t.end+1<=e*r)return[t,void 0];const s=e*r-1,n=e*r;return[{start:t.start,end:s,label:t.label,bits:s-t.start},{start:n,end:t.end,label:t.label,bits:t.end-n}]},"getNextFittingBlock"),v={parser:{yy:void 0},parse:b(async t=>{const e=await _("packet",t),r=v.parser?.yy;if(!(r instanceof w))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");m.debug(e),M(e,r)},"parse")},I=b((t,e,r,s)=>{const n=s.db,l=n.getConfig(),{rowHeight:a,paddingY:i,bitWidth:d,bitsPerRow:c}=l,p=n.getPacket(),o=n.getDiagramTitle(),h=a+i,g=h*(p.length+1)-(o?0:a),k=d*c+2,f=$(e);f.attr("viewBox",`0 0 ${k} ${g}`),C(f,g,k,l.useMaxWidth);for(const[x,y]of p.entries())O(f,y,x,l);f.append("text").text(o).attr("x",k/2).attr("y",g-h/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),O=b((t,e,r,{rowHeight:s,paddingX:n,paddingY:l,bitWidth:a,bitsPerRow:i,showBits:d})=>{const c=t.append("g"),p=r*(s+l)+l;for(const o of e){const h=o.start%i*a+1,g=(o.end-o.start+1)*a-n;if(c.append("rect").attr("x",h).attr("y",p).attr("width",g).attr("height",s).attr("class","packetBlock"),c.append("text").attr("x",h+g/2).attr("y",p+s/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(o.label),!d)continue;const k=o.end===o.start,f=p-2;c.append("text").attr("x",h+(k?g/2:0)).attr("y",f).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",k?"middle":"start").text(o.start),k||c.append("text").attr("x",h+g).attr("y",f).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(o.end)}},"drawWord"),j={draw:I},q={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},G=b(({packet:t}={})=>{const e=u(q,t);return`
.packetByte {
font-size: ${e.byteFontSize};
}
.packetByte.start {
fill: ${e.startByteColor};
}
.packetByte.end {
fill: ${e.endByteColor};
}
.packetLabel {
fill: ${e.labelColor};
font-size: ${e.labelFontSize};
}
.packetTitle {
fill: ${e.titleColor};
font-size: ${e.titleFontSize};
}
.packetBlock {
stroke: ${e.blockStrokeColor};
stroke-width: ${e.blockStrokeWidth};
fill: ${e.blockFillColor};
}
`},"styles"),X={parser:v,get db(){return new w},renderer:j,styles:G};export{X as diagram};

View file

@ -1,7 +1,7 @@
import{I as X}from"./chunk-2Q5K7J3B-NzojNxDT.js";import{p as O}from"./chunk-JWPE2WC7-BJMJfnyy.js";import{n as G,b as Y,s as P,o as j,g as F,a as Z,_ as f,A,l as D,D as q,e as U,y as N,p as J,i as K,ai as Q,B as ee,aj as te}from"./mermaid.core-WW7RuneT.js";import{p as ne}from"./cynefin-VYW2F7L2-DI-9Z5R0.js";import"./index-CiHMlsuo.js";import"./_commonjsHelpers-CqkleIqs.js";var E=/[─━│┃└┗├┣]/,S=/[└┗├┣]/,re=/[─━]/,V=/^[\s│┃]+$/,$=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,k=/^\s*%%/,ie=" ";function L(n){return n.some(e=>E.test(e))}f(L,"isBoxDrawingFormat");function _(n){for(const e of n){const t=S.exec(e);if(t?.index&&t.index>0)return t.index}return 4}f(_,"inferSegmentWidth");function M(n,e){return n.replace(/\bline\s+(\d+)\b/gi,(t,r)=>{const i=parseInt(r,10),a=e.get(i);return a?`line ${a}`:t})}f(M,"remapErrorLines");function R(n){const e=n.split(`
import{I as X}from"./chunk-2Q5K7J3B-CQzCXLEo.js";import{p as O}from"./chunk-JWPE2WC7-Bgwiccxa.js";import{o as G,b as Y,s as F,p as P,g as j,a as q,_ as f,B as A,l as D,F as Z,e as U,z as N,q as J,i as K,ai as Q,D as ee,aj as te}from"./mermaid.core-DY8EMjrF.js";import{p as ne}from"./cynefin-VYW2F7L2-rK0CO-KU.js";import"./index-8y9QBU_r.js";var E=/[─━│┃└┗├┣]/,S=/[└┗├┣]/,re=/[─━]/,V=/^[\s│┃]+$/,$=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,k=/^\s*%%/,ie=" ";function L(n){return n.some(e=>E.test(e))}f(L,"isBoxDrawingFormat");function _(n){for(const e of n){const t=S.exec(e);if(t?.index&&t.index>0)return t.index}return 4}f(_,"inferSegmentWidth");function M(n,e){return n.replace(/\bline\s+(\d+)\b/gi,(t,r)=>{const i=parseInt(r,10),a=e.get(i);return a?`line ${a}`:t})}f(M,"remapErrorLines");function R(n){const e=n.split(`
`),t=new Map;let r=-1;for(const[s,o]of e.entries())if(o.trim()==="treeView-beta"){r=s;break}if(r===-1)return{text:n,lineMap:t};const i=[];for(let s=r+1;s<e.length;s++){const o=e[s];o.trim()===""||k.test(o)||$.test(o)||V.test(o)||i.push(o.replace(/\t/g," "))}if(!L(i))return{text:n,lineMap:t};const a=_(i),c=[];let l=0;for(let s=0;s<=r;s++)c.push(e[s]),l++,t.set(l,s+1);for(let s=r+1;s<e.length;s++){const o=e[s],h=o.trim(),p=s+1;if(h===""){c.push(o),l++,t.set(l,p);continue}if(k.test(o)){c.push(o),l++,t.set(l,p);continue}if($.test(o)){c.push(o),l++,t.set(l,p);continue}if(V.test(o))continue;const d=o.replace(/\t/g," "),w=S.exec(d);if(w?.index!==void 0){const g=w.index,m=Math.round(g/a)+1;let u=g+1;for(;u<d.length&&re.test(d[u]);)u++;for(;u<d.length&&d[u]===" ";)u++;const v=d.slice(u).trimEnd();if(!v)throw new Error(`Line ${p}: Empty node — expected a filename or directory name after the box-drawing prefix`);const W=ie.repeat(m);c.push(W+v),l++,t.set(l,p)}else{if(/^[\s─━│┃└┗├┣]+$/.test(d))continue;if(E.test(d))c.push(o),l++,t.set(l,p);else{if(/^\s+/.test(d))throw new Error(`Line ${p}: Unexpected indentation without box-drawing characters. In box-drawing format, use ├── or └── prefixes for indented nodes.`);c.push(o),l++,t.set(l,p)}}}return{text:c.join(`
`),lineMap:t}}f(R,"preprocessBoxDrawing");var x=new X(()=>({cnt:1,stack:[{id:0,level:-1,name:"/",nodeType:"directory",children:[]}]})),oe=f(()=>{x.reset(),J()},"clear"),se=f(()=>x.records.stack[0],"getRoot"),ae=f(()=>x.records.cnt,"getCount"),ce=ee.treeView,le=f(()=>A(ce,N().treeView),"getConfig"),de=f((n,e,t,r,i,a)=>{for(;n<=x.records.stack[x.records.stack.length-1].level;)x.records.stack.pop();const c={id:x.records.cnt++,level:n,name:e,nodeType:t,icon:i,cssClass:r,description:a,children:[]};x.records.stack[x.records.stack.length-1].children.push(c),x.records.stack.push(c)},"addNode"),he={clear:oe,addNode:de,getRoot:se,getCount:ae,getConfig:le,getAccTitle:Z,getAccDescription:F,getDiagramTitle:j,setAccDescription:P,setAccTitle:Y,setDiagramTitle:G},I=he,pe=f(n=>{O(n,I);for(const e of n.nodes){const t=typeof e.indent=="number"?e.indent:0;let r=e.name;const i=r.endsWith("/");i&&(r=r.slice(0,-1));const a=i?"directory":"file",c=e.classAnnotation||void 0,l=e.iconAnnotation,s=l!==void 0?l||"none":void 0,o=e.descAnnotation||void 0,h=o?K(o,N()):void 0;I.addNode(t,r,a,c,s,h)}},"populate"),fe={parse:f(async n=>{const{text:e,lineMap:t}=R(n);try{const r=await ne("treeView",e);D.debug(r),pe(r)}catch(r){throw t.size>0&&r instanceof Error&&(r.message=M(r.message,t)),r}},"parse")},b={prefix:"mermaid-treeview",height:24,width:24,icons:{folder:{body:'<path fill="currentColor" d="M10.59 4.59A2 2 0 0 0 9.17 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.17z"/>'},file:{body:'<path fill="currentColor" fill-rule="evenodd" d="M6 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8.83a2 2 0 0 0-.59-1.42l-4.82-4.82A2 2 0 0 0 13.17 2H6Zm7.5 1.9l4.6 4.6h-3.6a1 1 0 0 1-1-1V3.9Z" clip-rule="evenodd"/>'}}};function H(n,e){const t=e?.filenameIcons?.[n];if(t)return t;const r=n.lastIndexOf(".");if(r>0){const i=n.substring(r).toLowerCase(),a=e?.extensionIcons;return a?.[i]??a?.[i.slice(1)]}}f(H,"detectIcon");function C(n,e){return n.includes(":")?n:n in b.icons||!e?`${b.prefix}:${n}`:`${e}:${n}`}f(C,"qualifyIcon");function B(n,e){if(n.icon!=="none"){if(n.icon)return C(n.icon,e.defaultIconPack);if(e.showIcons){if(n.nodeType==="file"){const t=H(n.name,e);if(t==="none")return;if(t)return C(t,e.defaultIconPack)}return`${b.prefix}:${n.nodeType==="directory"?"folder":"file"}`}}}f(B,"getNodeIcon");te([{name:b.prefix,icons:b}]);var y=14,ge=4,ue=16,z=f((n,e)=>`tv-icon-${n}-${e.replace(/[^\w-]/g,"-")}`,"iconSymbolId"),we=f(async(n,e,t,r)=>{const i=new Set,a=f(s=>{const o=B(s,t);o&&i.add(o),s.children.forEach(a)},"collect");if(a(e),i.size===0)return;const c=await Promise.all([...i].map(async s=>({icon:s,svg:await Q(s,{height:y,width:y})}))),l=n.append("defs");for(const{icon:s,svg:o}of c)l.append("g").attr("id",z(r,s)).html(o)},"injectIconDefs"),me=f((n,e,t,r,i,a)=>{const c=r.append("g");let l="treeView-node-label";t.nodeType==="directory"&&(l+=" treeView-node-dir"),t.cssClass&&(l+=` ${t.cssClass}`);const s=y+ge,o=B(t,i),h=o!==void 0;o&&c.append("use").attr("xlink:href",`#${z(a,o)}`).attr("x",n+i.paddingX).attr("y",e+i.paddingY).attr("class","treeView-node-icon");const p=c.append("text").text(t.name).attr("dominant-baseline","middle").attr("class",l),{height:d,width:w}=p.node().getBBox(),g=d+i.paddingY*2,m=n+i.paddingX+(h?s:0);p.attr("x",m),p.attr("y",e+g/2);const u=m+w,v=w+i.paddingX*2+(h?s:0);return t.BBox={x:n,y:e,width:v,height:g},t.cssClass?.split(/\s+/).includes("highlight")&&c.insert("rect",":first-child").attr("x",n).attr("y",e+1).attr("width",0).attr("height",g-2).attr("rx",3).attr("class","treeView-highlight-bg"),{node:t,nodeGroup:c,labelRightEdge:u,centerY:e+g/2}},"positionLabel"),T=f((n,e,t,r,i,a)=>n.append("line").attr("x1",e).attr("y1",t).attr("x2",r).attr("y2",i).attr("stroke-width",a).attr("class","treeView-node-line"),"positionLine"),xe=f((n,e,t,r)=>{let i=0,a=0;const c=[],l=f((h,p,d,w)=>{const g=w*(d.rowIndent+d.paddingX),m=me(g,i,p,h,d,r);c.push(m);const{height:u,width:v}=p.BBox;T(h,g-d.rowIndent,i+u/2,g,i+u/2,d.lineThickness),a=Math.max(a,g+v),i+=u},"drawNode"),s=f((h,p=0)=>{l(n,h,t,p),h.children.forEach(m=>{s(m,p+1)});const{x:d,y:w,height:g}=h.BBox;if(h.children.length){const{y:m,height:u}=h.children[h.children.length-1].BBox;T(n,d+t.paddingX,w+g,d+t.paddingX,m+u/2+t.lineThickness/2,t.lineThickness)}},"processNode");s(e);const o=c.filter(h=>h.node.description);if(o.length>0){const p=Math.max(...c.map(d=>d.labelRightEdge))+ue;for(const d of o){const g=d.nodeGroup.append("text").text(d.node.description).attr("dominant-baseline","middle").attr("class","treeView-node-description").attr("x",p).attr("y",d.centerY).node().getBBox();a=Math.max(a,p+g.width+t.paddingX)}}for(const h of c)if(h.node.cssClass?.split(/\s+/).includes("highlight")){const p=h.nodeGroup.select(".treeView-highlight-bg");if(!p.empty()){const d=a-h.node.BBox.x+8;p.attr("width",d),a=Math.max(a,h.node.BBox.x+d+2)}}return{totalHeight:i,totalWidth:a}},"drawTree"),ve=f(async(n,e,t,r)=>{D.debug(`Rendering treeView diagram
`+n);const i=r.db,a=i.getRoot(),c=i.getConfig(),l=q(e);await we(l,a,c,e);const s=l.append("g");s.attr("class","tree-view");const{totalHeight:o,totalWidth:h}=xe(s,a,c,e);l.attr("viewBox",`-${c.lineThickness/2} 0 ${h} ${o}`),U(l,o,h,c.useMaxWidth)},"draw"),be={draw:ve},Ie=be,Ce={labelFontSize:"16px",labelColor:"black",lineColor:"black",iconColor:"#546e7a",descriptionColor:"#6a9955",highlightBg:"rgba(255, 193, 7, 0.15)",highlightStroke:"#ffc107"},ye=f(({treeView:n})=>{const{labelFontSize:e,labelColor:t,lineColor:r,iconColor:i,descriptionColor:a,highlightBg:c,highlightStroke:l}=A(Ce,n);return`
`),lineMap:t}}f(R,"preprocessBoxDrawing");var x=new X(()=>({cnt:1,stack:[{id:0,level:-1,name:"/",nodeType:"directory",children:[]}]})),oe=f(()=>{x.reset(),J()},"clear"),se=f(()=>x.records.stack[0],"getRoot"),ae=f(()=>x.records.cnt,"getCount"),ce=ee.treeView,le=f(()=>A(ce,N().treeView),"getConfig"),de=f((n,e,t,r,i,a)=>{for(;n<=x.records.stack[x.records.stack.length-1].level;)x.records.stack.pop();const c={id:x.records.cnt++,level:n,name:e,nodeType:t,icon:i,cssClass:r,description:a,children:[]};x.records.stack[x.records.stack.length-1].children.push(c),x.records.stack.push(c)},"addNode"),he={clear:oe,addNode:de,getRoot:se,getCount:ae,getConfig:le,getAccTitle:q,getAccDescription:j,getDiagramTitle:P,setAccDescription:F,setAccTitle:Y,setDiagramTitle:G},I=he,pe=f(n=>{O(n,I);for(const e of n.nodes){const t=typeof e.indent=="number"?e.indent:0;let r=e.name;const i=r.endsWith("/");i&&(r=r.slice(0,-1));const a=i?"directory":"file",c=e.classAnnotation||void 0,l=e.iconAnnotation,s=l!==void 0?l||"none":void 0,o=e.descAnnotation||void 0,h=o?K(o,N()):void 0;I.addNode(t,r,a,c,s,h)}},"populate"),fe={parse:f(async n=>{const{text:e,lineMap:t}=R(n);try{const r=await ne("treeView",e);D.debug(r),pe(r)}catch(r){throw t.size>0&&r instanceof Error&&(r.message=M(r.message,t)),r}},"parse")},b={prefix:"mermaid-treeview",height:24,width:24,icons:{folder:{body:'<path fill="currentColor" d="M10.59 4.59A2 2 0 0 0 9.17 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.17z"/>'},file:{body:'<path fill="currentColor" fill-rule="evenodd" d="M6 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8.83a2 2 0 0 0-.59-1.42l-4.82-4.82A2 2 0 0 0 13.17 2H6Zm7.5 1.9l4.6 4.6h-3.6a1 1 0 0 1-1-1V3.9Z" clip-rule="evenodd"/>'}}};function z(n,e){const t=e?.filenameIcons?.[n];if(t)return t;const r=n.lastIndexOf(".");if(r>0){const i=n.substring(r).toLowerCase(),a=e?.extensionIcons;return a?.[i]??a?.[i.slice(1)]}}f(z,"detectIcon");function C(n,e){return n.includes(":")?n:n in b.icons||!e?`${b.prefix}:${n}`:`${e}:${n}`}f(C,"qualifyIcon");function B(n,e){if(n.icon!=="none"){if(n.icon)return C(n.icon,e.defaultIconPack);if(e.showIcons){if(n.nodeType==="file"){const t=z(n.name,e);if(t==="none")return;if(t)return C(t,e.defaultIconPack)}return`${b.prefix}:${n.nodeType==="directory"?"folder":"file"}`}}}f(B,"getNodeIcon");te([{name:b.prefix,icons:b}]);var y=14,ge=4,ue=16,H=f((n,e)=>`tv-icon-${n}-${e.replace(/[^\w-]/g,"-")}`,"iconSymbolId"),we=f(async(n,e,t,r)=>{const i=new Set,a=f(s=>{const o=B(s,t);o&&i.add(o),s.children.forEach(a)},"collect");if(a(e),i.size===0)return;const c=await Promise.all([...i].map(async s=>({icon:s,svg:await Q(s,{height:y,width:y})}))),l=n.append("defs");for(const{icon:s,svg:o}of c)l.append("g").attr("id",H(r,s)).html(o)},"injectIconDefs"),me=f((n,e,t,r,i,a)=>{const c=r.append("g");let l="treeView-node-label";t.nodeType==="directory"&&(l+=" treeView-node-dir"),t.cssClass&&(l+=` ${t.cssClass}`);const s=y+ge,o=B(t,i),h=o!==void 0;o&&c.append("use").attr("xlink:href",`#${H(a,o)}`).attr("x",n+i.paddingX).attr("y",e+i.paddingY).attr("class","treeView-node-icon");const p=c.append("text").text(t.name).attr("dominant-baseline","middle").attr("class",l),{height:d,width:w}=p.node().getBBox(),g=d+i.paddingY*2,m=n+i.paddingX+(h?s:0);p.attr("x",m),p.attr("y",e+g/2);const u=m+w,v=w+i.paddingX*2+(h?s:0);return t.BBox={x:n,y:e,width:v,height:g},t.cssClass?.split(/\s+/).includes("highlight")&&c.insert("rect",":first-child").attr("x",n).attr("y",e+1).attr("width",0).attr("height",g-2).attr("rx",3).attr("class","treeView-highlight-bg"),{node:t,nodeGroup:c,labelRightEdge:u,centerY:e+g/2}},"positionLabel"),T=f((n,e,t,r,i,a)=>n.append("line").attr("x1",e).attr("y1",t).attr("x2",r).attr("y2",i).attr("stroke-width",a).attr("class","treeView-node-line"),"positionLine"),xe=f((n,e,t,r)=>{let i=0,a=0;const c=[],l=f((h,p,d,w)=>{const g=w*(d.rowIndent+d.paddingX),m=me(g,i,p,h,d,r);c.push(m);const{height:u,width:v}=p.BBox;T(h,g-d.rowIndent,i+u/2,g,i+u/2,d.lineThickness),a=Math.max(a,g+v),i+=u},"drawNode"),s=f((h,p=0)=>{l(n,h,t,p),h.children.forEach(m=>{s(m,p+1)});const{x:d,y:w,height:g}=h.BBox;if(h.children.length){const{y:m,height:u}=h.children[h.children.length-1].BBox;T(n,d+t.paddingX,w+g,d+t.paddingX,m+u/2+t.lineThickness/2,t.lineThickness)}},"processNode");s(e);const o=c.filter(h=>h.node.description);if(o.length>0){const p=Math.max(...c.map(d=>d.labelRightEdge))+ue;for(const d of o){const g=d.nodeGroup.append("text").text(d.node.description).attr("dominant-baseline","middle").attr("class","treeView-node-description").attr("x",p).attr("y",d.centerY).node().getBBox();a=Math.max(a,p+g.width+t.paddingX)}}for(const h of c)if(h.node.cssClass?.split(/\s+/).includes("highlight")){const p=h.nodeGroup.select(".treeView-highlight-bg");if(!p.empty()){const d=a-h.node.BBox.x+8;p.attr("width",d),a=Math.max(a,h.node.BBox.x+d+2)}}return{totalHeight:i,totalWidth:a}},"drawTree"),ve=f(async(n,e,t,r)=>{D.debug(`Rendering treeView diagram
`+n);const i=r.db,a=i.getRoot(),c=i.getConfig(),l=Z(e);await we(l,a,c,e);const s=l.append("g");s.attr("class","tree-view");const{totalHeight:o,totalWidth:h}=xe(s,a,c,e);l.attr("viewBox",`-${c.lineThickness/2} 0 ${h} ${o}`),U(l,o,h,c.useMaxWidth)},"draw"),be={draw:ve},Ie=be,Ce={labelFontSize:"16px",labelColor:"black",lineColor:"black",iconColor:"#546e7a",descriptionColor:"#6a9955",highlightBg:"rgba(255, 193, 7, 0.15)",highlightStroke:"#ffc107"},ye=f(({treeView:n})=>{const{labelFontSize:e,labelColor:t,lineColor:r,iconColor:i,descriptionColor:a,highlightBg:c,highlightStroke:l}=A(Ce,n);return`
.treeView-node-label {
font-size: ${e};
fill: ${t};
@ -27,4 +27,4 @@ import{I as X}from"./chunk-2Q5K7J3B-NzojNxDT.js";import{p as O}from"./chunk-JWPE
stroke: ${l};
stroke-width: 1;
}
`},"styles"),Be=ye,Ne={db:I,renderer:Ie,parser:fe,styles:Be};export{Ne as diagram};
`},"styles"),Be=ye,De={db:I,renderer:Ie,parser:fe,styles:Be};export{De as diagram};

View file

@ -0,0 +1,41 @@
import{p as k}from"./chunk-JWPE2WC7-Bgwiccxa.js";import{s as R,g as F,p as I,o as _,a as D,b as E,_ as c,F as z,q as P,B as y,z as C,D as G,l as B,W,e as V}from"./mermaid.core-DY8EMjrF.js";import{p as H}from"./cynefin-VYW2F7L2-rK0CO-KU.js";import"./index-8y9QBU_r.js";var m={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"},w={axes:[],curves:[],options:m},x=structuredClone(w),j=G.radar,q=c(()=>y({...j,...C().radar}),"getConfig"),b=c(()=>x.axes,"getAxes"),N=c(()=>x.curves,"getCurves"),U=c(()=>x.options,"getOptions"),X=c(a=>{x.axes=a.map(t=>({name:t.name,label:t.label??t.name}))},"setAxes"),Y=c(a=>{x.curves=a.map(t=>({name:t.name,label:t.label??t.name,entries:Z(t.entries)}))},"setCurves"),Z=c(a=>{if(a[0].axis==null)return a.map(e=>e.value);const t=b();if(t.length===0)throw new Error("Axes must be populated before curves for reference entries");return t.map(e=>{const r=a.find(s=>s.axis?.$refText===e.name);if(r===void 0)throw new Error("Missing entry for axis "+e.label);return r.value})},"computeCurveEntries"),J=c(a=>{const t=a.reduce((e,r)=>(e[r.name]=r,e),{});x.options={showLegend:t.showLegend?.value??m.showLegend,ticks:t.ticks?.value??m.ticks,max:t.max?.value??m.max,min:t.min?.value??m.min,graticule:t.graticule?.value??m.graticule}},"setOptions"),K=c(()=>{P(),x=structuredClone(w)},"clear"),$={getAxes:b,getCurves:N,getOptions:U,setAxes:X,setCurves:Y,setOptions:J,getConfig:q,clear:K,setAccTitle:E,getAccTitle:D,setDiagramTitle:_,getDiagramTitle:I,getAccDescription:F,setAccDescription:R},Q=c(a=>{k(a,$);const{axes:t,curves:e,options:r}=a;$.setAxes(t),$.setCurves(e),$.setOptions(r)},"populate"),tt={parse:c(async a=>{const t=await H("radar",a);B.debug(t),Q(t)},"parse")},et=c((a,t,e,r)=>{const s=r.db,i=s.getAxes(),l=s.getCurves(),n=s.getOptions(),o=s.getConfig(),d=s.getDiagramTitle(),p=z(t),u=at(p,o),g=n.max??Math.max(...l.map(f=>Math.max(...f.entries))),h=n.min,v=Math.min(o.width,o.height)/2;rt(u,i,v,n.ticks,n.graticule),st(u,i,v,o),A(u,i,l,h,g,n.graticule,o),T(u,l,n.showLegend,o),u.append("text").attr("class","radarTitle").text(d).attr("x",0).attr("y",-o.height/2-o.marginTop)},"draw"),at=c((a,t)=>{const e=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,s={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return V(a,r,e,t.useMaxWidth??!0),a.attr("viewBox",`0 0 ${e} ${r}`).attr("overflow","visible"),a.append("g").attr("transform",`translate(${s.x}, ${s.y})`)},"drawFrame"),rt=c((a,t,e,r,s)=>{if(s==="circle")for(let i=0;i<r;i++){const l=e*(i+1)/r;a.append("circle").attr("r",l).attr("class","radarGraticule")}else if(s==="polygon"){const i=t.length;for(let l=0;l<r;l++){const n=e*(l+1)/r,o=t.map((d,p)=>{const u=2*p*Math.PI/i-Math.PI/2,g=n*Math.cos(u),h=n*Math.sin(u);return`${g},${h}`}).join(" ");a.append("polygon").attr("points",o).attr("class","radarGraticule")}}},"drawGraticule"),st=c((a,t,e,r)=>{const s=t.length;for(let i=0;i<s;i++){const l=t[i].label,n=2*i*Math.PI/s-Math.PI/2,o=Math.cos(n),d=Math.sin(n);a.append("line").attr("x1",0).attr("y1",0).attr("x2",e*r.axisScaleFactor*o).attr("y2",e*r.axisScaleFactor*d).attr("class","radarAxisLine");const p=o>.01?"start":o<-.01?"end":"middle",u=d>.01?"hanging":d<-.01?"auto":"central",g=4;a.append("text").text(l).attr("x",e*r.axisLabelFactor*o+g*o).attr("y",e*r.axisLabelFactor*d+g*d).attr("text-anchor",p).attr("dominant-baseline",u).attr("class","radarAxisLabel")}},"drawAxes");function A(a,t,e,r,s,i,l){const n=t.length,o=Math.min(l.width,l.height)/2;e.forEach((d,p)=>{if(d.entries.length!==n)return;const u=d.entries.map((g,h)=>{const v=2*Math.PI*h/n-Math.PI/2,f=M(g,r,s,o),S=f*Math.cos(v),O=f*Math.sin(v);return{x:S,y:O}});i==="circle"?a.append("path").attr("d",L(u,l.curveTension)).attr("class",`radarCurve-${p}`):i==="polygon"&&a.append("polygon").attr("points",u.map(g=>`${g.x},${g.y}`).join(" ")).attr("class",`radarCurve-${p}`)})}c(A,"drawCurves");function M(a,t,e,r){const s=Math.min(Math.max(a,t),e);return r*(s-t)/(e-t)}c(M,"relativeRadius");function L(a,t){const e=a.length;let r=`M${a[0].x},${a[0].y}`;for(let s=0;s<e;s++){const i=a[(s-1+e)%e],l=a[s],n=a[(s+1)%e],o=a[(s+2)%e],d={x:l.x+(n.x-i.x)*t,y:l.y+(n.y-i.y)*t},p={x:n.x-(o.x-l.x)*t,y:n.y-(o.y-l.y)*t};r+=` C${d.x},${d.y} ${p.x},${p.y} ${n.x},${n.y}`}return`${r} Z`}c(L,"closedRoundCurve");function T(a,t,e,r){if(!e)return;const s=(r.width/2+r.marginRight)*3/4,i=-(r.height/2+r.marginTop)*3/4,l=20;t.forEach((n,o)=>{const d=a.append("g").attr("transform",`translate(${s}, ${i+o*l})`);d.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${o}`),d.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(n.label)})}c(T,"drawLegend");var nt={draw:et},ot=c((a,t)=>{let e="";for(let r=0;r<a.THEME_COLOR_LIMIT;r++){const s=a[`cScale${r}`];e+=`
.radarCurve-${r} {
color: ${s};
fill: ${s};
fill-opacity: ${t.curveOpacity};
stroke: ${s};
stroke-width: ${t.curveStrokeWidth};
}
.radarLegendBox-${r} {
fill: ${s};
fill-opacity: ${t.curveOpacity};
stroke: ${s};
}
`}return e},"genIndexStyles"),it=c(a=>{const t=W(),e=C(),r=y(t,e.themeVariables),s=y(r.radar,a);return{themeVariables:r,radarOptions:s}},"buildRadarStyleOptions"),lt=c(({radar:a}={})=>{const{themeVariables:t,radarOptions:e}=it(a);return`
.radarTitle {
font-size: ${t.fontSize};
color: ${t.titleColor};
dominant-baseline: hanging;
text-anchor: middle;
}
.radarAxisLine {
stroke: ${e.axisColor};
stroke-width: ${e.axisStrokeWidth};
}
.radarAxisLabel {
font-size: ${e.axisLabelFontSize}px;
color: ${e.axisColor};
}
.radarGraticule {
fill: ${e.graticuleColor};
fill-opacity: ${e.graticuleOpacity};
stroke: ${e.graticuleColor};
stroke-width: ${e.graticuleStrokeWidth};
}
.radarLegendText {
text-anchor: start;
font-size: ${e.legendFontSize}px;
dominant-baseline: hanging;
}
${ot(t,e)}
`},"styles"),gt={parser:tt,db:$,renderer:nt,styles:lt};export{gt as diagram};

View file

@ -1,41 +0,0 @@
import{p as k}from"./chunk-JWPE2WC7-BJMJfnyy.js";import{s as R,g as E,o as I,n as _,a as D,b as F,_ as c,D as P,p as z,A as y,y as C,B as G,l as B,E as W,e as V}from"./mermaid.core-WW7RuneT.js";import{p as H}from"./cynefin-VYW2F7L2-DI-9Z5R0.js";import"./index-CiHMlsuo.js";import"./_commonjsHelpers-CqkleIqs.js";var m={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"},w={axes:[],curves:[],options:m},x=structuredClone(w),j=G.radar,N=c(()=>y({...j,...C().radar}),"getConfig"),b=c(()=>x.axes,"getAxes"),U=c(()=>x.curves,"getCurves"),X=c(()=>x.options,"getOptions"),Y=c(a=>{x.axes=a.map(t=>({name:t.name,label:t.label??t.name}))},"setAxes"),Z=c(a=>{x.curves=a.map(t=>({name:t.name,label:t.label??t.name,entries:q(t.entries)}))},"setCurves"),q=c(a=>{if(a[0].axis==null)return a.map(e=>e.value);const t=b();if(t.length===0)throw new Error("Axes must be populated before curves for reference entries");return t.map(e=>{const r=a.find(s=>s.axis?.$refText===e.name);if(r===void 0)throw new Error("Missing entry for axis "+e.label);return r.value})},"computeCurveEntries"),J=c(a=>{const t=a.reduce((e,r)=>(e[r.name]=r,e),{});x.options={showLegend:t.showLegend?.value??m.showLegend,ticks:t.ticks?.value??m.ticks,max:t.max?.value??m.max,min:t.min?.value??m.min,graticule:t.graticule?.value??m.graticule}},"setOptions"),K=c(()=>{z(),x=structuredClone(w)},"clear"),$={getAxes:b,getCurves:U,getOptions:X,setAxes:Y,setCurves:Z,setOptions:J,getConfig:N,clear:K,setAccTitle:F,getAccTitle:D,setDiagramTitle:_,getDiagramTitle:I,getAccDescription:E,setAccDescription:R},Q=c(a=>{k(a,$);const{axes:t,curves:e,options:r}=a;$.setAxes(t),$.setCurves(e),$.setOptions(r)},"populate"),tt={parse:c(async a=>{const t=await H("radar",a);B.debug(t),Q(t)},"parse")},et=c((a,t,e,r)=>{const s=r.db,i=s.getAxes(),l=s.getCurves(),n=s.getOptions(),o=s.getConfig(),d=s.getDiagramTitle(),p=P(t),u=at(p,o),g=n.max??Math.max(...l.map(f=>Math.max(...f.entries))),h=n.min,v=Math.min(o.width,o.height)/2;rt(u,i,v,n.ticks,n.graticule),st(u,i,v,o),A(u,i,l,h,g,n.graticule,o),T(u,l,n.showLegend,o),u.append("text").attr("class","radarTitle").text(d).attr("x",0).attr("y",-o.height/2-o.marginTop)},"draw"),at=c((a,t)=>{const e=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,s={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return V(a,r,e,t.useMaxWidth??!0),a.attr("viewBox",`0 0 ${e} ${r}`).attr("overflow","visible"),a.append("g").attr("transform",`translate(${s.x}, ${s.y})`)},"drawFrame"),rt=c((a,t,e,r,s)=>{if(s==="circle")for(let i=0;i<r;i++){const l=e*(i+1)/r;a.append("circle").attr("r",l).attr("class","radarGraticule")}else if(s==="polygon"){const i=t.length;for(let l=0;l<r;l++){const n=e*(l+1)/r,o=t.map((d,p)=>{const u=2*p*Math.PI/i-Math.PI/2,g=n*Math.cos(u),h=n*Math.sin(u);return`${g},${h}`}).join(" ");a.append("polygon").attr("points",o).attr("class","radarGraticule")}}},"drawGraticule"),st=c((a,t,e,r)=>{const s=t.length;for(let i=0;i<s;i++){const l=t[i].label,n=2*i*Math.PI/s-Math.PI/2,o=Math.cos(n),d=Math.sin(n);a.append("line").attr("x1",0).attr("y1",0).attr("x2",e*r.axisScaleFactor*o).attr("y2",e*r.axisScaleFactor*d).attr("class","radarAxisLine");const p=o>.01?"start":o<-.01?"end":"middle",u=d>.01?"hanging":d<-.01?"auto":"central",g=4;a.append("text").text(l).attr("x",e*r.axisLabelFactor*o+g*o).attr("y",e*r.axisLabelFactor*d+g*d).attr("text-anchor",p).attr("dominant-baseline",u).attr("class","radarAxisLabel")}},"drawAxes");function A(a,t,e,r,s,i,l){const n=t.length,o=Math.min(l.width,l.height)/2;e.forEach((d,p)=>{if(d.entries.length!==n)return;const u=d.entries.map((g,h)=>{const v=2*Math.PI*h/n-Math.PI/2,f=M(g,r,s,o),S=f*Math.cos(v),O=f*Math.sin(v);return{x:S,y:O}});i==="circle"?a.append("path").attr("d",L(u,l.curveTension)).attr("class",`radarCurve-${p}`):i==="polygon"&&a.append("polygon").attr("points",u.map(g=>`${g.x},${g.y}`).join(" ")).attr("class",`radarCurve-${p}`)})}c(A,"drawCurves");function M(a,t,e,r){const s=Math.min(Math.max(a,t),e);return r*(s-t)/(e-t)}c(M,"relativeRadius");function L(a,t){const e=a.length;let r=`M${a[0].x},${a[0].y}`;for(let s=0;s<e;s++){const i=a[(s-1+e)%e],l=a[s],n=a[(s+1)%e],o=a[(s+2)%e],d={x:l.x+(n.x-i.x)*t,y:l.y+(n.y-i.y)*t},p={x:n.x-(o.x-l.x)*t,y:n.y-(o.y-l.y)*t};r+=` C${d.x},${d.y} ${p.x},${p.y} ${n.x},${n.y}`}return`${r} Z`}c(L,"closedRoundCurve");function T(a,t,e,r){if(!e)return;const s=(r.width/2+r.marginRight)*3/4,i=-(r.height/2+r.marginTop)*3/4,l=20;t.forEach((n,o)=>{const d=a.append("g").attr("transform",`translate(${s}, ${i+o*l})`);d.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${o}`),d.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(n.label)})}c(T,"drawLegend");var nt={draw:et},ot=c((a,t)=>{let e="";for(let r=0;r<a.THEME_COLOR_LIMIT;r++){const s=a[`cScale${r}`];e+=`
.radarCurve-${r} {
color: ${s};
fill: ${s};
fill-opacity: ${t.curveOpacity};
stroke: ${s};
stroke-width: ${t.curveStrokeWidth};
}
.radarLegendBox-${r} {
fill: ${s};
fill-opacity: ${t.curveOpacity};
stroke: ${s};
}
`}return e},"genIndexStyles"),it=c(a=>{const t=W(),e=C(),r=y(t,e.themeVariables),s=y(r.radar,a);return{themeVariables:r,radarOptions:s}},"buildRadarStyleOptions"),lt=c(({radar:a}={})=>{const{themeVariables:t,radarOptions:e}=it(a);return`
.radarTitle {
font-size: ${t.fontSize};
color: ${t.titleColor};
dominant-baseline: hanging;
text-anchor: middle;
}
.radarAxisLine {
stroke: ${e.axisColor};
stroke-width: ${e.axisStrokeWidth};
}
.radarAxisLabel {
font-size: ${e.axisLabelFontSize}px;
color: ${e.axisColor};
}
.radarGraticule {
fill: ${e.graticuleColor};
fill-opacity: ${e.graticuleOpacity};
stroke: ${e.graticuleColor};
stroke-width: ${e.graticuleStrokeWidth};
}
.radarLegendText {
text-anchor: start;
font-size: ${e.legendFontSize}px;
dominant-baseline: hanging;
}
${ot(t,e)}
`},"styles"),xt={parser:tt,db:$,renderer:nt,styles:lt};export{xt as diagram};

View file

@ -1 +0,0 @@
import{g as l,r as m,d as n}from"./chunk-MOJQB5TN-DmVMZHwQ.js";import{p}from"./chunk-JWPE2WC7-BJMJfnyy.js";import{_ as t,l as o}from"./mermaid.core-WW7RuneT.js";import{M as u,a as f}from"./cynefin-VYW2F7L2-DI-9Z5R0.js";import"./index-CiHMlsuo.js";import"./_commonjsHelpers-CqkleIqs.js";var c=f().RailroadEbnf.parser.LangiumParser,s=t(e=>{const r=e.alternatives.map(E);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformChoice"),E=t(e=>{const r=e.elements.map(d);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),i=t(e=>{switch(e.$type){case"EbnfTerminal":return{type:"terminal",value:e.value};case"EbnfNonTerminal":return{type:"nonterminal",name:e.name};case"EbnfSpecial":return{type:"special",text:e.text};case"EbnfGroup":return s(e.element);case"EbnfOptional":return{type:"optional",element:s(e.element)};case"EbnfRepetition":return{type:"repetition",element:s(e.element),min:0,max:1/0};default:throw new Error(`Unsupported EBNF primary node: ${e.$type}`)}},"transformPrimary"),b=t((e,r)=>{switch(r.$type){case"EbnfOptionalPostfix":return{type:"optional",element:e};case"EbnfZeroOrMorePostfix":return{type:"repetition",element:e,min:0,max:1/0};case"EbnfOneOrMorePostfix":return{type:"repetition",element:e,min:1,max:1/0};case"EbnfExceptionPostfix":return{type:"sequence",elements:[e,{type:"terminal",value:"-"},i(r.except)]};default:throw new Error(`Unsupported EBNF postfix node: ${r.$type}`)}},"transformPostfix"),d=t(e=>e.postfixes.reduce((r,a)=>b(r,a),i(e.base)),"transformTerm"),y=t(e=>({name:e.name,definition:s(e.definition)}),"transformRule"),v=t(e=>{p(e,n),e.title&&n.setTitle(e.title),e.rules.map(r=>n.addRule(y(r)))},"populateDb"),g={parse:t(e=>{n.clear(),o.debug("[EBNF Parser] Starting Langium parse");const r=c.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const a=r.value;o.debug("[EBNF Parser] Parsed rules:",a.rules.length),v(a),o.debug("[EBNF Parser] Parse complete")},"parse"),parser:{yy:n}},S={parser:g,db:n,renderer:m,styles:l};export{S as diagram};

View file

@ -0,0 +1 @@
import{g as l,r as m,d as n}from"./chunk-MOJQB5TN-CClISXJW.js";import{p}from"./chunk-JWPE2WC7-Bgwiccxa.js";import{_ as t,l as o}from"./mermaid.core-DY8EMjrF.js";import{M as u,a as f}from"./cynefin-VYW2F7L2-rK0CO-KU.js";import"./index-8y9QBU_r.js";var c=f().RailroadEbnf.parser.LangiumParser,s=t(e=>{const r=e.alternatives.map(E);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformChoice"),E=t(e=>{const r=e.elements.map(d);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),i=t(e=>{switch(e.$type){case"EbnfTerminal":return{type:"terminal",value:e.value};case"EbnfNonTerminal":return{type:"nonterminal",name:e.name};case"EbnfSpecial":return{type:"special",text:e.text};case"EbnfGroup":return s(e.element);case"EbnfOptional":return{type:"optional",element:s(e.element)};case"EbnfRepetition":return{type:"repetition",element:s(e.element),min:0,max:1/0};default:throw new Error(`Unsupported EBNF primary node: ${e.$type}`)}},"transformPrimary"),b=t((e,r)=>{switch(r.$type){case"EbnfOptionalPostfix":return{type:"optional",element:e};case"EbnfZeroOrMorePostfix":return{type:"repetition",element:e,min:0,max:1/0};case"EbnfOneOrMorePostfix":return{type:"repetition",element:e,min:1,max:1/0};case"EbnfExceptionPostfix":return{type:"sequence",elements:[e,{type:"terminal",value:"-"},i(r.except)]};default:throw new Error(`Unsupported EBNF postfix node: ${r.$type}`)}},"transformPostfix"),d=t(e=>e.postfixes.reduce((r,a)=>b(r,a),i(e.base)),"transformTerm"),y=t(e=>({name:e.name,definition:s(e.definition)}),"transformRule"),v=t(e=>{p(e,n),e.title&&n.setTitle(e.title),e.rules.map(r=>n.addRule(y(r)))},"populateDb"),g={parse:t(e=>{n.clear(),o.debug("[EBNF Parser] Starting Langium parse");const r=c.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const a=r.value;o.debug("[EBNF Parser] Parsed rules:",a.rules.length),v(a),o.debug("[EBNF Parser] Parse complete")},"parse"),parser:{yy:n}},R={parser:g,db:n,renderer:m,styles:l};export{R as diagram};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1 +0,0 @@
import c from"./CodeBlockNode-Dh6YGbd1.js";import{M as v,bl as g,aL as P,s as C,A as b,bJ as i,aY as d,av as k,a4 as x,ar as S,bk as T,q as O}from"./index-CiHMlsuo.js";import"./safeRaf-DGuzXxDK.js";var H=Object.defineProperty,z=Object.defineProperties,j=Object.getOwnPropertyDescriptors,u=Object.getOwnPropertySymbols,F=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable,m=(o,s,e)=>s in o?H(o,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[s]=e;const h=v({__name:"MarkdownCodeBlockNode",props:{node:{},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},darkTheme:{default:"vitesse-dark"},lightTheme:{default:"vitesse-light"},isDark:{type:Boolean,default:!1},isShowPreview:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},minWidth:{default:void 0},maxWidth:{default:void 0},showPreviewButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},showTooltips:{type:Boolean},autoScrollOnUpdate:{type:Boolean},autoScrollInitial:{type:Boolean},estimatedHeightPx:{},estimatedContentHeightPx:{},themes:{},langs:{},showHeader:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0}},emits:["previewCode","copy"],setup(o,{emit:s}){const e=o,p=s,w=c,f=g(),y=O(()=>{return t=((a,n)=>{for(var r in n||(n={}))F.call(n,r)&&m(a,r,n[r]);if(u)for(var r of u(n))W.call(n,r)&&m(a,r,n[r]);return a})({},f),l={node:e.node,loading:e.loading,stream:e.stream,darkTheme:e.darkTheme,lightTheme:e.lightTheme,isDark:e.isDark,isShowPreview:e.isShowPreview,enableFontSizeControl:e.enableFontSizeControl,minWidth:e.minWidth,maxWidth:e.maxWidth,themes:e.themes,showHeader:e.showHeader,showCopyButton:e.showCopyButton,showExpandButton:e.showExpandButton,showPreviewButton:e.showPreviewButton,showCollapseButton:e.showCollapseButton,showFontSizeButtons:e.showFontSizeButtons,showTooltips:e.showTooltips,estimatedHeightPx:e.estimatedHeightPx,estimatedContentHeightPx:e.estimatedContentHeightPx},z(t,j(l));var t,l});function B(t){p("previewCode",{type:t.artifactType,content:e.node.code,title:t.artifactTitle})}return(t,l)=>(P(),C(T(w),S(y.value,{onPreviewCode:B,onCopy:l[0]||(l[0]=a=>p("copy",a))}),b({_:2},[t.$slots["header-left"]?{name:"header-left",fn:i(()=>[d(t.$slots,"header-left")]),key:"0"}:void 0,t.$slots["header-right"]?{name:"header-right",fn:i(()=>[d(t.$slots,"header-right")]),key:"1"}:void 0,t.$slots.loading?{name:"loading",fn:i(a=>[d(t.$slots,"loading",k(x(a)))]),key:"2"}:void 0]),1040))}});h.install=o=>{o.component(h.__name,h)};export{h as default};

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
import{bQ as A,M as K,a0 as W,bS as z,bT as C,aU as k,bU as I,bE as H,aD as P,az as V,aL as T,u as M,bb as X,s as q,bJ as j,v as B,aY as F,g as G,t as J,q as D,bV as Q,bW as Y,bX as Z}from"./index-8y9QBU_r.js";var N=(h,w,d)=>new Promise((y,e)=>{var _=o=>{try{t(d.next(o))}catch(i){e(i)}},s=o=>{try{t(d.throw(o))}catch(i){e(i)}},t=o=>o.done?y(o.value):Promise.resolve(o.value).then(_,s);t((d=d.apply(h,w)).next())});const ee=["data-markstream-mode","data-markstream-pending"],ne=["innerHTML"],ae={key:1,class:"math-inline math-inline--fallback"},le={class:"math-inline__loading",role:"status","aria-live":"polite"},L=A(K({__name:"MathInlineNode",props:{node:{}},setup(h){var w,d,y;const e=h,_=k(null),s=D(()=>e.node.markup==="$$"),t=D(()=>I(e.node.content)),o=((d=(w=W())==null?void 0:w.vnode.el)==null?void 0:d.nodeType)===1,i=(function(){if(!e.node.content)return{html:"",text:e.node.loading?"":e.node.raw,loading:e.node.loading};if(e.node.loading)return{html:"",text:"",loading:!0};const n=z();if(!n){const a=typeof window>"u"||o;return{html:"",text:a?e.node.raw:"",loading:!a}}try{const a=n.renderToString(t.value,{throwOnError:!1,displayMode:s.value});return C(t.value,s.value,a),{html:a,text:"",loading:!1}}catch{return{html:"",text:e.node.loading?"":e.node.raw,loading:e.node.loading}}})(),u=k(i.html),c=k(i.text);let b=!1,g=0,v=!1,m=null;const f=k(i.loading),x=k(!1);function E(n){n!=null&&n!==g||(x.value=!1)}function $(){return N(this,null,function*(){if(v)return;m&&(m.abort(),m=null);const n=++g;if(!e.node.content)return E(),u.value="",c.value=e.node.loading?"":e.node.raw,f.value=e.node.loading,void(b=!1);const a=new AbortController;m=a,x.value=!0,v||n!==g||a.signal.aborted?E(n):Q(t.value,s.value,{timeout:1500,waitTimeout:1500,maxRetries:8,signal:a.signal}).then(l=>{v||n!==g||(u.value=l,c.value="",f.value=!1,b=!0)}).catch(l=>N(null,null,function*(){if(v||n!==g)return;const p=l?.code||l?.name,U=p==="KATEX_DISABLED";if(p==="WORKER_INIT_ERROR"||l?.fallbackToRenderer||(p===Y||p==="WORKER_TIMEOUT")&&!e.node.loading){const S=yield Z();if(v||n!==g)return;if(S){try{const R=S.renderToString(t.value,{throwOnError:e.node.loading,displayMode:s.value});u.value=R,c.value="",f.value=!1,b=!0,C(t.value,s.value,R)}catch{}return}}if(U||!e.node.loading)return f.value=!1,u.value="",void(c.value=e.node.raw);b||(f.value=!0)})).finally(()=>{v||E(n)})})}i.html&&(b=!0);let r=null,O=`${I(e.node.content)}\0${(y=e.node.markup)!=null?y:""}\0${e.node.loading?"1":"0"}`;return H(()=>[e.node.content,e.node.loading,e.node.raw,e.node.markup],()=>{(function(){var n;const a=I(e.node.content),l=e.node.loading===!0,p=`${a}\0${(n=e.node.markup)!=null?n:""}\0${l?"1":"0"}`;if(p!==O){if(O=p,!l)return r!=null&&(clearTimeout(r),r=null),void $();r==null&&(r=setTimeout(()=>{r=null,$()},32))}})()}),P(()=>{u.value||$()}),V(()=>{v=!0,r!=null&&(clearTimeout(r),r=null),m&&(m.abort(),m=null)}),(n,a)=>(T(),M("span",{ref_key:"containerEl",ref:_,class:"math-inline-wrapper","data-markstream-math":"inline","data-markstream-mode":u.value?"katex":c.value?"fallback":"loading","data-markstream-pending":x.value?"true":void 0},[u.value?(T(),M("span",{key:0,class:"math-inline",innerHTML:u.value},null,8,ne)):c.value?(T(),M("span",ae,X(c.value),1)):f.value?(T(),q(G,{key:2,name:"table-node-fade"},{default:j(()=>[B("span",le,[F(n.$slots,"loading",{isLoading:f.value},()=>[a[0]||(a[0]=B("span",{class:"math-inline__spinner animate-spin","aria-hidden":"true"},null,-1)),a[1]||(a[1]=B("span",{class:"sr-only"},"Loading",-1))],!0)])]),_:3})):J("",!0)],8,ee))}}),[["__scopeId","data-v-73d5e320"]]);L.install=h=>{h.component(L.__name,L)};export{L as default};

View file

@ -1 +0,0 @@
import{bQ as C,M as D,a0 as N,bS as U,bT as L,aU as h,bE as A,aD as K,az as W,aL as y,u as x,bb as z,s as H,bJ as P,v as M,aY as V,g as X,t as j,q as O,bU as q,bV as F,bW as J,bX as Q}from"./index-CiHMlsuo.js";var S=(f,b,r)=>new Promise((e,k)=>{var i=l=>{try{p(r.next(l))}catch(t){k(t)}},d=l=>{try{p(r.throw(l))}catch(t){k(t)}},p=l=>l.done?e(l.value):Promise.resolve(l.value).then(i,d);p((r=r.apply(f,b)).next())});const Y=["data-markstream-mode","data-markstream-pending"],G=["innerHTML"],Z={key:1,class:"math-inline math-inline--fallback"},ee={class:"math-inline__loading",role:"status","aria-live":"polite"},R=C(D({__name:"MathInlineNode",props:{node:{}},setup(f){var b,r;const e=f,k=h(null),i=O(()=>e.node.markup==="$$"),d=O(()=>q(e.node.content)),p=((r=(b=N())==null?void 0:b.vnode.el)==null?void 0:r.nodeType)===1,l=(function(){if(!e.node.content)return{html:"",text:e.node.loading?"":e.node.raw,loading:e.node.loading};if(e.node.loading)return{html:"",text:"",loading:!0};const a=U();if(!a){const n=typeof window>"u"||p;return{html:"",text:n?e.node.raw:"",loading:!n}}try{const n=a.renderToString(d.value,{throwOnError:!1,displayMode:i.value});return L(d.value,i.value,n),{html:n,text:"",loading:!1}}catch{return{html:"",text:e.node.loading?"":e.node.raw,loading:e.node.loading}}})(),t=h(l.html),u=h(l.text);let g=!1,m=0,s=!1,c=null;const v=h(l.loading),_=h(!1);function T(a){a!=null&&a!==m||(_.value=!1)}function B(){return S(this,null,function*(){if(s)return;c&&(c.abort(),c=null);const a=++m;if(!e.node.content)return T(),t.value="",u.value=e.node.loading?"":e.node.raw,v.value=e.node.loading,void(g=!1);const n=new AbortController;c=n,_.value=!0,s||a!==m||n.signal.aborted?T(a):F(d.value,i.value,{timeout:1500,waitTimeout:1500,maxRetries:8,signal:n.signal}).then(o=>{s||a!==m||(t.value=o,u.value="",v.value=!1,g=!0)}).catch(o=>S(null,null,function*(){if(s||a!==m)return;const w=o?.code||o?.name,$=w==="KATEX_DISABLED";if(w==="WORKER_INIT_ERROR"||o?.fallbackToRenderer||(w===J||w==="WORKER_TIMEOUT")&&!e.node.loading){const I=yield Q();if(s||a!==m)return;if(I){try{const E=I.renderToString(d.value,{throwOnError:e.node.loading,displayMode:i.value});t.value=E,u.value="",v.value=!1,g=!0,L(d.value,i.value,E)}catch{}return}}if($||!e.node.loading)return v.value=!1,t.value="",void(u.value=e.node.raw);g||(v.value=!0)})).finally(()=>{s||T(a)})})}return l.html&&(g=!0),A(()=>[e.node.content,e.node.loading,e.node.raw,e.node.markup],()=>{B()}),K(()=>{t.value||B()}),W(()=>{s=!0,c&&(c.abort(),c=null)}),(a,n)=>(y(),x("span",{ref_key:"containerEl",ref:k,class:"math-inline-wrapper","data-markstream-math":"inline","data-markstream-mode":t.value?"katex":u.value?"fallback":"loading","data-markstream-pending":_.value?"true":void 0},[t.value?(y(),x("span",{key:0,class:"math-inline",innerHTML:t.value},null,8,G)):u.value?(y(),x("span",Z,z(u.value),1)):v.value?(y(),H(X,{key:2,name:"table-node-fade"},{default:P(()=>[M("span",ee,[V(a.$slots,"loading",{isLoading:v.value},()=>[n[0]||(n[0]=M("span",{class:"math-inline__spinner animate-spin","aria-hidden":"true"},null,-1)),n[1]||(n[1]=M("span",{class:"sr-only"},"Loading",-1))],!0)])]),_:3})):j("",!0)],8,Y))}}),[["__scopeId","data-v-6c556261"]]);R.install=f=>{f.component(R.__name,R)};export{R as default};

Some files were not shown because too many files have changed in this diff Show more