tbclient

package
v0.260514.4 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: MPL-2.0 Imports: 7 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 SmartGuideRuleUUID added in v0.260507.1

func SmartGuideRuleUUID(botUUID string) string

SmartGuideRuleUUID generates the rule UUID for a specific bot Uses the bot UUID directly as the rule UUID for consistency

Types

type ConnectionConfig

type ConnectionConfig struct {
	BaseURL string `json:"base_url"` // Default: ClaudeCode scenario URL
	APIKey  string `json:"api_key"`
}

ConnectionConfig contains base URL and API key

type DefaultServiceConfig

type DefaultServiceConfig struct {
	ProviderUUID string `json:"provider_uuid"`
	ProviderName string `json:"provider_name"`
	ModelID      string `json:"model_id"`
	BaseURL      string `json:"base_url"`  // ClaudeCode scenario base URL
	APIKey       string `json:"api_key"`   // Provider's API key
	APIStyle     string `json:"api_style"` // "anthropic" or "openai"
}

DefaultServiceConfig contains the complete default service configuration This reuses the ClaudeCode scenario's active service

type HTTPEndpointConfig

type HTTPEndpointConfig struct {
	BaseURL string // e.g., "http://localhost:12580/tingly/_smart_guide/"
	APIKey  string // tingly-box token
}

HTTPEndpointConfig represents HTTP endpoint configuration for a scenario

type MockTBClient

type MockTBClient struct {
	mock.Mock
}

MockTBClient is a mock implementation of TBClient interface for testing This mock can be shared across all packages that need to test TBClient functionality

func (*MockTBClient) EnsureSmartGuideRule

func (m *MockTBClient) EnsureSmartGuideRule(ctx context.Context, providerUUID, modelID string) error

EnsureSmartGuideRule mocks the EnsureSmartGuideRule method Deprecated: Use EnsureSmartGuideRuleForBot for bot-specific rules

func (*MockTBClient) EnsureSmartGuideRuleForBot

func (m *MockTBClient) EnsureSmartGuideRuleForBot(ctx context.Context, botUUID, botName, providerUUID, modelID string) error

EnsureSmartGuideRuleForBot mocks the EnsureSmartGuideRuleForBot method

func (*MockTBClient) GetConnectionConfig

func (m *MockTBClient) GetConnectionConfig(ctx context.Context) (*ConnectionConfig, error)

GetConnectionConfig mocks the GetConnectionConfig method

func (*MockTBClient) GetDataDir

func (m *MockTBClient) GetDataDir() string

GetDataDir mocks the GetDataDir method

func (*MockTBClient) GetDefaultRule

func (m *MockTBClient) GetDefaultRule(ctx context.Context) (*typ.Rule, error)

GetDefaultRule mocks the GetDefaultRule method

func (*MockTBClient) GetDefaultRuleForScenario

func (m *MockTBClient) GetDefaultRuleForScenario(ctx context.Context, scenario typ.RuleScenario) (*typ.Rule, error)

GetDefaultRuleForScenario mocks the GetDefaultRuleForScenario method

func (*MockTBClient) GetDefaultService

func (m *MockTBClient) GetDefaultService(ctx context.Context) (*DefaultServiceConfig, error)

GetDefaultService mocks the GetDefaultService method

func (*MockTBClient) GetHTTPEndpointForScenario

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

GetHTTPEndpointForScenario mocks the GetHTTPEndpointForScenario method

func (*MockTBClient) GetProviders

func (m *MockTBClient) GetProviders(ctx context.Context) ([]ProviderInfo, error)

GetProviders mocks the GetProviders method

func (*MockTBClient) SelectModel

func (m *MockTBClient) SelectModel(ctx context.Context, req ModelSelectionRequest) (*ModelConfig, error)

SelectModel mocks the SelectModel method

type ModelConfig

type ModelConfig struct {
	ProviderUUID string `json:"provider_uuid"`
	ModelID      string `json:"model_id"`
	BaseURL      string `json:"base_url"`
	APIKey       string `json:"api_key"`
	APIStyle     string `json:"api_style"` // "openai" or "anthropic"
}

ModelConfig contains the configuration needed for @tb execution

type ModelSelectionRequest

type ModelSelectionRequest struct {
	ProviderUUID string `json:"provider_uuid,omitempty"` // Filter by provider
	ModelID      string `json:"model_id,omitempty"`      // Explicit model selection
}

ModelSelectionRequest for selecting model for @tb

type ProviderInfo

type ProviderInfo struct {
	UUID     string   `json:"uuid"`
	Name     string   `json:"name"`
	APIBase  string   `json:"api_base"`
	APIStyle string   `json:"api_style"` // "openai" or "anthropic"
	Enabled  bool     `json:"enabled"`
	Models   []string `json:"models,omitempty"` // Optional: available models
}

ProviderInfo represents a configured provider (simplified view)

type TBClient

type TBClient interface {

	// GetProviders returns all configured providers
	GetProviders(ctx context.Context) ([]ProviderInfo, error)

	GetDefaultRule(ctx context.Context) (*typ.Rule, error)

	// GetDefaultRuleForScenario returns the default rule for a specific scenario
	GetDefaultRuleForScenario(ctx context.Context, scenario typ.RuleScenario) (*typ.Rule, error)

	// GetDefaultService returns the default service configuration
	// This reuses the ClaudeCode scenario's active service
	// Returns base URL (ClaudeCode scenario), API key, provider, and model
	GetDefaultService(ctx context.Context) (*DefaultServiceConfig, error)

	// GetConnectionConfig returns base URL and API key
	// Base URL defaults to ClaudeCode scenario URL if not configured
	GetConnectionConfig(ctx context.Context) (*ConnectionConfig, error)

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

	// EnsureSmartGuideRule ensures the _smart_guide rule exists and is configured correctly
	// Deprecated: Use EnsureSmartGuideRuleForBot for bot-specific rules
	EnsureSmartGuideRule(ctx context.Context, providerUUID, modelID string) error

	// EnsureSmartGuideRuleForBot ensures the _smart_guide rule exists for a specific bot
	// Each bot gets its own rule with UUID equal to botUUID
	EnsureSmartGuideRuleForBot(ctx context.Context, botUUID, botName, providerUUID, modelID string) error

	// DeleteSmartGuideRuleForBot removes the _smart_guide rule for a specific bot
	DeleteSmartGuideRuleForBot(ctx context.Context, botUUID string) error

	// SelectModel returns model configuration for @tb execution
	SelectModel(ctx context.Context, req ModelSelectionRequest) (*ModelConfig, error)

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

TBClient defines the interface for remote control interactions

type TBClientImpl

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

TBClientImpl implements TBClient interface

func NewTBClient

func NewTBClient(
	cfg *serverconfig.Config,
	providerDB *db.ProviderStore,
) *TBClientImpl

NewTBClient creates a new TB client instance

func (*TBClientImpl) DeleteSmartGuideRuleForBot added in v0.260507.1

func (c *TBClientImpl) DeleteSmartGuideRuleForBot(ctx context.Context, botUUID string) error

DeleteSmartGuideRuleForBot removes the _smart_guide rule for a specific bot

func (*TBClientImpl) EnsureSmartGuideRule

func (c *TBClientImpl) EnsureSmartGuideRule(ctx context.Context, providerUUID, modelID string) error

EnsureSmartGuideRule ensures the _smart_guide rule exists and is configured correctly Deprecated: Use EnsureSmartGuideRuleForBot for bot-specific rules

func (*TBClientImpl) EnsureSmartGuideRuleForBot

func (c *TBClientImpl) EnsureSmartGuideRuleForBot(ctx context.Context, botUUID, botName, providerUUID, modelID string) error

EnsureSmartGuideRuleForBot ensures the _smart_guide rule exists for a specific bot Each bot gets its own rule with UUID: _internal_smart_guide_{botUUID}

func (*TBClientImpl) GetConnectionConfig

func (c *TBClientImpl) GetConnectionConfig(ctx context.Context) (*ConnectionConfig, error)

GetConnectionConfig returns base URL and API key

func (*TBClientImpl) GetDataDir

func (c *TBClientImpl) GetDataDir() string

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

func (*TBClientImpl) GetDefaultRule

func (c *TBClientImpl) GetDefaultRule(ctx context.Context) (*typ.Rule, error)

func (*TBClientImpl) GetDefaultRuleForScenario

func (c *TBClientImpl) GetDefaultRuleForScenario(ctx context.Context, scenario typ.RuleScenario) (*typ.Rule, error)

GetDefaultRuleForScenario returns the default rule for a specific scenario

func (*TBClientImpl) GetDefaultService

func (c *TBClientImpl) GetDefaultService(ctx context.Context) (*DefaultServiceConfig, error)

GetDefaultService returns the default service configuration This reuses the ClaudeCode scenario's active service

func (*TBClientImpl) GetHTTPEndpointForScenario

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

GetHTTPEndpointForScenario returns HTTP endpoint configuration for a scenario

func (*TBClientImpl) GetProviders

func (c *TBClientImpl) GetProviders(ctx context.Context) ([]ProviderInfo, error)

GetProviders returns all configured providers

func (*TBClientImpl) GetScenarioEndpointPath

func (c *TBClientImpl) GetScenarioEndpointPath(scenario typ.RuleScenario) string

GetScenarioEndpointPath returns the endpoint path for a scenario

func (*TBClientImpl) SelectModel

func (c *TBClientImpl) SelectModel(ctx context.Context, req ModelSelectionRequest) (*ModelConfig, error)

SelectModel returns model configuration for @tb execution

Jump to

Keyboard shortcuts

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