@ai-matrx/messaging 0.15.0 → 0.15.1
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 +18 -0
- package/dist/index.cjs +17 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -1
- package/dist/index.d.ts +24 -1
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +25 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +24 -1
- package/dist/react.d.ts +24 -1
- package/dist/react.js +25 -1
- package/dist/react.js.map +1 -1
- package/package.json +2 -2
package/dist/react.d.cts
CHANGED
|
@@ -386,11 +386,34 @@ interface AiResult {
|
|
|
386
386
|
readonly text: string;
|
|
387
387
|
readonly conversationId: string | null;
|
|
388
388
|
}
|
|
389
|
+
/**
|
|
390
|
+
* Facts about the open conversation the caller already holds (the inbox row
|
|
391
|
+
* and the signed-in reader). Each is sent by its offered name
|
|
392
|
+
* (`messaging.conversation`, mapped-only) beside the transcript; an absent
|
|
393
|
+
* one is omitted, never sent empty. Nothing here changes the transcript.
|
|
394
|
+
*/
|
|
395
|
+
interface ConversationAiContext {
|
|
396
|
+
conversationType?: ConversationType | undefined;
|
|
397
|
+
/** The name the reader sees: the group name, or the other person's name. */
|
|
398
|
+
conversationName?: string | undefined;
|
|
399
|
+
conversationCreatedAt?: string | undefined;
|
|
400
|
+
unreadCount?: number | undefined;
|
|
401
|
+
isMuted?: boolean | undefined;
|
|
402
|
+
readerUserId?: string | undefined;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* The offered values of `ConversationAiContext`, by name. Pure, so a host that
|
|
406
|
+
* builds its own call can reuse it. `total_loaded_message_count` is the
|
|
407
|
+
* messages the caller loaded BEFORE windowing.
|
|
408
|
+
*/
|
|
409
|
+
declare function conversationContextVariables(context: ConversationAiContext | undefined, loadedMessageCount: number): MatrxJsonObject;
|
|
389
410
|
/** What every capability takes: the conversation, and how to watch the run. */
|
|
390
411
|
interface AiCallArgs {
|
|
391
412
|
conversationId: ConversationId;
|
|
392
413
|
messages: readonly Message[];
|
|
393
414
|
participants: readonly UserSummary[];
|
|
415
|
+
/** Conversation facts sent by name beside the transcript (optional). */
|
|
416
|
+
context?: ConversationAiContext | undefined;
|
|
394
417
|
signal?: AbortSignal | undefined;
|
|
395
418
|
/** The accumulated answer so far, after every streamed chunk. */
|
|
396
419
|
onText?: ((fullText: string) => void) | undefined;
|
|
@@ -1875,4 +1898,4 @@ declare function summarizeText(content: string, maxLength?: number): string;
|
|
|
1875
1898
|
/** Serialize picked references into a fence the platform's other readers accept. */
|
|
1876
1899
|
declare function composeFence(references: readonly MatrxReference[]): string;
|
|
1877
1900
|
|
|
1878
|
-
export { type ActionChoice, type ActionContext, type ActionHandler, type ActionOutcome, type ActionReceipt, type ActionRegistry, type ActorPresentation, AgentTag, type AiCallArgs, type AiCapability, type AiResult, AlertIcon, type Attachment, Avatar, BotIcon, CheckIcon, ChevronLeftIcon, type ClientMessageId, ClockIcon, CloseIcon, Composer, type ComposerInputRenderProps, type Conversation, type ConversationCursor, type ConversationId, ConversationList, type ConversationListProps, type ConversationReadFailure, type ConversationRowWrapperProps, ConversationSkeleton, type ConversationSummary, type ConversationThread, type ConversationType, ConversationView, type ConversationViewProps, DEFAULT_MESSAGING_ARCHIVE_FILTER, 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 MessagingAgentIdentity, type MessagingAgents, type MessagingAi, type MessagingAiOptions, type MessagingArchiveFilter, type MessagingEngine, type MessagingEngineOptions, MessagingError, type MessagingErrorCode, type MessagingHost, type MessagingIdentity, MessagingInbox, type MessagingInboxProps, MessagingProvider, type MessagingProviderProps, type MessagingRepository, type MessagingSnapshot, type MessagingStore, type MessagingSupabaseClient, type MessagingSupabaseInternal, 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, SERVER_SESSION_IDENTITY, type SchemaLike, SearchIcon, SendIcon, type SessionIdentity, type SessionIdentitySnapshot, 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, createSessionIdentity, createWebOutboxStorage, effectiveActorKey, extractReferences, formatConversationTime, formatDateSeparator, formatLastSeen, formatMessageTime, formatTypists, groupMessages, inboxTopic, invalidResponse, isSameDay, messagingClientId, normalizeMessagingError, optimisticMessage, participantNames, projectConversationSummary, projectMessage, projectMessageAction, projectParticipantRole, projectUserSummary, resolveActor, splitText, summarizeText, toMessagingArchiveFilter, unreadCutoff, useComposer, useConversation, useConversations, useMessageAction, useMessagingAi, useMessagingHost, useMessagingSnapshot, useOnlineUserIds, useRequiredMessagingHost, useTypists };
|
|
1901
|
+
export { type ActionChoice, type ActionContext, type ActionHandler, type ActionOutcome, type ActionReceipt, type ActionRegistry, type ActorPresentation, AgentTag, type AiCallArgs, type AiCapability, type AiResult, AlertIcon, type Attachment, Avatar, BotIcon, CheckIcon, ChevronLeftIcon, type ClientMessageId, ClockIcon, CloseIcon, Composer, type ComposerInputRenderProps, type Conversation, type ConversationAiContext, type ConversationCursor, type ConversationId, ConversationList, type ConversationListProps, type ConversationReadFailure, type ConversationRowWrapperProps, ConversationSkeleton, type ConversationSummary, type ConversationThread, type ConversationType, ConversationView, type ConversationViewProps, DEFAULT_MESSAGING_ARCHIVE_FILTER, 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 MessagingAgentIdentity, type MessagingAgents, type MessagingAi, type MessagingAiOptions, type MessagingArchiveFilter, type MessagingEngine, type MessagingEngineOptions, MessagingError, type MessagingErrorCode, type MessagingHost, type MessagingIdentity, MessagingInbox, type MessagingInboxProps, MessagingProvider, type MessagingProviderProps, type MessagingRepository, type MessagingSnapshot, type MessagingStore, type MessagingSupabaseClient, type MessagingSupabaseInternal, 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, SERVER_SESSION_IDENTITY, type SchemaLike, SearchIcon, SendIcon, type SessionIdentity, type SessionIdentitySnapshot, 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, conversationContextVariables, conversationTopic, createActionRegistry, createMemoryOutboxStorage, createMessagingAi, createMessagingEngine, createMessagingRepository, createMessagingStore, createOutbox, createReadCache, createSessionIdentity, createWebOutboxStorage, effectiveActorKey, extractReferences, formatConversationTime, formatDateSeparator, formatLastSeen, formatMessageTime, formatTypists, groupMessages, inboxTopic, invalidResponse, isSameDay, messagingClientId, normalizeMessagingError, optimisticMessage, participantNames, projectConversationSummary, projectMessage, projectMessageAction, projectParticipantRole, projectUserSummary, resolveActor, splitText, summarizeText, toMessagingArchiveFilter, unreadCutoff, useComposer, useConversation, useConversations, useMessageAction, useMessagingAi, useMessagingHost, useMessagingSnapshot, useOnlineUserIds, useRequiredMessagingHost, useTypists };
|
package/dist/react.d.ts
CHANGED
|
@@ -386,11 +386,34 @@ interface AiResult {
|
|
|
386
386
|
readonly text: string;
|
|
387
387
|
readonly conversationId: string | null;
|
|
388
388
|
}
|
|
389
|
+
/**
|
|
390
|
+
* Facts about the open conversation the caller already holds (the inbox row
|
|
391
|
+
* and the signed-in reader). Each is sent by its offered name
|
|
392
|
+
* (`messaging.conversation`, mapped-only) beside the transcript; an absent
|
|
393
|
+
* one is omitted, never sent empty. Nothing here changes the transcript.
|
|
394
|
+
*/
|
|
395
|
+
interface ConversationAiContext {
|
|
396
|
+
conversationType?: ConversationType | undefined;
|
|
397
|
+
/** The name the reader sees: the group name, or the other person's name. */
|
|
398
|
+
conversationName?: string | undefined;
|
|
399
|
+
conversationCreatedAt?: string | undefined;
|
|
400
|
+
unreadCount?: number | undefined;
|
|
401
|
+
isMuted?: boolean | undefined;
|
|
402
|
+
readerUserId?: string | undefined;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* The offered values of `ConversationAiContext`, by name. Pure, so a host that
|
|
406
|
+
* builds its own call can reuse it. `total_loaded_message_count` is the
|
|
407
|
+
* messages the caller loaded BEFORE windowing.
|
|
408
|
+
*/
|
|
409
|
+
declare function conversationContextVariables(context: ConversationAiContext | undefined, loadedMessageCount: number): MatrxJsonObject;
|
|
389
410
|
/** What every capability takes: the conversation, and how to watch the run. */
|
|
390
411
|
interface AiCallArgs {
|
|
391
412
|
conversationId: ConversationId;
|
|
392
413
|
messages: readonly Message[];
|
|
393
414
|
participants: readonly UserSummary[];
|
|
415
|
+
/** Conversation facts sent by name beside the transcript (optional). */
|
|
416
|
+
context?: ConversationAiContext | undefined;
|
|
394
417
|
signal?: AbortSignal | undefined;
|
|
395
418
|
/** The accumulated answer so far, after every streamed chunk. */
|
|
396
419
|
onText?: ((fullText: string) => void) | undefined;
|
|
@@ -1875,4 +1898,4 @@ declare function summarizeText(content: string, maxLength?: number): string;
|
|
|
1875
1898
|
/** Serialize picked references into a fence the platform's other readers accept. */
|
|
1876
1899
|
declare function composeFence(references: readonly MatrxReference[]): string;
|
|
1877
1900
|
|
|
1878
|
-
export { type ActionChoice, type ActionContext, type ActionHandler, type ActionOutcome, type ActionReceipt, type ActionRegistry, type ActorPresentation, AgentTag, type AiCallArgs, type AiCapability, type AiResult, AlertIcon, type Attachment, Avatar, BotIcon, CheckIcon, ChevronLeftIcon, type ClientMessageId, ClockIcon, CloseIcon, Composer, type ComposerInputRenderProps, type Conversation, type ConversationCursor, type ConversationId, ConversationList, type ConversationListProps, type ConversationReadFailure, type ConversationRowWrapperProps, ConversationSkeleton, type ConversationSummary, type ConversationThread, type ConversationType, ConversationView, type ConversationViewProps, DEFAULT_MESSAGING_ARCHIVE_FILTER, 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 MessagingAgentIdentity, type MessagingAgents, type MessagingAi, type MessagingAiOptions, type MessagingArchiveFilter, type MessagingEngine, type MessagingEngineOptions, MessagingError, type MessagingErrorCode, type MessagingHost, type MessagingIdentity, MessagingInbox, type MessagingInboxProps, MessagingProvider, type MessagingProviderProps, type MessagingRepository, type MessagingSnapshot, type MessagingStore, type MessagingSupabaseClient, type MessagingSupabaseInternal, 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, SERVER_SESSION_IDENTITY, type SchemaLike, SearchIcon, SendIcon, type SessionIdentity, type SessionIdentitySnapshot, 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, createSessionIdentity, createWebOutboxStorage, effectiveActorKey, extractReferences, formatConversationTime, formatDateSeparator, formatLastSeen, formatMessageTime, formatTypists, groupMessages, inboxTopic, invalidResponse, isSameDay, messagingClientId, normalizeMessagingError, optimisticMessage, participantNames, projectConversationSummary, projectMessage, projectMessageAction, projectParticipantRole, projectUserSummary, resolveActor, splitText, summarizeText, toMessagingArchiveFilter, unreadCutoff, useComposer, useConversation, useConversations, useMessageAction, useMessagingAi, useMessagingHost, useMessagingSnapshot, useOnlineUserIds, useRequiredMessagingHost, useTypists };
|
|
1901
|
+
export { type ActionChoice, type ActionContext, type ActionHandler, type ActionOutcome, type ActionReceipt, type ActionRegistry, type ActorPresentation, AgentTag, type AiCallArgs, type AiCapability, type AiResult, AlertIcon, type Attachment, Avatar, BotIcon, CheckIcon, ChevronLeftIcon, type ClientMessageId, ClockIcon, CloseIcon, Composer, type ComposerInputRenderProps, type Conversation, type ConversationAiContext, type ConversationCursor, type ConversationId, ConversationList, type ConversationListProps, type ConversationReadFailure, type ConversationRowWrapperProps, ConversationSkeleton, type ConversationSummary, type ConversationThread, type ConversationType, ConversationView, type ConversationViewProps, DEFAULT_MESSAGING_ARCHIVE_FILTER, 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 MessagingAgentIdentity, type MessagingAgents, type MessagingAi, type MessagingAiOptions, type MessagingArchiveFilter, type MessagingEngine, type MessagingEngineOptions, MessagingError, type MessagingErrorCode, type MessagingHost, type MessagingIdentity, MessagingInbox, type MessagingInboxProps, MessagingProvider, type MessagingProviderProps, type MessagingRepository, type MessagingSnapshot, type MessagingStore, type MessagingSupabaseClient, type MessagingSupabaseInternal, 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, SERVER_SESSION_IDENTITY, type SchemaLike, SearchIcon, SendIcon, type SessionIdentity, type SessionIdentitySnapshot, 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, conversationContextVariables, conversationTopic, createActionRegistry, createMemoryOutboxStorage, createMessagingAi, createMessagingEngine, createMessagingRepository, createMessagingStore, createOutbox, createReadCache, createSessionIdentity, createWebOutboxStorage, effectiveActorKey, extractReferences, formatConversationTime, formatDateSeparator, formatLastSeen, formatMessageTime, formatTypists, groupMessages, inboxTopic, invalidResponse, isSameDay, messagingClientId, normalizeMessagingError, optimisticMessage, participantNames, projectConversationSummary, projectMessage, projectMessageAction, projectParticipantRole, projectUserSummary, resolveActor, splitText, summarizeText, toMessagingArchiveFilter, unreadCutoff, useComposer, useConversation, useConversations, useMessageAction, useMessagingAi, useMessagingHost, useMessagingSnapshot, useOnlineUserIds, useRequiredMessagingHost, useTypists };
|
package/dist/react.js
CHANGED
|
@@ -270,6 +270,20 @@ ${JSON.stringify(references, null, 2)}
|
|
|
270
270
|
}
|
|
271
271
|
|
|
272
272
|
// src/core/ai.ts
|
|
273
|
+
function conversationContextVariables(context, loadedMessageCount) {
|
|
274
|
+
const values = {
|
|
275
|
+
total_loaded_message_count: loadedMessageCount
|
|
276
|
+
};
|
|
277
|
+
if (context === void 0) return values;
|
|
278
|
+
if (context.conversationType) values.conversation_type = context.conversationType;
|
|
279
|
+
if (context.conversationName) values.conversation_name = context.conversationName;
|
|
280
|
+
if (context.conversationCreatedAt)
|
|
281
|
+
values.conversation_created_at = context.conversationCreatedAt;
|
|
282
|
+
if (typeof context.unreadCount === "number") values.unread_count = context.unreadCount;
|
|
283
|
+
if (typeof context.isMuted === "boolean") values.is_muted = context.isMuted;
|
|
284
|
+
if (context.readerUserId) values.reader_user_id = context.readerUserId;
|
|
285
|
+
return values;
|
|
286
|
+
}
|
|
273
287
|
function unreadCutoff(messages, unreadCount) {
|
|
274
288
|
if (unreadCount <= 0) return null;
|
|
275
289
|
const index = messages.length - unreadCount - 1;
|
|
@@ -359,7 +373,8 @@ function createMessagingAi(options) {
|
|
|
359
373
|
transcript_message_count: transcript.length,
|
|
360
374
|
// Honest about the cut, so an agent can say "showing the last 200".
|
|
361
375
|
transcript_truncated: args.messages.length > transcript.length,
|
|
362
|
-
...args.since != null ? { unread_since: args.since } : {}
|
|
376
|
+
...args.since != null ? { unread_since: args.since } : {},
|
|
377
|
+
...conversationContextVariables(args.context, args.messages.length)
|
|
363
378
|
};
|
|
364
379
|
}
|
|
365
380
|
function configured(capability) {
|
|
@@ -2631,6 +2646,14 @@ function useMessagingAi(conversationId) {
|
|
|
2631
2646
|
conversationId,
|
|
2632
2647
|
messages: conversation.messages,
|
|
2633
2648
|
participants: conversation.participants,
|
|
2649
|
+
context: {
|
|
2650
|
+
conversationType: conversation.summary?.conversation.type,
|
|
2651
|
+
conversationName: conversation.summary?.displayName,
|
|
2652
|
+
conversationCreatedAt: conversation.summary?.conversation.createdAt,
|
|
2653
|
+
unreadCount: conversation.summary?.unreadCount,
|
|
2654
|
+
isMuted: conversation.summary?.isMuted,
|
|
2655
|
+
readerUserId: host?.identity.userId || void 0
|
|
2656
|
+
},
|
|
2634
2657
|
signal: controller.signal,
|
|
2635
2658
|
// Live progress. Aborted runs stop painting immediately — a cancelled
|
|
2636
2659
|
// answer must not keep growing on screen.
|
|
@@ -3690,6 +3713,7 @@ export {
|
|
|
3690
3713
|
asOrganizationId,
|
|
3691
3714
|
asUserId,
|
|
3692
3715
|
composeFence,
|
|
3716
|
+
conversationContextVariables,
|
|
3693
3717
|
conversationTopic,
|
|
3694
3718
|
createActionRegistry,
|
|
3695
3719
|
createMemoryOutboxStorage,
|