Files
deepseek-harness/packages/host/directory-picker-auto
Turtle 38c7a9fbf4 feat(release): publish package source, declaration maps, and documentation (#5884)
* feat(release): publish package source, declaration maps, and documentation

Every release member publishes its TypeScript source and the declaration
maps that resolve into it, and @deepseek-ai/dsh publishes the repository
Markdown documentation staged from docs/ at prepack time.

The ./src/* export most members already declared now resolves for an
installed consumer, and a consumer editor follows a declaration to the
implementation. Bundled JavaScript maps stay unpublished; the vendored
family and the Desktop runtime file policy are unchanged.

Rationale: .agents/notes/implemented/process/2026-10-08-published-source-and-docs.md

* feat(release): publish JavaScript maps and compress bundles

Every emitted JavaScript map ships beside the bundle it describes, and the
workspace build and the client preset compress bundles without mangling
identifiers.

The documentation payload now mirrors the website publication manifest and
is removed again by `postpack`; Desktop and the Python executable exclude
the published source, documentation, and maps; `clean` removes a staged
copy. Typert's publication contract gains the Remote declaration map.

* fix(release): keep node bundles readable for the worker image

The browser worker image lowers `yield*` only as a whole statement and
rewrites `for await` loops by their source layout, so compressed node-side
entries either fail that lowering or lower to unparseable code. Only the
browser bundles keep compression, which removes about a third of their text.

The bundle-purity assertion now matches the module-loader call regardless of
the quote style compression picks, and the release-pack fixture exercises
the installed package's new documentation requirement.

* feat(release): publish the whole documentation tree

`@deepseek-ai/dsh` copies `docs/` in full instead of the website's page
set: the maintainer documents, the generated migration records, the
translation guidelines, and the `*.i18n.yaml` consistency records ship
with the installed package, so the documentation's own links resolve
without a checkout.

* feat(release): publish the upgrade guides with the documentation

The staged documentation keeps the website's page set and adds every
`docs/upgrade-guide/` document, which is what an installed reader consults
when a released change breaks something. The rest of the maintainer tree
stays out.

* test(release): expect source and maps in master's new payload cases

* feat(release): keep installed docs and source readable in Desktop

Desktop keeps the published src/ and docs/ trees inside app.asar, and
every model shell call receives DSH_INSTALL_DIR and DSH_NODE_EXECUTABLE
so an agent can read them through Electron's Node mode. Staging also
generates docs/upgrade-guide/README.md, an index of the upgrade guides
grouped by the release they upgrade from.

Minified client bundles print string literals with backticks: the
worker image packer now recognizes those chunk requests, client license
banners are prepended after minification so their text survives, and
the affected artifact tests accept either quote.

* test(desktop): read archived docs through the Windows PowerShell form

Regenerate the config catalog for the shifted shell-env source line.

* test(desktop): wait for the GUI-subsystem Electron process from PowerShell

* build(release): publish source and maps from the message-quotes package

* build(release): publish source and maps from packages new on master

* build(release): publish source and maps from the tool-office package
2026-11-05 00:22:36 +08:00
..
…
…

description, kind
description kind
Adaptive chooser of the directory-picker seam: resolves the web GUI host's situation once at boot and mounts the matching native or browse backend. package-reference

@deepseek-ai/dsh-host-directory-picker-auto

English | 中文

Summary

dsh-host-directory-picker-auto picks the right directory-picking interaction for every boot: it resolves the host's situation once at boot and mounts the matching backend — native or browse — together with its browser half, as real Loader entries in the in-memory root tree. The resolution is one pure boot-time sample: native requires no remote-authority trust, a loopback-only bind, a non-SSH launch, and a servable display session; anything ambiguous resolves to browse, which works everywhere. Pinning an interaction means composing that backend directly. The mounted capability stays stable for the service lifetime, as the seam requires.

Table of Contents


Use this package

Compose this plugin instead of a concrete backend when the same composition must serve hosts that differ: local workstation sessions where a native chooser works, and remote or headless sessions where only the in-app browser works. The chooser inspects the host once at boot and mounts the matching interaction.

How the choice is made

native requires every signal that the operator can see the host display and the native backend can serve it: no remote-authority trust (allowsRemoteAuthorities is false — every validated trustedHosts entry names a loopback hostname), a loopback-only bind (read from the injected webServer; remote-authority trust or a non-loopback bind admits remote browsers no OS chooser can reach), no SSH launch (the shared launch-environment predicate ignores project/user .env values and checks only inherited non-empty SSH_CONNECTION/SSH_TTY), and a servable display session — assumed on darwin and win32; on linux, DISPLAY/WAYLAND_DISPLAY plus a zenity or kdialog binary on PATH; never on any other platform. Anything ambiguous resolves to browse, which works everywhere.

What you get

The resolved interaction arrives as an ordinary Loader entry: the backend registers ctx.directoryPicker, and its browser half is discovered by the client module table exactly as a config row's would be, so the seam's one-row-swaps-both-faces invariant holds. Unloading the chooser removes the entry, unloading both faces with it. The sample happens exactly once per boot, so the mounted capability stays stable for the service lifetime.

Pinning an interaction

Pinning is not a config field here: compose the -native or -browse row directly instead of this one — that is the seam's documented swap point. Mounting the chooser and a backend row together fails loud (duplicate directoryPicker service, duplicate client flow in the single holes).

Observable failures

A wrong native choice degrades to the backend's existing retryable failure dialog rather than a broken composition; composing -browse directly selects the safe interaction for deployments whose situation the probe cannot prove.


Understand the implementation

Implementation internals — click to expand

Design concept

The chooser is a pure decision plus a mount: resolveDirectoryPickerBackend samples host facts once at boot and returns a backend kind, and apply mounts the matching backend and surface packages as real Loader entries in the in-memory root tree — never persisted to a config file, because the root tree's commit(change) is a no-op. The effect's disposer removes both entries and joins their fibers' teardown, so unloading returns only after both faces of the mounted interaction quiesced.

The resolution table

Condition Backend
A trustedHosts entry admits a non-loopback authority browse
Bind host is not loopback (isLoopbackHost) browse
SSH_CONNECTION or SSH_TTY present browse
darwin or win32 native
linux with a chooser binary and a display native
anything else browse

Source map

File Role
src/index.ts Plugin entry: BACKEND_PACKAGES/SURFACE_PACKAGES maps, apply mount and unmount
src/resolve.ts resolveDirectoryPickerBackend — the pure boot-time decision
src/probe.ts Host probes: hasLinuxChooserBinary, canExecute

Further Exploration

Read these when the chooser's contract is not enough: the seam definition first, then the two backends it mounts.


Model Experience

None, as the GUI host's directory-selection chooser only mounts a backend row and registers nothing model-facing.

KV Cache effect

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

Known Limitations and Deferred Work

These limits define when the boot-time sample can misjudge the host. They are current package constraints, not a task backlog.

  • Detection infers operator location from launch context, which no launch-side signal can prove — a tmux session detached from its SSH launch loses the SSH_* markers; a Darwin process outside an Aqua session still counts as displayed; and a workstation-local launch later reached through ssh -L arrives from 127.0.0.1, resolves native, and opens the chooser on the unattended workstation. A wrong native choice degrades to the backend's existing retryable failure dialog, and composing -browse directly selects the safe interaction for such deployments.
  • The Linux chooser probe reads PATH only — a zenity/kdialog reachable some other way (shell alias, non-PATH install) still resolves browse; installing either binary on PATH restores native eligibility at the next boot.
  • Boot-time only — one resolution serves every client of the boot; per-connection adaptivity (native for a local browser, browse for a remote one, same server) would need a per-client capability and the wire advertisement the seam does not carry, and waits for a deployment that serves both at once.
  • A loopback-presenting proxy hides a remote browser — a reverse proxy that rewrites both the request Host and Origin to a loopback authority (say 127.0.0.1:3080), with no non-loopback trustedHosts entry, passes the browser-trust fence: a browser's /api POST carries Origin: https://app.example, which the Origin fence rejects unless the proxy rewrites that header too. Only then does a remote browser still resolve native and open the chooser on the host display.

Dev Note

Working context for maintainers — click to expand

None.