feat(chat): support first-class /compress and /compact session compression (#1306)

This commit is contained in:
m57 authored and GitHub committed 2026-09-27 20:47:59 +03:00
1 parent 3c56026a1c
commit bbfcfada6b
13 files changed
+929 -6

No files matched your search

@@ -0,0 +1,32 @@
package com.m57.hermescontrol.data.model
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.JsonElement
@Serializable
data class SessionCompressResponse(
val status: String? = null,
val removed: Int? = null,
val before_messages: Int? = null,
val after_messages: Int? = null,
val before_tokens: Long? = null,
val after_tokens: Long? = null,
val summary: CompressionSummary? = null,
val compressed: Boolean? = null,
val lock_held: Boolean? = null,
val message: String? = null,
val messages: List<SessionMessage>? = null,
val usage: JsonElement? = null,
val info: JsonElement? = null,
)
@Serializable
data class CompressionSummary(
val noop: Boolean = false,
val aborted: Boolean = false,
val refused_would_grow: Boolean? = null,
val fallback_used: Boolean? = null,
val headline: String = "",
val token_line: String = "",
val note: String? = null,
)
@@ -73,7 +73,6 @@ object CommandBlocklist {
"/image",
"/quit",
// TUI-only extras (meaningless outside the TUI)
"/compact",
"/logs",
"/mouse",
)
@@ -16,6 +16,7 @@ object WsMethods {
const val SESSION_TITLE = "session.title"
const val SESSION_BRANCH = "session.branch"
const val SESSION_BRANCH_WHOLE = "session.branch_whole"
const val SESSION_COMPRESS = "session.compress"
/** Replay recorded events newer than client's last-seen seq for a session. */
const val SESSION_EVENTS_SINCE = "session.events.since"