@memberjunction/ai-agents 5.40.2 → 5.42.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 (88) hide show
  1. package/README.md +53 -0
  2. package/dist/AgentRunner.d.ts +5 -2
  3. package/dist/AgentRunner.d.ts.map +1 -1
  4. package/dist/AgentRunner.js +14 -4
  5. package/dist/AgentRunner.js.map +1 -1
  6. package/dist/MemoryWriteManager.d.ts +188 -0
  7. package/dist/MemoryWriteManager.d.ts.map +1 -0
  8. package/dist/MemoryWriteManager.js +299 -0
  9. package/dist/MemoryWriteManager.js.map +1 -0
  10. package/dist/agent-context-injector.d.ts +29 -0
  11. package/dist/agent-context-injector.d.ts.map +1 -1
  12. package/dist/agent-context-injector.js +90 -32
  13. package/dist/agent-context-injector.js.map +1 -1
  14. package/dist/agent-memory-context-builder.d.ts +100 -0
  15. package/dist/agent-memory-context-builder.d.ts.map +1 -0
  16. package/dist/agent-memory-context-builder.js +172 -0
  17. package/dist/agent-memory-context-builder.js.map +1 -0
  18. package/dist/agent-types/index.d.ts +1 -0
  19. package/dist/agent-types/index.d.ts.map +1 -1
  20. package/dist/agent-types/index.js +1 -0
  21. package/dist/agent-types/index.js.map +1 -1
  22. package/dist/agent-types/loop-agent-response-type.d.ts +12 -1
  23. package/dist/agent-types/loop-agent-response-type.d.ts.map +1 -1
  24. package/dist/agent-types/loop-agent-response-type.js.map +1 -1
  25. package/dist/agent-types/loop-agent-type.d.ts.map +1 -1
  26. package/dist/agent-types/loop-agent-type.js +4 -0
  27. package/dist/agent-types/loop-agent-type.js.map +1 -1
  28. package/dist/agent-types/realtime-agent-type.d.ts +146 -0
  29. package/dist/agent-types/realtime-agent-type.d.ts.map +1 -0
  30. package/dist/agent-types/realtime-agent-type.js +176 -0
  31. package/dist/agent-types/realtime-agent-type.js.map +1 -0
  32. package/dist/base-agent.d.ts +386 -39
  33. package/dist/base-agent.d.ts.map +1 -1
  34. package/dist/base-agent.js +1121 -261
  35. package/dist/base-agent.js.map +1 -1
  36. package/dist/index.d.ts +13 -0
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +17 -0
  39. package/dist/index.js.map +1 -1
  40. package/dist/memory-manager-agent.d.ts +99 -4
  41. package/dist/memory-manager-agent.d.ts.map +1 -1
  42. package/dist/memory-manager-agent.js +349 -117
  43. package/dist/memory-manager-agent.js.map +1 -1
  44. package/dist/realtime/bridge-realtime-session-factory.d.ts +111 -0
  45. package/dist/realtime/bridge-realtime-session-factory.d.ts.map +1 -0
  46. package/dist/realtime/bridge-realtime-session-factory.js +163 -0
  47. package/dist/realtime/bridge-realtime-session-factory.js.map +1 -0
  48. package/dist/realtime/bridge-room-transcript-sink.d.ts +58 -0
  49. package/dist/realtime/bridge-room-transcript-sink.d.ts.map +1 -0
  50. package/dist/realtime/bridge-room-transcript-sink.js +127 -0
  51. package/dist/realtime/bridge-room-transcript-sink.js.map +1 -0
  52. package/dist/realtime/meeting-controls-channel-server.d.ts +198 -0
  53. package/dist/realtime/meeting-controls-channel-server.d.ts.map +1 -0
  54. package/dist/realtime/meeting-controls-channel-server.js +319 -0
  55. package/dist/realtime/meeting-controls-channel-server.js.map +1 -0
  56. package/dist/realtime/meeting-controls-state.d.ts +191 -0
  57. package/dist/realtime/meeting-controls-state.d.ts.map +1 -0
  58. package/dist/realtime/meeting-controls-state.js +219 -0
  59. package/dist/realtime/meeting-controls-state.js.map +1 -0
  60. package/dist/realtime/realtime-channel-server-host.d.ts +166 -0
  61. package/dist/realtime/realtime-channel-server-host.d.ts.map +1 -0
  62. package/dist/realtime/realtime-channel-server-host.js +378 -0
  63. package/dist/realtime/realtime-channel-server-host.js.map +1 -0
  64. package/dist/realtime/realtime-client-session-service.d.ts +1026 -0
  65. package/dist/realtime/realtime-client-session-service.d.ts.map +1 -0
  66. package/dist/realtime/realtime-client-session-service.js +1607 -0
  67. package/dist/realtime/realtime-client-session-service.js.map +1 -0
  68. package/dist/realtime/realtime-coagent-config.d.ts +258 -0
  69. package/dist/realtime/realtime-coagent-config.d.ts.map +1 -0
  70. package/dist/realtime/realtime-coagent-config.js +408 -0
  71. package/dist/realtime/realtime-coagent-config.js.map +1 -0
  72. package/dist/realtime/realtime-narration.d.ts +67 -0
  73. package/dist/realtime/realtime-narration.d.ts.map +1 -0
  74. package/dist/realtime/realtime-narration.js +127 -0
  75. package/dist/realtime/realtime-narration.js.map +1 -0
  76. package/dist/realtime/realtime-session-runner.d.ts +383 -0
  77. package/dist/realtime/realtime-session-runner.d.ts.map +1 -0
  78. package/dist/realtime/realtime-session-runner.js +532 -0
  79. package/dist/realtime/realtime-session-runner.js.map +1 -0
  80. package/dist/realtime/realtime-tool-broker.d.ts +294 -0
  81. package/dist/realtime/realtime-tool-broker.d.ts.map +1 -0
  82. package/dist/realtime/realtime-tool-broker.js +206 -0
  83. package/dist/realtime/realtime-tool-broker.js.map +1 -0
  84. package/dist/realtime/whiteboard-channel-server.d.ts +50 -0
  85. package/dist/realtime/whiteboard-channel-server.d.ts.map +1 -0
  86. package/dist/realtime/whiteboard-channel-server.js +85 -0
  87. package/dist/realtime/whiteboard-channel-server.js.map +1 -0
  88. package/package.json +17 -17
@@ -0,0 +1,319 @@
1
+ /**
2
+ * @fileoverview The **Meeting Controls** server-side channel — a SERVER-ONLY interactive channel
3
+ * (no Angular client surface) that turns a realtime agent into a meeting **facilitator**.
4
+ *
5
+ * It contributes a facilitator tool vocabulary the agent invokes server-side (`RaiseHand`,
6
+ * `LowerHand`, `CallOnParticipant`, `MuteParticipant`, `SetTimer`) and feeds back the perception that
7
+ * makes facilitation possible: the ordered **hand-raise queue** (who raised, in order, how long
8
+ * they've waited), **who is speaking**, the **roster**, and the agenda **timer** (elapsed / remaining).
9
+ * With that intel an agent can call on people in order, enforce time, and move the agenda — all
10
+ * through one channel's tools + perception.
11
+ *
12
+ * The channel has **no platform code**: the signals (roster / speaking / hand-raise) arrive from an
13
+ * INJECTED {@link IMeetingControlsEventSource} that each bridge driver adapts from its native
14
+ * participant/event stream. The queue + timer logic is the pure, fully unit-testable
15
+ * {@link MeetingControlsState}. This is the §4b "bridge contributes a channel" pattern realized as an
16
+ * MJ channel: dynamic tool vocabulary + perception, routed through the same channel plane as the
17
+ * MJ-native whiteboard.
18
+ *
19
+ * @module @memberjunction/ai-agents
20
+ * @author MemberJunction.com
21
+ */
22
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
23
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
24
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
25
+ 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;
26
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
27
+ };
28
+ var __metadata = (this && this.__metadata) || function (k, v) {
29
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
30
+ };
31
+ import { BaseRealtimeChannelServer, } from '@memberjunction/ai';
32
+ import { RegisterClass } from '@memberjunction/global';
33
+ import { LogError } from '@memberjunction/core';
34
+ import { MeetingControlsState, } from './meeting-controls-state.js';
35
+ /** The channel name — matches the (seedable) `MJ: AI Agent Channels` row's `Name`. */
36
+ export const MEETING_CONTROLS_CHANNEL_NAME = 'Meeting Controls';
37
+ /**
38
+ * The shared name prefix of every Meeting Controls tool. The host routes any tool call beginning with
39
+ * this prefix back to this channel's {@link MeetingControlsChannelServer.ExecuteServerTool}.
40
+ */
41
+ export const MEETING_CONTROLS_TOOL_PREFIX = 'MeetingControls_';
42
+ /**
43
+ * Server-only Meeting Controls channel — the facilitator surface. ONE instance per session.
44
+ *
45
+ * Unlike the whiteboard (resolved from the registry by the host via a parameterless ClassFactory
46
+ * construction), this channel needs a per-session {@link IMeetingControlsEventSource} from the bridge,
47
+ * so a bridge driver constructs it directly with {@link MeetingControlsChannelDeps} and hands it to
48
+ * the host's per-session plugin set. It has **no client surface** — the contract's
49
+ * `GetServerToolDefinitions` / `ExecuteServerTool` are the entire interface; there is no
50
+ * `GetSurfaceComponent` on the server half at all.
51
+ *
52
+ * Registered under {@link MEETING_CONTROLS_CHANNEL_NAME} so a seeded registry row can resolve a
53
+ * default (event-source-less) instance for discovery; a real session always injects the driver's
54
+ * event source.
55
+ */
56
+ let MeetingControlsChannelServer = class MeetingControlsChannelServer extends BaseRealtimeChannelServer {
57
+ /**
58
+ * @param deps Optional per-session dependencies. Omitted only for a registry-resolved discovery
59
+ * instance (the host's ClassFactory path) — such an instance maintains no live state and
60
+ * contributes its tool vocabulary but cannot actuate platform mutes.
61
+ */
62
+ constructor(deps) {
63
+ super();
64
+ this.state = new MeetingControlsState(deps?.Clock);
65
+ this.eventSource = deps?.EventSource ?? null;
66
+ }
67
+ /** @inheritdoc */
68
+ get ChannelName() {
69
+ return MEETING_CONTROLS_CHANNEL_NAME;
70
+ }
71
+ /** @inheritdoc */
72
+ get ToolNamePrefix() {
73
+ return MEETING_CONTROLS_TOOL_PREFIX;
74
+ }
75
+ /** Read-only access to the live facilitator state (for the channel's own perception + tests). */
76
+ get State() {
77
+ return this.state;
78
+ }
79
+ // ── Lifecycle: subscribe the bridge event source ────────────────────────────────
80
+ /**
81
+ * Subscribes the injected event source's perception streams into {@link MeetingControlsState} and
82
+ * emits an initial perception snapshot. A discovery instance (no event source) is inert.
83
+ */
84
+ async OnSessionStarted() {
85
+ if (!this.eventSource) {
86
+ return;
87
+ }
88
+ this.eventSource.OnRosterChange((participants) => {
89
+ this.state.SetRoster(participants);
90
+ this.emitPerception('roster changed');
91
+ });
92
+ this.eventSource.OnSpeakingChange((ids) => {
93
+ this.state.SetSpeaking(ids);
94
+ this.emitPerception('speaking changed');
95
+ });
96
+ this.eventSource.OnHandRaiseChange((participantId, raised) => {
97
+ const changed = raised ? this.state.RaiseHand(participantId) : this.state.LowerHand(participantId);
98
+ if (changed) {
99
+ this.emitPerception(raised ? 'hand raised' : 'hand lowered');
100
+ }
101
+ });
102
+ }
103
+ // ── Dynamic tool vocabulary ─────────────────────────────────────────────────────
104
+ /**
105
+ * The facilitator tool vocabulary. `MuteParticipant` is included only when the platform advertises
106
+ * the `'Mute'` capability — so the contributed tool set is **runtime-computed** from the connected
107
+ * platform's abilities (the §4b dynamic-tool point), not a fixed constant.
108
+ *
109
+ * @returns The contributed server-executed tool definitions.
110
+ */
111
+ GetServerToolDefinitions() {
112
+ const tools = [
113
+ this.tool('RaiseHand', 'Add a participant to the hand-raise queue (e.g. on their spoken request to speak).', this.participantSchema()),
114
+ this.tool('LowerHand', 'Remove a participant from the hand-raise queue.', this.participantSchema()),
115
+ this.tool('CallOnParticipant', 'Call on a participant so they may speak, lowering their hand. Omit participantId to call on the next person in the queue.', this.participantSchema(false)),
116
+ this.tool('SetTimer', 'Start an agenda/meeting timer for the given number of seconds (0 clears it).', this.setTimerSchema()),
117
+ ];
118
+ if (this.muteSupported()) {
119
+ tools.push(this.tool('MuteParticipant', 'Mute a participant on the platform.', this.participantSchema()));
120
+ }
121
+ return tools;
122
+ }
123
+ /**
124
+ * Executes one facilitator tool and returns the result (the model narrates it). Tool dispatch is
125
+ * by the bare tool name (after the {@link MEETING_CONTROLS_TOOL_PREFIX}). Never throws — bad args
126
+ * or an unknown tool resolve to a structured failure result.
127
+ *
128
+ * @param toolName The full tool name (prefixed).
129
+ * @param argsJson The raw arguments JSON.
130
+ * @returns The execution result.
131
+ */
132
+ async ExecuteServerTool(toolName, argsJson) {
133
+ const bare = toolName.startsWith(MEETING_CONTROLS_TOOL_PREFIX)
134
+ ? toolName.slice(MEETING_CONTROLS_TOOL_PREFIX.length)
135
+ : toolName;
136
+ switch (bare) {
137
+ case 'RaiseHand':
138
+ return this.execRaiseHand(argsJson);
139
+ case 'LowerHand':
140
+ return this.execLowerHand(argsJson);
141
+ case 'CallOnParticipant':
142
+ return this.execCallOn(argsJson);
143
+ case 'MuteParticipant':
144
+ return this.execMute(argsJson);
145
+ case 'SetTimer':
146
+ return this.execSetTimer(argsJson);
147
+ default:
148
+ return { Success: false, Output: `Unknown Meeting Controls tool '${toolName}'.` };
149
+ }
150
+ }
151
+ // ── Tool implementations ────────────────────────────────────────────────────────
152
+ /** `RaiseHand(participantId)` — enqueue a participant; emits perception on a real change. */
153
+ execRaiseHand(argsJson) {
154
+ const id = this.requireParticipantId(argsJson);
155
+ if (!id) {
156
+ return this.missingParticipant('RaiseHand');
157
+ }
158
+ if (!this.state.GetParticipant(id)) {
159
+ return { Success: false, Output: `Participant '${id}' is not on the roster.` };
160
+ }
161
+ const changed = this.state.RaiseHand(id);
162
+ if (changed) {
163
+ this.emitPerception('hand raised');
164
+ }
165
+ return { Success: true, Output: changed ? `Hand raised for ${this.name(id)} (queue position ${this.queuePosition(id)}).` : `${this.name(id)} already has a hand raised.` };
166
+ }
167
+ /** `LowerHand(participantId)` — dequeue a participant. */
168
+ execLowerHand(argsJson) {
169
+ const id = this.requireParticipantId(argsJson);
170
+ if (!id) {
171
+ return this.missingParticipant('LowerHand');
172
+ }
173
+ const changed = this.state.LowerHand(id);
174
+ if (changed) {
175
+ this.emitPerception('hand lowered');
176
+ }
177
+ return { Success: true, Output: changed ? `Lowered ${this.name(id)}'s hand.` : `${this.name(id)} had no raised hand.` };
178
+ }
179
+ /** `CallOnParticipant(participantId?)` — call on a specific person or the front of the queue. */
180
+ execCallOn(argsJson) {
181
+ const id = this.parseParticipantArgs(argsJson).participantId;
182
+ const called = this.state.CallOn(id);
183
+ if (!called) {
184
+ return { Success: false, Output: id ? `${this.name(id)} is not in the hand-raise queue.` : 'No one is in the hand-raise queue to call on.' };
185
+ }
186
+ this.emitPerception('called on participant');
187
+ return { Success: true, Output: `Calling on ${called.DisplayName ?? this.name(called.ParticipantId)}.` };
188
+ }
189
+ /** `MuteParticipant(participantId)` — capability-gated; actuates the platform mute. */
190
+ async execMute(argsJson) {
191
+ if (!this.muteSupported()) {
192
+ return { Success: false, Output: 'Muting participants is not supported on this platform.' };
193
+ }
194
+ const id = this.requireParticipantId(argsJson);
195
+ if (!id) {
196
+ return this.missingParticipant('MuteParticipant');
197
+ }
198
+ if (!this.state.GetParticipant(id)) {
199
+ return { Success: false, Output: `Participant '${id}' is not on the roster.` };
200
+ }
201
+ try {
202
+ await this.eventSource?.MuteParticipant(id);
203
+ }
204
+ catch (error) {
205
+ return { Success: false, Output: `Failed to mute ${this.name(id)}: ${error instanceof Error ? error.message : String(error)}` };
206
+ }
207
+ this.state.MarkMuted(id);
208
+ this.emitPerception('participant muted');
209
+ return { Success: true, Output: `Muted ${this.name(id)}.` };
210
+ }
211
+ /** `SetTimer(seconds)` — start/clear the agenda timer. */
212
+ execSetTimer(argsJson) {
213
+ const seconds = this.parseSetTimerArgs(argsJson).seconds;
214
+ if (seconds == null || !Number.isFinite(seconds) || seconds < 0) {
215
+ return { Success: false, Output: "SetTimer requires a non-negative 'seconds' value." };
216
+ }
217
+ this.state.SetTimer(seconds);
218
+ this.emitPerception('timer set');
219
+ return { Success: true, Output: seconds > 0 ? `Timer set for ${seconds} seconds.` : 'Timer cleared.' };
220
+ }
221
+ // ── Perception ──────────────────────────────────────────────────────────────────
222
+ /**
223
+ * Serializes the current facilitator state and feeds it to the model as a background context note
224
+ * (no spoken reply forced). No-op when the host context supplies no perception sink (provider
225
+ * can't inject mid-session, or no live session yet).
226
+ *
227
+ * @param reason A short label for the change that triggered the perception (logging only).
228
+ */
229
+ emitPerception(reason) {
230
+ const sink = this.Context?.SendContextNote;
231
+ if (!sink) {
232
+ return;
233
+ }
234
+ try {
235
+ const payload = JSON.stringify(this.state.BuildPerception());
236
+ sink.call(this.Context, `[meeting-controls: ${reason}] ${payload}`);
237
+ }
238
+ catch (error) {
239
+ LogError(`[MeetingControlsChannelServer] perception emit failed (${reason}): ${error instanceof Error ? error.message : String(error)}`);
240
+ }
241
+ }
242
+ // ── Helpers ─────────────────────────────────────────────────────────────────────
243
+ /** Whether the platform advertises mute support. */
244
+ muteSupported() {
245
+ return this.eventSource?.Capabilities.includes('Mute') ?? false;
246
+ }
247
+ /** Builds one tool definition with the prefixed name. */
248
+ tool(bareName, description, parametersSchema) {
249
+ return { Name: `${MEETING_CONTROLS_TOOL_PREFIX}${bareName}`, Description: description, ParametersSchema: parametersSchema };
250
+ }
251
+ /** JSON schema for a `{ participantId }` tool; `required` controls whether the id is mandatory. */
252
+ participantSchema(required = true) {
253
+ const schema = {
254
+ type: 'object',
255
+ properties: { participantId: { type: 'string', description: 'The platform participant id this tool targets.' } },
256
+ };
257
+ if (required) {
258
+ schema.required = ['participantId'];
259
+ }
260
+ return schema;
261
+ }
262
+ /** JSON schema for the `SetTimer` tool. */
263
+ setTimerSchema() {
264
+ return {
265
+ type: 'object',
266
+ properties: { seconds: { type: 'number', description: 'Timer duration in seconds; 0 clears the timer.' } },
267
+ required: ['seconds'],
268
+ };
269
+ }
270
+ /** Parses a participant-targeting tool's args, tolerating malformed JSON. */
271
+ parseParticipantArgs(argsJson) {
272
+ return this.safeParse(argsJson);
273
+ }
274
+ /** Parses the `SetTimer` tool's args, tolerating malformed JSON. */
275
+ parseSetTimerArgs(argsJson) {
276
+ return this.safeParse(argsJson);
277
+ }
278
+ /** Returns the required `participantId` or `null` when absent/blank. */
279
+ requireParticipantId(argsJson) {
280
+ const id = this.parseParticipantArgs(argsJson).participantId;
281
+ return typeof id === 'string' && id.trim().length > 0 ? id : null;
282
+ }
283
+ /** A standard "missing participantId" failure result for a tool. */
284
+ missingParticipant(tool) {
285
+ return { Success: false, Output: `${tool} requires a 'participantId'.` };
286
+ }
287
+ /** A participant's display name, falling back to their id. */
288
+ name(participantId) {
289
+ return this.state.GetParticipant(participantId)?.DisplayName ?? participantId;
290
+ }
291
+ /** 1-based queue position of a participant (0 when not queued). */
292
+ queuePosition(participantId) {
293
+ return this.state.GetHandRaiseQueue().findIndex((e) => e.ParticipantId === participantId) + 1;
294
+ }
295
+ /** Parses JSON into `T`, returning an empty object on any error (channels never throw on bad args). */
296
+ safeParse(json) {
297
+ try {
298
+ const parsed = JSON.parse(json);
299
+ return parsed && typeof parsed === 'object' ? parsed : {};
300
+ }
301
+ catch {
302
+ return {};
303
+ }
304
+ }
305
+ };
306
+ MeetingControlsChannelServer = __decorate([
307
+ RegisterClass(BaseRealtimeChannelServer, 'MeetingControlsChannelServer'),
308
+ __metadata("design:paramtypes", [Object])
309
+ ], MeetingControlsChannelServer);
310
+ export { MeetingControlsChannelServer };
311
+ /**
312
+ * Tree-shaking prevention for {@link MeetingControlsChannelServer}'s `@RegisterClass` registration.
313
+ * Call from a static code path so the registration is never eliminated by the bundler — mirroring
314
+ * every other `Load…()` in the realtime stack.
315
+ */
316
+ export function LoadMeetingControlsChannelServer() {
317
+ // no-op — the import + call create a static reference bundlers cannot eliminate
318
+ }
319
+ //# sourceMappingURL=meeting-controls-channel-server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meeting-controls-channel-server.js","sourceRoot":"","sources":["../../src/realtime/meeting-controls-channel-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;AAEH,OAAO,EACH,yBAAyB,GAI5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EACH,oBAAoB,GAGvB,MAAM,0BAA0B,CAAC;AAElC,sFAAsF;AACtF,MAAM,CAAC,MAAM,6BAA6B,GAAG,kBAAkB,CAAC;AAEhE;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,kBAAkB,CAAC;AAsF/D;;;;;;;;;;;;;GAaG;AAEI,IAAM,4BAA4B,GAAlC,MAAM,4BAA6B,SAAQ,yBAAyB;IAOvE;;;;OAIG;IACH,YAAY,IAAiC;QACzC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,GAAG,IAAI,oBAAoB,CAAC,IAAI,EAA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EAAE,GAAG,IAAI,8BAA8B,EAAE,CAAC;IAC7E,CAAC;IAED,8DAA8D;IACtD,IAAI,CAAC,aAAqB;QAC9B,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,WAAW,IAAI,aAAa,CAAC;IAClF,CAAC;IAED,mEAAmE;IAC3D,aAAa,CAAC,aAAqB;QACvC,OAAO,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,KAAK,aAAa,CAAC,GAAG,CAAC,CAAC;IAClG,CAAC;IAED,uGAAuG;IAC/F,SAAS,CAAI,IAAY;QAC7B,IAAI,CAAC;YACD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAChC,OAAO,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAE,MAAY,CAAC,CAAC,CAAE,EAAQ,CAAC;QAC5E,CAAC;QAAC,MAAM,CAAC;YACL,OAAO,EAAO,CAAC;QACnB,CAAC;IACL,CAAC;CACJ,CAAA;AA5RY,4BAA4B;IADxC,aAAa,CAAC,yBAAyB,EAAE,8BAA8B,CAAC;;GAC5D,4BAA4B,CA4RxC;;AAED;;;;GAIG;AACH,MAAM,UAAU,gCAAgC;IAC5C,gFAAgF;AACpF,CAAC"}
@@ -0,0 +1,191 @@
1
+ /**
2
+ * @fileoverview Pure, platform-free state machine for the Meeting Controls channel — the
3
+ * facilitator intel an agent acts on: the ordered hand-raise QUEUE, who is speaking, the roster,
4
+ * and a meeting/agenda timer. Deliberately free of any realtime/bridge/MJ dependency so it is
5
+ * exhaustively unit-testable with an injected clock and no platform.
6
+ *
7
+ * The {@link import('./meeting-controls-channel-server.js').MeetingControlsChannelServer} owns one of
8
+ * these per session, mutates it from the injected bridge event stream + the agent's tool calls, and
9
+ * serializes {@link MeetingControlsState.BuildPerception} snapshots back to the model.
10
+ *
11
+ * @module @memberjunction/ai-agents
12
+ * @author MemberJunction.com
13
+ */
14
+ /**
15
+ * The role a participant plays in the meeting, from the facilitator's point of view. A union (not an
16
+ * enum) so it exports cleanly and stays additive. `Agent` is the facilitating bot itself.
17
+ */
18
+ export type MeetingParticipantRole = 'Host' | 'CoHost' | 'Participant' | 'Agent';
19
+ /**
20
+ * One participant on the meeting roster, as the Meeting Controls channel tracks them. Minimal and
21
+ * platform-agnostic — a bridge driver maps its native roster (`BridgeParticipantInfo`, a Zoom
22
+ * participant, a Twilio call leg, …) onto this shape when feeding the channel's event source.
23
+ */
24
+ export interface MeetingParticipant {
25
+ /** Stable platform-native participant id (the key the queue / speaking / mute state is keyed on). */
26
+ ParticipantId: string;
27
+ /** Human-readable display name, when the platform reports one. */
28
+ DisplayName?: string;
29
+ /** The participant's role in the meeting. */
30
+ Role: MeetingParticipantRole;
31
+ /** Whether this participant is an agent bot (the facilitator excludes agents from hand-raise / call-on). */
32
+ IsAgent: boolean;
33
+ }
34
+ /**
35
+ * One entry in the hand-raise queue: who raised, and WHEN (so the queue preserves raise order and the
36
+ * perception feed can report how long each person has been waiting).
37
+ */
38
+ export interface HandRaiseQueueEntry {
39
+ /** The participant who raised their hand. */
40
+ ParticipantId: string;
41
+ /** Their display name at raise time (for a human-readable queue in the perception feed). */
42
+ DisplayName?: string;
43
+ /** Epoch-ms when the hand was raised — drives queue ordering and wait-time reporting. */
44
+ RaisedAtMs: number;
45
+ }
46
+ /**
47
+ * A monotonic clock, injected so the queue/timer logic is deterministic in tests. Defaults to
48
+ * `Date.now` in production.
49
+ */
50
+ export type MeetingControlsClock = () => number;
51
+ /**
52
+ * A snapshot of the timer the agent set (via the `SetTimer` tool), reported in the perception feed so
53
+ * the agent can pace the meeting ("two minutes left on this agenda item").
54
+ */
55
+ export interface MeetingTimerSnapshot {
56
+ /** The total duration the timer was set for, in seconds. */
57
+ DurationSeconds: number;
58
+ /** Whole seconds elapsed since the timer was set (clamped to `[0, DurationSeconds]`). */
59
+ ElapsedSeconds: number;
60
+ /** Whole seconds remaining (clamped to `[0, DurationSeconds]`); `0` once the timer has expired. */
61
+ RemainingSeconds: number;
62
+ /** Whether the timer has reached or passed its duration. */
63
+ Expired: boolean;
64
+ }
65
+ /**
66
+ * The full perception payload the channel serializes back to the model — the facilitator's situational
67
+ * awareness in one object: the roster, the ordered hand-raise queue, who is speaking, and the timer.
68
+ */
69
+ export interface MeetingControlsPerception {
70
+ /** The current roster (every known participant, agents included). */
71
+ Roster: MeetingParticipant[];
72
+ /** The hand-raise queue in RAISE ORDER (oldest first) — who is waiting and for how long. */
73
+ HandRaiseQueue: Array<HandRaiseQueueEntry & {
74
+ WaitingSeconds: number;
75
+ }>;
76
+ /** The participant ids currently speaking (diarized), in no particular order. */
77
+ SpeakingParticipantIds: string[];
78
+ /** The participant ids the agent has muted via the channel (best-effort mirror of mute state). */
79
+ MutedParticipantIds: string[];
80
+ /** The active agenda/meeting timer, or `null` when none is set. */
81
+ Timer: MeetingTimerSnapshot | null;
82
+ }
83
+ /**
84
+ * Pure facilitator state — the ordered hand-raise queue, who is speaking, the roster, mute state, and
85
+ * a single agenda timer. No I/O, no realtime/bridge coupling; mutated by the channel server from the
86
+ * bridge event stream and the agent's tool calls, then snapshotted via {@link BuildPerception}.
87
+ *
88
+ * All time-based behavior reads the injected {@link MeetingControlsClock}, so a test can advance time
89
+ * deterministically and assert exact wait / elapsed / remaining values.
90
+ */
91
+ export declare class MeetingControlsState {
92
+ /** Roster keyed by participant id (insertion order preserved for stable perception output). */
93
+ private roster;
94
+ /** Hand-raise queue in raise order (oldest first). A participant appears at most once. */
95
+ private handQueue;
96
+ /** Currently-speaking participant ids (diarized). */
97
+ private speaking;
98
+ /** Participant ids the agent muted via the channel. */
99
+ private muted;
100
+ /** The active timer's total duration (seconds) and start time (epoch-ms), or `null` when unset. */
101
+ private timer;
102
+ /** Injected clock for deterministic time math. */
103
+ private readonly clock;
104
+ /**
105
+ * @param clock The monotonic clock to read for queue wait-times and the timer. Defaults to `Date.now`.
106
+ */
107
+ constructor(clock?: MeetingControlsClock);
108
+ /**
109
+ * Replaces the roster wholesale with a fresh snapshot from the bridge. Participants who left the
110
+ * meeting (no longer in the snapshot) are pruned from the queue, the speaking set, and the mute
111
+ * set so stale ids never linger in the perception feed.
112
+ *
113
+ * @param participants The current roster snapshot.
114
+ */
115
+ SetRoster(participants: MeetingParticipant[]): void;
116
+ /** The current roster (every known participant), in insertion order. */
117
+ GetRoster(): MeetingParticipant[];
118
+ /** Looks up a participant by id, or `undefined` when not on the roster. */
119
+ GetParticipant(participantId: string): MeetingParticipant | undefined;
120
+ /**
121
+ * Adds a participant to the hand-raise queue (idempotent — a second raise by someone already in
122
+ * the queue keeps their ORIGINAL position and raise time, never jumping them forward). A raise by
123
+ * someone not on the roster is ignored (the bridge should roster them first).
124
+ *
125
+ * @param participantId The participant raising their hand.
126
+ * @returns `true` when the queue changed (a new raise landed), `false` otherwise.
127
+ */
128
+ RaiseHand(participantId: string): boolean;
129
+ /**
130
+ * Removes a participant from the hand-raise queue (the explicit `LowerHand` tool, and the
131
+ * implicit lower when they are called on). Preserves the order of everyone else.
132
+ *
133
+ * @param participantId The participant whose hand to lower.
134
+ * @returns `true` when they were in the queue and were removed, `false` otherwise.
135
+ */
136
+ LowerHand(participantId: string): boolean;
137
+ /** Whether a participant is currently in the hand-raise queue. */
138
+ isQueued(participantId: string): boolean;
139
+ /** The next participant in the queue (front of the line), or `undefined` when the queue is empty. */
140
+ PeekNextHand(): HandRaiseQueueEntry | undefined;
141
+ /**
142
+ * "Calls on" a participant: removes them from the hand-raise queue (lowering their hand) and
143
+ * returns them. When `participantId` is omitted, calls on the FRONT of the queue (next in line).
144
+ * Returns `undefined` when there is no one to call on (empty queue, or the named id isn't queued).
145
+ *
146
+ * @param participantId Optional specific participant to call on; defaults to the queue front.
147
+ * @returns The participant called on, or `undefined`.
148
+ */
149
+ CallOn(participantId?: string): HandRaiseQueueEntry | undefined;
150
+ /** The hand-raise queue in raise order (oldest first), each stamped with current wait seconds. */
151
+ GetHandRaiseQueue(): Array<HandRaiseQueueEntry & {
152
+ WaitingSeconds: number;
153
+ }>;
154
+ /**
155
+ * Replaces the set of currently-speaking participants (from the bridge's diarization stream).
156
+ *
157
+ * @param participantIds The ids now speaking.
158
+ */
159
+ SetSpeaking(participantIds: string[]): void;
160
+ /** The participant ids currently speaking. */
161
+ GetSpeaking(): string[];
162
+ /**
163
+ * Marks a participant muted by the channel (the agent's `MuteParticipant` tool). The actual
164
+ * platform mute is the driver's job; this mirrors the intent so the perception feed reflects it.
165
+ *
166
+ * @param participantId The participant to mark muted.
167
+ * @returns `true` when the participant is on the roster (and was marked), `false` otherwise.
168
+ */
169
+ MarkMuted(participantId: string): boolean;
170
+ /** The participant ids the agent has muted via the channel. */
171
+ GetMuted(): string[];
172
+ /**
173
+ * Sets (or resets) the agenda timer to `durationSeconds`, starting now. A non-positive duration
174
+ * clears the timer. Setting a new timer replaces any existing one.
175
+ *
176
+ * @param durationSeconds The timer duration in seconds; `<= 0` clears it.
177
+ */
178
+ SetTimer(durationSeconds: number): void;
179
+ /** Clears the agenda timer. */
180
+ ClearTimer(): void;
181
+ /** The current timer snapshot (elapsed / remaining / expired), or `null` when none is set. */
182
+ GetTimer(): MeetingTimerSnapshot | null;
183
+ /**
184
+ * Builds the full perception snapshot the channel serializes back to the model — the facilitator's
185
+ * complete situational awareness in one object.
186
+ *
187
+ * @returns The perception payload.
188
+ */
189
+ BuildPerception(): MeetingControlsPerception;
190
+ }
191
+ //# sourceMappingURL=meeting-controls-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meeting-controls-state.d.ts","sourceRoot":"","sources":["../../src/realtime/meeting-controls-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,QAAQ,GAAG,aAAa,GAAG,OAAO,CAAC;AAEjF;;;;GAIG;AACH,MAAM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