HostProtocol
The RPC group a host serves over its unix socket (effect/rpc, NDJSON).
Every payload, result and error is a Schema, so typed failures
(TurnFailure members, SessionError members, EventsTrimmed) arrive as
the same classes on the client.
Since v0.1.0
Errors
Section titled “Errors”EventsTrimmed (class)
Section titled “EventsTrimmed (class)”subscribeFrom asked for events the host no longer has: older than its
in-memory cache (HostSpec.maxEvents) when events aren’t persisted
(persistEvents: false), or when the events file is missing or unreadable.
Signature
declare class EventsTrimmedSince v0.1.0
Models
Section titled “Models”HookCall
Section titled “HookCall”A hook’s input: ToolHookInput (plus output/isError for afterTool); null for beforeStop.
Signature
declare const HookCall: Schema.Struct<{ readonly callId: Schema.String readonly name: Schema.String readonly input: Schema.Unknown readonly output: Schema.optionalKey<Schema.String> readonly isError: Schema.optionalKey<Schema.Boolean>}>Since v0.1.0
HookCall (type alias)
Section titled “HookCall (type alias)”Signature
type HookCall = typeof HookCall.TypeSince v0.1.0
HookName
Section titled “HookName”The hooks a client can answer for a host.
Signature
declare const HookName: Schema.Literals< readonly ["beforeTool", "afterTool", "beforeStop"]>Since v0.1.0
HookName (type alias)
Section titled “HookName (type alias)”Signature
type HookName = typeof HookName.TypeSince v0.1.0
HookRequest
Section titled “HookRequest”The host asks a client to run one of its hooks.
Signature
declare const HookRequest: Schema.TaggedStruct< "HookRequest", { readonly hookId: Schema.String readonly hook: Schema.Literals<readonly ["beforeTool", "afterTool", "beforeStop"]> readonly call: Schema.NullOr< Schema.Struct<{ readonly callId: Schema.String readonly name: Schema.String readonly input: Schema.Unknown readonly output: Schema.optionalKey<Schema.String> readonly isError: Schema.optionalKey<Schema.Boolean> }> > }>Since v0.1.0
HookRequest (type alias)
Section titled “HookRequest (type alias)”Signature
type HookRequest = typeof HookRequest.TypeSince v0.1.0
HookStreamItem
Section titled “HookStreamItem”HookRequests items: Registered first (the client is answering from now on), then requests.
Signature
declare const HookStreamItem: Schema.Union< readonly [ Schema.TaggedStruct<"Registered", {}>, Schema.TaggedStruct< "HookRequest", { readonly hookId: Schema.String readonly hook: Schema.Literals< readonly ["beforeTool", "afterTool", "beforeStop"] > readonly call: Schema.NullOr< Schema.Struct<{ readonly callId: Schema.String readonly name: Schema.String readonly input: Schema.Unknown readonly output: Schema.optionalKey<Schema.String> readonly isError: Schema.optionalKey<Schema.Boolean> }> > } >, ]>Since v0.1.0
HookStreamItem (type alias)
Section titled “HookStreamItem (type alias)”Signature
type HookStreamItem = typeof HookStreamItem.TypeSince v0.1.0
HostInfo
Section titled “HostInfo”What Info returns: the session, the host, and the range of events it can serve.
Signature
declare const HostInfo: Schema.Struct<{ readonly sessionId: Schema.brand<Schema.String, "effect-agent/SessionId"> readonly provider: Schema.String readonly location: Schema.NullOr<Schema.String> readonly pid: Schema.NullOr<Schema.Number> readonly hostPid: Schema.Number readonly capabilities: Schema.Struct<{ readonly provider: Schema.String readonly version: Schema.NullOr<Schema.String> readonly steer: Schema.Boolean readonly queue: Schema.Boolean readonly resume: Schema.Boolean readonly cost: Schema.Literals<readonly ["reported", "estimated", "none"]> readonly spendCap: Schema.Literals<readonly ["native", "estimated", "none"]> readonly resetTimes: Schema.Boolean readonly hooks: Schema.Boolean readonly refuseTool: Schema.optionalKey<Schema.Boolean> readonly reattach: Schema.Boolean readonly disable: Schema.Struct<{ readonly askUser: Schema.Boolean readonly subagents: Schema.Boolean readonly tools: Schema.Literals<readonly ["any", "some"]> }> }> readonly lastSeq: Schema.Number readonly oldestSeq: Schema.Number readonly ended: Schema.Boolean}>Since v0.1.0
HostInfo (type alias)
Section titled “HostInfo (type alias)”Signature
type HostInfo = typeof HostInfo.TypeSince v0.1.0
SeqEvent
Section titled “SeqEvent”An event and its position in the session’s log (0, 1, 2, …).
Signature
declare const SeqEvent: Schema.Struct<{ readonly seq: Schema.Number readonly event: Schema.Union< readonly [ Schema.TaggedStruct< "SessionStarted", { readonly sessionId: Schema.brand<Schema.String, "effect-agent/SessionId"> readonly provider: Schema.String readonly version: Schema.NullOr<Schema.String> readonly model: Schema.NullOr<Schema.String> readonly resumed: Schema.Boolean readonly raw: Schema.Unknown } >, Schema.TaggedStruct< "TurnStarted", { readonly turnId: Schema.brand<Schema.String, "effect-agent/TurnId"> readonly raw: Schema.Unknown } >, Schema.TaggedStruct< "MessageLanded", { readonly messageId: Schema.brand<Schema.String, "effect-agent/MessageId"> readonly turnId: Schema.brand<Schema.String, "effect-agent/TurnId"> readonly raw: Schema.Unknown } >, Schema.TaggedStruct< "MessageDropped", { readonly messageId: Schema.brand<Schema.String, "effect-agent/MessageId"> readonly reason: Schema.String readonly raw: Schema.Unknown } >, Schema.TaggedStruct< "UserMessage", { readonly turnId: Schema.NullOr< Schema.brand<Schema.String, "effect-agent/TurnId"> > readonly messageId: Schema.NullOr< Schema.brand<Schema.String, "effect-agent/MessageId"> > readonly text: Schema.String readonly raw: Schema.Unknown } >, Schema.TaggedStruct< "Text", { readonly turnId: Schema.NullOr< Schema.brand<Schema.String, "effect-agent/TurnId"> > readonly text: Schema.String readonly raw: Schema.Unknown } >, Schema.TaggedStruct< "ToolCall", { readonly turnId: Schema.NullOr< Schema.brand<Schema.String, "effect-agent/TurnId"> > readonly callId: Schema.String readonly name: Schema.String readonly summary: Schema.String readonly input: Schema.Unknown readonly raw: Schema.Unknown } >, Schema.TaggedStruct< "ToolResult", { readonly turnId: Schema.NullOr< Schema.brand<Schema.String, "effect-agent/TurnId"> > readonly callId: Schema.String readonly isError: Schema.Boolean readonly output: Schema.String readonly raw: Schema.Unknown } >, Schema.TaggedStruct< "Retrying", { readonly turnId: Schema.NullOr< Schema.brand<Schema.String, "effect-agent/TurnId"> > readonly attempt: Schema.NullOr<Schema.Number> readonly maxAttempts: Schema.NullOr<Schema.Number> readonly delayMs: Schema.NullOr<Schema.Number> readonly message: Schema.String readonly raw: Schema.Unknown } >, Schema.TaggedStruct< "LimitsUpdated", { readonly windows: Schema.$Array< Schema.Struct<{ readonly window: Schema.Literals< readonly ["five_hour", "weekly", "other"] > readonly label: Schema.String readonly usedPercent: Schema.NullOr<Schema.Number> readonly resetsAt: Schema.NullOr<Schema.DateTimeUtcFromMillis> readonly model: Schema.OptionFromNullOr<Schema.String> }> > readonly raw: Schema.Unknown } >, Schema.TaggedStruct< "Compacted", { readonly turnId: Schema.NullOr< Schema.brand<Schema.String, "effect-agent/TurnId"> > readonly trigger: Schema.NullOr<Schema.Literals<readonly ["auto", "manual"]>> readonly raw: Schema.Unknown } >, Schema.TaggedStruct< "Heartbeat", { readonly turnId: Schema.NullOr< Schema.brand<Schema.String, "effect-agent/TurnId"> > readonly raw: Schema.Unknown } >, Schema.TaggedStruct< "TurnEnded", { readonly turnId: Schema.brand<Schema.String, "effect-agent/TurnId"> readonly outcome: Schema.Union< readonly [ Schema.TaggedStruct< "Succeeded", { readonly turnId: Schema.brand<Schema.String, "effect-agent/TurnId"> readonly finalText: Schema.String } >, Schema.Union< readonly [ typeof AgentFailed, typeof UsageLimited, typeof Throttled, typeof AuthFailed, typeof SpendCapReached, typeof ContextExhausted, typeof ProcessKilled, typeof Stalled, typeof Interrupted, ] >, ] > readonly usage: Schema.NullOr< Schema.Struct<{ readonly inputTokens: Schema.Number readonly cachedInputTokens: Schema.Number readonly outputTokens: Schema.Number readonly reasoningTokens: Schema.NullOr<Schema.Number> }> > readonly cost: Schema.NullOr< Schema.Struct<{ readonly usd: Schema.Number readonly source: Schema.Literals<readonly ["reported", "estimated"]> }> > readonly raw: Schema.Unknown } >, Schema.TaggedStruct<"Other", { readonly raw: Schema.Unknown }>, ] >}>Since v0.1.0
SeqEvent (type alias)
Section titled “SeqEvent (type alias)”Signature
type SeqEvent = typeof SeqEvent.TypeSince v0.1.0
HostRpcs (class)
Section titled “HostRpcs (class)”Signature
declare class HostRpcsSince v0.1.0