chore: upgrade ktlint to 1.8.0 and format codebase (#1024)
Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
1 parent
3f3b853758
commit
cfe3e736fd
66 files changed
+1287
-541
No files matched your search
@@ -256,12 +256,15 @@ object HermesWsClient {
|
||||
is WsEvent.ThinkingDelta,
|
||||
is WsEvent.ReasoningDelta,
|
||||
is WsEvent.ToolStart,
|
||||
-> pendingReply = true
|
||||
-> {
|
||||
pendingReply = true
|
||||
}
|
||||
|
||||
is WsEvent.MessageComplete -> {
|
||||
pendingReply = false
|
||||
disconnectIfIdleInBackground()
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
@@ -992,7 +995,9 @@ object HermesWsClient {
|
||||
disconnectIfIdleInBackground()
|
||||
}
|
||||
|
||||
else -> Unit
|
||||
else -> {
|
||||
Unit
|
||||
}
|
||||
}
|
||||
// tryEmit on a DROP_OLDEST flow only returns false when the
|
||||
// buffer is full AND no subscriber is draining; with extraBuffer=512
|
||||
|
||||
@@ -44,12 +44,30 @@ data class JsonRpcError(
|
||||
|
||||
fun Any?.toJsonElement(): JsonElement =
|
||||
when (this) {
|
||||
null -> JsonNull
|
||||
is JsonElement -> this
|
||||
is Boolean -> JsonPrimitive(this)
|
||||
is Int -> JsonPrimitive(this)
|
||||
is Long -> JsonPrimitive(this)
|
||||
is Float -> JsonPrimitive(this)
|
||||
null -> {
|
||||
JsonNull
|
||||
}
|
||||
|
||||
is JsonElement -> {
|
||||
this
|
||||
}
|
||||
|
||||
is Boolean -> {
|
||||
JsonPrimitive(this)
|
||||
}
|
||||
|
||||
is Int -> {
|
||||
JsonPrimitive(this)
|
||||
}
|
||||
|
||||
is Long -> {
|
||||
JsonPrimitive(this)
|
||||
}
|
||||
|
||||
is Float -> {
|
||||
JsonPrimitive(this)
|
||||
}
|
||||
|
||||
is Double -> {
|
||||
// Preserve integer semantics: 177.0 → JsonPrimitive(177) not "177.0"
|
||||
if (this % 1.0 == 0.0 && this >= Int.MIN_VALUE.toDouble() && this <= Int.MAX_VALUE.toDouble()) {
|
||||
@@ -60,11 +78,26 @@ fun Any?.toJsonElement(): JsonElement =
|
||||
JsonPrimitive(this)
|
||||
}
|
||||
}
|
||||
is Number -> JsonPrimitive(this)
|
||||
is String -> JsonPrimitive(this)
|
||||
is Map<*, *> -> JsonObject(this.map { it.key.toString() to it.value.toJsonElement() }.toMap())
|
||||
is List<*> -> JsonArray(this.map { it.toJsonElement() })
|
||||
else -> JsonPrimitive(this.toString())
|
||||
|
||||
is Number -> {
|
||||
JsonPrimitive(this)
|
||||
}
|
||||
|
||||
is String -> {
|
||||
JsonPrimitive(this)
|
||||
}
|
||||
|
||||
is Map<*, *> -> {
|
||||
JsonObject(this.map { it.key.toString() to it.value.toJsonElement() }.toMap())
|
||||
}
|
||||
|
||||
is List<*> -> {
|
||||
JsonArray(this.map { it.toJsonElement() })
|
||||
}
|
||||
|
||||
else -> {
|
||||
JsonPrimitive(this.toString())
|
||||
}
|
||||
}
|
||||
|
||||
fun JsonElement.toAny(): Any? =
|
||||
|
||||
Reference in new issue
Block a user