textfs

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultMaxLines = 2000
	DefaultMaxBytes = 50 * 1024
)

Variables

This section is empty.

Functions

func AllowedNoteExtensions

func AllowedNoteExtensions() []string

AllowedNoteExtensions returns the hardcoded list of indexable "note" file extensions. Extensions are lowercase and include a leading dot.

func ClassifySource

func ClassifySource(path string) string

ClassifySource returns the default source label for a path.

func FormatSize

func FormatSize(bytes int) string

func IsAllowedTextNotePath

func IsAllowedTextNotePath(relPath string) (ok bool, ext string, reason string)

IsAllowedTextNotePath checks whether a virtual path is allowed for note indexing/reading. It requires an explicit file extension in the allowlist.

func IsMemoryPath

func IsMemoryPath(relPath string) bool

IsMemoryPath returns true for MEMORY.md or memory/*.md.

func NormalizePath

func NormalizePath(raw string) (string, error)

NormalizePath normalizes a virtual file path and prevents escaping the root.

func NoteMaxBytesDefault

func NoteMaxBytesDefault() int

NoteMaxBytesDefault is the default per-file size cap for note indexing and reads.

Types

type ApplyPatchResult

type ApplyPatchResult struct {
	Summary ApplyPatchSummary
	Text    string
}

func ApplyPatch

func ApplyPatch(ctx context.Context, store *Store, input string) (*ApplyPatchResult, error)

type ApplyPatchSummary

type ApplyPatchSummary struct {
	Added    []string
	Modified []string
	Deleted  []string
}

type FileEntry

type FileEntry struct {
	Path      string
	Content   string
	Hash      string
	Source    string
	UpdatedAt int64
}

type Store

type Store struct {
	// contains filtered or unexported fields
}

func NewStore

func NewStore(db *dbutil.Database, bridgeID, loginID, agentID string) *Store

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, relPath string) error

func (*Store) List

func (s *Store) List(ctx context.Context) ([]FileEntry, error)

func (*Store) Read

func (s *Store) Read(ctx context.Context, relPath string) (*FileEntry, bool, error)

func (*Store) Write

func (s *Store) Write(ctx context.Context, relPath, content string) (*FileEntry, error)

func (*Store) WriteIfMissing

func (s *Store) WriteIfMissing(ctx context.Context, relPath, content string) (bool, error)

WriteIfMissing writes a file only if it does not already exist. Returns true if a new entry was created.

type Truncation

type Truncation struct {
	Content               string
	Truncated             bool
	TruncatedBy           string
	TotalLines            int
	TotalBytes            int
	OutputLines           int
	OutputBytes           int
	FirstLineExceedsLimit bool
	MaxLines              int
	MaxBytes              int
}

func TruncateHead

func TruncateHead(content string, maxLines, maxBytes int) Truncation

TruncateHead keeps the first maxLines/maxBytes of content.

Jump to

Keyboard shortcuts

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