command

package
v0.260507.0-rc1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MPL-2.0 Imports: 58 Imported by: 0

Documentation

Index

Constants

View Source
const StopTimeout = time.Second

Variables

View Source
var (
	BuildVersion   = "dev"
	BuildGitCommit = "unknown"
	BuildBuildTime = "unknown"
	BuildGoVersion = "unknown"
	BuildPlatform  = "unknown"
)

Build information set by cli/tingly-box/main_kong.go at startup.

Functions

func AgentCommand

func AgentCommand(appManager *AppManager) *cobra.Command

AgentCommand creates the agent management command

func CCCommand

func CCCommand(appManager *AppManager) *cobra.Command

CCCommand creates the `cc` subcommand that configures and launches Claude Code.

func ClearLine

func ClearLine()

ClearLine clears the current line in terminal

func DisplayQR

func DisplayQR(qrURL string) error

DisplayQR displays a QR code in the terminal It tries multiple methods and falls back to showing the URL

func DisplaySpinnerASCII

func DisplaySpinnerASCII(step int) string

DisplaySpinnerASCII returns a simple ASCII spinner

func DisplayStatus

func DisplayStatus(message string, showSpinner bool, step int)

DisplayStatus displays a status message with optional spinner

func ExportCommand

func ExportCommand(appManager *AppManager) *cobra.Command

ExportCommand represents the export rule command

func ImportCommand

func ImportCommand(appManager *AppManager) *cobra.Command

ImportCommand represents the import rule command

func MCPBuiltinCommand added in v0.260418.2200

func MCPBuiltinCommand() *cobra.Command

MCPBuiltinCommand creates the cobra command for the builtin MCP server.

func OAuthCommand

func OAuthCommand(appManager interface{}) interface{}

OAuthCommand returns the oauth command group

func OpenCommand

func OpenCommand(appManager *AppManager) *cobra.Command

OpenCommand represents the open web UI command

func PrintError

func PrintError(message string)

PrintError prints an error message

func PrintInfo

func PrintInfo(message string)

PrintInfo prints an info message

func PrintSuccess

func PrintSuccess(message string)

PrintSuccess prints a success message

func PrintWarning

func PrintWarning(message string)

PrintWarning prints a warning message

func ProviderCommand

func ProviderCommand(appManager *AppManager) *cobra.Command

ProviderCommand represents the unified provider management command It provides both interactive mode (no args) and subcommands for specific operations

func QuickstartCommand

func QuickstartCommand(appManager *AppManager) *cobra.Command

QuickstartCommand creates the quickstart subcommand for guided setup

func QuotaCommand added in v0.260402.2330

func QuotaCommand(appManager *AppManager) *cobra.Command

QuotaCommand represents the quota management command

func RemoteCoderCommand

func RemoteCoderCommand(appManager *AppManager) *cobra.Command

RemoteCoderCommand is deprecated. Use RemoteCommand instead.

func RemoteCommand

func RemoteCommand(appManager *AppManager) *cobra.Command

RemoteCommand creates the `remote` subcommand for bot management.

func RestartCommand

func RestartCommand(appManager *AppManager) *cobra.Command

RestartCommand represents the restart server command

func StartCommand

func StartCommand(appManager *AppManager) *cobra.Command

StartCommand represents the start server command

func StartCommandWithHook

func StartCommandWithHook(appManager *AppManager, hooks ...func(*ServerManager) error) *cobra.Command

StartCommandWithHook represents the start server command with setup hooks that run after the server manager is created and before the server starts.

func StatusCommand

func StatusCommand(appManager *AppManager) *cobra.Command

StatusCommand represents the status command

func StopCommand

func StopCommand(appManager *AppManager) *cobra.Command

StopCommand represents the stop server command

func SwaggerCommand added in v0.260418.2200

func SwaggerCommand(appManager *AppManager) *cobra.Command

SwaggerCommand creates the swagger command

func TokenCommand

func TokenCommand(appConfig *config.AppConfig) *cobra.Command

TokenCommand represents the generate token command

func TruncateString

func TruncateString(s string, maxWidth int) string

TruncateString truncates a string to fit within max width

Types

type APIStyle

type APIStyle = protocol.APIStyle

type AgentApplyCmdKong

type AgentApplyCmdKong struct {
	AgentType string `kong:"arg,optional,help='Agent type (claude-code, opencode, codex)'"`
	Provider  string `kong:"flag,name='provider',help='Provider UUID'"`
	Model     string `kong:"flag,name='model',help='Model name'"`
	Unified   bool   `kong:"flag,name='unified',default='true',help='Unified mode'"`
	Force     bool   `kong:"flag,name='force',help='Skip confirmation'"`
	Preview   bool   `kong:"flag,name='preview',help='Preview without applying'"`
}

AgentApplyCmdKong applies an agent configuration

func (*AgentApplyCmdKong) Run

func (a *AgentApplyCmdKong) Run(appManager *AppManager) error

type AgentCmdKong added in v0.260507.1

type AgentCmdKong struct {
	Apply AgentApplyCmdKong `kong:"cmd,help='Apply agent configuration'"`
	List  AgentListCmdKong  `kong:"cmd,help='List configured agents'"`
	Show  AgentShowCmdKong  `kong:"cmd,help='Show agent configuration details'"`
}

AgentCmdKong is the Kong version of agent command

func (*AgentCmdKong) Run

func (a *AgentCmdKong) Run(appManager *AppManager) error

type AgentListCmdKong

type AgentListCmdKong struct{}

AgentListCmdKong lists configured agents

func (*AgentListCmdKong) Run

func (a *AgentListCmdKong) Run(appManager *AppManager) error

type AgentShowCmdKong

type AgentShowCmdKong struct {
	AgentType string `kong:"arg,optional,help='Agent type to show'"`
}

AgentShowCmdKong shows agent configuration details

func (*AgentShowCmdKong) Run

func (a *AgentShowCmdKong) Run(appManager *AppManager) error

type AppManager

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

AppManager manages all application state and operations. It serves as the single source of truth for business logic that can be used by both CLI (cobra commands) and GUI (Wails services).

func CreateAppManagerForDir

func CreateAppManagerForDir(configDir string) (*AppManager, error)

CreateAppManagerForDir creates a new AppManager for the specified config directory. This is used when a command specifies a different config directory than the global one.

func NewAppManager

func NewAppManager(configDir string) (*AppManager, error)

NewAppManager creates a new AppManager with the given config directory.

func NewAppManagerWithConfig

func NewAppManagerWithConfig(appConfig *config.AppConfig) *AppManager

NewAppManagerWithConfig creates a new AppManager with an existing AppConfig.

func (*AppManager) AddProvider

func (am *AppManager) AddProvider(name, apiBase, token string, apiStyle protocol.APIStyle) error

AddProvider adds a new AI provider with the given configuration.

func (*AppManager) AddRule

func (am *AppManager) AddRule(rule typ.Rule) error

AddRule adds a new routing rule.

func (*AppManager) AppConfig

func (am *AppManager) AppConfig() *config.AppConfig

AppConfig returns the underlying AppConfig.

func (*AppManager) CollectProvidersFromRule

func (am *AppManager) CollectProvidersFromRule(rule *typ.Rule) ([]*typ.Provider, error)

CollectProvidersFromRule collects all providers referenced by the rule's services. This is a helper function for gathering providers to export with a rule.

func (*AppManager) DeleteProvider

func (am *AppManager) DeleteProvider(name string) error

DeleteProvider removes an AI provider by name.

func (*AppManager) DeleteProviderByUUID

func (am *AppManager) DeleteProviderByUUID(uuid string) error

DeleteProviderByUUID removes an AI provider by UUID.

func (*AppManager) ExportRule

func (am *AppManager) ExportRule(rule *typ.Rule, providers []*typ.Provider, format exportpkg.Format) (string, error)

ExportRule exports a rule with its providers, or providers only, in the specified format. At least one of rule or providers must be specified.

func (*AppManager) FetchAndSaveProviderModels

func (am *AppManager) FetchAndSaveProviderModels(providerUUID string) error

FetchAndSaveProviderModels fetches models from a provider and saves them.

func (*AppManager) GetGlobalConfig

func (am *AppManager) GetGlobalConfig() *serverconfig.Config

GetGlobalConfig returns the global configuration manager.

func (*AppManager) GetModelToken

func (am *AppManager) GetModelToken() string

GetModelToken returns the model API token.

func (*AppManager) GetProvider

func (am *AppManager) GetProvider(uuid string) (*typ.Provider, error)

GetProvider returns a provider by UUID, or nil if not found.

func (*AppManager) GetProviderByUUID added in v0.260402.2330

func (am *AppManager) GetProviderByUUID(uuid string) (*typ.Provider, error)

GetProviderByUUID returns a provider by UUID (implements quota.ProviderManager interface)

func (*AppManager) GetRuleByRequestModelAndScenario

func (am *AppManager) GetRuleByRequestModelAndScenario(requestModel string, scenario typ.RuleScenario) *typ.Rule

GetRuleByRequestModelAndScenario returns a rule by request model and scenario.

func (*AppManager) GetServerManager

func (am *AppManager) GetServerManager() *ServerManager

GetServerManager returns the server manager instance.

func (*AppManager) GetServerPort

func (am *AppManager) GetServerPort() int

GetServerPort returns the configured server port.

func (*AppManager) GetUserToken

func (am *AppManager) GetUserToken() string

GetUserToken returns the user authentication token.

func (*AppManager) HasModelToken

func (am *AppManager) HasModelToken() bool

HasModelToken returns true if a model token is configured.

func (*AppManager) ImportRule

func (am *AppManager) ImportRule(data string, format exportpkg.Format, opts ImportOptions) (*ImportResult, error)

ImportRule imports a rule from data in the specified format

func (*AppManager) ImportRuleFromJSONL deprecated

func (am *AppManager) ImportRuleFromJSONL(data string, opts ImportOptions) (*ImportResult, error)

ImportRuleFromJSONL imports a rule from JSONL format (either file content or stdin format). The data should be line-delimited JSON with: - Line 1: metadata (type="metadata") - Line 2: rule data (type="rule") - Subsequent lines: provider data (type="provider")

Deprecated: Use ImportRule with FormatAuto instead. This method is kept for backward compatibility.

func (*AppManager) ListProviders

func (am *AppManager) ListProviders() []*typ.Provider

ListProviders returns all configured providers.

func (*AppManager) ListRules

func (am *AppManager) ListRules() []typ.Rule

ListRules returns all configured rules.

func (*AppManager) SaveConfig

func (am *AppManager) SaveConfig() error

SaveConfig saves the current configuration to disk.

func (*AppManager) SetServerPort

func (am *AppManager) SetServerPort(port int) error

SetServerPort sets the server port.

func (*AppManager) SetupServer

func (am *AppManager) SetupServer(port int, opts ...server.ServerOption) error

SetupServer initializes the server manager with the given port and options.

func (*AppManager) SetupServerWithPort

func (am *AppManager) SetupServerWithPort(port int) error

SetupServerWithPort initializes the server manager with just a port (no options). This is a convenience method for the TUI wizard.

func (*AppManager) StartServer

func (am *AppManager) StartServer() error

StartServer starts the server if it has been set up.

func (*AppManager) UpdateProviderByUUID

func (am *AppManager) UpdateProviderByUUID(uuid string, provider *typ.Provider) error

UpdateProviderByUUID updates an existing provider by UUID.

func (*AppManager) UpdateRule

func (am *AppManager) UpdateRule(uuid string, rule typ.Rule) error

UpdateRule updates an existing rule by UUID.

type BannerConfig

type BannerConfig struct {
	Port         int
	Host         string
	EnableUI     bool
	GlobalConfig *serverconfig.Config
	IsDaemon     bool
}

BannerConfig holds configuration for banner display

type CCmdKong added in v0.260507.1

type CCmdKong struct {
	Args []string `kong:"arg,optional,passthrough"`
}

CCmdKong launches Claude Code with passthrough mode Kong's passthrough mode requires at least one positional arg

func (*CCmdKong) Run added in v0.260507.1

func (c *CCmdKong) Run(appManager *AppManager) error

type ExportCmdKong

type ExportCmdKong struct {
	RequestModel string `kong:"flag,name='request-model',required,help='Request model name'"`
	Scenario     string `kong:"flag,name='scenario',required,help='Rule scenario'"`
	Format       string `kong:"flag,name='format',default='jsonl',help='Export format (jsonl, base64)'"`
	Output       string `kong:"flag,name='output',short='o',help='Output file path'"`
}

ExportCmdKong exports routing rules

func (*ExportCmdKong) Run

func (e *ExportCmdKong) Run(appManager *AppManager) error

type ImportCmdKong

type ImportCmdKong struct {
	File   string `kong:"arg,optional,help='Import file path (default: stdin)'"`
	Format string `kong:"flag,name='format',default='auto',help='Import format (auto, jsonl, base64)'"`
}

ImportCmdKong imports routing rules

func (*ImportCmdKong) Run

func (i *ImportCmdKong) Run(appManager *AppManager) error

type ImportOptions

type ImportOptions struct {
	// OnProviderConflict specifies what to do when a provider already exists.
	// "use" - use existing provider, "skip" - skip this provider, "suffix" - create with suffixed name
	OnProviderConflict string
	// OnRuleConflict specifies what to do when a rule already exists.
	// "skip" - skip import, "update" - update existing rule, "new" - create with new name
	OnRuleConflict string
	// Quiet suppresses progress output
	Quiet bool
}

ImportOptions controls how imports are handled when conflicts occur.

type ImportResult

type ImportResult struct {
	RuleCreated      bool
	RuleUpdated      bool
	ProvidersCreated int
	ProvidersUsed    int
	Providers        []ProviderImportInfo
	ProviderMap      map[string]string // old UUID -> new UUID
}

ImportResult contains the results of an import operation.

type MCPBuiltinCmdKong added in v0.260507.1

type MCPBuiltinCmdKong struct{}

MCPBuiltinCmdKong starts the builtin MCP server. Registered at the top level as "mcp-builtin" to match the legacy command path, which is consumed by internal/mcp/runtime/builtin_registry.go.

func (*MCPBuiltinCmdKong) Run added in v0.260507.1

func (m *MCPBuiltinCmdKong) Run(appManager *AppManager) error

type OAuthCmdKong added in v0.260507.1

type OAuthCmdKong struct {
	// Positional argument (optional)
	Provider string `kong:"arg,optional,help='Provider type (e.g., claude_code, qwen_code, codex)'"`

	// Flags
	Name     string `kong:"flag,name='name',short='n',help='Custom name for the provider'"`
	Port     int    `kong:"flag,name='port',short='p',help='Callback server port'"`
	ProxyURL string `kong:"flag,name='proxy',short='x',help='Proxy URL for OAuth requests'"`
}

OAuthCmdKong handles OAuth authentication

func (*OAuthCmdKong) Run added in v0.260507.1

func (o *OAuthCmdKong) Run(appManager *AppManager) error

type OpenCmdKong added in v0.260507.1

type OpenCmdKong struct {
	// Embed StartCmdKong to share server flags
	StartCmdKong
}

OpenCmdKong opens the web UI

func (*OpenCmdKong) Run added in v0.260507.1

func (o *OpenCmdKong) Run(appManager *AppManager) error

type ProviderAddCmdKong added in v0.260507.1

type ProviderAddCmdKong struct {
	Name     string `kong:"arg,optional,help='Provider name'"`
	BaseURL  string `kong:"arg,optional,help='API base URL'"`
	Token    string `kong:"arg,optional,help='API token'"`
	APIStyle string `kong:"arg,optional,help='API style (openai, anthropic)'"`
}

ProviderAddCmdKong adds a new provider

func (*ProviderAddCmdKong) Run added in v0.260507.1

func (p *ProviderAddCmdKong) Run(appManager *AppManager) error

type ProviderCmdKong added in v0.260507.1

type ProviderCmdKong struct {
	Interactive ProviderInteractiveCmdKong `kong:"cmd,name='interactive',default='1',hidden,help='Interactive provider management'"`
	Add         ProviderAddCmdKong         `kong:"cmd,help='Add a new provider'"`
	List        ProviderListCmdKong        `kong:"cmd,help='List all providers'"`
	Delete      ProviderDeleteCmdKong      `kong:"cmd,help='Delete a provider (interactive)'"`
	Update      ProviderUpdateCmdKong      `kong:"cmd,help='Update a provider (interactive)'"`
	Get         ProviderGetCmdKong         `kong:"cmd,help='Get provider details by name'"`
}

ProviderCmdKong is the Kong version of provider command. The hidden Interactive subcommand is marked default so `tingly-box provider` (no further args) drops into interactive management, matching legacy behavior.

type ProviderDeleteCmdKong added in v0.260507.1

type ProviderDeleteCmdKong struct{}

ProviderDeleteCmdKong deletes a provider in interactive mode.

func (*ProviderDeleteCmdKong) Run added in v0.260507.1

func (p *ProviderDeleteCmdKong) Run(appManager *AppManager) error

type ProviderGetCmdKong

type ProviderGetCmdKong struct {
	Name string `kong:"arg,optional,help='Provider name'"`
}

ProviderGetCmdKong displays a provider's details. Without a name it drops into interactive selection.

func (*ProviderGetCmdKong) Run

func (p *ProviderGetCmdKong) Run(appManager *AppManager) error

type ProviderImportInfo added in v0.260414.2000

type ProviderImportInfo struct {
	UUID   string
	Name   string
	Action string // "created", "used", "skipped"
}

ProviderImportInfo contains information about an imported or used provider

type ProviderInfo

type ProviderInfo struct {
	Type        string
	DisplayName string
	Description string
}

ProviderInfo holds information about an OAuth provider

type ProviderInteractiveCmdKong

type ProviderInteractiveCmdKong struct{}

ProviderInteractiveCmdKong runs the interactive provider menu.

func (*ProviderInteractiveCmdKong) Run

func (p *ProviderInteractiveCmdKong) Run(appManager *AppManager) error

type ProviderListCmdKong added in v0.260507.1

type ProviderListCmdKong struct{}

ProviderListCmdKong lists all providers

func (*ProviderListCmdKong) Run added in v0.260507.1

func (p *ProviderListCmdKong) Run(appManager *AppManager) error

type ProviderOAuthConfig

type ProviderOAuthConfig struct {
	Type          string
	DisplayName   string
	APIBase       string
	APIStyle      string
	OAuthMethod   string // "pkce" or "device_code"
	NeedsPort1455 bool
}

ProviderOAuthConfig holds OAuth configuration for a provider

type ProviderUpdateCmdKong added in v0.260507.1

type ProviderUpdateCmdKong struct{}

ProviderUpdateCmdKong updates a provider in interactive mode.

func (*ProviderUpdateCmdKong) Run added in v0.260507.1

func (p *ProviderUpdateCmdKong) Run(appManager *AppManager) error

type QRDisplay

type QRDisplay struct {
	URL       string
	ExpiresIn int // seconds
}

QRDisplay represents the QR code display

type QuickstartCmdKong added in v0.260507.1

type QuickstartCmdKong struct {
	UseTUI bool `kong:"flag,name='tui',short='t',default='true',help='Use interactive TUI mode'"`
}

QuickstartCmdKong runs the guided setup wizard

func (*QuickstartCmdKong) Run

func (q *QuickstartCmdKong) Run(appManager *AppManager) error

type QuotaCmdKong added in v0.260507.1

type QuotaCmdKong struct {
	Default QuotaDefaultCmdKong `kong:"cmd,name='default',default='1',hidden,help='List all provider quotas (default)'"`
	List    QuotaListCmdKong    `kong:"cmd,help='List all provider quotas'"`
	Get     QuotaGetCmdKong     `kong:"cmd,help='Get provider quota details'"`
	Refresh QuotaRefreshCmdKong `kong:"cmd,help='Refresh provider quota data'"`
	Summary QuotaSummaryCmdKong `kong:"cmd,help='Show quota summary'"`
}

QuotaCmdKong is the Kong version of quota command. The hidden Default subcommand is marked default so `tingly-box quota` (no further args) behaves like `quota list`, matching legacy behavior.

type QuotaDefaultCmdKong

type QuotaDefaultCmdKong struct{}

QuotaDefaultCmdKong is the no-subcommand default that runs the list view.

func (*QuotaDefaultCmdKong) Run

func (q *QuotaDefaultCmdKong) Run(appManager *AppManager) error

type QuotaGetCmdKong added in v0.260507.1

type QuotaGetCmdKong struct {
	Provider string `kong:"arg,optional,help='Provider name or UUID'"`
	Refresh  bool   `kong:"flag,name='refresh',short='r',help='Refresh before displaying'"`
}

QuotaGetCmdKong gets quota details

func (*QuotaGetCmdKong) Run added in v0.260507.1

func (q *QuotaGetCmdKong) Run(appManager *AppManager) error

type QuotaListCmdKong added in v0.260507.1

type QuotaListCmdKong struct {
	Refresh bool `kong:"flag,name='refresh',short='r',help='Refresh before listing'"`
}

QuotaListCmdKong lists quotas

func (*QuotaListCmdKong) Run added in v0.260507.1

func (q *QuotaListCmdKong) Run(appManager *AppManager) error

type QuotaRefreshCmdKong added in v0.260507.1

type QuotaRefreshCmdKong struct {
	Provider string `kong:"arg,optional,help='Provider name or UUID'"`
}

QuotaRefreshCmdKong refreshes quota data

func (*QuotaRefreshCmdKong) Run added in v0.260507.1

func (q *QuotaRefreshCmdKong) Run(appManager *AppManager) error

type QuotaSummaryCmdKong added in v0.260507.1

type QuotaSummaryCmdKong struct{}

QuotaSummaryCmdKong shows quota summary

func (*QuotaSummaryCmdKong) Run added in v0.260507.1

func (q *QuotaSummaryCmdKong) Run(appManager *AppManager) error

type RemoteAddCmdKong added in v0.260507.1

type RemoteAddCmdKong struct{}

RemoteAddCmdKong adds a new bot configuration (interactive).

func (*RemoteAddCmdKong) Run added in v0.260507.1

func (r *RemoteAddCmdKong) Run(appManager *AppManager) error

type RemoteCmdKong added in v0.260507.1

type RemoteCmdKong struct {
	Default RemoteListCmdKong   `kong:"cmd,name='default',default='1',hidden,help='List remote sessions (default)'"`
	List    RemoteListCmdKong   `kong:"cmd,help='List remote sessions'"`
	Start   RemoteStartCmdKong  `kong:"cmd,help='Start a remote session'"`
	Config  RemoteConfigCmdKong `kong:"cmd,help='Configure remote settings'"`
	Add     RemoteAddCmdKong    `kong:"cmd,help='Add a new bot configuration'"`
	Pair    RemotePairCmdKong   `kong:"cmd,help='Manage TOFU pairing for an imbot'"`
}

RemoteCmdKong manages remote control. The hidden Default subcommand is marked default so `tingly-box remote` (no further args) lists sessions, matching the legacy behavior of showing help/list.

type RemoteConfigCmdKong added in v0.260507.1

type RemoteConfigCmdKong struct {
	UUID     string `kong:"arg,optional,help='Bot UUID (interactive selection if omitted)'"`
	Show     bool   `kong:"flag,name='show',help='Show current configuration'"`
	Provider string `kong:"flag,name='provider',help='Provider UUID for smartguide'"`
	Model    string `kong:"flag,name='model',help='Model name for smartguide'"`
}

RemoteConfigCmdKong configures remote settings

func (*RemoteConfigCmdKong) Run added in v0.260507.1

func (r *RemoteConfigCmdKong) Run(appManager *AppManager) error

type RemoteListCmdKong added in v0.260507.1

type RemoteListCmdKong struct{}

RemoteListCmdKong lists remote sessions

func (*RemoteListCmdKong) Run added in v0.260507.1

func (r *RemoteListCmdKong) Run(appManager *AppManager) error

type RemotePairCmdKong added in v0.260507.1

type RemotePairCmdKong struct {
	Enable  RemotePairEnableCmdKong  `kong:"cmd,help='Turn on RequirePairing for a bot'"`
	Disable RemotePairDisableCmdKong `kong:"cmd,help='Turn off RequirePairing for a bot'"`
	Revoke  RemotePairRevokeCmdKong  `kong:"cmd,help='Forget the pairing for a specific chat'"`
	Status  RemotePairStatusCmdKong  `kong:"cmd,help='Show pairing status for a bot'"`
}

RemotePairCmdKong manages TOFU pairing for imbots

func (*RemotePairCmdKong) Run added in v0.260507.1

func (r *RemotePairCmdKong) Run(appManager *AppManager) error

type RemotePairDisableCmdKong added in v0.260507.1

type RemotePairDisableCmdKong struct {
	BotUUID string `kong:"arg,help='Bot UUID'"`
}

RemotePairDisableCmdKong turns off RequirePairing for a bot

func (*RemotePairDisableCmdKong) Run added in v0.260507.1

func (r *RemotePairDisableCmdKong) Run(appManager *AppManager) error

type RemotePairEnableCmdKong added in v0.260507.1

type RemotePairEnableCmdKong struct {
	BotUUID string `kong:"arg,help='Bot UUID'"`
}

RemotePairEnableCmdKong turns on RequirePairing for a bot

func (*RemotePairEnableCmdKong) Run added in v0.260507.1

func (r *RemotePairEnableCmdKong) Run(appManager *AppManager) error

type RemotePairRevokeCmdKong added in v0.260507.1

type RemotePairRevokeCmdKong struct {
	BotUUID string `kong:"arg,help='Bot UUID'"`
	ChatID  string `kong:"arg,help='Chat ID to unpair'"`
}

RemotePairRevokeCmdKong forgets the pairing for a specific chat

func (*RemotePairRevokeCmdKong) Run added in v0.260507.1

func (r *RemotePairRevokeCmdKong) Run(appManager *AppManager) error

type RemotePairStatusCmdKong added in v0.260507.1

type RemotePairStatusCmdKong struct {
	BotUUID string `kong:"arg,help='Bot UUID'"`
}

RemotePairStatusCmdKong shows pairing status for a bot

func (*RemotePairStatusCmdKong) Run added in v0.260507.1

func (r *RemotePairStatusCmdKong) Run(appManager *AppManager) error

type RemoteStartCmdKong added in v0.260507.1

type RemoteStartCmdKong struct {
	UUID     string `kong:"arg,optional,help='Bot UUID (interactive selection if omitted)'"`
	DataPath string `kong:"flag,name='data-path',help='Data directory for bot state'"`
	Provider string `kong:"flag,name='provider',help='Provider UUID for smartguide'"`
	Model    string `kong:"flag,name='model',help='Model name for smartguide'"`
	Force    bool   `kong:"flag,name='force',help='Skip provider validation and force start'"`
}

RemoteStartCmdKong starts a remote session

func (*RemoteStartCmdKong) Run added in v0.260507.1

func (r *RemoteStartCmdKong) Run(appManager *AppManager) error

type RestartCmdKong added in v0.260507.1

type RestartCmdKong struct {
	StartCmdKong
}

RestartCmdKong is the Kong version of restart command

func (*RestartCmdKong) Run added in v0.260507.1

func (r *RestartCmdKong) Run(appManager *AppManager) error

type ServerManager

type ServerManager struct {
	sync.Mutex
	// contains filtered or unexported fields
}

ServerManager manages the HTTP server lifecycle

func NewServerManager

func NewServerManager(appConfig *config.AppConfig, opts ...server.ServerOption) *ServerManager

NewServerManager creates a new server manager. opts are server options passed directly to the underlying server.

func (*ServerManager) Cleanup

func (sm *ServerManager) Cleanup()

func (*ServerManager) GetGinEngine

func (sm *ServerManager) GetGinEngine() *gin.Engine

func (*ServerManager) GetTBServer

func (sm *ServerManager) GetTBServer() *server.Server

GetTBServer returns the underlying TinglyBox server instance

func (*ServerManager) IsRunning

func (sm *ServerManager) IsRunning() bool

IsRunning checks if the server is currently running

func (*ServerManager) ServeHTTP

func (sm *ServerManager) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*ServerManager) Setup

func (sm *ServerManager) Setup(port int) error

Setup creates and configures the server without starting it

func (*ServerManager) Start

func (sm *ServerManager) Start() error

Start starts the server (requires Setup to be called first)

func (*ServerManager) Stop

func (sm *ServerManager) Stop() error

Stop stops the server gracefully

type StartCmdKong added in v0.260507.1

type StartCmdKong struct {
	Port                 int    `kong:"flag,name='port',short='p',help='Server port'"`
	Host                 string `kong:"flag,name='host',help='Server host'"`
	EnableUI             bool   `kong:"flag,name='ui',short='u',default='true',help='Enable web UI'"`
	EnableDebug          bool   `kong:"flag,name='debug',help='Enable debug mode'"`
	EnableOpenBrowser    bool   `kong:"flag,name='browser',default='true',help='Auto-open browser'"`
	EnableStyleTransform bool   `kong:"flag,name='adapter',default='true',help='Enable API style transform'"`
	Daemon               bool   `kong:"flag,name='daemon',help='Run as daemon'"`
	LogFile              string `kong:"flag,name='log-file',help='Log file path'"`
	PromptRestart        bool   `kong:"flag,name='prompt-restart',help='Prompt to restart if running'"`
	RecordMode           string `kong:"flag,name='record-mode',help='Record mode'"`
	RecordDir            string `kong:"flag,name='record-dir',help='Record directory'"`
	Expr                 string `kong:"flag,name='expr',help='Experimental features'"`
}

StartCmdKong is the Kong version of start command

func (*StartCmdKong) Run added in v0.260507.1

func (s *StartCmdKong) Run(appManager *AppManager) error

type StatusCmdKong added in v0.260507.1

type StatusCmdKong struct{}

StatusCmdKong is the Kong version of status command

func (*StatusCmdKong) Run added in v0.260507.1

func (s *StatusCmdKong) Run(appManager *AppManager) error

type StopCmdKong added in v0.260507.1

type StopCmdKong struct{}

StopCmdKong is the Kong version of stop command

func (*StopCmdKong) Run added in v0.260507.1

func (s *StopCmdKong) Run(appManager *AppManager) error

type SwaggerCmdKong added in v0.260507.1

type SwaggerCmdKong struct {
	Output string `kong:"flag,name='output',short='o',help='Output file path'"`
	Stdout bool   `kong:"flag,name='stdout',help='Write to stdout'"`
}

SwaggerCmdKong generates OpenAPI schema

func (*SwaggerCmdKong) Run added in v0.260507.1

func (s *SwaggerCmdKong) Run(appManager *AppManager) error

type VersionCmdKong added in v0.260507.1

type VersionCmdKong struct{}

VersionCmdKong is the Kong version of version command

func (*VersionCmdKong) Run added in v0.260507.1

func (v *VersionCmdKong) Run(appManager *AppManager) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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