@ai-matrx/messaging 0.6.0 → 0.8.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/dist/react.d.cts CHANGED
@@ -543,8 +543,25 @@ type MessagingSupabaseClient = SupabaseLike & RealtimeClientLike;
543
543
  * — which in a large org is every page.
544
544
  */
545
545
 
546
- /** The schema. Messaging is never in `public`. */
546
+ /** The TABLES' schema. Messaging tables are never in `public`. */
547
547
  declare const MESSAGING_SCHEMA = "communication";
548
+ /**
549
+ * 🚨 THE RPCS LIVE IN `public`, AND THE TABLES DO NOT. THIS IS NOT A TYPO.
550
+ *
551
+ * Matrx Main's messaging tables moved into `communication` during the schema
552
+ * reorg; the five auth-checked SECURITY DEFINER functions stayed in `public`,
553
+ * where PostgREST exposes them by default and where every existing caller and
554
+ * GRANT already pointed. Calling them on `communication` fails with PGRST202
555
+ * ("no matches were found in the schema cache") on EVERY read — which is what
556
+ * happened the first time this package touched the live database, and what no
557
+ * amount of checking the SQL by inspection had caught.
558
+ *
559
+ * Verify before changing either constant:
560
+ * select n.nspname, p.proname from pg_proc p
561
+ * join pg_namespace n on n.oid = p.pronamespace
562
+ * where p.proname like '%_dm_%';
563
+ */
564
+ declare const MESSAGING_RPC_SCHEMA = "public";
548
565
  declare const TABLES: {
549
566
  readonly conversations: "dm_conversations";
550
567
  readonly participants: "dm_conversation_participants";
@@ -1408,4 +1425,4 @@ declare function summarizeText(content: string, maxLength?: number): string;
1408
1425
  /** Serialize picked references into a fence the platform's other readers accept. */
1409
1426
  declare function composeFence(references: readonly MatrxReference[]): string;
1410
1427
 
1411
- export { type ActionChoice, type ActionContext, type ActionHandler, type ActionOutcome, type ActionReceipt, type ActionRegistry, type ActorPresentation, AgentTag, type AiCapability, type AiResult, AlertIcon, type Attachment, Avatar, BotIcon, CheckIcon, ChevronLeftIcon, type ClientMessageId, ClockIcon, CloseIcon, Composer, type Conversation, type ConversationCursor, type ConversationId, ConversationList, type ConversationListProps, type ConversationRowWrapperProps, ConversationSkeleton, type ConversationSummary, type ConversationThread, type ConversationType, ConversationView, type ConversationViewProps, type DeliveryState, DeliveryTick, DoubleCheckIcon, type DraftMessage, EmptyState, type EngineDiagnostic, type IncomingMessageContext, type JsonObject, type JsonValue, LinkIcon, MESSAGING_EVENTS, MESSAGING_SCHEMA, type MatrxReference, type Message, type MessageAction, MessageActionChips, type MessageActionRenderProps, type MessageActionRenderer, MessageBubble, type MessageCursor, type MessageGroup, type MessageId, type MessageKind, type MessageWrapperProps, type MessagingAgents, type MessagingAi, type MessagingAiOptions, type MessagingEngine, type MessagingEngineOptions, MessagingError, type MessagingErrorCode, type MessagingHost, type MessagingIdentity, MessagingInbox, type MessagingInboxProps, MessagingProvider, type MessagingProviderProps, type MessagingRepository, type MessagingSnapshot, type MessagingStore, type OrganizationId, type Outbox, type OutboxEntry, type OutboxOptions, type OutboxStorage, type Page, PaperclipIcon, type Participant, type ParticipantRole, PlusIcon, type PostgrestFilterLike, type PostgrestLikeResponse, type PostgrestTableLike, RPCS, type ReadCache, type ReadCacheOptions, ReferenceCard, type ReferenceRenderer, ReplyIcon, type RepositoryOptions, type SchemaLike, SearchIcon, SendIcon, type SessionResolver, SparklesIcon, type SupabaseLike, TABLES, type TextSegment, TypingDots, type UseComposerResult, type UseConversationResult, type UseConversationsResult, type UseMessageActionResult, type UseMessagingAiResult, type UseTypistsResult, type UserId, type UserSummary, UsersIcon, asClientMessageId, asConversationId, asMessageId, asOrganizationId, asUserId, composeFence, conversationTopic, createActionRegistry, createMemoryOutboxStorage, createMessagingAi, createMessagingEngine, createMessagingRepository, createMessagingStore, createOutbox, createReadCache, createWebOutboxStorage, extractReferences, formatConversationTime, formatDateSeparator, formatLastSeen, formatMessageTime, formatTypists, groupMessages, inboxTopic, invalidResponse, isSameDay, messagingClientId, normalizeMessagingError, optimisticMessage, participantNames, projectConversationSummary, projectMessage, projectMessageAction, projectParticipantRole, projectUserSummary, resolveActor, splitText, summarizeText, useComposer, useConversation, useConversations, useMessageAction, useMessagingAi, useMessagingHost, useMessagingSnapshot, useOnlineUserIds, useRequiredMessagingHost, useTypists };
1428
+ export { type ActionChoice, type ActionContext, type ActionHandler, type ActionOutcome, type ActionReceipt, type ActionRegistry, type ActorPresentation, AgentTag, type AiCapability, type AiResult, AlertIcon, type Attachment, Avatar, BotIcon, CheckIcon, ChevronLeftIcon, type ClientMessageId, ClockIcon, CloseIcon, Composer, type Conversation, type ConversationCursor, type ConversationId, ConversationList, type ConversationListProps, type ConversationRowWrapperProps, ConversationSkeleton, type ConversationSummary, type ConversationThread, type ConversationType, ConversationView, type ConversationViewProps, type DeliveryState, DeliveryTick, DoubleCheckIcon, type DraftMessage, EmptyState, type EngineDiagnostic, type IncomingMessageContext, type JsonObject, type JsonValue, LinkIcon, MESSAGING_EVENTS, MESSAGING_RPC_SCHEMA, MESSAGING_SCHEMA, type MatrxReference, type Message, type MessageAction, MessageActionChips, type MessageActionRenderProps, type MessageActionRenderer, MessageBubble, type MessageCursor, type MessageGroup, type MessageId, type MessageKind, type MessageWrapperProps, type MessagingAgents, type MessagingAi, type MessagingAiOptions, type MessagingEngine, type MessagingEngineOptions, MessagingError, type MessagingErrorCode, type MessagingHost, type MessagingIdentity, MessagingInbox, type MessagingInboxProps, MessagingProvider, type MessagingProviderProps, type MessagingRepository, type MessagingSnapshot, type MessagingStore, type OrganizationId, type Outbox, type OutboxEntry, type OutboxOptions, type OutboxStorage, type Page, PaperclipIcon, type Participant, type ParticipantRole, PlusIcon, type PostgrestFilterLike, type PostgrestLikeResponse, type PostgrestTableLike, RPCS, type ReadCache, type ReadCacheOptions, ReferenceCard, type ReferenceRenderer, ReplyIcon, type RepositoryOptions, type SchemaLike, SearchIcon, SendIcon, type SessionResolver, SparklesIcon, type SupabaseLike, TABLES, type TextSegment, TypingDots, type UseComposerResult, type UseConversationResult, type UseConversationsResult, type UseMessageActionResult, type UseMessagingAiResult, type UseTypistsResult, type UserId, type UserSummary, UsersIcon, asClientMessageId, asConversationId, asMessageId, asOrganizationId, asUserId, composeFence, conversationTopic, createActionRegistry, createMemoryOutboxStorage, createMessagingAi, createMessagingEngine, createMessagingRepository, createMessagingStore, createOutbox, createReadCache, createWebOutboxStorage, extractReferences, formatConversationTime, formatDateSeparator, formatLastSeen, formatMessageTime, formatTypists, groupMessages, inboxTopic, invalidResponse, isSameDay, messagingClientId, normalizeMessagingError, optimisticMessage, participantNames, projectConversationSummary, projectMessage, projectMessageAction, projectParticipantRole, projectUserSummary, resolveActor, splitText, summarizeText, useComposer, useConversation, useConversations, useMessageAction, useMessagingAi, useMessagingHost, useMessagingSnapshot, useOnlineUserIds, useRequiredMessagingHost, useTypists };
package/dist/react.d.ts CHANGED
@@ -543,8 +543,25 @@ type MessagingSupabaseClient = SupabaseLike & RealtimeClientLike;
543
543
  * — which in a large org is every page.
544
544
  */
545
545
 
546
- /** The schema. Messaging is never in `public`. */
546
+ /** The TABLES' schema. Messaging tables are never in `public`. */
547
547
  declare const MESSAGING_SCHEMA = "communication";
548
+ /**
549
+ * 🚨 THE RPCS LIVE IN `public`, AND THE TABLES DO NOT. THIS IS NOT A TYPO.
550
+ *
551
+ * Matrx Main's messaging tables moved into `communication` during the schema
552
+ * reorg; the five auth-checked SECURITY DEFINER functions stayed in `public`,
553
+ * where PostgREST exposes them by default and where every existing caller and
554
+ * GRANT already pointed. Calling them on `communication` fails with PGRST202
555
+ * ("no matches were found in the schema cache") on EVERY read — which is what
556
+ * happened the first time this package touched the live database, and what no
557
+ * amount of checking the SQL by inspection had caught.
558
+ *
559
+ * Verify before changing either constant:
560
+ * select n.nspname, p.proname from pg_proc p
561
+ * join pg_namespace n on n.oid = p.pronamespace
562
+ * where p.proname like '%_dm_%';
563
+ */
564
+ declare const MESSAGING_RPC_SCHEMA = "public";
548
565
  declare const TABLES: {
549
566
  readonly conversations: "dm_conversations";
550
567
  readonly participants: "dm_conversation_participants";
@@ -1408,4 +1425,4 @@ declare function summarizeText(content: string, maxLength?: number): string;
1408
1425
  /** Serialize picked references into a fence the platform's other readers accept. */
1409
1426
  declare function composeFence(references: readonly MatrxReference[]): string;
1410
1427
 
1411
- export { type ActionChoice, type ActionContext, type ActionHandler, type ActionOutcome, type ActionReceipt, type ActionRegistry, type ActorPresentation, AgentTag, type AiCapability, type AiResult, AlertIcon, type Attachment, Avatar, BotIcon, CheckIcon, ChevronLeftIcon, type ClientMessageId, ClockIcon, CloseIcon, Composer, type Conversation, type ConversationCursor, type ConversationId, ConversationList, type ConversationListProps, type ConversationRowWrapperProps, ConversationSkeleton, type ConversationSummary, type ConversationThread, type ConversationType, ConversationView, type ConversationViewProps, type DeliveryState, DeliveryTick, DoubleCheckIcon, type DraftMessage, EmptyState, type EngineDiagnostic, type IncomingMessageContext, type JsonObject, type JsonValue, LinkIcon, MESSAGING_EVENTS, MESSAGING_SCHEMA, type MatrxReference, type Message, type MessageAction, MessageActionChips, type MessageActionRenderProps, type MessageActionRenderer, MessageBubble, type MessageCursor, type MessageGroup, type MessageId, type MessageKind, type MessageWrapperProps, type MessagingAgents, type MessagingAi, type MessagingAiOptions, type MessagingEngine, type MessagingEngineOptions, MessagingError, type MessagingErrorCode, type MessagingHost, type MessagingIdentity, MessagingInbox, type MessagingInboxProps, MessagingProvider, type MessagingProviderProps, type MessagingRepository, type MessagingSnapshot, type MessagingStore, type OrganizationId, type Outbox, type OutboxEntry, type OutboxOptions, type OutboxStorage, type Page, PaperclipIcon, type Participant, type ParticipantRole, PlusIcon, type PostgrestFilterLike, type PostgrestLikeResponse, type PostgrestTableLike, RPCS, type ReadCache, type ReadCacheOptions, ReferenceCard, type ReferenceRenderer, ReplyIcon, type RepositoryOptions, type SchemaLike, SearchIcon, SendIcon, type SessionResolver, SparklesIcon, type SupabaseLike, TABLES, type TextSegment, TypingDots, type UseComposerResult, type UseConversationResult, type UseConversationsResult, type UseMessageActionResult, type UseMessagingAiResult, type UseTypistsResult, type UserId, type UserSummary, UsersIcon, asClientMessageId, asConversationId, asMessageId, asOrganizationId, asUserId, composeFence, conversationTopic, createActionRegistry, createMemoryOutboxStorage, createMessagingAi, createMessagingEngine, createMessagingRepository, createMessagingStore, createOutbox, createReadCache, createWebOutboxStorage, extractReferences, formatConversationTime, formatDateSeparator, formatLastSeen, formatMessageTime, formatTypists, groupMessages, inboxTopic, invalidResponse, isSameDay, messagingClientId, normalizeMessagingError, optimisticMessage, participantNames, projectConversationSummary, projectMessage, projectMessageAction, projectParticipantRole, projectUserSummary, resolveActor, splitText, summarizeText, useComposer, useConversation, useConversations, useMessageAction, useMessagingAi, useMessagingHost, useMessagingSnapshot, useOnlineUserIds, useRequiredMessagingHost, useTypists };
1428
+ export { type ActionChoice, type ActionContext, type ActionHandler, type ActionOutcome, type ActionReceipt, type ActionRegistry, type ActorPresentation, AgentTag, type AiCapability, type AiResult, AlertIcon, type Attachment, Avatar, BotIcon, CheckIcon, ChevronLeftIcon, type ClientMessageId, ClockIcon, CloseIcon, Composer, type Conversation, type ConversationCursor, type ConversationId, ConversationList, type ConversationListProps, type ConversationRowWrapperProps, ConversationSkeleton, type ConversationSummary, type ConversationThread, type ConversationType, ConversationView, type ConversationViewProps, type DeliveryState, DeliveryTick, DoubleCheckIcon, type DraftMessage, EmptyState, type EngineDiagnostic, type IncomingMessageContext, type JsonObject, type JsonValue, LinkIcon, MESSAGING_EVENTS, MESSAGING_RPC_SCHEMA, MESSAGING_SCHEMA, type MatrxReference, type Message, type MessageAction, MessageActionChips, type MessageActionRenderProps, type MessageActionRenderer, MessageBubble, type MessageCursor, type MessageGroup, type MessageId, type MessageKind, type MessageWrapperProps, type MessagingAgents, type MessagingAi, type MessagingAiOptions, type MessagingEngine, type MessagingEngineOptions, MessagingError, type MessagingErrorCode, type MessagingHost, type MessagingIdentity, MessagingInbox, type MessagingInboxProps, MessagingProvider, type MessagingProviderProps, type MessagingRepository, type MessagingSnapshot, type MessagingStore, type OrganizationId, type Outbox, type OutboxEntry, type OutboxOptions, type OutboxStorage, type Page, PaperclipIcon, type Participant, type ParticipantRole, PlusIcon, type PostgrestFilterLike, type PostgrestLikeResponse, type PostgrestTableLike, RPCS, type ReadCache, type ReadCacheOptions, ReferenceCard, type ReferenceRenderer, ReplyIcon, type RepositoryOptions, type SchemaLike, SearchIcon, SendIcon, type SessionResolver, SparklesIcon, type SupabaseLike, TABLES, type TextSegment, TypingDots, type UseComposerResult, type UseConversationResult, type UseConversationsResult, type UseMessageActionResult, type UseMessagingAiResult, type UseTypistsResult, type UserId, type UserSummary, UsersIcon, asClientMessageId, asConversationId, asMessageId, asOrganizationId, asUserId, composeFence, conversationTopic, createActionRegistry, createMemoryOutboxStorage, createMessagingAi, createMessagingEngine, createMessagingRepository, createMessagingStore, createOutbox, createReadCache, createWebOutboxStorage, extractReferences, formatConversationTime, formatDateSeparator, formatLastSeen, formatMessageTime, formatTypists, groupMessages, inboxTopic, invalidResponse, isSameDay, messagingClientId, normalizeMessagingError, optimisticMessage, participantNames, projectConversationSummary, projectMessage, projectMessageAction, projectParticipantRole, projectUserSummary, resolveActor, splitText, summarizeText, useComposer, useConversation, useConversations, useMessageAction, useMessagingAi, useMessagingHost, useMessagingSnapshot, useOnlineUserIds, useRequiredMessagingHost, useTypists };
package/dist/react.js CHANGED
@@ -658,11 +658,13 @@ function projectParticipants(value, operation) {
658
658
  for (const entry of value) {
659
659
  if (typeof entry !== "object" || entry === null) continue;
660
660
  const record = entry;
661
- const id = str(record, "user_id") ?? str(record, "id");
661
+ const nested = typeof record["user"] === "object" && record["user"] !== null ? record["user"] : {};
662
+ const id = str(record, "user_id") ?? str(nested, "user_id") ?? str(record, "id");
662
663
  if (id === null) continue;
663
664
  summaries.push(
664
665
  projectUserSummary({
665
666
  ...record,
667
+ ...nested,
666
668
  user_id: id
667
669
  })
668
670
  );
@@ -1358,6 +1360,7 @@ function createReadCache(options) {
1358
1360
 
1359
1361
  // src/core/repository.ts
1360
1362
  var MESSAGING_SCHEMA = "communication";
1363
+ var MESSAGING_RPC_SCHEMA = "public";
1361
1364
  var TABLES = {
1362
1365
  conversations: "dm_conversations",
1363
1366
  participants: "dm_conversation_participants",
@@ -1392,6 +1395,7 @@ function createMessagingRepository(options) {
1392
1395
  ...options.now !== void 0 ? { now: options.now } : {}
1393
1396
  });
1394
1397
  const db = () => client.schema(MESSAGING_SCHEMA);
1398
+ const rpcDb = () => client.schema(MESSAGING_RPC_SCHEMA);
1395
1399
  async function withSessionRetry(operation, run) {
1396
1400
  try {
1397
1401
  return await run();
@@ -1409,7 +1413,7 @@ function createMessagingRepository(options) {
1409
1413
  }
1410
1414
  }
1411
1415
  async function rpc(fn, args, operation) {
1412
- const { data, error } = await db().rpc(fn, args);
1416
+ const { data, error } = await rpcDb().rpc(fn, args);
1413
1417
  if (error !== null) throw normalizeMessagingError(error, operation);
1414
1418
  return data;
1415
1419
  }
@@ -3034,6 +3038,7 @@ export {
3034
3038
  EmptyState,
3035
3039
  LinkIcon,
3036
3040
  MESSAGING_EVENTS,
3041
+ MESSAGING_RPC_SCHEMA,
3037
3042
  MESSAGING_SCHEMA,
3038
3043
  MessageActionChips,
3039
3044
  MessageBubble,