Files
deepseek-harness/apps/cli/src
imccyu 1c3c02b9b6 fix(app-boot)!: load bundle plugin rows from the packages their bundles select (#9038)
* fix(app-boot)!: load bundle plugin rows from the packages their bundles select

The root config tree imports every row from the profile directory. A copy of
a built-in plugin package that a third-party plugin pins is hoisted into
<profile>/node_modules, where it replaced the package of the row that
@deepseek-ai/dsh-base inserts under the same name. The compatibility
admission then disabled that row and DSH started without its services.

createRuntimeResolution now reads the bundle layers in order and records, for
each plugin package name they insert as rows, the package in the nearest
node_modules above the inserting bundle; a bundle installed in the profile
looks no higher than the profile directory. A request whose importer is the
active profile directory itself uses that package before any copy in the
profile; every other importer keeps its lookup. A later bundle that finds
another copy adds a warning and does not change the selection. publish()
compares the selections, so a successor that differs only there is published.

A package installed into a profile no longer replaces the package of a row
that a bundle inserts; the upgrade guide describes the patch that does.

Refs #8476

* test(app-boot): expect the bundle plugin warning to name native real paths

The warning reports directories as the native real path spells them. On
Windows that expands 8.3 short names, which the JavaScript realpath keeps, so
the expected text differed under a short-named temporary directory.

Refs #8476

* fix(app-boot): select shipped peers and preset rows for bundle plugins

A bundle that declares a row's package under peerDependencies selects the
package the running installation ships, so a development bundle linked into
a profile keeps running its row from the host's package, as its own imports
do. Any other row still selects the nearest package above its bundle.

The rows an inserted row lists under config.plugins, as an agent preset
does, count as rows of the bundle that inserts it. A pinned copy in the
profile therefore no longer disables a row of a built-in preset.

Each package name is looked up once per bundle.

* fix(app-boot): bind bundle plugin rows to the bundle that declares them

A plugin row now resolves from the first bundle that inserts it and
declares the package under dependencies or optionalDependencies. The
resolution stores the package name and the bundle directory only: binding
reads one manifest per bundle and looks no package up. A request for a
bound name from the profile directory resolves again as an import of that
bundle does, from the real path of the bundle's manifest, so a source
launch keeps mapping workspace packages to their sources.

A row whose bundle declares the package as a peer, as a development
dependency, or not at all is not bound and keeps the lookup of the profile
directory. A bound row does not fall back to that lookup.

Two bundles that bind one name and reach different copies add a warning;
only such names are resolved while binding.

* fix(app-boot): read the rows of a group named without the group marker

The group plugin mounts its array configuration as rows whether or not the
row carries the `group` marker, and the compatibility admission already
visits those rows. Binding now reads them too, for `cordis:group` and
`@deepseek-ai/cordis-plugin-group`, so a bundle's row inside such a group
resolves from that bundle.

* perf(app-boot): compare bundle plugin copies only for differing ranges

Two bundles that bind one plugin package name and declare the same range
for it are taken to reach the same copy, so binding no longer resolves the
package from both. Only bundles whose declared ranges differ are compared
on disk and can record a warning. The shipped `web` profile, whose two
bundles insert 22 rows of the same names, now reads two manifests while
binding instead of making 90 file-system calls.

* feat(app-boot): print bundle plugin warnings when dsh starts a profile

`reportBundlePluginWarnings` prints each recorded warning to stderr, as
`reportSkippedBundles` does for skipped bundles, and the `dsh` launcher
calls it once after it computes the runtime resolution. A resolution
recomputed while the application runs still only records its warnings.
2026-11-24 21:14:36 +08:00
..