Documentation
¶
Overview ¶
Package composer implements the TUI's local editor-quality composer model.
Index ¶
- Constants
- Variables
- type Attachment
- type Candidate
- type Editor
- func (e Editor) AcceptCompletion() Editor
- func (e Editor) Attachments() []Attachment
- func (e Editor) Backspace() Editor
- func (e Editor) BeforeCursor() string
- func (e Editor) Candidates() []Candidate
- func (e Editor) CommitSubmission(submission Submission) Editor
- func (e Editor) Complete(all []Candidate, query string) Editor
- func (e Editor) Cursor() int
- func (e Editor) DisabledReason() string
- func (e Editor) History(direction int) Editor
- func (e Editor) HistoryEntries() []string
- func (e Editor) Insert(value string) Editor
- func (e Editor) Move(delta int, selectText bool) Editor
- func (e Editor) MoveCompletion(delta int) Editor
- func (e Editor) MoveLine(end, selectText bool) Editor
- func (e Editor) MoveWord(direction int, selectText bool) Editor
- func (e Editor) Paste(value string) Editor
- func (e Editor) PopStash() Editor
- func (e Editor) PrepareSubmission() (Submission, error)
- func (e Editor) Redo() Editor
- func (e Editor) RestoreLocal(history, stash []string) Editor
- func (e Editor) Running() bool
- func (e Editor) SelectAll() Editor
- func (e Editor) SelectedCandidate() (Candidate, bool)
- func (e Editor) Selection() (int, int, bool)
- func (e Editor) SetAttachments(values []Attachment) Editor
- func (e Editor) SetDisabled(disabled bool, reason string) Editor
- func (e Editor) SetRunning(running bool) Editor
- func (e Editor) SetText(value string) Editor
- func (e Editor) Stash() Editor
- func (e Editor) StashEntries() []string
- func (e Editor) Submit() (Editor, string, error)
- func (e Editor) Text() string
- func (e Editor) Undo() Editor
- type Submission
Constants ¶
const ( // MaxHistory bounds submitted local prompt history. MaxHistory = 50 // MaxStash bounds explicitly stashed drafts. MaxStash = 50 // MaxAutocompleteRows is the binding popup height. MaxAutocompleteRows = 10 )
Variables ¶
var ErrDisabled = errors.New("composer: submission disabled")
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
Attachment is a local upload reference and its optional Runtime disposition hint.
type Candidate ¶
type Candidate struct{ Kind, Value, Detail string }
Candidate is one slash-command or structured-reference completion.
type Editor ¶
type Editor struct {
// contains filtered or unexported fields
}
Editor is a value-updated, bounded composer model. It contains interaction state only and never stores Runtime conversation rows.
func (Editor) AcceptCompletion ¶
AcceptCompletion inserts the selected completion.
func (Editor) Attachments ¶
func (e Editor) Attachments() []Attachment
Attachments returns an isolated copy.
func (Editor) BeforeCursor ¶
BeforeCursor returns the draft prefix ending at the cursor.
func (Editor) Candidates ¶
Candidates returns the fixed-height autocomplete rows.
func (Editor) CommitSubmission ¶
func (e Editor) CommitSubmission(submission Submission) Editor
CommitSubmission records history and clears the exact prepared payload only after the Runtime accepted it. A changed draft is retained.
func (Editor) DisabledReason ¶
DisabledReason returns the actionable reason submission is unavailable.
func (Editor) History ¶
History moves through bounded local prompt history, parking the in-progress working draft at the bottom of the stack so paging back down returns the user to exactly what they were typing. The parked draft is captured the moment browsing begins and is discarded once a real edit mutates the content.
func (Editor) HistoryEntries ¶
HistoryEntries returns an isolated bounded history snapshot for local persistence.
func (Editor) Insert ¶
Insert inserts text at the cursor, replacing a selection. Newlines are retained.
Consecutive single-character non-whitespace insertions at the same position coalesce into one undo group, so ordinary typing does not exhaust the bounded undo budget one rune at a time.
func (Editor) MoveCompletion ¶
MoveCompletion wraps autocomplete selection.
func (Editor) PrepareSubmission ¶
func (e Editor) PrepareSubmission() (Submission, error)
PrepareSubmission validates and snapshots a turn without mutating the draft.
func (Editor) RestoreLocal ¶
RestoreLocal restores bounded interaction-only history and stash state.
func (Editor) SelectedCandidate ¶
SelectedCandidate returns the current autocomplete row.
func (Editor) SetAttachments ¶
func (e Editor) SetAttachments(values []Attachment) Editor
SetAttachments replaces local attachment lifecycle state.
func (Editor) SetDisabled ¶
SetDisabled changes explicit availability and its actionable reason.
func (Editor) SetRunning ¶
SetRunning marks whether submission creates a local follow-up.
func (Editor) StashEntries ¶
StashEntries returns an isolated bounded stash snapshot for local persistence.
type Submission ¶
type Submission struct {
Text string
Attachments []Attachment
}
Submission is an immutable snapshot of one validated draft and its uploaded artifact references. Preparing it never mutates editor state.