builtins

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package builtins is part of the GoFastr harness.

See docs/harness-architecture.md for the architecture this package implements.

Package builtins implements the v0.1 default tool set: Read, Write, Edit, Bash, Grep, Glob, Ls, WebFetch. Each tool is small, focused, and declares is_mutating per the persistence layer's contract.

Index

Constants

This section is empty.

Variables

View Source
var DefaultBashBlocklist = []string{
	"security",
	"secret-tool",
	"keyctl",
	"kwalletcli",
	"systemd-ask-password",
}

DefaultBashBlocklist names the commands the Bash tool refuses to run by default. The threat model rationale is in docs/harness-architecture.md § Threat model → Standing rules.

Functions

func PackTools

func PackTools(pack string) []string

PackTools returns the tool names belonging to a built-in pack name. See § Profiles → tool_packs.

func ResetTasks

func ResetTasks(sess ids.SessionID)

ResetTasks clears a session's task list. Used by /clear-style commands or explicit test teardown.

Types

type Agent

type Agent struct{}

func (Agent) Description

func (Agent) Description() string

func (Agent) InputSchema

func (Agent) InputSchema() []byte

func (Agent) Mutating

func (Agent) Mutating() bool

func (Agent) Name

func (Agent) Name() string

func (Agent) Run

type Bash

type Bash = bashImpl

Bash is the public alias for the shell-execution tool implementation.

type Edit

type Edit = editImpl

Edit is the public alias for the file-edit tool implementation.

type Glob

type Glob struct{}

Glob returns paths matching a glob pattern. Uses doublestar-compatible semantics: `**` matches any number of directories.

func (Glob) Description

func (Glob) Description() string

func (Glob) InputSchema

func (Glob) InputSchema() []byte

func (Glob) Mutating

func (Glob) Mutating() bool

func (Glob) Name

func (Glob) Name() string

func (Glob) Run

type Grep

type Grep struct{}

Grep finds lines matching a regex across files. Tiny ripgrep substitute — exact line matches per file.

func (Grep) Description

func (Grep) Description() string

func (Grep) InputSchema

func (Grep) InputSchema() []byte

func (Grep) Mutating

func (Grep) Mutating() bool

func (Grep) Name

func (Grep) Name() string

func (Grep) Run

type Ls

type Ls struct{}

Ls lists files in a directory.

func (Ls) Description

func (Ls) Description() string

func (Ls) InputSchema

func (Ls) InputSchema() []byte

func (Ls) Mutating

func (Ls) Mutating() bool

func (Ls) Name

func (Ls) Name() string

func (Ls) Run

func (Ls) Run(ctx context.Context, call tool.ToolCall, _ tool.EventSink) (*tool.ToolResult, error)

type Read

type Read struct {
	// MaxBytes caps a single Read response. 0 means use the default (1 MiB).
	MaxBytes int64
}

Read is the file-read tool. Reads up to MaxBytes from a file (default 1 MiB) and returns the text. Optional Offset (byte) and Limit (lines) for partial reads.

func (Read) Description

func (Read) Description() string

func (Read) InputSchema

func (Read) InputSchema() []byte

func (Read) Mutating

func (Read) Mutating() bool

func (Read) Name

func (Read) Name() string

func (Read) Run

func (r Read) Run(ctx context.Context, call tool.ToolCall, _ tool.EventSink) (*tool.ToolResult, error)

type Source

type Source struct {
	// EnabledPacks lets a profile constrain which packs of tools are
	// exposed (e.g., a CI profile that doesn't want Bash). Empty
	// means "all v0.1 built-ins."
	EnabledPacks []string
}

Source is the ToolSource that exposes the built-in tool set.

func (Source) Name

func (s Source) Name() string

func (Source) Tools

func (s Source) Tools(ctx context.Context) ([]tool.Tool, error)

Tools returns the built-in tools enabled for this source.

type TaskItem

type TaskItem struct {
	Content    string `json:"content"`              // imperative form, "Read x.go"
	Status     string `json:"status"`               // pending|in_progress|completed
	ActiveForm string `json:"activeForm,omitempty"` // present-progressive, "Reading x.go"
}

TaskItem is one entry in the plan.

func TaskListSnapshot

func TaskListSnapshot(sess ids.SessionID) ([]TaskItem, time.Time)

TaskListSnapshot returns the current list for a session. Exported so transports (REST, WS, web sidecar) can surface it without dispatching the tool — the tool is the WRITE path; this is the read.

type TaskList

type TaskList struct{}

TaskList is the tool the model calls to rewrite its plan. The active session is resolved from the dispatch ctx via tool.SessionFromContext, so a single registered instance serves all sessions without stale-binding bugs.

func (TaskList) Description

func (TaskList) Description() string

func (TaskList) InputSchema

func (TaskList) InputSchema() []byte

func (TaskList) Mutating

func (TaskList) Mutating() bool

func (TaskList) Name

func (TaskList) Name() string

func (TaskList) Run

type ToolSearch

type ToolSearch struct{}

ToolSearch tool. Stateless — pulls the registry from the dispatch ctx via tool.RegistryFromContext.

func (ToolSearch) Description

func (ToolSearch) Description() string

func (ToolSearch) InputSchema

func (ToolSearch) InputSchema() []byte

func (ToolSearch) Mutating

func (ToolSearch) Mutating() bool

func (ToolSearch) Name

func (ToolSearch) Name() string

func (ToolSearch) Run

type WebFetch

type WebFetch = webFetchImpl

WebFetch is the public alias for the HTTP-GET tool implementation.

type Write

type Write = writeImpl

Write is the public alias for the file-write tool implementation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL