fix(tui): restore queued compaction indicator (#36440)

This commit is contained in:
Kit Langton 2026-07-11 13:54:23 -04:00 committed by GitHub
commit 5945a8d429
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 181 additions and 1 deletions

View file

@ -1059,6 +1059,9 @@ function SessionRowView(props: { row: SessionRow; message: (messageID: string) =
<Show when={props.message(row().messageID)}>{(message) => <SessionMessageView message={message()} />}</Show>
)}
</Match>
<Match when={props.row.type === "compaction-queued"}>
<CompactionQueued />
</Match>
<Match when={props.row.type === "part" ? props.row : undefined}>
{(row) => <SessionPartView partRef={row().ref} message={props.message} />}
</Match>
@ -1370,6 +1373,20 @@ function CompactionMessage(props: { message: Extract<SessionMessageInfo, { type:
)
}
function CompactionQueued() {
const { theme } = useTheme()
return (
<box flexDirection="row" alignItems="center">
<box border={["top"]} borderColor={theme.border} flexGrow={1} />
<box flexDirection="row" gap={1} paddingLeft={1} paddingRight={1}>
<text fg={theme.textMuted}></text>
<text fg={theme.textMuted}>Compaction queued</text>
</box>
<box border={["top"]} borderColor={theme.border} flexGrow={1} />
</box>
)
}
function statusLabel(status: "added" | "modified" | "deleted") {
if (status === "added") return "A"
if (status === "deleted") return "D"

View file

@ -10,6 +10,7 @@ export type PartRef = {
export type SessionRow =
| { type: "message"; messageID: string }
| { type: "compaction-queued"; inputID: string }
| { type: "part"; ref: PartRef }
| {
type: "group"
@ -31,6 +32,14 @@ export function createSessionRows(sessionID: Accessor<string>) {
const boundary = revertBoundary()
const rows = reduceSessionRows(boundary ? messages.filter((message) => message.id < boundary) : messages, inputs)
partitionPending(rows, pendingPermissions())
const position = rows.findIndex((row) => row.type === "message" && inputs.has(row.messageID))
rows.splice(
position === -1 ? rows.length : position,
0,
...data.session.compaction
.list(sessionID())
.map((inputID): SessionRow => ({ type: "compaction-queued", inputID })),
)
return rows
}
@ -54,6 +63,7 @@ export function createSessionRows(sessionID: Accessor<string>) {
createEffect(
on(sessionID, (id) => {
setRows(reconcile(reduce()))
void data.session.compaction.refresh(id).catch(() => undefined)
void data.session.message.refresh(id).then(
() => {
if (sessionID() !== id) return
@ -71,6 +81,13 @@ export function createSessionRows(sessionID: Accessor<string>) {
}),
)
createEffect(
on(
() => data.session.compaction.list(sessionID()).map((inputID) => inputID),
() => setRows(reconcile(reduce())),
),
)
createEffect(
on(
() =>