{
  "lexicon": 1,
  "id": "space.polymodel.actor.getSession",
  "defs": {
    "sessionUnauthenticated": {
      "type": "object",
      "description": "Logged-out session marker. No identity fields are present when authenticated is false.",
      "required": ["authenticated"],
      "properties": { "authenticated": { "type": "boolean", "const": false } }
    },
    "sessionAuthenticated": {
      "type": "object",
      "description": "Authenticated viewer identity for client session seeding. If authenticated is true, did, handle, and profile are all present.",
      "required": ["authenticated", "did", "handle", "profile"],
      "properties": {
        "authenticated": { "type": "boolean", "const": true },
        "did": { "type": "string", "format": "did" },
        "handle": { "type": "string", "format": "handle" },
        "profile": { "type": "ref", "ref": "space.polymodel.actor.defs#profileView" }
      }
    },
    "sessionView": {
      "type": "union",
      "refs": [
        "space.polymodel.actor.getSession#sessionUnauthenticated",
        "space.polymodel.actor.getSession#sessionAuthenticated"
      ],
      "closed": true
    },
    "main": {
      "type": "query",
      "description": "Identity primitive (PM-9). Returns either a logged-out marker or the authenticated viewer's full identity/profile for client session seeding. Takes no parameters: identity is derived from the request session, not an actor argument.",
      "output": {
        "encoding": "application/json",
        "schema": { "type": "ref", "ref": "space.polymodel.actor.getSession#sessionView" }
      }
    }
  }
}
