@absolutejs/voice 0.0.22-beta.215 → 0.0.22-beta.217

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/dist/index.js CHANGED
@@ -21397,6 +21397,7 @@ var listVoiceRoutingEvents = (events) => {
21397
21397
  operation: getString13(event.payload.operation),
21398
21398
  provider,
21399
21399
  routing: getString13(event.payload.routing),
21400
+ scenarioId: event.scenarioId,
21400
21401
  selectedProvider: getString13(event.payload.selectedProvider),
21401
21402
  sessionId: event.sessionId,
21402
21403
  status: providerStatus,
@@ -22066,7 +22067,8 @@ var summarizeSessions = (events) => {
22066
22067
  };
22067
22068
  var buildVoiceProviderSloReport = async (options = {}) => {
22068
22069
  const rawEvents = options.events ?? await options.store?.list() ?? [];
22069
- const events = normalizeEvents2(rawEvents);
22070
+ const now = options.now ?? Date.now();
22071
+ const events = normalizeEvents2(rawEvents).filter((event) => (typeof options.maxAgeMs !== "number" || now - event.at <= options.maxAgeMs) && (!options.sessionId || event.sessionId === options.sessionId) && (!options.scenarioId || event.scenarioId === options.scenarioId));
22070
22072
  const thresholds = mergeThresholds(options.thresholds);
22071
22073
  const observedKinds = new Set(events.map((event) => event.kind));
22072
22074
  const requiredKinds = new Set(options.requiredKinds ?? [...observedKinds]);
@@ -62,7 +62,11 @@ export type VoiceProviderSloReport = {
62
62
  };
63
63
  export type VoiceProviderSloReportOptions = {
64
64
  events?: StoredVoiceTraceEvent[] | VoiceRoutingEvent[];
65
+ maxAgeMs?: number;
66
+ now?: number;
65
67
  requiredKinds?: readonly VoiceRoutingEventKind[];
68
+ scenarioId?: string;
69
+ sessionId?: string;
66
70
  store?: VoiceTraceEventStore;
67
71
  thresholds?: VoiceProviderSloThresholdConfig;
68
72
  };
@@ -14,6 +14,7 @@ export type VoiceRoutingEvent = {
14
14
  operation?: string;
15
15
  provider?: string;
16
16
  routing?: string;
17
+ scenarioId?: string;
17
18
  selectedProvider?: string;
18
19
  sessionId: string;
19
20
  status?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.215",
3
+ "version": "0.0.22-beta.217",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",