slash

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 7 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

	// 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
)

Jump to

Keyboard shortcuts

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