Documentation
¶
Index ¶
- Constants
- Variables
- func ClearLine()
- func DisplayQR(qrURL string) error
- func PrintError(message string)
- func PrintInfo(message string)
- func PrintSuccess(message string)
- func PrintWarning(message string)
- func RemotePairEnable(appManager *AppManager, botUUID string, enable bool) error
- func RemotePairRevoke(appManager *AppManager, botUUID, chatID string) error
- func RemotePairStatus(appManager *AppManager, botUUID string) error
- type APIStyle
- type AgentApplyFlagCmdKong
- type AgentCmdKong
- type AgentListFlagCmdKong
- type AgentRestoreFlagCmdKong
- type AgentShowFlagCmdKong
- type AppManager
- type BannerConfig
- type CCmdKong
- type ImportOptions
- type ImportResult
- type LaunchSource
- type LogCmdKong
- type MCPBuiltinCmdKong
- type OAuthCmdKong
- type OpenCmdKong
- type ProfileCmdKong
- type ProviderAddCmdKong
- type ProviderCmdKong
- type ProviderDeleteCmdKong
- type ProviderGetCmdKong
- type ProviderImportInfo
- type ProviderInfo
- type ProviderListCmdKong
- type ProviderOAuthConfig
- type ProviderUpdateCmdKong
- type QRDisplay
- type QuickstartCmdKong
- type QuotaCmdKong
- type RemoteAddCmdKong
- type RemoteCmdKong
- type RemoteConfigCmdKong
- type RemoteListCmdKong
- type RemotePairCmdKong
- type RemotePairDisableCmdKong
- type RemotePairEnableCmdKong
- type RemotePairRevokeCmdKong
- type RemotePairStatusCmdKong
- type RemoteStartCmdKong
- type RestartCmdKong
- type RuleAddCmdKong
- type RuleCmdKong
- type RuleDeleteCmdKong
- type RuleExportCmdKong
- type RuleImportCmdKong
- type RuleListCmdKong
- type RuleUpdateCmdKong
- type ServerManager
- func (sm *ServerManager) Cleanup()
- func (sm *ServerManager) GetGinEngine() *gin.Engine
- func (sm *ServerManager) GetTBServer() *server.Server
- func (sm *ServerManager) IsRunning() bool
- func (sm *ServerManager) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (sm *ServerManager) Setup(port int) error
- func (sm *ServerManager) Start() error
- func (sm *ServerManager) Stop() error
- type ShortcutCmdKong
- type StartCmdKong
- type StatusCmdKong
- type StopCmdKong
- type SwaggerCmdKong
- type TUICmdKong
- type TokenCmdKong
- type TokenKind
- type TokenListCmdKong
- type TokenRefreshCmdKong
- type TokenViewCmdKong
- type VersionCmdKong
Constants ¶
const StopTimeout = time.Second
Variables ¶
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 DisplayQR ¶
DisplayQR displays a QR code in the terminal It tries multiple methods and falls back to showing the URL
func RemotePairEnable ¶ added in v0.260507.1
func RemotePairEnable(appManager *AppManager, botUUID string, enable bool) error
RemotePairEnable enables or disables RequirePairing for a bot. Takes effect at next bot start.
func RemotePairRevoke ¶ added in v0.260507.1
func RemotePairRevoke(appManager *AppManager, botUUID, chatID string) error
RemotePairRevoke forgets the pairing for a specific chat. The chat will need to re-bind to issue commands.
func RemotePairStatus ¶ added in v0.260507.1
func RemotePairStatus(appManager *AppManager, botUUID string) error
RemotePairStatus shows whether RequirePairing is on and where to find the code.
Types ¶
type AgentApplyFlagCmdKong ¶ added in v0.260507.1
type AgentApplyFlagCmdKong struct {
AgentType string `kong:"arg,optional,help='Agent type (cc/claude-code, oc/opencode, codex)'"`
Provider string `kong:"flag,name='provider',help='Provider UUID (optional, uses routing rule if not specified)'"`
Model string `kong:"flag,name='model',help='Model name (optional, uses routing rule if not specified)'"`
Unified bool `kong:"flag,name='unified',default='true',help='Unified mode (claude-code only)'"`
StatusLine bool `kong:"flag,name='status-line',help='Install status line integration (claude-code only)'"`
Yes bool `kong:"flag,name='yes',short='y',help='Skip the confirmation prompt'"`
Preview bool `kong:"flag,name='preview',help='Preview without applying'"`
}
AgentApplyFlagCmdKong applies agent configuration via flags
func (*AgentApplyFlagCmdKong) Run ¶ added in v0.260507.1
func (a *AgentApplyFlagCmdKong) Run(appManager *AppManager) error
type AgentCmdKong ¶ added in v0.260507.1
type AgentCmdKong struct {
// Flag-based operations (primary interface)
List AgentListFlagCmdKong `kong:"cmd,name='list',default='1',hidden,help='List configured agents (default)'"`
Apply AgentApplyFlagCmdKong `kong:"cmd,help='Apply agent configuration'"`
Show AgentShowFlagCmdKong `kong:"cmd,help='Show agent configuration details'"`
Restore AgentRestoreFlagCmdKong `kong:"cmd,help='Restore agent configuration from backup'"`
}
AgentCmdKong is the Kong version of agent command with flag-based operations. The default behavior (no subcommand) is to list agents.
type AgentListFlagCmdKong ¶ added in v0.260507.1
type AgentListFlagCmdKong struct{}
AgentListFlagCmdKong lists configured agents (default behavior)
func (*AgentListFlagCmdKong) Run ¶ added in v0.260507.1
func (a *AgentListFlagCmdKong) Run(appManager *AppManager) error
type AgentRestoreFlagCmdKong ¶ added in v0.260507.1
type AgentRestoreFlagCmdKong struct {
AgentType string `kong:"arg,optional,help='Agent type to restore'"`
Yes bool `kong:"flag,name='yes',short='y',help='Skip the confirmation prompt'"`
}
AgentRestoreFlagCmdKong restores agent configuration from backup
func (*AgentRestoreFlagCmdKong) Run ¶ added in v0.260507.1
func (a *AgentRestoreFlagCmdKong) Run(appManager *AppManager) error
type AgentShowFlagCmdKong ¶ added in v0.260507.1
type AgentShowFlagCmdKong struct {
AgentType string `kong:"arg,optional,help='Agent type to show'"`
}
AgentShowFlagCmdKong shows agent configuration details via flags
func (*AgentShowFlagCmdKong) Run ¶ added in v0.260507.1
func (a *AgentShowFlagCmdKong) Run(appManager *AppManager) error
type AppManager ¶
type AppManager struct {
// contains filtered or unexported fields
}
AppManager is the command process host: it owns AppConfig and server lifecycle. Domain behavior belongs in internal/usecase rather than here.
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) AppConfig ¶
func (am *AppManager) AppConfig() *config.AppConfig
AppConfig returns the underlying AppConfig.
func (*AppManager) GetGlobalConfig ¶
func (am *AppManager) GetGlobalConfig() *serverconfig.Config
GetGlobalConfig returns the global configuration manager.
func (*AppManager) GetRuntimeServerPort ¶ added in v0.260716.1
func (am *AppManager) GetRuntimeServerPort() int
GetRuntimeServerPort returns the port the running server is actually listening on. The server port is intentionally not persisted in the config file, so a server started with --port would be invisible to other CLI processes; the server therefore records its port in a runtime port file next to the PID lock. When the server is running (lock held) and the port file is readable, that port wins; otherwise this falls back to the configured port.
func (*AppManager) StartServerAt ¶ added in v0.260813.1
func (am *AppManager) StartServerAt(port int) error
StartServerAt initializes and starts the in-process server used by the TUI.
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 {
Profile string `kong:"flag,name='profile',help='Claude Code profile to use (deprecated: prefer \"tingly-box profile <id>\")'"`
Port int `kong:"flag,name='port',help='Tingly-Box server port (default: detected from running server, else config or 12580)'"`
Args []string `kong:"arg,optional,passthrough='all',help='Additional arguments to pass to Claude Code (e.g., --model opus)'"`
}
CCmdKong launches Claude Code with tingly-box-specific flags. Put tingly-box flags before Claude Code args; unknown flags are passed through to Claude Code so users do not need to insert a literal '--'.
--profile duplicates `tingly-box profile <id>` (both resolve through runCC below) and is kept only for existing scripts/muscle memory; prefer `profile` for anything profile-related; see profile_command.go.
func (*CCmdKong) Run ¶ added in v0.260507.1
func (c *CCmdKong) Run(appManager *AppManager) error
type ImportOptions ¶
type ImportOptions struct {
// Quiet suppresses progress output.
Quiet bool
}
ImportOptions controls provider import behavior.
type ImportResult ¶
type ImportResult struct {
ProvidersCreated int
Providers []ProviderImportInfo
ProviderMap map[string]string
}
ImportResult contains the results of a provider import.
func ImportProviders ¶ added in v0.260813.1
func ImportProviders(cfg *serverconfig.Config, data string, format dataio.Format, opts ImportOptions) (*ImportResult, error)
ImportProviders imports provider data without requiring an AppManager.
type LaunchSource ¶ added in v0.260801.1
type LaunchSource string
LaunchSource is how the running tingly-box process was invoked (binary, npx, npm, npx-bundle, npm-bundle) — see internal/shortcut for the source constants. It comes from the global --source flag and is bound into Kong's Run() calls, so any subcommand that needs it (shortcut, start, restart) can read it directly without persisting it anywhere.
type LogCmdKong ¶ added in v0.260514.1
type LogCmdKong struct {
Once bool `kong:"flag,name='once',help='Fetch logs once and exit (default is real-time follow)'"`
Limit int `kong:"flag,name='limit',short='n',default='50',help='Number of recent log entries per fetch (max 1000)'"`
Interval time.Duration `kong:"flag,name='interval',short='i',default='2s',help='Poll interval for real-time follow mode'"`
Level string `kong:"flag,name='level',help='Filter by minimum log level (debug|info|warn|error)'"`
Host string `kong:"flag,name='host',default='localhost',help='Server host'"`
Port int `kong:"flag,name='port',short='p',help='Server port (defaults to configured port)'"`
}
LogCmdKong streams or fetches system logs from the running tingly-box server via its HTTP API (/api/v1/system/logs). Default mode is real-time follow.
func (*LogCmdKong) Run ¶ added in v0.260514.1
func (l *LogCmdKong) Run(appManager *AppManager) error
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, source LaunchSource) error
type ProfileCmdKong ¶ added in v0.260611.1
type ProfileCmdKong struct {
List bool `kong:"flag,name='list',help='List all profiles (non-interactive)'"`
Show bool `kong:"flag,name='show',help='Show profile details instead of launching'"`
Port int `` /* 127-byte string literal not displayed */
ProfileID string `kong:"arg,optional,help='Profile name or ID to launch Claude Code with'"`
Args []string `kong:"arg,optional,passthrough='all',help='Additional arguments to pass to Claude Code (e.g., --model opus)'"`
}
ProfileCmdKong is the Kong command for managing and using Claude Code profiles. It is also reachable via the `use` alias (`tb use p1`), the shorthand for the common "launch with this profile" case.
Management mode:
tingly-box profile --list → list all profiles (non-interactive) tingly-box profile --show p1 → show profile details
Launch mode:
tingly-box profile → list profiles (interactive on TTY, select to launch) tingly-box profile p1 → launch Claude Code with profile p1 tingly-box use p1 → same as above, via the `use` alias tingly-box profile --port 12580 p1 → launch Claude Code with profile p1 on port 12580 tingly-box profile p1 --model opus → launch with profile p1, passing --model opus to Claude tingly-box profile p1 -p hi → launch with profile p1, using Claude's print mode
Put tingly-box flags before the profile name; after the profile name, flags are treated as Claude Code arguments. A literal '--' still works for compatibility.
func (*ProfileCmdKong) Run ¶ added in v0.260611.1
func (p *ProfileCmdKong) 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. All four positional args runs non-interactively; anything else is a clear error — see runAdd.
func (*ProviderAddCmdKong) Run ¶ added in v0.260507.1
func (c *ProviderAddCmdKong) Run(appManager *AppManager) error
Run is a pure CI command with no interactive fallback of any kind: all four fields are required, or it fails with a clear error naming what to pass instead — picking values interactively is `tingly-box tui` or Web UI work.
type ProviderCmdKong ¶ added in v0.260507.1
type ProviderCmdKong struct {
List ProviderListCmdKong `kong:"cmd,name='list',default='1',help='List all providers'"`
Add ProviderAddCmdKong `kong:"cmd,help='Add a new provider (CI: pass all four positional args)'"`
Get ProviderGetCmdKong `kong:"cmd,help='Get provider details by UUID'"`
Update ProviderUpdateCmdKong `kong:"cmd,help='Update one or more fields on an existing provider'"`
Delete ProviderDeleteCmdKong `kong:"cmd,help='Delete a provider (-y required)'"`
}
ProviderCmdKong is the top-level `provider` command: a pure CI surface for managing providers by UUID/flags, one operation per invocation, never interactive. Browsing and picking a provider to edit/delete is TUI/Web UI work (`tingly-box tui`) — this command family intentionally has no picker of its own to duplicate that.
type ProviderDeleteCmdKong ¶ added in v0.260507.1
type ProviderDeleteCmdKong struct {
UUID string `kong:"arg,required,help='Provider UUID'"`
Yes bool `kong:"flag,name='yes',short='y',help='Confirm deletion (required — this command never prompts)'"`
}
ProviderDeleteCmdKong deletes a provider. -y/--yes is required: this command never prompts, so the flag is the only way to confirm intent.
func (*ProviderDeleteCmdKong) Run ¶ added in v0.260507.1
func (c *ProviderDeleteCmdKong) Run(appManager *AppManager) error
type ProviderGetCmdKong ¶ added in v0.260903.1
type ProviderGetCmdKong struct {
UUID string `kong:"arg,required,help='Provider UUID'"`
}
ProviderGetCmdKong displays a provider's details by UUID. Names are not unique (UUID is the PK), so UUID is required — no picker to fall back to.
func (*ProviderGetCmdKong) Run ¶ added in v0.260903.1
func (c *ProviderGetCmdKong) Run(appManager *AppManager) error
type ProviderImportInfo ¶ added in v0.260414.2000
ProviderImportInfo describes one imported provider.
type ProviderInfo ¶
ProviderInfo holds information about an OAuth provider
type ProviderListCmdKong ¶ added in v0.260507.1
type ProviderListCmdKong struct{}
ProviderListCmdKong lists all providers.
func (*ProviderListCmdKong) Run ¶ added in v0.260507.1
func (c *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 {
UUID string `kong:"arg,required,help='Provider UUID'"`
Name string `kong:"flag,name='name',help='New name'"`
BaseURL string `kong:"flag,name='base-url',help='New API base URL'"`
Token string `kong:"flag,name='token',help='New API token'"`
APIStyle string `kong:"flag,name='api-style',help='New API style: openai or anthropic'"`
ProxyURL string `kong:"flag,name='proxy-url',help='New proxy URL'"`
}
ProviderUpdateCmdKong updates one or more fields on an existing provider. Only fields whose flag was actually passed change; the rest are left as-is (fetched from the current record first). At least one field flag is required — otherwise there is nothing to do.
func (*ProviderUpdateCmdKong) Run ¶ added in v0.260507.1
func (c *ProviderUpdateCmdKong) Run(appManager *AppManager) error
type QuickstartCmdKong ¶ added in v0.260507.1
type QuickstartCmdKong struct{}
QuickstartCmdKong is a hidden alias kept for backward compatibility with scripts and muscle memory; it goes straight to the guided wizard rather than the mode menu.
func (*QuickstartCmdKong) Run ¶ added in v0.260604.1
func (q *QuickstartCmdKong) Run(appManager *AppManager) error
type QuotaCmdKong ¶ added in v0.260507.1
type QuotaCmdKong struct {
NoRefresh bool `kong:"flag,name='no-refresh',help='Skip refresh and show cached data only'"`
AllProviders bool `kong:"flag,name='all',short='a',help='Show all providers instead of interactive mode'"`
Provider string `kong:"arg,optional,help='Provider name or UUID (interactive mode if omitted)'"`
}
QuotaCmdKong is the streamlined quota command. Default behavior: interactive mode to select provider.
func (*QuotaCmdKong) Run ¶ added in v0.260625.1
func (q *QuotaCmdKong) 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.
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
// Kept as a hidden no-op: `restart` no longer asks for confirmation (the
// verb itself is the intent), but the npx entrypoint, the Docker pm2
// wrapper and user scripts still pass -y.
Yes bool `kong:"flag,name='yes',short='y',hidden"`
}
RestartCmdKong is the Kong version of restart command
func (*RestartCmdKong) Run ¶ added in v0.260507.1
func (r *RestartCmdKong) Run(appManager *AppManager, source LaunchSource) error
type RuleAddCmdKong ¶ added in v0.260903.1
type RuleAddCmdKong struct {
Scenario string `kong:"flag,name='scenario',help='Rule scenario (e.g. openai, anthropic, claude_code)'"`
RequestModel string `kong:"flag,name='request-model',help='Request model (e.g. gpt-4o, tingly/cc)'"`
Provider string `kong:"flag,name='provider',help='Provider UUID or name'"`
Model string `kong:"flag,name='model',help='Model name on the provider'"`
}
RuleAddCmdKong adds a rule. All four flags are required — there is no partial or interactive form; use `tingly-box tui` for interactive setup.
func (*RuleAddCmdKong) Run ¶ added in v0.260903.1
func (c *RuleAddCmdKong) Run(appManager *AppManager) error
type RuleCmdKong ¶ added in v0.260903.1
type RuleCmdKong struct {
List RuleListCmdKong `kong:"cmd,name='list',default='1',help='List all rules'"`
Add RuleAddCmdKong `kong:"cmd,help='Add a rule (all four flags required)'"`
Update RuleUpdateCmdKong `kong:"cmd,help='Update the service on an existing rule'"`
Delete RuleDeleteCmdKong `kong:"cmd,help='Delete a rule (-y required)'"`
Export RuleExportCmdKong `kong:"cmd,help='Export a rule with its providers'"`
Import RuleImportCmdKong `kong:"cmd,help='Import a rule with its providers'"`
}
RuleCmdKong is the top-level `rule` command: a pure CI surface for managing routing rules by UUID/flags, one operation per invocation, never interactive. Rule operations are deliberately simpler than provider operations: add/update only let the operator pick a single service (one provider + model); for richer multi-service rules use `rule import` or the Web UI. Browsing and picking a rule to edit/delete is TUI/Web UI work (`tingly-box tui`) — this command family intentionally has no picker of its own to duplicate that.
type RuleDeleteCmdKong ¶ added in v0.260903.1
type RuleDeleteCmdKong struct {
UUID string `kong:"arg,required,help='Rule UUID'"`
Yes bool `kong:"flag,name='yes',short='y',help='Confirm deletion (required — this command never prompts)'"`
}
RuleDeleteCmdKong deletes a rule. -y/--yes is required: this command never prompts, so the flag is the only way to confirm intent.
func (*RuleDeleteCmdKong) Run ¶ added in v0.260903.1
func (c *RuleDeleteCmdKong) Run(appManager *AppManager) error
type RuleExportCmdKong ¶ added in v0.260903.1
type RuleExportCmdKong struct {
UUID string `kong:"arg,required,help='Rule UUID'"`
Format string `kong:"flag,name='format',default='jsonl',help='Export format: jsonl or base64'"`
Output string `kong:"flag,name='output',help='Output file path (default: stdout)'"`
}
RuleExportCmdKong exports a rule (with its referenced providers). UUID is required — no picker to fall back to. Format/output stay as flags so scripts can pipe deterministically.
func (*RuleExportCmdKong) Run ¶ added in v0.260903.1
func (c *RuleExportCmdKong) Run(appManager *AppManager) error
type RuleImportCmdKong ¶ added in v0.260903.1
type RuleImportCmdKong struct {
File string `kong:"arg,optional,help='Import file path (reads from stdin if omitted)'"`
Format string `kong:"flag,name='format',default='auto',help='Import format: auto, jsonl, or base64'"`
}
RuleImportCmdKong imports a rule (with its providers) from a bundle.
func (*RuleImportCmdKong) Run ¶ added in v0.260903.1
func (c *RuleImportCmdKong) Run(appManager *AppManager) error
type RuleListCmdKong ¶ added in v0.260903.1
type RuleListCmdKong struct{}
RuleListCmdKong lists all rules.
func (*RuleListCmdKong) Run ¶ added in v0.260903.1
func (c *RuleListCmdKong) Run(appManager *AppManager) error
type RuleUpdateCmdKong ¶ added in v0.260903.1
type RuleUpdateCmdKong struct {
UUID string `kong:"arg,required,help='Rule UUID'"`
Provider string `kong:"flag,name='provider',help='New provider UUID or name'"`
Model string `kong:"flag,name='model',help='New model name on the provider'"`
}
RuleUpdateCmdKong re-picks the service (provider + model) on an existing rule. Everything else on the rule (request-model, scenario, flags, tactic) stays as-is. Both flags are required — there is no partial or interactive form.
func (*RuleUpdateCmdKong) Run ¶ added in v0.260903.1
func (c *RuleUpdateCmdKong) Run(appManager *AppManager) error
type ServerManager ¶
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)
type ShortcutCmdKong ¶ added in v0.260801.1
type ShortcutCmdKong struct {
Name string `kong:"flag,name='name',default='Tingly Box',help='Shortcut name'"`
NoDesktop bool `kong:"flag,name='no-desktop',help='Do not create a desktop shortcut'"`
NoMenu bool `kong:"flag,name='no-menu',help='Do not create a Start Menu / application menu entry'"`
}
ShortcutCmdKong creates a desktop / start-menu shortcut that launches Tingly Box (restart in daemon mode and open the web UI) with a double-click, so users don't have to remember and type the startup command — especially on Windows.
func (*ShortcutCmdKong) Run ¶ added in v0.260801.1
func (s *ShortcutCmdKong) Run(source LaunchSource) error
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',default='true',negatable,help='Run in the background (default; pass --no-daemon for foreground)'"`
LogFile string `kong:"flag,name='log-file',help='Log file path'"`
EnableShortcut bool `kong:"flag,name='shortcut',help='Also create/refresh a desktop shortcut for next time'"`
}
StartCmdKong is the Kong version of start command
func (*StartCmdKong) Run ¶ added in v0.260507.1
func (s *StartCmdKong) Run(appManager *AppManager, source LaunchSource) 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 TUICmdKong ¶ added in v0.260507.1
type TUICmdKong struct{}
TUICmdKong runs the interactive TUI. On entry users pick a mode (QuickStart, Provider, Rule, Agent) and manage that area of config freely. Backward-compatible: `tingly-box quickstart` still drops straight into the guided wizard via QuickstartCmdKong.
func (*TUICmdKong) Run ¶ added in v0.260507.1
func (t *TUICmdKong) Run(appManager *AppManager) error
type TokenCmdKong ¶ added in v0.260514.1
type TokenCmdKong struct {
List TokenListCmdKong `kong:"cmd,name='list',default='1',hidden,help='List tingly-box tokens (default)'"`
View TokenViewCmdKong `kong:"cmd,help='View a tingly-box token (auth or model)'"`
Refresh TokenRefreshCmdKong `kong:"cmd,help='Refresh (rotate) a tingly-box token (auth or model)'"`
}
TokenCmdKong manages tingly-box's own auth and model tokens. Upstream provider credentials are not handled here — those live under the `provider` and `oauth` commands.
type TokenKind ¶ added in v0.260514.1
type TokenKind string
TokenKind identifies which tingly-box token a sub-command operates on. "auth" is the UserToken (control panel + control API). "model" is the ModelToken (used by AI clients hitting the box's OpenAI/Anthropic endpoints). Both are managed independently from upstream provider creds.
type TokenListCmdKong ¶ added in v0.260514.1
type TokenListCmdKong struct{}
TokenListCmdKong prints both tokens with masked previews.
func (*TokenListCmdKong) Run ¶ added in v0.260514.1
func (t *TokenListCmdKong) Run(appManager *AppManager) error
type TokenRefreshCmdKong ¶ added in v0.260514.1
type TokenRefreshCmdKong struct {
Kind string `kong:"arg,optional,help='Which token to refresh: auth or model'"`
Reveal bool `kong:"flag,name='reveal',short='r',help='Print the full rotated token after success'"`
Yes bool `kong:"flag,name='yes',short='y',help='Skip the rotation confirmation prompt'"`
}
TokenRefreshCmdKong rotates a tingly-box token (auth or model) and persists the new value. Existing clients using the old token will need to be updated.
func (*TokenRefreshCmdKong) Run ¶ added in v0.260514.1
func (t *TokenRefreshCmdKong) Run(appManager *AppManager) error
type TokenViewCmdKong ¶ added in v0.260514.1
type TokenViewCmdKong struct {
Kind string `kong:"arg,optional,help='Which token to view: auth or model (both, if omitted)'"`
Reveal bool `kong:"flag,name='reveal',short='r',help='Print the full token instead of a masked preview'"`
}
TokenViewCmdKong shows a tingly-box token. When kind is omitted, both tokens are shown directly — viewing either is harmless, so there is nothing worth picking one over the other for.
func (*TokenViewCmdKong) Run ¶ added in v0.260514.1
func (t *TokenViewCmdKong) 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