{
  "openapi": "3.0.0",
  "info": {
    "title": "Innochip Nexus Node Terminal & Compute API",
    "description": "Direct, sandboxed terminal and Python code execution for ChatGPT on local Innochip Nodes.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://innochipus.com",
      "description": "Innochip Production API"
    }
  ],
  "paths": {
    "/api/v1/nexus/compute/dispatch": {
      "post": {
        "summary": "Execute sandboxed terminal command or Python script",
        "operationId": "execute_sandboxed_command",
        "description": "Executes a PowerShell, shell command, or Python script within a zero-residue, isolated ephemeral sandbox on the user's bound PC workstation.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "command": {
                    "type": "string",
                    "description": "The command or script to execute (e.g. 'Get-Process', 'python script.py')."
                  },
                  "code": {
                    "type": "string",
                    "description": "Optional inline Python code to execute directly in the sandbox."
                  },
                  "language": {
                    "type": "string",
                    "enum": [
                      "powershell",
                      "python",
                      "cmd"
                    ],
                    "default": "powershell",
                    "description": "Execution language/shell."
                  },
                  "timeout_seconds": {
                    "type": "number",
                    "default": 60,
                    "description": "Maximum execution time in seconds."
                  }
                },
                "required": [
                  "command"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Execution completed successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "PASS"
                    },
                    "returncode": {
                      "type": "integer",
                      "example": 0
                    },
                    "stdout": {
                      "type": "string"
                    },
                    "stderr": {
                      "type": "string"
                    },
                    "execution_time_ms": {
                      "type": "number",
                      "example": 542.1
                    },
                    "sandbox_cleanup": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/nexus/compute/status": {
      "get": {
        "summary": "Query node status and pairing health",
        "operationId": "get_node_status",
        "description": "Returns whether the user's Innochip Node is online, active hardware logical cores, and sandbox health.",
        "responses": {
          "200": {
            "description": "Node status returned successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "ONLINE"
                    },
                    "node_name": {
                      "type": "string",
                      "example": "JONAH-WS"
                    },
                    "cpu_count": {
                      "type": "integer",
                      "example": 16
                    },
                    "plan_tier": {
                      "type": "string",
                      "example": "STUDIO"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}