Commit Graph

186 Commits

Author SHA1 Message Date
Dash
ca4bdc9293 fix(voice-input): 改进个人词汇学习,候选两次自动入库 (#4095)
* fix(voice-input): 改进个人词汇学习并为三次候选提供入库保底

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(voice-input): 将候选自动入库门槛降为两次

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(voice-input): 保留高优先级学习动作的词条拼写

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(voice-input): persist progress for count and admission changes

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

---------

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
2026-09-09 02:43:01 +08:00
Dash
66adfb5d7b feat(mobile): 支持详细本地 Debug 日志与手动上传摘要 (#4092)
* feat(mobile): 支持本地诊断日志与手动上传

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* feat(mobile): 记录详细本地 Debug 日志并简化设置

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* test(mobile): 补齐滚动手势测试的 Debug 依赖

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(mobile): 补齐转义凭证脱敏与关闭后的日志清理

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(mobile): 完整过滤多字段鉴权头

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(mobile): 立即停止关闭后的采集并校验商店上传配置

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

---------

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
2026-09-09 02:42:05 +08:00
Kirozeng
043eaec31d Merge pull request #4072 from kirozeng/docs/visible-layer-radius-registration
docs(design): 按可见层与登记分配圆角并明确审查边界
2026-09-08 17:30:51 +08:00
Kirozeng
641650391b docs(design): 复用会话视图的两个 surface 补登记成员保护标签
review 指出:desktop.chat.orca-workflow 与 desktop.bots 经
extraStyleRoots 继承 desktop.chat.session(都渲染 CCAgentSessionView),
同样出现已登记的 workflow-status-cell / system-category-square 图元,
但 PROTECTED_TAGS 只写了 chat.session——两个 surface 台账 protected
为 —,按 surface 做 DS-9 迁移时会在无保护提示的情况下改坏登记几何。

补齐两个 surface 的生成器标签与人工行登记(注明经
desktop.chat.session 会话视图复用),种子测试加复用注记断言。
继承 chat.session 的 surface 恰好只有这两个,已核对无遗漏。

Signed-off-by: Kirozeng <kirozeng@gmail.com>
2026-09-08 15:35:13 +08:00
Dash
30a91a4ce9 test(device-link): 恢复拆仓后的连接集成测试并接入 CI (#3943)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
2026-09-08 13:51:08 +08:00
DavidShen
547da56c93 test: keep Pi RPC lifecycle coverage in unit CI
Signed-off-by: DavidShen <david@xd.com>
2026-09-08 13:11:24 +08:00
DavidShen
04394cfbde test: retain platform gates and expose explicit e2e entry
Signed-off-by: DavidShen <david@xd.com>
2026-09-08 12:45:45 +08:00
DavidShen
9daddddfb3 ci: preserve pnpm entry when running workspace test shards
Signed-off-by: DavidShen <david@xd.com>
2026-09-08 12:25:58 +08:00
Kirozeng
a9a8ddc087 docs(design): 台账种子补 desktop.settings 的用量图表登记成员
review 指出:上轮只同步了三个 surface 的 PROTECTED_TAGS,漏了
人工行已有的 desktop.settings 登记成员 usage-heatmap-day /
usage-token-bar——台账文件缺失或为空时 defaultHumanSeed 重建的
人工区会静默丢掉这两个成员及迁移约束。补进映射,并把种子测试
扩展到覆盖全部四个 data mark 成员。

Signed-off-by: Kirozeng <kirozeng@gmail.com>
2026-09-08 12:22:21 +08:00
DavidShen
fc522e55e3 test: stabilize test scheduling and consolidate validation cases
Signed-off-by: DavidShen <david@xd.com>
2026-09-08 12:11:17 +08:00
Kirozeng
6c98ed8bde docs(design): 台账生成源与设计索引同步 09-07 圆角登记
review 指出三处台账/索引与 09-07 裁决脱节:

- 生成器 PROTECTED_TAGS 仍给 desktop.chat.session 输出旧的
  "2px status micro-cells",种子断言也锁定旧短语;换为登记成员
  表述,并为 main-layout / window.sidebar 补 workflow-status-cell
  种子 tag,断言改为新短语在场 + 旧短语缺席。
- 台账人工表只在 desktop.chat.session 登记 workflow-status-cell,
  但 §5 成员明确覆盖 background-tasks 面板详情用法;该用法落在
  desktop.shell.main-layout 与 desktop.window.sidebar 两个 surface,
  补齐登记。
- cindy-design-system.md 缺本 PR 的 09-07 版本条目,08-29 / 07-28
  两条旧裁决仍以现行口吻陈述被取代的绝对化表述与尺寸判据;补
  09-07 条目并给两条旧条目加取代标注。

Signed-off-by: Kirozeng <kirozeng@gmail.com>
2026-09-08 11:12:57 +08:00
Kirozeng
63e90722e0 docs(design-system): DS-5 对齐执行路线与双端设计合同 (#4022)
* docs(design-system): DS-5 对齐执行路线与双端设计合同

Signed-off-by: kirozeng <kirozeng@gmail.com>

* fix-run ds5-anchor wave1 squash

group g1 tip c2d89fd0cf4c90ab38fa63dd39b3fd50c3eba3de

Signed-off-by: kirozeng <kirozeng@gmail.com>

---------

Signed-off-by: kirozeng <kirozeng@gmail.com>
2026-09-07 11:44:49 +08:00
Dash
15cb9db806 fix(permissions): 统一 Auto 审批,减少已授权操作的重复确认 (#3993)
* fix(permissions): 统一 Auto 审批并移除直接转人工的分支

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(permissions): 收紧授权历史与异步审批边界

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(permissions): 保留完整授权证据并隔离渠道原文

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(permissions): 防止新附件继承旧操作授权

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(permissions): 取消 Codex 审阅中的过期批准

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(permissions): 最小化文件正文并补齐凭证操作证据

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(permissions): 作废跨越 Pi 关闭边界的审批结果

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(permissions): 保留跨前台轮次的后台 Host 审批

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(permissions): invalidate stale auto reviews safely

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(permissions): invalidate auto reviews when stopping

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

---------

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
2026-09-06 19:55:53 +08:00
Chris Zhang
f045326f1e feat(bots): 交付长期伙伴、可恢复后台任务与三引擎协作 (#2829)
* feat(bots): 伙伴档案、Home 与轻量运行时基座

伙伴是永久 Profile + 可替换物理 Session 的两层结构:SOUL/记忆/自有技能落在
账号隔离的 Bot Home,canonical 卷每日 04:00 CAS 换代并归档,模型走 1-5 项
候选链,只有「候选不可用」才推进。运行时按 allowlist 装配能力:不继承
Cindy 全局 Skill/MCP/项目上下文;pi 关闭原生 subagent 扩展并传
--no-context-files,codex 置 project_doc_max_bytes=0,显式挂载 docs 工具集
时 cindy_docs 才进入 MCP allowlist —— 提示词承诺与工具面同进同退。
数据库为 6 张只增量新表(migration 0101)。

Signed-off-by: zqchris <chrisz83@gmail.com>

* feat(bots): 委派协作、交互卡与用户不可见的完成信号

协作只有一个直接入口 collaborate_with_bot:status 查空闲,notify 发不追踪
的消息,delegate 委派给另一个伙伴,start_task 把大活开成一条真正的 Cindy
任务(出现在主任务列表、走自己的权限门)。两种委派共用同一张 bot_delegations
表(target_bot_id 为空即 Cindy 任务)、同一张实时协作卡与同一条完成信号。

完成信号重做:不再往时间线落机读文本,改为 synthetic-trigger 隐藏行 ——
对模型是接手指令,对用户不可见,可见终态由协作卡承载;发起方父卷被每日
换卷归档时改投该伙伴当前 canonical 卷,不静默丢失。委派服务不再依赖
automation 上下文、token 预算层、投递 outbox 与 IM 路由。

Signed-off-by: zqchris <chrisz83@gmail.com>

* feat(bots): 桌面聊天面——名册、对话与最小设置

左侧伙伴名册(IM 式未读)、复用真实任务与 ChatInput 的聊天面、@伙伴结构化
引用,以及只剩三页的设置(成长/模型/维护)。创建收敛成「名字 + 自动色相
头像 + 人设文本」,不暴露 Session、压缩、fallback 等工程概念;记忆与自学
技能在设置页可见、可删。五语言 i18n 同步。

Signed-off-by: zqchris <chrisz83@gmail.com>

* docs(bots): 产品契约、设计规范与术语

《Cindy 伙伴运行时》契约与工程完成矩阵按 v1 范围重写:Bot Home 权威边界、
每日换卷、模型候选链、能力 allowlist、委派与完成信号的呈现契约;设计规范
登记伙伴头像色相与未读徽章的窄作用域 token,并把头像图收敛为保留命名空间。

Signed-off-by: zqchris <chrisz83@gmail.com>

* feat(bots): 伙伴会话不受通用回收与生命周期入口影响

worktree 回收器与通用任务生命周期入口跳过 source='bot' 的会话 —— 伙伴卷的
归档与替换只归 Bot Renew 管;崩溃恢复快照剥离 Bot 宿主瞬态引用。

Signed-off-by: zqchris <chrisz83@gmail.com>

* chore(bots): 清理砍单后的术语表残留与死注释

术语表移除已退出 v1 的「作品」「日程」两条,Teammate 描述收敛到当前范围;
botPersona 不再引用已删除的模板文件。

Signed-off-by: zqchris <chrisz83@gmail.com>

* feat(bots): unify tracked call orchestration

Signed-off-by: zqchris <chrisz83@gmail.com>

* fix(bots): simplify roster and create teammates directly

Signed-off-by: zqchris <chrisz83@gmail.com>

* fix(bots): show Cindy calls as task cards

Signed-off-by: zqchris <chrisz83@gmail.com>

* feat(bots): add bounded private conversations

Signed-off-by: zqchris <chrisz83@gmail.com>

* fix(bots): route direct teammate requests to private chat

Signed-off-by: zqchris <chrisz83@gmail.com>

* fix(bots): keep direct message traces visible

Signed-off-by: zqchris <chrisz83@gmail.com>

* fix(bots): ignore direct messages for unread alerts

Signed-off-by: zqchris <chrisz83@gmail.com>

* refactor(bots): unify teammate profile settings

Signed-off-by: zqchris <chrisz83@gmail.com>

* refactor(bots): show teammate settings on one page

Signed-off-by: zqchris <chrisz83@gmail.com>

* refactor(bots): simplify teammate settings

Signed-off-by: zqchris <chrisz83@gmail.com>

* fix(bots): restore professional teammate presets

Signed-off-by: zqchris <chrisz83@gmail.com>

* fix(bots): restore teammate ability presets

Signed-off-by: zqchris <chrisz83@gmail.com>

* fix(bots): equip built-in partners with skills

Signed-off-by: zqchris <chrisz83@gmail.com>

* feat(bots): present generated files as usable artifacts

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(bots): separate session tasks from bot messages

Signed-off-by: zqchris <chrisz83@gmail.com>

* refactor(bots): stabilize tasks and communication

Signed-off-by: zqchris <chrisz83@gmail.com>

* fix(bots): repair durable messages and verify runtime capabilities

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(bots): prevent deletion of shared collaboration history

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* test(bots): accept Windows line endings in navigation contract

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(bots): prevent sidebar menu misclicks and refine unread display

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* test(bots): close memory databases before temporary directory cleanup

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(bots): simplify creation into a dialog with avatar uploads

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* feat(bots): personalize companion invitations and simplify profile settings

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(bots): require confirmation by default and restore permission controls

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* refactor(bots): use static Main imports and inject invitation callbacks

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(bots): restore model picker scrolling in settings drawer

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* feat(bots): connect remote companions and use automatic review

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(bots): scope helper tools to companion sessions

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(bots): reject hidden companions in remote details

Backport the remote visibility fix from mobile commit 816424d8e so the Desktop companion PR enforces the same boundary.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(bots): hide private profiles from legacy remote reads

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(bots): check shared history before deletion preparation

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(bots): synchronize remote session and profile safety

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(bots): serialize deletion with shared message writes

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

---------

Signed-off-by: zqchris <chrisz83@gmail.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
Co-authored-by: Chris <4436110+zqchris@users.noreply.github.com>
2026-09-06 19:09:38 +08:00
Dash
4fb0594318 fix(dev): 防止普通启动继承 Terminal 的 smoke 开关 (#3975)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
2026-09-06 11:06:15 +08:00
Chris Zhang
83903a5eb3 fix(models): unify model pickers and recover provider switches (#3958)
* fix(model-selector): unify default A and synchronize favorite configuration

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(model-selector): preserve Fast across engine reselect and verify provider routes

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(model-switch): recover native history through durable Cindy handoffs

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(model-switch): recover outgoing auth and align pending picker state

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(model-selector): keep explicit configuration open during interaction

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(model-selector): toggle configuration with the same button

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

---------

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
Co-authored-by: Chris <4436110+zqchris@users.noreply.github.com>
2026-09-05 15:20:23 +08:00
Dash
1857e28e60 feat(computer): 对齐驱动契约并验证操作结果 (#3951)
* feat(computer): negotiate driver contracts and verify action outcomes

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(computer): cancel startup waits and disambiguate repeated tokens

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

---------

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
2026-09-05 13:32:33 +08:00
DavidShenXD
7ac1c4da73 fix(desktop): 修复跨供应商切模型与上下文保护 (#3930)
* fix(desktop): allow verified model window switches

Signed-off-by: david <david@xd.com>

* fix(desktop): explain model switch protection failures

Signed-off-by: david <david@xd.com>

* fix(desktop): 修复跨供应商切模型与上下文保护

Signed-off-by: david <david@xd.com>

* fix(desktop): 保留设置输入框深链能力

Signed-off-by: david <david@xd.com>

* fix(desktop): isolate Release auth snapshots during dev forks

Signed-off-by: david <david@xd.com>

* test(desktop): clean up rebase assertion

Signed-off-by: david <david@xd.com>

* chore(desktop): refresh design inventory after main rebase

Signed-off-by: david <david@xd.com>

---------

Signed-off-by: david <david@xd.com>
2026-09-05 10:43:39 +08:00
fico-hub
2f7a901c4b fix(legal): 重新生成第三方声明并修复生成器登记缺口(追平 Claude Code 2.1.259) (#3843)
* fix(legal): 重新生成第三方声明并修复生成器登记缺口

- 把 apps/desktop/resources/cindy-updater-runtime/ 加进 tracked binary
  登记白名单:#3697 引入 vcruntime140*.dll 后 generate-third-party-notices.mjs
  一直直接抛错,无法再生成任何 notices(披露条目本身 #3697 已写好)
- 为 exceljs → unzipper → binary 引入的 buffers / chainsaw / traverse
  三个 substack 旧包补 license 归一:包内元数据缺失或写作非法 SPDX
  表达 "MIT/X11",依据包内 LICENSE、Debian copyright 审计与
  ClearlyDefined 登记为 MIT
- 重新生成全部 notices 与 SBOM:Claude Code CLI 披露版本追平 ec4bd863
  升级后的 2.1.259,同时补齐 Expo 57、pi 0.84.4、exceljs 等 main 上
  已落地但未再生成的依赖变化

Signed-off-by: ficowang <fico@xd.com>

* fix(legal): review 收口——license override 限定核验版本,更新器 runtime 改精确文件登记

- PACKAGE_POLICIES 的 buffers/chainsaw/traverse 条目加 verifiedVersion:
  override 只对人工核验过的版本生效,版本升级后自动失效并让
  license audit 重新报错,避免许可证变化被静默沿用旧结论
- cindy-updater-runtime 从目录前缀白名单改为逐文件登记
  (vcruntime140.dll / vcruntime140_1.dll):目录内新增其它二进制时
  重新触发登记拦截
- 反证:verifiedVersion 改成不匹配值后生成器如预期重新抛
  license audit 错误;恢复后生成器 exit 0 且 notices 产物零变化,
  notices 测试 8/8 通过

Signed-off-by: ficowang <fico@xd.com>

---------

Signed-off-by: ficowang <fico@xd.com>
2026-09-04 03:24:13 +08:00
bobo
a406850079 feat(skillhub): connect clients to Cindy SkillHub (#3682)
* feat(skillhub): connect clients to Cindy SkillHub

Signed-off-by: xd-bobo <caojianbo@xd.com>

* fix(skillhub): remove legacy XD visibility copy

Signed-off-by: xd-bobo <caojianbo@xd.com>

* feat(skillhub): add scoped catalog tabs

Signed-off-by: xd-bobo <caojianbo@xd.com>

* fix(skillhub): remove available market filter

Signed-off-by: xd-bobo <caojianbo@xd.com>

* refactor(skillhub): simplify skill catalog header

Signed-off-by: xd-bobo <caojianbo@xd.com>

* feat(skillhub): 优化目录导航、匿名浏览和扫描反馈

Signed-off-by: xd-bobo <caojianbo@xd.com>

* fix(desktop): keep local endpoints across realm switches

Signed-off-by: xd-bobo <caojianbo@xd.com>

* fix(skillhub): align catalog presentation and review feedback

Signed-off-by: xd-bobo <caojianbo@xd.com>

* fix(skillhub): guard endpoint and preserve metadata

Signed-off-by: xd-bobo <caojianbo@xd.com>

* fix(skillhub): 对齐组织归属与 XD 只读策略

Signed-off-by: xd-bobo <caojianbo@xd.com>

* fix(skillhub): 透传技能目录来源

Signed-off-by: xd-bobo <caojianbo@xd.com>

* fix(skillhub): 由服务端决定组织目录路由

Signed-off-by: xd-bobo <caojianbo@xd.com>

* feat(skillhub): 支持当前版本公开审核

Signed-off-by: xd-bobo <caojianbo@xd.com>

* feat(skillhub): 支持首页分页加载更多

Signed-off-by: xd-bobo <caojianbo@xd.com>

* fix(skillhub): align catalog scope and publishing contracts

Signed-off-by: xd-bobo <caojianbo@xd.com>

---------

Signed-off-by: xd-bobo <caojianbo@xd.com>
2026-09-03 05:40:11 +08:00
Kirozeng
7175eff645 feat(design-system): DS-3 最小语义 Token 影子层 (#3798)
* feat(design-system): DS-3 最小语义 Token 影子层

在 packages/design-tokens 建立 reference → semantic 两层 DTCG 影子字典。
数据源仅为 DS-2b 冻结快照,零运行时接线;产品代码不改。

Signed-off-by: kirozeng <kirozeng@gmail.com>

* fix-run ds3-r1b wave1 squash

group g1 tip 793c462b68839fc857844d55b4e9d37031153c6b

Signed-off-by: kirozeng <kirozeng@gmail.com>

* fix(design-tokens): HSL 色值改用标准 DTCG 颜色对象,修复 Windows CRLF 假红

review 指出 12 个 HSL triplet reference 节点是自造的 $type: "other"——
它不是标准 DTCG token 类型,且校验器此前显式放行,测试全绿也发现不了。
对治理合同锁定的 Terrazzo 2.7.1 实测:other 类型 token 被 CSS 插件静默
丢弃(不产出任何 CSS 变量),alias 到它同样无输出;裸 triplet 字符串在
$type: color 下被解析成黑色。DS-8 接线时影子层无法直接承担生成切换。

- dtcg.ts 新增 toDtcgColorObject / dtcgColorObjectToString:HSL triplet →
  {colorSpace:"hsl",components:[h,s,l]};hex/rgba/transparent → srgb 分量
  (0-1) + 可选 alpha。$type 收紧为仅 color。
- build-layers.ts 删除 dtcgTypeFor 启发式,reference/semantic 全部节点
  生成标准颜色对象;重生成两层 JSON(12 个 other reference + 14 个
  other semantic alias 全部消除)。
- guards.ts:$type 校验不再放行 other;reference 只许颜色对象字面量,
  semantic 只许 alias;逐值一致守卫改在颜色对象层比较(hex 大小写不构成
  色值差异)。
- .gitattributes 给 packages/design-tokens/src/**/*.json 钉 eol=lf(drizzle
  migration .sql 同款先例):Windows autocrlf 检出把生成物转 CRLF 导致
  「磁盘 = 内存生成」字节一致守卫假红(本轮 CI Windows unit tests 红),
  并补 git check-attr 回归测试钉住该契约。
- value-consistency.test.ts 补往返还原与 other 拒收的回归测试。

验证:pnpm --filter @cindy/design-tokens typecheck / vitest 19 测试全绿;
pnpm test:unit:related 全量绿;生成器两次运行字节一致;最终生成物过
Terrazzo 2.7.1 tz build 零 lint 错误,136 token 全部产出 CSS 变量。

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* fix(design-tokens): 零接线守卫按文件位置解析相对 import,校验器检查分量范围

Codex 新一轮 review 两条 P1 的跟进:

① 相对路径接线漏检(成立):兄弟 workspace(packages/foo/src/a.ts)写
`../../design-tokens/src/…` 时说明符不含 packages/ 段,旧正则
`packages\/design-tokens\/(?:src|dist|build)\//` 漏检,零运行时接线守卫
会放行真实消费者。修法:新增 relativeSpecifierHitsDesignTokens——提取
from/import()/require()/import.meta.resolve() 语境下的相对说明符,按被
扫描文件的 repo 相对位置 resolve,落进 packages/design-tokens/ 即命中;
任意 ../ 深度、兄弟包与 apps 侧路径全覆盖。findRuntimeImportsOfDesignTokens
双通道检测,并补正反两组自证伪用例(全仓扫描零误报保持)。

② HSL 百分比分量应为 0–1(不成立):DTCG Color 模块 Color Space 表原文
是 hsl hue [0,360) / saturation / lightness [0,100]——s/l 用 0–100 不是
0–1,规范自己的白色示例就是 components: ["none", 0, 100]。Terrazzo 2.7.1
实测:[60, 12.5, 97] 产出 hsl(60 12.5% 97%)(正确),0–1 写法产出
hsl(60 0.125% 0.97%)(几乎全黑)。生成物不改。采纳意见的合理内核:
校验器现在按色彩空间检查分量合法范围(srgb 通道 [0,1]、hsl hue [0,360)
360 非法、s/l [0,100]、alpha [0,1]),把正确范围锁进守卫防止反向犯错,
并补越界反证用例。

验证:pnpm --filter @cindy/design-tokens typecheck 通过;22 个单测全绿
(新增 3 个);生成物未变(本轮零改动 rebase 在 77db609e2 之上)。

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* fix(design-tokens): 相对说明符提取补副作用 import 语境

Codex review P2(3913379862)跟进:兄弟 workspace 写
`import '../../design-tokens/src/generate.ts'`(副作用导入,无 from 子句
无括号)时,SPECIFIER_CONTEXT_RE 四种语境都命不中,相对路径解析通道
漏检,零接线守卫会放行。

- 补 `import '…'` 分支:用 `(?=['"])` 前瞻定位引号(分支自身不吞引号,
  引号由共享后继统一消费,`\s*` 覆盖换行形态),实测单行 / 换行 / 双引号
  形态全部命中。
- 顺带修既有误报:import() / require() 分支此前无 `(?<![\w$.])` 守卫,
  `foo.import('…')` / `foo.require('…')` 成员调用会被当 import 语句命中
  (上一轮就存在,本轮一起收口);副作用 import 分支同款守卫。
- 反证用例:副作用 import 两种形态命中;foo.import / foo.require 成员
  调用不误报;全仓扫描仍零命中。

验证:pnpm --filter @cindy/design-tokens typecheck 通过;22 单测全绿
(zero-wiring 新增 4 个断言形态)。

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* fix(design-tokens): 零接线守卫剥离注释与字符串里的伪导入

Codex review P1(3913459489)跟进:守卫把源码全文直接喂正则,注释或错误
消息里出现完整 import 语句(如 `// import '@cindy/design-tokens';`)会被
当真实接线,required unit workspace 假红,无运行时接线的改动被 CI 阻断。
实测确认属实(此前『非导入语境不误报』用例能过只是因为缺完整 import
语法)。

- 新增 stripCommentsAndDataStrings:轻量状态机剥除行注释 / 块注释(替换
  为等长空白,行列结构不变);字符串字面量按语境二分——开引号前以
  from/import(/require(/import.meta.resolve(/import 语境结尾的是模块
  说明符,保留原文;否则是数据字符串,内容替换为空白(引号保留)。
  语境判定只看输出末尾 64 字符,避免全文件正则回溯。
- containsRuntimeImportOfDesignTokens / relativeSpecifierHitsDesignTokens
  改两段式:先跑廉价正则,零命中(绝大多数文件)不付剥除成本;命中后
  剥除复核,命中若来自注释/文案则判非真实接线。全仓扫描 3.8s,超时余量
  提到 60s(Windows 慢盘)。
- 正则字面量不识别:只在『漏放』方向偏差(正则内容被清空不命中),真实
  import 语句不会写在正则里,可接受——如实注释声明。
- 反证用例:注释(单行/块/JSDoc)/ 数据字符串 / 报错文案里的完整 import
  语句全部不误报(两个通道都验);剥除后真实 import 全形态(含前面有
  注释或数据字符串的)仍然命中;stripper 语义四组直接断言。

验证:pnpm --filter @cindy/design-tokens typecheck 通过;25 单测全绿
(zero-wiring 新增 3 个用例 17 个断言形态);全仓扫描仍零命中。

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* fix(design-tokens): 零接线守卫剥除顺序前置,修复注释隔断的合法导入漏检

Codex review P2(3913603623)跟进:`import(/* webpackChunkName: "tokens" */
'../../design-tokens/src/snapshot.ts')` 这类说明符前带合法注释的导入,两个
检测通道都漏检。根因是上一轮两段式的顺序缺陷:廉价正则预扫跑在原始文本
上,注释隔断了关键字→引号衔接,预扫零命中提前返回,剥除层(本可剥掉注释
恢复衔接)反而执行不到——防误报的层顺序自己制造了漏放。

- 剥除前置:containsRuntimeImportOfDesignTokens 与
  relativeSpecifierHitsDesignTokens 都改为先剥注释/数据字符串、再跑正则。
  注释的两个方向(伪命中 / 遮蔽真命中)都由剥除层统一解决。
- 性能:stripCommentsAndDataStrings 重写为 chunked 状态机——普通文本按
  区间整段拷贝(不再逐字符拼接),语境判定从后往前拼接 chunk 凑 64 字符
  窗口;7.7MB 真实包源码 59ms(125MB/s,较逐字符版 5.9MB/s 提速 21 倍)。
  另加 import/require/from 关键字 includes 预检,无语法痕迹的文件零成本。
  全仓扫描 1.24s(较上轮 3.8s 基线更快)。
- 反证用例:动态 import / require / 副作用 import 带注释的相对路径走
  rel 通道、包 id 带注释走 id 通道,各自命中;注释/数据字符串误报形态
  回归保持全绿。

验证:pnpm --filter @cindy/design-tokens typecheck 通过;26 单测全绿;
全仓扫描仍零命中零误报。

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* fix(design-tokens): 导入语境判定去长度窗口,member-require 不再被后顾排除

Codex review 两条 P1 跟进:

① 固定 64 字符窗口判语境(3913687085,成立):>64 字符的块注释剥成
空白后把 import( 挤出 tail 窗口,说明符被当数据字符串清空,两通道漏放。
修法采纳「状态机直接保留导入语境」:维护 lastCodeContext(无空白压缩的
最近输出,注释与空白不推进),判定时 trimEnd 后匹配——任意长度注释
都不再影响语境,无长度上限。实测 100/300 字符注释形态全命中。

② module.require 被负向后顾排除(3913687096,成立):`module.require()`
是 Node 真实模块加载 API,`(?<![\\w$.])` 却因 . 前缀拒绝匹配。修法:
后顾放宽为 `(?<![\\w$])`(只排除 myImport 标识符连写),. 前缀放行;
foo.import( 这类自定义成员调用同被命中——宁误报不漏放,守卫拦截的是
「有人真接线」,member-require 恰是合法接线形态。IMPORT_ENTRY_PATTERNS
与 SPECIFIER_CONTEXT_RE 两处同步。

行为变更如实声明:foo.import('…') / foo.require('…') 从「不误报白名单」
移入「命中集」——上一轮把它们列为不误报用例,本轮按威胁模型反转并在
测试里注明理由;标识符连写(myImport)仍排除。

验证:pnpm --filter @cindy/design-tokens typecheck 通过;28 单测全绿
(新增 2 个 P1 用例);全仓扫描 1.9s 零命中零误报。

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* fix(design-tokens): 零接线扫描纳入 require.resolve 加载入口

Codex review P2(3913799524)跟进:产品包通过
`readFileSync(require.resolve('../../design-tokens/src/semantic/color.json'), 'utf8')`
消费影子层时是真实运行时消费者,但剥离层把 require.resolve 的参数当普通
数据字符串清空,包 id 与相对路径两个通道都返回 false——漏放。实测确认
(含 module.require.resolve 成员链)。

- SPECIFIER_CONTEXT_RE / SPECIFIER_PREFIX_RE 补 require.resolve 语境
  (`require\s*\.\s*resolve\s*\(` 容忍空格形态);IMPORT_ENTRY_PATTERNS
  补 require.resolve( 模块 id 形态。
- 反证用例:readFileSync(require.resolve(…))(包 id / 相对路径)、裸
  require.resolve、module.require.resolve 成员链全部命中;注释/数据字符串/
  myResolve 标识符回归不误报。

验证:pnpm --filter @cindy/design-tokens typecheck 通过;29 单测全绿;
全仓扫描 1.9s 零命中零误报。

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* fix(design-tokens): 零接线扫描纳入模板字面量形式的模块说明符

Codex review P1(3913883249)跟进:`import(`../../design-tokens/src/snapshot.ts`)`、
`require(`@cindy/design-tokens/src/snapshot.ts`)` 这类无插值模板字面量是
有效运行时加载,但提取正则只认单双引号——包 id 与相对路径两个通道都漏放。
实测确认。

- SPECIFIER_CONTEXT_RE / IMPORT_ENTRY_PATTERNS 的引号字符类从 ['"] 扩到
  ['"`],全部六种语境(from / import() / require() / require.resolve /
  import.meta.resolve / 裸副作用 import)同步。
- 带 ${…} 插值的模板**同样命中**:路径在运行期拼装恰是零接线阶段不该
  出现的动态消费形态,按宁误报不漏放处理(与 member-require 同一威胁
  模型,如实声明)。
- 数据语境的普通模板不误报:剥离层在非说明符位置把模板内容剥成空白,
  既有机制无需改动。
- 反证用例:import/require/require.resolve/from/副作用 import 的模板形态
  (包 id + 相对路径 + 插值)全部命中;数据模板回归不误报。

验证:pnpm --filter @cindy/design-tokens typecheck 通过;30 单测全绿;
全仓扫描 2.4s 零命中零误报。

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* fix(design-tokens): 语义豁免色登记 exemption 元数据,fs 裸相对路径直读纳入零接线扫描

Codex review 两条 P2 跟进:

① 豁免色缺 protected 登记(3914411235,成立):destructive / error-* /
warning-* / focus-ring* 已进 semantic 建模,但 DESIGN.md §10 列其为
theme-invariant 语义豁免色、治理合同 §3.2 要求 Tier-3 豁免色作为 protected
角色迁移——分类里却是无元数据的普通 literal,DS-8 生成主题入口时无法区分
可覆写 semantic 与必须保留原值的豁免族。修法:新增 SEMANTIC_EXEMPTION_IDS
与 exemption 元数据(与 PROTECTED_IDS 并列、语义不同——豁免色**照常建模**
只带标记,protected 是「只登记不建模」);ClassificationEntry 加 exemption
字段,11 个已建模豁免色重新生成登记;新守卫 assertSemanticExemptionsRegistered
校验已建模豁免色必须带标记且不与 protected 混用。

② fs 裸相对路径直读漏检(3914411249,成立):
readFileSync('../../design-tokens/src/semantic/color.json') 是最直接的
消费方式,两通道都漏。修法:fs API 路径参数成为第八类说明符语境
(readFileSync/readFile/writeFileSync/existsSync/statSync 等 13 个 API 的
第一参数,含成员链与模板形态),按调用文件位置 resolve。误报核查:第一方
代码既有 fs 读取全部走 resolve(__dirname…) / new URL(…) 包装(54 处实测),
裸相对形态为零——纳入扫描零误报,全仓扫描实证。

验证:pnpm --filter @cindy/design-tokens typecheck 通过;33 单测全绿
(新增豁免色守卫 + fs 检测两组用例);全仓扫描 3.0s 零命中零误报;
生成器两次运行字节一致。

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* fix(design-tokens): 零接线扫描纳入路径构造器与 Windows 反斜杠说明符

Codex review 两条 P2 跟进:

① 路径构造器包装漏检(3914597287,成立):
`readFileSync(resolve(__dirname, '../../design-tokens/…'))` / `join(…)`
是仓内既有 fs 读取的主流写法(54 处实测),旧实现只认 fs API 第一参数
直接以引号开始——包装形态两通道都漏。修法:resolve/join 调用内的静态
字符串片段(任意参数位置)成为第九类说明符语境,按调用文件位置 resolve
(__dirname ≈ 文件所在目录)。剥离层语境判定同步(resolve(/join( 开括号
后未闭括号内的字符串保留)。误报核查:既有 54 处用法全部不指向
design-tokens,Array.join 分隔符字符串不以 '.' 开头天然过滤——全仓扫描
零误报实证。

② Windows 反斜杠说明符漏检(3914597300,成立):
`require('..\\..\\design-tokens\\src\\x')` 在 Windows CJS 合法,
但说明符直接交给 path.posix、反斜杠不被识别为分隔符——resolve 结果不
落进 design-tokens,漏放。修法:说明符统一反斜杠归一为 / 再 resolve
(源码字符串里 \\ 是转义单反斜杠;仓内无含反斜杠字符的 POSIX 文件名,
替换是安全近似)。

验证:pnpm --filter @cindy/design-tokens typecheck 通过;35 单测全绿
(新增两组 11 个断言形态);全仓扫描 3.1s 零命中零误报。

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* fix(design-tokens): 路径构造器重建全部静态参数,Tier-1 受保护 slot 照常语义建模

Codex review 两条 P2 跟进:

① 路径构造器只捕获第一个字符串参数(3914703193,成立):
`join(__dirname, '..', '..', 'design-tokens/…')` 分段拼接形态实际读取
design-tokens,但正则只看第一个 '..' 就返回 false——常见分段写法绕过
守卫。修法:重建调用内**全部**静态字符串参数——PATH_CONSTRUCTOR_CALL_RE
捕获完整调用实参区,按序提取字符串字面量拼成候选路径再按文件位置
resolve(非字符串参数天然缺席,等价于从文件目录起算的相对段)。反证:
分段 join / 多段 resolve / 模板段全命中;既有 54 处用法与 Array.join
分隔符回归零误报。

② 受保护 Tier-1 文本角色被移出 semantic(3914703199,成立):
text-secondary / text-secondary-cross 是 DESIGN.md §10 Tier-1 slot,
治理合同 §3.2 明确「Tier-1 semantic slots → semantic,名称与用途延续」;
却被 PROTECTED_IDS 统一 register-only 分支标成只登记、从 semantic JSON
消失——DS-8 接管生成时无法从新真相源生成这两个核心文本变量。U2 保护
限制的是改值须裁决(never darken unilaterally),不等于禁止迁移。
修法:ProtectedRule 加 mode 字段——Tier-1 slot(text-secondary /
text-secondary-cross)semantic-modeled:照常值形态分类 + 强制进
semantic + 保留 protected 元数据;Tier-3 singleton(annotation-accent、
login-brand-*)维持 register-only(治理合同「保留原位,逐项裁决,默认
不动」,本 PR 未裁决它们进 semantic)。守卫 assertProtectedNotSemantic
按 mode 分支校验;SEMANTIC_ROLES 补登记两个 Tier-1 slot。

验证:pnpm --filter @cindy/design-tokens typecheck 通过;35 单测全绿
(oracle 与保护值用例同步 mode 语义;value-consistency 验证
text-secondary 双模式值与冻结快照一致);全仓扫描零命中零误报;
生成器两次运行字节一致。

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* fix(design-tokens): 零接线扫描纳入 import.meta.glob,语境判定锚定开引号

Codex review 两条 P2 跟进:

① import.meta.glob 漏检(3914869131,成立):Vite 的
`import.meta.glob('../../design-tokens/src/**/*.json')` 在构建期把影子层
内容打进产品(仓内 packages/lizi-mcps/src/browser/recipe-loader.ts 有
实际用例),但说明符语境没有 import.meta.glob 分支——两通道漏放。修法:
SPECIFIER_CONTEXT_RE / SPECIFIER_PREFIX_RE 补 import.meta.glob( 分支,
相对 glob 模式按文件位置 resolve(glob 元字符不影响前缀段判定)。

② 语境残留误报(3914869140,成立):`import x from './x'; const hint =
'packages/design-tokens/src/x';` 被误报——SPECIFIER_PREFIX_RE 的
\\bfrom / \\bimport 分支在 2320ce02 轮重写时丢失了 \\$ 锚定,匹配的是
「语境里任何位置有 import 字样」而非「语境以 import 结尾」,数据字符串被
剥除层错误保留、裸路径模式随后误报接线。修法:所有分支共享末尾 \\$ 锚定
((?:…)$ 整组包裹),保证匹配的是紧邻当前开引号的调用语境。

反证用例:glob(含模板形态与既有 recipes 用法不误报)、残留语境三种形态
不误报;此前全部九类语境 + 注释/数据字符串回归(23 形态)全绿。

验证:pnpm --filter @cindy/design-tokens typecheck 通过;37 单测全绿;
全仓扫描零命中零误报。

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* fix(design-tokens): 零接线扫描纳入 fs/promises.open 与 .mts/.cts 源码

Codex review 两条 P2 跟进:

① fs/promises.open 漏检(3915016839,成立):
`const file = await open('../../design-tokens/src/semantic/color.json');
await file.readFile()` 真实消费影子层,但 open 不在 fs API 列表(openSync
在、异步 open 不在)——路径字符串被剥除,两通道漏放。修法:open 加入
FS_API_PATH_CONTEXT_RE 与 SPECIFIER_PREFIX_RE,预检补 open 字样(裸
open('…') 不含 File/Sync,此前连剥除层都进不去)。误报核查:window.open
的 URL 参数不以 '.' 开头天然过滤;仓内以 '.' 开头字符串参数的 open( 调用
实测为零。

② .mts/.cts 扫描缺口(3915016844,成立):扫描器扩展名正则只认
ts/tsx/js/mjs/cjs,.mts/.cts(有效 Node/TS 模块扩展,仓内 scripts/ 与
tools/ 已使用)的文件在读取内容前被跳过——相对路径消费且不留
package.json 依赖,两通道都看不见。修法:扩展名正则补 mts|cts,并用
临时 fixture(.mts 与 .cjs 消费者各一)直接验证扫描器行为。

验证:pnpm --filter @cindy/design-tokens typecheck 通过;38 单测全绿;
全仓扫描零命中零误报。

Signed-off-by: Kirozeng <kirozeng@gmail.com>

---------

Signed-off-by: kirozeng <kirozeng@gmail.com>
Signed-off-by: Kirozeng <kirozeng@gmail.com>
2026-09-03 03:21:04 +08:00
Dash
f7d50150cc perf(desktop): 降低 Windows 语音输入启动与提交延迟 (#3815)
* perf(desktop): 降低 Windows 语音输入启动与提交延迟

- Windows 已授权后跳过重复的临时麦克风探测流;权限运行期被撤销时立即失效缓存
- 系统静音期间缓存开头 PCM,静音完成后补发,不再丢首字
- BYOK ASR 支持 1.5s 错峰竞速与 4.5s 快速失败,输家连接显式回收;托管模式保持串行
- 会话分配加代次号,晚到的托管会话不再覆盖新的 fallback 候选
- FallbackAsrProvider 补发候选胜出前的 connected 事件,asr_connected 打点不再为空
- 新增会话分配 / socket 握手 / flush 等待的分段耗时日志与脱敏的 latency summary
- voice-input:start 里 refiner 链与 ASR 链解析改为并行
- 修复反复语音输入导致的 WebContents destroyed 监听器累积
- 修复每次录音后全局快捷键按对象引用重复同步、反复报 registration failed
- Tip 声明受控意图后固定走受控路径,消除提交时 Radix Tooltip 受控切换警告

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): 语音输入静音前音频不再补发,撤权时当前尝试直接进入权限恢复

- 回退「系统静音期间缓存开头 PCM 并补发」:这段音频含静音生效前的系统播放
  内容,恢复基线的丢弃门控(inline 与 global overlay 两处对称)。
- captureSession 在 getUserMedia 报 NotAllowedError/SecurityError 时返回
  permissionDenied,useVoiceInput 走 onMicrophonePermissionRequired、overlay
  走 microphone 权限提示,不再让用户先看到原始错误再重试一次。

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(desktop): 去掉 BYOK ASR 启动的 4.5s 外层超时,保留各 provider 自身连接期限

外层计时从 provider.start() 一开始就走,覆盖了凭证读取与代理解析,而各 provider
的 5s 连接超时只从 socket 拨号开始算;单 provider 的 BYOK 配置下,一次前置耗时
1s、拨号 4s 的正常连接会被外层误杀且没有 fallback 可退。删除 startTimeoutMs 与
startWithTimeout,慢候选只由错峰竞速推进。

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

---------

Signed-off-by: Dash <dashhuang@gmail.com>
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
2026-09-03 03:18:44 +08:00
Lizi
635977dd9c feat(desktop): use Codex package in development
Signed-off-by: Lizi <jiali@magiclizi.com>
2026-09-03 00:11:05 +08:00
DavidShenXD
36d25a4640 fix(desktop): 为 Windows 更新器内置 VC++ Runtime 并阻断重试死循环 (#3697)
* fix(desktop): guard updater runtime prerequisites

Signed-off-by: DavidShen <david@xd.com>

* docs(design): 补充 Windows 更新器运行库提示证据

Signed-off-by: DavidShen <david@xd.com>

---------

Signed-off-by: DavidShen <david@xd.com>
2026-09-01 18:24:35 +08:00
Kirozeng
cb794f4ef9 test(design-system): DS-2a 生产 UI 台账 (#3648)
* test(design-system): DS-2a 生产 UI 台账

登记 Desktop 生产可达 UI 台账(混合 markdown:GENERATED 机器事实 + 人工迁移状态),并加上生成器 / --check 与单测。产品代码零改动。

Signed-off-by: kirozeng <kirozeng@gmail.com>

* docs(design-system): DS-2a 回填路线图 PR 号

Signed-off-by: kirozeng <kirozeng@gmail.com>

#3638 已合入。§12 DS-2a 填 #3648;DS-1 保持 ✅ #3609,本张未合入不加勾。

* fix(design-system): DS-2a 台账补迁移弹窗、薄壳统计与 stale 路由核对

review 反馈修复(PR #3648):
- catalog 补录 desktop.auth.legacy-migration:App 顶层挂载的
  LegacyMigrationDialog 是生产可达 UI,此前不在手工目录,
  --check 只解析路由发现不了
- AddAccountLoginPage 渲染即委托 LoginPage,按 extraStyleRoots
  并入登录皮肤同组事实源,统计不再全 0
- productionRouterCoverage 增加 stale 反向核对:catalog 路由被
  删除/改名后 --check 直接失败,不再静默从覆盖表抹掉
- 生成模式快照日期改为当天求值,--check 沿用文件内既有日期
- 人工表补行改为按 surface ID 有序插入
- 测试断言不再用 includes(URL) 子串(CodeQL
  js/incomplete-url-substring-sanitization 会拦)

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* fix(design-system): DS-2a 台账组件核对、失效样式根报错与沙箱化 CLI 测试

review 反馈修复(PR #3648 第三轮):
- productionRouterCoverage 增加 componentMismatch:路径保留但 element
  换新组件时 --check 直接失败,catalog 的 routeComponents 与真实
  路由入口组件逐路径核对,台账不再内部自相矛盾
- styleRoot 路径不存在时不再静默跳过:collectStyleFiles 记录
  missing,CLI 以 missingStyleRoots 报错退出,源码移动后统计不会
  静默归零还过检
- splash surface 补录 LoginBrandStage:App.tsx 同源 gating 并挂两者,
  品牌画布启动期即渲染(z-9980,Splash z-9999 之下),计入可达组件
  与样式根,统计 4/11/1
- CLI 测试改在临时拷贝上跑(CINDY_INVENTORY_DOC 重定向写读),
  跨日运行 test:runner 不再改写受版本控制的真实台账;新增守卫
  用例钉住真实文件前后字节一致

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* fix(design-system): DS-2a Orca 工作台继承会话视图样式事实

review 反馈修复(PR #3648 第四轮):
- OrcaSplitView / OrcaWorkerPanel 都直接渲染 <CCAgentSessionView
  compact orcaMode>,只扫三个 Orca 包装文件会把完整聊天界面统计成
  0 token / 0 裸颜色。orca-workflow surface 补 extraStyleRoots →
  desktop.chat.session,CCAgentSessionView 入可达组件
- 统计从 0/0/1 变为 268/217/423(会话视图本体 + Orca 包装层),
  与 desktop.chat.session(268/217/422)同一组事实源
- 新增测试钉住 Orca 继承不回退

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* fix(design-system): DS-2a 台账统计剔伪裸色、市场页补子组件与 view 分支守卫

review 反馈修复(PR #3648 第五轮):
- 统计层剔除 var() 包装与注释伪裸色:hsl(var(--token)) 是语义
  token 消费、注释里的 PR 编号/坐标不是组件样式。新增
  filterInventoryBareColors + TS/TSX 剥注释后再统计;共享匹配器
  matchBareColors 口径不动(治理合同:与 audit 必须同一套正则,
  audit 扫 diff 的宽松行为保持)
- skillhub market 补直接渲染子组件:MarketCard /
  InstallTargetPicker / SkillhubMarketPreviewPanel /
  MarketInfoEditDialog / VisibilityEditorDialog 入可达组件与
  样式根(components/ 目录 + 预览面板),统计不再只扫入口文件
- 新增 view 分支覆盖守卫:extractViewEntries 从 main-entry.tsx
  抽 view === '...' 分支,catalog 的 viewEntries 正反两个方向
  核对——新增非 router 生产入口而未登记 surface 时 --check 失败
- GENERATED 自述补充统计口径说明

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* fix(design-system): DS-2a Token 统一去注释口径、skillhub 本地与插件页补子组件

review 反馈修复(PR #3648 第六轮):
- Token 统计改用剥注释后的 scanSource(与裸色/圆角同口径):
  注释里的 var(--xxx) 占位符(GhostToolCard/ErrorBanner 等)不再
  计入权威基线
- skillhub.local 补直接渲染子组件:PluginManagementLayout
  (features/plugin 共享布局)、SkillhubMarketPreviewPanel、
  InstallTargetPicker 入可达组件与样式根,统计 33/0/53 → 41/0/70
- plugins.installed 补直接渲染子组件与 plugin-motion.css:
  PluginManagementLayout、MarketPluginDetailView、PluginScopePicker、
  MyPublishesSection、AddMarketplaceDialog、UpdateAllDialog 入
  可达组件与样式根,统计 25/0/52 → 49/0/81

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* fix(design-system): DS-2a 主窗口纳入 globals.css、camelCase 圆角、模块图入口守卫与 extraStyleRoots 校验

review 反馈修复(PR #3648 第七轮):
- 主窗口壳纳入 globals.css:main-entry.tsx 无条件导入,CINDY 皮肤段
  直接改写 MainLayout 根容器/侧栏背景与 token,统计 45/3/66 → 97/92/80
- BARE_RADIUS_RE 补 React style 对象的 camelCase borderRadius:,
  LoginCaptchaOverlay/ImageLightbox 等内联圆角不再漏计(登录页
  裸圆角 6 → 21)
- renderer 模块图入口守卫:extractRendererEntries 从 index.tsx 抽
  urlParams.get(...) 查询参数入口,catalog 的 rendererEntries 正反
  双向核对(resourceUsageWindow / sidebarWindow / ghostPanelWindow)
- extraStyleRoots 失效引用报错:被引用 surface ID 改名/删除/误拼时
  不再静默展开为空数组,danglingExtraStyleRoots 使 --check 失败

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* fix(design-system): DS-2a 独立窗口纳入 globals.css、模块图入口核对参数→模块映射

review 反馈修复(PR #3648 第八轮):
- 三个独立窗口 surface(resource-usage / sidebar-window /
  ghost-panel)补 globals.css:各 entry 文件都直接导入,
  body/#root 基础样式与窗口专用规则实际生效,统计 4/2/0 → 60/91/14
- extractRendererEntries 升级为「参数 → 入口模块」映射:只核参数名
  防不住参数保留但分支换加载别的入口(换窗口实现);现按嵌套三元
  链序配对,catalog 的 rendererEntryModules 逐参数核对映射,
  与路由组件核对同构

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* fix(design-system): DS-2a 路由组件核对按路径精确比对、CSS 统一剥注释

review 反馈修复(PR #3648 第九轮):
- routeComponents 升级为 routeEntryComponents(路径 → 入口组件映射):
  surface 级并集防不住多路由 surface 内部把 A 路径入口换成同集合内
  B 组件(如 /skillhub/local 从 SkillhubHomeView 换成
  SkillhubDetailView),逐路径精确比对后这类失配也会让 --check 失败
- CSS 文件同样剥块注释后统计:globals.css 注释里的示例色值
  (#ffffff/#f0fff4/#ffeef0 等 27 个)不再计入权威基线,主窗口
  裸色 92 → 65,三个独立窗口 91 → 64;stripJsComments 的块注释
  正则对 CSS 直接适用(CSS 无 // 行注释,第二段替换无害)

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* fix(design-system): DS-2a 主窗口补全局浮层、设置页补 sortable.css、view 分支核对渲染组件

review 反馈修复(PR #3648 第十轮):
- 主窗口壳补 MainLayout 直接挂载的四个全局浮层:
  GhostMediaLightboxHost / UpdateNoticeDialog /
  FeishuConflictDialogHost / SessionShareImportWizard 入可达
  组件与样式根,触发更新提示/飞书冲突/媒体预览/导入向导时的
  样式事实不再遗漏
- 设置页补 sortable.css:providers tab 拖拽行
  (provider-settings-sortable-row)的背景/圆角/阴影/动效规则
  定义在该文件(main-entry.tsx 无条件导入)
- view 分支守卫升级为「view → 渲染组件」映射:viewEntryComponents
  逐项比对,view 名保留但分支改渲染别的组件(换浮窗实现)时
  --check 失败——与路由组件核对、模块图入口核对同构

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* fix(design-system): DS-2a 主窗口壳与右侧栏窗口纳入 RightSidebarShell 实现目录

review 反馈修复(PR #3648 第十一轮,P1):
- RightSidebar.tsx:26,263 与 SidebarWindowLayout.tsx:31 都渲染
  features/right-sidebar/RightSidebarShell,该目录含 TabBar、下拉、
  插件体与 FileBrowserBody.css;desktop.shell.main-layout 与
  desktop.window.sidebar 此前都只扫 wrapper/layout 目录
- 主窗口壳统计 121/65/103 → 144/72/282,右侧栏独立窗口同步上调

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* fix(design-system): DS-2a 语音浮窗纳入 globals.css 与 VoiceInputStatusNotice

review 反馈修复(PR #3648 第十二轮):
- main-entry.tsx 无条件加载 globals.css,其中 data-voice-input-overlay
  透明根节点规则是该浮窗专用;VoiceInputOverlay.tsx:1521 直接渲染
  VoiceInputStatusNotice(状态提示条)。两者均未入册
- desktop.window.voice-overlay 统计 8/2/10 → 67/64/25

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* fix(design-system): DS-2a 台账排序改码点序,修复 Windows CI 假红

第十二轮 push 后 Windows CI 确定性失败在「CLI --check 在当前台账上
通过」:GENERATED 区块与源码不同步。根因是排序比较器用的
localeCompare——ICU 版本在 Windows/Linux/macOS 间对连字符等标点的
排序权重不一致(同机器实测 en collation 把 a-b 排在 ab 前、码点序
相反),styleSources 等列表在不同平台渲染出不同字节序。

全部比较器换成确定性码点序(< / >),任何 Node 上逐字节稳定;
台账按新序重新生成(16 行重排);新增用例钉死连字符路径的码点序
与跨平台一致性。

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* fix(design-system): DS-2a --check 失败时输出首个差异行

CI 上「GENERATED 区块与源码不同步」只有一句提示,看不到差异本体,
跨平台排查(ICU/EOL/大小写)无从下手。失败时对比文件与重算结果的
逐行差异并打印首个分歧行(两侧各截 160 字符)。

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* fix(design-system): DS-2a --check 分歧输出升级为逐 surface 统计对比

首个差异行被长 styleSources 列表淹没且 160 字符截断切掉了统计数字。
改为逐 surface 对比主表行,打印每个分歧 surface 的 tokens/colors/radii
与来源文件数两侧对照——统计数字或文件集的分歧一眼可见。

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* fix(design-system): DS-2a --check 诊断升级为逐文件圆角计数表

CI 与本地在 desktop.settings 的 radii 上稳定差 2(CI 重算 701 vs
台账 703,文件数/tokens/colors 全一致)。逐 surface 统计仍不足以
定位——升级为打印分歧 surface 的逐文件圆角计数表(CI 日志与本地
表逐行对比即可锁定分歧文件)。

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* fix(design-system): DS-2a 裸圆角匹配改为每次调用全新正则

CI 上 desktop.settings 重算比台账少 2 个圆角匹配,逐文件表锁定唯一
分歧文件 PiPackagesSection.tsx(本地 11 vs CI 9,文件数/Token/裸色
全一致,git blob 两轮 CI 间逐字节相同且该文件未在本 PR 改动)。

排查已排除:ICU/localeCompare、EOL/CRLF、Node 版本(CI 同款
v22.23.2 本地全绿)、大小写文件系统、LFS/符号链接/NFC-NFD、
共享正则 lastIndex(String.match 带 /g 前后均复位,实测验证)。

防御性修复:BARE_RADIUS_RE 改为 createBareRadiusRe() 工厂,每次
调用返回全新 /g 正则,从机制上杜绝任何共享状态参与计数。若 CI
仍差 2,则唯一剩余解释是 CI runner 环境读到的文件内容与本仓 git
blob 不同,需人工在 Linux 机器上核对。

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* fix(design-system): DS-2a 逐文件诊断补文件内容 sha256

防御修复(每次调用全新正则)未改变 CI 计数(仍 701),排除共享
状态假设。逐文件表每行补文件内容 sha256 前 12 位:若 CI 读到的
文件与本仓 git blob 不同,哈希直接分叉;若哈希一致而计数不同,
则是引擎级异常。本地 PiPackagesSection.tsx = c5c90524b99e + 11。

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* docs(design-system): DS-2a 台账按合并 main 后的树重新生成

根因终于定位:pull_request 事件的 CI 检出的是 PR 分支与 main 的
merge ref,而 #3614(2026-08-30 23:42 UTC 合入 main)改了
PiPackagesSection/AddProviderWizard/ProvidersSection 三个设置页
文件(PiPackagesSection 少了 2 个 rounded class)。台账此前按
分支树生成(radii 703),CI 按合并树重算(701),--check 稳定
失败——哈希诊断证实 CI 读到的正是 main 的 blob。

修复:merge origin/main 进分支(本就该跟进基线),台账按合并树
重新生成(radii 703 → 701,与 CI 重算一致)。

Signed-off-by: Kirozeng <kirozeng@gmail.com>

* fix(design-system): DS-2a componentMismatch 报错拼接修复字符串 join TypeError

review P1(当前 head 复核成立):catalogComponents 被赋成
routeEntryComponents[path] 的值(字符串),CLI 失败路径的
row.catalogComponents.join(' / ') 会 TypeError,把真实的组件
不一致信息吞掉、CLI 以非预期方式退出。

修复:共享层统一成数组([].concat(value ?? [])),登记缺路径时
兜底空数组;新增回归测试钉住数组形态与报错文本可渲染,并保留
真实 CLI 路径的人工触发验证(本地 sabotage 实测报错行正常输出)。

Signed-off-by: Kirozeng <kirozeng@gmail.com>

---------

Signed-off-by: kirozeng <kirozeng@gmail.com>
Signed-off-by: Kirozeng <kirozeng@gmail.com>
2026-08-31 19:05:30 +08:00
DavidShen
9ef3de4866 test: 阻止 symlink 用例按平台硬跳过
Signed-off-by: DavidShen <david@xd.com>
2026-08-31 15:43:02 +08:00
DavidShen
a146eb5041 fix(dev): 修复 Windows 移动端调试与测试门禁
Signed-off-by: DavidShen <david@xd.com>
2026-08-31 14:54:34 +08:00
Chris Zhang
2d176b7fed fix(desktop): protect shared Codex OAuth credentials (#3651)
* fix(desktop): protect shared Codex OAuth credentials

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): close dev Codex auth read bypasses

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): retain dev Codex write policy after logout

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): restrict isolated auth to derived sandboxes

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): verify dev Codex recovery in memory

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): fingerprint late Codex invalidation locally

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(codex): trust only isolated auth write overrides

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(codex): trust-gate isolated auth cleanup

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(codex): bind isolated auth writes to launch proof

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: keep isolated auth proof out of profile freshness

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): show executable isolated auth command

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): reject aliased isolated auth profiles

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

---------

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
Co-authored-by: Chris <4436110+zqchris@users.noreply.github.com>
2026-08-31 07:13:32 +08:00
Dash
a25b6881d1 fix(grok): 防止 malformed tool call 重试风暴并增加 wire 诊断 (#3534)
* fix(grok): guard malformed tool calls and diagnose wire fidelity

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(grok): only trip contract guard on failed tool results

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(grok): count contract failures by tool-result batch

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(desktop): localize tool-loop guard errors

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(grok): redact diagnostic keys and localize loop counts

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(desktop): preserve tool-loop details through terminal done

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(mobile): localize tool-loop terminal errors

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(i18n): describe tool-loop interruption per turn

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(grok): localize live tool-loop error projections

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(desktop): keep persistence errors aligned with projection

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(grok): hide tool-loop details in IM errors

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(bridge): redact unrecognized diagnostic tool names

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(desktop): localize scheduler tool-loop errors

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(grok): localize Goal tool-loop errors

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(grok): preserve contract streak within result batches

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(grok): aggregate contract errors by result batch

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(grok): isolate legacy contract streak state

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(desktop): type structured tool-loop error payload

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(desktop): localize tool-loop terminal projections

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(desktop): keep renderer tool-loop parser browser-safe

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(desktop): localize learn tool-loop failures

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* test(desktop): cover learn tool-loop projection

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

---------

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
2026-08-29 22:58:00 +08:00
DavidShenXD
fd99c1ba73 fix(proxy): compact oversized vision history before forwarding (#3606)
* fix(proxy): compact oversized vision history before forwarding

Signed-off-by: david <david@xd.com>

* fix(proxy): compact oversized local requests safely

Signed-off-by: david <david@xd.com>

* docs(proxy): clarify vision compaction order

Signed-off-by: david <david@xd.com>

* fix(proxy): compact OpenAI Chat image history

Signed-off-by: david <david@xd.com>

---------

Signed-off-by: david <david@xd.com>
2026-08-29 20:21:28 +08:00
Dash
f1dd63ec52 feat(desktop): 使用系统浏览器登录态,并拆分链接打开方式 (#3596)
* feat(desktop): 使用系统浏览器登录态,并拆分链接打开方式

设置「自动操作」增加默认关闭的「使用我的浏览器登录态」:同意后把系统
Chrome / Edge / Brave 当前 profile 的 Cookies 与已存密码拷到独立的
Cindy-real,关掉开关即删除拷贝,隔离身份 Cindy 不动。链接打开拆成外部
网页与内部网页两套偏好。已有磁盘权限时不再弹完全磁盘访问引导;打开
Agent 专用浏览器不再因冷启动多开一个页签。

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(desktop): 登录态拷贝改为原子替换,关掉开关才落盘

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(desktop): 切换登录态前必须停掉托管浏览器

stop 失败或无法确认时不再 persist 开关,避免 POSIX 上 unlink 后仍被打开的 Cookie 句柄留着。
Main 改为静态引入 node:sqlite backup;config-dir 子路径刷新 runtime 根,避免 inbound media 冻在 ~/.xdt-maker。
userDataDirFor 按目标 OS 拼路径,修 Windows CI。

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(desktop): 隐式启动也先拷登录态,并确认浏览器已停

open/tabs 会绕过 /start 冷启动空 Cindy-real;同意使用登录态时
这些动作走同一扇快照门。停浏览器除 ok 外还要 data.stopped。
macOS 源探测补上 ~/Applications。

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(desktop): 快照清掉残留站点存储,并记住重定位后的 CDP 端口

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(desktop): 停浏览器时不热改托管身份,源探测对齐 Snap

Stop 前不再重建缺 executablePath 的 runtime 配置,避免 vendored
runtime 当成身份变化先杀进程再返回 stopped:false。
Linux 源探测对齐稳定版路径;Snap 二进制走对应 ~/snap profile。
隔离 Cindy 固定 18800,CDP 重定位只给同意拷登录态的 Cindy-real。

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(desktop): 迟到快照不再激活已撤销的登录态

快照完成后、启动前再读同意开关;已关则清快照并回到隔离 Cindy。
崩溃后 remembered 端口上的无 pid leftover 先停再拷;
无 marker 的 18800 占用仍只重定位。

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

---------

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
2026-08-29 18:33:02 +08:00
DavidShenXD
01e0780dfc feat(desktop): 新增数据库清理并优化大库执行体验 (#3477)
* feat(desktop): add database slimming maintenance

Signed-off-by: DavidShen <david@xd.com>

* fix(desktop): harden database cleanup workflow

Signed-off-by: DavidShen <david@xd.com>

* fix(desktop): harden database cleanup recovery

Signed-off-by: DavidShen <david@xd.com>

* fix(desktop): 收敛数据库清理反馈

Signed-off-by: DavidShen <david@xd.com>

* fix(desktop): 保留数据库清理恢复标记

Signed-off-by: DavidShen <david@xd.com>

* fix(desktop): 修复数据库清理索引与交互反馈

Signed-off-by: DavidShen <david@xd.com>

* fix(desktop): preserve database cleanup recovery markers

Signed-off-by: DavidShen <david@xd.com>

* fix(desktop): 保留数据库清理回滚标记

Signed-off-by: DavidShen <david@xd.com>

* fix(desktop): 保留数据库清理失败标记

Signed-off-by: DavidShen <david@xd.com>

* fix(desktop): 保留数据库清理调度请求

Signed-off-by: DavidShen <david@xd.com>

* fix(desktop): 加固数据库清理恢复状态

Signed-off-by: DavidShen <david@xd.com>

* fix(desktop): 加固数据库清理启动失败处理

Signed-off-by: DavidShen <david@xd.com>

* fix(desktop): 等待数据库清理进程确认退出

Signed-off-by: DavidShen <david@xd.com>

---------

Signed-off-by: DavidShen <david@xd.com>
2026-08-27 09:52:54 +08:00
DavidShen
3768fecc9b fix(mobile): harden environment switching failures
Signed-off-by: DavidShen <david@xd.com>
2026-08-26 17:55:25 +08:00
DavidShen
3dc650e034 fix(mobile): 保留 Android 构建失败诊断
Signed-off-by: DavidShen <david@xd.com>
2026-08-26 17:25:50 +08:00
DavidShen
cd8e162d7f fix(mobile): 避免构建错误日志泄露环境变量
Signed-off-by: DavidShen <david@xd.com>
2026-08-26 16:26:33 +08:00
DavidShen
991db9e306 fix(mobile): harden CindyDev server env bundling
Signed-off-by: DavidShen <david@xd.com>
2026-08-26 15:45:33 +08:00
MagicLizi
173df24fb6 feat: default desktop restart to stable dev sandbox
Signed-off-by: MagicLizi <jiali@magiclizi.com>
2026-08-26 12:48:12 +08:00
nanaco
33a1a8b259 feat(pi): 新增 Windows Git PATH 解析模块 (#2869)
* feat(pi): add Windows Git PATH resolution helpers

Signed-off-by: nanaco <823073145h@gmail.com>

* fix(pi): address Windows Git path review feedback

Signed-off-by: nanaco <823073145h@gmail.com>

* fix(pi): preserve Unicode Windows Git paths

Signed-off-by: nanaco <823073145h@gmail.com>

* fix(pi): bound Windows Git path probes

Signed-off-by: nanaco <823073145h@gmail.com>

* fix(pi): preserve partial Windows path probe results

Signed-off-by: nanaco <823073145h@gmail.com>

* fix(pi): 隔离 Windows 网络路径探测

Signed-off-by: nanaco <823073145h@gmail.com>

* fix(pi): 统一网络路径探测预算

Signed-off-by: nanaco <823073145h@gmail.com>

* fix(pi): 隔离多个 Windows 网络根探测

Signed-off-by: nana <823073145@qq.com>

* fix(pi): 隔离 Windows 路径候选探测

Signed-off-by: nana <823073145@qq.com>

* fix(pi): 统一 Git exec-path 探测预算

Signed-off-by: nana <823073145@qq.com>

* fix(pi): 禁止执行 PATH 候选程序

Signed-off-by: nana <823073145@qq.com>

* fix(pi): 复用 Windows 路径探测快照

Signed-off-by: nana <823073145@qq.com>

* fix(pi): 补齐 Windows 路径探测诊断覆盖

Signed-off-by: nana <823073145@qq.com>

* fix(pi): 限制 Windows 路径探测并发

Signed-off-by: nana <823073145@qq.com>

* fix(pi): 避免慢候选阻塞后续探测

Signed-off-by: nana <823073145@qq.com>

* fix(pi): 按安装根隔离 Windows 路径探测

Signed-off-by: nana <823073145@qq.com>

* test(pi): 增加 Windows 路径探测实测

Signed-off-by: nana <823073145@qq.com>

* fix(pi): 阻止 bin shim 自证安装根

Signed-off-by: nana <823073145@qq.com>

* fix(pi): 优先使用 PATH 选中的 Git 根

Signed-off-by: nana <823073145@qq.com>

* fix(pi): 清理超时的 PowerShell 探测树

Signed-off-by: nana <823073145@qq.com>

* fix(pi): 超时后清理 PowerShell 探测后代

Signed-off-by: nana <823073145@qq.com>

* chore(ci): 重跑偶发失败门禁

Signed-off-by: nana <823073145@qq.com>

* fix(pi): 收紧 Windows Git 路径探测

Signed-off-by: nana <823073145@qq.com>

* fix(pi): 为注册表根保留探测容量

Signed-off-by: nana <823073145@qq.com>

---------

Signed-off-by: nanaco <823073145h@gmail.com>
Signed-off-by: nana <823073145@qq.com>
Co-authored-by: nana <823073145@qq.com>
2026-08-26 11:41:31 +08:00
Junshan
fd03cf14a4 fix(test-runner): skip git-ignored tmp/ and tolerate unreadable dirs (#3373)
readAllFiles() recursively scans from the repo root using only a hardcoded
directory blacklist; it never consults .gitignore. tmp/ is git-ignored
(.gitignore:188, session tool scratch) but was not in the blacklist, so
the scan recursed into it. When tmp/ holds a directory the current
process cannot scandir (sandbox / tool leftovers on Windows throw EPERM),
fs.readdirSync escaped uncaught and crashed the root test gate during
file discovery, before any source-contract assertion ran.

Two changes:
- Add 'tmp' to IGNORED_PARTS so git-ignored scratch trees are skipped,
  matching .gitignore and keeping isIgnoredFile path-segment exact
  (legitimate 'tmp-adapter' package names stay scannable).
- Wrap readAllFiles' readdirSync in EPERM/EACCES/ENOENT tolerance and
  skip that subtree, so any future unreadable residual directory cannot
  take down the gate; tracked and non-ignored sources never live there.

Fixes #3353

Signed-off-by: yuaiccc <yuaiccc@aliaun.com>
Co-authored-by: yuaiccc <yuaiccc@aliaun.com>
2026-08-25 18:43:08 +08:00
Chris Zhang
3b8d01b86d feat(desktop): 重做 Subagent 紧凑任务与子对话详情 (#2574)
* feat(desktop): add compact Subagent transcript details

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* feat(pi): complete durable subagent workspace

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(pi): auto-approve durable subagent spawn

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(pi): harden Subagent approvals and runtime ownership

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(pi): close Subagent approval and result gaps

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* feat(desktop): rebuild Subagent detail as a session-style conversation

The detail view renders the durable transcript the way the main session
renders a turn: user bubbles for the assignment and steer/follow-up lines,
assistant prose per reply, one foldable card per tool call, runtime noise
folded into technical details. Tool frames are recorded as structured card
data instead of raw event JSON, control lines carry their action as a field
instead of a text prefix, and transcript pages expose a tail cursor so the
open conversation appends increments instead of re-reading the record.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): make the Subagent composer behave like the session's

Remove the delivery-mode picker, target line and hint rows: one box, one
send. The action is decided by run state — an interjection while running,
an automatic follow-up once the child has settled output, resume on a
finished run — and the state only shows through the placeholder wording.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): give the Subagent composer the session's Enter semantics

While the run is live, plain send queues a follow-up and the modifier send
(Cmd/Ctrl+Enter) interjects — the same split the main composer resolves
through resolveComposerEnterIntent. A settled reply still refuses late
steering and a finished run resumes; the running placeholder now names the
interjection shortcut.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* test(pi): assert snapshot identity, not exact shape, in SuperGrok retry tests

The upstream tests landed against a snapshot without the Subagent alias
route table; this branch persists modelRoutes in the same file. Assert the
rebuilt identity and the cleared pending flag — the behaviors under test —
instead of the exact field set.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): route Subagent stop and send tooltips through the managed Tip

The icon-button tooltip guard added upstream flags native titles in guarded
roots; wrap both icon controls the way the back button already is.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — detached approval lifecycle, account boundary, remote discovery

- The detached-run supervisor now owns approval consumption after the
  parent handle closes (same dedupe state, runner-owned mailbox), and also
  starts for sessions with no proxy lease, so an approval-gated tool in a
  detached child gets a deterministic answer instead of hanging.
- Teardown carries an explicit reason (navigation / account-boundary /
  app-quit, failing closed to account-boundary). Logout and account switch
  stop the owner's detached runners, skip the lease transfer so the proxy
  token is revoked immediately, and sweep the whole agent home for runners
  whose parent handle was already gone; a post-teardown process exit can no
  longer resurrect a supervisor for the outgoing owner.
- Subagent tab discovery for device-link tasks reads the data-owning device
  and polls coarsely until the one-shot registration lands; local discovery
  keeps the change push and also stops once registered.
- The completed-output-immutability test now waits on the same durable
  record it asserts, with a described timeout instead of a raced cap.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — approval parking, owner-scoped sweeps, eligibility window

- An approval whose surface is gone (no listener/resolver/route) is parked
  in the durable mailbox instead of being consumed as a deny: the request
  re-offers when a surface reattaches, in-flight cards settle as unanswered
  for durable Subagent approvals only, and explicit refusals keep their
  fail-closed deny. Regressions run the production Session teardown.
- Runtime owner ids now carry the host pid, so quit / account-boundary /
  update-relaunch sweeps and the quit-confirmation probe stop only this
  process's runs plus unattributable or dead-owner orphans, leaving a
  concurrent shared-userData instance's Subagents alone.
- Subagents tab availability treats unknown eligibility as provisional:
  the persisted projection survives the cold-load window and active-tab
  reconciliation waits until eligibility is actually known.
- The runner suite gets a Windows-shaped time budget and deterministic
  waits for receipts and queued directions instead of racing fixed sleeps.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — bound aborts, kill children before terminal publish

- The foreground abort path arms the same stop grace deadline the run
  timeout uses, so a wedged runner that never consumes the control file
  can no longer leave the parent turn polling forever; the give-up message
  distinguishes a failed cancellation from a run timeout.
- Publishing a terminal status is a handover, so both runner terminal
  paths now kill every owned process tree and disarm all timers before
  writing it; the exception path reports per-child outcomes instead of an
  opaque error. A lane that throws mid-launch also stops poisoning the
  scheduler queue, which previously kept the runner process alive behind a
  finished status; a process exit backstop SIGKILLs any stragglers.
- The runner suite's waitFor default window widens to 30s inside the 60s
  Windows-shaped budget.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — real stop-deadline teardown, control ownership, child spinner

- Giving up on a wedged runner now terminates it for real before the
  synthetic terminal status: the extension signals the ChildProcess it
  spawned (taskkill tree on Windows), escalates to SIGKILL after a bounded
  grace, and converges the durable record; the runner gained SIGTERM/SIGINT
  handlers that reap owned children and publish a terminal status, which is
  the only reachable path to its process-group-isolated children.
- Stop, steer and follow-up refuse a run owned by a different live Cindy
  instance sharing the agent home, with a readable error; orphaned and
  unattributable runs stay controllable so a crashed instance's work can
  still be stopped.
- A selected settled child no longer shows the aggregate run's waiting
  spinner.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — gate the detached stop fallback, render truncated-run results

- The detached stop fallback both Subagent stop buttons reach now applies
  the same ownership gate as the control handler: it discovers the run,
  refuses a different live instance's run with the same readable error
  before any control write, and lets that refusal pass through the stop
  handler's error mapping instead of being relabelled INTERNAL. Terminal
  runs skip the gate so an idempotent stop stays a no-op.
- The durable-result fallback keys on whether the transcript carries an
  actual assistant reply, not on whether any item exists, so a run at the
  transcript cap or with its reply beyond the paged window shows its tool
  cards and its finished result; a complete transcript still renders the
  reply exactly once, and the missing-reply notice keys on the same value.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — lock child self-exit, cross-process resume claim

- The wedged-runner SIGKILL residue the review names does not reproduce:
  every durable child's stdio is piped to the runner, and a real Pi binary
  exits on stdin EOF within a second of the runner dying. That property
  was load-bearing but untested, so a real-binary regression now locks it
  (flipping the spawn to stdio ignore fails it), and the stale-sweep skip
  documents why a stop control there has no consumer.
- Resuming a generation takes an O_EXCL claim file scoped to the source
  run dir: a live holder refuses with a readable error, a dead or
  unreadable holder is atomically renamed aside and taken over, no TTL,
  released once the new generation's status exists on disk, with a
  re-check under the claim; the in-process map stays for same-process
  serialisation. Concurrent resumes across simulated processes start
  exactly one runner.
- The two Windows-regressed runner cases dump raw durable status and
  runner stderr on timeout, separating never-published, rejected-record
  and gone-stale outcomes in the next CI run.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — roll the run-id window, gate the tab on Pi rows, skip unchanged writes

- providerRunIds now evict from the front instead of silently dropping
  every id after the 64 cap: the detail and transcript readers select a
  generation by membership (the transcript takes the last run-directory
  id), so the panel pinned itself to an old generation forever, and the
  absent current id re-fired the resume detector on every reconciliation
  tick, reopening the terminal row and discarding its result. Evicted ids
  stay resolvable through the append-only alias index.
- Subagent tab discovery registers only when a Pi run actually exists,
  matching the Main-side narrowing the remote path already has; non-Pi
  history no longer produces an empty Pi-only tab.
- Reconciliation keeps an owner-scoped fingerprint of the exact payload it
  would persist and skips the write when nothing changed, ending the ~2N
  SQLite updates per second a polled remote detail generated; a backfilled
  output changes the payload and still writes.
- Runner-suite hardening for Windows: every timeout now dumps each live
  fixture's raw durable status and runner stderr, the byte-identical
  runner script is written once per suite instead of per fixture, and the
  remaining sub-budget waits take the suite default.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — serialize reconciliation writes, single-flight the remote poll

- Reconciliation's projection writes now go through the same durable FIFO
  the agent event path uses, injected at the composition root so the
  storage layer does not import the broadcaster back; a first-seen run can
  no longer be inserted twice by the two writers racing the matching-row
  select. The diagnostics loop shares the same helper, and no third
  bypass exists.
- The remote detail poll is a chained timeout with an in-flight fence
  across list, detail and transcript reads: slow or failing device-link
  rounds stretch the cadence instead of stacking ~30s-timeout invokes,
  the opening read sits inside the fence, failures still re-arm, and
  unmount or owner switch cancels the chain. User controls never pass
  through this path.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — verified boundary kill, adopted approvals, recency-picked diagnostics

- An account-boundary stop that times out now escalates to a real kill:
  the runner records its own script path, the host verifies the live
  command line still names that path (ps on POSIX, CIM on Windows) and
  only then SIGKILLs the process group; anything unprovable is left
  alone. The runner header documents this as the one exception to the
  no-disk-pid rule, motivated by inherited BYOM credentials that, unlike
  the proxy token, cannot be revoked. Ordinary quit never escalates.
- A parked approval becomes reachable again when the parent task is
  reopened: the new handle adopts approvals for the same parent session
  when ownership is provably same-process or the owner is dead, and an
  adopted approval always prompts the user explicitly — above both the
  bypass fast-path and the Auto reviewer — so reopening under Full
  Access cannot launder an ask-mode child's permissions. Control writes
  carry the run's own owner id so the mailbox accepts adopted answers.
- Reconciliation picks health or diagnostics per task by generation
  recency, so a crashed latest resume is no longer masked by an older
  completed generation.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — confirm runner exit before claiming reclaim, retry Windows rename races

taskkill reports failure through its exit status, so the account-boundary
kill now judges success by re-verifying runner identity until it disappears
(covers zombies, recycled pids, and dead Windows pids with one predicate),
and the extension/runner taskkill sites escalate to their own handles when
it fails. Status-file replaces retry briefly on Windows sharing violations
(EPERM/EACCES/EBUSY) instead of crashing the runner from a flush timer.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — retry terminal status, single-flight remote discovery, honest guide

The terminal status write no longer funnels into scheduleStatus's terminal
early-return (its own bounded retry budget, since status.json is the only
record the product reads back), the task-level remote Subagent discovery
poll chains on settle instead of stacking setInterval reads against a slow
device, the guide stops claiming a resume action the management whitelist
never accepted, the PR-added AgentTaskCard buttons use the pill radius, and
the runner suite tolerates commands.jsonl not existing yet on slow spawns.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — publish resume claims whole, count unreadable runs as unreclaimed

The resume claim now lands via hard link (O_EXCL with its payload already
complete) with a bounded re-read before a dead-holder takeover, so a racer
can no longer steal a claim it caught mid-write; the account-boundary kill
pass derives its work set from the same run-directory universe as the stop
pass, so a run whose status is missing, corrupt or oversized keeps the
boundary from reporting itself clean instead of silently escaping the
escalation.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* test: make the mid-flight kill premise a fact and budget the 513-control backlog

Gate the finishing child on both pids being on disk so the poisoned lane
cannot fire before its sibling process exists, give the control-backlog
waits a throughput budget instead of the per-event default, and assert the
concurrent-resume race on the mutual-exclusion invariant instead of on
which racer wins (the symlink-alias winner always dies on the textual
session-containment check, so 'exactly one fulfilled' was a coin flip).

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — escalate quit sweep like the account boundary, detach terminal status from the result artifact

App quit now runs the same identity-verified kill as an account boundary
(shorter stop wait to fit the async phase budget, honest error when a
runner survives), and the runner's result.json write is a best-effort
artifact that can no longer flip a completed run to failed or block the
authoritative terminal status publish; status only advertises resultPath
once the artifact actually landed.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — verify the owner instance, not just its pid

The runtime owner id now records the minting process's start second
(<pid>.<startSec>:<scope>, opaque and equality-compared as before for the
runner and extension), and owner liveness for sweeps, control ownership
and resume claims compares that start time against the live process — a
recycled pid no longer disguises a crashed instance's orphan as another
live Cindy. Legacy ids and unreadable probes stay conservatively alive.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — abort the account handover and the update relaunch when runners cannot be reclaimed

An account boundary that cannot confirm this runtime's durable runners
stopped now throws instead of continuing into resetMaker and the owner
switch, and an update relaunch reclaims them behind a bounded gate before
the updater is spawned (once the script is running it SIGKILLs us after
120s, so refusing later is not a real outcome) and cancels the relaunch
when reclaim is unconfirmed. Owner ids only stamp a start time for the
minting process itself — ids minted for another pid fall back to the
legacy conservative shape, which is also what made the owner-identity
tests deterministic off the real process tree.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — verify runner identity behind an expired heartbeat, deflake the relaunch and Windows suites

An expired heartbeat with a live pid now re-verifies the runner's identity
(memoized, never probed while the heartbeat is fresh) so a recycled pid
cannot resurrect a crashed run or deadlock the account-boundary sweep.
executeRelaunch no longer rejects — its whole body reports through
handleApplyFailure, which also removes the unhandled rejection that failed
the desktop suites. Source-reading static tests normalize CRLF, the resume
containment check drops a textual prefix test that the canonical
realpath/parent-chain block strictly supersedes (it rejected legitimate
symlink/8.3 roots while not catching symlink escapes itself), and the
receipt-bound wait counts only real receipt files.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — nothing to reclaim is a reclaim, localize synthesized system lines

killVerifiedPiSubagentRunner now classifies the recorded pid (gone /
running / unverifiable) instead of collapsing every unverifiable state
into failure, so a runner that exited on its own — or whose pid was
recycled — no longer cancels an account switch or update, and the exit
confirmation demands a positive gone. Host-synthesized system transcript
lines carry a structured systemEvent kind next to the legacy English
content, and the renderer localizes from the kind with a content fallback
for old records and unknown slugs; the Windows receipt-bound wait gets a
throughput-derived budget (measured 4/s on the CI runner).

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — reclaim runners in parallel within the quit budget, hold the relaunch until the agent home is stable

The kill escalation probes identities through async execFile (1s timeout —
an unanswered probe cannot rescue a quit budget and already reads as
unverifiable) and runs per-runner reclaims concurrently under a caller
supplied budget, so a few wedged runners no longer overrun the 6s quit
phase serially. An update relaunch now re-scans after each reclaim pass
and only spawns the updater once a pass succeeded and a fresh scan finds
nothing active (bounded rounds, cancel otherwise), closing the window
where a runner launched mid-reclaim survived the restart. The runner
prunes control receipts by an in-memory count with a periodic TTL sweep
instead of walking the directory every poll cycle (the O(receipts) walk
per ack is what decayed Windows CI from 4 acks/s to under 0.5), and the
durable-result test awaits the transcript instead of racing it.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — fence Subagent launches through a relaunch, model projections per task, re-probe owners across sweeps

An update relaunch now raises a cross-process launch fence in the shared
runs directory before its first reclaim pass and holds it to exit (the
extension refuses durable spawns for a live fencing host, host-side resume
refuses too; a fence from a dead or foreign host never blocks anyone, and
startup clears stale ones), so the spawn window is closed rather than
narrowed. Reconcile fingerprints for the healthy and diagnostic
projections of one task invalidate each other, so a transiently unreadable
terminal status can no longer pin the row on the diagnostic failure. Owner
start-time probes memoize per sweep pass instead of globally for 10s — a
pid recycled between sweeps is re-probed and read as the orphan it is —
and the Windows receipt wait is calibrated to the now-linear measured
throughput.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — publish intent before reading the fence, three-state staleness, durable authority over diagnostics

The launcher (and host-side resume) now writes the run directory with a
queued status before reading the launch fence, which makes the fence
check-then-spawn race impossible without a lock: the host writes the
fence before its stability scans, so whichever side loses the ordering is
seen by the other. Staleness classification keeps gone/running/
unverifiable apart — an unreadable command line no longer reads as an
exited runner, so sweeps cannot report a false reclaim or delete live
metadata. A PI durable status is the authority for its task row: it
replaces a diagnostic's failed state and rebuilds capabilities instead of
being absorbed by them (the earlier regression asserted at the mock layer;
it now asserts the database row).

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — one launch fence per host, resume masked while the parent is not loaded

Fence ownership is now the file name (.launch-fence-<pid>.json): no
instance can overwrite or cancel-delete another's fence out of the shared
agent home, the readers consult their own host's file plus the legacy
shared name for the upgrade window, and stale cleanup only collects fences
whose owner is gone. The durable projection stops advertising resume for a
finished run whose parent task is not loaded as a live PI session — masked
in the detail/list responses through a predicate injected at the
composition root, never in the stored row, so the capability returns by
itself once the task is opened.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — supervision ends at Pi's exit, resume trusts only the directory set, fences carry a start identity

The detached supervisor no longer concludes anything from a scan that
started while the Pi process was alive: an empty run directory only
releases the proxy lease and approval supervision once a scan sampled
after Pi's exit confirms it (close stays as fast as before — the lease is
held at most one extra poll tick). The resume claim's critical section
enumerates run directories and diagnostics instead of the parseable list,
so a briefly unreadable newest generation conservatively refuses the
resume rather than letting a second runner share the PI session
directories. Launch fences record the raising host's start second, so a
fence inherited across a crash by a recycled pid is ignored and swept
instead of refusing that instance's launches for life; the Windows-only
receipts case is skipped with four rounds of calibration data in place of
a budget that cannot be met.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — raise the launch fence before the quit sweep

The quit disposer runs concurrently with shutdown-maker, so a parent Pi
process could enter launchDurableRun while the sweep walked an empty
directory and publish its detached runner just after it finished. The
sweep now raises the same per-host launch fence the update relaunch uses
before scanning — the publish-before-check ordering on the launcher side
makes the two conclusive together, with no serialisation of the maker
shutdown — releases it on the way out so a cancelled quit cannot wedge
this instance, and proceeds unfenced (logged) if the fence cannot be
raised. The account boundary needs no fence: its sweep only starts after
maker.shutdown has awaited every Pi process's exit.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — hold the quit fence through parent shutdown, reclaim conclusively after it

The quit sweep no longer releases the launch fence when it returns —
shutdown-maker runs concurrently, so the parent Pi processes can still be
alive at that point and a launch in the release window had no later sweep
to collect it. The fence is now held across the async phase and released
by a new post-async final sweep, which runs once shutdown-maker has
finished (every Pi process closed) and is therefore conclusive in the
ordinary case; an async-phase timeout leaves the fence itself as the
cover. Watchdog kills leave the fence to the next instance's stale sweep,
which the recorded start identity keeps safe across pid reuse.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — lower the quit fence only once parent shutdown has settled

The post-async final sweep no longer releases the launch fence
unconditionally: shutdown-maker's disposer records fulfilment (and only
fulfilment — a rejection can predate maker.shutdown entirely, meaning
every parent Pi is still alive), and the sweep lowers the fence only on
that proof. When the async phase timed out with shutdown-maker still in
flight, the sweep still reclaims best-effort but the fence stands until
process exit, with the next instance's start-identity-checked stale sweep
collecting the leftover file.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — raise the boundary fence before any await, judge teardown by the directory, project vanished runs

The account-boundary fence is set before close() awaits the resume tail,
so a Pi process exiting in that window can no longer restart the outgoing
owner's detached supervisor. A run dropping out of the parseable list no
longer tears down its approval dedupe state on that evidence alone — the
directory set decides: still on disk and not provably dead is unknown and
held, while a vanished directory or a stale diagnosis clears state, and
the stale case now projects the same diagnostic the durable reconciler
writes through the same update channel so the sidebar's row settles
instead of reading running forever.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — fence the account boundary, poll unfinished local runs, lock queued-orphan release behavior

The account teardown raises the per-host launch fence before
maker.shutdown (which swallows per-session detach failures, so a
surviving parent could publish a run after the one-shot sweep) and lowers
it on both the completed and the aborted path — the boundary swaps owners
inside a live process, so a standing fence would lock the incoming owner
out. The local Subagents panel gains a slow chained fallback poll while
any run is unfinished, covering completions that land after the root Pi's
exit ended the push channel (the list read reconciles on the Host side).
The queued-orphan claim was verified rather than patched: a pre-spawn
death goes stale at the heartbeat and the supervisor releases within
seconds, now locked in by paired regressions.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — supervisor re-checks the boundary fence, shutdown reports what it could not detach, fence failure aborts the handover

The detached supervisor re-reads the account-boundary fence every round
and leaves through its normal release path, so a supervisor started by a
crash no longer answers the outgoing account's approvals after a switch.
Maker.shutdown returns an additive report of per-session detach failures;
the account boundary treats a PI failure as an unverified reclaim and
aborts the handover (the quit path's settled flag now requires a clean PI
report too), and a launch fence that cannot be raised aborts the boundary
outright instead of degrading — the acquire moved inside the suppression
try so the new throw cannot leak the turn-ended suppression counter.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — barrier the boundary close on in-flight supervision, read the transcript across generations

An account-boundary close now waits (bounded, 2s) for the detached
supervisor to observe the fence and for every dispatched approval to
settle before returning — the barrier converges the common case while the
shutdown report and sweep verdict remain the safety authority for what it
cannot. The transcript reader walks every durable generation oldest-first
behind the unchanged page protocol: the cursor already named its
generation, a finished generation's EOF steps seamlessly into the next,
the tail cursor keeps pointing at the newest generation, an unreadable
middle generation becomes a localized marker instead of a hole, and a
follow-up no longer erases the conversation that came before it.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — gate approval dispatch at the boundary, drain the barrier instead of sampling it

Approvals now pass an account-boundary check at the single dispatch door
and again immediately before the mailbox write (the auto-review path never
touches the approval surface, so the write-side check is the only thing
between a boundary and its allow), which means no new dispatch can start
once the fence is up; the close barrier then drains the in-flight set in
rounds under one shared 2s budget instead of settling a single snapshot
that a scan returning after the fence could sidestep. Not answering is
parking, not denial — the request stays durable for the next owner.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — poll refreshes the transcript too, remote link safety reaches every Pi bubble, fence leases compose

The local fallback poll bumps the transcript refresh alongside the detail
one, so a conversation whose push channel died with the root Pi keeps
streaming late tool frames and no stale assistant snapshot suppresses the
resumed generation's result. The device-link boundary flag now travels
through the Pi conversation and both fallbacks into every markdown and
chip renderer (defaults unchanged for every existing caller), matching
the legacy detail's policy. Launch-fence acquisitions are re-entrant per
host: an in-process holder count keeps the fence up until the last
overlapping boundary is done, and a leaseId in the payload makes each
release conditional on still owning the file — with the stale sweep
unchanged as the cross-process backstop.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address review — an unreadable fence fails closed, a resumed child keeps its whole conversation

Fence reads now separate ENOENT from every other failure: an owned fence
that exists but cannot be read or parsed blocks spawn and resume while
its host is alive (a sharing conflict is exactly the moment the file
matters), the stale sweep refuses to remove a fence it could not read,
and only content that is readable-but-unparseable — which atomic writes
never publish — is still collected. Child conversations group across
generations by the PI session a resume deliberately keeps: the detail
projection attaches each child's earlier-generation ids as additive
aliases and the renderer filters by the set, so a resumed child shows its
original assignment, replies and tool calls instead of only the newest
generation.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): 删除父任务清理前先证明 launcher 已停止

删除父任务的 Pi Subagent 清理与父会话关闭原本互不排序:conclusive
空目录扫描可能在父 Pi 进程仍存活时完成,launch 在扫描后进入、重建
run root 并 spawn detached runner,而清理已返回成功并丢弃重试定时器。

每次清理尝试前经 maker 确认父会话不存活:存活则幂等补关(closeSession
有 15s 上限,超时按未证死处理走既有退避),close resolve 后复查——close
失败留在 error 态仍读作存活,复查天然保守。launcher 只活在父 Pi 进程
内,证死后不可能有新 launch;死前已发布 intent 的 run 会被扫描看到并
走停控路径。不用 host 级 launch fence:那会把无关会话的 launch 一并拦住。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop,maker-core): 账户边界审批写前复验、resumed 选中解析与删除清理 kill 升级

三条同族「持久子会话生命周期/身份边界/删除清理」修复:

1. turn-change-capture 审批分支在 beforeKnownFileWrite 长 await 之后、
   向 child mailbox 写 confirmed 之前,补与普通审批路径同构的账户边界
   栅栏复查;栅栏活跃时停放非拒绝(不写 confirmed 也不写 deny,请求留
   在 durable mailbox 等下一个 owner)。

2. DetailView 选中解析升级为「id 或 identityAliases 命中」,resume 换
   新 childId 后旧选择仍解析到同一 child;解析不到时回落到与无选择同
   构的语义,单 child resumed 不再因 lookup undefined 露全量 transcript。

3. stopAndRemovePiSubagentRuns 委托 quit/账户边界同一条 sweep 升级路径
   (killUnresponsiveRunners):stop 投递后 grace(6s=30 个 mailbox 消费
   周期)仍不消费 → 经已验证 runner identity 有界 kill;unverifiable 仍
   返回 false 拒删 metadata。删除清理不再对不消费 mailbox 的 runner 无
   限重投同一条 stop。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop,maker-core): fence acquire 首个 await 前预留 holder;durable result 按当前代判定

1. acquirePiSubagentLaunchFence 把「读 existing → 复用/新铸 leaseId →
   登记 holder」压进首次 await 之前的同一同步段:update/账户交接/quit
   近同时 acquire 时,旧时序双方都读到空 Map、各铸 lease、后写覆盖先写,
   短边界释放即删仍被另一边界持有的 fence。Node 单线程保证同步段串行,
   第二方必然看到预留并 join 同一 lease。写盘失败在 rethrow 前撤销本次
   预留(只回收自己那一次递增),失败的 acquire 不钉死 fence。释放路径
   与三个持有点签名不变。

2. DetailView 的 assistant 存在性判定收窄到当前代:transcript 现在永久
   聚合旧代记录,旧代回复会稳态满足全局 some,把最新代(截断/损坏/缺页)
   的 durable result 永久压掉。改在 transcript entries 层按当前代
   childId 判定(entry.role === 'subagent' 与 items 投影判据逐字等价);
   无 childId 条目按当前代计,与别名聚合出现前行为一致。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(maker-core): 审批 mailbox 写与账户 teardown 原子排他;fence 失败回滚清盘

1. controlPiSubagentRuns 两阶段化并新增写前门:beforeMailboxWrite 在
   helper 全部内部 await 之后、每个 run 落盘之前即时复查,false 则跳过
   该 run 且不计 delivered;onMailboxWritesSettled 在全部写 settle 后、
   收据等待之前发出。两个审批发布点统一走 publishPiSubagentApproval:
   写阶段登记进独立集合(只等纯 fs 写,不等 runner 收据,teardown 不被
   受体等待拖住),账户边界 teardown 在 stop sweep 之前排空该集合——
   写前门保证「没到写的不再写」,pre-sweep 排空保证「已过门的写在
   sweep 前落完」。排空与既有收敛屏障共享同一 2s 预算,teardown 最坏
   延迟不变。其它 action(stop/steer)不传回调,行为逐字不变。

2. dropReservation 删除最后一个 Map 项时按 lease 所有权清理磁盘 fence:
   A 建盘→B 预留→A release→B 写盘失败的序列不再留下「标着存活 PID、
   无人持有」的孤儿 fence(stale 清理只清死 owner,它会把 durable 启动
   堵到进程退出)。盘侧删除逻辑抽 removeOwnedLaunchFenceFile 与 release
   闭包共用,杜绝语义漂移;holders>1 递减路径不碰磁盘。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(maker-core): fence 文件盘面操作 per-file 串行化

release/dropReservation 的「读所有权 → 异步 rm」不可分割性此前不成立:
读到自己的 lease 后 rm 悬在事件循环里,新 boundary 的 acquire 已原子
发布替换文件,旧 rm 把新 fence 删掉——新 holder 计着数却无文件在盘,
extension 读不到 fence 即可 spawn。POSIX 无「内容匹配才删」原语,
rename-out-check-back 有回放竞态,故把该 fence 文件的全部盘面 I/O
(acquire 的 mkdir+原子写、release 与 dropReservation 的读+删)挂进
模块级 per-file 操作链。同步 Map 预留语义不动(仍在首次 await 前);
前环错误不毒化后环、只归属自己那环的调用者;链尾按 identity 清 Map。
clearStale(够不到本进程发布的文件)与纯读者(串行化保证终态,零
holder 窗口语义本就存在)有意不入链,理由在 doc。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(maker-core): stale fence 清理入串行链;fence 删除瞬时错误有界重试

1. clearStalePiSubagentLaunchFence 每个文件的「读→判 stale→删」整段进
   该路径的 launchFenceDiskChain,裁决在链内重读(入链前只做候选筛选)。
   上一批「够不到本进程文件」的结论被 PID 复用证伪:OS 把旧 host 的
   pid 发回本进程时,启动期 fire-and-forget 清理读到旧化身留在本 pid
   路径上的 stale fence,其 rm 悬着,期间 quit/账户边界经链在同一路径
   发布新 fence,旧 rm 最后执行删掉新 fence。链按路径 key,多文件扫描
   仍并发。

2. fence 删除抽单一入口 removeLaunchFenceFile,release/dropReservation/
   clearStale(含 malformed 分支)共用:EPERM/EACCES/EBUSY 有界重试
   (10 次,25ms 递增 100ms 封顶,总预算 <1s;Windows AV/持锁通常亚秒
   级,节奏对齐 runner 侧 rename 重试)。ENOENT 即成功;永久错误不重
   试;重试耗尽保持吞,残余(标着存活 PID 的无主 fence)自愈于下一次
   同路径 acquire 重写+其 release 删除,已文档化并用例固化。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): Harness 切换后按 durable runs 保留 Subagents 入口

Subagents 入口可见性与发现此前硬绑父任务当前 agentKind==='pi':Pi 父
任务启动 detached run 后切到 Claude Code/Codex,run 继续跑(停止路径
早已为此保留),但侧栏 tab 立即被隐藏、发现 effect 早退不再注册——
运行中的 detached runner 失去监控与按 child 停止入口。

判据改为「Harness 是 pi 或该任务存在 durable Pi runs」:发现 effect
去掉 agentKind 早退(discovery 按盘上实际 runs 决定,无 runs 的非 pi
任务只多付一次 list 与按会话过滤的订阅,不注册任何 tab);presence 经
onPresenceChange 按 sessionId 记名提升为组件状态,availability 用
agentKind==='pi' || present 声明。presence 消费者在场时本地订阅活过
注册以看见下降沿(清理完成后入口回落,不留死 tab);远端 poll 仍在注
册后停止(5s device-link 轮询不为下降沿常驻,面板自有轮询接手)。
不为 Claude Code/Codex 新增任何入口。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(maker-core): 直接 Pi bridge 的放行出口补账户边界复验

live Pi 会话的 extension UI bridge 两处放行出口在长 await 之后不复查
账户边界:turn-change-capture 的 finally 无条件 proc.send confirmed
(快照 await 与文件大小成正比,切号/登出可整个发生在其间);permission
决议在等人身上更久。与批 37/39 修过的 durable mailbox 路径同族,
不同出口。

修复:getPermissionCtx 新增 isAccountBoundaryTornDown 函数字段(必须
是函数不是布尔——两个分支都在 await 前取过 ctx 快照,传值就是旧竞态
的复刻);capture 的 finally 与 permission 的唯一出口
sendPermissionResolution 开头各设闸,边界后停放非拒绝——不发
confirmed 也不发 deny(回 false 会向模型伪造用户从未做出的拒绝;
teardown 正在关闭该进程,悬着的请求随进程终止消失)。闸门只认账户
边界,普通 navigation close/切 Harness 不触发,不静音正常关闭路径。
包管理 mutate 成功回执的边界窗口(副作用在发送前已发生、且为
configHome 本地操作非工作区写)在审计中标注为独立议题未动。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): quit fence 创建失败改 fail-closed 收敛

quit 路径是唯一对 fence 立不起仍 warn-and-continue 的边界(账户边界
已是中止交接):acquire 失败后互斥论证不成立,shutdown 超时/detach
失败时幸存父 Pi 可在扫描后发布带继承凭证的 runner,且终扫 else 分支
误称「holding the fence」——从未立起来过。

修复:1) quitLaunchFenceRaised 显式跟踪 fence 是否真的立起(与「已
释放」区分);2) 终扫在扫描前重试 acquire,成功即恢复 fence→扫描排
序,无 fence 窗口收敛回 async 相位;3) 两次都立不起且父未证死时进入
有界复扫循环(2.5s 预算/400ms 间隔/每轮更紧的 300ms+700ms 预算,
makerShutdownSettled 翻真立即退出),把幸存者的发布窗口从「最后一次
扫描之后的全部时间」压成两轮扫描间隙;4) 终扫尾部三分支按真实状态
说话,无 fence 且父未证死时如实陈述暴露面。正常路径的两相扫描、预
算、门与释放时机一字未动。残余:两次 fence 失败×shutdown 挂死×轮
间隙命中仍是敞口,彻底封口需对登记的 pi 根进程做启动时间身份化强杀,
作为独立议题留档。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): 账户交接中止后按持有状态恢复 Maker

交接因 sweep/detach 失败中止时,boundary error 直接 rethrow 跳过
resetMaker——Maker.shutdown 入口已置 shutdownStarted 且不回退,用户
留在旧账户却再也开不了新任务,直到重启。

修复按「shutdown 是否执行 × 是否仍持有会话」区分:sweep 失败的幸存
者是已 detach 的 runner,所有权在 durable 文件/pid/runtimeOwnerId 上
不挂实例,reset 恢复旧账户可用且重试登出会重新全量 sweep;detach 失
败的会话被 Maker 有意保留在 activeSessions(status=error,下一次
shutdown 重试 detach),此时实例是幸存 PI 进程唯一监督面,reset 会造
成永久孤儿——保持毒化是较小的害,重试登出仍可走通。fence 立不起的
pre-shutdown 抛出不触 reset(Maker 未毒化)。quit(进程将消失)与
update relaunch(失败即取消、不调 shutdown)审计无同病。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): 全量失效触发 presence 重读;远端注册后保留低频存在性探测

1. /clear 或 rewind 到 Subagent 启动前时 Main 广播 runId:null 的整会
   话失效,view 侧 discovery 订阅自写的过滤器把它丢弃,presence 保持
   旧值,切到其它 Harness 后空 Subagents 页签常驻。改为复用面板侧既
   有共享谓词 isCurrentSubagentRunsChange(它本就接受 runId:null),
   消掉两份过滤漂移;payload 的 sessionId 恒为真实 id,作用域不变。

2. 远端 device-link 注册后唯一的 poll 永久停止且面板轮询不回写,远端
   /clear、rewind、删除清理或切非 Pi harness 后 presence 永真。presence
   消费者在场时远端 poll 注册后降频为 REMOTE_SUBAGENT_PRESENCE_POLL_MS
   (20s,发现的 4 倍慢——发现决定页签是否出现、用户在等;存在性只决
   定失效页签何时消失、无人在等),持续覆盖下降沿;这也是远端整会话
   失效的唯一传播通路(控制端收不到本地 change push)。未传 presence
   回调时行为逐字不变,dispose 路径不变。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* test(desktop): 对账 orcaWorkflowRoute 源级断言与 Subagents 入口新判据

upstream/main 在合并基之后给 orcaWorkflowRoute.test.ts 新增了源级断
言,期待旧的单行 subagentsAvailable={session ? agentKind==='pi' :
undefined};本 PR 已有意把该表达式改为带 durable runs 回落的多行形态
(Harness 切换后按 runs 保留入口)。git 合并无文本冲突但语义相撞,
CI 在 Linux/Windows (2/2) 双红。按本 PR 的有意改动更新断言字面量,
不变量意图(路由布局声明里传 subagentsAvailable)不变,属性与表达式
分别钉住。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop,maker-core): runner 消费 stop 优先;账户边界 fence 前移到破坏性清理之前

1. runner 控制邮箱同批消费按写入顺序执行,账户边界排空有意等在途审
   批写完再追加 stop——runner 先消费 confirmed:true,在停止前执行掉
   待审批的文件写/命令。host 无法控制在途写的完成顺序,fail-closed
   落在消费侧:pollControl 排序后按 stop 稳定分区(stop 组先行,两组
   各保原序),applyControl 既有的 stopRequested guard 让同批其余
   approval/steer/follow_up 全部作废;跨轮场景既有 guard 本就覆盖。
   scoped stop 只作废该 child,兄弟不受影响。

2. 账户边界的 launch fence 原在停 IM/scheduler/embedding/Ghost、清
   provider 目录等破坏性步骤之后获取,失败中止时用户留在半拆除的旧
   账户直到重启。fence 前移到函数体第一步,失败即中止且尚无任何破坏;
   外层 try/finally 保证含中止在内每条路径都释放。持有窗口扩到整个
   teardown 是预期收紧——边界期间本就该拒绝 durable 启动。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): reconcile fingerprint 只在真实写入后落 memo

persistSubagentTaskUpdate 的全部 null 出口都在触库之前(最关键的是
「parent tool_use 尚不可见」——快速终态 run 常规命中:child 先于
parent 的 durable 写离开 FIFO),非 null 恒等于真写。此前被拒的投影
仍被记 fingerprint:终态状态不再变化,后续每次 reconciliation 都因
memo 命中跳过,Subagent 在侧栏永不出现直到进程级 cache 驱逐。

修复:enqueueProjectionWrite 返回 null 时既不 set fingerprint 也不清
counterpart memo(没写行就无从分歧),下一次读取自动重试,顺序窗口
自愈;抛错路径本就在 set 之前,现状已正确。healthy↔diagnostic 互失
效只在真写后发生,与新门正交。顺带修正两条既有用例的失真(mock 默认
返回 null 在新语义下会让它们失去判别力,改为返回真实结果)。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): durable result 按尾部完整性抑制;交接中止后打明确阻断标记

1. 同一代 child 经 Follow-up 有多次回复,runner 每次 message_end 覆盖
   task.output(durable result 恒为最新),而 transcript 截断永远丢尾
   (runner 触 50MB 上限即停止追加并写 transcript-truncated 标记)、
   分页头向尾且有页界。「当前代存在 assistant 条目」不等于「最新回复
   在屏上」。抑制条件加尾部完整判据:transcriptCursor 为 null 且当前
   代无截断标记时才凭 assistant 在场抑制 fallback;尾部不完整时始终
   展示 durable result——重复看到最新答案远小于看不到它。尾部完整时
   与原条件逐字等价。

2. 账户交接在破坏性 teardown 之后中止时(sweep/detach 失败),provider
   目录已清、IM/scheduler/embedding/Ghost/Learn 已停而无人重建。六项
   中仅三项有幂等可达的建构入口,provider 目录(决定 agent 路由)的
   重建挂在启动闭包的 readiness arm 上不可重入——恢复一半会让账户看
   起来好了而路由是空的,比明确坏掉更危险。本批不做半恢复:打一次性
   进程级标记 + 点名 error 日志(哪些服务不可用、需重启或下次交接成
   功),用户可见的 restart-required 状态与 readiness 入口可重入化留
   作后续。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop,maker-core): updater 失败汇聚点释放 fence;不可读代占位后游标推进

1. Windows updater 注册 spawn/error 回调后立即返回,executeRelaunch 的
   finally 检查时 isRelaunching 仍 true 而跳过 fence 清理;异步 error
   与 5s 启动超时走 handleApplyFailure 复位标志却不清 fence——此后本
   进程全部 durable 启动被永久判「正在重启」。全部 9 个失败出口都汇聚
   到 handleApplyFailure,在此调既有释放入口(串行链+lease 条件删,不
   裸 rm;同步路径上冗余为 no-op);成功路径不经过它,fence 保持语义
   不回退。macOS/Linux 无异步失败回调,不同病。

2. 跨代 transcript reader 对不可读代的占位分支把游标留在该代 offset 0,
   占位恰落页界(limit=1 必现)时下一页无限重复同一占位,读不到后续
   resumed 代。消费占位后游标指向下一代起点;末代不可读时无下一代可
   指,循环结束 more 保持 false,正确读作 EOF。占位在页中间的路径本
   就由循环覆盖,不受影响。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): 中止的账户交接接入用户可见的重启阻断对话框

上一轮的中止标记只有日志无消费者,用户仍停留在无提示的半瘫痪旧账户。
本轮接入真实可见流:交接在破坏性 teardown 后中止时弹主进程警告框
(照 iOS Simulator 授权卡的既有 showMessageBox 形态,经 main/i18n.ts
的 t() 五语文案),说明模型路由/消息连接/定时运行暂不可用、重启即可
恢复;「立即重启」走 app.relaunch()+app.quit()(复用 updateService
的先例与理由:无更新器接管,必须走 before-quit 链优雅收尾),「稍后」
仅关闭。一次性弹出(打标即门),fire-and-forget 不阻塞 rethrow 与
fence 释放,dialog 起不来降级为日志;下一次交接完整跑通时清除标记。
逻辑拆出 accountBoundaryAbortNotice.ts 依赖注入可测(bootstrap 不可
import)。fence 立不起的 pre-teardown 中止不弹(无破坏)。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop,maker-core): 详情投影按最新权威代裁决;approval 转发前复验 stop

1. 最新 resumed 代 stale/corrupt 时 listPiSubagentRuns 省略它,detail
   的 find() 落在旧代可读 completed 状态并把 children/output 填回——
   旧答案被当成崩溃那次的结果呈现,诊断反被挤掉。代次比较抽成
   isNewestPiGeneration 谓词供 reconcile 与 detail 共用,detail 复用
   reconcile 同一次扫描的 diagnostics 快照(reconcile 返回
   newestDiagnosticUpdatedAt,无二次扫盘无漂移面);被更新诊断顶掉的
   状态不投影 children,并把 returnedResult/returnedResultTruncated
   两键从投影摘除(数据行有意保留旧 result 作持久记录,但 detail 无
   「来自旧代」字段,渲染层会把它当本次结果并挤掉诊断 summary),失败
   态与诊断信息独立呈现;旧代正文仍可经按代寻址的 transcript 回看。

2. runner 的 stop-first 分区只作用于单次扫描快照,批执行期间落盘的
   stop 在本批之外——approval 已消费未转发时仍会放行。approval 与
   steer/follow_up 在实际转发前重扫 mailbox 中未处理的 stop(scope
   命中判定),命中即以既有 accepted:false 语义 fail closed,host 不
   计送达,无分歧。已转发的 approval 物理不可撤回,兜底仍是账户边界
   sweep 的 identity-verified kill——本修复收敛「消费到转发」窗口。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): /clear 后仍活跃的 durable run 豁免清除边界过滤

/clear 只清消息历史,detached runner 有意保留继续跑;但 clearedAt 推
进后 startedAt 过滤把该行从 list/detail/presence 全部藏掉,persist 守
卫还会拒绝其后续 reconcile 更新——子进程继续花凭证改工作区,用户失
去查看与停止入口(PI Full Access 无 OS 沙箱)。

豁免判据 = 非终态 且 capabilities.stop(只有 durable 能力集携带;同
步 PI 子任务随父轮次死,不豁免)。clearedAt 的七处查询过滤收敛到
clearBoundary(startedAt > clearedAt 或 活跃 durable),SQL 侧 json
读取按 parseCapabilities 同款 fail-closed;新发现的第二道过滤——父
tool_use 可见性(launch 消息按定义早于 clear)在 list/detail 两处 JS
后置过滤同步豁免,且只豁免 clear 半边、rewind 隐藏语义不放宽。persist
守卫下移到 matchingRow 之后,豁免钉在「已存在且仍活跃的 durable 行」
——运行中行可继续推进状态,clear 前旧 spawn 仍不得重建行。终态后按
clear 边界归档(清历史语义),durable 文件仍在盘可回看。stop/控制路
径不查 SQLite,行恢复可见即可达。rewind 用独立 rewind_at 机制,一行
未动。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): rewind 后仍活跃的 durable run 豁免回退边界过滤

与 /clear 侧完全对称:rewind 只重切父会话树,detached runner 有意存
活;但行级 isNull(rewindAt) 过滤(五处)与父可见性的 rewind 半边把
活跃 run 从 list/detail/presence 藏掉,matchingRow 查不到行还会让
reconcile 落进「不得重建 rewound 行」守卫——行冻结、停止入口消失。

豁免复用 clear 侧同一判据(非终态且 capabilities.stop):五处行级过
滤收敛到 rewindBoundary(isNull(rewindAt) 或 活跃 durable),父可见
性改为顶部短路统收 rewind/clear 两个半边;matchingRow 放行后 update
分支自然接管,「无行不得重建」守卫本意保留。update/insert 字段均不
含 rewind_at/deletedAt,更新不抹戳不复活行(判别器锁定);rewind 事
务只打戳不覆盖,与豁免正交。终态后按 rewind 边界归档;deletedAt 五
处一律不豁免(删除是真清理且自停子进程)。四边界完整语义表写进注释。
一处既有用例语义反转:原「rewound durable run 拒绝 reconcile」编码
的正是被本 finding 推翻的语义,改为锁「不插入隐藏重复行 + 保戳」。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): SSH-hosted Pi 会话不再声明 Subagents 入口

maker-core 对 remote 会话(remote = Boolean(remoteHostId))明确不装
durable Subagent extension 与 runner,SSH-hosted Pi 任务不可能产生
run;但入口声明只看 agentKind==='pi',SubagentsBody 在无 device-link
deviceId 时又走本地文件路径——SSH 用户能打开一个永远为空、控制指向
本地文件系统的页签。声明门与能力门逐字对齐:agentKind==='pi' 且
!remoteHostId。durablePiRunsPresent 有意不加门:device-link 是受支持
路径(经 listRemote 发现),SSH 会话无 deviceId、本地 list 恒空、
presence 恒 false,不会经该支路漏回。discovery effect 对 SSH 会话仅
一次空 list、不注册、无副作用,无需加门。这不是做 SSH-hosted
Subagent 支持(需 wire protocol 端到端接管 run 文件,另立后续),只
是不为能力门已禁用的会话声明入口。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): 批准回执读盘按 realpath 复核状态根

readBoundedFile 的 containWithin 要求传入已 realpath 的根,但
GhostInstallReceiptStore 一直把 path.resolve 的状态根交进去。macOS
/var → /private/var、relocated home 这类祖先链接下,合法回执会被误判
「不是普通文件」,读成 invalid,已批准插件失去运行授权。写路径仍用
resolve——目录可能尚未存在。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): 终态落盘、续跑标题、不可读诊断与 transcript 上限

durable 达到 completed/failed/stopped 时 observation 仍标 spawn,重开任务后
紧凑卡会把启动回执当成 running。终态快照改为 terminal,保留 generation id。
续跑不再把英文 Resume 前缀写进标题,侧栏继续显示原标题。status.json 暂时
读不到时不再投影 failed(会拆掉活跃豁免,clear/rewind 后停止入口永久消失);
只有 stale(已解析、runner 已死)才关行。transcript 截断标记写不下就不写,
避免文件超 50MB 被整段判不可读。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(pi): 父进程看门狗核对化身,并稳住 Windows/Linux 单测

durable runner 原先只用 kill(pid,0) 判断父 Pi 是否还在。父退出后 PID 被
快速复用时,已分离 child 会带着继承凭证继续跑到超时。启动时把父进程
start time 写入 config,轮询时对照进程化身,不匹配即停。Windows 启动时间
探针改用 Get-Process StartTime(CIM CreationDate 在 CI 上常读空,导致
resume claim 把别人的活 PID 当成仍持有)。abort-before-status 用例改为
等 runner 哨兵后再 abort,避免和 spawn 抢跑。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(pi): 后台快照保留 Pi 身份,并稳住 Windows 续跑单测

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(pi): 删除任务时落跨进程墓碑,阻止共享档案实例再拉起子会话

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(pi): Host 续跑在 spawn 前同样检查删除墓碑

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(pi): launch-pending 在父进程仍活时不算过期

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(pi): 对齐遗弃 queued 测例的死进程 owner,并放宽路由测例超时

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(pi): 扫 runs 目录失败时按仍有活动 runner 处理

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): 从本 PR 剥离插件批准回执 realpath 改动

该文件改的是插件基座批准状态读盘,会触发白名单人批门,但不服务于
Pi Subagent 持久子会话工作区。恢复为与主干相同的读盘路径。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): 重启恢复给没有 run 目录的已删 Pi 任务补墓碑

删除提交后若进程在异步写墓碑前退出,恢复原先只扫已有 run 目录,
从未拉过子会话的已删 Pi 任务永远不会补墓碑。共享用户数据的其它
实例随后仍可启动。现在从库里捞全部已删 Pi 任务,不依赖 run 目录。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): IM 软删行复活时撤回 Pi Subagent 删除墓碑

确定性 IM session 被删除后,入站消息会把同一行翻回 active,但永久墓碑
和进行中的清理都还在,复活后的 durable 启动会继续判父任务已删除。
翻回 active 之前先取消清理并清掉墓碑;进行中的清理用代次卡住,避免
写回墓碑或扫掉刚复活的 runner。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* revert(desktop): 撤掉账户交接失败的重启对话框

这是过 review 顺手加的用户可见能力,不是子会话工作区要交付的功能。
交接中止仍记日志,不再弹窗要求重启。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* revert(pi): 去掉子会话工具上多出来的角色和编排

只保留 scout / reviewer / planner / worker。删掉 oracle、researcher、
delegate、自定义角色、chain / workflow,以及 doctor / guide。并行派发、
审批写路径和停止/插话/跟进仍在。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): 复活已有 IM 行时不要重跑标题解析

createSession 为撤删除墓碑增加了 upsert 前的存在性查询,但标题是否新建
仍按 upsert 之后的回读判断,复活行会被当成新行再解析一次标题。改为以
upsert 前是否已有行为准。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(pi): spawn 前再读一次删除墓碑

Host 续跑与 in-Pi 启动在 queued 之后、拷运行时文件之前已经看过墓碑,
但拷文件是多次 await/同步 IO。这段窗口里另一实例可以写下墓碑。
staging 结束后、spawn 前再检查一次,读到就回滚目录、拒绝启动。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): 对齐 0093 snapshot 到当前 schema

custom 生成把 0093 snapshot 留成 0092 的拷贝,schema 与 companion 已有的
returned_result / cost_usd 列不会进 HEAD snapshot。用 drizzle-kit generate
重写 0093 snapshot;SQL 仍由 companion 幂等加列。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(pi): 删除任务时 Windows 上重试占用中的 run 目录

stopAndRemove 在子进程刚被杀掉时直接 rmdir,Windows 会因 cwd/句柄返回
EBUSY。用与测例 teardown 相同的 Node maxRetries,避免已删任务的文件留着。

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

---------

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
Co-authored-by: Chris <4436110+zqchris@users.noreply.github.com>
2026-08-22 08:08:28 +08:00
Dash
4537b5e4ad feat(dev): 开发版启动输出不可忽略的 verdict (#2985)
* feat(dev): 开发版启动输出不可忽略的 verdict

共享模式经常起不来,Agent 却把「窗口开了」当成成功。restart 在 wait-ready
之后再核 whoami,打印 DESKTOP_DEV_VERDICT=ready|failed;没看到 ready 不得
声称已起来。Agent 默认改走 --isolated=@worktree,只有当前 checkout 的宿主
dev 才拒绝重启。

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(dev): 收紧启动 verdict 的失败出口与沙箱唯一性

按 worktree 路径短哈希区分同名 checkout;从另一个 desktop dev 里只允许
隔离启动。wait-ready 与 deps 失败都走可捕获错误,next= 保留原来的
region / local。

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(dev): 补齐宿主识别与 verdict 上下文

宿主判定把路径后的空格视为结束,避免漏认当前 checkout。启动器失败改为抛错
好打 verdict;next= 认 --region cn,隔离意图也看 XDT_ISOLATED;Linux 上
沙箱哈希保留大小写。

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(dev): 删掉空格路径边界,宿主判定跟 kill 同一套

spaceEndsPath 会把「当前路径 + 空格 + 后缀」的 sibling worktree 误认成当前
宿主。desktop-dev 命令行里 checkout 都以 /node_modules 出现,保守匹配足够。
隔离意图改认 XDT_ISOLATED;沙箱哈希按卷是否折叠大小写。

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(dev): 命名隔离不继承宿主的 XDT_USER_DATA_DIR

从另一个隔离 Desktop 里跑 Agent 时会带上宿主沙箱目录,@worktree 就被
USERDATA_IN_USE 挡掉。显式 --isolated=<name> 只用自己派生的目录。

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(dev): verdict 只打一次,只清 Cindy 托管 profile

kill-only 失败已有具体 verdict,runner 不再补打 STARTUP_FAILED。命名隔离只丢掉
Cindy / Cindy-dev2 这类托管目录,并清掉宿主的 device override;用户自定义
userData 仍保留。

Signed-off-by: Dash <dashhuang@gmail.com>

---------

Signed-off-by: Dash <dashhuang@gmail.com>
2026-08-19 07:18:10 +08:00
Dash
10528ab665 feat(desktop): 接入 Work Louder Codex Micro 键盘 (#2937)
* feat(desktop): add Codex Micro task lighting

Signed-off-by: Dash <dashhuang@gmail.com>

* feat(desktop): activate tasks from Codex Micro keys

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): keep Codex Micro HID listener active

Signed-off-by: Dash <dashhuang@gmail.com>

* feat(desktop): map Codex Micro keys to task slots

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): use recent tasks for Codex Micro slots

Signed-off-by: Dash <dashhuang@gmail.com>

* feat(desktop): add Codex Micro device settings

Signed-off-by: Dash <dashhuang@gmail.com>

* feat(desktop): integrate Work Louder Codex Micro controls

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): align Work Louder microphone gestures

Signed-off-by: Dash <dashhuang@gmail.com>

* feat(desktop): add visual Work Louder layout editor

Signed-off-by: Dash <dashhuang@gmail.com>

* feat(desktop): draw Work Louder keycaps with Codex's own artwork

The layout editor was wearing lookalike icons from a generic set, so keys
did not match the physical keycaps users see on the board. Several Codex
glyphs (codex, openai, worktree, confetti, brain) have no equivalent
anywhere else, so no amount of substitution would have closed the gap.

Copy the glyphs and the keycap-to-glyph mapping verbatim from the Codex
desktop client, and give the agent keys the lit centre dot Codex draws
instead of an icon. The YOLO/YEET legend drops from 0.68rem to text-10,
the nearest step on our type ladder.

Signed-off-by: Dash <dashhuang@gmail.com>

* feat(desktop): redraw the Codex Micro board and configure it by clicking it

The layout was drawn as three stacked rows of unequal width, which is not the
shape of the hardware. The board is a 4x4 square: analog stick in one corner,
encoder in the other, six task keys, four command keys, and a double-width
microphone key beside Codex. Redraw it that way.

Real keycaps carry artwork and no lettering, so drop the legends printed under
every key. What a key is bound to now surfaces on hover — keycap, action, and
what that action does — which needs per-command copy the repo did not have, so
add a name and description for all 29 commands in five languages. Wording
follows Codex's own command palette wherever the same command exists there.

Configuring a key also belongs on the key. Clicking any part of the board opens
its editor: the keycap library for command keys, voice options on the
microphone, directions on the stick, gestures on the encoder, source and action
on a task key. The five standalone groups that used to list these are gone —
the settings themselves are unchanged, only the way in.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): stop the Codex Micro board rendering inside out

The board colours went through --surface-* tokens, which flip with the theme.
In dark mode that inverted the hardware: task keys came out dark when the real
caps are pale, and the encoder came out white when it is the darkest part of
the board.

Fix the caps, the artwork, and the encoder to the values the hardware actually
has, and leave only the shell tracking the app theme. Also give every part a
fixed key height instead of an aspect ratio, so the double-width microphone key
spans two columns without growing into a square twice as tall as its neighbours.

Signed-off-by: Dash <dashhuang@gmail.com>

* feat(desktop): give the Codex Micro board a case edge and a truthful thumbnail

Add a rim to the board so it reads as a physical case rather than a bare grid:
a lit top edge, a shadow line under it, and a soft drop shadow.

The connection card above it drew six numbered squares, which is not the shape
of any board that ships. Redraw it as the same 4x4 device shown below — stick,
task caps, command caps, double-width microphone — and pull the colours from
the exported board tokens so the thumbnail cannot drift away from the real one.

Signed-off-by: Dash <dashhuang@gmail.com>

* feat(desktop): set the six task keys as a set, not one dialog at a time

Which chats the task keys follow is one rule for all six, but it sat inside the
per-key editor. Changing it from AG03's dialog silently rewrote the other five,
and every key opened a dialog whose contents were not about that key.

Move the rule — the source and the single-tap behaviour — to one control under
the board, and leave the per-key editor holding only that key's own action.
Under any source but "custom" a task key has nothing of its own to configure,
so it no longer renders as a button; the tooltip names the rule it is following
instead. Picking "custom" is what makes the keys individually editable.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): put the encoder and the analog stick in the right corners

They were the wrong way round, and drawn as the wrong shapes. Codex's own
board renders the stick as a keycap-sized square housing with a small #111111
thumb cap inside it, sitting top-right; the encoder is the plain round wheel
top-left. This drew a bare black circle top-right and called it the encoder.

Swap the corners, redraw both parts to match, and fix the connection thumbnail
the same way. Add a test that asserts the order of the top row: naming the
parts was never enough to catch them being exchanged, since both were present
either way.

Signed-off-by: Dash <dashhuang@gmail.com>

* refactor(desktop): drop the device thumbnail from the connection card

The card sits directly above the board it was a picture of, so it showed the
same device twice and carried no information the text did not already give.

Remove it, and pull the board tokens back to module scope now that nothing
outside the layout draws from them.

Signed-off-by: Dash <dashhuang@gmail.com>

* feat(desktop): draw the entry-row icon as the Codex Micro's own silhouette

The row used a generic keyboard glyph, which says nothing about which device it
opens. Replace it with the board's actual shape: round controls in the top
corners, six task keys, a row of command keys, and the double-width microphone.

Drawn as SVG so the keys stay crisp at 20px, and in currentColor so it takes
the chip's text colour in both themes. Task caps sit at full strength and the
command row at lower opacity, keeping the contrast the real board has.

Signed-off-by: Dash <dashhuang@gmail.com>

* feat(desktop): drop the microphone mode; the key works like Cindy's microphone

The mode picker offered push-to-talk or voice-chat, but the push-to-talk path
already went through the gesture recogniser, which handles a tap to start, a
second tap to stop, and a hold that records until release. That is Cindy's own
microphone behaviour, and it needs no setting — the other mode only took away
the hold.

Remove voiceButtonMode from the layout, the IPC contract, the store, and the
renderer action, leaving one path through the gesture. The key on the settings
board keeps only the split-microphone switch, which is about physical layout.

Old settings files keep loading: the store reads field by field, so the stale
key is ignored, and the IPC validator still allows it so a layout object saved
by an earlier build round-trips instead of being rejected. Covered by a test.

Signed-off-by: Dash <dashhuang@gmail.com>

* feat(desktop): give the stick and the encoder the defaults they should have had

None of the five default bindings matched what the controls are for. The stick
toggled plan mode, went back and forward through history, and opened one
sidebar; the encoder drove the composer's arrow keys.

Map the stick to the two axes of the screen instead — up and down scroll the
conversation, left and right open the panel on that side — and default the
encoder to stepping through the task list, left for the previous task and right
for the next.

Most of this was wiring: the scroll commands already existed, and both sidebar
toggles were already there. Going through handleToggleRightSidebar matters —
it keeps the right sidebar's detached-window behaviour, which computing
visibility by hand would get wrong.

Stepping through tasks is new. It reads the sidebar's real rendered order, the
same source the mod+1..9 shortcuts use, so grouping, pinning, collapsing and
search filtering all agree with what is on screen. It stops at both ends rather
than wrapping: an encoder turns continuously, and wrapping would move the user
somewhere far away with no way to feel that the list had ended.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): notice when the Codex Micro is unplugged

Connection state only ever moved when something wrote lighting or started
listening for keys. Once connected, nothing touched the device again, so
pulling the cable changed nothing on screen — the card kept showing the last
successful contact, indefinitely. The retry timer did not help either: it only
arms after a failure, and no failure was ever observed.

The SDK has no disconnect event, so the only way to find out is to ask. Add a
probe request the host answers by calling getDeviceStatus on the live handle;
if that throws, the handle is stale, so drop it and report not-detected. A
probe with no connection retries discovery instead, and re-arms lighting and
key listening when the device comes back.

Call it directly rather than through postDeviceStatus, which swallows failures
— swallowing here would make every probe succeed and fix nothing. The same
round trip refreshes battery and firmware, which were also frozen at whatever
they read when the device first connected.

The settings page drives the cadence, since it is the only view showing a live
status, and it pauses while the window is hidden. Probing never starts the host
process on its own: on a machine with no such keyboard, opening settings should
not fork it.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): turn the knob the way the sidebar reads, and start at "new task"

Turning left now walks up the sidebar list and right walks down, which is the
opposite of what shipped. ENC_CW is the up direction on this hardware — the
existing conversation-scroll mode already maps it to scrollUp for the same
reason — so reading the firmware's naming as clockwise/next had the knob
fighting the list on screen.

Also fold the "new task" row into what the knob walks. It sits above the list
in the sidebar but is not a session row, so it never appeared in the DOM order
the stepper reads; turning up from the first task simply stopped. It is now the
first stop, and landing on it opens the new-task page.

Signed-off-by: Dash <dashhuang@gmail.com>

* feat(desktop): make stick scrolling continuous and pressure-sensitive

Holding the stick scrolled once and stopped. handleJoystickInput bailed out
whenever the direction had not changed, so it only ever fired as the stick
crossed into a direction — a flick, not a hold. The pressure the stick reports
was read once as an on/off threshold and then discarded, so a nudge and a full
push scrolled exactly the same distance.

Send the pressure through to the renderer as a scroll action instead of
collapsing it into a one-shot command, and scroll every frame until the stick
comes back. Speed is squared rather than linear so most of the travel stays
slow enough to place a message, and per-frame distance follows real elapsed
time so it holds up when frames drop. Frame-stepping replaces the smooth
jumps — easing per frame would fight itself and drift after release.

The SDK hook only reports movement, so a stick held still may go quiet and a
release can be missed outright if the device sleeps or is unplugged mid-push.
A watchdog ends the scroll if nothing arrives for 300ms.

Two things stay as they were: sideways still toggles the sidebars once per
push, and conversation.scrollUp/Down still jump a screen for keyboard callers.
Scrolling up also has to unpin auto-follow by hand — assigning scrollTop fires
no wheel event, so without that the view would be dragged straight back down.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): let a held stick keep scrolling instead of stopping after 300ms

Holding the stick scrolled briefly and then stopped. The release watchdog was
set to 300ms on the assumption that a held stick keeps reporting; logging the
raw events shows it does not. A stick pushed and held reports on the way in,
then goes silent — gaps of over two seconds — until it moves again. The
watchdog was reading that silence as a release, so holding was effectively
capped at a third of a second.

Release does have its own signal: distance drops to zero, which already ends
the scroll. So the watchdog is only needed for the device disappearing
mid-push — unplugged, asleep, a dropped packet — and belongs well above the
silent gaps. Raise it to 10s.

Tests now replay a push as the hardware actually reports it, including the
silent stretch, so a future timeout that is too eager fails here rather than
in someone's hand.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): give the agent keys the tasks on linked machines too

The six agent keys read the local sessions table directly. Tasks on a linked
machine never reach that table — they live only in the renderer's remote store
— so on a machine driving someone else's sessions all six keys were empty and
pressing one fell through to "new task". The sidebar showed a full list the
whole time.

Have the renderer publish what it is showing instead. It is the only side that
sees remote sessions, and the only side that knows which machine filter is
applied, so what it sends is what the user is looking at. Main keeps every bit
of its projection logic; only where the rows come from changes, and it still
falls back to the local table until the first report arrives.

The catalogue builder splits out of the database query so both paths share one
ordering and pinning rule. Published rows are validated at the IPC boundary
like any other renderer input, and the renderer skips the round trip when the
list has not actually changed.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): order the agent keys the way the sidebar reads

The keys followed a flat list sorted by recent activity. The sidebar shows
something else entirely — pinned section first, then projects, then dialogues —
so AG00 pointed at whatever was most recently touched rather than the row at
the top of the list. The settings copy even said pinned order was ignored,
which made the mismatch deliberate-looking rather than a bug.

Publish the sidebar's real rendered order instead, the same source the mod+1..9
shortcuts and the encoder already read, so grouping, pinning, collapsing and
search filtering all agree with what is on screen. Scan the whole document
rather than one container: expanded and rail are separate components, and both
need covering. Refuse to publish when no rows are rendered — the keyboard
keeping its previous mapping beats overwriting it with a wrong order.

Mutation batching matters here: the observer watches the document, and streamed
output fires constantly, so recomputation is capped at once per frame.

Signed-off-by: Dash <dashhuang@gmail.com>

* feat(desktop): flash the Codex Micro when Cindy's window comes back

Closing Cindy to the Dock or the tray hid the window; bringing it back
did nothing on the keyboard. Play a short rainbow sweep across the case,
keys and agent slots when the window returns from hide or minimize.

The first appearance after create is not a reopen, and neither is a
focus change while the window stays on screen. Status lighting waits
out the greeting so a running task cannot overwrite it mid-sweep; a
keypress or settings change ends it early.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): make the window-reopen keyboard greeting actually visible

Rainbow on an idle board can look like the lights never came on. Use the
snake and breath effects already proven by running and waiting tasks.

Also play on the first appearance, not only later reopens — the previous
gate treated cold start as a baseline and swallowed the first real show.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): greet a reopened window in Cindy brand red

The hello used the running-task blue. Cindy's brand red is #DF0C27;
hardware LEDs take that hex directly, they are not a UI token.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): deepen the window-reopen red so it does not read pink

#DF0C27 is the UI brand red, but on these LEDs it washed toward pink.
Use the deeper brand red #A61629 instead.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): shift the window-reopen red off the pink hue

#DF0C27 and #A61629 are the same hue at different values, so the board
could not tell them apart. Drop the blue channel to #B40A12 and ease
the brightness so the greeting stays crimson instead of washing pink.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): preview four reds when the window comes back

Play four distinct reds in sequence so we can pick one on the hardware.
Agent keys light 1–4 to mark which swatch is on; a short blackout sits
between each colour. Temporary — keep the favourite and drop the rest.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): keep the hotter red as the window-reopen greeting

#D0060C was the better of the four hardware swatches. Drop the preview
sequence and play that colour once, with all six agent keys breathing.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): keep a remote model list when one catalog row is stale

The controlled machine still answers maker:provider:list, but one
model without a self-consistent defaultEffort — gpt-5.6-luna on this
catalog — made the controller reject the whole payload. The local
model plane already drops that row. Do the same for remote
capabilities and provider lists so the selector stays usable.

Signed-off-by: Dash <dashhuang@gmail.com>

* refactor(desktop): reuse the greeting frame instead of building it twice

playWindowReveal already got the brightness-adjusted frame back from
updateLightingFrame, then rebuilt the same one for auto-dim. Keep the
return value. Also drop two comments that still talked about the
preview swatches and attaching after ready-to-show.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): close the Codex Micro product holes the review found

Default keys now say what they do on hover. The keycap dialog no longer
writes microphone-split or assigned-action drafts until Save. Custom
agent-key hover shows the bound task, and the keycap picker only offers
caps that actually run.

Unplugging clears the stale device snapshot. An empty sidebar publishes
an empty mapping instead of keeping the last machine's tasks. Search
hits join the sidebar scan and hide the list underneath.

SPLIT and Copy as Markdown now reach the open task. A background Agent
tap no longer steals focus while the window is still loading.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): keep Codex Micro mappings after search and split saves

Write microphone merge/split edits onto the still-visible slot, ignore the
resident sidebar search input when scanning AG00-AG05, and let only the
focused task consume SPLIT/copy. Assigned actions now follow the MIC
keycap instead of the physical slot.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): keep Codex Micro keycaps on-width and file-rail actions

Filter and save microphone merge/split against the target slot width so a
double keycap cannot land on ACT10. Hardware fork/copy now follows the
visible open task, including the file-browse chat rail, without letting
unfocused split panes consume the same press.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): keep customized mic keys and Orca file-rail actions

Judge merge/split assignment edits from the original draft, not the
width-normalized target, so a split-only save keeps customized ACT10/11.
Visible Orca file-browse rails can consume SPLIT/copy; unfocused split
panes and the sidebar worker panel still do not.

Signed-off-by: Dash <dashhuang@gmail.com>

* feat(desktop): treat Codex Micro as one input-device adapter

Cindy now owns a device-neutral action list, capability card, and host
registry. Work Louder Codex Micro registers itself as the first adapter
and keeps its HID, lights, and settings. Later keyboards can attach the
same way without inheriting this board's slots or lighting frame.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): restore the Codex Micro right-sidebar toggle after rebase

The keyboard still called handleToggleRightSidebar after main split open
and close into separate handlers. Put the toggle back so the board uses
the same detached-window semantics as the UI button.

Signed-off-by: Dash <dashhuang@gmail.com>

* feat(desktop): center the Codex Micro board and show live key presses

The settings layout now sits in the middle of the card. Physical presses
light the matching drawn key so you can see which part of the board was
hit while assigning keycaps.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): mute Codex Micro actions while editing the board

Opening the keyboard layout page now only previews presses on the drawn
board. Assigned tasks, commands, voice, and stick scrolling stay off
until you leave that page.

Signed-off-by: Dash <dashhuang@gmail.com>

* feat(desktop): show Codex Micro encoder turns and stick travel

Settings preview now follows encoder detents and the stick's raw
angle and distance, still without running the bound actions.

Signed-off-by: Dash <dashhuang@gmail.com>

* feat(desktop): use Cindy selects and last-sent task order

Drop the separate pinned list, keep sidebar order, and add a
last-sent source. Settings dropdowns now use Cindy's own panel.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): keep Codex Micro tasks and host restarts bounded

Clear the published catalog on account switch, reject oversized
task IPC, keep last-sent off the visible-row cut, and only reset
the crash budget after a stable connection.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): reconnect Codex Micro after pairing and polish the board

Drop a stale HID handle when pairing or USB re-enumeration kills the
session, so switching back to wired reconnects without restarting Cindy.
Match the drawn encoder to the physical knob, lift the analog stick off
the board, and mark the settings as Beta.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): keep Codex Micro actions on the focused task

Route hardware composer and approval commands to the focused pane, fork
from the newest assistant reply, copy conversations in chronological
order, and clear leftover stick or encoder state when the account
suspends. Also mock moveTop so Windows deep-link focus tests pass.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): isolate Codex Micro input to the focused task

Gate joystick scroll to the owner pane, stop command dispatch while an
account switch is tearing down, make DIFF hide an already-open Review
tab, and look for the bundled Work Louder SDK on Windows installs.
Also assert Windows deep-link focus via moveTop instead of always-on-top.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): keep Codex Micro keys on the visible task list

Ignore a stick held across account resume until it recenters, keep a
published empty sidebar empty, open the new-task folder picker from
FOLD, and statically import the input-device refresh after pin changes.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): restore Codex Micro after same-account login

Resume hardware task slots on the reused lifecycle client, and keep
last-sent / priority / custom catalogs on active tasks when the
sidebar is showing archived rows.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): keep Codex Micro voice press and release paired

Release a held microphone on account suspend, stop the owning
composer gesture when focus moves, and register the board preview
colours as asset-intrinsic exemptions.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): keep Codex Micro actions on the owning task

Ignore leftover split-pane hardware ownership, accept a stick return
to centre while suspended, keep archived sidebar rows out of last-sent
catalogs, and let MAGIC / DEL pin or archive from the hardware-owning
session view including the files rail.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): close Codex Micro input at the account boundary

Suspend hardware before the long auth teardown drain, keep visible
archived rows inside the 100-task publication cap, route DIFF through
the detached sidebar host, and keep untitled task names nullable so
the settings UI can show a placeholder.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): keep Codex Micro resume, catalog, and review toggle complete

Account suspend now latches a held stick only. Sidebar publication reserves six visible keys and leaves the rest for the active catalog. DIFF hides Review only when that host is already visible.

Signed-off-by: Dash <dashhuang@gmail.com>

* fix(desktop): keep Codex Micro input inside the account boundary

Hardware stays closed until an account resumes, including after a failed
DbClient takeover. Settings live under the owner namespace, and a late
sidebar catalog from the outgoing account cannot refill the next one.

Signed-off-by: Dash <dashhuang@gmail.com>

---------

Signed-off-by: Dash <dashhuang@gmail.com>
2026-08-18 21:31:25 +08:00
DavidShenXD
41346103bc fix(desktop): 修复个性化 Subagent 模型路由与展示 (#2949)
* fix(desktop): 修复个性化 Subagent 模型路由与展示

Signed-off-by: DavidShen <david@xd.com>

* test(desktop): 兼容 Windows 目录链接测试

Signed-off-by: DavidShen <david@xd.com>

* fix(desktop): 收口 Subagent 凭证与任务身份

Signed-off-by: DavidShen <david@xd.com>

* fix(desktop): 透传锁定 Subagent 推理强度

Signed-off-by: DavidShen <david@xd.com>

---------

Signed-off-by: DavidShen <david@xd.com>
2026-08-18 20:50:54 +08:00
Chris Zhang
5abe4bb7f6 feat(desktop): 统一模型选择器——模型优先,引擎自动推荐 (#2619)
* feat(desktop): 统一模型选择器第一版——模型优先,引擎自动推荐

用户只选模型,引擎(harness)由推荐映射自动配好并常驻可见;高级调整全部
收进行配置浮层。composer 的新会话与会话内两个入口启用,其余 7 个
ModelSelector 消费入口本版保持旧面板。

- 推荐引擎纯客户端推导(packages/model-providers/unifiedSelection):
  逐引擎解析生效来源得候选,推荐恒为候选之一;openai→codex、
  anthropic→claude-code、xd 按折扣路由分流,pi 仅唯一候选时推荐
- 新增两根偏好轴(只存 override,零迁移):modelEnginePrefs(引擎
  override,恢复推荐=删除)与 modelFavorites(收藏=配置副本,独立锚点)
- 统一面板:跨引擎联合列表+收藏置顶+行内「引擎·推理强度·⚡」三元组;
  行配置浮层:档位绝对色滑杆(绿→紫,唯一紫=真顶档)、引擎胶囊、
  Fast 开关、按 (模型,引擎) 实时价格与上下文
- 会话内:同引擎过滤默认开,跨引擎显式入口带有损提示,切换仍走
  performAgentSwitch 事务(fastMode 不跨引擎带入);拿不到切换事务的
  会话(SSH/老被控端)锁定当前引擎或回落旧面板
- 新会话工具条撤 AgentSelect(device-link capabilities-only 降级时保留);
  运行时未注册引擎的门禁移交联合列表
- i18n 五语齐全,Light/Dark 语义 token;设计文档
  docs/product-rules/model-selector-unified.md

验证:根 pnpm test:unit 全绿,desktop typecheck 零错误,
check:i18n-glossary 通过;实机目检待沙盒验证。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): 统一模型选择器第二轮——实测 9 bug 与数据层修正

Chris 沙盒实测反馈的修复与打磨:

- 双行合并:bridge 前缀条目(chatgpt//xai/)与 root 条目合并为一行逻辑
  模型,行身份用归一化 id,每引擎携带真实发送 wireModelId;[1m] 与
  codex/ 折扣条目仍独立成行。发送/记忆全 wire id,override/收藏用行 id
- 包月窗口修正:openai 家族 codex 侧统一 272k;与 XD 网关按路由隔离
  红线拆分注册表条目(xd/* 新条目窗口不变),updatedAt 提版
- 原生底座排序:同引擎视图 native 模型在前,仅兼容其后;服务端
  newSessionDefault 种子行置顶独立小节
- 会话内引擎锁定改用已确认身份(runtimeAgentKind),身份未落地回落
  旧面板——修复 Codex 会话可能摆出纯 Claude 列表并错切的洞
- 种子深度按模型档位表校准(新用户 DeepSeek 默认档 中→高),种子/
  记忆/预设三来源同一条 clamp 规则
- 浮层:定位三级回落防飘屏、缝隙并入 hover 区+方向性 grace、portal
  子树纳入外层 dismiss 豁免(修点深度整面板消失/恢复推荐无效)
- 面板:列表 min-h-0+高度上限修滚动、rail 选中反色、行描述截断、
  行内折扣徽标、pill 改「模型名+引擎图标+深度」
- 收藏锚点失效判定改选中时刻快照,不再比对两套 id

验证:合并态根 pnpm test:unit 全绿,desktop typecheck 零错误,
check:i18n-glossary 通过;实机验收随后由 CDP 驱动执行。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): 真机验收轮——远程投影下折扣行原生底座与浏览滚动保位

CDP 驱动真机验收发现并修复两处:

- 原生底座判定不再依赖网关识别:device-link 供应商投影会剥掉
  routing.authStrategy(执行细节不出被控端),isGatewayProvider 在
  控制端必然 false,codex/ 折扣行的 native 错落 claude-code——推荐
  引擎与同引擎视图排序双双出错。折扣判定(codex/ 前缀或
  group:'gpt-budget')改为只看条目数据;非折扣网关行语义不变
- 列表滚动保位:选中项对齐只在视图本身变化(rail 切换/搜索/首开)
  时执行;后台目录轮询重建 sections 不再把浏览中的用户拽回选中行

真机验收记录(登录态沙盒,CDP 驱动):默认置顶/行内折扣徽标/描述
截断/浮层定位与存活/滑杆点击/引擎 override 与恢复推荐/收藏副本/
会话内同引擎过滤+原生排序+有损提示均实机通过。

验证:@cindy/model-providers 552 用例全绿,根 pnpm test:unit 全绿,
desktop typecheck 零错误。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): 折扣视觉按设计稿定稿还原,描述截断收紧

Chris 实测反馈两处:

- 行内折扣从「立省 X%」胶囊改为设计稿 v4 定稿的 F 样式:付费行显示
  $ 档串(三档色:便宜绿/中档琥珀/高价红,按标准输出价分档),折扣行
  $ 串双层互补裁切——亮段(绿)宽度=折后价比例,尾随「↓X%」小字;
  限免保留淡染徽标。价格档三色注册进 colors.ts(price-tier-*,跨主题
  固定功能色),字号收进排版梯(text-11)
- 行描述截断上限收紧到 ~30ch(约等于最长模型名宽度),不再横穿整行

真机验收(CDP):新会话面板 $ 串填充/↓20%/描述截断/默认区单绿 $/
Fable 红 $$$ 均实机确认;种子深度校准在新草稿下显示「高」确认生效。

验证:desktop typecheck 零错误,排版纪律锁全绿,统一面板 35 用例全绿。
已知环境项:codexLocalSessions 与 claudeOrphanReaper 两组主进程用例
对构建期烘焙区域(.env VITE_CINDY_AUTH_REGION)有相反假设,本机随
沙盒改写 .env 后互斥失败;与本分支改动面无交集(同文件在 main
checkout 全过,本分支主进程侧仅动模型目录数据),以 PR CI 为准。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* style(desktop): 统一选择器视觉保真轮——逐像素对齐设计稿定稿

Chris 并排对比设计稿与真实版本后的对齐轮,逐项(设计稿值→实现值
见各文件注释):

- ↓X% 徽标:裸文字 → 淡染胶囊(rounded-full + 绿 14% 底,原型
  .badge.save-tint)
- 价格档串按报价币种取符号(CNY→¥),不再写死 $
- 订阅接入且无按量报价的行显示「订阅」小签,不画 $ 档串
- 浮层价格区重做为设计稿紧凑两行:「每百万 token · 折扣中,较标准
  价省 X%」+ 折后价单行;删除线表格移除,原价对比收进 title
- 滑杆补 4px 档色外晕环,停点改 color-mix 实心打孔
- 引擎胶囊 padding/gap 对齐原型,选中态加浮起阴影(新 token
  --shadow-chip-raised,light/dark 双值注册)
- 行内间距/厂商标尺寸/☆ 尺寸/字号全面对齐(半档字号就近落梯)

已知有意偏差:组标题副标缺服务端数据字段(列服务端清单)、Pi 用
真实 PiMark 不照抄 π 字形、半档字号落整数档。

验证:全量 pnpm test:unit 绿、typecheck 零错、排版纪律锁绿、术语
门禁绿;DOM 级实机验收通过(↓X% 胶囊/档串/title)。像素级目检因
沙盒窗口处于系统隐藏态(rAF 冻结)暂缓,窗口可见后补验。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): 价格档串与徽标改为紧贴模型名左排

设计稿 .m-name 是内容宽(不 grow),钱串/订阅签/折扣胶囊紧跟在模型名后,
右侧三元组由 .l1-right { margin-left:auto } 推到最右;此前实现给模型名
加了 flex-1 把名字撑满整行,导致整套价签被挤到行尾右对齐,与定稿不符。

修法:模型名去掉 flex-1(保留 min-w-0 truncate,空间不足时先收缩截断),
三元组加 ml-auto 接管推右职责。星标按钮维持在左簇尾部,与稿一致。

验证:unifiedModelPanelRendering 30 条全绿;纯 className 改动不涉类型。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* style(desktop): 按设计稿源码逐属性对齐统一选择器结构与间距

改验收方法:不再靠截图比对,直接拿设计稿 v4 的 HTML/CSS 声明与实现逐属性
核对(用户 2026-08-13 指出截图比对效率低且不准)。本轮差异清单与修复:

- 行首图标补 18×18 定位盒(设计稿 .mark):名字起点固定 26px,与第二行
  描述的 26px 缩进精确对齐;此前裸图标 ~13px 宽,名字起点浮动、两行错位。
- 分组标题(.group-label):去掉多余的 font-medium,内距改 8/10/4。
- 列表(.model-list):内距统一 8px,移除行间额外 2px gap。
- rail(.rail/.rail-btn):宽 44→48、格 30→34、圆角 8→9、纵距 4→8、
  星/全部图标 15→16。
- 面板外壳:搜索从独立胶囊输入框改为设计稿的贴顶平铺行 + 底部 hairline
  (.search-wrap,12/14 内距、13px 字);footer 改 border-t 分隔 + 纯文字链
  (hover 提亮不加底色);外层容器不再统一加 padding(两个宿主本就 p-0)。
- 浮层:容器底距 14→12(.flyout 14/14/12)、首个控件行上距 12→14
  (.fly-ctrl:first-of-type)、价格区上距 8→9(.fly-price)。

保留的既有有意偏差(均有依据):rail 选中态用反色实心块(用户对原稿弱选中
色的实测反馈)、描述宽度上限 30ch(用户要求)、半档字号落排版梯、引擎胶囊
选中态加内描边+贴地阴影(Dark 下纯换底色不可辨)。

验证:unifiedModelPanelRendering 30 条、排版纪律、选择器接线/分组/触发器
回归共 139 条全绿;desktop typecheck 零错。旧版面板的搜索框未动。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* feat(desktop): 原生底座改为可空——无主场模型任何引擎视图不降级

Chris 2026-08-13 裁决:原生底座只标确有主场的模型,可空,空 = 全场平等。

背景:grok 在三个引擎都是正式成员(#2572 后),旧实现把 xai 写死映射到
claude-code,导致它在 codex / Pi 视图被错误降到「仅兼容」层;上游维护目录
时也被迫为全能模型硬选一个主场,选哪个都会在别的视图产生错误排序。

变更:
- BUILTIN_ROOT_PREFERENCE 移除 xai(多 root 全能 → null 无主场)
- UnifiedModelEntry.nativeAgent 类型改为 AgentKind | null,建行不再回落
  recommended(BYOM 同样落无主场)
- partitionEntriesByNativeAgent 只降级「主场明确在别处」的行;null 与原生
  行按入参序同组
- 网关非折扣行从代理主场 cc 改为 null:旧代理让 XD 的 GPT 非折扣行在
  codex 视图被降级,且判定依赖 routing.authStrategy 导致 device-link 投影
  下本地/远程排序不一致;现在判定链不含任何 authStrategy 分支,两端同结果
  (gatewayRootPreference / isGatewayProvider 随之删除)
- 推荐引擎不受影响(候选回落链兜底,可见推荐结果与旧版一致)
- 规格文档 §2.1 补录裁决;服务端未来 nativeAgent 字段沿用同语义

验证:model-providers 63 条(含新增「无主场三视图不降级」回归)、desktop
相关套件 81 条、仓库根 pnpm test:unit 全绿;desktop 与包 typecheck 零错。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): 统一选择器第三轮实测修复——浮层面板内对齐/底部截断/供应商分组/字体恢复

Chris 2026-08-13 实机反馈四组问题:

1. 浮层垂直定位改按设计稿 flyFinish 算法钳制在**面板**纵向范围内:底部行
   的浮层与面板底对齐,顶部行不高过面板顶,视口安全区仍兜底 —— 此前只按
   视口夹,hover 底部行时浮层整体滑到面板下方。
2. 列表最后一行与「连接来源」footer 被裁:面板列的 max-h 公式(560px/100vh)
   不知道宿主 popover 按锚点算出的实际可用高度(实测外层 456px、面板列
   511px,底部 55px 被 overflow-hidden 裁掉)。外层加一层 max-h-full 百分比
   钳制:宿主高度确定时把面板列钳进宿主(列内 min-h-0 让列表收缩滚动),
   不确定时百分比落空、由面板列自己的绝对上限兜底。
3. 分组从模型家族改为**供应商口径**:OAuth 授权登录来源合并「授权登录」组,
   网关与自定义供应商各自成组(标题=供应商名)。供应商决定价格,网关上的
   Claude 与订阅登录的 Claude 混进同一组会让用户没法选。判据 auth.method
   (device-link 投影保留,两端同结果);供应商簇内按 sortOrder、簇间保持
   首见序,不再做全局 sortOrder 跨供应商交错混排。同引擎视图的原生优先
   排序改到组内进行。
4. 字体按旧选择器恢复:模型名 text-14 + font-medium(设计稿 13.5px/normal
   偏小偏细,与描述行难区分);描述行颜色 tertiary → secondary(太淡看不清),
   字号 12 不变。

新增「授权登录」组标题五语言文案(authGroup)。

验证:renderer 逻辑锁 43 条(含供应商分组/簇内排序/面板内钳制新断言)、
面板渲染 30 条、路由 10 条、排版纪律 5 条全绿;desktop typecheck 零错;
i18n 术语门禁绿。实机像素目检待沙盒窗口可见后补(渲染冻结)。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): 左侧分类栏常驻——移除少项隐藏规则,★ 恒在并补空态引导

设计稿的 rail(★/同引擎/全部/分组)是常驻结构;实现里加的「项数 ≤2 整条隐藏」
与「无收藏时不出 ★」两条规则叠加后,单来源登录态下整条分类栏消失
(Chris 2026-08-13 实测:「分类栏直接砍了?」)。

- UnifiedModelRail 移除 items.length <= 2 的整条隐藏
- buildUnifiedRail:★ 常驻(不再按有无收藏出格)
- ★ 视图空收藏时显示引导空态(设计稿 favEmpty,五语言新增 favoritesEmpty),
  与搜索「没有匹配」区分

验证:renderer 逻辑锁 + 面板渲染 73 条全绿。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* style(desktop): 行尾去掉选中勾,面板最小宽度放开到 300

Chris 2026-08-13 实测:
- 行尾 ✅ 与选中整行底色是重复信号,还恒占一列宽度(含未选中行的占位)——
  移除,选中语义由整行底色 + aria-selected 承载。
- 面板 min-w 460 在短名列表下让最长行与右侧之间留一条固定空隙 —— 宽度
  应贴着最长行收窄。min-w 降到 300(只兜搜索行与空态不局促的底),
  w-max 自适应与 600 上限不变。

验证:面板渲染/逻辑锁 73 条 + 排版纪律全绿;desktop typecheck 零错。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): 面板底部裁切真正修复——morph 内容包装改弹性列,列表底部加呼吸

上一版的 max-h-full 百分比钳制无效:morph 外层虽有显式高度,但内容包装自身
height:auto + max-height 对子元素不构成「确定高度」,CSS 百分比解析落空,面板列
仍按自己的 560px/100vh 上限撑高、底部被 overflow-hidden 裁掉(Chris 实测:
最后一行仍缺半截)。

修法:模型选择器的 morph 实例 panelClassName 加 flex min-h-0 flex-col ——
弹性布局用 max-height 钳出的容器主轴尺寸收缩子项(与面板列内部同一套
min-h-0 链),列表在自己内部滚动,搜索行与底部 footer 完整露出。仅作用于
本实例,不影响其它 MorphPopover 调用方。

另按反馈把列表底部内边距 8px → 12px,滚到底时最后一行不贴边。

验证:注入同构 DOM 实测(456px 宿主约束下面板列=456、列表=373 内部滚动、
footer 底边=宿主底边完整可见);相关测试 83 条全绿。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* feat(desktop): dev 沙箱凭证隔离开关(--isolated-auth)——不与 ~/.codex 共享 auth 硬链

隔离沙箱(--isolated)的 userData 独立,但 codex 凭证经「零重复登录」reconcile
硬链到本机 ~/.codex/auth.json(实测 nlink=7:正式版/多个沙箱/CLI 同一物理文件)。
沙箱里做 OAuth 登录/登出会改写共用凭证,把正式实例与本机 CLI 一起退登
(2026-08-13 Chris 实测)——隔离沙箱因此不敢测登录流程。

新增 restart 启动参数 --isolated-auth(必须与 --isolated 同用):
- 置 XDT_ISOLATED_AUTH=1,经 devEnvPrefix 白名单透传主进程;
- auth-adapters 消费(仅非 packaged 生效):reconcile 完全不与系统 codex 协调,
  不建共享硬链;已存在的共享硬链解除本沙箱一端(系统文件与其它实例的链接
  原样保留),沙箱回到未登录、之后的登录写独立文件。
- Claude / xAI / 自定义供应商凭证本就存在各自 userData(safeStorage),无需处理;
  codex-browser-companion 只读 ~/.codex/config.toml 描述符,不涉凭证。

默认关,packaged 构建忽略 —— 正式「零重复登录」行为零变化(既有 reconcile
测试 67 条全绿锁住)。新增回归锁 3 条:开关开不建链/解除已有链且系统文件
不动/开关关行为不变。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* style(desktop): 价格档串颜色改按折后实付价分档——个数管标准档,颜色管当前观感

Chris 2026-08-14 裁决:颜色表达「当前价格的选择观感」——贵模型打到一折,
点亮那段应该是绿色质感(1绿2灰),不是红色(1红2灰)。

此前绿色一身两职(便宜档档位色 + 折扣填充色),出现三档旗舰打折后通体
发绿、看起来比原价中档的黄色「更便宜」的倒挂观感。

规则拆分:
- $ 符号个数 = 标准价档(折扣不改变,表达模型本身贵不贵)
- 颜色 = 折后实付价重新分档(colorTier;无折扣时与标准档同值)
- 省了多少 = ↓X% 淡染胶囊(不变)

新增回归:三档旗舰 90% 折扣 → $$$ 亮段为 t1 绿、非 t3 红。
渲染测试 30 条全绿,desktop typecheck 零错。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* style(desktop): 价格档串改整格点亮——颜色只由点亮格数决定(1绿/2黄/3红)

Chris 2026-08-14 第二版裁决(推翻上一版按折后价重新分档):颜色不做任何
价格换算,**只看点亮了几格** —— 亮 1 格绿、2 格黄、3 格红,与模型档位无关。
$$$ 打六折亮两格是黄,$$ 打六折亮一格是绿,$$$ 打一折亮一格是绿;
无折扣行全格点亮,自然落回档位色 —— 折扣与非折扣同一条规则。

- 点亮格数 = round(实付比例 × 格数),至少 1 格;整格点亮,不再在字形
  中间裁切(colorTier 字段随之删除,规则收敛回单一来源)
- 精确省幅由 ↓X% 胶囊与悬停说明表达
- 回归锁改写:$$$ paid60 → 2 格黄;$$$ paid10 → 1 格绿;$$ paid40 → 1 格
  亮裁右 50%

渲染测试 30 条全绿,desktop typecheck 零错。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): 打开面板保证当前选中模型可见——对齐改为尺寸稳定前持续复核

Chris 2026-08-14 实测:点开面板,当前选中模型在可视区外。

根因:首开对齐是一次性动作,而面板在 morph 弹层里 —— 首帧列表还是 pill
高度的裁切态(面板列随宿主实际高度收缩后,列表高度跟随生长动画),按错误
几何算出一次错误滚动,动画长完不再重算,选中行停在可视区外。

修法:「保证选中行可见」改为在途标记 + ResizeObserver 持续复核 —— 首开/
切视图时置位,列表每次尺寸变化都重新对齐,直到选中行完整可见才收工;
用户手动滚动立即放弃(不抢滚动条)。数据刷新不夺滚动位、选中变化不跳位
两条既有规则不变。

验证:面板渲染 30 + 逻辑锁 43 全绿,desktop typecheck 零错。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): 选择器全面自查终审——尺寸往返/选中对齐余量/单来源标题/rail 细节

Chris 2026-08-14 裁决:不再逐项验收,由实现方以完美主义标准全面自查一次修完。
本轮实机(CDP)逐项走查全部交互面后的修复批次:

1. 面板尺寸「能缩不能涨」:min-h-0 钳制链让内容增长时元素尺寸不变,morph 的
   ResizeObserver 看不到 —— 切到 xAI 视图收缩到 321×252 后,切回「全部」永远
   卡在小盒子里。新增 MORPH_CONTENT_RESIZE_EVENT 事件桥:内容集合变化(切视图/
   搜索/数据刷新)时面板主动请求宿主重量,与 RO 同一条 settle 门。
   实测:全部 417×456 → xAI 321×252 → 全部 417×456,往返精确恢复。
2. 选中行对齐余量:此前贴死列表顶边、所在组标题被卷走(像被裁一刀)。现在
   行是组内第一行时把组标题一起露出,否则上下各留 8px;极矮面板下约束装不下
   时顶对齐一次并收工(防上下修正振荡)。实测:开面板选中行距顶 32px,
   「默认」组头完整可见。
3. 单来源视图组标题:点 rail 的 xAI 图标后列表标题原样写「授权登录」,像没
   切换 —— 单来源视图改显示该来源名(合并组只在多来源陈列时使用)。
4. rail ★ 未激活改中性灰(常亮金色在未进收藏视图时抢视线),激活反色实心不变;
   ★/同引擎段与全部/来源段之间补设计稿的 22px 分隔线。

验证:renderer 全量 461 文件 5494 测试全绿,desktop typecheck 零错;实机复验
首开对齐/组头可见/尺寸往返/单来源标题/hover 星标与浮层底对齐全部通过。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* style(desktop): 面板内筛选时宽度只进不退——rail 图标不再在指针下移位

Chris 2026-08-14 实测反馈:rail 筛选把内容变窄时面板宽度自动回缩,正在点击的
rail 图标跟着移位,交互体验差。

- MorphPopover 新增 stickyWidth(可选,默认关):同一次打开内宽度只进不退,
  重量允许变宽(切到需要更宽的视图)、不允许回缩;下次打开重新起算;
  视口/锚点钳制仍最优先。仅模型选择器实例启用。
- 高度不受影响,继续双向跟随内容(底边锚定向上收,无空箱子)。
- 面板列加 grow:宿主比内容宽时拉伸填满,不在边框内留空条。

实测:全部 417 宽 → xAI 视图宽度保持 417(高度 456→252 照常收)→ 切回
417×456;面板列 415 填满。测试 73 条全绿,typecheck 零错。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): 引擎归属按厂商家族定主场——清除批量错配到 codex/Claude 的一族 bug

Chris 实测:codex 会话里打开选择器,Claude 模型整列被标成 Codex(「很吓人」);
本轮实机排查又抓到镜像现象:草稿视图里网关 GPT 非折扣行整列显示「底座 Claude」,
且草稿正在 pi 上跑的选中行也显示 Claude。三者同根:网关/BYOM 行 nativeAgent 全落
null,推荐只能走「候选里 cc 优先」回落;会话内 pinnedEngine 又把所有能骑 bridge 的
行批量顶成会话引擎。四项修复:

1. 主场按厂商家族补齐(packages/model-providers):内置表/折扣判定之后,用
   classification 既有 groupOf(目录 group 优先、id 前缀兜底)——anthropic 家族→cc,
   gpt/gpt-budget 家族→codex,其余(grok/国产/BYOM)仍 null。纯条目数据,不碰
   authStrategy,device-link 两端同结果;grok 无主场裁决不变。
2. pinnedEngine 只对「无主场或主场=会话引擎」的行生效:codex 会话里 Claude 行保持
   显示 claude-code 主场,选中走跨引擎切换确认,不再静默骑 bridge;显式 override
   仍是最高优先。
3. 选中行 forceEngine:正在用的那行强制按事实引擎显示(会话取 sessionAgent,草稿取
   草稿 vendor),isLiveRow 与 force 同口径——修掉「pi 跑着 DeepSeek,行上写 Claude」。
4. 选中行的引擎胶囊专属语义:草稿=override 落库+新引擎配置立即写回草稿;会话=改道
   跨引擎切换事务,取消时不写任何全局 override(不留脏数据)。

测试:model-providers 556 条、renderer 全量 5498 条全绿;新增家族主场/pinned 收敛/
forceEngine/两种选中行胶囊语义的回归锁。沙盒实测:选中行显示 Pi·最高,网关 GPT 列
全部回到 Codex,Claude 列保持 Claude。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* feat(desktop): 模型选择器新增「引擎徽标行」列表样式,与现行样式并存可切换

Chris 试用后提出的新方向落地为第二套行样式(v7 设计稿),现行样式保持默认与
原行为完全不变;footer 右侧「试用新样式/回到旧样式」本机偏好切换(localStorage,
不进用户数据)。新样式(badge):

- 行首 22px 引擎徽标 = 唯一图标系统:官方 mark(Claude 像素脸 / Codex 圆花 /
  π)+ 品牌色底(语义豁免,同 brand variant 规则);多候选行徽标可点,在候选
  引擎间快切 —— 与浮层引擎胶囊同一条 applyEngine 链路,选中行的草稿回写 /
  会话跨引擎确认语义一致。
- 右缘常驻来源字签(providerLabel 原值),任何滚动位置都能读出行属渠道;
  组头粘性吸顶。
- 价格串按实付比例上色:亮宽 = 档数 × 实付比例,下限 0.5 字符(深折扣不出
  彩缝);颜色仍按点亮字符数取整 1绿/2黄/3红。classic 样式维持整格点亮不变。
- 单行布局,描述并入行 title 与浮层;推荐/默认引擎推导链零改动。

测试:面板渲染 34 条全绿(新增 badge 行为锁:徽标快切不触发行选中、0.5 字符
钳制、面板级切换、粘性组头),renderer 全量 5500 条通过,typecheck/术语门禁绿。
沙盒实测:切换生效、Grok 徽标点击 cc→codex 翻转、渠道签 Cindy AI/xAI 正确。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(model-providers): 合并上游后目录与测试收敛——registry 整体跟随服务端快照

merge upstream/main 时 catalog 自动合并把上游给 openai/* 补的 xd 路由静默丢掉,
同时留下了本分支已被取代的 xd/gpt-* 拆分条目(路由歧义打破 user-provider 继承
唯一性)。收敛:model-registry.json 整体取上游版本(服务端目录快照为准),删除
本地拆分结构;modelRegistry.test.ts 改锁「同一条目、openai/xd 双路由可解析」的
结构,窗口值跟随快照(08-14 起两路由同 372K),不再本地断言拆分值。

回归:model-providers 603/603、renderer 全量 5674 通过,desktop/model-providers
typecheck 与术语门禁绿。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* style(desktop): 行右侧簇颜色恒定——调过思考深度不再提亮(两种样式同规则)

Chris 实测:在浮层调整思考深度后,行右侧(引擎/档位/来源签)跟着变亮,列表外侧
不该因配置变化换颜色。移除「已自定义提亮三元组」机制(emphasizeTriple),右侧簇
恒定 text-tertiary;「已自定义」信号仍由浮层底栏(已自定义 · 恢复推荐)承载。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): 分组回归供应商本名+粘性组头不透底

Chris 实测两条:① 废除「授权登录」合并组——分组必须直接回答"这是哪家的",每个
供应商各自成组、组名用 providerLabel,与模型设置页同一套名字;删除五语言 authGroup
孤儿键。② badge 样式的吸顶组头此前背景透底且不盖列表左右 padding,行滑过时从边缘
和字缝透出来;改为不透明面板底色 + -mx 出血铺满滚动区宽度。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(desktop): 组名常驻改为列表顶部覆盖层题头——彻底根除吸顶透底

sticky 组头钉在滚动容器 padding 之下,上沿必然漏出一条行(Chris 实测两轮)。改为
「继承目录题头」:badge 样式滚动时,列表视口顶部渲染一条不透明覆盖层横幅(整宽、
下缘细线、pointer-events 穿透),显示当前滚过的组名;组头本体恢复普通元素,只挂
data-group-label 供覆盖层测量。滚动/分组变化实时更新,机制上无从透底。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(model-picker): 覆盖层题头改为设计稿式渐隐收尾并对齐组头位形

- 去掉横幅底部硬线:行滚出时被拦腰切开很糙,改为设计稿 .sec 同款
  「实底渐隐到透明」渐变收尾,行从渐变里柔和浮现
- 文字位形对齐真组头静止位(距列表顶 16px = 列表 p-2 + 组头 pt-2),
  接管瞬间与列表顶部真组头逐像素重合,消除上下边距不一致

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(model-picker): 题头文字下方补足实底净空,消除贴底

实底只到文字下缘 3px 就渐隐,下一行的字贴着题头文字冒出来;
改为文字下方 15px 实底(总 42px)再接 12px 渐隐尾,上下净空对称

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* feat(model-picker): badge 样式拿掉左侧快捷跳转栏,渠道图标移入分栏题头

- badge 样式不再渲染 rail,视图恒为「全部」(引擎与渠道已在行内表达,
  行内星标仍可收藏);classic 样式的 rail 行为不变
- 分栏组头与滚动题头卡带上供应商图标(复用 ProviderRailMark 同一套
  图标规则),快捷跳转拿掉后渠道归属就地由题头承担
- 跨引擎常驻警示在 badge 下不摆(没有同引擎视图,常驻即喊狼来了;
  有损把关交给选中时的跨引擎确认事务)

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(model-picker): 题头提前退场 + badge 组头上下净空对称

- 下一组组头进入题头区(50px)时上一组题头即退场,不再等组尾行全部
  滚没还压着牌子;退场到新组头接管(-12)之间走原生滚动
- badge 组头改上 4/下 12 内衬(配合列表 8px 上衬,顶部标签文字上下
  净空各约 13px),组间距移到 section 容器;题头卡同步对齐(pt-3、
  实底 38px、总高 50px);classic 组头节奏不变

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(model-picker): 题头改为真 sticky 力学,消除跟跑与回落跳变

离散阈值切换让组头先跟滚一段再跳回钉住位、还压住新组首行;改为连续
运动:组头文字一到钉住位即锁死;下一组组头贴上实底下缘后把在位题头
1:1 顶出(offset 随滚动逐帧驱动,不加补间),推满 38px 时正好轮到它
自己锁进钉住位 —— 全程无跳变、无空窗

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* feat(model-picker): 去掉「默认」小节,官方推荐改为一次性种子收藏

Chris 2026-08-16 裁决:简单一点 —— 列表不再有「默认」常驻小节,服务端
newSessionDefault 标记的推荐模型改以**种子收藏**交付:gateway 用户的
首个收藏即官方推荐,不想要取消收藏即可。

- buildUnifiedListSections 删除 defaults 小节与 isDefaultSeed 注入
  (providers 参数随之无消费,一并移除);行内「默认」小签与五语言
  defaultsGroup/defaultBadge 键删除
- modelFavorites 新增 seedDefaultFavorite:只投一次(seeded 标记持久
  化),取消不复种;已有收藏的用户只标记不投放;非法配置 no-op 不落
  标记;addModelFavorite 落盘补 ...state 展开防丢标记
- ModelSelector 挂一次性投放 effect(unifiedPanel 本机视图;device-link
  远程不投,被控端目录不污染控制端收藏),新增 5 条种子行为回归测试

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* feat(model-picker): badge 样式下选中态胶囊改为引擎 mark 打头

Chris 2026-08-17 裁决:badge 样式的 pill 首位图标换成用户在用的
harness mark,去掉渠道图标与尾部 harness 小标 —— 行内已建立引擎优先
心智,pill 跟同一套,渠道归属由面板分栏题头回答。深度档前补「·」分隔
(尾部失去 mark 后「名字 深度」贴着会粘读)。classic 形态一个像素不动

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(model-picker): 列表样式切换时清零 sticky 宽度水位,面板回贴内容

面板宽度本就自适应(w-max 贴最宽行,300-600 钳制),但 stickyWidth 的
「同一次打开内只进不退」把 classic(含 48px 侧栏)的宽度扛进了 badge
——当场切样式后面板不回缩,新样式显宽(Chris 2026-08-17 实测)。
MorphPopover 新增 stickyWidthKey(形态代际):key 变化即清零水位,
选择器把列表样式当 key 传入;同形态内的筛选防抖动语义不变

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* feat(model-picker): 三档并存 —— 保留最原始选择器为默认,新选择器 A/B 自选

Chris 2026-08-17 裁决:代码保留最原始的选择器,测试版可先发观察。
modelPickerLayout 扩为三档('original' 默认 | 'classic' A | 'badge' B):

- ChatInput:unifiedPanelActive 增加形态门(original 不启用统一面板),
  原 agentSwitch 两步 harness 分段因此在老版自动回归,不丢;pill 的引擎
  小标仅统一面板形态下渲染,老版保持 harness 名字文本的原始 pill
- 老面板 footer:「添加模型」改左对齐按钮,右侧新增「尝试新选择器」
  (unifiedPanelAvailable = 可用但未启用时才摆,设置类入口不受影响)
- 新面板 footer 右侧两个文字按钮:A/B 互切 + 「切回老版」
- 五语言补 layoutTryUnified / layoutOriginal;路由测试断言同步

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(model-picker): 三路 code review 批次 —— 13 项行为修复 + 7 项质量修复

行为(按严重度):
- P0 默认 'original' 形态下新建草稿失去换引擎入口:AgentSelect 注入改按
  两级判据的 active(capable ⊕ 形态偏好),与 ChatInput 对齐,注释改实情
- P1 跨引擎确认收合极性反转(取消关面板/确认不关)—— 布尔取正
- P1 两处裸 NUL 字节令 unifiedModelSelection.ts / modelFavorites.ts 被判
  二进制(rg/grep 全瞎):改空格分隔,文件恢复文本属性
- P1 scope:'session' 空转:新增 keepModel(借 deriveModelList 既有
  keepSelected 松开准入),运行中会话选中行在停用/retired 后仍成行
- P2 种子收藏与面板共用同一套可见性谓词/agents/scope,命中行缺席不落
  seeded;种子引擎优先取该行推荐引擎;storage unchanged 判定补 seeded;
  空列表分支 persist 形状对称
- P2 「恢复推荐」无条件清推荐引擎槽的 Fast(原用当前引擎值当门,清不掉)
- P2 badge 滚动题头三处位形常量同源(SOLID/TOTAL/SWITCH_AT),
  ensureSelectedVisible 让开实底遮挡带
- P2 浮层 repositionKey:列表结构变化(如浮层内收藏插入小节)时重定位,
  detached 锚点不再量 rect
- P2 device-link 草稿统一选中复用 resolveDeviceLinkDraftDefaults 按目标
  模型重解析 effort/fast,去掉 'medium' 字面量,prev 空回落 deviceLinkInitial
- P2 候选校验逐 agent 用 draft.wireIds;capabilityOf null 的 agent 剔出
  candidates(键集恒等);[1m] 变体候选走 exact 口径不借基础条目蹭引擎
- P2 删除名存实亡的 providerScope 选项与恒真的 sourceConnected 字段

质量:buildUnifiedRail 死参 favorites、死 display 回落、死 import/夹具、
pi 徽标色合一、价格档串双份渲染合并、三个形态按钮补 disabled、
modelPickerLayout 补跨窗口 storage 同步、useAvailableAgents 模块级缓存
+并发去重+focus 节流、行根补 aria-keyshortcuts

新增回归:keepModel 保行/[1m] 智谱形状/家族与前缀矛盾边界/seeded 跨窗口
同步/恢复推荐清推荐槽 Fast。验证:双包 typecheck 绿;目标套件 119+608 全
绿;根 test:unit:related 25892 过(2 失败为 ghostInstallReceipt 既有环境
性失败,干净树复现,见 PR 描述)

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(model-picker): A/B 互切按钮改称「尝试样式B / 回到样式A」

Chris 2026-08-17 裁决:新选择器内部两档以 A/B 相称,不再叫「新样式/旧
样式」(与「尝试新选择器/切回老版」的外层入口区分开)。五语言同步。
另:样式 A 的描述行试改按裁决丢弃,恢复灰色描述行原样(工作区试改
清除,无代码变更)

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* chore(model-picker): A/B 样式按钮文案定稿,样式A恢复描述行

Chris 2026-08-17 裁决:
- 新选择器互切按钮改「尝试样式B / 切回样式A」(原「试用新样式/回到旧
  样式」与旁边的「切回老版」语义打架)
- 样式A保留灰色描述行(此前的移除试改作废,未曾提交)

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(model-picker): address review —— keepModel 按 agent 收紧等 5 项

- keepModel 扩为 {providerId, modelId, agent}(agent 必填):枚举准入与
  来源校验的豁免只作用于当前运行引擎那一格,同行其它引擎的目录副本照常
  走可见性/新路由准入/resolveSourceId,不合格即出局;面板只在 session
  形态且 live 引擎已知时传,草稿不豁免
- 「恢复推荐」对 live 选中行真实应用推荐配置:同引擎走 onEffortChangeLive
  /onFastModeChangeLive;跨引擎草稿走 onSelect、会话走跨引擎切换事务,
  且**先事务成功才清 override/记忆**,取消不留半套状态;非 live 行不变
- device-link 写穿携带本次 selection 的显式目标(agent/provider/model/
  effort),不再读 setDlSel 提交前的闭包旧值;目标未给档时不下发 effort,
  保留被控端为该模型记的档
- Fast 强调色注册语义 token(--fast-accent,light/dark 同值为有意决策,
  同 effort/price 档色先例),组件经 CSS var 消费,删除 hex 常量
- modelFavorites/modelEnginePrefs 写路径改为「重读 localStorage 新鲜
  快照作基底」再应用变更落盘,另一窗口在 storage 事件到达前的写入不再
  被旧模块快照覆盖;读不到持久化值退回内存缓存防误清

回归:unifiedSelection keepModel 按 agent 系列、恢复推荐 live 五路组合、
device-link 写穿目标口径、双窗口交错写(收藏 4 条/引擎偏好 3 条)。
验证:desktop+model-providers typecheck 绿;根 test:unit:related
25919 过(2 失败为 ghostInstallReceipt 既有环境性失败,见 PR 描述)

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(model-picker): address review —— 删选中收藏回落默认、切换链真实结果、徽标色 token

- 删除当前选中的收藏先经既有选择链应用该模型默认配置再删记录:草稿走
  onSelect(favoriteUid 置空);会话同引擎走实时回调;跨引擎走切换事务
  且真成功才删,取消/失败收藏保留、配置不动;非选中收藏行为不变。三路
  与「恢复推荐」抽成同一份实现,两个入口不再漂移
- performAgentSwitch 返回真实结果(Promise<boolean>):无会话/在途发送
  拒绝/会话切走/ack 被超车/守卫拒下/抛错均 false,意图登记成功/同引擎
  重选/立即切换才 true;onCrossEngineSelect await 透传,恢复推荐与删
  收藏的清理只挂真成功;确认期保命锁本就覆盖全程,补注释说明
- 引擎徽标三支标识色注册语义 token(engine-badge-cc/codex/pi,双模式
  同值为有意决策,注册处写明来源),组件经 CSS var 消费,color-mix 与
  PiMark 引用同一变量,组件内无 hex 副本

回归:删选中收藏 5 条、切换真实结果 3 类、token 注册与无 hex 副本 4 条;
同步 4 处既有源码断言。验证:desktop typecheck 绿;model-providers
612 绿;目标套件 349 绿;根 test:unit:related 25997 过(2 失败为
ghostInstallReceipt 既有环境性失败,干净 HEAD 复现,见 PR 描述)

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(model-picker): address review —— 播种覆盖/实时写入原子性/收藏编辑同步/会话锚点

- device-link 草稿跨引擎选择时把播种键前置推到目标引擎(键构造与播种
  effect 逐字一致),显式选择成为新引擎的 seed,后续重播种不再用远程
  默认值覆盖用户刚选的模型;换设备/换引擎首次播种不受影响
- 恢复推荐与删选中收藏的同引擎路径改为「实时写入成功才清存储」:深度/
  Fast 两个 live 回调沿调用链透传真实结果(本地成功即真、远程复用既有
  失败语义、settingsLocked/隧道失败/异常为假),串行遇错即停,任一失败
  保留原配置与记录
- 编辑当前选中的收藏同步应用到 live(同引擎走模型行调档同一链路,引擎
  不一致走既有跨引擎/onSelect 口径),live 真成功才落收藏副本;非选中
  收藏行为不变
- 会话内收藏锚点最小一致实现:renderer 内存态记录(重启即忘,UI 选中
  提示而非用户数据,不动 sessions 表/不进 payload),跨引擎仅事务真成功
  后记录,派生校验替代清理式写法避开异步落库窗口;删除当前收藏的回落
  链路在会话内真正可达

回归:新增 13 条(播种生命周期/写入原子性/收藏编辑/会话锚点),同步 4
处既有断言。验证:typecheck 绿;renderer 全量 9746 绿;根
test:unit:related 26010 过(2 失败为 ghostInstallReceipt 既有环境性
失败,见 PR 描述)

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(model-picker): address review P1 —— 并发写串行重放/收藏引擎编辑/恢复推荐清除语义

- modelFavorites/modelEnginePrefs 写路径改「同步乐观写 + Web Locks 串行
  权威重放」:写操作表达为幂等 op(add 按身份去重/update 未命中 no-op/
  remove 幂等/seed 有门),同步落盘保住 app.exit 场景后,在同源互斥锁内
  于最新状态上重放自己那一个 op —— 跨 renderer 并发新增互不丢、删除与
  编辑交错不复活;锁不可用退回原行为。机制注释写进 storageOpReplay.ts
- 选中收藏改引擎并入 applySelectedFavoriteEdit 同一结构:目标配置由与
  行渲染同源的 resolveFavoriteRowConfig 算出,草稿 onSelect 整份写回
  (锚点保持)、会话走跨引擎事务,真成功才落副本;非选中收藏不变
- 恢复推荐改清除语义:providerModelMemory 新增 clearEffort/clearFast
  (全局槽+来源兼容副本两处一起删,只加不改),恢复后记忆无键、跟随
  之后的目录默认;device-link 镜像无删除笔,按能力退化保持原行为

回归:并发交错 11 条、记忆清除 4 条、引擎编辑+清除语义面板 7 条。
验证:desktop typecheck 绿;目标套件 188 绿;model-providers 612 绿;
根 test:unit:related 除 ghostInstallReceipt 既有 2 条外全过

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(model-picker): address review —— op-log 事件调和升级 + 收藏锚点随事务传递

- 并发机制升级为「同步乐观写 + 每 key 会话 op-log + 事件驱动持续调和」
  (storageOpReplay 改为 createStorageReconciler,两 store 共用):
  · 调和按捕获 key 自洽运行,owner 切换/登出不放弃旧分区合并,只在 key
    仍为 active 分区时刷新缓存,绝不跨分区灌注
  · storage 监听放宽到「op-log 里有记录的 key 都认」,迟到脏写以事件
    回到本窗后在锁内重放整条 op-log 重新断言,无差异不写、自然静止
  · op 重放前先归并折叠(update 折进 add/seed、remove 顶掉同 uid 历史,
    enginePrefs 同 key 留最后一次),防重放插重复副本
  · TTL 2s + 断言次数上限 3 防相反 op 活锁(无版本号无法区分脏覆盖与
    用户显式改动,窗口外回归最后写者胜);删除类 op 寿命 ×3(复活已删
    条目是静默错误,删早了当场可见)
  · 残余边界(进程在脏写落盘与事件到达之间退出)写进文件头
- 跨引擎编辑选中收藏把 favoriteUid 随事务传递,成功后按事务后目标值
  保留锚点;runCrossEngineSwitch 的 favoriteUid 改必填,三类调用点
  (恢复推荐/删收藏/模型行=null,收藏编辑=uid)显式表态,类型层拦漏传

回归:K1/K2 精确交错+折叠+容量+静默 11 条、K3 锚点 5 条,全部经变异
验证确认能抓住回退。验证:typecheck 绿;指定套件 142 绿;model-providers
612 绿;根 test:unit:related 26072 过(ghostInstallReceipt 2 条既有 +
ElevenLabs 1 条并发偶发、单跑 7/7,均与本轮无关)

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(model-picker): address review —— 双笔原子回滚/模型行清锚/同模型收藏应用/成功才记锚/本地模式分区

- applyDefaultsLive 进入前快照 live 深度,第二笔 Fast 失败时回滚第一笔,
  两笔要么都落要么都不落;回滚失败仍按失败处理不清存储(注释写明)
- 选中收藏存在时编辑普通模型行的深度/Fast,写成功后清收藏锚点(草稿走
  直通通道置空、会话回传 null,面板不收);收藏行自身编辑不清
- 会话内选「同来源同模型但深度/Fast 不同」的同引擎收藏不再被判重收起:
  收藏完整配置经实时回调真正应用(同一原子口径),全部成功才记锚并收起
- handleRowSelect/onProviderChange 结果透传,收藏锚点只在选择真实成功
  (含上下文确认/远程写入/本地持久化各出口)后记录
- enterLocalMode/exitLocalMode 补挂两个新 store 的 owner setter,本地
  模式不再读写上一身份分区

回归 13 条,全部经「去掉修复必红」变异验证。验证:typecheck 绿;指定
8 套 240 绿;model-providers 612 绿;根 test:unit:related 26181 过
(仅剩 ghostInstallReceipt 既有 2 条)

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(model-picker): address review —— kept 判定绑定枚举引擎,收藏锚点纳入来源维度

- unifiedSelection 的 isKeptRow 增加 agent 绑定:kept 只能由 kept agent
  自己那一轮、wire id 精确匹配的行点亮,其它引擎撞名 wire id 不再污染整
  行(此前误标依赖来源解析对显式来源的短路才未产生坏输出,正确性不该
  依赖该偶然性);补撞名桥接壳形状回归
- 会话收藏锚点快照增加 providerId(选中时的显式来源),派生校验同时比
  对当前生效来源 —— 跨窗口/外部 patch 仅把来源从 A 切到 B(wire id 与
  引擎不变)时锚点即失效,不再继续勾旧来源的收藏;跨引擎事务与同引擎
  两条记录路径同步携带,源码锁与面板断言更新

验证:desktop/model-providers typecheck 绿;面板+路由 87 绿;
unifiedSelection 73 绿;根 test:unit:related 26181 过(仅剩
ghostInstallReceipt 既有 2 条)

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(model-picker): carry explicit target fast into cross-engine switch; keepModel rejoins suspended/offline provider rail

- Cross-engine selections from the unified panel now pass the panel-resolved
  target fast (favorite copies, reset-to-recommended's explicit off, engine
  capsule edits) into performAgentSwitch overrides.fastMode; the old engine's
  live fast still never enters the payload, and callers without a resolved
  target config keep the re-resolve fallback.
- unifiedModelEntries keepModel exemption now covers the provider layer:
  a kept provider dropped by the connected-for-agent rail (suspended/offline)
  is rejoined for the kept agent's enumeration round only, admitting only the
  named wire id; model- and engine-layer exemptions unchanged, runtime-level
  disabled remains out of scope.
- Regression coverage: fast payload assertions across all cross-engine call
  sites plus a fast-on favorite case; provider-layer keep tests replace the
  previously documented suspended/offline boundary.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(model-picker): drive the unified panel's session engine from the pending switch intent target

During a registered cross-engine agentSwitchIntent the displayed
model/effort/fast/provider are all intent-target values and every callback
(performModelChange/performProviderChange/effort/fast intent branches)
writes the target engine, but sessionEngineFilter.currentAgent stayed pinned
to the old vendorKey — the panel drew the target model under the old engine
identity, offering the old engine's effort levels while edits were validated
against the target and silently clamped.

currentAgent now prefers agentSwitchIntent.target, unifying live/keep/pinned
(and the rail's same-engine view) on the intent target; once the switch lands
vendorKey converges to the same value. Regression: panel test for the
split-identity period (dual-engine model, target-only effort set, keep row)
plus a source lock on the derivation.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

---------

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
Co-authored-by: Chris <4436110+zqchris@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-18 20:10:55 +08:00
Lizi
726f52f0fc Merge pull request #2856 from makecindy/dash/light-sidebar-glass-85
feat(desktop): 浅色侧栏玻璃遮盖调到 85%
2026-08-17 15:37:54 +08:00
Dash
66abb46150 chore: 豁免设计规范文档的色值审计
DESIGN.md 与 token-decision-table.md 本身是色值权威,
改遮盖度说明会连带扫到行内既有 hex。按 cindy-design-system.md
先例登记豁免,hardcoded-color-audit unexpected=0。

Signed-off-by: Dash <dashhuang@gmail.com>
2026-08-17 18:45:47 +12:00
Lizi
52050d2699 Merge pull request #2822 from makecindy/dash/reject-isolated-on-shared-profile
fix(desktop): 拒绝 isolated 落到正式 profile,DEVICE_MISMATCH 不再删盘
2026-08-17 12:10:23 +08:00
Lizi
640a4c145f 修复dev 白屏 2026-08-17 11:59:30 +08:00
Dash
42e6ee74eb fix(desktop): 正式 profile 集合不含自定义 userData,规范化走祖先 realpath
原生 --user-data-dir 不能再被算成正式目录。restart 在叶子目录还不存在时
沿最近祖先做 realpath,避免杀进程后才被主进程拒绝。

Signed-off-by: Dash <dashhuang@gmail.com>
2026-08-17 00:42:30 +12:00
Dash
c303e94b74 fix(desktop): 非法隔离名回落默认沙箱,DEVICE_MISMATCH 不再瞬时重试
env-only 非法 XDT_ISOLATED_NAME 与主进程同样回落未命名沙箱。
正式 profile 判定改走 realpath。冷启动撞 DEVICE_MISMATCH 立即停,
避免后续 429 盖掉 foreign-device 墓碑。

Signed-off-by: Dash <dashhuang@gmail.com>
2026-08-16 23:27:26 +12:00