Documentation
¶
Index ¶
- type Config
- type CoreService
- type FlowSink
- type Listener
- type Liveness
- type Manager
- func (m *Manager) AdapterTools() map[string][]wire.MCPTool
- func (m *Manager) Count() int
- func (m *Manager) Get(name string) (*Record, bool)
- func (m *Manager) HandleConn(ctx context.Context, conn net.Conn)
- func (m *Manager) HasAdapter(name string) bool
- func (m *Manager) InvokeTool(ctx context.Context, name string, args json.RawMessage) (wire.InvokeToolResult, *wire.Error)
- func (m *Manager) PushRules(ctx context.Context)
- func (m *Manager) SetToolsChangedHook(fn func())
- func (m *Manager) Shutdown(ctx context.Context)
- func (m *Manager) SidecarSend(ctx context.Context, adapter string, p wire.SidecarSendParams) (wire.SidecarSendResult, *wire.Error)
- type Record
- type RuleSource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Socket string
HeartbeatInterval time.Duration
HeartbeatTimeout time.Duration
NativeProxyPort int // proxy listen port; excluded from sidecar early_claim ranges
ReservedNames []string // built-in adapter names sidecars may not reuse
// ScopeCheck gates dial_upstream destinations; nil allows any host.
ScopeCheck func(host string) (allowed bool, reason string)
// DialTimeout bounds each dial_upstream connection attempt.
DialTimeout time.Duration
// NativeHTTPSend originates an outbound HTTP request through the in-process
// proxy on a sidecar's behalf; nil disables native origination.
NativeHTTPSend func(ctx context.Context, p wire.SidecarSendParams, invokedBy string) (wire.SidecarSendResult, *wire.Error)
}
Config configures the sidecar Manager and listener.
type CoreService ¶
type CoreService interface {
// CoreInvoke dispatches a core MCP tool by name.
CoreInvoke(ctx context.Context, tool string, params json.RawMessage) (content string, isErr bool, err error)
// CoreToolNames lists core tool names for registration-time collision checks.
CoreToolNames() []string
}
CoreService dispatches core MCP tools and reports their names.
type FlowSink ¶
type FlowSink interface {
Store(*types.Flow) string
Complete(flowID string, resp *types.Message, completedAt time.Time, annotations map[string]any) bool
SetInvokedBy(flowID, invokedBy string) bool
Get(flowID string) (*types.Flow, bool)
ShouldCapture(*types.Flow) bool
}
FlowSink persists sidecar-emitted flows into sectool's unified history. Satisfied by *proxy.HistoryStore.
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener accepts sidecar connections on the local socket and hands each to the Manager. Its lifecycle is owned by the native proxy backend.
func NewListener ¶
NewListener binds the local socket: a Unix domain socket on unix, loopback TCP on Windows. Call Serve to start accepting.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager owns the registry of connected sidecars: registration, conflict resolution, heartbeat, reconnect/resume, and shutdown.
func NewManager ¶
func NewManager(cfg Config, registry *protocol.Registry, flows FlowSink, coreInvoke CoreService, rules RuleSource) *Manager
NewManager creates a Manager. registry dispatches connections to sidecar adapters, flows sinks push_flow, coreInvoke backs core_invoke, and rules supplies sync_rules snapshots.
func (*Manager) AdapterTools ¶
AdapterTools returns each healthy adapter's MCP tools keyed by adapter name, as a single consistent snapshot.
func (*Manager) HandleConn ¶
HandleConn drives one accepted sidecar connection until it closes.
func (*Manager) HasAdapter ¶
HasAdapter reports whether a healthy adapter is registered under name.
func (*Manager) InvokeTool ¶
func (m *Manager) InvokeTool(ctx context.Context, name string, args json.RawMessage) (wire.InvokeToolResult, *wire.Error)
InvokeTool delegates a sidecar-registered tool call to its owning adapter and returns the tool's result.
func (*Manager) PushRules ¶
PushRules sends each connected sidecar its scoped rule snapshot and records the acked version. It waits for every push to complete.
func (*Manager) SetToolsChangedHook ¶
func (m *Manager) SetToolsChangedHook(fn func())
SetToolsChangedHook registers a callback invoked when the set of connected adapters changes, so the MCP server can recompose the advertised tool list.
func (*Manager) SidecarSend ¶
func (m *Manager) SidecarSend(ctx context.Context, adapter string, p wire.SidecarSendParams) (wire.SidecarSendResult, *wire.Error)
SidecarSend routes a replay or origination to the named adapter. For replay (FlowID set) it fetches the source flow and passes it inline.
type Record ¶
type Record struct {
Name string
ProtoVersion wire.ProtocolVersion
Protocols []string
Capabilities wire.Capabilities
MCPTools []wire.MCPTool // tool definitions the sidecar provides
InstanceID string
// contains filtered or unexported fields
}
Record is the registry entry for one connected sidecar adapter.