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

Function emitInterrupt

lib/logger.js:212–226  ·  view source on GitHub ↗
(source)

Source from the content-addressed store, hash-verified

210}
211
212function emitInterrupt(source) {
213 const interruptEvent = {
214 type: 'interrupt',
215 source,
216 timestamp: Date.now(),
217 uuid: crypto.randomUUID(),
218 };
219 const record = { seq: ++state.eventSeq, event: interruptEvent };
220 state.eventBuffer.push(record);
221 if (state.eventBuffer.length > EVENT_BUFFER_MAX) {
222 state.eventBuffer = state.eventBuffer.slice(-Math.round(EVENT_BUFFER_MAX * 0.8));
223 }
224 broadcast({ type: 'log_event', seq: record.seq, event: interruptEvent });
225 setTurnState('idle', { reason: `${source}_interrupt` });
226}
227
228function formatTtyInputChunk(chunk) {
229 const buf = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);

Callers 3

attachTtyForwardersFunction · 0.85
setupWebSocketServerFunction · 0.85
test-modules.jsFile · 0.85

Calls 2

broadcastFunction · 0.85
setTurnStateFunction · 0.85

Tested by

no test coverage detected