Documentation
¶
Overview ¶
Package extensions provides the Go-native extension registry, API surface, and ordered event runner used by the coding agent.
Index ¶
- Variables
- func BashToolCall(event ToolCallEvent) (tools.BashToolInput, bool)
- func BashToolResult(event ToolResultEvent) (tools.BashToolDetails, bool)
- func EditToolCall(event ToolCallEvent) (tools.EditToolInput, bool)
- func EditToolResult(event ToolResultEvent) (tools.EditToolDetails, bool)
- func EmitSessionShutdown(ctx context.Context, runner *Runner, event SessionShutdownEvent) bool
- func FindToolCall(event ToolCallEvent) (tools.FindToolInput, bool)
- func FindToolResult(event ToolResultEvent) (tools.FindToolDetails, bool)
- func GrepToolCall(event ToolCallEvent) (tools.GrepToolInput, bool)
- func GrepToolResult(event ToolResultEvent) (tools.GrepToolDetails, bool)
- func LoadCompiled(cwd string, catalog []CompiledExtension, overrides map[string]bool, ...) (*Registry, []CompiledLoadError)
- func LsToolCall(event ToolCallEvent) (tools.LsToolInput, bool)
- func LsToolResult(event ToolResultEvent) (tools.LsToolDetails, bool)
- func ReadToolCall(event ToolCallEvent) (tools.ReadToolInput, bool)
- func ReadToolResult(event ToolResultEvent) (tools.ReadToolDetails, bool)
- func RegisterCustomEditorBase(factory EditorFactory)
- func WrapRegisteredTool(tool RegisteredTool, runner *Runner) agent.AgentTool
- func WrapRegisteredTools(tools []RegisteredTool, runner *Runner) []agent.AgentTool
- func WriteToolCall(event ToolCallEvent) (tools.WriteToolInput, bool)
- func WriteToolResult(event ToolResultEvent) bool
- type API
- type Actions
- type AfterProviderResponseEvent
- type AgentEndEvent
- type AgentSettledEvent
- type AgentStartEvent
- type AuthStatus
- type AutocompleteEditorComponent
- type AutocompleteItem
- type AutocompleteProvider
- type AutocompleteProviderFactory
- type AutocompleteRequest
- type AutocompleteResult
- type BashResult
- type BeforeAgentStartCombinedResult
- type BeforeAgentStartEvent
- type BeforeAgentStartResult
- type BeforeProviderHeadersEvent
- type BeforeProviderRequestEvent
- type Command
- type CommandActions
- type CommandContext
- type CompactOptions
- type CompactionReason
- type CompiledExtension
- type CompiledLoadError
- type Component
- type ComponentFactory
- type Context
- type ContextActions
- type ContextEvent
- type ContextFile
- type ContextResult
- type ContextUsage
- type CustomDone
- type CustomFactory
- type CustomMessage
- type CustomOptions
- type DeliveryMode
- type Diagnostic
- type DialogOptions
- type DiscoveredPath
- type DiscoveredResources
- type DisposableComponent
- type EditorComponent
- type EditorFactory
- type EntryRenderOptions
- type EntryRenderer
- type Event
- type EventBus
- type EventListener
- type EventType
- type ExecOptions
- type ExecResult
- type Extension
- type ExtensionError
- type Factory
- type Flag
- type FlagType
- type FooterDataProvider
- type FooterFactory
- type ForkOptions
- type ForkPosition
- type Handler
- type HeaderFactory
- type InputAction
- type InputEvent
- type InputResult
- type InputSource
- type KeybindingConflict
- type KeybindingDefinition
- type Keybindings
- type MessageEndEvent
- type MessageEndResult
- type MessageRenderOptions
- type MessageRenderer
- type MessageStartEvent
- type MessageUpdateEvent
- type Mode
- type ModelRegistry
- type ModelSelectEvent
- type ModelSelectSource
- type NavigateTreeOptions
- type NewSessionOptions
- type NoopUI
- func (NoopUI) AddAutocompleteProvider(AutocompleteProviderFactory)
- func (NoopUI) Confirm(context.Context, string, string, *DialogOptions) (bool, error)
- func (NoopUI) Custom(context.Context, CustomFactory, *CustomOptions) (any, bool, error)
- func (NoopUI) Editor(context.Context, string, *string) (string, bool, error)
- func (NoopUI) GetAllThemes() []ThemeInfo
- func (NoopUI) GetEditorComponent() EditorFactory
- func (NoopUI) GetEditorText() string
- func (NoopUI) GetTheme(string) Theme
- func (NoopUI) GetToolsExpanded() bool
- func (NoopUI) Input(context.Context, string, *string, *DialogOptions) (string, bool, error)
- func (NoopUI) Notify(string, NotificationType)
- func (NoopUI) OnTerminalInput(TerminalInputHandler) func()
- func (NoopUI) PasteToEditor(string)
- func (NoopUI) Select(context.Context, string, []string, *DialogOptions) (string, bool, error)
- func (NoopUI) SetEditorComponent(EditorFactory)
- func (NoopUI) SetEditorText(string)
- func (NoopUI) SetFooter(FooterFactory)
- func (NoopUI) SetHeader(HeaderFactory)
- func (NoopUI) SetHiddenThinkingLabel(*string)
- func (NoopUI) SetStatus(string, *string)
- func (NoopUI) SetTheme(any) ThemeSetResult
- func (NoopUI) SetTitle(string)
- func (NoopUI) SetToolsExpanded(bool)
- func (NoopUI) SetWidget(string, *Widget, *WidgetOptions)
- func (NoopUI) SetWorkingIndicator(*WorkingIndicatorOptions)
- func (NoopUI) SetWorkingMessage(*string)
- func (NoopUI) SetWorkingVisible(bool)
- func (NoopUI) Theme() Theme
- type NotificationType
- type OAuthAuthInfo
- type OAuthCredentials
- type OAuthDeviceCodeInfo
- type OAuthLoginCallbacks
- type OAuthPrompt
- type OAuthProvider
- type OAuthSelectOption
- type OAuthSelectPrompt
- type OverlayAnchor
- type OverlayHandle
- type OverlayOptions
- type OverlayUnfocusOptions
- type ProjectTrustContext
- type ProjectTrustDecision
- type ProjectTrustEvent
- type ProjectTrustResult
- type Provider
- type ProviderConfig
- type ProviderModelConfig
- type ProviderModelStore
- type ProviderModelsStoreEntry
- type ProviderRequestResult
- type ReadonlySessionManager
- type RefreshModelsContext
- type RegisterOption
- type RegisteredTool
- type Registry
- func (registry *Registry) BindModelRegistry(models ModelRegistry, report func(ExtensionError))
- func (registry *Registry) Events() EventBus
- func (registry *Registry) Extensions() []*Extension
- func (registry *Registry) Fresh(cwd string) (*Registry, error)
- func (registry *Registry) HasPath(path string) bool
- func (registry *Registry) Len() int
- func (registry *Registry) Register(path string, factory Factory, options ...RegisterOption) error
- func (registry *Registry) RegisteredFlags() []Flag
- func (registry *Registry) SetFlagValue(name string, value any)
- type RenderShell
- type ReplacedSessionContext
- type ResolvedCommand
- type ResourcesDiscoverEvent
- type ResourcesDiscoverReason
- type ResourcesDiscoverResult
- type Runner
- func (runner *Runner) ActiveTools() ([]string, error)
- func (runner *Runner) AllRegisteredTools() []RegisteredTool
- func (runner *Runner) BindCommandContext(actions *CommandActions)
- func (runner *Runner) BindCore(actions Actions, contextActions ContextActions)
- func (runner *Runner) Command(name string) *ResolvedCommand
- func (runner *Runner) CommandDiagnostics() []Diagnostic
- func (runner *Runner) CreateCommandContext() CommandContext
- func (runner *Runner) CreateContext() Context
- func (runner *Runner) CreateReplacedSessionContext() ReplacedSessionContext
- func (runner *Runner) Emit(ctx context.Context, event Event) any
- func (runner *Runner) EmitBeforeAgentStart(ctx context.Context, prompt string, images []*ai.ImageContent, ...) *BeforeAgentStartCombinedResult
- func (runner *Runner) EmitBeforeProviderHeaders(ctx context.Context, headers ai.ProviderHeaders) ai.ProviderHeaders
- func (runner *Runner) EmitBeforeProviderRequest(ctx context.Context, payload any) any
- func (runner *Runner) EmitContext(ctx context.Context, messages agent.AgentMessages) agent.AgentMessages
- func (runner *Runner) EmitInput(ctx context.Context, text string, images []*ai.ImageContent, ...) InputResult
- func (runner *Runner) EmitMessageEnd(ctx context.Context, event MessageEndEvent) agent.AgentMessage
- func (runner *Runner) EmitProjectTrust(ctx context.Context, event ProjectTrustEvent, trustContext Context) (*ProjectTrustResult, []ExtensionError)
- func (runner *Runner) EmitResourcesDiscover(ctx context.Context, cwd string, reason ResourcesDiscoverReason) DiscoveredResources
- func (runner *Runner) EmitToolCall(ctx context.Context, event ToolCallEvent) *ToolCallResult
- func (runner *Runner) EmitToolResult(ctx context.Context, event ToolResultEvent) *ToolResultResult
- func (runner *Runner) EmitUserBash(ctx context.Context, event UserBashEvent) *UserBashResult
- func (runner *Runner) EntryRenderer(customType string) EntryRenderer
- func (runner *Runner) ExecuteCommand(ctx context.Context, name, args string) bool
- func (runner *Runner) ExtensionPaths() []string
- func (runner *Runner) FlagValues() map[string]any
- func (runner *Runner) Flags() map[string]Flag
- func (runner *Runner) HasHandlers(event EventType) bool
- func (runner *Runner) HasUI() bool
- func (runner *Runner) Invalidate(message string)
- func (runner *Runner) MessageRenderer(customType string) MessageRenderer
- func (runner *Runner) ModelRegistry() ModelRegistry
- func (runner *Runner) OnError(listener func(ExtensionError)) func()
- func (runner *Runner) RegisteredCommands() []ResolvedCommand
- func (runner *Runner) RegisteredFlags() []Flag
- func (runner *Runner) SetFlagValue(name string, value any)
- func (runner *Runner) SetUI(ui UI, mode Mode)
- func (runner *Runner) ShortcutDiagnostics() []Diagnostic
- func (runner *Runner) ShortcutOrder() []string
- func (runner *Runner) Shortcuts(bindings map[string][]string) map[string]Shortcut
- func (runner *Runner) Shutdown()
- func (runner *Runner) ToolDefinition(name string) *ToolDefinition
- func (runner *Runner) UI() UI
- type RunnerOptions
- type SendMessageOptions
- type SendUserMessageOptions
- type SessionBeforeCompactEvent
- type SessionBeforeCompactResult
- type SessionBeforeForkEvent
- type SessionBeforeForkResult
- type SessionBeforeSwitchEvent
- type SessionBeforeSwitchResult
- type SessionBeforeTreeEvent
- type SessionBeforeTreeResult
- type SessionCompactEvent
- type SessionInfoChangedEvent
- type SessionReplacementResult
- type SessionShutdownEvent
- type SessionShutdownReason
- type SessionStartEvent
- type SessionStartReason
- type SessionSwitchReason
- type SessionTreeEvent
- type Shortcut
- type Skill
- type SlashCommandInfo
- type SlashCommandSource
- type SourceInfo
- type SourceOrigin
- type SourceScope
- type SwitchSessionOptions
- type SystemPromptOptions
- type TerminalInputHandler
- type TerminalInputResult
- type Theme
- type ThemeInfo
- type ThemeSetResult
- type ThinkingLevelSelectEvent
- type ToolCallEvent
- type ToolCallResult
- type ToolDefinition
- type ToolExecutionEndEvent
- type ToolExecutionStartEvent
- type ToolExecutionUpdateEvent
- type ToolInfo
- type ToolRenderContext
- type ToolRenderResultOptions
- type ToolResultEvent
- type ToolResultResult
- type TreePreparation
- type TreeSummary
- type TrustUI
- type TurnEndEvent
- type TurnStartEvent
- type UI
- type UIHost
- type UserBashEvent
- type UserBashResult
- type Widget
- type WidgetOptions
- type WidgetPlacement
- type WorkingIndicatorOptions
Constants ¶
This section is empty.
Variables ¶
var ( ErrRuntimeNotInitialized = errors.New("Extension runtime not initialized") )
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 ¶
func (AfterProviderResponseEvent) Type ¶
func (AfterProviderResponseEvent) Type() EventType
type AgentEndEvent ¶
type AgentEndEvent struct{ Messages agent.AgentMessages }
func (AgentEndEvent) Type ¶
func (AgentEndEvent) Type() EventType
type AgentSettledEvent ¶
type AgentSettledEvent struct{}
func (AgentSettledEvent) Type ¶
func (AgentSettledEvent) Type() EventType
type AgentStartEvent ¶
type AgentStartEvent struct{}
func (AgentStartEvent) Type ¶
func (AgentStartEvent) Type() EventType
type AuthStatus ¶
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 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 AutocompleteResult ¶
type AutocompleteResult struct {
Prefix string
Items []AutocompleteItem
}
type BashResult ¶
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 ¶
func (BeforeAgentStartEvent) Type() EventType
type BeforeAgentStartResult ¶
type BeforeAgentStartResult struct {
Message *CustomMessage
SystemPrompt *string
}
type BeforeProviderHeadersEvent ¶
type BeforeProviderHeadersEvent struct{ Headers ai.ProviderHeaders }
func (BeforeProviderHeadersEvent) Type ¶
func (BeforeProviderHeadersEvent) Type() EventType
type BeforeProviderRequestEvent ¶
type BeforeProviderRequestEvent struct{ Payload any }
func (BeforeProviderRequestEvent) Type ¶
func (BeforeProviderRequestEvent) Type() EventType
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 CommandActions ¶
type CommandActions struct {
WaitForIdle func(context.Context) error
NewSession func(context.Context, *NewSessionOptions) (SessionReplacementResult, error)
Fork func(context.Context, string, *ForkOptions) (SessionReplacementResult, error)
SwitchSession func(context.Context, string, *SwitchSessionOptions) (SessionReplacementResult, error)
Reload func(context.Context) error
}
type CommandContext ¶
type CommandContext interface {
Context
GetSystemPromptOptions() SystemPromptOptions
WaitForIdle(context.Context) error
NewSession(context.Context, *NewSessionOptions) (SessionReplacementResult, error)
Fork(context.Context, string, *ForkOptions) (SessionReplacementResult, error)
SwitchSession(context.Context, string, *SwitchSessionOptions) (SessionReplacementResult, error)
Reload(context.Context) 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 CompiledLoadError ¶
func (CompiledLoadError) Error ¶
func (loadError CompiledLoadError) Error() string
type ComponentFactory ¶
type Context ¶
type Context interface {
UI() UI
Mode() Mode
HasUI() bool
CWD() string
SessionManager() ReadonlySessionManager
ModelRegistry() ModelRegistry
Model() *ai.Model
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 ContextResult ¶
type ContextResult struct{ Messages agent.AgentMessages }
type ContextUsage ¶
type CustomDone ¶
type CustomDone func(any)
type CustomFactory ¶
type CustomFactory func(UIHost, Theme, Keybindings, CustomDone) (Component, error)
type CustomMessage ¶
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 DialogOptions ¶
type DiscoveredPath ¶
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 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 EventBus ¶
type EventBus interface {
Emit(context.Context, string, any) []error
On(string, EventListener) func()
Clear()
}
func NewEventBus ¶
func NewEventBus() EventBus
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 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 FooterDataProvider ¶
type FooterDataProvider interface {
}
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 HeaderFactory ¶
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 KeybindingDefinition ¶
type Keybindings ¶
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 }
type MessageRenderer ¶
type MessageRenderer func(CustomMessage, MessageRenderOptions, Theme) Component
type MessageStartEvent ¶
type MessageStartEvent struct{ Message agent.AgentMessage }
func (MessageStartEvent) Type ¶
func (MessageStartEvent) Type() EventType
type MessageUpdateEvent ¶
type MessageUpdateEvent struct {
Message agent.AgentMessage
AssistantMessageEvent ai.AssistantMessageEvent
}
func (MessageUpdateEvent) Type ¶
func (MessageUpdateEvent) Type() EventType
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 ¶
type NavigateTreeOptions struct {
}
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) Custom ¶
func (NoopUI) Custom(context.Context, CustomFactory, *CustomOptions) (any, bool, error)
func (NoopUI) GetAllThemes ¶
func (NoopUI) GetEditorComponent ¶
func (NoopUI) GetEditorComponent() EditorFactory
func (NoopUI) GetEditorText ¶
func (NoopUI) GetToolsExpanded ¶
func (NoopUI) Notify ¶
func (NoopUI) Notify(string, NotificationType)
func (NoopUI) OnTerminalInput ¶
func (NoopUI) OnTerminalInput(TerminalInputHandler) func()
func (NoopUI) PasteToEditor ¶
func (NoopUI) SetEditorComponent ¶
func (NoopUI) SetEditorComponent(EditorFactory)
func (NoopUI) SetEditorText ¶
func (NoopUI) SetFooter ¶
func (NoopUI) SetFooter(FooterFactory)
func (NoopUI) SetHeader ¶
func (NoopUI) SetHeader(HeaderFactory)
func (NoopUI) SetHiddenThinkingLabel ¶
func (NoopUI) SetTheme ¶
func (NoopUI) SetTheme(any) ThemeSetResult
func (NoopUI) SetToolsExpanded ¶
func (NoopUI) SetWorkingIndicator ¶
func (NoopUI) SetWorkingIndicator(*WorkingIndicatorOptions)
func (NoopUI) SetWorkingMessage ¶
func (NoopUI) SetWorkingVisible ¶
type NotificationType ¶
type NotificationType string
const ( NotifyInfo NotificationType = "info" NotifyWarning NotificationType = "warning" NotifyError NotificationType = "error" )
type OAuthAuthInfo ¶
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 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 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 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 OverlayUnfocusOptions ¶
type OverlayUnfocusOptions struct {
Target Component
}
type ProjectTrustContext ¶
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 ¶
func (ProjectTrustEvent) Type() EventType
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 ProviderModelStore ¶
type ProviderRequestResult ¶
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 (*Registry) BindModelRegistry ¶
func (registry *Registry) BindModelRegistry(models ModelRegistry, report func(ExtensionError))
func (*Registry) Extensions ¶
func (*Registry) Fresh ¶
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) Register ¶
func (registry *Registry) Register(path string, factory Factory, options ...RegisterOption) error
func (*Registry) RegisteredFlags ¶
func (*Registry) SetFlagValue ¶
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 ResourcesDiscoverEvent ¶
type ResourcesDiscoverEvent struct {
CWD string
Reason ResourcesDiscoverReason
}
func (ResourcesDiscoverEvent) Type ¶
func (ResourcesDiscoverEvent) Type() EventType
type ResourcesDiscoverReason ¶
type ResourcesDiscoverReason string
const ( ResourcesDiscoverStartup ResourcesDiscoverReason = "startup" ResourcesDiscoverReload ResourcesDiscoverReason = "reload" )
type ResourcesDiscoverResult ¶
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
func NewRunner ¶
func NewRunner(registry *Registry, options RunnerOptions) *Runner
func (*Runner) ActiveTools ¶
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) CreateReplacedSessionContext ¶
func (runner *Runner) CreateReplacedSessionContext() ReplacedSessionContext
CreateReplacedSessionContext creates the post-replacement context passed to new, fork, and switch callbacks.
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) 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) ExtensionPaths ¶
func (*Runner) FlagValues ¶
func (*Runner) HasHandlers ¶
func (*Runner) Invalidate ¶
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) SetFlagValue ¶
func (*Runner) ShortcutDiagnostics ¶
func (runner *Runner) ShortcutDiagnostics() []Diagnostic
func (*Runner) ShortcutOrder ¶
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) ToolDefinition ¶
func (runner *Runner) ToolDefinition(name string) *ToolDefinition
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 ¶
func (SessionBeforeCompactEvent) Type() EventType
type SessionBeforeCompactResult ¶
type SessionBeforeCompactResult struct {
Cancel bool
Compaction *session.CompactionResult
}
type SessionBeforeForkEvent ¶
type SessionBeforeForkEvent struct {
EntryID string
Position ForkPosition
}
func (SessionBeforeForkEvent) Type ¶
func (SessionBeforeForkEvent) Type() EventType
type SessionBeforeForkResult ¶
type SessionBeforeSwitchEvent ¶
type SessionBeforeSwitchEvent struct {
Reason SessionSwitchReason
TargetSessionFile *string
}
func (SessionBeforeSwitchEvent) Type ¶
func (SessionBeforeSwitchEvent) Type() EventType
type SessionBeforeSwitchResult ¶
type SessionBeforeSwitchResult struct{ Cancel bool }
type SessionBeforeTreeEvent ¶
type SessionBeforeTreeEvent struct {
Preparation TreePreparation
Signal context.Context
}
func (SessionBeforeTreeEvent) Type ¶
func (SessionBeforeTreeEvent) Type() EventType
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 ¶
func (SessionCompactEvent) Type() EventType
type SessionInfoChangedEvent ¶
type SessionInfoChangedEvent struct{ Name *string }
func (SessionInfoChangedEvent) Type ¶
func (SessionInfoChangedEvent) Type() EventType
type SessionReplacementResult ¶
type SessionReplacementResult struct{ Cancelled bool }
type SessionShutdownEvent ¶
type SessionShutdownEvent struct {
Reason SessionShutdownReason
TargetSessionFile *string
}
func (SessionShutdownEvent) Type ¶
func (SessionShutdownEvent) Type() EventType
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 ¶
func (SessionStartEvent) Type() EventType
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 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 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 ThemeSetResult ¶
type ThinkingLevelSelectEvent ¶
type ThinkingLevelSelectEvent struct {
Level agent.ThinkingLevel
PreviousLevel agent.ThinkingLevel
}
func (ThinkingLevelSelectEvent) Type ¶
func (ThinkingLevelSelectEvent) Type() EventType
type ToolCallEvent ¶
func (ToolCallEvent) Type ¶
func (ToolCallEvent) Type() EventType
type ToolCallResult ¶
type ToolDefinition ¶
type ToolDefinition struct {
Name string
Label string
Description string
PromptSnippet string
PromptGuidelines []string
Parameters ai.JSONSchema
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 ¶
func (ToolExecutionEndEvent) Type ¶
func (ToolExecutionEndEvent) Type() EventType
type ToolExecutionStartEvent ¶
func (ToolExecutionStartEvent) Type ¶
func (ToolExecutionStartEvent) Type() EventType
type ToolExecutionUpdateEvent ¶
type ToolExecutionUpdateEvent struct {
ToolCallID string
ToolName string
Args any
PartialResult any
}
func (ToolExecutionUpdateEvent) Type ¶
func (ToolExecutionUpdateEvent) Type() EventType
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 ToolRenderResultOptions ¶
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 TreePreparation ¶
type TurnEndEvent ¶
type TurnEndEvent struct {
TurnIndex int
Message agent.AgentMessage
ToolResults []*ai.ToolResultMessage
}
func (TurnEndEvent) Type ¶
func (TurnEndEvent) Type() EventType
type TurnStartEvent ¶
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)
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)
}
type UserBashEvent ¶
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 ¶
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
Package jsbridge discovers, bundles, and runs TypeScript extensions in isolated Sobek runtimes backed by the Go-native extension API.
|
Package jsbridge discovers, bundles, and runs TypeScript extensions in isolated Sobek runtimes backed by the Go-native extension API. |