mac-compute-space / README.md
josephrw's picture
Upload folder using huggingface_hub
c4916b2 verified
|
Raw
History Blame Contribute Delete
4.9 kB
---
title: GBridge PhoneGPU
emoji: πŸ“±
colorFrom: indigo
colorTo: blue
sdk: docker
app_port: 7860
pinned: false
license: mit
---
# GBridge PhoneGPU
**The Hugging Face Space that turns an iPhone into a private ML server and turns Windsurf into the build agent for the bridge itself.**
The Space is the public endpoint. The iPhone is the private model worker. Windsurf is the engineering agent. gbridge is the connective tissue. Every job produces a signed receipt.
## What this is
GBridge is a **capability-to-endpoint connectivity layer**.
A live node (iPhone, browser, Windsurf agent) advertises a capability, leases it to the Space, and the Space binds it to an HTTP/WebSocket endpoint. Jobs route to the node. Results return with signed receipts.
## Pages
- `/` β€” Landing / Manifest
- `/phone` β€” iPhone compute bridge with QR pairing
- `/gbridge` β€” Protocol explorer with capability lease table
- `/windsurf` β€” Build packet generator and MCP manifest export
- `/receipts` β€” Proof console for signed compute receipts
- `/dashboard` β€” 2050 real-time control plane
## Core API
- `POST /api/gbridge/session` β€” create compute session
- `GET /api/gbridge/session/{id}` β€” session status
- `POST /cap/{capability_name}` β€” invoke leased capability
- `GET /api/windsurf/packet` β€” Windsurf build packet
- `GET /api/windsurf/mcp` β€” MCP server manifest
- `POST /api/windsurf/ingest` β€” ingest agent build report
- `GET /api/receipts` β€” list receipts
- `POST /api/receipts/{id}/verify` β€” verify receipt
## gbridge primitive
```python
route_capability_call(capability_name, payload)
```
1. Find active lease for capability
2. Verify lease is not expired
3. Check payload policy
4. Create job
5. Route to correct node
6. Return async job id
7. Verify receipt
8. Return output + receipt
## Architecture
```
Hugging Face Space
β”œβ”€β”€ gbridge router
β”œβ”€β”€ phone relay (WebSocket)
β”œβ”€β”€ receipt verifier
β”œβ”€β”€ Windsurf packet generator
└── MCP manifest exporter
iPhone Worker (PWA)
β”œβ”€β”€ local runtime detector
β”œβ”€β”€ local ML / redaction / embeddings
β”œβ”€β”€ device keypair
└── signed receipt emitter
Windsurf / Cascade
β”œβ”€β”€ consumes generated build packet
β”œβ”€β”€ optionally connects through MCP/gbridge manifest
β”œβ”€β”€ patches repo
└── sends build report back as receipt
```
## What this is
PhoneGPU Space creates a new topology:
- **Public Space** = control plane, API, marketplace, verifier, dashboard
- **iPhone** = private edge inference node (Neural Engine / GPU / CPU)
- **Receipt** = proof of local execution
This is not cloud inference from a phone. This is **device-leased inference**: a public Hugging Face Space temporarily binds a private iPhone as its backend ML worker through a revocable, receipt-producing compute session.
## How it works
1. Open the Space and create a session
2. Scan the QR code with your iPhone
3. The iPhone registers as a worker and advertises its capabilities
4. Submit an inference job through the Space UI or API
5. The iPhone receives the job, runs it locally with Core ML / Web ML
6. The iPhone returns the result plus a signed receipt
7. The Space verifies and stores the receipt
## Environment Variables
| Variable | Description | Default |
|----------|-------------|---------|
| `SPACE_PUBLIC_URL` | Public URL of this Space | Auto-detected |
| `SESSION_TTL_SECONDS` | Session lifetime | 3600 |
| `JOB_TTL_SECONDS` | Job timeout | 300 |
| `MAX_PAYLOAD_BYTES` | Max request payload | 10485760 |
| `REQUIRE_DEVICE_SIGNATURES` | Require signed receipts | false |
| `RECEIPT_STORAGE_PATH` | Where to store receipts | ./data/receipts.jsonl |
## API Endpoints
- `POST /api/session` β€” Create a new compute session
- `GET /api/session/{id}` β€” Get session status
- `POST /api/session/{id}/job` β€” Submit inference job
- `GET /api/job/{id}` β€” Get job result
- `GET /api/receipt/{id}` β€” Get signed receipt
- `POST /api/receipt/{id}/verify` β€” Verify receipt
- `GET /worker` β€” iPhone worker page (with QR scan)
- `WS /ws/worker/{session_id}/{worker_id}` β€” Worker WebSocket
## Capabilities (v1)
- `iphone.text.embedding.private` β€” Local text embedding
- `iphone.image.classify.local` β€” Local image classification
- `iphone.privacy.redact.local` β€” Local privacy redaction
## Architecture
```
User β†’ HF Space UI/API β†’ Session β†’ Job Queue β†’ iPhone Worker β†’ Core ML/ONNX/WebML β†’ Signed Result β†’ Receipt
```
## Security
- Outbound-only connections from iPhone (no inbound ports needed)
- Worker join tokens with expiry
- Ed25519 receipt signatures where supported
- Input/output hashing for verification
- Privacy modes: raw, hash-only, local-only
## Development
```bash
pip install -r requirements.txt
python -m uvicorn app.main:app --host 0.0.0.0 --port 7860
```
## License
Proprietary β€” Membra Technologies