WorkspaceAgentInterface

org.llm4s.shared.WorkspaceAgentInterface

Interface that provides methods corresponding to WorkspaceAgentCommands.

Attributes

Source
WorkspaceAgentInterface.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

def deleteFile(path: String, expectedHash: Option[String]): DeleteFileResponse

Delete the file, or the empty directory, path; with expectedHash, a compare-and-set as for writeFile (directory for a directory).

Delete the file, or the empty directory, path; with expectedHash, a compare-and-set as for writeFile (directory for a directory).

Attributes

Source
WorkspaceAgentInterface.scala
def executeCommand(command: String, workingDirectory: Option[String], timeout: Option[FiniteDuration], environment: Option[Map[String, String]], maxOutputBytes: Option[Long]): ExecuteCommandResponse

Execute a command in the workspace. The command is a program and its arguments, not shell text: the runner tokenizes it and runs the program directly, refusing pipes, redirection, ;, $(...) and anything else the sandbox's command policy forbids (see docs/reference/workspace-sandbox.md).

Execute a command in the workspace. The command is a program and its arguments, not shell text: the runner tokenizes it and runs the program directly, refusing pipes, redirection, ;, $(...) and anything else the sandbox's command policy forbids (see docs/reference/workspace-sandbox.md).

Value parameters

command

Command to execute

environment

Environment variables

maxOutputBytes

The most bytes of each of stdout and stderr to keep, measured as the output is carried (UTF-8, JSON-escaped; so also at most that many characters). Default and upper bound: the workspace's maxOutputSize; the rest is read and discarded, and isOutputTruncated set

timeout

Timeout (default: the sandbox's defaultCommandTimeout)

workingDirectory

Working directory (default: workspace root)

Attributes

Returns

Response with command execution result

Source
WorkspaceAgentInterface.scala
def exploreFiles(path: String, recursive: Option[Boolean], excludePatterns: Option[List[String]], maxDepth: Option[Int], returnMetadata: Option[Boolean]): ExploreFilesResponse

List files and directories in a specified path, optionally recursively.

List files and directories in a specified path, optionally recursively.

Value parameters

excludePatterns

Glob patterns to exclude

maxDepth

Maximum recursion depth

path

Path to explore

recursive

Whether to explore recursively

returnMetadata

Whether to include file metadata

Attributes

Returns

Response with list of files and directories

Source
WorkspaceAgentInterface.scala
def fileSnapshot(path: String, includeContent: Boolean, followLinks: Boolean): FileSnapshotResponse

What is at path: nothing, a directory, or a file with the hash of its bytes and, when includeContent, its exact text if it is valid UTF-8 and at most the workspace's maxFileSize. With followLinks = false, a symbolic link at path is described as itself: kind link and a hash of where it points, which a deleteFile compares (it removes the link, not what it names).

What is at path: nothing, a directory, or a file with the hash of its bytes and, when includeContent, its exact text if it is valid UTF-8 and at most the workspace's maxFileSize. With followLinks = false, a symbolic link at path is described as itself: kind link and a hash of where it points, which a deleteFile compares (it removes the link, not what it names).

Attributes

Source
WorkspaceAgentInterface.scala

Retrieve information about the workspace, including default settings and limits.

Retrieve information about the workspace, including default settings and limits.

Attributes

Returns

Response with workspace information

Source
WorkspaceAgentInterface.scala

Perform targeted modifications to a file without rewriting the entire content.

Perform targeted modifications to a file without rewriting the entire content.

Value parameters

operations

List of operations to perform

path

Path to file

Attributes

Returns

Response with modification result

Source
WorkspaceAgentInterface.scala
def readFile(path: String, startLine: Option[Int], endLine: Option[Int]): ReadFileResponse

Read the content of a file, with options to read specific line ranges.

Read the content of a file, with options to read specific line ranges.

Value parameters

endLine

Optional end line (1-indexed)

path

Path to file

startLine

Optional start line (1-indexed)

Attributes

Returns

Response with file content and metadata

Source
WorkspaceAgentInterface.scala
def searchFiles(paths: List[String], query: String, searchType: String, recursive: Option[Boolean], excludePatterns: Option[List[String]], contextLines: Option[Int]): SearchFilesResponse

Search for content in files across the workspace.

Search for content in files across the workspace.

Value parameters

contextLines

Number of context lines to include

excludePatterns

Glob patterns to exclude

paths

Paths to search in

query

Search query

recursive

Whether to search recursively

searchType

Search type ("regex" or "literal")

Attributes

Returns

Response with search results

Source
WorkspaceAgentInterface.scala
def writeFile(path: String, content: String, mode: Option[String], createDirectories: Option[Boolean], expectedHash: Option[String]): WriteFileResponse

Write content to a file, creating the file if it doesn't exist.

Write content to a file, creating the file if it doesn't exist.

Value parameters

content

Content to write

createDirectories

Create parent directories if they don't exist

expectedHash

A compare-and-set: write only if the path's current FileSnapshotResponse.hash is this, atomically against every other file operation, and replace the file atomically (a reader or a crash sees the old content or the new, never part of it); otherwise HASH_MISMATCH, and nothing is written. Only with mode "overwrite".

mode

Write mode (default: "overwrite")

path

Path to file

Attributes

Returns

Response with write operation result

Source
WorkspaceAgentInterface.scala