@absolutejs/voice 0.0.22-beta.455 → 0.0.22-beta.457
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 +143 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +146 -0
- package/dist/proofTrends.d.ts +46 -0
- package/dist/react/index.js +143 -0
- package/dist/vue/index.js +143 -0
- package/package.json +1 -1
package/dist/client/index.js
CHANGED
|
@@ -6793,6 +6793,149 @@ var createVoiceRealCallEvidenceRuntime = (options) => {
|
|
|
6793
6793
|
})
|
|
6794
6794
|
};
|
|
6795
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
|
+
};
|
|
6860
|
+
var readVoiceRealCallEvidenceRuntimeWorkerNow = (options) => (options.now ?? (() => new Date))().toISOString();
|
|
6861
|
+
var readVoiceRealCallEvidenceRuntimeWorkerError = (error) => error instanceof Error ? error.message : String(error);
|
|
6862
|
+
var createVoiceRealCallEvidenceRuntimeWorker = (options) => {
|
|
6863
|
+
let collectCount = 0;
|
|
6864
|
+
let error;
|
|
6865
|
+
let lastCollectedAt;
|
|
6866
|
+
let lastReport;
|
|
6867
|
+
let lastTickAt;
|
|
6868
|
+
let status = "idle";
|
|
6869
|
+
const collect = async () => {
|
|
6870
|
+
lastTickAt = readVoiceRealCallEvidenceRuntimeWorkerNow(options);
|
|
6871
|
+
try {
|
|
6872
|
+
const report = await options.runtime.collect(options.collectOptions);
|
|
6873
|
+
collectCount += 1;
|
|
6874
|
+
error = undefined;
|
|
6875
|
+
lastCollectedAt = readVoiceRealCallEvidenceRuntimeWorkerNow(options);
|
|
6876
|
+
lastReport = report;
|
|
6877
|
+
status = report.status;
|
|
6878
|
+
await options.onCollect?.(report);
|
|
6879
|
+
return report;
|
|
6880
|
+
} catch (caught) {
|
|
6881
|
+
error = readVoiceRealCallEvidenceRuntimeWorkerError(caught);
|
|
6882
|
+
status = "fail";
|
|
6883
|
+
await options.onError?.(caught);
|
|
6884
|
+
throw caught;
|
|
6885
|
+
}
|
|
6886
|
+
};
|
|
6887
|
+
return {
|
|
6888
|
+
collect,
|
|
6889
|
+
health: () => ({
|
|
6890
|
+
collectCount,
|
|
6891
|
+
error,
|
|
6892
|
+
isRunning: false,
|
|
6893
|
+
lastCollectedAt,
|
|
6894
|
+
lastReport,
|
|
6895
|
+
lastTickAt,
|
|
6896
|
+
source: "real-call-evidence-runtime-worker",
|
|
6897
|
+
status
|
|
6898
|
+
})
|
|
6899
|
+
};
|
|
6900
|
+
};
|
|
6901
|
+
var createVoiceRealCallEvidenceRuntimeWorkerLoop = (options) => {
|
|
6902
|
+
const worker = createVoiceRealCallEvidenceRuntimeWorker(options);
|
|
6903
|
+
const pollIntervalMs = Math.max(1, options.pollIntervalMs ?? 30000);
|
|
6904
|
+
let timer;
|
|
6905
|
+
let lastStartedAt;
|
|
6906
|
+
let lastStoppedAt;
|
|
6907
|
+
const isRunning = () => timer !== undefined;
|
|
6908
|
+
const tick = () => worker.collect();
|
|
6909
|
+
return {
|
|
6910
|
+
collect: tick,
|
|
6911
|
+
health: () => ({
|
|
6912
|
+
...worker.health(),
|
|
6913
|
+
isRunning: isRunning(),
|
|
6914
|
+
lastStartedAt,
|
|
6915
|
+
lastStoppedAt
|
|
6916
|
+
}),
|
|
6917
|
+
isRunning,
|
|
6918
|
+
start: () => {
|
|
6919
|
+
if (timer) {
|
|
6920
|
+
return;
|
|
6921
|
+
}
|
|
6922
|
+
lastStartedAt = readVoiceRealCallEvidenceRuntimeWorkerNow(options);
|
|
6923
|
+
timer = setInterval(() => {
|
|
6924
|
+
tick().catch((error) => {
|
|
6925
|
+
options.onError?.(error);
|
|
6926
|
+
});
|
|
6927
|
+
}, pollIntervalMs);
|
|
6928
|
+
},
|
|
6929
|
+
stop: () => {
|
|
6930
|
+
if (timer) {
|
|
6931
|
+
clearInterval(timer);
|
|
6932
|
+
timer = undefined;
|
|
6933
|
+
}
|
|
6934
|
+
lastStoppedAt = readVoiceRealCallEvidenceRuntimeWorkerNow(options);
|
|
6935
|
+
},
|
|
6936
|
+
tick
|
|
6937
|
+
};
|
|
6938
|
+
};
|
|
6796
6939
|
var realCallProfileTraceSignalTypes = new Set([
|
|
6797
6940
|
"client.barge_in",
|
|
6798
6941
|
"client.browser_media",
|
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, 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";
|
|
34
|
+
export { assertVoiceProofTrendEvidence, appendVoiceRealCallProfileRecoveryEvidence, buildEmptyVoiceProofTrendReport, buildVoiceProofTrendProfileSummaries, buildVoiceProofTrendRecommendationReport, buildVoiceProofTrendReportFromRealCallProfiles, buildVoiceProofTrendReport, buildVoiceRealCallProfileEvidenceFromTraceEvents, buildVoiceRealCallProfileEvidenceFromReconnectProofReports, buildVoiceRealCallProfileDefaults, buildVoiceRealCallProfileHistoryReport, buildVoiceRealCallProfileHistoryReportFromStore, buildVoiceRealCallEvidenceRuntimeReadinessCheck, buildVoiceRealCallProfileReadinessCheck, buildVoiceRealCallProfileRecoveryJobHistoryCheck, buildVoiceRealCallProfileRecoveryActions, buildVoiceReconnectProfileEvidenceSummary, createVoiceRealCallEvidenceRuntime, createVoiceRealCallEvidenceRuntimeWorker, createVoiceRealCallEvidenceRuntimeWorkerLoop, 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, VoiceRealCallEvidenceRuntime, VoiceRealCallEvidenceRuntimeCollectOptions, VoiceRealCallEvidenceRuntimeOptions, VoiceRealCallEvidenceRuntimeReport, VoiceRealCallEvidenceRuntimeRoutesOptions, VoiceRealCallEvidenceRuntimeSourceOptions, 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, VoiceRealCallEvidenceRuntimeWorker, VoiceRealCallEvidenceRuntimeWorkerHealthReport, VoiceRealCallEvidenceRuntimeWorkerLoop, VoiceRealCallEvidenceRuntimeWorkerLoopOptions, VoiceRealCallEvidenceRuntimeWorkerOptions, VoiceRealCallEvidenceRuntimeWorkerStatus, 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
|
@@ -16983,6 +16983,149 @@ var createVoiceRealCallEvidenceRuntime = (options) => {
|
|
|
16983
16983
|
})
|
|
16984
16984
|
};
|
|
16985
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
|
+
};
|
|
17050
|
+
var readVoiceRealCallEvidenceRuntimeWorkerNow = (options) => (options.now ?? (() => new Date))().toISOString();
|
|
17051
|
+
var readVoiceRealCallEvidenceRuntimeWorkerError = (error) => error instanceof Error ? error.message : String(error);
|
|
17052
|
+
var createVoiceRealCallEvidenceRuntimeWorker = (options) => {
|
|
17053
|
+
let collectCount = 0;
|
|
17054
|
+
let error;
|
|
17055
|
+
let lastCollectedAt;
|
|
17056
|
+
let lastReport;
|
|
17057
|
+
let lastTickAt;
|
|
17058
|
+
let status = "idle";
|
|
17059
|
+
const collect = async () => {
|
|
17060
|
+
lastTickAt = readVoiceRealCallEvidenceRuntimeWorkerNow(options);
|
|
17061
|
+
try {
|
|
17062
|
+
const report = await options.runtime.collect(options.collectOptions);
|
|
17063
|
+
collectCount += 1;
|
|
17064
|
+
error = undefined;
|
|
17065
|
+
lastCollectedAt = readVoiceRealCallEvidenceRuntimeWorkerNow(options);
|
|
17066
|
+
lastReport = report;
|
|
17067
|
+
status = report.status;
|
|
17068
|
+
await options.onCollect?.(report);
|
|
17069
|
+
return report;
|
|
17070
|
+
} catch (caught) {
|
|
17071
|
+
error = readVoiceRealCallEvidenceRuntimeWorkerError(caught);
|
|
17072
|
+
status = "fail";
|
|
17073
|
+
await options.onError?.(caught);
|
|
17074
|
+
throw caught;
|
|
17075
|
+
}
|
|
17076
|
+
};
|
|
17077
|
+
return {
|
|
17078
|
+
collect,
|
|
17079
|
+
health: () => ({
|
|
17080
|
+
collectCount,
|
|
17081
|
+
error,
|
|
17082
|
+
isRunning: false,
|
|
17083
|
+
lastCollectedAt,
|
|
17084
|
+
lastReport,
|
|
17085
|
+
lastTickAt,
|
|
17086
|
+
source: "real-call-evidence-runtime-worker",
|
|
17087
|
+
status
|
|
17088
|
+
})
|
|
17089
|
+
};
|
|
17090
|
+
};
|
|
17091
|
+
var createVoiceRealCallEvidenceRuntimeWorkerLoop = (options) => {
|
|
17092
|
+
const worker = createVoiceRealCallEvidenceRuntimeWorker(options);
|
|
17093
|
+
const pollIntervalMs = Math.max(1, options.pollIntervalMs ?? 30000);
|
|
17094
|
+
let timer;
|
|
17095
|
+
let lastStartedAt;
|
|
17096
|
+
let lastStoppedAt;
|
|
17097
|
+
const isRunning = () => timer !== undefined;
|
|
17098
|
+
const tick = () => worker.collect();
|
|
17099
|
+
return {
|
|
17100
|
+
collect: tick,
|
|
17101
|
+
health: () => ({
|
|
17102
|
+
...worker.health(),
|
|
17103
|
+
isRunning: isRunning(),
|
|
17104
|
+
lastStartedAt,
|
|
17105
|
+
lastStoppedAt
|
|
17106
|
+
}),
|
|
17107
|
+
isRunning,
|
|
17108
|
+
start: () => {
|
|
17109
|
+
if (timer) {
|
|
17110
|
+
return;
|
|
17111
|
+
}
|
|
17112
|
+
lastStartedAt = readVoiceRealCallEvidenceRuntimeWorkerNow(options);
|
|
17113
|
+
timer = setInterval(() => {
|
|
17114
|
+
tick().catch((error) => {
|
|
17115
|
+
options.onError?.(error);
|
|
17116
|
+
});
|
|
17117
|
+
}, pollIntervalMs);
|
|
17118
|
+
},
|
|
17119
|
+
stop: () => {
|
|
17120
|
+
if (timer) {
|
|
17121
|
+
clearInterval(timer);
|
|
17122
|
+
timer = undefined;
|
|
17123
|
+
}
|
|
17124
|
+
lastStoppedAt = readVoiceRealCallEvidenceRuntimeWorkerNow(options);
|
|
17125
|
+
},
|
|
17126
|
+
tick
|
|
17127
|
+
};
|
|
17128
|
+
};
|
|
16986
17129
|
var realCallProfileTraceSignalTypes = new Set([
|
|
16987
17130
|
"client.barge_in",
|
|
16988
17131
|
"client.browser_media",
|
|
@@ -42778,6 +42921,8 @@ export {
|
|
|
42778
42921
|
createVoiceRealCallProfileTraceCollector,
|
|
42779
42922
|
createVoiceRealCallProfileRecoveryActionRoutes,
|
|
42780
42923
|
createVoiceRealCallProfileHistoryRoutes,
|
|
42924
|
+
createVoiceRealCallEvidenceRuntimeWorkerLoop,
|
|
42925
|
+
createVoiceRealCallEvidenceRuntimeWorker,
|
|
42781
42926
|
createVoiceRealCallEvidenceRuntimeRoutes,
|
|
42782
42927
|
createVoiceRealCallEvidenceRuntime,
|
|
42783
42928
|
createVoiceReadinessProfile,
|
|
@@ -43024,6 +43169,7 @@ export {
|
|
|
43024
43169
|
buildVoiceRealCallProfileEvidenceFromTraceEvents,
|
|
43025
43170
|
buildVoiceRealCallProfileEvidenceFromReconnectProofReports,
|
|
43026
43171
|
buildVoiceRealCallProfileDefaults,
|
|
43172
|
+
buildVoiceRealCallEvidenceRuntimeReadinessCheck,
|
|
43027
43173
|
buildVoiceReadinessRecoveryActions,
|
|
43028
43174
|
buildVoiceProviderSloReport,
|
|
43029
43175
|
buildVoiceProviderRouterTraceEvent,
|
package/dist/proofTrends.d.ts
CHANGED
|
@@ -280,6 +280,39 @@ export type VoiceRealCallEvidenceRuntime = {
|
|
|
280
280
|
collect: (options?: VoiceRealCallEvidenceRuntimeCollectOptions) => Promise<VoiceRealCallEvidenceRuntimeReport>;
|
|
281
281
|
listEvidence: (options?: VoiceRealCallProfileEvidenceListOptions) => Promise<VoiceRealCallProfileEvidenceRecord[]>;
|
|
282
282
|
};
|
|
283
|
+
export type VoiceRealCallEvidenceRuntimeWorkerStatus = "idle" | "running" | VoiceProofTrendStatus;
|
|
284
|
+
export type VoiceRealCallEvidenceRuntimeWorkerHealthReport = {
|
|
285
|
+
collectCount: number;
|
|
286
|
+
error?: string;
|
|
287
|
+
isRunning: boolean;
|
|
288
|
+
lastCollectedAt?: string;
|
|
289
|
+
lastReport?: VoiceRealCallEvidenceRuntimeReport;
|
|
290
|
+
lastStartedAt?: string;
|
|
291
|
+
lastStoppedAt?: string;
|
|
292
|
+
lastTickAt?: string;
|
|
293
|
+
source: string;
|
|
294
|
+
status: VoiceRealCallEvidenceRuntimeWorkerStatus;
|
|
295
|
+
};
|
|
296
|
+
export type VoiceRealCallEvidenceRuntimeWorkerOptions = {
|
|
297
|
+
collectOptions?: VoiceRealCallEvidenceRuntimeCollectOptions;
|
|
298
|
+
now?: () => Date;
|
|
299
|
+
onCollect?: (report: VoiceRealCallEvidenceRuntimeReport) => void | Promise<void>;
|
|
300
|
+
onError?: (error: unknown) => void | Promise<void>;
|
|
301
|
+
runtime: VoiceRealCallEvidenceRuntime;
|
|
302
|
+
};
|
|
303
|
+
export type VoiceRealCallEvidenceRuntimeWorker = {
|
|
304
|
+
collect: () => Promise<VoiceRealCallEvidenceRuntimeReport>;
|
|
305
|
+
health: () => VoiceRealCallEvidenceRuntimeWorkerHealthReport;
|
|
306
|
+
};
|
|
307
|
+
export type VoiceRealCallEvidenceRuntimeWorkerLoopOptions = VoiceRealCallEvidenceRuntimeWorkerOptions & {
|
|
308
|
+
pollIntervalMs?: number;
|
|
309
|
+
};
|
|
310
|
+
export type VoiceRealCallEvidenceRuntimeWorkerLoop = VoiceRealCallEvidenceRuntimeWorker & {
|
|
311
|
+
isRunning: () => boolean;
|
|
312
|
+
start: () => void;
|
|
313
|
+
stop: () => void;
|
|
314
|
+
tick: () => Promise<VoiceRealCallEvidenceRuntimeReport>;
|
|
315
|
+
};
|
|
283
316
|
export type VoiceRealCallEvidenceRuntimeRoutesOptions = VoiceRealCallEvidenceRuntimeOptions & {
|
|
284
317
|
collectPath?: false | string;
|
|
285
318
|
headers?: HeadersInit;
|
|
@@ -290,6 +323,16 @@ export type VoiceRealCallEvidenceRuntimeRoutesOptions = VoiceRealCallEvidenceRun
|
|
|
290
323
|
runtime?: VoiceRealCallEvidenceRuntime;
|
|
291
324
|
title?: string;
|
|
292
325
|
};
|
|
326
|
+
export type VoiceRealCallEvidenceRuntimeReadinessCheckOptions = {
|
|
327
|
+
collectHref?: string;
|
|
328
|
+
failOnWarnings?: boolean;
|
|
329
|
+
href?: string;
|
|
330
|
+
label?: string;
|
|
331
|
+
minProfiles?: number;
|
|
332
|
+
minSessions?: number;
|
|
333
|
+
minStoredEvidence?: number;
|
|
334
|
+
sourceHref?: string;
|
|
335
|
+
};
|
|
293
336
|
export type VoiceProofTrendRealCallProfileReportOptions = VoiceProofTrendProfileSummaryOptions & {
|
|
294
337
|
baseUrl?: string;
|
|
295
338
|
evidence: readonly VoiceProofTrendRealCallProfileEvidence[];
|
|
@@ -711,6 +754,9 @@ export declare const loadVoiceRealCallProfileEvidenceFromStore: (options: VoiceR
|
|
|
711
754
|
store: VoiceRealCallProfileEvidenceStore;
|
|
712
755
|
}) => Promise<VoiceRealCallProfileEvidenceRecord[]>;
|
|
713
756
|
export declare const createVoiceRealCallEvidenceRuntime: (options: VoiceRealCallEvidenceRuntimeOptions) => VoiceRealCallEvidenceRuntime;
|
|
757
|
+
export declare const buildVoiceRealCallEvidenceRuntimeReadinessCheck: (report: VoiceRealCallEvidenceRuntimeReport, options?: VoiceRealCallEvidenceRuntimeReadinessCheckOptions) => VoiceProductionReadinessCheck;
|
|
758
|
+
export declare const createVoiceRealCallEvidenceRuntimeWorker: (options: VoiceRealCallEvidenceRuntimeWorkerOptions) => VoiceRealCallEvidenceRuntimeWorker;
|
|
759
|
+
export declare const createVoiceRealCallEvidenceRuntimeWorkerLoop: (options: VoiceRealCallEvidenceRuntimeWorkerLoopOptions) => VoiceRealCallEvidenceRuntimeWorkerLoop;
|
|
714
760
|
export declare const createVoiceRealCallProfileTraceCollector: <TEvent extends StoredVoiceTraceEvent = StoredVoiceTraceEvent>(options: VoiceRealCallProfileTraceCollectorOptions<TEvent>) => VoiceRealCallProfileTraceCollector<TEvent>;
|
|
715
761
|
export declare const buildVoiceProofTrendProfileSummaries: (input: VoiceProofTrendReport | readonly VoiceProofTrendReport[], options?: VoiceProofTrendProfileSummaryOptions) => VoiceProofTrendProfileSummary[];
|
|
716
762
|
export declare const buildVoiceProofTrendReportFromRealCallProfiles: (options: VoiceProofTrendRealCallProfileReportOptions) => VoiceProofTrendReport;
|
package/dist/react/index.js
CHANGED
|
@@ -3888,6 +3888,149 @@ var createVoiceRealCallEvidenceRuntime = (options) => {
|
|
|
3888
3888
|
})
|
|
3889
3889
|
};
|
|
3890
3890
|
};
|
|
3891
|
+
var buildVoiceRealCallEvidenceRuntimeReadinessCheck = (report, options = {}) => {
|
|
3892
|
+
const minStoredEvidence = options.minStoredEvidence ?? 1;
|
|
3893
|
+
const minSessions = options.minSessions ?? 1;
|
|
3894
|
+
const minProfiles = options.minProfiles ?? 1;
|
|
3895
|
+
const issues = [];
|
|
3896
|
+
const warnings = [];
|
|
3897
|
+
if (report.summary.storedEvidence < minStoredEvidence) {
|
|
3898
|
+
issues.push(`Expected at least ${String(minStoredEvidence)} stored real-call evidence record(s), observed ${String(report.summary.storedEvidence)}.`);
|
|
3899
|
+
}
|
|
3900
|
+
if (report.summary.sessions < minSessions) {
|
|
3901
|
+
issues.push(`Expected at least ${String(minSessions)} real-call session(s), observed ${String(report.summary.sessions)}.`);
|
|
3902
|
+
}
|
|
3903
|
+
if (report.summary.profiles < minProfiles) {
|
|
3904
|
+
issues.push(`Expected at least ${String(minProfiles)} real-call profile(s), observed ${String(report.summary.profiles)}.`);
|
|
3905
|
+
}
|
|
3906
|
+
if (report.summary.failedProfiles > 0) {
|
|
3907
|
+
issues.push(`${String(report.summary.failedProfiles)} rolling real-call profile(s) are failing.`);
|
|
3908
|
+
}
|
|
3909
|
+
if (report.status === "empty" || report.status === "stale") {
|
|
3910
|
+
issues.push(`Real-call evidence runtime is ${report.status}.`);
|
|
3911
|
+
} else if (report.status === "fail") {
|
|
3912
|
+
issues.push("Real-call evidence runtime has failing evidence.");
|
|
3913
|
+
}
|
|
3914
|
+
if (report.status !== "pass" && options.failOnWarnings === true) {
|
|
3915
|
+
warnings.push(...report.issues);
|
|
3916
|
+
}
|
|
3917
|
+
const status = issues.length > 0 ? "fail" : warnings.length > 0 && options.failOnWarnings === true ? "fail" : warnings.length > 0 ? "warn" : "pass";
|
|
3918
|
+
const sourceHref = options.sourceHref ?? "/api/voice/real-call-evidence-runtime";
|
|
3919
|
+
const href = options.href ?? "/voice/real-call-evidence-runtime";
|
|
3920
|
+
return {
|
|
3921
|
+
actions: [
|
|
3922
|
+
{
|
|
3923
|
+
description: "Collect fresh real browser, phone, reconnect, provider, and latency evidence into the runtime store.",
|
|
3924
|
+
href: options.collectHref ?? `${sourceHref}/collect`,
|
|
3925
|
+
label: "Collect real-call evidence",
|
|
3926
|
+
method: "POST"
|
|
3927
|
+
},
|
|
3928
|
+
{
|
|
3929
|
+
description: "Open rolling real-call evidence and inspect profile/session depth.",
|
|
3930
|
+
href,
|
|
3931
|
+
label: "Open real-call evidence runtime"
|
|
3932
|
+
}
|
|
3933
|
+
],
|
|
3934
|
+
detail: status === "pass" ? `${String(report.summary.storedEvidence)} stored evidence record(s), ${String(report.summary.sessions)} session(s), ${String(report.summary.profiles)} profile(s).` : [...issues, ...warnings].join(" "),
|
|
3935
|
+
gateExplanation: {
|
|
3936
|
+
evidenceHref: sourceHref,
|
|
3937
|
+
observed: report.summary.storedEvidence,
|
|
3938
|
+
remediation: "Run real browser or phone traffic, collect runtime evidence, and ensure rolling profile history is passing before promotion.",
|
|
3939
|
+
sourceHref: href,
|
|
3940
|
+
threshold: minStoredEvidence,
|
|
3941
|
+
thresholdLabel: "Minimum stored real-call evidence",
|
|
3942
|
+
unit: "count"
|
|
3943
|
+
},
|
|
3944
|
+
href,
|
|
3945
|
+
label: options.label ?? "Real-call evidence runtime",
|
|
3946
|
+
proofSource: {
|
|
3947
|
+
href: sourceHref,
|
|
3948
|
+
source: report.source,
|
|
3949
|
+
sourceLabel: "Real-call evidence runtime"
|
|
3950
|
+
},
|
|
3951
|
+
status,
|
|
3952
|
+
value: `${String(report.summary.storedEvidence)} evidence / ${String(report.summary.sessions)} sessions / ${String(report.summary.profiles)} profiles`
|
|
3953
|
+
};
|
|
3954
|
+
};
|
|
3955
|
+
var readVoiceRealCallEvidenceRuntimeWorkerNow = (options) => (options.now ?? (() => new Date))().toISOString();
|
|
3956
|
+
var readVoiceRealCallEvidenceRuntimeWorkerError = (error) => error instanceof Error ? error.message : String(error);
|
|
3957
|
+
var createVoiceRealCallEvidenceRuntimeWorker = (options) => {
|
|
3958
|
+
let collectCount = 0;
|
|
3959
|
+
let error;
|
|
3960
|
+
let lastCollectedAt;
|
|
3961
|
+
let lastReport;
|
|
3962
|
+
let lastTickAt;
|
|
3963
|
+
let status = "idle";
|
|
3964
|
+
const collect = async () => {
|
|
3965
|
+
lastTickAt = readVoiceRealCallEvidenceRuntimeWorkerNow(options);
|
|
3966
|
+
try {
|
|
3967
|
+
const report = await options.runtime.collect(options.collectOptions);
|
|
3968
|
+
collectCount += 1;
|
|
3969
|
+
error = undefined;
|
|
3970
|
+
lastCollectedAt = readVoiceRealCallEvidenceRuntimeWorkerNow(options);
|
|
3971
|
+
lastReport = report;
|
|
3972
|
+
status = report.status;
|
|
3973
|
+
await options.onCollect?.(report);
|
|
3974
|
+
return report;
|
|
3975
|
+
} catch (caught) {
|
|
3976
|
+
error = readVoiceRealCallEvidenceRuntimeWorkerError(caught);
|
|
3977
|
+
status = "fail";
|
|
3978
|
+
await options.onError?.(caught);
|
|
3979
|
+
throw caught;
|
|
3980
|
+
}
|
|
3981
|
+
};
|
|
3982
|
+
return {
|
|
3983
|
+
collect,
|
|
3984
|
+
health: () => ({
|
|
3985
|
+
collectCount,
|
|
3986
|
+
error,
|
|
3987
|
+
isRunning: false,
|
|
3988
|
+
lastCollectedAt,
|
|
3989
|
+
lastReport,
|
|
3990
|
+
lastTickAt,
|
|
3991
|
+
source: "real-call-evidence-runtime-worker",
|
|
3992
|
+
status
|
|
3993
|
+
})
|
|
3994
|
+
};
|
|
3995
|
+
};
|
|
3996
|
+
var createVoiceRealCallEvidenceRuntimeWorkerLoop = (options) => {
|
|
3997
|
+
const worker = createVoiceRealCallEvidenceRuntimeWorker(options);
|
|
3998
|
+
const pollIntervalMs = Math.max(1, options.pollIntervalMs ?? 30000);
|
|
3999
|
+
let timer;
|
|
4000
|
+
let lastStartedAt;
|
|
4001
|
+
let lastStoppedAt;
|
|
4002
|
+
const isRunning = () => timer !== undefined;
|
|
4003
|
+
const tick = () => worker.collect();
|
|
4004
|
+
return {
|
|
4005
|
+
collect: tick,
|
|
4006
|
+
health: () => ({
|
|
4007
|
+
...worker.health(),
|
|
4008
|
+
isRunning: isRunning(),
|
|
4009
|
+
lastStartedAt,
|
|
4010
|
+
lastStoppedAt
|
|
4011
|
+
}),
|
|
4012
|
+
isRunning,
|
|
4013
|
+
start: () => {
|
|
4014
|
+
if (timer) {
|
|
4015
|
+
return;
|
|
4016
|
+
}
|
|
4017
|
+
lastStartedAt = readVoiceRealCallEvidenceRuntimeWorkerNow(options);
|
|
4018
|
+
timer = setInterval(() => {
|
|
4019
|
+
tick().catch((error) => {
|
|
4020
|
+
options.onError?.(error);
|
|
4021
|
+
});
|
|
4022
|
+
}, pollIntervalMs);
|
|
4023
|
+
},
|
|
4024
|
+
stop: () => {
|
|
4025
|
+
if (timer) {
|
|
4026
|
+
clearInterval(timer);
|
|
4027
|
+
timer = undefined;
|
|
4028
|
+
}
|
|
4029
|
+
lastStoppedAt = readVoiceRealCallEvidenceRuntimeWorkerNow(options);
|
|
4030
|
+
},
|
|
4031
|
+
tick
|
|
4032
|
+
};
|
|
4033
|
+
};
|
|
3891
4034
|
var realCallProfileTraceSignalTypes = new Set([
|
|
3892
4035
|
"client.barge_in",
|
|
3893
4036
|
"client.browser_media",
|
package/dist/vue/index.js
CHANGED
|
@@ -3809,6 +3809,149 @@ var createVoiceRealCallEvidenceRuntime = (options) => {
|
|
|
3809
3809
|
})
|
|
3810
3810
|
};
|
|
3811
3811
|
};
|
|
3812
|
+
var buildVoiceRealCallEvidenceRuntimeReadinessCheck = (report, options = {}) => {
|
|
3813
|
+
const minStoredEvidence = options.minStoredEvidence ?? 1;
|
|
3814
|
+
const minSessions = options.minSessions ?? 1;
|
|
3815
|
+
const minProfiles = options.minProfiles ?? 1;
|
|
3816
|
+
const issues = [];
|
|
3817
|
+
const warnings = [];
|
|
3818
|
+
if (report.summary.storedEvidence < minStoredEvidence) {
|
|
3819
|
+
issues.push(`Expected at least ${String(minStoredEvidence)} stored real-call evidence record(s), observed ${String(report.summary.storedEvidence)}.`);
|
|
3820
|
+
}
|
|
3821
|
+
if (report.summary.sessions < minSessions) {
|
|
3822
|
+
issues.push(`Expected at least ${String(minSessions)} real-call session(s), observed ${String(report.summary.sessions)}.`);
|
|
3823
|
+
}
|
|
3824
|
+
if (report.summary.profiles < minProfiles) {
|
|
3825
|
+
issues.push(`Expected at least ${String(minProfiles)} real-call profile(s), observed ${String(report.summary.profiles)}.`);
|
|
3826
|
+
}
|
|
3827
|
+
if (report.summary.failedProfiles > 0) {
|
|
3828
|
+
issues.push(`${String(report.summary.failedProfiles)} rolling real-call profile(s) are failing.`);
|
|
3829
|
+
}
|
|
3830
|
+
if (report.status === "empty" || report.status === "stale") {
|
|
3831
|
+
issues.push(`Real-call evidence runtime is ${report.status}.`);
|
|
3832
|
+
} else if (report.status === "fail") {
|
|
3833
|
+
issues.push("Real-call evidence runtime has failing evidence.");
|
|
3834
|
+
}
|
|
3835
|
+
if (report.status !== "pass" && options.failOnWarnings === true) {
|
|
3836
|
+
warnings.push(...report.issues);
|
|
3837
|
+
}
|
|
3838
|
+
const status = issues.length > 0 ? "fail" : warnings.length > 0 && options.failOnWarnings === true ? "fail" : warnings.length > 0 ? "warn" : "pass";
|
|
3839
|
+
const sourceHref = options.sourceHref ?? "/api/voice/real-call-evidence-runtime";
|
|
3840
|
+
const href = options.href ?? "/voice/real-call-evidence-runtime";
|
|
3841
|
+
return {
|
|
3842
|
+
actions: [
|
|
3843
|
+
{
|
|
3844
|
+
description: "Collect fresh real browser, phone, reconnect, provider, and latency evidence into the runtime store.",
|
|
3845
|
+
href: options.collectHref ?? `${sourceHref}/collect`,
|
|
3846
|
+
label: "Collect real-call evidence",
|
|
3847
|
+
method: "POST"
|
|
3848
|
+
},
|
|
3849
|
+
{
|
|
3850
|
+
description: "Open rolling real-call evidence and inspect profile/session depth.",
|
|
3851
|
+
href,
|
|
3852
|
+
label: "Open real-call evidence runtime"
|
|
3853
|
+
}
|
|
3854
|
+
],
|
|
3855
|
+
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(" "),
|
|
3856
|
+
gateExplanation: {
|
|
3857
|
+
evidenceHref: sourceHref,
|
|
3858
|
+
observed: report.summary.storedEvidence,
|
|
3859
|
+
remediation: "Run real browser or phone traffic, collect runtime evidence, and ensure rolling profile history is passing before promotion.",
|
|
3860
|
+
sourceHref: href,
|
|
3861
|
+
threshold: minStoredEvidence,
|
|
3862
|
+
thresholdLabel: "Minimum stored real-call evidence",
|
|
3863
|
+
unit: "count"
|
|
3864
|
+
},
|
|
3865
|
+
href,
|
|
3866
|
+
label: options.label ?? "Real-call evidence runtime",
|
|
3867
|
+
proofSource: {
|
|
3868
|
+
href: sourceHref,
|
|
3869
|
+
source: report.source,
|
|
3870
|
+
sourceLabel: "Real-call evidence runtime"
|
|
3871
|
+
},
|
|
3872
|
+
status,
|
|
3873
|
+
value: `${String(report.summary.storedEvidence)} evidence / ${String(report.summary.sessions)} sessions / ${String(report.summary.profiles)} profiles`
|
|
3874
|
+
};
|
|
3875
|
+
};
|
|
3876
|
+
var readVoiceRealCallEvidenceRuntimeWorkerNow = (options) => (options.now ?? (() => new Date))().toISOString();
|
|
3877
|
+
var readVoiceRealCallEvidenceRuntimeWorkerError = (error) => error instanceof Error ? error.message : String(error);
|
|
3878
|
+
var createVoiceRealCallEvidenceRuntimeWorker = (options) => {
|
|
3879
|
+
let collectCount = 0;
|
|
3880
|
+
let error;
|
|
3881
|
+
let lastCollectedAt;
|
|
3882
|
+
let lastReport;
|
|
3883
|
+
let lastTickAt;
|
|
3884
|
+
let status = "idle";
|
|
3885
|
+
const collect = async () => {
|
|
3886
|
+
lastTickAt = readVoiceRealCallEvidenceRuntimeWorkerNow(options);
|
|
3887
|
+
try {
|
|
3888
|
+
const report = await options.runtime.collect(options.collectOptions);
|
|
3889
|
+
collectCount += 1;
|
|
3890
|
+
error = undefined;
|
|
3891
|
+
lastCollectedAt = readVoiceRealCallEvidenceRuntimeWorkerNow(options);
|
|
3892
|
+
lastReport = report;
|
|
3893
|
+
status = report.status;
|
|
3894
|
+
await options.onCollect?.(report);
|
|
3895
|
+
return report;
|
|
3896
|
+
} catch (caught) {
|
|
3897
|
+
error = readVoiceRealCallEvidenceRuntimeWorkerError(caught);
|
|
3898
|
+
status = "fail";
|
|
3899
|
+
await options.onError?.(caught);
|
|
3900
|
+
throw caught;
|
|
3901
|
+
}
|
|
3902
|
+
};
|
|
3903
|
+
return {
|
|
3904
|
+
collect,
|
|
3905
|
+
health: () => ({
|
|
3906
|
+
collectCount,
|
|
3907
|
+
error,
|
|
3908
|
+
isRunning: false,
|
|
3909
|
+
lastCollectedAt,
|
|
3910
|
+
lastReport,
|
|
3911
|
+
lastTickAt,
|
|
3912
|
+
source: "real-call-evidence-runtime-worker",
|
|
3913
|
+
status
|
|
3914
|
+
})
|
|
3915
|
+
};
|
|
3916
|
+
};
|
|
3917
|
+
var createVoiceRealCallEvidenceRuntimeWorkerLoop = (options) => {
|
|
3918
|
+
const worker = createVoiceRealCallEvidenceRuntimeWorker(options);
|
|
3919
|
+
const pollIntervalMs = Math.max(1, options.pollIntervalMs ?? 30000);
|
|
3920
|
+
let timer;
|
|
3921
|
+
let lastStartedAt;
|
|
3922
|
+
let lastStoppedAt;
|
|
3923
|
+
const isRunning = () => timer !== undefined;
|
|
3924
|
+
const tick = () => worker.collect();
|
|
3925
|
+
return {
|
|
3926
|
+
collect: tick,
|
|
3927
|
+
health: () => ({
|
|
3928
|
+
...worker.health(),
|
|
3929
|
+
isRunning: isRunning(),
|
|
3930
|
+
lastStartedAt,
|
|
3931
|
+
lastStoppedAt
|
|
3932
|
+
}),
|
|
3933
|
+
isRunning,
|
|
3934
|
+
start: () => {
|
|
3935
|
+
if (timer) {
|
|
3936
|
+
return;
|
|
3937
|
+
}
|
|
3938
|
+
lastStartedAt = readVoiceRealCallEvidenceRuntimeWorkerNow(options);
|
|
3939
|
+
timer = setInterval(() => {
|
|
3940
|
+
tick().catch((error) => {
|
|
3941
|
+
options.onError?.(error);
|
|
3942
|
+
});
|
|
3943
|
+
}, pollIntervalMs);
|
|
3944
|
+
},
|
|
3945
|
+
stop: () => {
|
|
3946
|
+
if (timer) {
|
|
3947
|
+
clearInterval(timer);
|
|
3948
|
+
timer = undefined;
|
|
3949
|
+
}
|
|
3950
|
+
lastStoppedAt = readVoiceRealCallEvidenceRuntimeWorkerNow(options);
|
|
3951
|
+
},
|
|
3952
|
+
tick
|
|
3953
|
+
};
|
|
3954
|
+
};
|
|
3812
3955
|
var realCallProfileTraceSignalTypes = new Set([
|
|
3813
3956
|
"client.barge_in",
|
|
3814
3957
|
"client.browser_media",
|