mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-10-30 19:32:39 +08:00
fix(cli): preserve variant after compact
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@kilocode/cli": patch
|
||||
"kilo-code": patch
|
||||
---
|
||||
|
||||
Preserve the selected thinking level after compacting a session.
|
||||
@@ -43,6 +43,7 @@ import { DialogSkill } from "../dialog-skill"
|
||||
import { DialogWorkspaceCreate, restoreWorkspaceSession } from "../dialog-workspace-create"
|
||||
import { DialogWorkspaceUnavailable } from "../dialog-workspace-unavailable"
|
||||
import { useArgs } from "@tui/context/args"
|
||||
import { KiloSessionTuiSync } from "@/kilocode/session/tui-sync" // kilocode_change
|
||||
|
||||
export type PromptProps = {
|
||||
sessionID?: string
|
||||
@@ -236,6 +237,7 @@ export function Prompt(props: PromptProps) {
|
||||
const sessionID = props.sessionID
|
||||
const msg = lastUserMessage()
|
||||
if (!sessionID || !msg) return
|
||||
if (!KiloSessionTuiSync.model(msg)) return // kilocode_change
|
||||
|
||||
const key = [sessionID, msg.id].join(":")
|
||||
if (key === syncedKey) return
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
export namespace KiloSessionTuiSync {
|
||||
export function model(input: { role: string; parts?: readonly { type: string }[] }) {
|
||||
if (input.role !== "user") return false
|
||||
return !input.parts?.some((part) => part.type === "compaction")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { describe, expect, test } from "bun:test"
|
||||
import { KiloSessionTuiSync } from "../../src/kilocode/session/tui-sync"
|
||||
|
||||
describe("KiloSessionTuiSync.model", () => {
|
||||
test("syncs normal user messages", () => {
|
||||
expect(KiloSessionTuiSync.model({ role: "user", parts: [{ type: "text" }] })).toBe(true)
|
||||
})
|
||||
|
||||
test("skips compaction marker user messages", () => {
|
||||
expect(KiloSessionTuiSync.model({ role: "user", parts: [{ type: "compaction" }] })).toBe(false)
|
||||
})
|
||||
|
||||
test("skips non-user messages", () => {
|
||||
expect(KiloSessionTuiSync.model({ role: "assistant", parts: [{ type: "text" }] })).toBe(false)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user