Documentation
¶
Index ¶
- Constants
- func GetConfigPath() string
- func GetWorkspaceHash(workspace string) string
- func SetTestSocketPath(path string)
- type AutoSaveConfig
- type Config
- func (c *Config) AddContextDirectory(workspace, dir string)
- func (c *Config) AddLandlockApproval(workspace, path, accessLevel string)
- func (c *Config) ApplySecretsPassword(password string) error
- func (c *Config) AuthorizeCommand(commandPrefix string)
- func (c *Config) AuthorizeDomain(domain string)
- func (c *Config) GetContextDirectories(workspace string) []string
- func (c *Config) GetLandlockApprovals(workspace string) []LandlockApproval
- func (c *Config) GetOpenTabState(workspace string) (*WorkspaceTabState, bool)
- func (c *Config) IsCommandAuthorized(commandPrefix string) bool
- func (c *Config) IsDomainAuthorized(domain string) bool
- func (c *Config) IsLandlockApproved(workspace, path string, accessLevel string) bool
- func (c *Config) RemoveContextDirectory(workspace, dir string) bool
- func (c *Config) RemoveLandlockApproval(workspace, path string) bool
- func (c *Config) Save(path string) error
- func (c *Config) SecretsPassword() string
- func (c *Config) SetOpenTabState(workspace string, tabState *WorkspaceTabState)
- func (c *Config) UpdateSecretsPassword(password string) error
- type ExaConfig
- type GooglePSEConfig
- type LandlockApproval
- type LandlockWorkspaceApprovals
- type LoopConfig
- type MCPCommandConfig
- type MCPConfig
- type MCPOpenAIConfig
- type MCPOpenAPIConfig
- type MCPServerConfig
- type PerplexityConfig
- type SandboxConfig
- type SandboxOutputCompactionConfig
- type SearchConfig
- type SecretsSettings
- type SocketConfig
- type WorkspaceTabState
Constants ¶
const DefaultSocketPath = "~/.scriptschnell.sock"
DefaultSocketPath is the default socket path
Variables ¶
This section is empty.
Functions ¶
func GetWorkspaceHash ¶
GetWorkspaceHash generates a SHA256 hash for a workspace path to use as a unique identifier.
func SetTestSocketPath ¶
func SetTestSocketPath(path string)
SetTestSocketPath sets the socket path for testing (should be called in test init)
Types ¶
type AutoSaveConfig ¶
type AutoSaveConfig struct {
Enabled bool `json:"enabled"`
SaveIntervalSeconds int `json:"save_interval_seconds"`
MaxConcurrentSaves int `json:"max_concurrent_saves"`
}
AutoSaveConfig holds configuration for automatic session saving
type Config ¶
type Config struct {
WorkingDir string `json:"working_dir"`
CacheTTL int `json:"cache_ttl_seconds"`
MaxCacheEntries int `json:"max_cache_entries"`
DefaultTimeout int `json:"default_timeout_seconds"`
TempDir string `json:"-"`
Temperature float64 `json:"temperature"`
MaxTokens int `json:"max_tokens,omitempty"` // DEPRECATED: Only used as fallback when model doesn't specify context window
ProviderConfigPath string `json:"-"`
DisableAnimations bool `json:"disable_animations"`
LogLevel string `json:"log_level"` // debug, info, warn, error, none
LogPath string `json:"-"`
LogToConsole bool `json:"log_to_console"` // Enable console logging in addition to file logging
AuthorizedDomains map[string]bool `json:"authorized_domains,omitempty"` // Permanently authorized domains for network access
AuthorizedCommands map[string]bool `json:"authorized_commands,omitempty"` // Permanently authorized command prefixes for this project
Search SearchConfig `json:"search"` // Web search provider configuration
MCP MCPConfig `json:"mcp,omitempty"` // Custom MCP server configuration
Secrets SecretsSettings `json:"secrets,omitempty"` // Encryption settings
EnablePromptCache bool `json:"enable_prompt_cache"` // Enable prompt caching for compatible providers (Anthropic, OpenAI). Disabled by default as some providers like Mistral don't support cache_control ephemeral
PromptCacheTTL string `json:"prompt_cache_ttl,omitempty"` // Cache TTL: "5m" or "1h" (default: "1h", Anthropic only)
ContextDirectories map[string][]string `json:"context_directories,omitempty"` // Workspace-specific context directories (map of workspace path -> directories)
OpenTabs map[string]*WorkspaceTabState `json:"open_tabs,omitempty"` // Workspace-specific open tabs state (map of workspace path -> tab state)
LandlockApprovals map[string]*LandlockWorkspaceApprovals `json:"landlock_approvals,omitempty"` // Workspace-specific landlock approvals (map of workspace hash -> approvals)
Sandbox SandboxConfig `json:"sandbox,omitempty"` // Sandbox configuration for shell commands
AutoSave AutoSaveConfig `json:"auto_save,omitempty"` // Session auto-save configuration
AutoResume bool `json:"auto_resume"` // Automatically resume last session on startup
SandboxOutputCompaction SandboxOutputCompactionConfig `json:"sandbox_output_compaction"` // Sandbox output compaction configuration
Socket SocketConfig `json:"socket,omitempty"` // Unix socket server configuration
Loop LoopConfig `json:"loop,omitempty"` // Loop abstraction configuration
// contains filtered or unexported fields
}
Config represents application configuration
func (*Config) AddContextDirectory ¶
AddContextDirectory adds a directory to the context directories list for a specific workspace The workspace parameter should be an absolute path to the workspace directory
func (*Config) AddLandlockApproval ¶
AddLandlockApproval adds an approved directory for a specific workspace.
func (*Config) ApplySecretsPassword ¶
ApplySecretsPassword records the active password and decrypts any encrypted fields.
func (*Config) AuthorizeCommand ¶
AuthorizeCommand adds a command prefix to the permanently authorized list
func (*Config) AuthorizeDomain ¶
AuthorizeDomain adds a domain to the permanently authorized list
func (*Config) GetContextDirectories ¶
GetContextDirectories returns a copy of the context directories list for a specific workspace The workspace parameter should be an absolute path to the workspace directory
func (*Config) GetLandlockApprovals ¶
func (c *Config) GetLandlockApprovals(workspace string) []LandlockApproval
GetLandlockApprovals returns the landlock approvals for a specific workspace.
func (*Config) GetOpenTabState ¶
func (c *Config) GetOpenTabState(workspace string) (*WorkspaceTabState, bool)
GetOpenTabState returns the tab state for a workspace in a thread-safe manner. This method acquires a read lock to ensure safe concurrent access.
func (*Config) IsCommandAuthorized ¶
IsCommandAuthorized checks if a command prefix is permanently authorized
func (*Config) IsDomainAuthorized ¶
IsDomainAuthorized checks if a domain is permanently authorized
func (*Config) IsLandlockApproved ¶
IsLandlockApproved checks if a path is approved for a specific workspace.
func (*Config) RemoveContextDirectory ¶
RemoveContextDirectory removes a directory from the context directories list for a specific workspace The workspace parameter should be an absolute path to the workspace directory
func (*Config) RemoveLandlockApproval ¶
RemoveLandlockApproval removes an approved directory for a specific workspace.
func (*Config) Save ¶
Save saves configuration to file using atomic writes, but only if something has changed. This method is thread-safe and can be called concurrently from multiple goroutines.
func (*Config) SecretsPassword ¶
SecretsPassword returns the active secrets password (empty string by default).
func (*Config) SetOpenTabState ¶
func (c *Config) SetOpenTabState(workspace string, tabState *WorkspaceTabState)
SetOpenTabState sets the tab state for a workspace in a thread-safe manner. This method acquires a write lock to ensure safe concurrent access.
func (*Config) UpdateSecretsPassword ¶
UpdateSecretsPassword switches the runtime password and updates the persisted flags.
type ExaConfig ¶
type ExaConfig struct {
APIKey string `json:"api_key"`
ExaSearchType string `json:"exa_search_type"` // "neural", "auto", "deep", or "deep-reasoning"
}
ExaConfig holds Exa AI Search API configuration
type GooglePSEConfig ¶
type GooglePSEConfig struct {
APIKey string `json:"api_key"`
CX string `json:"cx"` // Search Engine ID
}
GooglePSEConfig holds Google Programmable Search Engine configuration
type LandlockApproval ¶
type LandlockApproval struct {
Path string `json:"path"`
AccessLevel string `json:"access_level"` // "read" or "readwrite"
}
LandlockApproval represents an approved directory path for sandboxed shell execution
type LandlockWorkspaceApprovals ¶
type LandlockWorkspaceApprovals struct {
Directories []LandlockApproval `json:"directories,omitempty"`
}
LandlockWorkspaceApprovals stores landlock approvals for a specific workspace
type LoopConfig ¶
type LoopConfig struct {
Strategy string `json:"strategy"` // Loop strategy: "default", "conservative", "aggressive", "llm-judge"
MaxIterations int `json:"max_iterations"` // Maximum number of iterations (0 = use default)
MaxAutoContinueAttempts int `json:"max_auto_continue_attempts"` // Maximum auto-continue attempts (0 = use default)
EnableLoopDetection bool `json:"enable_loop_detection"` // Enable repetitive pattern detection
EnableAutoContinue bool `json:"enable_auto_continue"` // Enable automatic continuation on incomplete responses
EnableLLMAutoContinueJudge bool `json:"enable_llm_auto_continue_judge"` // Enable LLM-based auto-continue decisions
LLMAutoContinueJudgeTimeout int `json:"llm_auto_continue_judge_timeout_seconds"` // LLM judge timeout in seconds (0 = use default 15s)
LLMAutoContinueJudgeTokenLimit int `json:"llm_auto_continue_judge_token_limit"` // LLM judge token limit (0 = use default 1000)
}
LoopConfig holds configuration for the orchestrator loop abstraction
type MCPCommandConfig ¶
type MCPCommandConfig struct {
Exec []string `json:"exec"`
WorkingDir string `json:"working_dir,omitempty"`
Env map[string]string `json:"env,omitempty"`
TimeoutSeconds int `json:"timeout_seconds,omitempty"`
}
MCPCommandConfig describes a command-based MCP server
type MCPConfig ¶
type MCPConfig struct {
Servers map[string]*MCPServerConfig `json:"servers"`
}
MCPConfig stores user-defined MCP servers
type MCPOpenAIConfig ¶
type MCPOpenAIConfig struct {
Model string `json:"model"`
APIKey string `json:"api_key,omitempty"`
APIKeyEnvVar string `json:"api_key_env,omitempty"`
BaseURL string `json:"base_url,omitempty"`
SystemPrompt string `json:"system_prompt,omitempty"`
Temperature float64 `json:"temperature,omitempty"`
MaxOutput int `json:"max_output,omitempty"`
ResponseJSON bool `json:"response_json,omitempty"`
}
MCPOpenAIConfig describes an OpenAI-powered MCP server
type MCPOpenAPIConfig ¶
type MCPOpenAPIConfig struct {
SpecPath string `json:"spec_path"`
URL string `json:"url"`
DefaultHeaders map[string]string `json:"default_headers,omitempty"`
DefaultQuery map[string]string `json:"default_query,omitempty"`
AuthBearerToken string `json:"auth_bearer_token,omitempty"`
AuthBearerEnv string `json:"auth_bearer_env,omitempty"`
}
MCPOpenAPIConfig describes an OpenAPI-powered MCP server
type MCPServerConfig ¶
type MCPServerConfig struct {
Type string `json:"type"`
Description string `json:"description,omitempty"`
Command *MCPCommandConfig `json:"command,omitempty"`
OpenAPI *MCPOpenAPIConfig `json:"openapi,omitempty"`
OpenAI *MCPOpenAIConfig `json:"openai,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
Disabled bool `json:"disabled,omitempty"`
}
MCPServerConfig describes a custom MCP server
type PerplexityConfig ¶
type PerplexityConfig struct {
APIKey string `json:"api_key"`
}
PerplexityConfig holds Perplexity Search API configuration
type SandboxConfig ¶
type SandboxConfig struct {
// AdditionalReadOnlyPaths are extra directories to allow read-only access
AdditionalReadOnlyPaths []string `json:"additional_read_only_paths,omitempty"`
// AdditionalReadWritePaths are extra directories to allow full access
AdditionalReadWritePaths []string `json:"additional_read_write_paths,omitempty"`
// DisableSandbox disables landlock sandboxing entirely (not recommended)
DisableSandbox bool `json:"disable_sandbox,omitempty"`
// BestEffort enables best-effort mode for landlock restrictions.
// When true (default), landlock will apply restrictions even if some
// rules cannot be enforced (e.g., due to insufficient kernel support).
// When false, landlock will fail if it cannot fully enforce all restrictions.
BestEffort bool `json:"best_effort,omitempty"`
}
SandboxConfig holds configuration for shell command sandboxing This allows custom paths to be added to the landlock sandbox Default package manager paths are handled automatically
type SandboxOutputCompactionConfig ¶
type SandboxOutputCompactionConfig struct {
Enabled bool `json:"enabled"`
ContextWindowPercent float64 `json:"context_window_percent"` // Compaction threshold as percentage of context window (e.g., 0.1 for 10%)
ChunkSize int `json:"chunk_size"` // Size of each chunk in characters
}
SandboxOutputCompactionConfig holds configuration for sandbox output compaction
type SearchConfig ¶
type SearchConfig struct {
Provider string `json:"provider"` // "exa", "google_pse", "perplexity", or ""
Exa ExaConfig `json:"exa"`
GooglePSE GooglePSEConfig `json:"google_pse"`
Perplexity PerplexityConfig `json:"perplexity"`
}
SearchConfig holds configuration for web search providers
type SecretsSettings ¶
type SecretsSettings struct {
PasswordSet bool `json:"password_set,omitempty"`
Verifier string `json:"verifier,omitempty"`
}
SecretsSettings keeps track of password-protection state.
type SocketConfig ¶
type SocketConfig struct {
Enabled bool `json:"enabled"` // Enable/disable socket server
AutoConnect bool `json:"auto_connect"` // Auto-detect and connect to socket server in clients
Path string `json:"path"` // Socket file path (~/.scriptschnell.sock)
Permissions string `json:"permissions,omitempty"` // Octal permissions (e.g., "0600")
RequireAuth bool `json:"require_auth"` // Whether auth is required
AuthMethod string `json:"auth_method,omitempty"` // "file", "token", "challenge", "peercred"
Token string `json:"token,omitempty"` // Pre-shared token (empty string = not encrypted)
AllowedUIDs []int `json:"allowed_uids,omitempty"` // Allowed user IDs for peercred
AllowedGIDs []int `json:"allowed_gids,omitempty"` // Allowed group IDs for peercred
MaxConnections int `json:"max_connections"` // Max concurrent connections
MaxSessionsPerConn int `json:"max_sessions_per_connection"` // Max sessions per connection
ConnectionTimeoutSecs int `json:"connection_timeout_seconds"` // Idle timeout in seconds
EnableBatching bool `json:"enable_batching"` // Enable message batching
BatchSize int `json:"batch_size"` // Messages per batch
}
SocketConfig holds configuration for the Unix socket server
func (*SocketConfig) GetSocketPath ¶
func (s *SocketConfig) GetSocketPath() string
GetSocketPath returns the expanded socket path with ~ expansion
type WorkspaceTabState ¶
type WorkspaceTabState struct {
ActiveTabID int `json:"active_tab_id"` // ID of currently active tab
TabIDs []int `json:"tab_ids"` // Ordered list of tab IDs
TabNames map[int]string `json:"tab_names,omitempty"` // Tab ID -> name mapping
WorktreePaths map[int]string `json:"worktree_paths,omitempty"` // Tab ID -> worktree path
}
WorkspaceTabState tracks open tabs for a specific workspace