コンテンツにスキップ
View as Markdown

このコンテンツはまだ日本語訳がありません。

Process and session execution interface for a Sandbox.

Supports single-command execution, code execution, long-running sessions, and PTY terminal sessions.

public ExecuteResponse executeCommand(String command)

Executes a shell command with default options.

Parameters:

  • command String - command to execute

Returns:

  • ExecuteResponse - execution result

Throws:

  • DaytonaException - if execution fails
public ExecuteResponse executeCommand(String command, String cwd, Map<String, String> env, Integer timeout)

Executes a shell command.

Parameters:

  • command String - command to execute
  • cwd String - working directory, or null to use sandbox default
  • env Map<String, String> - environment variables to set for the command
  • timeout Integer - timeout in seconds

Returns:

  • ExecuteResponse - execution result

Throws:

  • DaytonaException - if execution fails
public ExecuteResponse codeRun(String code)

Executes source code using Sandbox language tooling.

Parameters:

  • code String - source code to execute

Returns:

  • ExecuteResponse - execution result

Throws:

  • DaytonaException - if execution fails
public ExecuteResponse codeRun(String code, Map<String, String> env, Integer timeout)

Parameters:

  • code String -
  • env Map<String, String> -
  • timeout Integer -

Returns:

  • ExecuteResponse -
public ExecuteResponse codeRun(String code, List<String> argv, Map<String, String> env, Integer timeout)

Parameters:

  • code String -
  • argv List<String> -
  • env Map<String, String> -
  • timeout Integer -

Returns:

  • ExecuteResponse -
public void createSession(String sessionId)

Creates a persistent background session.

Parameters:

  • sessionId String - unique session identifier

Throws:

  • DaytonaException - if session creation fails
public Session getSession(String sessionId)

Returns session metadata.

Parameters:

  • sessionId String - session identifier

Returns:

  • Session - session metadata

Throws:

  • DaytonaException - if retrieval fails
public Session getEntrypointSession()

Returns entrypoint session metadata.

Returns:

  • Session - entrypoint session metadata

Throws:

  • DaytonaException - if retrieval fails
public SessionExecuteResponse executeSessionCommand(String sessionId, SessionExecuteRequest req)

Executes a command in an existing session.

Parameters:

  • sessionId String - session identifier
  • req SessionExecuteRequest - execution request

Returns:

  • SessionExecuteResponse - command execution response

Throws:

  • DaytonaException - if execution fails
public Command getSessionCommand(String sessionId, String commandId)

Returns metadata for a command executed in a session.

Parameters:

  • sessionId String - session identifier
  • commandId String - command identifier

Returns:

  • Command - command metadata

Throws:

  • DaytonaException - if retrieval fails
public SessionCommandLogsResponse getSessionCommandLogs(String sessionId, String commandId)

Returns logs for a command executed in a session.

Parameters:

  • sessionId String - session identifier
  • commandId String - command identifier

Returns:

  • SessionCommandLogsResponse - command logs

Throws:

  • DaytonaException - if retrieval fails
public SessionCommandLogsResponse getEntrypointLogs()

Returns one-shot logs for the sandbox entrypoint session.

Returns:

  • SessionCommandLogsResponse - entrypoint logs

Throws:

  • DaytonaException - if retrieval fails
public void getEntrypointLogs(Consumer<String> onStdout, Consumer<String> onStderr)

Streams logs for the sandbox entrypoint session via WebSocket.

Parameters:

  • onStdout Consumer<String> - callback for stdout chunks
  • onStderr Consumer<String> - callback for stderr chunks

Throws:

  • DaytonaException - if streaming fails
public void sendSessionCommandInput(String sessionId, String commandId, String data)

Sends input data to a command executed in a session.

Parameters:

  • sessionId String - session identifier
  • commandId String - command identifier
  • data String - input text to send

Throws:

  • DaytonaException - if sending input fails
public void deleteSession(String sessionId)

Deletes a session.

Parameters:

  • sessionId String - session identifier

Throws:

  • DaytonaException - if deletion fails
public List<Session> listSessions()

Lists all sessions in the Sandbox.

Returns:

  • List\<Session\> - session list

Throws:

  • DaytonaException - if listing fails
public PtyHandle createPty(PtyCreateOptions options)

Creates a PTY terminal session.

Parameters:

  • options PtyCreateOptions - PTY options, or null to use defaults

Returns:

  • PtyHandle - PTY handle for streaming I/O and lifecycle operations

Throws:

  • DaytonaException - if PTY session creation fails
public PtyHandle connectPty(String sessionId)

Connects to an existing PTY terminal session.

Parameters:

  • sessionId String - PTY session identifier

Returns:

  • PtyHandle - PTY handle for streaming I/O and lifecycle operations

Throws:

  • DaytonaException - if websocket connection setup fails
public PtyHandle connectPty(String sessionId, PtyCreateOptions options)

Connects to an existing PTY terminal session.

Parameters:

  • sessionId String - PTY session identifier
  • options PtyCreateOptions - 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
public List<PtySessionInfo> listPtySessions()

Lists PTY sessions in the Sandbox.

Returns:

  • List\<PtySessionInfo\> - PTY session information list

Throws:

  • DaytonaException - if listing fails
public PtySessionInfo getPtySessionInfo(String sessionId)

Returns PTY session information.

Parameters:

  • sessionId String - PTY session identifier

Returns:

  • PtySessionInfo - PTY session information

Throws:

  • DaytonaException - if retrieval fails
public void resizePtySession(String sessionId, int cols, int rows)

Resizes an active PTY session.

Parameters:

  • sessionId String - PTY session identifier
  • cols int - terminal width in columns
  • rows int - terminal height in rows

Throws:

  • DaytonaException - if resize fails
public void killPtySession(String sessionId)

Terminates a PTY session.

Parameters:

  • sessionId String - PTY session identifier

Throws:

  • DaytonaException - if termination fails