fix(upstream-skills): load node-tar at the first download

The base bundle row made the experimental Web preview's browser worker
import this package, and evaluating node-tar there fails, so the row did
not activate and preview-boot.e2e.ts reported console errors. The archive
reader now imports node-tar when a download starts.
This commit is contained in:
gengruilin committed 2026-11-17 14:56:06 +08:00
1 parent 88e5e057f0
commit 8b251cdbea
4 files changed
+6 -3

No files matched your search

@@ -45,8 +45,8 @@
en: 2a09699bc1130758
zh: 972fc624936c8c2f
/deepseek-ai-dsh-upstream-skills/known-limitations-and-deferred-work:
en: 06445918386e4553
zh: e1f712e2983bb015
en: 31293ef35d3c40da
zh: db7b8e190085008e
/deepseek-ai-dsh-upstream-skills/known-limitations-and-deferred-work/dev-note:
en: e67f633dc6fe7773
zh: e88aeb617ffb74ea
@@ -146,6 +146,7 @@ A load that finds the files in place lists the entry in the session's first cata
- Published directories stay in `$DSH_HOME/cache/<name>` after a plugin pins another commit and after the plugin is removed; nothing prunes them. A process that exits while it writes a download leaves its `.skills-<digest>-<uuid>` staging directory there too.
- Only the published directory's existence is checked. When files inside it are deleted or changed, the entry skill stays listed over them; deleting the directory makes the next check or load download the pin again.
- File modes are not kept, so an upstream script is not executable; the current upstream guides run their scripts through `python3`.
- In the experimental Web preview, which runs Host plugins in a browser worker, the Service loads but node-tar does not, so every download fails there.
<a id="dev-note"></a>
### Dev Note
@@ -146,6 +146,7 @@ Service 按顺序从每个 `skillsUrls` 前缀下载 `<前缀>/<owner>/<reposito
- 插件改为固定其他提交后,以及插件卸载后,已发布的目录仍留在 `$DSH_HOME/cache/<name>` 中,没有任何清理。进程在写入下载内容时退出,也会在那里留下它的暂存目录 `.skills-<摘要>-<uuid>`。
- 只检查已发布的目录是否存在。目录里的文件被删除或改动后,入口技能仍会基于这些文件列出;删除该目录后,下一次检查或加载会重新下载固定的提交。
- 不保留文件权限,上游脚本不可直接执行;目前的上游子指南都通过 `python3` 运行脚本。
- 实验性 Web 预览把 Host 插件运行在浏览器 worker 中:服务可以加载,但 node-tar 无法加载,因此那里的每次下载都会失败。
<a id="dev-note"></a>
### 开发备注
@@ -6,7 +6,6 @@ import { dirname, join } from 'node:path'
import { Readable } from 'node:stream'
import { pipeline } from 'node:stream/promises'
import type { ReadableStream } from 'node:stream/web'
import { t as list } from 'tar'
import type { UpstreamSkillSelection, UpstreamSkillSet } from './types.ts'
/** Entry types read as regular files. */
@@ -38,6 +37,8 @@ export async function readArchive(archive: Readable, selection: UpstreamSkillSel
failure ??= error
archive.destroy(failure)
}
// Loaded at the first download: the experimental Web preview's browser worker cannot evaluate node-tar, and the Service loads there.
const { t: list } = await import('tar')
const parser = list({
strict: true,
onReadEntry: (entry) => {