This release is a pre-release and may not be stable for production use.
Castor Client (castor-client)
Typed Python client for the Castor OS AISA v0.1 Unix-domain socket IPC protocol. The Rust castord process owns authorization, journal transitions, recovery, and effect admission. This package only sends requests and validates responses; it has no local kernel fallback.
Features
- Big-Endian 32-bit Framing: Robust framing matching the Castor kernel wire protocol.
- Exact Fragmented Reads: Handles partial TCP/Unix socket chunks cleanly.
- 16 MiB Frame Guard: Enforces frame size upper bounds to prevent memory exhaustion.
- Request Correlation: Thread-safe correlation of requests to responses via unique IDs.
- Typed Error Hierarchy: Clear exception mapping for gateway errors, connection errors, protocol errors, and timeouts.
- Zero External Dependencies: Implemented entirely with Python standard library.
Usage
from castor_client import AgentRequest, AgentSession
def admit_turn(admission_payload: dict[str, object]) -> dict[str, object]:
agent = AgentSession("/run/castor/ipc.sock")
return agent.send(AgentRequest("AdmitTurn", admission_payload)).outcome
admission_payload must contain the current Turn, lease, projection digest, and capability reference supplied by the host. See the physical tests/dogfood/ring3_agent.py journey for the bounded D1 request sequence. The Agent session accepts only Agent-channel operations. Host operators use OperatorSession with a separate control.sock; neither client class can grant authority by itself. Each request opens a fresh connection with a five-second socket idle timeout, not a total request deadline, and never retries an uncertain action automatically.
AisaClient remains available for protocol-level integrations. It does not make the old in-process Python Castor() facade equivalent to Rust castord.
Operation-specific request objects are available for all current Agent and operator D1 opcodes. For example, AgentSession.send(AdmitTurn(...)) sends a payload with named fields and returns an AisaResponse[AdmitTurnOutcome] for static type checkers. RequestInteraction omits its optional descriptor when absent, as required by the Rust parser. The original AgentRequest and OperatorRequest envelopes and low-level request(op, payload) remain available for protocol-level callers. Outcome types describe the Rust wire shapes; callers still inspect outcome["type"] to distinguish admission from a governed rejection. Only castord validates authority and D1 preconditions.
Release files for castor-client 0.7.0a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| castor_client-0.7.0a1.tar.gz | 11.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| castor_client-0.7.0a1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.8 kB
Release files / castor_client-0.7.0a1.tar.gz
| Download URL | castor_client-0.7.0a1.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ecbd5e07a6c5ac3bb3b98d5fbd5766b38ed5b912c806fb8bfd84ffbc68735619
|
|
BLAKE2b-256 checksum How to use checksums |
fe21e55793bde78205eb58ca46e8ca6d9b7ce9d404cdc3ef35fd4c64b646c22c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / castor_client-0.7.0a1-py3-none-any.whl
| Download URL | castor_client-0.7.0a1-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b33fa69b55106f149f3bd4bddce62f46633bb9edfaa54563c2807c628d19111f
|
|
BLAKE2b-256 checksum How to use checksums |
992aaff182842758385ecc32cf9320a2f4e13564e7df40ca68a4c229e6c88369
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency log