mirror of
https://github.com/wu736139669/hapi.git
synced 2026-10-27 22:51:43 +00:00
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.
16 lines
730 B
TypeScript
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)
|
|
})
|
|
})
|