Documentation
¶
Overview ¶
This file implements the apply_patch tool: one call carries a whole patch (add / update / move / delete, any number of files) in the codex apply_patch format. It replaces the former separate write and edit tools, so a multi-file change lands as one call and the model keeps one editing tool in context. The parser and matcher live in internal/patch; this file owns the workspace-path policy, the /rewind snapshots, and persistence.
This file implements the bash tool: run a shell command under a managed session (internal/execsess), streaming stdout/stderr back as tool_execution_update partials. A command that finishes within its yield window returns its output directly; one that is still running hands back a bash_id the model polls with write_stdin. A non-zero exit is surfaced as an error (isError) whose message carries the captured output.
This file implements batch tool execution (US-005): a batch of tool calls from one assistant message is split into ordered groups, mirroring pi's semantics while letting independent calls overlap the way codex does.
- Calls are first grouped (see batchGroups): a maximal run of parallel-safe calls becomes one group whose members run concurrently, and every sequential call stands alone. Groups run one after another in source order, so a sequential (write-lock) call still observes everything before it and is observed by everything after it — apply_patch keeps that guarantee — while the parallel-capable calls, shell commands included, overlap inside their own group the way codex's read-lock tools do.
- The whole batch signals termination only when every finalized result has terminate=true, except a successful frontend computer handoff, which must settle the run even when the model included other calls in the batch.
- Abort stops further groups and fills the remaining calls with aborted error results so every call still gets a result message.
Results are backfilled at their source index, so completion order never reorders the batch. (prepare is not separately staged: executeToolCall keeps prepare+execute together per call.)
This file implements the context-budget tools: get_context_remaining lets the model read how much room is left in the context window, and new_context lets it ask for a fresh window at the next turn boundary (the loop summarizes and keeps recent history, exactly like /compact). Both read the run's live budget state from the context the loop publishes, so they need no constructor wiring and every run — parent or sub-agent — sees its own figures. When no state is present (tools used outside a run loop) they degrade to an explanatory result rather than an error.
This file holds the unified-diff renderer the write-side tools report in their result Details (the TUI turns Details["diff"] into a colored diff section). It was extracted from the former edit tool, which the apply_patch tool replaced; the algorithms are unchanged.
This file implements FileSnapshotRecorder, the edit-rewind journal backing the /rewind command. Before the write and edit tools mutate a file they call Record(absPath), which captures the file's prior content (or notes that it did not exist). Snapshots accumulate per turn; Commit groups the turn's snapshots into a RestorePoint tagged with the conversation leaf that preceded the turn. Restore replays a suffix of the restore points in reverse to roll the working tree back to an earlier state, mirroring Claude Code's Esc-Esc rewind. The journal is in-memory and scoped to the running session; only golder's own write/edit tools are captured (arbitrary bash edits are not).
This file implements the goal state and the two goal-control tools that power the /goal command (mirrors pi-goal / Claude Code's goal mode): given a high-level objective, the agent runs autonomously — re-prompted turn after turn — until it either declares the goal done (goal_complete), hits a true impasse (goal_blocked), or a safety guard / token budget stops it.
The tools live here (rather than in the REPL) because they are ordinary AgentTools the model invokes, and because the runtime's GoalReminderProvider needs to read the same state — mirroring how TodoTool/TodoStore pairs with TodoReminderProvider. GoalState is the shared, concurrency-safe handle both the tools (which may run in a batch) and the REPL/reminder (which reads it each turn) touch.
This file implements the HTML→Markdown reduction used by the webfetch tool (US-012, #128). It wraps the JohannesKaufmann/html-to-markdown/v2 library: the base plugin already strips head/script/style/link/meta/iframe/noscript/input, and we additionally register the remaining page chrome (nav/footer/header/ aside/form/svg/template) for removal so only readable content survives. The commonmark plugin renders headings, links, lists, code, emphasis, and tables.
This file implements the memory_search AgentTool (issue #477): a read-only tool that queries the persistent memory library (internal/memory) by relevance using its BM25 full-text index and returns ranked snippets to the model.
Writes are intentionally NOT a separate tool here. Per the SPEC (§4.1/§4.2), memory writes reuse the existing Write/Edit file tools, constrained to the memory root and carrying the canonical frontmatter (name/description/ metadata.type). Traversal protection for those writes lives in the memory package (memory.assertSafeComponent) and the write-path plumbing; a dedicated memory_write tool would duplicate that. After an off-tool write, the next memory_search picks it up automatically because Execute searches with ReconcileFirst=true (lazy reconcile).
This file implements the read tool (US-015): read a file's contents by path, with optional line offset/limit, numbered output, and large-file truncation. Paths are resolved against a Root and rejected if they escape it (path traversal guard) or do not exist.
This file implements the tool registry (US-014): tools are registered by name, and their arguments are validated against a per-tool JSON Schema (santhosh-tekuri/jsonschema v6) before execution. Validation failures are turned into a field-level error tool result rather than a Go error, so the model receives actionable feedback in the loop.
This file implements the session-local reminder scheduler (issue #565, ported from dsh's "Schedule session-local reminders"): three model-invocable tools (schedule_create / schedule_list / schedule_delete) over an in-memory store bound to one session, plus the delivery seam that turns due reminders into follow-up user turns.
Semantics (mirroring dsh, scoped to golder's session model):
- Session-local. The store lives in memory for one run assembly; nothing is persisted and a session's end drops every reminder.
- Two kinds. One-shot (an absolute `at` instant) and fixed-rate repeating (`every_seconds` >= 300); the two are mutually exclusive.
- Strict time parsing. `at` must be a strict RFC 3339 date-time with Z or a numeric offset, or be built from {date, time, time_zone} with time_zone being "UTC" or an IANA Area/Location ("Local" is rejected). DST spring-forward gaps are rejected; fall-back overlaps choose the first instant (Go's time.Date semantics). Stored targets are normalized to UTC.
- Delivery. When the run is otherwise idle (the outer loop is about to settle), each due reminder is queued as one normal user turn via the GetFollowUpMessages seam and marked delivered. A repeating reminder's next fire is its last delivery (or creation) plus the interval.
This file implements the search tools (US-019): grep (search file contents by regexp with optional glob filtering and context lines), find (locate files by name glob), and ls (list a directory, distinguishing files from directories).
grep and find delegate to ripgrep (rg) — the tool codex's prompt tells the model to prefer. rg is multithreaded, skips binary/hidden/.gitignore'd paths, and is several times faster than a walk-and-scan; delegating also deletes the hand-rolled walker and .gitignore matcher this file used to carry. ls stays pure Go (a single directory read). All three resolve paths against a Root with the same boundary guard as the other tools, and the read-only search tools run parallel.
This file implements the todo tool (US-011, #127): a structured task list the model uses to plan and track multi-step work, with progress visible to the user. Unlike the file tools this one is stateful — the written list lives in a per-session TodoStore the tool holds, so a later write replaces the plan and the REPL can render the current progress after each update.
pi itself has no such tool; this mirrors Claude Code's TodoWrite: the model submits the WHOLE list each call (not incremental edits), each item carries a content string and a status of pending | in_progress | completed.
This file implements the three-phase tool execution (US-004): prepare → execute → finalize, with the beforeToolCall / afterToolCall hooks. It mirrors pi's agent-loop tool handling: a tool call is looked up in the registry, its arguments are (optionally) prepared and schema-validated, the beforeToolCall hook may block it, the tool runs (streaming partial updates), and the afterToolCall hook may override the result field-by-field (no deep merge).
Every failure mode (unknown tool, validation failure, block, abort, tool error/panic) is turned into an error tool result rather than a Go error, so the loop always has a ToolResultMessage to feed back to the model.
This file adds resilience to the single tool-execution seam (see tool_executor.go): when a tool's Execute returns a non-nil Go error, the error is classified as transient (worth a bounded retry) or terminal (give up immediately). This is deliberately separate from and does NOT touch the transport-layer connect-time retry in internal/provider/transport.go, which keeps its own, stricter semantics (only 429/503/529, respect Retry-After, never replay a consumed stream).
This file implements the view_image tool: read a local image file and return it to the model as an ImageContent block alongside a short text summary. The image rides a tool result, so each provider serializes it through its own tool-result channel (Responses function_call_output content items, Anthropic tool_result blocks; Chat Completions cannot carry images and degrades to a placeholder).
This file implements the webfetch tool (US-012, #128): fetch a URL and return its main text as simplified Markdown. pi has no such tool; this mirrors Claude Code's WebFetch. Safety properties required by the issue:
- HTTP URLs are upgraded to HTTPS before the request.
- Cross-origin redirects are NOT followed automatically; the redirect target is returned to the caller (the model) so it can decide whether to fetch it.
- A request timeout and a response-body size cap bound the work.
- A failed fetch (timeout, non-2xx, unreachable) degrades to a structured error result, never a panic.
The optional "prompt" argument is accepted and echoed back in the result framing so the model keeps its intent alongside the fetched content; the tool does not itself call a model to summarize (that is the agent loop's job).
This file implements the websearch backends: Tavily, Exa and DeepSeek (credentialed JSON APIs) plus a keyless DuckDuckGo HTML fallback. selectSearchBackend picks the first backend whose credential is present, defaulting to DuckDuckGo.
This file implements the websearch tool: run a web search and return the top results (title, URL, snippet) as Markdown. pi has no such tool; this mirrors Claude Code's WebSearch. It is provider-agnostic and auto-detects a backend by available credentials so it works out of the box:
- Tavily when TAVILY_API_KEY is set (LLM-optimized results).
- Exa when EXA_API_KEY is set (codex's fallback backend; search with highlights enabled).
- DeepSeek when DEEPSEEK_API_KEY is set (the raw Search API).
- DuckDuckGo as a keyless fallback (HTML endpoint, no API key needed).
The first backend whose credential is present wins; DuckDuckGo is always the last-resort fallback. Optional allowed/blocked domain filters are applied uniformly to every backend by post-filtering the result hosts, so behavior is consistent regardless of which backend served the query.
This file implements the write_stdin tool: the model's handle on a running bash session. An empty chars polls new output and status; chars "\u0003" (Ctrl-C) interrupts the session's process group, and a second interrupt force-kills a process that ignores SIGINT. Arbitrary input requires a PTY session (bash with tty=true); pipe sessions reject it with a clear message rather than silently ignoring it.
Index ¶
- Constants
- func BrowserAvailable() bool
- func BrowserContinuations(tools []agentcore.AgentTool) *browsercontinuation.Coordinator
- func BrowserLaunchAvailable() bool
- func BrowserSessionSocketPaths(cwd, conversation string) []string
- func BrowserWorkspaceAvailable(cwd string) bool
- func BrowserWorkspaceSocketPaths(cwd string) []string
- func CheckComputerLaunch(mode *permissions.State) error
- func ClosePaneAgent(tools []agentcore.AgentTool)
- func CloseSessionBrowsers(ctx context.Context, cwd, conversation string)
- func ConfigureBrowserSession(tools []agentcore.AgentTool, id string) *browserbinding.Binding
- func ConfigureEmbeddedBrowser(executable string) error
- func ConfigureNativeBrowserLauncher(launch NativeBrowserLauncher)
- func ConfigurePaneAgent(ctx context.Context, tools []agentcore.AgentTool, conversationID string) error
- func ConnectSessionBrowser(ctx context.Context, cwd, conversation, socket string) (*browserhost.RemoteView, error)
- func DisplayBrowserEvidence(text string, limit int) string
- func EmbeddedBrowserConfigured() bool
- func ExecuteToolCalls(ctx context.Context, cfg BatchConfig, calls []agentcore.AgentToolCall, ...) ([]agentcore.ToolResultMessage, bool)
- func KittyBrowseAvailable() bool
- func NativeBrowserLauncherAvailable() bool
- func OpenAuthorizationPage(ctx context.Context, cwd, startURL string) (func(), error)
- func OpenAuthorizationQR(ctx context.Context, cwd string, event setupevent.Event) (func(), error)
- func OpenRemotePairQR(ctx context.Context, cwd, pairURL string) (func(), error)
- func PaneCommand(tools []agentcore.AgentTool, args string) string
- func RenderTodoList(items []TodoItem) string
- func ScheduleTools(s *Schedule) []agentcore.AgentTool
- func SetPaneAgentPreview(tools []agentcore.AgentTool, conversationID, preview string)
- func SetPaneAgentState(tools []agentcore.AgentTool, state string)
- func SetSearchEnv(fn func(string) string)
- func TuiosAvailable() bool
- func ValidationErrorResult(toolName string, errs []FieldError) agentcore.AgentToolResult
- type ApplyPatchTool
- func (t *ApplyPatchTool) Description() string
- func (t *ApplyPatchTool) Execute(ctx context.Context, id string, args json.RawMessage, ...) (agentcore.AgentToolResult, error)
- func (t *ApplyPatchTool) ExecutionMode() agentcore.ToolExecutionMode
- func (t *ApplyPatchTool) Name() string
- func (t *ApplyPatchTool) Schema() json.RawMessage
- type BashTool
- func (t *BashTool) Description() string
- func (t *BashTool) Execute(ctx context.Context, id string, args json.RawMessage, ...) (result agentcore.AgentToolResult, execErr error)
- func (t *BashTool) ExecutionMode() agentcore.ToolExecutionMode
- func (t *BashTool) Name() string
- func (t *BashTool) Schema() json.RawMessage
- func (t *BashTool) StopSessions()
- type BatchConfig
- type BrowserTool
- func (t *BrowserTool) Description() string
- func (t *BrowserTool) Execute(ctx context.Context, callID string, raw json.RawMessage, ...) (agentcore.AgentToolResult, error)
- func (t *BrowserTool) ExecutionMode() agentcore.ToolExecutionMode
- func (t *BrowserTool) Name() string
- func (t *BrowserTool) PrepareCall(ctx context.Context, raw json.RawMessage) (json.RawMessage, error)
- func (t *BrowserTool) RequiresOperatorConfirmationFor(raw json.RawMessage) bool
- func (t *BrowserTool) ReviewEvidence(ctx context.Context, args json.RawMessage) (agentcore.ToolReviewEvidence, error)
- func (t *BrowserTool) Schema() json.RawMessage
- func (t *BrowserTool) ValidationSchema() json.RawMessage
- type ComputerRequestTool
- func (*ComputerRequestTool) Description() string
- func (t *ComputerRequestTool) Execute(ctx context.Context, _ string, raw json.RawMessage, _ agentcore.ToolUpdateFunc) (agentcore.AgentToolResult, error)
- func (*ComputerRequestTool) ExecutionMode() agentcore.ToolExecutionMode
- func (*ComputerRequestTool) Name() string
- func (t *ComputerRequestTool) Reset()
- func (*ComputerRequestTool) Schema() json.RawMessage
- type ComputerTool
- func (*ComputerTool) Description() string
- func (t *ComputerTool) Execute(ctx context.Context, _ string, raw json.RawMessage, _ agentcore.ToolUpdateFunc) (agentcore.AgentToolResult, error)
- func (*ComputerTool) ExecutionMode() agentcore.ToolExecutionMode
- func (*ComputerTool) Name() string
- func (t *ComputerTool) Schema() json.RawMessage
- func (t *ComputerTool) ValidationSchema() json.RawMessage
- type ControlGuard
- func (g *ControlGuard) CheckGUITerminalControl(ctx context.Context, envelope GUITerminalEnvelope) error
- func (g *ControlGuard) CheckGUITerminalInput(ctx context.Context, envelope GUITerminalEnvelope) error
- func (g *ControlGuard) PrepareGUITerminal(ctx context.Context, argv []string, network bool) (GUITerminalEnvelope, error)
- type FieldError
- type FileSnapshotRecorder
- func (r *FileSnapshotRecorder) CanRecord(n int64) bool
- func (r *FileSnapshotRecorder) Commit(leafID, label string) bool
- func (r *FileSnapshotRecorder) ImportWorkerBaseline(snaps []SnapshotTransfer)
- func (r *FileSnapshotRecorder) PendingBytes() int64
- func (r *FileSnapshotRecorder) PendingForWorker() []SnapshotTransfer
- func (r *FileSnapshotRecorder) Points() []RestorePoint
- func (r *FileSnapshotRecorder) Record(absPath string)
- func (r *FileSnapshotRecorder) Restore(idx int) (leafID string, restored []string, warnings []string, err error)
- type FindTool
- func (t *FindTool) Description() string
- func (t *FindTool) Execute(ctx context.Context, id string, args json.RawMessage, ...) (agentcore.AgentToolResult, error)
- func (t *FindTool) ExecutionMode() agentcore.ToolExecutionMode
- func (t *FindTool) Name() string
- func (t *FindTool) Schema() json.RawMessage
- type GUITerminalEnvelope
- type GetContextRemainingTool
- func (t *GetContextRemainingTool) Description() string
- func (t *GetContextRemainingTool) Execute(ctx context.Context, _ string, _ json.RawMessage, _ agentcore.ToolUpdateFunc) (agentcore.AgentToolResult, error)
- func (t *GetContextRemainingTool) ExecutionMode() agentcore.ToolExecutionMode
- func (t *GetContextRemainingTool) Name() string
- func (t *GetContextRemainingTool) Schema() json.RawMessage
- type GoalBlockedTool
- func (t *GoalBlockedTool) Description() string
- func (t *GoalBlockedTool) Execute(ctx context.Context, id string, args json.RawMessage, ...) (agentcore.AgentToolResult, error)
- func (t *GoalBlockedTool) ExecutionMode() agentcore.ToolExecutionMode
- func (t *GoalBlockedTool) Name() string
- func (t *GoalBlockedTool) Schema() json.RawMessage
- type GoalCompleteTool
- func (t *GoalCompleteTool) Description() string
- func (t *GoalCompleteTool) Execute(ctx context.Context, id string, args json.RawMessage, ...) (agentcore.AgentToolResult, error)
- func (t *GoalCompleteTool) ExecutionMode() agentcore.ToolExecutionMode
- func (t *GoalCompleteTool) Name() string
- func (t *GoalCompleteTool) Schema() json.RawMessage
- type GoalSnapshot
- type GoalState
- func (s *GoalState) Clear()
- func (s *GoalState) ID() string
- func (s *GoalState) MarkBlocked(reason string)
- func (s *GoalState) MarkComplete(summary string)
- func (s *GoalState) RecordIteration(outputTokens int, hadToolActivity bool)
- func (s *GoalState) Resume()
- func (s *GoalState) SetStatus(status GoalStatus)
- func (s *GoalState) Snapshot() GoalSnapshot
- func (s *GoalState) Start(id, objective string, tokenBudget int)
- type GoalStatus
- type GrepTool
- func (t *GrepTool) Description() string
- func (t *GrepTool) Execute(ctx context.Context, id string, args json.RawMessage, ...) (agentcore.AgentToolResult, error)
- func (t *GrepTool) ExecutionMode() agentcore.ToolExecutionMode
- func (t *GrepTool) Name() string
- func (t *GrepTool) Schema() json.RawMessage
- type LsTool
- type MemorySearchTool
- func (t *MemorySearchTool) Description() string
- func (t *MemorySearchTool) Execute(ctx context.Context, id string, args json.RawMessage, ...) (agentcore.AgentToolResult, error)
- func (t *MemorySearchTool) ExecutionMode() agentcore.ToolExecutionMode
- func (t *MemorySearchTool) Name() string
- func (t *MemorySearchTool) Schema() json.RawMessage
- type NativeBrowserLauncher
- type NativeBrowserRequest
- type NewContextTool
- func (t *NewContextTool) Description() string
- func (t *NewContextTool) Execute(ctx context.Context, _ string, _ json.RawMessage, _ agentcore.ToolUpdateFunc) (agentcore.AgentToolResult, error)
- func (t *NewContextTool) ExecutionMode() agentcore.ToolExecutionMode
- func (t *NewContextTool) Name() string
- func (t *NewContextTool) Schema() json.RawMessage
- type ReadTool
- func (t *ReadTool) Description() string
- func (t *ReadTool) Execute(ctx context.Context, id string, args json.RawMessage, ...) (agentcore.AgentToolResult, error)
- func (t *ReadTool) ExecutionMode() agentcore.ToolExecutionMode
- func (t *ReadTool) Name() string
- func (t *ReadTool) Schema() json.RawMessage
- type RestorePoint
- type SandboxDenialAnswer
- type SandboxRunner
- type Schedule
- func (s *Schedule) Create(prompt string, at *time.Time, interval time.Duration) (*ScheduleReminder, error)
- func (s *Schedule) Delete(id string) bool
- func (s *Schedule) FollowUpMessages(_ context.Context, _ *agentcore.AgentContext) []agentcore.AgentMessage
- func (s *Schedule) List() []ScheduleReminder
- type ScheduleReminder
- type SnapshotTransfer
- type TodoItem
- type TodoStatus
- type TodoStore
- type TodoTool
- func (t *TodoTool) Description() string
- func (t *TodoTool) Execute(ctx context.Context, id string, args json.RawMessage, ...) (agentcore.AgentToolResult, error)
- func (t *TodoTool) ExecutionMode() agentcore.ToolExecutionMode
- func (t *TodoTool) Name() string
- func (t *TodoTool) Schema() json.RawMessage
- type ToolExecutorConfig
- type ToolRegistry
- func (r *ToolRegistry) Get(name string) (agentcore.AgentTool, bool)
- func (r *ToolRegistry) List() []agentcore.AgentTool
- func (r *ToolRegistry) Register(tool agentcore.AgentTool) error
- func (r *ToolRegistry) RepairUnknownFields(tool string, args json.RawMessage) (json.RawMessage, []string, bool)
- func (r *ToolRegistry) ReplaceAll(tools []agentcore.AgentTool) error
- func (r *ToolRegistry) UnregisterIf(name string, expected agentcore.AgentTool) bool
- func (r *ToolRegistry) Validate(name string, args json.RawMessage) []FieldError
- type TuiosTool
- func (t *TuiosTool) Description() string
- func (t *TuiosTool) Execute(ctx context.Context, callID string, raw json.RawMessage, ...) (result agentcore.AgentToolResult, resultErr error)
- func (t *TuiosTool) ExecutionMode() agentcore.ToolExecutionMode
- func (t *TuiosTool) Name() string
- func (t *TuiosTool) PrepareCall(ctx context.Context, raw json.RawMessage) (json.RawMessage, error)
- func (t *TuiosTool) RequiresOperatorConfirmationFor(raw json.RawMessage) bool
- func (t *TuiosTool) Schema() json.RawMessage
- type ViewImageTool
- func (t *ViewImageTool) Description() string
- func (t *ViewImageTool) Execute(ctx context.Context, id string, args json.RawMessage, ...) (agentcore.AgentToolResult, error)
- func (t *ViewImageTool) ExecutionMode() agentcore.ToolExecutionMode
- func (t *ViewImageTool) Name() string
- func (t *ViewImageTool) Schema() json.RawMessage
- type WebFetchTool
- func (t *WebFetchTool) Description() string
- func (t *WebFetchTool) Execute(ctx context.Context, id string, args json.RawMessage, ...) (agentcore.AgentToolResult, error)
- func (t *WebFetchTool) ExecutionMode() agentcore.ToolExecutionMode
- func (t *WebFetchTool) Name() string
- func (t *WebFetchTool) Schema() json.RawMessage
- type WebSearchTool
- func (t *WebSearchTool) Description() string
- func (t *WebSearchTool) Execute(ctx context.Context, id string, args json.RawMessage, ...) (agentcore.AgentToolResult, error)
- func (t *WebSearchTool) ExecutionMode() agentcore.ToolExecutionMode
- func (t *WebSearchTool) Name() string
- func (t *WebSearchTool) Schema() json.RawMessage
- type WorkspaceTool
- func (t *WorkspaceTool) Description() string
- func (t *WorkspaceTool) Execute(ctx context.Context, _ string, raw json.RawMessage, _ agentcore.ToolUpdateFunc) (agentcore.AgentToolResult, error)
- func (t *WorkspaceTool) ExecutionMode() agentcore.ToolExecutionMode
- func (t *WorkspaceTool) Name() string
- func (t *WorkspaceTool) Schema() json.RawMessage
- type WriteStdinTool
- func (t *WriteStdinTool) Description() string
- func (t *WriteStdinTool) Execute(ctx context.Context, id string, args json.RawMessage, ...) (agentcore.AgentToolResult, error)
- func (t *WriteStdinTool) ExecutionMode() agentcore.ToolExecutionMode
- func (t *WriteStdinTool) Name() string
- func (t *WriteStdinTool) Schema() json.RawMessage
Constants ¶
const ( PresetFullStack = "debug-fullstack" PresetData = "data-analysis" PresetReview = "review" )
Workspace presets. They are names rather than free-form layouts so a typo is a clear error, and each one has a concrete debugging use.
Variables ¶
This section is empty.
Functions ¶
func BrowserAvailable ¶ added in v1.5.0
func BrowserAvailable() bool
BrowserAvailable reports whether this process should advertise the tool.
func BrowserContinuations ¶ added in v1.5.81
func BrowserContinuations(tools []agentcore.AgentTool) *browsercontinuation.Coordinator
BrowserContinuations returns presentation/decision state only to trusted frontends. It is not registered as an AgentTool.
func BrowserLaunchAvailable ¶ added in v1.5.3
func BrowserLaunchAvailable() bool
BrowserLaunchAvailable reports whether this process can start a browser pane at all: its own `browse` when main configured one, or an external kitty-browse. Registration uses it, so the tool appears without kitty-browse on PATH once the built-in pane is configured.
func BrowserSessionSocketPaths ¶ added in v1.5.67
BrowserSessionSocketPaths is also used by GUI discovery: a session sees only its own views, never another GUI/TUI conversation's project-default browser.
func BrowserWorkspaceAvailable ¶ added in v1.5.1
BrowserWorkspaceAvailable is a cheap registration check. Liveness is checked by list/open, not while serializing the tool schema.
func BrowserWorkspaceSocketPaths ¶ added in v1.5.55
BrowserWorkspaceSocketPaths returns the bounded, validated browser endpoints discoverable from a workspace, including short runtime sockets named by its owner-only metadata records. GUI rendering uses the same discovery boundary as the browser tool instead of scanning only literal .sock directory entries.
func CheckComputerLaunch ¶ added in v1.5.62
func CheckComputerLaunch(mode *permissions.State) error
CheckComputerLaunch applies the current session mode and enforced OS containment both when a request is queued and immediately before launch.
func ClosePaneAgent ¶ added in v1.5.44
func CloseSessionBrowsers ¶ added in v1.5.67
CloseSessionBrowsers releases only the closing controller's views. It uses authenticated reconnect rather than trusting a repository's socket record.
func ConfigureBrowserSession ¶ added in v1.5.67
func ConfigureBrowserSession(tools []agentcore.AgentTool, id string) *browserbinding.Binding
ConfigureBrowserSession binds broker tools before a conversation starts or changes. Neither model arguments nor workspace metadata supply the identity. The returned binding is also held by the GUI controller, not reconstructed from tool results. Reconfiguring the same conversation preserves its binding.
func ConfigureEmbeddedBrowser ¶ added in v1.5.3
ConfigureEmbeddedBrowser tells the browser tool that this executable can start a browser pane itself, with `"<exe>" browse -profile-dir DIR -control-socket SOCKET URL`. main calls it once with its own os.Executable(); nothing here assumes an arbitrary binary supports "browse".
An empty executable disables the built-in pane again (kitty-browse remains the fallback), which is also how tests restore the state they found. A configuration that cannot work is refused immediately and left visible to browserPaneSpec instead of being silently ignored.
func ConfigureNativeBrowserLauncher ¶ added in v1.5.53
func ConfigureNativeBrowserLauncher(launch NativeBrowserLauncher)
ConfigureNativeBrowserLauncher installs a process-wide launcher for hosts such as the desktop GUI that render browser frames without a tuios pane.
func ConfigurePaneAgent ¶ added in v1.5.44
func ConfigurePaneAgent(ctx context.Context, tools []agentcore.AgentTool, conversationID string) error
ConfigurePaneAgent registers the top-level interactive agent represented by tools in the daemon-scoped cross-process registry. Read-only sub-agent tool sets are intentionally ignored.
func ConnectSessionBrowser ¶ added in v1.5.67
func ConnectSessionBrowser(ctx context.Context, cwd, conversation, socket string) (*browserhost.RemoteView, error)
ConnectSessionBrowser restores an operator surface only for this trusted controller's conversation and a validated derived endpoint.
func DisplayBrowserEvidence ¶ added in v1.5.81
func EmbeddedBrowserConfigured ¶ added in v1.5.3
func EmbeddedBrowserConfigured() bool
EmbeddedBrowserConfigured reports whether golder can start its own browser pane right now.
func ExecuteToolCalls ¶
func ExecuteToolCalls(ctx context.Context, cfg BatchConfig, calls []agentcore.AgentToolCall, emit agentcore.EmitFunc) ([]agentcore.ToolResultMessage, bool)
ExecuteToolCalls runs a batch of tool calls belonging to one assistant message. It returns the tool-result messages in source order and whether the whole batch requests termination. A successful computer handoff is a trusted exception: the frontend cannot start its session until the run is idle.
func KittyBrowseAvailable ¶ added in v1.5.1
func KittyBrowseAvailable() bool
KittyBrowseAvailable keeps the name existing callers use. It now answers for both launch programs, because "can a browser be started here" is the question callers actually have.
func NativeBrowserLauncherAvailable ¶ added in v1.5.53
func NativeBrowserLauncherAvailable() bool
NativeBrowserLauncherAvailable reports whether this process can open a browser without a terminal pane.
func OpenAuthorizationPage ¶ added in v1.5.62
OpenAuthorizationPage starts an operator-only browser pane for one OAuth transaction. The caller supplies only the private loopback trampoline; the real authorization URL is never placed in pane argv or exposed to agents. There is no browser control socket, workspace browser record or shared login profile. The user controls the pane directly.
func OpenAuthorizationQR ¶ added in v1.5.16
OpenAuthorizationQR is operator-only. It shares the existing trusted browser launcher, but exposes NO browser control socket, workspace record or cookies. The desktop shows an offline, CSP-locked QR page; the phone opens the official authorization URL. This avoids both cross-origin desktop redirects and giving an agent a general browser page on which the person is logging in. Calling it represents the operator's explicit setup/browser-runtime consent.
func OpenRemotePairQR ¶ added in v1.5.78
OpenRemotePairQR presents a pairing QR in an operator-only browser pane. The QR exists only in memory, never in pane argv, the conversation or a file. A single-use local trampoline holds an unrelated random capability until the protected pane has loaded the page; it has no browser control endpoint.
func PaneCommand ¶ added in v1.5.44
PaneCommand is the user-authored slash-command path. Unlike an agent tool call, the person already selected this top-level agent by typing in its own composer, so no agent id argument is needed and no model can reach this path.
func RenderTodoList ¶
RenderTodoList renders items as a checkbox progress block, one line per task, with a trailing summary count. An empty list renders as a single "(no tasks)" line so an intentional clear is still visible. The marks are: [ ] pending, [~] in_progress, [x] completed.
func ScheduleTools ¶
ScheduleTools returns the three model-invocable schedule tools sharing s.
func SetPaneAgentPreview ¶ added in v1.5.72
SetPaneAgentPreview publishes display-only, already-redacted conversation context. It never selects an Agent or grants pane access.
func SetPaneAgentState ¶ added in v1.5.44
SetPaneAgentState keeps the shared candidate list from offering an Agent that is currently waiting on an approval. It never grants or revokes by itself; conversation/workspace changes and explicit control operations own that.
func SetSearchEnv ¶ added in v1.5.113
SetSearchEnv installs the key lookup used when a WebSearchTool has no injected getenv. Nil restores the environment-only default.
func TuiosAvailable ¶ added in v1.4.9
func TuiosAvailable() bool
TuiosAvailable reports whether this process should advertise the tool.
func ValidationErrorResult ¶
func ValidationErrorResult(toolName string, errs []FieldError) agentcore.AgentToolResult
ValidationErrorResult builds an error AgentToolResult describing the given field errors, for the loop to hand back to the model (FR: field-level error tool result). Terminate is left nil (a validation failure never ends the run).
Types ¶
type ApplyPatchTool ¶
type ApplyPatchTool struct {
// Root bounds all writes; a path resolving outside Root is rejected. Empty
// Root defaults to the current working directory.
Root string
// ExtraRoots are additional trusted directories a change may target even
// though they lie outside Root (the skills directory, so the model can
// author skills it advertises).
ExtraRoots []string
// Snap, when non-nil, records each file's prior content before it is
// mutated so /rewind can roll the change back: every path a patch touches
// is snapshotted, creates and deletes included.
Snap *FileSnapshotRecorder
// BeforePersist, when set, runs after ALL changes are computed and before
// the first write. An isolated worker uses it to transfer the rewind
// baseline to its parent and wait for acknowledgement: a worker that dies
// during a write must not leave the parent without a way to rewind it.
BeforePersist func([]patch.Change) error
// WritableAt, when set, reports whether a path is already writable for this
// session — the sandbox's writable-root registry, which config.toml,
// permissions.toml and every prior write dialog feed. It is injected for the
// same reason BashTool's sandbox is: this package cannot import that registry
// (the cli layer wires the two), and a nil value simply means only the
// authorization table can authorize a write. See judge.WriteAllowed, which
// combines the two so the tool and the gate cannot disagree.
WritableAt func(path string) bool
}
ApplyPatchTool edits files under Root via an apply_patch-format patch.
func (*ApplyPatchTool) Description ¶
func (t *ApplyPatchTool) Description() string
Description implements AgentTool.
func (*ApplyPatchTool) Execute ¶
func (t *ApplyPatchTool) Execute(ctx context.Context, id string, args json.RawMessage, onUpdate agentcore.ToolUpdateFunc) (agentcore.AgentToolResult, error)
Execute implements AgentTool. Every failure — malformed patch, path escape, missing file, stale context — is decided before the first byte is written, so a rejected patch leaves the tree untouched. The returned Go error is reserved for nothing here; failures are error results.
func (*ApplyPatchTool) ExecutionMode ¶
func (t *ApplyPatchTool) ExecutionMode() agentcore.ToolExecutionMode
ExecutionMode implements AgentTool. Patches mutate the filesystem → sequential so a batch cannot race concurrent writes to the same tree.
func (*ApplyPatchTool) Schema ¶
func (t *ApplyPatchTool) Schema() json.RawMessage
Schema implements AgentTool.
type BashTool ¶
type BashTool struct {
// Dir is the working directory for commands. Empty uses the process CWD.
Dir string
// Shell is the interpreter path. Empty defaults to "bash".
Shell string
// Sessions tracks running commands so they can be polled and killed.
// Production always wires one shared manager (BuiltinTools); tests may
// omit it and get a private manager per tool.
Sessions *execsess.Manager
// Permissions, when set, is the live approval mode. Read-only blocks every
// command here too (the gate normally does it first; this covers paths
// without a gate, e.g. in-process sub-agents), full-access skips grading,
// and an auto-mode reviewer failure routes the command into the sandbox
// instead of letting it run unisolated.
Permissions *permissions.State
// OnSandboxDenied, when set, is asked before a sandbox-denied command gives
// up: the sandbox refused a path this command needs, and the person may want
// to re-admit it — or to run this one command without the sandbox at all.
// It receives the path (already extracted from the command and its
// justification) and the command line the question is about, and reports
// what was granted (see SandboxDenialAnswer). Wired by the drivers through
// cli/run, so the question is literally the same one the refused-escape
// dialog asks; a nil hook keeps the old behavior (the denial is labelled for
// the model, nobody is interrupted).
OnSandboxDenied func(ctx context.Context, path, summary string) SandboxDenialAnswer
// Sandbox builds the sandboxed argv for a command. Nil means no isolation
// is available: sandbox-tier commands run directly (the gate already
// prompted for them).
Sandbox SandboxRunner
// ForceSandbox routes every foreground command through Sandbox
// (GOLDER_SANDBOX=enforce) and fails closed when Sandbox is nil.
ForceSandbox bool
// RequireSandbox is set where isolation IS the default (a platform with a
// sandbox implementation, and GOLDER_SANDBOX not off). With it set, a
// missing runner fails closed rather than silently running unconfined;
// where isolation was never implemented (Windows) it stays false, and the
// command runs directly as it always did.
RequireSandbox bool
// ResolveToolchain is host wiring/test injection, never a tool argument.
ResolveToolchain func(context.Context, string, string) (toolchain.Plan, error)
// contains filtered or unexported fields
}
BashTool runs shell commands. Dir bounds the working directory (empty = the process CWD). Shell selects the interpreter (empty = "bash -c").
func (*BashTool) Description ¶
Description implements AgentTool.
func (*BashTool) Execute ¶
func (t *BashTool) Execute(ctx context.Context, id string, args json.RawMessage, onUpdate agentcore.ToolUpdateFunc) (result agentcore.AgentToolResult, execErr error)
Execute runs one command: sandboxed by default, direct only where the gate granted a Direct decision. A sandbox denial that names a path is offered back to the person before the failure is returned (see OnSandboxDenied).
func (*BashTool) ExecutionMode ¶
func (t *BashTool) ExecutionMode() agentcore.ToolExecutionMode
ExecutionMode implements AgentTool. Shell calls batch in parallel, matching codex: there the shell is a shareable tool (supports_parallel_tool_calls = true, dispatched under a read lock) and the exclusive lock belongs to the editing tools, which act as barriers. Here that division is the grouping rule: apply_patch is sequential and stands alone, bash shares a concurrent group with its neighbours. Two shell commands ordered against each other must therefore be split across messages, or chained inside one call (the batching guide says so). What makes sharing safe: each call owns its process and its session, the session manager and per-session buffers are mutex-guarded, and a sandbox profile is written per call.
func (*BashTool) StopSessions ¶
func (t *BashTool) StopSessions()
StopSessions terminates every still-running session this tool spawned. It lets a driver drop a tool set (sub-agent teardown) without leaking OS processes.
type BatchConfig ¶
type BatchConfig struct {
ToolExecutorConfig
ForceSequential bool
}
ForceSequential, when true, makes the whole batch run serially regardless of per-tool ExecutionMode.
type BrowserTool ¶ added in v1.5.0
type BrowserTool struct {
Control *ControlGuard
// contains filtered or unexported fields
}
BrowserTool is the browser facade.
func NewBrowserTool ¶ added in v1.5.0
func NewBrowserTool(cwd string, allowControl bool) *BrowserTool
NewBrowserTool builds the facade. allowControl=false is the sub-agent shape: the same socket and browser, but only the read-only actions.
func (*BrowserTool) Description ¶ added in v1.5.0
func (t *BrowserTool) Description() string
func (*BrowserTool) Execute ¶ added in v1.5.0
func (t *BrowserTool) Execute(ctx context.Context, callID string, raw json.RawMessage, _ agentcore.ToolUpdateFunc) (agentcore.AgentToolResult, error)
func (*BrowserTool) ExecutionMode ¶ added in v1.5.0
func (t *BrowserTool) ExecutionMode() agentcore.ToolExecutionMode
func (*BrowserTool) Name ¶ added in v1.5.0
func (t *BrowserTool) Name() string
func (*BrowserTool) PrepareCall ¶ added in v1.5.5
func (t *BrowserTool) PrepareCall(ctx context.Context, raw json.RawMessage) (json.RawMessage, error)
PrepareCall pins the selected browser/tab before review; Execute refuses an identity mismatch rather than sending the approved action to a replacement.
func (*BrowserTool) RequiresOperatorConfirmationFor ¶ added in v1.5.41
func (t *BrowserTool) RequiresOperatorConfirmationFor(raw json.RawMessage) bool
RequiresOperatorConfirmationFor is a trusted, per-call policy, not a model argument. The project default is deliberately shared; a fresh agent must get a person's answer before accessing any other named login profile. The ordinary auto reviewer and even full-access mode cannot invent it.
func (*BrowserTool) ReviewEvidence ¶ added in v1.5.81
func (t *BrowserTool) ReviewEvidence(ctx context.Context, args json.RawMessage) (agentcore.ToolReviewEvidence, error)
ReviewEvidence observes the current target directly. It never relies on the reviewer's truncated transcript and never performs input/navigation. Browser ownership and runtime facts are host observations; page labels remain data.
func (*BrowserTool) Schema ¶ added in v1.5.0
func (t *BrowserTool) Schema() json.RawMessage
func (*BrowserTool) ValidationSchema ¶ added in v1.5.0
func (t *BrowserTool) ValidationSchema() json.RawMessage
ValidationSchema is the widest form: the registry compiles it once, and a call that becomes possible after workspace create must still validate.
type ComputerRequestTool ¶ added in v1.5.57
type ComputerRequestTool struct {
Request func(context.Context, string) error
Mode *permissions.State
// contains filtered or unexported fields
}
ComputerRequestTool asks the local frontend to resolve an application and prepare its target-bound desktop session. The frontend handles ambiguity and owns the session lifecycle; the model cannot supply paths or window handles.
func (*ComputerRequestTool) Description ¶ added in v1.5.57
func (*ComputerRequestTool) Description() string
func (*ComputerRequestTool) Execute ¶ added in v1.5.57
func (t *ComputerRequestTool) Execute(ctx context.Context, _ string, raw json.RawMessage, _ agentcore.ToolUpdateFunc) (agentcore.AgentToolResult, error)
func (*ComputerRequestTool) ExecutionMode ¶ added in v1.5.57
func (*ComputerRequestTool) ExecutionMode() agentcore.ToolExecutionMode
func (*ComputerRequestTool) Name ¶ added in v1.5.57
func (*ComputerRequestTool) Name() string
func (*ComputerRequestTool) Reset ¶ added in v1.5.57
func (t *ComputerRequestTool) Reset()
Reset clears the pending request after the frontend resolves or cancels it.
func (*ComputerRequestTool) Schema ¶ added in v1.5.57
func (*ComputerRequestTool) Schema() json.RawMessage
type ComputerTool ¶ added in v1.5.57
type ComputerTool struct {
Session *computeruse.Session
Mode *permissions.State
// Stop ends the session and closes its operator pane. The frontend that
// owns the pane sets it; closing the pane always revokes desktop access
// first, so the agent cannot hide supervision and keep controlling.
Stop func()
}
ComputerTool is a narrow facade over a target-bound desktop session. It is registered only after the local frontend resolves and starts that session.
func (*ComputerTool) Description ¶ added in v1.5.57
func (*ComputerTool) Description() string
func (*ComputerTool) Execute ¶ added in v1.5.57
func (t *ComputerTool) Execute(ctx context.Context, _ string, raw json.RawMessage, _ agentcore.ToolUpdateFunc) (agentcore.AgentToolResult, error)
func (*ComputerTool) ExecutionMode ¶ added in v1.5.57
func (*ComputerTool) ExecutionMode() agentcore.ToolExecutionMode
func (*ComputerTool) Name ¶ added in v1.5.57
func (*ComputerTool) Name() string
func (*ComputerTool) Schema ¶ added in v1.5.57
func (t *ComputerTool) Schema() json.RawMessage
func (*ComputerTool) ValidationSchema ¶ added in v1.5.57
func (t *ComputerTool) ValidationSchema() json.RawMessage
type ControlGuard ¶ added in v1.5.5
type ControlGuard struct {
Root string
Mode *permissions.State
Runner seatbelt.CallRunner
// BrowserProxy resolves the person's explicit browser route at launch time.
// It is wired by the CLI assembly layer; nil keeps library/tests direct.
BrowserProxy func() (string, error)
// contains filtered or unexported fields
}
ControlGuard is session-local authority, shared only by the three broker tools in one registry. Repository metadata and pane titles cannot grant it.
func NewControlGuard ¶ added in v1.5.5
func NewControlGuard(root string) *ControlGuard
func (*ControlGuard) CheckGUITerminalControl ¶ added in v1.5.62
func (g *ControlGuard) CheckGUITerminalControl(ctx context.Context, envelope GUITerminalEnvelope) error
CheckGUITerminalControl checks layout/lifecycle actions without treating them as network input to an existing pane.
func (*ControlGuard) CheckGUITerminalInput ¶ added in v1.5.62
func (g *ControlGuard) CheckGUITerminalInput(ctx context.Context, envelope GUITerminalEnvelope) error
CheckGUITerminalInput revalidates a persistent envelope immediately before input, including live mode and policy changes since the pane was created.
func (*ControlGuard) PrepareGUITerminal ¶ added in v1.5.62
func (g *ControlGuard) PrepareGUITerminal(ctx context.Context, argv []string, network bool) (GUITerminalEnvelope, error)
PrepareGUITerminal uses the same scrubbed, bounded launcher as tuios helpers. A one-call path grant cannot be turned into a persistent shell capability.
type FieldError ¶
type FieldError struct {
Field string `json:"field"` // JSON pointer, e.g. "/path" or "" for root
Message string `json:"message"` // human-readable reason
}
FieldError is a single validation failure located at a JSON-pointer path within the arguments.
type FileSnapshotRecorder ¶
type FileSnapshotRecorder struct {
// contains filtered or unexported fields
}
FileSnapshotRecorder captures prior file content before write/edit mutations and groups it into per-turn RestorePoints. Its methods are safe for concurrent use so parallel tool calls within a turn can record without racing.
func NewFileSnapshotRecorder ¶
func NewFileSnapshotRecorder() *FileSnapshotRecorder
NewFileSnapshotRecorder returns an empty recorder ready to record the first turn's mutations.
func (*FileSnapshotRecorder) CanRecord ¶ added in v1.5.9
func (r *FileSnapshotRecorder) CanRecord(n int64) bool
CanRecord reports whether n more content bytes fit in the turn's snapshot budget. It lets a writer reject an oversized batch before recording or writing any of it.
func (*FileSnapshotRecorder) Commit ¶
func (r *FileSnapshotRecorder) Commit(leafID, label string) bool
Commit closes the current turn: if any files were recorded it appends a RestorePoint tagged with leafID (the conversation leaf before the turn) and label (a short description, e.g. the user prompt), then clears the pending buffer. A turn that mutated no files creates no restore point. It reports whether a restore point was created.
func (*FileSnapshotRecorder) ImportWorkerBaseline ¶ added in v1.3.1
func (r *FileSnapshotRecorder) ImportWorkerBaseline(snaps []SnapshotTransfer)
ImportWorkerBaseline records a worker's pre-write snapshots. First touch in the turn wins, just as Record does for consecutive patches in one turn.
func (*FileSnapshotRecorder) PendingBytes ¶ added in v1.5.9
func (r *FileSnapshotRecorder) PendingBytes() int64
PendingBytes reports the content size currently retained by the turn's uncommitted snapshots. Paths and metadata are not counted.
func (*FileSnapshotRecorder) PendingForWorker ¶ added in v1.3.1
func (r *FileSnapshotRecorder) PendingForWorker() []SnapshotTransfer
PendingForWorker returns the baseline captured so far by the isolated tool. The worker sends this before it starts persisting changes; the parent imports it and acknowledges receipt before any filesystem mutation can happen.
func (*FileSnapshotRecorder) Points ¶
func (r *FileSnapshotRecorder) Points() []RestorePoint
Points returns a copy of the committed restore points, oldest first.
func (*FileSnapshotRecorder) Record ¶
func (r *FileSnapshotRecorder) Record(absPath string)
Record captures the current on-disk state of absPath before it is mutated. Only the first call for a given path within a turn is retained, so the snapshot reflects the state at the turn's start (later mutations in the same turn are rolled back to that same baseline). A nil recorder is a no-op, so tools can hold an always-safe optional handle.
func (*FileSnapshotRecorder) Restore ¶
func (r *FileSnapshotRecorder) Restore(idx int) (leafID string, restored []string, warnings []string, err error)
Restore rolls the working tree back to the state before the restore point at index idx (0-based into the Points slice). It replays that point and every later point in reverse, restoring each file's prior content (or deleting files that did not exist), then drops those points from the journal so the next rewind starts from the new tip. It returns the conversation leaf to switch to (the target point's LeafID), the list of restored file paths, and any non-fatal warnings (e.g. files skipped because they were too large or a restore write failed).
type FindTool ¶
type FindTool struct {
// Root bounds the search; empty defaults to the current working directory.
Root string
}
FindTool locates files by base-name glob under Root via ripgrep.
func (*FindTool) Description ¶
func (*FindTool) Execute ¶
func (t *FindTool) Execute(ctx context.Context, id string, args json.RawMessage, onUpdate agentcore.ToolUpdateFunc) (agentcore.AgentToolResult, error)
func (*FindTool) ExecutionMode ¶
func (t *FindTool) ExecutionMode() agentcore.ToolExecutionMode
func (*FindTool) Schema ¶
func (t *FindTool) Schema() json.RawMessage
type GUITerminalEnvelope ¶ added in v1.5.62
type GUITerminalEnvelope struct {
Argv []string
Cleanup func()
Isolated bool
Network bool
Shell bool
Policy [32]byte
}
GUITerminalEnvelope carries the actual launch argv and policy ceiling of one Agent-created GUI terminal. Cleanup belongs to the process and runs on exit.
type GetContextRemainingTool ¶
type GetContextRemainingTool struct{}
GetContextRemainingTool reports the remaining context-window budget.
func (*GetContextRemainingTool) Description ¶
func (t *GetContextRemainingTool) Description() string
Description implements AgentTool.
func (*GetContextRemainingTool) Execute ¶
func (t *GetContextRemainingTool) Execute(ctx context.Context, _ string, _ json.RawMessage, _ agentcore.ToolUpdateFunc) (agentcore.AgentToolResult, error)
Execute implements AgentTool.
func (*GetContextRemainingTool) ExecutionMode ¶
func (t *GetContextRemainingTool) ExecutionMode() agentcore.ToolExecutionMode
ExecutionMode implements AgentTool. Read-only, so parallel is safe.
func (*GetContextRemainingTool) Name ¶
func (t *GetContextRemainingTool) Name() string
Name implements AgentTool.
func (*GetContextRemainingTool) Schema ¶
func (t *GetContextRemainingTool) Schema() json.RawMessage
Schema implements AgentTool. The tool takes no arguments.
type GoalBlockedTool ¶
type GoalBlockedTool struct {
// State is the session goal state. Must be non-nil.
State *GoalState
}
GoalBlockedTool lets the model report a true impasse it cannot work around. It records the reason, moves the state to blocked, and terminates the run.
func (*GoalBlockedTool) Description ¶
func (t *GoalBlockedTool) Description() string
Description implements AgentTool.
func (*GoalBlockedTool) Execute ¶
func (t *GoalBlockedTool) Execute(ctx context.Context, id string, args json.RawMessage, onUpdate agentcore.ToolUpdateFunc) (agentcore.AgentToolResult, error)
Execute implements AgentTool. It validates the reason/evidence, records the block, and terminates the run.
func (*GoalBlockedTool) ExecutionMode ¶
func (t *GoalBlockedTool) ExecutionMode() agentcore.ToolExecutionMode
ExecutionMode implements AgentTool. It mutates shared goal state → sequential.
func (*GoalBlockedTool) Schema ¶
func (t *GoalBlockedTool) Schema() json.RawMessage
Schema implements AgentTool.
type GoalCompleteTool ¶
type GoalCompleteTool struct {
// State is the session goal state. Must be non-nil.
State *GoalState
}
GoalCompleteTool lets the model declare the active goal finished. It records the summary, moves the state to complete, and terminates the run.
func (*GoalCompleteTool) Description ¶
func (t *GoalCompleteTool) Description() string
Description implements AgentTool.
func (*GoalCompleteTool) Execute ¶
func (t *GoalCompleteTool) Execute(ctx context.Context, id string, args json.RawMessage, onUpdate agentcore.ToolUpdateFunc) (agentcore.AgentToolResult, error)
Execute implements AgentTool. It validates the summary (non-empty and not plainly contradictory), records completion, and terminates the run. Invalid input degrades to an error result (not a Go error) so the model can retry.
func (*GoalCompleteTool) ExecutionMode ¶
func (t *GoalCompleteTool) ExecutionMode() agentcore.ToolExecutionMode
ExecutionMode implements AgentTool. It mutates shared goal state → sequential.
func (*GoalCompleteTool) Schema ¶
func (t *GoalCompleteTool) Schema() json.RawMessage
Schema implements AgentTool.
type GoalSnapshot ¶
type GoalSnapshot struct {
ID string
Objective string
Summary string
BlockReason string
Status GoalStatus
Iterations int
NoProgress int
TokenBudget int
TokensUsed int
StartedAt time.Time
}
GoalSnapshot is an immutable copy of the goal state for display/decisions.
type GoalState ¶
type GoalState struct {
// contains filtered or unexported fields
}
GoalState holds the current goal for a REPL session. It is safe for concurrent use so the goal tools (which may run in a batch) and the REPL/reminder reader can touch it without racing. A single state is shared for a session's lifetime; /goal clear resets it to the idle zero value.
func (*GoalState) Clear ¶
func (s *GoalState) Clear()
Clear resets the state to idle (no goal). It zeroes the fields individually rather than replacing the whole struct so the embedded mutex (currently held) is preserved — overwriting it while locked would corrupt the lock.
func (*GoalState) MarkBlocked ¶
MarkBlocked records the block reason and moves the goal to blocked.
func (*GoalState) MarkComplete ¶
MarkComplete records the completion summary and moves the goal to complete.
func (*GoalState) RecordIteration ¶
RecordIteration increments the autonomous-continuation counter and folds the given output-token delta into the running total. hadToolActivity resets the no-progress counter when true, else increments it — so a run of tool-free turns can trip the no-progress guard.
func (*GoalState) Resume ¶
func (s *GoalState) Resume()
Resume reactivates a paused or budget-limited goal and clears the transient safety-guard counters (iterations, no-progress) that stopped it, so the run gets a fresh allowance rather than immediately re-tripping the same guard. The token budget is intentionally reset too (tokensUsed → 0): resuming past an exhausted budget is an explicit user decision to grant another window. The objective and id are preserved. It is a no-op-safe wrapper — callers gate on the current status before invoking it.
func (*GoalState) SetStatus ¶
func (s *GoalState) SetStatus(status GoalStatus)
SetStatus transitions the goal to a new status (used by the REPL when a safety guard fires or the user pauses/resumes).
func (*GoalState) Snapshot ¶
func (s *GoalState) Snapshot() GoalSnapshot
Snapshot returns a copy of the current state, safe to read without a lock.
type GoalStatus ¶
type GoalStatus string
GoalStatus is the lifecycle state of the active goal.
const ( // GoalIdle means no goal is set (the zero value). GoalIdle GoalStatus = "" // GoalActive means the agent is autonomously working toward the goal. GoalActive GoalStatus = "active" // GoalPaused means autonomous continuation stopped (a safety guard fired, or // the user paused it); it can be resumed. GoalPaused GoalStatus = "paused" // GoalBlocked means the agent hit a true impasse (goal_blocked was called). GoalBlocked GoalStatus = "blocked" // GoalComplete means the agent declared the goal done (goal_complete). GoalComplete GoalStatus = "complete" // GoalBudgetLimited means the token budget was exhausted before completion. GoalBudgetLimited GoalStatus = "budget_limited" )
type GrepTool ¶
type GrepTool struct {
// Root bounds the search; empty defaults to the current working directory.
Root string
}
GrepTool searches file contents by regexp under Root via ripgrep.
func (*GrepTool) Description ¶
func (*GrepTool) Execute ¶
func (t *GrepTool) Execute(ctx context.Context, id string, args json.RawMessage, onUpdate agentcore.ToolUpdateFunc) (agentcore.AgentToolResult, error)
func (*GrepTool) ExecutionMode ¶
func (t *GrepTool) ExecutionMode() agentcore.ToolExecutionMode
func (*GrepTool) Schema ¶
func (t *GrepTool) Schema() json.RawMessage
type LsTool ¶
type LsTool struct {
// Root bounds the listing; empty defaults to the current working directory.
Root string
}
LsTool lists the entries of a directory, distinguishing files from directories.
func (*LsTool) Description ¶
func (*LsTool) Execute ¶
func (t *LsTool) Execute(ctx context.Context, id string, args json.RawMessage, onUpdate agentcore.ToolUpdateFunc) (agentcore.AgentToolResult, error)
func (*LsTool) ExecutionMode ¶
func (t *LsTool) ExecutionMode() agentcore.ToolExecutionMode
func (*LsTool) Schema ¶
func (t *LsTool) Schema() json.RawMessage
type MemorySearchTool ¶
type MemorySearchTool struct {
// Store is the persistent memory store. When nil, Execute degrades to a
// friendly no-op result rather than erroring, so a session without memory
// configured still runs.
Store *memory.Store
}
MemorySearchTool searches the persistent memory library by relevance. Store is exported so the loop-integration node (#481) can construct the tool with a live *memory.Store, mirroring how TodoTool exposes its Store.
func (*MemorySearchTool) Description ¶
func (t *MemorySearchTool) Description() string
Description implements AgentTool.
func (*MemorySearchTool) Execute ¶
func (t *MemorySearchTool) Execute(ctx context.Context, id string, args json.RawMessage, onUpdate agentcore.ToolUpdateFunc) (agentcore.AgentToolResult, error)
Execute implements AgentTool. It decodes the args, runs a lazily-reconciled BM25 search, and formats the ranked hits as text (one line each: "type/scope path (score) — snippet") with the structured []SearchResult in Details. A nil Store or empty query degrades to a friendly no-op result rather than a Go error so the loop keeps running.
func (*MemorySearchTool) ExecutionMode ¶
func (t *MemorySearchTool) ExecutionMode() agentcore.ToolExecutionMode
ExecutionMode implements AgentTool. memory_search is read-only, so it runs in the default parallel mode.
func (*MemorySearchTool) Schema ¶
func (t *MemorySearchTool) Schema() json.RawMessage
Schema implements AgentTool.
type NativeBrowserLauncher ¶ added in v1.5.53
type NativeBrowserLauncher func(context.Context, NativeBrowserRequest) error
NativeBrowserLauncher starts a headless browser control host and returns once its owner-only socket is listening. The host owns its lifecycle independently of the individual tool-call context.
type NativeBrowserRequest ¶ added in v1.5.53
type NativeBrowserRequest struct {
URL, Socket, ProfileDir, LoginProfile, ProxyServer string
ConversationID, Instance string
}
NativeBrowserRequest is a validated GUI-hosted browser launch. Paths and the login identity are derived by the browser tool; the model cannot supply them.
type NewContextTool ¶
type NewContextTool struct{}
NewContextTool asks the loop to start a fresh context window at the next turn boundary: the conversation so far is summarized and recent messages are kept, so work continues without replaying the whole history.
func (*NewContextTool) Description ¶
func (t *NewContextTool) Description() string
Description implements AgentTool.
func (*NewContextTool) Execute ¶
func (t *NewContextTool) Execute(ctx context.Context, _ string, _ json.RawMessage, _ agentcore.ToolUpdateFunc) (agentcore.AgentToolResult, error)
Execute implements AgentTool.
func (*NewContextTool) ExecutionMode ¶
func (t *NewContextTool) ExecutionMode() agentcore.ToolExecutionMode
ExecutionMode implements AgentTool. It mutates shared budget state, so the batch runs sequentially.
func (*NewContextTool) Schema ¶
func (t *NewContextTool) Schema() json.RawMessage
Schema implements AgentTool. The tool takes no arguments.
type ReadTool ¶
type ReadTool struct {
// Root is the directory that bounds all reads. A path resolving outside Root
// is rejected. Empty Root defaults to the current working directory.
Root string
// ExtraRoots are additional trusted directories a read may target even though
// they lie outside Root. It exists for the skills directory: golder advertises
// each skill's absolute SKILL.md path in the system prompt and tells the model
// to read it, so the read tool must permit those paths (they are otherwise
// outside the workspace and rejected).
ExtraRoots []string
}
ReadTool reads text files under Root. It is the first concrete AgentTool.
func (*ReadTool) Description ¶
Description implements AgentTool.
func (*ReadTool) Execute ¶
func (t *ReadTool) Execute(ctx context.Context, id string, args json.RawMessage, onUpdate agentcore.ToolUpdateFunc) (agentcore.AgentToolResult, error)
Execute implements AgentTool. It never returns a Go error for a read failure (bad path, missing file); those are encoded as error results so the model can react. The returned error is reserved for argument decode failures.
func (*ReadTool) ExecutionMode ¶
func (t *ReadTool) ExecutionMode() agentcore.ToolExecutionMode
ExecutionMode implements AgentTool. Reads are side-effect free → parallel.
type RestorePoint ¶
type RestorePoint struct {
Seq int
Time time.Time
LeafID string
Label string
Snapshots []fileSnapshot
}
RestorePoint is one turn's worth of file snapshots plus the conversation leaf that preceded the turn. Rewinding to it restores every file to its Snapshots state and moves the active conversation leaf back to LeafID.
type SandboxDenialAnswer ¶ added in v1.3.3
type SandboxDenialAnswer int
SandboxDenialAnswer is what came back from the question a sandbox denial puts to the person: re-admit the refused path (the command still runs contained), or refuse. Leaving the sandbox is a different request — the model asks for it with sandbox_permissions=require_escalated, and the level decides it — so the denial recovery cannot smuggle an unconfined run in through a second answer.
const ( // SandboxDenialRefused: nothing was granted. The original failure stands, // with its labelling for the model. SandboxDenialRefused SandboxDenialAnswer = iota // SandboxDenialReAdmitted: the refused path is registered, so re-running the // command inside the sandbox can now reach it. SandboxDenialReAdmitted )
type SandboxRunner ¶
type SandboxRunner interface {
SandboxArgv(shell, flag, command, dir string) (argv []string, cleanup func(), err error)
SandboxCall(argv []string, dir string, policy seatbelt.CallPolicy) (sandboxed []string, cleanup func(), err error)
}
SandboxRunner builds a sandboxed argv for one shell invocation: argv[0] is the executable, argv[1:] its args. dir is advisory (the caller keeps cmd.Dir); cleanup removes any generated profile and runs once the session exits. It is a local interface so agenttool stays free of platform imports: internal/seatbelt satisfies it structurally and the cli layer injects it.
type Schedule ¶
type Schedule struct {
// Now is the clock consulted for due-ness and creation stamps. It is a
// field rather than a hidden func so tests can pin it (mirrors
// TokenSource.Now); nil falls back to the wall clock.
Now func() time.Time
// contains filtered or unexported fields
}
Schedule is the in-memory store of session-local reminders. It is safe for concurrent use: the executor may run schedule_* tool calls in a parallel batch while the loop goroutine consults delivery.
func NewSchedule ¶
func NewSchedule() *Schedule
NewSchedule builds an empty scheduler using the wall clock. Tests inject a fixed clock through the Now field.
func ScheduleFromTools ¶
ScheduleFromTools returns the Schedule store backing the schedule_create tool in tools, or nil when the scheduler is not wired in (e.g. --no-tools). It mirrors MemoryStoreFromTools: front-ends extract the store from the assembled tool set to wire delivery, instead of threading it separately.
func (*Schedule) Create ¶
func (s *Schedule) Create(prompt string, at *time.Time, interval time.Duration) (*ScheduleReminder, error)
Create adds a reminder. One-shot: at non-nil. Repeating: interval >= 300s. The prompt must be non-empty. Exactly one shape applies.
func (*Schedule) Delete ¶
Delete removes the reminder with the given id, reporting whether it existed.
func (*Schedule) FollowUpMessages ¶
func (s *Schedule) FollowUpMessages(_ context.Context, _ *agentcore.AgentContext) []agentcore.AgentMessage
FollowUpMessages implements the RunConfig.GetFollowUpMessages delivery seam: when the run is about to settle, every due reminder is returned as one normal user turn (in creation order) and marked delivered. A nil result means nothing is due, so the run ends as usual.
func (*Schedule) List ¶
func (s *Schedule) List() []ScheduleReminder
List returns a snapshot of the reminders in creation order.
type ScheduleReminder ¶
type ScheduleReminder struct {
ID string `json:"id"`
Prompt string `json:"prompt"`
OneShot bool `json:"oneShot"`
At time.Time `json:"at,omitempty"` // UTC; one-shot only
Interval time.Duration `json:"intervalSeconds,omitempty"` // > 0 repeating only
CreatedAt time.Time `json:"createdAt"` // UTC
LastFired time.Time `json:"lastFired,omitempty"` // UTC; zero = never
Delivered bool `json:"delivered"` // one-shot only
}
ScheduleReminder is one session-local reminder. Exactly one of the one-shot (At) and repeating (Interval) shapes is set.
func (ScheduleReminder) NextFire ¶
func (r ScheduleReminder) NextFire() time.Time
NextFire returns the reminder's next fire instant (UTC), or the zero time when nothing will fire again (a delivered one-shot).
type SnapshotTransfer ¶ added in v1.3.1
type SnapshotTransfer struct {
Path string `json:"path"`
Existed bool `json:"existed"`
TooLarge bool `json:"tooLarge"`
Content []byte `json:"content,omitempty"`
}
SnapshotTransfer is the pre-write state transferred from a one-call isolated tool worker. It is deliberately data, not a path for the parent to re-read: the parent should not access a file outside the worker merely to journal it.
type TodoItem ¶
type TodoItem struct {
// Content is the human-readable task description.
Content string `json:"content"`
// Status is the item's lifecycle state. An omitted status means pending —
// see normalizeTodoStatus.
Status TodoStatus `json:"status"`
}
TodoItem is one entry in the task list.
type TodoStatus ¶
type TodoStatus string
TodoStatus is the lifecycle state of a single todo item.
const ( // TodoPending is a task not yet started. TodoPending TodoStatus = "pending" // TodoInProgress is the task currently being worked on. TodoInProgress TodoStatus = "in_progress" // TodoCompleted is a finished task. TodoCompleted TodoStatus = "completed" )
type TodoStore ¶
type TodoStore struct {
// contains filtered or unexported fields
}
TodoStore holds the current task list for a session. It is safe for concurrent use so the tool (which may run in a batch) and the REPL renderer can touch it without racing. A single store is shared for a session's lifetime.
type TodoTool ¶
type TodoTool struct {
// Store holds the session task list. Must be non-nil; NewTodoStore builds one.
Store *TodoStore
}
TodoTool is the stateful todo-list tool. It writes the submitted list into Store, replacing any previous list, and returns a rendered progress view.
func (*TodoTool) Description ¶
Description implements AgentTool.
func (*TodoTool) Execute ¶
func (t *TodoTool) Execute(ctx context.Context, id string, args json.RawMessage, onUpdate agentcore.ToolUpdateFunc) (agentcore.AgentToolResult, error)
Execute implements AgentTool. It validates every item's status, stores the list, and returns the rendered progress as the result content. Invalid input degrades to an error result (matching the file tools) rather than a Go error.
func (*TodoTool) ExecutionMode ¶
func (t *TodoTool) ExecutionMode() agentcore.ToolExecutionMode
ExecutionMode implements AgentTool. Updating the shared list mutates session state → sequential so a batch cannot interleave two list writes.
type ToolExecutorConfig ¶
type ToolExecutorConfig struct {
Registry *ToolRegistry
PrepareArguments agentcore.PrepareArgumentsFunc
BeforeToolCall agentcore.BeforeToolCallFunc
AfterToolCall agentcore.AfterToolCallFunc
// BeginToolCall is an optional host-side admission barrier. It runs before
// preparation and returns a release function for the entire call. A host can
// stop admitting calls and wait for already admitted calls to finish.
BeginToolCall func(context.Context, agentcore.AgentToolCall) (func(), error)
// GateChain, when set, is published onto every tool call's context so a tool
// that spawns a derived run (the sub-agent tool) hands the child the same
// gates instead of building its own. It carries the gate seams plus the
// authorization snapshot a run across a process boundary needs; nil means
// the run has nothing to inherit.
//
// BeforeToolCall/AfterToolCall above remain the seams this executor runs;
// GateChain is the pair a CHILD runs. A driver wires both from the session's
// assembled gates (run.Gates.Install), so the interactive chain and the
// inherited chain cannot drift apart.
GateChain *agentcore.ToolGateChain
// MaxResultBytes overrides the executor-layer per-result text budget. Zero
// (the default) uses toolResultMaxBytes; a negative value disables the
// budget entirely.
MaxResultBytes int
// MaxToolRetries overrides the number of RETRIES for a transient tool error
// (see isRetryableToolError). Zero (the default) uses maxToolRetries; a
// negative value disables retrying (a single attempt). Mirrors the
// MaxResultBytes sentinel convention.
MaxToolRetries int
// Redactor overrides the process-wide redactor (redact.Default()). Tests and
// embedders use it to pin one engine; nil means "use the process default".
Redactor *redact.Redactor
}
ToolExecutorConfig holds the registry and the optional per-phase hooks. Every hook is optional (nil = default behavior).
type ToolRegistry ¶
type ToolRegistry struct {
// contains filtered or unexported fields
}
ToolRegistry stores tools by name and validates call arguments against each tool's declared JSON Schema. It is safe for concurrent use.
func NewToolRegistry ¶
func NewToolRegistry() *ToolRegistry
NewToolRegistry returns an empty registry.
func (*ToolRegistry) Get ¶
func (r *ToolRegistry) Get(name string) (agentcore.AgentTool, bool)
Get returns the tool registered under name and whether it was found.
func (*ToolRegistry) List ¶
func (r *ToolRegistry) List() []agentcore.AgentTool
List returns all registered tools sorted by name (stable ordering for deterministic provider tool declarations).
func (*ToolRegistry) Register ¶
func (r *ToolRegistry) Register(tool agentcore.AgentTool) error
Register adds a tool, compiling its JSON Schema up front so bad schemas fail at registration rather than on first call. A duplicate name is an error. A tool whose Schema() is empty is registered with no validation.
func (*ToolRegistry) RepairUnknownFields ¶ added in v1.4.0
func (r *ToolRegistry) RepairUnknownFields(tool string, args json.RawMessage) (json.RawMessage, []string, bool)
RepairUnknownFields rewrites a call whose only schema failure is root-level additional properties. A field with a known alias is renamed (bash's "description" -> "justification"), a metadata-only field is dropped, and the rest of the call must then validate. Anything else is left alone so the model sees the validation error and fixes the call itself.
The repair is deliberately narrow. It never drops an arbitrary unknown field: a field such as "cwd" could change what the command does, so silently ignoring it would be worse than one extra round trip. It also refuses when the remaining call is invalid (a missing required field is the model's to fix).
func (*ToolRegistry) ReplaceAll ¶ added in v1.5.15
func (r *ToolRegistry) ReplaceAll(tools []agentcore.AgentTool) error
ReplaceAll compiles the entire proposed catalog before publishing it. A bad schema or duplicate leaves the current catalog intact.
func (*ToolRegistry) UnregisterIf ¶ added in v1.5.57
func (r *ToolRegistry) UnregisterIf(name string, expected agentcore.AgentTool) bool
UnregisterIf removes the expected tool and its compiled validation state atomically, without removing a replacement registered under the same name. expected must be a comparable tool value, such as a pointer.
func (*ToolRegistry) Validate ¶
func (r *ToolRegistry) Validate(name string, args json.RawMessage) []FieldError
Validate checks args against the tool's compiled schema. It returns nil when the tool has no schema or the arguments are valid; otherwise it returns the flattened field-level errors. An unknown tool name is reported as a single root-level error.
type TuiosTool ¶ added in v1.4.9
type TuiosTool struct {
Control *ControlGuard
// contains filtered or unexported fields
}
TuiosTool serializes layout operations separately from per-pane input, so waiting for one server does not block an independent server's commands.
func NewTuiosTool ¶ added in v1.4.9
NewTuiosTool builds the facade. allowControl=false is the sub-agent shape: the same tool name and session, but only list/capture/wait are in the schema and every control action is refused at execution.
func (*TuiosTool) Description ¶ added in v1.4.9
func (*TuiosTool) Execute ¶ added in v1.4.9
func (t *TuiosTool) Execute(ctx context.Context, callID string, raw json.RawMessage, _ agentcore.ToolUpdateFunc) (result agentcore.AgentToolResult, resultErr error)
func (*TuiosTool) ExecutionMode ¶ added in v1.4.9
func (t *TuiosTool) ExecutionMode() agentcore.ToolExecutionMode
func (*TuiosTool) PrepareCall ¶ added in v1.5.5
func (t *TuiosTool) PrepareCall(ctx context.Context, raw json.RawMessage) (json.RawMessage, error)
func (*TuiosTool) RequiresOperatorConfirmationFor ¶ added in v1.5.44
func (t *TuiosTool) RequiresOperatorConfirmationFor(raw json.RawMessage) bool
RequiresOperatorConfirmationFor is trusted tool policy. A session lease is a standing capability and therefore cannot be invented by the automatic reviewer or full-access mode; the existing ask-mode dialog binds the person's answer to the exact prepared pane identity.
func (*TuiosTool) Schema ¶ added in v1.4.9
func (t *TuiosTool) Schema() json.RawMessage
type ViewImageTool ¶
type ViewImageTool struct {
// Root is the directory that bounds reads. A path resolving outside Root
// is rejected. Empty Root defaults to the current working directory.
Root string
// ExtraRoots are additional trusted directories, mirroring ReadTool: the
// skills directory may hold images a skill references.
ExtraRoots []string
}
ViewImageTool reads an image under Root (or ExtraRoots) and returns it as a tool result. It never mutates anything.
func (*ViewImageTool) Description ¶
func (t *ViewImageTool) Description() string
Description implements AgentTool.
func (*ViewImageTool) Execute ¶
func (t *ViewImageTool) Execute(ctx context.Context, id string, args json.RawMessage, onUpdate agentcore.ToolUpdateFunc) (agentcore.AgentToolResult, error)
Execute implements AgentTool. Read failures are error results, not Go errors, so the model can react (a missing file is not a harness failure).
func (*ViewImageTool) ExecutionMode ¶
func (t *ViewImageTool) ExecutionMode() agentcore.ToolExecutionMode
ExecutionMode implements AgentTool. Reading is side-effect free → parallel.
func (*ViewImageTool) Schema ¶
func (t *ViewImageTool) Schema() json.RawMessage
Schema implements AgentTool.
type WebFetchTool ¶
type WebFetchTool struct {
// Client performs the HTTP request. When nil, a default client is built that
// blocks cross-origin redirects and enforces webFetchTimeout. Injected for
// tests so a fake transport can serve canned responses.
Client *http.Client
}
WebFetchTool fetches a URL and returns its text as simplified Markdown. The zero value is usable; Client defaults to a redirect-blocking http.Client with webFetchTimeout.
func (*WebFetchTool) Description ¶
func (t *WebFetchTool) Description() string
Description implements AgentTool.
func (*WebFetchTool) Execute ¶
func (t *WebFetchTool) Execute(ctx context.Context, id string, args json.RawMessage, onUpdate agentcore.ToolUpdateFunc) (agentcore.AgentToolResult, error)
Execute implements AgentTool. Fetch failures are encoded as error results (the returned Go error is always nil), matching the file tools' contract.
func (*WebFetchTool) ExecutionMode ¶
func (t *WebFetchTool) ExecutionMode() agentcore.ToolExecutionMode
ExecutionMode implements AgentTool. A fetch has no local side effects and is safe to run alongside other reads → parallel.
func (*WebFetchTool) Schema ¶
func (t *WebFetchTool) Schema() json.RawMessage
Schema implements AgentTool.
type WebSearchTool ¶
type WebSearchTool struct {
// Client performs backend HTTP requests. When nil, a default client bounded by
// webSearchTimeout is built. Injected for tests to serve canned responses.
Client *http.Client
// contains filtered or unexported fields
}
WebSearchTool runs a web search via the first available backend. The zero value is usable: Client defaults to an http.Client with webSearchTimeout and getenv defaults to os.Getenv (both injected in tests).
func NewWebSearchTool ¶ added in v1.5.111
func NewWebSearchTool(getenv func(string) string) *WebSearchTool
NewWebSearchTool builds a search tool whose backend credentials come from getenv. A nil getenv keeps os.Getenv; the Android host passes its own encrypted store so keys never enter the process environment.
func (*WebSearchTool) Description ¶
func (t *WebSearchTool) Description() string
Description implements AgentTool.
func (*WebSearchTool) Execute ¶
func (t *WebSearchTool) Execute(ctx context.Context, id string, args json.RawMessage, onUpdate agentcore.ToolUpdateFunc) (agentcore.AgentToolResult, error)
Execute implements AgentTool. Backend failures are encoded as error results (the returned Go error is always nil), matching the file tools' contract.
func (*WebSearchTool) ExecutionMode ¶
func (t *WebSearchTool) ExecutionMode() agentcore.ToolExecutionMode
ExecutionMode implements AgentTool. A search has no local side effects and is safe to run alongside other reads → parallel.
func (*WebSearchTool) Schema ¶
func (t *WebSearchTool) Schema() json.RawMessage
Schema implements AgentTool.
type WorkspaceTool ¶ added in v1.5.0
type WorkspaceTool struct {
Control *ControlGuard
// contains filtered or unexported fields
}
WorkspaceTool arranges and reads several panes at once.
func NewWorkspaceTool ¶ added in v1.5.0
func NewWorkspaceTool(cwd string, allowControl bool) *WorkspaceTool
NewWorkspaceTool builds the facade. allowControl=false keeps list and snapshot: a sub-agent can read the session's panes but cannot create, focus or close them.
func (*WorkspaceTool) Description ¶ added in v1.5.0
func (t *WorkspaceTool) Description() string
func (*WorkspaceTool) Execute ¶ added in v1.5.0
func (t *WorkspaceTool) Execute(ctx context.Context, _ string, raw json.RawMessage, _ agentcore.ToolUpdateFunc) (agentcore.AgentToolResult, error)
func (*WorkspaceTool) ExecutionMode ¶ added in v1.5.0
func (t *WorkspaceTool) ExecutionMode() agentcore.ToolExecutionMode
func (*WorkspaceTool) Name ¶ added in v1.5.0
func (t *WorkspaceTool) Name() string
func (*WorkspaceTool) Schema ¶ added in v1.5.0
func (t *WorkspaceTool) Schema() json.RawMessage
type WriteStdinTool ¶
WriteStdinTool polls and controls sessions created by the bash tool. Sessions is the shared manager the bash tool populates.
func (*WriteStdinTool) Description ¶
func (t *WriteStdinTool) Description() string
Description implements AgentTool.
func (*WriteStdinTool) Execute ¶
func (t *WriteStdinTool) Execute(ctx context.Context, id string, args json.RawMessage, onUpdate agentcore.ToolUpdateFunc) (agentcore.AgentToolResult, error)
Execute implements AgentTool. It returns output produced since the previous read plus a status line, waits up to the yield window for either new output or exit, and never fails the call for a non-zero exit code: the status line carries the code so the model can decide what to do next.
func (*WriteStdinTool) ExecutionMode ¶
func (t *WriteStdinTool) ExecutionMode() agentcore.ToolExecutionMode
ExecutionMode implements AgentTool. Ordering matters: a poll must not race an interrupt, so calls are sequential.
func (*WriteStdinTool) Schema ¶
func (t *WriteStdinTool) Schema() json.RawMessage
Schema implements AgentTool.
Source Files
¶
- apply_patch_budget.go
- apply_patch_tool.go
- authorization_browser.go
- authorization_page.go
- bash_tool.go
- batch_executor.go
- browser_cleanup_hint.go
- browser_continuation.go
- browser_control.go
- browser_discovery.go
- browser_launch.go
- browser_paths.go
- browser_pause.go
- browser_profile.go
- browser_registry.go
- browser_review.go
- browser_review_context.go
- browser_selector.go
- browser_session.go
- browser_status.go
- browser_tool.go
- browser_upload.go
- builtin_review.go
- caps.go
- computer_request_tool.go
- computer_tool.go
- context_tool.go
- control_guard.go
- diff.go
- file_snapshot.go
- goal_tool.go
- gui_terminal_guard.go
- htmlmarkdown.go
- memory_tool.go
- pane_close.go
- pane_command.go
- pane_lease.go
- process_exit.go
- read_tool.go
- registry.go
- remote_pair_qr.go
- schedule_tool.go
- search_env.go
- search_tool.go
- todo_tool.go
- tool_executor.go
- tool_retry.go
- tuios_control.go
- tuios_routing.go
- tuios_script.go
- tuios_tool.go
- view_image_tool.go
- webfetch_tool.go
- websearch_backends.go
- websearch_tool.go
- workspace_tool.go
- write_stdin_tool.go