Repository navigation
feat(kap-server): include host product in instance registry and /api/v1/meta - #5045
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 08a6397 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
liruifengv
approved these changes
Nov 18, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requirement or Bug
当 Kimi Code Desktop 与 CLI(
kimi web/kimi rc)在同一台机器上同时运行时,两者都会在~/.kimi-code/server/instances/*.json下注册本地 KAP 实例。此前注册文件仅记录server_id、pid、host、port、started_at、heartbeat_at与内核host_version,本地调用方无法直接区分哪个实例来自桌面端(kimi-code-desktop)、哪个来自命令行(kimi-code-cli)。本 PR 将startServer已接收的opts.hostIdentity.productName落入instances/*.json与GET /api/v1/meta的可选字段product,使本地 Agent 与脚本可直接识别宿主类型(例如优先连接正在运行的桌面端)。Bug Reproduction Steps
N/A
Root Cause
N/A
Code Changes
startServer(opts)入参中原本已携带必填的opts.hostIdentity.productName(桌面端传入"kimi-code-desktop",CLI 传入"kimi-code-cli"),无需改动任何上游客户端即可在kap-server内直接透传到实例注册表与/api/v1/meta。packages/kap-server/src/instanceRegistry.ts、src/start.ts:ServerInstanceInfo与磁盘序列化新增可选字段product(非空字符串时写入与还原),startServer注册实例时传入opts.hostIdentity.productName。packages/kap-server/src/protocol/rest-meta.ts、src/routes/meta.ts、src/routes/registerApiV1Routes.ts:GET /api/v1/meta响应新增可选字段product,透传opts.hostIdentity.productName;HOST_API_LEVEL保持1(纯增量可选响应字段,旧版客户端与新版服务端双向兼容),同步更新apiSurface.snapshot.test.ts的契约摘要。Behavior Changes and Affected Users
~/.kimi-code/server/instances/*.json实例元数据product字段product(如"kimi-code-desktop"、"kimi-code-cli");旧版写入的无product文件仍正常解析instances/*.json的本地 CLI、外部 KAP Agent 与脚本GET /api/v1/meta响应dataproduct字段data.product/api/v1/meta的 Desktop / Web(code-app)及外部 KAP 客户端packages/kap-serverpackages/kap-server/test/instanceRegistry.test.ts(覆盖product磁盘读写、listLive还原及startServer注入)、packages/kap-server/test/meta.test.ts(覆盖/api/v1/meta返回data.product)、packages/kap-server/test/apiSurface.snapshot.test.ts(契约摘要与快照校验通过)。Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.