Repository navigation
refactor(desktop): 删除 Core 的 Java 启动规划,run/start 临时文件支持 base64 字节 - #1859
Merged
Merged
Conversation
宿主按原样启动插件给出的命令行,不再调用 Core 的 execution.planLaunchCommand, 也不再读取 JDK 版本、按系统代码页写参数文件: - 删除 core/launch_plan.go、pluginservice/runargs.go、argfile_encoding_*.go, 以及 runs.go 里的规划分支; - core.RunStartFile 增加 Base64,宿主解码后原样写入,文本仍按 UTF-8 写入; - 新增测试:进程读到的临时文件与插件给出的文本、字节逐字节一致; - PINNED_CORE_REVISION 升到 Lithe-core-rust#23; - 功能矩阵 run-java-long-classpath 改为插件提供,资源登记改名为 run-temporary-files 并修正路径; - 新 Agent Note 记录决策,旧的超长 Java 启动命令 Note 归档。
xiaoyumuxi
marked this pull request as ready for review
November 13, 2026 16:03
24 tasks done
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
execution.planLaunchCommand,给run/start的temporaryFiles增加{name, base64}。本 PR 是它的桌面端配套,必须在 fix:修复左侧Git提交文件无法全选问题 #23 之后合入。temporaryFiles交给宿主。PR 类型 / Type
改动说明 / What changes
背景 / Why
以前,插件发起的每个非调试运行都会先经过 Core 的
execution.planLaunchCommand:java;-cp、--module-path等路径列表搬进 JDK 参数文件;release文件得到版本,再按系统 ANSI 代码页写出参数文件。这让 Core 和宿主都写死了 Java 知识。Core #23 删除了这个命令,所以桌面端也删除整条调用链。之后宿主按原样启动插件给出的命令行。命令行需要缩短时,由插件生成文件,通过
temporaryFiles交给宿主;需要特定编码或二进制内容时,用新增的base64形式。改动 / Changes
desktop/internal/core/launch_plan.go,即execution.planLaunchCommand的客户端封装。desktop/internal/pluginservice/runargs.go:读取 JDKrelease版本、写参数文件。argfile_encoding_windows.go和argfile_encoding_other.go:Windows ANSI 代码页编码,其他平台写 UTF-8。pluginservice/runs.go删除launchPlanner分支。非调试运行直接把start.Arguments交给buildprocess.Start。core.RunStartFile增加Base64字段,以及Bytes()方法:有Base64时返回解码后的字节,否则返回Contents的 UTF-8 字节。runs.go写临时文件改用Bytes()。解码失败按写入失败处理,删除临时目录,返回plugin.host.failure。Core 已经校验过 base64 和大小,所以这条路径只在 Core 与宿主对契约理解不一致时才会走到。TestRunStartWritesTemporaryFilesAsGiven。插件给出三个临时文件:含非 ASCII 字符的文本、含0x95 0x5c 0x00 0xff等非 UTF-8 字节的 base64、空的 base64。被启动的进程按${temporaryFile:<name>}读取这些文件,测试确认内容逐字节一致。core/run_start_test.go不需要改。它回放 Core 的run-start.json,已经覆盖 fix:修复左侧Git提交文件无法全选问题 #23 新增的三条拒绝用例:同时给出contents和base64、两者都不给、base64 不合法。scripts/desktop/build-desktop-core.sh的PINNED_CORE_REVISION升到 fix:修复左侧Git提交文件无法全选问题 #23 的头提交5a8e67d,注释同步更新。run-java-long-classpath两端都从implemented / pending改成plugin-provided / not-applicable。证据换成runs.go、run_start.go;验证和备注改为“由 Java 插件实现,宿主只验证temporaryFiles写入与清理”。docs/viva-migration.md中这一行的扩展点改成run/start的temporaryFiles,并指向 lithe-plugin-java#7。scripts/resources/worktree-resources.json的java-launch-temporaries改名为run-temporary-files。<system-temp>/lithe-run/launch-*.argfile|.classpath.jar改成桌面端实际使用的<system-temp>/lithe-run-<random>/,说明改成通用的插件运行临时文件。test-reuse-worktree-resources.mjs和docs/ci-builds.md同步更新。.agents/notes/implemented/architecture/2026-11-13-plugin-owned-long-command-lines.md,记录“插件缩短、宿主按字节写入”的决策和被否方案,并保留插件实现时仍要遵守的事实:只搬路径列表、Windows 用 ANSI 代码页、0x5c尾字节、JDK 8 用 classpath JAR。2026-09-20-oversized-java-launch-command.md移到archived/bug-fix/,加上归档日期和取代说明。不在本 PR 范围内 / Out of scope
ARG_MAX远大于这个长度,不受影响。shared/contracts/rust-core-api.md里还有execution.planLaunchCommand一节,它属于shared/契约副本,由 [Feature] 应用契约与 fixture 在本仓库 shared/ 与 Core rust/ 各存一份且已分叉:以 Core 为唯一来源,桌面测试读取所链接的 Core 检出 #1853 统一删除。PINNED_CORE_REVISION要改成 Coremain上的 squash 提交,再把本 PR 标记为 ready。类型专属:fix
复现与根因
execution.planLaunchCommand,桌面端不能再调用它。runargs.go、argfile_encoding_*.go)。desktop/internal/pluginservice。检查项
TestRunStartWritesTemporaryFilesAsGiven覆盖新的 base64 写入路径;在旧 pin 的 Core 上,base64字段会被拒绝。git grep搜索launchPlanner、planLaunch、launchArguments、PlanLaunchCommand、ArgumentFile、runargs、argfile_encoding,在desktop/、scripts/、docs/、.agents/(不含归档)中 0 命中。shared/contracts/rust-core-api.md的命中由 [Feature] 应用契约与 fixture 在本仓库 shared/ 与 Core rust/ 各存一份且已分叉:以 Core 为唯一来源,桌面测试读取所链接的 Core 检出 #1853 删除。.agents/notes/implemented/bug-fix/记录:这是边界决策,记录在implemented/architecture/2026-11-13-plugin-owned-long-command-lines.md,旧的 bug-fix Note 已归档。范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/run-java-long-classpath.json:两端改为plugin-provided / not-applicable,证据、验证和备注同步修改./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh和./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/preview HEAD.artifacts/下生成的矩阵视图统一日志系统 / Structured logging
N/A:没有新增或改动日志事件。删除的规划分支没有日志;写入失败沿用原有的
plugin.host.failure返回。界面文案 / i18n
N/A:没有用户可见文案。删除的
the run's argument file cannot be written是返回给插件的宿主错误消息,不是界面文案。逻辑归属 / Logic placement
temporaryFiles的个数、名字、大小、base64 校验都在 Core 的run.decodeStart,契约和 fixture 在 fix:修复左侧Git提交文件无法全选问题 #23;桌面端只做解码和写盘java分支性能与内存 / Performance and memory
N/A:没有新增后台功能、子进程或缓存。非调试运行少了一次 Core 调用和 JDK
release文件读取。设置 / Settings
N/A:没有设置改动。
插件契约 / Plugin contract
PINNED_CORE_REVISION已升到包含该契约的 Core 提交5a8e67d4b73f5e633e67dc09e722c3b22b47b280;本地测试用LITHE_CORE_RUST_DIR指向同一提交的检出node shared/plugins/scripts/sdk-e2e.mjs:Java 2、Node 3、Rust 2,全部通过(记录在 fix:修复左侧Git提交文件无法全选问题 #23)lithe/host/run/start(temporaryFiles[].base64)发行包与资源 / Bundle and resources
os.MkdirTemp("", "lithe-run-")创建的系统临时目录,运行结束、启动失败或 Core 拒绝后删除;已运行./scripts/desktop/verify/verify-runtime-bundle-immutability.shscripts/resources/worktree-resources.json、test-reuse-worktree-resources.mjs和docs/ci-builds.md。reuse-worktree-resources.mjs按注册表里的excludedResources统一拒绝,不需要单独路由无用代码与重构 / Dead code and refactoring
runs.go的规划分支refactor标签的 Issue:[Feature] Core 剩余的语言专属默认值(忽略目录、索引排除、go/node 运行时、运行发现、行注释表)改由插件注入 #1856、[Feature] 清理 hostIntegration 的不可达实现:集成名单为空,下游校验、计划输出和构建来源分支都执行不到 #1857、[Feature] 清理旧 macOS Swift 客户端遗留:只在测试中使用的 Swift 位置适配器与无读者的内置模块清单 #1858验证 / Verification
所有命令都在 macOS(Apple Silicon)上运行,
LITHE_CORE_RUST_DIR指向 #23 头提交5a8e67d的检出。./scripts/desktop/desktop-go.sh vet ./internal/core/ ./internal/pluginservice/./scripts/desktop/desktop-go.sh test -race ./internal/core/ ./internal/pluginservice/./scripts/desktop/desktop-go.sh test ./..../.agents/skills/write-stable-tests/scripts/test-stability-macos.sh --package ./internal/pluginservice -- --filter 'TestRunStart'./.agents/skills/write-stable-tests/scripts/verify-test-stability.sh --base origin/preview(静态检查)./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/preview HEAD./scripts/agent-notes/verify-agent-notes.shnode scripts/i18n/verify-app-language-localization.mjsnode scripts/i18n/generate-i18n.mjs --check./scripts/desktop/verify/verify-runtime-bundle-immutability.shnode scripts/resources/test-reuse-worktree-resources.mjs未能执行的检查和原因:
desktop-go.sh test。argfile_encoding_windows.go删除后,pluginservice没有剩下 Windows 专属代码。Draft 状态只跑 Linux 检查,标记 ready 后的完整 CI 会覆盖 Windows 编译和测试。提交前确认 / Final checks
preview(170ad19e6)创建,目标分支preview