Skip to content

feat(orca): 新增 kimi-code worker agent 类型(类型层与创建链路贯通) - #2976

Open
owlwang wants to merge 9 commits into
makecindy:mainfrom
owlwang:feat/kimi-code-worker-agent
Open

feat(orca): 新增 kimi-code worker agent 类型(类型层与创建链路贯通)#2976
owlwang wants to merge 9 commits into
makecindy:mainfrom
owlwang:feat/kimi-code-worker-agent

Conversation

@owlwang

@owlwang owlwang commented Aug 18, 2026

Copy link
Copy Markdown

这次改了什么

摘要

让 Orca 协同可以把 Kimi Code CLI(月之暗面官方终端 AI Agent,@moonshot-ai/kimi-code)作为一种新的 worker agent 类型 kimi-code,与现有 codex / claude-code / pi 并列。

本 PR 是分阶段落地的 Phase 1:类型层、MCP 工具枚举、worker 创建 preflight、renderer 选项全链路贯通;运行时桥接(经 kimi web 本地服务 REST + WebSocket 驱动会话)留待 Phase 2,完整方案见 docs/kimi-code-worker-agent-plan.md

Phase 1 合入后的行为:创建面板/工具已能选择 Kimi Code,但因此时还没有声明支持 kimi-code 的模型来源,preflight 会给出明确的「Kimi Code 当前没有可用的模型供应商」错误——不会静默落到错误路由。

变更类型

  • feat 新功能

范围

  • 关联 Issue / 需求:Feature request: support Kimi Code CLI as a new Orca worker agent type (like codex / claude-code / pi) #2953
  • 本 PR 包含:
    • 类型层model-providers / maker-core / maker-scheduler / maker-shared / lizi-mcps 及 desktop / mobile / shared 各 AgentKind 联合类型扩展 'kimi-code'(renderer 短名体系对应 'kimi');Model Access wire 解析白名单(MODEL_ACCESS_AGENTS)同步放开,客户端可解析服务端下发的 kimi-code 模型标记。
    • MCP 工具create_worker / create_workers / list_available_models 的 agent 枚举与文案;send_to_worker 返回类型。
    • worker 创建服务selectWorkerModel 默认模型 kimi-for-coding、显示名 Kimi CodebuildNoProviderMessage 候选列表;Fast 模式保持不接线(Kimi 侧无对应概念,agentConsumesExplicitFast 不含 kimi-code)。
    • rendererAgentSelect / VendorSegmentedSwitcher 选项(新增 KimiMark 图标)、VendorIcon 映射、CreateWorkerPopover 偏好存储(workerCreationPrefs)、IM 渠道默认设置、scheduler 表单等各 Record<AgentKind, …> 键补齐;agentKindConversion 中央映射模块双向覆盖 kimi(含 normalizeDbAgentKind 防吞值)。
    • DB schema(drizzle text({enum}))同步扩展。经核实该 enum 仅为 TS 类型层约束:不生成 SQL CHECK 约束、snapshot 亦不记录 enum 值(已对照 schema-v39 fixture 与 0092_snapshot.json 验证),故无需 migration
    • 保持三值不动的边界:自定义供应商对话框(DialogAgentKind / RuntimeFillAgent)、agent 二进制安装器(AgentBinaryKind)、SSH 远端安装(RemoteAgentKind)——其 runtime 配置与 CDN manifest 均不含 kimi-code;Kimi 的凭据与安装由 Kimi CLI 侧持有(~/.kimi-code/,OAuth 由 CLI 内 /login 完成)。
  • 明确不包含:
    • @cindy/maker-kimi-manager 运行时桥接包(Phase 2:spawn kimi web 本地服务 + 会话驱动 + 事件归一 + 权限卡桥接)
    • SSH 远端 kimi-code worker、usage 统计接入、scheduler 实际派发(Phase 3)
  • 用户可见变化:新建 Worker 面板与引擎选择器出现「Kimi Code」选项(选择后按上述 preflight 行为给出明确错误提示)。
  • 是否存在 breaking change:无(存量数据与行为不变;新增枚举值仅在被显式选择时生效)。

UI 变化

  • 新增 KimiMarkapps/desktop/src/renderer/components/icons/KimiMark.tsx):细描边 K 字形 + currentColor 单色,与 ClaudeMark / CodexMark / PiMark 同构——不引入新颜色 token、不占用 DESIGN.md 任何彩色豁免条目,随主题/状态染色;VendorIcon 的 kimi 分支复用同一组件。
  • AgentSelect / VendorSegmentedSwitcher 的选项由 SELECTABLE_VENDORS 派生自动多出 Kimi Code,无布局变更。
  • 引用的设计规范:DESIGN.md 色彩体系(identity mark 保持单色 currentColor,与既有 vendor mark 组件约定一致)。

怎么验证的

自动验证

在 macOS(Node 24.3.0 / pnpm 10.9.0)实际执行:

  • pnpm install --frozen-lockfile:成功
  • apps/desktop pnpm typecheck0 error
  • apps/mobile pnpm typecheck0 errorpnpm test303 files / 3556 tests 全绿
  • packages/{maker-shared,model-providers,lizi-mcps,orca-workflow,maker-scheduler,maker-remote-ssh,maker-pi-manager,maker-cc-manager} pnpm build(tsc --noEmit):错误数与 main 基线逐一持平(maker-shared 6 / model-providers 2 / maker-core 16 为预存在,其余 0)
  • packages/* pnpm test:maker-shared 910 / model-providers 546 / lizi-mcps 496 / orca-workflow 34 / maker-scheduler 208 全部通过
  • apps/desktop pnpm test(27359 tests):失败测试名单与 main 基线逐名一致(42 个预存在失败,已用 git stash 双向对照),本 PR 0 新增失败;过程中修复了 5 个受影响的既有测试桩(IM 默认设置合并预期、capabilities 缓存的 agent 计数与 resolver 索引——均为四值化后的对称性更新)
  • npx eslint <116 个改动文件>:与基线一致(11 个预存在问题),0 新增

手工验证

未执行真机运行(本地未装 Kimi Code CLI / 无 Kimi 会员环境)。选择 kimi-code 创建 worker 的端到端行为将在 Phase 2 manager 落地后一并验证;本期由类型与 preflight 单测(orcaWorkerCreationService.test.ts 95 tests 全绿)覆盖。

风险与回滚

  • 风险点:类型层扩散面大(157 文件),但改动均为联合类型扩展 / Record 键补齐 / 中央映射补分支;无存量数据迁移、无协议破坏。git diff 已 review,无凭证、无生成文件、无 submodule 指针变化。
  • 回滚:revert 本 PR 单个 commit 即可。

关联 issue makecindy#2953。Kimi Code CLI(月之暗面官方终端 AI Agent)用户希望
在 Orca 协同中以与 codex / claude-code / pi 并列的方式创建 worker。

本 PR 为分阶段落地的 Phase 1(详见 docs/kimi-code-worker-agent-plan.md):

- 类型层:model-providers / maker-core / maker-scheduler / maker-shared /
  lizi-mcps 及 desktop/mobile/shared 各 AgentKind 联合类型扩展 'kimi-code'
  (renderer 短名体系对应 'kimi'),Model Access wire 解析白名单同步放开。
- MCP 工具:create_worker / create_workers / list_available_models 的 agent
  枚举与文案;send_to_worker 返回类型。
- worker 创建服务:selectWorkerModel 默认模型 kimi-for-coding、显示名
  Kimi Code、buildNoProviderMessage 候选列表;Fast 模式保持不接线
  (Kimi 侧无对应概念)。
- renderer:AgentSelect / VendorSegmentedSwitcher 选项(新增 KimiMark)、
  VendorIcon 映射、CreateWorkerPopover 偏好存储、IM 默认设置、scheduler
  表单等 Record 键补齐;agentKindConversion 中央映射双向覆盖 kimi。
- DB schema(drizzle text enum)同步扩展;经核实该 enum 仅 TS 类型层约束,
  不生成 SQL CHECK,snapshot 亦不记录,无需 migration。
- 自定义供应商对话框 / agent 二进制安装器维持三值(其 runtime 与 CDN
  manifest 均不含 kimi-code,凭据与安装由 Kimi CLI 侧持有)。

明确不包含(后续阶段):kimi web 服务桥接的 manager 运行时(Phase 2)、
SSH 远端 worker、usage 统计接入(Phase 3)。当前选择 kimi-code 创建 worker
会在 preflight 得到明确的「无可用供应商」错误,不会静默落到错误路由。

验证(实际执行):
- pnpm install --frozen-lockfile 成功
- apps/desktop pnpm typecheck: 0 error
- apps/mobile pnpm typecheck: 0 error;pnpm test: 303 files / 3556 tests 全绿
- packages/{maker-shared,model-providers,lizi-mcps,orca-workflow,maker-scheduler}
  build 与基线持平(预存在错误 6/2/16/0/0),test 全绿
  (910/546/496/34/208 passed)
- apps/desktop pnpm test: 失败集与 main 基线逐名一致(42 个预存在失败),
  本 PR 0 新增失败
- eslint 改动文件: 与基线一致(11 个预存在问题),0 新增

Signed-off-by: owlwang <owlwang@outlook.com>
@greptile-apps

greptile-apps Bot commented Aug 18, 2026

Copy link
Copy Markdown

Greptile Summary

本 PR 为 Orca Phase 1 补充 kimi-code Worker 类型,并贯通类型、模型 preflight、MCP、持久化及桌面/移动端展示链路。

  • 新增 Kimi Code 的 Agent 类型、模型标记和双向 vendor 转换
  • Worker 创建保留显式 Kimi 选择,并在无供应商时进入明确 preflight
  • 补齐 IM 默认设置、Worker 偏好、数据库类型和共享协议中的 Kimi 分支

Confidence Score: 4/5

当前仍不宜合并,因为普通新会话草稿可在隐藏 Kimi 的异步修正生效前提交到未注册 runtime。

NewMakerDraftRoute 仅通过 React effect 替换不可用的当前 vendor,而发送处理没有同步校验运行时可用性,因此已有 Kimi 草稿仍存在可触达的提交窗口;其余既有 Kimi Worker、Hook 和设置持久化问题已被当前代码修复。

Files Needing Attention: apps/desktop/src/renderer/features/cc-agent/NewMakerDraftRoute.tsx

Important Files Changed

Filename Overview
apps/desktop/src/renderer/features/cc-agent/NewMakerDraftRoute.tsx 已修复 Kimi Worker 跨 Agent fallback,但普通草稿对隐藏 Kimi 的提交阻断仍依赖异步 effect。
apps/desktop/src/main/hook-control/defaults.ts Hook 的显式和默认 Kimi 值均在 session 创建前回退到已注册 Agent,避免触达未注册 runtime。
apps/desktop/src/main/im/defaultSettingsStore.ts Kimi 设置已加入稀疏 override、自定义键检测、归一化和克隆路径。
apps/desktop/src/renderer/features/cc-agent/CreateWorkerPopover.tsx Kimi segment 已正确映射为 kimi-code,并使用独立 capabilities 与偏好槽位。
apps/desktop/src/main/maker-ipc/orcaWorkerCreationService.ts Worker 创建链路为 Kimi 提供默认模型和无供应商 preflight,符合 Phase 1 的失败闭合设计。

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  UI["Worker 创建 UI<br/>vendor: kimi"] --> Convert["中央映射<br/>kimi → kimi-code"]
  MCP["MCP create_worker"] --> Service["Orca Worker Creation Service"]
  Convert --> Service
  Service --> Preflight{"存在支持<br/>kimi-code 的 Provider?"}
  Preflight -->|Phase 1: 否| Error["NO_PROVIDER_FOR_AGENT<br/>明确错误"]
  Preflight -->|Phase 2: 是| Runtime["Kimi Code Runtime"]
Loading

Reviews (9): Last reviewed commit: "merge main + fix(orca): 七轮 review 与上游统一模..." | Re-trigger Greptile

Comment thread apps/desktop/src/renderer/lib/agentVendors.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 23a696215c

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/renderer/features/cc-agent/CreateWorkerPopover.tsx
Comment thread packages/lizi-mcps/src/xdt-helper/list_available_models.ts
Comment thread apps/desktop/src/shared/imDefaultSettings.ts
@MagicLizi MagicLizi added awaiting-discussion 等待维护者讨论(review-pr) touches:core 改动碰到架构核心路径(review-pr 自动维护,仅展示) touches:product-ui 改动碰到产品 / UI 面(review-pr 自动维护,仅展示) touches:redline 改动碰到红线路径(updater / DB schema 等,review-pr 自动维护,仅展示) labels Aug 18, 2026
按 Greptile P1 与 Codex P2 review 修复,另自查补齐同类漏网映射:

- NewMakerDraftRoute.hiddenSwitcherVendors: 过滤清单补 'kimi' —— 未注册时
  普通新会话的 AgentSelect 不再提前开放 Kimi 入口(Greptile P1),与 pi 的
  「按 maker:list-available-agents 过滤」口径一致。
- CreateWorkerPopover onChange: 'kimi' → 'kimi-code' 显式映射,修复点击
  Kimi 分段静默落到 claude-code(Codex P2)。
- list_available_models handler 与 host register 侧 key 映射: 补齐
  kimi_code 字段透传,修复 Kimi 模型列表被静默丢弃(Codex P2)。
- ScheduleChips AgentTabs onChange: 'kimi' → 'kimi-code',修复 scheduler
  选择 Kimi 静默存成 codex(Codex P2)。
- im/sessionRepo: toCoreAgentKind/toDbAgentKind 改走中央映射
  dbToMakerAgentKind/makerToDbAgentKind,修复 IM 渠道 Kimi 会话落盘后
  身份回退成 Claude Code(Codex P2)。
- 自查补齐: ModelSelector.enqueueAgentSwitch 浏览态切换、ChatInput
  lastByVendor 槽位读取、CCAgentSessionView 鉴权门禁与默认模型回退、
  NewMakerDraftRoute collab.worker 双向映射、usageHistory/skillhub
  usageStore 的 usage 聚合归一,均补 kimi 分支防止静默错配。

Ghost errand 的 agent 选择维持三值(配置与 UI 均不开放 kimi-code,
Phase 2 后再评估)。

验证:
- apps/desktop pnpm typecheck: 0 error
- packages/lizi-mcps test: 496 passed
- desktop 定向: cc-agent features 214 / main-im 608 / new-chat 88 全绿

Signed-off-by: owlwang <owlwang@outlook.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 810547b123

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/renderer/features/cc-agent/CreateWorkerPopover.tsx
Comment thread apps/desktop/src/renderer/lib/modelDefinitions.ts Outdated
Comment thread apps/desktop/src/main/session-share/xdtshareFormat.pure.ts
Comment thread apps/desktop/src/main/hook-control/defaults.ts Outdated
Comment thread apps/desktop/src/main/im/defaultSettingsStore.ts
按 Codex 二轮 review(6 条 P1)修复:

- CreateWorkerPopover: 接入 kimi-code 专属 capabilities 通道(不再复用
  Claude caps),无可用模型提示的 agent 名补齐 'Kimi Code' —— 选择 Kimi 后
  展示等价的「缺少可用模型来源」内联错误,不再静默显示为 Claude Code。
- modelDefinitions.agentKindForVendor 函数体补 kimi 分支:Kimi vendor
  不再错读 Claude 模型清单。
- ScheduleChips AgentTabs: hiddenVendors 隐藏 kimi —— scheduler 派发
  属 Phase 3,本期不允许配置出运行时不存在的任务。
- xdtshareFormat AGENT_KINDS 运行时校验集合同步 'kimi':Kimi 会话 /
  Orca 包导出后可被同版本重新导入。
- hook-control/defaults AGENT_KINDS 白名单同步 'kimi-code':Hook 工作区
  显式保存的 Kimi override 不再被静默回退全局默认。
- im/defaultSettingsStore settingsOverrides 与 settingsCustomizedKeys
  持久化循环遍历补齐 'kimi-code':IM 渠道 Kimi 独立设置可正确落盘,
  重启不丢。

验证:
- apps/desktop pnpm typecheck: 0 error
- 定向测试 122 文件 / 1687 tests 全绿(session-share / hook-control / im /
  modelDefinitions / scheduler / cc-agent)

Signed-off-by: owlwang <owlwang@outlook.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6814c03d3a

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

方案文档开放问题补一条已裁决记录:对齐 Cindy 既有架构传统——
Claude Code 用官方 SDK、Codex 用官方 app-server(其自身支持 ACP 但
Cindy 未采用)、Pi 用 --mode rpc,均为官方程序化/服务化接口;Cindy 的
能力面(fast/effort/permission/usage/fork/SSH 桥接)超出 ACP 标准面。
ACP 保留为未来统一客户端的替换方向,桥接层可整体更换。

Signed-off-by: owlwang <owlwang@outlook.com>
Comment thread apps/desktop/src/renderer/features/cc-agent/NewMakerDraftRoute.tsx

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 23904f034e

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/main/session-share/sessionShareExport.ts
Comment thread apps/desktop/src/renderer/components/new-chat/ModelSelector.tsx
Comment thread apps/mobile/src/session/types.ts
Codex 三轮 review 指出 IM 默认设置与 Hook 偏好编辑器仍能选中
kimi-code(运行时尚未注册,选择即失败/崩溃)。按「Phase 2 注册前不在
选择即生效的入口暴露」的统一原则处理,并系统性排查全部 9 处
AgentSelect / VendorSegmentedSwitcher 消费点:

- ImDefaultSettingsSection: AgentSelect hiddenVendors 隐藏 kimi
  (review 命中:选了会让该渠道新建会话走未注册 agent 而失败)
- HookWorkspacePrefsEditor: 同隐藏(review 命中:capsByAgent 无 kimi 槽,
  capsOf 返回 undefined 致设置卡崩溃,toAgentKind 抛错)
- ModelSelector 会话引擎切换分段: 同隐藏(自查补充;切换未注册引擎
  必然失败)
- GhostErrandPrefs errand agent 分段: 同隐藏(自查补充;errand 配置为
  三值体系,误选 kimi 会被归一静默吞成 cc)

已覆盖无需处理:NewMakerDraftRoute 两处 AgentSelect 已按注册过滤
(一轮修复);ScheduleChips/ScheduleFormDialog 已隐藏(二轮修复);
CreateWorkerPopover 保留可见——worker 路径有内联等价错误提示 +
MCP create_worker 直达 main preflight 的 NO_PROVIDER_FOR_AGENT,
该行为已经与二轮 review 对齐确认。

所有 hiddenVendors={['kimi']} 均带注释:Phase 2 注册 kimi-code
manager 后移除。

验证:
- apps/desktop pnpm typecheck: 0 error
- 定向测试 82 文件 / 688 tests 全绿(settings / new-chat /
  cindy-brain / scheduler)

Signed-off-by: owlwang <owlwang@outlook.com>
Comment thread apps/desktop/src/renderer/features/cc-agent/NewMakerDraftRoute.tsx

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6feb016a54

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/main/session-share/sessionShareImport.ts
Comment thread apps/desktop/src/renderer/features/cc-agent/lib/orcaAgentDisplay.ts
Comment thread apps/mobile/src/session/composerPalette.ts
按 Greptile P1 与 Codex P2 四轮 review 修复:

- NewMakerDraftRoute.draftEnableOrcaOptions: 显式选择的 kimi-code 不再
  参与跨 agent 供应商收窄 fallback(Greptile P1)——Phase 1 无任何供应商
  声明支持 kimi-code 是预期状态,静默换成其他 agent 会把任务与项目上下文
  发给用户未选择的引擎并绕过 Kimi 的 NO_PROVIDER_FOR_AGENT preflight;
  现原样透传,与 MCP create_worker 路径同口径。
- sessionShareExport: worker 与 lead 两处导出白名单同步 'kimi',含 Kimi
  worker 的 Orca 包与 Kimi 会话可正常导出(Codex P2;与上轮导入侧
  xdtshareFormat 校验扩展形成双向闭环)。
- ModelSelector / ChatInput 的 vendorKeyToAgentKind 函数体补 'kimi' →
  'kimi-code' 分支(签名此前已扩、函数体遗漏):导入的 Kimi 会话打开时
  模型与权限控件按正确 agent 渲染(Codex P2)。
- mobile inputProjection: 排队消息 createOpts 的 agentKind 补
  'kimi' → 'kimi-code' 映射——Desktop 重启后 lazy-create 恢复 Kimi
  会话不再被错误路由到 Claude(Codex P2)。

验证:
- apps/desktop pnpm typecheck: 0 error;相关 37 文件 / 411 tests 全绿
- apps/mobile pnpm typecheck: 0 error;276 文件 / 3205 tests 全绿

Signed-off-by: owlwang <owlwang@outlook.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9ac1f11e66

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/lizi-mcps/src/xdt-helper/create_worker.ts
… + 系统性自查)

Codex 五轮 review(2 条 P1):
- orcaWorkerCreationService.createWorkerInTeam: 无 provider 快速失败前移到
  capabilities 读取之前——未注册 agent(如当前的 kimi-code)在
  getAvailableModels 里会撞 requireAgent 抛 INTERNAL,永远到不了
  NO_PROVIDER_FOR_AGENT;调整顺序后 MCP create_worker(agent='kimi-code')
  按承诺返回可操作的 preflight 错误。
- PermissionSelector.vendorKeyToAgentKind 函数体补 kimi 分支(第三个
  同名函数;此前只修了 ModelSelector 与 ChatInput 的两处)。

按用户要求做全仓系统性自查(不再依赖 bot 逐轮发现),补齐所有残余的
映射函数体 / 归一逻辑 / capabilities 槽位:
- orcaAgentDisplay: normalizeOrcaDisplayAgentKind / orcaAgentLabel /
  orcaVendorForAgentKind 三函数体(类型已扩、函数体全漏)
- HookWorkspacePrefsEditor: capsByAgent 补 kimi-code 槽(此前 cast 掩盖,
  capsOf('kimi-code') 返回 undefined 会致设置卡崩溃);toAgentKind 补
  'kimi' 分支(存量 kimi 工作区配置渲染不再 throw)
- workerProjectionStore / RunHistoryPane / useScheduleForm /
  useVendorAuthGate / useVendorReadiness / newMakerDraft(草稿恢复) /
  help.ts(最近会话归一) / makerChatStore.dbAgentKindToMakerKind /
  lizi-mcps providers.ts ×3: 全部补 kimi 分支,杜绝静默错配

甄别后确认无需改动(值域或语义本就不含 kimi,保持原样):
AgentBinaryKind/RemoteAgentKind 体系、自定义供应商 VALID_AGENTS、
provider-route/vision-channel 的 routing 回退表、oneShot 能力面、
authHandlers 登录白名单、UpgradeBanner 二值 prop(有前置守卫)。

验证:
- apps/desktop pnpm typecheck: 0 error;pnpm test 27359 tests,
  失败名单与 main 基线逐名一致(42 个预存在),0 新增
- packages/lizi-mcps: build 0 error,496 tests 全绿
- apps/mobile pnpm typecheck: 0 error

Signed-off-by: owlwang <owlwang@outlook.com>
@MagicLizi

Copy link
Copy Markdown
Contributor

⏸️ 维护者确认门已挂起

此 PR 触发 product(新增 agent 类型,影响 UI)与 arch(核心路径 304 行)两类维护者确认门。已创建讨论 issue 供维护者评估。

确认方式:直接在本 PR 上 Approve(通过)或 Request Changes(要改)。

讨论 issue:#2978

Comment thread apps/desktop/src/main/hook-control/defaults.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7a41add166

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/renderer/components/new-chat/ModelSelector.tsx
Comment thread apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx
Comment thread apps/mobile/src/session/newSession.ts
@MagicLizi

Copy link
Copy Markdown
Contributor

💡 建议补充界面效果证据

命中 UI 路径(apps/desktop/src/renderer/cindy-brain/GhostErrandPrefs.tsx / apps/desktop/src/renderer/components/chat/ErrorBanner.tsx / apps/desktop/src/renderer/components/chat/InterruptedTurnBanner.tsx 等)但 description 未附界面效果证据——建议补充改动后效果:截图/录屏,或改动后界面的 HTML 页面(```html 代码块、.html 附件或在线预览链接),便于确认界面符合 DESIGN.md 设计规范。

- hook-control/defaults: 白名单回退三值(Greptile P1)——UI 入口已隐藏,
  接受未注册 agent 的 hook override 会撞 requireAgent 抛错、中断无人值守
  任务;存量/外部下发的 kimi-code 值静默回退全局默认(安全降级)。
  renderer 侧 KnownAgent 保留 kimi-code(仅用于渲染存量配置),两侧职责
  分离并在注释写明。
- ModelSelector/ChatInput: kimi-code capabilities 状态贯穿
  resolveRemoteModelListStatus(Codex P1)——此前 Kimi 会话误用 Pi 的
  加载/错误态;合并展示(未指定 agent)刻意不计入 kimi,避免未注册 error
  拖垮三边清单。selectVisibleModels 增 deviceKimiModels 参数与 kimi-code
  分支,Kimi 会话模型清单不再错落 Claude 合并集。
- useVendorAuthGate: 新增独立 kimi readiness(Codex P1)——Kimi 会话的
  发送门禁按 Kimi 自身供应商/安装状态判定与引导,不再错用 Claude 的
  二进制与 provider 状态。
- mobile newSession.pickMostRecentSessionRuntime: 补 'kimi' →
  'kimi-code' 归一(Codex P1)——新建草稿继承最近 Kimi 会话时不再把
  Claude agent 与 Kimi 的 model/provider 混写进草稿。

验证:
- apps/desktop pnpm typecheck: 0 error;pnpm test 27359 tests
  与基线逐名一致,0 新增失败
- 定向 867(desktop)+ 127(mobile)tests 全绿

Signed-off-by: owlwang <owlwang@outlook.com>
Comment thread apps/desktop/src/main/hook-control/defaults.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5ecb144b91

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/main/localDb/orcaTeamStore.ts
Comment thread packages/maker-shared/src/deviceLinkContract.ts
Comment thread packages/lizi-mcps/src/xdt-helper/_history_types.ts
@MagicLizi

Copy link
Copy Markdown
Contributor

@owlwang 👋 这个 PR 目前与 main 有合并冲突,auto-review 因此暂时跳过、没法继续审查 / 合并。

请在本地 merge 最新的 origin/main 解决冲突后推送;冲突解除后,下一轮 auto-review 会自动重新处理这个 PR。

@MagicLizi

Copy link
Copy Markdown
Contributor

@owlwang 👋 这个 PR 还有 27 条 review conversation 没 resolve(apps/desktop/src/renderer/features/cc-agent/CreateWorkerPopover.tsx / packages/lizi-mcps/src/xdt-helper/list_available_models.ts / apps/desktop/src/renderer/features/scheduler/components/ScheduleChips.tsx / apps/desktop/src/shared/imDefaultSettings.ts / apps/desktop/src/renderer/lib/modelDefinitions.ts 等),auto-review 因此暂时跳过、没法继续审查 / 合并。

如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。

merge origin/main(统一模型面板 unified panel 上游落地)冲突解决:
- modelPlanePolicy: 适配上游 pi 早退重构,kimi-code 提前 return false
- preload/vite-env: listAgentCommands 上游新增 params 参数与我方
  kimi-code 扩展合并保留
- NewMakerDraftRoute: persistedAgentKind/authVendor 去重(上游已迁至
  新位置),扩展为四值
- providerModels: 上游 pi chatgpt/[1m] 过滤与我方 kimi 通道合并
- 上游统一面板跟进: engine 类型四值化(ChatInput/ModelSelector 回调)、
  agentKindOfEngine 补 kimi、ENGINE_BADGE_TINT 加 kimi 键并注册
  --engine-badge-kimi 占位色(待设计裁决)、piPackages 两函数参数扩展、
  rewritePiSkillMessageForSend 调用映射

第七轮 review(4 条):
- hook-control/defaults: IM 全局默认已是 kimi-code 时(无显式 override)
  同样过准入白名单,未注册值回退系统默认,不再撞 requireAgent
  (Greptile P1)
- orcaTeamStore.fromDbAgentKind: 补 kimi 分支,Orca store 投影不再把
  Kimi worker 身份回退成 claude-code(Codex P2)
- makerChatStore.normalizeAgentSwitchIntent 与 mobile
  normalizeSessionAgentSwitchIntent: 白名单补 kimi-code,控制端不再
  丢失被控端的 Kimi 切换意图(Codex P2)
- search_chat_history/get_chat_history: agent_kind Zod enum 补 'kimi'
  (Codex P2)

验证:
- apps/desktop pnpm typecheck: 0 error(merge 后 25 个引入错误全部修复)
- pnpm test 28221 tests: 与 main 基线逐名一致(42 预存在失败),0 新增

Signed-off-by: owlwang <owlwang@outlook.com>
@owlwang

owlwang commented Aug 19, 2026

Copy link
Copy Markdown
Author

维护者确认事项处理进展

✅ 合并冲突已解决

已 merge 最新 main(统一模型面板上游落地),5 个冲突文件全部解决并适配(含上游 pi 早退重构、pi chatgpt/[1m] 过滤、listAgentCommands 新参数与我方 kimi-code 扩展的合并),commit 363c3bcc。merge 引入的 25 个类型错误全部修复,desktop typecheck 回 0。

✅ 27 条 review conversation 已全部 resolve

七轮 bot review 的 23 个命中问题全部修复并逐条回复(另有约 20 处自查补充),所有 thread 已标记 resolved。

✅ UI 证据

见附件思路说明:本 PR 的 UI 变化为「新增 KimiMark 引擎身份图标 + Worker 创建面板的 Kimi Code 选项 + 统一面板 --engine-badge-kimi 徽标占位色」。

  • KimiMark:细描边 K 字形 + currentColor,与 ClaudeMark / CodexMark / PiMark 同构,不占用彩色豁免、随主题染色(DESIGN.md 色彩体系)。
  • 引擎选项:由 SELECTABLE_VENDORS 派生自动多出 Kimi Code,无布局变更;未注册 runtime 前仅 Worker 创建面板可见(普通会话 / Scheduler / IM / Hook / Ghost errand 入口均隐藏)。
  • --engine-badge-kimi:占位青蓝 #38bdf8(与 cc 橙 / codex 蓝 / pi 紫可区分),上游无官方品牌色规范,待设计裁决——已在 colors.ts 注释标明。

效果预览 HTML(自包含单文件,浏览器直接打开即可查看三个区域的渲染效果):见下一条评论附件。

关于确认门

已知悉 product + arch 确认门挂在 #2978。本 PR 为分阶段落地的 Phase 1(类型层与创建链路贯通,运行时不激活),完整方案与桥接选型裁决记录见 docs/kimi-code-worker-agent-plan.md,欢迎维护者在讨论 issue 中就开放问题(实验性 API 稳定性、审批桥接粒度、多实例复用)给方向。

@owlwang

owlwang commented Aug 19, 2026

Copy link
Copy Markdown
Author

UI 效果预览(自包含 HTML,复制保存为 .html 文件用浏览器打开即可):

kimi-code-ui-evidence.html(点击展开源码)
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>PR #2976 UI 证据 — Kimi Code 引擎接入预览</title>
<style>
  :root {
    --bg: #fafafa; --card: #ffffff; --border: #e4e4e7; --text: #18181b; --text-2: #52525b; --text-3: #a1a1aa;
    --engine-badge-cc: #d97757; --engine-badge-codex: #7a9dff; --engine-badge-pi: #a78bfa; --engine-badge-kimi: #38bdf8;
  }
  * { margin: 0; padding: 0; box-sizing: border-box; }
  body { background: var(--bg); color: var(--text); font: 14px/1.6 -apple-system, "PingFang SC", "Segoe UI", sans-serif; padding: 32px 20px; }
  .wrap { max-width: 760px; margin: 0 auto; }
  h1 { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
  .sub { color: var(--text-2); font-size: 13px; margin-bottom: 24px; }
  .card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
  .card h2 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text-3); margin-bottom: 14px; }
  .marks { display: flex; gap: 24px; align-items: center; }
  .mark-item { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text-2); font-size: 12px; }
  .mark-item svg { display: block; }
  /* AgentSelect 模拟 */
  .select-trigger { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; background: var(--card); font-size: 13px; margin-bottom: 8px; }
  .select-panel { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; width: 240px; box-shadow: 0 8px 24px rgba(0,0,0,.08); }
  .select-option { display: flex; align-items: center; gap: 10px; padding: 9px 14px; font-size: 13px; }
  .select-option + .select-option { border-top: 1px solid var(--border); }
  .select-option.active { background: #f4f4f5; font-weight: 500; }
  .badge-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
  .engine-rows { display: flex; flex-direction: column; gap: 10px; }
  .engine-row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); }
  code { background: #f4f4f5; border-radius: 4px; padding: 1px 6px; font-size: 12px; }
  .note { font-size: 12px; color: var(--text-3); margin-top: 8px; }
</style>
</head>
<body>
<div class="wrap">
  <h1>PR #2976 · Kimi Code 引擎接入 — UI 证据</h1>
  <p class="sub">展示新增的 KimiMark 身份图标、AgentSelect 引擎选项与统一面板引擎徽标色。图标均为 currentColor 细描边,随主题染色,不引入彩色豁免。</p>

  <div class="card">
    <h2>KimiMark 与现有引擎 Mark 同构对比</h2>
    <div class="marks">
      <div class="mark-item">
        <!-- ClaudeMark 占位示意:像素脸 -->
        <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round"><rect x="5" y="5" width="14" height="14" rx="3"/><circle cx="9" cy="11" r=".8" fill="currentColor"/><circle cx="15" cy="11" r=".8" fill="currentColor"/></svg>
        <span>Claude</span>
      </div>
      <div class="mark-item">
        <!-- CodexMark 占位示意:>_ 花形 -->
        <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round"><path d="M5 8l5 4-5 4"/><path d="M12 16h7"/></svg>
        <span>Codex</span>
      </div>
      <div class="mark-item">
        <!-- PiMark:π -->
        <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"><path d="M3.6 6.6h16.8"/><path d="M8.4 6.6v11.8"/><path d="M15.6 6.6v9.6c0 1.5.9 2.2 2.4 2.2"/></svg>
        <span>Pi</span>
      </div>
      <div class="mark-item" style="color: var(--engine-badge-kimi)">
        <!-- KimiMark(本 PR 新增):细描边 K -->
        <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"><path d="M7 4.5v15"/><path d="M17.5 4.5 7.8 12.2"/><path d="M9.4 10.6 18 19.5"/></svg>
        <span>Kimi Code</span>
      </div>
    </div>
    <p class="note">KimiMark 与 PiMark 同构:细描边字形 + currentColor。此处仅以徽标色点亮演示;实际组件默认 mono(继承上下文前景色)。</p>
  </div>

  <div class="card">
    <h2>AgentSelect 引擎下拉(Worker 创建 / 新建会话共用组件)</h2>
    <div class="select-panel">
      <div class="select-option"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round"><rect x="5" y="5" width="14" height="14" rx="3"/></svg>Claude</div>
      <div class="select-option"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round"><path d="M5 8l5 4-5 4"/><path d="M12 16h7"/></svg>Codex</div>
      <div class="select-option"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round"><path d="M3.6 6.6h16.8"/><path d="M8.4 6.6v11.8"/><path d="M15.6 6.6v9.6c0 1.5.9 2.2 2.4 2.2"/></svg>Pi</div>
      <div class="select-option active"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"><path d="M7 4.5v15"/><path d="M17.5 4.5 7.8 12.2"/><path d="M9.4 10.6 18 19.5"/></svg>Kimi Code</div>
    </div>
    <p class="note">Kimi Code 选项仅在 Worker 创建面板可见;普通会话 / Scheduler / IM / Hook / Ghost errand 入口在运行时注册前(Phase 2)一律隐藏。</p>
  </div>

  <div class="card">
    <h2>统一模型面板 · 引擎徽标色(--engine-badge-kimi 占位)</h2>
    <div class="engine-rows">
      <div class="engine-row"><span class="badge-dot" style="background: var(--engine-badge-cc)"></span><code>--engine-badge-cc</code> #d97757(Anthropic 陶土橙)</div>
      <div class="engine-row"><span class="badge-dot" style="background: var(--engine-badge-codex)"></span><code>--engine-badge-codex</code> #7a9dff(官方渐变中段蓝)</div>
      <div class="engine-row"><span class="badge-dot" style="background: var(--engine-badge-pi)"></span><code>--engine-badge-pi</code> #a78bfa(自选紫)</div>
      <div class="engine-row"><span class="badge-dot" style="background: var(--engine-badge-kimi)"></span><code>--engine-badge-kimi</code> #38bdf8(占位青蓝,上游无官方品牌色规范,<strong>待设计裁决</strong></div>
    </div>
  </div>
</div>
</body>
</html>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 363c3bcc95

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

/** vendor → AgentKind(查目录 / 能力 / 记忆时用)。 */
export function agentKindOfEngine(engine: UnifiedEngine): AgentKind {
return engine === 'cc' ? 'claude-code' : engine === 'codex' ? 'codex' : 'pi';
return engine === 'cc' ? 'claude-code' : engine === 'codex' ? 'codex' : engine === 'kimi' ? 'kimi-code' : 'pi';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 补齐统一模型面板的 Kimi 反向映射

当统一面板处理 Kimi 模型条目或打开 Kimi 会话时,这里新增了 kimikimi-code,但同文件的 engineOfAgentKind 仍把 kimi-code 回退为 ccresolveUnifiedRowConfig、收藏配置和会话引擎固定逻辑随后都会按 Claude capabilities 解析该条目,选择 Kimi 行也可能提交成 Claude。请让双向转换保持对称。

Useful? React with 👍 / 👎.

const ccCaps = useAgentCapabilities('claude-code', deviceLinkDeviceId ?? undefined);
const codexCaps = useAgentCapabilities('codex', deviceLinkDeviceId ?? undefined);
const piCaps = useAgentCapabilities('pi', deviceLinkDeviceId ?? undefined);
const kimiCaps = useAgentCapabilities('kimi-code', deviceLinkDeviceId ?? undefined);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 实际选用新增的 Kimi capabilities

当打开导入的 Kimi 会话或 device-link 对端返回 Kimi 会话时,这里虽然新增了 kimiCaps,但紧随其后的 activeAgentCapabilities 仍只处理 Codex/Pi,其余一律选择 ccCaps;因此权限模式与 Plan 支持状态继续按 Claude 渲染和提交。此前反馈后的新证据是 Kimi hook 已接入,但其结果尚未进入活动能力选择分支。请为 agentKind === 'kimi-code' 选择 kimiCaps.capabilities

AGENTS.md reference: AGENTS.md:L117-L120

Useful? React with 👍 / 👎.

inputShape: {
agent: z
.enum(['codex', 'claude-code', 'pi'])
.enum(['codex', 'claude-code', 'pi', 'kimi-code'])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 在开放 Kimi 模型查询前处理未注册 runtime

当 Lead 按新增 schema 调用 list_available_models(agent: "kimi-code") 时,host 的 maker-ipc/register.ts 仍直接执行 maker.getCapabilities('kimi-code');本期没有注册 Kimi agent,因此 requireAgent 抛错并被包装成 INTERNAL,而无参数查询的 agents 数组也仍只包含旧的三个 agent。此前响应字段修复后的新证据是 host 的枚举与 capabilities 读取仍未处理未注册 Kimi;请返回空清单/可操作的未就绪结果,并将 Kimi 纳入“全部”查询。

Useful? React with 👍 / 👎.

@MagicLizi

Copy link
Copy Markdown
Contributor

@owlwang 👋 这个 PR 目前与 main 有合并冲突,auto-review 因此暂时跳过、没法继续审查 / 合并。

请在本地 merge 最新的 origin/main 解决冲突后推送;冲突解除后,下一轮 auto-review 会自动重新处理这个 PR。

@MagicLizi

Copy link
Copy Markdown
Contributor

@owlwang 👋 这个 PR 还有 3 条 review conversation 没 resolve(apps/desktop/src/renderer/components/new-chat/unifiedModelSelection.ts / apps/desktop/src/renderer/components/new-chat/ChatInput.tsx / packages/lizi-mcps/src/xdt-helper/list_available_models.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。

如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-discussion 等待维护者讨论(review-pr) touches:core 改动碰到架构核心路径(review-pr 自动维护,仅展示) touches:product-ui 改动碰到产品 / UI 面(review-pr 自动维护,仅展示) touches:redline 改动碰到红线路径(updater / DB schema 等,review-pr 自动维护,仅展示)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants