fix(compaction): add checkpoint store for session agent config

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-03-08 02:23:11 +09:00
parent f3be710a73
commit 90be61b45b
@@ -0,0 +1,42 @@
export type CompactionAgentConfigCheckpoint = {
agent?: string
model?: { providerID: string; modelID: string }
tools?: Record<string, boolean>
}
const checkpoints = new Map<string, CompactionAgentConfigCheckpoint>()
function cloneCheckpoint(
checkpoint: CompactionAgentConfigCheckpoint,
): CompactionAgentConfigCheckpoint {
return {
...(checkpoint.agent ? { agent: checkpoint.agent } : {}),
...(checkpoint.model
? {
model: {
providerID: checkpoint.model.providerID,
modelID: checkpoint.model.modelID,
},
}
: {}),
...(checkpoint.tools ? { tools: { ...checkpoint.tools } } : {}),
}
}
export function setCompactionAgentConfigCheckpoint(
sessionID: string,
checkpoint: CompactionAgentConfigCheckpoint,
): void {
checkpoints.set(sessionID, cloneCheckpoint(checkpoint))
}
export function getCompactionAgentConfigCheckpoint(
sessionID: string,
): CompactionAgentConfigCheckpoint | undefined {
const checkpoint = checkpoints.get(sessionID)
return checkpoint ? cloneCheckpoint(checkpoint) : undefined
}
export function clearCompactionAgentConfigCheckpoint(sessionID: string): void {
checkpoints.delete(sessionID)
}