@stackmemoryai/stackmemory
Version:
Lossless, project-scoped memory for AI coding tools. Durable context across sessions with 56 MCP tools, FTS5 search, conductor orchestrator, loop/watch monitoring, snapshot capture, pre-flight overlap checks, Claude/Codex/OpenCode wrappers, Linear sync, a
38 lines (37 loc) • 888 B
JavaScript
import { fileURLToPath as __fileURLToPath } from 'url';
import { dirname as __pathDirname } from 'path';
const __filename = __fileURLToPath(import.meta.url);
const __dirname = __pathDirname(__filename);
const TAB = 9;
const ESC = 27;
class TabInterceptor {
predictionActive = false;
callbacks;
constructor(callbacks) {
this.callbacks = callbacks;
}
setPredictionActive(active) {
this.predictionActive = active;
}
isPredictionActive() {
return this.predictionActive;
}
process(data) {
if (!this.predictionActive) {
this.callbacks.onPassthrough(data);
return;
}
if (data.length === 1 && data[0] === TAB) {
this.callbacks.onAccept();
return;
}
if (data.length === 1 && data[0] === ESC) {
this.callbacks.onDismiss();
return;
}
this.callbacks.onPassthrough(data);
}
}
export {
TabInterceptor
};