From 44494d5c3079f5043c312e072a2f88516658572f Mon Sep 17 00:00:00 2001 From: Yao Jingxi <23722032@bjtu.edu.cn> Date: Tue, 24 Nov 2026 17:53:31 +0800 Subject: [PATCH] =?UTF-8?q?fix(desktop):=20=E5=9B=BA=E5=AE=9A=20Core=20mai?= =?UTF-8?q?n=20c6cef0b=20=E5=B9=B6=E4=BF=AE=E6=AD=A3=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E5=9B=BE=E6=A0=87=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - PINNED_CORE_REVISION 从集成提交 75e1480 换成 Core main c6cef0b,带上 #196, 修复 #2382 的 TestGeneratedRunTypeSnapshotResolvesAsDeclaredKind - TestPluginToolWindowUsesPackageIconAcrossThemes 构造 App 时初始化 chrome, 修复 #2383 引入的空指针 panic - API 计划、功能矩阵和 Agent Note 的固定版本说明同步 --- ...-viva-plugin-host-services-and-backend-sessions.md | 2 +- desktop/internal/workbench/plugintools_test.go | 2 +- docs/development/macos-plugin-api-plan.md | 6 +++--- scripts/desktop/build-desktop-core.sh | 11 ++++++----- .../plugin-host-editor-file-window-services.json | 4 ++-- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.agents/notes/implemented/architecture/2026-11-10-viva-plugin-host-services-and-backend-sessions.md b/.agents/notes/implemented/architecture/2026-11-10-viva-plugin-host-services-and-backend-sessions.md index 903689c19..84be1e639 100644 --- a/.agents/notes/implemented/architecture/2026-11-10-viva-plugin-host-services-and-backend-sessions.md +++ b/.agents/notes/implemented/architecture/2026-11-10-viva-plugin-host-services-and-backend-sessions.md @@ -101,7 +101,7 @@ Run 自己启动的进程还必须随附加的调试会话释放。单独发送 三个方法仅在窗口实现 `WorkspaceReadHost` 后注册。没有远程读取适配器时拒绝远程工作区,不读取本机占位目录。监听与搜索也按各自的可选宿主接口注册,遵循相同的上下文检查。 -验证使用 `scripts/desktop/desktop-go.sh test ./internal/pluginservice ./internal/workbench -run 'TestWorkspaceReads|TestPluginWorkspaceReads' -count=1`。默认构建固定到 Core `75e1480`,包含 [Core #190](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/190)、[#193](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/193)、[#194](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/194) 并保留现有 #187 增量更新依赖;无需本地覆盖路径。测试读取真实临时文件,覆盖资源隔离、磁盘与未保存文档的区别及项目关闭取消;不依赖任何具体插件。Windows 的原生目录句柄行为须在 Windows 单独验证,本机 macOS 测试不能替代。 +验证使用 `scripts/desktop/desktop-go.sh test ./internal/pluginservice ./internal/workbench -run 'TestWorkspaceReads|TestPluginWorkspaceReads' -count=1`。默认构建固定到 Core main `c6cef0b`,包含 [Core #190](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/190)、[#193](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/193)、[#194](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/194) 与 #187 增量更新;无需本地覆盖路径。测试读取真实临时文件,覆盖资源隔离、磁盘与未保存文档的区别及项目关闭取消;不依赖任何具体插件。Windows 的原生目录句柄行为须在 Windows 单独验证,本机 macOS 测试不能替代。 ### API-07/08:Core 处理搜索与监听语义,Viva 只提供原生事件 diff --git a/desktop/internal/workbench/plugintools_test.go b/desktop/internal/workbench/plugintools_test.go index f924b32c7..0e55432c4 100644 --- a/desktop/internal/workbench/plugintools_test.go +++ b/desktop/internal/workbench/plugintools_test.go @@ -34,7 +34,7 @@ func TestPluginToolWindowUsesPackageIconAcrossThemes(t *testing.T) { PluginID: "dev.lithe.test.tool-icon", ID: "dev.lithe.test.tool-icon.window", Package: directory, Icon: pluginicons.Declaration{Path: "light.svg", DarkPath: "dark.svg", Mode: mode}, } - var app App + app := App{chrome: newChromeState()} app.chrome.setItems(pluginItems([]pluginservice.ToolWindow{tool}, nil)) if err := app.pluginIcons.Read(tool.PluginID, directory, tool.Icon); err != nil { t.Fatal(err) diff --git a/docs/development/macos-plugin-api-plan.md b/docs/development/macos-plugin-api-plan.md index 8060f5f49..b2445a732 100644 --- a/docs/development/macos-plugin-api-plan.md +++ b/docs/development/macos-plugin-api-plan.md @@ -6,7 +6,7 @@ Core [#193](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/193) 已合入, [#194](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/194) 补齐原生执行前校验与默认值。 -桌面固定 Core `75e1480`,包含这两项改动,并保留既有 Core #187 增量更新依赖。 +桌面固定 Core main `c6cef0b`,包含这两项改动和 Core #187 增量更新。 桌面端接入对应的输入、预览、只读对比、输出、进度、状态项、剪贴板、文件管理器和 HTTP。 纯后端命令接入命令面板与已有快捷键目录,树支持主动刷新、展开懒加载和接近末尾自动分页。 本次不改变任何系统 API 版本;下文 `ui:4`、协议 3 等是旧客户端的历史记录, @@ -71,8 +71,8 @@ Windows 不在本轮,平台矩阵的 partial/pending 保持真实。 | API-03 | 部分完成 | 既有命令 placements 可用;Viva 已接入 statusBar/setItem 与 removeItem,按 Core 顺序呈现;通用菜单、快捷键贡献与 context.set 未做 | | API-04 | 部分完成 | didChangeContexts 与 watch 事件;文档/选区/活动编辑器语义事件未做 | | API-05 | 已公开 | listContexts/getContext/getFolders,context/generation 与 rootID | -| API-06 | 已实现,待合入 | readDirectory/stat/readFile 已由 Rust Core 执行并接入 Viva 本地工作区;逐段拒绝符号链接/reparse point,目录有界分页,磁盘读取上限 128 KiB,支持文本/base64 与截断标记。macOS 定向验证通过;默认 Core 已固定到包含 [Core #190](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/190) 与既有增量更新依赖的 `75e1480`,本轮不做 Windows 验收 | -| API-07 | 已实现,待合入 | watch 已接入 Viva 原生事件,Core 负责范围、隐藏过滤、排序去重和溢出重扫;注册先发重扫,dispose/context/session 结束释放且停止通知;macOS 真实文件事件已验证,本轮不做 Windows 验收 | +| API-06 | 已公开 | readDirectory/stat/readFile 已由 Rust Core 执行并接入 Viva 本地工作区;逐段拒绝符号链接/reparse point,目录有界分页,磁盘读取上限 128 KiB,支持文本/base64 与截断标记。macOS 定向验证通过;[Core #190](https://github.com/Lithe-IDEA/Lithe-core-rust/pull/190) 已合入,默认 Core 固定 main `c6cef0b`;Windows 验收未做 | +| API-07 | 已公开 | watch 已接入 Viva 原生事件,Core 负责范围、隐藏过滤、排序去重和溢出重扫;注册先发重扫,dispose/context/session 结束释放且停止通知;macOS 真实文件事件已验证;Windows 验收未做 | | API-08 | 已实现,精确范围未提供 | findFiles/findText 已由 Core 执行并接入 Viva;查询绑定游标、分页与 200 条总上限、取消、隐藏/索引过滤、no-follow 与磁盘编码处理;只搜磁盘,一行一条结果,range 如实为 null;macOS 定向验证通过 | | API-09 | 已公开 | documents/list/getSnapshot、editor/getActive/getSelections,含 dirty/版本/编码/EOL | | API-10 | 已公开 | applyEdits/replaceSelections/insertText;版本校验、IME/只读拒绝、一次 Undo | diff --git a/scripts/desktop/build-desktop-core.sh b/scripts/desktop/build-desktop-core.sh index 50e46f199..0b6564286 100755 --- a/scripts/desktop/build-desktop-core.sh +++ b/scripts/desktop/build-desktop-core.sh @@ -372,11 +372,12 @@ PINNED_CORE_REPOSITORY="https://github.com/Lithe-IDEA/Lithe-core-rust.git" # The plugin delta branch (#187) includes current Core main, including the # built-in file association catalog and plans (#186). It adds the pinned # companion index and verifies and reconstructs ZIPs for marketplace updates. -# Desktop integration of Core #190 (API-06/07/08) at 095d013 with the existing -# #187 delta dependency at 076ce04. Both parents remain independently reviewable; -# the pin preserves marketplace delta commands while adding workspace disk reads, -# bounded search and native-watch planning/filtering. -PINNED_CORE_REVISION="75e148091439248e5927c58790019b26de02ca87" +# Lithe-core-rust main at c6cef0b: the merge of #187 (marketplace delta updates) puts on main +# everything the integration commit 75e1480 carried for the desktop (#187, #189, #190, #193 and +# #194). It adds #196, which lets buildSystems[].run[] materialize a declared +# runConfigurationTypes kind (desktop #2382), and keeps Windows directory handles from sharing +# delete access while Core reads below them. +PINNED_CORE_REVISION="c6cef0b9f63024f99cfc447dbf205e05893f7597" PROFILE="debug" CHECKOUT_ONLY="no" while [[ $# -gt 0 ]]; do diff --git a/shared/platform-feature-matrix/features/plugin-host-editor-file-window-services.json b/shared/platform-feature-matrix/features/plugin-host-editor-file-window-services.json index 5ab04b096..597d8ac85 100644 --- a/shared/platform-feature-matrix/features/plugin-host-editor-file-window-services.json +++ b/shared/platform-feature-matrix/features/plugin-host-editor-file-window-services.json @@ -78,8 +78,8 @@ ] }, "owner": "Extensions", - "verification": "API-06–08:默认固定 Core 75e1480(含 Core #190 与既有 #187 增量更新),运行 scripts/desktop/desktop-go.sh test ./internal/core ./internal/pluginservice ./internal/workbench -run 'TestWorkspace(Reads|Find|Search|Watch)|TestPluginWorkspace' -count=1 及对应 -race 检查,验证真实文件分页、文本/二进制读取、资源封装与权限上下文隔离、dirty 文档仍读磁盘及项目关闭取消,搜索分页/查询游标/范围与磁盘隔离,以及 macOS Viva 原生监听的递归创建、原子保存、删除、调用方归属、会话/上下文释放、在途通知取消、根目录替换后的最终重扫与释放。Windows 原生验收按用户要求本轮不执行,保持 pending。API-11:scripts/desktop/desktop-go.sh test ./internal/pluginservice -run 'TestFileChanges|TestChangeError' 与 ./internal/workbench -run 'TestPlugin(Save|Create|Rename|Trash)'。两平台原生验收使用内联合成插件:读取分页目录、磁盘文件,验证链接与 .. 越界拒绝、取消和重开工作区隔离,再保存/另存为、复制、重命名打开文件、移到废纸篓并恢复;无头测试不能替代 Windows reparse point 与目录共享行为验收。验收后关闭应用并确认无残留进程。 工作流增量:macOS 执行 scripts/desktop/desktop-go.sh test ./internal/workbench ./internal/pluginservice ./internal/pluginview -run 'Test(Workflow|BrowserOpensOnlyHTTP|SessionRefresh|WorkbenchDefaultLayout)' -count=1 -timeout=45s 及同范围 -race。覆盖取消和释放、关闭上下文取消在途调用、HTTP 重定向与预算及错误脱敏、预览更新和会话隔离、只读 Diff、输出清空、进度部分更新、密码取消清理。TestVisualPluginWorkflow 生成深浅主题及中英文截图,CI 上传 plugin-workflow-visual artifact。系统 WebView、剪贴板、浏览器和文件管理器的整机验收仍待完成;Windows 本轮不验收。", - "notes": "Viva 已接通 documents/list|getSnapshot、editor/getActive|getSelections|open|reveal|insertText|replaceSelections|applyEdits、window/showInformation|showWarning|showError、browser/openExternal(HTTP(S) 地址或已保存 HTML 资源)、documents/registerContentProvider、editor/registerProviders。编辑走编辑器自己的撤销栈,整批一步,按 view 修订号做版本隔离,只读/组字/过期版本被拒。editor/open 只落光标(范围起点)。API-11(documents.save、workspace.files.write)已接通:documents/save|saveAs|close 走文档自己的保存,磁盘冲突、硬链接、未命名文档、组字被拒并返回错误码,不弹窗;workspace/create(文件、文件夹、kind:\"symlink\" 的符号链接)|rename|copy|trash 的参数由 Core 严格检查,磁盘变更由 Core 内核命令 workspace.createEntry|renameEntry|copyEntry|resolveEntry 完成(不跟随最后一段、不覆盖),窗口只负责先保存其下文档、打开的文档跟随文件移动、本地历史、项目树和系统废纸篓;Windows 上建符号链接需要开发者模式或管理员,否则返回 failed。API-06(workspace.files.read)已接通本地工作区的 workspace/readDirectory|stat|readFile:路径、隐藏规则、有界分页、no-follow 和 128 KiB 磁盘读取预算均由 Core 执行,文本/base64 与截断前缀 identity 如实返回,不读取 dirty 文档;窗口关闭或替换会取消并拒绝旧结果,remote authority 明确拒绝。API-07/08 已接通 workspace/watch|findFiles|findText:Core 复用匹配、编码和隐藏/索引规则,以 no-follow 句柄搜索磁盘、处理分页游标与监听过滤;Viva 原生事件无空闲轮询,订阅按插件/会话/上下文释放,dispose 返回前停止通知;搜索每页和总结果最多 200,精确范围为 null。macOS 真实文件与原生事件测试已通过;Windows 本轮不验收。默认 Core 已固定到 75e1480,包含本次 Core #190 改动并保留既有 #187 增量更新依赖。整体条目仍含其他未完成能力,状态保持 partial/pending。Core #193 与 #194 的工作流已接入:Markdown/HTML 资源和内联只读预览、只读文本对比、快速选择和安全输入、剪贴板、文件管理器定位、输出、进度、状态项、有界 HTTP。Core 负责参数、默认值、权限、过滤排序与预算;Viva 只做原生 I/O 和呈现。HTML 在原生 WebView 不可用时于打开标签前拒绝。浏览器资源默认 requireSaved,不自动保存。HTTP 惰性复用连接,无 Cookie jar、不跟随重定向,错误不带 URL 或正文。长期资源按插件、会话和上下文释放,不新增磁盘缓存。复杂身份验证、Cookie 提取与下载到文件不在本次范围。", + "verification": "API-06–08:默认固定 Core main c6cef0b(含 Core #190 与 #187 增量更新),运行 scripts/desktop/desktop-go.sh test ./internal/core ./internal/pluginservice ./internal/workbench -run 'TestWorkspace(Reads|Find|Search|Watch)|TestPluginWorkspace' -count=1 及对应 -race 检查,验证真实文件分页、文本/二进制读取、资源封装与权限上下文隔离、dirty 文档仍读磁盘及项目关闭取消,搜索分页/查询游标/范围与磁盘隔离,以及 macOS Viva 原生监听的递归创建、原子保存、删除、调用方归属、会话/上下文释放、在途通知取消、根目录替换后的最终重扫与释放。Windows 原生验收按用户要求本轮不执行,保持 pending。API-11:scripts/desktop/desktop-go.sh test ./internal/pluginservice -run 'TestFileChanges|TestChangeError' 与 ./internal/workbench -run 'TestPlugin(Save|Create|Rename|Trash)'。两平台原生验收使用内联合成插件:读取分页目录、磁盘文件,验证链接与 .. 越界拒绝、取消和重开工作区隔离,再保存/另存为、复制、重命名打开文件、移到废纸篓并恢复;无头测试不能替代 Windows reparse point 与目录共享行为验收。验收后关闭应用并确认无残留进程。 工作流增量:macOS 执行 scripts/desktop/desktop-go.sh test ./internal/workbench ./internal/pluginservice ./internal/pluginview -run 'Test(Workflow|BrowserOpensOnlyHTTP|SessionRefresh|WorkbenchDefaultLayout)' -count=1 -timeout=45s 及同范围 -race。覆盖取消和释放、关闭上下文取消在途调用、HTTP 重定向与预算及错误脱敏、预览更新和会话隔离、只读 Diff、输出清空、进度部分更新、密码取消清理。TestVisualPluginWorkflow 生成深浅主题及中英文截图,CI 上传 plugin-workflow-visual artifact。系统 WebView、剪贴板、浏览器和文件管理器的整机验收仍待完成;Windows 本轮不验收。", + "notes": "Viva 已接通 documents/list|getSnapshot、editor/getActive|getSelections|open|reveal|insertText|replaceSelections|applyEdits、window/showInformation|showWarning|showError、browser/openExternal(HTTP(S) 地址或已保存 HTML 资源)、documents/registerContentProvider、editor/registerProviders。编辑走编辑器自己的撤销栈,整批一步,按 view 修订号做版本隔离,只读/组字/过期版本被拒。editor/open 只落光标(范围起点)。API-11(documents.save、workspace.files.write)已接通:documents/save|saveAs|close 走文档自己的保存,磁盘冲突、硬链接、未命名文档、组字被拒并返回错误码,不弹窗;workspace/create(文件、文件夹、kind:\"symlink\" 的符号链接)|rename|copy|trash 的参数由 Core 严格检查,磁盘变更由 Core 内核命令 workspace.createEntry|renameEntry|copyEntry|resolveEntry 完成(不跟随最后一段、不覆盖),窗口只负责先保存其下文档、打开的文档跟随文件移动、本地历史、项目树和系统废纸篓;Windows 上建符号链接需要开发者模式或管理员,否则返回 failed。API-06(workspace.files.read)已接通本地工作区的 workspace/readDirectory|stat|readFile:路径、隐藏规则、有界分页、no-follow 和 128 KiB 磁盘读取预算均由 Core 执行,文本/base64 与截断前缀 identity 如实返回,不读取 dirty 文档;窗口关闭或替换会取消并拒绝旧结果,remote authority 明确拒绝。API-07/08 已接通 workspace/watch|findFiles|findText:Core 复用匹配、编码和隐藏/索引规则,以 no-follow 句柄搜索磁盘、处理分页游标与监听过滤;Viva 原生事件无空闲轮询,订阅按插件/会话/上下文释放,dispose 返回前停止通知;搜索每页和总结果最多 200,精确范围为 null。macOS 真实文件与原生事件测试已通过;Windows 本轮不验收。默认 Core 已固定到 main c6cef0b,包含 Core #190 与 #187 增量更新。整体条目仍含其他未完成能力,状态保持 partial/pending。Core #193 与 #194 的工作流已接入:Markdown/HTML 资源和内联只读预览、只读文本对比、快速选择和安全输入、剪贴板、文件管理器定位、输出、进度、状态项、有界 HTTP。Core 负责参数、默认值、权限、过滤排序与预算;Viva 只做原生 I/O 和呈现。HTML 在原生 WebView 不可用时于打开标签前拒绝。浏览器资源默认 requireSaved,不自动保存。HTTP 惰性复用连接,无 Cookie jar、不跟随重定向,错误不带 URL 或正文。长期资源按插件、会话和上下文释放,不新增磁盘缓存。复杂身份验证、Cookie 提取与下载到文件不在本次范围。", "legacy": { "revision": "5a54c41aa37a4e6e6b68918a4b05765b9dd07a36", "macos": {