tbclient

package
v1.261109.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: MPL-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetScenarioEndpointPath added in v0.260903.1

func GetScenarioEndpointPath(scenario typ.RuleScenario) string

GetScenarioEndpointPath returns the endpoint path for a scenario. Exported because the HTTP client also needs it.

Types

type HTTPEndpointConfig

type HTTPEndpointConfig struct {
	BaseURL string
	APIKey  string
}

HTTPEndpointConfig represents HTTP endpoint configuration for a scenario.

type HTTPTBClient added in v0.260903.1

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

HTTPTBClient implements TBClient via HTTP calls to the tingly-box management API. Use this when the consumer runs in a separate process from the server.

func NewHTTPTBClient added in v0.260903.1

func NewHTTPTBClient(baseURL, userToken, modelToken string) *HTTPTBClient

NewHTTPTBClient creates an HTTP-based TBClient. baseURL is the server root (scheme + host + port, no trailing slash). userToken authenticates management API calls; modelToken is the gateway API key returned in env vars.

func (*HTTPTBClient) GetClaudeCodeEnv added in v0.260903.1

func (c *HTTPTBClient) GetClaudeCodeEnv(ctx context.Context) ([]string, error)

func (*HTTPTBClient) GetClaudeCodeSettingsPathForProfile added in v0.260903.1

func (c *HTTPTBClient) GetClaudeCodeSettingsPathForProfile(ctx context.Context, profileID string) (string, error)

func (*HTTPTBClient) GetDataDir added in v0.260903.1

func (c *HTTPTBClient) GetDataDir() string

func (*HTTPTBClient) GetHTTPEndpointForScenario added in v0.260903.1

func (c *HTTPTBClient) GetHTTPEndpointForScenario(_ context.Context, scenario typ.RuleScenario) (*HTTPEndpointConfig, error)

type MockTBClient

type MockTBClient struct {
	mock.Mock
}

MockTBClient is a mock implementation of TBClient interface for testing.

func (*MockTBClient) GetClaudeCodeEnv added in v0.260531.1

func (m *MockTBClient) GetClaudeCodeEnv(ctx context.Context) ([]string, error)

func (*MockTBClient) GetClaudeCodeSettingsPathForProfile added in v0.260723.1

func (m *MockTBClient) GetClaudeCodeSettingsPathForProfile(ctx context.Context, profileID string) (string, error)

func (*MockTBClient) GetDataDir

func (m *MockTBClient) GetDataDir() string

func (*MockTBClient) GetHTTPEndpointForScenario

func (m *MockTBClient) GetHTTPEndpointForScenario(ctx context.Context, scenario typ.RuleScenario) (*HTTPEndpointConfig, error)

type TBClient

type TBClient interface {
	// GetClaudeCodeEnv returns the environment variables (KEY=VALUE) that point
	// the Claude Code CLI at the tingly-box gateway's claude_code scenario.
	GetClaudeCodeEnv(ctx context.Context) ([]string, error)

	// GetClaudeCodeSettingsPathForProfile materializes a Claude Code profile's
	// settings.json and returns its path for the --settings CLI flag.
	// Returns ("", nil) for an empty profileID.
	GetClaudeCodeSettingsPathForProfile(ctx context.Context, profileID string) (string, error)

	// GetHTTPEndpointForScenario returns HTTP endpoint configuration for a scenario.
	GetHTTPEndpointForScenario(ctx context.Context, scenario typ.RuleScenario) (*HTTPEndpointConfig, error)

	// GetDataDir returns the data directory path for storing sessions and other data.
	GetDataDir() string
}

TBClient defines the interface for remote control interactions with the tingly-box server. Both an in-memory implementation (TBClientImpl, for in-process use) and an HTTP implementation (HTTPTBClient, for out-of-process use) satisfy this interface.

type TBClientImpl

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

TBClientImpl implements TBClient via direct in-memory config access. Use this when the consumer runs in the same process as the server.

func NewTBClient

func NewTBClient(cfg *serverconfig.Config) *TBClientImpl

NewTBClient creates a new in-memory TB client instance.

func (*TBClientImpl) ClaudeCodeDefaultModel added in v1.261022.1

func (c *TBClientImpl) ClaudeCodeDefaultModel() string

ClaudeCodeDefaultModel is the request model Claude Code is pointed at by default (ANTHROPIC_MODEL in GetClaudeCodeEnv): the claude_code scenario's default tier, which its routing rules resolve.

func (*TBClientImpl) GetClaudeCodeEnv added in v0.260531.1

func (c *TBClientImpl) GetClaudeCodeEnv(ctx context.Context) ([]string, error)

GetClaudeCodeEnv builds the env vars needed to route the Claude Code CLI through the local tingly-box gateway.

func (*TBClientImpl) GetClaudeCodeSettingsPathForProfile added in v0.260723.1

func (c *TBClientImpl) GetClaudeCodeSettingsPathForProfile(ctx context.Context, profileID string) (string, error)

GetClaudeCodeSettingsPathForProfile materializes the profiled scenario settings file and returns its path for the --settings CLI flag.

func (*TBClientImpl) GetDataDir

func (c *TBClientImpl) GetDataDir() string

GetDataDir returns the data directory path for storing sessions and other data.

func (*TBClientImpl) GetHTTPEndpointForScenario

func (c *TBClientImpl) GetHTTPEndpointForScenario(ctx context.Context, scenario typ.RuleScenario) (*HTTPEndpointConfig, error)

GetHTTPEndpointForScenario returns HTTP endpoint configuration for a scenario.

Jump to

Keyboard shortcuts

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