builtin

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package builtin is the registry of upstream's built-in extensions that PiG implements natively: the `builtin:<name>` extension paths of codemode and tool-search (docs/specs/builtin-codemode-tool-search.md).

Ports packages/coding-agent/src/extensions/index.ts (builtInExtensions).

Index

Constants

View Source
const PathPrefix = "builtin:"

PathPrefix starts the path of a built-in extension, as in `builtin:codemode`.

Ports packages/coding-agent/src/core/source-info.ts (BUILTIN_PATH_PREFIX).

Variables

This section is empty.

Functions

This section is empty.

Types

type CodemodeOptions

type CodemodeOptions = codemode.Options

CodemodeOptions configures the codemode extension.

type Extension

type Extension struct {
	// Name is the part of the path after PathPrefix.
	Name string
	// Replaceable leaves the extension out when another extension registers a tool, command or flag it registers.
	Replaceable bool
	// Factory builds the extension: the Go counterpart of the factory that is the module's default export.
	Factory extension.ExtensionFactory
}

Extension is one built-in extension.

func All

func All(options Options) []Extension

All lists the built-in extensions in upstream's order, then PiG's own `pig-login`. A stripped built-in has no row. pig additive (D92): each row comes from a registration shim a Piglet Binary compiles out with pig_strip_<name>.

func Resolve

func Resolve(path string, options Options) (Extension, error)

Resolve returns the built-in extension a `builtin:<name>` path names. An unknown name fails with upstream's message.

Ports packages/coding-agent/src/core/resource-loader.ts (loadExtensionPaths).

func (Extension) Path

func (e Extension) Path() string

Path is the extension path, `builtin:<name>`.

type McpOptions

type McpOptions = mcpext.Options

McpOptions configures the MCP extension.

type Options

type Options struct {
	// Codemode configures the codemode extension (unused when built with the `pig_strip_codemode` tag).
	Codemode CodemodeOptions
	// Mcp configures the MCP extension (unused when built with the `pig_strip_mcp` tag).
	Mcp McpOptions
}

Options configures the built-in extensions that need the session's settings or a cache location.

func (*Options) ConfigureCodemode

func (o *Options) ConfigureCodemode(cacheDir string)

ConfigureCodemode sets the sandbox's compilation cache directory. The tool reads the settings through the extension API.

func (*Options) ConfigureMcp

func (o *Options) ConfigureMcp(agentDir, configDirName string, openURL func(url string), copyToClipboard ...func(text string) error)

ConfigureMcp sets where the MCP extension reads `mcp.json` and keeps its credentials and log (the agent directory and the per-project configuration directory name), how it opens an OAuth authorization URL, and, when given, how it copies one.

Directories

Path Synopsis
Package codemode is the built-in `codemode` extension: the tool that lets the model write JavaScript that calls other tools.
Package codemode is the built-in `codemode` extension: the tool that lets the model write JavaScript that calls other tools.
Package toolsearch is the built-in `tool_search` extension: tool discovery with a BM25 ranker over tool metadata, shared by `searchTools()` in codemode scripts and the optional `tool_search` tool.
Package toolsearch is the built-in `tool_search` extension: tool discovery with a BM25 ranker over tool metadata, shared by `searchTools()` in codemode scripts and the optional `tool_search` tool.

Jump to

Keyboard shortcuts

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