Terminals
A terminal is a opened inside the machine, with stdin/stdout streamed to your client over a WebSocket. The machine wakes if it was sleeping.
dedalus machines terminals create \
--machine-id <machine_id> \
--width 80 \
--height 24 \
--shell /bin/bash \
--cwd /root \
--env '{"FOO":"bar"}'
term = client.machines.terminals.create(
machine_id="<machine_id>",
width=80,
height=24,
shell="/bin/bash", # optional
cwd="/root", # optional
env={"FOO": "bar"}, # optional
)
print(term.stream_url) # wss://...
const term = await client.machines.terminals.create({
machine_id: "<machine_id>",
width: 80,
height: 24,
});
console.log(term.stream_url);
term, _ := client.Machines.Terminals.New(ctx, dedalus.MachineTerminalNewParams{
MachineID: machineID,
TerminalCreateParams: dedalus.TerminalCreateParams{
Width: 80,
Height: 24,
Shell: dedalus.String("/bin/bash"),
Cwd: dedalus.String("/root"),
Env: map[string]string{"FOO": "bar"},
},
})
fmt.Println(term.StreamURL)
Parameters
machine_id · string · required
The machine where the terminal opens.
width · integer · required
Initial terminal width in columns.
height · integer · required
Initial terminal height in rows.
shell · string · default: /bin/bash
Shell to start inside the PTY.
cwd · string · default: /root
Working directory for the shell.
env · object
Extra environment variables for the shell.
Wire protocol
| Direction | Frame | Payload |
|---|---|---|
| Client → server | Binary | Raw bytes written to the shell's stdin (keystrokes, paste, etc.) |
| Client → server | Text (JSON) | {"cols": 100, "rows": 30} to resize the PTY |
| Server → client | Binary | Raw bytes from the shell's stdout/stderr (ANSI escapes intact) |
| Server → client | Close | Shell exited or session expired |
Manage terminals
dedalus machines terminals list --machine-id <machine_id>
dedalus machines terminals retrieve --machine-id <machine_id> --terminal-id <terminal_id>
dedalus machines terminals delete --machine-id <machine_id> --terminal-id <terminal_id>
client.machines.terminals.list(machine_id="<machine_id>")
client.machines.terminals.retrieve(machine_id="<machine_id>", terminal_id="<terminal_id>")
client.machines.terminals.delete(machine_id="<machine_id>", terminal_id="<terminal_id>")
await client.machines.terminals.list({ machine_id: "<machine_id>" });
await client.machines.terminals.retrieve({
machine_id: "<machine_id>",
terminal_id: "<terminal_id>",
});
await client.machines.terminals.delete({
machine_id: "<machine_id>",
terminal_id: "<terminal_id>",
});
client.Machines.Terminals.List(ctx, dedalus.MachineTerminalListParams{
MachineID: machineID,
})
client.Machines.Terminals.Get(ctx, dedalus.MachineTerminalGetParams{
MachineID: machineID,
TerminalID: "<terminal_id>",
})
client.Machines.Terminals.Delete(ctx, dedalus.MachineTerminalDeleteParams{
MachineID: machineID,
TerminalID: "<terminal_id>",
})
Parameters
machine_id · string · required
The machine that owns the terminal.
terminal_id · string · required
The terminal to retrieve or close.
