offmute-v2 0.1.1 → 0.3.0
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 +108 -44
- package/dist/browser.browser.js +168 -69
- package/dist/browser.browser.js.map +1 -1
- package/dist/browser.d.ts +72 -19
- package/dist/cli.js +2095 -788
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +1269 -490
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +238 -18
- package/dist/index.d.ts +238 -18
- package/dist/index.js +1272 -493
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -109,8 +109,142 @@ interface TranscriptMetadata {
|
|
|
109
109
|
inputTokens: number;
|
|
110
110
|
outputTokens: number;
|
|
111
111
|
};
|
|
112
|
+
/** How much of the recording the LLM transcript covered, chunk by chunk, and what was
|
|
113
|
+
* done where it didn't. "Every run reported success" was true of runs that silently
|
|
114
|
+
* lost minutes; this says where text came from the ASR instead. */
|
|
115
|
+
quality?: TranscriptQuality;
|
|
116
|
+
/** Whether this run asked providers to keep nothing (PipelineOptions.zeroStorage). */
|
|
117
|
+
zeroStorage?: boolean;
|
|
118
|
+
}
|
|
119
|
+
/** One LLM chunk's coverage against the ASR. */
|
|
120
|
+
interface ChunkQuality {
|
|
121
|
+
chunk: number;
|
|
122
|
+
start: number;
|
|
123
|
+
end: number;
|
|
124
|
+
/** ok · retried (re-transcribed in halves, now fine) · low-coverage (still short after any
|
|
125
|
+
* retry; the ASR filled what it could) · dropped-loop (a repetition loop, replaced by ASR) */
|
|
126
|
+
status: "ok" | "retried" | "low-coverage" | "dropped-loop";
|
|
127
|
+
/** Transcript words per ASR word (null when the ASR heard nothing here). */
|
|
128
|
+
coverage: number | null;
|
|
129
|
+
llmWords: number;
|
|
130
|
+
asrWords: number;
|
|
131
|
+
/** Few of its content words were also heard by the ASR (flagged, kept as transcribed). */
|
|
132
|
+
ungrounded?: boolean;
|
|
133
|
+
}
|
|
134
|
+
interface TranscriptQuality {
|
|
135
|
+
chunks: ChunkQuality[];
|
|
136
|
+
/** Words inserted from the ASR where no transcript segment covered its speech. */
|
|
137
|
+
gapFilledWords: number;
|
|
138
|
+
/** The ASR heard far fewer words than the transcript holds (often: another language). */
|
|
139
|
+
asrMissedSpeech: boolean;
|
|
112
140
|
}
|
|
113
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Structured progress events for live displays (the CLI's terminal renderer, or a library
|
|
144
|
+
* caller's own UI), delivered through `PipelineOptions.onProgress`.
|
|
145
|
+
*
|
|
146
|
+
* The pipeline still logs everything it logs; logs remain the record (plain output, the
|
|
147
|
+
* watch daemon, files). These events carry what a live display needs and log lines can't
|
|
148
|
+
* say cleanly: the ASR runs at the same time as the LLM, every chunk has its own state, and
|
|
149
|
+
* a chunk the coverage check catches is transcribed again.
|
|
150
|
+
*/
|
|
151
|
+
/** The pipeline's stages, in the order they start. The ASR is not a stage: it runs
|
|
152
|
+
* alongside `describe` and `transcribe` and reports through `asr` events. */
|
|
153
|
+
type StageName = "preprocess" | "describe" | "transcribe" | "align" | "speakers" | "identify" | "finalize" | "summary";
|
|
154
|
+
/** A provider a zero-storage run uses that has no way to be asked to keep nothing; its own
|
|
155
|
+
* retention applies. */
|
|
156
|
+
interface UnaskedProvider {
|
|
157
|
+
/** The timing ASR's name ("ElevenLabs Scribe"), or a text reasoner's model ("deepseek-chat"). */
|
|
158
|
+
name: string;
|
|
159
|
+
/** What it gets: the audio, for word timings, or transcript text, to name speakers and
|
|
160
|
+
* write the summary. */
|
|
161
|
+
role: "timing" | "text";
|
|
162
|
+
}
|
|
163
|
+
/** The run's shape, known once the media is probed (before any paid call). */
|
|
164
|
+
interface PlanEvent {
|
|
165
|
+
type: "plan";
|
|
166
|
+
durationSec: number;
|
|
167
|
+
/** The transcription model. */
|
|
168
|
+
model: string;
|
|
169
|
+
/** The timing ASR by name ("AssemblyAI"), or "none" (the LLM's own timestamps). */
|
|
170
|
+
asr: string;
|
|
171
|
+
estimateUsd: number;
|
|
172
|
+
/** Whether this run asks providers to keep nothing (PipelineOptions.zeroStorage). */
|
|
173
|
+
zeroStorage: boolean;
|
|
174
|
+
/** With zero storage, the providers this run uses that can't be asked. */
|
|
175
|
+
notAsked: UnaskedProvider[];
|
|
176
|
+
}
|
|
177
|
+
/** A stage started, was satisfied from the run cache without running (`cached`), or
|
|
178
|
+
* failed without stopping the run (`failed`: the summary, or every naming pass). */
|
|
179
|
+
interface StageEvent {
|
|
180
|
+
type: "stage";
|
|
181
|
+
stage: StageName;
|
|
182
|
+
state: "start" | "cached" | "failed";
|
|
183
|
+
/** e.g. the reasoner model(s) naming the speakers. */
|
|
184
|
+
detail?: string;
|
|
185
|
+
}
|
|
186
|
+
/** The timing ASR. `cached` means its words came from the cache (nothing billed). */
|
|
187
|
+
interface AsrEvent {
|
|
188
|
+
type: "asr";
|
|
189
|
+
provider: string;
|
|
190
|
+
state: "start" | "done" | "cached" | "failed";
|
|
191
|
+
words?: number;
|
|
192
|
+
speakers?: number;
|
|
193
|
+
/** The language it transcribed in, when it says. */
|
|
194
|
+
language?: string;
|
|
195
|
+
error?: string;
|
|
196
|
+
}
|
|
197
|
+
/** How many chunks the transcribe stage will run (sent once, before the first chunk). */
|
|
198
|
+
interface ChunksEvent {
|
|
199
|
+
type: "chunks";
|
|
200
|
+
total: number;
|
|
201
|
+
chunkSec: number;
|
|
202
|
+
}
|
|
203
|
+
/** One chunk's transcription. `index` is 0-based. */
|
|
204
|
+
interface ChunkEvent {
|
|
205
|
+
type: "chunk";
|
|
206
|
+
index: number;
|
|
207
|
+
state: "running" | "done" | "cached" | "failed";
|
|
208
|
+
segments?: number;
|
|
209
|
+
error?: string;
|
|
210
|
+
}
|
|
211
|
+
/** The coverage check caught a chunk with too few words and transcribed it again in two
|
|
212
|
+
* halves: `retrying` as that starts, then `recovered` (the halves kept) or `unchanged`. A
|
|
213
|
+
* retry already in the cache sends only its outcome. */
|
|
214
|
+
interface GuardEvent {
|
|
215
|
+
type: "guard";
|
|
216
|
+
index: number;
|
|
217
|
+
/** The chunk's span in the recording (seconds). */
|
|
218
|
+
startSec: number;
|
|
219
|
+
endSec: number;
|
|
220
|
+
state: "retrying" | "recovered" | "unchanged";
|
|
221
|
+
llmWords: number;
|
|
222
|
+
asrWords: number;
|
|
223
|
+
/** Words in the two-half retry (with `recovered` / `unchanged`). */
|
|
224
|
+
retryWords?: number;
|
|
225
|
+
}
|
|
226
|
+
/** Names the naming pass gave the voices (speaker id → name). */
|
|
227
|
+
interface NamesEvent {
|
|
228
|
+
type: "names";
|
|
229
|
+
names: Record<string, string>;
|
|
230
|
+
}
|
|
231
|
+
/** The run finished and its outputs are written. */
|
|
232
|
+
interface DoneEvent {
|
|
233
|
+
type: "done";
|
|
234
|
+
segments: number;
|
|
235
|
+
speakers: number;
|
|
236
|
+
durationSec: number;
|
|
237
|
+
/** What the run cost, the summary included. */
|
|
238
|
+
costUsd?: number;
|
|
239
|
+
wallMs: number;
|
|
240
|
+
/** Chunks the coverage check transcribed again (and kept). */
|
|
241
|
+
retriedChunks: number;
|
|
242
|
+
/** Every file written, as absolute paths. */
|
|
243
|
+
outputs: string[];
|
|
244
|
+
}
|
|
245
|
+
type ProgressEvent = PlanEvent | StageEvent | AsrEvent | ChunksEvent | ChunkEvent | GuardEvent | NamesEvent | DoneEvent;
|
|
246
|
+
type ProgressListener = (event: ProgressEvent) => void;
|
|
247
|
+
|
|
114
248
|
/**
|
|
115
249
|
* Configuration: model presets, API-key resolution, pipeline options.
|
|
116
250
|
*
|
|
@@ -174,6 +308,10 @@ interface PipelineOptions {
|
|
|
174
308
|
reasoner?: string;
|
|
175
309
|
/** Timestamped provider. */
|
|
176
310
|
timestampedProvider?: TimestampedProvider;
|
|
311
|
+
/** Spoken language for the ASR (e.g. "ko", "ml", "hi"). Omitted, each ASR detects one
|
|
312
|
+
* language per file, which can fail on a meeting full of English loanwords. Changing it
|
|
313
|
+
* re-runs only the ASR (its cache is keyed by language), not the transcription. */
|
|
314
|
+
language?: string;
|
|
177
315
|
/** Speaker identification mode: "dual" (two reasoners + adjudication, default) or
|
|
178
316
|
* "single" (one reasoner; the self-introduction tripwire still applies). */
|
|
179
317
|
identifyMode?: "dual" | "single";
|
|
@@ -190,6 +328,13 @@ interface PipelineOptions {
|
|
|
190
328
|
/** Cooperative cancellation: checked at stage and chunk boundaries. Intermediates
|
|
191
329
|
* written so far stay on disk, so an aborted run resumes where it stopped. */
|
|
192
330
|
signal?: AbortSignal;
|
|
331
|
+
/** Live progress for a display (see progress.ts). Never affects the output or cache. */
|
|
332
|
+
onProgress?: ProgressListener;
|
|
333
|
+
/** Ask providers to keep nothing (default true): every Gemini request carries
|
|
334
|
+
* `store: false` (Google stores requests by default for paid projects created after
|
|
335
|
+
* 26 Oct 2026) and uploaded audio is deleted after each call; AssemblyAI's transcript
|
|
336
|
+
* is deleted once offmute has saved its own copy. False leaves providers' defaults. */
|
|
337
|
+
zeroStorage?: boolean;
|
|
193
338
|
}
|
|
194
339
|
type OutputFormat = "srt" | "md" | "json" | "txt" | "html";
|
|
195
340
|
type TimestampedProvider = "assemblyai" | "elevenlabs" | "whisper-groq" | "none";
|
|
@@ -200,8 +345,24 @@ declare function planChunks(totalDuration: number, chunkDuration: number, overla
|
|
|
200
345
|
declare function transcribe(opts: PipelineOptions): Promise<TranscriptResult>;
|
|
201
346
|
|
|
202
347
|
/**
|
|
203
|
-
*
|
|
204
|
-
*
|
|
348
|
+
* The models offmute uses when none is named. Plain constants, no Node imports: the
|
|
349
|
+
* browser build reads them too.
|
|
350
|
+
*/
|
|
351
|
+
/** Transcription default. Gemini 4 Hydrogen: on nine hard chunks of real meetings it kept
|
|
352
|
+
* 96.6% of the speech where Gemini 3.1 Pro (the 0.1.x default) kept 72.9%, at the same
|
|
353
|
+
* $0.74 per audio hour (docs/field-report-2, §8). Its thinking runs at LOW
|
|
354
|
+
* (providers/gemini-models.ts). */
|
|
355
|
+
declare const DEFAULT_TRANSCRIBE_MODEL = "gemini-4-hydrogen";
|
|
356
|
+
/** `--pro`: Gemini 4 Argon kept the most speech in the same bake-off (97.3%), at about
|
|
357
|
+
* 1.7× Hydrogen's time per chunk and, from 1 Dec 2026, about twice its price. */
|
|
358
|
+
declare const PRO_TRANSCRIBE_MODEL = "gemini-4-argon";
|
|
359
|
+
/** Speaker naming and summaries. */
|
|
360
|
+
declare const DEFAULT_REASONER_MODEL = "deepseek-chat";
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Per-chunk LLM transcription: call Gemini (streamed), parse relative mm:ss timestamps to
|
|
364
|
+
* absolute seconds (chunk offset), validate span + reject repetition loops, retry on
|
|
365
|
+
* failure (hotter after a loop).
|
|
205
366
|
*/
|
|
206
367
|
|
|
207
368
|
interface ParsedLlmSegment {
|
|
@@ -220,6 +381,10 @@ interface ParsedLlmSegment {
|
|
|
220
381
|
* owned by the previous chunk. Segments whose center is before this are dropped to
|
|
221
382
|
* avoid double-printing the overlap region. */
|
|
222
383
|
trustedStart?: number;
|
|
384
|
+
/** Absolute audio range of the source chunk (set by the pipeline): the only audio
|
|
385
|
+
* this segment can have been heard in. Alignment keeps its words inside it. */
|
|
386
|
+
chunkStart?: number;
|
|
387
|
+
chunkEnd?: number;
|
|
223
388
|
}
|
|
224
389
|
|
|
225
390
|
/**
|
|
@@ -307,13 +472,10 @@ interface ChatOptions {
|
|
|
307
472
|
/** What this call is for (logged): identify | … */
|
|
308
473
|
logKind?: string;
|
|
309
474
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
private providerName;
|
|
315
|
-
constructor(baseUrl: string, apiKey: string, defaultModel: string, providerName?: string);
|
|
316
|
-
static fromProvider(provider: string, apiKey: string, defaultModel: string): OpenAICompatClient;
|
|
475
|
+
/** The text-reasoning surface the naming and summary passes use. Implemented by
|
|
476
|
+
* OpenAICompatClient (DeepSeek, OpenAI, GLM, Kimi, Claude, …) and GeminiChatClient
|
|
477
|
+
* (Gemini over its native API). */
|
|
478
|
+
interface ChatClient {
|
|
317
479
|
chat(model: string | undefined, messages: ChatMessage[], opts?: ChatOptions): Promise<ChatResult>;
|
|
318
480
|
chatJson<T = unknown>(model: string | undefined, messages: ChatMessage[], opts?: ChatOptions): Promise<{
|
|
319
481
|
data: T | null;
|
|
@@ -346,7 +508,67 @@ interface IdentifyResult {
|
|
|
346
508
|
reasoning: string;
|
|
347
509
|
}
|
|
348
510
|
/** Identify speakers via a text reasoner. Returns a name map (speaker id → name). */
|
|
349
|
-
declare function identifySpeakers(client:
|
|
511
|
+
declare function identifySpeakers(client: ChatClient, model: string, segments: IdentifySegment[], speakers: SpeakerInfo[], roster: string, knownSpeakers?: string[], nameHints?: Record<string, string>, sourceFileName?: string): Promise<IdentifyResult>;
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Identify v2: speaker naming with a second opinion.
|
|
515
|
+
*
|
|
516
|
+
* Two different reasoner models name the speakers independently (same prompt), then a
|
|
517
|
+
* deterministic adjudicator merges the answers:
|
|
518
|
+
* - agreement → adopt (prefer the more complete form of the name);
|
|
519
|
+
* - disagreement → a candidate stays eligible only if its evidence quote actually
|
|
520
|
+
* appears in the transcript (hallucinated evidence disqualifies); if the survivors
|
|
521
|
+
* still disagree, keep the generic label — names are never invented under conflict;
|
|
522
|
+
* - the self-introduction tripwire ("I'm X" / "my name is X" inside a segment whose
|
|
523
|
+
* speaker got named Y) breaks ties toward the introduction.
|
|
524
|
+
*
|
|
525
|
+
* Motivating failure (fable baseline run, 2026-07-03): "Hi everyone, I'm Anly,
|
|
526
|
+
* co-founder and CEO…" attributed to an already-named *different* speaker — invisible
|
|
527
|
+
* to WER, obvious to a text check.
|
|
528
|
+
*/
|
|
529
|
+
|
|
530
|
+
interface ReasonerHandle {
|
|
531
|
+
client: ChatClient;
|
|
532
|
+
model: string;
|
|
533
|
+
provider: string;
|
|
534
|
+
}
|
|
535
|
+
interface IdentifyV2Decision {
|
|
536
|
+
speakerId: string;
|
|
537
|
+
nameA?: string;
|
|
538
|
+
nameB?: string;
|
|
539
|
+
outcome: "agreed" | "a-only" | "b-only" | "evidence-break" | "tripwire" | "elimination" | "conflict-fallback" | "kept-generic";
|
|
540
|
+
finalName?: string;
|
|
541
|
+
note?: string;
|
|
542
|
+
}
|
|
543
|
+
interface IdentifyV2Result {
|
|
544
|
+
nameMap: Record<string, string>;
|
|
545
|
+
decisions: IdentifyV2Decision[];
|
|
546
|
+
tripwires: {
|
|
547
|
+
speakerId: string;
|
|
548
|
+
introducedName: string;
|
|
549
|
+
segmentText: string;
|
|
550
|
+
}[];
|
|
551
|
+
passA: IdentifyResult & {
|
|
552
|
+
model: string;
|
|
553
|
+
};
|
|
554
|
+
passB?: IdentifyResult & {
|
|
555
|
+
model: string;
|
|
556
|
+
};
|
|
557
|
+
/** Every pass failed to run (an outage, an unparseable reply), so no naming happened;
|
|
558
|
+
* not the same as passes that ran and found no names. */
|
|
559
|
+
allPassesFailed: boolean;
|
|
560
|
+
}
|
|
561
|
+
interface IdentifyV2Options {
|
|
562
|
+
roster: string;
|
|
563
|
+
knownSpeakers?: string[];
|
|
564
|
+
/** Skip the second pass ("single") — one reasoner, tripwire still active. */
|
|
565
|
+
mode?: "dual" | "single";
|
|
566
|
+
/** Tentative names from the transcription labels (unverified, possibly swapped). */
|
|
567
|
+
nameHints?: Record<string, string>;
|
|
568
|
+
/** The recording's filename — meeting recorders often name participants in it. */
|
|
569
|
+
sourceFileName?: string;
|
|
570
|
+
}
|
|
571
|
+
declare function identifySpeakersV2(reasonerA: ReasonerHandle, reasonerB: ReasonerHandle | null, segments: IdentifySegment[], speakers: SpeakerInfo[], opts: IdentifyV2Options): Promise<IdentifyV2Result>;
|
|
350
572
|
|
|
351
573
|
/**
|
|
352
574
|
* Finalize: dedup chunk-overlap duplicates, fix timestamp overlaps, clamp durations,
|
|
@@ -357,12 +579,10 @@ declare function identifySpeakers(client: OpenAICompatClient, model: string, seg
|
|
|
357
579
|
* (ipgu noted clamping can re-introduce overlaps but didn't re-check).
|
|
358
580
|
*/
|
|
359
581
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
/** Convert aligned+consistent segments into the final Segment list (renumbered, deduped, clamped). */
|
|
365
|
-
declare function finalizeSegments(segments: AlignedSegment[], opts?: FinalizeOptions): Segment[];
|
|
582
|
+
/** Convert aligned+consistent segments into the final Segment list (renumbered, deduped,
|
|
583
|
+
* clamped). Segments are dropped only when they have no text: a one-word interjection the
|
|
584
|
+
* aligner could only place at a point in time is still something somebody said. */
|
|
585
|
+
declare function finalizeSegments(segments: AlignedSegment[]): Segment[];
|
|
366
586
|
|
|
367
587
|
/**
|
|
368
588
|
* Output formatting: diarized SRT (with tone), Markdown transcript, plain text, and JSON.
|
|
@@ -417,7 +637,7 @@ declare function formatHtml(result: TranscriptResult, opts?: {
|
|
|
417
637
|
* questions). offmute v1's most-loved feature, absent from v2 until now.
|
|
418
638
|
*/
|
|
419
639
|
|
|
420
|
-
declare function summarizeTranscript(client:
|
|
640
|
+
declare function summarizeTranscript(client: ChatClient, model: string, result: TranscriptResult, instructions?: string): Promise<string>;
|
|
421
641
|
|
|
422
642
|
interface ParsedSrtEntry {
|
|
423
643
|
id: number;
|
|
@@ -430,4 +650,4 @@ interface ParsedSrtEntry {
|
|
|
430
650
|
/** Parse an SRT file string into entries. Tolerant of BOM and \r\n. */
|
|
431
651
|
declare function parseSrt(content: string): ParsedSrtEntry[];
|
|
432
652
|
|
|
433
|
-
export { type AlignedSegment, type ApiKeys, type ChunkPlan, type Pass, type PipelineOptions, type Segment, type SpeakerInfo, type TimestampedUtterance, type TimestampedWord, type TranscriptMetadata, type TranscriptResult, alignSegments, assignGlobalSpeakers, finalizeSegments, formatHtml, formatJson, formatMarkdown, formatSrt, formatText, identifySpeakers, parseSrt, planChunks, summarizeTranscript, transcribe };
|
|
653
|
+
export { type AlignedSegment, type ApiKeys, type AsrEvent, type ChatClient, type ChunkEvent, type ChunkPlan, type ChunksEvent, DEFAULT_REASONER_MODEL, DEFAULT_TRANSCRIBE_MODEL, type DoneEvent, type GuardEvent, type IdentifyV2Decision, type IdentifyV2Options, type IdentifyV2Result, type NamesEvent, PRO_TRANSCRIBE_MODEL, type Pass, type PipelineOptions, type PlanEvent, type ProgressEvent, type ProgressListener, type ReasonerHandle, type Segment, type SpeakerInfo, type StageEvent, type StageName, type TimestampedProvider, type TimestampedUtterance, type TimestampedWord, type TranscriptMetadata, type TranscriptResult, type UnaskedProvider, alignSegments, assignGlobalSpeakers, finalizeSegments, formatHtml, formatJson, formatMarkdown, formatSrt, formatText, identifySpeakers, identifySpeakersV2, parseSrt, planChunks, summarizeTranscript, transcribe };
|
package/dist/index.d.ts
CHANGED
|
@@ -109,8 +109,142 @@ interface TranscriptMetadata {
|
|
|
109
109
|
inputTokens: number;
|
|
110
110
|
outputTokens: number;
|
|
111
111
|
};
|
|
112
|
+
/** How much of the recording the LLM transcript covered, chunk by chunk, and what was
|
|
113
|
+
* done where it didn't. "Every run reported success" was true of runs that silently
|
|
114
|
+
* lost minutes; this says where text came from the ASR instead. */
|
|
115
|
+
quality?: TranscriptQuality;
|
|
116
|
+
/** Whether this run asked providers to keep nothing (PipelineOptions.zeroStorage). */
|
|
117
|
+
zeroStorage?: boolean;
|
|
118
|
+
}
|
|
119
|
+
/** One LLM chunk's coverage against the ASR. */
|
|
120
|
+
interface ChunkQuality {
|
|
121
|
+
chunk: number;
|
|
122
|
+
start: number;
|
|
123
|
+
end: number;
|
|
124
|
+
/** ok · retried (re-transcribed in halves, now fine) · low-coverage (still short after any
|
|
125
|
+
* retry; the ASR filled what it could) · dropped-loop (a repetition loop, replaced by ASR) */
|
|
126
|
+
status: "ok" | "retried" | "low-coverage" | "dropped-loop";
|
|
127
|
+
/** Transcript words per ASR word (null when the ASR heard nothing here). */
|
|
128
|
+
coverage: number | null;
|
|
129
|
+
llmWords: number;
|
|
130
|
+
asrWords: number;
|
|
131
|
+
/** Few of its content words were also heard by the ASR (flagged, kept as transcribed). */
|
|
132
|
+
ungrounded?: boolean;
|
|
133
|
+
}
|
|
134
|
+
interface TranscriptQuality {
|
|
135
|
+
chunks: ChunkQuality[];
|
|
136
|
+
/** Words inserted from the ASR where no transcript segment covered its speech. */
|
|
137
|
+
gapFilledWords: number;
|
|
138
|
+
/** The ASR heard far fewer words than the transcript holds (often: another language). */
|
|
139
|
+
asrMissedSpeech: boolean;
|
|
112
140
|
}
|
|
113
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Structured progress events for live displays (the CLI's terminal renderer, or a library
|
|
144
|
+
* caller's own UI), delivered through `PipelineOptions.onProgress`.
|
|
145
|
+
*
|
|
146
|
+
* The pipeline still logs everything it logs; logs remain the record (plain output, the
|
|
147
|
+
* watch daemon, files). These events carry what a live display needs and log lines can't
|
|
148
|
+
* say cleanly: the ASR runs at the same time as the LLM, every chunk has its own state, and
|
|
149
|
+
* a chunk the coverage check catches is transcribed again.
|
|
150
|
+
*/
|
|
151
|
+
/** The pipeline's stages, in the order they start. The ASR is not a stage: it runs
|
|
152
|
+
* alongside `describe` and `transcribe` and reports through `asr` events. */
|
|
153
|
+
type StageName = "preprocess" | "describe" | "transcribe" | "align" | "speakers" | "identify" | "finalize" | "summary";
|
|
154
|
+
/** A provider a zero-storage run uses that has no way to be asked to keep nothing; its own
|
|
155
|
+
* retention applies. */
|
|
156
|
+
interface UnaskedProvider {
|
|
157
|
+
/** The timing ASR's name ("ElevenLabs Scribe"), or a text reasoner's model ("deepseek-chat"). */
|
|
158
|
+
name: string;
|
|
159
|
+
/** What it gets: the audio, for word timings, or transcript text, to name speakers and
|
|
160
|
+
* write the summary. */
|
|
161
|
+
role: "timing" | "text";
|
|
162
|
+
}
|
|
163
|
+
/** The run's shape, known once the media is probed (before any paid call). */
|
|
164
|
+
interface PlanEvent {
|
|
165
|
+
type: "plan";
|
|
166
|
+
durationSec: number;
|
|
167
|
+
/** The transcription model. */
|
|
168
|
+
model: string;
|
|
169
|
+
/** The timing ASR by name ("AssemblyAI"), or "none" (the LLM's own timestamps). */
|
|
170
|
+
asr: string;
|
|
171
|
+
estimateUsd: number;
|
|
172
|
+
/** Whether this run asks providers to keep nothing (PipelineOptions.zeroStorage). */
|
|
173
|
+
zeroStorage: boolean;
|
|
174
|
+
/** With zero storage, the providers this run uses that can't be asked. */
|
|
175
|
+
notAsked: UnaskedProvider[];
|
|
176
|
+
}
|
|
177
|
+
/** A stage started, was satisfied from the run cache without running (`cached`), or
|
|
178
|
+
* failed without stopping the run (`failed`: the summary, or every naming pass). */
|
|
179
|
+
interface StageEvent {
|
|
180
|
+
type: "stage";
|
|
181
|
+
stage: StageName;
|
|
182
|
+
state: "start" | "cached" | "failed";
|
|
183
|
+
/** e.g. the reasoner model(s) naming the speakers. */
|
|
184
|
+
detail?: string;
|
|
185
|
+
}
|
|
186
|
+
/** The timing ASR. `cached` means its words came from the cache (nothing billed). */
|
|
187
|
+
interface AsrEvent {
|
|
188
|
+
type: "asr";
|
|
189
|
+
provider: string;
|
|
190
|
+
state: "start" | "done" | "cached" | "failed";
|
|
191
|
+
words?: number;
|
|
192
|
+
speakers?: number;
|
|
193
|
+
/** The language it transcribed in, when it says. */
|
|
194
|
+
language?: string;
|
|
195
|
+
error?: string;
|
|
196
|
+
}
|
|
197
|
+
/** How many chunks the transcribe stage will run (sent once, before the first chunk). */
|
|
198
|
+
interface ChunksEvent {
|
|
199
|
+
type: "chunks";
|
|
200
|
+
total: number;
|
|
201
|
+
chunkSec: number;
|
|
202
|
+
}
|
|
203
|
+
/** One chunk's transcription. `index` is 0-based. */
|
|
204
|
+
interface ChunkEvent {
|
|
205
|
+
type: "chunk";
|
|
206
|
+
index: number;
|
|
207
|
+
state: "running" | "done" | "cached" | "failed";
|
|
208
|
+
segments?: number;
|
|
209
|
+
error?: string;
|
|
210
|
+
}
|
|
211
|
+
/** The coverage check caught a chunk with too few words and transcribed it again in two
|
|
212
|
+
* halves: `retrying` as that starts, then `recovered` (the halves kept) or `unchanged`. A
|
|
213
|
+
* retry already in the cache sends only its outcome. */
|
|
214
|
+
interface GuardEvent {
|
|
215
|
+
type: "guard";
|
|
216
|
+
index: number;
|
|
217
|
+
/** The chunk's span in the recording (seconds). */
|
|
218
|
+
startSec: number;
|
|
219
|
+
endSec: number;
|
|
220
|
+
state: "retrying" | "recovered" | "unchanged";
|
|
221
|
+
llmWords: number;
|
|
222
|
+
asrWords: number;
|
|
223
|
+
/** Words in the two-half retry (with `recovered` / `unchanged`). */
|
|
224
|
+
retryWords?: number;
|
|
225
|
+
}
|
|
226
|
+
/** Names the naming pass gave the voices (speaker id → name). */
|
|
227
|
+
interface NamesEvent {
|
|
228
|
+
type: "names";
|
|
229
|
+
names: Record<string, string>;
|
|
230
|
+
}
|
|
231
|
+
/** The run finished and its outputs are written. */
|
|
232
|
+
interface DoneEvent {
|
|
233
|
+
type: "done";
|
|
234
|
+
segments: number;
|
|
235
|
+
speakers: number;
|
|
236
|
+
durationSec: number;
|
|
237
|
+
/** What the run cost, the summary included. */
|
|
238
|
+
costUsd?: number;
|
|
239
|
+
wallMs: number;
|
|
240
|
+
/** Chunks the coverage check transcribed again (and kept). */
|
|
241
|
+
retriedChunks: number;
|
|
242
|
+
/** Every file written, as absolute paths. */
|
|
243
|
+
outputs: string[];
|
|
244
|
+
}
|
|
245
|
+
type ProgressEvent = PlanEvent | StageEvent | AsrEvent | ChunksEvent | ChunkEvent | GuardEvent | NamesEvent | DoneEvent;
|
|
246
|
+
type ProgressListener = (event: ProgressEvent) => void;
|
|
247
|
+
|
|
114
248
|
/**
|
|
115
249
|
* Configuration: model presets, API-key resolution, pipeline options.
|
|
116
250
|
*
|
|
@@ -174,6 +308,10 @@ interface PipelineOptions {
|
|
|
174
308
|
reasoner?: string;
|
|
175
309
|
/** Timestamped provider. */
|
|
176
310
|
timestampedProvider?: TimestampedProvider;
|
|
311
|
+
/** Spoken language for the ASR (e.g. "ko", "ml", "hi"). Omitted, each ASR detects one
|
|
312
|
+
* language per file, which can fail on a meeting full of English loanwords. Changing it
|
|
313
|
+
* re-runs only the ASR (its cache is keyed by language), not the transcription. */
|
|
314
|
+
language?: string;
|
|
177
315
|
/** Speaker identification mode: "dual" (two reasoners + adjudication, default) or
|
|
178
316
|
* "single" (one reasoner; the self-introduction tripwire still applies). */
|
|
179
317
|
identifyMode?: "dual" | "single";
|
|
@@ -190,6 +328,13 @@ interface PipelineOptions {
|
|
|
190
328
|
/** Cooperative cancellation: checked at stage and chunk boundaries. Intermediates
|
|
191
329
|
* written so far stay on disk, so an aborted run resumes where it stopped. */
|
|
192
330
|
signal?: AbortSignal;
|
|
331
|
+
/** Live progress for a display (see progress.ts). Never affects the output or cache. */
|
|
332
|
+
onProgress?: ProgressListener;
|
|
333
|
+
/** Ask providers to keep nothing (default true): every Gemini request carries
|
|
334
|
+
* `store: false` (Google stores requests by default for paid projects created after
|
|
335
|
+
* 26 Oct 2026) and uploaded audio is deleted after each call; AssemblyAI's transcript
|
|
336
|
+
* is deleted once offmute has saved its own copy. False leaves providers' defaults. */
|
|
337
|
+
zeroStorage?: boolean;
|
|
193
338
|
}
|
|
194
339
|
type OutputFormat = "srt" | "md" | "json" | "txt" | "html";
|
|
195
340
|
type TimestampedProvider = "assemblyai" | "elevenlabs" | "whisper-groq" | "none";
|
|
@@ -200,8 +345,24 @@ declare function planChunks(totalDuration: number, chunkDuration: number, overla
|
|
|
200
345
|
declare function transcribe(opts: PipelineOptions): Promise<TranscriptResult>;
|
|
201
346
|
|
|
202
347
|
/**
|
|
203
|
-
*
|
|
204
|
-
*
|
|
348
|
+
* The models offmute uses when none is named. Plain constants, no Node imports: the
|
|
349
|
+
* browser build reads them too.
|
|
350
|
+
*/
|
|
351
|
+
/** Transcription default. Gemini 4 Hydrogen: on nine hard chunks of real meetings it kept
|
|
352
|
+
* 96.6% of the speech where Gemini 3.1 Pro (the 0.1.x default) kept 72.9%, at the same
|
|
353
|
+
* $0.74 per audio hour (docs/field-report-2, §8). Its thinking runs at LOW
|
|
354
|
+
* (providers/gemini-models.ts). */
|
|
355
|
+
declare const DEFAULT_TRANSCRIBE_MODEL = "gemini-4-hydrogen";
|
|
356
|
+
/** `--pro`: Gemini 4 Argon kept the most speech in the same bake-off (97.3%), at about
|
|
357
|
+
* 1.7× Hydrogen's time per chunk and, from 1 Dec 2026, about twice its price. */
|
|
358
|
+
declare const PRO_TRANSCRIBE_MODEL = "gemini-4-argon";
|
|
359
|
+
/** Speaker naming and summaries. */
|
|
360
|
+
declare const DEFAULT_REASONER_MODEL = "deepseek-chat";
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Per-chunk LLM transcription: call Gemini (streamed), parse relative mm:ss timestamps to
|
|
364
|
+
* absolute seconds (chunk offset), validate span + reject repetition loops, retry on
|
|
365
|
+
* failure (hotter after a loop).
|
|
205
366
|
*/
|
|
206
367
|
|
|
207
368
|
interface ParsedLlmSegment {
|
|
@@ -220,6 +381,10 @@ interface ParsedLlmSegment {
|
|
|
220
381
|
* owned by the previous chunk. Segments whose center is before this are dropped to
|
|
221
382
|
* avoid double-printing the overlap region. */
|
|
222
383
|
trustedStart?: number;
|
|
384
|
+
/** Absolute audio range of the source chunk (set by the pipeline): the only audio
|
|
385
|
+
* this segment can have been heard in. Alignment keeps its words inside it. */
|
|
386
|
+
chunkStart?: number;
|
|
387
|
+
chunkEnd?: number;
|
|
223
388
|
}
|
|
224
389
|
|
|
225
390
|
/**
|
|
@@ -307,13 +472,10 @@ interface ChatOptions {
|
|
|
307
472
|
/** What this call is for (logged): identify | … */
|
|
308
473
|
logKind?: string;
|
|
309
474
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
private providerName;
|
|
315
|
-
constructor(baseUrl: string, apiKey: string, defaultModel: string, providerName?: string);
|
|
316
|
-
static fromProvider(provider: string, apiKey: string, defaultModel: string): OpenAICompatClient;
|
|
475
|
+
/** The text-reasoning surface the naming and summary passes use. Implemented by
|
|
476
|
+
* OpenAICompatClient (DeepSeek, OpenAI, GLM, Kimi, Claude, …) and GeminiChatClient
|
|
477
|
+
* (Gemini over its native API). */
|
|
478
|
+
interface ChatClient {
|
|
317
479
|
chat(model: string | undefined, messages: ChatMessage[], opts?: ChatOptions): Promise<ChatResult>;
|
|
318
480
|
chatJson<T = unknown>(model: string | undefined, messages: ChatMessage[], opts?: ChatOptions): Promise<{
|
|
319
481
|
data: T | null;
|
|
@@ -346,7 +508,67 @@ interface IdentifyResult {
|
|
|
346
508
|
reasoning: string;
|
|
347
509
|
}
|
|
348
510
|
/** Identify speakers via a text reasoner. Returns a name map (speaker id → name). */
|
|
349
|
-
declare function identifySpeakers(client:
|
|
511
|
+
declare function identifySpeakers(client: ChatClient, model: string, segments: IdentifySegment[], speakers: SpeakerInfo[], roster: string, knownSpeakers?: string[], nameHints?: Record<string, string>, sourceFileName?: string): Promise<IdentifyResult>;
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Identify v2: speaker naming with a second opinion.
|
|
515
|
+
*
|
|
516
|
+
* Two different reasoner models name the speakers independently (same prompt), then a
|
|
517
|
+
* deterministic adjudicator merges the answers:
|
|
518
|
+
* - agreement → adopt (prefer the more complete form of the name);
|
|
519
|
+
* - disagreement → a candidate stays eligible only if its evidence quote actually
|
|
520
|
+
* appears in the transcript (hallucinated evidence disqualifies); if the survivors
|
|
521
|
+
* still disagree, keep the generic label — names are never invented under conflict;
|
|
522
|
+
* - the self-introduction tripwire ("I'm X" / "my name is X" inside a segment whose
|
|
523
|
+
* speaker got named Y) breaks ties toward the introduction.
|
|
524
|
+
*
|
|
525
|
+
* Motivating failure (fable baseline run, 2026-07-03): "Hi everyone, I'm Anly,
|
|
526
|
+
* co-founder and CEO…" attributed to an already-named *different* speaker — invisible
|
|
527
|
+
* to WER, obvious to a text check.
|
|
528
|
+
*/
|
|
529
|
+
|
|
530
|
+
interface ReasonerHandle {
|
|
531
|
+
client: ChatClient;
|
|
532
|
+
model: string;
|
|
533
|
+
provider: string;
|
|
534
|
+
}
|
|
535
|
+
interface IdentifyV2Decision {
|
|
536
|
+
speakerId: string;
|
|
537
|
+
nameA?: string;
|
|
538
|
+
nameB?: string;
|
|
539
|
+
outcome: "agreed" | "a-only" | "b-only" | "evidence-break" | "tripwire" | "elimination" | "conflict-fallback" | "kept-generic";
|
|
540
|
+
finalName?: string;
|
|
541
|
+
note?: string;
|
|
542
|
+
}
|
|
543
|
+
interface IdentifyV2Result {
|
|
544
|
+
nameMap: Record<string, string>;
|
|
545
|
+
decisions: IdentifyV2Decision[];
|
|
546
|
+
tripwires: {
|
|
547
|
+
speakerId: string;
|
|
548
|
+
introducedName: string;
|
|
549
|
+
segmentText: string;
|
|
550
|
+
}[];
|
|
551
|
+
passA: IdentifyResult & {
|
|
552
|
+
model: string;
|
|
553
|
+
};
|
|
554
|
+
passB?: IdentifyResult & {
|
|
555
|
+
model: string;
|
|
556
|
+
};
|
|
557
|
+
/** Every pass failed to run (an outage, an unparseable reply), so no naming happened;
|
|
558
|
+
* not the same as passes that ran and found no names. */
|
|
559
|
+
allPassesFailed: boolean;
|
|
560
|
+
}
|
|
561
|
+
interface IdentifyV2Options {
|
|
562
|
+
roster: string;
|
|
563
|
+
knownSpeakers?: string[];
|
|
564
|
+
/** Skip the second pass ("single") — one reasoner, tripwire still active. */
|
|
565
|
+
mode?: "dual" | "single";
|
|
566
|
+
/** Tentative names from the transcription labels (unverified, possibly swapped). */
|
|
567
|
+
nameHints?: Record<string, string>;
|
|
568
|
+
/** The recording's filename — meeting recorders often name participants in it. */
|
|
569
|
+
sourceFileName?: string;
|
|
570
|
+
}
|
|
571
|
+
declare function identifySpeakersV2(reasonerA: ReasonerHandle, reasonerB: ReasonerHandle | null, segments: IdentifySegment[], speakers: SpeakerInfo[], opts: IdentifyV2Options): Promise<IdentifyV2Result>;
|
|
350
572
|
|
|
351
573
|
/**
|
|
352
574
|
* Finalize: dedup chunk-overlap duplicates, fix timestamp overlaps, clamp durations,
|
|
@@ -357,12 +579,10 @@ declare function identifySpeakers(client: OpenAICompatClient, model: string, seg
|
|
|
357
579
|
* (ipgu noted clamping can re-introduce overlaps but didn't re-check).
|
|
358
580
|
*/
|
|
359
581
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
/** Convert aligned+consistent segments into the final Segment list (renumbered, deduped, clamped). */
|
|
365
|
-
declare function finalizeSegments(segments: AlignedSegment[], opts?: FinalizeOptions): Segment[];
|
|
582
|
+
/** Convert aligned+consistent segments into the final Segment list (renumbered, deduped,
|
|
583
|
+
* clamped). Segments are dropped only when they have no text: a one-word interjection the
|
|
584
|
+
* aligner could only place at a point in time is still something somebody said. */
|
|
585
|
+
declare function finalizeSegments(segments: AlignedSegment[]): Segment[];
|
|
366
586
|
|
|
367
587
|
/**
|
|
368
588
|
* Output formatting: diarized SRT (with tone), Markdown transcript, plain text, and JSON.
|
|
@@ -417,7 +637,7 @@ declare function formatHtml(result: TranscriptResult, opts?: {
|
|
|
417
637
|
* questions). offmute v1's most-loved feature, absent from v2 until now.
|
|
418
638
|
*/
|
|
419
639
|
|
|
420
|
-
declare function summarizeTranscript(client:
|
|
640
|
+
declare function summarizeTranscript(client: ChatClient, model: string, result: TranscriptResult, instructions?: string): Promise<string>;
|
|
421
641
|
|
|
422
642
|
interface ParsedSrtEntry {
|
|
423
643
|
id: number;
|
|
@@ -430,4 +650,4 @@ interface ParsedSrtEntry {
|
|
|
430
650
|
/** Parse an SRT file string into entries. Tolerant of BOM and \r\n. */
|
|
431
651
|
declare function parseSrt(content: string): ParsedSrtEntry[];
|
|
432
652
|
|
|
433
|
-
export { type AlignedSegment, type ApiKeys, type ChunkPlan, type Pass, type PipelineOptions, type Segment, type SpeakerInfo, type TimestampedUtterance, type TimestampedWord, type TranscriptMetadata, type TranscriptResult, alignSegments, assignGlobalSpeakers, finalizeSegments, formatHtml, formatJson, formatMarkdown, formatSrt, formatText, identifySpeakers, parseSrt, planChunks, summarizeTranscript, transcribe };
|
|
653
|
+
export { type AlignedSegment, type ApiKeys, type AsrEvent, type ChatClient, type ChunkEvent, type ChunkPlan, type ChunksEvent, DEFAULT_REASONER_MODEL, DEFAULT_TRANSCRIBE_MODEL, type DoneEvent, type GuardEvent, type IdentifyV2Decision, type IdentifyV2Options, type IdentifyV2Result, type NamesEvent, PRO_TRANSCRIBE_MODEL, type Pass, type PipelineOptions, type PlanEvent, type ProgressEvent, type ProgressListener, type ReasonerHandle, type Segment, type SpeakerInfo, type StageEvent, type StageName, type TimestampedProvider, type TimestampedUtterance, type TimestampedWord, type TranscriptMetadata, type TranscriptResult, type UnaskedProvider, alignSegments, assignGlobalSpeakers, finalizeSegments, formatHtml, formatJson, formatMarkdown, formatSrt, formatText, identifySpeakers, identifySpeakersV2, parseSrt, planChunks, summarizeTranscript, transcribe };
|