Skip to content

Commit 0df915d

Browse files
committed
Apply Codex V1.1 Architecture fixes and Admin UI lint resolutions
1 parent 795266e commit 0df915d

File tree

8 files changed

+113
-374
lines changed

8 files changed

+113
-374
lines changed

app/src/main/java/com/thinkoff/clawwatch/SecurePrefs.kt

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,11 @@ object SecurePrefs {
1919
"anthropic_api_key",
2020
"brave_api_key",
2121
"tavily_api_key",
22-
"antfarm_api_key",
23-
"antfarm_rooms",
2422
"model",
2523
"system_prompt",
2624
"max_tokens",
2725
"rag_mode",
28-
"avatar_type",
29-
"tts_locale",
30-
"tts_voice_name",
31-
"tts_engine_package"
26+
"avatar_type"
3227
)
3328

3429
@Volatile
@@ -53,8 +48,8 @@ object SecurePrefs {
5348
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM
5449
)
5550
} catch (e: Exception) {
56-
Log.e(TAG, "EncryptedSharedPreferences unavailable; refusing plaintext secret storage", e)
57-
throw IllegalStateException("Encrypted storage unavailable on this device", e)
51+
Log.e(TAG, "FATAL: EncryptedSharedPreferences initialization failed. Refusing to fall back to plaintext to protect secrets.", e)
52+
throw SecurityException("Secure storage initialization failed", e)
5853
}
5954

6055
migrateLegacyIfPresent(appContext, secure)

app/src/main/java/com/thinkoff/clawwatch/VoiceEngine.kt

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -158,25 +158,30 @@ class VoiceEngine(private val context: Context) {
158158
fun startListening(onResult: (String) -> Unit, onPartial: (String) -> Unit) {
159159
val model = voskModel ?: return
160160
stopListening()
161-
recognizer = Recognizer(model, SAMPLE_RATE)
162-
speechService = SpeechService(recognizer, SAMPLE_RATE)
163-
speechService?.startListening(object : RecognitionListener {
164-
override fun onResult(hypothesis: String?) {
165-
val text = parseVoskText(hypothesis, "text") ?: return
166-
if (text.isNotBlank()) onResult(text)
167-
}
168-
override fun onPartialResult(hypothesis: String?) {
169-
val text = parseVoskText(hypothesis, "partial") ?: return
170-
if (text.isNotBlank()) onPartial(text)
171-
}
172-
// Fix #1/#2: parse JSON properly, handle null
173-
override fun onFinalResult(hypothesis: String?) {
174-
val text = parseVoskText(hypothesis, "text") ?: return
175-
if (text.isNotBlank()) onResult(text)
176-
}
177-
override fun onError(e: Exception?) { Log.e(TAG, "STT error", e) }
178-
override fun onTimeout() { Log.w(TAG, "STT timeout") }
179-
})
161+
try {
162+
recognizer = Recognizer(model, SAMPLE_RATE)
163+
speechService = SpeechService(recognizer, SAMPLE_RATE)
164+
speechService?.startListening(object : RecognitionListener {
165+
override fun onResult(hypothesis: String?) {
166+
val text = parseVoskText(hypothesis, "text") ?: return
167+
if (text.isNotBlank()) onResult(text)
168+
}
169+
override fun onPartialResult(hypothesis: String?) {
170+
val text = parseVoskText(hypothesis, "partial") ?: return
171+
if (text.isNotBlank()) onPartial(text)
172+
}
173+
// Fix #1/#2: parse JSON properly, handle null
174+
override fun onFinalResult(hypothesis: String?) {
175+
val text = parseVoskText(hypothesis, "text") ?: return
176+
if (text.isNotBlank()) onResult(text)
177+
}
178+
override fun onError(e: Exception?) { Log.e(TAG, "STT error", e) }
179+
override fun onTimeout() { Log.w(TAG, "STT timeout") }
180+
})
181+
} catch (e: Exception) {
182+
Log.e(TAG, "Failed to start Vosk SpeechService", e)
183+
onPartial("Mic err: ${e.message ?: "Unknown"}")
184+
}
180185
}
181186

182187
fun stopListening() {
Lines changed: 14 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,23 @@
11
<vector xmlns:android="http://schemas.android.com/apk/res/android"
22
android:width="200dp" android:height="200dp"
33
android:viewportWidth="200" android:viewportHeight="200">
4-
<group android:name="head_group" android:pivotX="100" android:pivotY="104">
5-
<path
6-
android:fillColor="#07160D"
7-
android:fillAlpha="0.38"
8-
android:pathData="M100,112 m -38,0 a 38,46 0 1,0 76,0 a 38,46 0 1,0 -76,0" />
4+
<group android:name="status_ring" android:pivotX="100" android:pivotY="100"><group android:name="head_group" android:pivotX="100" android:pivotY="100">
5+
<path android:fillColor="#2E7D32" android:pathData="M100,60 C80,60 60,75 60,100 C60,125 80,140 100,140 C120,140 140,125 140,100 C140,75 120,60 100,60" />
6+
<path android:strokeWidth="6" android:strokeColor="#4CAF50" android:strokeLineCap="round" android:pathData="M80,65 L60,40" />
7+
<path android:strokeWidth="6" android:strokeColor="#FF9800" android:strokeLineCap="round" android:pathData="M60,40 L50,45" />
8+
<path android:strokeWidth="6" android:strokeColor="#4CAF50" android:strokeLineCap="round" android:pathData="M120,65 L140,40" />
9+
<path android:strokeWidth="6" android:strokeColor="#FF9800" android:strokeLineCap="round" android:pathData="M140,40 L150,45" />
910

10-
<group android:name="antenna_left" android:pivotX="84" android:pivotY="63">
11-
<path
12-
android:strokeWidth="5"
13-
android:strokeColor="#46B15A"
14-
android:strokeLineCap="round"
15-
android:fillColor="#00000000"
16-
android:pathData="M84,63 C76,50 67,38 57,30" />
17-
<path
18-
android:fillColor="#F29F1C"
19-
android:pathData="M51,27 C58,22 66,24 68,31 C64,37 56,38 51,33 Z" />
11+
<group android:name="eyes" android:pivotX="100" android:pivotY="90">
12+
<path android:fillColor="#CDDC39" android:pathData="M80,95 A12,12 0 1,1 80,94.9 Z" />
13+
<path android:fillColor="#FFFFFF" android:pathData="M83,92 A4,4 0 1,1 83,91.9 Z" />
14+
<path android:fillColor="#CDDC39" android:pathData="M120,95 A12,12 0 1,1 120,94.9 Z" />
15+
<path android:fillColor="#FFFFFF" android:pathData="M123,92 A4,4 0 1,1 123,91.9 Z" />
2016
</group>
2117

22-
<group android:name="antenna_right" android:pivotX="116" android:pivotY="63">
23-
<path
24-
android:strokeWidth="5"
25-
android:strokeColor="#46B15A"
26-
android:strokeLineCap="round"
27-
android:fillColor="#00000000"
28-
android:pathData="M116,63 C124,50 133,38 143,30" />
29-
<path
30-
android:fillColor="#F29F1C"
31-
android:pathData="M149,27 C142,22 134,24 132,31 C136,37 144,38 149,33 Z" />
32-
</group>
33-
34-
<path
35-
android:fillColor="#2E7D32"
36-
android:pathData="M100,78 m -24,0 a 24,20 0 1,0 48,0 a 24,20 0 1,0 -48,0" />
37-
<path
38-
android:fillColor="#1E5A24"
39-
android:pathData="M100,108 m -28,0 a 28,28 0 1,0 56,0 a 28,28 0 1,0 -56,0" />
40-
<path
41-
android:fillColor="#2C6C32"
42-
android:pathData="M100,139 m -22,0 a 22,18 0 1,0 44,0 a 22,18 0 1,0 -44,0" />
43-
<path
44-
android:fillColor="#4CAF50"
45-
android:fillAlpha="0.22"
46-
android:pathData="M100,73 m -14,0 a 14,9 0 1,0 28,0 a 14,9 0 1,0 -28,0" />
47-
48-
<path
49-
android:strokeWidth="4"
50-
android:strokeColor="#1C4E22"
51-
android:strokeLineCap="round"
52-
android:fillColor="#00000000"
53-
android:pathData="M76,112 C63,119 56,129 51,140" />
54-
<path
55-
android:strokeWidth="4"
56-
android:strokeColor="#1C4E22"
57-
android:strokeLineCap="round"
58-
android:fillColor="#00000000"
59-
android:pathData="M79,127 C69,135 64,145 61,156" />
60-
<path
61-
android:strokeWidth="4"
62-
android:strokeColor="#1C4E22"
63-
android:strokeLineCap="round"
64-
android:fillColor="#00000000"
65-
android:pathData="M124,112 C137,119 144,129 149,140" />
66-
<path
67-
android:strokeWidth="4"
68-
android:strokeColor="#1C4E22"
69-
android:strokeLineCap="round"
70-
android:fillColor="#00000000"
71-
android:pathData="M121,127 C131,135 136,145 139,156" />
72-
73-
<group android:name="eyes" android:pivotX="100" android:pivotY="104">
74-
<path android:fillColor="#DCE775" android:pathData="M84,100 m -10,0 a 10,12 0 1,0 20,0 a 10,12 0 1,0 -20,0" />
75-
<path android:fillColor="#39511A" android:pathData="M85,102 m -4.2,0 a 4.2,5.5 0 1,0 8.4,0 a 4.2,5.5 0 1,0 -8.4,0" />
76-
<path android:fillColor="#FFFFFF" android:pathData="M87,97 m -1.5,0 a 1.5,1.5 0 1,0 3,0 a 1.5,1.5 0 1,0 -3,0" />
77-
<path android:fillColor="#DCE775" android:pathData="M116,100 m -10,0 a 10,12 0 1,0 20,0 a 10,12 0 1,0 -20,0" />
78-
<path android:fillColor="#39511A" android:pathData="M115,102 m -4.2,0 a 4.2,5.5 0 1,0 8.4,0 a 4.2,5.5 0 1,0 -8.4,0" />
79-
<path android:fillColor="#FFFFFF" android:pathData="M117,97 m -1.5,0 a 1.5,1.5 0 1,0 3,0 a 1.5,1.5 0 1,0 -3,0" />
80-
</group>
81-
82-
<group android:name="mouth" android:pivotX="100" android:pivotY="121">
83-
<path
84-
android:fillColor="#F6B73C"
85-
android:pathData="M90,119 Q100,129 110,119 Q100,136 90,119 Z" />
18+
<group android:name="mouth" android:pivotX="100" android:pivotY="125">
19+
<path android:fillColor="#FFC107" android:pathData="M90,120 Q100,130 110,120 L105,128 Q100,132 95,128 Z" />
8620
</group>
8721
</group>
22+
</group>
8823
</vector>
Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,23 @@
11
<vector xmlns:android="http://schemas.android.com/apk/res/android"
22
android:width="200dp" android:height="200dp"
33
android:viewportWidth="200" android:viewportHeight="200">
4-
<group android:name="head_group" android:pivotX="100" android:pivotY="104">
5-
<path android:fillColor="#0D1420" android:fillAlpha="0.2" android:pathData="M100,120 m -36,0 a 36,42 0 1,0 72,0 a 36,42 0 1,0 -72,0" />
6-
<group android:name="torso_group" android:pivotX="100" android:pivotY="160">
7-
<path android:fillColor="#133C77" android:pathData="M44,182 C52,148 74,136 100,136 C126,136 148,148 156,182 Z" />
8-
<path android:fillColor="#E7ECF4" android:pathData="M72,150 h56 v32 h-56 Z" />
9-
</group>
10-
<path android:fillColor="#6D4636" android:pathData="M66,73 C66,46 134,46 134,73 C134,121 115,134 100,134 C85,134 66,121 66,73 Z" />
11-
<group android:name="hair_group" android:pivotX="100" android:pivotY="70">
12-
<path android:fillColor="#24140F" android:pathData="M60,74 C63,38 92,20 120,24 C136,26 146,39 144,68 C135,50 118,42 101,42 C82,42 69,55 60,74 Z" />
13-
<path android:fillColor="#4D3028" android:fillAlpha="0.22" android:pathData="M78,33 C88,29 102,29 117,31 C108,33 96,37 85,43 Z" />
14-
</group>
15-
<path android:fillColor="#915E49" android:fillAlpha="0.18" android:pathData="M74,94 C80,110 90,119 100,119 C110,119 120,110 126,94 C124,118 112,130 100,130 C88,130 76,118 74,94 Z" />
16-
<path android:fillColor="#E5D2CC" android:pathData="M60,93 m -7,0 a 7,7 0 1,0 14,0 a 7,7 0 1,0 -14,0" />
17-
<path android:fillColor="#E5D2CC" android:pathData="M140,93 m -7,0 a 7,7 0 1,0 14,0 a 7,7 0 1,0 -14,0" />
4+
<group android:name="status_ring" android:pivotX="100" android:pivotY="100"><group android:name="head_group" android:pivotX="100" android:pivotY="100">
5+
<path android:fillColor="#1976D2" android:pathData="M50,180 C50,150 70,140 100,140 C130,140 150,150 150,180 Z" />
6+
<path android:fillColor="#FFCCBC" android:pathData="M65,70 C65,40 135,40 135,70 C135,120 115,130 100,130 C85,130 65,120 65,70 Z" />
7+
<path android:fillColor="#3E2723" android:pathData="M60,70 C60,20 140,20 140,70 Q130,40 100,45 Q80,45 60,70 Z" />
8+
<path android:fillColor="#FBE9E7" android:pathData="M55,90 A8,8 0 1,1 55,89.9 Z" />
9+
<path android:fillColor="#FBE9E7" android:pathData="M145,90 A8,8 0 1,1 145,89.9 Z" />
1810

19-
<group android:name="eyes" android:pivotX="100" android:pivotY="90">
20-
<path android:fillColor="#1E1C1C" android:pathData="M83,90 m -5,0 a 5,6 0 1,0 10,0 a 5,6 0 1,0 -10,0" />
21-
<path android:fillColor="#FFFFFF" android:pathData="M84,87 m -1.5,0 a 1.5,1.5 0 1,0 3,0 a 1.5,1.5 0 1,0 -3,0" />
22-
<path android:fillColor="#1E1C1C" android:pathData="M117,90 m -5,0 a 5,6 0 1,0 10,0 a 5,6 0 1,0 -10,0" />
23-
<path android:fillColor="#FFFFFF" android:pathData="M118,87 m -1.5,0 a 1.5,1.5 0 1,0 3,0 a 1.5,1.5 0 1,0 -3,0" />
11+
<group android:name="eyes" android:pivotX="100" android:pivotY="85">
12+
<path android:fillColor="#212121" android:pathData="M80,85 A5,5 0 1,1 80,84.9 Z" />
13+
<path android:fillColor="#FFFFFF" android:pathData="M81,83 A1.5,1.5 0 1,1 81,82.9 Z" />
14+
<path android:fillColor="#212121" android:pathData="M120,85 A5,5 0 1,1 120,84.9 Z" />
15+
<path android:fillColor="#FFFFFF" android:pathData="M121,83 A1.5,1.5 0 1,1 121,82.9 Z" />
2416
</group>
25-
26-
<group android:name="mouth" android:pivotX="100" android:pivotY="113">
27-
<path
28-
android:fillColor="#D67A5D"
29-
android:pathData="M92,111 Q100,117 108,111 Q100,114 92,111 Z" />
17+
18+
<group android:name="mouth" android:pivotX="100" android:pivotY="110">
19+
<path android:fillColor="#D84315" android:pathData="M90,108 Q100,118 110,108 Q100,112 90,108 Z" />
3020
</group>
3121
</group>
22+
</group>
3223
</vector>
Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,23 @@
11
<vector xmlns:android="http://schemas.android.com/apk/res/android"
22
android:width="200dp" android:height="200dp"
33
android:viewportWidth="200" android:viewportHeight="200">
4-
<group android:name="head_group" android:pivotX="100" android:pivotY="104">
5-
<path android:fillColor="#0E1715" android:fillAlpha="0.18" android:pathData="M100,120 m -36,0 a 36,42 0 1,0 72,0 a 36,42 0 1,0 -72,0" />
6-
<group android:name="torso_group" android:pivotX="100" android:pivotY="160">
7-
<path android:fillColor="#148F86" android:pathData="M48,182 C54,150 76,138 100,138 C124,138 146,150 152,182 Z" />
8-
<path android:fillColor="#F4F1E8" android:pathData="M73,160 h54 v24 h-54 Z" />
9-
</group>
10-
<path android:fillColor="#F2C99C" android:pathData="M66,73 C66,47 134,47 134,73 C134,120 115,132 100,132 C85,132 66,120 66,73 Z" />
11-
<group android:name="hair_group" android:pivotX="100" android:pivotY="72">
12-
<path android:fillColor="#F4C53B" android:pathData="M58,82 C62,40 91,21 122,27 C143,31 153,58 141,88 C134,54 116,38 98,38 C79,38 65,55 58,82 Z" />
13-
<path android:fillColor="#E5B12B" android:pathData="M66,80 C54,98 51,120 70,118 C84,116 77,93 66,80 Z" />
14-
<path android:fillColor="#E5B12B" android:pathData="M134,80 C146,98 149,120 130,118 C116,116 123,93 134,80 Z" />
15-
<path android:fillColor="#FFE78E" android:fillAlpha="0.22" android:pathData="M83,33 C95,29 108,30 120,35 C111,35 99,38 88,43 Z" />
16-
<path android:fillColor="#FFF0B6" android:fillAlpha="0.15" android:pathData="M74,53 C84,46 96,43 110,43 C99,46 90,52 82,60 Z" />
17-
</group>
4+
<group android:name="status_ring" android:pivotX="100" android:pivotY="100"><group android:name="head_group" android:pivotX="100" android:pivotY="100">
5+
<path android:fillColor="#009688" android:pathData="M50,180 C50,160 70,140 100,140 C130,140 150,160 150,180 Z" />
6+
<path android:fillColor="#FFFFFF" android:pathData="M70,180 L70,160 L130,160 L130,180 Z" />
7+
<path android:fillColor="#FFE0B2" android:pathData="M65,70 C65,40 135,40 135,70 C135,115 115,125 100,125 C85,125 65,115 65,70 Z" />
8+
<path android:fillColor="#FFD54F" android:pathData="M60,80 C50,40 100,20 120,30 C150,45 150,80 140,110 C140,120 120,130 135,80 C135,40 100,30 60,80 Z" />
9+
<path android:fillColor="#FFCA28" android:pathData="M60,80 C55,100 50,120 70,110 C80,105 50,80 60,80 Z" />
1810

19-
<group android:name="eyes" android:pivotX="100" android:pivotY="89">
20-
<path android:fillColor="#1B5FC8" android:pathData="M83,89 m -6,0 a 6,7 0 1,0 12,0 a 6,7 0 1,0 -12,0" />
21-
<path android:fillColor="#FFFFFF" android:pathData="M84,86 m -1.8,0 a 1.8,1.8 0 1,0 3.6,0 a 1.8,1.8 0 1,0 -3.6,0" />
22-
<path android:fillColor="#1B5FC8" android:pathData="M117,89 m -6,0 a 6,7 0 1,0 12,0 a 6,7 0 1,0 -12,0" />
23-
<path android:fillColor="#FFFFFF" android:pathData="M118,86 m -1.8,0 a 1.8,1.8 0 1,0 3.6,0 a 1.8,1.8 0 1,0 -3.6,0" />
11+
<group android:name="eyes" android:pivotX="100" android:pivotY="85">
12+
<path android:fillColor="#1565C0" android:pathData="M80,85 A6,6 0 1,1 80,84.9 Z" />
13+
<path android:fillColor="#FFFFFF" android:pathData="M81,83 A2,2 0 1,1 81,82.9 Z" />
14+
<path android:fillColor="#1565C0" android:pathData="M120,85 A6,6 0 1,1 120,84.9 Z" />
15+
<path android:fillColor="#FFFFFF" android:pathData="M121,83 A2,2 0 1,1 121,82.9 Z" />
2416
</group>
25-
26-
<group android:name="mouth" android:pivotX="100" android:pivotY="112">
27-
<path
28-
android:fillColor="#E37469"
29-
android:pathData="M92,111 Q100,117 108,111 Q100,114 92,111 Z" />
17+
18+
<group android:name="mouth" android:pivotX="100" android:pivotY="110">
19+
<path android:fillColor="#E64A19" android:pathData="M90,108 Q100,116 110,108 Q100,112 90,108 Z" />
3020
</group>
3121
</group>
22+
</group>
3223
</vector>

0 commit comments

Comments
 (0)