Files
hapi/cli/src/codex/runCodex.test.ts
T
weishu 0c4abcb3d1 feat(codex): share sessions across terminal and web
Use one native app-server for terminal, Web and phone clients while retaining the existing CLI and Runner lifecycle.

Synchronize native queues, permissions, question history and steering state; preserve explicit permission precedence and per-turn usage models. Resume inactive clear commands through Runner and reject independent child cold resumes.

Add shared-runtime regression tests, generated protocol fixtures and lifecycle documentation.
2026-09-12 10:59:17 +08:00

14 lines
724 B
TypeScript

import { describe, expect, it, vi } from 'vitest';
const run = vi.hoisted(() => vi.fn(async (_options: unknown) => {}));
vi.mock('./shared/frontend', () => ({ runSharedCodex: run }));
import { runCodex } from './runCodex';
describe('Codex entrypoint', () => {
it('uses the shared runtime for terminal, runner and resume (no exclusive-mode branch)', async () => {
const launches = [{ startedBy: 'terminal' as const }, { startedBy: 'runner' as const },
{ existingSessionId: 'hapi', resumeSessionId: 'native', collaborationMode: 'plan' as const }];
for (const options of launches) await runCodex(options);
expect(run.mock.calls).toEqual(launches.map(options => [options]));
});
});