Skip to content

Apha205/haven-cli

Β 
Β 

Repository files navigation

Haven CLI

Decentralized video archival with AI-powered analysis and blockchain verification.

Features

  • πŸ“Ή Video Archival: Archive videos from YouTube, local files, and more
  • πŸ” Encryption: Lit Protocol access-controlled encryption
  • πŸ—„οΈ Decentralized Storage: Filecoin/IPFS via Synapse
  • πŸ€– AI Analysis: VLM-powered timestamp and tag generation
  • ⛓️ Blockchain Sync: Arkiv on-chain metadata records
  • πŸ”Œ Plugin System: Extensible archiver plugins
  • ⏰ Scheduling: Cron-based automated archival

Quick Start

Installation

pip install haven-cli

Configuration

haven config init

Upload a Video

haven upload video.mp4

Start Daemon

haven run

Launch TUI (Optional)

# Start the Terminal User Interface for real-time monitoring
haven-tui

Data Format Standardization

haven-cli now uses the Haven Cross-Application Data Format, ensuring full compatibility with:

  • haven-player (Gold Standard)
  • haven-dapp

Key Field Names

When working with Arkiv entities created by haven-cli:

Payload Fields (Private):

  • filecoin_root_cid - The Filecoin CID for video content
  • is_encrypted - Boolean indicating encryption status
  • cid_hash - SHA256 hash of the CID
  • vlm_json_cid - CID of VLM analysis JSON
  • lit_encryption_metadata - JSON string of Lit encryption metadata
  • segment_metadata - Multi-segment recording info

Attributes Fields (Public):

  • title - Video title
  • is_encrypted - Integer 0 or 1
  • cid_hash - SHA256 hash of CID
  • created_at - ISO8601 timestamp
  • updated_at - ISO8601 timestamp
  • creator_handle - Content creator
  • mint_id - NFT mint identifier
  • analysis_model - VLM model used

For detailed format documentation, see Arkiv Data Format and Migration Notes.

Documentation

Haven CLI

Haven TUI

Requirements

  • Python 3.11+
  • FFmpeg (for video processing)
  • Deno 1.40+ (for JS runtime)
  • yt-dlp (for YouTube plugin)

Installation

From PyPI

pip install haven-cli

From Source

git clone https://github.com/haven/haven-cli
cd haven-cli
pip install -e .

Development Installation

git clone https://github.com/haven/haven-cli
cd haven-cli
pip install -e ".[dev]"

Quick Command Reference

Command Description
haven config init Initialize configuration
haven config show Show current configuration
haven upload <file> Upload a video file
haven download <cid> Download a file by CID
haven jobs list List scheduled jobs
haven jobs create --plugin <name> --schedule <cron> Create a scheduled job
haven plugins list List available plugins
haven plugins enable <name> Enable a plugin
haven plugins test <name> Test a plugin
haven run Start the daemon
haven run status Check daemon status
haven run stop Stop the daemon

Pipeline Overview

The Haven pipeline processes videos through these steps:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”
β”‚ Ingest  │──▢│ Analyze │──▢│ Encrypt │──▢│ Upload │──▢│ Sync β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”˜
  1. Ingest: Extract metadata, calculate pHash, check duplicates
  2. Analyze: Run VLM to generate timestamps and tags (optional)
  3. Encrypt: Encrypt with Lit Protocol (optional)
  4. Upload: Store on Filecoin via Synapse (optional)
  5. Sync: Record metadata on Arkiv blockchain (optional)

Configuration

Configuration is stored in ~/.config/haven/config.toml:

[pipeline]
vlm_enabled = true
encryption_enabled = true
upload_enabled = true
sync_enabled = true

[scheduler]
enabled = true

[js_runtime]
runtime = "deno"

See Configuration Reference for all options.

Environment Variables

All configuration can be overridden via environment variables:

export HAVEN_VLM_ENABLED=true
export HAVEN_SYNAPSE_API_KEY=your-key
export HAVEN_LOG_LEVEL=DEBUG

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Type checking
mypy haven_cli

# Linting
ruff check haven_cli

# Format code
ruff format haven_cli

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        HAVEN CLI                             β”‚
β”‚                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚   Upload    β”‚  β”‚  Download   β”‚  β”‚   Job Scheduler     β”‚  β”‚
β”‚  β”‚   Command   β”‚  β”‚   Command   β”‚  β”‚   (Cron-based)      β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚         β”‚                β”‚                    β”‚             β”‚
β”‚         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β”‚
β”‚                              β”‚                              β”‚
β”‚                              β–Ό                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚                   Pipeline Engine                    β”‚   β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚   β”‚
β”‚  β”‚  β”‚ Ingest  β”‚β†’β”‚ Analyze β”‚β†’β”‚ Encrypt β”‚β†’β”‚ Upload β”‚  β”‚   β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                              β”‚                              β”‚
β”‚         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”‚
β”‚         β–Ό                    β–Ό                    β–Ό         β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚   Plugin    β”‚      β”‚   Lit/      β”‚      β”‚  Synapse/   β”‚  β”‚
β”‚  β”‚   System    β”‚      β”‚   Arkiv     β”‚      β”‚  Filecoin   β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

License

MIT

Contributing

Contributions are welcome! Please see our Contributing Guide for details.

Support

Useful links

About

Reclaiming the Internet for the User.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 88.6%
  • TypeScript 10.4%
  • Other 1.0%