Compare commits

..

13 Commits

Author SHA1 Message Date
giles
4bb084154a Add deterministic debug logging to fused pipeline 2026-02-04 12:17:12 +00:00
giles
656738782f Fix database connection pool leak in init_db()
- Check if pool already exists before creating a new one
- Set pool size limits (min=2, max=10) to prevent exhaustion
- Multiple calls to init_db() were creating new pools without
  closing old ones, leading to "too many clients" errors

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 23:00:13 +00:00
giles
0242c0bb22 Add stream command for streaming recipes
- artdag stream <recipe.sexp> runs streaming recipes
- Supports --duration, --fps, --sources, --audio options
- --wait flag polls for completion

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 19:18:57 +00:00
gilesb
3d663950f1 Add plan_cid to run status, change Output Hash to Output
- Display plan CID in run status when available
- Simplified "Output Hash:" label to "Output:"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 18:43:47 +00:00
gilesb
eb0a38b087 Fix --raw to output raw content to stdout
--raw without -o now streams raw content to stdout instead of showing metadata

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 17:59:59 +00:00
gilesb
1a768370f6 Update README with --raw flag for view command
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 17:53:42 +00:00
gilesb
d69ed09575 Remember server settings between sessions
- Server URLs are now saved to ~/.artdag/config.json when provided
- Subsequent commands use saved settings without needing --server/--l2
- Priority: CLI args > env vars > saved config > defaults
- Added 'artdag config' command to view/clear settings

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 17:28:40 +00:00
gilesb
599f181f8c Remove all ellipsis truncation from CLI output
- Show full CIDs/hashes in runs list, cache list, effects list
- Show full output CIDs in plan steps and artifacts
- Show full CIDs in recipe fixed_inputs
- Use block format for better readability with long IDs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 17:11:50 +00:00
gilesb
efca939c7d Add --raw flag to view command and improve metadata display
- Add --raw/-r flag to fetch from /cache/{cid}/raw endpoint
- Automatically use /raw when outputting to file or stdout
- Show friendly_name, title, filename in metadata view
- Use JSON API for metadata instead of streaming response

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 17:00:53 +00:00
gilesb
b56f4d906c Fix recipe list display and handle missing uploaded_at
- Show full Recipe ID instead of truncated
- Display friendly name with version hash when available
- Make uploaded_at optional to avoid KeyError
- Improve recipe list format with one recipe per block

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 16:57:34 +00:00
gilesb
9e13a4ce3d Fix JSON decode error by adding Accept header to all API requests
The CLI was getting empty responses from the server because it wasn't
sending Accept: application/json header. The server uses content
negotiation and returns HTML for browser requests.

Changes:
- Updated get_auth_header() to always include Accept: application/json
- Simplified all commands to use get_auth_header(require_token=True)
- Removed redundant token_data checks now handled by get_auth_header

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 14:46:55 +00:00
gilesb
84acfc45cf Add CLI feature parity with L1 web UI
New commands:
- stats: Show user counts (runs, recipes, effects, media, storage)
- effect <cid>: Show effect details with --source option
- storage list/add/test/delete: Manage IPFS storage providers
- clear-data: Clear all user L1 data (preserves storage config)

Enhanced commands:
- runs/recipes/effects/cache: Add --offset pagination
- cache: Add --type filter (all/image/video/audio)
- status: Add --plan, --artifacts, --analysis flags for detailed views

Other changes:
- All list commands now require auth and use server-side pagination
- Updated README with comprehensive CLI documentation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 14:35:12 +00:00
gilesb
dce277f1da Show detailed error message on upload failure
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 08:30:11 +00:00
5 changed files with 1180 additions and 246 deletions

1
.gitignore vendored
View File

@@ -2,3 +2,4 @@ __pycache__/
*.py[cod] *.py[cod]
.venv/ .venv/
venv/ venv/
.scripts

366
README.md
View File

@@ -8,170 +8,256 @@ CLI for interacting with the Art DAG L1 rendering server.
pip install -r requirements.txt pip install -r requirements.txt
``` ```
## Usage ## Configuration
```bash ```bash
# Set server URL (default: http://localhost:8100) # Set L1 server URL (default: http://localhost:8100)
export ARTDAG_SERVER=http://localhost:8100 export ARTDAG_SERVER=http://localhost:8100
# Or pass with every command # Set L2 server URL for auth (default: http://localhost:8200)
./artdag.py --server http://localhost:8100 <command> export ARTDAG_L2=https://artdag.rose-ash.com
# Or pass with commands
./artdag.py --server http://localhost:8100 --l2 https://artdag.rose-ash.com <command>
``` ```
## Authentication ## Authentication
The client authenticates against an L2 server for commands that require login (e.g., `run`, `publish`). Most commands require authentication. Login credentials are stored locally in `~/.artdag/token.json`.
```bash ```bash
# Set L2 server URL (default: http://localhost:8200) # Register a new account
export ARTDAG_L2=https://artdag.rose-ash.com artdag register <username> [--email user@example.com]
# Or pass with every command # Login
./artdag.py --l2 https://artdag.rose-ash.com <command> artdag login <username>
# Check current user
artdag whoami
# Logout
artdag logout
``` ```
### Login ## Commands Reference
```bash
./artdag.py login <username>
# You'll be prompted for your password
# Or specify password with -p flag (will prompt) ### Server & Stats
./artdag.py login <username> -p
```
### Register
```bash
./artdag.py register <username>
# You'll be prompted to enter and confirm your password
# Optionally include email
./artdag.py register <username> --email user@example.com
```
### Check Current User
```bash
./artdag.py whoami
```
### Logout
```bash
./artdag.py logout
```
## Commands
### Server Info
```bash
./artdag.py info
```
### List Known Assets
```bash
./artdag.py assets
```
### Start a Rendering Run
```bash
# Using asset name
./artdag.py run dog cat
# Using CID
./artdag.py run dog Qm33268b6e167deaf018cc538de12dbe562612b33e
# Wait for completion
./artdag.py run dog cat --wait
# Custom output name
./artdag.py run dog cat --name my-dog-video
```
### List Runs
```bash
./artdag.py runs
./artdag.py runs --limit 20
```
### Check Run Status
```bash
./artdag.py status <run-id>
```
### Delete a Run
```bash
./artdag.py delete-run <run-id>
# Skip confirmation
./artdag.py delete-run <run-id> -f
```
### List Cached Content
```bash
./artdag.py cache
```
### View/Download Cached Content
```bash
# Show info
./artdag.py view <cid>
# Download to file
./artdag.py view <cid> -o output.mkv
# Pipe to mpv (use -o - for stdout)
./artdag.py view <cid> -o - | mpv -
```
### Import Local File to Cache
```bash
./artdag.py import /path/to/file.jpg
```
### Delete Cached Content
```bash
./artdag.py delete-cache <cid>
# Skip confirmation
./artdag.py delete-cache <cid> -f
```
Note: Items that are inputs/outputs of runs, or published to L2, cannot be deleted.
### Config Commands
Configs are reusable DAG definitions with fixed and variable inputs.
```bash ```bash
# Upload a config YAML file # Show server info
./artdag.py upload-config recipe.yaml artdag info
# List configs # Show user stats (counts of runs, recipes, effects, media, storage)
./artdag.py configs artdag stats
# View config details # List known named assets
./artdag.py config <config-id> artdag assets
# Run a config with variable inputs
./artdag.py run-config <config-id> -i node_id:cid --wait
# Delete a config
./artdag.py delete-config <config-id>
``` ```
## Example Workflow ### Runs
```bash ```bash
# Check server # List runs (with pagination)
./artdag.py info artdag runs [--limit N] [--offset N]
# See available assets # Start a run
./artdag.py assets artdag run <recipe> <input_cid> [--name output_name] [--wait]
# Run dog effect on cat, wait for result # Get run status
./artdag.py run dog cat --wait artdag status <run_id>
# List completed runs # Get detailed run info
./artdag.py runs artdag status <run_id> --plan # Show execution plan with steps
artdag status <run_id> --artifacts # Show output artifacts
artdag status <run_id> --analysis # Show audio analysis data
# Download the output # Delete a run
./artdag.py view <output-cid> -o result.mkv artdag delete-run <run_id> [--force]
```
### Recipes
```bash
# List recipes (with pagination)
artdag recipes [--limit N] [--offset N]
# Show recipe details
artdag recipe <recipe_id>
# Upload a recipe (YAML or S-expression)
artdag upload-recipe <filepath>
# Run a recipe with inputs
artdag run-recipe <recipe_id> -i node_id:cid [--wait]
# Delete a recipe
artdag delete-recipe <recipe_id> [--force]
```
### Effects
```bash
# List effects (with pagination)
artdag effects [--limit N] [--offset N]
# Show effect details
artdag effect <cid>
# Show effect with source code
artdag effect <cid> --source
# Upload an effect (.py file)
artdag upload-effect <filepath>
```
### Media / Cache
```bash
# List cached content (with pagination and type filter)
artdag cache [--limit N] [--offset N] [--type all|image|video|audio]
# View/download cached content
artdag view <cid> # Show metadata (size, type, friendly name)
artdag view <cid> --raw # Get raw content info
artdag view <cid> -o output.mp4 # Download raw file
artdag view <cid> -o - | mpv - # Pipe raw content to player
# Upload file to cache and IPFS
artdag upload <filepath>
# Import local file to cache (local server only)
artdag import <filepath>
# View/update metadata
artdag meta <cid> # View metadata
artdag meta <cid> -d "Description" # Set description
artdag meta <cid> -t "tag1,tag2" # Set tags
artdag meta <cid> --publish "my-video" # Publish to L2
# Delete cached content
artdag delete-cache <cid> [--force]
```
### Storage Providers
```bash
# List storage providers
artdag storage list
# Add a provider (interactive)
artdag storage add <type> [--name friendly_name] [--capacity GB]
# Types: pinata, web3storage, nftstorage, infura, filebase, storj, local
# Test provider connectivity
artdag storage test <id>
# Delete a provider
artdag storage delete <id> [--force]
```
### Folders & Collections
```bash
# Folders
artdag folder list
artdag folder create <path>
artdag folder delete <path>
# Collections
artdag collection list
artdag collection create <name>
artdag collection delete <name>
```
### v2 API (3-Phase Execution)
```bash
# Generate execution plan
artdag plan <recipe_file> -i name:cid [--features beats,energy] [--output plan.json]
# Execute a plan
artdag execute-plan <plan_file> [--wait]
# Run recipe (plan + execute in one step)
artdag run-v2 <recipe_file> -i name:cid [--wait]
# Check v2 run status
artdag run-status <run_id>
```
### Publishing to L2
```bash
# Publish a run output to L2
artdag publish <run_id> <output_name>
```
### Data Management
```bash
# Clear all user data (preserves storage configs)
artdag clear-data [--force]
```
## Example Workflows
### Basic Rendering
```bash
# Login
artdag login myuser
# Check available assets
artdag assets
# Run an effect on an input
artdag run dog cat --wait
# View runs
artdag runs
# Download result
artdag view <output_cid> -o result.mp4
```
### Recipe-Based Processing
```bash
# Upload a recipe
artdag upload-recipe my-recipe.yaml
# View recipes
artdag recipes
# Run with inputs
artdag run-recipe <recipe_id> -i video:bafkrei... --wait
# View run plan
artdag status <run_id> --plan
```
### Managing Storage
```bash
# Add Pinata storage
artdag storage add pinata --name "My Pinata"
# Test connection
artdag storage test 1
# View all providers
artdag storage list
```
### Browsing Media
```bash
# List all media
artdag cache
# Filter by type
artdag cache --type video --limit 20
# View with pagination
artdag cache --offset 20 --limit 20
``` ```

995
artdag.py

File diff suppressed because it is too large Load Diff

38
test_gpu_effects.sexp Normal file
View File

@@ -0,0 +1,38 @@
;; GPU Effects Performance Test
;; Tests rotation, zoom, hue-shift, ripple
(stream "gpu_effects_test"
:fps 30
:width 1920
:height 1080
:seed 42
;; Load primitives
(require-primitives "geometry")
(require-primitives "core")
(require-primitives "math")
(require-primitives "image")
(require-primitives "color_ops")
;; Frame pipeline - test GPU effects
(frame
(let [;; Create a base gradient image
r (+ 0.5 (* 0.5 (math:sin (* t 1))))
g (+ 0.5 (* 0.5 (math:sin (* t 1.3))))
b (+ 0.5 (* 0.5 (math:sin (* t 1.7))))
color [(* r 255) (* g 255) (* b 255)]
base (image:make-image 1920 1080 color)
;; Apply rotation (this is the main GPU bottleneck we optimized)
angle (* t 30)
rotated (geometry:rotate base angle)
;; Apply hue shift
hue-shift (* 180 (math:sin (* t 0.5)))
hued (color_ops:hue-shift rotated hue-shift)
;; Apply brightness based on time
brightness (+ 0.8 (* 0.4 (math:sin (* t 2))))
bright (color_ops:brightness hued brightness)]
bright)))

26
test_simple.sexp Normal file
View File

@@ -0,0 +1,26 @@
;; Simple Test - No external assets required
;; Just generates a color gradient that changes over time
(stream "simple_test"
:fps 30
:width 720
:height 720
:seed 42
;; Load standard primitives
(require-primitives "geometry")
(require-primitives "core")
(require-primitives "math")
(require-primitives "image")
(require-primitives "color_ops")
;; Frame pipeline - animated gradient
(frame
(let [;; Time-based color cycling (0-1 range)
r (+ 0.5 (* 0.5 (math:sin (* t 1))))
g (+ 0.5 (* 0.5 (math:sin (* t 1.3))))
b (+ 0.5 (* 0.5 (math:sin (* t 1.7))))
;; Convert to 0-255 range and create solid color frame
color [(* r 255) (* g 255) (* b 255)]
frame (image:make-image 720 720 color)]
frame)))