@ai-matrx/messaging 0.6.0 → 0.7.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/index.d.cts CHANGED
@@ -637,8 +637,25 @@ interface SupabaseLike extends SchemaLike {
637
637
  * — which in a large org is every page.
638
638
  */
639
639
 
640
- /** The schema. Messaging is never in `public`. */
640
+ /** The TABLES' schema. Messaging tables are never in `public`. */
641
641
  declare const MESSAGING_SCHEMA = "communication";
642
+ /**
643
+ * 🚨 THE RPCS LIVE IN `public`, AND THE TABLES DO NOT. THIS IS NOT A TYPO.
644
+ *
645
+ * Matrx Main's messaging tables moved into `communication` during the schema
646
+ * reorg; the five auth-checked SECURITY DEFINER functions stayed in `public`,
647
+ * where PostgREST exposes them by default and where every existing caller and
648
+ * GRANT already pointed. Calling them on `communication` fails with PGRST202
649
+ * ("no matches were found in the schema cache") on EVERY read — which is what
650
+ * happened the first time this package touched the live database, and what no
651
+ * amount of checking the SQL by inspection had caught.
652
+ *
653
+ * Verify before changing either constant:
654
+ * select n.nspname, p.proname from pg_proc p
655
+ * join pg_namespace n on n.oid = p.pronamespace
656
+ * where p.proname like '%_dm_%';
657
+ */
658
+ declare const MESSAGING_RPC_SCHEMA = "public";
642
659
  declare const TABLES: {
643
660
  readonly conversations: "dm_conversations";
644
661
  readonly participants: "dm_conversation_participants";
@@ -1020,4 +1037,4 @@ declare function summarizeText(content: string, maxLength?: number): string;
1020
1037
  /** Serialize picked references into a fence the platform's other readers accept. */
1021
1038
  declare function composeFence(references: readonly MatrxReference[]): string;
1022
1039
 
1023
- export { type ActionChoice, type ActionContext, type ActionHandler, type ActionOutcome, type ActionReceipt, type ActionRegistry, type ActorPresentation, type AiCapability, type AiResult, type Attachment, type ClientMessageId, type Conversation, type ConversationCursor, type ConversationId, type ConversationSummary, type ConversationThread, type ConversationType, type DeliveryState, type DraftMessage, type EngineDiagnostic, type JsonObject, type JsonValue, MESSAGING_EVENTS, MESSAGING_SCHEMA, type MatrxReference, type Message, type MessageAction, type MessageCursor, type MessageGroup, type MessageId, type MessageKind, type MessagingAgents, type MessagingAi, type MessagingAiOptions, type MessagingEngine, type MessagingEngineOptions, MessagingError, type MessagingErrorCode, type MessagingIdentity, type MessagingRepository, type MessagingSnapshot, type MessagingStore, type OrganizationId, type Outbox, type OutboxEntry, type OutboxOptions, type OutboxStorage, type Page, type Participant, type ParticipantRole, type PostgrestFilterLike, type PostgrestLikeResponse, type PostgrestTableLike, RPCS, type ReadCache, type ReadCacheOptions, type RepositoryOptions, type SchemaLike, type SessionResolver, type SupabaseLike, TABLES, type TextSegment, type UserId, type UserSummary, 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 };
1040
+ export { type ActionChoice, type ActionContext, type ActionHandler, type ActionOutcome, type ActionReceipt, type ActionRegistry, type ActorPresentation, type AiCapability, type AiResult, type Attachment, type ClientMessageId, type Conversation, type ConversationCursor, type ConversationId, type ConversationSummary, type ConversationThread, type ConversationType, type DeliveryState, type DraftMessage, type EngineDiagnostic, type JsonObject, type JsonValue, MESSAGING_EVENTS, MESSAGING_RPC_SCHEMA, MESSAGING_SCHEMA, type MatrxReference, type Message, type MessageAction, type MessageCursor, type MessageGroup, type MessageId, type MessageKind, type MessagingAgents, type MessagingAi, type MessagingAiOptions, type MessagingEngine, type MessagingEngineOptions, MessagingError, type MessagingErrorCode, type MessagingIdentity, type MessagingRepository, type MessagingSnapshot, type MessagingStore, type OrganizationId, type Outbox, type OutboxEntry, type OutboxOptions, type OutboxStorage, type Page, type Participant, type ParticipantRole, type PostgrestFilterLike, type PostgrestLikeResponse, type PostgrestTableLike, RPCS, type ReadCache, type ReadCacheOptions, type RepositoryOptions, type SchemaLike, type SessionResolver, type SupabaseLike, TABLES, type TextSegment, type UserId, type UserSummary, 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 };
package/dist/index.d.ts CHANGED
@@ -637,8 +637,25 @@ interface SupabaseLike extends SchemaLike {
637
637
  * — which in a large org is every page.
638
638
  */
639
639
 
640
- /** The schema. Messaging is never in `public`. */
640
+ /** The TABLES' schema. Messaging tables are never in `public`. */
641
641
  declare const MESSAGING_SCHEMA = "communication";
642
+ /**
643
+ * 🚨 THE RPCS LIVE IN `public`, AND THE TABLES DO NOT. THIS IS NOT A TYPO.
644
+ *
645
+ * Matrx Main's messaging tables moved into `communication` during the schema
646
+ * reorg; the five auth-checked SECURITY DEFINER functions stayed in `public`,
647
+ * where PostgREST exposes them by default and where every existing caller and
648
+ * GRANT already pointed. Calling them on `communication` fails with PGRST202
649
+ * ("no matches were found in the schema cache") on EVERY read — which is what
650
+ * happened the first time this package touched the live database, and what no
651
+ * amount of checking the SQL by inspection had caught.
652
+ *
653
+ * Verify before changing either constant:
654
+ * select n.nspname, p.proname from pg_proc p
655
+ * join pg_namespace n on n.oid = p.pronamespace
656
+ * where p.proname like '%_dm_%';
657
+ */
658
+ declare const MESSAGING_RPC_SCHEMA = "public";
642
659
  declare const TABLES: {
643
660
  readonly conversations: "dm_conversations";
644
661
  readonly participants: "dm_conversation_participants";
@@ -1020,4 +1037,4 @@ declare function summarizeText(content: string, maxLength?: number): string;
1020
1037
  /** Serialize picked references into a fence the platform's other readers accept. */
1021
1038
  declare function composeFence(references: readonly MatrxReference[]): string;
1022
1039
 
1023
- export { type ActionChoice, type ActionContext, type ActionHandler, type ActionOutcome, type ActionReceipt, type ActionRegistry, type ActorPresentation, type AiCapability, type AiResult, type Attachment, type ClientMessageId, type Conversation, type ConversationCursor, type ConversationId, type ConversationSummary, type ConversationThread, type ConversationType, type DeliveryState, type DraftMessage, type EngineDiagnostic, type JsonObject, type JsonValue, MESSAGING_EVENTS, MESSAGING_SCHEMA, type MatrxReference, type Message, type MessageAction, type MessageCursor, type MessageGroup, type MessageId, type MessageKind, type MessagingAgents, type MessagingAi, type MessagingAiOptions, type MessagingEngine, type MessagingEngineOptions, MessagingError, type MessagingErrorCode, type MessagingIdentity, type MessagingRepository, type MessagingSnapshot, type MessagingStore, type OrganizationId, type Outbox, type OutboxEntry, type OutboxOptions, type OutboxStorage, type Page, type Participant, type ParticipantRole, type PostgrestFilterLike, type PostgrestLikeResponse, type PostgrestTableLike, RPCS, type ReadCache, type ReadCacheOptions, type RepositoryOptions, type SchemaLike, type SessionResolver, type SupabaseLike, TABLES, type TextSegment, type UserId, type UserSummary, 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 };
1040
+ export { type ActionChoice, type ActionContext, type ActionHandler, type ActionOutcome, type ActionReceipt, type ActionRegistry, type ActorPresentation, type AiCapability, type AiResult, type Attachment, type ClientMessageId, type Conversation, type ConversationCursor, type ConversationId, type ConversationSummary, type ConversationThread, type ConversationType, type DeliveryState, type DraftMessage, type EngineDiagnostic, type JsonObject, type JsonValue, MESSAGING_EVENTS, MESSAGING_RPC_SCHEMA, MESSAGING_SCHEMA, type MatrxReference, type Message, type MessageAction, type MessageCursor, type MessageGroup, type MessageId, type MessageKind, type MessagingAgents, type MessagingAi, type MessagingAiOptions, type MessagingEngine, type MessagingEngineOptions, MessagingError, type MessagingErrorCode, type MessagingIdentity, type MessagingRepository, type MessagingSnapshot, type MessagingStore, type OrganizationId, type Outbox, type OutboxEntry, type OutboxOptions, type OutboxStorage, type Page, type Participant, type ParticipantRole, type PostgrestFilterLike, type PostgrestLikeResponse, type PostgrestTableLike, RPCS, type ReadCache, type ReadCacheOptions, type RepositoryOptions, type SchemaLike, type SessionResolver, type SupabaseLike, TABLES, type TextSegment, type UserId, type UserSummary, 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 };
package/dist/index.js CHANGED
@@ -1477,6 +1477,7 @@ function formatLastSeen(lastSeenMs, now = Date.now()) {
1477
1477
 
1478
1478
  // src/core/repository.ts
1479
1479
  var MESSAGING_SCHEMA = "communication";
1480
+ var MESSAGING_RPC_SCHEMA = "public";
1480
1481
  var TABLES = {
1481
1482
  conversations: "dm_conversations",
1482
1483
  participants: "dm_conversation_participants",
@@ -1511,6 +1512,7 @@ function createMessagingRepository(options) {
1511
1512
  ...options.now !== void 0 ? { now: options.now } : {}
1512
1513
  });
1513
1514
  const db = () => client.schema(MESSAGING_SCHEMA);
1515
+ const rpcDb = () => client.schema(MESSAGING_RPC_SCHEMA);
1514
1516
  async function withSessionRetry(operation, run) {
1515
1517
  try {
1516
1518
  return await run();
@@ -1528,7 +1530,7 @@ function createMessagingRepository(options) {
1528
1530
  }
1529
1531
  }
1530
1532
  async function rpc(fn, args, operation) {
1531
- const { data, error } = await db().rpc(fn, args);
1533
+ const { data, error } = await rpcDb().rpc(fn, args);
1532
1534
  if (error !== null) throw normalizeMessagingError(error, operation);
1533
1535
  return data;
1534
1536
  }
@@ -1824,6 +1826,7 @@ var asOrganizationId = (value) => value;
1824
1826
  var asClientMessageId = (value) => value;
1825
1827
  export {
1826
1828
  MESSAGING_EVENTS,
1829
+ MESSAGING_RPC_SCHEMA,
1827
1830
  MESSAGING_SCHEMA,
1828
1831
  MessagingError,
1829
1832
  RPCS,