ExDaytona.Toolbox (ex_daytona v0.3.0)

Copy Markdown View Source

Helpers for connecting to a sandbox's toolbox API.

Toolbox endpoints (ExDaytona.Api.Process, FileSystem, Git, Lsp, ComputerUse, …) are not served from the main platform base URL — each sandbox exposes them at {toolboxProxyUrl}/{sandboxId}, where toolboxProxyUrl comes from the sandbox DTO returned by the platform API.

conn = ExDaytona.Connection.new(bearer_token: token)
{:ok, sandbox} = ExDaytona.Api.Sandbox.get_sandbox(conn, "my-sandbox")

toolbox = ExDaytona.Toolbox.connection(sandbox, bearer_token: token)

{:ok, result} =
  ExDaytona.Api.Process.execute_command(
    toolbox,
    %ExDaytona.Model.ExecuteRequest{command: "echo hello"}
  )

Summary

Functions

The toolbox base URL for a sandbox: {toolboxProxyUrl}/{sandboxId}.

Build a ExDaytona.Connection for a sandbox's toolbox API.

Functions

base_url(sandbox)

@spec base_url(ExDaytona.Model.Sandbox.t()) :: String.t()

The toolbox base URL for a sandbox: {toolboxProxyUrl}/{sandboxId}.

Raises ArgumentError if the sandbox has no toolboxProxyUrl (e.g. a sandbox that is still starting or was built from a sparse fixture).

connection(sandbox, options \\ [])

Build a ExDaytona.Connection for a sandbox's toolbox API.

Accepts the same options as ExDaytona.Connection.new/1 (e.g. bearer_token); the base_url is derived from the sandbox and cannot be overridden here.