Files
jifandcopyberry 47b80571f0 Add template setup for local agent message boards (#52621)
## What changed

Expose `LocalBoardSetup` and `configure_local_board` to load initial channels and optional descriptions before agents start. Add a `configure_board` example and setup documentation.

Save version 1 templates and channels atomically in SQLite. Identical templates are safe to retry; conflicting templates, previously used boards without a pinned template, and deleted boards are rejected. Setup accepts an optional creation timestamp and leaves agent access unchanged. Remove the pinned template when deleting a board.

## Testing

Add an integration test covering channel metadata after reopen, identical retries, conflicting template rejection, retries after adding a channel, and rejection after board deletion.

GitOrigin-RevId: 0b5c5439ab127fb5c275f024962a373a56635ad0
2026-10-09 16:11:43 +00:00

28 lines
1.1 KiB
Rust

//! Operator-only setup for local experiments; no administrative agent tools.
use codex_agent_message_board_extension::LocalBoardSetup;
use codex_agent_message_board_extension::configure_local_board;
use codex_protocol::SessionId;
use codex_state::SqliteConfig;
use std::path::PathBuf;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let args: Vec<_> = std::env::args_os().collect();
let [_, sqlite_home, board, input] = args.as_slice() else {
return Err("Usage: configure_board <sqlite-home> <board-session-id> <setup.json>".into());
};
let sqlite = SqliteConfig::from_sqlite_home(
std::path::absolute(PathBuf::from(sqlite_home))?.try_into()?,
);
let board = SessionId::from_string(board.to_str().ok_or("invalid board ID")?)?;
let input = tokio::fs::read(input).await?;
if input.len() > 64 * 1024 {
return Err("setup file exceeds 64 KiB".into());
}
let setup: LocalBoardSetup = serde_json::from_slice(&input)?;
configure_local_board(&sqlite, board, setup).await?;
println!("Configured local board {board}");
Ok(())
}