MCPcopy Create free account
hub / github.com/tiann/hapi / handleSessionHook

Function handleSessionHook

cli/src/codex/codexLocalLauncher.ts:134–151  ·  view source on GitHub ↗
(sessionId: string, data: Record<string, unknown>)

Source from the content-addressed store, hash-verified

132 };
133
134 const handleSessionHook = (sessionId: string, data: Record<string, unknown>): void => {
135 if (shuttingDown) {
136 return;
137 }
138
139 const transcriptPath = typeof data.transcript_path === 'string' && data.transcript_path.length > 0
140 ? data.transcript_path
141 : null;
142 const hookSource = typeof data.source === 'string' ? data.source : null;
143 const shouldAllowSessionSwitch = hookSource === 'clear';
144
145 if (!transcriptPath) {
146 handleSessionFound(sessionId, shouldAllowSessionSwitch);
147 return;
148 }
149
150 bindPrimarySession(sessionId, transcriptPath, shouldAllowSessionSwitch);
151 };
152
153 const hookServer = await startHookServer({
154 onSessionHook: (sessionId, data) => {

Callers 1

codexLocalLauncherFunction · 0.85

Calls 2

bindPrimarySessionFunction · 0.85
handleSessionFoundFunction · 0.70

Tested by

no test coverage detected