Versions in this module Expand all Collapse all v0 v0.6.0 Sep 12, 2026 Changes in this version + type ModelMutationOptions struct + Persist bool type SessionRuntime + func (runtime *SessionRuntime) SetModelWithOptions(ctx context.Context, model ai.Model, options ModelMutationOptions) error + func (runtime *SessionRuntime) SetThinkingLevelWithOptions(level ai.ModelThinkingLevel, options ModelMutationOptions) error v0.5.2 Sep 4, 2026 v0.5.1 Sep 3, 2026 v0.5.0 Aug 18, 2026 Changes in this version + const BranchSummaryPrefix + const BranchSummarySuffix + const CompactionSummaryPrefix + const CompactionSummarySuffix + var BuiltinSlashCommands = []BuiltinSlashCommand + var DefaultActiveToolNames = []string + var ErrSessionDisposed = errors.New("agent: session is disposed") + func AuthGuidanceDocPaths() (providersDoc, modelsDoc string) + func BuildSystemPrompt(options SystemPromptOptions) string + func BuiltInToolPromptData(toolNames []string) (map[string]string, []string) + func ConvertToLLM(_ context.Context, messages engine.AgentMessages) (ai.MessageList, error) + func ConvertToLLMWithBlockImages(blockImages func() bool) engine.ConvertToLLMFunc + func DefaultAgentDir() string + func DefaultAvailableModel(provider string, available []ai.Model) *ai.Model + func DefaultModelIDForProvider(provider string) (string, bool) + func ExpandPromptTemplate(text string, templates []PromptTemplate) string + func ExpandSkillCommand(text string, skills []Skill) (string, error) + func FormatChangelog(content string) string + func FormatNoModelsAvailableMessage() string + func FormatSkillInvocation(skill Skill, additionalInstructions string) string + func FormatSkillsForPrompt(skills []Skill) string + func GetExtensionTempFolder(agentDir string) (string, error) + func IsUnknownModel(model *ai.Model) bool + func LoadProjectContextFiles(cwd, agentDir string) ([]ContextFile, []ResourceDiagnostic) + func MarshalSessionEvent(event any) ([]byte, error) + func OpenBrowser(target string) + func ParseCommandArgs(argsString string) []string + func PreferredAvailableModel(available []ai.Model) *ai.Model + func ResolveModelScope(patterns []string, available []ai.Model) ([]ScopedModel, []ModelDiagnostic) + func ResolveProjectTrusted(ctx context.Context, options ResolveProjectTrustedOptions) (bool, error) + func SubstituteArgs(content string, args []string) string + type AgentSession = SessionRuntime + type AgentSessionOptions struct + AgentDir string + AvailableModels func() []ai.Model + BuiltinToolPrompts map[string]ToolPromptContribution + CWD string + Clock func() int64 + CustomTools []extensions.ToolDefinition + DeferExtensionStart bool + ExcludeTools []string + ExtensionRegistry *extensions.Registry + GetAPIKey engine.GetAPIKeyFunc + GetModelHeaders engine.GetModelHeadersFunc + GetRequestAuth engine.GetRequestAuthFunc + Model *ai.Model + ModelRegistry *config.ModelRegistry + NoTools string + ProjectTrustContext extensions.ProjectTrustContext + ResourceLoader ResourceLoader + Resources *Resources + ScopedModels []ScopedModel + SessionManager *sessionstore.SessionManager + SessionStartEvent *extensions.SessionStartEvent + Settings *config.SettingsManager + SlashResolver *SlashResolver + StreamFn engine.StreamFn + ThinkingLevel ai.ModelThinkingLevel + ToolOptions *tools.ToolsOptions + Tools []string + type AgentSessionResult struct + Diagnostics []AgentSessionRuntimeDiagnostic + ExtensionRegistry *extensions.Registry + ModelFallbackMessage string + Services *AgentSessionServices + Session *AgentSession + func CreateAgentSessionFromServices(options CreateAgentSessionFromServicesOptions) (*AgentSessionResult, error) + func NewAgentSession(opts AgentSessionOptions) (*AgentSessionResult, error) + type AgentSessionRuntime struct + func NewAgentSessionRuntime(ctx context.Context, options AgentSessionOptions, ...) (*AgentSessionRuntime, error) + func (runtime *AgentSessionRuntime) CWD() string + func (runtime *AgentSessionRuntime) Diagnostics() []AgentSessionRuntimeDiagnostic + func (runtime *AgentSessionRuntime) Dispose(ctx context.Context) + func (runtime *AgentSessionRuntime) Fork(ctx context.Context, entryID string, options *extensions.ForkOptions) (AgentSessionRuntimeForkResult, error) + func (runtime *AgentSessionRuntime) ImportFromJSONL(ctx context.Context, inputPath string, cwdOverride string) (extensions.SessionReplacementResult, error) + func (runtime *AgentSessionRuntime) ModelFallbackMessage() string + func (runtime *AgentSessionRuntime) NewSession(ctx context.Context, options *extensions.NewSessionOptions) (extensions.SessionReplacementResult, error) + func (runtime *AgentSessionRuntime) Services() *AgentSessionServices + func (runtime *AgentSessionRuntime) Session() *AgentSession + func (runtime *AgentSessionRuntime) SetBeforeSessionInvalidate(callback func()) + func (runtime *AgentSessionRuntime) SetRebindSession(rebind func(*AgentSession) error) + func (runtime *AgentSessionRuntime) SwitchSession(ctx context.Context, path string, options *AgentSessionRuntimeSwitchOptions) (extensions.SessionReplacementResult, error) + type AgentSessionRuntimeDiagnostic struct + Message string + Type string + type AgentSessionRuntimeForkResult struct + Cancelled bool + SelectedText *string + type AgentSessionRuntimeSwitchOptions struct + CWDOverride string + ProjectTrustContextFactory func(string) extensions.ProjectTrustContext + WithSession func(context.Context, extensions.ReplacedSessionContext) error + type AgentSessionServices struct + AgentDir string + CWD string + Diagnostics []AgentSessionRuntimeDiagnostic + ExtensionRegistry *extensions.Registry + ModelRegistry *config.ModelRegistry + ResourceLoader ResourceLoader + Resources *Resources + SettingsManager *config.SettingsManager + func CreateAgentSessionServices(options CreateAgentSessionServicesOptions) (*AgentSessionServices, error) + type AgentSettledEvent struct + type AutoRetryEndEvent struct + Attempt int + FinalError *string + Success bool + type AutoRetryStartEvent struct + Attempt int + DelayMS int64 + ErrorMessage string + MaxAttempts int + type BashExecutionUpdateEvent struct + Delta string + ID *string + type BuiltinSlashCommand struct + ArgumentHint string + Description string + Name string + type CLIModelResult struct + Error string + Model *ai.Model + ThinkingLevel *ai.ModelThinkingLevel + Warning string + func ResolveCLIModel(provider, pattern string, cliThinking *ai.ModelThinkingLevel, ...) CLIModelResult + type CompactionEndEvent struct + Aborted bool + ErrorMessage *string + Reason string + Result *sessionstore.CompactionResult + WillRetry bool + type CompactionStartEvent struct + Reason string + type ConfiguredPackage struct + Filtered bool + InstalledPath string + Scope string + Source string + type ContextFile struct + Content string + Path string + type CreateAgentSessionFromServicesOptions struct + CustomTools []extensions.ToolDefinition + ExcludeTools []string + Model *ai.Model + NoTools string + ScopedModels []ScopedModel + Services *AgentSessionServices + SessionManager *sessionstore.SessionManager + SessionStartEvent *extensions.SessionStartEvent + ThinkingLevel ai.ModelThinkingLevel + ToolOptions *tools.ToolsOptions + Tools []string + type CreateAgentSessionRuntimeFactory func(context.Context, AgentSessionOptions) (*AgentSessionResult, error) + type CreateAgentSessionServicesOptions struct + AgentDir string + CWD string + ExtensionFlagValues map[string]any + ExtensionRegistry *extensions.Registry + ModelRegistry *config.ModelRegistry + ResourceLoaderOptions *DefaultResourceLoaderOptions + ResourceLoaderReloadOptions *ResourceLoaderReloadOptions + ResourceOptions *ResourceOptions + SettingsManager *config.SettingsManager + type CustomMessage = extensions.CustomMessage + type DefaultResourceLoader struct + func NewDefaultResourceLoader(options DefaultResourceLoaderOptions) (*DefaultResourceLoader, error) + func (loader *DefaultResourceLoader) ExtendResources(paths ResourceExtensionPaths) + func (loader *DefaultResourceLoader) GetAgentsFiles() ResourceAgentsFilesResult + func (loader *DefaultResourceLoader) GetAppendSystemPrompt() []string + func (loader *DefaultResourceLoader) GetAppendSystemPromptSources() []PromptSource + func (loader *DefaultResourceLoader) GetExtensions() *extensions.Registry + func (loader *DefaultResourceLoader) GetPrompts() ResourcePromptsResult + func (loader *DefaultResourceLoader) GetSkills() ResourceSkillsResult + func (loader *DefaultResourceLoader) GetSystemPrompt() *string + func (loader *DefaultResourceLoader) GetSystemPromptSource() *PromptSource + func (loader *DefaultResourceLoader) GetThemes() ResourceThemesResult + func (loader *DefaultResourceLoader) Reload(ctx context.Context, reloadOptions *ResourceLoaderReloadOptions) error + type DefaultResourceLoaderOptions struct + AdditionalPromptTemplatePaths []string + AdditionalSkillPaths []string + AdditionalThemePaths []string + AgentDir string + AgentsFilesOverride func(ResourceAgentsFilesResult) ResourceAgentsFilesResult + AppendSystemPrompt []string + AppendSystemPromptOverride func([]string) []string + CWD string + ExtensionFactories []extensions.Factory + ExtensionRegistry *extensions.Registry + NoContextFiles bool + NoExtensions bool + NoPromptTemplates bool + NoSkills bool + NoThemes bool + PackagePromptTemplatePaths []string + PackageSkillPaths []string + PackageThemePaths []ResourcePath + PromptsOverride func(ResourcePromptsResult) ResourcePromptsResult + SettingsManager *config.SettingsManager + SkillsOverride func(ResourceSkillsResult) ResourceSkillsResult + SystemPrompt *string + SystemPromptOverride func(*string) *string + ThemesOverride func(ResourceThemesResult) ResourceThemesResult + type EntryAppendedEvent struct + Entry sessionstore.SessionEntry + type ExtensionAgentSessionService struct + func NewExtensionAgentSessionService(options ExtensionAgentSessionServiceOptions) *ExtensionAgentSessionService + func (service *ExtensionAgentSessionService) CreateSession(ctx context.Context, request extensionhost.AgentSessionCreateRequest, ...) (extensionhost.AgentSessionHandle, extensionhost.AgentSessionCreateResult, ...) + func (service *ExtensionAgentSessionService) ReloadResources(ctx context.Context, request extensionhost.AgentSessionResourceLoader) error + type ExtensionAgentSessionServiceOptions struct + AgentDir string + CWD string + Clock func() int64 + StreamFn engine.StreamFn + type FooterSnapshot struct + AutoCompactEnabled bool + ContextUsage *harness.ContextUsage + Cost float64 + Display engine.AgentDisplayState + HasLatestCacheHitRate bool + LatestCacheHitRate float64 + Tokens SessionTokenTotals + type GitSource struct + Host string + Path string + Pinned bool + Ref string + Repo string + func ParseGitURL(source string) *GitSource + type InputAction string + const InputHandled + const InputPass + const InputTransform + type InputResult struct + Action InputAction + Text string + type InteractiveModeSettings struct + AgentDir string + BlockImages bool + DefaultProjectTrust string + EnableSkillCommands bool + ExternalEditor string + GlobalThemePaths []string + HTTPIdleTimeoutMS int64 + ImageAutoResize bool + MermaidRenderingMode string + OutputPad int + ProjectThemePaths []string + ProjectTrusted bool + ShowTerminalProgress bool + ThemeSetting string + Transport ai.Transport + TreeFilterMode string + type InteractiveSettings struct + AutocompleteMaxVisible int + ClearOnShrink bool + DoubleEscapeAction string + EditorPaddingX int + FollowUpMode engine.QueueMode + HideThinkingBlock bool + ImageWidthCells int + QuietStartup bool + ShowCacheMissNotices bool + ShowHardwareCursor bool + ShowImages bool + SteeringMode engine.QueueMode + type LoadPromptTemplatesOptions struct + AgentDir string + CWD string + IncludeDefaults bool + PromptPaths []string + type LoadSkillsFromDirOptions struct + Dir string + Source string + type LoadSkillsOptions struct + AgentDir string + CWD string + IncludeDefaults bool + SkillPaths []string + type LoadSkillsResult struct + Diagnostics []ResourceDiagnostic + Skills []Skill + func LoadSkills(options LoadSkillsOptions) LoadSkillsResult + func LoadSkillsFromDir(options LoadSkillsFromDirOptions) LoadSkillsResult + type MissingSessionCWDError struct + FallbackCWD string + SessionCWD string + SessionFile string + func (failure *MissingSessionCWDError) Error() string + type MissingSourceAction string + const MissingSourceError + const MissingSourceInstall + const MissingSourceSkip + type ModelCycleResult struct + IsScoped bool + Model ai.Model + ThinkingLevel ai.ModelThinkingLevel + type ModelDiagnostic struct + Code string + Message string + Pattern string + Type string + type NavigateTreeOptions struct + CustomInstructions string + Label string + ReplaceInstructions bool + Summarize bool + type NavigateTreeResult struct + Aborted bool + Cancelled bool + EditorText string + SummaryEntry *sessionstore.SessionEntry + type PackageManager struct + func NewPackageManager(options PackageManagerOptions) *PackageManager + func (manager *PackageManager) AddSourceToSettings(source string, local bool) (bool, error) + func (manager *PackageManager) CheckForAvailableUpdates() []PackageUpdate + func (manager *PackageManager) CheckForPackageUpdates(ctx context.Context) (PackageUpdateCheck, error) + func (manager *PackageManager) GetInstalledPath(source, scope string) string + func (manager *PackageManager) Install(source string, local bool) error + func (manager *PackageManager) InstallAndPersist(source string, local bool) error + func (manager *PackageManager) ListConfiguredPackages() []ConfiguredPackage + func (manager *PackageManager) Remove(source string, local bool) error + func (manager *PackageManager) RemoveAndPersist(source string, local bool) (bool, error) + func (manager *PackageManager) RemoveSourceFromSettings(source string, local bool) (bool, error) + func (manager *PackageManager) Resolve(onMissing func(source string) (MissingSourceAction, error)) (*ResolvedPaths, error) + func (manager *PackageManager) ResolveExtensionSources(sources []string, local, temporary bool) (*ResolvedPaths, error) + func (manager *PackageManager) SetProgressCallback(callback ProgressCallback) + func (manager *PackageManager) Update(source string) error + func (manager *PackageManager) UpdateWithResults(source string) ([]PackageVersionUpdate, error) + type PackageManagerOptions struct + AgentDir string + CWD string + Settings *config.SettingsManager + type PackageUpdate struct + DisplayName string + Scope string + Source string + Type string + type PackageUpdateCheck struct + Installed int + Updates []PackageVersionUpdate + type PackageVersionUpdate struct + CurrentVersion string + LatestVersion string + type ParsedModel struct + Model *ai.Model + ThinkingLevel *ai.ModelThinkingLevel + Warning string + func ParseModelPattern(pattern string, available []ai.Model, allowInvalidFallback ...bool) ParsedModel + type ParsedSkillBlock = exporthtml.ParsedSkillBlock + func ParseSkillBlock(text string) (ParsedSkillBlock, bool) + type PathMetadata struct + BaseDir string + Origin string + Scope string + Source string + type ProgressCallback func(ProgressEvent) + type ProgressEvent struct + Action string + Message string + Source string + Type string + type PromptOptions struct + ExpandPromptTemplates *bool + Images []*ai.ImageContent + PreflightResult func(bool) + Source extensions.InputSource + StreamingBehavior extensions.DeliveryMode + type PromptSource struct + Path string + type PromptTemplate struct + ArgumentHint string + Content string + Description string + FilePath string + Name string + SourceInfo SourceInfo + func LoadPromptTemplates(options LoadPromptTemplatesOptions) []PromptTemplate + type QueueUpdateEvent struct + FollowUp []string + Steering []string + type ResolveProjectTrustedOptions struct + CWD string + DefaultProjectTrust string + HasUI bool + OnExtensionError func(message string) + Runner *extensions.Runner + SelectOption func(title string, options []string) (string, bool) + TrustContext extensions.Context + TrustOverride *bool + TrustStore *config.ProjectTrustStore + type ResolvedPaths struct + Extensions []ResolvedResource + Prompts []ResolvedResource + Skills []ResolvedResource + Themes []ResolvedResource + type ResolvedResource struct + Enabled bool + Metadata PathMetadata + Path string + type ResourceAgentsFilesResult struct + AgentsFiles []ContextFile + type ResourceCollision struct + LoserPath string + Name string + ResourceType string + WinnerPath string + type ResourceDiagnostic struct + Collision *ResourceCollision + Message string + Path string + Type string + type ResourceExtensionPaths struct + PromptPaths []ResourcePath + SkillPaths []ResourcePath + ThemePaths []ResourcePath + type ResourceLoader interface + ExtendResources func(ResourceExtensionPaths) + GetAgentsFiles func() ResourceAgentsFilesResult + GetAppendSystemPrompt func() []string + GetAppendSystemPromptSources func() []PromptSource + GetExtensions func() *extensions.Registry + GetPrompts func() ResourcePromptsResult + GetSkills func() ResourceSkillsResult + GetSystemPrompt func() *string + GetSystemPromptSource func() *PromptSource + GetThemes func() ResourceThemesResult + Reload func(context.Context, *ResourceLoaderReloadOptions) error + type ResourceLoaderReloadOptions struct + ResolveProjectTrust func(context.Context, *extensions.Registry) (bool, error) + type ResourceOptions struct + AgentDir string + AppendSystemPrompt []string + CWD string + GlobalPromptTemplatePaths []string + GlobalSkillPaths []string + NoContextFiles bool + NoPromptTemplates bool + NoSkills bool + PackagePromptTemplatePaths []string + PackageSkillPaths []string + ProjectPromptTemplatePaths []string + ProjectSkillPaths []string + ProjectTrusted *bool + PromptPathMetadata map[string]PathMetadata + PromptTemplatePaths []string + SkillPathMetadata map[string]PathMetadata + SkillPaths []string + SystemPrompt *string + type ResourcePath struct + Metadata PathMetadata + Path string + type ResourcePromptsResult struct + Diagnostics []ResourceDiagnostic + Prompts []PromptTemplate + type ResourceSkillsResult struct + Diagnostics []ResourceDiagnostic + Skills []Skill + type ResourceThemesResult struct + Diagnostics []ResourceDiagnostic + Themes []*modetheme.Theme + type Resources struct + AppendSystemPrompt []string + AppendSystemPromptSources []PromptSource + ContextFiles []ContextFile + Diagnostics []ResourceDiagnostic + PromptTemplates []PromptTemplate + Skills []Skill + SystemPrompt *string + SystemPromptSource *PromptSource + func LoadResources(options ResourceOptions) Resources + func (resources Resources) JoinedAppendSystemPrompt() *string + type ScopedModel struct + Model ai.Model + ThinkingLevel *ai.ModelThinkingLevel + type SendCustomMessageOptions = extensions.SendMessageOptions + type SendUserMessageOptions = extensions.SendUserMessageOptions + type SessionAgentEndEvent struct + Messages engine.AgentMessages + WillRetry bool + type SessionEventType string + const EventAgentSettled + const EventAutoRetryEnd + const EventAutoRetryStart + const EventBashExecutionUpdate + const EventCompactionEnd + const EventCompactionStart + const EventEntryAppended + const EventQueueUpdate + const EventSessionInfo + const EventSummarizationRetryAttemptStart + const EventSummarizationRetryFinished + const EventSummarizationRetryScheduled + const EventThinkingLevel + type SessionImportFileNotFoundError struct + FilePath string + func (failure *SessionImportFileNotFoundError) Error() string + type SessionInfoChangedEvent struct + Name *string + type SessionRuntime struct + func NewSessionRuntime(runtimeConfig SessionRuntimeConfig) (*SessionRuntime, error) + func (runtime *SessionRuntime) Abort() + func (runtime *SessionRuntime) AbortBash() + func (runtime *SessionRuntime) AbortBranchSummary() + func (runtime *SessionRuntime) AbortCompaction() + func (runtime *SessionRuntime) AbortRetry() + func (runtime *SessionRuntime) Agent() *engine.Agent + func (runtime *SessionRuntime) AutoCompactionEnabled() bool + func (runtime *SessionRuntime) AutoRetryEnabled() bool + func (runtime *SessionRuntime) AvailableModels() []ai.Model + func (runtime *SessionRuntime) AvailableThinkingLevels() []ai.ModelThinkingLevel + func (runtime *SessionRuntime) BindExtensionUI(ui extensions.UI, mode extensions.Mode) + func (runtime *SessionRuntime) BindExtensions(ctx context.Context) error + func (runtime *SessionRuntime) BindHostCommandActions(actions extensions.CommandActions) + func (runtime *SessionRuntime) ClearQueue() QueueUpdateEvent + func (runtime *SessionRuntime) Commands() []SlashCommandInfo + func (runtime *SessionRuntime) Compact(ctx context.Context, customInstructions string) (*sessionstore.CompactionResult, error) + func (runtime *SessionRuntime) Continue(ctx context.Context) error + func (runtime *SessionRuntime) CycleModel(ctx context.Context) (*ModelCycleResult, error) + func (runtime *SessionRuntime) CycleModelBackward(ctx context.Context) (*ModelCycleResult, error) + func (runtime *SessionRuntime) CycleThinkingLevel() (*ai.ModelThinkingLevel, error) + func (runtime *SessionRuntime) DequeueMessages() []string + func (runtime *SessionRuntime) Dispose() + func (runtime *SessionRuntime) EnabledModels() []string + func (runtime *SessionRuntime) ExecuteBash(ctx context.Context, command string, excludeFromContext *bool) (tools.BashResult, error) + func (runtime *SessionRuntime) ExecuteBashWithID(ctx context.Context, command string, excludeFromContext *bool, id *string) (tools.BashResult, error) + func (runtime *SessionRuntime) ExecuteUserBash(ctx context.Context, command string, excludeFromContext bool, ...) (extensions.BashResult, error) + func (runtime *SessionRuntime) ExecuteUserBashWithID(ctx context.Context, command string, excludeFromContext *bool, id *string) (tools.BashResult, error) + func (runtime *SessionRuntime) ExportHTML(outputPath string) (string, error) + func (runtime *SessionRuntime) ExportJSONL(outputPath string) (string, error) + func (runtime *SessionRuntime) ExtensionResources() extensions.DiscoveredResources + func (runtime *SessionRuntime) ExtensionRunner() *extensions.Runner + func (runtime *SessionRuntime) FollowUp(text string) error + func (runtime *SessionRuntime) FollowUpImages(text string, images []*ai.ImageContent) error + func (runtime *SessionRuntime) FollowUpMode() engine.QueueMode + func (runtime *SessionRuntime) FooterSnapshot() FooterSnapshot + func (runtime *SessionRuntime) GetActiveToolNames() []string + func (runtime *SessionRuntime) GetContextUsage() *harness.ContextUsage + func (runtime *SessionRuntime) GetLastAssistantText() *string + func (runtime *SessionRuntime) GetSessionStats() SessionStats + func (runtime *SessionRuntime) GetToolDefinition(name string) *extensions.ToolDefinition + func (runtime *SessionRuntime) GetUserMessagesForForking() []struct{ ... } + func (runtime *SessionRuntime) InteractiveModeSettings() InteractiveModeSettings + func (runtime *SessionRuntime) InteractiveSettings() InteractiveSettings + func (runtime *SessionRuntime) IsBashRunning() bool + func (runtime *SessionRuntime) IsCompacting() bool + func (runtime *SessionRuntime) IsIdle() bool + func (runtime *SessionRuntime) Manager() *sessionstore.SessionManager + func (runtime *SessionRuntime) MermaidRenderingMode() string + func (runtime *SessionRuntime) NavigateTree(ctx context.Context, targetID string, options NavigateTreeOptions) (NavigateTreeResult, error) + func (runtime *SessionRuntime) PendingMessageCount() int + func (runtime *SessionRuntime) PendingMessages() QueueUpdateEvent + func (runtime *SessionRuntime) Prompt(ctx context.Context, input any, images ...*ai.ImageContent) error + func (runtime *SessionRuntime) PromptAfterPreflight(ctx context.Context, input any, images ...*ai.ImageContent) error + func (runtime *SessionRuntime) PromptPreflight(ctx context.Context) error + func (runtime *SessionRuntime) PromptSync(ctx context.Context, text string) error + func (runtime *SessionRuntime) PromptWithOptions(ctx context.Context, text string, options *PromptOptions) error + func (runtime *SessionRuntime) ProviderAPIKey(ctx context.Context, provider ai.ProviderID) (string, error) + func (runtime *SessionRuntime) QueueInteractive(ctx context.Context, text string, images []*ai.ImageContent, ...) error + func (runtime *SessionRuntime) RefreshCurrentModelFromRegistry(registry extensions.ModelRegistry) + func (runtime *SessionRuntime) RefreshModels() error + func (runtime *SessionRuntime) RegisteredTool(name string) engine.AgentTool + func (runtime *SessionRuntime) Reload(ctx context.Context) error + func (runtime *SessionRuntime) ResourceLoader() ResourceLoader + func (runtime *SessionRuntime) ScopedModels() []ScopedModel + func (runtime *SessionRuntime) SendCustomMessage(ctx context.Context, message CustomMessage, options *SendCustomMessageOptions) error + func (runtime *SessionRuntime) SendUserMessage(ctx context.Context, content ai.UserContent, options *SendUserMessageOptions) error + func (runtime *SessionRuntime) SetActiveToolsByName(names []string) error + func (runtime *SessionRuntime) SetAutoCompactionEnabled(enabled bool) + func (runtime *SessionRuntime) SetAutoRetryEnabled(enabled bool) + func (runtime *SessionRuntime) SetAutocompleteMaxVisible(visible int) + func (runtime *SessionRuntime) SetBlockImages(blocked bool) + func (runtime *SessionRuntime) SetClearOnShrink(enabled bool) + func (runtime *SessionRuntime) SetDefaultProjectTrust(value string) + func (runtime *SessionRuntime) SetDoubleEscapeAction(action string) + func (runtime *SessionRuntime) SetEditorPaddingX(padding int) + func (runtime *SessionRuntime) SetEnableSkillCommands(enabled bool) + func (runtime *SessionRuntime) SetEnabledModels(models []string) + func (runtime *SessionRuntime) SetExtensionShutdownHandler(handler func()) + func (runtime *SessionRuntime) SetFollowUpMode(mode engine.QueueMode) + func (runtime *SessionRuntime) SetHTTPIdleTimeoutMS(timeoutMS int64) + func (runtime *SessionRuntime) SetHideThinkingBlock(hidden bool) + func (runtime *SessionRuntime) SetImageAutoResize(enabled bool) + func (runtime *SessionRuntime) SetImageWidthCells(width int) + func (runtime *SessionRuntime) SetMermaidRenderingMode(mode string) + func (runtime *SessionRuntime) SetModel(ctx context.Context, model ai.Model) error + func (runtime *SessionRuntime) SetOutputPad(padding int) + func (runtime *SessionRuntime) SetQuietStartup(enabled bool) + func (runtime *SessionRuntime) SetScopedModels(models []ScopedModel) + func (runtime *SessionRuntime) SetSessionName(name string) error + func (runtime *SessionRuntime) SetShowCacheMissNotices(show bool) + func (runtime *SessionRuntime) SetShowHardwareCursor(enabled bool) + func (runtime *SessionRuntime) SetShowImages(show bool) + func (runtime *SessionRuntime) SetShowTerminalProgress(enabled bool) + func (runtime *SessionRuntime) SetSteeringMode(mode engine.QueueMode) + func (runtime *SessionRuntime) SetTheme(name string) error + func (runtime *SessionRuntime) SetThinkingLevel(level ai.ModelThinkingLevel) error + func (runtime *SessionRuntime) SetTransport(transport ai.Transport) + func (runtime *SessionRuntime) SetTreeFilterMode(value string) + func (runtime *SessionRuntime) ShutdownExtensions(reason extensions.SessionShutdownReason, target *string) + func (runtime *SessionRuntime) StartExtensions() + func (runtime *SessionRuntime) State() engine.AgentState + func (runtime *SessionRuntime) Steer(text string) error + func (runtime *SessionRuntime) SteerImages(text string, images []*ai.ImageContent) error + func (runtime *SessionRuntime) SteeringMode() engine.QueueMode + func (runtime *SessionRuntime) String() string + func (runtime *SessionRuntime) SubmitInteractive(ctx context.Context, text string, images []*ai.ImageContent, ...) error + func (runtime *SessionRuntime) Subscribe(listener func(any)) func() + func (runtime *SessionRuntime) SubscribeChan(bufferSize int) (<-chan any, func()) + func (runtime *SessionRuntime) SyncMessagesFromSession() + func (runtime *SessionRuntime) WaitForIdle(ctx context.Context) error + func (runtime *SessionRuntime) WarnAnthropicExtraUsage() bool + type SessionRuntimeConfig struct + Agent *engine.Agent + AllowedToolNames *[]string + AvailableModels func() []ai.Model + BaseTools []engine.AgentTool + BuiltinToolPrompts map[string]ToolPromptContribution + Clock func() int64 + Complete harness.CompleteFunc + DeferExtensionStart bool + DeferSessionStart bool + ExcludedToolNames []string + ExtensionErrorHandler func(extensions.ExtensionError) + ExtensionMode extensions.Mode + ExtensionRegistry *extensions.Registry + ExtensionUI extensions.UI + GetAPIKey engine.GetAPIKeyFunc + GetModelHeaders engine.GetModelHeadersFunc + GetRequestAuth engine.GetRequestAuthFunc + InitialActiveToolNames []string + ModelRegistry extensions.ModelRegistry + RebuildBaseTools func() ([]engine.AgentTool, error) + RegisterProvider func(extensions.Provider) error + RegisterProviderConfig func(string, extensions.ProviderConfig) error + ResourceLoader ResourceLoader + ScopedModels []ScopedModel + SessionManager *sessionstore.SessionManager + SessionStart *extensions.SessionStartEvent + SessionStartEvent *extensions.SessionStartEvent + Settings *config.SettingsManager + SlashResolver *SlashResolver + Sleep func(context.Context, time.Duration) error + StreamFn engine.StreamFn + SystemPromptOptions *SystemPromptOptions + UnregisterProvider func(string) error + type SessionStats struct + AssistantMessages int + ContextUsage *harness.ContextUsage + Cost float64 + SessionFile string + SessionID string + Tokens SessionTokenTotals + ToolCalls int + ToolResults int + TotalMessages int + UserMessages int + type SessionTokenTotals struct + CacheRead int64 + CacheWrite int64 + Input int64 + Output int64 + Total int64 + type Skill struct + AllowedTools string + BaseDir string + Content string + Description string + DisableModelInvocation bool + FilePath string + Name string + SourceInfo SourceInfo + type SlashCommandInfo struct + Description string + Name string + Source SlashCommandSource + SourceInfo SourceInfo + type SlashCommandSource string + const SlashCommandExtension + const SlashCommandPrompt + const SlashCommandSkill + type SlashResolver struct + ExecuteExtension func(name, args string) (bool, error) + ExtensionCommands []SlashCommandInfo + InterceptInput func(text string) (InputResult, error) + OnError func(error) + PromptTemplates []PromptTemplate + Skills []Skill + func (resolver *SlashResolver) Commands(_ bool) []SlashCommandInfo + func (resolver *SlashResolver) Expand(text string) string + func (resolver *SlashResolver) ExpandQueued(text string) (string, error) + func (resolver *SlashResolver) ResolvePrompt(text string) (string, bool) + type SourceInfo struct + BaseDir string + Origin string + Path string + Scope string + Source string + type SummarizationRetryAttemptStartEvent struct + Reason string + Source string + type SummarizationRetryFinishedEvent struct + type SummarizationRetryScheduledEvent struct + Attempt int + DelayMS int64 + ErrorMessage string + MaxAttempts int + type SystemPromptOptions struct + AppendSystemPrompt *string + CWD string + ContextFiles []ContextFile + CustomPrompt *string + PackageDir string + PromptGuidelines []string + SelectedTools []string + Skills []Skill + ToolSnippets map[string]string + type ThinkingLevelChangedEvent struct + Level ai.ModelThinkingLevel + type ToolPromptContribution struct + Guidelines []string + Snippet string + type UsageCostBreakdownEntry struct + Cost float64 + Key string + Tokens int64 + func GetUsageCostBreakdown(entries []sessionstore.SessionEntry) []UsageCostBreakdownEntry v0.4.16 Aug 13, 2026 v0.4.15 Aug 11, 2026 v0.4.14 Aug 11, 2026 v0.4.13 Aug 10, 2026 v0.4.12 Aug 10, 2026 v0.4.11 Aug 3, 2026 Changes in this version + func IsEphemeralAgentEvent(ctx context.Context) bool v0.4.10 Jul 30, 2026 Changes in this version + func MarshalAgentEvent(event AgentEvent) ([]byte, error) + func SetDefaultStreamFn(streamFn StreamFn) + func ToolExecutionModel(ctx context.Context) *ai.Model + func WithToolExecutionModel(ctx context.Context, model *ai.Model) context.Context + type AfterToolCallContext struct + Args any + AssistantMessage *ai.AssistantMessage + Context *AgentContext + IsError bool + Result AgentToolResult + ToolCall *ai.ToolCall + type AfterToolCallFunc func(context.Context, AfterToolCallContext) (*AfterToolCallResult, error) + type AfterToolCallResult struct + Content ai.ToolResultContent + Details any + DetailsSet bool + IsError *bool + Terminate *bool + Usage *ai.Usage + type Agent struct + func NewAgent(stream StreamFn, option ...AgentOption) *Agent + func (agent *Agent) Abort() + func (agent *Agent) AppendMessage(message AgentMessage) + func (agent *Agent) ClearAllQueues() + func (agent *Agent) ClearFollowUpQueue() + func (agent *Agent) ClearSteeringQueue() + func (agent *Agent) Continue(ctx context.Context) error + func (agent *Agent) DisplayState() AgentDisplayState + func (agent *Agent) FollowUp(message AgentMessage) + func (agent *Agent) FollowUpMode() QueueMode + func (agent *Agent) HasQueuedMessages() bool + func (agent *Agent) IsIdle() bool + func (agent *Agent) Prompt(ctx context.Context, input any, images ...*ai.ImageContent) error + func (agent *Agent) ReplaceLastMessage(replacement AgentMessage) bool + func (agent *Agent) Reset() + func (agent *Agent) SetFollowUpMode(mode QueueMode) + func (agent *Agent) SetMessages(messages AgentMessages) + func (agent *Agent) SetModel(model *ai.Model) + func (agent *Agent) SetProviderHooks(payload ai.PayloadHook, headers ai.HeadersHook, response ai.ResponseHook) + func (agent *Agent) SetRequestResolvers(apiKey GetAPIKeyFunc, auth GetRequestAuthFunc, headers GetModelHeadersFunc) + func (agent *Agent) SetSteeringMode(mode QueueMode) + func (agent *Agent) SetStreamFn(stream StreamFn) + func (agent *Agent) SetStreamSessionID(sessionID string) + func (agent *Agent) SetSystemPrompt(prompt string) + func (agent *Agent) SetThinkingLevel(level ThinkingLevel) + func (agent *Agent) SetToolCallHooks(before BeforeToolCallFunc, after AfterToolCallFunc) + func (agent *Agent) SetTools(tools []AgentTool) + func (agent *Agent) SetTransformContext(transform TransformContextFunc) + func (agent *Agent) SetTransport(transport ai.Transport) + func (agent *Agent) Signal() context.Context + func (agent *Agent) State() AgentState + func (agent *Agent) Steer(message AgentMessage) + func (agent *Agent) SteeringMode() QueueMode + func (agent *Agent) StreamFn() StreamFn + func (agent *Agent) Subscribe(listener EventSink) func() + func (agent *Agent) WaitForIdle(ctx context.Context) error + type AgentContext struct + Messages AgentMessages + SystemPrompt string + Tools []AgentTool + type AgentDisplayState struct + ContextWindow float64 + HasModel bool + ModelID string + Provider ai.ProviderID + Reasoning bool + ThinkingLevel ThinkingLevel + type AgentEndEvent struct + Messages AgentMessages + func (AgentEndEvent) Type() AgentEventType + func (event AgentEndEvent) MarshalJSON() ([]byte, error) + type AgentEvent interface + Type func() AgentEventType + type AgentEventType string + const EventAgentEnd + const EventAgentStart + const EventMessageEnd + const EventMessageStart + const EventMessageUpdate + const EventToolExecutionEnd + const EventToolExecutionStart + const EventToolExecutionUpdate + const EventTurnEnd + const EventTurnStart + type AgentLoopConfig struct + AfterToolCall AfterToolCallFunc + BeforeToolCall BeforeToolCallFunc + ConvertToLLM ConvertToLLMFunc + GetAPIKey GetAPIKeyFunc + GetFollowUpMessages GetQueuedMessagesFunc + GetModelHeaders GetModelHeadersFunc + GetRequestAuth GetRequestAuthFunc + GetSteeringMessages GetQueuedMessagesFunc + Model *ai.Model + Now func() int64 + PrepareNextTurn PrepareNextTurnFunc + ShouldStopAfterTurn ShouldStopAfterTurnFunc + ToolExecution ToolExecutionMode + TransformContext TransformContextFunc + type AgentLoopTurnUpdate struct + Context *AgentContext + Model *ai.Model + ThinkingLevel *ThinkingLevel + type AgentMessage = any + type AgentMessages []AgentMessage + func RunLoop(ctx context.Context, prompts AgentMessages, loopContext AgentContext, ...) (AgentMessages, error) + func RunLoopContinue(ctx context.Context, loopContext *AgentContext, config AgentLoopConfig, ...) (AgentMessages, error) + type AgentOption func(*agentOptions) + func WithAPIKeyResolver(resolve GetAPIKeyFunc) AgentOption + func WithAfterToolCall(hook AfterToolCallFunc) AgentOption + func WithBeforeToolCall(hook BeforeToolCallFunc) AgentOption + func WithClock(now func() int64) AgentOption + func WithConvertToLLM(convert ConvertToLLMFunc) AgentOption + func WithFollowUpMode(mode QueueMode) AgentOption + func WithGetFollowUpMessages(getter GetQueuedMessagesFunc) AgentOption + func WithGetSteeringMessages(getter GetQueuedMessagesFunc) AgentOption + func WithInitialState(state AgentState) AgentOption + func WithModelHeadersResolver(resolve GetModelHeadersFunc) AgentOption + func WithPrepareNextTurn(hook PrepareNextTurnWithoutContextFunc) AgentOption + func WithPrepareNextTurnContext(hook PrepareNextTurnFunc) AgentOption + func WithRequestAuthResolver(resolve GetRequestAuthFunc) AgentOption + func WithShouldStopAfterTurn(hook ShouldStopAfterTurnFunc) AgentOption + func WithSimpleStreamOptions(streamOptions ai.SimpleStreamOptions) AgentOption + func WithSteeringMode(mode QueueMode) AgentOption + func WithToolExecution(mode ToolExecutionMode) AgentOption + func WithTransformContext(transform TransformContextFunc) AgentOption + type AgentStartEvent struct + func (AgentStartEvent) MarshalJSON() ([]byte, error) + func (AgentStartEvent) Type() AgentEventType + type AgentState struct + ErrorMessage *string + IsStreaming bool + Messages AgentMessages + Model *ai.Model + PendingToolCalls map[string]struct{} + StreamingMessage AgentMessage + SystemPrompt string + ThinkingLevel ThinkingLevel + Tools []AgentTool + type AgentTool interface + Execute func(context.Context, string, any, AgentToolUpdateCallback) (AgentToolResult, error) + Spec func() AgentToolSpec + type AgentToolFunc struct + Run ToolExecuteFunc + func (tool AgentToolFunc) Execute(ctx context.Context, toolCallID string, params any, ...) (AgentToolResult, error) + func (tool AgentToolFunc) Spec() AgentToolSpec + type AgentToolResult struct + AddedToolNames *[]string + Content ai.ToolResultContent + Details any + Terminate *bool + Usage *ai.Usage + func (result AgentToolResult) MarshalJSON() ([]byte, error) + type AgentToolSpec struct + ConstrainedSampling *ai.ConstrainedSamplingConfig + Description string + ExecutionMode ToolExecutionMode + Label string + Name string + Parameters ai.JSONSchema + PrepareArguments PrepareArgumentsFunc + type AgentToolUpdateCallback func(AgentToolResult) + type BeforeToolCallContext struct + Args any + AssistantMessage *ai.AssistantMessage + Context *AgentContext + ToolCall *ai.ToolCall + type BeforeToolCallFunc func(context.Context, BeforeToolCallContext) (*BeforeToolCallResult, error) + type BeforeToolCallResult struct + Block bool + Reason string + type ConvertToLLMFunc func(context.Context, AgentMessages) (ai.MessageList, error) + type EventSink func(ctx context.Context, event AgentEvent) error + type GetAPIKeyFunc func(context.Context, ai.ProviderID) (*string, error) + type GetModelHeadersFunc func(context.Context, *ai.Model, *string, ai.ProviderEnv) (*map[string]string, error) + type GetQueuedMessagesFunc func(context.Context) (AgentMessages, error) + type GetRequestAuthFunc func(context.Context, ai.ProviderID) (*RequestAuth, error) + type MessageEndEvent struct + Message AgentMessage + func (MessageEndEvent) Type() AgentEventType + func (event MessageEndEvent) MarshalJSON() ([]byte, error) + type MessageStartEvent struct + Message AgentMessage + func (MessageStartEvent) Type() AgentEventType + func (event MessageStartEvent) MarshalJSON() ([]byte, error) + type MessageUpdateEvent struct + AssistantMessageEvent ai.AssistantMessageEvent + Message AgentMessage + func (MessageUpdateEvent) Type() AgentEventType + func (event MessageUpdateEvent) MarshalJSON() ([]byte, error) + type ParallelExecutionPreparer interface + PrepareParallelExecution func(context.Context, any) (context.Context, func(), error) + type PrepareArgumentsFunc func(args any) (any, error) + type PrepareNextTurnContext = ShouldStopAfterTurnContext + type PrepareNextTurnFunc func(context.Context, PrepareNextTurnContext) (*AgentLoopTurnUpdate, error) + type PrepareNextTurnWithoutContextFunc func(context.Context) (*AgentLoopTurnUpdate, error) + type QueueMode string + const QueueAll + const QueueOneAtATime + type RequestAuth struct + APIKey *string + BaseURL *string + Env ai.ProviderEnv + Headers ai.ProviderHeaders + type ShouldStopAfterTurnContext struct + Context *AgentContext + Message *ai.AssistantMessage + NewMessages AgentMessages + ToolResults []*ai.ToolResultMessage + type ShouldStopAfterTurnFunc func(context.Context, ShouldStopAfterTurnContext) (bool, error) + type StreamFn func(ctx context.Context, model *ai.Model, requestContext ai.Context, ...) (ai.AssistantMessageEventStream, error) + type ThinkingLevel = ai.ModelThinkingLevel + const ThinkingHigh + const ThinkingLow + const ThinkingMax + const ThinkingMedium + const ThinkingMinimal + const ThinkingOff + const ThinkingXHigh + type ToolExecuteFunc func(ctx context.Context, toolCallID string, params any, ...) (AgentToolResult, error) + type ToolExecutionEndEvent struct + IsError bool + Result AgentToolResult + ToolCallID string + ToolName string + func (ToolExecutionEndEvent) Type() AgentEventType + func (event ToolExecutionEndEvent) MarshalJSON() ([]byte, error) + type ToolExecutionMode string + const ToolExecutionParallel + const ToolExecutionSequential + type ToolExecutionStartEvent struct + Args map[string]any + ToolCallID string + ToolName string + func NewToolExecutionStartEvent(toolCall *ai.ToolCall) ToolExecutionStartEvent + func (ToolExecutionStartEvent) Type() AgentEventType + func (event ToolExecutionStartEvent) MarshalJSON() ([]byte, error) + type ToolExecutionUpdateEvent struct + Args map[string]any + PartialResult AgentToolResult + ToolCallID string + ToolName string + func NewToolExecutionUpdateEvent(toolCall *ai.ToolCall, partial AgentToolResult) ToolExecutionUpdateEvent + func (ToolExecutionUpdateEvent) Type() AgentEventType + func (event ToolExecutionUpdateEvent) MarshalJSON() ([]byte, error) + type TransformContextFunc func(context.Context, AgentMessages) (AgentMessages, error) + type TurnEndEvent struct + Message AgentMessage + ToolResults []*ai.ToolResultMessage + func (TurnEndEvent) Type() AgentEventType + func (event TurnEndEvent) MarshalJSON() ([]byte, error) + type TurnStartEvent struct + func (TurnStartEvent) MarshalJSON() ([]byte, error) + func (TurnStartEvent) Type() AgentEventType