Documentation
¶
Index ¶
- Constants
- Variables
- func Close(tileId string)
- func EmitAIStreamBlock(ctx context.Context, kind sessiondb.StreamBlockKind, content string)
- func EmitAIStreamToolProgress(ctx context.Context) func(string)
- func New(renderer types.Renderer, tile types.Tile)
- func RequestUserQuestion(ctx context.Context, question string, choices []string) (string, error)
- func ResolveUserQuestionRequest(id, answer string) error
- func ResolveWritePermissionRequest(id, decision string) error
- func ToolsAdd(t aitypes.Tool)
- type AIStreamBlockEmitter
- type Agent
- func (agent *Agent) ChooseTools(cancel types.MenuCallbackT)
- func (agt *Agent) CurrentModelLabel() string
- func (agt *Agent) EnvironmentValue(name string) string
- func (agt *Agent) GetMeta() *aitypes.Meta
- func (agt *Agent) ImageGenerationEnvironmentValue(name string) string
- func (agt *Agent) IsWorkspaceActive() bool
- func (agent *Agent) ListMcpServers() []map[string]interface{}
- func (agt *Agent) ListModels() ([]ServiceModelIndexT, []string)
- func (agt *Agent) ListModelsInputVariable() types.InputBoxWTVariables
- func (agent *Agent) ListTools() []map[string]interface{}
- func (agt *Agent) MaxIterations() int
- func (agent *Agent) McpMenu(cancel types.MenuCallbackT)
- func (agt *Agent) McpServerAdd(server, source string, client client)
- func (agt *Agent) McpServerExists(server string) bool
- func (agt *Agent) McpServerRemove(server string)
- func (agt *Agent) McpServerSource(server string) string
- func (agt *Agent) ModelName() string
- func (agt *Agent) ProjectRoot() string
- func (agt *Agent) ProviderName() string
- func (agt *Agent) Reload()
- func (agt *Agent) Renderer() types.Renderer
- func (agt *Agent) RequestToolPermission(ctx context.Context, toolName string) error
- func (agt *Agent) ResetToolPermissions()
- func (agent *Agent) RunLLMWithMessageStream(ctx context.Context, messages []*schema.Message, streamCallback func(string)) (result string, err error)
- func (agent *Agent) RunLLMWithStream(ctx context.Context, prompt string, streamCallback func(string)) (result string, err error)
- func (agent *Agent) RunSubagentWithTools(ctx context.Context, systemPrompt, prompt string, emit func(string)) (string, error)
- func (agt *Agent) SelectServiceModel(returnFn func())
- func (agt *Agent) ServiceName() string
- func (agent *Agent) SetMcpServerEnabled(serverKey string, enabled bool) error
- func (agt *Agent) SetModelFromInputVariable(variables map[string]any)
- func (agt *Agent) SetServiceModelFromSelection(selection string) error
- func (agent *Agent) SetToolAllowedInSubagent(toolName string, allowed bool) error
- func (agent *Agent) SetToolEnabled(toolName string, enabled bool) error
- func (agent *Agent) SetToolState(toolName, state string) error
- func (agent *Agent) ShowToolStateMenu(toolName string, x, y int, changed func(string))
- func (agent *Agent) ShowToolSubagentMenu(toolName string, x, y int, changed func(bool))
- func (agent *Agent) StartServerFromConfigServer(config *mcp_config.ConfigT, server string) error
- func (agent *Agent) StartServersFromConfig(config *mcp_config.ConfigT) error
- func (agent *Agent) StartServersFromJson(filename string) error
- func (agent *Agent) StartTools(tools []*skills.ToolsT) error
- func (agent *Agent) SubagentToolNames() []string
- func (agt *Agent) SummariseModelName() string
- func (agt *Agent) SwitchServiceModel(modelXRef []ServiceModelIndexT, i int)
- func (agt *Agent) Term() types.Term
- func (agent *Agent) ToolAllowedInSubagent(toolName string) bool
- func (agent *Agent) ToolState(toolName string) string
- func (agent *Agent) ToolsAdd(t aitypes.Tool) error
- func (agt *Agent) Workspace() string
- type ServiceModelIndexT
Constants ¶
const ( LLM_OPENAI = "openai" LLM_ANTHROPIC = "anthropic" LLM_OLLAMA = "ollama" )
const ( ToolStateDisabled = "disabled" ToolStateApproval = "approval" ToolStatePrompt = "prompt" ToolStateSession = "session" ToolStateDenied = "denied" ToolStateAlways = "always" )
const ( TOOL_DELEGATE = "delegate" TOOL_REPORT = "report" TOOL_ASK_USER = "askUser" )
Variables ¶
var ErrToolPermissionRefused = errors.New("tool call refused")
ErrToolPermissionRefused marks a refusal the LLM should be told about rather than one that should abort the agent run.
Functions ¶
func EmitAIStreamBlock ¶
func EmitAIStreamBlock(ctx context.Context, kind sessiondb.StreamBlockKind, content string)
func EmitAIStreamToolProgress ¶
EmitAIStreamToolProgress returns the current run's panel and log emitter.
func RequestUserQuestion ¶
func ResolveWritePermissionRequest ¶
ResolveWritePermissionRequest is called by the frontend when the user clicks one of the access-request options rendered in the AI panel output.
Types ¶
type AIStreamBlockEmitter ¶
type AIStreamBlockEmitter struct {
// contains filtered or unexported fields
}
func OpenAIStreamBlock ¶
func OpenAIStreamBlock(ctx context.Context, kind sessiondb.StreamBlockKind, parentID string) *AIStreamBlockEmitter
func OpenAITypedStreamBlock ¶
func OpenAITypedStreamBlock(ctx context.Context, kind sessiondb.StreamBlockKind, label string) *AIStreamBlockEmitter
OpenAITypedStreamBlock streams only on the addressable block transport.
func (*AIStreamBlockEmitter) ChildContext ¶
func (e *AIStreamBlockEmitter) ChildContext(ctx context.Context) context.Context
ChildContext scopes blocks emitted from ctx beneath this block.
func (*AIStreamBlockEmitter) Close ¶
func (e *AIStreamBlockEmitter) Close()
func (*AIStreamBlockEmitter) Emit ¶
func (e *AIStreamBlockEmitter) Emit(text string)
type Agent ¶
func (*Agent) ChooseTools ¶
func (agent *Agent) ChooseTools(cancel types.MenuCallbackT)
func (*Agent) CurrentModelLabel ¶
func (*Agent) EnvironmentValue ¶
func (*Agent) ImageGenerationEnvironmentValue ¶
func (*Agent) IsWorkspaceActive ¶
func (*Agent) ListMcpServers ¶
func (*Agent) ListModels ¶
func (agt *Agent) ListModels() ([]ServiceModelIndexT, []string)
func (*Agent) ListModelsInputVariable ¶
func (agt *Agent) ListModelsInputVariable() types.InputBoxWTVariables
ListModelsInputVariable returns a pre-configured InputBox variable definition that can be used directly in InputBoxWT options.
func (*Agent) MaxIterations ¶
func (*Agent) McpMenu ¶
func (agent *Agent) McpMenu(cancel types.MenuCallbackT)
func (*Agent) McpServerAdd ¶
func (*Agent) McpServerExists ¶
func (*Agent) McpServerRemove ¶
func (*Agent) McpServerSource ¶
func (*Agent) ProjectRoot ¶
func (*Agent) ProviderName ¶
func (*Agent) RequestToolPermission ¶
func (*Agent) ResetToolPermissions ¶
func (agt *Agent) ResetToolPermissions()
Permissions are scoped to a single user prompt, so this must only be called when a new prompt starts — not per continuation.
func (*Agent) RunLLMWithMessageStream ¶
func (agent *Agent) RunLLMWithMessageStream(ctx context.Context, messages []*schema.Message, streamCallback func(string)) (result string, err error)
RunLLMWithMessageStream calls the configured runtime with structured messages and streams text chunks.
func (*Agent) RunLLMWithStream ¶
func (agent *Agent) RunLLMWithStream(ctx context.Context, prompt string, streamCallback func(string)) (result string, err error)
RunLLMWithStream calls the configured runtime and streams text chunks. Use ai package helpers to construct provider-appropriate prompts.
func (*Agent) RunSubagentWithTools ¶
func (agent *Agent) RunSubagentWithTools(ctx context.Context, systemPrompt, prompt string, emit func(string)) (string, error)
RunSubagentWithTools runs a sub-agent prompt through its own react agent, restricted to the tools delegable to sub-agents.
The run is deliberately isolated: no session history is loaded, so a sub-agent only ever sees its own system prompt and task.
func (*Agent) SelectServiceModel ¶
func (agt *Agent) SelectServiceModel(returnFn func())
func (*Agent) ServiceName ¶
func (*Agent) SetMcpServerEnabled ¶
func (*Agent) SetModelFromInputVariable ¶
func (*Agent) SetServiceModelFromSelection ¶
SetServiceModelFromSelection sets the active service/model from a list label formatted as "<Service>: <Model>".
func (*Agent) SetToolAllowedInSubagent ¶
func (*Agent) SetToolEnabled ¶
func (*Agent) SetToolState ¶
func (*Agent) ShowToolStateMenu ¶
func (*Agent) ShowToolSubagentMenu ¶
func (*Agent) StartServerFromConfigServer ¶
func (agent *Agent) StartServerFromConfigServer(config *mcp_config.ConfigT, server string) error
func (*Agent) StartServersFromConfig ¶
func (agent *Agent) StartServersFromConfig(config *mcp_config.ConfigT) error
func (*Agent) StartServersFromJson ¶
func (*Agent) SubagentToolNames ¶
func (*Agent) SummariseModelName ¶
func (*Agent) SwitchServiceModel ¶
func (agt *Agent) SwitchServiceModel(modelXRef []ServiceModelIndexT, i int)
func (*Agent) ToolAllowedInSubagent ¶
type ServiceModelIndexT ¶
type ServiceModelIndexT struct {
// contains filtered or unexported fields
}