Help us shape the future of Go! Take the 2026 Go Developer Survey

fs

package
v0.4.45 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 15 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: model file tools over an injected filesystem.Service.

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"`
}

func (*FSMemoryConfig) SetDefaults added in v0.3.48

func (c *FSMemoryConfig) SetDefaults()

SetDefaults implements pluginkit.Defaulter.

func (*FSMemoryConfig) Validate added in v0.3.48

func (c *FSMemoryConfig) Validate() error

Validate implements pluginkit.Validator.

type FSWorkspaceConfig

type FSWorkspaceConfig struct {
	// Root is accepted for older configs; path confinement lives on filesystem/local.
	Root string `json:"root,omitempty"`
	// 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"`
	// Unrestricted is accepted for older configs; belongs on filesystem/local.
	Unrestricted bool `json:"unrestricted,omitempty"`
	// Tools limits which model tools are registered; empty means all six (read, write, edit, grep, find, ls).
	Tools []string `json:"tools,omitempty"`
}

func (*FSWorkspaceConfig) SetDefaults added in v0.3.48

func (c *FSWorkspaceConfig) SetDefaults()

SetDefaults implements pluginkit.Defaulter.

func (*FSWorkspaceConfig) Validate added in v0.3.48

func (c *FSWorkspaceConfig) Validate() error

Validate implements pluginkit.Validator.

type FSWorkspaceDeps

type FSWorkspaceDeps struct {
	FS        filesystem.Service `json:"fs"`
	Workspace workspace.Service  `json:"workspace,omitempty"`
}

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 `` /* 158-byte string literal not displayed */
	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 `` /* 158-byte string literal not displayed */
	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