LAYER 06 · Build and ship extensions

Lab: Web, CLI, ACP, SDK, and Host

Surfaces adapt protocols, Host owns runtime, and clients project SessionEvents—there is no second agent core

21 min3 source anchorsupstream@47f9438
surface input → ctx.agents → session/event → projection
The question this chapter resolves

How does a Web UI button become agent behavior without making the browser own business state?

Build intuition

Clients are service windows speaking different languages; Host is the shared back office. Windows translate requests and present records, while rules and authoritative state stay behind them.

MECHANISM

Mechanism

ctx.apiProxy provides a transport-neutral Host gateway and each Host stream owns its event subscriptions. Web client modules compose through dsh.client scanning and update through HMR.

ACP, CLI, Headless, and SDK create, resume, or drive agents through ctx.agents and render from session/event. Human commands may bypass model turns through ctx.commands while preserving service boundaries.

Step 1 of 5

Adapt input

Browser RPC, ACP request, or CLI command becomes a Host call.

INVARIANTS

What extensions must preserve

  • Client surfaces do not own a second authoritative agent state
  • Durable transcripts consume session/event, not agent/*
  • Each Host stream owns its subscriptions and disposal
FAILURE MODES

The tempting wrong turns

  • ×Letting optimistic browser state overwrite authoritative results
  • ×Writing agent/status into durable transcripts
  • ×Sharing one global broadcaster and leaking events across connections
VERIFY IN SOURCE

Do not trust the conclusion—verify it

These anchors are pinned to official deepseek-harness@47f9438; account for later breaking changes when reading current upstream.

KNOWLEDGE CHECK

Pause for ten seconds before revealing

Why should an SDK consume session/event instead of only assistant text?

Why the next chapter follows

The final chapter packages tools, providers, and surfaces into profiles and bundles with versioning, tests, and upstream alignment.

Learn DeepSeek Harness

An independent learning project. Explanations derive from source; upstream remains authoritative.