Files
deepseek-harness/packages/host
imccyu 73931626be feat(webserver): add resource routes and in-process readResource (#6901)
* feat(webserver): add resource routes and in-process readResource

A webserver route or the fallback seat may now answer through a resource,
a function from a Fetch Request to a Response, besides the existing
node:http handler. register accepts either route form and registerFallback
accepts a handler or { resource }; existing handler callers are unchanged.
HTTP GET and HEAD requests reach a resource; webServer.readResource(request,
peer) follows the same match order and reaches only resources, so handler
routes stay unreachable to in-process readers.

client-modules registers /plugins as the fetchBundle resource, and
frontend-static claims the fallback seat with a resource that renders the
index for a supplied Peer, or runs Connection's existing authorizeIndex for
an HTTP request and renders for the browser Peer.

* fix(webserver): flush resource headers and keep one drain listener per response

Resource responses send their status and headers before the first body
chunk, register one drain/close listener pair per response so the gzip
middleware's zlib stream does not accumulate listeners across backpressure
waits, and readResource drops the body of a HEAD read as HTTP does. HTTP
requests and readResource share one responder lookup.

* chore(scripts): prune the retired client-modules unknown-cast baseline entry

* feat(frontend-static): let browsers revalidate dist files except the index

Every dist file other than the rendered index now carries
cache-control: no-cache and a weak ETag from a SHA-1 of its bytes; a
request whose If-None-Match equals that ETag receives an empty 304. The
index keeps sending no cache headers. In-process reads through
webServer.readResource revalidate the same way.

* fix(webserver): stop reading Host for resource URLs and copy no held body

A resource request's URL is the request target resolved against the same
placeholder origin the route match uses, so a missing or unparsable Host no
longer turns a dist or /plugins request into 400. The webserver ends a
resource response itself and treats any earlier close as an abort, which
also covers the Web Worker tunnel marking an aborted response ended first.
client-modules bundle bodies and frontend-static file bodies are the held
bytes themselves instead of copies, and frontend-static no longer exports
its internal serveStatic helper.

* docs(webserver): document resource route types and the handler-or-resource fallback

Paste WebResource and WebResourceRoute beside WebRoute on the web-server
subsystem page and link the catalog signatures to it, replace the remaining
'fallback handler' wording now that the seat takes a handler or a resource,
and note why the drain listener removal is a no-op under gzip.
2026-10-22 13:41:18 +08:00
..
2026-10-17 15:10:31 +08:00
2026-10-08 19:49:01 +08:00

description, kind
description kind
Package map for the web GUI host half: the HTTP and SPA servers, workspace-directory picking implementations, the open-in-app launch routes, the plugin inventory projection, and explicit product event reporting. package-group

host/ — web-GUI host half

English | 中文

Summary

The host/ group provides the web GUI's HTTP(S) server, the SPA dist server that serves the built Web shell, the workspace-directory picking seam with its native, browse, and adaptive composition packages, the open-in-app application probe and launch routes, the read-only plugin inventory projection, and explicit product event reporting. These packages are product packages; the browser transport lives in client/, and the composed application is apps/cli booting the dsh-base bundle that serves the web app under apps/web/. The picker backends replace one another behind the shared seam.

Table of Contents


Packages

The packages play the host roles; each package README owns its contract and configuration.

Package Role ctx key
webserver/ Browser HTTP server: named routes, upgrades, index taps, and the fallback seat ctx.webServer
frontend-static/ SPA dist server on the webserver fallback seat consumes ctx.webServer
directory-picker/ Workspace-directory picking seam: capability contract and error vocabulary ctx.directoryPicker
directory-picker-native/ Native-OS-chooser backend for operators at the host display registers ctx.directoryPicker
directory-picker-browse/ In-app directory-browser backend, including for remote clients registers ctx.directoryPicker
directory-picker-auto/ Host-adaptive chooser that mounts the matching backend at boot mounts a backend
open-in-app/ Application probe, icon, and launch routes opening the workspace directory in an installed application consumes ctx.webServer
plugin-inventory/ Read-only projection of current Loader entries Remote pluginInventory/list
product-telemetry-otel/ Explicit product usage events over OTLP/HTTP ctx.productTelemetry

Start with the subsystem references for the transport and the workspace records, then the layering decision behind the Web client.

Dev Note

Working context for maintainers — click to expand

None.