@absolutejs/voice 0.0.22-beta.454 → 0.0.22-beta.455
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.js +192 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +196 -0
- package/dist/proofTrends.d.ts +85 -0
- package/dist/react/index.js +192 -0
- package/dist/vue/index.js +192 -0
- package/package.json +1 -1
package/dist/client/index.js
CHANGED
|
@@ -6666,6 +6666,133 @@ var buildVoiceRealCallProfileEvidenceFromReconnectProofReports = (input, options
|
|
|
6666
6666
|
};
|
|
6667
6667
|
var loadVoiceRealCallProfileEvidenceFromTraceStore = async (options) => buildVoiceRealCallProfileEvidenceFromTraceEvents(await options.store.list({ limit: options.limit ?? 5000 }), options);
|
|
6668
6668
|
var loadVoiceRealCallProfileEvidenceFromStore = async (options) => options.store.list(options);
|
|
6669
|
+
var readRealCallEvidenceRuntimeKey = (evidence) => [evidence.profileId, evidence.sessionId, evidence.generatedAt ?? ""].join("\x00");
|
|
6670
|
+
var resolveRealCallEvidenceRuntimeReconnectReports = async (reports, options) => {
|
|
6671
|
+
const resolved = typeof reports === "function" ? await reports(options) : reports;
|
|
6672
|
+
if (!resolved) {
|
|
6673
|
+
return [];
|
|
6674
|
+
}
|
|
6675
|
+
return Array.isArray(resolved) ? resolved : [resolved];
|
|
6676
|
+
};
|
|
6677
|
+
var mergeRealCallEvidenceRuntimeOptions = (base, override = {}) => ({
|
|
6678
|
+
dedupe: override.dedupe ?? base.dedupe,
|
|
6679
|
+
evidenceStore: override.evidenceStore ?? base.evidenceStore,
|
|
6680
|
+
existingEvidenceLimit: override.existingEvidenceLimit ?? base.existingEvidenceLimit,
|
|
6681
|
+
history: {
|
|
6682
|
+
...base.history ?? {},
|
|
6683
|
+
...override.history ?? {}
|
|
6684
|
+
},
|
|
6685
|
+
now: override.now ?? base.now,
|
|
6686
|
+
reconnectEvidence: {
|
|
6687
|
+
...base.reconnectEvidence ?? {},
|
|
6688
|
+
...override.reconnectEvidence ?? {}
|
|
6689
|
+
},
|
|
6690
|
+
reconnectReports: override.reconnectReports ?? base.reconnectReports,
|
|
6691
|
+
traceEvidence: mergeRealCallProfileCollectorOptions(base.traceEvidence ?? {}, override.traceEvidence ?? {}),
|
|
6692
|
+
traceStore: override.traceStore ?? base.traceStore
|
|
6693
|
+
});
|
|
6694
|
+
var buildRealCallEvidenceRuntimeReport = async (options, input = {}) => {
|
|
6695
|
+
const evidence = await options.evidenceStore.list({
|
|
6696
|
+
limit: options.existingEvidenceLimit ?? 5000
|
|
6697
|
+
});
|
|
6698
|
+
const history = await buildVoiceRealCallProfileHistoryReportFromStore({
|
|
6699
|
+
...options.history ?? {},
|
|
6700
|
+
limit: options.existingEvidenceLimit ?? 5000,
|
|
6701
|
+
store: options.evidenceStore
|
|
6702
|
+
});
|
|
6703
|
+
const generatedAt = (options.now ?? (() => new Date))().toISOString();
|
|
6704
|
+
const sessions = new Set(evidence.map((record) => record.sessionId)).size;
|
|
6705
|
+
const failedProfiles = history.summary.profiles?.filter((profile) => profile.status === "fail").length;
|
|
6706
|
+
const issues = [
|
|
6707
|
+
...evidence.length === 0 ? ["No real-call profile evidence has been collected yet."] : [],
|
|
6708
|
+
...history.issues
|
|
6709
|
+
];
|
|
6710
|
+
const status = evidence.length === 0 ? "empty" : issues.length > 0 ? history.status === "pass" ? "fail" : history.status : history.status;
|
|
6711
|
+
return {
|
|
6712
|
+
appended: input.appended ?? 0,
|
|
6713
|
+
collected: input.collected ?? [],
|
|
6714
|
+
duplicateKeys: input.duplicateKeys ?? [],
|
|
6715
|
+
evidence,
|
|
6716
|
+
generatedAt,
|
|
6717
|
+
history,
|
|
6718
|
+
issues,
|
|
6719
|
+
ok: status === "pass" && issues.length === 0,
|
|
6720
|
+
skippedDuplicates: input.skippedDuplicates ?? 0,
|
|
6721
|
+
source: "real-call-evidence-runtime",
|
|
6722
|
+
status,
|
|
6723
|
+
summary: {
|
|
6724
|
+
collectedEvidence: input.collected?.length ?? 0,
|
|
6725
|
+
failedProfiles: failedProfiles ?? 0,
|
|
6726
|
+
profiles: history.summary.profileCount,
|
|
6727
|
+
sessions,
|
|
6728
|
+
storedEvidence: evidence.length
|
|
6729
|
+
}
|
|
6730
|
+
};
|
|
6731
|
+
};
|
|
6732
|
+
var collectVoiceRealCallEvidenceRuntimeEvidence = async (options) => {
|
|
6733
|
+
const evidence = [];
|
|
6734
|
+
if (options.traceStore) {
|
|
6735
|
+
evidence.push(...buildVoiceRealCallProfileEvidenceFromTraceEvents(await options.traceStore.list({
|
|
6736
|
+
limit: options.traceEvidence?.limit ?? 5000
|
|
6737
|
+
}), options.traceEvidence));
|
|
6738
|
+
}
|
|
6739
|
+
const reconnectReports = await resolveRealCallEvidenceRuntimeReconnectReports(options.reconnectReports, options);
|
|
6740
|
+
if (reconnectReports.length > 0) {
|
|
6741
|
+
evidence.push(...buildVoiceRealCallProfileEvidenceFromReconnectProofReports(reconnectReports, options.reconnectEvidence));
|
|
6742
|
+
}
|
|
6743
|
+
return evidence;
|
|
6744
|
+
};
|
|
6745
|
+
var createVoiceRealCallEvidenceRuntime = (options) => {
|
|
6746
|
+
const appendEvidence = async (evidenceInput, collectOptions = {}) => {
|
|
6747
|
+
const merged = mergeRealCallEvidenceRuntimeOptions(options, collectOptions);
|
|
6748
|
+
const evidence = Array.isArray(evidenceInput) ? [...evidenceInput] : [evidenceInput];
|
|
6749
|
+
const dedupe = merged.dedupe ?? true;
|
|
6750
|
+
const existing = dedupe ? await merged.evidenceStore.list({
|
|
6751
|
+
limit: merged.existingEvidenceLimit ?? 5000
|
|
6752
|
+
}) : [];
|
|
6753
|
+
const seen = new Set(existing.map(readRealCallEvidenceRuntimeKey));
|
|
6754
|
+
const incomingSeen = new Set;
|
|
6755
|
+
const duplicateKeys = [];
|
|
6756
|
+
let appended = 0;
|
|
6757
|
+
for (const item of evidence) {
|
|
6758
|
+
const key = readRealCallEvidenceRuntimeKey(item);
|
|
6759
|
+
if (dedupe && (seen.has(key) || incomingSeen.has(key))) {
|
|
6760
|
+
duplicateKeys.push(key);
|
|
6761
|
+
continue;
|
|
6762
|
+
}
|
|
6763
|
+
incomingSeen.add(key);
|
|
6764
|
+
await merged.evidenceStore.append(item);
|
|
6765
|
+
appended += 1;
|
|
6766
|
+
}
|
|
6767
|
+
return buildRealCallEvidenceRuntimeReport(merged, {
|
|
6768
|
+
appended,
|
|
6769
|
+
collected: evidence,
|
|
6770
|
+
duplicateKeys,
|
|
6771
|
+
skippedDuplicates: duplicateKeys.length
|
|
6772
|
+
});
|
|
6773
|
+
};
|
|
6774
|
+
return {
|
|
6775
|
+
appendEvidence,
|
|
6776
|
+
buildHistoryReport: async (historyOptions = {}) => buildVoiceRealCallProfileHistoryReportFromStore({
|
|
6777
|
+
...options.history ?? {},
|
|
6778
|
+
...historyOptions,
|
|
6779
|
+
limit: historyOptions.limit ?? options.existingEvidenceLimit ?? 5000,
|
|
6780
|
+
store: options.evidenceStore
|
|
6781
|
+
}),
|
|
6782
|
+
buildReport: async (collectOptions = {}) => buildRealCallEvidenceRuntimeReport(mergeRealCallEvidenceRuntimeOptions(options, collectOptions)),
|
|
6783
|
+
collect: async (collectOptions = {}) => {
|
|
6784
|
+
const merged = mergeRealCallEvidenceRuntimeOptions(options, collectOptions);
|
|
6785
|
+
const evidence = await collectVoiceRealCallEvidenceRuntimeEvidence(merged);
|
|
6786
|
+
return appendEvidence(evidence, {
|
|
6787
|
+
dedupe: merged.dedupe
|
|
6788
|
+
});
|
|
6789
|
+
},
|
|
6790
|
+
listEvidence: async (listOptions = {}) => await options.evidenceStore.list({
|
|
6791
|
+
limit: options.existingEvidenceLimit ?? 5000,
|
|
6792
|
+
...listOptions
|
|
6793
|
+
})
|
|
6794
|
+
};
|
|
6795
|
+
};
|
|
6669
6796
|
var realCallProfileTraceSignalTypes = new Set([
|
|
6670
6797
|
"client.barge_in",
|
|
6671
6798
|
"client.browser_media",
|
|
@@ -8252,6 +8379,31 @@ var renderVoiceRealCallProfileHistoryHTML = (report, title = "Voice Real-Call Pr
|
|
|
8252
8379
|
const issues = report.issues.length === 0 ? "<li>None</li>" : report.issues.map((issue) => `<li>${escapeHtml9(issue)}</li>`).join("");
|
|
8253
8380
|
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>`;
|
|
8254
8381
|
};
|
|
8382
|
+
var renderVoiceRealCallEvidenceRuntimeMarkdown = (report, title = "Voice Real-Call Evidence Runtime") => [
|
|
8383
|
+
`# ${title}`,
|
|
8384
|
+
"",
|
|
8385
|
+
`- Status: ${report.status}`,
|
|
8386
|
+
`- Stored evidence: ${String(report.summary.storedEvidence)}`,
|
|
8387
|
+
`- Collected evidence: ${String(report.summary.collectedEvidence)}`,
|
|
8388
|
+
`- Appended: ${String(report.appended)}`,
|
|
8389
|
+
`- Skipped duplicates: ${String(report.skippedDuplicates)}`,
|
|
8390
|
+
`- Sessions: ${String(report.summary.sessions)}`,
|
|
8391
|
+
`- Profiles: ${String(report.summary.profiles)}`,
|
|
8392
|
+
"",
|
|
8393
|
+
"## Rolling Profile History",
|
|
8394
|
+
"",
|
|
8395
|
+
renderVoiceRealCallProfileHistoryMarkdown(report.history, "Rolling Real-Call Profile History"),
|
|
8396
|
+
"",
|
|
8397
|
+
"## Issues",
|
|
8398
|
+
"",
|
|
8399
|
+
...report.issues.length ? report.issues.map((issue) => `- ${issue}`) : ["- None"]
|
|
8400
|
+
].join(`
|
|
8401
|
+
`);
|
|
8402
|
+
var renderVoiceRealCallEvidenceRuntimeHTML = (report, title = "Voice Real-Call Evidence Runtime") => {
|
|
8403
|
+
const issueItems = report.issues.length === 0 ? "<li>None</li>" : report.issues.map((issue) => `<li>${escapeHtml9(issue)}</li>`).join("");
|
|
8404
|
+
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>';
|
|
8405
|
+
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>`;
|
|
8406
|
+
};
|
|
8255
8407
|
var createVoiceProofTrendRecommendationRoutes = (options) => {
|
|
8256
8408
|
const path = options.path ?? "/api/voice/proof-trend-recommendations";
|
|
8257
8409
|
const htmlPath = options.htmlPath === undefined ? "/voice/proof-trend-recommendations" : options.htmlPath;
|
|
@@ -8335,6 +8487,46 @@ var createVoiceRealCallProfileHistoryRoutes = (options = {}) => {
|
|
|
8335
8487
|
}
|
|
8336
8488
|
return routes;
|
|
8337
8489
|
};
|
|
8490
|
+
var createVoiceRealCallEvidenceRuntimeRoutes = (options) => {
|
|
8491
|
+
const path = options.jsonPath ?? "/api/voice/real-call-evidence-runtime";
|
|
8492
|
+
const collectPath = options.collectPath === undefined ? `${path}/collect` : options.collectPath;
|
|
8493
|
+
const htmlPath = options.htmlPath === undefined ? "/voice/real-call-evidence-runtime" : options.htmlPath;
|
|
8494
|
+
const markdownPath = options.markdownPath === undefined ? "/voice/real-call-evidence-runtime.md" : options.markdownPath;
|
|
8495
|
+
const title = options.title ?? "Voice Real-Call Evidence Runtime";
|
|
8496
|
+
const runtime = options.runtime ?? createVoiceRealCallEvidenceRuntime({
|
|
8497
|
+
...options
|
|
8498
|
+
});
|
|
8499
|
+
const routes = new Elysia4({
|
|
8500
|
+
name: options.name ?? "absolutejs-voice-real-call-evidence-runtime"
|
|
8501
|
+
});
|
|
8502
|
+
routes.get(path, async () => Response.json(await runtime.buildReport(), { headers: options.headers }));
|
|
8503
|
+
if (collectPath !== false) {
|
|
8504
|
+
routes.post(collectPath, async () => Response.json(await runtime.collect(), { headers: options.headers }));
|
|
8505
|
+
}
|
|
8506
|
+
if (htmlPath !== false) {
|
|
8507
|
+
routes.get(htmlPath, async () => {
|
|
8508
|
+
const report = await runtime.buildReport();
|
|
8509
|
+
return new Response(renderVoiceRealCallEvidenceRuntimeHTML(report, title), {
|
|
8510
|
+
headers: {
|
|
8511
|
+
"content-type": "text/html; charset=utf-8",
|
|
8512
|
+
...Object.fromEntries(new Headers(options.headers))
|
|
8513
|
+
}
|
|
8514
|
+
});
|
|
8515
|
+
});
|
|
8516
|
+
}
|
|
8517
|
+
if (markdownPath !== false) {
|
|
8518
|
+
routes.get(markdownPath, async () => {
|
|
8519
|
+
const report = await runtime.buildReport();
|
|
8520
|
+
return new Response(renderVoiceRealCallEvidenceRuntimeMarkdown(report, title), {
|
|
8521
|
+
headers: {
|
|
8522
|
+
"content-type": "text/markdown; charset=utf-8",
|
|
8523
|
+
...Object.fromEntries(new Headers(options.headers))
|
|
8524
|
+
}
|
|
8525
|
+
});
|
|
8526
|
+
});
|
|
8527
|
+
}
|
|
8528
|
+
return routes;
|
|
8529
|
+
};
|
|
8338
8530
|
var realCallProfileActionPaths = {
|
|
8339
8531
|
"collect-browser-proof": "/collect-browser-proof",
|
|
8340
8532
|
"collect-phone-proof": "/collect-phone-proof",
|
package/dist/index.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export { assertVoicePlatformCoverage, buildVoicePlatformCoverageSummary, createV
|
|
|
31
31
|
export { assertVoiceCompetitiveCoverage, buildVoiceCompetitiveCoverageReport, createVoiceCompetitiveCoverageRoutes, evaluateVoiceCompetitiveCoverage, renderVoiceCompetitiveCoverageHTML, renderVoiceCompetitiveCoverageMarkdown, } from "./competitiveCoverage";
|
|
32
32
|
export type { VoiceCompetitiveCoverageAssertionInput, VoiceCompetitiveCoverageAssertionReport, VoiceCompetitiveCoverageIssue, VoiceCompetitiveCoverageLevel, VoiceCompetitiveCoverageReport, VoiceCompetitiveCoverageReportInput, VoiceCompetitiveCoverageRoutesOptions, VoiceCompetitiveCoverageStatus, VoiceCompetitiveCoverageSummary, VoiceCompetitiveDepthLevel, VoiceCompetitiveEvidence, VoiceCompetitiveSurface, } from "./competitiveCoverage";
|
|
33
33
|
export type { VoicePlatformCoverageAssertionInput, VoicePlatformCoverageAssertionReport, VoicePlatformCoverageEvidence, VoicePlatformCoverageRoutesOptions, VoicePlatformCoverageStatus, VoicePlatformCoverageSummary, VoicePlatformCoverageSummaryInput, VoicePlatformCoverageSurface, } from "./platformCoverage";
|
|
34
|
-
export { assertVoiceProofTrendEvidence, appendVoiceRealCallProfileRecoveryEvidence, buildEmptyVoiceProofTrendReport, buildVoiceProofTrendProfileSummaries, buildVoiceProofTrendRecommendationReport, buildVoiceProofTrendReportFromRealCallProfiles, buildVoiceProofTrendReport, buildVoiceRealCallProfileEvidenceFromTraceEvents, buildVoiceRealCallProfileEvidenceFromReconnectProofReports, buildVoiceRealCallProfileDefaults, buildVoiceRealCallProfileHistoryReport, buildVoiceRealCallProfileHistoryReportFromStore, buildVoiceRealCallProfileReadinessCheck, buildVoiceRealCallProfileRecoveryJobHistoryCheck, buildVoiceRealCallProfileRecoveryActions, buildVoiceReconnectProfileEvidenceSummary, createVoiceInMemoryRealCallProfileRecoveryJobStore, createVoiceRealCallProfileTraceCollector, createVoiceSQLiteRealCallProfileEvidenceStore, createVoiceSQLiteRealCallProfileRecoveryJobStore, createVoiceProofTrendRecommendationRoutes, createVoiceProofTrendRoutes, createVoiceRealCallProfileHistoryRoutes, createVoiceRealCallProfileRecoveryActionRoutes, DEFAULT_VOICE_PROOF_TREND_PROFILE_DEFINITIONS, DEFAULT_VOICE_PROOF_TRENDS_MAX_AGE_MS, evaluateVoiceProofTrendEvidence, formatVoiceProofTrendAge, loadVoiceRealCallProfileEvidenceFromStore, loadVoiceRealCallProfileEvidenceFromTraceStore, normalizeVoiceProofTrendReport, readVoiceProofTrendReportFile, renderVoiceProofTrendRecommendationHTML, renderVoiceProofTrendRecommendationMarkdown, renderVoiceRealCallProfileHistoryHTML, renderVoiceRealCallProfileHistoryMarkdown, runVoiceRealCallProfileRecoveryLoop, resolveVoiceRealCallProfileProviderRoute, } from "./proofTrends";
|
|
34
|
+
export { assertVoiceProofTrendEvidence, appendVoiceRealCallProfileRecoveryEvidence, buildEmptyVoiceProofTrendReport, buildVoiceProofTrendProfileSummaries, buildVoiceProofTrendRecommendationReport, buildVoiceProofTrendReportFromRealCallProfiles, buildVoiceProofTrendReport, buildVoiceRealCallProfileEvidenceFromTraceEvents, buildVoiceRealCallProfileEvidenceFromReconnectProofReports, buildVoiceRealCallProfileDefaults, buildVoiceRealCallProfileHistoryReport, buildVoiceRealCallProfileHistoryReportFromStore, buildVoiceRealCallProfileReadinessCheck, buildVoiceRealCallProfileRecoveryJobHistoryCheck, buildVoiceRealCallProfileRecoveryActions, buildVoiceReconnectProfileEvidenceSummary, createVoiceRealCallEvidenceRuntime, createVoiceRealCallEvidenceRuntimeRoutes, createVoiceInMemoryRealCallProfileRecoveryJobStore, createVoiceRealCallProfileTraceCollector, createVoiceSQLiteRealCallProfileEvidenceStore, createVoiceSQLiteRealCallProfileRecoveryJobStore, createVoiceProofTrendRecommendationRoutes, createVoiceProofTrendRoutes, createVoiceRealCallProfileHistoryRoutes, createVoiceRealCallProfileRecoveryActionRoutes, DEFAULT_VOICE_PROOF_TREND_PROFILE_DEFINITIONS, DEFAULT_VOICE_PROOF_TRENDS_MAX_AGE_MS, evaluateVoiceProofTrendEvidence, formatVoiceProofTrendAge, loadVoiceRealCallProfileEvidenceFromStore, loadVoiceRealCallProfileEvidenceFromTraceStore, normalizeVoiceProofTrendReport, readVoiceProofTrendReportFile, renderVoiceProofTrendRecommendationHTML, renderVoiceProofTrendRecommendationMarkdown, renderVoiceRealCallEvidenceRuntimeHTML, renderVoiceRealCallEvidenceRuntimeMarkdown, renderVoiceRealCallProfileHistoryHTML, renderVoiceRealCallProfileHistoryMarkdown, runVoiceRealCallProfileRecoveryLoop, resolveVoiceRealCallProfileProviderRoute, } from "./proofTrends";
|
|
35
35
|
export { createVoiceEvidenceAssertion, createVoiceProofAssertion, summarizeVoiceProofAssertions, } from "./proofAssertions";
|
|
36
36
|
export { buildVoiceSessionSnapshot, buildVoiceSessionSnapshotStatus, createVoiceSessionSnapshotRoutes, parseVoiceSessionSnapshot, } from "./sessionSnapshot";
|
|
37
37
|
export { buildVoiceCallDebuggerReport, createVoiceCallDebuggerRoutes, renderVoiceCallDebuggerHTML, resolveLatestVoiceCallDebuggerSessionId, } from "./callDebugger";
|
|
@@ -46,7 +46,7 @@ export { buildVoiceProviderDecisionTraceReport, createVoiceProviderDecisionTrace
|
|
|
46
46
|
export type { VoiceProviderDecisionStatus, VoiceProviderDecisionSurfaceReport, VoiceProviderDecisionTrace, VoiceProviderDecisionTraceInput, VoiceProviderDecisionTraceIssue, VoiceProviderDecisionTraceReport, VoiceProviderDecisionTraceReportOptions, VoiceProviderDecisionTraceRoutesOptions, } from "./providerDecisionTraces";
|
|
47
47
|
export { appendVoiceIOProviderRouterTraceEvent, appendVoiceProviderRouterTraceEvent, buildVoiceIOProviderRouterTraceEvent, buildVoiceProviderRouterTraceEvent, } from "./providerRouterTraces";
|
|
48
48
|
export type { VoiceIOProviderRouterTraceAppendOptions, VoiceIOProviderRouterTraceEventOptions, VoiceProviderRouterTraceAppendOptions, VoiceProviderRouterTraceEventOptions, } from "./providerRouterTraces";
|
|
49
|
-
export type { VoiceProofTrendAssertionInput, VoiceProofTrendAssertionReport, VoiceProofTrendCycle, VoiceProofTrendProfileDefinition, VoiceProofTrendProfileRecommendation, VoiceProofTrendProfileSummaryOptions, VoiceProofTrendProfileSummary, VoiceProofTrendProviderRecommendation, VoiceProofTrendProviderSummary, VoiceProofTrendReconnectSummary, VoiceProofTrendRecommendation, VoiceProofTrendRecommendationOptions, VoiceProofTrendRecommendationReport, VoiceProofTrendRecommendationRoutesOptions, VoiceProofTrendRecommendationStatus, VoiceProofTrendRecommendationSurface, VoiceProofTrendRealCallProfileEvidence, VoiceProofTrendRealCallProfileReportOptions, VoiceProofTrendReport, VoiceProofTrendReportInput, VoiceProofTrendRoutesOptions, VoiceProofTrendRuntimeChannelSummary, VoiceProofTrendStatus, VoiceProofTrendSummary, VoiceRealCallProfileDefault, VoiceRealCallProfileDefaultsOptions, VoiceRealCallProfileDefaultsReport, VoiceRealCallProfileEvidenceCreateInput, VoiceRealCallProfileEvidenceListOptions, VoiceRealCallProfileEvidenceRecord, VoiceRealCallProfileEvidenceStore, VoiceRealCallProfileHistoryOptions, VoiceRealCallProfileHistoryReport, VoiceRealCallProfileHistoryRoutesOptions, VoiceRealCallProfileProviderRouteOptions, VoiceRealCallProfileReadinessCheckOptions, VoiceRealCallProfileRecoveryActionOptions, VoiceRealCallProfileRecoveryAction, VoiceRealCallProfileRecoveryActionHandler, VoiceRealCallProfileRecoveryActionHandlerInput, VoiceRealCallProfileRecoveryActionId, VoiceRealCallProfileRecoveryJobHistoryCheckOptions, VoiceRealCallProfileRecoveryActionResult, VoiceRealCallProfileRecoveryActionRoutesOptions, VoiceRealCallProfileRecoveryJob, VoiceRealCallProfileRecoveryJobCreateInput, VoiceRealCallProfileRecoveryJobListOptions, VoiceRealCallProfileRecoveryJobStatus, VoiceRealCallProfileRecoveryJobStore, VoiceRealCallProfileRecoveryJobUpdate, VoiceRealCallProfileRecoveryLoopAction, VoiceRealCallProfileRecoveryLoopJob, VoiceRealCallProfileRecoveryLoopJobResult, VoiceRealCallProfileRecoveryLoopOptions, VoiceRealCallProfileRecoveryLoopReport, VoiceRealCallProfileRecoveryLoopStartFailure, VoiceRealCallProfileRecoveryEvidenceOptions, VoiceRealCallProfileRecoveryEvidenceProvider, VoiceRealCallProfileRecoveryEvidenceProviderRole, VoiceRealCallProfileRecoveryEvidenceResult, VoiceSQLiteRealCallProfileRecoveryJobStoreOptions, VoiceRealCallProfileTraceCollector, VoiceRealCallProfileTraceCollectorEvidenceOptions, VoiceRealCallProfileTraceCollectorOptions, VoiceRealCallProfileTraceEvidenceOptions, VoiceRealCallProfileTraceStoreEvidenceOptions, VoiceReconnectRealCallProfileEvidenceOptions, VoiceReconnectProfileEvidenceSummary, VoiceReconnectProfileEvidenceSummaryStatus, VoiceSQLiteRealCallProfileEvidenceStoreOptions, } from "./proofTrends";
|
|
49
|
+
export type { VoiceProofTrendAssertionInput, VoiceProofTrendAssertionReport, VoiceProofTrendCycle, VoiceProofTrendProfileDefinition, VoiceProofTrendProfileRecommendation, VoiceProofTrendProfileSummaryOptions, VoiceProofTrendProfileSummary, VoiceProofTrendProviderRecommendation, VoiceProofTrendProviderSummary, VoiceProofTrendReconnectSummary, VoiceProofTrendRecommendation, VoiceProofTrendRecommendationOptions, VoiceProofTrendRecommendationReport, VoiceProofTrendRecommendationRoutesOptions, VoiceProofTrendRecommendationStatus, VoiceProofTrendRecommendationSurface, VoiceProofTrendRealCallProfileEvidence, VoiceProofTrendRealCallProfileReportOptions, VoiceProofTrendReport, VoiceProofTrendReportInput, VoiceProofTrendRoutesOptions, VoiceProofTrendRuntimeChannelSummary, VoiceProofTrendStatus, VoiceProofTrendSummary, VoiceRealCallProfileDefault, VoiceRealCallProfileDefaultsOptions, VoiceRealCallProfileDefaultsReport, VoiceRealCallProfileEvidenceCreateInput, VoiceRealCallProfileEvidenceListOptions, VoiceRealCallProfileEvidenceRecord, VoiceRealCallProfileEvidenceStore, VoiceRealCallProfileHistoryOptions, VoiceRealCallProfileHistoryReport, VoiceRealCallProfileHistoryRoutesOptions, VoiceRealCallProfileProviderRouteOptions, VoiceRealCallProfileReadinessCheckOptions, VoiceRealCallProfileRecoveryActionOptions, VoiceRealCallProfileRecoveryAction, VoiceRealCallProfileRecoveryActionHandler, VoiceRealCallProfileRecoveryActionHandlerInput, VoiceRealCallProfileRecoveryActionId, VoiceRealCallProfileRecoveryJobHistoryCheckOptions, VoiceRealCallProfileRecoveryActionResult, VoiceRealCallProfileRecoveryActionRoutesOptions, VoiceRealCallProfileRecoveryJob, VoiceRealCallProfileRecoveryJobCreateInput, VoiceRealCallProfileRecoveryJobListOptions, VoiceRealCallProfileRecoveryJobStatus, VoiceRealCallProfileRecoveryJobStore, VoiceRealCallProfileRecoveryJobUpdate, VoiceRealCallProfileRecoveryLoopAction, VoiceRealCallProfileRecoveryLoopJob, VoiceRealCallProfileRecoveryLoopJobResult, VoiceRealCallProfileRecoveryLoopOptions, VoiceRealCallProfileRecoveryLoopReport, VoiceRealCallProfileRecoveryLoopStartFailure, VoiceRealCallProfileRecoveryEvidenceOptions, VoiceRealCallProfileRecoveryEvidenceProvider, VoiceRealCallProfileRecoveryEvidenceProviderRole, VoiceRealCallProfileRecoveryEvidenceResult, VoiceSQLiteRealCallProfileRecoveryJobStoreOptions, VoiceRealCallProfileTraceCollector, VoiceRealCallProfileTraceCollectorEvidenceOptions, VoiceRealCallProfileTraceCollectorOptions, VoiceRealCallProfileTraceEvidenceOptions, VoiceRealCallProfileTraceStoreEvidenceOptions, VoiceReconnectRealCallProfileEvidenceOptions, VoiceReconnectProfileEvidenceSummary, VoiceReconnectProfileEvidenceSummaryStatus, VoiceRealCallEvidenceRuntime, VoiceRealCallEvidenceRuntimeCollectOptions, VoiceRealCallEvidenceRuntimeOptions, VoiceRealCallEvidenceRuntimeReport, VoiceRealCallEvidenceRuntimeRoutesOptions, VoiceRealCallEvidenceRuntimeSourceOptions, VoiceSQLiteRealCallProfileEvidenceStoreOptions, } from "./proofTrends";
|
|
50
50
|
export { assertVoiceSloCalibration, buildVoiceSloCalibrationReport, buildVoiceSloReadinessThresholdReport, createVoiceSloReadinessThresholdOptions, createVoiceSloReadinessThresholdRoutes, createVoiceSloThresholdProfile, createVoiceSloCalibrationRoutes, renderVoiceSloCalibrationMarkdown, renderVoiceSloReadinessThresholdHTML, renderVoiceSloReadinessThresholdMarkdown, } from "./sloCalibration";
|
|
51
51
|
export type { VoiceSloCalibrationMetricKey, VoiceSloCalibrationOptions, VoiceSloCalibrationReport, VoiceSloCalibrationRoutesOptions, VoiceSloCalibrationSample, VoiceSloCalibrationStatus, VoiceSloCalibrationThreshold, VoiceSloCalibrationThresholds, VoiceSloReadinessThresholdReport, VoiceSloReadinessThresholdReportOptions, VoiceSloReadinessThresholdOptions, VoiceSloReadinessThresholdRoutesOptions, VoiceSloThresholdProfile, } from "./sloCalibration";
|
|
52
52
|
export { assertVoiceLiveOpsControlEvidence, assertVoiceLiveOpsEvidence, buildVoiceLiveOpsControlState, createVoiceLiveOpsController, createVoiceLiveOpsRoutes, createVoiceMemoryLiveOpsControlStore, evaluateVoiceLiveOpsControlEvidence, evaluateVoiceLiveOpsEvidence, getVoiceLiveOpsControlStatus, VOICE_LIVE_OPS_ACTIONS, } from "./liveOps";
|
package/dist/index.js
CHANGED
|
@@ -16856,6 +16856,133 @@ var buildVoiceRealCallProfileEvidenceFromReconnectProofReports = (input, options
|
|
|
16856
16856
|
};
|
|
16857
16857
|
var loadVoiceRealCallProfileEvidenceFromTraceStore = async (options) => buildVoiceRealCallProfileEvidenceFromTraceEvents(await options.store.list({ limit: options.limit ?? 5000 }), options);
|
|
16858
16858
|
var loadVoiceRealCallProfileEvidenceFromStore = async (options) => options.store.list(options);
|
|
16859
|
+
var readRealCallEvidenceRuntimeKey = (evidence) => [evidence.profileId, evidence.sessionId, evidence.generatedAt ?? ""].join("\x00");
|
|
16860
|
+
var resolveRealCallEvidenceRuntimeReconnectReports = async (reports, options) => {
|
|
16861
|
+
const resolved = typeof reports === "function" ? await reports(options) : reports;
|
|
16862
|
+
if (!resolved) {
|
|
16863
|
+
return [];
|
|
16864
|
+
}
|
|
16865
|
+
return Array.isArray(resolved) ? resolved : [resolved];
|
|
16866
|
+
};
|
|
16867
|
+
var mergeRealCallEvidenceRuntimeOptions = (base, override = {}) => ({
|
|
16868
|
+
dedupe: override.dedupe ?? base.dedupe,
|
|
16869
|
+
evidenceStore: override.evidenceStore ?? base.evidenceStore,
|
|
16870
|
+
existingEvidenceLimit: override.existingEvidenceLimit ?? base.existingEvidenceLimit,
|
|
16871
|
+
history: {
|
|
16872
|
+
...base.history ?? {},
|
|
16873
|
+
...override.history ?? {}
|
|
16874
|
+
},
|
|
16875
|
+
now: override.now ?? base.now,
|
|
16876
|
+
reconnectEvidence: {
|
|
16877
|
+
...base.reconnectEvidence ?? {},
|
|
16878
|
+
...override.reconnectEvidence ?? {}
|
|
16879
|
+
},
|
|
16880
|
+
reconnectReports: override.reconnectReports ?? base.reconnectReports,
|
|
16881
|
+
traceEvidence: mergeRealCallProfileCollectorOptions(base.traceEvidence ?? {}, override.traceEvidence ?? {}),
|
|
16882
|
+
traceStore: override.traceStore ?? base.traceStore
|
|
16883
|
+
});
|
|
16884
|
+
var buildRealCallEvidenceRuntimeReport = async (options, input = {}) => {
|
|
16885
|
+
const evidence = await options.evidenceStore.list({
|
|
16886
|
+
limit: options.existingEvidenceLimit ?? 5000
|
|
16887
|
+
});
|
|
16888
|
+
const history = await buildVoiceRealCallProfileHistoryReportFromStore({
|
|
16889
|
+
...options.history ?? {},
|
|
16890
|
+
limit: options.existingEvidenceLimit ?? 5000,
|
|
16891
|
+
store: options.evidenceStore
|
|
16892
|
+
});
|
|
16893
|
+
const generatedAt = (options.now ?? (() => new Date))().toISOString();
|
|
16894
|
+
const sessions = new Set(evidence.map((record) => record.sessionId)).size;
|
|
16895
|
+
const failedProfiles = history.summary.profiles?.filter((profile) => profile.status === "fail").length;
|
|
16896
|
+
const issues = [
|
|
16897
|
+
...evidence.length === 0 ? ["No real-call profile evidence has been collected yet."] : [],
|
|
16898
|
+
...history.issues
|
|
16899
|
+
];
|
|
16900
|
+
const status = evidence.length === 0 ? "empty" : issues.length > 0 ? history.status === "pass" ? "fail" : history.status : history.status;
|
|
16901
|
+
return {
|
|
16902
|
+
appended: input.appended ?? 0,
|
|
16903
|
+
collected: input.collected ?? [],
|
|
16904
|
+
duplicateKeys: input.duplicateKeys ?? [],
|
|
16905
|
+
evidence,
|
|
16906
|
+
generatedAt,
|
|
16907
|
+
history,
|
|
16908
|
+
issues,
|
|
16909
|
+
ok: status === "pass" && issues.length === 0,
|
|
16910
|
+
skippedDuplicates: input.skippedDuplicates ?? 0,
|
|
16911
|
+
source: "real-call-evidence-runtime",
|
|
16912
|
+
status,
|
|
16913
|
+
summary: {
|
|
16914
|
+
collectedEvidence: input.collected?.length ?? 0,
|
|
16915
|
+
failedProfiles: failedProfiles ?? 0,
|
|
16916
|
+
profiles: history.summary.profileCount,
|
|
16917
|
+
sessions,
|
|
16918
|
+
storedEvidence: evidence.length
|
|
16919
|
+
}
|
|
16920
|
+
};
|
|
16921
|
+
};
|
|
16922
|
+
var collectVoiceRealCallEvidenceRuntimeEvidence = async (options) => {
|
|
16923
|
+
const evidence = [];
|
|
16924
|
+
if (options.traceStore) {
|
|
16925
|
+
evidence.push(...buildVoiceRealCallProfileEvidenceFromTraceEvents(await options.traceStore.list({
|
|
16926
|
+
limit: options.traceEvidence?.limit ?? 5000
|
|
16927
|
+
}), options.traceEvidence));
|
|
16928
|
+
}
|
|
16929
|
+
const reconnectReports = await resolveRealCallEvidenceRuntimeReconnectReports(options.reconnectReports, options);
|
|
16930
|
+
if (reconnectReports.length > 0) {
|
|
16931
|
+
evidence.push(...buildVoiceRealCallProfileEvidenceFromReconnectProofReports(reconnectReports, options.reconnectEvidence));
|
|
16932
|
+
}
|
|
16933
|
+
return evidence;
|
|
16934
|
+
};
|
|
16935
|
+
var createVoiceRealCallEvidenceRuntime = (options) => {
|
|
16936
|
+
const appendEvidence = async (evidenceInput, collectOptions = {}) => {
|
|
16937
|
+
const merged = mergeRealCallEvidenceRuntimeOptions(options, collectOptions);
|
|
16938
|
+
const evidence = Array.isArray(evidenceInput) ? [...evidenceInput] : [evidenceInput];
|
|
16939
|
+
const dedupe = merged.dedupe ?? true;
|
|
16940
|
+
const existing = dedupe ? await merged.evidenceStore.list({
|
|
16941
|
+
limit: merged.existingEvidenceLimit ?? 5000
|
|
16942
|
+
}) : [];
|
|
16943
|
+
const seen = new Set(existing.map(readRealCallEvidenceRuntimeKey));
|
|
16944
|
+
const incomingSeen = new Set;
|
|
16945
|
+
const duplicateKeys = [];
|
|
16946
|
+
let appended = 0;
|
|
16947
|
+
for (const item of evidence) {
|
|
16948
|
+
const key = readRealCallEvidenceRuntimeKey(item);
|
|
16949
|
+
if (dedupe && (seen.has(key) || incomingSeen.has(key))) {
|
|
16950
|
+
duplicateKeys.push(key);
|
|
16951
|
+
continue;
|
|
16952
|
+
}
|
|
16953
|
+
incomingSeen.add(key);
|
|
16954
|
+
await merged.evidenceStore.append(item);
|
|
16955
|
+
appended += 1;
|
|
16956
|
+
}
|
|
16957
|
+
return buildRealCallEvidenceRuntimeReport(merged, {
|
|
16958
|
+
appended,
|
|
16959
|
+
collected: evidence,
|
|
16960
|
+
duplicateKeys,
|
|
16961
|
+
skippedDuplicates: duplicateKeys.length
|
|
16962
|
+
});
|
|
16963
|
+
};
|
|
16964
|
+
return {
|
|
16965
|
+
appendEvidence,
|
|
16966
|
+
buildHistoryReport: async (historyOptions = {}) => buildVoiceRealCallProfileHistoryReportFromStore({
|
|
16967
|
+
...options.history ?? {},
|
|
16968
|
+
...historyOptions,
|
|
16969
|
+
limit: historyOptions.limit ?? options.existingEvidenceLimit ?? 5000,
|
|
16970
|
+
store: options.evidenceStore
|
|
16971
|
+
}),
|
|
16972
|
+
buildReport: async (collectOptions = {}) => buildRealCallEvidenceRuntimeReport(mergeRealCallEvidenceRuntimeOptions(options, collectOptions)),
|
|
16973
|
+
collect: async (collectOptions = {}) => {
|
|
16974
|
+
const merged = mergeRealCallEvidenceRuntimeOptions(options, collectOptions);
|
|
16975
|
+
const evidence = await collectVoiceRealCallEvidenceRuntimeEvidence(merged);
|
|
16976
|
+
return appendEvidence(evidence, {
|
|
16977
|
+
dedupe: merged.dedupe
|
|
16978
|
+
});
|
|
16979
|
+
},
|
|
16980
|
+
listEvidence: async (listOptions = {}) => await options.evidenceStore.list({
|
|
16981
|
+
limit: options.existingEvidenceLimit ?? 5000,
|
|
16982
|
+
...listOptions
|
|
16983
|
+
})
|
|
16984
|
+
};
|
|
16985
|
+
};
|
|
16859
16986
|
var realCallProfileTraceSignalTypes = new Set([
|
|
16860
16987
|
"client.barge_in",
|
|
16861
16988
|
"client.browser_media",
|
|
@@ -18442,6 +18569,31 @@ var renderVoiceRealCallProfileHistoryHTML = (report, title = "Voice Real-Call Pr
|
|
|
18442
18569
|
const issues = report.issues.length === 0 ? "<li>None</li>" : report.issues.map((issue) => `<li>${escapeHtml26(issue)}</li>`).join("");
|
|
18443
18570
|
return `<!doctype html><html lang="en"><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width,initial-scale=1" /><title>${escapeHtml26(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>${escapeHtml26(title)}</h1><p>Generated ${escapeHtml26(report.generatedAt)} from ${escapeHtml26(report.source)}.</p><div class="summary"><span class="pill">Status ${escapeHtml26(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 ${escapeHtml26(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>`;
|
|
18444
18571
|
};
|
|
18572
|
+
var renderVoiceRealCallEvidenceRuntimeMarkdown = (report, title = "Voice Real-Call Evidence Runtime") => [
|
|
18573
|
+
`# ${title}`,
|
|
18574
|
+
"",
|
|
18575
|
+
`- Status: ${report.status}`,
|
|
18576
|
+
`- Stored evidence: ${String(report.summary.storedEvidence)}`,
|
|
18577
|
+
`- Collected evidence: ${String(report.summary.collectedEvidence)}`,
|
|
18578
|
+
`- Appended: ${String(report.appended)}`,
|
|
18579
|
+
`- Skipped duplicates: ${String(report.skippedDuplicates)}`,
|
|
18580
|
+
`- Sessions: ${String(report.summary.sessions)}`,
|
|
18581
|
+
`- Profiles: ${String(report.summary.profiles)}`,
|
|
18582
|
+
"",
|
|
18583
|
+
"## Rolling Profile History",
|
|
18584
|
+
"",
|
|
18585
|
+
renderVoiceRealCallProfileHistoryMarkdown(report.history, "Rolling Real-Call Profile History"),
|
|
18586
|
+
"",
|
|
18587
|
+
"## Issues",
|
|
18588
|
+
"",
|
|
18589
|
+
...report.issues.length ? report.issues.map((issue) => `- ${issue}`) : ["- None"]
|
|
18590
|
+
].join(`
|
|
18591
|
+
`);
|
|
18592
|
+
var renderVoiceRealCallEvidenceRuntimeHTML = (report, title = "Voice Real-Call Evidence Runtime") => {
|
|
18593
|
+
const issueItems = report.issues.length === 0 ? "<li>None</li>" : report.issues.map((issue) => `<li>${escapeHtml26(issue)}</li>`).join("");
|
|
18594
|
+
const profileRows = report.history.summary.profiles?.length ? report.history.summary.profiles.map((profile) => `<tr><td>${escapeHtml26(profile.label ?? profile.id)}</td><td>${escapeHtml26(profile.status ?? "unknown")}</td><td>${escapeHtml26(profile.sessionCount ?? "n/a")}</td><td>${escapeHtml26(profile.maxLiveP95Ms ?? "n/a")}</td><td>${escapeHtml26(profile.maxProviderP95Ms ?? "n/a")}</td><td>${escapeHtml26(formatProviderMix(profile.providers ?? []))}</td></tr>`).join("") : '<tr><td colspan="6">No profile history has been collected yet.</td></tr>';
|
|
18595
|
+
return `<!doctype html><html lang="en"><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width,initial-scale=1" /><title>${escapeHtml26(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>${escapeHtml26(title)}</h1><p>Generated ${escapeHtml26(report.generatedAt)} from ${escapeHtml26(report.source)}.</p><div class="summary"><span class="pill ${escapeHtml26(report.status)}">Status ${escapeHtml26(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>`;
|
|
18596
|
+
};
|
|
18445
18597
|
var createVoiceProofTrendRecommendationRoutes = (options) => {
|
|
18446
18598
|
const path = options.path ?? "/api/voice/proof-trend-recommendations";
|
|
18447
18599
|
const htmlPath = options.htmlPath === undefined ? "/voice/proof-trend-recommendations" : options.htmlPath;
|
|
@@ -18525,6 +18677,46 @@ var createVoiceRealCallProfileHistoryRoutes = (options = {}) => {
|
|
|
18525
18677
|
}
|
|
18526
18678
|
return routes;
|
|
18527
18679
|
};
|
|
18680
|
+
var createVoiceRealCallEvidenceRuntimeRoutes = (options) => {
|
|
18681
|
+
const path = options.jsonPath ?? "/api/voice/real-call-evidence-runtime";
|
|
18682
|
+
const collectPath = options.collectPath === undefined ? `${path}/collect` : options.collectPath;
|
|
18683
|
+
const htmlPath = options.htmlPath === undefined ? "/voice/real-call-evidence-runtime" : options.htmlPath;
|
|
18684
|
+
const markdownPath = options.markdownPath === undefined ? "/voice/real-call-evidence-runtime.md" : options.markdownPath;
|
|
18685
|
+
const title = options.title ?? "Voice Real-Call Evidence Runtime";
|
|
18686
|
+
const runtime = options.runtime ?? createVoiceRealCallEvidenceRuntime({
|
|
18687
|
+
...options
|
|
18688
|
+
});
|
|
18689
|
+
const routes = new Elysia24({
|
|
18690
|
+
name: options.name ?? "absolutejs-voice-real-call-evidence-runtime"
|
|
18691
|
+
});
|
|
18692
|
+
routes.get(path, async () => Response.json(await runtime.buildReport(), { headers: options.headers }));
|
|
18693
|
+
if (collectPath !== false) {
|
|
18694
|
+
routes.post(collectPath, async () => Response.json(await runtime.collect(), { headers: options.headers }));
|
|
18695
|
+
}
|
|
18696
|
+
if (htmlPath !== false) {
|
|
18697
|
+
routes.get(htmlPath, async () => {
|
|
18698
|
+
const report = await runtime.buildReport();
|
|
18699
|
+
return new Response(renderVoiceRealCallEvidenceRuntimeHTML(report, title), {
|
|
18700
|
+
headers: {
|
|
18701
|
+
"content-type": "text/html; charset=utf-8",
|
|
18702
|
+
...Object.fromEntries(new Headers(options.headers))
|
|
18703
|
+
}
|
|
18704
|
+
});
|
|
18705
|
+
});
|
|
18706
|
+
}
|
|
18707
|
+
if (markdownPath !== false) {
|
|
18708
|
+
routes.get(markdownPath, async () => {
|
|
18709
|
+
const report = await runtime.buildReport();
|
|
18710
|
+
return new Response(renderVoiceRealCallEvidenceRuntimeMarkdown(report, title), {
|
|
18711
|
+
headers: {
|
|
18712
|
+
"content-type": "text/markdown; charset=utf-8",
|
|
18713
|
+
...Object.fromEntries(new Headers(options.headers))
|
|
18714
|
+
}
|
|
18715
|
+
});
|
|
18716
|
+
});
|
|
18717
|
+
}
|
|
18718
|
+
return routes;
|
|
18719
|
+
};
|
|
18528
18720
|
var realCallProfileActionPaths = {
|
|
18529
18721
|
"collect-browser-proof": "/collect-browser-proof",
|
|
18530
18722
|
"collect-phone-proof": "/collect-phone-proof",
|
|
@@ -42314,6 +42506,8 @@ export {
|
|
|
42314
42506
|
renderVoiceRealtimeChannelHTML,
|
|
42315
42507
|
renderVoiceRealCallProfileHistoryMarkdown,
|
|
42316
42508
|
renderVoiceRealCallProfileHistoryHTML,
|
|
42509
|
+
renderVoiceRealCallEvidenceRuntimeMarkdown,
|
|
42510
|
+
renderVoiceRealCallEvidenceRuntimeHTML,
|
|
42317
42511
|
renderVoiceQualityHTML,
|
|
42318
42512
|
renderVoiceProviderSloMarkdown,
|
|
42319
42513
|
renderVoiceProviderSloHTML,
|
|
@@ -42584,6 +42778,8 @@ export {
|
|
|
42584
42778
|
createVoiceRealCallProfileTraceCollector,
|
|
42585
42779
|
createVoiceRealCallProfileRecoveryActionRoutes,
|
|
42586
42780
|
createVoiceRealCallProfileHistoryRoutes,
|
|
42781
|
+
createVoiceRealCallEvidenceRuntimeRoutes,
|
|
42782
|
+
createVoiceRealCallEvidenceRuntime,
|
|
42587
42783
|
createVoiceReadinessProfile,
|
|
42588
42784
|
createVoiceQualityRoutes,
|
|
42589
42785
|
createVoiceProviderSloRoutes,
|
package/dist/proofTrends.d.ts
CHANGED
|
@@ -236,6 +236,60 @@ 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
|
+
};
|
|
239
293
|
export type VoiceProofTrendRealCallProfileReportOptions = VoiceProofTrendProfileSummaryOptions & {
|
|
240
294
|
baseUrl?: string;
|
|
241
295
|
evidence: readonly VoiceProofTrendRealCallProfileEvidence[];
|
|
@@ -656,6 +710,7 @@ export declare const loadVoiceRealCallProfileEvidenceFromTraceStore: (options: V
|
|
|
656
710
|
export declare const loadVoiceRealCallProfileEvidenceFromStore: (options: VoiceRealCallProfileEvidenceListOptions & {
|
|
657
711
|
store: VoiceRealCallProfileEvidenceStore;
|
|
658
712
|
}) => Promise<VoiceRealCallProfileEvidenceRecord[]>;
|
|
713
|
+
export declare const createVoiceRealCallEvidenceRuntime: (options: VoiceRealCallEvidenceRuntimeOptions) => VoiceRealCallEvidenceRuntime;
|
|
659
714
|
export declare const createVoiceRealCallProfileTraceCollector: <TEvent extends StoredVoiceTraceEvent = StoredVoiceTraceEvent>(options: VoiceRealCallProfileTraceCollectorOptions<TEvent>) => VoiceRealCallProfileTraceCollector<TEvent>;
|
|
660
715
|
export declare const buildVoiceProofTrendProfileSummaries: (input: VoiceProofTrendReport | readonly VoiceProofTrendReport[], options?: VoiceProofTrendProfileSummaryOptions) => VoiceProofTrendProfileSummary[];
|
|
661
716
|
export declare const buildVoiceProofTrendReportFromRealCallProfiles: (options: VoiceProofTrendRealCallProfileReportOptions) => VoiceProofTrendReport;
|
|
@@ -683,6 +738,8 @@ export declare const renderVoiceProofTrendRecommendationMarkdown: (report: Voice
|
|
|
683
738
|
export declare const renderVoiceProofTrendRecommendationHTML: (report: VoiceProofTrendRecommendationReport, title?: string) => string;
|
|
684
739
|
export declare const renderVoiceRealCallProfileHistoryMarkdown: (report: VoiceRealCallProfileHistoryReport, title?: string) => string;
|
|
685
740
|
export declare const renderVoiceRealCallProfileHistoryHTML: (report: VoiceRealCallProfileHistoryReport, title?: string) => string;
|
|
741
|
+
export declare const renderVoiceRealCallEvidenceRuntimeMarkdown: (report: VoiceRealCallEvidenceRuntimeReport, title?: string) => string;
|
|
742
|
+
export declare const renderVoiceRealCallEvidenceRuntimeHTML: (report: VoiceRealCallEvidenceRuntimeReport, title?: string) => string;
|
|
686
743
|
export declare const createVoiceProofTrendRecommendationRoutes: (options: VoiceProofTrendRecommendationRoutesOptions) => Elysia<"", {
|
|
687
744
|
decorator: {};
|
|
688
745
|
store: {};
|
|
@@ -739,6 +796,34 @@ export declare const createVoiceRealCallProfileHistoryRoutes: (options?: VoiceRe
|
|
|
739
796
|
standaloneSchema: {};
|
|
740
797
|
response: {};
|
|
741
798
|
}>;
|
|
799
|
+
export declare const createVoiceRealCallEvidenceRuntimeRoutes: (options: VoiceRealCallEvidenceRuntimeRoutesOptions) => Elysia<"", {
|
|
800
|
+
decorator: {};
|
|
801
|
+
store: {};
|
|
802
|
+
derive: {};
|
|
803
|
+
resolve: {};
|
|
804
|
+
}, {
|
|
805
|
+
typebox: {};
|
|
806
|
+
error: {};
|
|
807
|
+
}, {
|
|
808
|
+
schema: {};
|
|
809
|
+
standaloneSchema: {};
|
|
810
|
+
macro: {};
|
|
811
|
+
macroFn: {};
|
|
812
|
+
parser: {};
|
|
813
|
+
response: {};
|
|
814
|
+
}, {}, {
|
|
815
|
+
derive: {};
|
|
816
|
+
resolve: {};
|
|
817
|
+
schema: {};
|
|
818
|
+
standaloneSchema: {};
|
|
819
|
+
response: {};
|
|
820
|
+
}, {
|
|
821
|
+
derive: {};
|
|
822
|
+
resolve: {};
|
|
823
|
+
schema: {};
|
|
824
|
+
standaloneSchema: {};
|
|
825
|
+
response: {};
|
|
826
|
+
}>;
|
|
742
827
|
export declare const createVoiceRealCallProfileRecoveryActionRoutes: (options?: VoiceRealCallProfileRecoveryActionRoutesOptions) => Elysia<"", {
|
|
743
828
|
decorator: {};
|
|
744
829
|
store: {};
|
package/dist/react/index.js
CHANGED
|
@@ -3761,6 +3761,133 @@ 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
|
+
};
|
|
3764
3891
|
var realCallProfileTraceSignalTypes = new Set([
|
|
3765
3892
|
"client.barge_in",
|
|
3766
3893
|
"client.browser_media",
|
|
@@ -5347,6 +5474,31 @@ var renderVoiceRealCallProfileHistoryHTML = (report, title = "Voice Real-Call Pr
|
|
|
5347
5474
|
const issues = report.issues.length === 0 ? "<li>None</li>" : report.issues.map((issue) => `<li>${escapeHtml9(issue)}</li>`).join("");
|
|
5348
5475
|
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
5476
|
};
|
|
5477
|
+
var renderVoiceRealCallEvidenceRuntimeMarkdown = (report, title = "Voice Real-Call Evidence Runtime") => [
|
|
5478
|
+
`# ${title}`,
|
|
5479
|
+
"",
|
|
5480
|
+
`- Status: ${report.status}`,
|
|
5481
|
+
`- Stored evidence: ${String(report.summary.storedEvidence)}`,
|
|
5482
|
+
`- Collected evidence: ${String(report.summary.collectedEvidence)}`,
|
|
5483
|
+
`- Appended: ${String(report.appended)}`,
|
|
5484
|
+
`- Skipped duplicates: ${String(report.skippedDuplicates)}`,
|
|
5485
|
+
`- Sessions: ${String(report.summary.sessions)}`,
|
|
5486
|
+
`- Profiles: ${String(report.summary.profiles)}`,
|
|
5487
|
+
"",
|
|
5488
|
+
"## Rolling Profile History",
|
|
5489
|
+
"",
|
|
5490
|
+
renderVoiceRealCallProfileHistoryMarkdown(report.history, "Rolling Real-Call Profile History"),
|
|
5491
|
+
"",
|
|
5492
|
+
"## Issues",
|
|
5493
|
+
"",
|
|
5494
|
+
...report.issues.length ? report.issues.map((issue) => `- ${issue}`) : ["- None"]
|
|
5495
|
+
].join(`
|
|
5496
|
+
`);
|
|
5497
|
+
var renderVoiceRealCallEvidenceRuntimeHTML = (report, title = "Voice Real-Call Evidence Runtime") => {
|
|
5498
|
+
const issueItems = report.issues.length === 0 ? "<li>None</li>" : report.issues.map((issue) => `<li>${escapeHtml9(issue)}</li>`).join("");
|
|
5499
|
+
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>';
|
|
5500
|
+
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>`;
|
|
5501
|
+
};
|
|
5350
5502
|
var createVoiceProofTrendRecommendationRoutes = (options) => {
|
|
5351
5503
|
const path = options.path ?? "/api/voice/proof-trend-recommendations";
|
|
5352
5504
|
const htmlPath = options.htmlPath === undefined ? "/voice/proof-trend-recommendations" : options.htmlPath;
|
|
@@ -5430,6 +5582,46 @@ var createVoiceRealCallProfileHistoryRoutes = (options = {}) => {
|
|
|
5430
5582
|
}
|
|
5431
5583
|
return routes;
|
|
5432
5584
|
};
|
|
5585
|
+
var createVoiceRealCallEvidenceRuntimeRoutes = (options) => {
|
|
5586
|
+
const path = options.jsonPath ?? "/api/voice/real-call-evidence-runtime";
|
|
5587
|
+
const collectPath = options.collectPath === undefined ? `${path}/collect` : options.collectPath;
|
|
5588
|
+
const htmlPath = options.htmlPath === undefined ? "/voice/real-call-evidence-runtime" : options.htmlPath;
|
|
5589
|
+
const markdownPath = options.markdownPath === undefined ? "/voice/real-call-evidence-runtime.md" : options.markdownPath;
|
|
5590
|
+
const title = options.title ?? "Voice Real-Call Evidence Runtime";
|
|
5591
|
+
const runtime = options.runtime ?? createVoiceRealCallEvidenceRuntime({
|
|
5592
|
+
...options
|
|
5593
|
+
});
|
|
5594
|
+
const routes = new Elysia4({
|
|
5595
|
+
name: options.name ?? "absolutejs-voice-real-call-evidence-runtime"
|
|
5596
|
+
});
|
|
5597
|
+
routes.get(path, async () => Response.json(await runtime.buildReport(), { headers: options.headers }));
|
|
5598
|
+
if (collectPath !== false) {
|
|
5599
|
+
routes.post(collectPath, async () => Response.json(await runtime.collect(), { headers: options.headers }));
|
|
5600
|
+
}
|
|
5601
|
+
if (htmlPath !== false) {
|
|
5602
|
+
routes.get(htmlPath, async () => {
|
|
5603
|
+
const report = await runtime.buildReport();
|
|
5604
|
+
return new Response(renderVoiceRealCallEvidenceRuntimeHTML(report, title), {
|
|
5605
|
+
headers: {
|
|
5606
|
+
"content-type": "text/html; charset=utf-8",
|
|
5607
|
+
...Object.fromEntries(new Headers(options.headers))
|
|
5608
|
+
}
|
|
5609
|
+
});
|
|
5610
|
+
});
|
|
5611
|
+
}
|
|
5612
|
+
if (markdownPath !== false) {
|
|
5613
|
+
routes.get(markdownPath, async () => {
|
|
5614
|
+
const report = await runtime.buildReport();
|
|
5615
|
+
return new Response(renderVoiceRealCallEvidenceRuntimeMarkdown(report, title), {
|
|
5616
|
+
headers: {
|
|
5617
|
+
"content-type": "text/markdown; charset=utf-8",
|
|
5618
|
+
...Object.fromEntries(new Headers(options.headers))
|
|
5619
|
+
}
|
|
5620
|
+
});
|
|
5621
|
+
});
|
|
5622
|
+
}
|
|
5623
|
+
return routes;
|
|
5624
|
+
};
|
|
5433
5625
|
var realCallProfileActionPaths = {
|
|
5434
5626
|
"collect-browser-proof": "/collect-browser-proof",
|
|
5435
5627
|
"collect-phone-proof": "/collect-phone-proof",
|
package/dist/vue/index.js
CHANGED
|
@@ -3682,6 +3682,133 @@ var buildVoiceRealCallProfileEvidenceFromReconnectProofReports = (input, options
|
|
|
3682
3682
|
};
|
|
3683
3683
|
var loadVoiceRealCallProfileEvidenceFromTraceStore = async (options) => buildVoiceRealCallProfileEvidenceFromTraceEvents(await options.store.list({ limit: options.limit ?? 5000 }), options);
|
|
3684
3684
|
var loadVoiceRealCallProfileEvidenceFromStore = async (options) => options.store.list(options);
|
|
3685
|
+
var readRealCallEvidenceRuntimeKey = (evidence) => [evidence.profileId, evidence.sessionId, evidence.generatedAt ?? ""].join("\x00");
|
|
3686
|
+
var resolveRealCallEvidenceRuntimeReconnectReports = async (reports, options) => {
|
|
3687
|
+
const resolved = typeof reports === "function" ? await reports(options) : reports;
|
|
3688
|
+
if (!resolved) {
|
|
3689
|
+
return [];
|
|
3690
|
+
}
|
|
3691
|
+
return Array.isArray(resolved) ? resolved : [resolved];
|
|
3692
|
+
};
|
|
3693
|
+
var mergeRealCallEvidenceRuntimeOptions = (base, override = {}) => ({
|
|
3694
|
+
dedupe: override.dedupe ?? base.dedupe,
|
|
3695
|
+
evidenceStore: override.evidenceStore ?? base.evidenceStore,
|
|
3696
|
+
existingEvidenceLimit: override.existingEvidenceLimit ?? base.existingEvidenceLimit,
|
|
3697
|
+
history: {
|
|
3698
|
+
...base.history ?? {},
|
|
3699
|
+
...override.history ?? {}
|
|
3700
|
+
},
|
|
3701
|
+
now: override.now ?? base.now,
|
|
3702
|
+
reconnectEvidence: {
|
|
3703
|
+
...base.reconnectEvidence ?? {},
|
|
3704
|
+
...override.reconnectEvidence ?? {}
|
|
3705
|
+
},
|
|
3706
|
+
reconnectReports: override.reconnectReports ?? base.reconnectReports,
|
|
3707
|
+
traceEvidence: mergeRealCallProfileCollectorOptions(base.traceEvidence ?? {}, override.traceEvidence ?? {}),
|
|
3708
|
+
traceStore: override.traceStore ?? base.traceStore
|
|
3709
|
+
});
|
|
3710
|
+
var buildRealCallEvidenceRuntimeReport = async (options, input = {}) => {
|
|
3711
|
+
const evidence = await options.evidenceStore.list({
|
|
3712
|
+
limit: options.existingEvidenceLimit ?? 5000
|
|
3713
|
+
});
|
|
3714
|
+
const history = await buildVoiceRealCallProfileHistoryReportFromStore({
|
|
3715
|
+
...options.history ?? {},
|
|
3716
|
+
limit: options.existingEvidenceLimit ?? 5000,
|
|
3717
|
+
store: options.evidenceStore
|
|
3718
|
+
});
|
|
3719
|
+
const generatedAt = (options.now ?? (() => new Date))().toISOString();
|
|
3720
|
+
const sessions = new Set(evidence.map((record) => record.sessionId)).size;
|
|
3721
|
+
const failedProfiles = history.summary.profiles?.filter((profile) => profile.status === "fail").length;
|
|
3722
|
+
const issues = [
|
|
3723
|
+
...evidence.length === 0 ? ["No real-call profile evidence has been collected yet."] : [],
|
|
3724
|
+
...history.issues
|
|
3725
|
+
];
|
|
3726
|
+
const status = evidence.length === 0 ? "empty" : issues.length > 0 ? history.status === "pass" ? "fail" : history.status : history.status;
|
|
3727
|
+
return {
|
|
3728
|
+
appended: input.appended ?? 0,
|
|
3729
|
+
collected: input.collected ?? [],
|
|
3730
|
+
duplicateKeys: input.duplicateKeys ?? [],
|
|
3731
|
+
evidence,
|
|
3732
|
+
generatedAt,
|
|
3733
|
+
history,
|
|
3734
|
+
issues,
|
|
3735
|
+
ok: status === "pass" && issues.length === 0,
|
|
3736
|
+
skippedDuplicates: input.skippedDuplicates ?? 0,
|
|
3737
|
+
source: "real-call-evidence-runtime",
|
|
3738
|
+
status,
|
|
3739
|
+
summary: {
|
|
3740
|
+
collectedEvidence: input.collected?.length ?? 0,
|
|
3741
|
+
failedProfiles: failedProfiles ?? 0,
|
|
3742
|
+
profiles: history.summary.profileCount,
|
|
3743
|
+
sessions,
|
|
3744
|
+
storedEvidence: evidence.length
|
|
3745
|
+
}
|
|
3746
|
+
};
|
|
3747
|
+
};
|
|
3748
|
+
var collectVoiceRealCallEvidenceRuntimeEvidence = async (options) => {
|
|
3749
|
+
const evidence = [];
|
|
3750
|
+
if (options.traceStore) {
|
|
3751
|
+
evidence.push(...buildVoiceRealCallProfileEvidenceFromTraceEvents(await options.traceStore.list({
|
|
3752
|
+
limit: options.traceEvidence?.limit ?? 5000
|
|
3753
|
+
}), options.traceEvidence));
|
|
3754
|
+
}
|
|
3755
|
+
const reconnectReports = await resolveRealCallEvidenceRuntimeReconnectReports(options.reconnectReports, options);
|
|
3756
|
+
if (reconnectReports.length > 0) {
|
|
3757
|
+
evidence.push(...buildVoiceRealCallProfileEvidenceFromReconnectProofReports(reconnectReports, options.reconnectEvidence));
|
|
3758
|
+
}
|
|
3759
|
+
return evidence;
|
|
3760
|
+
};
|
|
3761
|
+
var createVoiceRealCallEvidenceRuntime = (options) => {
|
|
3762
|
+
const appendEvidence = async (evidenceInput, collectOptions = {}) => {
|
|
3763
|
+
const merged = mergeRealCallEvidenceRuntimeOptions(options, collectOptions);
|
|
3764
|
+
const evidence = Array.isArray(evidenceInput) ? [...evidenceInput] : [evidenceInput];
|
|
3765
|
+
const dedupe = merged.dedupe ?? true;
|
|
3766
|
+
const existing = dedupe ? await merged.evidenceStore.list({
|
|
3767
|
+
limit: merged.existingEvidenceLimit ?? 5000
|
|
3768
|
+
}) : [];
|
|
3769
|
+
const seen = new Set(existing.map(readRealCallEvidenceRuntimeKey));
|
|
3770
|
+
const incomingSeen = new Set;
|
|
3771
|
+
const duplicateKeys = [];
|
|
3772
|
+
let appended = 0;
|
|
3773
|
+
for (const item of evidence) {
|
|
3774
|
+
const key = readRealCallEvidenceRuntimeKey(item);
|
|
3775
|
+
if (dedupe && (seen.has(key) || incomingSeen.has(key))) {
|
|
3776
|
+
duplicateKeys.push(key);
|
|
3777
|
+
continue;
|
|
3778
|
+
}
|
|
3779
|
+
incomingSeen.add(key);
|
|
3780
|
+
await merged.evidenceStore.append(item);
|
|
3781
|
+
appended += 1;
|
|
3782
|
+
}
|
|
3783
|
+
return buildRealCallEvidenceRuntimeReport(merged, {
|
|
3784
|
+
appended,
|
|
3785
|
+
collected: evidence,
|
|
3786
|
+
duplicateKeys,
|
|
3787
|
+
skippedDuplicates: duplicateKeys.length
|
|
3788
|
+
});
|
|
3789
|
+
};
|
|
3790
|
+
return {
|
|
3791
|
+
appendEvidence,
|
|
3792
|
+
buildHistoryReport: async (historyOptions = {}) => buildVoiceRealCallProfileHistoryReportFromStore({
|
|
3793
|
+
...options.history ?? {},
|
|
3794
|
+
...historyOptions,
|
|
3795
|
+
limit: historyOptions.limit ?? options.existingEvidenceLimit ?? 5000,
|
|
3796
|
+
store: options.evidenceStore
|
|
3797
|
+
}),
|
|
3798
|
+
buildReport: async (collectOptions = {}) => buildRealCallEvidenceRuntimeReport(mergeRealCallEvidenceRuntimeOptions(options, collectOptions)),
|
|
3799
|
+
collect: async (collectOptions = {}) => {
|
|
3800
|
+
const merged = mergeRealCallEvidenceRuntimeOptions(options, collectOptions);
|
|
3801
|
+
const evidence = await collectVoiceRealCallEvidenceRuntimeEvidence(merged);
|
|
3802
|
+
return appendEvidence(evidence, {
|
|
3803
|
+
dedupe: merged.dedupe
|
|
3804
|
+
});
|
|
3805
|
+
},
|
|
3806
|
+
listEvidence: async (listOptions = {}) => await options.evidenceStore.list({
|
|
3807
|
+
limit: options.existingEvidenceLimit ?? 5000,
|
|
3808
|
+
...listOptions
|
|
3809
|
+
})
|
|
3810
|
+
};
|
|
3811
|
+
};
|
|
3685
3812
|
var realCallProfileTraceSignalTypes = new Set([
|
|
3686
3813
|
"client.barge_in",
|
|
3687
3814
|
"client.browser_media",
|
|
@@ -5268,6 +5395,31 @@ var renderVoiceRealCallProfileHistoryHTML = (report, title = "Voice Real-Call Pr
|
|
|
5268
5395
|
const issues = report.issues.length === 0 ? "<li>None</li>" : report.issues.map((issue) => `<li>${escapeHtml9(issue)}</li>`).join("");
|
|
5269
5396
|
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>`;
|
|
5270
5397
|
};
|
|
5398
|
+
var renderVoiceRealCallEvidenceRuntimeMarkdown = (report, title = "Voice Real-Call Evidence Runtime") => [
|
|
5399
|
+
`# ${title}`,
|
|
5400
|
+
"",
|
|
5401
|
+
`- Status: ${report.status}`,
|
|
5402
|
+
`- Stored evidence: ${String(report.summary.storedEvidence)}`,
|
|
5403
|
+
`- Collected evidence: ${String(report.summary.collectedEvidence)}`,
|
|
5404
|
+
`- Appended: ${String(report.appended)}`,
|
|
5405
|
+
`- Skipped duplicates: ${String(report.skippedDuplicates)}`,
|
|
5406
|
+
`- Sessions: ${String(report.summary.sessions)}`,
|
|
5407
|
+
`- Profiles: ${String(report.summary.profiles)}`,
|
|
5408
|
+
"",
|
|
5409
|
+
"## Rolling Profile History",
|
|
5410
|
+
"",
|
|
5411
|
+
renderVoiceRealCallProfileHistoryMarkdown(report.history, "Rolling Real-Call Profile History"),
|
|
5412
|
+
"",
|
|
5413
|
+
"## Issues",
|
|
5414
|
+
"",
|
|
5415
|
+
...report.issues.length ? report.issues.map((issue) => `- ${issue}`) : ["- None"]
|
|
5416
|
+
].join(`
|
|
5417
|
+
`);
|
|
5418
|
+
var renderVoiceRealCallEvidenceRuntimeHTML = (report, title = "Voice Real-Call Evidence Runtime") => {
|
|
5419
|
+
const issueItems = report.issues.length === 0 ? "<li>None</li>" : report.issues.map((issue) => `<li>${escapeHtml9(issue)}</li>`).join("");
|
|
5420
|
+
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>';
|
|
5421
|
+
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>`;
|
|
5422
|
+
};
|
|
5271
5423
|
var createVoiceProofTrendRecommendationRoutes = (options) => {
|
|
5272
5424
|
const path = options.path ?? "/api/voice/proof-trend-recommendations";
|
|
5273
5425
|
const htmlPath = options.htmlPath === undefined ? "/voice/proof-trend-recommendations" : options.htmlPath;
|
|
@@ -5351,6 +5503,46 @@ var createVoiceRealCallProfileHistoryRoutes = (options = {}) => {
|
|
|
5351
5503
|
}
|
|
5352
5504
|
return routes;
|
|
5353
5505
|
};
|
|
5506
|
+
var createVoiceRealCallEvidenceRuntimeRoutes = (options) => {
|
|
5507
|
+
const path = options.jsonPath ?? "/api/voice/real-call-evidence-runtime";
|
|
5508
|
+
const collectPath = options.collectPath === undefined ? `${path}/collect` : options.collectPath;
|
|
5509
|
+
const htmlPath = options.htmlPath === undefined ? "/voice/real-call-evidence-runtime" : options.htmlPath;
|
|
5510
|
+
const markdownPath = options.markdownPath === undefined ? "/voice/real-call-evidence-runtime.md" : options.markdownPath;
|
|
5511
|
+
const title = options.title ?? "Voice Real-Call Evidence Runtime";
|
|
5512
|
+
const runtime = options.runtime ?? createVoiceRealCallEvidenceRuntime({
|
|
5513
|
+
...options
|
|
5514
|
+
});
|
|
5515
|
+
const routes = new Elysia4({
|
|
5516
|
+
name: options.name ?? "absolutejs-voice-real-call-evidence-runtime"
|
|
5517
|
+
});
|
|
5518
|
+
routes.get(path, async () => Response.json(await runtime.buildReport(), { headers: options.headers }));
|
|
5519
|
+
if (collectPath !== false) {
|
|
5520
|
+
routes.post(collectPath, async () => Response.json(await runtime.collect(), { headers: options.headers }));
|
|
5521
|
+
}
|
|
5522
|
+
if (htmlPath !== false) {
|
|
5523
|
+
routes.get(htmlPath, async () => {
|
|
5524
|
+
const report = await runtime.buildReport();
|
|
5525
|
+
return new Response(renderVoiceRealCallEvidenceRuntimeHTML(report, title), {
|
|
5526
|
+
headers: {
|
|
5527
|
+
"content-type": "text/html; charset=utf-8",
|
|
5528
|
+
...Object.fromEntries(new Headers(options.headers))
|
|
5529
|
+
}
|
|
5530
|
+
});
|
|
5531
|
+
});
|
|
5532
|
+
}
|
|
5533
|
+
if (markdownPath !== false) {
|
|
5534
|
+
routes.get(markdownPath, async () => {
|
|
5535
|
+
const report = await runtime.buildReport();
|
|
5536
|
+
return new Response(renderVoiceRealCallEvidenceRuntimeMarkdown(report, title), {
|
|
5537
|
+
headers: {
|
|
5538
|
+
"content-type": "text/markdown; charset=utf-8",
|
|
5539
|
+
...Object.fromEntries(new Headers(options.headers))
|
|
5540
|
+
}
|
|
5541
|
+
});
|
|
5542
|
+
});
|
|
5543
|
+
}
|
|
5544
|
+
return routes;
|
|
5545
|
+
};
|
|
5354
5546
|
var realCallProfileActionPaths = {
|
|
5355
5547
|
"collect-browser-proof": "/collect-browser-proof",
|
|
5356
5548
|
"collect-phone-proof": "/collect-phone-proof",
|