DSH API contract
DSH is pre-stable: its own rule is that public APIs may change between releases and every
consumer is updated with them. So the aim here is not an API that never changes but one
where an upgrade is mechanical: only what DSH exports from a package root and documents is
used, never a deep path (.../src/*), never an internal event, and every use is listed
below so it can be checked when DSH moves.
Host (the plugins)
| Use | API | Where |
|---|---|---|
| Plugins, services | Context, Service, ctx.inject, ctx.effect, ctx.provide (cordis) | everywhere |
| Configuration | Schemastery Config, volatile fields, loader/volatile-update | index.ts, host/config.ts |
| Browser HTTP API | ctx.webServer.register, ctx.connection.requestRejection | host/http/ |
| The chat of a session | ctx.sessionController.create/rename, ctx.workspaceRegistry.create/archiveSession, workspace.attachSession, ctx.sessionPersistence | host/agent/ |
| Agent presets | the @deepseek-ai/dsh-agent-preset row with plugins (persona, our two plugins, a compaction group) | the bundle's cordis.patch.yml |
| Game master tools | ctx.tools.register(defineTool(...)) | host/orchestration/tools.ts, @dsh-agentic-roleplay/state |
| Prompt | ctx.systemPrompt.section | orchestration.ts |
| Turn control | agent/pre-step (waterfall), agent/turn-stopping, agent.steer, exec.concludeTurn(), exec.agent, exec.signal | host/orchestration/hooks.ts, tools.ts |
| Chronicler (no tools of its own) | a runChild child with a submit_result of its own (below) | compaction/chronicler.ts |
| Characters and record keeper (tools of their own) | not the public sub-agent API: see below | agents/child.ts |
| Message source | merge into MessageSourceMap (roleplay) | hooks.ts |
| Looking up an agent | ctx.agents.get | orchestration.ts |
| Compaction | BasicCompactionEngine (@deepseek-ai/dsh-compaction-basic, default export): its documented sole hook summarize() and compactRegion(); ctx.tokenMeter.measure(session); session.surface.nodes; session.snapshotEvents(); session.header.origin | host/compaction/ |
| Session events | reading turn/start, user/message, tool/result events; writing the opening turn through Session.create and ctx.sessionPersistence | compaction/range.ts, agent/opening.ts |
Browser (the client plugins)
ctx.slots (settings.section, sidebar.panellist, main panels, conversation.chat.node,
conversation.view), ctx.locale, ctx.configForms, ctx.uiConversation (events and views),
uiWorkspace.openSession, and the shell primitives (Button, Input, Switch, Modal, Tag,
Tooltip). The client bundle format is the shell's module loader, checked by tsdown.config.ts.