Files
hapi/shared/src/schemas.compaction.test.ts
T
wushenghua ee4422dbc5 feat(codex,web): show live context compaction status
The composer status bar surfaces an in-flight Codex context compaction
with the native start time and an elapsed timer; completion,
interruption, reconnect, and shutdown all clear it. The CLI follows the
contextCompaction item on the app-server stream and publishes
contextCompactionStartedAt through the shared agent state.
2026-10-16 20:32:57 +08:00

16 lines
730 B
TypeScript

import { describe, expect, it } from 'vitest'
import { AgentStateSchema } from './schemas'
describe('live context compaction state', () => {
it('preserves the start timestamp and an explicit clear across schema parsing', () => {
expect(AgentStateSchema.parse({ contextCompactionStartedAt: 1_792_068_848_000 }))
.toEqual({ contextCompactionStartedAt: 1_792_068_848_000 })
expect(AgentStateSchema.parse({ contextCompactionStartedAt: null }))
.toEqual({ contextCompactionStartedAt: null })
})
it.each([-1, 1.5, 'now'])('rejects an invalid start time: %s', value => {
expect(AgentStateSchema.safeParse({ contextCompactionStartedAt: value }).success).toBe(false)
})
})