Documentation
¶
Index ¶
- Variables
- func RegisterReplToTimelineTransformer(bus *eventbus.Bus)
- type Bridge
- type ClearHistoryMsg
- type Config
- type EvaluationCompleteMsg
- type Evaluator
- type Event
- type EventKind
- type ExampleEvaluator
- func (e *ExampleEvaluator) Evaluate(ctx context.Context, code string) (string, error)
- func (e *ExampleEvaluator) EvaluateStream(ctx context.Context, code string, emit func(Event)) error
- func (e *ExampleEvaluator) GetFileExtension() string
- func (e *ExampleEvaluator) GetName() string
- func (e *ExampleEvaluator) GetPrompt() string
- func (e *ExampleEvaluator) SupportsMultiline() bool
- type ExternalEditorCompleteMsg
- type ExternalEditorMsg
- type History
- func (h *History) Add(input, output string, isErr bool)
- func (h *History) Clear()
- func (h *History) GetAll() []string
- func (h *History) GetEntries() []HistoryEntry
- func (h *History) IsNavigating() bool
- func (h *History) NavigateDown() string
- func (h *History) NavigateUp() string
- func (h *History) ResetNavigation()
- type HistoryEntry
- type HistoryNavigationMsg
- type Model
- type MultilineModeToggleMsg
- type QuitMsg
- type SlashCommandMsg
- type Styles
- type Theme
Constants ¶
This section is empty.
Variables ¶
var BuiltinThemes = map[string]Theme{ "default": { Name: "Default", Styles: DefaultStyles(), }, "dark": { Name: "Dark", Styles: Styles{ Title: lipgloss.NewStyle(). Bold(true). Foreground(lipgloss.Color("15")). Background(lipgloss.Color("236")). Padding(0, 1), Prompt: lipgloss.NewStyle(). Foreground(lipgloss.Color("11")). Bold(true), Result: lipgloss.NewStyle(). Foreground(lipgloss.Color("14")), Error: lipgloss.NewStyle(). Foreground(lipgloss.Color("9")). Bold(true), Info: lipgloss.NewStyle(). Foreground(lipgloss.Color("3")). Italic(true), HelpText: lipgloss.NewStyle(). Foreground(lipgloss.Color("243")). Italic(true), }, }, "light": { Name: "Light", Styles: Styles{ Title: lipgloss.NewStyle(). Bold(true). Foreground(lipgloss.Color("0")). Background(lipgloss.Color("252")). Padding(0, 1), Prompt: lipgloss.NewStyle(). Foreground(lipgloss.Color("4")). Bold(true), Result: lipgloss.NewStyle(). Foreground(lipgloss.Color("6")), Error: lipgloss.NewStyle(). Foreground(lipgloss.Color("1")). Bold(true), Info: lipgloss.NewStyle(). Foreground(lipgloss.Color("130")). Italic(true), HelpText: lipgloss.NewStyle(). Foreground(lipgloss.Color("8")). Italic(true), }, }, }
BuiltinThemes provides predefined themes
Functions ¶
func RegisterReplToTimelineTransformer ¶ added in v0.0.29
RegisterReplToTimelineTransformer subscribes to repl.events and publishes timeline lifecycle messages to ui.entities.
Types ¶
type Bridge ¶ added in v0.0.29
type Bridge struct {
// contains filtered or unexported fields
}
Bridge maps Evaluator events to timeline lifecycle messages via the Shell wrapper to ensure viewport refresh semantics are consistent.
type ClearHistoryMsg ¶
type ClearHistoryMsg struct{}
ClearHistoryMsg is sent when history should be cleared
type Config ¶
type Config struct {
Title string
Prompt string
Placeholder string
Width int
StartMultiline bool
EnableExternalEditor bool
EnableHistory bool
MaxHistorySize int
}
Config holds REPL shell configuration.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a sensible default configuration.
type EvaluationCompleteMsg ¶
EvaluationCompleteMsg is sent when evaluation is complete
type Evaluator ¶
type Evaluator interface {
EvaluateStream(ctx context.Context, code string, emit func(Event)) error
GetPrompt() string
GetName() string
SupportsMultiline() bool
GetFileExtension() string
}
Evaluator executes code and streams events. Errors should be represented as events too (e.g., stderr or result with error annotation), with the returned error used for terminal failures.
type EventKind ¶ added in v0.0.29
type EventKind string
EventKind enumerates structured output kinds for the timeline.
const ( EventInput EventKind = "repl_input" // recommended to be emitted by REPL shell EventResultMarkdown EventKind = "repl_result_markdown" // props: markdown|string in "markdown" or "text" EventStdout EventKind = "repl_stdout" // props: append|string or text EventStderr EventKind = "repl_stderr" // props: append|string or text, is_error=true EventLog EventKind = "repl_log" // props: level, message, metadata(optional), fields(optional) EventStructuredLog EventKind = "repl_structured_log" // props: level, message(optional), data|metadata|fields EventToolCalls EventKind = "repl_tool_calls" EventProgress EventKind = "repl_progress" EventPerf EventKind = "repl_perf" EventTable EventKind = "repl_table" EventDiff EventKind = "repl_diff" EventShellCmd EventKind = "repl_shell_cmd" EventInspector EventKind = "repl_inspector" )
type ExampleEvaluator ¶
type ExampleEvaluator struct {
// contains filtered or unexported fields
}
ExampleEvaluator is a simple evaluator for demonstration
func NewExampleEvaluator ¶
func NewExampleEvaluator() *ExampleEvaluator
NewExampleEvaluator creates a new example evaluator
func (*ExampleEvaluator) EvaluateStream ¶ added in v0.0.29
EvaluateStream adapts Evaluate to the streaming interface expected by the REPL timeline.
func (*ExampleEvaluator) GetFileExtension ¶
func (e *ExampleEvaluator) GetFileExtension() string
GetFileExtension returns the file extension for external editor
func (*ExampleEvaluator) GetName ¶
func (e *ExampleEvaluator) GetName() string
GetName returns the evaluator name
func (*ExampleEvaluator) GetPrompt ¶
func (e *ExampleEvaluator) GetPrompt() string
GetPrompt returns the prompt string
func (*ExampleEvaluator) SupportsMultiline ¶
func (e *ExampleEvaluator) SupportsMultiline() bool
SupportsMultiline returns true if multiline is supported
type ExternalEditorCompleteMsg ¶
ExternalEditorCompleteMsg is sent when external editor is complete
type ExternalEditorMsg ¶
type ExternalEditorMsg struct {
Content string
}
ExternalEditorMsg is sent when external editor should be opened
type History ¶
type History struct {
// contains filtered or unexported fields
}
History manages command history for the REPL
func (*History) GetEntries ¶
func (h *History) GetEntries() []HistoryEntry
GetEntries returns all history entries
func (*History) IsNavigating ¶
IsNavigating returns true if currently navigating history
func (*History) NavigateDown ¶
NavigateDown moves down in history (to newer entries)
func (*History) NavigateUp ¶
NavigateUp moves up in history (to older entries)
func (*History) ResetNavigation ¶
func (h *History) ResetNavigation()
ResetNavigation resets the navigation state
type HistoryEntry ¶
HistoryEntry represents a single entry in the REPL history
type HistoryNavigationMsg ¶
type HistoryNavigationMsg struct {
}
HistoryNavigationMsg is sent when history navigation occurs
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is a timeline-first REPL shell: timeline transcript + input line.
type MultilineModeToggleMsg ¶
type MultilineModeToggleMsg struct {
Enabled bool
}
MultilineModeToggleMsg is sent when multiline mode is toggled
type SlashCommandMsg ¶
SlashCommandMsg is sent when a slash command is executed
type Styles ¶
type Styles struct {
Title lipgloss.Style
Prompt lipgloss.Style
Result lipgloss.Style
Error lipgloss.Style
Info lipgloss.Style
HelpText lipgloss.Style
}
Styles defines the visual styling for the REPL
func DefaultStyles ¶
func DefaultStyles() Styles
DefaultStyles returns the default styling configuration