ai-interview-assistant 2.3.0__tar.gz → 2.3.3__tar.gz

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.
Files changed (46) hide show
  1. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/PKG-INFO +2 -2
  2. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/pyproject.toml +2 -2
  3. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/__init__.py +1 -1
  4. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/audio/capture.py +19 -76
  5. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/audio/transcriber.py +18 -33
  6. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/daemon.py +0 -33
  7. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview_assistant.egg-info/PKG-INFO +2 -2
  8. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview_assistant.egg-info/requires.txt +1 -1
  9. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/tests/test_transcription_phase.py +2 -41
  10. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/README.md +0 -0
  11. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/setup.cfg +0 -0
  12. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/__main__.py +0 -0
  13. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/ai_client.py +0 -0
  14. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/audio/__init__.py +0 -0
  15. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/buffer.py +0 -0
  16. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/cli.py +0 -0
  17. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/config.py +0 -0
  18. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/flet_gui/__init__.py +0 -0
  19. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/flet_gui/__main__.py +0 -0
  20. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/flet_gui/app.py +0 -0
  21. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/flet_gui/screens/__init__.py +0 -0
  22. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/flet_gui/screens/dashboard.py +0 -0
  23. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/flet_gui/screens/hotkeys.py +0 -0
  24. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/flet_gui/screens/scripts.py +0 -0
  25. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/flet_gui/screens/settings.py +0 -0
  26. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/hotkey_config.py +0 -0
  27. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/hotkeys.py +0 -0
  28. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/i18n.py +0 -0
  29. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/llm_clients.py +0 -0
  30. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/menubar.py +0 -0
  31. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/metrics.py +0 -0
  32. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/ollama_utils.py +0 -0
  33. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/overlay.py +0 -0
  34. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/screenshot.py +0 -0
  35. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/server/__init__.py +0 -0
  36. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/server/app.py +0 -0
  37. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/server/routes.py +0 -0
  38. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/server/websocket.py +0 -0
  39. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/state.py +0 -0
  40. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/utils.py +0 -0
  41. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview/watchdog.py +0 -0
  42. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview_assistant.egg-info/SOURCES.txt +0 -0
  43. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview_assistant.egg-info/dependency_links.txt +0 -0
  44. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview_assistant.egg-info/entry_points.txt +0 -0
  45. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/src/ai_interview_assistant.egg-info/top_level.txt +0 -0
  46. {ai_interview_assistant-2.3.0 → ai_interview_assistant-2.3.3}/tests/test_llm_clients.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ai-interview-assistant
3
- Version: 2.3.0
3
+ Version: 2.3.3
4
4
  Summary: Ghost background AI assistant for live code challenges
5
5
  Requires-Python: >=3.11
6
6
  Requires-Dist: click>=8.0
@@ -28,7 +28,7 @@ Requires-Dist: datadog>=0.49.0
28
28
  Requires-Dist: psutil>=5.9
29
29
  Requires-Dist: httpx>=0.27.0
30
30
  Requires-Dist: h2>=4.0
31
- Requires-Dist: flet>=0.25.0
31
+ Requires-Dist: flet<0.84,>=0.25.0
32
32
  Requires-Dist: PyPDF2>=3.0
33
33
  Provides-Extra: dev
34
34
  Requires-Dist: pytest>=8.0; extra == "dev"
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ai-interview-assistant"
7
- version = "2.3.0"
7
+ version = "2.3.3"
8
8
  description = "Ghost background AI assistant for live code challenges"
9
9
  requires-python = ">=3.11"
10
10
  dependencies = [
@@ -33,7 +33,7 @@ dependencies = [
33
33
  "psutil>=5.9",
34
34
  "httpx>=0.27.0",
35
35
  "h2>=4.0",
36
- "flet>=0.25.0",
36
+ "flet>=0.25.0,<0.84",
37
37
  "PyPDF2>=3.0",
38
38
  ]
39
39
 
@@ -1,3 +1,3 @@
1
1
  """AI Interview Assistant — ghost background tool for live code challenges."""
2
2
 
3
- __version__ = "2.3.0"
3
+ __version__ = "2.3.3"
@@ -285,33 +285,6 @@ class ScreenCaptureAudio:
285
285
  # Combined capture: mic + system audio
286
286
  # ---------------------------------------------------------------------------
287
287
 
288
- class _QueueAudioSource:
289
- """Minimal capture-like adapter over a single Queue.
290
-
291
- Exposes the same ``get_audio`` / ``flush`` surface a DeepgramTranscriber pulls
292
- from, so a second transcriber can consume the candidate (mic) stream from its
293
- own queue without knowing about CombinedAudioCapture internals.
294
- """
295
-
296
- def __init__(self, queue: "Queue") -> None:
297
- self._queue = queue
298
-
299
- def get_audio(self, timeout: float = 0.1) -> Optional[np.ndarray]:
300
- try:
301
- return self._queue.get(timeout=timeout)
302
- except Empty:
303
- return None
304
-
305
- def flush(self) -> int:
306
- dropped = 0
307
- while True:
308
- try:
309
- self._queue.get_nowait()
310
- dropped += 1
311
- except Empty:
312
- return dropped
313
-
314
-
315
288
  class CombinedAudioCapture:
316
289
  """Mixes microphone + system audio and feeds a Queue for the transcriber."""
317
290
 
@@ -324,11 +297,6 @@ class CombinedAudioCapture:
324
297
  def __init__(self, sample_rate: int = SAMPLE_RATE) -> None:
325
298
  self.sample_rate = sample_rate
326
299
  self.audio_queue: Queue[np.ndarray] = Queue()
327
- # Separate queue carrying the microphone (candidate) stream when system
328
- # audio is the primary source. Only fed while a mic transcriber is active
329
- # (see _mic_routing) so it never grows unbounded when unused.
330
- self.mic_queue: Queue[np.ndarray] = Queue()
331
- self._mic_routing = False
332
300
  self._stop_event = Event()
333
301
  self._mic: Optional[MicrophoneCapture] = None
334
302
  self._sys: Optional[ScreenCaptureAudio] = None
@@ -383,12 +351,14 @@ class CombinedAudioCapture:
383
351
  # transcriber is routing the candidate stream; otherwise drain-and-
384
352
  # discard.
385
353
  if self._mic:
386
- keep_mic = (not self._has_system_audio) or self._mic_routing
387
354
  while True:
388
355
  mic_chunk = self._mic.get_audio(timeout=0)
389
356
  if mic_chunk is None:
390
357
  break
391
- if keep_mic:
358
+ # Mic feeds the transcriber only as a fallback when there is no
359
+ # system audio; otherwise drain-and-discard so its queue can't
360
+ # back up. (Only the interviewer's voice is transcribed.)
361
+ if not self._has_system_audio:
392
362
  mic_buf.extend(mic_chunk.flatten())
393
363
 
394
364
  # Drain the system-audio queue fully (non-blocking).
@@ -402,12 +372,9 @@ class CombinedAudioCapture:
402
372
  # Emit EVERY complete chunk this iteration (system audio decoupled from
403
373
  # mic — it never waits on the mic having a chunk ready).
404
374
  if self._has_system_audio:
405
- produced = self._emit_all_chunks(sys_buf, chunk_size, self.audio_queue)
406
- # Candidate's own voice → separate queue for the mic transcriber.
407
- if self._mic_routing:
408
- produced += self._emit_all_chunks(mic_buf, chunk_size, self.mic_queue)
375
+ produced = self._emit_all_chunks(sys_buf, chunk_size)
409
376
  else:
410
- produced = self._emit_all_chunks(mic_buf, chunk_size, self.audio_queue)
377
+ produced = self._emit_all_chunks(mic_buf, chunk_size)
411
378
 
412
379
  # Stall-recovery: if the downstream consumer (Deepgram feed loop) has
413
380
  # fallen behind real-time, trim oldest queued chunks so transcripts stay
@@ -417,11 +384,6 @@ class CombinedAudioCapture:
417
384
  if trimmed:
418
385
  _trim_events += 1
419
386
  _trim_chunks += trimmed
420
- # Bound the secondary (mic) queue too — if its transcriber dies (no
421
- # Whisper fallback) routing stays on, so without this it would grow
422
- # without limit. Same drop-oldest-to-stay-live policy as the primary.
423
- if self._mic_routing:
424
- self._trim_queue(self.mic_queue)
425
387
  now = time.time()
426
388
  if _trim_events and now - _last_drain_warn > 30:
427
389
  import logging
@@ -442,9 +404,9 @@ class CombinedAudioCapture:
442
404
  if not produced:
443
405
  time.sleep(0.005)
444
406
 
445
- def _emit_all_chunks(self, buf: "deque", chunk_size: int, queue: "Queue") -> int:
407
+ def _emit_all_chunks(self, buf: "deque", chunk_size: int) -> int:
446
408
  """Pop every complete ``chunk_size`` window from ``buf`` and forward it to
447
- ``queue``. Returns the number of chunks emitted.
409
+ the transcriber queue. Returns the number of chunks emitted.
448
410
 
449
411
  Draining all complete chunks (not just one per call) is what keeps the
450
412
  local buffer from accumulating a hidden backlog when the producer briefly
@@ -453,48 +415,29 @@ class CombinedAudioCapture:
453
415
  produced = 0
454
416
  while len(buf) >= chunk_size:
455
417
  data = np.array([buf.popleft() for _ in range(chunk_size)], dtype=np.float32)
456
- queue.put(data)
418
+ self.audio_queue.put(data)
457
419
  produced += 1
458
420
  return produced
459
421
 
460
- @property
461
- def has_system_audio(self) -> bool:
462
- return self._has_system_audio
463
-
464
- def enable_mic_routing(self) -> None:
465
- """Begin routing the microphone (candidate) stream to ``mic_queue`` for a
466
- secondary transcriber. Called once the mic Deepgram connection is up."""
467
- self._mic_routing = True
468
-
469
- def mic_source(self) -> "_QueueAudioSource":
470
- """A capture-like view over ``mic_queue`` (get_audio + flush) to hand to a
471
- second DeepgramTranscriber for the candidate's own voice."""
472
- return _QueueAudioSource(self.mic_queue)
473
-
474
- def _trim_queue(self, queue: "Queue") -> int:
475
- """Drop oldest chunks from ``queue`` when it exceeds ~2s of backlog, down to
476
- a ~0.5s tail. No-op at or below the threshold. Returns the count dropped.
477
-
478
- A growing queue means its consumer (a transcriber feed loop) is behind
479
- real-time — or, for the mic queue, has died (the secondary transcriber has
480
- no Whisper fallback, so a dead Deepgram socket leaves no consumer). Either
481
- way, bounding it keeps transcripts live and prevents unbounded growth.
422
+ def _trim_stale_backlog(self) -> int:
423
+ """Drop oldest queued chunks when the backlog exceeds ~2s, down to a ~0.5s
424
+ tail. No-op at or below the trim threshold. Returns the count dropped.
425
+
426
+ Each item is one 10ms chunk; a growing queue means the Deepgram feed loop
427
+ is behind real-time, which would otherwise show as transcripts arriving
428
+ progressively later than live speech.
482
429
  """
483
- if queue.qsize() <= self._STALL_TRIM_CHUNKS:
430
+ if self.audio_queue.qsize() <= self._STALL_TRIM_CHUNKS:
484
431
  return 0
485
432
  trimmed = 0
486
- while queue.qsize() > self._STALL_TAIL_CHUNKS:
433
+ while self.audio_queue.qsize() > self._STALL_TAIL_CHUNKS:
487
434
  try:
488
- queue.get_nowait()
435
+ self.audio_queue.get_nowait()
489
436
  trimmed += 1
490
437
  except Empty:
491
438
  break
492
439
  return trimmed
493
440
 
494
- def _trim_stale_backlog(self) -> int:
495
- """Bound the primary transcriber queue (each item is one 10ms chunk)."""
496
- return self._trim_queue(self.audio_queue)
497
-
498
441
  def flush(self) -> int:
499
442
  """Drop every queued audio chunk; return how many were dropped.
500
443
 
@@ -37,20 +37,11 @@ class DeepgramTranscriber:
37
37
  transcript_buffer: "RollingTranscriptBuffer",
38
38
  api_key: str,
39
39
  language: str = "en",
40
- label: str = "",
41
- whisper_fallback: bool = True,
42
40
  ) -> None:
43
41
  self._capture = audio_capture
44
42
  self._buffer = transcript_buffer
45
43
  self._language = language
46
44
  self._api_key = api_key
47
- # Secondary streams (e.g. the candidate's mic) set a label so their text
48
- # is prefixed in the AI context (so the model can tell who spoke) and so
49
- # they don't fight the primary stream on the live transcript bar.
50
- self._label = label
51
- # Secondary streams skip the Whisper fallback — one local Whisper model is
52
- # enough; a second would double CPU/memory for little gain.
53
- self._whisper_fallback = whisper_fallback
54
45
  self._stop_event = threading.Event()
55
46
  self._thread: Optional[threading.Thread] = None
56
47
  self._connection = None
@@ -59,11 +50,6 @@ class DeepgramTranscriber:
59
50
  self._last_transcript_time: float = 0.0
60
51
  self._last_interim = None
61
52
 
62
- def _buffer_text(self, sentence: str) -> str:
63
- """Prefix a labeled (secondary) stream's text so the AI context shows who
64
- spoke, e.g. ``[me] ...`` for the candidate's own voice."""
65
- return f"[{self._label}] {sentence}" if self._label else sentence
66
-
67
53
  def _on_message(self, sender, result=None, **kwargs):
68
54
  try:
69
55
  if result is None:
@@ -78,10 +64,9 @@ class DeepgramTranscriber:
78
64
 
79
65
  if result.is_final:
80
66
  # Final: add to AI buffer and broadcast; clear pending interim
81
- logger.info("Deepgram final%s: %s",
82
- f" [{self._label}]" if self._label else "", sentence[:120])
67
+ logger.info("Deepgram final: %s", sentence[:120])
83
68
  self._last_interim = None
84
- self._buffer.append(self._buffer_text(sentence))
69
+ self._buffer.append(sentence)
85
70
  state.last_activity_at = time.time()
86
71
  try:
87
72
  from ai_interview.metrics import metrics
@@ -91,14 +76,12 @@ class DeepgramTranscriber:
91
76
  if loop is not None:
92
77
  import asyncio
93
78
  asyncio.run_coroutine_threadsafe(
94
- self._broadcast_transcript(sentence, interim=False, source=self._label), loop
79
+ self._broadcast_transcript(sentence, interim=False), loop
95
80
  )
96
81
  else:
97
- # Interim: track for utterance_end flush. Only the primary stream
98
- # broadcasts interims — two streams replacing the same transcript
99
- # bar in-place would flicker against each other.
82
+ # Interim: track for utterance_end flush; broadcast to transcript bar
100
83
  self._last_interim = sentence
101
- if loop is not None and not self._label:
84
+ if loop is not None:
102
85
  import asyncio
103
86
  asyncio.run_coroutine_threadsafe(
104
87
  self._broadcast_transcript(sentence, interim=True), loop
@@ -107,10 +90,10 @@ class DeepgramTranscriber:
107
90
  logger.warning("Deepgram message parse error: %s", exc)
108
91
 
109
92
  @staticmethod
110
- async def _broadcast_transcript(sentence: str, interim: bool = False, source: str = "") -> None:
93
+ async def _broadcast_transcript(sentence: str, interim: bool = False) -> None:
111
94
  try:
112
95
  from ai_interview.server.websocket import broadcast
113
- await broadcast({"type": "transcript", "text": sentence, "interim": interim, "source": source})
96
+ await broadcast({"type": "transcript", "text": sentence, "interim": interim})
114
97
  except Exception:
115
98
  pass
116
99
 
@@ -120,13 +103,13 @@ class DeepgramTranscriber:
120
103
  last = getattr(self, '_last_interim', None)
121
104
  if last:
122
105
  logger.info("Deepgram utterance_end flush: %s", last[:80])
123
- self._buffer.append(self._buffer_text(last))
106
+ self._buffer.append(last)
124
107
  from ai_interview.state import state
125
108
  loop = state.asyncio_loop
126
109
  if loop is not None:
127
110
  import asyncio
128
111
  asyncio.run_coroutine_threadsafe(
129
- self._broadcast_transcript(last, interim=False, source=self._label), loop
112
+ self._broadcast_transcript(last, interim=False), loop
130
113
  )
131
114
  self._last_interim = None
132
115
  except Exception as exc:
@@ -214,11 +197,8 @@ class DeepgramTranscriber:
214
197
  except Exception:
215
198
  pass
216
199
 
217
- if self._whisper_fallback:
218
- logger.error("Deepgram reconnect failed after 10 attempts — falling back to local Whisper")
219
- self._start_whisper_fallback()
220
- else:
221
- logger.error("Deepgram reconnect failed after 10 attempts (label=%s) — giving up, no Whisper fallback for secondary stream", self._label)
200
+ logger.error("Deepgram reconnect failed after 10 attempts — falling back to local Whisper")
201
+ self._start_whisper_fallback()
222
202
  finally:
223
203
  self._reconnect_lock.release()
224
204
 
@@ -237,7 +217,12 @@ class DeepgramTranscriber:
237
217
  """Read audio chunks and send to Deepgram connection."""
238
218
  last_keepalive = time.time()
239
219
  self._last_transcript_time = time.time()
240
- _WATCHDOG_TIMEOUT = 30 # reconnect if no transcript for 30s while sending audio
220
+ # Reconnect if the interviewer is talking (audio being sent) but Deepgram
221
+ # returns no transcript for this long — i.e. a silent server-side stall.
222
+ # Kept low (vs the old 30s) so a stall doesn't leave the interviewer's
223
+ # question seconds behind; finals/interims normally arrive every 1-3s, so
224
+ # 12s with no message while sending audio is unambiguously a dead stream.
225
+ _WATCHDOG_TIMEOUT = 12
241
226
  last_watchdog_check = time.time()
242
227
 
243
228
  while not self._stop_event.is_set():
@@ -265,7 +250,7 @@ class DeepgramTranscriber:
265
250
 
266
251
  # Watchdog: if we're sending audio but getting no transcripts, connection is dead
267
252
  now = time.time()
268
- if now - last_watchdog_check > 10:
253
+ if now - last_watchdog_check > 3:
269
254
  last_watchdog_check = now
270
255
  silence_duration = now - self._last_transcript_time
271
256
  if silence_duration > _WATCHDOG_TIMEOUT:
@@ -249,37 +249,6 @@ def run_daemon(config: Config) -> None:
249
249
  state.transcriber_name = transcriber_name
250
250
  state.ai_model = config.model
251
251
 
252
- # Secondary transcriber: the candidate's own microphone on a SEPARATE Deepgram
253
- # connection (per-role, like meeting-helper). The primary stream above carries
254
- # system audio (interviewer); this adds the user's voice to the AI context,
255
- # prefixed "[me]" so the model can tell the two apart. Only when system audio
256
- # is the primary source (otherwise the mic already IS the primary), a Deepgram
257
- # key is present, and not disabled via config.
258
- mic_transcriber = None
259
- if (
260
- getattr(config, "transcribe_mic", True)
261
- and isinstance(transcriber, DeepgramTranscriber)
262
- and audio_capture.has_system_audio
263
- and config.deepgram_api_key
264
- ):
265
- try:
266
- mic_t = DeepgramTranscriber(
267
- audio_capture.mic_source(),
268
- state.transcript_buffer,
269
- config.deepgram_api_key,
270
- language=config.transcription_language,
271
- label="me",
272
- whisper_fallback=False,
273
- )
274
- if mic_t.start():
275
- audio_capture.enable_mic_routing()
276
- mic_transcriber = mic_t
277
- logger.info("Mic (candidate) transcriber started on a separate Deepgram connection")
278
- else:
279
- logger.warning("Mic transcriber failed to start — continuing with interviewer audio only")
280
- except Exception as exc:
281
- logger.warning("Mic transcriber setup failed: %s — continuing without it", exc)
282
-
283
252
  # -----------------------------------------------------------------------
284
253
  # Start Datadog metrics + structured logging (no-op if dd_api_key absent)
285
254
  # -----------------------------------------------------------------------
@@ -394,8 +363,6 @@ def run_daemon(config: Config) -> None:
394
363
  finally:
395
364
  if transcriber is not None:
396
365
  transcriber.stop()
397
- if mic_transcriber is not None:
398
- mic_transcriber.stop()
399
366
  audio_capture.stop()
400
367
  # Clean up all screenshots captured during this session
401
368
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ai-interview-assistant
3
- Version: 2.3.0
3
+ Version: 2.3.3
4
4
  Summary: Ghost background AI assistant for live code challenges
5
5
  Requires-Python: >=3.11
6
6
  Requires-Dist: click>=8.0
@@ -28,7 +28,7 @@ Requires-Dist: datadog>=0.49.0
28
28
  Requires-Dist: psutil>=5.9
29
29
  Requires-Dist: httpx>=0.27.0
30
30
  Requires-Dist: h2>=4.0
31
- Requires-Dist: flet>=0.25.0
31
+ Requires-Dist: flet<0.84,>=0.25.0
32
32
  Requires-Dist: PyPDF2>=3.0
33
33
  Provides-Extra: dev
34
34
  Requires-Dist: pytest>=8.0; extra == "dev"
@@ -17,7 +17,7 @@ datadog>=0.49.0
17
17
  psutil>=5.9
18
18
  httpx>=0.27.0
19
19
  h2>=4.0
20
- flet>=0.25.0
20
+ flet<0.84,>=0.25.0
21
21
  PyPDF2>=3.0
22
22
 
23
23
  [:sys_platform == "darwin"]
@@ -96,7 +96,7 @@ def test_stall_constants_are_sane():
96
96
  def test_emit_all_chunks_drains_every_complete_chunk(cap):
97
97
  from collections import deque
98
98
  buf = deque([0.0] * (160 * 3 + 30)) # 3 full 10ms chunks + 30 leftover samples
99
- produced = cap._emit_all_chunks(buf, 160, cap.audio_queue)
99
+ produced = cap._emit_all_chunks(buf, 160)
100
100
  assert produced == 3, "must emit ALL complete chunks in one call, not just one"
101
101
  assert cap.audio_queue.qsize() == 3
102
102
  assert len(buf) == 30, "sub-chunk remainder stays buffered for next time"
@@ -105,45 +105,6 @@ def test_emit_all_chunks_drains_every_complete_chunk(cap):
105
105
  def test_emit_all_chunks_noop_below_chunk_size(cap):
106
106
  from collections import deque
107
107
  buf = deque([0.0] * 159)
108
- assert cap._emit_all_chunks(buf, 160, cap.audio_queue) == 0
108
+ assert cap._emit_all_chunks(buf, 160) == 0
109
109
  assert cap.audio_queue.qsize() == 0
110
110
  assert len(buf) == 159
111
-
112
-
113
- def test_emit_all_chunks_targets_the_given_queue(cap):
114
- from collections import deque
115
- buf = deque([0.0] * 320)
116
- cap._emit_all_chunks(buf, 160, cap.mic_queue)
117
- assert cap.mic_queue.qsize() == 2
118
- assert cap.audio_queue.qsize() == 0, "must write to the queue it was handed"
119
-
120
-
121
- # --------------------------------------------------------------------------
122
- # Separate mic stream: routing flag + queue adapter
123
- # --------------------------------------------------------------------------
124
-
125
- def test_enable_mic_routing_flag(cap):
126
- assert cap._mic_routing is False
127
- cap.enable_mic_routing()
128
- assert cap._mic_routing is True
129
-
130
-
131
- def test_mic_source_get_and_flush(cap):
132
- src = cap.mic_source()
133
- assert src.get_audio(timeout=0.001) is None # empty queue
134
- cap.mic_queue.put(_chunk())
135
- cap.mic_queue.put(_chunk())
136
- assert src.get_audio(timeout=0.001) is not None
137
- assert src.flush() == 1 # the one remaining chunk dropped
138
- assert cap.mic_queue.qsize() == 0
139
-
140
-
141
- def test_trim_queue_bounds_mic_queue(cap):
142
- # If the mic transcriber dies, routing stays on and mic_queue would grow
143
- # unbounded — _trim_queue must cap it to the live tail like the primary.
144
- over = cap._STALL_TRIM_CHUNKS + 100
145
- for _ in range(over):
146
- cap.mic_queue.put(_chunk())
147
- trimmed = cap._trim_queue(cap.mic_queue)
148
- assert cap.mic_queue.qsize() == cap._STALL_TAIL_CHUNKS
149
- assert trimmed == over - cap._STALL_TAIL_CHUNKS