@memberjunction/ng-conversations 6.3.0-edge.1 → 6.3.0-edge.2
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 +13 -0
- package/dist/assets/edge-ai.worker.js +3451 -798
- package/dist/lib/components/agent/agent-instance-editor-modal.component.d.ts +186 -0
- package/dist/lib/components/agent/agent-instance-editor-modal.component.d.ts.map +1 -0
- package/dist/lib/components/agent/agent-instance-editor-modal.component.js +2202 -0
- package/dist/lib/components/agent/agent-instance-editor-modal.component.js.map +1 -0
- package/dist/lib/components/artifact/artifact-share-modal.component.d.ts.map +1 -1
- package/dist/lib/components/artifact/artifact-share-modal.component.js +289 -266
- package/dist/lib/components/artifact/artifact-share-modal.component.js.map +1 -1
- package/dist/lib/components/composer/ai-composer.component.d.ts +15 -1
- package/dist/lib/components/composer/ai-composer.component.d.ts.map +1 -1
- package/dist/lib/components/composer/ai-composer.component.js +43 -4
- package/dist/lib/components/composer/ai-composer.component.js.map +1 -1
- package/dist/lib/components/conversation/conversation-agent-picker.component.d.ts +20 -2
- package/dist/lib/components/conversation/conversation-agent-picker.component.d.ts.map +1 -1
- package/dist/lib/components/conversation/conversation-agent-picker.component.js +378 -62
- package/dist/lib/components/conversation/conversation-agent-picker.component.js.map +1 -1
- package/dist/lib/components/conversation/conversation-chat-area.component.d.ts +59 -9
- package/dist/lib/components/conversation/conversation-chat-area.component.d.ts.map +1 -1
- package/dist/lib/components/conversation/conversation-chat-area.component.js +645 -416
- package/dist/lib/components/conversation/conversation-chat-area.component.js.map +1 -1
- package/dist/lib/components/conversation/conversation-list.component.d.ts +5 -1
- package/dist/lib/components/conversation/conversation-list.component.d.ts.map +1 -1
- package/dist/lib/components/conversation/conversation-list.component.js +100 -56
- package/dist/lib/components/conversation/conversation-list.component.js.map +1 -1
- package/dist/lib/components/library/library-workspace.component.d.ts +30 -2
- package/dist/lib/components/library/library-workspace.component.d.ts.map +1 -1
- package/dist/lib/components/library/library-workspace.component.js +1342 -641
- package/dist/lib/components/library/library-workspace.component.js.map +1 -1
- package/dist/lib/components/library/library.models.d.ts +33 -3
- package/dist/lib/components/library/library.models.d.ts.map +1 -1
- package/dist/lib/components/library/library.models.js.map +1 -1
- package/dist/lib/components/message/agent-handoff-card.component.js +1 -1
- package/dist/lib/components/message/agent-handoff-card.component.js.map +1 -1
- package/dist/lib/components/message/message-input.component.d.ts +7 -0
- package/dist/lib/components/message/message-input.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-input.component.js +52 -20
- package/dist/lib/components/message/message-input.component.js.map +1 -1
- package/dist/lib/components/message/message-item.component.d.ts +17 -4
- package/dist/lib/components/message/message-item.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-item.component.js +58 -8
- package/dist/lib/components/message/message-item.component.js.map +1 -1
- package/dist/lib/components/message/message-list.component.d.ts +15 -1
- package/dist/lib/components/message/message-list.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-list.component.js +73 -3
- package/dist/lib/components/message/message-list.component.js.map +1 -1
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-channel.js +30 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-channel.js.map +1 -1
- package/dist/lib/components/realtime/capture/realtime-capture-channel.d.ts +28 -1
- package/dist/lib/components/realtime/capture/realtime-capture-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/capture/realtime-capture-channel.js +53 -1
- package/dist/lib/components/realtime/capture/realtime-capture-channel.js.map +1 -1
- package/dist/lib/components/realtime/channels/client-context-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/channels/client-context-channel.js +23 -7
- package/dist/lib/components/realtime/channels/client-context-channel.js.map +1 -1
- package/dist/lib/components/realtime/media/media-channel.d.ts +32 -11
- package/dist/lib/components/realtime/media/media-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/media/media-channel.js +186 -23
- package/dist/lib/components/realtime/media/media-channel.js.map +1 -1
- package/dist/lib/components/realtime/media/realtime-media-surface.component.d.ts +9 -1
- package/dist/lib/components/realtime/media/realtime-media-surface.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/media/realtime-media-surface.component.js +33 -10
- package/dist/lib/components/realtime/media/realtime-media-surface.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-agent-banner.component.js +2 -2
- package/dist/lib/components/realtime/realtime-agent-picker.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-agent-picker.component.js +3 -3
- package/dist/lib/components/realtime/realtime-agent-picker.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-composer.component.js +2 -2
- package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts +1 -1
- package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-session-overlay.component.js +20 -11
- package/dist/lib/components/realtime/realtime-session-overlay.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-session-state.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-session-state.js +1 -1
- package/dist/lib/components/realtime/realtime-session-state.js.map +1 -1
- package/dist/lib/components/realtime/realtime-session-thread.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-session-thread.component.js +1 -1
- package/dist/lib/components/realtime/realtime-session-thread.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tab-style.d.ts +7 -0
- package/dist/lib/components/realtime/realtime-surface-tab-style.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tab-style.js +19 -0
- package/dist/lib/components/realtime/realtime-surface-tab-style.js.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tabs.model.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tabs.model.js +13 -2
- package/dist/lib/components/realtime/realtime-surface-tabs.model.js.map +1 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.d.ts +3 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.js +9 -0
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.js.map +1 -1
- package/dist/lib/components/share/share-modal.component.d.ts.map +1 -1
- package/dist/lib/components/share/share-modal.component.js +181 -127
- package/dist/lib/components/share/share-modal.component.js.map +1 -1
- package/dist/lib/components/sidebar/conversation-sidebar.component.d.ts +14 -1
- package/dist/lib/components/sidebar/conversation-sidebar.component.d.ts.map +1 -1
- package/dist/lib/components/sidebar/conversation-sidebar.component.js +50 -11
- package/dist/lib/components/sidebar/conversation-sidebar.component.js.map +1 -1
- package/dist/lib/components/sidebar/my-agents-section.component.d.ts +78 -0
- package/dist/lib/components/sidebar/my-agents-section.component.d.ts.map +1 -0
- package/dist/lib/components/sidebar/my-agents-section.component.js +450 -0
- package/dist/lib/components/sidebar/my-agents-section.component.js.map +1 -0
- package/dist/lib/components/task/tasks-full-view.component.d.ts.map +1 -1
- package/dist/lib/components/task/tasks-full-view.component.js +9 -0
- package/dist/lib/components/task/tasks-full-view.component.js.map +1 -1
- package/dist/lib/composer-plugins/base-conversation-mention.provider.d.ts +1 -0
- package/dist/lib/composer-plugins/base-conversation-mention.provider.d.ts.map +1 -1
- package/dist/lib/composer-plugins/base-conversation-mention.provider.js +13 -1
- package/dist/lib/composer-plugins/base-conversation-mention.provider.js.map +1 -1
- package/dist/lib/conversations.module.d.ts +78 -76
- package/dist/lib/conversations.module.d.ts.map +1 -1
- package/dist/lib/conversations.module.js +8 -0
- package/dist/lib/conversations.module.js.map +1 -1
- package/dist/lib/services/conversation-agent.service.d.ts +23 -18
- package/dist/lib/services/conversation-agent.service.d.ts.map +1 -1
- package/dist/lib/services/conversation-agent.service.js +75 -32
- package/dist/lib/services/conversation-agent.service.js.map +1 -1
- package/dist/lib/services/realtime-session.service.d.ts.map +1 -1
- package/dist/lib/services/realtime-session.service.js +2 -1
- package/dist/lib/services/realtime-session.service.js.map +1 -1
- package/dist/lib/utils/agent-handoff-map.js +1 -1
- package/dist/lib/utils/agent-handoff-map.js.map +1 -1
- package/dist/lib/utils/agent-turn-routing.js +1 -1
- package/dist/lib/utils/agent-turn-routing.js.map +1 -1
- package/dist/public-api.d.ts +2 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +2 -0
- package/dist/public-api.js.map +1 -1
- package/package.json +37 -37
|
@@ -4,12 +4,92 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
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
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
+
var RealtimeMediaChannel_1;
|
|
7
8
|
import { RegisterClass } from '@memberjunction/global';
|
|
8
9
|
import { REALTIME_CHANNEL_CONTRACT_VERSION } from '@memberjunction/ai-core-plus';
|
|
9
10
|
import { BaseRealtimeChannelClient, BuildToolBackedVerbs } from '@memberjunction/realtime-runtime';
|
|
10
11
|
import { MEDIA_TOOL_DEFINITIONS, MEDIA_TOOL_NAMES, MEDIA_TOOL_PREFIX } from './media-channel-tools';
|
|
11
12
|
import { IsAllowedExternalMediaUrl, MediaChannelState } from './media-channel-state';
|
|
12
13
|
import { RealtimeMediaSurfaceComponent } from './realtime-media-surface.component';
|
|
14
|
+
const MEDIA_URL_PROBE_TIMEOUT_MS = 5000;
|
|
15
|
+
/** Returns true when running inside a real browser DOM (never Node or jsdom where Image never fires onload/onerror). */
|
|
16
|
+
function isRealBrowserDom() {
|
|
17
|
+
if (typeof window === 'undefined' || typeof Image !== 'function') {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
const ua = typeof window.navigator?.userAgent === 'string' ? window.navigator.userAgent : '';
|
|
21
|
+
return !/jsdom/i.test(ua);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Probes an external media URL via real browser elements (`Image` for images, `<video>`/`<audio>` metadata
|
|
25
|
+
* for AV) so broken 404/403/corrupt image links fail pre-flight without rendering a broken icon and without
|
|
26
|
+
* failing on third-party hosts that disallow CORS `fetch()`.
|
|
27
|
+
*/
|
|
28
|
+
function probeBrowserMediaUrl(url, mediaType) {
|
|
29
|
+
if (mediaType === 'image') {
|
|
30
|
+
return new Promise((resolve) => {
|
|
31
|
+
const img = new Image();
|
|
32
|
+
let settled = false;
|
|
33
|
+
const timer = setTimeout(() => {
|
|
34
|
+
if (!settled) {
|
|
35
|
+
settled = true;
|
|
36
|
+
resolve({ Ok: false, Reason: `Timed out loading image URL after ${MEDIA_URL_PROBE_TIMEOUT_MS}ms.` });
|
|
37
|
+
}
|
|
38
|
+
}, MEDIA_URL_PROBE_TIMEOUT_MS);
|
|
39
|
+
const finish = (result) => {
|
|
40
|
+
if (settled) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
settled = true;
|
|
44
|
+
clearTimeout(timer);
|
|
45
|
+
img.onload = null;
|
|
46
|
+
img.onerror = null;
|
|
47
|
+
resolve(result);
|
|
48
|
+
};
|
|
49
|
+
img.referrerPolicy = 'no-referrer';
|
|
50
|
+
img.onload = () => finish({ Ok: true });
|
|
51
|
+
img.onerror = () => finish({
|
|
52
|
+
Ok: false,
|
|
53
|
+
Reason: 'Image URL failed to load (404/403, network error, or non-image response).',
|
|
54
|
+
});
|
|
55
|
+
img.src = url;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
if (mediaType === 'video' || mediaType === 'audio') {
|
|
59
|
+
if (typeof document === 'undefined') {
|
|
60
|
+
return Promise.resolve({ Ok: true });
|
|
61
|
+
}
|
|
62
|
+
return new Promise((resolve) => {
|
|
63
|
+
const el = document.createElement(mediaType);
|
|
64
|
+
let settled = false;
|
|
65
|
+
const timer = setTimeout(() => {
|
|
66
|
+
if (!settled) {
|
|
67
|
+
settled = true;
|
|
68
|
+
el.removeAttribute('src');
|
|
69
|
+
el.load();
|
|
70
|
+
resolve({ Ok: false, Reason: `Timed out loading ${mediaType} URL after ${MEDIA_URL_PROBE_TIMEOUT_MS}ms.` });
|
|
71
|
+
}
|
|
72
|
+
}, MEDIA_URL_PROBE_TIMEOUT_MS);
|
|
73
|
+
const finish = (result) => {
|
|
74
|
+
if (settled) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
settled = true;
|
|
78
|
+
clearTimeout(timer);
|
|
79
|
+
el.onloadedmetadata = null;
|
|
80
|
+
el.onerror = null;
|
|
81
|
+
el.removeAttribute('src');
|
|
82
|
+
el.load();
|
|
83
|
+
resolve(result);
|
|
84
|
+
};
|
|
85
|
+
el.preload = 'metadata';
|
|
86
|
+
el.onloadedmetadata = () => finish({ Ok: true });
|
|
87
|
+
el.onerror = () => finish({ Ok: false, Reason: `${mediaType} URL failed to load metadata.` });
|
|
88
|
+
el.src = url;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
return Promise.resolve({ Ok: true });
|
|
92
|
+
}
|
|
13
93
|
/** Coerces a parsed arg to a non-empty string, or `undefined` when absent / wrong-typed. */
|
|
14
94
|
function asString(value) {
|
|
15
95
|
return typeof value === 'string' && value.length > 0 ? value : undefined;
|
|
@@ -39,12 +119,17 @@ const VALID_MEDIA_TYPES = ['image', 'video', 'audio', 'pdf', 'web'];
|
|
|
39
119
|
* Modeled directly on `RealtimeWhiteboardChannel`.
|
|
40
120
|
*/
|
|
41
121
|
let RealtimeMediaChannel = class RealtimeMediaChannel extends BaseRealtimeChannelClient {
|
|
122
|
+
static { RealtimeMediaChannel_1 = this; }
|
|
123
|
+
/** Optional hook (used in tests or custom hosts) to check external media URLs before showing them. */
|
|
124
|
+
static UrlHealthChecker = null;
|
|
42
125
|
/** The media state of record — created fresh with the plugin (one per session). */
|
|
43
126
|
State = new MediaChannelState();
|
|
44
127
|
/** The live bound surface, when the channel tab's pane is instantiated. */
|
|
45
128
|
surface = null;
|
|
46
|
-
/** Media-mutation subscription driving the debounced state-of-record save. */
|
|
129
|
+
/** Media-mutation subscription driving the debounced state-of-record save and passive perception updates. */
|
|
47
130
|
stateChangedSub = null;
|
|
131
|
+
pendingChangeAuthor = 'user';
|
|
132
|
+
restoring = false;
|
|
48
133
|
get ChannelName() {
|
|
49
134
|
return 'Media';
|
|
50
135
|
}
|
|
@@ -104,12 +189,47 @@ let RealtimeMediaChannel = class RealtimeMediaChannel extends BaseRealtimeChanne
|
|
|
104
189
|
IconClass: 'fa-solid fa-images',
|
|
105
190
|
};
|
|
106
191
|
}
|
|
107
|
-
/**
|
|
192
|
+
/**
|
|
193
|
+
* Persist the media surface (host-debounced) AND notify passive perception updates on user-driven
|
|
194
|
+
* changes (tab switches, dismissing items) so the realtime agent sees media surface activity.
|
|
195
|
+
*/
|
|
108
196
|
OnInitialize() {
|
|
109
197
|
this.stateChangedSub = this.State.Changed$.subscribe(() => {
|
|
110
198
|
this.Context?.RequestSave(this.State.ToJSON());
|
|
199
|
+
if (!this.restoring) {
|
|
200
|
+
this.RecordChange({
|
|
201
|
+
Author: this.pendingChangeAuthor,
|
|
202
|
+
Perceive: this.pendingChangeAuthor !== 'agent',
|
|
203
|
+
});
|
|
204
|
+
}
|
|
111
205
|
});
|
|
112
206
|
}
|
|
207
|
+
/** Compact state snapshot used by `GetSurfaceSnapshot()`, `[surface]` focus notes, and `ChannelPerceptionCoalescer`. */
|
|
208
|
+
GetState() {
|
|
209
|
+
const activeId = this.State.ActiveItemId;
|
|
210
|
+
return {
|
|
211
|
+
activeItemId: activeId,
|
|
212
|
+
itemCount: this.State.Items.length,
|
|
213
|
+
items: this.State.Items.map((item) => ({
|
|
214
|
+
id: item.Id,
|
|
215
|
+
type: item.Type,
|
|
216
|
+
displayName: item.DisplayName,
|
|
217
|
+
...(item.Url ? { url: item.Url } : {}),
|
|
218
|
+
...(item.FileID ? { fileId: item.FileID } : {}),
|
|
219
|
+
isActive: activeId === item.Id,
|
|
220
|
+
})),
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
/** Tags a synchronous state mutation with `'agent'` authorship so perception knows who changed it. */
|
|
224
|
+
withAgentAuthor(work) {
|
|
225
|
+
this.pendingChangeAuthor = 'agent';
|
|
226
|
+
try {
|
|
227
|
+
return work();
|
|
228
|
+
}
|
|
229
|
+
finally {
|
|
230
|
+
this.pendingChangeAuthor = 'user';
|
|
231
|
+
}
|
|
232
|
+
}
|
|
113
233
|
/**
|
|
114
234
|
* Wires the dynamically-created media surface (before first CD): shared state engine + agent name,
|
|
115
235
|
* plus the live session's MJ provider so FileID-backed items stream securely (mj-storage-media-player
|
|
@@ -120,16 +240,21 @@ let RealtimeMediaChannel = class RealtimeMediaChannel extends BaseRealtimeChanne
|
|
|
120
240
|
instance.State = this.State;
|
|
121
241
|
instance.AgentName = this.Context?.AgentName ?? 'The agent';
|
|
122
242
|
instance.Provider = this.Context?.Provider ?? null;
|
|
243
|
+
instance.OnRenderError = (item, reason) => this.handleSurfaceRenderError(item, reason);
|
|
123
244
|
}
|
|
124
245
|
UnbindSurface() {
|
|
246
|
+
if (this.surface) {
|
|
247
|
+
this.surface.OnRenderError = null;
|
|
248
|
+
}
|
|
125
249
|
this.surface = null;
|
|
126
250
|
}
|
|
251
|
+
handleSurfaceRenderError(item, reason) {
|
|
252
|
+
this.Context?.SendContextNote(`[media] error displaying ${item.Type} "${item.DisplayName}" (id: ${item.Id}, url: ${item.Url ?? item.FileID ?? 'unknown'}): ${reason} — please fix or replace the URL and retry.`);
|
|
253
|
+
}
|
|
127
254
|
/**
|
|
128
|
-
* Executes one `Media_*` tool call LOCALLY: parse args,
|
|
129
|
-
* background context note so the agent stays aware of the
|
|
130
|
-
* string for the model. Never throws
|
|
131
|
-
* payload the model can narrate. Works with or without a bound surface (it mutates the state engine,
|
|
132
|
-
* which the surface observes).
|
|
255
|
+
* Executes one `Media_*` tool call LOCALLY: parse args, validate external URLs when possible,
|
|
256
|
+
* mutate the state engine, push a `[media]` background context note so the agent stays aware of the
|
|
257
|
+
* surface, and return a short JSON result string for the model. Never throws.
|
|
133
258
|
*/
|
|
134
259
|
ApplyAgentTool(toolName, argsJson) {
|
|
135
260
|
let args = {};
|
|
@@ -157,7 +282,10 @@ let RealtimeMediaChannel = class RealtimeMediaChannel extends BaseRealtimeChanne
|
|
|
157
282
|
return this.fail(`Unknown Media tool "${toolName}".`);
|
|
158
283
|
}
|
|
159
284
|
}
|
|
160
|
-
/**
|
|
285
|
+
/**
|
|
286
|
+
* Adds a media item and makes it active. External URLs are health-checked before rendering so broken
|
|
287
|
+
* images/links fail immediately and never render as broken icons.
|
|
288
|
+
*/
|
|
161
289
|
applyShowMedia(args) {
|
|
162
290
|
const mediaType = asString(args['mediaType']);
|
|
163
291
|
const url = asString(args['url']);
|
|
@@ -177,15 +305,44 @@ let RealtimeMediaChannel = class RealtimeMediaChannel extends BaseRealtimeChanne
|
|
|
177
305
|
if (!displayName) {
|
|
178
306
|
return this.fail('Media_ShowMedia requires a "displayName".');
|
|
179
307
|
}
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
308
|
+
const trimmedUrl = url ? url.trim() : undefined;
|
|
309
|
+
const commitShow = () => {
|
|
310
|
+
const item = this.withAgentAuthor(() => this.State.AddItem({
|
|
311
|
+
Type: mediaType,
|
|
312
|
+
Url: trimmedUrl,
|
|
313
|
+
FileID: fileId,
|
|
314
|
+
DisplayName: displayName,
|
|
315
|
+
Caption: asString(args['caption']),
|
|
316
|
+
}));
|
|
317
|
+
this.note(`now showing ${mediaType} "${displayName}"`);
|
|
318
|
+
return JSON.stringify({ success: true, id: item.Id, active: true });
|
|
319
|
+
};
|
|
320
|
+
if (trimmedUrl) {
|
|
321
|
+
const healthResult = this.checkExternalUrlHealth(trimmedUrl, mediaType);
|
|
322
|
+
if (healthResult !== null) {
|
|
323
|
+
if (healthResult instanceof Promise) {
|
|
324
|
+
return healthResult.then((res) => {
|
|
325
|
+
if (!res.Ok) {
|
|
326
|
+
return this.fail(`Media URL "${trimmedUrl}" could not be loaded: ${res.Reason ?? 'unhealthy URL'}. Fix or replace the URL and retry.`);
|
|
327
|
+
}
|
|
328
|
+
return commitShow();
|
|
329
|
+
}, (err) => this.fail(`Media URL "${trimmedUrl}" health check failed: ${err instanceof Error ? err.message : String(err)}. Fix or replace the URL and retry.`));
|
|
330
|
+
}
|
|
331
|
+
if (!healthResult.Ok) {
|
|
332
|
+
return this.fail(`Media URL "${trimmedUrl}" could not be loaded: ${healthResult.Reason ?? 'unhealthy URL'}. Fix or replace the URL and retry.`);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
return commitShow();
|
|
337
|
+
}
|
|
338
|
+
checkExternalUrlHealth(url, mediaType) {
|
|
339
|
+
if (RealtimeMediaChannel_1.UrlHealthChecker) {
|
|
340
|
+
return RealtimeMediaChannel_1.UrlHealthChecker(url, mediaType);
|
|
341
|
+
}
|
|
342
|
+
if (isRealBrowserDom() && (mediaType === 'image' || mediaType === 'video' || mediaType === 'audio')) {
|
|
343
|
+
return probeBrowserMediaUrl(url, mediaType);
|
|
344
|
+
}
|
|
345
|
+
return null;
|
|
189
346
|
}
|
|
190
347
|
/** Closes a media item. */
|
|
191
348
|
applyCloseMedia(args) {
|
|
@@ -193,7 +350,7 @@ let RealtimeMediaChannel = class RealtimeMediaChannel extends BaseRealtimeChanne
|
|
|
193
350
|
if (!id) {
|
|
194
351
|
return this.fail('Media_CloseMedia requires an "id".');
|
|
195
352
|
}
|
|
196
|
-
const removed = this.State.RemoveItem(id);
|
|
353
|
+
const removed = this.withAgentAuthor(() => this.State.RemoveItem(id));
|
|
197
354
|
if (!removed) {
|
|
198
355
|
return this.fail(`No media item with id "${id}".`);
|
|
199
356
|
}
|
|
@@ -206,7 +363,7 @@ let RealtimeMediaChannel = class RealtimeMediaChannel extends BaseRealtimeChanne
|
|
|
206
363
|
if (!id) {
|
|
207
364
|
return this.fail('Media_PlayMedia requires an "id".');
|
|
208
365
|
}
|
|
209
|
-
const ok = this.State.RequestPlay(id);
|
|
366
|
+
const ok = this.withAgentAuthor(() => this.State.RequestPlay(id));
|
|
210
367
|
if (!ok) {
|
|
211
368
|
return this.fail(`No media item with id "${id}".`);
|
|
212
369
|
}
|
|
@@ -227,7 +384,7 @@ let RealtimeMediaChannel = class RealtimeMediaChannel extends BaseRealtimeChanne
|
|
|
227
384
|
return this.fail('Media_Highlight requires numeric fractional x, y, w, h (0..1).');
|
|
228
385
|
}
|
|
229
386
|
const highlight = { X: x, Y: y, W: w, H: h, Label: asString(args['label']) };
|
|
230
|
-
const ok = this.State.Highlight(id, highlight);
|
|
387
|
+
const ok = this.withAgentAuthor(() => this.State.Highlight(id, highlight));
|
|
231
388
|
if (!ok) {
|
|
232
389
|
return this.fail(`No media item with id "${id}".`);
|
|
233
390
|
}
|
|
@@ -236,7 +393,7 @@ let RealtimeMediaChannel = class RealtimeMediaChannel extends BaseRealtimeChanne
|
|
|
236
393
|
}
|
|
237
394
|
/** Clears all media. */
|
|
238
395
|
applyClearAll() {
|
|
239
|
-
this.State.Clear();
|
|
396
|
+
this.withAgentAuthor(() => this.State.Clear());
|
|
240
397
|
this.note('cleared all media');
|
|
241
398
|
return JSON.stringify({ success: true });
|
|
242
399
|
}
|
|
@@ -250,7 +407,13 @@ let RealtimeMediaChannel = class RealtimeMediaChannel extends BaseRealtimeChanne
|
|
|
250
407
|
* `false` and the surface stays empty.
|
|
251
408
|
*/
|
|
252
409
|
RestoreState(stateJson) {
|
|
253
|
-
|
|
410
|
+
this.restoring = true;
|
|
411
|
+
try {
|
|
412
|
+
return this.State.LoadFromJSON(stateJson);
|
|
413
|
+
}
|
|
414
|
+
finally {
|
|
415
|
+
this.restoring = false;
|
|
416
|
+
}
|
|
254
417
|
}
|
|
255
418
|
Dispose() {
|
|
256
419
|
this.stateChangedSub?.unsubscribe();
|
|
@@ -270,7 +433,7 @@ let RealtimeMediaChannel = class RealtimeMediaChannel extends BaseRealtimeChanne
|
|
|
270
433
|
this.Context?.SendContextNote(`[media] ${summary} (background context — do NOT narrate routine changes; mention only if relevant).`);
|
|
271
434
|
}
|
|
272
435
|
};
|
|
273
|
-
RealtimeMediaChannel = __decorate([
|
|
436
|
+
RealtimeMediaChannel = RealtimeMediaChannel_1 = __decorate([
|
|
274
437
|
RegisterClass(BaseRealtimeChannelClient, 'RealtimeMediaChannel')
|
|
275
438
|
], RealtimeMediaChannel);
|
|
276
439
|
export { RealtimeMediaChannel };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media-channel.js","sourceRoot":"","sources":["../../../../../src/lib/components/realtime/media/media-channel.ts"],"names":[],"mappings":";;;;;;AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,iCAAiC,EAAkC,MAAM,8BAA8B,CAAC;AACjH,OAAO,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAEnG,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACpG,OAAO,EAAE,yBAAyB,EAAE,iBAAiB,EAAiC,MAAM,uBAAuB,CAAC;AACpH,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AAKnF,4FAA4F;AAC5F,SAAS,QAAQ,CAAC,KAA+B;IAC/C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3E,CAAC;AAED,yFAAyF;AACzF,SAAS,QAAQ,CAAC,KAA+B;IAC/C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACjF,CAAC;AAED,mFAAmF;AACnF,MAAM,iBAAiB,GAAoB,CAA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,CAAC;IAEe,OAAO;QACrB,IAAI,CAAC,eAAe,EAAE,WAAW,EAAE,CAAC;QACpC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;IAED,sFAAsF;IAC9E,IAAI,CAAC,KAAa;QACxB,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACnD,CAAC;IAED;;;OAGG;IACK,IAAI,CAAC,OAAe;QAC1B,IAAI,CAAC,OAAO,EAAE,eAAe,CAC3B,WAAW,OAAO,mFAAmF,CACtG,CAAC;IACJ,CAAC;CACF,CAAA;AAlQY,oBAAoB;IADhC,aAAa,CAAC,yBAAyB,EAAE,sBAAsB,CAAC;GACpD,oBAAoB,CAkQhC;;AAED;;;;GAIG;AACH,MAAM,UAAU,wBAAwB;IACtC,uEAAuE;AACzE,CAAC","sourcesContent":["import type { Type } from '@angular/core';\nimport { Subscription } from 'rxjs';\nimport { RegisterClass } from '@memberjunction/global';\nimport { RealtimeToolDefinition } from '@memberjunction/ai';\nimport { REALTIME_CHANNEL_CONTRACT_VERSION, type RealtimeChannelDescriptor } from '@memberjunction/ai-core-plus';\nimport { BaseRealtimeChannelClient, BuildToolBackedVerbs } from '@memberjunction/realtime-runtime';\nimport { ChannelOnboardingDetails } from '@memberjunction/realtime-runtime';\nimport { MEDIA_TOOL_DEFINITIONS, MEDIA_TOOL_NAMES, MEDIA_TOOL_PREFIX } from './media-channel-tools';\nimport { IsAllowedExternalMediaUrl, MediaChannelState, MediaHighlight, MediaItemType } from './media-channel-state';\nimport { RealtimeMediaSurfaceComponent } from './realtime-media-surface.component';\n\n/** A JSON-serializable value (the building block of a parsed tool-args object). */\ntype ToolArgValue = string | number | boolean | null | ToolArgValue[] | { [key: string]: ToolArgValue };\n\n/** Coerces a parsed arg to a non-empty string, or `undefined` when absent / wrong-typed. */\nfunction asString(value: ToolArgValue | undefined): string | undefined {\n return typeof value === 'string' && value.length > 0 ? value : undefined;\n}\n\n/** Coerces a parsed arg to a finite number, or `undefined` when absent / wrong-typed. */\nfunction asNumber(value: ToolArgValue | undefined): number | undefined {\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined;\n}\n\n/** The media types `Media_ShowMedia` accepts (validated before mutating state). */\nconst VALID_MEDIA_TYPES: MediaItemType[] = ['image', 'video', 'audio', 'pdf', 'web'];\n\n/**\n * The shared MEDIA SURFACE as a pluggable interactive channel — a {@link BaseRealtimeChannelClient}\n * resolved from the `MJ: AI Agent Channels` registry row whose `ClientPluginClass` is\n * `'RealtimeMediaChannel'`. One instance per session (created via ClassFactory at session start).\n *\n * It owns a {@link MediaChannelState} engine and contributes the channel's full contract:\n *\n * - **Action**: the `Media_*` client-executed tool set ({@link MEDIA_TOOL_DEFINITIONS});\n * {@link ApplyAgentTool} parses the args, mutates the state engine, returns a short JSON result\n * string, and sends the model a `[media]` background context note (so it stays aware of what's\n * on screen). Works with NO surface bound — the tools mutate the state engine directly.\n * - **Surface**: {@link RealtimeMediaSurfaceComponent}, created dynamically by the overlay's\n * channel tab; {@link BindSurface} hands it the shared state engine + agent name.\n * - **State of record**: every mutation requests a debounced save of {@link MediaChannelState.ToJSON}\n * under channel name `'Media'`; a prior session's media is rehydrated via {@link RestoreState}.\n *\n * Modeled directly on `RealtimeWhiteboardChannel`.\n */\n@RegisterClass(BaseRealtimeChannelClient, 'RealtimeMediaChannel')\nexport class RealtimeMediaChannel extends BaseRealtimeChannelClient<RealtimeMediaSurfaceComponent> {\n /** The media state of record — created fresh with the plugin (one per session). */\n public readonly State = new MediaChannelState();\n\n /** The live bound surface, when the channel tab's pane is instantiated. */\n private surface: RealtimeMediaSurfaceComponent | null = null;\n /** Media-mutation subscription driving the debounced state-of-record save. */\n private stateChangedSub: Subscription | null = null;\n\n public get ChannelName(): string {\n return 'Media';\n }\n\n public get ToolNamePrefix(): string {\n return MEDIA_TOOL_PREFIX;\n }\n\n public get TabTitle(): string {\n return 'Media';\n }\n\n public get TabIcon(): string {\n return 'fa-solid fa-images';\n }\n\n public GetToolDefinitions(): RealtimeToolDefinition[] {\n return MEDIA_TOOL_DEFINITIONS;\n }\n\n /**\n * The media surface's self-description: what it holds, and every `Media_*` tool as a verb (so a tool a\n * subclass adds shows up here too). The model reads its state (what is on screen) but is never shown\n * pixels of it, so its exposure ceiling is `state`.\n */\n public override GetDescriptor(): RealtimeChannelDescriptor {\n return {\n Key: this.ChannelName,\n Version: REALTIME_CHANNEL_CONTRACT_VERSION,\n DisplayName: this.TabTitle,\n OwningPackage: '@memberjunction/ng-conversations',\n Instructions:\n 'A shared surface where you can show the user images, videos, audio clips, PDFs and web pages. ' +\n 'Each item opens in its own tab; you can switch between them and highlight a region to point at it.',\n Nouns: [\n {\n Name: 'items',\n Description: 'The media items currently shared, each with its type, title and source.',\n Schema: { type: 'array', items: { type: 'object' } }\n }\n ],\n Verbs: BuildToolBackedVerbs(this.GetToolDefinitions(), this.ToolNamePrefix),\n DisplayPolicy: 'open-on-start',\n DefaultAvailability: 'all-sessions',\n MaxExposure: 'state'\n };\n }\n\n public override GetSurfaceComponent(): Type<RealtimeMediaSurfaceComponent> {\n return RealtimeMediaSurfaceComponent;\n }\n\n /** First-run intro shown the first time the user opens the Media tab (once per user). */\n public override GetOnboardingDetails(): ChannelOnboardingDetails {\n return {\n Heading: 'Media',\n Description:\n 'A shared surface where the agent can show you visuals during the call — images, videos, ' +\n 'audio clips, PDFs and web pages. Each item opens in its own tab; the agent can switch ' +\n 'between them and highlight regions to point at exactly what it means.',\n Tips: [\n 'Switch between shared items using the tabs along the top.',\n 'The agent can highlight part of an image or page to draw your eye to it.',\n 'Open any item in a new browser tab or download it from the toolbar.',\n ],\n IconClass: 'fa-solid fa-images',\n };\n }\n\n /** Persist the media surface (host-debounced) on EVERY mutation — agent tools and tab changes. */\n protected override OnInitialize(): void {\n this.stateChangedSub = this.State.Changed$.subscribe(() => {\n this.Context?.RequestSave(this.State.ToJSON());\n });\n }\n\n /**\n * Wires the dynamically-created media surface (before first CD): shared state engine + agent name,\n * plus the live session's MJ provider so FileID-backed items stream securely (mj-storage-media-player\n * + CreateMediaAccessToken) under the SAME authenticated, multi-provider-safe provider.\n */\n public BindSurface(instance: RealtimeMediaSurfaceComponent): void {\n this.surface = instance;\n instance.State = this.State;\n instance.AgentName = this.Context?.AgentName ?? 'The agent';\n instance.Provider = this.Context?.Provider ?? null;\n }\n\n public override UnbindSurface(): void {\n this.surface = null;\n }\n\n /**\n * Executes one `Media_*` tool call LOCALLY: parse args, mutate the state engine, push a `[media]`\n * background context note so the agent stays aware of the surface, and return a short JSON result\n * string for the model. Never throws — malformed args resolve to a `{ success: false, error }`\n * payload the model can narrate. Works with or without a bound surface (it mutates the state engine,\n * which the surface observes).\n */\n public ApplyAgentTool(toolName: string, argsJson: string): string {\n let args: Record<string, ToolArgValue> = {};\n try {\n const parsed = argsJson ? (JSON.parse(argsJson) as unknown) : {};\n if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {\n args = parsed as Record<string, ToolArgValue>;\n }\n } catch {\n return this.fail(`Could not parse arguments for ${toolName}.`);\n }\n\n switch (toolName) {\n case MEDIA_TOOL_NAMES.ShowMedia:\n return this.applyShowMedia(args);\n case MEDIA_TOOL_NAMES.CloseMedia:\n return this.applyCloseMedia(args);\n case MEDIA_TOOL_NAMES.PlayMedia:\n return this.applyPlayMedia(args);\n case MEDIA_TOOL_NAMES.Highlight:\n return this.applyHighlight(args);\n case MEDIA_TOOL_NAMES.ClearAll:\n return this.applyClearAll();\n default:\n return this.fail(`Unknown Media tool \"${toolName}\".`);\n }\n }\n\n /** Adds a media item and makes it active. Source is a public `url` OR an MJStorage `fileId` (>=1 required). */\n private applyShowMedia(args: Record<string, ToolArgValue>): string {\n const mediaType = asString(args['mediaType']);\n const url = asString(args['url']);\n const fileId = asString(args['fileId']);\n const displayName = asString(args['displayName']);\n if (!mediaType || !VALID_MEDIA_TYPES.includes(mediaType as MediaItemType)) {\n return this.fail('Media_ShowMedia requires a \"mediaType\" of image | video | audio | pdf | web.');\n }\n if (!url && !fileId) {\n return this.fail('Media_ShowMedia requires a source — provide a \"url\" (external/public) OR a \"fileId\" (an MJ: Files id).');\n }\n // SECURITY: the url arg is model-supplied and is later rendered in an img/iframe/player, so\n // only well-formed absolute http(s) URLs are accepted — never javascript:, data:, blob:, or scheme-relative.\n if (url && !IsAllowedExternalMediaUrl(url)) {\n return this.fail('Media_ShowMedia \"url\" must be an absolute http:// or https:// URL.');\n }\n if (!displayName) {\n return this.fail('Media_ShowMedia requires a \"displayName\".');\n }\n const item = this.State.AddItem({\n Type: mediaType as MediaItemType,\n Url: url ? url.trim() : undefined,\n FileID: fileId,\n DisplayName: displayName,\n Caption: asString(args['caption']),\n });\n this.note(`now showing ${mediaType} \"${displayName}\"`);\n return JSON.stringify({ success: true, id: item.Id, active: true });\n }\n\n /** Closes a media item. */\n private applyCloseMedia(args: Record<string, ToolArgValue>): string {\n const id = asString(args['id']);\n if (!id) {\n return this.fail('Media_CloseMedia requires an \"id\".');\n }\n const removed = this.State.RemoveItem(id);\n if (!removed) {\n return this.fail(`No media item with id \"${id}\".`);\n }\n this.note(`closed media item \"${id}\"`);\n return JSON.stringify({ success: true, id });\n }\n\n /** Activates + requests playback of a media item. */\n private applyPlayMedia(args: Record<string, ToolArgValue>): string {\n const id = asString(args['id']);\n if (!id) {\n return this.fail('Media_PlayMedia requires an \"id\".');\n }\n const ok = this.State.RequestPlay(id);\n if (!ok) {\n return this.fail(`No media item with id \"${id}\".`);\n }\n this.note(`playing media item \"${id}\"`);\n return JSON.stringify({ success: true, id });\n }\n\n /** Draws (or, with absent dims, clears) a fractional highlight on a media item. */\n private applyHighlight(args: Record<string, ToolArgValue>): string {\n const id = asString(args['id']);\n if (!id) {\n return this.fail('Media_Highlight requires an \"id\".');\n }\n const x = asNumber(args['x']);\n const y = asNumber(args['y']);\n const w = asNumber(args['w']);\n const h = asNumber(args['h']);\n if (x === undefined || y === undefined || w === undefined || h === undefined) {\n return this.fail('Media_Highlight requires numeric fractional x, y, w, h (0..1).');\n }\n const highlight: MediaHighlight = { X: x, Y: y, W: w, H: h, Label: asString(args['label']) };\n const ok = this.State.Highlight(id, highlight);\n if (!ok) {\n return this.fail(`No media item with id \"${id}\".`);\n }\n this.note(`highlighted a region of media item \"${id}\"`);\n return JSON.stringify({ success: true, id });\n }\n\n /** Clears all media. */\n private applyClearAll(): string {\n this.State.Clear();\n this.note('cleared all media');\n return JSON.stringify({ success: true });\n }\n\n /** The Media channel's serialized state of record (persisted under {@link ChannelName}). */\n public override SerializeState(): string | null {\n return this.State.ToJSON();\n }\n\n /**\n * Rehydrates a prior session's saved media into THIS session's state engine (in place — the\n * {@link State} instance and its subscriptions are preserved). Tolerant: malformed JSON returns\n * `false` and the surface stays empty.\n */\n public override RestoreState(stateJson: string): boolean {\n return this.State.LoadFromJSON(stateJson);\n }\n\n public override Dispose(): void {\n this.stateChangedSub?.unsubscribe();\n this.stateChangedSub = null;\n this.surface = null;\n super.Dispose();\n }\n\n /** Builds a model-readable failure payload (never thrown — returned to the model). */\n private fail(error: string): string {\n return JSON.stringify({ success: false, error });\n }\n\n /**\n * Pushes a background context note so the agent stays aware of the surface state. Framed as\n * background (like the whiteboard's scene-delta notes) so the model doesn't narrate every change.\n */\n private note(summary: string): void {\n this.Context?.SendContextNote(\n `[media] ${summary} (background context — do NOT narrate routine changes; mention only if relevant).`,\n );\n }\n}\n\n/**\n * Tree-shaking prevention: the Media channel is resolved dynamically through the ClassFactory (by the\n * registry row's `ClientPluginClass` key), so this static call keeps its `@RegisterClass` side effect\n * from being eliminated by the bundler. Called alongside `LoadRealtimeWhiteboardChannel()`.\n */\nexport function LoadRealtimeMediaChannel(): void {\n // intentional no-op — the import side effect performs the registration\n}\n"]}
|
|
1
|
+
{"version":3,"file":"media-channel.js","sourceRoot":"","sources":["../../../../../src/lib/components/realtime/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,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;QAC5C,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACzB,CAAC;IACH,CAAC;IAEe,OAAO;QACrB,IAAI,CAAC,eAAe,EAAE,WAAW,EAAE,CAAC;QACpC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;IAED,sFAAsF;IAC9E,IAAI,CAAC,KAAa;QACxB,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACnD,CAAC;IAED;;;OAGG;IACK,IAAI,CAAC,OAAe;QAC1B,IAAI,CAAC,OAAO,EAAE,eAAe,CAC3B,WAAW,OAAO,mFAAmF,CACtG,CAAC;IACJ,CAAC;;AA1WU,oBAAoB;IADhC,aAAa,CAAC,yBAAyB,EAAE,sBAAsB,CAAC;GACpD,oBAAoB,CA2WhC;;AAED;;;;GAIG;AACH,MAAM,UAAU,wBAAwB;IACtC,uEAAuE;AACzE,CAAC","sourcesContent":["import type { Type } from '@angular/core';\nimport { Subscription } from 'rxjs';\nimport { RegisterClass } from '@memberjunction/global';\nimport { JSONObject, RealtimeToolDefinition } from '@memberjunction/ai';\nimport { REALTIME_CHANNEL_CONTRACT_VERSION, type RealtimeChannelDescriptor } from '@memberjunction/ai-core-plus';\nimport { BaseRealtimeChannelClient, BuildToolBackedVerbs } from '@memberjunction/realtime-runtime';\nimport { ChannelOnboardingDetails } from '@memberjunction/realtime-runtime';\nimport { MEDIA_TOOL_DEFINITIONS, MEDIA_TOOL_NAMES, MEDIA_TOOL_PREFIX } from './media-channel-tools';\nimport { IsAllowedExternalMediaUrl, MediaChannelState, MediaHighlight, MediaItem, MediaItemType } from './media-channel-state';\nimport { RealtimeMediaSurfaceComponent } from './realtime-media-surface.component';\n\n/** Result of checking whether an external media URL loads cleanly before displaying it. */\nexport interface MediaUrlHealthResult {\n Ok: boolean;\n Reason?: string;\n}\n\n/** Optional pluggable URL health checker hook (browser probe in UI, injectable in unit tests). */\nexport type MediaUrlHealthChecker = (\n url: string,\n mediaType: MediaItemType,\n) => MediaUrlHealthResult | Promise<MediaUrlHealthResult>;\n\nconst MEDIA_URL_PROBE_TIMEOUT_MS = 5000;\n\n/** Returns true when running inside a real browser DOM (never Node or jsdom where Image never fires onload/onerror). */\nfunction isRealBrowserDom(): boolean {\n if (typeof window === 'undefined' || typeof Image !== 'function') {\n return false;\n }\n const ua = typeof window.navigator?.userAgent === 'string' ? window.navigator.userAgent : '';\n return !/jsdom/i.test(ua);\n}\n\n/**\n * Probes an external media URL via real browser elements (`Image` for images, `<video>`/`<audio>` metadata\n * for AV) so broken 404/403/corrupt image links fail pre-flight without rendering a broken icon and without\n * failing on third-party hosts that disallow CORS `fetch()`.\n */\nfunction probeBrowserMediaUrl(url: string, mediaType: MediaItemType): Promise<MediaUrlHealthResult> {\n if (mediaType === 'image') {\n return new Promise((resolve) => {\n const img = new Image();\n let settled = false;\n const timer = setTimeout(() => {\n if (!settled) {\n settled = true;\n resolve({ Ok: false, Reason: `Timed out loading image URL after ${MEDIA_URL_PROBE_TIMEOUT_MS}ms.` });\n }\n }, MEDIA_URL_PROBE_TIMEOUT_MS);\n const finish = (result: MediaUrlHealthResult) => {\n if (settled) {\n return;\n }\n settled = true;\n clearTimeout(timer);\n img.onload = null;\n img.onerror = null;\n resolve(result);\n };\n img.referrerPolicy = 'no-referrer';\n img.onload = () => finish({ Ok: true });\n img.onerror = () =>\n finish({\n Ok: false,\n Reason: 'Image URL failed to load (404/403, network error, or non-image response).',\n });\n img.src = url;\n });\n }\n if (mediaType === 'video' || mediaType === 'audio') {\n if (typeof document === 'undefined') {\n return Promise.resolve({ Ok: true });\n }\n return new Promise((resolve) => {\n const el = document.createElement(mediaType);\n let settled = false;\n const timer = setTimeout(() => {\n if (!settled) {\n settled = true;\n el.removeAttribute('src');\n el.load();\n resolve({ Ok: false, Reason: `Timed out loading ${mediaType} URL after ${MEDIA_URL_PROBE_TIMEOUT_MS}ms.` });\n }\n }, MEDIA_URL_PROBE_TIMEOUT_MS);\n const finish = (result: MediaUrlHealthResult) => {\n if (settled) {\n return;\n }\n settled = true;\n clearTimeout(timer);\n el.onloadedmetadata = null;\n el.onerror = null;\n el.removeAttribute('src');\n el.load();\n resolve(result);\n };\n el.preload = 'metadata';\n el.onloadedmetadata = () => finish({ Ok: true });\n el.onerror = () => finish({ Ok: false, Reason: `${mediaType} URL failed to load metadata.` });\n el.src = url;\n });\n }\n return Promise.resolve({ Ok: true });\n}\n\n/** A JSON-serializable value (the building block of a parsed tool-args object). */\ntype ToolArgValue = string | number | boolean | null | ToolArgValue[] | { [key: string]: ToolArgValue };\n\n/** Coerces a parsed arg to a non-empty string, or `undefined` when absent / wrong-typed. */\nfunction asString(value: ToolArgValue | undefined): string | undefined {\n return typeof value === 'string' && value.length > 0 ? value : undefined;\n}\n\n/** Coerces a parsed arg to a finite number, or `undefined` when absent / wrong-typed. */\nfunction asNumber(value: ToolArgValue | undefined): number | undefined {\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined;\n}\n\n/** The media types `Media_ShowMedia` accepts (validated before mutating state). */\nconst VALID_MEDIA_TYPES: MediaItemType[] = ['image', 'video', 'audio', 'pdf', 'web'];\n\n/**\n * The shared MEDIA SURFACE as a pluggable interactive channel — a {@link BaseRealtimeChannelClient}\n * resolved from the `MJ: AI Agent Channels` registry row whose `ClientPluginClass` is\n * `'RealtimeMediaChannel'`. One instance per session (created via ClassFactory at session start).\n *\n * It owns a {@link MediaChannelState} engine and contributes the channel's full contract:\n *\n * - **Action**: the `Media_*` client-executed tool set ({@link MEDIA_TOOL_DEFINITIONS});\n * {@link ApplyAgentTool} parses the args, mutates the state engine, returns a short JSON result\n * string, and sends the model a `[media]` background context note (so it stays aware of what's\n * on screen). Works with NO surface bound — the tools mutate the state engine directly.\n * - **Surface**: {@link RealtimeMediaSurfaceComponent}, created dynamically by the overlay's\n * channel tab; {@link BindSurface} hands it the shared state engine + agent name.\n * - **State of record**: every mutation requests a debounced save of {@link MediaChannelState.ToJSON}\n * under channel name `'Media'`; a prior session's media is rehydrated via {@link RestoreState}.\n *\n * Modeled directly on `RealtimeWhiteboardChannel`.\n */\n@RegisterClass(BaseRealtimeChannelClient, 'RealtimeMediaChannel')\nexport class RealtimeMediaChannel extends BaseRealtimeChannelClient<RealtimeMediaSurfaceComponent> {\n /** Optional hook (used in tests or custom hosts) to check external media URLs before showing them. */\n public static UrlHealthChecker: MediaUrlHealthChecker | null = null;\n\n /** The media state of record — created fresh with the plugin (one per session). */\n public readonly State = new MediaChannelState();\n\n /** The live bound surface, when the channel tab's pane is instantiated. */\n private surface: RealtimeMediaSurfaceComponent | null = null;\n /** Media-mutation subscription driving the debounced state-of-record save and passive perception updates. */\n private stateChangedSub: Subscription | null = null;\n private pendingChangeAuthor: 'user' | 'agent' = 'user';\n private restoring = false;\n\n public get ChannelName(): string {\n return 'Media';\n }\n\n public get ToolNamePrefix(): string {\n return MEDIA_TOOL_PREFIX;\n }\n\n public get TabTitle(): string {\n return 'Media';\n }\n\n public get TabIcon(): string {\n return 'fa-solid fa-images';\n }\n\n public GetToolDefinitions(): RealtimeToolDefinition[] {\n return MEDIA_TOOL_DEFINITIONS;\n }\n\n /**\n * The media surface's self-description: what it holds, and every `Media_*` tool as a verb (so a tool a\n * subclass adds shows up here too). The model reads its state (what is on screen) but is never shown\n * pixels of it, so its exposure ceiling is `state`.\n */\n public override GetDescriptor(): RealtimeChannelDescriptor {\n return {\n Key: this.ChannelName,\n Version: REALTIME_CHANNEL_CONTRACT_VERSION,\n DisplayName: this.TabTitle,\n OwningPackage: '@memberjunction/ng-conversations',\n Instructions:\n 'A shared surface where you can show the user images, videos, audio clips, PDFs and web pages. ' +\n 'Each item opens in its own tab; you can switch between them and highlight a region to point at it.',\n Nouns: [\n {\n Name: 'items',\n Description: 'The media items currently shared, each with its type, title and source.',\n Schema: { type: 'array', items: { type: 'object' } }\n }\n ],\n Verbs: BuildToolBackedVerbs(this.GetToolDefinitions(), this.ToolNamePrefix),\n DisplayPolicy: 'open-on-start',\n DefaultAvailability: 'all-sessions',\n MaxExposure: 'state'\n };\n }\n\n public override GetSurfaceComponent(): Type<RealtimeMediaSurfaceComponent> {\n return RealtimeMediaSurfaceComponent;\n }\n\n /** First-run intro shown the first time the user opens the Media tab (once per user). */\n public override GetOnboardingDetails(): ChannelOnboardingDetails {\n return {\n Heading: 'Media',\n Description:\n 'A shared surface where the agent can show you visuals during the call — images, videos, ' +\n 'audio clips, PDFs and web pages. Each item opens in its own tab; the agent can switch ' +\n 'between them and highlight regions to point at exactly what it means.',\n Tips: [\n 'Switch between shared items using the tabs along the top.',\n 'The agent can highlight part of an image or page to draw your eye to it.',\n 'Open any item in a new browser tab or download it from the toolbar.',\n ],\n IconClass: 'fa-solid fa-images',\n };\n }\n\n /**\n * Persist the media surface (host-debounced) AND notify passive perception updates on user-driven\n * changes (tab switches, dismissing items) so the realtime agent sees media surface activity.\n */\n protected override OnInitialize(): void {\n this.stateChangedSub = this.State.Changed$.subscribe(() => {\n this.Context?.RequestSave(this.State.ToJSON());\n if (!this.restoring) {\n this.RecordChange({\n Author: this.pendingChangeAuthor,\n Perceive: this.pendingChangeAuthor !== 'agent',\n });\n }\n });\n }\n\n /** Compact state snapshot used by `GetSurfaceSnapshot()`, `[surface]` focus notes, and `ChannelPerceptionCoalescer`. */\n public override GetState(): JSONObject {\n const activeId = this.State.ActiveItemId;\n return {\n activeItemId: activeId,\n itemCount: this.State.Items.length,\n items: this.State.Items.map((item) => ({\n id: item.Id,\n type: item.Type,\n displayName: item.DisplayName,\n ...(item.Url ? { url: item.Url } : {}),\n ...(item.FileID ? { fileId: item.FileID } : {}),\n isActive: activeId === item.Id,\n })),\n };\n }\n\n /** Tags a synchronous state mutation with `'agent'` authorship so perception knows who changed it. */\n private withAgentAuthor<T>(work: () => T): T {\n this.pendingChangeAuthor = 'agent';\n try {\n return work();\n } finally {\n this.pendingChangeAuthor = 'user';\n }\n }\n\n /**\n * Wires the dynamically-created media surface (before first CD): shared state engine + agent name,\n * plus the live session's MJ provider so FileID-backed items stream securely (mj-storage-media-player\n * + CreateMediaAccessToken) under the SAME authenticated, multi-provider-safe provider.\n */\n public BindSurface(instance: RealtimeMediaSurfaceComponent): void {\n this.surface = instance;\n instance.State = this.State;\n instance.AgentName = this.Context?.AgentName ?? 'The agent';\n instance.Provider = this.Context?.Provider ?? null;\n instance.OnRenderError = (item, reason) => this.handleSurfaceRenderError(item, reason);\n }\n\n public override UnbindSurface(): void {\n if (this.surface) {\n this.surface.OnRenderError = null;\n }\n this.surface = null;\n }\n\n private handleSurfaceRenderError(item: MediaItem, reason: string): void {\n this.Context?.SendContextNote(\n `[media] error displaying ${item.Type} \"${item.DisplayName}\" (id: ${item.Id}, url: ${item.Url ?? item.FileID ?? 'unknown'}): ${reason} — please fix or replace the URL and retry.`,\n );\n }\n\n /**\n * Executes one `Media_*` tool call LOCALLY: parse args, validate external URLs when possible,\n * mutate the state engine, push a `[media]` background context note so the agent stays aware of the\n * surface, and return a short JSON result string for the model. Never throws.\n */\n public ApplyAgentTool(toolName: string, argsJson: string): string | Promise<string> {\n let args: Record<string, ToolArgValue> = {};\n try {\n const parsed = argsJson ? (JSON.parse(argsJson) as ToolArgValue) : {};\n if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {\n args = parsed as Record<string, ToolArgValue>;\n }\n } catch {\n return this.fail(`Could not parse arguments for ${toolName}.`);\n }\n\n switch (toolName) {\n case MEDIA_TOOL_NAMES.ShowMedia:\n return this.applyShowMedia(args);\n case MEDIA_TOOL_NAMES.CloseMedia:\n return this.applyCloseMedia(args);\n case MEDIA_TOOL_NAMES.PlayMedia:\n return this.applyPlayMedia(args);\n case MEDIA_TOOL_NAMES.Highlight:\n return this.applyHighlight(args);\n case MEDIA_TOOL_NAMES.ClearAll:\n return this.applyClearAll();\n default:\n return this.fail(`Unknown Media tool \"${toolName}\".`);\n }\n }\n\n /**\n * Adds a media item and makes it active. External URLs are health-checked before rendering so broken\n * images/links fail immediately and never render as broken icons.\n */\n private applyShowMedia(args: Record<string, ToolArgValue>): string | Promise<string> {\n const mediaType = asString(args['mediaType']);\n const url = asString(args['url']);\n const fileId = asString(args['fileId']);\n const displayName = asString(args['displayName']);\n if (!mediaType || !VALID_MEDIA_TYPES.includes(mediaType as MediaItemType)) {\n return this.fail('Media_ShowMedia requires a \"mediaType\" of image | video | audio | pdf | web.');\n }\n if (!url && !fileId) {\n return this.fail('Media_ShowMedia requires a source — provide a \"url\" (external/public) OR a \"fileId\" (an MJ: Files id).');\n }\n // SECURITY: the url arg is model-supplied and is later rendered in an img/iframe/player, so\n // only well-formed absolute http(s) URLs are accepted — never javascript:, data:, blob:, or scheme-relative.\n if (url && !IsAllowedExternalMediaUrl(url)) {\n return this.fail('Media_ShowMedia \"url\" must be an absolute http:// or https:// URL.');\n }\n if (!displayName) {\n return this.fail('Media_ShowMedia requires a \"displayName\".');\n }\n\n const trimmedUrl = url ? url.trim() : undefined;\n const commitShow = (): string => {\n const item = this.withAgentAuthor(() =>\n this.State.AddItem({\n Type: mediaType as MediaItemType,\n Url: trimmedUrl,\n FileID: fileId,\n DisplayName: displayName,\n Caption: asString(args['caption']),\n }),\n );\n this.note(`now showing ${mediaType} \"${displayName}\"`);\n return JSON.stringify({ success: true, id: item.Id, active: true });\n };\n\n if (trimmedUrl) {\n const healthResult = this.checkExternalUrlHealth(trimmedUrl, mediaType as MediaItemType);\n if (healthResult !== null) {\n if (healthResult instanceof Promise) {\n return healthResult.then(\n (res) => {\n if (!res.Ok) {\n return this.fail(\n `Media URL \"${trimmedUrl}\" could not be loaded: ${res.Reason ?? 'unhealthy URL'}. Fix or replace the URL and retry.`,\n );\n }\n return commitShow();\n },\n (err) =>\n this.fail(\n `Media URL \"${trimmedUrl}\" health check failed: ${err instanceof Error ? err.message : String(err)}. Fix or replace the URL and retry.`,\n ),\n );\n }\n if (!healthResult.Ok) {\n return this.fail(\n `Media URL \"${trimmedUrl}\" could not be loaded: ${healthResult.Reason ?? 'unhealthy URL'}. Fix or replace the URL and retry.`,\n );\n }\n }\n }\n\n return commitShow();\n }\n\n private checkExternalUrlHealth(\n url: string,\n mediaType: MediaItemType,\n ): MediaUrlHealthResult | Promise<MediaUrlHealthResult> | null {\n if (RealtimeMediaChannel.UrlHealthChecker) {\n return RealtimeMediaChannel.UrlHealthChecker(url, mediaType);\n }\n if (isRealBrowserDom() && (mediaType === 'image' || mediaType === 'video' || mediaType === 'audio')) {\n return probeBrowserMediaUrl(url, mediaType);\n }\n return null;\n }\n\n /** Closes a media item. */\n private applyCloseMedia(args: Record<string, ToolArgValue>): string {\n const id = asString(args['id']);\n if (!id) {\n return this.fail('Media_CloseMedia requires an \"id\".');\n }\n const removed = this.withAgentAuthor(() => this.State.RemoveItem(id));\n if (!removed) {\n return this.fail(`No media item with id \"${id}\".`);\n }\n this.note(`closed media item \"${id}\"`);\n return JSON.stringify({ success: true, id });\n }\n\n /** Activates + requests playback of a media item. */\n private applyPlayMedia(args: Record<string, ToolArgValue>): string {\n const id = asString(args['id']);\n if (!id) {\n return this.fail('Media_PlayMedia requires an \"id\".');\n }\n const ok = this.withAgentAuthor(() => this.State.RequestPlay(id));\n if (!ok) {\n return this.fail(`No media item with id \"${id}\".`);\n }\n this.note(`playing media item \"${id}\"`);\n return JSON.stringify({ success: true, id });\n }\n\n /** Draws (or, with absent dims, clears) a fractional highlight on a media item. */\n private applyHighlight(args: Record<string, ToolArgValue>): string {\n const id = asString(args['id']);\n if (!id) {\n return this.fail('Media_Highlight requires an \"id\".');\n }\n const x = asNumber(args['x']);\n const y = asNumber(args['y']);\n const w = asNumber(args['w']);\n const h = asNumber(args['h']);\n if (x === undefined || y === undefined || w === undefined || h === undefined) {\n return this.fail('Media_Highlight requires numeric fractional x, y, w, h (0..1).');\n }\n const highlight: MediaHighlight = { X: x, Y: y, W: w, H: h, Label: asString(args['label']) };\n const ok = this.withAgentAuthor(() => this.State.Highlight(id, highlight));\n if (!ok) {\n return this.fail(`No media item with id \"${id}\".`);\n }\n this.note(`highlighted a region of media item \"${id}\"`);\n return JSON.stringify({ success: true, id });\n }\n\n /** Clears all media. */\n private applyClearAll(): string {\n this.withAgentAuthor(() => this.State.Clear());\n this.note('cleared all media');\n return JSON.stringify({ success: true });\n }\n\n /** The Media channel's serialized state of record (persisted under {@link ChannelName}). */\n public override SerializeState(): string | null {\n return this.State.ToJSON();\n }\n\n /**\n * Rehydrates a prior session's saved media into THIS session's state engine (in place — the\n * {@link State} instance and its subscriptions are preserved). Tolerant: malformed JSON returns\n * `false` and the surface stays empty.\n */\n public override RestoreState(stateJson: string): boolean {\n this.restoring = true;\n try {\n return this.State.LoadFromJSON(stateJson);\n } finally {\n this.restoring = false;\n }\n }\n\n public override Dispose(): void {\n this.stateChangedSub?.unsubscribe();\n this.stateChangedSub = null;\n this.surface = null;\n super.Dispose();\n }\n\n /** Builds a model-readable failure payload (never thrown — returned to the model). */\n private fail(error: string): string {\n return JSON.stringify({ success: false, error });\n }\n\n /**\n * Pushes a background context note so the agent stays aware of the surface state. Framed as\n * background (like the whiteboard's scene-delta notes) so the model doesn't narrate every change.\n */\n private note(summary: string): void {\n this.Context?.SendContextNote(\n `[media] ${summary} (background context — do NOT narrate routine changes; mention only if relevant).`,\n );\n }\n}\n\n/**\n * Tree-shaking prevention: the Media channel is resolved dynamically through the ClassFactory (by the\n * registry row's `ClientPluginClass` key), so this static call keeps its `@RegisterClass` side effect\n * from being eliminated by the bundler. Called alongside `LoadRealtimeWhiteboardChannel()`.\n */\nexport function LoadRealtimeMediaChannel(): void {\n // intentional no-op — the import side effect performs the registration\n}\n"]}
|
|
@@ -71,6 +71,8 @@ export declare class RealtimeMediaSurfaceComponent extends BaseAngularComponent
|
|
|
71
71
|
* resolve inside `mj-storage-media-player` and never enter this map.
|
|
72
72
|
*/
|
|
73
73
|
private fileResolveByItem;
|
|
74
|
+
private renderErrorByItem;
|
|
75
|
+
OnRenderError: ((item: MediaItem, reason: string) => void) | null;
|
|
74
76
|
private mediaPane?;
|
|
75
77
|
private readonly cdr;
|
|
76
78
|
private readonly sanitizer;
|
|
@@ -99,8 +101,14 @@ export declare class RealtimeMediaSurfaceComponent extends BaseAngularComponent
|
|
|
99
101
|
RenderUrl(item: MediaItem): string | null;
|
|
100
102
|
/** Whether a FileID-backed image/pdf/web item is still resolving its streaming URL. */
|
|
101
103
|
IsResolving(item: MediaItem): boolean;
|
|
102
|
-
/** The
|
|
104
|
+
/** The load-failure message for any item (FileID resolution failure or runtime render error), or `null`. */
|
|
103
105
|
ResolveError(item: MediaItem): string | null;
|
|
106
|
+
/**
|
|
107
|
+
* Called when an external image fails to load at runtime (e.g. expired link or broken source
|
|
108
|
+
* after restore): hides the broken image icon behind the error card and notifies the channel so
|
|
109
|
+
* the realtime agent can fix or replace the URL.
|
|
110
|
+
*/
|
|
111
|
+
OnMediaElementError(item: MediaItem): void;
|
|
104
112
|
/** Switches the active tab to `item`. */
|
|
105
113
|
SelectTab(item: MediaItem): void;
|
|
106
114
|
/** Keyboard handler for the tab buttons — Enter/Space activate, arrows move between tabs. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"realtime-media-surface.component.d.ts","sourceRoot":"","sources":["../../../../../src/lib/components/realtime/media/realtime-media-surface.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACqE,SAAS,EAAE,MAAM,EAE5F,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAgB,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAI1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAyD,UAAU,EAAE,MAAM,iCAAiC,CAAC;AACpH,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;;AA0BrE,gHAAgH;AAChH,MAAM,MAAM,gBAAgB,GACxB;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,GACrB;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAChC;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzC,4FAA4F;AAC5F,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,GAAG,YAAY,GAAG,eAAe,GAAG,MAAM,CAAC;AAE1F,iGAAiG;AACjG,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAE1D;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAclG;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,gBAAgB,CAWnE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAQa,6BAA8B,SAAQ,oBAAqB,YAAW,MAAM,EAAE,SAAS;IAClG,wFAAwF;IACxF,IACI,KAAK,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,EAMxC;IACD,IAAI,KAAK,IAAI,iBAAiB,GAAG,IAAI,CAEpC;IACD,OAAO,CAAC,MAAM,CAAkC;IAEhD,qFAAqF;IAC5E,SAAS,SAAe;IAEjC,uFAAuF;IAChF,SAAS,SAAK;IAErB,mGAAmG;IACnG,OAAO,CAAC,YAAY,CAAsC;IAE1D,wFAAwF;IACxF,OAAO,CAAC,eAAe,CAA6B;IAEpD;;;OAGG;IACH,OAAO,CAAC,iBAAiB,CAAuC;
|
|
1
|
+
{"version":3,"file":"realtime-media-surface.component.d.ts","sourceRoot":"","sources":["../../../../../src/lib/components/realtime/media/realtime-media-surface.component.ts"],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