@happyvertical/smrt-messages 0.60.15 → 0.60.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/AGENTS.md +4 -0
  2. package/dist/chunks/{AccountCollection-DBEG6nR7.js → AccountCollection-Jn3jKg1h.js} +2 -2
  3. package/dist/chunks/{AccountCollection-DBEG6nR7.js.map → AccountCollection-Jn3jKg1h.js.map} +1 -1
  4. package/dist/chunks/{Email-p5qIyMC5.js → Email-Ddhzl5pT.js} +3 -3
  5. package/dist/chunks/{Email-p5qIyMC5.js.map → Email-Ddhzl5pT.js.map} +1 -1
  6. package/dist/chunks/{EmailFolder-Dk4hxikK.js → EmailFolder-DFj8EDOE.js} +2 -2
  7. package/dist/chunks/{EmailFolder-Dk4hxikK.js.map → EmailFolder-DFj8EDOE.js.map} +1 -1
  8. package/dist/chunks/{Message-hIwx07Kt.js → Message-C92Sna6i.js} +4 -4
  9. package/dist/chunks/{Message-hIwx07Kt.js.map → Message-C92Sna6i.js.map} +1 -1
  10. package/dist/chunks/{MessageCollection-BwnE4a_L.js → MessageCollection-DTcvlo_u.js} +2 -2
  11. package/dist/chunks/{MessageCollection-BwnE4a_L.js.map → MessageCollection-DTcvlo_u.js.map} +1 -1
  12. package/dist/chunks/{__smrt-register__-D3kBjvML.js → __smrt-register__-C4I1owMm.js} +2 -2
  13. package/dist/chunks/{__smrt-register__-D3kBjvML.js.map → __smrt-register__-C4I1owMm.js.map} +1 -1
  14. package/dist/index.js +9 -9
  15. package/dist/manifest.json +1 -1
  16. package/dist/smrt-knowledge.json +5 -5
  17. package/dist/smrt-knowledge.okf.md +2 -2
  18. package/dist/svelte/components/AccountAvatar.svelte +34 -30
  19. package/dist/svelte/components/AccountCard.svelte +72 -63
  20. package/dist/svelte/components/AccountList.svelte +15 -9
  21. package/dist/svelte/components/AttachmentChip.svelte +54 -39
  22. package/dist/svelte/components/AttachmentUpload.svelte +55 -48
  23. package/dist/svelte/components/ComposeForm.svelte +105 -83
  24. package/dist/svelte/components/EmailAccountManager.svelte +245 -230
  25. package/dist/svelte/components/EmailFilterManager.svelte +250 -228
  26. package/dist/svelte/components/FolderNav.svelte +60 -50
  27. package/dist/svelte/components/ForwardForm.svelte +40 -34
  28. package/dist/svelte/components/MessageCard.svelte +116 -110
  29. package/dist/svelte/components/MessageDetail.svelte +107 -92
  30. package/dist/svelte/components/MessageFilters.svelte +73 -48
  31. package/dist/svelte/components/MessageList.svelte +20 -13
  32. package/dist/svelte/components/MessageStatusIndicator.svelte +24 -22
  33. package/dist/svelte/components/MessageToolbar.svelte +48 -36
  34. package/dist/svelte/components/MessageTypeBadge.svelte +8 -5
  35. package/dist/svelte/components/MessagingSettingsPanel.svelte +97 -32
  36. package/dist/svelte/components/RecipientInput.svelte +63 -43
  37. package/dist/svelte/components/ReplyForm.svelte +40 -34
  38. package/dist/svelte/components/SendStatusBadge.svelte +21 -14
  39. package/dist/svelte/components/ThreadView.svelte +68 -55
  40. package/package.json +16 -16
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { t as __exportAll } from "./chunks/rolldown-runtime-D7D4PA-g.js";
2
- import "./chunks/__smrt-register__-D3kBjvML.js";
2
+ import "./chunks/__smrt-register__-C4I1owMm.js";
3
3
  import { a as registerMessagingProvider, n as getMessagingProvider, o as ZulipSender, r as listMessagingProviders, s as TelegramSender, t as ensureBuiltinMessagingProvidersRegistered } from "./chunks/providers-4iLula-V.js";
4
4
  import { buildSqliteRebuildStatements, isDeepStrictEqual, normalizeIdentityEmail, queryGlobal, queryWithGlobals, readNotificationProfile, withSystemContext, withTenant } from "./host.js";
5
- import { r as Account, t as AccountCollection } from "./chunks/AccountCollection-DBEG6nR7.js";
5
+ import { r as Account, t as AccountCollection } from "./chunks/AccountCollection-Jn3jKg1h.js";
6
6
  import { d as withProtectedNotificationHandoff, f as PROFILE_NOTIFICATION_POLICY_PREFIX, l as protectedNotificationMetadata, m as profileNotificationPolicy, n as assertProtectedEmailAdmission, p as assertNotificationRecipientIdentity, r as assertProtectedEmailHandoff, t as ProtectedNotificationHandoffError } from "./chunks/protected-notification-handoff-mvaEZVp7.js";
7
- import { t as Message } from "./chunks/Message-hIwx07Kt.js";
8
- import { t as MessageCollection } from "./chunks/MessageCollection-BwnE4a_L.js";
9
- import { t as Email } from "./chunks/Email-p5qIyMC5.js";
10
- import { t as EmailFolder } from "./chunks/EmailFolder-Dk4hxikK.js";
7
+ import { t as Message } from "./chunks/Message-C92Sna6i.js";
8
+ import { t as MessageCollection } from "./chunks/MessageCollection-DTcvlo_u.js";
9
+ import { t as Email } from "./chunks/Email-Ddhzl5pT.js";
10
+ import { t as EmailFolder } from "./chunks/EmailFolder-DFj8EDOE.js";
11
11
  import { t as SlackSender } from "./chunks/SlackSender-CjSvwY1K.js";
12
12
  import { t as TweetSender } from "./chunks/TweetSender-CcLPNNi1.js";
13
13
  import { GlobalInterceptors, SmrtCollection, SmrtObject, SmrtRecipe, crossPackageRef, detectEngine, field, foreignKey, importOptionalDependency, isUniqueViolationError, smrt, usesEmbeddedRevisionFallback, withEmbeddedWriteQueue } from "@happyvertical/smrt-core";
@@ -109,7 +109,7 @@ var Attachment = class extends SmrtObject {
109
109
  */
110
110
  async getMessage() {
111
111
  if (!this.messageId) return null;
112
- const { MessageCollection } = await import("./chunks/MessageCollection-BwnE4a_L.js").then((n) => n.n);
112
+ const { MessageCollection } = await import("./chunks/MessageCollection-DTcvlo_u.js").then((n) => n.n);
113
113
  return await (await MessageCollection.create(this.options)).get({ id: this.messageId });
114
114
  }
115
115
  /**
@@ -1056,7 +1056,7 @@ var EmailAccount = class extends Account {
1056
1056
  for (const folderName of foldersToSync) try {
1057
1057
  let folder = await folderCollection.getByPath(accountId, folderName);
1058
1058
  if (!folder) {
1059
- const { EmailFolder } = await import("./chunks/EmailFolder-Dk4hxikK.js").then((n) => n.n);
1059
+ const { EmailFolder } = await import("./chunks/EmailFolder-DFj8EDOE.js").then((n) => n.n);
1060
1060
  folder = new EmailFolder({
1061
1061
  ...this.childOptions(),
1062
1062
  accountId,
@@ -1081,7 +1081,7 @@ var EmailAccount = class extends Account {
1081
1081
  result.messagesSkipped++;
1082
1082
  continue;
1083
1083
  }
1084
- const { Email } = await import("./chunks/Email-p5qIyMC5.js").then((n) => n.n);
1084
+ const { Email } = await import("./chunks/Email-Ddhzl5pT.js").then((n) => n.n);
1085
1085
  let email = existingEmail;
1086
1086
  if (!email) {
1087
1087
  email = new Email({
@@ -2,7 +2,7 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-messages",
5
- "packageVersion": "0.60.15",
5
+ "packageVersion": "0.60.17",
6
6
  "objects": {
7
7
  "@happyvertical/smrt-messages:AccountCollection": {
8
8
  "name": "accountcollection",
@@ -3,13 +3,13 @@
3
3
  "sensitiveFieldsExcluded": true,
4
4
  "generatedAt": "1970-01-01T00:00:00.000Z",
5
5
  "packageName": "@happyvertical/smrt-messages",
6
- "packageVersion": "0.60.15",
6
+ "packageVersion": "0.60.17",
7
7
  "sourceManifestPath": "dist/manifest.json",
8
8
  "agentDocPath": "AGENTS.md",
9
9
  "sourceHashes": {
10
- "manifest": "64daf724db93bd0a089432ed7ac608210ae3b54239dda033a8b1dbbeed5396bf",
11
- "packageJson": "ab034a9bfa8d82a0bd1d7cc7841a289a2af9c78a23502b184f3ecbcb78ee4f40",
12
- "agents": "fadb167e6030e31ffcd7705b097db7d914a104a4f5f7b8d30d8def2a034a0879",
10
+ "manifest": "8b04307b30c982ad1a7f65ecc9e7e08893ede5e5c26fbef93ef1fa5ba8ebe168",
11
+ "packageJson": "075b77bb345681965fe02cb737cdb92accd1e82c4ec8a6e3a33914dd055d368b",
12
+ "agents": "982506bdb93396f2cba5ca381c00b3e016199c2852e8f05eec27dc2de40ea106",
13
13
  "moduleDoc:agents/notification-outbox.md": "0e9a870c4b2d5f0fec47af0dff6e61d216fb0121d384d99bccfc506beb6e38ad",
14
14
  "moduleDoc:agents/profile-recipients.md": "1b6710bf646ddeafd6836df8270fcbb8e29226dceda716a693d945cc2e914606"
15
15
  },
@@ -12910,7 +12910,7 @@
12910
12910
  "polymorphicAssociations": 0,
12911
12911
  "uuidColumns": 114
12912
12912
  },
12913
- "agentDoc": "# @happyvertical/smrt-messages\n\nMulti-channel messaging with STI hierarchies for both messages and accounts. Credential encryption via smrt-secrets.\n\n## STI Hierarchies\n\n**Messages** (share `messages` table):\n- `Message` (base): accountId, personaId, endpointId, correlationId, threadId, subject, body, fromAddress, toAddresses (JSON), sendStatus (draft/sending/sent/failed), retryCount\n- `Email`: messageId (RFC 822), inReplyTo, ccAddresses, bccAddresses, htmlBody, textBody, folderId, labels, headers\n- `Tweet`: tweetId, retweetCount, likeCount, mediaUrls, hashtags, mentions\n- `SlackMessage`: channelId, slackTs, slackThreadTs, reactions, blocks\n\n**Accounts** (share `accounts` table):\n- `Account` (base): channelType, providerType, public configuration,\n credentialSecretId, isActive, lastSyncAt, deprecated sensitive settings\n- `EmailAccount`, `TwitterAccount`, `SlackAccount`, `ZulipAccount`,\n `TelegramAccount`: provider-specific identity/sender behavior\n\n## Persona messaging\n\n- `MessagingEndpoint`: tenant-owned, write-only destination JSON with masked\n display helper.\n- `PersonaMessageRoute`: persona → account + endpoint, selected by purpose and\n descending priority.\n- `PersonaMessagingService`: persists and sends through an enabled route.\n- Provider registry: public setup descriptors + optional sender factory. Keep\n channel (`sms`) separate from provider (`twilio`).\n- Permissions: `messages.send`, `messages.manage-routes`,\n `messages.manage-credentials`.\n- `MessagingSettingsService` is the permissioned server boundary;\n its host-supplied `resolvePersonaTenantId` proves cross-package ownership.\n `MessagingSettingsPanel` is the callback-driven Svelte surface.\n- Account, endpoint, and route generated surfaces are read-only. Do not add\n generated mutations around the settings service or make secret fields writable.\n- **Recipe `messages.slack`** (`src/recipes.ts`, help in `src/help/slack.md`): lists Slack messages and workspaces beside the Mailbox and Notifications recipes; workspaces stay read-only and sending goes through the senders, not generated routes. Fields it shows carry `@field({ description })` in plain words; keep them when editing the models.\n\n## In-app notifications (`UserNotification`)\n\nThe in-app channel: one stored row per person, with read state.\n`user_notifications`: `tenantId` (required), `recipientUserId`\n(`@crossPackageRef` smrt-users:User, uuid), `kind`, `title`, `body`, `href`,\n`severity` (info/success/warning/error), `sourceRef`, `occurredAt`, `readAt`,\n`dismissedAt`. Conflict identity `(tenant_id, recipient_user_id, source_ref)`.\n\n- `UserNotificationService` is the only access path: `notify()` /\n `notifyMany()` (dedupe on `sourceRef`, existing row returned untouched;\n a unique ref is generated when omitted), `listForUser()` / `countUnread()`\n across explicit `tenantIds` (each read under `withTenant`), `markRead()`,\n `dismiss()` (also marks read), `markAllRead()`. Every write filters on the\n recipient, so another user's id matches nothing.\n- Generated REST/MCP/CLI are off (`api`/`mcp`/`cli: false`): a tenant-scoped\n list would expose every member's rows. Hosts expose their own routes that\n pass the signed-in user's id, never a request-chosen one.\n- Hosts decide who is told (e.g. `SocialPost.createdByUserId` for a failed\n post). New table: consumers run `db:migrate`.\n\n## Notification email outbox (`NotificationDelivery`)\n\n`NotificationOutboxService` is the external-channel counterpart of\n`UserNotificationService`: `enqueueEmail()` stores one delivery per\n`(tenant, recipient, channel, sourceRef)` after the host resolves the\nrecipient address and same-tenant sender account (callers never choose an\naddress); `dispatchDue()` leases due rows by compare-and-set\n(`NotificationDelivery.transition()`), creates the single outbound `Email`\nunder the lease, and settles sent/retry/failed/uncertain. Never resend an\n`uncertain` row automatically. Contract, retry, and reconciliation policy:\n[agents/notification-outbox.md](agents/notification-outbox.md). New table:\nconsumers run `db:migrate`.\n\n`NotificationOptOut` (`notification_opt_outs`, tenant-required, generated\nsurfaces off) is the per-recipient opt-out ledger for the outbox's\n`isSuppressed` hook, keyed `(tenant, recipient, channel, scope)` with scope `*`\nor `project:<uuid>`-style keys. `NotificationOptOutService`: idempotent\n`optOut`/`optIn` (with a `principal` only `userId === recipientUserId` may\nchange a row, and only in the principal's own `tenantId`, else\n`NotificationOptOutDeniedError`; no principal = trusted host code), trusted `isOptedOut` (a `*` row matches every scope), `listForRecipient`\n(principal required). `optOutSuppression(service, scopeOf)` builds the\n`isSuppressed` function. Details in the outbox doc; consumers run `db:migrate`.\n\n## Credential Security\n\nAccount credentials stored via tenant-bound `credentialSecretId` →\nsmrt-secrets. Use `setCredentials()`/`getCredentials()` — never store passwords\ndirectly. Credential descriptor schemas contain field definitions, never values.\n\n## Send Lifecycle\n\n`message.send()`: resolves account → creates provider sender → updates sendStatus. Retry support with `maxRetries` budget.\nA failure the provider may still have accepted carries\n`MessageSendResult.outcomeUnknown` (set by `EmailSender` unless\n`isDefiniteSendRejection()` proves a refusal, and when a sender throws) and is\npersisted as `metadata.sendOutcomeUnknown`; never auto-resend it.\n`EmailSender` attaches the message's stored `Attachment` rows (read through\n`Attachment.readContent()`, under the message's tenant context) plus\n`SendEmailOptions.attachments` bytes; an unreadable or file-less row fails the\nsend with the error on `sendError`, never a silent drop (#3808).\n`PersonaMessagingService.send({ attachments })` accepts them on email routes only.\n\n## Provider entry points (bundle boundary, #1979)\n\nThe package root is provider-neutral: models, collections, services,\npermissions, and the provider registry carry **zero provider-SDK weight**.\nProvider SDK wrappers (`@happyvertical/email`, `@happyvertical/messages`) are\nreachable only through explicit entry points, imported once at server startup:\n\n```ts\nimport '@happyvertical/smrt-messages/providers/email'; // smtp/imap/pop3/gmail\nimport '@happyvertical/smrt-messages/providers/slack';\nimport '@happyvertical/smrt-messages/providers/twitter';\nimport '@happyvertical/smrt-messages/providers/all'; // all of the above\n```\n\n- Without the matching entry, `EmailAccount.createClient()` (send + mailbox\n sync) throws an actionable error and `SlackSender`/`TweetSender` return a\n failure result naming the entry to import. Telegram and Zulip are\n fetch-based and always work from the root.\n- Builtin registry definitions stay metadata-only (setup fields for UIs); the\n entries upgrade them with `createEmailClient`/`createMessageClient`/\n `createSender` hooks. Never import a provider SDK from any module reachable\n from `src/index.ts` — the consumer bundle gate (`packages/bundle-gate`)\n fails CI when one becomes reachable.\n- `Attachment.readContent()` loads `@happyvertical/files` through core's\n `importOptionalDependency` boundary and keeps its null-on-failure contract\n in builds where the SDK is absent.\n\n## Gotchas\n\n- **Manifest before decorators**: every decorated model imports\n `../__smrt-register__.js`, and `package.json#sideEffects` lists\n `./src/__smrt-register__.ts`. Without both, the library build dropped or\n reordered the self-registration, so dist classes registered with only their\n decorated fields and could adopt smrt-ledgers' same-named `Account` (#3098).\n- **`Account` is not unique**: smrt-ledgers also declares `Account` (on\n `ledger_accounts`). Resolve by constructor or qualified name; the\n coexistence tests (`ledger-account-identity-*`, and the PostgreSQL lane\n `pnpm test:postgres`) load both packages in both orders.\n- **STI `_meta_type`**: qualified format `@happyvertical/smrt-messages:Email`\n- **JSON fields**: all address/metadata fields are JSON strings with `getX()`/`setX()` helpers\n- **RFC 822 threading**: Email uses `inReplyTo`/`messageId`/`references` — manual management required\n- **Attachment.messageId**: use this field (not `emailId`); old getter/setter mapped via deprecation wrapper\n- **Optional tenancy**: `@TenantScoped({ mode: 'optional' })` on Message, Account, Attachment\n- **Required tenancy**: endpoints and persona routes are always tenant scoped\n- **Secrets are write-only**: never serialize credentials or endpoint.address to an app\n\n## Intake byte snapshots\n\n`EmailAccount.readIntakeMessage(providerLookup, maxBytes, imapIdentity?)` is the authorized host seam for\nopt-in ingestion. It copies full-message attachment bytes from the registered\nemail provider and fails when only attachment metadata is available; it never\nreads provider-supplied paths or advances sync checkpoints. Keep this path\nprovider-neutral and exclude arbitrary headers/credentials from its snapshot.\nIMAP lookup must include folder/UIDVALIDITY/UID verification; sender Message-ID\nis a lookup hint, never the durable delivery identity.\n\nProtected notification Emails carry durable delivery provenance. Their canonical\n`send`/`retrySend`, ordinary save/delete, and default EmailSender handoff are\nconstrained by `protected-notification-handoff.ts` (package-private, never a root\nexport). Only the outbox enters its exact one-use scope after current trusted\npolicy/byte validation. Preserve old-row/constructor identity checks, current\npersisted lease checks at the actual provider boundary, copied byte buffers and\nunknown-outcome marker protection. See the outbox contract and shared protected\nhandoff suite (SQLite and migrated PostgreSQL).\n\n## Protected external contacts\n\nProfile email uses exclusive `recipientProfileId` plus `resolveProfileRecipient`, a reserved `profileNotificationPolicy` and exact current tenant-owned public Profile email. No User account is required. Before activating profiles, run normal framework schema migration and public `planNotificationProfileRecipients` / `migrateNotificationProfileRecipients`; runtime verifies physical constraints and never applies DDL. Legacy User notification and opt-out paths remain User-only. See [profile recipient contract and matrix](agents/profile-recipients.md).\n",
12913
+ "agentDoc": "# @happyvertical/smrt-messages\n\nMulti-channel messaging with STI hierarchies for both messages and accounts. Credential encryption via smrt-secrets.\n\n## STI Hierarchies\n\n**Messages** (share `messages` table):\n- `Message` (base): accountId, personaId, endpointId, correlationId, threadId, subject, body, fromAddress, toAddresses (JSON), sendStatus (draft/sending/sent/failed), retryCount\n- `Email`: messageId (RFC 822), inReplyTo, ccAddresses, bccAddresses, htmlBody, textBody, folderId, labels, headers\n- `Tweet`: tweetId, retweetCount, likeCount, mediaUrls, hashtags, mentions\n- `SlackMessage`: channelId, slackTs, slackThreadTs, reactions, blocks\n\n**Accounts** (share `accounts` table):\n- `Account` (base): channelType, providerType, public configuration,\n credentialSecretId, isActive, lastSyncAt, deprecated sensitive settings\n- `EmailAccount`, `TwitterAccount`, `SlackAccount`, `ZulipAccount`,\n `TelegramAccount`: provider-specific identity/sender behavior\n\n## Persona messaging\n\n- `MessagingEndpoint`: tenant-owned, write-only destination JSON with masked\n display helper.\n- `PersonaMessageRoute`: persona → account + endpoint, selected by purpose and\n descending priority.\n- `PersonaMessagingService`: persists and sends through an enabled route.\n- Provider registry: public setup descriptors + optional sender factory. Keep\n channel (`sms`) separate from provider (`twilio`).\n- Permissions: `messages.send`, `messages.manage-routes`,\n `messages.manage-credentials`.\n- `MessagingSettingsService` is the permissioned server boundary;\n its host-supplied `resolvePersonaTenantId` proves cross-package ownership.\n `MessagingSettingsPanel` is the callback-driven Svelte surface.\n- Account, endpoint, and route generated surfaces are read-only. Do not add\n generated mutations around the settings service or make secret fields writable.\n- **Recipe `messages.slack`** (`src/recipes.ts`, help in `src/help/slack.md`): lists Slack messages and workspaces beside the Mailbox and Notifications recipes; workspaces stay read-only and sending goes through the senders, not generated routes. Fields it shows carry `@field({ description })` in plain words; keep them when editing the models.\n\n## In-app notifications (`UserNotification`)\n\nThe in-app channel: one stored row per person, with read state.\n`user_notifications`: `tenantId` (required), `recipientUserId`\n(`@crossPackageRef` smrt-users:User, uuid), `kind`, `title`, `body`, `href`,\n`severity` (info/success/warning/error), `sourceRef`, `occurredAt`, `readAt`,\n`dismissedAt`. Conflict identity `(tenant_id, recipient_user_id, source_ref)`.\n\n- `UserNotificationService` is the only access path: `notify()` /\n `notifyMany()` (dedupe on `sourceRef`, existing row returned untouched;\n a unique ref is generated when omitted), `listForUser()` / `countUnread()`\n across explicit `tenantIds` (each read under `withTenant`), `markRead()`,\n `dismiss()` (also marks read), `markAllRead()`. Every write filters on the\n recipient, so another user's id matches nothing.\n- Generated REST/MCP/CLI are off (`api`/`mcp`/`cli: false`): a tenant-scoped\n list would expose every member's rows. Hosts expose their own routes that\n pass the signed-in user's id, never a request-chosen one.\n- Hosts decide who is told (e.g. `SocialPost.createdByUserId` for a failed\n post). New table: consumers run `db:migrate`.\n\n## Notification email outbox (`NotificationDelivery`)\n\n`NotificationOutboxService` is the external-channel counterpart of\n`UserNotificationService`: `enqueueEmail()` stores one delivery per\n`(tenant, recipient, channel, sourceRef)` after the host resolves the\nrecipient address and same-tenant sender account (callers never choose an\naddress); `dispatchDue()` leases due rows by compare-and-set\n(`NotificationDelivery.transition()`), creates the single outbound `Email`\nunder the lease, and settles sent/retry/failed/uncertain. Never resend an\n`uncertain` row automatically. Contract, retry, and reconciliation policy:\n[agents/notification-outbox.md](agents/notification-outbox.md). New table:\nconsumers run `db:migrate`.\n\n`NotificationOptOut` (`notification_opt_outs`, tenant-required, generated\nsurfaces off) is the per-recipient opt-out ledger for the outbox's\n`isSuppressed` hook, keyed `(tenant, recipient, channel, scope)` with scope `*`\nor `project:<uuid>`-style keys. `NotificationOptOutService`: idempotent\n`optOut`/`optIn` (with a `principal` only `userId === recipientUserId` may\nchange a row, and only in the principal's own `tenantId`, else\n`NotificationOptOutDeniedError`; no principal = trusted host code), trusted `isOptedOut` (a `*` row matches every scope), `listForRecipient`\n(principal required). `optOutSuppression(service, scopeOf)` builds the\n`isSuppressed` function. Details in the outbox doc; consumers run `db:migrate`.\n\n## Credential Security\n\nAccount credentials stored via tenant-bound `credentialSecretId` →\nsmrt-secrets. Use `setCredentials()`/`getCredentials()` — never store passwords\ndirectly. Credential descriptor schemas contain field definitions, never values.\n\n## Send Lifecycle\n\n`message.send()`: resolves account → creates provider sender → updates sendStatus. Retry support with `maxRetries` budget.\nA failure the provider may still have accepted carries\n`MessageSendResult.outcomeUnknown` (set by `EmailSender` unless\n`isDefiniteSendRejection()` proves a refusal, and when a sender throws) and is\npersisted as `metadata.sendOutcomeUnknown`; never auto-resend it.\n`EmailSender` attaches the message's stored `Attachment` rows (read through\n`Attachment.readContent()`, under the message's tenant context) plus\n`SendEmailOptions.attachments` bytes; an unreadable or file-less row fails the\nsend with the error on `sendError`, never a silent drop (#3808).\n`PersonaMessagingService.send({ attachments })` accepts them on email routes only.\n\n## Provider entry points (bundle boundary, #1979)\n\nThe package root is provider-neutral: models, collections, services,\npermissions, and the provider registry carry **zero provider-SDK weight**.\nProvider SDK wrappers (`@happyvertical/email`, `@happyvertical/messages`) are\nreachable only through explicit entry points, imported once at server startup:\n\n```ts\nimport '@happyvertical/smrt-messages/providers/email'; // smtp/imap/pop3/gmail\nimport '@happyvertical/smrt-messages/providers/slack';\nimport '@happyvertical/smrt-messages/providers/twitter';\nimport '@happyvertical/smrt-messages/providers/all'; // all of the above\n```\n\n- Without the matching entry, `EmailAccount.createClient()` (send + mailbox\n sync) throws an actionable error and `SlackSender`/`TweetSender` return a\n failure result naming the entry to import. Telegram and Zulip are\n fetch-based and always work from the root.\n- Builtin registry definitions stay metadata-only (setup fields for UIs); the\n entries upgrade them with `createEmailClient`/`createMessageClient`/\n `createSender` hooks. Never import a provider SDK from any module reachable\n from `src/index.ts` — the consumer bundle gate (`packages/bundle-gate`)\n fails CI when one becomes reachable.\n- `Attachment.readContent()` loads `@happyvertical/files` through core's\n `importOptionalDependency` boundary and keeps its null-on-failure contract\n in builds where the SDK is absent.\n\n## Gotchas\n\n- **Manifest before decorators**: every decorated model imports\n `../__smrt-register__.js`, and `package.json#sideEffects` lists\n `./src/__smrt-register__.ts`. Without both, the library build dropped or\n reordered the self-registration, so dist classes registered with only their\n decorated fields and could adopt smrt-ledgers' same-named `Account` (#3098).\n- **`Account` is not unique**: smrt-ledgers also declares `Account` (on\n `ledger_accounts`). Resolve by constructor or qualified name; the\n coexistence tests (`ledger-account-identity-*`, and the PostgreSQL lane\n `pnpm test:postgres`) load both packages in both orders.\n Both declare the `accounts` collection, so registering the ledgers `Account`\n auto-loads this family from its manifest as STI siblings. Core loads this\n base with them and never takes the ledgers `Account` for it (#4735,\n `ledger-account-identity-sti-siblings.test.ts`).\n- **STI `_meta_type`**: qualified format `@happyvertical/smrt-messages:Email`\n- **JSON fields**: all address/metadata fields are JSON strings with `getX()`/`setX()` helpers\n- **RFC 822 threading**: Email uses `inReplyTo`/`messageId`/`references` — manual management required\n- **Attachment.messageId**: use this field (not `emailId`); old getter/setter mapped via deprecation wrapper\n- **Optional tenancy**: `@TenantScoped({ mode: 'optional' })` on Message, Account, Attachment\n- **Required tenancy**: endpoints and persona routes are always tenant scoped\n- **Secrets are write-only**: never serialize credentials or endpoint.address to an app\n\n## Intake byte snapshots\n\n`EmailAccount.readIntakeMessage(providerLookup, maxBytes, imapIdentity?)` is the authorized host seam for\nopt-in ingestion. It copies full-message attachment bytes from the registered\nemail provider and fails when only attachment metadata is available; it never\nreads provider-supplied paths or advances sync checkpoints. Keep this path\nprovider-neutral and exclude arbitrary headers/credentials from its snapshot.\nIMAP lookup must include folder/UIDVALIDITY/UID verification; sender Message-ID\nis a lookup hint, never the durable delivery identity.\n\nProtected notification Emails carry durable delivery provenance. Their canonical\n`send`/`retrySend`, ordinary save/delete, and default EmailSender handoff are\nconstrained by `protected-notification-handoff.ts` (package-private, never a root\nexport). Only the outbox enters its exact one-use scope after current trusted\npolicy/byte validation. Preserve old-row/constructor identity checks, current\npersisted lease checks at the actual provider boundary, copied byte buffers and\nunknown-outcome marker protection. See the outbox contract and shared protected\nhandoff suite (SQLite and migrated PostgreSQL).\n\n## Protected external contacts\n\nProfile email uses exclusive `recipientProfileId` plus `resolveProfileRecipient`, a reserved `profileNotificationPolicy` and exact current tenant-owned public Profile email. No User account is required. Before activating profiles, run normal framework schema migration and public `planNotificationProfileRecipients` / `migrateNotificationProfileRecipients`; runtime verifies physical constraints and never applies DDL. Legacy User notification and opt-out paths remain User-only. See [profile recipient contract and matrix](agents/profile-recipients.md).\n",
12914
12914
  "moduleDocs": [
12915
12915
  {
12916
12916
  "path": "agents/notification-outbox.md",
@@ -5,10 +5,10 @@ description: "Unified multi-channel messaging with STI-based hierarchies"
5
5
  status: "stable"
6
6
  generated:
7
7
  by: "smrt/scripts/generate-knowledge-okf.ts"
8
- at: "2026-11-08T11:50:49Z"
8
+ at: "2026-11-09T12:20:01Z"
9
9
  audience: "internal"
10
10
  evidence_level: "source-inspected"
11
- source_revision: "sha256:98c94cbe1b459e5e653249097b9d303b5eb5f8520aa073292bb47e9750c2a913"
11
+ source_revision: "sha256:daecc7b8b53b9fa44d951b5204d887468c9b08a84b61fe91e467dae67a1202ad"
12
12
  sources:
13
13
  - id: "manifest"
14
14
  resource: "https://github.com/happyvertical/smrt/blob/main/packages/messages/package.json"
@@ -40,74 +40,78 @@ const _icon = $derived.by(() => {
40
40
  </script>
41
41
 
42
42
  <span
43
- class="avatar avatar--{size}"
44
- class:avatar--email={['imap', 'smtp', 'pop3', 'gmail'].includes(providerType)}
45
- class:avatar--slack={providerType === 'slack'}
46
- class:avatar--twitter={providerType === 'twitter'}
43
+ class="smrt-account-avatar__root smrt-account-avatar__{size}"
44
+ class:smrt-account-avatar__email={['imap', 'smtp', 'pop3', 'gmail'].includes(providerType)}
45
+ class:smrt-account-avatar__slack={providerType === 'slack'}
46
+ class:smrt-account-avatar__twitter={providerType === 'twitter'}
47
47
  title={name}
48
48
  aria-label={`${name} (${providerType})`} data-smrt-component="AccountAvatar"
49
49
  >
50
50
  {#if _icon}
51
- <span class="icon">{_icon}</span>
51
+ <span class="smrt-account-avatar__icon" data-smrt-part="icon">{_icon}</span>
52
52
  {:else}
53
- <span class="initials">{_initials}</span>
53
+ <span class="smrt-account-avatar__initials" data-smrt-part="label">{_initials}</span>
54
54
  {/if}
55
55
  </span>
56
56
 
57
57
  <style>
58
58
  @layer smrt.reset, smrt.structure, smrt.theme;
59
- @layer smrt.theme {
60
- .avatar {
59
+ @layer smrt.structure {
60
+ .smrt-account-avatar__root {
61
61
  display: inline-flex;
62
62
  align-items: center;
63
63
  justify-content: center;
64
- border-radius: var(--smrt-radius-full);
65
- background: var(--smrt-color-secondary-container);
66
- color: var(--smrt-color-on-secondary-container);
67
- font-weight: var(--smrt-typography-weight-medium, 500);
68
64
  flex-shrink: 0;
69
65
  }
70
-
71
- .avatar--sm {
66
+ .smrt-account-avatar__sm {
72
67
  width: 1.5rem;
73
68
  height: 1.5rem;
74
- font-size: var(--smrt-typography-label-small-size, 0.625rem);
75
69
  }
76
-
77
- .avatar--md {
70
+ .smrt-account-avatar__md {
78
71
  width: 2rem;
79
72
  height: 2rem;
80
- font-size: var(--smrt-typography-label-medium-size, 0.75rem);
81
73
  }
82
-
83
- .avatar--lg {
74
+ .smrt-account-avatar__lg {
84
75
  width: 2.5rem;
85
76
  height: 2.5rem;
86
- font-size: var(--smrt-typography-label-large-size, 0.875rem);
87
77
  }
78
+ }
88
79
 
89
- .avatar--email {
80
+ @layer smrt.theme {
81
+ .smrt-account-avatar__root {
82
+ border-radius: var(--smrt-radius-full);
83
+ background: var(--smrt-color-secondary-container);
84
+ color: var(--smrt-color-on-secondary-container);
85
+ font-weight: var(--smrt-typography-weight-medium, 500);
86
+ }
87
+ .smrt-account-avatar__sm {
88
+ font-size: var(--smrt-typography-label-small-size, 0.625rem);
89
+ }
90
+ .smrt-account-avatar__md {
91
+ font-size: var(--smrt-typography-label-medium-size, 0.75rem);
92
+ }
93
+ .smrt-account-avatar__lg {
94
+ font-size: var(--smrt-typography-label-large-size, 0.875rem);
95
+ }
96
+ .smrt-account-avatar__email {
90
97
  background: var(--smrt-color-primary-container);
91
98
  color: var(--smrt-color-on-primary-container);
92
99
  }
93
-
94
- .avatar--slack {
100
+ .smrt-account-avatar__slack {
95
101
  background: var(--smrt-color-tertiary-container);
96
102
  color: var(--smrt-color-on-tertiary-container);
97
103
  }
98
-
99
- .avatar--twitter {
104
+ .smrt-account-avatar__twitter {
100
105
  background: var(--smrt-color-secondary-container);
101
106
  color: var(--smrt-color-on-secondary-container);
102
107
  }
103
-
104
- .icon {
108
+ .smrt-account-avatar__icon {
105
109
  font-size: 1.1em;
106
110
  }
107
-
108
- .initials {
111
+ .smrt-account-avatar__initials {
109
112
  text-transform: uppercase;
110
113
  letter-spacing: 0.02em;
111
114
  }
112
115
  }
116
+
113
117
  </style>
@@ -32,29 +32,29 @@ const _lastSyncFormatted = $derived.by(() => {
32
32
  </script>
33
33
 
34
34
  <Card>
35
- <div class="account-card">
36
- <div class="account-info">
35
+ <div class="smrt-account-card__body" data-smrt-part="body">
36
+ <div class="smrt-account-card__header" data-smrt-part="header">
37
37
  <AccountAvatar providerType={account.providerType} name={account.name} size="lg" />
38
- <div class="details">
39
- <h3 class="name">{account.name}</h3>
38
+ <div class="smrt-account-card__content" data-smrt-part="body">
39
+ <h3 class="smrt-account-card__name" data-smrt-part="title">{account.name}</h3>
40
40
  {#if account.email}
41
- <span class="email">{account.email}</span>
41
+ <span class="smrt-account-card__email" data-smrt-part="meta">{account.email}</span>
42
42
  {/if}
43
- <span class="provider">{account.providerType}</span>
43
+ <span class="smrt-account-card__provider" data-smrt-part="meta">{account.providerType}</span>
44
44
  </div>
45
45
  </div>
46
46
 
47
- <div class="status-row">
48
- <span class="status" class:status--active={account.isActive} class:status--inactive={!account.isActive}>
47
+ <div class="smrt-account-card__meta" data-smrt-part="meta">
48
+ <span class="smrt-account-card__status" class:smrt-account-card__status--active={account.isActive} class:smrt-account-card__status--inactive={!account.isActive} data-smrt-part="badge">
49
49
  {account.isActive ? 'Active' : 'Inactive'}
50
50
  </span>
51
- <span class="sync-time">{_lastSyncFormatted}</span>
51
+ <span class="smrt-account-card__sync-time" data-smrt-part="time">{_lastSyncFormatted}</span>
52
52
  {#if account.unreadCount !== undefined}
53
- <span class="unread-count">{account.unreadCount} unread</span>
53
+ <span class="smrt-account-card__unread-count" data-smrt-part="count">{account.unreadCount} unread</span>
54
54
  {/if}
55
55
  </div>
56
56
 
57
- <div class="actions">
57
+ <div class="smrt-account-card__actions" data-smrt-part="actions">
58
58
  {#if onsync && account.isActive}
59
59
  <Button variant="ghost" size="sm" class="action-btn" onclick={() => onsync?.(account)}>
60
60
  Sync
@@ -81,110 +81,119 @@ const _lastSyncFormatted = $derived.by(() => {
81
81
 
82
82
  <style>
83
83
  @layer smrt.reset, smrt.structure, smrt.theme;
84
- @layer smrt.theme {
85
- .account-card {
84
+ @layer smrt.structure {
85
+ .smrt-account-card__body {
86
86
  display: flex;
87
87
  flex-direction: column;
88
88
  gap: 0.75rem;
89
89
  }
90
-
91
- .account-info {
90
+ .smrt-account-card__header {
92
91
  display: flex;
93
92
  align-items: center;
94
93
  gap: 0.75rem;
95
94
  }
96
-
97
- .details {
95
+ .smrt-account-card__content {
98
96
  display: flex;
99
97
  flex-direction: column;
100
98
  gap: 0.125rem;
101
99
  min-width: 0;
102
100
  }
103
-
104
- .name {
101
+ .smrt-account-card__name {
105
102
  margin: 0;
106
- font: var(--smrt-typography-title-medium-font, 500 1rem / 1.25 sans-serif);
107
- color: var(--smrt-color-on-surface);
108
103
  }
109
-
110
- .email {
111
- font: var(--smrt-typography-body-small-font, 0.75rem / 1.33 sans-serif);
112
- color: var(--smrt-color-on-surface-variant);
104
+ .smrt-account-card__email {
113
105
  overflow: hidden;
114
106
  text-overflow: ellipsis;
115
107
  white-space: nowrap;
116
108
  }
109
+ .smrt-account-card__meta {
110
+ display: flex;
111
+ align-items: center;
112
+ gap: 0.75rem;
113
+ }
114
+ .smrt-account-card__status {
115
+ padding: 0.125rem 0.375rem;
116
+ }
117
+ .smrt-account-card__actions {
118
+ display: flex;
119
+ gap: 0.375rem;
120
+ }
121
+ /*
122
+ * The action buttons now render through smrt-ui's <Button variant="ghost">.
123
+ * Svelte scopes `.action-btn` to this component, but the <button> is emitted
124
+ * inside the Button child, so a plain `.action-btn {}` rule would not match —
125
+ * `.smrt-account-card__actions :global(.action-btn)` anchors on `.smrt-account-card__actions` (a real element here)
126
+ * and pierces into the child (issue #1589). These overrides keep the original
127
+ * outlined-surface look (border/radius/color); the modifier class is
128
+ * `action-btn--danger`, NOT `danger`, so it never collides with Button's own
129
+ * `.danger` variant class.
130
+ */
131
+ .smrt-account-card__actions :global(.action-btn) {
132
+ padding: 0.375rem 0.75rem;
133
+ }
134
+ }
117
135
 
118
- .provider {
136
+ @layer smrt.theme {
137
+ .smrt-account-card__name {
138
+ font: var(--smrt-typography-title-medium-font, 500 1rem / 1.25 sans-serif);
139
+ color: var(--smrt-color-on-surface);
140
+ }
141
+ .smrt-account-card__email {
142
+ font: var(--smrt-typography-body-small-font, 0.75rem / 1.33 sans-serif);
143
+ color: var(--smrt-color-on-surface-variant);
144
+ }
145
+ .smrt-account-card__provider {
119
146
  font: var(--smrt-typography-label-small-font, 500 0.6875rem / 1 sans-serif);
120
147
  color: var(--smrt-color-on-surface-variant);
121
148
  text-transform: uppercase;
122
149
  letter-spacing: 0.05em;
123
150
  }
124
-
125
- .status-row {
126
- display: flex;
127
- align-items: center;
128
- gap: 0.75rem;
151
+ .smrt-account-card__meta {
129
152
  font: var(--smrt-typography-body-small-font, 0.75rem / 1.33 sans-serif);
130
153
  }
131
-
132
- .status {
133
- padding: 0.125rem 0.375rem;
154
+ .smrt-account-card__status {
134
155
  border-radius: var(--smrt-radius-small, 0.25rem);
135
156
  font-weight: var(--smrt-typography-weight-medium, 500);
136
157
  }
137
-
138
- .status--active {
158
+ .smrt-account-card__status--active {
139
159
  background: var(--smrt-color-tertiary-container);
140
160
  color: var(--smrt-color-on-tertiary-container);
141
161
  }
142
-
143
- .status--inactive {
162
+ .smrt-account-card__status--inactive {
144
163
  background: var(--smrt-color-surface-variant);
145
164
  color: var(--smrt-color-on-surface-variant);
146
165
  }
147
-
148
- .sync-time {
166
+ .smrt-account-card__sync-time {
149
167
  color: var(--smrt-color-on-surface-variant);
150
168
  }
151
-
152
- .unread-count {
169
+ .smrt-account-card__unread-count {
153
170
  font-weight: var(--smrt-typography-weight-medium, 500);
154
171
  color: var(--smrt-color-primary);
155
172
  }
156
-
157
- .actions {
158
- display: flex;
159
- gap: 0.375rem;
160
- }
161
-
162
173
  /*
163
- * The action buttons now render through smrt-ui's <Button variant="ghost">.
164
- * Svelte scopes `.action-btn` to this component, but the <button> is emitted
165
- * inside the Button child, so a plain `.action-btn {}` rule would not match —
166
- * `.actions :global(.action-btn)` anchors on `.actions` (a real element here)
167
- * and pierces into the child (issue #1589). These overrides keep the original
168
- * outlined-surface look (border/radius/color); the modifier class is
169
- * `action-btn--danger`, NOT `danger`, so it never collides with Button's own
170
- * `.danger` variant class.
171
- */
172
- .actions :global(.action-btn) {
173
- padding: 0.375rem 0.75rem;
174
+ * The action buttons now render through smrt-ui's <Button variant="ghost">.
175
+ * Svelte scopes `.action-btn` to this component, but the <button> is emitted
176
+ * inside the Button child, so a plain `.action-btn {}` rule would not match —
177
+ * `.smrt-account-card__actions :global(.action-btn)` anchors on `.smrt-account-card__actions` (a real element here)
178
+ * and pierces into the child (issue #1589). These overrides keep the original
179
+ * outlined-surface look (border/radius/color); the modifier class is
180
+ * `action-btn--danger`, NOT `danger`, so it never collides with Button's own
181
+ * `.danger` variant class.
182
+ */
183
+ .smrt-account-card__actions :global(.action-btn) {
174
184
  border: var(--smrt-hairline-strong);
175
185
  border-radius: var(--smrt-radius-small, 0.25rem);
176
186
  background: var(--smrt-color-surface);
177
187
  color: var(--smrt-color-on-surface);
178
188
  font: var(--smrt-typography-label-medium-font, 500 0.75rem / 1.33 sans-serif);
179
189
  }
180
-
181
- .actions :global(.action-btn):hover {
190
+ .smrt-account-card__actions :global(.action-btn):hover {
182
191
  background: var(--smrt-color-surface-variant);
183
192
  }
184
-
185
- .actions :global(.action-btn--danger) {
193
+ .smrt-account-card__actions :global(.action-btn--danger) {
186
194
  color: var(--smrt-color-error);
187
195
  border-color: var(--smrt-color-error);
188
196
  }
189
197
  }
198
+
190
199
  </style>
@@ -56,13 +56,13 @@ function handleAccountKeydown(event: KeyboardEvent, account: AccountData) {
56
56
  }
57
57
  </script>
58
58
 
59
- <div class="account-list" role="list" aria-label={t(M['messages.account_list.accounts'])} data-smrt-component="AccountList">
59
+ <div class="smrt-account-list__root" role="list" aria-label={t(M['messages.account_list.accounts'])} data-smrt-component="AccountList">
60
60
  {#if loading}
61
- <div class="loading" role="status" aria-live="polite">
61
+ <div class="smrt-account-list__message" role="status" aria-live="polite" data-smrt-part="message">
62
62
  <p>{t(M['messages.account_list.loading'])}</p>
63
63
  </div>
64
64
  {:else if accounts.length === 0}
65
- <div class="empty" role="status" aria-live="polite">
65
+ <div class="smrt-account-list__empty" role="status" aria-live="polite" data-smrt-part="empty">
66
66
  <p>{t(M['messages.account_list.empty'])}</p>
67
67
  </div>
68
68
  {:else}
@@ -91,17 +91,23 @@ function handleAccountKeydown(event: KeyboardEvent, account: AccountData) {
91
91
 
92
92
  <style>
93
93
  @layer smrt.reset, smrt.structure, smrt.theme;
94
+ @layer smrt.structure {
95
+ .smrt-account-list__message,
96
+ .smrt-account-list__empty {
97
+ padding: var(--smrt-spacing-3xl, 3rem);
98
+ }
99
+ }
100
+
94
101
  @layer smrt.theme {
95
- .loading,
96
- .empty {
102
+ .smrt-account-list__message,
103
+ .smrt-account-list__empty {
97
104
  text-align: center;
98
- padding: var(--smrt-spacing-3xl, 3rem);
99
105
  color: var(--smrt-color-on-surface-variant);
100
106
  }
101
-
102
- .loading p,
103
- .empty p {
107
+ .smrt-account-list__message p,
108
+ .smrt-account-list__empty p {
104
109
  font: var(--smrt-typography-body-large-font, 1.125rem / 1.5 sans-serif);
105
110
  }
106
111
  }
112
+
107
113
  </style>
@@ -42,82 +42,97 @@ const _formattedSize = $derived.by(() => {
42
42
  onclick={() => onclick?.(attachment)}
43
43
  title={`${attachment.filename} (${_formattedSize})`}
44
44
  >
45
- <span class="icon">{_icon}</span>
46
- <span class="name">{attachment.filename}</span>
47
- <span class="size">{_formattedSize}</span>
45
+ <span class="smrt-attachment-chip__icon" data-smrt-part="icon">{_icon}</span>
46
+ <span class="smrt-attachment-chip__name" data-smrt-part="title">{attachment.filename}</span>
47
+ <span class="smrt-attachment-chip__size" data-smrt-part="meta">{_formattedSize}</span>
48
48
  </Button>
49
49
  {:else}
50
- <span class="chip" title={`${attachment.filename} (${_formattedSize})`} data-smrt-component="AttachmentChip">
51
- <span class="icon">{_icon}</span>
52
- <span class="name">{attachment.filename}</span>
53
- <span class="size">{_formattedSize}</span>
50
+ <span class="smrt-attachment-chip__root" title={`${attachment.filename} (${_formattedSize})`} data-smrt-component="AttachmentChip">
51
+ <span class="smrt-attachment-chip__icon" data-smrt-part="icon">{_icon}</span>
52
+ <span class="smrt-attachment-chip__name" data-smrt-part="title">{attachment.filename}</span>
53
+ <span class="smrt-attachment-chip__size" data-smrt-part="meta">{_formattedSize}</span>
54
54
  </span>
55
55
  {/if}
56
56
 
57
57
  <style>
58
58
  @layer smrt.reset, smrt.structure, smrt.theme;
59
- @layer smrt.theme {
60
- .chip {
59
+ @layer smrt.structure {
60
+ .smrt-attachment-chip__root {
61
61
  display: inline-flex;
62
62
  align-items: center;
63
63
  gap: 0.375rem;
64
64
  padding: 0.25rem 0.625rem;
65
- border-radius: var(--smrt-radius-small, 0.25rem);
66
- background: var(--smrt-color-surface-variant);
67
- color: var(--smrt-color-on-surface-variant);
68
- font: var(--smrt-typography-label-medium-font, 500 0.75rem / 1.33 sans-serif);
69
- border: none;
70
65
  cursor: default;
71
66
  max-width: 200px;
72
67
  }
73
-
74
68
  /*
75
- * The interactive chip now renders through smrt-ui's <Button variant="ghost">.
76
- * The <button> is emitted inside the Button child carrying Button's scope hash,
77
- * so the local `.chip` rule above no longer reaches it. `:global(.chip--button)`
78
- * pierces that scope to give the button the same chip styling plus the
79
- * pressable affordances; `chip--button` is a non-colliding modifier (issue
80
- * #1589). The non-interactive `<span class="chip">` branch still uses the
81
- * scoped `.chip` rule above.
82
- */
69
+ * The interactive chip now renders through smrt-ui's <Button variant="ghost">.
70
+ * The <button> is emitted inside the Button child carrying Button's scope hash,
71
+ * so the local `.smrt-attachment-chip__root` rule above no longer reaches it. `:global(.chip--button)`
72
+ * pierces that scope to give the button the same chip styling plus the
73
+ * pressable affordances; `chip--button` is a non-colliding modifier (issue
74
+ * #1589). The non-interactive `<span class="smrt-attachment-chip__root">` branch still uses the
75
+ * scoped `.smrt-attachment-chip__root` rule above.
76
+ */
83
77
  :global(.chip.chip--button) {
84
78
  display: inline-flex;
85
79
  align-items: center;
86
80
  gap: 0.375rem;
87
81
  padding: 0.25rem 0.625rem;
82
+ cursor: pointer;
83
+ max-width: 200px;
84
+ }
85
+ .smrt-attachment-chip__icon {
86
+ flex-shrink: 0;
87
+ }
88
+ .smrt-attachment-chip__name {
89
+ overflow: hidden;
90
+ text-overflow: ellipsis;
91
+ white-space: nowrap;
92
+ }
93
+ .smrt-attachment-chip__size {
94
+ flex-shrink: 0;
95
+ }
96
+ }
97
+
98
+ @layer smrt.theme {
99
+ .smrt-attachment-chip__root {
100
+ border-radius: var(--smrt-radius-small, 0.25rem);
101
+ background: var(--smrt-color-surface-variant);
102
+ color: var(--smrt-color-on-surface-variant);
103
+ font: var(--smrt-typography-label-medium-font, 500 0.75rem / 1.33 sans-serif);
104
+ border: none;
105
+ }
106
+ /*
107
+ * The interactive chip now renders through smrt-ui's <Button variant="ghost">.
108
+ * The <button> is emitted inside the Button child carrying Button's scope hash,
109
+ * so the local `.smrt-attachment-chip__root` rule above no longer reaches it. `:global(.chip--button)`
110
+ * pierces that scope to give the button the same chip styling plus the
111
+ * pressable affordances; `chip--button` is a non-colliding modifier (issue
112
+ * #1589). The non-interactive `<span class="smrt-attachment-chip__root">` branch still uses the
113
+ * scoped `.smrt-attachment-chip__root` rule above.
114
+ */
115
+ :global(.chip.chip--button) {
88
116
  border-radius: var(--smrt-radius-small, 0.25rem);
89
117
  background: var(--smrt-color-surface-variant);
90
118
  color: var(--smrt-color-on-surface-variant);
91
119
  font: var(--smrt-typography-label-medium-font, 500 0.75rem / 1.33 sans-serif);
92
- cursor: pointer;
93
- max-width: 200px;
94
120
  transition: background var(--smrt-duration-short2, 150ms) var(--smrt-easing-standard, ease);
95
121
  }
96
-
97
122
  :global(.chip.chip--button):hover {
98
123
  background: color-mix(in srgb, var(--smrt-color-surface-variant) 92%, var(--smrt-color-shadow));
99
124
  }
100
-
101
125
  :global(.chip.chip--button):focus-visible {
102
126
  outline: 2px solid var(--smrt-color-primary);
103
127
  outline-offset: 1px;
104
128
  }
105
-
106
- .icon {
107
- flex-shrink: 0;
129
+ .smrt-attachment-chip__icon {
108
130
  font-size: var(--smrt-typography-label-large-size, 0.875rem);
109
131
  }
110
-
111
- .name {
112
- overflow: hidden;
113
- text-overflow: ellipsis;
114
- white-space: nowrap;
115
- }
116
-
117
- .size {
118
- flex-shrink: 0;
132
+ .smrt-attachment-chip__size {
119
133
  opacity: 0.7;
120
134
  font-size: var(--smrt-typography-label-small-size, 0.6875rem);
121
135
  }
122
136
  }
137
+
123
138
  </style>