@absolutejs/voice 0.0.22-beta.262 → 0.0.22-beta.263

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.
@@ -4299,6 +4299,58 @@ var assertVoiceLiveOpsEvidence = (input = {}) => {
4299
4299
  }
4300
4300
  return assertion;
4301
4301
  };
4302
+ var evaluateVoiceLiveOpsControlEvidence = (input = {}) => {
4303
+ const issues = [];
4304
+ const results = input.results ?? [];
4305
+ const controls = results.map((result) => result.control).filter((control) => Boolean(control));
4306
+ const finalControl = input.finalControl ?? controls.at(-1);
4307
+ const actions = uniqueSorted(results.map((result) => result.action).filter((action) => isVoiceLiveOpsAction(action)));
4308
+ const statuses = uniqueSorted(controls.map((control) => control.status));
4309
+ const failedActions = results.filter((result) => result.ok === false).length;
4310
+ if (results.length === 0) {
4311
+ issues.push("Expected live-ops control action result(s) to be present.");
4312
+ }
4313
+ if (input.minSnapshots !== undefined && controls.length < input.minSnapshots) {
4314
+ issues.push(`Expected at least ${String(input.minSnapshots)} live-ops control snapshot(s), found ${String(controls.length)}.`);
4315
+ }
4316
+ if (input.maxFailedActions !== undefined && failedActions > input.maxFailedActions) {
4317
+ issues.push(`Expected at most ${String(input.maxFailedActions)} failed live-ops control action(s), found ${String(failedActions)}.`);
4318
+ }
4319
+ for (const action of findMissing(actions, input.requiredActions)) {
4320
+ issues.push(`Missing live-ops control action: ${action}.`);
4321
+ }
4322
+ for (const status of findMissing(statuses, input.requiredStatuses)) {
4323
+ issues.push(`Missing live-ops control status: ${status}.`);
4324
+ }
4325
+ if (!finalControl) {
4326
+ issues.push("Expected final live-ops control state to be present.");
4327
+ } else {
4328
+ if (input.requireFinalAssistantPaused !== undefined && finalControl.assistantPaused !== input.requireFinalAssistantPaused) {
4329
+ issues.push(`Expected final live-ops assistantPaused ${String(input.requireFinalAssistantPaused)}, found ${String(finalControl.assistantPaused)}.`);
4330
+ }
4331
+ if (input.requireFinalOperatorTakeover !== undefined && finalControl.operatorTakeover !== input.requireFinalOperatorTakeover) {
4332
+ issues.push(`Expected final live-ops operatorTakeover ${String(input.requireFinalOperatorTakeover)}, found ${String(finalControl.operatorTakeover)}.`);
4333
+ }
4334
+ }
4335
+ return {
4336
+ actionCount: results.length,
4337
+ actions,
4338
+ failedActions,
4339
+ finalControl: finalControl ?? undefined,
4340
+ finalStatus: finalControl?.status,
4341
+ issues,
4342
+ ok: issues.length === 0,
4343
+ snapshots: controls.length,
4344
+ statuses
4345
+ };
4346
+ };
4347
+ var assertVoiceLiveOpsControlEvidence = (input = {}) => {
4348
+ const assertion = evaluateVoiceLiveOpsControlEvidence(input);
4349
+ if (!assertion.ok) {
4350
+ throw new Error(`Voice live-ops control evidence assertion failed: ${assertion.issues.join(" ")}`);
4351
+ }
4352
+ return assertion;
4353
+ };
4302
4354
  var createVoiceMemoryLiveOpsControlStore = () => {
4303
4355
  const states = new Map;
4304
4356
  return {
package/dist/index.d.ts CHANGED
@@ -18,8 +18,8 @@ export { assertVoicePlatformCoverage, buildVoicePlatformCoverageSummary, createV
18
18
  export type { VoicePlatformCoverageAssertionInput, VoicePlatformCoverageAssertionReport, VoicePlatformCoverageEvidence, VoicePlatformCoverageRoutesOptions, VoicePlatformCoverageStatus, VoicePlatformCoverageSummary, VoicePlatformCoverageSummaryInput, VoicePlatformCoverageSurface } from './platformCoverage';
19
19
  export { assertVoiceProofTrendEvidence, buildEmptyVoiceProofTrendReport, buildVoiceProofTrendReport, createVoiceProofTrendRoutes, DEFAULT_VOICE_PROOF_TRENDS_MAX_AGE_MS, evaluateVoiceProofTrendEvidence, formatVoiceProofTrendAge, normalizeVoiceProofTrendReport, readVoiceProofTrendReportFile } from './proofTrends';
20
20
  export type { VoiceProofTrendAssertionInput, VoiceProofTrendAssertionReport, VoiceProofTrendCycle, VoiceProofTrendReport, VoiceProofTrendReportInput, VoiceProofTrendRoutesOptions, VoiceProofTrendStatus, VoiceProofTrendSummary } from './proofTrends';
21
- export { assertVoiceLiveOpsEvidence, buildVoiceLiveOpsControlState, createVoiceLiveOpsController, createVoiceLiveOpsRoutes, createVoiceMemoryLiveOpsControlStore, evaluateVoiceLiveOpsEvidence, getVoiceLiveOpsControlStatus, VOICE_LIVE_OPS_ACTIONS } from './liveOps';
22
- export type { VoiceLiveOpsAction, VoiceLiveOpsActionInput, VoiceLiveOpsActionResult, VoiceLiveOpsControllerOptions, VoiceLiveOpsControlState, VoiceLiveOpsControlStatus, VoiceLiveOpsControlStore, VoiceLiveOpsEvidenceInput, VoiceLiveOpsEvidenceReport, VoiceLiveOpsRoutesOptions } from './liveOps';
21
+ export { assertVoiceLiveOpsControlEvidence, assertVoiceLiveOpsEvidence, buildVoiceLiveOpsControlState, createVoiceLiveOpsController, createVoiceLiveOpsRoutes, createVoiceMemoryLiveOpsControlStore, evaluateVoiceLiveOpsControlEvidence, evaluateVoiceLiveOpsEvidence, getVoiceLiveOpsControlStatus, VOICE_LIVE_OPS_ACTIONS } from './liveOps';
22
+ export type { VoiceLiveOpsAction, VoiceLiveOpsActionInput, VoiceLiveOpsActionResult, VoiceLiveOpsControllerOptions, VoiceLiveOpsControlState, VoiceLiveOpsControlStatus, VoiceLiveOpsControlStore, VoiceLiveOpsControlEvidenceInput, VoiceLiveOpsControlEvidenceReport, VoiceLiveOpsEvidenceInput, VoiceLiveOpsEvidenceReport, VoiceLiveOpsRoutesOptions } from './liveOps';
23
23
  export { buildVoiceDeliveryRuntimeReport, createVoiceDeliveryRuntime, createVoiceDeliveryRuntimePresetConfig, createVoiceDeliveryRuntimeRoutes, renderVoiceDeliveryRuntimeHTML } from './deliveryRuntime';
24
24
  export { applyVoiceDataRetentionPolicy, assertVoiceDataControlEvidence, buildVoiceDataControlReport, buildVoiceDataRetentionPlan, createVoiceDataControlRoutes, createVoiceZeroRetentionPolicy, evaluateVoiceDataControlEvidence, renderVoiceDataControlHTML, renderVoiceDataControlMarkdown, voiceComplianceRedactionDefaults } from './dataControl';
25
25
  export type { VoiceDataControlAssertionInput, VoiceDataControlAssertionReport, VoiceDataControlProviderKeySurface, VoiceDataControlReport, VoiceDataControlRoutesOptions, VoiceDataControlStorageSurface, VoiceDataRetentionPolicy, VoiceDataRetentionReport, VoiceDataRetentionScope, VoiceDataRetentionScopeReport, VoiceDataRetentionStores } from './dataControl';
package/dist/index.js CHANGED
@@ -12729,6 +12729,58 @@ var assertVoiceLiveOpsEvidence = (input = {}) => {
12729
12729
  }
12730
12730
  return assertion;
12731
12731
  };
12732
+ var evaluateVoiceLiveOpsControlEvidence = (input = {}) => {
12733
+ const issues = [];
12734
+ const results = input.results ?? [];
12735
+ const controls = results.map((result) => result.control).filter((control) => Boolean(control));
12736
+ const finalControl = input.finalControl ?? controls.at(-1);
12737
+ const actions = uniqueSorted(results.map((result) => result.action).filter((action) => isVoiceLiveOpsAction(action)));
12738
+ const statuses = uniqueSorted(controls.map((control) => control.status));
12739
+ const failedActions = results.filter((result) => result.ok === false).length;
12740
+ if (results.length === 0) {
12741
+ issues.push("Expected live-ops control action result(s) to be present.");
12742
+ }
12743
+ if (input.minSnapshots !== undefined && controls.length < input.minSnapshots) {
12744
+ issues.push(`Expected at least ${String(input.minSnapshots)} live-ops control snapshot(s), found ${String(controls.length)}.`);
12745
+ }
12746
+ if (input.maxFailedActions !== undefined && failedActions > input.maxFailedActions) {
12747
+ issues.push(`Expected at most ${String(input.maxFailedActions)} failed live-ops control action(s), found ${String(failedActions)}.`);
12748
+ }
12749
+ for (const action of findMissing(actions, input.requiredActions)) {
12750
+ issues.push(`Missing live-ops control action: ${action}.`);
12751
+ }
12752
+ for (const status of findMissing(statuses, input.requiredStatuses)) {
12753
+ issues.push(`Missing live-ops control status: ${status}.`);
12754
+ }
12755
+ if (!finalControl) {
12756
+ issues.push("Expected final live-ops control state to be present.");
12757
+ } else {
12758
+ if (input.requireFinalAssistantPaused !== undefined && finalControl.assistantPaused !== input.requireFinalAssistantPaused) {
12759
+ issues.push(`Expected final live-ops assistantPaused ${String(input.requireFinalAssistantPaused)}, found ${String(finalControl.assistantPaused)}.`);
12760
+ }
12761
+ if (input.requireFinalOperatorTakeover !== undefined && finalControl.operatorTakeover !== input.requireFinalOperatorTakeover) {
12762
+ issues.push(`Expected final live-ops operatorTakeover ${String(input.requireFinalOperatorTakeover)}, found ${String(finalControl.operatorTakeover)}.`);
12763
+ }
12764
+ }
12765
+ return {
12766
+ actionCount: results.length,
12767
+ actions,
12768
+ failedActions,
12769
+ finalControl: finalControl ?? undefined,
12770
+ finalStatus: finalControl?.status,
12771
+ issues,
12772
+ ok: issues.length === 0,
12773
+ snapshots: controls.length,
12774
+ statuses
12775
+ };
12776
+ };
12777
+ var assertVoiceLiveOpsControlEvidence = (input = {}) => {
12778
+ const assertion = evaluateVoiceLiveOpsControlEvidence(input);
12779
+ if (!assertion.ok) {
12780
+ throw new Error(`Voice live-ops control evidence assertion failed: ${assertion.issues.join(" ")}`);
12781
+ }
12782
+ return assertion;
12783
+ };
12732
12784
  var createVoiceMemoryLiveOpsControlStore = () => {
12733
12785
  const states = new Map;
12734
12786
  return {
@@ -31334,6 +31386,7 @@ export {
31334
31386
  evaluateVoiceObservabilityExportReplayEvidence,
31335
31387
  evaluateVoiceObservabilityExportDeliveryEvidence,
31336
31388
  evaluateVoiceLiveOpsEvidence,
31389
+ evaluateVoiceLiveOpsControlEvidence,
31337
31390
  evaluateVoiceGuardrailPolicy,
31338
31391
  evaluateVoiceDataControlEvidence,
31339
31392
  evaluateVoiceCampaignReadinessEvidence,
@@ -31668,6 +31721,7 @@ export {
31668
31721
  assertVoiceObservabilityExportRecord,
31669
31722
  assertVoiceObservabilityExportDeliveryEvidence,
31670
31723
  assertVoiceLiveOpsEvidence,
31724
+ assertVoiceLiveOpsControlEvidence,
31671
31725
  assertVoiceLatencySLOGate,
31672
31726
  assertVoiceDataControlEvidence,
31673
31727
  assertVoiceCampaignReadinessEvidence,
package/dist/liveOps.d.ts CHANGED
@@ -69,6 +69,29 @@ export type VoiceLiveOpsEvidenceReport = {
69
69
  opsRecoveryStatus?: VoiceOpsRecoveryStatus;
70
70
  opsStatus?: VoiceOpsStatusReport['status'];
71
71
  };
72
+ export type VoiceLiveOpsControlEvidenceInput = {
73
+ finalControl?: VoiceLiveOpsControlState | null;
74
+ maxFailedActions?: number;
75
+ minSnapshots?: number;
76
+ requireFinalAssistantPaused?: boolean;
77
+ requireFinalOperatorTakeover?: boolean;
78
+ requiredActions?: VoiceLiveOpsAction[];
79
+ requiredStatuses?: VoiceLiveOpsControlStatus[];
80
+ results?: Array<Partial<Omit<VoiceLiveOpsActionResult, 'ok'>> & {
81
+ ok?: boolean;
82
+ }>;
83
+ };
84
+ export type VoiceLiveOpsControlEvidenceReport = {
85
+ actionCount: number;
86
+ actions: VoiceLiveOpsAction[];
87
+ failedActions: number;
88
+ finalControl?: VoiceLiveOpsControlState;
89
+ finalStatus?: VoiceLiveOpsControlStatus;
90
+ issues: string[];
91
+ ok: boolean;
92
+ snapshots: number;
93
+ statuses: VoiceLiveOpsControlStatus[];
94
+ };
72
95
  export type VoiceLiveOpsControlStore = {
73
96
  get: (sessionId: string) => Promise<VoiceLiveOpsControlState | undefined> | VoiceLiveOpsControlState | undefined;
74
97
  set: (sessionId: string, state: VoiceLiveOpsControlState) => Promise<void> | void;
@@ -93,6 +116,8 @@ export type VoiceLiveOpsRoutesOptions = VoiceLiveOpsControllerOptions & {
93
116
  };
94
117
  export declare const evaluateVoiceLiveOpsEvidence: (input?: VoiceLiveOpsEvidenceInput) => VoiceLiveOpsEvidenceReport;
95
118
  export declare const assertVoiceLiveOpsEvidence: (input?: VoiceLiveOpsEvidenceInput) => VoiceLiveOpsEvidenceReport;
119
+ export declare const evaluateVoiceLiveOpsControlEvidence: (input?: VoiceLiveOpsControlEvidenceInput) => VoiceLiveOpsControlEvidenceReport;
120
+ export declare const assertVoiceLiveOpsControlEvidence: (input?: VoiceLiveOpsControlEvidenceInput) => VoiceLiveOpsControlEvidenceReport;
96
121
  export declare const createVoiceMemoryLiveOpsControlStore: () => VoiceLiveOpsControlStore;
97
122
  export declare const getVoiceLiveOpsControlStatus: (action: VoiceLiveOpsAction) => VoiceLiveOpsControlStatus;
98
123
  export declare const buildVoiceLiveOpsControlState: (input: VoiceLiveOpsActionInput & {
@@ -1837,6 +1837,58 @@ var assertVoiceLiveOpsEvidence = (input = {}) => {
1837
1837
  }
1838
1838
  return assertion;
1839
1839
  };
1840
+ var evaluateVoiceLiveOpsControlEvidence = (input = {}) => {
1841
+ const issues = [];
1842
+ const results = input.results ?? [];
1843
+ const controls = results.map((result) => result.control).filter((control) => Boolean(control));
1844
+ const finalControl = input.finalControl ?? controls.at(-1);
1845
+ const actions = uniqueSorted(results.map((result) => result.action).filter((action) => isVoiceLiveOpsAction(action)));
1846
+ const statuses = uniqueSorted(controls.map((control) => control.status));
1847
+ const failedActions = results.filter((result) => result.ok === false).length;
1848
+ if (results.length === 0) {
1849
+ issues.push("Expected live-ops control action result(s) to be present.");
1850
+ }
1851
+ if (input.minSnapshots !== undefined && controls.length < input.minSnapshots) {
1852
+ issues.push(`Expected at least ${String(input.minSnapshots)} live-ops control snapshot(s), found ${String(controls.length)}.`);
1853
+ }
1854
+ if (input.maxFailedActions !== undefined && failedActions > input.maxFailedActions) {
1855
+ issues.push(`Expected at most ${String(input.maxFailedActions)} failed live-ops control action(s), found ${String(failedActions)}.`);
1856
+ }
1857
+ for (const action of findMissing(actions, input.requiredActions)) {
1858
+ issues.push(`Missing live-ops control action: ${action}.`);
1859
+ }
1860
+ for (const status of findMissing(statuses, input.requiredStatuses)) {
1861
+ issues.push(`Missing live-ops control status: ${status}.`);
1862
+ }
1863
+ if (!finalControl) {
1864
+ issues.push("Expected final live-ops control state to be present.");
1865
+ } else {
1866
+ if (input.requireFinalAssistantPaused !== undefined && finalControl.assistantPaused !== input.requireFinalAssistantPaused) {
1867
+ issues.push(`Expected final live-ops assistantPaused ${String(input.requireFinalAssistantPaused)}, found ${String(finalControl.assistantPaused)}.`);
1868
+ }
1869
+ if (input.requireFinalOperatorTakeover !== undefined && finalControl.operatorTakeover !== input.requireFinalOperatorTakeover) {
1870
+ issues.push(`Expected final live-ops operatorTakeover ${String(input.requireFinalOperatorTakeover)}, found ${String(finalControl.operatorTakeover)}.`);
1871
+ }
1872
+ }
1873
+ return {
1874
+ actionCount: results.length,
1875
+ actions,
1876
+ failedActions,
1877
+ finalControl: finalControl ?? undefined,
1878
+ finalStatus: finalControl?.status,
1879
+ issues,
1880
+ ok: issues.length === 0,
1881
+ snapshots: controls.length,
1882
+ statuses
1883
+ };
1884
+ };
1885
+ var assertVoiceLiveOpsControlEvidence = (input = {}) => {
1886
+ const assertion = evaluateVoiceLiveOpsControlEvidence(input);
1887
+ if (!assertion.ok) {
1888
+ throw new Error(`Voice live-ops control evidence assertion failed: ${assertion.issues.join(" ")}`);
1889
+ }
1890
+ return assertion;
1891
+ };
1840
1892
  var createVoiceMemoryLiveOpsControlStore = () => {
1841
1893
  const states = new Map;
1842
1894
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.262",
3
+ "version": "0.0.22-beta.263",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",