slash

package
v0.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package slash resolves a submitted TUI input line into an action: send text to the agent, eagerly load a skill, or report an error. It also expands a command's prompt template.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Expand

func Expand(c types.CommandConfig, args string) (string, error)

Expand renders a command's prompt template with the given args.

Types

type Action

type Action struct {
	Kind   Kind
	Text   string // for KindSend: the message to send
	Skill  string // for KindLoadSkill: the skill name
	Err    string // for KindError
	Model  string // for KindModelSet: the model to switch to
	YoloOn *bool  // for KindYolo: nil = toggle, non-nil = set explicitly (on/off)

	// Resume actions:
	ResumeAll bool   // KindResume: widen the picker to sessions from any cwd
	ResumeID  string // KindResume: non-empty loads this session directly, skipping the picker

	// Loop actions:
	Interval time.Duration // KindLoopStart: 0 = self-paced
	Payload  string        // KindLoopStart: the prompt/slash-command to repeat
	LoopID   string        // KindLoopStop: empty = stop all

	// Attachment actions:
	Files      []string // KindSend: resolved @path attachments
	AttachOp   AttachOp // KindAttach: which op
	AttachPath string   // KindAttach+AttachStage: file to stage
	Transcribe bool     // KindAttach+AttachStage: --transcribe/-t override
}

Action is the resolved result of a submitted input line.

func Resolve

func Resolve(input string, cmds []types.CommandConfig, skills []types.Skill, agents []types.AgentTypeConfig) Action

Resolve maps an input line to an Action. Non-slash input is sent verbatim.

type AttachOp added in v0.4.1

type AttachOp int

AttachOp enumerates the /attach sub-operations.

const (
	AttachStage AttachOp = iota // stage AttachPath (optionally Transcribe)
	AttachList                  // list staged attachments
	AttachClear                 // clear staged attachments
)

type Kind

type Kind int

Kind enumerates the resolved action types.

const (
	KindSend      Kind = iota // send Text to the agent
	KindLoadSkill             // eagerly load Skill into the session prompt
	KindError                 // report Err to the user, send nothing
	KindCompact               // compact the current conversation
	KindLoopStart             // start a recurring/self-paced loop
	KindLoopStop              // stop one loop (LoopID) or all (empty)
	KindLoopList              // list active loops
	KindGoalSet               // set/replace the session goal (Text)
	KindGoalShow              // show the current goal
	KindGoalClear             // clear the current goal
	KindAttach                // stage/list/clear file attachments
	KindModelList             // list available models
	KindModelSet              // switch the session model to Model
	KindYolo                  // toggle (or explicitly set) session-wide auto-approval
	KindResume                // resume a recorded session (ResumeID) or open the picker
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL