origin/staging当前 Marketplace 和插件 entry 的 github、git、legacy url、git-subdir 来源最终都会
进入 execFile("git", ...)。这使插件管理能力隐式依赖运行 ZCode Agent 的主机已安装 Git:
已安装插件的启动发现、启停和会话注入只读取本地 installed cache,本身不需要 Git。问题属于 “远端来源物化”边界的设计缺口,不应通过在 UI、Desktop main 或 relay 增加特殊分支解决。
github.com HTTPS Marketplace 和插件来源,在系统没有 Git 时仍可刷新、
校验、describe、安装和更新。sha256,GitHub Archive 绑定 Git sha / commit / ref。Settings / CLI command
|
v
plugins protocol -> workspace Agent Host (local / SSH / WSL / Docker)
|
v
source classifier
|
+-- public github.com HTTPS / github shorthand
| |
| v
| pin = sha/commit > ref > HEAD
| |
| v
| GitHub Archive REST zipball (HTTPS -> codeload redirect)
| |
| v
| bounded download -> secure extract -> semantic validation
|
+-- private/auth/SSH/non-GitHub/submodule/LFS
|
v
system Git
|
+-- unavailable -> structured actionable diagnostic
validated source tree
|
v
same-volume staging copy
|
v
write transaction marker
|
v
target -> backup ; staging -> target ; authority JSON writes transactionId
| | |
+------ failure ----------+--> backup -> target rollback
|
v
finalize removes backup + marker
|
+------ process exit -----> next read cross-checks authority generation
startup / discovery / enable / session injection
|
+----------------------------> installed cache only (no HTTP, no Git)
以下来源在仓库 URL 可规范化为 https://github.com/<owner>/<repo>[.git],且 Marketplace
没有声明 sparsePaths 时优先使用 Archive:
{source:"github", repo, ref?, path?};{source:"git", url, ref?, path?};{source:"github"}、{source:"git"}、{source:"url"}、
{source:"url", type:"git"}、{source:"git-subdir"}。只接受 github.com / www.github.com 的 HTTPS URL 和 owner/repo shorthand。SSH、git://、
带 userinfo 的 URL、其他 host 不进入 Archive 路由。仓库 URL 必须恰好解析出 owner 和 repo,拒绝
额外的 tree/blob 页面路径。
Archive ref 选择顺序固定为:
source.sha || source.commit || source.ref || "HEAD"
sha / commit 是 Git 对象身份;ref 和 HEAD 可能随远端变化。它们都不等于 ZIP 字节的
SHA-256,不能写入或复用 sha256 字段。
以下来源保留系统 Git:
sparsePaths 的 Marketplace;Archive 尚未实现与 Git sparse checkout 等价的路径投影,
不能先下载整仓而破坏既有大仓库可用性;Archive 的超时、连接失败、5xx、限额或安全校验失败不自动改走 Git,以免把同一网络/恶意包错误 重复执行成另一条不可预测路径。只有“需要 Git 语义/认证”的分类才 fallback。
系统 Git 不存在时诊断码为 plugin_git_unavailable,消息必须说明:来源、为什么该来源需要 Git,
以及在当前 Agent Host 安装 Git或改用公开 GitHub HTTPS/显式 ZIP 的恢复办法。
GitHub Archive 使用官方 repos/{owner}/{repo}/zipball/{ref} REST endpoint,并复用
zip-source.ts 的底层 HTTP ZIP materializer:
path;sparsePaths 不进入 Archive 路由,继续由系统 Git sparse checkout 执行。显式 {source:"url", type:"zip"} 继续强制 sha256。GitHub Archive 不要求 archive SHA-256,
但若 source 提供 commit pin,则下载 URL 必须绑定该 commit。
Marketplace snapshot 与 installed plugin cache 共用以下目录提交协议:
prepare: target parent/.<name>.stage-XXXXXX
validate: stage 内 manifest、目标 path、版本和兼容检查通过
intent: 写入 .<name>.transaction.json(owner + transactionId + authorityPath)
commit: target -> .<name>.backup
stage -> target
state: known/installed JSON 记录同一 cacheTransactionId
cleanup: 删除 backup 和 transaction marker
rollback: 第二次 rename 失败时 backup -> target
recovery: authority 含 transactionId 则保留 target,否则恢复 backup
known_marketplaces.json / installed_plugins.json 中的同一
cacheTransactionId 为提交判据:存在则保留新 target,不存在则恢复旧 backup(首次安装则移除
尚未提交的新 target);known_marketplaces.json、installed_plugins.json、Marketplace manifest 与 installed cache
的同步读取入口都会解析可读代际,因此活跃提交和进程退出窗口都不会被解释为来源或插件被删除;KnownMarketplaceRecord 增加可选 lastRefreshFailure:
interface MarketplaceRefreshFailure {
code: "plugin_git_unavailable" | "plugin_archive_fetch_failed" | "plugin_marketplace_invalid";
message: string;
failedAt: string;
}
lastUpdated、pluginCount 和 snapshot;lastRefreshFailure,更新 lastUpdated;plugins/overview 返回 failure,使 UI 重载/重启后仍能展示,而不是只保留一次 toast;zcodePluginMarketplaceSummarySchema 增加可选 refreshFailure,不破坏旧 Agent payload;plugins/marketplace/update 使用现有 optional diagnostics 返回部分失败;refreshFailure;部分失败返回 false、写入共用 store 错误态,并在 Marketplace source 行展示
message/failedAt;批量刷新即使部分失败也要展示已成功更新的来源;usePlugins 即使退役也不能
把 error diagnostic 报告为成功;plugin_git_unavailable、plugin_archive_fetch_failed;其他 manifest/依赖错误继续使用
现有诊断码。workspaceIdentity / remoteSessionId 选择权威 Agent,不创建独立 runtime;continuous 与 mobile replayable session/task delivery。先写失败测试,再实现:
sha/commit > ref > HEAD URL 选择与 plugin path / git-subdir 解析;plugin_git_unavailable;sparsePaths 的公开 GitHub Marketplace 不发 Archive 请求,保留系统 Git sparse 路由;.gitattributes 的 LFS 规则时必须 fallback Git;pnpm typecheck、pnpm lint,再做真实公开 GitHub smoke。对应生命周期 case:PLM-LC-011 no-git-github-archive、
PLM-LC-012 isolated-refresh-atomic-cache。