Files
deepseek-harness/packages/experimental/webworker-packer
Turtle d1e22a7e24 feat(preset): declare Agent compositions in profile YAML (#4569)
* feat(preset): declare Agent compositions in profile YAML

* fix(preset): share scope binding cleanup and refresh module graph

* fix(preset): use host syntax colors in the YAML editor

* fix(preset): write new profile declarations as block YAML

* fix(preset): align eager activation with browser and worker surfaces

* fix(ui-agent-preset): retain the existing preset card layout

* fix(preset): keep rows waiting for a Host service mounted and re-audit after settlement

A preset row whose Host provider was still activating at declaration time
was reported as waiting for a missing service, and the registry recorded the
definition as broken for the rest of the process. Split the mount audit into
failed and pending rows: failures and root-realm leaks still reject the
mount, while pending rows stay mounted and every read and binding re-audits
them after the Host Loader tree settles.

Remove the accidental self-dependency of @deepseek-ai/dsh-web-app and its
lockfile self-link. Archive the copy-only preset authoring note, which the
declarative-preset note fully supersedes, and update the ralph note's
restore recipe to the profile-patch mechanism.

* chore(lint): re-key and prune the unknown-cast baseline after the master merge

* refactor(web-app): ship each Agent preset as its own bundle patch file

`dsh.bundle.patch` accepts an ordered file list, so the four shipped preset
declarations move out of the 1000-line web patch into
`presets/<id>.patch.yml`, one insert per file, applied after the host patch.
The host patch keeps the preset registry row. Gates and test scaffolds that
read the web layer resolve every patch file through `bundlePatchPaths`
instead of one hardcoded path.

* refactor(preset): drop the save notice injected into live Agents

The notice duplicated the save result the Web editor already shows, and
after the producer-owned message sources it would have needed its own
persisted source kind. Saving now only persists and reports the activation
diagnostic; the persistence catalog is unchanged from master.

* docs: regenerate the module graph after dropping the registry's llm dependency

* test(ui-agent-preset): cover the guide dialog's keyboard handling on the declarative section

* fix(preset): address the remaining review comments

Apply the lowercase id rule only when creating a declaration, so presets
declared with other ids stay editable. Export `isBuiltInPreset` from the
display fold and key the client card groups on it. Remove the dead `error`
and `retry` locale keys, the JSDoc orphaned by the `trust` removal, the
`trust` fields in the plugin-inventory test fixtures, and the stale
`dsh-agent-presets` package name in comments and READMEs.

* refactor(preset): make the Web preset page view-and-select only

Remove the child-plugin YAML editor, the `agent_preset` tool and the
registry's read/save Remote methods. Presets are declared and changed only by
bundle patches; the settings page keeps the roster, the new-task default and
the mode help, and its question icon explains that and offers to start a
Creator-mode task. The `editing-cordis-compositions` skill and the Creator
persona describe the bundle-based path, and the authored skill-load Session
and Web snapshots are refreshed for it.

* docs(skill): make the composition skill self-sufficient for preset authoring

State where the shipped declarations live, list every declaration field,
inline a complete minimal bundle and an override example, and name the
verification calls, so Creator mode no longer reads DSH package sources to
infer the format. Refresh the authored skill-load Session for the new text.

* test(tools): drop the removed agent_preset tool from the catalog expectation
2026-09-21 08:24:18 +00:00
..

description, kind
description kind
Browser-worker VFS image packaging for maintainers building or debugging the experimental preview deployment. package-library

@deepseek-ai/dsh-experimental-webworker-packer

English | 中文

Summary

The VFS image packer: turns one composed profile into the gzip-compressed base tar the browser worker mounts as its filesystem, and opaque data trees into ordered overlay tars (experimental group). Nothing is compiled from source — the base image carries the repository's real build products, so a preview deployment debugs exactly what the served deployment ships. Read this page when packaging a preview image or diagnosing its contents.

Table of Contents


Use this package

The public npm package exposes packVfsImage and packVfsOverlay through its library entry. Callers supply the composition, package directories, and resolution root; no profile layer is installed. The runtime's library entry supplies the module-proxy and replacement tables used during packing.

The packer owns the internal dsh.configTrees declaration, its validation, and source directory resolution in src/repository.ts. This field is not part of the public plugin manifest API.

The pack is a three-layer standard stack:

  1. Roster — the composed profile's plugin rows (standard YAML parse under Include's dialect, !!js intact), plus the rows of every config tree the CLI declares in its package.json dsh.configTrees (agent presets), materialized as a Node-style dependency closure. External peer edges never bind the worker; workspace peers stay on the chain.
  2. Publish view — each workspace or vendored package contributes its built npm slice (files through picomatch) without source or workspace dist/. External packages retain published JavaScript under both src/ and dist/ because their main or exports may point there; only generic test, map, declaration, and archive exclusions apply.
  3. Reachability sweep — the runtime loader's own resolution walks from every non-wildcard workspace runtime export plus the worker assembly's seeds (IMAGE_ENTRY_SEEDS), lowering each reached module to the wrapper contract at pack time. Declaration-only condition trees do not seed the sweep; runtime requests for those exports still fail. The transform reports statically named imports, re-exports, and dynamic imports; calls through require; and module-scope direct calls of the form createRequire(import.meta.url)('pkg') through a named import from node:module or module, including an import alias. Page assets (lib/client.js behind ./client exports) ship verbatim; an unresolvable request from our own code fails the pack, third-party ones are tolerated to fail loud at require time.

repository.ts owns the repo-shaped inputs (workspace scan of vendor/, packages/, native/system/packages/, and apps/; profile composition through the real CLI dump path); pack.ts owns none of them, so the same library packs a different tree by being called differently. The native scan makes the Landlock entry package an ordinary published-view dependency while its executable remains a Worker platform implementation. The CLI is dsh-pack-vfs-image --out <file> [--profile web]; apps/web's build:preview runs it after the preview shell build.

The repository adapter also declares the preview-only fixture trees under webworker-runtime/tests/fixtures/. The CLI packs each named fixture into a separate deterministic overlay archive plus a browser-readable manifest. Overlay files bypass npm publish-view and module-reachability exclusions, so dot directories and example source files remain intact; their mounts are limited to home/ and workspace/. packVfsOverlay treats all files as opaque bytes.

packPreviewFixture prepares the newest canonical raw Session generation in each fixture directory through the Session format catalog in Node. It collects direct-child discovery evidence from the same fixture root before completing historical parent catalogs. It strictly restores the source, encodes and strictly validates the current successor, and packs that successor beside unchanged source files. A malformed, unsupported, or future selected generation refuses the build without falling back. Temporary successors are removed after packing. Browser write-open then uses current data without invoking Node's migration-verification Worker. Projection caches remain owner-validated; an older generation cannot supply a current fold checkpoint.


Model Experience

None, as this package runs at build time and writes an image file; nothing it produces reaches a model request on its own.

KV Cache effect

None; this package neither assembles nor sends a provider request.

Known Limitations and Deferred Work

  • The rule tables are judgement calls (rules.ts: exclude globs, page-asset patterns, entry seeds) pinned by tests/; a new asset class the worker must reach needs a table row, not a scanner change.
  • Reachability infers only exact request forms — computed import and require arguments, stored createRequire results, CommonJS-obtained createRequire, and bases other than import.meta.url resolve only at runtime and fail loud if the target was otherwise pruned; a target reachable only through those forms needs an explicit image entry seed.
  • Vendored package sources (src/*.ts) are excluded — nothing resolves them at runtime; a future in-worker source-inspection feature would need a dedicated include rule.
  • The packer assumes built lib/ artifacts are current: it never compiles, so a stale workspace build packs stale bytes. Run the repository build first.
  • The CLI requires its original repository location: dsh-pack-vfs-image finds the checkout relative to its own installed file and reads the source CLI, configuration trees, and preview fixtures there. An npm installation supports the parameterized library API; the CLI and repository helpers require a complete, built DeepSeek Harness checkout.
  • Preview Session inputs use raw JSONL — packPreviewFixture rejects compressed and noncanonical Session generation filenames. Generic overlays remain byte-preserving.

Dev Note

Working context for maintainers — click to expand

None.

Runtime invariant: No companion is published. This package is a build-time pass with no production event stream or mutable data; the pack's own gates (unresolvable own requests, the all-or-nothing wrapper contract) fail the pack instead.