@ai-matrx/messaging 0.4.0 → 0.6.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/dist/index.cjs +0 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -11
- package/dist/index.d.ts +16 -11
- package/dist/index.js +0 -16
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +5 -18
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +16 -11
- package/dist/react.d.ts +16 -11
- package/dist/react.js +3 -16
- package/dist/react.js.map +1 -1
- package/package.json +2 -1
package/dist/index.d.cts
CHANGED
|
@@ -16,10 +16,22 @@ import { RealtimeManager } from '@ai-matrx/realtime';
|
|
|
16
16
|
* is the JSON boundary — `metadata` and `action_data` are host/DB-generated
|
|
17
17
|
* shapes this package does not own (the data 0.2.1 `Json = unknown` lesson).
|
|
18
18
|
*/
|
|
19
|
-
/**
|
|
20
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Nominal id types. A conversation id can never be passed where a user id goes.
|
|
21
|
+
*
|
|
22
|
+
* 🚨 THE MARKER IS A NAMED PROPERTY, NOT A `unique symbol`. This package ships
|
|
23
|
+
* two entries built as two separate bundles, so a `declare const brand: unique
|
|
24
|
+
* symbol` is DECLARED TWICE — and two unique symbols are two different types.
|
|
25
|
+
* `ConversationId` from `@ai-matrx/messaging` then does not match
|
|
26
|
+
* `ConversationId` from `@ai-matrx/messaging/react`, which makes the two
|
|
27
|
+
* entries unusable together: the first consumer hit exactly that, calling
|
|
28
|
+
* `asConversationId` from the core and passing it to a hook. A structural
|
|
29
|
+
* marker is identical in both declarations, so the brands unify — and it still
|
|
30
|
+
* cannot be produced by accident, which is all nominal typing needs to do.
|
|
31
|
+
* (The marker is types-only; nothing writes it at runtime.)
|
|
32
|
+
*/
|
|
21
33
|
type Brand<T, B extends string> = T & {
|
|
22
|
-
readonly
|
|
34
|
+
readonly __mxBrand: B;
|
|
23
35
|
};
|
|
24
36
|
type ConversationId = Brand<string, "ConversationId">;
|
|
25
37
|
type MessageId = Brand<string, "MessageId">;
|
|
@@ -910,13 +922,6 @@ declare function formatConversationTime(isoString: string | null, now?: number,
|
|
|
910
922
|
declare function formatMessageTime(isoString: string, locale?: string): string;
|
|
911
923
|
/** The separator between day groups in a thread. */
|
|
912
924
|
declare function formatDateSeparator(isoString: string, now?: number, locale?: string): string;
|
|
913
|
-
declare function getInitials(name: string): string;
|
|
914
|
-
/**
|
|
915
|
-
* A stable palette index for an avatar with no image. Deterministic on the id,
|
|
916
|
-
* so the same person is the same color on every device and every reload — a
|
|
917
|
-
* random color per render is a surprisingly loud bug.
|
|
918
|
-
*/
|
|
919
|
-
declare function avatarPaletteIndex(seed: string, buckets?: number): number;
|
|
920
925
|
/**
|
|
921
926
|
* Group consecutive messages by the same sender within a window, the way every
|
|
922
927
|
* good chat UI does — one avatar and one name per burst.
|
|
@@ -1015,4 +1020,4 @@ declare function summarizeText(content: string, maxLength?: number): string;
|
|
|
1015
1020
|
/** Serialize picked references into a fence the platform's other readers accept. */
|
|
1016
1021
|
declare function composeFence(references: readonly MatrxReference[]): string;
|
|
1017
1022
|
|
|
1018
|
-
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,
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -16,10 +16,22 @@ import { RealtimeManager } from '@ai-matrx/realtime';
|
|
|
16
16
|
* is the JSON boundary — `metadata` and `action_data` are host/DB-generated
|
|
17
17
|
* shapes this package does not own (the data 0.2.1 `Json = unknown` lesson).
|
|
18
18
|
*/
|
|
19
|
-
/**
|
|
20
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Nominal id types. A conversation id can never be passed where a user id goes.
|
|
21
|
+
*
|
|
22
|
+
* 🚨 THE MARKER IS A NAMED PROPERTY, NOT A `unique symbol`. This package ships
|
|
23
|
+
* two entries built as two separate bundles, so a `declare const brand: unique
|
|
24
|
+
* symbol` is DECLARED TWICE — and two unique symbols are two different types.
|
|
25
|
+
* `ConversationId` from `@ai-matrx/messaging` then does not match
|
|
26
|
+
* `ConversationId` from `@ai-matrx/messaging/react`, which makes the two
|
|
27
|
+
* entries unusable together: the first consumer hit exactly that, calling
|
|
28
|
+
* `asConversationId` from the core and passing it to a hook. A structural
|
|
29
|
+
* marker is identical in both declarations, so the brands unify — and it still
|
|
30
|
+
* cannot be produced by accident, which is all nominal typing needs to do.
|
|
31
|
+
* (The marker is types-only; nothing writes it at runtime.)
|
|
32
|
+
*/
|
|
21
33
|
type Brand<T, B extends string> = T & {
|
|
22
|
-
readonly
|
|
34
|
+
readonly __mxBrand: B;
|
|
23
35
|
};
|
|
24
36
|
type ConversationId = Brand<string, "ConversationId">;
|
|
25
37
|
type MessageId = Brand<string, "MessageId">;
|
|
@@ -910,13 +922,6 @@ declare function formatConversationTime(isoString: string | null, now?: number,
|
|
|
910
922
|
declare function formatMessageTime(isoString: string, locale?: string): string;
|
|
911
923
|
/** The separator between day groups in a thread. */
|
|
912
924
|
declare function formatDateSeparator(isoString: string, now?: number, locale?: string): string;
|
|
913
|
-
declare function getInitials(name: string): string;
|
|
914
|
-
/**
|
|
915
|
-
* A stable palette index for an avatar with no image. Deterministic on the id,
|
|
916
|
-
* so the same person is the same color on every device and every reload — a
|
|
917
|
-
* random color per render is a surprisingly loud bug.
|
|
918
|
-
*/
|
|
919
|
-
declare function avatarPaletteIndex(seed: string, buckets?: number): number;
|
|
920
925
|
/**
|
|
921
926
|
* Group consecutive messages by the same sender within a window, the way every
|
|
922
927
|
* good chat UI does — one avatar and one name per burst.
|
|
@@ -1015,4 +1020,4 @@ declare function summarizeText(content: string, maxLength?: number): string;
|
|
|
1015
1020
|
/** Serialize picked references into a fence the platform's other readers accept. */
|
|
1016
1021
|
declare function composeFence(references: readonly MatrxReference[]): string;
|
|
1017
1022
|
|
|
1018
|
-
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,
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -1431,20 +1431,6 @@ function formatDateSeparator(isoString, now = Date.now(), locale) {
|
|
|
1431
1431
|
day: "numeric"
|
|
1432
1432
|
});
|
|
1433
1433
|
}
|
|
1434
|
-
function getInitials(name) {
|
|
1435
|
-
const parts = name.trim().split(/\s+/).filter(Boolean);
|
|
1436
|
-
if (parts.length === 0) return "?";
|
|
1437
|
-
const first = parts[0]?.[0] ?? "";
|
|
1438
|
-
const last = parts.length > 1 ? parts.at(-1)?.[0] ?? "" : "";
|
|
1439
|
-
return `${first}${last}`.toUpperCase() || "?";
|
|
1440
|
-
}
|
|
1441
|
-
function avatarPaletteIndex(seed, buckets = 8) {
|
|
1442
|
-
let hash = 0;
|
|
1443
|
-
for (let index = 0; index < seed.length; index += 1) {
|
|
1444
|
-
hash = hash * 31 + seed.charCodeAt(index) | 0;
|
|
1445
|
-
}
|
|
1446
|
-
return Math.abs(hash) % buckets;
|
|
1447
|
-
}
|
|
1448
1434
|
function groupMessages(messages, args = {}) {
|
|
1449
1435
|
const windowMs = args.windowMs ?? 5 * MINUTE;
|
|
1450
1436
|
const now = args.now ?? Date.now();
|
|
@@ -1847,7 +1833,6 @@ export {
|
|
|
1847
1833
|
asMessageId,
|
|
1848
1834
|
asOrganizationId,
|
|
1849
1835
|
asUserId,
|
|
1850
|
-
avatarPaletteIndex,
|
|
1851
1836
|
composeFence,
|
|
1852
1837
|
conversationTopic,
|
|
1853
1838
|
createActionRegistry,
|
|
@@ -1865,7 +1850,6 @@ export {
|
|
|
1865
1850
|
formatLastSeen,
|
|
1866
1851
|
formatMessageTime,
|
|
1867
1852
|
formatTypists,
|
|
1868
|
-
getInitials,
|
|
1869
1853
|
groupMessages,
|
|
1870
1854
|
inboxTopic,
|
|
1871
1855
|
invalidResponse,
|