A few minor tweaks to progressbar beeps.

This commit is contained in:
Storm Dragon
2025-06-07 11:13:15 -04:00
parent 7e87ebf04b
commit 27c35939b1

View File

@ -60,29 +60,32 @@ class command():
# Debug: Print what we're checking
self.env['runtime']['debug'].writeDebugOut("Progress detector checking: '" + text + "'", debug.debugLevel.INFO)
# Check if progress monitoring should automatically stop
self.checkProgressCompletion(text, currentTime)
# Note: Auto-disable on 100% completion removed to respect user settings
# Pattern 1: Percentage (50%, 25.5%, etc.)
percentMatch = re.search(r'(\d+(?:\.\d+)?)\s*%', text)
if percentMatch:
percentage = float(percentMatch.group(1))
self.env['runtime']['debug'].writeDebugOut("Found percentage: " + str(percentage), debug.debugLevel.INFO)
if percentage != self.env['commandBuffer']['lastProgressValue']:
self.env['runtime']['debug'].writeDebugOut("Playing tone for: " + str(percentage), debug.debugLevel.INFO)
self.playProgressTone(percentage)
self.env['commandBuffer']['lastProgressValue'] = percentage
self.env['commandBuffer']['lastProgressTime'] = currentTime
return
# Only trigger on realistic progress percentages (0-100%)
if 0 <= percentage <= 100:
self.env['runtime']['debug'].writeDebugOut("Found percentage: " + str(percentage), debug.debugLevel.INFO)
if percentage != self.env['commandBuffer']['lastProgressValue']:
self.env['runtime']['debug'].writeDebugOut("Playing tone for: " + str(percentage), debug.debugLevel.INFO)
self.playProgressTone(percentage)
self.env['commandBuffer']['lastProgressValue'] = percentage
self.env['commandBuffer']['lastProgressTime'] = currentTime
return
# Pattern 1b: Time/token activity (not percentage-based, so use single beep)
timeMatch = re.search(r'(\d+)s\s', text)
tokenMatch = re.search(r'(\d+)\s+tokens', text)
# Pattern 1c: Curl-style transfer data (bytes, speed indicators)
curlMatch = re.search(r'(\d+\s+\d+\s+\d+\s+\d+.*?(?:k|M|G)?.*?--:--:--|Speed)', text)
if timeMatch or tokenMatch:
if timeMatch or tokenMatch or curlMatch:
# For non-percentage progress, use a single activity beep every 2 seconds
if currentTime - self.env['commandBuffer']['lastProgressTime'] >= 2.0:
self.env['runtime']['debug'].writeDebugOut("Playing activity beep for Claude Code progress", debug.debugLevel.INFO)
self.env['runtime']['debug'].writeDebugOut("Playing activity beep for transfer progress", debug.debugLevel.INFO)
self.playActivityBeep()
self.env['commandBuffer']['lastProgressTime'] = currentTime
return
@ -148,21 +151,6 @@ class command():
except Exception as e:
self.env['runtime']['debug'].writeDebugOut("Sox tone error: " + str(e), debug.debugLevel.ERROR)
def checkProgressCompletion(self, text, currentTime):
"""Check if progress is complete and should auto-disable monitoring"""
# Progress monitor is now beep-only - user controls speech separately
# Only auto-disable on clear 100% completion for convenience
import re
if re.search(r'100\s*%', text):
self.env['runtime']['debug'].writeDebugOut("Progress complete: 100%", debug.debugLevel.INFO)
self.stopProgressMonitoring()
return
def stopProgressMonitoring(self):
"""Stop progress monitoring - beep-only, no speech control"""
self.env['commandBuffer']['progressMonitoring'] = False
# Just disable monitoring, don't touch speech settings
def setCallback(self, callback):
pass