pub struct CommonConfig {
pub agent_id: String,
pub auth_token: String,
pub transports: HashMap<String, TransportConfig>,
pub slash_commands: Vec<SlashCommandConfig>,
pub push_relay: Option<PushRelayConfig>,
}Expand description
Stable agent identity and multi-transport settings.
Replaces the old BridgeConfig / bridge.toml. Stored as common.toml.
Fields§
§agent_id: StringStable UUID that identifies this agent across all transports.
auth_token: StringBearer token required for WebSocket connections.
transports: HashMap<String, TransportConfig>Per-transport configuration, keyed by transport name
(e.g., "local", "cloudflare", "tailscale-serve").
slash_commands: Vec<SlashCommandConfig>Slash commands to advertise to clients via available_commands_update.
Used for agents that don’t send this notification themselves.
The bridge injects the notification after every session/new or session/load.
push_relay: Option<PushRelayConfig>Push relay configuration. Push is disabled when this section is absent or any required field is empty — no hardcoded defaults.
Implementations§
Source§impl CommonConfig
impl CommonConfig
Sourcepub fn config_path() -> PathBuf
pub fn config_path() -> PathBuf
Path to the common.toml file (default config dir).
Sourcepub fn config_dir() -> PathBuf
pub fn config_dir() -> PathBuf
Config directory (system default or custom override).
Sourcepub fn load() -> Result<Self>
pub fn load() -> Result<Self>
Load from common.toml at the default location, or return defaults.
Sourcepub fn load_from_dir(dir: &Path) -> Result<Self>
pub fn load_from_dir(dir: &Path) -> Result<Self>
Load from common.toml in a specific directory, or return defaults.
Sourcepub fn save(&self) -> Result<()>
pub fn save(&self) -> Result<()>
Save to common.toml with 0600 permissions (default config dir).
Sourcepub fn save_to_dir(&self, dir: &Path) -> Result<()>
pub fn save_to_dir(&self, dir: &Path) -> Result<()>
Save to common.toml in a specific directory with 0600 permissions.
Sourcepub fn ensure_agent_id(&mut self)
pub fn ensure_agent_id(&mut self)
Generate a UUID v4 agent_id if one is not already set.
Sourcepub fn generate_auth_token() -> String
pub fn generate_auth_token() -> String
Generate a random URL-safe authentication token (32 random bytes, base64).
Sourcepub fn ensure_auth_token(&mut self)
pub fn ensure_auth_token(&mut self)
Ensure auth_token is populated, generating one if needed.
Sourcepub fn enabled_transports(&self) -> Vec<(&str, &TransportConfig)>
pub fn enabled_transports(&self) -> Vec<(&str, &TransportConfig)>
Returns all enabled transports, sorted by name for deterministic ordering.
Trait Implementations§
Source§impl Clone for CommonConfig
impl Clone for CommonConfig
Source§impl Debug for CommonConfig
impl Debug for CommonConfig
Source§impl Default for CommonConfig
impl Default for CommonConfig
Source§impl<'de> Deserialize<'de> for CommonConfig
impl<'de> Deserialize<'de> for CommonConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for CommonConfig
impl RefUnwindSafe for CommonConfig
impl Send for CommonConfig
impl Sync for CommonConfig
impl Unpin for CommonConfig
impl UnsafeUnpin for CommonConfig
impl UnwindSafe for CommonConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().