fs

package
v0.1.17 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFSMemory

func NewFSMemory(cfg FSMemoryConfig) (agentkit.ToolPack, error)

NewFSMemory registers tool/fs-memory: In-memory workspace file tools for tests and smoke runs.

func NewFSWorkspace

func NewFSWorkspace(cfg FSWorkspaceConfig, deps FSWorkspaceDeps) (agentkit.ToolPack, error)

NewFSWorkspace registers tool/fs-workspace: Workspace file tools (read, write, edit, grep, find, ls).

Types

type EditInput

type EditInput struct {
	Path  string     `json:"path" jsonschema:"Path to the file to edit"`
	Edits []FileEdit `json:"edits" jsonschema:"One or more targeted replacements matched against the original file"`
}

type FSMemoryConfig

type FSMemoryConfig struct {
	// Files is seed contents, keyed by path.
	Files map[string]string `json:"files"`
	// MaxBytes is read truncation limit; defaults to 1 MiB.
	MaxBytes int `json:"maxBytes,omitempty"`
	// MaxMatches is grep cap per call; defaults to 100.
	MaxMatches int `json:"maxMatches,omitempty"`
	// MaxResults is find cap per call; defaults to 1000.
	MaxResults int `json:"maxResults,omitempty"`
	// MaxListEntries is ls cap per call; defaults to 500.
	MaxListEntries int `json:"maxListEntries,omitempty"`
	// Tools limits which model tools are registered; empty means all six.
	Tools []string `json:"tools,omitempty"`
}

type FSWorkspaceConfig

type FSWorkspaceConfig struct {
	// Root is directory relative to the workspace root; may use the global: or local: scope prefix.
	Root string `json:"root"`
	// MaxBytes is read truncation limit; defaults to 1 MiB.
	MaxBytes int `json:"maxBytes,omitempty"`
	// MaxMatches is grep cap per call; defaults to 100.
	MaxMatches int `json:"maxMatches,omitempty"`
	// MaxResults is find cap per call; defaults to 1000.
	MaxResults int `json:"maxResults,omitempty"`
	// MaxListEntries is ls cap per call; defaults to 500.
	MaxListEntries int `json:"maxListEntries,omitempty"`
	// ReadOnly rejects write and edit operations.
	ReadOnly bool `json:"readOnly,omitempty"`
	// Tools limits which model tools are registered; empty means all six (read, write, edit, grep, find, ls).
	Tools []string `json:"tools,omitempty"`
}

type FSWorkspaceDeps

type FSWorkspaceDeps struct {
	Workspace workspace.Service `json:"workspace"`
}

type FileEdit

type FileEdit struct {
	OldText string `` /* 140-byte string literal not displayed */
	NewText string `json:"newText" jsonschema:"Replacement text"`
}

type FindInput

type FindInput struct {
	Pattern string `json:"pattern" jsonschema:"Glob pattern to match files, e.g. *.go or **/*.json"`
	Path    string `json:"path,omitempty" jsonschema:"Directory to search (default: workspace root)"`
	Limit   int    `json:"limit,omitempty" jsonschema:"Maximum number of results (default: 1000)"`
}

type GrepInput

type GrepInput struct {
	Pattern    string `json:"pattern" jsonschema:"Search pattern (regex or literal string)"`
	Path       string `json:"path,omitempty" jsonschema:"Directory or file to search (default: workspace root)"`
	Glob       string `json:"glob,omitempty" jsonschema:"Optional filename glob filter, e.g. *.go"`
	IgnoreCase bool   `json:"ignoreCase,omitempty" jsonschema:"Case-insensitive search"`
	Literal    bool   `json:"literal,omitempty" jsonschema:"Treat pattern as a literal string instead of a regex"`
	Context    int    `json:"context,omitempty" jsonschema:"Lines of context to show before and after each match"`
	Limit      int    `json:"limit,omitempty" jsonschema:"Maximum number of matches to return (default: 100)"`
}

type ListDirInput

type ListDirInput struct {
	Path  string `json:"path,omitempty" jsonschema:"Directory path relative to the workspace (default: root)"`
	Limit int    `json:"limit,omitempty" jsonschema:"Maximum number of entries to return (default: 500)"`
}

type ReadInput

type ReadInput struct {
	Path   string `json:"path" jsonschema:"File path relative to the workspace"`
	Offset int    `json:"offset,omitempty" jsonschema:"Line number to start reading from (1-indexed)"`
	Limit  int    `json:"limit,omitempty" jsonschema:"Maximum number of lines to read"`
}

type WriteInput

type WriteInput struct {
	Path    string `json:"path" jsonschema:"File path relative to the workspace"`
	Content string `json:"content" jsonschema:"Full file content to write"`
}

Jump to

Keyboard shortcuts

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