reference

@kestrel-agents/protocol

Parse runner health, stream events, capabilities, and terminal result data with the public protocol package.

ProtocolbeginnerCurrent releases
Verified 2026-08-04View sourceReport a docs issue
Bash
pnpm add @kestrel-agents/protocol@0.8.5

Runtime, SDK, adapters, and clients must follow their declared exact dependency contracts. Compatible first-party packages do not need equal semantic versions.

Exported modules

The package exports execution, durable conversations, approvals/effects, recovery, Mission Control, public events, and health contracts from its supported entrypoints. Import only public exports rather than internal source paths.

Exported constants

ExportPurpose
RUNNER_HEALTH_VERSIONVersion of the runner health response
RUNNER_COMMAND_CONTRACT_VERSIONCommand contract reported by health checks
RUNNER_EVENT_CONTRACT_VERSIONEvent contract reported by health checks
RUNNER_RUN_STREAM_EVENT_TYPESAllowed public request-stream event names
RUNNER_CAPABILITIESCapabilities a compatible runner may advertise

Parse a terminal result

assistantText is required and must be null or a non-empty string. output is also required. Validate unknown data before your application uses it.

TypeScript
import { parseRunnerResultV2 } from "@kestrel-agents/protocol";
 
const result = parseRunnerResultV2(input);
console.log(result.output, result.assistantText);

Parse a terminal event payload

TypeScript
import { parseRunnerTerminalPayloadV2 } from "@kestrel-agents/protocol";
 
const payload = parseRunnerTerminalPayloadV2(event.type, event.payload);

The payload parser validates the nested result for run.completed, run.failed, and run.cancelled. It also validates a result attached to an operator-controlled outcome.

Validate runner health

Use parseRunnerHealthV1() on an unknown health response. It verifies the service name, contract versions, capability list, and non-empty service version before returning typed data.

Validation and unknown fields

Parse network, persisted, and plugin-provided data before use. Canonical contracts reject malformed required values and unexpected shapes where closed objects own the boundary. Consumers must preserve or safely ignore unknown future event names rather than coercing them.

Removed 0.7 APIs

The current project-control contract is Mission Control. Legacy Board/Task writes and project snapshot updates are migration/history concepts only; 0.8 clients do not receive a compatibility shim.