extensions

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package extensions provides the Go-native extension registry, API surface, and ordered event runner used by the coding agent.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRuntimeNotInitialized = errors.New("Extension runtime not initialized")
	ErrUIUnavailable         = errors.New("UI not available")
)

Functions

func BashToolCall

func BashToolCall(event ToolCallEvent) (tools.BashToolInput, bool)

BashToolCall decodes the typed input of a bash tool_call event.

func BashToolResult

func BashToolResult(event ToolResultEvent) (tools.BashToolDetails, bool)

BashToolResult extracts the typed details of a bash tool_result event.

func EditToolCall

func EditToolCall(event ToolCallEvent) (tools.EditToolInput, bool)

EditToolCall decodes the typed input of an edit tool_call event.

func EditToolResult

func EditToolResult(event ToolResultEvent) (tools.EditToolDetails, bool)

EditToolResult extracts the typed details of an edit tool_result event.

func EmitSessionShutdown

func EmitSessionShutdown(ctx context.Context, runner *Runner, event SessionShutdownEvent) bool

func FindToolCall

func FindToolCall(event ToolCallEvent) (tools.FindToolInput, bool)

FindToolCall decodes the typed input of a find tool_call event.

func FindToolResult

func FindToolResult(event ToolResultEvent) (tools.FindToolDetails, bool)

FindToolResult extracts the typed details of a find tool_result event.

func GrepToolCall

func GrepToolCall(event ToolCallEvent) (tools.GrepToolInput, bool)

GrepToolCall decodes the typed input of a grep tool_call event.

func GrepToolResult

func GrepToolResult(event ToolResultEvent) (tools.GrepToolDetails, bool)

GrepToolResult extracts the typed details of a grep tool_result event.

func LoadCompiled

func LoadCompiled(
	cwd string,
	catalog []CompiledExtension,
	overrides map[string]bool,
	disableAll bool,
) (*Registry, []CompiledLoadError)

func LsToolCall

func LsToolCall(event ToolCallEvent) (tools.LsToolInput, bool)

LsToolCall decodes the typed input of an ls tool_call event.

func LsToolResult

func LsToolResult(event ToolResultEvent) (tools.LsToolDetails, bool)

LsToolResult extracts the typed details of an ls tool_result event.

func ReadToolCall

func ReadToolCall(event ToolCallEvent) (tools.ReadToolInput, bool)

ReadToolCall decodes the typed input of a read tool_call event.

func ReadToolResult

func ReadToolResult(event ToolResultEvent) (tools.ReadToolDetails, bool)

ReadToolResult extracts the typed details of a read tool_result event.

func RegisterCustomEditorBase

func RegisterCustomEditorBase(factory EditorFactory)

func WrapRegisteredTool

func WrapRegisteredTool(tool RegisteredTool, runner *Runner) agent.AgentTool

func WrapRegisteredTools

func WrapRegisteredTools(tools []RegisteredTool, runner *Runner) []agent.AgentTool

func WriteToolCall

func WriteToolCall(event ToolCallEvent) (tools.WriteToolInput, bool)

WriteToolCall decodes the typed input of a write tool_call event.

func WriteToolResult

func WriteToolResult(event ToolResultEvent) bool

WriteToolResult reports whether the event is a write tool_result. The write tool carries no details (upstream WriteToolResultEvent.details is always undefined), so this accessor is the bare guard.

Types

type API

type API interface {
	On(EventType, Handler)
	RegisterTool(ToolDefinition)
	RegisterCommand(string, Command)
	RegisterShortcut(string, Shortcut)
	RegisterFlag(string, Flag)
	GetFlag(string) (any, bool)
	RegisterMessageRenderer(string, MessageRenderer)
	RegisterEntryRenderer(string, EntryRenderer)
	SendMessage(context.Context, CustomMessage, *SendMessageOptions) error
	SendUserMessage(context.Context, ai.UserContent, *SendUserMessageOptions) error
	AppendEntry(context.Context, string, any) error
	SetSessionName(context.Context, string) error
	GetSessionName(context.Context) (*string, error)
	SetLabel(context.Context, string, *string) error
	Exec(context.Context, string, []string, *ExecOptions) (ExecResult, error)
	GetActiveTools() ([]string, error)
	GetAllTools() ([]ToolInfo, error)
	SetActiveTools([]string) error
	GetCommands() ([]SlashCommandInfo, error)
	SetModel(context.Context, *ai.Model) (bool, error)
	GetThinkingLevel() (agent.ThinkingLevel, error)
	SetThinkingLevel(agent.ThinkingLevel) error
	RegisterProvider(Provider)
	RegisterProviderConfig(string, ProviderConfig)
	UnregisterProvider(string)
	Events() EventBus
}

type Actions

type Actions struct {
	SendMessage            func(context.Context, CustomMessage, *SendMessageOptions) error
	SendUserMessage        func(context.Context, ai.UserContent, *SendUserMessageOptions) error
	AppendEntry            func(context.Context, string, any) error
	SetSessionName         func(context.Context, string) error
	GetSessionName         func(context.Context) (*string, error)
	SetLabel               func(context.Context, string, *string) error
	GetActiveTools         func() ([]string, error)
	GetAllTools            func() ([]ToolInfo, error)
	SetActiveTools         func([]string) error
	RefreshTools           func()
	GetCommands            func() ([]SlashCommandInfo, error)
	SetModel               func(context.Context, *ai.Model) (bool, error)
	GetThinkingLevel       func() (agent.ThinkingLevel, error)
	SetThinkingLevel       func(agent.ThinkingLevel) error
	RegisterProvider       func(Provider) error
	RegisterProviderConfig func(string, ProviderConfig) error
	UnregisterProvider     func(string) error
}

type AfterProviderResponseEvent

type AfterProviderResponseEvent struct {
	Status  int
	Headers map[string]string
}

func (AfterProviderResponseEvent) Type

type AgentEndEvent

type AgentEndEvent struct{ Messages agent.AgentMessages }

func (AgentEndEvent) Type

func (AgentEndEvent) Type() EventType

type AgentSettledEvent

type AgentSettledEvent struct{}

func (AgentSettledEvent) Type

type AgentStartEvent

type AgentStartEvent struct{}

func (AgentStartEvent) Type

func (AgentStartEvent) Type() EventType

type AuthStatus

type AuthStatus struct {
	Configured bool   `json:"configured"`
	Source     string `json:"source,omitempty"`
	Label      string `json:"label,omitempty"`
}

type AutocompleteEditorComponent

type AutocompleteEditorComponent interface {
	EditorComponent
	SetAutocompleteProvider(AutocompleteProvider)
}

AutocompleteEditorComponent is the optional editor capability used when an extension replaces the active editor while autocomplete is configured.

type AutocompleteItem

type AutocompleteItem struct {
	Value       string `json:"value"`
	Label       string `json:"label"`
	Description string `json:"description,omitempty"`
}

type AutocompleteProvider

type AutocompleteProvider interface {
	TriggerCharacters() []string
	GetSuggestions(context.Context, AutocompleteRequest) (*AutocompleteResult, error)
	ApplyCompletion(AutocompleteRequest, AutocompleteItem, string) ([]string, int, int)
	ShouldTriggerFileCompletion(AutocompleteRequest) bool
}

type AutocompleteProviderFactory

type AutocompleteProviderFactory func(AutocompleteProvider) AutocompleteProvider

type AutocompleteRequest

type AutocompleteRequest struct {
	Lines      []string
	CursorLine int
	CursorCol  int
	Signal     context.Context
	Force      bool
}

type AutocompleteResult

type AutocompleteResult struct {
	Prefix string
	Items  []AutocompleteItem
}

type BashResult

type BashResult struct {
	Output     string  `json:"output"`
	ExitCode   *int    `json:"exitCode"`
	Cancelled  bool    `json:"cancelled"`
	Truncated  bool    `json:"truncated"`
	FullOutput *string `json:"fullOutputPath,omitempty"`
}

type BeforeAgentStartCombinedResult

type BeforeAgentStartCombinedResult struct {
	Messages     []CustomMessage
	SystemPrompt *string
}

type BeforeAgentStartEvent

type BeforeAgentStartEvent struct {
	Prompt              string
	Images              []*ai.ImageContent
	SystemPrompt        string
	SystemPromptOptions SystemPromptOptions
}

func (BeforeAgentStartEvent) Type

type BeforeAgentStartResult

type BeforeAgentStartResult struct {
	Message      *CustomMessage
	SystemPrompt *string
}

type BeforeProviderHeadersEvent

type BeforeProviderHeadersEvent struct{ Headers ai.ProviderHeaders }

func (BeforeProviderHeadersEvent) Type

type BeforeProviderRequestEvent

type BeforeProviderRequestEvent struct{ Payload any }

func (BeforeProviderRequestEvent) Type

type Command

type Command struct {
	Name                   string
	SourceInfo             SourceInfo
	Description            string
	GetArgumentCompletions func(context.Context, string) ([]AutocompleteItem, error)
	Handler                func(context.Context, string, CommandContext) error
}

type CompactOptions

type CompactOptions struct {
	CustomInstructions string
	OnComplete         func(session.CompactionResult)
	OnError            func(error)
}

type CompactionReason

type CompactionReason string
const (
	CompactionManual    CompactionReason = "manual"
	CompactionThreshold CompactionReason = "threshold"
	CompactionOverflow  CompactionReason = "overflow"
)

type CompiledExtension

type CompiledExtension struct {
	Name           string
	Factory        Factory
	Hidden         bool
	DefaultEnabled bool
}

type CompiledLoadError

type CompiledLoadError struct {
	Name string
	Err  error
}

func (CompiledLoadError) Error

func (loadError CompiledLoadError) Error() string

type Component

type Component interface{ Render(int) []string }

type ComponentFactory

type ComponentFactory func(UIHost, Theme) Component

type Context

type Context interface {
	UI() UI
	Mode() Mode
	HasUI() bool
	CWD() string
	SessionManager() ReadonlySessionManager
	ModelRegistry() ModelRegistry
	Model() *ai.Model
	// ThinkingLevel is the current thinking level, when provided by the
	// session runtime; empty otherwise.
	ThinkingLevel() agent.ThinkingLevel
	IsIdle() bool
	IsProjectTrusted() bool
	Signal() context.Context
	Abort()
	HasPendingMessages() bool
	Shutdown()
	GetContextUsage() *ContextUsage
	Compact(*CompactOptions)
	GetSystemPrompt() string
}

type ContextActions

type ContextActions struct {
	GetModel               func() *ai.Model
	IsIdle                 func() bool
	IsProjectTrusted       func() bool
	GetSignal              func() context.Context
	Abort                  func()
	HasPendingMessages     func() bool
	Shutdown               func()
	GetContextUsage        func() *ContextUsage
	Compact                func(*CompactOptions)
	GetSystemPrompt        func() string
	GetSystemPromptOptions func() SystemPromptOptions
}

type ContextEvent

type ContextEvent struct{ Messages agent.AgentMessages }

func (ContextEvent) Type

func (ContextEvent) Type() EventType

type ContextFile

type ContextFile struct {
	Path    string `json:"path"`
	Content string `json:"content"`
}

type ContextResult

type ContextResult struct{ Messages agent.AgentMessages }

type ContextUsage

type ContextUsage struct {
	Tokens        *int64
	ContextWindow int64
	Percent       *float64
}

type CustomDone

type CustomDone func(any)

type CustomFactory

type CustomFactory func(UIHost, Theme, Keybindings, CustomDone) (Component, error)

type CustomMessage

type CustomMessage struct {
	CustomType string `json:"customType"`
	Content    any    `json:"content"`
	Display    bool   `json:"display"`
	Details    any    `json:"details,omitempty"`
}

type CustomOptions

type CustomOptions struct {
	Overlay               bool
	StaticOverlayOptions  *OverlayOptions
	DynamicOverlayOptions func() OverlayOptions
	OnHandle              func(OverlayHandle)
}

type DeliveryMode

type DeliveryMode string
const (
	DeliverSteer    DeliveryMode = "steer"
	DeliverFollowUp DeliveryMode = "followUp"
	DeliverNextTurn DeliveryMode = "nextTurn"
)

type Diagnostic

type Diagnostic struct {
	Type    string
	Message string
	Path    string
}

type DialogOptions

type DialogOptions struct {
	Signal  context.Context
	Timeout *int64
}

type DiscoveredPath

type DiscoveredPath struct {
	Path          string `json:"path"`
	ExtensionPath string `json:"extensionPath"`
}

type DiscoveredResources

type DiscoveredResources struct {
	SkillPaths  []DiscoveredPath `json:"skillPaths"`
	PromptPaths []DiscoveredPath `json:"promptPaths"`
	ThemePaths  []DiscoveredPath `json:"themePaths"`
}

type DisposableComponent

type DisposableComponent interface {
	Component
	Dispose()
}

type EditorComponent

type EditorComponent interface {
	Component
	GetText() string
	SetText(string)
	HandleInput(string)
}

type EditorFactory

type EditorFactory func(UIHost, Theme, Keybindings) EditorComponent

func CustomEditorBase

func CustomEditorBase() EditorFactory

type EntryRenderOptions

type EntryRenderOptions struct{ Expanded bool }

type EntryRenderer

type EntryRenderer func(any, EntryRenderOptions, Theme) Component

type Event

type Event interface {
	Type() EventType
}

type EventBus

type EventBus interface {
	Emit(context.Context, string, any) []error
	On(string, EventListener) func()
	Clear()
}

func NewEventBus

func NewEventBus() EventBus

type EventListener

type EventListener func(context.Context, any) error

type EventType

type EventType string
const (
	EventProjectTrust          EventType = "project_trust"
	EventResourcesDiscover     EventType = "resources_discover"
	EventSessionStart          EventType = "session_start"
	EventSessionInfoChanged    EventType = "session_info_changed"
	EventSessionBeforeSwitch   EventType = "session_before_switch"
	EventSessionBeforeFork     EventType = "session_before_fork"
	EventSessionBeforeCompact  EventType = "session_before_compact"
	EventSessionCompact        EventType = "session_compact"
	EventSessionShutdown       EventType = "session_shutdown"
	EventSessionBeforeTree     EventType = "session_before_tree"
	EventSessionTree           EventType = "session_tree"
	EventContext               EventType = "context"
	EventBeforeProviderRequest EventType = "before_provider_request"
	EventBeforeProviderHeaders EventType = "before_provider_headers"
	EventAfterProviderResponse EventType = "after_provider_response"
	EventBeforeAgentStart      EventType = "before_agent_start"
	EventAgentStart            EventType = "agent_start"
	EventAgentEnd              EventType = "agent_end"
	EventAgentSettled          EventType = "agent_settled"
	EventTurnStart             EventType = "turn_start"
	EventTurnEnd               EventType = "turn_end"
	EventMessageStart          EventType = "message_start"
	EventMessageUpdate         EventType = "message_update"
	EventMessageEnd            EventType = "message_end"
	EventToolExecutionStart    EventType = "tool_execution_start"
	EventToolExecutionUpdate   EventType = "tool_execution_update"
	EventToolExecutionEnd      EventType = "tool_execution_end"
	EventModelSelect           EventType = "model_select"
	EventThinkingLevelSelect   EventType = "thinking_level_select"
	EventToolCall              EventType = "tool_call"
	EventToolResult            EventType = "tool_result"
	EventUserBash              EventType = "user_bash"
	EventInput                 EventType = "input"
)

type ExecOptions

type ExecOptions struct {
	Context context.Context
	Timeout int64
	CWD     string
	Env     []string
}

type ExecResult

type ExecResult struct {
	Stdout string `json:"stdout"`
	Stderr string `json:"stderr"`
	Code   int    `json:"code"`
	Killed bool   `json:"killed"`
}

func Exec

func Exec(ctx context.Context, command string, args []string, options *ExecOptions) (ExecResult, error)

type Extension

type Extension struct {
	Path         string
	ResolvedPath string
	Hidden       bool
	SourceInfo   SourceInfo
	// contains filtered or unexported fields
}

type ExtensionError

type ExtensionError struct {
	ExtensionPath string `json:"extensionPath"`
	Event         string `json:"event"`
	Error         string `json:"error"`
	Stack         string `json:"stack,omitempty"`
}

type Factory

type Factory func(API) error

type Flag

type Flag struct {
	Name          string
	Description   string
	Type          FlagType
	Default       any
	ExtensionPath string
}

type FlagType

type FlagType string
const (
	FlagBoolean FlagType = "boolean"
	FlagString  FlagType = "string"
)

type FooterDataProvider

type FooterDataProvider interface {
	GitBranch() string
	Statuses() map[string]string
}

type FooterFactory

type FooterFactory func(UIHost, Theme, FooterDataProvider) Component

type ForkOptions

type ForkOptions struct {
	Position    ForkPosition
	WithSession func(context.Context, ReplacedSessionContext) error
}

type ForkPosition

type ForkPosition string
const (
	ForkBefore ForkPosition = "before"
	ForkAt     ForkPosition = "at"
)

type Handler

type Handler func(context.Context, Event, Context) (any, error)

type HeaderFactory

type HeaderFactory func(UIHost, Theme) Component

type InputAction

type InputAction string
const (
	InputContinue  InputAction = "continue"
	InputTransform InputAction = "transform"
	InputHandled   InputAction = "handled"
)

type InputEvent

type InputEvent struct {
	Text              string
	Images            []*ai.ImageContent
	Source            InputSource
	StreamingBehavior *DeliveryMode
}

func (InputEvent) Type

func (InputEvent) Type() EventType

type InputResult

type InputResult struct {
	Action InputAction        `json:"action"`
	Text   string             `json:"text,omitempty"`
	Images []*ai.ImageContent `json:"images,omitempty"`
}

type InputSource

type InputSource string
const (
	InputInteractive InputSource = "interactive"
	InputRPC         InputSource = "rpc"
	InputExtension   InputSource = "extension"
)

type KeybindingConflict

type KeybindingConflict struct {
	Key      string
	Bindings []string
}

type KeybindingDefinition

type KeybindingDefinition struct {
	DefaultKeys []string
	Description string
}

type Keybindings

type Keybindings interface {
	Matches(input, binding string) bool
	Keys(binding string) []string
	Definition(binding string) KeybindingDefinition
	Conflicts() []KeybindingConflict
	UserBindings() map[string][]string
	ResolvedBindings() map[string][]string
}

type MessageEndEvent

type MessageEndEvent struct{ Message agent.AgentMessage }

func (MessageEndEvent) Type

func (MessageEndEvent) Type() EventType

type MessageEndResult

type MessageEndResult struct{ Message agent.AgentMessage }

type MessageRenderOptions

type MessageRenderOptions struct {
	Expanded  bool
	OutputPad int
}

MessageRenderOptions mirrors upstream MessageRenderOptions (types.ts): OutputPad is the horizontal padding configured by the outputPad setting.

type MessageStartEvent

type MessageStartEvent struct{ Message agent.AgentMessage }

func (MessageStartEvent) Type

type MessageUpdateEvent

type MessageUpdateEvent struct {
	Message               agent.AgentMessage
	AssistantMessageEvent ai.AssistantMessageEvent
}

func (MessageUpdateEvent) Type

type Mode

type Mode string
const (
	ModeTUI   Mode = "tui"
	ModeRPC   Mode = "rpc"
	ModeJSON  Mode = "json"
	ModePrint Mode = "print"
)

type ModelRegistry

type ModelRegistry interface {
	Reload() error
	Error() string
	Models() []ai.Model
	Find(provider, id string) (ai.Model, bool)
	HasConfiguredAuth(provider string, env map[string]string) bool
	GetProviderAuthStatus(provider string, env map[string]string) AuthStatus
	IsUsingOAuth(provider string) bool
	Available(env map[string]string) []ai.Model
	AvailableWithError(env map[string]string) ([]ai.Model, error)
	ResolveAPIKey(context.Context, string, map[string]string) (*string, error)
	ResolveProviderAuth(context.Context, string, map[string]string) (*aiauth.AuthResult, error)
	ResolveModelHeaders(context.Context, ai.Model, map[string]string, ...*string) (*map[string]string, error)
	StreamSimple(context.Context, *ai.Model, ai.Context, *ai.SimpleStreamOptions) (ai.AssistantMessageEventStream, error)
	Provider(string) (Provider, bool)
	ProviderDisplayName(string) string
	ProviderAuth(string) aiauth.ProviderAuth
	RegisteredProviderConfig(string) (ProviderConfig, bool)
	RegisteredNativeProvider(string) (Provider, bool)
	RegisteredProviderIDs() []string
	RegisterProvider(Provider) error
	RegisterProviderConfig(string, ProviderConfig) error
	UnregisterProvider(string) error
}

type ModelSelectEvent

type ModelSelectEvent struct {
	Model         *ai.Model
	PreviousModel *ai.Model
	Source        ModelSelectSource
}

func (ModelSelectEvent) Type

func (ModelSelectEvent) Type() EventType

type ModelSelectSource

type ModelSelectSource string
const (
	ModelSelectSet     ModelSelectSource = "set"
	ModelSelectCycle   ModelSelectSource = "cycle"
	ModelSelectRestore ModelSelectSource = "restore"
)
type NavigateTreeOptions struct {
	Summarize           bool
	CustomInstructions  string
	ReplaceInstructions bool
	Label               string
}

type NewSessionOptions

type NewSessionOptions struct {
	ParentSession string
	Setup         func(*session.SessionManager) error
	WithSession   func(context.Context, ReplacedSessionContext) error
}

type NoopUI

type NoopUI struct{}

func (NoopUI) AddAutocompleteProvider

func (NoopUI) AddAutocompleteProvider(AutocompleteProviderFactory)

func (NoopUI) Confirm

func (NoopUI) Custom

func (NoopUI) Editor

func (NoopUI) GetAllThemes

func (NoopUI) GetAllThemes() []ThemeInfo

func (NoopUI) GetEditorComponent

func (NoopUI) GetEditorComponent() EditorFactory

func (NoopUI) GetEditorText

func (NoopUI) GetEditorText() string

func (NoopUI) GetTheme

func (NoopUI) GetTheme(string) Theme

func (NoopUI) GetToolsExpanded

func (NoopUI) GetToolsExpanded() bool

func (NoopUI) Input

func (NoopUI) Notify

func (NoopUI) Notify(string, NotificationType)

func (NoopUI) OnTerminalInput

func (NoopUI) OnTerminalInput(TerminalInputHandler) func()

func (NoopUI) PasteToEditor

func (NoopUI) PasteToEditor(string)

func (NoopUI) Select

func (NoopUI) SetEditorComponent

func (NoopUI) SetEditorComponent(EditorFactory)

func (NoopUI) SetEditorText

func (NoopUI) SetEditorText(string)

func (NoopUI) SetFooter

func (NoopUI) SetFooter(FooterFactory)

func (NoopUI) SetHeader

func (NoopUI) SetHeader(HeaderFactory)

func (NoopUI) SetHiddenThinkingLabel

func (NoopUI) SetHiddenThinkingLabel(*string)

func (NoopUI) SetStatus

func (NoopUI) SetStatus(string, *string)

func (NoopUI) SetTheme

func (NoopUI) SetTheme(any) ThemeSetResult

func (NoopUI) SetTitle

func (NoopUI) SetTitle(string)

func (NoopUI) SetToolsExpanded

func (NoopUI) SetToolsExpanded(bool)

func (NoopUI) SetWidget

func (NoopUI) SetWidget(string, *Widget, *WidgetOptions)

func (NoopUI) SetWorkingIndicator

func (NoopUI) SetWorkingIndicator(*WorkingIndicatorOptions)

func (NoopUI) SetWorkingMessage

func (NoopUI) SetWorkingMessage(*string)

func (NoopUI) SetWorkingVisible

func (NoopUI) SetWorkingVisible(bool)

func (NoopUI) Theme

func (NoopUI) Theme() Theme

type NotificationType

type NotificationType string
const (
	NotifyInfo    NotificationType = "info"
	NotifyWarning NotificationType = "warning"
	NotifyError   NotificationType = "error"
)

type OAuthAuthInfo

type OAuthAuthInfo struct {
	URL          string
	Instructions string
}

type OAuthCredentials

type OAuthCredentials struct {
	Refresh string         `json:"refresh"`
	Access  string         `json:"access"`
	Expires int64          `json:"expires"`
	Extra   map[string]any `json:"-"`
}

func (OAuthCredentials) MarshalJSON

func (credentials OAuthCredentials) MarshalJSON() ([]byte, error)

func (*OAuthCredentials) UnmarshalJSON

func (credentials *OAuthCredentials) UnmarshalJSON(data []byte) error

type OAuthDeviceCodeInfo

type OAuthDeviceCodeInfo struct {
	UserCode         string
	VerificationURI  string
	IntervalSeconds  int
	ExpiresInSeconds int
}

type OAuthLoginCallbacks

type OAuthLoginCallbacks struct {
	Signal            context.Context
	OnAuth            func(OAuthAuthInfo)
	OnDeviceCode      func(OAuthDeviceCodeInfo)
	OnPrompt          func(OAuthPrompt) (string, error)
	OnProgress        func(string)
	OnManualCodeInput func() (string, error)
	OnSelect          func(OAuthSelectPrompt) (*string, error)
}

type OAuthPrompt

type OAuthPrompt struct {
	Message     string
	Placeholder string
	AllowEmpty  bool
}

type OAuthProvider

type OAuthProvider struct {
	Name         string
	Login        func(context.Context, OAuthLoginCallbacks) (OAuthCredentials, error)
	RefreshToken func(context.Context, OAuthCredentials) (OAuthCredentials, error)
	GetAPIKey    func(OAuthCredentials) (string, error)
	ModifyModels func([]ai.Model, OAuthCredentials) ([]ai.Model, error)
}

type OAuthSelectOption

type OAuthSelectOption struct {
	ID    string
	Label string
}

type OAuthSelectPrompt

type OAuthSelectPrompt struct {
	Message string
	Options []OAuthSelectOption
}

type OverlayAnchor

type OverlayAnchor string
const (
	OverlayTopLeft     OverlayAnchor = "top-left"
	OverlayTop         OverlayAnchor = "top"
	OverlayTopRight    OverlayAnchor = "top-right"
	OverlayLeft        OverlayAnchor = "left"
	OverlayCenter      OverlayAnchor = "center"
	OverlayRight       OverlayAnchor = "right"
	OverlayBottomLeft  OverlayAnchor = "bottom-left"
	OverlayBottom      OverlayAnchor = "bottom"
	OverlayBottomRight OverlayAnchor = "bottom-right"
)

type OverlayHandle

type OverlayHandle interface {
	Hide()
	SetHidden(bool)
	IsHidden() bool
	Focus()
	Unfocus(...OverlayUnfocusOptions)
	IsFocused() bool
}

type OverlayOptions

type OverlayOptions struct {
	Width        any
	MinWidth     int
	MaxHeight    any
	Anchor       OverlayAnchor
	OffsetX      int
	OffsetY      int
	Row          any
	Column       any
	Margin       any
	Visible      func(width, height int) bool
	NonCapturing bool
}

type OverlayUnfocusOptions

type OverlayUnfocusOptions struct {
	Target Component
}

type ProjectTrustContext

type ProjectTrustContext interface {
	CWD() string
	Mode() Mode
	HasUI() bool
	UI() TrustUI
}

type ProjectTrustDecision

type ProjectTrustDecision string
const (
	ProjectTrustYes       ProjectTrustDecision = "yes"
	ProjectTrustNo        ProjectTrustDecision = "no"
	ProjectTrustUndecided ProjectTrustDecision = "undecided"
)

type ProjectTrustEvent

type ProjectTrustEvent struct{ CWD string }

func (ProjectTrustEvent) Type

type ProjectTrustResult

type ProjectTrustResult struct {
	Trusted  ProjectTrustDecision `json:"trusted"`
	Remember bool                 `json:"remember,omitempty"`
}

type Provider

type Provider struct {
	ID            string
	Name          string
	BaseURL       string
	Headers       map[string]string
	Auth          aiauth.ProviderAuth
	Config        ProviderConfig
	FilterModels  func([]ai.Model, *aiauth.Credential) ([]ai.Model, error)
	GetModels     func() ([]ai.Model, error)
	RefreshModels func(RefreshModelsContext) error
	Stream        agent.StreamFn
	StreamSimple  agent.StreamFn
	// RegistrationValue is returned only to the VM that owns it; callbacks
	// above remain the cross-VM representation held by the shared registry.
	RegistrationValue any
}

type ProviderConfig

type ProviderConfig struct {
	Name          string
	BaseURL       string
	APIKey        string
	API           ai.API
	Stream        agent.StreamFn
	Headers       map[string]string
	AuthHeader    *bool
	Models        []ProviderModelConfig
	RefreshModels func(RefreshModelsContext) ([]ProviderModelConfig, error)
	OAuth         *OAuthProvider
	Defined       map[string]bool
	// RegistrationValues retains owner-scoped values solely so the bridge can
	// expose the effective registration through the owning VM.
	RegistrationValues map[string]any
}

type ProviderModelConfig

type ProviderModelConfig struct {
	ID               string
	Name             string
	API              ai.API
	BaseURL          string
	Reasoning        bool
	ThinkingLevelMap *map[ai.ModelThinkingLevel]*string
	Input            ai.InputModalities
	Cost             ai.ModelCost
	ContextWindow    float64
	MaxTokens        float64
	Headers          map[string]string
	Compat           json.RawMessage
}

type ProviderModelsStoreEntry

type ProviderModelsStoreEntry struct {
	Models    []ai.Model `json:"models"`
	CheckedAt *int64     `json:"checkedAt,omitempty"`
}

type ProviderRequestResult

type ProviderRequestResult struct {
	Payload any
	Replace bool
}

ProviderRequestResult distinguishes an unchanged payload from an explicit nil replacement.

type ReadonlySessionManager

type ReadonlySessionManager interface {
	IsPersisted() bool
	GetCWD() string
	GetSessionDir() string
	GetSessionID() string
	GetSessionFile() string
	GetLeafID() *string
	GetLeafEntry() *session.SessionEntry
	GetEntry(string) *session.SessionEntry
	GetEntries() []session.SessionEntry
	GetHeader() *session.SessionHeader
	GetSessionName() *string
	GetLabel(string) *string
	GetChildren(string) []session.SessionEntry
	GetBranch(...string) []session.SessionEntry
	GetTree() []*session.SessionTreeNode
	BuildContextEntries() []session.SessionEntry
	BuildSessionContext() session.SessionContext
}

type RefreshModelsContext

type RefreshModelsContext struct {
	Credential   *aiauth.Credential
	Store        ProviderModelStore
	AllowNetwork bool
	Force        bool
	Signal       context.Context
}

type RegisterOption

type RegisterOption func(*registerOptions)

func WithHidden

func WithHidden(hidden bool) RegisterOption

func WithSourceInfo

func WithSourceInfo(sourceInfo SourceInfo) RegisterOption

type RegisteredTool

type RegisteredTool struct {
	Definition ToolDefinition
	SourceInfo SourceInfo
}

type Registry

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

func NewRegistry

func NewRegistry(cwd string) *Registry

func (*Registry) BindModelRegistry

func (registry *Registry) BindModelRegistry(models ModelRegistry, report func(ExtensionError))

func (*Registry) Events

func (registry *Registry) Events() EventBus

func (*Registry) Extensions

func (registry *Registry) Extensions() []*Extension

func (*Registry) Fresh

func (registry *Registry) Fresh(cwd string) (*Registry, error)

Fresh recreates every registered extension against a new active runtime. Factories run again so captured API and command contexts belong exclusively to the replacement session.

func (*Registry) HasPath

func (registry *Registry) HasPath(path string) bool

HasPath reports whether an extension path is already registered.

func (*Registry) Len

func (registry *Registry) Len() int

func (*Registry) Register

func (registry *Registry) Register(path string, factory Factory, options ...RegisterOption) error

func (*Registry) RegisteredFlags

func (registry *Registry) RegisteredFlags() []Flag

func (*Registry) SetFlagValue

func (registry *Registry) SetFlagValue(name string, value any)

type RenderShell

type RenderShell string
const (
	RenderShellDefault RenderShell = "default"
	RenderShellSelf    RenderShell = "self"
)

type ReplacedSessionContext

type ReplacedSessionContext interface {
	CommandContext
	SendMessage(context.Context, CustomMessage, *SendMessageOptions) error
	SendUserMessage(context.Context, ai.UserContent, *SendUserMessageOptions) error
}

type ResolvedCommand

type ResolvedCommand struct {
	Command
	InvocationName string
}

type ResourcesDiscoverEvent

type ResourcesDiscoverEvent struct {
	CWD    string
	Reason ResourcesDiscoverReason
}

func (ResourcesDiscoverEvent) Type

type ResourcesDiscoverReason

type ResourcesDiscoverReason string
const (
	ResourcesDiscoverStartup ResourcesDiscoverReason = "startup"
	ResourcesDiscoverReload  ResourcesDiscoverReason = "reload"
)

type ResourcesDiscoverResult

type ResourcesDiscoverResult struct {
	SkillPaths  []string `json:"skillPaths,omitempty"`
	PromptPaths []string `json:"promptPaths,omitempty"`
	ThemePaths  []string `json:"themePaths,omitempty"`
}

type Runner

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

func NewRunner

func NewRunner(registry *Registry, options RunnerOptions) *Runner

func (*Runner) ActiveTools

func (runner *Runner) ActiveTools() ([]string, error)

func (*Runner) AllRegisteredTools

func (runner *Runner) AllRegisteredTools() []RegisteredTool

func (*Runner) BindCommandContext

func (runner *Runner) BindCommandContext(actions *CommandActions)

func (*Runner) BindCore

func (runner *Runner) BindCore(actions Actions, contextActions ContextActions)

func (*Runner) Command

func (runner *Runner) Command(name string) *ResolvedCommand

func (*Runner) CommandDiagnostics

func (runner *Runner) CommandDiagnostics() []Diagnostic

func (*Runner) CreateCommandContext

func (runner *Runner) CreateCommandContext() CommandContext

func (*Runner) CreateContext

func (runner *Runner) CreateContext() Context

func (*Runner) CreateReplacedSessionContext

func (runner *Runner) CreateReplacedSessionContext() ReplacedSessionContext

CreateReplacedSessionContext creates the post-replacement context passed to new, fork, and switch callbacks.

func (*Runner) Emit

func (runner *Runner) Emit(ctx context.Context, event Event) any

func (*Runner) EmitBeforeAgentStart

func (runner *Runner) EmitBeforeAgentStart(
	ctx context.Context,
	prompt string,
	images []*ai.ImageContent,
	systemPrompt string,
	options SystemPromptOptions,
) *BeforeAgentStartCombinedResult

func (*Runner) EmitBeforeProviderHeaders

func (runner *Runner) EmitBeforeProviderHeaders(ctx context.Context, headers ai.ProviderHeaders) ai.ProviderHeaders

func (*Runner) EmitBeforeProviderRequest

func (runner *Runner) EmitBeforeProviderRequest(ctx context.Context, payload any) any

func (*Runner) EmitContext

func (runner *Runner) EmitContext(ctx context.Context, messages agent.AgentMessages) agent.AgentMessages

func (*Runner) EmitInput

func (runner *Runner) EmitInput(
	ctx context.Context,
	text string,
	images []*ai.ImageContent,
	source InputSource,
	streamingBehavior *DeliveryMode,
) InputResult

func (*Runner) EmitMessageEnd

func (runner *Runner) EmitMessageEnd(ctx context.Context, event MessageEndEvent) agent.AgentMessage

func (*Runner) EmitProjectTrust

func (runner *Runner) EmitProjectTrust(ctx context.Context, event ProjectTrustEvent, trustContext Context) (*ProjectTrustResult, []ExtensionError)

func (*Runner) EmitResourcesDiscover

func (runner *Runner) EmitResourcesDiscover(ctx context.Context, cwd string, reason ResourcesDiscoverReason) DiscoveredResources

func (*Runner) EmitToolCall

func (runner *Runner) EmitToolCall(ctx context.Context, event ToolCallEvent) *ToolCallResult

func (*Runner) EmitToolResult

func (runner *Runner) EmitToolResult(ctx context.Context, event ToolResultEvent) *ToolResultResult

func (*Runner) EmitUserBash

func (runner *Runner) EmitUserBash(ctx context.Context, event UserBashEvent) *UserBashResult

func (*Runner) EntryRenderer

func (runner *Runner) EntryRenderer(customType string) EntryRenderer

func (*Runner) ExecuteCommand

func (runner *Runner) ExecuteCommand(ctx context.Context, name, args string) bool

func (*Runner) ExtensionPaths

func (runner *Runner) ExtensionPaths() []string

func (*Runner) FlagValues

func (runner *Runner) FlagValues() map[string]any

func (*Runner) Flags

func (runner *Runner) Flags() map[string]Flag

func (*Runner) HasHandlers

func (runner *Runner) HasHandlers(event EventType) bool

func (*Runner) HasUI

func (runner *Runner) HasUI() bool

func (*Runner) Invalidate

func (runner *Runner) Invalidate(message string)

func (*Runner) MessageRenderer

func (runner *Runner) MessageRenderer(customType string) MessageRenderer

func (*Runner) ModelRegistry

func (runner *Runner) ModelRegistry() ModelRegistry

func (*Runner) OnError

func (runner *Runner) OnError(listener func(ExtensionError)) func()

func (*Runner) RegisteredCommands

func (runner *Runner) RegisteredCommands() []ResolvedCommand

func (*Runner) RegisteredFlags

func (runner *Runner) RegisteredFlags() []Flag

func (*Runner) SetFlagValue

func (runner *Runner) SetFlagValue(name string, value any)

func (*Runner) SetUI

func (runner *Runner) SetUI(ui UI, mode Mode)

func (*Runner) ShortcutDiagnostics

func (runner *Runner) ShortcutDiagnostics() []Diagnostic

func (*Runner) ShortcutOrder

func (runner *Runner) ShortcutOrder() []string

ShortcutOrder returns registered shortcut keys in extension registration order. Upstream getShortcuts returns an insertion-ordered Map; the TUI dispatcher walks this order so first-registered shortcuts win ties.

func (*Runner) Shortcuts

func (runner *Runner) Shortcuts(bindings map[string][]string) map[string]Shortcut

func (*Runner) Shutdown

func (runner *Runner) Shutdown()

func (*Runner) ToolDefinition

func (runner *Runner) ToolDefinition(name string) *ToolDefinition

func (*Runner) UI

func (runner *Runner) UI() UI

type RunnerOptions

type RunnerOptions struct {
	CWD            string
	SessionManager ReadonlySessionManager
	ModelRegistry  ModelRegistry
	Mode           Mode
	UI             UI
	Actions        Actions
	ContextActions ContextActions
	CommandActions *CommandActions
	ErrorHandler   func(ExtensionError)
}

type SendMessageOptions

type SendMessageOptions struct {
	TriggerTurn bool
	DeliverAs   DeliveryMode
}

type SendUserMessageOptions

type SendUserMessageOptions struct{ DeliverAs DeliveryMode }

type SessionBeforeCompactEvent

type SessionBeforeCompactEvent struct {
	Preparation        harness.CompactionPreparation
	BranchEntries      []session.SessionEntry
	CustomInstructions *string
	Reason             CompactionReason
	WillRetry          bool
	Signal             context.Context
}

func (SessionBeforeCompactEvent) Type

type SessionBeforeCompactResult

type SessionBeforeCompactResult struct {
	Cancel     bool
	Compaction *session.CompactionResult
}

type SessionBeforeForkEvent

type SessionBeforeForkEvent struct {
	EntryID  string
	Position ForkPosition
}

func (SessionBeforeForkEvent) Type

type SessionBeforeForkResult

type SessionBeforeForkResult struct {
	Cancel                  bool
	SkipConversationRestore bool
}

type SessionBeforeSwitchEvent

type SessionBeforeSwitchEvent struct {
	Reason            SessionSwitchReason
	TargetSessionFile *string
}

func (SessionBeforeSwitchEvent) Type

type SessionBeforeSwitchResult

type SessionBeforeSwitchResult struct{ Cancel bool }

type SessionBeforeTreeEvent

type SessionBeforeTreeEvent struct {
	Preparation TreePreparation
	Signal      context.Context
}

func (SessionBeforeTreeEvent) Type

type SessionBeforeTreeResult

type SessionBeforeTreeResult struct {
	Cancel              bool
	Summary             *TreeSummary
	CustomInstructions  *string
	ReplaceInstructions *bool
	Label               *string
}

type SessionCompactEvent

type SessionCompactEvent struct {
	CompactionEntry session.SessionEntry
	FromExtension   bool
	Reason          CompactionReason
	WillRetry       bool
}

func (SessionCompactEvent) Type

type SessionInfoChangedEvent

type SessionInfoChangedEvent struct{ Name *string }

func (SessionInfoChangedEvent) Type

type SessionReplacementResult

type SessionReplacementResult struct{ Cancelled bool }

type SessionShutdownEvent

type SessionShutdownEvent struct {
	Reason            SessionShutdownReason
	TargetSessionFile *string
}

func (SessionShutdownEvent) Type

type SessionShutdownReason

type SessionShutdownReason string
const (
	SessionShutdownQuit   SessionShutdownReason = "quit"
	SessionShutdownReload SessionShutdownReason = "reload"
	SessionShutdownNew    SessionShutdownReason = "new"
	SessionShutdownResume SessionShutdownReason = "resume"
	SessionShutdownFork   SessionShutdownReason = "fork"
)

type SessionStartEvent

type SessionStartEvent struct {
	Reason              SessionStartReason
	PreviousSessionFile *string
}

func (SessionStartEvent) Type

type SessionStartReason

type SessionStartReason string
const (
	SessionStartStartup SessionStartReason = "startup"
	SessionStartReload  SessionStartReason = "reload"
	SessionStartNew     SessionStartReason = "new"
	SessionStartResume  SessionStartReason = "resume"
	SessionStartFork    SessionStartReason = "fork"
)

type SessionSwitchReason

type SessionSwitchReason string
const (
	SessionSwitchNew    SessionSwitchReason = "new"
	SessionSwitchResume SessionSwitchReason = "resume"
)

type SessionTreeEvent

type SessionTreeEvent struct {
	NewLeafID     *string
	OldLeafID     *string
	SummaryEntry  *session.SessionEntry
	FromExtension *bool
}

func (SessionTreeEvent) Type

func (SessionTreeEvent) Type() EventType

type Shortcut

type Shortcut struct {
	Shortcut      string
	Description   string
	Handler       func(context.Context, Context) error
	ExtensionPath string
}

type Skill

type Skill struct {
	Name                   string     `json:"name"`
	Description            string     `json:"description"`
	FilePath               string     `json:"filePath"`
	BaseDir                string     `json:"baseDir"`
	SourceInfo             SourceInfo `json:"sourceInfo"`
	DisableModelInvocation bool       `json:"disableModelInvocation"`
}

type SlashCommandInfo

type SlashCommandInfo struct {
	Name        string             `json:"name"`
	Description string             `json:"description,omitempty"`
	Source      SlashCommandSource `json:"source"`
	SourceInfo  SourceInfo         `json:"sourceInfo"`
}

type SlashCommandSource

type SlashCommandSource string
const (
	SlashCommandExtension SlashCommandSource = "extension"
	SlashCommandPrompt    SlashCommandSource = "prompt"
	SlashCommandSkill     SlashCommandSource = "skill"
)

type SourceInfo

type SourceInfo struct {
	Path    string       `json:"path"`
	Source  string       `json:"source"`
	Scope   SourceScope  `json:"scope"`
	Origin  SourceOrigin `json:"origin"`
	BaseDir *string      `json:"baseDir,omitempty"`
}

type SourceOrigin

type SourceOrigin string
const (
	SourceOriginPackage  SourceOrigin = "package"
	SourceOriginTopLevel SourceOrigin = "top-level"
)

type SourceScope

type SourceScope string
const (
	SourceScopeUser      SourceScope = "user"
	SourceScopeProject   SourceScope = "project"
	SourceScopeTemporary SourceScope = "temporary"
)

type SwitchSessionOptions

type SwitchSessionOptions struct {
	WithSession func(context.Context, ReplacedSessionContext) error
}

type SystemPromptOptions

type SystemPromptOptions struct {
	CustomPrompt       *string           `json:"customPrompt,omitempty"`
	SelectedTools      []string          `json:"selectedTools,omitempty"`
	ToolSnippets       map[string]string `json:"toolSnippets,omitempty"`
	PromptGuidelines   []string          `json:"promptGuidelines,omitempty"`
	AppendSystemPrompt *string           `json:"appendSystemPrompt,omitempty"`
	CWD                string            `json:"cwd"`
	ContextFiles       []ContextFile     `json:"contextFiles,omitempty"`
	Skills             []Skill           `json:"skills,omitempty"`
}

type TerminalInputHandler

type TerminalInputHandler func(string) *TerminalInputResult

type TerminalInputResult

type TerminalInputResult struct {
	Consume bool
	Data    *string
}

type Theme

type Theme interface {
	FG(color, text string) string
	BG(color, text string) string
	Bold(string) string
	Italic(string) string
	Underline(string) string
	Inverse(string) string
	Strikethrough(string) string
	FGANSI(string) string
	BGANSI(string) string
	ColorMode() string
	ThinkingBorderColor(agent.ThinkingLevel) func(string) string
	BashModeBorderColor() func(string) string
}

type ThemeInfo

type ThemeInfo struct {
	Name string
	Path *string
}

type ThemeSetResult

type ThemeSetResult struct {
	Success bool
	Error   string
}

type ThinkingLevelSelectEvent

type ThinkingLevelSelectEvent struct {
	Level         agent.ThinkingLevel
	PreviousLevel agent.ThinkingLevel
}

func (ThinkingLevelSelectEvent) Type

type ToolCallEvent

type ToolCallEvent struct {
	ToolCallID string
	ToolName   string
	Input      map[string]any
}

func (ToolCallEvent) Type

func (ToolCallEvent) Type() EventType

type ToolCallResult

type ToolCallResult struct {
	Block  bool   `json:"block,omitempty"`
	Reason string `json:"reason,omitempty"`
}

type ToolDefinition

type ToolDefinition struct {
	Name                string
	Label               string
	Description         string
	PromptSnippet       string
	PromptGuidelines    []string
	Parameters          ai.JSONSchema
	ConstrainedSampling *ai.ConstrainedSamplingConfig
	RenderShell         RenderShell
	PrepareArguments    agent.PrepareArgumentsFunc
	ExecutionMode       agent.ToolExecutionMode
	Execute             func(context.Context, string, any, agent.AgentToolUpdateCallback, Context) (agent.AgentToolResult, error)
	RenderCall          func(any, Theme, ToolRenderContext) Component
	RenderResult        func(agent.AgentToolResult, ToolRenderResultOptions, Theme, ToolRenderContext) Component
}

type ToolExecutionEndEvent

type ToolExecutionEndEvent struct {
	ToolCallID string
	ToolName   string
	Result     any
	IsError    bool
}

func (ToolExecutionEndEvent) Type

type ToolExecutionStartEvent

type ToolExecutionStartEvent struct {
	ToolCallID string
	ToolName   string
	Args       any
}

func (ToolExecutionStartEvent) Type

type ToolExecutionUpdateEvent

type ToolExecutionUpdateEvent struct {
	ToolCallID    string
	ToolName      string
	Args          any
	PartialResult any
}

func (ToolExecutionUpdateEvent) Type

type ToolInfo

type ToolInfo struct {
	Name             string        `json:"name"`
	Description      string        `json:"description"`
	Parameters       ai.JSONSchema `json:"parameters"`
	PromptGuidelines []string      `json:"promptGuidelines,omitempty"`
	SourceInfo       SourceInfo    `json:"sourceInfo"`
}

type ToolRenderContext

type ToolRenderContext struct {
	Args             any
	ToolCallID       string
	Invalidate       func()
	LastComponent    Component
	State            map[string]any
	CWD              string
	ExecutionStarted bool
	ArgsComplete     bool
	IsPartial        bool
	Expanded         bool
	ShowImages       bool
	IsError          bool
}

type ToolRenderResultOptions

type ToolRenderResultOptions struct {
	Expanded  bool
	IsPartial bool
}

type ToolResultEvent

type ToolResultEvent struct {
	ToolCallID string
	ToolName   string
	Input      map[string]any
	Content    ai.ToolResultContent
	Details    any
	IsError    bool
	Usage      *ai.Usage
}

func (ToolResultEvent) Type

func (ToolResultEvent) Type() EventType

type ToolResultResult

type ToolResultResult struct {
	Content *ai.ToolResultContent
	Details *any
	IsError *bool
	Usage   *ai.Usage
}

type TreePreparation

type TreePreparation struct {
	TargetID            string
	OldLeafID           *string
	CommonAncestorID    *string
	EntriesToSummarize  []session.SessionEntry
	UserWantsSummary    bool
	CustomInstructions  *string
	ReplaceInstructions bool
	Label               *string
}

type TreeSummary

type TreeSummary struct {
	Summary string
	Details any
	Usage   *ai.Usage
}

type TurnEndEvent

type TurnEndEvent struct {
	TurnIndex   int
	Message     agent.AgentMessage
	ToolResults []*ai.ToolResultMessage
}

func (TurnEndEvent) Type

func (TurnEndEvent) Type() EventType

type TurnStartEvent

type TurnStartEvent struct {
	TurnIndex int
	Timestamp int64
}

func (TurnStartEvent) Type

func (TurnStartEvent) Type() EventType

type UI

type UI interface {
	TrustUI
	OnTerminalInput(TerminalInputHandler) func()
	SetStatus(string, *string)
	SetWorkingMessage(*string)
	SetWorkingVisible(bool)
	SetWorkingIndicator(*WorkingIndicatorOptions)
	SetHiddenThinkingLabel(*string)
	SetWidget(string, *Widget, *WidgetOptions)
	SetFooter(FooterFactory)
	SetHeader(HeaderFactory)
	SetTitle(string)
	Custom(context.Context, CustomFactory, *CustomOptions) (any, bool, error)
	PasteToEditor(string)
	SetEditorText(string)
	GetEditorText() string
	Editor(context.Context, string, *string) (string, bool, error)
	AddAutocompleteProvider(AutocompleteProviderFactory)
	SetEditorComponent(EditorFactory)
	GetEditorComponent() EditorFactory
	Theme() Theme
	GetAllThemes() []ThemeInfo
	GetTheme(string) Theme
	SetTheme(any) ThemeSetResult
	GetToolsExpanded() bool
	SetToolsExpanded(bool)
}

func NewNoopUI

func NewNoopUI() UI

type UIHost

type UIHost interface {
	Width() int
	Height() int
	Invalidate()
}

type UserBashEvent

type UserBashEvent struct {
	Command            string
	ExcludeFromContext bool
	CWD                string
}

func (UserBashEvent) Type

func (UserBashEvent) Type() EventType

type UserBashResult

type UserBashResult struct {
	Operations tools.BashOperations
	Result     *BashResult
}

type Widget

type Widget struct {
	Lines   []string
	Factory ComponentFactory
}

type WidgetOptions

type WidgetOptions struct{ Placement WidgetPlacement }

type WidgetPlacement

type WidgetPlacement string
const (
	WidgetAboveEditor WidgetPlacement = "aboveEditor"
	WidgetBelowEditor WidgetPlacement = "belowEditor"
)

type WorkingIndicatorOptions

type WorkingIndicatorOptions struct {
	Frames     []string
	IntervalMS int64
}

Directories

Path Synopsis
examples
Package host implements pigo's original out-of-process JavaScript extension host protocol and lifecycle manager.
Package host implements pigo's original out-of-process JavaScript extension host protocol and lifecycle manager.

Jump to

Keyboard shortcuts

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