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

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.
@@ -6857,6 +6857,161 @@ var buildVoiceRealCallEvidenceRuntimeReadinessCheck = (report, options = {}) =>
6857
6857
  value: `${String(report.summary.storedEvidence)} evidence / ${String(report.summary.sessions)} sessions / ${String(report.summary.profiles)} profiles`
6858
6858
  };
6859
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
+ const health = worker.health();
6913
+ const running = isRunning();
6914
+ return {
6915
+ ...health,
6916
+ isRunning: running,
6917
+ lastStartedAt,
6918
+ lastStoppedAt,
6919
+ status: running && health.status === "idle" ? "running" : health.status
6920
+ };
6921
+ },
6922
+ isRunning,
6923
+ start: () => {
6924
+ if (timer) {
6925
+ return;
6926
+ }
6927
+ lastStartedAt = readVoiceRealCallEvidenceRuntimeWorkerNow(options);
6928
+ timer = setInterval(() => {
6929
+ tick().catch((error) => {
6930
+ options.onError?.(error);
6931
+ });
6932
+ }, pollIntervalMs);
6933
+ },
6934
+ stop: () => {
6935
+ if (timer) {
6936
+ clearInterval(timer);
6937
+ timer = undefined;
6938
+ }
6939
+ lastStoppedAt = readVoiceRealCallEvidenceRuntimeWorkerNow(options);
6940
+ },
6941
+ tick
6942
+ };
6943
+ };
6944
+ var buildVoiceRealCallEvidenceRuntimeWorkerReadinessCheck = (health, options = {}) => {
6945
+ const requireRunning = options.requireRunning ?? true;
6946
+ const issues = [];
6947
+ const warnings = [];
6948
+ const now = options.now ?? (() => new Date);
6949
+ const sourceHref = options.sourceHref ?? "/api/voice/real-call-evidence-runtime/worker";
6950
+ const href = options.href ?? "/voice/real-call-evidence-runtime";
6951
+ if (health.error) {
6952
+ issues.push(`Real-call evidence auto-collector error: ${health.error}.`);
6953
+ }
6954
+ if (health.status === "fail") {
6955
+ issues.push("Real-call evidence auto-collector is failing.");
6956
+ }
6957
+ if (requireRunning && !health.isRunning) {
6958
+ const message = "Real-call evidence auto-collector is not running; evidence is only collected manually.";
6959
+ if (options.failOnNotRunning) {
6960
+ issues.push(message);
6961
+ } else {
6962
+ warnings.push(message);
6963
+ }
6964
+ }
6965
+ if (health.collectCount === 0) {
6966
+ warnings.push("Real-call evidence auto-collector has not collected yet.");
6967
+ }
6968
+ if (options.maxLastCollectedAgeMs && health.lastCollectedAt) {
6969
+ const ageMs = now().getTime() - new Date(health.lastCollectedAt).getTime();
6970
+ if (Number.isFinite(ageMs) && ageMs > options.maxLastCollectedAgeMs) {
6971
+ const message = `Last real-call evidence auto-collection is ${String(ageMs)}ms old.`;
6972
+ if (options.failOnStale) {
6973
+ issues.push(message);
6974
+ } else {
6975
+ warnings.push(message);
6976
+ }
6977
+ }
6978
+ }
6979
+ const status = issues.length > 0 ? "fail" : warnings.length > 0 ? "warn" : "pass";
6980
+ return {
6981
+ actions: [
6982
+ {
6983
+ description: "Run one collection cycle immediately and update worker health.",
6984
+ href: options.collectHref ?? "/api/voice/real-call-evidence-runtime/collect",
6985
+ label: "Collect real-call evidence",
6986
+ method: "POST"
6987
+ },
6988
+ {
6989
+ description: "Open rolling real-call evidence and inspect worker health.",
6990
+ href,
6991
+ label: "Open real-call evidence runtime"
6992
+ }
6993
+ ],
6994
+ detail: status === "pass" ? `Auto-collector is running with ${String(health.collectCount)} collection(s).` : [...issues, ...warnings].join(" "),
6995
+ gateExplanation: {
6996
+ evidenceHref: sourceHref,
6997
+ observed: health.isRunning ? "running" : "manual",
6998
+ remediation: "Enable the real-call evidence worker loop in production, keep it healthy, and run real traffic so rolling evidence stays fresh.",
6999
+ sourceHref: href,
7000
+ threshold: requireRunning ? "running" : "available",
7001
+ thresholdLabel: "Real-call evidence collection mode",
7002
+ unit: "status"
7003
+ },
7004
+ href,
7005
+ label: options.label ?? "Real-call evidence auto-collector",
7006
+ proofSource: {
7007
+ href: sourceHref,
7008
+ source: health.source,
7009
+ sourceLabel: "Real-call evidence worker health"
7010
+ },
7011
+ status,
7012
+ value: `${health.isRunning ? "running" : "manual"} / ${String(health.collectCount)} collections / ${health.status}`
7013
+ };
7014
+ };
6860
7015
  var realCallProfileTraceSignalTypes = new Set([
6861
7016
  "client.barge_in",
6862
7017
  "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, 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";
34
+ export { assertVoiceProofTrendEvidence, appendVoiceRealCallProfileRecoveryEvidence, buildEmptyVoiceProofTrendReport, buildVoiceProofTrendProfileSummaries, buildVoiceProofTrendRecommendationReport, buildVoiceProofTrendReportFromRealCallProfiles, buildVoiceProofTrendReport, buildVoiceRealCallProfileEvidenceFromTraceEvents, buildVoiceRealCallProfileEvidenceFromReconnectProofReports, buildVoiceRealCallProfileDefaults, buildVoiceRealCallProfileHistoryReport, buildVoiceRealCallProfileHistoryReportFromStore, buildVoiceRealCallEvidenceRuntimeReadinessCheck, buildVoiceRealCallEvidenceRuntimeWorkerReadinessCheck, 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, VoiceRealCallEvidenceRuntimeReadinessCheckOptions, 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, VoiceRealCallEvidenceRuntimeWorkerReadinessCheckOptions, 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
@@ -17047,6 +17047,161 @@ var buildVoiceRealCallEvidenceRuntimeReadinessCheck = (report, options = {}) =>
17047
17047
  value: `${String(report.summary.storedEvidence)} evidence / ${String(report.summary.sessions)} sessions / ${String(report.summary.profiles)} profiles`
17048
17048
  };
17049
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
+ const health = worker.health();
17103
+ const running = isRunning();
17104
+ return {
17105
+ ...health,
17106
+ isRunning: running,
17107
+ lastStartedAt,
17108
+ lastStoppedAt,
17109
+ status: running && health.status === "idle" ? "running" : health.status
17110
+ };
17111
+ },
17112
+ isRunning,
17113
+ start: () => {
17114
+ if (timer) {
17115
+ return;
17116
+ }
17117
+ lastStartedAt = readVoiceRealCallEvidenceRuntimeWorkerNow(options);
17118
+ timer = setInterval(() => {
17119
+ tick().catch((error) => {
17120
+ options.onError?.(error);
17121
+ });
17122
+ }, pollIntervalMs);
17123
+ },
17124
+ stop: () => {
17125
+ if (timer) {
17126
+ clearInterval(timer);
17127
+ timer = undefined;
17128
+ }
17129
+ lastStoppedAt = readVoiceRealCallEvidenceRuntimeWorkerNow(options);
17130
+ },
17131
+ tick
17132
+ };
17133
+ };
17134
+ var buildVoiceRealCallEvidenceRuntimeWorkerReadinessCheck = (health, options = {}) => {
17135
+ const requireRunning = options.requireRunning ?? true;
17136
+ const issues = [];
17137
+ const warnings = [];
17138
+ const now = options.now ?? (() => new Date);
17139
+ const sourceHref = options.sourceHref ?? "/api/voice/real-call-evidence-runtime/worker";
17140
+ const href = options.href ?? "/voice/real-call-evidence-runtime";
17141
+ if (health.error) {
17142
+ issues.push(`Real-call evidence auto-collector error: ${health.error}.`);
17143
+ }
17144
+ if (health.status === "fail") {
17145
+ issues.push("Real-call evidence auto-collector is failing.");
17146
+ }
17147
+ if (requireRunning && !health.isRunning) {
17148
+ const message = "Real-call evidence auto-collector is not running; evidence is only collected manually.";
17149
+ if (options.failOnNotRunning) {
17150
+ issues.push(message);
17151
+ } else {
17152
+ warnings.push(message);
17153
+ }
17154
+ }
17155
+ if (health.collectCount === 0) {
17156
+ warnings.push("Real-call evidence auto-collector has not collected yet.");
17157
+ }
17158
+ if (options.maxLastCollectedAgeMs && health.lastCollectedAt) {
17159
+ const ageMs = now().getTime() - new Date(health.lastCollectedAt).getTime();
17160
+ if (Number.isFinite(ageMs) && ageMs > options.maxLastCollectedAgeMs) {
17161
+ const message = `Last real-call evidence auto-collection is ${String(ageMs)}ms old.`;
17162
+ if (options.failOnStale) {
17163
+ issues.push(message);
17164
+ } else {
17165
+ warnings.push(message);
17166
+ }
17167
+ }
17168
+ }
17169
+ const status = issues.length > 0 ? "fail" : warnings.length > 0 ? "warn" : "pass";
17170
+ return {
17171
+ actions: [
17172
+ {
17173
+ description: "Run one collection cycle immediately and update worker health.",
17174
+ href: options.collectHref ?? "/api/voice/real-call-evidence-runtime/collect",
17175
+ label: "Collect real-call evidence",
17176
+ method: "POST"
17177
+ },
17178
+ {
17179
+ description: "Open rolling real-call evidence and inspect worker health.",
17180
+ href,
17181
+ label: "Open real-call evidence runtime"
17182
+ }
17183
+ ],
17184
+ detail: status === "pass" ? `Auto-collector is running with ${String(health.collectCount)} collection(s).` : [...issues, ...warnings].join(" "),
17185
+ gateExplanation: {
17186
+ evidenceHref: sourceHref,
17187
+ observed: health.isRunning ? "running" : "manual",
17188
+ remediation: "Enable the real-call evidence worker loop in production, keep it healthy, and run real traffic so rolling evidence stays fresh.",
17189
+ sourceHref: href,
17190
+ threshold: requireRunning ? "running" : "available",
17191
+ thresholdLabel: "Real-call evidence collection mode",
17192
+ unit: "status"
17193
+ },
17194
+ href,
17195
+ label: options.label ?? "Real-call evidence auto-collector",
17196
+ proofSource: {
17197
+ href: sourceHref,
17198
+ source: health.source,
17199
+ sourceLabel: "Real-call evidence worker health"
17200
+ },
17201
+ status,
17202
+ value: `${health.isRunning ? "running" : "manual"} / ${String(health.collectCount)} collections / ${health.status}`
17203
+ };
17204
+ };
17050
17205
  var realCallProfileTraceSignalTypes = new Set([
17051
17206
  "client.barge_in",
17052
17207
  "client.browser_media",
@@ -42842,6 +42997,8 @@ export {
42842
42997
  createVoiceRealCallProfileTraceCollector,
42843
42998
  createVoiceRealCallProfileRecoveryActionRoutes,
42844
42999
  createVoiceRealCallProfileHistoryRoutes,
43000
+ createVoiceRealCallEvidenceRuntimeWorkerLoop,
43001
+ createVoiceRealCallEvidenceRuntimeWorker,
42845
43002
  createVoiceRealCallEvidenceRuntimeRoutes,
42846
43003
  createVoiceRealCallEvidenceRuntime,
42847
43004
  createVoiceReadinessProfile,
@@ -43088,6 +43245,7 @@ export {
43088
43245
  buildVoiceRealCallProfileEvidenceFromTraceEvents,
43089
43246
  buildVoiceRealCallProfileEvidenceFromReconnectProofReports,
43090
43247
  buildVoiceRealCallProfileDefaults,
43248
+ buildVoiceRealCallEvidenceRuntimeWorkerReadinessCheck,
43091
43249
  buildVoiceRealCallEvidenceRuntimeReadinessCheck,
43092
43250
  buildVoiceReadinessRecoveryActions,
43093
43251
  buildVoiceProviderSloReport,
@@ -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;
@@ -300,6 +333,17 @@ export type VoiceRealCallEvidenceRuntimeReadinessCheckOptions = {
300
333
  minStoredEvidence?: number;
301
334
  sourceHref?: string;
302
335
  };
336
+ export type VoiceRealCallEvidenceRuntimeWorkerReadinessCheckOptions = {
337
+ collectHref?: string;
338
+ failOnNotRunning?: boolean;
339
+ failOnStale?: boolean;
340
+ href?: string;
341
+ label?: string;
342
+ maxLastCollectedAgeMs?: number;
343
+ now?: () => Date;
344
+ requireRunning?: boolean;
345
+ sourceHref?: string;
346
+ };
303
347
  export type VoiceProofTrendRealCallProfileReportOptions = VoiceProofTrendProfileSummaryOptions & {
304
348
  baseUrl?: string;
305
349
  evidence: readonly VoiceProofTrendRealCallProfileEvidence[];
@@ -722,6 +766,9 @@ export declare const loadVoiceRealCallProfileEvidenceFromStore: (options: VoiceR
722
766
  }) => Promise<VoiceRealCallProfileEvidenceRecord[]>;
723
767
  export declare const createVoiceRealCallEvidenceRuntime: (options: VoiceRealCallEvidenceRuntimeOptions) => VoiceRealCallEvidenceRuntime;
724
768
  export declare const buildVoiceRealCallEvidenceRuntimeReadinessCheck: (report: VoiceRealCallEvidenceRuntimeReport, options?: VoiceRealCallEvidenceRuntimeReadinessCheckOptions) => VoiceProductionReadinessCheck;
769
+ export declare const createVoiceRealCallEvidenceRuntimeWorker: (options: VoiceRealCallEvidenceRuntimeWorkerOptions) => VoiceRealCallEvidenceRuntimeWorker;
770
+ export declare const createVoiceRealCallEvidenceRuntimeWorkerLoop: (options: VoiceRealCallEvidenceRuntimeWorkerLoopOptions) => VoiceRealCallEvidenceRuntimeWorkerLoop;
771
+ export declare const buildVoiceRealCallEvidenceRuntimeWorkerReadinessCheck: (health: VoiceRealCallEvidenceRuntimeWorkerHealthReport, options?: VoiceRealCallEvidenceRuntimeWorkerReadinessCheckOptions) => VoiceProductionReadinessCheck;
725
772
  export declare const createVoiceRealCallProfileTraceCollector: <TEvent extends StoredVoiceTraceEvent = StoredVoiceTraceEvent>(options: VoiceRealCallProfileTraceCollectorOptions<TEvent>) => VoiceRealCallProfileTraceCollector<TEvent>;
726
773
  export declare const buildVoiceProofTrendProfileSummaries: (input: VoiceProofTrendReport | readonly VoiceProofTrendReport[], options?: VoiceProofTrendProfileSummaryOptions) => VoiceProofTrendProfileSummary[];
727
774
  export declare const buildVoiceProofTrendReportFromRealCallProfiles: (options: VoiceProofTrendRealCallProfileReportOptions) => VoiceProofTrendReport;
@@ -3952,6 +3952,161 @@ var buildVoiceRealCallEvidenceRuntimeReadinessCheck = (report, options = {}) =>
3952
3952
  value: `${String(report.summary.storedEvidence)} evidence / ${String(report.summary.sessions)} sessions / ${String(report.summary.profiles)} profiles`
3953
3953
  };
3954
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
+ const health = worker.health();
4008
+ const running = isRunning();
4009
+ return {
4010
+ ...health,
4011
+ isRunning: running,
4012
+ lastStartedAt,
4013
+ lastStoppedAt,
4014
+ status: running && health.status === "idle" ? "running" : health.status
4015
+ };
4016
+ },
4017
+ isRunning,
4018
+ start: () => {
4019
+ if (timer) {
4020
+ return;
4021
+ }
4022
+ lastStartedAt = readVoiceRealCallEvidenceRuntimeWorkerNow(options);
4023
+ timer = setInterval(() => {
4024
+ tick().catch((error) => {
4025
+ options.onError?.(error);
4026
+ });
4027
+ }, pollIntervalMs);
4028
+ },
4029
+ stop: () => {
4030
+ if (timer) {
4031
+ clearInterval(timer);
4032
+ timer = undefined;
4033
+ }
4034
+ lastStoppedAt = readVoiceRealCallEvidenceRuntimeWorkerNow(options);
4035
+ },
4036
+ tick
4037
+ };
4038
+ };
4039
+ var buildVoiceRealCallEvidenceRuntimeWorkerReadinessCheck = (health, options = {}) => {
4040
+ const requireRunning = options.requireRunning ?? true;
4041
+ const issues = [];
4042
+ const warnings = [];
4043
+ const now = options.now ?? (() => new Date);
4044
+ const sourceHref = options.sourceHref ?? "/api/voice/real-call-evidence-runtime/worker";
4045
+ const href = options.href ?? "/voice/real-call-evidence-runtime";
4046
+ if (health.error) {
4047
+ issues.push(`Real-call evidence auto-collector error: ${health.error}.`);
4048
+ }
4049
+ if (health.status === "fail") {
4050
+ issues.push("Real-call evidence auto-collector is failing.");
4051
+ }
4052
+ if (requireRunning && !health.isRunning) {
4053
+ const message = "Real-call evidence auto-collector is not running; evidence is only collected manually.";
4054
+ if (options.failOnNotRunning) {
4055
+ issues.push(message);
4056
+ } else {
4057
+ warnings.push(message);
4058
+ }
4059
+ }
4060
+ if (health.collectCount === 0) {
4061
+ warnings.push("Real-call evidence auto-collector has not collected yet.");
4062
+ }
4063
+ if (options.maxLastCollectedAgeMs && health.lastCollectedAt) {
4064
+ const ageMs = now().getTime() - new Date(health.lastCollectedAt).getTime();
4065
+ if (Number.isFinite(ageMs) && ageMs > options.maxLastCollectedAgeMs) {
4066
+ const message = `Last real-call evidence auto-collection is ${String(ageMs)}ms old.`;
4067
+ if (options.failOnStale) {
4068
+ issues.push(message);
4069
+ } else {
4070
+ warnings.push(message);
4071
+ }
4072
+ }
4073
+ }
4074
+ const status = issues.length > 0 ? "fail" : warnings.length > 0 ? "warn" : "pass";
4075
+ return {
4076
+ actions: [
4077
+ {
4078
+ description: "Run one collection cycle immediately and update worker health.",
4079
+ href: options.collectHref ?? "/api/voice/real-call-evidence-runtime/collect",
4080
+ label: "Collect real-call evidence",
4081
+ method: "POST"
4082
+ },
4083
+ {
4084
+ description: "Open rolling real-call evidence and inspect worker health.",
4085
+ href,
4086
+ label: "Open real-call evidence runtime"
4087
+ }
4088
+ ],
4089
+ detail: status === "pass" ? `Auto-collector is running with ${String(health.collectCount)} collection(s).` : [...issues, ...warnings].join(" "),
4090
+ gateExplanation: {
4091
+ evidenceHref: sourceHref,
4092
+ observed: health.isRunning ? "running" : "manual",
4093
+ remediation: "Enable the real-call evidence worker loop in production, keep it healthy, and run real traffic so rolling evidence stays fresh.",
4094
+ sourceHref: href,
4095
+ threshold: requireRunning ? "running" : "available",
4096
+ thresholdLabel: "Real-call evidence collection mode",
4097
+ unit: "status"
4098
+ },
4099
+ href,
4100
+ label: options.label ?? "Real-call evidence auto-collector",
4101
+ proofSource: {
4102
+ href: sourceHref,
4103
+ source: health.source,
4104
+ sourceLabel: "Real-call evidence worker health"
4105
+ },
4106
+ status,
4107
+ value: `${health.isRunning ? "running" : "manual"} / ${String(health.collectCount)} collections / ${health.status}`
4108
+ };
4109
+ };
3955
4110
  var realCallProfileTraceSignalTypes = new Set([
3956
4111
  "client.barge_in",
3957
4112
  "client.browser_media",
package/dist/vue/index.js CHANGED
@@ -3873,6 +3873,161 @@ var buildVoiceRealCallEvidenceRuntimeReadinessCheck = (report, options = {}) =>
3873
3873
  value: `${String(report.summary.storedEvidence)} evidence / ${String(report.summary.sessions)} sessions / ${String(report.summary.profiles)} profiles`
3874
3874
  };
3875
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
+ const health = worker.health();
3929
+ const running = isRunning();
3930
+ return {
3931
+ ...health,
3932
+ isRunning: running,
3933
+ lastStartedAt,
3934
+ lastStoppedAt,
3935
+ status: running && health.status === "idle" ? "running" : health.status
3936
+ };
3937
+ },
3938
+ isRunning,
3939
+ start: () => {
3940
+ if (timer) {
3941
+ return;
3942
+ }
3943
+ lastStartedAt = readVoiceRealCallEvidenceRuntimeWorkerNow(options);
3944
+ timer = setInterval(() => {
3945
+ tick().catch((error) => {
3946
+ options.onError?.(error);
3947
+ });
3948
+ }, pollIntervalMs);
3949
+ },
3950
+ stop: () => {
3951
+ if (timer) {
3952
+ clearInterval(timer);
3953
+ timer = undefined;
3954
+ }
3955
+ lastStoppedAt = readVoiceRealCallEvidenceRuntimeWorkerNow(options);
3956
+ },
3957
+ tick
3958
+ };
3959
+ };
3960
+ var buildVoiceRealCallEvidenceRuntimeWorkerReadinessCheck = (health, options = {}) => {
3961
+ const requireRunning = options.requireRunning ?? true;
3962
+ const issues = [];
3963
+ const warnings = [];
3964
+ const now = options.now ?? (() => new Date);
3965
+ const sourceHref = options.sourceHref ?? "/api/voice/real-call-evidence-runtime/worker";
3966
+ const href = options.href ?? "/voice/real-call-evidence-runtime";
3967
+ if (health.error) {
3968
+ issues.push(`Real-call evidence auto-collector error: ${health.error}.`);
3969
+ }
3970
+ if (health.status === "fail") {
3971
+ issues.push("Real-call evidence auto-collector is failing.");
3972
+ }
3973
+ if (requireRunning && !health.isRunning) {
3974
+ const message = "Real-call evidence auto-collector is not running; evidence is only collected manually.";
3975
+ if (options.failOnNotRunning) {
3976
+ issues.push(message);
3977
+ } else {
3978
+ warnings.push(message);
3979
+ }
3980
+ }
3981
+ if (health.collectCount === 0) {
3982
+ warnings.push("Real-call evidence auto-collector has not collected yet.");
3983
+ }
3984
+ if (options.maxLastCollectedAgeMs && health.lastCollectedAt) {
3985
+ const ageMs = now().getTime() - new Date(health.lastCollectedAt).getTime();
3986
+ if (Number.isFinite(ageMs) && ageMs > options.maxLastCollectedAgeMs) {
3987
+ const message = `Last real-call evidence auto-collection is ${String(ageMs)}ms old.`;
3988
+ if (options.failOnStale) {
3989
+ issues.push(message);
3990
+ } else {
3991
+ warnings.push(message);
3992
+ }
3993
+ }
3994
+ }
3995
+ const status = issues.length > 0 ? "fail" : warnings.length > 0 ? "warn" : "pass";
3996
+ return {
3997
+ actions: [
3998
+ {
3999
+ description: "Run one collection cycle immediately and update worker health.",
4000
+ href: options.collectHref ?? "/api/voice/real-call-evidence-runtime/collect",
4001
+ label: "Collect real-call evidence",
4002
+ method: "POST"
4003
+ },
4004
+ {
4005
+ description: "Open rolling real-call evidence and inspect worker health.",
4006
+ href,
4007
+ label: "Open real-call evidence runtime"
4008
+ }
4009
+ ],
4010
+ detail: status === "pass" ? `Auto-collector is running with ${String(health.collectCount)} collection(s).` : [...issues, ...warnings].join(" "),
4011
+ gateExplanation: {
4012
+ evidenceHref: sourceHref,
4013
+ observed: health.isRunning ? "running" : "manual",
4014
+ remediation: "Enable the real-call evidence worker loop in production, keep it healthy, and run real traffic so rolling evidence stays fresh.",
4015
+ sourceHref: href,
4016
+ threshold: requireRunning ? "running" : "available",
4017
+ thresholdLabel: "Real-call evidence collection mode",
4018
+ unit: "status"
4019
+ },
4020
+ href,
4021
+ label: options.label ?? "Real-call evidence auto-collector",
4022
+ proofSource: {
4023
+ href: sourceHref,
4024
+ source: health.source,
4025
+ sourceLabel: "Real-call evidence worker health"
4026
+ },
4027
+ status,
4028
+ value: `${health.isRunning ? "running" : "manual"} / ${String(health.collectCount)} collections / ${health.status}`
4029
+ };
4030
+ };
3876
4031
  var realCallProfileTraceSignalTypes = new Set([
3877
4032
  "client.barge_in",
3878
4033
  "client.browser_media",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.456",
3
+ "version": "0.0.22-beta.458",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",