{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/casama-ai/json-schema/casama-ai-computer-schema.json",
  "title": "Computer",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/casama-ai-openapi.json#/components/schemas/Computer",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "org_id": {
      "type": "string",
      "format": "uuid"
    },
    "kind": {
      "type": "string",
      "enum": [
        "private",
        "team",
        "local"
      ]
    },
    "name": {
      "type": "string"
    },
    "owner_bot_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "provider": {
      "type": "string"
    },
    "profile": {
      "type": "string",
      "enum": [
        "headless",
        "desktop"
      ]
    },
    "state": {
      "$ref": "#/$defs/ComputerState"
    },
    "size": {
      "type": "object",
      "properties": {
        "cpus": {
          "type": "number"
        },
        "memory_mb": {
          "type": "number"
        },
        "disk_gb": {
          "type": "number"
        }
      }
    },
    "has_snapshot": {
      "type": "boolean"
    },
    "home_kept": {
      "type": "boolean",
      "description": "Asleep with its files still on disk (warm sleep, D-574): it wakes in seconds. False with has_snapshot: waking restores its files from the archive, which takes longer."
    },
    "max_desktops": {
      "type": "integer",
      "description": "Team computers: bots that may use the desktop at the same time"
    },
    "last_active_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "error": {
      "type": [
        "string",
        "null"
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "os": {
      "type": [
        "string",
        "null"
      ],
      "description": "The operating system to show, e.g. \"Ubuntu 24.04\" or \"macOS 26.2\"; null when unknown (D-227)"
    },
    "device": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "platform": {
          "type": "string",
          "enum": [
            "macos",
            "windows",
            "linux"
          ]
        },
        "online": {
          "type": "boolean"
        },
        "last_seen_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "capabilities": {
          "$ref": "#/$defs/LocalCapabilities"
        }
      },
      "required": [
        "platform",
        "online",
        "last_seen_at",
        "capabilities"
      ],
      "description": "Personal computers only: the paired device"
    },
    "idle_sleep_minutes": {
      "type": "integer",
      "description": "Minutes without activity before it sleeps (D-240); 5 unless changed"
    },
    "operation": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "reset_system",
            "erase"
          ]
        },
        "step": {
          "type": "string",
          "enum": [
            "saving",
            "wiping",
            "restarting",
            "done",
            "failed"
          ]
        },
        "checkpoint_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid",
          "description": "The restore point saved first: restoring it undoes the reset"
        },
        "error": {
          "type": [
            "string",
            "null"
          ]
        },
        "started_at": {
          "type": "string",
          "format": "date-time"
        },
        "finished_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      },
      "required": [
        "kind",
        "step",
        "checkpoint_id",
        "error",
        "started_at",
        "finished_at"
      ],
      "description": "The last reset: in progress, done (with its undo point) or failed (D-240)"
    },
    "update_available_since": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "Since when a newer system is ready for this running computer (D-360). Applying it restarts the computer (files kept); it also applies by itself the next time the computer sleeps. Null: up to date or not known."
    },
    "files_removed_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When its saved files were removed because the workspace went unused for 6 months (docs/INACTIVE-ACCOUNTS-PLAN.md); it starts fresh. Null: never."
    },
    "in_use_by": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "bot_id": {
          "type": "string",
          "format": "uuid"
        },
        "bot_name": {
          "type": "string"
        },
        "run_id": {
          "type": "string",
          "format": "uuid"
        },
        "conversation_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid"
        }
      },
      "required": [
        "bot_id",
        "bot_name",
        "run_id",
        "conversation_id"
      ],
      "description": "The bot driving its screen right now (a browser or desktop step in a working run, within the last 2 minutes); null when none. A team computer's every chat shows the same screen, so the panel says whose work it is (D-617)."
    }
  },
  "required": [
    "id",
    "org_id",
    "kind",
    "name",
    "owner_bot_id",
    "provider",
    "profile",
    "state",
    "size",
    "has_snapshot",
    "max_desktops",
    "last_active_at",
    "error",
    "created_at"
  ],
  "$defs": {
    "ComputerState": {
      "type": "string",
      "enum": [
        "provisioning",
        "starting",
        "running",
        "idle",
        "sleeping",
        "stopped",
        "error"
      ]
    },
    "LocalCapabilities": {
      "type": "object",
      "properties": {
        "shell": {
          "type": "boolean"
        },
        "files": {
          "type": "boolean"
        },
        "browser": {
          "type": "boolean"
        },
        "desktop": {
          "type": "boolean"
        },
        "mcp": {
          "type": "boolean"
        },
        "messages": {
          "type": "boolean"
        }
      }
    }
  }
}