Documentation
¶
Index ¶
- Constants
- Variables
- func Register(name string, e Engine)
- type BackendAttempt
- type BalanceState
- type BalanceStore
- type Engine
- type ExaAdapter
- type FileBalanceStore
- type Hit
- type MCPAdapterServer
- type MCPToolCaller
- type MemoryBalanceStore
- type NativeCloakAdapter
- type ParallelAdapter
- type Request
- type Response
- type ResponseMetadata
- type Router
- type RouterError
- type RouterOptions
Constants ¶
const ( ExaAdapterName = "exa" ExaSearchToolName = "web_search_exa" ExaFetchToolName = "web_fetch_exa" )
const ( ParallelAdapterName = "parallel" ParallelSearchToolName = "web_search" ParallelFetchToolName = "web_fetch" )
const (
CloakAdapterName = "cloak"
)
const InternalEngineName = "internal"
Variables ¶
var ( ErrUnknownEngine = errors.New("unknown search engine") ErrNoResults = errors.New("search returned no results") )
Functions ¶
Types ¶
type BackendAttempt ¶ added in v2026.909.0
type BalanceState ¶ added in v2026.909.0
type BalanceState struct {
Month string `json:"month"`
Counts map[string]int64 `json:"counts"`
Next string `json:"next,omitempty"`
}
BalanceState is the persisted scheduler state for the MCP-backed search adapters. Counts represent backend attempts, including attempts that later fail and cause a fallback.
type BalanceStore ¶ added in v2026.909.0
type BalanceStore interface {
Update(func(*BalanceState) error) (BalanceState, error)
}
BalanceStore provides an atomic read-modify-write operation. The file implementation uses a process lock as well as an OS file lock so two Solomon processes do not lose increments made in the same month.
func DefaultBalanceStore ¶ added in v2026.909.0
func DefaultBalanceStore() BalanceStore
type ExaAdapter ¶ added in v2026.909.0
type ExaAdapter struct {
// contains filtered or unexported fields
}
ExaAdapter translates Solomon's neutral search request into Exa's hosted MCP search tool. The hosted tool intentionally exposes only query and numResults, so provider-specific search settings are not guessed or sent as unsupported MCP arguments.
func NewExaAdapter ¶ added in v2026.909.0
func NewExaAdapter(caller MCPToolCaller, serverName string) (*ExaAdapter, error)
type FileBalanceStore ¶ added in v2026.909.0
type FileBalanceStore struct {
// contains filtered or unexported fields
}
func NewFileBalanceStore ¶ added in v2026.909.0
func NewFileBalanceStore(path string) (*FileBalanceStore, error)
func (*FileBalanceStore) Update ¶ added in v2026.909.0
func (s *FileBalanceStore) Update(fn func(*BalanceState) error) (BalanceState, error)
type Hit ¶
type Hit struct {
Title string `json:"title"`
URL string `json:"url"`
Snippet string `json:"snippet,omitempty"`
Content string `json:"content,omitempty"`
Author string `json:"author,omitempty"`
PublishedAt string `json:"publishedAt,omitempty"`
Score *float64 `json:"score,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
type MCPAdapterServer ¶ added in v2026.909.0
MCPAdapterServer identifies one internal MCP server without exposing its transport, headers, environment, or other configuration secrets.
type MCPToolCaller ¶ added in v2026.909.0
type MCPToolCaller interface {
CallInternalTool(ctx context.Context, serverName, toolName, intent string, args map[string]any) (any, error)
}
MCPToolCaller is the narrow host-side surface needed by MCP-backed search adapters. The concrete MCP manager remains outside this package so the adapter can be unit-tested without a live remote server.
type MemoryBalanceStore ¶ added in v2026.909.0
type MemoryBalanceStore struct {
// contains filtered or unexported fields
}
func NewMemoryBalanceStore ¶ added in v2026.909.0
func NewMemoryBalanceStore(initial BalanceState) *MemoryBalanceStore
func (*MemoryBalanceStore) Snapshot ¶ added in v2026.909.0
func (s *MemoryBalanceStore) Snapshot() BalanceState
func (*MemoryBalanceStore) Update ¶ added in v2026.909.0
func (s *MemoryBalanceStore) Update(fn func(*BalanceState) error) (BalanceState, error)
type NativeCloakAdapter ¶ added in v2026.909.0
type NativeCloakAdapter struct {
// contains filtered or unexported fields
}
NativeCloakAdapter is Solomon's local CloakBrowser fallback. The browser process is owned by internal/cloak; this adapter only turns a rendered search page into the provider-neutral search response.
func NewNativeCloakAdapter ¶ added in v2026.909.0
func NewNativeCloakAdapter(browser cloak.Browser) (*NativeCloakAdapter, error)
type ParallelAdapter ¶ added in v2026.909.0
type ParallelAdapter struct {
// contains filtered or unexported fields
}
ParallelAdapter translates Solomon's neutral request into the current Parallel Search MCP contract. The MCP tool accepts an objective and one or more search queries; max-results and advanced settings are connection-level settings on the public MCP endpoint, so the adapter trims the returned list locally instead of sending unsupported per-call arguments.
func NewParallelAdapter ¶ added in v2026.909.0
func NewParallelAdapter(caller MCPToolCaller, serverName string) (*ParallelAdapter, error)
type Response ¶
type Response struct {
Engine string `json:"engine"`
Hits []Hit `json:"hits"`
HasMore bool `json:"hasMore,omitempty"`
SearxBaseURL string `json:"searxBaseURL,omitempty"`
Metadata *ResponseMetadata `json:"metadata,omitempty"`
}
type ResponseMetadata ¶ added in v2026.909.0
type ResponseMetadata struct {
Provider string `json:"provider,omitempty"`
Adapter string `json:"adapter,omitempty"`
SessionID string `json:"sessionId,omitempty"`
ProviderRequestID string `json:"providerRequestId,omitempty"`
Warnings []string `json:"warnings,omitempty"`
Fallback bool `json:"fallback,omitempty"`
Partial bool `json:"partial,omitempty"`
Attempts []BackendAttempt `json:"attempts,omitempty"`
ProviderData map[string]any `json:"providerData,omitempty"`
}
type Router ¶ added in v2026.909.0
type Router struct {
// contains filtered or unexported fields
}
Router balances requests among configured web-search adapters. A backend attempt is reserved before the call, so failures are counted just like successful requests and the monthly usage stays balanced across fallbacks.
func NewMCPRouter ¶ added in v2026.909.0
func NewMCPRouter(caller MCPToolCaller, servers []MCPAdapterServer, options RouterOptions) (*Router, error)
NewMCPRouter creates only the adapters Solomon knows how to host. Unknown internal adapter labels are ignored and logged so one optional backend does not disable another valid backend from the same mcp.json.
type RouterError ¶ added in v2026.909.0
type RouterError struct {
Attempts []BackendAttempt
Err error
}
RouterError reports that every selected backend failed. Its Unwrap method preserves errors.Is checks such as errors.Is(err, ErrNoResults).
func (*RouterError) Error ¶ added in v2026.909.0
func (e *RouterError) Error() string
func (*RouterError) Unwrap ¶ added in v2026.909.0
func (e *RouterError) Unwrap() error
type RouterOptions ¶ added in v2026.909.0
type RouterOptions struct {
Store BalanceStore
Now func() time.Time
Fallback Engine
}