Process
Section titled “Process”Process and session execution interface for a Sandbox.
Supports single-command execution, code execution, long-running sessions, and PTY terminal sessions.
Methods
Section titled “Methods”executeCommand()
Section titled “executeCommand()”public ExecuteResponse executeCommand(String command)Executes a shell command with default options.
Parameters:
commandString - command to execute
Returns:
ExecuteResponse- execution result
Throws:
DaytonaException- if execution fails
executeCommand()
Section titled “executeCommand()”public ExecuteResponse executeCommand(String command, String cwd, Map<String, String> env, Integer timeout)Executes a shell command.
Parameters:
commandString - command to executecwdString - working directory, ornullto use sandbox defaultenvMap<String, String> - environment variables to set for the commandtimeoutInteger - timeout in seconds
Returns:
ExecuteResponse- execution result
Throws:
DaytonaException- if execution fails
codeRun()
Section titled “codeRun()”public ExecuteResponse codeRun(String code)Executes source code using Sandbox language tooling.
Parameters:
codeString - source code to execute
Returns:
ExecuteResponse- execution result
Throws:
DaytonaException- if execution fails
codeRun()
Section titled “codeRun()”public ExecuteResponse codeRun(String code, Map<String, String> env, Integer timeout)Parameters:
codeString -envMap<String, String> -timeoutInteger -
Returns:
ExecuteResponse-
codeRun()
Section titled “codeRun()”public ExecuteResponse codeRun(String code, List<String> argv, Map<String, String> env, Integer timeout)Parameters:
codeString -argvList<String> -envMap<String, String> -timeoutInteger -
Returns:
ExecuteResponse-
createSession()
Section titled “createSession()”public void createSession(String sessionId)Creates a persistent background session.
Parameters:
sessionIdString - unique session identifier
Throws:
DaytonaException- if session creation fails
getSession()
Section titled “getSession()”public Session getSession(String sessionId)Returns session metadata.
Parameters:
sessionIdString - session identifier
Returns:
Session- session metadata
Throws:
DaytonaException- if retrieval fails
getEntrypointSession()
Section titled “getEntrypointSession()”public Session getEntrypointSession()Returns entrypoint session metadata.
Returns:
Session- entrypoint session metadata
Throws:
DaytonaException- if retrieval fails
executeSessionCommand()
Section titled “executeSessionCommand()”public SessionExecuteResponse executeSessionCommand(String sessionId, SessionExecuteRequest req)Executes a command in an existing session.
Parameters:
sessionIdString - session identifierreqSessionExecuteRequest - execution request
Returns:
SessionExecuteResponse- command execution response
Throws:
DaytonaException- if execution fails
getSessionCommand()
Section titled “getSessionCommand()”public Command getSessionCommand(String sessionId, String commandId)Returns metadata for a command executed in a session.
Parameters:
sessionIdString - session identifiercommandIdString - command identifier
Returns:
Command- command metadata
Throws:
DaytonaException- if retrieval fails
getSessionCommandLogs()
Section titled “getSessionCommandLogs()”public SessionCommandLogsResponse getSessionCommandLogs(String sessionId, String commandId)Returns logs for a command executed in a session.
Parameters:
sessionIdString - session identifiercommandIdString - command identifier
Returns:
SessionCommandLogsResponse- command logs
Throws:
DaytonaException- if retrieval fails
getEntrypointLogs()
Section titled “getEntrypointLogs()”public SessionCommandLogsResponse getEntrypointLogs()Returns one-shot logs for the sandbox entrypoint session.
Returns:
SessionCommandLogsResponse- entrypoint logs
Throws:
DaytonaException- if retrieval fails
getEntrypointLogs()
Section titled “getEntrypointLogs()”public void getEntrypointLogs(Consumer<String> onStdout, Consumer<String> onStderr)Streams logs for the sandbox entrypoint session via WebSocket.
Parameters:
onStdoutConsumer<String> - callback for stdout chunksonStderrConsumer<String> - callback for stderr chunks
Throws:
DaytonaException- if streaming fails
sendSessionCommandInput()
Section titled “sendSessionCommandInput()”public void sendSessionCommandInput(String sessionId, String commandId, String data)Sends input data to a command executed in a session.
Parameters:
sessionIdString - session identifiercommandIdString - command identifierdataString - input text to send
Throws:
DaytonaException- if sending input fails
deleteSession()
Section titled “deleteSession()”public void deleteSession(String sessionId)Deletes a session.
Parameters:
sessionIdString - session identifier
Throws:
DaytonaException- if deletion fails
listSessions()
Section titled “listSessions()”public List<Session> listSessions()Lists all sessions in the Sandbox.
Returns:
List\<Session\>- session list
Throws:
DaytonaException- if listing fails
createPty()
Section titled “createPty()”public PtyHandle createPty(PtyCreateOptions options)Creates a PTY terminal session.
Parameters:
optionsPtyCreateOptions - PTY options, ornullto use defaults
Returns:
PtyHandle- PTY handle for streaming I/O and lifecycle operations
Throws:
DaytonaException- if PTY session creation fails
connectPty()
Section titled “connectPty()”public PtyHandle connectPty(String sessionId)Connects to an existing PTY terminal session.
Parameters:
sessionIdString - PTY session identifier
Returns:
PtyHandle- PTY handle for streaming I/O and lifecycle operations
Throws:
DaytonaException- if websocket connection setup fails
connectPty()
Section titled “connectPty()”public PtyHandle connectPty(String sessionId, PtyCreateOptions options)Connects to an existing PTY terminal session.
Parameters:
sessionIdString - PTY session identifieroptionsPtyCreateOptions - PTY options, used for data callback configuration
Returns:
PtyHandle- PTY handle for streaming I/O and lifecycle operations
Throws:
DaytonaException- if websocket connection setup fails
listPtySessions()
Section titled “listPtySessions()”public List<PtySessionInfo> listPtySessions()Lists PTY sessions in the Sandbox.
Returns:
List\<PtySessionInfo\>- PTY session information list
Throws:
DaytonaException- if listing fails
getPtySessionInfo()
Section titled “getPtySessionInfo()”public PtySessionInfo getPtySessionInfo(String sessionId)Returns PTY session information.
Parameters:
sessionIdString - PTY session identifier
Returns:
PtySessionInfo- PTY session information
Throws:
DaytonaException- if retrieval fails
resizePtySession()
Section titled “resizePtySession()”public void resizePtySession(String sessionId, int cols, int rows)Resizes an active PTY session.
Parameters:
sessionIdString - PTY session identifiercolsint - terminal width in columnsrowsint - terminal height in rows
Throws:
DaytonaException- if resize fails
killPtySession()
Section titled “killPtySession()”public void killPtySession(String sessionId)Terminates a PTY session.
Parameters:
sessionIdString - PTY session identifier
Throws:
DaytonaException- if termination fails