fix(tui): restore compaction model marker

This commit is contained in:
Kit Langton 2026-07-14 11:35:12 -04:00
commit 76f205d260
13 changed files with 105 additions and 19 deletions

View file

@ -488,6 +488,7 @@ export namespace Compaction {
schema: {
...Base,
reason: Started.data.fields.reason,
model: Model.Ref.pipe(optional),
text: Schema.String,
recent: Schema.String,
},

View file

@ -222,6 +222,7 @@ export const CompactionCompleted = Schema.Struct({
...CompactionBase,
status: Schema.tag("completed"),
reason: Schema.Literals(["auto", "manual"]),
model: Model.Ref.pipe(optional),
summary: Schema.String,
recent: Schema.String,
}).annotate({ identifier: "Session.Message.Compaction.Completed" })

View file

@ -0,0 +1,21 @@
import { describe, expect, test } from "bun:test"
import { Schema } from "effect"
import { SessionMessage } from "../src/session-message.js"
describe("session message", () => {
test("decodes completed compactions recorded before model attribution", () => {
const encoded = {
type: "compaction" as const,
id: "msg_compaction",
time: { created: 0 },
status: "completed" as const,
reason: "manual" as const,
summary: "summary",
recent: "",
}
const message = Schema.decodeUnknownSync(SessionMessage.CompactionCompleted)(encoded)
expect(message.model).toBeUndefined()
expect(Schema.encodeSync(SessionMessage.CompactionCompleted)(message)).toEqual(encoded)
})
})