filesystem

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package services provides the implementation of the FileSystemServer, which allows access to files and directories on the local file system.

Index

Constants

View Source
const (
	// MaxInlineSize Maximum size for inline content (5MB)
	MaxInlineSize = 1024 * 1024 * 5
	// MaxBase64Size Maximum size for base64 encoding (1MB)
	MaxBase64Size = 1024 * 1024 * 1
)
View Source
const (
	// FileSystemPromptDefault is the default prompt for the file system.
	FileSystemPromptDefault = `` /* 1385-byte string literal not displayed */

)
View Source
const (
	FilesystemServerName comm.MoLingServerType = "FileSystem"
)

Variables

This section is empty.

Functions

func NewFilesystemServer

func NewFilesystemServer(ctx context.Context) (abstract.Service, error)

Types

type FileInfo

type FileInfo struct {
	Size        int64     `json:"size"`
	Created     time.Time `json:"created"`
	Modified    time.Time `json:"modified"`
	Accessed    time.Time `json:"accessed"`
	IsDirectory bool      `json:"isDirectory"`
	IsFile      bool      `json:"isFile"`
	Permissions string    `json:"permissions"`
}

type FileSystemConfig

type FileSystemConfig struct {
	PromptFile string `json:"prompt_file"` // PromptFile is the prompt file for the file system.

	AllowedDir string `json:"allowed_dir"` // AllowedDirs is a list of allowed directories. split by comma. e.g. /tmp,/var/tmp

	CachePath string `json:"cache_path"` // CachePath is the root path for the file system.
	// contains filtered or unexported fields
}

FileSystemConfig represents the configuration for the file system.

func NewFileSystemConfig

func NewFileSystemConfig(path string) *FileSystemConfig

NewFileSystemConfig creates a new FileSystemConfig with the given allowed directories.

func (*FileSystemConfig) Check

func (fc *FileSystemConfig) Check() error

Check validates the allowed directories in the FileSystemConfig.

type FilesystemServer

type FilesystemServer struct {
	abstract.MLService
	// contains filtered or unexported fields
}

func (*FilesystemServer) Close

func (fs *FilesystemServer) Close() error

func (*FilesystemServer) Config

func (fs *FilesystemServer) Config() string

Config returns the configuration of the service as a string.

func (*FilesystemServer) Init

func (fs *FilesystemServer) Init() error

func (*FilesystemServer) LoadConfig

func (fs *FilesystemServer) LoadConfig(jsonData map[string]any) error

LoadConfig loads the configuration from a JSON object.

func (*FilesystemServer) Name

Jump to

Keyboard shortcuts

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