Skip to main content

Open or resume the session for a workspace

POST 

/sessions/open

Resolves a workspace directory to its session and returns it, creating the session the first time the directory is opened. This is the only REST operation that creates a workspace session, so a controller starts with none and a client must name the workspace it wants. POST /sessions/system creates the system session. It takes no X-Session-ID header; use the returned session.id as X-Session-ID on later REST calls and as metadata.sessionId on the WebSocket. The response also carries it in the X-Session-ID response header.

The path is resolved through its symbolic links, so opening the same directory again by any of its names resumes the same session. All entry points targeting that directory use its session.

Each workspace session has one agent space.

  • For a workspace with no session yet, agentSpace picks the agent space. Leaving it out gives the deployment default (default in GET /agent-spaces).
  • For a workspace with a session, leaving agentSpace out or naming its current space reuses the session. Naming a different one returns 409 AGENT_SPACE_CONFLICT, whose message names the workspace's current agent space. Use POST /session/reconfigure to move the workspace on purpose.

Errors, none of which creates a session:

  • 400 VALIDATION_FAILED: the body is missing or malformed, workspace is empty, or the path is not a directory.
  • 403 AGENT_SPACE_NOT_ALLOWED: agentSpace names an agent space the deployment does not offer. This is checked first, even when the workspace already has a session.
  • 403 WORKSPACE_NOT_ALLOWED: the path is outside every configured workspace root (before or after resolving symbolic links), or the workspace is, contains, or sits inside the controller's state directory, or is or contains its configuration directory. The message never names a root.
  • 404 WORKSPACE_NOT_FOUND: the path is beneath a configured root but the directory does not exist.
  • 409 AGENT_SPACE_CONFLICT: see above.

Request​

Responses​

The session, and whether this call created it.

Response Headers
    X-Session-ID

    The session this response belongs to. For session-scoped requests it echoes the X-Session-ID request header; for POST /sessions/open and POST /sessions/system it is the session that was opened or created.

    X-Request-ID

    The request's correlation ID. When the request carried an X-Request-ID header holding a UUID, Peen echoes it; otherwise Peen generates a new UUID. The controller log records the same value for this request.