feat: retro Claude ekip konsolunu kur

This commit is contained in:
2026-03-16 23:38:15 +03:00
parent 9294028fb2
commit 68d5c2afea
32 changed files with 5207 additions and 0 deletions

51
server/index.js Normal file
View File

@@ -0,0 +1,51 @@
import express from "express";
import http from "http";
import path from "path";
import { fileURLToPath } from "url";
import { Server } from "socket.io";
import { getPublicRuntimeConfig, getRuntimeConfig } from "./config.js";
import { SessionManager } from "./sessionManager.js";
import { registerSocketHandlers } from "./socketHandlers.js";
const config = getRuntimeConfig();
const app = express();
const server = http.createServer(app);
const io = new Server(server, {
cors: {
origin: "*"
}
});
const sessionManager = new SessionManager({ io, config });
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const webDistPath = path.resolve(__dirname, "../web/dist");
app.get("/health", (req, res) => {
res.json({
ok: true,
runtime: getPublicRuntimeConfig(config),
session: sessionManager.getState()
});
});
app.get("/api/session/state", (req, res) => {
res.json({
state: sessionManager.getState(),
logs: sessionManager.getLogSnapshot(),
chat: sessionManager.getChatSnapshot()
});
});
if (config.nodeEnv === "production") {
app.use(express.static(webDistPath));
app.get("*", (req, res) => {
res.sendFile(path.join(webDistPath, "index.html"));
});
}
registerSocketHandlers(io, sessionManager);
server.listen(config.port, () => {
console.log(`Retro console server listening on http://localhost:${config.port}`);
});