@absolutejs/voice 0.0.22-beta.93 → 0.0.22-beta.95

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.
@@ -5,5 +5,6 @@ export { VoiceProviderCapabilitiesService } from './voice-provider-capabilities.
5
5
  export { VoiceProviderStatusService } from './voice-provider-status.service';
6
6
  export { VoiceRoutingStatusService } from './voice-routing-status.service';
7
7
  export { VoiceTraceTimelineService } from './voice-trace-timeline.service';
8
+ export { VoiceTurnLatencyService } from './voice-turn-latency.service';
8
9
  export { VoiceTurnQualityService } from './voice-turn-quality.service';
9
10
  export { VoiceWorkflowStatusService } from './voice-workflow-status.service';
@@ -1955,9 +1955,127 @@ VoiceTraceTimelineService = __decorateElement(_init, 0, "VoiceTraceTimelineServi
1955
1955
  __runInitializers(_init, 1, VoiceTraceTimelineService);
1956
1956
  __decoratorMetadata(_init, VoiceTraceTimelineService);
1957
1957
  let _VoiceTraceTimelineService = VoiceTraceTimelineService;
1958
- // src/angular/voice-turn-quality.service.ts
1958
+ // src/angular/voice-turn-latency.service.ts
1959
1959
  import { computed as computed7, Injectable as Injectable8, signal as signal8 } from "@angular/core";
1960
1960
 
1961
+ // src/client/turnLatency.ts
1962
+ var fetchVoiceTurnLatency = async (path = "/api/turn-latency", options = {}) => {
1963
+ const fetchImpl = options.fetch ?? globalThis.fetch;
1964
+ const response = await fetchImpl(path);
1965
+ if (!response.ok) {
1966
+ throw new Error(`Voice turn latency failed: HTTP ${response.status}`);
1967
+ }
1968
+ return await response.json();
1969
+ };
1970
+ var createVoiceTurnLatencyStore = (path = "/api/turn-latency", options = {}) => {
1971
+ const listeners = new Set;
1972
+ let closed = false;
1973
+ let timer;
1974
+ let snapshot = {
1975
+ error: null,
1976
+ isLoading: false
1977
+ };
1978
+ const emit = () => {
1979
+ for (const listener of listeners) {
1980
+ listener();
1981
+ }
1982
+ };
1983
+ const refresh = async () => {
1984
+ if (closed) {
1985
+ return snapshot.report;
1986
+ }
1987
+ snapshot = { ...snapshot, error: null, isLoading: true };
1988
+ emit();
1989
+ try {
1990
+ const report = await fetchVoiceTurnLatency(path, options);
1991
+ snapshot = {
1992
+ error: null,
1993
+ isLoading: false,
1994
+ report,
1995
+ updatedAt: Date.now()
1996
+ };
1997
+ emit();
1998
+ return report;
1999
+ } catch (error) {
2000
+ snapshot = {
2001
+ ...snapshot,
2002
+ error: error instanceof Error ? error.message : String(error),
2003
+ isLoading: false
2004
+ };
2005
+ emit();
2006
+ throw error;
2007
+ }
2008
+ };
2009
+ const close = () => {
2010
+ closed = true;
2011
+ if (timer) {
2012
+ clearInterval(timer);
2013
+ timer = undefined;
2014
+ }
2015
+ listeners.clear();
2016
+ };
2017
+ if (options.intervalMs && options.intervalMs > 0) {
2018
+ timer = setInterval(() => {
2019
+ refresh().catch(() => {});
2020
+ }, options.intervalMs);
2021
+ }
2022
+ return {
2023
+ close,
2024
+ getServerSnapshot: () => snapshot,
2025
+ getSnapshot: () => snapshot,
2026
+ refresh,
2027
+ subscribe: (listener) => {
2028
+ listeners.add(listener);
2029
+ return () => {
2030
+ listeners.delete(listener);
2031
+ };
2032
+ }
2033
+ };
2034
+ };
2035
+
2036
+ // src/angular/voice-turn-latency.service.ts
2037
+ var _dec = [
2038
+ Injectable8({ providedIn: "root" })
2039
+ ];
2040
+ var _init = __decoratorStart(undefined);
2041
+
2042
+ class VoiceTurnLatencyService {
2043
+ connect(path = "/api/turn-latency", options = {}) {
2044
+ const store = createVoiceTurnLatencyStore(path, options);
2045
+ const errorSignal = signal8(null);
2046
+ const isLoadingSignal = signal8(false);
2047
+ const reportSignal = signal8(undefined);
2048
+ const updatedAtSignal = signal8(undefined);
2049
+ const sync = () => {
2050
+ const snapshot = store.getSnapshot();
2051
+ errorSignal.set(snapshot.error);
2052
+ isLoadingSignal.set(snapshot.isLoading);
2053
+ reportSignal.set(snapshot.report);
2054
+ updatedAtSignal.set(snapshot.updatedAt);
2055
+ };
2056
+ const unsubscribe = store.subscribe(sync);
2057
+ sync();
2058
+ store.refresh().catch(() => {});
2059
+ return {
2060
+ close: () => {
2061
+ unsubscribe();
2062
+ store.close();
2063
+ },
2064
+ error: computed7(() => errorSignal()),
2065
+ isLoading: computed7(() => isLoadingSignal()),
2066
+ refresh: store.refresh,
2067
+ report: computed7(() => reportSignal()),
2068
+ updatedAt: computed7(() => updatedAtSignal())
2069
+ };
2070
+ }
2071
+ }
2072
+ VoiceTurnLatencyService = __decorateElement(_init, 0, "VoiceTurnLatencyService", _dec, VoiceTurnLatencyService);
2073
+ __runInitializers(_init, 1, VoiceTurnLatencyService);
2074
+ __decoratorMetadata(_init, VoiceTurnLatencyService);
2075
+ let _VoiceTurnLatencyService = VoiceTurnLatencyService;
2076
+ // src/angular/voice-turn-quality.service.ts
2077
+ import { computed as computed8, Injectable as Injectable9, signal as signal9 } from "@angular/core";
2078
+
1961
2079
  // src/client/turnQuality.ts
1962
2080
  var fetchVoiceTurnQuality = async (path = "/api/turn-quality", options = {}) => {
1963
2081
  const fetchImpl = options.fetch ?? globalThis.fetch;
@@ -2039,17 +2157,17 @@ var createVoiceTurnQualityStore = (path = "/api/turn-quality", options = {}) =>
2039
2157
 
2040
2158
  // src/angular/voice-turn-quality.service.ts
2041
2159
  var _dec = [
2042
- Injectable8({ providedIn: "root" })
2160
+ Injectable9({ providedIn: "root" })
2043
2161
  ];
2044
2162
  var _init = __decoratorStart(undefined);
2045
2163
 
2046
2164
  class VoiceTurnQualityService {
2047
2165
  connect(path = "/api/turn-quality", options = {}) {
2048
2166
  const store = createVoiceTurnQualityStore(path, options);
2049
- const errorSignal = signal8(null);
2050
- const isLoadingSignal = signal8(false);
2051
- const reportSignal = signal8(undefined);
2052
- const updatedAtSignal = signal8(undefined);
2167
+ const errorSignal = signal9(null);
2168
+ const isLoadingSignal = signal9(false);
2169
+ const reportSignal = signal9(undefined);
2170
+ const updatedAtSignal = signal9(undefined);
2053
2171
  const sync = () => {
2054
2172
  const snapshot = store.getSnapshot();
2055
2173
  errorSignal.set(snapshot.error);
@@ -2065,11 +2183,11 @@ class VoiceTurnQualityService {
2065
2183
  unsubscribe();
2066
2184
  store.close();
2067
2185
  },
2068
- error: computed7(() => errorSignal()),
2069
- isLoading: computed7(() => isLoadingSignal()),
2186
+ error: computed8(() => errorSignal()),
2187
+ isLoading: computed8(() => isLoadingSignal()),
2070
2188
  refresh: store.refresh,
2071
- report: computed7(() => reportSignal()),
2072
- updatedAt: computed7(() => updatedAtSignal())
2189
+ report: computed8(() => reportSignal()),
2190
+ updatedAt: computed8(() => updatedAtSignal())
2073
2191
  };
2074
2192
  }
2075
2193
  }
@@ -2078,7 +2196,7 @@ __runInitializers(_init, 1, VoiceTurnQualityService);
2078
2196
  __decoratorMetadata(_init, VoiceTurnQualityService);
2079
2197
  let _VoiceTurnQualityService = VoiceTurnQualityService;
2080
2198
  // src/angular/voice-workflow-status.service.ts
2081
- import { computed as computed8, Injectable as Injectable9, signal as signal9 } from "@angular/core";
2199
+ import { computed as computed9, Injectable as Injectable10, signal as signal10 } from "@angular/core";
2082
2200
 
2083
2201
  // src/client/workflowStatus.ts
2084
2202
  var fetchVoiceWorkflowStatus = async (path = "/evals/scenarios/json", options = {}) => {
@@ -2161,17 +2279,17 @@ var createVoiceWorkflowStatusStore = (path = "/evals/scenarios/json", options =
2161
2279
 
2162
2280
  // src/angular/voice-workflow-status.service.ts
2163
2281
  var _dec = [
2164
- Injectable9({ providedIn: "root" })
2282
+ Injectable10({ providedIn: "root" })
2165
2283
  ];
2166
2284
  var _init = __decoratorStart(undefined);
2167
2285
 
2168
2286
  class VoiceWorkflowStatusService {
2169
2287
  connect(path = "/evals/scenarios/json", options = {}) {
2170
2288
  const store = createVoiceWorkflowStatusStore(path, options);
2171
- const errorSignal = signal9(null);
2172
- const isLoadingSignal = signal9(false);
2173
- const reportSignal = signal9(undefined);
2174
- const updatedAtSignal = signal9(undefined);
2289
+ const errorSignal = signal10(null);
2290
+ const isLoadingSignal = signal10(false);
2291
+ const reportSignal = signal10(undefined);
2292
+ const updatedAtSignal = signal10(undefined);
2175
2293
  const sync = () => {
2176
2294
  const snapshot = store.getSnapshot();
2177
2295
  errorSignal.set(snapshot.error);
@@ -2189,11 +2307,11 @@ class VoiceWorkflowStatusService {
2189
2307
  unsubscribe();
2190
2308
  store.close();
2191
2309
  },
2192
- error: computed8(() => errorSignal()),
2193
- isLoading: computed8(() => isLoadingSignal()),
2310
+ error: computed9(() => errorSignal()),
2311
+ isLoading: computed9(() => isLoadingSignal()),
2194
2312
  refresh: store.refresh,
2195
- report: computed8(() => reportSignal()),
2196
- updatedAt: computed8(() => updatedAtSignal())
2313
+ report: computed9(() => reportSignal()),
2314
+ updatedAt: computed9(() => updatedAtSignal())
2197
2315
  };
2198
2316
  }
2199
2317
  }
@@ -2204,6 +2322,7 @@ let _VoiceWorkflowStatusService = VoiceWorkflowStatusService;
2204
2322
  export {
2205
2323
  VoiceWorkflowStatusService,
2206
2324
  VoiceTurnQualityService,
2325
+ VoiceTurnLatencyService,
2207
2326
  VoiceTraceTimelineService,
2208
2327
  VoiceStreamService,
2209
2328
  VoiceRoutingStatusService,
@@ -0,0 +1,12 @@
1
+ import { type VoiceTurnLatencyClientOptions } from '../client/turnLatency';
2
+ import type { VoiceTurnLatencyReport } from '../turnLatency';
3
+ export declare class VoiceTurnLatencyService {
4
+ connect(path?: string, options?: VoiceTurnLatencyClientOptions): {
5
+ close: () => void;
6
+ error: import("@angular/core").Signal<string | null>;
7
+ isLoading: import("@angular/core").Signal<boolean>;
8
+ refresh: () => Promise<VoiceTurnLatencyReport | undefined>;
9
+ report: import("@angular/core").Signal<VoiceTurnLatencyReport | undefined>;
10
+ updatedAt: import("@angular/core").Signal<number | undefined>;
11
+ };
12
+ }