* fix(chat): revive the turn file-change summary's dead file rows The summary card's file rows rendered as inert plain-text spans in the main conversation, so they had no hover feedback and ignored every click: - An optional boolean prop without a declared default casts ABSENT to false, so "interactive unless explicitly false" silently resolved to false wherever the flag wasn't passed (ChatPane → TurnFilesSummary). Both boundaries now declare the default true explicitly; only the BTW side chat keeps the plain-text rows, by design. With the rows alive again, two latent defects on the never-exercised interactive path surfaced and are fixed here: - The turn-diff panel could not be toggled closed by tapping the same row again: openTurnDiff compares the stored change by identity, but a deep ref reads back a reactive proxy that never matches the raw object. turnDiffChange is now a shallowRef. - AgentDetailPanel's embedded ChatPane never forwarded open-turn-diff, so an Edit row there would have been a dead button; the event now flows through to the shared detail layer. Plus two style corrections on the card: - The row hover underline rode the full-strength text colour; it now uses the faint text token, matching the spec's "lightly". - The foot "N more files" toggle no longer inherits the shared Button's press-scale, which read as the whole strip denting inward on a full-width square-cornered row. Tests: SSR-render assertions pin the interactive defaults and the button-vs-span rows (turn-files-summary.test.ts), and composable tests cover the second-tap toggle of both the turn-diff and file-preview panels (detail-panel-toggle.test.ts) — mirrored desktop/web. * refactor(chat): trim invariant comments, keep web tests pure-logic Review feedback on the turn file-change summary fix: - The shallowRef / prop-default notes carried bug-narrative detail that repo rules keep out of source comments; each is now a one-line invariant hint (root causes live in the earlier commit message). - apps/web tests are pure logic only (apps/web/AGENTS.md), so the web copies no longer render components: turn-files-summary pins just the compiled prop defaults (rendered button-vs-span coverage stays in the desktop renderer tests), and detail-panel-toggle calls the composables directly instead of mounting a host. Same coverage, no renderer. * fix(chat): show a real not-found state for moved or deleted preview files Clicking a file the turn touched after it was renamed or deleted showed the generic unable-to-read message — the daemon precise fs.path_not_found (40409) was swallowed into null by readFileContent, collapsing every failure into one misleading message. readFileContent now rethrows the not-found code (its two loadFileDiff call sites keep their null-on-error behavior via .catch), and openFilePreview maps it to the dedicated not-found state that only the host-read branch used before. * chore(chat): drop the css rationale note, trim the not-found changeset Review feedback: the press-scale override carries its reason in the commit message rather than a source comment, and the changeset stops at the fixed problem per the changeset skill (no behavior supplement). * chore(chat): drop the remaining prop-default rationale notes Review feedback: the one-line boolean-cast note is still regression rationale; the defaults are guarded by the turn-files-summary tests, so source stays bare per the comment-restraint rule. * chore(chat): drop regression narrative from the new tests Review feedback: test names and assertions already carry the regression intent; setup-constraint notes (module mocks) stay, bug root causes live in the commit history. |
||
|---|---|---|
| .agents/skills | ||
| .changeset | ||
| .github | ||
| apps | ||
| docs | ||
| KIMI CODE LOGO | ||
| kimi-code@16c7189bd5 | ||
| packages | ||
| release-notes | ||
| scripts | ||
| .env.example | ||
| .gitignore | ||
| .gitmodules | ||
| .npmrc | ||
| .oxlintrc.json | ||
| AGENTS.md | ||
| LICENSE | ||
| package.json | ||
| pnpm-lock.yaml | ||
| pnpm-workspace.yaml | ||
| publish-desktop-cdn.sh | ||
| README.md | ||
| tsconfig.base.json | ||
| vitest.config.ts | ||
code-app
Kimi Code 客户端仓库:桌面端(apps/desktop)+ Web UI(apps/web)+ 共享包(packages/*)。
核心仓 kimi-code 以 git submodule 引入。
现状与仓库关系
- 本仓库是 Web UI 和桌面端源码的主仓库。这两个应用此前住在 kimi-code 仓库(
apps/kimi-web/apps/kimi-desktop),今后 web/desktop 的开发都在本仓库进行。 - kimi-code 是 CLI / server / agent 的主仓库,以 submodule 钉在本仓库根目录,其
packages/*通过 pnpm workspace 直接以源码链接进来——desktop 的 Electron 主进程会把其中的 server(kap-server、agent-core-v2等)打包为内嵌 server。 - web 产物分发:
pnpm sync:web(scripts/sync-web-to-kimi-code.mjs)把apps/web/dist拷贝到一个 kimi-code checkout 的apps/kimi-code/dist-web,用KIMI_CODE_REPO指定目标 checkout(必传)。 - Windows 窗口 chrome:desktop 用 Window Controls Overlay 保留原生窗口按钮,并由 renderer 绘制品牌与文件/编辑/视图/帮助菜单入口。
- desktop 遥测:仅内嵌 server 模式由主进程给 agent-core-v2 接入 CloudAppender;宿主与 renderer 事件经本地白名单汇入同一管线,遵循配置项
telemetry与KIMI_DISABLE_TELEMETRY,退出时等待最终 flush。system-metrics.ts周期采样主进程/Chromium 子进程内存 CPU 与 renderer JS 堆(system_metrics,口径对齐 CLI v1)。事件契约与分叉范围见apps/desktop/docs/native-todos.md。
下载
桌面端最新安装包(CDN 固定入口,永远指向最新版本):
macOS · Apple Silicon
https://code.kimi.com/kimi-code/desktop/download/KimiCode-mac-arm64.dmg
macOS · Intel
https://code.kimi.com/kimi-code/desktop/download/KimiCode-mac-x64.dmg
Windows
https://code.kimi.com/kimi-code/desktop/download/KimiCode-win-x64.exe
Linux · AppImage
https://code.kimi.com/kimi-code/desktop/download/KimiCode-linux-x86_64.AppImage
Linux · deb
https://code.kimi.com/kimi-code/desktop/download/KimiCode-linux-amd64.deb
历史版本与完整产物见 GitHub Releases。
快速开始
pnpm run sync # 初始化/更新 submodule
pnpm install # 安装依赖,并在 postinstall 下载、校验及转换缺失的共享字体
pnpm prepare:fonts # 可选;手动重新校验/准备共享字体
pnpm dev:desktop # 桌面端(renderer HMR + 默认启动内嵌 server)
pnpm dev:desktop:debug # 桌面端,并开启 Electron remote debugging(端口 9222,供 agent-browser 连接)
pnpm dev:web # Web UI(Vite dev server,/api/v1 代理到 127.0.0.1:58627)
用 agent-browser 自动化桌面端
桌面端支持通过 Chrome DevTools Protocol 被外部工具控制,方便做自动化测试或 UI 操作。
-
安装
agent-browser:npm i -g agent-browser && agent-browser install -
用 debug 模式启动桌面端(默认开启
127.0.0.1:9222):pnpm dev:desktop:debug -
在另一个终端连接并操作:
agent-browser connect 9222 agent-browser snapshot -i # 查看可交互元素 agent-browser click @e2 # 例如点击 New Chat agent-browser screenshot app.png
更多用法见 agent-browser skills get electron。
开发
- 联调 kimi-code 的 server 改动:在你的 kimi-code 工作克隆里
pnpm dev:server,然后KIMI_SERVER_URL=http://127.0.0.1:58627 pnpm dev:desktop(desktop 不再启动内嵌 server)。完整流程见AGENTS.md的"双仓工作流"。 - web 改动同步到 kimi-code:先
pnpm --filter kimi-code-web run build,再KIMI_CODE_REPO=<kimi-code checkout 路径> pnpm sync:web。 - 升级 submodule:在
kimi-code/内 checkout 目标 commit,然后在根目录提交 submodule 指针;新克隆或拉取后跑pnpm run sync对齐。 - 常用检查:
pnpm test、pnpm lint、pnpm typecheck、pnpm build。 - 更新品牌图标:设计源文件在
KIMI CODE LOGO/(设计师交付,整目录替换后跑pnpm build:icons,重新生成apps/desktop/build/图标、web favicon 与组件内联品牌标;几何约定见scripts/build-brand-icons.mjs头注释)。macOS Tahoe 深色/玻璃图标需另在 Icon Composer(Xcode 26)手工制作AppIcon.icon放入apps/desktop/build/,打包时自动编译嵌入;没有该文件则全平台保持.icns静态图标。 - UI 设计系统:改 UI 前必读
apps/desktop/src/renderer/views/DesignSystemView.vue(应用内长按侧栏 logo 打开),样式只用style.css的设计 token(动效除--duration-*/--ease-*外,含设计师导出图标动画的--anim-*例外,见 §02 Motion),并在亮色 + 暗色下做视觉验证。细则见AGENTS.md的"硬约束"。 - 主进程原生界面文案:新增用户可见字符串(托盘、通知、对话框等)要 en/zh 双语——主进程无 i18n runtime,用
apps/desktop/src/main/tray.ts同款字符串表,应用语言经kimi:locale通道同步(OS 语言兜底)。细则见AGENTS.md的"硬约束"。 - 应用菜单(menu.ts):编辑菜单不用
editMenu角色而是手工拼装——原生菜单加速键会先于 renderer 截获按键;「全选」保留 CmdOrCtrl+A 加速键但经kimi:menu-action转发 renderer 的作用域全选(只选中中间 transcript 或注意力所在面板)。改动菜单时保持该契约,其余编辑项镜像 Electron editMenu 展开(tests/main/menu.test.ts钉住)。 - 文本框原生右键菜单(context-menu.ts):Electron 无默认编辑菜单,
context-menu.ts在webContents的context-menu事件里对可编辑字段(transcript 搜索框、composer、内联重命名等)弹原生菜单——macOS 带 Look Up(走showDefinitionForSelection),其余编辑动词走 role +editFlags门控;全部条目显式双语 label(role 默认 label 只随 OS locale),菜单每次右键重建,切语言即时生效。安装点:window.ts的createWindow(installExternalLinkGuard同款);明细见apps/desktop/docs/native-todos.md。 - 内置终端(terminal.ts):desktop 专属,PTY 由主进程
node-pty直接托管(不经内嵌 server),经kimi:terminal-*IPC 与 renderer 的useNativeTerminal.ts+components/terminal/交互;⌃` 或 View 菜单开合底部面板,多 tab,终端状态按 sessionId 分桶(切 session 原样恢复,上限 10 个 session LRU 驱逐);shell 解析 POSIX$SHELL/ Windows pwsh→powershell→cmd;退出 app、renderer 重载/崩溃时全清;xterm 聚焦时原生菜单 accelerator 经kimi:menu-terminal-focus摘除(否则 Windows 下 Ctrl+C 到不了 PTY)。明细见apps/desktop/docs/native-todos.md。 - Windows 标题栏:使用 Window Controls Overlay 保留原生窗口按钮,左侧依次为图标随主题同向切换(浅色白底、深色深底)的完整品牌、常驻侧栏切换、文件/编辑/视图/帮助菜单及按状态出现的更新入口;Windows 托盘固定使用带白色背景的完整品牌图标,Sidebar 不渲染品牌 Header,也不重复这些 chrome 控件。
- 注释克制:密度对齐所在文件,不写复述代码的注释;设计决策与 bug 根因进 spec / commit message,不进代码。细则见
AGENTS.md的"硬约束"。 - 本地打包并签名 macOS 包:
pnpm package:macos(CI 不可用时的替代,arm64;凭证与流程见apps/desktop/README.md的"打包"一节)。
发布
桌面端发版与产物分发(不发 npm):
-
changeset:功能 PR 按
.agents/skills/changeset/SKILL.md生成 changeset(只选kimi-code-app,早期一律 patch);合入 main 后 CI 自动维护ci: release desktop版本 PR。 -
打包:合并版本 PR,CI 自动打四平台签名包(macOS arm64/x64、Windows、Linux,含
latest*.yml自动更新元数据)并创建 GitHub Release(tagv<version>)。完整流程见.changeset/README.md。 -
双语更新说明:按
.agents/skills/release-notes/SKILL.md生成该版本的中英双语 changelog——从apps/desktop/CHANGELOG.md抽取中文案、翻译成英文,review 后存档到release-notes/<version>/changelog.{zh,en}.md并提交;发布脚本会随版本目录一并上传,更新弹窗按系统语言展示(旧版本无此文件,弹窗不显示更新说明)。 -
CDN 分发(本地手动,TOS 凭证限内网):
./publish-desktop-cdn.sh # 拉最新 Release:传产物 + 切自动更新指针 + 刷新下载入口 ./publish-desktop-cdn.sh 0.0.3 # 指定版本(rebuild / 补传 / 回滚切指针) ./publish-desktop-cdn.sh 0.0.3 --artifacts-only # 只传产物,先验证再切流量产物双推两条 CDN 链路——国内
code.kimi.com/kimi-code/desktop/(TOSkimi-code)与海外code.kimi.ai/kimi-code/desktop/(TOSkimi-code-oversea),内容一致:版本目录binaries/<version>/(immutable,含安装包与双语更新说明changelog.{zh,en}.md;过渡期 changelog 会同时往旧布局<version>/传一份副本供未升级客户端拉取,两个版本后停)、自动更新指针latest*.yml(no-cache)、固定下载入口download/(官网链接见上方"下载"一节)。
目录
apps/desktop:Electron 桌面端(kimi-code-app)apps/web:浏览器 Web UI(kimi-code-web)packages/*:web 共享包(web-core / web-i18n / web-markdown / web-ui / vite-preset);字体许可证及本地生成(不入 Git)的两端共用字体位于packages/web-ui/src/assets/fontsscripts/prepare-fonts.mjs:下载并校验共享源字体,再转换为 Vite/Electron 使用的 WOFF2;install/dev/build 会自动调用KIMI CODE LOGO/+scripts/build-brand-icons.mjs:品牌设计源文件(SVG/PNG)及其到全部图标资源(apps/desktop/build/、apps/web/public/favicon.ico、组件内联品牌标)的生成脚本(pnpm build:icons)kimi-code/:核心仓 submodule(CLI / server / agent-core / packages)scripts/sync-web-to-kimi-code.mjs:web 产物同步到 kimi-code 的脚本