@absolutejs/voice 0.0.22-beta.369 → 0.0.22-beta.370

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/README.md CHANGED
@@ -1486,6 +1486,22 @@ app.use(
1486
1486
 
1487
1487
  The point is not to benchmark a fake demo once. The point is to let every real call add profile evidence so `/api/voice/real-call-profile-history`, provider recommendations, profile-switch readiness, and operations records can explain which provider/runtime path is winning for each call shape.
1488
1488
 
1489
+ Use `buildVoiceRealCallProfileReadinessCheck(...)` to make that history deploy-blocking through `createVoiceProductionReadinessRoutes(...)`:
1490
+
1491
+ ```ts
1492
+ createVoiceProductionReadinessRoutes({
1493
+ additionalChecks: async () => [
1494
+ buildVoiceRealCallProfileReadinessCheck(await buildRealCallHistory(), {
1495
+ minActionableProfiles: 2,
1496
+ minCycles: 10,
1497
+ requiredProfileIds: ['meeting-recorder', 'support-agent'],
1498
+ requiredProviderRoles: ['llm', 'stt', 'tts']
1499
+ })
1500
+ ],
1501
+ store: runtime.traces
1502
+ });
1503
+ ```
1504
+
1489
1505
  Use `createVoiceProfileTraceTagger(...)` when the app already has a trace store and needs every appended trace to carry a benchmark profile label. It wraps any `VoiceTraceEventStore`, preserves the underlying store behavior, and adds `profileId`/`benchmarkProfileId` metadata and payload fields that real-call profile history can ingest later.
1490
1506
 
1491
1507
  ```ts
@@ -4506,6 +4506,81 @@ var expandProviderRouteCandidates = (provider, role, aliases = {}) => {
4506
4506
  ];
4507
4507
  };
4508
4508
  var readRealCallProfileDefaultsReport = (input) => ("defaults" in input) ? input.defaults : input;
4509
+ var buildRealCallProfileReadinessIssues = (report, options) => {
4510
+ const minProfiles = options.minProfiles ?? 1;
4511
+ const minActionableProfiles = options.minActionableProfiles ?? 1;
4512
+ const minCycles = options.minCycles ?? 1;
4513
+ const requiredProviderRoles = options.requiredProviderRoles ?? [];
4514
+ const defaultsByProfile = new Map(report.defaults.profiles.map((profile) => [profile.profileId, profile]));
4515
+ const issues = [];
4516
+ const warnings = [];
4517
+ if (report.status === "fail" || report.ok !== true) {
4518
+ issues.push(`Real-call profile history is ${report.status}.`);
4519
+ }
4520
+ if ((report.summary.profileCount ?? 0) < minProfiles) {
4521
+ issues.push(`Expected at least ${String(minProfiles)} real-call profile(s), found ${String(report.summary.profileCount ?? 0)}.`);
4522
+ }
4523
+ if (report.defaults.summary.actionableProfiles < minActionableProfiles) {
4524
+ issues.push(`Expected at least ${String(minActionableProfiles)} actionable profile default(s), found ${String(report.defaults.summary.actionableProfiles)}.`);
4525
+ }
4526
+ if ((report.summary.cycles ?? 0) < minCycles) {
4527
+ issues.push(`Expected at least ${String(minCycles)} real-call cycle(s), found ${String(report.summary.cycles ?? 0)}.`);
4528
+ }
4529
+ const ageMs = report.trend.ageMs ?? (report.generatedAt ? Date.now() - new Date(report.generatedAt).getTime() : undefined);
4530
+ if (options.maxAgeMs !== undefined && (ageMs === undefined || ageMs > options.maxAgeMs)) {
4531
+ issues.push(`Expected real-call profile history age <= ${String(options.maxAgeMs)}ms, found ${String(ageMs ?? "missing")}ms.`);
4532
+ }
4533
+ for (const profileId of options.requiredProfileIds ?? []) {
4534
+ const profile = defaultsByProfile.get(profileId);
4535
+ if (!profile) {
4536
+ issues.push(`Missing required real-call profile: ${profileId}.`);
4537
+ continue;
4538
+ }
4539
+ if (profile.status === "fail") {
4540
+ issues.push(`Required real-call profile ${profileId} is failing.`);
4541
+ } else if (profile.status === "warn") {
4542
+ warnings.push(`Required real-call profile ${profileId} is warning.`);
4543
+ }
4544
+ for (const role of requiredProviderRoles) {
4545
+ if (!profile.providerRoutes[role]) {
4546
+ warnings.push(`Required real-call profile ${profileId} is missing ${role} provider default evidence.`);
4547
+ }
4548
+ }
4549
+ }
4550
+ if (report.recommendations.profiles.some((item) => item.status === "fail")) {
4551
+ issues.push("At least one real-call profile recommendation is failing.");
4552
+ }
4553
+ if (report.recommendations.profiles.some((item) => item.status === "warn")) {
4554
+ warnings.push("At least one real-call profile recommendation is warning.");
4555
+ }
4556
+ return { issues, warnings };
4557
+ };
4558
+ var buildVoiceRealCallProfileReadinessCheck = (report, options = {}) => {
4559
+ const { issues, warnings } = buildRealCallProfileReadinessIssues(report, options);
4560
+ const status = issues.length > 0 ? "fail" : warnings.length > 0 && options.failOnWarnings === true ? "fail" : warnings.length > 0 ? "warn" : "pass";
4561
+ const detail = status === "pass" ? `${String(report.summary.profileCount)} profile(s), ${String(report.summary.cycles ?? 0)} cycle(s), ${String(report.defaults.summary.actionableProfiles)} actionable default(s).` : [...issues, ...warnings].join(" ");
4562
+ return {
4563
+ detail,
4564
+ gateExplanation: {
4565
+ evidenceHref: options.href ?? "/api/voice/real-call-profile-history",
4566
+ observed: report.defaults.summary.actionableProfiles,
4567
+ remediation: "Run fresh browser or phone calls for required profiles so provider/runtime recommendations have measured profile evidence.",
4568
+ sourceHref: options.sourceHref ?? "/voice/real-call-profile-history",
4569
+ threshold: options.minActionableProfiles ?? 1,
4570
+ thresholdLabel: "Minimum actionable real-call profiles",
4571
+ unit: "count"
4572
+ },
4573
+ href: options.href ?? "/voice/real-call-profile-history",
4574
+ label: options.label ?? "Real-call profile history",
4575
+ proofSource: {
4576
+ href: options.sourceHref ?? "/api/voice/real-call-profile-history",
4577
+ source: report.source,
4578
+ sourceLabel: "Real-call profile history"
4579
+ },
4580
+ status,
4581
+ value: `${String(report.defaults.summary.actionableProfiles)}/${String(report.summary.profileCount)} actionable`
4582
+ };
4583
+ };
4509
4584
  var resolveVoiceRealCallProfileProviderRoute = (options) => {
4510
4585
  const defaults = readRealCallProfileDefaultsReport(options.defaults);
4511
4586
  const profile = defaults.profiles.find((item) => item.profileId === options.profileId) ?? defaults.profiles.find((item) => item.status === "pass") ?? defaults.profiles[0];
package/dist/index.d.ts CHANGED
@@ -30,12 +30,12 @@ export { assertVoicePlatformCoverage, buildVoicePlatformCoverageSummary, createV
30
30
  export { assertVoiceCompetitiveCoverage, buildVoiceCompetitiveCoverageReport, createVoiceCompetitiveCoverageRoutes, evaluateVoiceCompetitiveCoverage, renderVoiceCompetitiveCoverageHTML, renderVoiceCompetitiveCoverageMarkdown } from './competitiveCoverage';
31
31
  export type { VoiceCompetitiveCoverageAssertionInput, VoiceCompetitiveCoverageAssertionReport, VoiceCompetitiveCoverageIssue, VoiceCompetitiveCoverageLevel, VoiceCompetitiveCoverageReport, VoiceCompetitiveCoverageReportInput, VoiceCompetitiveCoverageRoutesOptions, VoiceCompetitiveCoverageStatus, VoiceCompetitiveCoverageSummary, VoiceCompetitiveDepthLevel, VoiceCompetitiveEvidence, VoiceCompetitiveSurface } from './competitiveCoverage';
32
32
  export type { VoicePlatformCoverageAssertionInput, VoicePlatformCoverageAssertionReport, VoicePlatformCoverageEvidence, VoicePlatformCoverageRoutesOptions, VoicePlatformCoverageStatus, VoicePlatformCoverageSummary, VoicePlatformCoverageSummaryInput, VoicePlatformCoverageSurface } from './platformCoverage';
33
- export { assertVoiceProofTrendEvidence, buildEmptyVoiceProofTrendReport, buildVoiceProofTrendProfileSummaries, buildVoiceProofTrendRecommendationReport, buildVoiceProofTrendReportFromRealCallProfiles, buildVoiceProofTrendReport, buildVoiceRealCallProfileEvidenceFromTraceEvents, buildVoiceRealCallProfileDefaults, buildVoiceRealCallProfileHistoryReport, createVoiceProofTrendRecommendationRoutes, createVoiceProofTrendRoutes, createVoiceRealCallProfileHistoryRoutes, DEFAULT_VOICE_PROOF_TREND_PROFILE_DEFINITIONS, DEFAULT_VOICE_PROOF_TRENDS_MAX_AGE_MS, evaluateVoiceProofTrendEvidence, formatVoiceProofTrendAge, loadVoiceRealCallProfileEvidenceFromTraceStore, normalizeVoiceProofTrendReport, readVoiceProofTrendReportFile, renderVoiceProofTrendRecommendationHTML, renderVoiceProofTrendRecommendationMarkdown, renderVoiceRealCallProfileHistoryHTML, renderVoiceRealCallProfileHistoryMarkdown, resolveVoiceRealCallProfileProviderRoute } from './proofTrends';
33
+ export { assertVoiceProofTrendEvidence, buildEmptyVoiceProofTrendReport, buildVoiceProofTrendProfileSummaries, buildVoiceProofTrendRecommendationReport, buildVoiceProofTrendReportFromRealCallProfiles, buildVoiceProofTrendReport, buildVoiceRealCallProfileEvidenceFromTraceEvents, buildVoiceRealCallProfileDefaults, buildVoiceRealCallProfileHistoryReport, buildVoiceRealCallProfileReadinessCheck, createVoiceProofTrendRecommendationRoutes, createVoiceProofTrendRoutes, createVoiceRealCallProfileHistoryRoutes, DEFAULT_VOICE_PROOF_TREND_PROFILE_DEFINITIONS, DEFAULT_VOICE_PROOF_TRENDS_MAX_AGE_MS, evaluateVoiceProofTrendEvidence, formatVoiceProofTrendAge, loadVoiceRealCallProfileEvidenceFromTraceStore, normalizeVoiceProofTrendReport, readVoiceProofTrendReportFile, renderVoiceProofTrendRecommendationHTML, renderVoiceProofTrendRecommendationMarkdown, renderVoiceRealCallProfileHistoryHTML, renderVoiceRealCallProfileHistoryMarkdown, resolveVoiceRealCallProfileProviderRoute } from './proofTrends';
34
34
  export { applyVoiceProfileSwitchGuard, buildVoiceProfileSwitchReadinessReport, buildVoiceProfileSwitchLiveDecisionReport, createVoiceProfileSwitchLiveDecisionRoutes, createVoiceProfileSwitchPolicyProofRoutes, createVoiceProfileSwitchReadinessRoutes, recommendVoiceProfileSwitch, renderVoiceProfileSwitchLiveDecisionHTML, renderVoiceProfileSwitchPolicyProofHTML, renderVoiceProfileSwitchReadinessHTML, runVoiceProfileSwitchPolicyProof } from './profileSwitchRecommendation';
35
35
  export type { VoiceProfileSwitchGuardAction, VoiceProfileSwitchGuardDecision, VoiceProfileSwitchGuardMode, VoiceProfileSwitchGuardOptions, VoiceProfileSwitchObservedSignals, VoiceProfileSwitchLiveDecisionEvidence, VoiceProfileSwitchLiveDecisionReport, VoiceProfileSwitchLiveDecisionReportOptions, VoiceProfileSwitchLiveDecisionRoutesOptions, VoiceProfileSwitchLiveDecisionSession, VoiceProfileSwitchPolicyProofCase, VoiceProfileSwitchPolicyProofCaseResult, VoiceProfileSwitchPolicyProofOptions, VoiceProfileSwitchPolicyProofReport, VoiceProfileSwitchPolicyProofRoutesOptions, VoiceProfileSwitchReadinessIssue, VoiceProfileSwitchReadinessOptions, VoiceProfileSwitchReadinessReport, VoiceProfileSwitchReadinessRoutesOptions, VoiceProfileSwitchReadinessStatus, VoiceProfileSwitchRecommendation, VoiceProfileSwitchRecommendationOptions } from './profileSwitchRecommendation';
36
36
  export { buildVoiceProviderDecisionTraceReport, createVoiceProviderDecisionTraceEvent, createVoiceProviderDecisionTraceRoutes, listVoiceProviderDecisionTraces, renderVoiceProviderDecisionTraceHTML, renderVoiceProviderDecisionTraceMarkdown } from './providerDecisionTraces';
37
37
  export type { VoiceProviderDecisionStatus, VoiceProviderDecisionSurfaceReport, VoiceProviderDecisionTrace, VoiceProviderDecisionTraceInput, VoiceProviderDecisionTraceIssue, VoiceProviderDecisionTraceReport, VoiceProviderDecisionTraceReportOptions, VoiceProviderDecisionTraceRoutesOptions } from './providerDecisionTraces';
38
- export type { VoiceProofTrendAssertionInput, VoiceProofTrendAssertionReport, VoiceProofTrendCycle, VoiceProofTrendProfileDefinition, VoiceProofTrendProfileRecommendation, VoiceProofTrendProfileSummaryOptions, VoiceProofTrendProfileSummary, VoiceProofTrendProviderRecommendation, VoiceProofTrendProviderSummary, VoiceProofTrendRecommendation, VoiceProofTrendRecommendationOptions, VoiceProofTrendRecommendationReport, VoiceProofTrendRecommendationRoutesOptions, VoiceProofTrendRecommendationStatus, VoiceProofTrendRecommendationSurface, VoiceProofTrendRealCallProfileEvidence, VoiceProofTrendRealCallProfileReportOptions, VoiceProofTrendReport, VoiceProofTrendReportInput, VoiceProofTrendRoutesOptions, VoiceProofTrendRuntimeChannelSummary, VoiceProofTrendStatus, VoiceProofTrendSummary, VoiceRealCallProfileDefault, VoiceRealCallProfileDefaultsOptions, VoiceRealCallProfileDefaultsReport, VoiceRealCallProfileHistoryOptions, VoiceRealCallProfileHistoryReport, VoiceRealCallProfileHistoryRoutesOptions, VoiceRealCallProfileProviderRouteOptions, VoiceRealCallProfileTraceEvidenceOptions, VoiceRealCallProfileTraceStoreEvidenceOptions } from './proofTrends';
38
+ export type { VoiceProofTrendAssertionInput, VoiceProofTrendAssertionReport, VoiceProofTrendCycle, VoiceProofTrendProfileDefinition, VoiceProofTrendProfileRecommendation, VoiceProofTrendProfileSummaryOptions, VoiceProofTrendProfileSummary, VoiceProofTrendProviderRecommendation, VoiceProofTrendProviderSummary, VoiceProofTrendRecommendation, VoiceProofTrendRecommendationOptions, VoiceProofTrendRecommendationReport, VoiceProofTrendRecommendationRoutesOptions, VoiceProofTrendRecommendationStatus, VoiceProofTrendRecommendationSurface, VoiceProofTrendRealCallProfileEvidence, VoiceProofTrendRealCallProfileReportOptions, VoiceProofTrendReport, VoiceProofTrendReportInput, VoiceProofTrendRoutesOptions, VoiceProofTrendRuntimeChannelSummary, VoiceProofTrendStatus, VoiceProofTrendSummary, VoiceRealCallProfileDefault, VoiceRealCallProfileDefaultsOptions, VoiceRealCallProfileDefaultsReport, VoiceRealCallProfileHistoryOptions, VoiceRealCallProfileHistoryReport, VoiceRealCallProfileHistoryRoutesOptions, VoiceRealCallProfileProviderRouteOptions, VoiceRealCallProfileReadinessCheckOptions, VoiceRealCallProfileTraceEvidenceOptions, VoiceRealCallProfileTraceStoreEvidenceOptions } from './proofTrends';
39
39
  export { assertVoiceSloCalibration, buildVoiceSloCalibrationReport, buildVoiceSloReadinessThresholdReport, createVoiceSloReadinessThresholdOptions, createVoiceSloReadinessThresholdRoutes, createVoiceSloThresholdProfile, createVoiceSloCalibrationRoutes, renderVoiceSloCalibrationMarkdown, renderVoiceSloReadinessThresholdHTML, renderVoiceSloReadinessThresholdMarkdown } from './sloCalibration';
40
40
  export type { VoiceSloCalibrationMetricKey, VoiceSloCalibrationOptions, VoiceSloCalibrationReport, VoiceSloCalibrationRoutesOptions, VoiceSloCalibrationSample, VoiceSloCalibrationStatus, VoiceSloCalibrationThreshold, VoiceSloCalibrationThresholds, VoiceSloReadinessThresholdReport, VoiceSloReadinessThresholdReportOptions, VoiceSloReadinessThresholdOptions, VoiceSloReadinessThresholdRoutesOptions, VoiceSloThresholdProfile } from './sloCalibration';
41
41
  export { assertVoiceLiveOpsControlEvidence, assertVoiceLiveOpsEvidence, buildVoiceLiveOpsControlState, createVoiceLiveOpsController, createVoiceLiveOpsRoutes, createVoiceMemoryLiveOpsControlStore, evaluateVoiceLiveOpsControlEvidence, evaluateVoiceLiveOpsEvidence, getVoiceLiveOpsControlStatus, VOICE_LIVE_OPS_ACTIONS } from './liveOps';
package/dist/index.js CHANGED
@@ -15975,6 +15975,81 @@ var expandProviderRouteCandidates = (provider, role, aliases = {}) => {
15975
15975
  ];
15976
15976
  };
15977
15977
  var readRealCallProfileDefaultsReport = (input) => ("defaults" in input) ? input.defaults : input;
15978
+ var buildRealCallProfileReadinessIssues = (report, options) => {
15979
+ const minProfiles = options.minProfiles ?? 1;
15980
+ const minActionableProfiles = options.minActionableProfiles ?? 1;
15981
+ const minCycles = options.minCycles ?? 1;
15982
+ const requiredProviderRoles = options.requiredProviderRoles ?? [];
15983
+ const defaultsByProfile = new Map(report.defaults.profiles.map((profile) => [profile.profileId, profile]));
15984
+ const issues = [];
15985
+ const warnings = [];
15986
+ if (report.status === "fail" || report.ok !== true) {
15987
+ issues.push(`Real-call profile history is ${report.status}.`);
15988
+ }
15989
+ if ((report.summary.profileCount ?? 0) < minProfiles) {
15990
+ issues.push(`Expected at least ${String(minProfiles)} real-call profile(s), found ${String(report.summary.profileCount ?? 0)}.`);
15991
+ }
15992
+ if (report.defaults.summary.actionableProfiles < minActionableProfiles) {
15993
+ issues.push(`Expected at least ${String(minActionableProfiles)} actionable profile default(s), found ${String(report.defaults.summary.actionableProfiles)}.`);
15994
+ }
15995
+ if ((report.summary.cycles ?? 0) < minCycles) {
15996
+ issues.push(`Expected at least ${String(minCycles)} real-call cycle(s), found ${String(report.summary.cycles ?? 0)}.`);
15997
+ }
15998
+ const ageMs = report.trend.ageMs ?? (report.generatedAt ? Date.now() - new Date(report.generatedAt).getTime() : undefined);
15999
+ if (options.maxAgeMs !== undefined && (ageMs === undefined || ageMs > options.maxAgeMs)) {
16000
+ issues.push(`Expected real-call profile history age <= ${String(options.maxAgeMs)}ms, found ${String(ageMs ?? "missing")}ms.`);
16001
+ }
16002
+ for (const profileId of options.requiredProfileIds ?? []) {
16003
+ const profile = defaultsByProfile.get(profileId);
16004
+ if (!profile) {
16005
+ issues.push(`Missing required real-call profile: ${profileId}.`);
16006
+ continue;
16007
+ }
16008
+ if (profile.status === "fail") {
16009
+ issues.push(`Required real-call profile ${profileId} is failing.`);
16010
+ } else if (profile.status === "warn") {
16011
+ warnings.push(`Required real-call profile ${profileId} is warning.`);
16012
+ }
16013
+ for (const role of requiredProviderRoles) {
16014
+ if (!profile.providerRoutes[role]) {
16015
+ warnings.push(`Required real-call profile ${profileId} is missing ${role} provider default evidence.`);
16016
+ }
16017
+ }
16018
+ }
16019
+ if (report.recommendations.profiles.some((item) => item.status === "fail")) {
16020
+ issues.push("At least one real-call profile recommendation is failing.");
16021
+ }
16022
+ if (report.recommendations.profiles.some((item) => item.status === "warn")) {
16023
+ warnings.push("At least one real-call profile recommendation is warning.");
16024
+ }
16025
+ return { issues, warnings };
16026
+ };
16027
+ var buildVoiceRealCallProfileReadinessCheck = (report, options = {}) => {
16028
+ const { issues, warnings } = buildRealCallProfileReadinessIssues(report, options);
16029
+ const status = issues.length > 0 ? "fail" : warnings.length > 0 && options.failOnWarnings === true ? "fail" : warnings.length > 0 ? "warn" : "pass";
16030
+ const detail = status === "pass" ? `${String(report.summary.profileCount)} profile(s), ${String(report.summary.cycles ?? 0)} cycle(s), ${String(report.defaults.summary.actionableProfiles)} actionable default(s).` : [...issues, ...warnings].join(" ");
16031
+ return {
16032
+ detail,
16033
+ gateExplanation: {
16034
+ evidenceHref: options.href ?? "/api/voice/real-call-profile-history",
16035
+ observed: report.defaults.summary.actionableProfiles,
16036
+ remediation: "Run fresh browser or phone calls for required profiles so provider/runtime recommendations have measured profile evidence.",
16037
+ sourceHref: options.sourceHref ?? "/voice/real-call-profile-history",
16038
+ threshold: options.minActionableProfiles ?? 1,
16039
+ thresholdLabel: "Minimum actionable real-call profiles",
16040
+ unit: "count"
16041
+ },
16042
+ href: options.href ?? "/voice/real-call-profile-history",
16043
+ label: options.label ?? "Real-call profile history",
16044
+ proofSource: {
16045
+ href: options.sourceHref ?? "/api/voice/real-call-profile-history",
16046
+ source: report.source,
16047
+ sourceLabel: "Real-call profile history"
16048
+ },
16049
+ status,
16050
+ value: `${String(report.defaults.summary.actionableProfiles)}/${String(report.summary.profileCount)} actionable`
16051
+ };
16052
+ };
15978
16053
  var resolveVoiceRealCallProfileProviderRoute = (options) => {
15979
16054
  const defaults = readRealCallProfileDefaultsReport(options.defaults);
15980
16055
  const profile = defaults.profiles.find((item) => item.profileId === options.profileId) ?? defaults.profiles.find((item) => item.status === "pass") ?? defaults.profiles[0];
@@ -38832,6 +38907,7 @@ export {
38832
38907
  buildVoiceRealtimeProviderContractMatrix,
38833
38908
  buildVoiceRealtimeChannelRuntimeSamplesFromTrace,
38834
38909
  buildVoiceRealtimeChannelReport,
38910
+ buildVoiceRealCallProfileReadinessCheck,
38835
38911
  buildVoiceRealCallProfileHistoryReport,
38836
38912
  buildVoiceRealCallProfileEvidenceFromTraceEvents,
38837
38913
  buildVoiceRealCallProfileDefaults,
@@ -1,4 +1,5 @@
1
1
  import { Elysia } from 'elysia';
2
+ import type { VoiceProductionReadinessCheck } from './productionReadiness';
2
3
  import type { StoredVoiceTraceEvent, VoiceTraceEventStore } from './trace';
3
4
  export type VoiceProofTrendStatus = 'empty' | 'fail' | 'pass' | 'stale';
4
5
  export type VoiceProofTrendSummary = {
@@ -355,6 +356,18 @@ export type VoiceRealCallProfileHistoryRoutesOptions = Omit<VoiceRealCallProfile
355
356
  source?: (() => Promise<VoiceRealCallProfileHistoryOptions> | VoiceRealCallProfileHistoryOptions) | VoiceRealCallProfileHistoryOptions;
356
357
  title?: string;
357
358
  };
359
+ export type VoiceRealCallProfileReadinessCheckOptions = {
360
+ failOnWarnings?: boolean;
361
+ href?: string;
362
+ label?: string;
363
+ maxAgeMs?: number;
364
+ minActionableProfiles?: number;
365
+ minCycles?: number;
366
+ minProfiles?: number;
367
+ requiredProfileIds?: readonly string[];
368
+ requiredProviderRoles?: readonly string[];
369
+ sourceHref?: string;
370
+ };
358
371
  export declare const DEFAULT_VOICE_PROOF_TRENDS_MAX_AGE_MS: number;
359
372
  export declare const DEFAULT_VOICE_PROOF_TREND_PROFILE_DEFINITIONS: ({
360
373
  description: string;
@@ -388,6 +401,7 @@ export declare const loadVoiceRealCallProfileEvidenceFromTraceStore: (options: V
388
401
  export declare const buildVoiceProofTrendProfileSummaries: (input: VoiceProofTrendReport | readonly VoiceProofTrendReport[], options?: VoiceProofTrendProfileSummaryOptions) => VoiceProofTrendProfileSummary[];
389
402
  export declare const buildVoiceProofTrendReportFromRealCallProfiles: (options: VoiceProofTrendRealCallProfileReportOptions) => VoiceProofTrendReport;
390
403
  export declare const buildVoiceRealCallProfileDefaults: (input: VoiceRealCallProfileHistoryReport | VoiceProofTrendReport, options?: VoiceRealCallProfileDefaultsOptions) => VoiceRealCallProfileDefaultsReport;
404
+ export declare const buildVoiceRealCallProfileReadinessCheck: (report: VoiceRealCallProfileHistoryReport, options?: VoiceRealCallProfileReadinessCheckOptions) => VoiceProductionReadinessCheck;
391
405
  export declare const resolveVoiceRealCallProfileProviderRoute: <TProvider extends string = string>(options: VoiceRealCallProfileProviderRouteOptions<TProvider>) => TProvider | undefined;
392
406
  export declare const buildVoiceRealCallProfileHistoryReport: (options?: VoiceRealCallProfileHistoryOptions) => VoiceRealCallProfileHistoryReport;
393
407
  export declare const evaluateVoiceProofTrendEvidence: (report: VoiceProofTrendReport, input?: VoiceProofTrendAssertionInput) => VoiceProofTrendAssertionReport;
@@ -2093,6 +2093,81 @@ var expandProviderRouteCandidates = (provider, role, aliases = {}) => {
2093
2093
  ];
2094
2094
  };
2095
2095
  var readRealCallProfileDefaultsReport = (input) => ("defaults" in input) ? input.defaults : input;
2096
+ var buildRealCallProfileReadinessIssues = (report, options) => {
2097
+ const minProfiles = options.minProfiles ?? 1;
2098
+ const minActionableProfiles = options.minActionableProfiles ?? 1;
2099
+ const minCycles = options.minCycles ?? 1;
2100
+ const requiredProviderRoles = options.requiredProviderRoles ?? [];
2101
+ const defaultsByProfile = new Map(report.defaults.profiles.map((profile) => [profile.profileId, profile]));
2102
+ const issues = [];
2103
+ const warnings = [];
2104
+ if (report.status === "fail" || report.ok !== true) {
2105
+ issues.push(`Real-call profile history is ${report.status}.`);
2106
+ }
2107
+ if ((report.summary.profileCount ?? 0) < minProfiles) {
2108
+ issues.push(`Expected at least ${String(minProfiles)} real-call profile(s), found ${String(report.summary.profileCount ?? 0)}.`);
2109
+ }
2110
+ if (report.defaults.summary.actionableProfiles < minActionableProfiles) {
2111
+ issues.push(`Expected at least ${String(minActionableProfiles)} actionable profile default(s), found ${String(report.defaults.summary.actionableProfiles)}.`);
2112
+ }
2113
+ if ((report.summary.cycles ?? 0) < minCycles) {
2114
+ issues.push(`Expected at least ${String(minCycles)} real-call cycle(s), found ${String(report.summary.cycles ?? 0)}.`);
2115
+ }
2116
+ const ageMs = report.trend.ageMs ?? (report.generatedAt ? Date.now() - new Date(report.generatedAt).getTime() : undefined);
2117
+ if (options.maxAgeMs !== undefined && (ageMs === undefined || ageMs > options.maxAgeMs)) {
2118
+ issues.push(`Expected real-call profile history age <= ${String(options.maxAgeMs)}ms, found ${String(ageMs ?? "missing")}ms.`);
2119
+ }
2120
+ for (const profileId of options.requiredProfileIds ?? []) {
2121
+ const profile = defaultsByProfile.get(profileId);
2122
+ if (!profile) {
2123
+ issues.push(`Missing required real-call profile: ${profileId}.`);
2124
+ continue;
2125
+ }
2126
+ if (profile.status === "fail") {
2127
+ issues.push(`Required real-call profile ${profileId} is failing.`);
2128
+ } else if (profile.status === "warn") {
2129
+ warnings.push(`Required real-call profile ${profileId} is warning.`);
2130
+ }
2131
+ for (const role of requiredProviderRoles) {
2132
+ if (!profile.providerRoutes[role]) {
2133
+ warnings.push(`Required real-call profile ${profileId} is missing ${role} provider default evidence.`);
2134
+ }
2135
+ }
2136
+ }
2137
+ if (report.recommendations.profiles.some((item) => item.status === "fail")) {
2138
+ issues.push("At least one real-call profile recommendation is failing.");
2139
+ }
2140
+ if (report.recommendations.profiles.some((item) => item.status === "warn")) {
2141
+ warnings.push("At least one real-call profile recommendation is warning.");
2142
+ }
2143
+ return { issues, warnings };
2144
+ };
2145
+ var buildVoiceRealCallProfileReadinessCheck = (report, options = {}) => {
2146
+ const { issues, warnings } = buildRealCallProfileReadinessIssues(report, options);
2147
+ const status = issues.length > 0 ? "fail" : warnings.length > 0 && options.failOnWarnings === true ? "fail" : warnings.length > 0 ? "warn" : "pass";
2148
+ const detail = status === "pass" ? `${String(report.summary.profileCount)} profile(s), ${String(report.summary.cycles ?? 0)} cycle(s), ${String(report.defaults.summary.actionableProfiles)} actionable default(s).` : [...issues, ...warnings].join(" ");
2149
+ return {
2150
+ detail,
2151
+ gateExplanation: {
2152
+ evidenceHref: options.href ?? "/api/voice/real-call-profile-history",
2153
+ observed: report.defaults.summary.actionableProfiles,
2154
+ remediation: "Run fresh browser or phone calls for required profiles so provider/runtime recommendations have measured profile evidence.",
2155
+ sourceHref: options.sourceHref ?? "/voice/real-call-profile-history",
2156
+ threshold: options.minActionableProfiles ?? 1,
2157
+ thresholdLabel: "Minimum actionable real-call profiles",
2158
+ unit: "count"
2159
+ },
2160
+ href: options.href ?? "/voice/real-call-profile-history",
2161
+ label: options.label ?? "Real-call profile history",
2162
+ proofSource: {
2163
+ href: options.sourceHref ?? "/api/voice/real-call-profile-history",
2164
+ source: report.source,
2165
+ sourceLabel: "Real-call profile history"
2166
+ },
2167
+ status,
2168
+ value: `${String(report.defaults.summary.actionableProfiles)}/${String(report.summary.profileCount)} actionable`
2169
+ };
2170
+ };
2096
2171
  var resolveVoiceRealCallProfileProviderRoute = (options) => {
2097
2172
  const defaults = readRealCallProfileDefaultsReport(options.defaults);
2098
2173
  const profile = defaults.profiles.find((item) => item.profileId === options.profileId) ?? defaults.profiles.find((item) => item.status === "pass") ?? defaults.profiles[0];
package/dist/vue/index.js CHANGED
@@ -2014,6 +2014,81 @@ var expandProviderRouteCandidates = (provider, role, aliases = {}) => {
2014
2014
  ];
2015
2015
  };
2016
2016
  var readRealCallProfileDefaultsReport = (input) => ("defaults" in input) ? input.defaults : input;
2017
+ var buildRealCallProfileReadinessIssues = (report, options) => {
2018
+ const minProfiles = options.minProfiles ?? 1;
2019
+ const minActionableProfiles = options.minActionableProfiles ?? 1;
2020
+ const minCycles = options.minCycles ?? 1;
2021
+ const requiredProviderRoles = options.requiredProviderRoles ?? [];
2022
+ const defaultsByProfile = new Map(report.defaults.profiles.map((profile) => [profile.profileId, profile]));
2023
+ const issues = [];
2024
+ const warnings = [];
2025
+ if (report.status === "fail" || report.ok !== true) {
2026
+ issues.push(`Real-call profile history is ${report.status}.`);
2027
+ }
2028
+ if ((report.summary.profileCount ?? 0) < minProfiles) {
2029
+ issues.push(`Expected at least ${String(minProfiles)} real-call profile(s), found ${String(report.summary.profileCount ?? 0)}.`);
2030
+ }
2031
+ if (report.defaults.summary.actionableProfiles < minActionableProfiles) {
2032
+ issues.push(`Expected at least ${String(minActionableProfiles)} actionable profile default(s), found ${String(report.defaults.summary.actionableProfiles)}.`);
2033
+ }
2034
+ if ((report.summary.cycles ?? 0) < minCycles) {
2035
+ issues.push(`Expected at least ${String(minCycles)} real-call cycle(s), found ${String(report.summary.cycles ?? 0)}.`);
2036
+ }
2037
+ const ageMs = report.trend.ageMs ?? (report.generatedAt ? Date.now() - new Date(report.generatedAt).getTime() : undefined);
2038
+ if (options.maxAgeMs !== undefined && (ageMs === undefined || ageMs > options.maxAgeMs)) {
2039
+ issues.push(`Expected real-call profile history age <= ${String(options.maxAgeMs)}ms, found ${String(ageMs ?? "missing")}ms.`);
2040
+ }
2041
+ for (const profileId of options.requiredProfileIds ?? []) {
2042
+ const profile = defaultsByProfile.get(profileId);
2043
+ if (!profile) {
2044
+ issues.push(`Missing required real-call profile: ${profileId}.`);
2045
+ continue;
2046
+ }
2047
+ if (profile.status === "fail") {
2048
+ issues.push(`Required real-call profile ${profileId} is failing.`);
2049
+ } else if (profile.status === "warn") {
2050
+ warnings.push(`Required real-call profile ${profileId} is warning.`);
2051
+ }
2052
+ for (const role of requiredProviderRoles) {
2053
+ if (!profile.providerRoutes[role]) {
2054
+ warnings.push(`Required real-call profile ${profileId} is missing ${role} provider default evidence.`);
2055
+ }
2056
+ }
2057
+ }
2058
+ if (report.recommendations.profiles.some((item) => item.status === "fail")) {
2059
+ issues.push("At least one real-call profile recommendation is failing.");
2060
+ }
2061
+ if (report.recommendations.profiles.some((item) => item.status === "warn")) {
2062
+ warnings.push("At least one real-call profile recommendation is warning.");
2063
+ }
2064
+ return { issues, warnings };
2065
+ };
2066
+ var buildVoiceRealCallProfileReadinessCheck = (report, options = {}) => {
2067
+ const { issues, warnings } = buildRealCallProfileReadinessIssues(report, options);
2068
+ const status = issues.length > 0 ? "fail" : warnings.length > 0 && options.failOnWarnings === true ? "fail" : warnings.length > 0 ? "warn" : "pass";
2069
+ const detail = status === "pass" ? `${String(report.summary.profileCount)} profile(s), ${String(report.summary.cycles ?? 0)} cycle(s), ${String(report.defaults.summary.actionableProfiles)} actionable default(s).` : [...issues, ...warnings].join(" ");
2070
+ return {
2071
+ detail,
2072
+ gateExplanation: {
2073
+ evidenceHref: options.href ?? "/api/voice/real-call-profile-history",
2074
+ observed: report.defaults.summary.actionableProfiles,
2075
+ remediation: "Run fresh browser or phone calls for required profiles so provider/runtime recommendations have measured profile evidence.",
2076
+ sourceHref: options.sourceHref ?? "/voice/real-call-profile-history",
2077
+ threshold: options.minActionableProfiles ?? 1,
2078
+ thresholdLabel: "Minimum actionable real-call profiles",
2079
+ unit: "count"
2080
+ },
2081
+ href: options.href ?? "/voice/real-call-profile-history",
2082
+ label: options.label ?? "Real-call profile history",
2083
+ proofSource: {
2084
+ href: options.sourceHref ?? "/api/voice/real-call-profile-history",
2085
+ source: report.source,
2086
+ sourceLabel: "Real-call profile history"
2087
+ },
2088
+ status,
2089
+ value: `${String(report.defaults.summary.actionableProfiles)}/${String(report.summary.profileCount)} actionable`
2090
+ };
2091
+ };
2017
2092
  var resolveVoiceRealCallProfileProviderRoute = (options) => {
2018
2093
  const defaults = readRealCallProfileDefaultsReport(options.defaults);
2019
2094
  const profile = defaults.profiles.find((item) => item.profileId === options.profileId) ?? defaults.profiles.find((item) => item.status === "pass") ?? defaults.profiles[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.369",
3
+ "version": "0.0.22-beta.370",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",