controlplane

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 31 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommandName

func CommandName(command string) string

func CommandText added in v0.2.1

func CommandText(id CommandID) string

CommandText is the command's slash word, such as "/modules".

func CompactRequested added in v0.2.1

func CompactRequested(command string) bool

CompactRequested reports whether command compacts the context now, which may outlast a client's usual wait.

func DeniedApproval added in v0.2.0

func DeniedApproval(command string) (string, bool)

DeniedApproval returns the approval that a "/approval deny <id> [reason]" command, or the command its prompt submits, denies.

func FormatServerStatus

func FormatServerStatus(status core.ServerStatus) string

func GoalLine added in v0.2.1

func GoalLine(goal *core.SessionGoal) string

GoalLine is a goal in one short line for status displays, "" without one.

func HelpText

func HelpText() string

func RestartRequested added in v0.2.1

func RestartRequested(command string) bool

RestartRequested reports whether command is the confirmed daemon restart, which clients run themselves to show its progress and the notice after it.

func StopNotice added in v0.2.0

func StopNotice(reason agent.StopReason) string

StopNotice explains why a completed run stopped before its work was done; "" when it finished normally. Clients add how to continue.

Types

type CommandID

type CommandID string
const (
	CommandNewSession  CommandID = "new_session"
	CommandSessions    CommandID = "sessions"
	CommandSession     CommandID = "session"
	CommandProvider    CommandID = "provider"
	CommandPermissions CommandID = "permissions"
	CommandPlan        CommandID = "plan"
	CommandContext     CommandID = "context"
	CommandUsage       CommandID = "usage"
	CommandContinue    CommandID = "continue"
	CommandBudget      CommandID = "budget"
	CommandGoal        CommandID = "goal"
	CommandTodo        CommandID = "todo"
	CommandHooks       CommandID = "hooks"
	CommandMemory      CommandID = "memory"
	CommandSearch      CommandID = "search"
	CommandSkills      CommandID = "skills"
	CommandModules     CommandID = "modules"
	CommandRemind      CommandID = "remind"
	CommandTasks       CommandID = "tasks"
	CommandServer      CommandID = "server"
	CommandStatus      CommandID = "status"
	CommandRestart     CommandID = "restart"
	CommandStop        CommandID = "stop"
	CommandHelp        CommandID = "help"
	CommandApproval    CommandID = "approval"
	CommandUndo        CommandID = "undo"
	CommandRewind      CommandID = "rewind"
)

type CommandSpec

type CommandSpec struct {
	ID      CommandID
	Command string
	Aliases []string
	Title   string
	Menu    bool
	Public  bool
}

func BotCommands added in v0.2.0

func BotCommands() []CommandSpec

BotCommands are the commands a client lists by name: the menu ones, /plan and /help.

func Catalog

func Catalog() []CommandSpec

func Parse

func Parse(text string) (CommandSpec, string, bool)

type ConfirmData

type ConfirmData struct {
	Title          string
	Message        string
	ConfirmLabel   string
	CancelLabel    string
	ConfirmCommand string
	CancelCommand  string
	ConfirmDanger  bool
	CancelDanger   bool
}

type Dispatcher

type Dispatcher struct {
	// contains filtered or unexported fields
}

Dispatcher runs slash commands against the daemon for one client: its name, external key and role come with daemon. It keeps the client's open forms, so a client keeps one dispatcher while it shows its screens.

func New

func New(daemon *daemonclient.Client, workingDir string) *Dispatcher

func (*Dispatcher) Answer added in v0.2.1

func (d *Dispatcher) Answer(ctx context.Context, submit string, answer string) (Result, error)

Answer runs the command a prompt submits with answer as its value; the answer never becomes part of a command line.

func (*Dispatcher) Handle

func (d *Dispatcher) Handle(ctx context.Context, line string) (Result, error)

Handle runs a typed or picked command line.

type FormData

type FormData struct {
	Title         string
	Fields        []FormField
	SubmitLabel   string
	CancelLabel   string
	SubmitCommand string
	CancelCommand string
	Error         string
}

type FormField

type FormField struct {
	ID          string
	Label       string
	Value       string
	EditCommand string
}

type InfoData

type InfoData struct {
	Title        string
	Text         string
	Rows         []InfoRow
	CloseCommand string
}

type InfoRow

type InfoRow struct {
	Label string
	Value string
}

func FormatServerStatusRows

func FormatServerStatusRows(status core.ServerStatus) []InfoRow
type MenuState struct {
	SessionTitle   string
	ProviderID     string
	ModelID        string
	PermissionMode core.PermissionMode
	Capabilities   core.SessionCapabilities
}

type PickerBuilder

type PickerBuilder struct {
	// contains filtered or unexported fields
}

func NewPickerData

func NewPickerData(kind PickerKind, title string) *PickerBuilder

func (*PickerBuilder) Action

func (b *PickerBuilder) Action(id string, title string, info string, command string) *PickerBuilder

func (*PickerBuilder) Back

func (b *PickerBuilder) Back(command string) *PickerBuilder

func (*PickerBuilder) Build

func (b *PickerBuilder) Build() PickerData

func (*PickerBuilder) Command added in v0.2.0

func (b *PickerBuilder) Command(command string) *PickerBuilder

Command is the command that shows this picker again.

func (*PickerBuilder) Danger

func (b *PickerBuilder) Danger(id string, title string, info string, command string) *PickerBuilder

func (*PickerBuilder) Item

func (b *PickerBuilder) Item(item PickerItem) *PickerBuilder

func (*PickerBuilder) Items

func (b *PickerBuilder) Items(items ...PickerItem) *PickerBuilder

func (*PickerBuilder) Meta added in v0.1.8

func (b *PickerBuilder) Meta(meta string) *PickerBuilder

func (*PickerBuilder) Row

func (b *PickerBuilder) Row(id string, title string, info string, command string) *PickerBuilder

func (*PickerBuilder) Select added in v0.1.16

func (b *PickerBuilder) Select(closeCommand string) *PickerBuilder

Select makes the picker a choice that runs closeCommand when dismissed.

func (*PickerBuilder) Static added in v0.1.13

func (b *PickerBuilder) Static(id string, title string, info string) *PickerBuilder

type PickerData

type PickerData struct {
	Kind  PickerKind
	Title string
	Meta  string
	// Command shows the picker again (Telegram pages with it); empty when
	// the picker cannot be repeated, and then it is shown unpaged.
	Command string
	Back    string // command of a Back button; empty for none
	// Popup is a choice that closes once picked; Close runs on dismissal.
	Popup bool
	Close string
	Items []PickerItem
}

PickerData is a list screen; clients render it as they see fit (Telegram buttons, a terminal menu) from these fields alone.

type PickerItem

type PickerItem struct {
	ID       string
	Title    string
	Info     string
	Search   string
	Command  string
	Selected bool
	Focused  bool
	Disabled bool
	Role     PickerItemRole
}
func Menu(state MenuState) []PickerItem

Menu is the command menu of the terminal and of Telegram's /help: the menu commands, the session's ones first, with their current state.

func (PickerItem) NeedsSeparator

func (item PickerItem) NeedsSeparator() bool

NeedsSeparator reports whether a list draws a line above item.

type PickerItemRole

type PickerItemRole string
const (
	PickerItemRoleNormal PickerItemRole = ""
	PickerItemRoleDanger PickerItemRole = "danger"
	PickerItemRoleAction PickerItemRole = "action"
)

type PickerKind

type PickerKind string
const (
	PickerCommandMenu     PickerKind = "command_menu"
	PickerSessions        PickerKind = "sessions"
	PickerSessionRuntime  PickerKind = "session_runtime"
	PickerSessionActions  PickerKind = "session_actions"
	PickerSessionModels   PickerKind = "session_models"
	PickerProvider        PickerKind = "provider"
	PickerProviderCustom  PickerKind = "provider_custom"
	PickerProviderActions PickerKind = "provider_actions"
	PickerPermissions     PickerKind = "permissions"
	PickerContext         PickerKind = "context"
	PickerModules         PickerKind = "modules"
	PickerModule          PickerKind = "module"
	PickerExternalAgents  PickerKind = "external_agents"
	PickerExternalAgent   PickerKind = "external_agent"
	PickerStorage         PickerKind = "storage"
	PickerStorageFiles    PickerKind = "storage_files"
	PickerStorageFile     PickerKind = "storage_file"
	PickerStorageTemp     PickerKind = "storage_temp"
	PickerStorageCleanup  PickerKind = "storage_cleanup"
	PickerStorageTempFile PickerKind = "storage_temp_file"
	PickerSessionSkills   PickerKind = "session_skills"
	PickerSessionSkill    PickerKind = "session_skill"
	PickerSkills          PickerKind = "skills"
	PickerSkillsSection   PickerKind = "skills_section"
	PickerSkill           PickerKind = "skill"
	PickerMCP             PickerKind = "mcp"
	PickerMCPServer       PickerKind = "mcp_server"
	PickerTasks           PickerKind = "tasks"
	PickerTaskActions     PickerKind = "task_actions"
	PickerTaskArchive     PickerKind = "task_archive"
	PickerServer          PickerKind = "server"
	PickerCheckpoints     PickerKind = "checkpoints"
	PickerMemoryPending   PickerKind = "memory_pending"
)

type PromptData

type PromptData struct {
	Title         string
	Placeholder   string
	Value         string
	Submit        string
	CancelCommand string
	Sensitive     bool
	Multiline     bool
}

PromptData asks for one value, which the client hands to Dispatcher.Answer with Submit; Multiline asks for a text to edit rather than a line, and Sensitive for a secret the client neither shows nor keeps.

func DenyWithReasonPrompt added in v0.2.0

func DenyWithReasonPrompt(approvalID string) PromptData

DenyWithReasonPrompt asks for the reason a client sends with a denial.

type Result

type Result struct {
	Screen         Screen
	ReloadSnapshot bool
}

Result is what a command shows, one screen or none, and whether the client reloads its snapshot because the command changed session state.

func (Result) Text

func (r Result) Text() string

Text is the text of a TextData screen, "" for any other.

type Route added in v0.2.1

type Route struct {
	Verb  Verb
	Args  []string
	Value string
}

Route is a verb with its operands and value.

func DecodeRoute added in v0.2.1

func DecodeRoute(line string) (Route, bool)

DecodeRoute reads a command line: the longest verb its words name (one that takes a value when text is left over), its operands and the rest as value. It is false for text that is no command.

func (Route) Command added in v0.2.1

func (r Route) Command() CommandID

Command is the command r runs a verb of.

func (Route) Encode added in v0.2.1

func (r Route) Encode() string

Encode is r's command line; DecodeRoute reads it back.

func (Route) Is added in v0.2.1

func (r Route) Is(verb Verb) bool

Is reports whether r runs verb.

type Screen added in v0.2.1

type Screen interface {
	// contains filtered or unexported methods
}

Screen is what a client shows: TextData, PickerData, FormData, PromptData, ConfirmData or InfoData.

type TextData added in v0.2.1

type TextData struct {
	Text string
}

TextData is a plain answer.

type Verb added in v0.2.1

type Verb struct {
	// contains filtered or unexported fields
}

Verb is one route of a command: the words naming it after the command, the operands that follow them and whether free text may follow those.

Jump to

Keyboard shortcuts

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