Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentNotifier ¶
type AgentNotifier interface {
Notify(ctx context.Context, agentID string, payload map[string]any) error
}
AgentNotifier pushes notifications to connected agents.
type MCPNotifier ¶
type MCPNotifier struct {
// contains filtered or unexported fields
}
MCPNotifier implements AgentNotifier using MCP SSE push.
func NewMCPNotifier ¶
func NewMCPNotifier(mcpServer *server.MCPServer, sessions *SessionRegistry) *MCPNotifier
NewMCPNotifier creates a notifier that pushes via MCP SSE.
type OpcodeServer ¶
type OpcodeServer struct {
// contains filtered or unexported fields
}
OpcodeServer wraps an MCP server with opcode-specific tool handlers.
func NewOpcodeServer ¶
func NewOpcodeServer(deps OpcodeServerDeps) *OpcodeServer
NewOpcodeServer creates a new OpcodeServer with all 6 tools registered.
func (*OpcodeServer) MCPServer ¶
func (s *OpcodeServer) MCPServer() *server.MCPServer
MCPServer returns the underlying MCPServer for testing or custom transports.
func (*OpcodeServer) NewSSEServer ¶
func (s *OpcodeServer) NewSSEServer(baseURL string) *server.SSEServer
NewSSEServer creates an SSE server for use with a custom HTTP mux. The returned SSEServer implements http.Handler and can be mounted at /sse and /message.
func (*OpcodeServer) ServeSSE ¶
func (s *OpcodeServer) ServeSSE(ctx context.Context, addr, baseURL string) error
ServeSSE starts the SSE transport and blocks until ctx is cancelled.
func (*OpcodeServer) Sessions ¶
func (s *OpcodeServer) Sessions() *SessionRegistry
Sessions returns the session registry for creating notifiers.
type OpcodeServerDeps ¶
type OpcodeServerDeps struct {
Executor engine.Executor
Store store.Store
Vault secrets.Vault
Registry actions.ActionRegistry
Hub streaming.EventHub
Sessions *SessionRegistry
Logger *slog.Logger
BinDir string // Path to external tool binaries (e.g. ~/.opcode/bin)
}
OpcodeServerDeps holds the dependencies for creating an OpcodeServer.
type SessionRegistry ¶
type SessionRegistry struct {
// contains filtered or unexported fields
}
SessionRegistry maps agent IDs to MCP session IDs. Populated automatically when agents call any tool that includes agent_id.
func NewSessionRegistry ¶
func NewSessionRegistry() *SessionRegistry
NewSessionRegistry creates a new empty SessionRegistry.
func (*SessionRegistry) Register ¶
func (r *SessionRegistry) Register(agentID, sessionID string)
Register associates an agent ID with a session ID. If the agent already has a session, it is overwritten (reconnect).
func (*SessionRegistry) Remove ¶
func (r *SessionRegistry) Remove(sessionID string)
Remove deletes all agent mappings for the given session ID. Called when a session disconnects.
func (*SessionRegistry) SessionFor ¶
func (r *SessionRegistry) SessionFor(agentID string) (string, bool)
SessionFor returns the session ID for the given agent, if connected.