Files
codex/codex-rs/ext/agent-message-board/src/host.rs
T
jif 97239fd052 Add explicit local board connections with fixed runtime access (#53400)
## Why

Local message boards were scoped to an agent tree. Independently created Codex runtimes need a way to share a board while receiving different access permissions.

## What changed

- Add `LocalBoard` and `LocalBoardConnection` so hosts can supply read-only or read-write access through `thread_extension_init`, including for isolated, ephemeral runtimes.
- Allow read-only connections to read and manage their own subscriptions; reject posting, replying, channel creation, and changes to another agent's subscriptions. Expose effective permissions in channel discovery.
- Use unique runtime paths and require matching board IDs and canonical database paths when resolving agents or delivering notifications.
- Document explicit extension installation and connection setup for new runtimes, cold resumes, and forks.

## Testing

Add a scenario and context snapshot covering an independent writer and isolated Guardian sharing a board through a symlink alias, read-only permission denials, subscription and explicit notifications, and rejection of notifications to an unconnected runtime before a post is written.

GitOrigin-RevId: f92410c3a5c6a46920c3e0e71849c85dc83d9c31
2026-10-12 14:44:22 +00:00

40 lines
1.5 KiB
Rust

//! Host capabilities needed by a board without depending on codex-core.
use crate::PostPreview;
use chrono::DateTime;
use chrono::Utc;
use codex_protocol::AgentPath;
use codex_protocol::ThreadId;
use codex_protocol::error::Result;
use futures::future::BoxFuture;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum NotificationDelivery {
Accepted,
SkippedInactive,
}
/// Board-scoped membership, clock and notification access supplied by the host.
///
/// The host remains authoritative for membership even when runtimes are unloaded.
/// Clock reads use the posting agent's configured source, including simulated
/// time. Notifications are accepted only while a running turn still accepts
/// mailbox delivery; otherwise they are skipped without being queued.
/// Accepted notifications must not start a new turn or reopen a finalized answer,
/// but may remain in conversation history for a later turn.
/// Backends may implement these capabilities with local handles or remote RPCs.
pub trait MessageBoardHost: Send + Sync {
fn agent_path(&self, caller: ThreadId) -> BoxFuture<'_, Result<AgentPath>>;
fn resolve_agent(&self, path: AgentPath) -> BoxFuture<'_, Result<ThreadId>>;
fn current_time(&self, caller: ThreadId) -> BoxFuture<'_, Result<DateTime<Utc>>>;
/// Push metadata and a bounded preview. Full content is retrieved through bounded reads.
fn notify(
&self,
recipient: ThreadId,
post: PostPreview,
) -> BoxFuture<'_, Result<NotificationDelivery>>;
}