fix(tui): restore compaction model marker
This commit is contained in:
parent
634386fe0f
commit
76f205d260
13 changed files with 105 additions and 19 deletions
|
|
@ -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,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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" })
|
||||
|
|
|
|||
21
packages/schema/test/session-message.test.ts
Normal file
21
packages/schema/test/session-message.test.ts
Normal 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)
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue