Repository navigation
refactor(core): 拆出 protocol、network、terminal、process、diff、github 基础 crate,keymap 与 action_search 并入 core-rules - #27
Merged
Conversation
…rate,keymap 与 action_search 并入 core-rules - lithe-protocol:响应信封、错误码、取消和 JSON 唯一键解析,lithe-core 原样重新导出 - lithe-network、lithe-terminal、lithe-process、lithe-diff、lithe-github:从 lithe-core 原样搬出的叶子模块 - keymap.parseContext/evaluateContext/analyzeConflicts、keymap.schemes.reduce、search.actions 移入 lithe-core-rules,分发表统一走 rules_response - AiError、RuleError 到 CoreError 的转换改为 protocol::ai_error、protocol::rule_error(孤儿规则) - lithe-core 去掉 similar、unicode-normalization 依赖;契约文档注明新增的 core-rules 命令 命令名、C ABI、JSON 字段和错误码都不变。
xiaoyumuxi
marked this pull request as ready for review
November 13, 2026 17:37
This was referenced Nov 13, 2026
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.
关联
protocol::CoreEvent,以及 4 处仍提到已删除客户端的注释)。rust/logging/README.md第十、十二节仍按脚本存在描述)。这个 PR 做什么
1. 新增 6 个 crate
都放在
rust/crates/下,代码从 lithe-core 原样搬出,只做了可见性和导入路径调整:crates/protocolCoreResponse/ResponseData、CoreError/ErrorCode、取消cancellation、JSON 唯一键解析json_documentcrates/networknetwork.proxyPolicy代理策略归一化crates/processprocessLifecycle.resolve/inventory/settle进程生命周期决策crates/terminalterminal.parseLinkTarget终端链接识别crates/diffdiff.compareTexts、行配对和行内差异crates/githubgithub.pullRequestCheckoutPlan拆分后的依赖关系:
这 6 个 crate 互不依赖(除了都依赖 lithe-protocol),可以和 lithe-core 的其他依赖并行编译。lithe-core 的源码从 185 784 行减到 180 358 行。
2. keymap 和 action_search 移入 lithe-core-rules
这些命令都是纯规则,没有 I/O,和已经在 lithe-core-rules 里的
keymap.modifierGestureStep属于一类:keymap.parseContext、keymap.evaluateContextcore-rules/src/keymap/context.rskeymap.analyzeConflictscore-rules/src/keymap/bindings.rskeymap.schemes.reducecore-rules/src/keymap/schemes.rssearch.actionscore-rules/src/action_search.rs*_json(payload) -> Result<Value, RuleError>适配函数,并登记到dispatch.rs的COMMANDS。已有测试every_rules_crate_command_is_routed_by_core会检查每个登记的命令都能被 lithe-core 解析。rules_response,替换原来的agent_response命名。details和错误码保持原样。比如keymap.schemes.reduce的invalid_name、duplicate_name等 details 不变。unicode-normalization依赖跟着 action_search 移到 lithe-core-rules。3. lithe-core 的调整
protocol模块改为在 lithe-protocol 之上补充请求解析(CoreCommand)、领域响应模型和事件,并原样重新导出CoreError、CoreResponse、ErrorCode、ResponseData、invalid_relative_path。lithe-core 的公开 API 不变。CoreError实现From<AiError>和From<RuleError>,所以改成两个显式函数protocol::ai_error、protocol::rule_error,映射关系一一对应,和原来相同。similar(移到 lithe-diff)和unicode-normalization依赖。rust/contracts/rust-core-api.md:移入 core-rules 的 5 组命令,在正文和命令表中注明 “lives inrust/crates/core-rules”,写法和已有的keymap.modifierGestureStep一致。拆分时补的文档
新 crate 根导出的项会受注释门禁的
-D missing_docs检查。下面这些原来在 lithe-core 内部、可见性只到 crate 级的字段和变体,这次补了英文文档:lithe-diff 14 处、lithe-network 17 处、lithe-github 2 处、lithe-terminal 1 处,以及cancellation::cancel。不动的部分
rust/crates/*,新 crate 自动接受检查,不需要改脚本。验证
cargo fmt --all --check:通过。cargo check --workspace --all-targets:没有警告。cargo test --workspace:1933 passed / 0 failed,和拆分前相同。scripts/rust-core/verify-rust-core-comments.sh:通过。capabilities.rs:24的private_intra_doc_links警告是原有问题,记在 [Feature] 清零 lithe-core 在 rustc 1.96 下的 84 条 clippy 告警 1lck/Lithe-IDEA#1864。node shared/plugins/scripts/verify-docs.mjs:通过。node shared/plugins/scripts/sdk-e2e.mjs:Node、Java、Rust 三个 SDK 和构建场景全部通过。cargo clippy -p <crate> --all-targets:lithe-protocol、lithe-network、lithe-process、lithe-terminal 没有告警。lithe-diff 2 条、lithe-github 1 条、lithe-core-rules 的 keymap 2 条是随代码移过来的原有告警,已在 [Feature] 清零 lithe-core 在 rustc 1.96 下的 84 条 clippy 告警 1lck/Lithe-IDEA#1864 更新位置。lithe-core-rules 的modifier_gesture.rs那 1 条仍记在 [Bug] rustc 1.96 下 lithe-git-host、lithe-core-rules 出现 3 条新 clippy 告警 1lck/Lithe-IDEA#1789。