@absolutejs/voice 0.0.22-beta.346 → 0.0.22-beta.348

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.
@@ -3829,6 +3829,7 @@ var normalizeVoiceProofTrendReport = (value, options = {}) => {
3829
3829
  return buildVoiceProofTrendReport({
3830
3830
  ...value,
3831
3831
  maxAgeMs: options.maxAgeMs ?? value.maxAgeMs,
3832
+ now: options.now ?? ("now" in value ? value.now : undefined),
3832
3833
  source: value.source ?? options.source
3833
3834
  });
3834
3835
  };
@@ -4085,6 +4086,65 @@ var buildVoiceProofTrendReportFromRealCallProfiles = (options) => {
4085
4086
  summary
4086
4087
  });
4087
4088
  };
4089
+ var flattenProofTrendCycles = (reports) => reports.flatMap((report) => report.cycles ?? []);
4090
+ var buildVoiceRealCallProfileHistoryReport = (options = {}) => {
4091
+ const generatedAt = options.generatedAt ?? (options.now instanceof Date ? options.now.toISOString() : typeof options.now === "number" ? new Date(options.now).toISOString() : typeof options.now === "string" ? new Date(options.now).toISOString() : new Date().toISOString());
4092
+ const evidenceReport = options.evidence && options.evidence.length > 0 ? buildVoiceProofTrendReportFromRealCallProfiles({
4093
+ ...options,
4094
+ evidence: options.evidence,
4095
+ generatedAt,
4096
+ source: `${options.source ?? "real-call-profile-history"}#evidence`
4097
+ }) : undefined;
4098
+ const history = [
4099
+ ...(options.reports ?? []).map((report) => normalizeVoiceProofTrendReport(report, {
4100
+ maxAgeMs: options.maxAgeMs,
4101
+ now: options.now
4102
+ })),
4103
+ ...evidenceReport ? [evidenceReport] : []
4104
+ ];
4105
+ const passingHistory = history.filter((report) => report.ok === true);
4106
+ const recommendationHistory = passingHistory.length > 0 ? passingHistory : history;
4107
+ const profiles = buildVoiceProofTrendProfileSummaries(recommendationHistory, options);
4108
+ const summary = {
4109
+ cycles: recommendationHistory.reduce((total, report) => total + (report.summary.cycles ?? report.cycles.length), 0),
4110
+ failedReports: history.filter((report) => report.ok !== true).length,
4111
+ maxLiveP95Ms: maxNumber(recommendationHistory.map(readProofTrendMaxLiveP95)),
4112
+ maxProviderP95Ms: maxNumber(recommendationHistory.map(readProofTrendMaxProviderP95)),
4113
+ maxTurnP95Ms: maxNumber(recommendationHistory.map(readProofTrendMaxTurnP95)),
4114
+ profileCount: profiles.length,
4115
+ profiles,
4116
+ providers: readProofTrendProviders(recommendationHistory),
4117
+ runtimeChannel: aggregateProofTrendRuntimeChannel(recommendationHistory.map(readProofTrendRuntimeChannel).filter((channel) => channel !== undefined))
4118
+ };
4119
+ const trend = buildVoiceProofTrendReport({
4120
+ baseUrl: options.baseUrl,
4121
+ cycles: flattenProofTrendCycles(recommendationHistory),
4122
+ generatedAt,
4123
+ maxAgeMs: options.maxAgeMs,
4124
+ now: options.now,
4125
+ ok: recommendationHistory.length > 0 && profiles.every((profile) => profile.status !== "fail"),
4126
+ source: options.source ?? "real-call-profile-history",
4127
+ summary
4128
+ });
4129
+ const recommendations = buildVoiceProofTrendRecommendationReport(trend, options);
4130
+ const issues = [
4131
+ ...recommendationHistory.length === 0 ? ["No passing real-call profile reports were present."] : [],
4132
+ ...profiles.length === 0 ? ["No benchmark profiles were present."] : [],
4133
+ ...recommendations.issues
4134
+ ];
4135
+ return {
4136
+ generatedAt,
4137
+ history,
4138
+ issues,
4139
+ ok: trend.ok && issues.length === 0,
4140
+ recommendations,
4141
+ reports: history.length,
4142
+ source: trend.source,
4143
+ status: issues.length > 0 ? trend.status === "pass" ? "fail" : trend.status : trend.status,
4144
+ summary,
4145
+ trend
4146
+ };
4147
+ };
4088
4148
  var normalizeProviderStatus = (status) => status === "pass" ? "pass" : status === "fail" ? "fail" : "warn";
4089
4149
  var providerSortScore = (provider) => [
4090
4150
  recommendationStatusRank[provider.status],
@@ -4461,6 +4521,37 @@ var renderVoiceProofTrendRecommendationHTML = (report, title = "Voice Provider R
4461
4521
  const profileRows = report.profiles.length === 0 ? "<li>No benchmark profiles were present.</li>" : report.profiles.map((profile) => `<li><strong>${escapeHtml3(profile.label ?? profile.id)}</strong><span>${escapeHtml3(profile.status)} \xB7 ${escapeHtml3(formatProviderMix(profile.bestProviders))}</span><small>${escapeHtml3(profile.nextMove)}</small></li>`).join("");
4462
4522
  return `<!doctype html><html lang="en"><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width,initial-scale=1" /><title>${escapeHtml3(title)}</title><style>body{background:#101418;color:#f7f3e8;font-family:ui-sans-serif,system-ui,sans-serif;margin:0}main{margin:auto;max-width:1120px;padding:32px}.hero,article{background:#17201d;border:1px solid #2e3d36;border-radius:24px;margin-bottom:16px;padding:22px}.hero{background:linear-gradient(135deg,rgba(20,184,166,.18),rgba(245,158,11,.12))}.eyebrow{color:#5eead4;font-weight:900;letter-spacing:.1em;text-transform:uppercase}h1{font-size:clamp(2.2rem,6vw,4.7rem);letter-spacing:-.06em;line-height:.92;margin:.2rem 0 1rem}.summary{display:flex;flex-wrap:wrap;gap:10px}.pill{border:1px solid #42534a;border-radius:999px;padding:8px 12px}.pass{border-color:rgba(34,197,94,.55)}.warn{border-color:rgba(245,158,11,.7)}.fail{border-color:rgba(239,68,68,.75)}pre{background:#0b1110;border-radius:14px;overflow:auto;padding:12px}a{color:#5eead4}li{margin:.45rem 0}li span,li small{display:block;color:#c9d3ca}</style></head><body><main><section class="hero"><p class="eyebrow">Sustained proof recommendations</p><h1>${escapeHtml3(title)}</h1><p>Generated ${escapeHtml3(report.generatedAt)} from ${escapeHtml3(report.source)}.</p><div class="summary"><span class="pill">Status ${escapeHtml3(report.status)}</span><span class="pill">Provider ${report.summary.keepCurrentProviderPath ? "keep" : "change"}</span><span class="pill">Best mix ${escapeHtml3(formatProviderMix(report.bestProviders))}</span><span class="pill">Profiles ${String(report.profiles.length)}</span><span class="pill">Runtime ${report.summary.keepCurrentRuntimeChannel ? "keep" : "tune"}</span><span class="pill">${String(report.summary.recommendedActions)} action(s)</span></div></section>${cards}<section class="hero"><h2>Benchmark Profiles</h2><ul>${profileRows}</ul></section><section class="hero"><h2>Provider Comparison</h2><ul>${providerRows}</ul></section><section class="hero"><h2>Issues</h2><ul>${issues}</ul></section></main></body></html>`;
4463
4523
  };
4524
+ var renderVoiceRealCallProfileHistoryMarkdown = (report, title = "Voice Real-Call Profile History") => [
4525
+ `# ${title}`,
4526
+ "",
4527
+ `- Status: ${report.status}`,
4528
+ `- Reports: ${String(report.reports)}`,
4529
+ `- Profiles: ${String(report.summary.profileCount)}`,
4530
+ `- Cycles: ${String(report.summary.cycles ?? 0)}`,
4531
+ `- Source: ${report.source}`,
4532
+ `- Best provider mix: ${formatProviderMix(report.recommendations.bestProviders)}`,
4533
+ "",
4534
+ "## Profiles",
4535
+ "",
4536
+ "| Profile | Status | Live p95 | Provider p95 | Turn p95 | Provider mix |",
4537
+ "| --- | --- | ---: | ---: | ---: | --- |",
4538
+ ...report.summary.profiles?.length ? report.summary.profiles.map((profile) => `| ${escapeMarkdown(profile.label ?? profile.id)} | ${profile.status ?? "unknown"} | ${profile.maxLiveP95Ms ?? "n/a"} | ${profile.maxProviderP95Ms ?? "n/a"} | ${profile.maxTurnP95Ms ?? "n/a"} | ${escapeMarkdown(formatProviderMix(profile.providers ?? []))} |`) : ["| n/a | n/a | n/a | n/a | n/a | No profiles present. |"],
4539
+ "",
4540
+ "## Recommendations",
4541
+ "",
4542
+ ...report.recommendations.recommendations.map((recommendation) => `- ${recommendation.status}: ${recommendation.recommendation} ${recommendation.nextMove}`),
4543
+ "",
4544
+ "## Issues",
4545
+ "",
4546
+ ...report.issues.length ? report.issues.map((issue) => `- ${issue}`) : ["- None"]
4547
+ ].join(`
4548
+ `);
4549
+ var renderVoiceRealCallProfileHistoryHTML = (report, title = "Voice Real-Call Profile History") => {
4550
+ const profileRows = report.summary.profiles?.length ? report.summary.profiles.map((profile) => `<tr><td>${escapeHtml3(profile.label ?? profile.id)}</td><td>${escapeHtml3(profile.status ?? "unknown")}</td><td>${escapeHtml3(profile.maxLiveP95Ms ?? "n/a")}</td><td>${escapeHtml3(profile.maxProviderP95Ms ?? "n/a")}</td><td>${escapeHtml3(profile.maxTurnP95Ms ?? "n/a")}</td><td>${escapeHtml3(formatProviderMix(profile.providers ?? []))}</td></tr>`).join("") : '<tr><td colspan="6">No profiles present.</td></tr>';
4551
+ const recommendations = report.recommendations.recommendations.map((recommendation) => `<article class="${escapeHtml3(recommendation.status)}"><p class="eyebrow">${escapeHtml3(recommendation.surface)} \xB7 ${escapeHtml3(recommendation.status)}</p><h2>${escapeHtml3(recommendation.recommendation)}</h2><p>${escapeHtml3(recommendation.nextMove)}</p></article>`).join("");
4552
+ const issues = report.issues.length === 0 ? "<li>None</li>" : report.issues.map((issue) => `<li>${escapeHtml3(issue)}</li>`).join("");
4553
+ return `<!doctype html><html lang="en"><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width,initial-scale=1" /><title>${escapeHtml3(title)}</title><style>body{background:#111510;color:#f6f0dd;font-family:ui-sans-serif,system-ui,sans-serif;margin:0}main{margin:auto;max-width:1120px;padding:32px}.hero,article,.card{background:#182117;border:1px solid #32412d;border-radius:24px;margin-bottom:16px;padding:22px}.hero{background:linear-gradient(135deg,rgba(132,204,22,.16),rgba(20,184,166,.12))}.eyebrow{color:#bef264;font-weight:900;letter-spacing:.1em;text-transform:uppercase}h1{font-size:clamp(2.2rem,6vw,4.7rem);letter-spacing:-.06em;line-height:.92;margin:.2rem 0 1rem}.summary{display:flex;flex-wrap:wrap;gap:10px}.pill{border:1px solid #52624b;border-radius:999px;padding:8px 12px}.pass{border-color:rgba(34,197,94,.55)}.warn{border-color:rgba(245,158,11,.7)}.fail{border-color:rgba(239,68,68,.75)}table{border-collapse:collapse;width:100%}td,th{border-bottom:1px solid #32412d;padding:10px;text-align:left}</style></head><body><main><section class="hero"><p class="eyebrow">Real-call benchmark history</p><h1>${escapeHtml3(title)}</h1><p>Generated ${escapeHtml3(report.generatedAt)} from ${escapeHtml3(report.source)}.</p><div class="summary"><span class="pill">Status ${escapeHtml3(report.status)}</span><span class="pill">Reports ${String(report.reports)}</span><span class="pill">Profiles ${String(report.summary.profileCount)}</span><span class="pill">Cycles ${String(report.summary.cycles ?? 0)}</span><span class="pill">Best mix ${escapeHtml3(formatProviderMix(report.recommendations.bestProviders))}</span></div></section><section class="card"><h2>Profiles</h2><table><thead><tr><th>Profile</th><th>Status</th><th>Live p95</th><th>Provider p95</th><th>Turn p95</th><th>Provider mix</th></tr></thead><tbody>${profileRows}</tbody></table></section>${recommendations}<section class="card"><h2>Issues</h2><ul>${issues}</ul></section></main></body></html>`;
4554
+ };
4464
4555
  var createVoiceProofTrendRecommendationRoutes = (options) => {
4465
4556
  const path = options.path ?? "/api/voice/proof-trend-recommendations";
4466
4557
  const htmlPath = options.htmlPath === undefined ? "/voice/proof-trend-recommendations" : options.htmlPath;
@@ -4503,6 +4594,47 @@ var createVoiceProofTrendRecommendationRoutes = (options) => {
4503
4594
  }
4504
4595
  return routes;
4505
4596
  };
4597
+ var createVoiceRealCallProfileHistoryRoutes = (options = {}) => {
4598
+ const path = options.path ?? "/api/voice/real-call-profile-history";
4599
+ const htmlPath = options.htmlPath === undefined ? "/voice/real-call-profile-history" : options.htmlPath;
4600
+ const markdownPath = options.markdownPath === undefined ? "/voice/real-call-profile-history.md" : options.markdownPath;
4601
+ const title = options.title ?? "Voice Real-Call Profile History";
4602
+ const routes = new Elysia({
4603
+ name: options.name ?? "absolutejs-voice-real-call-profile-history"
4604
+ });
4605
+ const loadReport = async () => {
4606
+ const { source, ...routeOptions } = options;
4607
+ const sourceOptions = source === undefined ? routeOptions : typeof source === "function" ? await source() : source;
4608
+ return buildVoiceRealCallProfileHistoryReport({
4609
+ ...routeOptions,
4610
+ ...sourceOptions
4611
+ });
4612
+ };
4613
+ routes.get(path, async () => Response.json(await loadReport(), { headers: options.headers }));
4614
+ if (htmlPath !== false) {
4615
+ routes.get(htmlPath, async () => {
4616
+ const report = await loadReport();
4617
+ return new Response(renderVoiceRealCallProfileHistoryHTML(report, title), {
4618
+ headers: {
4619
+ "content-type": "text/html; charset=utf-8",
4620
+ ...Object.fromEntries(new Headers(options.headers))
4621
+ }
4622
+ });
4623
+ });
4624
+ }
4625
+ if (markdownPath !== false) {
4626
+ routes.get(markdownPath, async () => {
4627
+ const report = await loadReport();
4628
+ return new Response(renderVoiceRealCallProfileHistoryMarkdown(report, title), {
4629
+ headers: {
4630
+ "content-type": "text/markdown; charset=utf-8",
4631
+ ...Object.fromEntries(new Headers(options.headers))
4632
+ }
4633
+ });
4634
+ });
4635
+ }
4636
+ return routes;
4637
+ };
4506
4638
  var createVoiceProofTrendRoutes = (options) => {
4507
4639
  const path = options.path ?? "/api/voice/proof-trends";
4508
4640
  const routes = new Elysia({
package/dist/index.d.ts CHANGED
@@ -30,10 +30,10 @@ export { assertVoicePlatformCoverage, buildVoicePlatformCoverageSummary, createV
30
30
  export { assertVoiceCompetitiveCoverage, buildVoiceCompetitiveCoverageReport, createVoiceCompetitiveCoverageRoutes, evaluateVoiceCompetitiveCoverage, renderVoiceCompetitiveCoverageHTML, renderVoiceCompetitiveCoverageMarkdown } from './competitiveCoverage';
31
31
  export type { VoiceCompetitiveCoverageAssertionInput, VoiceCompetitiveCoverageAssertionReport, VoiceCompetitiveCoverageIssue, VoiceCompetitiveCoverageLevel, VoiceCompetitiveCoverageReport, VoiceCompetitiveCoverageReportInput, VoiceCompetitiveCoverageRoutesOptions, VoiceCompetitiveCoverageStatus, VoiceCompetitiveCoverageSummary, VoiceCompetitiveDepthLevel, VoiceCompetitiveEvidence, VoiceCompetitiveSurface } from './competitiveCoverage';
32
32
  export type { VoicePlatformCoverageAssertionInput, VoicePlatformCoverageAssertionReport, VoicePlatformCoverageEvidence, VoicePlatformCoverageRoutesOptions, VoicePlatformCoverageStatus, VoicePlatformCoverageSummary, VoicePlatformCoverageSummaryInput, VoicePlatformCoverageSurface } from './platformCoverage';
33
- export { assertVoiceProofTrendEvidence, buildEmptyVoiceProofTrendReport, buildVoiceProofTrendProfileSummaries, buildVoiceProofTrendRecommendationReport, buildVoiceProofTrendReportFromRealCallProfiles, buildVoiceProofTrendReport, createVoiceProofTrendRecommendationRoutes, createVoiceProofTrendRoutes, DEFAULT_VOICE_PROOF_TREND_PROFILE_DEFINITIONS, DEFAULT_VOICE_PROOF_TRENDS_MAX_AGE_MS, evaluateVoiceProofTrendEvidence, formatVoiceProofTrendAge, normalizeVoiceProofTrendReport, readVoiceProofTrendReportFile, renderVoiceProofTrendRecommendationHTML, renderVoiceProofTrendRecommendationMarkdown } from './proofTrends';
33
+ export { assertVoiceProofTrendEvidence, buildEmptyVoiceProofTrendReport, buildVoiceProofTrendProfileSummaries, buildVoiceProofTrendRecommendationReport, buildVoiceProofTrendReportFromRealCallProfiles, buildVoiceProofTrendReport, buildVoiceRealCallProfileHistoryReport, createVoiceProofTrendRecommendationRoutes, createVoiceProofTrendRoutes, createVoiceRealCallProfileHistoryRoutes, DEFAULT_VOICE_PROOF_TREND_PROFILE_DEFINITIONS, DEFAULT_VOICE_PROOF_TRENDS_MAX_AGE_MS, evaluateVoiceProofTrendEvidence, formatVoiceProofTrendAge, normalizeVoiceProofTrendReport, readVoiceProofTrendReportFile, renderVoiceProofTrendRecommendationHTML, renderVoiceProofTrendRecommendationMarkdown, renderVoiceRealCallProfileHistoryHTML, renderVoiceRealCallProfileHistoryMarkdown } from './proofTrends';
34
34
  export { buildVoiceProviderDecisionTraceReport, createVoiceProviderDecisionTraceEvent, createVoiceProviderDecisionTraceRoutes, listVoiceProviderDecisionTraces, renderVoiceProviderDecisionTraceHTML, renderVoiceProviderDecisionTraceMarkdown } from './providerDecisionTraces';
35
35
  export type { VoiceProviderDecisionStatus, VoiceProviderDecisionSurfaceReport, VoiceProviderDecisionTrace, VoiceProviderDecisionTraceInput, VoiceProviderDecisionTraceIssue, VoiceProviderDecisionTraceReport, VoiceProviderDecisionTraceReportOptions, VoiceProviderDecisionTraceRoutesOptions } from './providerDecisionTraces';
36
- export type { VoiceProofTrendAssertionInput, VoiceProofTrendAssertionReport, VoiceProofTrendCycle, VoiceProofTrendProfileDefinition, VoiceProofTrendProfileRecommendation, VoiceProofTrendProfileSummaryOptions, VoiceProofTrendProfileSummary, VoiceProofTrendProviderRecommendation, VoiceProofTrendProviderSummary, VoiceProofTrendRecommendation, VoiceProofTrendRecommendationOptions, VoiceProofTrendRecommendationReport, VoiceProofTrendRecommendationRoutesOptions, VoiceProofTrendRecommendationStatus, VoiceProofTrendRecommendationSurface, VoiceProofTrendRealCallProfileEvidence, VoiceProofTrendRealCallProfileReportOptions, VoiceProofTrendReport, VoiceProofTrendReportInput, VoiceProofTrendRoutesOptions, VoiceProofTrendRuntimeChannelSummary, VoiceProofTrendStatus, VoiceProofTrendSummary } from './proofTrends';
36
+ export type { VoiceProofTrendAssertionInput, VoiceProofTrendAssertionReport, VoiceProofTrendCycle, VoiceProofTrendProfileDefinition, VoiceProofTrendProfileRecommendation, VoiceProofTrendProfileSummaryOptions, VoiceProofTrendProfileSummary, VoiceProofTrendProviderRecommendation, VoiceProofTrendProviderSummary, VoiceProofTrendRecommendation, VoiceProofTrendRecommendationOptions, VoiceProofTrendRecommendationReport, VoiceProofTrendRecommendationRoutesOptions, VoiceProofTrendRecommendationStatus, VoiceProofTrendRecommendationSurface, VoiceProofTrendRealCallProfileEvidence, VoiceProofTrendRealCallProfileReportOptions, VoiceProofTrendReport, VoiceProofTrendReportInput, VoiceProofTrendRoutesOptions, VoiceProofTrendRuntimeChannelSummary, VoiceProofTrendStatus, VoiceProofTrendSummary, VoiceRealCallProfileHistoryOptions, VoiceRealCallProfileHistoryReport, VoiceRealCallProfileHistoryRoutesOptions } from './proofTrends';
37
37
  export { assertVoiceSloCalibration, buildVoiceSloCalibrationReport, buildVoiceSloReadinessThresholdReport, createVoiceSloReadinessThresholdOptions, createVoiceSloReadinessThresholdRoutes, createVoiceSloThresholdProfile, createVoiceSloCalibrationRoutes, renderVoiceSloCalibrationMarkdown, renderVoiceSloReadinessThresholdHTML, renderVoiceSloReadinessThresholdMarkdown } from './sloCalibration';
38
38
  export type { VoiceSloCalibrationMetricKey, VoiceSloCalibrationOptions, VoiceSloCalibrationReport, VoiceSloCalibrationRoutesOptions, VoiceSloCalibrationSample, VoiceSloCalibrationStatus, VoiceSloCalibrationThreshold, VoiceSloCalibrationThresholds, VoiceSloReadinessThresholdReport, VoiceSloReadinessThresholdReportOptions, VoiceSloReadinessThresholdOptions, VoiceSloReadinessThresholdRoutesOptions, VoiceSloThresholdProfile } from './sloCalibration';
39
39
  export { assertVoiceLiveOpsControlEvidence, assertVoiceLiveOpsEvidence, buildVoiceLiveOpsControlState, createVoiceLiveOpsController, createVoiceLiveOpsRoutes, createVoiceMemoryLiveOpsControlStore, evaluateVoiceLiveOpsControlEvidence, evaluateVoiceLiveOpsEvidence, getVoiceLiveOpsControlStatus, VOICE_LIVE_OPS_ACTIONS } from './liveOps';
package/dist/index.js CHANGED
@@ -14731,6 +14731,7 @@ var normalizeVoiceProofTrendReport = (value, options = {}) => {
14731
14731
  return buildVoiceProofTrendReport({
14732
14732
  ...value,
14733
14733
  maxAgeMs: options.maxAgeMs ?? value.maxAgeMs,
14734
+ now: options.now ?? ("now" in value ? value.now : undefined),
14734
14735
  source: value.source ?? options.source
14735
14736
  });
14736
14737
  };
@@ -14987,6 +14988,65 @@ var buildVoiceProofTrendReportFromRealCallProfiles = (options) => {
14987
14988
  summary
14988
14989
  });
14989
14990
  };
14991
+ var flattenProofTrendCycles = (reports) => reports.flatMap((report) => report.cycles ?? []);
14992
+ var buildVoiceRealCallProfileHistoryReport = (options = {}) => {
14993
+ const generatedAt = options.generatedAt ?? (options.now instanceof Date ? options.now.toISOString() : typeof options.now === "number" ? new Date(options.now).toISOString() : typeof options.now === "string" ? new Date(options.now).toISOString() : new Date().toISOString());
14994
+ const evidenceReport = options.evidence && options.evidence.length > 0 ? buildVoiceProofTrendReportFromRealCallProfiles({
14995
+ ...options,
14996
+ evidence: options.evidence,
14997
+ generatedAt,
14998
+ source: `${options.source ?? "real-call-profile-history"}#evidence`
14999
+ }) : undefined;
15000
+ const history = [
15001
+ ...(options.reports ?? []).map((report) => normalizeVoiceProofTrendReport(report, {
15002
+ maxAgeMs: options.maxAgeMs,
15003
+ now: options.now
15004
+ })),
15005
+ ...evidenceReport ? [evidenceReport] : []
15006
+ ];
15007
+ const passingHistory = history.filter((report) => report.ok === true);
15008
+ const recommendationHistory = passingHistory.length > 0 ? passingHistory : history;
15009
+ const profiles = buildVoiceProofTrendProfileSummaries(recommendationHistory, options);
15010
+ const summary = {
15011
+ cycles: recommendationHistory.reduce((total, report) => total + (report.summary.cycles ?? report.cycles.length), 0),
15012
+ failedReports: history.filter((report) => report.ok !== true).length,
15013
+ maxLiveP95Ms: maxNumber(recommendationHistory.map(readProofTrendMaxLiveP95)),
15014
+ maxProviderP95Ms: maxNumber(recommendationHistory.map(readProofTrendMaxProviderP95)),
15015
+ maxTurnP95Ms: maxNumber(recommendationHistory.map(readProofTrendMaxTurnP95)),
15016
+ profileCount: profiles.length,
15017
+ profiles,
15018
+ providers: readProofTrendProviders(recommendationHistory),
15019
+ runtimeChannel: aggregateProofTrendRuntimeChannel(recommendationHistory.map(readProofTrendRuntimeChannel).filter((channel) => channel !== undefined))
15020
+ };
15021
+ const trend = buildVoiceProofTrendReport({
15022
+ baseUrl: options.baseUrl,
15023
+ cycles: flattenProofTrendCycles(recommendationHistory),
15024
+ generatedAt,
15025
+ maxAgeMs: options.maxAgeMs,
15026
+ now: options.now,
15027
+ ok: recommendationHistory.length > 0 && profiles.every((profile) => profile.status !== "fail"),
15028
+ source: options.source ?? "real-call-profile-history",
15029
+ summary
15030
+ });
15031
+ const recommendations = buildVoiceProofTrendRecommendationReport(trend, options);
15032
+ const issues = [
15033
+ ...recommendationHistory.length === 0 ? ["No passing real-call profile reports were present."] : [],
15034
+ ...profiles.length === 0 ? ["No benchmark profiles were present."] : [],
15035
+ ...recommendations.issues
15036
+ ];
15037
+ return {
15038
+ generatedAt,
15039
+ history,
15040
+ issues,
15041
+ ok: trend.ok && issues.length === 0,
15042
+ recommendations,
15043
+ reports: history.length,
15044
+ source: trend.source,
15045
+ status: issues.length > 0 ? trend.status === "pass" ? "fail" : trend.status : trend.status,
15046
+ summary,
15047
+ trend
15048
+ };
15049
+ };
14990
15050
  var normalizeProviderStatus = (status) => status === "pass" ? "pass" : status === "fail" ? "fail" : "warn";
14991
15051
  var providerSortScore = (provider) => [
14992
15052
  recommendationStatusRank[provider.status],
@@ -15363,6 +15423,37 @@ var renderVoiceProofTrendRecommendationHTML = (report, title = "Voice Provider R
15363
15423
  const profileRows = report.profiles.length === 0 ? "<li>No benchmark profiles were present.</li>" : report.profiles.map((profile) => `<li><strong>${escapeHtml23(profile.label ?? profile.id)}</strong><span>${escapeHtml23(profile.status)} \xB7 ${escapeHtml23(formatProviderMix(profile.bestProviders))}</span><small>${escapeHtml23(profile.nextMove)}</small></li>`).join("");
15364
15424
  return `<!doctype html><html lang="en"><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width,initial-scale=1" /><title>${escapeHtml23(title)}</title><style>body{background:#101418;color:#f7f3e8;font-family:ui-sans-serif,system-ui,sans-serif;margin:0}main{margin:auto;max-width:1120px;padding:32px}.hero,article{background:#17201d;border:1px solid #2e3d36;border-radius:24px;margin-bottom:16px;padding:22px}.hero{background:linear-gradient(135deg,rgba(20,184,166,.18),rgba(245,158,11,.12))}.eyebrow{color:#5eead4;font-weight:900;letter-spacing:.1em;text-transform:uppercase}h1{font-size:clamp(2.2rem,6vw,4.7rem);letter-spacing:-.06em;line-height:.92;margin:.2rem 0 1rem}.summary{display:flex;flex-wrap:wrap;gap:10px}.pill{border:1px solid #42534a;border-radius:999px;padding:8px 12px}.pass{border-color:rgba(34,197,94,.55)}.warn{border-color:rgba(245,158,11,.7)}.fail{border-color:rgba(239,68,68,.75)}pre{background:#0b1110;border-radius:14px;overflow:auto;padding:12px}a{color:#5eead4}li{margin:.45rem 0}li span,li small{display:block;color:#c9d3ca}</style></head><body><main><section class="hero"><p class="eyebrow">Sustained proof recommendations</p><h1>${escapeHtml23(title)}</h1><p>Generated ${escapeHtml23(report.generatedAt)} from ${escapeHtml23(report.source)}.</p><div class="summary"><span class="pill">Status ${escapeHtml23(report.status)}</span><span class="pill">Provider ${report.summary.keepCurrentProviderPath ? "keep" : "change"}</span><span class="pill">Best mix ${escapeHtml23(formatProviderMix(report.bestProviders))}</span><span class="pill">Profiles ${String(report.profiles.length)}</span><span class="pill">Runtime ${report.summary.keepCurrentRuntimeChannel ? "keep" : "tune"}</span><span class="pill">${String(report.summary.recommendedActions)} action(s)</span></div></section>${cards}<section class="hero"><h2>Benchmark Profiles</h2><ul>${profileRows}</ul></section><section class="hero"><h2>Provider Comparison</h2><ul>${providerRows}</ul></section><section class="hero"><h2>Issues</h2><ul>${issues}</ul></section></main></body></html>`;
15365
15425
  };
15426
+ var renderVoiceRealCallProfileHistoryMarkdown = (report, title = "Voice Real-Call Profile History") => [
15427
+ `# ${title}`,
15428
+ "",
15429
+ `- Status: ${report.status}`,
15430
+ `- Reports: ${String(report.reports)}`,
15431
+ `- Profiles: ${String(report.summary.profileCount)}`,
15432
+ `- Cycles: ${String(report.summary.cycles ?? 0)}`,
15433
+ `- Source: ${report.source}`,
15434
+ `- Best provider mix: ${formatProviderMix(report.recommendations.bestProviders)}`,
15435
+ "",
15436
+ "## Profiles",
15437
+ "",
15438
+ "| Profile | Status | Live p95 | Provider p95 | Turn p95 | Provider mix |",
15439
+ "| --- | --- | ---: | ---: | ---: | --- |",
15440
+ ...report.summary.profiles?.length ? report.summary.profiles.map((profile) => `| ${escapeMarkdown2(profile.label ?? profile.id)} | ${profile.status ?? "unknown"} | ${profile.maxLiveP95Ms ?? "n/a"} | ${profile.maxProviderP95Ms ?? "n/a"} | ${profile.maxTurnP95Ms ?? "n/a"} | ${escapeMarkdown2(formatProviderMix(profile.providers ?? []))} |`) : ["| n/a | n/a | n/a | n/a | n/a | No profiles present. |"],
15441
+ "",
15442
+ "## Recommendations",
15443
+ "",
15444
+ ...report.recommendations.recommendations.map((recommendation) => `- ${recommendation.status}: ${recommendation.recommendation} ${recommendation.nextMove}`),
15445
+ "",
15446
+ "## Issues",
15447
+ "",
15448
+ ...report.issues.length ? report.issues.map((issue) => `- ${issue}`) : ["- None"]
15449
+ ].join(`
15450
+ `);
15451
+ var renderVoiceRealCallProfileHistoryHTML = (report, title = "Voice Real-Call Profile History") => {
15452
+ const profileRows = report.summary.profiles?.length ? report.summary.profiles.map((profile) => `<tr><td>${escapeHtml23(profile.label ?? profile.id)}</td><td>${escapeHtml23(profile.status ?? "unknown")}</td><td>${escapeHtml23(profile.maxLiveP95Ms ?? "n/a")}</td><td>${escapeHtml23(profile.maxProviderP95Ms ?? "n/a")}</td><td>${escapeHtml23(profile.maxTurnP95Ms ?? "n/a")}</td><td>${escapeHtml23(formatProviderMix(profile.providers ?? []))}</td></tr>`).join("") : '<tr><td colspan="6">No profiles present.</td></tr>';
15453
+ const recommendations = report.recommendations.recommendations.map((recommendation) => `<article class="${escapeHtml23(recommendation.status)}"><p class="eyebrow">${escapeHtml23(recommendation.surface)} \xB7 ${escapeHtml23(recommendation.status)}</p><h2>${escapeHtml23(recommendation.recommendation)}</h2><p>${escapeHtml23(recommendation.nextMove)}</p></article>`).join("");
15454
+ const issues = report.issues.length === 0 ? "<li>None</li>" : report.issues.map((issue) => `<li>${escapeHtml23(issue)}</li>`).join("");
15455
+ return `<!doctype html><html lang="en"><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width,initial-scale=1" /><title>${escapeHtml23(title)}</title><style>body{background:#111510;color:#f6f0dd;font-family:ui-sans-serif,system-ui,sans-serif;margin:0}main{margin:auto;max-width:1120px;padding:32px}.hero,article,.card{background:#182117;border:1px solid #32412d;border-radius:24px;margin-bottom:16px;padding:22px}.hero{background:linear-gradient(135deg,rgba(132,204,22,.16),rgba(20,184,166,.12))}.eyebrow{color:#bef264;font-weight:900;letter-spacing:.1em;text-transform:uppercase}h1{font-size:clamp(2.2rem,6vw,4.7rem);letter-spacing:-.06em;line-height:.92;margin:.2rem 0 1rem}.summary{display:flex;flex-wrap:wrap;gap:10px}.pill{border:1px solid #52624b;border-radius:999px;padding:8px 12px}.pass{border-color:rgba(34,197,94,.55)}.warn{border-color:rgba(245,158,11,.7)}.fail{border-color:rgba(239,68,68,.75)}table{border-collapse:collapse;width:100%}td,th{border-bottom:1px solid #32412d;padding:10px;text-align:left}</style></head><body><main><section class="hero"><p class="eyebrow">Real-call benchmark history</p><h1>${escapeHtml23(title)}</h1><p>Generated ${escapeHtml23(report.generatedAt)} from ${escapeHtml23(report.source)}.</p><div class="summary"><span class="pill">Status ${escapeHtml23(report.status)}</span><span class="pill">Reports ${String(report.reports)}</span><span class="pill">Profiles ${String(report.summary.profileCount)}</span><span class="pill">Cycles ${String(report.summary.cycles ?? 0)}</span><span class="pill">Best mix ${escapeHtml23(formatProviderMix(report.recommendations.bestProviders))}</span></div></section><section class="card"><h2>Profiles</h2><table><thead><tr><th>Profile</th><th>Status</th><th>Live p95</th><th>Provider p95</th><th>Turn p95</th><th>Provider mix</th></tr></thead><tbody>${profileRows}</tbody></table></section>${recommendations}<section class="card"><h2>Issues</h2><ul>${issues}</ul></section></main></body></html>`;
15456
+ };
15366
15457
  var createVoiceProofTrendRecommendationRoutes = (options) => {
15367
15458
  const path = options.path ?? "/api/voice/proof-trend-recommendations";
15368
15459
  const htmlPath = options.htmlPath === undefined ? "/voice/proof-trend-recommendations" : options.htmlPath;
@@ -15405,6 +15496,47 @@ var createVoiceProofTrendRecommendationRoutes = (options) => {
15405
15496
  }
15406
15497
  return routes;
15407
15498
  };
15499
+ var createVoiceRealCallProfileHistoryRoutes = (options = {}) => {
15500
+ const path = options.path ?? "/api/voice/real-call-profile-history";
15501
+ const htmlPath = options.htmlPath === undefined ? "/voice/real-call-profile-history" : options.htmlPath;
15502
+ const markdownPath = options.markdownPath === undefined ? "/voice/real-call-profile-history.md" : options.markdownPath;
15503
+ const title = options.title ?? "Voice Real-Call Profile History";
15504
+ const routes = new Elysia21({
15505
+ name: options.name ?? "absolutejs-voice-real-call-profile-history"
15506
+ });
15507
+ const loadReport = async () => {
15508
+ const { source, ...routeOptions } = options;
15509
+ const sourceOptions = source === undefined ? routeOptions : typeof source === "function" ? await source() : source;
15510
+ return buildVoiceRealCallProfileHistoryReport({
15511
+ ...routeOptions,
15512
+ ...sourceOptions
15513
+ });
15514
+ };
15515
+ routes.get(path, async () => Response.json(await loadReport(), { headers: options.headers }));
15516
+ if (htmlPath !== false) {
15517
+ routes.get(htmlPath, async () => {
15518
+ const report = await loadReport();
15519
+ return new Response(renderVoiceRealCallProfileHistoryHTML(report, title), {
15520
+ headers: {
15521
+ "content-type": "text/html; charset=utf-8",
15522
+ ...Object.fromEntries(new Headers(options.headers))
15523
+ }
15524
+ });
15525
+ });
15526
+ }
15527
+ if (markdownPath !== false) {
15528
+ routes.get(markdownPath, async () => {
15529
+ const report = await loadReport();
15530
+ return new Response(renderVoiceRealCallProfileHistoryMarkdown(report, title), {
15531
+ headers: {
15532
+ "content-type": "text/markdown; charset=utf-8",
15533
+ ...Object.fromEntries(new Headers(options.headers))
15534
+ }
15535
+ });
15536
+ });
15537
+ }
15538
+ return routes;
15539
+ };
15408
15540
  var createVoiceProofTrendRoutes = (options) => {
15409
15541
  const path = options.path ?? "/api/voice/proof-trends";
15410
15542
  const routes = new Elysia21({
@@ -36985,6 +37117,8 @@ export {
36985
37117
  renderVoiceRealtimeProviderContractHTML,
36986
37118
  renderVoiceRealtimeChannelMarkdown,
36987
37119
  renderVoiceRealtimeChannelHTML,
37120
+ renderVoiceRealCallProfileHistoryMarkdown,
37121
+ renderVoiceRealCallProfileHistoryHTML,
36988
37122
  renderVoiceQualityHTML,
36989
37123
  renderVoiceProviderSloMarkdown,
36990
37124
  renderVoiceProviderSloHTML,
@@ -37228,6 +37362,7 @@ export {
37228
37362
  createVoiceRealtimeProviderContractRoutes,
37229
37363
  createVoiceRealtimeProviderContractMatrixPreset,
37230
37364
  createVoiceRealtimeChannelRoutes,
37365
+ createVoiceRealCallProfileHistoryRoutes,
37231
37366
  createVoiceReadinessProfile,
37232
37367
  createVoiceQualityRoutes,
37233
37368
  createVoiceProviderSloRoutes,
@@ -37438,6 +37573,7 @@ export {
37438
37573
  buildVoiceRealtimeProviderContractMatrix,
37439
37574
  buildVoiceRealtimeChannelRuntimeSamplesFromTrace,
37440
37575
  buildVoiceRealtimeChannelReport,
37576
+ buildVoiceRealCallProfileHistoryReport,
37441
37577
  buildVoiceProviderSloReport,
37442
37578
  buildVoiceProviderOrchestrationReport,
37443
37579
  buildVoiceProviderDecisionTraceReport,
@@ -257,6 +257,39 @@ export type VoiceProofTrendRecommendationRoutesOptions = VoiceProofTrendRecommen
257
257
  source?: (() => Promise<VoiceProofTrendReport | VoiceProofTrendReportInput> | VoiceProofTrendReport | VoiceProofTrendReportInput) | VoiceProofTrendReport | VoiceProofTrendReportInput;
258
258
  title?: string;
259
259
  };
260
+ export type VoiceRealCallProfileHistoryReport = {
261
+ generatedAt: string;
262
+ history: VoiceProofTrendReport[];
263
+ issues: string[];
264
+ ok: boolean;
265
+ recommendations: VoiceProofTrendRecommendationReport;
266
+ reports: number;
267
+ source: string;
268
+ status: VoiceProofTrendStatus;
269
+ summary: VoiceProofTrendSummary & {
270
+ failedReports: number;
271
+ profileCount: number;
272
+ };
273
+ trend: VoiceProofTrendReport;
274
+ };
275
+ export type VoiceRealCallProfileHistoryOptions = VoiceProofTrendProfileSummaryOptions & VoiceProofTrendRecommendationOptions & {
276
+ baseUrl?: string;
277
+ evidence?: readonly VoiceProofTrendRealCallProfileEvidence[];
278
+ generatedAt?: string;
279
+ maxAgeMs?: number;
280
+ now?: Date | number | string;
281
+ reports?: readonly (VoiceProofTrendReport | VoiceProofTrendReportInput)[];
282
+ source?: string;
283
+ };
284
+ export type VoiceRealCallProfileHistoryRoutesOptions = Omit<VoiceRealCallProfileHistoryOptions, 'source'> & {
285
+ headers?: HeadersInit;
286
+ htmlPath?: false | string;
287
+ markdownPath?: false | string;
288
+ name?: string;
289
+ path?: string;
290
+ source?: (() => Promise<VoiceRealCallProfileHistoryOptions> | VoiceRealCallProfileHistoryOptions) | VoiceRealCallProfileHistoryOptions;
291
+ title?: string;
292
+ };
260
293
  export declare const DEFAULT_VOICE_PROOF_TRENDS_MAX_AGE_MS: number;
261
294
  export declare const DEFAULT_VOICE_PROOF_TREND_PROFILE_DEFINITIONS: ({
262
295
  description: string;
@@ -279,6 +312,7 @@ export declare const buildVoiceProofTrendReport: (input?: VoiceProofTrendReportI
279
312
  export declare const buildEmptyVoiceProofTrendReport: (source?: string, maxAgeMs?: number) => VoiceProofTrendReport;
280
313
  export declare const normalizeVoiceProofTrendReport: (value: VoiceProofTrendReport | VoiceProofTrendReportInput, options?: {
281
314
  maxAgeMs?: number;
315
+ now?: Date | number | string;
282
316
  source?: string;
283
317
  }) => VoiceProofTrendReport;
284
318
  export declare const readVoiceProofTrendReportFile: (path: string, options?: {
@@ -286,11 +320,14 @@ export declare const readVoiceProofTrendReportFile: (path: string, options?: {
286
320
  }) => Promise<VoiceProofTrendReport>;
287
321
  export declare const buildVoiceProofTrendProfileSummaries: (input: VoiceProofTrendReport | readonly VoiceProofTrendReport[], options?: VoiceProofTrendProfileSummaryOptions) => VoiceProofTrendProfileSummary[];
288
322
  export declare const buildVoiceProofTrendReportFromRealCallProfiles: (options: VoiceProofTrendRealCallProfileReportOptions) => VoiceProofTrendReport;
323
+ export declare const buildVoiceRealCallProfileHistoryReport: (options?: VoiceRealCallProfileHistoryOptions) => VoiceRealCallProfileHistoryReport;
289
324
  export declare const evaluateVoiceProofTrendEvidence: (report: VoiceProofTrendReport, input?: VoiceProofTrendAssertionInput) => VoiceProofTrendAssertionReport;
290
325
  export declare const assertVoiceProofTrendEvidence: (report: VoiceProofTrendReport, input?: VoiceProofTrendAssertionInput) => VoiceProofTrendAssertionReport;
291
326
  export declare const buildVoiceProofTrendRecommendationReport: (report: VoiceProofTrendReport, options?: VoiceProofTrendRecommendationOptions) => VoiceProofTrendRecommendationReport;
292
327
  export declare const renderVoiceProofTrendRecommendationMarkdown: (report: VoiceProofTrendRecommendationReport, title?: string) => string;
293
328
  export declare const renderVoiceProofTrendRecommendationHTML: (report: VoiceProofTrendRecommendationReport, title?: string) => string;
329
+ export declare const renderVoiceRealCallProfileHistoryMarkdown: (report: VoiceRealCallProfileHistoryReport, title?: string) => string;
330
+ export declare const renderVoiceRealCallProfileHistoryHTML: (report: VoiceRealCallProfileHistoryReport, title?: string) => string;
294
331
  export declare const createVoiceProofTrendRecommendationRoutes: (options: VoiceProofTrendRecommendationRoutesOptions) => Elysia<"", {
295
332
  decorator: {};
296
333
  store: {};
@@ -319,6 +356,34 @@ export declare const createVoiceProofTrendRecommendationRoutes: (options: VoiceP
319
356
  standaloneSchema: {};
320
357
  response: {};
321
358
  }>;
359
+ export declare const createVoiceRealCallProfileHistoryRoutes: (options?: VoiceRealCallProfileHistoryRoutesOptions) => Elysia<"", {
360
+ decorator: {};
361
+ store: {};
362
+ derive: {};
363
+ resolve: {};
364
+ }, {
365
+ typebox: {};
366
+ error: {};
367
+ }, {
368
+ schema: {};
369
+ standaloneSchema: {};
370
+ macro: {};
371
+ macroFn: {};
372
+ parser: {};
373
+ response: {};
374
+ }, {}, {
375
+ derive: {};
376
+ resolve: {};
377
+ schema: {};
378
+ standaloneSchema: {};
379
+ response: {};
380
+ }, {
381
+ derive: {};
382
+ resolve: {};
383
+ schema: {};
384
+ standaloneSchema: {};
385
+ response: {};
386
+ }>;
322
387
  export declare const createVoiceProofTrendRoutes: (options: VoiceProofTrendRoutesOptions) => Elysia<"", {
323
388
  decorator: {};
324
389
  store: {};
@@ -1577,6 +1577,7 @@ var normalizeVoiceProofTrendReport = (value, options = {}) => {
1577
1577
  return buildVoiceProofTrendReport({
1578
1578
  ...value,
1579
1579
  maxAgeMs: options.maxAgeMs ?? value.maxAgeMs,
1580
+ now: options.now ?? ("now" in value ? value.now : undefined),
1580
1581
  source: value.source ?? options.source
1581
1582
  });
1582
1583
  };
@@ -1833,6 +1834,65 @@ var buildVoiceProofTrendReportFromRealCallProfiles = (options) => {
1833
1834
  summary
1834
1835
  });
1835
1836
  };
1837
+ var flattenProofTrendCycles = (reports) => reports.flatMap((report) => report.cycles ?? []);
1838
+ var buildVoiceRealCallProfileHistoryReport = (options = {}) => {
1839
+ const generatedAt = options.generatedAt ?? (options.now instanceof Date ? options.now.toISOString() : typeof options.now === "number" ? new Date(options.now).toISOString() : typeof options.now === "string" ? new Date(options.now).toISOString() : new Date().toISOString());
1840
+ const evidenceReport = options.evidence && options.evidence.length > 0 ? buildVoiceProofTrendReportFromRealCallProfiles({
1841
+ ...options,
1842
+ evidence: options.evidence,
1843
+ generatedAt,
1844
+ source: `${options.source ?? "real-call-profile-history"}#evidence`
1845
+ }) : undefined;
1846
+ const history = [
1847
+ ...(options.reports ?? []).map((report) => normalizeVoiceProofTrendReport(report, {
1848
+ maxAgeMs: options.maxAgeMs,
1849
+ now: options.now
1850
+ })),
1851
+ ...evidenceReport ? [evidenceReport] : []
1852
+ ];
1853
+ const passingHistory = history.filter((report) => report.ok === true);
1854
+ const recommendationHistory = passingHistory.length > 0 ? passingHistory : history;
1855
+ const profiles = buildVoiceProofTrendProfileSummaries(recommendationHistory, options);
1856
+ const summary = {
1857
+ cycles: recommendationHistory.reduce((total, report) => total + (report.summary.cycles ?? report.cycles.length), 0),
1858
+ failedReports: history.filter((report) => report.ok !== true).length,
1859
+ maxLiveP95Ms: maxNumber(recommendationHistory.map(readProofTrendMaxLiveP95)),
1860
+ maxProviderP95Ms: maxNumber(recommendationHistory.map(readProofTrendMaxProviderP95)),
1861
+ maxTurnP95Ms: maxNumber(recommendationHistory.map(readProofTrendMaxTurnP95)),
1862
+ profileCount: profiles.length,
1863
+ profiles,
1864
+ providers: readProofTrendProviders(recommendationHistory),
1865
+ runtimeChannel: aggregateProofTrendRuntimeChannel(recommendationHistory.map(readProofTrendRuntimeChannel).filter((channel) => channel !== undefined))
1866
+ };
1867
+ const trend = buildVoiceProofTrendReport({
1868
+ baseUrl: options.baseUrl,
1869
+ cycles: flattenProofTrendCycles(recommendationHistory),
1870
+ generatedAt,
1871
+ maxAgeMs: options.maxAgeMs,
1872
+ now: options.now,
1873
+ ok: recommendationHistory.length > 0 && profiles.every((profile) => profile.status !== "fail"),
1874
+ source: options.source ?? "real-call-profile-history",
1875
+ summary
1876
+ });
1877
+ const recommendations = buildVoiceProofTrendRecommendationReport(trend, options);
1878
+ const issues = [
1879
+ ...recommendationHistory.length === 0 ? ["No passing real-call profile reports were present."] : [],
1880
+ ...profiles.length === 0 ? ["No benchmark profiles were present."] : [],
1881
+ ...recommendations.issues
1882
+ ];
1883
+ return {
1884
+ generatedAt,
1885
+ history,
1886
+ issues,
1887
+ ok: trend.ok && issues.length === 0,
1888
+ recommendations,
1889
+ reports: history.length,
1890
+ source: trend.source,
1891
+ status: issues.length > 0 ? trend.status === "pass" ? "fail" : trend.status : trend.status,
1892
+ summary,
1893
+ trend
1894
+ };
1895
+ };
1836
1896
  var normalizeProviderStatus = (status) => status === "pass" ? "pass" : status === "fail" ? "fail" : "warn";
1837
1897
  var providerSortScore = (provider) => [
1838
1898
  recommendationStatusRank[provider.status],
@@ -2209,6 +2269,37 @@ var renderVoiceProofTrendRecommendationHTML = (report, title = "Voice Provider R
2209
2269
  const profileRows = report.profiles.length === 0 ? "<li>No benchmark profiles were present.</li>" : report.profiles.map((profile) => `<li><strong>${escapeHtml5(profile.label ?? profile.id)}</strong><span>${escapeHtml5(profile.status)} \xB7 ${escapeHtml5(formatProviderMix(profile.bestProviders))}</span><small>${escapeHtml5(profile.nextMove)}</small></li>`).join("");
2210
2270
  return `<!doctype html><html lang="en"><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width,initial-scale=1" /><title>${escapeHtml5(title)}</title><style>body{background:#101418;color:#f7f3e8;font-family:ui-sans-serif,system-ui,sans-serif;margin:0}main{margin:auto;max-width:1120px;padding:32px}.hero,article{background:#17201d;border:1px solid #2e3d36;border-radius:24px;margin-bottom:16px;padding:22px}.hero{background:linear-gradient(135deg,rgba(20,184,166,.18),rgba(245,158,11,.12))}.eyebrow{color:#5eead4;font-weight:900;letter-spacing:.1em;text-transform:uppercase}h1{font-size:clamp(2.2rem,6vw,4.7rem);letter-spacing:-.06em;line-height:.92;margin:.2rem 0 1rem}.summary{display:flex;flex-wrap:wrap;gap:10px}.pill{border:1px solid #42534a;border-radius:999px;padding:8px 12px}.pass{border-color:rgba(34,197,94,.55)}.warn{border-color:rgba(245,158,11,.7)}.fail{border-color:rgba(239,68,68,.75)}pre{background:#0b1110;border-radius:14px;overflow:auto;padding:12px}a{color:#5eead4}li{margin:.45rem 0}li span,li small{display:block;color:#c9d3ca}</style></head><body><main><section class="hero"><p class="eyebrow">Sustained proof recommendations</p><h1>${escapeHtml5(title)}</h1><p>Generated ${escapeHtml5(report.generatedAt)} from ${escapeHtml5(report.source)}.</p><div class="summary"><span class="pill">Status ${escapeHtml5(report.status)}</span><span class="pill">Provider ${report.summary.keepCurrentProviderPath ? "keep" : "change"}</span><span class="pill">Best mix ${escapeHtml5(formatProviderMix(report.bestProviders))}</span><span class="pill">Profiles ${String(report.profiles.length)}</span><span class="pill">Runtime ${report.summary.keepCurrentRuntimeChannel ? "keep" : "tune"}</span><span class="pill">${String(report.summary.recommendedActions)} action(s)</span></div></section>${cards}<section class="hero"><h2>Benchmark Profiles</h2><ul>${profileRows}</ul></section><section class="hero"><h2>Provider Comparison</h2><ul>${providerRows}</ul></section><section class="hero"><h2>Issues</h2><ul>${issues}</ul></section></main></body></html>`;
2211
2271
  };
2272
+ var renderVoiceRealCallProfileHistoryMarkdown = (report, title = "Voice Real-Call Profile History") => [
2273
+ `# ${title}`,
2274
+ "",
2275
+ `- Status: ${report.status}`,
2276
+ `- Reports: ${String(report.reports)}`,
2277
+ `- Profiles: ${String(report.summary.profileCount)}`,
2278
+ `- Cycles: ${String(report.summary.cycles ?? 0)}`,
2279
+ `- Source: ${report.source}`,
2280
+ `- Best provider mix: ${formatProviderMix(report.recommendations.bestProviders)}`,
2281
+ "",
2282
+ "## Profiles",
2283
+ "",
2284
+ "| Profile | Status | Live p95 | Provider p95 | Turn p95 | Provider mix |",
2285
+ "| --- | --- | ---: | ---: | ---: | --- |",
2286
+ ...report.summary.profiles?.length ? report.summary.profiles.map((profile) => `| ${escapeMarkdown(profile.label ?? profile.id)} | ${profile.status ?? "unknown"} | ${profile.maxLiveP95Ms ?? "n/a"} | ${profile.maxProviderP95Ms ?? "n/a"} | ${profile.maxTurnP95Ms ?? "n/a"} | ${escapeMarkdown(formatProviderMix(profile.providers ?? []))} |`) : ["| n/a | n/a | n/a | n/a | n/a | No profiles present. |"],
2287
+ "",
2288
+ "## Recommendations",
2289
+ "",
2290
+ ...report.recommendations.recommendations.map((recommendation) => `- ${recommendation.status}: ${recommendation.recommendation} ${recommendation.nextMove}`),
2291
+ "",
2292
+ "## Issues",
2293
+ "",
2294
+ ...report.issues.length ? report.issues.map((issue) => `- ${issue}`) : ["- None"]
2295
+ ].join(`
2296
+ `);
2297
+ var renderVoiceRealCallProfileHistoryHTML = (report, title = "Voice Real-Call Profile History") => {
2298
+ const profileRows = report.summary.profiles?.length ? report.summary.profiles.map((profile) => `<tr><td>${escapeHtml5(profile.label ?? profile.id)}</td><td>${escapeHtml5(profile.status ?? "unknown")}</td><td>${escapeHtml5(profile.maxLiveP95Ms ?? "n/a")}</td><td>${escapeHtml5(profile.maxProviderP95Ms ?? "n/a")}</td><td>${escapeHtml5(profile.maxTurnP95Ms ?? "n/a")}</td><td>${escapeHtml5(formatProviderMix(profile.providers ?? []))}</td></tr>`).join("") : '<tr><td colspan="6">No profiles present.</td></tr>';
2299
+ const recommendations = report.recommendations.recommendations.map((recommendation) => `<article class="${escapeHtml5(recommendation.status)}"><p class="eyebrow">${escapeHtml5(recommendation.surface)} \xB7 ${escapeHtml5(recommendation.status)}</p><h2>${escapeHtml5(recommendation.recommendation)}</h2><p>${escapeHtml5(recommendation.nextMove)}</p></article>`).join("");
2300
+ const issues = report.issues.length === 0 ? "<li>None</li>" : report.issues.map((issue) => `<li>${escapeHtml5(issue)}</li>`).join("");
2301
+ return `<!doctype html><html lang="en"><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width,initial-scale=1" /><title>${escapeHtml5(title)}</title><style>body{background:#111510;color:#f6f0dd;font-family:ui-sans-serif,system-ui,sans-serif;margin:0}main{margin:auto;max-width:1120px;padding:32px}.hero,article,.card{background:#182117;border:1px solid #32412d;border-radius:24px;margin-bottom:16px;padding:22px}.hero{background:linear-gradient(135deg,rgba(132,204,22,.16),rgba(20,184,166,.12))}.eyebrow{color:#bef264;font-weight:900;letter-spacing:.1em;text-transform:uppercase}h1{font-size:clamp(2.2rem,6vw,4.7rem);letter-spacing:-.06em;line-height:.92;margin:.2rem 0 1rem}.summary{display:flex;flex-wrap:wrap;gap:10px}.pill{border:1px solid #52624b;border-radius:999px;padding:8px 12px}.pass{border-color:rgba(34,197,94,.55)}.warn{border-color:rgba(245,158,11,.7)}.fail{border-color:rgba(239,68,68,.75)}table{border-collapse:collapse;width:100%}td,th{border-bottom:1px solid #32412d;padding:10px;text-align:left}</style></head><body><main><section class="hero"><p class="eyebrow">Real-call benchmark history</p><h1>${escapeHtml5(title)}</h1><p>Generated ${escapeHtml5(report.generatedAt)} from ${escapeHtml5(report.source)}.</p><div class="summary"><span class="pill">Status ${escapeHtml5(report.status)}</span><span class="pill">Reports ${String(report.reports)}</span><span class="pill">Profiles ${String(report.summary.profileCount)}</span><span class="pill">Cycles ${String(report.summary.cycles ?? 0)}</span><span class="pill">Best mix ${escapeHtml5(formatProviderMix(report.recommendations.bestProviders))}</span></div></section><section class="card"><h2>Profiles</h2><table><thead><tr><th>Profile</th><th>Status</th><th>Live p95</th><th>Provider p95</th><th>Turn p95</th><th>Provider mix</th></tr></thead><tbody>${profileRows}</tbody></table></section>${recommendations}<section class="card"><h2>Issues</h2><ul>${issues}</ul></section></main></body></html>`;
2302
+ };
2212
2303
  var createVoiceProofTrendRecommendationRoutes = (options) => {
2213
2304
  const path = options.path ?? "/api/voice/proof-trend-recommendations";
2214
2305
  const htmlPath = options.htmlPath === undefined ? "/voice/proof-trend-recommendations" : options.htmlPath;
@@ -2251,6 +2342,47 @@ var createVoiceProofTrendRecommendationRoutes = (options) => {
2251
2342
  }
2252
2343
  return routes;
2253
2344
  };
2345
+ var createVoiceRealCallProfileHistoryRoutes = (options = {}) => {
2346
+ const path = options.path ?? "/api/voice/real-call-profile-history";
2347
+ const htmlPath = options.htmlPath === undefined ? "/voice/real-call-profile-history" : options.htmlPath;
2348
+ const markdownPath = options.markdownPath === undefined ? "/voice/real-call-profile-history.md" : options.markdownPath;
2349
+ const title = options.title ?? "Voice Real-Call Profile History";
2350
+ const routes = new Elysia({
2351
+ name: options.name ?? "absolutejs-voice-real-call-profile-history"
2352
+ });
2353
+ const loadReport = async () => {
2354
+ const { source, ...routeOptions } = options;
2355
+ const sourceOptions = source === undefined ? routeOptions : typeof source === "function" ? await source() : source;
2356
+ return buildVoiceRealCallProfileHistoryReport({
2357
+ ...routeOptions,
2358
+ ...sourceOptions
2359
+ });
2360
+ };
2361
+ routes.get(path, async () => Response.json(await loadReport(), { headers: options.headers }));
2362
+ if (htmlPath !== false) {
2363
+ routes.get(htmlPath, async () => {
2364
+ const report = await loadReport();
2365
+ return new Response(renderVoiceRealCallProfileHistoryHTML(report, title), {
2366
+ headers: {
2367
+ "content-type": "text/html; charset=utf-8",
2368
+ ...Object.fromEntries(new Headers(options.headers))
2369
+ }
2370
+ });
2371
+ });
2372
+ }
2373
+ if (markdownPath !== false) {
2374
+ routes.get(markdownPath, async () => {
2375
+ const report = await loadReport();
2376
+ return new Response(renderVoiceRealCallProfileHistoryMarkdown(report, title), {
2377
+ headers: {
2378
+ "content-type": "text/markdown; charset=utf-8",
2379
+ ...Object.fromEntries(new Headers(options.headers))
2380
+ }
2381
+ });
2382
+ });
2383
+ }
2384
+ return routes;
2385
+ };
2254
2386
  var createVoiceProofTrendRoutes = (options) => {
2255
2387
  const path = options.path ?? "/api/voice/proof-trends";
2256
2388
  const routes = new Elysia({
package/dist/vue/index.js CHANGED
@@ -1498,6 +1498,7 @@ var normalizeVoiceProofTrendReport = (value, options = {}) => {
1498
1498
  return buildVoiceProofTrendReport({
1499
1499
  ...value,
1500
1500
  maxAgeMs: options.maxAgeMs ?? value.maxAgeMs,
1501
+ now: options.now ?? ("now" in value ? value.now : undefined),
1501
1502
  source: value.source ?? options.source
1502
1503
  });
1503
1504
  };
@@ -1754,6 +1755,65 @@ var buildVoiceProofTrendReportFromRealCallProfiles = (options) => {
1754
1755
  summary
1755
1756
  });
1756
1757
  };
1758
+ var flattenProofTrendCycles = (reports) => reports.flatMap((report) => report.cycles ?? []);
1759
+ var buildVoiceRealCallProfileHistoryReport = (options = {}) => {
1760
+ const generatedAt = options.generatedAt ?? (options.now instanceof Date ? options.now.toISOString() : typeof options.now === "number" ? new Date(options.now).toISOString() : typeof options.now === "string" ? new Date(options.now).toISOString() : new Date().toISOString());
1761
+ const evidenceReport = options.evidence && options.evidence.length > 0 ? buildVoiceProofTrendReportFromRealCallProfiles({
1762
+ ...options,
1763
+ evidence: options.evidence,
1764
+ generatedAt,
1765
+ source: `${options.source ?? "real-call-profile-history"}#evidence`
1766
+ }) : undefined;
1767
+ const history = [
1768
+ ...(options.reports ?? []).map((report) => normalizeVoiceProofTrendReport(report, {
1769
+ maxAgeMs: options.maxAgeMs,
1770
+ now: options.now
1771
+ })),
1772
+ ...evidenceReport ? [evidenceReport] : []
1773
+ ];
1774
+ const passingHistory = history.filter((report) => report.ok === true);
1775
+ const recommendationHistory = passingHistory.length > 0 ? passingHistory : history;
1776
+ const profiles = buildVoiceProofTrendProfileSummaries(recommendationHistory, options);
1777
+ const summary = {
1778
+ cycles: recommendationHistory.reduce((total, report) => total + (report.summary.cycles ?? report.cycles.length), 0),
1779
+ failedReports: history.filter((report) => report.ok !== true).length,
1780
+ maxLiveP95Ms: maxNumber(recommendationHistory.map(readProofTrendMaxLiveP95)),
1781
+ maxProviderP95Ms: maxNumber(recommendationHistory.map(readProofTrendMaxProviderP95)),
1782
+ maxTurnP95Ms: maxNumber(recommendationHistory.map(readProofTrendMaxTurnP95)),
1783
+ profileCount: profiles.length,
1784
+ profiles,
1785
+ providers: readProofTrendProviders(recommendationHistory),
1786
+ runtimeChannel: aggregateProofTrendRuntimeChannel(recommendationHistory.map(readProofTrendRuntimeChannel).filter((channel) => channel !== undefined))
1787
+ };
1788
+ const trend = buildVoiceProofTrendReport({
1789
+ baseUrl: options.baseUrl,
1790
+ cycles: flattenProofTrendCycles(recommendationHistory),
1791
+ generatedAt,
1792
+ maxAgeMs: options.maxAgeMs,
1793
+ now: options.now,
1794
+ ok: recommendationHistory.length > 0 && profiles.every((profile) => profile.status !== "fail"),
1795
+ source: options.source ?? "real-call-profile-history",
1796
+ summary
1797
+ });
1798
+ const recommendations = buildVoiceProofTrendRecommendationReport(trend, options);
1799
+ const issues = [
1800
+ ...recommendationHistory.length === 0 ? ["No passing real-call profile reports were present."] : [],
1801
+ ...profiles.length === 0 ? ["No benchmark profiles were present."] : [],
1802
+ ...recommendations.issues
1803
+ ];
1804
+ return {
1805
+ generatedAt,
1806
+ history,
1807
+ issues,
1808
+ ok: trend.ok && issues.length === 0,
1809
+ recommendations,
1810
+ reports: history.length,
1811
+ source: trend.source,
1812
+ status: issues.length > 0 ? trend.status === "pass" ? "fail" : trend.status : trend.status,
1813
+ summary,
1814
+ trend
1815
+ };
1816
+ };
1757
1817
  var normalizeProviderStatus = (status) => status === "pass" ? "pass" : status === "fail" ? "fail" : "warn";
1758
1818
  var providerSortScore = (provider) => [
1759
1819
  recommendationStatusRank[provider.status],
@@ -2130,6 +2190,37 @@ var renderVoiceProofTrendRecommendationHTML = (report, title = "Voice Provider R
2130
2190
  const profileRows = report.profiles.length === 0 ? "<li>No benchmark profiles were present.</li>" : report.profiles.map((profile) => `<li><strong>${escapeHtml5(profile.label ?? profile.id)}</strong><span>${escapeHtml5(profile.status)} \xB7 ${escapeHtml5(formatProviderMix(profile.bestProviders))}</span><small>${escapeHtml5(profile.nextMove)}</small></li>`).join("");
2131
2191
  return `<!doctype html><html lang="en"><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width,initial-scale=1" /><title>${escapeHtml5(title)}</title><style>body{background:#101418;color:#f7f3e8;font-family:ui-sans-serif,system-ui,sans-serif;margin:0}main{margin:auto;max-width:1120px;padding:32px}.hero,article{background:#17201d;border:1px solid #2e3d36;border-radius:24px;margin-bottom:16px;padding:22px}.hero{background:linear-gradient(135deg,rgba(20,184,166,.18),rgba(245,158,11,.12))}.eyebrow{color:#5eead4;font-weight:900;letter-spacing:.1em;text-transform:uppercase}h1{font-size:clamp(2.2rem,6vw,4.7rem);letter-spacing:-.06em;line-height:.92;margin:.2rem 0 1rem}.summary{display:flex;flex-wrap:wrap;gap:10px}.pill{border:1px solid #42534a;border-radius:999px;padding:8px 12px}.pass{border-color:rgba(34,197,94,.55)}.warn{border-color:rgba(245,158,11,.7)}.fail{border-color:rgba(239,68,68,.75)}pre{background:#0b1110;border-radius:14px;overflow:auto;padding:12px}a{color:#5eead4}li{margin:.45rem 0}li span,li small{display:block;color:#c9d3ca}</style></head><body><main><section class="hero"><p class="eyebrow">Sustained proof recommendations</p><h1>${escapeHtml5(title)}</h1><p>Generated ${escapeHtml5(report.generatedAt)} from ${escapeHtml5(report.source)}.</p><div class="summary"><span class="pill">Status ${escapeHtml5(report.status)}</span><span class="pill">Provider ${report.summary.keepCurrentProviderPath ? "keep" : "change"}</span><span class="pill">Best mix ${escapeHtml5(formatProviderMix(report.bestProviders))}</span><span class="pill">Profiles ${String(report.profiles.length)}</span><span class="pill">Runtime ${report.summary.keepCurrentRuntimeChannel ? "keep" : "tune"}</span><span class="pill">${String(report.summary.recommendedActions)} action(s)</span></div></section>${cards}<section class="hero"><h2>Benchmark Profiles</h2><ul>${profileRows}</ul></section><section class="hero"><h2>Provider Comparison</h2><ul>${providerRows}</ul></section><section class="hero"><h2>Issues</h2><ul>${issues}</ul></section></main></body></html>`;
2132
2192
  };
2193
+ var renderVoiceRealCallProfileHistoryMarkdown = (report, title = "Voice Real-Call Profile History") => [
2194
+ `# ${title}`,
2195
+ "",
2196
+ `- Status: ${report.status}`,
2197
+ `- Reports: ${String(report.reports)}`,
2198
+ `- Profiles: ${String(report.summary.profileCount)}`,
2199
+ `- Cycles: ${String(report.summary.cycles ?? 0)}`,
2200
+ `- Source: ${report.source}`,
2201
+ `- Best provider mix: ${formatProviderMix(report.recommendations.bestProviders)}`,
2202
+ "",
2203
+ "## Profiles",
2204
+ "",
2205
+ "| Profile | Status | Live p95 | Provider p95 | Turn p95 | Provider mix |",
2206
+ "| --- | --- | ---: | ---: | ---: | --- |",
2207
+ ...report.summary.profiles?.length ? report.summary.profiles.map((profile) => `| ${escapeMarkdown(profile.label ?? profile.id)} | ${profile.status ?? "unknown"} | ${profile.maxLiveP95Ms ?? "n/a"} | ${profile.maxProviderP95Ms ?? "n/a"} | ${profile.maxTurnP95Ms ?? "n/a"} | ${escapeMarkdown(formatProviderMix(profile.providers ?? []))} |`) : ["| n/a | n/a | n/a | n/a | n/a | No profiles present. |"],
2208
+ "",
2209
+ "## Recommendations",
2210
+ "",
2211
+ ...report.recommendations.recommendations.map((recommendation) => `- ${recommendation.status}: ${recommendation.recommendation} ${recommendation.nextMove}`),
2212
+ "",
2213
+ "## Issues",
2214
+ "",
2215
+ ...report.issues.length ? report.issues.map((issue) => `- ${issue}`) : ["- None"]
2216
+ ].join(`
2217
+ `);
2218
+ var renderVoiceRealCallProfileHistoryHTML = (report, title = "Voice Real-Call Profile History") => {
2219
+ const profileRows = report.summary.profiles?.length ? report.summary.profiles.map((profile) => `<tr><td>${escapeHtml5(profile.label ?? profile.id)}</td><td>${escapeHtml5(profile.status ?? "unknown")}</td><td>${escapeHtml5(profile.maxLiveP95Ms ?? "n/a")}</td><td>${escapeHtml5(profile.maxProviderP95Ms ?? "n/a")}</td><td>${escapeHtml5(profile.maxTurnP95Ms ?? "n/a")}</td><td>${escapeHtml5(formatProviderMix(profile.providers ?? []))}</td></tr>`).join("") : '<tr><td colspan="6">No profiles present.</td></tr>';
2220
+ const recommendations = report.recommendations.recommendations.map((recommendation) => `<article class="${escapeHtml5(recommendation.status)}"><p class="eyebrow">${escapeHtml5(recommendation.surface)} \xB7 ${escapeHtml5(recommendation.status)}</p><h2>${escapeHtml5(recommendation.recommendation)}</h2><p>${escapeHtml5(recommendation.nextMove)}</p></article>`).join("");
2221
+ const issues = report.issues.length === 0 ? "<li>None</li>" : report.issues.map((issue) => `<li>${escapeHtml5(issue)}</li>`).join("");
2222
+ return `<!doctype html><html lang="en"><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width,initial-scale=1" /><title>${escapeHtml5(title)}</title><style>body{background:#111510;color:#f6f0dd;font-family:ui-sans-serif,system-ui,sans-serif;margin:0}main{margin:auto;max-width:1120px;padding:32px}.hero,article,.card{background:#182117;border:1px solid #32412d;border-radius:24px;margin-bottom:16px;padding:22px}.hero{background:linear-gradient(135deg,rgba(132,204,22,.16),rgba(20,184,166,.12))}.eyebrow{color:#bef264;font-weight:900;letter-spacing:.1em;text-transform:uppercase}h1{font-size:clamp(2.2rem,6vw,4.7rem);letter-spacing:-.06em;line-height:.92;margin:.2rem 0 1rem}.summary{display:flex;flex-wrap:wrap;gap:10px}.pill{border:1px solid #52624b;border-radius:999px;padding:8px 12px}.pass{border-color:rgba(34,197,94,.55)}.warn{border-color:rgba(245,158,11,.7)}.fail{border-color:rgba(239,68,68,.75)}table{border-collapse:collapse;width:100%}td,th{border-bottom:1px solid #32412d;padding:10px;text-align:left}</style></head><body><main><section class="hero"><p class="eyebrow">Real-call benchmark history</p><h1>${escapeHtml5(title)}</h1><p>Generated ${escapeHtml5(report.generatedAt)} from ${escapeHtml5(report.source)}.</p><div class="summary"><span class="pill">Status ${escapeHtml5(report.status)}</span><span class="pill">Reports ${String(report.reports)}</span><span class="pill">Profiles ${String(report.summary.profileCount)}</span><span class="pill">Cycles ${String(report.summary.cycles ?? 0)}</span><span class="pill">Best mix ${escapeHtml5(formatProviderMix(report.recommendations.bestProviders))}</span></div></section><section class="card"><h2>Profiles</h2><table><thead><tr><th>Profile</th><th>Status</th><th>Live p95</th><th>Provider p95</th><th>Turn p95</th><th>Provider mix</th></tr></thead><tbody>${profileRows}</tbody></table></section>${recommendations}<section class="card"><h2>Issues</h2><ul>${issues}</ul></section></main></body></html>`;
2223
+ };
2133
2224
  var createVoiceProofTrendRecommendationRoutes = (options) => {
2134
2225
  const path = options.path ?? "/api/voice/proof-trend-recommendations";
2135
2226
  const htmlPath = options.htmlPath === undefined ? "/voice/proof-trend-recommendations" : options.htmlPath;
@@ -2172,6 +2263,47 @@ var createVoiceProofTrendRecommendationRoutes = (options) => {
2172
2263
  }
2173
2264
  return routes;
2174
2265
  };
2266
+ var createVoiceRealCallProfileHistoryRoutes = (options = {}) => {
2267
+ const path = options.path ?? "/api/voice/real-call-profile-history";
2268
+ const htmlPath = options.htmlPath === undefined ? "/voice/real-call-profile-history" : options.htmlPath;
2269
+ const markdownPath = options.markdownPath === undefined ? "/voice/real-call-profile-history.md" : options.markdownPath;
2270
+ const title = options.title ?? "Voice Real-Call Profile History";
2271
+ const routes = new Elysia({
2272
+ name: options.name ?? "absolutejs-voice-real-call-profile-history"
2273
+ });
2274
+ const loadReport = async () => {
2275
+ const { source, ...routeOptions } = options;
2276
+ const sourceOptions = source === undefined ? routeOptions : typeof source === "function" ? await source() : source;
2277
+ return buildVoiceRealCallProfileHistoryReport({
2278
+ ...routeOptions,
2279
+ ...sourceOptions
2280
+ });
2281
+ };
2282
+ routes.get(path, async () => Response.json(await loadReport(), { headers: options.headers }));
2283
+ if (htmlPath !== false) {
2284
+ routes.get(htmlPath, async () => {
2285
+ const report = await loadReport();
2286
+ return new Response(renderVoiceRealCallProfileHistoryHTML(report, title), {
2287
+ headers: {
2288
+ "content-type": "text/html; charset=utf-8",
2289
+ ...Object.fromEntries(new Headers(options.headers))
2290
+ }
2291
+ });
2292
+ });
2293
+ }
2294
+ if (markdownPath !== false) {
2295
+ routes.get(markdownPath, async () => {
2296
+ const report = await loadReport();
2297
+ return new Response(renderVoiceRealCallProfileHistoryMarkdown(report, title), {
2298
+ headers: {
2299
+ "content-type": "text/markdown; charset=utf-8",
2300
+ ...Object.fromEntries(new Headers(options.headers))
2301
+ }
2302
+ });
2303
+ });
2304
+ }
2305
+ return routes;
2306
+ };
2175
2307
  var createVoiceProofTrendRoutes = (options) => {
2176
2308
  const path = options.path ?? "/api/voice/proof-trends";
2177
2309
  const routes = new Elysia({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.346",
3
+ "version": "0.0.22-beta.348",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",