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
6 changes: 3 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Outer: agent working agreement

Outer is a personal software forge for AI agents. An agent talks MCP to Outer, Outer builds the user's Ilha + Void app and runs it on [celld](https://celld.dev), and serves it at `https://<slug>.outer.now`.
Outer is a personal software forge for AI agents. An agent talks MCP to Outer, Outer builds the user's Ilha + Void app and runs it on [Cello](https://cello.ryuz.eu), and serves it at `https://<slug>.outer.now`.

- **Design record:** the maintainer's spec at `~/Developer/vault/outer/spec.md` (not in this repo). Read it before changing behavior, and say so when a change departs from it.
- **Status:** live at `outer.now` (M0 done); milestone M1 (owner alpha) in progress.
Expand Down Expand Up @@ -45,7 +45,7 @@ is `crates/outer/tests/hostile.rs`, in two layers:
and the harness refuses to pass unless the installed `inet outer` table
covers the probe uid.

The `worker.js` `/probes` check needs a live celld fleet with a deployed app
The `worker.js` `/probes` check needs a live Cello fleet with a deployed app
and stays a manual VPS step (see the script header). A PR that changes escape
relevant behavior adds a fixture probe first, then the containment.

Expand All @@ -59,7 +59,7 @@ relevant behavior adds a fixture probe first, then the containment.
| `crates/outer/src/http/` | Axum router: operator probes on the platform host, app proxy fallback for app hosts |
| `crates/outer/src/store/` | `Store` (R2 over S3, or in-memory) and the SQLite snapshot to the bucket |
| `crates/outer/src/git/` | Each app's repo: a bucket WAL (tip bundle + `MANIFEST.json`) and worktree-free commits |
| `crates/outer/src/fleet/` | Sandboxed processes, cgroup v2 leaves, nft egress rules, the celld supervisor |
| `crates/outer/src/fleet/` | Sandboxed processes, cgroup v2 leaves, nft egress rules, the Cello supervisor |
| `e2e/hostile/`, `crates/outer/tests/hostile.rs` | Hostile suite (§12.7): fixtures, manifest, two-layer harness |
| `scripts/hostile-suite.sh` | Integrator entry for the privileged hostile layer (VPS) |
## Rules
Expand Down
2 changes: 1 addition & 1 deletion crates/outer/src/billing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2845,7 +2845,7 @@ mod tests {
fleets: crate::fleet::manager::FleetManager::new(
crate::fleet::manager::ManagerSettings {
data_dir: data_dir.clone(),
celld_bin: "celld".to_string(),
cello_bin: "cello".to_string(),
storage: crate::fleet::manager::FleetStorage {
endpoint: "http://127.0.0.1:1".to_string(),
region: "us-east-1".to_string(),
Expand Down
88 changes: 83 additions & 5 deletions crates/outer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,8 @@ pub struct RuntimeConfig {
pub app_uid_range: (u32, u32),
/// Idle time before an app's fleet is stopped (`OUTER_SLEEP_AFTER_S`).
pub sleep_after_secs: u64,
/// `OUTER_CELLD_BIN`, `OUTER_BUN_BIN`, `OUTER_ESBUILD_BIN` (passed to celld).
pub celld_bin: String,
/// `OUTER_CELLO_BIN`, `OUTER_BUN_BIN`, `OUTER_ESBUILD_BIN` (passed to cello).
pub cello_bin: String,
pub bun_bin: String,
pub esbuild_bin: Option<String>,
/// Global build slots (`OUTER_BUILD_CONCURRENCY`, default half the CPUs).
Expand Down Expand Up @@ -427,6 +427,33 @@ impl Config {
pub fn from_vars(vars: &BTreeMap<String, String>) -> Result<Config, Vec<String>> {
let get = |name: &str| vars.get(name).map(|v| v.trim()).filter(|v| !v.is_empty());
let mut problems = Vec::new();
// Cello 0.1.0 renamed every `CELLD_*` variable to `CELLO_*` (and
// `OUTER_CELLD_BIN` to `OUTER_CELLO_BIN`), with no aliases: cello
// refuses to start with any `CELLD_*` set, and Outer no longer
// emits any. A carried-over setting is dead config at best, so fail
// here, in both `serve` and `check-config` (the release preflight
// runs the latter against prod's env file): the release aborts
// before prod is touched, naming the exact rename.
{
let mut renamed: Vec<(&String, String)> = vars
.keys()
.filter_map(|name| {
if let Some(suffix) = name.strip_prefix("CELLD_") {
Some((name, format!("CELLO_{suffix}")))
} else if name == "OUTER_CELLD_BIN" {
Some((name, "OUTER_CELLO_BIN".to_string()))
} else {
None
}
})
.collect();
renamed.sort();
for (old, new) in renamed {
problems.push(format!(
"{old} was renamed to {new}: set {new} instead of {old} (stale pre-Cello names fail closed)"
));
}
}

let domain = get("OUTER_DOMAIN")
.unwrap_or(DEFAULT_DOMAIN)
Expand Down Expand Up @@ -628,8 +655,8 @@ impl Config {
1800,
&mut problems,
),
celld_bin: resolve_bin(
get("OUTER_CELLD_BIN").unwrap_or("celld"),
cello_bin: resolve_bin(
get("OUTER_CELLO_BIN").unwrap_or("cello"),
vars.get("PATH").map(String::as_str).unwrap_or(""),
),
bun_bin: resolve_bin(
Expand Down Expand Up @@ -1615,10 +1642,61 @@ mod tests {
assert_eq!(cfg.runtime.bun_bin, fake.to_string_lossy().into_owned());
// Missing tools and explicit paths keep their raw names: config load
// (and check-config) never depends on installed tools.
assert_eq!(cfg.runtime.celld_bin, "celld");
assert_eq!(cfg.runtime.cello_bin, "cello");
assert_eq!(cfg.runtime.esbuild_bin.as_deref(), Some("/opt/esbuild"));
}

#[test]
fn stale_celld_env_refuses_with_the_cello_spelling() {
let err = Config::from_vars(&vars(&[
("OUTER_STORE", "memory"),
("CELLD_OPERATOR_TOKEN", "stale"),
("CELLD_DURABILITY", "bucket"),
]))
.unwrap_err();
assert!(
err.iter()
.any(|p| p.contains("CELLD_OPERATOR_TOKEN was renamed to CELLO_OPERATOR_TOKEN")),
"missing operator-token rename: {err:?}"
);
assert!(
err.iter()
.any(|p| p.contains("CELLD_DURABILITY was renamed to CELLO_DURABILITY")),
"missing durability rename: {err:?}"
);
}

#[test]
fn stale_outer_celld_bin_refuses_with_the_cello_spelling() {
let err = Config::from_vars(&vars(&[
("OUTER_STORE", "memory"),
("OUTER_CELLD_BIN", "celld"),
]))
.unwrap_err();
assert!(
err.iter()
.any(|p| p.contains("OUTER_CELLD_BIN was renamed to OUTER_CELLO_BIN")),
"missing bin rename: {err:?}"
);
}

#[test]
fn cello_bin_defaults_to_cello() {
// An empty PATH: without one, resolve_bin falls back to the system
// PATH and finds an installed /usr/local/bin/cello.
let empty = tempfile::tempdir().unwrap();
let path = empty.path().to_string_lossy().into_owned();
let cfg = Config::from_vars(&vars(&[("OUTER_STORE", "memory"), ("PATH", path.as_str())]))
.unwrap();
assert_eq!(cfg.runtime.cello_bin, "cello");
let cfg = Config::from_vars(&vars(&[
("OUTER_STORE", "memory"),
("OUTER_CELLO_BIN", "/opt/cello"),
]))
.unwrap();
assert_eq!(cfg.runtime.cello_bin, "/opt/cello");
}

#[test]
fn partial_tls_triple_is_rejected() {
for missing in ["OUTER_TLS_CERT", "OUTER_TLS_KEY", "OUTER_ORIGIN_PULL_CA"] {
Expand Down
62 changes: 31 additions & 31 deletions crates/outer/src/d1_backup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@
//! newest 3 dumps per binding, Pro the newest 30 (spec §3, owner-set
//! 2026-10-26).
//!
//! `celld d1 export` dumps the live database as SQL — schema beside data,
//! `cello d1 export` dumps the live database as SQL — schema beside data,
//! read under one transaction on the owning node, so the dump is a single
//! snapshot even while the database takes writes. The dump names exactly
//! the visible tables (`--table`, repeatable): celld's `d1_migrations`
//! the visible tables (`--table`, repeatable): cello's `d1_migrations`
//! bookkeeping and the runtime's internal tables stay out, the chosen
//! tables' indexes, triggers and AUTOINCREMENT counters ride along, and the
//! visible views (which belong to no table, so a filtered export leaves
//! them out) are appended by one `sqlite_master` read. Every stored
//! statement stays under the 100,000-byte D1 statement limit
//! (<https://celld.dev/docs/services/d1>), and the dump holds no
//! `BEGIN`/`COMMIT` (application SQL may not use them): each restore batch
//! runs inside celld's own transaction instead.
//! runs inside cello's own transaction instead.
//!
//! Restore replays a dump into the same database (drop the user tables,
//! replay in batches) after taking a fresh backup first, so a bad restore
//! is itself restorable. `d1_migrations` — celld's migration bookkeeping,
//! is itself restorable. `d1_migrations` — cello's migration bookkeeping,
//! written by `migrations apply` — is neither dumped nor dropped, so a
//! restore never confuses a later apply.

Expand Down Expand Up @@ -96,7 +96,7 @@ pub const D1_STATEMENT_LIMIT: usize = 100_000;
/// daily sweep on one app.
pub const MAX_DUMP_BYTES: usize = 32 * 1024 * 1024;

/// Restore applies the dump in batches of at most this many bytes. celld
/// Restore applies the dump in batches of at most this many bytes. cello
/// brackets each multi-statement exec in its own transaction, so a batch is
/// all-or-nothing while the whole restore stays resumable statement-wise.
pub const RESTORE_BATCH_BYTES: usize = 80_000;
Expand Down Expand Up @@ -231,7 +231,7 @@ pub async fn prune_app(
// Dump
// ---------------------------------------------------------------------------

/// One `celld d1 execute --json` against the app's fleet, through the backup
/// One `cello d1 execute --json` against the app's fleet, through the backup
/// entry point. A free function (not a closure) so the borrow checker sees
/// each call's borrows independently.
async fn exec_one(
Expand Down Expand Up @@ -317,10 +317,10 @@ async fn visible_view_stmts(
Ok(stmts)
}

/// Dump one binding to SQL text: one `celld d1 export` over the visible
/// Dump one binding to SQL text: one `cello d1 export` over the visible
/// tables, plus the visible views and their triggers (a filtered export
/// leaves both out — neither belongs to a table). The `--table` allowlist
/// keeps celld's `d1_migrations` bookkeeping and the runtime's internal
/// keeps cello's `d1_migrations` bookkeeping and the runtime's internal
/// tables out of the dump, so restore never sees them; the chosen tables'
/// indexes, triggers and AUTOINCREMENT counters ride along. The export is
/// one snapshot even while the database takes writes — a daily sweep cost,
Expand Down Expand Up @@ -356,7 +356,7 @@ pub async fn dump_database(ctx: &D1Ctx, app: &App, binding: &str) -> Result<Stri
}
};
// A single statement bigger than D1's statement limit can never be
// restored (the replay batch would fail at the celld limit after the
// restored (the replay batch would fail at the cello limit after the
// tables were already dropped), so the backup fails here and stores
// nothing.
if let Some(big) = stmts.iter().find(|s| s.len() > D1_STATEMENT_LIMIT) {
Expand Down Expand Up @@ -530,7 +530,7 @@ fn split_sql(dump: &str) -> Vec<String> {

/// Restore one binding from SQL text: drop the current user tables and
/// views, then replay the statements in [`RESTORE_BATCH_BYTES`] batches.
/// Each batch is one `celld d1 execute`, which brackets it in its own
/// Each batch is one `cello d1 execute`, which brackets it in its own
/// transaction — all-or-nothing per batch, resumable across batches.
pub async fn restore_database(
ctx: &D1Ctx,
Expand Down Expand Up @@ -583,7 +583,7 @@ pub async fn restore_database(
// D1 enforces foreign keys by default, so dropping a populated
// parent before its child fails. `PRAGMA defer_foreign_keys` cannot
// be changed mid-transaction by user queries — D1 runs every query
// in an implicit transaction — but celld brackets this whole exec
// in an implicit transaction — but cello brackets this whole exec
// in its own transaction, so deferring at its start covers every
// drop in the batch (<https://developers.cloudflare.com/d1/sql-api/foreign-keys/>).
let drop_sql = format!("PRAGMA defer_foreign_keys = ON;\n{}", drops.join(";\n"));
Expand Down Expand Up @@ -727,7 +727,7 @@ pub async fn restore_binding(
)));
};
let sql = std::string::String::from_utf8(bytes)
.map_err(|_| D1Error::Celld(format!("backup {} is not valid UTF-8", row.id)))?;
.map_err(|_| D1Error::Cello(format!("backup {} is not valid UTF-8", row.id)))?;
let mut report = restore_database(ctx, app, binding, &sql).await?;
report.fresh_backup_id = fresh.id.clone();
Ok((fresh, report))
Expand Down Expand Up @@ -795,7 +795,7 @@ pub async fn tick(pool: &SqlitePool, store: &Store, fleets: &FleetManager) -> an
continue;
}
let ctx = D1Ctx {
celld_bin: fleets.celld_bin(),
cello_bin: fleets.cello_bin(),
storage: fleets.storage().clone(),
pool: pool.clone(),
store: store.clone(),
Expand Down Expand Up @@ -941,18 +941,18 @@ mod tests {
assert!(stmts[0].contains("\"we;ird\""));
}

// --- fake celld ------------------------------------------------------
// --- fake cello ------------------------------------------------------

use crate::auth::test_support::test_pool;
use crate::fleet::manager::FleetStorage;

/// A fake `celld` answering the backup engine's exact queries: the
/// A fake `cello` answering the backup engine's exact queries: the
/// `d1 export` dump over the allowlisted tables, the dump's and the
/// restore's view reads, the restore's table/count reads, and (by
/// logging + `exit 0`) every drop/replay batch. The state dir is baked
/// into the script, so parallel tests never share it.
fn install_fake_celld(state: &std::path::Path) -> std::path::PathBuf {
let script = state.join("fake-celld");
fn install_fake_cello(state: &std::path::Path) -> std::path::PathBuf {
let script = state.join("fake-cello");
let tmp = script.with_extension("tmp");
let log = state.join("calls.log").to_string_lossy().into_owned();
std::fs::write(
Expand Down Expand Up @@ -1020,7 +1020,7 @@ exit 0
store: Store,
) -> D1Ctx {
D1Ctx {
celld_bin: script.to_string_lossy().into_owned(),
cello_bin: script.to_string_lossy().into_owned(),
storage: FleetStorage {
endpoint: "http://127.0.0.1:1".to_string(),
region: "test-region".to_string(),
Expand Down Expand Up @@ -1094,7 +1094,7 @@ exit 0
async fn dump_exports_allowlisted_tables_and_appends_views() {
let pool = test_pool().await;
let state = tempfile::tempdir().unwrap();
let script = install_fake_celld(state.path());
let script = install_fake_cello(state.path());
let store = Store::memory();
let now = crate::apps::now_ms();
seed_backup_app(&pool, &store, now).await;
Expand Down Expand Up @@ -1175,10 +1175,10 @@ exit 0
assert_eq!(lists, 2, "{calls}");
}

/// A fake `celld` whose table list never settles: every listing
/// A fake `cello` whose table list never settles: every listing
/// alternates, so the drift check retries and then gives up.
fn install_drifting_celld(state: &std::path::Path) -> std::path::PathBuf {
let script = state.join("fake-celld-drift");
fn install_drifting_cello(state: &std::path::Path) -> std::path::PathBuf {
let script = state.join("fake-cello-drift");
let tmp = script.with_extension("tmp");
let log = state.join("calls.log").to_string_lossy().into_owned();
let counter = state.join("drift-n").to_string_lossy().into_owned();
Expand Down Expand Up @@ -1231,7 +1231,7 @@ exit 0
async fn dump_retries_a_schema_that_changes_mid_dump() {
let pool = test_pool().await;
let state = tempfile::tempdir().unwrap();
let script = install_drifting_celld(state.path());
let script = install_drifting_cello(state.path());
let store = Store::memory();
let now = crate::apps::now_ms();
seed_backup_app(&pool, &store, now).await;
Expand All @@ -1254,7 +1254,7 @@ exit 0
async fn restore_replays_drops_then_dump_after_a_fresh_backup() {
let pool = test_pool().await;
let state = tempfile::tempdir().unwrap();
let script = install_fake_celld(state.path());
let script = install_fake_cello(state.path());
let store = Store::memory();
let now = crate::apps::now_ms();
seed_backup_app(&pool, &store, now).await;
Expand Down Expand Up @@ -1306,10 +1306,10 @@ exit 0
assert_eq!(backups_for(&pool, &app.id).await.unwrap().len(), 2);
}

/// A fake `celld` whose export carries one statement bigger than the
/// A fake `cello` whose export carries one statement bigger than the
/// D1 statement limit: the dump must refuse it at backup time.
fn install_huge_row_celld(state: &std::path::Path) -> std::path::PathBuf {
let script = state.join("fake-celld-huge");
fn install_huge_row_cello(state: &std::path::Path) -> std::path::PathBuf {
let script = state.join("fake-cello-huge");
let tmp = script.with_extension("tmp");
let log = state.join("calls.log").to_string_lossy().into_owned();
std::fs::write(
Expand Down Expand Up @@ -1356,7 +1356,7 @@ exit 0
async fn dump_rejects_a_row_bigger_than_the_d1_statement_limit() {
let pool = test_pool().await;
let state = tempfile::tempdir().unwrap();
let script = install_huge_row_celld(state.path());
let script = install_huge_row_cello(state.path());
let store = Store::memory();
let now = crate::apps::now_ms();
seed_backup_app(&pool, &store, now).await;
Expand All @@ -1374,7 +1374,7 @@ exit 0
async fn restore_rejects_an_oversized_statement_before_dropping_anything() {
let pool = test_pool().await;
let state = tempfile::tempdir().unwrap();
let script = install_fake_celld(state.path());
let script = install_fake_cello(state.path());
let store = Store::memory();
let now = crate::apps::now_ms();
seed_backup_app(&pool, &store, now).await;
Expand All @@ -1400,7 +1400,7 @@ exit 0
async fn tick_skips_an_app_whose_manifest_wont_parse() {
let pool = test_pool().await;
let state = tempfile::tempdir().unwrap();
let script = install_fake_celld(state.path());
let script = install_fake_cello(state.path());
let store = Store::memory();
let now = crate::apps::now_ms();
// A due app whose deployed manifest has non-array bindings: reading
Expand Down Expand Up @@ -1451,7 +1451,7 @@ exit 0
.unwrap();
let fleets = FleetManager::new(crate::fleet::manager::ManagerSettings {
data_dir: state.path().join("data"),
celld_bin: script.to_string_lossy().into_owned(),
cello_bin: script.to_string_lossy().into_owned(),
storage: FleetStorage {
endpoint: "http://127.0.0.1:1".to_string(),
region: "test-region".to_string(),
Expand Down
Loading
Loading