s-m-r-t
Open the s-m-r-t source on GitHub Switch to dark color scheme
← All packages
Content & media v0.57.40

@happyvertical/smrt-messages

A unified STI hierarchy for email, social, and other communication channels, plus in-app notifications.

Source ↗

What it gives you

A unified STI hierarchy for email, social, and other communication channels, plus in-app notifications.

This package is one focused part of the s-m-r-t stack. Its decorated models participate in the same manifest, tenancy, persistence, and generated-interface conventions as the rest of the framework.

Channels and accounts are polymorphic

Message has Email, Tweet, and SlackMessage subtypes; Account has Email, Twitter, Slack, Zulip, and Telegram subtypes. Import a provider from smrt-messages/providers/email, slack, twitter, or all when needed. The root import remains free of provider SDK weight, and credentialSecretId points to write-only smrt-secrets storage.

Persona routes are wired by a trusted caller

MessagingEndpoint, PersonaMessageRoute, and PersonaMessagingService operate behind messages.send and messages.manage-routes. createPersonaMessagingTool fixes personaId in trusted wiring so an agent-provided argument cannot choose a different persona. EmailAccount.readIntakeMessage is the authorized seam for opt-in ingestion of full message bytes; it never advances sync checkpoints.

In-app notifications are a closed service

UserNotification stores one row per recipient with kind, title, body, link, severity, a source reference, and read and dismissed state. UserNotificationService is the only access path: notify and notifyMany deduplicate on the source reference, and listForUser, countUnread, markRead, dismiss, and markAllRead filter on the recipient. Generated REST, MCP, and CLI are off, because a tenant-scoped list would expose every member. Hosts expose their own routes with the signed-in user id.