Documentation
¶
Overview ¶
Package inprocess provides an in-process plugin router that dispatches tool calls, storage operations, and prompt requests via direct Go function calls instead of QUIC network round-trips. It implements the Sender interface used by StdioTransport and the StorageClient interface used by plugins.
Index ¶
- func ClientTLSConfigForBridge(certsDir string) (*tls.Config, error)
- type ExternalPlugin
- type QUICBridge
- type Router
- func (r *Router) GetStreamHandler(toolName string) (plugin.StreamingToolHandler, bool)
- func (r *Router) ListToolNames() []string
- func (r *Router) ListenAndServeQUIC(ctx context.Context, addr string, certsDir string) (string, error)
- func (r *Router) RegisterExternal(ep *ExternalPlugin)
- func (r *Router) RegisterPlugin(ep *plugin.ExportedPlugin)
- func (r *Router) Send(ctx context.Context, req *pluginv1.PluginRequest) (*pluginv1.PluginResponse, error)
- func (r *Router) SetStorageHandler(h plugin.StorageHandler)
- type Sender
- type TCPServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientTLSConfigForBridge ¶
ClientTLSConfigForBridge returns a TLS config suitable for the orchestra host to connect to child plugin QUIC servers. This is a convenience wrapper around the SDK's ClientTLSConfig with the correct ALPN protocol.
Types ¶
type ExternalPlugin ¶
type ExternalPlugin struct {
ID string
ProvidesAI []string
ToolDefs []*pluginv1.ToolDefinition
PromptDefs []*pluginv1.PromptDefinition
Client Sender
}
ExternalPlugin represents a QUIC-connected plugin that runs as a separate process (e.g. engine-rag written in Rust, or third-party plugins). The router forwards requests to it via its Send method.
func (*ExternalPlugin) Send ¶
func (ep *ExternalPlugin) Send(ctx context.Context, req *pluginv1.PluginRequest) (*pluginv1.PluginResponse, error)
Send forwards a request to the external plugin via its QUIC client.
type QUICBridge ¶
type QUICBridge struct {
// contains filtered or unexported fields
}
QUICBridge is a QUIC listener that child plugin processes connect to for storage access and cross-plugin tool calls. The router proxies all requests through its in-process handlers.
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router dispatches PluginRequests to in-process tool handlers, storage handlers, and prompt handlers. It replaces the QUIC-based orchestrator router for local IDE use. External plugins (e.g. engine-rag) are supported via ExternalPlugin entries that forward requests over QUIC.
Router implements the Sender interface:
Send(ctx, *PluginRequest) (*PluginResponse, error)
This means it can be passed directly to StdioTransport and also used as the clientAdapter for plugins that need cross-plugin storage calls.
func (*Router) GetStreamHandler ¶ added in v1.0.2
func (r *Router) GetStreamHandler(toolName string) (plugin.StreamingToolHandler, bool)
GetStreamHandler returns the streaming tool handler for the given tool name.
func (*Router) ListToolNames ¶
ListToolNames returns a list of all registered tool names (for logging).
func (*Router) ListenAndServeQUIC ¶
func (r *Router) ListenAndServeQUIC(ctx context.Context, addr string, certsDir string) (string, error)
ListenAndServeQUIC starts a QUIC listener using mTLS certificates from the given certsDir. Child plugins connect to this address (passed as --orchestrator-addr) to make storage and cross-plugin RPC calls.
Returns the actual bound address (e.g. "127.0.0.1:56789") which should be passed to spawnPlugin when starting child processes.
func (*Router) RegisterExternal ¶
func (r *Router) RegisterExternal(ep *ExternalPlugin)
RegisterExternal adds an external QUIC-connected plugin to the router.
func (*Router) RegisterPlugin ¶
func (r *Router) RegisterPlugin(ep *plugin.ExportedPlugin)
RegisterPlugin registers all tools, streaming tools, and prompts from an ExportedPlugin. If the plugin's manifest declares ProvidesAI, tools are indexed under the AI routing table instead of the generic tool table.
func (*Router) Send ¶
func (r *Router) Send(ctx context.Context, req *pluginv1.PluginRequest) (*pluginv1.PluginResponse, error)
Send implements the Sender interface. It dispatches a PluginRequest to the appropriate in-process handler based on the request type.
func (*Router) SetStorageHandler ¶
func (r *Router) SetStorageHandler(h plugin.StorageHandler)
SetStorageHandler sets the storage backend (typically storage-markdown).
type Sender ¶
type Sender interface {
Send(ctx context.Context, req *pluginv1.PluginRequest) (*pluginv1.PluginResponse, error)
}
Sender abstracts the QUIC client for external plugins.
type TCPServer ¶
type TCPServer struct {
// contains filtered or unexported fields
}
TCPServer listens for desktop app connections (Swift, Windows, Linux) using the same length-delimited Protobuf protocol as the orchestrator's TCP bridge. Each TCP connection handles one request/response pair.
func NewTCPServer ¶
NewTCPServer creates a TCP server bound to the given address.
func (*TCPServer) Addr ¶
Addr returns the actual listening address. Only valid after ListenAndServe.
func (*TCPServer) ListenAndServe ¶
ListenAndServe starts the TCP listener and processes connections until the context is cancelled. Each connection receives one PluginRequest and gets one PluginResponse back, using the SDK's length-delimited Protobuf framing.