Documentation
¶
Overview ¶
Package codingtools defines Plasmid's native ADK coding tools and their wire arguments and result objects.
Index ¶
- Constants
- Variables
- func BashInputSchema() json.RawMessage
- func EditInputSchema() json.RawMessage
- func FindInputSchema() json.RawMessage
- func GrepInputSchema() json.RawMessage
- func ListInputSchema() json.RawMessage
- func NewBashTool(cfg Config) (adktool.Tool, error)
- func NewEditTool(cfg Config) (adktool.Tool, error)
- func NewFindTool(cfg Config) (adktool.Tool, error)
- func NewGrepTool(cfg Config) (adktool.Tool, error)
- func NewListTool(cfg Config) (adktool.Tool, error)
- func NewReadTool(cfg Config) (adktool.Tool, error)
- func NewWriteTool(cfg Config) (adktool.Tool, error)
- func ReadInputSchema() json.RawMessage
- func ToolSpecifier(toolName string, input map[string]any) string
- func WriteInputSchema() json.RawMessage
- type BashArgs
- type BashResult
- type Config
- type EditArgs
- type EditResult
- type FindArgs
- type FindResult
- type GrepArgs
- type GrepMatch
- type GrepResult
- type ListArgs
- type ListEntry
- type ListResult
- type ReadArgs
- type ReadResult
- type Set
- type ToolSpecifierFunc
- type WriteArgs
- type WriteResult
Constants ¶
const ( // ReadDescription is the model-facing read tool description. ReadDescription = "" /* 271-byte string literal not displayed */ // WriteDescription is the model-facing write tool description. WriteDescription = "" /* 384-byte string literal not displayed */ // EditDescription is the model-facing edit tool description. EditDescription = "" /* 436-byte string literal not displayed */ // BashDescription is the model-facing bash tool description. BashDescription = "" /* 551-byte string literal not displayed */ // GrepDescription is the model-facing grep tool description. GrepDescription = "" /* 393-byte string literal not displayed */ // FindDescription is the model-facing find tool description. FindDescription = "" /* 312-byte string literal not displayed */ // ListDescription is the model-facing ls tool description. ListDescription = "" /* 369-byte string literal not displayed */ )
const ( // DiagnosticsResultKey is reserved for structured LSP diagnostics added by // the native after-tool callback. DiagnosticsResultKey = "diagnostics" // DiagnosticsTextResultKey is reserved for the bounded model-facing LSP // diagnostic rendering added by the native after-tool callback. DiagnosticsTextResultKey = "diagnostics_text" )
const MaxTouchEvents = 256
MaxTouchEvents bounds search fan-out into context and LSP observers.
Variables ¶
var ( // File sentinels preserve the workspace contract's errors.Is identity. ErrPathOutsideRoot = workspace.ErrOutsideRoot ErrFileNotFound = workspace.ErrNotFound ErrIsDirectory = workspace.ErrIsDirectory ErrBinaryFile = workspace.ErrBinaryFile ErrFileTooLarge = workspace.ErrTooLarge ErrNeverRead = workspace.ErrNeverRead ErrStaleRead = workspace.ErrStaleRead // Edit sentinels preserve the deterministic matcher's errors.Is identity. ErrNoMatch = textmatch.ErrNoMatch ErrAmbiguousMatch = textmatch.ErrAmbiguousMatch // ErrNoShell preserves the shell executor's errors.Is identity. ErrNoShell = shellexec.ErrNoShell // ErrUnsupportedPattern classifies search syntax outside the portable // regexp and glob subset. Handlers add the rejected construct and remedy. ErrUnsupportedPattern = errors.New("coding tools: unsupported pattern") )
Functions ¶
func BashInputSchema ¶
func BashInputSchema() json.RawMessage
BashInputSchema returns an independent copy of the bash input schema.
func EditInputSchema ¶
func EditInputSchema() json.RawMessage
EditInputSchema returns an independent copy of the edit input schema.
func FindInputSchema ¶
func FindInputSchema() json.RawMessage
FindInputSchema returns an independent copy of the find input schema.
func GrepInputSchema ¶
func GrepInputSchema() json.RawMessage
GrepInputSchema returns an independent copy of the grep input schema.
func ListInputSchema ¶
func ListInputSchema() json.RawMessage
ListInputSchema returns an independent copy of the ls input schema.
func NewBashTool ¶
NewBashTool validates the shared executor dependencies and constructs a bash tool.
func NewEditTool ¶
NewEditTool validates the shared mutation dependencies and constructs an edit tool.
func NewFindTool ¶
NewFindTool constructs the native ADK find tool.
func NewGrepTool ¶
NewGrepTool validates shared search dependencies and constructs a grep tool.
func NewListTool ¶
NewListTool validates the listing dependencies and constructs an ls tool.
func NewReadTool ¶
NewReadTool validates the read dependencies and constructs a read tool.
func NewWriteTool ¶
NewWriteTool validates the shared mutation dependencies and constructs a write tool.
func ReadInputSchema ¶
func ReadInputSchema() json.RawMessage
ReadInputSchema returns an independent copy of the read input schema.
func ToolSpecifier ¶
ToolSpecifier returns the primary subject of a known coding-tool call.
func WriteInputSchema ¶
func WriteInputSchema() json.RawMessage
WriteInputSchema returns an independent copy of the write input schema.
Types ¶
type BashArgs ¶
type BashArgs struct {
Command string `json:"command"`
Dir string `json:"dir"`
TimeoutMS int `json:"timeout_ms"`
}
BashArgs describes one fresh, non-interactive shell invocation. An empty Dir and a zero TimeoutMS select the schema defaults.
type BashResult ¶
type BashResult struct {
Stdout string `json:"stdout"`
Stderr string `json:"stderr"`
ExitCode int `json:"exit_code"`
Signal string `json:"signal"`
TimedOut bool `json:"timed_out"`
Killed bool `json:"killed"`
Truncated bool `json:"truncated"`
StdoutReport outputlimit.Report `json:"stdout_report"`
StderrReport outputlimit.Report `json:"stderr_report"`
}
BashResult is the portable projection of shellexec.Result. Process duration and the resolved host directory are deliberately excluded from the wire.
type Config ¶
type Config struct {
Root *workspace.Root
Queue *workspace.MutationQueue
Ledger *workspace.Ledger
Touch *workspace.TouchBus
Shell *shellexec.Executor
Output outputlimit.Policy
Budget *outputlimit.Budget
Logger *slog.Logger
WarningSink warning.Warner
MaxReadBytes int64
MaxWriteBytes int64
MaxGrepFileBytes int64
MaxTouchEvents int
DefaultBashTimeout time.Duration
}
Config contains the shared dependencies and limits used by coding tools.
type EditArgs ¶
type EditArgs struct {
Path string `json:"path"`
OldText string `json:"old_text"`
NewText string `json:"new_text"`
ReplaceAll bool `json:"replace_all"`
}
EditArgs describes one deterministic text replacement. ReplaceAll defaults to false.
type EditResult ¶
type EditResult struct {
Path string `json:"path"`
Replacements int `json:"replacements"`
MatchTier string `json:"match_tier"`
Diff string `json:"diff"`
Truncated bool `json:"truncated"`
Report outputlimit.Report `json:"report"`
}
EditResult reports the selected matching tier and bounded unified diff.
type FindArgs ¶
type FindArgs struct {
Path string `json:"path"`
Glob string `json:"glob"`
Type string `json:"type"`
SortBy string `json:"sort_by"`
MaxResults int `json:"max_results"`
}
FindArgs configures a bounded workspace glob search. Zero optional values select the schema defaults.
type FindResult ¶
FindResult contains sorted slash-separated workspace-relative paths.
type GrepArgs ¶
type GrepArgs struct {
Pattern string `json:"pattern"`
Path string `json:"path"`
Glob string `json:"glob"`
Literal bool `json:"literal"`
CaseInsensitive bool `json:"case_insensitive"`
ContextLines int `json:"context_lines"`
MaxResults int `json:"max_results"`
}
GrepArgs configures a bounded text search. Zero optional values select the schema defaults.
type GrepMatch ¶
type GrepMatch struct {
Path string `json:"path"`
Line int `json:"line"`
Text string `json:"text"`
Before []string `json:"before"`
After []string `json:"after"`
}
GrepMatch contains a full matching line and its requested surrounding context. Path is slash-separated and workspace-relative.
type GrepResult ¶
type GrepResult struct {
Matches []GrepMatch `json:"matches"`
MatchCount int `json:"match_count"`
Files int `json:"files"`
Truncated bool `json:"truncated"`
SkippedBinary int `json:"skipped_binary"`
SkippedTooLarge int `json:"skipped_too_large"`
SkippedLongLines int `json:"skipped_long_lines"`
}
GrepResult contains sorted matches and explicit skip counts.
type ListArgs ¶
type ListArgs struct {
Path string `json:"path"`
MaxDepth int `json:"max_depth"`
ShowHidden bool `json:"show_hidden"`
MaxResults int `json:"max_results"`
}
ListArgs configures a bounded directory listing. Zero optional values select the schema defaults.
type ListEntry ¶
type ListEntry struct {
Path string `json:"path"`
Type string `json:"type"`
Size int64 `json:"size"`
ModTime string `json:"mod_time"`
}
ListEntry is a portable projection of one workspace entry. ModTime is encoded as RFC3339 text; host file modes are deliberately excluded.
type ListResult ¶
ListResult contains directory-first entries in deterministic name order.
type ReadArgs ¶
type ReadArgs struct {
Path string `json:"path"`
Offset int `json:"offset"`
Limit int `json:"limit"`
}
ReadArgs selects a one-based line window from a text file. Zero Offset and Limit values select the schema defaults.
type ReadResult ¶
type ReadResult struct {
Path string `json:"path"`
Content string `json:"content"`
StartLine int `json:"start_line"`
EndLine int `json:"end_line"`
TotalLines int `json:"total_lines"`
Truncated bool `json:"truncated"`
Report outputlimit.Report `json:"report"`
}
ReadResult contains numbered text and the actual source window rendered from a workspace-relative path.
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set is the fixed, ordered collection of built-in coding tools.
func (*Set) Names ¶
Names returns stable tool names in tool order. The returned slice is owned by the caller.
type ToolSpecifierFunc ¶
ToolSpecifierFunc adapts a function to a tool-call specifier.
type WriteResult ¶
type WriteResult struct {
Path string `json:"path"`
BytesWritten int `json:"bytes_written"`
Diff string `json:"diff"`
Truncated bool `json:"truncated"`
Report outputlimit.Report `json:"report"`
}
WriteResult reports the durable content size and bounded unified diff.