Documentation
¶
Overview ¶
Package workspace implements local workspace operations.
Index ¶
- Constants
- func ShouldSkipForOutputsDir(command string) bool
- type Environment
- func (e *Environment) Bash(ctx context.Context, args *protocol.BashArgs) (*protocol.BashResult, error)
- func (e *Environment) DeleteKnowledgeFiles(ctx context.Context, args *protocol.DeleteKnowledgeFilesArgs) (*protocol.DeleteKnowledgeFilesResult, error)
- func (e *Environment) Glob(ctx context.Context, args *protocol.GlobArgs) (*protocol.GlobResult, error)
- func (e *Environment) Grep(ctx context.Context, args *protocol.GrepArgs) (*protocol.GrepResult, error)
- func (e *Environment) List(ctx context.Context, args *protocol.ListArgs) (*protocol.ListResult, error)
- func (e *Environment) MCPCall(ctx context.Context, args *protocol.MCPCallArgs, logger *slog.Logger) (*protocol.MCPCallResult, error)
- func (e *Environment) MCPListTools(ctx context.Context, args *protocol.MCPListToolsArgs, logger *slog.Logger) (*protocol.MCPListToolsResult, error)
- func (e *Environment) Read(ctx context.Context, args *protocol.ReadArgs) (*protocol.ReadResult, error)
- func (e *Environment) Root() string
- func (e *Environment) StageKnowledgeFiles(ctx context.Context, args *protocol.StageKnowledgeFilesArgs) (*protocol.StageKnowledgeFilesResult, error)
- func (e *Environment) SyncSkill(ctx context.Context, args *protocol.SyncSkillArgs) (*protocol.SyncSkillResult, error)
- func (e *Environment) WebFetch(ctx context.Context, args *protocol.WebFetchArgs) (*protocol.WebFetchResult, error)
- func (e *Environment) Write(ctx context.Context, args *protocol.WriteArgs) error
- func (e *Environment) WriteRaw(ctx context.Context, path string, content []byte) error
- type LargeOutputConfig
- type LargeOutputProcessor
- type LimitedWriter
- type ProcessResult
Constants ¶
const ( // DefaultMaxOutputSize is the default character limit before truncation (~7.5k tokens) DefaultMaxOutputSize = 30000 // ~7.5k tokens at 4 chars/token // DefaultPreviewSize is the maximum characters for preview DefaultPreviewSize = 8000 // ~2k tokens // DefaultPreviewLines is the number of lines shown in the preview DefaultPreviewLines = 20 // OutputsDir is the directory name for storing large outputs OutputsDir = ".outputs" )
Variables ¶
This section is empty.
Functions ¶
func ShouldSkipForOutputsDir ¶
ShouldSkipForOutputsDir checks if large output processing should be skipped for commands operating on .outputs/ directory to avoid circular processing.
Types ¶
type Environment ¶
type Environment struct {
// contains filtered or unexported fields
}
Environment handles local filesystem operations.
func New ¶
func New(root string, checker *permission.Checker) (*Environment, error)
New creates a new workspace with the given root directory and permission checker.
func (*Environment) Bash ¶
func (e *Environment) Bash(ctx context.Context, args *protocol.BashArgs) (*protocol.BashResult, error)
Bash executes a bash command in the workspace.
func (*Environment) DeleteKnowledgeFiles ¶
func (e *Environment) DeleteKnowledgeFiles(ctx context.Context, args *protocol.DeleteKnowledgeFilesArgs) (*protocol.DeleteKnowledgeFilesResult, error)
DeleteKnowledgeFiles removes the supplied files from the workspace root and scrubs their entries from the sentinel.
func (*Environment) Glob ¶
func (e *Environment) Glob(ctx context.Context, args *protocol.GlobArgs) (*protocol.GlobResult, error)
Glob searches for files matching a pattern.
func (*Environment) Grep ¶
func (e *Environment) Grep(ctx context.Context, args *protocol.GrepArgs) (*protocol.GrepResult, error)
Grep searches for a pattern in files.
func (*Environment) List ¶
func (e *Environment) List(ctx context.Context, args *protocol.ListArgs) (*protocol.ListResult, error)
List lists entries in a directory.
func (*Environment) MCPCall ¶
func (e *Environment) MCPCall(ctx context.Context, args *protocol.MCPCallArgs, logger *slog.Logger) (*protocol.MCPCallResult, error)
MCPCall executes an MCP tool call.
func (*Environment) MCPListTools ¶
func (e *Environment) MCPListTools(ctx context.Context, args *protocol.MCPListToolsArgs, logger *slog.Logger) (*protocol.MCPListToolsResult, error)
MCPListTools lists available tools from an MCP server.
func (*Environment) Read ¶
func (e *Environment) Read(ctx context.Context, args *protocol.ReadArgs) (*protocol.ReadResult, error)
Read reads a file from the workspace.
func (*Environment) Root ¶
func (e *Environment) Root() string
Root returns the workspace root directory.
func (*Environment) StageKnowledgeFiles ¶
func (e *Environment) StageKnowledgeFiles(ctx context.Context, args *protocol.StageKnowledgeFilesArgs) (*protocol.StageKnowledgeFilesResult, error)
StageKnowledgeFiles writes the supplied files into the workspace root and updates the sentinel checksum map.
func (*Environment) SyncSkill ¶
func (e *Environment) SyncSkill(ctx context.Context, args *protocol.SyncSkillArgs) (*protocol.SyncSkillResult, error)
SyncSkill syncs a skill from cloud to local workspace.
func (*Environment) WebFetch ¶
func (e *Environment) WebFetch(ctx context.Context, args *protocol.WebFetchArgs) (*protocol.WebFetchResult, error)
WebFetch fetches content from a URL and converts it to readable format.
type LargeOutputConfig ¶
LargeOutputConfig holds configuration for large output handling.
func DefaultLargeOutputConfig ¶
func DefaultLargeOutputConfig() LargeOutputConfig
DefaultLargeOutputConfig returns the default configuration.
type LargeOutputProcessor ¶
type LargeOutputProcessor struct {
// contains filtered or unexported fields
}
LargeOutputProcessor handles large output truncation and file storage.
func NewLargeOutputProcessor ¶
func NewLargeOutputProcessor(ws *Environment, config LargeOutputConfig) *LargeOutputProcessor
NewLargeOutputProcessor creates a new processor with the given workspace.
func (*LargeOutputProcessor) Process ¶
func (p *LargeOutputProcessor) Process(ctx context.Context, content string, prefix string) (*ProcessResult, error)
Process checks if content exceeds the limit and handles accordingly.
type LimitedWriter ¶
LimitedWriter is an io.Writer that limits the total number of bytes written.