Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
use crate::outbound::email_api::GmailApi;
use crate::pubsub::context::PubSubEventBroker;
use sqlx::PgPool;
#[derive(Clone)]
pub struct ScheduledContext {
pub db: PgPool,
pub sqs_worker: sqs_worker::SQSWorker,
pub email_api: GmailApi,
pub attachment_bytes:
std::sync::Arc<dyn email::domain::attachment_access::AuthorizedAttachmentBytes>,
pub s3_client: s3_client::S3,
pub attachment_bucket: String,
pub macro_event_broker: PubSubEventBroker,
pub read_receipts: crate::composition::ReadReceipts,
}
impl ScheduledContext {
/// Compose the worker's persistence/provider adapter without holding a DB transaction.
pub fn delivery_adapter(
&self,
) -> crate::outbound::scheduled_delivery::ScheduledDeliveryAdapter {
crate::outbound::scheduled_delivery::ScheduledDeliveryAdapter {
db: self.db.clone(),
forwarded_attachments:
email::domain::forwarded_attachments::ForwardedAttachmentService::new(
crate::outbound::forwarded_attachments::PgForwardedAttachmentRepo(
self.db.clone(),
),
),
email_api: self.email_api.clone(),
attachment_bytes: self.attachment_bytes.clone(),
s3_client: self.s3_client.clone(),
attachment_bucket: self.attachment_bucket.clone(),
macro_event_broker: self.macro_event_broker.clone(),
read_receipts: self.read_receipts.clone(),
}
}
}