@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/CHANGELOG.md +50 -0
- package/README.md +2 -1
- package/dist/index.cjs +7 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +7 -2
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +19 -2
- package/dist/react.d.ts +19 -2
- package/dist/react.js +7 -2
- package/dist/react.js.map +1 -1
- package/package.json +3 -3
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
|
|
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
|
|
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
|
@@ -734,11 +734,13 @@ function projectParticipants(value, operation) {
|
|
|
734
734
|
for (const entry of value) {
|
|
735
735
|
if (typeof entry !== "object" || entry === null) continue;
|
|
736
736
|
const record = entry;
|
|
737
|
-
const
|
|
737
|
+
const nested = typeof record["user"] === "object" && record["user"] !== null ? record["user"] : {};
|
|
738
|
+
const id = str(record, "user_id") ?? str(nested, "user_id") ?? str(record, "id");
|
|
738
739
|
if (id === null) continue;
|
|
739
740
|
summaries.push(
|
|
740
741
|
projectUserSummary({
|
|
741
742
|
...record,
|
|
743
|
+
...nested,
|
|
742
744
|
user_id: id
|
|
743
745
|
})
|
|
744
746
|
);
|
|
@@ -1477,6 +1479,7 @@ function formatLastSeen(lastSeenMs, now = Date.now()) {
|
|
|
1477
1479
|
|
|
1478
1480
|
// src/core/repository.ts
|
|
1479
1481
|
var MESSAGING_SCHEMA = "communication";
|
|
1482
|
+
var MESSAGING_RPC_SCHEMA = "public";
|
|
1480
1483
|
var TABLES = {
|
|
1481
1484
|
conversations: "dm_conversations",
|
|
1482
1485
|
participants: "dm_conversation_participants",
|
|
@@ -1511,6 +1514,7 @@ function createMessagingRepository(options) {
|
|
|
1511
1514
|
...options.now !== void 0 ? { now: options.now } : {}
|
|
1512
1515
|
});
|
|
1513
1516
|
const db = () => client.schema(MESSAGING_SCHEMA);
|
|
1517
|
+
const rpcDb = () => client.schema(MESSAGING_RPC_SCHEMA);
|
|
1514
1518
|
async function withSessionRetry(operation, run) {
|
|
1515
1519
|
try {
|
|
1516
1520
|
return await run();
|
|
@@ -1528,7 +1532,7 @@ function createMessagingRepository(options) {
|
|
|
1528
1532
|
}
|
|
1529
1533
|
}
|
|
1530
1534
|
async function rpc(fn, args, operation) {
|
|
1531
|
-
const { data, error } = await
|
|
1535
|
+
const { data, error } = await rpcDb().rpc(fn, args);
|
|
1532
1536
|
if (error !== null) throw normalizeMessagingError(error, operation);
|
|
1533
1537
|
return data;
|
|
1534
1538
|
}
|
|
@@ -1824,6 +1828,7 @@ var asOrganizationId = (value) => value;
|
|
|
1824
1828
|
var asClientMessageId = (value) => value;
|
|
1825
1829
|
export {
|
|
1826
1830
|
MESSAGING_EVENTS,
|
|
1831
|
+
MESSAGING_RPC_SCHEMA,
|
|
1827
1832
|
MESSAGING_SCHEMA,
|
|
1828
1833
|
MessagingError,
|
|
1829
1834
|
RPCS,
|