@ai-matrx/messaging 0.14.0 → 0.15.0

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # Changelog — `@ai-matrx/messaging`
2
2
 
3
+ ## 0.15.0
4
+
5
+ ### Fixed
6
+
7
+ - **A failed inbox read is never a skeleton forever, and never "empty"** (RC-B12
8
+ round 11). When the first conversation-list read failed,
9
+ `hasLoadedConversations` stayed false and the list showed its skeleton for as
10
+ long as it was open. The store now carries `conversationsLoadError`; the list
11
+ resolves to "Couldn't load your conversations" with a **Try again**
12
+ (`useConversations().retry`, `engine.refreshInbox()`), and "No conversations
13
+ yet" only follows a read that succeeded.
14
+ - **Read failures render through the design-system error slot.** "Couldn't load
15
+ this conversation" and the inbox failure are drawn with `ErrorBox` from
16
+ `@ai-matrx/design-system` (new dependency), so the host fills them with its
17
+ error actions — in AI Matrx, the Alchemy Menu. They were `EmptyState`s before,
18
+ in the same grey as "No messages yet".
19
+
20
+ ### Added
21
+
22
+ - `MessagingSnapshot.conversationsLoadError`, `MessagingStore.setConversationsLoadError`,
23
+ `MessagingEngine.refreshInbox()`, `useConversations().loadError` / `.retry`.
24
+
25
+ ## 0.14.1
26
+
27
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
28
+ `git diff npm/messaging/v0.14.0..npm/messaging/v0.14.1 -- apps/shared/messaging`).
29
+ No source changes intended and no consumer action required.
30
+
3
31
  ## 0.14.0
4
32
 
5
33
  ### Changed
@@ -811,3 +839,4 @@ consumer):
811
839
  sign-in reports `session-unavailable` instead of recovering.
812
840
  - This package supersedes host code that talks to `communication.dm_*` directly. Anything still
813
841
  reading those tables outside the package should be moved onto it or deleted.
842
+
package/dist/index.cjs CHANGED
@@ -1045,6 +1045,7 @@ function createMessagingStore() {
1045
1045
  let threads = /* @__PURE__ */ new Map();
1046
1046
  let activeConversationId = null;
1047
1047
  let conversationReadFailures = /* @__PURE__ */ new Map();
1048
+ let conversationsLoadError = null;
1048
1049
  const listeners = /* @__PURE__ */ new Set();
1049
1050
  let cached = null;
1050
1051
  function snapshot() {
@@ -1058,7 +1059,8 @@ function createMessagingStore() {
1058
1059
  totalUnreadConversations: conversations.filter((item) => item.unreadCount > 0).length,
1059
1060
  archiveFilter,
1060
1061
  archivedCount,
1061
- conversationReadFailures
1062
+ conversationReadFailures,
1063
+ conversationsLoadError
1062
1064
  };
1063
1065
  return cached;
1064
1066
  }
@@ -1103,6 +1105,12 @@ function createMessagingStore() {
1103
1105
  conversations = normalizeConversations(items);
1104
1106
  hasMoreConversations = hasMore;
1105
1107
  hasLoadedConversations = true;
1108
+ conversationsLoadError = null;
1109
+ emit();
1110
+ },
1111
+ setConversationsLoadError(message) {
1112
+ if (message === conversationsLoadError) return;
1113
+ conversationsLoadError = message;
1106
1114
  emit();
1107
1115
  },
1108
1116
  setArchiveFilter(next) {
@@ -1335,10 +1343,20 @@ function createMessagingEngine(options) {
1335
1343
  }
1336
1344
  async function reloadInbox() {
1337
1345
  if (disposed) return;
1338
- const page = await repository.listConversations({
1339
- limit: conversationPageSize,
1340
- archived: store.snapshot().archiveFilter
1341
- });
1346
+ let page;
1347
+ try {
1348
+ page = await repository.listConversations({
1349
+ limit: conversationPageSize,
1350
+ archived: store.snapshot().archiveFilter
1351
+ });
1352
+ } catch (error) {
1353
+ if (!disposed) {
1354
+ store.setConversationsLoadError(
1355
+ error instanceof Error ? error.message : typeof error === "string" ? error : "The conversation list could not be read."
1356
+ );
1357
+ }
1358
+ throw error;
1359
+ }
1342
1360
  if (disposed) return;
1343
1361
  conversationCursor = page.nextCursor;
1344
1362
  store.setConversations(page.items, page.hasMore);
@@ -1423,6 +1441,13 @@ function createMessagingEngine(options) {
1423
1441
  }
1424
1442
  });
1425
1443
  },
1444
+ async refreshInbox() {
1445
+ try {
1446
+ await reloadInbox();
1447
+ } catch (error) {
1448
+ reportError(error, "inboxRefresh");
1449
+ }
1450
+ },
1426
1451
  async setArchiveFilter(next) {
1427
1452
  if (next === store.snapshot().archiveFilter) return;
1428
1453
  store.setArchiveFilter(next);