Skip to content

HostAdapter

Defined in: types/src/host.ts:68

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/src/host.ts:72

What the host environment can do.

optional agentIdentification?: boolean

Whether this host’s hook payloads can supply agentId/agentType (ExtractedPayload’s subagent-identity fields) on subagent-scoped events. Optional so adapters written before this flag existed keep parsing unchanged (their extraction behavior is untouched); a host SHOULD declare it explicitly once it’s known whether the raw hook envelope carries agent identity. false means core cannot rely on ctx.agentId/ctx.agentType for this host and must degrade loudly — never silently — wherever it depends on them (phase 222 AC-3).

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/src/host.ts:70

Contract version this adapter targets; must equal ADAPTER_CONTRACT_VERSION.

extractPayload(raw): ExtractedPayload | undefined

Defined in: types/src/host.ts:76

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

unknown

ExtractedPayload | undefined


installCommands(root, options?): unknown

Defined in: types/src/host.ts:80

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

string

CommandOpts

unknown


installHooks(root, options?): unknown

Defined in: types/src/host.ts:78

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/src/host.ts:74

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