@memberjunction/ai-agents 6.2.0-edge.3 → 6.2.0-edge.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/dist/AgentRunner.d.ts +49 -2
- package/dist/AgentRunner.d.ts.map +1 -1
- package/dist/AgentRunner.js +114 -21
- package/dist/AgentRunner.js.map +1 -1
- package/dist/ConversationCompactionManager.d.ts +2 -0
- package/dist/ConversationCompactionManager.d.ts.map +1 -1
- package/dist/ConversationCompactionManager.js +2 -2
- package/dist/ConversationCompactionManager.js.map +1 -1
- package/dist/ConversationToolManager.d.ts +13 -2
- package/dist/ConversationToolManager.d.ts.map +1 -1
- package/dist/ConversationToolManager.js +19 -3
- package/dist/ConversationToolManager.js.map +1 -1
- package/dist/KnowledgeAgent.d.ts.map +1 -1
- package/dist/KnowledgeAgent.js +6 -1
- package/dist/KnowledgeAgent.js.map +1 -1
- package/dist/MJAIAgentRequestEntityServer.d.ts +6 -0
- package/dist/MJAIAgentRequestEntityServer.d.ts.map +1 -1
- package/dist/MJAIAgentRequestEntityServer.js +26 -1
- package/dist/MJAIAgentRequestEntityServer.js.map +1 -1
- package/dist/agent-run-watchdog.d.ts +65 -5
- package/dist/agent-run-watchdog.d.ts.map +1 -1
- package/dist/agent-run-watchdog.js +143 -28
- package/dist/agent-run-watchdog.js.map +1 -1
- package/dist/agent-types/loop-agent-prompt-params.d.ts +7 -0
- package/dist/agent-types/loop-agent-prompt-params.d.ts.map +1 -1
- package/dist/agent-types/loop-agent-prompt-params.js +1 -0
- package/dist/agent-types/loop-agent-prompt-params.js.map +1 -1
- package/dist/artifact-tools/SearchResultSetToolLibrary.js +4 -4
- package/dist/artifact-tools/SearchResultSetToolLibrary.js.map +1 -1
- package/dist/base-agent.d.ts +275 -18
- package/dist/base-agent.d.ts.map +1 -1
- package/dist/base-agent.js +761 -216
- package/dist/base-agent.js.map +1 -1
- package/dist/client-tool-results.d.ts +45 -0
- package/dist/client-tool-results.d.ts.map +1 -0
- package/dist/client-tool-results.js +94 -0
- package/dist/client-tool-results.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/prior-turn-tool-result-cache.d.ts +31 -12
- package/dist/prior-turn-tool-result-cache.d.ts.map +1 -1
- package/dist/prior-turn-tool-result-cache.js +59 -16
- package/dist/prior-turn-tool-result-cache.js.map +1 -1
- package/dist/realtime/bridge-realtime-session-factory.d.ts +44 -2
- package/dist/realtime/bridge-realtime-session-factory.d.ts.map +1 -1
- package/dist/realtime/bridge-realtime-session-factory.js +68 -20
- package/dist/realtime/bridge-realtime-session-factory.js.map +1 -1
- package/dist/realtime/bridge-realtime-usage-recorder.d.ts +81 -0
- package/dist/realtime/bridge-realtime-usage-recorder.d.ts.map +1 -0
- package/dist/realtime/bridge-realtime-usage-recorder.js +194 -0
- package/dist/realtime/bridge-realtime-usage-recorder.js.map +1 -0
- package/dist/realtime/client-only-channel-server.d.ts +83 -0
- package/dist/realtime/client-only-channel-server.d.ts.map +1 -0
- package/dist/realtime/client-only-channel-server.js +107 -0
- package/dist/realtime/client-only-channel-server.js.map +1 -0
- package/dist/realtime/identity-verification-channel-server.d.ts +50 -0
- package/dist/realtime/identity-verification-channel-server.d.ts.map +1 -0
- package/dist/realtime/identity-verification-channel-server.js +66 -0
- package/dist/realtime/identity-verification-channel-server.js.map +1 -0
- package/dist/realtime/interactive-component-channel-server.d.ts +39 -0
- package/dist/realtime/interactive-component-channel-server.d.ts.map +1 -0
- package/dist/realtime/interactive-component-channel-server.js +55 -0
- package/dist/realtime/interactive-component-channel-server.js.map +1 -0
- package/dist/realtime/realtime-avatar-resolution.d.ts +194 -0
- package/dist/realtime/realtime-avatar-resolution.d.ts.map +1 -0
- package/dist/realtime/realtime-avatar-resolution.js +208 -0
- package/dist/realtime/realtime-avatar-resolution.js.map +1 -0
- package/dist/realtime/realtime-channel-policy.d.ts +81 -0
- package/dist/realtime/realtime-channel-policy.d.ts.map +1 -0
- package/dist/realtime/realtime-channel-policy.js +91 -0
- package/dist/realtime/realtime-channel-policy.js.map +1 -0
- package/dist/realtime/realtime-channel-server-host.d.ts +14 -0
- package/dist/realtime/realtime-channel-server-host.d.ts.map +1 -1
- package/dist/realtime/realtime-channel-server-host.js +35 -0
- package/dist/realtime/realtime-channel-server-host.js.map +1 -1
- package/dist/realtime/realtime-client-session-service.d.ts +430 -30
- package/dist/realtime/realtime-client-session-service.d.ts.map +1 -1
- package/dist/realtime/realtime-client-session-service.js +766 -111
- package/dist/realtime/realtime-client-session-service.js.map +1 -1
- package/dist/realtime/realtime-coagent-config.d.ts +94 -15
- package/dist/realtime/realtime-coagent-config.d.ts.map +1 -1
- package/dist/realtime/realtime-coagent-config.js +109 -4
- package/dist/realtime/realtime-coagent-config.js.map +1 -1
- package/dist/realtime/realtime-recording-store.d.ts +136 -16
- package/dist/realtime/realtime-recording-store.d.ts.map +1 -1
- package/dist/realtime/realtime-recording-store.js +505 -39
- package/dist/realtime/realtime-recording-store.js.map +1 -1
- package/dist/realtime/realtime-session-runner.js +4 -4
- package/dist/realtime/realtime-session-runner.js.map +1 -1
- package/dist/realtime/realtime-vendor-resolution.d.ts +9 -0
- package/dist/realtime/realtime-vendor-resolution.d.ts.map +1 -1
- package/dist/realtime/realtime-vendor-resolution.js +16 -5
- package/dist/realtime/realtime-vendor-resolution.js.map +1 -1
- package/dist/realtime/realtime-video-output-gate.d.ts +83 -0
- package/dist/realtime/realtime-video-output-gate.d.ts.map +1 -0
- package/dist/realtime/realtime-video-output-gate.js +79 -0
- package/dist/realtime/realtime-video-output-gate.js.map +1 -0
- package/dist/tool-result-format.d.ts +14 -0
- package/dist/tool-result-format.d.ts.map +1 -1
- package/dist/tool-result-format.js.map +1 -1
- package/package.json +19 -19
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Which live avatar, if any, a realtime session asks for, and the voice that goes with it.
|
|
3
|
+
*
|
|
4
|
+
* A persona is a voice and a face: its Audio binding on a vendor is a voice, its Video binding an avatar. A session asks
|
|
5
|
+
* for an avatar when the voiced agent's video setting is on (`realtime.video.enabled`), the model's Video/Output row
|
|
6
|
+
* doesn't turn video off (`IsSupported` false: reason `endpoint`), and a face resolves:
|
|
7
|
+
* 1. `realtime.video.avatarId`, accepted only when it names an Active Video binding the model supports on the vendor;
|
|
8
|
+
* 2. else the voiced (target) agent's personas, default first, the first with a face;
|
|
9
|
+
* 3. else the co-agent's personas, the same way;
|
|
10
|
+
* 4. else none. The model's own first persona is never used: an agent with no persona gets no face.
|
|
11
|
+
*
|
|
12
|
+
* A call's avatar pick (the runtime override's `realtime.video.avatarId`) can't turn the video setting on: with the
|
|
13
|
+
* setting off the session asks for none, and says why (reason `video-off`), since the pick asked for one.
|
|
14
|
+
*
|
|
15
|
+
* Where the session runs can rule the avatar out before any of that: nobody sees an avatar on a phone call (reason
|
|
16
|
+
* `phone`), or in an app that shows no agent video (reason `host`: the app said so at mint), so such a session asks for
|
|
17
|
+
* none ({@link WithoutUnseenAvatar}) and keeps only the persona's voice.
|
|
18
|
+
*
|
|
19
|
+
* Whether the session can render the avatar is otherwise the driver's call (its endpoint profile); this only decides
|
|
20
|
+
* which one to ask for. Once the driver has minted the session, {@link ResolveRealtimeAvatarStatus} merges the two into
|
|
21
|
+
* the status the call gets, so a call that shows no avatar can say why. A server-side session gets its status from
|
|
22
|
+
* {@link ResolveBridgedAvatarStatus}, so a meeting can say why too, including when the prep asked its driver for none
|
|
23
|
+
* and when its driver renders no avatar and ignored the request.
|
|
24
|
+
*
|
|
25
|
+
* @module @memberjunction/ai-agents
|
|
26
|
+
*/
|
|
27
|
+
import { IndexByUUID, UUIDsEqual } from '@memberjunction/global';
|
|
28
|
+
/**
|
|
29
|
+
* Why nobody would see an avatar in a session, whatever its model renders, or `undefined` when someone could. A phone
|
|
30
|
+
* call says `phone` whatever app relays it.
|
|
31
|
+
*
|
|
32
|
+
* @param viewers What the session says about who is on the other end.
|
|
33
|
+
*/
|
|
34
|
+
export function ResolveAvatarUnseenReason(viewers) {
|
|
35
|
+
if (viewers.PhoneCall === true) {
|
|
36
|
+
return 'phone';
|
|
37
|
+
}
|
|
38
|
+
return viewers.ShowsAgentVideo === false ? 'host' : undefined;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Whether a session could show an avatar at all: a browser session whose app may show agent video, or a server-side
|
|
42
|
+
* one whose host publishes the avatar into a room. A phone call or an app without agent video
|
|
43
|
+
* ({@link ResolveAvatarUnseenReason}), or a server-side session whose host can't publish video, can't.
|
|
44
|
+
*
|
|
45
|
+
* @param session What the session says about its viewers and where it runs.
|
|
46
|
+
*/
|
|
47
|
+
export function RealtimeSessionCanShowAvatar(session) {
|
|
48
|
+
if (ResolveAvatarUnseenReason(session)) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
return session.ServerSide !== true || session.AvatarDelivery === 'room';
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A resolution without its avatar request when nobody in the session would see the avatar
|
|
55
|
+
* ({@link ResolveAvatarUnseenReason}), so the driver is never asked to render video that nobody sees. The reason replaces
|
|
56
|
+
* any other, since no model or face could change it; the persona's voice stays. A resolution that asked for nothing
|
|
57
|
+
* (the video setting is off) stays as it is, so the call gets no notice.
|
|
58
|
+
*
|
|
59
|
+
* @param resolution The session's avatar resolution.
|
|
60
|
+
* @param viewers What the session says about who is on the other end.
|
|
61
|
+
*/
|
|
62
|
+
export function WithoutUnseenAvatar(resolution, viewers) {
|
|
63
|
+
const unseen = ResolveAvatarUnseenReason(viewers);
|
|
64
|
+
if (!unseen || (!resolution.Avatar && !resolution.Reason)) {
|
|
65
|
+
return resolution;
|
|
66
|
+
}
|
|
67
|
+
return resolution.Voice ? { Voice: resolution.Voice, Reason: unseen } : { Reason: unseen };
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The avatar status a server-side (bridged) session reports, which its host shows (the LiveKit room puts it on the
|
|
71
|
+
* agent's bot as `mj.agentAvatar`). A status the driver reported about the avatar it was asked for stands: the driver
|
|
72
|
+
* decided. A session whose prep asked for none because the video setting is off keeps the driver's status (none).
|
|
73
|
+
* Otherwise the driver had nothing to report, because the prep asked it for no avatar for a reason, or because it renders
|
|
74
|
+
* no avatar and ignored the request, so the status says why, asked for and not granted:
|
|
75
|
+
* 1. `phone` (or `host`): nobody would see the avatar, whatever renders it; or `video-off`: the agent's video setting
|
|
76
|
+
* dropped the call's pick;
|
|
77
|
+
* 2. `bridged` when the host publishes no avatar into a room, which is what a driver asked there says (the LiveKit room
|
|
78
|
+
* then names its own reason, such as `decoder-missing`);
|
|
79
|
+
* 3. `endpoint` when the model shows no avatar, as a browser call says ({@link ResolveRealtimeAvatarStatus});
|
|
80
|
+
* 4. else the prep's reason: `endpoint` (the model's Video/Output row), `unknown-avatar` or `no-binding`. A driver that
|
|
81
|
+
* was asked for the avatar on a model that shows avatars and reported nothing gives no reason, so there is no status.
|
|
82
|
+
*
|
|
83
|
+
* @param input The resolution, whether the host publishes the avatar, the model's capability and the driver's status.
|
|
84
|
+
* @returns The status for the session; `undefined` when the session asked for no avatar, or its driver reported nothing
|
|
85
|
+
* about one on a model that shows avatars.
|
|
86
|
+
*/
|
|
87
|
+
export function ResolveBridgedAvatarStatus(input) {
|
|
88
|
+
const prepReason = input.Resolution?.Reason;
|
|
89
|
+
const unreported = input.Resolution?.Avatar !== undefined && !input.DriverStatus;
|
|
90
|
+
if (!prepReason && !unreported) {
|
|
91
|
+
return input.DriverStatus;
|
|
92
|
+
}
|
|
93
|
+
const reason = bridgedAudioOnlyReason(prepReason, input);
|
|
94
|
+
return reason ? { Requested: true, Granted: false, Reason: reason } : undefined;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Why a bridged session whose driver had nothing to report is audio only, in {@link ResolveBridgedAvatarStatus}'s order.
|
|
98
|
+
* `prepReason` is why the prep asked the driver for no avatar; it is absent when the prep asked for one and the driver
|
|
99
|
+
* reported nothing, which names no reason (`undefined`) on a model that shows avatars.
|
|
100
|
+
*/
|
|
101
|
+
function bridgedAudioOnlyReason(prepReason, input) {
|
|
102
|
+
if (prepReason && standsWhateverModel(prepReason)) {
|
|
103
|
+
return prepReason;
|
|
104
|
+
}
|
|
105
|
+
if (!input.RoomDelivery) {
|
|
106
|
+
return 'bridged';
|
|
107
|
+
}
|
|
108
|
+
return input.ModelShowsAvatar() ? prepReason : 'endpoint';
|
|
109
|
+
}
|
|
110
|
+
/** Whether a resolution's reason says nobody in the session would see the avatar. */
|
|
111
|
+
function isUnseenReason(reason) {
|
|
112
|
+
return reason === 'phone' || reason === 'host';
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Whether a resolution's reason stands whatever model or host serves the session: nobody would see the avatar, or the
|
|
116
|
+
* agent's video setting dropped the call's pick (`video-off`).
|
|
117
|
+
*/
|
|
118
|
+
function standsWhateverModel(reason) {
|
|
119
|
+
return isUnseenReason(reason) || reason === 'video-off';
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Resolves the avatar a session asks for (see the file header for the order).
|
|
123
|
+
*
|
|
124
|
+
* @param input The session's configuration, agents, model and vendor.
|
|
125
|
+
* @param personas The persona lookups (`AIEngine.Instance`).
|
|
126
|
+
*/
|
|
127
|
+
export function ResolveRealtimeAvatar(input, personas) {
|
|
128
|
+
const video = input.EffectiveConfig?.realtime?.video;
|
|
129
|
+
if (video?.enabled !== true) {
|
|
130
|
+
return input.AvatarPicked ? { Reason: 'video-off' } : {};
|
|
131
|
+
}
|
|
132
|
+
if (input.VideoOutputRow === 'unsupported') {
|
|
133
|
+
return { Reason: 'endpoint' };
|
|
134
|
+
}
|
|
135
|
+
const vendorId = input.VendorID ?? undefined;
|
|
136
|
+
const faces = personas.GetModelPersonas(input.ModelID, 'Video', vendorId);
|
|
137
|
+
const requested = video.avatarId?.trim();
|
|
138
|
+
if (requested) {
|
|
139
|
+
const face = faces.find((f) => f.PersonaVendor.APIName.trim().toLowerCase() === requested.toLowerCase());
|
|
140
|
+
return face ? withVoice(face, 'override', input, personas) : { Reason: 'unknown-avatar' };
|
|
141
|
+
}
|
|
142
|
+
for (const agentId of [input.TargetAgentID, input.CoAgentID]) {
|
|
143
|
+
const face = agentId ? firstFaceOf(agentId, faces, personas) : undefined;
|
|
144
|
+
if (face) {
|
|
145
|
+
return withVoice(face, 'persona', input, personas);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return { Reason: 'no-binding' };
|
|
149
|
+
}
|
|
150
|
+
/** The agent's first persona (the default first, then by sequence) that has a face. */
|
|
151
|
+
function firstFaceOf(agentId, faces, personas) {
|
|
152
|
+
const agentPersonas = personas.GetAgentPersonas(agentId);
|
|
153
|
+
const ordered = [...agentPersonas.filter((p) => p.AgentPersona.IsDefault), ...agentPersonas.filter((p) => !p.AgentPersona.IsDefault)];
|
|
154
|
+
// First face per persona wins, as faces.find() would.
|
|
155
|
+
const facesByPersona = IndexByUUID(faces, (f) => f.Persona.ID);
|
|
156
|
+
for (const agentPersona of ordered) {
|
|
157
|
+
const face = facesByPersona.Get(agentPersona.Persona.ID);
|
|
158
|
+
if (face) {
|
|
159
|
+
return face;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* The status a call gets about the avatar its agent asked for. Nothing when the agent asked for none (its video
|
|
166
|
+
* setting is off, and the call picked none). Otherwise audio only when nobody in the session would see it
|
|
167
|
+
* ({@link RealtimeAvatarUnseenReason}) or the agent's video setting dropped the call's pick (`video-off`), whatever the
|
|
168
|
+
* model renders; then `endpoint` when the model shows no avatar (its Video/Output row turns video off, or it
|
|
169
|
+
* renders none on its endpoint), whatever driver serves it; then the resolution's reason (`unknown-avatar`,
|
|
170
|
+
* `no-binding`); else the driver's own decision (granted, or `custom-disabled` and the like).
|
|
171
|
+
*
|
|
172
|
+
* @param input The resolution, the model's capability and the driver's decision.
|
|
173
|
+
* @returns The status for the call, or `undefined` when the session asked for no avatar or the driver reported none.
|
|
174
|
+
*/
|
|
175
|
+
export function ResolveRealtimeAvatarStatus(input) {
|
|
176
|
+
const { Avatar: avatar, Reason: reason } = input.Resolution;
|
|
177
|
+
if (!avatar && !reason) {
|
|
178
|
+
return undefined;
|
|
179
|
+
}
|
|
180
|
+
if (reason && standsWhateverModel(reason)) {
|
|
181
|
+
return { Requested: true, Granted: false, Reason: reason };
|
|
182
|
+
}
|
|
183
|
+
if (!input.ModelSupportsAvatarOutput) {
|
|
184
|
+
return { Requested: true, Granted: false, Reason: 'endpoint' };
|
|
185
|
+
}
|
|
186
|
+
if (reason) {
|
|
187
|
+
return { Requested: true, Granted: false, Reason: reason };
|
|
188
|
+
}
|
|
189
|
+
return input.DriverStatus;
|
|
190
|
+
}
|
|
191
|
+
/** The avatar request for a face, and the same persona's voice on the vendor. */
|
|
192
|
+
function withVoice(face, source, input, personas) {
|
|
193
|
+
const settings = face.PersonaVendor.VendorSettingsObject?.Avatar;
|
|
194
|
+
const avatar = {
|
|
195
|
+
AvatarID: face.PersonaVendor.APIName.trim(),
|
|
196
|
+
PersonaName: face.Persona.Name,
|
|
197
|
+
Source: source,
|
|
198
|
+
...(settings?.Kind ? { Kind: settings.Kind } : {}),
|
|
199
|
+
...(settings?.ReferenceImageFileID ? { ReferenceImageFileID: settings.ReferenceImageFileID } : {}),
|
|
200
|
+
...(settings?.Resolution ? { Resolution: settings.Resolution } : {}),
|
|
201
|
+
...(settings?.Background ? { Background: settings.Background } : {}),
|
|
202
|
+
};
|
|
203
|
+
const voice = personas
|
|
204
|
+
.GetModelPersonas(input.ModelID, 'Audio', input.VendorID ?? undefined)
|
|
205
|
+
.find((p) => UUIDsEqual(p.Persona.ID, face.Persona.ID))?.PersonaVendor.APIName;
|
|
206
|
+
return voice ? { Avatar: avatar, Voice: voice } : { Avatar: avatar };
|
|
207
|
+
}
|
|
208
|
+
//# sourceMappingURL=realtime-avatar-resolution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtime-avatar-resolution.js","sourceRoot":"","sources":["../../src/realtime/realtime-avatar-resolution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAwEjE;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAA8B;IACpE,IAAI,OAAO,CAAC,SAAS,KAAK,IAAI,EAAE,CAAC;QAC7B,OAAO,OAAO,CAAC;IACnB,CAAC;IACD,OAAO,OAAO,CAAC,eAAe,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AAClE,CAAC;AAUD;;;;;;GAMG;AACH,MAAM,UAAU,4BAA4B,CAAC,OAAmC;IAC5E,IAAI,yBAAyB,CAAC,OAAO,CAAC,EAAE,CAAC;QACrC,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,OAAO,OAAO,CAAC,UAAU,KAAK,IAAI,IAAI,OAAO,CAAC,cAAc,KAAK,MAAM,CAAC;AAC5E,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAAoC,EAAE,OAA8B;IACpG,MAAM,MAAM,GAAG,yBAAyB,CAAC,OAAO,CAAC,CAAC;IAClD,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QACxD,OAAO,UAAU,CAAC;IACtB,CAAC;IACD,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC/F,CAAC;AAqBD;;;;;;;;;;;;;;;;;G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AAQ,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACvE,CAAC;IACF,MAAM,KAAK,GAAG,QAAQ;SACjB,gBAAgB,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,QAAQ,IAAI,SAAS,CAAC;SACrE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC;IACnF,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AACzE,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The **server half of channel scoping** for client-direct realtime sessions — pure
|
|
3
|
+
* functions, no I/O, so the whole decision is unit-testable and the transport layer
|
|
4
|
+
* (`RealtimeClientSessionResolver`) stays a thin shell.
|
|
5
|
+
*
|
|
6
|
+
* In the client-direct topology the browser holds the channel plugins and the server holds the
|
|
7
|
+
* configuration cascade and the registry. At mint the browser reports its **candidates**
|
|
8
|
+
* ({@link RealtimeChannelCandidate} — facts about code it owns); this module decides, from the
|
|
9
|
+
* server's own state, which of them are **in the session**, and what the model is told natively:
|
|
10
|
+
*
|
|
11
|
+
* 1. **Registry state is the server's, never the client's.** A candidate is matched to its
|
|
12
|
+
* `MJ: AI Agent Channels` row by name; `IsActive = false` is the master kill switch.
|
|
13
|
+
* 2. **Scoping** is `ResolveRealtimeChannelScope` (`@memberjunction/ai-core-plus`) — the SAME pure
|
|
14
|
+
* function the browser runs locally when no server policy comes back — fed the cascade's folded
|
|
15
|
+
* `channels` section (agent layers + the app's `AgentSettings.Realtime.Channels`).
|
|
16
|
+
* 3. **Exposure** (how much of each channel the model may perceive: nothing, state, or pixels) is the
|
|
17
|
+
* channel's ceiling lowered by the agent's per-channel `maxExposure` and by the agent's
|
|
18
|
+
* `requireZeroDataRetentionFor` when the session model does not declare zero data retention. It is
|
|
19
|
+
* decided HERE, on the server, and rides in the policy; the browser can only lower it further with
|
|
20
|
+
* the user's own choice.
|
|
21
|
+
* 4. **Native tools** are re-derived from the decision: the tools the client declared are narrowed to
|
|
22
|
+
* those of in-scope channels that declare natively, and the in-scope channels' tools are added by
|
|
23
|
+
* name even if the client did not list them (an `'opt-in'` channel the agent included). Tools
|
|
24
|
+
* that do not belong to any candidate (the host's own) pass through untouched.
|
|
25
|
+
*
|
|
26
|
+
* Nothing here grants capability: candidate tools are CLIENT-EXECUTED declarations of the same kind
|
|
27
|
+
* `clientToolsJson` has always carried, and they are subject to the same shape validation and caps.
|
|
28
|
+
*
|
|
29
|
+
* @module @memberjunction/ai-agents
|
|
30
|
+
*/
|
|
31
|
+
import type { RealtimeToolDefinition } from '@memberjunction/ai';
|
|
32
|
+
import { type RealtimeChannelCandidate, type RealtimeChannelRegistryState, type RealtimeChannelsConfig, type RealtimeSessionClientPolicy, type RealtimeSessionClientTools } from '@memberjunction/ai-core-plus';
|
|
33
|
+
/** The slice of an `MJ: AI Agent Channels` row the scope decision needs. */
|
|
34
|
+
export interface RealtimeChannelRegistryRow {
|
|
35
|
+
/** The channel's registry name — matched to a candidate's key, case-insensitively. */
|
|
36
|
+
Name: string;
|
|
37
|
+
/** `false` is the master kill switch. */
|
|
38
|
+
IsActive: boolean;
|
|
39
|
+
}
|
|
40
|
+
/** Input to {@link BuildSessionChannelPolicy}. */
|
|
41
|
+
export interface SessionChannelPolicyInput {
|
|
42
|
+
/** The channels the browser reported (already validated and capped). */
|
|
43
|
+
Candidates: ReadonlyArray<RealtimeChannelCandidate>;
|
|
44
|
+
/** The cascade's folded `channels` section — agent layers plus the app layer. */
|
|
45
|
+
ChannelsConfig?: RealtimeChannelsConfig | null;
|
|
46
|
+
/** The registry, as the server reads it. */
|
|
47
|
+
Registry: ReadonlyArray<RealtimeChannelRegistryRow>;
|
|
48
|
+
/** The client tools as the browser declared them at mint, if any. */
|
|
49
|
+
ClientTools?: ReadonlyArray<RealtimeToolDefinition> | null;
|
|
50
|
+
/** The app/static client-tool tiers to hand back to the browser, when resolved. */
|
|
51
|
+
ClientToolTiers?: RealtimeSessionClientTools;
|
|
52
|
+
/**
|
|
53
|
+
* Whether the session model's configuration declares `Privacy.ZeroDataRetention: true`. Feeds the
|
|
54
|
+
* agent's `requireZeroDataRetentionFor` exposure downgrade; leave unset (treated as `false`) when
|
|
55
|
+
* the model could not be resolved, so the downgrade fails closed.
|
|
56
|
+
*/
|
|
57
|
+
ModelHasZeroDataRetention?: boolean;
|
|
58
|
+
}
|
|
59
|
+
/** The outcome of {@link BuildSessionChannelPolicy}. */
|
|
60
|
+
export interface SessionChannelPolicyOutcome {
|
|
61
|
+
/** The policy to return to the browser at mint. */
|
|
62
|
+
Policy: RealtimeSessionClientPolicy;
|
|
63
|
+
/** The native tools to declare to the model: the client's, narrowed and completed per the scope. `undefined` when there are none. */
|
|
64
|
+
ClientTools: RealtimeToolDefinition[] | undefined;
|
|
65
|
+
}
|
|
66
|
+
/** The registry state a candidate resolves to, from the server's own registry. */
|
|
67
|
+
export declare function ResolveCandidateRegistryState(candidateKey: string, registry: ReadonlyArray<RealtimeChannelRegistryRow>): RealtimeChannelRegistryState;
|
|
68
|
+
/**
|
|
69
|
+
* Decides which candidate channels are in the session and which native tools the model gets.
|
|
70
|
+
*
|
|
71
|
+
* @param input The candidates, the cascade's channel config, the registry, and the client's declared tools.
|
|
72
|
+
*/
|
|
73
|
+
export declare function BuildSessionChannelPolicy(input: SessionChannelPolicyInput): SessionChannelPolicyOutcome;
|
|
74
|
+
/**
|
|
75
|
+
* The channel keys a policy puts in the session — what the server persists on the session so a later
|
|
76
|
+
* server-side call can check it names a channel that is actually in scope.
|
|
77
|
+
*/
|
|
78
|
+
export declare function InSessionChannelKeys(policy: RealtimeSessionClientPolicy): string[];
|
|
79
|
+
/** The keys of the channels a policy excluded — what the server prunes its own channel plugins by. */
|
|
80
|
+
export declare function ExcludedChannelKeys(policy: RealtimeSessionClientPolicy): string[];
|
|
81
|
+
//# sourceMappingURL=realtime-channel-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtime-channel-policy.d.ts","sourceRoot":"","sources":["../../src/realtime/realtime-channel-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAIH,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,EACjC,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAClC,MAAM,8BAA8B,CAAC;AAEtC,4EAA4E;AAC5E,MAAM,WAAW,0BAA0B;IACvC,sFAAsF;IACtF,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED,kDAAkD;AAClD,MAAM,WAAW,yBAAyB;IACtC,wEAAwE;IACxE,UAAU,EAAE,aAAa,CAAC,wBAAwB,CAAC,CAAC;IACpD,iFAAiF;IACjF,cAAc,CAAC,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAC/C,4CAA4C;IAC5C,QAAQ,EAAE,aAAa,CAAC,0BAA0B,CAAC,CAAC;IACpD,qEAAqE;IACrE,WAAW,CAAC,EAAE,aAAa,CAAC,sBAAsB,CAAC,GAAG,IAAI,CAAC;IAC3D,mFAAmF;IACnF,eAAe,CAAC,EAAE,0BAA0B,CAAC;IAC7C;;;;OAIG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACvC;AAED,wDAAwD;AACxD,MAAM,WAAW,2BAA2B;IACxC,mDAAmD;IACnD,MAAM,EAAE,2BAA2B,CAAC;IACpC,qIAAqI;IACrI,WAAW,EAAE,sBAAsB,EAAE,GAAG,SAAS,CAAC;CACrD;AAED,kFAAkF;AAClF,wBAAgB,6BAA6B,CACzC,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,aAAa,CAAC,0BAA0B,CAAC,GACpD,4BAA4B,CAO9B;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,yBAAyB,GAAG,2BAA2B,CAsBvG;AAmBD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,2BAA2B,GAAG,MAAM,EAAE,CAElF;AAED,sGAAsG;AACtG,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,2BAA2B,GAAG,MAAM,EAAE,CAEjF"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The **server half of channel scoping** for client-direct realtime sessions — pure
|
|
3
|
+
* functions, no I/O, so the whole decision is unit-testable and the transport layer
|
|
4
|
+
* (`RealtimeClientSessionResolver`) stays a thin shell.
|
|
5
|
+
*
|
|
6
|
+
* In the client-direct topology the browser holds the channel plugins and the server holds the
|
|
7
|
+
* configuration cascade and the registry. At mint the browser reports its **candidates**
|
|
8
|
+
* ({@link RealtimeChannelCandidate} — facts about code it owns); this module decides, from the
|
|
9
|
+
* server's own state, which of them are **in the session**, and what the model is told natively:
|
|
10
|
+
*
|
|
11
|
+
* 1. **Registry state is the server's, never the client's.** A candidate is matched to its
|
|
12
|
+
* `MJ: AI Agent Channels` row by name; `IsActive = false` is the master kill switch.
|
|
13
|
+
* 2. **Scoping** is `ResolveRealtimeChannelScope` (`@memberjunction/ai-core-plus`) — the SAME pure
|
|
14
|
+
* function the browser runs locally when no server policy comes back — fed the cascade's folded
|
|
15
|
+
* `channels` section (agent layers + the app's `AgentSettings.Realtime.Channels`).
|
|
16
|
+
* 3. **Exposure** (how much of each channel the model may perceive: nothing, state, or pixels) is the
|
|
17
|
+
* channel's ceiling lowered by the agent's per-channel `maxExposure` and by the agent's
|
|
18
|
+
* `requireZeroDataRetentionFor` when the session model does not declare zero data retention. It is
|
|
19
|
+
* decided HERE, on the server, and rides in the policy; the browser can only lower it further with
|
|
20
|
+
* the user's own choice.
|
|
21
|
+
* 4. **Native tools** are re-derived from the decision: the tools the client declared are narrowed to
|
|
22
|
+
* those of in-scope channels that declare natively, and the in-scope channels' tools are added by
|
|
23
|
+
* name even if the client did not list them (an `'opt-in'` channel the agent included). Tools
|
|
24
|
+
* that do not belong to any candidate (the host's own) pass through untouched.
|
|
25
|
+
*
|
|
26
|
+
* Nothing here grants capability: candidate tools are CLIENT-EXECUTED declarations of the same kind
|
|
27
|
+
* `clientToolsJson` has always carried, and they are subject to the same shape validation and caps.
|
|
28
|
+
*
|
|
29
|
+
* @module @memberjunction/ai-agents
|
|
30
|
+
*/
|
|
31
|
+
import { NormalizeChannelKey, ResolveRealtimeChannelScope, SelectNativeChannelTools, } from '@memberjunction/ai-core-plus';
|
|
32
|
+
/** The registry state a candidate resolves to, from the server's own registry. */
|
|
33
|
+
export function ResolveCandidateRegistryState(candidateKey, registry) {
|
|
34
|
+
const id = NormalizeChannelKey(candidateKey);
|
|
35
|
+
const row = registry.find((r) => NormalizeChannelKey(r.Name ?? '') === id);
|
|
36
|
+
if (!row) {
|
|
37
|
+
return 'none';
|
|
38
|
+
}
|
|
39
|
+
return row.IsActive ? 'active' : 'inactive';
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Decides which candidate channels are in the session and which native tools the model gets.
|
|
43
|
+
*
|
|
44
|
+
* @param input The candidates, the cascade's channel config, the registry, and the client's declared tools.
|
|
45
|
+
*/
|
|
46
|
+
export function BuildSessionChannelPolicy(input) {
|
|
47
|
+
const scope = ResolveRealtimeChannelScope({
|
|
48
|
+
Candidates: input.Candidates.map((candidate) => ({
|
|
49
|
+
...candidate,
|
|
50
|
+
Registry: ResolveCandidateRegistryState(candidate.Key, input.Registry),
|
|
51
|
+
})),
|
|
52
|
+
Config: input.ChannelsConfig ?? null,
|
|
53
|
+
ModelHasZeroDataRetention: input.ModelHasZeroDataRetention === true,
|
|
54
|
+
});
|
|
55
|
+
const toolsByKey = new Map(input.Candidates.map((c) => [c.Key, c.Tools]));
|
|
56
|
+
const inScopeNative = SelectNativeChannelTools(scope.Channels, toolsByKey);
|
|
57
|
+
const clientTools = reconcileClientTools(input.ClientTools ?? [], input.Candidates, inScopeNative);
|
|
58
|
+
const policy = {
|
|
59
|
+
Version: 1,
|
|
60
|
+
Channels: scope.Channels,
|
|
61
|
+
ExcludedChannels: scope.Excluded,
|
|
62
|
+
};
|
|
63
|
+
if (input.ClientToolTiers && (input.ClientToolTiers.App?.length || input.ClientToolTiers.Static?.length)) {
|
|
64
|
+
policy.ClientTools = input.ClientToolTiers;
|
|
65
|
+
}
|
|
66
|
+
return { Policy: policy, ClientTools: clientTools.length > 0 ? clientTools : undefined };
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Narrows the client's declared tools to the scope's decision: a tool that belongs to a candidate
|
|
70
|
+
* survives only if its channel's native tools were selected; a tool no candidate owns passes through;
|
|
71
|
+
* and selected channel tools the client did not declare are appended (by name — never duplicated).
|
|
72
|
+
*/
|
|
73
|
+
function reconcileClientTools(declared, candidates, inScopeNative) {
|
|
74
|
+
const candidateOwned = new Set(candidates.flatMap((c) => c.Tools.map((t) => t.Name)));
|
|
75
|
+
const selected = new Set(inScopeNative.map((t) => t.Name));
|
|
76
|
+
const kept = declared.filter((tool) => !candidateOwned.has(tool.Name) || selected.has(tool.Name));
|
|
77
|
+
const present = new Set(kept.map((t) => t.Name));
|
|
78
|
+
return [...kept, ...inScopeNative.filter((tool) => !present.has(tool.Name))];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The channel keys a policy puts in the session — what the server persists on the session so a later
|
|
82
|
+
* server-side call can check it names a channel that is actually in scope.
|
|
83
|
+
*/
|
|
84
|
+
export function InSessionChannelKeys(policy) {
|
|
85
|
+
return policy.Channels.map((c) => c.Key);
|
|
86
|
+
}
|
|
87
|
+
/** The keys of the channels a policy excluded — what the server prunes its own channel plugins by. */
|
|
88
|
+
export function ExcludedChannelKeys(policy) {
|
|
89
|
+
return (policy.ExcludedChannels ?? []).map((e) => e.Key);
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=realtime-channel-policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtime-channel-policy.js","sourceRoot":"","sources":["../../src/realtime/realtime-channel-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAGH,OAAO,EACH,mBAAmB,EACnB,2BAA2B,EAC3B,wBAAwB,GAM3B,MAAM,8BAA8B,CAAC;AAsCtC,kFAAkF;AAClF,MAAM,UAAU,6BAA6B,CACzC,YAAoB,EACpB,QAAmD;IAEnD,MAAM,EAAE,GAAG,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAC7C,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;IAC3E,IAAI,CAAC,GAAG,EAAE,CAAC;QACP,OAAO,MAAM,CAAC;IAClB,CAAC;IACD,OAAO,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC;AAChD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAAgC;IACtE,MAAM,KAAK,GAAG,2BAA2B,CAAC;QACtC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;YAC7C,GAAG,SAAS;YACZ,QAAQ,EAAE,6BAA6B,CAAC,SAAS,CAAC,GAAG,EAAE,KAAK,CAAC,QAAQ,CAAC;SACzE,CAAC,CAAC;QACH,MAAM,EAAE,KAAK,CAAC,cAA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,CAAC,CAAC,CAAC,CAAC;IACtF,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3D,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAClG,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACjD,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACjF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAmC;IACpE,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAC7C,CAAC;AAED,sGAAsG;AACtG,MAAM,UAAU,mBAAmB,CAAC,MAAmC;IACnE,OAAO,CAAC,MAAM,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -114,6 +114,20 @@ export declare class RealtimeChannelServerHost extends BaseSingleton<RealtimeCha
|
|
|
114
114
|
* instances is ignored (logged) rather than double-initializing.
|
|
115
115
|
*/
|
|
116
116
|
OnSessionStarted(ctx: RealtimeChannelServerContext, contextUser: UserInfo, provider: IMetadataProvider): Promise<void>;
|
|
117
|
+
/**
|
|
118
|
+
* Drops the server plugins of channels the session's resolved scope LEFT OUT.
|
|
119
|
+
*
|
|
120
|
+
* Server plugins start when the session row is created — before the browser's channel candidates
|
|
121
|
+
* have been scoped at mint — so a channel an agent or app excluded (or whose registry row is the
|
|
122
|
+
* kill switch) would otherwise keep running its server half. Only the named channels are touched:
|
|
123
|
+
* a server-only channel the browser never reported as a candidate has no scope decision and is
|
|
124
|
+
* left alone. Each dropped plugin is disposed (failures logged); an unknown session is a no-op.
|
|
125
|
+
*
|
|
126
|
+
* @param agentSessionID The session whose scope was resolved.
|
|
127
|
+
* @param channelNames The excluded channels' names (case/whitespace-insensitive).
|
|
128
|
+
* @returns The names of the plugins that were dropped (for logging and tests).
|
|
129
|
+
*/
|
|
130
|
+
PruneSessionChannels(agentSessionID: string, channelNames: ReadonlyArray<string>): string[];
|
|
117
131
|
/**
|
|
118
132
|
* Channel-state-save entry point, invoked PRE-persistence. Routes the payload to the session's
|
|
119
133
|
* matching plugin and returns the string to persist:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"realtime-channel-server-host.d.ts","sourceRoot":"","sources":["../../src/realtime/realtime-channel-server-host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EACH,yBAAyB,EACzB,4BAA4B,EAC5B,0BAA0B,EAC1B,sBAAsB,EACtB,uBAAuB,EAC1B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAY,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAuB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"realtime-channel-server-host.d.ts","sourceRoot":"","sources":["../../src/realtime/realtime-channel-server-host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EACH,yBAAyB,EACzB,4BAA4B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G;;;;;;;;OAQG;IACU,kBAAkB,CAAC,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAmBhH;;;;;;;OAOG;IACU,eAAe,CAAC,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,0BAA0B,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBnH,6FAA6F;IAC7F,OAAO,CAAC,gBAAgB;IAUxB,8FAA8F;IAC9F,OAAO,CAAC,cAAc;IAetB;;;;;;OAMG;YACW,uBAAuB;IAoBrC,uFAAuF;YACzE,yBAAyB;IAgCvC;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB;IA6B5B,qEAAqE;IACrE,OAAO,CAAC,WAAW;IAQnB,kFAAkF;IAClF,OAAO,CAAC,UAAU;IAIlB,4CAA4C;IAC5C,OAAO,CAAC,UAAU;IAIlB,kEAAkE;IAClE,OAAO,CAAC,OAAO;CAGlB"}
|
|
@@ -30,6 +30,7 @@ import { BaseSingleton, MJGlobal } from '@memberjunction/global';
|
|
|
30
30
|
import { LogError, LogStatus } from '@memberjunction/core';
|
|
31
31
|
import { AIEngineBase } from '@memberjunction/ai-engine-base';
|
|
32
32
|
import { IsRealtimeChannelServerDataAware } from './realtime-channel-server-data-context.js';
|
|
33
|
+
import { ClientOnlyChannelServer } from './client-only-channel-server.js';
|
|
33
34
|
/** Entity name — kept in sync with the session machinery's `MJ:`-prefix convention. */
|
|
34
35
|
const CHANNEL_ENTITY = 'MJ: AI Agent Channels';
|
|
35
36
|
/**
|
|
@@ -203,6 +204,36 @@ export class RealtimeChannelServerHost extends BaseSingleton {
|
|
|
203
204
|
LogError(`[RealtimeChannelServerHost] OnSessionStarted failed for session ${ctx.AgentSessionID}: ${this.message(error)}`);
|
|
204
205
|
}
|
|
205
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* Drops the server plugins of channels the session's resolved scope LEFT OUT.
|
|
209
|
+
*
|
|
210
|
+
* Server plugins start when the session row is created — before the browser's channel candidates
|
|
211
|
+
* have been scoped at mint — so a channel an agent or app excluded (or whose registry row is the
|
|
212
|
+
* kill switch) would otherwise keep running its server half. Only the named channels are touched:
|
|
213
|
+
* a server-only channel the browser never reported as a candidate has no scope decision and is
|
|
214
|
+
* left alone. Each dropped plugin is disposed (failures logged); an unknown session is a no-op.
|
|
215
|
+
*
|
|
216
|
+
* @param agentSessionID The session whose scope was resolved.
|
|
217
|
+
* @param channelNames The excluded channels' names (case/whitespace-insensitive).
|
|
218
|
+
* @returns The names of the plugins that were dropped (for logging and tests).
|
|
219
|
+
*/
|
|
220
|
+
PruneSessionChannels(agentSessionID, channelNames) {
|
|
221
|
+
const entry = this.sessions.get(this.sessionKey(agentSessionID));
|
|
222
|
+
if (!entry) {
|
|
223
|
+
return [];
|
|
224
|
+
}
|
|
225
|
+
const dropped = [];
|
|
226
|
+
for (const name of channelNames) {
|
|
227
|
+
const key = this.channelKey(name);
|
|
228
|
+
const plugin = entry.plugins.get(key);
|
|
229
|
+
if (plugin) {
|
|
230
|
+
entry.plugins.delete(key);
|
|
231
|
+
this.safeDispose(plugin, name);
|
|
232
|
+
dropped.push(name);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return dropped;
|
|
236
|
+
}
|
|
206
237
|
/**
|
|
207
238
|
* Channel-state-save entry point, invoked PRE-persistence. Routes the payload to the session's
|
|
208
239
|
* matching plugin and returns the string to persist:
|
|
@@ -353,6 +384,10 @@ export class RealtimeChannelServerHost extends BaseSingleton {
|
|
|
353
384
|
LogError(`[RealtimeChannelServerHost] Failed to instantiate server plugin for channel '${row.Name}' (key '${key}').`);
|
|
354
385
|
return null;
|
|
355
386
|
}
|
|
387
|
+
if (plugin instanceof ClientOnlyChannelServer) {
|
|
388
|
+
// One registered class serves every client-only channel: it takes its name from the row it was resolved for.
|
|
389
|
+
plugin.BindChannelName(row.Name);
|
|
390
|
+
}
|
|
356
391
|
if (this.channelKey(plugin.ChannelName) !== this.channelKey(row.Name)) {
|
|
357
392
|
LogError(`[RealtimeChannelServerHost] Server plugin '${key}' reports ChannelName '${plugin.ChannelName}' but is ` +
|
|
358
393
|
`registered on channel row '${row.Name}' — routing by the row name; fix the plugin/registry mismatch.`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"realtime-channel-server-host.js","sourceRoot":"","sources":["../../src/realtime/realtime-channel-server-host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EACH,yBAAyB,GAK5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAA+B,QAAQ,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,gCAAgC,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"realtime-channel-server-host.js","sourceRoot":"","sources":["../../src/realtime/realtime-channel-server-host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EACH,yBAAyB,GAK5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAA+B,QAAQ,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,gCAAgC,EAAE,MAAM,wCAAwC,CAAC;AAC1F,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,uFAAuF;AACvF,MAAM,cAAc,GAAG,uBAAuB,CAAC;AAiB/C;;;;;GAKG;AACH,MAAM,yBAAyB,GAAG,MAAM,CAAC;AAEzC;;;;;;;;;;;;;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