Merge branch 'testing' bug fix for remoteDriver

This commit is contained in:
Storm Dragon 2025-06-07 18:24:44 -04:00
commit f18c31df6c
3 changed files with 12 additions and 20 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ dist/
build/
*.kate-swp
.directory
CLAUDE.md

View File

@ -79,10 +79,12 @@ class command():
# 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)
# Pattern 1c: dd command output (bytes copied with transfer rate)
ddMatch = re.search(r'\d+\s+bytes.*copied.*\d+\s+s.*[kMGT]?B/s', text)
# Pattern 1d: 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 or curlMatch:
if timeMatch or tokenMatch or ddMatch 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 transfer progress", debug.debugLevel.INFO)

View File

@ -45,28 +45,17 @@ class driver(remoteDriver):
continue
if self.fenrirSock in r:
client_sock, client_addr = self.fenrirSock.accept()
response = "ERROR: Failed to process command\n"
try:
rawdata = client_sock.recv(8129)
data = rawdata.decode("utf-8").rstrip().lstrip()
if data:
# Process the command and get response
result = self.env['runtime']['remoteManager'].handleRemoteIncommingWithResponse(data)
if result['success']:
response = f"OK: {result['message']}\n"
else:
response = f"ERROR: {result['message']}\n"
else:
response = "ERROR: Empty command\n"
except Exception as e:
response = f"ERROR: {str(e)}\n"
# Send response back to client
try:
client_sock.send(response.encode("utf-8"))
except:
pass
try:
data = rawdata.decode("utf-8").rstrip().lstrip()
eventQueue.put({"Type":fenrirEventType.RemoteIncomming,
"Data": data
})
except:
pass
try:
client_sock.close()
except: