Metadata-Version: 2.4
Name: styrened
Version: 0.16.0
Summary: Unified Styrene library and headless daemon for RNS/LXMF mesh networking
Project-URL: Homepage, https://github.com/styrene-lab/styrened
Project-URL: Repository, https://github.com/styrene-lab/styrened
Project-URL: Documentation, https://docs.styrene.io/styrened/api/
Author: Vanderlyn Labs
License: MIT
License-File: LICENSE
Keywords: daemon,edge,lxmf,mesh,reticulum,rpc
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: No Input/Output (Daemon)
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Communications
Classifier: Topic :: System :: Systems Administration
Requires-Python: >=3.11
Requires-Dist: cryptography>=41.0
Requires-Dist: lxmf>=0.8.0
Requires-Dist: msgpack>=1.0
Requires-Dist: packaging>=21.0
Requires-Dist: platformdirs>=4.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: rns>=1.0.0
Requires-Dist: sqlalchemy>=2.0
Provides-Extra: dev
Requires-Dist: mypy>=1.8; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest-cov>=4.1; extra == 'dev'
Requires-Dist: pytest-forked>=1.6; extra == 'dev'
Requires-Dist: pytest-textual-snapshot>=1.0; extra == 'dev'
Requires-Dist: pytest-xdist>=3.5; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.4.0; extra == 'dev'
Requires-Dist: textual-dev>=1.0; extra == 'dev'
Requires-Dist: types-pyyaml>=6.0; extra == 'dev'
Provides-Extra: docs
Requires-Dist: pdoc>=14.0; extra == 'docs'
Provides-Extra: metrics
Requires-Dist: prometheus-client>=0.19; extra == 'metrics'
Provides-Extra: pqc
Requires-Dist: liboqs-python>=0.10.0; extra == 'pqc'
Provides-Extra: tui
Requires-Dist: pillow>=10.0; extra == 'tui'
Requires-Dist: psutil>=5.9; extra == 'tui'
Requires-Dist: pyte>=0.8; extra == 'tui'
Requires-Dist: rumps>=0.4.0; (sys_platform == 'darwin') and extra == 'tui'
Requires-Dist: textual-image>=0.8.0; extra == 'tui'
Requires-Dist: textual>=0.47.0; extra == 'tui'
Provides-Extra: web
Requires-Dist: fastapi>=0.109; extra == 'web'
Requires-Dist: uvicorn[standard]>=0.27; extra == 'web'
Provides-Extra: yubikey
Requires-Dist: python-fido2>=1.0; extra == 'yubikey'
Description-Content-Type: text/markdown

# styrened

Daemon, library, and TUI for [Reticulum](https://reticulum.network) mesh networks.

## Overview

`styrened` is the core of the [Styrene](https://github.com/styrene-lab) mesh networking stack. It provides a headless daemon for edge devices, a terminal UI for interactive fleet management, and a Python library for building mesh applications on RNS/LXMF.

**Key Features**:
- **Mesh daemon** — headless operation on edge devices (Raspberry Pi, NixOS, containers)
- **Terminal UI** — full-featured TUI for fleet management, chat, device provisioning
- **RPC over LXMF** — remote device management (status, exec, reboot, config)
- **Device discovery** — automatic mesh topology tracking
- **Auto-reply** — automated message responses with cooldown
- **Direct links** — point-to-point RNS links for status queries and speedtests
- **Mesh VPN** — WireGuard tunnels bootstrapped over LXMF (IPv6 ULA addressing)
- **HTTP API** (optional) — REST/WebSocket endpoints for external integration
- **Nix flake** — declarative NixOS deployment with OCI container builds

## Installation

```bash
# Full stack: daemon + TUI (via meta-package)
pip install styrene

# Daemon only (minimal dependencies)
pip install styrened

# Daemon + TUI
pip install styrened[tui]

# All extras
pip install styrened[tui,web,metrics,yubikey]
```

### Nix Flake

```bash
nix run github:styrene-lab/styrened
```

### Container

```bash
docker pull ghcr.io/styrene-lab/styrened:latest
```

## Usage

```bash
# Run daemon
styrened daemon

# Run TUI
styrene

# CLI tools
styrened devices              # List discovered mesh devices
styrened devices -w 10        # Wait 10s for announces
styrened status               # Local daemon health
styrened status <dest>        # Query remote node
styrened send <dest> "hello"  # Send message
styrened exec <dest> uptime   # Remote command execution
styrened doctor               # Installation diagnostics
styrened doctor --setup       # Interactive setup wizard
styrened identity             # Show local identity
```

## Architecture

```
┌──────────────────────────────────────┐
│  styrened                            │
│  ├── tui/          Terminal UI       │  pip install styrened[tui]
│  ├── services/     Business logic    │
│  ├── protocols/    LXMF routing      │
│  ├── rpc/          Remote mgmt       │
│  ├── models/       Data models       │
│  └── web/          HTTP API          │  pip install styrened[web]
├──────────────────────────────────────┤
│  RNS + LXMF (Reticulum Stack)       │
└──────────────────────────────────────┘
```

**Async-first** — all network operations use asyncio. The daemon runs an event loop with periodic tasks for announces, discovery, and mesh maintenance.

**Protocol discrimination** — LXMF messages are routed to handlers based on `fields["protocol"]`, supporting chat (NomadNet/MeshChat), Styrene wire protocol, and VPN handshake messages.

## Configuration

Config file: `~/.styrene/config.yaml`

```yaml
identity:
  display_name: "My Node"

reticulum:
  mode: standalone
  interfaces:
    peers:
      - host: rns.styrene.io
        port: 4242

rpc:
  enabled: true

chat:
  auto_reply_mode: template
  auto_reply_message: "Automated node"

mesh_vpn:
  enabled: false
  gateway: false
```

## Installation Extras

| Extra | Adds |
|-------|------|
| `[tui]` | Terminal UI (textual, psutil) |
| `[web]` | HTTP API (fastapi, uvicorn) |
| `[metrics]` | Prometheus metrics |
| `[yubikey]` | YubiKey authentication |

## Development

```bash
git clone https://github.com/styrene-lab/styrened
cd styrened
pip install -e ".[tui,dev]"

just test-unit    # ~5s, 2200+ tests
just test         # Full suite
make lint         # ruff
make typecheck    # mypy
make validate     # lint + typecheck + test
```

## Related Projects

- **[styrene-rs](https://github.com/styrene-lab/styrene-rs)** — Rust RNS/LXMF implementation (interoperable wire protocol)
- **[styrene-pypi](https://github.com/styrene-lab/styrene-pypi)** — PyPI meta-package (`pip install styrene`)
- **[Reticulum](https://reticulum.network)** — The underlying mesh networking stack

## License

[MIT](LICENSE)
