Metadata-Version: 2.4
Name: graft-core
Version: 0.2.0
Summary: Rust hot-path kernel for Graft Robotics (continuous Kay-Kajiya swept-path slab checks, Envelope 0.2 geometry, and LiDAR voxel-to-OBJ meshing)
Author-email: Craig Merry <craigm26@gmail.com>
License: Apache-2.0
Requires-Python: >=3.11
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://graftrobotics.ai
Project-URL: Documentation, https://graftrobotics.ai/docs/
Project-URL: Repository, https://github.com/craigm26/graft-robotics

# `graft-core` — Graft Robotics Rust Spatial & Watchdog Kernel

GIL-free Rust hot-path spatial kernel (`PyO3`) and monotonic heartbeat watchdog (`graft-watchdog`) for [`robot-gate`](https://pypi.org/project/robot-gate/) and [Graft Robotics](https://graftrobotics.ai).

- **Exact Continuous Swept-Path Kernel (`check_swept_path`):** Continuous Kay-Kajiya ray-vs-AABB slab intersection (`1.96 µs/check` on Raspberry Pi 5 ARM64) with strict fail-closed IEEE-754 `NaN`/`Inf` and inverted-box guards.
- **LAN 3D LiDAR Voxel Mesher (`build_voxel_mesh_obj`):** 10,000-point cloud → manifold `.obj` obstacle mesh at `316 Hz` (`3.16 ms p50` on Pi 5).
- **Record verifier (`verify_json`, new in 0.2.0):** the [graft-verify](https://github.com/craigm26/graft-robotics/tree/main/graft-verify) checks for cell passports, the public log and RCAN §8.6 signer key files. `robot-gate` uses it as a second, independent check of each passport's hash and signature.
- **Monotonic Heartbeat Watchdog (`graft-watchdog`):** Static GIL-free Rust supervisor (`std::time::Instant`, `0.22 ms p50` `/stop` under load, bounded connection pool).

## Install (PyPI)

```bash
uv pip install graft-core
# or: pip install graft-core
```

```python
import graft_core

# waypoints, workspace min, workspace max, keep-out boxes (name, min, max)
allowed, margin_m, violator, samples = graft_core.check_swept_path(
    [[0.0, 0.0, 0.2], [0.4, 0.1, 0.3]],
    [-0.75, -0.65, 0.05], [0.75, 0.65, 0.95],
    [("fixture", [0.2, 0.2, 0.0], [0.3, 0.3, 0.4])],
)

# Check a cell passport against its signer's public key (op 1).
import json
result = json.loads(graft_core.verify_json(1, json.dumps({"passport": passport, "jwk": jwk})))
```

> **ISO 13850 Safety Boundary:** `graft-core`, `graft-watchdog`, and `robot-gate` are strictly a deterministic, default-deny software pre-flight boundary and cryptographic audit layer claiming **zero ISO 13849-1 PL/SIL risk-reduction credit**. They are **NOT** a safety-rated ISO 13850 hardware emergency stop and must always be paired alongside certified hardwired E-stops and safety relays.

