@absolutejs/voice 0.0.22-beta.452 → 0.0.22-beta.453
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/client/index.js +76 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +79 -0
- package/dist/proofTrends.d.ts +35 -0
- package/dist/react/index.js +76 -0
- package/dist/vue/index.js +76 -0
- package/package.json +1 -1
package/dist/client/index.js
CHANGED
|
@@ -6564,6 +6564,7 @@ var buildVoiceRealCallProfileEvidenceFromReconnectProofReports = (input, options
|
|
|
6564
6564
|
});
|
|
6565
6565
|
};
|
|
6566
6566
|
var loadVoiceRealCallProfileEvidenceFromTraceStore = async (options) => buildVoiceRealCallProfileEvidenceFromTraceEvents(await options.store.list({ limit: options.limit ?? 5000 }), options);
|
|
6567
|
+
var loadVoiceRealCallProfileEvidenceFromStore = async (options) => options.store.list(options);
|
|
6567
6568
|
var realCallProfileTraceSignalTypes = new Set([
|
|
6568
6569
|
"client.barge_in",
|
|
6569
6570
|
"client.browser_media",
|
|
@@ -7406,6 +7407,74 @@ var createVoiceInMemoryRealCallProfileRecoveryJobStore = (options = {}) => {
|
|
|
7406
7407
|
}
|
|
7407
7408
|
};
|
|
7408
7409
|
};
|
|
7410
|
+
var normalizeRealCallProfileEvidenceTableName = (value) => value.trim().replace(/[^a-zA-Z0-9_]+/g, "_").replace(/^_+|_+$/g, "") || "voice_real_call_profile_evidence";
|
|
7411
|
+
var parseRealCallProfileEvidenceBoundary = (value) => value === undefined ? undefined : value instanceof Date ? value.getTime() : typeof value === "number" ? value : Date.parse(value);
|
|
7412
|
+
var readRealCallProfileEvidenceSortTime = (evidence, fallback) => Date.parse(evidence.generatedAt ?? fallback) || Date.parse(fallback);
|
|
7413
|
+
var createVoiceSQLiteRealCallProfileEvidenceStore = (options = {}) => {
|
|
7414
|
+
const { Database: SQLiteDatabase } = __require("bun:sqlite");
|
|
7415
|
+
const database = options.database ?? new SQLiteDatabase(options.path ?? ":memory:", {
|
|
7416
|
+
create: true
|
|
7417
|
+
});
|
|
7418
|
+
const tableName = normalizeRealCallProfileEvidenceTableName(options.tableName ?? "voice_real_call_profile_evidence");
|
|
7419
|
+
const now = () => (options.now ?? (() => new Date))().toISOString();
|
|
7420
|
+
const createId = () => `${options.idPrefix ?? "voice-profile-evidence"}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
7421
|
+
database.exec("PRAGMA journal_mode = WAL;");
|
|
7422
|
+
database.exec("PRAGMA synchronous = NORMAL;");
|
|
7423
|
+
database.exec("PRAGMA busy_timeout = 5000;");
|
|
7424
|
+
database.exec(`CREATE TABLE IF NOT EXISTS "${tableName}" (
|
|
7425
|
+
id TEXT PRIMARY KEY,
|
|
7426
|
+
sort_at INTEGER NOT NULL,
|
|
7427
|
+
profile_id TEXT NOT NULL,
|
|
7428
|
+
session_id TEXT NOT NULL,
|
|
7429
|
+
created_at TEXT NOT NULL,
|
|
7430
|
+
payload TEXT NOT NULL
|
|
7431
|
+
)`);
|
|
7432
|
+
const selectStatement = database.query(`SELECT payload FROM "${tableName}" WHERE id = ?1 LIMIT 1`);
|
|
7433
|
+
const listStatement = database.query(`SELECT payload FROM "${tableName}" ORDER BY sort_at DESC, id DESC`);
|
|
7434
|
+
const upsertStatement = database.query(`INSERT INTO "${tableName}" (id, sort_at, profile_id, session_id, created_at, payload)
|
|
7435
|
+
VALUES (?1, ?2, ?3, ?4, ?5, ?6)
|
|
7436
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
7437
|
+
sort_at = excluded.sort_at,
|
|
7438
|
+
profile_id = excluded.profile_id,
|
|
7439
|
+
session_id = excluded.session_id,
|
|
7440
|
+
created_at = excluded.created_at,
|
|
7441
|
+
payload = excluded.payload`);
|
|
7442
|
+
const deleteStatement = database.query(`DELETE FROM "${tableName}" WHERE id = ?1`);
|
|
7443
|
+
const writeEvidence = (record) => {
|
|
7444
|
+
upsertStatement.run(record.id, readRealCallProfileEvidenceSortTime(record, record.createdAt), record.profileId, record.sessionId, record.createdAt, JSON.stringify(record));
|
|
7445
|
+
return record;
|
|
7446
|
+
};
|
|
7447
|
+
const readEvidence = (id) => {
|
|
7448
|
+
const row = selectStatement.get(id);
|
|
7449
|
+
return row ? JSON.parse(row.payload) : undefined;
|
|
7450
|
+
};
|
|
7451
|
+
const matchesListOptions = (record, input) => {
|
|
7452
|
+
const evidenceTime = readRealCallProfileEvidenceSortTime(record, record.createdAt);
|
|
7453
|
+
const since = parseRealCallProfileEvidenceBoundary(input.since);
|
|
7454
|
+
const until = parseRealCallProfileEvidenceBoundary(input.until);
|
|
7455
|
+
return (!input.profileId || record.profileId === input.profileId) && (!input.sessionId || record.sessionId === input.sessionId) && (since === undefined || Number.isNaN(since) || evidenceTime >= since) && (until === undefined || Number.isNaN(until) || evidenceTime <= until);
|
|
7456
|
+
};
|
|
7457
|
+
return {
|
|
7458
|
+
append(input) {
|
|
7459
|
+
const createdAt = input.createdAt ?? now();
|
|
7460
|
+
return writeEvidence({
|
|
7461
|
+
...input,
|
|
7462
|
+
createdAt,
|
|
7463
|
+
id: input.id ?? createId()
|
|
7464
|
+
});
|
|
7465
|
+
},
|
|
7466
|
+
get(id) {
|
|
7467
|
+
return readEvidence(id);
|
|
7468
|
+
},
|
|
7469
|
+
list(input = {}) {
|
|
7470
|
+
const limit = Number.isFinite(input.limit) && input.limit !== undefined && input.limit > 0 ? Math.floor(input.limit) : 500;
|
|
7471
|
+
return listStatement.all().map((row) => JSON.parse(row.payload)).filter((record) => matchesListOptions(record, input)).slice(0, limit);
|
|
7472
|
+
},
|
|
7473
|
+
remove(id) {
|
|
7474
|
+
deleteStatement.run(id);
|
|
7475
|
+
}
|
|
7476
|
+
};
|
|
7477
|
+
};
|
|
7409
7478
|
var normalizeRealCallRecoveryJobTableName = (value) => value.trim().replace(/[^a-zA-Z0-9_]+/g, "_").replace(/^_+|_+$/g, "") || "voice_real_call_profile_recovery_jobs";
|
|
7410
7479
|
var createVoiceSQLiteRealCallProfileRecoveryJobStore = (options = {}) => {
|
|
7411
7480
|
const { Database: SQLiteDatabase } = __require("bun:sqlite");
|
|
@@ -7659,6 +7728,13 @@ var buildVoiceRealCallProfileHistoryReport = (options = {}) => {
|
|
|
7659
7728
|
trend
|
|
7660
7729
|
};
|
|
7661
7730
|
};
|
|
7731
|
+
var buildVoiceRealCallProfileHistoryReportFromStore = async (options) => {
|
|
7732
|
+
const evidence = await options.store.list(options);
|
|
7733
|
+
return buildVoiceRealCallProfileHistoryReport({
|
|
7734
|
+
...options,
|
|
7735
|
+
evidence
|
|
7736
|
+
});
|
|
7737
|
+
};
|
|
7662
7738
|
var normalizeProviderStatus = (status) => status === "pass" ? "pass" : status === "fail" ? "fail" : "warn";
|
|
7663
7739
|
var providerSortScore = (provider) => [
|
|
7664
7740
|
recommendationStatusRank[provider.status],
|
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, 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
|
+
export { assertVoiceProofTrendEvidence, appendVoiceRealCallProfileRecoveryEvidence, buildEmptyVoiceProofTrendReport, buildVoiceProofTrendProfileSummaries, buildVoiceProofTrendRecommendationReport, buildVoiceProofTrendReportFromRealCallProfiles, buildVoiceProofTrendReport, buildVoiceRealCallProfileEvidenceFromTraceEvents, buildVoiceRealCallProfileEvidenceFromReconnectProofReports, buildVoiceRealCallProfileDefaults, buildVoiceRealCallProfileHistoryReport, buildVoiceRealCallProfileHistoryReportFromStore, buildVoiceRealCallProfileReadinessCheck, buildVoiceRealCallProfileRecoveryJobHistoryCheck, buildVoiceRealCallProfileRecoveryActions, 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, 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, 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, } 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, 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
|
@@ -16828,6 +16828,7 @@ var buildVoiceRealCallProfileEvidenceFromReconnectProofReports = (input, options
|
|
|
16828
16828
|
});
|
|
16829
16829
|
};
|
|
16830
16830
|
var loadVoiceRealCallProfileEvidenceFromTraceStore = async (options) => buildVoiceRealCallProfileEvidenceFromTraceEvents(await options.store.list({ limit: options.limit ?? 5000 }), options);
|
|
16831
|
+
var loadVoiceRealCallProfileEvidenceFromStore = async (options) => options.store.list(options);
|
|
16831
16832
|
var realCallProfileTraceSignalTypes = new Set([
|
|
16832
16833
|
"client.barge_in",
|
|
16833
16834
|
"client.browser_media",
|
|
@@ -17670,6 +17671,74 @@ var createVoiceInMemoryRealCallProfileRecoveryJobStore = (options = {}) => {
|
|
|
17670
17671
|
}
|
|
17671
17672
|
};
|
|
17672
17673
|
};
|
|
17674
|
+
var normalizeRealCallProfileEvidenceTableName = (value) => value.trim().replace(/[^a-zA-Z0-9_]+/g, "_").replace(/^_+|_+$/g, "") || "voice_real_call_profile_evidence";
|
|
17675
|
+
var parseRealCallProfileEvidenceBoundary = (value) => value === undefined ? undefined : value instanceof Date ? value.getTime() : typeof value === "number" ? value : Date.parse(value);
|
|
17676
|
+
var readRealCallProfileEvidenceSortTime = (evidence, fallback) => Date.parse(evidence.generatedAt ?? fallback) || Date.parse(fallback);
|
|
17677
|
+
var createVoiceSQLiteRealCallProfileEvidenceStore = (options = {}) => {
|
|
17678
|
+
const { Database: SQLiteDatabase } = __require("bun:sqlite");
|
|
17679
|
+
const database = options.database ?? new SQLiteDatabase(options.path ?? ":memory:", {
|
|
17680
|
+
create: true
|
|
17681
|
+
});
|
|
17682
|
+
const tableName = normalizeRealCallProfileEvidenceTableName(options.tableName ?? "voice_real_call_profile_evidence");
|
|
17683
|
+
const now = () => (options.now ?? (() => new Date))().toISOString();
|
|
17684
|
+
const createId3 = () => `${options.idPrefix ?? "voice-profile-evidence"}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
17685
|
+
database.exec("PRAGMA journal_mode = WAL;");
|
|
17686
|
+
database.exec("PRAGMA synchronous = NORMAL;");
|
|
17687
|
+
database.exec("PRAGMA busy_timeout = 5000;");
|
|
17688
|
+
database.exec(`CREATE TABLE IF NOT EXISTS "${tableName}" (
|
|
17689
|
+
id TEXT PRIMARY KEY,
|
|
17690
|
+
sort_at INTEGER NOT NULL,
|
|
17691
|
+
profile_id TEXT NOT NULL,
|
|
17692
|
+
session_id TEXT NOT NULL,
|
|
17693
|
+
created_at TEXT NOT NULL,
|
|
17694
|
+
payload TEXT NOT NULL
|
|
17695
|
+
)`);
|
|
17696
|
+
const selectStatement = database.query(`SELECT payload FROM "${tableName}" WHERE id = ?1 LIMIT 1`);
|
|
17697
|
+
const listStatement = database.query(`SELECT payload FROM "${tableName}" ORDER BY sort_at DESC, id DESC`);
|
|
17698
|
+
const upsertStatement = database.query(`INSERT INTO "${tableName}" (id, sort_at, profile_id, session_id, created_at, payload)
|
|
17699
|
+
VALUES (?1, ?2, ?3, ?4, ?5, ?6)
|
|
17700
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
17701
|
+
sort_at = excluded.sort_at,
|
|
17702
|
+
profile_id = excluded.profile_id,
|
|
17703
|
+
session_id = excluded.session_id,
|
|
17704
|
+
created_at = excluded.created_at,
|
|
17705
|
+
payload = excluded.payload`);
|
|
17706
|
+
const deleteStatement = database.query(`DELETE FROM "${tableName}" WHERE id = ?1`);
|
|
17707
|
+
const writeEvidence = (record) => {
|
|
17708
|
+
upsertStatement.run(record.id, readRealCallProfileEvidenceSortTime(record, record.createdAt), record.profileId, record.sessionId, record.createdAt, JSON.stringify(record));
|
|
17709
|
+
return record;
|
|
17710
|
+
};
|
|
17711
|
+
const readEvidence = (id) => {
|
|
17712
|
+
const row = selectStatement.get(id);
|
|
17713
|
+
return row ? JSON.parse(row.payload) : undefined;
|
|
17714
|
+
};
|
|
17715
|
+
const matchesListOptions = (record, input) => {
|
|
17716
|
+
const evidenceTime = readRealCallProfileEvidenceSortTime(record, record.createdAt);
|
|
17717
|
+
const since = parseRealCallProfileEvidenceBoundary(input.since);
|
|
17718
|
+
const until = parseRealCallProfileEvidenceBoundary(input.until);
|
|
17719
|
+
return (!input.profileId || record.profileId === input.profileId) && (!input.sessionId || record.sessionId === input.sessionId) && (since === undefined || Number.isNaN(since) || evidenceTime >= since) && (until === undefined || Number.isNaN(until) || evidenceTime <= until);
|
|
17720
|
+
};
|
|
17721
|
+
return {
|
|
17722
|
+
append(input) {
|
|
17723
|
+
const createdAt = input.createdAt ?? now();
|
|
17724
|
+
return writeEvidence({
|
|
17725
|
+
...input,
|
|
17726
|
+
createdAt,
|
|
17727
|
+
id: input.id ?? createId3()
|
|
17728
|
+
});
|
|
17729
|
+
},
|
|
17730
|
+
get(id) {
|
|
17731
|
+
return readEvidence(id);
|
|
17732
|
+
},
|
|
17733
|
+
list(input = {}) {
|
|
17734
|
+
const limit = Number.isFinite(input.limit) && input.limit !== undefined && input.limit > 0 ? Math.floor(input.limit) : 500;
|
|
17735
|
+
return listStatement.all().map((row) => JSON.parse(row.payload)).filter((record) => matchesListOptions(record, input)).slice(0, limit);
|
|
17736
|
+
},
|
|
17737
|
+
remove(id) {
|
|
17738
|
+
deleteStatement.run(id);
|
|
17739
|
+
}
|
|
17740
|
+
};
|
|
17741
|
+
};
|
|
17673
17742
|
var normalizeRealCallRecoveryJobTableName = (value) => value.trim().replace(/[^a-zA-Z0-9_]+/g, "_").replace(/^_+|_+$/g, "") || "voice_real_call_profile_recovery_jobs";
|
|
17674
17743
|
var createVoiceSQLiteRealCallProfileRecoveryJobStore = (options = {}) => {
|
|
17675
17744
|
const { Database: SQLiteDatabase } = __require("bun:sqlite");
|
|
@@ -17923,6 +17992,13 @@ var buildVoiceRealCallProfileHistoryReport = (options = {}) => {
|
|
|
17923
17992
|
trend
|
|
17924
17993
|
};
|
|
17925
17994
|
};
|
|
17995
|
+
var buildVoiceRealCallProfileHistoryReportFromStore = async (options) => {
|
|
17996
|
+
const evidence = await options.store.list(options);
|
|
17997
|
+
return buildVoiceRealCallProfileHistoryReport({
|
|
17998
|
+
...options,
|
|
17999
|
+
evidence
|
|
18000
|
+
});
|
|
18001
|
+
};
|
|
17926
18002
|
var normalizeProviderStatus = (status) => status === "pass" ? "pass" : status === "fail" ? "fail" : "warn";
|
|
17927
18003
|
var providerSortScore = (provider) => [
|
|
17928
18004
|
recommendationStatusRank[provider.status],
|
|
@@ -42307,6 +42383,7 @@ export {
|
|
|
42307
42383
|
markVoiceOpsTaskSLABreached,
|
|
42308
42384
|
mapVoiceProofTargetsWithConcurrency,
|
|
42309
42385
|
loadVoiceRealCallProfileEvidenceFromTraceStore,
|
|
42386
|
+
loadVoiceRealCallProfileEvidenceFromStore,
|
|
42310
42387
|
loadVoiceObservabilityExportReplaySource,
|
|
42311
42388
|
listVoiceRoutingEvents,
|
|
42312
42389
|
listVoiceProviderDecisionTraces,
|
|
@@ -42454,6 +42531,7 @@ export {
|
|
|
42454
42531
|
createVoiceSQLiteRuntimeStorage,
|
|
42455
42532
|
createVoiceSQLiteReviewStore,
|
|
42456
42533
|
createVoiceSQLiteRealCallProfileRecoveryJobStore,
|
|
42534
|
+
createVoiceSQLiteRealCallProfileEvidenceStore,
|
|
42457
42535
|
createVoiceSQLitePlivoWebhookNonceStore,
|
|
42458
42536
|
createVoiceSQLiteIntegrationEventStore,
|
|
42459
42537
|
createVoiceSQLiteExternalObjectMapStore,
|
|
@@ -42717,6 +42795,7 @@ export {
|
|
|
42717
42795
|
buildVoiceRealCallProfileRecoveryJobHistoryCheck,
|
|
42718
42796
|
buildVoiceRealCallProfileRecoveryActions,
|
|
42719
42797
|
buildVoiceRealCallProfileReadinessCheck,
|
|
42798
|
+
buildVoiceRealCallProfileHistoryReportFromStore,
|
|
42720
42799
|
buildVoiceRealCallProfileHistoryReport,
|
|
42721
42800
|
buildVoiceRealCallProfileEvidenceFromTraceEvents,
|
|
42722
42801
|
buildVoiceRealCallProfileEvidenceFromReconnectProofReports,
|
package/dist/proofTrends.d.ts
CHANGED
|
@@ -162,6 +162,34 @@ export type VoiceProofTrendRealCallProfileEvidence = {
|
|
|
162
162
|
surfaces?: string[];
|
|
163
163
|
turnP95Ms?: number;
|
|
164
164
|
};
|
|
165
|
+
export type VoiceRealCallProfileEvidenceRecord = VoiceProofTrendRealCallProfileEvidence & {
|
|
166
|
+
createdAt: string;
|
|
167
|
+
id: string;
|
|
168
|
+
};
|
|
169
|
+
export type VoiceRealCallProfileEvidenceCreateInput = VoiceProofTrendRealCallProfileEvidence & {
|
|
170
|
+
createdAt?: string;
|
|
171
|
+
id?: string;
|
|
172
|
+
};
|
|
173
|
+
export type VoiceRealCallProfileEvidenceListOptions = {
|
|
174
|
+
limit?: number;
|
|
175
|
+
profileId?: string;
|
|
176
|
+
sessionId?: string;
|
|
177
|
+
since?: Date | number | string;
|
|
178
|
+
until?: Date | number | string;
|
|
179
|
+
};
|
|
180
|
+
export type VoiceRealCallProfileEvidenceStore = {
|
|
181
|
+
append(input: VoiceRealCallProfileEvidenceCreateInput): Promise<VoiceRealCallProfileEvidenceRecord> | VoiceRealCallProfileEvidenceRecord;
|
|
182
|
+
get(id: string): Promise<VoiceRealCallProfileEvidenceRecord | undefined> | VoiceRealCallProfileEvidenceRecord | undefined;
|
|
183
|
+
list(options?: VoiceRealCallProfileEvidenceListOptions): Promise<VoiceRealCallProfileEvidenceRecord[]> | VoiceRealCallProfileEvidenceRecord[];
|
|
184
|
+
remove(id: string): Promise<void> | void;
|
|
185
|
+
};
|
|
186
|
+
export type VoiceSQLiteRealCallProfileEvidenceStoreOptions = {
|
|
187
|
+
database?: Database;
|
|
188
|
+
idPrefix?: string;
|
|
189
|
+
now?: () => Date;
|
|
190
|
+
path?: string;
|
|
191
|
+
tableName?: string;
|
|
192
|
+
};
|
|
165
193
|
export type VoiceReconnectRealCallProfileEvidenceOptions = {
|
|
166
194
|
operationsRecordHref?: string | ((report: VoiceReconnectProofReport | VoiceReconnectContractReport, index: number) => string | undefined);
|
|
167
195
|
profileDescription?: string;
|
|
@@ -607,6 +635,9 @@ export declare const readVoiceProofTrendReportFile: (path: string, options?: {
|
|
|
607
635
|
export declare const buildVoiceRealCallProfileEvidenceFromTraceEvents: (events: readonly StoredVoiceTraceEvent[], options?: VoiceRealCallProfileTraceEvidenceOptions) => VoiceProofTrendRealCallProfileEvidence[];
|
|
608
636
|
export declare const buildVoiceRealCallProfileEvidenceFromReconnectProofReports: (input: VoiceReconnectProofReport | VoiceReconnectContractReport | readonly (VoiceReconnectProofReport | VoiceReconnectContractReport)[], options?: VoiceReconnectRealCallProfileEvidenceOptions) => VoiceProofTrendRealCallProfileEvidence[];
|
|
609
637
|
export declare const loadVoiceRealCallProfileEvidenceFromTraceStore: (options: VoiceRealCallProfileTraceStoreEvidenceOptions) => Promise<VoiceProofTrendRealCallProfileEvidence[]>;
|
|
638
|
+
export declare const loadVoiceRealCallProfileEvidenceFromStore: (options: VoiceRealCallProfileEvidenceListOptions & {
|
|
639
|
+
store: VoiceRealCallProfileEvidenceStore;
|
|
640
|
+
}) => Promise<VoiceRealCallProfileEvidenceRecord[]>;
|
|
610
641
|
export declare const createVoiceRealCallProfileTraceCollector: <TEvent extends StoredVoiceTraceEvent = StoredVoiceTraceEvent>(options: VoiceRealCallProfileTraceCollectorOptions<TEvent>) => VoiceRealCallProfileTraceCollector<TEvent>;
|
|
611
642
|
export declare const buildVoiceProofTrendProfileSummaries: (input: VoiceProofTrendReport | readonly VoiceProofTrendReport[], options?: VoiceProofTrendProfileSummaryOptions) => VoiceProofTrendProfileSummary[];
|
|
612
643
|
export declare const buildVoiceProofTrendReportFromRealCallProfiles: (options: VoiceProofTrendRealCallProfileReportOptions) => VoiceProofTrendReport;
|
|
@@ -618,11 +649,15 @@ export declare const createVoiceInMemoryRealCallProfileRecoveryJobStore: (option
|
|
|
618
649
|
idPrefix?: string;
|
|
619
650
|
now?: () => Date;
|
|
620
651
|
}) => VoiceRealCallProfileRecoveryJobStore;
|
|
652
|
+
export declare const createVoiceSQLiteRealCallProfileEvidenceStore: (options?: VoiceSQLiteRealCallProfileEvidenceStoreOptions) => VoiceRealCallProfileEvidenceStore;
|
|
621
653
|
export declare const createVoiceSQLiteRealCallProfileRecoveryJobStore: (options?: VoiceSQLiteRealCallProfileRecoveryJobStoreOptions) => VoiceRealCallProfileRecoveryJobStore;
|
|
622
654
|
export declare const buildVoiceRealCallProfileReadinessCheck: (report: VoiceRealCallProfileHistoryReport, options?: VoiceRealCallProfileReadinessCheckOptions) => VoiceProductionReadinessCheck;
|
|
623
655
|
export declare const buildVoiceRealCallProfileRecoveryJobHistoryCheck: (store: Pick<VoiceRealCallProfileRecoveryJobStore, "list"> | undefined, options?: VoiceRealCallProfileRecoveryJobHistoryCheckOptions) => Promise<VoiceProductionReadinessCheck>;
|
|
624
656
|
export declare const resolveVoiceRealCallProfileProviderRoute: <TProvider extends string = string>(options: VoiceRealCallProfileProviderRouteOptions<TProvider>) => TProvider | undefined;
|
|
625
657
|
export declare const buildVoiceRealCallProfileHistoryReport: (options?: VoiceRealCallProfileHistoryOptions) => VoiceRealCallProfileHistoryReport;
|
|
658
|
+
export declare const buildVoiceRealCallProfileHistoryReportFromStore: (options: Omit<VoiceRealCallProfileHistoryOptions, "evidence"> & VoiceRealCallProfileEvidenceListOptions & {
|
|
659
|
+
store: VoiceRealCallProfileEvidenceStore;
|
|
660
|
+
}) => Promise<VoiceRealCallProfileHistoryReport>;
|
|
626
661
|
export declare const evaluateVoiceProofTrendEvidence: (report: VoiceProofTrendReport, input?: VoiceProofTrendAssertionInput) => VoiceProofTrendAssertionReport;
|
|
627
662
|
export declare const assertVoiceProofTrendEvidence: (report: VoiceProofTrendReport, input?: VoiceProofTrendAssertionInput) => VoiceProofTrendAssertionReport;
|
|
628
663
|
export declare const buildVoiceProofTrendRecommendationReport: (report: VoiceProofTrendReport, options?: VoiceProofTrendRecommendationOptions) => VoiceProofTrendRecommendationReport;
|
package/dist/react/index.js
CHANGED
|
@@ -3733,6 +3733,7 @@ var buildVoiceRealCallProfileEvidenceFromReconnectProofReports = (input, options
|
|
|
3733
3733
|
});
|
|
3734
3734
|
};
|
|
3735
3735
|
var loadVoiceRealCallProfileEvidenceFromTraceStore = async (options) => buildVoiceRealCallProfileEvidenceFromTraceEvents(await options.store.list({ limit: options.limit ?? 5000 }), options);
|
|
3736
|
+
var loadVoiceRealCallProfileEvidenceFromStore = async (options) => options.store.list(options);
|
|
3736
3737
|
var realCallProfileTraceSignalTypes = new Set([
|
|
3737
3738
|
"client.barge_in",
|
|
3738
3739
|
"client.browser_media",
|
|
@@ -4575,6 +4576,74 @@ var createVoiceInMemoryRealCallProfileRecoveryJobStore = (options = {}) => {
|
|
|
4575
4576
|
}
|
|
4576
4577
|
};
|
|
4577
4578
|
};
|
|
4579
|
+
var normalizeRealCallProfileEvidenceTableName = (value) => value.trim().replace(/[^a-zA-Z0-9_]+/g, "_").replace(/^_+|_+$/g, "") || "voice_real_call_profile_evidence";
|
|
4580
|
+
var parseRealCallProfileEvidenceBoundary = (value) => value === undefined ? undefined : value instanceof Date ? value.getTime() : typeof value === "number" ? value : Date.parse(value);
|
|
4581
|
+
var readRealCallProfileEvidenceSortTime = (evidence, fallback) => Date.parse(evidence.generatedAt ?? fallback) || Date.parse(fallback);
|
|
4582
|
+
var createVoiceSQLiteRealCallProfileEvidenceStore = (options = {}) => {
|
|
4583
|
+
const { Database: SQLiteDatabase } = __require("bun:sqlite");
|
|
4584
|
+
const database = options.database ?? new SQLiteDatabase(options.path ?? ":memory:", {
|
|
4585
|
+
create: true
|
|
4586
|
+
});
|
|
4587
|
+
const tableName = normalizeRealCallProfileEvidenceTableName(options.tableName ?? "voice_real_call_profile_evidence");
|
|
4588
|
+
const now = () => (options.now ?? (() => new Date))().toISOString();
|
|
4589
|
+
const createId = () => `${options.idPrefix ?? "voice-profile-evidence"}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
4590
|
+
database.exec("PRAGMA journal_mode = WAL;");
|
|
4591
|
+
database.exec("PRAGMA synchronous = NORMAL;");
|
|
4592
|
+
database.exec("PRAGMA busy_timeout = 5000;");
|
|
4593
|
+
database.exec(`CREATE TABLE IF NOT EXISTS "${tableName}" (
|
|
4594
|
+
id TEXT PRIMARY KEY,
|
|
4595
|
+
sort_at INTEGER NOT NULL,
|
|
4596
|
+
profile_id TEXT NOT NULL,
|
|
4597
|
+
session_id TEXT NOT NULL,
|
|
4598
|
+
created_at TEXT NOT NULL,
|
|
4599
|
+
payload TEXT NOT NULL
|
|
4600
|
+
)`);
|
|
4601
|
+
const selectStatement = database.query(`SELECT payload FROM "${tableName}" WHERE id = ?1 LIMIT 1`);
|
|
4602
|
+
const listStatement = database.query(`SELECT payload FROM "${tableName}" ORDER BY sort_at DESC, id DESC`);
|
|
4603
|
+
const upsertStatement = database.query(`INSERT INTO "${tableName}" (id, sort_at, profile_id, session_id, created_at, payload)
|
|
4604
|
+
VALUES (?1, ?2, ?3, ?4, ?5, ?6)
|
|
4605
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
4606
|
+
sort_at = excluded.sort_at,
|
|
4607
|
+
profile_id = excluded.profile_id,
|
|
4608
|
+
session_id = excluded.session_id,
|
|
4609
|
+
created_at = excluded.created_at,
|
|
4610
|
+
payload = excluded.payload`);
|
|
4611
|
+
const deleteStatement = database.query(`DELETE FROM "${tableName}" WHERE id = ?1`);
|
|
4612
|
+
const writeEvidence = (record) => {
|
|
4613
|
+
upsertStatement.run(record.id, readRealCallProfileEvidenceSortTime(record, record.createdAt), record.profileId, record.sessionId, record.createdAt, JSON.stringify(record));
|
|
4614
|
+
return record;
|
|
4615
|
+
};
|
|
4616
|
+
const readEvidence = (id) => {
|
|
4617
|
+
const row = selectStatement.get(id);
|
|
4618
|
+
return row ? JSON.parse(row.payload) : undefined;
|
|
4619
|
+
};
|
|
4620
|
+
const matchesListOptions = (record, input) => {
|
|
4621
|
+
const evidenceTime = readRealCallProfileEvidenceSortTime(record, record.createdAt);
|
|
4622
|
+
const since = parseRealCallProfileEvidenceBoundary(input.since);
|
|
4623
|
+
const until = parseRealCallProfileEvidenceBoundary(input.until);
|
|
4624
|
+
return (!input.profileId || record.profileId === input.profileId) && (!input.sessionId || record.sessionId === input.sessionId) && (since === undefined || Number.isNaN(since) || evidenceTime >= since) && (until === undefined || Number.isNaN(until) || evidenceTime <= until);
|
|
4625
|
+
};
|
|
4626
|
+
return {
|
|
4627
|
+
append(input) {
|
|
4628
|
+
const createdAt = input.createdAt ?? now();
|
|
4629
|
+
return writeEvidence({
|
|
4630
|
+
...input,
|
|
4631
|
+
createdAt,
|
|
4632
|
+
id: input.id ?? createId()
|
|
4633
|
+
});
|
|
4634
|
+
},
|
|
4635
|
+
get(id) {
|
|
4636
|
+
return readEvidence(id);
|
|
4637
|
+
},
|
|
4638
|
+
list(input = {}) {
|
|
4639
|
+
const limit = Number.isFinite(input.limit) && input.limit !== undefined && input.limit > 0 ? Math.floor(input.limit) : 500;
|
|
4640
|
+
return listStatement.all().map((row) => JSON.parse(row.payload)).filter((record) => matchesListOptions(record, input)).slice(0, limit);
|
|
4641
|
+
},
|
|
4642
|
+
remove(id) {
|
|
4643
|
+
deleteStatement.run(id);
|
|
4644
|
+
}
|
|
4645
|
+
};
|
|
4646
|
+
};
|
|
4578
4647
|
var normalizeRealCallRecoveryJobTableName = (value) => value.trim().replace(/[^a-zA-Z0-9_]+/g, "_").replace(/^_+|_+$/g, "") || "voice_real_call_profile_recovery_jobs";
|
|
4579
4648
|
var createVoiceSQLiteRealCallProfileRecoveryJobStore = (options = {}) => {
|
|
4580
4649
|
const { Database: SQLiteDatabase } = __require("bun:sqlite");
|
|
@@ -4828,6 +4897,13 @@ var buildVoiceRealCallProfileHistoryReport = (options = {}) => {
|
|
|
4828
4897
|
trend
|
|
4829
4898
|
};
|
|
4830
4899
|
};
|
|
4900
|
+
var buildVoiceRealCallProfileHistoryReportFromStore = async (options) => {
|
|
4901
|
+
const evidence = await options.store.list(options);
|
|
4902
|
+
return buildVoiceRealCallProfileHistoryReport({
|
|
4903
|
+
...options,
|
|
4904
|
+
evidence
|
|
4905
|
+
});
|
|
4906
|
+
};
|
|
4831
4907
|
var normalizeProviderStatus = (status) => status === "pass" ? "pass" : status === "fail" ? "fail" : "warn";
|
|
4832
4908
|
var providerSortScore = (provider) => [
|
|
4833
4909
|
recommendationStatusRank[provider.status],
|
package/dist/vue/index.js
CHANGED
|
@@ -3654,6 +3654,7 @@ var buildVoiceRealCallProfileEvidenceFromReconnectProofReports = (input, options
|
|
|
3654
3654
|
});
|
|
3655
3655
|
};
|
|
3656
3656
|
var loadVoiceRealCallProfileEvidenceFromTraceStore = async (options) => buildVoiceRealCallProfileEvidenceFromTraceEvents(await options.store.list({ limit: options.limit ?? 5000 }), options);
|
|
3657
|
+
var loadVoiceRealCallProfileEvidenceFromStore = async (options) => options.store.list(options);
|
|
3657
3658
|
var realCallProfileTraceSignalTypes = new Set([
|
|
3658
3659
|
"client.barge_in",
|
|
3659
3660
|
"client.browser_media",
|
|
@@ -4496,6 +4497,74 @@ var createVoiceInMemoryRealCallProfileRecoveryJobStore = (options = {}) => {
|
|
|
4496
4497
|
}
|
|
4497
4498
|
};
|
|
4498
4499
|
};
|
|
4500
|
+
var normalizeRealCallProfileEvidenceTableName = (value) => value.trim().replace(/[^a-zA-Z0-9_]+/g, "_").replace(/^_+|_+$/g, "") || "voice_real_call_profile_evidence";
|
|
4501
|
+
var parseRealCallProfileEvidenceBoundary = (value) => value === undefined ? undefined : value instanceof Date ? value.getTime() : typeof value === "number" ? value : Date.parse(value);
|
|
4502
|
+
var readRealCallProfileEvidenceSortTime = (evidence, fallback) => Date.parse(evidence.generatedAt ?? fallback) || Date.parse(fallback);
|
|
4503
|
+
var createVoiceSQLiteRealCallProfileEvidenceStore = (options = {}) => {
|
|
4504
|
+
const { Database: SQLiteDatabase } = __require("bun:sqlite");
|
|
4505
|
+
const database = options.database ?? new SQLiteDatabase(options.path ?? ":memory:", {
|
|
4506
|
+
create: true
|
|
4507
|
+
});
|
|
4508
|
+
const tableName = normalizeRealCallProfileEvidenceTableName(options.tableName ?? "voice_real_call_profile_evidence");
|
|
4509
|
+
const now = () => (options.now ?? (() => new Date))().toISOString();
|
|
4510
|
+
const createId = () => `${options.idPrefix ?? "voice-profile-evidence"}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
4511
|
+
database.exec("PRAGMA journal_mode = WAL;");
|
|
4512
|
+
database.exec("PRAGMA synchronous = NORMAL;");
|
|
4513
|
+
database.exec("PRAGMA busy_timeout = 5000;");
|
|
4514
|
+
database.exec(`CREATE TABLE IF NOT EXISTS "${tableName}" (
|
|
4515
|
+
id TEXT PRIMARY KEY,
|
|
4516
|
+
sort_at INTEGER NOT NULL,
|
|
4517
|
+
profile_id TEXT NOT NULL,
|
|
4518
|
+
session_id TEXT NOT NULL,
|
|
4519
|
+
created_at TEXT NOT NULL,
|
|
4520
|
+
payload TEXT NOT NULL
|
|
4521
|
+
)`);
|
|
4522
|
+
const selectStatement = database.query(`SELECT payload FROM "${tableName}" WHERE id = ?1 LIMIT 1`);
|
|
4523
|
+
const listStatement = database.query(`SELECT payload FROM "${tableName}" ORDER BY sort_at DESC, id DESC`);
|
|
4524
|
+
const upsertStatement = database.query(`INSERT INTO "${tableName}" (id, sort_at, profile_id, session_id, created_at, payload)
|
|
4525
|
+
VALUES (?1, ?2, ?3, ?4, ?5, ?6)
|
|
4526
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
4527
|
+
sort_at = excluded.sort_at,
|
|
4528
|
+
profile_id = excluded.profile_id,
|
|
4529
|
+
session_id = excluded.session_id,
|
|
4530
|
+
created_at = excluded.created_at,
|
|
4531
|
+
payload = excluded.payload`);
|
|
4532
|
+
const deleteStatement = database.query(`DELETE FROM "${tableName}" WHERE id = ?1`);
|
|
4533
|
+
const writeEvidence = (record) => {
|
|
4534
|
+
upsertStatement.run(record.id, readRealCallProfileEvidenceSortTime(record, record.createdAt), record.profileId, record.sessionId, record.createdAt, JSON.stringify(record));
|
|
4535
|
+
return record;
|
|
4536
|
+
};
|
|
4537
|
+
const readEvidence = (id) => {
|
|
4538
|
+
const row = selectStatement.get(id);
|
|
4539
|
+
return row ? JSON.parse(row.payload) : undefined;
|
|
4540
|
+
};
|
|
4541
|
+
const matchesListOptions = (record, input) => {
|
|
4542
|
+
const evidenceTime = readRealCallProfileEvidenceSortTime(record, record.createdAt);
|
|
4543
|
+
const since = parseRealCallProfileEvidenceBoundary(input.since);
|
|
4544
|
+
const until = parseRealCallProfileEvidenceBoundary(input.until);
|
|
4545
|
+
return (!input.profileId || record.profileId === input.profileId) && (!input.sessionId || record.sessionId === input.sessionId) && (since === undefined || Number.isNaN(since) || evidenceTime >= since) && (until === undefined || Number.isNaN(until) || evidenceTime <= until);
|
|
4546
|
+
};
|
|
4547
|
+
return {
|
|
4548
|
+
append(input) {
|
|
4549
|
+
const createdAt = input.createdAt ?? now();
|
|
4550
|
+
return writeEvidence({
|
|
4551
|
+
...input,
|
|
4552
|
+
createdAt,
|
|
4553
|
+
id: input.id ?? createId()
|
|
4554
|
+
});
|
|
4555
|
+
},
|
|
4556
|
+
get(id) {
|
|
4557
|
+
return readEvidence(id);
|
|
4558
|
+
},
|
|
4559
|
+
list(input = {}) {
|
|
4560
|
+
const limit = Number.isFinite(input.limit) && input.limit !== undefined && input.limit > 0 ? Math.floor(input.limit) : 500;
|
|
4561
|
+
return listStatement.all().map((row) => JSON.parse(row.payload)).filter((record) => matchesListOptions(record, input)).slice(0, limit);
|
|
4562
|
+
},
|
|
4563
|
+
remove(id) {
|
|
4564
|
+
deleteStatement.run(id);
|
|
4565
|
+
}
|
|
4566
|
+
};
|
|
4567
|
+
};
|
|
4499
4568
|
var normalizeRealCallRecoveryJobTableName = (value) => value.trim().replace(/[^a-zA-Z0-9_]+/g, "_").replace(/^_+|_+$/g, "") || "voice_real_call_profile_recovery_jobs";
|
|
4500
4569
|
var createVoiceSQLiteRealCallProfileRecoveryJobStore = (options = {}) => {
|
|
4501
4570
|
const { Database: SQLiteDatabase } = __require("bun:sqlite");
|
|
@@ -4749,6 +4818,13 @@ var buildVoiceRealCallProfileHistoryReport = (options = {}) => {
|
|
|
4749
4818
|
trend
|
|
4750
4819
|
};
|
|
4751
4820
|
};
|
|
4821
|
+
var buildVoiceRealCallProfileHistoryReportFromStore = async (options) => {
|
|
4822
|
+
const evidence = await options.store.list(options);
|
|
4823
|
+
return buildVoiceRealCallProfileHistoryReport({
|
|
4824
|
+
...options,
|
|
4825
|
+
evidence
|
|
4826
|
+
});
|
|
4827
|
+
};
|
|
4752
4828
|
var normalizeProviderStatus = (status) => status === "pass" ? "pass" : status === "fail" ? "fail" : "warn";
|
|
4753
4829
|
var providerSortScore = (provider) => [
|
|
4754
4830
|
recommendationStatusRank[provider.status],
|