@absolutejs/voice 0.0.22-beta.345 → 0.0.22-beta.347

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,64 @@ 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 profiles = buildVoiceProofTrendProfileSummaries(history, options);
4106
+ const summary = {
4107
+ cycles: history.reduce((total, report) => total + (report.summary.cycles ?? report.cycles.length), 0),
4108
+ failedReports: history.filter((report) => report.ok !== true).length,
4109
+ maxLiveP95Ms: maxNumber(history.map(readProofTrendMaxLiveP95)),
4110
+ maxProviderP95Ms: maxNumber(history.map(readProofTrendMaxProviderP95)),
4111
+ maxTurnP95Ms: maxNumber(history.map(readProofTrendMaxTurnP95)),
4112
+ profileCount: profiles.length,
4113
+ profiles,
4114
+ providers: readProofTrendProviders(history),
4115
+ runtimeChannel: aggregateProofTrendRuntimeChannel(history.map(readProofTrendRuntimeChannel).filter((channel) => channel !== undefined))
4116
+ };
4117
+ const trend = buildVoiceProofTrendReport({
4118
+ baseUrl: options.baseUrl,
4119
+ cycles: flattenProofTrendCycles(history),
4120
+ generatedAt,
4121
+ maxAgeMs: options.maxAgeMs,
4122
+ now: options.now,
4123
+ ok: history.length > 0 && summary.failedReports === 0 && profiles.every((profile) => profile.status !== "fail"),
4124
+ source: options.source ?? "real-call-profile-history",
4125
+ summary
4126
+ });
4127
+ const recommendations = buildVoiceProofTrendRecommendationReport(trend, options);
4128
+ const issues = [
4129
+ ...history.length === 0 ? ["No real-call profile reports were present."] : [],
4130
+ ...profiles.length === 0 ? ["No benchmark profiles were present."] : [],
4131
+ ...summary.failedReports > 0 ? [`${summary.failedReports} real-call profile report(s) failed.`] : [],
4132
+ ...recommendations.issues
4133
+ ];
4134
+ return {
4135
+ generatedAt,
4136
+ history,
4137
+ issues,
4138
+ ok: trend.ok && issues.length === 0,
4139
+ recommendations,
4140
+ reports: history.length,
4141
+ source: trend.source,
4142
+ status: issues.length > 0 ? trend.status === "pass" ? "fail" : trend.status : trend.status,
4143
+ summary,
4144
+ trend
4145
+ };
4146
+ };
4088
4147
  var normalizeProviderStatus = (status) => status === "pass" ? "pass" : status === "fail" ? "fail" : "warn";
4089
4148
  var providerSortScore = (provider) => [
4090
4149
  recommendationStatusRank[provider.status],
@@ -4461,6 +4520,37 @@ var renderVoiceProofTrendRecommendationHTML = (report, title = "Voice Provider R
4461
4520
  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
4521
  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
4522
  };
4523
+ var renderVoiceRealCallProfileHistoryMarkdown = (report, title = "Voice Real-Call Profile History") => [
4524
+ `# ${title}`,
4525
+ "",
4526
+ `- Status: ${report.status}`,
4527
+ `- Reports: ${String(report.reports)}`,
4528
+ `- Profiles: ${String(report.summary.profileCount)}`,
4529
+ `- Cycles: ${String(report.summary.cycles ?? 0)}`,
4530
+ `- Source: ${report.source}`,
4531
+ `- Best provider mix: ${formatProviderMix(report.recommendations.bestProviders)}`,
4532
+ "",
4533
+ "## Profiles",
4534
+ "",
4535
+ "| Profile | Status | Live p95 | Provider p95 | Turn p95 | Provider mix |",
4536
+ "| --- | --- | ---: | ---: | ---: | --- |",
4537
+ ...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. |"],
4538
+ "",
4539
+ "## Recommendations",
4540
+ "",
4541
+ ...report.recommendations.recommendations.map((recommendation) => `- ${recommendation.status}: ${recommendation.recommendation} ${recommendation.nextMove}`),
4542
+ "",
4543
+ "## Issues",
4544
+ "",
4545
+ ...report.issues.length ? report.issues.map((issue) => `- ${issue}`) : ["- None"]
4546
+ ].join(`
4547
+ `);
4548
+ var renderVoiceRealCallProfileHistoryHTML = (report, title = "Voice Real-Call Profile History") => {
4549
+ 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>';
4550
+ 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("");
4551
+ const issues = report.issues.length === 0 ? "<li>None</li>" : report.issues.map((issue) => `<li>${escapeHtml3(issue)}</li>`).join("");
4552
+ 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>`;
4553
+ };
4464
4554
  var createVoiceProofTrendRecommendationRoutes = (options) => {
4465
4555
  const path = options.path ?? "/api/voice/proof-trend-recommendations";
4466
4556
  const htmlPath = options.htmlPath === undefined ? "/voice/proof-trend-recommendations" : options.htmlPath;
@@ -4503,6 +4593,47 @@ var createVoiceProofTrendRecommendationRoutes = (options) => {
4503
4593
  }
4504
4594
  return routes;
4505
4595
  };
4596
+ var createVoiceRealCallProfileHistoryRoutes = (options = {}) => {
4597
+ const path = options.path ?? "/api/voice/real-call-profile-history";
4598
+ const htmlPath = options.htmlPath === undefined ? "/voice/real-call-profile-history" : options.htmlPath;
4599
+ const markdownPath = options.markdownPath === undefined ? "/voice/real-call-profile-history.md" : options.markdownPath;
4600
+ const title = options.title ?? "Voice Real-Call Profile History";
4601
+ const routes = new Elysia({
4602
+ name: options.name ?? "absolutejs-voice-real-call-profile-history"
4603
+ });
4604
+ const loadReport = async () => {
4605
+ const { source, ...routeOptions } = options;
4606
+ const sourceOptions = source === undefined ? routeOptions : typeof source === "function" ? await source() : source;
4607
+ return buildVoiceRealCallProfileHistoryReport({
4608
+ ...routeOptions,
4609
+ ...sourceOptions
4610
+ });
4611
+ };
4612
+ routes.get(path, async () => Response.json(await loadReport(), { headers: options.headers }));
4613
+ if (htmlPath !== false) {
4614
+ routes.get(htmlPath, async () => {
4615
+ const report = await loadReport();
4616
+ return new Response(renderVoiceRealCallProfileHistoryHTML(report, title), {
4617
+ headers: {
4618
+ "content-type": "text/html; charset=utf-8",
4619
+ ...Object.fromEntries(new Headers(options.headers))
4620
+ }
4621
+ });
4622
+ });
4623
+ }
4624
+ if (markdownPath !== false) {
4625
+ routes.get(markdownPath, async () => {
4626
+ const report = await loadReport();
4627
+ return new Response(renderVoiceRealCallProfileHistoryMarkdown(report, title), {
4628
+ headers: {
4629
+ "content-type": "text/markdown; charset=utf-8",
4630
+ ...Object.fromEntries(new Headers(options.headers))
4631
+ }
4632
+ });
4633
+ });
4634
+ }
4635
+ return routes;
4636
+ };
4506
4637
  var createVoiceProofTrendRoutes = (options) => {
4507
4638
  const path = options.path ?? "/api/voice/proof-trends";
4508
4639
  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,64 @@ 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 profiles = buildVoiceProofTrendProfileSummaries(history, options);
15008
+ const summary = {
15009
+ cycles: history.reduce((total, report) => total + (report.summary.cycles ?? report.cycles.length), 0),
15010
+ failedReports: history.filter((report) => report.ok !== true).length,
15011
+ maxLiveP95Ms: maxNumber(history.map(readProofTrendMaxLiveP95)),
15012
+ maxProviderP95Ms: maxNumber(history.map(readProofTrendMaxProviderP95)),
15013
+ maxTurnP95Ms: maxNumber(history.map(readProofTrendMaxTurnP95)),
15014
+ profileCount: profiles.length,
15015
+ profiles,
15016
+ providers: readProofTrendProviders(history),
15017
+ runtimeChannel: aggregateProofTrendRuntimeChannel(history.map(readProofTrendRuntimeChannel).filter((channel) => channel !== undefined))
15018
+ };
15019
+ const trend = buildVoiceProofTrendReport({
15020
+ baseUrl: options.baseUrl,
15021
+ cycles: flattenProofTrendCycles(history),
15022
+ generatedAt,
15023
+ maxAgeMs: options.maxAgeMs,
15024
+ now: options.now,
15025
+ ok: history.length > 0 && summary.failedReports === 0 && profiles.every((profile) => profile.status !== "fail"),
15026
+ source: options.source ?? "real-call-profile-history",
15027
+ summary
15028
+ });
15029
+ const recommendations = buildVoiceProofTrendRecommendationReport(trend, options);
15030
+ const issues = [
15031
+ ...history.length === 0 ? ["No real-call profile reports were present."] : [],
15032
+ ...profiles.length === 0 ? ["No benchmark profiles were present."] : [],
15033
+ ...summary.failedReports > 0 ? [`${summary.failedReports} real-call profile report(s) failed.`] : [],
15034
+ ...recommendations.issues
15035
+ ];
15036
+ return {
15037
+ generatedAt,
15038
+ history,
15039
+ issues,
15040
+ ok: trend.ok && issues.length === 0,
15041
+ recommendations,
15042
+ reports: history.length,
15043
+ source: trend.source,
15044
+ status: issues.length > 0 ? trend.status === "pass" ? "fail" : trend.status : trend.status,
15045
+ summary,
15046
+ trend
15047
+ };
15048
+ };
14990
15049
  var normalizeProviderStatus = (status) => status === "pass" ? "pass" : status === "fail" ? "fail" : "warn";
14991
15050
  var providerSortScore = (provider) => [
14992
15051
  recommendationStatusRank[provider.status],
@@ -15363,6 +15422,37 @@ var renderVoiceProofTrendRecommendationHTML = (report, title = "Voice Provider R
15363
15422
  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
15423
  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
15424
  };
15425
+ var renderVoiceRealCallProfileHistoryMarkdown = (report, title = "Voice Real-Call Profile History") => [
15426
+ `# ${title}`,
15427
+ "",
15428
+ `- Status: ${report.status}`,
15429
+ `- Reports: ${String(report.reports)}`,
15430
+ `- Profiles: ${String(report.summary.profileCount)}`,
15431
+ `- Cycles: ${String(report.summary.cycles ?? 0)}`,
15432
+ `- Source: ${report.source}`,
15433
+ `- Best provider mix: ${formatProviderMix(report.recommendations.bestProviders)}`,
15434
+ "",
15435
+ "## Profiles",
15436
+ "",
15437
+ "| Profile | Status | Live p95 | Provider p95 | Turn p95 | Provider mix |",
15438
+ "| --- | --- | ---: | ---: | ---: | --- |",
15439
+ ...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. |"],
15440
+ "",
15441
+ "## Recommendations",
15442
+ "",
15443
+ ...report.recommendations.recommendations.map((recommendation) => `- ${recommendation.status}: ${recommendation.recommendation} ${recommendation.nextMove}`),
15444
+ "",
15445
+ "## Issues",
15446
+ "",
15447
+ ...report.issues.length ? report.issues.map((issue) => `- ${issue}`) : ["- None"]
15448
+ ].join(`
15449
+ `);
15450
+ var renderVoiceRealCallProfileHistoryHTML = (report, title = "Voice Real-Call Profile History") => {
15451
+ 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>';
15452
+ 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("");
15453
+ const issues = report.issues.length === 0 ? "<li>None</li>" : report.issues.map((issue) => `<li>${escapeHtml23(issue)}</li>`).join("");
15454
+ 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>`;
15455
+ };
15366
15456
  var createVoiceProofTrendRecommendationRoutes = (options) => {
15367
15457
  const path = options.path ?? "/api/voice/proof-trend-recommendations";
15368
15458
  const htmlPath = options.htmlPath === undefined ? "/voice/proof-trend-recommendations" : options.htmlPath;
@@ -15405,6 +15495,47 @@ var createVoiceProofTrendRecommendationRoutes = (options) => {
15405
15495
  }
15406
15496
  return routes;
15407
15497
  };
15498
+ var createVoiceRealCallProfileHistoryRoutes = (options = {}) => {
15499
+ const path = options.path ?? "/api/voice/real-call-profile-history";
15500
+ const htmlPath = options.htmlPath === undefined ? "/voice/real-call-profile-history" : options.htmlPath;
15501
+ const markdownPath = options.markdownPath === undefined ? "/voice/real-call-profile-history.md" : options.markdownPath;
15502
+ const title = options.title ?? "Voice Real-Call Profile History";
15503
+ const routes = new Elysia21({
15504
+ name: options.name ?? "absolutejs-voice-real-call-profile-history"
15505
+ });
15506
+ const loadReport = async () => {
15507
+ const { source, ...routeOptions } = options;
15508
+ const sourceOptions = source === undefined ? routeOptions : typeof source === "function" ? await source() : source;
15509
+ return buildVoiceRealCallProfileHistoryReport({
15510
+ ...routeOptions,
15511
+ ...sourceOptions
15512
+ });
15513
+ };
15514
+ routes.get(path, async () => Response.json(await loadReport(), { headers: options.headers }));
15515
+ if (htmlPath !== false) {
15516
+ routes.get(htmlPath, async () => {
15517
+ const report = await loadReport();
15518
+ return new Response(renderVoiceRealCallProfileHistoryHTML(report, title), {
15519
+ headers: {
15520
+ "content-type": "text/html; charset=utf-8",
15521
+ ...Object.fromEntries(new Headers(options.headers))
15522
+ }
15523
+ });
15524
+ });
15525
+ }
15526
+ if (markdownPath !== false) {
15527
+ routes.get(markdownPath, async () => {
15528
+ const report = await loadReport();
15529
+ return new Response(renderVoiceRealCallProfileHistoryMarkdown(report, title), {
15530
+ headers: {
15531
+ "content-type": "text/markdown; charset=utf-8",
15532
+ ...Object.fromEntries(new Headers(options.headers))
15533
+ }
15534
+ });
15535
+ });
15536
+ }
15537
+ return routes;
15538
+ };
15408
15539
  var createVoiceProofTrendRoutes = (options) => {
15409
15540
  const path = options.path ?? "/api/voice/proof-trends";
15410
15541
  const routes = new Elysia21({
@@ -31123,6 +31254,12 @@ var resolveProofSources = async (options, input) => {
31123
31254
  }
31124
31255
  return typeof options.proofSources === "function" ? await options.proofSources(input) : options.proofSources;
31125
31256
  };
31257
+ var resolveAdditionalChecks = async (options, input) => {
31258
+ if (options.additionalChecks === false || options.additionalChecks === undefined) {
31259
+ return [];
31260
+ }
31261
+ return typeof options.additionalChecks === "function" ? await options.additionalChecks(input) : options.additionalChecks;
31262
+ };
31126
31263
  var isVoiceDeliveryRuntime = (value) => typeof value.summarize === "function";
31127
31264
  var resolveDeliveryRuntime = async (options, input) => {
31128
31265
  if (options.deliveryRuntime === false || options.deliveryRuntime === undefined) {
@@ -31501,7 +31638,8 @@ var buildVoiceProductionReadinessReport = async (options, input = {}) => {
31501
31638
  observabilityExport,
31502
31639
  observabilityExportDeliveryHistory,
31503
31640
  observabilityExportReplay,
31504
- proofSources
31641
+ proofSources,
31642
+ additionalChecks
31505
31643
  ] = await Promise.all([
31506
31644
  evaluateVoiceQuality({ events }),
31507
31645
  Promise.all([
@@ -31546,7 +31684,8 @@ var buildVoiceProductionReadinessReport = async (options, input = {}) => {
31546
31684
  resolveObservabilityExport(options, { query, request }),
31547
31685
  resolveObservabilityExportDeliveryHistory(options, { query, request }),
31548
31686
  resolveObservabilityExportReplay(options, { query, request }),
31549
- resolveProofSources(options, { query, request })
31687
+ resolveProofSources(options, { query, request }),
31688
+ resolveAdditionalChecks(options, { query, request })
31550
31689
  ]);
31551
31690
  const deliveryRuntime = summarizeDeliveryRuntime(deliveryRuntimeSummary);
31552
31691
  const degradedProviders = providers.filter((provider) => provider.status === "degraded" || provider.status === "rate-limited" || provider.status === "suppressed").length;
@@ -31695,6 +31834,7 @@ var buildVoiceProductionReadinessReport = async (options, input = {}) => {
31695
31834
  ]
31696
31835
  }
31697
31836
  ];
31837
+ checks.push(...additionalChecks);
31698
31838
  const proofSource = (...keys) => keys.map((key) => proofSources?.[key]).find((source) => source !== undefined);
31699
31839
  const calibratedThresholdActions = () => options.links?.sloReadinessThresholds ? [
31700
31840
  {
@@ -36976,6 +37116,8 @@ export {
36976
37116
  renderVoiceRealtimeProviderContractHTML,
36977
37117
  renderVoiceRealtimeChannelMarkdown,
36978
37118
  renderVoiceRealtimeChannelHTML,
37119
+ renderVoiceRealCallProfileHistoryMarkdown,
37120
+ renderVoiceRealCallProfileHistoryHTML,
36979
37121
  renderVoiceQualityHTML,
36980
37122
  renderVoiceProviderSloMarkdown,
36981
37123
  renderVoiceProviderSloHTML,
@@ -37219,6 +37361,7 @@ export {
37219
37361
  createVoiceRealtimeProviderContractRoutes,
37220
37362
  createVoiceRealtimeProviderContractMatrixPreset,
37221
37363
  createVoiceRealtimeChannelRoutes,
37364
+ createVoiceRealCallProfileHistoryRoutes,
37222
37365
  createVoiceReadinessProfile,
37223
37366
  createVoiceQualityRoutes,
37224
37367
  createVoiceProviderSloRoutes,
@@ -37429,6 +37572,7 @@ export {
37429
37572
  buildVoiceRealtimeProviderContractMatrix,
37430
37573
  buildVoiceRealtimeChannelRuntimeSamplesFromTrace,
37431
37574
  buildVoiceRealtimeChannelReport,
37575
+ buildVoiceRealCallProfileHistoryReport,
37432
37576
  buildVoiceProviderSloReport,
37433
37577
  buildVoiceProviderOrchestrationReport,
37434
37578
  buildVoiceProviderDecisionTraceReport,
@@ -453,6 +453,10 @@ export type VoiceProductionReadinessRoutesOptions = {
453
453
  query: Record<string, unknown>;
454
454
  request: Request;
455
455
  }) => Promise<readonly VoiceAgentSquadContractReport[]> | readonly VoiceAgentSquadContractReport[]);
456
+ additionalChecks?: false | readonly VoiceProductionReadinessCheck[] | ((input: {
457
+ query: Record<string, unknown>;
458
+ request: Request;
459
+ }) => Promise<readonly VoiceProductionReadinessCheck[]> | readonly VoiceProductionReadinessCheck[]);
456
460
  audit?: false | VoiceProductionReadinessAuditOptions;
457
461
  auditDeliveries?: false | VoiceProductionReadinessAuditDeliveryOptions;
458
462
  bargeInReports?: false | readonly VoiceBargeInReport[] | ((input: {
@@ -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,64 @@ 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 profiles = buildVoiceProofTrendProfileSummaries(history, options);
1854
+ const summary = {
1855
+ cycles: history.reduce((total, report) => total + (report.summary.cycles ?? report.cycles.length), 0),
1856
+ failedReports: history.filter((report) => report.ok !== true).length,
1857
+ maxLiveP95Ms: maxNumber(history.map(readProofTrendMaxLiveP95)),
1858
+ maxProviderP95Ms: maxNumber(history.map(readProofTrendMaxProviderP95)),
1859
+ maxTurnP95Ms: maxNumber(history.map(readProofTrendMaxTurnP95)),
1860
+ profileCount: profiles.length,
1861
+ profiles,
1862
+ providers: readProofTrendProviders(history),
1863
+ runtimeChannel: aggregateProofTrendRuntimeChannel(history.map(readProofTrendRuntimeChannel).filter((channel) => channel !== undefined))
1864
+ };
1865
+ const trend = buildVoiceProofTrendReport({
1866
+ baseUrl: options.baseUrl,
1867
+ cycles: flattenProofTrendCycles(history),
1868
+ generatedAt,
1869
+ maxAgeMs: options.maxAgeMs,
1870
+ now: options.now,
1871
+ ok: history.length > 0 && summary.failedReports === 0 && profiles.every((profile) => profile.status !== "fail"),
1872
+ source: options.source ?? "real-call-profile-history",
1873
+ summary
1874
+ });
1875
+ const recommendations = buildVoiceProofTrendRecommendationReport(trend, options);
1876
+ const issues = [
1877
+ ...history.length === 0 ? ["No real-call profile reports were present."] : [],
1878
+ ...profiles.length === 0 ? ["No benchmark profiles were present."] : [],
1879
+ ...summary.failedReports > 0 ? [`${summary.failedReports} real-call profile report(s) failed.`] : [],
1880
+ ...recommendations.issues
1881
+ ];
1882
+ return {
1883
+ generatedAt,
1884
+ history,
1885
+ issues,
1886
+ ok: trend.ok && issues.length === 0,
1887
+ recommendations,
1888
+ reports: history.length,
1889
+ source: trend.source,
1890
+ status: issues.length > 0 ? trend.status === "pass" ? "fail" : trend.status : trend.status,
1891
+ summary,
1892
+ trend
1893
+ };
1894
+ };
1836
1895
  var normalizeProviderStatus = (status) => status === "pass" ? "pass" : status === "fail" ? "fail" : "warn";
1837
1896
  var providerSortScore = (provider) => [
1838
1897
  recommendationStatusRank[provider.status],
@@ -2209,6 +2268,37 @@ var renderVoiceProofTrendRecommendationHTML = (report, title = "Voice Provider R
2209
2268
  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
2269
  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
2270
  };
2271
+ var renderVoiceRealCallProfileHistoryMarkdown = (report, title = "Voice Real-Call Profile History") => [
2272
+ `# ${title}`,
2273
+ "",
2274
+ `- Status: ${report.status}`,
2275
+ `- Reports: ${String(report.reports)}`,
2276
+ `- Profiles: ${String(report.summary.profileCount)}`,
2277
+ `- Cycles: ${String(report.summary.cycles ?? 0)}`,
2278
+ `- Source: ${report.source}`,
2279
+ `- Best provider mix: ${formatProviderMix(report.recommendations.bestProviders)}`,
2280
+ "",
2281
+ "## Profiles",
2282
+ "",
2283
+ "| Profile | Status | Live p95 | Provider p95 | Turn p95 | Provider mix |",
2284
+ "| --- | --- | ---: | ---: | ---: | --- |",
2285
+ ...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. |"],
2286
+ "",
2287
+ "## Recommendations",
2288
+ "",
2289
+ ...report.recommendations.recommendations.map((recommendation) => `- ${recommendation.status}: ${recommendation.recommendation} ${recommendation.nextMove}`),
2290
+ "",
2291
+ "## Issues",
2292
+ "",
2293
+ ...report.issues.length ? report.issues.map((issue) => `- ${issue}`) : ["- None"]
2294
+ ].join(`
2295
+ `);
2296
+ var renderVoiceRealCallProfileHistoryHTML = (report, title = "Voice Real-Call Profile History") => {
2297
+ 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>';
2298
+ 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("");
2299
+ const issues = report.issues.length === 0 ? "<li>None</li>" : report.issues.map((issue) => `<li>${escapeHtml5(issue)}</li>`).join("");
2300
+ 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>`;
2301
+ };
2212
2302
  var createVoiceProofTrendRecommendationRoutes = (options) => {
2213
2303
  const path = options.path ?? "/api/voice/proof-trend-recommendations";
2214
2304
  const htmlPath = options.htmlPath === undefined ? "/voice/proof-trend-recommendations" : options.htmlPath;
@@ -2251,6 +2341,47 @@ var createVoiceProofTrendRecommendationRoutes = (options) => {
2251
2341
  }
2252
2342
  return routes;
2253
2343
  };
2344
+ var createVoiceRealCallProfileHistoryRoutes = (options = {}) => {
2345
+ const path = options.path ?? "/api/voice/real-call-profile-history";
2346
+ const htmlPath = options.htmlPath === undefined ? "/voice/real-call-profile-history" : options.htmlPath;
2347
+ const markdownPath = options.markdownPath === undefined ? "/voice/real-call-profile-history.md" : options.markdownPath;
2348
+ const title = options.title ?? "Voice Real-Call Profile History";
2349
+ const routes = new Elysia({
2350
+ name: options.name ?? "absolutejs-voice-real-call-profile-history"
2351
+ });
2352
+ const loadReport = async () => {
2353
+ const { source, ...routeOptions } = options;
2354
+ const sourceOptions = source === undefined ? routeOptions : typeof source === "function" ? await source() : source;
2355
+ return buildVoiceRealCallProfileHistoryReport({
2356
+ ...routeOptions,
2357
+ ...sourceOptions
2358
+ });
2359
+ };
2360
+ routes.get(path, async () => Response.json(await loadReport(), { headers: options.headers }));
2361
+ if (htmlPath !== false) {
2362
+ routes.get(htmlPath, async () => {
2363
+ const report = await loadReport();
2364
+ return new Response(renderVoiceRealCallProfileHistoryHTML(report, title), {
2365
+ headers: {
2366
+ "content-type": "text/html; charset=utf-8",
2367
+ ...Object.fromEntries(new Headers(options.headers))
2368
+ }
2369
+ });
2370
+ });
2371
+ }
2372
+ if (markdownPath !== false) {
2373
+ routes.get(markdownPath, async () => {
2374
+ const report = await loadReport();
2375
+ return new Response(renderVoiceRealCallProfileHistoryMarkdown(report, title), {
2376
+ headers: {
2377
+ "content-type": "text/markdown; charset=utf-8",
2378
+ ...Object.fromEntries(new Headers(options.headers))
2379
+ }
2380
+ });
2381
+ });
2382
+ }
2383
+ return routes;
2384
+ };
2254
2385
  var createVoiceProofTrendRoutes = (options) => {
2255
2386
  const path = options.path ?? "/api/voice/proof-trends";
2256
2387
  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,64 @@ 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 profiles = buildVoiceProofTrendProfileSummaries(history, options);
1775
+ const summary = {
1776
+ cycles: history.reduce((total, report) => total + (report.summary.cycles ?? report.cycles.length), 0),
1777
+ failedReports: history.filter((report) => report.ok !== true).length,
1778
+ maxLiveP95Ms: maxNumber(history.map(readProofTrendMaxLiveP95)),
1779
+ maxProviderP95Ms: maxNumber(history.map(readProofTrendMaxProviderP95)),
1780
+ maxTurnP95Ms: maxNumber(history.map(readProofTrendMaxTurnP95)),
1781
+ profileCount: profiles.length,
1782
+ profiles,
1783
+ providers: readProofTrendProviders(history),
1784
+ runtimeChannel: aggregateProofTrendRuntimeChannel(history.map(readProofTrendRuntimeChannel).filter((channel) => channel !== undefined))
1785
+ };
1786
+ const trend = buildVoiceProofTrendReport({
1787
+ baseUrl: options.baseUrl,
1788
+ cycles: flattenProofTrendCycles(history),
1789
+ generatedAt,
1790
+ maxAgeMs: options.maxAgeMs,
1791
+ now: options.now,
1792
+ ok: history.length > 0 && summary.failedReports === 0 && profiles.every((profile) => profile.status !== "fail"),
1793
+ source: options.source ?? "real-call-profile-history",
1794
+ summary
1795
+ });
1796
+ const recommendations = buildVoiceProofTrendRecommendationReport(trend, options);
1797
+ const issues = [
1798
+ ...history.length === 0 ? ["No real-call profile reports were present."] : [],
1799
+ ...profiles.length === 0 ? ["No benchmark profiles were present."] : [],
1800
+ ...summary.failedReports > 0 ? [`${summary.failedReports} real-call profile report(s) failed.`] : [],
1801
+ ...recommendations.issues
1802
+ ];
1803
+ return {
1804
+ generatedAt,
1805
+ history,
1806
+ issues,
1807
+ ok: trend.ok && issues.length === 0,
1808
+ recommendations,
1809
+ reports: history.length,
1810
+ source: trend.source,
1811
+ status: issues.length > 0 ? trend.status === "pass" ? "fail" : trend.status : trend.status,
1812
+ summary,
1813
+ trend
1814
+ };
1815
+ };
1757
1816
  var normalizeProviderStatus = (status) => status === "pass" ? "pass" : status === "fail" ? "fail" : "warn";
1758
1817
  var providerSortScore = (provider) => [
1759
1818
  recommendationStatusRank[provider.status],
@@ -2130,6 +2189,37 @@ var renderVoiceProofTrendRecommendationHTML = (report, title = "Voice Provider R
2130
2189
  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
2190
  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
2191
  };
2192
+ var renderVoiceRealCallProfileHistoryMarkdown = (report, title = "Voice Real-Call Profile History") => [
2193
+ `# ${title}`,
2194
+ "",
2195
+ `- Status: ${report.status}`,
2196
+ `- Reports: ${String(report.reports)}`,
2197
+ `- Profiles: ${String(report.summary.profileCount)}`,
2198
+ `- Cycles: ${String(report.summary.cycles ?? 0)}`,
2199
+ `- Source: ${report.source}`,
2200
+ `- Best provider mix: ${formatProviderMix(report.recommendations.bestProviders)}`,
2201
+ "",
2202
+ "## Profiles",
2203
+ "",
2204
+ "| Profile | Status | Live p95 | Provider p95 | Turn p95 | Provider mix |",
2205
+ "| --- | --- | ---: | ---: | ---: | --- |",
2206
+ ...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. |"],
2207
+ "",
2208
+ "## Recommendations",
2209
+ "",
2210
+ ...report.recommendations.recommendations.map((recommendation) => `- ${recommendation.status}: ${recommendation.recommendation} ${recommendation.nextMove}`),
2211
+ "",
2212
+ "## Issues",
2213
+ "",
2214
+ ...report.issues.length ? report.issues.map((issue) => `- ${issue}`) : ["- None"]
2215
+ ].join(`
2216
+ `);
2217
+ var renderVoiceRealCallProfileHistoryHTML = (report, title = "Voice Real-Call Profile History") => {
2218
+ 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>';
2219
+ 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("");
2220
+ const issues = report.issues.length === 0 ? "<li>None</li>" : report.issues.map((issue) => `<li>${escapeHtml5(issue)}</li>`).join("");
2221
+ 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>`;
2222
+ };
2133
2223
  var createVoiceProofTrendRecommendationRoutes = (options) => {
2134
2224
  const path = options.path ?? "/api/voice/proof-trend-recommendations";
2135
2225
  const htmlPath = options.htmlPath === undefined ? "/voice/proof-trend-recommendations" : options.htmlPath;
@@ -2172,6 +2262,47 @@ var createVoiceProofTrendRecommendationRoutes = (options) => {
2172
2262
  }
2173
2263
  return routes;
2174
2264
  };
2265
+ var createVoiceRealCallProfileHistoryRoutes = (options = {}) => {
2266
+ const path = options.path ?? "/api/voice/real-call-profile-history";
2267
+ const htmlPath = options.htmlPath === undefined ? "/voice/real-call-profile-history" : options.htmlPath;
2268
+ const markdownPath = options.markdownPath === undefined ? "/voice/real-call-profile-history.md" : options.markdownPath;
2269
+ const title = options.title ?? "Voice Real-Call Profile History";
2270
+ const routes = new Elysia({
2271
+ name: options.name ?? "absolutejs-voice-real-call-profile-history"
2272
+ });
2273
+ const loadReport = async () => {
2274
+ const { source, ...routeOptions } = options;
2275
+ const sourceOptions = source === undefined ? routeOptions : typeof source === "function" ? await source() : source;
2276
+ return buildVoiceRealCallProfileHistoryReport({
2277
+ ...routeOptions,
2278
+ ...sourceOptions
2279
+ });
2280
+ };
2281
+ routes.get(path, async () => Response.json(await loadReport(), { headers: options.headers }));
2282
+ if (htmlPath !== false) {
2283
+ routes.get(htmlPath, async () => {
2284
+ const report = await loadReport();
2285
+ return new Response(renderVoiceRealCallProfileHistoryHTML(report, title), {
2286
+ headers: {
2287
+ "content-type": "text/html; charset=utf-8",
2288
+ ...Object.fromEntries(new Headers(options.headers))
2289
+ }
2290
+ });
2291
+ });
2292
+ }
2293
+ if (markdownPath !== false) {
2294
+ routes.get(markdownPath, async () => {
2295
+ const report = await loadReport();
2296
+ return new Response(renderVoiceRealCallProfileHistoryMarkdown(report, title), {
2297
+ headers: {
2298
+ "content-type": "text/markdown; charset=utf-8",
2299
+ ...Object.fromEntries(new Headers(options.headers))
2300
+ }
2301
+ });
2302
+ });
2303
+ }
2304
+ return routes;
2305
+ };
2175
2306
  var createVoiceProofTrendRoutes = (options) => {
2176
2307
  const path = options.path ?? "/api/voice/proof-trends";
2177
2308
  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.345",
3
+ "version": "0.0.22-beta.347",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",