@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.cjs CHANGED
@@ -1304,6 +1304,11 @@ function createMessagingEngine(options) {
1304
1304
  if (openChannels.has(id) || disposed) return;
1305
1305
  const handle = manager.open({
1306
1306
  topic: conversationTopic(id),
1307
+ // Presence callbacks are JOIN-TIME in supabase-js. Declare the
1308
+ // read-only room shape on the first holder (the engine) so the
1309
+ // composer/typist/online hooks can attach without forcing a rebuild
1310
+ // after this durable channel has already subscribed.
1311
+ presence: { publish: false, state: {} },
1307
1312
  postgresChanges: [
1308
1313
  {
1309
1314
  event: "*",
@@ -2394,6 +2399,7 @@ function readActorHint(metadata) {
2394
2399
  const avatar2 = record["agentAvatarUrl"] ?? record["agent_avatar_url"];
2395
2400
  return {
2396
2401
  agentId,
2402
+ showPrincipalAttribution: true,
2397
2403
  ...typeof name2 === "string" && name2.length > 0 ? { agentName: name2 } : {},
2398
2404
  ...typeof avatar2 === "string" && avatar2.length > 0 ? { agentAvatarUrl: avatar2 } : {}
2399
2405
  };
@@ -2404,6 +2410,7 @@ function readActorHint(metadata) {
2404
2410
  const name = envelope["actor_label"] ?? envelope["actorLabel"];
2405
2411
  const avatar = envelope["actor_avatar_url"] ?? envelope["actorAvatarUrl"];
2406
2412
  return {
2413
+ showPrincipalAttribution: false,
2407
2414
  ...typeof id === "string" && id.length > 0 ? { agentId: id } : {},
2408
2415
  ...typeof name === "string" && name.length > 0 ? { agentName: name } : {},
2409
2416
  ...typeof avatar === "string" && avatar.length > 0 ? { agentAvatarUrl: avatar } : {}
@@ -2425,7 +2432,11 @@ function resolveActor(message, sender) {
2425
2432
  displayName: hint.agentName ?? "Agent",
2426
2433
  avatarUrl: hint.agentAvatarUrl ?? null,
2427
2434
  isAgent: true,
2428
- onBehalfOfName: humanName,
2435
+ // The nested envelope explicitly models an agent acting on behalf of a
2436
+ // session principal. Platform event rows use the flat actor envelope as
2437
+ // the complete presentation identity; surfacing their audit writer as
2438
+ // "via Human" wrongly re-attaches that person to an automated event.
2439
+ onBehalfOfName: hint.showPrincipalAttribution ? humanName : null,
2429
2440
  principalUserId: message.senderId
2430
2441
  };
2431
2442
  }