home

package
v7.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDisabled       = errors.New("home client disabled")
	ErrNotConnected   = errors.New("home not connected")
	ErrEmptyResponse  = errors.New("home returned empty response")
	ErrAuthNotFound   = errors.New("home auth not found")
	ErrConfigNotFound = errors.New("home config not found")
	ErrModelsNotFound = errors.New("home models not found")
)

Functions

func ClearCurrent

func ClearCurrent()

ClearCurrent removes the active home client.

func SetCurrent

func SetCurrent(client *Client)

SetCurrent sets the active home client used by runtime integrations.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func Current

func Current() *Client

Current returns the active home client instance, if any.

func New

func New(homeCfg config.HomeConfig) *Client

func (*Client) Close

func (c *Client) Close()

func (*Client) Enabled

func (c *Client) Enabled() bool

func (*Client) GetConfig

func (c *Client) GetConfig(ctx context.Context) ([]byte, error)

func (*Client) GetModels

func (c *Client) GetModels(ctx context.Context) ([]byte, error)

func (*Client) GetRefreshAuth

func (c *Client) GetRefreshAuth(ctx context.Context, authIndex string) ([]byte, error)

func (*Client) HeartbeatOK

func (c *Client) HeartbeatOK() bool

func (*Client) LPushUsage

func (c *Client) LPushUsage(ctx context.Context, payload []byte) error

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) error

func (*Client) RPopAuth

func (c *Client) RPopAuth(ctx context.Context, requestedModel string, sessionID string, headers http.Header, count int) ([]byte, error)

func (*Client) RPushRequestLog

func (c *Client) RPushRequestLog(ctx context.Context, payload []byte) error

func (*Client) StartConfigSubscriber

func (c *Client) StartConfigSubscriber(ctx context.Context, onConfig func([]byte) error)

StartConfigSubscriber connects to home, fetches config once via GET config, then subscribes to the "config" channel to receive runtime config updates.

The subscription connection is treated as the home heartbeat. HeartbeatOK is set to true only after the initial GET config succeeds and the SUBSCRIBE connection is established. When the subscription ends unexpectedly, HeartbeatOK becomes false and the loop reconnects.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL