@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/index.d.cts
CHANGED
|
@@ -412,11 +412,34 @@ interface AiResult {
|
|
|
412
412
|
readonly text: string;
|
|
413
413
|
readonly conversationId: string | null;
|
|
414
414
|
}
|
|
415
|
+
/**
|
|
416
|
+
* Facts about the open conversation the caller already holds (the inbox row
|
|
417
|
+
* and the signed-in reader). Each is sent by its offered name
|
|
418
|
+
* (`messaging.conversation`, mapped-only) beside the transcript; an absent
|
|
419
|
+
* one is omitted, never sent empty. Nothing here changes the transcript.
|
|
420
|
+
*/
|
|
421
|
+
interface ConversationAiContext {
|
|
422
|
+
conversationType?: ConversationType | undefined;
|
|
423
|
+
/** The name the reader sees: the group name, or the other person's name. */
|
|
424
|
+
conversationName?: string | undefined;
|
|
425
|
+
conversationCreatedAt?: string | undefined;
|
|
426
|
+
unreadCount?: number | undefined;
|
|
427
|
+
isMuted?: boolean | undefined;
|
|
428
|
+
readerUserId?: string | undefined;
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* The offered values of `ConversationAiContext`, by name. Pure, so a host that
|
|
432
|
+
* builds its own call can reuse it. `total_loaded_message_count` is the
|
|
433
|
+
* messages the caller loaded BEFORE windowing.
|
|
434
|
+
*/
|
|
435
|
+
declare function conversationContextVariables(context: ConversationAiContext | undefined, loadedMessageCount: number): MatrxJsonObject;
|
|
415
436
|
/** What every capability takes: the conversation, and how to watch the run. */
|
|
416
437
|
interface AiCallArgs {
|
|
417
438
|
conversationId: ConversationId;
|
|
418
439
|
messages: readonly Message[];
|
|
419
440
|
participants: readonly UserSummary[];
|
|
441
|
+
/** Conversation facts sent by name beside the transcript (optional). */
|
|
442
|
+
context?: ConversationAiContext | undefined;
|
|
420
443
|
signal?: AbortSignal | undefined;
|
|
421
444
|
/** The accumulated answer so far, after every streamed chunk. */
|
|
422
445
|
onText?: ((fullText: string) => void) | undefined;
|
|
@@ -1399,4 +1422,4 @@ declare function summarizeText(content: string, maxLength?: number): string;
|
|
|
1399
1422
|
/** Serialize picked references into a fence the platform's other readers accept. */
|
|
1400
1423
|
declare function composeFence(references: readonly MatrxReference[]): string;
|
|
1401
1424
|
|
|
1402
|
-
export { type ActionChoice, type ActionContext, type ActionHandler, type ActionOutcome, type ActionReceipt, type ActionRegistry, type ActorPresentation, type AiCallArgs, type AiCapability, type AiResult, type Attachment, type ClientMessageId, type Conversation, type ConversationCursor, type ConversationId, type ConversationReadFailure, type ConversationSummary, type ConversationThread, type ConversationType, DEFAULT_MESSAGING_ARCHIVE_FILTER, 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 MessagingAgentIdentity, type MessagingAgents, type MessagingAi, type MessagingAiOptions, type MessagingArchiveFilter, type MessagingEngine, type MessagingEngineOptions, MessagingError, type MessagingErrorCode, type MessagingIdentity, type MessagingRepository, type MessagingSnapshot, type MessagingStore, type MessagingSupabaseClient, type MessagingSupabaseInternal, 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, SERVER_SESSION_IDENTITY, type SchemaLike, type SessionIdentity, type SessionIdentitySnapshot, 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, 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 };
|
|
1425
|
+
export { type ActionChoice, type ActionContext, type ActionHandler, type ActionOutcome, type ActionReceipt, type ActionRegistry, type ActorPresentation, type AiCallArgs, type AiCapability, type AiResult, type Attachment, type ClientMessageId, type Conversation, type ConversationAiContext, type ConversationCursor, type ConversationId, type ConversationReadFailure, type ConversationSummary, type ConversationThread, type ConversationType, DEFAULT_MESSAGING_ARCHIVE_FILTER, 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 MessagingAgentIdentity, type MessagingAgents, type MessagingAi, type MessagingAiOptions, type MessagingArchiveFilter, type MessagingEngine, type MessagingEngineOptions, MessagingError, type MessagingErrorCode, type MessagingIdentity, type MessagingRepository, type MessagingSnapshot, type MessagingStore, type MessagingSupabaseClient, type MessagingSupabaseInternal, 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, SERVER_SESSION_IDENTITY, type SchemaLike, type SessionIdentity, type SessionIdentitySnapshot, type SessionResolver, type SupabaseLike, TABLES, type TextSegment, type UserId, type UserSummary, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -412,11 +412,34 @@ interface AiResult {
|
|
|
412
412
|
readonly text: string;
|
|
413
413
|
readonly conversationId: string | null;
|
|
414
414
|
}
|
|
415
|
+
/**
|
|
416
|
+
* Facts about the open conversation the caller already holds (the inbox row
|
|
417
|
+
* and the signed-in reader). Each is sent by its offered name
|
|
418
|
+
* (`messaging.conversation`, mapped-only) beside the transcript; an absent
|
|
419
|
+
* one is omitted, never sent empty. Nothing here changes the transcript.
|
|
420
|
+
*/
|
|
421
|
+
interface ConversationAiContext {
|
|
422
|
+
conversationType?: ConversationType | undefined;
|
|
423
|
+
/** The name the reader sees: the group name, or the other person's name. */
|
|
424
|
+
conversationName?: string | undefined;
|
|
425
|
+
conversationCreatedAt?: string | undefined;
|
|
426
|
+
unreadCount?: number | undefined;
|
|
427
|
+
isMuted?: boolean | undefined;
|
|
428
|
+
readerUserId?: string | undefined;
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* The offered values of `ConversationAiContext`, by name. Pure, so a host that
|
|
432
|
+
* builds its own call can reuse it. `total_loaded_message_count` is the
|
|
433
|
+
* messages the caller loaded BEFORE windowing.
|
|
434
|
+
*/
|
|
435
|
+
declare function conversationContextVariables(context: ConversationAiContext | undefined, loadedMessageCount: number): MatrxJsonObject;
|
|
415
436
|
/** What every capability takes: the conversation, and how to watch the run. */
|
|
416
437
|
interface AiCallArgs {
|
|
417
438
|
conversationId: ConversationId;
|
|
418
439
|
messages: readonly Message[];
|
|
419
440
|
participants: readonly UserSummary[];
|
|
441
|
+
/** Conversation facts sent by name beside the transcript (optional). */
|
|
442
|
+
context?: ConversationAiContext | undefined;
|
|
420
443
|
signal?: AbortSignal | undefined;
|
|
421
444
|
/** The accumulated answer so far, after every streamed chunk. */
|
|
422
445
|
onText?: ((fullText: string) => void) | undefined;
|
|
@@ -1399,4 +1422,4 @@ declare function summarizeText(content: string, maxLength?: number): string;
|
|
|
1399
1422
|
/** Serialize picked references into a fence the platform's other readers accept. */
|
|
1400
1423
|
declare function composeFence(references: readonly MatrxReference[]): string;
|
|
1401
1424
|
|
|
1402
|
-
export { type ActionChoice, type ActionContext, type ActionHandler, type ActionOutcome, type ActionReceipt, type ActionRegistry, type ActorPresentation, type AiCallArgs, type AiCapability, type AiResult, type Attachment, type ClientMessageId, type Conversation, type ConversationCursor, type ConversationId, type ConversationReadFailure, type ConversationSummary, type ConversationThread, type ConversationType, DEFAULT_MESSAGING_ARCHIVE_FILTER, 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 MessagingAgentIdentity, type MessagingAgents, type MessagingAi, type MessagingAiOptions, type MessagingArchiveFilter, type MessagingEngine, type MessagingEngineOptions, MessagingError, type MessagingErrorCode, type MessagingIdentity, type MessagingRepository, type MessagingSnapshot, type MessagingStore, type MessagingSupabaseClient, type MessagingSupabaseInternal, 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, SERVER_SESSION_IDENTITY, type SchemaLike, type SessionIdentity, type SessionIdentitySnapshot, 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, 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 };
|
|
1425
|
+
export { type ActionChoice, type ActionContext, type ActionHandler, type ActionOutcome, type ActionReceipt, type ActionRegistry, type ActorPresentation, type AiCallArgs, type AiCapability, type AiResult, type Attachment, type ClientMessageId, type Conversation, type ConversationAiContext, type ConversationCursor, type ConversationId, type ConversationReadFailure, type ConversationSummary, type ConversationThread, type ConversationType, DEFAULT_MESSAGING_ARCHIVE_FILTER, 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 MessagingAgentIdentity, type MessagingAgents, type MessagingAi, type MessagingAiOptions, type MessagingArchiveFilter, type MessagingEngine, type MessagingEngineOptions, MessagingError, type MessagingErrorCode, type MessagingIdentity, type MessagingRepository, type MessagingSnapshot, type MessagingStore, type MessagingSupabaseClient, type MessagingSupabaseInternal, 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, SERVER_SESSION_IDENTITY, type SchemaLike, type SessionIdentity, type SessionIdentitySnapshot, type SessionResolver, type SupabaseLike, TABLES, type TextSegment, type UserId, type UserSummary, 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 };
|
package/dist/index.js
CHANGED
|
@@ -323,6 +323,20 @@ ${JSON.stringify(references, null, 2)}
|
|
|
323
323
|
}
|
|
324
324
|
|
|
325
325
|
// src/core/ai.ts
|
|
326
|
+
function conversationContextVariables(context, loadedMessageCount) {
|
|
327
|
+
const values = {
|
|
328
|
+
total_loaded_message_count: loadedMessageCount
|
|
329
|
+
};
|
|
330
|
+
if (context === void 0) return values;
|
|
331
|
+
if (context.conversationType) values.conversation_type = context.conversationType;
|
|
332
|
+
if (context.conversationName) values.conversation_name = context.conversationName;
|
|
333
|
+
if (context.conversationCreatedAt)
|
|
334
|
+
values.conversation_created_at = context.conversationCreatedAt;
|
|
335
|
+
if (typeof context.unreadCount === "number") values.unread_count = context.unreadCount;
|
|
336
|
+
if (typeof context.isMuted === "boolean") values.is_muted = context.isMuted;
|
|
337
|
+
if (context.readerUserId) values.reader_user_id = context.readerUserId;
|
|
338
|
+
return values;
|
|
339
|
+
}
|
|
326
340
|
function unreadCutoff(messages, unreadCount) {
|
|
327
341
|
if (unreadCount <= 0) return null;
|
|
328
342
|
const index = messages.length - unreadCount - 1;
|
|
@@ -412,7 +426,8 @@ function createMessagingAi(options) {
|
|
|
412
426
|
transcript_message_count: transcript.length,
|
|
413
427
|
// Honest about the cut, so an agent can say "showing the last 200".
|
|
414
428
|
transcript_truncated: args.messages.length > transcript.length,
|
|
415
|
-
...args.since != null ? { unread_since: args.since } : {}
|
|
429
|
+
...args.since != null ? { unread_since: args.since } : {},
|
|
430
|
+
...conversationContextVariables(args.context, args.messages.length)
|
|
416
431
|
};
|
|
417
432
|
}
|
|
418
433
|
function configured(capability) {
|
|
@@ -2226,6 +2241,7 @@ export {
|
|
|
2226
2241
|
asOrganizationId,
|
|
2227
2242
|
asUserId,
|
|
2228
2243
|
composeFence,
|
|
2244
|
+
conversationContextVariables,
|
|
2229
2245
|
conversationTopic,
|
|
2230
2246
|
createActionRegistry,
|
|
2231
2247
|
createMemoryOutboxStorage,
|