feat(#1121): add multiplexed gateway awareness (#1127)

This commit is contained in:
M57 authored and GitHub committed 2026-09-15 15:56:32 +03:00
1 parent fe465ad93c
commit 528ec4f28f
20 files changed
+1065 -8

No files matched your search

@@ -0,0 +1,43 @@
package com.m57.hermescontrol.data.model
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class GatewayMigrationPlan(
@SerialName("default_home") val defaultHome: String? = null,
val profiles: List<GatewayMigrationProfile> = emptyList(),
@SerialName("multiplex_flag_on") val multiplexFlagOn: Boolean = false,
@SerialName("live_served") val liveServed: List<String>? = null,
@SerialName("already_multiplexed") val alreadyMultiplexed: Boolean = false,
val interrupted: Boolean = false,
val blockers: List<String> = emptyList(),
val notices: List<String> = emptyList(),
val eligible: Boolean = false,
val command: String? = null,
)
@Serializable
data class GatewayMigrationProfile(
val profile: String? = null,
val home: String? = null,
val pid: Int? = null,
val service: GatewayMigrationService? = null,
val services: List<GatewayMigrationService> = emptyList(),
@SerialName("run_as_user") val runAsUser: String? = null,
val uid: Int? = null,
@SerialName("runtime_home") val runtimeHome: String? = null,
)
@Serializable
data class GatewayMigrationService(
val kind: String? = null,
val system: Boolean? = null,
)
@Serializable
data class GatewayMigrationStartResponse(
val ok: Boolean = false,
val pid: Int? = null,
val name: String? = null,
)
@@ -17,6 +17,7 @@ data class MessagingPlatform(
@SerialName("env_vars") val envVars: List<EnvVarField>? = null,
@SerialName("updated_at") val updatedAt: String? = null,
@SerialName("home_channel") val homeChannel: HomeChannelInfo? = null,
@SerialName("ingress_url") val ingressUrl: String? = null,
)
@Serializable
@@ -64,6 +65,13 @@ data class MessagingPlatformTestResult(
val message: String,
)
@Serializable
data class MessagingPlatformUpdateResponse(
val ok: Boolean = false,
val platform: String? = null,
@SerialName("hot_served") val hotServed: Boolean = false,
)
// ── Telegram onboarding ─────────────────────────────────────────────────
@Serializable
@@ -1,4 +1,5 @@
package com.m57.hermescontrol.data.model
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
@@ -8,6 +9,8 @@ data class StatusResponse(
val active_sessions: Int? = null,
val auth_required: Boolean? = null,
val gateway_platforms: Map<String, PlatformStatus?>? = null,
@SerialName("gateway_shared_with")
val gatewaySharedWith: List<String>? = null,
val memory: MemoryPressureStatus? = null,
val disk: DiskPressureStatus? = null,
)
@@ -33,6 +33,8 @@ import com.m57.hermescontrol.data.model.EnvVarDeleteRequest
import com.m57.hermescontrol.data.model.EnvVarRevealRequest
import com.m57.hermescontrol.data.model.EnvVarRevealResponse
import com.m57.hermescontrol.data.model.EnvVarUpdate
import com.m57.hermescontrol.data.model.GatewayMigrationPlan
import com.m57.hermescontrol.data.model.GatewayMigrationStartResponse
import com.m57.hermescontrol.data.model.HealthStatus
import com.m57.hermescontrol.data.model.HookResponse
import com.m57.hermescontrol.data.model.InstantiateBlueprintRequest
@@ -65,6 +67,7 @@ import com.m57.hermescontrol.data.model.MemoryResponse
import com.m57.hermescontrol.data.model.MessagingPlatformResponse
import com.m57.hermescontrol.data.model.MessagingPlatformTestResult
import com.m57.hermescontrol.data.model.MessagingPlatformUpdate
import com.m57.hermescontrol.data.model.MessagingPlatformUpdateResponse
import com.m57.hermescontrol.data.model.MoaConfigResponse
import com.m57.hermescontrol.data.model.ModelAssignmentRequest
import com.m57.hermescontrol.data.model.ModelAssignmentResponse
@@ -390,6 +393,12 @@ interface HermesApiService : KanbanApiService {
@POST("api/gateway/restart")
suspend fun restartGateway(): Response<Unit>
@GET("api/gateway/migrate/plan")
suspend fun getGatewayMigrationPlan(): Response<GatewayMigrationPlan>
@POST("api/gateway/migrate")
suspend fun startGatewayMigration(): Response<GatewayMigrationStartResponse>
@GET("api/profiles")
suspend fun getProfiles(): Response<ProfilesResponse>
@@ -677,7 +686,7 @@ interface HermesApiService : KanbanApiService {
suspend fun configurePlatform(
@Path("platform_id") platformId: String,
@Body config: MessagingPlatformUpdate,
): Response<Unit>
): Response<MessagingPlatformUpdateResponse>
@POST("api/messaging/platforms/{platform_id}/test")
suspend fun testMessagingPlatform(