fix(#1230,#1221): clarify inactive plugins and verify uninstall (#1236)

This commit is contained in:
m57 authored and GitHub committed 2026-09-23 12:25:21 +03:00
1 parent 721edef618
commit 33d87a11ec
13 files changed
+475 -94

No files matched your search

@@ -0,0 +1,31 @@
package com.m57.hermescontrol.data.ws
import kotlinx.coroutines.CancellationException
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.decodeFromJsonElement
@Serializable
data class PluginRemovalResult(
val ok: Boolean,
val name: String? = null,
val error: String? = null,
)
/** Removes a user-installed plugin through the gateway's canonical plugin manager. */
class PluginRemovalRepository(
private val rpcRequest: suspend (String, Map<String, Any>) -> Any? = { method, params ->
val deferred = HermesWsClient.request(method, params)
try {
deferred.await()
} catch (e: CancellationException) {
deferred.cancel(e)
throw e
}
},
) {
suspend fun remove(name: String): PluginRemovalResult {
val result = rpcRequest(WsMethods.PLUGINS_MANAGE, mapOf("action" to "remove", "name" to name))
return Json.decodeFromJsonElement<PluginRemovalResult>(result.toJsonElement())
}
}
@@ -110,6 +110,9 @@ object WsMethods {
/** Initiate or restart authorization flow for one or more connectors. */
const val CONNECTORS_CONNECT = "connectors.connect"
// ── Plugins ───────────────────────────────────────────────────────────
const val PLUGINS_MANAGE = "plugins.manage"
// ── Billing / subscription (issue #628) ─────────────────────────────
// Adopted from the backend release audit (hermes-agent 0bf44d557..614dc194e).
// `credits.view` was REMOVED upstream; these replace it. `usage.bars`
@@ -174,6 +177,7 @@ object WsMethods {
CONFIG_SET, // methods_config_set.py: @method("config.set") + @_profile_scoped
"verification.status", // line 282
PROJECTS_LIST, // methods_projects.py: @_registry.profile_scoped
PLUGINS_MANAGE, // methods_tools.py: @_scoped_rpc
"pet.info", // line 1253
"pet.info.meta", // line 1279
"pet.cells", // line 1302