fix android shell output wire defaults
This commit is contained in:
@@ -2,6 +2,8 @@ package net.awan.pipelines.data.protocol
|
||||
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.EncodeDefault
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import kotlinx.serialization.json.JsonElement
|
||||
import kotlinx.serialization.json.JsonObject
|
||||
|
||||
@@ -202,10 +204,13 @@ data class ChatShell(
|
||||
)
|
||||
|
||||
@Serializable
|
||||
@OptIn(ExperimentalSerializationApi::class)
|
||||
data class ChatShellOutputQuery(
|
||||
@SerialName("session_id") val sessionId: String = "",
|
||||
@SerialName("shell_id") val shellId: String = "",
|
||||
@EncodeDefault(EncodeDefault.Mode.ALWAYS)
|
||||
val cursor: Long = 0,
|
||||
@EncodeDefault(EncodeDefault.Mode.ALWAYS)
|
||||
val limit: Int = ChatProtocol.SHELL_OUTPUT_LIMIT,
|
||||
)
|
||||
|
||||
|
||||
@@ -407,6 +407,14 @@ class ChatProtocolTest {
|
||||
|
||||
@Test
|
||||
fun shellOutputRequestAndPageUseBoundedWireNames() {
|
||||
val defaults = ChatProtocol.shellOutputRequest("ses_1", "sh_1")
|
||||
val defaultJson = PipelinesJson.encodeToString(Message.serializer(), defaults)
|
||||
assertTrue(defaultJson.contains("\"cursor\":0"))
|
||||
assertTrue(defaultJson.contains("\"limit\":65536"))
|
||||
val decodedDefaults = PipelinesJson.decodeFromString(Message.serializer(), defaultJson)
|
||||
assertEquals(0L, decodedDefaults.chatShellOutputQuery!!.cursor)
|
||||
assertEquals(ChatProtocol.SHELL_OUTPUT_LIMIT, decodedDefaults.chatShellOutputQuery!!.limit)
|
||||
|
||||
val request = ChatProtocol.shellOutputRequest("ses_1", "sh_1", 7, 128)
|
||||
val decoded = PipelinesJson.decodeFromString(Message.serializer(), PipelinesJson.encodeToString(Message.serializer(), request))
|
||||
assertEquals(Protocol.CHAT_SHELL_OUTPUT, decoded.type)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# Shell output default wire fields
|
||||
|
||||
The Android shell-output query now always serializes its bounded `cursor` and
|
||||
`limit` fields, including when callers use the request helper defaults. The
|
||||
server requires both bounds explicitly; unrelated protocol DTO defaults remain
|
||||
unchanged.
|
||||
|
||||
The packaged OpenCode skill references and any shared protocol documentation
|
||||
that describe Android shell-output request serialization are stale. The
|
||||
manual-only `docs-fold` pipeline should update those references; this item does
|
||||
not edit shared docs or packaged skill files.
|
||||
Reference in New Issue
Block a user