@memberjunction/ai-bridge-server 0.0.1 → 5.41.0

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.
Files changed (38) hide show
  1. package/README.md +120 -42
  2. package/dist/ai-bridge-engine.d.ts +505 -0
  3. package/dist/ai-bridge-engine.d.ts.map +1 -0
  4. package/dist/ai-bridge-engine.js +833 -0
  5. package/dist/ai-bridge-engine.js.map +1 -0
  6. package/dist/calendar-source.d.ts +142 -0
  7. package/dist/calendar-source.d.ts.map +1 -0
  8. package/dist/calendar-source.js +63 -0
  9. package/dist/calendar-source.js.map +1 -0
  10. package/dist/calendar-watcher.d.ts +174 -0
  11. package/dist/calendar-watcher.d.ts.map +1 -0
  12. package/dist/calendar-watcher.js +248 -0
  13. package/dist/calendar-watcher.js.map +1 -0
  14. package/dist/identity-provisioner.d.ts +109 -0
  15. package/dist/identity-provisioner.d.ts.map +1 -0
  16. package/dist/identity-provisioner.js +71 -0
  17. package/dist/identity-provisioner.js.map +1 -0
  18. package/dist/index.d.ts +9 -0
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +9 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/join-url-resolver.d.ts +37 -0
  23. package/dist/join-url-resolver.d.ts.map +1 -0
  24. package/dist/join-url-resolver.js +102 -0
  25. package/dist/join-url-resolver.js.map +1 -0
  26. package/dist/loopback-bridge.d.ts +165 -0
  27. package/dist/loopback-bridge.d.ts.map +1 -0
  28. package/dist/loopback-bridge.js +255 -0
  29. package/dist/loopback-bridge.js.map +1 -0
  30. package/dist/multi-agent-room-coordinator.d.ts +198 -0
  31. package/dist/multi-agent-room-coordinator.d.ts.map +1 -0
  32. package/dist/multi-agent-room-coordinator.js +296 -0
  33. package/dist/multi-agent-room-coordinator.js.map +1 -0
  34. package/dist/scheduled-bridge-runner.d.ts +126 -0
  35. package/dist/scheduled-bridge-runner.d.ts.map +1 -0
  36. package/dist/scheduled-bridge-runner.js +140 -0
  37. package/dist/scheduled-bridge-runner.js.map +1 -0
  38. package/package.json +34 -7
@@ -0,0 +1,165 @@
1
+ import { BaseRealtimeBridge, BridgeConnectResult, BridgeDisconnectReason, BridgeMediaFrame, BridgeMediaTrackKind, BridgeParticipantInfo, RealtimeBridgeContext, IBridgeMeetingControlsEventSource, BridgeMeetingParticipant, BridgeMeetingControlsCapability } from '@memberjunction/ai-bridge-base';
2
+ /**
3
+ * The `DriverClass` key the {@link LoopbackBridge} registers under. A bridge provider row with
4
+ * `DriverClass = 'LoopbackBridge'` resolves to this driver via the `ClassFactory`.
5
+ */
6
+ export declare const LOOPBACK_BRIDGE_DRIVER_CLASS = "LoopbackBridge";
7
+ /**
8
+ * A trivial in-memory {@link IBridgeMeetingControlsEventSource} for tests — the loopback driver's
9
+ * optional facilitator surface. It records the registered perception handlers and exposes `Emit*`
10
+ * helpers so a test can drive roster / speaking / hand-raise signals into the Meeting Controls
11
+ * channel, and records mute requests. A real driver (e.g. `ZoomBridge`) implements this by adapting
12
+ * its native participant/event stream; the loopback version proves the bridge → channel-plane wiring
13
+ * with no platform.
14
+ */
15
+ export declare class LoopbackMeetingControlsEventSource implements IBridgeMeetingControlsEventSource {
16
+ private rosterHandler?;
17
+ private speakingHandler?;
18
+ private handRaiseHandler?;
19
+ /** Participant ids this source was asked to mute, in order — a capture sink for assertions. */
20
+ readonly Muted: string[];
21
+ /** The facilitator capabilities the loopback advertises (mute supported, so the gated tool appears). */
22
+ readonly Capabilities: ReadonlyArray<BridgeMeetingControlsCapability>;
23
+ /** @inheritdoc */
24
+ OnRosterChange(handler: (participants: BridgeMeetingParticipant[]) => void): void;
25
+ /** @inheritdoc */
26
+ OnSpeakingChange(handler: (participantIds: string[]) => void): void;
27
+ /** @inheritdoc */
28
+ OnHandRaiseChange(handler: (participantId: string, raised: boolean) => void): void;
29
+ /** @inheritdoc */
30
+ MuteParticipant(participantId: string): Promise<void>;
31
+ /** Drives a roster snapshot into the channel. */
32
+ EmitRoster(participants: BridgeMeetingParticipant[]): void;
33
+ /** Drives a speaking-set change into the channel. */
34
+ EmitSpeaking(participantIds: string[]): void;
35
+ /** Drives a platform hand-raise/lower signal into the channel. */
36
+ EmitHandRaise(participantId: string, raised: boolean): void;
37
+ }
38
+ /**
39
+ * An in-memory, platform-free Realtime Bridge driver for **test and development**.
40
+ *
41
+ * `LoopbackBridge` proves the transport seam round-trips media with NO external conferencing or
42
+ * telephony platform: every frame sent via {@link SendMedia} is **echoed straight back** through the
43
+ * inbound {@link OnMedia} handler (re-stamped to the matching inbound track), and {@link GetParticipants}
44
+ * returns a single synthetic agent participant. Wired into {@link AIBridgeEngine} with a mock
45
+ * `IRealtimeSession`, it demonstrates that bridge → session → bridge media flow works end-to-end —
46
+ * the deferred "unified-transport track" foundation, validated with zero infrastructure.
47
+ *
48
+ * It declares an audio-capable, diarizing feature set so the engine exercises both the media seam
49
+ * and participant tracking against it. Telephony/recording features stay off (their virtual base
50
+ * methods keep throwing `NotSupported`), so the loopback driver also documents the capability-gating
51
+ * contract by example.
52
+ *
53
+ * Registered via `@RegisterClass(BaseRealtimeBridge, 'LoopbackBridge')`.
54
+ */
55
+ export declare class LoopbackBridge extends BaseRealtimeBridge {
56
+ /** Whether {@link Connect} has run and the bridge is "online". */
57
+ private connected;
58
+ /** The inbound-media handler registered via {@link OnMedia}; frames are echoed to it. */
59
+ private mediaHandler?;
60
+ /** The roster-change handler registered via {@link OnParticipantChange}. */
61
+ private participantHandler?;
62
+ /**
63
+ * Every frame the engine sent outbound, in order — a capture sink for assertions in tests.
64
+ * The frames are ALSO echoed back inbound; this array is the durable record of what was sent.
65
+ */
66
+ readonly Sent: BridgeMediaFrame[];
67
+ /** The synthetic agent participant the loopback endpoint reports. */
68
+ private static readonly AGENT_PARTICIPANT;
69
+ /**
70
+ * The optional Meeting Controls event source. `null` by default so the loopback driver contributes
71
+ * NO facilitator surface (matching most drivers) — a test opts in via {@link EnableMeetingControls}
72
+ * to exercise the bridge → channel-plane wiring.
73
+ */
74
+ private meetingControls;
75
+ /**
76
+ * Enables (and returns) a simple {@link LoopbackMeetingControlsEventSource} so this loopback driver
77
+ * contributes a Meeting Controls surface — used by tests of the engine's channel-plane wiring. The
78
+ * returned source's `Emit*` helpers drive roster / speaking / hand-raise signals into the channel.
79
+ *
80
+ * @returns The enabled event source (the same instance {@link GetMeetingControlsEventSource} returns).
81
+ */
82
+ EnableMeetingControls(): LoopbackMeetingControlsEventSource;
83
+ /**
84
+ * Returns the loopback's Meeting Controls event source when {@link EnableMeetingControls} was
85
+ * called, else `null` (the base default — no facilitator surface).
86
+ */
87
+ GetMeetingControlsEventSource(): IBridgeMeetingControlsEventSource | null;
88
+ /**
89
+ * The enabled Meeting Controls event source (or `null`), typed concretely so tests can drive its
90
+ * `Emit*` helpers. {@link GetMeetingControlsEventSource} returns the same instance via the interface.
91
+ */
92
+ get MeetingControlsSource(): LoopbackMeetingControlsEventSource | null;
93
+ /**
94
+ * "Connects" the loopback endpoint. Records the context for capability gating and returns
95
+ * synthetic handles. No network, no platform — always succeeds. After connecting, emits an
96
+ * initial roster (the synthetic agent participant) to any registered roster handler.
97
+ *
98
+ * @param ctx The bridge context (features, provider name, address).
99
+ * @returns Synthetic bot + connection identifiers.
100
+ */
101
+ Connect(ctx: RealtimeBridgeContext): Promise<BridgeConnectResult>;
102
+ /**
103
+ * Tears the loopback endpoint down and drops all handlers. Always clean.
104
+ *
105
+ * @param _reason Why the disconnect happened (unused — loopback teardown is uniform).
106
+ */
107
+ Disconnect(_reason: BridgeDisconnectReason): Promise<void>;
108
+ /**
109
+ * Sends an outbound media frame — and **echoes it straight back** through the inbound handler,
110
+ * re-stamped to the matching inbound track (`audio-out` → `audio-in`, etc.). This is what makes
111
+ * the loopback round-trip provable: what the agent "says" is immediately what the agent "hears",
112
+ * so a test can drive the realtime-session output and observe it arrive back as session input.
113
+ *
114
+ * @param track The outbound track the frame targets.
115
+ * @param frame The media frame to send (and echo).
116
+ */
117
+ SendMedia(track: BridgeMediaTrackKind, frame: BridgeMediaFrame): void;
118
+ /**
119
+ * Registers the inbound-media handler. The loopback echoes outbound frames to this handler.
120
+ *
121
+ * @param handler Invoked with each (echoed) inbound media frame.
122
+ */
123
+ OnMedia(handler: (frame: BridgeMediaFrame) => void): void;
124
+ /**
125
+ * Returns the loopback roster — a single synthetic agent participant. Overrides the
126
+ * capability-gated base method (gated by `SpeakerDiarization`, which the loopback provider
127
+ * enables in its feature set).
128
+ *
129
+ * @returns The synthetic participant list.
130
+ */
131
+ GetParticipants(): Promise<BridgeParticipantInfo[]>;
132
+ /**
133
+ * Registers a roster-change handler. The loopback fires it once at {@link Connect} time with the
134
+ * synthetic participant; {@link EmitParticipants} lets tests drive further roster changes.
135
+ *
136
+ * @param handler Invoked with the updated participant list on each change.
137
+ */
138
+ OnParticipantChange(handler: (participants: BridgeParticipantInfo[]) => void): void;
139
+ /**
140
+ * Pushes an inbound media frame directly into the registered {@link OnMedia} handler, simulating
141
+ * the endpoint producing media (what the agent hears) WITHOUT an outbound echo. Lets a test
142
+ * exercise the inbound half of the transport seam in isolation.
143
+ *
144
+ * @param frame The inbound frame to deliver.
145
+ */
146
+ EmitInbound(frame: BridgeMediaFrame): void;
147
+ /**
148
+ * Drives a roster change, delivering the supplied participants to the registered
149
+ * {@link OnParticipantChange} handler. Lets a test exercise participant tracking.
150
+ *
151
+ * @param participants The roster to deliver.
152
+ */
153
+ EmitParticipants(participants: BridgeParticipantInfo[]): void;
154
+ /** Whether the loopback is currently "connected" (after {@link Connect}, before {@link Disconnect}). */
155
+ get IsConnected(): boolean;
156
+ /** Maps an outbound track kind to its inbound counterpart for the echo. */
157
+ private toInboundTrack;
158
+ }
159
+ /**
160
+ * Tree-shaking-prevention loader. Modern bundlers cannot see the `@RegisterClass` dynamic
161
+ * registration of {@link LoopbackBridge} and may eliminate it. Importing and calling this no-op from
162
+ * a package entry point keeps the class in the bundle so the `ClassFactory` can resolve it.
163
+ */
164
+ export declare function LoadLoopbackBridge(): void;
165
+ //# source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,GAAG,IAAI;IAIjD;;;;;OAKG;IACI,gBAAgB,CAAC,YAAY,EAAE,qBAAqB,EAAE,GAAG,IAAI;IAIpE,wGAAwG;IACxG,IAAW,WAAW,IAAI,OAAO,CAEhC;IAED,2EAA2E;IAC3E,OAAO,CAAC,cAAc;CAYzB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC"}
@@ -0,0 +1,255 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var LoopbackBridge_1;
8
+ import { RegisterClass } from '@memberjunction/global';
9
+ import { BaseRealtimeBridge, } from '@memberjunction/ai-bridge-base';
10
+ /**
11
+ * The `DriverClass` key the {@link LoopbackBridge} registers under. A bridge provider row with
12
+ * `DriverClass = 'LoopbackBridge'` resolves to this driver via the `ClassFactory`.
13
+ */
14
+ export const LOOPBACK_BRIDGE_DRIVER_CLASS = 'LoopbackBridge';
15
+ /**
16
+ * A trivial in-memory {@link IBridgeMeetingControlsEventSource} for tests — the loopback driver's
17
+ * optional facilitator surface. It records the registered perception handlers and exposes `Emit*`
18
+ * helpers so a test can drive roster / speaking / hand-raise signals into the Meeting Controls
19
+ * channel, and records mute requests. A real driver (e.g. `ZoomBridge`) implements this by adapting
20
+ * its native participant/event stream; the loopback version proves the bridge → channel-plane wiring
21
+ * with no platform.
22
+ */
23
+ export class LoopbackMeetingControlsEventSource {
24
+ constructor() {
25
+ /** Participant ids this source was asked to mute, in order — a capture sink for assertions. */
26
+ this.Muted = [];
27
+ /** The facilitator capabilities the loopback advertises (mute supported, so the gated tool appears). */
28
+ this.Capabilities = ['Mute'];
29
+ }
30
+ /** @inheritdoc */
31
+ OnRosterChange(handler) {
32
+ this.rosterHandler = handler;
33
+ }
34
+ /** @inheritdoc */
35
+ OnSpeakingChange(handler) {
36
+ this.speakingHandler = handler;
37
+ }
38
+ /** @inheritdoc */
39
+ OnHandRaiseChange(handler) {
40
+ this.handRaiseHandler = handler;
41
+ }
42
+ /** @inheritdoc */
43
+ async MuteParticipant(participantId) {
44
+ this.Muted.push(participantId);
45
+ }
46
+ /** Drives a roster snapshot into the channel. */
47
+ EmitRoster(participants) {
48
+ this.rosterHandler?.(participants);
49
+ }
50
+ /** Drives a speaking-set change into the channel. */
51
+ EmitSpeaking(participantIds) {
52
+ this.speakingHandler?.(participantIds);
53
+ }
54
+ /** Drives a platform hand-raise/lower signal into the channel. */
55
+ EmitHandRaise(participantId, raised) {
56
+ this.handRaiseHandler?.(participantId, raised);
57
+ }
58
+ }
59
+ /**
60
+ * An in-memory, platform-free Realtime Bridge driver for **test and development**.
61
+ *
62
+ * `LoopbackBridge` proves the transport seam round-trips media with NO external conferencing or
63
+ * telephony platform: every frame sent via {@link SendMedia} is **echoed straight back** through the
64
+ * inbound {@link OnMedia} handler (re-stamped to the matching inbound track), and {@link GetParticipants}
65
+ * returns a single synthetic agent participant. Wired into {@link AIBridgeEngine} with a mock
66
+ * `IRealtimeSession`, it demonstrates that bridge → session → bridge media flow works end-to-end —
67
+ * the deferred "unified-transport track" foundation, validated with zero infrastructure.
68
+ *
69
+ * It declares an audio-capable, diarizing feature set so the engine exercises both the media seam
70
+ * and participant tracking against it. Telephony/recording features stay off (their virtual base
71
+ * methods keep throwing `NotSupported`), so the loopback driver also documents the capability-gating
72
+ * contract by example.
73
+ *
74
+ * Registered via `@RegisterClass(BaseRealtimeBridge, 'LoopbackBridge')`.
75
+ */
76
+ let LoopbackBridge = class LoopbackBridge extends BaseRealtimeBridge {
77
+ constructor() {
78
+ super(...arguments);
79
+ /** Whether {@link Connect} has run and the bridge is "online". */
80
+ this.connected = false;
81
+ /**
82
+ * Every frame the engine sent outbound, in order — a capture sink for assertions in tests.
83
+ * The frames are ALSO echoed back inbound; this array is the durable record of what was sent.
84
+ */
85
+ this.Sent = [];
86
+ /**
87
+ * The optional Meeting Controls event source. `null` by default so the loopback driver contributes
88
+ * NO facilitator surface (matching most drivers) — a test opts in via {@link EnableMeetingControls}
89
+ * to exercise the bridge → channel-plane wiring.
90
+ */
91
+ this.meetingControls = null;
92
+ }
93
+ static { LoopbackBridge_1 = this; }
94
+ /** The synthetic agent participant the loopback endpoint reports. */
95
+ static { this.AGENT_PARTICIPANT = {
96
+ ExternalId: 'loopback-agent',
97
+ DisplayName: 'Loopback Agent',
98
+ Role: 'Agent',
99
+ IsAgent: true,
100
+ }; }
101
+ /**
102
+ * Enables (and returns) a simple {@link LoopbackMeetingControlsEventSource} so this loopback driver
103
+ * contributes a Meeting Controls surface — used by tests of the engine's channel-plane wiring. The
104
+ * returned source's `Emit*` helpers drive roster / speaking / hand-raise signals into the channel.
105
+ *
106
+ * @returns The enabled event source (the same instance {@link GetMeetingControlsEventSource} returns).
107
+ */
108
+ EnableMeetingControls() {
109
+ this.meetingControls = new LoopbackMeetingControlsEventSource();
110
+ return this.meetingControls;
111
+ }
112
+ /**
113
+ * Returns the loopback's Meeting Controls event source when {@link EnableMeetingControls} was
114
+ * called, else `null` (the base default — no facilitator surface).
115
+ */
116
+ GetMeetingControlsEventSource() {
117
+ return this.meetingControls;
118
+ }
119
+ /**
120
+ * The enabled Meeting Controls event source (or `null`), typed concretely so tests can drive its
121
+ * `Emit*` helpers. {@link GetMeetingControlsEventSource} returns the same instance via the interface.
122
+ */
123
+ get MeetingControlsSource() {
124
+ return this.meetingControls;
125
+ }
126
+ /**
127
+ * "Connects" the loopback endpoint. Records the context for capability gating and returns
128
+ * synthetic handles. No network, no platform — always succeeds. After connecting, emits an
129
+ * initial roster (the synthetic agent participant) to any registered roster handler.
130
+ *
131
+ * @param ctx The bridge context (features, provider name, address).
132
+ * @returns Synthetic bot + connection identifiers.
133
+ */
134
+ async Connect(ctx) {
135
+ this.applyContext(ctx);
136
+ this.connected = true;
137
+ // Surface the initial roster so participant tracking has something to upsert.
138
+ this.participantHandler?.([LoopbackBridge_1.AGENT_PARTICIPANT]);
139
+ return {
140
+ BotParticipantId: LoopbackBridge_1.AGENT_PARTICIPANT.ExternalId,
141
+ ExternalConnectionId: `loopback:${ctx.Address || 'in-memory'}`,
142
+ };
143
+ }
144
+ /**
145
+ * Tears the loopback endpoint down and drops all handlers. Always clean.
146
+ *
147
+ * @param _reason Why the disconnect happened (unused — loopback teardown is uniform).
148
+ */
149
+ async Disconnect(_reason) {
150
+ this.connected = false;
151
+ this.mediaHandler = undefined;
152
+ this.participantHandler = undefined;
153
+ }
154
+ /**
155
+ * Sends an outbound media frame — and **echoes it straight back** through the inbound handler,
156
+ * re-stamped to the matching inbound track (`audio-out` → `audio-in`, etc.). This is what makes
157
+ * the loopback round-trip provable: what the agent "says" is immediately what the agent "hears",
158
+ * so a test can drive the realtime-session output and observe it arrive back as session input.
159
+ *
160
+ * @param track The outbound track the frame targets.
161
+ * @param frame The media frame to send (and echo).
162
+ */
163
+ SendMedia(track, frame) {
164
+ if (!this.connected) {
165
+ return; // a disconnected loopback drops frames silently.
166
+ }
167
+ this.Sent.push(frame);
168
+ const echoed = {
169
+ ...frame,
170
+ Track: this.toInboundTrack(track),
171
+ };
172
+ this.mediaHandler?.(echoed);
173
+ }
174
+ /**
175
+ * Registers the inbound-media handler. The loopback echoes outbound frames to this handler.
176
+ *
177
+ * @param handler Invoked with each (echoed) inbound media frame.
178
+ */
179
+ OnMedia(handler) {
180
+ this.mediaHandler = handler;
181
+ }
182
+ /**
183
+ * Returns the loopback roster — a single synthetic agent participant. Overrides the
184
+ * capability-gated base method (gated by `SpeakerDiarization`, which the loopback provider
185
+ * enables in its feature set).
186
+ *
187
+ * @returns The synthetic participant list.
188
+ */
189
+ async GetParticipants() {
190
+ this.RequireFeature('SpeakerDiarization');
191
+ return [LoopbackBridge_1.AGENT_PARTICIPANT];
192
+ }
193
+ /**
194
+ * Registers a roster-change handler. The loopback fires it once at {@link Connect} time with the
195
+ * synthetic participant; {@link EmitParticipants} lets tests drive further roster changes.
196
+ *
197
+ * @param handler Invoked with the updated participant list on each change.
198
+ */
199
+ OnParticipantChange(handler) {
200
+ this.RequireFeature('SpeakerDiarization');
201
+ this.participantHandler = handler;
202
+ }
203
+ // ──────────────────────────────────────────────────────────────────────────────
204
+ // Test/dev helpers — drive the loopback from outside.
205
+ // ──────────────────────────────────────────────────────────────────────────────
206
+ /**
207
+ * Pushes an inbound media frame directly into the registered {@link OnMedia} handler, simulating
208
+ * the endpoint producing media (what the agent hears) WITHOUT an outbound echo. Lets a test
209
+ * exercise the inbound half of the transport seam in isolation.
210
+ *
211
+ * @param frame The inbound frame to deliver.
212
+ */
213
+ EmitInbound(frame) {
214
+ this.mediaHandler?.(frame);
215
+ }
216
+ /**
217
+ * Drives a roster change, delivering the supplied participants to the registered
218
+ * {@link OnParticipantChange} handler. Lets a test exercise participant tracking.
219
+ *
220
+ * @param participants The roster to deliver.
221
+ */
222
+ EmitParticipants(participants) {
223
+ this.participantHandler?.(participants);
224
+ }
225
+ /** Whether the loopback is currently "connected" (after {@link Connect}, before {@link Disconnect}). */
226
+ get IsConnected() {
227
+ return this.connected;
228
+ }
229
+ /** Maps an outbound track kind to its inbound counterpart for the echo. */
230
+ toInboundTrack(track) {
231
+ switch (track) {
232
+ case 'audio-out':
233
+ return 'audio-in';
234
+ case 'video-out':
235
+ return 'video-in';
236
+ case 'screen-out':
237
+ return 'screen-in';
238
+ default:
239
+ return track; // an already-inbound track echoes as itself.
240
+ }
241
+ }
242
+ };
243
+ LoopbackBridge = LoopbackBridge_1 = __decorate([
244
+ RegisterClass(BaseRealtimeBridge, LOOPBACK_BRIDGE_DRIVER_CLASS)
245
+ ], LoopbackBridge);
246
+ export { LoopbackBridge };
247
+ /**
248
+ * Tree-shaking-prevention loader. Modern bundlers cannot see the `@RegisterClass` dynamic
249
+ * registration of {@link LoopbackBridge} and may eliminate it. Importing and calling this no-op from
250
+ * a package entry point keeps the class in the bundle so the `ClassFactory` can resolve it.
251
+ */
252
+ export function LoadLoopbackBridge() {
253
+ // Intentionally empty — referencing the module is what prevents tree-shaking.
254
+ }
255
+ //# sourceMappingURL=loopback-bridge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loopback-bridge.js","sourceRoot":"","sources":["../src/loopback-bridge.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EACH,kBAAkB,GAUrB,MAAM,gCAAgC,CAAC;AAExC;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,gBAAgB,CAAC;AAE7D;;;;;;;GAOG;AACH,MAAM,OAAO,kCAAkC;IAA/C;QAKI,+FAA+F;QAC/E,UAAK,GAAa,EAAE,CAAC;QAErC,wGAAwG;QACxF,iBAAY,GAAmD,CAAC,MAAM,CAAC,CAAC;IAoC5F,CAAC;IAlCG,kBAAkB;IACX,cAAc,CAAC,OAA2D;QAC7E,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC;IACjC,CAAC;IAED,kBAAkB;IACX,gBAAgB,CAAC,OAA2C;QAC/D,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC;IACnC,CAAC;IAED,kBAAkB;IACX,iBAAiB,CAAC,OAAyD;QAC9E,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC;IACpC,CAAC;IAED,kBAAkB;IACX,KAAK,CAAC,eAAe,CAAC,aAAqB;QAC9C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACnC,CAAC;IAED,iDAAiD;IAC1C,UAAU,CAAC,YAAwC;QACtD,IAAI,CAAC,aAAa,EAAE,CAAC,YAAY,CAAC,CAAC;IACvC,CAAC;IAED,qDAAqD;I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;IACI,gBAAgB,CAAC,YAAqC;QACzD,IAAI,CAAC,kBAAkB,EAAE,CAAC,YAAY,CAAC,CAAC;IAC5C,CAAC;IAED,wGAAwG;IACxG,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED,2EAA2E;IACnE,cAAc,CAAC,KAA2B;QAC9C,QAAQ,KAAK,EAAE,CAAC;YACZ,KAAK,WAAW;gBACZ,OAAO,UAAU,CAAC;YACtB,KAAK,WAAW;gBACZ,OAAO,UAAU,CAAC;YACtB,KAAK,YAAY;gBACb,OAAO,WAAW,CAAC;YACvB;gBACI,OAAO,KAAK,CAAC,CAAC,6CAA6C;QACnE,CAAC;IACL,CAAC;;AAxLQ,cAAc;IAD1B,aAAa,CAAC,kBAAkB,EAAE,4BAA4B,CAAC;GACnD,cAAc,CAyL1B;;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB;IAC9B,8EAA8E;AAClF,CAAC"}
@@ -0,0 +1,198 @@
1
+ /**
2
+ * Multi-agent room coordination — the inter-agent **speaking discipline** for "1+ agents in one shared
3
+ * room" (`/plans/realtime/realtime-bridges-architecture.md` §4c).
4
+ *
5
+ * ## The model — the room IS the shared media plane; this only adds discipline
6
+ * Multi-party is an **emergent property of the bridge**, not a separate build. When several agents each
7
+ * open their OWN bridge connection into the SAME room (a Zoom meeting, a Teams meeting, or an MJ-native
8
+ * LiveKit room), the conferencing platform *is* the shared media plane: it does the SFU, the mixing, the
9
+ * multi-party transport. **Each agent hears the others through the room's own mix** — Sage's voice is
10
+ * part of "everyone else" in Demo Loop's inbound audio and vice-versa. There is NO transcript-relay hack
11
+ * and NO mixer in MJ; the room already mixes.
12
+ *
13
+ * So the ONLY genuinely new problem is **turn-taking discipline among multiple agents** so they don't
14
+ * talk over each other or loop forever. This coordinator solves exactly that and nothing else:
15
+ *
16
+ * 1. **Floor arbitration** — at most ONE agent "holds the floor" (is speaking) in a room at any instant.
17
+ * An agent calls {@link CanTakeFloor} before generating speech; it returns `true` only if no OTHER
18
+ * agent currently holds the floor. {@link TakeFloor} grants it; {@link ReleaseFloor} frees it.
19
+ * 2. **Passive-default loop safety** — combined with passive turn-taking (an agent speaks only when
20
+ * *addressed by name*, per {@link import('@memberjunction/ai-bridge-base').TurnTakingPolicy}), two
21
+ * agents in a room never loop: neither speaks unless a human calls on it, and even then only one holds
22
+ * the floor. This coordinator is the SECOND guard — passivity prevents the loop, the floor prevents
23
+ * the overlap.
24
+ * 3. **Facilitator override** — an optional designated **facilitator** agent (one that runs the Meeting
25
+ * Controls channel) may be granted the floor even while another agent holds it, so it can arbitrate /
26
+ * call on a specific agent. See {@link RegisterRoom}'s `facilitatorAgentSessionId` and
27
+ * {@link CanTakeFloor}'s facilitator path.
28
+ *
29
+ * ## Echo / self-audio (documented, handled by the bridge, not here)
30
+ * A bot must not hear its OWN output, or it would react to itself and loop. Conferencing platforms
31
+ * (and the LiveKit SFU) **exclude a participant's own published audio from that participant's inbound
32
+ * mix**, so the bridge driver naturally never feeds the agent its own voice — the LiveKitBridge documents
33
+ * this explicitly. Where a platform does NOT exclude own-audio, the bridge driver must gate it before
34
+ * `OnMedia`. This coordinator assumes that property holds and does not itself touch media — it operates
35
+ * purely on floor state.
36
+ *
37
+ * ## Purity & testability
38
+ * This class is **pure and synchronous** — no I/O, no entities, no clock dependence (an optional injected
39
+ * clock only stamps `since` for observability). Every decision is a deterministic function of the
40
+ * in-memory room/floor state, so it is exhaustively unit-testable with no network, DB, or real session.
41
+ */
42
+ /**
43
+ * One agent's membership in a shared room, as the coordinator tracks it.
44
+ */
45
+ export interface RoomAgentMembership {
46
+ /** The `MJ: AI Agent Sessions` row id of this agent's bridge session in the room. */
47
+ AgentSessionId: string;
48
+ /** Whether this agent is the room's designated facilitator (may override the floor to arbitrate). */
49
+ IsFacilitator: boolean;
50
+ }
51
+ /**
52
+ * The live floor state of a room, returned by {@link MultiAgentRoomCoordinator.GetRoomState} for
53
+ * observability and tests.
54
+ */
55
+ export interface RoomFloorState {
56
+ /** The room's external id (the shared external connection id / ConversationID all agents key on). */
57
+ RoomId: string;
58
+ /** The agent session ids currently in the room. */
59
+ AgentSessionIds: string[];
60
+ /** The facilitator agent session id, when one is designated; otherwise `null`. */
61
+ FacilitatorAgentSessionId: string | null;
62
+ /** The agent session id currently holding the floor (speaking), or `null` when the floor is free. */
63
+ FloorHolderAgentSessionId: string | null;
64
+ /** Epoch-ms the current floor holder took the floor, or `null` when the floor is free. */
65
+ FloorHeldSinceMs: number | null;
66
+ }
67
+ /** The reason a {@link MultiAgentRoomCoordinator.CanTakeFloor} request was granted or denied. */
68
+ export type FloorDecisionReason = 'FloorFree' | 'AlreadyHolder' | 'FacilitatorOverride' | 'HeldByOtherAgent' | 'NotInRoom' | 'UnknownRoom';
69
+ /** The outcome of a floor request — whether the agent may speak, and why. */
70
+ export interface FloorDecision {
71
+ /** Whether the requesting agent may take the floor and speak now. */
72
+ Granted: boolean;
73
+ /** The structured reason for the decision (useful for observability + tests). */
74
+ Reason: FloorDecisionReason;
75
+ }
76
+ /**
77
+ * Coordinates speaking discipline for multiple agents sharing one room. Construct one per process (the
78
+ * engine holds a single instance) and key everything on the **room id** — the shared external connection
79
+ * id (or ConversationID) that all co-located agent sessions belong to.
80
+ *
81
+ * The coordinator is additive: single-agent sessions never register here and are wholly unaffected. Only
82
+ * when 2+ agent sessions share a room does floor arbitration come into play.
83
+ */
84
+ export declare class MultiAgentRoomCoordinator {
85
+ /** Room id (lowercased) → room record. */
86
+ private readonly rooms;
87
+ /** Injected clock for floor-held timestamps; defaults to `Date.now`. */
88
+ private readonly now;
89
+ /**
90
+ * @param now Optional injected clock returning epoch-ms (for `FloorHeldSince` stamps). Defaults to
91
+ * `Date.now`. Tests inject a controllable function for determinism.
92
+ */
93
+ constructor(now?: () => number);
94
+ /**
95
+ * Registers an agent session as a participant in a shared room, creating the room on first member.
96
+ * Idempotent — re-registering the same agent updates its facilitator flag without disturbing the
97
+ * floor. Designating an agent as the facilitator records it as the room's arbiter; only one
98
+ * facilitator is tracked (the latest designation wins, mirroring "one chair").
99
+ *
100
+ * @param roomId The shared room id (external connection id / ConversationID) all agents key on.
101
+ * @param agentSessionId The agent's `MJ: AI Agent Sessions` row id.
102
+ * @param isFacilitator Whether this agent is the room's facilitator (may override the floor).
103
+ */
104
+ RegisterRoomParticipant(roomId: string, agentSessionId: string, isFacilitator?: boolean): void;
105
+ /**
106
+ * Unregisters an agent session from a room (the agent left / its bridge stopped). If the leaving
107
+ * agent held the floor, the floor is released. If it was the facilitator, the facilitator slot is
108
+ * cleared. When the last member leaves, the room record is discarded.
109
+ *
110
+ * @param roomId The room the agent is leaving.
111
+ * @param agentSessionId The agent session leaving.
112
+ */
113
+ UnregisterRoomParticipant(roomId: string, agentSessionId: string): void;
114
+ /**
115
+ * Whether a room currently has more than one agent session — i.e. floor arbitration is meaningful.
116
+ * Single-agent rooms can skip the floor dance entirely.
117
+ *
118
+ * @param roomId The room to check.
119
+ * @returns `true` when 2+ agents share the room.
120
+ */
121
+ IsMultiAgentRoom(roomId: string): boolean;
122
+ /**
123
+ * Asks whether an agent MAY take the floor (speak) now — the read-only arbitration check an agent
124
+ * runs before generating speech. Returns `true` only when no OTHER agent holds the floor, with the
125
+ * facilitator exception:
126
+ *
127
+ * - **Floor free** → granted (`FloorFree`).
128
+ * - **The requester already holds it** → granted (`AlreadyHolder`) — re-asserting is fine.
129
+ * - **The requester is the facilitator** → granted (`FacilitatorOverride`) even if another agent
130
+ * holds it, so the facilitator can cut in to arbitrate / call on a specific agent.
131
+ * - **Another (non-facilitator) agent holds it** → denied (`HeldByOtherAgent`).
132
+ * - **The requester is not a member of the room** → denied (`NotInRoom`).
133
+ * - **The room is unknown** → denied (`UnknownRoom`).
134
+ *
135
+ * This is purely advisory until {@link TakeFloor} actually claims the floor — keeping the check
136
+ * (read) and the claim (write) separate lets a caller test-then-act atomically within its own turn.
137
+ *
138
+ * @param roomId The shared room id.
139
+ * @param agentSessionId The agent asking to speak.
140
+ * @returns The floor decision (granted + reason).
141
+ */
142
+ CanTakeFloor(roomId: string, agentSessionId: string): FloorDecision;
143
+ /**
144
+ * Atomically attempts to claim the floor for an agent: runs {@link CanTakeFloor} and, when granted,
145
+ * records the agent as the floor holder (stamping the take time) and returns the decision. When a
146
+ * **facilitator** overrides a sitting holder, the holder is replaced — the facilitator now holds the
147
+ * floor (the prior holder should observe this via {@link IsFloorHolder} on its next check and yield).
148
+ *
149
+ * @param roomId The shared room id.
150
+ * @param agentSessionId The agent claiming the floor.
151
+ * @returns The decision; on `Granted` the agent now holds the floor.
152
+ */
153
+ TakeFloor(roomId: string, agentSessionId: string): FloorDecision;
154
+ /**
155
+ * Releases the floor held by an agent (it finished speaking). A no-op when the agent is not the
156
+ * current holder, so a late/duplicate release can never steal the floor from another agent.
157
+ *
158
+ * @param roomId The shared room id.
159
+ * @param agentSessionId The agent releasing the floor.
160
+ * @returns `true` when this call actually freed the floor (the agent was the holder).
161
+ */
162
+ ReleaseFloor(roomId: string, agentSessionId: string): boolean;
163
+ /**
164
+ * Whether a given agent currently holds the floor in a room. An agent that was bumped by a
165
+ * facilitator override checks this to learn it should yield.
166
+ *
167
+ * @param roomId The shared room id.
168
+ * @param agentSessionId The agent to test.
169
+ * @returns `true` when the agent is the current floor holder.
170
+ */
171
+ IsFloorHolder(roomId: string, agentSessionId: string): boolean;
172
+ /**
173
+ * Designates (or re-designates) a room's facilitator at runtime — e.g. when the agent running the
174
+ * Meeting Controls channel is determined after join. The agent must already be a room member.
175
+ *
176
+ * @param roomId The shared room id.
177
+ * @param agentSessionId The agent to make facilitator (must be a member).
178
+ * @returns `true` when the facilitator was set; `false` when the room/agent is unknown.
179
+ */
180
+ SetFacilitator(roomId: string, agentSessionId: string): boolean;
181
+ /**
182
+ * Returns a snapshot of a room's floor state, or `null` when the room is unknown. Read-only — for
183
+ * the realtime dashboard / observer console and tests.
184
+ *
185
+ * @param roomId The room to inspect.
186
+ * @returns The room's floor state snapshot, or `null`.
187
+ */
188
+ GetRoomState(roomId: string): RoomFloorState | null;
189
+ /** The ids of all rooms the coordinator currently tracks (those with ≥1 agent member). */
190
+ get RoomIds(): string[];
191
+ /** Gets the room record, creating an empty one (preserving the caller's casing) on first use. */
192
+ private ensureRoom;
193
+ /** Whether an agent is the room's facilitator (by membership flag or the room's facilitator slot). */
194
+ private isFacilitator;
195
+ /** Normalizes an id for case-insensitive map keying (UUIDs differ in case across DB platforms). */
196
+ private key;
197
+ }
198
+ //# sourceMappingURL=multi-agent-room-coordinator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multi-agent-room-coordinator.d.ts","sourceRoot":"","sources":["../src/multi-agent-room-coordinator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,qFAAqF;IACrF,cAAc,EAAE,MAAM,CAAC;IAEvB,qGAAqG;IACrG,aAAa,EAAE,OAAO,CAAC;CAC1B;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC3B,qGAAqG;IACrG,MAAM,EAAE,MAAM,CAAC;IAEf,mDAAmD;IACnD,eAAe,EAAE,MAAM,EAAE,CAAC;IAE1B,kFAAkF;IAClF,yBAAyB,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzC,qGAAqG;IACrG,yBAAyB,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzC,0FAA0F;IAC1F,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAED,iGAAiG;AACjG,MAAM,MAAM,mBAAmB,GACzB,WAAW,GACX,eAAe,GACf,qBAAqB,GACrB,kBAAkB,GAClB,WAAW,GACX,aAAa,CAAC;AAEpB,6EAA6E;AAC7E,MAAM,WAAW,aAAa;IAC1B,qEAAqE;IACrE,OAAO,EAAE,OAAO,CAAC;IAEjB,iFAAiF;IACjF,MAAM,EAAE,mBAAmB,CAAC;CAC/B;AAYD;;;;;;;GAOG;A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