Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultPrompt ¶
func DefaultPrompt() string
DefaultPrompt returns the default suggestion prompt template.
func LoadPrompt ¶
func LoadPrompt() string
LoadPrompt loads the prompt template from the extension's namespaced directory, creating the default if missing.
Types ¶
type Config ¶
type Config struct {
Model string `yaml:"model"`
MaxTokens int `yaml:"max_tokens"`
Timeout time.Duration `yaml:"timeout"`
Cooldown int `yaml:"cooldown"`
Enabled bool `yaml:"enabled"`
TriggerMode string `yaml:"trigger_mode"`
}
Config holds suggestion settings.
func LoadConfig ¶
func LoadConfig() Config
LoadConfig loads config from ~/.config/piglet/suggest.yaml, creating defaults if missing.
type ProjectContext ¶
type ProjectContext struct {
GitStatus string // "clean", "dirty", "no-repo"
ModifiedFiles []string
LastTool string
LastError bool
}
ProjectContext holds context about the current project state.
func GatherContext ¶
func GatherContext(cwd string, turn TurnData) ProjectContext
GatherContext collects project context from git and turn data.
type Suggester ¶
type Suggester struct {
// contains filtered or unexported fields
}
Suggester generates next-prompt suggestions based on conversation context.
func NewSuggester ¶
NewSuggester creates a new suggester with the given config.
func (*Suggester) Generate ¶
func (s *Suggester) Generate(ctx context.Context, turn TurnData, projCtx ProjectContext) (string, error)
Generate creates a suggestion based on turn data and project context.
func (*Suggester) IncrementTurn ¶
func (s *Suggester) IncrementTurn()
IncrementTurn increments the turn counter (called on each turn even if not suggesting).
func (*Suggester) ResetCooldown ¶
func (s *Suggester) ResetCooldown()
ResetCooldown resets the cooldown counter after a suggestion is made.
func (*Suggester) ShouldSuggest ¶
ShouldSuggest checks if a suggestion should be generated for this turn.
type ToolResult ¶
type ToolResult struct {
ToolName string `json:"tool_name"`
ToolCallID string `json:"tool_call_id"`
IsError bool `json:"is_error"`
Content []struct {
Type string `json:"type"`
Text string `json:"text"`
} `json:"content"`
}
ToolResult represents a tool result from the turn.
type TurnData ¶
type TurnData struct {
Assistant json.RawMessage `json:"Assistant"`
ToolResults []ToolResult `json:"ToolResults"`
}
TurnData represents the relevant data from an EventTurnEnd, parsed from JSON.