@ai-matrx/messaging 0.2.0 → 0.3.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 +32 -0
- package/README.md +21 -0
- package/dist/react.cjs +62 -24
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +63 -4
- package/dist/react.d.ts +63 -4
- package/dist/react.js +62 -24
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/react.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode, ComponentType, SVGProps } from 'react';
|
|
2
2
|
import { MatrxTransport } from '@ai-matrx/agents/matrx';
|
|
3
3
|
import { RealtimeClientLike, RealtimeManager } from '@ai-matrx/realtime';
|
|
4
4
|
|
|
@@ -781,6 +781,15 @@ declare function messagingClientId(): string;
|
|
|
781
781
|
* resubscribe loop that looks exactly like "realtime is broken".
|
|
782
782
|
*/
|
|
783
783
|
|
|
784
|
+
/**
|
|
785
|
+
* What the host needs to decide whether to interrupt someone, and what to say.
|
|
786
|
+
*/
|
|
787
|
+
interface IncomingMessageContext {
|
|
788
|
+
/** The message landed in the conversation currently on screen. */
|
|
789
|
+
readonly isActiveConversation: boolean;
|
|
790
|
+
/** The conversation it landed in, when the inbox already holds it. */
|
|
791
|
+
readonly conversation: ConversationSummary | null;
|
|
792
|
+
}
|
|
784
793
|
/**
|
|
785
794
|
* A host-supplied surface for ONE action kind.
|
|
786
795
|
*
|
|
@@ -806,6 +815,40 @@ interface MessageActionRenderer<TPayload = unknown> {
|
|
|
806
815
|
readonly versions: readonly number[];
|
|
807
816
|
readonly render: ComponentType<MessageActionRenderProps<TPayload>>;
|
|
808
817
|
}
|
|
818
|
+
/**
|
|
819
|
+
* A host's own renderer for a Matrx reference.
|
|
820
|
+
*
|
|
821
|
+
* References are the ONE piece of a bubble an app is likely to already render
|
|
822
|
+
* everywhere else — this platform resolves a ```matrx fence through a kind
|
|
823
|
+
* registry and draws a live, openable chip. Two different treatments of the
|
|
824
|
+
* same fence in one app is the second-renderer defect, so a host may hand us
|
|
825
|
+
* theirs. Omit it and the package's own card is used, which is what a
|
|
826
|
+
* greenfield consumer wants.
|
|
827
|
+
*/
|
|
828
|
+
type ReferenceRenderer = ComponentType<{
|
|
829
|
+
reference: MatrxReference;
|
|
830
|
+
}>;
|
|
831
|
+
/**
|
|
832
|
+
* App chrome wrapped around ONE message bubble or ONE conversation row.
|
|
833
|
+
*
|
|
834
|
+
* The reason this exists is the right-click menu. A platform whose every
|
|
835
|
+
* surface answers a right-click with copy / export / attach / hand-to-an-agent
|
|
836
|
+
* cannot have messaging be the one surface that does not — and a menu is
|
|
837
|
+
* per-row app chrome that no package can own (it needs the app's surface name,
|
|
838
|
+
* its entity tokens, its clipboard primitive). Without the seam a host keeps
|
|
839
|
+
* its own message list beside this one, which is the whole failure mode.
|
|
840
|
+
*
|
|
841
|
+
* It wraps; it does not replace. The bubble it receives is the package's.
|
|
842
|
+
*/
|
|
843
|
+
interface MessageWrapperProps {
|
|
844
|
+
readonly message: Message;
|
|
845
|
+
readonly isMine: boolean;
|
|
846
|
+
readonly children: ReactNode;
|
|
847
|
+
}
|
|
848
|
+
interface ConversationRowWrapperProps {
|
|
849
|
+
readonly conversation: ConversationSummary;
|
|
850
|
+
readonly children: ReactNode;
|
|
851
|
+
}
|
|
809
852
|
interface MessagingHost {
|
|
810
853
|
readonly engine: MessagingEngine;
|
|
811
854
|
readonly actions: ActionRegistry;
|
|
@@ -814,6 +857,9 @@ interface MessagingHost {
|
|
|
814
857
|
readonly openReference: ((reference: MatrxReference) => void) | null;
|
|
815
858
|
/** Host surfaces for action kinds whose answer is a card, not a chip. */
|
|
816
859
|
readonly actionRenderers: ReadonlyMap<string, MessageActionRenderer>;
|
|
860
|
+
readonly renderReference: ReferenceRenderer | null;
|
|
861
|
+
readonly wrapMessage: ComponentType<MessageWrapperProps> | null;
|
|
862
|
+
readonly wrapConversationRow: ComponentType<ConversationRowWrapperProps> | null;
|
|
817
863
|
}
|
|
818
864
|
interface MessagingProviderProps {
|
|
819
865
|
/** Any Supabase client. `null` while the host is still resolving one. */
|
|
@@ -841,8 +887,21 @@ interface MessagingProviderProps {
|
|
|
841
887
|
actionRenderers?: readonly MessageActionRenderer<never>[] | undefined;
|
|
842
888
|
/** Called when a reference card is clicked. Omit and cards render inert-but-labeled. */
|
|
843
889
|
onOpenReference?: ((reference: MatrxReference) => void) | undefined;
|
|
844
|
-
/**
|
|
845
|
-
|
|
890
|
+
/** Draw references with the app's own renderer instead of the package card. */
|
|
891
|
+
renderReference?: ReferenceRenderer | undefined;
|
|
892
|
+
/** App chrome (a right-click menu, a drop target) around each message bubble. */
|
|
893
|
+
wrapMessage?: ComponentType<MessageWrapperProps> | undefined;
|
|
894
|
+
/** App chrome around each conversation row. */
|
|
895
|
+
wrapConversationRow?: ComponentType<ConversationRowWrapperProps> | undefined;
|
|
896
|
+
/**
|
|
897
|
+
* A message arrived from someone else — for a toast, sound, or badge.
|
|
898
|
+
*
|
|
899
|
+
* The CONTEXT is not a courtesy. "Do not interrupt someone for the
|
|
900
|
+
* conversation they are looking at" is the rule every chat app needs and only
|
|
901
|
+
* this package can answer, and a notification names the SENDER, whose display
|
|
902
|
+
* name lives on the conversation the host cannot see from above the provider.
|
|
903
|
+
*/
|
|
904
|
+
onIncomingMessage?: ((message: Message, context: IncomingMessageContext) => void) | undefined;
|
|
846
905
|
/** Background failures, with a remedy. Defaults to a console sink. */
|
|
847
906
|
onDiagnostic?: ((event: EngineDiagnostic) => void) | undefined;
|
|
848
907
|
/** Re-resolve a session after one goes missing. Enables the single retry. */
|
|
@@ -1321,4 +1380,4 @@ declare function summarizeText(content: string, maxLength?: number): string;
|
|
|
1321
1380
|
/** Serialize picked references into a fence the platform's other readers accept. */
|
|
1322
1381
|
declare function composeFence(references: readonly MatrxReference[]): string;
|
|
1323
1382
|
|
|
1324
|
-
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, ConversationSkeleton, type ConversationSummary, type ConversationThread, type ConversationType, ConversationView, type ConversationViewProps, type DeliveryState, DeliveryTick, DoubleCheckIcon, type DraftMessage, EmptyState, type EngineDiagnostic, 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 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, 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, avatarPaletteIndex, composeFence, conversationTopic, createActionRegistry, createMemoryOutboxStorage, createMessagingAi, createMessagingEngine, createMessagingRepository, createMessagingStore, createOutbox, createReadCache, createWebOutboxStorage, extractReferences, formatConversationTime, formatDateSeparator, formatLastSeen, formatMessageTime, formatTypists, getInitials, 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 };
|
|
1383
|
+
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, avatarPaletteIndex, composeFence, conversationTopic, createActionRegistry, createMemoryOutboxStorage, createMessagingAi, createMessagingEngine, createMessagingRepository, createMessagingStore, createOutbox, createReadCache, createWebOutboxStorage, extractReferences, formatConversationTime, formatDateSeparator, formatLastSeen, formatMessageTime, formatTypists, getInitials, 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode, ComponentType, SVGProps } from 'react';
|
|
2
2
|
import { MatrxTransport } from '@ai-matrx/agents/matrx';
|
|
3
3
|
import { RealtimeClientLike, RealtimeManager } from '@ai-matrx/realtime';
|
|
4
4
|
|
|
@@ -781,6 +781,15 @@ declare function messagingClientId(): string;
|
|
|
781
781
|
* resubscribe loop that looks exactly like "realtime is broken".
|
|
782
782
|
*/
|
|
783
783
|
|
|
784
|
+
/**
|
|
785
|
+
* What the host needs to decide whether to interrupt someone, and what to say.
|
|
786
|
+
*/
|
|
787
|
+
interface IncomingMessageContext {
|
|
788
|
+
/** The message landed in the conversation currently on screen. */
|
|
789
|
+
readonly isActiveConversation: boolean;
|
|
790
|
+
/** The conversation it landed in, when the inbox already holds it. */
|
|
791
|
+
readonly conversation: ConversationSummary | null;
|
|
792
|
+
}
|
|
784
793
|
/**
|
|
785
794
|
* A host-supplied surface for ONE action kind.
|
|
786
795
|
*
|
|
@@ -806,6 +815,40 @@ interface MessageActionRenderer<TPayload = unknown> {
|
|
|
806
815
|
readonly versions: readonly number[];
|
|
807
816
|
readonly render: ComponentType<MessageActionRenderProps<TPayload>>;
|
|
808
817
|
}
|
|
818
|
+
/**
|
|
819
|
+
* A host's own renderer for a Matrx reference.
|
|
820
|
+
*
|
|
821
|
+
* References are the ONE piece of a bubble an app is likely to already render
|
|
822
|
+
* everywhere else — this platform resolves a ```matrx fence through a kind
|
|
823
|
+
* registry and draws a live, openable chip. Two different treatments of the
|
|
824
|
+
* same fence in one app is the second-renderer defect, so a host may hand us
|
|
825
|
+
* theirs. Omit it and the package's own card is used, which is what a
|
|
826
|
+
* greenfield consumer wants.
|
|
827
|
+
*/
|
|
828
|
+
type ReferenceRenderer = ComponentType<{
|
|
829
|
+
reference: MatrxReference;
|
|
830
|
+
}>;
|
|
831
|
+
/**
|
|
832
|
+
* App chrome wrapped around ONE message bubble or ONE conversation row.
|
|
833
|
+
*
|
|
834
|
+
* The reason this exists is the right-click menu. A platform whose every
|
|
835
|
+
* surface answers a right-click with copy / export / attach / hand-to-an-agent
|
|
836
|
+
* cannot have messaging be the one surface that does not — and a menu is
|
|
837
|
+
* per-row app chrome that no package can own (it needs the app's surface name,
|
|
838
|
+
* its entity tokens, its clipboard primitive). Without the seam a host keeps
|
|
839
|
+
* its own message list beside this one, which is the whole failure mode.
|
|
840
|
+
*
|
|
841
|
+
* It wraps; it does not replace. The bubble it receives is the package's.
|
|
842
|
+
*/
|
|
843
|
+
interface MessageWrapperProps {
|
|
844
|
+
readonly message: Message;
|
|
845
|
+
readonly isMine: boolean;
|
|
846
|
+
readonly children: ReactNode;
|
|
847
|
+
}
|
|
848
|
+
interface ConversationRowWrapperProps {
|
|
849
|
+
readonly conversation: ConversationSummary;
|
|
850
|
+
readonly children: ReactNode;
|
|
851
|
+
}
|
|
809
852
|
interface MessagingHost {
|
|
810
853
|
readonly engine: MessagingEngine;
|
|
811
854
|
readonly actions: ActionRegistry;
|
|
@@ -814,6 +857,9 @@ interface MessagingHost {
|
|
|
814
857
|
readonly openReference: ((reference: MatrxReference) => void) | null;
|
|
815
858
|
/** Host surfaces for action kinds whose answer is a card, not a chip. */
|
|
816
859
|
readonly actionRenderers: ReadonlyMap<string, MessageActionRenderer>;
|
|
860
|
+
readonly renderReference: ReferenceRenderer | null;
|
|
861
|
+
readonly wrapMessage: ComponentType<MessageWrapperProps> | null;
|
|
862
|
+
readonly wrapConversationRow: ComponentType<ConversationRowWrapperProps> | null;
|
|
817
863
|
}
|
|
818
864
|
interface MessagingProviderProps {
|
|
819
865
|
/** Any Supabase client. `null` while the host is still resolving one. */
|
|
@@ -841,8 +887,21 @@ interface MessagingProviderProps {
|
|
|
841
887
|
actionRenderers?: readonly MessageActionRenderer<never>[] | undefined;
|
|
842
888
|
/** Called when a reference card is clicked. Omit and cards render inert-but-labeled. */
|
|
843
889
|
onOpenReference?: ((reference: MatrxReference) => void) | undefined;
|
|
844
|
-
/**
|
|
845
|
-
|
|
890
|
+
/** Draw references with the app's own renderer instead of the package card. */
|
|
891
|
+
renderReference?: ReferenceRenderer | undefined;
|
|
892
|
+
/** App chrome (a right-click menu, a drop target) around each message bubble. */
|
|
893
|
+
wrapMessage?: ComponentType<MessageWrapperProps> | undefined;
|
|
894
|
+
/** App chrome around each conversation row. */
|
|
895
|
+
wrapConversationRow?: ComponentType<ConversationRowWrapperProps> | undefined;
|
|
896
|
+
/**
|
|
897
|
+
* A message arrived from someone else — for a toast, sound, or badge.
|
|
898
|
+
*
|
|
899
|
+
* The CONTEXT is not a courtesy. "Do not interrupt someone for the
|
|
900
|
+
* conversation they are looking at" is the rule every chat app needs and only
|
|
901
|
+
* this package can answer, and a notification names the SENDER, whose display
|
|
902
|
+
* name lives on the conversation the host cannot see from above the provider.
|
|
903
|
+
*/
|
|
904
|
+
onIncomingMessage?: ((message: Message, context: IncomingMessageContext) => void) | undefined;
|
|
846
905
|
/** Background failures, with a remedy. Defaults to a console sink. */
|
|
847
906
|
onDiagnostic?: ((event: EngineDiagnostic) => void) | undefined;
|
|
848
907
|
/** Re-resolve a session after one goes missing. Enables the single retry. */
|
|
@@ -1321,4 +1380,4 @@ declare function summarizeText(content: string, maxLength?: number): string;
|
|
|
1321
1380
|
/** Serialize picked references into a fence the platform's other readers accept. */
|
|
1322
1381
|
declare function composeFence(references: readonly MatrxReference[]): string;
|
|
1323
1382
|
|
|
1324
|
-
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, ConversationSkeleton, type ConversationSummary, type ConversationThread, type ConversationType, ConversationView, type ConversationViewProps, type DeliveryState, DeliveryTick, DoubleCheckIcon, type DraftMessage, EmptyState, type EngineDiagnostic, 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 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, 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, avatarPaletteIndex, composeFence, conversationTopic, createActionRegistry, createMemoryOutboxStorage, createMessagingAi, createMessagingEngine, createMessagingRepository, createMessagingStore, createOutbox, createReadCache, createWebOutboxStorage, extractReferences, formatConversationTime, formatDateSeparator, formatLastSeen, formatMessageTime, formatTypists, getInitials, 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 };
|
|
1383
|
+
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, avatarPaletteIndex, composeFence, conversationTopic, createActionRegistry, createMemoryOutboxStorage, createMessagingAi, createMessagingEngine, createMessagingRepository, createMessagingStore, createOutbox, createReadCache, createWebOutboxStorage, extractReferences, formatConversationTime, formatDateSeparator, formatLastSeen, formatMessageTime, formatTypists, getInitials, 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
|
@@ -1739,7 +1739,8 @@ function MessagingRuntime(props) {
|
|
|
1739
1739
|
identity,
|
|
1740
1740
|
...props.resolveSession !== void 0 ? { resolveSession: props.resolveSession } : {}
|
|
1741
1741
|
});
|
|
1742
|
-
|
|
1742
|
+
let built = null;
|
|
1743
|
+
built = createMessagingEngine({
|
|
1743
1744
|
repository,
|
|
1744
1745
|
manager,
|
|
1745
1746
|
identity,
|
|
@@ -1748,8 +1749,18 @@ function MessagingRuntime(props) {
|
|
|
1748
1749
|
onFallback: (message) => report({ level: "warn", message })
|
|
1749
1750
|
}),
|
|
1750
1751
|
onDiagnostic: report,
|
|
1751
|
-
onIncoming: (message) =>
|
|
1752
|
+
onIncoming: (message) => {
|
|
1753
|
+
const snapshot = built?.store.snapshot();
|
|
1754
|
+
if (snapshot === void 0) return;
|
|
1755
|
+
incomingRef.current?.(message, {
|
|
1756
|
+
isActiveConversation: snapshot.activeConversationId === message.conversationId,
|
|
1757
|
+
conversation: snapshot.conversations.find(
|
|
1758
|
+
(item) => item.conversation.id === message.conversationId
|
|
1759
|
+
) ?? null
|
|
1760
|
+
});
|
|
1761
|
+
}
|
|
1752
1762
|
});
|
|
1763
|
+
return built;
|
|
1753
1764
|
}, [ready, manager, userId, organizationId]);
|
|
1754
1765
|
useEffect(() => {
|
|
1755
1766
|
if (engine === null) return void 0;
|
|
@@ -1782,6 +1793,9 @@ function MessagingRuntime(props) {
|
|
|
1782
1793
|
});
|
|
1783
1794
|
return map;
|
|
1784
1795
|
}, [renderers]);
|
|
1796
|
+
const renderReference = props.renderReference ?? null;
|
|
1797
|
+
const wrapMessage = props.wrapMessage ?? null;
|
|
1798
|
+
const wrapConversationRow = props.wrapConversationRow ?? null;
|
|
1785
1799
|
const host = useMemo(() => {
|
|
1786
1800
|
if (engine === null) return null;
|
|
1787
1801
|
return {
|
|
@@ -1790,9 +1804,12 @@ function MessagingRuntime(props) {
|
|
|
1790
1804
|
ai,
|
|
1791
1805
|
identity: engine.identity,
|
|
1792
1806
|
openReference: referenceRef.current ?? null,
|
|
1793
|
-
actionRenderers: rendererMap
|
|
1807
|
+
actionRenderers: rendererMap,
|
|
1808
|
+
renderReference,
|
|
1809
|
+
wrapMessage,
|
|
1810
|
+
wrapConversationRow
|
|
1794
1811
|
};
|
|
1795
|
-
}, [engine, actionRegistry, ai, rendererMap]);
|
|
1812
|
+
}, [engine, actionRegistry, ai, rendererMap, renderReference, wrapMessage, wrapConversationRow]);
|
|
1796
1813
|
const MessagingContext = messagingContext();
|
|
1797
1814
|
return /* @__PURE__ */ jsx(MessagingContext.Provider, { value: host, children });
|
|
1798
1815
|
}
|
|
@@ -2463,6 +2480,7 @@ var AI_LABELS = {
|
|
|
2463
2480
|
};
|
|
2464
2481
|
function ConversationList(props) {
|
|
2465
2482
|
const { conversations, hasMore, isInitialLoading, loadMore, select, activeConversationId } = useConversations();
|
|
2483
|
+
const RowChrome = useMessagingHost()?.wrapConversationRow ?? null;
|
|
2466
2484
|
const [query, setQuery] = useState2("");
|
|
2467
2485
|
const visible = useMemo3(() => {
|
|
2468
2486
|
const needle = query.trim().toLowerCase();
|
|
@@ -2503,17 +2521,20 @@ function ConversationList(props) {
|
|
|
2503
2521
|
title: query.length > 0 ? "No matches" : "No conversations yet",
|
|
2504
2522
|
body: query.length > 0 ? "Try a different name or word." : "Start one and it will appear here."
|
|
2505
2523
|
}
|
|
2506
|
-
) : /* @__PURE__ */ jsx4("ul", { className: "mx-msg__rows", children: visible.map((item) =>
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2524
|
+
) : /* @__PURE__ */ jsx4("ul", { className: "mx-msg__rows", children: visible.map((item) => {
|
|
2525
|
+
const row = /* @__PURE__ */ jsx4(
|
|
2526
|
+
ConversationRow,
|
|
2527
|
+
{
|
|
2528
|
+
summary: item,
|
|
2529
|
+
isActive: item.conversation.id === activeConversationId,
|
|
2530
|
+
onSelect: () => {
|
|
2531
|
+
select(item.conversation.id);
|
|
2532
|
+
props.onSelect?.(item.conversation.id);
|
|
2533
|
+
}
|
|
2514
2534
|
}
|
|
2515
|
-
|
|
2516
|
-
|
|
2535
|
+
);
|
|
2536
|
+
return /* @__PURE__ */ jsx4("li", { children: RowChrome !== null ? /* @__PURE__ */ jsx4(RowChrome, { conversation: item, children: row }) : row }, item.conversation.id);
|
|
2537
|
+
}) }),
|
|
2517
2538
|
hasMore && !isInitialLoading ? /* @__PURE__ */ jsx4(
|
|
2518
2539
|
"button",
|
|
2519
2540
|
{
|
|
@@ -2742,6 +2763,8 @@ function MessageGroupView(props) {
|
|
|
2742
2763
|
function MessageBubble(props) {
|
|
2743
2764
|
const { message, isMine } = props;
|
|
2744
2765
|
const host = useMessagingHost();
|
|
2766
|
+
const HostReference = host?.renderReference ?? null;
|
|
2767
|
+
const MessageChrome = host?.wrapMessage ?? null;
|
|
2745
2768
|
if (message.deletedAt !== null) {
|
|
2746
2769
|
return /* @__PURE__ */ jsx4("div", { className: "mx-msg__bubble mx-msg__bubble--deleted", children: "Message deleted" });
|
|
2747
2770
|
}
|
|
@@ -2752,10 +2775,16 @@ function MessageBubble(props) {
|
|
|
2752
2775
|
message.deliveryState === "sending" ? "mx-msg__bubble--pending" : "",
|
|
2753
2776
|
message.deliveryState === "failed" ? "mx-msg__bubble--failed" : ""
|
|
2754
2777
|
].filter(Boolean).join(" ");
|
|
2755
|
-
|
|
2778
|
+
const bubble = /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
2756
2779
|
/* @__PURE__ */ jsxs2("div", { className: classes, children: [
|
|
2757
2780
|
splitText(message.content).map(
|
|
2758
|
-
(segment, index) => segment.type === "text" ? /* @__PURE__ */ jsx4("span", { children: segment.value }, index) : /* @__PURE__ */ jsx4(
|
|
2781
|
+
(segment, index) => segment.type === "text" ? /* @__PURE__ */ jsx4("span", { children: segment.value }, index) : HostReference !== null ? /* @__PURE__ */ jsx4(
|
|
2782
|
+
HostReference,
|
|
2783
|
+
{
|
|
2784
|
+
reference: segment.reference
|
|
2785
|
+
},
|
|
2786
|
+
`${segment.reference.entityType}:${segment.reference.entityId}`
|
|
2787
|
+
) : /* @__PURE__ */ jsx4(
|
|
2759
2788
|
ReferenceCard,
|
|
2760
2789
|
{
|
|
2761
2790
|
reference: segment.reference,
|
|
@@ -2764,14 +2793,22 @@ function MessageBubble(props) {
|
|
|
2764
2793
|
`${segment.reference.entityType}:${segment.reference.entityId}`
|
|
2765
2794
|
)
|
|
2766
2795
|
),
|
|
2767
|
-
message.references.map(
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2796
|
+
message.references.map(
|
|
2797
|
+
(reference) => HostReference !== null ? /* @__PURE__ */ jsx4(
|
|
2798
|
+
HostReference,
|
|
2799
|
+
{
|
|
2800
|
+
reference
|
|
2801
|
+
},
|
|
2802
|
+
`structured:${reference.entityType}:${reference.entityId}`
|
|
2803
|
+
) : /* @__PURE__ */ jsx4(
|
|
2804
|
+
ReferenceCard,
|
|
2805
|
+
{
|
|
2806
|
+
reference,
|
|
2807
|
+
onOpen: host?.openReference ?? null
|
|
2808
|
+
},
|
|
2809
|
+
`structured:${reference.entityType}:${reference.entityId}`
|
|
2810
|
+
)
|
|
2811
|
+
),
|
|
2775
2812
|
message.action !== null ? /* @__PURE__ */ jsx4(MessageActionChips, { message }) : null
|
|
2776
2813
|
] }),
|
|
2777
2814
|
/* @__PURE__ */ jsxs2(
|
|
@@ -2807,6 +2844,7 @@ function MessageBubble(props) {
|
|
|
2807
2844
|
}
|
|
2808
2845
|
)
|
|
2809
2846
|
] });
|
|
2847
|
+
return MessageChrome !== null ? /* @__PURE__ */ jsx4(MessageChrome, { message, isMine, children: bubble }) : bubble;
|
|
2810
2848
|
}
|
|
2811
2849
|
function MessageActionChips(props) {
|
|
2812
2850
|
const host = useRequiredMessagingHost();
|