constant

package
v0.260801.2 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Default authentication tokens
	DefaultUserToken  = "tingly-box-user-token"
	DefaultModelToken = "tingly-box-model-token"

	// Default mode name
	DefaultModeName = "tingly"
)
View Source
const (
	LogDirName = "log"

	// DefaultRequestTimeout is the default timeout for HTTP requests in seconds
	DefaultRequestTimeout = 1800
	// DefaultMaxTimeout in seconds
	DefaultMaxTimeout = 30 * 60
	// ModelFetchTimeout is the timeout for fetching models from provider API in seconds
	ModelFetchTimeout = 30

	// DefaultMaxTokens is the default max_tokens value for API requests
	DefaultMaxTokens = 8192
)
View Source
const (
	DefaultMinSpeedSamples   = 5    // Minimum samples required before making speed-based decisions
	DefaultSpeedThresholdTps = 50.0 // Minimum acceptable tokens per second
	DefaultSpeedSampleWindow = 100  // Default number of speed samples to keep
)

Token speed-based routing defaults

View Source
const (
	DefaultTTFTThresholdMs    = int64(500) // Default TTFT threshold in milliseconds
	DefaultTTFTSampleWindow   = 100        // Default number of TTFT samples to keep
	DefaultTTFTPercentile     = 0.95       // Default percentile for TTFT comparison (0.95 = p95)
	DefaultTTFTComparisonMode = "p95"      // Default comparison mode: "avg", "p50", "p95", "p99"
)

TTFT (Time To First Token) based routing defaults

View Source
const (
	DefaultMinCacheHitRate = 0.3 // Minimum acceptable cache hit rate (30%)
	DefaultMinCacheSamples = 10  // Minimum samples before using cache data
)

Cache-aware routing defaults

View Source
const (
	DefaultMaxCostTokens  = int64(50000) // Default max token cost per window
	DefaultCostWindowSize = 3600         // Default cost window in seconds (1 hour)
)

Cost-optimized routing defaults

View Source
const (
	// Authentication metadata.
	CtxKeyUserID                    = "user_id"                     // string
	CtxKeyEnterpriseUserID          = "enterprise_user_id"          // string
	CtxKeyEnterpriseDepartmentID    = "enterprise_department_id"    // string
	CtxKeyEnterpriseKeyPrefix       = "enterprise_key_prefix"       // string
	CtxKeyEnterpriseUserTier        = "enterprise_user_tier"        // string
	CtxKeyEnterpriseContextJTI      = "enterprise_context_jti"      // string
	CtxKeyEnterpriseContextVerified = "enterprise_context_verified" // bool
	CtxKeyRemoteClientID            = "client_id"                   // string
	CtxKeyRemoteClaims              = "claims"                      // *auth.Claims
	CtxKeyRequestID                 = "request_id"                  // string

	// Request tracking metadata.
	CtxKeyRule           = "tracking_rule"             // *typ.Rule
	CtxKeyProvider       = "tracking_provider"         // *typ.Provider
	CtxKeyModel          = "tracking_model"            // string (actual model used)
	CtxKeyRequestModel   = "tracking_request_model"    // string (model requested by user)
	CtxKeyScenario       = "tracking_scenario"         // string (extracted from request path)
	CtxKeyStreamed       = "tracking_streamed"         // bool
	CtxKeyStartTime      = "tracking_start_time"       // time.Time
	CtxKeyFirstTokenTime = "tracking_first_token_time" // time.Time (for TTFT calculation)
	CtxKeyCacheHit       = "tracking_cache_hit"        // bool (cache hit status)
	CtxKeySessionID      = "tracking_session_id"       // string (resolved session ID for affinity)
	CtxKeyAffinityKey    = "tracking_affinity_key"     // string (scoped affinity store key: session + matched smart partition)
	CtxKeyLBServiceID    = "tracking_lb_service_id"    // string (selected upstream, e.g. "provider-uuid:model")
	CtxKeyLBTactic       = "tracking_lb_tactic"        // string (tactic name, e.g. "random")

	// Protocol recording metadata.
	CtxKeyProtocolRecorder    = "protocol_recorder"     // *recording.ProtocolRecorder
	CtxKeyStreamEventRecorder = "stream_event_recorder" // protocol/stream.StreamEventRecorder

	// Guardrail runtime metadata.
	CtxKeyCredentialMaskState = "guardrails_credential_mask_state" // *guardrails/core.CredentialMaskState
)

Gin context key constants for per-request metadata. Defined here so that server/, routing/, middleware/, and protocol/ sub-packages can share the writer/reader contract without import cycles or duplicated string literals.

View Source
const ConfigDirName = ".tingly-box"
View Source
const DBDirName = "db"
View Source
const DBFileName = "tingly.db" // Unified SQLite database file
View Source
const ImageDirName = "image"
View Source
const MemoryDirName = "memory"
View Source
const RemoteDirName = "remote"
View Source
const TranscriptDirName = "transcripts"

Variables

This section is empty.

Functions

func GetDBDir

func GetDBDir(baseDir string) string

func GetDBFile

func GetDBFile(baseDir string) string

func GetImageDir added in v0.260531.1

func GetImageDir(baseDir string) string

GetImageDir returns the generated-image persistence directory path

func GetLogDir

func GetLogDir(baseDir string) string

GetLogDir returns the log directory path

func GetMemoryDir

func GetMemoryDir(baseDir string) string

GetMemoryDir returns the memory directory path

func GetRemoteTranscriptDir added in v0.260801.1

func GetRemoteTranscriptDir(baseDir string) string

GetRemoteTranscriptDir returns the directory holding one append-only transcript file per remote session. The session index lives in the database; the conversation text lives here, where it appends in O(1) and stays greppable. See .design/remote-storage.md.

func GetTinglyConfDir

func GetTinglyConfDir() string

GetTinglyConfDir returns the config directory path (default: ~/.tingly-box)

Types

This section is empty.

Jump to

Keyboard shortcuts

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