Files
deepseek-harness/packages/host/runtime

@deepseek-ai/dsh-host-runtime

Host runtime assembly for dsh: bootHost composes the core plugin spine (LLM service + DeepSeek adapter, sessions with JSONL persistence, immediate fallback titles and first-message model summaries, system prompt, tools, agents, agent loop, workspace instructions, local bash), createApiProxy implements the dsh-host-apiproxy contract over that composition, and startHost is the one-step shell seam returning { api, handler, defaults, ctx, dispose }.

Which plugins mount and with what defaults is decided only here — shells must not ctx.plugin to alter the assembly. RunningHost.ctx is a formal seam with exactly two sanctioned uses: mounting protocol front-door plugins (e.g. a future dsh acp) and headless session-event subscription; consuming clients must not bypass api through it.

Configuration

Key Default Contract
persistenceRoot (required) Root directory for JSONL session persistence.
workspaceContext (required) AGENTS.md/CLAUDE.md loader config with an explicit maxBytes, or false to disable it.
provider 'deepseek' Default provider route injected as agentOptions on create/resume and reported by host.describe.
model 'deepseek-v4-flash' Default model id, same single source as provider.
cwd process.cwd() Default project directory for a session whose create request omits cwd.
sessionTitle 5 words / 40 fallback bytes / 80 accepted bytes Deterministic fallback and accepted-title limits.
sessionTitleLlm 5 words / 10 CJK chars / 4,096 input bytes / 64 output tokens / 60 s First-message model-title policy. An omitted route inherits the logged main-request provider and model.

ApiProxy implementation notes

Unary methods take the narrow RpcRequest<P> and echo request.rpcId; a prompt's rpcId rides MessageSource into the user/message event so clients can promote optimistic echoes. history/prompt on a cold session implicitly resume it, deduplicating concurrent calls through an in-flight table; history paginates backwards on message boundaries (never mid-message). The mux stream replays a session/subscribed baseline per attached session on open; the host stream carries session lifecycle, running flips, and agent/error as the only outlet for live failures with no turn position.

Model Experience

Indirectly, through the non-blocking first-message title request owned by dsh-session-title-llm, the provider/model defaults injected into created and resumed agents, and the other model-facing plugins bootHost mounts. When workspaceContext is enabled, each agent-loop instance freezes the applicable workspace instructions into its logged request prefix; the owning package documents the exact model-visible framing.

KV Cache effect

No main-request invalidation; the auxiliary title request has its own cache behavior and the conversation prefix remains unchanged.

Known Limitations and Deferred Work

  • respond is a stub — it always returns not-pending; the approval/question pending registry (stable-rpcId mint on accept, baseline replay on stream reopen, wire answerer) is the next host-side step.
  • host.describe.version is a placeholder — it does not yet report the apps/cli package version.
  • The assembly is fixed — per-deployment plugin selection (user profile, log sinks, alternative persistence) has a documented home here but no configuration surface yet.