Repository navigation
feat: add built-in tool settings and mode availability - #5351
Conversation
🦋 Changeset detectedLatest commit: 28723d5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c9c63a9478
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…tings # Conflicts: # packages/agent-core-v2/src/features/tower/towerFeature.ts
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 05f7d384e5
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2a72796d86
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 67dce73f2a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 82b032ff50
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…tings # Conflicts: # packages/app-components/src/composer/Composer.vue # packages/app-components/test/composerRunningSendMode.test.ts
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1e3ed92923
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4fbbd4fc69
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: effa8a7dc1
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 28723d528e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 28723d528e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 28723d528e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
…aries The 2.8.0 back-sync is metadata-only here for now: docs/notes are in, the version bump and changeset consumption wait for the open 2.8.0 rows. The built-in tool settings port needs its layered breakdown because the raw patch conflicts in 29 files.
…hotAI#5204) Port the remaining client half of upstream e6b16c4 on top of the landed core/KAP/klient work: desktop panel roots and archived-project grouping, app-core panelRoots, app-client activePanelRoots and unseen-project listing, app-components FilesPanel session roots, CLI launch-path resolution for skill dirs, TUI session-directory resume hints, SDK resolveSessionPlacement and WorkspaceTrustInfo.projectRoot, and project-scoped imported sessions. Fork adaptations: - the localized trust prompt keeps the fork's workspace wording and the standalone session-directory hint; upstream's session-aware project trust and its trust-prompt rewrite are not adopted; - upstream vitest test files are adapted to the fork's bun:test suites, and the UI test for MoonshotAI#5351's confirmDiscard stays with that row; - migration-legacy keeps its own session-index entry writer while writing the new project-scoped session layout, and imported sessions keep the localized default title; - the message-flow temp-dir cleanup retries on Windows EBUSY. Verified: apps/kimi-code and node-sdk typecheck clean; node-sdk sdk-rpc-client-v2 100 pass / 11 skip; session-import 13, add-dir 9, run-shell 23, TUI startup 89, message-flow 489 pass / 1 skip, run-v2-print 27; migration-legacy import/resume 9; desktop renderer 50; app-client workspaces-store 90, files-store 60, session-info 13; app-components FilesPanel 7; app-core panelRoots 7. Pre-existing: app-client workspace-state 212 pass / 13 fail and session-list-store 35 pass / 2 fail (Bun lacks vi.resetModules).
Mark MoonshotAI#5394 ported with its cancel-during-start regression; record MoonshotAI#5359 and MoonshotAI#5351 as blocked on the TUI continuation capability and the tool activation model, and keep MoonshotAI#5432 partial until those rows close.
Built-in tool contributions now declare whether users may configure them, and every mode that depends on a tool checks it before entering: Plan needs ExitPlanMode, goals need UpdateGoal, swarm needs AgentSwarm, and Tower needs its complete tool set. KAP serves GET /tools/catalog, persists the tools.enabled/disabled config, and reports plan/swarm/tower/goal availability on the agent state frame. app-core adds the catalog/config client and default-tools helpers; app-components adds the Default Tools settings panel, rows and catalog; desktop wires the settings page, ChatDock goal controls and slash-menu availability. Fork adaptations: only the catalog/config/agent-state KAP changes are kept, with the unrelated upstream route refactors reverted; the tower availability getter tolerates an unbound loop in unit contexts; plan inline snapshots were refreshed for this fork's rendering. Verified: KAP tools 8, config 33, contracts 18, sessions 135; engine plan 31, goal 165, swarm 33, new tower availability 2; app-core 100, app-client composer/slash 122, app-components default tools 19, desktop ChatDock goal 3; root typecheck clean; check:lint, check:no-comments and check:t-coverage green; frozen install unchanged.
Compaction (MoonshotAI#5538): - Send the whole history to the summary request, drop the pre-shrink and the drop-oldest retries, shrink a truncated summary only when the window squeezed its output, and retry empty or thinking-only summaries with the same history. Keep flushReminders, applyCompactionRound and historyFromContextPreservingToolNotes. - Fix two pre-existing 2.7-alignment gaps the suite exposed: recognise the serialized { kind: 'context_overflow' } payload in shouldRecoverFromContextOverflow, and remove the duplicate runWithCredentialRecovery around the requester's own credential recovery so a replayed 401 surfaces instead of being retried. - fullCompaction 124 pass / 0 fail; agent-core-v2 typecheck clean. Built-in tool settings (MoonshotAI#5489): - Keep MoonshotAI#5351's KAP catalog/config/agent-state fields, the four mode guards and the desktop/Web UI as a fork-only capability. - Replace the 22 per-tool userConfigurable flags with the central USER_CONFIGURABLE_BUILTIN_TOOL_NAMES list in kap-server. The catalog still returns the same 39 entries (26 core + 13 Tower), now pinned by tools.test.ts. - Ledger: MoonshotAI#5351 marked fork-only, MoonshotAI#5489 not-applicable with the keep-both approval, both in B2; the PLAYBOOK records the invariant. - kap-server tools 8 pass; agent-core-v2 and kap-server typecheck clean. Loop baseline: - max_steps no longer marks a completed step as interrupted. - Goal creation accepts UpdateGoal when it is loadable through isToolActiveForDisclosure. - Refresh the three loop inline snapshots for the intentional continuation, loadable-tools and step.begin shape. - test/agent/loop 175 pass / 3 fail; the three remaining failures are the pre-existing cancelled-partial preservation, recorded as the first acceptance of the MoonshotAI#5541 requester migration. Ledger refresh adds 87 upstream rows; MoonshotAI#5538 and MoonshotAI#5489 are triaged, 85 remain pending.
Requirement or Bug
桌面端需要在设置中提供内置工具开关,保存后对当前及新会话生效;同时当 Plan、Swarm、Tower、Goal 所需的工具不可用时,应隐藏对应的模式入口。
本 PR 将旧仓库未合入的 MoonshotAI/kimi-code-app#1239 与配套服务端 MoonshotAI/kimi-code#4797 迁移到单仓。此前对应
custom-desktop分支的版本(kimi-code-app#1251与kimi-code#4807)只合入了已废弃的定制分支,从未进入main。截图
Bug Reproduction Steps
N/A
Root Cause
N/A
Code Changes
核心思路
设置页保存开关时直接写入现有的全局
[tools]策略,不引入按会话冻结的工具快照。引擎现有的动态工具策略会对已加载的 Agent 和新会话即时生效;服务端在agent帧中报告当前模式可用性,并在全局[tools]或会话级工具策略变化时主动刷新该帧;桌面端据此隐藏不可用的模式入口。flowchart LR Draft[设置页内置工具草稿] -->|保存| Config[全局 tools 配置] Catalog[GET /api/v1/tools/catalog] --> Draft Config --> Policy[当前及新会话工具策略] SessionPolicy[会话级 disabled_tools] --> Policy Policy --> Guards[服务端模式入口守卫] Policy --> Frames[agent 帧模式可用性] Config -->|onDidSectionChange tools| Frames SessionPolicy -->|onDidChange| Frames Frames --> Availability[当前会话模式可用性] Config --> DraftAvailability[无会话草稿与旧服务端回退] Availability --> Desktop[桌面端模式入口] DraftAvailability --> Desktop关键决策
[tools],对已加载和新 Agent 动态生效[tools]语义一致[tools]或会话级策略变化时主动刷新agent帧*_mode_available字段时回退到全局[tools],HOST_API_LEVEL保持1kimi web时不会误隐藏模式入口toast、吸底保存栏,并在返回、切换 Tab、关闭弹窗时统一拦截未保存修改Teleport底栏,仅在点击返回时确认main上GlobalAgentsMdSetting的模式一致,避免切换 Tab 或关闭设置时静默丢失草稿服务端改动
GET /api/v1/tools/catalog(无需会话即可调用,不恢复会话、不连接 MCP 服务),标记用户可配置的内置工具贡献,并与运行时媒体工具按名称去重。合入 fix(agent-core-v2): initialize loop after profile and mode selection #5141 后,6 个 Tower 模式专用工具(TowerInit、TowerPlan、TowerSpawn、TowerMerge、TowerRebase、TowerTeardown)改为进入 Tower 时动态注册,不再经过AgentToolContribution;因此由USER_CONFIGURABLE_TOWER_MODE_TOOLS导出其目录元数据,仅在isTowerFeatureAssembled为真时并入目录,保证 Tower 开关仍受实验开关门控。toolsConfigSchema在配置 REST schema 中映射全局tools.enabled/tools.disabled。agent帧和会话 profile 响应中新增plan_mode_available、swarm_mode_available、tower_mode_available、goal_mode_available。Plan、Tower、Goal 仅主 Agent 可用;Tower 还要求实验开关开启且特性已装配。SessionAgentFeed订阅ISessionToolPolicy.onDidChange与IConfigService.onDidSectionChange(tools),策略变更时立即推送可用性帧(无变化时自动去重)。ExitPlanMode,Swarm 依赖AgentSwarm,Tower 依赖实验开关、特性装配、主 Agent 及完整的 13 个 Tower 工具,Goal 的创建/恢复依赖UpdateGoal。ExitPlanMode不可用时,defaultPlanMode跳过自动进入。退出已开启的模式、暂停/取消 Goal 均不受影响。pnpm qa:refresh schema刷新packages/kap-server/schema/,并更新HOST_CONTRACT哈希(apiLevel保持1,全部为增量字段)。桌面端与客户端改动
DefaultToolsPanel与DefaultToolsRow),支持分组开关、草稿编辑、显式保存、目录加载失败重试、保存失败提示、成功系统toast及未保存放弃确认。由于 Web 与桌面端共用apps/desktop/src/renderer,Web 设置页同样可以看到这一全局配置入口。ExitPlanMode门控 Plan、AgentSwarm门控 Swarm、UpdateGoal门控 Goal 创建/恢复、实验开关加完整 Tower 工具集门控 Tower。不可用入口会从+菜单、斜杠补全、移动端设置页中隐藏;手动输入被禁用的/plan、/swarm、/goal、/tower进入类命令会提示「已在工具设置中禁用」,不会落入无关参数错误或当作提示词发给模型,同时保留/swarm off、/tower off、/goal pause和/goal cancel等退出/控制命令。*_mode_available字段的旧服务端,均回退使用全局[tools]判断可用性。main近期重构:MCP 路由与 schema 从tools.ts拆出、IAgentProfileService并入IAgentLoopService、Swarm 批处理钩子、extraBuiltins斜杠扩展、submitCommandContext()、refactor(ui): consolidate duplicated UI components, tokens and styles #5314 共享设置样式,以及hostRouting.ts多 Host 路由表(listToolCatalog: 'local')。main上尚不存在的自定义 Subagent 设置(CustomSubagentsPanel)未纳入本 PR。一并修复的旧评审遗留问题
处理了
kimi-code#4807与kimi-code-app#1251当时因先于机器人评审完成合入而未修复的 Codex 意见:true。false。MobileSettingsSheet不再因v-else在UpdateGoal禁用且无进行中目标时渲染 Goal 入口行。disabled_tools变更后会即时刷新agent帧(feat: add configurable tool catalog and mode availability #4797 评审指出)。AgentSwarm时的/swarm off;拆分 Tower 实验开关与工具可用性,保证禁用 Tower 工具后/tower off仍可退出、进入类命令给出禁用提示而不是发给模型;Web Composer 与桌面端统一按工具可用性过滤入口。confirmDiscard()在保存进行中直接返回false,避免「放弃」后在途请求仍写入磁盘;/config未成功加载(config为null)时阻断编辑并显示重试,重试同时拉取目录与全局配置,防止以空策略覆盖磁盘上已有的禁用列表。UpdateGoal不可用时禁用右侧 Goal 面板的「恢复」按钮(暂停/取消保持可用);Tower 降级(部分工具被禁用)时保留/tower status、/tower teardown及激活态下的裸/tower退出,仅拦截进入类命令;SettingsDialog暴露confirmDiscard(),App.vue在快捷键或菜单再次触发「设置」关闭弹窗前统一走未保存确认(同时覆盖全局 AGENTS.md 编辑与内置工具子页);面板有未保存修改时收到外部[tools]更新,通过rebaseDefaultToolsConfig仅将本页改动过的开关重放到最新配置上,避免覆盖其他客户端的并发修改;配置experimental域变化时同样刷新agent帧可用性;存在 SSH 主机时在入口与子页中明确设置仅对本机项目生效;/tower off在实验开关关闭后仍可识别,以便释放旧会话持久化的 Tower 状态与工作区占用。移动端底部抽屉工具编辑入口按产品决定不在本 PR 中加入。阅读指南
packages/kap-server/src/routes/tools.ts与packages/kap-server/src/protocol/rest-config.ts:工具目录接口与[tools]配置映射。packages/kap-server/src/transport/ws/v1/agentState.ts、sessionAgentFeed.ts、sessionEventBroadcaster.ts:可用性字段计算与策略变更帧刷新。packages/agent-core-v2/src/features/{plan,swarm,tower,goal}与workspace/sessionLifecycle/sessionLifecycleService.ts:各模式入口依赖与守卫。packages/app-core/src/lib/defaultTools.ts与packages/app-client/src/client/useKimiWebClient.ts:允许/禁止列表开关语义,以及会话/草稿/旧服务端可用性判定。packages/app-components/src/settings/DefaultToolsPanel.vue、DefaultToolsRow.vue与apps/desktop/src/renderer/components/settings/SettingsDialog.vue:设置界面与未保存拦截。packages/app-components/src/composer/Composer.vue、packages/app-client/src/lib/composerSubmit.ts与apps/desktop/src/renderer/components/mobile/MobileSettingsSheet.vue:入口过滤与禁用命令提示。Behavior Changes and Affected Users
config.toml的全局[tools][tools]GET /api/v1/tools/catalogGET /api/v1/tools不变agent帧字段false;实验关闭时 Tower 为false)[tools]或会话级disabled_tools变更时主动推送可用性帧defaultPlanModeExitPlanMode也可进入;defaultPlanMode总是自动进入ExitPlanMode不可用时手动进入被拒绝,defaultPlanMode跳过自动进入ExitPlanModeAgentSwarm也可进入AgentSwarm不可用时进入被拒绝AgentSwarmUpdateGoal也可创建或恢复UpdateGoal+菜单、斜杠补全、移动端设置页隐藏不可用入口;手输/plan、/swarm、/goal、/tower进入类命令给出禁用提示,保留/swarm off、/tower off、/goal pause/cancel*_mode_available时回退全局[tools],不会误隐藏入口kimi web的桌面端与 Web 用户HOST_API_LEVEL保持1受影响模块与测试覆盖:
kap-server路由、配置 schema 与 WS 推送:packages/kap-server/test/tools.test.ts(含动态注册 Tower 工具目录)、config.test.ts、sessionEventBroadcaster.test.ts(初始可用性、子 Agent 门控、会话策略刷新、全局配置刷新、无变化去重)、apiSurface.test.ts。agent-core-v2各模式守卫:plan.test.ts、planGuard.test.ts、swarm.test.ts、goal.test.ts、goalOps.test.ts、goalInjection.test.ts、towerService.test.ts(含toolsAvailable实验开关与装配检查)、towerTools.test.ts、towerFeature.test.ts、towerDeferredTools.e2e.test.ts、loop.test.ts。app-core(defaultTools.test.ts、configClient.test.ts、mappers.test.ts、slashCommands.test.ts、hostRouting.test.ts)、app-client(agentStateFrames.test.ts、composerSubmit.test.ts、slash-menu.test.ts)、app-components(defaultToolsPanel.test.ts、composerUndoDraft.test.ts)、桌面渲染端(settings-dialog-font-page.test.ts)。验证记录
pnpm lint:通过(0 warnings / 0 errors,包含注释检查、类型感知 oxlint、导入边界、守卫、棘轮、测试替身、隔离清单、说明文件与 e2e 边界检查)。pnpm --filter @moonshot-ai/agent-core-v2 typecheck、pnpm --filter @moonshot-ai/kap-server typecheck、pnpm --filter kimi-code-app run typecheck(主进程与渲染进程,覆盖packages/app-*)全部通过。kap-server定向测试(tools、config、sessionEventBroadcaster、apiSurface):106 条通过。origin/main(29953c86bb,含 fix(agent-core-v2): initialize loop after profile and mode selection #5141、refactor(core): replace loop.drained/loop.idle with loop end info on turn.ended #5337、fix(kap-server): append new content blocks without rescanning the turn #5344、fix(llm): validate deferred tool arguments against the visible tool view #5231 等)后,agent-core-v2定向套件(plan、swarm、goal、tower、loop、modeMutex、planSample、resume、undo)共 727 条全部通过。AgentPlanService若在构造函数注入IAgentToolPolicyService,会改变构造期 DI 实例化与执行器钩子注册时序,导致plan.test.ts批量工具在恢复后的日志顺序不一致;改为在enter()中通过IInstantiationService惰性读取策略后恢复原有顺序。同时为exitPlanMode.e2e.test.ts的严格 DI 容器补注册了IAgentToolPolicyServicestub。towerFeature.test.ts、towerDeferredTools.e2e.test.ts、kap-server的context.test.ts与sessions.test.ts、桌面主进程浏览器提醒/MCP 注册测试):166 条通过。pnpm qa:refresh schema:重新生成openapi.json、asyncapi.json、contract.txt,所有契约差异均为增量(non-breaking),HOST_CONTRACT已在apiLevel: 1下更新。pnpm run check:duplication origin/main:通过(0 新增重复)。提取了rest-config.ts的公共configFields(契约哈希不变),并在defineRoute.ts中用泛型RouteMethod<Req>定义GetRouteHost/PostRouteHost,供tools、context、fileHistory、conversation、sessions、sessionList、sessionRating复用,消除了路由文件中既有的同构接口重复。kap-server上述路由与sessionRating等相关测试共 424 条通过;defaultToolsPanel.test.ts(新增配置缺失阻断、重试保留禁用规则、无tools段配置初始化、保存中拒绝放弃)与settings-dialog-font-page.test.ts共 12 条通过。Checklist
MoonshotAI/kimi-code-app#1239与MoonshotAI/kimi-code#4797).gen-changesetsskill, or this PR needs no changeset.(已添加kimi-code-appminor 与@moonshot-ai/kap-server/@moonshot-ai/agent-core-v2patch;按要求不添加@moonshot-ai/kimi-code条目)gen-docsskill, or this PR needs no doc update.(按要求不在本 PR 中修改用户文档,docs/无改动)