@ai-matrx/messaging 0.10.2 → 0.10.3

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/dist/index.js CHANGED
@@ -81,6 +81,7 @@ function readActorHint(metadata) {
81
81
  const avatar2 = record["agentAvatarUrl"] ?? record["agent_avatar_url"];
82
82
  return {
83
83
  agentId,
84
+ showPrincipalAttribution: true,
84
85
  ...typeof name2 === "string" && name2.length > 0 ? { agentName: name2 } : {},
85
86
  ...typeof avatar2 === "string" && avatar2.length > 0 ? { agentAvatarUrl: avatar2 } : {}
86
87
  };
@@ -91,6 +92,7 @@ function readActorHint(metadata) {
91
92
  const name = envelope["actor_label"] ?? envelope["actorLabel"];
92
93
  const avatar = envelope["actor_avatar_url"] ?? envelope["actorAvatarUrl"];
93
94
  return {
95
+ showPrincipalAttribution: false,
94
96
  ...typeof id === "string" && id.length > 0 ? { agentId: id } : {},
95
97
  ...typeof name === "string" && name.length > 0 ? { agentName: name } : {},
96
98
  ...typeof avatar === "string" && avatar.length > 0 ? { agentAvatarUrl: avatar } : {}
@@ -112,7 +114,11 @@ function resolveActor(message, sender) {
112
114
  displayName: hint.agentName ?? "Agent",
113
115
  avatarUrl: hint.agentAvatarUrl ?? null,
114
116
  isAgent: true,
115
- onBehalfOfName: humanName,
117
+ // The nested envelope explicitly models an agent acting on behalf of a
118
+ // session principal. Platform event rows use the flat actor envelope as
119
+ // the complete presentation identity; surfacing their audit writer as
120
+ // "via Human" wrongly re-attaches that person to an automated event.
121
+ onBehalfOfName: hint.showPrincipalAttribution ? humanName : null,
116
122
  principalUserId: message.senderId
117
123
  };
118
124
  }
@@ -1304,6 +1310,11 @@ function createMessagingEngine(options) {
1304
1310
  if (openChannels.has(id) || disposed) return;
1305
1311
  const handle = manager.open({
1306
1312
  topic: conversationTopic(id),
1313
+ // Presence callbacks are JOIN-TIME in supabase-js. Declare the
1314
+ // read-only room shape on the first holder (the engine) so the
1315
+ // composer/typist/online hooks can attach without forcing a rebuild
1316
+ // after this durable channel has already subscribed.
1317
+ presence: { publish: false, state: {} },
1307
1318
  postgresChanges: [
1308
1319
  {
1309
1320
  event: "*",