@absolutejs/voice 0.0.22-beta.396 → 0.0.22-beta.398

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.d.ts CHANGED
@@ -32,7 +32,9 @@ export type { VoiceCompetitiveCoverageAssertionInput, VoiceCompetitiveCoverageAs
32
32
  export type { VoicePlatformCoverageAssertionInput, VoicePlatformCoverageAssertionReport, VoicePlatformCoverageEvidence, VoicePlatformCoverageRoutesOptions, VoicePlatformCoverageStatus, VoicePlatformCoverageSummary, VoicePlatformCoverageSummaryInput, VoicePlatformCoverageSurface } from './platformCoverage';
33
33
  export { assertVoiceProofTrendEvidence, appendVoiceRealCallProfileRecoveryEvidence, buildEmptyVoiceProofTrendReport, buildVoiceProofTrendProfileSummaries, buildVoiceProofTrendRecommendationReport, buildVoiceProofTrendReportFromRealCallProfiles, buildVoiceProofTrendReport, buildVoiceRealCallProfileEvidenceFromTraceEvents, buildVoiceRealCallProfileDefaults, buildVoiceRealCallProfileHistoryReport, buildVoiceRealCallProfileReadinessCheck, buildVoiceRealCallProfileRecoveryJobHistoryCheck, buildVoiceRealCallProfileRecoveryActions, createVoiceInMemoryRealCallProfileRecoveryJobStore, createVoiceRealCallProfileTraceCollector, createVoiceSQLiteRealCallProfileRecoveryJobStore, createVoiceProofTrendRecommendationRoutes, createVoiceProofTrendRoutes, createVoiceRealCallProfileHistoryRoutes, createVoiceRealCallProfileRecoveryActionRoutes, DEFAULT_VOICE_PROOF_TREND_PROFILE_DEFINITIONS, DEFAULT_VOICE_PROOF_TRENDS_MAX_AGE_MS, evaluateVoiceProofTrendEvidence, formatVoiceProofTrendAge, loadVoiceRealCallProfileEvidenceFromTraceStore, normalizeVoiceProofTrendReport, readVoiceProofTrendReportFile, renderVoiceProofTrendRecommendationHTML, renderVoiceProofTrendRecommendationMarkdown, renderVoiceRealCallProfileHistoryHTML, renderVoiceRealCallProfileHistoryMarkdown, runVoiceRealCallProfileRecoveryLoop, resolveVoiceRealCallProfileProviderRoute } from './proofTrends';
34
34
  export { createVoiceEvidenceAssertion, createVoiceProofAssertion, summarizeVoiceProofAssertions } from './proofAssertions';
35
+ export { buildVoiceSessionSnapshot, buildVoiceSessionSnapshotStatus, createVoiceSessionSnapshotRoutes, parseVoiceSessionSnapshot } from './sessionSnapshot';
35
36
  export type { VoiceEvidenceAssertionInput, VoiceProofAssertionInput, VoiceProofAssertionResult, VoiceProofAssertionSummary } from './proofAssertions';
37
+ export type { VoiceSessionSnapshot, VoiceSessionSnapshotInput, VoiceSessionSnapshotQualityEvidence, VoiceSessionSnapshotRoutesOptions, VoiceSessionSnapshotRouteSource, VoiceSessionSnapshotRouteSourceInput, VoiceSessionSnapshotStatus } from './sessionSnapshot';
36
38
  export { fetchVoiceProofTarget, getVoiceProofTargetLogicalFailure, mapVoiceProofTargetsWithConcurrency, runVoiceCommandProofTarget, runVoiceCommandProofTargets, runVoiceProofTargets } from './proofRunner';
37
39
  export type { VoiceCommandProofExecutionResult, VoiceCommandProofTarget, VoiceCommandProofTargetResult, VoiceCommandProofTargetRunnerOptions, VoiceCommandProofTargetRunOptions, VoiceProofTarget, VoiceProofTargetMethod, VoiceProofTargetResult, VoiceProofTargetRunnerOptions, VoiceProofTargetRunOptions } from './proofRunner';
38
40
  export { applyVoiceProfileSwitchGuard, buildVoiceProfileSwitchReadinessReport, buildVoiceProfileSwitchLiveDecisionReport, createVoiceProfileSwitchLiveDecisionRoutes, createVoiceProfileSwitchPolicyProofRoutes, createVoiceProfileSwitchReadinessRoutes, recommendVoiceProfileSwitch, renderVoiceProfileSwitchLiveDecisionHTML, renderVoiceProfileSwitchPolicyProofHTML, renderVoiceProfileSwitchReadinessHTML, runVoiceProfileSwitchPolicyProof } from './profileSwitchRecommendation';
package/dist/index.js CHANGED
@@ -18385,6 +18385,130 @@ var summarizeVoiceProofAssertions = (assertions) => {
18385
18385
  total: assertions.length
18386
18386
  };
18387
18387
  };
18388
+ // src/sessionSnapshot.ts
18389
+ import { Elysia as Elysia25 } from "elysia";
18390
+ var statusRank4 = (status) => {
18391
+ if (status === "fail") {
18392
+ return 2;
18393
+ }
18394
+ if (status === "warn") {
18395
+ return 1;
18396
+ }
18397
+ return 0;
18398
+ };
18399
+ var maxStatus = (statuses) => statuses.reduce((current, status) => statusRank4(status) > statusRank4(current) ? status : current, "pass");
18400
+ var buildVoiceSessionSnapshotStatus = (input) => {
18401
+ const statuses = [];
18402
+ for (const media of input.media ?? []) {
18403
+ statuses.push(media.report.status);
18404
+ }
18405
+ for (const quality of input.quality ?? []) {
18406
+ if (quality.status !== undefined) {
18407
+ statuses.push(quality.status);
18408
+ }
18409
+ }
18410
+ for (const outcome of input.telephonyOutcomes ?? []) {
18411
+ if (outcome.campaignOutcome.status === "failed") {
18412
+ statuses.push("fail");
18413
+ } else if (outcome.duplicate === true || !outcome.campaignOutcome.applied) {
18414
+ statuses.push("warn");
18415
+ }
18416
+ }
18417
+ if (input.proofSummary?.ok === false) {
18418
+ statuses.push("fail");
18419
+ }
18420
+ return maxStatus(statuses);
18421
+ };
18422
+ var buildVoiceSessionSnapshot = (input) => {
18423
+ const proofAssertions = [...input.proofAssertions ?? []];
18424
+ const proofSummary = summarizeVoiceProofAssertions(proofAssertions);
18425
+ const media = [...input.media ?? []];
18426
+ const providerRoutingEvents = [...input.providerRoutingEvents ?? []];
18427
+ const quality = [...input.quality ?? []];
18428
+ const telephonyOutcomes = [...input.telephonyOutcomes ?? []];
18429
+ return {
18430
+ capturedAt: Date.now(),
18431
+ media,
18432
+ name: input.name,
18433
+ proofAssertions,
18434
+ proofSummary,
18435
+ providerRoutingEvents,
18436
+ quality,
18437
+ scenarioId: input.scenarioId,
18438
+ schema: "absolute.voice.session.snapshot.v1",
18439
+ sessionId: input.sessionId,
18440
+ status: buildVoiceSessionSnapshotStatus({
18441
+ media,
18442
+ proofSummary,
18443
+ quality,
18444
+ telephonyOutcomes
18445
+ }),
18446
+ telephonyOutcomes,
18447
+ turnId: input.turnId
18448
+ };
18449
+ };
18450
+ var parseVoiceSessionSnapshot = (snapshot) => {
18451
+ if (snapshot.schema !== "absolute.voice.session.snapshot.v1") {
18452
+ throw new Error("Unsupported voice session snapshot schema.");
18453
+ }
18454
+ return snapshot;
18455
+ };
18456
+ var isVoiceSessionSnapshot = (value) => value.schema === "absolute.voice.session.snapshot.v1";
18457
+ var sessionSnapshotJsonResponse = (snapshot, headers = {}, downloadFilename) => new Response(JSON.stringify(snapshot, null, 2), {
18458
+ headers: {
18459
+ ...downloadFilename ? {
18460
+ "content-disposition": `attachment; filename="${downloadFilename.replaceAll('"', "")}"`
18461
+ } : {},
18462
+ "content-type": "application/json; charset=utf-8",
18463
+ ...headers
18464
+ }
18465
+ });
18466
+ var resolveVoiceSessionSnapshot = async (options, input) => {
18467
+ const source = typeof options.source === "function" ? await options.source(input) : options.source ?? {
18468
+ media: options.media,
18469
+ name: options.name,
18470
+ proofAssertions: options.proofAssertions,
18471
+ providerRoutingEvents: options.providerRoutingEvents,
18472
+ quality: options.quality,
18473
+ scenarioId: options.scenarioId,
18474
+ sessionId: options.sessionId ?? input.sessionId,
18475
+ telephonyOutcomes: options.telephonyOutcomes,
18476
+ turnId: options.turnId ?? input.turnId
18477
+ };
18478
+ if (isVoiceSessionSnapshot(source)) {
18479
+ return parseVoiceSessionSnapshot(source);
18480
+ }
18481
+ return buildVoiceSessionSnapshot({
18482
+ ...source,
18483
+ sessionId: source.sessionId ?? input.sessionId,
18484
+ turnId: source.turnId ?? input.turnId
18485
+ });
18486
+ };
18487
+ var readRouteSessionId = (params) => {
18488
+ const sessionId = params.sessionId;
18489
+ return typeof sessionId === "string" ? sessionId : "";
18490
+ };
18491
+ var createVoiceSessionSnapshotRoutes = (options = {}) => {
18492
+ const path = options.path ?? "/api/voice/session-snapshot/:sessionId";
18493
+ const downloadPath = options.downloadPath ?? "/api/voice/session-snapshot/:sessionId/download";
18494
+ const headers = options.headers ?? {};
18495
+ const app = new Elysia25({ name: options.name ?? "voice-session-snapshot" }).get(path, async ({ params, request, query }) => sessionSnapshotJsonResponse(await resolveVoiceSessionSnapshot(options, {
18496
+ request,
18497
+ sessionId: readRouteSessionId(params),
18498
+ turnId: typeof query.turnId === "string" ? query.turnId : undefined
18499
+ }), headers));
18500
+ if (downloadPath !== false) {
18501
+ app.get(downloadPath, async ({ params, request, query }) => {
18502
+ const snapshot = await resolveVoiceSessionSnapshot(options, {
18503
+ request,
18504
+ sessionId: readRouteSessionId(params),
18505
+ turnId: typeof query.turnId === "string" ? query.turnId : undefined
18506
+ });
18507
+ return sessionSnapshotJsonResponse(snapshot, headers, `voice-session-${snapshot.sessionId}.snapshot.json`);
18508
+ });
18509
+ }
18510
+ return app;
18511
+ };
18388
18512
  // src/proofRunner.ts
18389
18513
  var encoder = new TextEncoder;
18390
18514
  var trimBaseUrl = (baseUrl) => baseUrl.replace(/\/$/, "");
@@ -18629,7 +18753,7 @@ var buildVoiceIOProviderRouterTraceEvent = (options) => ({
18629
18753
  });
18630
18754
  var appendVoiceIOProviderRouterTraceEvent = async (options) => options.store.append(buildVoiceIOProviderRouterTraceEvent(options));
18631
18755
  // src/sloCalibration.ts
18632
- import { Elysia as Elysia25 } from "elysia";
18756
+ import { Elysia as Elysia26 } from "elysia";
18633
18757
  var DEFAULT_HEADROOM_MULTIPLIER = 1.5;
18634
18758
  var DEFAULT_WARN_RATIO = 0.8;
18635
18759
  var DEFAULT_MIN_PASSING_RUNS = 3;
@@ -18909,7 +19033,7 @@ var renderVoiceSloReadinessThresholdHTML = (report, options = {}) => {
18909
19033
  var createVoiceSloCalibrationRoutes = (options) => {
18910
19034
  const path = options.path ?? "/api/voice/slo-calibration";
18911
19035
  const markdownPath = options.markdownPath === undefined ? "/voice/slo-calibration.md" : options.markdownPath;
18912
- const routes = new Elysia25({
19036
+ const routes = new Elysia26({
18913
19037
  name: options.name ?? "absolutejs-voice-slo-calibration"
18914
19038
  });
18915
19039
  const loadReport = async () => buildVoiceSloCalibrationReport(typeof options.source === "function" ? await options.source() : options.source, options);
@@ -18933,7 +19057,7 @@ var createVoiceSloReadinessThresholdRoutes = (options) => {
18933
19057
  const path = options.path ?? "/api/voice/slo-readiness-thresholds";
18934
19058
  const htmlPath = options.htmlPath === undefined ? "/voice/slo-readiness-thresholds" : options.htmlPath;
18935
19059
  const markdownPath = options.markdownPath === undefined ? "/voice/slo-readiness-thresholds.md" : options.markdownPath;
18936
- const routes = new Elysia25({
19060
+ const routes = new Elysia26({
18937
19061
  name: options.name ?? "absolutejs-voice-slo-readiness-thresholds"
18938
19062
  });
18939
19063
  const loadReport = async () => buildVoiceSloReadinessThresholdReport(typeof options.source === "function" ? await options.source() : options.source, options);
@@ -18967,7 +19091,7 @@ var createVoiceSloReadinessThresholdRoutes = (options) => {
18967
19091
  return routes;
18968
19092
  };
18969
19093
  // src/liveOps.ts
18970
- import { Elysia as Elysia26 } from "elysia";
19094
+ import { Elysia as Elysia27 } from "elysia";
18971
19095
  var VOICE_LIVE_OPS_ACTIONS = [
18972
19096
  "assign",
18973
19097
  "create-task",
@@ -19277,7 +19401,7 @@ var createVoiceLiveOpsRoutes = (options = {}) => {
19277
19401
  const controller = createVoiceLiveOpsController(options);
19278
19402
  const path = options.path ?? "/api/voice/live-ops/action";
19279
19403
  const controlPath = options.controlPath ?? "/api/voice/live-ops/control/:sessionId";
19280
- return new Elysia26({
19404
+ return new Elysia27({
19281
19405
  name: options.name ?? "absolutejs-voice-live-ops"
19282
19406
  }).post(path, async ({ request, set }) => {
19283
19407
  try {
@@ -19299,7 +19423,7 @@ var createVoiceLiveOpsRoutes = (options = {}) => {
19299
19423
  });
19300
19424
  };
19301
19425
  // src/deliveryRuntime.ts
19302
- import { Elysia as Elysia27 } from "elysia";
19426
+ import { Elysia as Elysia28 } from "elysia";
19303
19427
  import { mkdir } from "fs/promises";
19304
19428
  import { dirname, join } from "path";
19305
19429
  var escapeHtml28 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
@@ -19553,7 +19677,7 @@ var createVoiceDeliveryRuntimeRoutes = (options) => {
19553
19677
  const htmlPath = options.htmlPath === undefined ? "/delivery-runtime" : options.htmlPath;
19554
19678
  const tickPath = options.tickPath === undefined ? "/api/voice-delivery-runtime/tick" : options.tickPath;
19555
19679
  const requeueDeadLettersPath = options.requeueDeadLettersPath === undefined ? "/api/voice-delivery-runtime/requeue-dead-letters" : options.requeueDeadLettersPath;
19556
- const routes = new Elysia27({
19680
+ const routes = new Elysia28({
19557
19681
  name: options.name ?? "absolutejs-voice-delivery-runtime"
19558
19682
  }).get(path, () => buildVoiceDeliveryRuntimeReport(options.runtime));
19559
19683
  if (tickPath !== false) {
@@ -19589,7 +19713,7 @@ var createVoiceDeliveryRuntimeRoutes = (options) => {
19589
19713
  return routes;
19590
19714
  };
19591
19715
  // src/dataControl.ts
19592
- import { Elysia as Elysia28 } from "elysia";
19716
+ import { Elysia as Elysia29 } from "elysia";
19593
19717
  var voiceComplianceRedactionDefaults = {
19594
19718
  keys: [
19595
19719
  "apiKey",
@@ -20128,7 +20252,7 @@ var parseRetentionPolicyBody = (body, options, dryRun) => {
20128
20252
  var createVoiceDataControlRoutes = (options) => {
20129
20253
  const path = options.path ?? "/data-control";
20130
20254
  const title = options.title ?? "AbsoluteJS Voice Data Control";
20131
- const routes = new Elysia28({
20255
+ const routes = new Elysia29({
20132
20256
  name: options.name ?? "absolutejs-voice-data-control"
20133
20257
  });
20134
20258
  routes.get(path, async ({ query }) => {
@@ -20204,15 +20328,15 @@ var createVoiceDataControlRoutes = (options) => {
20204
20328
  return routes;
20205
20329
  };
20206
20330
  // src/evalRoutes.ts
20207
- import { Elysia as Elysia31 } from "elysia";
20331
+ import { Elysia as Elysia32 } from "elysia";
20208
20332
  import { mkdir as mkdir2 } from "fs/promises";
20209
20333
  import { dirname as dirname2 } from "path";
20210
20334
 
20211
20335
  // src/qualityRoutes.ts
20212
- import { Elysia as Elysia30 } from "elysia";
20336
+ import { Elysia as Elysia31 } from "elysia";
20213
20337
 
20214
20338
  // src/handoffHealth.ts
20215
- import { Elysia as Elysia29 } from "elysia";
20339
+ import { Elysia as Elysia30 } from "elysia";
20216
20340
  var escapeHtml30 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
20217
20341
  var getString9 = (value) => typeof value === "string" && value.length > 0 ? value : undefined;
20218
20342
  var isStatus = (value) => value === "delivered" || value === "failed" || value === "skipped";
@@ -20395,7 +20519,7 @@ var createVoiceHandoffHealthHTMLHandler = (options = {}) => async ({ query }) =>
20395
20519
  var createVoiceHandoffHealthRoutes = (options = {}) => {
20396
20520
  const path = options.path ?? "/api/voice-handoffs";
20397
20521
  const htmlPath = options.htmlPath === undefined ? `${path}/htmx` : options.htmlPath;
20398
- const routes = new Elysia29({
20522
+ const routes = new Elysia30({
20399
20523
  name: options.name ?? "absolutejs-voice-handoff-health"
20400
20524
  }).get(path, createVoiceHandoffHealthJSONHandler(options));
20401
20525
  if (htmlPath) {
@@ -20526,7 +20650,7 @@ var renderVoiceQualityHTML = (report, options = {}) => {
20526
20650
  };
20527
20651
  var createVoiceQualityRoutes = (options) => {
20528
20652
  const path = options.path ?? "/quality";
20529
- const routes = new Elysia30({
20653
+ const routes = new Elysia31({
20530
20654
  name: options.name ?? "absolutejs-voice-quality"
20531
20655
  });
20532
20656
  const getReport = () => evaluateVoiceQuality({
@@ -20939,7 +21063,7 @@ var renderVoiceScenarioFixtureEvalHTML = (report, options = {}) => {
20939
21063
  };
20940
21064
  var createVoiceEvalRoutes = (options) => {
20941
21065
  const path = options.path ?? "/evals";
20942
- const routes = new Elysia31({
21066
+ const routes = new Elysia32({
20943
21067
  name: options.name ?? "absolutejs-voice-evals"
20944
21068
  });
20945
21069
  const getReport = () => runVoiceSessionEvals({
@@ -21076,10 +21200,10 @@ var createVoiceEvalRoutes = (options) => {
21076
21200
  return routes;
21077
21201
  };
21078
21202
  // src/simulationSuite.ts
21079
- import { Elysia as Elysia34 } from "elysia";
21203
+ import { Elysia as Elysia35 } from "elysia";
21080
21204
 
21081
21205
  // src/outcomeContract.ts
21082
- import { Elysia as Elysia32 } from "elysia";
21206
+ import { Elysia as Elysia33 } from "elysia";
21083
21207
  var escapeHtml33 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
21084
21208
  var resolveSessionHref2 = (value, sessionId) => {
21085
21209
  if (value === false) {
@@ -21328,7 +21452,7 @@ var createVoiceOutcomeContractHTMLHandler = (options) => async () => {
21328
21452
  var createVoiceOutcomeContractRoutes = (options) => {
21329
21453
  const path = options.path ?? "/api/outcome-contracts";
21330
21454
  const htmlPath = options.htmlPath === undefined ? `${path}/htmx` : options.htmlPath;
21331
- const routes = new Elysia32({
21455
+ const routes = new Elysia33({
21332
21456
  name: options.name ?? "absolutejs-voice-outcome-contracts"
21333
21457
  }).get(path, createVoiceOutcomeContractJSONHandler(options));
21334
21458
  if (htmlPath) {
@@ -21338,7 +21462,7 @@ var createVoiceOutcomeContractRoutes = (options) => {
21338
21462
  };
21339
21463
 
21340
21464
  // src/toolContract.ts
21341
- import { Elysia as Elysia33 } from "elysia";
21465
+ import { Elysia as Elysia34 } from "elysia";
21342
21466
 
21343
21467
  // src/toolRuntime.ts
21344
21468
  var toErrorMessage4 = (error) => error instanceof Error ? error.message : String(error);
@@ -21862,7 +21986,7 @@ var createVoiceToolContractHTMLHandler = (options) => async () => {
21862
21986
  var createVoiceToolContractRoutes = (options) => {
21863
21987
  const path = options.path ?? "/api/tool-contracts";
21864
21988
  const htmlPath = options.htmlPath === undefined ? `${path}/htmx` : options.htmlPath;
21865
- const routes = new Elysia33({
21989
+ const routes = new Elysia34({
21866
21990
  name: options.name ?? "absolutejs-voice-tool-contracts"
21867
21991
  }).get(path, createVoiceToolContractJSONHandler(options));
21868
21992
  if (htmlPath) {
@@ -22114,7 +22238,7 @@ app.use(
22114
22238
  var createVoiceSimulationSuiteRoutes = (options) => {
22115
22239
  const path = options.path ?? "/api/voice/simulations";
22116
22240
  const htmlPath = options.htmlPath === undefined ? "/voice/simulations" : options.htmlPath;
22117
- const app = new Elysia34({
22241
+ const app = new Elysia35({
22118
22242
  name: options.name ?? "absolutejs-voice-simulation-suite"
22119
22243
  }).get(path, () => runVoiceSimulationSuite(options));
22120
22244
  if (htmlPath) {
@@ -22426,7 +22550,7 @@ var createVoiceWorkflowContractHandler = (input) => {
22426
22550
  };
22427
22551
  };
22428
22552
  // src/sessionReplay.ts
22429
- import { Elysia as Elysia35 } from "elysia";
22553
+ import { Elysia as Elysia36 } from "elysia";
22430
22554
  var getString12 = (value) => typeof value === "string" ? value : undefined;
22431
22555
  var escapeHtml36 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
22432
22556
  var increment4 = (record, key) => {
@@ -22666,7 +22790,7 @@ var createVoiceSessionsHTMLHandler = (options = {}) => async ({ query }) => {
22666
22790
  var createVoiceSessionListRoutes = (options = {}) => {
22667
22791
  const path = options.path ?? "/api/voice-sessions";
22668
22792
  const htmlPath = options.htmlPath === undefined ? `${path}/htmx` : options.htmlPath;
22669
- const routes = new Elysia35({
22793
+ const routes = new Elysia36({
22670
22794
  name: options.name ?? "absolutejs-voice-session-list"
22671
22795
  }).get(path, createVoiceSessionsJSONHandler(options));
22672
22796
  if (htmlPath) {
@@ -22694,7 +22818,7 @@ var createVoiceSessionReplayHTMLHandler = (options) => async ({ params }) => {
22694
22818
  var createVoiceSessionReplayRoutes = (options) => {
22695
22819
  const path = options.path ?? "/api/voice-sessions/:sessionId/replay";
22696
22820
  const htmlPath = options.htmlPath === undefined ? `${path}/htmx` : options.htmlPath;
22697
- const routes = new Elysia35({
22821
+ const routes = new Elysia36({
22698
22822
  name: options.name ?? "absolutejs-voice-session-replay"
22699
22823
  }).get(path, createVoiceSessionReplayJSONHandler(options));
22700
22824
  if (htmlPath) {
@@ -23008,7 +23132,7 @@ var assertVoiceAgentSquadContractEvidence = (reports, input = {}) => {
23008
23132
  return report;
23009
23133
  };
23010
23134
  // src/turnLatency.ts
23011
- import { Elysia as Elysia36 } from "elysia";
23135
+ import { Elysia as Elysia37 } from "elysia";
23012
23136
  var DEFAULT_WARN_AFTER_MS = 1800;
23013
23137
  var DEFAULT_FAIL_AFTER_MS = 3200;
23014
23138
  var escapeHtml37 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
@@ -23164,7 +23288,7 @@ var createVoiceTurnLatencyHTMLHandler = (options) => async () => {
23164
23288
  var createVoiceTurnLatencyRoutes = (options) => {
23165
23289
  const path = options.path ?? "/api/turn-latency";
23166
23290
  const htmlPath = options.htmlPath === undefined ? `${path}/htmx` : options.htmlPath;
23167
- const routes = new Elysia36({
23291
+ const routes = new Elysia37({
23168
23292
  name: options.name ?? "absolutejs-voice-turn-latency"
23169
23293
  }).get(path, createVoiceTurnLatencyJSONHandler(options));
23170
23294
  if (htmlPath) {
@@ -23173,7 +23297,7 @@ var createVoiceTurnLatencyRoutes = (options) => {
23173
23297
  return routes;
23174
23298
  };
23175
23299
  // src/liveLatency.ts
23176
- import { Elysia as Elysia37 } from "elysia";
23300
+ import { Elysia as Elysia38 } from "elysia";
23177
23301
  var escapeHtml38 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
23178
23302
  var percentile4 = (values, percentileValue) => {
23179
23303
  if (values.length === 0) {
@@ -23247,7 +23371,7 @@ await traceStore.append({
23247
23371
  var createVoiceLiveLatencyRoutes = (options) => {
23248
23372
  const path = options.path ?? "/api/live-latency";
23249
23373
  const htmlPath = options.htmlPath === undefined ? "/live-latency" : options.htmlPath;
23250
- const routes = new Elysia37({
23374
+ const routes = new Elysia38({
23251
23375
  name: options.name ?? "absolutejs-voice-live-latency"
23252
23376
  }).get(path, () => summarizeVoiceLiveLatency(options));
23253
23377
  if (htmlPath) {
@@ -23566,7 +23690,7 @@ None.
23566
23690
  `}`;
23567
23691
  };
23568
23692
  // src/turnQuality.ts
23569
- import { Elysia as Elysia38 } from "elysia";
23693
+ import { Elysia as Elysia39 } from "elysia";
23570
23694
  var DEFAULT_CONFIDENCE_WARN_THRESHOLD = 0.72;
23571
23695
  var escapeHtml39 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
23572
23696
  var getTurnLatencyMs = (turn) => {
@@ -23673,7 +23797,7 @@ var createVoiceTurnQualityHTMLHandler = (options) => async () => {
23673
23797
  var createVoiceTurnQualityRoutes = (options) => {
23674
23798
  const path = options.path ?? "/api/turn-quality";
23675
23799
  const htmlPath = options.htmlPath === undefined ? `${path}/htmx` : options.htmlPath;
23676
- const routes = new Elysia38({
23800
+ const routes = new Elysia39({
23677
23801
  name: options.name ?? "absolutejs-voice-turn-quality"
23678
23802
  }).get(path, createVoiceTurnQualityJSONHandler(options));
23679
23803
  if (htmlPath) {
@@ -23682,7 +23806,7 @@ var createVoiceTurnQualityRoutes = (options) => {
23682
23806
  return routes;
23683
23807
  };
23684
23808
  // src/telephonyOutcome.ts
23685
- import { Elysia as Elysia39 } from "elysia";
23809
+ import { Elysia as Elysia40 } from "elysia";
23686
23810
  var DEFAULT_COMPLETED_STATUSES = [
23687
23811
  "answered",
23688
23812
  "completed",
@@ -24443,7 +24567,7 @@ var createVoiceTelephonyWebhookHandler = (options = {}) => async (input) => {
24443
24567
  var createVoiceTelephonyWebhookRoutes = (options = {}) => {
24444
24568
  const path = options.path ?? "/api/voice/telephony/webhook";
24445
24569
  const handler = createVoiceTelephonyWebhookHandler(options);
24446
- return new Elysia39({
24570
+ return new Elysia40({
24447
24571
  name: options.name ?? "absolutejs-voice-telephony-webhooks"
24448
24572
  }).post(path, async ({ query, request }) => {
24449
24573
  try {
@@ -24464,12 +24588,12 @@ var createVoiceTelephonyWebhookRoutes = (options = {}) => {
24464
24588
  });
24465
24589
  };
24466
24590
  // src/phoneAgent.ts
24467
- import { Elysia as Elysia45 } from "elysia";
24591
+ import { Elysia as Elysia46 } from "elysia";
24468
24592
 
24469
24593
  // src/telephony/plivo.ts
24470
24594
  import { Buffer as Buffer5 } from "buffer";
24471
24595
  import { Database } from "bun:sqlite";
24472
- import { Elysia as Elysia41 } from "elysia";
24596
+ import { Elysia as Elysia42 } from "elysia";
24473
24597
 
24474
24598
  // src/telephony/contract.ts
24475
24599
  var DEFAULT_REQUIREMENTS = [
@@ -24553,7 +24677,7 @@ var evaluateVoiceTelephonyContract = (input) => {
24553
24677
 
24554
24678
  // src/telephony/twilio.ts
24555
24679
  import { Buffer as Buffer4 } from "buffer";
24556
- import { Elysia as Elysia40 } from "elysia";
24680
+ import { Elysia as Elysia41 } from "elysia";
24557
24681
  var TWILIO_MULAW_SAMPLE_RATE = 8000;
24558
24682
  var VOICE_PCM_SAMPLE_RATE = 16000;
24559
24683
  var escapeXml2 = (value) => value.replaceAll("&", "&amp;").replaceAll('"', "&quot;").replaceAll("'", "&apos;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
@@ -25212,7 +25336,7 @@ var createTwilioVoiceRoutes = (options) => {
25212
25336
  const smokePath = options.smoke?.path === false ? false : options.smoke?.path ?? "/api/voice/twilio/smoke";
25213
25337
  const bridges = new WeakMap;
25214
25338
  const webhookPolicy = options.webhook?.policy ?? options.outcomePolicy ?? createVoiceTelephonyOutcomePolicy();
25215
- const app = new Elysia40({
25339
+ const app = new Elysia41({
25216
25340
  name: options.name ?? "absolutejs-voice-twilio"
25217
25341
  }).get(twimlPath, async ({ query, request }) => {
25218
25342
  const streamUrl = await resolveTwilioStreamUrl(options, {
@@ -25884,7 +26008,7 @@ var createPlivoVoiceRoutes = (options = {}) => {
25884
26008
  nonceStore: options.webhook.nonceStore,
25885
26009
  verificationUrl: options.webhook.verificationUrl
25886
26010
  }) : undefined);
25887
- const app = new Elysia41({
26011
+ const app = new Elysia42({
25888
26012
  name: options.name ?? "absolutejs-voice-plivo"
25889
26013
  }).get(answerPath, async ({ query, request }) => {
25890
26014
  const streamUrl = await resolvePlivoStreamUrl(options, {
@@ -25996,7 +26120,7 @@ var createPlivoVoiceRoutes = (options = {}) => {
25996
26120
  // src/telephony/telnyx.ts
25997
26121
  import { Buffer as Buffer6 } from "buffer";
25998
26122
  import { Database as Database2 } from "bun:sqlite";
25999
- import { Elysia as Elysia42 } from "elysia";
26123
+ import { Elysia as Elysia43 } from "elysia";
26000
26124
  var escapeXml4 = (value) => value.replaceAll("&", "&amp;").replaceAll('"', "&quot;").replaceAll("'", "&apos;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
26001
26125
  var escapeHtml42 = (value) => value.replaceAll("&", "&amp;").replaceAll('"', "&quot;").replaceAll("'", "&#39;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
26002
26126
  var joinUrlPath4 = (origin, path) => `${origin.replace(/\/$/, "")}${path.startsWith("/") ? path : `/${path}`}`;
@@ -26499,7 +26623,7 @@ var createTelnyxVoiceRoutes = (options = {}) => {
26499
26623
  publicKey: options.webhook.publicKey,
26500
26624
  toleranceSeconds: options.webhook.toleranceSeconds
26501
26625
  }) : undefined);
26502
- const app = new Elysia42({
26626
+ const app = new Elysia43({
26503
26627
  name: options.name ?? "absolutejs-voice-telnyx"
26504
26628
  }).get(texmlPath, async ({ query, request }) => {
26505
26629
  const streamUrl = await resolveTelnyxStreamUrl(options, {
@@ -26609,7 +26733,7 @@ var createTelnyxVoiceRoutes = (options = {}) => {
26609
26733
  };
26610
26734
 
26611
26735
  // src/telephony/matrix.ts
26612
- import { Elysia as Elysia43 } from "elysia";
26736
+ import { Elysia as Elysia44 } from "elysia";
26613
26737
  var escapeHtml43 = (value) => value.replaceAll("&", "&amp;").replaceAll('"', "&quot;").replaceAll("'", "&#39;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
26614
26738
  var labelForProvider = (provider) => provider.split("-").map((part) => `${part.slice(0, 1).toUpperCase()}${part.slice(1)}`).join(" ");
26615
26739
  var resolveEntryStatus = (contract, setup, smoke) => {
@@ -26693,7 +26817,7 @@ ${entry.issues.length ? `<ul style="margin:12px 0 0; padding-left:18px;">${entry
26693
26817
  </main>`;
26694
26818
  var createVoiceTelephonyCarrierMatrixRoutes = (options) => {
26695
26819
  const path = options.path ?? "/api/voice/telephony/carriers";
26696
- return new Elysia43({
26820
+ return new Elysia44({
26697
26821
  name: options.name ?? "absolutejs-voice-telephony-carrier-matrix"
26698
26822
  }).get(path, async ({ query, request }) => {
26699
26823
  const providers = await options.load({ query, request });
@@ -26715,7 +26839,7 @@ var createVoiceTelephonyCarrierMatrixRoutes = (options) => {
26715
26839
  };
26716
26840
 
26717
26841
  // src/phoneAgentProductionSmoke.ts
26718
- import { Elysia as Elysia44 } from "elysia";
26842
+ import { Elysia as Elysia45 } from "elysia";
26719
26843
  var defaultRequirements = [
26720
26844
  "media-started",
26721
26845
  "transcript",
@@ -26858,7 +26982,7 @@ var createVoicePhoneAgentProductionSmokeHTMLHandler = (options) => async ({
26858
26982
  var createVoicePhoneAgentProductionSmokeRoutes = (options) => {
26859
26983
  const path = options.path ?? "/api/voice/phone/smoke-contract";
26860
26984
  const htmlPath = options.htmlPath === undefined ? "/voice/phone/smoke-contract" : options.htmlPath;
26861
- const routes = new Elysia44({
26985
+ const routes = new Elysia45({
26862
26986
  name: options.name ?? "absolutejs-voice-phone-smoke-contract"
26863
26987
  }).get(path, createVoicePhoneAgentProductionSmokeJSONHandler(options));
26864
26988
  if (htmlPath) {
@@ -27189,7 +27313,7 @@ var createVoicePhoneAgent = (options) => {
27189
27313
  setupPath: resolveSetupPath(carrier),
27190
27314
  smokePath: resolveSmokePath(carrier)
27191
27315
  }));
27192
- const app = new Elysia45({
27316
+ const app = new Elysia46({
27193
27317
  name: options.name ?? "absolutejs-voice-phone-agent"
27194
27318
  });
27195
27319
  for (const carrier of options.carriers) {
@@ -28819,7 +28943,7 @@ var createOpenAIVoiceTTS = (options) => {
28819
28943
  };
28820
28944
  };
28821
28945
  // src/providerCapabilities.ts
28822
- import { Elysia as Elysia46 } from "elysia";
28946
+ import { Elysia as Elysia47 } from "elysia";
28823
28947
  var escapeHtml46 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
28824
28948
  var fromProviderList = (kind, providers, options) => (providers ?? []).map((provider) => ({
28825
28949
  configured: true,
@@ -28920,7 +29044,7 @@ var createVoiceProviderCapabilityHTMLHandler = (options) => async () => {
28920
29044
  var createVoiceProviderCapabilityRoutes = (options) => {
28921
29045
  const path = options.path ?? "/api/provider-capabilities";
28922
29046
  const htmlPath = options.htmlPath === undefined ? `${path}/htmx` : options.htmlPath;
28923
- const routes = new Elysia46({
29047
+ const routes = new Elysia47({
28924
29048
  name: options.name ?? "absolutejs-voice-provider-capabilities"
28925
29049
  }).get(path, createVoiceProviderCapabilityJSONHandler(options));
28926
29050
  if (htmlPath) {
@@ -28929,7 +29053,7 @@ var createVoiceProviderCapabilityRoutes = (options) => {
28929
29053
  return routes;
28930
29054
  };
28931
29055
  // src/providerOrchestration.ts
28932
- import { Elysia as Elysia47 } from "elysia";
29056
+ import { Elysia as Elysia48 } from "elysia";
28933
29057
  var defaultRequirement = {
28934
29058
  minProviders: 1,
28935
29059
  requireBudgetPolicy: false,
@@ -28937,7 +29061,7 @@ var defaultRequirement = {
28937
29061
  requireFallback: false,
28938
29062
  requireTimeoutBudget: false
28939
29063
  };
28940
- var statusRank4 = {
29064
+ var statusRank5 = {
28941
29065
  pass: 0,
28942
29066
  warn: 1,
28943
29067
  fail: 2
@@ -28953,7 +29077,7 @@ var surfaceProviderNames = (surface) => uniqueSorted6([
28953
29077
  ...isProviderList(surface.fallback) ? surface.fallback : [],
28954
29078
  ...isProviderList(surface.allowProviders) ? surface.allowProviders : []
28955
29079
  ]);
28956
- var surfaceStatus = (issues) => issues.reduce((status, issue) => statusRank4[issue.status] > statusRank4[status] ? issue.status : status, "pass");
29080
+ var surfaceStatus = (issues) => issues.reduce((status, issue) => statusRank5[issue.status] > statusRank5[status] ? issue.status : status, "pass");
28957
29081
  var resolvedRequirement = (surface, options) => ({
28958
29082
  ...defaultRequirement,
28959
29083
  ...options.defaultRequirement ?? {},
@@ -29105,7 +29229,7 @@ var createVoiceProviderOrchestrationRoutes = (options) => {
29105
29229
  const path = options.path ?? "/api/voice/provider-orchestration";
29106
29230
  const htmlPath = options.htmlPath === undefined ? "/voice/provider-orchestration" : options.htmlPath;
29107
29231
  const markdownPath = options.markdownPath === undefined ? "/voice/provider-orchestration.md" : options.markdownPath;
29108
- const routes = new Elysia47({
29232
+ const routes = new Elysia48({
29109
29233
  name: options.name ?? "absolutejs-voice-provider-orchestration"
29110
29234
  }).get(path, () => buildVoiceProviderOrchestrationReport(options));
29111
29235
  if (htmlPath) {
@@ -29276,7 +29400,7 @@ var assertVoiceProviderRoutingContractEvidence = (reports, input = {}) => {
29276
29400
  return report;
29277
29401
  };
29278
29402
  // src/providerSlo.ts
29279
- import { Elysia as Elysia48 } from "elysia";
29403
+ import { Elysia as Elysia49 } from "elysia";
29280
29404
  var defaultThresholds = {
29281
29405
  llm: {
29282
29406
  maxAverageElapsedMs: 2500,
@@ -29304,7 +29428,7 @@ var defaultThresholds = {
29304
29428
  }
29305
29429
  };
29306
29430
  var providerKinds = ["llm", "stt", "tts"];
29307
- var statusRank5 = {
29431
+ var statusRank6 = {
29308
29432
  pass: 0,
29309
29433
  warn: 1,
29310
29434
  fail: 2
@@ -29500,9 +29624,9 @@ var evaluateVoiceProviderSloEvidence = (report, input = {}) => {
29500
29624
  const fallbacks = kindReports.reduce((total, kind) => total + kind.fallbacks, 0);
29501
29625
  const timeouts = kindReports.reduce((total, kind) => total + kind.timeouts, 0);
29502
29626
  const unresolvedErrors = kindReports.reduce((total, kind) => total + kind.unresolvedErrors, 0);
29503
- const maxStatus = input.maxStatus ?? "pass";
29504
- if (statusRank5[report.status] > statusRank5[maxStatus]) {
29505
- issues.push(`Expected provider SLO status at most ${maxStatus}, found ${report.status}.`);
29627
+ const maxStatus2 = input.maxStatus ?? "pass";
29628
+ if (statusRank6[report.status] > statusRank6[maxStatus2]) {
29629
+ issues.push(`Expected provider SLO status at most ${maxStatus2}, found ${report.status}.`);
29506
29630
  }
29507
29631
  if (input.minEvents !== undefined && report.events < input.minEvents) {
29508
29632
  issues.push(`Expected at least ${String(input.minEvents)} provider routing events, found ${String(report.events)}.`);
@@ -29630,7 +29754,7 @@ var createVoiceProviderSloRoutes = (options) => {
29630
29754
  ...options.headers ?? {}
29631
29755
  };
29632
29756
  const buildReport = () => buildVoiceProviderSloReport(options);
29633
- const app = new Elysia48({ name: options.name ?? "absolute-voice-provider-slos" });
29757
+ const app = new Elysia49({ name: options.name ?? "absolute-voice-provider-slos" });
29634
29758
  app.get(path, async () => Response.json(await buildReport(), { headers }));
29635
29759
  if (markdownPath !== false) {
29636
29760
  app.get(markdownPath, async () => {
@@ -29660,10 +29784,10 @@ var createVoiceProviderSloRoutes = (options) => {
29660
29784
  return app;
29661
29785
  };
29662
29786
  // src/productionReadiness.ts
29663
- import { Elysia as Elysia54 } from "elysia";
29787
+ import { Elysia as Elysia55 } from "elysia";
29664
29788
 
29665
29789
  // src/telephony/security.ts
29666
- import { Elysia as Elysia49 } from "elysia";
29790
+ import { Elysia as Elysia50 } from "elysia";
29667
29791
 
29668
29792
  // src/postgresStore.ts
29669
29793
  var normalizeIdentifierSegment = (value) => value.trim().replace(/[^a-zA-Z0-9_]+/g, "_").replace(/^_+|_+$/g, "") || "voice";
@@ -30401,7 +30525,7 @@ var assertVoiceTelephonyWebhookSecurityEvidence = (report, input = {}) => {
30401
30525
  };
30402
30526
  var createVoiceTelephonyWebhookSecurityRoutes = (options) => {
30403
30527
  const path = options.path ?? "/api/voice/telephony/webhook-security";
30404
- return new Elysia49({
30528
+ return new Elysia50({
30405
30529
  name: options.name ?? "absolutejs-voice-telephony-webhook-security"
30406
30530
  }).get(path, () => buildVoiceTelephonyWebhookSecurityReport(options.options));
30407
30531
  };
@@ -30458,7 +30582,7 @@ var createVoiceTelephonyWebhookSecurityPreset = (options = {}) => {
30458
30582
  };
30459
30583
 
30460
30584
  // src/opsRecovery.ts
30461
- import { Elysia as Elysia50 } from "elysia";
30585
+ import { Elysia as Elysia51 } from "elysia";
30462
30586
  var escapeHtml49 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
30463
30587
  var getString15 = (value) => typeof value === "string" && value.trim() ? value.trim() : undefined;
30464
30588
  var hrefForSession = (value, sessionId) => {
@@ -30685,7 +30809,7 @@ var createVoiceOpsRecoveryRoutes = (options = {}) => {
30685
30809
  const path = options.path ?? "/api/voice/ops-recovery";
30686
30810
  const htmlPath = options.htmlPath === undefined ? "/ops-recovery" : options.htmlPath;
30687
30811
  const markdownPath = options.markdownPath === undefined ? `${path}.md` : options.markdownPath;
30688
- const routes = new Elysia50({
30812
+ const routes = new Elysia51({
30689
30813
  name: options.name ?? "absolutejs-voice-ops-recovery"
30690
30814
  }).get(path, async () => buildVoiceOpsRecoveryReport(options));
30691
30815
  if (htmlPath) {
@@ -30715,17 +30839,17 @@ var createVoiceOpsRecoveryRoutes = (options = {}) => {
30715
30839
  };
30716
30840
 
30717
30841
  // src/observabilityExport.ts
30718
- import { Elysia as Elysia53 } from "elysia";
30842
+ import { Elysia as Elysia54 } from "elysia";
30719
30843
  import { Database as Database4 } from "bun:sqlite";
30720
30844
  import { createHash } from "crypto";
30721
30845
  import { mkdir as mkdir4, readFile as readFile2, stat, unlink } from "fs/promises";
30722
30846
  import { join as join3 } from "path";
30723
30847
 
30724
30848
  // src/operationsRecord.ts
30725
- import { Elysia as Elysia52 } from "elysia";
30849
+ import { Elysia as Elysia53 } from "elysia";
30726
30850
 
30727
30851
  // src/traceTimeline.ts
30728
- import { Elysia as Elysia51 } from "elysia";
30852
+ import { Elysia as Elysia52 } from "elysia";
30729
30853
  var escapeHtml50 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
30730
30854
  var getString16 = (value) => typeof value === "string" && value.trim() ? value : undefined;
30731
30855
  var getNumber9 = (value) => typeof value === "number" && Number.isFinite(value) ? value : undefined;
@@ -30951,7 +31075,7 @@ var createVoiceTraceTimelineRoutes = (options) => {
30951
31075
  const path = options.path ?? "/api/voice-traces";
30952
31076
  const htmlPath = options.htmlPath ?? "/traces";
30953
31077
  const title = options.title ?? "AbsoluteJS Voice Trace Timelines";
30954
- const routes = new Elysia51({
31078
+ const routes = new Elysia52({
30955
31079
  name: options.name ?? "absolutejs-voice-trace-timelines"
30956
31080
  });
30957
31081
  const buildReport = async () => summarizeVoiceTraceTimeline(await options.store.list(), {
@@ -31738,7 +31862,7 @@ var createVoiceOperationsRecordRoutes = (options) => {
31738
31862
  const htmlPath = options.htmlPath === undefined ? "/voice-operations/:sessionId" : options.htmlPath;
31739
31863
  const incidentPath = options.incidentPath === undefined ? `${path}/incident.md` : options.incidentPath;
31740
31864
  const incidentHtmlPath = options.incidentHtmlPath === undefined && htmlPath ? `${htmlPath}/incident.md` : options.incidentHtmlPath;
31741
- const routes = new Elysia52({
31865
+ const routes = new Elysia53({
31742
31866
  name: options.name ?? "absolutejs-voice-operations-record"
31743
31867
  });
31744
31868
  const buildRecord = (sessionId) => buildVoiceOperationsRecord({
@@ -32389,7 +32513,7 @@ var createVoiceObservabilityExportReplayRoutes = (options) => {
32389
32513
  ...options.headers ?? {}
32390
32514
  };
32391
32515
  const buildReport = () => resolveVoiceObservabilityExportReplayReport(options.source);
32392
- const app = new Elysia53({
32516
+ const app = new Elysia54({
32393
32517
  name: options.name ?? "absolute-voice-observability-export-replay"
32394
32518
  });
32395
32519
  app.get(path, async () => Response.json(await buildReport(), { headers }));
@@ -33198,7 +33322,7 @@ var createVoiceObservabilityExportRoutes = (options = {}) => {
33198
33322
  artifactDownload: options.links?.artifactDownload ?? (artifactDownloadPath ? (artifact) => `${artifactDownloadPath}/${encodeURIComponent(artifact.id)}` : undefined)
33199
33323
  }
33200
33324
  });
33201
- const app = new Elysia53({
33325
+ const app = new Elysia54({
33202
33326
  name: options.name ?? "absolute-voice-observability-export"
33203
33327
  });
33204
33328
  app.get(path, async () => Response.json(await buildReport(), { headers }));
@@ -35208,7 +35332,7 @@ var createVoiceProductionReadinessRoutes = (options) => {
35208
35332
  const path = options.path ?? "/api/production-readiness";
35209
35333
  const gatePath = options.gatePath === undefined ? "/api/production-readiness/gate" : options.gatePath;
35210
35334
  const htmlPath = options.htmlPath ?? "/production-readiness";
35211
- const routes = new Elysia54({
35335
+ const routes = new Elysia55({
35212
35336
  name: options.name ?? "absolutejs-voice-production-readiness"
35213
35337
  });
35214
35338
  let cachedReport;
@@ -35279,7 +35403,7 @@ var createVoiceProductionReadinessRoutes = (options) => {
35279
35403
  return routes;
35280
35404
  };
35281
35405
  // src/voiceMonitoring.ts
35282
- import { Elysia as Elysia55 } from "elysia";
35406
+ import { Elysia as Elysia56 } from "elysia";
35283
35407
  var escapeHtml53 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
35284
35408
  var issueIdForRun = (run) => `voice-monitor:${run.id}:${run.impactedSessions?.[0] ?? "global"}`;
35285
35409
  var rollupStatus5 = (runs) => runs.some((run) => run.status === "fail") ? "fail" : runs.some((run) => run.status === "warn") ? "warn" : "pass";
@@ -35564,7 +35688,7 @@ var createVoiceMonitorRoutes = (options) => {
35564
35688
  monitors: options.monitors,
35565
35689
  now: options.now
35566
35690
  });
35567
- const routes = new Elysia55({
35691
+ const routes = new Elysia56({
35568
35692
  name: options.name ?? "absolutejs-voice-monitoring"
35569
35693
  }).get(path, report).get(`${path}.md`, async () => {
35570
35694
  return new Response(renderVoiceMonitorMarkdown(await report()), {
@@ -35611,7 +35735,7 @@ var createVoiceMonitorRoutes = (options) => {
35611
35735
  };
35612
35736
  var createVoiceMonitorRunnerRoutes = (options) => {
35613
35737
  const path = options.path ?? "/api/voice/monitor-runner";
35614
- return new Elysia55({
35738
+ return new Elysia56({
35615
35739
  name: options.name ?? "absolutejs-voice-monitor-runner"
35616
35740
  }).get(path, () => ({
35617
35741
  isRunning: options.runner.isRunning()
@@ -35987,7 +36111,7 @@ var recommendVoiceReadinessProfile = (options) => {
35987
36111
  };
35988
36112
  };
35989
36113
  // src/providerStackRecommendations.ts
35990
- import { Elysia as Elysia56 } from "elysia";
36114
+ import { Elysia as Elysia57 } from "elysia";
35991
36115
  var escapeHtml54 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
35992
36116
  var profileProviderPriorities = {
35993
36117
  "meeting-recorder": {
@@ -36100,12 +36224,12 @@ var recommendVoiceProviderStack = (input) => {
36100
36224
  };
36101
36225
  };
36102
36226
  var rollupContractStatus = (checks) => checks.some((check) => check.status === "fail") ? "fail" : checks.some((check) => check.status === "warn") ? "warn" : "pass";
36103
- var statusRank6 = {
36227
+ var statusRank7 = {
36104
36228
  pass: 0,
36105
36229
  warn: 1,
36106
36230
  fail: 2
36107
36231
  };
36108
- var statusExceeds2 = (actual, max2) => statusRank6[actual] > statusRank6[max2];
36232
+ var statusExceeds2 = (actual, max2) => statusRank7[actual] > statusRank7[max2];
36109
36233
  var buildVoiceProviderContractMatrix = (input) => {
36110
36234
  const rows = input.contracts.map((contract) => {
36111
36235
  const configured = contract.configured !== false;
@@ -36208,7 +36332,7 @@ var buildVoiceProviderContractMatrix = (input) => {
36208
36332
  };
36209
36333
  var evaluateVoiceProviderContractMatrixEvidence = (report, input = {}) => {
36210
36334
  const issues = [];
36211
- const maxStatus = input.maxStatus ?? "pass";
36335
+ const maxStatus2 = input.maxStatus ?? "pass";
36212
36336
  const maxFailed = input.maxFailed ?? 0;
36213
36337
  const maxWarned = input.maxWarned ?? 0;
36214
36338
  const minRows = input.minRows ?? 1;
@@ -36218,8 +36342,8 @@ var evaluateVoiceProviderContractMatrixEvidence = (report, input = {}) => {
36218
36342
  const selectedKinds = [
36219
36343
  ...new Set(report.rows.filter((row) => row.selected).map((row) => row.kind))
36220
36344
  ].sort();
36221
- if (statusExceeds2(report.status, maxStatus)) {
36222
- issues.push(`Expected provider contract matrix status at most ${maxStatus}, found ${report.status}.`);
36345
+ if (statusExceeds2(report.status, maxStatus2)) {
36346
+ issues.push(`Expected provider contract matrix status at most ${maxStatus2}, found ${report.status}.`);
36223
36347
  }
36224
36348
  if (report.failed > maxFailed) {
36225
36349
  issues.push(`Expected at most ${String(maxFailed)} failing provider contract row(s), found ${String(report.failed)}.`);
@@ -36353,7 +36477,7 @@ var createVoiceProviderContractMatrixHTMLHandler = (options) => async () => {
36353
36477
  var createVoiceProviderContractMatrixRoutes = (options) => {
36354
36478
  const path = options.path ?? "/api/provider-contracts";
36355
36479
  const htmlPath = options.htmlPath ?? "/provider-contracts";
36356
- const routes = new Elysia56({
36480
+ const routes = new Elysia57({
36357
36481
  name: options.name ?? "absolutejs-voice-provider-contract-matrix"
36358
36482
  });
36359
36483
  const jsonHandler = createVoiceProviderContractMatrixJSONHandler(options.matrix);
@@ -36413,15 +36537,15 @@ var evaluateVoiceProviderStackGaps = (input) => {
36413
36537
  };
36414
36538
  var evaluateVoiceProviderStackEvidence = (report, input = {}) => {
36415
36539
  const issues = [];
36416
- const maxStatus = input.maxStatus ?? "pass";
36540
+ const maxStatus2 = input.maxStatus ?? "pass";
36417
36541
  const maxMissing = input.maxMissing ?? 0;
36418
36542
  const requireProviders = input.requireProviders ?? true;
36419
36543
  const kinds = [...new Set(report.gaps.map((gap) => gap.kind))].sort();
36420
36544
  const providers = [
36421
36545
  ...new Set(report.gaps.map((gap) => gap.provider).filter((provider) => provider !== undefined))
36422
36546
  ].sort();
36423
- if (statusExceeds2(report.status, maxStatus)) {
36424
- issues.push(`Expected provider stack status at most ${maxStatus}, found ${report.status}.`);
36547
+ if (statusExceeds2(report.status, maxStatus2)) {
36548
+ issues.push(`Expected provider stack status at most ${maxStatus2}, found ${report.status}.`);
36425
36549
  }
36426
36550
  if (report.missing > maxMissing) {
36427
36551
  issues.push(`Expected at most ${String(maxMissing)} missing provider stack capability/capabilities, found ${String(report.missing)}.`);
@@ -36471,7 +36595,7 @@ var assertVoiceProviderStackEvidence = (report, input = {}) => {
36471
36595
  return assertion;
36472
36596
  };
36473
36597
  // src/opsConsoleRoutes.ts
36474
- import { Elysia as Elysia57 } from "elysia";
36598
+ import { Elysia as Elysia58 } from "elysia";
36475
36599
  var DEFAULT_LINKS = [
36476
36600
  {
36477
36601
  description: "Quality gates for CI, deploy checks, and production readiness.",
@@ -36588,7 +36712,7 @@ var renderVoiceOpsConsoleHTML = (report, options = {}) => {
36588
36712
  };
36589
36713
  var createVoiceOpsConsoleRoutes = (options) => {
36590
36714
  const path = options.path ?? "/ops-console";
36591
- const routes = new Elysia57({
36715
+ const routes = new Elysia58({
36592
36716
  name: options.name ?? "absolutejs-voice-ops-console"
36593
36717
  });
36594
36718
  const getReport = () => buildVoiceOpsConsoleReport(options);
@@ -36605,7 +36729,7 @@ var createVoiceOpsConsoleRoutes = (options) => {
36605
36729
  return routes;
36606
36730
  };
36607
36731
  // src/incidentBundle.ts
36608
- import { Elysia as Elysia58 } from "elysia";
36732
+ import { Elysia as Elysia59 } from "elysia";
36609
36733
  var filterIncidentBundleArtifacts = (artifacts, filter = {}) => artifacts.filter((artifact) => {
36610
36734
  if (filter.sessionId && artifact.sessionId !== filter.sessionId) {
36611
36735
  return false;
@@ -36806,7 +36930,7 @@ var buildVoiceIncidentBundle = async (options) => {
36806
36930
  var createVoiceIncidentBundleRoutes = (options) => {
36807
36931
  const path = options.path ?? "/api/voice-incidents/:sessionId";
36808
36932
  const markdownPath = options.markdownPath === undefined ? "/voice-incidents/:sessionId/markdown" : options.markdownPath;
36809
- const routes = new Elysia58({
36933
+ const routes = new Elysia59({
36810
36934
  name: options.name ?? "absolutejs-voice-incident-bundle"
36811
36935
  });
36812
36936
  const getSessionId = (params) => params.sessionId ?? "";
@@ -37007,7 +37131,7 @@ var summarizeVoiceOpsStatus = async (options) => {
37007
37131
  };
37008
37132
  };
37009
37133
  // src/opsStatusRoutes.ts
37010
- import { Elysia as Elysia59 } from "elysia";
37134
+ import { Elysia as Elysia60 } from "elysia";
37011
37135
  var escapeHtml56 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
37012
37136
  var renderVoiceOpsStatusHTML = (report, options = {}) => {
37013
37137
  const title = options.title ?? "AbsoluteJS Voice Ops Status";
@@ -37019,7 +37143,7 @@ var renderVoiceOpsStatusHTML = (report, options = {}) => {
37019
37143
  };
37020
37144
  var createVoiceOpsStatusRoutes = (options) => {
37021
37145
  const path = options.path ?? "/api/voice/ops-status";
37022
- const routes = new Elysia59({
37146
+ const routes = new Elysia60({
37023
37147
  name: options.name ?? "absolutejs-voice-ops-status"
37024
37148
  });
37025
37149
  routes.get(path, async () => summarizeVoiceOpsStatus(options));
@@ -37452,7 +37576,7 @@ var createVoiceTTSProviderRouter = (options) => {
37452
37576
  };
37453
37577
  };
37454
37578
  // src/traceDeliveryRoutes.ts
37455
- import { Elysia as Elysia60 } from "elysia";
37579
+ import { Elysia as Elysia61 } from "elysia";
37456
37580
  var escapeHtml57 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
37457
37581
  var getString20 = (value) => typeof value === "string" && value.trim() ? value.trim() : undefined;
37458
37582
  var getNumber12 = (value) => {
@@ -37561,7 +37685,7 @@ var createVoiceTraceDeliveryRoutes = (options) => {
37561
37685
  const path = options.path ?? "/api/voice-trace-deliveries";
37562
37686
  const htmlPath = options.htmlPath === undefined ? "/traces/deliveries" : options.htmlPath;
37563
37687
  const workerPath = options.workerPath === undefined ? `${path}/drain` : options.workerPath;
37564
- const routes = new Elysia60({
37688
+ const routes = new Elysia61({
37565
37689
  name: options.name ?? "absolutejs-voice-trace-deliveries"
37566
37690
  }).get(path, createVoiceTraceDeliveryJSONHandler(options));
37567
37691
  if (htmlPath !== false) {
@@ -37658,7 +37782,7 @@ var createVoiceMemoryStore = () => {
37658
37782
  return { get, getOrCreate, list, remove, set };
37659
37783
  };
37660
37784
  // src/opsWebhook.ts
37661
- import { Elysia as Elysia61 } from "elysia";
37785
+ import { Elysia as Elysia62 } from "elysia";
37662
37786
  var toHex6 = (bytes) => Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
37663
37787
  var signVoiceOpsWebhookBody = async (input) => {
37664
37788
  const encoder2 = new TextEncoder;
@@ -37788,7 +37912,7 @@ var verifyVoiceOpsWebhookSignature = async (input) => {
37788
37912
  };
37789
37913
  var createVoiceOpsWebhookReceiverRoutes = (options = {}) => {
37790
37914
  const path = options.path ?? "/api/voice-ops/webhook";
37791
- return new Elysia61().post(path, async ({ body, request, set }) => {
37915
+ return new Elysia62().post(path, async ({ body, request, set }) => {
37792
37916
  const bodyText = typeof body === "string" ? body : JSON.stringify(body);
37793
37917
  if (options.signingSecret) {
37794
37918
  const verification = await verifyVoiceOpsWebhookSignature({
@@ -38243,7 +38367,7 @@ var resolveVoiceOpsPreset = (name, overrides = {}) => {
38243
38367
  };
38244
38368
  };
38245
38369
  // src/postCallAnalysis.ts
38246
- import { Elysia as Elysia62 } from "elysia";
38370
+ import { Elysia as Elysia63 } from "elysia";
38247
38371
  var isStore = (value) => Boolean(value) && typeof value === "object" && value !== null && ("list" in value);
38248
38372
  var asArray = async (value) => Array.isArray(value) ? value : isStore(value) ? await value.list() : [];
38249
38373
  var getPathValue3 = (source, path) => {
@@ -38422,7 +38546,7 @@ var resolvePostCallAnalysisReport = async (options, input) => {
38422
38546
  };
38423
38547
  var createVoicePostCallAnalysisRoutes = (options = {}) => {
38424
38548
  const path = options.path ?? "/api/voice/post-call-analysis";
38425
- const routes = new Elysia62({
38549
+ const routes = new Elysia63({
38426
38550
  name: options.name ?? "absolutejs-voice-post-call-analysis"
38427
38551
  });
38428
38552
  routes.get(path, async ({ query }) => {
@@ -38447,7 +38571,7 @@ var createVoicePostCallAnalysisRoutes = (options = {}) => {
38447
38571
  return routes;
38448
38572
  };
38449
38573
  // src/guardrails.ts
38450
- import { Elysia as Elysia63 } from "elysia";
38574
+ import { Elysia as Elysia64 } from "elysia";
38451
38575
  var stringifyContent = (value) => typeof value === "string" ? value : JSON.stringify(value) ?? "";
38452
38576
  var appliesToStage = (rule, stage) => !rule.stages || rule.stages.length === 0 || rule.stages.includes(stage);
38453
38577
  var matchesRule = async (rule, input) => {
@@ -38749,7 +38873,7 @@ var resolveGuardrailReport = async (options, input) => {
38749
38873
  };
38750
38874
  var createVoiceGuardrailRoutes = (options = {}) => {
38751
38875
  const path = options.path ?? "/api/voice/guardrails";
38752
- const routes = new Elysia63({
38876
+ const routes = new Elysia64({
38753
38877
  name: options.name ?? "absolutejs-voice-guardrails"
38754
38878
  });
38755
38879
  routes.all(path, async ({ request }) => {
@@ -39733,6 +39857,7 @@ export {
39733
39857
  pruneVoiceTraceEvents,
39734
39858
  pruneVoiceIncidentBundleArtifacts,
39735
39859
  parseVoiceTelephonyWebhookEvent,
39860
+ parseVoiceSessionSnapshot,
39736
39861
  normalizeVoiceProofTrendReport,
39737
39862
  muteVoiceMonitorIssue,
39738
39863
  matchesVoiceOpsTaskAssignmentRule,
@@ -39866,6 +39991,7 @@ export {
39866
39991
  createVoiceSimulationSuiteRoutes,
39867
39992
  createVoiceSessionsJSONHandler,
39868
39993
  createVoiceSessionsHTMLHandler,
39994
+ createVoiceSessionSnapshotRoutes,
39869
39995
  createVoiceSessionReplayRoutes,
39870
39996
  createVoiceSessionReplayJSONHandler,
39871
39997
  createVoiceSessionReplayHTMLHandler,
@@ -40123,6 +40249,8 @@ export {
40123
40249
  buildVoiceTelephonyMediaReport,
40124
40250
  buildVoiceSloReadinessThresholdReport,
40125
40251
  buildVoiceSloCalibrationReport,
40252
+ buildVoiceSessionSnapshotStatus,
40253
+ buildVoiceSessionSnapshot,
40126
40254
  buildVoiceRealtimeProviderContractMatrix,
40127
40255
  buildVoiceRealtimeChannelRuntimeSamplesFromTrace,
40128
40256
  buildVoiceRealtimeChannelReport,
@@ -0,0 +1,98 @@
1
+ import { Elysia } from 'elysia';
2
+ import type { MediaProcessorGraphSnapshot } from '@absolutejs/media';
3
+ import type { VoiceProofAssertionResult, VoiceProofAssertionSummary } from './proofAssertions';
4
+ import type { VoiceCampaignTelephonyOutcomeSnapshot } from './campaign';
5
+ import type { StoredVoiceTraceEvent } from './trace';
6
+ export type VoiceSessionSnapshotStatus = 'fail' | 'pass' | 'warn';
7
+ export type VoiceSessionSnapshotQualityEvidence = {
8
+ name: string;
9
+ report: unknown;
10
+ status?: VoiceSessionSnapshotStatus;
11
+ };
12
+ export type VoiceSessionSnapshot = {
13
+ capturedAt: number;
14
+ media: readonly MediaProcessorGraphSnapshot[];
15
+ name?: string;
16
+ proofAssertions: readonly VoiceProofAssertionResult[];
17
+ proofSummary: VoiceProofAssertionSummary;
18
+ providerRoutingEvents: readonly StoredVoiceTraceEvent[];
19
+ quality: readonly VoiceSessionSnapshotQualityEvidence[];
20
+ scenarioId?: string;
21
+ schema: 'absolute.voice.session.snapshot.v1';
22
+ sessionId: string;
23
+ status: VoiceSessionSnapshotStatus;
24
+ telephonyOutcomes: readonly VoiceCampaignTelephonyOutcomeSnapshot[];
25
+ turnId?: string;
26
+ };
27
+ export type VoiceSessionSnapshotInput = {
28
+ media?: readonly MediaProcessorGraphSnapshot[];
29
+ name?: string;
30
+ proofAssertions?: readonly VoiceProofAssertionResult[];
31
+ providerRoutingEvents?: readonly StoredVoiceTraceEvent[];
32
+ quality?: readonly VoiceSessionSnapshotQualityEvidence[];
33
+ scenarioId?: string;
34
+ sessionId: string;
35
+ telephonyOutcomes?: readonly VoiceCampaignTelephonyOutcomeSnapshot[];
36
+ turnId?: string;
37
+ };
38
+ export type VoiceSessionSnapshotRouteSourceInput = {
39
+ request: Request;
40
+ sessionId: string;
41
+ turnId?: string;
42
+ };
43
+ export type VoiceSessionSnapshotRouteSource = VoiceSessionSnapshot | VoiceSessionSnapshotInput | ((input: VoiceSessionSnapshotRouteSourceInput) => Promise<VoiceSessionSnapshot | VoiceSessionSnapshotInput> | VoiceSessionSnapshot | VoiceSessionSnapshotInput);
44
+ export type VoiceSessionSnapshotRoutesOptions = Partial<VoiceSessionSnapshotInput> & {
45
+ downloadPath?: false | string;
46
+ headers?: HeadersInit;
47
+ name?: string;
48
+ path?: string;
49
+ source?: VoiceSessionSnapshotRouteSource;
50
+ };
51
+ export declare const buildVoiceSessionSnapshotStatus: (input: {
52
+ media?: readonly Pick<MediaProcessorGraphSnapshot, "report">[];
53
+ proofSummary?: Pick<VoiceProofAssertionSummary, "ok">;
54
+ quality?: readonly Pick<VoiceSessionSnapshotQualityEvidence, "status">[];
55
+ telephonyOutcomes?: readonly Pick<VoiceCampaignTelephonyOutcomeSnapshot, "campaignOutcome" | "duplicate">[];
56
+ }) => VoiceSessionSnapshotStatus;
57
+ export declare const buildVoiceSessionSnapshot: (input: VoiceSessionSnapshotInput) => VoiceSessionSnapshot;
58
+ export declare const parseVoiceSessionSnapshot: (snapshot: VoiceSessionSnapshot) => VoiceSessionSnapshot;
59
+ export declare const createVoiceSessionSnapshotRoutes: (options?: VoiceSessionSnapshotRoutesOptions) => Elysia<"", {
60
+ decorator: {};
61
+ store: {};
62
+ derive: {};
63
+ resolve: {};
64
+ }, {
65
+ typebox: {};
66
+ error: {};
67
+ }, {
68
+ schema: {};
69
+ standaloneSchema: {};
70
+ macro: {};
71
+ macroFn: {};
72
+ parser: {};
73
+ response: {};
74
+ }, {
75
+ [x: string]: {
76
+ get: {
77
+ body: unknown;
78
+ params: {};
79
+ query: unknown;
80
+ headers: unknown;
81
+ response: {
82
+ 200: Response;
83
+ };
84
+ };
85
+ };
86
+ }, {
87
+ derive: {};
88
+ resolve: {};
89
+ schema: {};
90
+ standaloneSchema: {};
91
+ response: {};
92
+ }, {
93
+ derive: {};
94
+ resolve: {};
95
+ schema: {};
96
+ standaloneSchema: {};
97
+ response: {};
98
+ }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.396",
3
+ "version": "0.0.22-beta.398",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",
@@ -246,7 +246,7 @@
246
246
  }
247
247
  },
248
248
  "dependencies": {
249
- "@absolutejs/media": "0.0.1-beta.7"
249
+ "@absolutejs/media": "0.0.1-beta.14"
250
250
  },
251
251
  "devDependencies": {
252
252
  "@absolutejs/absolute": "0.19.0-beta.646",