All RPC Requests/Responses, and Types (Rpc* prefixed types), are manually hardcoded in kaspa_rpc.pyi stub file. The contents of this file are then appended to the auto generated stubs and written to kaspa.pyi as part of stub generation pipeline.
All other stubs are automatically generated. Currently, these are generated using pyo3-stub-gen, but is subject to change once PyO3 has robust built in stub gen functionality (which is currently experimental status).
Ideally, all stubs are auto generated from source.