Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Cross-package release notes for relayburn. Package changelogs contain package-le

## [Unreleased]

- `relayburn-sdk` (Rust): default ledger home moves from `~/.relayburn` to `~/.agentworkforce/burn` so the Rust 2.0 port and the TS 1.x package can coexist on disk during the #249 cutover. `RELAYBURN_HOME` (and the per-DB path overrides) continue to override the path; TS 1.x users on `~/.relayburn` are unaffected. Rust-port testers with data under the old path can `mv ~/.relayburn ~/.agentworkforce/burn` to carry it over (formats are not compatible — Rust treats any non-2.0 layout as empty and requires a `burn ingest` re-population).
- `relayburn-cli` (Rust): wire opencode `HarnessAdapter` via `pending_stamp::adapter_static` factory; registered in `RUNTIME_ADAPTERS`. (#248 D7)
- `relayburn-cli` (Rust): wire `burn run <harness>` driver + claude adapter (eager unit-struct in `EAGER_ADAPTERS`); `afterExit` ingest folds into `[burn] claude ingest: ...` summary line. (#248 D5)
- `relayburn-cli` (Rust): wire `burn ingest` (no-flag scan, `--watch` poll loop, `--hook claude --quiet`) and `burn mcp-server` stdio subcommand exposing `burn__sessionCost`; closes #210. (#248 D8)
Expand Down
6 changes: 3 additions & 3 deletions crates/relayburn-cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub struct GlobalArgs {
pub json: bool,
/// Optional override for the relayburn home directory (the dir
/// containing `burn.sqlite` + `content.sqlite`). When `None`,
/// commands fall through to the SDK's env-var / `~/.relayburn`
/// commands fall through to the SDK's env-var / `~/.agentworkforce/burn`
/// resolution.
pub ledger_path: Option<PathBuf>,
/// Suppress ANSI color output. Honored by the table renderer and
Expand Down Expand Up @@ -64,7 +64,7 @@ pub struct Args {

/// Override the relayburn home directory (the dir containing
/// `burn.sqlite` + `content.sqlite`). Defaults to `$RELAYBURN_HOME`
/// or `~/.relayburn`.
/// or `~/.agentworkforce/burn`.
#[arg(long, global = true, value_name = "PATH")]
pub ledger_path: Option<PathBuf>,

Expand Down Expand Up @@ -111,7 +111,7 @@ pub enum Command {
/// session log on exit.
Run(RunArgs),

/// Inspect or rebuild derived state under `~/.relayburn`.
/// Inspect or rebuild derived state under `~/.agentworkforce/burn`.
State(StateArgs),

/// Scan harness session stores and append new turns to the ledger.
Expand Down
2 changes: 1 addition & 1 deletion crates/relayburn-cli/src/harnesses/codex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub fn config() -> PendingStampAdapter {
// Open a fresh ledger handle per tick. The TS sibling's
// `ingestCodexSessions` does the same via `withLock('ledger', …)`;
// SQLite WAL keeps the per-call open cheap (no DDL after first
// open). Defaults pull `$RELAYBURN_HOME` (or `~/.relayburn`)
// open). Defaults pull `$RELAYBURN_HOME` (or `~/.agentworkforce/burn`)
// and the same per-harness session-store root the factory's
// `session_root` closure resolves above.
let mut handle = Ledger::open(LedgerOpenOptions::default())?;
Expand Down
2 changes: 1 addition & 1 deletion crates/relayburn-cli/src/harnesses/opencode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub fn config() -> PendingStampAdapter {
// Open a fresh ledger handle per tick. The TS sibling's
// `ingestOpencodeSessions` does the same via `withLock('ledger', …)`;
// SQLite WAL keeps the per-call open cheap (no DDL after first
// open). Defaults pull `$RELAYBURN_HOME` (or `~/.relayburn`)
// open). Defaults pull `$RELAYBURN_HOME` (or `~/.agentworkforce/burn`)
// and the same per-harness session-store root the factory's
// `session_root` closure resolves above.
let mut handle = Ledger::open(LedgerOpenOptions::default())?;
Expand Down
2 changes: 1 addition & 1 deletion crates/relayburn-sdk-node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ unsafe fn promote_value(

/// Where on disk a ledger should land. Mirrors
/// `relayburn_sdk::LedgerOpenOptions`. `home` defaults to `RELAYBURN_HOME`
/// (or `~/.relayburn`); `contentHome` overrides only the `content.sqlite`
/// (or `~/.agentworkforce/burn`); `contentHome` overrides only the `content.sqlite`
/// path when it makes sense to park content on different storage.
#[napi(object)]
pub struct LedgerOpenOptions {
Expand Down
2 changes: 1 addition & 1 deletion crates/relayburn-sdk/src/analyze/ghost_surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ fn severity_from_usd(usd: f64) -> WasteSeverity {
}

fn default_archive_dir() -> PathBuf {
home_dir().join(".relayburn").join("ghost-archive")
crate::ledger::ledger_home().join("ghost-archive")
}

fn home_dir() -> PathBuf {
Expand Down
4 changes: 2 additions & 2 deletions crates/relayburn-sdk/src/ingest/orchestration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ fn open_ledger_in(tmp: &TempDir) -> Ledger {
}

/// Pin RELAYBURN_HOME under `tmp` so the pending-stamp + config layers
/// can't scribble on the developer's `~/.relayburn`. Caller holds the
/// returned mutex guard for the whole test body.
/// can't scribble on the developer's `~/.agentworkforce/burn`. Caller holds
/// the returned mutex guard for the whole test body.
fn isolated_relayburn_home<'a>(tmp: &TempDir) -> std::sync::MutexGuard<'a, ()> {
let guard = ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner());
let home = tmp.path().join("relayburn");
Expand Down
2 changes: 1 addition & 1 deletion crates/relayburn-sdk/src/ingest_verb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ mod tests {

// Point `RELAYBURN_HOME` at the temp dir so `cleanup_stale_pending_stamps`
// and `load_config` (called inside ingest_all) don't touch the real
// `~/.relayburn`. Set before any ledger-open call.
// `~/.agentworkforce/burn`. Set before any ledger-open call.
std::env::set_var("RELAYBURN_HOME", home.path());

let opts = IngestOptions {
Expand Down
2 changes: 1 addition & 1 deletion crates/relayburn-sdk/src/ledger/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ pub fn load_config_with_home(home: Option<&Path>) -> Result<BurnConfig> {
}

/// Load with an explicit config path. Tests use this to avoid touching
/// `$HOME/.relayburn/config.json`.
/// `$HOME/.agentworkforce/burn/config.json`.
pub fn load_config_at(path: &Path) -> Result<BurnConfig> {
let from_file = read_config_file(path);
let store = pick_store(
Expand Down
54 changes: 50 additions & 4 deletions crates/relayburn-sdk/src/ledger/paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@
//! content.sqlite # content blobs + FTS5 index
//! ```
//!
//! `$RELAYBURN_HOME` defaults to `~/.agentworkforce/burn` so the Rust 2.0
//! port and the TS 1.x package (still at `~/.relayburn`) can coexist on
//! disk during the #249 cutover.
//!
//! Both paths are overridable via env vars so they can live on different
//! mounts (e.g. cheaper/bigger storage for `content.sqlite`). See the
//! redesign issue for the rationale behind splitting them.

use std::env;
use std::path::PathBuf;

/// `$RELAYBURN_HOME`, defaulting to `~/.relayburn`. Reads the env var on
/// every call so test harnesses can flip it between cases without process
/// restart.
/// `$RELAYBURN_HOME`, defaulting to `~/.agentworkforce/burn`. Reads the
/// env var on every call so test harnesses can flip it between cases
/// without process restart.
pub fn ledger_home() -> PathBuf {
if let Ok(env) = env::var("RELAYBURN_HOME") {
if !env.is_empty() {
Expand All @@ -26,7 +30,8 @@ pub fn ledger_home() -> PathBuf {
}
let home = env::var("HOME").unwrap_or_else(|_| ".".to_string());
let mut p = PathBuf::from(home);
p.push(".relayburn");
p.push(".agentworkforce");
p.push("burn");
p
}

Expand Down Expand Up @@ -90,6 +95,47 @@ fn is_id_char(b: u8) -> bool {
#[cfg(test)]
mod tests {
use super::*;
use std::sync::Mutex;

/// Serialises tests that mutate `RELAYBURN_HOME` / `HOME` so they
/// don't trample one another (cargo runs tests in parallel by
/// default; env vars are process-global).
static ENV_LOCK: Mutex<()> = Mutex::new(());

#[test]
fn ledger_home_defaults_to_agentworkforce_burn_under_home() {
let _g = ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner());
let prev_home = env::var("HOME").ok();
let prev_relayburn = env::var("RELAYBURN_HOME").ok();
env::remove_var("RELAYBURN_HOME");
env::set_var("HOME", "/tmp/burn-paths-test-home");

let p = ledger_home();
assert_eq!(p, PathBuf::from("/tmp/burn-paths-test-home/.agentworkforce/burn"));

match prev_home {
Some(v) => env::set_var("HOME", v),
None => env::remove_var("HOME"),
}
if let Some(v) = prev_relayburn {
env::set_var("RELAYBURN_HOME", v);
}
}

#[test]
fn ledger_home_env_var_override_takes_precedence() {
let _g = ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner());
let prev_relayburn = env::var("RELAYBURN_HOME").ok();
env::set_var("RELAYBURN_HOME", "/tmp/explicit-burn-home");

let p = ledger_home();
assert_eq!(p, PathBuf::from("/tmp/explicit-burn-home"));

match prev_relayburn {
Some(v) => env::set_var("RELAYBURN_HOME", v),
None => env::remove_var("RELAYBURN_HOME"),
}
}

#[test]
fn rejects_traversal_and_empty() {
Expand Down
2 changes: 1 addition & 1 deletion crates/relayburn-sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub use crate::ingest::{
pub struct LedgerOpenOptions {
/// Override for `$RELAYBURN_HOME` (the directory containing
/// `burn.sqlite`). When `None`, the env var is consulted, then
/// `~/.relayburn`.
/// `~/.agentworkforce/burn`.
pub home: Option<PathBuf>,
/// Override for the `content.sqlite` location specifically. When
/// `None`, follows `home` (or its env-var fallback). Provided as a
Expand Down
2 changes: 1 addition & 1 deletion crates/relayburn-sdk/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ async fn ingest_with_empty_roots_returns_zero_report_via_handle_and_free_fn() {

// `cleanup_stale_pending_stamps` and `load_config` inside ingest_all
// honor RELAYBURN_HOME; pin it to the temp dir so the test never
// touches `~/.relayburn`.
// touches `~/.agentworkforce/burn`.
std::env::set_var("RELAYBURN_HOME", home.path());

let mut handle = Ledger::open(LedgerOpenOptions::with_home(home.path())).expect("open");
Expand Down
Loading