kimi-code/packages/node-sdk
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
..
examples feat(oauth): switch the managed usage payload to the quota model (#3787) 2026-09-15 13:33:20 +08:00
scripts chore: remove unused kaos package and MCP kaos executor option (#4184) 2026-10-12 18:43:56 +08:00
src feat: let users take over a session lock left by an exited process (#4328) 2026-10-22 14:37:49 +08:00
test feat(agent-core-v2): add cross-process session occupancy lock (#4246) 2026-10-20 17:21:18 +08:00
api-extractor.json chore: remove unused kaos package and MCP kaos executor option (#4184) 2026-10-12 18:43:56 +08:00
CHANGELOG.md chore: sync release/2026-10-21 (2.3.0) back to main (#4306) 2026-10-21 14:50:45 +08:00
package.json chore: sync release/2026-10-21 (2.3.0) back to main (#4306) 2026-10-21 14:50:45 +08:00
README.md Kimi For Coding 2026-05-22 15:54:50 +08:00
tsconfig.api-extractor.json Kimi For Coding 2026-05-22 15:54:50 +08:00
tsconfig.dts.json chore: remove unused kaos package and MCP kaos executor option (#4184) 2026-10-12 18:43:56 +08:00
tsconfig.json refactor: remove the legacy agent-core v1 package (#3542) 2026-09-07 11:17:51 +08:00
tsdown.config.ts chore: remove unused kaos package and MCP kaos executor option (#4184) 2026-10-12 18:43:56 +08:00
vitest.config.ts feat(agent-core-v2): support api_key_env for provider credentials (#3762) 2026-09-17 22:02:53 +08:00

@moonshot-ai/kimi-code-sdk

The TypeScript SDK for Kimi Code

Part of the Kimi Code monorepo.

See the main repository for documentation, issues, and contribution guidelines.

License

MIT