pub struct HttpChannel { /* private fields */ }Expand description
The CoPilot HTTP channel. Owns http:copilot and every http:copilot:*
sub-lane.
Implementations§
Source§impl HttpChannel
impl HttpChannel
Sourcepub fn new(
config: HttpConfig,
host: Arc<dyn ChannelHost>,
db: Db,
audit: SharedAuditSink,
) -> Self
pub fn new( config: HttpConfig, host: Arc<dyn ChannelHost>, db: Db, audit: SharedAuditSink, ) -> Self
Production constructor: db is the shared talon_db::Db.
The /palace/* endpoints are disabled (503) — see HttpDeps::new;
use Self::with_palace to supply a (containerized) palace runner.
Sourcepub fn with_palace(
config: HttpConfig,
host: Arc<dyn ChannelHost>,
db: Db,
audit: SharedAuditSink,
palace: Arc<dyn PalaceRunner>,
) -> Self
pub fn with_palace( config: HttpConfig, host: Arc<dyn ChannelHost>, db: Db, audit: SharedAuditSink, palace: Arc<dyn PalaceRunner>, ) -> Self
Like Self::new, serving /palace/* through palace (normally a
crate::CommandPalaceRunner running the palace in a hardened
container).
Sourcepub fn from_state(state: HttpState) -> Self
pub fn from_state(state: HttpState) -> Self
Build around an existing state (custom dependencies, tests).
Sourcepub fn local_addr(&self) -> Option<SocketAddr>
pub fn local_addr(&self) -> Option<SocketAddr>
The bound address once connected (useful with port 0).
Trait Implementations§
Source§impl Channel for HttpChannel
impl Channel for HttpChannel
Source§fn connect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn connect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Start the channel (bind servers, start polling). Must return once the
channel is ready; long-running work goes into spawned tasks.
Source§fn send_message<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
jid: &'life1 str,
text: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn send_message<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
jid: &'life1 str,
text: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Deliver
text to jid. Text is already formatted for channel_type.fn is_connected(&self) -> bool
Source§fn disconnect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn disconnect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Stop background tasks and release sockets.
Source§fn set_typing<'life0, 'life1, 'async_trait>(
&'life0 self,
jid: &'life1 str,
is_typing: bool,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set_typing<'life0, 'life1, 'async_trait>(
&'life0 self,
jid: &'life1 str,
is_typing: bool,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Optional typing indicator.
Source§fn on_turn_complete<'life0, 'life1, 'async_trait>(
&'life0 self,
jid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_turn_complete<'life0, 'life1, 'async_trait>(
&'life0 self,
jid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called when the agent finishes a turn successfully, before the
container goes idle (lets streaming channels close their streams).
Source§fn channel_type(&self) -> ChannelType
fn channel_type(&self) -> ChannelType
Dialect for outbound formatting.
Auto Trait Implementations§
impl !Freeze for HttpChannel
impl !RefUnwindSafe for HttpChannel
impl !UnwindSafe for HttpChannel
impl Forget for HttpChannel
impl Move for HttpChannel
impl Send for HttpChannel
impl Sync for HttpChannel
impl Unpin for HttpChannel
impl UnsafeUnpin for HttpChannel
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
Mutably borrows from an owned value. Read more