@memberjunction/server 5.41.0 → 5.43.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 (90) hide show
  1. package/dist/agentSessions/SessionJanitor.d.ts.map +1 -1
  2. package/dist/agentSessions/SessionJanitor.js +5 -1
  3. package/dist/agentSessions/SessionJanitor.js.map +1 -1
  4. package/dist/agentSessions/SessionManager.d.ts +15 -2
  5. package/dist/agentSessions/SessionManager.d.ts.map +1 -1
  6. package/dist/agentSessions/SessionManager.js +50 -11
  7. package/dist/agentSessions/SessionManager.js.map +1 -1
  8. package/dist/agentSessions/index.d.ts +1 -0
  9. package/dist/agentSessions/index.d.ts.map +1 -1
  10. package/dist/agentSessions/index.js +5 -0
  11. package/dist/agentSessions/index.js.map +1 -1
  12. package/dist/agentSessions/remoteBrowserGoalEngine.d.ts +102 -0
  13. package/dist/agentSessions/remoteBrowserGoalEngine.d.ts.map +1 -0
  14. package/dist/agentSessions/remoteBrowserGoalEngine.js +164 -0
  15. package/dist/agentSessions/remoteBrowserGoalEngine.js.map +1 -0
  16. package/dist/agentSessions/remoteBrowserGoalRegistry.d.ts +66 -0
  17. package/dist/agentSessions/remoteBrowserGoalRegistry.d.ts.map +1 -0
  18. package/dist/agentSessions/remoteBrowserGoalRegistry.js +86 -0
  19. package/dist/agentSessions/remoteBrowserGoalRegistry.js.map +1 -0
  20. package/dist/auth/initializeProviders.d.ts.map +1 -1
  21. package/dist/auth/initializeProviders.js +4 -7
  22. package/dist/auth/initializeProviders.js.map +1 -1
  23. package/dist/config.d.ts +7 -0
  24. package/dist/config.d.ts.map +1 -1
  25. package/dist/config.js +12 -2
  26. package/dist/config.js.map +1 -1
  27. package/dist/generated/generated.d.ts +612 -0
  28. package/dist/generated/generated.d.ts.map +1 -1
  29. package/dist/generated/generated.js +6934 -3626
  30. package/dist/generated/generated.js.map +1 -1
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +38 -17
  33. package/dist/index.js.map +1 -1
  34. package/dist/integration/CustomColumnPromoter.d.ts +108 -0
  35. package/dist/integration/CustomColumnPromoter.d.ts.map +1 -0
  36. package/dist/integration/CustomColumnPromoter.js +508 -0
  37. package/dist/integration/CustomColumnPromoter.js.map +1 -0
  38. package/dist/logging/StartupLogger.d.ts +57 -1
  39. package/dist/logging/StartupLogger.d.ts.map +1 -1
  40. package/dist/logging/StartupLogger.js +115 -6
  41. package/dist/logging/StartupLogger.js.map +1 -1
  42. package/dist/resolvers/ExecuteRemoteOperationResolver.d.ts +46 -0
  43. package/dist/resolvers/ExecuteRemoteOperationResolver.d.ts.map +1 -0
  44. package/dist/resolvers/ExecuteRemoteOperationResolver.js +192 -0
  45. package/dist/resolvers/ExecuteRemoteOperationResolver.js.map +1 -0
  46. package/dist/resolvers/IntegrationDiscoveryResolver.d.ts +101 -1
  47. package/dist/resolvers/IntegrationDiscoveryResolver.d.ts.map +1 -1
  48. package/dist/resolvers/IntegrationDiscoveryResolver.js +629 -58
  49. package/dist/resolvers/IntegrationDiscoveryResolver.js.map +1 -1
  50. package/dist/resolvers/RealtimeBridgeResolver.d.ts +130 -0
  51. package/dist/resolvers/RealtimeBridgeResolver.d.ts.map +1 -0
  52. package/dist/resolvers/RealtimeBridgeResolver.js +580 -0
  53. package/dist/resolvers/RealtimeBridgeResolver.js.map +1 -0
  54. package/dist/resolvers/RemoteBrowserActionResolver.d.ts +78 -5
  55. package/dist/resolvers/RemoteBrowserActionResolver.d.ts.map +1 -1
  56. package/dist/resolvers/RemoteBrowserActionResolver.js +227 -15
  57. package/dist/resolvers/RemoteBrowserActionResolver.js.map +1 -1
  58. package/dist/resolvers/RunAIAgentResolver.d.ts.map +1 -1
  59. package/dist/resolvers/RunAIAgentResolver.js +0 -7
  60. package/dist/resolvers/RunAIAgentResolver.js.map +1 -1
  61. package/dist/resolvers/RunTemplateResolver.d.ts +8 -0
  62. package/dist/resolvers/RunTemplateResolver.d.ts.map +1 -1
  63. package/dist/resolvers/RunTemplateResolver.js +8 -0
  64. package/dist/resolvers/RunTemplateResolver.js.map +1 -1
  65. package/dist/rest/setupRESTEndpoints.d.ts.map +1 -1
  66. package/dist/rest/setupRESTEndpoints.js +5 -3
  67. package/dist/rest/setupRESTEndpoints.js.map +1 -1
  68. package/package.json +83 -78
  69. package/src/__tests__/RealtimeBridgeResolver.test.ts +100 -0
  70. package/src/__tests__/RemoteBrowserAudioStream.test.ts +8 -1
  71. package/src/__tests__/RemoteBrowserGoalEngine.test.ts +144 -0
  72. package/src/__tests__/remoteBrowserGoalRegistry.test.ts +81 -0
  73. package/src/agentSessions/SessionJanitor.ts +15 -1
  74. package/src/agentSessions/SessionManager.ts +59 -10
  75. package/src/agentSessions/index.ts +5 -0
  76. package/src/agentSessions/remoteBrowserGoalEngine.ts +191 -0
  77. package/src/agentSessions/remoteBrowserGoalRegistry.ts +122 -0
  78. package/src/auth/initializeProviders.ts +4 -7
  79. package/src/config.ts +13 -2
  80. package/src/generated/generated.ts +2502 -198
  81. package/src/index.ts +38 -17
  82. package/src/integration/CustomColumnPromoter.ts +597 -0
  83. package/src/logging/StartupLogger.ts +130 -6
  84. package/src/resolvers/ExecuteRemoteOperationResolver.ts +164 -0
  85. package/src/resolvers/IntegrationDiscoveryResolver.ts +490 -53
  86. package/src/resolvers/RealtimeBridgeResolver.ts +493 -0
  87. package/src/resolvers/RemoteBrowserActionResolver.ts +232 -17
  88. package/src/resolvers/RunAIAgentResolver.ts +1 -9
  89. package/src/resolvers/RunTemplateResolver.ts +8 -0
  90. package/src/rest/setupRESTEndpoints.ts +5 -3
@@ -0,0 +1,580 @@
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 __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ import { Resolver, Mutation, Query, Arg, Ctx, ObjectType, InputType, Field } from 'type-graphql';
14
+ import { randomUUID } from 'crypto';
15
+ import { LogError, LogStatusEx } from '@memberjunction/core';
16
+ import { LiveKitTokenService, LiveKitAgentRoomCoordinator, LiveKitEgressService } from '@memberjunction/livekit-room-server';
17
+ import { ResolverBase } from '../generic/ResolverBase.js';
18
+ import { GetReadWriteProvider } from '../util.js';
19
+ import { CreateBridgeRealtimeSession, FinalizeBridgeCoAgentRuns, GetRealtimeModelVoices, CreateBridgeRoomTranscriptSink, RealtimeTurnModeratorDecision } from '@memberjunction/ai-agents';
20
+ import { AIBridgeEngine } from '@memberjunction/ai-bridge-server';
21
+ import { SessionManager } from '../agentSessions/SessionManager.js';
22
+ import { NotificationEngine } from '@memberjunction/notifications';
23
+ /**
24
+ * Binds the agent realtime-session factory onto the LiveKit room coordinator's model-session creation seam.
25
+ * Module-load side effect — it runs when MJServer builds its GraphQL schema (which imports this resolver),
26
+ * so `StartLiveKitAgentRoomSession` can open a real model session. `@memberjunction/server` is the natural
27
+ * home for the binding: it is the one package that depends on BOTH `@memberjunction/ai-agents` (the factory)
28
+ * and `@memberjunction/livekit-room-server` (the coordinator), keeping each of those decoupled from the
29
+ * other. Idempotent (latest-wins).
30
+ */
31
+ LiveKitAgentRoomCoordinator.Instance.SetSessionFactory(CreateBridgeRealtimeSession);
32
+ /**
33
+ * Binds the co-agent run finalizer onto the bridge engine (same module-load rationale as the factory above).
34
+ * Lets the engine finalize a session's dangling co-agent observability run when it reaps a bridge WITHOUT a
35
+ * live in-memory session (a prior-boot orphan / cross-host reap) — the one teardown path the agent layer's
36
+ * `Close()`-wrapped finalizer can't reach. Idempotent for clean same-process teardowns.
37
+ */
38
+ AIBridgeEngine.Instance.SetSessionRunFinalizer(FinalizeBridgeCoAgentRuns);
39
+ /**
40
+ * Binds the unified room-transcript sink onto the bridge engine (same module-load rationale). The engine
41
+ * elects one scribe per LiveKit room and feeds its final transcript lines here; the sink persists them as a
42
+ * single `MJ: Conversations` of `Type='Meeting Room'`, scoped `Application` so it stays OUT of the normal
43
+ * chat list (it surfaces in the Meet app's own view), with one `MJ: Conversation Detail` per utterance. The
44
+ * "Meeting Room"/scope choices live HERE (the Meet composition layer), keeping the engine generic.
45
+ */
46
+ AIBridgeEngine.Instance.SetTranscriptSink(CreateBridgeRoomTranscriptSink({ ConversationType: 'Meeting Room', ApplicationScope: 'Application', ApplicationName: 'Meet' }));
47
+ /**
48
+ * Binds the room **turn moderator** onto the bridge engine — **OPT-IN, off by default**. When
49
+ * `MJ_REALTIME_MODERATOR_MODE=on`, a multi-agent room routes each turn through a fast LLM prompt that decides
50
+ * who speaks (see `RealtimeTurnModerator` in `@memberjunction/ai-agents`). By default it's OFF: agents run in
51
+ * plain auto-response, hear everything, and self-moderate (no STT-driven router in the loop) — the
52
+ * coordinator likewise skips meeting mode when the flag is off, so the two stay consistent. We keep the
53
+ * moderator wired-but-toggleable for controlled scenarios (webinars, large rooms, weaker models).
54
+ */
55
+ if (process.env.MJ_REALTIME_MODERATOR_MODE === 'on') {
56
+ AIBridgeEngine.Instance.SetTurnModerator(RealtimeTurnModeratorDecision);
57
+ console.log('[RealtimeBridge] turn MODERATOR mode is ON (MJ_REALTIME_MODERATOR_MODE=on) — multi-agent rooms use the LLM router.');
58
+ }
59
+ else {
60
+ // Default mode — only surface this at startup when verbose (MJ_VERBOSE) is on; it's the expected state and otherwise just noise.
61
+ LogStatusEx({ message: '[RealtimeBridge] turn moderator mode is OFF (default) — multi-agent rooms run free-for-all: all agents auto-respond + hear everything.', verboseOnly: true });
62
+ }
63
+ /**
64
+ * GraphQL surface for the MJ-native LiveKit room: mints scoped client access tokens and starts an
65
+ * agent's presence in a room. The thin resolver delegates to `@memberjunction/livekit-room-server`
66
+ * (token service + session-start coordinator) per the Transport-Layer Architecture — no LiveKit logic
67
+ * lives here.
68
+ *
69
+ * `MintLiveKitClientToken` is fully functional given LiveKit credentials. `StartLiveKitAgentRoomSession`
70
+ * opens a real agent model session via the realtime-session factory bound above (the agent must have an
71
+ * Active `Realtime` model + a vendor with a resolvable API key), then bridges it into the room through the
72
+ * coordinator. The native room media client (`@memberjunction/ai-bridge-livekit-native` /
73
+ * `@livekit/rtc-node`) must be installed on the agent host for the bot's audio to flow.
74
+ */
75
+ let MintLiveKitClientTokenInput = class MintLiveKitClientTokenInput {
76
+ };
77
+ __decorate([
78
+ Field(() => String),
79
+ __metadata("design:type", String)
80
+ ], MintLiveKitClientTokenInput.prototype, "RoomName", void 0);
81
+ __decorate([
82
+ Field(() => String, { nullable: true }),
83
+ __metadata("design:type", String)
84
+ ], MintLiveKitClientTokenInput.prototype, "DisplayName", void 0);
85
+ MintLiveKitClientTokenInput = __decorate([
86
+ InputType()
87
+ ], MintLiveKitClientTokenInput);
88
+ export { MintLiveKitClientTokenInput };
89
+ let LiveKitClientTokenResult = class LiveKitClientTokenResult {
90
+ };
91
+ __decorate([
92
+ Field(() => Boolean),
93
+ __metadata("design:type", Boolean)
94
+ ], LiveKitClientTokenResult.prototype, "Success", void 0);
95
+ __decorate([
96
+ Field(() => String, { nullable: true }),
97
+ __metadata("design:type", String)
98
+ ], LiveKitClientTokenResult.prototype, "ErrorMessage", void 0);
99
+ __decorate([
100
+ Field(() => String),
101
+ __metadata("design:type", String)
102
+ ], LiveKitClientTokenResult.prototype, "ServerUrl", void 0);
103
+ __decorate([
104
+ Field(() => String),
105
+ __metadata("design:type", String)
106
+ ], LiveKitClientTokenResult.prototype, "Token", void 0);
107
+ __decorate([
108
+ Field(() => String),
109
+ __metadata("design:type", String)
110
+ ], LiveKitClientTokenResult.prototype, "Identity", void 0);
111
+ __decorate([
112
+ Field(() => String),
113
+ __metadata("design:type", String)
114
+ ], LiveKitClientTokenResult.prototype, "RoomName", void 0);
115
+ LiveKitClientTokenResult = __decorate([
116
+ ObjectType()
117
+ ], LiveKitClientTokenResult);
118
+ export { LiveKitClientTokenResult };
119
+ let StartLiveKitAgentRoomSessionInput = class StartLiveKitAgentRoomSessionInput {
120
+ };
121
+ __decorate([
122
+ Field(() => String, { nullable: true }),
123
+ __metadata("design:type", String)
124
+ ], StartLiveKitAgentRoomSessionInput.prototype, "AgentID", void 0);
125
+ __decorate([
126
+ Field(() => String, { nullable: true }),
127
+ __metadata("design:type", String)
128
+ ], StartLiveKitAgentRoomSessionInput.prototype, "AgentName", void 0);
129
+ __decorate([
130
+ Field(() => String, { nullable: true }),
131
+ __metadata("design:type", String)
132
+ ], StartLiveKitAgentRoomSessionInput.prototype, "TargetAgentID", void 0);
133
+ __decorate([
134
+ Field(() => String, { nullable: true }),
135
+ __metadata("design:type", String)
136
+ ], StartLiveKitAgentRoomSessionInput.prototype, "RealtimeModelID", void 0);
137
+ __decorate([
138
+ Field(() => String, { nullable: true }),
139
+ __metadata("design:type", String)
140
+ ], StartLiveKitAgentRoomSessionInput.prototype, "RealtimeVoice", void 0);
141
+ __decorate([
142
+ Field(() => String, { nullable: true }),
143
+ __metadata("design:type", String)
144
+ ], StartLiveKitAgentRoomSessionInput.prototype, "RoomName", void 0);
145
+ __decorate([
146
+ Field(() => String, { nullable: true }),
147
+ __metadata("design:type", String)
148
+ ], StartLiveKitAgentRoomSessionInput.prototype, "AgentSessionID", void 0);
149
+ __decorate([
150
+ Field(() => String, { nullable: true }),
151
+ __metadata("design:type", String)
152
+ ], StartLiveKitAgentRoomSessionInput.prototype, "TurnMode", void 0);
153
+ StartLiveKitAgentRoomSessionInput = __decorate([
154
+ InputType()
155
+ ], StartLiveKitAgentRoomSessionInput);
156
+ export { StartLiveKitAgentRoomSessionInput };
157
+ let LiveKitAgentRoomSessionResult = class LiveKitAgentRoomSessionResult {
158
+ };
159
+ __decorate([
160
+ Field(() => Boolean),
161
+ __metadata("design:type", Boolean)
162
+ ], LiveKitAgentRoomSessionResult.prototype, "Success", void 0);
163
+ __decorate([
164
+ Field(() => String, { nullable: true }),
165
+ __metadata("design:type", String)
166
+ ], LiveKitAgentRoomSessionResult.prototype, "ErrorMessage", void 0);
167
+ __decorate([
168
+ Field(() => String),
169
+ __metadata("design:type", String)
170
+ ], LiveKitAgentRoomSessionResult.prototype, "SessionBridgeID", void 0);
171
+ __decorate([
172
+ Field(() => String),
173
+ __metadata("design:type", String)
174
+ ], LiveKitAgentRoomSessionResult.prototype, "RoomName", void 0);
175
+ __decorate([
176
+ Field(() => String),
177
+ __metadata("design:type", String)
178
+ ], LiveKitAgentRoomSessionResult.prototype, "ServerUrl", void 0);
179
+ __decorate([
180
+ Field(() => String),
181
+ __metadata("design:type", String)
182
+ ], LiveKitAgentRoomSessionResult.prototype, "ClientToken", void 0);
183
+ __decorate([
184
+ Field(() => String),
185
+ __metadata("design:type", String)
186
+ ], LiveKitAgentRoomSessionResult.prototype, "Identity", void 0);
187
+ LiveKitAgentRoomSessionResult = __decorate([
188
+ ObjectType()
189
+ ], LiveKitAgentRoomSessionResult);
190
+ export { LiveKitAgentRoomSessionResult };
191
+ let LiveKitRecordingInput = class LiveKitRecordingInput {
192
+ };
193
+ __decorate([
194
+ Field(() => String),
195
+ __metadata("design:type", String)
196
+ ], LiveKitRecordingInput.prototype, "RoomName", void 0);
197
+ __decorate([
198
+ Field(() => String, { nullable: true }),
199
+ __metadata("design:type", String)
200
+ ], LiveKitRecordingInput.prototype, "Layout", void 0);
201
+ LiveKitRecordingInput = __decorate([
202
+ InputType()
203
+ ], LiveKitRecordingInput);
204
+ export { LiveKitRecordingInput };
205
+ let LiveKitRecordingResult = class LiveKitRecordingResult {
206
+ };
207
+ __decorate([
208
+ Field(() => Boolean),
209
+ __metadata("design:type", Boolean)
210
+ ], LiveKitRecordingResult.prototype, "Success", void 0);
211
+ __decorate([
212
+ Field(() => String, { nullable: true }),
213
+ __metadata("design:type", String)
214
+ ], LiveKitRecordingResult.prototype, "ErrorMessage", void 0);
215
+ __decorate([
216
+ Field(() => String),
217
+ __metadata("design:type", String)
218
+ ], LiveKitRecordingResult.prototype, "EgressID", void 0);
219
+ __decorate([
220
+ Field(() => String),
221
+ __metadata("design:type", String)
222
+ ], LiveKitRecordingResult.prototype, "Status", void 0);
223
+ LiveKitRecordingResult = __decorate([
224
+ ObjectType()
225
+ ], LiveKitRecordingResult);
226
+ export { LiveKitRecordingResult };
227
+ /** A selectable provider-native voice for the dev voice picker. */
228
+ let RealtimeVoiceOptionResult = class RealtimeVoiceOptionResult {
229
+ };
230
+ __decorate([
231
+ Field(() => String),
232
+ __metadata("design:type", String)
233
+ ], RealtimeVoiceOptionResult.prototype, "ID", void 0);
234
+ __decorate([
235
+ Field(() => String),
236
+ __metadata("design:type", String)
237
+ ], RealtimeVoiceOptionResult.prototype, "Name", void 0);
238
+ RealtimeVoiceOptionResult = __decorate([
239
+ ObjectType()
240
+ ], RealtimeVoiceOptionResult);
241
+ export { RealtimeVoiceOptionResult };
242
+ /** An active Realtime model with the voices its driver supports — feeds the dev model/voice picker. */
243
+ let RealtimeModelVoicesResult = class RealtimeModelVoicesResult {
244
+ };
245
+ __decorate([
246
+ Field(() => String),
247
+ __metadata("design:type", String)
248
+ ], RealtimeModelVoicesResult.prototype, "ModelID", void 0);
249
+ __decorate([
250
+ Field(() => String),
251
+ __metadata("design:type", String)
252
+ ], RealtimeModelVoicesResult.prototype, "ModelName", void 0);
253
+ __decorate([
254
+ Field(() => [RealtimeVoiceOptionResult]),
255
+ __metadata("design:type", Array)
256
+ ], RealtimeModelVoicesResult.prototype, "Voices", void 0);
257
+ RealtimeModelVoicesResult = __decorate([
258
+ ObjectType()
259
+ ], RealtimeModelVoicesResult);
260
+ export { RealtimeModelVoicesResult };
261
+ let RealtimeBridgeResolver = class RealtimeBridgeResolver extends ResolverBase {
262
+ constructor() {
263
+ super(...arguments);
264
+ /** Durable `AIAgentSession` record manager — creates the session row the bridge FK-references. */
265
+ this.sessionManager = new SessionManager();
266
+ }
267
+ /**
268
+ * Mints a scoped LiveKit access token for the current user to join the given room. The participant
269
+ * identity is derived server-side from the authenticated user (never trusted from the client).
270
+ */
271
+ async MintLiveKitClientToken(input, context = {}) {
272
+ const failure = (msg) => ({
273
+ Success: false,
274
+ ErrorMessage: msg,
275
+ ServerUrl: '',
276
+ Token: '',
277
+ Identity: '',
278
+ RoomName: input.RoomName,
279
+ });
280
+ try {
281
+ const user = this.GetUserFromPayload(context.userPayload);
282
+ if (!user) {
283
+ return failure('Unable to determine current user.');
284
+ }
285
+ const tokenService = new LiveKitTokenService();
286
+ const minted = await tokenService.MintClientToken(input.RoomName, this.participantIdentity(user), input.DisplayName ?? user.Name ?? user.Email);
287
+ return { Success: true, ...minted };
288
+ }
289
+ catch (error) {
290
+ const msg = error instanceof Error ? error.message : String(error);
291
+ LogError(`MintLiveKitClientToken failed: ${msg}`);
292
+ return failure(msg);
293
+ }
294
+ }
295
+ /**
296
+ * Starts (or reuses) an agent's presence in a LiveKit room and returns a client token so the calling
297
+ * user can immediately join the same room.
298
+ */
299
+ async StartLiveKitAgentRoomSession(input, context = {}) {
300
+ const failure = (msg, roomName = '') => ({
301
+ Success: false,
302
+ ErrorMessage: msg,
303
+ SessionBridgeID: '',
304
+ RoomName: roomName,
305
+ ServerUrl: '',
306
+ ClientToken: '',
307
+ Identity: '',
308
+ });
309
+ try {
310
+ const user = this.GetUserFromPayload(context.userPayload);
311
+ if (!user) {
312
+ return failure('Unable to determine current user.');
313
+ }
314
+ const provider = GetReadWriteProvider(context.providers);
315
+ const roomName = input.RoomName?.trim() || `mj-${randomUUID()}`;
316
+ // Resolve the AIAgentSession the bridge will reference. The bridge row FK-references
317
+ // AIAgentSession(ID), so we must use an EXISTING session — either one the caller supplied, or a
318
+ // freshly-created one. Previously this minted a bare random UUID with no backing row, so the
319
+ // bridge INSERT failed the FK_AIAgentSessionBridge_Session constraint.
320
+ let agentSessionID = input.AgentSessionID?.trim();
321
+ if (!agentSessionID) {
322
+ if (!input.AgentID?.trim()) {
323
+ return failure('An AgentID is required to start an agent room session.', roomName);
324
+ }
325
+ const createdSession = await this.sessionManager.CreateSession({ agentID: input.AgentID.trim(), userID: user.ID }, user, provider);
326
+ agentSessionID = createdSession.ID;
327
+ }
328
+ const session = await LiveKitAgentRoomCoordinator.Instance.StartAgentRoomSession({
329
+ AgentSessionID: agentSessionID,
330
+ RoomName: roomName,
331
+ AgentID: input.AgentID,
332
+ AgentName: input.AgentName,
333
+ TargetAgentID: input.TargetAgentID,
334
+ RealtimeModelID: input.RealtimeModelID,
335
+ RealtimeVoice: input.RealtimeVoice,
336
+ TurnMode: this.normalizeTurnMode(input.TurnMode),
337
+ ContextUser: user,
338
+ MetadataProvider: provider,
339
+ });
340
+ const tokenService = new LiveKitTokenService();
341
+ const clientToken = await tokenService.MintClientToken(roomName, this.participantIdentity(user), user.Name ?? user.Email);
342
+ return {
343
+ Success: true,
344
+ SessionBridgeID: session.SessionBridgeID,
345
+ RoomName: session.RoomName,
346
+ ServerUrl: session.ServerUrl,
347
+ ClientToken: clientToken.Token,
348
+ Identity: clientToken.Identity,
349
+ };
350
+ }
351
+ catch (error) {
352
+ const msg = error instanceof Error ? error.message : String(error);
353
+ LogError(`StartLiveKitAgentRoomSession failed: ${msg}`);
354
+ return failure(msg, input.RoomName ?? '');
355
+ }
356
+ }
357
+ /**
358
+ * Stops one agent's presence in a room (the bot leaves) — the remove half of in-room agent management.
359
+ * Identified by the `SessionBridgeID` returned from {@link StartLiveKitAgentRoomSession}. Returns `true`
360
+ * when the bridge was stopped. Best-effort: a missing/already-stopped bridge or any error resolves `false`.
361
+ *
362
+ * @param sessionBridgeID The `MJ: AI Agent Session Bridges` row id of the agent to remove.
363
+ */
364
+ async StopLiveKitAgentRoomSession(sessionBridgeID, context = {}) {
365
+ try {
366
+ const user = this.GetUserFromPayload(context.userPayload);
367
+ if (!user) {
368
+ return false;
369
+ }
370
+ const provider = GetReadWriteProvider(context.providers);
371
+ return await LiveKitAgentRoomCoordinator.Instance.StopAgentRoomSession(sessionBridgeID, 'Explicit', user, provider);
372
+ }
373
+ catch (error) {
374
+ LogError(`StopLiveKitAgentRoomSession failed: ${error instanceof Error ? error.message : String(error)}`);
375
+ return false;
376
+ }
377
+ }
378
+ /**
379
+ * **Ends the meeting for everyone**: stops EVERY agent bot bridged into a room (by room name, via the
380
+ * coordinator's server-side roster). This is the "End meeting" half of the Zoom-style leave control —
381
+ * usable by any participant, including one who only *joined* the room and never tracked the bridge ids.
382
+ * Returns `true` when the teardown ran (even if the room held zero agents). Best-effort: any error → `false`.
383
+ *
384
+ * @param roomName The LiveKit room to end.
385
+ */
386
+ async EndLiveKitRoom(roomName, context = {}) {
387
+ try {
388
+ const user = this.GetUserFromPayload(context.userPayload);
389
+ if (!user) {
390
+ return false;
391
+ }
392
+ const provider = GetReadWriteProvider(context.providers);
393
+ await LiveKitAgentRoomCoordinator.Instance.StopAllAgentsInRoom(roomName, 'Explicit', user, provider);
394
+ return true;
395
+ }
396
+ catch (error) {
397
+ LogError(`EndLiveKitRoom failed: ${error instanceof Error ? error.message : String(error)}`);
398
+ return false;
399
+ }
400
+ }
401
+ /**
402
+ * Lists active Realtime models with the voices each driver supports — the source for the dev model/voice
403
+ * picker (gated client-side by the `Realtime: Advanced Session Controls` authorization). Read-only; returns
404
+ * an empty list on any error so the picker degrades gracefully to "no overrides".
405
+ */
406
+ async GetRealtimeModelVoices(context = {}) {
407
+ try {
408
+ const user = this.GetUserFromPayload(context.userPayload);
409
+ if (!user) {
410
+ return [];
411
+ }
412
+ const provider = GetReadWriteProvider(context.providers);
413
+ return await GetRealtimeModelVoices(user, provider);
414
+ }
415
+ catch (error) {
416
+ LogError(`GetRealtimeModelVoices failed: ${error instanceof Error ? error.message : String(error)}`);
417
+ return [];
418
+ }
419
+ }
420
+ /**
421
+ * Invites MJ users to a live room: for each user, sends a **"Live Room Invite"** notification via the
422
+ * unified {@link NotificationEngine} — which writes the in-app notification (clickable → joins the room
423
+ * via the `meet-room` ResourceConfiguration) and ALSO delivers over MJ Comms (email/SMS) when the type's
424
+ * channels + a provider are configured. Best-effort: Comms not being set up never blocks the in-app
425
+ * notification, and a missing "Live Room Invite" type (seed not yet pushed) is caught and returns false.
426
+ *
427
+ * @param roomName The LiveKit room the invitees should join.
428
+ * @param userIDs The `MJ: Users` ids to invite.
429
+ * @returns `true` when at least one invite was delivered.
430
+ */
431
+ async InviteUsersToLiveKitRoom(roomName, userIDs, context = {}) {
432
+ try {
433
+ const user = this.GetUserFromPayload(context.userPayload);
434
+ if (!user) {
435
+ return false;
436
+ }
437
+ const provider = GetReadWriteProvider(context.providers);
438
+ await NotificationEngine.Instance.Config(false, user, provider);
439
+ const inviter = user.Name?.trim() || user.Email || 'Someone';
440
+ let anyDelivered = false;
441
+ for (const userId of userIDs ?? []) {
442
+ if (!userId?.trim()) {
443
+ continue;
444
+ }
445
+ const result = await NotificationEngine.Instance.SendNotification({
446
+ userId,
447
+ typeNameOrId: 'Live Room Invite',
448
+ title: `${inviter} invited you to a live room`,
449
+ message: `${inviter} is inviting you to join a live Meet room. Open this notification to join.`,
450
+ resourceConfiguration: { type: 'meet-room', room: roomName },
451
+ }, user);
452
+ anyDelivered = anyDelivered || result.success;
453
+ }
454
+ return anyDelivered;
455
+ }
456
+ catch (error) {
457
+ LogError(`InviteUsersToLiveKitRoom failed: ${error instanceof Error ? error.message : String(error)}`);
458
+ return false;
459
+ }
460
+ }
461
+ /**
462
+ * Starts recording (composite egress) of a room. Server-authorized — the browser never holds egress
463
+ * credentials.
464
+ */
465
+ async StartLiveKitRecording(input, context = {}) {
466
+ try {
467
+ if (!this.GetUserFromPayload(context.userPayload)) {
468
+ return { Success: false, ErrorMessage: 'Unable to determine current user.', EgressID: '', Status: '' };
469
+ }
470
+ const info = await new LiveKitEgressService().StartRoomRecording({ RoomName: input.RoomName, Layout: input.Layout });
471
+ return { Success: true, EgressID: info.EgressID, Status: info.Status };
472
+ }
473
+ catch (error) {
474
+ const msg = error instanceof Error ? error.message : String(error);
475
+ LogError(`StartLiveKitRecording failed: ${msg}`);
476
+ return { Success: false, ErrorMessage: msg, EgressID: '', Status: '' };
477
+ }
478
+ }
479
+ /** Stops a recording by egress id. */
480
+ async StopLiveKitRecording(egressID, context = {}) {
481
+ try {
482
+ if (!this.GetUserFromPayload(context.userPayload)) {
483
+ return { Success: false, ErrorMessage: 'Unable to determine current user.', EgressID: egressID, Status: '' };
484
+ }
485
+ const info = await new LiveKitEgressService().StopRecording(egressID);
486
+ return { Success: true, EgressID: info.EgressID, Status: info.Status };
487
+ }
488
+ catch (error) {
489
+ const msg = error instanceof Error ? error.message : String(error);
490
+ LogError(`StopLiveKitRecording failed: ${msg}`);
491
+ return { Success: false, ErrorMessage: msg, EgressID: egressID, Status: '' };
492
+ }
493
+ }
494
+ /** Builds a stable, lowercased participant identity from the authenticated user. */
495
+ participantIdentity(user) {
496
+ return `user-${user.ID}`.toLowerCase();
497
+ }
498
+ /** Normalizes a turn-mode string to the bridge's accepted values. */
499
+ normalizeTurnMode(mode) {
500
+ switch ((mode ?? '').toLowerCase()) {
501
+ case 'active':
502
+ return 'Active';
503
+ case 'hybrid':
504
+ return 'Hybrid';
505
+ case 'passive':
506
+ return 'Passive';
507
+ default:
508
+ return undefined;
509
+ }
510
+ }
511
+ };
512
+ __decorate([
513
+ Mutation(() => LiveKitClientTokenResult),
514
+ __param(0, Arg('input', () => MintLiveKitClientTokenInput)),
515
+ __param(1, Ctx()),
516
+ __metadata("design:type", Function),
517
+ __metadata("design:paramtypes", [MintLiveKitClientTokenInput, Object]),
518
+ __metadata("design:returntype", Promise)
519
+ ], RealtimeBridgeResolver.prototype, "MintLiveKitClientToken", null);
520
+ __decorate([
521
+ Mutation(() => LiveKitAgentRoomSessionResult),
522
+ __param(0, Arg('input', () => StartLiveKitAgentRoomSessionInput)),
523
+ __param(1, Ctx()),
524
+ __metadata("design:type", Function),
525
+ __metadata("design:paramtypes", [StartLiveKitAgentRoomSessionInput, Object]),
526
+ __metadata("design:returntype", Promise)
527
+ ], RealtimeBridgeResolver.prototype, "StartLiveKitAgentRoomSession", null);
528
+ __decorate([
529
+ Mutation(() => Boolean),
530
+ __param(0, Arg('sessionBridgeID', () => String)),
531
+ __param(1, Ctx()),
532
+ __metadata("design:type", Function),
533
+ __metadata("design:paramtypes", [String, Object]),
534
+ __metadata("design:returntype", Promise)
535
+ ], RealtimeBridgeResolver.prototype, "StopLiveKitAgentRoomSession", null);
536
+ __decorate([
537
+ Mutation(() => Boolean),
538
+ __param(0, Arg('roomName', () => String)),
539
+ __param(1, Ctx()),
540
+ __metadata("design:type", Function),
541
+ __metadata("design:paramtypes", [String, Object]),
542
+ __metadata("design:returntype", Promise)
543
+ ], RealtimeBridgeResolver.prototype, "EndLiveKitRoom", null);
544
+ __decorate([
545
+ Query(() => [RealtimeModelVoicesResult]),
546
+ __param(0, Ctx()),
547
+ __metadata("design:type", Function),
548
+ __metadata("design:paramtypes", [Object]),
549
+ __metadata("design:returntype", Promise)
550
+ ], RealtimeBridgeResolver.prototype, "GetRealtimeModelVoices", null);
551
+ __decorate([
552
+ Mutation(() => Boolean),
553
+ __param(0, Arg('roomName', () => String)),
554
+ __param(1, Arg('userIDs', () => [String])),
555
+ __param(2, Ctx()),
556
+ __metadata("design:type", Function),
557
+ __metadata("design:paramtypes", [String, Array, Object]),
558
+ __metadata("design:returntype", Promise)
559
+ ], RealtimeBridgeResolver.prototype, "InviteUsersToLiveKitRoom", null);
560
+ __decorate([
561
+ Mutation(() => LiveKitRecordingResult),
562
+ __param(0, Arg('input', () => LiveKitRecordingInput)),
563
+ __param(1, Ctx()),
564
+ __metadata("design:type", Function),
565
+ __metadata("design:paramtypes", [LiveKitRecordingInput, Object]),
566
+ __metadata("design:returntype", Promise)
567
+ ], RealtimeBridgeResolver.prototype, "StartLiveKitRecording", null);
568
+ __decorate([
569
+ Mutation(() => LiveKitRecordingResult),
570
+ __param(0, Arg('egressID', () => String)),
571
+ __param(1, Ctx()),
572
+ __metadata("design:type", Function),
573
+ __metadata("design:paramtypes", [String, Object]),
574
+ __metadata("design:returntype", Promise)
575
+ ], RealtimeBridgeResolver.prototype, "StopLiveKitRecording", null);
576
+ RealtimeBridgeResolver = __decorate([
577
+ Resolver()
578
+ ], RealtimeBridgeResolver);
579
+ export { RealtimeBridgeResolver };
580
+ //# sourceMappingURL=RealtimeBridgeResolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RealtimeBridgeResolver.js","sourceRoot":"","sources":["../../src/resolvers/RealtimeBridgeResolver.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACjG,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAA+B,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAE7H,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,8BAA8B,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAC1L,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE;;;;;;;GAOG;AACH,2BAA2B,CAAC,QAAQ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