@@ -11,7 +11,6 @@ import {
1111 loadSessionEntryReadOnly as loadAccessorSessionEntryReadOnly ,
1212 resolveTranscriptSessionKeyBySessionId ,
1313} from "../config/sessions/session-accessor.js" ;
14- import { hasPluginSessionsChangedSubscribers } from "../plugins/gateway-events.js" ;
1514import { normalizeAgentId , parseAgentSessionKey } from "../routing/session-key.js" ;
1615import type { SessionLifecycleEvent } from "../sessions/session-lifecycle-events.js" ;
1716import type { InternalSessionTranscriptUpdate } from "../sessions/transcript-events.js" ;
@@ -23,6 +22,7 @@ import type {
2322 SessionMessageSubscriberRegistry ,
2423} from "./server-chat.js" ;
2524import { resolveVisibleActiveSessionRunState } from "./server-methods/session-active-runs.js" ;
25+ import { hasSessionChangeReceivers } from "./session-change-receivers.js" ;
2626import {
2727 buildGatewaySessionEventFields ,
2828 buildGatewaySessionEventRow ,
@@ -40,10 +40,6 @@ import {
4040type SessionEventSubscribers = Pick < SessionEventSubscriberRegistry , "getAll" > ;
4141type SessionMessageSubscribers = Pick < SessionMessageSubscriberRegistry , "get" > ;
4242
43- function hasSessionsChangedReceiver ( connIds : ReadonlySet < string > ) : boolean {
44- return connIds . size > 0 || hasPluginSessionsChangedSubscribers ( ) ;
45- }
46-
4743function readMessageIdempotencyKey ( message : unknown ) : string | undefined {
4844 if ( ! message || typeof message !== "object" || Array . isArray ( message ) ) {
4945 return undefined ;
@@ -271,7 +267,7 @@ async function handleTranscriptUpdateBroadcast(
271267 }
272268 if ( connIds . size === 0 ) {
273269 if (
274- ! hasPluginSessionsChangedSubscribers ( ) ||
270+ ! hasSessionChangeReceivers ( connIds ) ||
275271 ( update . message !== undefined && projectChatDisplayMessage ( update . message ) )
276272 ) {
277273 return ;
@@ -388,7 +384,7 @@ async function handleTranscriptUpdateBroadcast(
388384 // Messages suppressed from display can still change transcript state, so
389385 // notify broad session listeners even when no session.message is emitted.
390386 const sessionEventConnIds = params . sessionEventSubscribers . getAll ( ) ;
391- if ( ! hasSessionsChangedReceiver ( sessionEventConnIds ) ) {
387+ if ( ! hasSessionChangeReceivers ( sessionEventConnIds ) ) {
392388 return ;
393389 }
394390 params . broadcastToConnIds (
@@ -420,7 +416,7 @@ export function createLifecycleEventBroadcastHandler(params: {
420416 text ?: string ;
421417 } ;
422418 const connIds = params . sessionEventSubscribers . getAll ( ) ;
423- if ( ! hasSessionsChangedReceiver ( connIds ) ) {
419+ if ( ! hasSessionChangeReceivers ( connIds ) ) {
424420 return ;
425421 }
426422 const sessionRow = loadGatewaySessionRow ( event . sessionKey ) ;
0 commit comments