mirror of
https://github.com/outbackdingo/optimclaw.git
synced 2026-08-31 00:29:24 +00:00
* feat(channels): add native Signal channel via signal-cli HTTP daemon Implement a native Rust Signal channel that connects to a running signal-cli daemon's HTTP endpoint, enabling Signal messaging without WASM overhead. Architecture: - SSE listener at /api/v1/events for receiving messages with automatic reconnection and exponential backoff - JSON-RPC client at /api/v1/rpc for sending messages and typing indicators - Reply target tracking via Arc<RwLock<HashMap>> to route responses back to the correct DM or group conversation Features: - User allowlisting supporting E.164 phone numbers, bare UUIDs, and uuid:-prefixed identifiers (matching OpenClaw's format) - Group allowlisting with wildcard (*) support - Configurable story and attachment-only message filtering - Health check via signal-cli /api/v1/check - Broadcast support to all tracked reply targets Configuration via environment variables: - SIGNAL_HTTP_URL, SIGNAL_ACCOUNT (required) - SIGNAL_ALLOWED_USERS, SIGNAL_ALLOWED_GROUPS - SIGNAL_IGNORE_ATTACHMENTS (default: false) - SIGNAL_IGNORE_STORIES (default: true) Includes unit tests covering allowlist logic, envelope parsing, recipient targeting, SSE deserialization, and edge cases. * refactor(signal): remove expect|unwrap calls - Change SignalChannel::new to return Result<Self, ChannelError> - Replace .expect() on reqwest client build with proper error handling - Replace .expect() on NonZeroUsize with compile-time const using unsafe new_unchecked - Propagate errors through test helpers to avoid unwraps in tests * fix(signal): prevent OOM from chunked response without Content-Length Use bytes_stream() to check response size during download rather than buffering entire body first. This closes the OOM vector where a malicious signal-cli daemon could send unbounded chunked data. * fix(signal): align is_e164 minimum digits with setup wizard Both now require 7-15 digits after '+', preventing environment variable bypass of the stricter onboarding validation. * refactor(signal): extract from_parts constructor Extract SignalChannel::from_parts() used by both new() and sse_listener() to ensure consistent object construction. * chore: remove redundant unused var * refactor(signal): rename allowed_users to allow_from and add dm_policy/group_policy - Rename allowed_users -> allow_from for consistency with other channels - Rename allowed_groups -> allow_from_groups - Add dm_policy field: 'open', 'allowlist', or 'pairing' (default: 'pairing') - Add group_policy field: 'allowlist', 'open', or 'disabled' (default: 'allowlist') - Add group_allow_from field that inherits from allow_from if empty - Implement dm_policy and group_policy logic in message processing - Add environment variable resolution: SIGNAL_ALLOW_FROM, SIGNAL_ALLOW_FROM_GROUPS, SIGNAL_DM_POLICY, SIGNAL_GROUP_POLICY, SIGNAL_GROUP_ALLOW_FROM - Add setup wizard prompts for new policy options - Note: full pairing flow (PairingStore integration) marked as pending for future PR * feat(signal): implement DM pairing workflow for unapproved senders - Add PairingStore integration to check approved senders - Handle pairing requests for unknown senders with dm_policy=pairing - Send pairing reply message with approval instructions - Update FEATURE_PARITY.md to reflect DM pairing support * chore(ci): fix clippy warnings
46 lines
2.4 KiB
Rust
46 lines
2.4 KiB
Rust
//! Multi-channel input system.
|
|
//!
|
|
//! Channels receive messages from external sources (CLI, HTTP, etc.)
|
|
//! and convert them to a unified message format for the agent to process.
|
|
//!
|
|
//! # Architecture
|
|
//!
|
|
//! ```text
|
|
//! ┌─────────────────────────────────────────────────────────────────────┐
|
|
//! │ ChannelManager │
|
|
//! │ │
|
|
//! │ ┌──────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
|
//! │ │ ReplChannel │ │ HttpChannel │ │ WasmChannel │ ... │
|
|
//! │ └──────┬───────┘ └──────┬──────┘ └──────┬──────┘ │
|
|
//! │ │ │ │ │
|
|
//! │ └─────────────────┴─────────────────┘ │
|
|
//! │ │ │
|
|
//! │ select_all (futures) │
|
|
//! │ │ │
|
|
//! │ ▼ │
|
|
//! │ MessageStream │
|
|
//! └─────────────────────────────────────────────────────────────────────┘
|
|
//! ```
|
|
//!
|
|
//! # WASM Channels
|
|
//!
|
|
//! WASM channels allow dynamic loading of channel implementations at runtime.
|
|
//! See the [`wasm`] module for details.
|
|
|
|
mod channel;
|
|
mod http;
|
|
mod manager;
|
|
mod repl;
|
|
mod signal;
|
|
pub mod wasm;
|
|
pub mod web;
|
|
mod webhook_server;
|
|
|
|
pub use channel::{Channel, IncomingMessage, MessageStream, OutgoingResponse, StatusUpdate};
|
|
pub use http::HttpChannel;
|
|
pub use manager::ChannelManager;
|
|
pub use repl::ReplChannel;
|
|
pub use signal::SignalChannel;
|
|
pub use web::GatewayChannel;
|
|
pub use webhook_server::{WebhookServer, WebhookServerConfig};
|