Connect to a unit's terminal
Code Mode: praxis.devops.units.connect
HTTP: POST /devops/v1/units/{id}:connect
Take a terminal into the unit’s machine — the path the Console workspaces page uses when a person opens one. The call does not hand back a terminal itself: it resolves the unit to the sandbox instance behind it, and the caller asks the sandbox’s public interface for a terminal token against that instance id; DevOps never carries the token. A stopped unit (phase shutdown) is started first, and the answer reports the phase that start produced (starting); a unit already available answers available; every other phase (queued, provisioning, shutting_down, failed, deleted) is reported as it stands. instance is the sandbox instance id and has a value only when phase is available — otherwise it is null, so poll devops.units.get until the unit is available and call again. A start refused because another transition is already in flight answers 409 UNIT_INVALID_STATE.
Signature
praxis.devops.units.connect(args:{path:{/** e.g. "wsu_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ id:string}}):Promise<{/** The unit this answer is about, the same id the call addressed. e.g. "wsu_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ unit:string;phase:"queued"|"provisioning"|"available"|"shutting_down"|"shutdown"|"starting"|"failed"|"deleted";/** The sandbox instance id to open the terminal against; it has a value only when phase is available, and null in every other phase, so poll the unit until it is a e.g. "sbx_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ instance:string|null}>;Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| id | path | string | yes | The unit identifier returned by the unit create answer or a unit list, such as wsu_…; not the id of the change it was opened for. |
Responses
| Status | Content types | Description |
|---|---|---|
| 200 | application/json | The unit’s id, its current phase, and the instance id when the machine is available; instance is null while the unit is starting or otherwise not available. |
| 401 | application/json | The API key is missing or invalid; send a valid Praxis API key in the Authorization header before retrying. |
| 403 | application/json | The credential carries no organization, or that organization cannot reach this project; use a key belonging to the project’s organization. No cross-organization read is possible. |
| 404 | application/json | UNIT_NOT_FOUND means no unit with that id is visible to this organization — a unit belonging to another organization answers the same way, so its existence is not revealed; list the project’s units and use an id from that answer. |
| 409 | application/json | UNIT_INVALID_STATE means the unit is not in a phase where this verb applies — starting one that is already available, for example, or acting while another transition is still in flight; read the unit to see its phase, and retry once it has settled. Nothing changed. |
| 500 | application/json | INTERNAL means the service could not complete the request; retry once, and if it repeats report the request id. A read is safe to repeat; a write that failed this way should be re-read before it is sent again. |