pub struct SlackAdapter { /* private fields */ }Expand description
In-process Slack adapter. UNCONDITIONAL (no #[cfg(target_os=...)] — MC-11):
Slack is cross-platform, the whole point of the second channel proving the
seam holds without macOS. Holds the channel-agnostic ApprovalCore
(resolve by approval_id), the per-channel MessagingConfigStore
(allowlist + pairing), the SlackTransport seam, and the configured
Slack channel id to post into.
Implementations§
Source§impl SlackAdapter
impl SlackAdapter
Sourcepub fn new(
host: Arc<HostState>,
config: MessagingConfigStore,
transport: Arc<dyn SlackTransport>,
channel: impl Into<String>,
) -> SlackAdapter
pub fn new( host: Arc<HostState>, config: MessagingConfigStore, transport: Arc<dyn SlackTransport>, channel: impl Into<String>, ) -> SlackAdapter
Build a Slack adapter over the shared host, config store, transport seam, and the configured Slack channel id.
Sourcepub async fn post_prompt(&self, approval: &HostApprovalRequest, code: &str)
pub async fn post_prompt(&self, approval: &HostApprovalRequest, code: &str)
Post ONE Block Kit approval prompt for approval_id (carrying the
shared fan-out code in the text for MC-8 equality) to the configured
Slack channel. The button value carries the approval_id directly.
Used by the fan-out outbound path (Unit 5) and by the e2e test.
Gating: a disabled Slack channel is a silent no-op (zero posts) — the enabled-flag wall, same as iMessage.
Sourcepub async fn handle_event(&self, event: &SlackInboundEvent)
pub async fn handle_event(&self, event: &SlackInboundEvent)
Dispatch one inbound Slack event. The closed set guarantees the only effects are: (1) resolve a known approval by id (button), or (2) validate-and-consume a pairing code (DM). NO config-mutation edge (MC-6). The enabled-flag wall applies — a disabled channel does zero inbound work.
Sourcepub fn core(&self) -> &ApprovalCore
pub fn core(&self) -> &ApprovalCore
The shared core (so the fan-out coordinator can query eligibility
through the same Arc<HostState>).
Trait Implementations§
Source§impl InboundChannel for SlackAdapter
The Slack adapter implements the channel-agnostic InboundChannel seam:
it names ChannelId::Slack and OWNS its push-based inbound loop, pulling
events off the SlackTransport and dispatching each. UNCONDITIONAL — no
cfg gate (MC-11).
impl InboundChannel for SlackAdapter
The Slack adapter implements the channel-agnostic InboundChannel seam:
it names ChannelId::Slack and OWNS its push-based inbound loop, pulling
events off the SlackTransport and dispatching each. UNCONDITIONAL — no
cfg gate (MC-11).
Note on the sink: like the iMessage adapter, the Slack adapter is its own
delivery path. Its inbound is button-clicks (resolve by approval_id) and
pairing DMs (the code primitive) — neither maps to the handle_id+body
InboundMessage sink shape, so the passed sink is unused here (the seam’s
sink param exists for a hypothetical adapter whose delivery is externally
supplied; Slack, like iMessage, delivers internally and honestly does not
fake an InboundMessage).
Source§fn run<'life0, 'life1, 'async_trait>(
&'life0 self,
_sink: &'life1 dyn InboundSink,
cancel: Receiver<bool>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
SlackAdapter: 'async_trait,
fn run<'life0, 'life1, 'async_trait>(
&'life0 self,
_sink: &'life1 dyn InboundSink,
cancel: Receiver<bool>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
SlackAdapter: 'async_trait,
cancel flips to true. The
adapter feeds every observed inbound message to sink.deliver(...).Auto Trait Implementations§
impl !RefUnwindSafe for SlackAdapter
impl !UnwindSafe for SlackAdapter
impl Freeze for SlackAdapter
impl Send for SlackAdapter
impl Sync for SlackAdapter
impl Unpin for SlackAdapter
impl UnsafeUnpin for SlackAdapter
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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 more