Skip to content

HarnessStreamPart

type HarnessStreamPart =
| {
id: string;
type: "text-start";
}
| {
delta: string;
id: string;
type: "text-delta";
}
| {
id: string;
type: "text-end";
}
| {
id: string;
reason: string;
type: "text-cancel";
}
| {
args: unknown;
toolCallId?: string;
toolName: string;
type: "tool-call";
}
| {
result: unknown;
toolCallId?: string;
toolName: string;
type: "tool-result";
}
| {
flow: string;
type: "flow-enter";
}
| {
flow: string;
reason: string;
type: "flow-end";
}
| {
nodeName: string;
type: "node-enter";
}
| {
nodeName: string;
type: "node-exit";
}
| {
from: string;
to: string;
type: "flow-transition";
}
| {
reason?: string;
targetAgent: string;
type: "handoff";
}
| {
lastStep: number;
reason: string;
type: "interrupted";
}
| {
type: "paused";
waitingFor: string;
}
| {
outcome: ConversationOutcome;
type: "conversation-outcome";
}
| {
nodeId: string;
options: ChoiceOption[];
prompt: string;
type: "interactive";
}
| {
type: "turn-end";
}
| {
rationale: string;
type: "pipeline-validation-block";
userFacingMessage?: string;
}
| {
handlerOutcome?: "queued" | "connected" | "failed";
moderator: string;
rationale: string;
type: "safety-blocked";
userFacingMessage: string;
}
| {
reason: string;
type: "wake";
}
| {
category?: EscalationReason;
outcome: "queued" | "connected" | "failed";
reason: string;
summary?: string;
type: "escalation";
}
| {
afterTokens: number;
beforeTokens: number;
summarizedCount: number;
type: "context-compacted";
}
| {
reason: string;
type: "compaction-skipped";
}
| {
compacted: boolean;
strippedCount: number;
type: "context-overflow-recovered";
}
| {
error: string;
type: "error";
}
| {
data: unknown;
name: string;
type: "custom";
}
| {
sessionId: string;
type: "done";
};

Authoritative runtime stream union (runFlow / Runtime emit). types/voice.ts defines a separate voice/realtime union that intentionally does not include { type: 'interactive' }.

{
id: string;
type: "text-start";
}

{
delta: string;
id: string;
type: "text-delta";
}

{
id: string;
type: "text-end";
}

{
id: string;
reason: string;
type: "text-cancel";
}

{
args: unknown;
toolCallId?: string;
toolName: string;
type: "tool-call";
}

{
result: unknown;
toolCallId?: string;
toolName: string;
type: "tool-result";
}

{
flow: string;
type: "flow-enter";
}

{
flow: string;
reason: string;
type: "flow-end";
}

{
nodeName: string;
type: "node-enter";
}

{
nodeName: string;
type: "node-exit";
}

{
from: string;
to: string;
type: "flow-transition";
}

{
reason?: string;
targetAgent: string;
type: "handoff";
}

{
lastStep: number;
reason: string;
type: "interrupted";
}

{
type: "paused";
waitingFor: string;
}

{
outcome: ConversationOutcome;
type: "conversation-outcome";
}

{
nodeId: string;
options: ChoiceOption[];
prompt: string;
type: "interactive";
}

{
type: "turn-end";
}

{
rationale: string;
type: "pipeline-validation-block";
userFacingMessage?: string;
}

{
handlerOutcome?: "queued" | "connected" | "failed";
moderator: string;
rationale: string;
type: "safety-blocked";
userFacingMessage: string;
}

{
reason: string;
type: "wake";
}
reason: string;
type: "wake";

An agent-initiated (scheduled wake) turn — there is no new user message.


{
category?: EscalationReason;
outcome: "queued" | "connected" | "failed";
reason: string;
summary?: string;
type: "escalation";
}
optional category?: EscalationReason;
outcome: "queued" | "connected" | "failed";

Result of the configured escalation handler.

reason: string;
optional summary?: string;

The LLM handoff brief included in the request, when generated.

type: "escalation";

{
afterTokens: number;
beforeTokens: number;
summarizedCount: number;
type: "context-compacted";
}
afterTokens: number;
beforeTokens: number;

Estimated history tokens before/after compaction.

summarizedCount: number;

Number of older messages folded into the summary.

type: "context-compacted";

{
reason: string;
type: "compaction-skipped";
}

{
compacted: boolean;
strippedCount: number;
type: "context-overflow-recovered";
}
compacted: boolean;

Whether the forced post-recovery compaction actually compacted.

strippedCount: number;

Partial assistant/tool messages stripped from the failed turn.

type: "context-overflow-recovered";

{
error: string;
type: "error";
}

{
data: unknown;
name: string;
type: "custom";
}

{
sessionId: string;
type: "done";
}