@absolutejs/voice 0.0.22-beta.454 → 0.0.22-beta.456

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.
@@ -236,6 +236,70 @@ export type VoiceRealCallProfileTraceCollector<TEvent extends StoredVoiceTraceEv
236
236
  listCapturedSessionIds: () => string[];
237
237
  listEvidence: (options?: VoiceRealCallProfileTraceCollectorEvidenceOptions) => Promise<VoiceProofTrendRealCallProfileEvidence[]>;
238
238
  };
239
+ export type VoiceRealCallEvidenceRuntimeSourceOptions = {
240
+ existingEvidenceLimit?: number;
241
+ evidenceStore: VoiceRealCallProfileEvidenceStore;
242
+ history?: Omit<VoiceRealCallProfileHistoryOptions, "evidence">;
243
+ reconnectEvidence?: VoiceReconnectRealCallProfileEvidenceOptions;
244
+ reconnectReports?: ((options: VoiceRealCallEvidenceRuntimeCollectOptions) => Promise<VoiceReconnectProofReport | VoiceReconnectContractReport | readonly (VoiceReconnectProofReport | VoiceReconnectContractReport)[] | undefined> | VoiceReconnectProofReport | VoiceReconnectContractReport | readonly (VoiceReconnectProofReport | VoiceReconnectContractReport)[] | undefined) | VoiceReconnectProofReport | VoiceReconnectContractReport | readonly (VoiceReconnectProofReport | VoiceReconnectContractReport)[];
245
+ traceEvidence?: VoiceRealCallProfileTraceCollectorEvidenceOptions;
246
+ traceStore?: VoiceTraceEventStore;
247
+ };
248
+ export type VoiceRealCallEvidenceRuntimeOptions = VoiceRealCallEvidenceRuntimeSourceOptions & {
249
+ dedupe?: boolean;
250
+ now?: () => Date;
251
+ };
252
+ export type VoiceRealCallEvidenceRuntimeCollectOptions = Partial<VoiceRealCallEvidenceRuntimeSourceOptions> & {
253
+ dedupe?: boolean;
254
+ now?: () => Date;
255
+ };
256
+ export type VoiceRealCallEvidenceRuntimeReport = {
257
+ appended: number;
258
+ collected: VoiceProofTrendRealCallProfileEvidence[];
259
+ duplicateKeys: string[];
260
+ evidence: VoiceRealCallProfileEvidenceRecord[];
261
+ generatedAt: string;
262
+ history: VoiceRealCallProfileHistoryReport;
263
+ issues: string[];
264
+ ok: boolean;
265
+ skippedDuplicates: number;
266
+ source: string;
267
+ status: VoiceProofTrendStatus;
268
+ summary: {
269
+ collectedEvidence: number;
270
+ failedProfiles: number;
271
+ profiles: number;
272
+ sessions: number;
273
+ storedEvidence: number;
274
+ };
275
+ };
276
+ export type VoiceRealCallEvidenceRuntime = {
277
+ appendEvidence: (evidence: VoiceProofTrendRealCallProfileEvidence | readonly VoiceProofTrendRealCallProfileEvidence[], options?: Pick<VoiceRealCallEvidenceRuntimeCollectOptions, "dedupe">) => Promise<VoiceRealCallEvidenceRuntimeReport>;
278
+ buildHistoryReport: (options?: Omit<VoiceRealCallProfileHistoryOptions, "evidence"> & VoiceRealCallProfileEvidenceListOptions) => Promise<VoiceRealCallProfileHistoryReport>;
279
+ buildReport: (options?: VoiceRealCallEvidenceRuntimeCollectOptions) => Promise<VoiceRealCallEvidenceRuntimeReport>;
280
+ collect: (options?: VoiceRealCallEvidenceRuntimeCollectOptions) => Promise<VoiceRealCallEvidenceRuntimeReport>;
281
+ listEvidence: (options?: VoiceRealCallProfileEvidenceListOptions) => Promise<VoiceRealCallProfileEvidenceRecord[]>;
282
+ };
283
+ export type VoiceRealCallEvidenceRuntimeRoutesOptions = VoiceRealCallEvidenceRuntimeOptions & {
284
+ collectPath?: false | string;
285
+ headers?: HeadersInit;
286
+ htmlPath?: false | string;
287
+ jsonPath?: string;
288
+ markdownPath?: false | string;
289
+ name?: string;
290
+ runtime?: VoiceRealCallEvidenceRuntime;
291
+ title?: string;
292
+ };
293
+ export type VoiceRealCallEvidenceRuntimeReadinessCheckOptions = {
294
+ collectHref?: string;
295
+ failOnWarnings?: boolean;
296
+ href?: string;
297
+ label?: string;
298
+ minProfiles?: number;
299
+ minSessions?: number;
300
+ minStoredEvidence?: number;
301
+ sourceHref?: string;
302
+ };
239
303
  export type VoiceProofTrendRealCallProfileReportOptions = VoiceProofTrendProfileSummaryOptions & {
240
304
  baseUrl?: string;
241
305
  evidence: readonly VoiceProofTrendRealCallProfileEvidence[];
@@ -656,6 +720,8 @@ export declare const loadVoiceRealCallProfileEvidenceFromTraceStore: (options: V
656
720
  export declare const loadVoiceRealCallProfileEvidenceFromStore: (options: VoiceRealCallProfileEvidenceListOptions & {
657
721
  store: VoiceRealCallProfileEvidenceStore;
658
722
  }) => Promise<VoiceRealCallProfileEvidenceRecord[]>;
723
+ export declare const createVoiceRealCallEvidenceRuntime: (options: VoiceRealCallEvidenceRuntimeOptions) => VoiceRealCallEvidenceRuntime;
724
+ export declare const buildVoiceRealCallEvidenceRuntimeReadinessCheck: (report: VoiceRealCallEvidenceRuntimeReport, options?: VoiceRealCallEvidenceRuntimeReadinessCheckOptions) => VoiceProductionReadinessCheck;
659
725
  export declare const createVoiceRealCallProfileTraceCollector: <TEvent extends StoredVoiceTraceEvent = StoredVoiceTraceEvent>(options: VoiceRealCallProfileTraceCollectorOptions<TEvent>) => VoiceRealCallProfileTraceCollector<TEvent>;
660
726
  export declare const buildVoiceProofTrendProfileSummaries: (input: VoiceProofTrendReport | readonly VoiceProofTrendReport[], options?: VoiceProofTrendProfileSummaryOptions) => VoiceProofTrendProfileSummary[];
661
727
  export declare const buildVoiceProofTrendReportFromRealCallProfiles: (options: VoiceProofTrendRealCallProfileReportOptions) => VoiceProofTrendReport;
@@ -683,6 +749,8 @@ export declare const renderVoiceProofTrendRecommendationMarkdown: (report: Voice
683
749
  export declare const renderVoiceProofTrendRecommendationHTML: (report: VoiceProofTrendRecommendationReport, title?: string) => string;
684
750
  export declare const renderVoiceRealCallProfileHistoryMarkdown: (report: VoiceRealCallProfileHistoryReport, title?: string) => string;
685
751
  export declare const renderVoiceRealCallProfileHistoryHTML: (report: VoiceRealCallProfileHistoryReport, title?: string) => string;
752
+ export declare const renderVoiceRealCallEvidenceRuntimeMarkdown: (report: VoiceRealCallEvidenceRuntimeReport, title?: string) => string;
753
+ export declare const renderVoiceRealCallEvidenceRuntimeHTML: (report: VoiceRealCallEvidenceRuntimeReport, title?: string) => string;
686
754
  export declare const createVoiceProofTrendRecommendationRoutes: (options: VoiceProofTrendRecommendationRoutesOptions) => Elysia<"", {
687
755
  decorator: {};
688
756
  store: {};
@@ -739,6 +807,34 @@ export declare const createVoiceRealCallProfileHistoryRoutes: (options?: VoiceRe
739
807
  standaloneSchema: {};
740
808
  response: {};
741
809
  }>;
810
+ export declare const createVoiceRealCallEvidenceRuntimeRoutes: (options: VoiceRealCallEvidenceRuntimeRoutesOptions) => Elysia<"", {
811
+ decorator: {};
812
+ store: {};
813
+ derive: {};
814
+ resolve: {};
815
+ }, {
816
+ typebox: {};
817
+ error: {};
818
+ }, {
819
+ schema: {};
820
+ standaloneSchema: {};
821
+ macro: {};
822
+ macroFn: {};
823
+ parser: {};
824
+ response: {};
825
+ }, {}, {
826
+ derive: {};
827
+ resolve: {};
828
+ schema: {};
829
+ standaloneSchema: {};
830
+ response: {};
831
+ }, {
832
+ derive: {};
833
+ resolve: {};
834
+ schema: {};
835
+ standaloneSchema: {};
836
+ response: {};
837
+ }>;
742
838
  export declare const createVoiceRealCallProfileRecoveryActionRoutes: (options?: VoiceRealCallProfileRecoveryActionRoutesOptions) => Elysia<"", {
743
839
  decorator: {};
744
840
  store: {};
@@ -3761,6 +3761,197 @@ var buildVoiceRealCallProfileEvidenceFromReconnectProofReports = (input, options
3761
3761
  };
3762
3762
  var loadVoiceRealCallProfileEvidenceFromTraceStore = async (options) => buildVoiceRealCallProfileEvidenceFromTraceEvents(await options.store.list({ limit: options.limit ?? 5000 }), options);
3763
3763
  var loadVoiceRealCallProfileEvidenceFromStore = async (options) => options.store.list(options);
3764
+ var readRealCallEvidenceRuntimeKey = (evidence) => [evidence.profileId, evidence.sessionId, evidence.generatedAt ?? ""].join("\x00");
3765
+ var resolveRealCallEvidenceRuntimeReconnectReports = async (reports, options) => {
3766
+ const resolved = typeof reports === "function" ? await reports(options) : reports;
3767
+ if (!resolved) {
3768
+ return [];
3769
+ }
3770
+ return Array.isArray(resolved) ? resolved : [resolved];
3771
+ };
3772
+ var mergeRealCallEvidenceRuntimeOptions = (base, override = {}) => ({
3773
+ dedupe: override.dedupe ?? base.dedupe,
3774
+ evidenceStore: override.evidenceStore ?? base.evidenceStore,
3775
+ existingEvidenceLimit: override.existingEvidenceLimit ?? base.existingEvidenceLimit,
3776
+ history: {
3777
+ ...base.history ?? {},
3778
+ ...override.history ?? {}
3779
+ },
3780
+ now: override.now ?? base.now,
3781
+ reconnectEvidence: {
3782
+ ...base.reconnectEvidence ?? {},
3783
+ ...override.reconnectEvidence ?? {}
3784
+ },
3785
+ reconnectReports: override.reconnectReports ?? base.reconnectReports,
3786
+ traceEvidence: mergeRealCallProfileCollectorOptions(base.traceEvidence ?? {}, override.traceEvidence ?? {}),
3787
+ traceStore: override.traceStore ?? base.traceStore
3788
+ });
3789
+ var buildRealCallEvidenceRuntimeReport = async (options, input = {}) => {
3790
+ const evidence = await options.evidenceStore.list({
3791
+ limit: options.existingEvidenceLimit ?? 5000
3792
+ });
3793
+ const history = await buildVoiceRealCallProfileHistoryReportFromStore({
3794
+ ...options.history ?? {},
3795
+ limit: options.existingEvidenceLimit ?? 5000,
3796
+ store: options.evidenceStore
3797
+ });
3798
+ const generatedAt = (options.now ?? (() => new Date))().toISOString();
3799
+ const sessions = new Set(evidence.map((record) => record.sessionId)).size;
3800
+ const failedProfiles = history.summary.profiles?.filter((profile) => profile.status === "fail").length;
3801
+ const issues = [
3802
+ ...evidence.length === 0 ? ["No real-call profile evidence has been collected yet."] : [],
3803
+ ...history.issues
3804
+ ];
3805
+ const status = evidence.length === 0 ? "empty" : issues.length > 0 ? history.status === "pass" ? "fail" : history.status : history.status;
3806
+ return {
3807
+ appended: input.appended ?? 0,
3808
+ collected: input.collected ?? [],
3809
+ duplicateKeys: input.duplicateKeys ?? [],
3810
+ evidence,
3811
+ generatedAt,
3812
+ history,
3813
+ issues,
3814
+ ok: status === "pass" && issues.length === 0,
3815
+ skippedDuplicates: input.skippedDuplicates ?? 0,
3816
+ source: "real-call-evidence-runtime",
3817
+ status,
3818
+ summary: {
3819
+ collectedEvidence: input.collected?.length ?? 0,
3820
+ failedProfiles: failedProfiles ?? 0,
3821
+ profiles: history.summary.profileCount,
3822
+ sessions,
3823
+ storedEvidence: evidence.length
3824
+ }
3825
+ };
3826
+ };
3827
+ var collectVoiceRealCallEvidenceRuntimeEvidence = async (options) => {
3828
+ const evidence = [];
3829
+ if (options.traceStore) {
3830
+ evidence.push(...buildVoiceRealCallProfileEvidenceFromTraceEvents(await options.traceStore.list({
3831
+ limit: options.traceEvidence?.limit ?? 5000
3832
+ }), options.traceEvidence));
3833
+ }
3834
+ const reconnectReports = await resolveRealCallEvidenceRuntimeReconnectReports(options.reconnectReports, options);
3835
+ if (reconnectReports.length > 0) {
3836
+ evidence.push(...buildVoiceRealCallProfileEvidenceFromReconnectProofReports(reconnectReports, options.reconnectEvidence));
3837
+ }
3838
+ return evidence;
3839
+ };
3840
+ var createVoiceRealCallEvidenceRuntime = (options) => {
3841
+ const appendEvidence = async (evidenceInput, collectOptions = {}) => {
3842
+ const merged = mergeRealCallEvidenceRuntimeOptions(options, collectOptions);
3843
+ const evidence = Array.isArray(evidenceInput) ? [...evidenceInput] : [evidenceInput];
3844
+ const dedupe = merged.dedupe ?? true;
3845
+ const existing = dedupe ? await merged.evidenceStore.list({
3846
+ limit: merged.existingEvidenceLimit ?? 5000
3847
+ }) : [];
3848
+ const seen = new Set(existing.map(readRealCallEvidenceRuntimeKey));
3849
+ const incomingSeen = new Set;
3850
+ const duplicateKeys = [];
3851
+ let appended = 0;
3852
+ for (const item of evidence) {
3853
+ const key = readRealCallEvidenceRuntimeKey(item);
3854
+ if (dedupe && (seen.has(key) || incomingSeen.has(key))) {
3855
+ duplicateKeys.push(key);
3856
+ continue;
3857
+ }
3858
+ incomingSeen.add(key);
3859
+ await merged.evidenceStore.append(item);
3860
+ appended += 1;
3861
+ }
3862
+ return buildRealCallEvidenceRuntimeReport(merged, {
3863
+ appended,
3864
+ collected: evidence,
3865
+ duplicateKeys,
3866
+ skippedDuplicates: duplicateKeys.length
3867
+ });
3868
+ };
3869
+ return {
3870
+ appendEvidence,
3871
+ buildHistoryReport: async (historyOptions = {}) => buildVoiceRealCallProfileHistoryReportFromStore({
3872
+ ...options.history ?? {},
3873
+ ...historyOptions,
3874
+ limit: historyOptions.limit ?? options.existingEvidenceLimit ?? 5000,
3875
+ store: options.evidenceStore
3876
+ }),
3877
+ buildReport: async (collectOptions = {}) => buildRealCallEvidenceRuntimeReport(mergeRealCallEvidenceRuntimeOptions(options, collectOptions)),
3878
+ collect: async (collectOptions = {}) => {
3879
+ const merged = mergeRealCallEvidenceRuntimeOptions(options, collectOptions);
3880
+ const evidence = await collectVoiceRealCallEvidenceRuntimeEvidence(merged);
3881
+ return appendEvidence(evidence, {
3882
+ dedupe: merged.dedupe
3883
+ });
3884
+ },
3885
+ listEvidence: async (listOptions = {}) => await options.evidenceStore.list({
3886
+ limit: options.existingEvidenceLimit ?? 5000,
3887
+ ...listOptions
3888
+ })
3889
+ };
3890
+ };
3891
+ var buildVoiceRealCallEvidenceRuntimeReadinessCheck = (report, options = {}) => {
3892
+ const minStoredEvidence = options.minStoredEvidence ?? 1;
3893
+ const minSessions = options.minSessions ?? 1;
3894
+ const minProfiles = options.minProfiles ?? 1;
3895
+ const issues = [];
3896
+ const warnings = [];
3897
+ if (report.summary.storedEvidence < minStoredEvidence) {
3898
+ issues.push(`Expected at least ${String(minStoredEvidence)} stored real-call evidence record(s), observed ${String(report.summary.storedEvidence)}.`);
3899
+ }
3900
+ if (report.summary.sessions < minSessions) {
3901
+ issues.push(`Expected at least ${String(minSessions)} real-call session(s), observed ${String(report.summary.sessions)}.`);
3902
+ }
3903
+ if (report.summary.profiles < minProfiles) {
3904
+ issues.push(`Expected at least ${String(minProfiles)} real-call profile(s), observed ${String(report.summary.profiles)}.`);
3905
+ }
3906
+ if (report.summary.failedProfiles > 0) {
3907
+ issues.push(`${String(report.summary.failedProfiles)} rolling real-call profile(s) are failing.`);
3908
+ }
3909
+ if (report.status === "empty" || report.status === "stale") {
3910
+ issues.push(`Real-call evidence runtime is ${report.status}.`);
3911
+ } else if (report.status === "fail") {
3912
+ issues.push("Real-call evidence runtime has failing evidence.");
3913
+ }
3914
+ if (report.status !== "pass" && options.failOnWarnings === true) {
3915
+ warnings.push(...report.issues);
3916
+ }
3917
+ const status = issues.length > 0 ? "fail" : warnings.length > 0 && options.failOnWarnings === true ? "fail" : warnings.length > 0 ? "warn" : "pass";
3918
+ const sourceHref = options.sourceHref ?? "/api/voice/real-call-evidence-runtime";
3919
+ const href = options.href ?? "/voice/real-call-evidence-runtime";
3920
+ return {
3921
+ actions: [
3922
+ {
3923
+ description: "Collect fresh real browser, phone, reconnect, provider, and latency evidence into the runtime store.",
3924
+ href: options.collectHref ?? `${sourceHref}/collect`,
3925
+ label: "Collect real-call evidence",
3926
+ method: "POST"
3927
+ },
3928
+ {
3929
+ description: "Open rolling real-call evidence and inspect profile/session depth.",
3930
+ href,
3931
+ label: "Open real-call evidence runtime"
3932
+ }
3933
+ ],
3934
+ detail: status === "pass" ? `${String(report.summary.storedEvidence)} stored evidence record(s), ${String(report.summary.sessions)} session(s), ${String(report.summary.profiles)} profile(s).` : [...issues, ...warnings].join(" "),
3935
+ gateExplanation: {
3936
+ evidenceHref: sourceHref,
3937
+ observed: report.summary.storedEvidence,
3938
+ remediation: "Run real browser or phone traffic, collect runtime evidence, and ensure rolling profile history is passing before promotion.",
3939
+ sourceHref: href,
3940
+ threshold: minStoredEvidence,
3941
+ thresholdLabel: "Minimum stored real-call evidence",
3942
+ unit: "count"
3943
+ },
3944
+ href,
3945
+ label: options.label ?? "Real-call evidence runtime",
3946
+ proofSource: {
3947
+ href: sourceHref,
3948
+ source: report.source,
3949
+ sourceLabel: "Real-call evidence runtime"
3950
+ },
3951
+ status,
3952
+ value: `${String(report.summary.storedEvidence)} evidence / ${String(report.summary.sessions)} sessions / ${String(report.summary.profiles)} profiles`
3953
+ };
3954
+ };
3764
3955
  var realCallProfileTraceSignalTypes = new Set([
3765
3956
  "client.barge_in",
3766
3957
  "client.browser_media",
@@ -5347,6 +5538,31 @@ var renderVoiceRealCallProfileHistoryHTML = (report, title = "Voice Real-Call Pr
5347
5538
  const issues = report.issues.length === 0 ? "<li>None</li>" : report.issues.map((issue) => `<li>${escapeHtml9(issue)}</li>`).join("");
5348
5539
  return `<!doctype html><html lang="en"><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width,initial-scale=1" /><title>${escapeHtml9(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>${escapeHtml9(title)}</h1><p>Generated ${escapeHtml9(report.generatedAt)} from ${escapeHtml9(report.source)}.</p><div class="summary"><span class="pill">Status ${escapeHtml9(report.status)}</span><span class="pill">Reports ${String(report.reports)}</span><span class="pill">Profiles ${String(report.summary.profileCount)}</span><span class="pill">Defaults ${String(report.defaults.summary.actionableProfiles)}/${String(report.defaults.summary.profileCount)}</span><span class="pill">Cycles ${String(report.summary.cycles ?? 0)}</span><span class="pill">Best mix ${escapeHtml9(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><section class="card"><h2>Actionable Defaults</h2><table><thead><tr><th>Profile</th><th>Status</th><th>Provider routes</th><th>Live budget</th><th>Provider budget</th><th>Turn budget</th></tr></thead><tbody>${defaultRows}</tbody></table></section>${recommendations}<section class="card"><h2>Issues</h2><ul>${issues}</ul></section></main></body></html>`;
5349
5540
  };
5541
+ var renderVoiceRealCallEvidenceRuntimeMarkdown = (report, title = "Voice Real-Call Evidence Runtime") => [
5542
+ `# ${title}`,
5543
+ "",
5544
+ `- Status: ${report.status}`,
5545
+ `- Stored evidence: ${String(report.summary.storedEvidence)}`,
5546
+ `- Collected evidence: ${String(report.summary.collectedEvidence)}`,
5547
+ `- Appended: ${String(report.appended)}`,
5548
+ `- Skipped duplicates: ${String(report.skippedDuplicates)}`,
5549
+ `- Sessions: ${String(report.summary.sessions)}`,
5550
+ `- Profiles: ${String(report.summary.profiles)}`,
5551
+ "",
5552
+ "## Rolling Profile History",
5553
+ "",
5554
+ renderVoiceRealCallProfileHistoryMarkdown(report.history, "Rolling Real-Call Profile History"),
5555
+ "",
5556
+ "## Issues",
5557
+ "",
5558
+ ...report.issues.length ? report.issues.map((issue) => `- ${issue}`) : ["- None"]
5559
+ ].join(`
5560
+ `);
5561
+ var renderVoiceRealCallEvidenceRuntimeHTML = (report, title = "Voice Real-Call Evidence Runtime") => {
5562
+ const issueItems = report.issues.length === 0 ? "<li>None</li>" : report.issues.map((issue) => `<li>${escapeHtml9(issue)}</li>`).join("");
5563
+ const profileRows = report.history.summary.profiles?.length ? report.history.summary.profiles.map((profile) => `<tr><td>${escapeHtml9(profile.label ?? profile.id)}</td><td>${escapeHtml9(profile.status ?? "unknown")}</td><td>${escapeHtml9(profile.sessionCount ?? "n/a")}</td><td>${escapeHtml9(profile.maxLiveP95Ms ?? "n/a")}</td><td>${escapeHtml9(profile.maxProviderP95Ms ?? "n/a")}</td><td>${escapeHtml9(formatProviderMix(profile.providers ?? []))}</td></tr>`).join("") : '<tr><td colspan="6">No profile history has been collected yet.</td></tr>';
5564
+ return `<!doctype html><html lang="en"><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width,initial-scale=1" /><title>${escapeHtml9(title)}</title><style>body{background:#0f1618;color:#f2f7f2;font-family:ui-sans-serif,system-ui,sans-serif;margin:0}main{margin:auto;max-width:1120px;padding:32px}.hero,.card{background:#162225;border:1px solid #2f4548;border-radius:24px;margin-bottom:16px;padding:22px}.hero{background:linear-gradient(135deg,rgba(20,184,166,.18),rgba(132,204,22,.1))}.eyebrow{color:#99f6e4;font-weight:900;letter-spacing:.1em;text-transform:uppercase}h1{font-size:clamp(2.1rem,6vw,4.3rem);letter-spacing:-.06em;line-height:.94;margin:.2rem 0 1rem}.summary{display:flex;flex-wrap:wrap;gap:10px}.pill{border:1px solid #4b6669;border-radius:999px;padding:8px 12px}.pass{border-color:rgba(34,197,94,.55)}.warn{border-color:rgba(245,158,11,.7)}.fail,.empty,.stale{border-color:rgba(239,68,68,.75)}table{border-collapse:collapse;width:100%}td,th{border-bottom:1px solid #2f4548;padding:10px;text-align:left}</style></head><body><main><section class="hero"><p class="eyebrow">Real-call evidence runtime</p><h1>${escapeHtml9(title)}</h1><p>Generated ${escapeHtml9(report.generatedAt)} from ${escapeHtml9(report.source)}.</p><div class="summary"><span class="pill ${escapeHtml9(report.status)}">Status ${escapeHtml9(report.status)}</span><span class="pill">Stored ${String(report.summary.storedEvidence)}</span><span class="pill">Collected ${String(report.summary.collectedEvidence)}</span><span class="pill">Appended ${String(report.appended)}</span><span class="pill">Duplicates ${String(report.skippedDuplicates)}</span><span class="pill">Sessions ${String(report.summary.sessions)}</span><span class="pill">Profiles ${String(report.summary.profiles)}</span></div></section><section class="card"><h2>Rolling Profile History</h2><table><thead><tr><th>Profile</th><th>Status</th><th>Sessions</th><th>Live p95</th><th>Provider p95</th><th>Provider mix</th></tr></thead><tbody>${profileRows}</tbody></table></section><section class="card"><h2>Issues</h2><ul>${issueItems}</ul></section></main></body></html>`;
5565
+ };
5350
5566
  var createVoiceProofTrendRecommendationRoutes = (options) => {
5351
5567
  const path = options.path ?? "/api/voice/proof-trend-recommendations";
5352
5568
  const htmlPath = options.htmlPath === undefined ? "/voice/proof-trend-recommendations" : options.htmlPath;
@@ -5430,6 +5646,46 @@ var createVoiceRealCallProfileHistoryRoutes = (options = {}) => {
5430
5646
  }
5431
5647
  return routes;
5432
5648
  };
5649
+ var createVoiceRealCallEvidenceRuntimeRoutes = (options) => {
5650
+ const path = options.jsonPath ?? "/api/voice/real-call-evidence-runtime";
5651
+ const collectPath = options.collectPath === undefined ? `${path}/collect` : options.collectPath;
5652
+ const htmlPath = options.htmlPath === undefined ? "/voice/real-call-evidence-runtime" : options.htmlPath;
5653
+ const markdownPath = options.markdownPath === undefined ? "/voice/real-call-evidence-runtime.md" : options.markdownPath;
5654
+ const title = options.title ?? "Voice Real-Call Evidence Runtime";
5655
+ const runtime = options.runtime ?? createVoiceRealCallEvidenceRuntime({
5656
+ ...options
5657
+ });
5658
+ const routes = new Elysia4({
5659
+ name: options.name ?? "absolutejs-voice-real-call-evidence-runtime"
5660
+ });
5661
+ routes.get(path, async () => Response.json(await runtime.buildReport(), { headers: options.headers }));
5662
+ if (collectPath !== false) {
5663
+ routes.post(collectPath, async () => Response.json(await runtime.collect(), { headers: options.headers }));
5664
+ }
5665
+ if (htmlPath !== false) {
5666
+ routes.get(htmlPath, async () => {
5667
+ const report = await runtime.buildReport();
5668
+ return new Response(renderVoiceRealCallEvidenceRuntimeHTML(report, title), {
5669
+ headers: {
5670
+ "content-type": "text/html; charset=utf-8",
5671
+ ...Object.fromEntries(new Headers(options.headers))
5672
+ }
5673
+ });
5674
+ });
5675
+ }
5676
+ if (markdownPath !== false) {
5677
+ routes.get(markdownPath, async () => {
5678
+ const report = await runtime.buildReport();
5679
+ return new Response(renderVoiceRealCallEvidenceRuntimeMarkdown(report, title), {
5680
+ headers: {
5681
+ "content-type": "text/markdown; charset=utf-8",
5682
+ ...Object.fromEntries(new Headers(options.headers))
5683
+ }
5684
+ });
5685
+ });
5686
+ }
5687
+ return routes;
5688
+ };
5433
5689
  var realCallProfileActionPaths = {
5434
5690
  "collect-browser-proof": "/collect-browser-proof",
5435
5691
  "collect-phone-proof": "/collect-phone-proof",