Server Events

The gateway speaks to its clients through a vocabulary of 51 distinct event types, organized into 17 functional categories. Each event is a JSON object bearing a type discriminator field — the single key by which clients dispatch, filter, and render the stream. Events scoped to a session carry a sessionId field; events within an active turn carry both sessionId and turnId. Streaming events include seq (a per-session monotonically increasing integer) and ts (Unix epoch milliseconds) for ordering and replay. This is the full downstream lexicon: every event the gateway can emit, every field it may contain, every semantic contract it upholds. It is reference material, intended to be consulted rather than read linearly — a concordance for the protocol’s server-side voice.
Event type names follow two naming conventions, both permanent fixtures of the protocol: snake_case for the original protocol events (e.g., turn_started, tool_call) and dot.notation for extended streaming events introduced in later protocol phases (e.g., message.delta, thinking.progress, terminal.stream). SDKs normalize both forms into their host language’s idiomatic naming conventions.

welcome

The first utterance the gateway makes to any connection. Sent immediately upon WebSocket upgrade, before authentication, before session discovery — a declaration of protocol version and authentication posture. It is the handshake’s handshake.
type
string
Always "welcome".
protocolVersion
number
The protocol version supported by this gateway instance (currently 1).
requiresAuth
boolean
true in production environments; false when the gateway runs in dev mode with authentication bypassed.
{
  "type": "welcome",
  "protocolVersion": 1,
  "requiresAuth": true
}

connected

Follows welcome immediately. Furnishes the server-assigned client identifier and the heartbeat cadence — everything the client needs to establish its identity within the gateway’s connection pool.
type
string
Always "connected".
clientId
string
A UUID assigned to this connection by the gateway. Unique across all active connections.
heartbeatIntervalMs
number
The interval in milliseconds between heartbeat events (default: 30000). Clients should treat silence exceeding this interval plus a 5-second tolerance as evidence of a stale connection.
ts
number
Server timestamp in Unix milliseconds.
{
  "type": "connected",
  "clientId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "heartbeatIntervalMs": 30000,
  "ts": 1709312400000
}

authenticated

Confirms that the client’s credentials have been validated and an identity has been established. This event is the threshold between the anonymous and the authorized — everything before it is preamble; everything after it is session interaction.
type
string
Always "authenticated".
identity
object
{
  "type": "authenticated",
  "identity": {
    "userId": "auth0|user-123",
    "email": "developer@example.com",
    "tenantId": "tenant-abc"
  }
}

heartbeat

The gateway’s periodic proof of life. Emitted every 30 seconds to all session topics with active subscribers. Carries no payload beyond a timestamp — its mere presence is the message. Clients should treat silence exceeding 35 seconds (the heartbeat interval plus a 5-second tolerance) as a stale connection and initiate reconnection.
type
string
Always "heartbeat".
ts
number
Server timestamp in Unix milliseconds.
{ "type": "heartbeat", "ts": 1709312430000 }

session_list

Response to list_sessions. Delivers the complete catalog of sessions belonging to the authenticated tenant — the registry made manifest.
type
string
Always "session_list".
sessions
SessionMeta[]
Array of session metadata objects, each conforming to the SessionMeta schema defined at the end of this reference.
{
  "type": "session_list",
  "sessions": [
    {
      "id": "f47ac10b-...",
      "tenantId": "dev",
      "name": "Auth Refactor",
      "agentType": "coding-agent",
      "status": "inactive",
      "archived": false,
      "createdAt": 1709312400000,
      "updatedAt": 1709312400000,
      "lastActivityAt": null
    }
  ]
}

session_created

Response to create_session. Announces the materialization of a new session — born in inactive status, awaiting its first activation.
type
string
Always "session_created".
session
SessionMeta
The full metadata of the newly created session.
{
  "type": "session_created",
  "session": {
    "id": "f47ac10b-...",
    "tenantId": "dev",
    "name": "New Session",
    "agentType": "coding-agent",
    "status": "inactive",
    "archived": false,
    "createdAt": 1709312400000,
    "updatedAt": 1709312400000,
    "lastActivityAt": null
  }
}

session_updated

Broadcast whenever a session’s metadata mutates — a name change, a status transition, an activity timestamp update. This event is published to the tenant topic, ensuring that all connected clients (including those not joined to the session in question) observe the change in their session lists.
type
string
Always "session_updated".
session
SessionMeta
The updated session metadata, reflecting the post-mutation state.
{
  "type": "session_updated",
  "session": {
    "id": "f47ac10b-...",
    "tenantId": "dev",
    "name": "Renamed Session",
    "agentType": "coding-agent",
    "status": "running",
    "archived": false,
    "createdAt": 1709312400000,
    "updatedAt": 1709312460000,
    "lastActivityAt": 1709312460000
  }
}

session_archived

Response to archive_session. Confirms that the session has been consigned to the archive — hidden from default session lists but retaining all its data, a kind of soft deletion.
type
string
Always "session_archived".
session
SessionMeta
The session metadata with archived: true.

session_unarchived

Response to unarchive_session. Confirms that a previously archived session has been recalled from dormancy and restored to active visibility.
type
string
Always "session_unarchived".
session
SessionMeta
The session metadata with archived: false.

session_deleted

Response to delete_session. Confirms the permanent and irrevocable destruction of a session and all its associated data — conversation history, event log, workspace files. There is no retrieval.
type
string
Always "session_deleted".
sessionId
string
The UUID of the obliterated session.
{
  "type": "session_deleted",
  "sessionId": "f47ac10b-58cc-4372-a567-0e02b2c3d479"
}

session_state

Broadcast when a session transitions between states in its finite-state lifecycle. The seven valid states are: inactive, activating, ready, running, waiting, deactivating, error. See the Session State Machine for the full transition graph and guard map.
type
string
Always "session_state".
sessionId
string
The session UUID.
state
string
The new state after the transition.
reason
string
Optional human-readable reason for the transition (e.g., "user_stopped", "turn_complete", "agent_disconnected").
{
  "type": "session_state",
  "sessionId": "f47ac10b-...",
  "state": "idle",
  "reason": "user_stopped"
}

turn_started

The opening salvo of a turn. Broadcast when the agent begins execution, marking the moment at which token consumption commences and the event stream becomes active. Everything between turn_started and its terminal counterpart (turn_complete or turn_error) constitutes the turn’s event window.
type
string
Always "turn_started".
sessionId
string
The session UUID.
turnId
string
The unique turn identifier, assigned by the gateway or provided by the client via clientTurnId.
seq
number
Monotonic sequence number within the session.
ts
number
Server timestamp in Unix milliseconds.
{
  "type": "turn_started",
  "sessionId": "f47ac10b-...",
  "turnId": "turn-001",
  "seq": 1,
  "ts": 1709312400000
}

text_delta

A fragment of the agent’s textual output, streamed incrementally as generation proceeds. Clients accumulate deltas to reconstruct the full response — each delta is a single brushstroke in a larger composition. Ephemeral: not persisted to the event log, and permanently lost if no client is listening at the moment of emission.
type
string
Always "text_delta".
sessionId
string
The session UUID.
turnId
string
The turn identifier.
text
string
The text fragment. May be a single token, a partial word, or a complete sentence — granularity depends on the upstream model’s tokenizer.
seq
number
Monotonic sequence number.
ts
number
Server timestamp in Unix milliseconds.
{
  "type": "text_delta",
  "sessionId": "f47ac10b-...",
  "turnId": "turn-001",
  "text": "Let me analyze the authentication module. ",
  "seq": 5,
  "ts": 1709312401000
}

turn_complete

The successful conclusion of a turn. Contains the full, final text — not a delta but the authoritative, complete response. This event is persisted and serves as the ground truth for what the agent produced, superseding the ephemeral delta stream.
type
string
Always "turn_complete".
sessionId
string
The session UUID.
turnId
string
The turn identifier.
finalText
string
The complete, accumulated response text.
seq
number
Monotonic sequence number.
ts
number
Server timestamp in Unix milliseconds.
{
  "type": "turn_complete",
  "sessionId": "f47ac10b-...",
  "turnId": "turn-001",
  "finalText": "I've refactored the authentication module to use dependency injection...",
  "seq": 42,
  "ts": 1709312450000
}

turn_error

A turn has failed. The agent encountered an error during execution — an LLM API failure, a tool crash, a disconnected upstream. The session transitions to an error state, and the credit reservation is settled against actual consumption. This is a session-scoped event (carrying seq and ts), distinct from the connection-level error event.
type
string
Always "turn_error".
sessionId
string
The session UUID.
turnId
string
The turn identifier (may be absent if the error occurred before turn assignment).
message
string
Human-readable error description, sanitized of internal details.
code
string
Machine-readable error code (e.g., "AGENT_ERROR", "AGENT_DISCONNECTED", "SERVER_RESTART").
seq
number
Monotonic sequence number.
ts
number
Server timestamp in Unix milliseconds.
{
  "type": "turn_error",
  "sessionId": "f47ac10b-...",
  "turnId": "turn-001",
  "message": "Lost connection to agent",
  "code": "AGENT_DISCONNECTED",
  "seq": 43,
  "ts": 1709312451000
}

Extended streaming events using dot-notation naming. These provide an alternative surface to text_delta / turn_complete for clients that prefer the dot-notation convention — semantically equivalent, syntactically distinct.

message.delta

Equivalent to text_delta. A fragment of the agent’s response, streamed during a turn. Ephemeral — not persisted.
type
string
Always "message.delta".
sessionId
string
The session UUID.
turnId
string
The turn identifier.
text
string
The text fragment.
seq
number
Monotonic sequence number.
ts
number
Server timestamp.

message.complete

Marks message completion with the full accumulated text. The dot-notation counterpart to turn_complete.
type
string
Always "message.complete".
sessionId
string
The session UUID.
turnId
string
The turn identifier.
text
string
The complete message text.
seq
number
Monotonic sequence number.
ts
number
Server timestamp.

tool_call

The agent has invoked a tool. This event announces the invocation with its full arguments, and is persisted to the event log for replay. It is the durable record of what tool was called and why — the audit trail of agent action.
type
string
Always "tool_call".
sessionId
string
The session UUID.
turnId
string
The turn identifier.
toolCallId
string
Unique identifier for this tool invocation. Used to correlate with tool_result and tool_error events.
toolName
string
The name of the tool being called (e.g., "read_file", "write_file", "bash").
args
unknown
The arguments passed to the tool. Structure varies by tool — opaque to the gateway, meaningful to the agent and client.
seq
number
Monotonic sequence number.
ts
number
Server timestamp.
{
  "type": "tool_call",
  "sessionId": "f47ac10b-...",
  "turnId": "turn-001",
  "toolCallId": "tc-abc123",
  "toolName": "read_file",
  "args": { "path": "src/auth/AuthService.ts" },
  "seq": 10,
  "ts": 1709312405000
}

tool_result

The outcome of a tool invocation. Persisted alongside its corresponding tool_call, forming a complete record of cause and effect.
type
string
Always "tool_result".
sessionId
string
The session UUID.
turnId
string
The turn identifier.
toolCallId
string
Correlates to the originating tool_call event.
status
string
Execution status: "success" or "error".
output
string
The tool’s output text. May be absent for void results or truncated for very large outputs.
seq
number
Monotonic sequence number.
ts
number
Server timestamp.
{
  "type": "tool_result",
  "sessionId": "f47ac10b-...",
  "turnId": "turn-001",
  "toolCallId": "tc-abc123",
  "status": "success",
  "output": "import { Effect } from 'effect'\n...",
  "seq": 11,
  "ts": 1709312406000
}

tool_call_start

Signals the commencement of a tool invocation with streaming arguments. Emitted before the full arguments are available, enabling clients to render a tool call in progress with its name visible. Ephemeral.
type
string
Always "tool_call_start".
sessionId
string
The session UUID.
turnId
string
The turn identifier.
toolCallId
string
Unique tool call identifier.
toolName
string
The tool being invoked.
seq
number
Monotonic sequence number.
ts
number
Server timestamp.

tool_call_delta

Streams incremental fragments of a tool’s arguments as they are generated. Clients accumulate deltas to reconstruct the full argument payload. Ephemeral.
type
string
Always "tool_call_delta".
sessionId
string
The session UUID.
turnId
string
The turn identifier.
toolCallId
string
Correlates to the tool_call_start event.
delta
string
An incremental fragment of the argument JSON.
seq
number
Monotonic sequence number.
ts
number
Server timestamp.

tool_error

A tool invocation has failed. Carries the error message from the tool’s execution environment.
type
string
Always "tool_error".
sessionId
string
The session UUID.
turnId
string
The turn identifier.
toolCallId
string
The identifier of the failed tool call.
error
string
The error message from the tool execution.
seq
number
Monotonic sequence number.
ts
number
Server timestamp.

question_requested

The agent has yielded control. It poses one or more questions to the user and suspends execution until answers arrive via answer_question. The session transitions to waiting state — a formal acknowledgment that the agent cannot proceed without human input.
type
string
Always "question_requested".
sessionId
string
The session UUID.
requestId
string
A unique identifier for this question request. Must be echoed in the client’s answer_question message to correlate the response.
questions
array
Array of question objects:
context
string
Optional contextual information explaining why the question is being asked — the agent’s rationale for yielding.
{
  "type": "question_requested",
  "sessionId": "f47ac10b-...",
  "requestId": "q-abc123",
  "questions": [
    {
      "id": "migration-strategy",
      "text": "Which migration strategy should I use?",
      "type": "choice",
      "options": ["incremental", "big-bang", "blue-green"]
    }
  ],
  "context": "The database schema needs to be updated and there are multiple approaches."
}

permission_requested

The agent seeks authorization for a sensitive operation — executing a destructive command, writing to a protected file, performing an irreversible action. Execution is suspended until the user grants or denies permission.
type
string
Always "permission_requested".
sessionId
string
The session UUID.
requestId
string
Unique request identifier for correlation.
toolName
string
The tool requesting permission.
description
string
Human-readable description of the proposed operation.
seq
number
Monotonic sequence number.
ts
number
Server timestamp.
{
  "type": "permission_requested",
  "sessionId": "f47ac10b-...",
  "requestId": "perm-xyz",
  "toolName": "bash",
  "description": "Execute: rm -rf node_modules && npm install",
  "seq": 15,
  "ts": 1709312410000
}

approval_resolved

Confirms the disposition of a permission request — whether the proposed action was sanctioned or refused.
type
string
Always "approval_resolved".
sessionId
string
The session UUID.
requestId
string
Correlates to the originating permission_requested event.
approved
boolean
true if the operation was authorized; false if denied.
seq
number
Monotonic sequence number.
ts
number
Server timestamp.

Events that expose the model’s chain-of-thought reasoning — the internal deliberation that precedes visible output. Not all models produce thinking content; when they do, these events render the cognitive process transparent.

thinking_start

The model has entered a reasoning phase. Subsequent thinking_progress events will stream the internal deliberation until thinking_complete signals the transition to visible output.
type
string
Always "thinking_start".
sessionId
string
The session UUID.
turnId
string
The turn identifier.
seq
number
Monotonic sequence number.
ts
number
Server timestamp.

thinking_progress

A fragment of the model’s internal reasoning, streamed incrementally. Ephemeral — not persisted to the event log. These fragments are the model thinking aloud; they may be speculative, self-correcting, or exploratory.
type
string
Always "thinking_progress".
sessionId
string
The session UUID.
turnId
string
The turn identifier.
text
string
A fragment of the model’s reasoning.
seq
number
Monotonic sequence number.
ts
number
Server timestamp.
{
  "type": "thinking_progress",
  "sessionId": "f47ac10b-...",
  "turnId": "turn-001",
  "text": "I need to consider the existing dependency graph before...",
  "seq": 3,
  "ts": 1709312402000
}

thinking_complete

The reasoning phase has concluded. The model transitions from internal deliberation to producing visible output. The thinking content accumulated via thinking_progress represents the completed chain of thought.
type
string
Always "thinking_complete".
sessionId
string
The session UUID.
turnId
string
The turn identifier.
seq
number
Monotonic sequence number.
ts
number
Server timestamp.

Events from shell command execution within the agent’s sandbox environment — the raw output of bash, sh, and other command-line invocations.

terminal_stream

Streams terminal output (stdout and stderr) from a running command in real time. Ephemeral — the raw byte stream is not persisted, though the tool_call and tool_result that bookend it are.
type
string
Always "terminal_stream".
sessionId
string
The session UUID.
turnId
string
The turn identifier.
data
string
Raw terminal output data, potentially containing ANSI escape sequences.
seq
number
Monotonic sequence number.
ts
number
Server timestamp.
{
  "type": "terminal_stream",
  "sessionId": "f47ac10b-...",
  "turnId": "turn-001",
  "data": "$ npm test\n\n  PASS  src/auth.test.ts\n  PASS  src/session.test.ts\n",
  "seq": 20,
  "ts": 1709312415000
}

terminal_complete

A terminal command has concluded execution. The exit code reveals whether the command succeeded or failed — the numeric verdict of the shell.
type
string
Always "terminal_complete".
sessionId
string
The session UUID.
turnId
string
The turn identifier.
exitCode
number
The process exit code. 0 conventionally signals success; any other value indicates failure.
seq
number
Monotonic sequence number.
ts
number
Server timestamp.
{
  "type": "terminal_complete",
  "sessionId": "f47ac10b-...",
  "turnId": "turn-001",
  "exitCode": 0,
  "seq": 21,
  "ts": 1709312416000
}

Events governing the lifecycle of the agent’s sandbox environment — the isolated execution context in which tools operate and files are mutated.

sandbox_init

A sandbox environment is being initialized for the session. This is the first signal that sandbox provisioning has begun.
type
string
Always "sandbox_init".
sessionId
string
The session UUID.
provider
string
The sandbox provider name (e.g., the provisioning backend responsible for creating the environment).

sandbox_provisioning

Progress updates during sandbox provisioning. These events allow clients to render a provisioning progress indicator with phase-specific messaging.
type
string
Always "sandbox_provisioning".
sessionId
string
The session UUID.
phase
string
The current provisioning phase (e.g., "creating", "configuring", "installing_deps").
message
string
Optional human-readable progress message.
{
  "type": "sandbox_provisioning",
  "sessionId": "f47ac10b-...",
  "phase": "installing_deps",
  "message": "Installing project dependencies..."
}

sandbox_ready

The sandbox is fully provisioned and operational. The agent may now execute tools within the sandbox’s isolated filesystem and process namespace.
type
string
Always "sandbox_ready".
sessionId
string
The session UUID.

sandbox_removed

The sandbox has been decommissioned. Its filesystem, processes, and network resources have been reclaimed.
type
string
Always "sandbox_removed".
sessionId
string
The session UUID.
reason
string
Why the sandbox was removed (e.g., "session_deleted", "timeout", "manual").
message
string
Optional additional context about the removal.

state_snapshot

Delivered in response to join_session. A comprehensive portrait of the session’s current state — everything a client needs to render the full UI immediately, without replaying the entire event history. This is the “catch-up” mechanism: a single event that collapses the session’s accumulated state into a transmittable snapshot.
type
string
Always "state_snapshot".
sessionId
string
The session UUID.
session
SessionMeta
Full session metadata.
currentTurn
object | null
If a turn is currently in progress:
recentHistory
array
The most recent conversation messages (up to 50), providing immediate conversational context.
subscriberCount
number
The number of clients currently subscribed to this session’s event stream.
sandbox
object | null
Current sandbox status, if a sandbox is provisioned for this session.
{
  "type": "state_snapshot",
  "sessionId": "f47ac10b-...",
  "session": {
    "id": "f47ac10b-...",
    "tenantId": "dev",
    "name": "Auth Refactor",
    "agentType": "coding-agent",
    "status": "running",
    "archived": false,
    "createdAt": 1709312400000,
    "updatedAt": 1709312460000,
    "lastActivityAt": 1709312460000
  },
  "currentTurn": {
    "turnId": "turn-001",
    "textSoFar": "I've analyzed the authentication module and...",
    "startedAt": 1709312460000
  },
  "recentHistory": [
    { "id": "msg-1", "role": "user", "content": "Refactor the auth module", "createdAt": 1709312459000 }
  ],
  "subscriberCount": 2,
  "sandbox": null
}

stream_snapshot

An in-flight snapshot of the current streaming state during a turn. Designed for late-joining clients who connect mid-turn and need the accumulated state of all active streams — the text generated so far, the thinking produced so far, and the status of all in-flight tool calls.
type
string
Always "stream_snapshot".
sessionId
string
The session UUID.
turnId
string
The current turn identifier.
textSoFar
string
All text output accumulated since the turn began.
thinkingSoFar
string
All thinking content accumulated since the turn began.
toolCalls
array
Active tool calls and their current disposition:

usage_update

Reports token consumption and cost for a turn. Emitted when the agent completes processing or at significant checkpoints during long turns. Ephemeral — the canonical billing record is maintained server-side.
type
string
Always "usage_update".
sessionId
string
The session UUID.
turnId
string
The turn identifier.
model
string | null
The LLM model used (e.g., "claude-sonnet-4-20250514").
provider
string | null
The inference provider (e.g., "anthropic").
inputTokens
number | null
Number of input tokens consumed.
outputTokens
number | null
Number of output tokens generated.
cachedTokens
number | null
Number of tokens served from the prompt cache.
costMicroDollars
number | null
Cost in micro-dollars (1,000,000 micro-dollars = $1.00 USD).
{
  "type": "usage_update",
  "sessionId": "f47ac10b-...",
  "turnId": "turn-001",
  "model": "claude-sonnet-4-20250514",
  "provider": "anthropic",
  "inputTokens": 12500,
  "outputTokens": 3200,
  "cachedTokens": 8000,
  "costMicroDollars": 45000
}

usage_context

Reports context window utilization during a turn. Enables clients to display warnings as the model approaches its context limit — a pressure gauge for the agent’s working memory.
type
string
Always "usage_context".
sessionId
string
The session UUID.
turnId
string
The turn identifier.
contextTokens
number
Current context window size in tokens.
maxContextTokens
number
Maximum context window size for the model in use.

gap

Announces that a range of events is absent from the replay stream. This typically occurs because the missing events were ephemeral (not persisted) and fell between the client’s afterSeq and the current sequence head. The gap is an honest admission: the gateway cannot provide what it did not retain.
type
string
Always "gap".
sessionId
string
The session UUID.
fromSeq
number
The start of the gap (exclusive).
toSeq
number
The end of the gap (inclusive).
{
  "type": "gap",
  "sessionId": "f47ac10b-...",
  "fromSeq": 10,
  "toSeq": 25
}

replay_complete

Signals the conclusion of event replay. The client may now transition from replay mode to real-time event processing — everything after this event is live.
type
string
Always "replay_complete".
sessionId
string
The session UUID.
lastSeq
number
The highest sequence number that was replayed.
{
  "type": "replay_complete",
  "sessionId": "f47ac10b-...",
  "lastSeq": 142
}

file_list

Response to list_files. Enumerates the contents of a directory within the agent’s workspace — the filesystem made visible to the client.
type
string
Always "file_list".
sessionId
string
The session UUID.
files
FileEntry[]
Array of file entries:

file_content

Response to read_file or file_at_iteration. Delivers the contents of a file from the agent’s workspace, at its current state or at a specified historical iteration.
type
string
Always "file_content".
sessionId
string
The session UUID.
path
string
The file path relative to the workspace root.
content
string
The file content.
encoding
string
Content encoding (e.g., "utf-8", "base64" for binary files).
size
number
File size in bytes.

file_history_result

Response to file_history. Presents the version lineage of a file — each iteration representing a snapshot captured at a point in the session’s timeline.
type
string
Always "file_history_result".
sessionId
string
The session UUID.
path
string
The file path.
iterations
IterationMeta[]
Array of iteration metadata:

file_changed

Broadcast when a file in the agent’s workspace is modified during a turn. Enables clients to show real-time file mutation indicators without polling.
type
string
Always "file_changed".
sessionId
string
The session UUID.
path
string
The path of the file that was modified.
iteration
number
The new iteration number (the version created by this change).
size
number
The new file size in bytes.

steer_sent

Confirms that a steering message was successfully delivered to the agent during an active turn. The steer has been injected into the agent’s context — its effect on the agent’s subsequent behavior is the agent’s to determine.
type
string
Always "steer_sent".
sessionId
string
The session UUID.
steerId
string
A gateway-assigned UUID for the steering message, enabling correlation and tracking.
content
string
The steering text that was delivered to the agent.

stop_acknowledged

Confirms that the stop signal was received and the turn termination process has been initiated. The agent may produce a small amount of additional output before fully halting.
type
string
Always "stop_acknowledged".
sessionId
string
The session UUID.
turnId
string
The turn that was stopped.

server_shutdown

The gateway is shutting down gracefully. This is the final event a connection may receive — a courteous farewell with a reason. Clients should wait a brief interval and then reconnect to the same or an alternative gateway endpoint.
type
string
Always "server_shutdown".
reason
string
Reason for shutdown (e.g., "maintenance", "restart", "deployment").
ts
number
Server timestamp.
{
  "type": "server_shutdown",
  "reason": "maintenance",
  "ts": 1709312500000
}

history

Response to get_history. Contains the conversation’s message transcript — the durable record of human and agent dialogue, ordered by creation time.
type
string
Always "history".
sessionId
string
The session UUID.
items
array
Array of message items:

events

Response to get_events. Delivers the raw event log — every persisted event for the session, with its sequence number, type, payload, and creation timestamp. This is the substrate for full event replay.
type
string
Always "events".
sessionId
string
The session UUID.
events
array
Array of event objects:

member_list

Response to manage_members with action "list". Enumerates the tenant’s membership roster.
type
string
Always "member_list".
members
MemberRecord[]
Array of member records:

member_updated

Response to manage_members with action "set_role". Confirms the role change.
type
string
Always "member_updated".
userId
string
The affected member’s user identifier.
role
string
The member’s new role.

member_removed

Response to manage_members with action "remove". Confirms the excision.
type
string
Always "member_removed".
userId
string
The removed member’s user identifier.

error

The general-purpose error event. Sent in response to invalid messages, authentication failures, authorization violations, and internal errors. This is the gateway’s way of saying “no” — a structured refusal with a machine-readable code and a human-readable explanation. See Error Handling for the full error code reference and recovery strategies.
type
string
Always "error".
code
string
Machine-readable error code. Use this for programmatic dispatch — switch statements, retry logic, UI rendering.
message
string
Human-readable error description. Guaranteed to be sanitized: no stack traces, no API keys, no internal file paths.
{
  "type": "error",
  "code": "SessionNotFound",
  "message": "Session not found"
}

pong

Response to ping. Echoes the client’s original timestamp alongside the server’s own, providing the two data points needed to compute round-trip latency and approximate clock skew. This is the protocol’s metronome — the mechanism by which clients calibrate their perception of time against the server’s.
type
string
Always "pong".
clientTs
number
The ts value from the client’s ping message, echoed back unmodified.
serverTs
number
The server’s timestamp at pong emission time.
{
  "type": "pong",
  "clientTs": 1709312400000,
  "serverTs": 1709312400042
}

SessionMeta Schema

Many session lifecycle events include a SessionMeta object — the canonical metadata envelope for a session. Here is the complete schema:
FieldTypeDescription
idstringSession UUID
tenantIdstringTenant the session belongs to
namestring | nullHuman-readable name (may be null if never set)
agentTypestringAgent template type (e.g., "coding-agent")
statusSessionStatusOne of: inactive, activating, ready, running, waiting, deactivating, error
archivedbooleanWhether the session is archived
createdAtnumberCreation timestamp (Unix milliseconds)
updatedAtnumberLast update timestamp (Unix milliseconds)
lastActivityAtnumber | nullLast activity timestamp (null if never active)