Documentation
¶
Index ¶
- type DeleteTextLinesArgs
- type DeleteTextLinesOut
- type FindTextArgs
- type FindTextLine
- type FindTextMatch
- type FindTextOut
- type InsertTextLinesArgs
- type InsertTextLinesOut
- type ReadTextRangeArgs
- type ReadTextRangeLine
- type ReadTextRangeOut
- type ReplaceTextLinesArgs
- type ReplaceTextLinesOut
- type TextTool
- func (tt *TextTool) DeleteTextLines(ctx context.Context, args DeleteTextLinesArgs) (*DeleteTextLinesOut, error)
- func (tt *TextTool) DeleteTextLinesTool() spec.Tool
- func (tt *TextTool) FindText(ctx context.Context, args FindTextArgs) (*FindTextOut, error)
- func (tt *TextTool) FindTextTool() spec.Tool
- func (tt *TextTool) InsertTextLines(ctx context.Context, args InsertTextLinesArgs) (*InsertTextLinesOut, error)
- func (tt *TextTool) InsertTextLinesTool() spec.Tool
- func (tt *TextTool) ReadTextRange(ctx context.Context, args ReadTextRangeArgs) (*ReadTextRangeOut, error)
- func (tt *TextTool) ReadTextRangeTool() spec.Tool
- func (tt *TextTool) ReplaceTextLines(ctx context.Context, args ReplaceTextLinesArgs) (*ReplaceTextLinesOut, error)
- func (tt *TextTool) ReplaceTextLinesTool() spec.Tool
- type TextToolOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeleteTextLinesArgs ¶
type DeleteTextLinesOut ¶
type FindTextArgs ¶
type FindTextArgs struct {
Path string `json:"path"`
QueryType string `json:"queryType,omitempty"` // substring (default) | regex | lineBlock
Query string `json:"query,omitempty"` // required for substring/regex
MatchLines []string `json:"matchLines,omitempty"` // required for lineBlock
ContextLines int `json:"contextLines,omitempty"` // default 5
MaxMatches int `json:"maxMatches,omitempty"` // default 10
}
type FindTextLine ¶
type FindTextMatch ¶
type FindTextMatch struct {
MatchStartLine int `json:"matchStartLine"` // 1-based
MatchEndLine int `json:"matchEndLine"` // 1-based
MatchedLinesWithContext []FindTextLine `json:"matchedLinesWithContext"` // includes matched lines as well (window around match)
}
type FindTextOut ¶
type FindTextOut struct {
ReachedMaxMatches bool `json:"reachedMaxMatches"`
MatchesReturned int `json:"matchesReturned"`
Matches []FindTextMatch `json:"matches"`
}
type InsertTextLinesArgs ¶
type InsertTextLinesOut ¶
type ReadTextRangeArgs ¶
type ReadTextRangeLine ¶
type ReadTextRangeOut ¶
type ReadTextRangeOut struct {
StartLine int `json:"startLine,omitempty"` // 1-based
EndLine int `json:"endLine,omitempty"` // 1-based
LinesReturned int `json:"linesReturned"`
Lines []ReadTextRangeLine `json:"lines"`
}
type ReplaceTextLinesArgs ¶
type ReplaceTextLinesArgs struct {
Path string `json:"path"`
MatchLines []string `json:"matchLines"`
// Required; must contain at least one line.
// This tool does NOT support deletion (use deletetextlines).
ReplaceWithLines []string `json:"replaceWithLines"`
BeforeLines []string `json:"beforeLines,omitempty"`
AfterLines []string `json:"afterLines,omitempty"`
// Pointer is used so we can distinguish "omitted" (default to 1) from "explicit 0" (error).
ExpectedReplacements *int `json:"expectedReplacements,omitempty"` // default 1; minimum 1
}
type ReplaceTextLinesOut ¶
type TextTool ¶ added in v0.7.0
type TextTool struct {
// contains filtered or unexported fields
}
TextTool is an instance-owned text tool runner. It centralizes path resolution and sandbox policy:
- workBaseDir: base for resolving relative paths
- allowedRoots: optional restriction; if empty/nil, allow all
- blockSymlinks: blocks symlink traversal (if enforced downstream).
func NewTextTool ¶ added in v0.7.0
func NewTextTool(opts ...TextToolOption) (*TextTool, error)
func (*TextTool) DeleteTextLines ¶ added in v0.7.0
func (tt *TextTool) DeleteTextLines(ctx context.Context, args DeleteTextLinesArgs) (*DeleteTextLinesOut, error)
func (*TextTool) DeleteTextLinesTool ¶ added in v0.7.0
func (*TextTool) FindText ¶ added in v0.7.0
func (tt *TextTool) FindText(ctx context.Context, args FindTextArgs) (*FindTextOut, error)
func (*TextTool) FindTextTool ¶ added in v0.7.0
func (*TextTool) InsertTextLines ¶ added in v0.7.0
func (tt *TextTool) InsertTextLines(ctx context.Context, args InsertTextLinesArgs) (*InsertTextLinesOut, error)
func (*TextTool) InsertTextLinesTool ¶ added in v0.7.0
func (*TextTool) ReadTextRange ¶ added in v0.7.0
func (tt *TextTool) ReadTextRange(ctx context.Context, args ReadTextRangeArgs) (*ReadTextRangeOut, error)
func (*TextTool) ReadTextRangeTool ¶ added in v0.7.0
func (*TextTool) ReplaceTextLines ¶ added in v0.7.0
func (tt *TextTool) ReplaceTextLines(ctx context.Context, args ReplaceTextLinesArgs) (*ReplaceTextLinesOut, error)
func (*TextTool) ReplaceTextLinesTool ¶ added in v0.7.0
type TextToolOption ¶ added in v0.7.0
func WithAllowedRoots ¶ added in v0.7.0
func WithAllowedRoots(roots []string) TextToolOption
func WithBlockSymlinks ¶ added in v0.10.0
func WithBlockSymlinks(block bool) TextToolOption
WithBlockSymlinks configures whether symlink traversal should be blocked (if supported downstream).
func WithWorkBaseDir ¶ added in v0.7.0
func WithWorkBaseDir(base string) TextToolOption
Click to show internal directories.
Click to hide internal directories.