@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/react.js CHANGED
@@ -1211,6 +1211,11 @@ function createMessagingEngine(options) {
1211
1211
  if (openChannels.has(id) || disposed) return;
1212
1212
  const handle = manager.open({
1213
1213
  topic: conversationTopic(id),
1214
+ // Presence callbacks are JOIN-TIME in supabase-js. Declare the
1215
+ // read-only room shape on the first holder (the engine) so the
1216
+ // composer/typist/online hooks can attach without forcing a rebuild
1217
+ // after this durable channel has already subscribed.
1218
+ presence: { publish: false, state: {} },
1214
1219
  postgresChanges: [
1215
1220
  {
1216
1221
  event: "*",
@@ -2306,6 +2311,7 @@ function readActorHint(metadata) {
2306
2311
  const avatar2 = record["agentAvatarUrl"] ?? record["agent_avatar_url"];
2307
2312
  return {
2308
2313
  agentId,
2314
+ showPrincipalAttribution: true,
2309
2315
  ...typeof name2 === "string" && name2.length > 0 ? { agentName: name2 } : {},
2310
2316
  ...typeof avatar2 === "string" && avatar2.length > 0 ? { agentAvatarUrl: avatar2 } : {}
2311
2317
  };
@@ -2316,6 +2322,7 @@ function readActorHint(metadata) {
2316
2322
  const name = envelope["actor_label"] ?? envelope["actorLabel"];
2317
2323
  const avatar = envelope["actor_avatar_url"] ?? envelope["actorAvatarUrl"];
2318
2324
  return {
2325
+ showPrincipalAttribution: false,
2319
2326
  ...typeof id === "string" && id.length > 0 ? { agentId: id } : {},
2320
2327
  ...typeof name === "string" && name.length > 0 ? { agentName: name } : {},
2321
2328
  ...typeof avatar === "string" && avatar.length > 0 ? { agentAvatarUrl: avatar } : {}
@@ -2337,7 +2344,11 @@ function resolveActor(message, sender) {
2337
2344
  displayName: hint.agentName ?? "Agent",
2338
2345
  avatarUrl: hint.agentAvatarUrl ?? null,
2339
2346
  isAgent: true,
2340
- onBehalfOfName: humanName,
2347
+ // The nested envelope explicitly models an agent acting on behalf of a
2348
+ // session principal. Platform event rows use the flat actor envelope as
2349
+ // the complete presentation identity; surfacing their audit writer as
2350
+ // "via Human" wrongly re-attaches that person to an automated event.
2351
+ onBehalfOfName: hint.showPrincipalAttribution ? humanName : null,
2341
2352
  principalUserId: message.senderId
2342
2353
  };
2343
2354
  }