Documentation
¶
Overview ¶
Package builtin provides the embedded WARP tool manifests (*.tool.md), generated tool-name constants, and standard library adapters for Tasksmith's built-in system tools (view, ls, glob, grep, write, edit, remove, bash, web_fetch, and download).
Index ¶
Constants ¶
const ( ToolAskQuestion = "ask_question" ToolBash = "bash" ToolDownload = "download" ToolEdit = "edit" ToolEnterPlanMode = "enter_plan_mode" ToolExitPlanMode = "exit_plan_mode" ToolGlob = "glob" ToolGrep = "grep" ToolInvokeAgent = "invoke_agent" ToolLoadRule = "load_rule" ToolLoadSkill = "load_skill" ToolLS = "ls" ToolManageAgents = "manage_agents" ToolReadMCPResource = "read_mcp_resource" ToolRemove = "remove" ToolTasks = "tasks" ToolTodos = "todos" ToolToolSearch = "tool_search" ToolView = "view" ToolWebFetch = "web_fetch" ToolWebSearch = "web_search" ToolWrite = "write" )
Built-in system tool identifiers.
Variables ¶
var ErrInvalidConfig = tools.ErrInvalidConfig
ErrInvalidConfig is returned when New receives an invalid Config.
Functions ¶
func FS ¶
FS returns a read-only filesystem containing the embedded default *.tool.md manifests for all built-in tools.
func New ¶
New validates cfg and constructs the built-in system tools backed by std.Std, shellguard.Guard, and tasks.Store. Config.AllowedTools is an explicit allowlist: only tools whose name appears in it are constructed. A nil or empty allowlist constructs zero tools.
func NewToolSearch ¶
NewToolSearch constructs the built-in tool_search tool. It is backed by Loom's BM25 keyword index over the deferred (DeferLoading) tools' definitions and returns the matching tool names as references to be loaded into the model's active toolset. It is registered by the tool container whenever the session resolves at least one deferred tool.
When the workspace catalog provides the tool_search manifest, its full <how_it_works> / <when_to_use> instructions and safety annotations are used as the tool description passed to the LLM, matching the built-in tool wiring in New. The built-in defaults are used when the catalog has no entry.
func PlanModeInstructions ¶
PlanModeInstructions returns the behavioral contract guidance for plan mode, parameterized by the session's safe plans directory.
Types ¶
type AgentManager ¶
type AgentManager interface {
InvokeSubagent(ctx context.Context, in api.InvokeAgentInput) (api.InvokeAgentOutput, error)
ManageSubagents(ctx context.Context, in api.ManageAgentsInput) (api.ManageAgentsOutput, error)
}
AgentManager defines the interface for invoking and managing child subagent sessions.
type Config ¶
type Config struct {
Std *std.Std
Sandbox sandbox.Sandbox
Guard *shellguard.Guard
Tasks tasks.Store
Workspace *workspace.Workspace
AllowedTools []string
Skills []warp.Skill
Rules []warp.Rule
Subagents []*warp.Agent
Agents AgentManager
// SandboxSettings is the workspace's live sandbox.json manager. The bash
// tool consults it for excludedCommands matching and the allowUnsandboxed
// lock; when nil, bypass_sandbox is rejected and exclusion is disabled.
SandboxSettings sandboxcfg.Manager
// AgentName is the active agent's name, used to resolve a loaded skill's
// declared tools against the agent's policy ceiling. When empty, the
// workspace default agent is used.
AgentName string
// Agent is the active agent definition, injected into skill render options
// so skill templates can reference {{.Agent.*}} fields.
Agent *warp.Agent
// DeferredTools is the set of tool names withheld from the initial model
// context (DeferLoading: true). Skill tools in this set are activated into
// context via tool references when the skill is loaded.
DeferredTools []string
// MCPCaller is the MCP runtime backing the resource-reading built-in tool. When
// nil, that tool is not constructed: with no runtime attached there is nothing
// for it to read, and offering it would only invite failed calls.
MCPCaller tools.MCPCaller
// MediaStore snapshots viewed media files into <session-dir>/media/<sha256>
// so historical tool turns stay immutable and lightweight.
MediaStore *media.Store
// SupportsModality reports whether the active session model supports mod,
// returning its model ID for diagnostic messages when unsupported.
SupportsModality func(mod media.Modality) (modelID string, supported bool)
// Plans coordinates enter_plan_mode and exit_plan_mode on top-level
// sessions. When nil (e.g., delegated subagents), plan-mode tools are omitted.
Plans PlanController
}
Config holds the required dependencies for constructing the built-in system tools.
type PlanController ¶
type PlanController interface {
PlansDir() string
CurrentMode() api.PermissionMode
EnterPlanMode(ctx context.Context) (alreadyActive bool, plansDir string, err error)
ExitPlanMode(ctx context.Context, planPath string, nextMode api.PermissionMode) (api.PermissionMode, error)
}
PlanController coordinates session-level plan mode transitions for the enter_plan_mode and exit_plan_mode built-in tools.