@absolutejs/voice 0.0.22-beta.280 → 0.0.22-beta.281

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
@@ -18,6 +18,8 @@ export { assertVoicePlatformCoverage, buildVoicePlatformCoverageSummary, createV
18
18
  export type { VoicePlatformCoverageAssertionInput, VoicePlatformCoverageAssertionReport, VoicePlatformCoverageEvidence, VoicePlatformCoverageRoutesOptions, VoicePlatformCoverageStatus, VoicePlatformCoverageSummary, VoicePlatformCoverageSummaryInput, VoicePlatformCoverageSurface } from './platformCoverage';
19
19
  export { assertVoiceProofTrendEvidence, buildEmptyVoiceProofTrendReport, buildVoiceProofTrendReport, createVoiceProofTrendRoutes, DEFAULT_VOICE_PROOF_TRENDS_MAX_AGE_MS, evaluateVoiceProofTrendEvidence, formatVoiceProofTrendAge, normalizeVoiceProofTrendReport, readVoiceProofTrendReportFile } from './proofTrends';
20
20
  export type { VoiceProofTrendAssertionInput, VoiceProofTrendAssertionReport, VoiceProofTrendCycle, VoiceProofTrendReport, VoiceProofTrendReportInput, VoiceProofTrendRoutesOptions, VoiceProofTrendStatus, VoiceProofTrendSummary } from './proofTrends';
21
+ export { assertVoiceSloCalibration, buildVoiceSloCalibrationReport, createVoiceSloCalibrationRoutes, renderVoiceSloCalibrationMarkdown } from './sloCalibration';
22
+ export type { VoiceSloCalibrationMetricKey, VoiceSloCalibrationOptions, VoiceSloCalibrationReport, VoiceSloCalibrationRoutesOptions, VoiceSloCalibrationSample, VoiceSloCalibrationStatus, VoiceSloCalibrationThreshold, VoiceSloCalibrationThresholds } from './sloCalibration';
21
23
  export { assertVoiceLiveOpsControlEvidence, assertVoiceLiveOpsEvidence, buildVoiceLiveOpsControlState, createVoiceLiveOpsController, createVoiceLiveOpsRoutes, createVoiceMemoryLiveOpsControlStore, evaluateVoiceLiveOpsControlEvidence, evaluateVoiceLiveOpsEvidence, getVoiceLiveOpsControlStatus, VOICE_LIVE_OPS_ACTIONS } from './liveOps';
22
24
  export type { VoiceLiveOpsAction, VoiceLiveOpsActionInput, VoiceLiveOpsActionResult, VoiceLiveOpsControllerOptions, VoiceLiveOpsControlState, VoiceLiveOpsControlStatus, VoiceLiveOpsControlStore, VoiceLiveOpsControlEvidenceInput, VoiceLiveOpsControlEvidenceReport, VoiceLiveOpsEvidenceInput, VoiceLiveOpsEvidenceReport, VoiceLiveOpsRoutesOptions } from './liveOps';
23
25
  export { buildVoiceDeliveryRuntimeReport, createVoiceDeliveryRuntime, createVoiceDeliveryRuntimePresetConfig, createVoiceDeliveryRuntimeRoutes, renderVoiceDeliveryRuntimeHTML } from './deliveryRuntime';
package/dist/index.js CHANGED
@@ -12621,8 +12621,183 @@ var formatVoiceProofTrendAge = (ageMs) => {
12621
12621
  const days = Math.floor(hours / 24);
12622
12622
  return `${days}d ${hours % 24}h`;
12623
12623
  };
12624
- // src/liveOps.ts
12624
+ // src/sloCalibration.ts
12625
12625
  import { Elysia as Elysia15 } from "elysia";
12626
+ var DEFAULT_HEADROOM_MULTIPLIER = 1.5;
12627
+ var DEFAULT_WARN_RATIO = 0.8;
12628
+ var DEFAULT_MIN_PASSING_RUNS = 3;
12629
+ var roundMs = (value) => Math.max(1, Math.ceil(value));
12630
+ var finiteNumber = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0;
12631
+ var percentile = (values, rank) => {
12632
+ if (values.length === 0) {
12633
+ return;
12634
+ }
12635
+ const sorted = [...values].sort((left, right) => left - right);
12636
+ const index = Math.min(sorted.length - 1, Math.max(0, Math.ceil(rank / 100 * sorted.length) - 1));
12637
+ return sorted[index];
12638
+ };
12639
+ var normalizeSample = (input) => {
12640
+ if ("summary" in input) {
12641
+ return {
12642
+ generatedAt: input.generatedAt,
12643
+ liveP95Ms: input.summary.maxLiveP95Ms,
12644
+ ok: input.ok,
12645
+ providerP95Ms: input.summary.maxProviderP95Ms,
12646
+ runId: input.runId,
12647
+ source: input.source || input.outputDir,
12648
+ turnP95Ms: input.summary.maxTurnP95Ms
12649
+ };
12650
+ }
12651
+ return input;
12652
+ };
12653
+ var createThreshold = (metric, values, options) => {
12654
+ const baselineP95Ms = percentile(values, 95);
12655
+ const maxObservedMs = values.length > 0 ? Math.max(...values) : undefined;
12656
+ const recommendedMs = baselineP95Ms === undefined ? undefined : roundMs(Math.max(options.minimumMs, baselineP95Ms * options.headroomMultiplier));
12657
+ const warnAfterMs = recommendedMs === undefined ? undefined : roundMs(Math.max(options.minimumMs, recommendedMs * options.warnRatio));
12658
+ return {
12659
+ baselineP95Ms,
12660
+ failAfterMs: recommendedMs,
12661
+ headroomMultiplier: options.headroomMultiplier,
12662
+ maxObservedMs,
12663
+ metric,
12664
+ minimumMs: options.minimumMs,
12665
+ recommendedMs,
12666
+ samples: values.length,
12667
+ status: values.length > 0 ? "pass" : "warn",
12668
+ warnAfterMs
12669
+ };
12670
+ };
12671
+ var buildVoiceSloCalibrationReport = (input, options = {}) => {
12672
+ const headroomMultiplier = finiteNumber(options.headroomMultiplier) && options.headroomMultiplier >= 1 ? options.headroomMultiplier : DEFAULT_HEADROOM_MULTIPLIER;
12673
+ const warnRatio = finiteNumber(options.warnRatio) && options.warnRatio > 0 && options.warnRatio < 1 ? options.warnRatio : DEFAULT_WARN_RATIO;
12674
+ const minPassingRuns = Math.max(1, Math.floor(options.minPassingRuns ?? DEFAULT_MIN_PASSING_RUNS));
12675
+ const samples = input.map(normalizeSample);
12676
+ const passingSamples = samples.filter((sample) => sample.ok === true);
12677
+ const issues = [];
12678
+ if (passingSamples.length < minPassingRuns) {
12679
+ issues.push(`Expected at least ${String(minPassingRuns)} passing SLO calibration run(s), found ${String(passingSamples.length)}.`);
12680
+ }
12681
+ const valuesFor = (key) => passingSamples.map((sample) => sample[key]).filter((value) => finiteNumber(value));
12682
+ const thresholds = {
12683
+ interruption: createThreshold("interruption", valuesFor("interruptionP95Ms"), {
12684
+ headroomMultiplier,
12685
+ minimumMs: options.interruptionMinimumMs ?? 250,
12686
+ warnRatio
12687
+ }),
12688
+ liveLatency: createThreshold("liveLatency", valuesFor("liveP95Ms"), {
12689
+ headroomMultiplier,
12690
+ minimumMs: options.liveLatencyMinimumMs ?? 600,
12691
+ warnRatio
12692
+ }),
12693
+ monitorRun: createThreshold("monitorRun", valuesFor("monitorRunP95Ms"), {
12694
+ headroomMultiplier,
12695
+ minimumMs: options.monitorRunMinimumMs ?? 1000,
12696
+ warnRatio
12697
+ }),
12698
+ notifierDelivery: createThreshold("notifierDelivery", valuesFor("notifierDeliveryP95Ms"), {
12699
+ headroomMultiplier,
12700
+ minimumMs: options.notifierDeliveryMinimumMs ?? 2000,
12701
+ warnRatio
12702
+ }),
12703
+ provider: createThreshold("provider", valuesFor("providerP95Ms"), {
12704
+ headroomMultiplier,
12705
+ minimumMs: options.providerMinimumMs ?? 1000,
12706
+ warnRatio
12707
+ }),
12708
+ reconnect: createThreshold("reconnect", valuesFor("reconnectP95Ms"), {
12709
+ headroomMultiplier,
12710
+ minimumMs: options.reconnectMinimumMs ?? 1500,
12711
+ warnRatio
12712
+ }),
12713
+ turnLatency: createThreshold("turnLatency", valuesFor("turnP95Ms"), {
12714
+ headroomMultiplier,
12715
+ minimumMs: options.turnLatencyMinimumMs ?? 250,
12716
+ warnRatio
12717
+ })
12718
+ };
12719
+ for (const threshold of Object.values(thresholds)) {
12720
+ if (threshold.status !== "pass") {
12721
+ issues.push(`Missing ${threshold.metric} samples for SLO threshold calibration.`);
12722
+ }
12723
+ }
12724
+ const providerP95 = thresholds.provider.recommendedMs;
12725
+ const recommendedProviderSloThresholds = providerP95 === undefined ? {} : {
12726
+ llm: { maxP95ElapsedMs: providerP95 },
12727
+ stt: { maxP95ElapsedMs: providerP95 },
12728
+ tts: { maxP95ElapsedMs: providerP95 }
12729
+ };
12730
+ const blockingIssues = issues.filter((issue) => !issue.startsWith("Missing interruption") && !issue.startsWith("Missing monitorRun") && !issue.startsWith("Missing notifierDelivery") && !issue.startsWith("Missing reconnect"));
12731
+ const ok = blockingIssues.length === 0;
12732
+ return {
12733
+ generatedAt: new Date().toISOString(),
12734
+ issues,
12735
+ minPassingRuns,
12736
+ ok,
12737
+ passingRuns: passingSamples.length,
12738
+ recommendedProviderSloThresholds,
12739
+ runs: samples.length,
12740
+ sources: [
12741
+ ...new Set(samples.map((sample) => sample.source || sample.runId).filter((value) => typeof value === "string"))
12742
+ ],
12743
+ status: ok ? issues.length > 0 ? "warn" : "pass" : "fail",
12744
+ thresholds
12745
+ };
12746
+ };
12747
+ var assertVoiceSloCalibration = (input, options = {}) => {
12748
+ const report = buildVoiceSloCalibrationReport(input, options);
12749
+ if (!report.ok) {
12750
+ throw new Error(`Voice SLO calibration failed: ${report.issues.join(" ")}`);
12751
+ }
12752
+ return report;
12753
+ };
12754
+ var escapeMarkdown = (value) => value.replaceAll("|", "\\|");
12755
+ var renderVoiceSloCalibrationMarkdown = (report, options = {}) => {
12756
+ const rows = Object.values(report.thresholds).map((threshold) => `| ${escapeMarkdown(threshold.metric)} | ${threshold.status} | ${threshold.samples} | ${threshold.baselineP95Ms ?? "n/a"} | ${threshold.warnAfterMs ?? "n/a"} | ${threshold.failAfterMs ?? "n/a"} |`).join(`
12757
+ `);
12758
+ return `# ${options.title ?? "Voice SLO Calibration"}
12759
+
12760
+ Generated: ${report.generatedAt}
12761
+
12762
+ Status: **${report.status}**
12763
+
12764
+ Passing runs: ${report.passingRuns}/${report.runs}
12765
+
12766
+ | Metric | Status | Samples | Baseline p95 | Warn after | Fail after |
12767
+ | --- | --- | ---: | ---: | ---: | ---: |
12768
+ ${rows}
12769
+
12770
+ Issues:
12771
+
12772
+ ${report.issues.map((issue) => `- ${issue}`).join(`
12773
+ `) || "- None"}
12774
+ `;
12775
+ };
12776
+ var createVoiceSloCalibrationRoutes = (options) => {
12777
+ const path = options.path ?? "/api/voice/slo-calibration";
12778
+ const markdownPath = options.markdownPath === undefined ? "/voice/slo-calibration.md" : options.markdownPath;
12779
+ const routes = new Elysia15({
12780
+ name: options.name ?? "absolutejs-voice-slo-calibration"
12781
+ });
12782
+ const loadReport = async () => buildVoiceSloCalibrationReport(typeof options.source === "function" ? await options.source() : options.source, options);
12783
+ routes.get(path, async () => Response.json(await loadReport(), { headers: options.headers }));
12784
+ if (markdownPath !== false) {
12785
+ routes.get(markdownPath, async () => {
12786
+ const report = await loadReport();
12787
+ return new Response(renderVoiceSloCalibrationMarkdown(report, {
12788
+ title: options.title
12789
+ }), {
12790
+ headers: {
12791
+ "content-type": "text/markdown; charset=utf-8",
12792
+ ...Object.fromEntries(new Headers(options.headers))
12793
+ }
12794
+ });
12795
+ });
12796
+ }
12797
+ return routes;
12798
+ };
12799
+ // src/liveOps.ts
12800
+ import { Elysia as Elysia16 } from "elysia";
12626
12801
  var VOICE_LIVE_OPS_ACTIONS = [
12627
12802
  "assign",
12628
12803
  "create-task",
@@ -12932,7 +13107,7 @@ var createVoiceLiveOpsRoutes = (options = {}) => {
12932
13107
  const controller = createVoiceLiveOpsController(options);
12933
13108
  const path = options.path ?? "/api/voice/live-ops/action";
12934
13109
  const controlPath = options.controlPath ?? "/api/voice/live-ops/control/:sessionId";
12935
- return new Elysia15({
13110
+ return new Elysia16({
12936
13111
  name: options.name ?? "absolutejs-voice-live-ops"
12937
13112
  }).post(path, async ({ request, set }) => {
12938
13113
  try {
@@ -12954,7 +13129,7 @@ var createVoiceLiveOpsRoutes = (options = {}) => {
12954
13129
  });
12955
13130
  };
12956
13131
  // src/deliveryRuntime.ts
12957
- import { Elysia as Elysia16 } from "elysia";
13132
+ import { Elysia as Elysia17 } from "elysia";
12958
13133
  import { mkdir } from "fs/promises";
12959
13134
  import { dirname, join } from "path";
12960
13135
  var escapeHtml16 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
@@ -13208,7 +13383,7 @@ var createVoiceDeliveryRuntimeRoutes = (options) => {
13208
13383
  const htmlPath = options.htmlPath === undefined ? "/delivery-runtime" : options.htmlPath;
13209
13384
  const tickPath = options.tickPath === undefined ? "/api/voice-delivery-runtime/tick" : options.tickPath;
13210
13385
  const requeueDeadLettersPath = options.requeueDeadLettersPath === undefined ? "/api/voice-delivery-runtime/requeue-dead-letters" : options.requeueDeadLettersPath;
13211
- const routes = new Elysia16({
13386
+ const routes = new Elysia17({
13212
13387
  name: options.name ?? "absolutejs-voice-delivery-runtime"
13213
13388
  }).get(path, () => buildVoiceDeliveryRuntimeReport(options.runtime));
13214
13389
  if (tickPath !== false) {
@@ -13244,7 +13419,7 @@ var createVoiceDeliveryRuntimeRoutes = (options) => {
13244
13419
  return routes;
13245
13420
  };
13246
13421
  // src/dataControl.ts
13247
- import { Elysia as Elysia17 } from "elysia";
13422
+ import { Elysia as Elysia18 } from "elysia";
13248
13423
  var voiceComplianceRedactionDefaults = {
13249
13424
  keys: [
13250
13425
  "apiKey",
@@ -13783,7 +13958,7 @@ var parseRetentionPolicyBody = (body, options, dryRun) => {
13783
13958
  var createVoiceDataControlRoutes = (options) => {
13784
13959
  const path = options.path ?? "/data-control";
13785
13960
  const title = options.title ?? "AbsoluteJS Voice Data Control";
13786
- const routes = new Elysia17({
13961
+ const routes = new Elysia18({
13787
13962
  name: options.name ?? "absolutejs-voice-data-control"
13788
13963
  });
13789
13964
  routes.get(path, async ({ query }) => {
@@ -13859,15 +14034,15 @@ var createVoiceDataControlRoutes = (options) => {
13859
14034
  return routes;
13860
14035
  };
13861
14036
  // src/evalRoutes.ts
13862
- import { Elysia as Elysia20 } from "elysia";
14037
+ import { Elysia as Elysia21 } from "elysia";
13863
14038
  import { mkdir as mkdir2 } from "fs/promises";
13864
14039
  import { dirname as dirname2 } from "path";
13865
14040
 
13866
14041
  // src/qualityRoutes.ts
13867
- import { Elysia as Elysia19 } from "elysia";
14042
+ import { Elysia as Elysia20 } from "elysia";
13868
14043
 
13869
14044
  // src/handoffHealth.ts
13870
- import { Elysia as Elysia18 } from "elysia";
14045
+ import { Elysia as Elysia19 } from "elysia";
13871
14046
  var escapeHtml18 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
13872
14047
  var getString7 = (value) => typeof value === "string" && value.length > 0 ? value : undefined;
13873
14048
  var isStatus = (value) => value === "delivered" || value === "failed" || value === "skipped";
@@ -14050,7 +14225,7 @@ var createVoiceHandoffHealthHTMLHandler = (options = {}) => async ({ query }) =>
14050
14225
  var createVoiceHandoffHealthRoutes = (options = {}) => {
14051
14226
  const path = options.path ?? "/api/voice-handoffs";
14052
14227
  const htmlPath = options.htmlPath === undefined ? `${path}/htmx` : options.htmlPath;
14053
- const routes = new Elysia18({
14228
+ const routes = new Elysia19({
14054
14229
  name: options.name ?? "absolutejs-voice-handoff-health"
14055
14230
  }).get(path, createVoiceHandoffHealthJSONHandler(options));
14056
14231
  if (htmlPath) {
@@ -14181,7 +14356,7 @@ var renderVoiceQualityHTML = (report, options = {}) => {
14181
14356
  };
14182
14357
  var createVoiceQualityRoutes = (options) => {
14183
14358
  const path = options.path ?? "/quality";
14184
- const routes = new Elysia19({
14359
+ const routes = new Elysia20({
14185
14360
  name: options.name ?? "absolutejs-voice-quality"
14186
14361
  });
14187
14362
  const getReport = () => evaluateVoiceQuality({
@@ -14594,7 +14769,7 @@ var renderVoiceScenarioFixtureEvalHTML = (report, options = {}) => {
14594
14769
  };
14595
14770
  var createVoiceEvalRoutes = (options) => {
14596
14771
  const path = options.path ?? "/evals";
14597
- const routes = new Elysia20({
14772
+ const routes = new Elysia21({
14598
14773
  name: options.name ?? "absolutejs-voice-evals"
14599
14774
  });
14600
14775
  const getReport = () => runVoiceSessionEvals({
@@ -14731,10 +14906,10 @@ var createVoiceEvalRoutes = (options) => {
14731
14906
  return routes;
14732
14907
  };
14733
14908
  // src/simulationSuite.ts
14734
- import { Elysia as Elysia23 } from "elysia";
14909
+ import { Elysia as Elysia24 } from "elysia";
14735
14910
 
14736
14911
  // src/outcomeContract.ts
14737
- import { Elysia as Elysia21 } from "elysia";
14912
+ import { Elysia as Elysia22 } from "elysia";
14738
14913
  var escapeHtml21 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
14739
14914
  var resolveSessionHref2 = (value, sessionId) => {
14740
14915
  if (value === false) {
@@ -14983,7 +15158,7 @@ var createVoiceOutcomeContractHTMLHandler = (options) => async () => {
14983
15158
  var createVoiceOutcomeContractRoutes = (options) => {
14984
15159
  const path = options.path ?? "/api/outcome-contracts";
14985
15160
  const htmlPath = options.htmlPath === undefined ? `${path}/htmx` : options.htmlPath;
14986
- const routes = new Elysia21({
15161
+ const routes = new Elysia22({
14987
15162
  name: options.name ?? "absolutejs-voice-outcome-contracts"
14988
15163
  }).get(path, createVoiceOutcomeContractJSONHandler(options));
14989
15164
  if (htmlPath) {
@@ -14993,7 +15168,7 @@ var createVoiceOutcomeContractRoutes = (options) => {
14993
15168
  };
14994
15169
 
14995
15170
  // src/toolContract.ts
14996
- import { Elysia as Elysia22 } from "elysia";
15171
+ import { Elysia as Elysia23 } from "elysia";
14997
15172
 
14998
15173
  // src/toolRuntime.ts
14999
15174
  var toErrorMessage4 = (error) => error instanceof Error ? error.message : String(error);
@@ -15517,7 +15692,7 @@ var createVoiceToolContractHTMLHandler = (options) => async () => {
15517
15692
  var createVoiceToolContractRoutes = (options) => {
15518
15693
  const path = options.path ?? "/api/tool-contracts";
15519
15694
  const htmlPath = options.htmlPath === undefined ? `${path}/htmx` : options.htmlPath;
15520
- const routes = new Elysia22({
15695
+ const routes = new Elysia23({
15521
15696
  name: options.name ?? "absolutejs-voice-tool-contracts"
15522
15697
  }).get(path, createVoiceToolContractJSONHandler(options));
15523
15698
  if (htmlPath) {
@@ -15769,7 +15944,7 @@ app.use(
15769
15944
  var createVoiceSimulationSuiteRoutes = (options) => {
15770
15945
  const path = options.path ?? "/api/voice/simulations";
15771
15946
  const htmlPath = options.htmlPath === undefined ? "/voice/simulations" : options.htmlPath;
15772
- const app = new Elysia23({
15947
+ const app = new Elysia24({
15773
15948
  name: options.name ?? "absolutejs-voice-simulation-suite"
15774
15949
  }).get(path, () => runVoiceSimulationSuite(options));
15775
15950
  if (htmlPath) {
@@ -16081,7 +16256,7 @@ var createVoiceWorkflowContractHandler = (input) => {
16081
16256
  };
16082
16257
  };
16083
16258
  // src/sessionReplay.ts
16084
- import { Elysia as Elysia24 } from "elysia";
16259
+ import { Elysia as Elysia25 } from "elysia";
16085
16260
  var getString10 = (value) => typeof value === "string" ? value : undefined;
16086
16261
  var escapeHtml24 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
16087
16262
  var increment4 = (record, key) => {
@@ -16321,7 +16496,7 @@ var createVoiceSessionsHTMLHandler = (options = {}) => async ({ query }) => {
16321
16496
  var createVoiceSessionListRoutes = (options = {}) => {
16322
16497
  const path = options.path ?? "/api/voice-sessions";
16323
16498
  const htmlPath = options.htmlPath === undefined ? `${path}/htmx` : options.htmlPath;
16324
- const routes = new Elysia24({
16499
+ const routes = new Elysia25({
16325
16500
  name: options.name ?? "absolutejs-voice-session-list"
16326
16501
  }).get(path, createVoiceSessionsJSONHandler(options));
16327
16502
  if (htmlPath) {
@@ -16349,7 +16524,7 @@ var createVoiceSessionReplayHTMLHandler = (options) => async ({ params }) => {
16349
16524
  var createVoiceSessionReplayRoutes = (options) => {
16350
16525
  const path = options.path ?? "/api/voice-sessions/:sessionId/replay";
16351
16526
  const htmlPath = options.htmlPath === undefined ? `${path}/htmx` : options.htmlPath;
16352
- const routes = new Elysia24({
16527
+ const routes = new Elysia25({
16353
16528
  name: options.name ?? "absolutejs-voice-session-replay"
16354
16529
  }).get(path, createVoiceSessionReplayJSONHandler(options));
16355
16530
  if (htmlPath) {
@@ -16663,7 +16838,7 @@ var assertVoiceAgentSquadContractEvidence = (reports, input = {}) => {
16663
16838
  return report;
16664
16839
  };
16665
16840
  // src/turnLatency.ts
16666
- import { Elysia as Elysia25 } from "elysia";
16841
+ import { Elysia as Elysia26 } from "elysia";
16667
16842
  var DEFAULT_WARN_AFTER_MS = 1800;
16668
16843
  var DEFAULT_FAIL_AFTER_MS = 3200;
16669
16844
  var escapeHtml25 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
@@ -16819,7 +16994,7 @@ var createVoiceTurnLatencyHTMLHandler = (options) => async () => {
16819
16994
  var createVoiceTurnLatencyRoutes = (options) => {
16820
16995
  const path = options.path ?? "/api/turn-latency";
16821
16996
  const htmlPath = options.htmlPath === undefined ? `${path}/htmx` : options.htmlPath;
16822
- const routes = new Elysia25({
16997
+ const routes = new Elysia26({
16823
16998
  name: options.name ?? "absolutejs-voice-turn-latency"
16824
16999
  }).get(path, createVoiceTurnLatencyJSONHandler(options));
16825
17000
  if (htmlPath) {
@@ -16828,9 +17003,9 @@ var createVoiceTurnLatencyRoutes = (options) => {
16828
17003
  return routes;
16829
17004
  };
16830
17005
  // src/liveLatency.ts
16831
- import { Elysia as Elysia26 } from "elysia";
17006
+ import { Elysia as Elysia27 } from "elysia";
16832
17007
  var escapeHtml26 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
16833
- var percentile = (values, percentileValue) => {
17008
+ var percentile2 = (values, percentileValue) => {
16834
17009
  if (values.length === 0) {
16835
17010
  return;
16836
17011
  }
@@ -16866,8 +17041,8 @@ var summarizeVoiceLiveLatency = async (options) => {
16866
17041
  averageLatencyMs: latencies.length > 0 ? Math.round(latencies.reduce((total, value) => total + value, 0) / latencies.length) : undefined,
16867
17042
  checkedAt: Date.now(),
16868
17043
  failed,
16869
- p50LatencyMs: percentile(latencies, 50),
16870
- p95LatencyMs: percentile(latencies, 95),
17044
+ p50LatencyMs: percentile2(latencies, 50),
17045
+ p95LatencyMs: percentile2(latencies, 95),
16871
17046
  recent,
16872
17047
  status: latencies.length === 0 ? "empty" : failed > 0 ? "fail" : warnings > 0 ? "warn" : "pass",
16873
17048
  total: latencies.length,
@@ -16902,7 +17077,7 @@ await traceStore.append({
16902
17077
  var createVoiceLiveLatencyRoutes = (options) => {
16903
17078
  const path = options.path ?? "/api/live-latency";
16904
17079
  const htmlPath = options.htmlPath === undefined ? "/live-latency" : options.htmlPath;
16905
- const routes = new Elysia26({
17080
+ const routes = new Elysia27({
16906
17081
  name: options.name ?? "absolutejs-voice-live-latency"
16907
17082
  }).get(path, () => summarizeVoiceLiveLatency(options));
16908
17083
  if (htmlPath) {
@@ -16943,7 +17118,7 @@ var TRACE_TYPES = [
16943
17118
  ];
16944
17119
  var getNumber6 = (value) => typeof value === "number" && Number.isFinite(value) ? value : undefined;
16945
17120
  var getString12 = (value) => typeof value === "string" && value.trim() ? value : undefined;
16946
- var percentile2 = (values, percentileValue) => {
17121
+ var percentile3 = (values, percentileValue) => {
16947
17122
  if (values.length === 0) {
16948
17123
  return;
16949
17124
  }
@@ -17151,8 +17326,8 @@ var summarizeStage = (stage, measurements, options) => {
17151
17326
  label: STAGE_LABELS[stage],
17152
17327
  maxMs: latencies.length > 0 ? Math.max(...latencies) : undefined,
17153
17328
  measurements: stageMeasurements,
17154
- p50Ms: percentile2(latencies, 50),
17155
- p95Ms: percentile2(latencies, 95),
17329
+ p50Ms: percentile3(latencies, 50),
17330
+ p95Ms: percentile3(latencies, 95),
17156
17331
  stage,
17157
17332
  status: stageMeasurements.length === 0 ? "empty" : failed > 0 ? "fail" : warnings > 0 ? "warn" : "pass",
17158
17333
  total: stageMeasurements.length,
@@ -17221,7 +17396,7 @@ None.
17221
17396
  `}`;
17222
17397
  };
17223
17398
  // src/turnQuality.ts
17224
- import { Elysia as Elysia27 } from "elysia";
17399
+ import { Elysia as Elysia28 } from "elysia";
17225
17400
  var DEFAULT_CONFIDENCE_WARN_THRESHOLD = 0.72;
17226
17401
  var escapeHtml27 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
17227
17402
  var getTurnLatencyMs = (turn) => {
@@ -17328,7 +17503,7 @@ var createVoiceTurnQualityHTMLHandler = (options) => async () => {
17328
17503
  var createVoiceTurnQualityRoutes = (options) => {
17329
17504
  const path = options.path ?? "/api/turn-quality";
17330
17505
  const htmlPath = options.htmlPath === undefined ? `${path}/htmx` : options.htmlPath;
17331
- const routes = new Elysia27({
17506
+ const routes = new Elysia28({
17332
17507
  name: options.name ?? "absolutejs-voice-turn-quality"
17333
17508
  }).get(path, createVoiceTurnQualityJSONHandler(options));
17334
17509
  if (htmlPath) {
@@ -17337,7 +17512,7 @@ var createVoiceTurnQualityRoutes = (options) => {
17337
17512
  return routes;
17338
17513
  };
17339
17514
  // src/telephonyOutcome.ts
17340
- import { Elysia as Elysia28 } from "elysia";
17515
+ import { Elysia as Elysia29 } from "elysia";
17341
17516
  var DEFAULT_COMPLETED_STATUSES = [
17342
17517
  "answered",
17343
17518
  "completed",
@@ -18098,7 +18273,7 @@ var createVoiceTelephonyWebhookHandler = (options = {}) => async (input) => {
18098
18273
  var createVoiceTelephonyWebhookRoutes = (options = {}) => {
18099
18274
  const path = options.path ?? "/api/voice/telephony/webhook";
18100
18275
  const handler = createVoiceTelephonyWebhookHandler(options);
18101
- return new Elysia28({
18276
+ return new Elysia29({
18102
18277
  name: options.name ?? "absolutejs-voice-telephony-webhooks"
18103
18278
  }).post(path, async ({ query, request }) => {
18104
18279
  try {
@@ -18119,12 +18294,12 @@ var createVoiceTelephonyWebhookRoutes = (options = {}) => {
18119
18294
  });
18120
18295
  };
18121
18296
  // src/phoneAgent.ts
18122
- import { Elysia as Elysia34 } from "elysia";
18297
+ import { Elysia as Elysia35 } from "elysia";
18123
18298
 
18124
18299
  // src/telephony/plivo.ts
18125
18300
  import { Buffer as Buffer5 } from "buffer";
18126
18301
  import { Database } from "bun:sqlite";
18127
- import { Elysia as Elysia30 } from "elysia";
18302
+ import { Elysia as Elysia31 } from "elysia";
18128
18303
 
18129
18304
  // src/telephony/contract.ts
18130
18305
  var DEFAULT_REQUIREMENTS = [
@@ -18208,7 +18383,7 @@ var evaluateVoiceTelephonyContract = (input) => {
18208
18383
 
18209
18384
  // src/telephony/twilio.ts
18210
18385
  import { Buffer as Buffer4 } from "buffer";
18211
- import { Elysia as Elysia29 } from "elysia";
18386
+ import { Elysia as Elysia30 } from "elysia";
18212
18387
  var TWILIO_MULAW_SAMPLE_RATE = 8000;
18213
18388
  var VOICE_PCM_SAMPLE_RATE = 16000;
18214
18389
  var escapeXml2 = (value) => value.replaceAll("&", "&amp;").replaceAll('"', "&quot;").replaceAll("'", "&apos;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
@@ -18781,7 +18956,7 @@ var createTwilioVoiceRoutes = (options) => {
18781
18956
  const smokePath = options.smoke?.path === false ? false : options.smoke?.path ?? "/api/voice/twilio/smoke";
18782
18957
  const bridges = new WeakMap;
18783
18958
  const webhookPolicy = options.webhook?.policy ?? options.outcomePolicy ?? createVoiceTelephonyOutcomePolicy();
18784
- const app = new Elysia29({
18959
+ const app = new Elysia30({
18785
18960
  name: options.name ?? "absolutejs-voice-twilio"
18786
18961
  }).get(twimlPath, async ({ query, request }) => {
18787
18962
  const streamUrl = await resolveTwilioStreamUrl(options, {
@@ -19452,7 +19627,7 @@ var createPlivoVoiceRoutes = (options = {}) => {
19452
19627
  nonceStore: options.webhook.nonceStore,
19453
19628
  verificationUrl: options.webhook.verificationUrl
19454
19629
  }) : undefined);
19455
- const app = new Elysia30({
19630
+ const app = new Elysia31({
19456
19631
  name: options.name ?? "absolutejs-voice-plivo"
19457
19632
  }).get(answerPath, async ({ query, request }) => {
19458
19633
  const streamUrl = await resolvePlivoStreamUrl(options, {
@@ -19564,7 +19739,7 @@ var createPlivoVoiceRoutes = (options = {}) => {
19564
19739
  // src/telephony/telnyx.ts
19565
19740
  import { Buffer as Buffer6 } from "buffer";
19566
19741
  import { Database as Database2 } from "bun:sqlite";
19567
- import { Elysia as Elysia31 } from "elysia";
19742
+ import { Elysia as Elysia32 } from "elysia";
19568
19743
  var escapeXml4 = (value) => value.replaceAll("&", "&amp;").replaceAll('"', "&quot;").replaceAll("'", "&apos;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
19569
19744
  var escapeHtml30 = (value) => value.replaceAll("&", "&amp;").replaceAll('"', "&quot;").replaceAll("'", "&#39;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
19570
19745
  var joinUrlPath4 = (origin, path) => `${origin.replace(/\/$/, "")}${path.startsWith("/") ? path : `/${path}`}`;
@@ -20066,7 +20241,7 @@ var createTelnyxVoiceRoutes = (options = {}) => {
20066
20241
  publicKey: options.webhook.publicKey,
20067
20242
  toleranceSeconds: options.webhook.toleranceSeconds
20068
20243
  }) : undefined);
20069
- const app = new Elysia31({
20244
+ const app = new Elysia32({
20070
20245
  name: options.name ?? "absolutejs-voice-telnyx"
20071
20246
  }).get(texmlPath, async ({ query, request }) => {
20072
20247
  const streamUrl = await resolveTelnyxStreamUrl(options, {
@@ -20176,7 +20351,7 @@ var createTelnyxVoiceRoutes = (options = {}) => {
20176
20351
  };
20177
20352
 
20178
20353
  // src/telephony/matrix.ts
20179
- import { Elysia as Elysia32 } from "elysia";
20354
+ import { Elysia as Elysia33 } from "elysia";
20180
20355
  var escapeHtml31 = (value) => value.replaceAll("&", "&amp;").replaceAll('"', "&quot;").replaceAll("'", "&#39;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
20181
20356
  var labelForProvider = (provider) => provider.split("-").map((part) => `${part.slice(0, 1).toUpperCase()}${part.slice(1)}`).join(" ");
20182
20357
  var resolveEntryStatus = (contract, setup, smoke) => {
@@ -20260,7 +20435,7 @@ ${entry.issues.length ? `<ul style="margin:12px 0 0; padding-left:18px;">${entry
20260
20435
  </main>`;
20261
20436
  var createVoiceTelephonyCarrierMatrixRoutes = (options) => {
20262
20437
  const path = options.path ?? "/api/voice/telephony/carriers";
20263
- return new Elysia32({
20438
+ return new Elysia33({
20264
20439
  name: options.name ?? "absolutejs-voice-telephony-carrier-matrix"
20265
20440
  }).get(path, async ({ query, request }) => {
20266
20441
  const providers = await options.load({ query, request });
@@ -20282,7 +20457,7 @@ var createVoiceTelephonyCarrierMatrixRoutes = (options) => {
20282
20457
  };
20283
20458
 
20284
20459
  // src/phoneAgentProductionSmoke.ts
20285
- import { Elysia as Elysia33 } from "elysia";
20460
+ import { Elysia as Elysia34 } from "elysia";
20286
20461
  var defaultRequirements = [
20287
20462
  "media-started",
20288
20463
  "transcript",
@@ -20425,7 +20600,7 @@ var createVoicePhoneAgentProductionSmokeHTMLHandler = (options) => async ({
20425
20600
  var createVoicePhoneAgentProductionSmokeRoutes = (options) => {
20426
20601
  const path = options.path ?? "/api/voice/phone/smoke-contract";
20427
20602
  const htmlPath = options.htmlPath === undefined ? "/voice/phone/smoke-contract" : options.htmlPath;
20428
- const routes = new Elysia33({
20603
+ const routes = new Elysia34({
20429
20604
  name: options.name ?? "absolutejs-voice-phone-smoke-contract"
20430
20605
  }).get(path, createVoicePhoneAgentProductionSmokeJSONHandler(options));
20431
20606
  if (htmlPath) {
@@ -20756,7 +20931,7 @@ var createVoicePhoneAgent = (options) => {
20756
20931
  setupPath: resolveSetupPath(carrier),
20757
20932
  smokePath: resolveSmokePath(carrier)
20758
20933
  }));
20759
- const app = new Elysia34({
20934
+ const app = new Elysia35({
20760
20935
  name: options.name ?? "absolutejs-voice-phone-agent"
20761
20936
  });
20762
20937
  for (const carrier of options.carriers) {
@@ -22815,7 +22990,7 @@ var createOpenAIVoiceTTS = (options) => {
22815
22990
  };
22816
22991
  };
22817
22992
  // src/providerCapabilities.ts
22818
- import { Elysia as Elysia35 } from "elysia";
22993
+ import { Elysia as Elysia36 } from "elysia";
22819
22994
  var escapeHtml34 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
22820
22995
  var fromProviderList = (kind, providers, options) => (providers ?? []).map((provider) => ({
22821
22996
  configured: true,
@@ -22916,7 +23091,7 @@ var createVoiceProviderCapabilityHTMLHandler = (options) => async () => {
22916
23091
  var createVoiceProviderCapabilityRoutes = (options) => {
22917
23092
  const path = options.path ?? "/api/provider-capabilities";
22918
23093
  const htmlPath = options.htmlPath === undefined ? `${path}/htmx` : options.htmlPath;
22919
- const routes = new Elysia35({
23094
+ const routes = new Elysia36({
22920
23095
  name: options.name ?? "absolutejs-voice-provider-capabilities"
22921
23096
  }).get(path, createVoiceProviderCapabilityJSONHandler(options));
22922
23097
  if (htmlPath) {
@@ -22925,7 +23100,7 @@ var createVoiceProviderCapabilityRoutes = (options) => {
22925
23100
  return routes;
22926
23101
  };
22927
23102
  // src/resilienceRoutes.ts
22928
- import { Elysia as Elysia36 } from "elysia";
23103
+ import { Elysia as Elysia37 } from "elysia";
22929
23104
  var escapeHtml35 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
22930
23105
  var getString13 = (value) => typeof value === "string" ? value : undefined;
22931
23106
  var getNumber7 = (value) => typeof value === "number" && Number.isFinite(value) ? value : undefined;
@@ -23369,7 +23544,7 @@ var registerSimulationRoutes = (routes, simulation, defaultPathPrefix) => {
23369
23544
  };
23370
23545
  var createVoiceResilienceRoutes = (options) => {
23371
23546
  const path = options.path ?? "/resilience";
23372
- const routes = new Elysia36({
23547
+ const routes = new Elysia37({
23373
23548
  name: options.name ?? "absolutejs-voice-resilience"
23374
23549
  }).get(path, async () => {
23375
23550
  const events = await options.store.list();
@@ -23551,7 +23726,7 @@ var assertVoiceProviderRoutingContractEvidence = (reports, input = {}) => {
23551
23726
  return report;
23552
23727
  };
23553
23728
  // src/providerSlo.ts
23554
- import { Elysia as Elysia37 } from "elysia";
23729
+ import { Elysia as Elysia38 } from "elysia";
23555
23730
  var defaultThresholds = {
23556
23731
  llm: {
23557
23732
  maxAverageElapsedMs: 2500,
@@ -23590,7 +23765,7 @@ var rate3 = (count, total) => count / Math.max(1, total);
23590
23765
  var uniqueSorted5 = (values) => [
23591
23766
  ...new Set(values.filter((value) => typeof value === "string"))
23592
23767
  ].sort();
23593
- var percentile3 = (values, rank) => {
23768
+ var percentile4 = (values, rank) => {
23594
23769
  if (values.length === 0) {
23595
23770
  return 0;
23596
23771
  }
@@ -23648,7 +23823,7 @@ var summarizeKind = (kind, events, thresholds, required) => {
23648
23823
  unit: "rate"
23649
23824
  }),
23650
23825
  p95ElapsedMs: createMetric2({
23651
- actual: percentile3(latencies, 95),
23826
+ actual: percentile4(latencies, 95),
23652
23827
  label: "P95 latency",
23653
23828
  threshold: thresholds.maxP95ElapsedMs,
23654
23829
  unit: "ms"
@@ -23905,7 +24080,7 @@ var createVoiceProviderSloRoutes = (options) => {
23905
24080
  ...options.headers ?? {}
23906
24081
  };
23907
24082
  const buildReport = () => buildVoiceProviderSloReport(options);
23908
- const app = new Elysia37({ name: options.name ?? "absolute-voice-provider-slos" });
24083
+ const app = new Elysia38({ name: options.name ?? "absolute-voice-provider-slos" });
23909
24084
  app.get(path, async () => Response.json(await buildReport(), { headers }));
23910
24085
  if (markdownPath !== false) {
23911
24086
  app.get(markdownPath, async () => {
@@ -23935,10 +24110,10 @@ var createVoiceProviderSloRoutes = (options) => {
23935
24110
  return app;
23936
24111
  };
23937
24112
  // src/productionReadiness.ts
23938
- import { Elysia as Elysia43 } from "elysia";
24113
+ import { Elysia as Elysia44 } from "elysia";
23939
24114
 
23940
24115
  // src/telephony/security.ts
23941
- import { Elysia as Elysia38 } from "elysia";
24116
+ import { Elysia as Elysia39 } from "elysia";
23942
24117
 
23943
24118
  // src/postgresStore.ts
23944
24119
  var normalizeIdentifierSegment = (value) => value.trim().replace(/[^a-zA-Z0-9_]+/g, "_").replace(/^_+|_+$/g, "") || "voice";
@@ -24676,7 +24851,7 @@ var assertVoiceTelephonyWebhookSecurityEvidence = (report, input = {}) => {
24676
24851
  };
24677
24852
  var createVoiceTelephonyWebhookSecurityRoutes = (options) => {
24678
24853
  const path = options.path ?? "/api/voice/telephony/webhook-security";
24679
- return new Elysia38({
24854
+ return new Elysia39({
24680
24855
  name: options.name ?? "absolutejs-voice-telephony-webhook-security"
24681
24856
  }).get(path, () => buildVoiceTelephonyWebhookSecurityReport(options.options));
24682
24857
  };
@@ -24733,7 +24908,7 @@ var createVoiceTelephonyWebhookSecurityPreset = (options = {}) => {
24733
24908
  };
24734
24909
 
24735
24910
  // src/opsRecovery.ts
24736
- import { Elysia as Elysia39 } from "elysia";
24911
+ import { Elysia as Elysia40 } from "elysia";
24737
24912
  var escapeHtml37 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
24738
24913
  var getString14 = (value) => typeof value === "string" && value.trim() ? value.trim() : undefined;
24739
24914
  var hrefForSession = (value, sessionId) => {
@@ -24960,7 +25135,7 @@ var createVoiceOpsRecoveryRoutes = (options = {}) => {
24960
25135
  const path = options.path ?? "/api/voice/ops-recovery";
24961
25136
  const htmlPath = options.htmlPath === undefined ? "/ops-recovery" : options.htmlPath;
24962
25137
  const markdownPath = options.markdownPath === undefined ? `${path}.md` : options.markdownPath;
24963
- const routes = new Elysia39({
25138
+ const routes = new Elysia40({
24964
25139
  name: options.name ?? "absolutejs-voice-ops-recovery"
24965
25140
  }).get(path, async () => buildVoiceOpsRecoveryReport(options));
24966
25141
  if (htmlPath) {
@@ -24990,17 +25165,17 @@ var createVoiceOpsRecoveryRoutes = (options = {}) => {
24990
25165
  };
24991
25166
 
24992
25167
  // src/observabilityExport.ts
24993
- import { Elysia as Elysia42 } from "elysia";
25168
+ import { Elysia as Elysia43 } from "elysia";
24994
25169
  import { Database as Database4 } from "bun:sqlite";
24995
25170
  import { createHash } from "crypto";
24996
25171
  import { mkdir as mkdir4, readFile as readFile2, stat, unlink } from "fs/promises";
24997
25172
  import { join as join3 } from "path";
24998
25173
 
24999
25174
  // src/operationsRecord.ts
25000
- import { Elysia as Elysia41 } from "elysia";
25175
+ import { Elysia as Elysia42 } from "elysia";
25001
25176
 
25002
25177
  // src/traceTimeline.ts
25003
- import { Elysia as Elysia40 } from "elysia";
25178
+ import { Elysia as Elysia41 } from "elysia";
25004
25179
  var escapeHtml38 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
25005
25180
  var getString15 = (value) => typeof value === "string" && value.trim() ? value : undefined;
25006
25181
  var getNumber8 = (value) => typeof value === "number" && Number.isFinite(value) ? value : undefined;
@@ -25226,7 +25401,7 @@ var createVoiceTraceTimelineRoutes = (options) => {
25226
25401
  const path = options.path ?? "/api/voice-traces";
25227
25402
  const htmlPath = options.htmlPath ?? "/traces";
25228
25403
  const title = options.title ?? "AbsoluteJS Voice Trace Timelines";
25229
- const routes = new Elysia40({
25404
+ const routes = new Elysia41({
25230
25405
  name: options.name ?? "absolutejs-voice-trace-timelines"
25231
25406
  });
25232
25407
  const buildReport = async () => summarizeVoiceTraceTimeline(await options.store.list(), {
@@ -25624,7 +25799,7 @@ var createVoiceOperationsRecordRoutes = (options) => {
25624
25799
  const htmlPath = options.htmlPath === undefined ? "/voice-operations/:sessionId" : options.htmlPath;
25625
25800
  const incidentPath = options.incidentPath === undefined ? `${path}/incident.md` : options.incidentPath;
25626
25801
  const incidentHtmlPath = options.incidentHtmlPath === undefined && htmlPath ? `${htmlPath}/incident.md` : options.incidentHtmlPath;
25627
- const routes = new Elysia41({
25802
+ const routes = new Elysia42({
25628
25803
  name: options.name ?? "absolutejs-voice-operations-record"
25629
25804
  });
25630
25805
  const buildRecord = (sessionId) => buildVoiceOperationsRecord({
@@ -26275,7 +26450,7 @@ var createVoiceObservabilityExportReplayRoutes = (options) => {
26275
26450
  ...options.headers ?? {}
26276
26451
  };
26277
26452
  const buildReport = () => resolveVoiceObservabilityExportReplayReport(options.source);
26278
- const app = new Elysia42({
26453
+ const app = new Elysia43({
26279
26454
  name: options.name ?? "absolute-voice-observability-export-replay"
26280
26455
  });
26281
26456
  app.get(path, async () => Response.json(await buildReport(), { headers }));
@@ -27084,7 +27259,7 @@ var createVoiceObservabilityExportRoutes = (options = {}) => {
27084
27259
  artifactDownload: options.links?.artifactDownload ?? (artifactDownloadPath ? (artifact) => `${artifactDownloadPath}/${encodeURIComponent(artifact.id)}` : undefined)
27085
27260
  }
27086
27261
  });
27087
- const app = new Elysia42({
27262
+ const app = new Elysia43({
27088
27263
  name: options.name ?? "absolute-voice-observability-export"
27089
27264
  });
27090
27265
  app.get(path, async () => Response.json(await buildReport(), { headers }));
@@ -28531,7 +28706,7 @@ var createVoiceProductionReadinessRoutes = (options) => {
28531
28706
  const path = options.path ?? "/api/production-readiness";
28532
28707
  const gatePath = options.gatePath === undefined ? "/api/production-readiness/gate" : options.gatePath;
28533
28708
  const htmlPath = options.htmlPath ?? "/production-readiness";
28534
- const routes = new Elysia43({
28709
+ const routes = new Elysia44({
28535
28710
  name: options.name ?? "absolutejs-voice-production-readiness"
28536
28711
  });
28537
28712
  routes.get(path, async ({ query, request }) => buildVoiceProductionReadinessReport(options, { query, request }));
@@ -28568,7 +28743,7 @@ var createVoiceProductionReadinessRoutes = (options) => {
28568
28743
  return routes;
28569
28744
  };
28570
28745
  // src/voiceMonitoring.ts
28571
- import { Elysia as Elysia44 } from "elysia";
28746
+ import { Elysia as Elysia45 } from "elysia";
28572
28747
  var escapeHtml41 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
28573
28748
  var issueIdForRun = (run) => `voice-monitor:${run.id}:${run.impactedSessions?.[0] ?? "global"}`;
28574
28749
  var rollupStatus4 = (runs) => runs.some((run) => run.status === "fail") ? "fail" : runs.some((run) => run.status === "warn") ? "warn" : "pass";
@@ -28849,7 +29024,7 @@ var createVoiceMonitorRoutes = (options) => {
28849
29024
  monitors: options.monitors,
28850
29025
  now: options.now
28851
29026
  });
28852
- const routes = new Elysia44({
29027
+ const routes = new Elysia45({
28853
29028
  name: options.name ?? "absolutejs-voice-monitoring"
28854
29029
  }).get(path, report).get(`${path}.md`, async () => {
28855
29030
  return new Response(renderVoiceMonitorMarkdown(await report()), {
@@ -28896,7 +29071,7 @@ var createVoiceMonitorRoutes = (options) => {
28896
29071
  };
28897
29072
  var createVoiceMonitorRunnerRoutes = (options) => {
28898
29073
  const path = options.path ?? "/api/voice/monitor-runner";
28899
- return new Elysia44({
29074
+ return new Elysia45({
28900
29075
  name: options.name ?? "absolutejs-voice-monitor-runner"
28901
29076
  }).get(path, () => ({
28902
29077
  isRunning: options.runner.isRunning()
@@ -29272,7 +29447,7 @@ var recommendVoiceReadinessProfile = (options) => {
29272
29447
  };
29273
29448
  };
29274
29449
  // src/providerStackRecommendations.ts
29275
- import { Elysia as Elysia45 } from "elysia";
29450
+ import { Elysia as Elysia46 } from "elysia";
29276
29451
  var escapeHtml42 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
29277
29452
  var profileProviderPriorities = {
29278
29453
  "meeting-recorder": {
@@ -29638,7 +29813,7 @@ var createVoiceProviderContractMatrixHTMLHandler = (options) => async () => {
29638
29813
  var createVoiceProviderContractMatrixRoutes = (options) => {
29639
29814
  const path = options.path ?? "/api/provider-contracts";
29640
29815
  const htmlPath = options.htmlPath ?? "/provider-contracts";
29641
- const routes = new Elysia45({
29816
+ const routes = new Elysia46({
29642
29817
  name: options.name ?? "absolutejs-voice-provider-contract-matrix"
29643
29818
  });
29644
29819
  const jsonHandler = createVoiceProviderContractMatrixJSONHandler(options.matrix);
@@ -29756,7 +29931,7 @@ var assertVoiceProviderStackEvidence = (report, input = {}) => {
29756
29931
  return assertion;
29757
29932
  };
29758
29933
  // src/opsConsoleRoutes.ts
29759
- import { Elysia as Elysia46 } from "elysia";
29934
+ import { Elysia as Elysia47 } from "elysia";
29760
29935
  var DEFAULT_LINKS = [
29761
29936
  {
29762
29937
  description: "Quality gates for CI, deploy checks, and production readiness.",
@@ -29873,7 +30048,7 @@ var renderVoiceOpsConsoleHTML = (report, options = {}) => {
29873
30048
  };
29874
30049
  var createVoiceOpsConsoleRoutes = (options) => {
29875
30050
  const path = options.path ?? "/ops-console";
29876
- const routes = new Elysia46({
30051
+ const routes = new Elysia47({
29877
30052
  name: options.name ?? "absolutejs-voice-ops-console"
29878
30053
  });
29879
30054
  const getReport = () => buildVoiceOpsConsoleReport(options);
@@ -29890,7 +30065,7 @@ var createVoiceOpsConsoleRoutes = (options) => {
29890
30065
  return routes;
29891
30066
  };
29892
30067
  // src/incidentBundle.ts
29893
- import { Elysia as Elysia47 } from "elysia";
30068
+ import { Elysia as Elysia48 } from "elysia";
29894
30069
  var filterIncidentBundleArtifacts = (artifacts, filter = {}) => artifacts.filter((artifact) => {
29895
30070
  if (filter.sessionId && artifact.sessionId !== filter.sessionId) {
29896
30071
  return false;
@@ -30091,7 +30266,7 @@ var buildVoiceIncidentBundle = async (options) => {
30091
30266
  var createVoiceIncidentBundleRoutes = (options) => {
30092
30267
  const path = options.path ?? "/api/voice-incidents/:sessionId";
30093
30268
  const markdownPath = options.markdownPath === undefined ? "/voice-incidents/:sessionId/markdown" : options.markdownPath;
30094
- const routes = new Elysia47({
30269
+ const routes = new Elysia48({
30095
30270
  name: options.name ?? "absolutejs-voice-incident-bundle"
30096
30271
  });
30097
30272
  const getSessionId = (params) => params.sessionId ?? "";
@@ -30292,7 +30467,7 @@ var summarizeVoiceOpsStatus = async (options) => {
30292
30467
  };
30293
30468
  };
30294
30469
  // src/opsStatusRoutes.ts
30295
- import { Elysia as Elysia48 } from "elysia";
30470
+ import { Elysia as Elysia49 } from "elysia";
30296
30471
  var escapeHtml44 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
30297
30472
  var renderVoiceOpsStatusHTML = (report, options = {}) => {
30298
30473
  const title = options.title ?? "AbsoluteJS Voice Ops Status";
@@ -30304,7 +30479,7 @@ var renderVoiceOpsStatusHTML = (report, options = {}) => {
30304
30479
  };
30305
30480
  var createVoiceOpsStatusRoutes = (options) => {
30306
30481
  const path = options.path ?? "/api/voice/ops-status";
30307
- const routes = new Elysia48({
30482
+ const routes = new Elysia49({
30308
30483
  name: options.name ?? "absolutejs-voice-ops-status"
30309
30484
  });
30310
30485
  routes.get(path, async () => summarizeVoiceOpsStatus(options));
@@ -30737,7 +30912,7 @@ var createVoiceTTSProviderRouter = (options) => {
30737
30912
  };
30738
30913
  };
30739
30914
  // src/traceDeliveryRoutes.ts
30740
- import { Elysia as Elysia49 } from "elysia";
30915
+ import { Elysia as Elysia50 } from "elysia";
30741
30916
  var escapeHtml45 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
30742
30917
  var getString19 = (value) => typeof value === "string" && value.trim() ? value.trim() : undefined;
30743
30918
  var getNumber11 = (value) => {
@@ -30846,7 +31021,7 @@ var createVoiceTraceDeliveryRoutes = (options) => {
30846
31021
  const path = options.path ?? "/api/voice-trace-deliveries";
30847
31022
  const htmlPath = options.htmlPath === undefined ? "/traces/deliveries" : options.htmlPath;
30848
31023
  const workerPath = options.workerPath === undefined ? `${path}/drain` : options.workerPath;
30849
- const routes = new Elysia49({
31024
+ const routes = new Elysia50({
30850
31025
  name: options.name ?? "absolutejs-voice-trace-deliveries"
30851
31026
  }).get(path, createVoiceTraceDeliveryJSONHandler(options));
30852
31027
  if (htmlPath !== false) {
@@ -30943,7 +31118,7 @@ var createVoiceMemoryStore = () => {
30943
31118
  return { get, getOrCreate, list, remove, set };
30944
31119
  };
30945
31120
  // src/opsWebhook.ts
30946
- import { Elysia as Elysia50 } from "elysia";
31121
+ import { Elysia as Elysia51 } from "elysia";
30947
31122
  var toHex6 = (bytes) => Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
30948
31123
  var signVoiceOpsWebhookBody = async (input) => {
30949
31124
  const encoder = new TextEncoder;
@@ -31073,7 +31248,7 @@ var verifyVoiceOpsWebhookSignature = async (input) => {
31073
31248
  };
31074
31249
  var createVoiceOpsWebhookReceiverRoutes = (options = {}) => {
31075
31250
  const path = options.path ?? "/api/voice-ops/webhook";
31076
- return new Elysia50().post(path, async ({ body, request, set }) => {
31251
+ return new Elysia51().post(path, async ({ body, request, set }) => {
31077
31252
  const bodyText = typeof body === "string" ? body : JSON.stringify(body);
31078
31253
  if (options.signingSecret) {
31079
31254
  const verification = await verifyVoiceOpsWebhookSignature({
@@ -31528,7 +31703,7 @@ var resolveVoiceOpsPreset = (name, overrides = {}) => {
31528
31703
  };
31529
31704
  };
31530
31705
  // src/postCallAnalysis.ts
31531
- import { Elysia as Elysia51 } from "elysia";
31706
+ import { Elysia as Elysia52 } from "elysia";
31532
31707
  var isStore = (value) => Boolean(value) && typeof value === "object" && value !== null && ("list" in value);
31533
31708
  var asArray = async (value) => Array.isArray(value) ? value : isStore(value) ? await value.list() : [];
31534
31709
  var getPathValue3 = (source, path) => {
@@ -31707,7 +31882,7 @@ var resolvePostCallAnalysisReport = async (options, input) => {
31707
31882
  };
31708
31883
  var createVoicePostCallAnalysisRoutes = (options = {}) => {
31709
31884
  const path = options.path ?? "/api/voice/post-call-analysis";
31710
- const routes = new Elysia51({
31885
+ const routes = new Elysia52({
31711
31886
  name: options.name ?? "absolutejs-voice-post-call-analysis"
31712
31887
  });
31713
31888
  routes.get(path, async ({ query }) => {
@@ -31732,7 +31907,7 @@ var createVoicePostCallAnalysisRoutes = (options = {}) => {
31732
31907
  return routes;
31733
31908
  };
31734
31909
  // src/guardrails.ts
31735
- import { Elysia as Elysia52 } from "elysia";
31910
+ import { Elysia as Elysia53 } from "elysia";
31736
31911
  var stringifyContent = (value) => typeof value === "string" ? value : JSON.stringify(value) ?? "";
31737
31912
  var appliesToStage = (rule, stage) => !rule.stages || rule.stages.length === 0 || rule.stages.includes(stage);
31738
31913
  var matchesRule = async (rule, input) => {
@@ -32034,7 +32209,7 @@ var resolveGuardrailReport = async (options, input) => {
32034
32209
  };
32035
32210
  var createVoiceGuardrailRoutes = (options = {}) => {
32036
32211
  const path = options.path ?? "/api/voice/guardrails";
32037
- const routes = new Elysia52({
32212
+ const routes = new Elysia53({
32038
32213
  name: options.name ?? "absolutejs-voice-guardrails"
32039
32214
  });
32040
32215
  routes.all(path, async ({ request }) => {
@@ -32549,6 +32724,7 @@ export {
32549
32724
  renderVoiceTraceDeliveryHTML,
32550
32725
  renderVoiceToolContractHTML,
32551
32726
  renderVoiceTelephonyCarrierMatrixHTML,
32727
+ renderVoiceSloCalibrationMarkdown,
32552
32728
  renderVoiceSimulationSuiteHTML,
32553
32729
  renderVoiceSessionsHTML,
32554
32730
  renderVoiceScenarioFixtureEvalHTML,
@@ -32729,6 +32905,7 @@ export {
32729
32905
  createVoiceTaskSLABreachedEvent,
32730
32906
  createVoiceTaskCreatedEvent,
32731
32907
  createVoiceTTSProviderRouter,
32908
+ createVoiceSloCalibrationRoutes,
32732
32909
  createVoiceSimulationSuiteRoutes,
32733
32910
  createVoiceSessionsJSONHandler,
32734
32911
  createVoiceSessionsHTMLHandler,
@@ -32962,6 +33139,7 @@ export {
32962
33139
  buildVoiceTraceReplay,
32963
33140
  buildVoiceTraceDeliveryReport,
32964
33141
  buildVoiceTelephonyWebhookSecurityReport,
33142
+ buildVoiceSloCalibrationReport,
32965
33143
  buildVoiceProviderSloReport,
32966
33144
  buildVoiceProviderContractMatrix,
32967
33145
  buildVoiceProofTrendReport,
@@ -33000,6 +33178,7 @@ export {
33000
33178
  assertVoiceToolContractEvidence,
33001
33179
  assertVoiceTelephonyWebhookSecurityEvidence,
33002
33180
  assertVoiceTelephonyWebhookNormalizationEvidence,
33181
+ assertVoiceSloCalibration,
33003
33182
  assertVoiceSimulationSuiteEvidence,
33004
33183
  assertVoiceProviderStackEvidence,
33005
33184
  assertVoiceProviderSloEvidence,
@@ -0,0 +1,104 @@
1
+ import { Elysia } from 'elysia';
2
+ import type { VoiceProviderSloThresholdConfig } from './providerSlo';
3
+ import type { VoiceProofTrendReport } from './proofTrends';
4
+ export type VoiceSloCalibrationStatus = 'fail' | 'pass' | 'warn';
5
+ export type VoiceSloCalibrationMetricKey = 'interruption' | 'liveLatency' | 'monitorRun' | 'notifierDelivery' | 'provider' | 'reconnect' | 'turnLatency';
6
+ export type VoiceSloCalibrationSample = {
7
+ generatedAt?: string;
8
+ interruptionP95Ms?: number;
9
+ liveP95Ms?: number;
10
+ monitorRunP95Ms?: number;
11
+ notifierDeliveryP95Ms?: number;
12
+ ok?: boolean;
13
+ providerP95Ms?: number;
14
+ reconnectP95Ms?: number;
15
+ runId?: string;
16
+ source?: string;
17
+ turnP95Ms?: number;
18
+ };
19
+ export type VoiceSloCalibrationThreshold = {
20
+ baselineP95Ms?: number;
21
+ failAfterMs?: number;
22
+ headroomMultiplier: number;
23
+ maxObservedMs?: number;
24
+ metric: VoiceSloCalibrationMetricKey;
25
+ minimumMs: number;
26
+ recommendedMs?: number;
27
+ samples: number;
28
+ status: VoiceSloCalibrationStatus;
29
+ warnAfterMs?: number;
30
+ };
31
+ export type VoiceSloCalibrationThresholds = {
32
+ interruption: VoiceSloCalibrationThreshold;
33
+ liveLatency: VoiceSloCalibrationThreshold;
34
+ monitorRun: VoiceSloCalibrationThreshold;
35
+ notifierDelivery: VoiceSloCalibrationThreshold;
36
+ provider: VoiceSloCalibrationThreshold;
37
+ reconnect: VoiceSloCalibrationThreshold;
38
+ turnLatency: VoiceSloCalibrationThreshold;
39
+ };
40
+ export type VoiceSloCalibrationReport = {
41
+ generatedAt: string;
42
+ issues: string[];
43
+ minPassingRuns: number;
44
+ ok: boolean;
45
+ passingRuns: number;
46
+ recommendedProviderSloThresholds: VoiceProviderSloThresholdConfig;
47
+ runs: number;
48
+ sources: string[];
49
+ status: VoiceSloCalibrationStatus;
50
+ thresholds: VoiceSloCalibrationThresholds;
51
+ };
52
+ export type VoiceSloCalibrationOptions = {
53
+ headroomMultiplier?: number;
54
+ liveLatencyMinimumMs?: number;
55
+ minPassingRuns?: number;
56
+ monitorRunMinimumMs?: number;
57
+ notifierDeliveryMinimumMs?: number;
58
+ providerMinimumMs?: number;
59
+ reconnectMinimumMs?: number;
60
+ interruptionMinimumMs?: number;
61
+ turnLatencyMinimumMs?: number;
62
+ warnRatio?: number;
63
+ };
64
+ export type VoiceSloCalibrationRoutesOptions = VoiceSloCalibrationOptions & {
65
+ headers?: HeadersInit;
66
+ markdownPath?: false | string;
67
+ name?: string;
68
+ path?: string;
69
+ source: (() => Promise<Array<VoiceProofTrendReport | VoiceSloCalibrationSample>> | Array<VoiceProofTrendReport | VoiceSloCalibrationSample>) | Array<VoiceProofTrendReport | VoiceSloCalibrationSample>;
70
+ title?: string;
71
+ };
72
+ export declare const buildVoiceSloCalibrationReport: (input: Array<VoiceProofTrendReport | VoiceSloCalibrationSample>, options?: VoiceSloCalibrationOptions) => VoiceSloCalibrationReport;
73
+ export declare const assertVoiceSloCalibration: (input: Array<VoiceProofTrendReport | VoiceSloCalibrationSample>, options?: VoiceSloCalibrationOptions) => VoiceSloCalibrationReport;
74
+ export declare const renderVoiceSloCalibrationMarkdown: (report: VoiceSloCalibrationReport, options?: {
75
+ title?: string;
76
+ }) => string;
77
+ export declare const createVoiceSloCalibrationRoutes: (options: VoiceSloCalibrationRoutesOptions) => Elysia<"", {
78
+ decorator: {};
79
+ store: {};
80
+ derive: {};
81
+ resolve: {};
82
+ }, {
83
+ typebox: {};
84
+ error: {};
85
+ }, {
86
+ schema: {};
87
+ standaloneSchema: {};
88
+ macro: {};
89
+ macroFn: {};
90
+ parser: {};
91
+ response: {};
92
+ }, {}, {
93
+ derive: {};
94
+ resolve: {};
95
+ schema: {};
96
+ standaloneSchema: {};
97
+ response: {};
98
+ }, {
99
+ derive: {};
100
+ resolve: {};
101
+ schema: {};
102
+ standaloneSchema: {};
103
+ response: {};
104
+ }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.280",
3
+ "version": "0.0.22-beta.281",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",