Repository navigation
feat(plugin-api): 实现工作区读取、搜索与监听规划(API-06/07/08) - #190
Merged
Merged
Conversation
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
PR 类型 / Type
改动说明 / What changes
插件的六个工作区宿主方法已有公共名称和授权,但桌面端缺少可复用的 Core 执行能力。本 PR 先实现本地磁盘读取、搜索和监听事件规划,平台层随后只需提供上下文、原生文件事件和订阅生命周期。
workspace.readDirectory、workspace.stat、workspace.readFile内核命令。目录按 UTF-8 名字稳定分页,单次文件读取最多 128 KiB;明确返回 UTF-8 或 base64、截断标记与已读取前缀的 SHA-256 identity,不读取编辑器的未保存内容。workspace.watchPlan、workspace.watchEvents。Core 校验监听范围,对原生事件做隐藏过滤、排序去重,并在事件丢失、上限溢出或范围无法确认时要求重新扫描。监听由桌面端原生适配器实现,无空闲轮询。workspace.findFiles、workspace.findText。复用现有匹配器、文本解码和隐藏/索引排除策略,以有界 no-follow 遍历搜索磁盘,查询绑定游标,每页及连续分页总结果最多 200 条,支持取消和 30 秒预算。lithe-platform实现持有目录句柄的逐段读取:Unix 使用openat/O_NOFOLLOW;Windows 拒绝 reparse point,并在读取期间持有禁止写入/删除共享的祖先句柄。pluginAPIVersion: 0。watchEvents不逐批记录请求里程碑,避免文件事件形成日志热点。宿主方法(行为及执行补充)
workspace/readDirectoryworkspace/statworkspace/readFileworkspace/watchworkspace/findFilesworkspace/findText范围与限制
range: null。isTruncated。验证 / Verification
以下均在 macOS 运行;命令中的 crate 选择与过滤只覆盖本次改动及直接消费者。
cargo test --manifest-path rust/Cargo.toml -p lithe-projectcargo test --manifest-path rust/Cargo.toml -p lithe-plugin-rpcworkspace_read/workspace_find_watch定向测试scoped_read定向测试cargo fmt --manifest-path rust/Cargo.toml --all --checkcargo clippy --manifest-path rust/Cargo.toml -p lithe-project -p lithe-plugin-rpc -p lithe-core --all-targets -- -D warningsscripts/rust-core/verify-rust-core-comments.sh project platform plugin-rpc corenode scripts/rust-core/verify-platform-tests.mjsnode scripts/rust-core/affected-crates.mjsnode shared/plugins/scripts/verify-docs.mjstest:typesnode shared/plugins/scripts/sdk-e2e.mjs-race测试**未执行或未完成的检查:**没有运行 Windows 原生工作流及全 workspace 测试。非编辑器整机性能基线入口已随旧客户端移除,本次未验证原生窗口/GPU/RSS 的前后基线,测试耗时不作为性能结论。旧共享契约、Core 与日志使用专用门禁已移除,缺失门禁不记为通过;现有契约 fixture、文档、注释与日志目录检查已通过。
提交前确认 / Final checks
origin/main(289af38)创建并保留独立 API 分支,不混入桌面当前依赖的 Core feat(plugin-marketplace): 验证并重建插件增量包 #187。5fa6f5875ee8a1fe5140a44e84d29dae2ce6d6fb),合入树与已验证的最终分支树一致。桌面端固定9ab2336,保留其原有 Core feat(plugin-marketplace): 验证并重建插件增量包 #187 增量更新依赖并加入本 PR;默认 pin 的 macOS 定向竞态测试已通过。