gicodingagent

package
v0.82.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ProtocolEventSessionBeforeSwitch   = "session_before_switch"
	ProtocolEventSessionBeforeFork     = "session_before_fork"
	ProtocolEventSessionShutdown       = "session_shutdown"
	ProtocolEventSessionStart          = "session_start"
	ProtocolEventSessionSwitch         = "session_switch"
	ProtocolEventSessionInfoChanged    = "session_info_changed"
	ProtocolEventSessionBeforeTree     = "session_before_tree"
	ProtocolEventModelSelect           = "model_select"
	ProtocolEventThinkingLevelSelect   = "thinking_level_select"
	ProtocolEventBeforeAgentStart      = "before_agent_start"
	ProtocolEventAgentSettled          = "agent_settled"
	ProtocolEventContext               = "context"
	ProtocolEventToolCall              = "tool_call"
	ProtocolEventToolResult            = "tool_result"
	ProtocolEventToolExecutionUpdate   = "tool_execution_update"
	ProtocolEventMessageStart          = "message_start"
	ProtocolEventMessageUpdate         = "message_update"
	ProtocolEventMessageEnd            = "message_end"
	ProtocolEventUserBash              = "user_bash"
	ProtocolEventProjectTrust          = "project_trust"
	ProtocolEventResourcesDiscover     = "resources_discover"
	ProtocolEventBeforeProviderRequest = "before_provider_request"
	ProtocolEventBeforeProviderHeaders = "before_provider_headers"
	ProtocolEventAfterProviderResponse = "after_provider_response"
)
View Source
const (
	DefaultCodingAgentPackageName = "gi"
	DefaultCodingAgentVersion     = "0.82.2"
	DefaultCodingAgentAppName     = "gi"
	DefaultCodingAgentAppTitle    = "Gi"

	EnvCodingAgentDir              = "GI_CODING_AGENT_DIR"
	LegacyEnvCodingAgentDir        = "PI_CODING_AGENT_DIR"
	EnvCodingAgentSessionDir       = "GI_CODING_AGENT_SESSION_DIR"
	LegacyEnvCodingAgentSessionDir = "PI_CODING_AGENT_SESSION_DIR"

	InstallMethodBunBinary InstallMethod = "bun-binary"
	InstallMethodNPM       InstallMethod = "npm"
	InstallMethodPNPM      InstallMethod = "pnpm"
	InstallMethodYarn      InstallMethod = "yarn"
	InstallMethodBun       InstallMethod = "bun"
	InstallMethodUnknown   InstallMethod = "unknown"
)
View Source
const (
	EnvExperimental       = "GI_EXPERIMENTAL"
	LegacyEnvExperimental = "PI_EXPERIMENTAL"
)
View Source
const (
	OSC133ZoneStart = "\x1b]133;A\x07"
	OSC133ZoneEnd   = "\x1b]133;B\x07"
	OSC133ZoneFinal = "\x1b]133;C\x07"
	TerminalBGReset = "\x1b[49m"
)
View Source
const (
	RPCCommandPrompt                     = "prompt"
	RPCCommandSteer                      = "steer"
	RPCCommandFollowUp                   = "follow_up"
	RPCCommandAbort                      = "abort"
	RPCCommandNewSession                 = "new_session"
	RPCCommandGetState                   = "get_state"
	RPCCommandSetModel                   = "set_model"
	RPCCommandCycleModel                 = "cycle_model"
	RPCCommandSetThinkingLevel           = "set_thinking_level"
	RPCCommandCycleThinkingLevel         = "cycle_thinking_level"
	RPCCommandGetAvailableThinkingLevels = "get_available_thinking_levels"
	RPCCommandGetAvailableModels         = "get_available_models"
	RPCCommandSetSteeringMode            = "set_steering_mode"
	RPCCommandSetFollowUpMode            = "set_follow_up_mode"
	RPCCommandCompact                    = "compact"
	RPCCommandSetAutoCompaction          = "set_auto_compaction"
	RPCCommandSetAutoRetry               = "set_auto_retry"
	RPCCommandAbortRetry                 = "abort_retry"
	RPCCommandBash                       = "bash"
	RPCCommandAbortBash                  = "abort_bash"
	RPCCommandGetSessionStats            = "get_session_stats"
	RPCCommandExportHTML                 = "export_html"
	RPCCommandSwitchSession              = "switch_session"
	RPCCommandFork                       = "fork"
	RPCCommandGetForkMessages            = "get_fork_messages"
	RPCCommandGetEntries                 = "get_entries"
	RPCCommandGetTree                    = "get_tree"
	RPCCommandGetLastAssistantText       = "get_last_assistant_text"
	RPCCommandSetSessionName             = "set_session_name"
	RPCCommandGetMessages                = "get_messages"
	RPCCommandGetCommands                = "get_commands"
)
View Source
const (
	FauxProvider = "faux"
	FauxModelID  = "faux-1"
	FauxAPI      = "anthropic-messages"
)
View Source
const AnthropicSubscriptionAuthWarning = authwarning.AnthropicSubscriptionAuthWarning
View Source
const (
	// CacheTTL is Anthropic's default prompt-cache TTL. It is presentation
	// context for callers; cache accounting itself remains provider-neutral.
	CacheTTL = 5 * time.Minute
)
View Source
const CapabilityBashIntercept = "bash.intercept"
View Source
const CapabilityCommandsRegister = "commands.register"
View Source
const CapabilityInputEvents = "input.events"
View Source
const CapabilityLifecycleEvents = "lifecycle.events"
View Source
const CapabilityProvidersRegister = "providers.register"
View Source
const CapabilityResourcesDiscover = "resources.discover"
View Source
const CapabilityShortcutsRegister = "shortcuts.register"
View Source
const CapabilitySystemPromptModify = "system_prompt.modify"
View Source
const CapabilityTUIAutocomplete = "tui.autocomplete"
View Source
const CapabilityTUIEditor = "tui.editor"
View Source
const CapabilityTUIFooter = "tui.footer"
View Source
const CapabilityTUIHeader = "tui.header"
View Source
const CapabilityTUIMessageRenderer = "tui.message_renderer"
View Source
const CapabilityTUIOverlay = "tui.overlay"
View Source
const CapabilityTUITerminalInput = "tui.terminal_input"
View Source
const CapabilityTUITheme = "tui.theme"
View Source
const CapabilityTUIToolRenderer = "tui.tool_renderer"
View Source
const CapabilityTUIToolsExpanded = "tui.tools_expanded"
View Source
const CapabilityTUIWidget = "tui.widget"
View Source
const CapabilityToolsRegister = "tools.register"
View Source
const ConfigDirName = ".gi"
View Source
const (
	CurrentSessionVersion = 3
)
View Source
const ExportHTMLTemplateCSS = `` /* 10094-byte string literal not displayed */
View Source
const ExportHTMLTemplateJS = `` /* 47459-byte string literal not displayed */
View Source
const FSWatchRetryDelay = fswatch.FSWatchRetryDelay
View Source
const LatestGiVersionURL = versioncheck.LatestGiVersionURL
View Source
const LatestPiVersionURL = versioncheck.LatestPiVersionURL
View Source
const RPCCommandClone = "clone"
View Source
const RadiusProviderID = "radius"

RadiusProviderID is the built-in Radius provider identifier used by models.json OAuth composition.

Variables

View Source
var (
	// ErrRPCProcessNotStarted reports a command sent without an active process.
	ErrRPCProcessNotStarted = errors.New("RPC process not started")
	// ErrRPCProcessStopped reports a command interrupted by explicit shutdown.
	ErrRPCProcessStopped = errors.New("RPC process stopped")
)
View Source
var DefaultModelPerProvider = modelresolver.DefaultModelPerProvider
View Source
var ErrAuthStorageLockCompromised = errors.New("auth storage lock was compromised")
View Source
var FauxModel = llm.Model{
	ID:            FauxModelID,
	Name:          "Faux Model",
	API:           FauxAPI,
	Provider:      FauxProvider,
	BaseURL:       "http://localhost:0",
	Reasoning:     false,
	Input:         []string{"text", "image"},
	ContextWindow: 128000,
	MaxTokens:     16384,
}

Functions

func AnsiLinesToHTML

func AnsiLinesToHTML(lines []string) string

func ApplyHTTPProxySettings added in v0.82.0

func ApplyHTTPProxySettings(httpProxy string) error

ApplyHTTPProxySettings projects the global httpProxy setting into the conventional process environment without replacing caller-owned values.

func AreExperimentalFeaturesEnabled added in v0.82.0

func AreExperimentalFeaturesEnabled() bool

AreExperimentalFeaturesEnabled keeps experimental behavior opt-in. Gi's environment name takes precedence while the Pi name remains available for compatibility during migration.

func AttachJSONLLineReader

func AttachJSONLLineReader(reader io.Reader, onLine func(string)) error

func BuildSDKStreamHeaders

func BuildSDKStreamHeaders(model llm.Model, installTelemetryEnabled bool, providerHeaders, requestHeaders map[string]string) map[string]string

func BuildSystemPrompt

func BuildSystemPrompt(options BuildSystemPromptOptions) string

func CanonicalizePath

func CanonicalizePath(path string) string

func CheckForNewGiVersion

func CheckForNewGiVersion(currentVersion string, options VersionCheckOptions) (string, bool)

func CheckForNewPiVersion

func CheckForNewPiVersion(currentVersion string, options VersionCheckOptions) (string, bool)

func CheckTmuxKeyboardSetup

func CheckTmuxKeyboardSetup(ctx context.Context, reader TmuxOptionReader) string

func CleanPlanStepText

func CleanPlanStepText(text string) string

func ClearAPIKeyCache

func ClearAPIKeyCache()

func ClearConfigValueCache

func ClearConfigValueCache()

ClearConfigValueCache clears cached command successes and failures.

func CloseWatcher

func CloseWatcher(watcher FSWatcher)

func ComparePackageVersions

func ComparePackageVersions(leftVersion, rightVersion string) (int, bool)

func ConfigValueEnvVarName added in v0.82.0

func ConfigValueEnvVarName(config string) (string, bool)

ConfigValueEnvVarName returns the environment variable name when config is exactly one $NAME or ${NAME} reference.

func ConfigValueEnvVarNames added in v0.82.0

func ConfigValueEnvVarNames(config string) []string

ConfigValueEnvVarNames returns referenced environment variables in first-use order with duplicates removed.

func ConvertImageBytesToPNG added in v0.82.0

func ConvertImageBytesToPNG(data []byte) ([]byte, bool)

func CopyToClipboard

func CopyToClipboard(text string, options ClipboardCopyOptions) error

func CreateAgentSessionRuntime

func CreateAgentSessionRuntime(factory CreateAgentSessionRuntimeFactory, options AgentSessionRuntimeOptions) (any, error)

func DefaultAgentSessionBranchSummarizer

func DefaultAgentSessionBranchSummarizer(entries []FileEntry, customInstructions string, abort <-chan struct{}) (string, error)

func DefaultAgentSessionCompactionSummarizer

func DefaultAgentSessionCompactionSummarizer(preparation agentharness.CompactionPreparation, customInstructions string) (agentharness.CompactionResult, error)

func DefaultAgentSessionResponder

func DefaultAgentSessionResponder(prompt string, context []llm.Message, model llm.Model) (llm.Message, error)

func DefaultClipboardPasteImageKey

func DefaultClipboardPasteImageKey() string

func DefaultSessionExportHTMLName

func DefaultSessionExportHTMLName(inputPath string) string

func DefaultTmuxOptionReader

func DefaultTmuxOptionReader(ctx context.Context, option string) (string, bool)

func ExpandPath

func ExpandPath(path string) string

func ExpandPromptTemplate

func ExpandPromptTemplate(text string, templates []PromptTemplate) string

func ExpandTildePath

func ExpandTildePath(path string) string

func ExportHTMLTemplateCSSWithOptions

func ExportHTMLTemplateCSSWithOptions(options ExportHTMLOptions) string

func ExportSessionFileToHTML

func ExportSessionFileToHTML(inputPath, outputPath string) (string, error)

func ExportSessionFileToHTMLWithOptions

func ExportSessionFileToHTMLWithOptions(inputPath, outputPath string, options ExportHTMLOptions) (string, error)

func ExtensionForImageMIMEType

func ExtensionForImageMIMEType(mimeType string) string

func ExtractDoneSteps

func ExtractDoneSteps(message string) []int

func FindExactModelReferenceMatch

func FindExactModelReferenceMatch(modelReference string, availableModels []llm.Model) *llm.Model

func FindMostRecentSession

func FindMostRecentSession(sessionDir string, cwd ...string) string

func FormatCWDForFooter added in v0.82.0

func FormatCWDForFooter(cwd, home string) string

FormatCWDForFooter replaces home with ~ only when cwd is home itself or a descendant. Both inputs are resolved before comparison so sibling prefixes such as "/home/me-other" are never shortened.

func FormatDimensionNote

func FormatDimensionNote(result ResizedImage) string

func GetAgentDir

func GetAgentDir(cwd ...string) string

func GetAgentDirSessionDir

func GetAgentDirSessionDir(cwd, agentDir string) string

func GetAttributionHeaders

func GetAttributionHeaders(model llm.Model, installTelemetryEnabled bool) map[string]string

func GetAuthPath

func GetAuthPath(agentDir ...string) string

func GetBinDir

func GetBinDir(agentDir ...string) string

func GetBundledInteractiveAssetPath

func GetBundledInteractiveAssetPath(name string, envs ...InstallEnvironment) string

func GetChangelogPath

func GetChangelogPath(envs ...InstallEnvironment) string

func GetCustomThemesDir

func GetCustomThemesDir(agentDir ...string) string

func GetCwdRelativePath

func GetCwdRelativePath(path, cwd string) (string, bool)

func GetDebugLogPath

func GetDebugLogPath(agentDir ...string) string

func GetDefaultSessionDir

func GetDefaultSessionDir(cwd string) (string, error)

func GetDefaultSessionDirPath added in v0.82.0

func GetDefaultSessionDirPath(cwd string) (string, error)

GetDefaultSessionDirPath computes the session directory without creating it.

func GetDocsPath

func GetDocsPath(envs ...InstallEnvironment) string

func GetExamplesPath

func GetExamplesPath(envs ...InstallEnvironment) string

func GetExportTemplateDir

func GetExportTemplateDir(envs ...InstallEnvironment) string

func GetExtensionTempFolder added in v0.82.0

func GetExtensionTempFolder(agentDir string) (string, error)

GetExtensionTempFolder returns the private cache root used for temporary extension checkouts. Existing directories are tightened on every access.

func GetGiUserAgent

func GetGiUserAgent(version string) string

func GetInteractiveAssetsDir

func GetInteractiveAssetsDir(envs ...InstallEnvironment) string

func GetLatestGiVersion

func GetLatestGiVersion(currentVersion string, options VersionCheckOptions) (string, bool)

func GetLatestPiVersion

func GetLatestPiVersion(currentVersion string, options VersionCheckOptions) (string, bool)

func GetModelsPath

func GetModelsPath(agentDir ...string) string

func GetPackageDir

func GetPackageDir(envs ...InstallEnvironment) string

func GetPackageJSONPath

func GetPackageJSONPath(envs ...InstallEnvironment) string

func GetPackageJsonPath

func GetPackageJsonPath(envs ...InstallEnvironment) string

func GetPathCommandArgument

func GetPathCommandArgument(text, command string) (string, bool)

func GetPiUserAgent

func GetPiUserAgent(version string) string

func GetProjectTrustParentPath added in v0.82.0

func GetProjectTrustParentPath(cwd string) string

func GetPromptsDir

func GetPromptsDir(agentDir ...string) string

func GetReadmePath

func GetReadmePath(envs ...InstallEnvironment) string

func GetResolvedThemeCSSColors

func GetResolvedThemeCSSColors(themeName, agentDir string) (map[string]string, error)

func GetSelfUpdateUnavailableInstruction

func GetSelfUpdateUnavailableInstruction(packageName string, env InstallEnvironment, _ []string, updatePackageName string) string

func GetSelfUpdateUnavailableInstructionForTarget added in v0.82.0

func GetSelfUpdateUnavailableInstructionForTarget(packageName string, env InstallEnvironment, target SelfUpdatePackageTarget) string

GetSelfUpdateUnavailableInstructionForTarget describes the safe manual update path without collapsing an exact install spec into its package name.

func GetSessionsDir

func GetSessionsDir(agentDir ...string) string

func GetSettingsPath

func GetSettingsPath(agentDir ...string) string

func GetShareViewerURL

func GetShareViewerURL(gistID string) string

func GetThemesDir

func GetThemesDir(envs ...InstallEnvironment) string

func GetToolsDir

func GetToolsDir(agentDir ...string) string

func GetUpdateInstruction

func GetUpdateInstruction(packageName string, env InstallEnvironment) string

func HasSessionName

func HasSessionName(session SessionInfo) bool

func HasTrustRequiringProjectResources added in v0.82.0

func HasTrustRequiringProjectResources(cwd string) bool

func Highlight

func Highlight(code string, options HighlightOptions) string

func IsAPIKeyLoginProvider

func IsAPIKeyLoginProvider(providerID string, oauthProviderIDs, builtInProviderIDs map[string]bool) bool

func IsAliasModelID

func IsAliasModelID(id string) bool

func IsAnthropicSubscriptionAuthKey

func IsAnthropicSubscriptionAuthKey(apiKey string) bool

func IsCommandConfigValue added in v0.82.0

func IsCommandConfigValue(config string) bool

IsCommandConfigValue reports whether config requests shell command execution.

func IsConfigValueConfigured added in v0.82.0

func IsConfigValueConfigured(config string, env llm.ProviderEnv) bool

IsConfigValueConfigured reports whether all environment references required by config are available. Commands and literals are considered configured without executing them.

func IsInstallTelemetryEnabled

func IsInstallTelemetryEnabled(settingsManager *SettingsManager) bool

func IsLocalPath

func IsLocalPath(value string) bool

func IsNewerPackageVersion

func IsNewerPackageVersion(candidateVersion, currentVersion string) bool

func IsOfficialDistribution added in v0.82.0

func IsOfficialDistribution(metadata DistributionMetadata) bool

func IsSafePlanCommand

func IsSafePlanCommand(command string) bool

func IsValidThinkingLevel

func IsValidThinkingLevel(level string) bool

func IsWaylandSession

func IsWaylandSession(env map[string]string) bool

func LoadProtocolExtensionDescriptors

func LoadProtocolExtensionDescriptors(sources []ProtocolExtensionSource, runtime *ProtocolExtensionRuntime) protocolExtensionDescriptorLoadResult

func MarkCompletedPlanSteps

func MarkCompletedPlanSteps(message string, items []PlanTodoItem) int

func MarkPathIgnoredByCloudSync added in v0.82.0

func MarkPathIgnoredByCloudSync(path string)

func MergeProviderAttributionHeaders added in v0.82.0

func MergeProviderAttributionHeaders(
	model llm.Model,
	context ProviderAttributionContext,
	headerSources ...map[string]string,
) map[string]string

func MigrateKeybindingsConfig

func MigrateKeybindingsConfig(rawConfig map[string]any) (map[string]any, bool)

func MigrateSessionEntries

func MigrateSessionEntries(entries []FileEntry) bool

func MissingConfigValueEnvVarNames added in v0.82.0

func MissingConfigValueEnvVarNames(config string, env llm.ProviderEnv) []string

MissingConfigValueEnvVarNames reports template variables that cannot be resolved. Provider-scoped values take precedence over process environment.

func OfficialPackageNames

func OfficialPackageNames() []string

func PackageSourceIdentity

func PackageSourceIdentity(source PackageSource) string

func ParseCommandArgs

func ParseCommandArgs(argsString string) []string

func PreRenderExportHTMLCustomTools

func PreRenderExportHTMLCustomTools(entries []FileEntry, renderer ExportHTMLToolRenderer) map[string]ExportHTMLRenderedTool

func PrepareEditToolArguments

func PrepareEditToolArguments(args any) any

func PrepareReadToolArguments

func PrepareReadToolArguments(args any) any

func PrepareWriteToolArguments

func PrepareWriteToolArguments(args any) any

func ReadClipboardText added in v0.82.0

func ReadClipboardText(
	ctx context.Context,
	options ClipboardTextReadOptions,
) (string, bool)

func RegisterOAuthProvider

func RegisterOAuthProvider(provider OAuthProvider)

func RenderCustomToolResultHTML

func RenderCustomToolResultHTML(lines []string) string

func RenderDiff

func RenderDiff(diffText string) string

func RenderExportHTMLHeaderModels

func RenderExportHTMLHeaderModels(models []string) string

func RenderExportHTMLInlineImage

func RenderExportHTMLInlineImage(mimeType, data string) string

func RenderExportHTMLMarkdownImage

func RenderExportHTMLMarkdownImage(src, alt string) string
func RenderExportHTMLMarkdownLink(href, text string) string

func RenderExportHTMLSessionEntryAttrs

func RenderExportHTMLSessionEntryAttrs(entryID string) string

func RenderExportHTMLTreeMetadata

func RenderExportHTMLTreeMetadata(values map[string]string) string

func RenderExportHTMLUserMessage

func RenderExportHTMLUserMessage(text string) string

func RenderHighlightedHTML

func RenderHighlightedHTML(input string, theme HighlightTheme) string

func RenderSessionManagerHTML

func RenderSessionManagerHTML(sessionManager *SessionManager) string

func RenderSessionManagerHTMLWithOptions

func RenderSessionManagerHTMLWithOptions(sessionManager *SessionManager, options ExportHTMLOptions) string

func RenderViewTree

func RenderViewTree(view ViewTreeNode, width int) []string

func ResetOAuthProviders

func ResetOAuthProviders()

func ResolveConfigHeaders added in v0.82.0

func ResolveConfigHeaders(headers map[string]string, env llm.ProviderEnv) map[string]string

ResolveConfigHeaders resolves header values and omits unresolved or empty entries.

func ResolveConfigHeadersOrError added in v0.82.0

func ResolveConfigHeadersOrError(
	headers map[string]string,
	description string,
	env llm.ProviderEnv,
) (map[string]string, error)

ResolveConfigHeadersOrError resolves every header or returns a contextual error for the first unresolved value.

func ResolveConfigValue

func ResolveConfigValue(config string) (string, bool)

ResolveConfigValue resolves config with process environment and caches shell command results for the process lifetime.

func ResolveConfigValueOrError added in v0.82.0

func ResolveConfigValueOrError(config, description string, env llm.ProviderEnv) (string, error)

ResolveConfigValueOrError resolves a config value and describes the missing command or environment dependency when resolution fails.

func ResolveConfigValueUncached

func ResolveConfigValueUncached(config string) (string, bool)

ResolveConfigValueUncached resolves config without caching shell command results.

func ResolveConfigValueUncachedWithEnv added in v0.82.0

func ResolveConfigValueUncachedWithEnv(config string, env llm.ProviderEnv) (string, bool)

ResolveConfigValueUncachedWithEnv is ResolveConfigValueWithEnv without the process-lifetime command cache.

func ResolveConfigValueWithEnv added in v0.82.0

func ResolveConfigValueWithEnv(config string, env llm.ProviderEnv) (string, bool)

ResolveConfigValueWithEnv resolves commands, explicit environment templates, escapes, and literals. Credential-scoped env values take precedence over process environment. Bare names are literals; environment references require $NAME or ${NAME} syntax.

func ResolveProjectTrusted added in v0.82.0

func ResolveProjectTrusted(options ResolveProjectTrustOptions) (bool, error)

func ResolveReadPath

func ResolveReadPath(path, cwd string) (string, error)

func ResolveThemeSetting added in v0.82.0

func ResolveThemeSetting(themeSetting string, terminalTheme TerminalTheme) (string, bool)

ResolveThemeSetting projects a fixed or automatic setting to the concrete theme name for the current terminal appearance. Malformed automatic values are rejected instead of being treated as file names.

func ResolveToCwd

func ResolveToCwd(path, cwd string) string

func RestoreProcessSandboxEnv

func RestoreProcessSandboxEnv(isBun bool) bool

func RestoreSandboxEnv

func RestoreSandboxEnv(isBun bool, env map[string]string, readEnviron SandboxEnvReader) bool

func RunCLI

func RunCLI(options CLIOptions) int

func RunMigrations

func RunMigrations(agentDir string, cwd ...string) error

func RunPrintMode

func RunPrintMode(host PrintModeRuntimeHost, options PrintModeOptions) (exitCode int)

func SerializeJSONLine

func SerializeJSONLine(record any) (string, error)

func SessionEntryToContextMessages added in v0.82.0

func SessionEntryToContextMessages(entry FileEntry) []llm.Message

SessionEntryToContextMessages converts one selected session entry into the canonical message representation consumed by the agent and TUI.

func ShouldRunFirstTimeSetup added in v0.82.0

func ShouldRunFirstTimeSetup(settingsPaths ...string) bool

ShouldRunFirstTimeSetup discovers only the four facts needed by the setup policy, then evaluates the immutable result. An optional path makes the function deterministic in callers and tests while retaining the default settings path used by the CLI.

func ShowFirstTimeSetup added in v0.82.0

func ShowFirstTimeSetup(
	ctx context.Context,
	settings *SettingsManager,
	options FirstTimeSetupRunnerOptions,
) error

ShowFirstTimeSetup owns the complete startup interaction lifecycle. The component emits one result, and only this coordinator mutates settings.

func StripAnsi

func StripAnsi(value string) string

func StripFrontmatter

func StripFrontmatter(content string) string

func SubstituteArgs

func SubstituteArgs(content string, args []string) string

func SupportsLanguage

func SupportsLanguage(language string) bool

func TUIThemeSchemaJSON

func TUIThemeSchemaJSON() []byte

TUIThemeSchemaJSON returns Gi's Pi-compatible TUI theme JSON schema.

func UnregisterOAuthProvider

func UnregisterOAuthProvider(providerID string)

func ValidateSessionID added in v0.82.0

func ValidateSessionID(id string) error

ValidateSessionID applies the portable filename contract used by Pi.

func ValidateViewTreeNode

func ValidateViewTreeNode(node ViewTreeNode) error

func WithFileMutationQueue

func WithFileMutationQueue(filePath string, fn func() error) error

func WriteCLIUsage

func WriteCLIUsage(writer io.Writer, extensionFlags ...ProtocolFlagRegistration)

func WriteListModels

func WriteListModels(stdout, stderr io.Writer, registry listModelsRegistry, searchPattern string) error

Types

type AgentContextUsage

type AgentContextUsage struct {
	Tokens        *int     `json:"tokens"`
	ContextWindow int      `json:"contextWindow"`
	Percent       *float64 `json:"percent"`
}

type AgentSession

type AgentSession struct {
	SessionManager       *SessionManager
	SettingsManager      *SettingsManager
	ResourceLoader       AgentSessionResourceLoader
	BaseSystemPrompt     string
	SystemPrompt         string
	Agent                *SDKAgent
	CompactionSettings   agentharness.CompactionSettings
	CompactionSummarizer AgentSessionCompactionSummarizer
	BranchSummarizer     AgentSessionBranchSummarizer
	RetrySettings        AgentSessionRetrySettings
	AutoCompactionRunner AgentSessionAutoCompactionRunner
	AgentContinue        func() error
	Responder            AgentSessionResponder
	StreamResponder      AgentSessionStreamResponder
	ModelRuntime         *ModelRuntime
	SummaryRuntime       agentharness.SimpleCompletionRuntime
	Preflight            AgentSessionPreflight
	ExtensionRuntime     *ProtocolExtensionRuntime
	DynamicTools         []SDKTool
	ScopedModels         []ScopedModel
	Tools                []string
	ToolsSet             bool
	NoTools              string
	SteeringMode         string
	FollowUpMode         string
	// contains filtered or unexported fields
}

func CreateAgentSession

func CreateAgentSession(options AgentSessionOptions) (*AgentSession, error)

func (*AgentSession) Abort

func (s *AgentSession) Abort() error

func (*AgentSession) AbortBash

func (s *AgentSession) AbortBash()

func (*AgentSession) AbortBranchSummary

func (s *AgentSession) AbortBranchSummary()

func (*AgentSession) AbortCompaction

func (s *AgentSession) AbortCompaction()

func (*AgentSession) AbortRetry

func (s *AgentSession) AbortRetry()

func (*AgentSession) AppendCustomEntry added in v0.82.0

func (s *AgentSession) AppendCustomEntry(
	customType string,
	data any,
) (string, error)

AppendCustomEntry persists the entry before publishing its presentation event. Consumers therefore never observe an entry that is absent from the append-only session tree.

func (*AgentSession) CheckCompaction

func (s *AgentSession) CheckCompaction(assistantMessage llm.Message, skipAbortedCheck ...bool) error

func (*AgentSession) ClearQueue

func (s *AgentSession) ClearQueue() (steering, followUp []string)

func (*AgentSession) Compact

func (s *AgentSession) Compact(customInstructions ...string) (agentharness.CompactionResult, error)

func (*AgentSession) Dispose

func (s *AgentSession) Dispose()

func (*AgentSession) ExecuteBash

func (s *AgentSession) ExecuteBash(command string, options ...AgentSessionBashOptions) (BashResult, error)

func (*AgentSession) FollowUp

func (s *AgentSession) FollowUp(text string) error

func (*AgentSession) FollowUpWithImages

func (s *AgentSession) FollowUpWithImages(text string, images []llm.ContentPart) error

func (*AgentSession) Fork

func (s *AgentSession) Fork(entryID string) (AgentSessionForkResult, error)

func (*AgentSession) ForkAt

func (s *AgentSession) ForkAt(entryID string) (AgentSessionForkResult, error)

func (*AgentSession) GetActiveLLMTools

func (s *AgentSession) GetActiveLLMTools() []llm.Tool

func (*AgentSession) GetActiveToolNames

func (s *AgentSession) GetActiveToolNames() []string

func (*AgentSession) GetActiveTools

func (s *AgentSession) GetActiveTools() []SDKTool

func (*AgentSession) GetAllTools

func (s *AgentSession) GetAllTools() []SDKTool

func (*AgentSession) GetContextUsage

func (s *AgentSession) GetContextUsage() *AgentContextUsage

func (*AgentSession) GetFollowUpMessages

func (s *AgentSession) GetFollowUpMessages() []string

func (*AgentSession) GetFollowUpQueue

func (s *AgentSession) GetFollowUpQueue() []QueuedUserMessage

func (*AgentSession) GetSessionStats

func (s *AgentSession) GetSessionStats() AgentSessionStats

func (*AgentSession) GetSteeringMessages

func (s *AgentSession) GetSteeringMessages() []string

func (*AgentSession) GetSteeringQueue

func (s *AgentSession) GetSteeringQueue() []QueuedUserMessage

func (*AgentSession) GetUserMessagesForForking

func (s *AgentSession) GetUserMessagesForForking() []AgentSessionForkMessage

func (*AgentSession) HasAgentQueuedMessages

func (s *AgentSession) HasAgentQueuedMessages() bool

func (*AgentSession) HasPendingBashMessages

func (s *AgentSession) HasPendingBashMessages() bool

func (*AgentSession) IsBashRunning

func (s *AgentSession) IsBashRunning() bool

func (*AgentSession) IsBranchSummaryRunning

func (s *AgentSession) IsBranchSummaryRunning() bool

func (*AgentSession) IsCompacting

func (s *AgentSession) IsCompacting() bool

func (*AgentSession) IsIdle added in v0.82.0

func (s *AgentSession) IsIdle() bool

func (*AgentSession) IsRetrying

func (s *AgentSession) IsRetrying() bool

func (*AgentSession) IsStreaming

func (s *AgentSession) IsStreaming() bool

func (*AgentSession) Messages

func (s *AgentSession) Messages() []llm.Message

func (*AgentSession) NavigateTree

func (*AgentSession) PendingMessageCount

func (s *AgentSession) PendingMessageCount() int

func (*AgentSession) Prompt

func (s *AgentSession) Prompt(text string) error

func (*AgentSession) PromptWithImages

func (s *AgentSession) PromptWithImages(text string, images []llm.ContentPart) error

func (*AgentSession) QueueAgentMessage

func (s *AgentSession) QueueAgentMessage(message llm.Message)

func (*AgentSession) QueueExtensionUserMessage

func (s *AgentSession) QueueExtensionUserMessage(text, deliverAs string) error

func (*AgentSession) RecordBashResult

func (s *AgentSession) RecordBashResult(command string, result BashResult, options ...AgentSessionBashRecordOptions)

func (*AgentSession) RefreshSystemPrompt

func (s *AgentSession) RefreshSystemPrompt()

func (*AgentSession) RunAutoCompaction

func (s *AgentSession) RunAutoCompaction(reason string, willRetry bool) error

func (*AgentSession) SendCustomMessage

func (s *AgentSession) SendCustomMessage(message QueuedCustomMessage, options ProtocolSendCustomMessageOptions) (returnErr error)

func (*AgentSession) SetScopedModels

func (s *AgentSession) SetScopedModels(scopedModels []ScopedModel)

func (*AgentSession) SetSessionName

func (s *AgentSession) SetSessionName(name string) error

func (*AgentSession) Steer

func (s *AgentSession) Steer(text string) error

func (*AgentSession) SteerWithImages

func (s *AgentSession) SteerWithImages(text string, images []llm.ContentPart) error

func (*AgentSession) Subscribe

func (s *AgentSession) Subscribe(listener AgentSessionEventListener) func()

func (*AgentSession) SyncRuntimeSettings added in v0.82.0

func (s *AgentSession) SyncRuntimeSettings()

SyncRuntimeSettings refreshes the settings that affect AgentSession control flow. The SettingsManager remains the durable/live owner; AgentSession keeps only the per-run snapshot needed to make deterministic decisions.

func (*AgentSession) WaitForIdle added in v0.82.0

func (s *AgentSession) WaitForIdle(ctx context.Context) error

type AgentSessionAutoCompactionRunner

type AgentSessionAutoCompactionRunner func(reason string, willRetry bool) error

type AgentSessionBashOptions

type AgentSessionBashOptions struct {
	OnChunk            func(string)
	ExcludeFromContext bool
	Operations         BashOperations
	Context            context.Context
}

type AgentSessionBashRecordOptions

type AgentSessionBashRecordOptions struct {
	ExcludeFromContext bool
}

type AgentSessionBranchSummarizer

type AgentSessionBranchSummarizer func(entries []FileEntry, customInstructions string, abort <-chan struct{}) (string, error)

type AgentSessionCompactionSummarizer

type AgentSessionCompactionSummarizer func(preparation agentharness.CompactionPreparation, customInstructions string) (agentharness.CompactionResult, error)

type AgentSessionContextResourceLoader

type AgentSessionContextResourceLoader interface {
	GetAgentsFiles() ResourceAgentsFilesResult
}

type AgentSessionEvent

type AgentSessionEvent struct {
	Type                  string                         `json:"type"`
	Source                string                         `json:"source,omitempty"`
	Reason                string                         `json:"reason,omitempty"`
	Result                *agentharness.CompactionResult `json:"result,omitempty"`
	Aborted               bool                           `json:"aborted,omitempty"`
	WillRetry             bool                           `json:"willRetry,omitempty"`
	ErrorMessage          string                         `json:"errorMessage,omitempty"`
	Message               *llm.Message                   `json:"message,omitempty"`
	Attempt               int                            `json:"attempt,omitempty"`
	MaxAttempts           int                            `json:"maxAttempts,omitempty"`
	DelayMs               int                            `json:"delayMs,omitempty"`
	Success               bool                           `json:"success,omitempty"`
	FinalError            string                         `json:"finalError,omitempty"`
	Steering              []string                       `json:"steering,omitempty"`
	FollowUp              []string                       `json:"followUp,omitempty"`
	Messages              []llm.Message                  `json:"messages,omitempty"`
	AssistantMessageEvent *llm.AssistantMessageEvent     `json:"assistantMessageEvent,omitempty"`
	ToolCallID            string                         `json:"toolCallId,omitempty"`
	ToolName              string                         `json:"toolName,omitempty"`
	Args                  map[string]any                 `json:"args,omitempty"`
	ToolResult            *llm.Message                   `json:"toolResult,omitempty"`
	PartialToolResult     *llm.Message                   `json:"partialToolResult,omitempty"`
	Name                  string                         `json:"name,omitempty"`
	Entry                 *FileEntry                     `json:"entry,omitempty"`
}

type AgentSessionEventListener

type AgentSessionEventListener func(AgentSessionEvent)

type AgentSessionForkMessage

type AgentSessionForkMessage struct {
	EntryID string `json:"entryId"`
	Text    string `json:"text"`
}

type AgentSessionForkResult

type AgentSessionForkResult struct {
	Cancelled    bool
	SelectedText string
	Session      *AgentSession
}

type AgentSessionNavigateTreeOptions

type AgentSessionNavigateTreeOptions struct {
	Summarize          bool
	CustomInstructions string
}

type AgentSessionNavigateTreeResult

type AgentSessionNavigateTreeResult struct {
	Cancelled    bool
	Aborted      bool
	EditorText   string
	SummaryEntry *FileEntry
}

type AgentSessionOptions

type AgentSessionOptions struct {
	CWD                  string
	AgentDir             string
	Model                llm.Model
	ThinkingLevel        string
	Preflight            AgentSessionPreflight
	SettingsManager      *SettingsManager
	SessionManager       *SessionManager
	ResourceLoader       AgentSessionResourceLoader
	CompactionSettings   *agentharness.CompactionSettings
	CompactionSummarizer AgentSessionCompactionSummarizer
	BranchSummarizer     AgentSessionBranchSummarizer
	RetrySettings        *AgentSessionRetrySettings
	AutoCompactionRunner AgentSessionAutoCompactionRunner
	AgentContinue        func() error
	Responder            AgentSessionResponder
	StreamResponder      AgentSessionStreamResponder
	ModelRuntime         *ModelRuntime
	SummaryRuntime       agentharness.SimpleCompletionRuntime
	CustomTools          []SDKTool
	ScopedModels         []ScopedModel
	Tools                []string
	ToolsSet             bool
	NoTools              string
}

type AgentSessionPreflight

type AgentSessionPreflight func(model llm.Model) error

type AgentSessionPromptResourceLoader

type AgentSessionPromptResourceLoader interface {
	GetPrompts() ResourcePromptsResult
}

type AgentSessionResourceLoader

type AgentSessionResourceLoader interface {
	GetSkills() AgentSessionSkillsResult
}

type AgentSessionResponder

type AgentSessionResponder func(prompt string, context []llm.Message, model llm.Model) (llm.Message, error)

type AgentSessionRetrySettings

type AgentSessionRetrySettings struct {
	Enabled     bool
	MaxRetries  int
	BaseDelayMs int
}

func DefaultAgentSessionRetrySettings

func DefaultAgentSessionRetrySettings() AgentSessionRetrySettings

type AgentSessionRuntimeEventListener

type AgentSessionRuntimeEventListener func(ProtocolSessionEvent) error

type AgentSessionRuntimeForkOptions

type AgentSessionRuntimeForkOptions struct {
	Position    string
	WithSession func(ProtocolCommandContext) error
}

type AgentSessionRuntimeHost

type AgentSessionRuntimeHost struct {
	Session                 *AgentSession
	ExtensionRuntime        *ProtocolExtensionRuntime
	BeforeSessionInvalidate func()
	RebindSession           func(*AgentSession) error
	// contains filtered or unexported fields
}

func NewAgentSessionRuntimeHost

func NewAgentSessionRuntimeHost(session *AgentSession, extensionRuntime *ProtocolExtensionRuntime) (*AgentSessionRuntimeHost, error)

func (*AgentSessionRuntimeHost) Fork

func (*AgentSessionRuntimeHost) NewSession

func (*AgentSessionRuntimeHost) OnSessionEvent

func (h *AgentSessionRuntimeHost) OnSessionEvent(listener AgentSessionRuntimeEventListener) func()

func (*AgentSessionRuntimeHost) Reload

func (h *AgentSessionRuntimeHost) Reload() error

func (*AgentSessionRuntimeHost) SetBeforeSessionInvalidate

func (h *AgentSessionRuntimeHost) SetBeforeSessionInvalidate(callback func())

func (*AgentSessionRuntimeHost) SetExtensionRuntime

func (h *AgentSessionRuntimeHost) SetExtensionRuntime(extensionRuntime *ProtocolExtensionRuntime)

func (*AgentSessionRuntimeHost) SetRebindSession

func (h *AgentSessionRuntimeHost) SetRebindSession(callback func(*AgentSession) error)

func (*AgentSessionRuntimeHost) SwitchSession

type AgentSessionRuntimeOptions

type AgentSessionRuntimeOptions struct {
	CWD            string
	AgentDir       string
	SessionManager *SessionManager
}

type AgentSessionRuntimeSwitchResult

type AgentSessionRuntimeSwitchResult struct {
	Cancelled bool `json:"cancelled"`
}

type AgentSessionSkillsResult

type AgentSessionSkillsResult struct {
	Skills      []agentharness.Skill
	Diagnostics []agentharness.SkillDiagnostic
}

type AgentSessionStats

type AgentSessionStats struct {
	SessionFile        string                    `json:"sessionFile,omitempty"`
	SessionID          string                    `json:"sessionId"`
	UserMessages       int                       `json:"userMessages"`
	AssistantMessages  int                       `json:"assistantMessages"`
	ToolCalls          int                       `json:"toolCalls"`
	ToolResults        int                       `json:"toolResults"`
	TotalMessages      int                       `json:"totalMessages"`
	Tokens             llm.Usage                 `json:"tokens"`
	ContextUsage       *AgentContextUsage        `json:"contextUsage,omitempty"`
	UsageBreakdown     []UsageCostBreakdownEntry `json:"usageBreakdown,omitempty"`
	CacheWaste         CacheWasteTotals          `json:"cacheWaste"`
	LatestCacheHitRate *float64                  `json:"latestCacheHitRate,omitempty"`
}

type AgentSessionStreamResponder

type AgentSessionStreamResponder func(prompt string, context []llm.Message, model llm.Model) (*llm.AssistantMessageEventStream, error)

type AgentSessionSystemPromptResourceLoader

type AgentSessionSystemPromptResourceLoader interface {
	GetSystemPrompt() string
	GetAppendSystemPrompt() string
}

type AllModelRegistry

type AllModelRegistry = modelresolver.AllModelRegistry

type AnthropicSubscriptionWarningChecker

type AnthropicSubscriptionWarningChecker struct {
	Shown                bool
	Settings             AnthropicWarningSettings
	AuthStorage          *AuthStorage
	GetAPIKeyForProvider func(provider string) (string, bool)
}

func (*AnthropicSubscriptionWarningChecker) MaybeWarn

func (c *AnthropicSubscriptionWarningChecker) MaybeWarn(modelProvider string) bool

type AnthropicWarningSettings

type AnthropicWarningSettings struct {
	AnthropicExtraUsage *bool
}

type Args

type Args = internalcli.Args

func ParseArgs

func ParseArgs(argv []string) Args

type AssistantContentBlock

type AssistantContentBlock struct {
	Type      string
	Text      string
	Thinking  string
	ID        string
	Name      string
	Arguments map[string]any
}

type AssistantMessageComponent

type AssistantMessageComponent struct {
	Content             []AssistantContentBlock
	HideThinkingBlock   bool
	HiddenThinkingLabel string
	// contains filtered or unexported fields
}

func NewAssistantMessageComponent

func NewAssistantMessageComponent(content []AssistantContentBlock) AssistantMessageComponent

func (AssistantMessageComponent) Render

func (c AssistantMessageComponent) Render(width int) []string

func (*AssistantMessageComponent) SetOutputPad added in v0.82.0

func (c *AssistantMessageComponent) SetOutputPad(padding int)

type AuthCredential

type AuthCredential = llm.Credential

func ReadStoredCredential added in v0.82.0

func ReadStoredCredential(providerID string, authPath ...string) (AuthCredential, bool)

ReadStoredCredential performs a one-off raw credential read without constructing a store or resolving API-key commands and templates.

type AuthSelectorProvider

type AuthSelectorProvider struct {
	ID       string
	Name     string
	AuthType string
}

type AuthStatus

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

type AuthStatusResolver

type AuthStatusResolver func(providerID string) AuthStatus

type AuthStorage

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

func NewAuthStorage

func NewAuthStorage(authPath string) *AuthStorage

func NewAuthStorageFromBackend

func NewAuthStorageFromBackend(storage AuthStorageBackend) *AuthStorage

func NewInMemoryAuthStorage

func NewInMemoryAuthStorage(data AuthStorageData) *AuthStorage

func (*AuthStorage) DeleteCredential added in v0.82.0

func (s *AuthStorage) DeleteCredential(ctx context.Context, providerID string) error

func (*AuthStorage) DrainErrors

func (s *AuthStorage) DrainErrors() []error

func (*AuthStorage) Get

func (s *AuthStorage) Get(provider string) (AuthCredential, bool)

func (*AuthStorage) GetAPIKey

func (s *AuthStorage) GetAPIKey(provider string) (string, bool)

func (*AuthStorage) GetAPIKeyWithOptions

func (s *AuthStorage) GetAPIKeyWithOptions(provider string, options AuthStorageOptions) (string, bool)

func (*AuthStorage) GetAll

func (s *AuthStorage) GetAll() AuthStorageData

func (*AuthStorage) GetAuthStatus

func (s *AuthStorage) GetAuthStatus(provider string) AuthStatus

func (*AuthStorage) Has

func (s *AuthStorage) Has(provider string) bool

func (*AuthStorage) HasAuth

func (s *AuthStorage) HasAuth(provider string) bool

func (*AuthStorage) HasRuntimeAPIKey added in v0.82.0

func (s *AuthStorage) HasRuntimeAPIKey(provider string) bool

func (*AuthStorage) List

func (s *AuthStorage) List() []string

func (*AuthStorage) ListCredentials added in v0.82.0

func (s *AuthStorage) ListCredentials(ctx context.Context) ([]llm.CredentialInfo, error)

func (*AuthStorage) ModifyCredential added in v0.82.0

func (s *AuthStorage) ModifyCredential(
	ctx context.Context,
	providerID string,
	modify llm.CredentialModifier,
) (llm.Credential, bool, error)

func (*AuthStorage) ReadCredential added in v0.82.0

func (s *AuthStorage) ReadCredential(
	ctx context.Context,
	providerID string,
) (llm.Credential, bool, error)

func (*AuthStorage) Reload

func (s *AuthStorage) Reload()

func (*AuthStorage) Remove

func (s *AuthStorage) Remove(provider string)

func (*AuthStorage) RemoveRuntimeAPIKey

func (s *AuthStorage) RemoveRuntimeAPIKey(provider string)

func (*AuthStorage) Set

func (s *AuthStorage) Set(provider string, credential AuthCredential)

func (*AuthStorage) SetFallbackResolver

func (s *AuthStorage) SetFallbackResolver(resolver func(provider string) string)

func (*AuthStorage) SetRuntimeAPIKey

func (s *AuthStorage) SetRuntimeAPIKey(provider, apiKey string)

type AuthStorageBackend

type AuthStorageBackend interface {
	WithLock(fn AuthStorageLockFunc) error
}

type AuthStorageData

type AuthStorageData map[string]AuthCredential

type AuthStorageLockFunc

type AuthStorageLockFunc func(current string) (next string, write bool, err error)

type AuthStorageOptions

type AuthStorageOptions struct {
	IncludeFallback    bool
	ExcludeEnvironment bool
}

type AutoThemeSetting added in v0.82.0

type AutoThemeSetting struct {
	LightTheme string
	DarkTheme  string
}

AutoThemeSetting is the parsed light/dark pair from an automatic theme setting. The value is immutable after parsing and can be resolved against a terminal appearance without consulting mutable settings again.

func ParseAutoThemeSetting added in v0.82.0

func ParseAutoThemeSetting(themeSetting string) (AutoThemeSetting, bool)

ParseAutoThemeSetting parses the exact "light-theme/dark-theme" grammar used by Pi. A setting is automatic only when it contains one slash and both names are non-empty after trimming.

type AutocompleteEditor

type AutocompleteEditor interface {
	SetAutocompleteProvider(AutocompleteProvider)
}

type AutocompleteProvider

type AutocompleteProvider interface {
	ShouldTriggerFileCompletion(lines []string, cursorLine, cursorCol int) bool
}

type AutocompleteProviderFactory

type AutocompleteProviderFactory func(AutocompleteProvider) AutocompleteProvider

type BashExecOptions

type BashExecOptions struct {
	Context        context.Context
	OnData         func([]byte)
	Env            map[string]string
	ExitStdioGrace time.Duration
}

type BashExecutionCompleteOptions

type BashExecutionCompleteOptions struct {
	Truncated      bool
	FullOutputPath string
}

type BashExecutionComponent

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

func NewBashExecutionComponent

func NewBashExecutionComponent(command string, options ...BashExecutionOptions) *BashExecutionComponent

func (*BashExecutionComponent) AppendOutput

func (b *BashExecutionComponent) AppendOutput(chunk string)

func (*BashExecutionComponent) GetCommand

func (b *BashExecutionComponent) GetCommand() string

func (*BashExecutionComponent) GetOutput

func (b *BashExecutionComponent) GetOutput() string

func (*BashExecutionComponent) Invalidate

func (b *BashExecutionComponent) Invalidate()

func (*BashExecutionComponent) Output

func (b *BashExecutionComponent) Output() string

func (*BashExecutionComponent) Render

func (b *BashExecutionComponent) Render(width int) []string

func (*BashExecutionComponent) SetComplete

func (b *BashExecutionComponent) SetComplete(exitCode int, cancelled bool, options ...BashExecutionCompleteOptions)

func (*BashExecutionComponent) SetExpanded

func (b *BashExecutionComponent) SetExpanded(expanded bool)

type BashExecutionOptions

type BashExecutionOptions struct {
	ExcludeFromContext bool
}

type BashExecutorOptions

type BashExecutorOptions struct {
	Context        context.Context
	OnChunk        func(string)
	ExitStdioGrace time.Duration
}

type BashLocalOperationsOptions

type BashLocalOperationsOptions struct {
	ShellPath string
	// contains filtered or unexported fields
}

type BashOperationResult

type BashOperationResult struct {
	ExitCode  int  `json:"exitCode"`
	Cancelled bool `json:"cancelled"`
}

type BashOperations

type BashOperations struct {
	Exec func(command, cwd string, options BashExecOptions) (BashOperationResult, error)
}

func CreateLocalBashOperations

func CreateLocalBashOperations(options ...BashLocalOperationsOptions) BashOperations

type BashResult

type BashResult struct {
	Output          string `json:"output"`
	ExitCode        int    `json:"exitCode"`
	Cancelled       bool   `json:"cancelled"`
	Truncated       bool   `json:"truncated"`
	TruncatedBy     string `json:"truncatedBy,omitempty"`
	FullOutputPath  string `json:"fullOutputPath,omitempty"`
	TotalLines      int    `json:"totalLines,omitempty"`
	TotalBytes      int    `json:"totalBytes,omitempty"`
	OutputLines     int    `json:"outputLines,omitempty"`
	OutputBytes     int    `json:"outputBytes,omitempty"`
	LastLinePartial bool   `json:"lastLinePartial,omitempty"`
}

func ExecuteBash

func ExecuteBash(command, cwd string, options ...BashExecutorOptions) (BashResult, error)

func ExecuteBashWithOperations

func ExecuteBashWithOperations(command, cwd string, operations BashOperations, options ...BashExecutorOptions) (BashResult, error)

type BashTool

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

func NewBashTool

func NewBashTool(cwd string, options ...BashToolOptions) BashTool

func (BashTool) Execute

func (t BashTool) Execute(toolCallID string, input BashToolInput) (FileToolResult, error)

func (BashTool) ExecuteWithUpdates

func (t BashTool) ExecuteWithUpdates(toolCallID string, input BashToolInput, onUpdate func(FileToolResult)) (FileToolResult, error)

type BashToolInput

type BashToolInput struct {
	Command string
	// Timeout is expressed in seconds to match the tool protocol. Fractional
	// values are preserved and converted to time.Duration at the harness edge.
	Timeout float64
	// contains filtered or unexported fields
}

type BashToolOptions

type BashToolOptions struct {
	CommandPrefix string
	Operations    BashOperations
	ShellPath     string
}

type BorderedLoaderComponent

type BorderedLoaderComponent struct {
	gitui.FocusState

	OnAbort func()
	// contains filtered or unexported fields
}

func NewBorderedLoaderComponent

func NewBorderedLoaderComponent(ui *gitui.TUI, message string, options ...BorderedLoaderOptions) *BorderedLoaderComponent

func NewNonCancellableBorderedLoaderComponent

func NewNonCancellableBorderedLoaderComponent(ui *gitui.TUI, message string) *BorderedLoaderComponent

func (*BorderedLoaderComponent) Aborted

func (c *BorderedLoaderComponent) Aborted() bool

func (*BorderedLoaderComponent) Cancelled

func (c *BorderedLoaderComponent) Cancelled() bool

func (*BorderedLoaderComponent) Context

func (*BorderedLoaderComponent) Dispose

func (c *BorderedLoaderComponent) Dispose()

func (*BorderedLoaderComponent) HandleInput

func (c *BorderedLoaderComponent) HandleInput(data string)

func (*BorderedLoaderComponent) Invalidate

func (c *BorderedLoaderComponent) Invalidate()

func (*BorderedLoaderComponent) Render

func (c *BorderedLoaderComponent) Render(width int) []string

func (*BorderedLoaderComponent) SetOnAbort

func (c *BorderedLoaderComponent) SetOnAbort(fn func())

func (*BorderedLoaderComponent) Signal

type BorderedLoaderOptions

type BorderedLoaderOptions struct {
	Cancellable *bool
}

type BranchSummaryStatusIndicator added in v0.82.0

type BranchSummaryStatusIndicator struct {
	*StatusIndicator
}

BranchSummaryStatusIndicator renders branch summarization activity.

func NewBranchSummaryStatusIndicator added in v0.82.0

func NewBranchSummaryStatusIndicator(ui *gitui.TUI) *BranchSummaryStatusIndicator

NewBranchSummaryStatusIndicator constructs a branch summarization indicator.

type BuildSystemPromptOptions

type BuildSystemPromptOptions struct {
	CustomPrompt       string
	SelectedTools      []string
	ToolSnippets       map[string]string
	PromptGuidelines   []string
	AppendSystemPrompt string
	CWD                string
	ContextFiles       []SystemPromptContextFile
	Skills             []SystemPromptSkill
	DocumentationPaths []SystemPromptDocumentationPath
	Now                time.Time
}

type CLIConfigRuntimeHost

type CLIConfigRuntimeHost interface {
	Run() error
}

type CLIInteractiveRuntimeHost

type CLIInteractiveRuntimeHost interface {
	Run() error
}

type CLIInteractiveTUIHost

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

func NewCLIInteractiveTUIHost

func NewCLIInteractiveTUIHost(options CLIInteractiveTUIHostOptions) (*CLIInteractiveTUIHost, error)

func (*CLIInteractiveTUIHost) AvailableTUIThemes

func (h *CLIInteractiveTUIHost) AvailableTUIThemes() []TUIThemeInfo

func (*CLIInteractiveTUIHost) CurrentTUITheme

func (h *CLIInteractiveTUIHost) CurrentTUITheme() string

func (*CLIInteractiveTUIHost) EditorCursor

func (h *CLIInteractiveTUIHost) EditorCursor() (line, col int, ok bool)

func (*CLIInteractiveTUIHost) EditorCustomActive

func (h *CLIInteractiveTUIHost) EditorCustomActive() bool

func (*CLIInteractiveTUIHost) EditorFocused

func (h *CLIInteractiveTUIHost) EditorFocused() bool

func (*CLIInteractiveTUIHost) FocusEditor

func (h *CLIInteractiveTUIHost) FocusEditor() error

func (*CLIInteractiveTUIHost) InsertEditorText

func (h *CLIInteractiveTUIHost) InsertEditorText(text string)

func (*CLIInteractiveTUIHost) PasteEditorText

func (h *CLIInteractiveTUIHost) PasteEditorText(text string)

func (*CLIInteractiveTUIHost) ReadEditorText

func (h *CLIInteractiveTUIHost) ReadEditorText() string

func (*CLIInteractiveTUIHost) Run

func (h *CLIInteractiveTUIHost) Run() error

func (*CLIInteractiveTUIHost) RunContext

func (h *CLIInteractiveTUIHost) RunContext(ctx context.Context) (runErr error)

func (*CLIInteractiveTUIHost) RunTUIDialog

func (h *CLIInteractiveTUIHost) RunTUIDialog(request TUIDialogRequest) (TUIDialogResult, error)

func (*CLIInteractiveTUIHost) SetEditorText

func (h *CLIInteractiveTUIHost) SetEditorText(text string)

func (*CLIInteractiveTUIHost) SetHiddenThinkingLabel

func (h *CLIInteractiveTUIHost) SetHiddenThinkingLabel(label string) error

func (*CLIInteractiveTUIHost) SetTUIStatus

func (h *CLIInteractiveTUIHost) SetTUIStatus(key, text string) error

func (*CLIInteractiveTUIHost) SetTUITheme

func (h *CLIInteractiveTUIHost) SetTUITheme(name string) error

func (*CLIInteractiveTUIHost) SetTUITitle

func (h *CLIInteractiveTUIHost) SetTUITitle(title string) error

func (*CLIInteractiveTUIHost) SetTUIToolsExpanded

func (h *CLIInteractiveTUIHost) SetTUIToolsExpanded(expanded bool) error

func (*CLIInteractiveTUIHost) SetTUIWorking

func (h *CLIInteractiveTUIHost) SetTUIWorking(update TUIWorkingUpdate) error

func (*CLIInteractiveTUIHost) Stop

func (h *CLIInteractiveTUIHost) Stop()

func (*CLIInteractiveTUIHost) SubmitEditorText

func (h *CLIInteractiveTUIHost) SubmitEditorText() error

func (*CLIInteractiveTUIHost) TUIToolsExpanded

func (h *CLIInteractiveTUIHost) TUIToolsExpanded() bool

type CLIInteractiveTUIHostOptions

type CLIInteractiveTUIHostOptions struct {
	RuntimeHost         PrintModeRuntimeHost
	InitialMessage      string
	InitialImages       []llm.ContentPart
	Messages            []string
	Terminal            gitui.Terminal
	Stdout              io.Writer
	StdoutIsTTY         *bool
	ViewTreeHost        *ViewTreeHost
	InProcessUI         *InProcessUIRegistry
	ClipboardCopy       func(string) error
	ClipboardImageRead  func() *ClipboardImage
	ClipboardTextRead   func(context.Context) (string, bool)
	ClipboardImageDir   string
	ShareCreateGist     func(context.Context, string) (string, error)
	Suspend             InteractiveSuspendOperations
	TmuxOptionReader    TmuxOptionReader
	VerboseStartup      bool
	ExitAfterInitial    bool
	ClearScreenOnStart  bool
	ShowFooter          bool
	Version             string
	PackageName         string
	InstallEnvironment  InstallEnvironment
	VersionCheck        VersionReleaseChecker
	VersionCheckOptions VersionCheckOptions
	PackageUpdateCheck  PackageUpdateChecker
	BashOperations      BashOperations
	ShutdownSignals     <-chan os.Signal
	StartupWarnings     []string
}

type CLIOptions

type CLIOptions struct {
	Args                   []string
	Stdout                 io.Writer
	Stderr                 io.Writer
	Stdin                  io.Reader
	CWD                    string
	AgentDir               string
	Startup                func(stderr io.Writer) error
	PrintModeHostFactory   func(Args) (PrintModeRuntimeHost, error)
	InteractiveHostFactory func(Args) (CLIInteractiveRuntimeHost, error)
	ConfigHostFactory      func(PackageResourceConfigOptions) (CLIConfigRuntimeHost, error)
	ModelRegistry          *ModelRegistry
	ModelCatalogRefresh    ModelCatalogRefreshFunc
	PackageManager         *DefaultPackageManager
	PackageName            string
	Version                string
	InstallEnvironment     InstallEnvironment
	VersionCheck           VersionReleaseChecker
	VersionCheckOptions    VersionCheckOptions
	StartupWarnings        []string
	Responder              AgentSessionResponder
	ProjectTrustPrompt     ProjectTrustPrompt
	ProjectTrustOverride   *bool
	ExtensionFactories     []ProtocolExtensionFactory
	FirstTimeSetupTerminal gitui.Terminal
}

type CLIStartupMigrationResult

type CLIStartupMigrationResult struct {
	StartupWarnings []string
}

type CacheMiss added in v0.82.0

type CacheMiss struct {
	MissedTokens int           `json:"missedTokens"`
	MissedCost   float64       `json:"missedCost"`
	Idle         time.Duration `json:"idle"`
	ModelChanged bool          `json:"modelChanged"`
}

CacheMiss describes prompt tokens that were present in the preceding request but were billed again instead of being served from cache.

type CacheWasteTotals added in v0.82.0

type CacheWasteTotals struct {
	MissedTokens int     `json:"missedTokens"`
	MissedCost   float64 `json:"missedCost"`
	MissCount    int     `json:"missCount"`
}

CacheWasteTotals is the immutable cumulative cache-miss projection for one session entry snapshot.

type ClipboardCopyOperations

type ClipboardCopyOperations = clip.ClipboardCopyOperations

type ClipboardCopyOptions

type ClipboardCopyOptions = clip.ClipboardCopyOptions

type ClipboardImage

type ClipboardImage = clip.ClipboardImage

func ReadClipboardImage

func ReadClipboardImage(options ClipboardImageOptions) *ClipboardImage

type ClipboardImageCommandOptions

type ClipboardImageCommandOptions = clip.ClipboardImageCommandOptions

type ClipboardImageCommandResult

type ClipboardImageCommandResult = clip.ClipboardImageCommandResult

type ClipboardImageOperations

type ClipboardImageOperations = clip.ClipboardImageOperations

type ClipboardImageOptions

type ClipboardImageOptions = clip.ClipboardImageOptions

type ClipboardTextCommandOptions

type ClipboardTextCommandOptions = clip.ClipboardTextCommandOptions

type ClipboardTextReadOperations added in v0.82.0

type ClipboardTextReadOperations = clip.ClipboardTextReadOperations

type ClipboardTextReadOptions added in v0.82.0

type ClipboardTextReadOptions = clip.ClipboardTextReadOptions

type CodingAgentFauxState

type CodingAgentFauxState struct {
	CallCount int
	Contexts  [][]llm.Message
}

type CodingAgentTestHarness

type CodingAgentTestHarness struct {
	Session          *AgentSession
	SessionManager   *SessionManager
	Faux             *CodingAgentFauxState
	Events           []AgentSessionEvent
	TempDir          string
	ExtensionRuntime *ProtocolExtensionRuntime
}

func NewCodingAgentTestHarnessWithProtocolExtensions

func NewCodingAgentTestHarnessWithProtocolExtensions(options CodingAgentTestHarnessOptions, factories []ProtocolExtensionFactory) (*CodingAgentTestHarness, error)

func (*CodingAgentTestHarness) Cleanup

func (h *CodingAgentTestHarness) Cleanup()

func (*CodingAgentTestHarness) EventsOfType

func (h *CodingAgentTestHarness) EventsOfType(eventType string) []AgentSessionEvent

func (*CodingAgentTestHarness) Messages

func (h *CodingAgentTestHarness) Messages() []llm.Message

type CodingAgentTestHarnessModelOverride

type CodingAgentTestHarnessModelOverride struct {
	Provider string
	ID       string
}

type CodingAgentTestHarnessOptions

type CodingAgentTestHarnessOptions struct {
	Responses     []CodingAgentTestHarnessResponse
	Model         llm.Model
	RetrySettings *AgentSessionRetrySettings
	Tools         []SDKTool
}

type CodingAgentTestHarnessResponse

type CodingAgentTestHarnessResponse struct {
	Text       *string
	Thinking   string
	ToolCalls  []CodingAgentTestHarnessToolCall
	StopReason string
	Error      string
	Usage      *llm.Usage
	Model      *CodingAgentTestHarnessModelOverride
}

func TextHarnessResponse

func TextHarnessResponse(text string) CodingAgentTestHarnessResponse

type CodingAgentTestHarnessToolCall

type CodingAgentTestHarnessToolCall struct {
	ID        string
	Name      string
	Arguments map[string]any
}

type CodingModelRegistry

type CodingModelRegistry = modelresolver.CodingModelRegistry

type CompactionStatusIndicator added in v0.82.0

type CompactionStatusIndicator struct {
	*StatusIndicator
}

CompactionStatusIndicator renders manual or automatic compaction activity.

func NewCompactionStatusIndicator added in v0.82.0

func NewCompactionStatusIndicator(
	ui *gitui.TUI,
	reason CompactionStatusReason,
) *CompactionStatusIndicator

NewCompactionStatusIndicator constructs a compaction indicator.

type CompactionStatusReason added in v0.82.0

type CompactionStatusReason string

CompactionStatusReason determines the label used for compaction activity.

const (
	// CompactionStatusReasonManual identifies user-requested compaction.
	CompactionStatusReasonManual CompactionStatusReason = "manual"
	// CompactionStatusReasonThreshold identifies automatic threshold compaction.
	CompactionStatusReasonThreshold CompactionStatusReason = "threshold"
	// CompactionStatusReasonOverflow identifies overflow recovery compaction.
	CompactionStatusReasonOverflow CompactionStatusReason = "overflow"
)

type ConfiguredPackage

type ConfiguredPackage struct {
	Source        string
	Scope         string
	Filtered      bool
	InstalledPath string
}

type ConvertedImage

type ConvertedImage = imageresize.ConvertedImage

func ConvertToPNG

func ConvertToPNG(base64Data, mimeType string) *ConvertedImage

type CountdownTimer added in v0.82.0

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

CountdownTimer owns one countdown goroutine. Dispose waits for it to stop, so no callback can run after disposal returns.

func NewCountdownTimer added in v0.82.0

func NewCountdownTimer(
	timeout time.Duration,
	requester TUIRenderRequester,
	onTick func(int),
	onExpire func(),
) *CountdownTimer

NewCountdownTimer starts a second-granularity countdown and synchronously publishes its initial value.

func (*CountdownTimer) Dispose added in v0.82.0

func (t *CountdownTimer) Dispose()

Dispose stops the countdown and waits until its goroutine exits.

type CreateAgentSessionRuntimeFactory

type CreateAgentSessionRuntimeFactory func(AgentSessionRuntimeOptions) (any, error)

type CustomEntryComponent added in v0.82.0

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

CustomEntryComponent owns only presentation state for one persisted custom entry. The session manager remains the source of truth for entry data, while the extension runtime owns renderer registration and precedence.

func NewCustomEntryComponent added in v0.82.0

func NewCustomEntryComponent(
	entry FileEntry,
	renderer ProtocolEntryRenderer,
) *CustomEntryComponent

func (*CustomEntryComponent) HasContent added in v0.82.0

func (c *CustomEntryComponent) HasContent() bool

func (*CustomEntryComponent) Invalidate added in v0.82.0

func (c *CustomEntryComponent) Invalidate()

func (*CustomEntryComponent) Render added in v0.82.0

func (c *CustomEntryComponent) Render(width int) []string

func (*CustomEntryComponent) SetExpanded added in v0.82.0

func (c *CustomEntryComponent) SetExpanded(expanded bool)

type DefaultAgentSessionResourceLoader

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

func NewDefaultAgentSessionResourceLoader

func NewDefaultAgentSessionResourceLoader(cwd, agentDir string) *DefaultAgentSessionResourceLoader

func (*DefaultAgentSessionResourceLoader) GetAgentsFiles

func (*DefaultAgentSessionResourceLoader) GetAppendSystemPrompt

func (l *DefaultAgentSessionResourceLoader) GetAppendSystemPrompt() string

func (*DefaultAgentSessionResourceLoader) GetPrompts

func (*DefaultAgentSessionResourceLoader) GetSkills

func (*DefaultAgentSessionResourceLoader) GetSystemPrompt

func (l *DefaultAgentSessionResourceLoader) GetSystemPrompt() string

type DefaultPackageManager

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

func NewDefaultPackageManager

func NewDefaultPackageManager(options PackageManagerOptions) *DefaultPackageManager

func (*DefaultPackageManager) CheckForAvailableUpdates

func (m *DefaultPackageManager) CheckForAvailableUpdates() ([]PackageUpdate, error)

func (*DefaultPackageManager) GetInstalledPath

func (m *DefaultPackageManager) GetInstalledPath(source, scope string) string

func (*DefaultPackageManager) GetPackageIdentity

func (m *DefaultPackageManager) GetPackageIdentity(source string) string

func (*DefaultPackageManager) Install

func (m *DefaultPackageManager) Install(source string, project bool) error

func (*DefaultPackageManager) ListConfiguredPackages

func (m *DefaultPackageManager) ListConfiguredPackages() []ConfiguredPackage

func (*DefaultPackageManager) ListPackageResourceToggles

func (m *DefaultPackageManager) ListPackageResourceToggles() ([]PackageResourceToggleItem, error)

func (*DefaultPackageManager) ListResourceToggles

func (m *DefaultPackageManager) ListResourceToggles() ([]PackageResourceToggleItem, error)

func (*DefaultPackageManager) ListTopLevelResourceToggles

func (m *DefaultPackageManager) ListTopLevelResourceToggles() []PackageResourceToggleItem

func (*DefaultPackageManager) LoadResourceConfigSnapshot added in v0.82.0

func (m *DefaultPackageManager) LoadResourceConfigSnapshot() (ResourceConfigSnapshot, error)

LoadResourceConfigSnapshot resolves an isolated user-only projection and the effective trusted-project projection from the same settings snapshot.

func (*DefaultPackageManager) ParseSource

func (m *DefaultPackageManager) ParseSource(source string) PackageSource

func (*DefaultPackageManager) ProjectResourceOverrideState added in v0.82.0

ProjectResourceOverrideState returns the explicit project-layer state for item without folding in inherited enabled state.

func (*DefaultPackageManager) Remove

func (m *DefaultPackageManager) Remove(source string, project bool) error

func (*DefaultPackageManager) RemoveAndPersist

func (m *DefaultPackageManager) RemoveAndPersist(source string, project bool) (bool, error)

func (*DefaultPackageManager) ResolveConfiguredProtocolPackageResources

func (m *DefaultPackageManager) ResolveConfiguredProtocolPackageResources() (ProtocolPackageResources, error)

func (*DefaultPackageManager) ResolveExtensionSources

func (m *DefaultPackageManager) ResolveExtensionSources(sources []string, options ResolveExtensionSourcesOptions) ([]string, error)

func (*DefaultPackageManager) ResolveProtocolPackageResources

func (m *DefaultPackageManager) ResolveProtocolPackageResources(sources []string) (ProtocolPackageResources, error)

func (*DefaultPackageManager) ResolveProtocolPackageSourceSpecs

func (m *DefaultPackageManager) ResolveProtocolPackageSourceSpecs(specs []ProtocolPackageSourceSpec) (ProtocolPackageResources, error)

func (*DefaultPackageManager) RunSelfUpdate

func (m *DefaultPackageManager) RunSelfUpdate(options SelfUpdateOptions) (SelfUpdateResult, error)

func (*DefaultPackageManager) SetPackageResourceEnabled

func (m *DefaultPackageManager) SetPackageResourceEnabled(toggle PackageResourceToggle) (bool, error)

func (*DefaultPackageManager) SetProgressCallback

func (m *DefaultPackageManager) SetProgressCallback(callback func(PackageProgressEvent))

func (*DefaultPackageManager) SetProjectResourceOverride added in v0.82.0

func (m *DefaultPackageManager) SetProjectResourceOverride(target ResourceConfigTarget, state ProjectResourceOverrideState) (bool, error)

SetProjectResourceOverride persists one project-layer transition. target carries inherited state from the ResourceConfigSnapshot that displayed it.

func (*DefaultPackageManager) SetTopLevelResourceEnabled

func (m *DefaultPackageManager) SetTopLevelResourceEnabled(toggle TopLevelResourceToggle) (bool, error)

func (*DefaultPackageManager) Update

func (m *DefaultPackageManager) Update(sources ...string) error

type DefaultProjectTrust added in v0.82.0

type DefaultProjectTrust string
const (
	DefaultProjectTrustAsk    DefaultProjectTrust = "ask"
	DefaultProjectTrustAlways DefaultProjectTrust = "always"
	DefaultProjectTrustNever  DefaultProjectTrust = "never"
)

type DefaultResourceLoader

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

func NewDefaultResourceLoader

func NewDefaultResourceLoader(options DefaultResourceLoaderOptions) *DefaultResourceLoader

func (*DefaultResourceLoader) ApplyExtensionFlagValues

func (l *DefaultResourceLoader) ApplyExtensionFlagValues(values map[string]any, allowDeferred bool) []ProtocolExtensionDiscoveryError

func (*DefaultResourceLoader) ExtendResources

func (l *DefaultResourceLoader) ExtendResources(resources ResourceExtension)

func (*DefaultResourceLoader) GetAgentsFiles

func (*DefaultResourceLoader) GetAppendSystemPrompt

func (l *DefaultResourceLoader) GetAppendSystemPrompt() string

func (*DefaultResourceLoader) GetExtensions

func (*DefaultResourceLoader) GetPrompts

func (*DefaultResourceLoader) GetSkills

func (*DefaultResourceLoader) GetSystemPrompt

func (l *DefaultResourceLoader) GetSystemPrompt() string

func (*DefaultResourceLoader) GetThemes

func (*DefaultResourceLoader) LoadProjectTrustExtensions added in v0.82.0

func (l *DefaultResourceLoader) LoadProjectTrustExtensions() ResourceExtensionsResult

LoadProjectTrustExtensions loads only global/user and explicitly requested extensions. It intentionally leaves SettingsManager untrusted so the caller can resolve trust before any project-local code or settings are observed.

func (*DefaultResourceLoader) Reload

func (l *DefaultResourceLoader) Reload()

func (*DefaultResourceLoader) ReloadWithOptions added in v0.82.0

func (l *DefaultResourceLoader) ReloadWithOptions(
	options ResourceLoaderReloadOptions,
) error

ReloadWithOptions reloads settings and resources as one transaction. When a resolver is provided, global/user and explicit extensions load first; the returned decision then selects the final resource set on the same runtime.

type DefaultResourceLoaderOptions

type DefaultResourceLoaderOptions struct {
	CWD                      string
	AgentDir                 string
	SettingsManager          *SettingsManager
	NoExtensions             bool
	NoContextFiles           bool
	NoSkills                 bool
	NoPromptTemplates        bool
	NoThemes                 bool
	AdditionalExtensionPaths []string
	AdditionalSkillPaths     []string
	AdditionalPromptPaths    []string
	AdditionalThemePaths     []string
	SystemPrompt             string
	AppendSystemPrompt       []string
	SkillsOverride           func() ResourceSkillsResult
	SystemPromptOverride     func() string
	ExtensionFactories       []ProtocolExtensionFactory
}

type Diagnostic

type Diagnostic = internalcli.Diagnostic

type DistributionMetadata added in v0.82.0

type DistributionMetadata struct {
	PackageName   string
	AppName       string
	ConfigDirName string
}

type Edit

type Edit = harnesstools.Edit

type EditDiffResult

type EditDiffResult struct {
	Diff  string `json:"diff,omitempty"`
	Error string `json:"error,omitempty"`
}

func ComputeEditsDiff

func ComputeEditsDiff(path string, edits []Edit, cwd string, operations ...FileToolOperations) EditDiffResult

type EditTool

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

func NewEditTool

func NewEditTool(cwd string, operations ...FileToolOperations) EditTool

func (EditTool) Execute

func (t EditTool) Execute(toolCallID string, input EditToolInput) (FileToolResult, error)

type EditToolInput

type EditToolInput struct {
	Path  string
	Edits []Edit
}

type ExportHTMLOptions

type ExportHTMLOptions struct {
	ThemeName    string
	AgentDir     string
	ToolRenderer ExportHTMLToolRenderer
}

type ExportHTMLRenderedTool

type ExportHTMLRenderedTool struct {
	CallHTML            string `json:"callHtml,omitempty"`
	ResultHTMLCollapsed string `json:"resultHtmlCollapsed,omitempty"`
	ResultHTMLExpanded  string `json:"resultHtmlExpanded,omitempty"`
}

type ExportHTMLSessionData

type ExportHTMLSessionData struct {
	Header        *SessionHeader                    `json:"header,omitempty"`
	Entries       []FileEntry                       `json:"entries"`
	LeafID        *string                           `json:"leafId"`
	SystemPrompt  string                            `json:"systemPrompt,omitempty"`
	Tools         []ExportHTMLToolDefinition        `json:"tools,omitempty"`
	RenderedTools map[string]ExportHTMLRenderedTool `json:"renderedTools,omitempty"`
}

func BuildExportHTMLSessionData

func BuildExportHTMLSessionData(sessionManager *SessionManager) ExportHTMLSessionData

func BuildExportHTMLSessionDataWithOptions

func BuildExportHTMLSessionDataWithOptions(sessionManager *SessionManager, options ExportHTMLOptions) ExportHTMLSessionData

type ExportHTMLSidebarEntry

type ExportHTMLSidebarEntry struct {
	Role  string
	Label string
}

func ExportHTMLSidebarEntriesForUserMessage

func ExportHTMLSidebarEntriesForUserMessage(text string) []ExportHTMLSidebarEntry

type ExportHTMLSkillBlock

type ExportHTMLSkillBlock struct {
	Name        string
	Location    string
	Content     string
	UserMessage string
}

func ParseExportHTMLSkillBlock

func ParseExportHTMLSkillBlock(text string) (ExportHTMLSkillBlock, bool)

type ExportHTMLToolDefinition

type ExportHTMLToolDefinition struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Parameters  any    `json:"parameters,omitempty"`
}

type ExportHTMLToolRenderResult

type ExportHTMLToolRenderResult struct {
	Collapsed string
	Expanded  string
}

type ExportHTMLToolRenderer

type ExportHTMLToolRenderer interface {
	RenderCall(toolCallID, toolName string, args any) string
	RenderResult(toolCallID, toolName string, result FileToolResult, isError bool) ExportHTMLToolRenderResult
}

type ExportHTMLToolRendererDeps

type ExportHTMLToolRendererDeps struct {
	GetToolDefinition func(name string) (ToolDefinition, bool)
	CWD               string
	Width             int
	ShowImages        bool
}

type ExtensionSelectorComponent

type ExtensionSelectorComponent struct {
	OnSelect func(option string)
	OnCancel func()
	// contains filtered or unexported fields
}

func NewExtensionSelectorComponent

func NewExtensionSelectorComponent(title string, options []string) *ExtensionSelectorComponent

func (*ExtensionSelectorComponent) Focused

func (c *ExtensionSelectorComponent) Focused() bool

func (*ExtensionSelectorComponent) HandleInput

func (c *ExtensionSelectorComponent) HandleInput(input string)

func (*ExtensionSelectorComponent) Invalidate

func (c *ExtensionSelectorComponent) Invalidate()

func (*ExtensionSelectorComponent) Render

func (c *ExtensionSelectorComponent) Render(width int) []string

func (*ExtensionSelectorComponent) SetFocused

func (c *ExtensionSelectorComponent) SetFocused(focused bool)

func (*ExtensionSelectorComponent) SetTitle

func (c *ExtensionSelectorComponent) SetTitle(title string)

func (*ExtensionSelectorComponent) Title

type ExternalEditorOptions added in v0.82.0

type ExternalEditorOptions struct {
	Command string
	Content string
	Stdin   io.Reader
	Stdout  io.Writer
	Stderr  io.Writer
}

ExternalEditorOptions is the immutable request passed from a UI surface to the external-editor process boundary.

type ExternalEditorResult added in v0.82.0

type ExternalEditorResult struct {
	Status  ExternalEditorStatus
	Content string
}

ExternalEditorResult is detached from the temporary file and safe for the UI owner to apply after the process boundary has closed.

func EditInExternalEditor added in v0.82.0

func EditInExternalEditor(ctx context.Context, options ExternalEditorOptions) (ExternalEditorResult, error)

EditInExternalEditor writes content to a private temporary workspace, waits for the configured editor, and returns a detached result. A failed editor process is a normal failed result; filesystem failures are returned as errors. The temporary workspace is always removed on a best-effort basis.

type ExternalEditorStatus added in v0.82.0

type ExternalEditorStatus string

ExternalEditorStatus describes whether the editor produced replacement text.

const (
	ExternalEditorStatusComplete ExternalEditorStatus = "complete"
	ExternalEditorStatusFailed   ExternalEditorStatus = "failed"
)

type FSWatchListener

type FSWatchListener = fswatch.FSWatchListener

type FSWatchOptions

type FSWatchOptions = fswatch.FSWatchOptions

type FSWatcher

type FSWatcher = fswatch.FSWatcher

func WatchPathsWithErrorHandler

func WatchPathsWithErrorHandler(paths []string, listener FSWatchListener, onError func(), options ...FSWatchOptions) FSWatcher

func WatchWithErrorHandler

func WatchWithErrorHandler(path string, listener FSWatchListener, onError func(), options ...FSWatchOptions) FSWatcher

type FileAuthStorageBackend

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

func NewFileAuthStorageBackend

func NewFileAuthStorageBackend(authPath string) *FileAuthStorageBackend

func (*FileAuthStorageBackend) WithLock

type FileEntry

type FileEntry struct {
	Type          string
	ID            string
	Version       int
	Timestamp     string
	CWD           string
	ParentSession string
	ParentID      *string
	Message       any
	ThinkingLevel string
	Provider      string
	ModelID       string
	Summary       string
	FirstKeptID   string
	TokensBefore  int
	CustomType    string
	Data          any
	Content       any
	Display       bool
	Details       any
	FromHook      bool
	Usage         *llm.Usage
	TargetID      string
	Label         string
	Name          string
	FromID        string
	// contains filtered or unexported fields
}

func BuildContextEntries added in v0.82.0

func BuildContextEntries(
	entries []FileEntry,
	leafID *string,
	byID map[string]FileEntry,
) []FileEntry

BuildContextEntries follows the selected leaf to the root and applies the latest compaction. It retains FileEntry identity so presentation layers can attach derived state, such as cache-miss notices, without persisting it.

func LoadEntriesFromFile

func LoadEntriesFromFile(filePath string) []FileEntry

LoadEntriesFromFile loads valid JSONL records and returns no entries when the first parsed record is not a session header.

func (FileEntry) IsCustom added in v0.82.0

func (e FileEntry) IsCustom() bool

IsCustom reports whether the entry carries extension-owned session data. Go keeps persisted entries and rendered LLM messages as distinct types, so callers use this method instead of a runtime union type assertion.

func (FileEntry) MarshalJSON

func (e FileEntry) MarshalJSON() ([]byte, error)

func (*FileEntry) UnmarshalJSON

func (e *FileEntry) UnmarshalJSON(data []byte) error

type FileModelsStore added in v0.82.0

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

FileModelsStore persists dynamic provider catalogs in one locked JSON file. Each mutation reads and rewrites the complete map while holding the path-scoped lock so unrelated provider entries cannot be lost.

func NewFileModelsStore added in v0.82.0

func NewFileModelsStore(path string) *FileModelsStore

NewFileModelsStore creates a JSON-backed dynamic catalog store.

func (*FileModelsStore) DeleteModels added in v0.82.0

func (s *FileModelsStore) DeleteModels(
	ctx context.Context,
	providerID string,
) error

func (*FileModelsStore) ReadModels added in v0.82.0

func (s *FileModelsStore) ReadModels(
	ctx context.Context,
	providerID string,
) (llm.ModelsStoreEntry, bool, error)

func (*FileModelsStore) WriteModels added in v0.82.0

func (s *FileModelsStore) WriteModels(
	ctx context.Context,
	providerID string,
	entry llm.ModelsStoreEntry,
) error

type FileToolDetails

type FileToolDetails struct {
	Truncation           *ReadToolTruncation `json:"truncation,omitempty"`
	Diff                 string              `json:"diff,omitempty"`
	Patch                string              `json:"patch,omitempty"`
	FirstChangedLine     int                 `json:"firstChangedLine,omitempty"`
	FullOutputPath       string              `json:"fullOutputPath,omitempty"`
	MatchLimitReached    int                 `json:"matchLimitReached,omitempty"`
	ResultLimitReached   int                 `json:"resultLimitReached,omitempty"`
	EntryLimitReached    int                 `json:"entryLimitReached,omitempty"`
	SearchLinesTruncated bool                `json:"searchLinesTruncated,omitempty"`
}

type FileToolOperations

type FileToolOperations struct {
	Access      func(path string) error
	ReadFile    func(path string) ([]byte, error)
	WriteFile   func(path string, content []byte) error
	MkdirAll    func(path string) error
	ResizeImage func(part llm.ContentPart, options ImageResizeOptions) *ResizedImage
}

type FileToolResult

type FileToolResult struct {
	Text    string
	Content []llm.ContentPart
	Details *FileToolDetails
}

type FindInitialModelOptions

type FindInitialModelOptions = modelresolver.FindInitialModelOptions

type FindTool

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

func NewFindTool

func NewFindTool(cwd string) FindTool

func (FindTool) Execute

func (t FindTool) Execute(_ string, input FindToolInput) (FileToolResult, error)

type FindToolInput

type FindToolInput struct {
	Pattern string
	Path    string
	Limit   int
}

type FirstTimeSetupComponent added in v0.82.0

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

func NewFirstTimeSetupComponent added in v0.82.0

func NewFirstTimeSetupComponent(options FirstTimeSetupOptions) *FirstTimeSetupComponent

func (*FirstTimeSetupComponent) Focused added in v0.82.0

func (c *FirstTimeSetupComponent) Focused() bool

func (*FirstTimeSetupComponent) HandleInput added in v0.82.0

func (c *FirstTimeSetupComponent) HandleInput(data string)

func (*FirstTimeSetupComponent) Invalidate added in v0.82.0

func (c *FirstTimeSetupComponent) Invalidate()

func (*FirstTimeSetupComponent) Render added in v0.82.0

func (c *FirstTimeSetupComponent) Render(width int) []string

func (*FirstTimeSetupComponent) SetFocused added in v0.82.0

func (c *FirstTimeSetupComponent) SetFocused(focused bool)

func (*FirstTimeSetupComponent) State added in v0.82.0

type FirstTimeSetupEligibility added in v0.82.0

type FirstTimeSetupEligibility struct {
	OfficialDistribution  bool
	ExperimentalFeatures  bool
	DefaultAgentDirectory bool
	SettingsMissing       bool
}

func (FirstTimeSetupEligibility) ShouldRun added in v0.82.0

func (e FirstTimeSetupEligibility) ShouldRun() bool

type FirstTimeSetupOptions added in v0.82.0

type FirstTimeSetupOptions struct {
	DetectedTheme  TerminalTheme
	OnThemePreview func(TerminalTheme)
	OnSubmit       func(FirstTimeSetupResult)
	OnCancel       func()
}

type FirstTimeSetupResult added in v0.82.0

type FirstTimeSetupResult struct {
	Theme          TerminalTheme
	ShareAnalytics bool
}

type FirstTimeSetupRunnerOptions added in v0.82.0

type FirstTimeSetupRunnerOptions struct {
	Terminal         gitui.Terminal
	DetectionTimeout time.Duration
	Environment      map[string]string
	DetectTheme      func(context.Context, *gitui.TUI, time.Duration, map[string]string) TerminalTheme
}

type FirstTimeSetupState added in v0.82.0

type FirstTimeSetupState struct {
	Step           FirstTimeSetupStep
	Theme          TerminalTheme
	ShareAnalytics bool
}

FirstTimeSetupState is the single mutable state owned by the setup component. Rendering and submission are projections of this value.

type FirstTimeSetupStep added in v0.82.0

type FirstTimeSetupStep string
const (
	FirstTimeSetupThemeStep     FirstTimeSetupStep = "theme"
	FirstTimeSetupAnalyticsStep FirstTimeSetupStep = "analytics"
)

type FooterComponent

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

func NewFooterComponent

func NewFooterComponent(state FooterState) *FooterComponent

func (*FooterComponent) Invalidate

func (f *FooterComponent) Invalidate()

func (*FooterComponent) Render

func (f *FooterComponent) Render(width int) []string

func (*FooterComponent) SetAutoCompactEnabled

func (f *FooterComponent) SetAutoCompactEnabled(enabled bool)

func (*FooterComponent) SetState

func (f *FooterComponent) SetState(state FooterState)

type FooterDataProvider

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

func NewFooterDataProvider

func NewFooterDataProvider(cwd string, options ...FooterDataProviderOptions) *FooterDataProvider

func (*FooterDataProvider) ClearExtensionStatuses

func (p *FooterDataProvider) ClearExtensionStatuses()

func (*FooterDataProvider) Dispose

func (p *FooterDataProvider) Dispose()

func (*FooterDataProvider) GetAvailableProviderCount

func (p *FooterDataProvider) GetAvailableProviderCount() int

func (*FooterDataProvider) GetExtensionStatuses

func (p *FooterDataProvider) GetExtensionStatuses() map[string]string

func (*FooterDataProvider) GetGitBranch

func (p *FooterDataProvider) GetGitBranch() string

func (*FooterDataProvider) OnBranchChange

func (p *FooterDataProvider) OnBranchChange(callback func()) func()

func (*FooterDataProvider) SetAvailableProviderCount

func (p *FooterDataProvider) SetAvailableProviderCount(count int)

func (*FooterDataProvider) SetCwd

func (p *FooterDataProvider) SetCwd(cwd string)

func (*FooterDataProvider) SetExtensionStatus

func (p *FooterDataProvider) SetExtensionStatus(key string, text *string)

type FooterDataProviderOptions

type FooterDataProviderOptions struct {
	GitBranchResolver FooterGitBranchResolver
	WatchDebounce     time.Duration
	WatchPollInterval time.Duration
	WatchRetryDelay   time.Duration
	DisableWatchers   bool
}

type FooterGitBranchResolver

type FooterGitBranchResolver func(repoDir string) (branch string, ok bool)

type FooterState

type FooterState struct {
	CWD                    string
	GitBranch              string
	SessionName            string
	ModelID                string
	Provider               string
	Reasoning              bool
	ThinkingLevel          string
	ContextWindow          int
	ContextPercent         *float64
	AvailableProviderCount int
	UsingOAuth             bool
	Usage                  llm.Usage
	LatestCacheHitRate     *float64
	ExtensionStatuses      map[string]string
}

type FrontmatterResult

type FrontmatterResult = frontmatter.Result

func ParseFrontmatter

func ParseFrontmatter(content string) (FrontmatterResult, error)

type GitSource

type GitSource = gitsource.GitSource

func ParseGitURL

func ParseGitURL(source string) (GitSource, bool)

type GrepTool

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

func NewGrepTool

func NewGrepTool(cwd string) GrepTool

func (GrepTool) Execute

func (t GrepTool) Execute(_ string, input GrepToolInput) (FileToolResult, error)

type GrepToolInput

type GrepToolInput struct {
	Pattern    string
	Path       string
	Glob       string
	IgnoreCase bool
	Literal    bool
	Limit      int
	Context    int
}

type HighlightOptions

type HighlightOptions = syntaxhighlight.HighlightOptions

type HighlightTheme

type HighlightTheme = syntaxhighlight.HighlightTheme

type HostActionError

type HostActionError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type HostActionRequest

type HostActionRequest struct {
	Type     string          `json:"type"`
	Protocol string          `json:"protocol,omitempty"`
	ID       string          `json:"id"`
	Method   string          `json:"method"`
	Params   json.RawMessage `json:"params"`
}

type HostActionResponse

type HostActionResponse struct {
	Type     string           `json:"type"`
	Protocol string           `json:"protocol,omitempty"`
	ID       string           `json:"id"`
	Result   any              `json:"result,omitempty"`
	Error    *HostActionError `json:"error,omitempty"`
}

type HostPolicyDecision

type HostPolicyDecision struct {
	Granted             bool     `json:"granted"`
	GrantedCapabilities []string `json:"grantedCapabilities,omitempty"`
	DeniedCapabilities  []string `json:"deniedCapabilities,omitempty"`
	Reason              string   `json:"reason,omitempty"`
	Persistent          bool     `json:"persistent,omitempty"`
}

type HostPolicyRequest

type HostPolicyRequest struct {
	Capability   string   `json:"capability,omitempty"`
	Capabilities []string `json:"capabilities,omitempty"`
	Reason       string   `json:"reason,omitempty"`
	Persistent   bool     `json:"persistent,omitempty"`
}

type HostPolicyRequester

type HostPolicyRequester interface {
	RequestHostPolicyGrant(request HostPolicyRequest) (HostPolicyDecision, error)
}

type HostPolicyRequesterFunc

type HostPolicyRequesterFunc func(HostPolicyRequest) (HostPolicyDecision, error)

func (HostPolicyRequesterFunc) RequestHostPolicyGrant

func (f HostPolicyRequesterFunc) RequestHostPolicyGrant(request HostPolicyRequest) (HostPolicyDecision, error)

type HostProcessExecutor

type HostProcessExecutor interface {
	ExecuteHostProcess(command []string, cwd string) (HostProcessResult, error)
}

type HostProcessExecutorWithOptions

type HostProcessExecutorWithOptions interface {
	ExecuteHostProcessWithOptions(command []string, cwd string, options HostProcessOptions) (HostProcessResult, error)
}

type HostProcessOptions

type HostProcessOptions struct {
	Timeout time.Duration
	Context context.Context
}

type HostProcessResult

type HostProcessResult struct {
	ExitCode int    `json:"exitCode"`
	Stdout   string `json:"stdout,omitempty"`
	Stderr   string `json:"stderr,omitempty"`
	Killed   bool   `json:"killed,omitempty"`
}

type IdleStatus added in v0.82.0

type IdleStatus struct{}

IdleStatus preserves the two-line status region after a shrinking render.

func (IdleStatus) Invalidate added in v0.82.0

func (IdleStatus) Invalidate()

Invalidate satisfies gitui.Component; IdleStatus has no cached state.

func (IdleStatus) Render added in v0.82.0

func (IdleStatus) Render(width int) []string

Render returns two blank lines matching the height of a status indicator.

type ImageResizeOptions

type ImageResizeOptions = imageresize.ImageResizeOptions

type InMemoryAuthStorageBackend

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

func NewInMemoryAuthStorageBackend

func NewInMemoryAuthStorageBackend(data AuthStorageData) *InMemoryAuthStorageBackend

func (*InMemoryAuthStorageBackend) WithLock

type InProcessComponentContext

type InProcessComponentContext struct {
	Session     *AgentSession
	RuntimeHost PrintModeRuntimeHost
	ViewTree    *ViewTreeHost
}

type InProcessComponentFactory

type InProcessComponentFactory func(InProcessComponentContext) (gitui.Component, func(), error)

type InProcessCustomComponentFactory

type InProcessCustomComponentFactory func(InProcessComponentContext, InProcessCustomDone) (gitui.Component, func(), error)

type InProcessCustomDone

type InProcessCustomDone func(result any)

type InProcessCustomHandle

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

func (*InProcessCustomHandle) Close

func (h *InProcessCustomHandle) Close() bool

func (*InProcessCustomHandle) Done

type InProcessCustomOptions

type InProcessCustomOptions struct {
	Slot    string
	Overlay *gitui.OverlayOptions
}

type InProcessCustomResult

type InProcessCustomResult struct {
	Value     any
	Err       error
	Cancelled bool
}

type InProcessSlotRegistration

type InProcessSlotRegistration struct {
	Key     string
	Slot    string
	Factory InProcessComponentFactory
	Version int
	Overlay *gitui.OverlayOptions
}

type InProcessUIRegistry

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

func NewInProcessUIRegistry

func NewInProcessUIRegistry() *InProcessUIRegistry

func (*InProcessUIRegistry) OnChange

func (r *InProcessUIRegistry) OnChange(listener func()) func()

func (*InProcessUIRegistry) Remove

func (r *InProcessUIRegistry) Remove(key string) bool

func (*InProcessUIRegistry) SetEditor

func (r *InProcessUIRegistry) SetEditor(key string, factory InProcessComponentFactory)

func (*InProcessUIRegistry) SetFooter

func (r *InProcessUIRegistry) SetFooter(key string, factory InProcessComponentFactory)

func (*InProcessUIRegistry) SetHeader

func (r *InProcessUIRegistry) SetHeader(key string, factory InProcessComponentFactory)

func (*InProcessUIRegistry) SetOverlay

func (r *InProcessUIRegistry) SetOverlay(key string, factory InProcessComponentFactory, options ...gitui.OverlayOptions)

func (*InProcessUIRegistry) SetSlot

func (r *InProcessUIRegistry) SetSlot(key, slot string, factory InProcessComponentFactory)

func (*InProcessUIRegistry) SetWidget

func (r *InProcessUIRegistry) SetWidget(key, slot string, factory InProcessComponentFactory)

func (*InProcessUIRegistry) ShowCustom

func (*InProcessUIRegistry) Slots

type InitialMessageInput

type InitialMessageInput = internalcli.InitialMessageInput

type InitialMessageResult

type InitialMessageResult = internalcli.InitialMessageResult

func BuildInitialMessage

func BuildInitialMessage(input InitialMessageInput) InitialMessageResult

type InitialModelResult

type InitialModelResult = modelresolver.InitialModelResult

func FindInitialModel

func FindInitialModel(options FindInitialModelOptions) InitialModelResult

type InstallEnvironment

type InstallEnvironment struct {
	ExecPath      string
	PackageDir    string
	Platform      string
	HomeDir       string
	BunBinary     bool
	BunRuntime    bool
	CommandOutput func(command string, args []string, requireSuccess bool) (string, bool, error)
}

func DefaultInstallEnvironment

func DefaultInstallEnvironment() InstallEnvironment

type InstallMethod

type InstallMethod string

func DetectInstallMethod

func DetectInstallMethod(env InstallEnvironment) InstallMethod

type InteractiveContainer

type InteractiveContainer interface {
	Clear()
	AddText(text string)
}

type InteractiveContextFile

type InteractiveContextFile struct {
	Path    string
	Content string
}

type InteractiveDefaultEditor

type InteractiveDefaultEditor struct {
	OnEscape func()
}

type InteractiveEditor

type InteractiveEditor interface {
	SetText(text string)
}

type InteractiveExpandable

type InteractiveExpandable interface {
	SetExpanded(expanded bool)
}

type InteractiveExtensionResource

type InteractiveExtensionResource struct {
	Path       string
	SourceInfo *InteractiveSourceInfo
}

type InteractiveExtensionUIContext

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

func (InteractiveExtensionUIContext) AddAutocompleteProvider

func (c InteractiveExtensionUIContext) AddAutocompleteProvider(wrapper AutocompleteProviderFactory)

func (InteractiveExtensionUIContext) GetToolsExpanded

func (c InteractiveExtensionUIContext) GetToolsExpanded() bool

func (InteractiveExtensionUIContext) SetTheme

func (InteractiveExtensionUIContext) SetToolsExpanded

func (c InteractiveExtensionUIContext) SetToolsExpanded(expanded bool)

type InteractiveFlushCompactionOptions

type InteractiveFlushCompactionOptions struct {
	WillRetry bool
}

type InteractiveFooter

type InteractiveFooter interface {
	Invalidate()
}

type InteractiveForkOptions

type InteractiveForkOptions struct {
	Position string
}

type InteractiveForkResult

type InteractiveForkResult struct {
	Cancelled bool
}

type InteractiveImportResult

type InteractiveImportResult struct {
	Cancelled bool
}

type InteractiveIndexedTextContainer

type InteractiveIndexedTextContainer interface {
	InteractiveContainer
	Len() int
	SetTextAt(index int, text string)
}

type InteractiveLoadedResources

type InteractiveLoadedResources struct {
	QuietStartup         bool
	Verbose              bool
	ToolOutputExpanded   bool
	CWD                  string
	ContextFiles         []InteractiveContextFile
	Extensions           []InteractiveExtensionResource
	Skills               []InteractiveSkillResource
	Prompts              []InteractivePromptResource
	Themes               []InteractiveThemeResource
	SkillDiagnostics     []InteractiveResourceDiagnostic
	PromptDiagnostics    []InteractiveResourceDiagnostic
	ExtensionDiagnostics []InteractiveResourceDiagnostic
	ThemeDiagnostics     []InteractiveResourceDiagnostic
}

type InteractiveMessage

type InteractiveMessage struct {
	Role         string
	Summary      string
	TokensBefore int
	Timestamp    string
}

type InteractiveMode

type InteractiveMode struct {
	SessionManager InteractiveSessionLeafProvider
	RuntimeHost    InteractiveRuntimeHost
	UI             InteractiveUI
	Editor         InteractiveEditor
	Status         InteractiveContainer
	Chat           InteractiveContainer
	Footer         InteractiveFooter
	Settings       InteractiveSettings

	LoadingAnimation            InteractiveStopper
	AutoCompactionLoader        InteractiveStopper
	DefaultEditor               *InteractiveDefaultEditor
	AutoCompactionEscapeHandler func()
	Suspend                     InteractiveSuspendOperations

	ToolOutputExpanded             bool
	CustomHeader                   InteractiveExpandable
	BuiltInHeader                  InteractiveExpandable
	ChatExpandables                []InteractiveExpandable
	ThemeSettings                  InteractiveThemeSettings
	AutocompleteProviderWrappers   []AutocompleteProviderFactory
	CreateBaseAutocompleteProvider func() AutocompleteProvider
	DefaultAutocompleteEditor      AutocompleteEditor
	AutocompleteEditor             AutocompleteEditor
	LoadedResources                InteractiveLoadedResources
	PendingTools                   map[string]*ToolExecutionComponent
	PendingToolChatIndexes         map[string]int

	RenderCurrentSessionState   func()
	RebuildChatFromMessages     func()
	AddMessageToChat            func(InteractiveMessage)
	GetRegisteredToolDefinition func(toolName string) ToolDefinition
	FlushCompactionQueue        func(InteractiveFlushCompactionOptions) error
	ShowStatus                  func(string)
	ShowError                   func(string)
	ShowExtensionConfirm        func(title, message string) (bool, error)
	PromptForMissingSessionCwd  func(error) (string, error)
	HandleFatalRuntimeError     func(prefix string, err error) error
	// contains filtered or unexported fields
}

func (*InteractiveMode) CreateExtensionUIContext

func (m *InteractiveMode) CreateExtensionUIContext() InteractiveExtensionUIContext

func (*InteractiveMode) FormatLoadedResources

func (m *InteractiveMode) FormatLoadedResources(options InteractiveShowLoadedResourcesOptions) string

func (*InteractiveMode) GetPathCommandArgument

func (m *InteractiveMode) GetPathCommandArgument(text, command string) (string, bool)

func (*InteractiveMode) HandleCloneCommand

func (m *InteractiveMode) HandleCloneCommand() error

func (*InteractiveMode) HandleCtrlZ

func (m *InteractiveMode) HandleCtrlZ() error

func (*InteractiveMode) HandleEvent

func (m *InteractiveMode) HandleEvent(event AgentSessionEvent) error

func (*InteractiveMode) HandleImportCommand

func (m *InteractiveMode) HandleImportCommand(text string) error

func (*InteractiveMode) RenderSessionContext

func (m *InteractiveMode) RenderSessionContext(context SessionContext)

func (*InteractiveMode) SetToolsExpanded

func (m *InteractiveMode) SetToolsExpanded(expanded bool)

func (*InteractiveMode) SetupAutocompleteProvider

func (m *InteractiveMode) SetupAutocompleteProvider()

func (*InteractiveMode) ShowLoadedResources

func (m *InteractiveMode) ShowLoadedResources(options InteractiveShowLoadedResourcesOptions)

func (*InteractiveMode) ShowStatusMessage

func (m *InteractiveMode) ShowStatusMessage(message string)

type InteractivePromptResource

type InteractivePromptResource struct {
	FilePath   string
	Name       string
	SourceInfo *InteractiveSourceInfo
}

type InteractiveResourceDiagnostic

type InteractiveResourceDiagnostic struct {
	Type    string
	Message string
	Path    string
}

type InteractiveRuntimeHost

type InteractiveRuntimeHost interface {
	Fork(entryID string, options InteractiveForkOptions) (InteractiveForkResult, error)
	ImportFromJsonl(inputPath string, cwdOverride ...string) (InteractiveImportResult, error)
}

type InteractiveSessionLeafProvider

type InteractiveSessionLeafProvider interface {
	GetLeafID() *string
}

type InteractiveSettings

type InteractiveSettings interface {
	GetShowTerminalProgress() bool
}

type InteractiveShowLoadedResourcesOptions

type InteractiveShowLoadedResourcesOptions struct {
	Force                    bool
	ShowDiagnosticsWhenQuiet bool
}

type InteractiveSkillResource

type InteractiveSkillResource struct {
	FilePath   string
	Name       string
	SourceInfo *InteractiveSourceInfo
}

type InteractiveSourceInfo

type InteractiveSourceInfo struct {
	Path    string
	Source  string
	Scope   string
	Origin  string
	BaseDir string
}

type InteractiveStatusChat

type InteractiveStatusChat struct {
	Children []string
}

func (*InteractiveStatusChat) AddText

func (c *InteractiveStatusChat) AddText(text string)

func (*InteractiveStatusChat) Clear

func (c *InteractiveStatusChat) Clear()

func (*InteractiveStatusChat) Len

func (c *InteractiveStatusChat) Len() int

func (*InteractiveStatusChat) Render

func (c *InteractiveStatusChat) Render() string

func (*InteractiveStatusChat) SetTextAt

func (c *InteractiveStatusChat) SetTextAt(index int, text string)

type InteractiveStopper

type InteractiveStopper interface {
	Stop()
}

type InteractiveSuspendOperations

type InteractiveSuspendOperations struct {
	Platform             string
	SetInterval          func(func(), time.Duration) any
	ClearInterval        func(any)
	OnSignal             func(signal string, handler func()) any
	OnceSignal           func(signal string, handler func()) any
	RemoveSignalListener func(signal string, subscription any)
	KillProcessGroup     func(signal string) error
}

type InteractiveTerminal

type InteractiveTerminal interface {
	SetProgress(active bool)
}

type InteractiveThemeResource

type InteractiveThemeResource struct {
	SourcePath string
	Name       string
	SourceInfo *InteractiveSourceInfo
}

type InteractiveThemeResult

type InteractiveThemeResult struct {
	Success bool
}

type InteractiveThemeSettings

type InteractiveThemeSettings interface {
	GetTheme() string
	SetTheme(theme string)
}

type InteractiveUI

type InteractiveUI interface {
	Start()
	Stop()
	RequestRender(force ...bool)
	Terminal() InteractiveTerminal
}

type KeybindingsConfig

type KeybindingsConfig map[string]any

func DefaultProtocolKeybindings

func DefaultProtocolKeybindings() KeybindingsConfig

type KeybindingsManager

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

func NewKeybindingsManager

func NewKeybindingsManager(agentDir string) *KeybindingsManager

func (*KeybindingsManager) GetEffectiveConfig

func (m *KeybindingsManager) GetEffectiveConfig() KeybindingsConfig

func (*KeybindingsManager) GetUserBindings

func (m *KeybindingsManager) GetUserBindings() KeybindingsConfig

func (*KeybindingsManager) Reload

func (m *KeybindingsManager) Reload()

type LatestGiRelease

type LatestGiRelease = versioncheck.LatestGiRelease

func GetLatestGiRelease

func GetLatestGiRelease(currentVersion string, options VersionCheckOptions) (LatestGiRelease, bool)

type LatestPiRelease

type LatestPiRelease = versioncheck.LatestPiRelease

func GetLatestPiRelease

func GetLatestPiRelease(currentVersion string, options VersionCheckOptions) (LatestPiRelease, bool)

type LoadPromptTemplatesOptions

type LoadPromptTemplatesOptions struct {
	Cwd             string
	AgentDir        string
	PromptPaths     []string
	IncludeDefaults bool
}

type LocalHostProcessExecutor

type LocalHostProcessExecutor struct{}

func (LocalHostProcessExecutor) ExecuteHostProcess

func (LocalHostProcessExecutor) ExecuteHostProcess(command []string, cwd string) (HostProcessResult, error)

func (LocalHostProcessExecutor) ExecuteHostProcessWithOptions

func (LocalHostProcessExecutor) ExecuteHostProcessWithOptions(command []string, cwd string, options HostProcessOptions) (HostProcessResult, error)

type LoginDialogComponent

type LoginDialogComponent struct {
	OnSubmit func(value string)
	OnCancel func()
	// contains filtered or unexported fields
}

LoginDialogComponent is an ordered presentation state machine for one provider-owned authentication flow. Protocol state stays in the provider; this component retains only the blocks already shown and the current input.

func NewLoginDialogComponent

func NewLoginDialogComponent(title, message string) *LoginDialogComponent

func (*LoginDialogComponent) Focused

func (c *LoginDialogComponent) Focused() bool

func (*LoginDialogComponent) HandleInput

func (c *LoginDialogComponent) HandleInput(input string)

func (*LoginDialogComponent) Invalidate

func (c *LoginDialogComponent) Invalidate()

func (*LoginDialogComponent) Render

func (c *LoginDialogComponent) Render(width int) []string

func (*LoginDialogComponent) SetFocused

func (c *LoginDialogComponent) SetFocused(focused bool)

func (*LoginDialogComponent) ShowAuth

func (c *LoginDialogComponent) ShowAuth(
	url string,
	instructions string,
	manualPrompt string,
)

ShowAuth starts a new authorization-page presentation. The optional manual prompt is retained for callers that want to present both steps atomically.

func (*LoginDialogComponent) ShowDetails added in v0.82.0

func (c *LoginDialogComponent) ShowDetails(lines []string)

ShowDetails replaces the current content with application-owned setup details that should remain visible through the next provider prompt.

func (*LoginDialogComponent) ShowDeviceCode added in v0.82.0

func (c *LoginDialogComponent) ShowDeviceCode(
	verificationURI string,
	userCode string,
)

ShowDeviceCode starts a provider device-code presentation.

func (*LoginDialogComponent) ShowInfo

func (c *LoginDialogComponent) ShowInfo(
	lines []string,
	showClose ...bool,
)

ShowInfo appends provider-owned information and links. showClose is used only for terminal informational dialogs that do not continue into a prompt.

func (*LoginDialogComponent) ShowManualInput added in v0.82.0

func (c *LoginDialogComponent) ShowManualInput(message string)

ShowManualInput appends the manual callback input to the authorization URL and instructions already displayed.

func (*LoginDialogComponent) ShowProgress added in v0.82.0

func (c *LoginDialogComponent) ShowProgress(message string)

ShowProgress appends one non-terminal provider status.

func (*LoginDialogComponent) ShowPrompt added in v0.82.0

func (c *LoginDialogComponent) ShowPrompt(
	message string,
	placeholder string,
)

ShowPrompt appends one provider-owned text or secret prompt.

func (*LoginDialogComponent) ShowWaiting added in v0.82.0

func (c *LoginDialogComponent) ShowWaiting(message string)

ShowWaiting appends a cancellable polling state.

type LsTool

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

func NewLsTool

func NewLsTool(cwd string) LsTool

func (LsTool) Execute

func (t LsTool) Execute(_ string, input LsToolInput) (FileToolResult, error)

type LsToolInput

type LsToolInput struct {
	Path  string
	Limit int
}

type MigrationResult

type MigrationResult struct {
	MigratedAuthProviders []string
	DeprecationWarnings   []string
}

func RunMigrationsWithResult

func RunMigrationsWithResult(agentDir string, cwd ...string) (MigrationResult, error)

type MissingSessionCwdError

type MissingSessionCwdError = sessioncwd.MissingError

type MissingSessionCwdIssue

type MissingSessionCwdIssue = sessioncwd.MissingIssue

func GetMissingSessionCwdIssue

func GetMissingSessionCwdIssue(sessionManager *SessionManager, fallbackCwd string) *MissingSessionCwdIssue

type Mode

type Mode = internalcli.Mode
const (
	ModeText Mode = internalcli.ModeText
	ModeJSON Mode = internalcli.ModeJSON
	ModeRPC  Mode = internalcli.ModeRPC
)

type ModelCatalogRefreshFunc added in v0.82.0

type ModelCatalogRefreshFunc func(
	ctx context.Context,
	agentDir string,
	options ModelRegistryRefreshOptions,
) (llm.ModelsRefreshResult, error)

ModelCatalogRefreshFunc is the command boundary for an explicit catalog refresh. The agent directory and refresh policy are values so callers can test the command without installing process-global network hooks.

type ModelCostOverride

type ModelCostOverride struct {
	Input      *float64
	Output     *float64
	CacheRead  *float64
	CacheWrite *float64
	Tiers      *[]llm.ModelCostTier
}

type ModelOverride

type ModelOverride struct {
	Name             string
	Reasoning        *bool
	ThinkingLevelMap map[string]*string
	Input            []string
	Cost             *ModelCostOverride
	ContextWindow    *int
	MaxTokens        *int
	Headers          map[string]string
	Compat           llm.ModelCompat
}

type ModelPatternOptions

type ModelPatternOptions = modelresolver.ModelPatternOptions

type ModelPriceSource added in v0.82.0

type ModelPriceSource interface {
	GetModel(providerID, modelID string) (llm.Model, bool)
}

ModelPriceSource is the narrow pricing boundary needed for full-miss estimates. ModelRuntime satisfies it directly.

type ModelRegistry

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

ModelRegistry is the synchronous coding-agent compatibility facade. Mutations are serialized under mu and readers consume detached snapshots; the shared llm.Models, credential storage, and ModelsStore boundaries it composes are independently safe for concurrent use.

func NewInMemoryModelRegistry

func NewInMemoryModelRegistry(authStorage *AuthStorage) *ModelRegistry

func NewModelRegistry

func NewModelRegistry(authStorage *AuthStorage, modelsJSONPath string) *ModelRegistry

func NewModelRegistryWithOptions added in v0.82.0

func NewModelRegistryWithOptions(
	ctx context.Context,
	options ModelRegistryOptions,
) *ModelRegistry

NewModelRegistryWithOptions builds a registry and restores dynamic catalogs. A network refresh occurs only when AllowModelNetwork is explicitly true.

func (*ModelRegistry) Find

func (r *ModelRegistry) Find(provider, modelID string) (llm.Model, bool)

func (*ModelRegistry) GetAPIKeyAndHeaders

func (r *ModelRegistry) GetAPIKeyAndHeaders(model llm.Model) ResolvedRequestAuth

func (*ModelRegistry) GetAPIKeyAndHeadersWithOverrides added in v0.82.0

func (r *ModelRegistry) GetAPIKeyAndHeadersWithOverrides(
	ctx context.Context,
	model llm.Model,
	overrides llm.AuthResolutionOverrides,
) ResolvedRequestAuth

GetAPIKeyAndHeadersWithOverrides resolves one immutable request-auth snapshot. Request-scoped key and environment overrides are applied without mutating credential storage or the model registry.

func (*ModelRegistry) GetAPIKeyForProvider

func (r *ModelRegistry) GetAPIKeyForProvider(provider string) (string, bool)

func (*ModelRegistry) GetAll

func (r *ModelRegistry) GetAll() []llm.Model

func (*ModelRegistry) GetAvailable

func (r *ModelRegistry) GetAvailable() []llm.Model

func (*ModelRegistry) GetError

func (r *ModelRegistry) GetError() string

func (*ModelRegistry) GetProviderAuthStatus

func (r *ModelRegistry) GetProviderAuthStatus(provider string) AuthStatus

func (*ModelRegistry) GetProviderDisplayName

func (r *ModelRegistry) GetProviderDisplayName(provider string) string

func (*ModelRegistry) GetRegisteredNativeProvider added in v0.82.0

func (r *ModelRegistry) GetRegisteredNativeProvider(
	provider string,
) (*llm.Provider, bool)

GetRegisteredNativeProvider projects the native provider owned by the bound ModelRuntime.

func (*ModelRegistry) GetRegisteredProviderConfig added in v0.82.0

func (r *ModelRegistry) GetRegisteredProviderConfig(
	provider string,
) (ProviderConfigInput, bool)

GetRegisteredProviderConfig returns a detached compatibility provider registration.

func (*ModelRegistry) GetRegisteredProviderIDs added in v0.82.0

func (r *ModelRegistry) GetRegisteredProviderIDs() []string

GetRegisteredProviderIDs returns configured and native registrations. Native providers are owned by ModelRuntime.

func (*ModelRegistry) HasConfiguredAuth

func (r *ModelRegistry) HasConfiguredAuth(model llm.Model) bool

func (*ModelRegistry) IsUsingOAuth

func (r *ModelRegistry) IsUsingOAuth(model llm.Model) bool

func (*ModelRegistry) Refresh

func (r *ModelRegistry) Refresh()

func (*ModelRegistry) RefreshModels added in v0.82.0

RefreshModels refreshes dynamic provider catalogs without reparsing models.json. The zero options value only restores persisted state.

func (*ModelRegistry) RegisterProvider

func (r *ModelRegistry) RegisterProvider(providerName string, config ProviderConfigInput) error

func (*ModelRegistry) UnregisterProvider

func (r *ModelRegistry) UnregisterProvider(providerName string)

type ModelRegistryOptions added in v0.82.0

type ModelRegistryOptions struct {
	AuthStorage         *AuthStorage
	ModelsJSONPath      string
	ModelsStore         llm.ModelsStore
	RadiusClient        llm.HTTPDoer
	CatalogBaseURL      string
	CatalogClient       llm.HTTPDoer
	CatalogUserAgent    string
	ModelNetworkEnabled *bool
	AllowModelNetwork   bool
	ModelRefreshTimeout time.Duration
}

ModelRegistryOptions supplies app-owned state and explicit startup network policy. Network catalog refresh is disabled by the zero value.

type ModelRegistryRefreshOptions added in v0.82.0

type ModelRegistryRefreshOptions struct {
	AllowNetwork bool
	Force        bool
	Timeout      time.Duration
}

ModelRegistryRefreshOptions controls an explicit dynamic catalog refresh. Network access is disabled by the zero value.

type ModelRuntime added in v0.82.0

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

ModelRuntime is the coding-agent ownership boundary for model discovery, provider composition, credentials, and request dispatch.

Mutations are serialized under mu and publish immutable snapshots. A prepared request captures one provider, model, auth result, and option set before invoking extension transforms or transport code, so an in-flight request never observes a half-applied provider reload.

func NewModelRuntime added in v0.82.0

func NewModelRuntime(
	ctx context.Context,
	options ModelRuntimeOptions,
) (*ModelRuntime, error)

NewModelRuntime constructs a runtime from either an existing compatibility registry or the supplied registry options.

func NewModelRuntimeFromRegistry added in v0.82.0

func NewModelRuntimeFromRegistry(
	registry *ModelRegistry,
) (*ModelRuntime, error)

NewModelRuntimeFromRegistry promotes a loaded compatibility registry into the canonical instance request runtime.

func (*ModelRuntime) CheckAuth added in v0.82.0

func (r *ModelRuntime) CheckAuth(
	ctx context.Context,
	providerID string,
) (llm.AuthCheck, bool, error)

CheckAuth reports provider auth without exposing request secrets.

func (*ModelRuntime) Complete added in v0.82.0

func (r *ModelRuntime) Complete(
	ctx context.Context,
	model llm.Model,
	llmContext llm.Context,
	options llm.ModelsStreamOptions,
) (llm.Message, error)

Complete collects Stream's terminal assistant message.

func (*ModelRuntime) CompleteSimple added in v0.82.0

func (r *ModelRuntime) CompleteSimple(
	ctx context.Context,
	model llm.Model,
	llmContext llm.Context,
	options llm.ModelsStreamOptions,
) (llm.Message, error)

CompleteSimple collects StreamSimple's terminal assistant message.

func (*ModelRuntime) Find added in v0.82.0

func (r *ModelRuntime) Find(
	providerID string,
	modelID string,
) (llm.Model, bool)

Find implements CodingModelRegistry.

func (*ModelRuntime) ForceRefreshAvailability added in v0.82.0

func (r *ModelRuntime) ForceRefreshAvailability(
	ctx context.Context,
) error

ForceRefreshAvailability waits for an older refresh before publishing a post-mutation snapshot.

func (*ModelRuntime) GetAll added in v0.82.0

func (r *ModelRuntime) GetAll() []llm.Model

GetAll implements CodingModelRegistry.

func (*ModelRuntime) GetAuth added in v0.82.0

func (r *ModelRuntime) GetAuth(
	ctx context.Context,
	model llm.Model,
	overrides llm.AuthResolutionOverrides,
) (*ResolvedRequestAuth, error)

GetAuth resolves one request-scoped auth snapshot.

func (*ModelRuntime) GetAvailable added in v0.82.0

func (r *ModelRuntime) GetAvailable() []llm.Model

GetAvailable returns the last fully published availability snapshot and implements CodingModelRegistry without hidden network access.

func (*ModelRuntime) GetAvailableSnapshot added in v0.82.0

func (r *ModelRuntime) GetAvailableSnapshot() []llm.Model

GetAvailableSnapshot returns a detached immutable availability view.

func (*ModelRuntime) GetCompatibilityRequestConfig added in v0.82.0

func (r *ModelRuntime) GetCompatibilityRequestConfig(
	model llm.Model,
) ProviderRequestConfig

GetCompatibilityRequestConfig returns a detached legacy request projection assembled from the same declarative provider layers as canonical auth.

func (*ModelRuntime) GetError added in v0.82.0

func (r *ModelRuntime) GetError() string

GetError combines configuration, provider-composition, and availability diagnostics without discarding a usable catalog.

func (*ModelRuntime) GetModel added in v0.82.0

func (r *ModelRuntime) GetModel(
	providerID string,
	modelID string,
) (llm.Model, bool)

GetModel finds one model in the current provider snapshot.

func (*ModelRuntime) GetModels added in v0.82.0

func (r *ModelRuntime) GetModels(
	providerID ...string,
) []llm.Model

GetModels returns a detached current catalog snapshot.

func (*ModelRuntime) GetProvider added in v0.82.0

func (r *ModelRuntime) GetProvider(
	providerID string,
) (*llm.Provider, bool)

GetProvider resolves one provider from this runtime only.

func (*ModelRuntime) GetProviderAuth added in v0.82.0

func (r *ModelRuntime) GetProviderAuth(
	ctx context.Context,
	providerID string,
) (*llm.AuthResult, error)

GetProviderAuth resolves one provider-scoped auth snapshot without requiring a catalog model. Management-plane clients use this to share the same stored credential and environment precedence as inference requests.

func (*ModelRuntime) GetProviderAuthStatus added in v0.82.0

func (r *ModelRuntime) GetProviderAuthStatus(
	providerID string,
) AuthStatus

GetProviderAuthStatus returns a synchronous status projection suitable for UI and RPC responses.

func (*ModelRuntime) GetProviders added in v0.82.0

func (r *ModelRuntime) GetProviders() []*llm.Provider

GetProviders returns the current instance provider order.

func (*ModelRuntime) GetRegisteredNativeProvider added in v0.82.0

func (r *ModelRuntime) GetRegisteredNativeProvider(
	providerID string,
) (*llm.Provider, bool)

GetRegisteredNativeProvider returns the exact registered provider object.

func (*ModelRuntime) GetRegisteredProviderConfig added in v0.82.0

func (r *ModelRuntime) GetRegisteredProviderConfig(
	providerID string,
) (ProviderConfigInput, bool)

GetRegisteredProviderConfig returns a detached extension-style provider overlay.

func (*ModelRuntime) GetRegisteredProviderIDs added in v0.82.0

func (r *ModelRuntime) GetRegisteredProviderIDs() []string

GetRegisteredProviderIDs returns config and native registrations in stable insertion order.

func (*ModelRuntime) HasConfiguredAuth added in v0.82.0

func (r *ModelRuntime) HasConfiguredAuth(providerID string) bool

HasConfiguredAuth reads the published auth snapshot.

func (*ModelRuntime) IsUsingOAuth added in v0.82.0

func (r *ModelRuntime) IsUsingOAuth(providerID string) bool

IsUsingOAuth reads the published auth snapshot.

func (*ModelRuntime) ListCredentials added in v0.82.0

func (r *ModelRuntime) ListCredentials(
	ctx context.Context,
) ([]llm.CredentialInfo, error)

ListCredentials returns metadata only; request secrets remain inside the credential boundary.

func (*ModelRuntime) Login added in v0.82.0

func (r *ModelRuntime) Login(
	ctx context.Context,
	providerID string,
	credentialType llm.CredentialType,
	interaction llm.AuthInteraction,
) (llm.Credential, error)

Login runs a provider-owned login flow and refreshes dependent model state.

func (*ModelRuntime) Logout added in v0.82.0

func (r *ModelRuntime) Logout(
	ctx context.Context,
	providerID string,
) error

Logout removes one provider credential and rebuilds credential-dependent model projections.

func (*ModelRuntime) ModelRegistry added in v0.82.0

func (r *ModelRuntime) ModelRegistry() *ModelRegistry

ModelRegistry returns the legacy synchronous facade backed by this runtime. New request paths should use ModelRuntime directly.

func (*ModelRuntime) Refresh added in v0.82.0

Refresh reparses configuration, refreshes dynamic catalogs according to the explicit network policy, and coalesces concurrent callers.

func (*ModelRuntime) RefreshAvailability added in v0.82.0

func (r *ModelRuntime) RefreshAvailability(ctx context.Context) error

RefreshAvailability coalesces concurrent availability readers.

func (*ModelRuntime) RegisterNativeProvider added in v0.82.0

func (r *ModelRuntime) RegisterNativeProvider(
	provider *llm.Provider,
) error

RegisterNativeProvider installs a provider with its native auth and transport implementation.

func (*ModelRuntime) RegisterProvider added in v0.82.0

func (r *ModelRuntime) RegisterProvider(
	providerID string,
	config ProviderConfigInput,
) error

RegisterProvider composes an extension-style provider overlay.

func (*ModelRuntime) RemoveRuntimeAPIKey added in v0.82.0

func (r *ModelRuntime) RemoveRuntimeAPIKey(
	ctx context.Context,
	providerID string,
) error

RemoveRuntimeAPIKey removes only the process-local key.

func (*ModelRuntime) SetRuntimeAPIKey added in v0.82.0

func (r *ModelRuntime) SetRuntimeAPIKey(
	ctx context.Context,
	providerID string,
	apiKey string,
) error

SetRuntimeAPIKey installs a process-local key and publishes the resulting model availability.

func (*ModelRuntime) Stream added in v0.82.0

func (r *ModelRuntime) Stream(
	ctx context.Context,
	model llm.Model,
	llmContext llm.Context,
	options llm.ModelsStreamOptions,
) (*llm.AssistantMessageEventStream, error)

Stream prepares and dispatches one provider-native stream.

func (*ModelRuntime) StreamSimple added in v0.82.0

func (r *ModelRuntime) StreamSimple(
	ctx context.Context,
	model llm.Model,
	llmContext llm.Context,
	options llm.ModelsStreamOptions,
) (*llm.AssistantMessageEventStream, error)

StreamSimple prepares and dispatches one simple provider stream.

func (*ModelRuntime) UnregisterProvider added in v0.82.0

func (r *ModelRuntime) UnregisterProvider(providerID string)

UnregisterProvider removes config and native registrations, then restores the built-in provider with the same ID when present.

type ModelRuntimeOptions added in v0.82.0

type ModelRuntimeOptions struct {
	Registry    *ModelRegistry
	Credentials llm.CredentialStore
	ModelRegistryOptions
}

ModelRuntimeOptions supplies the compatibility configuration facade and credential boundary used to compose an instance-scoped provider runtime. Supplying Registry ignores ModelRegistryOptions; an explicit Credentials store still replaces the registry's default AuthStorage for canonical runtime operations.

type ModelScopeDiagnostic added in v0.82.0

type ModelScopeDiagnostic = modelresolver.ModelScopeDiagnostic

type ModelScopeDiagnosticCode added in v0.82.1

type ModelScopeDiagnosticCode = modelresolver.ModelScopeDiagnosticCode

type ModelScopeDiagnosticType added in v0.82.0

type ModelScopeDiagnosticType = modelresolver.ModelScopeDiagnosticType

type ModelSelectorCallbacks

type ModelSelectorCallbacks struct {
	OnSelect func(llm.Model)
	OnCancel func()
}

type ModelSelectorComponent

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

func NewInteractiveModelSelectorComponent

func NewInteractiveModelSelectorComponent(config ModelSelectorConfig, callbacks ModelSelectorCallbacks) *ModelSelectorComponent

func NewModelSelectorComponent

func NewModelSelectorComponent(currentModel llm.Model, scopedModels []ScopedModel) *ModelSelectorComponent

func (*ModelSelectorComponent) Close added in v0.82.0

func (c *ModelSelectorComponent) Close()

Close cancels an in-flight catalog refresh. It is safe to call repeatedly.

func (*ModelSelectorComponent) Focused

func (c *ModelSelectorComponent) Focused() bool

func (*ModelSelectorComponent) HandleInput

func (c *ModelSelectorComponent) HandleInput(data string)

func (*ModelSelectorComponent) Invalidate

func (c *ModelSelectorComponent) Invalidate()

func (*ModelSelectorComponent) Render

func (c *ModelSelectorComponent) Render(width int) []string

func (*ModelSelectorComponent) SetFocused

func (c *ModelSelectorComponent) SetFocused(focused bool)

type ModelSelectorConfig

type ModelSelectorConfig struct {
	CurrentModel   llm.Model
	AllModels      []llm.Model
	ScopedModels   []ScopedModel
	InitialSearch  string
	Keybindings    KeybindingsConfig
	Runtime        ModelSelectorRuntime
	RefreshOptions ModelRegistryRefreshOptions
	RequestRender  func()
}

type ModelSelectorRuntime added in v0.82.0

type ModelSelectorRuntime interface {
	GetAvailableSnapshot() []llm.Model
	GetModel(providerID, modelID string) (llm.Model, bool)
	GetError() string
	Refresh(
		context.Context,
		ModelRegistryRefreshOptions,
	) (llm.ModelsRefreshResult, error)
}

ModelSelectorRuntime is the narrow catalog boundary consumed by the interactive selector. ModelRuntime implements it, while callers can provide deterministic implementations without constructing provider transports.

type NewSessionOptions

type NewSessionOptions struct {
	// ID is optional. The zero value requests a generated UUIDv7.
	ID            string
	ParentSession string
}

type OAuthProvider

type OAuthProvider struct {
	ID           string
	Name         string
	Login        func(context.Context, llm.AuthInteraction) (AuthCredential, error)
	RefreshToken func(AuthCredential) (AuthCredential, error)
	GetAPIKey    func(AuthCredential) string
	ModifyModels func([]llm.Model, AuthCredential) []llm.Model
}

func GetOAuthProvider

func GetOAuthProvider(providerID string) (OAuthProvider, bool)

func GetOAuthProviders

func GetOAuthProviders() []OAuthProvider

func (OAuthProvider) APIKey

func (p OAuthProvider) APIKey(credential AuthCredential) string

type OAuthSelector

type OAuthSelector struct {
	Mode           string
	AuthStorage    *AuthStorage
	Providers      []AuthSelectorProvider
	StatusResolver AuthStatusResolver
}

func (OAuthSelector) Render

func (s OAuthSelector) Render(width int) []string

type OAuthSelectorComponent

type OAuthSelectorComponent struct {
	OnSelect func(providerID string)
	OnCancel func()
	// contains filtered or unexported fields
}

func NewOAuthSelectorComponent

func NewOAuthSelectorComponent(selector OAuthSelector) *OAuthSelectorComponent

func (*OAuthSelectorComponent) Focused

func (c *OAuthSelectorComponent) Focused() bool

func (*OAuthSelectorComponent) HandleInput

func (c *OAuthSelectorComponent) HandleInput(input string)

func (*OAuthSelectorComponent) Invalidate

func (c *OAuthSelectorComponent) Invalidate()

func (*OAuthSelectorComponent) Render

func (c *OAuthSelectorComponent) Render(width int) []string

func (*OAuthSelectorComponent) SetFocused

func (c *OAuthSelectorComponent) SetFocused(focused bool)

type PackageCommandOptions

type PackageCommandOptions struct {
	CWD string
}

type PackageManagerOperations

type PackageManagerOperations struct {
	RunCommand                 func(command string, args []string, options PackageCommandOptions) error
	RunCommandCapture          func(command string, args []string, options PackageCommandOptions) (string, error)
	MarkPathIgnoredByCloudSync func(path string)
}

type PackageManagerOptions

type PackageManagerOptions struct {
	CWD             string
	AgentDir        string
	SettingsManager *SettingsManager
	Operations      PackageManagerOperations
	Progress        func(PackageProgressEvent)
}

type PackageProgressEvent

type PackageProgressEvent struct {
	Type   string
	Action string
	Source string
	Error  string
}

type PackageResourceConfigOptions

type PackageResourceConfigOptions struct {
	CWD             string
	AgentDir        string
	Terminal        gitui.Terminal
	SettingsManager *SettingsManager
	WriteScope      ResourceConfigWriteScope
}

type PackageResourceToggle

type PackageResourceToggle struct {
	Source       string
	Scope        string
	ResourceType string
	Pattern      string
	Enabled      bool
}

type PackageResourceToggleItem

type PackageResourceToggleItem struct {
	Source       string
	Scope        string
	ResourceType string
	Pattern      string
	Path         string
	DisplayName  string
	Enabled      bool
	Metadata     ProtocolSourceInfo
}

type PackageSource

type PackageSource struct {
	Type   string
	Source string
	Repo   string
	Host   string
	Path   string
	Ref    string
	Pinned bool
}

func ParsePackageSource

func ParsePackageSource(source string) PackageSource

type PackageUpdate

type PackageUpdate struct {
	Source      string
	DisplayName string
	Type        string
	Scope       string
}

type PackageUpdateChecker

type PackageUpdateChecker func() ([]string, error)

type PackageUpdateSuggestionError

type PackageUpdateSuggestionError struct {
	Input      string
	Suggestion string
}

func (PackageUpdateSuggestionError) Error

type ParsedModelResult

type ParsedModelResult = modelresolver.ParsedModelResult

func ParseModelPattern

func ParseModelPattern(pattern string, availableModels []llm.Model, options ...ModelPatternOptions) ParsedModelResult

type PlanTodoItem

type PlanTodoItem = planmode.PlanTodoItem

func ExtractPlanTodoItems

func ExtractPlanTodoItems(message string) []PlanTodoItem

type PrintModeOptions

type PrintModeOptions struct {
	Mode           string
	InitialMessage string
	InitialImages  []llm.ContentPart
	Messages       []string
	Stdout         io.Writer
	Stderr         io.Writer
}

type PrintModePromptOptions

type PrintModePromptOptions struct {
	Images []llm.ContentPart
}

type PrintModeRuntimeHost

type PrintModeRuntimeHost interface {
	PrintModeSession() PrintModeSession
	Dispose() error
}

type PrintModeSession

type PrintModeSession interface {
	Prompt(message string, options PrintModePromptOptions) error
	WaitForIdle() error
	Messages() []llm.Message
}

type ProcessFileArgumentsOptions

type ProcessFileArgumentsOptions struct {
	CWD              string
	AutoResizeImages *bool
	ResizeImage      func(part llm.ContentPart, options ImageResizeOptions) *ResizedImage
}

type ProcessImageOptions added in v0.82.0

type ProcessImageOptions = imageresize.ProcessImageOptions

type ProcessImageResult added in v0.82.0

type ProcessImageResult = imageresize.ProcessImageResult

func ProcessImage added in v0.82.0

func ProcessImage(data []byte, mimeType string, options ...ProcessImageOptions) ProcessImageResult

type ProcessedFileArguments

type ProcessedFileArguments struct {
	Text   string
	Images []llm.ContentPart
}

func ProcessFileArguments

func ProcessFileArguments(paths []string, options ...ProcessFileArgumentsOptions) (ProcessedFileArguments, error)

type ProjectResourceOverrideState added in v0.82.0

type ProjectResourceOverrideState string

ProjectResourceOverrideState is the persisted project-layer decision for one resource. Inherit delegates to the user layer; load and unload are explicit project overrides.

const (
	ProjectResourceInherit ProjectResourceOverrideState = "inherit"
	ProjectResourceLoad    ProjectResourceOverrideState = "load"
	ProjectResourceUnload  ProjectResourceOverrideState = "unload"
)

func NextProjectResourceOverrideState added in v0.82.0

func NextProjectResourceOverrideState(current ProjectResourceOverrideState, inheritedEnabled bool) ProjectResourceOverrideState

NextProjectResourceOverrideState implements Pi's asymmetric three-state cycle. The order always makes the first key press change effective behavior.

type ProjectTrustOption added in v0.82.0

type ProjectTrustOption struct {
	Label     string
	Trusted   bool
	Updates   []ProjectTrustUpdate
	SavedPath string
}

func GetProjectTrustOptions added in v0.82.0

func GetProjectTrustOptions(cwd string, includeSessionOnly bool) []ProjectTrustOption

type ProjectTrustPrompt added in v0.82.0

type ProjectTrustPrompt func(cwd string, options []ProjectTrustOption) (*ProjectTrustOption, error)

type ProjectTrustStore added in v0.82.0

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

func NewProjectTrustStore added in v0.82.0

func NewProjectTrustStore(agentDir string) *ProjectTrustStore

func (*ProjectTrustStore) Clear added in v0.82.0

func (s *ProjectTrustStore) Clear(cwd string) error

func (*ProjectTrustStore) Get added in v0.82.0

func (s *ProjectTrustStore) Get(cwd string) (decision bool, found bool, err error)

func (*ProjectTrustStore) GetEntry added in v0.82.0

func (*ProjectTrustStore) Path added in v0.82.0

func (s *ProjectTrustStore) Path() string

func (*ProjectTrustStore) Set added in v0.82.0

func (s *ProjectTrustStore) Set(cwd string, decision bool) error

func (*ProjectTrustStore) SetMany added in v0.82.0

func (s *ProjectTrustStore) SetMany(updates []ProjectTrustUpdate) error

type ProjectTrustStoreEntry added in v0.82.0

type ProjectTrustStoreEntry struct {
	Path     string
	Decision bool
}

type ProjectTrustUpdate added in v0.82.0

type ProjectTrustUpdate struct {
	Path     string
	Decision *bool
}

type PromptTemplate

type PromptTemplate struct {
	Name         string
	Description  string
	ArgumentHint string
	Content      string
	SourceInfo   SourceInfo
	FilePath     string
}

func LoadPromptTemplates

func LoadPromptTemplates(options LoadPromptTemplatesOptions) []PromptTemplate

type ProtocolAbortSignal

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

func NewProtocolAbortSignal

func NewProtocolAbortSignal(done <-chan struct{}) *ProtocolAbortSignal

func (*ProtocolAbortSignal) Aborted

func (s *ProtocolAbortSignal) Aborted() bool

func (*ProtocolAbortSignal) Done

func (s *ProtocolAbortSignal) Done() <-chan struct{}

type ProtocolAutocompleteItem

type ProtocolAutocompleteItem struct {
	ID          string
	Value       string
	Label       string
	Description string
	Kind        string
	Range       *ProtocolAutocompleteRange
	Detail      *ViewTreeNode
}

type ProtocolAutocompleteProviderDefinition

type ProtocolAutocompleteProviderDefinition struct {
	Description string
	Priority    int
	Handler     func(context.Context, ProtocolAutocompleteRequest) (ProtocolAutocompleteResult, error)
}

type ProtocolAutocompleteProviderRegistration

type ProtocolAutocompleteProviderRegistration struct {
	ID          string
	Description string
	Priority    int
	SourceInfo  ProtocolSourceInfo
	Handler     func(context.Context, ProtocolAutocompleteRequest) (ProtocolAutocompleteResult, error)
}

type ProtocolAutocompleteRange

type ProtocolAutocompleteRange struct {
	StartLine int
	StartCol  int
	EndLine   int
	EndCol    int
}

type ProtocolAutocompleteRequest

type ProtocolAutocompleteRequest struct {
	Text          string
	Lines         []string
	CursorLine    int
	CursorCol     int
	Force         bool
	Trigger       string
	SlashCommand  string
	ArgumentIndex int
}

type ProtocolAutocompleteResult

type ProtocolAutocompleteResult struct {
	Items  []ProtocolAutocompleteItem
	Prefix string
	Start  int
	End    int
}

type ProtocolCommandContext

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

func (ProtocolCommandContext) Fork

func (ProtocolCommandContext) NewSession

func (ProtocolCommandContext) Reload

func (c ProtocolCommandContext) Reload() error

func (ProtocolCommandContext) SendUserMessage

func (c ProtocolCommandContext) SendUserMessage(text string, options ...ProtocolSendUserMessageOptions) error

func (ProtocolCommandContext) SwitchSession

func (ProtocolCommandContext) WaitForIdle added in v0.82.0

func (c ProtocolCommandContext) WaitForIdle() error

type ProtocolCommandContextActions

type ProtocolCommandContextActions struct {
	WaitForIdle   func() error
	Fork          func(entryID string, options ProtocolForkOptions) (ProtocolCommandForkResult, error)
	NewSession    func(options ProtocolNewSessionOptions) (ProtocolCommandSwitchResult, error)
	SwitchSession func(sessionFile string, options ProtocolSwitchSessionOptions) (ProtocolCommandSwitchResult, error)
	Reload        func() error
}

type ProtocolCommandDefinition

type ProtocolCommandDefinition struct {
	Description        string
	ArgumentHint       string
	Handler            func(args string) error
	HandlerWithContext func(args string, ctx ProtocolCommandContext) error
}

type ProtocolCommandForkResult

type ProtocolCommandForkResult struct {
	Cancelled bool
}

type ProtocolCommandRegistration

type ProtocolCommandRegistration struct {
	Name               string
	InvocationName     string
	Description        string
	ArgumentHint       string
	SourceInfo         ProtocolSourceInfo
	Handler            func(args string) error
	HandlerWithContext func(args string, ctx ProtocolCommandContext) error
}

type ProtocolCommandSwitchResult

type ProtocolCommandSwitchResult struct {
	Cancelled bool
}

type ProtocolCustomMessage

type ProtocolCustomMessage struct {
	CustomType string
	Content    any
	Display    bool
	Details    any
}

type ProtocolEntryRenderOptions added in v0.82.0

type ProtocolEntryRenderOptions struct {
	Expanded bool
}

type ProtocolEntryRenderer added in v0.82.0

type ProtocolEntryRenderer func(
	entry FileEntry,
	options ProtocolEntryRenderOptions,
) gitui.Component

ProtocolEntryRenderer is a trusted in-process rendering boundary. Portable process extensions use ViewTree nodes instead of passing component handles across RPC.

type ProtocolEntryRendererRegistration added in v0.82.0

type ProtocolEntryRendererRegistration struct {
	CustomType string
	SourceInfo ProtocolSourceInfo
	Renderer   ProtocolEntryRenderer
}

type ProtocolErrorListener

type ProtocolErrorListener func(ProtocolExtensionError)

type ProtocolEventHandler

type ProtocolEventHandler func(ProtocolSessionEvent) (ProtocolEventResult, error)

type ProtocolEventResult

type ProtocolEventResult struct {
	Cancel            bool
	Block             bool
	Reason            string
	Compaction        *agentharness.CompactionResult
	Messages          []llm.Message
	MessagesSet       bool
	Message           *llm.Message
	MessageSet        bool
	CustomMessages    []ProtocolCustomMessage
	CustomMessagesSet bool
	SystemPrompt      string
	SystemPromptSet   bool
	Content           []SDKContentPart
	ContentSet        bool
	Details           any
	DetailsSet        bool
	IsError           bool
	IsErrorSet        bool
	BashResult        *BashResult
	BashResultSet     bool
	Payload           any
	PayloadSet        bool
	Resources         ResourceExtension
	ResourcesSet      bool
	ProjectTrust      *ProtocolProjectTrustResult
}

type ProtocolExtensionContext

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

func (*ProtocolExtensionContext) GetFlag

func (c *ProtocolExtensionContext) GetFlag(name string) any

func (*ProtocolExtensionContext) GetSystemPrompt

func (c *ProtocolExtensionContext) GetSystemPrompt() string

func (*ProtocolExtensionContext) IsIdle added in v0.82.0

func (c *ProtocolExtensionContext) IsIdle() bool

func (*ProtocolExtensionContext) MountViewTree

func (c *ProtocolExtensionContext) MountViewTree(mountID, slot string, view ViewTreeNode, options ...ViewTreeMountOptions) error

func (*ProtocolExtensionContext) On

func (c *ProtocolExtensionContext) On(eventType string, handler ProtocolEventHandler) error

func (*ProtocolExtensionContext) OnInput

func (*ProtocolExtensionContext) RegisterAutocompleteProvider

func (c *ProtocolExtensionContext) RegisterAutocompleteProvider(id string, definition ProtocolAutocompleteProviderDefinition) error

func (*ProtocolExtensionContext) RegisterCommand

func (c *ProtocolExtensionContext) RegisterCommand(name string, definition ProtocolCommandDefinition) error

func (*ProtocolExtensionContext) RegisterEntryRenderer added in v0.82.0

func (c *ProtocolExtensionContext) RegisterEntryRenderer(customType string, renderer ProtocolEntryRenderer) error

func (*ProtocolExtensionContext) RegisterFlag

func (c *ProtocolExtensionContext) RegisterFlag(name string, definition ProtocolFlagDefinition) error

func (*ProtocolExtensionContext) RegisterMessageRenderer

func (c *ProtocolExtensionContext) RegisterMessageRenderer(customType string, renderer ProtocolMessageRenderer) error

func (*ProtocolExtensionContext) RegisterProvider

func (c *ProtocolExtensionContext) RegisterProvider(provider string, override ProtocolProviderOverride) error

func (*ProtocolExtensionContext) RegisterShortcut

func (c *ProtocolExtensionContext) RegisterShortcut(key string, definition ProtocolShortcutDefinition) error

func (*ProtocolExtensionContext) RegisterTool

func (c *ProtocolExtensionContext) RegisterTool(definition ProtocolToolDefinition) error

func (*ProtocolExtensionContext) RegisterToolRenderer

func (c *ProtocolExtensionContext) RegisterToolRenderer(toolName string, definition ProtocolToolRendererDefinition) error

func (*ProtocolExtensionContext) SendCustomMessage

func (*ProtocolExtensionContext) SendUserMessage

func (c *ProtocolExtensionContext) SendUserMessage(text string, options ProtocolSendUserMessageOptions) error

func (*ProtocolExtensionContext) SetSessionName

func (c *ProtocolExtensionContext) SetSessionName(name string) error

func (*ProtocolExtensionContext) Signal

func (*ProtocolExtensionContext) UnregisterProvider

func (c *ProtocolExtensionContext) UnregisterProvider(provider string) error

type ProtocolExtensionDiscoveryError

type ProtocolExtensionDiscoveryError struct {
	Path  string
	Error string
}

type ProtocolExtensionDiscoveryResult

type ProtocolExtensionDiscoveryResult struct {
	Extensions []ProtocolExtensionSource
	Errors     []ProtocolExtensionDiscoveryError
}

func DiscoverProtocolExtensions

func DiscoverProtocolExtensions(explicitPaths []string, cwd, agentDir string) ProtocolExtensionDiscoveryResult

func LoadProtocolExtensionSources

func LoadProtocolExtensionSources(paths []string, cwd string) ProtocolExtensionDiscoveryResult

type ProtocolExtensionError

type ProtocolExtensionError struct {
	ExtensionPath string
	Event         string
	Error         string
	Stack         string
}

type ProtocolExtensionFactory

type ProtocolExtensionFactory struct {
	Path    string
	Name    string
	Hidden  bool
	Factory func(*ProtocolExtensionContext) error
}

type ProtocolExtensionFlagDiagnostic

type ProtocolExtensionFlagDiagnostic struct {
	Name    string
	Message string
}

type ProtocolExtensionProcess

type ProtocolExtensionProcess struct {
	Spec ProtocolPackageProcessExtension
	// contains filtered or unexported fields
}

func (*ProtocolExtensionProcess) EmitEvent

func (p *ProtocolExtensionProcess) EmitEvent(method string, params map[string]any) error

func (*ProtocolExtensionProcess) RequestEvent

func (p *ProtocolExtensionProcess) RequestEvent(ctx context.Context, method string, params any) (json.RawMessage, error)

func (*ProtocolExtensionProcess) Start

func (*ProtocolExtensionProcess) Stop

type ProtocolExtensionProcessSupervisor

type ProtocolExtensionProcessSupervisor struct {
	Host            *RPCSessionHost
	StartTimeout    time.Duration
	ShutdownTimeout time.Duration
	// contains filtered or unexported fields
}

func (*ProtocolExtensionProcessSupervisor) BindSession

func (s *ProtocolExtensionProcessSupervisor) BindSession(session *AgentSession)

func (*ProtocolExtensionProcessSupervisor) DiscoverResources

func (s *ProtocolExtensionProcessSupervisor) DiscoverResources(ctx context.Context, reason, cwd string) (ResourceExtension, error)

func (*ProtocolExtensionProcessSupervisor) EmitEvent

func (s *ProtocolExtensionProcessSupervisor) EmitEvent(method string, params map[string]any) error

func (*ProtocolExtensionProcessSupervisor) EmitSessionEvent

func (*ProtocolExtensionProcessSupervisor) EmitTerminalInput

func (s *ProtocolExtensionProcessSupervisor) EmitTerminalInput(data string) error

func (*ProtocolExtensionProcessSupervisor) EmitUserBash

func (s *ProtocolExtensionProcessSupervisor) EmitUserBash(ctx context.Context, params map[string]any) (*BashResult, bool, error)

func (*ProtocolExtensionProcessSupervisor) Processes

func (*ProtocolExtensionProcessSupervisor) Start

func (*ProtocolExtensionProcessSupervisor) Stop

type ProtocolExtensionRuntime

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

func NewDefaultProtocolExtensionRuntime

func NewDefaultProtocolExtensionRuntime() *ProtocolExtensionRuntime

func NewProtocolExtensionRuntime

func NewProtocolExtensionRuntime(capabilities ...string) *ProtocolExtensionRuntime

func (*ProtocolExtensionRuntime) ActiveToolNames

func (r *ProtocolExtensionRuntime) ActiveToolNames() []string

func (*ProtocolExtensionRuntime) AppendCustomEntry

func (r *ProtocolExtensionRuntime) AppendCustomEntry(customType string, data any) (string, error)

func (*ProtocolExtensionRuntime) ApplyToSession

func (r *ProtocolExtensionRuntime) ApplyToSession(session *AgentSession)

func (*ProtocolExtensionRuntime) AutocompleteProviders

func (*ProtocolExtensionRuntime) BindCommandContext

func (r *ProtocolExtensionRuntime) BindCommandContext(actions ProtocolCommandContextActions)

func (*ProtocolExtensionRuntime) BindHostActionHost

func (r *ProtocolExtensionRuntime) BindHostActionHost(host *RPCSessionHost)

func (*ProtocolExtensionRuntime) BindModelRegistry

func (r *ProtocolExtensionRuntime) BindModelRegistry(registry *ModelRegistry)

func (*ProtocolExtensionRuntime) BindModelRuntime added in v0.82.0

func (r *ProtocolExtensionRuntime) BindModelRuntime(
	runtime *ModelRuntime,
)

BindModelRuntime routes provider mutations through the instance runtime while retaining the compatibility registry for legacy extension surfaces.

func (*ProtocolExtensionRuntime) BindSession

func (r *ProtocolExtensionRuntime) BindSession(session *AgentSession)

func (*ProtocolExtensionRuntime) BindViewTreeHost

func (r *ProtocolExtensionRuntime) BindViewTreeHost(host *ViewTreeHost)

func (*ProtocolExtensionRuntime) CommandInvocationNames

func (r *ProtocolExtensionRuntime) CommandInvocationNames() []string

func (*ProtocolExtensionRuntime) CreateCommandContext

func (r *ProtocolExtensionRuntime) CreateCommandContext() ProtocolCommandContext

func (*ProtocolExtensionRuntime) EmitBeforeProviderHeaders added in v0.82.0

func (r *ProtocolExtensionRuntime) EmitBeforeProviderHeaders(
	ctx context.Context,
	headers map[string]string,
	model *llm.Model,
) map[string]string

EmitBeforeProviderHeaders runs after provider, model, and request headers have been assembled. Every handler receives the same mutable map, so changes flow to the next handler and then to the HTTP transport. A failing extension is diagnosed and isolated instead of preventing later handlers from running.

func (*ProtocolExtensionRuntime) EmitInput

func (r *ProtocolExtensionRuntime) EmitInput(text string, images []llm.ContentPart, source string) ProtocolInputResult

func (*ProtocolExtensionRuntime) EmitProjectTrustEvent added in v0.82.0

EmitProjectTrustEvent isolates handler failures and returns the first decisive answer. An undecided result deliberately falls through so later handlers and extensions can participate in the decision.

func (*ProtocolExtensionRuntime) EmitSessionEvent

func (*ProtocolExtensionRuntime) FlagDiagnostics

func (*ProtocolExtensionRuntime) FlagValue

func (r *ProtocolExtensionRuntime) FlagValue(name string) any

func (*ProtocolExtensionRuntime) Flags

func (*ProtocolExtensionRuntime) GetActiveTools added in v0.82.0

func (r *ProtocolExtensionRuntime) GetActiveTools() []string

func (*ProtocolExtensionRuntime) GetCommand

func (r *ProtocolExtensionRuntime) GetCommand(invocationName string) *ProtocolCommandRegistration

func (*ProtocolExtensionRuntime) GetEntryRenderer added in v0.82.0

func (r *ProtocolExtensionRuntime) GetEntryRenderer(customType string) ProtocolEntryRenderer

func (*ProtocolExtensionRuntime) GetMessageRenderer

func (r *ProtocolExtensionRuntime) GetMessageRenderer(customType string) ProtocolMessageRenderer

func (*ProtocolExtensionRuntime) GetModelRegistry added in v0.82.0

func (r *ProtocolExtensionRuntime) GetModelRegistry() *ModelRegistry

func (*ProtocolExtensionRuntime) GetRegisteredToolDefinition

func (r *ProtocolExtensionRuntime) GetRegisteredToolDefinition(toolName string) ToolDefinition

func (*ProtocolExtensionRuntime) GetSystemPrompt

func (r *ProtocolExtensionRuntime) GetSystemPrompt() string

func (*ProtocolExtensionRuntime) GetToolRenderer

func (*ProtocolExtensionRuntime) HasHandlers

func (r *ProtocolExtensionRuntime) HasHandlers(eventType string) bool

func (*ProtocolExtensionRuntime) InvalidateCommandContexts

func (r *ProtocolExtensionRuntime) InvalidateCommandContexts()

func (*ProtocolExtensionRuntime) LoadFactories

func (r *ProtocolExtensionRuntime) LoadFactories(factories []ProtocolExtensionFactory) error

func (*ProtocolExtensionRuntime) OnAutocompleteProvidersChanged

func (r *ProtocolExtensionRuntime) OnAutocompleteProvidersChanged(callback func()) func()

func (*ProtocolExtensionRuntime) OnCommandsChanged

func (r *ProtocolExtensionRuntime) OnCommandsChanged(callback func()) func()

func (*ProtocolExtensionRuntime) OnError

func (r *ProtocolExtensionRuntime) OnError(listener ProtocolErrorListener) func()

func (*ProtocolExtensionRuntime) OnMessageRenderersChanged

func (r *ProtocolExtensionRuntime) OnMessageRenderersChanged(callback func()) func()

func (*ProtocolExtensionRuntime) OrderSources added in v0.82.0

func (r *ProtocolExtensionRuntime) OrderSources(
	sources []ProtocolSourceInfo,
)

OrderSources projects the final resource-loader order onto registries that were populated across multiple load phases. Stable sorting preserves the registration order within each extension and leaves runtime-only sources at the end.

func (*ProtocolExtensionRuntime) PendingProviderRegistrations

func (r *ProtocolExtensionRuntime) PendingProviderRegistrations() []ProtocolProviderRegistration

func (*ProtocolExtensionRuntime) RegisteredCommands

func (r *ProtocolExtensionRuntime) RegisteredCommands() []ProtocolCommandRegistration

func (*ProtocolExtensionRuntime) RegisteredTools

func (r *ProtocolExtensionRuntime) RegisteredTools() []SDKTool

func (*ProtocolExtensionRuntime) RemoveSource

func (r *ProtocolExtensionRuntime) RemoveSource(source ProtocolSourceInfo)

func (*ProtocolExtensionRuntime) SendCustomMessage

func (*ProtocolExtensionRuntime) SendUserMessage

func (r *ProtocolExtensionRuntime) SendUserMessage(text string, options ProtocolSendUserMessageOptions) error

func (*ProtocolExtensionRuntime) SessionEntries

func (r *ProtocolExtensionRuntime) SessionEntries() []FileEntry

func (*ProtocolExtensionRuntime) SetAbortSignal

func (r *ProtocolExtensionRuntime) SetAbortSignal(done <-chan struct{})

func (*ProtocolExtensionRuntime) SetCLIFlagValues

func (r *ProtocolExtensionRuntime) SetCLIFlagValues(values map[string]any) []ProtocolExtensionFlagDiagnostic

func (*ProtocolExtensionRuntime) SetFlagValue

func (r *ProtocolExtensionRuntime) SetFlagValue(name string, value any)

func (*ProtocolExtensionRuntime) SetSessionName

func (r *ProtocolExtensionRuntime) SetSessionName(name string) error

func (*ProtocolExtensionRuntime) Shortcuts

func (*ProtocolExtensionRuntime) SuggestAutocomplete

func (*ProtocolExtensionRuntime) UnknownCLIFlagDiagnostics

func (r *ProtocolExtensionRuntime) UnknownCLIFlagDiagnostics() []ProtocolExtensionFlagDiagnostic

func (*ProtocolExtensionRuntime) ViewTreeMounts

type ProtocolExtensionSource

type ProtocolExtensionSource struct {
	Path     string
	BaseDir  string
	Metadata ProtocolSourceInfo
	Hidden   bool
}

type ProtocolFlagDefinition

type ProtocolFlagDefinition struct {
	Description string
	Type        string
	Default     any
}

type ProtocolFlagRegistration

type ProtocolFlagRegistration struct {
	Name        string
	Description string
	Type        string
	Default     any
	SourceInfo  ProtocolSourceInfo
}

type ProtocolForkOptions

type ProtocolForkOptions struct {
	Position    string
	WithSession func(ProtocolCommandContext) error
}

type ProtocolInputEvent

type ProtocolInputEvent struct {
	Type   string
	Text   string
	Images []llm.ContentPart
	Source string
}

type ProtocolInputHandler

type ProtocolInputHandler func(ProtocolInputEvent) (ProtocolInputResult, error)

type ProtocolInputResult

type ProtocolInputResult struct {
	Action    string
	Text      string
	Images    []llm.ContentPart
	ImagesSet bool
}

func ProtocolInputContinue

func ProtocolInputContinue() ProtocolInputResult

func ProtocolInputHandled

func ProtocolInputHandled() ProtocolInputResult

func ProtocolInputTransform

func ProtocolInputTransform(text string) ProtocolInputResult

func ProtocolInputTransformWithImages

func ProtocolInputTransformWithImages(text string, images []llm.ContentPart) ProtocolInputResult

type ProtocolMessageRenderer

type ProtocolMessageRenderer func(message any, options any) []string

type ProtocolMessageRendererRegistration

type ProtocolMessageRendererRegistration struct {
	CustomType string
	SourceInfo ProtocolSourceInfo
	Renderer   ProtocolMessageRenderer
}

type ProtocolNewSessionOptions

type ProtocolNewSessionOptions struct {
	ParentSession string
	WithSession   func(ProtocolCommandContext) error
}

type ProtocolPackageProcessExtension

type ProtocolPackageProcessExtension struct {
	ID           string
	Path         string
	PackageDir   string
	Command      []string
	Transport    string
	Protocol     string
	Capabilities []string
	Env          map[string]string
	Metadata     ProtocolSourceInfo
}

type ProtocolPackageResource

type ProtocolPackageResource struct {
	Path     string
	Enabled  bool
	Metadata ProtocolSourceInfo
}

type ProtocolPackageResourceFilters

type ProtocolPackageResourceFilters struct {
	Extensions []string
	Skills     []string
	Prompts    []string
	Themes     []string
	// contains filtered or unexported fields
}

type ProtocolPackageResources

type ProtocolPackageResources struct {
	Extensions        []ProtocolPackageResource
	ProcessExtensions []ProtocolPackageProcessExtension
	Skills            []ProtocolPackageResource
	Prompts           []ProtocolPackageResource
	Themes            []ProtocolPackageResource
}

type ProtocolPackageSourceSpec

type ProtocolPackageSourceSpec struct {
	Source   string
	Scope    string
	Autoload *bool
	Filters  ProtocolPackageResourceFilters
}

type ProtocolProjectTrustContext added in v0.82.0

type ProtocolProjectTrustContext struct {
	CWD     string
	Mode    string
	HasUI   bool
	Select  func(prompt string, options []string) (string, error)
	Confirm func(prompt string) (bool, error)
	Input   func(prompt string) (string, error)
	// InputWithPlaceholder preserves Pi's two-field startup input contract
	// while Input remains the backward-compatible single-prompt form.
	InputWithPlaceholder func(title, placeholder string) (string, error)
	Notify               func(message string) error
}

ProtocolProjectTrustContext describes the startup surface available to a trusted in-process extension. UI functions are optional so print and RPC modes do not need a synthetic terminal implementation.

type ProtocolProjectTrustDecision added in v0.82.0

type ProtocolProjectTrustDecision string

ProtocolProjectTrustDecision is an extension's trust answer.

const (
	// ProtocolProjectTrustYes trusts the project for the current runtime.
	ProtocolProjectTrustYes ProtocolProjectTrustDecision = "yes"
	// ProtocolProjectTrustNo rejects project-local settings and resources.
	ProtocolProjectTrustNo ProtocolProjectTrustDecision = "no"
	// ProtocolProjectTrustUndecided delegates to the next handler or fallback.
	ProtocolProjectTrustUndecided ProtocolProjectTrustDecision = "undecided"
)

type ProtocolProjectTrustResult added in v0.82.0

type ProtocolProjectTrustResult struct {
	Trusted  ProtocolProjectTrustDecision
	Remember bool
}

ProtocolProjectTrustResult is a decisive or fall-through extension result.

type ProtocolProviderOverride

type ProtocolProviderOverride struct {
	BaseURL        string
	APIKey         string
	API            string
	Headers        map[string]string
	AuthHeader     *bool
	Compat         llm.ModelCompat
	Models         []ProviderModelDefinition
	ModelOverrides map[string]ModelOverride
	StreamSimple   func(llm.Model, llm.Context, llm.SimpleStreamOptions) (*llm.AssistantMessageEventStream, error)
}

type ProtocolProviderRegistration

type ProtocolProviderRegistration struct {
	Name       string
	Config     ProtocolProviderOverride
	SourceInfo ProtocolSourceInfo
}

type ProtocolRuntimeError

type ProtocolRuntimeError struct {
	Code    string
	Message string
}

func (ProtocolRuntimeError) Error

func (e ProtocolRuntimeError) Error() string

type ProtocolSendCustomMessageOptions

type ProtocolSendCustomMessageOptions struct {
	TriggerTurn bool
	DeliverAs   string
}

type ProtocolSendUserMessageOptions

type ProtocolSendUserMessageOptions struct {
	DeliverAs string
}

type ProtocolSessionEvent

type ProtocolSessionEvent struct {
	Context               context.Context
	Type                  string
	Reason                string
	WillRetry             bool
	TargetSessionFile     string
	PreviousSessionFile   string
	Prompt                string
	Images                []llm.ContentPart
	SystemPrompt          string
	Messages              []llm.Message
	Message               *llm.Message
	AssistantMessageEvent *llm.AssistantMessageEvent
	EntryID               string
	Position              string
	Role                  string
	Model                 *llm.Model
	PreviousModel         *llm.Model
	SelectSource          string
	ThinkingLevel         string
	PreviousLevel         string
	ToolName              string
	ToolCallID            string
	Input                 map[string]any
	Content               []SDKContentPart
	Details               any
	IsError               bool
	Source                string
	Text                  string
	Command               string
	CWD                   string
	ExcludeFromContext    bool
	Steering              []string
	FollowUp              []string
	Preparation           *agentharness.CompactionPreparation
	BranchEntries         []FileEntry
	CustomInstructions    string
	CompactionEntry       *FileEntry
	FromExtension         bool
	Name                  string
	Payload               any
	Status                int
	Headers               map[string]string
	ProjectTrustContext   *ProtocolProjectTrustContext
}

type ProtocolShortcutDefinition

type ProtocolShortcutDefinition struct {
	Description string
	Handler     func() error
}

type ProtocolShortcutRegistration

type ProtocolShortcutRegistration struct {
	Key         string
	Description string
	SourceInfo  ProtocolSourceInfo
	Handler     func() error
}

type ProtocolShortcutWarning

type ProtocolShortcutWarning struct {
	Key     string
	Message string
}

type ProtocolShortcutsResult

type ProtocolShortcutsResult struct {
	Shortcuts map[string]ProtocolShortcutRegistration
	Warnings  []ProtocolShortcutWarning
}

type ProtocolSourceInfo

type ProtocolSourceInfo struct {
	Path   string `json:"path,omitempty"`
	Source string `json:"source,omitempty"`
	Scope  string `json:"scope,omitempty"`
	Origin string `json:"origin,omitempty"`
}

type ProtocolSwitchSessionOptions

type ProtocolSwitchSessionOptions struct {
	WithSession func(ProtocolCommandContext) error
}

type ProtocolToolDefinition

type ProtocolToolDefinition struct {
	Name               string
	Label              string
	Description        string
	Parameters         llm.Schema
	PromptSnippet      string
	PromptGuidelines   []string
	ExecutionMode      string
	PrepareArguments   func(input map[string]any) map[string]any
	Execute            func(toolCallID string, input map[string]any) (SDKToolResult, error)
	ExecuteWithUpdates func(toolCallID string, input map[string]any, onUpdate func(SDKToolResult)) (SDKToolResult, error)
}

type ProtocolToolRendererDefinition

type ProtocolToolRendererDefinition struct {
	RenderCall   ToolCallRenderer
	RenderResult ToolResultRenderer
}

type ProtocolToolRendererRegistration

type ProtocolToolRendererRegistration struct {
	Name         string
	SourceInfo   ProtocolSourceInfo
	RenderCall   ToolCallRenderer
	RenderResult ToolResultRenderer
}

type ProtocolViewTreeMountRegistration

type ProtocolViewTreeMountRegistration struct {
	MountID    string
	Slot       string
	View       ViewTreeNode
	Priority   int
	Overlay    *ViewTreeOverlayOptions
	SourceInfo ProtocolSourceInfo
}

type ProviderAttributionContext added in v0.82.0

type ProviderAttributionContext = attribution.Context

ProviderAttributionContext is the immutable session and telemetry state used to derive headers for one provider request.

type ProviderConfigInput

type ProviderConfigInput struct {
	Name           string
	BaseURL        string
	APIKey         string
	API            string
	Headers        map[string]string
	AuthHeader     *bool
	OAuth          *OAuthProvider                                                                                  `json:"-"`
	StreamSimple   func(llm.Model, llm.Context, llm.SimpleStreamOptions) (*llm.AssistantMessageEventStream, error) `json:"-"`
	RefreshModels  func(context.Context, llm.RefreshModelsContext) ([]ProviderModelDefinition, error)              `json:"-"`
	Compat         llm.ModelCompat
	Models         []ProviderModelDefinition
	ModelOverrides map[string]ModelOverride
}

type ProviderModelDefinition

type ProviderModelDefinition struct {
	ID               string
	Name             string
	API              string
	BaseURL          string
	Reasoning        bool
	ThinkingLevelMap map[string]*string
	Input            []string
	Cost             llm.ModelCost
	ContextWindow    int
	MaxTokens        int
	Headers          map[string]string
	Compat           llm.ModelCompat
}

type ProviderRequestConfig

type ProviderRequestConfig struct {
	APIKey     string
	Headers    map[string]string
	AuthHeader bool
}

type ProviderRequestSettings added in v0.82.0

type ProviderRequestSettings struct {
	Transport               string
	HTTPProxy               string
	HTTP                    llm.HTTPRuntimeConfig
	RequestTimeout          time.Duration
	WebSocketConnectTimeout *time.Duration
	MaxRetries              int
	MaxRetryDelayMS         int
}

ProviderRequestSettings is one immutable projection of mutable application settings into provider-facing transport and retry policy.

type ProviderRetrySettings

type ProviderRetrySettings struct {
	TimeoutMS       int
	MaxRetries      int
	MaxRetryDelayMS int
}

type QueuedCustomMessage

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

type QueuedUserMessage

type QueuedUserMessage struct {
	Text   string               `json:"text"`
	Images []llm.ContentPart    `json:"images,omitempty"`
	Custom *QueuedCustomMessage `json:"custom,omitempty"`
}

type RPCAvailableModelsResult

type RPCAvailableModelsResult struct {
	Models []llm.Model `json:"models"`
}

type RPCClient

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

func NewRPCClient

func NewRPCClient(sender RPCCommandSender) *RPCClient

func NewRPCProcessClient added in v0.82.0

func NewRPCProcessClient(options RPCProcessOptions) *RPCClient

NewRPCProcessClient creates an RPC client backed by a stopped subprocess.

func (*RPCClient) Abort

func (c *RPCClient) Abort(ctx context.Context) error

func (*RPCClient) AbortBash

func (c *RPCClient) AbortBash(ctx context.Context) error

func (*RPCClient) AbortRetry

func (c *RPCClient) AbortRetry(ctx context.Context) error

func (*RPCClient) Bash

func (c *RPCClient) Bash(ctx context.Context, command string) (BashResult, error)

func (*RPCClient) Clone

func (c *RPCClient) Clone(ctx context.Context) (RPCCloneResult, error)

func (*RPCClient) Compact

func (c *RPCClient) Compact(ctx context.Context, customInstructions string) (agentharness.CompactionResult, error)

func (*RPCClient) CycleModel

func (c *RPCClient) CycleModel(ctx context.Context) (*RPCCycleModelResult, error)

func (*RPCClient) CycleThinkingLevel

func (c *RPCClient) CycleThinkingLevel(ctx context.Context) (*RPCThinkingLevelResult, error)

func (*RPCClient) ExportHTML

func (c *RPCClient) ExportHTML(ctx context.Context, outputPath string) (RPCExportHTMLResult, error)

func (*RPCClient) FollowUp

func (c *RPCClient) FollowUp(ctx context.Context, message string) error

func (*RPCClient) FollowUpWithImages

func (c *RPCClient) FollowUpWithImages(ctx context.Context, message string, images []llm.ContentPart) error

func (*RPCClient) Fork

func (c *RPCClient) Fork(ctx context.Context, entryID string) (RPCForkResult, error)

func (*RPCClient) GetAvailableModels

func (c *RPCClient) GetAvailableModels(ctx context.Context) ([]llm.Model, error)

func (*RPCClient) GetAvailableThinkingLevels added in v0.82.0

func (c *RPCClient) GetAvailableThinkingLevels(ctx context.Context) ([]string, error)

func (*RPCClient) GetCommands

func (c *RPCClient) GetCommands(ctx context.Context) ([]RPCSlashCommand, error)

func (*RPCClient) GetEntries added in v0.82.0

func (c *RPCClient) GetEntries(ctx context.Context, since ...string) (RPCEntriesResult, error)

func (*RPCClient) GetForkMessages

func (c *RPCClient) GetForkMessages(ctx context.Context) ([]AgentSessionForkMessage, error)

func (*RPCClient) GetLastAssistantText

func (c *RPCClient) GetLastAssistantText(ctx context.Context) (*string, error)

func (*RPCClient) GetMessages

func (c *RPCClient) GetMessages(ctx context.Context) ([]llm.Message, error)

func (*RPCClient) GetSessionStats

func (c *RPCClient) GetSessionStats(ctx context.Context) (RPCSessionStats, error)

func (*RPCClient) GetState

func (c *RPCClient) GetState(ctx context.Context) (RPCSessionState, error)

func (*RPCClient) GetStderr added in v0.82.0

func (c *RPCClient) GetStderr() string

func (*RPCClient) GetTree added in v0.82.0

func (c *RPCClient) GetTree(ctx context.Context) (RPCTreeResult, error)

func (*RPCClient) NewSession

func (c *RPCClient) NewSession(ctx context.Context, parentSession string) (RPCCloneResult, error)

func (*RPCClient) OnEvent added in v0.82.0

func (c *RPCClient) OnEvent(listener func(AgentSessionEvent)) func()

func (*RPCClient) Prompt

func (c *RPCClient) Prompt(ctx context.Context, message string) error

func (*RPCClient) PromptWithImages

func (c *RPCClient) PromptWithImages(ctx context.Context, message string, images []llm.ContentPart) error

func (*RPCClient) SetAutoCompaction

func (c *RPCClient) SetAutoCompaction(ctx context.Context, enabled bool) error

func (*RPCClient) SetAutoRetry

func (c *RPCClient) SetAutoRetry(ctx context.Context, enabled bool) error

func (*RPCClient) SetFollowUpMode

func (c *RPCClient) SetFollowUpMode(ctx context.Context, mode string) error

func (*RPCClient) SetModel

func (c *RPCClient) SetModel(ctx context.Context, provider, modelID string) (llm.Model, error)

func (*RPCClient) SetSessionName

func (c *RPCClient) SetSessionName(ctx context.Context, name string) error

func (*RPCClient) SetSteeringMode

func (c *RPCClient) SetSteeringMode(ctx context.Context, mode string) error

func (*RPCClient) SetThinkingLevel

func (c *RPCClient) SetThinkingLevel(ctx context.Context, level string) error

func (*RPCClient) Start added in v0.82.0

func (c *RPCClient) Start(ctx context.Context) error

func (*RPCClient) Steer

func (c *RPCClient) Steer(ctx context.Context, message string) error

func (*RPCClient) SteerWithImages

func (c *RPCClient) SteerWithImages(ctx context.Context, message string, images []llm.ContentPart) error

func (*RPCClient) Stop added in v0.82.0

func (c *RPCClient) Stop(ctx context.Context) error

func (*RPCClient) SwitchSession

func (c *RPCClient) SwitchSession(ctx context.Context, sessionPath string) (RPCCloneResult, error)

type RPCCloneResult

type RPCCloneResult struct {
	Cancelled bool `json:"cancelled"`
}

type RPCCommand

type RPCCommand struct {
	ID                 string            `json:"id,omitempty"`
	Type               string            `json:"type"`
	Message            string            `json:"message,omitempty"`
	StreamingBehavior  string            `json:"streamingBehavior,omitempty"`
	Provider           string            `json:"provider,omitempty"`
	ModelID            string            `json:"modelId,omitempty"`
	Level              string            `json:"level,omitempty"`
	Mode               string            `json:"mode,omitempty"`
	CustomInstructions string            `json:"customInstructions,omitempty"`
	Enabled            *bool             `json:"enabled,omitempty"`
	Command            string            `json:"command,omitempty"`
	Images             []llm.ContentPart `json:"images,omitempty"`
	OutputPath         string            `json:"outputPath,omitempty"`
	SessionPath        string            `json:"sessionPath,omitempty"`
	EntryID            string            `json:"entryId,omitempty"`
	Since              *string           `json:"since,omitempty"`
	Name               string            `json:"name,omitempty"`
	ParentSession      string            `json:"parentSession,omitempty"`
}

type RPCCommandSender

type RPCCommandSender interface {
	SendRPCCommand(context.Context, RPCCommand) (RPCResponse, error)
}

type RPCCommandSenderFunc

type RPCCommandSenderFunc func(context.Context, RPCCommand) (RPCResponse, error)

func (RPCCommandSenderFunc) SendRPCCommand

func (f RPCCommandSenderFunc) SendRPCCommand(ctx context.Context, command RPCCommand) (RPCResponse, error)

type RPCCommandsResult

type RPCCommandsResult struct {
	Commands []RPCSlashCommand `json:"commands"`
}

type RPCCycleModelResult

type RPCCycleModelResult struct {
	Model         llm.Model `json:"model"`
	ThinkingLevel string    `json:"thinkingLevel"`
	IsScoped      bool      `json:"isScoped"`
}

type RPCEntriesResult added in v0.82.0

type RPCEntriesResult = SessionEntriesSnapshot

type RPCExportHTMLResult

type RPCExportHTMLResult struct {
	Path string `json:"path"`
}

type RPCForkMessagesResult

type RPCForkMessagesResult struct {
	Messages []AgentSessionForkMessage `json:"messages"`
}

type RPCForkResult

type RPCForkResult struct {
	Text      string `json:"text"`
	Cancelled bool   `json:"cancelled"`
}

type RPCLastAssistantTextResult

type RPCLastAssistantTextResult struct {
	Text *string `json:"text"`
}

type RPCLineProcessor

type RPCLineProcessor struct {
	Host                *RPCSessionHost
	Runtime             *ProtocolExtensionRuntime
	SourceInfo          ProtocolSourceInfo
	WriteLine           func(string)
	OnBeforeHostAction  func(HostActionRequest)
	OnHostAction        func(HostActionRequest, HostActionResponse)
	AllowedCapabilities []string
	EnforceCapabilities bool
	RequestTimeout      time.Duration
	// contains filtered or unexported fields
}

func (*RPCLineProcessor) HandleLine

func (p *RPCLineProcessor) HandleLine(ctx context.Context, line string)

func (*RPCLineProcessor) WriteEvent

func (p *RPCLineProcessor) WriteEvent(event AgentSessionEvent)

type RPCMessagesResult

type RPCMessagesResult struct {
	Messages []llm.Message `json:"messages"`
}

type RPCProcessExitError added in v0.82.0

type RPCProcessExitError struct {
	Code   *int
	Signal string
	Stderr string
	Cause  error
}

RPCProcessExitError records the stable process state and stderr tail observed when an RPC subprocess exits unexpectedly.

func (*RPCProcessExitError) Error added in v0.82.0

func (e *RPCProcessExitError) Error() string

func (*RPCProcessExitError) Unwrap added in v0.82.0

func (e *RPCProcessExitError) Unwrap() error

type RPCProcessOptions added in v0.82.0

type RPCProcessOptions struct {
	Command         string
	Args            []string
	CWD             string
	Env             map[string]string
	RequestTimeout  time.Duration
	ShutdownTimeout time.Duration
	Stderr          io.Writer
}

RPCProcessOptions configures the subprocess transport used by RPCClient. A nil Args slice starts the current executable with "--mode rpc".

type RPCProcessTransport added in v0.82.0

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

RPCProcessTransport owns subprocess lifecycle and JSONL response routing. RPCClient remains a typed protocol facade and delegates transport state here.

func NewRPCProcessTransport added in v0.82.0

func NewRPCProcessTransport(options RPCProcessOptions) *RPCProcessTransport

NewRPCProcessTransport creates a stopped subprocess transport.

func (*RPCProcessTransport) GetStderr added in v0.82.0

func (t *RPCProcessTransport) GetStderr() string

func (*RPCProcessTransport) OnEvent added in v0.82.0

func (t *RPCProcessTransport) OnEvent(listener func(AgentSessionEvent)) func()

func (*RPCProcessTransport) SendRPCCommand added in v0.82.0

func (t *RPCProcessTransport) SendRPCCommand(ctx context.Context, command RPCCommand) (RPCResponse, error)

func (*RPCProcessTransport) Start added in v0.82.0

func (t *RPCProcessTransport) Start(ctx context.Context) error

func (*RPCProcessTransport) Stop added in v0.82.0

type RPCResponse

type RPCResponse struct {
	ID      string          `json:"id,omitempty"`
	Type    string          `json:"type"`
	Command string          `json:"command"`
	Success bool            `json:"success"`
	Error   string          `json:"error,omitempty"`
	Data    json.RawMessage `json:"data,omitempty"`
}

type RPCScopedModel

type RPCScopedModel struct {
	Model         llm.Model
	ThinkingLevel string
}

type RPCSessionHost

type RPCSessionHost struct {
	Session               *AgentSession
	Settings              *SettingsManager
	SteeringMode          string
	FollowUpMode          string
	AutoCompactionEnabled bool
	AvailableModels       []llm.Model
	ScopedModels          []RPCScopedModel
	ProviderAuthStatus    AuthStatusResolver
	PromptPreflight       func(RPCCommand) error
	ViewTreeHost          *ViewTreeHost
	TUIEditor             TUIEditorHost
	TUIDialog             TUIDialogHost
	TUITitle              TUITitleHost
	TUIWorking            TUIWorkingHost
	TUIThinkingLabel      TUIThinkingLabelHost
	TUIStatus             TUIStatusHost
	TUITheme              TUIThemeHost
	TUIToolExpansion      TUIToolExpansionHost
	ProcessExecutor       HostProcessExecutor
	PolicyRequester       HostPolicyRequester
	ReloadSession         func() error
	// contains filtered or unexported fields
}

func NewRPCSessionHost

func NewRPCSessionHost(session *AgentSession) *RPCSessionHost

func (*RPCSessionHost) AcceptPrompt

func (h *RPCSessionHost) AcceptPrompt(command RPCCommand) error

func (*RPCSessionHost) Bash

func (h *RPCSessionHost) Bash(ctx context.Context, command string) (BashResult, error)

func (*RPCSessionHost) Clone

func (h *RPCSessionHost) Clone() (RPCCloneResult, error)

func (*RPCSessionHost) CycleModel

func (h *RPCSessionHost) CycleModel() (*RPCCycleModelResult, error)

func (*RPCSessionHost) CycleModelDirection

func (h *RPCSessionHost) CycleModelDirection(direction string) (*RPCCycleModelResult, error)

func (*RPCSessionHost) CycleThinkingLevel

func (h *RPCSessionHost) CycleThinkingLevel() (string, error)

func (*RPCSessionHost) ExportHTML

func (h *RPCSessionHost) ExportHTML(outputPath string) (string, error)

func (*RPCSessionHost) ExportJSONL

func (h *RPCSessionHost) ExportJSONL(outputPath string) (string, error)

func (*RPCSessionHost) Fork

func (h *RPCSessionHost) Fork(entryID string) (RPCForkResult, error)

func (*RPCSessionHost) GetAvailableThinkingLevels added in v0.82.0

func (h *RPCSessionHost) GetAvailableThinkingLevels() []string

func (*RPCSessionHost) GetCommands

func (h *RPCSessionHost) GetCommands() RPCCommandsResult

func (*RPCSessionHost) GetEntries added in v0.82.0

func (h *RPCSessionHost) GetEntries(since *string) (RPCEntriesResult, error)

func (*RPCSessionHost) GetLastAssistantText

func (h *RPCSessionHost) GetLastAssistantText() *string

func (*RPCSessionHost) GetSessionStats

func (h *RPCSessionHost) GetSessionStats() RPCSessionStats

func (*RPCSessionHost) GetState

func (h *RPCSessionHost) GetState() RPCSessionState

func (*RPCSessionHost) GetTree added in v0.82.0

func (h *RPCSessionHost) GetTree() (RPCTreeResult, error)

func (*RPCSessionHost) HandleCommand

func (h *RPCSessionHost) HandleCommand(ctx context.Context, command RPCCommand) RPCResponse

func (*RPCSessionHost) HandleHostAction

func (h *RPCSessionHost) HandleHostAction(request HostActionRequest) HostActionResponse

func (*RPCSessionHost) HandleHostActionContext

func (h *RPCSessionHost) HandleHostActionContext(ctx context.Context, request HostActionRequest) HostActionResponse

func (*RPCSessionHost) OnSessionReplaced

func (h *RPCSessionHost) OnSessionReplaced(listener func(*AgentSession)) func()

func (*RPCSessionHost) SetAutoCompaction

func (h *RPCSessionHost) SetAutoCompaction(enabled *bool) error

func (*RPCSessionHost) SetAutoRetry

func (h *RPCSessionHost) SetAutoRetry(enabled *bool) error

func (*RPCSessionHost) SetFollowUpMode

func (h *RPCSessionHost) SetFollowUpMode(mode string) error

func (*RPCSessionHost) SetModel

func (h *RPCSessionHost) SetModel(provider, modelID string) (llm.Model, error)

func (*RPCSessionHost) SetSteeringMode

func (h *RPCSessionHost) SetSteeringMode(mode string) error

func (*RPCSessionHost) SetThinkingLevel

func (h *RPCSessionHost) SetThinkingLevel(level string) error

func (*RPCSessionHost) SubscribeEvents

func (h *RPCSessionHost) SubscribeEvents(listener func(AgentSessionEvent)) func()

func (*RPCSessionHost) SwitchSession

func (h *RPCSessionHost) SwitchSession(sessionPath string) (RPCCloneResult, error)

type RPCSessionState

type RPCSessionState struct {
	Model                 *llm.Model `json:"model,omitempty"`
	ThinkingLevel         string     `json:"thinkingLevel"`
	IsStreaming           bool       `json:"isStreaming"`
	IsCompacting          bool       `json:"isCompacting"`
	SteeringMode          string     `json:"steeringMode"`
	FollowUpMode          string     `json:"followUpMode"`
	SessionFile           string     `json:"sessionFile,omitempty"`
	SessionID             string     `json:"sessionId"`
	SessionName           string     `json:"sessionName,omitempty"`
	AutoCompactionEnabled bool       `json:"autoCompactionEnabled"`
	MessageCount          int        `json:"messageCount"`
	PendingMessageCount   int        `json:"pendingMessageCount"`
}

type RPCSessionStats

type RPCSessionStats struct {
	SessionFile       string             `json:"sessionFile,omitempty"`
	SessionID         string             `json:"sessionId"`
	UserMessages      int                `json:"userMessages"`
	AssistantMessages int                `json:"assistantMessages"`
	ToolCalls         int                `json:"toolCalls"`
	ToolResults       int                `json:"toolResults"`
	TotalMessages     int                `json:"totalMessages"`
	Tokens            RPCSessionTokens   `json:"tokens"`
	Cost              float64            `json:"cost"`
	ContextUsage      *AgentContextUsage `json:"contextUsage,omitempty"`
}

type RPCSessionTokens

type RPCSessionTokens struct {
	Input      int `json:"input"`
	Output     int `json:"output"`
	CacheRead  int `json:"cacheRead"`
	CacheWrite int `json:"cacheWrite"`
	Total      int `json:"total"`
}

type RPCSlashCommand

type RPCSlashCommand struct {
	Name         string `json:"name"`
	Description  string `json:"description,omitempty"`
	ArgumentHint string `json:"argumentHint,omitempty"`
	Source       string `json:"source"`
	SourceInfo   any    `json:"sourceInfo"`
}

type RPCThinkingLevelResult

type RPCThinkingLevelResult struct {
	Level string `json:"level"`
}

type RPCThinkingLevelsResult added in v0.82.0

type RPCThinkingLevelsResult struct {
	Levels []string `json:"levels"`
}

type RPCTreeResult added in v0.82.0

type RPCTreeResult = SessionTreeSnapshot

type ReadTool

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

func NewReadTool

func NewReadTool(cwd string, operations ...FileToolOperations) ReadTool

func NewReadToolWithOptions

func NewReadToolWithOptions(cwd string, options ReadToolOptions, operations ...FileToolOperations) ReadTool

func (ReadTool) Execute

func (t ReadTool) Execute(toolCallID string, input ReadToolInput) (FileToolResult, error)

type ReadToolInput

type ReadToolInput struct {
	Path   string
	Offset int
	Limit  int
}

type ReadToolOptions

type ReadToolOptions struct {
	AutoResizeImages *bool
}

type ReadToolTruncation

type ReadToolTruncation = agentharness.TruncationResult

type ResizedImage

type ResizedImage = imageresize.ResizedImage

func ResizeImage

func ResizeImage(part llm.ContentPart, options ...ImageResizeOptions) *ResizedImage

func ResizeImageBytes added in v0.82.0

func ResizeImageBytes(data []byte, mimeType string, options ...ImageResizeOptions) *ResizedImage

type ResolveCLIModelOptions

type ResolveCLIModelOptions = modelresolver.ResolveCLIModelOptions

type ResolveCLIModelResult

type ResolveCLIModelResult = modelresolver.ResolveCLIModelResult

func ResolveCLIModel

func ResolveCLIModel(options ResolveCLIModelOptions) ResolveCLIModelResult

type ResolveExtensionSourcesOptions

type ResolveExtensionSourcesOptions struct {
	Temporary bool
}

type ResolveModelScopeResult added in v0.82.0

type ResolveModelScopeResult = modelresolver.ResolveModelScopeResult

func ResolveModelScopeWithDiagnostics added in v0.82.0

func ResolveModelScopeWithDiagnostics(patterns []string, registry CodingModelRegistry) ResolveModelScopeResult

type ResolveProjectTrustOptions added in v0.82.0

type ResolveProjectTrustOptions struct {
	CWD                 string
	TrustStore          *ProjectTrustStore
	TrustOverride       *bool
	DefaultProjectTrust DefaultProjectTrust
	Prompt              ProjectTrustPrompt
	ExtensionRuntime    *ProtocolExtensionRuntime
	ExtensionContext    ProtocolProjectTrustContext
	OnExtensionError    func(ProtocolExtensionError)
}

type ResolvedRequestAuth

type ResolvedRequestAuth struct {
	OK             bool
	APIKey         string
	Headers        map[string]string
	HeaderRemovals []string
	BaseURL        string
	Env            llm.ProviderEnv
	Error          string
}

type ResourceAgentsFilesResult

type ResourceAgentsFilesResult struct {
	AgentsFiles []ResourceContextFile
}

type ResourceConfigSnapshot added in v0.82.0

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

ResourceConfigSnapshot is an immutable pair of resource projections. The selector owns presentation state; SettingsManager remains the only owner of persisted configuration.

func (ResourceConfigSnapshot) InheritedEnabled added in v0.82.0

func (s ResourceConfigSnapshot) InheritedEnabled(item PackageResourceToggleItem) (bool, bool)

InheritedEnabled returns the effective user-layer state for item. The boolean result distinguishes a matched global resource from the fallback used for project-only resources.

func (ResourceConfigSnapshot) IsInherited added in v0.82.0

IsInherited reports whether item participates in the user-layer projection.

func (ResourceConfigSnapshot) Items added in v0.82.0

Items returns a copy of the selected projection so UI updates cannot mutate the canonical snapshot.

func (ResourceConfigSnapshot) Target added in v0.82.0

Target returns the canonical mutation input for an item in this snapshot.

type ResourceConfigTarget added in v0.82.0

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

ResourceConfigTarget binds a resolved resource to the inherited state from the snapshot that displayed it. Project mutations accept this value so a UI cannot accidentally calculate path/source encoding from unrelated state.

func (ResourceConfigTarget) InheritedEnabled added in v0.82.0

func (t ResourceConfigTarget) InheritedEnabled() bool

InheritedEnabled returns target's effective user-layer enabled state.

func (ResourceConfigTarget) IsInherited added in v0.82.0

func (t ResourceConfigTarget) IsInherited() bool

IsInherited reports whether target has a matching user-layer resource.

func (ResourceConfigTarget) Resource added in v0.82.0

Resource returns a copy of the resolved resource represented by target.

type ResourceConfigWriteScope added in v0.82.0

type ResourceConfigWriteScope string

ResourceConfigWriteScope identifies which settings layer the resource selector mutates. The project view is an effective projection: it includes inherited user resources plus project-local resources and overrides.

const (
	ResourceConfigWriteGlobal  ResourceConfigWriteScope = "global"
	ResourceConfigWriteProject ResourceConfigWriteScope = "project"
)

type ResourceContextFile

type ResourceContextFile struct {
	Path    string
	Content string
}

type ResourceExtension

type ResourceExtension struct {
	ExtensionPaths []ResourceExtensionPath
	SkillPaths     []ResourceSkillPath
	PromptPaths    []ResourcePromptPath
	ThemePaths     []ResourceThemePath
}

type ResourceExtensionPath

type ResourceExtensionPath struct {
	Path     string
	Metadata ProtocolSourceInfo
}

type ResourceExtensionsResult

type ResourceExtensionsResult struct {
	Extensions        []ProtocolExtensionSource
	ProcessExtensions []ProtocolPackageProcessExtension
	Errors            []ProtocolExtensionDiscoveryError
	Runtime           *ProtocolExtensionRuntime
}

type ResourceLoaderProjectTrustInput added in v0.82.0

type ResourceLoaderProjectTrustInput struct {
	ExtensionsResult ResourceExtensionsResult
}

ResourceLoaderProjectTrustInput exposes the safe pre-trust extension snapshot to the decision callback.

type ResourceLoaderReloadOptions added in v0.82.0

type ResourceLoaderReloadOptions struct {
	ResolveProjectTrust func(ResourceLoaderProjectTrustInput) (bool, error)
}

ResourceLoaderReloadOptions configures one serialized reload transaction.

type ResourcePromptPath

type ResourcePromptPath struct {
	Path     string
	Metadata ProtocolSourceInfo
}

type ResourcePromptsResult

type ResourcePromptsResult struct {
	Prompts []PromptTemplate
}

type ResourceSkillPath

type ResourceSkillPath struct {
	Path     string
	Metadata ProtocolSourceInfo
}

type ResourceSkillsResult

type ResourceSkillsResult = AgentSessionSkillsResult

type ResourceTheme

type ResourceTheme struct {
	Name       string
	SourcePath string
}

type ResourceThemePath

type ResourceThemePath struct {
	Path     string
	Metadata ProtocolSourceInfo
}

type ResourceThemesResult

type ResourceThemesResult struct {
	Themes      []ResourceTheme
	Diagnostics []agentharness.SkillDiagnostic
}

type RetryStatusIndicator added in v0.82.0

type RetryStatusIndicator struct {
	*StatusIndicator
	// contains filtered or unexported fields
}

RetryStatusIndicator renders retry activity and owns its countdown.

func NewRetryStatusIndicator added in v0.82.0

func NewRetryStatusIndicator(
	ui *gitui.TUI,
	attempt int,
	maxAttempts int,
	delay time.Duration,
) *RetryStatusIndicator

NewRetryStatusIndicator constructs a retry indicator with a live countdown.

func (*RetryStatusIndicator) Dispose added in v0.82.0

func (s *RetryStatusIndicator) Dispose()

Dispose stops both the countdown and loader animation.

type SDKAgent

type SDKAgent struct {
	State SDKAgentState
}

type SDKAgentState

type SDKAgentState struct {
	SystemPrompt  string
	Model         llm.Model
	ThinkingLevel string
	Tools         []SDKTool
}

type SDKContentPart

type SDKContentPart struct {
	Type string
	Text string
}

type SDKTool

type SDKTool struct {
	Name               string
	Label              string
	Description        string
	Parameters         llm.Schema
	PromptSnippet      string
	PromptGuidelines   []string
	ExecutionMode      string
	SourceInfo         ProtocolSourceInfo
	PrepareArguments   func(input map[string]any) map[string]any
	Execute            func(toolCallID string, input map[string]any) (SDKToolResult, error)
	ExecuteWithUpdates func(toolCallID string, input map[string]any, onUpdate func(SDKToolResult)) (SDKToolResult, error)
}

type SDKToolResult

type SDKToolResult struct {
	Content []SDKContentPart
	Details any
}

type SandboxEnvReader

type SandboxEnvReader = sandboxenv.Reader

type ScopedModel

type ScopedModel = modelresolver.ScopedModel

func ResolveModelScope

func ResolveModelScope(patterns []string, registry CodingModelRegistry) []ScopedModel

type ScopedModelsSelectorCallbacks

type ScopedModelsSelectorCallbacks struct {
	OnChange  func([]string)
	OnPersist func([]string)
	OnCancel  func()
}

type ScopedModelsSelectorComponent

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

func (*ScopedModelsSelectorComponent) EnabledModelIDs

func (c *ScopedModelsSelectorComponent) EnabledModelIDs() []string

func (*ScopedModelsSelectorComponent) Focused

func (c *ScopedModelsSelectorComponent) Focused() bool

func (*ScopedModelsSelectorComponent) HandleInput

func (c *ScopedModelsSelectorComponent) HandleInput(data string)

func (*ScopedModelsSelectorComponent) Invalidate

func (c *ScopedModelsSelectorComponent) Invalidate()

func (*ScopedModelsSelectorComponent) Render

func (c *ScopedModelsSelectorComponent) Render(width int) []string

func (*ScopedModelsSelectorComponent) SetFocused

func (c *ScopedModelsSelectorComponent) SetFocused(focused bool)

type ScopedModelsSelectorConfig

type ScopedModelsSelectorConfig struct {
	AllModels       []llm.Model
	EnabledModelIDs []string
	Keybindings     KeybindingsConfig
}

type SelfUpdateCommand

type SelfUpdateCommand struct {
	Command string
	Args    []string
	Display string
	Steps   []SelfUpdateCommandStep
}

func GetSelfUpdateCommand

func GetSelfUpdateCommand(packageName string, env InstallEnvironment, _ []string, updatePackageName string) *SelfUpdateCommand

func GetSelfUpdateCommandForTarget added in v0.82.0

func GetSelfUpdateCommandForTarget(packageName string, _ InstallEnvironment, target SelfUpdatePackageTarget) *SelfUpdateCommand

GetSelfUpdateCommandForTarget preserves the typed update target at the command-generation boundary. Gi intentionally does not execute Node package manager self-updates, so no environment currently produces a command.

type SelfUpdateCommandStep

type SelfUpdateCommandStep struct {
	Command string
	Args    []string
	Display string
}

type SelfUpdateOptions

type SelfUpdateOptions struct {
	PackageName         string
	CurrentVersion      string
	Force               bool
	Environment         InstallEnvironment
	VersionCheck        VersionReleaseChecker
	VersionCheckOptions VersionCheckOptions
}

type SelfUpdatePackageTarget added in v0.82.0

type SelfUpdatePackageTarget struct {
	PackageName string
	InstallSpec string
}

SelfUpdatePackageTarget separates the package identity used to replace an installation from the exact spec a package manager would install.

type SelfUpdateResult

type SelfUpdateResult struct {
	Updated     bool
	PackageName string
}

type SessionContext

type SessionContext struct {
	Messages      []any
	ThinkingLevel string
	Model         *SessionModel
}

func BuildSessionContext

func BuildSessionContext(entries []FileEntry, leafID *string, byID map[string]FileEntry) SessionContext

func BuildSessionContextWithOptions added in v0.82.0

func BuildSessionContextWithOptions(
	entries []FileEntry,
	leafID *string,
	byID map[string]FileEntry,
	options SessionContextOptions,
) SessionContext

type SessionContextOptions added in v0.82.0

type SessionContextOptions struct {
	ExcludeEntryIDs map[string]struct{}
}

SessionContextOptions controls the projection from the append-only session tree into the live provider context. Exclusions do not mutate persisted history; they only hide selected entries from the model-facing view.

type SessionEntriesSnapshot added in v0.82.0

type SessionEntriesSnapshot struct {
	Entries []FileEntry `json:"entries"`
	LeafID  *string     `json:"leafId"`
}

SessionEntriesSnapshot is a detached append-order view of a session and the leaf selected in the same locked manager revision.

type SessionHeader

type SessionHeader struct {
	Type          string `json:"type"`
	Version       int    `json:"version,omitempty"`
	ID            string `json:"id"`
	Timestamp     string `json:"timestamp"`
	CWD           string `json:"cwd"`
	ParentSession string `json:"parentSession,omitempty"`
}

type SessionHeaderScanLimitError added in v0.82.0

type SessionHeaderScanLimitError struct {
	Path  string
	Limit int
}

SessionHeaderScanLimitError identifies a file whose first parsed entry could not be discovered within the bounded header scan. Callers opening an explicit file may fall back to a full streaming load; directory discovery should skip the file.

func (*SessionHeaderScanLimitError) Error added in v0.82.0

type SessionImportFileNotFoundError

type SessionImportFileNotFoundError struct {
	Path string
}

func (SessionImportFileNotFoundError) Error

type SessionInfo

type SessionInfo struct {
	Path              string
	ID                string
	CWD               string
	Name              string
	ParentSessionPath string
	Created           time.Time
	Modified          time.Time
	MessageCount      int
	FirstMessage      string
	AllMessagesText   string
}

func BuildSessionInfo

func BuildSessionInfo(filePath string) (*SessionInfo, error)

func FilterAndSortSessions

func FilterAndSortSessions(sessions []SessionInfo, query string, sortMode SessionSelectorSortMode, filters ...SessionSelectorNameFilter) []SessionInfo

func ListAllSessions

func ListAllSessions(args ...any) []SessionInfo

func ListSessions

func ListSessions(cwd string, args ...any) []SessionInfo

type SessionListProgress

type SessionListProgress func(loaded int, total int)

type SessionManager

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

func ContinueRecentSession

func ContinueRecentSession(cwd string, sessionDir ...string) (*SessionManager, error)

func CreateSessionManager

func CreateSessionManager(cwd string, sessionDir ...string) (*SessionManager, error)

func CreateSessionManagerWithOptions added in v0.82.0

func CreateSessionManagerWithOptions(
	cwd, sessionDir string,
	options NewSessionOptions,
) (*SessionManager, error)

CreateSessionManagerWithOptions creates a persisted session with explicit identity or parent metadata.

func ForkSessionFrom

func ForkSessionFrom(sourcePath, targetCwd string, sessionDir ...string) (*SessionManager, error)

func ForkSessionFromWithOptions added in v0.82.0

func ForkSessionFromWithOptions(
	sourcePath, targetCwd string,
	options NewSessionOptions,
	sessionDir ...string,
) (*SessionManager, error)

ForkSessionFromWithOptions copies a session into a new exclusively-created file and optionally assigns a portable custom ID.

func InMemorySessionManager

func InMemorySessionManager(cwd ...string) (*SessionManager, error)

func InMemorySessionManagerWithOptions added in v0.82.0

func InMemorySessionManagerWithOptions(
	cwd string,
	options NewSessionOptions,
) (*SessionManager, error)

InMemorySessionManagerWithOptions creates a non-persisted session with explicit identity or parent metadata.

func OpenSessionManager

func OpenSessionManager(path string, args ...string) (*SessionManager, error)

func (*SessionManager) AppendCompaction

func (s *SessionManager) AppendCompaction(summary, firstKeptEntryID string, tokensBefore int) string

func (*SessionManager) AppendCompactionWithOptions added in v0.82.0

func (s *SessionManager) AppendCompactionWithOptions(
	summary,
	firstKeptEntryID string,
	tokensBefore int,
	options SessionSummaryOptions,
) string

func (*SessionManager) AppendCustomEntry

func (s *SessionManager) AppendCustomEntry(customType string, data any) string

func (*SessionManager) AppendCustomMessageEntry

func (s *SessionManager) AppendCustomMessageEntry(customType string, content any, display bool, details any) string

func (*SessionManager) AppendCustomMessageEntryWithContext

func (s *SessionManager) AppendCustomMessageEntryWithContext(customType string, content any, display bool, details any, includeInContext bool) string

func (*SessionManager) AppendLabelChange

func (s *SessionManager) AppendLabelChange(targetID, label string) (string, error)

func (*SessionManager) AppendMessage

func (s *SessionManager) AppendMessage(message any) string

func (*SessionManager) AppendModelChange

func (s *SessionManager) AppendModelChange(provider, modelID string) string

func (*SessionManager) AppendSessionInfo

func (s *SessionManager) AppendSessionInfo(name string) string

func (*SessionManager) AppendThinkingLevelChange

func (s *SessionManager) AppendThinkingLevelChange(thinkingLevel string) string

func (*SessionManager) Branch

func (s *SessionManager) Branch(branchFromID string) error

func (*SessionManager) BranchWithSummary

func (s *SessionManager) BranchWithSummary(branchFromID *string, summary string) (string, error)

func (*SessionManager) BranchWithSummaryOptions added in v0.82.0

func (s *SessionManager) BranchWithSummaryOptions(
	branchFromID *string,
	summary string,
	options SessionSummaryOptions,
) (string, error)

func (*SessionManager) BuildContextEntries added in v0.82.0

func (s *SessionManager) BuildContextEntries() []FileEntry

BuildContextEntries returns the active, compaction-aware entry projection. The snapshot is captured under one read lock so branch navigation cannot produce a path assembled from different session states.

func (*SessionManager) BuildSessionContext

func (s *SessionManager) BuildSessionContext() SessionContext

func (*SessionManager) BuildSessionContextWithOptions added in v0.82.0

func (s *SessionManager) BuildSessionContextWithOptions(
	options SessionContextOptions,
) SessionContext

func (*SessionManager) CreateBranchedSession

func (s *SessionManager) CreateBranchedSession(leafID string) (string, error)

func (*SessionManager) ForkAtEntry

func (s *SessionManager) ForkAtEntry(entryID string) (*SessionManager, error)

func (*SessionManager) ForkBeforeEntry

func (s *SessionManager) ForkBeforeEntry(entryID string) (*SessionManager, error)

func (*SessionManager) GetBranch

func (s *SessionManager) GetBranch(fromID ...string) []FileEntry

func (*SessionManager) GetCWD

func (s *SessionManager) GetCWD() string

func (*SessionManager) GetChildren

func (s *SessionManager) GetChildren(parentID string) []FileEntry

func (*SessionManager) GetCwd

func (s *SessionManager) GetCwd() string

func (*SessionManager) GetEntries

func (s *SessionManager) GetEntries() []FileEntry

func (*SessionManager) GetEntriesSnapshot added in v0.82.0

func (s *SessionManager) GetEntriesSnapshot() SessionEntriesSnapshot

func (*SessionManager) GetEntry

func (s *SessionManager) GetEntry(id string) *FileEntry

func (*SessionManager) GetHeader

func (s *SessionManager) GetHeader() *SessionHeader

func (*SessionManager) GetLabel

func (s *SessionManager) GetLabel(id string) (string, bool)

func (*SessionManager) GetLeafEntry

func (s *SessionManager) GetLeafEntry() *FileEntry

func (*SessionManager) GetLeafID

func (s *SessionManager) GetLeafID() *string

func (*SessionManager) GetLeafId

func (s *SessionManager) GetLeafId() *string

func (*SessionManager) GetSessionDir

func (s *SessionManager) GetSessionDir() string

func (*SessionManager) GetSessionFile

func (s *SessionManager) GetSessionFile() string

func (*SessionManager) GetSessionID

func (s *SessionManager) GetSessionID() string

func (*SessionManager) GetSessionId

func (s *SessionManager) GetSessionId() string

func (*SessionManager) GetSessionName

func (s *SessionManager) GetSessionName() string

func (*SessionManager) GetTree

func (s *SessionManager) GetTree() []*SessionTreeNode

func (*SessionManager) GetTreeSnapshot added in v0.82.0

func (s *SessionManager) GetTreeSnapshot() SessionTreeSnapshot

func (*SessionManager) IsPersisted

func (s *SessionManager) IsPersisted() bool

func (*SessionManager) NewSession

func (s *SessionManager) NewSession(options ...NewSessionOptions) (string, error)

NewSession replaces the active in-memory state after validating all supplied identity metadata. Persisted content is created lazily on the first response.

func (*SessionManager) ResetLeaf

func (s *SessionManager) ResetLeaf()

func (*SessionManager) SetSessionFile

func (s *SessionManager) SetSessionFile(sessionFile string) error

func (*SessionManager) UsesDefaultSessionDir added in v0.82.0

func (s *SessionManager) UsesDefaultSessionDir() bool

UsesDefaultSessionDir reports whether this manager owns the canonical per-working-directory store. It is pure and does not create directories.

type SessionModel

type SessionModel struct {
	Provider string
	ModelID  string
}

type SessionSelectorComponent

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

func NewLoadingSessionSelectorComponent

func NewLoadingSessionSelectorComponent(currentLoader, allLoader SessionSelectorLoader, options SessionSelectorOptions) *SessionSelectorComponent

func NewSessionSelectorComponent

func NewSessionSelectorComponent(sessions []SessionInfo, options SessionSelectorOptions) *SessionSelectorComponent

func (*SessionSelectorComponent) GetSessionList

func (*SessionSelectorComponent) HandleInput

func (s *SessionSelectorComponent) HandleInput(input string)

func (*SessionSelectorComponent) Invalidate

func (s *SessionSelectorComponent) Invalidate()

func (*SessionSelectorComponent) IsAllLoading

func (s *SessionSelectorComponent) IsAllLoading() bool

func (*SessionSelectorComponent) Render

func (s *SessionSelectorComponent) Render(width int) []string

func (*SessionSelectorComponent) Scope

func (s *SessionSelectorComponent) Scope() string

func (*SessionSelectorComponent) SetNameFilter

func (s *SessionSelectorComponent) SetNameFilter(filter SessionSelectorNameFilter)

func (*SessionSelectorComponent) SetSortMode

type SessionSelectorLoader

type SessionSelectorLoader func(SessionListProgress) ([]SessionInfo, error)

type SessionSelectorNameFilter

type SessionSelectorNameFilter string
const (
	SessionSelectorNameAll   SessionSelectorNameFilter = "all"
	SessionSelectorNameNamed SessionSelectorNameFilter = "named"
)

type SessionSelectorOptions

type SessionSelectorOptions struct {
	ShowRenameHint             bool
	RenameSession              func(path, name string) error
	DeleteSession              func(path string) error
	Keybindings                KeybindingsConfig
	OnDeleteConfirmationChange func(path *string)
	OnError                    func(message string)
	OnSelect                   func(path string)
	OnCancel                   func()
	RequestRender              func()
	CurrentSessionPath         string
}

type SessionSelectorSortMode

type SessionSelectorSortMode string
const (
	SessionSelectorSortThreaded  SessionSelectorSortMode = "threaded"
	SessionSelectorSortRecent    SessionSelectorSortMode = "recent"
	SessionSelectorSortRelevance SessionSelectorSortMode = "relevance"
)

type SessionSummaryOptions added in v0.82.0

type SessionSummaryOptions struct {
	Details  any
	FromHook bool
	Usage    *llm.Usage
}

type SessionTreeNode

type SessionTreeNode struct {
	Entry          FileEntry          `json:"entry"`
	Children       []*SessionTreeNode `json:"children"`
	Label          string             `json:"label,omitempty"`
	LabelTimestamp string             `json:"labelTimestamp,omitempty"`
}

type SessionTreeSnapshot added in v0.82.0

type SessionTreeSnapshot struct {
	Tree   []*SessionTreeNode `json:"tree"`
	LeafID *string            `json:"leafId"`
}

SessionTreeSnapshot is a detached tree projection and the leaf selected in the same locked manager revision.

type SettingsError

type SettingsError struct {
	Scope string
	Err   error
}

type SettingsManager

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

func NewInMemorySettingsManager

func NewInMemorySettingsManager(settings map[string]any) *SettingsManager

func NewSettingsManager

func NewSettingsManager(cwd, agentDir string) *SettingsManager

func NewSettingsManagerWithOptions added in v0.82.0

func NewSettingsManagerWithOptions(cwd, agentDir string, options SettingsManagerOptions) *SettingsManager

func (*SettingsManager) ApplyFirstTimeSetup added in v0.82.0

func (s *SettingsManager) ApplyFirstTimeSetup(result FirstTimeSetupResult) error

ApplyFirstTimeSetup persists the complete onboarding result with one global settings write, so theme and analytics cannot observe different setup runs.

func (*SettingsManager) DrainErrors

func (s *SettingsManager) DrainErrors() []SettingsError

func (*SettingsManager) Flush

func (s *SettingsManager) Flush() error

func (*SettingsManager) GetAutocompleteMaxVisible

func (s *SettingsManager) GetAutocompleteMaxVisible() int

func (*SettingsManager) GetBlockImages

func (s *SettingsManager) GetBlockImages() bool

func (*SettingsManager) GetBranchSummarySkipPrompt

func (s *SettingsManager) GetBranchSummarySkipPrompt() bool

func (*SettingsManager) GetClearOnShrink

func (s *SettingsManager) GetClearOnShrink() bool

func (*SettingsManager) GetCollapseChangelog

func (s *SettingsManager) GetCollapseChangelog() bool

func (*SettingsManager) GetCompactionEnabled added in v0.82.0

func (s *SettingsManager) GetCompactionEnabled() bool

func (*SettingsManager) GetCompactionKeepRecentTokens added in v0.82.0

func (s *SettingsManager) GetCompactionKeepRecentTokens() int

func (*SettingsManager) GetCompactionReserveTokens added in v0.82.0

func (s *SettingsManager) GetCompactionReserveTokens() int

func (*SettingsManager) GetCompactionSettings added in v0.82.0

func (s *SettingsManager) GetCompactionSettings() agentharness.CompactionSettings

func (*SettingsManager) GetDefaultModel

func (s *SettingsManager) GetDefaultModel() string

func (*SettingsManager) GetDefaultProjectTrust added in v0.82.0

func (s *SettingsManager) GetDefaultProjectTrust() DefaultProjectTrust

func (*SettingsManager) GetDefaultProvider

func (s *SettingsManager) GetDefaultProvider() string

func (*SettingsManager) GetDefaultThinkingLevel

func (s *SettingsManager) GetDefaultThinkingLevel() string

func (*SettingsManager) GetDoubleEscapeAction

func (s *SettingsManager) GetDoubleEscapeAction() string

func (*SettingsManager) GetEditorPaddingX

func (s *SettingsManager) GetEditorPaddingX() int

func (*SettingsManager) GetEnableAnalytics added in v0.82.0

func (s *SettingsManager) GetEnableAnalytics() bool

func (*SettingsManager) GetEnableInstallTelemetry

func (s *SettingsManager) GetEnableInstallTelemetry() bool

func (*SettingsManager) GetEnableSkillCommands

func (s *SettingsManager) GetEnableSkillCommands() bool

func (*SettingsManager) GetEnabledModels

func (s *SettingsManager) GetEnabledModels() []string

func (*SettingsManager) GetExtensionPaths

func (s *SettingsManager) GetExtensionPaths() []string

func (*SettingsManager) GetExternalEditorCommand added in v0.82.0

func (s *SettingsManager) GetExternalEditorCommand() string

func (*SettingsManager) GetFollowUpMode added in v0.82.0

func (s *SettingsManager) GetFollowUpMode() string

func (*SettingsManager) GetGlobalSettings added in v0.82.0

func (s *SettingsManager) GetGlobalSettings() map[string]any

func (*SettingsManager) GetHTTPIdleTimeoutMS

func (s *SettingsManager) GetHTTPIdleTimeoutMS() int

GetHTTPIdleTimeoutMS is the legacy millisecond accessor. New request paths use HTTPIdleTimeout or providerRequestSettings so malformed configuration is returned to the caller.

func (*SettingsManager) GetHTTPProxy added in v0.82.0

func (s *SettingsManager) GetHTTPProxy() string

GetHTTPProxy returns only the global proxy setting. Project settings cannot redirect process-wide traffic, matching Pi's trust boundary.

func (*SettingsManager) GetHideThinkingBlock

func (s *SettingsManager) GetHideThinkingBlock() bool

func (*SettingsManager) GetImageAutoResize

func (s *SettingsManager) GetImageAutoResize() bool

func (*SettingsManager) GetImageWidthCells

func (s *SettingsManager) GetImageWidthCells() int

func (*SettingsManager) GetLastChangelogVersion

func (s *SettingsManager) GetLastChangelogVersion() string

func (*SettingsManager) GetOutputPad added in v0.82.0

func (s *SettingsManager) GetOutputPad() int

func (*SettingsManager) GetPackages

func (s *SettingsManager) GetPackages() []any

func (*SettingsManager) GetProjectSettings added in v0.82.0

func (s *SettingsManager) GetProjectSettings() map[string]any

func (*SettingsManager) GetProviderRetrySettings

func (s *SettingsManager) GetProviderRetrySettings() ProviderRetrySettings

func (*SettingsManager) GetQuietStartup

func (s *SettingsManager) GetQuietStartup() bool

func (*SettingsManager) GetRetryEnabled

func (s *SettingsManager) GetRetryEnabled() bool

func (*SettingsManager) GetRetrySettings

func (s *SettingsManager) GetRetrySettings() AgentSessionRetrySettings

func (*SettingsManager) GetSessionDir

func (s *SettingsManager) GetSessionDir() string

func (*SettingsManager) GetShellCommandPrefix

func (s *SettingsManager) GetShellCommandPrefix() string

func (*SettingsManager) GetShowCacheMissNotices added in v0.82.0

func (s *SettingsManager) GetShowCacheMissNotices() bool

func (*SettingsManager) GetShowHardwareCursor

func (s *SettingsManager) GetShowHardwareCursor() bool

func (*SettingsManager) GetShowImages

func (s *SettingsManager) GetShowImages() bool

func (*SettingsManager) GetShowTerminalProgress

func (s *SettingsManager) GetShowTerminalProgress() bool

func (*SettingsManager) GetSteeringMode added in v0.82.0

func (s *SettingsManager) GetSteeringMode() string

func (*SettingsManager) GetTheme

func (s *SettingsManager) GetTheme() string

GetTheme returns only a fixed theme name. Automatic light/dark pairs are resolved by the interactive theme controller against terminal state.

func (*SettingsManager) GetThemeSetting added in v0.82.0

func (s *SettingsManager) GetThemeSetting() (string, bool)

GetThemeSetting returns the raw theme setting. The boolean distinguishes an absent setting from an explicitly stored empty value.

func (*SettingsManager) GetTrackingID added in v0.82.0

func (s *SettingsManager) GetTrackingID() string

func (*SettingsManager) GetTransport

func (s *SettingsManager) GetTransport() string

func (*SettingsManager) GetTreeFilterMode

func (s *SettingsManager) GetTreeFilterMode() string

func (*SettingsManager) GetWarnings

func (s *SettingsManager) GetWarnings() WarningSettings

func (*SettingsManager) HTTPIdleTimeout added in v0.82.0

func (s *SettingsManager) HTTPIdleTimeout() (time.Duration, error)

HTTPIdleTimeout returns the validated Go-native timeout value. Zero means disabled. Invalid persisted settings are surfaced instead of silently changing request behavior.

func (*SettingsManager) IsProjectTrusted added in v0.82.0

func (s *SettingsManager) IsProjectTrusted() bool

func (*SettingsManager) Reload

func (s *SettingsManager) Reload()

func (*SettingsManager) SetAutocompleteMaxVisible

func (s *SettingsManager) SetAutocompleteMaxVisible(visible int)

func (*SettingsManager) SetBlockImages

func (s *SettingsManager) SetBlockImages(blocked bool)

func (*SettingsManager) SetBranchSummarySkipPrompt

func (s *SettingsManager) SetBranchSummarySkipPrompt(skip bool)

func (*SettingsManager) SetClearOnShrink

func (s *SettingsManager) SetClearOnShrink(enabled bool)

func (*SettingsManager) SetCollapseChangelog

func (s *SettingsManager) SetCollapseChangelog(collapsed bool)

func (*SettingsManager) SetCompactionEnabled added in v0.82.0

func (s *SettingsManager) SetCompactionEnabled(enabled bool)

func (*SettingsManager) SetDefaultModel

func (s *SettingsManager) SetDefaultModel(model string)

func (*SettingsManager) SetDefaultProjectTrust added in v0.82.0

func (s *SettingsManager) SetDefaultProjectTrust(defaultProjectTrust DefaultProjectTrust)

func (*SettingsManager) SetDefaultProvider

func (s *SettingsManager) SetDefaultProvider(provider string)

func (*SettingsManager) SetDefaultThinkingLevel

func (s *SettingsManager) SetDefaultThinkingLevel(level string)

func (*SettingsManager) SetDoubleEscapeAction

func (s *SettingsManager) SetDoubleEscapeAction(action string)

func (*SettingsManager) SetEditorPaddingX

func (s *SettingsManager) SetEditorPaddingX(padding int)

func (*SettingsManager) SetEnableAnalytics added in v0.82.0

func (s *SettingsManager) SetEnableAnalytics(enabled bool)

SetEnableAnalytics updates the preference and its stable identifier as one locked state transition. Disabling analytics intentionally retains the identifier so a later opt-in resumes the same anonymous identity.

func (*SettingsManager) SetEnableInstallTelemetry

func (s *SettingsManager) SetEnableInstallTelemetry(enabled bool)

func (*SettingsManager) SetEnableSkillCommands

func (s *SettingsManager) SetEnableSkillCommands(enabled bool)

func (*SettingsManager) SetEnabledModels

func (s *SettingsManager) SetEnabledModels(models []string)

func (*SettingsManager) SetFollowUpMode added in v0.82.0

func (s *SettingsManager) SetFollowUpMode(mode string)

func (*SettingsManager) SetHTTPIdleTimeoutMS

func (s *SettingsManager) SetHTTPIdleTimeoutMS(timeoutMS int) error

func (*SettingsManager) SetHideThinkingBlock

func (s *SettingsManager) SetHideThinkingBlock(hidden bool)

func (*SettingsManager) SetImageAutoResize

func (s *SettingsManager) SetImageAutoResize(enabled bool)

func (*SettingsManager) SetImageWidthCells

func (s *SettingsManager) SetImageWidthCells(width int)

func (*SettingsManager) SetLastChangelogVersion

func (s *SettingsManager) SetLastChangelogVersion(version string)

func (*SettingsManager) SetOutputPad added in v0.82.0

func (s *SettingsManager) SetOutputPad(padding int)

func (*SettingsManager) SetPackages

func (s *SettingsManager) SetPackages(packages []any)

func (*SettingsManager) SetProjectExtensionPaths

func (s *SettingsManager) SetProjectExtensionPaths(paths []string) error

func (*SettingsManager) SetProjectPackages

func (s *SettingsManager) SetProjectPackages(packages []any) error

func (*SettingsManager) SetProjectPromptTemplatePaths added in v0.82.0

func (s *SettingsManager) SetProjectPromptTemplatePaths(paths []string) error

func (*SettingsManager) SetProjectSkillPaths added in v0.82.0

func (s *SettingsManager) SetProjectSkillPaths(paths []string) error

func (*SettingsManager) SetProjectThemePaths added in v0.82.0

func (s *SettingsManager) SetProjectThemePaths(paths []string) error

func (*SettingsManager) SetProjectTrusted added in v0.82.0

func (s *SettingsManager) SetProjectTrusted(trusted bool)

func (*SettingsManager) SetQuietStartup

func (s *SettingsManager) SetQuietStartup(enabled bool)

func (*SettingsManager) SetRetryEnabled

func (s *SettingsManager) SetRetryEnabled(enabled bool)

func (*SettingsManager) SetShowCacheMissNotices added in v0.82.0

func (s *SettingsManager) SetShowCacheMissNotices(show bool)

func (*SettingsManager) SetShowHardwareCursor

func (s *SettingsManager) SetShowHardwareCursor(enabled bool)

func (*SettingsManager) SetShowImages

func (s *SettingsManager) SetShowImages(enabled bool)

func (*SettingsManager) SetShowTerminalProgress

func (s *SettingsManager) SetShowTerminalProgress(enabled bool)

func (*SettingsManager) SetSteeringMode added in v0.82.0

func (s *SettingsManager) SetSteeringMode(mode string)

func (*SettingsManager) SetTheme

func (s *SettingsManager) SetTheme(theme string)

func (*SettingsManager) SetTransport

func (s *SettingsManager) SetTransport(transport string)

func (*SettingsManager) SetTreeFilterMode

func (s *SettingsManager) SetTreeFilterMode(mode string)

func (*SettingsManager) SetWarningAnthropicExtraUsage

func (s *SettingsManager) SetWarningAnthropicExtraUsage(enabled bool)

func (*SettingsManager) SetWarnings

func (s *SettingsManager) SetWarnings(warnings WarningSettings)

func (*SettingsManager) WebSocketConnectTimeout added in v0.82.0

func (s *SettingsManager) WebSocketConnectTimeout() (*time.Duration, error)

WebSocketConnectTimeout returns nil when the setting is absent and a non-nil zero duration when connection timeouts are explicitly disabled.

type SettingsManagerOptions added in v0.82.0

type SettingsManagerOptions struct {
	ProjectTrusted bool
}

type SourceInfo

type SourceInfo struct {
	Path   string
	Source string
	Scope  string
	Origin string
}

type StatusIndicator added in v0.82.0

type StatusIndicator struct {
	*gitui.Loader
	// contains filtered or unexported fields
}

StatusIndicator is the common state and loader lifecycle shared by every transient status shown in the interactive status slot.

func NewStatusIndicator added in v0.82.0

func NewStatusIndicator(
	kind StatusIndicatorKind,
	message string,
	options gitui.LoaderIndicatorOptions,
) *StatusIndicator

NewStatusIndicator constructs the common loader owned by a transient status.

func (*StatusIndicator) Dispose added in v0.82.0

func (s *StatusIndicator) Dispose()

Dispose stops the loader animation.

func (*StatusIndicator) StatusKind added in v0.82.0

func (s *StatusIndicator) StatusKind() StatusIndicatorKind

StatusKind returns the semantic owner of the shared status slot.

type StatusIndicatorKind added in v0.82.0

type StatusIndicatorKind string

StatusIndicatorKind identifies the semantic owner of the shared status slot.

const (
	// StatusIndicatorKindWorking identifies the normal agent activity indicator.
	StatusIndicatorKindWorking StatusIndicatorKind = "working"
	// StatusIndicatorKindRetry identifies an auto-retry countdown.
	StatusIndicatorKindRetry StatusIndicatorKind = "retry"
	// StatusIndicatorKindCompaction identifies context compaction activity.
	StatusIndicatorKindCompaction StatusIndicatorKind = "compaction"
	// StatusIndicatorKindBranchSummary identifies branch summarization activity.
	StatusIndicatorKindBranchSummary StatusIndicatorKind = "branchSummary"
)

type SystemPromptContextFile

type SystemPromptContextFile struct {
	Path    string
	Content string
}

type SystemPromptDocumentationPath

type SystemPromptDocumentationPath struct {
	Label  string
	Path   string
	Detail string
}

type SystemPromptSkill

type SystemPromptSkill struct {
	Name        string
	Description string
	Content     string
}

type TUIDialogHost

type TUIDialogHost interface {
	RunTUIDialog(request TUIDialogRequest) (TUIDialogResult, error)
}

type TUIDialogOption

type TUIDialogOption struct {
	ID          string `json:"id"`
	Label       string `json:"label"`
	Description string `json:"description,omitempty"`
	Value       any    `json:"value,omitempty"`
}

type TUIDialogRequest

type TUIDialogRequest struct {
	Kind         string            `json:"kind"`
	Type         string            `json:"type,omitempty"`
	Title        string            `json:"title,omitempty"`
	Message      string            `json:"message,omitempty"`
	Placeholder  string            `json:"placeholder,omitempty"`
	Options      []TUIDialogOption `json:"options,omitempty"`
	DefaultValue any               `json:"defaultValue,omitempty"`
	Timeout      int               `json:"timeout,omitempty"`
}

type TUIDialogResult

type TUIDialogResult struct {
	Action   string `json:"action"`
	OptionID string `json:"optionId,omitempty"`
	Value    any    `json:"value,omitempty"`
}

type TUIEditorCursorHost

type TUIEditorCursorHost interface {
	EditorCursor() (line, col int, ok bool)
}

type TUIEditorCustomStateHost

type TUIEditorCustomStateHost interface {
	EditorCustomActive() bool
}

type TUIEditorFocusHost

type TUIEditorFocusHost interface {
	FocusEditor() error
	EditorFocused() bool
}

type TUIEditorHost

type TUIEditorHost interface {
	ReadEditorText() string
	SetEditorText(text string)
	InsertEditorText(text string)
	SubmitEditorText() error
}

type TUIEditorPasteHost

type TUIEditorPasteHost interface {
	PasteEditorText(text string)
}

type TUIRenderRequester added in v0.82.0

type TUIRenderRequester interface {
	RequestRender(force ...bool)
}

TUIRenderRequester is the narrow rendering dependency needed by countdowns.

type TUIStatusHost

type TUIStatusHost interface {
	SetTUIStatus(key, text string) error
}

type TUIThemeHost

type TUIThemeHost interface {
	CurrentTUITheme() string
	AvailableTUIThemes() []TUIThemeInfo
	SetTUITheme(name string) error
}

type TUIThemeInfo

type TUIThemeInfo struct {
	Name    string `json:"name"`
	Path    string `json:"path,omitempty"`
	Builtin bool   `json:"builtin,omitempty"`
}

type TUIThinkingLabelHost

type TUIThinkingLabelHost interface {
	SetHiddenThinkingLabel(label string) error
}

type TUITitleHost

type TUITitleHost interface {
	SetTUITitle(title string) error
}

type TUIToolExpansionHost

type TUIToolExpansionHost interface {
	TUIToolsExpanded() bool
	SetTUIToolsExpanded(expanded bool) error
}

type TUIWorkingHost

type TUIWorkingHost interface {
	SetTUIWorking(update TUIWorkingUpdate) error
}

type TUIWorkingIndicatorOptions

type TUIWorkingIndicatorOptions struct {
	Frames     []string `json:"frames,omitempty"`
	IntervalMs int      `json:"intervalMs,omitempty"`
}

type TUIWorkingUpdate

type TUIWorkingUpdate struct {
	Message        string
	MessageSet     bool
	ResetMessage   bool
	Visible        bool
	VisibleSet     bool
	Indicator      TUIWorkingIndicatorOptions
	IndicatorSet   bool
	ResetIndicator bool
}

type TerminalAutoThemeDetector added in v0.82.0

type TerminalAutoThemeDetector interface {
	TerminalBackgroundThemeDetector
	QueryTerminalColorScheme(context.Context) (gitui.TerminalColorScheme, bool, error)
}

type TerminalBackgroundThemeDetector added in v0.82.0

type TerminalBackgroundThemeDetector interface {
	QueryTerminalBackgroundColor(context.Context) (gitui.RGBColor, bool, error)
}

type TerminalTheme added in v0.82.0

type TerminalTheme string
const (
	TerminalThemeDark  TerminalTheme = "dark"
	TerminalThemeLight TerminalTheme = "light"
)

func DetectTerminalThemeForAuto added in v0.82.0

func DetectTerminalThemeForAuto(
	ctx context.Context,
	detector TerminalAutoThemeDetector,
	timeout time.Duration,
	environment map[string]string,
) TerminalTheme

DetectTerminalThemeForAuto first asks terminals that expose a color-scheme capability, then uses OSC 11 and finally COLORFGBG.

func GetThemeForRGBColor added in v0.82.0

func GetThemeForRGBColor(color gitui.RGBColor) TerminalTheme

type TerminalThemeDetection added in v0.82.0

type TerminalThemeDetection struct {
	Theme      TerminalTheme
	Source     string
	Detail     string
	Confidence string
}

func DetectTerminalBackgroundFromEnv added in v0.82.0

func DetectTerminalBackgroundFromEnv(environment map[string]string) TerminalThemeDetection

DetectTerminalBackgroundFromEnv derives the theme from the last valid COLORFGBG field. A nil environment reads the process environment; an empty map intentionally represents an environment without hints.

func DetectTerminalBackgroundTheme added in v0.82.0

func DetectTerminalBackgroundTheme(
	ctx context.Context,
	detector TerminalBackgroundThemeDetector,
	timeout time.Duration,
	environment map[string]string,
) TerminalThemeDetection

DetectTerminalBackgroundTheme prefers a terminal OSC 11 response and falls back to the immutable environment snapshot supplied by the caller.

type ThemeExportColors

type ThemeExportColors struct {
	PageBg *string
	CardBg *string
	InfoBg *string
}

func GetThemeExportColors

func GetThemeExportColors(themeName, agentDir string) (ThemeExportColors, error)

type TmuxOptionReader

type TmuxOptionReader = tmux.OptionReader

type ToolCallRenderer

type ToolCallRenderer func(args any, context ToolRenderContext) []string

type ToolDefinition

type ToolDefinition struct {
	Name             string
	Description      string
	Parameters       llm.Schema
	PrepareArguments func(args any) any
	Execute          func(callID string, args any) (FileToolResult, error)
	RenderCall       ToolCallRenderer
	RenderResult     ToolResultRenderer
}

func CreateBashToolDefinition

func CreateBashToolDefinition(cwd string, options ...BashToolOptions) ToolDefinition

func CreateEditToolDefinition

func CreateEditToolDefinition(cwd string, operations ...FileToolOperations) ToolDefinition

func CreateReadToolDefinition

func CreateReadToolDefinition(cwd string, operations ...FileToolOperations) ToolDefinition

func CreateWriteToolDefinition

func CreateWriteToolDefinition(cwd string, operations ...FileToolOperations) ToolDefinition

type ToolExecutionComponent

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

func NewToolExecutionComponent

func NewToolExecutionComponent(name, callID string, args any, definition ToolDefinition, cwd string, options ...ToolExecutionOptions) *ToolExecutionComponent

func (*ToolExecutionComponent) Invalidate

func (c *ToolExecutionComponent) Invalidate()

func (*ToolExecutionComponent) MarkExecutionStarted

func (c *ToolExecutionComponent) MarkExecutionStarted()

func (*ToolExecutionComponent) Render

func (c *ToolExecutionComponent) Render(width int) []string

func (*ToolExecutionComponent) SetArgsComplete

func (c *ToolExecutionComponent) SetArgsComplete()

func (*ToolExecutionComponent) SetExpanded

func (c *ToolExecutionComponent) SetExpanded(expanded bool)

func (*ToolExecutionComponent) SetImageWidthCells

func (c *ToolExecutionComponent) SetImageWidthCells(width int)

func (*ToolExecutionComponent) SetShowImages

func (c *ToolExecutionComponent) SetShowImages(show bool)

func (*ToolExecutionComponent) UpdateArgs

func (c *ToolExecutionComponent) UpdateArgs(args any)

func (*ToolExecutionComponent) UpdatePartialResult

func (c *ToolExecutionComponent) UpdatePartialResult(result FileToolResult, isError bool) bool

func (*ToolExecutionComponent) UpdateResult

func (c *ToolExecutionComponent) UpdateResult(result FileToolResult, isError bool) bool

func (*ToolExecutionComponent) UpdateResultWithOptions

func (c *ToolExecutionComponent) UpdateResultWithOptions(result FileToolResult, isError, isPartial bool) bool

type ToolExecutionOptions

type ToolExecutionOptions struct {
	ShowImages      *bool
	ImageWidthCells int
}

type ToolRenderContext

type ToolRenderContext struct {
	Args             any
	ToolCallID       string
	State            map[string]any
	CWD              string
	ArgsComplete     bool
	IsPartial        bool
	Expanded         bool
	ShowImages       bool
	IsError          bool
	PreflightDiff    *EditDiffResult
	ExecutionStarted bool
}

type ToolRenderResultOptions

type ToolRenderResultOptions struct {
	Expanded  bool
	IsPartial bool
}

type ToolResultRenderer

type ToolResultRenderer func(result FileToolResult, options ToolRenderResultOptions, context ToolRenderContext) []string

type TopLevelResourceToggle

type TopLevelResourceToggle struct {
	Scope        string
	ResourceType string
	Pattern      string
	Enabled      bool
}

type TreeSelectorComponent

type TreeSelectorComponent struct {
	OnSelect      func(entryID string)
	OnCancel      func()
	OnCopy        func(text *string)
	OnLabelChange func(entryID, label string) error
	OnError       func(error)
	// contains filtered or unexported fields
}

TreeSelectorComponent owns the mutable presentation state for session-tree navigation. Session persistence and clipboard I/O stay behind host callbacks.

func NewTreeSelectorComponent

func NewTreeSelectorComponent(roots []*SessionTreeNode, currentLeafID string, options ...TreeSelectorOptions) *TreeSelectorComponent

func (*TreeSelectorComponent) Focused

func (s *TreeSelectorComponent) Focused() bool

func (*TreeSelectorComponent) GetTreeList

func (s *TreeSelectorComponent) GetTreeList() *TreeSelectorList

func (*TreeSelectorComponent) HandleInput

func (s *TreeSelectorComponent) HandleInput(input string)

func (*TreeSelectorComponent) Invalidate

func (s *TreeSelectorComponent) Invalidate()

func (*TreeSelectorComponent) Render

func (s *TreeSelectorComponent) Render(width int) []string

func (*TreeSelectorComponent) SetFilter

func (s *TreeSelectorComponent) SetFilter(filter TreeSelectorFilter)

func (*TreeSelectorComponent) SetFocused

func (s *TreeSelectorComponent) SetFocused(focused bool)

func (*TreeSelectorComponent) SetSelectedID added in v0.82.0

func (s *TreeSelectorComponent) SetSelectedID(entryID string)

SetSelectedID moves selection to an entry or its nearest visible ancestor.

type TreeSelectorFilter

type TreeSelectorFilter string
const (
	TreeSelectorDefaultFilter TreeSelectorFilter = "default"
	TreeSelectorNoToolsFilter TreeSelectorFilter = "no-tools"
	TreeSelectorUserFilter    TreeSelectorFilter = "user-only"
	TreeSelectorLabelFilter   TreeSelectorFilter = "labeled-only"
	TreeSelectorAllFilter     TreeSelectorFilter = "all"
)

type TreeSelectorHelp added in v0.82.0

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

TreeSelectorHelp renders keybinding-aware semantic help rows.

func (*TreeSelectorHelp) Invalidate added in v0.82.0

func (h *TreeSelectorHelp) Invalidate()

func (*TreeSelectorHelp) Render added in v0.82.0

func (h *TreeSelectorHelp) Render(width int) []string

type TreeSelectorList

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

TreeSelectorList exposes the current derived tree projection to callers that need selection, search, copy, or label operations.

func (*TreeSelectorList) CopySelected added in v0.82.0

func (l *TreeSelectorList) CopySelected()

func (*TreeSelectorList) GetSearchQuery added in v0.82.0

func (l *TreeSelectorList) GetSearchQuery() string

func (*TreeSelectorList) GetSelectedNode

func (l *TreeSelectorList) GetSelectedNode() *SessionTreeNode

func (*TreeSelectorList) Invalidate added in v0.82.0

func (l *TreeSelectorList) Invalidate()

func (*TreeSelectorList) Render

func (l *TreeSelectorList) Render(width int) []string

func (*TreeSelectorList) UpdateNodeLabel added in v0.82.0

func (l *TreeSelectorList) UpdateNodeLabel(entryID, label string)

type TreeSelectorOptions

type TreeSelectorOptions struct {
	Keybindings     KeybindingsConfig
	MaxVisibleLines int
}

type TriggerCompactExtension

type TriggerCompactExtension struct {
	ThresholdTokens int
	// contains filtered or unexported fields
}

func NewTriggerCompactExtension

func NewTriggerCompactExtension(thresholdTokens int) *TriggerCompactExtension

func (*TriggerCompactExtension) OnTurnEnd

func (e *TriggerCompactExtension) OnTurnEnd(tokens *int, compact func())

type UsageCostBreakdownEntry added in v0.82.0

type UsageCostBreakdownEntry struct {
	Key    string  `json:"key"`
	Cost   float64 `json:"cost"`
	Tokens int     `json:"tokens"`
}

UsageCostBreakdownEntry attributes billed usage to a concrete model or to application-owned work such as tools and summaries.

type UserMessageComponent

type UserMessageComponent struct {
	Text string
	// contains filtered or unexported fields
}

func NewUserMessageComponent

func NewUserMessageComponent(text string) UserMessageComponent

func (UserMessageComponent) Render

func (c UserMessageComponent) Render(width int) []string

func (*UserMessageComponent) SetOutputPad added in v0.82.0

func (c *UserMessageComponent) SetOutputPad(padding int)

type UserMessageSelectorComponent

type UserMessageSelectorComponent struct {
	OnSelect func(entryID string)
	OnCancel func()
	// contains filtered or unexported fields
}

func NewUserMessageSelectorComponent

func NewUserMessageSelectorComponent(messages []AgentSessionForkMessage, initialSelectedID string) *UserMessageSelectorComponent

func (*UserMessageSelectorComponent) Focused

func (c *UserMessageSelectorComponent) Focused() bool

func (*UserMessageSelectorComponent) HandleInput

func (c *UserMessageSelectorComponent) HandleInput(data string)

func (*UserMessageSelectorComponent) Invalidate

func (c *UserMessageSelectorComponent) Invalidate()

func (*UserMessageSelectorComponent) Render

func (c *UserMessageSelectorComponent) Render(width int) []string

func (*UserMessageSelectorComponent) SetFocused

func (c *UserMessageSelectorComponent) SetFocused(focused bool)

type VersionCheckOptions

type VersionCheckOptions = versioncheck.Options

type VersionReleaseChecker

type VersionReleaseChecker func(currentVersion string, options VersionCheckOptions) (LatestGiRelease, bool)

type ViewTreeChange

type ViewTreeChange struct {
	Type    string
	MountID string
	Slot    string
}

type ViewTreeComponent

type ViewTreeComponent struct {
	View    ViewTreeNode
	Host    *ViewTreeHost
	MountID string
	// contains filtered or unexported fields
}

func NewMountedViewTreeComponent

func NewMountedViewTreeComponent(host *ViewTreeHost, mountID string) *ViewTreeComponent

func NewViewTreeComponent

func NewViewTreeComponent(view ViewTreeNode) *ViewTreeComponent

func (*ViewTreeComponent) Focused

func (c *ViewTreeComponent) Focused() bool

func (*ViewTreeComponent) HandleInput

func (c *ViewTreeComponent) HandleInput(data string)

func (*ViewTreeComponent) Invalidate

func (c *ViewTreeComponent) Invalidate()

func (*ViewTreeComponent) Render

func (c *ViewTreeComponent) Render(width int) []string

func (*ViewTreeComponent) SetFocused

func (c *ViewTreeComponent) SetFocused(focused bool)

type ViewTreeEvent

type ViewTreeEvent struct {
	MountID string         `json:"mountId"`
	NodeID  string         `json:"nodeId,omitempty"`
	Event   string         `json:"event"`
	Data    map[string]any `json:"data,omitempty"`
}

type ViewTreeFocus

type ViewTreeFocus struct {
	MountID string `json:"mountId"`
	NodeID  string `json:"nodeId,omitempty"`
}

type ViewTreeHost

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

func NewViewTreeHost

func NewViewTreeHost() *ViewTreeHost

func (*ViewTreeHost) Blur

func (h *ViewTreeHost) Blur(mountID, nodeID string) error

func (*ViewTreeHost) DispatchEvent

func (h *ViewTreeHost) DispatchEvent(mountID, nodeID, event string, data map[string]any) error

func (*ViewTreeHost) DispatchResize

func (h *ViewTreeHost) DispatchResize(width, height int) error

func (*ViewTreeHost) DispatchThemeChange

func (h *ViewTreeHost) DispatchThemeChange(name string) error

func (*ViewTreeHost) DispatchTick

func (h *ViewTreeHost) DispatchTick(frame int64) error

func (*ViewTreeHost) DispatchVisibilityChange

func (h *ViewTreeHost) DispatchVisibilityChange(mountID string, visible bool, reason string) error

func (*ViewTreeHost) Events

func (h *ViewTreeHost) Events() []ViewTreeEvent

func (*ViewTreeHost) Focus

func (h *ViewTreeHost) Focus(mountID, nodeID string) error

func (*ViewTreeHost) Focused

func (h *ViewTreeHost) Focused() ViewTreeFocus

func (*ViewTreeHost) HasEventSubscription

func (h *ViewTreeHost) HasEventSubscription(event string) bool

func (*ViewTreeHost) Mount

func (h *ViewTreeHost) Mount(mountID, slot string, view ViewTreeNode) error

func (*ViewTreeHost) MountWithOptions

func (h *ViewTreeHost) MountWithOptions(mountID, slot string, view ViewTreeNode, options ...ViewTreeMountOptions) error

func (*ViewTreeHost) Mounted

func (h *ViewTreeHost) Mounted(mountID string) (ViewTreeMount, bool)

func (*ViewTreeHost) MountsBySlot

func (h *ViewTreeHost) MountsBySlot(slot string) []ViewTreeMount

func (*ViewTreeHost) OnChange

func (h *ViewTreeHost) OnChange(listener func(ViewTreeChange)) func()

func (*ViewTreeHost) OnEvent

func (h *ViewTreeHost) OnEvent(listener func(ViewTreeEvent)) func()

func (*ViewTreeHost) Patch

func (h *ViewTreeHost) Patch(mountID string, ops []ViewTreePatchOperation) error

func (*ViewTreeHost) RenderMount

func (h *ViewTreeHost) RenderMount(mountID string, width int) ([]string, error)

func (*ViewTreeHost) SetStatus

func (h *ViewTreeHost) SetStatus(key, text string, priority int) error

func (*ViewTreeHost) Unmount

func (h *ViewTreeHost) Unmount(mountID string) bool

type ViewTreeItem

type ViewTreeItem struct {
	Node *ViewTreeNode
	Item *ViewTreeListItem
}

func (ViewTreeItem) MarshalJSON

func (i ViewTreeItem) MarshalJSON() ([]byte, error)

func (*ViewTreeItem) UnmarshalJSON

func (i *ViewTreeItem) UnmarshalJSON(data []byte) error

type ViewTreeListItem

type ViewTreeListItem struct {
	ID       string             `json:"id"`
	Text     string             `json:"text,omitempty"`
	Checked  *bool              `json:"checked,omitempty"`
	Disabled bool               `json:"disabled,omitempty"`
	Children []ViewTreeListItem `json:"children,omitempty"`
}

type ViewTreeMount

type ViewTreeMount struct {
	MountID  string
	Slot     string
	View     ViewTreeNode
	Priority int
	Overlay  *ViewTreeOverlayOptions
}

type ViewTreeMountOptions

type ViewTreeMountOptions struct {
	Priority int
	Overlay  *ViewTreeOverlayOptions
}

type ViewTreeNode

type ViewTreeNode struct {
	Type     string                `json:"type"`
	ID       string                `json:"id,omitempty"`
	Text     string                `json:"text,omitempty"`
	Label    string                `json:"label,omitempty"`
	Value    *float64              `json:"value,omitempty"`
	Children []ViewTreeNode        `json:"children,omitempty"`
	Items    []ViewTreeItem        `json:"items,omitempty"`
	Columns  []ViewTreeTableColumn `json:"columns,omitempty"`
	Rows     []map[string]any      `json:"rows,omitempty"`
	Style    *ViewTreeStyle        `json:"style,omitempty"`
	Fallback *ViewTreeNode         `json:"fallback,omitempty"`
	Events   []string              `json:"events,omitempty"`
}

type ViewTreeOverlayMargin

type ViewTreeOverlayMargin struct {
	Set    bool
	Top    int
	Right  int
	Bottom int
	Left   int
}

func (*ViewTreeOverlayMargin) UnmarshalJSON

func (m *ViewTreeOverlayMargin) UnmarshalJSON(data []byte) error

type ViewTreeOverlayOptions

type ViewTreeOverlayOptions struct {
	Width        ViewTreeSizeValue     `json:"width,omitempty"`
	MinWidth     int                   `json:"minWidth,omitempty"`
	MaxHeight    ViewTreeSizeValue     `json:"maxHeight,omitempty"`
	Anchor       string                `json:"anchor,omitempty"`
	OffsetX      int                   `json:"offsetX,omitempty"`
	OffsetY      int                   `json:"offsetY,omitempty"`
	Row          ViewTreeSizeValue     `json:"row,omitempty"`
	Col          ViewTreeSizeValue     `json:"col,omitempty"`
	Margin       ViewTreeOverlayMargin `json:"margin,omitempty"`
	NonCapturing bool                  `json:"nonCapturing,omitempty"`
}

type ViewTreePatchOperation

type ViewTreePatchOperation struct {
	Op    string `json:"op"`
	Path  string `json:"path"`
	Value any    `json:"value,omitempty"`
}

type ViewTreeSizeValue

type ViewTreeSizeValue struct {
	Set          bool
	Value        int
	Percent      bool
	PercentValue float64
}

func (*ViewTreeSizeValue) UnmarshalJSON

func (v *ViewTreeSizeValue) UnmarshalJSON(data []byte) error

type ViewTreeStyle

type ViewTreeStyle struct {
	FG        string `json:"fg,omitempty"`
	BG        string `json:"bg,omitempty"`
	Bold      bool   `json:"bold,omitempty"`
	Italic    bool   `json:"italic,omitempty"`
	Underline bool   `json:"underline,omitempty"`
	Dim       bool   `json:"dim,omitempty"`
}

type ViewTreeTableColumn

type ViewTreeTableColumn struct {
	ID    string `json:"id"`
	Title string `json:"title"`
	Align string `json:"align,omitempty"`
}

type VisualTruncateResult

type VisualTruncateResult struct {
	VisualLines  []string
	SkippedCount int
}

func TruncateToVisualLines

func TruncateToVisualLines(text string, maxVisualLines, width, paddingX int) VisualTruncateResult

type WarningSettings

type WarningSettings struct {
	AnthropicExtraUsage bool
}

type WorkingStatusIndicator added in v0.82.0

type WorkingStatusIndicator struct {
	*StatusIndicator
}

WorkingStatusIndicator renders normal agent activity.

func NewWorkingStatusIndicator added in v0.82.0

func NewWorkingStatusIndicator(
	ui *gitui.TUI,
	message string,
	indicator *TUIWorkingIndicatorOptions,
) *WorkingStatusIndicator

NewWorkingStatusIndicator constructs an agent activity indicator.

type WriteTool

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

func NewWriteTool

func NewWriteTool(cwd string, operations ...FileToolOperations) WriteTool

func (WriteTool) Execute

func (t WriteTool) Execute(toolCallID string, input WriteToolInput) (FileToolResult, error)

type WriteToolInput

type WriteToolInput struct {
	Path    string
	Content string
}

Source Files

Directories

Path Synopsis
internal
cli
jsonutil
Package jsonutil contains the coding-agent JSON-with-comments compatibility boundary.
Package jsonutil contains the coding-agent JSON-with-comments compatibility boundary.
outputguard
Package outputguard serializes protocol and print output through one stateful writer boundary.
Package outputguard serializes protocol and print output through one stateful writer boundary.
shellconfig
Package shellconfig resolves one immutable shell invocation policy for all coding-agent command execution paths.
Package shellconfig resolves one immutable shell invocation policy for all coding-agent command execution paths.

Jump to

Keyboard shortcuts

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