api

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AgentMessageRoleUser       = "user"
	AgentMessageRoleAssistant  = "assistant"
	AgentMessageRoleToolResult = "tool_result"
)
View Source
const CurrentConversationSchemaVersion = 1

CurrentConversationSchemaVersion is the supported schema version for ResumeSessionRequest.ConversationLog.

Variables

This section is empty.

Functions

func AgentMessageToConversationEntries

func AgentMessageToConversationEntries(msg AgentMessage) []driver.ConversationEntry

AgentMessageToConversationEntries converts an AgentMessage into canonical termmux conversation entries used for cross-agent resume/session-log bridges.

Types

type AbortRequest

type AbortRequest struct {
	SessionID string
	Reason    string
}

type AbortResponse

type AbortResponse struct{}

type AgentEvent

type AgentEvent struct {
	Type            AgentEventType
	SessionID       string
	DriverSessionID string
	State           AgentState
	Turn            int
	Message         *AgentMessage
	Assistant       *ai.AssistantMessage
	ToolName        string
	ToolCallID      string
	ToolResult      *AgentToolResult
	Delta           string
	ControlMessage  string
	ErrorMessage    string
	At              time.Time
	Metadata        map[string]any
}

type AgentEventType

type AgentEventType string
const (
	EventSessionStarted        AgentEventType = "session_started"
	EventSessionEnded          AgentEventType = "session_ended"
	EventTurnStarted           AgentEventType = "turn_started"
	EventTurnCompleted         AgentEventType = "turn_completed"
	EventAgentMessageDelta     AgentEventType = "agent_message_delta"
	EventAgentMessageCompleted AgentEventType = "agent_message_completed"
	EventThinkingDelta         AgentEventType = "thinking_delta"
	EventToolStarted           AgentEventType = "tool_started"
	EventToolUpdate            AgentEventType = "tool_update"
	EventToolCompleted         AgentEventType = "tool_completed"
	EventStateChange           AgentEventType = "state_change"
	EventSteeringApplied       AgentEventType = "steering_applied"
	EventFollowUpEnqueued      AgentEventType = "followup_enqueued"
	EventAborted               AgentEventType = "aborted"
	EventDriverError           AgentEventType = "driver_error"
	EventProviderError         AgentEventType = "provider_error"
	EventToolError             AgentEventType = "tool_error"
	EventTerminalToolCompleted AgentEventType = "terminal_tool_completed"
)

type AgentMessage

type AgentMessage struct {
	Turn      int
	Message   ai.Message
	CreatedAt time.Time
}

func RecordToAgentMessage

func RecordToAgentMessage(rec AgentMessageRecord) (AgentMessage, error)

RecordToAgentMessage converts a serialized record back to an in-memory AgentMessage.

type AgentMessageRecord

type AgentMessageRecord struct {
	Turn      int
	Role      string
	Content   json.RawMessage
	CreatedAt time.Time
}

func AgentMessageToRecord

func AgentMessageToRecord(msg AgentMessage) (AgentMessageRecord, error)

AgentMessageToRecord converts an in-memory AgentMessage to the serializable record format used for persistence and resume.

type AgentService

AgentService manages agent loop sessions. Implemented by an in-process service and an RPC-backed client.

type AgentSessionSummary

type AgentSessionSummary struct {
	SessionID string
	State     string
	CreatedAt time.Time
}

type AgentState

type AgentState string

type AgentToolResult

type AgentToolResult struct {
	Content    []ai.ContentBlock
	SnapshotID string
	ExitCode   *int
	IsError    bool
	Metadata   map[string]any
}

type ContinueRequest

type ContinueRequest struct {
	SessionID string
}

type CreateAgentSessionRequest

type CreateAgentSessionRequest struct {
	SessionConfig
}

type CreateAgentSessionResponse

type CreateAgentSessionResponse struct {
	SessionID string
	State     string
}

type DestroyAgentSessionRequest

type DestroyAgentSessionRequest struct {
	SessionID string
}

type DestroyAgentSessionResponse

type DestroyAgentSessionResponse struct{}

type EventReceiver

type EventReceiver interface {
	Recv() (*AgentEvent, error)
	Close() error
}

EventReceiver is the transport-neutral stream interface for agent events.

type FollowUpRequest

type FollowUpRequest struct {
	SessionID string
	Message   string
}

type FollowUpResponse

type FollowUpResponse struct{}

type GetAgentSessionRequest

type GetAgentSessionRequest struct {
	SessionID string
}

type GetAgentSessionResponse

type GetAgentSessionResponse struct {
	SessionID       string
	State           string
	Metrics         SessionMetrics
	ConversationLen int
}

type ListAgentSessionsRequest

type ListAgentSessionsRequest struct {
	Labels map[string]string
}

type ListAgentSessionsResponse

type ListAgentSessionsResponse struct {
	Sessions []AgentSessionSummary
}

type ResumeSessionRequest

type ResumeSessionRequest struct {
	SessionConfig

	SchemaVersion   int
	ConversationLog []AgentMessageRecord
}

type ResumeSessionResponse

type ResumeSessionResponse struct {
	SessionID       string
	State           string
	ConversationLen int
	Warnings        []string
}

type SendMessageRequest

type SendMessageRequest struct {
	SessionID string
	Message   string
}

type SessionConfig

type SessionConfig struct {
	SessionID    string
	Driver       string
	Model        string
	Provider     string
	SystemPrompt string
	Tools        []string
	Metadata     map[string]any

	ToolEnvironment ToolEnvironmentConfig
}

type SessionMetrics

type SessionMetrics struct {
	TurnsStarted      uint64
	TurnsCompleted    uint64
	MessagesAppended  uint64
	ToolCallsStarted  uint64
	ToolCallsFinished uint64
	Errors            uint64
}

type SteerRequest

type SteerRequest struct {
	SessionID string
	Message   string
}

type SteerResponse

type SteerResponse struct{}

type SubscribeEventsRequest

type SubscribeEventsRequest struct {
	SessionID string
}

type ToolEnvironmentConfig

type ToolEnvironmentConfig struct {
	Type ToolEnvironmentType

	SandboxHostAddr  string
	SandboxSessionID string

	LocalRootDir string
}

type ToolEnvironmentType

type ToolEnvironmentType string
const (
	ToolEnvLocal   ToolEnvironmentType = "local"
	ToolEnvSandbox ToolEnvironmentType = "sandbox"
)

Jump to

Keyboard shortcuts

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