MCPcopy Create free account
hub / github.com/RioArisk/claudecode_api_RemoteControl / markExpectingSwitch

Function markExpectingSwitch

lib/transcript.js:260–280  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

258}
259
260function markExpectingSwitch() {
261 state.expectingSwitch = true;
262 if (state.expectingSwitchTimer) clearTimeout(state.expectingSwitchTimer);
263 state.expectingSwitchTimer = setTimeout(() => {
264 state.expectingSwitch = false;
265 state.expectingSwitchTimer = null;
266 log('Expecting-switch flag expired (no new transcript found)');
267 }, 15000);
268 log('Expecting session switch (/clear detected)');
269 if (maybeAttachPendingSwitchTarget('markExpectingSwitch')) return;
270
271 if (state.switchWatcher) { clearInterval(state.switchWatcher); state.switchWatcher = null; }
272 if (state.switchWatcherDelayTimer) { clearTimeout(state.switchWatcherDelayTimer); state.switchWatcherDelayTimer = null; }
273 state.switchWatcherDelayTimer = setTimeout(() => {
274 state.switchWatcherDelayTimer = null;
275 if (state.expectingSwitch && !state.switchWatcher) {
276 log('Hook did not bind within 5s, starting switchWatcher fallback');
277 startSwitchWatcher();
278 }
279 }, 5000);
280}
281
282function startSwitchWatcher() {
283 if (state.switchWatcher) { clearInterval(state.switchWatcher); state.switchWatcher = null; }

Callers 3

startTailingFunction · 0.85
setupWebSocketServerFunction · 0.85
createHttpServerFunction · 0.85

Calls 3

logFunction · 0.85
startSwitchWatcherFunction · 0.85

Tested by

no test coverage detected