Skip to content

HostAdapter

Defined in: types/dist/host.d.ts:79

The host-adapter contract. An adapter package translates a host’s lifecycle into the abstract events the core already speaks, declares its capabilities, extracts payloads, and installs itself into the host.

Only the core-facing surface is pinned here. Install option shapes are intrinsically host-specific, so they are left as type parameters rather than coupled to any one host. Runtime plumbing a host needs internally (request routing, locating its own install) is a documented responsibility, not part of this type — see the “write your own adapter” guide.

HookOpts = unknown

host-specific options for HostAdapter.installHooks

CommandOpts = unknown

host-specific options for HostAdapter.installCommands

readonly capabilities: object

Defined in: types/dist/host.d.ts:83

What the host environment can do.

optional agentIdentification?: boolean

blockingHooks: ("session-start" | "user-prompt" | "pre-tool-edit" | "post-tool-edit" | "session-stop" | "subagent-result" | "subagent-start" | "skill-invoke")[]

hooks: ("session-start" | "user-prompt" | "pre-tool-edit" | "post-tool-edit" | "session-stop" | "subagent-result" | "subagent-start" | "skill-invoke")[]

skillSystem: "none" | "native" | "prompted"

slashCommands: boolean

streamingOutput: boolean

subagentSpawn: "none" | "native" | "shell-out"


readonly contractVersion: number

Defined in: types/dist/host.d.ts:81

Contract version this adapter targets; must equal ADAPTER_CONTRACT_VERSION.

extractPayload(raw): ExtractedPayload | undefined

Defined in: types/dist/host.d.ts:87

Extract the normalized payload from a host’s raw event.

unknown

ExtractedPayload | undefined


installCommands(root, options?): unknown

Defined in: types/dist/host.d.ts:91

Install the host’s slash-command (or equivalent) surface, under project root.

string

CommandOpts

unknown


installHooks(root, options?): unknown

Defined in: types/dist/host.d.ts:89

Wire the host’s lifecycle hooks to the cadence shim, under project root.

string

HookOpts

unknown


mapEvent(hostEvent, toolName?): "session-start" | "user-prompt" | "pre-tool-edit" | "post-tool-edit" | "session-stop" | "subagent-result" | "subagent-start" | "skill-invoke" | null

Defined in: types/dist/host.d.ts:85

Map a host lifecycle event name to its abstract event, or null if unmapped.

string

string

"session-start" | "user-prompt" | "pre-tool-edit" | "post-tool-edit" | "session-stop" | "subagent-result" | "subagent-start" | "skill-invoke" | null