Repository navigation
feat(plugin-api): 接通工作区读取、搜索与原生监听(API-06/07/08) - #2369
Merged
Merged
Conversation
5 tasks done
xiaoyumuxi
marked this pull request as ready for review
November 23, 2026 19:08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
关联 Issue / Linked issue
9ab2336e8ca651e40baa5e65848b717b26f69e43,同时包含 [Feature] 想要支持直接终端在文件展示的界面打开的那种形式 #190 与桌面端原先已依赖的 Core #187 插件增量更新。[Feature] 想要支持直接终端在文件展示的界面打开的那种形式 #190 保持独立;[Bug] Windows preview 0.3.0 编辑器持续卡顿:每键全文同步、Git blame 与 LSP 轮询 #187 尚未合入,集成分支仅用于保留现有依赖并提供可抓取的完整 SHA。[Feature] 想要支持直接终端在文件展示的界面打开的那种形式 #190 的 squash 合入树与其分支最终树一致。PR 类型 / Type
改动说明 / What changes
背景 / Why
Viva 桌面端尚未注册插件的目录/文件读取、工作区搜索和文件监听,插件申请相应权限会被拒绝。先由 Core #190 实现规则、执行命令与公共契约,本 PR 再把六个方法接入窗口和插件后端会话。
改动 / Changes
workspace/readDirectory、workspace/stat、workspace/readFile。Go 只把已授权的根目录与请求交给 Core,再把相对路径封装成调用插件自己的资源标识;目录分页、隐藏规则、逐段拒绝链接、128 KiB 读取预算、UTF-8/base64 与截断前缀 identity 均由 Core 决定。workspace/findFiles、workspace/findText。使用 Core 的有界分页、查询绑定游标、匹配/解码/隐藏/索引排除策略与磁盘读取,每页及连续分页总结果最多 200 条;文本结果按行返回,精确范围如实为null。workspace/watch,复用 Viva 原生WatchTree,没有空闲轮询。Core 校验范围并过滤原生批次;注册时核对根与目标身份,先发送一次重扫;根删除或替换后发送最终重扫并释放旧流。dispose先取消在途通知再关闭原生句柄,返回后停止投递;项目关闭、会话结束及插件停用均回收。WorkspaceWatchIssue回调进入现有统一日志,事件投影热路径不逐条输出 INFO。LITHE_CORE_RUST_DIR覆盖重新运行 macOS 定向竞态测试。不在本 PR 范围内 / Out of scope
远程工作区读取/搜索/监听没有适配器,返回明确拒绝;不搜索未保存缓冲区,不补造文本精确范围。搜索按页重新遍历磁盘,不新增常驻内容索引,大工程可能触发超时。聚合矩阵中原有
preview/openHTML和 resource 形式的外部浏览器等未完成能力仍保留原状态。本轮按要求不执行 Windows 原生验收;没有新增窗口、布局或设置。类型专属:feat
多平台对齐
pending,不声称原生行为已通过。范围检查 / Scope checks
功能矩阵 / Feature matrix
plugin-host-editor-file-window-services.json的两端证据、API-06/07/08 行为、固定依赖和验证动作。聚合条目还有其他缺口,因此整体保持partial/pending;Windows 未验收的事实已写明。verify-platform-feature-matrix-change.sh origin/main HEAD,变更门禁通过。.artifacts/中的矩阵视图。插件归属 / Plugin ownership
UI 验证 / UI evidence
N/A:没有布局、控件、样式、界面文案、菜单、弹窗或可见交互状态改动,无需 UI 截图。
统一日志系统 / Structured logging
backgroundFailedIn;新增记录回调已在唯一生产构造处接线,Core 返回错误仍由处理边界记录。watchEvents按热路径处理,文件事件不逐项 INFO 输出。TestEveryLoggedEventIsAcceptedByTheKernel已验证。界面文案 / i18n
N/A:未新增宿主界面文字或插件文案;仍运行应用语言检查与生成一致性检查,中英均为 12628/12628。
逻辑归属 / Logic placement
性能与内存 / Performance and memory
设置 / Settings
N/A:无设置项、设置页或配置来源变化。
插件契约 / Plugin contract
PINNED_CORE_REVISION已更新到包含契约的9ab2336e8ca651e40baa5e65848b717b26f69e43;默认 wrapper 已验证读取同一份 Core fixture。workspace/readDirectoryworkspace/statworkspace/readFileworkspace/watchworkspace/findFilesworkspace/findText发行包与资源 / Bundle and resources
.artifacts/desktop生命周期。无用代码与重构 / Dead code and refactoring
验证 / Verification
env -u LITHE_CORE_RUST_DIR ./scripts/desktop/desktop-go.sh test -race -count=1 -timeout=120s ./internal/core ./internal/pluginservice ./internal/workbench ./internal/pluginhost ./cmd/lithe -run 'Test(Workspace|PluginWorkspace|MarketplaceSourceFixture|EveryLoggedEventIsAcceptedByTheKernel|HostServicesGrantWhatIsServed)'./.agents/skills/write-stable-tests/scripts/test-stability-macos.sh --package ./internal/core --package ./internal/pluginservice --package ./internal/workbench -- --filter 'TestWorkspace(Reads|Find|Search|Watch)|TestPluginWorkspace'(实现阶段使用包含本改动的本地 Core)-race通过cargo test ... -p lithe-plugin-marketplace delta::tests./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh/verify-platform-feature-matrix-change.sh origin/main HEAD./scripts/agent-notes/verify-agent-notes.shnode scripts/i18n/verify-app-language-localization.mjs/generate-i18n.mjs --check./scripts/desktop/verify/verify-runtime-bundle-immutability.sh./.agents/skills/write-stable-tests/scripts/verify-test-stability.sh --base origin/maingit diff --check逐项报告在本机
.artifacts/test-stability/index.html与对应 HTML/JSON/JUnit,已检查且不提交产物。较慢的相关用例为监听父用例约 470 ms、dirty 文档工作台用例约 300 ms、根替换约 120 ms;测试时间只用于稳定性检查。**未能执行的检查和原因:**按本轮范围没有运行 Windows 原生验收,没有重跑全桌面
test ./...或全 Core workspace,其余交 CI。整机性能基线、旧共享契约/Core/日志使用专用门禁缺失的限制如上,不记为通过。本轮没有打开完整 Lithe 窗口,因此组件和真实原生文件事件测试不代表整机 UI 验收。提交前确认 / Final checks
origin/main(913661835),目标为main。