Initial commit: Discord-Claude Gateway with event-driven agent runtime

This commit is contained in:
2026-02-22 00:31:25 -05:00
commit 77d7c74909
58 changed files with 11772 additions and 0 deletions

17
src/shutdown-handler.ts Normal file
View File

@@ -0,0 +1,17 @@
import type { GatewayCore } from "./gateway-core.js";
export function registerShutdownHandler(gateway: GatewayCore): void {
let shuttingDown = false;
const handler = (signal: string) => {
if (shuttingDown) {
return;
}
shuttingDown = true;
console.log(`Received ${signal}, shutting down...`);
gateway.shutdown();
};
process.on("SIGTERM", () => handler("SIGTERM"));
process.on("SIGINT", () => handler("SIGINT"));
}