@absolutejs/voice 0.0.22-beta.17 → 0.0.22-beta.170
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 +1057 -5
- package/dist/agent.d.ts +24 -0
- package/dist/agentSquadContract.d.ts +64 -0
- package/dist/angular/index.d.ts +12 -0
- package/dist/angular/index.js +3196 -1111
- package/dist/angular/voice-campaign-dialer-proof.service.d.ts +14 -0
- package/dist/angular/voice-controller.service.d.ts +1 -0
- package/dist/angular/voice-delivery-runtime.component.d.ts +17 -0
- package/dist/angular/voice-delivery-runtime.service.d.ts +16 -0
- package/dist/angular/voice-ops-action-center.service.d.ts +13 -0
- package/dist/angular/voice-ops-status.component.d.ts +15 -0
- package/dist/angular/voice-ops-status.service.d.ts +12 -0
- package/dist/angular/voice-provider-capabilities.service.d.ts +12 -0
- package/dist/angular/voice-provider-contracts.service.d.ts +12 -0
- package/dist/angular/voice-routing-status.service.d.ts +11 -0
- package/dist/angular/voice-stream.service.d.ts +3 -0
- package/dist/angular/voice-trace-timeline.service.d.ts +12 -0
- package/dist/angular/voice-turn-latency.service.d.ts +13 -0
- package/dist/angular/voice-turn-quality.service.d.ts +12 -0
- package/dist/angular/voice-workflow-status.service.d.ts +12 -0
- package/dist/assistantHealth.d.ts +81 -0
- package/dist/audit.d.ts +128 -0
- package/dist/auditDeliveryRoutes.d.ts +85 -0
- package/dist/auditExport.d.ts +34 -0
- package/dist/auditRoutes.d.ts +66 -0
- package/dist/auditSinks.d.ts +151 -0
- package/dist/bargeInRoutes.d.ts +56 -0
- package/dist/campaign.d.ts +610 -0
- package/dist/campaignDialers.d.ts +90 -0
- package/dist/client/actions.d.ts +105 -0
- package/dist/client/bargeInMonitor.d.ts +7 -0
- package/dist/client/campaignDialerProof.d.ts +23 -0
- package/dist/client/connection.d.ts +3 -0
- package/dist/client/deliveryRuntime.d.ts +34 -0
- package/dist/client/deliveryRuntimeWidget.d.ts +37 -0
- package/dist/client/duplex.d.ts +1 -1
- package/dist/client/htmxBootstrap.js +747 -15
- package/dist/client/index.d.ts +54 -0
- package/dist/client/index.js +2944 -20
- package/dist/client/liveTurnLatency.d.ts +41 -0
- package/dist/client/opsActionCenter.d.ts +54 -0
- package/dist/client/opsActionCenterWidget.d.ts +29 -0
- package/dist/client/opsActionHistory.d.ts +19 -0
- package/dist/client/opsActionHistoryWidget.d.ts +11 -0
- package/dist/client/opsStatus.d.ts +19 -0
- package/dist/client/opsStatusWidget.d.ts +40 -0
- package/dist/client/providerCapabilities.d.ts +19 -0
- package/dist/client/providerCapabilitiesWidget.d.ts +32 -0
- package/dist/client/providerContracts.d.ts +19 -0
- package/dist/client/providerContractsWidget.d.ts +37 -0
- package/dist/client/providerSimulationControls.d.ts +33 -0
- package/dist/client/providerSimulationControlsWidget.d.ts +20 -0
- package/dist/client/providerStatusWidget.d.ts +32 -0
- package/dist/client/routingStatus.d.ts +19 -0
- package/dist/client/routingStatusWidget.d.ts +28 -0
- package/dist/client/traceTimeline.d.ts +19 -0
- package/dist/client/traceTimelineWidget.d.ts +32 -0
- package/dist/client/turnLatency.d.ts +22 -0
- package/dist/client/turnLatencyWidget.d.ts +33 -0
- package/dist/client/turnQuality.d.ts +19 -0
- package/dist/client/turnQualityWidget.d.ts +32 -0
- package/dist/client/workflowStatus.d.ts +19 -0
- package/dist/dataControl.d.ts +47 -0
- package/dist/deliveryRuntime.d.ts +158 -0
- package/dist/deliverySinkRoutes.d.ts +117 -0
- package/dist/demoReadyRoutes.d.ts +98 -0
- package/dist/diagnosticsRoutes.d.ts +44 -0
- package/dist/evalRoutes.d.ts +213 -0
- package/dist/fileStore.d.ts +11 -2
- package/dist/handoff.d.ts +54 -0
- package/dist/handoffHealth.d.ts +94 -0
- package/dist/index.d.ts +114 -11
- package/dist/index.js +18454 -4316
- package/dist/liveLatency.d.ts +78 -0
- package/dist/modelAdapters.d.ts +23 -2
- package/dist/openaiRealtime.d.ts +27 -0
- package/dist/openaiTTS.d.ts +18 -0
- package/dist/opsActionAuditRoutes.d.ts +99 -0
- package/dist/opsConsoleRoutes.d.ts +80 -0
- package/dist/opsStatus.d.ts +76 -0
- package/dist/opsStatusRoutes.d.ts +33 -0
- package/dist/opsWebhook.d.ts +126 -0
- package/dist/outcomeContract.d.ts +112 -0
- package/dist/phoneAgent.d.ts +62 -0
- package/dist/phoneAgentProductionSmoke.d.ts +115 -0
- package/dist/postgresStore.d.ts +13 -2
- package/dist/productionReadiness.d.ts +368 -0
- package/dist/providerAdapters.d.ts +48 -0
- package/dist/providerCapabilities.d.ts +92 -0
- package/dist/providerHealth.d.ts +1 -0
- package/dist/providerRoutingContract.d.ts +38 -0
- package/dist/providerStackRecommendations.d.ts +145 -0
- package/dist/qualityRoutes.d.ts +76 -0
- package/dist/queue.d.ts +61 -0
- package/dist/react/VoiceDeliveryRuntime.d.ts +7 -0
- package/dist/react/VoiceOpsActionCenter.d.ts +5 -0
- package/dist/react/VoiceOpsStatus.d.ts +6 -0
- package/dist/react/VoiceProviderCapabilities.d.ts +6 -0
- package/dist/react/VoiceProviderContracts.d.ts +6 -0
- package/dist/react/VoiceProviderSimulationControls.d.ts +5 -0
- package/dist/react/VoiceProviderStatus.d.ts +6 -0
- package/dist/react/VoiceRoutingStatus.d.ts +6 -0
- package/dist/react/VoiceTraceTimeline.d.ts +6 -0
- package/dist/react/VoiceTurnLatency.d.ts +6 -0
- package/dist/react/VoiceTurnQuality.d.ts +6 -0
- package/dist/react/index.d.ts +23 -0
- package/dist/react/index.js +3695 -33
- package/dist/react/useVoiceCampaignDialerProof.d.ts +10 -0
- package/dist/react/useVoiceController.d.ts +3 -0
- package/dist/react/useVoiceDeliveryRuntime.d.ts +13 -0
- package/dist/react/useVoiceOpsActionCenter.d.ts +11 -0
- package/dist/react/useVoiceOpsStatus.d.ts +8 -0
- package/dist/react/useVoiceProviderCapabilities.d.ts +8 -0
- package/dist/react/useVoiceProviderContracts.d.ts +8 -0
- package/dist/react/useVoiceProviderSimulationControls.d.ts +10 -0
- package/dist/react/useVoiceRoutingStatus.d.ts +8 -0
- package/dist/react/useVoiceStream.d.ts +3 -0
- package/dist/react/useVoiceTraceTimeline.d.ts +8 -0
- package/dist/react/useVoiceTurnLatency.d.ts +9 -0
- package/dist/react/useVoiceTurnQuality.d.ts +8 -0
- package/dist/react/useVoiceWorkflowStatus.d.ts +8 -0
- package/dist/readinessProfiles.d.ts +35 -0
- package/dist/reconnectContract.d.ts +87 -0
- package/dist/resilienceRoutes.d.ts +142 -0
- package/dist/sessionReplay.d.ts +185 -0
- package/dist/simulationSuite.d.ts +120 -0
- package/dist/sqliteStore.d.ts +13 -2
- package/dist/svelte/createVoiceCampaignDialerProof.d.ts +9 -0
- package/dist/svelte/createVoiceDeliveryRuntime.d.ts +11 -0
- package/dist/svelte/createVoiceOpsActionCenter.d.ts +10 -0
- package/dist/svelte/createVoiceOpsStatus.d.ts +9 -0
- package/dist/svelte/createVoiceProviderCapabilities.d.ts +10 -0
- package/dist/svelte/createVoiceProviderContracts.d.ts +10 -0
- package/dist/svelte/createVoiceProviderSimulationControls.d.ts +11 -0
- package/dist/svelte/createVoiceProviderStatus.d.ts +4 -2
- package/dist/svelte/createVoiceRoutingStatus.d.ts +10 -0
- package/dist/svelte/createVoiceTraceTimeline.d.ts +10 -0
- package/dist/svelte/createVoiceTurnLatency.d.ts +11 -0
- package/dist/svelte/createVoiceTurnQuality.d.ts +10 -0
- package/dist/svelte/createVoiceWorkflowStatus.d.ts +8 -0
- package/dist/svelte/index.d.ts +12 -0
- package/dist/svelte/index.js +3095 -439
- package/dist/telephony/contract.d.ts +61 -0
- package/dist/telephony/matrix.d.ts +97 -0
- package/dist/telephony/plivo.d.ts +254 -0
- package/dist/telephony/telnyx.d.ts +247 -0
- package/dist/telephony/twilio.d.ts +135 -2
- package/dist/telephonyOutcome.d.ts +201 -0
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.js +2008 -69
- package/dist/testing/ioProviderSimulator.d.ts +41 -0
- package/dist/testing/providerSimulator.d.ts +8 -0
- package/dist/toolContract.d.ts +130 -0
- package/dist/toolRuntime.d.ts +50 -0
- package/dist/trace.d.ts +19 -1
- package/dist/traceDeliveryRoutes.d.ts +86 -0
- package/dist/traceTimeline.d.ts +93 -0
- package/dist/turnLatency.d.ts +95 -0
- package/dist/turnQuality.d.ts +94 -0
- package/dist/types.d.ts +170 -4
- package/dist/vue/VoiceDeliveryRuntime.d.ts +30 -0
- package/dist/vue/VoiceOpsActionCenter.d.ts +13 -0
- package/dist/vue/VoiceOpsStatus.d.ts +30 -0
- package/dist/vue/VoiceProviderCapabilities.d.ts +51 -0
- package/dist/vue/VoiceProviderContracts.d.ts +21 -0
- package/dist/vue/VoiceProviderSimulationControls.d.ts +88 -0
- package/dist/vue/VoiceProviderStatus.d.ts +51 -0
- package/dist/vue/VoiceRoutingStatus.d.ts +51 -0
- package/dist/vue/VoiceTurnLatency.d.ts +69 -0
- package/dist/vue/VoiceTurnQuality.d.ts +51 -0
- package/dist/vue/index.d.ts +22 -0
- package/dist/vue/index.js +3617 -53
- package/dist/vue/useVoiceCampaignDialerProof.d.ts +11 -0
- package/dist/vue/useVoiceController.d.ts +2 -1
- package/dist/vue/useVoiceDeliveryRuntime.d.ts +13 -0
- package/dist/vue/useVoiceOpsActionCenter.d.ts +11 -0
- package/dist/vue/useVoiceOpsStatus.d.ts +9 -0
- package/dist/vue/useVoiceProviderCapabilities.d.ts +9 -0
- package/dist/vue/useVoiceProviderContracts.d.ts +9 -0
- package/dist/vue/useVoiceProviderSimulationControls.d.ts +24 -0
- package/dist/vue/useVoiceProviderStatus.d.ts +1 -1
- package/dist/vue/useVoiceRoutingStatus.d.ts +8 -0
- package/dist/vue/useVoiceStream.d.ts +4 -1
- package/dist/vue/useVoiceTraceTimeline.d.ts +9 -0
- package/dist/vue/useVoiceTurnLatency.d.ts +10 -0
- package/dist/vue/useVoiceTurnQuality.d.ts +9 -0
- package/dist/vue/useVoiceWorkflowStatus.d.ts +9 -0
- package/dist/workflowContract.d.ts +91 -0
- package/package.json +1 -1
package/dist/client/index.js
CHANGED
|
@@ -80,7 +80,7 @@ var DEFAULT_SCENARIO_QUERY_PARAM = "scenarioId";
|
|
|
80
80
|
var noop = () => {};
|
|
81
81
|
var noopUnsubscribe = () => noop;
|
|
82
82
|
var NOOP_CONNECTION = {
|
|
83
|
-
|
|
83
|
+
callControl: noop,
|
|
84
84
|
close: noop,
|
|
85
85
|
endTurn: noop,
|
|
86
86
|
getReadyState: () => WS_CLOSED,
|
|
@@ -88,6 +88,7 @@ var NOOP_CONNECTION = {
|
|
|
88
88
|
getSessionId: () => "",
|
|
89
89
|
send: noop,
|
|
90
90
|
sendAudio: noop,
|
|
91
|
+
start: () => {},
|
|
91
92
|
subscribe: noopUnsubscribe
|
|
92
93
|
};
|
|
93
94
|
var createSessionId = () => crypto.randomUUID();
|
|
@@ -109,11 +110,14 @@ var isVoiceServerMessage = (value) => {
|
|
|
109
110
|
switch (value.type) {
|
|
110
111
|
case "audio":
|
|
111
112
|
case "assistant":
|
|
113
|
+
case "call_lifecycle":
|
|
112
114
|
case "complete":
|
|
115
|
+
case "connection":
|
|
113
116
|
case "error":
|
|
114
117
|
case "final":
|
|
115
118
|
case "partial":
|
|
116
119
|
case "pong":
|
|
120
|
+
case "replay":
|
|
117
121
|
case "session":
|
|
118
122
|
case "turn":
|
|
119
123
|
return true;
|
|
@@ -150,6 +154,9 @@ var createVoiceConnection = (path, options = {}) => {
|
|
|
150
154
|
sessionId: options.sessionId ?? createSessionId(),
|
|
151
155
|
ws: null
|
|
152
156
|
};
|
|
157
|
+
const emitConnection = (reconnect) => {
|
|
158
|
+
listeners.forEach((listener) => listener(reconnect));
|
|
159
|
+
};
|
|
153
160
|
const clearTimers = () => {
|
|
154
161
|
if (state.pingInterval) {
|
|
155
162
|
clearInterval(state.pingInterval);
|
|
@@ -172,9 +179,28 @@ var createVoiceConnection = (path, options = {}) => {
|
|
|
172
179
|
}
|
|
173
180
|
};
|
|
174
181
|
const scheduleReconnect = () => {
|
|
182
|
+
const nextAttemptAt = Date.now() + RECONNECT_DELAY_MS;
|
|
175
183
|
state.reconnectAttempts += 1;
|
|
184
|
+
emitConnection({
|
|
185
|
+
reconnect: {
|
|
186
|
+
attempts: state.reconnectAttempts,
|
|
187
|
+
lastDisconnectAt: Date.now(),
|
|
188
|
+
maxAttempts: maxReconnectAttempts,
|
|
189
|
+
nextAttemptAt,
|
|
190
|
+
status: "reconnecting"
|
|
191
|
+
},
|
|
192
|
+
type: "connection"
|
|
193
|
+
});
|
|
176
194
|
state.reconnectTimeout = setTimeout(() => {
|
|
177
195
|
if (state.reconnectAttempts > maxReconnectAttempts) {
|
|
196
|
+
emitConnection({
|
|
197
|
+
reconnect: {
|
|
198
|
+
attempts: state.reconnectAttempts,
|
|
199
|
+
maxAttempts: maxReconnectAttempts,
|
|
200
|
+
status: "exhausted"
|
|
201
|
+
},
|
|
202
|
+
type: "connection"
|
|
203
|
+
});
|
|
178
204
|
return;
|
|
179
205
|
}
|
|
180
206
|
connect();
|
|
@@ -184,9 +210,21 @@ var createVoiceConnection = (path, options = {}) => {
|
|
|
184
210
|
const ws = new WebSocket(buildWsUrl(path, state.sessionId, state.scenarioId));
|
|
185
211
|
ws.binaryType = "arraybuffer";
|
|
186
212
|
ws.onopen = () => {
|
|
213
|
+
const wasReconnecting = state.reconnectAttempts > 0;
|
|
187
214
|
state.isConnected = true;
|
|
188
|
-
state.reconnectAttempts = 0;
|
|
189
215
|
flushPendingMessages();
|
|
216
|
+
if (wasReconnecting) {
|
|
217
|
+
emitConnection({
|
|
218
|
+
reconnect: {
|
|
219
|
+
attempts: state.reconnectAttempts,
|
|
220
|
+
lastResumedAt: Date.now(),
|
|
221
|
+
maxAttempts: maxReconnectAttempts,
|
|
222
|
+
status: "resumed"
|
|
223
|
+
},
|
|
224
|
+
type: "connection"
|
|
225
|
+
});
|
|
226
|
+
state.reconnectAttempts = 0;
|
|
227
|
+
}
|
|
190
228
|
listeners.forEach((listener) => listener({
|
|
191
229
|
scenarioId: state.scenarioId ?? undefined,
|
|
192
230
|
sessionId: state.sessionId,
|
|
@@ -216,6 +254,16 @@ var createVoiceConnection = (path, options = {}) => {
|
|
|
216
254
|
const reconnectable = shouldReconnect && event.code !== WS_NORMAL_CLOSURE && state.reconnectAttempts < maxReconnectAttempts;
|
|
217
255
|
if (reconnectable) {
|
|
218
256
|
scheduleReconnect();
|
|
257
|
+
} else if (shouldReconnect && event.code !== WS_NORMAL_CLOSURE) {
|
|
258
|
+
emitConnection({
|
|
259
|
+
reconnect: {
|
|
260
|
+
attempts: state.reconnectAttempts,
|
|
261
|
+
lastDisconnectAt: Date.now(),
|
|
262
|
+
maxAttempts: maxReconnectAttempts,
|
|
263
|
+
status: "exhausted"
|
|
264
|
+
},
|
|
265
|
+
type: "connection"
|
|
266
|
+
});
|
|
219
267
|
}
|
|
220
268
|
};
|
|
221
269
|
state.ws = ws;
|
|
@@ -249,6 +297,12 @@ var createVoiceConnection = (path, options = {}) => {
|
|
|
249
297
|
const endTurn = () => {
|
|
250
298
|
send({ type: "end_turn" });
|
|
251
299
|
};
|
|
300
|
+
const callControl = (message) => {
|
|
301
|
+
send({
|
|
302
|
+
...message,
|
|
303
|
+
type: "call_control"
|
|
304
|
+
});
|
|
305
|
+
};
|
|
252
306
|
const close = () => {
|
|
253
307
|
clearTimers();
|
|
254
308
|
if (state.ws) {
|
|
@@ -266,7 +320,7 @@ var createVoiceConnection = (path, options = {}) => {
|
|
|
266
320
|
};
|
|
267
321
|
connect();
|
|
268
322
|
return {
|
|
269
|
-
|
|
323
|
+
callControl,
|
|
270
324
|
close,
|
|
271
325
|
endTurn,
|
|
272
326
|
getReadyState: () => state.ws?.readyState ?? WS_CLOSED,
|
|
@@ -274,6 +328,7 @@ var createVoiceConnection = (path, options = {}) => {
|
|
|
274
328
|
getSessionId: () => state.sessionId,
|
|
275
329
|
send,
|
|
276
330
|
sendAudio,
|
|
331
|
+
start,
|
|
277
332
|
subscribe
|
|
278
333
|
};
|
|
279
334
|
};
|
|
@@ -671,6 +726,17 @@ var serverMessageToAction = (message) => {
|
|
|
671
726
|
sessionId: message.sessionId,
|
|
672
727
|
type: "complete"
|
|
673
728
|
};
|
|
729
|
+
case "connection":
|
|
730
|
+
return {
|
|
731
|
+
reconnect: message.reconnect,
|
|
732
|
+
type: "connection"
|
|
733
|
+
};
|
|
734
|
+
case "call_lifecycle":
|
|
735
|
+
return {
|
|
736
|
+
event: message.event,
|
|
737
|
+
sessionId: message.sessionId,
|
|
738
|
+
type: "call_lifecycle"
|
|
739
|
+
};
|
|
674
740
|
case "error":
|
|
675
741
|
return {
|
|
676
742
|
message: normalizeErrorMessage(message.message),
|
|
@@ -686,6 +752,17 @@ var serverMessageToAction = (message) => {
|
|
|
686
752
|
transcript: message.transcript,
|
|
687
753
|
type: "partial"
|
|
688
754
|
};
|
|
755
|
+
case "replay":
|
|
756
|
+
return {
|
|
757
|
+
assistantTexts: message.assistantTexts,
|
|
758
|
+
call: message.call,
|
|
759
|
+
partial: message.partial,
|
|
760
|
+
scenarioId: message.scenarioId,
|
|
761
|
+
sessionId: message.sessionId,
|
|
762
|
+
status: message.status,
|
|
763
|
+
turns: message.turns,
|
|
764
|
+
type: "replay"
|
|
765
|
+
};
|
|
689
766
|
case "session":
|
|
690
767
|
return {
|
|
691
768
|
sessionId: message.sessionId,
|
|
@@ -704,13 +781,20 @@ var serverMessageToAction = (message) => {
|
|
|
704
781
|
};
|
|
705
782
|
|
|
706
783
|
// src/client/store.ts
|
|
784
|
+
var createInitialReconnectState = () => ({
|
|
785
|
+
attempts: 0,
|
|
786
|
+
maxAttempts: 0,
|
|
787
|
+
status: "idle"
|
|
788
|
+
});
|
|
707
789
|
var createInitialState2 = () => ({
|
|
708
790
|
assistantAudio: [],
|
|
709
791
|
assistantTexts: [],
|
|
792
|
+
call: null,
|
|
710
793
|
error: null,
|
|
711
794
|
isConnected: false,
|
|
712
795
|
scenarioId: null,
|
|
713
796
|
partial: "",
|
|
797
|
+
reconnect: createInitialReconnectState(),
|
|
714
798
|
sessionId: null,
|
|
715
799
|
status: "idle",
|
|
716
800
|
turns: []
|
|
@@ -750,10 +834,36 @@ var createVoiceStreamStore = () => {
|
|
|
750
834
|
status: "completed"
|
|
751
835
|
};
|
|
752
836
|
break;
|
|
837
|
+
case "call_lifecycle":
|
|
838
|
+
state = {
|
|
839
|
+
...state,
|
|
840
|
+
call: {
|
|
841
|
+
...state.call,
|
|
842
|
+
disposition: action.event.type === "end" ? action.event.disposition : state.call?.disposition,
|
|
843
|
+
endedAt: action.event.type === "end" ? action.event.at : state.call?.endedAt,
|
|
844
|
+
events: [...state.call?.events ?? [], action.event],
|
|
845
|
+
lastEventAt: action.event.at,
|
|
846
|
+
startedAt: state.call?.startedAt ?? action.event.at
|
|
847
|
+
},
|
|
848
|
+
sessionId: action.sessionId
|
|
849
|
+
};
|
|
850
|
+
break;
|
|
753
851
|
case "connected":
|
|
754
852
|
state = {
|
|
755
853
|
...state,
|
|
756
|
-
isConnected: true
|
|
854
|
+
isConnected: true,
|
|
855
|
+
reconnect: state.reconnect.status === "reconnecting" ? {
|
|
856
|
+
...state.reconnect,
|
|
857
|
+
lastResumedAt: Date.now(),
|
|
858
|
+
nextAttemptAt: undefined,
|
|
859
|
+
status: "resumed"
|
|
860
|
+
} : state.reconnect
|
|
861
|
+
};
|
|
862
|
+
break;
|
|
863
|
+
case "connection":
|
|
864
|
+
state = {
|
|
865
|
+
...state,
|
|
866
|
+
reconnect: action.reconnect
|
|
757
867
|
};
|
|
758
868
|
break;
|
|
759
869
|
case "disconnected":
|
|
@@ -781,6 +891,26 @@ var createVoiceStreamStore = () => {
|
|
|
781
891
|
partial: action.transcript.text
|
|
782
892
|
};
|
|
783
893
|
break;
|
|
894
|
+
case "replay":
|
|
895
|
+
state = {
|
|
896
|
+
...state,
|
|
897
|
+
assistantTexts: [...action.assistantTexts],
|
|
898
|
+
call: action.call ?? null,
|
|
899
|
+
error: null,
|
|
900
|
+
isConnected: action.status === "active",
|
|
901
|
+
partial: action.partial,
|
|
902
|
+
reconnect: state.reconnect.status === "reconnecting" ? {
|
|
903
|
+
...state.reconnect,
|
|
904
|
+
lastResumedAt: Date.now(),
|
|
905
|
+
nextAttemptAt: undefined,
|
|
906
|
+
status: "resumed"
|
|
907
|
+
} : state.reconnect,
|
|
908
|
+
scenarioId: action.scenarioId ?? state.scenarioId,
|
|
909
|
+
sessionId: action.sessionId,
|
|
910
|
+
status: action.status,
|
|
911
|
+
turns: [...action.turns]
|
|
912
|
+
};
|
|
913
|
+
break;
|
|
784
914
|
case "session":
|
|
785
915
|
state = {
|
|
786
916
|
...state,
|
|
@@ -828,14 +958,41 @@ var createVoiceStream = (path, options = {}) => {
|
|
|
828
958
|
const notify = () => {
|
|
829
959
|
subscribers.forEach((subscriber) => subscriber());
|
|
830
960
|
};
|
|
961
|
+
const reportReconnect = () => {
|
|
962
|
+
if (!options.reconnectReportPath || typeof fetch === "undefined") {
|
|
963
|
+
return;
|
|
964
|
+
}
|
|
965
|
+
const snapshot = store.getSnapshot();
|
|
966
|
+
const body = JSON.stringify({
|
|
967
|
+
at: Date.now(),
|
|
968
|
+
reconnect: snapshot.reconnect,
|
|
969
|
+
scenarioId: snapshot.scenarioId,
|
|
970
|
+
sessionId: connection.getSessionId(),
|
|
971
|
+
turnIds: snapshot.turns.map((turn) => turn.id)
|
|
972
|
+
});
|
|
973
|
+
fetch(options.reconnectReportPath, {
|
|
974
|
+
body,
|
|
975
|
+
headers: {
|
|
976
|
+
"Content-Type": "application/json"
|
|
977
|
+
},
|
|
978
|
+
keepalive: true,
|
|
979
|
+
method: "POST"
|
|
980
|
+
}).catch(() => {});
|
|
981
|
+
};
|
|
831
982
|
const unsubscribeConnection = connection.subscribe((message) => {
|
|
832
983
|
const action = serverMessageToAction(message);
|
|
833
984
|
if (action) {
|
|
834
985
|
store.dispatch(action);
|
|
986
|
+
if (message.type === "connection") {
|
|
987
|
+
reportReconnect();
|
|
988
|
+
}
|
|
835
989
|
notify();
|
|
836
990
|
}
|
|
837
991
|
});
|
|
838
992
|
return {
|
|
993
|
+
callControl(message) {
|
|
994
|
+
connection.callControl(message);
|
|
995
|
+
},
|
|
839
996
|
close() {
|
|
840
997
|
unsubscribeConnection();
|
|
841
998
|
connection.close();
|
|
@@ -864,6 +1021,9 @@ var createVoiceStream = (path, options = {}) => {
|
|
|
864
1021
|
get partial() {
|
|
865
1022
|
return store.getSnapshot().partial;
|
|
866
1023
|
},
|
|
1024
|
+
get reconnect() {
|
|
1025
|
+
return store.getSnapshot().reconnect;
|
|
1026
|
+
},
|
|
867
1027
|
get sessionId() {
|
|
868
1028
|
return connection.getSessionId();
|
|
869
1029
|
},
|
|
@@ -879,6 +1039,9 @@ var createVoiceStream = (path, options = {}) => {
|
|
|
879
1039
|
get assistantAudio() {
|
|
880
1040
|
return store.getSnapshot().assistantAudio;
|
|
881
1041
|
},
|
|
1042
|
+
get call() {
|
|
1043
|
+
return store.getSnapshot().call;
|
|
1044
|
+
},
|
|
882
1045
|
sendAudio(audio) {
|
|
883
1046
|
connection.sendAudio(audio);
|
|
884
1047
|
},
|
|
@@ -1352,10 +1515,12 @@ var resolveVoiceRuntimePreset = (name = "default") => {
|
|
|
1352
1515
|
var createInitialState3 = (stream) => ({
|
|
1353
1516
|
assistantAudio: [...stream.assistantAudio],
|
|
1354
1517
|
assistantTexts: [...stream.assistantTexts],
|
|
1518
|
+
call: stream.call,
|
|
1355
1519
|
error: stream.error,
|
|
1356
1520
|
isConnected: stream.isConnected,
|
|
1357
1521
|
isRecording: false,
|
|
1358
1522
|
partial: stream.partial,
|
|
1523
|
+
reconnect: stream.reconnect,
|
|
1359
1524
|
recordingError: null,
|
|
1360
1525
|
sessionId: stream.sessionId,
|
|
1361
1526
|
scenarioId: stream.scenarioId,
|
|
@@ -1381,9 +1546,11 @@ var createVoiceController = (path, options = {}) => {
|
|
|
1381
1546
|
...state,
|
|
1382
1547
|
assistantAudio: [...stream.assistantAudio],
|
|
1383
1548
|
assistantTexts: [...stream.assistantTexts],
|
|
1549
|
+
call: stream.call,
|
|
1384
1550
|
error: stream.error,
|
|
1385
1551
|
isConnected: stream.isConnected,
|
|
1386
1552
|
partial: stream.partial,
|
|
1553
|
+
reconnect: stream.reconnect,
|
|
1387
1554
|
sessionId: stream.sessionId,
|
|
1388
1555
|
scenarioId: stream.scenarioId,
|
|
1389
1556
|
status: stream.status,
|
|
@@ -1408,7 +1575,13 @@ var createVoiceController = (path, options = {}) => {
|
|
|
1408
1575
|
capture = createMicrophoneCapture({
|
|
1409
1576
|
channelCount: options.capture?.channelCount ?? preset.capture.channelCount,
|
|
1410
1577
|
onLevel: options.capture?.onLevel,
|
|
1411
|
-
onAudio: (audio) =>
|
|
1578
|
+
onAudio: (audio) => {
|
|
1579
|
+
if (options.capture?.onAudio) {
|
|
1580
|
+
options.capture.onAudio(audio, stream.sendAudio);
|
|
1581
|
+
return;
|
|
1582
|
+
}
|
|
1583
|
+
stream.sendAudio(audio);
|
|
1584
|
+
},
|
|
1412
1585
|
sampleRateHz: options.capture?.sampleRateHz ?? preset.capture.sampleRateHz
|
|
1413
1586
|
});
|
|
1414
1587
|
return capture;
|
|
@@ -1458,6 +1631,7 @@ var createVoiceController = (path, options = {}) => {
|
|
|
1458
1631
|
bindHTMX(bindingOptions) {
|
|
1459
1632
|
return bindVoiceHTMX(stream, bindingOptions);
|
|
1460
1633
|
},
|
|
1634
|
+
callControl: (message) => stream.callControl(message),
|
|
1461
1635
|
close,
|
|
1462
1636
|
endTurn: () => stream.endTurn(),
|
|
1463
1637
|
get error() {
|
|
@@ -1477,6 +1651,9 @@ var createVoiceController = (path, options = {}) => {
|
|
|
1477
1651
|
get recordingError() {
|
|
1478
1652
|
return state.recordingError;
|
|
1479
1653
|
},
|
|
1654
|
+
get reconnect() {
|
|
1655
|
+
return state.reconnect;
|
|
1656
|
+
},
|
|
1480
1657
|
sendAudio: (audio) => stream.sendAudio(audio),
|
|
1481
1658
|
get sessionId() {
|
|
1482
1659
|
return state.sessionId;
|
|
@@ -1510,6 +1687,9 @@ var createVoiceController = (path, options = {}) => {
|
|
|
1510
1687
|
},
|
|
1511
1688
|
get assistantAudio() {
|
|
1512
1689
|
return state.assistantAudio;
|
|
1690
|
+
},
|
|
1691
|
+
get call() {
|
|
1692
|
+
return state.call;
|
|
1513
1693
|
}
|
|
1514
1694
|
};
|
|
1515
1695
|
};
|
|
@@ -1518,11 +1698,26 @@ var DEFAULT_INTERRUPT_THRESHOLD = 0.08;
|
|
|
1518
1698
|
var shouldInterruptForLevel = (level, options = {}) => (options.enabled ?? true) && level >= (options.interruptThreshold ?? DEFAULT_INTERRUPT_THRESHOLD);
|
|
1519
1699
|
var bindVoiceBargeIn = (controller, player, options = {}) => {
|
|
1520
1700
|
let lastPartial = controller.partial;
|
|
1521
|
-
const interruptIfPlaying = () => {
|
|
1701
|
+
const interruptIfPlaying = (reason) => {
|
|
1522
1702
|
if (!player.isPlaying || options.enabled === false) {
|
|
1703
|
+
options.monitor?.recordSkipped({
|
|
1704
|
+
reason,
|
|
1705
|
+
sessionId: controller.sessionId
|
|
1706
|
+
});
|
|
1523
1707
|
return;
|
|
1524
1708
|
}
|
|
1525
|
-
|
|
1709
|
+
options.monitor?.recordRequested({
|
|
1710
|
+
reason,
|
|
1711
|
+
sessionId: controller.sessionId
|
|
1712
|
+
});
|
|
1713
|
+
player.interrupt().then(() => {
|
|
1714
|
+
options.monitor?.recordStopped({
|
|
1715
|
+
latencyMs: player.lastInterruptLatencyMs,
|
|
1716
|
+
playbackStopLatencyMs: player.lastPlaybackStopLatencyMs,
|
|
1717
|
+
reason,
|
|
1718
|
+
sessionId: controller.sessionId
|
|
1719
|
+
});
|
|
1720
|
+
});
|
|
1526
1721
|
};
|
|
1527
1722
|
const unsubscribe = controller.subscribe(() => {
|
|
1528
1723
|
if (options.interruptOnPartial === false) {
|
|
@@ -1530,7 +1725,7 @@ var bindVoiceBargeIn = (controller, player, options = {}) => {
|
|
|
1530
1725
|
return;
|
|
1531
1726
|
}
|
|
1532
1727
|
if (!lastPartial && controller.partial) {
|
|
1533
|
-
interruptIfPlaying();
|
|
1728
|
+
interruptIfPlaying("partial-transcript");
|
|
1534
1729
|
}
|
|
1535
1730
|
lastPartial = controller.partial;
|
|
1536
1731
|
});
|
|
@@ -1540,11 +1735,11 @@ var bindVoiceBargeIn = (controller, player, options = {}) => {
|
|
|
1540
1735
|
},
|
|
1541
1736
|
handleLevel: (level) => {
|
|
1542
1737
|
if (shouldInterruptForLevel(level, options)) {
|
|
1543
|
-
interruptIfPlaying();
|
|
1738
|
+
interruptIfPlaying("input-level");
|
|
1544
1739
|
}
|
|
1545
1740
|
},
|
|
1546
1741
|
sendAudio: (audio) => {
|
|
1547
|
-
interruptIfPlaying();
|
|
1742
|
+
interruptIfPlaying("manual-audio");
|
|
1548
1743
|
controller.sendAudio(audio);
|
|
1549
1744
|
}
|
|
1550
1745
|
};
|
|
@@ -1574,30 +1769,237 @@ var createVoiceDuplexController = (path, options = {}) => {
|
|
|
1574
1769
|
audioPlayer,
|
|
1575
1770
|
close,
|
|
1576
1771
|
interruptAssistant: async () => {
|
|
1772
|
+
options.bargeIn?.monitor?.recordRequested({
|
|
1773
|
+
reason: "manual-interrupt",
|
|
1774
|
+
sessionId: controller.sessionId
|
|
1775
|
+
});
|
|
1577
1776
|
await audioPlayer.interrupt();
|
|
1777
|
+
options.bargeIn?.monitor?.recordStopped({
|
|
1778
|
+
latencyMs: audioPlayer.lastInterruptLatencyMs,
|
|
1779
|
+
playbackStopLatencyMs: audioPlayer.lastPlaybackStopLatencyMs,
|
|
1780
|
+
reason: "manual-interrupt",
|
|
1781
|
+
sessionId: controller.sessionId
|
|
1782
|
+
});
|
|
1578
1783
|
},
|
|
1579
1784
|
sendAudio: (audio) => {
|
|
1580
1785
|
bargeInBinding?.sendAudio(audio);
|
|
1581
1786
|
}
|
|
1582
1787
|
};
|
|
1583
1788
|
};
|
|
1584
|
-
// src/client/
|
|
1585
|
-
var
|
|
1789
|
+
// src/client/bargeInMonitor.ts
|
|
1790
|
+
var DEFAULT_THRESHOLD_MS = 250;
|
|
1791
|
+
var createEventId = () => `barge-in:${Date.now()}:${crypto.randomUUID?.() ?? Math.random().toString(36).slice(2)}`;
|
|
1792
|
+
var summarize = (events, thresholdMs) => {
|
|
1793
|
+
const stopped = events.filter((event) => event.status === "stopped");
|
|
1794
|
+
const latencies = stopped.map((event) => event.latencyMs).filter((value) => typeof value === "number");
|
|
1795
|
+
const failed = stopped.filter((event) => typeof event.latencyMs === "number" && event.latencyMs > thresholdMs).length;
|
|
1796
|
+
const passed = stopped.length - failed;
|
|
1797
|
+
return {
|
|
1798
|
+
averageLatencyMs: latencies.length > 0 ? Math.round(latencies.reduce((total, value) => total + value, 0) / latencies.length) : undefined,
|
|
1799
|
+
events: [...events],
|
|
1800
|
+
failed,
|
|
1801
|
+
lastEvent: events.at(-1),
|
|
1802
|
+
passed,
|
|
1803
|
+
status: events.length === 0 ? "empty" : failed > 0 ? "fail" : stopped.length === 0 ? "warn" : "pass",
|
|
1804
|
+
thresholdMs,
|
|
1805
|
+
total: stopped.length
|
|
1806
|
+
};
|
|
1807
|
+
};
|
|
1808
|
+
var createVoiceBargeInMonitor = (options = {}) => {
|
|
1809
|
+
const listeners = new Set;
|
|
1810
|
+
const thresholdMs = options.thresholdMs ?? DEFAULT_THRESHOLD_MS;
|
|
1811
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
1812
|
+
const events = [];
|
|
1813
|
+
const emit = () => {
|
|
1814
|
+
for (const listener of listeners) {
|
|
1815
|
+
listener();
|
|
1816
|
+
}
|
|
1817
|
+
};
|
|
1818
|
+
const postEvent = (event) => {
|
|
1819
|
+
if (!options.path || typeof fetchImpl !== "function") {
|
|
1820
|
+
return;
|
|
1821
|
+
}
|
|
1822
|
+
fetchImpl(options.path, {
|
|
1823
|
+
body: JSON.stringify(event),
|
|
1824
|
+
headers: {
|
|
1825
|
+
"Content-Type": "application/json"
|
|
1826
|
+
},
|
|
1827
|
+
method: "POST"
|
|
1828
|
+
}).catch(() => {});
|
|
1829
|
+
};
|
|
1830
|
+
const record = (status, input) => {
|
|
1831
|
+
const event = {
|
|
1832
|
+
at: Date.now(),
|
|
1833
|
+
id: createEventId(),
|
|
1834
|
+
latencyMs: input.latencyMs,
|
|
1835
|
+
playbackStopLatencyMs: input.playbackStopLatencyMs,
|
|
1836
|
+
reason: input.reason,
|
|
1837
|
+
sessionId: input.sessionId,
|
|
1838
|
+
status,
|
|
1839
|
+
thresholdMs
|
|
1840
|
+
};
|
|
1841
|
+
events.push(event);
|
|
1842
|
+
postEvent(event);
|
|
1843
|
+
emit();
|
|
1844
|
+
return event;
|
|
1845
|
+
};
|
|
1846
|
+
return {
|
|
1847
|
+
getSnapshot: () => summarize(events, thresholdMs),
|
|
1848
|
+
recordRequested: (input) => record("requested", input),
|
|
1849
|
+
recordSkipped: (input) => record("skipped", input),
|
|
1850
|
+
recordStopped: (input) => record("stopped", input),
|
|
1851
|
+
subscribe: (subscriber) => {
|
|
1852
|
+
listeners.add(subscriber);
|
|
1853
|
+
return () => {
|
|
1854
|
+
listeners.delete(subscriber);
|
|
1855
|
+
};
|
|
1856
|
+
}
|
|
1857
|
+
};
|
|
1858
|
+
};
|
|
1859
|
+
// src/client/liveTurnLatency.ts
|
|
1860
|
+
var getAudioLevel = (audio) => {
|
|
1861
|
+
const bytes = audio instanceof Uint8Array ? audio : new Uint8Array(audio);
|
|
1862
|
+
if (bytes.byteLength < 2) {
|
|
1863
|
+
return 0;
|
|
1864
|
+
}
|
|
1865
|
+
const samples = new Int16Array(bytes.buffer, bytes.byteOffset, Math.floor(bytes.byteLength / 2));
|
|
1866
|
+
if (samples.length === 0) {
|
|
1867
|
+
return 0;
|
|
1868
|
+
}
|
|
1869
|
+
let sumSquares = 0;
|
|
1870
|
+
for (const sample of samples) {
|
|
1871
|
+
const normalized = sample / 32768;
|
|
1872
|
+
sumSquares += normalized * normalized;
|
|
1873
|
+
}
|
|
1874
|
+
return Math.min(1, Math.max(0, Math.sqrt(sumSquares / samples.length) * 5.5));
|
|
1875
|
+
};
|
|
1876
|
+
var createVoiceLiveTurnLatencyMonitor = (options = {}) => {
|
|
1877
|
+
const listeners = new Set;
|
|
1878
|
+
const clock = options.clock ?? (() => Date.now());
|
|
1879
|
+
const failAfterMs = options.failAfterMs ?? 3200;
|
|
1880
|
+
const maxEvents = options.maxEvents ?? 20;
|
|
1881
|
+
const speechThreshold = options.speechThreshold ?? 0.04;
|
|
1882
|
+
const warnAfterMs = options.warnAfterMs ?? 1800;
|
|
1883
|
+
let events = [];
|
|
1884
|
+
let pending;
|
|
1885
|
+
let lastAudioCount = 0;
|
|
1886
|
+
let lastTextCount = 0;
|
|
1887
|
+
let lastSessionId;
|
|
1888
|
+
const emit = () => {
|
|
1889
|
+
for (const listener of listeners) {
|
|
1890
|
+
listener();
|
|
1891
|
+
}
|
|
1892
|
+
};
|
|
1893
|
+
const reportCompletedEvent = async (event) => {
|
|
1894
|
+
await options.onComplete?.(event);
|
|
1895
|
+
if (!options.reportPath) {
|
|
1896
|
+
return;
|
|
1897
|
+
}
|
|
1898
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
1899
|
+
const response = await fetchImpl(options.reportPath, {
|
|
1900
|
+
body: JSON.stringify(event),
|
|
1901
|
+
headers: {
|
|
1902
|
+
"content-type": "application/json"
|
|
1903
|
+
},
|
|
1904
|
+
method: "POST"
|
|
1905
|
+
});
|
|
1906
|
+
if (!response.ok) {
|
|
1907
|
+
throw new Error(`Voice live turn latency report failed: HTTP ${response.status}`);
|
|
1908
|
+
}
|
|
1909
|
+
};
|
|
1910
|
+
const completePending = (input) => {
|
|
1911
|
+
if (!pending) {
|
|
1912
|
+
return;
|
|
1913
|
+
}
|
|
1914
|
+
const completedAt = input.assistantAudioAt ?? input.assistantTextAt ?? clock();
|
|
1915
|
+
const latencyMs = Math.max(0, completedAt - pending.startedAt);
|
|
1916
|
+
const status = latencyMs > failAfterMs ? "fail" : latencyMs > warnAfterMs ? "warn" : "pass";
|
|
1917
|
+
pending = {
|
|
1918
|
+
...pending,
|
|
1919
|
+
...input,
|
|
1920
|
+
completedAt,
|
|
1921
|
+
latencyMs,
|
|
1922
|
+
status
|
|
1923
|
+
};
|
|
1924
|
+
events = [pending, ...events].slice(0, maxEvents);
|
|
1925
|
+
reportCompletedEvent(pending).catch(() => {});
|
|
1926
|
+
pending = undefined;
|
|
1927
|
+
emit();
|
|
1928
|
+
};
|
|
1929
|
+
const observe = (state) => {
|
|
1930
|
+
const now = clock();
|
|
1931
|
+
if (pending) {
|
|
1932
|
+
if (state.assistantAudio.length > lastAudioCount) {
|
|
1933
|
+
completePending({ assistantAudioAt: now });
|
|
1934
|
+
} else if (state.assistantTexts.length > lastTextCount) {
|
|
1935
|
+
completePending({ assistantTextAt: now });
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
lastAudioCount = state.assistantAudio.length;
|
|
1939
|
+
lastTextCount = state.assistantTexts.length;
|
|
1940
|
+
lastSessionId = state.sessionId;
|
|
1941
|
+
};
|
|
1942
|
+
const recordAudio = (audio) => {
|
|
1943
|
+
if (pending || getAudioLevel(audio) < speechThreshold) {
|
|
1944
|
+
return pending;
|
|
1945
|
+
}
|
|
1946
|
+
pending = {
|
|
1947
|
+
id: `live-turn-${crypto.randomUUID()}`,
|
|
1948
|
+
sessionId: lastSessionId ?? null,
|
|
1949
|
+
startedAt: clock(),
|
|
1950
|
+
status: "pending",
|
|
1951
|
+
thresholdMs: failAfterMs
|
|
1952
|
+
};
|
|
1953
|
+
emit();
|
|
1954
|
+
return pending;
|
|
1955
|
+
};
|
|
1956
|
+
const getSnapshot = () => {
|
|
1957
|
+
const completed = events.filter((event) => typeof event.latencyMs === "number");
|
|
1958
|
+
const latencies = completed.map((event) => event.latencyMs);
|
|
1959
|
+
const failed = events.filter((event) => event.status === "fail").length;
|
|
1960
|
+
const warnings = events.filter((event) => event.status === "warn").length;
|
|
1961
|
+
const passed = events.filter((event) => event.status === "pass").length;
|
|
1962
|
+
return {
|
|
1963
|
+
averageLatencyMs: latencies.length ? Math.round(latencies.reduce((total, value) => total + value, 0) / latencies.length) : undefined,
|
|
1964
|
+
events,
|
|
1965
|
+
failed,
|
|
1966
|
+
lastEvent: events[0],
|
|
1967
|
+
passed,
|
|
1968
|
+
pending,
|
|
1969
|
+
status: pending ? "pending" : events.length === 0 ? "empty" : failed > 0 ? "fail" : warnings > 0 ? "warn" : "pass",
|
|
1970
|
+
thresholdMs: failAfterMs,
|
|
1971
|
+
total: events.length,
|
|
1972
|
+
warnings
|
|
1973
|
+
};
|
|
1974
|
+
};
|
|
1975
|
+
return {
|
|
1976
|
+
getSnapshot,
|
|
1977
|
+
observe,
|
|
1978
|
+
recordAudio,
|
|
1979
|
+
subscribe: (listener) => {
|
|
1980
|
+
listeners.add(listener);
|
|
1981
|
+
return () => {
|
|
1982
|
+
listeners.delete(listener);
|
|
1983
|
+
};
|
|
1984
|
+
}
|
|
1985
|
+
};
|
|
1986
|
+
};
|
|
1987
|
+
// src/client/opsStatus.ts
|
|
1988
|
+
var fetchVoiceOpsStatus = async (path = "/api/voice/ops-status", options = {}) => {
|
|
1586
1989
|
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
1587
1990
|
const response = await fetchImpl(path);
|
|
1588
1991
|
if (!response.ok) {
|
|
1589
|
-
throw new Error(`Voice
|
|
1992
|
+
throw new Error(`Voice ops status failed: HTTP ${response.status}`);
|
|
1590
1993
|
}
|
|
1591
1994
|
return await response.json();
|
|
1592
1995
|
};
|
|
1593
|
-
var
|
|
1996
|
+
var createVoiceOpsStatusStore = (path = "/api/voice/ops-status", options = {}) => {
|
|
1594
1997
|
const listeners = new Set;
|
|
1595
1998
|
let closed = false;
|
|
1596
1999
|
let timer;
|
|
1597
2000
|
let snapshot = {
|
|
1598
2001
|
error: null,
|
|
1599
|
-
isLoading: false
|
|
1600
|
-
providers: []
|
|
2002
|
+
isLoading: false
|
|
1601
2003
|
};
|
|
1602
2004
|
const emit = () => {
|
|
1603
2005
|
for (const listener of listeners) {
|
|
@@ -1606,7 +2008,7 @@ var createVoiceProviderStatusStore = (path = "/api/provider-status", options = {
|
|
|
1606
2008
|
};
|
|
1607
2009
|
const refresh = async () => {
|
|
1608
2010
|
if (closed) {
|
|
1609
|
-
return snapshot.
|
|
2011
|
+
return snapshot.report;
|
|
1610
2012
|
}
|
|
1611
2013
|
snapshot = {
|
|
1612
2014
|
...snapshot,
|
|
@@ -1615,15 +2017,15 @@ var createVoiceProviderStatusStore = (path = "/api/provider-status", options = {
|
|
|
1615
2017
|
};
|
|
1616
2018
|
emit();
|
|
1617
2019
|
try {
|
|
1618
|
-
const
|
|
2020
|
+
const report = await fetchVoiceOpsStatus(path, options);
|
|
1619
2021
|
snapshot = {
|
|
1620
2022
|
error: null,
|
|
1621
2023
|
isLoading: false,
|
|
1622
|
-
|
|
2024
|
+
report,
|
|
1623
2025
|
updatedAt: Date.now()
|
|
1624
2026
|
};
|
|
1625
2027
|
emit();
|
|
1626
|
-
return
|
|
2028
|
+
return report;
|
|
1627
2029
|
} catch (error) {
|
|
1628
2030
|
snapshot = {
|
|
1629
2031
|
...snapshot,
|
|
@@ -1642,7 +2044,2439 @@ var createVoiceProviderStatusStore = (path = "/api/provider-status", options = {
|
|
|
1642
2044
|
}
|
|
1643
2045
|
listeners.clear();
|
|
1644
2046
|
};
|
|
2047
|
+
if (typeof window !== "undefined" && options.intervalMs && options.intervalMs > 0) {
|
|
2048
|
+
timer = setInterval(() => {
|
|
2049
|
+
refresh().catch(() => {});
|
|
2050
|
+
}, options.intervalMs);
|
|
2051
|
+
}
|
|
2052
|
+
return {
|
|
2053
|
+
close,
|
|
2054
|
+
getServerSnapshot: () => snapshot,
|
|
2055
|
+
getSnapshot: () => snapshot,
|
|
2056
|
+
refresh,
|
|
2057
|
+
subscribe: (listener) => {
|
|
2058
|
+
listeners.add(listener);
|
|
2059
|
+
return () => {
|
|
2060
|
+
listeners.delete(listener);
|
|
2061
|
+
};
|
|
2062
|
+
}
|
|
2063
|
+
};
|
|
2064
|
+
};
|
|
2065
|
+
// src/client/opsActionCenter.ts
|
|
2066
|
+
var recordVoiceOpsActionResult = async (result, options = {}) => {
|
|
2067
|
+
if (options.auditPath === false) {
|
|
2068
|
+
return;
|
|
2069
|
+
}
|
|
2070
|
+
const path = options.auditPath ?? "/api/voice/ops-actions/audit";
|
|
2071
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
2072
|
+
const response = await fetchImpl(path, {
|
|
2073
|
+
body: JSON.stringify(result),
|
|
2074
|
+
headers: {
|
|
2075
|
+
"Content-Type": "application/json"
|
|
2076
|
+
},
|
|
2077
|
+
method: "POST"
|
|
2078
|
+
});
|
|
2079
|
+
if (!response.ok) {
|
|
2080
|
+
throw new Error(`Voice ops action audit failed: HTTP ${response.status}`);
|
|
2081
|
+
}
|
|
2082
|
+
};
|
|
2083
|
+
var createVoiceOpsActionCenterActions = (options = {}) => {
|
|
2084
|
+
const deliveryRuntimePath = options.deliveryRuntimePath ?? "/api/voice-delivery-runtime";
|
|
2085
|
+
const actions = [];
|
|
2086
|
+
if (options.includeProductionReadiness !== false) {
|
|
2087
|
+
actions.push({
|
|
2088
|
+
description: "Refresh the production readiness report.",
|
|
2089
|
+
id: "production-readiness",
|
|
2090
|
+
label: "Refresh readiness",
|
|
2091
|
+
method: "GET",
|
|
2092
|
+
path: options.productionReadinessPath ?? "/api/production-readiness"
|
|
2093
|
+
});
|
|
2094
|
+
}
|
|
2095
|
+
if (options.includeDeliveryRuntime !== false) {
|
|
2096
|
+
actions.push({
|
|
2097
|
+
description: "Drain pending and failed audit/trace deliveries.",
|
|
2098
|
+
id: "delivery-runtime.tick",
|
|
2099
|
+
label: "Tick delivery workers",
|
|
2100
|
+
method: "POST",
|
|
2101
|
+
path: `${deliveryRuntimePath.replace(/\/$/, "")}/tick`
|
|
2102
|
+
}, {
|
|
2103
|
+
description: "Move reviewed dead letters back to live delivery queues.",
|
|
2104
|
+
id: "delivery-runtime.requeue-dead-letters",
|
|
2105
|
+
label: "Requeue dead letters",
|
|
2106
|
+
method: "POST",
|
|
2107
|
+
path: `${deliveryRuntimePath.replace(/\/$/, "")}/requeue-dead-letters`
|
|
2108
|
+
});
|
|
2109
|
+
}
|
|
2110
|
+
if (options.includeTurnLatencyProof !== false) {
|
|
2111
|
+
actions.push({
|
|
2112
|
+
description: "Run the synthetic turn latency proof.",
|
|
2113
|
+
id: "turn-latency.proof",
|
|
2114
|
+
label: "Run latency proof",
|
|
2115
|
+
method: "POST",
|
|
2116
|
+
path: options.turnLatencyProofPath ?? "/api/turn-latency/proof"
|
|
2117
|
+
});
|
|
2118
|
+
}
|
|
2119
|
+
if (options.includeProviderSimulation !== false) {
|
|
2120
|
+
const pathPrefix = options.providerSimulationPathPrefix ?? "/api/stt-simulate";
|
|
2121
|
+
for (const provider of options.providers ?? []) {
|
|
2122
|
+
actions.push({
|
|
2123
|
+
description: `Simulate ${provider} provider failure.`,
|
|
2124
|
+
id: `provider.${provider}.failure`,
|
|
2125
|
+
label: `Simulate ${provider} failure`,
|
|
2126
|
+
method: "POST",
|
|
2127
|
+
path: `${pathPrefix}/failure?provider=${encodeURIComponent(provider)}`
|
|
2128
|
+
}, {
|
|
2129
|
+
description: `Mark ${provider} provider recovered.`,
|
|
2130
|
+
id: `provider.${provider}.recovery`,
|
|
2131
|
+
label: `Recover ${provider}`,
|
|
2132
|
+
method: "POST",
|
|
2133
|
+
path: `${pathPrefix}/recovery?provider=${encodeURIComponent(provider)}`
|
|
2134
|
+
});
|
|
2135
|
+
}
|
|
2136
|
+
}
|
|
2137
|
+
return actions;
|
|
2138
|
+
};
|
|
2139
|
+
var runVoiceOpsAction = async (action, options = {}) => {
|
|
2140
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
2141
|
+
const response = await fetchImpl(action.path, {
|
|
2142
|
+
method: action.method ?? "POST"
|
|
2143
|
+
});
|
|
2144
|
+
const body = await response.json().catch(() => null);
|
|
2145
|
+
if (!response.ok) {
|
|
2146
|
+
const message = body && typeof body === "object" && "error" in body ? String(body.error) : `Voice ops action "${action.id}" failed: HTTP ${response.status}`;
|
|
2147
|
+
throw new Error(message);
|
|
2148
|
+
}
|
|
2149
|
+
return {
|
|
2150
|
+
actionId: action.id,
|
|
2151
|
+
body,
|
|
2152
|
+
ok: response.ok,
|
|
2153
|
+
ranAt: Date.now(),
|
|
2154
|
+
status: response.status
|
|
2155
|
+
};
|
|
2156
|
+
};
|
|
2157
|
+
var createVoiceOpsActionCenterStore = (options = {}) => {
|
|
2158
|
+
const listeners = new Set;
|
|
2159
|
+
let closed = false;
|
|
2160
|
+
let timer;
|
|
2161
|
+
let snapshot = {
|
|
2162
|
+
actions: options.actions ?? createVoiceOpsActionCenterActions(),
|
|
2163
|
+
error: null,
|
|
2164
|
+
isRunning: false
|
|
2165
|
+
};
|
|
2166
|
+
const emit = () => {
|
|
2167
|
+
for (const listener of listeners) {
|
|
2168
|
+
listener();
|
|
2169
|
+
}
|
|
2170
|
+
};
|
|
2171
|
+
const setActions = (actions) => {
|
|
2172
|
+
snapshot = { ...snapshot, actions, updatedAt: Date.now() };
|
|
2173
|
+
emit();
|
|
2174
|
+
};
|
|
2175
|
+
const run = async (actionId) => {
|
|
2176
|
+
if (closed) {
|
|
2177
|
+
return snapshot.lastResult;
|
|
2178
|
+
}
|
|
2179
|
+
const action = snapshot.actions.find((item) => item.id === actionId);
|
|
2180
|
+
if (!action) {
|
|
2181
|
+
throw new Error(`Voice ops action "${actionId}" is not configured.`);
|
|
2182
|
+
}
|
|
2183
|
+
if (action.disabled) {
|
|
2184
|
+
throw new Error(`Voice ops action "${actionId}" is disabled.`);
|
|
2185
|
+
}
|
|
2186
|
+
snapshot = {
|
|
2187
|
+
...snapshot,
|
|
2188
|
+
error: null,
|
|
2189
|
+
isRunning: true,
|
|
2190
|
+
runningActionId: action.id
|
|
2191
|
+
};
|
|
2192
|
+
emit();
|
|
2193
|
+
try {
|
|
2194
|
+
const result = await runVoiceOpsAction(action, options);
|
|
2195
|
+
await options.onActionResult?.(result);
|
|
2196
|
+
await recordVoiceOpsActionResult(result, options);
|
|
2197
|
+
snapshot = {
|
|
2198
|
+
...snapshot,
|
|
2199
|
+
error: null,
|
|
2200
|
+
isRunning: false,
|
|
2201
|
+
lastResult: result,
|
|
2202
|
+
runningActionId: undefined,
|
|
2203
|
+
updatedAt: Date.now()
|
|
2204
|
+
};
|
|
2205
|
+
emit();
|
|
2206
|
+
return result;
|
|
2207
|
+
} catch (error) {
|
|
2208
|
+
const result = {
|
|
2209
|
+
actionId: action.id,
|
|
2210
|
+
body: null,
|
|
2211
|
+
error: error instanceof Error ? error.message : String(error),
|
|
2212
|
+
ok: false,
|
|
2213
|
+
ranAt: Date.now(),
|
|
2214
|
+
status: 0
|
|
2215
|
+
};
|
|
2216
|
+
await options.onActionResult?.(result);
|
|
2217
|
+
await recordVoiceOpsActionResult(result, options).catch(() => {});
|
|
2218
|
+
snapshot = {
|
|
2219
|
+
...snapshot,
|
|
2220
|
+
error: error instanceof Error ? error.message : String(error),
|
|
2221
|
+
isRunning: false,
|
|
2222
|
+
runningActionId: undefined
|
|
2223
|
+
};
|
|
2224
|
+
emit();
|
|
2225
|
+
throw error;
|
|
2226
|
+
}
|
|
2227
|
+
};
|
|
2228
|
+
const close = () => {
|
|
2229
|
+
closed = true;
|
|
2230
|
+
if (timer) {
|
|
2231
|
+
clearInterval(timer);
|
|
2232
|
+
timer = undefined;
|
|
2233
|
+
}
|
|
2234
|
+
listeners.clear();
|
|
2235
|
+
};
|
|
1645
2236
|
if (options.intervalMs && options.intervalMs > 0) {
|
|
2237
|
+
timer = setInterval(() => {
|
|
2238
|
+
emit();
|
|
2239
|
+
}, options.intervalMs);
|
|
2240
|
+
}
|
|
2241
|
+
return {
|
|
2242
|
+
close,
|
|
2243
|
+
getServerSnapshot: () => snapshot,
|
|
2244
|
+
getSnapshot: () => snapshot,
|
|
2245
|
+
run,
|
|
2246
|
+
setActions,
|
|
2247
|
+
subscribe: (listener) => {
|
|
2248
|
+
listeners.add(listener);
|
|
2249
|
+
return () => {
|
|
2250
|
+
listeners.delete(listener);
|
|
2251
|
+
};
|
|
2252
|
+
}
|
|
2253
|
+
};
|
|
2254
|
+
};
|
|
2255
|
+
// src/client/opsActionHistory.ts
|
|
2256
|
+
var fetchVoiceOpsActionHistory = async (path = "/api/voice/ops-actions/history", options = {}) => {
|
|
2257
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
2258
|
+
const response = await fetchImpl(path);
|
|
2259
|
+
if (!response.ok) {
|
|
2260
|
+
throw new Error(`Voice ops action history failed: HTTP ${response.status}`);
|
|
2261
|
+
}
|
|
2262
|
+
return await response.json();
|
|
2263
|
+
};
|
|
2264
|
+
var createVoiceOpsActionHistoryStore = (path = "/api/voice/ops-actions/history", options = {}) => {
|
|
2265
|
+
const listeners = new Set;
|
|
2266
|
+
let closed = false;
|
|
2267
|
+
let timer;
|
|
2268
|
+
let snapshot = {
|
|
2269
|
+
error: null,
|
|
2270
|
+
isLoading: false
|
|
2271
|
+
};
|
|
2272
|
+
const emit = () => {
|
|
2273
|
+
for (const listener of listeners) {
|
|
2274
|
+
listener();
|
|
2275
|
+
}
|
|
2276
|
+
};
|
|
2277
|
+
const refresh = async () => {
|
|
2278
|
+
if (closed) {
|
|
2279
|
+
return snapshot.report;
|
|
2280
|
+
}
|
|
2281
|
+
snapshot = { ...snapshot, error: null, isLoading: true };
|
|
2282
|
+
emit();
|
|
2283
|
+
try {
|
|
2284
|
+
const report = await fetchVoiceOpsActionHistory(path, options);
|
|
2285
|
+
snapshot = {
|
|
2286
|
+
error: null,
|
|
2287
|
+
isLoading: false,
|
|
2288
|
+
report,
|
|
2289
|
+
updatedAt: Date.now()
|
|
2290
|
+
};
|
|
2291
|
+
emit();
|
|
2292
|
+
return report;
|
|
2293
|
+
} catch (error) {
|
|
2294
|
+
snapshot = {
|
|
2295
|
+
...snapshot,
|
|
2296
|
+
error: error instanceof Error ? error.message : String(error),
|
|
2297
|
+
isLoading: false
|
|
2298
|
+
};
|
|
2299
|
+
emit();
|
|
2300
|
+
throw error;
|
|
2301
|
+
}
|
|
2302
|
+
};
|
|
2303
|
+
const close = () => {
|
|
2304
|
+
closed = true;
|
|
2305
|
+
if (timer) {
|
|
2306
|
+
clearInterval(timer);
|
|
2307
|
+
timer = undefined;
|
|
2308
|
+
}
|
|
2309
|
+
listeners.clear();
|
|
2310
|
+
};
|
|
2311
|
+
if (options.intervalMs && options.intervalMs > 0) {
|
|
2312
|
+
timer = setInterval(() => {
|
|
2313
|
+
refresh().catch(() => {});
|
|
2314
|
+
}, options.intervalMs);
|
|
2315
|
+
}
|
|
2316
|
+
return {
|
|
2317
|
+
close,
|
|
2318
|
+
getServerSnapshot: () => snapshot,
|
|
2319
|
+
getSnapshot: () => snapshot,
|
|
2320
|
+
refresh,
|
|
2321
|
+
subscribe: (listener) => {
|
|
2322
|
+
listeners.add(listener);
|
|
2323
|
+
return () => {
|
|
2324
|
+
listeners.delete(listener);
|
|
2325
|
+
};
|
|
2326
|
+
}
|
|
2327
|
+
};
|
|
2328
|
+
};
|
|
2329
|
+
// src/client/deliveryRuntime.ts
|
|
2330
|
+
var getDefaultActionPath = (path, action, options) => {
|
|
2331
|
+
if (action === "tick") {
|
|
2332
|
+
return options.tickPath ?? `${path.replace(/\/$/, "")}/tick`;
|
|
2333
|
+
}
|
|
2334
|
+
return options.requeueDeadLettersPath ?? `${path.replace(/\/$/, "")}/requeue-dead-letters`;
|
|
2335
|
+
};
|
|
2336
|
+
var fetchVoiceDeliveryRuntime = async (path = "/api/voice-delivery-runtime", options = {}) => {
|
|
2337
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
2338
|
+
const response = await fetchImpl(path);
|
|
2339
|
+
if (!response.ok) {
|
|
2340
|
+
throw new Error(`Voice delivery runtime failed: HTTP ${response.status}`);
|
|
2341
|
+
}
|
|
2342
|
+
return await response.json();
|
|
2343
|
+
};
|
|
2344
|
+
var runVoiceDeliveryRuntimeAction = async (action, path = "/api/voice-delivery-runtime", options = {}) => {
|
|
2345
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
2346
|
+
const response = await fetchImpl(getDefaultActionPath(path, action, options), {
|
|
2347
|
+
method: "POST"
|
|
2348
|
+
});
|
|
2349
|
+
if (!response.ok) {
|
|
2350
|
+
throw new Error(`Voice delivery runtime ${action} failed: HTTP ${response.status}`);
|
|
2351
|
+
}
|
|
2352
|
+
const body = await response.json();
|
|
2353
|
+
return {
|
|
2354
|
+
action,
|
|
2355
|
+
result: body.result,
|
|
2356
|
+
summary: body.summary,
|
|
2357
|
+
updatedAt: Date.now()
|
|
2358
|
+
};
|
|
2359
|
+
};
|
|
2360
|
+
var createVoiceDeliveryRuntimeStore = (path = "/api/voice-delivery-runtime", options = {}) => {
|
|
2361
|
+
const listeners = new Set;
|
|
2362
|
+
let closed = false;
|
|
2363
|
+
let timer;
|
|
2364
|
+
let snapshot = {
|
|
2365
|
+
actionError: null,
|
|
2366
|
+
actionStatus: "idle",
|
|
2367
|
+
error: null,
|
|
2368
|
+
isLoading: false
|
|
2369
|
+
};
|
|
2370
|
+
const emit = () => {
|
|
2371
|
+
for (const listener of listeners) {
|
|
2372
|
+
listener();
|
|
2373
|
+
}
|
|
2374
|
+
};
|
|
2375
|
+
const refresh = async () => {
|
|
2376
|
+
if (closed) {
|
|
2377
|
+
return snapshot.report;
|
|
2378
|
+
}
|
|
2379
|
+
snapshot = {
|
|
2380
|
+
...snapshot,
|
|
2381
|
+
error: null,
|
|
2382
|
+
isLoading: true
|
|
2383
|
+
};
|
|
2384
|
+
emit();
|
|
2385
|
+
try {
|
|
2386
|
+
const report = await fetchVoiceDeliveryRuntime(path, options);
|
|
2387
|
+
snapshot = {
|
|
2388
|
+
...snapshot,
|
|
2389
|
+
error: null,
|
|
2390
|
+
isLoading: false,
|
|
2391
|
+
report,
|
|
2392
|
+
updatedAt: Date.now()
|
|
2393
|
+
};
|
|
2394
|
+
emit();
|
|
2395
|
+
return report;
|
|
2396
|
+
} catch (error) {
|
|
2397
|
+
snapshot = {
|
|
2398
|
+
...snapshot,
|
|
2399
|
+
error: error instanceof Error ? error.message : String(error),
|
|
2400
|
+
isLoading: false
|
|
2401
|
+
};
|
|
2402
|
+
emit();
|
|
2403
|
+
throw error;
|
|
2404
|
+
}
|
|
2405
|
+
};
|
|
2406
|
+
const runAction = async (action) => {
|
|
2407
|
+
if (closed) {
|
|
2408
|
+
return snapshot.lastAction;
|
|
2409
|
+
}
|
|
2410
|
+
snapshot = {
|
|
2411
|
+
...snapshot,
|
|
2412
|
+
actionError: null,
|
|
2413
|
+
actionStatus: "running"
|
|
2414
|
+
};
|
|
2415
|
+
emit();
|
|
2416
|
+
try {
|
|
2417
|
+
const result = await runVoiceDeliveryRuntimeAction(action, path, options);
|
|
2418
|
+
snapshot = {
|
|
2419
|
+
...snapshot,
|
|
2420
|
+
actionError: null,
|
|
2421
|
+
actionStatus: "completed",
|
|
2422
|
+
lastAction: result
|
|
2423
|
+
};
|
|
2424
|
+
emit();
|
|
2425
|
+
await refresh();
|
|
2426
|
+
return result;
|
|
2427
|
+
} catch (error) {
|
|
2428
|
+
snapshot = {
|
|
2429
|
+
...snapshot,
|
|
2430
|
+
actionError: error instanceof Error ? error.message : String(error),
|
|
2431
|
+
actionStatus: "failed"
|
|
2432
|
+
};
|
|
2433
|
+
emit();
|
|
2434
|
+
throw error;
|
|
2435
|
+
}
|
|
2436
|
+
};
|
|
2437
|
+
const close = () => {
|
|
2438
|
+
closed = true;
|
|
2439
|
+
if (timer) {
|
|
2440
|
+
clearInterval(timer);
|
|
2441
|
+
timer = undefined;
|
|
2442
|
+
}
|
|
2443
|
+
listeners.clear();
|
|
2444
|
+
};
|
|
2445
|
+
if (typeof window !== "undefined" && options.intervalMs && options.intervalMs > 0) {
|
|
2446
|
+
timer = setInterval(() => {
|
|
2447
|
+
refresh().catch(() => {});
|
|
2448
|
+
}, options.intervalMs);
|
|
2449
|
+
}
|
|
2450
|
+
return {
|
|
2451
|
+
close,
|
|
2452
|
+
getServerSnapshot: () => snapshot,
|
|
2453
|
+
getSnapshot: () => snapshot,
|
|
2454
|
+
requeueDeadLetters: () => runAction("requeue-dead-letters"),
|
|
2455
|
+
refresh,
|
|
2456
|
+
tick: () => runAction("tick"),
|
|
2457
|
+
subscribe: (listener) => {
|
|
2458
|
+
listeners.add(listener);
|
|
2459
|
+
return () => {
|
|
2460
|
+
listeners.delete(listener);
|
|
2461
|
+
};
|
|
2462
|
+
}
|
|
2463
|
+
};
|
|
2464
|
+
};
|
|
2465
|
+
// src/client/opsStatusWidget.ts
|
|
2466
|
+
var DEFAULT_TITLE = "Voice Ops Status";
|
|
2467
|
+
var DEFAULT_DESCRIPTION = "Certified workflow, provider, and handoff readiness from your AbsoluteJS voice app.";
|
|
2468
|
+
var SURFACE_LABELS = {
|
|
2469
|
+
handoffs: "Handoffs",
|
|
2470
|
+
providers: "Providers",
|
|
2471
|
+
quality: "Quality",
|
|
2472
|
+
sessions: "Sessions",
|
|
2473
|
+
workflows: "Workflows"
|
|
2474
|
+
};
|
|
2475
|
+
var escapeHtml = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
2476
|
+
var readNumber = (value, key) => value && typeof value === "object" && (key in value) ? Number(value[key] ?? 0) : 0;
|
|
2477
|
+
var surfaceDetail = (surface) => {
|
|
2478
|
+
const total = readNumber(surface, "total");
|
|
2479
|
+
const failed = readNumber(surface, "failed");
|
|
2480
|
+
const degraded = readNumber(surface, "degraded");
|
|
2481
|
+
const source = surface && typeof surface === "object" && "source" in surface && typeof surface.source === "string" ? ` from ${surface.source}` : "";
|
|
2482
|
+
if (degraded > 0) {
|
|
2483
|
+
return `${degraded} degraded of ${total}`;
|
|
2484
|
+
}
|
|
2485
|
+
if (failed > 0) {
|
|
2486
|
+
return `${failed} failing of ${total}${source}`;
|
|
2487
|
+
}
|
|
2488
|
+
return total > 0 ? `${total} passing${source}` : `No failures${source}`;
|
|
2489
|
+
};
|
|
2490
|
+
var getVoiceOpsStatusLabel = (report, error) => {
|
|
2491
|
+
if (error) {
|
|
2492
|
+
return "Unavailable";
|
|
2493
|
+
}
|
|
2494
|
+
if (!report) {
|
|
2495
|
+
return "Checking";
|
|
2496
|
+
}
|
|
2497
|
+
return report.status === "pass" ? "Passing" : "Needs attention";
|
|
2498
|
+
};
|
|
2499
|
+
var createVoiceOpsStatusViewModel = (snapshot, options = {}) => {
|
|
2500
|
+
const report = snapshot.report;
|
|
2501
|
+
const surfaces = Object.entries(report?.surfaces ?? {}).map(([id, surface]) => {
|
|
2502
|
+
const failed = readNumber(surface, "failed") || readNumber(surface, "degraded");
|
|
2503
|
+
const total = readNumber(surface, "total");
|
|
2504
|
+
const status = surface && typeof surface === "object" && "status" in surface ? surface.status ?? "pass" : "pass";
|
|
2505
|
+
return {
|
|
2506
|
+
detail: surfaceDetail(surface),
|
|
2507
|
+
failed,
|
|
2508
|
+
id,
|
|
2509
|
+
label: SURFACE_LABELS[id] ?? id,
|
|
2510
|
+
status,
|
|
2511
|
+
total
|
|
2512
|
+
};
|
|
2513
|
+
});
|
|
2514
|
+
return {
|
|
2515
|
+
description: options.description ?? DEFAULT_DESCRIPTION,
|
|
2516
|
+
error: snapshot.error,
|
|
2517
|
+
isLoading: snapshot.isLoading,
|
|
2518
|
+
label: getVoiceOpsStatusLabel(report, snapshot.error),
|
|
2519
|
+
links: options.includeLinks === false ? [] : report?.links ?? [],
|
|
2520
|
+
passed: report?.passed ?? 0,
|
|
2521
|
+
status: snapshot.error ? "error" : report ? report.status : snapshot.isLoading ? "loading" : "loading",
|
|
2522
|
+
surfaces,
|
|
2523
|
+
title: options.title ?? DEFAULT_TITLE,
|
|
2524
|
+
total: report?.total ?? 0,
|
|
2525
|
+
updatedAt: snapshot.updatedAt
|
|
2526
|
+
};
|
|
2527
|
+
};
|
|
2528
|
+
var renderVoiceOpsStatusHTML = (snapshot, options = {}) => {
|
|
2529
|
+
const model = createVoiceOpsStatusViewModel(snapshot, options);
|
|
2530
|
+
const surfaces = model.surfaces.length ? model.surfaces.map((surface) => `<li class="absolute-voice-ops-status__surface absolute-voice-ops-status__surface--${escapeHtml(surface.status)}">
|
|
2531
|
+
<span>${escapeHtml(surface.label)}</span>
|
|
2532
|
+
<strong>${escapeHtml(surface.detail)}</strong>
|
|
2533
|
+
</li>`).join("") : '<li class="absolute-voice-ops-status__surface"><span>Status</span><strong>Waiting for first check</strong></li>';
|
|
2534
|
+
const links = model.links.length ? `<nav class="absolute-voice-ops-status__links">${model.links.slice(0, 4).map((link) => `<a href="${escapeHtml(link.href)}">${escapeHtml(link.label)}</a>`).join("")}</nav>` : "";
|
|
2535
|
+
return `<section class="absolute-voice-ops-status absolute-voice-ops-status--${escapeHtml(model.status)}">
|
|
2536
|
+
<header class="absolute-voice-ops-status__header">
|
|
2537
|
+
<span class="absolute-voice-ops-status__eyebrow">${escapeHtml(model.title)}</span>
|
|
2538
|
+
<strong class="absolute-voice-ops-status__label">${escapeHtml(model.label)}</strong>
|
|
2539
|
+
</header>
|
|
2540
|
+
<p class="absolute-voice-ops-status__description">${escapeHtml(model.description)}</p>
|
|
2541
|
+
<div class="absolute-voice-ops-status__summary">
|
|
2542
|
+
<span>${model.passed} passing</span>
|
|
2543
|
+
<span>${Math.max(model.total - model.passed, 0)} failing</span>
|
|
2544
|
+
<span>${model.total} checks</span>
|
|
2545
|
+
</div>
|
|
2546
|
+
<ul class="absolute-voice-ops-status__surfaces">${surfaces}</ul>
|
|
2547
|
+
${model.error ? `<p class="absolute-voice-ops-status__error">${escapeHtml(model.error)}</p>` : ""}
|
|
2548
|
+
${links}
|
|
2549
|
+
</section>`;
|
|
2550
|
+
};
|
|
2551
|
+
var getVoiceOpsStatusCSS = () => `.absolute-voice-ops-status{border:1px solid #d8d2c4;border-radius:20px;background:#fffaf0;color:#16130d;padding:18px;box-shadow:0 18px 40px rgba(47,37,18,.12);font-family:inherit}.absolute-voice-ops-status--fail,.absolute-voice-ops-status--error{border-color:#f2a7a7;background:#fff5f3}.absolute-voice-ops-status__header{align-items:start;display:flex;gap:12px;justify-content:space-between}.absolute-voice-ops-status__eyebrow{color:#73664f;font-size:12px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}.absolute-voice-ops-status__label{font-size:28px;line-height:1}.absolute-voice-ops-status__description{color:#514733;margin:12px 0 0}.absolute-voice-ops-status__summary,.absolute-voice-ops-status__links{display:flex;flex-wrap:wrap;gap:8px;margin-top:14px}.absolute-voice-ops-status__summary span,.absolute-voice-ops-status__links a{border:1px solid #e6ddca;border-radius:999px;color:inherit;padding:6px 10px;text-decoration:none}.absolute-voice-ops-status__surfaces{display:grid;gap:8px;list-style:none;margin:16px 0 0;padding:0}.absolute-voice-ops-status__surface{align-items:center;background:#fff;border:1px solid #eee4d2;border-radius:14px;display:flex;gap:12px;justify-content:space-between;padding:10px 12px}.absolute-voice-ops-status__surface--fail{border-color:#f2a7a7}.absolute-voice-ops-status__surface span{color:#655944}.absolute-voice-ops-status__error{color:#9f1239;font-weight:700}`;
|
|
2552
|
+
var mountVoiceOpsStatus = (element, path = "/api/voice/ops-status", options = {}) => {
|
|
2553
|
+
const store = createVoiceOpsStatusStore(path, options);
|
|
2554
|
+
const render = () => {
|
|
2555
|
+
element.innerHTML = renderVoiceOpsStatusHTML(store.getSnapshot(), options);
|
|
2556
|
+
};
|
|
2557
|
+
const unsubscribe = store.subscribe(render);
|
|
2558
|
+
render();
|
|
2559
|
+
store.refresh().catch(() => {});
|
|
2560
|
+
return {
|
|
2561
|
+
close: () => {
|
|
2562
|
+
unsubscribe();
|
|
2563
|
+
store.close();
|
|
2564
|
+
},
|
|
2565
|
+
refresh: store.refresh
|
|
2566
|
+
};
|
|
2567
|
+
};
|
|
2568
|
+
var defineVoiceOpsStatusElement = (tagName = "absolute-voice-ops-status") => {
|
|
2569
|
+
if (typeof window === "undefined" || typeof customElements === "undefined" || customElements.get(tagName)) {
|
|
2570
|
+
return;
|
|
2571
|
+
}
|
|
2572
|
+
customElements.define(tagName, class AbsoluteVoiceOpsStatusElement extends HTMLElement {
|
|
2573
|
+
mounted;
|
|
2574
|
+
connectedCallback() {
|
|
2575
|
+
const intervalMs = Number(this.getAttribute("interval-ms") ?? 5000);
|
|
2576
|
+
this.mounted = mountVoiceOpsStatus(this, this.getAttribute("path") ?? "/api/voice/ops-status", {
|
|
2577
|
+
description: this.getAttribute("description") ?? undefined,
|
|
2578
|
+
includeLinks: this.getAttribute("include-links") !== "false",
|
|
2579
|
+
intervalMs: Number.isFinite(intervalMs) ? intervalMs : 5000,
|
|
2580
|
+
title: this.getAttribute("title") ?? undefined
|
|
2581
|
+
});
|
|
2582
|
+
}
|
|
2583
|
+
disconnectedCallback() {
|
|
2584
|
+
this.mounted?.close();
|
|
2585
|
+
this.mounted = undefined;
|
|
2586
|
+
}
|
|
2587
|
+
});
|
|
2588
|
+
};
|
|
2589
|
+
// src/client/opsActionCenterWidget.ts
|
|
2590
|
+
var DEFAULT_TITLE2 = "Voice Ops Action Center";
|
|
2591
|
+
var DEFAULT_DESCRIPTION2 = "Run production voice proofs and operator actions from one primitive panel.";
|
|
2592
|
+
var escapeHtml2 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
2593
|
+
var createVoiceOpsActionCenterViewModel = (snapshot, options = {}) => {
|
|
2594
|
+
const status = snapshot.error ? "error" : snapshot.isRunning ? "running" : snapshot.lastResult ? "completed" : "ready";
|
|
2595
|
+
return {
|
|
2596
|
+
actions: snapshot.actions.map((action) => ({
|
|
2597
|
+
description: action.description ?? "",
|
|
2598
|
+
disabled: Boolean(action.disabled || snapshot.isRunning),
|
|
2599
|
+
id: action.id,
|
|
2600
|
+
isRunning: snapshot.runningActionId === action.id,
|
|
2601
|
+
label: action.label
|
|
2602
|
+
})),
|
|
2603
|
+
description: options.description ?? DEFAULT_DESCRIPTION2,
|
|
2604
|
+
error: snapshot.error,
|
|
2605
|
+
isRunning: snapshot.isRunning,
|
|
2606
|
+
label: status === "error" ? "Needs attention" : status === "running" ? "Running" : status === "completed" ? "Action completed" : "Ready",
|
|
2607
|
+
lastResultLabel: snapshot.lastResult ? `${snapshot.lastResult.actionId} returned HTTP ${snapshot.lastResult.status}` : "No action has run yet.",
|
|
2608
|
+
status,
|
|
2609
|
+
title: options.title ?? DEFAULT_TITLE2
|
|
2610
|
+
};
|
|
2611
|
+
};
|
|
2612
|
+
var renderVoiceOpsActionCenterHTML = (snapshot, options = {}) => {
|
|
2613
|
+
const model = createVoiceOpsActionCenterViewModel(snapshot, options);
|
|
2614
|
+
const actions = model.actions.map((action) => `<button type="button" data-absolute-voice-ops-action="${escapeHtml2(action.id)}"${action.disabled ? " disabled" : ""}>
|
|
2615
|
+
${escapeHtml2(action.isRunning ? "Working..." : action.label)}
|
|
2616
|
+
</button>`).join("");
|
|
2617
|
+
return `<section class="absolute-voice-ops-action-center absolute-voice-ops-action-center--${escapeHtml2(model.status)}">
|
|
2618
|
+
<header class="absolute-voice-ops-action-center__header">
|
|
2619
|
+
<span class="absolute-voice-ops-action-center__eyebrow">${escapeHtml2(model.title)}</span>
|
|
2620
|
+
<strong class="absolute-voice-ops-action-center__label">${escapeHtml2(model.label)}</strong>
|
|
2621
|
+
</header>
|
|
2622
|
+
<p class="absolute-voice-ops-action-center__description">${escapeHtml2(model.description)}</p>
|
|
2623
|
+
<div class="absolute-voice-ops-action-center__actions">${actions}</div>
|
|
2624
|
+
<p class="absolute-voice-ops-action-center__result">${escapeHtml2(model.lastResultLabel)}</p>
|
|
2625
|
+
${model.error ? `<p class="absolute-voice-ops-action-center__error">${escapeHtml2(model.error)}</p>` : ""}
|
|
2626
|
+
</section>`;
|
|
2627
|
+
};
|
|
2628
|
+
var getVoiceOpsActionCenterCSS = () => `.absolute-voice-ops-action-center{border:1px solid #d5cbb8;border-radius:20px;background:#fffaf1;color:#17130b;padding:18px;box-shadow:0 18px 40px rgba(58,42,16,.12);font-family:inherit}.absolute-voice-ops-action-center--error{border-color:#f2a7a7;background:#fff5f3}.absolute-voice-ops-action-center__header{align-items:start;display:flex;gap:12px;justify-content:space-between}.absolute-voice-ops-action-center__eyebrow{color:#725d37;font-size:12px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}.absolute-voice-ops-action-center__label{font-size:28px;line-height:1}.absolute-voice-ops-action-center__description,.absolute-voice-ops-action-center__result{color:#5b4b2f;margin:12px 0 0}.absolute-voice-ops-action-center__actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:14px}.absolute-voice-ops-action-center__actions button{background:#7c4a03;border:0;border-radius:999px;color:#fff8e8;cursor:pointer;font:inherit;font-weight:800;padding:8px 12px}.absolute-voice-ops-action-center__actions button:disabled{cursor:not-allowed;opacity:.5}.absolute-voice-ops-action-center__error{color:#9f1239;font-weight:700}`;
|
|
2629
|
+
var mountVoiceOpsActionCenter = (element, options = {}) => {
|
|
2630
|
+
const store = createVoiceOpsActionCenterStore(options);
|
|
2631
|
+
const render = () => {
|
|
2632
|
+
element.innerHTML = renderVoiceOpsActionCenterHTML(store.getSnapshot(), options);
|
|
2633
|
+
};
|
|
2634
|
+
const unsubscribe = store.subscribe(render);
|
|
2635
|
+
const handleClick = (event) => {
|
|
2636
|
+
const target = event.target;
|
|
2637
|
+
if (!(target instanceof Element)) {
|
|
2638
|
+
return;
|
|
2639
|
+
}
|
|
2640
|
+
const action = target.closest("[data-absolute-voice-ops-action]");
|
|
2641
|
+
const actionId = action?.getAttribute("data-absolute-voice-ops-action");
|
|
2642
|
+
if (actionId) {
|
|
2643
|
+
store.run(actionId).catch(() => {});
|
|
2644
|
+
}
|
|
2645
|
+
};
|
|
2646
|
+
element.addEventListener?.("click", handleClick);
|
|
2647
|
+
render();
|
|
2648
|
+
return {
|
|
2649
|
+
close: () => {
|
|
2650
|
+
element.removeEventListener?.("click", handleClick);
|
|
2651
|
+
unsubscribe();
|
|
2652
|
+
store.close();
|
|
2653
|
+
},
|
|
2654
|
+
run: store.run
|
|
2655
|
+
};
|
|
2656
|
+
};
|
|
2657
|
+
var defineVoiceOpsActionCenterElement = (tagName = "absolute-voice-ops-action-center", options = {}) => {
|
|
2658
|
+
if (typeof window === "undefined" || typeof customElements === "undefined" || customElements.get(tagName)) {
|
|
2659
|
+
return;
|
|
2660
|
+
}
|
|
2661
|
+
customElements.define(tagName, class AbsoluteVoiceOpsActionCenterElement extends HTMLElement {
|
|
2662
|
+
mounted;
|
|
2663
|
+
connectedCallback() {
|
|
2664
|
+
this.mounted = mountVoiceOpsActionCenter(this, {
|
|
2665
|
+
...options,
|
|
2666
|
+
description: this.getAttribute("description") ?? options.description,
|
|
2667
|
+
title: this.getAttribute("title") ?? options.title
|
|
2668
|
+
});
|
|
2669
|
+
}
|
|
2670
|
+
disconnectedCallback() {
|
|
2671
|
+
this.mounted?.close();
|
|
2672
|
+
this.mounted = undefined;
|
|
2673
|
+
}
|
|
2674
|
+
});
|
|
2675
|
+
};
|
|
2676
|
+
// src/client/opsActionHistoryWidget.ts
|
|
2677
|
+
var escapeHtml3 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
2678
|
+
var renderVoiceOpsActionHistoryWidgetHTML = (snapshot, options = {}) => {
|
|
2679
|
+
const report = snapshot.report;
|
|
2680
|
+
const entries = (report?.entries ?? []).slice(0, options.limit ?? 5);
|
|
2681
|
+
const rows = entries.map((entry) => `<li class="absolute-voice-ops-action-history__entry absolute-voice-ops-action-history__entry--${entry.ok ? "success" : "error"}"><span>${escapeHtml3(entry.actionId)}</span><strong>${escapeHtml3(entry.ok ? "Success" : "Failed")}</strong><small>${escapeHtml3(new Date(entry.at).toLocaleString())}${entry.status ? ` \xB7 HTTP ${String(entry.status)}` : ""}</small></li>`).join("");
|
|
2682
|
+
return `<section class="absolute-voice-ops-action-history">
|
|
2683
|
+
<header><span>Operator proof</span><strong>${escapeHtml3(options.title ?? "Action History")}</strong></header>
|
|
2684
|
+
<p>${String(report?.total ?? 0)} action(s), ${String(report?.failed ?? 0)} failed.</p>
|
|
2685
|
+
<ul>${rows || "<li>No operator actions recorded yet.</li>"}</ul>
|
|
2686
|
+
${snapshot.error ? `<p class="absolute-voice-ops-action-history__error">${escapeHtml3(snapshot.error)}</p>` : ""}
|
|
2687
|
+
</section>`;
|
|
2688
|
+
};
|
|
2689
|
+
var getVoiceOpsActionHistoryCSS = () => `.absolute-voice-ops-action-history{border:1px solid #d8d2c4;border-radius:20px;background:#fffaf0;color:#16130d;padding:18px;font-family:inherit}.absolute-voice-ops-action-history header{align-items:start;display:flex;gap:12px;justify-content:space-between}.absolute-voice-ops-action-history header span{color:#73664f;font-size:12px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}.absolute-voice-ops-action-history header strong{font-size:24px}.absolute-voice-ops-action-history p{color:#514733}.absolute-voice-ops-action-history ul{display:grid;gap:8px;list-style:none;margin:12px 0 0;padding:0}.absolute-voice-ops-action-history__entry{background:#fff;border:1px solid #eee4d2;border-radius:14px;display:grid;gap:3px;padding:10px 12px}.absolute-voice-ops-action-history__entry--error{border-color:#f2a7a7}.absolute-voice-ops-action-history__entry span{font-weight:800}.absolute-voice-ops-action-history__entry small{color:#655944}.absolute-voice-ops-action-history__error{color:#9f1239;font-weight:700}`;
|
|
2690
|
+
var mountVoiceOpsActionHistory = (element, path = "/api/voice/ops-actions/history", options = {}) => {
|
|
2691
|
+
const store = createVoiceOpsActionHistoryStore(path, options);
|
|
2692
|
+
const render = () => {
|
|
2693
|
+
element.innerHTML = renderVoiceOpsActionHistoryWidgetHTML(store.getSnapshot(), options);
|
|
2694
|
+
};
|
|
2695
|
+
const unsubscribe = store.subscribe(render);
|
|
2696
|
+
render();
|
|
2697
|
+
store.refresh().catch(() => {});
|
|
2698
|
+
return {
|
|
2699
|
+
close: () => {
|
|
2700
|
+
unsubscribe();
|
|
2701
|
+
store.close();
|
|
2702
|
+
},
|
|
2703
|
+
refresh: store.refresh
|
|
2704
|
+
};
|
|
2705
|
+
};
|
|
2706
|
+
// src/client/deliveryRuntimeWidget.ts
|
|
2707
|
+
var DEFAULT_TITLE3 = "Voice Delivery Runtime";
|
|
2708
|
+
var DEFAULT_DESCRIPTION3 = "Audit and trace delivery worker health from your AbsoluteJS voice app.";
|
|
2709
|
+
var escapeHtml4 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
2710
|
+
var createSurface = (id, summary) => {
|
|
2711
|
+
if (!summary) {
|
|
2712
|
+
return {
|
|
2713
|
+
deadLettered: 0,
|
|
2714
|
+
detail: "Worker disabled",
|
|
2715
|
+
failed: 0,
|
|
2716
|
+
id,
|
|
2717
|
+
label: id === "audit" ? "Audit delivery" : "Trace delivery",
|
|
2718
|
+
pending: 0,
|
|
2719
|
+
status: "disabled",
|
|
2720
|
+
total: 0
|
|
2721
|
+
};
|
|
2722
|
+
}
|
|
2723
|
+
const blocked = summary.failed + summary.deadLettered;
|
|
2724
|
+
return {
|
|
2725
|
+
deadLettered: summary.deadLettered,
|
|
2726
|
+
detail: `${summary.delivered}/${summary.total} delivered, ${summary.pending} pending`,
|
|
2727
|
+
failed: summary.failed,
|
|
2728
|
+
id,
|
|
2729
|
+
label: id === "audit" ? "Audit delivery" : "Trace delivery",
|
|
2730
|
+
pending: summary.pending,
|
|
2731
|
+
status: blocked > 0 ? "warn" : "pass",
|
|
2732
|
+
total: summary.total
|
|
2733
|
+
};
|
|
2734
|
+
};
|
|
2735
|
+
var createVoiceDeliveryRuntimeViewModel = (snapshot, options = {}) => {
|
|
2736
|
+
const report = snapshot.report;
|
|
2737
|
+
const surfaces = [
|
|
2738
|
+
createSurface("audit", report?.summary.audit),
|
|
2739
|
+
createSurface("trace", report?.summary.trace)
|
|
2740
|
+
];
|
|
2741
|
+
const hasWarnings = surfaces.some((surface) => surface.status === "warn");
|
|
2742
|
+
return {
|
|
2743
|
+
description: options.description ?? DEFAULT_DESCRIPTION3,
|
|
2744
|
+
error: snapshot.error,
|
|
2745
|
+
actionError: snapshot.actionError,
|
|
2746
|
+
actionStatus: snapshot.actionStatus,
|
|
2747
|
+
isLoading: snapshot.isLoading,
|
|
2748
|
+
isRunning: Boolean(report?.isRunning),
|
|
2749
|
+
label: snapshot.error ? "Unavailable" : report ? report.isRunning ? "Running" : "Stopped" : "Checking",
|
|
2750
|
+
status: snapshot.error ? "error" : report ? hasWarnings ? "warn" : "pass" : "loading",
|
|
2751
|
+
surfaces,
|
|
2752
|
+
title: options.title ?? DEFAULT_TITLE3,
|
|
2753
|
+
updatedAt: snapshot.updatedAt
|
|
2754
|
+
};
|
|
2755
|
+
};
|
|
2756
|
+
var renderVoiceDeliveryRuntimeHTML = (snapshot, options = {}) => {
|
|
2757
|
+
const model = createVoiceDeliveryRuntimeViewModel(snapshot, options);
|
|
2758
|
+
const surfaces = model.surfaces.map((surface) => `<li class="absolute-voice-delivery-runtime__surface absolute-voice-delivery-runtime__surface--${escapeHtml4(surface.status)}">
|
|
2759
|
+
<span>${escapeHtml4(surface.label)}</span>
|
|
2760
|
+
<strong>${escapeHtml4(surface.detail)}</strong>
|
|
2761
|
+
<small>${String(surface.failed)} failed · ${String(surface.deadLettered)} dead-lettered</small>
|
|
2762
|
+
</li>`).join("");
|
|
2763
|
+
const actions = options.includeActions === false ? "" : `<div class="absolute-voice-delivery-runtime__actions">
|
|
2764
|
+
<button type="button" data-absolute-voice-delivery-runtime-action="tick">${model.actionStatus === "running" ? "Working..." : "Tick workers"}</button>
|
|
2765
|
+
<button type="button" data-absolute-voice-delivery-runtime-action="requeue-dead-letters"${model.surfaces.some((surface) => surface.deadLettered > 0) ? "" : " disabled"}>Requeue dead letters</button>
|
|
2766
|
+
</div>`;
|
|
2767
|
+
const actionError = model.actionError ? `<p class="absolute-voice-delivery-runtime__error">${escapeHtml4(model.actionError)}</p>` : "";
|
|
2768
|
+
return `<section class="absolute-voice-delivery-runtime absolute-voice-delivery-runtime--${escapeHtml4(model.status)}">
|
|
2769
|
+
<header class="absolute-voice-delivery-runtime__header">
|
|
2770
|
+
<span class="absolute-voice-delivery-runtime__eyebrow">${escapeHtml4(model.title)}</span>
|
|
2771
|
+
<strong class="absolute-voice-delivery-runtime__label">${escapeHtml4(model.label)}</strong>
|
|
2772
|
+
</header>
|
|
2773
|
+
<p class="absolute-voice-delivery-runtime__description">${escapeHtml4(model.description)}</p>
|
|
2774
|
+
<ul class="absolute-voice-delivery-runtime__surfaces">${surfaces}</ul>
|
|
2775
|
+
${actions}
|
|
2776
|
+
${actionError}
|
|
2777
|
+
${model.error ? `<p class="absolute-voice-delivery-runtime__error">${escapeHtml4(model.error)}</p>` : ""}
|
|
2778
|
+
</section>`;
|
|
2779
|
+
};
|
|
2780
|
+
var getVoiceDeliveryRuntimeCSS = () => `.absolute-voice-delivery-runtime{border:1px solid #c9d8cf;border-radius:20px;background:#f6fff9;color:#0d1b12;padding:18px;box-shadow:0 18px 40px rgba(19,55,35,.12);font-family:inherit}.absolute-voice-delivery-runtime--warn,.absolute-voice-delivery-runtime--error{border-color:#f2b56b;background:#fff9ed}.absolute-voice-delivery-runtime__header{align-items:start;display:flex;gap:12px;justify-content:space-between}.absolute-voice-delivery-runtime__eyebrow{color:#4e6b59;font-size:12px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}.absolute-voice-delivery-runtime__label{font-size:28px;line-height:1}.absolute-voice-delivery-runtime__description{color:#33483b;margin:12px 0 0}.absolute-voice-delivery-runtime__surfaces{display:grid;gap:8px;list-style:none;margin:16px 0 0;padding:0}.absolute-voice-delivery-runtime__surface{background:#fff;border:1px solid #d9eadf;border-radius:14px;display:grid;gap:4px;padding:10px 12px}.absolute-voice-delivery-runtime__surface--warn{border-color:#f2b56b}.absolute-voice-delivery-runtime__surface--disabled{opacity:.72}.absolute-voice-delivery-runtime__surface span,.absolute-voice-delivery-runtime__surface small{color:#587063}.absolute-voice-delivery-runtime__actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:14px}.absolute-voice-delivery-runtime__actions button{background:#134e2d;border:0;border-radius:999px;color:#f6fff9;cursor:pointer;font:inherit;font-weight:800;padding:8px 12px}.absolute-voice-delivery-runtime__actions button:disabled{cursor:not-allowed;opacity:.48}.absolute-voice-delivery-runtime__error{color:#9f1239;font-weight:700}`;
|
|
2781
|
+
var mountVoiceDeliveryRuntime = (element, path = "/api/voice-delivery-runtime", options = {}) => {
|
|
2782
|
+
const store = createVoiceDeliveryRuntimeStore(path, options);
|
|
2783
|
+
const render = () => {
|
|
2784
|
+
element.innerHTML = renderVoiceDeliveryRuntimeHTML(store.getSnapshot(), options);
|
|
2785
|
+
};
|
|
2786
|
+
const unsubscribe = store.subscribe(render);
|
|
2787
|
+
const handleClick = (event) => {
|
|
2788
|
+
const target = event.target;
|
|
2789
|
+
if (!(target instanceof Element)) {
|
|
2790
|
+
return;
|
|
2791
|
+
}
|
|
2792
|
+
const action = target.closest("[data-absolute-voice-delivery-runtime-action]");
|
|
2793
|
+
const actionName = action?.getAttribute("data-absolute-voice-delivery-runtime-action");
|
|
2794
|
+
if (actionName === "tick") {
|
|
2795
|
+
store.tick().catch(() => {});
|
|
2796
|
+
}
|
|
2797
|
+
if (actionName === "requeue-dead-letters") {
|
|
2798
|
+
store.requeueDeadLetters().catch(() => {});
|
|
2799
|
+
}
|
|
2800
|
+
};
|
|
2801
|
+
element.addEventListener?.("click", handleClick);
|
|
2802
|
+
render();
|
|
2803
|
+
store.refresh().catch(() => {});
|
|
2804
|
+
return {
|
|
2805
|
+
close: () => {
|
|
2806
|
+
element.removeEventListener?.("click", handleClick);
|
|
2807
|
+
unsubscribe();
|
|
2808
|
+
store.close();
|
|
2809
|
+
},
|
|
2810
|
+
refresh: store.refresh
|
|
2811
|
+
};
|
|
2812
|
+
};
|
|
2813
|
+
var defineVoiceDeliveryRuntimeElement = (tagName = "absolute-voice-delivery-runtime") => {
|
|
2814
|
+
if (typeof window === "undefined" || typeof customElements === "undefined" || customElements.get(tagName)) {
|
|
2815
|
+
return;
|
|
2816
|
+
}
|
|
2817
|
+
customElements.define(tagName, class AbsoluteVoiceDeliveryRuntimeElement extends HTMLElement {
|
|
2818
|
+
mounted;
|
|
2819
|
+
connectedCallback() {
|
|
2820
|
+
const intervalMs = Number(this.getAttribute("interval-ms") ?? 5000);
|
|
2821
|
+
this.mounted = mountVoiceDeliveryRuntime(this, this.getAttribute("path") ?? "/api/voice-delivery-runtime", {
|
|
2822
|
+
description: this.getAttribute("description") ?? undefined,
|
|
2823
|
+
intervalMs: Number.isFinite(intervalMs) ? intervalMs : 5000,
|
|
2824
|
+
title: this.getAttribute("title") ?? undefined
|
|
2825
|
+
});
|
|
2826
|
+
}
|
|
2827
|
+
disconnectedCallback() {
|
|
2828
|
+
this.mounted?.close();
|
|
2829
|
+
this.mounted = undefined;
|
|
2830
|
+
}
|
|
2831
|
+
});
|
|
2832
|
+
};
|
|
2833
|
+
// src/client/routingStatus.ts
|
|
2834
|
+
var fetchVoiceRoutingStatus = async (path = "/api/routing/latest", options = {}) => {
|
|
2835
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
2836
|
+
const response = await fetchImpl(path);
|
|
2837
|
+
if (!response.ok) {
|
|
2838
|
+
throw new Error(`Voice routing status failed: HTTP ${response.status}`);
|
|
2839
|
+
}
|
|
2840
|
+
return await response.json();
|
|
2841
|
+
};
|
|
2842
|
+
var createVoiceRoutingStatusStore = (path = "/api/routing/latest", options = {}) => {
|
|
2843
|
+
const listeners = new Set;
|
|
2844
|
+
let closed = false;
|
|
2845
|
+
let timer;
|
|
2846
|
+
let snapshot = {
|
|
2847
|
+
decision: null,
|
|
2848
|
+
error: null,
|
|
2849
|
+
isLoading: false
|
|
2850
|
+
};
|
|
2851
|
+
const emit = () => {
|
|
2852
|
+
for (const listener of listeners) {
|
|
2853
|
+
listener();
|
|
2854
|
+
}
|
|
2855
|
+
};
|
|
2856
|
+
const refresh = async () => {
|
|
2857
|
+
if (closed) {
|
|
2858
|
+
return snapshot.decision;
|
|
2859
|
+
}
|
|
2860
|
+
snapshot = {
|
|
2861
|
+
...snapshot,
|
|
2862
|
+
error: null,
|
|
2863
|
+
isLoading: true
|
|
2864
|
+
};
|
|
2865
|
+
emit();
|
|
2866
|
+
try {
|
|
2867
|
+
const decision = await fetchVoiceRoutingStatus(path, options);
|
|
2868
|
+
snapshot = {
|
|
2869
|
+
decision,
|
|
2870
|
+
error: null,
|
|
2871
|
+
isLoading: false,
|
|
2872
|
+
updatedAt: Date.now()
|
|
2873
|
+
};
|
|
2874
|
+
emit();
|
|
2875
|
+
return decision;
|
|
2876
|
+
} catch (error) {
|
|
2877
|
+
snapshot = {
|
|
2878
|
+
...snapshot,
|
|
2879
|
+
error: error instanceof Error ? error.message : String(error),
|
|
2880
|
+
isLoading: false
|
|
2881
|
+
};
|
|
2882
|
+
emit();
|
|
2883
|
+
throw error;
|
|
2884
|
+
}
|
|
2885
|
+
};
|
|
2886
|
+
const close = () => {
|
|
2887
|
+
closed = true;
|
|
2888
|
+
if (timer) {
|
|
2889
|
+
clearInterval(timer);
|
|
2890
|
+
timer = undefined;
|
|
2891
|
+
}
|
|
2892
|
+
listeners.clear();
|
|
2893
|
+
};
|
|
2894
|
+
if (options.intervalMs && options.intervalMs > 0) {
|
|
2895
|
+
timer = setInterval(() => {
|
|
2896
|
+
refresh().catch(() => {});
|
|
2897
|
+
}, options.intervalMs);
|
|
2898
|
+
}
|
|
2899
|
+
return {
|
|
2900
|
+
close,
|
|
2901
|
+
getServerSnapshot: () => snapshot,
|
|
2902
|
+
getSnapshot: () => snapshot,
|
|
2903
|
+
refresh,
|
|
2904
|
+
subscribe: (listener) => {
|
|
2905
|
+
listeners.add(listener);
|
|
2906
|
+
return () => {
|
|
2907
|
+
listeners.delete(listener);
|
|
2908
|
+
};
|
|
2909
|
+
}
|
|
2910
|
+
};
|
|
2911
|
+
};
|
|
2912
|
+
// src/client/routingStatusWidget.ts
|
|
2913
|
+
var DEFAULT_TITLE4 = "Voice Routing";
|
|
2914
|
+
var DEFAULT_DESCRIPTION4 = "Latest provider routing decision from the self-hosted trace store.";
|
|
2915
|
+
var escapeHtml5 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
2916
|
+
var formatValue = (value, fallback = "None") => typeof value === "string" && value.trim() ? value : typeof value === "number" && Number.isFinite(value) ? String(value) : fallback;
|
|
2917
|
+
var createVoiceRoutingStatusViewModel = (snapshot, options = {}) => {
|
|
2918
|
+
const decision = snapshot.decision;
|
|
2919
|
+
const rows = decision ? [
|
|
2920
|
+
{ label: "Kind", value: decision.kind.toUpperCase() },
|
|
2921
|
+
{ label: "Policy", value: formatValue(decision.routing, "Unknown") },
|
|
2922
|
+
{ label: "Provider", value: formatValue(decision.provider, "Unknown") },
|
|
2923
|
+
{
|
|
2924
|
+
label: "Selected",
|
|
2925
|
+
value: formatValue(decision.selectedProvider, "Unknown")
|
|
2926
|
+
},
|
|
2927
|
+
{
|
|
2928
|
+
label: "Fallback",
|
|
2929
|
+
value: formatValue(decision.fallbackProvider)
|
|
2930
|
+
},
|
|
2931
|
+
{ label: "Status", value: formatValue(decision.status, "unknown") },
|
|
2932
|
+
{
|
|
2933
|
+
label: "Latency budget",
|
|
2934
|
+
value: typeof decision.latencyBudgetMs === "number" ? `${decision.latencyBudgetMs}ms` : "None"
|
|
2935
|
+
}
|
|
2936
|
+
] : [];
|
|
2937
|
+
return {
|
|
2938
|
+
decision,
|
|
2939
|
+
description: options.description ?? DEFAULT_DESCRIPTION4,
|
|
2940
|
+
error: snapshot.error,
|
|
2941
|
+
isLoading: snapshot.isLoading,
|
|
2942
|
+
label: snapshot.error ? "Unavailable" : decision ? `${formatValue(decision.kind).toUpperCase()} ${formatValue(decision.status, "unknown")}` : snapshot.isLoading ? "Checking" : "No routing yet",
|
|
2943
|
+
rows,
|
|
2944
|
+
status: snapshot.error ? "error" : decision ? "ready" : snapshot.isLoading ? "loading" : "empty",
|
|
2945
|
+
title: options.title ?? DEFAULT_TITLE4,
|
|
2946
|
+
updatedAt: snapshot.updatedAt
|
|
2947
|
+
};
|
|
2948
|
+
};
|
|
2949
|
+
var renderVoiceRoutingStatusHTML = (snapshot, options = {}) => {
|
|
2950
|
+
const model = createVoiceRoutingStatusViewModel(snapshot, options);
|
|
2951
|
+
const rows = model.rows.length ? `<div class="absolute-voice-routing-status__grid">${model.rows.map((row) => `<div>
|
|
2952
|
+
<span>${escapeHtml5(row.label)}</span>
|
|
2953
|
+
<strong>${escapeHtml5(row.value)}</strong>
|
|
2954
|
+
</div>`).join("")}</div>` : '<p class="absolute-voice-routing-status__empty">Start a voice session to see the selected provider.</p>';
|
|
2955
|
+
return `<section class="absolute-voice-routing-status absolute-voice-routing-status--${escapeHtml5(model.status)}">
|
|
2956
|
+
<header class="absolute-voice-routing-status__header">
|
|
2957
|
+
<span class="absolute-voice-routing-status__eyebrow">${escapeHtml5(model.title)}</span>
|
|
2958
|
+
<strong class="absolute-voice-routing-status__label">${escapeHtml5(model.label)}</strong>
|
|
2959
|
+
</header>
|
|
2960
|
+
<p class="absolute-voice-routing-status__description">${escapeHtml5(model.description)}</p>
|
|
2961
|
+
${rows}
|
|
2962
|
+
${model.error ? `<p class="absolute-voice-routing-status__error">${escapeHtml5(model.error)}</p>` : ""}
|
|
2963
|
+
</section>`;
|
|
2964
|
+
};
|
|
2965
|
+
var getVoiceRoutingStatusCSS = () => `.absolute-voice-routing-status{border:1px solid #d8d2c4;border-radius:20px;background:#fffaf0;color:#16130d;padding:18px;box-shadow:0 18px 40px rgba(47,37,18,.12);font-family:inherit}.absolute-voice-routing-status--error{border-color:#f2a7a7;background:#fff5f3}.absolute-voice-routing-status__header{align-items:start;display:flex;gap:12px;justify-content:space-between}.absolute-voice-routing-status__eyebrow{color:#73664f;font-size:12px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}.absolute-voice-routing-status__label{font-size:24px;line-height:1}.absolute-voice-routing-status__description{color:#514733;margin:12px 0 0}.absolute-voice-routing-status__grid{display:grid;gap:8px;grid-template-columns:repeat(2,minmax(0,1fr));margin-top:14px}.absolute-voice-routing-status__grid div{background:#fff;border:1px solid #eee4d2;border-radius:14px;padding:10px 12px}.absolute-voice-routing-status__grid span{color:#655944;display:block;font-size:12px;margin-bottom:4px}.absolute-voice-routing-status__grid strong{overflow-wrap:anywhere}.absolute-voice-routing-status__empty{color:#655944;margin:14px 0 0}.absolute-voice-routing-status__error{color:#9f1239;font-weight:700}`;
|
|
2966
|
+
var mountVoiceRoutingStatus = (element, path = "/api/routing/latest", options = {}) => {
|
|
2967
|
+
const store = createVoiceRoutingStatusStore(path, options);
|
|
2968
|
+
const render = () => {
|
|
2969
|
+
element.innerHTML = renderVoiceRoutingStatusHTML(store.getSnapshot(), options);
|
|
2970
|
+
};
|
|
2971
|
+
const unsubscribe = store.subscribe(render);
|
|
2972
|
+
render();
|
|
2973
|
+
store.refresh().catch(() => {});
|
|
2974
|
+
return {
|
|
2975
|
+
close: () => {
|
|
2976
|
+
unsubscribe();
|
|
2977
|
+
store.close();
|
|
2978
|
+
},
|
|
2979
|
+
refresh: store.refresh
|
|
2980
|
+
};
|
|
2981
|
+
};
|
|
2982
|
+
var defineVoiceRoutingStatusElement = (tagName = "absolute-voice-routing-status") => {
|
|
2983
|
+
if (typeof window === "undefined" || typeof customElements === "undefined" || customElements.get(tagName)) {
|
|
2984
|
+
return;
|
|
2985
|
+
}
|
|
2986
|
+
customElements.define(tagName, class AbsoluteVoiceRoutingStatusElement extends HTMLElement {
|
|
2987
|
+
mounted;
|
|
2988
|
+
connectedCallback() {
|
|
2989
|
+
const intervalMs = Number(this.getAttribute("interval-ms") ?? 5000);
|
|
2990
|
+
this.mounted = mountVoiceRoutingStatus(this, this.getAttribute("path") ?? "/api/routing/latest", {
|
|
2991
|
+
description: this.getAttribute("description") ?? undefined,
|
|
2992
|
+
intervalMs: Number.isFinite(intervalMs) ? intervalMs : 5000,
|
|
2993
|
+
title: this.getAttribute("title") ?? undefined
|
|
2994
|
+
});
|
|
2995
|
+
}
|
|
2996
|
+
disconnectedCallback() {
|
|
2997
|
+
this.mounted?.close();
|
|
2998
|
+
this.mounted = undefined;
|
|
2999
|
+
}
|
|
3000
|
+
});
|
|
3001
|
+
};
|
|
3002
|
+
// src/client/providerStatus.ts
|
|
3003
|
+
var fetchVoiceProviderStatus = async (path = "/api/provider-status", options = {}) => {
|
|
3004
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
3005
|
+
const response = await fetchImpl(path);
|
|
3006
|
+
if (!response.ok) {
|
|
3007
|
+
throw new Error(`Voice provider status failed: HTTP ${response.status}`);
|
|
3008
|
+
}
|
|
3009
|
+
return await response.json();
|
|
3010
|
+
};
|
|
3011
|
+
var createVoiceProviderStatusStore = (path = "/api/provider-status", options = {}) => {
|
|
3012
|
+
const listeners = new Set;
|
|
3013
|
+
let closed = false;
|
|
3014
|
+
let timer;
|
|
3015
|
+
let snapshot = {
|
|
3016
|
+
error: null,
|
|
3017
|
+
isLoading: false,
|
|
3018
|
+
providers: []
|
|
3019
|
+
};
|
|
3020
|
+
const emit = () => {
|
|
3021
|
+
for (const listener of listeners) {
|
|
3022
|
+
listener();
|
|
3023
|
+
}
|
|
3024
|
+
};
|
|
3025
|
+
const refresh = async () => {
|
|
3026
|
+
if (closed) {
|
|
3027
|
+
return snapshot.providers;
|
|
3028
|
+
}
|
|
3029
|
+
snapshot = {
|
|
3030
|
+
...snapshot,
|
|
3031
|
+
error: null,
|
|
3032
|
+
isLoading: true
|
|
3033
|
+
};
|
|
3034
|
+
emit();
|
|
3035
|
+
try {
|
|
3036
|
+
const providers = await fetchVoiceProviderStatus(path, options);
|
|
3037
|
+
snapshot = {
|
|
3038
|
+
error: null,
|
|
3039
|
+
isLoading: false,
|
|
3040
|
+
providers,
|
|
3041
|
+
updatedAt: Date.now()
|
|
3042
|
+
};
|
|
3043
|
+
emit();
|
|
3044
|
+
return providers;
|
|
3045
|
+
} catch (error) {
|
|
3046
|
+
snapshot = {
|
|
3047
|
+
...snapshot,
|
|
3048
|
+
error: error instanceof Error ? error.message : String(error),
|
|
3049
|
+
isLoading: false
|
|
3050
|
+
};
|
|
3051
|
+
emit();
|
|
3052
|
+
throw error;
|
|
3053
|
+
}
|
|
3054
|
+
};
|
|
3055
|
+
const close = () => {
|
|
3056
|
+
closed = true;
|
|
3057
|
+
if (timer) {
|
|
3058
|
+
clearInterval(timer);
|
|
3059
|
+
timer = undefined;
|
|
3060
|
+
}
|
|
3061
|
+
listeners.clear();
|
|
3062
|
+
};
|
|
3063
|
+
if (options.intervalMs && options.intervalMs > 0) {
|
|
3064
|
+
timer = setInterval(() => {
|
|
3065
|
+
refresh().catch(() => {});
|
|
3066
|
+
}, options.intervalMs);
|
|
3067
|
+
}
|
|
3068
|
+
return {
|
|
3069
|
+
close,
|
|
3070
|
+
getServerSnapshot: () => snapshot,
|
|
3071
|
+
getSnapshot: () => snapshot,
|
|
3072
|
+
refresh,
|
|
3073
|
+
subscribe: (listener) => {
|
|
3074
|
+
listeners.add(listener);
|
|
3075
|
+
return () => {
|
|
3076
|
+
listeners.delete(listener);
|
|
3077
|
+
};
|
|
3078
|
+
}
|
|
3079
|
+
};
|
|
3080
|
+
};
|
|
3081
|
+
// src/client/providerCapabilities.ts
|
|
3082
|
+
var fetchVoiceProviderCapabilities = async (path = "/api/provider-capabilities", options = {}) => {
|
|
3083
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
3084
|
+
const response = await fetchImpl(path);
|
|
3085
|
+
if (!response.ok) {
|
|
3086
|
+
throw new Error(`Voice provider capabilities failed: HTTP ${response.status}`);
|
|
3087
|
+
}
|
|
3088
|
+
return await response.json();
|
|
3089
|
+
};
|
|
3090
|
+
var createVoiceProviderCapabilitiesStore = (path = "/api/provider-capabilities", options = {}) => {
|
|
3091
|
+
const listeners = new Set;
|
|
3092
|
+
let closed = false;
|
|
3093
|
+
let timer;
|
|
3094
|
+
let snapshot = {
|
|
3095
|
+
error: null,
|
|
3096
|
+
isLoading: false
|
|
3097
|
+
};
|
|
3098
|
+
const emit = () => {
|
|
3099
|
+
for (const listener of listeners) {
|
|
3100
|
+
listener();
|
|
3101
|
+
}
|
|
3102
|
+
};
|
|
3103
|
+
const refresh = async () => {
|
|
3104
|
+
if (closed) {
|
|
3105
|
+
return snapshot.report;
|
|
3106
|
+
}
|
|
3107
|
+
snapshot = {
|
|
3108
|
+
...snapshot,
|
|
3109
|
+
error: null,
|
|
3110
|
+
isLoading: true
|
|
3111
|
+
};
|
|
3112
|
+
emit();
|
|
3113
|
+
try {
|
|
3114
|
+
const report = await fetchVoiceProviderCapabilities(path, options);
|
|
3115
|
+
snapshot = {
|
|
3116
|
+
error: null,
|
|
3117
|
+
isLoading: false,
|
|
3118
|
+
report,
|
|
3119
|
+
updatedAt: Date.now()
|
|
3120
|
+
};
|
|
3121
|
+
emit();
|
|
3122
|
+
return report;
|
|
3123
|
+
} catch (error) {
|
|
3124
|
+
snapshot = {
|
|
3125
|
+
...snapshot,
|
|
3126
|
+
error: error instanceof Error ? error.message : String(error),
|
|
3127
|
+
isLoading: false
|
|
3128
|
+
};
|
|
3129
|
+
emit();
|
|
3130
|
+
throw error;
|
|
3131
|
+
}
|
|
3132
|
+
};
|
|
3133
|
+
const close = () => {
|
|
3134
|
+
closed = true;
|
|
3135
|
+
if (timer) {
|
|
3136
|
+
clearInterval(timer);
|
|
3137
|
+
timer = undefined;
|
|
3138
|
+
}
|
|
3139
|
+
listeners.clear();
|
|
3140
|
+
};
|
|
3141
|
+
if (options.intervalMs && options.intervalMs > 0) {
|
|
3142
|
+
timer = setInterval(() => {
|
|
3143
|
+
refresh().catch(() => {});
|
|
3144
|
+
}, options.intervalMs);
|
|
3145
|
+
}
|
|
3146
|
+
return {
|
|
3147
|
+
close,
|
|
3148
|
+
getServerSnapshot: () => snapshot,
|
|
3149
|
+
getSnapshot: () => snapshot,
|
|
3150
|
+
refresh,
|
|
3151
|
+
subscribe: (listener) => {
|
|
3152
|
+
listeners.add(listener);
|
|
3153
|
+
return () => {
|
|
3154
|
+
listeners.delete(listener);
|
|
3155
|
+
};
|
|
3156
|
+
}
|
|
3157
|
+
};
|
|
3158
|
+
};
|
|
3159
|
+
// src/client/providerContracts.ts
|
|
3160
|
+
var fetchVoiceProviderContracts = async (path = "/api/provider-contracts", options = {}) => {
|
|
3161
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
3162
|
+
const response = await fetchImpl(path);
|
|
3163
|
+
if (!response.ok) {
|
|
3164
|
+
throw new Error(`Voice provider contracts failed: HTTP ${response.status}`);
|
|
3165
|
+
}
|
|
3166
|
+
return await response.json();
|
|
3167
|
+
};
|
|
3168
|
+
var createVoiceProviderContractsStore = (path = "/api/provider-contracts", options = {}) => {
|
|
3169
|
+
const listeners = new Set;
|
|
3170
|
+
let closed = false;
|
|
3171
|
+
let timer;
|
|
3172
|
+
let snapshot = {
|
|
3173
|
+
error: null,
|
|
3174
|
+
isLoading: false
|
|
3175
|
+
};
|
|
3176
|
+
const emit = () => {
|
|
3177
|
+
for (const listener of listeners) {
|
|
3178
|
+
listener();
|
|
3179
|
+
}
|
|
3180
|
+
};
|
|
3181
|
+
const refresh = async () => {
|
|
3182
|
+
if (closed) {
|
|
3183
|
+
return snapshot.report;
|
|
3184
|
+
}
|
|
3185
|
+
snapshot = { ...snapshot, error: null, isLoading: true };
|
|
3186
|
+
emit();
|
|
3187
|
+
try {
|
|
3188
|
+
const report = await fetchVoiceProviderContracts(path, options);
|
|
3189
|
+
snapshot = {
|
|
3190
|
+
error: null,
|
|
3191
|
+
isLoading: false,
|
|
3192
|
+
report,
|
|
3193
|
+
updatedAt: Date.now()
|
|
3194
|
+
};
|
|
3195
|
+
emit();
|
|
3196
|
+
return report;
|
|
3197
|
+
} catch (error) {
|
|
3198
|
+
snapshot = {
|
|
3199
|
+
...snapshot,
|
|
3200
|
+
error: error instanceof Error ? error.message : String(error),
|
|
3201
|
+
isLoading: false
|
|
3202
|
+
};
|
|
3203
|
+
emit();
|
|
3204
|
+
throw error;
|
|
3205
|
+
}
|
|
3206
|
+
};
|
|
3207
|
+
const close = () => {
|
|
3208
|
+
closed = true;
|
|
3209
|
+
if (timer) {
|
|
3210
|
+
clearInterval(timer);
|
|
3211
|
+
timer = undefined;
|
|
3212
|
+
}
|
|
3213
|
+
listeners.clear();
|
|
3214
|
+
};
|
|
3215
|
+
if (options.intervalMs && options.intervalMs > 0) {
|
|
3216
|
+
timer = setInterval(() => {
|
|
3217
|
+
refresh().catch(() => {});
|
|
3218
|
+
}, options.intervalMs);
|
|
3219
|
+
}
|
|
3220
|
+
return {
|
|
3221
|
+
close,
|
|
3222
|
+
getServerSnapshot: () => snapshot,
|
|
3223
|
+
getSnapshot: () => snapshot,
|
|
3224
|
+
refresh,
|
|
3225
|
+
subscribe: (listener) => {
|
|
3226
|
+
listeners.add(listener);
|
|
3227
|
+
return () => {
|
|
3228
|
+
listeners.delete(listener);
|
|
3229
|
+
};
|
|
3230
|
+
}
|
|
3231
|
+
};
|
|
3232
|
+
};
|
|
3233
|
+
// src/client/turnQuality.ts
|
|
3234
|
+
var fetchVoiceTurnQuality = async (path = "/api/turn-quality", options = {}) => {
|
|
3235
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
3236
|
+
const response = await fetchImpl(path);
|
|
3237
|
+
if (!response.ok) {
|
|
3238
|
+
throw new Error(`Voice turn quality failed: HTTP ${response.status}`);
|
|
3239
|
+
}
|
|
3240
|
+
return await response.json();
|
|
3241
|
+
};
|
|
3242
|
+
var createVoiceTurnQualityStore = (path = "/api/turn-quality", options = {}) => {
|
|
3243
|
+
const listeners = new Set;
|
|
3244
|
+
let closed = false;
|
|
3245
|
+
let timer;
|
|
3246
|
+
let snapshot = {
|
|
3247
|
+
error: null,
|
|
3248
|
+
isLoading: false
|
|
3249
|
+
};
|
|
3250
|
+
const emit = () => {
|
|
3251
|
+
for (const listener of listeners) {
|
|
3252
|
+
listener();
|
|
3253
|
+
}
|
|
3254
|
+
};
|
|
3255
|
+
const refresh = async () => {
|
|
3256
|
+
if (closed) {
|
|
3257
|
+
return snapshot.report;
|
|
3258
|
+
}
|
|
3259
|
+
snapshot = {
|
|
3260
|
+
...snapshot,
|
|
3261
|
+
error: null,
|
|
3262
|
+
isLoading: true
|
|
3263
|
+
};
|
|
3264
|
+
emit();
|
|
3265
|
+
try {
|
|
3266
|
+
const report = await fetchVoiceTurnQuality(path, options);
|
|
3267
|
+
snapshot = {
|
|
3268
|
+
error: null,
|
|
3269
|
+
isLoading: false,
|
|
3270
|
+
report,
|
|
3271
|
+
updatedAt: Date.now()
|
|
3272
|
+
};
|
|
3273
|
+
emit();
|
|
3274
|
+
return report;
|
|
3275
|
+
} catch (error) {
|
|
3276
|
+
snapshot = {
|
|
3277
|
+
...snapshot,
|
|
3278
|
+
error: error instanceof Error ? error.message : String(error),
|
|
3279
|
+
isLoading: false
|
|
3280
|
+
};
|
|
3281
|
+
emit();
|
|
3282
|
+
throw error;
|
|
3283
|
+
}
|
|
3284
|
+
};
|
|
3285
|
+
const close = () => {
|
|
3286
|
+
closed = true;
|
|
3287
|
+
if (timer) {
|
|
3288
|
+
clearInterval(timer);
|
|
3289
|
+
timer = undefined;
|
|
3290
|
+
}
|
|
3291
|
+
listeners.clear();
|
|
3292
|
+
};
|
|
3293
|
+
if (options.intervalMs && options.intervalMs > 0) {
|
|
3294
|
+
timer = setInterval(() => {
|
|
3295
|
+
refresh().catch(() => {});
|
|
3296
|
+
}, options.intervalMs);
|
|
3297
|
+
}
|
|
3298
|
+
return {
|
|
3299
|
+
close,
|
|
3300
|
+
getServerSnapshot: () => snapshot,
|
|
3301
|
+
getSnapshot: () => snapshot,
|
|
3302
|
+
refresh,
|
|
3303
|
+
subscribe: (listener) => {
|
|
3304
|
+
listeners.add(listener);
|
|
3305
|
+
return () => {
|
|
3306
|
+
listeners.delete(listener);
|
|
3307
|
+
};
|
|
3308
|
+
}
|
|
3309
|
+
};
|
|
3310
|
+
};
|
|
3311
|
+
// src/client/turnLatency.ts
|
|
3312
|
+
var fetchVoiceTurnLatency = async (path = "/api/turn-latency", options = {}) => {
|
|
3313
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
3314
|
+
const response = await fetchImpl(path);
|
|
3315
|
+
if (!response.ok) {
|
|
3316
|
+
throw new Error(`Voice turn latency failed: HTTP ${response.status}`);
|
|
3317
|
+
}
|
|
3318
|
+
return await response.json();
|
|
3319
|
+
};
|
|
3320
|
+
var runVoiceTurnLatencyProof = async (path, options = {}) => {
|
|
3321
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
3322
|
+
const response = await fetchImpl(path, { method: "POST" });
|
|
3323
|
+
if (!response.ok) {
|
|
3324
|
+
throw new Error(`Voice turn latency proof failed: HTTP ${response.status}`);
|
|
3325
|
+
}
|
|
3326
|
+
return response.json();
|
|
3327
|
+
};
|
|
3328
|
+
var createVoiceTurnLatencyStore = (path = "/api/turn-latency", options = {}) => {
|
|
3329
|
+
const listeners = new Set;
|
|
3330
|
+
let closed = false;
|
|
3331
|
+
let timer;
|
|
3332
|
+
let snapshot = {
|
|
3333
|
+
error: null,
|
|
3334
|
+
isLoading: false
|
|
3335
|
+
};
|
|
3336
|
+
const emit = () => {
|
|
3337
|
+
for (const listener of listeners) {
|
|
3338
|
+
listener();
|
|
3339
|
+
}
|
|
3340
|
+
};
|
|
3341
|
+
const refresh = async () => {
|
|
3342
|
+
if (closed) {
|
|
3343
|
+
return snapshot.report;
|
|
3344
|
+
}
|
|
3345
|
+
snapshot = { ...snapshot, error: null, isLoading: true };
|
|
3346
|
+
emit();
|
|
3347
|
+
try {
|
|
3348
|
+
const report = await fetchVoiceTurnLatency(path, options);
|
|
3349
|
+
snapshot = {
|
|
3350
|
+
error: null,
|
|
3351
|
+
isLoading: false,
|
|
3352
|
+
report,
|
|
3353
|
+
updatedAt: Date.now()
|
|
3354
|
+
};
|
|
3355
|
+
emit();
|
|
3356
|
+
return report;
|
|
3357
|
+
} catch (error) {
|
|
3358
|
+
snapshot = {
|
|
3359
|
+
...snapshot,
|
|
3360
|
+
error: error instanceof Error ? error.message : String(error),
|
|
3361
|
+
isLoading: false
|
|
3362
|
+
};
|
|
3363
|
+
emit();
|
|
3364
|
+
throw error;
|
|
3365
|
+
}
|
|
3366
|
+
};
|
|
3367
|
+
const runProof = async () => {
|
|
3368
|
+
if (!options.proofPath) {
|
|
3369
|
+
throw new Error("Voice turn latency proof path is not configured.");
|
|
3370
|
+
}
|
|
3371
|
+
snapshot = { ...snapshot, error: null, isLoading: true };
|
|
3372
|
+
emit();
|
|
3373
|
+
try {
|
|
3374
|
+
await runVoiceTurnLatencyProof(options.proofPath, options);
|
|
3375
|
+
return await refresh();
|
|
3376
|
+
} catch (error) {
|
|
3377
|
+
snapshot = {
|
|
3378
|
+
...snapshot,
|
|
3379
|
+
error: error instanceof Error ? error.message : String(error),
|
|
3380
|
+
isLoading: false
|
|
3381
|
+
};
|
|
3382
|
+
emit();
|
|
3383
|
+
throw error;
|
|
3384
|
+
}
|
|
3385
|
+
};
|
|
3386
|
+
const close = () => {
|
|
3387
|
+
closed = true;
|
|
3388
|
+
if (timer) {
|
|
3389
|
+
clearInterval(timer);
|
|
3390
|
+
timer = undefined;
|
|
3391
|
+
}
|
|
3392
|
+
listeners.clear();
|
|
3393
|
+
};
|
|
3394
|
+
if (options.intervalMs && options.intervalMs > 0) {
|
|
3395
|
+
timer = setInterval(() => {
|
|
3396
|
+
refresh().catch(() => {});
|
|
3397
|
+
}, options.intervalMs);
|
|
3398
|
+
}
|
|
3399
|
+
return {
|
|
3400
|
+
close,
|
|
3401
|
+
getServerSnapshot: () => snapshot,
|
|
3402
|
+
getSnapshot: () => snapshot,
|
|
3403
|
+
refresh,
|
|
3404
|
+
runProof,
|
|
3405
|
+
subscribe: (listener) => {
|
|
3406
|
+
listeners.add(listener);
|
|
3407
|
+
return () => {
|
|
3408
|
+
listeners.delete(listener);
|
|
3409
|
+
};
|
|
3410
|
+
}
|
|
3411
|
+
};
|
|
3412
|
+
};
|
|
3413
|
+
// src/client/campaignDialerProof.ts
|
|
3414
|
+
var fetchVoiceCampaignDialerProofStatus = async (path = "/api/voice/campaigns/dialer-proof", options = {}) => {
|
|
3415
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
3416
|
+
const response = await fetchImpl(path);
|
|
3417
|
+
if (!response.ok) {
|
|
3418
|
+
throw new Error(`Voice campaign dialer proof status failed: HTTP ${response.status}`);
|
|
3419
|
+
}
|
|
3420
|
+
return await response.json();
|
|
3421
|
+
};
|
|
3422
|
+
var runVoiceCampaignDialerProofAction = async (path = "/api/voice/campaigns/dialer-proof", options = {}) => {
|
|
3423
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
3424
|
+
const response = await fetchImpl(path, { method: "POST" });
|
|
3425
|
+
if (!response.ok) {
|
|
3426
|
+
throw new Error(`Voice campaign dialer proof failed: HTTP ${response.status}`);
|
|
3427
|
+
}
|
|
3428
|
+
return await response.json();
|
|
3429
|
+
};
|
|
3430
|
+
var createVoiceCampaignDialerProofStore = (path = "/api/voice/campaigns/dialer-proof", options = {}) => {
|
|
3431
|
+
const listeners = new Set;
|
|
3432
|
+
let closed = false;
|
|
3433
|
+
let timer;
|
|
3434
|
+
let snapshot = {
|
|
3435
|
+
error: null,
|
|
3436
|
+
isLoading: false
|
|
3437
|
+
};
|
|
3438
|
+
const emit = () => {
|
|
3439
|
+
for (const listener of listeners) {
|
|
3440
|
+
listener();
|
|
3441
|
+
}
|
|
3442
|
+
};
|
|
3443
|
+
const refresh = async () => {
|
|
3444
|
+
if (closed) {
|
|
3445
|
+
return snapshot.status;
|
|
3446
|
+
}
|
|
3447
|
+
snapshot = { ...snapshot, error: null, isLoading: true };
|
|
3448
|
+
emit();
|
|
3449
|
+
try {
|
|
3450
|
+
const status = await fetchVoiceCampaignDialerProofStatus(path, options);
|
|
3451
|
+
snapshot = {
|
|
3452
|
+
...snapshot,
|
|
3453
|
+
error: null,
|
|
3454
|
+
isLoading: false,
|
|
3455
|
+
status,
|
|
3456
|
+
updatedAt: Date.now()
|
|
3457
|
+
};
|
|
3458
|
+
emit();
|
|
3459
|
+
return status;
|
|
3460
|
+
} catch (error) {
|
|
3461
|
+
snapshot = {
|
|
3462
|
+
...snapshot,
|
|
3463
|
+
error: error instanceof Error ? error.message : String(error),
|
|
3464
|
+
isLoading: false
|
|
3465
|
+
};
|
|
3466
|
+
emit();
|
|
3467
|
+
throw error;
|
|
3468
|
+
}
|
|
3469
|
+
};
|
|
3470
|
+
const runProof = async () => {
|
|
3471
|
+
const runPath = options.runPath ?? snapshot.status?.runPath ?? path;
|
|
3472
|
+
snapshot = { ...snapshot, error: null, isLoading: true };
|
|
3473
|
+
emit();
|
|
3474
|
+
try {
|
|
3475
|
+
const report = await runVoiceCampaignDialerProofAction(runPath, options);
|
|
3476
|
+
snapshot = {
|
|
3477
|
+
...snapshot,
|
|
3478
|
+
error: null,
|
|
3479
|
+
isLoading: false,
|
|
3480
|
+
report,
|
|
3481
|
+
status: {
|
|
3482
|
+
generatedAt: Date.now(),
|
|
3483
|
+
mode: report.mode,
|
|
3484
|
+
ok: report.ok,
|
|
3485
|
+
providers: report.providers.map((provider) => provider.provider),
|
|
3486
|
+
runPath,
|
|
3487
|
+
safe: true
|
|
3488
|
+
},
|
|
3489
|
+
updatedAt: Date.now()
|
|
3490
|
+
};
|
|
3491
|
+
emit();
|
|
3492
|
+
return report;
|
|
3493
|
+
} catch (error) {
|
|
3494
|
+
snapshot = {
|
|
3495
|
+
...snapshot,
|
|
3496
|
+
error: error instanceof Error ? error.message : String(error),
|
|
3497
|
+
isLoading: false
|
|
3498
|
+
};
|
|
3499
|
+
emit();
|
|
3500
|
+
throw error;
|
|
3501
|
+
}
|
|
3502
|
+
};
|
|
3503
|
+
const close = () => {
|
|
3504
|
+
closed = true;
|
|
3505
|
+
if (timer) {
|
|
3506
|
+
clearInterval(timer);
|
|
3507
|
+
timer = undefined;
|
|
3508
|
+
}
|
|
3509
|
+
listeners.clear();
|
|
3510
|
+
};
|
|
3511
|
+
if (options.intervalMs && options.intervalMs > 0) {
|
|
3512
|
+
timer = setInterval(() => {
|
|
3513
|
+
refresh().catch(() => {});
|
|
3514
|
+
}, options.intervalMs);
|
|
3515
|
+
}
|
|
3516
|
+
return {
|
|
3517
|
+
close,
|
|
3518
|
+
getServerSnapshot: () => snapshot,
|
|
3519
|
+
getSnapshot: () => snapshot,
|
|
3520
|
+
refresh,
|
|
3521
|
+
runProof,
|
|
3522
|
+
subscribe: (listener) => {
|
|
3523
|
+
listeners.add(listener);
|
|
3524
|
+
return () => {
|
|
3525
|
+
listeners.delete(listener);
|
|
3526
|
+
};
|
|
3527
|
+
}
|
|
3528
|
+
};
|
|
3529
|
+
};
|
|
3530
|
+
// src/client/traceTimeline.ts
|
|
3531
|
+
var fetchVoiceTraceTimeline = async (path = "/api/voice-traces", options = {}) => {
|
|
3532
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
3533
|
+
const response = await fetchImpl(path);
|
|
3534
|
+
if (!response.ok) {
|
|
3535
|
+
throw new Error(`Voice trace timeline failed: HTTP ${response.status}`);
|
|
3536
|
+
}
|
|
3537
|
+
return await response.json();
|
|
3538
|
+
};
|
|
3539
|
+
var createVoiceTraceTimelineStore = (path = "/api/voice-traces", options = {}) => {
|
|
3540
|
+
const listeners = new Set;
|
|
3541
|
+
let closed = false;
|
|
3542
|
+
let timer;
|
|
3543
|
+
let snapshot = {
|
|
3544
|
+
error: null,
|
|
3545
|
+
isLoading: false,
|
|
3546
|
+
report: null
|
|
3547
|
+
};
|
|
3548
|
+
const emit = () => {
|
|
3549
|
+
for (const listener of listeners) {
|
|
3550
|
+
listener();
|
|
3551
|
+
}
|
|
3552
|
+
};
|
|
3553
|
+
const refresh = async () => {
|
|
3554
|
+
if (closed) {
|
|
3555
|
+
return snapshot.report;
|
|
3556
|
+
}
|
|
3557
|
+
snapshot = {
|
|
3558
|
+
...snapshot,
|
|
3559
|
+
error: null,
|
|
3560
|
+
isLoading: true
|
|
3561
|
+
};
|
|
3562
|
+
emit();
|
|
3563
|
+
try {
|
|
3564
|
+
const report = await fetchVoiceTraceTimeline(path, options);
|
|
3565
|
+
snapshot = {
|
|
3566
|
+
error: null,
|
|
3567
|
+
isLoading: false,
|
|
3568
|
+
report,
|
|
3569
|
+
updatedAt: Date.now()
|
|
3570
|
+
};
|
|
3571
|
+
emit();
|
|
3572
|
+
return report;
|
|
3573
|
+
} catch (error) {
|
|
3574
|
+
snapshot = {
|
|
3575
|
+
...snapshot,
|
|
3576
|
+
error: error instanceof Error ? error.message : String(error),
|
|
3577
|
+
isLoading: false
|
|
3578
|
+
};
|
|
3579
|
+
emit();
|
|
3580
|
+
throw error;
|
|
3581
|
+
}
|
|
3582
|
+
};
|
|
3583
|
+
const close = () => {
|
|
3584
|
+
closed = true;
|
|
3585
|
+
if (timer) {
|
|
3586
|
+
clearInterval(timer);
|
|
3587
|
+
timer = undefined;
|
|
3588
|
+
}
|
|
3589
|
+
listeners.clear();
|
|
3590
|
+
};
|
|
3591
|
+
if (options.intervalMs && options.intervalMs > 0) {
|
|
3592
|
+
timer = setInterval(() => {
|
|
3593
|
+
refresh().catch(() => {});
|
|
3594
|
+
}, options.intervalMs);
|
|
3595
|
+
}
|
|
3596
|
+
return {
|
|
3597
|
+
close,
|
|
3598
|
+
getServerSnapshot: () => snapshot,
|
|
3599
|
+
getSnapshot: () => snapshot,
|
|
3600
|
+
refresh,
|
|
3601
|
+
subscribe: (listener) => {
|
|
3602
|
+
listeners.add(listener);
|
|
3603
|
+
return () => {
|
|
3604
|
+
listeners.delete(listener);
|
|
3605
|
+
};
|
|
3606
|
+
}
|
|
3607
|
+
};
|
|
3608
|
+
};
|
|
3609
|
+
// src/client/providerSimulationControls.ts
|
|
3610
|
+
var postSimulation = async (pathPrefix, mode, provider, fetchImpl) => {
|
|
3611
|
+
const response = await fetchImpl(`${pathPrefix}/${mode}?provider=${encodeURIComponent(provider)}`, { method: "POST" });
|
|
3612
|
+
const body = await response.json().catch(() => null);
|
|
3613
|
+
if (!response.ok) {
|
|
3614
|
+
const message = body && typeof body === "object" && "error" in body ? String(body.error) : `Voice provider simulation failed: HTTP ${response.status}`;
|
|
3615
|
+
throw new Error(message);
|
|
3616
|
+
}
|
|
3617
|
+
return body;
|
|
3618
|
+
};
|
|
3619
|
+
var createVoiceProviderSimulationControlsStore = (options) => {
|
|
3620
|
+
const listeners = new Set;
|
|
3621
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
3622
|
+
const pathPrefix = options.pathPrefix ?? `/api/${options.kind ?? "stt"}-simulate`;
|
|
3623
|
+
let closed = false;
|
|
3624
|
+
let snapshot = {
|
|
3625
|
+
error: null,
|
|
3626
|
+
isRunning: false,
|
|
3627
|
+
lastResult: null,
|
|
3628
|
+
mode: null,
|
|
3629
|
+
provider: null
|
|
3630
|
+
};
|
|
3631
|
+
const emit = () => {
|
|
3632
|
+
for (const listener of listeners) {
|
|
3633
|
+
listener();
|
|
3634
|
+
}
|
|
3635
|
+
};
|
|
3636
|
+
const run = async (provider, mode) => {
|
|
3637
|
+
if (closed) {
|
|
3638
|
+
return snapshot.lastResult;
|
|
3639
|
+
}
|
|
3640
|
+
snapshot = {
|
|
3641
|
+
...snapshot,
|
|
3642
|
+
error: null,
|
|
3643
|
+
isRunning: true,
|
|
3644
|
+
mode,
|
|
3645
|
+
provider
|
|
3646
|
+
};
|
|
3647
|
+
emit();
|
|
3648
|
+
try {
|
|
3649
|
+
const result = await postSimulation(pathPrefix, mode, provider, fetchImpl);
|
|
3650
|
+
snapshot = {
|
|
3651
|
+
error: null,
|
|
3652
|
+
isRunning: false,
|
|
3653
|
+
lastResult: result,
|
|
3654
|
+
mode,
|
|
3655
|
+
provider,
|
|
3656
|
+
updatedAt: Date.now()
|
|
3657
|
+
};
|
|
3658
|
+
emit();
|
|
3659
|
+
return result;
|
|
3660
|
+
} catch (error) {
|
|
3661
|
+
snapshot = {
|
|
3662
|
+
...snapshot,
|
|
3663
|
+
error: error instanceof Error ? error.message : String(error),
|
|
3664
|
+
isRunning: false
|
|
3665
|
+
};
|
|
3666
|
+
emit();
|
|
3667
|
+
throw error;
|
|
3668
|
+
}
|
|
3669
|
+
};
|
|
3670
|
+
const close = () => {
|
|
3671
|
+
closed = true;
|
|
3672
|
+
listeners.clear();
|
|
3673
|
+
};
|
|
3674
|
+
return {
|
|
3675
|
+
close,
|
|
3676
|
+
getServerSnapshot: () => snapshot,
|
|
3677
|
+
getSnapshot: () => snapshot,
|
|
3678
|
+
run,
|
|
3679
|
+
subscribe: (listener) => {
|
|
3680
|
+
listeners.add(listener);
|
|
3681
|
+
return () => {
|
|
3682
|
+
listeners.delete(listener);
|
|
3683
|
+
};
|
|
3684
|
+
}
|
|
3685
|
+
};
|
|
3686
|
+
};
|
|
3687
|
+
// src/client/providerSimulationControlsWidget.ts
|
|
3688
|
+
var escapeHtml6 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
3689
|
+
var formatKind = (kind) => (kind ?? "stt").toUpperCase();
|
|
3690
|
+
var createVoiceProviderSimulationControlsViewModel = (snapshot, options) => {
|
|
3691
|
+
const configuredProviders = options.providers.filter((provider) => provider.configured !== false);
|
|
3692
|
+
const fallbackReady = !options.fallbackRequiredProvider || configuredProviders.some((entry) => entry.provider === options.fallbackRequiredProvider);
|
|
3693
|
+
const failureProviders = (options.failureProviders ? options.failureProviders.map((provider) => ({ provider })) : configuredProviders).filter((provider) => configuredProviders.some((entry) => entry.provider === provider.provider));
|
|
3694
|
+
return {
|
|
3695
|
+
canSimulateFailure: configuredProviders.length > 0 && fallbackReady,
|
|
3696
|
+
description: options.failureMessage ?? `Simulate ${formatKind(options.kind)} provider failure and recovery without changing credentials.`,
|
|
3697
|
+
error: snapshot.error,
|
|
3698
|
+
failureProviders,
|
|
3699
|
+
isRunning: snapshot.isRunning,
|
|
3700
|
+
label: snapshot.isRunning ? `Running ${snapshot.mode ?? "simulation"}` : snapshot.lastResult ? `${snapshot.lastResult.provider} ${snapshot.lastResult.mode} simulated` : configuredProviders.length ? `${configuredProviders.length} configured` : "No configured providers",
|
|
3701
|
+
providers: configuredProviders,
|
|
3702
|
+
resultText: snapshot.lastResult ? JSON.stringify(snapshot.lastResult, null, 2) : null,
|
|
3703
|
+
title: options.title ?? `${formatKind(options.kind)} Failure Simulation`
|
|
3704
|
+
};
|
|
3705
|
+
};
|
|
3706
|
+
var renderVoiceProviderSimulationControlsHTML = (snapshot, options) => {
|
|
3707
|
+
const model = createVoiceProviderSimulationControlsViewModel(snapshot, options);
|
|
3708
|
+
const failureButtons = model.failureProviders.map((provider) => `<button type="button" data-voice-provider-fail="${escapeHtml6(provider.provider)}"${!model.canSimulateFailure || snapshot.isRunning ? " disabled" : ""}>Simulate ${escapeHtml6(provider.provider)} ${escapeHtml6(formatKind(options.kind))} failure</button>`).join("");
|
|
3709
|
+
const recoveryButtons = model.providers.map((provider) => `<button type="button" data-voice-provider-recover="${escapeHtml6(provider.provider)}"${snapshot.isRunning ? " disabled" : ""}>Mark ${escapeHtml6(provider.provider)} recovered</button>`).join("");
|
|
3710
|
+
return `<section class="absolute-voice-provider-simulation absolute-voice-provider-simulation--${snapshot.error ? "error" : snapshot.isRunning ? "running" : "ready"}">
|
|
3711
|
+
<header class="absolute-voice-provider-simulation__header">
|
|
3712
|
+
<span class="absolute-voice-provider-simulation__eyebrow">${escapeHtml6(model.title)}</span>
|
|
3713
|
+
<strong class="absolute-voice-provider-simulation__label">${escapeHtml6(model.label)}</strong>
|
|
3714
|
+
</header>
|
|
3715
|
+
<p class="absolute-voice-provider-simulation__description">${escapeHtml6(model.description)}</p>
|
|
3716
|
+
${model.canSimulateFailure ? "" : `<p class="absolute-voice-provider-simulation__empty">${escapeHtml6(options.fallbackRequiredMessage ?? "Configure fallback providers before simulating failure.")}</p>`}
|
|
3717
|
+
<div class="absolute-voice-provider-simulation__actions">${failureButtons}${recoveryButtons}</div>
|
|
3718
|
+
${snapshot.error ? `<p class="absolute-voice-provider-simulation__error">${escapeHtml6(snapshot.error)}</p>` : ""}
|
|
3719
|
+
${model.resultText ? `<pre class="absolute-voice-provider-simulation__result">${escapeHtml6(model.resultText)}</pre>` : ""}
|
|
3720
|
+
</section>`;
|
|
3721
|
+
};
|
|
3722
|
+
var bindVoiceProviderSimulationControls = (element, store) => {
|
|
3723
|
+
const onClick = (event) => {
|
|
3724
|
+
const target = event.target;
|
|
3725
|
+
if (!(target instanceof HTMLElement)) {
|
|
3726
|
+
return;
|
|
3727
|
+
}
|
|
3728
|
+
const failProvider = target.getAttribute("data-voice-provider-fail");
|
|
3729
|
+
const recoverProvider = target.getAttribute("data-voice-provider-recover");
|
|
3730
|
+
if (failProvider) {
|
|
3731
|
+
store.run(failProvider, "failure").catch(() => {});
|
|
3732
|
+
}
|
|
3733
|
+
if (recoverProvider) {
|
|
3734
|
+
store.run(recoverProvider, "recovery").catch(() => {});
|
|
3735
|
+
}
|
|
3736
|
+
};
|
|
3737
|
+
element.addEventListener("click", onClick);
|
|
3738
|
+
return () => element.removeEventListener("click", onClick);
|
|
3739
|
+
};
|
|
3740
|
+
var mountVoiceProviderSimulationControls = (element, options) => {
|
|
3741
|
+
const store = createVoiceProviderSimulationControlsStore(options);
|
|
3742
|
+
const render = () => {
|
|
3743
|
+
element.innerHTML = renderVoiceProviderSimulationControlsHTML(store.getSnapshot(), options);
|
|
3744
|
+
};
|
|
3745
|
+
const unsubscribeStore = store.subscribe(render);
|
|
3746
|
+
const unsubscribeDom = bindVoiceProviderSimulationControls(element, store);
|
|
3747
|
+
render();
|
|
3748
|
+
return {
|
|
3749
|
+
close: () => {
|
|
3750
|
+
unsubscribeDom();
|
|
3751
|
+
unsubscribeStore();
|
|
3752
|
+
store.close();
|
|
3753
|
+
},
|
|
3754
|
+
run: store.run
|
|
3755
|
+
};
|
|
3756
|
+
};
|
|
3757
|
+
var defineVoiceProviderSimulationControlsElement = (tagName = "absolute-voice-provider-simulation") => {
|
|
3758
|
+
if (typeof window === "undefined" || typeof customElements === "undefined" || customElements.get(tagName)) {
|
|
3759
|
+
return;
|
|
3760
|
+
}
|
|
3761
|
+
customElements.define(tagName, class AbsoluteVoiceProviderSimulationElement extends HTMLElement {
|
|
3762
|
+
mounted;
|
|
3763
|
+
connectedCallback() {
|
|
3764
|
+
const providers = (this.getAttribute("providers") ?? "").split(",").map((provider) => provider.trim()).filter(Boolean).map((provider) => ({ provider }));
|
|
3765
|
+
const failureProviders = (this.getAttribute("failure-providers") ?? "").split(",").map((provider) => provider.trim()).filter(Boolean);
|
|
3766
|
+
this.mounted = mountVoiceProviderSimulationControls(this, {
|
|
3767
|
+
failureProviders: failureProviders.length ? failureProviders : undefined,
|
|
3768
|
+
fallbackRequiredMessage: this.getAttribute("fallback-required-message") ?? undefined,
|
|
3769
|
+
fallbackRequiredProvider: this.getAttribute("fallback-required-provider") ?? undefined,
|
|
3770
|
+
failureMessage: this.getAttribute("failure-message") ?? undefined,
|
|
3771
|
+
kind: this.getAttribute("kind") ?? "stt",
|
|
3772
|
+
pathPrefix: this.getAttribute("path-prefix") ?? undefined,
|
|
3773
|
+
providers,
|
|
3774
|
+
title: this.getAttribute("title") ?? undefined
|
|
3775
|
+
});
|
|
3776
|
+
}
|
|
3777
|
+
disconnectedCallback() {
|
|
3778
|
+
this.mounted?.close();
|
|
3779
|
+
this.mounted = undefined;
|
|
3780
|
+
}
|
|
3781
|
+
});
|
|
3782
|
+
};
|
|
3783
|
+
// src/client/providerStatusWidget.ts
|
|
3784
|
+
var DEFAULT_TITLE5 = "Voice Providers";
|
|
3785
|
+
var DEFAULT_DESCRIPTION5 = "Live provider health, fallback counts, latency, and suppression state from your self-hosted trace store.";
|
|
3786
|
+
var escapeHtml7 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
3787
|
+
var formatProvider = (provider) => provider.split(/[-_\s]+/).filter(Boolean).map((part) => `${part[0]?.toUpperCase() ?? ""}${part.slice(1)}`).join(" ") || provider;
|
|
3788
|
+
var formatStatus = (status) => status.split("-").map((part) => `${part[0]?.toUpperCase() ?? ""}${part.slice(1)}`).join(" ");
|
|
3789
|
+
var formatLatency = (value) => typeof value === "number" ? `${value}ms` : "No samples";
|
|
3790
|
+
var formatSuppression = (value) => typeof value === "number" ? `${Math.ceil(value / 1000)}s` : "None";
|
|
3791
|
+
var getProviderDetail = (provider) => {
|
|
3792
|
+
if (provider.status === "suppressed") {
|
|
3793
|
+
return provider.lastError ? `Suppressed for ${formatSuppression(provider.suppressionRemainingMs)} after ${provider.lastError}.` : `Suppressed for ${formatSuppression(provider.suppressionRemainingMs)}.`;
|
|
3794
|
+
}
|
|
3795
|
+
if (provider.status === "recoverable") {
|
|
3796
|
+
return "Cooldown expired; ready for recovery traffic.";
|
|
3797
|
+
}
|
|
3798
|
+
if (provider.status === "rate-limited") {
|
|
3799
|
+
return "Rate limit detected; router should avoid this provider.";
|
|
3800
|
+
}
|
|
3801
|
+
if (provider.status === "degraded") {
|
|
3802
|
+
return provider.lastError ?? "Recent provider errors detected.";
|
|
3803
|
+
}
|
|
3804
|
+
if (provider.status === "healthy") {
|
|
3805
|
+
return provider.recommended ? "Healthy and currently recommended." : "Healthy and available for routing.";
|
|
3806
|
+
}
|
|
3807
|
+
return "No provider traffic observed yet.";
|
|
3808
|
+
};
|
|
3809
|
+
var isWarningStatus = (status) => status === "degraded" || status === "rate-limited" || status === "recoverable" || status === "suppressed";
|
|
3810
|
+
var createVoiceProviderStatusViewModel = (snapshot, options = {}) => {
|
|
3811
|
+
const providers = snapshot.providers.map((provider) => ({
|
|
3812
|
+
...provider,
|
|
3813
|
+
detail: getProviderDetail(provider),
|
|
3814
|
+
label: `${formatProvider(provider.provider)}${provider.recommended ? " recommended" : ""}`,
|
|
3815
|
+
rows: [
|
|
3816
|
+
{ label: "Runs", value: String(provider.runCount) },
|
|
3817
|
+
{ label: "Avg latency", value: formatLatency(provider.averageElapsedMs) },
|
|
3818
|
+
{ label: "Errors", value: String(provider.errorCount) },
|
|
3819
|
+
{ label: "Timeouts", value: String(provider.timeoutCount) },
|
|
3820
|
+
{ label: "Fallbacks", value: String(provider.fallbackCount) },
|
|
3821
|
+
{
|
|
3822
|
+
label: "Suppression",
|
|
3823
|
+
value: formatSuppression(provider.suppressionRemainingMs)
|
|
3824
|
+
}
|
|
3825
|
+
]
|
|
3826
|
+
}));
|
|
3827
|
+
const warningCount = providers.filter((provider) => isWarningStatus(provider.status)).length;
|
|
3828
|
+
const healthyCount = providers.filter((provider) => provider.status === "healthy").length;
|
|
3829
|
+
return {
|
|
3830
|
+
description: options.description ?? DEFAULT_DESCRIPTION5,
|
|
3831
|
+
error: snapshot.error,
|
|
3832
|
+
isLoading: snapshot.isLoading,
|
|
3833
|
+
label: snapshot.error ? "Unavailable" : providers.length ? warningCount > 0 ? `${warningCount} needs attention` : `${healthyCount} healthy` : snapshot.isLoading ? "Checking" : "No provider traffic",
|
|
3834
|
+
providers,
|
|
3835
|
+
status: snapshot.error ? "error" : providers.length ? warningCount > 0 ? "warning" : "ready" : snapshot.isLoading ? "loading" : "empty",
|
|
3836
|
+
title: options.title ?? DEFAULT_TITLE5,
|
|
3837
|
+
updatedAt: snapshot.updatedAt
|
|
3838
|
+
};
|
|
3839
|
+
};
|
|
3840
|
+
var renderVoiceProviderStatusHTML = (snapshot, options = {}) => {
|
|
3841
|
+
const model = createVoiceProviderStatusViewModel(snapshot, options);
|
|
3842
|
+
const providers = model.providers.length ? `<div class="absolute-voice-provider-status__providers">${model.providers.map((provider) => `<article class="absolute-voice-provider-status__provider absolute-voice-provider-status__provider--${escapeHtml7(provider.status)}">
|
|
3843
|
+
<header>
|
|
3844
|
+
<strong>${escapeHtml7(provider.label)}</strong>
|
|
3845
|
+
<span>${escapeHtml7(formatStatus(provider.status))}</span>
|
|
3846
|
+
</header>
|
|
3847
|
+
<p>${escapeHtml7(provider.detail)}</p>
|
|
3848
|
+
<dl>${provider.rows.map((row) => `<div>
|
|
3849
|
+
<dt>${escapeHtml7(row.label)}</dt>
|
|
3850
|
+
<dd>${escapeHtml7(row.value)}</dd>
|
|
3851
|
+
</div>`).join("")}</dl>
|
|
3852
|
+
</article>`).join("")}</div>` : '<p class="absolute-voice-provider-status__empty">Run voice traffic to see provider health.</p>';
|
|
3853
|
+
return `<section class="absolute-voice-provider-status absolute-voice-provider-status--${escapeHtml7(model.status)}">
|
|
3854
|
+
<header class="absolute-voice-provider-status__header">
|
|
3855
|
+
<span class="absolute-voice-provider-status__eyebrow">${escapeHtml7(model.title)}</span>
|
|
3856
|
+
<strong class="absolute-voice-provider-status__label">${escapeHtml7(model.label)}</strong>
|
|
3857
|
+
</header>
|
|
3858
|
+
<p class="absolute-voice-provider-status__description">${escapeHtml7(model.description)}</p>
|
|
3859
|
+
${providers}
|
|
3860
|
+
${model.error ? `<p class="absolute-voice-provider-status__error">${escapeHtml7(model.error)}</p>` : ""}
|
|
3861
|
+
</section>`;
|
|
3862
|
+
};
|
|
3863
|
+
var getVoiceProviderStatusCSS = () => `.absolute-voice-provider-status{border:1px solid #d8d2c4;border-radius:20px;background:#fffaf0;color:#16130d;padding:18px;box-shadow:0 18px 40px rgba(47,37,18,.12);font-family:inherit}.absolute-voice-provider-status--error,.absolute-voice-provider-status--warning{border-color:#f2a7a7;background:#fff5f3}.absolute-voice-provider-status__header,.absolute-voice-provider-status__provider header{align-items:start;display:flex;gap:12px;justify-content:space-between}.absolute-voice-provider-status__eyebrow{color:#73664f;font-size:12px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}.absolute-voice-provider-status__label{font-size:24px;line-height:1}.absolute-voice-provider-status__description,.absolute-voice-provider-status__provider p,.absolute-voice-provider-status__provider dt,.absolute-voice-provider-status__empty{color:#514733}.absolute-voice-provider-status__providers{display:grid;gap:12px;margin-top:14px}.absolute-voice-provider-status__provider{background:#fff;border:1px solid #eee4d2;border-radius:16px;padding:14px}.absolute-voice-provider-status__provider--degraded,.absolute-voice-provider-status__provider--rate-limited,.absolute-voice-provider-status__provider--suppressed{border-color:#f2a7a7}.absolute-voice-provider-status__provider--recoverable{border-color:#fbbf24}.absolute-voice-provider-status__provider p{margin:10px 0}.absolute-voice-provider-status__provider dl{display:grid;gap:8px;grid-template-columns:repeat(2,minmax(0,1fr));margin:0}.absolute-voice-provider-status__provider div{background:#fffaf0;border:1px solid #eee4d2;border-radius:12px;padding:8px}.absolute-voice-provider-status__provider dt{font-size:12px}.absolute-voice-provider-status__provider dd{font-weight:800;margin:4px 0 0}.absolute-voice-provider-status__empty{margin:14px 0 0}.absolute-voice-provider-status__error{color:#9f1239;font-weight:700}`;
|
|
3864
|
+
var mountVoiceProviderStatus = (element, path = "/api/provider-status", options = {}) => {
|
|
3865
|
+
const store = createVoiceProviderStatusStore(path, options);
|
|
3866
|
+
const render = () => {
|
|
3867
|
+
element.innerHTML = renderVoiceProviderStatusHTML(store.getSnapshot(), options);
|
|
3868
|
+
};
|
|
3869
|
+
const unsubscribe = store.subscribe(render);
|
|
3870
|
+
render();
|
|
3871
|
+
store.refresh().catch(() => {});
|
|
3872
|
+
return {
|
|
3873
|
+
close: () => {
|
|
3874
|
+
unsubscribe();
|
|
3875
|
+
store.close();
|
|
3876
|
+
},
|
|
3877
|
+
refresh: store.refresh
|
|
3878
|
+
};
|
|
3879
|
+
};
|
|
3880
|
+
var defineVoiceProviderStatusElement = (tagName = "absolute-voice-provider-status") => {
|
|
3881
|
+
if (typeof window === "undefined" || typeof customElements === "undefined" || customElements.get(tagName)) {
|
|
3882
|
+
return;
|
|
3883
|
+
}
|
|
3884
|
+
customElements.define(tagName, class AbsoluteVoiceProviderStatusElement extends HTMLElement {
|
|
3885
|
+
mounted;
|
|
3886
|
+
connectedCallback() {
|
|
3887
|
+
const intervalMs = Number(this.getAttribute("interval-ms") ?? 5000);
|
|
3888
|
+
this.mounted = mountVoiceProviderStatus(this, this.getAttribute("path") ?? "/api/provider-status", {
|
|
3889
|
+
description: this.getAttribute("description") ?? undefined,
|
|
3890
|
+
intervalMs: Number.isFinite(intervalMs) ? intervalMs : 5000,
|
|
3891
|
+
title: this.getAttribute("title") ?? undefined
|
|
3892
|
+
});
|
|
3893
|
+
}
|
|
3894
|
+
disconnectedCallback() {
|
|
3895
|
+
this.mounted?.close();
|
|
3896
|
+
this.mounted = undefined;
|
|
3897
|
+
}
|
|
3898
|
+
});
|
|
3899
|
+
};
|
|
3900
|
+
// src/client/providerCapabilitiesWidget.ts
|
|
3901
|
+
var DEFAULT_TITLE6 = "Provider Capabilities";
|
|
3902
|
+
var DEFAULT_DESCRIPTION6 = "Configured, selected, and healthy voice providers for this deployment.";
|
|
3903
|
+
var escapeHtml8 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
3904
|
+
var formatProvider2 = (provider) => provider.split(/[-_\s]+/).filter(Boolean).map((part) => `${part[0]?.toUpperCase() ?? ""}${part.slice(1)}`).join(" ") || provider;
|
|
3905
|
+
var formatKind2 = (kind) => kind.toUpperCase();
|
|
3906
|
+
var formatStatus2 = (status) => status.split("-").map((part) => `${part[0]?.toUpperCase() ?? ""}${part.slice(1)}`).join(" ");
|
|
3907
|
+
var getCapabilityDetail = (capability) => {
|
|
3908
|
+
if (!capability.configured) {
|
|
3909
|
+
return "Not configured in this deployment.";
|
|
3910
|
+
}
|
|
3911
|
+
if (capability.selected) {
|
|
3912
|
+
return `Selected ${capability.kind.toUpperCase()} provider for new sessions.`;
|
|
3913
|
+
}
|
|
3914
|
+
if (capability.health?.status === "healthy") {
|
|
3915
|
+
return "Configured and healthy fallback candidate.";
|
|
3916
|
+
}
|
|
3917
|
+
if (capability.health?.status === "idle") {
|
|
3918
|
+
return "Configured; no traffic observed yet.";
|
|
3919
|
+
}
|
|
3920
|
+
if (capability.health?.lastError) {
|
|
3921
|
+
return capability.health.lastError;
|
|
3922
|
+
}
|
|
3923
|
+
return "Configured and available.";
|
|
3924
|
+
};
|
|
3925
|
+
var isWarningStatus2 = (status) => status === "degraded" || status === "rate-limited" || status === "suppressed" || status === "unconfigured";
|
|
3926
|
+
var createVoiceProviderCapabilitiesViewModel = (snapshot, options = {}) => {
|
|
3927
|
+
const capabilities = (snapshot.report?.capabilities ?? []).map((capability) => ({
|
|
3928
|
+
...capability,
|
|
3929
|
+
detail: getCapabilityDetail(capability),
|
|
3930
|
+
label: `${formatProvider2(capability.provider)} ${formatKind2(capability.kind)}`,
|
|
3931
|
+
rows: [
|
|
3932
|
+
{ label: "Status", value: formatStatus2(capability.status) },
|
|
3933
|
+
{ label: "Selected", value: capability.selected ? "Yes" : "No" },
|
|
3934
|
+
{ label: "Model", value: capability.model ?? "Default" },
|
|
3935
|
+
{
|
|
3936
|
+
label: "Features",
|
|
3937
|
+
value: capability.features?.join(", ") || "Not specified"
|
|
3938
|
+
},
|
|
3939
|
+
{ label: "Runs", value: String(capability.health?.runCount ?? 0) },
|
|
3940
|
+
{ label: "Errors", value: String(capability.health?.errorCount ?? 0) }
|
|
3941
|
+
]
|
|
3942
|
+
}));
|
|
3943
|
+
const warningCount = capabilities.filter((capability) => isWarningStatus2(capability.status)).length;
|
|
3944
|
+
const selectedCount = snapshot.report?.selected ?? capabilities.filter((capability) => capability.selected).length;
|
|
3945
|
+
return {
|
|
3946
|
+
capabilities,
|
|
3947
|
+
description: options.description ?? DEFAULT_DESCRIPTION6,
|
|
3948
|
+
error: snapshot.error,
|
|
3949
|
+
isLoading: snapshot.isLoading,
|
|
3950
|
+
label: snapshot.error ? "Unavailable" : capabilities.length ? warningCount > 0 ? `${warningCount} needs attention` : `${selectedCount} selected` : snapshot.isLoading ? "Checking" : "No capabilities",
|
|
3951
|
+
status: snapshot.error ? "error" : capabilities.length ? warningCount > 0 ? "warning" : "ready" : snapshot.isLoading ? "loading" : "empty",
|
|
3952
|
+
title: options.title ?? DEFAULT_TITLE6,
|
|
3953
|
+
updatedAt: snapshot.updatedAt
|
|
3954
|
+
};
|
|
3955
|
+
};
|
|
3956
|
+
var renderVoiceProviderCapabilitiesHTML = (snapshot, options = {}) => {
|
|
3957
|
+
const model = createVoiceProviderCapabilitiesViewModel(snapshot, options);
|
|
3958
|
+
const capabilities = model.capabilities.length ? `<div class="absolute-voice-provider-capabilities__providers">${model.capabilities.map((capability) => `<article class="absolute-voice-provider-capabilities__provider absolute-voice-provider-capabilities__provider--${escapeHtml8(capability.status)}">
|
|
3959
|
+
<header>
|
|
3960
|
+
<strong>${escapeHtml8(capability.label)}</strong>
|
|
3961
|
+
<span>${escapeHtml8(formatStatus2(capability.status))}</span>
|
|
3962
|
+
</header>
|
|
3963
|
+
<p>${escapeHtml8(capability.detail)}</p>
|
|
3964
|
+
<dl>${capability.rows.map((row) => `<div>
|
|
3965
|
+
<dt>${escapeHtml8(row.label)}</dt>
|
|
3966
|
+
<dd>${escapeHtml8(row.value)}</dd>
|
|
3967
|
+
</div>`).join("")}</dl>
|
|
3968
|
+
</article>`).join("")}</div>` : '<p class="absolute-voice-provider-capabilities__empty">Configure provider capabilities to see deployment coverage.</p>';
|
|
3969
|
+
return `<section class="absolute-voice-provider-capabilities absolute-voice-provider-capabilities--${escapeHtml8(model.status)}">
|
|
3970
|
+
<header class="absolute-voice-provider-capabilities__header">
|
|
3971
|
+
<span class="absolute-voice-provider-capabilities__eyebrow">${escapeHtml8(model.title)}</span>
|
|
3972
|
+
<strong class="absolute-voice-provider-capabilities__label">${escapeHtml8(model.label)}</strong>
|
|
3973
|
+
</header>
|
|
3974
|
+
<p class="absolute-voice-provider-capabilities__description">${escapeHtml8(model.description)}</p>
|
|
3975
|
+
${capabilities}
|
|
3976
|
+
${model.error ? `<p class="absolute-voice-provider-capabilities__error">${escapeHtml8(model.error)}</p>` : ""}
|
|
3977
|
+
</section>`;
|
|
3978
|
+
};
|
|
3979
|
+
var getVoiceProviderCapabilitiesCSS = () => `.absolute-voice-provider-capabilities{border:1px solid #bfd7ea;border-radius:20px;background:#f6fbff;color:#08131f;padding:18px;box-shadow:0 18px 40px rgba(14,51,78,.12);font-family:inherit}.absolute-voice-provider-capabilities--error,.absolute-voice-provider-capabilities--warning{border-color:#f2a7a7;background:#fff5f3}.absolute-voice-provider-capabilities__header,.absolute-voice-provider-capabilities__provider header{align-items:start;display:flex;gap:12px;justify-content:space-between}.absolute-voice-provider-capabilities__eyebrow{color:#255f85;font-size:12px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}.absolute-voice-provider-capabilities__label{font-size:24px;line-height:1}.absolute-voice-provider-capabilities__description,.absolute-voice-provider-capabilities__provider p,.absolute-voice-provider-capabilities__provider dt,.absolute-voice-provider-capabilities__empty{color:#405467}.absolute-voice-provider-capabilities__providers{display:grid;gap:12px;margin-top:14px}.absolute-voice-provider-capabilities__provider{background:#fff;border:1px solid #d7e7f3;border-radius:16px;padding:14px}.absolute-voice-provider-capabilities__provider--selected,.absolute-voice-provider-capabilities__provider--healthy{border-color:#86efac}.absolute-voice-provider-capabilities__provider--degraded,.absolute-voice-provider-capabilities__provider--rate-limited,.absolute-voice-provider-capabilities__provider--suppressed,.absolute-voice-provider-capabilities__provider--unconfigured{border-color:#f2a7a7}.absolute-voice-provider-capabilities__provider p{margin:10px 0}.absolute-voice-provider-capabilities__provider dl{display:grid;gap:8px;grid-template-columns:repeat(2,minmax(0,1fr));margin:0}.absolute-voice-provider-capabilities__provider div{background:#f6fbff;border:1px solid #d7e7f3;border-radius:12px;padding:8px}.absolute-voice-provider-capabilities__provider dt{font-size:12px}.absolute-voice-provider-capabilities__provider dd{font-weight:800;margin:4px 0 0}.absolute-voice-provider-capabilities__empty{margin:14px 0 0}.absolute-voice-provider-capabilities__error{color:#9f1239;font-weight:700}`;
|
|
3980
|
+
var mountVoiceProviderCapabilities = (element, path = "/api/provider-capabilities", options = {}) => {
|
|
3981
|
+
const store = createVoiceProviderCapabilitiesStore(path, options);
|
|
3982
|
+
const render = () => {
|
|
3983
|
+
element.innerHTML = renderVoiceProviderCapabilitiesHTML(store.getSnapshot(), options);
|
|
3984
|
+
};
|
|
3985
|
+
const unsubscribe = store.subscribe(render);
|
|
3986
|
+
render();
|
|
3987
|
+
store.refresh().catch(() => {});
|
|
3988
|
+
return {
|
|
3989
|
+
close: () => {
|
|
3990
|
+
unsubscribe();
|
|
3991
|
+
store.close();
|
|
3992
|
+
},
|
|
3993
|
+
refresh: store.refresh
|
|
3994
|
+
};
|
|
3995
|
+
};
|
|
3996
|
+
var defineVoiceProviderCapabilitiesElement = (tagName = "absolute-voice-provider-capabilities") => {
|
|
3997
|
+
if (typeof window === "undefined" || typeof customElements === "undefined" || customElements.get(tagName)) {
|
|
3998
|
+
return;
|
|
3999
|
+
}
|
|
4000
|
+
customElements.define(tagName, class AbsoluteVoiceProviderCapabilitiesElement extends HTMLElement {
|
|
4001
|
+
mounted;
|
|
4002
|
+
connectedCallback() {
|
|
4003
|
+
const intervalMs = Number(this.getAttribute("interval-ms") ?? 5000);
|
|
4004
|
+
this.mounted = mountVoiceProviderCapabilities(this, this.getAttribute("path") ?? "/api/provider-capabilities", {
|
|
4005
|
+
description: this.getAttribute("description") ?? undefined,
|
|
4006
|
+
intervalMs: Number.isFinite(intervalMs) ? intervalMs : 5000,
|
|
4007
|
+
title: this.getAttribute("title") ?? undefined
|
|
4008
|
+
});
|
|
4009
|
+
}
|
|
4010
|
+
disconnectedCallback() {
|
|
4011
|
+
this.mounted?.close();
|
|
4012
|
+
this.mounted = undefined;
|
|
4013
|
+
}
|
|
4014
|
+
});
|
|
4015
|
+
};
|
|
4016
|
+
// src/client/providerContractsWidget.ts
|
|
4017
|
+
var DEFAULT_TITLE7 = "Provider Contracts";
|
|
4018
|
+
var DEFAULT_DESCRIPTION7 = "Production contract coverage for provider env, latency, fallback, streaming, and capabilities.";
|
|
4019
|
+
var escapeHtml9 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
4020
|
+
var formatProvider3 = (provider) => provider.split(/[-_\s]+/).filter(Boolean).map((part) => `${part[0]?.toUpperCase() ?? ""}${part.slice(1)}`).join(" ") || provider;
|
|
4021
|
+
var formatStatus3 = (status) => status.split("-").map((part) => `${part[0]?.toUpperCase() ?? ""}${part.slice(1)}`).join(" ");
|
|
4022
|
+
var contractDetail = (row) => {
|
|
4023
|
+
const failing = row.checks.filter((check) => check.status !== "pass");
|
|
4024
|
+
if (failing.length === 0) {
|
|
4025
|
+
return "Provider contract is production-ready.";
|
|
4026
|
+
}
|
|
4027
|
+
return failing.map((check) => `${check.label}: ${check.detail ?? check.status}`).join(" ");
|
|
4028
|
+
};
|
|
4029
|
+
var createVoiceProviderContractsViewModel = (snapshot, options = {}) => {
|
|
4030
|
+
const rows = (snapshot.report?.rows ?? []).map((row) => ({
|
|
4031
|
+
...row,
|
|
4032
|
+
detail: contractDetail(row),
|
|
4033
|
+
label: `${formatProvider3(row.provider)} ${row.kind.toUpperCase()}`,
|
|
4034
|
+
remediations: row.checks.filter((check) => check.status !== "pass" && check.remediation).map((check) => ({
|
|
4035
|
+
detail: check.remediation?.detail ?? "",
|
|
4036
|
+
href: check.remediation?.href,
|
|
4037
|
+
label: check.remediation?.label ?? check.label
|
|
4038
|
+
})),
|
|
4039
|
+
rows: [
|
|
4040
|
+
{ label: "Status", value: formatStatus3(row.status) },
|
|
4041
|
+
{ label: "Selected", value: row.selected ? "Yes" : "No" },
|
|
4042
|
+
{ label: "Configured", value: row.configured ? "Yes" : "No" },
|
|
4043
|
+
{
|
|
4044
|
+
label: "Checks",
|
|
4045
|
+
value: row.checks.map((check) => `${check.label}: ${formatStatus3(check.status)}`).join(", ")
|
|
4046
|
+
}
|
|
4047
|
+
]
|
|
4048
|
+
}));
|
|
4049
|
+
const warningCount = snapshot.report ? snapshot.report.failed + snapshot.report.warned : rows.filter((row) => row.status !== "pass").length;
|
|
4050
|
+
return {
|
|
4051
|
+
description: options.description ?? DEFAULT_DESCRIPTION7,
|
|
4052
|
+
error: snapshot.error,
|
|
4053
|
+
isLoading: snapshot.isLoading,
|
|
4054
|
+
label: snapshot.error ? "Unavailable" : rows.length ? warningCount > 0 ? `${warningCount} needs attention` : `${rows.length} passing` : snapshot.isLoading ? "Checking" : "No contracts",
|
|
4055
|
+
rows,
|
|
4056
|
+
status: snapshot.error ? "error" : rows.length ? warningCount > 0 ? "warning" : "ready" : snapshot.isLoading ? "loading" : "empty",
|
|
4057
|
+
title: options.title ?? DEFAULT_TITLE7,
|
|
4058
|
+
updatedAt: snapshot.updatedAt
|
|
4059
|
+
};
|
|
4060
|
+
};
|
|
4061
|
+
var renderVoiceProviderContractsHTML = (snapshot, options = {}) => {
|
|
4062
|
+
const model = createVoiceProviderContractsViewModel(snapshot, options);
|
|
4063
|
+
const rows = model.rows.length ? `<div class="absolute-voice-provider-contracts__rows">${model.rows.map((row) => `<article class="absolute-voice-provider-contracts__row absolute-voice-provider-contracts__row--${escapeHtml9(row.status)}">
|
|
4064
|
+
<header>
|
|
4065
|
+
<strong>${escapeHtml9(row.label)}</strong>
|
|
4066
|
+
<span>${escapeHtml9(formatStatus3(row.status))}</span>
|
|
4067
|
+
</header>
|
|
4068
|
+
<p>${escapeHtml9(row.detail)}</p>
|
|
4069
|
+
${row.remediations.length ? `<ul class="absolute-voice-provider-contracts__remediations">${row.remediations.map((remediation) => `<li>${remediation.href ? `<a href="${escapeHtml9(remediation.href)}">${escapeHtml9(remediation.label)}</a>` : `<strong>${escapeHtml9(remediation.label)}</strong>`}<span>${escapeHtml9(remediation.detail)}</span></li>`).join("")}</ul>` : ""}
|
|
4070
|
+
<dl>${row.rows.map((item) => `<div>
|
|
4071
|
+
<dt>${escapeHtml9(item.label)}</dt>
|
|
4072
|
+
<dd>${escapeHtml9(item.value)}</dd>
|
|
4073
|
+
</div>`).join("")}</dl>
|
|
4074
|
+
</article>`).join("")}</div>` : '<p class="absolute-voice-provider-contracts__empty">Configure provider contracts to see production coverage.</p>';
|
|
4075
|
+
return `<section class="absolute-voice-provider-contracts absolute-voice-provider-contracts--${escapeHtml9(model.status)}">
|
|
4076
|
+
<header class="absolute-voice-provider-contracts__header">
|
|
4077
|
+
<span class="absolute-voice-provider-contracts__eyebrow">${escapeHtml9(model.title)}</span>
|
|
4078
|
+
<strong class="absolute-voice-provider-contracts__label">${escapeHtml9(model.label)}</strong>
|
|
4079
|
+
</header>
|
|
4080
|
+
<p class="absolute-voice-provider-contracts__description">${escapeHtml9(model.description)}</p>
|
|
4081
|
+
${rows}
|
|
4082
|
+
${model.error ? `<p class="absolute-voice-provider-contracts__error">${escapeHtml9(model.error)}</p>` : ""}
|
|
4083
|
+
</section>`;
|
|
4084
|
+
};
|
|
4085
|
+
var getVoiceProviderContractsCSS = () => `.absolute-voice-provider-contracts{border:1px solid #b8dcc7;border-radius:20px;background:#f7fff9;color:#09140d;padding:18px;box-shadow:0 18px 40px rgba(21,83,45,.12);font-family:inherit}.absolute-voice-provider-contracts--error,.absolute-voice-provider-contracts--warning{border-color:#f2a7a7;background:#fff7f4}.absolute-voice-provider-contracts__header,.absolute-voice-provider-contracts__row header{align-items:start;display:flex;gap:12px;justify-content:space-between}.absolute-voice-provider-contracts__eyebrow{color:#166534;font-size:12px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}.absolute-voice-provider-contracts__label{font-size:24px;line-height:1}.absolute-voice-provider-contracts__description,.absolute-voice-provider-contracts__row p,.absolute-voice-provider-contracts__row dt,.absolute-voice-provider-contracts__empty{color:#405448}.absolute-voice-provider-contracts__rows{display:grid;gap:12px;margin-top:14px}.absolute-voice-provider-contracts__row{background:#fff;border:1px solid #d6eadb;border-radius:16px;padding:14px}.absolute-voice-provider-contracts__row--pass{border-color:#86efac}.absolute-voice-provider-contracts__row--warn,.absolute-voice-provider-contracts__row--fail{border-color:#f2a7a7}.absolute-voice-provider-contracts__row p{margin:10px 0}.absolute-voice-provider-contracts__remediations{display:grid;gap:8px;list-style:none;margin:0 0 10px;padding:0}.absolute-voice-provider-contracts__remediations li{background:#fff7ed;border:1px solid #fed7aa;border-radius:12px;display:grid;gap:3px;padding:8px}.absolute-voice-provider-contracts__remediations a,.absolute-voice-provider-contracts__remediations strong{color:#9a3412}.absolute-voice-provider-contracts__remediations span{color:#7c2d12}.absolute-voice-provider-contracts__row dl{display:grid;gap:8px;grid-template-columns:repeat(2,minmax(0,1fr));margin:0}.absolute-voice-provider-contracts__row div{background:#f7fff9;border:1px solid #d6eadb;border-radius:12px;padding:8px}.absolute-voice-provider-contracts__row dt{font-size:12px}.absolute-voice-provider-contracts__row dd{font-weight:800;margin:4px 0 0}.absolute-voice-provider-contracts__error{color:#9f1239;font-weight:700}`;
|
|
4086
|
+
var mountVoiceProviderContracts = (element, path = "/api/provider-contracts", options = {}) => {
|
|
4087
|
+
const store = createVoiceProviderContractsStore(path, options);
|
|
4088
|
+
const render = () => {
|
|
4089
|
+
element.innerHTML = renderVoiceProviderContractsHTML(store.getSnapshot(), options);
|
|
4090
|
+
};
|
|
4091
|
+
const unsubscribe = store.subscribe(render);
|
|
4092
|
+
render();
|
|
4093
|
+
store.refresh().catch(() => {});
|
|
4094
|
+
return {
|
|
4095
|
+
close: () => {
|
|
4096
|
+
unsubscribe();
|
|
4097
|
+
store.close();
|
|
4098
|
+
},
|
|
4099
|
+
refresh: store.refresh
|
|
4100
|
+
};
|
|
4101
|
+
};
|
|
4102
|
+
var defineVoiceProviderContractsElement = (tagName = "absolute-voice-provider-contracts") => {
|
|
4103
|
+
if (typeof window === "undefined" || typeof customElements === "undefined" || customElements.get(tagName)) {
|
|
4104
|
+
return;
|
|
4105
|
+
}
|
|
4106
|
+
customElements.define(tagName, class AbsoluteVoiceProviderContractsElement extends HTMLElement {
|
|
4107
|
+
mounted;
|
|
4108
|
+
connectedCallback() {
|
|
4109
|
+
const intervalMs = Number(this.getAttribute("interval-ms") ?? 5000);
|
|
4110
|
+
this.mounted = mountVoiceProviderContracts(this, this.getAttribute("path") ?? "/api/provider-contracts", {
|
|
4111
|
+
description: this.getAttribute("description") ?? undefined,
|
|
4112
|
+
intervalMs: Number.isFinite(intervalMs) ? intervalMs : 5000,
|
|
4113
|
+
title: this.getAttribute("title") ?? undefined
|
|
4114
|
+
});
|
|
4115
|
+
}
|
|
4116
|
+
disconnectedCallback() {
|
|
4117
|
+
this.mounted?.close();
|
|
4118
|
+
this.mounted = undefined;
|
|
4119
|
+
}
|
|
4120
|
+
});
|
|
4121
|
+
};
|
|
4122
|
+
// src/client/turnQualityWidget.ts
|
|
4123
|
+
var DEFAULT_TITLE8 = "Turn Quality";
|
|
4124
|
+
var DEFAULT_DESCRIPTION8 = "Per-turn STT confidence, fallback selection, corrections, and transcript coverage.";
|
|
4125
|
+
var escapeHtml10 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
4126
|
+
var formatConfidence = (value) => typeof value === "number" ? `${Math.round(value * 100)}%` : "n/a";
|
|
4127
|
+
var formatMaybe = (value) => value === undefined || value === "" ? "n/a" : String(value);
|
|
4128
|
+
var getTurnDetail = (turn) => {
|
|
4129
|
+
if (turn.status === "fail") {
|
|
4130
|
+
return "Empty or unusable committed turn; inspect transcripts and adapter events.";
|
|
4131
|
+
}
|
|
4132
|
+
if (turn.fallbackUsed) {
|
|
4133
|
+
return `Fallback STT selected${turn.fallbackSelectionReason ? ` by ${turn.fallbackSelectionReason}` : ""}.`;
|
|
4134
|
+
}
|
|
4135
|
+
if (turn.correctionChanged) {
|
|
4136
|
+
return `Correction changed the turn${turn.correctionProvider ? ` via ${turn.correctionProvider}` : ""}.`;
|
|
4137
|
+
}
|
|
4138
|
+
if (turn.status === "warn") {
|
|
4139
|
+
return "Turn completed with quality warnings.";
|
|
4140
|
+
}
|
|
4141
|
+
if (turn.status === "unknown") {
|
|
4142
|
+
return "No quality diagnostics were recorded for this turn.";
|
|
4143
|
+
}
|
|
4144
|
+
return "Turn quality looks healthy.";
|
|
4145
|
+
};
|
|
4146
|
+
var createVoiceTurnQualityViewModel = (snapshot, options = {}) => {
|
|
4147
|
+
const turns = (snapshot.report?.turns ?? []).map((turn) => ({
|
|
4148
|
+
...turn,
|
|
4149
|
+
detail: getTurnDetail(turn),
|
|
4150
|
+
label: turn.text || "Empty turn",
|
|
4151
|
+
rows: [
|
|
4152
|
+
{ label: "Source", value: turn.source ?? "unknown" },
|
|
4153
|
+
{ label: "Confidence", value: formatConfidence(turn.averageConfidence) },
|
|
4154
|
+
{ label: "Fallback", value: turn.fallbackUsed ? "Yes" : "No" },
|
|
4155
|
+
{ label: "Correction", value: turn.correctionChanged ? "Changed" : "None" },
|
|
4156
|
+
{ label: "Transcripts", value: `${turn.selectedTranscriptCount} selected` },
|
|
4157
|
+
{ label: "Cost", value: formatMaybe(turn.costUnits) }
|
|
4158
|
+
]
|
|
4159
|
+
}));
|
|
4160
|
+
const warningCount = snapshot.report?.warnings ?? turns.filter((turn) => turn.status === "warn").length;
|
|
4161
|
+
const failedCount = snapshot.report?.failed ?? turns.filter((turn) => turn.status === "fail").length;
|
|
4162
|
+
return {
|
|
4163
|
+
description: options.description ?? DEFAULT_DESCRIPTION8,
|
|
4164
|
+
error: snapshot.error,
|
|
4165
|
+
isLoading: snapshot.isLoading,
|
|
4166
|
+
label: snapshot.error ? "Unavailable" : turns.length ? failedCount > 0 ? `${failedCount} failed` : warningCount > 0 ? `${warningCount} warnings` : `${turns.length} healthy` : snapshot.isLoading ? "Checking" : "No turns",
|
|
4167
|
+
status: snapshot.error ? "error" : turns.length ? failedCount > 0 || warningCount > 0 ? "warning" : "ready" : snapshot.isLoading ? "loading" : "empty",
|
|
4168
|
+
title: options.title ?? DEFAULT_TITLE8,
|
|
4169
|
+
turns,
|
|
4170
|
+
updatedAt: snapshot.updatedAt
|
|
4171
|
+
};
|
|
4172
|
+
};
|
|
4173
|
+
var renderVoiceTurnQualityHTML = (snapshot, options = {}) => {
|
|
4174
|
+
const model = createVoiceTurnQualityViewModel(snapshot, options);
|
|
4175
|
+
const turns = model.turns.length ? `<div class="absolute-voice-turn-quality__turns">${model.turns.map((turn) => `<article class="absolute-voice-turn-quality__turn absolute-voice-turn-quality__turn--${escapeHtml10(turn.status)}">
|
|
4176
|
+
<header>
|
|
4177
|
+
<strong>${escapeHtml10(turn.label)}</strong>
|
|
4178
|
+
<span>${escapeHtml10(turn.status)}</span>
|
|
4179
|
+
</header>
|
|
4180
|
+
<p>${escapeHtml10(turn.detail)}</p>
|
|
4181
|
+
<dl>${turn.rows.map((row) => `<div>
|
|
4182
|
+
<dt>${escapeHtml10(row.label)}</dt>
|
|
4183
|
+
<dd>${escapeHtml10(row.value)}</dd>
|
|
4184
|
+
</div>`).join("")}</dl>
|
|
4185
|
+
</article>`).join("")}</div>` : '<p class="absolute-voice-turn-quality__empty">Complete a voice turn to see STT quality diagnostics.</p>';
|
|
4186
|
+
return `<section class="absolute-voice-turn-quality absolute-voice-turn-quality--${escapeHtml10(model.status)}">
|
|
4187
|
+
<header class="absolute-voice-turn-quality__header">
|
|
4188
|
+
<span class="absolute-voice-turn-quality__eyebrow">${escapeHtml10(model.title)}</span>
|
|
4189
|
+
<strong class="absolute-voice-turn-quality__label">${escapeHtml10(model.label)}</strong>
|
|
4190
|
+
</header>
|
|
4191
|
+
<p class="absolute-voice-turn-quality__description">${escapeHtml10(model.description)}</p>
|
|
4192
|
+
${turns}
|
|
4193
|
+
${model.error ? `<p class="absolute-voice-turn-quality__error">${escapeHtml10(model.error)}</p>` : ""}
|
|
4194
|
+
</section>`;
|
|
4195
|
+
};
|
|
4196
|
+
var getVoiceTurnQualityCSS = () => `.absolute-voice-turn-quality{border:1px solid #e4d1a3;border-radius:20px;background:#fff9eb;color:#17120a;padding:18px;box-shadow:0 18px 40px rgba(73,48,14,.12);font-family:inherit}.absolute-voice-turn-quality--error,.absolute-voice-turn-quality--warning{border-color:#f2a7a7;background:#fff5f3}.absolute-voice-turn-quality__header,.absolute-voice-turn-quality__turn header{align-items:start;display:flex;gap:12px;justify-content:space-between}.absolute-voice-turn-quality__eyebrow{color:#8a5a0a;font-size:12px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}.absolute-voice-turn-quality__label{font-size:24px;line-height:1}.absolute-voice-turn-quality__description,.absolute-voice-turn-quality__turn p,.absolute-voice-turn-quality__turn dt,.absolute-voice-turn-quality__empty{color:#5a4930}.absolute-voice-turn-quality__turns{display:grid;gap:12px;margin-top:14px}.absolute-voice-turn-quality__turn{background:#fff;border:1px solid #f0dfba;border-radius:16px;padding:14px}.absolute-voice-turn-quality__turn--pass{border-color:#86efac}.absolute-voice-turn-quality__turn--warn,.absolute-voice-turn-quality__turn--unknown{border-color:#fbbf24}.absolute-voice-turn-quality__turn--fail{border-color:#f2a7a7}.absolute-voice-turn-quality__turn p{margin:10px 0}.absolute-voice-turn-quality__turn dl{display:grid;gap:8px;grid-template-columns:repeat(2,minmax(0,1fr));margin:0}.absolute-voice-turn-quality__turn div{background:#fff9eb;border:1px solid #f0dfba;border-radius:12px;padding:8px}.absolute-voice-turn-quality__turn dt{font-size:12px}.absolute-voice-turn-quality__turn dd{font-weight:800;margin:4px 0 0}.absolute-voice-turn-quality__empty{margin:14px 0 0}.absolute-voice-turn-quality__error{color:#9f1239;font-weight:700}`;
|
|
4197
|
+
var mountVoiceTurnQuality = (element, path = "/api/turn-quality", options = {}) => {
|
|
4198
|
+
const store = createVoiceTurnQualityStore(path, options);
|
|
4199
|
+
const render = () => {
|
|
4200
|
+
element.innerHTML = renderVoiceTurnQualityHTML(store.getSnapshot(), options);
|
|
4201
|
+
};
|
|
4202
|
+
const unsubscribe = store.subscribe(render);
|
|
4203
|
+
render();
|
|
4204
|
+
store.refresh().catch(() => {});
|
|
4205
|
+
return {
|
|
4206
|
+
close: () => {
|
|
4207
|
+
unsubscribe();
|
|
4208
|
+
store.close();
|
|
4209
|
+
},
|
|
4210
|
+
refresh: store.refresh
|
|
4211
|
+
};
|
|
4212
|
+
};
|
|
4213
|
+
var defineVoiceTurnQualityElement = (tagName = "absolute-voice-turn-quality") => {
|
|
4214
|
+
if (typeof window === "undefined" || typeof customElements === "undefined" || customElements.get(tagName)) {
|
|
4215
|
+
return;
|
|
4216
|
+
}
|
|
4217
|
+
customElements.define(tagName, class AbsoluteVoiceTurnQualityElement extends HTMLElement {
|
|
4218
|
+
mounted;
|
|
4219
|
+
connectedCallback() {
|
|
4220
|
+
const intervalMs = Number(this.getAttribute("interval-ms") ?? 5000);
|
|
4221
|
+
this.mounted = mountVoiceTurnQuality(this, this.getAttribute("path") ?? "/api/turn-quality", {
|
|
4222
|
+
description: this.getAttribute("description") ?? undefined,
|
|
4223
|
+
intervalMs: Number.isFinite(intervalMs) ? intervalMs : 5000,
|
|
4224
|
+
title: this.getAttribute("title") ?? undefined
|
|
4225
|
+
});
|
|
4226
|
+
}
|
|
4227
|
+
disconnectedCallback() {
|
|
4228
|
+
this.mounted?.close();
|
|
4229
|
+
this.mounted = undefined;
|
|
4230
|
+
}
|
|
4231
|
+
});
|
|
4232
|
+
};
|
|
4233
|
+
// src/client/turnLatencyWidget.ts
|
|
4234
|
+
var DEFAULT_TITLE9 = "Turn Latency";
|
|
4235
|
+
var DEFAULT_DESCRIPTION9 = "Per-turn timing from first transcript to commit and assistant response start.";
|
|
4236
|
+
var DEFAULT_PROOF_LABEL = "Run latency proof";
|
|
4237
|
+
var escapeHtml11 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
4238
|
+
var formatMs = (value) => typeof value === "number" ? `${Math.round(value)}ms` : "n/a";
|
|
4239
|
+
var createVoiceTurnLatencyViewModel = (snapshot, options = {}) => {
|
|
4240
|
+
const turns = (snapshot.report?.turns ?? []).map((turn) => ({
|
|
4241
|
+
...turn,
|
|
4242
|
+
label: turn.text || "Empty turn",
|
|
4243
|
+
rows: turn.stages.map((stage) => ({
|
|
4244
|
+
label: stage.label,
|
|
4245
|
+
value: formatMs(stage.valueMs)
|
|
4246
|
+
}))
|
|
4247
|
+
}));
|
|
4248
|
+
const warningCount = snapshot.report?.warnings ?? turns.filter((turn) => turn.status === "warn").length;
|
|
4249
|
+
const failedCount = snapshot.report?.failed ?? turns.filter((turn) => turn.status === "fail").length;
|
|
4250
|
+
return {
|
|
4251
|
+
description: options.description ?? DEFAULT_DESCRIPTION9,
|
|
4252
|
+
error: snapshot.error,
|
|
4253
|
+
isLoading: snapshot.isLoading,
|
|
4254
|
+
label: snapshot.error ? "Unavailable" : turns.length ? failedCount > 0 ? `${failedCount} slow` : warningCount > 0 ? `${warningCount} warnings` : `avg ${formatMs(snapshot.report?.averageTotalMs)}` : snapshot.isLoading ? "Checking" : "No turns",
|
|
4255
|
+
proofLabel: options.proofPath ? options.proofLabel ?? DEFAULT_PROOF_LABEL : undefined,
|
|
4256
|
+
showProofAction: Boolean(options.proofPath),
|
|
4257
|
+
status: snapshot.error ? "error" : turns.length ? failedCount > 0 || warningCount > 0 ? "warning" : "ready" : snapshot.isLoading ? "loading" : "empty",
|
|
4258
|
+
title: options.title ?? DEFAULT_TITLE9,
|
|
4259
|
+
turns,
|
|
4260
|
+
updatedAt: snapshot.updatedAt
|
|
4261
|
+
};
|
|
4262
|
+
};
|
|
4263
|
+
var renderVoiceTurnLatencyHTML = (snapshot, options = {}) => {
|
|
4264
|
+
const model = createVoiceTurnLatencyViewModel(snapshot, options);
|
|
4265
|
+
const turns = model.turns.length ? `<div class="absolute-voice-turn-latency__turns">${model.turns.map((turn) => `<article class="absolute-voice-turn-latency__turn absolute-voice-turn-latency__turn--${escapeHtml11(turn.status)}">
|
|
4266
|
+
<header>
|
|
4267
|
+
<strong>${escapeHtml11(turn.label)}</strong>
|
|
4268
|
+
<span>${escapeHtml11(turn.status)}</span>
|
|
4269
|
+
</header>
|
|
4270
|
+
<dl>${turn.rows.map((row) => `<div>
|
|
4271
|
+
<dt>${escapeHtml11(row.label)}</dt>
|
|
4272
|
+
<dd>${escapeHtml11(row.value)}</dd>
|
|
4273
|
+
</div>`).join("")}</dl>
|
|
4274
|
+
</article>`).join("")}</div>` : '<p class="absolute-voice-turn-latency__empty">Complete a voice turn to see latency diagnostics.</p>';
|
|
4275
|
+
return `<section class="absolute-voice-turn-latency absolute-voice-turn-latency--${escapeHtml11(model.status)}">
|
|
4276
|
+
<header class="absolute-voice-turn-latency__header">
|
|
4277
|
+
<span class="absolute-voice-turn-latency__eyebrow">${escapeHtml11(model.title)}</span>
|
|
4278
|
+
<strong class="absolute-voice-turn-latency__label">${escapeHtml11(model.label)}</strong>
|
|
4279
|
+
</header>
|
|
4280
|
+
<p class="absolute-voice-turn-latency__description">${escapeHtml11(model.description)}</p>
|
|
4281
|
+
${model.showProofAction ? `<button class="absolute-voice-turn-latency__proof" data-absolute-voice-turn-latency-proof type="button">${escapeHtml11(model.proofLabel ?? DEFAULT_PROOF_LABEL)}</button>` : ""}
|
|
4282
|
+
${turns}
|
|
4283
|
+
${model.error ? `<p class="absolute-voice-turn-latency__error">${escapeHtml11(model.error)}</p>` : ""}
|
|
4284
|
+
</section>`;
|
|
4285
|
+
};
|
|
4286
|
+
var mountVoiceTurnLatency = (element, path = "/api/turn-latency", options = {}) => {
|
|
4287
|
+
const store = createVoiceTurnLatencyStore(path, options);
|
|
4288
|
+
const render = () => {
|
|
4289
|
+
element.innerHTML = renderVoiceTurnLatencyHTML(store.getSnapshot(), options);
|
|
4290
|
+
};
|
|
4291
|
+
const handleClick = (event) => {
|
|
4292
|
+
const target = event.target;
|
|
4293
|
+
if (target instanceof Element && target.closest("[data-absolute-voice-turn-latency-proof]")) {
|
|
4294
|
+
store.runProof().catch(() => {});
|
|
4295
|
+
}
|
|
4296
|
+
};
|
|
4297
|
+
const unsubscribe = store.subscribe(render);
|
|
4298
|
+
element.addEventListener("click", handleClick);
|
|
4299
|
+
render();
|
|
4300
|
+
store.refresh().catch(() => {});
|
|
4301
|
+
return {
|
|
4302
|
+
close: () => {
|
|
4303
|
+
element.removeEventListener("click", handleClick);
|
|
4304
|
+
unsubscribe();
|
|
4305
|
+
store.close();
|
|
4306
|
+
},
|
|
4307
|
+
refresh: store.refresh
|
|
4308
|
+
};
|
|
4309
|
+
};
|
|
4310
|
+
var defineVoiceTurnLatencyElement = (tagName = "absolute-voice-turn-latency") => {
|
|
4311
|
+
if (typeof window === "undefined" || typeof customElements === "undefined" || customElements.get(tagName)) {
|
|
4312
|
+
return;
|
|
4313
|
+
}
|
|
4314
|
+
customElements.define(tagName, class AbsoluteVoiceTurnLatencyElement extends HTMLElement {
|
|
4315
|
+
mounted;
|
|
4316
|
+
connectedCallback() {
|
|
4317
|
+
const intervalMs = Number(this.getAttribute("interval-ms") ?? 5000);
|
|
4318
|
+
this.mounted = mountVoiceTurnLatency(this, this.getAttribute("path") ?? "/api/turn-latency", {
|
|
4319
|
+
description: this.getAttribute("description") ?? undefined,
|
|
4320
|
+
intervalMs: Number.isFinite(intervalMs) ? intervalMs : 5000,
|
|
4321
|
+
proofLabel: this.getAttribute("proof-label") ?? undefined,
|
|
4322
|
+
proofPath: this.getAttribute("proof-path") ?? undefined,
|
|
4323
|
+
title: this.getAttribute("title") ?? undefined
|
|
4324
|
+
});
|
|
4325
|
+
}
|
|
4326
|
+
disconnectedCallback() {
|
|
4327
|
+
this.mounted?.close();
|
|
4328
|
+
this.mounted = undefined;
|
|
4329
|
+
}
|
|
4330
|
+
});
|
|
4331
|
+
};
|
|
4332
|
+
// src/client/traceTimelineWidget.ts
|
|
4333
|
+
var DEFAULT_TITLE10 = "Voice Traces";
|
|
4334
|
+
var DEFAULT_DESCRIPTION10 = "Latest call timelines with provider latency, fallbacks, handoffs, and errors from your self-hosted trace store.";
|
|
4335
|
+
var escapeHtml12 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
4336
|
+
var formatMs2 = (value) => typeof value === "number" ? `${value}ms` : "n/a";
|
|
4337
|
+
var formatProviders = (session) => session.providers.length ? session.providers.map((provider) => provider.provider).join(", ") : "No providers";
|
|
4338
|
+
var createVoiceTraceTimelineViewModel = (snapshot, options = {}) => {
|
|
4339
|
+
const sessions = (snapshot.report?.sessions ?? []).slice(0, options.limit ?? 3).map((session) => ({
|
|
4340
|
+
...session,
|
|
4341
|
+
detailHref: `${options.detailBasePath ?? "/traces"}/${encodeURIComponent(session.sessionId)}`,
|
|
4342
|
+
durationLabel: formatMs2(session.summary.callDurationMs),
|
|
4343
|
+
label: `${session.summary.eventCount} events / ${session.summary.turnCount} turns`,
|
|
4344
|
+
providerLabel: formatProviders(session)
|
|
4345
|
+
}));
|
|
4346
|
+
const failed = sessions.filter((session) => session.status === "failed").length;
|
|
4347
|
+
const warnings = sessions.filter((session) => session.status === "warning").length;
|
|
4348
|
+
return {
|
|
4349
|
+
description: options.description ?? DEFAULT_DESCRIPTION10,
|
|
4350
|
+
error: snapshot.error,
|
|
4351
|
+
isLoading: snapshot.isLoading,
|
|
4352
|
+
label: snapshot.error ? "Unavailable" : failed > 0 ? `${failed} failed` : warnings > 0 ? `${warnings} warning` : sessions.length ? `${sessions.length} recent` : snapshot.isLoading ? "Checking" : "No traces yet",
|
|
4353
|
+
sessions,
|
|
4354
|
+
status: snapshot.error ? "error" : failed > 0 ? "failed" : warnings > 0 ? "warning" : sessions.length ? "ready" : snapshot.isLoading ? "loading" : "empty",
|
|
4355
|
+
title: options.title ?? DEFAULT_TITLE10,
|
|
4356
|
+
updatedAt: snapshot.updatedAt
|
|
4357
|
+
};
|
|
4358
|
+
};
|
|
4359
|
+
var renderVoiceTraceTimelineWidgetHTML = (snapshot, options = {}) => {
|
|
4360
|
+
const model = createVoiceTraceTimelineViewModel(snapshot, options);
|
|
4361
|
+
const sessions = model.sessions.length ? `<div class="absolute-voice-trace-timeline__sessions">${model.sessions.map((session) => `<article class="absolute-voice-trace-timeline__session absolute-voice-trace-timeline__session--${escapeHtml12(session.status)}">
|
|
4362
|
+
<header>
|
|
4363
|
+
<strong>${escapeHtml12(session.sessionId)}</strong>
|
|
4364
|
+
<span>${escapeHtml12(session.status)}</span>
|
|
4365
|
+
</header>
|
|
4366
|
+
<p>${escapeHtml12(session.label)} \xB7 ${escapeHtml12(session.durationLabel)} \xB7 ${escapeHtml12(session.providerLabel)}</p>
|
|
4367
|
+
<a href="${escapeHtml12(session.detailHref)}">Open timeline</a>
|
|
4368
|
+
</article>`).join("")}</div>` : '<p class="absolute-voice-trace-timeline__empty">Run a voice session to see call timelines.</p>';
|
|
4369
|
+
return `<section class="absolute-voice-trace-timeline absolute-voice-trace-timeline--${escapeHtml12(model.status)}">
|
|
4370
|
+
<header class="absolute-voice-trace-timeline__header">
|
|
4371
|
+
<span class="absolute-voice-trace-timeline__eyebrow">${escapeHtml12(model.title)}</span>
|
|
4372
|
+
<strong class="absolute-voice-trace-timeline__label">${escapeHtml12(model.label)}</strong>
|
|
4373
|
+
</header>
|
|
4374
|
+
<p class="absolute-voice-trace-timeline__description">${escapeHtml12(model.description)}</p>
|
|
4375
|
+
${sessions}
|
|
4376
|
+
${model.error ? `<p class="absolute-voice-trace-timeline__error">${escapeHtml12(model.error)}</p>` : ""}
|
|
4377
|
+
</section>`;
|
|
4378
|
+
};
|
|
4379
|
+
var getVoiceTraceTimelineCSS = () => `.absolute-voice-trace-timeline{border:1px solid #bad7d3;border-radius:20px;background:#f3fffb;color:#09201c;padding:18px;box-shadow:0 18px 40px rgba(9,32,28,.12);font-family:inherit}.absolute-voice-trace-timeline--error,.absolute-voice-trace-timeline--failed{border-color:#f2a7a7;background:#fff5f3}.absolute-voice-trace-timeline--warning{border-color:#fbbf24;background:#fffaf0}.absolute-voice-trace-timeline__header,.absolute-voice-trace-timeline__session header{align-items:start;display:flex;gap:12px;justify-content:space-between}.absolute-voice-trace-timeline__eyebrow{color:#17665b;font-size:12px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}.absolute-voice-trace-timeline__label{font-size:24px;line-height:1}.absolute-voice-trace-timeline__description,.absolute-voice-trace-timeline__session p,.absolute-voice-trace-timeline__empty{color:#35544f}.absolute-voice-trace-timeline__sessions{display:grid;gap:12px;margin-top:14px}.absolute-voice-trace-timeline__session{background:#fff;border:1px solid #cfe7e2;border-radius:16px;padding:14px}.absolute-voice-trace-timeline__session--failed{border-color:#f2a7a7}.absolute-voice-trace-timeline__session--warning{border-color:#fbbf24}.absolute-voice-trace-timeline__session p{margin:10px 0}.absolute-voice-trace-timeline__session a{color:#0f766e;font-weight:800}.absolute-voice-trace-timeline__empty{margin:14px 0 0}.absolute-voice-trace-timeline__error{color:#9f1239;font-weight:700}`;
|
|
4380
|
+
var mountVoiceTraceTimeline = (element, path = "/api/voice-traces", options = {}) => {
|
|
4381
|
+
const store = createVoiceTraceTimelineStore(path, options);
|
|
4382
|
+
const render = () => {
|
|
4383
|
+
element.innerHTML = renderVoiceTraceTimelineWidgetHTML(store.getSnapshot(), options);
|
|
4384
|
+
};
|
|
4385
|
+
const unsubscribe = store.subscribe(render);
|
|
4386
|
+
render();
|
|
4387
|
+
store.refresh().catch(() => {});
|
|
4388
|
+
return {
|
|
4389
|
+
close: () => {
|
|
4390
|
+
unsubscribe();
|
|
4391
|
+
store.close();
|
|
4392
|
+
},
|
|
4393
|
+
refresh: store.refresh
|
|
4394
|
+
};
|
|
4395
|
+
};
|
|
4396
|
+
var defineVoiceTraceTimelineElement = (tagName = "absolute-voice-trace-timeline") => {
|
|
4397
|
+
if (typeof window === "undefined" || typeof customElements === "undefined" || customElements.get(tagName)) {
|
|
4398
|
+
return;
|
|
4399
|
+
}
|
|
4400
|
+
customElements.define(tagName, class AbsoluteVoiceTraceTimelineElement extends HTMLElement {
|
|
4401
|
+
mounted;
|
|
4402
|
+
connectedCallback() {
|
|
4403
|
+
const intervalMs = Number(this.getAttribute("interval-ms") ?? 5000);
|
|
4404
|
+
const limit = Number(this.getAttribute("limit") ?? 3);
|
|
4405
|
+
this.mounted = mountVoiceTraceTimeline(this, this.getAttribute("path") ?? "/api/voice-traces", {
|
|
4406
|
+
description: this.getAttribute("description") ?? undefined,
|
|
4407
|
+
detailBasePath: this.getAttribute("detail-base-path") ?? undefined,
|
|
4408
|
+
intervalMs: Number.isFinite(intervalMs) ? intervalMs : 5000,
|
|
4409
|
+
limit: Number.isFinite(limit) ? limit : 3,
|
|
4410
|
+
title: this.getAttribute("title") ?? undefined
|
|
4411
|
+
});
|
|
4412
|
+
}
|
|
4413
|
+
disconnectedCallback() {
|
|
4414
|
+
this.mounted?.close();
|
|
4415
|
+
this.mounted = undefined;
|
|
4416
|
+
}
|
|
4417
|
+
});
|
|
4418
|
+
};
|
|
4419
|
+
// src/client/workflowStatus.ts
|
|
4420
|
+
var fetchVoiceWorkflowStatus = async (path = "/evals/scenarios/json", options = {}) => {
|
|
4421
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
4422
|
+
const response = await fetchImpl(path);
|
|
4423
|
+
if (!response.ok) {
|
|
4424
|
+
throw new Error(`Voice workflow status failed: HTTP ${response.status}`);
|
|
4425
|
+
}
|
|
4426
|
+
return await response.json();
|
|
4427
|
+
};
|
|
4428
|
+
var createVoiceWorkflowStatusStore = (path = "/evals/scenarios/json", options = {}) => {
|
|
4429
|
+
const listeners = new Set;
|
|
4430
|
+
let closed = false;
|
|
4431
|
+
let timer;
|
|
4432
|
+
let snapshot = {
|
|
4433
|
+
error: null,
|
|
4434
|
+
isLoading: false
|
|
4435
|
+
};
|
|
4436
|
+
const emit = () => {
|
|
4437
|
+
for (const listener of listeners) {
|
|
4438
|
+
listener();
|
|
4439
|
+
}
|
|
4440
|
+
};
|
|
4441
|
+
const refresh = async () => {
|
|
4442
|
+
if (closed) {
|
|
4443
|
+
return snapshot.report;
|
|
4444
|
+
}
|
|
4445
|
+
snapshot = {
|
|
4446
|
+
...snapshot,
|
|
4447
|
+
error: null,
|
|
4448
|
+
isLoading: true
|
|
4449
|
+
};
|
|
4450
|
+
emit();
|
|
4451
|
+
try {
|
|
4452
|
+
const report = await fetchVoiceWorkflowStatus(path, options);
|
|
4453
|
+
snapshot = {
|
|
4454
|
+
error: null,
|
|
4455
|
+
isLoading: false,
|
|
4456
|
+
report,
|
|
4457
|
+
updatedAt: Date.now()
|
|
4458
|
+
};
|
|
4459
|
+
emit();
|
|
4460
|
+
return report;
|
|
4461
|
+
} catch (error) {
|
|
4462
|
+
snapshot = {
|
|
4463
|
+
...snapshot,
|
|
4464
|
+
error: error instanceof Error ? error.message : String(error),
|
|
4465
|
+
isLoading: false
|
|
4466
|
+
};
|
|
4467
|
+
emit();
|
|
4468
|
+
throw error;
|
|
4469
|
+
}
|
|
4470
|
+
};
|
|
4471
|
+
const close = () => {
|
|
4472
|
+
closed = true;
|
|
4473
|
+
if (timer) {
|
|
4474
|
+
clearInterval(timer);
|
|
4475
|
+
timer = undefined;
|
|
4476
|
+
}
|
|
4477
|
+
listeners.clear();
|
|
4478
|
+
};
|
|
4479
|
+
if (typeof window !== "undefined" && options.intervalMs && options.intervalMs > 0) {
|
|
1646
4480
|
timer = setInterval(() => {
|
|
1647
4481
|
refresh().catch(() => {});
|
|
1648
4482
|
}, options.intervalMs);
|
|
@@ -1661,15 +4495,105 @@ var createVoiceProviderStatusStore = (path = "/api/provider-status", options = {
|
|
|
1661
4495
|
};
|
|
1662
4496
|
};
|
|
1663
4497
|
export {
|
|
4498
|
+
runVoiceTurnLatencyProof,
|
|
4499
|
+
runVoiceOpsAction,
|
|
4500
|
+
runVoiceDeliveryRuntimeAction,
|
|
4501
|
+
runVoiceCampaignDialerProofAction,
|
|
4502
|
+
renderVoiceTurnQualityHTML,
|
|
4503
|
+
renderVoiceTurnLatencyHTML,
|
|
4504
|
+
renderVoiceTraceTimelineWidgetHTML,
|
|
4505
|
+
renderVoiceRoutingStatusHTML,
|
|
4506
|
+
renderVoiceProviderStatusHTML,
|
|
4507
|
+
renderVoiceProviderSimulationControlsHTML,
|
|
4508
|
+
renderVoiceProviderContractsHTML,
|
|
4509
|
+
renderVoiceProviderCapabilitiesHTML,
|
|
4510
|
+
renderVoiceOpsStatusHTML,
|
|
4511
|
+
renderVoiceOpsActionHistoryWidgetHTML,
|
|
4512
|
+
renderVoiceOpsActionCenterHTML,
|
|
4513
|
+
renderVoiceDeliveryRuntimeHTML,
|
|
4514
|
+
recordVoiceOpsActionResult,
|
|
4515
|
+
mountVoiceTurnQuality,
|
|
4516
|
+
mountVoiceTurnLatency,
|
|
4517
|
+
mountVoiceTraceTimeline,
|
|
4518
|
+
mountVoiceRoutingStatus,
|
|
4519
|
+
mountVoiceProviderStatus,
|
|
4520
|
+
mountVoiceProviderSimulationControls,
|
|
4521
|
+
mountVoiceProviderContracts,
|
|
4522
|
+
mountVoiceProviderCapabilities,
|
|
4523
|
+
mountVoiceOpsStatus,
|
|
4524
|
+
mountVoiceOpsActionHistory,
|
|
4525
|
+
mountVoiceOpsActionCenter,
|
|
4526
|
+
mountVoiceDeliveryRuntime,
|
|
4527
|
+
getVoiceTurnQualityCSS,
|
|
4528
|
+
getVoiceTraceTimelineCSS,
|
|
4529
|
+
getVoiceRoutingStatusCSS,
|
|
4530
|
+
getVoiceProviderStatusCSS,
|
|
4531
|
+
getVoiceProviderContractsCSS,
|
|
4532
|
+
getVoiceProviderCapabilitiesCSS,
|
|
4533
|
+
getVoiceOpsStatusLabel,
|
|
4534
|
+
getVoiceOpsStatusCSS,
|
|
4535
|
+
getVoiceOpsActionHistoryCSS,
|
|
4536
|
+
getVoiceOpsActionCenterCSS,
|
|
4537
|
+
getVoiceDeliveryRuntimeCSS,
|
|
4538
|
+
fetchVoiceWorkflowStatus,
|
|
4539
|
+
fetchVoiceTurnQuality,
|
|
4540
|
+
fetchVoiceTurnLatency,
|
|
4541
|
+
fetchVoiceTraceTimeline,
|
|
4542
|
+
fetchVoiceRoutingStatus,
|
|
1664
4543
|
fetchVoiceProviderStatus,
|
|
4544
|
+
fetchVoiceProviderContracts,
|
|
4545
|
+
fetchVoiceProviderCapabilities,
|
|
4546
|
+
fetchVoiceOpsStatus,
|
|
4547
|
+
fetchVoiceOpsActionHistory,
|
|
4548
|
+
fetchVoiceDeliveryRuntime,
|
|
4549
|
+
fetchVoiceCampaignDialerProofStatus,
|
|
4550
|
+
defineVoiceTurnQualityElement,
|
|
4551
|
+
defineVoiceTurnLatencyElement,
|
|
4552
|
+
defineVoiceTraceTimelineElement,
|
|
4553
|
+
defineVoiceRoutingStatusElement,
|
|
4554
|
+
defineVoiceProviderStatusElement,
|
|
4555
|
+
defineVoiceProviderSimulationControlsElement,
|
|
4556
|
+
defineVoiceProviderContractsElement,
|
|
4557
|
+
defineVoiceProviderCapabilitiesElement,
|
|
4558
|
+
defineVoiceOpsStatusElement,
|
|
4559
|
+
defineVoiceOpsActionCenterElement,
|
|
4560
|
+
defineVoiceDeliveryRuntimeElement,
|
|
1665
4561
|
decodeVoiceAudioChunk,
|
|
4562
|
+
createVoiceWorkflowStatusStore,
|
|
4563
|
+
createVoiceTurnQualityViewModel,
|
|
4564
|
+
createVoiceTurnQualityStore,
|
|
4565
|
+
createVoiceTurnLatencyViewModel,
|
|
4566
|
+
createVoiceTurnLatencyStore,
|
|
4567
|
+
createVoiceTraceTimelineViewModel,
|
|
4568
|
+
createVoiceTraceTimelineStore,
|
|
1666
4569
|
createVoiceStream,
|
|
4570
|
+
createVoiceRoutingStatusViewModel,
|
|
4571
|
+
createVoiceRoutingStatusStore,
|
|
4572
|
+
createVoiceProviderStatusViewModel,
|
|
1667
4573
|
createVoiceProviderStatusStore,
|
|
4574
|
+
createVoiceProviderSimulationControlsViewModel,
|
|
4575
|
+
createVoiceProviderSimulationControlsStore,
|
|
4576
|
+
createVoiceProviderContractsViewModel,
|
|
4577
|
+
createVoiceProviderContractsStore,
|
|
4578
|
+
createVoiceProviderCapabilitiesViewModel,
|
|
4579
|
+
createVoiceProviderCapabilitiesStore,
|
|
4580
|
+
createVoiceOpsStatusViewModel,
|
|
4581
|
+
createVoiceOpsStatusStore,
|
|
4582
|
+
createVoiceOpsActionHistoryStore,
|
|
4583
|
+
createVoiceOpsActionCenterViewModel,
|
|
4584
|
+
createVoiceOpsActionCenterStore,
|
|
4585
|
+
createVoiceOpsActionCenterActions,
|
|
4586
|
+
createVoiceLiveTurnLatencyMonitor,
|
|
1668
4587
|
createVoiceDuplexController,
|
|
4588
|
+
createVoiceDeliveryRuntimeViewModel,
|
|
4589
|
+
createVoiceDeliveryRuntimeStore,
|
|
1669
4590
|
createVoiceController,
|
|
1670
4591
|
createVoiceConnection,
|
|
4592
|
+
createVoiceCampaignDialerProofStore,
|
|
4593
|
+
createVoiceBargeInMonitor,
|
|
1671
4594
|
createVoiceAudioPlayer,
|
|
1672
4595
|
createMicrophoneCapture,
|
|
4596
|
+
bindVoiceProviderSimulationControls,
|
|
1673
4597
|
bindVoiceHTMX,
|
|
1674
4598
|
bindVoiceBargeIn
|
|
1675
4599
|
};
|