Managoat.Sandbox.E2B.Envd (managoat_sandbox v0.2.1)

Copy Markdown View Source

E2B data-plane client: "envd", the daemon inside every sandbox, reachable at https://49983-{sandboxId}.{domain}.

envd speaks the Connect protocol with the JSON codec — no gRPC and no HTTP/2 required:

  • unary calls are plain application/json POSTs to /process.Process/<Method>;
  • server-streaming calls use application/connect+json, where both directions carry 5-byte envelopes — one flag byte, a 4-byte big-endian length, then a JSON message. Flag 0x02 marks the EndStreamResponse (trailers / error).

Protobuf bytes fields ride base64 in the JSON codec — stdin payloads out, stdout/stderr data in. Files use envd's plain HTTP API (POST /files multipart, parents auto-created; GET /files to read).

Summary

Functions

Send stdin EOF to the process selected by tag.

Pull every complete envelope out of buffer, returning {frames, rest} where each frame is {:message, map} (flag 0) or {:end_stream, map} (flag 2 — trailers/error).

Encode one message as a Connect envelope (flag 0).

List the processes envd is running.

Write stdin bytes to the process selected by tag.

The Process/Start request for a shell command, tagged so a later Connect/SendInput can address the process by name.

Content type for streaming Connect calls. application/connect+json on the wire; overridable because test plugs run Plug.Parsers, which chokes on the binary envelope behind any +json type.

Functions

close_stdin(sandbox_id, tag)

Send stdin EOF to the process selected by tag.

decode_frames(buffer, acc \\ [])

Pull every complete envelope out of buffer, returning {frames, rest} where each frame is {:message, map} (flag 0) or {:end_stream, map} (flag 2 — trailers/error).

encode_frame(message)

Encode one message as a Connect envelope (flag 0).

host(sandbox_id)

list_processes(sandbox_id)

List the processes envd is running.

read_file(sandbox_id, path)

req(sandbox_id)

send_input(sandbox_id, tag, data)

Write stdin bytes to the process selected by tag.

start_request(tag, cmd, args, opts)

The Process/Start request for a shell command, tagged so a later Connect/SendInput can address the process by name.

stream_content_type()

Content type for streaming Connect calls. application/connect+json on the wire; overridable because test plugs run Plug.Parsers, which chokes on the binary envelope behind any +json type.

write_file(sandbox_id, path, data)