@absolutejs/voice 0.0.22-beta.410 → 0.0.22-beta.411
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 +1 -1
- package/dist/index.js +175 -1
- package/dist/proofPack.d.ts +27 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -206,6 +206,6 @@ export type { PlivoInboundMessage, PlivoMediaStreamBridge, PlivoMediaStreamBridg
|
|
|
206
206
|
export type { VoiceTelephonyCarrierMatrix, VoiceTelephonyCarrierMatrixEntry, VoiceTelephonyCarrierMatrixInput, VoiceTelephonyCarrierMatrixOptions, VoiceTelephonyCarrierMatrixRoutesOptions, VoiceTelephonyCarrierMatrixStatus } from './telephony/matrix';
|
|
207
207
|
export { shapeTelephonyAssistantText } from './telephony/response';
|
|
208
208
|
export type { TelephonyResponseShapeMode, TelephonyResponseShapeOptions } from './telephony/response';
|
|
209
|
-
export { buildVoiceProofPack, buildVoiceProofPackFromObservabilityExport, createVoiceProofPackArtifacts, createVoiceProofPackRoutes, renderVoiceProofPackMarkdown, writeVoiceProofPack } from './proofPack';
|
|
209
|
+
export { buildVoiceProofPack, buildVoiceProofPackFromObservabilityExport, createVoiceProofPackArtifacts, createVoiceProofPackOperationsRecordSection, createVoiceProofPackProductionReadinessSection, createVoiceProofPackProviderSloSection, createVoiceProofPackRoutes, createVoiceProofPackSupportBundleSection, renderVoiceProofPackMarkdown, writeVoiceProofPack } from './proofPack';
|
|
210
210
|
export type { VoiceProofPack, VoiceProofPackEvidence, VoiceProofPackInput, VoiceProofPackRoutesOptions, VoiceProofPackSection, VoiceProofPackStatus, VoiceProofPackWriteResult } from './proofPack';
|
|
211
211
|
export * from './types';
|
package/dist/index.js
CHANGED
|
@@ -39882,6 +39882,176 @@ var summarizeProofPackSections = (sections) => {
|
|
|
39882
39882
|
}
|
|
39883
39883
|
return { fail, pass, sections: sections.length, warn };
|
|
39884
39884
|
};
|
|
39885
|
+
var toProofPackStatus = (status) => {
|
|
39886
|
+
if (status === "fail" || status === "failed") {
|
|
39887
|
+
return "fail";
|
|
39888
|
+
}
|
|
39889
|
+
if (status === "warn" || status === "warning" || status === "degraded" || status === "stale") {
|
|
39890
|
+
return "warn";
|
|
39891
|
+
}
|
|
39892
|
+
return "pass";
|
|
39893
|
+
};
|
|
39894
|
+
var numberEvidence = (label, value, options = {}) => {
|
|
39895
|
+
const safeValue = value ?? 0;
|
|
39896
|
+
const status = options.failWhenPositive ? safeValue > 0 ? "fail" : "pass" : options.passWhenPositive ? safeValue > 0 ? "pass" : "warn" : "pass";
|
|
39897
|
+
return {
|
|
39898
|
+
label,
|
|
39899
|
+
status,
|
|
39900
|
+
value: safeValue
|
|
39901
|
+
};
|
|
39902
|
+
};
|
|
39903
|
+
var createVoiceProofPackProviderSloSection = (report, options = {}) => ({
|
|
39904
|
+
evidence: [
|
|
39905
|
+
{
|
|
39906
|
+
href: options.href,
|
|
39907
|
+
label: "Provider SLO status",
|
|
39908
|
+
status: toProofPackStatus(report.status),
|
|
39909
|
+
value: report.status
|
|
39910
|
+
},
|
|
39911
|
+
numberEvidence("Provider routing events", report.events, {
|
|
39912
|
+
passWhenPositive: true
|
|
39913
|
+
}),
|
|
39914
|
+
numberEvidence("Latency samples", report.eventsWithLatency, {
|
|
39915
|
+
passWhenPositive: true
|
|
39916
|
+
}),
|
|
39917
|
+
numberEvidence("Provider SLO issues", report.issues.length, {
|
|
39918
|
+
failWhenPositive: true
|
|
39919
|
+
})
|
|
39920
|
+
],
|
|
39921
|
+
status: toProofPackStatus(report.status),
|
|
39922
|
+
summary: "Provider latency, timeout, fallback, and unresolved error evidence.",
|
|
39923
|
+
title: options.title ?? "Provider SLO"
|
|
39924
|
+
});
|
|
39925
|
+
var createVoiceProofPackProductionReadinessSection = (report, options = {}) => {
|
|
39926
|
+
const checkFailures = report.checks.filter((check) => check.status === "fail").length;
|
|
39927
|
+
const checkWarnings = report.checks.filter((check) => check.status === "warn").length;
|
|
39928
|
+
return {
|
|
39929
|
+
evidence: [
|
|
39930
|
+
{
|
|
39931
|
+
label: "Production readiness status",
|
|
39932
|
+
status: toProofPackStatus(report.status),
|
|
39933
|
+
value: report.status
|
|
39934
|
+
},
|
|
39935
|
+
numberEvidence("Readiness checks", report.checks.length, {
|
|
39936
|
+
passWhenPositive: true
|
|
39937
|
+
}),
|
|
39938
|
+
numberEvidence("Failed readiness checks", checkFailures, {
|
|
39939
|
+
failWhenPositive: true
|
|
39940
|
+
}),
|
|
39941
|
+
{
|
|
39942
|
+
label: "Warning readiness checks",
|
|
39943
|
+
status: checkWarnings > 0 ? "warn" : "pass",
|
|
39944
|
+
value: checkWarnings
|
|
39945
|
+
},
|
|
39946
|
+
...report.summary.providerSlo ? [
|
|
39947
|
+
{
|
|
39948
|
+
href: report.links.providerSlo,
|
|
39949
|
+
label: "Provider SLO samples",
|
|
39950
|
+
status: toProofPackStatus(report.summary.providerSlo.status),
|
|
39951
|
+
value: report.summary.providerSlo.eventsWithLatency
|
|
39952
|
+
}
|
|
39953
|
+
] : [],
|
|
39954
|
+
...report.summary.traceDeliveries ? [
|
|
39955
|
+
{
|
|
39956
|
+
href: report.links.traceDeliveries,
|
|
39957
|
+
label: "Trace delivery status",
|
|
39958
|
+
status: toProofPackStatus(report.summary.traceDeliveries.status),
|
|
39959
|
+
value: report.summary.traceDeliveries.pending
|
|
39960
|
+
}
|
|
39961
|
+
] : []
|
|
39962
|
+
],
|
|
39963
|
+
status: toProofPackStatus(report.status),
|
|
39964
|
+
summary: "Production readiness gates and linked proof surfaces.",
|
|
39965
|
+
title: options.title ?? "Production readiness"
|
|
39966
|
+
};
|
|
39967
|
+
};
|
|
39968
|
+
var createVoiceProofPackOperationsRecordSection = (records, options = {}) => {
|
|
39969
|
+
const failed = records.filter((record) => record.status === "failed").length;
|
|
39970
|
+
const warnings = records.filter((record) => record.status === "warning").length;
|
|
39971
|
+
const errors = records.reduce((total, record) => total + record.summary.errorCount, 0);
|
|
39972
|
+
const fallbacks = records.reduce((total, record) => total + record.providerDecisionSummary.fallbacks, 0);
|
|
39973
|
+
return {
|
|
39974
|
+
evidence: [
|
|
39975
|
+
numberEvidence("Operations records", records.length, {
|
|
39976
|
+
passWhenPositive: true
|
|
39977
|
+
}),
|
|
39978
|
+
numberEvidence("Failed operations records", failed, {
|
|
39979
|
+
failWhenPositive: true
|
|
39980
|
+
}),
|
|
39981
|
+
{
|
|
39982
|
+
label: "Warning operations records",
|
|
39983
|
+
status: warnings > 0 ? "warn" : "pass",
|
|
39984
|
+
value: warnings
|
|
39985
|
+
},
|
|
39986
|
+
numberEvidence("Trace errors", errors, { failWhenPositive: true }),
|
|
39987
|
+
{
|
|
39988
|
+
label: "Provider fallbacks",
|
|
39989
|
+
status: fallbacks > 0 ? "warn" : "pass",
|
|
39990
|
+
value: fallbacks
|
|
39991
|
+
},
|
|
39992
|
+
...records.slice(0, 5).map((record) => ({
|
|
39993
|
+
href: options.href?.(record.sessionId),
|
|
39994
|
+
label: `Session ${record.sessionId}`,
|
|
39995
|
+
status: toProofPackStatus(record.status),
|
|
39996
|
+
value: record.status
|
|
39997
|
+
}))
|
|
39998
|
+
],
|
|
39999
|
+
status: failed > 0 || errors > 0 ? "fail" : warnings > 0 || fallbacks > 0 ? "warn" : "pass",
|
|
40000
|
+
summary: "Per-call operations records, trace errors, and provider recovery.",
|
|
40001
|
+
title: options.title ?? "Operations records"
|
|
40002
|
+
};
|
|
40003
|
+
};
|
|
40004
|
+
var createVoiceProofPackSupportBundleSection = (input) => {
|
|
40005
|
+
const snapshots = input.sessionSnapshots ?? [];
|
|
40006
|
+
const debuggerReports = input.callDebuggerReports ?? [];
|
|
40007
|
+
const failedSnapshots = snapshots.filter((snapshot) => snapshot.status === "fail").length;
|
|
40008
|
+
const failedDebuggerReports = debuggerReports.filter((report) => report.status === "failed").length;
|
|
40009
|
+
const warnings = snapshots.filter((snapshot) => snapshot.status === "warn").length + debuggerReports.filter((report) => report.status === "warning").length;
|
|
40010
|
+
return {
|
|
40011
|
+
evidence: [
|
|
40012
|
+
numberEvidence("Session snapshots", snapshots.length, {
|
|
40013
|
+
passWhenPositive: true
|
|
40014
|
+
}),
|
|
40015
|
+
numberEvidence("Call debugger reports", debuggerReports.length, {
|
|
40016
|
+
passWhenPositive: true
|
|
40017
|
+
}),
|
|
40018
|
+
numberEvidence("Failed snapshots", failedSnapshots, {
|
|
40019
|
+
failWhenPositive: true
|
|
40020
|
+
}),
|
|
40021
|
+
numberEvidence("Failed debugger reports", failedDebuggerReports, {
|
|
40022
|
+
failWhenPositive: true
|
|
40023
|
+
}),
|
|
40024
|
+
{
|
|
40025
|
+
label: "Warning support artifacts",
|
|
40026
|
+
status: warnings > 0 ? "warn" : "pass",
|
|
40027
|
+
value: warnings
|
|
40028
|
+
}
|
|
40029
|
+
],
|
|
40030
|
+
status: failedSnapshots > 0 || failedDebuggerReports > 0 ? "fail" : warnings > 0 ? "warn" : "pass",
|
|
40031
|
+
summary: "Support artifacts that make the latest call debuggable.",
|
|
40032
|
+
title: input.title ?? "Support bundle"
|
|
40033
|
+
};
|
|
40034
|
+
};
|
|
40035
|
+
var buildDerivedProofPackSections = (input) => [
|
|
40036
|
+
...input.productionReadiness ? [createVoiceProofPackProductionReadinessSection(input.productionReadiness)] : [],
|
|
40037
|
+
...input.providerSlo ? [
|
|
40038
|
+
createVoiceProofPackProviderSloSection(input.providerSlo, {
|
|
40039
|
+
href: input.productionReadiness?.links.providerSlo
|
|
40040
|
+
})
|
|
40041
|
+
] : [],
|
|
40042
|
+
...input.operationsRecords && input.operationsRecords.length > 0 ? [
|
|
40043
|
+
createVoiceProofPackOperationsRecordSection(input.operationsRecords, {
|
|
40044
|
+
href: (sessionId) => input.productionReadiness?.links.operationsRecords ? `${input.productionReadiness.links.operationsRecords}/${encodeURIComponent(sessionId)}` : undefined
|
|
40045
|
+
})
|
|
40046
|
+
] : [],
|
|
40047
|
+
...input.sessionSnapshots?.length || input.callDebuggerReports?.length ? [
|
|
40048
|
+
createVoiceProofPackSupportBundleSection({
|
|
40049
|
+
callDebuggerReports: input.callDebuggerReports,
|
|
40050
|
+
sessionSnapshots: input.sessionSnapshots
|
|
40051
|
+
})
|
|
40052
|
+
] : [],
|
|
40053
|
+
...input.observabilityExport ? buildVoiceProofPackFromObservabilityExport(input.observabilityExport).sections : []
|
|
40054
|
+
];
|
|
39885
40055
|
var resolveProofPack = async (source) => {
|
|
39886
40056
|
const input = typeof source === "function" ? await source() : source;
|
|
39887
40057
|
return buildVoiceProofPack(input);
|
|
@@ -39890,7 +40060,7 @@ var buildVoiceProofPack = (input) => {
|
|
|
39890
40060
|
if ("status" in input && "ok" in input && "summary" in input && Array.isArray(input.sections)) {
|
|
39891
40061
|
return input;
|
|
39892
40062
|
}
|
|
39893
|
-
const sections = input.sections ?? [];
|
|
40063
|
+
const sections = [...buildDerivedProofPackSections(input), ...input.sections ?? []];
|
|
39894
40064
|
const summary = summarizeProofPackSections(sections);
|
|
39895
40065
|
const status = summary.fail > 0 ? "fail" : summary.warn > 0 ? "warn" : "pass";
|
|
39896
40066
|
return {
|
|
@@ -40462,7 +40632,11 @@ export {
|
|
|
40462
40632
|
createVoiceProviderCapabilityHTMLHandler,
|
|
40463
40633
|
createVoiceProofTrendRoutes,
|
|
40464
40634
|
createVoiceProofTrendRecommendationRoutes,
|
|
40635
|
+
createVoiceProofPackSupportBundleSection,
|
|
40465
40636
|
createVoiceProofPackRoutes,
|
|
40637
|
+
createVoiceProofPackProviderSloSection,
|
|
40638
|
+
createVoiceProofPackProductionReadinessSection,
|
|
40639
|
+
createVoiceProofPackOperationsRecordSection,
|
|
40466
40640
|
createVoiceProofPackArtifacts,
|
|
40467
40641
|
createVoiceProofAssertion,
|
|
40468
40642
|
createVoiceProfileTraceTagger,
|
package/dist/proofPack.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { Elysia } from 'elysia';
|
|
2
2
|
import type { VoiceObservabilityExportArtifact, VoiceObservabilityExportReport } from './observabilityExport';
|
|
3
|
+
import type { VoiceCallDebuggerReport } from './callDebugger';
|
|
4
|
+
import type { VoiceOperationsRecord } from './operationsRecord';
|
|
5
|
+
import type { VoiceProductionReadinessReport } from './productionReadiness';
|
|
6
|
+
import type { VoiceProviderSloReport } from './providerSlo';
|
|
7
|
+
import type { VoiceSessionSnapshot } from './sessionSnapshot';
|
|
3
8
|
export type VoiceProofPackStatus = 'fail' | 'pass' | 'warn';
|
|
4
9
|
export type VoiceProofPackEvidence = {
|
|
5
10
|
detail?: string;
|
|
@@ -31,10 +36,16 @@ export type VoiceProofPack = {
|
|
|
31
36
|
};
|
|
32
37
|
export type VoiceProofPackInput = {
|
|
33
38
|
artifacts?: VoiceObservabilityExportArtifact[];
|
|
39
|
+
callDebuggerReports?: VoiceCallDebuggerReport[];
|
|
34
40
|
generatedAt?: number | string;
|
|
41
|
+
observabilityExport?: VoiceObservabilityExportReport;
|
|
42
|
+
operationsRecords?: VoiceOperationsRecord[];
|
|
35
43
|
outputDir?: string;
|
|
44
|
+
productionReadiness?: VoiceProductionReadinessReport;
|
|
45
|
+
providerSlo?: VoiceProviderSloReport;
|
|
36
46
|
runId?: string;
|
|
37
47
|
sections?: VoiceProofPackSection[];
|
|
48
|
+
sessionSnapshots?: VoiceSessionSnapshot[];
|
|
38
49
|
};
|
|
39
50
|
export type VoiceProofPackWriteResult = {
|
|
40
51
|
artifacts: VoiceObservabilityExportArtifact[];
|
|
@@ -49,6 +60,22 @@ export type VoiceProofPackRoutesOptions = {
|
|
|
49
60
|
name?: string;
|
|
50
61
|
source: VoiceProofPack | VoiceProofPackInput | (() => VoiceProofPack | VoiceProofPackInput | Promise<VoiceProofPack | VoiceProofPackInput>);
|
|
51
62
|
};
|
|
63
|
+
export declare const createVoiceProofPackProviderSloSection: (report: VoiceProviderSloReport, options?: {
|
|
64
|
+
href?: string;
|
|
65
|
+
title?: string;
|
|
66
|
+
}) => VoiceProofPackSection;
|
|
67
|
+
export declare const createVoiceProofPackProductionReadinessSection: (report: VoiceProductionReadinessReport, options?: {
|
|
68
|
+
title?: string;
|
|
69
|
+
}) => VoiceProofPackSection;
|
|
70
|
+
export declare const createVoiceProofPackOperationsRecordSection: (records: readonly VoiceOperationsRecord[], options?: {
|
|
71
|
+
href?: (sessionId: string) => string | undefined;
|
|
72
|
+
title?: string;
|
|
73
|
+
}) => VoiceProofPackSection;
|
|
74
|
+
export declare const createVoiceProofPackSupportBundleSection: (input: {
|
|
75
|
+
callDebuggerReports?: readonly VoiceCallDebuggerReport[];
|
|
76
|
+
sessionSnapshots?: readonly VoiceSessionSnapshot[];
|
|
77
|
+
title?: string;
|
|
78
|
+
}) => VoiceProofPackSection;
|
|
52
79
|
export declare const buildVoiceProofPack: (input: VoiceProofPackInput | VoiceProofPack) => VoiceProofPack;
|
|
53
80
|
export declare const buildVoiceProofPackFromObservabilityExport: (report: VoiceObservabilityExportReport, input?: Omit<VoiceProofPackInput, "artifacts" | "sections">) => VoiceProofPack;
|
|
54
81
|
export declare const renderVoiceProofPackMarkdown: (proofPack: VoiceProofPack) => string;
|