@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.
- package/dist/client/index.js +256 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +261 -0
- package/dist/proofTrends.d.ts +96 -0
- package/dist/react/index.js +256 -0
- package/dist/vue/index.js +256 -0
- package/package.json +1 -1
package/dist/client/index.js
CHANGED
|
@@ -6666,6 +6666,197 @@ 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
|
+
};
|
|
6796
|
+
var buildVoiceRealCallEvidenceRuntimeReadinessCheck = (report, options = {}) => {
|
|
6797
|
+
const minStoredEvidence = options.minStoredEvidence ?? 1;
|
|
6798
|
+
const minSessions = options.minSessions ?? 1;
|
|
6799
|
+
const minProfiles = options.minProfiles ?? 1;
|
|
6800
|
+
const issues = [];
|
|
6801
|
+
const warnings = [];
|
|
6802
|
+
if (report.summary.storedEvidence < minStoredEvidence) {
|
|
6803
|
+
issues.push(`Expected at least ${String(minStoredEvidence)} stored real-call evidence record(s), observed ${String(report.summary.storedEvidence)}.`);
|
|
6804
|
+
}
|
|
6805
|
+
if (report.summary.sessions < minSessions) {
|
|
6806
|
+
issues.push(`Expected at least ${String(minSessions)} real-call session(s), observed ${String(report.summary.sessions)}.`);
|
|
6807
|
+
}
|
|
6808
|
+
if (report.summary.profiles < minProfiles) {
|
|
6809
|
+
issues.push(`Expected at least ${String(minProfiles)} real-call profile(s), observed ${String(report.summary.profiles)}.`);
|
|
6810
|
+
}
|
|
6811
|
+
if (report.summary.failedProfiles > 0) {
|
|
6812
|
+
issues.push(`${String(report.summary.failedProfiles)} rolling real-call profile(s) are failing.`);
|
|
6813
|
+
}
|
|
6814
|
+
if (report.status === "empty" || report.status === "stale") {
|
|
6815
|
+
issues.push(`Real-call evidence runtime is ${report.status}.`);
|
|
6816
|
+
} else if (report.status === "fail") {
|
|
6817
|
+
issues.push("Real-call evidence runtime has failing evidence.");
|
|
6818
|
+
}
|
|
6819
|
+
if (report.status !== "pass" && options.failOnWarnings === true) {
|
|
6820
|
+
warnings.push(...report.issues);
|
|
6821
|
+
}
|
|
6822
|
+
const status = issues.length > 0 ? "fail" : warnings.length > 0 && options.failOnWarnings === true ? "fail" : warnings.length > 0 ? "warn" : "pass";
|
|
6823
|
+
const sourceHref = options.sourceHref ?? "/api/voice/real-call-evidence-runtime";
|
|
6824
|
+
const href = options.href ?? "/voice/real-call-evidence-runtime";
|
|
6825
|
+
return {
|
|
6826
|
+
actions: [
|
|
6827
|
+
{
|
|
6828
|
+
description: "Collect fresh real browser, phone, reconnect, provider, and latency evidence into the runtime store.",
|
|
6829
|
+
href: options.collectHref ?? `${sourceHref}/collect`,
|
|
6830
|
+
label: "Collect real-call evidence",
|
|
6831
|
+
method: "POST"
|
|
6832
|
+
},
|
|
6833
|
+
{
|
|
6834
|
+
description: "Open rolling real-call evidence and inspect profile/session depth.",
|
|
6835
|
+
href,
|
|
6836
|
+
label: "Open real-call evidence runtime"
|
|
6837
|
+
}
|
|
6838
|
+
],
|
|
6839
|
+
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(" "),
|
|
6840
|
+
gateExplanation: {
|
|
6841
|
+
evidenceHref: sourceHref,
|
|
6842
|
+
observed: report.summary.storedEvidence,
|
|
6843
|
+
remediation: "Run real browser or phone traffic, collect runtime evidence, and ensure rolling profile history is passing before promotion.",
|
|
6844
|
+
sourceHref: href,
|
|
6845
|
+
threshold: minStoredEvidence,
|
|
6846
|
+
thresholdLabel: "Minimum stored real-call evidence",
|
|
6847
|
+
unit: "count"
|
|
6848
|
+
},
|
|
6849
|
+
href,
|
|
6850
|
+
label: options.label ?? "Real-call evidence runtime",
|
|
6851
|
+
proofSource: {
|
|
6852
|
+
href: sourceHref,
|
|
6853
|
+
source: report.source,
|
|
6854
|
+
sourceLabel: "Real-call evidence runtime"
|
|
6855
|
+
},
|
|
6856
|
+
status,
|
|
6857
|
+
value: `${String(report.summary.storedEvidence)} evidence / ${String(report.summary.sessions)} sessions / ${String(report.summary.profiles)} profiles`
|
|
6858
|
+
};
|
|
6859
|
+
};
|
|
6669
6860
|
var realCallProfileTraceSignalTypes = new Set([
|
|
6670
6861
|
"client.barge_in",
|
|
6671
6862
|
"client.browser_media",
|
|
@@ -8252,6 +8443,31 @@ var renderVoiceRealCallProfileHistoryHTML = (report, title = "Voice Real-Call Pr
|
|
|
8252
8443
|
const issues = report.issues.length === 0 ? "<li>None</li>" : report.issues.map((issue) => `<li>${escapeHtml9(issue)}</li>`).join("");
|
|
8253
8444
|
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
8445
|
};
|
|
8446
|
+
var renderVoiceRealCallEvidenceRuntimeMarkdown = (report, title = "Voice Real-Call Evidence Runtime") => [
|
|
8447
|
+
`# ${title}`,
|
|
8448
|
+
"",
|
|
8449
|
+
`- Status: ${report.status}`,
|
|
8450
|
+
`- Stored evidence: ${String(report.summary.storedEvidence)}`,
|
|
8451
|
+
`- Collected evidence: ${String(report.summary.collectedEvidence)}`,
|
|
8452
|
+
`- Appended: ${String(report.appended)}`,
|
|
8453
|
+
`- Skipped duplicates: ${String(report.skippedDuplicates)}`,
|
|
8454
|
+
`- Sessions: ${String(report.summary.sessions)}`,
|
|
8455
|
+
`- Profiles: ${String(report.summary.profiles)}`,
|
|
8456
|
+
"",
|
|
8457
|
+
"## Rolling Profile History",
|
|
8458
|
+
"",
|
|
8459
|
+
renderVoiceRealCallProfileHistoryMarkdown(report.history, "Rolling Real-Call Profile History"),
|
|
8460
|
+
"",
|
|
8461
|
+
"## Issues",
|
|
8462
|
+
"",
|
|
8463
|
+
...report.issues.length ? report.issues.map((issue) => `- ${issue}`) : ["- None"]
|
|
8464
|
+
].join(`
|
|
8465
|
+
`);
|
|
8466
|
+
var renderVoiceRealCallEvidenceRuntimeHTML = (report, title = "Voice Real-Call Evidence Runtime") => {
|
|
8467
|
+
const issueItems = report.issues.length === 0 ? "<li>None</li>" : report.issues.map((issue) => `<li>${escapeHtml9(issue)}</li>`).join("");
|
|
8468
|
+
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>';
|
|
8469
|
+
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>`;
|
|
8470
|
+
};
|
|
8255
8471
|
var createVoiceProofTrendRecommendationRoutes = (options) => {
|
|
8256
8472
|
const path = options.path ?? "/api/voice/proof-trend-recommendations";
|
|
8257
8473
|
const htmlPath = options.htmlPath === undefined ? "/voice/proof-trend-recommendations" : options.htmlPath;
|
|
@@ -8335,6 +8551,46 @@ var createVoiceRealCallProfileHistoryRoutes = (options = {}) => {
|
|
|
8335
8551
|
}
|
|
8336
8552
|
return routes;
|
|
8337
8553
|
};
|
|
8554
|
+
var createVoiceRealCallEvidenceRuntimeRoutes = (options) => {
|
|
8555
|
+
const path = options.jsonPath ?? "/api/voice/real-call-evidence-runtime";
|
|
8556
|
+
const collectPath = options.collectPath === undefined ? `${path}/collect` : options.collectPath;
|
|
8557
|
+
const htmlPath = options.htmlPath === undefined ? "/voice/real-call-evidence-runtime" : options.htmlPath;
|
|
8558
|
+
const markdownPath = options.markdownPath === undefined ? "/voice/real-call-evidence-runtime.md" : options.markdownPath;
|
|
8559
|
+
const title = options.title ?? "Voice Real-Call Evidence Runtime";
|
|
8560
|
+
const runtime = options.runtime ?? createVoiceRealCallEvidenceRuntime({
|
|
8561
|
+
...options
|
|
8562
|
+
});
|
|
8563
|
+
const routes = new Elysia4({
|
|
8564
|
+
name: options.name ?? "absolutejs-voice-real-call-evidence-runtime"
|
|
8565
|
+
});
|
|
8566
|
+
routes.get(path, async () => Response.json(await runtime.buildReport(), { headers: options.headers }));
|
|
8567
|
+
if (collectPath !== false) {
|
|
8568
|
+
routes.post(collectPath, async () => Response.json(await runtime.collect(), { headers: options.headers }));
|
|
8569
|
+
}
|
|
8570
|
+
if (htmlPath !== false) {
|
|
8571
|
+
routes.get(htmlPath, async () => {
|
|
8572
|
+
const report = await runtime.buildReport();
|
|
8573
|
+
return new Response(renderVoiceRealCallEvidenceRuntimeHTML(report, title), {
|
|
8574
|
+
headers: {
|
|
8575
|
+
"content-type": "text/html; charset=utf-8",
|
|
8576
|
+
...Object.fromEntries(new Headers(options.headers))
|
|
8577
|
+
}
|
|
8578
|
+
});
|
|
8579
|
+
});
|
|
8580
|
+
}
|
|
8581
|
+
if (markdownPath !== false) {
|
|
8582
|
+
routes.get(markdownPath, async () => {
|
|
8583
|
+
const report = await runtime.buildReport();
|
|
8584
|
+
return new Response(renderVoiceRealCallEvidenceRuntimeMarkdown(report, title), {
|
|
8585
|
+
headers: {
|
|
8586
|
+
"content-type": "text/markdown; charset=utf-8",
|
|
8587
|
+
...Object.fromEntries(new Headers(options.headers))
|
|
8588
|
+
}
|
|
8589
|
+
});
|
|
8590
|
+
});
|
|
8591
|
+
}
|
|
8592
|
+
return routes;
|
|
8593
|
+
};
|
|
8338
8594
|
var realCallProfileActionPaths = {
|
|
8339
8595
|
"collect-browser-proof": "/collect-browser-proof",
|
|
8340
8596
|
"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, buildVoiceRealCallEvidenceRuntimeReadinessCheck, 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, VoiceRealCallEvidenceRuntimeReadinessCheckOptions, 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,197 @@ 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
|
+
};
|
|
16986
|
+
var buildVoiceRealCallEvidenceRuntimeReadinessCheck = (report, options = {}) => {
|
|
16987
|
+
const minStoredEvidence = options.minStoredEvidence ?? 1;
|
|
16988
|
+
const minSessions = options.minSessions ?? 1;
|
|
16989
|
+
const minProfiles = options.minProfiles ?? 1;
|
|
16990
|
+
const issues = [];
|
|
16991
|
+
const warnings = [];
|
|
16992
|
+
if (report.summary.storedEvidence < minStoredEvidence) {
|
|
16993
|
+
issues.push(`Expected at least ${String(minStoredEvidence)} stored real-call evidence record(s), observed ${String(report.summary.storedEvidence)}.`);
|
|
16994
|
+
}
|
|
16995
|
+
if (report.summary.sessions < minSessions) {
|
|
16996
|
+
issues.push(`Expected at least ${String(minSessions)} real-call session(s), observed ${String(report.summary.sessions)}.`);
|
|
16997
|
+
}
|
|
16998
|
+
if (report.summary.profiles < minProfiles) {
|
|
16999
|
+
issues.push(`Expected at least ${String(minProfiles)} real-call profile(s), observed ${String(report.summary.profiles)}.`);
|
|
17000
|
+
}
|
|
17001
|
+
if (report.summary.failedProfiles > 0) {
|
|
17002
|
+
issues.push(`${String(report.summary.failedProfiles)} rolling real-call profile(s) are failing.`);
|
|
17003
|
+
}
|
|
17004
|
+
if (report.status === "empty" || report.status === "stale") {
|
|
17005
|
+
issues.push(`Real-call evidence runtime is ${report.status}.`);
|
|
17006
|
+
} else if (report.status === "fail") {
|
|
17007
|
+
issues.push("Real-call evidence runtime has failing evidence.");
|
|
17008
|
+
}
|
|
17009
|
+
if (report.status !== "pass" && options.failOnWarnings === true) {
|
|
17010
|
+
warnings.push(...report.issues);
|
|
17011
|
+
}
|
|
17012
|
+
const status = issues.length > 0 ? "fail" : warnings.length > 0 && options.failOnWarnings === true ? "fail" : warnings.length > 0 ? "warn" : "pass";
|
|
17013
|
+
const sourceHref = options.sourceHref ?? "/api/voice/real-call-evidence-runtime";
|
|
17014
|
+
const href = options.href ?? "/voice/real-call-evidence-runtime";
|
|
17015
|
+
return {
|
|
17016
|
+
actions: [
|
|
17017
|
+
{
|
|
17018
|
+
description: "Collect fresh real browser, phone, reconnect, provider, and latency evidence into the runtime store.",
|
|
17019
|
+
href: options.collectHref ?? `${sourceHref}/collect`,
|
|
17020
|
+
label: "Collect real-call evidence",
|
|
17021
|
+
method: "POST"
|
|
17022
|
+
},
|
|
17023
|
+
{
|
|
17024
|
+
description: "Open rolling real-call evidence and inspect profile/session depth.",
|
|
17025
|
+
href,
|
|
17026
|
+
label: "Open real-call evidence runtime"
|
|
17027
|
+
}
|
|
17028
|
+
],
|
|
17029
|
+
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(" "),
|
|
17030
|
+
gateExplanation: {
|
|
17031
|
+
evidenceHref: sourceHref,
|
|
17032
|
+
observed: report.summary.storedEvidence,
|
|
17033
|
+
remediation: "Run real browser or phone traffic, collect runtime evidence, and ensure rolling profile history is passing before promotion.",
|
|
17034
|
+
sourceHref: href,
|
|
17035
|
+
threshold: minStoredEvidence,
|
|
17036
|
+
thresholdLabel: "Minimum stored real-call evidence",
|
|
17037
|
+
unit: "count"
|
|
17038
|
+
},
|
|
17039
|
+
href,
|
|
17040
|
+
label: options.label ?? "Real-call evidence runtime",
|
|
17041
|
+
proofSource: {
|
|
17042
|
+
href: sourceHref,
|
|
17043
|
+
source: report.source,
|
|
17044
|
+
sourceLabel: "Real-call evidence runtime"
|
|
17045
|
+
},
|
|
17046
|
+
status,
|
|
17047
|
+
value: `${String(report.summary.storedEvidence)} evidence / ${String(report.summary.sessions)} sessions / ${String(report.summary.profiles)} profiles`
|
|
17048
|
+
};
|
|
17049
|
+
};
|
|
16859
17050
|
var realCallProfileTraceSignalTypes = new Set([
|
|
16860
17051
|
"client.barge_in",
|
|
16861
17052
|
"client.browser_media",
|
|
@@ -18442,6 +18633,31 @@ var renderVoiceRealCallProfileHistoryHTML = (report, title = "Voice Real-Call Pr
|
|
|
18442
18633
|
const issues = report.issues.length === 0 ? "<li>None</li>" : report.issues.map((issue) => `<li>${escapeHtml26(issue)}</li>`).join("");
|
|
18443
18634
|
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
18635
|
};
|
|
18636
|
+
var renderVoiceRealCallEvidenceRuntimeMarkdown = (report, title = "Voice Real-Call Evidence Runtime") => [
|
|
18637
|
+
`# ${title}`,
|
|
18638
|
+
"",
|
|
18639
|
+
`- Status: ${report.status}`,
|
|
18640
|
+
`- Stored evidence: ${String(report.summary.storedEvidence)}`,
|
|
18641
|
+
`- Collected evidence: ${String(report.summary.collectedEvidence)}`,
|
|
18642
|
+
`- Appended: ${String(report.appended)}`,
|
|
18643
|
+
`- Skipped duplicates: ${String(report.skippedDuplicates)}`,
|
|
18644
|
+
`- Sessions: ${String(report.summary.sessions)}`,
|
|
18645
|
+
`- Profiles: ${String(report.summary.profiles)}`,
|
|
18646
|
+
"",
|
|
18647
|
+
"## Rolling Profile History",
|
|
18648
|
+
"",
|
|
18649
|
+
renderVoiceRealCallProfileHistoryMarkdown(report.history, "Rolling Real-Call Profile History"),
|
|
18650
|
+
"",
|
|
18651
|
+
"## Issues",
|
|
18652
|
+
"",
|
|
18653
|
+
...report.issues.length ? report.issues.map((issue) => `- ${issue}`) : ["- None"]
|
|
18654
|
+
].join(`
|
|
18655
|
+
`);
|
|
18656
|
+
var renderVoiceRealCallEvidenceRuntimeHTML = (report, title = "Voice Real-Call Evidence Runtime") => {
|
|
18657
|
+
const issueItems = report.issues.length === 0 ? "<li>None</li>" : report.issues.map((issue) => `<li>${escapeHtml26(issue)}</li>`).join("");
|
|
18658
|
+
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>';
|
|
18659
|
+
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>`;
|
|
18660
|
+
};
|
|
18445
18661
|
var createVoiceProofTrendRecommendationRoutes = (options) => {
|
|
18446
18662
|
const path = options.path ?? "/api/voice/proof-trend-recommendations";
|
|
18447
18663
|
const htmlPath = options.htmlPath === undefined ? "/voice/proof-trend-recommendations" : options.htmlPath;
|
|
@@ -18525,6 +18741,46 @@ var createVoiceRealCallProfileHistoryRoutes = (options = {}) => {
|
|
|
18525
18741
|
}
|
|
18526
18742
|
return routes;
|
|
18527
18743
|
};
|
|
18744
|
+
var createVoiceRealCallEvidenceRuntimeRoutes = (options) => {
|
|
18745
|
+
const path = options.jsonPath ?? "/api/voice/real-call-evidence-runtime";
|
|
18746
|
+
const collectPath = options.collectPath === undefined ? `${path}/collect` : options.collectPath;
|
|
18747
|
+
const htmlPath = options.htmlPath === undefined ? "/voice/real-call-evidence-runtime" : options.htmlPath;
|
|
18748
|
+
const markdownPath = options.markdownPath === undefined ? "/voice/real-call-evidence-runtime.md" : options.markdownPath;
|
|
18749
|
+
const title = options.title ?? "Voice Real-Call Evidence Runtime";
|
|
18750
|
+
const runtime = options.runtime ?? createVoiceRealCallEvidenceRuntime({
|
|
18751
|
+
...options
|
|
18752
|
+
});
|
|
18753
|
+
const routes = new Elysia24({
|
|
18754
|
+
name: options.name ?? "absolutejs-voice-real-call-evidence-runtime"
|
|
18755
|
+
});
|
|
18756
|
+
routes.get(path, async () => Response.json(await runtime.buildReport(), { headers: options.headers }));
|
|
18757
|
+
if (collectPath !== false) {
|
|
18758
|
+
routes.post(collectPath, async () => Response.json(await runtime.collect(), { headers: options.headers }));
|
|
18759
|
+
}
|
|
18760
|
+
if (htmlPath !== false) {
|
|
18761
|
+
routes.get(htmlPath, async () => {
|
|
18762
|
+
const report = await runtime.buildReport();
|
|
18763
|
+
return new Response(renderVoiceRealCallEvidenceRuntimeHTML(report, title), {
|
|
18764
|
+
headers: {
|
|
18765
|
+
"content-type": "text/html; charset=utf-8",
|
|
18766
|
+
...Object.fromEntries(new Headers(options.headers))
|
|
18767
|
+
}
|
|
18768
|
+
});
|
|
18769
|
+
});
|
|
18770
|
+
}
|
|
18771
|
+
if (markdownPath !== false) {
|
|
18772
|
+
routes.get(markdownPath, async () => {
|
|
18773
|
+
const report = await runtime.buildReport();
|
|
18774
|
+
return new Response(renderVoiceRealCallEvidenceRuntimeMarkdown(report, title), {
|
|
18775
|
+
headers: {
|
|
18776
|
+
"content-type": "text/markdown; charset=utf-8",
|
|
18777
|
+
...Object.fromEntries(new Headers(options.headers))
|
|
18778
|
+
}
|
|
18779
|
+
});
|
|
18780
|
+
});
|
|
18781
|
+
}
|
|
18782
|
+
return routes;
|
|
18783
|
+
};
|
|
18528
18784
|
var realCallProfileActionPaths = {
|
|
18529
18785
|
"collect-browser-proof": "/collect-browser-proof",
|
|
18530
18786
|
"collect-phone-proof": "/collect-phone-proof",
|
|
@@ -42314,6 +42570,8 @@ export {
|
|
|
42314
42570
|
renderVoiceRealtimeChannelHTML,
|
|
42315
42571
|
renderVoiceRealCallProfileHistoryMarkdown,
|
|
42316
42572
|
renderVoiceRealCallProfileHistoryHTML,
|
|
42573
|
+
renderVoiceRealCallEvidenceRuntimeMarkdown,
|
|
42574
|
+
renderVoiceRealCallEvidenceRuntimeHTML,
|
|
42317
42575
|
renderVoiceQualityHTML,
|
|
42318
42576
|
renderVoiceProviderSloMarkdown,
|
|
42319
42577
|
renderVoiceProviderSloHTML,
|
|
@@ -42584,6 +42842,8 @@ export {
|
|
|
42584
42842
|
createVoiceRealCallProfileTraceCollector,
|
|
42585
42843
|
createVoiceRealCallProfileRecoveryActionRoutes,
|
|
42586
42844
|
createVoiceRealCallProfileHistoryRoutes,
|
|
42845
|
+
createVoiceRealCallEvidenceRuntimeRoutes,
|
|
42846
|
+
createVoiceRealCallEvidenceRuntime,
|
|
42587
42847
|
createVoiceReadinessProfile,
|
|
42588
42848
|
createVoiceQualityRoutes,
|
|
42589
42849
|
createVoiceProviderSloRoutes,
|
|
@@ -42828,6 +43088,7 @@ export {
|
|
|
42828
43088
|
buildVoiceRealCallProfileEvidenceFromTraceEvents,
|
|
42829
43089
|
buildVoiceRealCallProfileEvidenceFromReconnectProofReports,
|
|
42830
43090
|
buildVoiceRealCallProfileDefaults,
|
|
43091
|
+
buildVoiceRealCallEvidenceRuntimeReadinessCheck,
|
|
42831
43092
|
buildVoiceReadinessRecoveryActions,
|
|
42832
43093
|
buildVoiceProviderSloReport,
|
|
42833
43094
|
buildVoiceProviderRouterTraceEvent,
|