Files
deepseek-harness/packages/api/workspace-controller

description, kind
description kind
Host and Client workspace control: mutate workspace navigation and follow its complete projection. package-reference

Workspace Controller

English | 中文

Summary

@deepseek-ai/dsh-api-workspace-controller owns the Host ctx.workspaceController service and the generated Client ctx.remote.workspace namespace. Its Remote methods create, rename, remove, and reorder Workspaces, reorder Sessions within a Workspace, archive Sessions from Workspace navigation, and follow the complete Workspace projection. Use it through API Gateway when a Client must change or follow Workspace navigation.

Table of Contents


Use this package

The Host controller serializes mutations whose correctness depends on current registry state and returns stable WorkspaceError values for expected failures. Its follow() stream synchronously attaches to durable Workspace changes, emits one complete baseline first, then emits ordered upsert, remove, order, and archived increments. A reconnect starts another generation with a replacement baseline, so consumers do not depend on receiving every increment while disconnected.

The Client entry provides ClientWorkspaceModel and createWorkspaceStateStream(). The model owns Workspace rows, registry order, archived Session ids, unary mutation echoes, and stream/unary race resolution. A newer Host row wins by updatedAt; a committed stream order outranks an older unary response; a removed Workspace id cannot be resurrected by delayed data. The package exposes framework-neutral snapshots and subscriptions, leaving navigation policy and React hooks to the UI owner.


Model Experience

None, as Workspace organization is browser and Host control state and registers no prompt, tool, or session event.

KV Cache effect

No direct effect; Workspace mutations do not alter model requests.

Known Limitations and Deferred Work

  • follow() replaces the whole projection after reconnect and has no durable cursor or incremental catch-up protocol.
  • Process-local deletion markers prevent delayed data from reviving a removed Workspace only for the lifetime of the Client model.

Dev Note

Working context for maintainers — click to expand

None.