@absolutejs/voice 0.0.22-beta.549 → 0.0.22-beta.550
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/core/scribe.d.ts +50 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +51 -0
- package/package.json +1 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { AudioChunk, AudioFormat, STTAdapter, Transcript, VoiceCloseEvent, VoiceErrorEvent, VoiceLanguageStrategy, VoiceLexiconEntry, VoicePhraseHint } from "./types";
|
|
2
|
+
export type VoiceScribeTurn = {
|
|
3
|
+
speaker: string;
|
|
4
|
+
text: string;
|
|
5
|
+
confidence?: number;
|
|
6
|
+
startedAtMs?: number;
|
|
7
|
+
endedAtMs?: number;
|
|
8
|
+
};
|
|
9
|
+
export type VoiceScribePartialEvent = {
|
|
10
|
+
type: "partial";
|
|
11
|
+
transcript: Transcript;
|
|
12
|
+
};
|
|
13
|
+
export type VoiceScribeTurnEvent = {
|
|
14
|
+
type: "turn";
|
|
15
|
+
turn: VoiceScribeTurn;
|
|
16
|
+
};
|
|
17
|
+
export type VoiceScribeEventMap = {
|
|
18
|
+
partial: VoiceScribePartialEvent;
|
|
19
|
+
turn: VoiceScribeTurnEvent;
|
|
20
|
+
error: VoiceErrorEvent;
|
|
21
|
+
close: VoiceCloseEvent;
|
|
22
|
+
};
|
|
23
|
+
export type VoiceScribeSession = {
|
|
24
|
+
on: <K extends keyof VoiceScribeEventMap>(event: K, handler: (payload: VoiceScribeEventMap[K]) => void | Promise<void>) => () => void;
|
|
25
|
+
/** Push a chunk of audio (same format declared in `open`). */
|
|
26
|
+
send: (audio: AudioChunk) => Promise<void>;
|
|
27
|
+
/** All finalized, speaker-labelled turns so far, in order. */
|
|
28
|
+
getTranscript: () => VoiceScribeTurn[];
|
|
29
|
+
close: (reason?: string) => Promise<void>;
|
|
30
|
+
};
|
|
31
|
+
export type VoiceScribeOptions = {
|
|
32
|
+
stt: STTAdapter;
|
|
33
|
+
sessionId: string;
|
|
34
|
+
format: AudioFormat;
|
|
35
|
+
languageStrategy?: VoiceLanguageStrategy;
|
|
36
|
+
lexicon?: VoiceLexiconEntry[];
|
|
37
|
+
phraseHints?: VoicePhraseHint[];
|
|
38
|
+
signal?: AbortSignal;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* A listen-only transcription session — a "scribe". It drives an STT adapter
|
|
42
|
+
* over a stream of audio chunks and emits diarized transcript turns, with NO
|
|
43
|
+
* assistant (no LLM) and NO TTS. Use it to turn any audio source — an
|
|
44
|
+
* onSpark-hosted meeting, or a meeting-bot adapter piping in an external call —
|
|
45
|
+
* into a live, speaker-labelled transcript that downstream consumers (e.g. a
|
|
46
|
+
* deal-call analyzer) read or act on. Diarization comes from the STT adapter
|
|
47
|
+
* (e.g. `deepgram({ diarize: true })`); speakers are surfaced as stable string
|
|
48
|
+
* labels on each turn.
|
|
49
|
+
*/
|
|
50
|
+
export declare const createVoiceScribe: (options: VoiceScribeOptions) => Promise<VoiceScribeSession>;
|
package/dist/index.d.ts
CHANGED
|
@@ -197,6 +197,8 @@ export { createVoiceHandoffHealthHTMLHandler, createVoiceHandoffHealthJSONHandle
|
|
|
197
197
|
export { createVoiceHandoffDeliveryWorker, createVoiceHandoffDeliveryWorkerLoop, createVoiceIntegrationSinkWorker, createVoiceIntegrationSinkWorkerLoop, createVoiceOpsTaskWorker, createVoiceOpsTaskProcessorWorker, createVoiceOpsTaskProcessorWorkerLoop, createVoiceRedisIdempotencyStore, createVoiceRedisTelephonyWebhookIdempotencyStore, createVoiceRedisTaskLeaseCoordinator, createVoiceTraceSinkDeliveryWorker, createVoiceTraceSinkDeliveryWorkerLoop, createVoiceWebhookDeliveryWorker, createVoiceWebhookDeliveryWorkerLoop, summarizeVoiceHandoffDeliveries, summarizeVoiceTraceSinkDeliveries, summarizeVoiceOpsTaskQueue, summarizeVoiceIntegrationEvents, } from "./core/queue";
|
|
198
198
|
export { assignVoiceOpsTask, applyVoiceOpsTaskAssignmentRule, applyVoiceOpsTaskPolicy, buildVoiceOpsTaskFromReview, buildVoiceOpsTaskFromSLABreach, claimVoiceOpsTask, completeVoiceOpsTask, createVoiceExternalObjectMap, createVoiceExternalObjectMapId, createVoiceCallCompletedEvent, createVoiceTaskSLABreachedEvent, deadLetterVoiceOpsTask, deliverVoiceIntegrationEvent, failVoiceOpsTask, hasVoiceOpsTaskSLABreach, heartbeatVoiceOpsTask, isVoiceOpsTaskOverdue, markVoiceOpsTaskSLABreached, matchesVoiceOpsTaskAssignmentRule, resolveVoiceOpsTaskAgeBucket, createVoiceIntegrationEvent, createVoiceReviewSavedEvent, resolveVoiceOpsTaskAssignment, resolveVoiceOpsTaskPolicy, requeueVoiceOpsTask, createVoiceTaskCreatedEvent, createVoiceTaskUpdatedEvent, listVoiceOpsTasks, reopenVoiceOpsTask, startVoiceOpsTask, summarizeVoiceOpsTaskAnalytics, summarizeVoiceOpsTasks, withVoiceIntegrationEventId, withVoiceOpsTaskId, } from "./core/ops";
|
|
199
199
|
export { createVoiceSession } from "./core/session";
|
|
200
|
+
export { createVoiceScribe } from "./core/scribe";
|
|
201
|
+
export type { VoiceScribeSession, VoiceScribeOptions, VoiceScribeTurn, VoiceScribeEventMap, VoiceScribePartialEvent, VoiceScribeTurnEvent, } from "./core/scribe";
|
|
200
202
|
export { createVoiceCallReviewFromSession, recordVoiceRuntimeOps, } from "./core/runtimeOps";
|
|
201
203
|
export { createVoiceOpsRuntime } from "./core/opsRuntime";
|
|
202
204
|
export { resolveVoiceOpsPreset } from "./core/opsPresets";
|
package/dist/index.js
CHANGED
|
@@ -46486,6 +46486,56 @@ var createVoiceMemoryStore = () => {
|
|
|
46486
46486
|
};
|
|
46487
46487
|
return { get, getOrCreate, list, remove, set };
|
|
46488
46488
|
};
|
|
46489
|
+
// src/core/scribe.ts
|
|
46490
|
+
var createVoiceScribe = async (options) => {
|
|
46491
|
+
const session = await options.stt.open({
|
|
46492
|
+
format: options.format,
|
|
46493
|
+
languageStrategy: options.languageStrategy,
|
|
46494
|
+
lexicon: options.lexicon,
|
|
46495
|
+
phraseHints: options.phraseHints,
|
|
46496
|
+
sessionId: options.sessionId,
|
|
46497
|
+
signal: options.signal
|
|
46498
|
+
});
|
|
46499
|
+
const turns = [];
|
|
46500
|
+
const listeners = {
|
|
46501
|
+
close: new Set,
|
|
46502
|
+
error: new Set,
|
|
46503
|
+
partial: new Set,
|
|
46504
|
+
turn: new Set
|
|
46505
|
+
};
|
|
46506
|
+
const emit2 = (event, payload) => {
|
|
46507
|
+
for (const handler of listeners[event])
|
|
46508
|
+
handler(payload);
|
|
46509
|
+
};
|
|
46510
|
+
session.on("final", ({ transcript }) => {
|
|
46511
|
+
const text = transcript.text.trim();
|
|
46512
|
+
if (!text)
|
|
46513
|
+
return;
|
|
46514
|
+
const turn = {
|
|
46515
|
+
confidence: transcript.confidence,
|
|
46516
|
+
endedAtMs: transcript.endedAtMs,
|
|
46517
|
+
speaker: transcript.speaker === undefined ? "0" : String(transcript.speaker),
|
|
46518
|
+
startedAtMs: transcript.startedAtMs,
|
|
46519
|
+
text
|
|
46520
|
+
};
|
|
46521
|
+
turns.push(turn);
|
|
46522
|
+
emit2("turn", { turn, type: "turn" });
|
|
46523
|
+
});
|
|
46524
|
+
session.on("partial", ({ transcript }) => emit2("partial", { transcript, type: "partial" }));
|
|
46525
|
+
session.on("error", (event) => emit2("error", event));
|
|
46526
|
+
session.on("close", (event) => emit2("close", event));
|
|
46527
|
+
return {
|
|
46528
|
+
close: (reason) => session.close(reason),
|
|
46529
|
+
getTranscript: () => [...turns],
|
|
46530
|
+
on: (event, handler) => {
|
|
46531
|
+
listeners[event].add(handler);
|
|
46532
|
+
return () => {
|
|
46533
|
+
listeners[event].delete(handler);
|
|
46534
|
+
};
|
|
46535
|
+
},
|
|
46536
|
+
send: (audio) => session.send(audio)
|
|
46537
|
+
};
|
|
46538
|
+
};
|
|
46489
46539
|
// src/core/opsRuntime.ts
|
|
46490
46540
|
var resolveTaskStores = (config) => {
|
|
46491
46541
|
if (!config.ops.tasks) {
|
|
@@ -52346,6 +52396,7 @@ export {
|
|
|
52346
52396
|
createVoiceSessionObservabilityRoutes,
|
|
52347
52397
|
createVoiceSessionListRoutes,
|
|
52348
52398
|
createVoiceSession,
|
|
52399
|
+
createVoiceScribe,
|
|
52349
52400
|
createVoiceScopedTraceEventStore,
|
|
52350
52401
|
createVoiceScopedAuditEventStore,
|
|
52351
52402
|
createVoiceSTTRoutingCorrectionHandler,
|