Documentation
¶
Overview ¶
Package ashlet defines the request/response types for ashlet IPC. Messages are JSON-encoded and sent over a Unix domain socket, one per line.
Index ¶
- func ConfigDir() string
- func ConfigPath() string
- func EmbeddingEnabled(cfg *Config) bool
- func OpenRouterTelemetryEnabled(cfg *Config) bool
- func PromptPath() string
- func ResolveEmbeddingAPIKey(cfg *Config) string
- func ResolveEmbeddingBaseURL(cfg *Config) string
- func ResolveEmbeddingModel(cfg *Config) string
- func ResolveGenerationAPIKey(cfg *Config) string
- func ResolveGenerationBaseURL(cfg *Config) string
- func ResolveGenerationModel(cfg *Config) string
- func ValidateConfig(cfg *Config) []string
- type Candidate
- type Config
- type ConfigRequest
- type ConfigResponse
- type ContextRequest
- type ContextResponse
- type EmbeddingConfig
- type Error
- type GenerationConfig
- type Request
- type Response
- type TelemetryConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigDir ¶
func ConfigDir() string
ConfigDir returns the config directory path. Resolution order: $ASHLET_CONFIG_DIR > $XDG_CONFIG_HOME/ashlet > ~/.config/ashlet
func EmbeddingEnabled ¶
EmbeddingEnabled returns true when both base_url and api_key are configured for embedding.
func OpenRouterTelemetryEnabled ¶
OpenRouterTelemetryEnabled returns whether OpenRouter attribution headers should be sent.
func ResolveEmbeddingAPIKey ¶
ResolveEmbeddingAPIKey returns the embedding API key. Priority: $ASHLET_EMBEDDING_API_KEY env > config value.
func ResolveEmbeddingBaseURL ¶
ResolveEmbeddingBaseURL returns the embedding API base URL. Priority: $ASHLET_EMBEDDING_API_BASE_URL env > config value.
func ResolveEmbeddingModel ¶
ResolveEmbeddingModel returns the embedding model name. Priority: $ASHLET_EMBEDDING_MODEL env > config value.
func ResolveGenerationAPIKey ¶
ResolveGenerationAPIKey returns the generation API key. Priority: $ASHLET_GENERATION_API_KEY env > config value.
func ResolveGenerationBaseURL ¶
ResolveGenerationBaseURL returns the generation API base URL. Priority: $ASHLET_GENERATION_API_BASE_URL env > config value.
func ResolveGenerationModel ¶
ResolveGenerationModel returns the generation model name. Priority: $ASHLET_GENERATION_MODEL env > config value.
func ValidateConfig ¶
ValidateConfig checks configuration for potential issues and returns warnings.
Types ¶
type Candidate ¶
type Candidate struct {
// Completion is the full command line suggestion.
Completion string `json:"completion"`
// CursorPos is the desired cursor position within the completion.
// nil means cursor at end of completion.
CursorPos *int `json:"cursor_pos,omitempty"`
// Confidence is the model's confidence score (0.0 to 1.0).
Confidence float64 `json:"confidence"`
}
Candidate represents a single completion suggestion with a confidence score.
type Config ¶
type Config struct {
Version int `json:"version"`
Generation GenerationConfig `json:"generation"`
Embedding EmbeddingConfig `json:"embedding"`
Telemetry TelemetryConfig `json:"telemetry"`
}
Config represents the user's ashlet configuration.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns the default configuration from the embedded default_config.json.
func LoadConfig ¶
LoadConfig loads config from disk or returns defaults if not found.
type ConfigRequest ¶
type ConfigRequest struct {
// Action is the config operation: "get", "reload", "defaults", or "default_prompt".
Action string `json:"action"`
}
ConfigRequest is sent from the shell client for configuration operations.
type ConfigResponse ¶
type ConfigResponse struct {
// Config is the current configuration (for "get", "reload", and "defaults" actions).
Config *Config `json:"config,omitempty"`
// Prompt is the default prompt template (for "default_prompt" action).
Prompt string `json:"prompt,omitempty"`
// Warnings contains configuration warnings (for "validate" action).
Warnings []string `json:"warnings,omitempty"`
// Error is set when the operation fails.
Error *Error `json:"error,omitempty"`
}
ConfigResponse is sent from the daemon in response to a ConfigRequest.
type ContextRequest ¶
type ContextRequest struct {
// Type is always "context".
Type string `json:"type"`
// Cwd is the directory to pre-cache context for.
Cwd string `json:"cwd"`
}
ContextRequest is sent from the shell client to warm the directory context cache.
type ContextResponse ¶
type ContextResponse struct {
// OK is true when the warm-up was accepted.
OK bool `json:"ok"`
// Error is set when the operation fails.
Error *Error `json:"error,omitempty"`
}
ContextResponse is sent from the daemon in response to a ContextRequest.
type EmbeddingConfig ¶
type EmbeddingConfig struct {
BaseURL string `json:"base_url"`
APIKey string `json:"api_key"`
Model string `json:"model"`
Dimensions int `json:"dimensions,omitempty"`
TTLMinutes int `json:"ttl_minutes,omitempty"`
MaxHistoryCommands int `json:"max_history_commands,omitempty"`
}
EmbeddingConfig holds settings for the embedding API.
type Error ¶
type Error struct {
// Code is a machine-readable error identifier (e.g. "not_configured", "api_error").
Code string `json:"code"`
// Message is a human-readable error description.
Message string `json:"message"`
}
Error describes a daemon-side error returned to the shell client.
type GenerationConfig ¶
type GenerationConfig struct {
BaseURL string `json:"base_url"`
APIKey string `json:"api_key"`
APIType string `json:"api_type"`
Model string `json:"model"`
MaxTokens int `json:"max_tokens,omitempty"`
Temperature float64 `json:"temperature,omitempty"`
Stop []string `json:"stop,omitempty"`
NoRawHistory *bool `json:"no_raw_history,omitempty"`
}
GenerationConfig holds settings for the generation API.
type Request ¶
type Request struct {
// RequestID is a per-session incrementing identifier assigned by the shell.
// The daemon echoes it back in the response for ordering.
RequestID int `json:"request_id"`
// Input is the current command line content.
Input string `json:"input"`
// CursorPos is the cursor position within the input.
CursorPos int `json:"cursor_pos"`
// Cwd is the current working directory of the shell.
Cwd string `json:"cwd"`
// SessionID identifies the shell session.
SessionID string `json:"session_id"`
// MaxCandidates is the maximum number of completion candidates to return.
MaxCandidates int `json:"max_candidates,omitempty"`
}
Request is sent from the shell client to the daemon.
type Response ¶
type Response struct {
// RequestID is echoed from the request for ordering on the client side.
RequestID int `json:"request_id"`
// Candidates is the list of completion suggestions, sorted by confidence descending.
Candidates []Candidate `json:"candidates"`
// Error is set when the daemon cannot fulfill the request.
Error *Error `json:"error,omitempty"`
}
Response is sent from the daemon back to the shell client.
type TelemetryConfig ¶
type TelemetryConfig struct {
OpenRouter *bool `json:"openrouter,omitempty"`
}
TelemetryConfig holds telemetry settings.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package defaults provides embedded default assets (prompt template and config).
|
Package defaults provides embedded default assets (prompt template and config). |
|
Package generate orchestrates model inference to generate shell completions.
|
Package generate orchestrates model inference to generate shell completions. |
|
Package index provides history indexing and embedding for ashlet.
|
Package index provides history indexing and embedding for ashlet. |
|
Command ashlet-repl is an interactive test REPL for ashlet completions.
|
Command ashlet-repl is an interactive test REPL for ashlet completions. |
|
Command ashletd is the ashlet daemon.
|
Command ashletd is the ashlet daemon. |

