Files
deepseek-harness/packages/client/ui-slots
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
Slot registry pure core for the dsh web client: ordinary extension slots, reusable Component Factories, derived props types, store seats, and the renderer install contract. package-library

@deepseek-ai/dsh-client-ui-slots

English | 中文

Summary

dsh-client-ui-slots lets web client plugins define and compose typed UI regions. Ordinary Slots provide parent-owned extension positions; Component Factories provide reusable assemblies with caller-selected local Components. Both APIs derive scoped state, injection, locale, and child-render props from declaration-merged types and report conflicting definitions during plugin loading. Pair this React-free package with ui-renderer when the client needs rendering.

Table of Contents


Use this package

Compose UI through this package whenever you write a client plugin: register a component into a slot your parent declared, or declare child slots your component renders. The five kinds cover the composition shapes — single (one occupant), list (ordered entries), keyed (dispatch by a key), chain (entries elect themselves), and hoc (entries nest around the owner's children).

Reusable Component Factories

A designer may choose a Component Factory for a component or assembly they consider reusable, even with one current caller; unrelated parents, separate packages, and additional injection or local slots are not prerequisites. A one-off component need not use a Factory. Declare its complete type in SlotFactoryMap, install the definition with ctx.slots.registerFactory(), render occurrences through the injected renderFactorySlot(), and select each declared local Component through the call's slots option. The definition reads that choice through useFactorySlot(name, fallback).

Factory children remain ordinary global Slots and must match SlotMap, while local slots select one Component per occurrence. An occurrence inherits its render-position scope; renderFactorySlot() does not accept a Session identity. Shared Store handles use ordinary scope resolution. A Store factory stays lazy until an occurrence first materializes, then creates one handle for that render position and rejects a persistent Store spec whose key would collide across occurrences.

The five framework props shares

Every registered component receives props composed from five framework shares: the runtime share (owner from the parent's render call site, plus the session standard kit and global seat), the child-render share (renderSlot statically narrowed to declared children), the Factory-render share (renderFactorySlot), the store share (the declared handle's selector hook and draft-stripped actions), and the business share (inferred from inject). Components reference the derived props aliases; they never re-type a share locally.

An open-key standard Hook, called as useName(key, selector?, equal?), also accepts useName(key, member): a string second argument reads the KeyedStandardSource resolver's (key, member) source without a selector. The resolver returns the same source object for the same arguments while that source is live.

Store seats

A register call may declare a store seat with store: defineStore(...): init infers the state schema and actions is the complete draft-transform write set. Components read through the selector hook and write through the baked callbacks; the engine implementation of defineStore lives in the runtime package and satisfies the DefineStore contract exported here.

Declaration discipline

Declaring a slot is claiming it: the registering entry becomes the only entry allowed to render that key, and registering into an undeclared slot, declaring an already-declared child, mounting one shared handle under two scopes, or registering a chain without select throws at load. An entry's disposer collapses its declared child slots recursively — ledger rows, contributions, and store mounts die on one lifecycle axis.


Understand the implementation

Implementation internals — click to expand

The ordinary Slot design is one table: declaration = render authorization = runtime spec. SlotMap is declared empty here and merged by consumers via declare module augmentation, exactly like SlotFactoryMap and the standard-kit interfaces (SessionStandardProps, GlobalStandardProps). Factory definitions use a separate single-definition ledger because their occurrences have no parent declaration.

Registration and routing

SlotCore seeds the a-priori 'root' slot at construction and enforces load-time validation. ChainSelect selectors run in ascending priority order (ties in registration order); the first non-null return elects its entry and becomes the component's matched prop, and all-null falls to the owner's renderSlotChain fallback (ChainRenderOpts). Each key carries a declaration epoch that advances only on declaration and collapse; ui-renderer uses it for ctx.slots.inject, independently from ordinary entry versions. Live inspection uses strict type: 'slot' | 'factory' nodes and nests Factory-owned child Slots under their definition.

The renderer contract

renderer.ts carries the installation contract (SlotRenderer, SlotRendererHost) plus StaleAuthorizationError/SlotOwnershipError; ui-renderer owns both the implementation and its plugin-lifecycle installation. Engine products and the renderer host contract carry bare snapshot sources (getSnapshot/subscribe), never React hooks — hook binding belongs to the render machinery. Factory crashes use the ordinary supervision channel, and an idempotent effect retains per-position Store handles only after commit.


Further Exploration

These pages cover the engine, the renderer, and the composition model.


Model Experience

None, as the package is a browser-side UI plugin layer that 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 the registry's scaling behavior and accepted type noise; they are current package constraints.

  • isLive scans all records linearly — fine at UI-plugin registration counts (tens); revisit with an entry→record backref if ledgers ever grow hot.
  • The __renders phantom anchor is visible on PropsRenderSlots — the same accepted noise as the type-chain design's __accepts: generic method signatures compare loosely across key unions, so the contravariant marker is what enforces "component key set ⊆ children declaration".

Dev Note

Working context for maintainers — click to expand

None.