Skip to content

Commit f2aff06

Browse files
committed
feat: Add examples for workflows, pipelines, and agents with YAML/JSON support
- Introduced `workflow.yaml` and `pipeline.yaml` examples demonstrating quick-start configurations for workflows and pipelines. - Added `agent.json` and `hackernews_agent.yaml` to showcase detailed agent setups with LLM-based prompt handling and HackerNews API integration. - Added documentation (`docs/logo_ascii.md`, `docs/persistence.md`) explaining logo rendering, persistence providers, and their configurations. - Expanded resource capabilities: increased memory limits (4GB) and adjusted network/security policies (connection rates, seccomp filters). - Updated dependencies: added `serde_yaml` for YAML parsing.
1 parent 78bca6f commit f2aff06

File tree

28 files changed

+2752
-199
lines changed

28 files changed

+2752
-199
lines changed

Cargo.lock

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ tracing = "0.1"
6060
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
6161
serde = { version = "1", features = ["derive"] }
6262
serde_json = "1"
63+
serde_yaml = "0.9"
6364
void-box-protocol = { path = "void-box-protocol" }
6465
libc = "0.2"
6566
nix = { version = "0.29", features = ["fs", "ioctl", "net", "socket", "event"] }

docs/event_model.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# VoidBox Event Model (Skill + Environment)
2+
3+
The event stream is designed so every action can be answered as:
4+
5+
- Which `run`?
6+
- Which `box` (if any)?
7+
- Which `skill`?
8+
- In which `environment`?
9+
- What happened (`event_type`)?
10+
11+
## Core Fields
12+
13+
All events include:
14+
15+
- `ts_ms`
16+
- `level`
17+
- `event_type`
18+
- `message`
19+
- `run_id`
20+
21+
Optional identity/correlation fields:
22+
23+
- `box_name`
24+
- `skill_id`
25+
- `skill_type`
26+
- `environment_id`
27+
- `mode` (`mock|local|auto`)
28+
- `stream` (`stdout|stderr`)
29+
- `seq`
30+
- `payload`
31+
32+
## Event Types
33+
34+
Lifecycle:
35+
36+
- `run.started`
37+
- `run.spec.loaded`
38+
- `run.finished`
39+
- `run.failed`
40+
- `run.cancelled`
41+
42+
Environment:
43+
44+
- `env.provisioned`
45+
46+
Box / workflow planning:
47+
48+
- `box.started`
49+
- `workflow.planned`
50+
51+
Skills:
52+
53+
- `skill.mounted`
54+
55+
Streams/logs:
56+
57+
- `log.chunk`
58+
- `log.closed`
59+
60+
## TUI Mapping
61+
62+
A Claude-like TUI should render this stream in a timeline:
63+
64+
- `skill.mounted` -> capability setup
65+
- `env.provisioned` -> sandbox context
66+
- `log.chunk` -> live execution detail
67+
- `run.finished|run.failed` -> terminal status
68+
69+
This keeps `voidbox = skill + environment` visible in every run.

docs/logo_ascii.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# TUI Logo from PNG (ASCII)
2+
3+
You can render the real Void-Box image in terminal TUI as ASCII art.
4+
5+
## 1) Convert image to ASCII
6+
7+
```bash
8+
scripts/logo_to_ascii.sh /path/to/void-box-logo.png assets/logo/void-box.txt 80
9+
```
10+
11+
The script tries:
12+
13+
- `chafa` (preferred)
14+
- `jp2a` (fallback)
15+
16+
## 2) Run TUI with logo
17+
18+
Default path (auto-loaded):
19+
20+
- `assets/logo/void-box.txt`
21+
22+
Run:
23+
24+
```bash
25+
cargo run --bin voidbox -- tui
26+
```
27+
28+
Or explicit path:
29+
30+
```bash
31+
cargo run --bin voidbox -- tui --logo-ascii assets/logo/void-box.txt
32+
```
33+
34+
Or env var:
35+
36+
```bash
37+
VOIDBOX_LOGO_ASCII_PATH=assets/logo/void-box.txt cargo run --bin voidbox -- tui
38+
```
39+
40+
## Notes
41+
42+
- `--logo-ascii` is supported by the TUI command (`voidbox tui`).
43+
- If no file exists, TUI falls back to `⬢ VOID-BOX`.

docs/persistence.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Persistence Providers
2+
3+
`void-box` now supports a persistence abstraction for daemon state and TUI conversation history.
4+
5+
## Provider Abstraction
6+
7+
Code: `src/persistence.rs`
8+
9+
Trait:
10+
11+
- `load_runs()`
12+
- `save_run()`
13+
- `append_session_message()`
14+
- `load_session_messages()`
15+
16+
Built-in providers:
17+
18+
- `disk` (default): persists to local files under:
19+
- `~/.local/state/void-box/runs/*.json`
20+
- `~/.local/state/void-box/sessions/*.jsonl`
21+
- `sqlite` (example adapter): currently delegates to disk provider and shows where a real SQLite backend plugs in.
22+
- `valkey` (example adapter): currently delegates to disk provider and shows where a real Valkey/Redis backend plugs in.
23+
24+
## Selecting a Provider
25+
26+
```bash
27+
# default
28+
VOIDBOX_PERSISTENCE_PROVIDER=disk
29+
30+
# example adapters
31+
VOIDBOX_PERSISTENCE_PROVIDER=sqlite
32+
VOIDBOX_PERSISTENCE_PROVIDER=valkey
33+
```
34+
35+
Optional state directory override:
36+
37+
```bash
38+
VOIDBOX_STATE_DIR=/tmp/void-box-state
39+
```
40+
41+
## Conversation Persistence
42+
43+
Daemon endpoints:
44+
45+
- `POST /v1/sessions/:id/messages`
46+
- `GET /v1/sessions/:id/messages`
47+
48+
The TUI writes user/assistant interactions to these endpoints and can show them with `/history`.

examples/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,38 @@ Interactive/demo style Claude-compatible session.
6565
cargo run --example claude_in_voidbox_example
6666
```
6767

68+
## hackernews
69+
70+
HackerNews research agent with a real procedural-knowledge skill (`hackernews-api.md`)
71+
that teaches the agent HOW to use the HN API via curl + jq.
72+
73+
Build a production initramfs (real `claude-code`):
74+
75+
```bash
76+
CLAUDE_CODE_BIN=/path/to/claude scripts/build_guest_image.sh
77+
```
78+
79+
Then set runtime image env:
80+
81+
```bash
82+
export VOID_BOX_KERNEL=/boot/vmlinuz-$(uname -r)
83+
export VOID_BOX_INITRAMFS=target/void-box-rootfs.cpio.gz
84+
```
85+
86+
Run the HackerNews agent spec (Claude default):
87+
88+
```bash
89+
cargo run --bin voidbox -- run --file examples/hackernews/hackernews_agent.yaml
90+
```
91+
92+
Run with Ollama (no spec edits needed):
93+
94+
```bash
95+
VOIDBOX_LLM_PROVIDER=ollama \
96+
VOIDBOX_LLM_MODEL=qwen2.5-coder:7b \
97+
cargo run --bin voidbox -- run --file examples/hackernews/hackernews_agent.yaml
98+
```
99+
68100
## playground_pipeline
69101

70102
Observability-first pipeline for Grafana LGTM with OTLP export.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
api_version: v1
2+
kind: agent
3+
name: hn_researcher
4+
5+
sandbox:
6+
mode: auto
7+
memory_mb: 1024
8+
vcpus: 1
9+
network: true
10+
11+
llm:
12+
provider: claude
13+
14+
agent:
15+
prompt: >
16+
Analyze the current HackerNews top stories and produce a tactical briefing
17+
for AI engineering teams. Group stories by theme, prioritize by engagement
18+
density (score/time, comments/time), and extract 3-5 actionable signals.
19+
Output a clean markdown report with sections: Top Signals, Emerging Themes,
20+
and Watchlist (next 24h). Include source links.
21+
skills:
22+
- "file:examples/hackernews/skills/hackernews-api.md"
23+
timeout_secs: 600

0 commit comments

Comments
 (0)