tools

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 48 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// The user answered or skipped every question
	Submitted = "submitted"
	// The user dismissed the questions, those answered before kept
	Cancelled = "cancelled"
	// No answer came in time, those answered before kept
	TimedOut = "timed_out"
	// No one could be asked, the notice saying why
	Undelivered = "undelivered"
)

How a set of questions to the user ended

View Source
const (
	SearchTool   = toolsearch.SearchTool
	DescribeTool = toolsearch.DescribeTool
	CallTool     = toolsearch.CallTool
)

Names of the three tools that reach the tools found by search: tool_search finds them, tool_describe gives their schemas and tool_call runs them. No other tool may take them

View Source
const (
	SpillTag = "<persisted-output>"

	// Folder of the profile results are saved in
	SpillDir = "cache/spillover"
)

Marks of the block that stands in for a tool result saved to a file

View Source
const (
	IconRead   = "read"
	IconWrite  = "write"
	IconEdit   = "edit"
	IconFind   = "find"
	IconSearch = "search"
	IconShell  = "shell"
	IconOutput = "output"
	IconKill   = "kill"
	IconFetch  = "fetch"
	IconAgent  = "agent"
	IconRecord = "record"
	IconPlan   = "plan"
	IconServer = "server"
	IconAsk    = "ask"
)

Glyphs the app can mark a tool with

View Source
const DelegatedMarker = "ICEBATH_DELEGATED_CHILD_CONTEXT"

Variable a command of a subagent's session carries, so what it starts knows it works for a delegated agent

View Source
const ErrorChars = 2048

Longest error text a result carries before it is cut

View Source
const (
	Every = "all"
)

Word a toolset may hold for every toolset there is, and the other way alpha spelled it

View Source
const GuardrailRefusal = "guardrail_refusal"

Key a refusal of a redundant call carries, which no failure is

View Source
const Unlimited = math.MaxInt

Size of a result kept in the chat whatever its size, as read_file has to avoid saving what it reads back from a saved result

Variables

View Source
var ErrClient = errors.New("Your shell has more variables than a session keeps, which is at most " + strs.Count(clientMaxNames, "variable") + " and " +
	strs.Counted(clientMaxChars, "characters") + " in all. None of them were kept.")
View Source
var Fires = []hooks.Site{
	{Point: hooks.PreToolCall, By: "the tools", When: "before each tool call runs"},
	{Point: hooks.PostToolCall, By: "the tools", When: "after each tool call, with what came of it"},
	{Point: hooks.TransformToolResult, By: "the tools", When: "as the result of a tool call is about to reach the model"},
	{Point: hooks.PreVerify, By: "the tools", When: "as a reply that changed code is about to end"},
}

The moments of the tools the hook points hear of, which the hooks screen and Doctor say of each point

View Source
var Pruned = []string{".archive", ".backups", ".cache", ".git", ".gradle", ".hg", ".m2", ".mypy_cache", ".next", ".nox", ".npm", ".nuget", ".nuxt",
	".parcel-cache", ".pnpm-store", ".pytest_cache", ".ruff_cache", ".svelte-kit", ".svn", ".tox", ".Trash", ".turbo", ".venv", ".yarn", "__pycache__",
	"backup", "backups", "build", "coverage", "dist", "dist-packages", "node_modules", "out", "site-packages", "target", "third_party", "vendor", "venv"}

Folders of dependencies, builds, caches, version control and backups that broad scans skip, by name, at any depth

View Source
var SessionNames = []string{
	"ICEBATH_SESSION_PLATFORM", "ICEBATH_SESSION_SOURCE", "ICEBATH_SESSION_CHAT_ID", "ICEBATH_SESSION_CHAT_TYPE", "ICEBATH_SESSION_CHAT_NAME",
	"ICEBATH_SESSION_THREAD_ID", "ICEBATH_SESSION_USER_ID", "ICEBATH_SESSION_USER_ID_ALT", "ICEBATH_SESSION_USER_NAME", "ICEBATH_SESSION_SCOPE_ID",
	"ICEBATH_SESSION_KEY", "ICEBATH_SESSION_ID", "ICEBATH_UI_SESSION_ID", "ICEBATH_SESSION_MESSAGE_ID", "ICEBATH_SESSION_PROFILE",
	"ICEBATH_CRON_SESSION", "ICEBATH_SESSION_PARENT_CHAT_ID", "ICEBATH_CRON_AUTO_DELIVER_PLATFORM", "ICEBATH_CRON_AUTO_DELIVER_CHAT_ID",
	"ICEBATH_CRON_AUTO_DELIVER_THREAD_ID", DelegatedMarker,
}

Variables naming the session a command runs for, which every command a session runs is given anew: those the session binds hold its values, the rest are cleared so a value the server's own environment carries never stands in

View Source
var Signatures = []Signature{
	{"\x89PNG\r\n\x1a\n", "PNG image data"},
	{"\xff\xd8\xff", "JPEG image data"},
	{"GIF87a", "GIF image data"},
	{"GIF89a", "GIF image data"},
	{"RIFF", "RIFF container (WAV/AVI/WebP family)"},
	{"%PDF-", "PDF document"},
	{"PK\x03\x04", "ZIP archive (also docx/xlsx/jar/apk)"},
	{"PK\x05\x06", "ZIP archive (empty)"},
	{"\x1f\x8b", "gzip compressed data"},
	{"BZh", "bzip2 compressed data"},
	{"\xfd7zXZ\x00", "xz compressed data"},
	{"7z\xbc\xaf\x27\x1c", "7-Zip archive"},
	{"\x7fELF", "ELF executable"},
	{"MZ", "Windows PE executable"},
	{"\xcf\xfa\xed\xfe", "Mach-O executable (64-bit)"},
	{"\xca\xfe\xba\xbe", "Mach-O universal binary / Java class"},
	{"SQLite format 3\x00", "SQLite database"},
	{"OggS", "Ogg container"},
	{"fLaC", "FLAC audio"},
	{"ID3", "MP3 audio (ID3 tag)"},
	{"\x00\x00\x00", "ISO media container (MP4/MOV family)"},
	{"BM", "BMP image data"},
	{"II*\x00", "TIFF image data (little-endian)"},
	{"MM\x00*", "TIFF image data (big-endian)"},
}

Binary kinds the file and web tools tell apart, first match winning, longer prefixes sharing a first byte first

Functions

func Bound

func Bound(text string, limit int) string

func BoundError

func BoundError(text string) string

Error text of a result cut to the characters the model reads of an error

func Broke

func Broke(tool, result string) (bool, string)

Whether a result says the call failed, and in a word how: a command's non zero exit, an error the result names, a failed status, every result of a batch failing, else an error marker near its start. A write that landed and a refusal of a redundant call are no failures

func Called

func Called(name, arguments string) (string, string)

The tool a call runs and the arguments it gives it, as a person is shown the call and the hooks hear of it: the one tool a tool_call runs and its arguments, any other call as it is

func ClientVariables

func ClientVariables(extra []string) map[string]string

Variables of this process's shell a session it starts keeps as its client's: the behaviour variables, the toolchain and the extra names the profile's client variables setting lists

func CompileGlob

func CompileGlob(pattern string) *regexp.Regexp

Expression of the glob as Glob reads it, for a caller matching many names; nil for a pattern that makes none

func Definitions

func Definitions(defs []Def, env *Env) []map[string]any

What the model is sent of the tools, whatever registered each one, built in, of a plugin, of an MCP server or of an extension: its parameters as schema.Make makes them, in a form every provider takes. One that already was is the very map the tool holds, one that was not a copy, the tool's own left as it was; a call that names a key as it was sent is read back to the key the tool declares

func EntryID

func EntryID(id string, at, of int) string

Id one tool of a tool_call runs under: the call's own for its only tool, the call's with the place of the tool after it otherwise

func ErrorResult

func ErrorResult(err error) string

func ErrorText

func ErrorText(result string) string

Error a result names, as text: a text as it is, any other value as the JSON it was written as; empty when it names none

func Expired

func Expired(path string) string

Hint for a path that is missing when it is that of a saved result, which the sweep pruned or its session took with it; empty otherwise

func Failed

func Failed(result string) bool

func Folders

func Folders(cfg *config.Config, key string) ([]string, bool)

Entries of a setting that lists folders or patterns of them, empty ones left out; false when it holds anything but a list of text

func Glob

func Glob(name, pattern string) bool

Whether the whole name matches the glob, case kept: * and ? match any character, slashes included, [...] is a set with ! for none of it

func Groups

func Groups(defs []Def) map[string]string

Heading of each toolset by its name: the one a tool of it gives, else its name in words

func Identify

func Identify(sample []byte) string

Name of the binary kind the bytes start as, empty when none; ISO media also needs ftyp at offset 4

func Inside

func Inside(path, folder string) bool

Whether the path is the folder or lies under it, links unresolved

func JSON

func JSON(value any) string

Result as JSON on one line, text left unescaped, a value that cannot be encoded as the error result

func Joined

func Joined(names, results []string) string

Results of the tools one tool_call ran, in their order: the only result as it is, else each under a line with its place and its tool

func Keep

func Keep(cfg *config.Config, disabled []string) error

Keeps the list of the tools that are off for the profile, each once and in order: what turning tools on or off and every write of the setting end in

func Lacking

func Lacking(def Def, env *Env) string

What a tool lacks to run for the profile, empty when it can run

func Landed

func Landed(def Def, call *Call, result string) []string

Files the write of a call landed in, as its result says: those it modified, made and deleted, both ends of a move, else the one it resolved, else the paths the call names; none for a tool that writes no paths or a result that is no success. Paths are as the tool gave them

func Local

func Local(surface string) bool

Whether the surface is one a front end of icebath shows its sessions on, rather than a chat platform

func MarkerRoot

func MarkerRoot(dir string) string

Nearest folder at or a few above the folder holding a project marker, never the home or the shared temporary folder; empty when none does

func Object

func Object(result string) map[string]any

Result of a tool read as a JSON object, nil when it is none

func Once

func Once[T any](env *Env, key string, ask func() T) T

Answer of the question the key names, such as how the profile's terminal backend stands, which the checks of several tools ask: asked once for an env Fresh made however many tools ask it, a tool asking while it is asked waiting for it, and asked each time with any other env. A key names one kind of answer

func Outside

func Outside(tool, result string) string

Result of outside content the tool returned as the model is handed it: inside a block that tells it to read the content as data

func Preview

func Preview(content string, limit int) (string, bool)

Start of a text cut at its last line break within the limit, and whether more follows

func ProjectRoot

func ProjectRoot(dir string) (root, git string)

Root of the project the folder is in, and its git checkout alone: the checkout's top, else the nearest folder with a project marker; empty outside a project

func Property

func Property(kind, description string) map[string]any

func Repeat

func Repeat(result string) bool

Whether a result is the note Repeated hands the model in place of one it got before

func Repeated

func Repeated(tool, first, args string) string

Note the model is handed in place of a result byte-identical to one it got earlier in the turn: the tool, the call that got the first, empty when not known, and the arguments of the call

func Save

func Save(cfg *config.Config, content, name string) string

Saves a text a tool keeps aside for the model to page, such as the whole output of a script, in the profile's folder of saved results under the name, where the sweep deletes it once no transcript names it: its path, empty when it could not be written

func Saved

func Saved(result string) (path, size string, ok bool)

Where a result saved to a file for being too large is, and its size in words such as 1.2 MB, read from the block that stands in for it; false for a result kept whole

func Scheduled

func Scheduled(platform string) bool

Whether the session runs as a scheduled job, which no one points at a folder: one started on the cron surface

func Schema

func Schema(description string, required []string, properties map[string]any) map[string]any

Schema of a tool: what the model reads of it, the arguments every call must name and the properties of each argument. Required of nil names none and is sent as an empty list, which every provider takes, never as null, and properties of nil are an object of none

func SessionVars

func SessionVars(call *Call) map[string]string

Variables of the session a call works for, by every name of SessionNames: the session's id, its profile, the platform of a session of a chat app with the chat and the person it talks with, and the marker of a subagent's session hold values, the other names hold none and are cleared; nil outside a session

func Shown

func Shown(call *sessionsv1.ToolCall) *sessionsv1.ToolCall

The call as a person is shown it and hears of it: a tool_call of one tool as a call of that tool under the same id, any other as it is

func Skipped

func Skipped(name string) bool

Whether a folder of the name is one broad scans skip

func Spill

func Spill(env *Env, content, tool, id string, threshold, preview int) string

Result in the chat: the text when it fits the threshold, else a block pointing at the file it was saved in with its start; its start alone with a note when it could not be saved

func Sweep

func Sweep(cfg *config.Config, retention time.Duration, referenced func(name string) (bool, error)) int

Deletes the profile's saved results older than the retention, at least a day, that no transcript points at any more; how many went. Referenced tells whether a transcript names a file, and an error keeps it

func Thumbnail

func Thumbnail(data []byte) ([]byte, string)

Small copy of a picture a tool made or looked at, which the chat draws with the call's result, as JPEG or PNG bytes and their type; nil when it can't be read

func ThumbnailFile

func ThumbnailFile(file string) string

Thumbnail of the picture in a file as a data URL, which a call's Display carries for its view to draw; empty when it is no picture that can be read

func Trust

func Trust(cfg *config.Config, folders ...string) error

Adds folders to the trusted folders setting, the one list of them. A folder the list trusts already, as it reads, is left out, and every item the list holds stays as it is written, a ${NAME} in it kept rather than what its variable holds; a setting that holds no list is replaced by the folders

func Trusted

func Trusted(cfg *config.Config, root string, working ...string) bool

Whether tools may run the project's own toolchain in the folder: it lies in a folder of the trusted folders setting, or in the git worktree of one of the folders the user works in, the folders of the sessions given, unless that worktree holds the home folder. The folder the server process started in is none of them, as a server many windows reach started in none of theirs

func TrustedFolders

func TrustedFolders(cfg *config.Config) ([]string, bool)

Folders of the trusted folders setting; false when it holds anything but a list of text, which then trusts nothing

func Unwrapped

func Unwrapped(result string) string

Result as the tool returned it, out of the block Outside put it in; any other result as it is

func Visible

func Visible(text string) string

Text shown to the user to decide on, such as a command to approve or a question to answer, with everything that could hide part of it made visible: invisible and control code points escaped, long padding and runs of blank lines counted instead of shown

func Vouches

func Vouches(platform string) bool

Whether the folder a session of the surface works in vouches for the workspace it lies in, as one the user works in: not for a scheduled job, which no one points at a folder, nor for a kanban worker, which works for the board rather than in a folder of the user's

func Worktree

func Worktree(path string) string

Nearest folder at or above the path holding a .git file or folder, empty when there is none

func Wrote

func Wrote(tool, result string) bool

Whether a file write's result proves it landed

Types

type Adder

type Adder interface {
	Add(ctx context.Context, def Def, call *Call, result string) string
}

Registrant that adds words of its own to what the model reads of a call's result, such as the instruction files of a folder the call first reached: asked once the result is whole and anything too long of it saved aside, so its words are never cut off with the result; empty for nothing to add

type Arrangement

type Arrangement struct {
	// Toolset the place starts from in place of the one it comes with: nil keeps it, empty puts back the one it comes with
	Base *string
	// Toolsets, composites and tools to turn on or off for the place, as On says
	Turn []string
	On   bool
	// Puts the place back as shipped, every change of it dropped
	Reset bool
}

A change of the tools of a place a person asks for

type Assembly

type Assembly struct {
	Searching Searching
	// Tools the request carries, in the order they are sent: those listed, then while tool search is on the three that reach the others,
	// and what the model is sent of them
	Defs        []Def
	Definitions []map[string]any
	// Tools found by search in place of being sent, none while tool search is off
	Deferred []Def
	// Tool search is on for the request; why not when it is off though some tool would be found by search, and whether that is the tools of
	// the search turned off for the profile
	On    bool
	Off   string
	Muted bool
	// How many of the tools offered search would find, the tokens their definitions take, the tokens of the share of the window that
	// turns the search on, and the most tokens the listing may take
	Found, Tokens, Threshold, Budget int
	// How much of the tools found by search the description of tool_search names, as the session keeps it
	Form toolsearch.Form
	// Groups of tools search finds that the description the session keeps does not name, such as the tools of a server that came after,
	// and groups it names that search no longer finds, each with how many tools it has
	Unlisted, Gone []string
}

What a request of a session carries of the tools it is offered

func (Assembly) About

func (a Assembly) About() string

How tool search stands for the assembly, a sentence a person reads

func (Assembly) Note

func (a Assembly) Note() string

What the model is told once of groups of tools the kept listing of tool_search does not name, and of those it names that are gone, as a note of the next message; empty when the listing names them all

type Blocked

type Blocked struct {
	Tool Def
	Why  string
}

A tool that is on and can't run, and what it lacks in a person's words

type Bridged

type Bridged struct {
	Name string
	// The tool, and the arguments it is given as a JSON object coerced to its schema
	Def       Def
	Arguments string
	// Why it does not run, a result the model reads; empty when it runs
	Refusal string
}

One tool a tool_call runs

type Budget

type Budget struct {
	Result  int
	Turn    int
	Preview int
	MCP     int
}

How much of its tool results a turn keeps in the chat before the rest is saved to files: one result, all the results of a reply, the preview a saved one keeps, and one result of an MCP tool

func BudgetFor

func BudgetFor(cfg *config.Config, window int) Budget

Budget for a window of that many tokens, the defaults capped to shares of it and floored; the defaults when the window is not known

func (Budget) Threshold

func (b Budget) Threshold(def Def) int

Largest result of the tool the chat keeps: none for the pinned tools, the MCP size for an MCP tool, the tool's own when smaller

type Bundle

type Bundle struct {
	// Place as its sessions record it, such as tui, telegram or cron; empty for the bundle of every place no other bundle is of
	Surface string
	// What a person calls the place, and what is done there in a phrase
	Title, About string
	// Toolset its sessions get, a composite of the toolsets that suit the place
	Toolset string
	// Its sessions also get every toolset of a plugin, an extension or an MCP server that no toolset icebath declares names, unless it is
	// off, as most places do; a place whose sessions take outside input as it comes, such as a webhook's, gets its toolset alone
	Open bool
	// Toolsets the place gets beside its toolset, those off everywhere else among them, such as the board's tools for its workers
	Adds []string
	// Toolsets the place goes without whatever brings them, such as sending messages for a program that calls the API
	Leaves []string
}

What the sessions of one place get of the tools until a person changes it there

type Bundler

type Bundler interface {
	Bundles() []Bundle
}

Registrant that declares what the sessions of places get of the tools

type Call

type Call struct {
	Name       string
	Args       map[string]any
	RawArgs    string
	ToolCallID string
	SessionID  string
	Env        *Env
	// Images or videos the result hands the model along with its text, which reach it only when Env.Aux says the main model takes them
	Media []*sessionsv1.Media
	// What the user is shown of the result in place of its text, such as the change a write made; never sent to the model
	Display string
	// Tells the user how far a long call got: progress out of total, total nil when not known, and what it is doing now; nil where
	// nobody watches
	Progress func(progress float64, total *float64, message string)
}

type Capture

type Capture struct {
	// contains filtered or unexported fields
}

func NewCapture

func NewCapture(limit int) *Capture

func (*Capture) String

func (c *Capture) String() string

func (*Capture) Write

func (c *Capture) Write(data []byte) (int, error)

type Carrier

type Carrier interface {
	Carried(env *Env, session string) string
}

Registrant whose tools keep state of a session the model must still see once the messages that showed it are compacted away, such as a task list: the text it hands back is put into the compacted context, its first line marking it so an older copy is replaced

type Checker

type Checker interface {
	// Whether it takes files of the extension, so a write keeps the content it replaces to compare against
	Handles(cfg *config.Config, extension string) bool
	// Whether it checks the file, so the per file shell check that floods false errors is left out
	Checks(cfg *config.Config, path string) bool
	// Diagnostics the edit brought in as a block the model reads, empty when there are none or the verdict comes after the call; a late
	// verdict is handed to the session, the owner
	Check(ctx context.Context, cfg *config.Config, path string, before, after *string, owner string, started time.Time) string
}

Registrant that checks what the file tools write, such as the language servers

type Client

type Client struct {
	Env map[string]string `json:"env"`
	// The client runs on this machine, so its toolchain holds here; of a remote one only the behaviour variables that name nothing of a
	// machine are kept
	Local bool `json:"local"`
	// Behaviour variables kept, toolchain variables kept by name and by prefix, and the fragments that mark a name as a credential
	Behaviour []string `json:"behaviour"`
	Names     []string `json:"names"`
	Prefixes  []string `json:"prefixes"`
	Secret    []string `json:"secret"`
}

Shell of the user's client as a session froze it: the variables of it the session keeps, and the rules they were kept by

func FreezeClient

func FreezeClient(variables map[string]string, local bool, extra []string) (*Client, error)

Client a session freezes from the variables its first message came with, kept by the rules of a client on this machine or of a remote one, extra naming the profile's client variables; ErrClient for more than a session takes

func (*Client) Lookup

func (c *Client) Lookup(cfg *config.Config, name string) (string, bool)

Value of a behaviour variable for the session: its client's when it has one that may set it, else that of the environment of the session's profile; false when neither sets it

func (*Client) Toolchain

func (c *Client) Toolchain(base map[string]string) map[string]string

Environment the session's commands start from: base without the behaviour variables the client sets, and, for a client on this machine, with its toolchain in place of base's own, PATH replaced rather than dropped

type Compacter

type Compacter interface {
	Compacted(cfg *config.Config, session string)
}

Registrant that keeps what the model was shown in a session, which it forgets once the session's context is compacted and the model no longer holds those results

type Continuer

type Continuer interface {
	Continue(ctx context.Context, env *Env, ending Ending) string
}

Registrant that may send the agent back once more before a turn that changed code ends, after the verification evidence said nothing was due, such as the pre_verify hooks: the message the agent is sent back with, empty to let the turn end

type Def

type Def struct {
	Name    string
	Toolset string
	// Name shown in the app, the tool name when empty
	Title string
	// What the tool lets the agent do, a phrase for a person with no period, at most 70 characters: "Read a file of the project".
	// The description in Schema is written for the model and is not shown in its place
	About string
	// Heading the app lists the tools of the toolset under, such as Files; one tool of a toolset saying it is enough
	Group string
	// Glyph the app marks the tool with, one of the Icon names, a generic one when empty
	Icon string
	// Argument whose value the app shows next to the title, such as "path"; the first text argument when empty
	Subject string
	// Argument whose value is the line of the file the call names that the call starts at, such as "offset", which a code editor opens
	// the file at; none for a tool whose calls name no line
	Line string
	// View the app shows the tool's calls with, for a tool of a kind whose calls all show one way, such as those of MCP servers; the view
	// of the tool's own name when empty
	View string
	// Kinds of risky action the tool asks approval for, each the reason it hands to Env.Approve, offered in the approvals allowlist
	Risks  []string
	Schema map[string]any
	// Schema for the session in place of Schema, such as one that depends on its main model; nil, or a nil result, keeps Schema
	Dynamic func(env *Env) map[string]any
	Handler Handler
	Check   func(env *Env) bool
	// What the tool lacks while Check says it can't run, in a person's words, such as "It needs a web search service that is ready."
	Lacks          func(env *Env) string
	MaxResultChars int
	// What a call does to the world: a read only call may be stopped or repeated freely, a mutating one that succeeds is progress
	Effect Effect
	// Whether a call may run at the same time as the other calls of its reply: tools that read and keep no state of the session
	Parallel bool
	// Paths a call reads or writes and whether it writes them, for a tool that may run alongside others on paths of its own: calls on
	// overlapping paths where one writes run in turn, and a call that names none runs alone
	Paths func(env *Env, args map[string]any) (paths []string, writes bool)
	// Failing is part of the tool's normal output, such as a command that exits non zero, so failures alone are no sign of a loop
	Fallible bool
	// What the tool returns comes from outside, such as a web page, so the model is handed it as data, never as instructions
	Untrusted bool
	// The tool is polled, so calling it again with the same arguments is no sign of being stuck
	Polls bool
	// Longest a call may take when longer than the agent's own limit, for a tool with a budget of its own; negative for a tool that
	// watches its own liveness and is given no limit. Such a call runs alone
	Timeout time.Duration
	// Left out of sessions in the coding focus posture, as having nothing to do with code, such as pictures, speech or scheduled jobs
	Unfocused bool
	// Most calls of a batch running at once while one of the tool's calls is in it, as a setting says, such as pictures drawn at the same
	// time a service's rate limits allow; nil leaves the batch at its own limit
	Workers func(env *Env) int
	// Profile whose sessions alone get the tool, such as one of a server the profile set up; every profile when empty
	Profile string
	// How a session with more tools than its requests should carry reaches the tool while tool search is on: found by search, as the
	// tools of plugins and MCP servers are, sent with every request, or one of the agent's own that few sessions use, found by search
	Search Reach
	// Name of the MCP server the tool is of, as its settings give it, empty for every other tool: tool search groups the tools of a server
	// under its name and tells of the servers set up for the profile whose tools can't run
	MCP string
	// What of the model's own writing the tool runs: commands, as the terminal does, or code by another name, such as a Python script, which
	// a session is offered only while it is offered a tool that runs commands; nothing for most tools
	Runs Runs
	// The tool keeps the agent's own bookkeeping rather than doing the work, such as its notes, its task list, its skills or a search of
	// past sessions: the words of a reply whose calls all went to such tools may stand as the answer when the next reply comes back with
	// nothing
	Housekeeping bool
}

Tool a plugin adds: what the model sees, what runs, and how the app shows it

func (Def) For

func (d Def) For(env *Env) map[string]any

Schema the model of the session sees

func (Def) Label

func (d Def) Label() string

Name shown in the app

func (Def) Sign

func (d Def) Sign() string

Sign a call of the tool is shown with where text alone shows it, by the glyph the tool marks itself with; a gear for a tool that names none, or a tool not known

func (Def) SubjectOf

func (d Def) SubjectOf(arguments string) string

What a call of the tool works on in a line, as a person reads it beside the tool's name: the argument the tool names as what it works on, else the first argument of the call that is text; empty for a call with neither

type Delegated

type Delegated struct {
	// Session of the agent that delegated to it
	Parent string
	// Its id in the spawn tree, such as sa-0-1a2b3c4d
	ID string
	// How deep it nests: 1 for a child of a session of its own
	Depth int
	// Background processes of the session handed over to the parent so far, and records one more, which the parent hears the end of in its
	// place
	Handoffs func() int
	Handoff  func(process, command, note string)
	// Tells the parent's session something out of turn, such as the end of a background process it took over
	Notify func(notice Notice) error
}

What a session running as a subagent knows of the agent that delegated to it

type Edit

type Edit struct {
	Path          string
	Before, After *string
}

One change to a file that waits on an answer: what the file holds before, nil for one that is not there, and what it would hold, nil for one that goes

type Effect

type Effect int

What running a tool does to the world

const (
	// May change something; nothing is known
	MayChange Effect = iota
	// Only reads: a call stopped midway or run again changes nothing
	ReadOnly
	// Changes files, the machine or the session's state, so a call that succeeds is progress
	Mutates
)

type Ender

type Ender interface {
	Ended(env *Env, session string)
}

Registrant whose tools keep something for one turn only, such as a browser session: told the session's turn ended, whatever way it ended, so it lets go of what the next turn makes again

type Ending

type Ending struct {
	Session  string
	Platform string
	Model    string
	// The session works on code, in a project the coding posture applies to
	Coding bool
	// Times the registrants kept this turn going so far
	Attempt int
	// The answer the turn is about to end with
	Final string
	// Files the turn's writes landed in, sorted
	Changed []string
}

What a turn is about to end with, for the registrants that may keep it going

type Env

type Env struct {
	Cwd    string
	Config *config.Config
	// Asks the user to allow a flagged action, as the approvals decide, the answer remembered under the reason: nil when it may go ahead,
	// else a *Refusal saying why not; nil where no one can be asked
	Approve func(ctx context.Context, action, reason string) error
	// Asks as Approve does, with the options of the gate, such as asking every time
	Gate func(ctx context.Context, gate Gate) error
	// Checks a shell command against the approval rules before it runs, asking the user when they flag it; isolated for a backend whose
	// commands can't reach this machine, where only the always-deny patterns apply
	Command func(ctx context.Context, command string, isolated bool) Verdict
	// Asks the user the questions and waits for the answers, nil where no one can be asked
	Clarify func(ctx context.Context, questions []Question) (Reply, error)
	// Helper models of the session's profile, routed from its main model; nil where no session runs
	Aux *auxiliary.Client
	// Adds a message to the session from outside a turn, such as one a background process sends as it ends: the agent answers it in a
	// turn of its own, after the one running; an error when the session can't take it; nil where nothing can reach the session later
	Notify func(notice Notice) error
	// Whether the user sent a message while the tool runs, consumed by the first tool that asks: a long tool hands its work to the
	// background and returns, so the agent can answer; nil where no one can send one
	Yield func() bool
	// Surface the session is shown on, such as "tui", whose own disabled skills are left out; none where not known
	Platform string
	// Where a session of a chat app talks, the chat and the person, which the commands the session runs are told of: for a subagent that
	// of the session that delegated to it; nil or empty for a session of no chat app
	Peer *sessionsv1.Peer
	// The turn answers one query and the session ends, such as a one-shot run of the command line: what tools wait on to set up gets
	// longer
	OneShot bool
	// Shell the user's client runs in, as the session froze it from the first message it was sent; nil when it was sent none
	Client *Client
	// Tokens the session's main model takes in at once, which sizes how much of a tool result stays in the chat; 0 when not known
	Window int
	// Path the session's commands see a file of the profile's caches at, such as a saved tool result inside a sandbox; nil where host
	// paths hold
	Visible func(host string) string
	// The session runs as a subagent another session's agent delegated a task to; nil for a session of its own
	Delegated *Delegated
	// Text the session keeps under the name from the first time it is made, such as the description of tool_search with its listing, so
	// every request of the session carries it the same way and a provider's prompt cache holds; nil makes it each time
	Keep func(name string, make func() string) string
	// Tokens of the text and of the tool definitions as the session's main model reads them, such as with its own tokenizer; nil where
	// nothing counts them for the session, where they are estimated
	Count func(text string, definitions []map[string]any) int
	// contains filtered or unexported fields
}

func (*Env) Deferred

func (e *Env) Deferred(name string) bool

Whether tool search finds the tool of the name for the session of the env, so the session calls it through tool_call

func (*Env) Fresh

func (e *Env) Fresh() *Env

Copy of the env for one listing or one dispatch, whose checks ask each question Once names once

func (*Env) Main

func (e *Env) Main() provider.Route

Main model of the session: its provider, by name and kind, and its model; empty where no session runs

type Evidence

type Evidence struct {
	// passed or failed
	Status string `json:"status"`
	// What kind of check it was, such as test, lint, build or verify
	Kind string `json:"kind"`
	// full, or targeted for a check of some files or tests alone
	Scope string `json:"scope"`
	// The project's own command it ran
	Canonical string `json:"canonical_command"`
}

What a check a session ran proved, as the result of its command tells the model

type Finisher

type Finisher interface {
	Finished(call *Call, result string)
}

Registrant that hears of every call once its tool returned, with the result the model reads, such as a write that landed

type Gate

type Gate struct {
	// Name the answer is remembered under, for the session or always in the allowlist; the description when empty
	Key string
	// What it is flagged as, as the user reads it; the key when empty
	Description string
	// What would run or change, as shown to the user
	Target string
	// Asked every time whatever the mode, yolo, the allowlist or an earlier answer say, with no answer that lasts past this one: for
	// actions the user must see each time, such as edits to the files that steer agents
	Strict bool
	// What the model reads when a scheduled job, a one-shot run or an unattended surface refuses it without asking; a general text when
	// empty
	Blocked string
	// What the refusal of a one-shot run or a scheduled job says needed approval, such as "computer_use `click` requires approval", the
	// kind of action it allows and what to do instead; the description, flagged actions and a general advice when empty
	Subject, Noun, Advice string
	// What the model reads when nobody is there to ask, a general text when empty
	Unanswered string
	// The action runs code the user is shown, such as a Python script that can reach past the command checks: let through on the user's
	// own window and asked of them only on a surface they reach from elsewhere, such as a chat app, or when ICEBATH_EXEC_ASK says to ask,
	// the smart reviewer first; Subject says what the code may do in the refusal of a context nobody watches
	Code bool
	// Changes to files the action makes, which a surface that draws changes shows as such beside the target, such as a code editor; none
	// for an action that changes no file
	Edits []Edit
}

Action a tool asks the user to allow, which the approvals decide on

type Group

type Group struct {
	Title string
	// Keys of the settings sections that hold options of its tools: the options of the first are listed on its page, each other one is a
	// row there that opens its own
	Sections []string
	// Key of the area of the settings menu its options are, for a group whose options are an area of their own, and the argument the page of
	// that area is opened with
	Area, Opens string
	// Its tools are turned on and off on the page of its area, their one home, so the group lists none of them
	Elsewhere bool
	// Place among the groups, lowest first
	Order int
	// Profile the group is of, every profile when empty
	Profile string
}

Heading the app lists tools under, and where the options of its tools are: declared by the plugins whose tools or settings belong to it, the declarations of one title making one group

type Grouper

type Grouper interface {
	Groups() []Group
}

Registrant that declares the groups its tools are listed under

type Guard

type Guard interface {
	// Why a write to the path is refused or must be approved, empty when it may go ahead
	Unwritable(cfg *config.Config, path string) string
	// Why a read of the path is refused, empty when it may go ahead
	Unreadable(cfg *config.Config, path string) string
}

Registrant that guards paths of this machine, which the tools of other plugins that write or read a file of the model's choosing ask too, such as text_to_speech writing its audio: the file tools' credential stores, system files and write safe root

type Handler

type Handler func(ctx context.Context, call *Call) string

func Bind

func Bind[T any](run func(ctx context.Context, call *Call, args T) (string, error)) Handler

type Holder

type Holder interface {
	Hold(ctx context.Context, env *Env, ending Ending) string
}

Registrant that holds a session's turn open until the session did what its work owes, such as a board worker that must hand its task back: asked before every turn of a session ends, the message the agent is sent back with, empty to let the turn end

type Journal

type Journal struct {
	// Family the file is named for, such as image_tools
	Name string
	// contains filtered or unexported fields
}

Record of the calls of a family of tools this run, one for each profile, written whole to a JSON file in that profile's logs folder after each call while the family's debug setting is on, so no profile's file holds the calls of another

func (*Journal) Record

func (j *Journal) Record(cfg *config.Config, key, tool string, data map[string]any)

Adds a call of the tool to the record of the profile and writes that record again, when the setting under key is on

type Lingerer

type Lingerer interface {
	// Waits until the session's work that will tell it of its end has, its notices handed to Env.Notify, the deadline passed or the
	// context ended; whether there was any such work, and whether some of it still runs
	Linger(ctx context.Context, env *Env, session string, deadline time.Time) (waited, running bool)
}

Registrant whose tools leave work running past their call that tells the session when it ends, such as a background process that notifies on completion: a one-shot session waits for it before it ends

type Noter

type Noter interface {
	// Notes of the session, each handed out once, oldest first; with a deadline ahead, first waits until the session's work that will note
	// something settled, the deadline passed or the context ended
	Notes(ctx context.Context, session string, deadline time.Time) []string
}

Registrant whose tools learn more of a call after its result returned, such as a language server that answers an edit after the write did: the agent hands the notes to the model with the next results it stores and with the next message of the session, and before a turn ends waits for those still coming, five seconds at most, going on with the turn to answer them three times at most

type Notice

type Notice struct {
	// What the model reads
	Text string
	// Short line the user sees for it, none when empty
	Title string
}

Message a session gets from outside a turn

type Origin

type Origin struct {
	Def  Def
	By   Reached
	Path []string
}

A tool a place holds, how, and the toolsets that brought it, the outermost first, such as icebath-cli, debugging, terminal; none for a tool named on its own

func (Origin) Said

func (o Origin) Said() string

Where the tool comes from in words a person reads, such as From icebath-cli, debugging, terminal

type Place

type Place struct {
	Name, Title string
}

A place whose sessions get tools: the name its sessions record as their source, and what a person calls it

type Preparer

type Preparer interface {
	Prepare(env *Env)
}

Registrant whose tools follow what the session's settings set up, such as the servers a profile connects: readied for the session each time its tools are listed or a call is dispatched

type Project

type Project struct {
	Root         string
	Manifests    []string
	Managers     []string
	Verify       []string
	ContextFiles []string
}

What a project holds: its root, its manifests, package managers, the commands that check it and its instructions for agents

func ProjectAt

func ProjectAt(root string) Project

What the project at the root holds

func ProjectOf

func ProjectOf(dir string) (Project, bool)

What the project the folder is in holds; false outside a project

type Question

type Question struct {
	// Stable within the set, the key of its answer
	ID   string
	Text string
	// Choices to pick from as shown, the recommended one first; none for an open question, which takes typed text
	Choices []string
	// Whether any number of the choices may be picked
	MultiSelect bool
	// The answer is a secret, such as a password: masked as it is typed and never shown again
	Secret bool
}

Question to the user, one of the set Env.Clarify asks at once

type Reach

type Reach int

How a session with more tools than its requests should carry reaches a tool while tool search is on

const (
	// A tool search finds, as the tools of plugins and MCP servers are
	Found Reach = iota
	// Sent with every request, as the agent's own tools that most sessions use are
	Listed
	// One of the agent's own tools that most sessions never use, found by search
	Rare
)

type Reached

type Reached int

How a place came to hold a tool

const (
	// The toolset the place starts from, its own or the one a person picked
	ByBase Reached = iota
	// A toolset the place gets beside it
	ByAdds
	// A toolset of a plugin, an extension or an MCP server that an open place takes
	ByOpen
	// A person turned it on for the place
	ByOn
	// A run holds its session to the toolsets that brought it
	ByHeld
)

type Refusal

type Refusal struct {
	// What the model reads
	Message string
	// One line the user reads of what became of it, empty when there is nothing to add
	Summary string
	// How it ended: denied, timeout, cancelled, blocked, or how a rule refused it
	Outcome string
	// What the user said when they denied it
	Reason string
}

Why a flagged action or command did not go ahead

func (*Refusal) Error

func (r *Refusal) Error() string

type Registrant

type Registrant interface {
	Tools() []Def
}

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

func (*Registry) Added

func (r *Registry) Added(ctx context.Context, def Def, call *Call, result string) string

Words every registrant of the host that adds to results gives for the call, those of the registries nested in it among them, in the order they were registered, each after a blank line; empty for none

func (*Registry) Assemble

func (r *Registry) Assemble(env *Env, offered []Def) Assembly

What a request of the session of the env carries of the tools it is offered, the one way every request is made: while tool search is on for them, the tools it finds leave the request and tool_search, tool_describe and tool_call take their place. The description of tool_search is made once for the session and kept, so its requests carry the same tools until its prompt is built anew and a provider's prompt cache holds; the search reads the live catalog. The env keeps what the three tools read of the session. A tool that runs code is held back while the assembler offers no tool that runs commands, whatever left it out, the env keeping why for a call of it

func (*Registry) Bridged

func (r *Registry) Bridged(env *Env, arguments string) ([]Bridged, string)

What a tool_call of the session of the env runs, read from its arguments as the model wrote them: each tool it names with its arguments, or why that one does not run, checked against the tool's schema before it runs. Else why the call runs nothing, a result the model reads

func (*Registry) BundleOf

func (r *Registry) BundleOf(surface string) Bundle

Bundle of the place: the first declared for it, else the first declared for every other place, else every toolset with those of plugins, as for a host no table of toolsets was registered with

func (*Registry) Bundles

func (r *Registry) Bundles() []Bundle

Every bundle the registrants declare, nested registries in their place, in the order they declare them

func (*Registry) Carried

func (r *Registry) Carried(env *Env, session string) []string

Texts the registrants that keep state of the session hand back after its context was compacted, those with nothing to carry left out

func (*Registry) Check

func (r *Registry) Check(ctx context.Context, cfg *config.Config, path string, before, after *string, owner string, started time.Time) string

Diagnostics the edit brought in, the blocks of every registrant that checks writes one after another

func (*Registry) Checks

func (r *Registry) Checks(cfg *config.Config, path string) bool

Whether a registrant that checks writes checks the file

func (*Registry) Close

func (r *Registry) Close() error

Stops what the registrants keep running past their calls, such as interpreters or drivers, last registered first, as icebath exits

func (*Registry) Compacted

func (r *Registry) Compacted(cfg *config.Config, session string)

Tells the registrants that keep what the model was shown that the session's context was compacted, which the compaction of a session calls once it folded messages away

func (*Registry) Continue

func (r *Registry) Continue(ctx context.Context, env *Env, ending Ending) string

Message of the first registrant of the host that keeps the turn going, empty when none does or the turn was kept going as often as the first registrant that keeps verification evidence allows: the host's own pre_verify hooks and the plugins' registrants in the registry nested in it are asked alike, whichever of the two the agent holds

func (*Registry) Def

func (r *Registry) Def(name string) (Def, bool)

Definition of the tool with the name, false when no registrant of the host has one

func (*Registry) Definitions

func (r *Registry) Definitions(env *Env) []map[string]any

func (*Registry) Dispatch

func (r *Registry) Dispatch(ctx context.Context, call *Call) string

func (*Registry) Dispatched

func (r *Registry) Dispatched(call *Call)

Tells the registrants that watch calls of one about to run

func (*Registry) Ended

func (r *Registry) Ended(env *Env, session string)

Tells the registrants that keep something for one turn only that the session's turn ended, which the agent calls as each turn of a session finishes

func (*Registry) Finished

func (r *Registry) Finished(call *Call, result string)

Tells the registrants that hear of calls of one whose tool returned

func (*Registry) Groups

func (r *Registry) Groups() []Group

Every group the registrants declare, declarations of one title and profile joined: the sections of the one that gives the group its place first, then the others in order, and the first area

func (*Registry) Guarded

func (r *Registry) Guarded(asker Registrant, cfg *config.Config, path string, write bool) string

Refusal of a write to the path, or of a read of it, by the first registrant other than the one asking that refuses it, empty when none does: what a registrant that guards paths by rules of its own for its own tools, such as the file tools, asks of the rest, so the file of a task board is as safe from write_file as from any other tool

func (*Registry) Handles

func (r *Registry) Handles(cfg *config.Config, extension string) bool

Whether a registrant that checks writes takes files of the extension

func (*Registry) Hold

func (r *Registry) Hold(ctx context.Context, env *Env, ending Ending) string

Message of the first registrant that holds the turn open, empty when none does

func (*Registry) Invoke

func (r *Registry) Invoke(ctx context.Context, call *Call) string

Runs the call as Dispatch does for a caller that reads the whole result itself, such as a script calling tools, so none of it is saved aside for the chat

func (*Registry) KnownReads

func (r *Registry) KnownReads(cfg *config.Config, session string) []string

Paths the session read through the registrants that keep track, sorted, each once

func (*Registry) Linger

func (r *Registry) Linger(ctx context.Context, env *Env, session string, deadline time.Time) (waited, running bool)

Waits for the work every registrant that leaves some running has of the session, until the deadline; whether there was any, and whether some of it still runs

func (*Registry) Notes

func (r *Registry) Notes(ctx context.Context, session string, deadline time.Time) []string

Notes every registrant that learns more of calls has for the session, waiting for those still coming until the deadline

func (*Registry) Offered

func (r *Registry) Offered(env *Env) []Def

Tools offered to the session, by name

func (*Registry) Offers

func (r *Registry) Offers(env *Env, name string) bool

Whether the session of the env is offered the tool of the name, only the checks of that tool asked, and of the tools that run commands for one that runs code: on, able to run, and neither held back by its settings nor by what offered the session its tools

func (*Registry) Prepare

func (r *Registry) Prepare(env *Env)

Readies the registrants whose tools follow the session's settings

func (*Registry) Rechecks

func (r *Registry) Rechecks(env *Env) int

Most times one turn is sent back to check the files it changed, as the first registrant that keeps verification evidence says; none where none does

func (*Registry) Register

func (r *Registry) Register(registrant Registrant)

func (*Registry) Remind

func (r *Registry) Remind(ctx context.Context, env *Env, used, limit int) string

What every registrant that adds to the notice of steps running low adds, each after a space

func (*Registry) Resolve

func (r *Registry) Resolve(cfg *config.Config, names []string) (map[string]Origin, []string)

Tools the names come to for the profile, each named directly, with how each was reached; and what among them names nothing or itself. What delegate_task's toolsets, a job's and a batch's are read through, so a composite is understood wherever a toolset is named

func (*Registry) Risks

func (r *Registry) Risks() []config.Option

Every kind of risky action the tools ask approval for, each about the tool that asks, which the approvals allowlist can hold

func (*Registry) Run

func (r *Registry) Run(ctx context.Context, def Def, call *Call) string

Runs the call on the tool: its arguments read and checked against the schema, the watchers told, a result too large for the chat saved to a file the model can page through, its start kept. A tool_call runs each tool it names this way, under that tool's name

func (*Registry) Select

func (r *Registry) Select(cfg *config.Config, surface string) Selection

What the sessions of the place get of the profile's tools, the one answer every assembly and every page reads: a session a run holds to toolsets gets those alone; else the toolset the place starts from (a person's pick, else its bundle's), the toolsets its bundle adds, for an open bundle every toolset of a plugin, an extension or an MCP server no toolset icebath declares names and that is not off, less what the bundle leaves out, with what a person turned on there and less what they turned off

func (*Registry) Sets

func (r *Registry) Sets(cfg *config.Config) *Sets

Every toolset of the profile: those the registrants declare, those its tools make, and the person's own

func (*Registry) Stepped

func (r *Registry) Stepped(session string)

Tells the registrants that keep something for each reply of the model that the calls of a new reply of the session are about to run, which the agent calls before it runs the tool calls of each reply

func (*Registry) Stop

func (r *Registry) Stop(session string) int

Ends the background work of the session every registrant that keeps some has, how many it ended in all

func (*Registry) Tools

func (r *Registry) Tools() []Def

func (*Registry) Toolsets

func (r *Registry) Toolsets() []Toolset

Every toolset the registrants declare, nested registries in their place, in the order they declare them

func (*Registry) Unoffered

func (r *Registry) Unoffered(env *Env, name string) string

Why the session can't call the tool of the name directly, as the model reads it: one tool search finds, a tool of the search while it is off, one turned off, one that lacks what it needs, one the session is not offered; empty for a name no tool has

func (*Registry) Unreadable

func (r *Registry) Unreadable(cfg *config.Config, path string) string

Refusal of a read of the path by the first registrant that refuses it, empty when none does

func (*Registry) Unverified

func (r *Registry) Unverified(env *Env, session string, changed []string) string

Message of the first registrant that keeps verification evidence sending the agent back to check the files the turn changed, empty when none has one

func (*Registry) Unwritable

func (r *Registry) Unwritable(cfg *config.Config, path string) string

Refusal of a write to the path by the first registrant that refuses it, empty when none does

func (*Registry) Verified

func (r *Registry) Verified(env *Env, run Run) *Evidence

What the first registrant that keeps verification evidence made of the run, nil when none recorded it

func (*Registry) Warns

func (r *Registry) Warns(ctx context.Context, env *Env) float64

Highest share of its steps at which a registrant has the session given the notice of steps running low, zero when none asks for it

func (*Registry) Withholds

func (r *Registry) Withholds(env *Env, name string) bool

Whether the tool of the name runs code and is held back from the session of the env, which is offered no tool that runs commands by its settings or by what offered it its tools, such as a tool another tool's words would point the model to

func (*Registry) WritesSince

func (r *Registry) WritesSince(cfg *config.Config, exclude string, since time.Time, paths []string) map[string][]string

Paths among those given, every path for nil, that sessions besides the one left out wrote since the time, by session, as the registrants that keep track saw them

type Reminder

type Reminder interface {
	Remind(ctx context.Context, env *Env, used, limit int) string
}

Registrant that adds to the notice the agent is given as the steps of one reply run low, such as how a board worker hands its task back: the words added, empty for none

type Reply

type Reply struct {
	// Answers by question id: the picked choices or the typed text, empty for a question the user skipped. A question with no entry was never
	// answered
	Answers map[string][]string
	Outcome string
	// Why the questions ended without being submitted, for the model
	Notice string
}

How the questions ended and the answers given

type Run

type Run struct {
	Command string
	// Folder it ran in
	Cwd     string
	Session string
	Code    int
	// Output as the model reads it, secrets masked
	Output string
	// Exit codes of the commands of its last pipeline in their order, when the shell reported them
	Pipeline []int
}

One command a session ran in the foreground, as the terminal hands it to the registrants that keep verification evidence

type Runs

type Runs int

What of the model's own writing a tool runs

const (
	// Nothing the model writes runs: the tool does what its arguments ask and no more
	RunsNothing Runs = iota
	// Commands the model writes, as the terminal runs them: the door to running what the model writes, which a person shuts by turning the
	// tool off
	RunsCommands
	// Code the model writes by another name than a command, such as a Python script, a script driving a browser or the build steps of a
	// project: running commands by another name, so a session is offered it only while it is offered a tool that runs commands, and a call
	// of it is refused while it is not
	RunsCode
)

type Searching

type Searching struct {
	// When the search is used and when its listing is given: auto, on or off
	Enabled, Listing string
	// Percent of the context window the definitions of the tools found by search may take before auto turns the search on, which bounds
	// the listing too
	Share float64
	// Most tokens the listing takes, most tools one search returns and how many it returns when the agent asks for no number
	ListingTokens, Most, Default int
	// Tools the settings name to be found by search, and to be sent with every request
	Defer, Listed []string
}

Tool search as the settings of a profile have it, every number within its bounds

func SearchingOf

func SearchingOf(cfg *config.Config) Searching

Tool search as the settings say, read the way a person may write them: yes, true and 1 for on, no, false and 0 for off

func (Searching) Budget

func (s Searching) Budget(window int) int

Most tokens the listing takes in a context window of that many tokens: the listing's own size, or the share when smaller

func (Searching) On

func (s Searching) On(found, tokens, window int) bool

Whether the search is on for tools found by search whose definitions take that many tokens of a window of that many

func (Searching) Threshold

func (s Searching) Threshold(window int) int

Tokens the share is of a context window of that many tokens, of a window of 200,000 when it is not known

func (Searching) Why

func (s Searching) Why(def Def) string

Why tool search finds the tool rather than every request carrying it, in a person's words; empty for a tool every request carries, as the three tools of the search themselves are

type Selection

type Selection struct {
	Surface string
	// Bundle of the place, the one of every other place for a place with none of its own
	Bundle Bundle
	// Toolset the selection starts from: the bundle's, or the one a person picked for the place
	Base string
	// Toolsets a run holds its session to in place of all the rest, nil while no run does
	Held []string
	// Toolsets, composites and tools a person turned on and off for the place
	On, Off []string
	// Tools the place's sessions get, by name
	Tools map[string]Origin
	// What its making names that is nothing, or a toolset that names itself, each a sentence
	Problems []string
}

What the sessions of one place get of a profile's tools

func (Selection) Holds

func (s Selection) Holds(name string) bool

Whether the place's sessions get the tool of the name

type Set

type Set struct {
	Toolset
	// Tools it comes to by name, each with the toolsets inside it that brought it, outermost first
	Tools map[string][]string
	// Tools that name it as their toolset
	Named []string
	// It names itself through other toolsets, said in a sentence, so its members are left out; empty when it does not
	Cycle string
	// Members that name no toolset and no tool
	Missing []string
	// A toolset of a plugin, an extension or an MCP server that no toolset icebath declares names, which an open place takes
	Loose bool
}

A toolset as a profile has it: what it is, the tools it comes to, and what in it is wrong

func (Set) Problems

func (s Set) Problems() []string

What is wrong with the toolset, each a sentence as Problems says it of every toolset: that it holds itself, then each member that names nothing

type Sets

type Sets struct {
	// contains filtered or unexported fields
}

Every toolset of a profile by name, each resolving into the tools it comes to

func (*Sets) Find

func (s *Sets) Find(name string) (Set, bool)

The toolset of the name resolved, false when there is none

func (*Sets) Known

func (s *Sets) Known(name string) bool

Whether the name is one of a toolset, a composite or a tool of the profile

func (*Sets) List

func (s *Sets) List() []Set

Every toolset of the profile in order, each resolved

func (*Sets) Problems

func (s *Sets) Problems() []string

Everything wrong with the toolsets of the profile, each a sentence: the person's own that take a name icebath has, those that hold themselves, and members that name nothing

func (*Sets) Resolve

func (s *Sets) Resolve(names []string) (map[string][]string, []string)

Tools the names come to, each named directly, with the toolsets that brought each; and what among them names nothing or itself

func (*Sets) Select

func (s *Sets) Select(cfg *config.Config, surface string, bundle Bundle) Selection

What the sessions of the place get of these toolsets, by the bundle given

type Signature

type Signature struct {
	Prefix string
	Name   string
}

Kind of binary content by the bytes it starts with

type Standing

type Standing struct {
	Group Group
	// Its tools by the names a person reads
	Tools []Def
	// How many of its tools there are and how many are on
	Total, On int
	// Tools that are on and can't run, each with what it lacks
	Blocked []Blocked
	// On, Off, or how many of how many are on, such as 3 of 4 on
	State string
	// How many that are on can't run, such as 1 can't run; empty for none
	Note string
}

How a group of tools stands for a profile, the one answer every page, command and message gives

type Stepper

type Stepper interface {
	Stepped(session string)
}

Registrant that keeps something for each reply of the model, such as the folders snapshotted before its calls changed them: told the calls of a new reply of the session are about to run

type Stopper

type Stopper interface {
	Stop(session string) int
}

Registrant whose tools keep work of a session going in the background that /stop ends, such as the subagents delegate_task runs: ends the session's, how many it ended

type Told

type Told struct {
	Tool              string
	Asked, Unanswered int
}

What tool search did for a session, as the host tells it: tool_search with how many queries it asked and how many found nothing, or tool_call with how many tools it named and how many of them it refused

type Tools

type Tools struct {
	Registry
	// contains filtered or unexported fields
}

func New

func New(cfg *config.Config, hk *hooks.Hooks) *Tools

func (*Tools) Arrange

func (t *Tools) Arrange(cfg *config.Config, surface string, change Arrangement) (string, error)

Changes the tools of a place for the profile, the one way a place's tools change: what to tell the person

func (*Tools) Catalog

func (t *Tools) Catalog(cfg *config.Config) Assembly

What a new session of the profile would be sent of its tools, as far as can be told where the context window of its model is not known

func (*Tools) Find

func (t *Tools) Find(cfg *config.Config, queries []string, limit int) ([][]toolsearch.Entry, int)

What tool search finds for each query among the tools of the profile it would find, whether it is on or not, at most the limit for each within the settings, their default for 0; and how many tools it looks through

func (*Tools) Lacks

func (t *Tools) Lacks(cfg *config.Config) ([]Def, []string)

Tools the profile's sessions may get, as Of gives them, and what each lacks to run for the profile by its place: a tool that runs code lacks the tools that run commands while those are off or can't run

func (*Tools) Listing

func (t *Tools) Listing(cfg *config.Config) (standings []Standing, defs []Def, lacks []string)

Every tool of every profile in the order the registrants give them, so a chat of any profile can name the tools it calls, with what each lacks to run for the profile by its place, and how every group of the profile's own tools stands as Standings tells: each tool's check run once for both, the checks side by side and sharing their answers, a tool of the profile's that runs code held back as its sessions hold it

func (*Tools) Of

func (t *Tools) Of(cfg *config.Config) []Def

Tools the profile's sessions may get, by their group: every profile's, and those of the profile itself

func (*Tools) Places

func (t *Tools) Places() []Bundle

Every place a person may set the tools of, each with its bundle: those the bundles are of in the order they are declared, then the places runs come from that none is of, which take the bundle of every other place under their own name and title

func (*Tools) Placing

func (t *Tools) Placing(places func() []Place)

Hands the host what tells the places runs come from, such as each chat app, a scheduled job and the API, so each is one a person may set the tools of

func (*Tools) Register

func (t *Tools) Register(registrant Registrant)

Adds a registrant; a registry nested in the host reaches the host's hooks

func (*Tools) Standings

func (t *Tools) Standings(cfg *config.Config) []Standing

How every group of tools stands for the profile, in the order the groups declare, then by title: a group no plugin declares is one all the same, by the title its tools give

func (*Tools) Telling

func (t *Tools) Telling(tell func(Told))

Hands what tool search did to a function, such as the monitoring that counts searches, which the host tells as it happens

func (*Tools) Turn

func (t *Tools) Turn(cfg *config.Config, words []string, on bool) (Turned, error)

Turns on or off for the profile the tools the words name, the one way a tool or a group of them is turned on or off: a word names a tool by its name or its title, or every tool of a group by the group's title or a toolset's name. The tools of a group turned on and off on the page of its area are left to it

func (*Tools) Unfit

func (t *Tools) Unfit(cfg *config.Config) []Unfitted

Tools of the profile whose schema could not be made valid, by name: each is sent as an object of any properties rather than break the request it is in

func (*Tools) Unrun

func (t *Tools) Unrun(cfg *config.Config) (coderun.Why, bool)

Why the profile's sessions are offered no tool that runs commands, true while they are offered none

func (*Tools) Withheld

func (t *Tools) Withheld(cfg *config.Config) ([]Def, coderun.Why)

Tools of the profile that run code and are on, held back from its sessions while they are offered no tool that runs commands, and why; none while a tool that runs commands is on and can run

type Toolset

type Toolset struct {
	Name string
	// What a person calls it, the title of its tools' group when empty, and what it is for in a phrase
	Title, About string
	// Toolsets, composites and single tools it holds beside the tools that name it, by name; all holds every toolset
	Members []string
	// Left off every place until a person turns it on there, as tools few people want are: a composite that holds it brings it nowhere,
	// naming it directly does
	Off bool
	// Made by a person in the settings rather than declared by what icebath runs
	Own bool
}

A named set of tools the sessions of a place may be given: one its tools make by naming it as their Toolset, a composite made of other toolsets and single tools, or both, as a toolset a plugin declares members of beside the tools that name it

type Toolsetter

type Toolsetter interface {
	Toolsets() []Toolset
}

Registrant that declares toolsets: composites, and what it knows of toolsets its tools make, such as that they stay off until asked for

type Tracker

type Tracker interface {
	// Paths the session read whole or in part, sorted
	KnownReads(cfg *config.Config, session string) []string
	// Paths among those given, every path for nil, that a session other than the one left out wrote since the time, by the session that
	// wrote each last, sorted
	WritesSince(cfg *config.Config, exclude string, since time.Time, paths []string) map[string][]string
}

Registrant whose tools keep what sessions read and wrote, such as the file tools: what tells an agent that a subagent changed files it had read

type Turned

type Turned struct {
	Tools     []Def
	Unknown   []string
	Elsewhere []string
	Said      string
}

What turning tools on or off came to: the tools turned, the words that named none, the groups named whose tools are turned on and off on the page of their area, and what to tell the person

type Unfitted

type Unfitted struct {
	Def Def
	Why string
}

A tool whose schema could not be made valid, so a request sends it as an object of any properties, and why

type Verdict

type Verdict struct {
	// Why it may not run, nil when it may
	Refusal *Refusal
	// How it was let through after it was flagged, which the result tells the model; empty when nothing flagged it
	Note string
	// The user allowed it, so a message they sent while it waited is no reason to put it aside
	User bool
}

What the approvals made of a command about to run

type Verifier

type Verifier interface {
	// Records the run when it checks the session's workspace, giving what it proved; nil for a run that checks nothing
	Verified(env *Env, run Run) *Evidence
	// Message that sends the agent back to check the files the turn changed before it finishes, empty when nothing is due
	Unverified(env *Env, session string, changed []string) string
	// Most times the registrants that keep a turn going may send the agent back in one turn
	Nudges(env *Env) int
	// Most times one turn is sent back to check the files it changed before the registrants that keep it going have their say
	Rechecks(env *Env) int
}

Registrant that keeps evidence that the code a session changes was checked: told of each command it runs in the foreground, and asked before a turn that changed files ends whether the agent must check them first

type Warner

type Warner interface {
	Warns(ctx context.Context, env *Env) float64
}

Registrant whose sessions are given the notice of steps running low at a share of their steps when no setting of theirs says when, such as a board worker, which nobody is there to tell: the share, between zero and one, zero for a session it does not speak for

type Watcher

type Watcher interface {
	Dispatched(call *Call)
}

Registrant that hears of every call dispatched, before its tool runs

type Wrapper

type Wrapper interface {
	Wrap(ctx context.Context, def Def, call *Call, next func(ctx context.Context, args map[string]any) string) string
}

Registrant that runs every call through a pipeline of its own around everything else of the call, the hooks set on tool calls included, such as a runtime whose plugins may change a call's arguments or refuse it: handed the call and what runs it on the arguments it leaves, which it runs at most once; what it returns is the call's result. The arguments the call ran with are left on the call

Directories

Path Synopsis
The tools commands: how the groups of the agent's tools stand, every tool, and turning tools on or off through the function the page of Tools uses
The tools commands: how the groups of the agent's tools stand, every tool, and turning tools on or off through the function the page of Tools uses
Package diff compares sequences the way Python's difflib does: matching blocks and opcodes of a sequence matcher, the similarity ratio of two texts, and unified diffs of their lines.
Package diff compares sequences the way Python's difflib does: matching blocks and opcodes of a sequence matcher, the similarity ratio of two texts, and unified diffs of their lines.
Package document renders document files as text: notebooks, Word, Excel and PowerPoint files old and new, OpenDocument, RTF, EPUB, PDF and SQLite databases
Package document renders document files as text: notebooks, Word, Excel and PowerPoint files old and new, OpenDocument, RTF, EPUB, PDF and SQLite databases
Package fuzzy finds the text an edit means to replace when the model's copy of it is not byte for byte the file's: nine strategies from an exact match to similarity scoring, each tried in turn, with the guards that keep a near miss from editing the wrong place
Package fuzzy finds the text an edit means to replace when the model's copy of it is not byte for byte the file's: nine strategies from an exact match to similarity scoring, each tried in turn, with the guards that keep a near miss from editing the wrong place
Package redact masks secrets in text a tool hands the model: tokens with a known vendor prefix, JWTs, private keys, credentials in URLs, headers and form bodies, and in text that holds secrets, such as a .env read or an environment dump, the values of assignments whose names say they are secret.
Package redact masks secrets in text a tool hands the model: tokens with a known vendor prefix, JWTs, private keys, credentials in URLs, headers and form bodies, and in text that holds secrets, such as a .env read or an environment dump, the values of assignments whose names say they are secret.
Package schema holds what is done to a JSON schema before a model is sent it, the one place of the tools host for it: the repair of values no provider takes, the sanitizing of every tool's parameters that the one assembly runs, the subsets one provider takes, and the keys a sanitized schema renamed, which a call of the tool is read back through
Package schema holds what is done to a JSON schema before a model is sent it, the one place of the tools host for it: the repair of values no provider takes, the sanitizing of every tool's parameters that the one assembly runs, the subsets one provider takes, and the keys a sanitized schema renamed, which a call of the tool is read back through

Jump to

Keyboard shortcuts

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