@absolutejs/voice 0.0.22-beta.517 → 0.0.22-beta.518

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -75,8 +75,8 @@ export { createVoiceAIJudgeCompletion, createVoiceLLMJudge, } from "./llmJudge";
75
75
  export type { CreateVoiceAIJudgeCompletionOptions, CreateVoiceLLMJudgeOptions, VoiceLLMJudge, VoiceLLMJudgeCompletion, VoiceLLMJudgeCriterionVerdict, VoiceLLMJudgeInput, VoiceLLMJudgeRubric, VoiceLLMJudgeRubricCriterion, VoiceLLMJudgeVerdict, } from "./llmJudge";
76
76
  export { DEFAULT_VOICE_REDACTION_PATTERNS, createVoiceTranscriptRedactor, redactVoiceTranscript, } from "./redaction";
77
77
  export type { CreateVoiceTranscriptRedactorOptions, VoiceRedactionPattern, VoiceTranscriptRedactor, } from "./redaction";
78
- export { deriveVoiceRecordingRedactionRanges } from "./recordingRedaction";
79
- export type { DeriveVoiceRecordingRedactionRangesInput, VoiceRecordingRedactionRange, } from "./recordingRedaction";
78
+ export { deriveVoiceRecordingRedactionRanges, redactVoiceRecording, } from "./recordingRedaction";
79
+ export type { DeriveVoiceRecordingRedactionRangesInput, RedactVoiceRecordingInput, RedactVoiceRecordingResult, VoiceRecordingRedactionRange, } from "./recordingRedaction";
80
80
  export { DEFAULT_VOICE_PRICE_BOOK, createVoiceCostAccountant, } from "./costAccounting";
81
81
  export type { CreateVoiceCostAccountantOptions, VoiceCostAccountant, VoiceCostBreakdown, VoiceCostLLMRecord, VoiceCostSTTRecord, VoiceCostTTSRecord, VoiceCostTelephonyRecord, VoicePriceBook, VoiceProviderRates, } from "./costAccounting";
82
82
  export { describeVoiceAssistantMode, resolveVoiceAssistantMode, } from "./assistantMode";
package/dist/index.js CHANGED
@@ -35409,6 +35409,10 @@ var createVoiceTranscriptRedactor = (options = {}) => {
35409
35409
  };
35410
35410
  var redactVoiceTranscript = (transcript, patterns = DEFAULT_VOICE_REDACTION_PATTERNS) => createVoiceTranscriptRedactor({ patterns })(transcript);
35411
35411
  // src/recordingRedaction.ts
35412
+ import {
35413
+ applyAudioRedaction,
35414
+ mergeAudioRedactionRanges
35415
+ } from "@absolutejs/media";
35412
35416
  var matchesAnyPattern = (text, patterns) => {
35413
35417
  for (const pattern of patterns) {
35414
35418
  pattern.regex.lastIndex = 0;
@@ -35446,6 +35450,23 @@ var deriveVoiceRecordingRedactionRanges = (input) => {
35446
35450
  }
35447
35451
  return out;
35448
35452
  };
35453
+ var redactVoiceRecording = (input) => {
35454
+ const derived = deriveVoiceRecordingRedactionRanges({
35455
+ transcripts: input.transcripts,
35456
+ ...input.recordingStartedAtEpochMs !== undefined ? { recordingStartedAtEpochMs: input.recordingStartedAtEpochMs } : {},
35457
+ ...input.paddingMs !== undefined ? { paddingMs: input.paddingMs } : {},
35458
+ ...input.patterns !== undefined ? { patterns: input.patterns } : {}
35459
+ });
35460
+ const ranges = mergeAudioRedactionRanges(derived);
35461
+ const bytes = applyAudioRedaction(input.pcm, input.format, ranges, {
35462
+ ...input.fill !== undefined ? { fill: input.fill } : {}
35463
+ });
35464
+ return {
35465
+ bytes,
35466
+ ranges,
35467
+ redactedCount: ranges.length
35468
+ };
35469
+ };
35449
35470
  // src/costAccounting.ts
35450
35471
  var DEFAULT_VOICE_PRICE_BOOK = {
35451
35472
  "anthropic:claude-opus-4-5": {
@@ -51767,6 +51788,7 @@ export {
51767
51788
  redactVoiceTraceText,
51768
51789
  redactVoiceTraceEvents,
51769
51790
  redactVoiceTraceEvent,
51791
+ redactVoiceRecording,
51770
51792
  redactVoiceAuditEvents,
51771
51793
  redactVoiceAuditEvent,
51772
51794
  recordVoiceWorkflowContractTrace,
@@ -1,4 +1,5 @@
1
- import type { Transcript } from "./types";
1
+ import { type AudioRedactionFill } from "@absolutejs/media";
2
+ import type { AudioFormat, Transcript } from "./types";
2
3
  import { type VoiceRedactionPattern } from "./redaction";
3
4
  export type VoiceRecordingRedactionRange = {
4
5
  endMs: number;
@@ -16,3 +17,31 @@ export type DeriveVoiceRecordingRedactionRangesInput = {
16
17
  transcripts: ReadonlyArray<Transcript>;
17
18
  };
18
19
  export declare const deriveVoiceRecordingRedactionRanges: (input: DeriveVoiceRecordingRedactionRangesInput) => VoiceRecordingRedactionRange[];
20
+ export type RedactVoiceRecordingInput = {
21
+ /** Raw pcm_s16le bytes of the recorded artifact. */
22
+ pcm: ArrayBuffer | ArrayBufferView;
23
+ /** Format of the recording (must be raw pcm_s16le). */
24
+ format: AudioFormat;
25
+ /** Final transcripts with timing, scanned for sensitive content. */
26
+ transcripts: ReadonlyArray<Transcript>;
27
+ recordingStartedAtEpochMs?: number;
28
+ paddingMs?: number;
29
+ patterns?: ReadonlyArray<VoiceRedactionPattern>;
30
+ /** Bleep style — silence (default) or a tone. */
31
+ fill?: AudioRedactionFill;
32
+ };
33
+ export type RedactVoiceRecordingResult = {
34
+ /** The redacted pcm_s16le bytes. */
35
+ bytes: Uint8Array;
36
+ /** The merged ranges that were bleeped. */
37
+ ranges: VoiceRecordingRedactionRange[];
38
+ /** How many ranges were redacted. */
39
+ redactedCount: number;
40
+ };
41
+ /**
42
+ * End-to-end recording redaction: derives sensitive ranges from final
43
+ * transcripts, merges overlaps, and applies the audio bleep via
44
+ * `@absolutejs/media`'s `applyAudioRedaction`. Returns the redacted bytes
45
+ * ready to re-store in place of the original artifact.
46
+ */
47
+ export declare const redactVoiceRecording: (input: RedactVoiceRecordingInput) => RedactVoiceRecordingResult;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.517",
3
+ "version": "0.0.22-beta.518",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",