Repository navigation
fix(terminal): 保留控制台原始字节并兼容 Windows GBK - #128
Merged
Merged
Conversation
- outputStyle.decode 接受 base64 字节与编码策略,按行先试 UTF-8,再试声明编码和系统代码页对应的编码;未完成的行在 state 里保留字节,响应 open 给出暂定解码 - 新增 outputEncoding.resolve:返回策略的候选编码和全部可选编码,供设置页显示“自动(实际值)” - run/start 的 process 与 lithe/build/prepareRun 的结果可带 outputEncoding,Core 规范成编码 id,不能按行解码的编码被拒绝 - 新增 output-encoding-v1.json fixture、契约 README、API 总表、后端与构建指南说明 Refs 1lck/Lithe-IDEA#2186
xiaoyumuxi
marked this pull request as ready for review
November 20, 2026 05:09
This was referenced Nov 20, 2026
xiaoyumuxi
added a commit
that referenced
this pull request
Nov 20, 2026
* fix(toolchain): 外部安装的多入口链接保留布局里的文件名 rustup 把 ~/.cargo/bin/cargo、rust-analyzer 链接到自身,按启动时的名字决定运行哪个工具。 Core 校验外部安装后返回规范路径,把 cargo 解析成 rustup,版本探针运行的是 rustup, cargo 因此永远找不到。 布局文件链接到另一个文件名时,返回规范主目录下的布局路径;链接目标的类型、可执行位和 不越出主目录、不进入工作区的检查不变。同名链接(版本管理器别名等)仍返回规范路径。 顺带把已合入的 #112、#127、#128、#130、#133 从协议更新记录的“待合入”移到时间线。 * docs(plugins): 协议更新记录登记 #135
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
背景 / Why
程序向管道写 GBK 时,宿主把原始字节作为 JSON 文本传入 Core,非法 UTF-8 会先变为 U+FFFD,Core 无法恢复中文。一个控制台还可能交替收到 UTF-8 和 GBK 行,需要保留字节并逐行解码。
改动 / Changes
outputStyle.decode保留已有text请求,新增 base64bytes、编码策略和独立open预览;Core 按 CR/LF 分行后解码,保留跨块字符和 ANSI 样式。未结束行、请求、输出行和样式数量继续有界。windows: true在某行 UTF-8 校验失败后尝试 GBK;平台由调用方作为数据传入,不读取系统语言/ANSI 代码页。固定设置优先;自动模式先尝试插件显式声明,然后 UTF-8、Windows GBK,并去重。encoding_rs提供 18 种兼容 ASCII 的编码及别名;固定其他编码只影响显式选择。拒绝 UTF-16、未知 ID 和未知策略字段;候选均不合法时选择替换字符最少者,平手按候选顺序。outputEncoding.resolve,设置界面和实际解码使用同一候选与可选编码列表。run/start的process.outputEncoding?和 API-29 提供者lithe/build/prepareRun返回的outputEncoding?经 Core 校验、规范化后交给宿主。字段可省略,沿用现有能力版本;不改子进程参数或终端代码页。不在本 PR 范围内 / Out of scope
桌面桥接和设置页在配套桌面 PR。Java/Maven/JVM 专属启动参数、终端代码页调整不在本次范围。
类型专属:fix
复现与根因
B9 B9 BD A8(GBK“构建”)作为 Go JSON 文本发送会先被替换;修复后原始字节穿过 JSON,Windows 策略返回“构建”。UTF-8 与 GBK 的不同日志行独立解码。范围检查 / Scope checks
功能矩阵 / Feature matrix
N/A:矩阵在配套桌面 PR 更新;Core 仓库不复制宿主矩阵。
插件归属 / Plugin ownership
UI 验证 / UI evidence
N/A:Core 无视图,桌面 PR 附两端设置页截图。
统一日志系统 / Structured logging
界面文案 / i18n
N/A:本 PR 无界面文案;错误使用已有结构化错误码。
逻辑归属 / Logic placement
encoding_rs,无工具名特判。性能与内存 / Performance and memory
设置 / Settings
N/A:设置呈现在配套桌面 PR;本 PR 提供真实候选解析。
插件契约 / Plugin contract
pluginAPIVersion0 和litheBuild0/1。node shared/plugins/scripts/verify-docs.mjs、sdk-e2e.mjs通过,四官方 SDK 共 12 项端到端通过。run/startprocess.outputEncoding?声明进程输出编码lithe/build/prepareRunoutputEncoding?outputStyle.decode(Core 内部命令)outputEncoding.resolve(Core 内部命令)发行包与资源 / Bundle and resources
N/A:无运行时资源路径或打包修改。
无用代码与重构 / Dead code and refactoring
验证 / Verification
cargo fmt --manifest-path rust/Cargo.toml --all -- --checkcargo test --manifest-path rust/Cargo.toml -p lithe-terminal -p lithe-build -p lithe-corenode shared/plugins/scripts/sdk-e2e.mjsverify-rust-core-comments.sh terminal build corenode scripts/rust-core/verify-platform-tests.mjsnode shared/plugins/scripts/verify-docs.mjs未能执行的检查和原因: CI 受影响 crate 选择器因共享 fixture/contracts 选择整个 workspace,本地只跑直接受影响的三个 crate,其余交给 Draft CI。未运行完整应用窗口、原生 GPU/RSS 基线;同一行混用编码或 GBK 恰好也是合法 UTF-8 无法可靠自动识别,需显式设置/声明。
提交前确认 / Final checks
origin/main,目标main。