protocol

package
v0.303.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MethodStateSync requests a full state snapshot from the primary instance.
	MethodStateSync = "state.sync"
	// MethodSessionList requests the full list of sessions.
	MethodSessionList = "session.list"
	// MethodSessionGet requests a single session by ID.
	MethodSessionGet = "session.get"
	// MethodSessionActivate requests changing the active session.
	MethodSessionActivate = "session.activate"
	// MethodMessageSend sends a user message to a session.
	MethodMessageSend = "message.send"
	// MethodSessionInterrupt cancels the running LLM call for a session.
	MethodSessionInterrupt = "session.interrupt"
	// MethodInstancePing checks that the instance is alive.
	MethodInstancePing = "instance.ping"
	// MethodInstanceInfo retrieves detailed instance information.
	MethodInstanceInfo = "instance.info"
	// MethodMessageList requests the message history for a session.
	MethodMessageList = "message.list"
)

RPC method name constants used for JSON-RPC 2.0 calls over the ROUTER socket.

View Source
const (
	// TopicSessionList is published when the session list changes; carries a full list.
	TopicSessionList = "session.list"
	// TopicSessionUpdate is published when a single session is created or updated.
	TopicSessionUpdate = "session.update"
	// TopicSessionActivated is published when the active session changes.
	TopicSessionActivated = "session.activated"
	// TopicSessionDeleted is published when a session is deleted.
	TopicSessionDeleted = "session.deleted"
)

Session topics — published on the PUB socket for session lifecycle events.

View Source
const (
	// TopicLLMToken is published for each streaming LLM token.
	TopicLLMToken = "llm.token"
	// TopicLLMStart is published when an LLM call begins.
	TopicLLMStart = "llm.start"
	// TopicLLMEnd is published when an LLM call completes.
	TopicLLMEnd = "llm.end"
)

LLM topics — published during LLM inference.

View Source
const (
	// TopicToolStart is published when tool execution begins.
	TopicToolStart = "tool.start"
	// TopicToolEnd is published when tool execution completes.
	TopicToolEnd = "tool.end"
)

Tool topics — published during tool execution.

View Source
const (
	// TopicInstanceHeartbeat is published every 5 seconds to signal liveness.
	TopicInstanceHeartbeat = "instance.heartbeat"
	// TopicInstanceShutdown is published on graceful shutdown.
	TopicInstanceShutdown = "instance.shutdown"
)

Instance topics — published for instance lifecycle management.

View Source
const (
	// TopicMessageAppend is published when a new message is added to a session.
	TopicMessageAppend = "message.append"
)

Message topics.

Variables

This section is empty.

Functions

This section is empty.

Types

type HeartbeatPayload

type HeartbeatPayload struct {
	InstanceID      string    `json:"instance_id"`
	ActiveSessionID string    `json:"active_session_id,omitempty"`
	SessionCount    int       `json:"session_count"`
	Uptime          string    `json:"uptime"` // duration string e.g. "1h30m"
	StartedAt       time.Time `json:"started_at"`
}

HeartbeatPayload is published on instance.heartbeat every 5 seconds.

type LLMEndPayload

type LLMEndPayload struct {
	SessionID string `json:"session_id"`
	TokensIn  int    `json:"tokens_in"`
	TokensOut int    `json:"tokens_out"`
}

LLMEndPayload is published on llm.end when an LLM call completes.

type LLMStartPayload

type LLMStartPayload struct {
	SessionID string `json:"session_id"`
}

LLMStartPayload is published on llm.start when an LLM call begins.

type LLMTokenPayload

type LLMTokenPayload struct {
	SessionID string `json:"session_id"`
	Token     string `json:"token"`
}

LLMTokenPayload is published on llm.token for each streaming token.

type MessageAppendPayload

type MessageAppendPayload struct {
	SessionID string `json:"session_id"`
	MessageID string `json:"message_id"`
	Role      string `json:"role"`    // "user" or "assistant"
	Content   string `json:"content"` // text content or summary
}

MessageAppendPayload is published on message.append.

type MessageListParams added in v0.302.0

type MessageListParams struct {
	SessionID string `json:"session_id"`
}

MessageListParams is the parameter struct for message.list.

type MessagePayload added in v0.302.0

type MessagePayload struct {
	ID        string    `json:"id"`
	Role      string    `json:"role"`    // "user" or "assistant"
	Content   string    `json:"content"` // text representation of the message
	CreatedAt time.Time `json:"created_at"`
}

MessagePayload is a single message returned by message.list.

type MessageSendParams

type MessageSendParams struct {
	SessionID string `json:"session_id"`
	Content   string `json:"content"`
}

MessageSendParams is the parameter struct for message.send.

type OKResult

type OKResult struct {
	OK bool `json:"ok"`
}

OKResult is a generic success response.

type PingResult

type PingResult struct {
	Status     string `json:"status"`
	InstanceID string `json:"instance_id"`
	Uptime     string `json:"uptime"`
}

PingResult is the response for instance.ping.

type SessionActivateParams

type SessionActivateParams struct {
	SessionID string `json:"session_id"`
}

SessionActivateParams is the parameter struct for session.activate.

type SessionGetParams

type SessionGetParams struct {
	SessionID string `json:"session_id"`
}

SessionGetParams is the parameter struct for session.get.

type SessionInterruptParams

type SessionInterruptParams struct {
	SessionID string `json:"session_id"`
}

SessionInterruptParams is the parameter struct for session.interrupt.

type SessionListPayload

type SessionListPayload struct {
	Sessions []SessionPayload `json:"sessions"`
}

SessionListPayload is published on session.list and carries the full session list.

type SessionPayload

type SessionPayload struct {
	ID           string    `json:"id"`
	Title        string    `json:"title"`
	UpdatedAt    time.Time `json:"updated_at"`
	MessageCount int64     `json:"message_count"`
}

SessionPayload is published on session.update, session.activated, and session.deleted.

type ShutdownPayload

type ShutdownPayload struct {
	InstanceID string `json:"instance_id"`
	Reason     string `json:"reason,omitempty"`
}

ShutdownPayload is published on instance.shutdown during graceful shutdown.

type StateSyncParams

type StateSyncParams struct {
	ProjectID string `json:"project_id,omitempty"`
}

StateSyncParams is the parameter struct for the state.sync RPC method.

type StateSyncResult

type StateSyncResult struct {
	Sessions        []SessionPayload `json:"sessions"`
	ActiveSessionID string           `json:"active_session_id,omitempty"`
	InstanceID      string           `json:"instance_id"`
}

StateSyncResult is the response for state.sync.

type ToolEndPayload

type ToolEndPayload struct {
	SessionID string `json:"session_id"`
	ToolName  string `json:"tool_name"`
	CallID    string `json:"call_id"`
	IsError   bool   `json:"is_error"`
	Result    string `json:"result"` // short summary of result
}

ToolEndPayload is published on tool.end when tool execution completes.

type ToolStartPayload

type ToolStartPayload struct {
	SessionID string `json:"session_id"`
	ToolName  string `json:"tool_name"`
	CallID    string `json:"call_id"`
	Params    string `json:"params"` // JSON params as string
}

ToolStartPayload is published on tool.start when tool execution begins.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL