@memberjunction/realtime-widget 6.2.0-edge.5 → 6.2.0-edge.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +11 -2
  2. package/dist/embed/chunks/UserViewEngine-IVGLM2DH.js +7 -0
  3. package/dist/embed/chunks/chunk-MRWWS7FK.js +162091 -0
  4. package/dist/embed/chunks/chunk-N3BM2W5J.js +36503 -0
  5. package/dist/embed/chunks/chunk-RAIOBPHZ.js +6127 -0
  6. package/dist/embed/chunks/chunk-S3LX5KYE.js +46 -0
  7. package/dist/embed/chunks/chunk-VZ6KR7K2.js +2492 -0
  8. package/dist/embed/chunks/chunk-ZX4SRAYD.js +17043 -0
  9. package/dist/embed/chunks/dist-P2JMWJFV.js +66 -0
  10. package/dist/embed/chunks/guest-tool-relay-GAWXNIUD.js +30 -0
  11. package/dist/embed/chunks/guest-voice-mint-KJMP4VTK.js +94 -0
  12. package/dist/embed/chunks/realtime-voice-controller-PCOD3UBR.js +30558 -0
  13. package/dist/embed/chunks/runtime-widget-transport-AFGCQC7N.js +161 -0
  14. package/dist/embed/mj-widget.js +1056 -0
  15. package/dist/embed.js +3 -2
  16. package/dist/embed.js.map +1 -1
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +1 -1
  20. package/dist/index.js.map +1 -1
  21. package/dist/loader.d.ts +9 -0
  22. package/dist/loader.d.ts.map +1 -1
  23. package/dist/loader.js +56 -7
  24. package/dist/loader.js.map +1 -1
  25. package/dist/session/widget-session-client.d.ts +46 -5
  26. package/dist/session/widget-session-client.d.ts.map +1 -1
  27. package/dist/session/widget-session-client.js +118 -17
  28. package/dist/session/widget-session-client.js.map +1 -1
  29. package/dist/transport/runtime-widget-transport.d.ts +0 -6
  30. package/dist/transport/runtime-widget-transport.d.ts.map +1 -1
  31. package/dist/transport/runtime-widget-transport.js +2 -31
  32. package/dist/transport/runtime-widget-transport.js.map +1 -1
  33. package/package.json +10 -10
@@ -0,0 +1,66 @@
1
+ import {
2
+ BuildConversationTimeline,
3
+ ClientToolRegistry,
4
+ CollectRealtimeSessionIDs,
5
+ ConsoleNotificationAdapter,
6
+ ConversationAgentRunner,
7
+ ConversationBridge,
8
+ ConversationLiveness,
9
+ ConversationStreaming,
10
+ ConversationTail,
11
+ ConversationsRuntime,
12
+ DefaultAgentResolver,
13
+ FindRealtimeSessionMeta,
14
+ IntersectAcceptedSkills,
15
+ IsVisibleRealtimeTurn,
16
+ MapRealtimeSessionMeta,
17
+ MentionAutocomplete,
18
+ MentionParser,
19
+ NoOpActiveTaskTracker,
20
+ NoOpSessionsAdapter,
21
+ REALTIME_SESSION_META_FIELDS,
22
+ RECONCILE_THROTTLE_MS,
23
+ SessionCardDurationLabel,
24
+ SessionCardIsSameDayRange,
25
+ SessionCardMessageCountLabel,
26
+ SessionCardSpeakerLabel,
27
+ SessionCardStartedAt,
28
+ SessionCardStatusChip,
29
+ SessionCardTitle,
30
+ SessionsObserver
31
+ } from "./chunk-RAIOBPHZ.js";
32
+ import "./chunk-MRWWS7FK.js";
33
+ import "./chunk-N3BM2W5J.js";
34
+ import "./chunk-VZ6KR7K2.js";
35
+ import "./chunk-ZX4SRAYD.js";
36
+ export {
37
+ BuildConversationTimeline,
38
+ ClientToolRegistry,
39
+ CollectRealtimeSessionIDs,
40
+ ConsoleNotificationAdapter,
41
+ ConversationAgentRunner,
42
+ ConversationBridge,
43
+ ConversationLiveness,
44
+ ConversationStreaming,
45
+ ConversationTail,
46
+ ConversationsRuntime,
47
+ DefaultAgentResolver,
48
+ FindRealtimeSessionMeta,
49
+ IntersectAcceptedSkills,
50
+ IsVisibleRealtimeTurn,
51
+ MapRealtimeSessionMeta,
52
+ MentionAutocomplete,
53
+ MentionParser,
54
+ NoOpActiveTaskTracker,
55
+ NoOpSessionsAdapter,
56
+ REALTIME_SESSION_META_FIELDS,
57
+ RECONCILE_THROTTLE_MS,
58
+ SessionCardDurationLabel,
59
+ SessionCardIsSameDayRange,
60
+ SessionCardMessageCountLabel,
61
+ SessionCardSpeakerLabel,
62
+ SessionCardStartedAt,
63
+ SessionCardStatusChip,
64
+ SessionCardTitle,
65
+ SessionsObserver
66
+ };
@@ -0,0 +1,30 @@
1
+ import {
2
+ h
3
+ } from "./chunk-MRWWS7FK.js";
4
+ import "./chunk-N3BM2W5J.js";
5
+ import "./chunk-VZ6KR7K2.js";
6
+ import "./chunk-ZX4SRAYD.js";
7
+
8
+ // dist/voice/guest-tool-relay.js
9
+ var EXECUTE_TOOL_MUTATION = `
10
+ mutation WidgetRelayRealtimeTool($agentSessionId: String!, $callId: String!, $toolName: String!, $argsJson: String!) {
11
+ ExecuteRealtimeSessionTool(agentSessionId: $agentSessionId, callId: $callId, toolName: $toolName, argsJson: $argsJson)
12
+ }`;
13
+ function CreateGuestToolRelay() {
14
+ return async (agentSessionId, callId, toolName, argsJson) => {
15
+ const data = await h.Instance.ExecuteGQL(EXECUTE_TOOL_MUTATION, {
16
+ agentSessionId,
17
+ callId,
18
+ toolName,
19
+ argsJson
20
+ });
21
+ return data.ExecuteRealtimeSessionTool ?? "{}";
22
+ };
23
+ }
24
+ function createGuestToolRelay() {
25
+ return CreateGuestToolRelay();
26
+ }
27
+ export {
28
+ CreateGuestToolRelay,
29
+ createGuestToolRelay
30
+ };
@@ -0,0 +1,94 @@
1
+ import {
2
+ h
3
+ } from "./chunk-MRWWS7FK.js";
4
+ import "./chunk-N3BM2W5J.js";
5
+ import {
6
+ ParseRealtimeClientTransport
7
+ } from "./chunk-VZ6KR7K2.js";
8
+ import "./chunk-ZX4SRAYD.js";
9
+
10
+ // dist/voice/guest-voice-mint.js
11
+ var MINT_FIELDS = ["AgentSessionId", "Provider", "Model", "EphemeralToken", "ExpiresAt", "SessionConfigJson"];
12
+ var TRANSPORT_FIELDS = ["Transport", "RelayUrl"];
13
+ var UNSUPPORTED_WARNINGS = {
14
+ Transport: "[RealtimeWidget] The server does not report the session transport \u2014 minting without it; every session connects directly.",
15
+ NoAgentVideo: "[RealtimeWidget] The server does not take showsAgentVideo \u2014 minting without it; it may ask for an avatar the widget can't show (the call stays audio only)."
16
+ };
17
+ function startRealtimeMutation(asked) {
18
+ const fields = asked.Transport ? [...MINT_FIELDS, ...TRANSPORT_FIELDS] : MINT_FIELDS;
19
+ const variable = asked.NoAgentVideo ? ", $showsAgentVideo: Boolean" : "";
20
+ const argument = asked.NoAgentVideo ? ", showsAgentVideo: $showsAgentVideo" : "";
21
+ return `
22
+ mutation StartWidgetVoiceSession($targetAgentId: String, $clientToolsJson: String${variable}) {
23
+ StartRealtimeClientSession(targetAgentId: $targetAgentId, clientToolsJson: $clientToolsJson${argument}) {
24
+ ${fields.join("\n ")}
25
+ }
26
+ }`;
27
+ }
28
+ function rejectedExtension(error, asked) {
29
+ const message = error instanceof Error ? error.message : String(error);
30
+ if (asked.NoAgentVideo && message.includes("showsAgentVideo")) {
31
+ return "NoAgentVideo";
32
+ }
33
+ if (asked.Transport && (message.includes('field "Transport"') || message.includes('field "RelayUrl"'))) {
34
+ return "Transport";
35
+ }
36
+ return null;
37
+ }
38
+ function CreateGuestVoiceMint(session) {
39
+ const serverLacks = /* @__PURE__ */ new Set();
40
+ const mint = async (variables) => {
41
+ let asked = { Transport: !serverLacks.has("Transport"), NoAgentVideo: !serverLacks.has("NoAgentVideo") };
42
+ for (; ; ) {
43
+ try {
44
+ const sent = asked.NoAgentVideo ? { ...variables, showsAgentVideo: false } : variables;
45
+ return await h.Instance.ExecuteGQL(startRealtimeMutation(asked), sent);
46
+ } catch (error) {
47
+ const rejected = rejectedExtension(error, asked);
48
+ if (!rejected) {
49
+ throw error;
50
+ }
51
+ serverLacks.add(rejected);
52
+ console.warn(UNSUPPORTED_WARNINGS[rejected]);
53
+ asked = { ...asked, [rejected]: false };
54
+ }
55
+ }
56
+ };
57
+ return async (clientTools) => {
58
+ const data = await mint({
59
+ targetAgentId: session.pinnedAgentId,
60
+ clientToolsJson: clientTools.length > 0 ? JSON.stringify(clientTools) : void 0
61
+ });
62
+ const r = data.StartRealtimeClientSession;
63
+ return { provider: r.Provider, sessionConfig: toClientConfig(r), agentSessionId: r.AgentSessionId };
64
+ };
65
+ }
66
+ function createGuestVoiceMint(session) {
67
+ return CreateGuestVoiceMint(session);
68
+ }
69
+ function toClientConfig(r) {
70
+ const transport = ParseRealtimeClientTransport(r.Transport);
71
+ return {
72
+ Provider: r.Provider,
73
+ Model: r.Model,
74
+ EphemeralToken: r.EphemeralToken,
75
+ ExpiresAt: r.ExpiresAt,
76
+ ...transport ? { Transport: transport } : {},
77
+ ...r.RelayUrl ? { RelayUrl: r.RelayUrl } : {},
78
+ SessionConfig: parseSessionConfig(r.SessionConfigJson)
79
+ };
80
+ }
81
+ function parseSessionConfig(json) {
82
+ if (!json) {
83
+ return {};
84
+ }
85
+ try {
86
+ return JSON.parse(json);
87
+ } catch {
88
+ return {};
89
+ }
90
+ }
91
+ export {
92
+ CreateGuestVoiceMint,
93
+ createGuestVoiceMint
94
+ };