Skip to content

fix(desktop): 八组宿主规则改由 Core 计算,AI 代码移到 internal/ai - #1888

Merged
xiaoyumuxi merged 11 commits into
chore/core-split-crate-pathsfrom
feat/viva-rules-into-core
Nov 14, 2026
Merged

xiaoyumuxi merged 11 commits into
chore/core-split-crate-pathsfrom
feat/viva-rules-into-core

Conversation

@xiaoyumuxi

Copy link
Copy Markdown
Collaborator

关联 Issue / Linked issue

PR 类型 / Type

  • feat:新功能或用户可见的改进
  • fix:缺陷修复
  • docs:文档、Agent Note、Skill 等规则文件
  • release:稳定版发布准备

改动说明 / What changes

背景 / Why

Viva 桌面端(Go)里有八组规则本该由 Core 决定,但宿主一直自己写一份:停止等待时间的上下限、代理排除项的写法、Git 改动文件的分组、工作树状态与新建对话框、插件启用与卸载步骤、编辑分组的拆分与拖放、项目树可见行与多选、Diff 内查找。将来换 UI 壳子,这些规则还得再写一遍,而且已经造成了几个可见的问题:

  • Git 改动文件用 strings.Compare 排序,v0.1.12 排在 v0.1.4 前面,顶层目录显示成 .。
  • Diff 查找自己用 Go 转小写匹配,文本里有转小写后字节数会变的字符时,就退回区分大小写。
  • 设置页用三个越界值去探测停止等待时间的上下限。

这几条规则已经由 Lithe-core-rust #30 在 Core 里实现(叠在 #28 上)。本 PR 让桌面端改用这些 Core 命令,删除 Go 里的同名规则,宿主只负责 I/O 和绘制。

另外,应维护者要求,把 AI 相关的 Go 代码移到独立的包 desktop/internal/ai,以后单独维护。

本 PR 叠在 #1887(chore/core-split-crate-paths)上,base 是 #1887 的分支,diff 里只有本 PR 新增的 11 个提交。

改动 / Changes

按提交列出:

  • 290f9e6 停止等待时间([Feature] 停止等待时间的默认值与上下限由 Core 公开,桌面端不再三次探测推导 #1830)
    • core.ProcessLifecycle 读取 processLifecycle.resolve 新增的 gracefulStopRule(defaultSeconds、minSeconds、maxSeconds)。
    • workbench/process_exit.go 删除三次越界探测,设置页的上下限直接取 Core 给出的值。
  • f8a2537 代理排除项由 Core 解析([Feature] 代理排除列表的写法解释与匹配下沉到 Core,netproxy 不再自行实现 #1829)
    • network.proxyPolicy 返回的 exclusionRules 和 invalidExclusions 在 core/network.go 中解码。
    • netproxy 删除自己解析排除项的 Excluded。新的 Bypasses 只做契约规定的比较:同一地址族内比较,忽略 IPv6 zone。
    • netproxy_test.go 回放 Core 的 fixture network/proxy-bypass-v1.json。
    • 设置页“测试连接”的结果后面列出 Core 无法识别、不会生效的排除项。新词条为 desktop.settings.network.ignoredExclusions,中英文都已补齐。
  • 66436fb Git 改动文件分组([Feature] 将 Viva Git Log 提交改动文件的文件夹分组下沉到 Core #1814)
    • Log 页的提交文件、Stash 页和 Shelf 页在后台读取列表时调用一次 git.changedFileGroups。
    • 目录按段比较,文件按项目树的自然顺序排列,顶层目录是 ""。
    • “文件夹是否包含所选文件”改为用 Core 的分组判断,不再用 path.Dir。
    • 删除旧分组和 stashCommitFiles。
  • 0a495dd 工作树([Feature] 将 Viva 工作树操作的可用性、状态和新建建议路径下沉到 Core #1817)
    • 工作树页显示 Core git.worktrees 给出的状态(missing、locked、modified、current、available),以及被禁止的写操作和原因。
    • 每个检出的改动数改为一次 countChanges 列出统计。
    • 新建对话框的可选项、清理后的分支名、建议目录和能否创建,都来自 git.worktreeCreationPreview。
    • 删除 Go 里的可用性、状态优先级和建议路径规则。
  • cff3cd7 Diff 查找([Feature] 将 Viva Diff 查找的全文匹配与位置投影迁入 Rust Core #1847)
    • 查找栏在后台对两侧编辑器的快照逐个调用 Core editor.find,规则和编辑器查找栏相同:Unicode 大小写折叠,最多 10000 处,计数显示 n+。
    • 新的查询或关闭查找栏会取消进行中的查找;两侧文本在查找期间变化时,丢弃结果并重新查找。
    • 匹配在两侧都高亮。
  • 34beb24 插件启用与卸载([Feature] Viva 插件生命周期规则(启用选择、卸载清理与停止顺序)仍在 Go 平台层,应迁入 Rust Core #1842)
    • 新增 core.PlanPluginLifecycle,调用 plugins.installed.lifecycle。Core 返回每个插件的启用状态,并为确认安装、启用、禁用、卸载给出有序步骤。
    • pluginstate 只保存用户的选择,删除 Enabled 和 EnableUnlessChosen。
    • pluginmanager.Manager.Apply 按步骤执行:删除版本、删除批准记录、清除选择、删除状态目录、停止插件程序。对未安装的插件返回 ErrUnknownPlugin。
    • pluginservice 的 Uninstall 和 Disable 改走 Apply,停止程序由调用方传入。
    • 更新 Agent Note 2026-11-13-viva-plugin-install-enables-and-uninstall-cleans-state.md。
  • 9eae9a8 编辑分组([Feature] 将编辑分组的共享状态转换迁入 Rust Core #1806)
    • 新增 core.ReduceEditorLayout(editor.groupLayout.reduce),分组和布局树一起归约,覆盖打开页签、拖放页签(合并、拆分、拖到空编辑区)和移除空组。
    • 拖到已关闭的页签或已消失的分组时返回 stale,不会变成别的移动。
    • 新增 core.EditorDropTargets(editor.groupLayout.dropTargets),拖动开始时取一次每个分组接受的落点;宿主只对画出的区域做命中测试。
    • 删除 moveTab、moveIntoNewGroup、splitTab、placeInEmptyEditor、splitLeaf、removeLeaf 和 dropRestoredGroup。
    • adoptLayout 按 split 编号复用分隔条比例。
    • 会话恢复只创建布局里有的分组,结束时用 RemoveEmptyEditorGroups 去掉空组;终端分组也走同一个归约。
    • 更新 Agent Note 2026-10-12-editor-tab-split-docking.md。
  • c0e6b3c 项目树([Feature] 将 Viva 项目树可见行和导航规则下沉到 Rust Core #1800)
    • 树的形状变化后(目录打开或关闭、列表返回、节点消失)调用一次 workspace.projectTree.rows,由 Core 给出可见行、修正后的选择和视口顶端行。缩放和重绘不调用 Core。
    • 删除 Go 里的选择修正、视口锚点恢复、扩选范围和“已被标记的目录包含”判断。
    • 普通、Cmd/Ctrl、Shift 点击和批量结束走 workspace.rowSelection.reduce,批量操作的对象取 Core 的 targets。
    • Commit 窗口改动行的多选使用同一个归约(changelists_select.go)。
    • 同名目录被文件替换时,选择跟着路径走;选中的顶层文件被删除时,选择回到根节点。
    • 更新 Agent Note 2026-10-19-lazy-project-tree.md。
  • 55cd13e AI 代码移到 desktop/internal/ai
    • 新包对应 Core 的 lithe-ai crate,包括:
      • Core AI 命令的封装:ai.configuration.*、ai.planCommit、ai.decodeCommitMessage、ai.inlineEdit.*、ai.pullRequest.*,以及 git.commitMessageContext;
      • Codex 和 Claude 服务商的发现与凭据定位;
      • HTTP 请求:45 秒超时、不跟随重定向、响应上限 2 MiB;
      • 三条生成流程:提交信息、行内编辑、PR 描述。
    • desktop/internal/core 删除 ai_generation.go、ai_configuration.go 和 ai_pull_request.go,只保留 IDE API(IDEHostControl 并入 ide_host.go)。core/doc.go 写明,单独维护的功能在自己的包里封装命令。
    • workbench 删除 ai_provider.go、aicommit_http.go 和 AIKernel/CoreAIKernel,只保留界面状态和本地化错误文案。Options.AIKernel 的类型改为 ai.Kernel。
    • 测试随代码移到 internal/ai,删除没有调用方的 AICommitInputBudget 封装。
    • 更新三条 AI 功能矩阵、Agent Note 2026-11-12-viva-agent-conversation-removed.md 和 docs/viva-migration.md 中的路径。
  • 7f3699e Core 固定版本
  • d666e85 文档
    • 功能矩阵 file-explorer、git-diff-review、git-history、git-worktrees 和 network-proxy-settings 中还写着“仍在 Go、下沉跟踪 #18xx”的句子,改为写明现在由哪条 Core 命令计算。
    • git-history 删除“文件保持 Git 返回的顺序”,现在按自然顺序排列。
    • Agent Note 2026-10-05-project-tree-selection-and-moves.md 同样改为已在 Core。

不在本 PR 范围内 / Out of scope


类型专属:fix

复现与根因

检查项

  • 回归测试已随每个提交更新,但没有逐条回到修复前的代码上确认它会失败。新增或改写的测试:gitlog_files_test.go(自然顺序、顶层 "")、difftab_test.go(Core 查找)、process_exit_test.go、netproxy_test.go(回放 proxy-bypass-v1.json)、network_check_test.go、network_view_test.go、gitworktree_test.go、pluginmanager_test.go、pluginstate_test.go、pluginservice/*_test.go、core/editor_layout_test.go、editorgroups_test.go、core/project_tree_test.go、filetree_test.go。
  • [N/A] 无法自动化时的手动步骤:所有改动都有自动化测试;整机交互验收见下面“未能执行的检查”。
  • 已搜索被改函数、类型和字段的全部调用方。pluginstate.Enabled、EnableUnlessChosen、netproxy.Excluded、stashCommitFiles、AIKernel、CoreAIKernel 和编辑分组的旧函数都已删除,vet 和全部测试通过。
  • 另一平台:Viva 各平台共用同一份 Go 代码,本 PR 同时覆盖。
  • 本 PR 包含一个不属于修复的重构:维护者要求把 AI 代码移到 internal/ai,放在单独的提交 55cd13e 中。没有建新的 Issue:维护者要求一次处理完、少开单。
  • 已在 .agents/notes/implemented/ 记录行为约束:architecture/2026-10-19-lazy-project-tree.md、architecture/2026-10-12-editor-tab-split-docking.md、bug-fix/2026-11-13-viva-plugin-install-enables-and-uninstall-cleans-state.md、bug-fix/2026-10-05-project-tree-selection-and-moves.md。

范围检查 / Scope checks

功能矩阵 / Feature matrix

  • 已更新 shared/platform-feature-matrix/features/ 下的这些文件:file-explorer、git-diff-review、git-history、git-worktrees、network-proxy-settings、ai-commit-generation、ai-inline-edit、ai-pull-request-description。只改了说明和证据路径,没有改实现状态或验证状态;没在实机上验证的仍是 pending。
  • 已运行 ./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh(221 项能力)和 ./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/preview HEAD,都通过。
  • 没有提交 .artifacts/ 下的矩阵视图。
  • [N/A] 已经更新了矩阵,不需要说明理由。

统一日志系统 / Structured logging

N/A:本 PR 没有新增或修改日志事件,失败仍走原有的 notifyError 和 Core 错误路径。模板里的 scripts/logging/*.mjs 在当前仓库中不存在(Viva 日志生成和使用门禁跟踪 #1802),所以没有运行。

界面文案 / i18n

  • 新文案 desktop.settings.network.ignoredExclusions 已在 shared/i18n/ 补齐中英文,并运行 node scripts/i18n/generate-i18n.mjs 提交了生成结果(desktop/internal/i18n/shared.generated.go),没有手改。
  • 已运行 node scripts/i18n/verify-app-language-localization.mjs 和 node scripts/i18n/generate-i18n.mjs --check,都通过。没有放宽脚本或扩大豁免名单。

逻辑归属 / Logic placement

  • 八组规则都在 Core(Lithe-core-rust [Windows][W2] Git 安全工作流与冲突恢复 #30),契约和 fixture 先于本 PR 的接入。宿主只做 I/O、命中测试和绘制。
  • 平台层已有的可共享逻辑都已移入 Core,这次没有留下不迁的部分。
  • 没有按工具名加分支。插件生命周期按通用的已安装版本和用户选择计算。

性能与内存 / Performance and memory

  • 没有新增后台常驻任务或轮询。Diff 查找和改动文件分组在已有的后台任务里调用 Core,新的查询会取消旧的。
  • 主线程不读写文件,也不启动进程。workspace.projectTree.rows 只在树的形状变化时调用,不是每帧调用。
  • 项目树基线,同一台机器上 1000 行缩放:改动前约 397µs/op,改动后约 394µs/op,内存分配不变(filetree_bench_test.go)。本 PR 没有改 Viva 编辑器模块(desktop/internal/editor/**、editorview/**),所以没有运行 editor-bench.sh。

设置 / Settings

  • [N/A] ⓘ 和“自动(实际生效值)”:没有新增设置项。停止等待时间的默认值和上下限改为来自 Core gracefulStopRule,与 resolve 共用同一组常量。
  • [N/A] 真实来源回读:没有改设置的读写来源。代理设置仍按原来的方式保存,只改了排除项由谁解析,以及测试连接的提示。
  • [N/A] 设置页分类:没有新增或移动设置页。

插件契约 / Plugin contract

N/A:没有改插件契约、能力版本或插件函数协议,也没有新增或修改宿主方法和通知。plugins.installed.lifecycle 是宿主内部命令,不属于插件契约。PINNED_CORE_REVISION 已改为 Core #30 的 head 5efe90b,桌面端测试读取的就是这个检出里的 fixture。

发行包与资源 / Bundle and resources

  • 没有新增运行时资源,也不会向 app bundle 写入;已运行 ./scripts/desktop/verify/verify-runtime-bundle-immutability.sh,通过。
  • [N/A] 没有新增或修改下载、解压、生成或缓存资源。

无用代码与重构 / Dead code and refactoring


验证 / Verification

以下命令在 d666e85 上运行,Core 指向 Lithe-core-rust #30 的 head 5efe90b(LITHE_CORE_RUST_DIR 指向该检出)。Go 代码在 7f3699e 之后没有改动,d666e855a 只改了文档。

命令或操作 平台 结果
cd desktop && ../scripts/desktop/desktop-go.sh vet ./... macOS 通过
cd desktop && ../scripts/desktop/desktop-go.sh test ./... macOS 通过:54 个包 ok,12 个包没有测试
gofmt -l(改动的 Go 文件) macOS 没有输出
node scripts/i18n/verify-app-language-localization.mjs macOS 通过
node scripts/i18n/generate-i18n.mjs --check macOS 通过(11072/11072 条)
./scripts/desktop/verify/verify-runtime-bundle-immutability.sh macOS 通过
./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh macOS 通过(221 项能力)
./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/preview HEAD macOS 通过
./scripts/agent-notes/verify-agent-notes.sh macOS 通过(221 篇 Note)
Core #30:cargo fmt、注释检查、cargo clippy(macOS 和 Windows target)、cargo test --workspace、verify-docs.mjs、sdk-e2e.mjs macOS 全部通过,详见 Core #30

未能执行的检查和原因:

  • 没有在 Windows 和 Linux 实机上运行桌面端测试。Core 只在 macOS 上交叉检查了 Windows target 的 clippy。
  • 没有做整机交互验收:项目树多选、编辑分组拖放、工作树新建对话框和 Diff 查找都只有组件测试,没有在运行中的应用里录屏。
  • 统一日志的两条检查脚本在仓库中不存在([Feature] 恢复 Viva 日志事件类型生成和目录使用门禁 #1802),没有运行。

提交前确认 / Final checks

network.proxyPolicy 返回 exclusionRules 和 invalidExclusions;netproxy 删掉
自己解析排除项的 Excluded,改为 Bypasses 只做契约规定的比较,并回放 Core 的
network/proxy-bypass-v1.json。设置页测试连接的结果后面列出 Core 无法识别、
不会生效的排除项。

Closes #1829
…ough Core

The Log tab's commit files, the Stash tab and the Shelf tab grouped files by
folder with path.Dir and strings.Compare, so v0.1.12 sorted before v0.1.4 and
the top folder was ".". They now ask Core's git.changedFileGroups once when a
list loads, in the background task that reads it, and test whether a folder
holds the selected file from Core's grouping instead of path.Dir. The top
folder is "". stashCommitFiles is gone with the old grouping.

Closes #1814
… follow Core

The Worktrees tab shows the states and blocked-write reasons Core derives,
counts every checkout's changes with one countChanges listing, and the new
worktree dialog takes its choices, branch name, destination and readiness
from git.worktreeCreationPreview instead of rules of its own.

Closes #1817
Diff 页签的查找栏不再自己用 Go 转小写匹配(遇到小写后字节变长的字符就退回区分大小写),
改为在后台对两侧编辑器的快照逐个调用 Core 的 editor.find,与编辑器查找栏同一套规则:
Unicode 大小写折叠、匹配上限 10000 处(计数显示 n+)。新查询或关闭查找栏会取消进行中的
查找;两侧文本在查找期间变化时丢弃结果并重新查找;匹配会在两侧编辑器里高亮。

Closes #1847
- 新增 core.PlanPluginLifecycle,调用 plugins.installed.lifecycle:
  Core 按插件回答启用状态,并为确认安装、启用、禁用、卸载给出有序步骤
- pluginstate 只保存用户选择,去掉 Enabled、EnableUnlessChosen
- pluginmanager.Manager.Apply 按步骤执行删版本、删批准记录、忘记选择、
  删状态目录和停止插件程序,未安装插件报 ErrUnknownPlugin
- pluginservice 的 Uninstall、Disable 改走 Apply,停止程序由调用方传入
- 更新安装即启用、卸载清理状态的 Agent Note

Closes #1842
- 新增 core.ReduceEditorLayout(editor.groupLayout.reduce):分组与布局树一起归约,
  打开页签、拖放页签(合并、拆分、空编辑区)、移除空组都由 Core 返回新状态、新布局、
  被移除的组和页签所在组;拖到已关闭的页签或已消失的组时返回 stale,不会变成别的移动
- 新增 core.EditorDropTargets(editor.groupLayout.dropTargets):拖动开始时取一次
  每个组可接受的位置,宿主只按画出的区域命中测试
- 工作台删掉自写的 moveTab、moveIntoNewGroup、splitTab、placeInEmptyEditor、
  splitLeaf、removeLeaf 和 dropRestoredGroup;adoptLayout 按 split 编号复用分隔条比例
- 会话恢复只创建布局里有的组,结束时用 RemoveEmptyEditorGroups 去掉空组
- 更新编辑分组拆分与停靠的 Agent Note

Closes #1806
- 树的形状变化后(目录打开/关闭、列表返回、节点消失)调用一次
  workspace.projectTree.rows,由 Core 给出显示的行、修正后的选择和视口顶端行;
  不再每帧在 Go 里展平,缩放和重绘不调用 Core(1000 行缩放 397→394µs/op,分配不变)。
- 删除 Go 里的选择修正、视口锚点恢复、扩选范围和“已被标记目录包含”判断;
  普通/Cmd/Shift 点击与批量结束走 workspace.rowSelection.reduce,批量目标用 Core 的 targets。
- Commit 窗口改动行的多选使用同一个归约。
- 同名目录被文件替换时选择跟随路径,选中顶层文件被删时选择回到根节点。
- 更新项目树 Agent Note,补选择归约和改动行多选的回归测试。

Closes #1800
- 新包 desktop/internal/ai 与 Core 的 lithe-ai crate 对应:Core AI 命令
  (ai.configuration.*、ai.planCommit、ai.decodeCommitMessage、ai.inlineEdit.*、
  ai.pullRequest.*)以及 git.commitMessageContext 的封装,Codex/Claude 服务商
  发现与凭据定位,HTTP 请求(45 秒、不跟随重定向、2 MiB 上限),提交信息、
  行内编辑、PR 描述三条生成流程。
- desktop/internal/core 删除 ai_generation.go、ai_configuration.go、
  ai_pull_request.go,只保留 IDE API(IDEHostControl 并入 ide_host.go)。
- workbench 删除 ai_provider.go、aicommit_http.go 和 AIKernel/CoreAIKernel,
  只保留界面状态与本地化错误文案,Options.AIKernel 改为 ai.Kernel。
- 测试随代码迁到 internal/ai;去掉没有调用方的 AICommitInputBudget 封装。
- 功能矩阵三条 AI 能力、Agent 对话删除 Note、viva-migration 改到新路径。
#30 叠在 #28 上,提供本分支接入的宿主规则命令:gracefulStopRule、
代理 exclusionRules、git.changedFileGroups、工作树状态与
git.worktreeCreationPreview、plugins.installed.lifecycle、
editor.groupLayout.*、workspace.rowSelection.reduce 和
workspace.projectTree.rows。两者合入 main 后改成合并 commit。
项目树、Diff 查找、Git 改动文件分组、工作树和代理排除项的说明还写着
“仍在 Go、下沉跟踪 #18xx”,改为现在由哪条 Core 命令计算。git-history
去掉“文件保持 Git 返回的顺序”,现在按自然顺序。
@xiaoyumuxi

Copy link
Copy Markdown
Collaborator Author

本 PR 在 #1887 合入 preview 之后才合入,合进的是 #1887 原来的分支,没有进 preview,所以 Closes 的八张单也没有关闭。同样的改动已从最新的 preview 重新提交为 #1889。

xiaoyumuxi added a commit that referenced this pull request Nov 14, 2026
* fix(desktop): 停止等待时间的规则改读 Core 的 gracefulStopRule,删除三次探测

Closes #1830

* fix(desktop): 代理排除项由 Core 解析,测试连接提示被忽略的条目

network.proxyPolicy 返回 exclusionRules 和 invalidExclusions;netproxy 删掉
自己解析排除项的 Excluded,改为 Bypasses 只做契约规定的比较,并回放 Core 的
network/proxy-bypass-v1.json。设置页测试连接的结果后面列出 Core 无法识别、
不会生效的排除项。

Closes #1829

* fix(desktop): group changed files of commits, stashes and shelves through Core

The Log tab's commit files, the Stash tab and the Shelf tab grouped files by
folder with path.Dir and strings.Compare, so v0.1.12 sorted before v0.1.4 and
the top folder was ".". They now ask Core's git.changedFileGroups once when a
list loads, in the background task that reads it, and test whether a folder
holds the selected file from Core's grouping instead of path.Dir. The top
folder is "". stashCommitFiles is gone with the old grouping.

Closes #1814

* fix(desktop): worktree states, blocked writes and the creation dialog follow Core

The Worktrees tab shows the states and blocked-write reasons Core derives,
counts every checkout's changes with one countChanges listing, and the new
worktree dialog takes its choices, branch name, destination and readiness
from git.worktreeCreationPreview instead of rules of its own.

Closes #1817

* fix(desktop): Diff 查找改用 Core editor.find

Diff 页签的查找栏不再自己用 Go 转小写匹配(遇到小写后字节变长的字符就退回区分大小写),
改为在后台对两侧编辑器的快照逐个调用 Core 的 editor.find,与编辑器查找栏同一套规则:
Unicode 大小写折叠、匹配上限 10000 处(计数显示 n+)。新查询或关闭查找栏会取消进行中的
查找;两侧文本在查找期间变化时丢弃结果并重新查找;匹配会在两侧编辑器里高亮。

Closes #1847

* refactor(desktop): 插件启用规则和生命周期步骤改由 Core 决定

- 新增 core.PlanPluginLifecycle,调用 plugins.installed.lifecycle:
  Core 按插件回答启用状态,并为确认安装、启用、禁用、卸载给出有序步骤
- pluginstate 只保存用户选择,去掉 Enabled、EnableUnlessChosen
- pluginmanager.Manager.Apply 按步骤执行删版本、删批准记录、忘记选择、
  删状态目录和停止插件程序,未安装插件报 ErrUnknownPlugin
- pluginservice 的 Uninstall、Disable 改走 Apply,停止程序由调用方传入
- 更新安装即启用、卸载清理状态的 Agent Note

Closes #1842

* fix(desktop): 编辑分组的打开、拖放与空组移除改由 Core editor.groupLayout 计算

- 新增 core.ReduceEditorLayout(editor.groupLayout.reduce):分组与布局树一起归约,
  打开页签、拖放页签(合并、拆分、空编辑区)、移除空组都由 Core 返回新状态、新布局、
  被移除的组和页签所在组;拖到已关闭的页签或已消失的组时返回 stale,不会变成别的移动
- 新增 core.EditorDropTargets(editor.groupLayout.dropTargets):拖动开始时取一次
  每个组可接受的位置,宿主只按画出的区域命中测试
- 工作台删掉自写的 moveTab、moveIntoNewGroup、splitTab、placeInEmptyEditor、
  splitLeaf、removeLeaf 和 dropRestoredGroup;adoptLayout 按 split 编号复用分隔条比例
- 会话恢复只创建布局里有的组,结束时用 RemoveEmptyEditorGroups 去掉空组
- 更新编辑分组拆分与停靠的 Agent Note

Closes #1806

* fix(desktop): 项目树可见行、选择修正与多选改由 Core 计算

- 树的形状变化后(目录打开/关闭、列表返回、节点消失)调用一次
  workspace.projectTree.rows,由 Core 给出显示的行、修正后的选择和视口顶端行;
  不再每帧在 Go 里展平,缩放和重绘不调用 Core(1000 行缩放 397→394µs/op,分配不变)。
- 删除 Go 里的选择修正、视口锚点恢复、扩选范围和“已被标记目录包含”判断;
  普通/Cmd/Shift 点击与批量结束走 workspace.rowSelection.reduce,批量目标用 Core 的 targets。
- Commit 窗口改动行的多选使用同一个归约。
- 同名目录被文件替换时选择跟随路径,选中顶层文件被删时选择回到根节点。
- 更新项目树 Agent Note,补选择归约和改动行多选的回归测试。

Closes #1800

* refactor(desktop): 把 AI 代码抽成独立包 internal/ai

- 新包 desktop/internal/ai 与 Core 的 lithe-ai crate 对应:Core AI 命令
  (ai.configuration.*、ai.planCommit、ai.decodeCommitMessage、ai.inlineEdit.*、
  ai.pullRequest.*)以及 git.commitMessageContext 的封装,Codex/Claude 服务商
  发现与凭据定位,HTTP 请求(45 秒、不跟随重定向、2 MiB 上限),提交信息、
  行内编辑、PR 描述三条生成流程。
- desktop/internal/core 删除 ai_generation.go、ai_configuration.go、
  ai_pull_request.go,只保留 IDE API(IDEHostControl 并入 ide_host.go)。
- workbench 删除 ai_provider.go、aicommit_http.go 和 AIKernel/CoreAIKernel,
  只保留界面状态与本地化错误文案,Options.AIKernel 改为 ai.Kernel。
- 测试随代码迁到 internal/ai;去掉没有调用方的 AICommitInputBudget 封装。
- 功能矩阵三条 AI 能力、Agent 对话删除 Note、viva-migration 改到新路径。

* chore(desktop): Core 固定到 Lithe-core-rust #30 的 head 5efe90b

#30 叠在 #28 上,提供本分支接入的宿主规则命令:gracefulStopRule、
代理 exclusionRules、git.changedFileGroups、工作树状态与
git.worktreeCreationPreview、plugins.installed.lifecycle、
editor.groupLayout.*、workspace.rowSelection.reduce 和
workspace.projectTree.rows。两者合入 main 后改成合并 commit。

* docs: 功能矩阵和项目树笔记改写为规则已在 Core

项目树、Diff 查找、Git 改动文件分组、工作树和代理排除项的说明还写着
“仍在 Go、下沉跟踪 #18xx”,改为现在由哪条 Core 命令计算。git-history
去掉“文件保持 Git 返回的顺序”,现在按自然顺序。
@xiaoyumuxi
xiaoyumuxi deleted the feat/viva-rules-into-core branch November 14, 2026 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review: high ghfind author score; see https://ghfind.com

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant