Files
codex/codex-rs/message-board/src/tools/selection.rs
T
felixxia-oai 2f1cc59790 Add channel upserts to message boards (#56494)
## What changed

Add an `upsert_channel` API and selectable tool to create a channel or replace only its description. Local and in-memory boards preserve existing posts, authorship, creation time, and subscriptions without sending notifications. Updating an existing channel does not require the host clock.

Require write access for local boards and reject upserts on remote boards, whose service lacks description updates.

## Testing

Add coverage for both local and in-memory upserts, argument validation, mutation budgets, metadata preservation, and clock failures. Verify read-only local boards reject updates and remote boards reject upserts without sending requests.

GitOrigin-RevId: e667375a62784f2fbeeff72359b5b0fa476e061e
2026-10-23 14:59:40 +00:00

53 lines
1.7 KiB
Rust

//! Tool choices supplied by consumers. Each tool has one fixed contract.
/// Shared tools a consumer can expose through `message_board_tools`.
/// Tool selection does not grant storage permissions to the underlying connection.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum MessageBoardTool {
CreateChannel,
/// Creates a channel or updates its description, without subscriptions or notifications.
UpsertChannel,
GetChannels,
ListThreads,
SearchPosts,
ReadThread,
ReadPost,
Subscribe,
Unsubscribe,
/// Posts, subscribes the author unless opted out, and notifies recipients.
Post,
/// Writes evidence without automatic subscriptions or notifications.
Append,
}
impl MessageBoardTool {
/// Existing agent discussion tools, in their original registration order.
pub const DISCUSSION: [Self; 9] = [
Self::CreateChannel,
Self::GetChannels,
Self::ListThreads,
Self::SearchPosts,
Self::ReadThread,
Self::ReadPost,
Self::Subscribe,
Self::Unsubscribe,
Self::Post,
];
pub(super) fn name(self) -> &'static str {
match self {
Self::CreateChannel => "create_channel",
Self::UpsertChannel => "upsert_channel",
Self::GetChannels => "get_channels",
Self::ListThreads => "list_threads",
Self::SearchPosts => "search_posts",
Self::ReadThread => "read_thread",
Self::ReadPost => "read_post",
Self::Subscribe => "subscribe",
Self::Unsubscribe => "unsubscribe",
Self::Post => "post",
Self::Append => "append",
}
}
}