@absolutejs/voice 0.0.22-beta.6 → 0.0.22-beta.61
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 +205 -0
- package/dist/angular/index.d.ts +4 -0
- package/dist/angular/index.js +587 -43
- package/dist/angular/voice-app-kit-status.service.d.ts +12 -0
- package/dist/angular/voice-ops-status.component.d.ts +15 -0
- package/dist/angular/voice-provider-status.service.d.ts +12 -0
- package/dist/angular/voice-routing-status.service.d.ts +11 -0
- package/dist/angular/voice-stream.service.d.ts +2 -0
- package/dist/angular/voice-workflow-status.service.d.ts +12 -0
- package/dist/appKit.d.ts +92 -0
- package/dist/assistantHealth.d.ts +81 -0
- package/dist/client/actions.d.ts +22 -0
- package/dist/client/appKitStatus.d.ts +19 -0
- package/dist/client/connection.d.ts +3 -0
- package/dist/client/htmxBootstrap.js +44 -2
- package/dist/client/index.d.ts +18 -0
- package/dist/client/index.js +893 -2
- package/dist/client/opsStatusWidget.d.ts +40 -0
- package/dist/client/providerSimulationControls.d.ts +33 -0
- package/dist/client/providerSimulationControlsWidget.d.ts +20 -0
- package/dist/client/providerStatus.d.ts +19 -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/workflowStatus.d.ts +19 -0
- package/dist/diagnosticsRoutes.d.ts +44 -0
- package/dist/evalRoutes.d.ts +213 -0
- package/dist/handoff.d.ts +54 -0
- package/dist/handoffHealth.d.ts +94 -0
- package/dist/index.d.ts +32 -4
- package/dist/index.js +4222 -133
- package/dist/modelAdapters.d.ts +75 -0
- package/dist/opsConsoleRoutes.d.ts +77 -0
- package/dist/opsWebhook.d.ts +126 -0
- package/dist/providerAdapters.d.ts +48 -0
- package/dist/providerHealth.d.ts +79 -0
- package/dist/qualityRoutes.d.ts +76 -0
- package/dist/queue.d.ts +52 -0
- package/dist/react/VoiceOpsStatus.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/index.d.ts +9 -0
- package/dist/react/index.js +1295 -11
- package/dist/react/useVoiceAppKitStatus.d.ts +8 -0
- package/dist/react/useVoiceController.d.ts +2 -0
- package/dist/react/useVoiceProviderSimulationControls.d.ts +10 -0
- package/dist/react/useVoiceProviderStatus.d.ts +8 -0
- package/dist/react/useVoiceRoutingStatus.d.ts +8 -0
- package/dist/react/useVoiceStream.d.ts +2 -0
- package/dist/react/useVoiceWorkflowStatus.d.ts +8 -0
- package/dist/resilienceRoutes.d.ts +117 -0
- package/dist/sessionReplay.d.ts +175 -0
- package/dist/svelte/createVoiceAppKitStatus.d.ts +8 -0
- package/dist/svelte/createVoiceOpsStatus.d.ts +9 -0
- package/dist/svelte/createVoiceProviderSimulationControls.d.ts +11 -0
- package/dist/svelte/createVoiceProviderStatus.d.ts +10 -0
- package/dist/svelte/createVoiceRoutingStatus.d.ts +10 -0
- package/dist/svelte/createVoiceWorkflowStatus.d.ts +8 -0
- package/dist/svelte/index.d.ts +6 -0
- package/dist/svelte/index.js +923 -3
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.js +1537 -7
- package/dist/testing/ioProviderSimulator.d.ts +41 -0
- package/dist/testing/providerSimulator.d.ts +44 -0
- package/dist/trace.d.ts +1 -1
- package/dist/types.d.ts +84 -2
- package/dist/vue/VoiceOpsStatus.d.ts +30 -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/index.d.ts +9 -0
- package/dist/vue/index.js +1354 -25
- package/dist/vue/useVoiceAppKitStatus.d.ts +9 -0
- package/dist/vue/useVoiceProviderSimulationControls.d.ts +24 -0
- package/dist/vue/useVoiceProviderStatus.d.ts +9 -0
- package/dist/vue/useVoiceRoutingStatus.d.ts +8 -0
- package/dist/vue/useVoiceStream.d.ts +2 -0
- package/dist/vue/useVoiceWorkflowStatus.d.ts +9 -0
- package/dist/workflowContract.d.ts +91 -0
- package/package.json +1 -1
package/dist/angular/index.js
CHANGED
|
@@ -69,9 +69,133 @@ var __decorateElement = (array, flags, name, decorators, target, extra) => {
|
|
|
69
69
|
return k || __decoratorMetadata(array, target), desc && __defProp(target, name, desc), p ? k ^ 4 ? extra : desc : target;
|
|
70
70
|
};
|
|
71
71
|
|
|
72
|
-
// src/angular/voice-
|
|
72
|
+
// src/angular/voice-app-kit-status.service.ts
|
|
73
73
|
import { computed, Injectable, signal } from "@angular/core";
|
|
74
74
|
|
|
75
|
+
// src/client/appKitStatus.ts
|
|
76
|
+
var fetchVoiceAppKitStatus = async (path = "/app-kit/status", options = {}) => {
|
|
77
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
78
|
+
const response = await fetchImpl(path);
|
|
79
|
+
if (!response.ok) {
|
|
80
|
+
throw new Error(`Voice app kit status failed: HTTP ${response.status}`);
|
|
81
|
+
}
|
|
82
|
+
return await response.json();
|
|
83
|
+
};
|
|
84
|
+
var createVoiceAppKitStatusStore = (path = "/app-kit/status", options = {}) => {
|
|
85
|
+
const listeners = new Set;
|
|
86
|
+
let closed = false;
|
|
87
|
+
let timer;
|
|
88
|
+
let snapshot = {
|
|
89
|
+
error: null,
|
|
90
|
+
isLoading: false
|
|
91
|
+
};
|
|
92
|
+
const emit = () => {
|
|
93
|
+
for (const listener of listeners) {
|
|
94
|
+
listener();
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const refresh = async () => {
|
|
98
|
+
if (closed) {
|
|
99
|
+
return snapshot.report;
|
|
100
|
+
}
|
|
101
|
+
snapshot = {
|
|
102
|
+
...snapshot,
|
|
103
|
+
error: null,
|
|
104
|
+
isLoading: true
|
|
105
|
+
};
|
|
106
|
+
emit();
|
|
107
|
+
try {
|
|
108
|
+
const report = await fetchVoiceAppKitStatus(path, options);
|
|
109
|
+
snapshot = {
|
|
110
|
+
error: null,
|
|
111
|
+
isLoading: false,
|
|
112
|
+
report,
|
|
113
|
+
updatedAt: Date.now()
|
|
114
|
+
};
|
|
115
|
+
emit();
|
|
116
|
+
return report;
|
|
117
|
+
} catch (error) {
|
|
118
|
+
snapshot = {
|
|
119
|
+
...snapshot,
|
|
120
|
+
error: error instanceof Error ? error.message : String(error),
|
|
121
|
+
isLoading: false
|
|
122
|
+
};
|
|
123
|
+
emit();
|
|
124
|
+
throw error;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const close = () => {
|
|
128
|
+
closed = true;
|
|
129
|
+
if (timer) {
|
|
130
|
+
clearInterval(timer);
|
|
131
|
+
timer = undefined;
|
|
132
|
+
}
|
|
133
|
+
listeners.clear();
|
|
134
|
+
};
|
|
135
|
+
if (typeof window !== "undefined" && options.intervalMs && options.intervalMs > 0) {
|
|
136
|
+
timer = setInterval(() => {
|
|
137
|
+
refresh().catch(() => {});
|
|
138
|
+
}, options.intervalMs);
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
close,
|
|
142
|
+
getServerSnapshot: () => snapshot,
|
|
143
|
+
getSnapshot: () => snapshot,
|
|
144
|
+
refresh,
|
|
145
|
+
subscribe: (listener) => {
|
|
146
|
+
listeners.add(listener);
|
|
147
|
+
return () => {
|
|
148
|
+
listeners.delete(listener);
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
// src/angular/voice-app-kit-status.service.ts
|
|
155
|
+
var _dec = [
|
|
156
|
+
Injectable({ providedIn: "root" })
|
|
157
|
+
];
|
|
158
|
+
var _init = __decoratorStart(undefined);
|
|
159
|
+
|
|
160
|
+
class VoiceAppKitStatusService {
|
|
161
|
+
connect(path = "/app-kit/status", options = {}) {
|
|
162
|
+
const store = createVoiceAppKitStatusStore(path, options);
|
|
163
|
+
const errorSignal = signal(null);
|
|
164
|
+
const isLoadingSignal = signal(false);
|
|
165
|
+
const reportSignal = signal(undefined);
|
|
166
|
+
const updatedAtSignal = signal(undefined);
|
|
167
|
+
const sync = () => {
|
|
168
|
+
const snapshot = store.getSnapshot();
|
|
169
|
+
errorSignal.set(snapshot.error);
|
|
170
|
+
isLoadingSignal.set(snapshot.isLoading);
|
|
171
|
+
reportSignal.set(snapshot.report);
|
|
172
|
+
updatedAtSignal.set(snapshot.updatedAt);
|
|
173
|
+
};
|
|
174
|
+
const unsubscribe = store.subscribe(sync);
|
|
175
|
+
sync();
|
|
176
|
+
if (typeof window !== "undefined") {
|
|
177
|
+
store.refresh().catch(() => {});
|
|
178
|
+
}
|
|
179
|
+
return {
|
|
180
|
+
close: () => {
|
|
181
|
+
unsubscribe();
|
|
182
|
+
store.close();
|
|
183
|
+
},
|
|
184
|
+
error: computed(() => errorSignal()),
|
|
185
|
+
isLoading: computed(() => isLoadingSignal()),
|
|
186
|
+
refresh: store.refresh,
|
|
187
|
+
report: computed(() => reportSignal()),
|
|
188
|
+
updatedAt: computed(() => updatedAtSignal())
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
VoiceAppKitStatusService = __decorateElement(_init, 0, "VoiceAppKitStatusService", _dec, VoiceAppKitStatusService);
|
|
193
|
+
__runInitializers(_init, 1, VoiceAppKitStatusService);
|
|
194
|
+
__decoratorMetadata(_init, VoiceAppKitStatusService);
|
|
195
|
+
let _VoiceAppKitStatusService = VoiceAppKitStatusService;
|
|
196
|
+
// src/angular/voice-stream.service.ts
|
|
197
|
+
import { computed as computed2, Injectable as Injectable2, signal as signal2 } from "@angular/core";
|
|
198
|
+
|
|
75
199
|
// src/client/actions.ts
|
|
76
200
|
var normalizeErrorMessage = (value) => {
|
|
77
201
|
if (typeof value === "string" && value.trim()) {
|
|
@@ -120,6 +244,12 @@ var serverMessageToAction = (message) => {
|
|
|
120
244
|
sessionId: message.sessionId,
|
|
121
245
|
type: "complete"
|
|
122
246
|
};
|
|
247
|
+
case "call_lifecycle":
|
|
248
|
+
return {
|
|
249
|
+
event: message.event,
|
|
250
|
+
sessionId: message.sessionId,
|
|
251
|
+
type: "call_lifecycle"
|
|
252
|
+
};
|
|
123
253
|
case "error":
|
|
124
254
|
return {
|
|
125
255
|
message: normalizeErrorMessage(message.message),
|
|
@@ -163,7 +293,7 @@ var DEFAULT_SCENARIO_QUERY_PARAM = "scenarioId";
|
|
|
163
293
|
var noop = () => {};
|
|
164
294
|
var noopUnsubscribe = () => noop;
|
|
165
295
|
var NOOP_CONNECTION = {
|
|
166
|
-
|
|
296
|
+
callControl: noop,
|
|
167
297
|
close: noop,
|
|
168
298
|
endTurn: noop,
|
|
169
299
|
getReadyState: () => WS_CLOSED,
|
|
@@ -171,6 +301,7 @@ var NOOP_CONNECTION = {
|
|
|
171
301
|
getSessionId: () => "",
|
|
172
302
|
send: noop,
|
|
173
303
|
sendAudio: noop,
|
|
304
|
+
start: () => {},
|
|
174
305
|
subscribe: noopUnsubscribe
|
|
175
306
|
};
|
|
176
307
|
var createSessionId = () => crypto.randomUUID();
|
|
@@ -192,6 +323,7 @@ var isVoiceServerMessage = (value) => {
|
|
|
192
323
|
switch (value.type) {
|
|
193
324
|
case "audio":
|
|
194
325
|
case "assistant":
|
|
326
|
+
case "call_lifecycle":
|
|
195
327
|
case "complete":
|
|
196
328
|
case "error":
|
|
197
329
|
case "final":
|
|
@@ -332,6 +464,12 @@ var createVoiceConnection = (path, options = {}) => {
|
|
|
332
464
|
const endTurn = () => {
|
|
333
465
|
send({ type: "end_turn" });
|
|
334
466
|
};
|
|
467
|
+
const callControl = (message) => {
|
|
468
|
+
send({
|
|
469
|
+
...message,
|
|
470
|
+
type: "call_control"
|
|
471
|
+
});
|
|
472
|
+
};
|
|
335
473
|
const close = () => {
|
|
336
474
|
clearTimers();
|
|
337
475
|
if (state.ws) {
|
|
@@ -349,7 +487,7 @@ var createVoiceConnection = (path, options = {}) => {
|
|
|
349
487
|
};
|
|
350
488
|
connect();
|
|
351
489
|
return {
|
|
352
|
-
|
|
490
|
+
callControl,
|
|
353
491
|
close,
|
|
354
492
|
endTurn,
|
|
355
493
|
getReadyState: () => state.ws?.readyState ?? WS_CLOSED,
|
|
@@ -357,6 +495,7 @@ var createVoiceConnection = (path, options = {}) => {
|
|
|
357
495
|
getSessionId: () => state.sessionId,
|
|
358
496
|
send,
|
|
359
497
|
sendAudio,
|
|
498
|
+
start,
|
|
360
499
|
subscribe
|
|
361
500
|
};
|
|
362
501
|
};
|
|
@@ -365,6 +504,7 @@ var createVoiceConnection = (path, options = {}) => {
|
|
|
365
504
|
var createInitialState = () => ({
|
|
366
505
|
assistantAudio: [],
|
|
367
506
|
assistantTexts: [],
|
|
507
|
+
call: null,
|
|
368
508
|
error: null,
|
|
369
509
|
isConnected: false,
|
|
370
510
|
scenarioId: null,
|
|
@@ -408,6 +548,20 @@ var createVoiceStreamStore = () => {
|
|
|
408
548
|
status: "completed"
|
|
409
549
|
};
|
|
410
550
|
break;
|
|
551
|
+
case "call_lifecycle":
|
|
552
|
+
state = {
|
|
553
|
+
...state,
|
|
554
|
+
call: {
|
|
555
|
+
...state.call,
|
|
556
|
+
disposition: action.event.type === "end" ? action.event.disposition : state.call?.disposition,
|
|
557
|
+
endedAt: action.event.type === "end" ? action.event.at : state.call?.endedAt,
|
|
558
|
+
events: [...state.call?.events ?? [], action.event],
|
|
559
|
+
lastEventAt: action.event.at,
|
|
560
|
+
startedAt: state.call?.startedAt ?? action.event.at
|
|
561
|
+
},
|
|
562
|
+
sessionId: action.sessionId
|
|
563
|
+
};
|
|
564
|
+
break;
|
|
411
565
|
case "connected":
|
|
412
566
|
state = {
|
|
413
567
|
...state,
|
|
@@ -494,6 +648,9 @@ var createVoiceStream = (path, options = {}) => {
|
|
|
494
648
|
}
|
|
495
649
|
});
|
|
496
650
|
return {
|
|
651
|
+
callControl(message) {
|
|
652
|
+
connection.callControl(message);
|
|
653
|
+
},
|
|
497
654
|
close() {
|
|
498
655
|
unsubscribeConnection();
|
|
499
656
|
connection.close();
|
|
@@ -537,6 +694,9 @@ var createVoiceStream = (path, options = {}) => {
|
|
|
537
694
|
get assistantAudio() {
|
|
538
695
|
return store.getSnapshot().assistantAudio;
|
|
539
696
|
},
|
|
697
|
+
get call() {
|
|
698
|
+
return store.getSnapshot().call;
|
|
699
|
+
},
|
|
540
700
|
sendAudio(audio) {
|
|
541
701
|
connection.sendAudio(audio);
|
|
542
702
|
},
|
|
@@ -551,24 +711,26 @@ var createVoiceStream = (path, options = {}) => {
|
|
|
551
711
|
|
|
552
712
|
// src/angular/voice-stream.service.ts
|
|
553
713
|
var _dec = [
|
|
554
|
-
|
|
714
|
+
Injectable2({ providedIn: "root" })
|
|
555
715
|
];
|
|
556
716
|
var _init = __decoratorStart(undefined);
|
|
557
717
|
|
|
558
718
|
class VoiceStreamService {
|
|
559
719
|
connect(path, options = {}) {
|
|
560
720
|
const stream = createVoiceStream(path, options);
|
|
561
|
-
const assistantAudioSignal =
|
|
562
|
-
const assistantTextsSignal =
|
|
563
|
-
const
|
|
564
|
-
const
|
|
565
|
-
const
|
|
566
|
-
const
|
|
567
|
-
const
|
|
568
|
-
const
|
|
721
|
+
const assistantAudioSignal = signal2([]);
|
|
722
|
+
const assistantTextsSignal = signal2([]);
|
|
723
|
+
const callSignal = signal2(null);
|
|
724
|
+
const errorSignal = signal2(null);
|
|
725
|
+
const isConnectedSignal = signal2(false);
|
|
726
|
+
const partialSignal = signal2("");
|
|
727
|
+
const sessionIdSignal = signal2(stream.sessionId);
|
|
728
|
+
const statusSignal = signal2(stream.status);
|
|
729
|
+
const turnsSignal = signal2([]);
|
|
569
730
|
const sync = () => {
|
|
570
731
|
assistantAudioSignal.set([...stream.assistantAudio]);
|
|
571
732
|
assistantTextsSignal.set([...stream.assistantTexts]);
|
|
733
|
+
callSignal.set(stream.call);
|
|
572
734
|
errorSignal.set(stream.error);
|
|
573
735
|
isConnectedSignal.set(stream.isConnected);
|
|
574
736
|
partialSignal.set(stream.partial);
|
|
@@ -579,20 +741,22 @@ class VoiceStreamService {
|
|
|
579
741
|
const unsubscribe = stream.subscribe(sync);
|
|
580
742
|
sync();
|
|
581
743
|
return {
|
|
582
|
-
assistantAudio:
|
|
583
|
-
assistantTexts:
|
|
744
|
+
assistantAudio: computed2(() => assistantAudioSignal()),
|
|
745
|
+
assistantTexts: computed2(() => assistantTextsSignal()),
|
|
746
|
+
call: computed2(() => callSignal()),
|
|
747
|
+
callControl: (message) => stream.callControl(message),
|
|
584
748
|
close: () => {
|
|
585
749
|
unsubscribe();
|
|
586
750
|
stream.close();
|
|
587
751
|
},
|
|
588
752
|
endTurn: () => stream.endTurn(),
|
|
589
|
-
error:
|
|
590
|
-
isConnected:
|
|
591
|
-
partial:
|
|
753
|
+
error: computed2(() => errorSignal()),
|
|
754
|
+
isConnected: computed2(() => isConnectedSignal()),
|
|
755
|
+
partial: computed2(() => partialSignal()),
|
|
592
756
|
sendAudio: (audio) => stream.sendAudio(audio),
|
|
593
|
-
sessionId:
|
|
594
|
-
status:
|
|
595
|
-
turns:
|
|
757
|
+
sessionId: computed2(() => sessionIdSignal()),
|
|
758
|
+
status: computed2(() => statusSignal()),
|
|
759
|
+
turns: computed2(() => turnsSignal())
|
|
596
760
|
};
|
|
597
761
|
}
|
|
598
762
|
}
|
|
@@ -601,7 +765,7 @@ __runInitializers(_init, 1, VoiceStreamService);
|
|
|
601
765
|
__decoratorMetadata(_init, VoiceStreamService);
|
|
602
766
|
let _VoiceStreamService = VoiceStreamService;
|
|
603
767
|
// src/angular/voice-controller.service.ts
|
|
604
|
-
import { computed as
|
|
768
|
+
import { computed as computed3, Injectable as Injectable3, signal as signal3 } from "@angular/core";
|
|
605
769
|
|
|
606
770
|
// src/client/htmx.ts
|
|
607
771
|
var DEFAULT_EVENT_NAME = "voice-refresh";
|
|
@@ -1065,6 +1229,7 @@ var resolveVoiceRuntimePreset = (name = "default") => {
|
|
|
1065
1229
|
var createInitialState2 = (stream) => ({
|
|
1066
1230
|
assistantAudio: [...stream.assistantAudio],
|
|
1067
1231
|
assistantTexts: [...stream.assistantTexts],
|
|
1232
|
+
call: stream.call,
|
|
1068
1233
|
error: stream.error,
|
|
1069
1234
|
isConnected: stream.isConnected,
|
|
1070
1235
|
isRecording: false,
|
|
@@ -1094,6 +1259,7 @@ var createVoiceController = (path, options = {}) => {
|
|
|
1094
1259
|
...state,
|
|
1095
1260
|
assistantAudio: [...stream.assistantAudio],
|
|
1096
1261
|
assistantTexts: [...stream.assistantTexts],
|
|
1262
|
+
call: stream.call,
|
|
1097
1263
|
error: stream.error,
|
|
1098
1264
|
isConnected: stream.isConnected,
|
|
1099
1265
|
partial: stream.partial,
|
|
@@ -1171,6 +1337,7 @@ var createVoiceController = (path, options = {}) => {
|
|
|
1171
1337
|
bindHTMX(bindingOptions) {
|
|
1172
1338
|
return bindVoiceHTMX(stream, bindingOptions);
|
|
1173
1339
|
},
|
|
1340
|
+
callControl: (message) => stream.callControl(message),
|
|
1174
1341
|
close,
|
|
1175
1342
|
endTurn: () => stream.endTurn(),
|
|
1176
1343
|
get error() {
|
|
@@ -1223,29 +1390,32 @@ var createVoiceController = (path, options = {}) => {
|
|
|
1223
1390
|
},
|
|
1224
1391
|
get assistantAudio() {
|
|
1225
1392
|
return state.assistantAudio;
|
|
1393
|
+
},
|
|
1394
|
+
get call() {
|
|
1395
|
+
return state.call;
|
|
1226
1396
|
}
|
|
1227
1397
|
};
|
|
1228
1398
|
};
|
|
1229
1399
|
|
|
1230
1400
|
// src/angular/voice-controller.service.ts
|
|
1231
1401
|
var _dec = [
|
|
1232
|
-
|
|
1402
|
+
Injectable3({ providedIn: "root" })
|
|
1233
1403
|
];
|
|
1234
1404
|
var _init = __decoratorStart(undefined);
|
|
1235
1405
|
|
|
1236
1406
|
class VoiceControllerService {
|
|
1237
1407
|
connect(path, options = {}) {
|
|
1238
1408
|
const controller = createVoiceController(path, options);
|
|
1239
|
-
const assistantAudioSignal =
|
|
1240
|
-
const assistantTextsSignal =
|
|
1241
|
-
const errorSignal =
|
|
1242
|
-
const isConnectedSignal =
|
|
1243
|
-
const isRecordingSignal =
|
|
1244
|
-
const partialSignal =
|
|
1245
|
-
const recordingErrorSignal =
|
|
1246
|
-
const sessionIdSignal =
|
|
1247
|
-
const statusSignal =
|
|
1248
|
-
const turnsSignal =
|
|
1409
|
+
const assistantAudioSignal = signal3([]);
|
|
1410
|
+
const assistantTextsSignal = signal3([]);
|
|
1411
|
+
const errorSignal = signal3(null);
|
|
1412
|
+
const isConnectedSignal = signal3(false);
|
|
1413
|
+
const isRecordingSignal = signal3(false);
|
|
1414
|
+
const partialSignal = signal3("");
|
|
1415
|
+
const recordingErrorSignal = signal3(null);
|
|
1416
|
+
const sessionIdSignal = signal3(controller.sessionId);
|
|
1417
|
+
const statusSignal = signal3(controller.status);
|
|
1418
|
+
const turnsSignal = signal3([]);
|
|
1249
1419
|
const sync = () => {
|
|
1250
1420
|
assistantAudioSignal.set([...controller.assistantAudio]);
|
|
1251
1421
|
assistantTextsSignal.set([...controller.assistantTexts]);
|
|
@@ -1261,26 +1431,26 @@ class VoiceControllerService {
|
|
|
1261
1431
|
const unsubscribe = controller.subscribe(sync);
|
|
1262
1432
|
sync();
|
|
1263
1433
|
return {
|
|
1264
|
-
assistantAudio:
|
|
1265
|
-
assistantTexts:
|
|
1434
|
+
assistantAudio: computed3(() => assistantAudioSignal()),
|
|
1435
|
+
assistantTexts: computed3(() => assistantTextsSignal()),
|
|
1266
1436
|
bindHTMX: controller.bindHTMX,
|
|
1267
1437
|
close: () => {
|
|
1268
1438
|
unsubscribe();
|
|
1269
1439
|
controller.close();
|
|
1270
1440
|
},
|
|
1271
1441
|
endTurn: () => controller.endTurn(),
|
|
1272
|
-
error:
|
|
1273
|
-
isConnected:
|
|
1274
|
-
isRecording:
|
|
1275
|
-
partial:
|
|
1276
|
-
recordingError:
|
|
1442
|
+
error: computed3(() => errorSignal()),
|
|
1443
|
+
isConnected: computed3(() => isConnectedSignal()),
|
|
1444
|
+
isRecording: computed3(() => isRecordingSignal()),
|
|
1445
|
+
partial: computed3(() => partialSignal()),
|
|
1446
|
+
recordingError: computed3(() => recordingErrorSignal()),
|
|
1277
1447
|
sendAudio: (audio) => controller.sendAudio(audio),
|
|
1278
|
-
sessionId:
|
|
1448
|
+
sessionId: computed3(() => sessionIdSignal()),
|
|
1279
1449
|
startRecording: () => controller.startRecording(),
|
|
1280
|
-
status:
|
|
1450
|
+
status: computed3(() => statusSignal()),
|
|
1281
1451
|
stopRecording: () => controller.stopRecording(),
|
|
1282
1452
|
toggleRecording: () => controller.toggleRecording(),
|
|
1283
|
-
turns:
|
|
1453
|
+
turns: computed3(() => turnsSignal())
|
|
1284
1454
|
};
|
|
1285
1455
|
}
|
|
1286
1456
|
}
|
|
@@ -1288,7 +1458,381 @@ VoiceControllerService = __decorateElement(_init, 0, "VoiceControllerService", _
|
|
|
1288
1458
|
__runInitializers(_init, 1, VoiceControllerService);
|
|
1289
1459
|
__decoratorMetadata(_init, VoiceControllerService);
|
|
1290
1460
|
let _VoiceControllerService = VoiceControllerService;
|
|
1461
|
+
// src/angular/voice-provider-status.service.ts
|
|
1462
|
+
import { computed as computed4, Injectable as Injectable4, signal as signal4 } from "@angular/core";
|
|
1463
|
+
|
|
1464
|
+
// src/client/providerStatus.ts
|
|
1465
|
+
var fetchVoiceProviderStatus = async (path = "/api/provider-status", options = {}) => {
|
|
1466
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
1467
|
+
const response = await fetchImpl(path);
|
|
1468
|
+
if (!response.ok) {
|
|
1469
|
+
throw new Error(`Voice provider status failed: HTTP ${response.status}`);
|
|
1470
|
+
}
|
|
1471
|
+
return await response.json();
|
|
1472
|
+
};
|
|
1473
|
+
var createVoiceProviderStatusStore = (path = "/api/provider-status", options = {}) => {
|
|
1474
|
+
const listeners = new Set;
|
|
1475
|
+
let closed = false;
|
|
1476
|
+
let timer;
|
|
1477
|
+
let snapshot = {
|
|
1478
|
+
error: null,
|
|
1479
|
+
isLoading: false,
|
|
1480
|
+
providers: []
|
|
1481
|
+
};
|
|
1482
|
+
const emit = () => {
|
|
1483
|
+
for (const listener of listeners) {
|
|
1484
|
+
listener();
|
|
1485
|
+
}
|
|
1486
|
+
};
|
|
1487
|
+
const refresh = async () => {
|
|
1488
|
+
if (closed) {
|
|
1489
|
+
return snapshot.providers;
|
|
1490
|
+
}
|
|
1491
|
+
snapshot = {
|
|
1492
|
+
...snapshot,
|
|
1493
|
+
error: null,
|
|
1494
|
+
isLoading: true
|
|
1495
|
+
};
|
|
1496
|
+
emit();
|
|
1497
|
+
try {
|
|
1498
|
+
const providers = await fetchVoiceProviderStatus(path, options);
|
|
1499
|
+
snapshot = {
|
|
1500
|
+
error: null,
|
|
1501
|
+
isLoading: false,
|
|
1502
|
+
providers,
|
|
1503
|
+
updatedAt: Date.now()
|
|
1504
|
+
};
|
|
1505
|
+
emit();
|
|
1506
|
+
return providers;
|
|
1507
|
+
} catch (error) {
|
|
1508
|
+
snapshot = {
|
|
1509
|
+
...snapshot,
|
|
1510
|
+
error: error instanceof Error ? error.message : String(error),
|
|
1511
|
+
isLoading: false
|
|
1512
|
+
};
|
|
1513
|
+
emit();
|
|
1514
|
+
throw error;
|
|
1515
|
+
}
|
|
1516
|
+
};
|
|
1517
|
+
const close = () => {
|
|
1518
|
+
closed = true;
|
|
1519
|
+
if (timer) {
|
|
1520
|
+
clearInterval(timer);
|
|
1521
|
+
timer = undefined;
|
|
1522
|
+
}
|
|
1523
|
+
listeners.clear();
|
|
1524
|
+
};
|
|
1525
|
+
if (options.intervalMs && options.intervalMs > 0) {
|
|
1526
|
+
timer = setInterval(() => {
|
|
1527
|
+
refresh().catch(() => {});
|
|
1528
|
+
}, options.intervalMs);
|
|
1529
|
+
}
|
|
1530
|
+
return {
|
|
1531
|
+
close,
|
|
1532
|
+
getServerSnapshot: () => snapshot,
|
|
1533
|
+
getSnapshot: () => snapshot,
|
|
1534
|
+
refresh,
|
|
1535
|
+
subscribe: (listener) => {
|
|
1536
|
+
listeners.add(listener);
|
|
1537
|
+
return () => {
|
|
1538
|
+
listeners.delete(listener);
|
|
1539
|
+
};
|
|
1540
|
+
}
|
|
1541
|
+
};
|
|
1542
|
+
};
|
|
1543
|
+
|
|
1544
|
+
// src/angular/voice-provider-status.service.ts
|
|
1545
|
+
var _dec = [
|
|
1546
|
+
Injectable4({ providedIn: "root" })
|
|
1547
|
+
];
|
|
1548
|
+
var _init = __decoratorStart(undefined);
|
|
1549
|
+
|
|
1550
|
+
class VoiceProviderStatusService {
|
|
1551
|
+
connect(path = "/api/provider-status", options = {}) {
|
|
1552
|
+
const store = createVoiceProviderStatusStore(path, options);
|
|
1553
|
+
const errorSignal = signal4(null);
|
|
1554
|
+
const isLoadingSignal = signal4(false);
|
|
1555
|
+
const providersSignal = signal4([]);
|
|
1556
|
+
const updatedAtSignal = signal4(undefined);
|
|
1557
|
+
const sync = () => {
|
|
1558
|
+
const snapshot = store.getSnapshot();
|
|
1559
|
+
errorSignal.set(snapshot.error);
|
|
1560
|
+
isLoadingSignal.set(snapshot.isLoading);
|
|
1561
|
+
providersSignal.set([...snapshot.providers]);
|
|
1562
|
+
updatedAtSignal.set(snapshot.updatedAt);
|
|
1563
|
+
};
|
|
1564
|
+
const unsubscribe = store.subscribe(sync);
|
|
1565
|
+
sync();
|
|
1566
|
+
store.refresh().catch(() => {});
|
|
1567
|
+
return {
|
|
1568
|
+
close: () => {
|
|
1569
|
+
unsubscribe();
|
|
1570
|
+
store.close();
|
|
1571
|
+
},
|
|
1572
|
+
error: computed4(() => errorSignal()),
|
|
1573
|
+
isLoading: computed4(() => isLoadingSignal()),
|
|
1574
|
+
providers: computed4(() => providersSignal()),
|
|
1575
|
+
refresh: store.refresh,
|
|
1576
|
+
updatedAt: computed4(() => updatedAtSignal())
|
|
1577
|
+
};
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
VoiceProviderStatusService = __decorateElement(_init, 0, "VoiceProviderStatusService", _dec, VoiceProviderStatusService);
|
|
1581
|
+
__runInitializers(_init, 1, VoiceProviderStatusService);
|
|
1582
|
+
__decoratorMetadata(_init, VoiceProviderStatusService);
|
|
1583
|
+
let _VoiceProviderStatusService = VoiceProviderStatusService;
|
|
1584
|
+
// src/angular/voice-routing-status.service.ts
|
|
1585
|
+
import { Injectable as Injectable5, signal as signal5 } from "@angular/core";
|
|
1586
|
+
|
|
1587
|
+
// src/client/routingStatus.ts
|
|
1588
|
+
var fetchVoiceRoutingStatus = async (path = "/api/routing/latest", options = {}) => {
|
|
1589
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
1590
|
+
const response = await fetchImpl(path);
|
|
1591
|
+
if (!response.ok) {
|
|
1592
|
+
throw new Error(`Voice routing status failed: HTTP ${response.status}`);
|
|
1593
|
+
}
|
|
1594
|
+
return await response.json();
|
|
1595
|
+
};
|
|
1596
|
+
var createVoiceRoutingStatusStore = (path = "/api/routing/latest", options = {}) => {
|
|
1597
|
+
const listeners = new Set;
|
|
1598
|
+
let closed = false;
|
|
1599
|
+
let timer;
|
|
1600
|
+
let snapshot = {
|
|
1601
|
+
decision: null,
|
|
1602
|
+
error: null,
|
|
1603
|
+
isLoading: false
|
|
1604
|
+
};
|
|
1605
|
+
const emit = () => {
|
|
1606
|
+
for (const listener of listeners) {
|
|
1607
|
+
listener();
|
|
1608
|
+
}
|
|
1609
|
+
};
|
|
1610
|
+
const refresh = async () => {
|
|
1611
|
+
if (closed) {
|
|
1612
|
+
return snapshot.decision;
|
|
1613
|
+
}
|
|
1614
|
+
snapshot = {
|
|
1615
|
+
...snapshot,
|
|
1616
|
+
error: null,
|
|
1617
|
+
isLoading: true
|
|
1618
|
+
};
|
|
1619
|
+
emit();
|
|
1620
|
+
try {
|
|
1621
|
+
const decision = await fetchVoiceRoutingStatus(path, options);
|
|
1622
|
+
snapshot = {
|
|
1623
|
+
decision,
|
|
1624
|
+
error: null,
|
|
1625
|
+
isLoading: false,
|
|
1626
|
+
updatedAt: Date.now()
|
|
1627
|
+
};
|
|
1628
|
+
emit();
|
|
1629
|
+
return decision;
|
|
1630
|
+
} catch (error) {
|
|
1631
|
+
snapshot = {
|
|
1632
|
+
...snapshot,
|
|
1633
|
+
error: error instanceof Error ? error.message : String(error),
|
|
1634
|
+
isLoading: false
|
|
1635
|
+
};
|
|
1636
|
+
emit();
|
|
1637
|
+
throw error;
|
|
1638
|
+
}
|
|
1639
|
+
};
|
|
1640
|
+
const close = () => {
|
|
1641
|
+
closed = true;
|
|
1642
|
+
if (timer) {
|
|
1643
|
+
clearInterval(timer);
|
|
1644
|
+
timer = undefined;
|
|
1645
|
+
}
|
|
1646
|
+
listeners.clear();
|
|
1647
|
+
};
|
|
1648
|
+
if (options.intervalMs && options.intervalMs > 0) {
|
|
1649
|
+
timer = setInterval(() => {
|
|
1650
|
+
refresh().catch(() => {});
|
|
1651
|
+
}, options.intervalMs);
|
|
1652
|
+
}
|
|
1653
|
+
return {
|
|
1654
|
+
close,
|
|
1655
|
+
getServerSnapshot: () => snapshot,
|
|
1656
|
+
getSnapshot: () => snapshot,
|
|
1657
|
+
refresh,
|
|
1658
|
+
subscribe: (listener) => {
|
|
1659
|
+
listeners.add(listener);
|
|
1660
|
+
return () => {
|
|
1661
|
+
listeners.delete(listener);
|
|
1662
|
+
};
|
|
1663
|
+
}
|
|
1664
|
+
};
|
|
1665
|
+
};
|
|
1666
|
+
|
|
1667
|
+
// src/angular/voice-routing-status.service.ts
|
|
1668
|
+
var _dec = [
|
|
1669
|
+
Injectable5({ providedIn: "root" })
|
|
1670
|
+
];
|
|
1671
|
+
var _init = __decoratorStart(undefined);
|
|
1672
|
+
|
|
1673
|
+
class VoiceRoutingStatusService {
|
|
1674
|
+
connect(path = "/api/routing/latest", options = {}) {
|
|
1675
|
+
const store = createVoiceRoutingStatusStore(path, options);
|
|
1676
|
+
const decisionSignal = signal5(null);
|
|
1677
|
+
const errorSignal = signal5(null);
|
|
1678
|
+
const isLoadingSignal = signal5(false);
|
|
1679
|
+
const updatedAtSignal = signal5(undefined);
|
|
1680
|
+
const sync = () => {
|
|
1681
|
+
const snapshot = store.getSnapshot();
|
|
1682
|
+
decisionSignal.set(snapshot.decision);
|
|
1683
|
+
errorSignal.set(snapshot.error);
|
|
1684
|
+
isLoadingSignal.set(snapshot.isLoading);
|
|
1685
|
+
updatedAtSignal.set(snapshot.updatedAt);
|
|
1686
|
+
};
|
|
1687
|
+
const unsubscribe = store.subscribe(sync);
|
|
1688
|
+
sync();
|
|
1689
|
+
store.refresh().catch(() => {});
|
|
1690
|
+
return {
|
|
1691
|
+
close: () => {
|
|
1692
|
+
unsubscribe();
|
|
1693
|
+
store.close();
|
|
1694
|
+
},
|
|
1695
|
+
decision: decisionSignal.asReadonly(),
|
|
1696
|
+
error: errorSignal.asReadonly(),
|
|
1697
|
+
isLoading: isLoadingSignal.asReadonly(),
|
|
1698
|
+
refresh: store.refresh,
|
|
1699
|
+
updatedAt: updatedAtSignal.asReadonly()
|
|
1700
|
+
};
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
VoiceRoutingStatusService = __decorateElement(_init, 0, "VoiceRoutingStatusService", _dec, VoiceRoutingStatusService);
|
|
1704
|
+
__runInitializers(_init, 1, VoiceRoutingStatusService);
|
|
1705
|
+
__decoratorMetadata(_init, VoiceRoutingStatusService);
|
|
1706
|
+
let _VoiceRoutingStatusService = VoiceRoutingStatusService;
|
|
1707
|
+
// src/angular/voice-workflow-status.service.ts
|
|
1708
|
+
import { computed as computed5, Injectable as Injectable6, signal as signal6 } from "@angular/core";
|
|
1709
|
+
|
|
1710
|
+
// src/client/workflowStatus.ts
|
|
1711
|
+
var fetchVoiceWorkflowStatus = async (path = "/evals/scenarios/json", options = {}) => {
|
|
1712
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
1713
|
+
const response = await fetchImpl(path);
|
|
1714
|
+
if (!response.ok) {
|
|
1715
|
+
throw new Error(`Voice workflow status failed: HTTP ${response.status}`);
|
|
1716
|
+
}
|
|
1717
|
+
return await response.json();
|
|
1718
|
+
};
|
|
1719
|
+
var createVoiceWorkflowStatusStore = (path = "/evals/scenarios/json", options = {}) => {
|
|
1720
|
+
const listeners = new Set;
|
|
1721
|
+
let closed = false;
|
|
1722
|
+
let timer;
|
|
1723
|
+
let snapshot = {
|
|
1724
|
+
error: null,
|
|
1725
|
+
isLoading: false
|
|
1726
|
+
};
|
|
1727
|
+
const emit = () => {
|
|
1728
|
+
for (const listener of listeners) {
|
|
1729
|
+
listener();
|
|
1730
|
+
}
|
|
1731
|
+
};
|
|
1732
|
+
const refresh = async () => {
|
|
1733
|
+
if (closed) {
|
|
1734
|
+
return snapshot.report;
|
|
1735
|
+
}
|
|
1736
|
+
snapshot = {
|
|
1737
|
+
...snapshot,
|
|
1738
|
+
error: null,
|
|
1739
|
+
isLoading: true
|
|
1740
|
+
};
|
|
1741
|
+
emit();
|
|
1742
|
+
try {
|
|
1743
|
+
const report = await fetchVoiceWorkflowStatus(path, options);
|
|
1744
|
+
snapshot = {
|
|
1745
|
+
error: null,
|
|
1746
|
+
isLoading: false,
|
|
1747
|
+
report,
|
|
1748
|
+
updatedAt: Date.now()
|
|
1749
|
+
};
|
|
1750
|
+
emit();
|
|
1751
|
+
return report;
|
|
1752
|
+
} catch (error) {
|
|
1753
|
+
snapshot = {
|
|
1754
|
+
...snapshot,
|
|
1755
|
+
error: error instanceof Error ? error.message : String(error),
|
|
1756
|
+
isLoading: false
|
|
1757
|
+
};
|
|
1758
|
+
emit();
|
|
1759
|
+
throw error;
|
|
1760
|
+
}
|
|
1761
|
+
};
|
|
1762
|
+
const close = () => {
|
|
1763
|
+
closed = true;
|
|
1764
|
+
if (timer) {
|
|
1765
|
+
clearInterval(timer);
|
|
1766
|
+
timer = undefined;
|
|
1767
|
+
}
|
|
1768
|
+
listeners.clear();
|
|
1769
|
+
};
|
|
1770
|
+
if (typeof window !== "undefined" && options.intervalMs && options.intervalMs > 0) {
|
|
1771
|
+
timer = setInterval(() => {
|
|
1772
|
+
refresh().catch(() => {});
|
|
1773
|
+
}, options.intervalMs);
|
|
1774
|
+
}
|
|
1775
|
+
return {
|
|
1776
|
+
close,
|
|
1777
|
+
getServerSnapshot: () => snapshot,
|
|
1778
|
+
getSnapshot: () => snapshot,
|
|
1779
|
+
refresh,
|
|
1780
|
+
subscribe: (listener) => {
|
|
1781
|
+
listeners.add(listener);
|
|
1782
|
+
return () => {
|
|
1783
|
+
listeners.delete(listener);
|
|
1784
|
+
};
|
|
1785
|
+
}
|
|
1786
|
+
};
|
|
1787
|
+
};
|
|
1788
|
+
|
|
1789
|
+
// src/angular/voice-workflow-status.service.ts
|
|
1790
|
+
var _dec = [
|
|
1791
|
+
Injectable6({ providedIn: "root" })
|
|
1792
|
+
];
|
|
1793
|
+
var _init = __decoratorStart(undefined);
|
|
1794
|
+
|
|
1795
|
+
class VoiceWorkflowStatusService {
|
|
1796
|
+
connect(path = "/evals/scenarios/json", options = {}) {
|
|
1797
|
+
const store = createVoiceWorkflowStatusStore(path, options);
|
|
1798
|
+
const errorSignal = signal6(null);
|
|
1799
|
+
const isLoadingSignal = signal6(false);
|
|
1800
|
+
const reportSignal = signal6(undefined);
|
|
1801
|
+
const updatedAtSignal = signal6(undefined);
|
|
1802
|
+
const sync = () => {
|
|
1803
|
+
const snapshot = store.getSnapshot();
|
|
1804
|
+
errorSignal.set(snapshot.error);
|
|
1805
|
+
isLoadingSignal.set(snapshot.isLoading);
|
|
1806
|
+
reportSignal.set(snapshot.report);
|
|
1807
|
+
updatedAtSignal.set(snapshot.updatedAt);
|
|
1808
|
+
};
|
|
1809
|
+
const unsubscribe = store.subscribe(sync);
|
|
1810
|
+
sync();
|
|
1811
|
+
if (typeof window !== "undefined") {
|
|
1812
|
+
store.refresh().catch(() => {});
|
|
1813
|
+
}
|
|
1814
|
+
return {
|
|
1815
|
+
close: () => {
|
|
1816
|
+
unsubscribe();
|
|
1817
|
+
store.close();
|
|
1818
|
+
},
|
|
1819
|
+
error: computed5(() => errorSignal()),
|
|
1820
|
+
isLoading: computed5(() => isLoadingSignal()),
|
|
1821
|
+
refresh: store.refresh,
|
|
1822
|
+
report: computed5(() => reportSignal()),
|
|
1823
|
+
updatedAt: computed5(() => updatedAtSignal())
|
|
1824
|
+
};
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
VoiceWorkflowStatusService = __decorateElement(_init, 0, "VoiceWorkflowStatusService", _dec, VoiceWorkflowStatusService);
|
|
1828
|
+
__runInitializers(_init, 1, VoiceWorkflowStatusService);
|
|
1829
|
+
__decoratorMetadata(_init, VoiceWorkflowStatusService);
|
|
1830
|
+
let _VoiceWorkflowStatusService = VoiceWorkflowStatusService;
|
|
1291
1831
|
export {
|
|
1832
|
+
VoiceWorkflowStatusService,
|
|
1292
1833
|
VoiceStreamService,
|
|
1293
|
-
|
|
1834
|
+
VoiceRoutingStatusService,
|
|
1835
|
+
VoiceProviderStatusService,
|
|
1836
|
+
VoiceControllerService,
|
|
1837
|
+
VoiceAppKitStatusService
|
|
1294
1838
|
};
|