Repository navigation
feat(sdk): 三种 SDK 增加原生终端与 reopen API - #14
Merged
Merged
Conversation
xiaoyumuxi
marked this pull request as ready for review
November 2, 2026 09:31
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.
问题与结果
工具插件需要调用 Lithe 已有原生终端,减少 Docker 等交互客户端的手动 Shell 操作。本 PR 为 Node、Java、Rust 三个官方 SDK 同时增加
terminal.create/show/close/reopen/dispose/onExit封装,并将插件契约完整同步到已合并的宿主 1lck/Lithe-IDEA#1653:f64d262c48f1ff5ad1778b301138596493a09ad5。改动
close可设置retainedContextBytes:默认 16 KiB,最高 256 KiB,0 不保留。reopen以保存的 argv 启动新进程,只恢复显示文本,terminalID 不变、generation 递增,不重放输入或恢复旧 Shell 内存。dispose释放句柄与历史。node scripts/contract.mjs sync --revision f64d262c48f1ff5ad1778b301138596493a09ad5 --checkout <Lithe checkout>生成契约副本和锁文件;77 个文件已逐字节比对上游,未手改 contract/v1。show:false不改变当前终端选择/不抢焦点,以及自然退出和用户关标签后先清理、只留有界快照、释放原生 session/render buffer 再通知的语义。terminal.create;终端跨进程场景纳入默认node scripts/sdk-e2e.mjs,移除合并前LITHE_PLUGIN_SDK_TERMINAL_E2E临时开关和运行时修改示例清单的做法。验证
本地已对最终合并宿主重新验证:
contract.mjs verify、verify --upstream、77 文件逐字节比对通过。node scripts/sdk-e2e.mjs针对新 pin 全部通过:三个 SDK 示例后端及原有 build/test/run/VCS 场景,加上 Rust 终端 create → onExit → close → reopen → dispose 的真实 Core 协议链路。端到端场景在协议边界扮演宿主应答,不把响应数据冒充真实 PTY 验收;实际 PTY 输入、历史不重放及中文/emoji/0 字节截断在已合并宿主的原生测试验证。
范围
宿主 #1653 已合并,契约同步已完成。当前未修改 SDK 版本、打标签或发布包,也不包含 Docker 插件按钮接入。Windows/remote 的终端 handler 尚未实现,旧宿主没有 terminal.create 权限时会拒绝声明该权限的示例插件;未声明它的其他插件保持原有兼容性。