feat(codex): use hook to obtain the session id and transcript path

This commit is contained in:
weishu
2026-04-24 10:52:38 +08:00
parent 82703b85fb
commit 8e54bbeb53
8 changed files with 610 additions and 762 deletions
+16 -1
View File
@@ -1,5 +1,9 @@
import { describe, it, expect } from 'vitest';
import { buildMcpServerConfigArgs, buildDeveloperInstructionsArg } from './codexMcpConfig';
import {
buildMcpServerConfigArgs,
buildDeveloperInstructionsArg,
buildSessionStartHookConfigArgs
} from './codexMcpConfig';
describe('codexMcpConfig', () => {
describe('buildMcpServerConfigArgs', () => {
@@ -90,4 +94,15 @@ describe('codexMcpConfig', () => {
expect(args[1]).toContain('\\\\');
});
});
describe('buildSessionStartHookConfigArgs', () => {
it('builds a SessionStart hook config override', () => {
const args = buildSessionStartHookConfigArgs(4312, 'secret-token');
expect(args[0]).toBe('-c');
expect(args[1]).toContain('hooks.SessionStart=[');
expect(args[1]).toContain('type = "command"');
expect(args[1]).toContain('hook-forwarder --port 4312 --token secret-token');
});
});
});