@absolutejs/voice 0.0.22-beta.373 → 0.0.22-beta.374

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
@@ -1537,6 +1537,14 @@ app.use(
1537
1537
  );
1538
1538
  ```
1539
1539
 
1540
+ Use the SQLite job store when recovery jobs should survive restarts:
1541
+
1542
+ ```ts
1543
+ const recoveryJobs = createVoiceSQLiteRealCallProfileRecoveryJobStore({
1544
+ path: '.voice-runtime/real-call-recovery/jobs.sqlite'
1545
+ });
1546
+ ```
1547
+
1540
1548
  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.
1541
1549
 
1542
1550
  ```ts
@@ -3907,6 +3907,7 @@ var defineVoicePlatformCoverageElement = (tagName = "absolute-voice-platform-cov
3907
3907
  };
3908
3908
  // src/proofTrends.ts
3909
3909
  import { Elysia } from "elysia";
3910
+ import { Database } from "bun:sqlite";
3910
3911
  var DEFAULT_VOICE_PROOF_TRENDS_MAX_AGE_MS = 24 * 60 * 60 * 1000;
3911
3912
  var DEFAULT_VOICE_PROOF_TREND_PROFILE_DEFINITIONS = [
3912
3913
  {
@@ -4663,6 +4664,62 @@ var createVoiceInMemoryRealCallProfileRecoveryJobStore = (options = {}) => {
4663
4664
  }
4664
4665
  };
4665
4666
  };
4667
+ var normalizeRealCallRecoveryJobTableName = (value) => value.trim().replace(/[^a-zA-Z0-9_]+/g, "_").replace(/^_+|_+$/g, "") || "voice_real_call_profile_recovery_jobs";
4668
+ var createVoiceSQLiteRealCallProfileRecoveryJobStore = (options = {}) => {
4669
+ const database = options.database ?? new Database(options.path ?? ":memory:", {
4670
+ create: true
4671
+ });
4672
+ const tableName = normalizeRealCallRecoveryJobTableName(options.tableName ?? "voice_real_call_profile_recovery_jobs");
4673
+ const now = () => (options.now ?? (() => new Date))().toISOString();
4674
+ const createId = () => `${options.idPrefix ?? "voice-recovery-job"}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
4675
+ database.exec("PRAGMA journal_mode = WAL;");
4676
+ database.exec("PRAGMA synchronous = NORMAL;");
4677
+ database.exec("PRAGMA busy_timeout = 5000;");
4678
+ database.exec(`CREATE TABLE IF NOT EXISTS "${tableName}" (
4679
+ id TEXT PRIMARY KEY,
4680
+ sort_at INTEGER NOT NULL,
4681
+ payload TEXT NOT NULL
4682
+ )`);
4683
+ const selectStatement = database.query(`SELECT payload FROM "${tableName}" WHERE id = ?1 LIMIT 1`);
4684
+ const upsertStatement = database.query(`INSERT INTO "${tableName}" (id, sort_at, payload)
4685
+ VALUES (?1, ?2, ?3)
4686
+ ON CONFLICT(id) DO UPDATE SET sort_at = excluded.sort_at, payload = excluded.payload`);
4687
+ const writeJob = (job) => {
4688
+ upsertStatement.run(job.id, Date.parse(job.updatedAt) || Date.now(), JSON.stringify(job));
4689
+ return job;
4690
+ };
4691
+ const readJob = (id) => {
4692
+ const row = selectStatement.get(id);
4693
+ return row ? JSON.parse(row.payload) : undefined;
4694
+ };
4695
+ return {
4696
+ create(input) {
4697
+ const createdAt = input.createdAt ?? now();
4698
+ return writeJob({
4699
+ actionId: input.actionId,
4700
+ createdAt,
4701
+ id: input.id ?? createId(),
4702
+ message: input.message,
4703
+ status: input.status ?? "queued",
4704
+ updatedAt: createdAt
4705
+ });
4706
+ },
4707
+ get(id) {
4708
+ return readJob(id);
4709
+ },
4710
+ update(id, update) {
4711
+ const existing = readJob(id);
4712
+ if (!existing) {
4713
+ return;
4714
+ }
4715
+ return writeJob({
4716
+ ...existing,
4717
+ ...update,
4718
+ updatedAt: update.updatedAt ?? now()
4719
+ });
4720
+ }
4721
+ };
4722
+ };
4666
4723
  var buildVoiceRealCallProfileReadinessCheck = (report, options = {}) => {
4667
4724
  const { issues, warnings } = buildRealCallProfileReadinessIssues(report, options);
4668
4725
  const status = issues.length > 0 ? "fail" : warnings.length > 0 && options.failOnWarnings === true ? "fail" : warnings.length > 0 ? "warn" : "pass";
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, buildVoiceRealCallProfileReadinessCheck, buildVoiceRealCallProfileRecoveryActions, createVoiceInMemoryRealCallProfileRecoveryJobStore, 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, resolveVoiceRealCallProfileProviderRoute } from './proofTrends';
33
+ export { assertVoiceProofTrendEvidence, buildEmptyVoiceProofTrendReport, buildVoiceProofTrendProfileSummaries, buildVoiceProofTrendRecommendationReport, buildVoiceProofTrendReportFromRealCallProfiles, buildVoiceProofTrendReport, buildVoiceRealCallProfileEvidenceFromTraceEvents, buildVoiceRealCallProfileDefaults, buildVoiceRealCallProfileHistoryReport, buildVoiceRealCallProfileReadinessCheck, buildVoiceRealCallProfileRecoveryActions, createVoiceInMemoryRealCallProfileRecoveryJobStore, 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, 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, VoiceRealCallProfileReadinessCheckOptions, VoiceRealCallProfileRecoveryActionOptions, VoiceRealCallProfileRecoveryAction, VoiceRealCallProfileRecoveryActionHandler, VoiceRealCallProfileRecoveryActionHandlerInput, VoiceRealCallProfileRecoveryActionId, VoiceRealCallProfileRecoveryActionResult, VoiceRealCallProfileRecoveryActionRoutesOptions, VoiceRealCallProfileRecoveryJob, VoiceRealCallProfileRecoveryJobCreateInput, VoiceRealCallProfileRecoveryJobStatus, VoiceRealCallProfileRecoveryJobStore, VoiceRealCallProfileRecoveryJobUpdate, 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, VoiceRealCallProfileRecoveryActionOptions, VoiceRealCallProfileRecoveryAction, VoiceRealCallProfileRecoveryActionHandler, VoiceRealCallProfileRecoveryActionHandlerInput, VoiceRealCallProfileRecoveryActionId, VoiceRealCallProfileRecoveryActionResult, VoiceRealCallProfileRecoveryActionRoutesOptions, VoiceRealCallProfileRecoveryJob, VoiceRealCallProfileRecoveryJobCreateInput, VoiceRealCallProfileRecoveryJobStatus, VoiceRealCallProfileRecoveryJobStore, VoiceRealCallProfileRecoveryJobUpdate, VoiceSQLiteRealCallProfileRecoveryJobStoreOptions, 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
@@ -15376,6 +15376,7 @@ var createVoiceCompetitiveCoverageRoutes = (options) => {
15376
15376
  };
15377
15377
  // src/proofTrends.ts
15378
15378
  import { Elysia as Elysia22 } from "elysia";
15379
+ import { Database } from "bun:sqlite";
15379
15380
  var DEFAULT_VOICE_PROOF_TRENDS_MAX_AGE_MS = 24 * 60 * 60 * 1000;
15380
15381
  var DEFAULT_VOICE_PROOF_TREND_PROFILE_DEFINITIONS = [
15381
15382
  {
@@ -16132,6 +16133,62 @@ var createVoiceInMemoryRealCallProfileRecoveryJobStore = (options = {}) => {
16132
16133
  }
16133
16134
  };
16134
16135
  };
16136
+ var normalizeRealCallRecoveryJobTableName = (value) => value.trim().replace(/[^a-zA-Z0-9_]+/g, "_").replace(/^_+|_+$/g, "") || "voice_real_call_profile_recovery_jobs";
16137
+ var createVoiceSQLiteRealCallProfileRecoveryJobStore = (options = {}) => {
16138
+ const database = options.database ?? new Database(options.path ?? ":memory:", {
16139
+ create: true
16140
+ });
16141
+ const tableName = normalizeRealCallRecoveryJobTableName(options.tableName ?? "voice_real_call_profile_recovery_jobs");
16142
+ const now = () => (options.now ?? (() => new Date))().toISOString();
16143
+ const createId3 = () => `${options.idPrefix ?? "voice-recovery-job"}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
16144
+ database.exec("PRAGMA journal_mode = WAL;");
16145
+ database.exec("PRAGMA synchronous = NORMAL;");
16146
+ database.exec("PRAGMA busy_timeout = 5000;");
16147
+ database.exec(`CREATE TABLE IF NOT EXISTS "${tableName}" (
16148
+ id TEXT PRIMARY KEY,
16149
+ sort_at INTEGER NOT NULL,
16150
+ payload TEXT NOT NULL
16151
+ )`);
16152
+ const selectStatement = database.query(`SELECT payload FROM "${tableName}" WHERE id = ?1 LIMIT 1`);
16153
+ const upsertStatement = database.query(`INSERT INTO "${tableName}" (id, sort_at, payload)
16154
+ VALUES (?1, ?2, ?3)
16155
+ ON CONFLICT(id) DO UPDATE SET sort_at = excluded.sort_at, payload = excluded.payload`);
16156
+ const writeJob = (job) => {
16157
+ upsertStatement.run(job.id, Date.parse(job.updatedAt) || Date.now(), JSON.stringify(job));
16158
+ return job;
16159
+ };
16160
+ const readJob = (id) => {
16161
+ const row = selectStatement.get(id);
16162
+ return row ? JSON.parse(row.payload) : undefined;
16163
+ };
16164
+ return {
16165
+ create(input) {
16166
+ const createdAt = input.createdAt ?? now();
16167
+ return writeJob({
16168
+ actionId: input.actionId,
16169
+ createdAt,
16170
+ id: input.id ?? createId3(),
16171
+ message: input.message,
16172
+ status: input.status ?? "queued",
16173
+ updatedAt: createdAt
16174
+ });
16175
+ },
16176
+ get(id) {
16177
+ return readJob(id);
16178
+ },
16179
+ update(id, update) {
16180
+ const existing = readJob(id);
16181
+ if (!existing) {
16182
+ return;
16183
+ }
16184
+ return writeJob({
16185
+ ...existing,
16186
+ ...update,
16187
+ updatedAt: update.updatedAt ?? now()
16188
+ });
16189
+ }
16190
+ };
16191
+ };
16135
16192
  var buildVoiceRealCallProfileReadinessCheck = (report, options = {}) => {
16136
16193
  const { issues, warnings } = buildRealCallProfileReadinessIssues(report, options);
16137
16194
  const status = issues.length > 0 ? "fail" : warnings.length > 0 && options.failOnWarnings === true ? "fail" : warnings.length > 0 ? "warn" : "pass";
@@ -23562,7 +23619,7 @@ import { Elysia as Elysia45 } from "elysia";
23562
23619
 
23563
23620
  // src/telephony/plivo.ts
23564
23621
  import { Buffer as Buffer5 } from "buffer";
23565
- import { Database } from "bun:sqlite";
23622
+ import { Database as Database2 } from "bun:sqlite";
23566
23623
  import { Elysia as Elysia41 } from "elysia";
23567
23624
 
23568
23625
  // src/telephony/contract.ts
@@ -24689,7 +24746,7 @@ var resolvePlivoNonceTableName = (input) => {
24689
24746
  };
24690
24747
  var getPlivoNonceExpiresAt = (ttlSeconds) => typeof ttlSeconds === "number" && ttlSeconds > 0 ? Date.now() + Math.ceil(ttlSeconds * 1000) : null;
24691
24748
  var createVoiceSQLitePlivoWebhookNonceStore = (options) => {
24692
- const database = options.database ?? new Database(options.path ?? ":memory:", {
24749
+ const database = options.database ?? new Database2(options.path ?? ":memory:", {
24693
24750
  create: true
24694
24751
  });
24695
24752
  const tableName = resolvePlivoNonceTableName({
@@ -25089,7 +25146,7 @@ var createPlivoVoiceRoutes = (options = {}) => {
25089
25146
 
25090
25147
  // src/telephony/telnyx.ts
25091
25148
  import { Buffer as Buffer6 } from "buffer";
25092
- import { Database as Database2 } from "bun:sqlite";
25149
+ import { Database as Database3 } from "bun:sqlite";
25093
25150
  import { Elysia as Elysia42 } from "elysia";
25094
25151
  var escapeXml4 = (value) => value.replaceAll("&", "&amp;").replaceAll('"', "&quot;").replaceAll("'", "&apos;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
25095
25152
  var escapeHtml42 = (value) => value.replaceAll("&", "&amp;").replaceAll('"', "&quot;").replaceAll("'", "&#39;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
@@ -25289,7 +25346,7 @@ var resolveTelnyxEventTableName = (input) => {
25289
25346
  };
25290
25347
  var getTelnyxEventExpiresAt = (ttlSeconds) => typeof ttlSeconds === "number" && ttlSeconds > 0 ? Date.now() + Math.ceil(ttlSeconds * 1000) : null;
25291
25348
  var createVoiceSQLiteTelnyxWebhookEventStore = (options) => {
25292
- const database = options.database ?? new Database2(options.path ?? ":memory:", {
25349
+ const database = options.database ?? new Database3(options.path ?? ":memory:", {
25293
25350
  create: true
25294
25351
  });
25295
25352
  const tableName = resolveTelnyxEventTableName({
@@ -29020,7 +29077,7 @@ var createVoicePostgresRuntimeStorage = (options) => {
29020
29077
  };
29021
29078
 
29022
29079
  // src/sqliteStore.ts
29023
- import { Database as Database3 } from "bun:sqlite";
29080
+ import { Database as Database4 } from "bun:sqlite";
29024
29081
  var normalizeTableNameSegment = (value) => value.trim().replace(/[^a-zA-Z0-9_]+/g, "_").replace(/^_+|_+$/g, "") || "voice";
29025
29082
  var resolveTableName = (input) => {
29026
29083
  if (input.options.tableName) {
@@ -29031,7 +29088,7 @@ var resolveTableName = (input) => {
29031
29088
  return `${prefix}_${fallback}`;
29032
29089
  };
29033
29090
  var openVoiceSQLiteDatabase = (path) => {
29034
- const database = new Database3(path, {
29091
+ const database = new Database4(path, {
29035
29092
  create: true
29036
29093
  });
29037
29094
  database.exec("PRAGMA journal_mode = WAL;");
@@ -29810,7 +29867,7 @@ var createVoiceOpsRecoveryRoutes = (options = {}) => {
29810
29867
 
29811
29868
  // src/observabilityExport.ts
29812
29869
  import { Elysia as Elysia53 } from "elysia";
29813
- import { Database as Database4 } from "bun:sqlite";
29870
+ import { Database as Database5 } from "bun:sqlite";
29814
29871
  import { createHash } from "crypto";
29815
29872
  import { mkdir as mkdir4, readFile as readFile2, stat, unlink } from "fs/promises";
29816
29873
  import { join as join3 } from "path";
@@ -31429,7 +31486,7 @@ var loadVoiceObservabilityExportReplaySource = async (source) => {
31429
31486
  if (!source.database && !source.path) {
31430
31487
  throw new Error("SQLite observability export replay requires source.database or source.path.");
31431
31488
  }
31432
- const database = source.database ?? new Database4(source.path, { create: false });
31489
+ const database = source.database ?? new Database5(source.path, { create: false });
31433
31490
  const table2 = quoteObservabilityIdentifier(normalizeObservabilityIdentifier(source.tableName));
31434
31491
  const row2 = database.query(`SELECT manifest_json, artifact_index_json, payload_json FROM ${table2} WHERE run_id = $runId`).get({ $runId: source.runId });
31435
31492
  if (!row2) {
@@ -31506,7 +31563,7 @@ var deliverObservabilityExportToSQLite = async (input) => {
31506
31563
  if (!input.destination.database && !input.destination.path) {
31507
31564
  throw new Error("SQLite observability export delivery requires destination.database or destination.path.");
31508
31565
  }
31509
- const database = input.destination.database ?? new Database4(input.destination.path, { create: true });
31566
+ const database = input.destination.database ?? new Database5(input.destination.path, { create: true });
31510
31567
  const table = quoteObservabilityIdentifier(normalizeObservabilityIdentifier(input.destination.tableName));
31511
31568
  const record = buildObservabilityExportDatabaseRecord(input);
31512
31569
  database.exec(`CREATE TABLE IF NOT EXISTS ${table} (
@@ -38938,6 +38995,7 @@ export {
38938
38995
  createVoiceSQLiteSessionStore,
38939
38996
  createVoiceSQLiteRuntimeStorage,
38940
38997
  createVoiceSQLiteReviewStore,
38998
+ createVoiceSQLiteRealCallProfileRecoveryJobStore,
38941
38999
  createVoiceSQLitePlivoWebhookNonceStore,
38942
39000
  createVoiceSQLiteIntegrationEventStore,
38943
39001
  createVoiceSQLiteExternalObjectMapStore,
@@ -1,4 +1,5 @@
1
1
  import { Elysia } from 'elysia';
2
+ import { Database } from 'bun:sqlite';
2
3
  import type { VoiceProductionReadinessAction, VoiceProductionReadinessCheck } from './productionReadiness';
3
4
  import type { StoredVoiceTraceEvent, VoiceTraceEventStore } from './trace';
4
5
  export type VoiceProofTrendStatus = 'empty' | 'fail' | 'pass' | 'stale';
@@ -418,6 +419,13 @@ export type VoiceRealCallProfileRecoveryJobStore = {
418
419
  get(id: string): Promise<VoiceRealCallProfileRecoveryJob | undefined> | VoiceRealCallProfileRecoveryJob | undefined;
419
420
  update(id: string, update: VoiceRealCallProfileRecoveryJobUpdate): Promise<VoiceRealCallProfileRecoveryJob | undefined> | VoiceRealCallProfileRecoveryJob | undefined;
420
421
  };
422
+ export type VoiceSQLiteRealCallProfileRecoveryJobStoreOptions = {
423
+ database?: Database;
424
+ idPrefix?: string;
425
+ now?: () => Date;
426
+ path?: string;
427
+ tableName?: string;
428
+ };
421
429
  export type VoiceRealCallProfileRecoveryActionHandler = (input: VoiceRealCallProfileRecoveryActionHandlerInput) => Promise<Partial<VoiceRealCallProfileRecoveryActionResult> | void> | Partial<VoiceRealCallProfileRecoveryActionResult> | void;
422
430
  export type VoiceRealCallProfileRecoveryActionRoutesOptions = VoiceRealCallProfileRecoveryActionOptions & Omit<VoiceRealCallProfileHistoryRoutesOptions, 'htmlPath' | 'markdownPath'> & {
423
431
  asyncActionIds?: readonly VoiceRealCallProfileRecoveryActionId[];
@@ -462,6 +470,7 @@ export declare const createVoiceInMemoryRealCallProfileRecoveryJobStore: (option
462
470
  idPrefix?: string;
463
471
  now?: () => Date;
464
472
  }) => VoiceRealCallProfileRecoveryJobStore;
473
+ export declare const createVoiceSQLiteRealCallProfileRecoveryJobStore: (options?: VoiceSQLiteRealCallProfileRecoveryJobStoreOptions) => VoiceRealCallProfileRecoveryJobStore;
465
474
  export declare const buildVoiceRealCallProfileReadinessCheck: (report: VoiceRealCallProfileHistoryReport, options?: VoiceRealCallProfileReadinessCheckOptions) => VoiceProductionReadinessCheck;
466
475
  export declare const resolveVoiceRealCallProfileProviderRoute: <TProvider extends string = string>(options: VoiceRealCallProfileProviderRouteOptions<TProvider>) => TProvider | undefined;
467
476
  export declare const buildVoiceRealCallProfileHistoryReport: (options?: VoiceRealCallProfileHistoryOptions) => VoiceRealCallProfileHistoryReport;
@@ -1494,6 +1494,7 @@ var useVoiceProofTrends = (path = "/api/voice/proof-trends", options = {}) => {
1494
1494
 
1495
1495
  // src/proofTrends.ts
1496
1496
  import { Elysia } from "elysia";
1497
+ import { Database } from "bun:sqlite";
1497
1498
  var DEFAULT_VOICE_PROOF_TRENDS_MAX_AGE_MS = 24 * 60 * 60 * 1000;
1498
1499
  var DEFAULT_VOICE_PROOF_TREND_PROFILE_DEFINITIONS = [
1499
1500
  {
@@ -2250,6 +2251,62 @@ var createVoiceInMemoryRealCallProfileRecoveryJobStore = (options = {}) => {
2250
2251
  }
2251
2252
  };
2252
2253
  };
2254
+ var normalizeRealCallRecoveryJobTableName = (value) => value.trim().replace(/[^a-zA-Z0-9_]+/g, "_").replace(/^_+|_+$/g, "") || "voice_real_call_profile_recovery_jobs";
2255
+ var createVoiceSQLiteRealCallProfileRecoveryJobStore = (options = {}) => {
2256
+ const database = options.database ?? new Database(options.path ?? ":memory:", {
2257
+ create: true
2258
+ });
2259
+ const tableName = normalizeRealCallRecoveryJobTableName(options.tableName ?? "voice_real_call_profile_recovery_jobs");
2260
+ const now = () => (options.now ?? (() => new Date))().toISOString();
2261
+ const createId = () => `${options.idPrefix ?? "voice-recovery-job"}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
2262
+ database.exec("PRAGMA journal_mode = WAL;");
2263
+ database.exec("PRAGMA synchronous = NORMAL;");
2264
+ database.exec("PRAGMA busy_timeout = 5000;");
2265
+ database.exec(`CREATE TABLE IF NOT EXISTS "${tableName}" (
2266
+ id TEXT PRIMARY KEY,
2267
+ sort_at INTEGER NOT NULL,
2268
+ payload TEXT NOT NULL
2269
+ )`);
2270
+ const selectStatement = database.query(`SELECT payload FROM "${tableName}" WHERE id = ?1 LIMIT 1`);
2271
+ const upsertStatement = database.query(`INSERT INTO "${tableName}" (id, sort_at, payload)
2272
+ VALUES (?1, ?2, ?3)
2273
+ ON CONFLICT(id) DO UPDATE SET sort_at = excluded.sort_at, payload = excluded.payload`);
2274
+ const writeJob = (job) => {
2275
+ upsertStatement.run(job.id, Date.parse(job.updatedAt) || Date.now(), JSON.stringify(job));
2276
+ return job;
2277
+ };
2278
+ const readJob = (id) => {
2279
+ const row = selectStatement.get(id);
2280
+ return row ? JSON.parse(row.payload) : undefined;
2281
+ };
2282
+ return {
2283
+ create(input) {
2284
+ const createdAt = input.createdAt ?? now();
2285
+ return writeJob({
2286
+ actionId: input.actionId,
2287
+ createdAt,
2288
+ id: input.id ?? createId(),
2289
+ message: input.message,
2290
+ status: input.status ?? "queued",
2291
+ updatedAt: createdAt
2292
+ });
2293
+ },
2294
+ get(id) {
2295
+ return readJob(id);
2296
+ },
2297
+ update(id, update) {
2298
+ const existing = readJob(id);
2299
+ if (!existing) {
2300
+ return;
2301
+ }
2302
+ return writeJob({
2303
+ ...existing,
2304
+ ...update,
2305
+ updatedAt: update.updatedAt ?? now()
2306
+ });
2307
+ }
2308
+ };
2309
+ };
2253
2310
  var buildVoiceRealCallProfileReadinessCheck = (report, options = {}) => {
2254
2311
  const { issues, warnings } = buildRealCallProfileReadinessIssues(report, options);
2255
2312
  const status = issues.length > 0 ? "fail" : warnings.length > 0 && options.failOnWarnings === true ? "fail" : warnings.length > 0 ? "warn" : "pass";
package/dist/vue/index.js CHANGED
@@ -1415,6 +1415,7 @@ import { defineComponent as defineComponent5, h as h5 } from "vue";
1415
1415
 
1416
1416
  // src/proofTrends.ts
1417
1417
  import { Elysia } from "elysia";
1418
+ import { Database } from "bun:sqlite";
1418
1419
  var DEFAULT_VOICE_PROOF_TRENDS_MAX_AGE_MS = 24 * 60 * 60 * 1000;
1419
1420
  var DEFAULT_VOICE_PROOF_TREND_PROFILE_DEFINITIONS = [
1420
1421
  {
@@ -2171,6 +2172,62 @@ var createVoiceInMemoryRealCallProfileRecoveryJobStore = (options = {}) => {
2171
2172
  }
2172
2173
  };
2173
2174
  };
2175
+ var normalizeRealCallRecoveryJobTableName = (value) => value.trim().replace(/[^a-zA-Z0-9_]+/g, "_").replace(/^_+|_+$/g, "") || "voice_real_call_profile_recovery_jobs";
2176
+ var createVoiceSQLiteRealCallProfileRecoveryJobStore = (options = {}) => {
2177
+ const database = options.database ?? new Database(options.path ?? ":memory:", {
2178
+ create: true
2179
+ });
2180
+ const tableName = normalizeRealCallRecoveryJobTableName(options.tableName ?? "voice_real_call_profile_recovery_jobs");
2181
+ const now = () => (options.now ?? (() => new Date))().toISOString();
2182
+ const createId = () => `${options.idPrefix ?? "voice-recovery-job"}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
2183
+ database.exec("PRAGMA journal_mode = WAL;");
2184
+ database.exec("PRAGMA synchronous = NORMAL;");
2185
+ database.exec("PRAGMA busy_timeout = 5000;");
2186
+ database.exec(`CREATE TABLE IF NOT EXISTS "${tableName}" (
2187
+ id TEXT PRIMARY KEY,
2188
+ sort_at INTEGER NOT NULL,
2189
+ payload TEXT NOT NULL
2190
+ )`);
2191
+ const selectStatement = database.query(`SELECT payload FROM "${tableName}" WHERE id = ?1 LIMIT 1`);
2192
+ const upsertStatement = database.query(`INSERT INTO "${tableName}" (id, sort_at, payload)
2193
+ VALUES (?1, ?2, ?3)
2194
+ ON CONFLICT(id) DO UPDATE SET sort_at = excluded.sort_at, payload = excluded.payload`);
2195
+ const writeJob = (job) => {
2196
+ upsertStatement.run(job.id, Date.parse(job.updatedAt) || Date.now(), JSON.stringify(job));
2197
+ return job;
2198
+ };
2199
+ const readJob = (id) => {
2200
+ const row = selectStatement.get(id);
2201
+ return row ? JSON.parse(row.payload) : undefined;
2202
+ };
2203
+ return {
2204
+ create(input) {
2205
+ const createdAt = input.createdAt ?? now();
2206
+ return writeJob({
2207
+ actionId: input.actionId,
2208
+ createdAt,
2209
+ id: input.id ?? createId(),
2210
+ message: input.message,
2211
+ status: input.status ?? "queued",
2212
+ updatedAt: createdAt
2213
+ });
2214
+ },
2215
+ get(id) {
2216
+ return readJob(id);
2217
+ },
2218
+ update(id, update) {
2219
+ const existing = readJob(id);
2220
+ if (!existing) {
2221
+ return;
2222
+ }
2223
+ return writeJob({
2224
+ ...existing,
2225
+ ...update,
2226
+ updatedAt: update.updatedAt ?? now()
2227
+ });
2228
+ }
2229
+ };
2230
+ };
2174
2231
  var buildVoiceRealCallProfileReadinessCheck = (report, options = {}) => {
2175
2232
  const { issues, warnings } = buildRealCallProfileReadinessIssues(report, options);
2176
2233
  const status = issues.length > 0 ? "fail" : warnings.length > 0 && options.failOnWarnings === true ? "fail" : warnings.length > 0 ? "warn" : "pass";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.373",
3
+ "version": "0.0.22-beta.374",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",