@absolutejs/voice 0.0.22-beta.416 → 0.0.22-beta.418

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 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, createVoiceProofPackStaleWhileRefreshSource, createVoiceProofPackArtifacts, createVoiceProofPackOperationsRecordSection, createVoiceProofPackProductionReadinessSection, createVoiceProofPackProviderSloSection, createVoiceProofPackRoutes, createVoiceProofPackSupportBundleSection, renderVoiceProofPackMarkdown, writeVoiceProofPack } from './proofPack';
210
- export type { VoiceProofPack, VoiceProofPackEvidence, VoiceProofPackInput, VoiceProofPackRefreshState, VoiceProofPackRefreshStatus, VoiceProofPackRoutesOptions, VoiceProofPackSection, VoiceProofPackSourceValue, VoiceProofPackStatus, VoiceProofPackStaleWhileRefreshSource, VoiceProofPackStaleWhileRefreshSourceOptions, VoiceProofPackWriteResult } from './proofPack';
209
+ export { buildVoiceProofPack, buildVoiceProofPackFromObservabilityExport, createVoiceProofPackBuildContext, createVoiceProofRefreshSnapshot, createVoiceProofPackStaleWhileRefreshSource, createVoiceProofPackArtifacts, createVoiceProofPackOperationsRecordSection, createVoiceProofPackProductionReadinessSection, createVoiceProofPackProviderSloSection, createVoiceProofPackRoutes, createVoiceProofPackSupportBundleSection, renderVoiceProofPackMarkdown, writeVoiceProofPack } from './proofPack';
210
+ export type { VoiceProofPack, VoiceProofPackBuildContext, VoiceProofPackBuildContextOptions, VoiceProofPackBuildTiming, VoiceProofPackEvidence, VoiceProofPackInput, VoiceProofPackRefreshState, VoiceProofPackRefreshStatus, VoiceProofPackRoutesOptions, VoiceProofPackSection, VoiceProofPackSourceValue, VoiceProofPackStatus, VoiceProofPackStaleWhileRefreshSource, VoiceProofPackStaleWhileRefreshSourceOptions, VoiceProofPackWriteResult, VoiceProofRefreshSnapshot, VoiceProofRefreshSnapshotOptions } from './proofPack';
211
211
  export * from './types';
package/dist/index.js CHANGED
@@ -39981,6 +39981,93 @@ var summarizeProofPackSections = (sections) => {
39981
39981
  }
39982
39982
  return { fail, pass, sections: sections.length, warn };
39983
39983
  };
39984
+ var createVoiceProofPackBuildContext = (options = {}) => {
39985
+ const now = options.now ?? Date.now;
39986
+ const cachedValues = new Map;
39987
+ const timings = [];
39988
+ const time = async (label, run) => {
39989
+ const startedAt = now();
39990
+ try {
39991
+ return await run();
39992
+ } finally {
39993
+ const endedAt = now();
39994
+ const timing = {
39995
+ durationMs: Math.max(0, endedAt - startedAt),
39996
+ endedAt,
39997
+ label,
39998
+ startedAt
39999
+ };
40000
+ timings.push(timing);
40001
+ options.onTiming?.(timing);
40002
+ }
40003
+ };
40004
+ const cache = (key, loader) => {
40005
+ const cached = cachedValues.get(key);
40006
+ if (cached) {
40007
+ return cached;
40008
+ }
40009
+ const value = Promise.resolve(loader());
40010
+ cachedValues.set(key, value);
40011
+ return value;
40012
+ };
40013
+ return {
40014
+ cache,
40015
+ clear: (key) => {
40016
+ if (key === undefined) {
40017
+ cachedValues.clear();
40018
+ return;
40019
+ }
40020
+ cachedValues.delete(key);
40021
+ },
40022
+ getTimings: () => [...timings],
40023
+ time
40024
+ };
40025
+ };
40026
+ var createSnapshotTraceStore = (events) => ({
40027
+ append: async () => {
40028
+ throw new Error("Voice proof refresh snapshot trace store is read-only.");
40029
+ },
40030
+ get: async (id) => events.find((event) => event.id === id),
40031
+ list: async (filter) => filterVoiceTraceEvents([...events], filter),
40032
+ remove: async () => {
40033
+ throw new Error("Voice proof refresh snapshot trace store is read-only.");
40034
+ }
40035
+ });
40036
+ var createSnapshotAuditStore = (events) => ({
40037
+ append: async () => {
40038
+ throw new Error("Voice proof refresh snapshot audit store is read-only.");
40039
+ },
40040
+ get: async (id) => events.find((event) => event.id === id),
40041
+ list: async (filter) => filterVoiceAuditEvents([...events], filter)
40042
+ });
40043
+ var createSnapshotTraceDeliveryStore = (deliveries) => ({
40044
+ get: async (id) => deliveries.find((delivery) => delivery.id === id),
40045
+ list: async () => [...deliveries],
40046
+ remove: async () => {
40047
+ throw new Error("Voice proof refresh snapshot delivery store is read-only.");
40048
+ },
40049
+ set: async () => {
40050
+ throw new Error("Voice proof refresh snapshot delivery store is read-only.");
40051
+ }
40052
+ });
40053
+ var createVoiceProofRefreshSnapshot = async (options = {}) => {
40054
+ const [traceEvents, auditEvents, traceDeliveries, auditSinkDeliveries] = await Promise.all([
40055
+ options.events ?? await options.traceStore?.list(options.traceFilter) ?? [],
40056
+ options.audit ? await options.audit.list(options.auditFilter) : [],
40057
+ options.traceDeliveries ? await options.traceDeliveries.list() : [],
40058
+ options.auditSinkDeliveries ? await options.auditSinkDeliveries.list() : []
40059
+ ]);
40060
+ return {
40061
+ auditEvents,
40062
+ auditSinkDeliveries,
40063
+ auditStore: createSnapshotAuditStore(auditEvents),
40064
+ capturedAt: Date.now(),
40065
+ traceDeliveries,
40066
+ traceDeliveryStore: createSnapshotTraceDeliveryStore(traceDeliveries),
40067
+ traceEvents,
40068
+ traceStore: createSnapshotTraceStore(traceEvents)
40069
+ };
40070
+ };
39984
40071
  var toProofPackStatus = (status) => {
39985
40072
  if (status === "fail" || status === "failed") {
39986
40073
  return "fail";
@@ -40826,12 +40913,14 @@ export {
40826
40913
  createVoiceProofTrendRoutes,
40827
40914
  createVoiceProofTrendRecommendationRoutes,
40828
40915
  createVoiceProofTraceStore,
40916
+ createVoiceProofRefreshSnapshot,
40829
40917
  createVoiceProofPackSupportBundleSection,
40830
40918
  createVoiceProofPackStaleWhileRefreshSource,
40831
40919
  createVoiceProofPackRoutes,
40832
40920
  createVoiceProofPackProviderSloSection,
40833
40921
  createVoiceProofPackProductionReadinessSection,
40834
40922
  createVoiceProofPackOperationsRecordSection,
40923
+ createVoiceProofPackBuildContext,
40835
40924
  createVoiceProofPackArtifacts,
40836
40925
  createVoiceProofAssertion,
40837
40926
  createVoiceProfileTraceTagger,
@@ -1,10 +1,12 @@
1
1
  import { Elysia } from 'elysia';
2
+ import { type StoredVoiceAuditEvent, type VoiceAuditEventFilter, type VoiceAuditEventStore } from './audit';
2
3
  import type { VoiceObservabilityExportArtifact, VoiceObservabilityExportReport } from './observabilityExport';
3
4
  import type { VoiceCallDebuggerReport } from './callDebugger';
4
5
  import type { VoiceOperationsRecord } from './operationsRecord';
5
6
  import type { VoiceProductionReadinessReport } from './productionReadiness';
6
7
  import type { VoiceProviderSloReport } from './providerSlo';
7
8
  import type { VoiceSessionSnapshot } from './sessionSnapshot';
9
+ import { type StoredVoiceTraceEvent, type VoiceTraceEventFilter, type VoiceTraceEventStore, type VoiceTraceSinkDeliveryRecord, type VoiceTraceSinkDeliveryStore } from './trace';
8
10
  export type VoiceProofPackStatus = 'fail' | 'pass' | 'warn';
9
11
  export type VoiceProofPackEvidence = {
10
12
  detail?: string;
@@ -53,6 +55,43 @@ export type VoiceProofPackWriteResult = {
53
55
  markdownPath: string;
54
56
  proofPack: VoiceProofPack;
55
57
  };
58
+ export type VoiceProofPackBuildTiming = {
59
+ durationMs: number;
60
+ endedAt: number;
61
+ label: string;
62
+ startedAt: number;
63
+ };
64
+ export type VoiceProofPackBuildContext = {
65
+ cache: <TValue>(key: string, loader: () => Promise<TValue> | TValue) => Promise<TValue>;
66
+ clear: (key?: string) => void;
67
+ getTimings: () => VoiceProofPackBuildTiming[];
68
+ time: <TValue>(label: string, run: () => Promise<TValue> | TValue) => Promise<TValue>;
69
+ };
70
+ export type VoiceProofPackBuildContextOptions = {
71
+ now?: () => number;
72
+ onTiming?: (timing: VoiceProofPackBuildTiming) => void;
73
+ };
74
+ export type VoiceProofRefreshSnapshotOptions = {
75
+ audit?: VoiceAuditEventStore;
76
+ auditFilter?: VoiceAuditEventFilter;
77
+ auditSinkDeliveries?: {
78
+ list: () => Promise<unknown[]> | unknown[];
79
+ };
80
+ events?: StoredVoiceTraceEvent[];
81
+ traceDeliveries?: VoiceTraceSinkDeliveryStore;
82
+ traceFilter?: VoiceTraceEventFilter;
83
+ traceStore?: VoiceTraceEventStore;
84
+ };
85
+ export type VoiceProofRefreshSnapshot = {
86
+ auditEvents: StoredVoiceAuditEvent[];
87
+ auditStore: VoiceAuditEventStore;
88
+ auditSinkDeliveries: unknown[];
89
+ capturedAt: number;
90
+ traceDeliveries: VoiceTraceSinkDeliveryRecord[];
91
+ traceDeliveryStore: VoiceTraceSinkDeliveryStore;
92
+ traceEvents: StoredVoiceTraceEvent[];
93
+ traceStore: VoiceTraceEventStore;
94
+ };
56
95
  export type VoiceProofPackSourceValue = VoiceProofPack | VoiceProofPackInput;
57
96
  export type VoiceProofPackStaleWhileRefreshSourceOptions = {
58
97
  maxAgeMs?: number;
@@ -83,6 +122,8 @@ export type VoiceProofPackRoutesOptions = {
83
122
  name?: string;
84
123
  source: VoiceProofPackSourceValue | (() => VoiceProofPackSourceValue | Promise<VoiceProofPackSourceValue>);
85
124
  };
125
+ export declare const createVoiceProofPackBuildContext: (options?: VoiceProofPackBuildContextOptions) => VoiceProofPackBuildContext;
126
+ export declare const createVoiceProofRefreshSnapshot: (options?: VoiceProofRefreshSnapshotOptions) => Promise<VoiceProofRefreshSnapshot>;
86
127
  export declare const createVoiceProofPackProviderSloSection: (report: VoiceProviderSloReport, options?: {
87
128
  href?: string;
88
129
  title?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.416",
3
+ "version": "0.0.22-beta.418",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",