Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BridgeClient ¶
type BridgeClient struct {
// contains filtered or unexported fields
}
BridgeClient speaks to the Node.js Playwright search bridge.
func NewBridgeClient ¶
func NewBridgeClient(baseURL string) *BridgeClient
NewBridgeClient creates a client pointed at the given base URL (e.g. "http://127.0.0.1:7331").
func (*BridgeClient) FetchPage ¶
func (b *BridgeClient) FetchPage(ctx context.Context, url string) (PageContent, error)
FetchPage fetches the text content of a URL via the bridge.
func (*BridgeClient) Health ¶
func (b *BridgeClient) Health(ctx context.Context) error
Health checks whether the bridge is alive.
func (*BridgeClient) Search ¶
func (b *BridgeClient) Search(ctx context.Context, query string, limit int) ([]SearchResult, error)
Search queries Google via the bridge and returns up to limit results.
type BridgeProcess ¶
type BridgeProcess struct {
// contains filtered or unexported fields
}
BridgeProcess manages the lifecycle of the Node.js search bridge subprocess.
func StartBridge ¶
StartBridge starts the Node.js bridge process and waits until it is healthy. The process is killed when ctx is cancelled.
func (*BridgeProcess) Client ¶
func (p *BridgeProcess) Client() *BridgeClient
Client returns the HTTP client connected to the running bridge.
func (*BridgeProcess) Stop ¶
func (p *BridgeProcess) Stop()
Stop shuts down the bridge process gracefully.
type Config ¶
type Config struct {
// Port the Node.js bridge listens on (default 7331).
Port int
// UseRealProfile tells the bridge to use the real Chrome user profile instead
// of the isolated ogcode profile. Chrome must be fully closed when enabled.
UseRealProfile bool
}
Config holds search bridge configuration derived from environment variables.
func ConfigFromEnv ¶
func ConfigFromEnv() Config
ConfigFromEnv reads OGCODE_SEARCH_BRIDGE_PORT and OGCODE_SEARCH_USE_REAL_PROFILE.
type PageContent ¶
type PageContent struct {
URL string `json:"url"`
Title string `json:"title"`
Text string `json:"text"`
Truncated bool `json:"truncated"`
}
PageContent is the extracted text returned by the /fetch endpoint.
type SearchResult ¶
type SearchResult struct {
Title string `json:"title"`
URL string `json:"url"`
Snippet string `json:"snippet"`
}
SearchResult is one entry returned by the /search endpoint.