Server Events
The gateway emits 100+ distinct event types to connected clients (84 literal types plus 18 generated GitHub action event types), organized into functional categories. Each event is a JSON object with atype discriminator field. Events scoped to a session carry a sessionId field; events within an active turn carry both sessionId and turnId. Streaming events include seq (monotonic sequence number) and ts (Unix milliseconds) fields for ordering and replay.
Event type names use two conventions: snake_case for original protocol events (e.g.,
turn_started, tool_call) and dot.notation for extended streaming events added in later protocol phases (e.g., message.delta, thinking.progress, terminal.stream). Both conventions are permanent parts of the protocol. SDKs normalize both forms into their native naming conventions.Connection Lifecycle (4 events)
Connection Lifecycle (4 events)
welcome
Sent immediately upon WebSocket connection. Indicates the protocol version and whether authentication is required.Always
"welcome".The protocol version supported by this gateway (currently
1 or 2).true in production; false in dev mode.connected
Sent immediately after welcome. Provides the server-assigned client ID and heartbeat configuration.Always
"connected".A UUID assigned to this connection by the gateway.
The interval in milliseconds between heartbeat events (default:
30000).Server timestamp in Unix milliseconds.
authenticated
Confirms successful authentication. Contains the user’s identity.Always
"authenticated".heartbeat
Sent every 30 seconds to all session topics with active subscribers. Clients should treat silence exceeding 35 seconds as a stale connection.Always
"heartbeat".Server timestamp in Unix milliseconds.
Session Lifecycle (7 events)
Session Lifecycle (7 events)
session_list
Response to list_sessions. Contains all sessions for the authenticated tenant.Always
"session_list".Array of session metadata objects.
session_created
Response to create_session. Contains the newly created session’s metadata.Always
"session_created".The full metadata of the new session.
session_updated
Broadcast when a session’s metadata changes — name, status, or other properties. Also broadcast to the tenant topic so all connected clients (even those not joined to the session) see the update in their session list.Always
"session_updated".The updated session metadata.
session_archived
Response to archive_session. Confirms the session has been archived.Always
"session_archived".The session metadata with
archived: true.session_unarchived
Response to unarchive_session. Confirms the session has been restored.Always
"session_unarchived".The session metadata with
archived: false.session_deleted
Response to delete_session. Confirms permanent deletion.Always
"session_deleted".The UUID of the deleted session.
session_state
Broadcast when a session transitions between states in its lifecycle state machine. The seven valid states are: inactive, activating, ready, running, waiting, deactivating, error.Always
"session_state".The session UUID.
The new state (e.g.,
"running", "idle", "error").Optional reason for the transition (e.g.,
"user_stopped", "turn_complete").Turn Lifecycle (4 events)
Turn Lifecycle (4 events)
turn_started
Broadcast when a new turn begins execution. Marks the beginning of agent output.Always
"turn_started".The session UUID.
The unique turn identifier.
Monotonic sequence number.
Server timestamp in Unix milliseconds.
text_delta
Streamed during a turn as the agent generates text. Each delta contains a fragment of the response. Accumulate deltas to reconstruct the full text. Ephemeral — not persisted.Always
"text_delta".The session UUID.
The turn identifier.
The text fragment.
Monotonic sequence number.
Server timestamp in Unix milliseconds.
turn_complete
Marks the successful completion of a turn. Contains the full final text (not a delta).Always
"turn_complete".The session UUID.
The turn identifier.
The complete response text.
Monotonic sequence number.
Server timestamp in Unix milliseconds.
turn_error
Indicates that a turn failed. The session transitions to an error state.Always
"turn_error".The session UUID.
The turn identifier (may be absent if the error occurred before turn assignment).
Human-readable error description.
Machine-readable error code (e.g.,
"AGENT_ERROR", "AGENT_DISCONNECTED").Monotonic sequence number.
Server timestamp in Unix milliseconds.
Message Streaming (2 events)
Message Streaming (2 events)
Extended streaming events using dot-notation. These provide an alternative to
Equivalent to
Marks message completion with the full text.
text_delta / turn_complete for clients that prefer the dot-notation convention.message.delta
Equivalent to text_delta. Streamed during a turn. Ephemeral.Always
"message.delta".The session UUID.
The turn identifier.
The text fragment.
Monotonic sequence number.
Server timestamp.
message.complete
Marks message completion with the full text.Always
"message.complete".The session UUID.
The turn identifier.
The complete message text.
Monotonic sequence number.
Server timestamp.
Tool Lifecycle (5 events)
Tool Lifecycle (5 events)
tool_call
The agent invoked a tool. Contains the tool name and arguments. Persisted.Always
"tool_call".The session UUID.
The turn identifier.
Unique identifier for this tool invocation.
The name of the tool being called (e.g.,
"read_file", "write_file", "bash").The arguments passed to the tool (structure varies by tool).
Monotonic sequence number.
Server timestamp.
tool_result
The result of a tool invocation. Persisted.Always
"tool_result".The session UUID.
The turn identifier.
Correlates to the
tool_call event.Execution status (e.g.,
"success", "error").The tool’s output text (may be absent for void results).
Monotonic sequence number.
Server timestamp.
tool_call_start
Signals the beginning of a tool invocation with streaming arguments. Use this for rendering tool call progress in real time. Ephemeral.Always
"tool_call_start".The session UUID.
The turn identifier.
Unique tool call identifier.
The tool being called.
Monotonic sequence number.
Server timestamp.
tool_call_delta
Streams incremental tool argument data. Accumulate deltas to reconstruct the full arguments. Ephemeral.Always
"tool_call_delta".The session UUID.
The turn identifier.
Correlates to the
tool_call_start event.Incremental argument fragment.
Monotonic sequence number.
Server timestamp.
tool_error
A tool invocation failed.Always
"tool_error".The session UUID.
The turn identifier.
The failed tool call’s identifier.
The error message from the tool execution.
Monotonic sequence number.
Server timestamp.
Interactive (3 events)
Interactive (3 events)
question_requested
The agent is asking the user one or more questions and has paused execution until answers are provided via answer_question.Always
"question_requested".The session UUID.
A unique ID for this question request. Must be echoed in
answer_question.Array of question objects:
Optional contextual information about why the question is being asked.
permission_requested
The agent is requesting permission to perform a sensitive operation (e.g., executing a destructive command, writing to a protected file).Always
"permission_requested".The session UUID.
Unique request identifier.
The tool requesting permission.
Human-readable description of the operation.
Monotonic sequence number.
Server timestamp.
approval_resolved
Confirms whether a permission request was approved or denied.Always
"approval_resolved".The session UUID.
Correlates to the
permission_requested event.true if the operation was approved.Monotonic sequence number.
Server timestamp.
Thinking (3 events)
Thinking (3 events)
Extended model thinking/reasoning events. These expose the model’s chain-of-thought process when available.
The model has begun a thinking/reasoning block.
Streamed during the thinking block. Ephemeral — not persisted.
The thinking block has ended. The model transitions to producing visible output.
thinking_start
The model has begun a thinking/reasoning block.Always
"thinking_start".The session UUID.
The turn identifier.
Monotonic sequence number.
Server timestamp.
thinking_progress
Streamed during the thinking block. Ephemeral — not persisted.Always
"thinking_progress".The session UUID.
The turn identifier.
Thinking text fragment.
Monotonic sequence number.
Server timestamp.
thinking_complete
The thinking block has ended. The model transitions to producing visible output.Always
"thinking_complete".The session UUID.
The turn identifier.
Monotonic sequence number.
Server timestamp.
Terminal (2 events)
Terminal (2 events)
Events from shell command execution within the agent’s sandbox.
Streams terminal output (stdout/stderr) from a running command. Ephemeral.
A terminal command has finished execution.
terminal_stream
Streams terminal output (stdout/stderr) from a running command. Ephemeral.Always
"terminal_stream".The session UUID.
The turn identifier.
Raw terminal output data.
Monotonic sequence number.
Server timestamp.
terminal_complete
A terminal command has finished execution.Always
"terminal_complete".The session UUID.
The turn identifier.
The process exit code (
0 for success).Monotonic sequence number.
Server timestamp.
Sandbox (4 events)
Sandbox (4 events)
Events related to the agent’s sandbox environment lifecycle.
A sandbox is being initialized for the session.
Progress updates during sandbox provisioning.
The sandbox is fully provisioned and ready for agent use.
The sandbox has been torn down.
sandbox_init
A sandbox is being initialized for the session.Always
"sandbox_init".The session UUID.
The sandbox provider name.
sandbox_provisioning
Progress updates during sandbox provisioning.Always
"sandbox_provisioning".The session UUID.
The current provisioning phase (e.g.,
"creating", "configuring", "installing_deps").Optional human-readable progress message.
sandbox_ready
The sandbox is fully provisioned and ready for agent use.Always
"sandbox_ready".The session UUID.
sandbox_removed
The sandbox has been torn down.Always
"sandbox_removed".The session UUID.
Why the sandbox was removed (e.g.,
"session_deleted", "timeout", "manual").Optional additional context.
State & Snapshots (2 events)
State & Snapshots (2 events)
state_snapshot
Delivered in response to join_session. Contains the complete current state of the session, enabling a client to render the full UI immediately without needing to replay the entire event history.Always
"state_snapshot".The session UUID.
Full session metadata.
If a turn is currently in progress:
The most recent conversation messages (up to 50).
How many clients are currently subscribed to this session.
Current sandbox status, if any.
stream_snapshot
An in-flight snapshot of the current streaming state during a turn. Useful for late-joining clients who need the accumulated state of all active streams.Always
"stream_snapshot".The session UUID.
The current turn identifier.
Accumulated text output.
Accumulated thinking output.
Active tool calls with their current status:
Usage & Billing (2 events)
Usage & Billing (2 events)
usage_update
Reports token usage and cost for a turn. Sent when the agent completes processing or at significant checkpoints. Ephemeral.Always
"usage_update".The session UUID.
The turn identifier.
The LLM model used (e.g.,
"claude-sonnet-4-20250514").The inference provider.
Number of input tokens consumed.
Number of output tokens generated.
Number of tokens served from cache.
Cost in micro-dollars (1,000,000 micro-dollars = $1.00).
usage_context
Reports context window utilization during a turn. Helps clients display warnings when approaching the model’s context limit.Always
"usage_context".The session UUID.
The turn identifier.
Current context window size in tokens.
Maximum context window size for the model.
Reliability (2 events)
Reliability (2 events)
gap
Indicates that a range of events is missing from the replay stream — typically because those events were ephemeral (not persisted) and occurred between the client’s afterSeq and the current head.Always
"gap".The session UUID.
The start of the gap (exclusive).
The end of the gap (inclusive).
replay_complete
Signals that event replay has finished. The client can now transition from replay mode to real-time event processing.Always
"replay_complete".The session UUID.
The highest sequence number replayed.
File System (4 events)
File System (4 events)
file_list
Response to list_files. Contains the directory listing.Always
"file_list".The session UUID.
Array of file entries:
file_content
Response to read_file or file_at_iteration. Contains the file’s content.Always
"file_content".The session UUID.
The file path.
The file content.
Content encoding (e.g.,
"utf-8", "base64").File size in bytes.
file_history_result
Response to file_history. Contains the version history for a file.Always
"file_history_result".The session UUID.
The file path.
Array of iteration metadata:
file_changed
Broadcast when a file in the agent’s workspace is modified during a turn.Always
"file_changed".The session UUID.
The file path that changed.
The new iteration number.
The new file size in bytes.
Control (3 events)
Control (3 events)
steer_sent
Confirms that a steering message was delivered to the agent.Always
"steer_sent".The session UUID.
A gateway-assigned UUID for the steer message.
The steering text that was delivered.
stop_acknowledged
Confirms that the stop signal was received and processed.Always
"stop_acknowledged".The session UUID.
The turn that was stopped.
server_shutdown
The gateway is shutting down gracefully. Clients should reconnect after a short delay.Always
"server_shutdown".Reason for shutdown (e.g.,
"maintenance", "restart").Server timestamp.
Generative UI (4 events)
Generative UI (4 events)
Events for streaming rich interactive UI components inline in the chat message stream. The agent emits SpecStream (JSONL patches) inside fenced code blocks, and the gateway parses them into these events.
Signals the beginning of a new UI spec block. The client creates a new UI part in the active turn. Ephemeral.
One RFC 6902 JSON Patch operation for an in-progress UI spec. Streamed as patches arrive from the agent. Ephemeral.
Final compiled spec for a UI block. Persisted — stored in message metadata for session replay.
Parse or validation error during spec compilation. Ephemeral.
ui.spec_start
Signals the beginning of a new UI spec block. The client creates a new UI part in the active turn. Ephemeral.Always
"ui.spec_start".The session UUID.
The turn identifier.
Unique identifier for this UI block within the turn.
Catalog version identifier (e.g.,
"diminuendo.chat-ui@v1").Monotonic sequence number.
Server timestamp in Unix milliseconds.
ui.spec_delta
One RFC 6902 JSON Patch operation for an in-progress UI spec. Streamed as patches arrive from the agent. Ephemeral.Always
"ui.spec_delta".The session UUID.
The turn identifier.
Correlates to the
ui.spec_start event.An RFC 6902 JSON Patch operation:
Monotonic sequence number.
Server timestamp.
ui.spec_complete
Final compiled spec for a UI block. Persisted — stored in message metadata for session replay.Always
"ui.spec_complete".The session UUID.
The turn identifier.
Correlates to the
ui.spec_start event.The complete UI spec:
Monotonic sequence number.
Server timestamp.
ui.spec_error
Parse or validation error during spec compilation. Ephemeral.Always
"ui.spec_error".The session UUID.
The turn identifier.
Correlates to the
ui.spec_start event.Human-readable error description.
Monotonic sequence number.
Server timestamp.
Data Responses (2 events)
Data Responses (2 events)
history
Response to get_history. Contains conversation messages.Always
"history".The session UUID.
Array of message items:
events
Response to get_events. Contains persisted events from the event log.Always
"events".The session UUID.
Array of event objects:
Member Management (3 events)
Member Management (3 events)
member_list
Response to manage_members with action "list".Always
"member_list".Array of member records:
member_updated
Response to manage_members with action "set_role".Always
"member_updated".The affected member’s user ID.
The member’s new role.
member_removed
Response to manage_members with action "remove".Always
"member_removed".The removed member’s user ID.
Errors (2 events)
Errors (2 events)
error
A general-purpose error event. Sent in response to invalid messages, authentication failures, authorization violations, and internal errors. See Error Handling for the full error code reference.Always
"error".Machine-readable error code.
Human-readable error description (sanitized — no stack traces, no API keys).
pong
Response to ping. Contains both the client’s original timestamp and the server’s timestamp for latency calculation.Always
"pong".The
ts value from the client’s ping message (echoed back).The server’s timestamp at pong time.
Automation Events (8+ events)
Automation Events (8+ events)
Events related to the automation engine — scheduled runs, heartbeats, and inbox management.
Response to
Confirmations for automation CRUD operations.
Confirms an automation was enabled or disabled.
Lifecycle events for automation runs.
Response to
automation_list
Response to list_automations. Contains all automations for the tenant.automation_created / automation_updated / automation_deleted
Confirmations for automation CRUD operations.automation_toggled
Confirms an automation was enabled or disabled.automation_run_started / automation_run_completed / automation_run_blocked
Lifecycle events for automation runs. run_blocked indicates the automation could not execute (e.g., session is already running).template_list
Response to list_templates. Contains available automation templates.Inbox Events (3 events)
Inbox Events (3 events)
GitHub Action Events (18 generated events)
GitHub Action Events (18 generated events)
Nine GitHub action types (
create_repo, create_pr, add_comment, add_review, update_pr, add_reviewers, fork_repo, create_issue, update_issue) each generate two event types: github.{action}_request (agent requests approval for a GitHub write action) and github.{action}_answer (user responds to the approval request). These are dynamically generated from the GITHUB_ACTIONS constant and the GitHubEventType mapped type union.Agent Mode & Approval Events
Agent Mode & Approval Events
mode_switched
Confirms the agent mode was changed (e.g., implement, ideate, plan, high_agency).autonomy_profile_updated
Confirms the autonomy profile was updated (e.g., ask_every_time, recommended, auto_pilot, never_ask).session_settings_updated
Confirms session-level settings were updated (e.g., coalesceMs).thread.name_delta / thread.name_complete
Streamed events from ThreadNamingService when auto-generating a session name after the first turn.Project Events (7 events)
Project Events (7 events)
project_list / project_created / project_updated / project_archived / project_unarchived / project_deleted / project_detail
CRUD responses for the project management system.Plan Lifecycle Events (4 events)
Plan Lifecycle Events (4 events)
plan_created / plan.created
Emitted when an agent creates a structured plan via the PlanCreate tool. Persistent — stored to session.db.UUID of the plan.
Human-readable plan title.
Ordered array of steps, each with
id, title, optional description, and status ("pending").plan_step_started / plan.step_started
Emitted when an agent begins work on a plan step. Ephemeral — not persisted.Plan UUID.
Step identifier (e.g.,
"step-0").Step title.
"in_progress".plan_step_completed / plan.step_completed
Emitted when a plan step completes or is skipped. Ephemeral."completed" or "skipped".plan_revised / plan.revised
Emitted when an agent revises an existing plan (new steps, same plan ID). Persistent.Optional reason for the revision.
Memory Lifecycle Events (3 events)
Memory Lifecycle Events (3 events)
memory_extracted / memory.extracted
Emitted at session cleanup when the agent’s MemoryExtractor produces reusable facts. Persistent.Array of extracted memories, each with
content, category, confidence (0.0–1.0), and tags.memory_recalled / memory.recalled
Response to a memory_recall client message. Contains aggregated memories from prior sessions. Persistent.Array with
id, sessionId, category, content, confidence, tags.memory_forgotten / memory.forgotten
Confirmation that a specific memory was deleted. Persistent.The ID of the forgotten memory.
SessionMeta Schema
Many session lifecycle events include aSessionMeta object. Here is the complete schema:
| Field | Type | Description |
|---|---|---|
id | string | Session UUID |
tenantId | string | Tenant the session belongs to |
name | string | null | Human-readable name (may be null) |
agentType | string | Agent template type (e.g., "coding-agent") |
status | SessionStatus | One of: inactive, activating, ready, running, waiting, deactivating, error |
archived | boolean | Whether the session is archived |
createdAt | number | Creation timestamp (Unix ms) |
updatedAt | number | Last update timestamp (Unix ms) |
lastActivityAt | number | null | Last activity timestamp (null if never active) |