Files
OSGKeyboard/OSGKeyboardShared/Utilities/FlowPipelineDiagnostics.swift
T
Cursor Agent c7ee891a90 fix(flow): improve tail capture and final chunk ASR recovery
- Add FlowUtteranceEndCoordinator with 350ms silence drain and 150ms post-roll
- Extend FinalChunkRecovery for short/empty final chunks in chunked pipeline
- Snapshot partial at mic stop and guard final transcript in FlowSessionManager
- Unify tail drain presets (iosFlow/macMLX) and expand diagnostics

Co-authored-by: Rocky <hkgood@users.noreply.github.com>
2026-07-26 10:13:40 +00:00

45 lines
1.5 KiB
Swift

// FlowPipelineDiagnostics.swift
// OSGKeyboard · Shared
//
// Structured Flow pipeline metrics for Console.app filtering.
import Foundation
import os
public enum FlowPipelineDiagnostics {
public static func logDrain(_ report: FlowCaptureDrainReport) {
OSGLog.flow.info(
"tailDrain duration=\(report.drainDurationSeconds, format: .fixed(precision: 2))s " +
"postRoll=\(report.postRollDurationSeconds, format: .fixed(precision: 2))s " +
"silenceEnd=\(report.endedBySilence) tailSamples=\(report.tailSampleCount)"
)
}
public static func logTranscriptGuardUsedPartial(finalLength: Int, partialLength: Int) {
OSGLog.flow.warning(
"transcriptGuard partial preferred finalLen=\(finalLength) partialLen=\(partialLength)"
)
}
public static func logFinalChunkRecovery(action: String, chunkIndex: Int) {
OSGLog.asr.info("finalChunkRecovery \(action) chunk=\(chunkIndex)")
}
public static func logChunkFinalize(
chunkCount: Int,
lastChunkSamples: Int,
stitchedLength: Int,
chunkWarnings: Int
) {
OSGLog.flow.info(
"chunkPipeline chunks=\(chunkCount) lastChunkSamples=\(lastChunkSamples) stitchedLen=\(stitchedLength) warnings=\(chunkWarnings)"
)
}
public static func logStitcherSafeFallback(naiveLength: Int, mergedLength: Int) {
OSGLog.asr.warning(
"stitcher safe fallback naive=\(naiveLength) merged=\(mergedLength)"
)
}
}