event

package
v1.16.16 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsIndicatorActive

func IsIndicatorActive() bool

func RequestConfirm

func RequestConfirm(description string, toolsUse *data.ToolsUse)

RequestConfirm sends a ConfirmRequest to the UI and blocks until the user responds. The ToolsUse.Confirm field will be set by the subscriber before unblocking.

func RequestDiff

func RequestDiff(before, after string, contextLines int) string

RequestDiff sends a DiffRequest to the UI and returns the rendered diff string.

func SendBanner

func SendBanner(text string)

func SendStatus

func SendStatus(text string)

func StartIndicator

func StartIndicator(text string)

func StopIndicator

func StopIndicator()

Types

type AskUserRequest

type AskUserRequest struct {
	Question     string
	QuestionType string
	Options      []string
	Placeholder  string
	Response     chan AskUserResponse // UI sends response back on this channel
}

type AskUserResponse

type AskUserResponse struct {
	Answer    string   `json:"answer,omitempty"`
	Answers   []string `json:"answers,omitempty"`
	Cancelled bool     `json:"cancelled,omitempty"`
}

func RequestAskUser

func RequestAskUser(req AskUserRequest) (AskUserResponse, error)

RequestAskUser sends an AskUserRequest to the UI and returns the response.

type BannerEvent

type BannerEvent struct {
	Text string
}

type Bus

type Bus struct {
	Status    chan StatusEvent
	Banner    chan BannerEvent
	Indicator chan IndicatorEvent
	Session   chan SessionModeEvent

	Confirm chan ConfirmRequest
	AskUser chan AskUserRequest
	Diff    chan DiffRequest
	// contains filtered or unexported fields
}

func GetBus

func GetBus() *Bus

type ConfirmRequest

type ConfirmRequest struct {
	Prompt      string
	Description string
	ToolsUse    *data.ToolsUse
	Done        chan struct{} // closed when UI finishes; service blocks on this
}

type DiffRequest

type DiffRequest struct {
	Before       string
	After        string
	File1        string
	File2        string
	ContextLines int
	Response     chan string // UI sends rendered diff string back
}

type IndicatorAction

type IndicatorAction int
const (
	IndicatorStart IndicatorAction = iota
	IndicatorStop
)

type IndicatorEvent

type IndicatorEvent struct {
	Action IndicatorAction
	Text   string
	Done   chan struct{}
}

type SessionModeEvent

type SessionModeEvent struct {
	Mode int // 0=Normal, 1=Plan, 2=Yolo
}

type StatusEvent

type StatusEvent struct {
	Text string
}

type VSCodeConfirmBus added in v1.15.28

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

func GetVSCodeConfirmBus added in v1.15.28

func GetVSCodeConfirmBus() *VSCodeConfirmBus

GetVSCodeConfirmBus returns the global bus for remote confirmation overrides.

func (*VSCodeConfirmBus) Accepted added in v1.16.4

func (b *VSCodeConfirmBus) Accepted() bool

Accepted returns the remote decision, or nil if no remote event has superseded the prompt.

func (*VSCodeConfirmBus) Clear added in v1.16.4

func (b *VSCodeConfirmBus) Clear()

Clear is called by the UI when the prompt finishes normally to remove the hook.

func (*VSCodeConfirmBus) Confirm added in v1.15.28

func (b *VSCodeConfirmBus) Confirm(path string)

func (*VSCodeConfirmBus) Register added in v1.16.4

func (b *VSCodeConfirmBus) Register(cancel context.CancelFunc, path string)

Register is called by the UI just before blocking on a user prompt. If a remote event arrives, it will call check this cancel function.

func (*VSCodeConfirmBus) Reject added in v1.15.28

func (b *VSCodeConfirmBus) Reject(path string)

Jump to

Keyboard shortcuts

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