Documentation
¶
Index ¶
- Variables
- func AttachImage(ctx context.Context, ext string, data []byte) bool
- func AttachScreenshot(ctx context.Context, jpeg []byte) bool
- func Authorize(ctx context.Context, tool, command string) error
- func BeforeFileMutation(ctx context.Context, path string)
- func BinaryPlaceholder(name string, size int) string
- func CommandRule(command string) string
- func Defs(ts []Tool) []ai.Tool
- func Execute(ctx context.Context, ts []Tool, name string, args json.RawMessage) string
- func IsBinary(data []byte) bool
- func IsStale(err error) bool
- func ResolvePath(ctx context.Context, path string) string
- func SuggestTool(name string, candidates []string) []string
- func ToolCallID(ctx context.Context) string
- func Truncate(s string) string
- func TruncateTail(s string) string
- func WithAsk(ctx context.Context, ask AskFunc) context.Context
- func WithFileMutationObserver(ctx context.Context, observe func(string)) context.Context
- func WithGate(ctx context.Context, gate func(GateRequest) (GateDecision, string)) context.Context
- func WithLiveAgentNamedRoots(ctx context.Context, roots map[string]WorkspaceRoot) context.Context
- func WithOnUpdate(ctx context.Context, onUpdate func(outputSoFar string)) context.Context
- func WithRunIdentity(ctx context.Context, identity RunIdentity) context.Context
- func WithToolCallID(ctx context.Context, id string) context.Context
- func WithWorkingDir(ctx context.Context, dir string) context.Context
- func WithWorkspaceRoots(ctx context.Context, roots []WorkspaceRoot) context.Context
- func WorkingDir(ctx context.Context) string
- type AskFunc
- type AskOption
- type AskQuestion
- type AskRequest
- type GateDecision
- type GateRequest
- type InteractiveRunner
- type LiveAgentToolMetadata
- type ManagedProcessManager
- type Result
- type RunIdentity
- type TerminalManager
- func (m *TerminalManager) CloseAll()
- func (m *TerminalManager) Handle(ctx context.Context, req TerminalRequest) (TerminalResponse, error)
- func (m *TerminalManager) Read(ctx context.Context, id string, maxBytes int) (string, error)
- func (m *TerminalManager) Start(ctx context.Context, command, cwd string) (string, error)
- type TerminalRecord
- type TerminalRequest
- type TerminalResponse
- type TerminalShellOption
- type Tool
- type WorkspaceRoot
Constants ¶
This section is empty.
Variables ¶
var Ask func(ctx context.Context, req AskRequest) (answers []string, ok bool)
var Browser *browser.Manager
var ComputerApprover func(app string) bool
var ComputerPolicy *computer.Policy
var Gate func(GateRequest) (GateDecision, string)
var LSP interface { WaitDiagnostics(ctx context.Context, path string) string }
var Suggester func(name string) []string
Functions ¶
func AttachImage ¶ added in v0.107.3
AttachImage attaches an image of the given extension (png, jpg, gif, webp) to the current tool result when the model supports vision.
func AttachScreenshot ¶ added in v0.103.0
func BeforeFileMutation ¶ added in v0.107.0
func BinaryPlaceholder ¶
func CommandRule ¶
func SuggestTool ¶
func ToolCallID ¶ added in v0.107.0
func TruncateTail ¶
func WithFileMutationObserver ¶ added in v0.107.0
WithFileMutationObserver records the pre-image immediately before a file tool mutates it.
func WithGate ¶ added in v0.103.0
func WithGate(ctx context.Context, gate func(GateRequest) (GateDecision, string)) context.Context
func WithLiveAgentNamedRoots ¶ added in v0.107.0
WithLiveAgentNamedRoots maps root:// aliases and enabled skill:// names to explicit grants. Unmapped names never fall back to arbitrary host paths.
func WithOnUpdate ¶
func WithRunIdentity ¶ added in v0.107.0
func WithRunIdentity(ctx context.Context, identity RunIdentity) context.Context
func WithToolCallID ¶ added in v0.107.0
func WithWorkingDir ¶ added in v0.103.0
func WithWorkspaceRoots ¶ added in v0.107.0
func WithWorkspaceRoots(ctx context.Context, roots []WorkspaceRoot) context.Context
func WorkingDir ¶ added in v0.103.0
Types ¶
type AskQuestion ¶ added in v0.107.0
type AskRequest ¶
type AskRequest struct {
Question string `json:"question,omitempty"`
Options []AskOption `json:"options,omitempty"`
Multiple bool `json:"multiple,omitempty"`
Questions []AskQuestion `json:"questions,omitempty"`
}
type GateDecision ¶
type GateDecision int
const ( GateAllowOnce GateDecision = iota GateAllowAlways GateReject )
type GateRequest ¶
type InteractiveRunner ¶
type InteractiveRunner interface {
Run(ctx context.Context, command string, timeout time.Duration, keys <-chan []byte) string
}
var InteractiveBash InteractiveRunner
type LiveAgentToolMetadata ¶ added in v0.107.0
type LiveAgentToolMetadata struct {
ID string `json:"id"`
Icon string `json:"icon"`
ToolName string `json:"toolName"`
Category string `json:"categoryId"`
ReadOnly bool `json:"isReadOnly"`
RuntimeScope []string `json:"runtimeScopes"`
DefaultPolicy string `json:"defaultPolicy"`
}
LiveAgentToolMetadata mirrors the original builtinToolCatalog entries needed by provider/UI policy code without importing LiveAgent's TypeScript bundle.
func LiveAgentToolCatalogMetadata ¶ added in v0.107.0
func LiveAgentToolCatalogMetadata() []LiveAgentToolMetadata
type ManagedProcessManager ¶ added in v0.107.0
type ManagedProcessManager = liveagentProcessManager
ManagedProcessManager retains tool processes across model changes in a session.
func NewManagedProcessManager ¶ added in v0.107.0
func NewManagedProcessManager() *ManagedProcessManager
type Result ¶ added in v0.103.0
type Result struct {
Text string
Parts []ai.ContentPart
Failed bool
Cancelled bool
}
func ExecuteResult ¶ added in v0.103.0
type RunIdentity ¶ added in v0.107.0
func RunIdentityFromContext ¶ added in v0.107.0
func RunIdentityFromContext(ctx context.Context) (RunIdentity, bool)
type TerminalManager ¶ added in v0.107.0
type TerminalManager struct {
// contains filtered or unexported fields
}
func NewTerminalManager ¶ added in v0.107.0
func NewTerminalManager() *TerminalManager
func (*TerminalManager) CloseAll ¶ added in v0.107.0
func (m *TerminalManager) CloseAll()
func (*TerminalManager) Handle ¶ added in v0.107.0
func (m *TerminalManager) Handle(ctx context.Context, req TerminalRequest) (TerminalResponse, error)
type TerminalRecord ¶ added in v0.107.0
type TerminalRecord struct {
ID string `json:"id"`
ProjectPathKey string `json:"project_path_key"`
CWD string `json:"cwd"`
Shell string `json:"shell"`
Title string `json:"title"`
PID int `json:"pid"`
Cols uint16 `json:"cols"`
Rows uint16 `json:"rows"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
FinishedAt int64 `json:"finished_at"`
ExitCode int `json:"exit_code"`
Running bool `json:"running"`
Kind string `json:"kind"`
}
type TerminalRequest ¶ added in v0.107.0
type TerminalRequest struct {
Action string `json:"action"`
ConversationID string `json:"conversation_id"`
RunID string `json:"run_id"`
SessionID string `json:"session_id"`
ProjectPathKey string `json:"project_path_key"`
CWD string `json:"cwd"`
Shell string `json:"shell"`
Title string `json:"title"`
Data string `json:"data"`
Cols uint16 `json:"cols"`
Rows uint16 `json:"rows"`
MaxBytes int `json:"max_bytes"`
}
TerminalRequest and TerminalResponse mirror the local Gateway v2 terminal protocol.
type TerminalResponse ¶ added in v0.107.0
type TerminalResponse struct {
Action string `json:"action"`
ConversationID string `json:"conversation_id"`
RunID string `json:"run_id"`
Session *TerminalRecord `json:"session,omitempty"`
Sessions []TerminalRecord `json:"sessions,omitempty"`
Output []byte `json:"output,omitempty"`
Truncated bool `json:"truncated"`
OutputStartOffset uint64 `json:"output_start_offset"`
OutputEndOffset uint64 `json:"output_end_offset"`
ShellOptions []TerminalShellOption `json:"shell_options,omitempty"`
DefaultShell string `json:"default_shell,omitempty"`
}
type TerminalShellOption ¶ added in v0.107.0
type Tool ¶
type Tool struct {
Def ai.Tool
Run func(ctx context.Context, args json.RawMessage) (string, error)
NoInherit bool
}
func BrowserExec ¶
func BrowserExec() Tool
func ComputerExec ¶
func ComputerExec() Tool
func LiveAgentCatalog ¶ added in v0.107.0
LiveAgentCatalog creates session-local tools without changing CLI defaults.
func LiveAgentCatalogWithManagers ¶ added in v0.107.0
func LiveAgentCatalogWithManagers(provider []string, terminalManager *TerminalManager, processManager *ManagedProcessManager) []Tool
func QuestionTool ¶
func QuestionTool() Tool
type WorkspaceRoot ¶ added in v0.107.0
WorkspaceRoot is the backend's authoritative filesystem boundary.
Source Files
¶
- attachments.go
- binary.go
- browser.go
- browser_lang.go
- computer.go
- liveagent_catalog.go
- liveagent_documents.go
- liveagent_edit.go
- liveagent_policy.go
- liveagent_process.go
- liveagent_process_actions.go
- liveagent_read.go
- liveagent_schemas.go
- liveagent_search.go
- liveagent_shell.go
- liveagent_terminal.go
- liveagent_tools.go
- permission.go
- question.go
- run_identity.go
- suggest.go
- terminal.go
- terminal_unix.go
- tools.go