DeepSeek Harness

DeepSeek Harness: Extend the Web UI with Slots

· 6 min read · 中文版

DeepSeek Harness Slots let a client feature contribute a React component to a declared location, with typed inputs and a lifecycle tied to the slot owner. Start by finding the exact slot and its scope, then register within that declaration's lifetime.

DeepSeek Harness: where do Slots fit in the client?

The Web Client architecture describes a browser-side Cordis application assembled from independently loaded plugins. Client Modules load the plugin graph; API Gateway supplies typed host communication; Slots compose React UI; and Conversation turns a Session history window into target-owned views. A slot contribution belongs to the client composition. It is not, by itself, a new host service or a change to persisted session data.

The Slots reference separates a React-free registry and type algebra from the renderer that binds observable sources, owns internal React contexts and renders the tree. Features contribute through ctx.slots.register() rather than importing another feature's component. This lets the owner define an extension point while contributors use its declared interface.

Choose a declared slot, inject its lifetime, register, then render

DeepSeek Harness: how do you choose a slot?

Start with the intended UI location and the current hierarchy in the reference. For example, conversation.session.header.actions is a header action location; conversation.chat.node dispatches chat node presentation; conversation.input.right is a composer position. These are different contracts even if each ultimately renders React. The generated client inspect catalog describes each key's cardinality, scope, owner props, current occupants, declaration owner and replacement risk. The reference also describes querying a running dynamic package with cordis_inspect what:"client".

Declaration propertyChoicesConsequence for a contribution
Cardinalitysingle, list, keyed, chainDetermines whether the owner selects one cell, an ordered list, a key or a matching selector
Scoperoot, session-maybe, sessionDetermines whether session-bound inputs are unavailable, optional or definite
OwnershipA live entry declares its childRegistration must follow the declaration's lifetime
IdentityList id or keyed keyA fresh identity adds a cell; reusing one may replace presentation

For a list, the required id addresses a cell and order, then registration order, determines its position. A keyed slot renders the matching entryKey. A chain selects the first non-null result in priority order, otherwise using the owner's fallback. For single, list and keyed cells, priority controls shadowing; lower values come first. Do not treat a single slot as an additive list.

DeepSeek Harness: how do you register a header action?

The reference provides a typed header-action example. It imports the relevant client declarations, derives PropsRuntime<'conversation.session.header.actions'>, reads running state through useSession, and registers an entry named for that slot with id: 'review' and order: 100. The essential lifecycle pattern is:

export const inject = ['slots']

export function apply(ctx: Context): void {
  ctx.slots.inject('conversation.session.header.actions', () =>
    ctx.slots.register({
      name: 'conversation.session.header.actions',
      id: 'review',
      order: 100,
    }, HeaderAction))
}

This is the registration portion of the documented example: Context, the client declaration imports and the HeaderAction component must also be supplied as in the reference. The component can use the typed session hook to disable its button while the session is running. The code illustrates the contribution point; the button's business action is deliberately not invented here.

ctx.slots.inject is important when contributing to a slot owned by another package. Its callback runs for each declaration lifetime. Its effects are removed if the owner collapses, and it runs again when the owner is mounted again. Registering into an undeclared slot fails during plugin activation; declaring a child already owned elsewhere also fails. A missing UI contribution can therefore be an ownership or activation problem rather than a CSS problem.

DeepSeek Harness: how do data and actions reach the component?

A component does not receive ctx directly. The reference distinguishes owner values passed at the render occurrence, a declared store for shared mutable view state, and a registration inject factory for one entry's private data, callbacks and observable sources. The factory runs in the plugin's apply world and may close over injected services. Its session input follows the target scope: definite for session, optional for session-maybe.

A reserved hooks object in the factory can hold getSnapshot and subscribe sources. The renderer turns them into component hook props; components do not call the source directly. Slot owners can also define an inject face for a capability required by every occupant. For component types, derive inputs from the slot's declared types instead of copying properties into a new interface that can drift.

This separation helps diagnose a common mistake: an owner prop describes one render occurrence, while a store represents shared state and a callback invokes behavior. If a feature needs to render another extension point, it uses a declared child slot and authorized renderer rather than injecting React nodes as arbitrary data.

DeepSeek Harness: how should you implement and check it?

  1. Locate the exact key and verify its declaration owner, cardinality, scope and existing occupants in the current reference or live inspection.
  2. Choose a fresh list identity when adding an action; deliberately replacing a shipped cell is a different operation and has a wider effect.
  3. Derive component props from the declared slot types. Keep services in the plugin closure and expose only required data and callbacks.
  4. Register inside ctx.slots.inject when the slot belongs to another feature. Confirm that the owning plugin and the contribution both activate.
  5. Test the contribution in the actual client: verify ordering, the relevant session states and behavior when the owner is removed and mounted again. Check activation diagnostics if registration fails.

The root slot is special: the renderer invokes it through the Cordis service. Descendants are rendered by the declaring entry's renderSlot or renderSlotChain prop. A feature should follow the hierarchy rather than assuming every key is directly rendered at root.

DeepSeek Harness: what are the limits and safety boundaries?

Slots are UI composition, not authorization. Hiding or disabling an action does not establish that the corresponding host operation is forbidden. Check the actual service and access contracts for any action you wire into the component. Similarly, a valid registration or a visible button does not establish that the associated operation is safe.

A slot's key, props and occupants describe a particular documented version and composition. Verify them against the installed version and live tree before relying on a replacement. Avoid sharing session-derived data or service outputs unnecessarily in diagnostics. When a contribution disappears after an owner is disposed, inspect lifetime and activation before trying to work around the owner by importing its component directly.

DeepSeek Harness: what do the terms mean?

  • Slot: a declared UI extension location with typed dispatch and scope.
  • Owner: the entry that declares a child location and is authorized to render it.
  • Cardinality: whether the location selects a single cell, list, keyed cell or chain match.
  • Scope: the availability of root or session-bound component inputs.
  • Injection: a way to bind a contribution to a declaration lifetime or provide its private data, according to context.
  • Store: declared shared view state used by contributions that need it.

Frequently asked questions

Can a feature register in any slot?

The slot must be declared and its ownership and lifecycle must be respected.

Do components receive ctx?

No. Services stay in the plugin closure and components receive declared inputs.

Does a hidden button enforce authorization?

No. Authorization must be checked in the relevant service and access contracts.

Sources

Every claim in this article was checked against the sources below. Community discussions are user reports, not official behavior.

  1. Web Client Slots
  2. Web Client architecture

This is an independent community article, not official DeepSeek documentation. Listing a plugin in the registry is not a security review.

← Back to all articles

DeepSeek Harness: Extend the Web UI with Slots