feat: add Codex session management and automatic restoration

This commit is contained in:
lzt404 committed 2026-07-26 11:54:48 +08:00
1 parent 50b35ae6bd
commit 4e8125b94a
12 files changed
+4433 -77

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
import { describe, expect, it } from 'bun:test';
import {
codexSessionPageCounts,
retainVisibleCodexSessionIds,
} from '../src/services/codexSessionState';
describe('Codex session page state', () => {
it('counts active and archived sessions on the current page', () => {
expect(codexSessionPageCounts([
{ archived: false },
{ archived: true },
{ archived: false },
])).toEqual({ active: 2, archived: 1 });
});
it('drops selections that are no longer on the visible page', () => {
expect(Array.from(retainVisibleCodexSessionIds(
new Set(['thread-a', 'thread-c']),
[{ id: 'thread-a' }, { id: 'thread-b' }],
))).toEqual(['thread-a']);
});
});