offmute-v2 0.0.5 → 0.1.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/dist/index.d.cts CHANGED
@@ -97,6 +97,18 @@ interface TranscriptMetadata {
97
97
  processedAt: string;
98
98
  models: Record<string, string>;
99
99
  passes: string[];
100
+ /** Wall-clock processing time (ms). */
101
+ wallMs?: number;
102
+ /** Cost accounting for this run (list-price estimates, see pricing.ts). */
103
+ cost?: {
104
+ estimatedUsd: number;
105
+ actualUsd: number;
106
+ pricesAsOf: string;
107
+ lines: string[];
108
+ llmCalls: number;
109
+ inputTokens: number;
110
+ outputTokens: number;
111
+ };
100
112
  }
101
113
 
102
114
  /**
@@ -115,6 +127,12 @@ interface ApiKeys {
115
127
  groq?: string;
116
128
  assemblyai?: string;
117
129
  anthropic?: string;
130
+ /** z.ai (GLM models). GLM_API_KEY is accepted as an env alias. */
131
+ zai?: string;
132
+ /** Moonshot (Kimi models). */
133
+ kimi?: string;
134
+ /** ElevenLabs (Scribe timestamped transcription). */
135
+ elevenlabs?: string;
118
136
  }
119
137
  interface PipelineOptions {
120
138
  /** Input file path. */
@@ -141,7 +159,11 @@ interface PipelineOptions {
141
159
  /** Save intermediates (default true). */
142
160
  saveIntermediates?: boolean;
143
161
  /** Output formats. */
144
- formats?: ("srt" | "md" | "json")[];
162
+ formats?: OutputFormat[];
163
+ /** Markdown layout: merged same-speaker paragraphs (default) or one block per turn. */
164
+ mdStyle?: "merged" | "turns";
165
+ /** Write a meeting summary (<name>.summary.md) via the reasoner. Default false. */
166
+ summary?: boolean;
145
167
  /** Target diarization level. */
146
168
  diarizationLevel?: 1 | 2 | 3;
147
169
  /** Injected API keys (override env). */
@@ -151,7 +173,10 @@ interface PipelineOptions {
151
173
  /** Override the text-reasoner model (identification pass). */
152
174
  reasoner?: string;
153
175
  /** Timestamped provider. */
154
- timestampedProvider?: "assemblyai" | "whisper-groq" | "none";
176
+ timestampedProvider?: TimestampedProvider;
177
+ /** Speaker identification mode: "dual" (two reasoners + adjudication, default) or
178
+ * "single" (one reasoner; the self-introduction tripwire still applies). */
179
+ identifyMode?: "dual" | "single";
155
180
  /** Force reprocessing of cached chunk outputs. */
156
181
  force?: boolean;
157
182
  /** Process only a specific chunk index (debugging). */
@@ -162,7 +187,12 @@ interface PipelineOptions {
162
187
  llmLog?: boolean;
163
188
  /** Log level. */
164
189
  logLevel?: "debug" | "info" | "warn" | "error";
190
+ /** Cooperative cancellation: checked at stage and chunk boundaries. Intermediates
191
+ * written so far stay on disk, so an aborted run resumes where it stopped. */
192
+ signal?: AbortSignal;
165
193
  }
194
+ type OutputFormat = "srt" | "md" | "json" | "txt" | "html";
195
+ type TimestampedProvider = "assemblyai" | "elevenlabs" | "whisper-groq" | "none";
166
196
  type Pass = "preprocess" | "describe" | "llm-transcribe" | "timestamped" | "align" | "consistency" | "identify" | "finalize";
167
197
  /** Build a chunk plan with overlap + trustedStart (for clean dedup). */
168
198
  declare function planChunks(totalDuration: number, chunkDuration: number, overlap: number): ChunkPlan[];
@@ -316,7 +346,7 @@ interface IdentifyResult {
316
346
  reasoning: string;
317
347
  }
318
348
  /** Identify speakers via a text reasoner. Returns a name map (speaker id → name). */
319
- declare function identifySpeakers(client: OpenAICompatClient, model: string, segments: IdentifySegment[], speakers: SpeakerInfo[], roster: string, knownSpeakers?: string[]): Promise<IdentifyResult>;
349
+ declare function identifySpeakers(client: OpenAICompatClient, model: string, segments: IdentifySegment[], speakers: SpeakerInfo[], roster: string, knownSpeakers?: string[], nameHints?: Record<string, string>, sourceFileName?: string): Promise<IdentifyResult>;
320
350
 
321
351
  /**
322
352
  * Finalize: dedup chunk-overlap duplicates, fix timestamp overlaps, clamp durations,
@@ -335,28 +365,60 @@ interface FinalizeOptions {
335
365
  declare function finalizeSegments(segments: AlignedSegment[], opts?: FinalizeOptions): Segment[];
336
366
 
337
367
  /**
338
- * Output formatting: diarized SRT (with tone), Markdown transcript, and JSON.
368
+ * Output formatting: diarized SRT (with tone), Markdown transcript, plain text, and JSON.
369
+ *
370
+ * Markdown ships in two styles:
371
+ * - "merged" (default): consecutive same-speaker segments join into one paragraph —
372
+ * the formatting that reads best over long transcripts. Merging happens HERE, in the
373
+ * formatter only; the underlying segments are never merged (measured WER regression
374
+ * when segments were merged upstream — boundary words duplicate).
375
+ * - "turns": one block per segment (the previous default), useful when you want the
376
+ * fine-grained turn structure visible.
339
377
  *
340
378
  * SRT breaking (spec §5): each finalized segment is one speaker turn. Long turns are
341
- * split into readable blocks (≤ maxChars / ≤ maxSec) using per-word timing so block
342
- * boundaries stay time-accurate. The speaker label prefixes each block.
379
+ * split into readable blocks (≤ MAX_CHARS / ≤ MAX_BLOCK_SEC) using per-word timing when
380
+ * available, or proportional timing otherwise — so no cue is ever "too thick to read".
343
381
  */
344
382
 
345
383
  interface FormatOptions {
346
384
  /** Prefix each SRT block with "Speaker: ". Default true. */
347
385
  labelSpeakers?: boolean;
348
- /** Append "(tone)" to blocks that have tone tags. Default true. */
386
+ /** Show "(tone)" annotations. Default true. */
349
387
  showTone?: boolean;
350
388
  /** Title for the markdown transcript. */
351
389
  title?: string;
390
+ /** Markdown layout: merged same-speaker paragraphs (default) or one block per turn. */
391
+ mdStyle?: "merged" | "turns";
392
+ /** Include [mm:ss] timestamps in markdown/text. Default true. */
393
+ timestamps?: boolean;
352
394
  }
353
395
  /** Format the transcript as a diarized SRT. */
354
396
  declare function formatSrt(result: TranscriptResult, opts?: FormatOptions): string;
355
- /** Format as a readable markdown transcript. */
397
+ /** Format as a readable markdown transcript (merged paragraphs by default). */
356
398
  declare function formatMarkdown(result: TranscriptResult, opts?: FormatOptions): string;
399
+ /** Format as compact plain text (no markdown syntax). */
400
+ declare function formatText(result: TranscriptResult, opts?: FormatOptions): string;
357
401
  /** Format as JSON (full structured result). */
358
402
  declare function formatJson(result: TranscriptResult): string;
359
403
 
404
+ /**
405
+ * HTML output: one self-contained file (no JS frameworks, no network) — the
406
+ * shareable "here's the meeting" artifact. Speaker-colored merged paragraphs,
407
+ * sticky legend, tone as subtle badges, click a timestamp to copy it.
408
+ */
409
+
410
+ declare function formatHtml(result: TranscriptResult, opts?: {
411
+ title?: string;
412
+ }): string;
413
+
414
+ /**
415
+ * Summary pass (--summary): one reasoner call over the final transcript → a meeting
416
+ * summary markdown (TL;DR, decisions, action items, per-speaker positions, open
417
+ * questions). offmute v1's most-loved feature, absent from v2 until now.
418
+ */
419
+
420
+ declare function summarizeTranscript(client: OpenAICompatClient, model: string, result: TranscriptResult, instructions?: string): Promise<string>;
421
+
360
422
  interface ParsedSrtEntry {
361
423
  id: number;
362
424
  start: number;
@@ -368,4 +430,4 @@ interface ParsedSrtEntry {
368
430
  /** Parse an SRT file string into entries. Tolerant of BOM and \r\n. */
369
431
  declare function parseSrt(content: string): ParsedSrtEntry[];
370
432
 
371
- 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, formatJson, formatMarkdown, formatSrt, identifySpeakers, parseSrt, planChunks, transcribe };
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 };
package/dist/index.d.ts CHANGED
@@ -97,6 +97,18 @@ interface TranscriptMetadata {
97
97
  processedAt: string;
98
98
  models: Record<string, string>;
99
99
  passes: string[];
100
+ /** Wall-clock processing time (ms). */
101
+ wallMs?: number;
102
+ /** Cost accounting for this run (list-price estimates, see pricing.ts). */
103
+ cost?: {
104
+ estimatedUsd: number;
105
+ actualUsd: number;
106
+ pricesAsOf: string;
107
+ lines: string[];
108
+ llmCalls: number;
109
+ inputTokens: number;
110
+ outputTokens: number;
111
+ };
100
112
  }
101
113
 
102
114
  /**
@@ -115,6 +127,12 @@ interface ApiKeys {
115
127
  groq?: string;
116
128
  assemblyai?: string;
117
129
  anthropic?: string;
130
+ /** z.ai (GLM models). GLM_API_KEY is accepted as an env alias. */
131
+ zai?: string;
132
+ /** Moonshot (Kimi models). */
133
+ kimi?: string;
134
+ /** ElevenLabs (Scribe timestamped transcription). */
135
+ elevenlabs?: string;
118
136
  }
119
137
  interface PipelineOptions {
120
138
  /** Input file path. */
@@ -141,7 +159,11 @@ interface PipelineOptions {
141
159
  /** Save intermediates (default true). */
142
160
  saveIntermediates?: boolean;
143
161
  /** Output formats. */
144
- formats?: ("srt" | "md" | "json")[];
162
+ formats?: OutputFormat[];
163
+ /** Markdown layout: merged same-speaker paragraphs (default) or one block per turn. */
164
+ mdStyle?: "merged" | "turns";
165
+ /** Write a meeting summary (<name>.summary.md) via the reasoner. Default false. */
166
+ summary?: boolean;
145
167
  /** Target diarization level. */
146
168
  diarizationLevel?: 1 | 2 | 3;
147
169
  /** Injected API keys (override env). */
@@ -151,7 +173,10 @@ interface PipelineOptions {
151
173
  /** Override the text-reasoner model (identification pass). */
152
174
  reasoner?: string;
153
175
  /** Timestamped provider. */
154
- timestampedProvider?: "assemblyai" | "whisper-groq" | "none";
176
+ timestampedProvider?: TimestampedProvider;
177
+ /** Speaker identification mode: "dual" (two reasoners + adjudication, default) or
178
+ * "single" (one reasoner; the self-introduction tripwire still applies). */
179
+ identifyMode?: "dual" | "single";
155
180
  /** Force reprocessing of cached chunk outputs. */
156
181
  force?: boolean;
157
182
  /** Process only a specific chunk index (debugging). */
@@ -162,7 +187,12 @@ interface PipelineOptions {
162
187
  llmLog?: boolean;
163
188
  /** Log level. */
164
189
  logLevel?: "debug" | "info" | "warn" | "error";
190
+ /** Cooperative cancellation: checked at stage and chunk boundaries. Intermediates
191
+ * written so far stay on disk, so an aborted run resumes where it stopped. */
192
+ signal?: AbortSignal;
165
193
  }
194
+ type OutputFormat = "srt" | "md" | "json" | "txt" | "html";
195
+ type TimestampedProvider = "assemblyai" | "elevenlabs" | "whisper-groq" | "none";
166
196
  type Pass = "preprocess" | "describe" | "llm-transcribe" | "timestamped" | "align" | "consistency" | "identify" | "finalize";
167
197
  /** Build a chunk plan with overlap + trustedStart (for clean dedup). */
168
198
  declare function planChunks(totalDuration: number, chunkDuration: number, overlap: number): ChunkPlan[];
@@ -316,7 +346,7 @@ interface IdentifyResult {
316
346
  reasoning: string;
317
347
  }
318
348
  /** Identify speakers via a text reasoner. Returns a name map (speaker id → name). */
319
- declare function identifySpeakers(client: OpenAICompatClient, model: string, segments: IdentifySegment[], speakers: SpeakerInfo[], roster: string, knownSpeakers?: string[]): Promise<IdentifyResult>;
349
+ declare function identifySpeakers(client: OpenAICompatClient, model: string, segments: IdentifySegment[], speakers: SpeakerInfo[], roster: string, knownSpeakers?: string[], nameHints?: Record<string, string>, sourceFileName?: string): Promise<IdentifyResult>;
320
350
 
321
351
  /**
322
352
  * Finalize: dedup chunk-overlap duplicates, fix timestamp overlaps, clamp durations,
@@ -335,28 +365,60 @@ interface FinalizeOptions {
335
365
  declare function finalizeSegments(segments: AlignedSegment[], opts?: FinalizeOptions): Segment[];
336
366
 
337
367
  /**
338
- * Output formatting: diarized SRT (with tone), Markdown transcript, and JSON.
368
+ * Output formatting: diarized SRT (with tone), Markdown transcript, plain text, and JSON.
369
+ *
370
+ * Markdown ships in two styles:
371
+ * - "merged" (default): consecutive same-speaker segments join into one paragraph —
372
+ * the formatting that reads best over long transcripts. Merging happens HERE, in the
373
+ * formatter only; the underlying segments are never merged (measured WER regression
374
+ * when segments were merged upstream — boundary words duplicate).
375
+ * - "turns": one block per segment (the previous default), useful when you want the
376
+ * fine-grained turn structure visible.
339
377
  *
340
378
  * SRT breaking (spec §5): each finalized segment is one speaker turn. Long turns are
341
- * split into readable blocks (≤ maxChars / ≤ maxSec) using per-word timing so block
342
- * boundaries stay time-accurate. The speaker label prefixes each block.
379
+ * split into readable blocks (≤ MAX_CHARS / ≤ MAX_BLOCK_SEC) using per-word timing when
380
+ * available, or proportional timing otherwise — so no cue is ever "too thick to read".
343
381
  */
344
382
 
345
383
  interface FormatOptions {
346
384
  /** Prefix each SRT block with "Speaker: ". Default true. */
347
385
  labelSpeakers?: boolean;
348
- /** Append "(tone)" to blocks that have tone tags. Default true. */
386
+ /** Show "(tone)" annotations. Default true. */
349
387
  showTone?: boolean;
350
388
  /** Title for the markdown transcript. */
351
389
  title?: string;
390
+ /** Markdown layout: merged same-speaker paragraphs (default) or one block per turn. */
391
+ mdStyle?: "merged" | "turns";
392
+ /** Include [mm:ss] timestamps in markdown/text. Default true. */
393
+ timestamps?: boolean;
352
394
  }
353
395
  /** Format the transcript as a diarized SRT. */
354
396
  declare function formatSrt(result: TranscriptResult, opts?: FormatOptions): string;
355
- /** Format as a readable markdown transcript. */
397
+ /** Format as a readable markdown transcript (merged paragraphs by default). */
356
398
  declare function formatMarkdown(result: TranscriptResult, opts?: FormatOptions): string;
399
+ /** Format as compact plain text (no markdown syntax). */
400
+ declare function formatText(result: TranscriptResult, opts?: FormatOptions): string;
357
401
  /** Format as JSON (full structured result). */
358
402
  declare function formatJson(result: TranscriptResult): string;
359
403
 
404
+ /**
405
+ * HTML output: one self-contained file (no JS frameworks, no network) — the
406
+ * shareable "here's the meeting" artifact. Speaker-colored merged paragraphs,
407
+ * sticky legend, tone as subtle badges, click a timestamp to copy it.
408
+ */
409
+
410
+ declare function formatHtml(result: TranscriptResult, opts?: {
411
+ title?: string;
412
+ }): string;
413
+
414
+ /**
415
+ * Summary pass (--summary): one reasoner call over the final transcript → a meeting
416
+ * summary markdown (TL;DR, decisions, action items, per-speaker positions, open
417
+ * questions). offmute v1's most-loved feature, absent from v2 until now.
418
+ */
419
+
420
+ declare function summarizeTranscript(client: OpenAICompatClient, model: string, result: TranscriptResult, instructions?: string): Promise<string>;
421
+
360
422
  interface ParsedSrtEntry {
361
423
  id: number;
362
424
  start: number;
@@ -368,4 +430,4 @@ interface ParsedSrtEntry {
368
430
  /** Parse an SRT file string into entries. Tolerant of BOM and \r\n. */
369
431
  declare function parseSrt(content: string): ParsedSrtEntry[];
370
432
 
371
- 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, formatJson, formatMarkdown, formatSrt, identifySpeakers, parseSrt, planChunks, transcribe };
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 };