@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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog — `@ai-matrx/messaging`
2
2
 
3
+ ## 0.15.1
4
+ ### Unreleased
5
+
6
+ ### Added
7
+
8
+ - `AiCallArgs.context` (`ConversationAiContext`) and
9
+ `conversationContextVariables()`: the four conversation intelligences now send
10
+ the `messaging.conversation` offered values by name — `conversation_type`,
11
+ `conversation_name`, `conversation_created_at`, `unread_count`, `is_muted`,
12
+ `reader_user_id`, and always `total_loaded_message_count` — beside the
13
+ existing variables, which are unchanged. `useMessagingAi` fills the context
14
+ from the inbox row and the host identity. Absent facts are omitted.
15
+
16
+ ### Consumer action
17
+
18
+ - None — optional field. A host calling `createMessagingAi` directly may pass
19
+ `context` to supply the same facts.
20
+
3
21
  ## 0.15.0
4
22
 
5
23
  ### Fixed
package/dist/index.cjs CHANGED
@@ -34,6 +34,7 @@ __export(src_exports, {
34
34
  asOrganizationId: () => asOrganizationId,
35
35
  asUserId: () => asUserId,
36
36
  composeFence: () => composeFence,
37
+ conversationContextVariables: () => conversationContextVariables,
37
38
  conversationTopic: () => conversationTopic,
38
39
  createActionRegistry: () => createActionRegistry,
39
40
  createMemoryOutboxStorage: () => createMemoryOutboxStorage,
@@ -395,6 +396,20 @@ ${JSON.stringify(references, null, 2)}
395
396
  }
396
397
 
397
398
  // src/core/ai.ts
399
+ function conversationContextVariables(context, loadedMessageCount) {
400
+ const values = {
401
+ total_loaded_message_count: loadedMessageCount
402
+ };
403
+ if (context === void 0) return values;
404
+ if (context.conversationType) values.conversation_type = context.conversationType;
405
+ if (context.conversationName) values.conversation_name = context.conversationName;
406
+ if (context.conversationCreatedAt)
407
+ values.conversation_created_at = context.conversationCreatedAt;
408
+ if (typeof context.unreadCount === "number") values.unread_count = context.unreadCount;
409
+ if (typeof context.isMuted === "boolean") values.is_muted = context.isMuted;
410
+ if (context.readerUserId) values.reader_user_id = context.readerUserId;
411
+ return values;
412
+ }
398
413
  function unreadCutoff(messages, unreadCount) {
399
414
  if (unreadCount <= 0) return null;
400
415
  const index = messages.length - unreadCount - 1;
@@ -484,7 +499,8 @@ function createMessagingAi(options) {
484
499
  transcript_message_count: transcript.length,
485
500
  // Honest about the cut, so an agent can say "showing the last 200".
486
501
  transcript_truncated: args.messages.length > transcript.length,
487
- ...args.since != null ? { unread_since: args.since } : {}
502
+ ...args.since != null ? { unread_since: args.since } : {},
503
+ ...conversationContextVariables(args.context, args.messages.length)
488
504
  };
489
505
  }
490
506
  function configured(capability) {