refactor(cleanup): remove 5 orphaned symbols (no behavior change) (#484)
- ChatViewModel: drop fetchAndDisplayStatus/Sessions/Stats — left behind
after slash-command dispatch rework (e7b2973c); /status /sessions /stats
now route to backend via SlashCommandDispatcher.RpcDispatch -> WS COMMAND_DISPATCH.
Zero call sites, grep-confirmed.
- AuthManager: drop KEY_SELECTED_PROFILE_ID const — selected profile id
moved to ServerStore StateFlow (getSelectedProfileId/setSelectedProfileId).
Legacy PREFS key never read.
- Theme: drop ENABLE_DYNAMIC_COLOR const — theming reads useDynamicColors
setting (Theme.kt:318), not this const. Dead since that refactor.
Verification: ktlintCheck PASS, compileDebugKotlin PASS (local SDK).
Per behavior-preserving-cleanup: grep zero refs, not exported, no
dynamic/reflection access, git blame shows original intent superseded.
This commit is contained in:
3 files changed
-93
No files matched your search
@@ -35,7 +35,6 @@ object AuthManager {
|
|||||||
private const val PREFS_FILE = "hermes_secure_prefs"
|
private const val PREFS_FILE = "hermes_secure_prefs"
|
||||||
|
|
||||||
private const val KEY_TOKEN = "auth_token"
|
private const val KEY_TOKEN = "auth_token"
|
||||||
private const val KEY_SELECTED_PROFILE_ID = "selected_profile_id"
|
|
||||||
private const val KEY_SESSION_COOKIE = "session_cookie"
|
private const val KEY_SESSION_COOKIE = "session_cookie"
|
||||||
|
|
||||||
@Volatile
|
@Volatile
|
||||||
|
|||||||
@@ -26,11 +26,6 @@ enum class BottomNavDisplayMode { ICON_AND_TEXT, ICON_ONLY, TEXT_ONLY }
|
|||||||
val LocalThemePreference = compositionLocalOf { ThemePreference.SYSTEM }
|
val LocalThemePreference = compositionLocalOf { ThemePreference.SYSTEM }
|
||||||
val LocalThemePreset = compositionLocalOf { ThemePreset.DEFAULT }
|
val LocalThemePreset = compositionLocalOf { ThemePreset.DEFAULT }
|
||||||
|
|
||||||
/**
|
|
||||||
* Set to true to opt into Material You dynamic color (Android 12+).
|
|
||||||
*/
|
|
||||||
private const val ENABLE_DYNAMIC_COLOR = true
|
|
||||||
|
|
||||||
private val HermesDarkColorScheme =
|
private val HermesDarkColorScheme =
|
||||||
darkColorScheme(
|
darkColorScheme(
|
||||||
primary = HermesPurple,
|
primary = HermesPurple,
|
||||||
|
|||||||
@@ -836,93 +836,6 @@ class ChatViewModel(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun fetchAndDisplayStatus() {
|
|
||||||
viewModelScope.launch {
|
|
||||||
val result =
|
|
||||||
withContext(Dispatchers.IO) {
|
|
||||||
safeApiCall { ApiClient.hermesApi.getStatus() }
|
|
||||||
}
|
|
||||||
when (result) {
|
|
||||||
is NetworkResult.Success -> {
|
|
||||||
val body = result.data
|
|
||||||
val platformsStr =
|
|
||||||
body.gateway_platforms?.entries?.joinToString("\n") { (k, v) ->
|
|
||||||
val status = v?.state ?: "Unknown"
|
|
||||||
val err = v?.error_code?.let { " (Error: $it)" } ?: ""
|
|
||||||
" • **$k**: $status$err"
|
|
||||||
} ?: "No active platforms"
|
|
||||||
addAssistantMessage(
|
|
||||||
"""
|
|
||||||
**Hermes Gateway Status:**
|
|
||||||
• **Version:** ${body.version ?: "Unknown"}
|
|
||||||
• **Gateway Running:** ${body.gateway_running ?: false}
|
|
||||||
• **Active Sessions:** ${body.active_sessions ?: 0}
|
|
||||||
• **Auth Required:** ${body.auth_required ?: false}
|
|
||||||
|
|
||||||
**Platforms:**
|
|
||||||
$platformsStr
|
|
||||||
""".trimIndent(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
is NetworkResult.Failure -> {
|
|
||||||
addAssistantMessage("Failed to retrieve status: ${result.error.message}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun fetchAndDisplaySessions() {
|
|
||||||
viewModelScope.launch {
|
|
||||||
val result =
|
|
||||||
withContext(Dispatchers.IO) {
|
|
||||||
safeApiCall { ApiClient.hermesApi.getSessions() }
|
|
||||||
}
|
|
||||||
when (result) {
|
|
||||||
is NetworkResult.Success -> {
|
|
||||||
val body = result.data
|
|
||||||
val sessionsStr =
|
|
||||||
body.sessions.joinToString("\n") { s ->
|
|
||||||
"• **${s.title ?: "Untitled"}** (ID: `${s.id}`, Messages: ${s.message_count ?: 0})"
|
|
||||||
}
|
|
||||||
addAssistantMessage("**Sessions List:**\n$sessionsStr")
|
|
||||||
}
|
|
||||||
|
|
||||||
is NetworkResult.Failure -> {
|
|
||||||
addAssistantMessage("Failed to list sessions: ${result.error.message}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun fetchAndDisplayStats() {
|
|
||||||
viewModelScope.launch {
|
|
||||||
val result =
|
|
||||||
withContext(Dispatchers.IO) {
|
|
||||||
safeApiCall { ApiClient.hermesApi.getSystemStats() }
|
|
||||||
}
|
|
||||||
when (result) {
|
|
||||||
is NetworkResult.Success -> {
|
|
||||||
val body = result.data
|
|
||||||
val cpuPct = body.cpu_percent?.let { String.format("%.1f%%", it) } ?: "N/A"
|
|
||||||
val memPct = body.memory?.percent?.let { String.format("%.1f%%", it) } ?: "N/A"
|
|
||||||
addAssistantMessage(
|
|
||||||
"""
|
|
||||||
**System Resource Stats:**
|
|
||||||
• **CPU Usage:** $cpuPct
|
|
||||||
• **Memory Usage:** $memPct
|
|
||||||
• **Uptime:** ${body.uptime_seconds?.let { "${it.toLong()}s" } ?: "N/A"}
|
|
||||||
""".trimIndent(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
is NetworkResult.Failure -> {
|
|
||||||
addAssistantMessage("Failed to retrieve system stats: ${result.error.message}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun addAssistantMessage(text: String) {
|
private fun addAssistantMessage(text: String) {
|
||||||
val msg = ChatMessage(role = MessageRole.ASSISTANT, content = text)
|
val msg = ChatMessage(role = MessageRole.ASSISTANT, content = text)
|
||||||
_uiState.update { it.copy(messages = it.messages + msg) }
|
_uiState.update { it.copy(messages = it.messages + msg) }
|
||||||
|
|||||||
Reference in new issue
Block a user