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-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)
- `relayburn-cli` (Rust): wire codex `HarnessAdapter` via `pending_stamp::adapter_static` factory; registered in `RUNTIME_ADAPTERS`. (#248 D6)
- `relayburn-cli` (Rust): wire `burn compare` as a presenter over `relayburn_sdk::analyze::compare` building blocks (`build_compare_table` + the per-turn fidelity gate), matching the TS CLI flag set (positional comma-separated model list, `--include-partial` / `--fidelity` / `--since` / `--project` / `--session` / `--min-sample` / `--csv` / `--no-archive`) and producing byte-equivalent stdout for the cli-golden `compare` / `compare-json` invocations. (#248 D3)
- `relayburn-cli` (Rust): port `burn overhead` and `burn overhead trim` as thin presenters over `relayburn_sdk::overhead` / `::overhead_trim`. Output (human + `--json`) is byte-equivalent with the TS CLI. (#248 D2)
Expand Down
31 changes: 31 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion crates/relayburn-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ thiserror = { workspace = true }
# bodies via a current-thread runtime.
async-trait = "0.1"
phf = { version = "0.11", features = ["macros"] }
tokio = { workspace = true, features = ["sync", "rt"] }
# `signal` is needed for the `burn ingest --watch` SIGINT/SIGTERM trap
# (#248 D8); the watch loop blocks the foreground until a stop signal
# comes in. `rt` drives the current-thread runtime that wraps the SDK's
# async ingest verb from otherwise-sync presenter bodies.
tokio = { workspace = true, features = ["sync", "rt", "signal"] }

# `IndexMap` preserves first-seen iteration order, which matters for the
# Wave 2 read-path commands so their grouped output (`summary --by-model`,
Expand Down
69 changes: 67 additions & 2 deletions crates/relayburn-cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,77 @@ pub enum Command {
State(StateArgs),

/// Scan harness session stores and append new turns to the ledger.
Ingest,
Ingest(IngestArgs),

/// Stdio MCP server exposing read-only ledger queries for
/// in-session self-query.
#[command(name = "mcp-server")]
McpServer,
McpServer(McpServerArgs),
}

/// Per-command flags for `burn ingest`. Mirrors the TS surface in
/// `packages/cli/src/commands/ingest.ts` so flag muscle memory carries
/// across.
///
/// Three modes, exactly one applies per invocation:
///
/// - No flags: scan all known session stores once and exit.
/// - `--watch` (optionally with `--interval <MS>`): foreground poll loop
/// driven by [`relayburn_sdk::start_watch_loop`].
/// - `--hook <HARNESS> [--quiet]`: stdin-driven hook entrypoint. Today
/// only `--hook claude` is supported; the `--quiet` flag suppresses
/// non-error stderr breadcrumbs so it is safe to call from every
/// Claude Code hook.
///
/// `--watch` and `--hook` are mutually exclusive; the presenter rejects
/// the combination at runtime with exit 2 (matching TS).
#[derive(Debug, Clone, ClapArgs)]
pub struct IngestArgs {
/// Stay running and poll session stores at `--interval` ms.
/// Mutually exclusive with `--hook`.
#[arg(long)]
pub watch: bool,

/// Poll interval for `--watch`, in milliseconds. Defaults to 1000.
/// Ignored without `--watch`.
#[arg(long, value_name = "MS")]
pub interval: Option<u64>,

/// Read a harness-specific hook payload from stdin and ingest the
/// transcript it references. Today only `claude` is supported.
/// Mutually exclusive with `--watch`.
#[arg(long, value_name = "HARNESS")]
pub hook: Option<String>,

/// Suppress non-error stderr breadcrumbs. Used by hook callers so
/// the surrounding tool invocation isn't blocked by a noisy
/// pipeline. Only meaningful with `--hook`; clap rejects `--quiet`
/// on its own (or with `--watch`) so a typo can't silently no-op.
#[arg(long, requires = "hook")]
pub quiet: bool,
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}

/// Per-command flags for `burn mcp-server`. The stdio MCP server speaks
/// JSON-RPC 2.0 line-delimited frames over stdin/stdout and exposes the
/// `burn__sessionCost` read-only tool. Closes #210.
///
/// Global `--ledger-path` (on [`Args`]) is consulted as the SDK ledger
/// home. `--session-id` registers a default session id so MCP clients
/// that omit `sessionId` in `tools/call` get a useful answer (the
/// running agent's own session).
#[derive(Debug, Clone, ClapArgs)]
pub struct McpServerArgs {
/// Default sessionId to use when `tools/call burn__sessionCost`
/// omits the argument. Lets the host wrap the server with the
/// running agent's own session id so the agent can self-query
/// without knowing it.
#[arg(long = "session-id", value_name = "ID")]
pub session_id: Option<String>,

/// Emit protocol-level diagnostics to stderr. Off by default so a
/// well-behaved client doesn't see unexpected noise on the channel.
#[arg(long)]
pub debug: bool,
}

/// Per-command flag set for `burn compare`. Mirrors
Expand Down
Loading
Loading