@deepseek-ai/dsh-experimental-webworker-runtime 0.1.6-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/LICENSE +21 -0
  2. package/README.i18n.yaml +6 -0
  3. package/README.md +75 -0
  4. package/README.zh.md +75 -0
  5. package/lib/client.js +854 -0
  6. package/lib/index.js +3506 -0
  7. package/lib/types/client/apply-injections.d.ts +15 -0
  8. package/lib/types/client/client.d.ts +102 -0
  9. package/lib/types/client/index.d.ts +66 -0
  10. package/lib/types/client/source-chooser.d.ts +8 -0
  11. package/lib/types/compile/transform.d.ts +39 -0
  12. package/lib/types/fixture-manifest.d.ts +26 -0
  13. package/lib/types/image-layout.d.ts +43 -0
  14. package/lib/types/index.d.ts +23 -0
  15. package/lib/types/module-proxies.d.ts +25 -0
  16. package/lib/types/module-system/module-loader.d.ts +177 -0
  17. package/lib/types/module-system/posix-path.d.ts +98 -0
  18. package/lib/types/node/builtin_modules/implemented/abort-error.d.ts +11 -0
  19. package/lib/types/node/builtin_modules/implemented/async_hooks.d.ts +174 -0
  20. package/lib/types/node/builtin_modules/implemented/buffer.d.ts +28 -0
  21. package/lib/types/node/builtin_modules/implemented/child_process.d.ts +178 -0
  22. package/lib/types/node/builtin_modules/implemented/crypto.d.ts +53 -0
  23. package/lib/types/node/builtin_modules/implemented/events.d.ts +84 -0
  24. package/lib/types/node/builtin_modules/implemented/fs/promises.d.ts +39 -0
  25. package/lib/types/node/builtin_modules/implemented/fs-watch.d.ts +119 -0
  26. package/lib/types/node/builtin_modules/implemented/fs.d.ts +502 -0
  27. package/lib/types/node/builtin_modules/implemented/http.d.ts +113 -0
  28. package/lib/types/node/builtin_modules/implemented/module.d.ts +50 -0
  29. package/lib/types/node/builtin_modules/implemented/os.d.ts +115 -0
  30. package/lib/types/node/builtin_modules/implemented/path.d.ts +138 -0
  31. package/lib/types/node/builtin_modules/implemented/perf_hooks.d.ts +13 -0
  32. package/lib/types/node/builtin_modules/implemented/stream.d.ts +22 -0
  33. package/lib/types/node/builtin_modules/implemented/timers/promises.d.ts +36 -0
  34. package/lib/types/node/builtin_modules/implemented/tty.d.ts +18 -0
  35. package/lib/types/node/builtin_modules/implemented/url.d.ts +61 -0
  36. package/lib/types/node/builtin_modules/implemented/util/types.d.ts +12 -0
  37. package/lib/types/node/builtin_modules/implemented/util.d.ts +95 -0
  38. package/lib/types/node/builtin_modules/implemented/zlib.d.ts +65 -0
  39. package/lib/types/node/builtin_modules/mock/dns/promises.d.ts +10 -0
  40. package/lib/types/node/builtin_modules/mock/net.d.ts +61 -0
  41. package/lib/types/node/builtin_modules/mock/sqlite.d.ts +19 -0
  42. package/lib/types/node/builtin_modules/mock/vm.d.ts +25 -0
  43. package/lib/types/node/builtin_modules/mock/worker_threads.d.ts +34 -0
  44. package/lib/types/node/builtins.d.ts +13 -0
  45. package/lib/types/node/external_packages/koffi.d.ts +63 -0
  46. package/lib/types/node/external_packages/node-addon-system-flock.d.ts +19 -0
  47. package/lib/types/node/external_packages/node-pty.d.ts +13 -0
  48. package/lib/types/node/external_packages/pi-ai.d.ts +51 -0
  49. package/lib/types/node/external_packages/replaced-externals.d.ts +9 -0
  50. package/lib/types/node/external_packages/ripgrep.d.ts +16 -0
  51. package/lib/types/node/external_packages/sharp.d.ts +6 -0
  52. package/lib/types/node/external_packages/ws.d.ts +38 -0
  53. package/lib/types/node/globals/crypto.d.ts +3 -0
  54. package/lib/types/node/globals/process.d.ts +78 -0
  55. package/lib/types/node/globals/timers.d.ts +10 -0
  56. package/lib/types/node/notImplementedFail.d.ts +34 -0
  57. package/lib/types/node/process-table.d.ts +50 -0
  58. package/lib/types/polyfill/async-context/als-runtime.d.ts +45 -0
  59. package/lib/types/polyfill/async-context/async-context-hooks.d.ts +6 -0
  60. package/lib/types/shell/ast.d.ts +23 -0
  61. package/lib/types/shell/expand.d.ts +65 -0
  62. package/lib/types/shell/fs-access.d.ts +43 -0
  63. package/lib/types/shell/interpret.d.ts +54 -0
  64. package/lib/types/shell/process/child.d.ts +26 -0
  65. package/lib/types/shell/process/host.d.ts +58 -0
  66. package/lib/types/shell/process/landlock.d.ts +33 -0
  67. package/lib/types/shell/process/protocol.d.ts +74 -0
  68. package/lib/types/shell/process/virtual-executables.d.ts +49 -0
  69. package/lib/types/shell/programs/builtins.d.ts +9 -0
  70. package/lib/types/shell/programs/files.d.ts +11 -0
  71. package/lib/types/shell/programs/index.d.ts +14 -0
  72. package/lib/types/shell/programs/options.d.ts +40 -0
  73. package/lib/types/shell/programs/text.d.ts +9 -0
  74. package/lib/types/shell/types.d.ts +138 -0
  75. package/lib/types/storage/active.d.ts +18 -0
  76. package/lib/types/storage/image-gzip.d.ts +39 -0
  77. package/lib/types/storage/memory.d.ts +308 -0
  78. package/lib/types/storage/paths.d.ts +18 -0
  79. package/lib/types/storage/tar.d.ts +41 -0
  80. package/lib/types/storage/types.d.ts +279 -0
  81. package/lib/types/transport/frames.d.ts +108 -0
  82. package/lib/types/transport/synthetic-http.d.ts +50 -0
  83. package/lib/types/transport/tunnel.d.ts +132 -0
  84. package/lib/types/worker-host.d.ts +165 -0
  85. package/lib/types/worker.d.ts +2 -0
  86. package/lib/worker.js +21879 -0
  87. package/package.json +73 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 DeepSeek
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,6 @@
1
+ # Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
2
+ # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
+ # after editing either side, bring the other along and re-record with:
4
+ # pnpm run verify-translation-pairing --write packages/experimental/webworker-runtime/README.md
5
+ README.md: ab54ec689664adc1c0e01cc3387777c77f36bc66
6
+ README.zh.md: d6593eeff22e642e2423fa9348f64d751d5de62f
package/README.md ADDED
@@ -0,0 +1,75 @@
1
+ ---
2
+ description: "Browser-worker harness hosting for maintainers building or debugging the experimental Web preview runtime."
3
+ kind: "package-library"
4
+ ---
5
+
6
+ # `@deepseek-ai/dsh-experimental-webworker-runtime`
7
+
8
+ English | [中文](README.zh.md)
9
+
10
+ ## Summary
11
+
12
+ The browser worker host: the whole harness plugin tree runs inside one dedicated Web Worker, for preview deployments and packaging regressions ([experimental group](../README.md)). The worker inflates a packed VFS image off its download and mounts it in memory, loads its modules through a CommonJS wrapper loader, and serves the page over a postMessage tunnel that speaks plain HTTP. Use it when a preview must run the packaged harness without a Node host.
13
+
14
+ ## Table of Contents
15
+
16
+ - [Use this package](#use-this-package)
17
+ - [Model Experience](#model-experience)
18
+ - [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
19
+ - [Dev Note](#dev-note)
20
+
21
+ -----
22
+
23
+ <a id="use-this-package"></a>
24
+ ## Use this package
25
+
26
+ The public npm package exposes the runtime library at its root, the self-contained browser Worker at `./worker`, and the page connector at `./client`. Deployments supply and serve the VFS image separately through the [packer](../webworker-packer/README.md); installing this library does not add a profile layer. The root also exports the module-proxy and replacement tables used by the packer.
27
+
28
+ Three build artifacts and one source-owned process layer:
29
+
30
+ - **`lib/index.js` (assembly library)** — `createWorkerHost`/`startWorkerHost` mount the base image and any ordered data overlays (`storage/`), install the module loader (`module-system/`) and the `process` shim, boot the tree through the image's own `dsh-app-boot`, and hand the tunnel its serving seams. Overlays may replace files only under `home/` and `workspace/`; they cannot replace the base manifest, configuration, or modules. The image layout contract (`image-layout.ts`: virtual root, config/manifest paths, empty directories, the `lowered` wrapper-contract gate) is shared with the packer. Boot patches force the deployment-shaped rows: frontend serving off, JSONL session logs on the plaintext path, preset roots onto the image's `config/agent-presets`.
31
+ - **`lib/worker.js` (worker bundle)** — the assembly plus this package's Node-compatibility layer as one self-contained ES module. The module proxy table (`module-proxies.ts`) is the only platform fork: `node:*` builtins over VFS/tunnel/browser primitives, structural stubs that fail loud on the console for what a browser cannot do, and native/binary package replacements. `node:module` supplies `createRequire().resolve` and `.resolve.paths()` over the image package root, so unchanged packages can discover manifests without evaluating their modules. The global `process` shim carries Node detection fields including `title`, preventing Worker execution from entering DOM-only branches. The pack-time parser reports statically named module requests, including module-scope direct calls of the form `createRequire(import.meta.url)('pkg')` through a named `node:module` or `module` import, to the packer's reachability walk. Stored, CommonJS-obtained, and rebased `createRequire` calls require image entry seeds. VFS mutations drive `node:fs` callback, polling, and promise watchers; open descriptors retain file identity and access mode across rename, replacement, and unlink, `FileHandle.stat({ bigint: true })` reports the same device and inode identity as a path stat while the name still refers to that file, and `FileHandle.chmod()` updates the opened file identity; `readable-stream` supplies the stream state machine used by file streams and unchanged image packages such as Chokidar and readdirp. AsyncLocalStorage carries sync-stack causality across `await` through the snapshot/restore faces the pack-time lowering injects. The worker holds no compiler: an image the packer did not lower is refused at mount. The callback `fs.realpath.native` alias resolves within the mounted VFS and supports `util.promisify`.
32
+ - **`src/shell/` (the worker's own process layer)** — a browser worker cannot fork, so `node:child_process` is not a stub but an implementation: `spawn` starts the command in its own Web Worker — this same bundle, told by its first frame to be a shell process — and reports it through the `ChildProcess` surface the subprocess service consumes. The command runs off the host's thread, `SIGKILL` terminates it whatever it is doing, and it reaches the VFS only by message (the host serves those frames). Worker platform executables preserve native-package protocols such as Landlock without replacing their JavaScript packages or coupling their implementations to `node:child_process`; ordinary commands use the package's evaluator and coreutils command table. The grammar is `@yarnpkg/parsers`' `parseShell`, while `execSync`/`fork` still refuse because they need a real process.
33
+ - **`lib/client.js` (page half)** — startup has two independent stages. `chooseWorkerHostSource({ image?, fixtureManifest? })` optionally owns the boot barrier and fixture manifest: without `preview-fixture` it waits at the source chooser, while a valid query selects directly; either path returns ordered overlays. `connectWorkerHost(worker, { image?, overlays? })` remains the public base-runtime connector; callers that skip the chooser get an empty overlay list. `apps/web` invokes both and supplies its statically bundled Worker. The opening `init` frame carries the base and ordered overlay URLs, the boot payload delivers the structured index-injection table, and `applyIndexInjections` executes it before the shell entry runs. Script preload rows are advisory and skipped because `/plugins` resources resolve only through the tunnel; `loadBundle` fetches each combo on first demand, embeds its tunnel-only source map as a Base64 data URL, and executes the script as a Blob. The tunnel also exposes fetch-shaped transport, the independent file-upload carrier, and the API client. Request frames preserve Blob bodies through structured clone and transfer `ReadableStream<Uint8Array>` ownership. The Host Worker streams both forms into the route, so neither browser thread creates a complete byte array for a generic-file upload.
34
+
35
+ Acceptance lives in `apps/web/tests/preview-boot.e2e.ts`, which serves the real built pages and drives the pre-boot chooser plus Worker activation in headless Chromium. The empty selection exercises first-run startup. The `vfs-example` overlay supplies ordinary workspace files and plaintext persistence artifacts for cold Workspace/Session discovery, tool presentation, subagent navigation, and history paging without a model request. The fixture generator owns current-generation logs and the projection cache; committed predecessor logs remain byte-identical alongside them. The chooser reserves WebFS as a separate user-authorized source; that provider does not read the built-in fixture.
36
+
37
+ The [built-bundle import sweep](tests/compile/transform-corpus-check.ts) checks bare Node imports after the library build. Its Dockkit exception accepts Node’s unknown-`.css`-extension refusal for any stylesheet rather than one pinned path; another extension, error code, or message, and an unexpectedly successful exempt import, remain errors. See the [stylesheet exemption decision](../../../.agents/notes/implemented/bug-fix/2026-09-10-built-bundle-css-exemption.md).
38
+
39
+ -----
40
+
41
+ <a id="model-experience"></a>
42
+ ## Model Experience
43
+
44
+ None, as this package only hosts the tree in a browser worker and answers its `node:*` calls; every model-facing registration belongs to the plugins it boots.
45
+
46
+ #### KV Cache effect
47
+
48
+ None; this package neither assembles nor sends a provider request.
49
+
50
+ ## Known Limitations and Deferred Work
51
+
52
+ <a id="known-limitations-and-deferred-work"></a>
53
+
54
+ - **The worker composition writes plaintext session logs** (`compression: 'none'` boot patch): it carries no Zstandard codec, so exported logs are `.jsonl`, never `.jsonl.zstd`.
55
+ - **`node:dns/promises`, `node:vm`, `node:net`, `node:sqlite`, `node:worker_threads` are structural stubs**: every call reports its refusal on the console and throws. Rows needing native DNS, a real process, or realm isolation cannot run here.
56
+ - **PTC Node programs are unavailable**: the process shim exposes `/dsh/bin/node` as its executable identity so the provider can activate, but the Worker has neither a Node executable nor `stripTypeScriptTypes`. Program execution fails before launching a child.
57
+ - **Filesystem watchers observe only the mounted VFS**: image seeding is silent and the VFS has no symlinks or external writers. `persistent`, `ref()`, and `unref()` preserve the Node API but cannot control a dedicated Worker's lifetime because browsers expose no ref-counted event loop.
58
+ - **Worker confinement is a VFS boundary, not kernel Landlock**: `read-only` and `workspace-write` run the unchanged `@deepseek-ai/node-addon-system/landlock-run` JavaScript and launcher argv, but the process layer implements the logical `landlock-run` executable and enforces its grants on every shell filesystem request. `full` therefore covers the Worker command table and mounted VFS only; it does not claim arbitrary native-process execution or Linux kernel isolation.
59
+ - **The worker bundle pins a path inside `@yarnpkg/parsers`** — the build resolves the package's own `lib/shell.js` instead of its root, whose barrel also re-exports the Syml parser and so drags js-yaml into a bundle that never parses that format (around 175 kB, plus its module body at worker start). The path is derived from the package manifest, so a layout change fails the build rather than reinstating the barrel; upgrading the dependency means re-checking that the shell parser still lives there.
60
+ - **The shell is not bash**: no loops, functions, `case`, job control, or process substitution — the grammar stops at pipelines, `&&`/`||`, subshells, groups, redirections, and expansion. `&` runs its command to completion in place, `sed` accepts only substitution scripts, patterns are JavaScript regular expressions, and the command table holds coreutils only (no `git`, no network tools).
61
+ - **A shell process has no synchronous filesystem**: it reads and writes the host's VFS by message, because blocking on a reply would need `SharedArrayBuffer`, which requires a cross-origin isolation GitHub Pages cannot grant. Directory-walking commands therefore cost one round trip per entry, and two concurrent commands can interleave their writes.
62
+ - **Transport, worker-host, and page-half coverage needs a browser-grade harness** — the per-file coverage gate is unmet for those modules; unit specs cover storage, ALS, the transform, and the stub contracts.
63
+
64
+
65
+ <a id="dev-note"></a>
66
+ ### Dev Note
67
+
68
+ <details>
69
+ <summary>Working context for maintainers — click to expand</summary>
70
+
71
+ None.
72
+
73
+ </details>
74
+
75
+ **Runtime invariant:** No companion is published. This package is pre-Cordis platform glue — the tree it boots runs the product packages' own invariants, and the assembly's contracts (image contract gate, tunnel refusals) fail loud at boot rather than drifting at run time.
package/README.zh.md ADDED
@@ -0,0 +1,75 @@
1
+ ---
2
+ description: "面向构建或排查实验性 Web 预览运行时的维护者,说明浏览器 worker 中的 harness 托管。"
3
+ kind: "package-library"
4
+ ---
5
+
6
+ # `@deepseek-ai/dsh-experimental-webworker-runtime`
7
+
8
+ [English](README.md) | 中文
9
+
10
+ ## 概述
11
+
12
+ 浏览器 worker 宿主:整棵 harness 插件树跑在一个 dedicated Web Worker 里,用于预览部署与打包回归([实验组](../README.zh.md))。worker 边下载边解压打包好的 VFS 镜像并挂载进内存,经 CommonJS 包装加载器装载模块,并通过一条讲纯 HTTP 的 postMessage 隧道服务页面。当预览需要在没有 Node 宿主的环境中运行已打包 harness 时,请使用它。
13
+
14
+ ## 目录
15
+
16
+ - [使用本包](#use-this-package)
17
+ - [模型体验](#model-experience)
18
+ - [已知限制与延期工作](#known-limitations-and-deferred-work)
19
+ - [开发备注](#dev-note)
20
+
21
+ -----
22
+
23
+ <a id="use-this-package"></a>
24
+ ## 使用本包
25
+
26
+ 公开 npm 包在根入口导出运行时库,通过 `./worker` 提供自包含的浏览器 Worker,通过 `./client` 提供页面连接器。部署方通过 [打包器](../webworker-packer/README.zh.md) 单独提供和托管 VFS 镜像;安装此库不会增加 profile 层。根入口还导出打包器所用的模块代理表与替换表。
27
+
28
+ 一条 tsdown 管线产出三个构建产物;另有一层由源码维护的进程实现:
29
+
30
+ - **`lib/index.js`(装配库)**——`createWorkerHost`/`startWorkerHost` 挂载基础镜像和按序排列的数据 overlays(`storage/`)、安装模块加载器(`module-system/`)与 `process` shim、经镜像自带的 `dsh-app-boot` 启动插件树,并把服务 seam 交给隧道。Overlay 只能替换 `home/` 与 `workspace/` 下的文件,不能替换基础 manifest、配置或模块。镜像布局契约(`image-layout.ts`:虚拟根、config/manifest 路径、空目录、`lowered` 包装契约门)与 packer 共享。boot patch 强制部署形态行:关前端静态服务、JSONL 会话日志走明文、preset 根指向镜像内 `config/agent-presets`。
31
+ - **`lib/worker.js`(worker 束)**——装配库加本包的 Node 兼容层,合成一个自含 ES module。模块代理表(`module-proxies.ts`)是唯一平台叉口:`node:*` 内建走 VFS、隧道和浏览器原语,浏览器做不到的走结构化 stub(调用即在 console 报错并抛出),native/binary 包则替换执行后端。`node:module` 在镜像 package 根之上提供 `createRequire().resolve` 与 `.resolve.paths()`,使未修改的包无需执行目标模块即可发现 manifest。全局 `process` shim 带有包括 `title` 在内的 Node 环境识别字段,避免 Worker 执行误入仅适用于 DOM 的分支。pack 期解析器会把名称静态可知的模块请求报告给 packer 的可达性遍历,其中包括通过 `node:module` 或 `module` 具名导入在模块作用域直接发起的 `createRequire(import.meta.url)('pkg')` 调用。保存、经 CommonJS 获取或另设基准的 `createRequire` 调用需要镜像入口种子。VFS mutation 驱动 `node:fs` 的 callback、polling 和 promise watcher;打开的 descriptor 在 rename、replacement 和 unlink 后仍保留文件身份与访问模式,只要文件名仍指向该文件,`FileHandle.stat({ bigint: true })` 报告的 device 与 inode 身份就与路径 stat 相同,`FileHandle.chmod()` 则更新打开文件身份的权限;`readable-stream` 提供文件流以及 Chokidar、readdirp 等未修改镜像包所用的流状态机。AsyncLocalStorage 经 pack 时降低注入的 snapshot/restore 面在 `await` 间携带同步栈因果。worker 不带编译器:packer 未降低的镜像在挂载时被拒。回调式 `fs.realpath.native` 别名在已挂载的 VFS 内解析路径,并支持 `util.promisify`。
32
+ - **`src/shell/`(worker 自己的进程层)**——浏览器 worker 无法 fork,所以 `node:child_process` 不是 stub 而是实现:`spawn` 把命令放进它自己的 Web Worker——就是这同一个束,由首帧告诉它「你是 shell 进程」——并以 subprocess 服务消费的 `ChildProcess` 面报告结果。命令不占宿主线程,`SIGKILL` 不管它在干什么都能终止它,而它只能靠消息触达 VFS(由宿主应答这些帧)。Worker 平台 executable 在不替换 JavaScript 包、也不把具体实现耦合进 `node:child_process` 的情况下保持 Landlock 等 native 包协议;普通命令使用本包的求值器与 coreutils 命令表。语法来自 `@yarnpkg/parsers` 的 `parseShell`,而 `execSync`/`fork` 依然拒绝,因为它们需要真进程。
33
+ - **`lib/client.js`(页面半)**——启动分为相互独立的两段。`chooseWorkerHostSource({ image?, fixtureManifest? })` 可选地拥有 boot barrier 与 fixture manifest:没有 `preview-fixture` 时停在来源选择面板,合法 query 则直接选择;两条路径都返回按序排列的 overlays。`connectWorkerHost(worker, { image?, overlays? })` 仍是公开的基础运行态连接器;调用方跳过选择器时 overlay 列表为空。`apps/web` 调用这两段并提供静态打包的 Worker。开局 `init` 帧携带基础镜像与按序排列的 overlay URL,boot 载荷送达结构化 index 注入表,`applyIndexInjections` 在壳入口运行前逐行执行。脚本 preload 行只是提示,因此会被跳过:`/plugins` 资源只能经 tunnel 解析,`loadBundle` 会在首次需要时获取 combo、把仅 tunnel 可达的 sourcemap 内嵌为 Base64 data URL,再以 Blob 执行脚本。Tunnel 还暴露 fetch 形式的传输、独立文件上传载体和 API 客户端。请求帧通过结构化克隆保留 Blob 请求体,并转移 `ReadableStream<Uint8Array>` 的所有权。Host Worker 将两种请求体都逐块送入路由,因此通用文件上传不会在任何浏览器线程创建完整字节数组。
34
+
35
+ 验收在 `apps/web/tests/preview-boot.e2e.ts`:静态服务真实构建页面,在 headless Chromium 里驱动 pre-boot 选择面板与 Worker 激活。空白选择验证首次启动;`vfs-example` overlay 提供普通 workspace 文件与明文 persistence 产物,无需模型请求即可验证 Workspace/Session 冷发现、工具呈现、subagent 导航和历史分页。fixture 生成器负责当前代日志与投影缓存;已提交的前代日志逐字节保持不变,与它们并存。选择面板为 WebFS 保留独立的用户授权来源;该 provider 不读取内置 fixture。
36
+
37
+ [已构建 bundle 导入检查](tests/compile/transform-corpus-check.ts)在库构建后检查裸 Node 导入。Dockkit 例外接受 Node 针对任意样式表报告的未知 `.css` 扩展名错误,而不限定某一固定路径;其他扩展名、错误码或消息,以及意外成功的豁免导入,仍然报错。参见 [样式表豁免决策](../../../.agents/notes/implemented/bug-fix/2026-09-10-built-bundle-css-exemption.zh.md)。
38
+
39
+ -----
40
+
41
+ <a id="model-experience"></a>
42
+ ## 模型体验
43
+
44
+ 无:本包只在浏览器 worker 里承载插件树并应答它的 `node:*` 调用;所有面向模型的注册都属于它启动的那些插件。
45
+
46
+ #### KV Cache 影响
47
+
48
+ 无:本包既不组装也不发送提供方请求。
49
+
50
+ ## 已知限制与延期工作
51
+
52
+ <a id="known-limitations-and-deferred-work"></a>
53
+
54
+ - **worker 组合写明文会话日志**(`compression: 'none'` boot patch):不带 Zstandard 编解码器,导出日志是 `.jsonl`,不会是 `.jsonl.zstd`。
55
+ - **`node:dns/promises`、`node:vm`、`node:net`、`node:sqlite`、`node:worker_threads` 是结构化 stub**:每次调用在 console 报告拒绝并抛出。需要原生 DNS、真进程或真 realm 隔离的行在此无法运行。
56
+ - **PTC Node 程序不可用**:process shim 用 `/dsh/bin/node` 表示可执行文件身份,使 provider 能够激活,但 Worker 既没有 Node 可执行文件,也没有 `stripTypeScriptTypes`。程序执行会在启动子进程前失败。
57
+ - **文件 watcher 只能观察已挂载的 VFS**:镜像 seed 不产生事件,VFS 也没有符号链接或外部写入方。`persistent`、`ref()` 和 `unref()` 保留 Node API,但浏览器没有引用计数事件循环,因此这些接口不能控制 dedicated Worker 的生存期。
58
+ - **Worker confinement 是 VFS 边界,不是内核 Landlock**:`read-only` 和 `workspace-write` 运行未经修改的 `@deepseek-ai/node-addon-system/landlock-run` JavaScript 与 launcher argv,进程层则实现逻辑 `landlock-run` 可执行文件,并在 shell 的每次文件系统请求上执行其授权。`full` 仅覆盖 Worker 命令表和已挂载 VFS,不表示能够执行任意 native 进程,也不表示 Linux 内核隔离。
59
+ - **worker 束钉住了 `@yarnpkg/parsers` 的包内路径**——构建解析到该包自己的 `lib/shell.js` 而非包根,因为包根 barrel 还 re-export 了 Syml 解析器,会把 js-yaml 拖进一个从不解析该格式的束(约 175 kB,外加 worker 启动时的模块体求值)。该路径由包 manifest 派生,包内布局一变即构建期失败、不会静默退回 barrel;升级这个依赖时须复核 shell 解析器是否仍在那里。
60
+ - **这个 shell 不是 bash**:没有循环、函数、`case`、作业控制或进程替换——语法止步于管道、`&&`/`||`、子 shell、group、重定向与展开。`&` 会就地把命令跑完,`sed` 只接受替换脚本,模式是 JavaScript 正则,命令表只有 coreutils(没有 `git`,没有网络工具)。
61
+ - **shell 进程没有同步文件面**:它靠消息读写宿主的 VFS,因为阻塞等待回帧需要 `SharedArrayBuffer`,而那要求 GitHub Pages 给不了的跨源隔离。因此目录遍历类命令每个条目一次往返,并发的两条命令写入可以交错。
62
+ - **transport、worker-host、页面半的覆盖需要浏览器级 harness**——这些模块未达 per-file 覆盖门;单测覆盖 storage、ALS、transform 与 stub 契约。
63
+
64
+
65
+ <a id="dev-note"></a>
66
+ ### 开发备注
67
+
68
+ <details>
69
+ <summary>维护者工作上下文——点击展开</summary>
70
+
71
+ 无。
72
+
73
+ </details>
74
+
75
+ **运行时不变式:** 不发布伴生入口。这是 Cordis 启动前的平台 glue;其启动的产品树运行各包自己的不变式,image 与 tunnel 约定在 boot 时失败。