WebSocket-based implementation of ContainerisedWorkspace that communicates with the workspace runner via WebSocket instead of HTTP.
This solves the threading issues of the HTTP version by:
- Using asynchronous WebSocket communication
- Implementing heartbeats over the same connection
- Supporting real-time streaming of command output
- Eliminating thread pool blocking during long commands
Commands run without a shell, and only programs on the runner's allowlist run (#1756): the runner's WORKSPACE_SANDBOX_PROFILE (unset, permissive) chooses the list, and extraAllowedCommands adds to it.
Value parameters
- extraAllowedCommands
-
programs the runner may run besides its profile's allowlist (for example
sbt), passed to the container asWORKSPACE_EXTRA_COMMANDS; each is a bare program name, never a shell or a launcher (see WorkspaceSandboxConfig.withExtraCommands), and a container is not started with a name the runner would refuse - hostPort
-
the host port the container's 8080 is published on
- imageName
-
the workspace-runner image
- workspaceDir
-
the host directory mounted as the container's
/workspace
Attributes
- Companion
- object
- Graph
-
- Supertypes
Members list
Value members
Concrete methods
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
- timeout
-
Timeout (default: the sandbox's
defaultCommandTimeout) - workingDirectory
-
Working directory (default: workspace root)
Attributes
- Returns
-
Response with command execution result
- Definition Classes
Execute a command with streaming output support. The handler will be called for each chunk of output received.
Execute a command with streaming output support. The handler will be called for each chunk of output received.
Attributes
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
- Definition Classes
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
- Definition Classes
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
- Definition Classes
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
- Definition Classes
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
- Definition Classes
Starts the workspace runner docker container and establishes WebSocket connection
Starts the workspace runner docker container and establishes WebSocket connection
Attributes
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
- mode
-
Write mode (default: "overwrite")
- path
-
Path to file
Attributes
- Returns
-
Response with write operation result
- Definition Classes