@absolutejs/voice 0.0.22-beta.396 → 0.0.22-beta.397
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/index.d.ts +2 -0
- package/dist/index.js +84 -14
- package/dist/sessionSnapshot.d.ts +44 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -32,7 +32,9 @@ export type { VoiceCompetitiveCoverageAssertionInput, VoiceCompetitiveCoverageAs
|
|
|
32
32
|
export type { VoicePlatformCoverageAssertionInput, VoicePlatformCoverageAssertionReport, VoicePlatformCoverageEvidence, VoicePlatformCoverageRoutesOptions, VoicePlatformCoverageStatus, VoicePlatformCoverageSummary, VoicePlatformCoverageSummaryInput, VoicePlatformCoverageSurface } from './platformCoverage';
|
|
33
33
|
export { assertVoiceProofTrendEvidence, appendVoiceRealCallProfileRecoveryEvidence, buildEmptyVoiceProofTrendReport, buildVoiceProofTrendProfileSummaries, buildVoiceProofTrendRecommendationReport, buildVoiceProofTrendReportFromRealCallProfiles, buildVoiceProofTrendReport, buildVoiceRealCallProfileEvidenceFromTraceEvents, buildVoiceRealCallProfileDefaults, buildVoiceRealCallProfileHistoryReport, buildVoiceRealCallProfileReadinessCheck, buildVoiceRealCallProfileRecoveryJobHistoryCheck, buildVoiceRealCallProfileRecoveryActions, createVoiceInMemoryRealCallProfileRecoveryJobStore, createVoiceRealCallProfileTraceCollector, createVoiceSQLiteRealCallProfileRecoveryJobStore, createVoiceProofTrendRecommendationRoutes, createVoiceProofTrendRoutes, createVoiceRealCallProfileHistoryRoutes, createVoiceRealCallProfileRecoveryActionRoutes, DEFAULT_VOICE_PROOF_TREND_PROFILE_DEFINITIONS, DEFAULT_VOICE_PROOF_TRENDS_MAX_AGE_MS, evaluateVoiceProofTrendEvidence, formatVoiceProofTrendAge, loadVoiceRealCallProfileEvidenceFromTraceStore, normalizeVoiceProofTrendReport, readVoiceProofTrendReportFile, renderVoiceProofTrendRecommendationHTML, renderVoiceProofTrendRecommendationMarkdown, renderVoiceRealCallProfileHistoryHTML, renderVoiceRealCallProfileHistoryMarkdown, runVoiceRealCallProfileRecoveryLoop, resolveVoiceRealCallProfileProviderRoute } from './proofTrends';
|
|
34
34
|
export { createVoiceEvidenceAssertion, createVoiceProofAssertion, summarizeVoiceProofAssertions } from './proofAssertions';
|
|
35
|
+
export { buildVoiceSessionSnapshot, buildVoiceSessionSnapshotStatus, parseVoiceSessionSnapshot } from './sessionSnapshot';
|
|
35
36
|
export type { VoiceEvidenceAssertionInput, VoiceProofAssertionInput, VoiceProofAssertionResult, VoiceProofAssertionSummary } from './proofAssertions';
|
|
37
|
+
export type { VoiceSessionSnapshot, VoiceSessionSnapshotInput, VoiceSessionSnapshotQualityEvidence, VoiceSessionSnapshotStatus } from './sessionSnapshot';
|
|
36
38
|
export { fetchVoiceProofTarget, getVoiceProofTargetLogicalFailure, mapVoiceProofTargetsWithConcurrency, runVoiceCommandProofTarget, runVoiceCommandProofTargets, runVoiceProofTargets } from './proofRunner';
|
|
37
39
|
export type { VoiceCommandProofExecutionResult, VoiceCommandProofTarget, VoiceCommandProofTargetResult, VoiceCommandProofTargetRunnerOptions, VoiceCommandProofTargetRunOptions, VoiceProofTarget, VoiceProofTargetMethod, VoiceProofTargetResult, VoiceProofTargetRunnerOptions, VoiceProofTargetRunOptions } from './proofRunner';
|
|
38
40
|
export { applyVoiceProfileSwitchGuard, buildVoiceProfileSwitchReadinessReport, buildVoiceProfileSwitchLiveDecisionReport, createVoiceProfileSwitchLiveDecisionRoutes, createVoiceProfileSwitchPolicyProofRoutes, createVoiceProfileSwitchReadinessRoutes, recommendVoiceProfileSwitch, renderVoiceProfileSwitchLiveDecisionHTML, renderVoiceProfileSwitchPolicyProofHTML, renderVoiceProfileSwitchReadinessHTML, runVoiceProfileSwitchPolicyProof } from './profileSwitchRecommendation';
|
package/dist/index.js
CHANGED
|
@@ -18385,6 +18385,73 @@ var summarizeVoiceProofAssertions = (assertions) => {
|
|
|
18385
18385
|
total: assertions.length
|
|
18386
18386
|
};
|
|
18387
18387
|
};
|
|
18388
|
+
// src/sessionSnapshot.ts
|
|
18389
|
+
var statusRank4 = (status) => {
|
|
18390
|
+
if (status === "fail") {
|
|
18391
|
+
return 2;
|
|
18392
|
+
}
|
|
18393
|
+
if (status === "warn") {
|
|
18394
|
+
return 1;
|
|
18395
|
+
}
|
|
18396
|
+
return 0;
|
|
18397
|
+
};
|
|
18398
|
+
var maxStatus = (statuses) => statuses.reduce((current, status) => statusRank4(status) > statusRank4(current) ? status : current, "pass");
|
|
18399
|
+
var buildVoiceSessionSnapshotStatus = (input) => {
|
|
18400
|
+
const statuses = [];
|
|
18401
|
+
for (const media of input.media ?? []) {
|
|
18402
|
+
statuses.push(media.report.status);
|
|
18403
|
+
}
|
|
18404
|
+
for (const quality of input.quality ?? []) {
|
|
18405
|
+
if (quality.status !== undefined) {
|
|
18406
|
+
statuses.push(quality.status);
|
|
18407
|
+
}
|
|
18408
|
+
}
|
|
18409
|
+
for (const outcome of input.telephonyOutcomes ?? []) {
|
|
18410
|
+
if (outcome.campaignOutcome.status === "failed") {
|
|
18411
|
+
statuses.push("fail");
|
|
18412
|
+
} else if (outcome.duplicate === true || !outcome.campaignOutcome.applied) {
|
|
18413
|
+
statuses.push("warn");
|
|
18414
|
+
}
|
|
18415
|
+
}
|
|
18416
|
+
if (input.proofSummary?.ok === false) {
|
|
18417
|
+
statuses.push("fail");
|
|
18418
|
+
}
|
|
18419
|
+
return maxStatus(statuses);
|
|
18420
|
+
};
|
|
18421
|
+
var buildVoiceSessionSnapshot = (input) => {
|
|
18422
|
+
const proofAssertions = [...input.proofAssertions ?? []];
|
|
18423
|
+
const proofSummary = summarizeVoiceProofAssertions(proofAssertions);
|
|
18424
|
+
const media = [...input.media ?? []];
|
|
18425
|
+
const providerRoutingEvents = [...input.providerRoutingEvents ?? []];
|
|
18426
|
+
const quality = [...input.quality ?? []];
|
|
18427
|
+
const telephonyOutcomes = [...input.telephonyOutcomes ?? []];
|
|
18428
|
+
return {
|
|
18429
|
+
capturedAt: Date.now(),
|
|
18430
|
+
media,
|
|
18431
|
+
name: input.name,
|
|
18432
|
+
proofAssertions,
|
|
18433
|
+
proofSummary,
|
|
18434
|
+
providerRoutingEvents,
|
|
18435
|
+
quality,
|
|
18436
|
+
scenarioId: input.scenarioId,
|
|
18437
|
+
schema: "absolute.voice.session.snapshot.v1",
|
|
18438
|
+
sessionId: input.sessionId,
|
|
18439
|
+
status: buildVoiceSessionSnapshotStatus({
|
|
18440
|
+
media,
|
|
18441
|
+
proofSummary,
|
|
18442
|
+
quality,
|
|
18443
|
+
telephonyOutcomes
|
|
18444
|
+
}),
|
|
18445
|
+
telephonyOutcomes,
|
|
18446
|
+
turnId: input.turnId
|
|
18447
|
+
};
|
|
18448
|
+
};
|
|
18449
|
+
var parseVoiceSessionSnapshot = (snapshot) => {
|
|
18450
|
+
if (snapshot.schema !== "absolute.voice.session.snapshot.v1") {
|
|
18451
|
+
throw new Error("Unsupported voice session snapshot schema.");
|
|
18452
|
+
}
|
|
18453
|
+
return snapshot;
|
|
18454
|
+
};
|
|
18388
18455
|
// src/proofRunner.ts
|
|
18389
18456
|
var encoder = new TextEncoder;
|
|
18390
18457
|
var trimBaseUrl = (baseUrl) => baseUrl.replace(/\/$/, "");
|
|
@@ -28937,7 +29004,7 @@ var defaultRequirement = {
|
|
|
28937
29004
|
requireFallback: false,
|
|
28938
29005
|
requireTimeoutBudget: false
|
|
28939
29006
|
};
|
|
28940
|
-
var
|
|
29007
|
+
var statusRank5 = {
|
|
28941
29008
|
pass: 0,
|
|
28942
29009
|
warn: 1,
|
|
28943
29010
|
fail: 2
|
|
@@ -28953,7 +29020,7 @@ var surfaceProviderNames = (surface) => uniqueSorted6([
|
|
|
28953
29020
|
...isProviderList(surface.fallback) ? surface.fallback : [],
|
|
28954
29021
|
...isProviderList(surface.allowProviders) ? surface.allowProviders : []
|
|
28955
29022
|
]);
|
|
28956
|
-
var surfaceStatus = (issues) => issues.reduce((status, issue) =>
|
|
29023
|
+
var surfaceStatus = (issues) => issues.reduce((status, issue) => statusRank5[issue.status] > statusRank5[status] ? issue.status : status, "pass");
|
|
28957
29024
|
var resolvedRequirement = (surface, options) => ({
|
|
28958
29025
|
...defaultRequirement,
|
|
28959
29026
|
...options.defaultRequirement ?? {},
|
|
@@ -29304,7 +29371,7 @@ var defaultThresholds = {
|
|
|
29304
29371
|
}
|
|
29305
29372
|
};
|
|
29306
29373
|
var providerKinds = ["llm", "stt", "tts"];
|
|
29307
|
-
var
|
|
29374
|
+
var statusRank6 = {
|
|
29308
29375
|
pass: 0,
|
|
29309
29376
|
warn: 1,
|
|
29310
29377
|
fail: 2
|
|
@@ -29500,9 +29567,9 @@ var evaluateVoiceProviderSloEvidence = (report, input = {}) => {
|
|
|
29500
29567
|
const fallbacks = kindReports.reduce((total, kind) => total + kind.fallbacks, 0);
|
|
29501
29568
|
const timeouts = kindReports.reduce((total, kind) => total + kind.timeouts, 0);
|
|
29502
29569
|
const unresolvedErrors = kindReports.reduce((total, kind) => total + kind.unresolvedErrors, 0);
|
|
29503
|
-
const
|
|
29504
|
-
if (
|
|
29505
|
-
issues.push(`Expected provider SLO status at most ${
|
|
29570
|
+
const maxStatus2 = input.maxStatus ?? "pass";
|
|
29571
|
+
if (statusRank6[report.status] > statusRank6[maxStatus2]) {
|
|
29572
|
+
issues.push(`Expected provider SLO status at most ${maxStatus2}, found ${report.status}.`);
|
|
29506
29573
|
}
|
|
29507
29574
|
if (input.minEvents !== undefined && report.events < input.minEvents) {
|
|
29508
29575
|
issues.push(`Expected at least ${String(input.minEvents)} provider routing events, found ${String(report.events)}.`);
|
|
@@ -36100,12 +36167,12 @@ var recommendVoiceProviderStack = (input) => {
|
|
|
36100
36167
|
};
|
|
36101
36168
|
};
|
|
36102
36169
|
var rollupContractStatus = (checks) => checks.some((check) => check.status === "fail") ? "fail" : checks.some((check) => check.status === "warn") ? "warn" : "pass";
|
|
36103
|
-
var
|
|
36170
|
+
var statusRank7 = {
|
|
36104
36171
|
pass: 0,
|
|
36105
36172
|
warn: 1,
|
|
36106
36173
|
fail: 2
|
|
36107
36174
|
};
|
|
36108
|
-
var statusExceeds2 = (actual, max2) =>
|
|
36175
|
+
var statusExceeds2 = (actual, max2) => statusRank7[actual] > statusRank7[max2];
|
|
36109
36176
|
var buildVoiceProviderContractMatrix = (input) => {
|
|
36110
36177
|
const rows = input.contracts.map((contract) => {
|
|
36111
36178
|
const configured = contract.configured !== false;
|
|
@@ -36208,7 +36275,7 @@ var buildVoiceProviderContractMatrix = (input) => {
|
|
|
36208
36275
|
};
|
|
36209
36276
|
var evaluateVoiceProviderContractMatrixEvidence = (report, input = {}) => {
|
|
36210
36277
|
const issues = [];
|
|
36211
|
-
const
|
|
36278
|
+
const maxStatus2 = input.maxStatus ?? "pass";
|
|
36212
36279
|
const maxFailed = input.maxFailed ?? 0;
|
|
36213
36280
|
const maxWarned = input.maxWarned ?? 0;
|
|
36214
36281
|
const minRows = input.minRows ?? 1;
|
|
@@ -36218,8 +36285,8 @@ var evaluateVoiceProviderContractMatrixEvidence = (report, input = {}) => {
|
|
|
36218
36285
|
const selectedKinds = [
|
|
36219
36286
|
...new Set(report.rows.filter((row) => row.selected).map((row) => row.kind))
|
|
36220
36287
|
].sort();
|
|
36221
|
-
if (statusExceeds2(report.status,
|
|
36222
|
-
issues.push(`Expected provider contract matrix status at most ${
|
|
36288
|
+
if (statusExceeds2(report.status, maxStatus2)) {
|
|
36289
|
+
issues.push(`Expected provider contract matrix status at most ${maxStatus2}, found ${report.status}.`);
|
|
36223
36290
|
}
|
|
36224
36291
|
if (report.failed > maxFailed) {
|
|
36225
36292
|
issues.push(`Expected at most ${String(maxFailed)} failing provider contract row(s), found ${String(report.failed)}.`);
|
|
@@ -36413,15 +36480,15 @@ var evaluateVoiceProviderStackGaps = (input) => {
|
|
|
36413
36480
|
};
|
|
36414
36481
|
var evaluateVoiceProviderStackEvidence = (report, input = {}) => {
|
|
36415
36482
|
const issues = [];
|
|
36416
|
-
const
|
|
36483
|
+
const maxStatus2 = input.maxStatus ?? "pass";
|
|
36417
36484
|
const maxMissing = input.maxMissing ?? 0;
|
|
36418
36485
|
const requireProviders = input.requireProviders ?? true;
|
|
36419
36486
|
const kinds = [...new Set(report.gaps.map((gap) => gap.kind))].sort();
|
|
36420
36487
|
const providers = [
|
|
36421
36488
|
...new Set(report.gaps.map((gap) => gap.provider).filter((provider) => provider !== undefined))
|
|
36422
36489
|
].sort();
|
|
36423
|
-
if (statusExceeds2(report.status,
|
|
36424
|
-
issues.push(`Expected provider stack status at most ${
|
|
36490
|
+
if (statusExceeds2(report.status, maxStatus2)) {
|
|
36491
|
+
issues.push(`Expected provider stack status at most ${maxStatus2}, found ${report.status}.`);
|
|
36425
36492
|
}
|
|
36426
36493
|
if (report.missing > maxMissing) {
|
|
36427
36494
|
issues.push(`Expected at most ${String(maxMissing)} missing provider stack capability/capabilities, found ${String(report.missing)}.`);
|
|
@@ -39733,6 +39800,7 @@ export {
|
|
|
39733
39800
|
pruneVoiceTraceEvents,
|
|
39734
39801
|
pruneVoiceIncidentBundleArtifacts,
|
|
39735
39802
|
parseVoiceTelephonyWebhookEvent,
|
|
39803
|
+
parseVoiceSessionSnapshot,
|
|
39736
39804
|
normalizeVoiceProofTrendReport,
|
|
39737
39805
|
muteVoiceMonitorIssue,
|
|
39738
39806
|
matchesVoiceOpsTaskAssignmentRule,
|
|
@@ -40123,6 +40191,8 @@ export {
|
|
|
40123
40191
|
buildVoiceTelephonyMediaReport,
|
|
40124
40192
|
buildVoiceSloReadinessThresholdReport,
|
|
40125
40193
|
buildVoiceSloCalibrationReport,
|
|
40194
|
+
buildVoiceSessionSnapshotStatus,
|
|
40195
|
+
buildVoiceSessionSnapshot,
|
|
40126
40196
|
buildVoiceRealtimeProviderContractMatrix,
|
|
40127
40197
|
buildVoiceRealtimeChannelRuntimeSamplesFromTrace,
|
|
40128
40198
|
buildVoiceRealtimeChannelReport,
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { MediaProcessorGraphSnapshot } from '@absolutejs/media';
|
|
2
|
+
import type { VoiceProofAssertionResult, VoiceProofAssertionSummary } from './proofAssertions';
|
|
3
|
+
import type { VoiceCampaignTelephonyOutcomeSnapshot } from './campaign';
|
|
4
|
+
import type { StoredVoiceTraceEvent } from './trace';
|
|
5
|
+
export type VoiceSessionSnapshotStatus = 'fail' | 'pass' | 'warn';
|
|
6
|
+
export type VoiceSessionSnapshotQualityEvidence = {
|
|
7
|
+
name: string;
|
|
8
|
+
report: unknown;
|
|
9
|
+
status?: VoiceSessionSnapshotStatus;
|
|
10
|
+
};
|
|
11
|
+
export type VoiceSessionSnapshot = {
|
|
12
|
+
capturedAt: number;
|
|
13
|
+
media: readonly MediaProcessorGraphSnapshot[];
|
|
14
|
+
name?: string;
|
|
15
|
+
proofAssertions: readonly VoiceProofAssertionResult[];
|
|
16
|
+
proofSummary: VoiceProofAssertionSummary;
|
|
17
|
+
providerRoutingEvents: readonly StoredVoiceTraceEvent[];
|
|
18
|
+
quality: readonly VoiceSessionSnapshotQualityEvidence[];
|
|
19
|
+
scenarioId?: string;
|
|
20
|
+
schema: 'absolute.voice.session.snapshot.v1';
|
|
21
|
+
sessionId: string;
|
|
22
|
+
status: VoiceSessionSnapshotStatus;
|
|
23
|
+
telephonyOutcomes: readonly VoiceCampaignTelephonyOutcomeSnapshot[];
|
|
24
|
+
turnId?: string;
|
|
25
|
+
};
|
|
26
|
+
export type VoiceSessionSnapshotInput = {
|
|
27
|
+
media?: readonly MediaProcessorGraphSnapshot[];
|
|
28
|
+
name?: string;
|
|
29
|
+
proofAssertions?: readonly VoiceProofAssertionResult[];
|
|
30
|
+
providerRoutingEvents?: readonly StoredVoiceTraceEvent[];
|
|
31
|
+
quality?: readonly VoiceSessionSnapshotQualityEvidence[];
|
|
32
|
+
scenarioId?: string;
|
|
33
|
+
sessionId: string;
|
|
34
|
+
telephonyOutcomes?: readonly VoiceCampaignTelephonyOutcomeSnapshot[];
|
|
35
|
+
turnId?: string;
|
|
36
|
+
};
|
|
37
|
+
export declare const buildVoiceSessionSnapshotStatus: (input: {
|
|
38
|
+
media?: readonly Pick<MediaProcessorGraphSnapshot, "report">[];
|
|
39
|
+
proofSummary?: Pick<VoiceProofAssertionSummary, "ok">;
|
|
40
|
+
quality?: readonly Pick<VoiceSessionSnapshotQualityEvidence, "status">[];
|
|
41
|
+
telephonyOutcomes?: readonly Pick<VoiceCampaignTelephonyOutcomeSnapshot, "campaignOutcome" | "duplicate">[];
|
|
42
|
+
}) => VoiceSessionSnapshotStatus;
|
|
43
|
+
export declare const buildVoiceSessionSnapshot: (input: VoiceSessionSnapshotInput) => VoiceSessionSnapshot;
|
|
44
|
+
export declare const parseVoiceSessionSnapshot: (snapshot: VoiceSessionSnapshot) => VoiceSessionSnapshot;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@absolutejs/voice",
|
|
3
|
-
"version": "0.0.22-beta.
|
|
3
|
+
"version": "0.0.22-beta.397",
|
|
4
4
|
"description": "Voice primitives and Elysia plugin for AbsoluteJS",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -246,7 +246,7 @@
|
|
|
246
246
|
}
|
|
247
247
|
},
|
|
248
248
|
"dependencies": {
|
|
249
|
-
"@absolutejs/media": "0.0.1-beta.
|
|
249
|
+
"@absolutejs/media": "0.0.1-beta.14"
|
|
250
250
|
},
|
|
251
251
|
"devDependencies": {
|
|
252
252
|
"@absolutejs/absolute": "0.19.0-beta.646",
|