reference

@kestrel-agents/protocol

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

Protocolbeginner0.7.0 Stable
Verified 2026-07-13View sourceReport a docs issue
Bash
pnpm add @kestrel-agents/protocol@0.7.0

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.