mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-10 09:19:42 +02:00
Create 6 domain-focused config files in src/config/ to centralize operational tuning knobs that were scattered across 15+ source files: - server-timing.ts: SSE batching, state debounce, scheduled runs, error recovery - auth-config.ts: session TTL, rate limits, hook timeout - tunnel-config.ts: QR token rotation, tunnel process lifecycle - terminal-limits.ts: input length, terminal cols/rows, session name - ai-defaults.ts: AI model string, idle/plan context limits - team-config.ts: poll interval, cache sizes Eliminates all cross-file duplicates: - AI model string: 5 occurrences → 1 (config only) - STATS_COLLECTION_INTERVAL_MS: 2 → 1 - timeout: 10000 in hooks-config: 6 → 0 (now HOOK_TIMEOUT_MS) - MAX_TRACKED_AGENTS shadow: removed, imports from map-limits Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
/**
|
|
* @fileoverview Mux (tmux) session management routes.
|
|
* Provides mux session listing, killing, reconciliation, and stats control.
|
|
*/
|
|
|
|
import { FastifyInstance } from 'fastify';
|
|
import type { InfraPort } from '../ports/index.js';
|
|
import { STATS_COLLECTION_INTERVAL_MS } from '../../config/server-timing.js';
|
|
|
|
export function registerMuxRoutes(app: FastifyInstance, ctx: InfraPort): void {
|
|
app.get('/api/mux-sessions', async () => {
|
|
const sessions = await ctx.mux.getSessionsWithStats();
|
|
return {
|
|
sessions,
|
|
muxAvailable: ctx.mux.isAvailable(),
|
|
};
|
|
});
|
|
|
|
app.delete('/api/mux-sessions/:sessionId', async (req) => {
|
|
const { sessionId } = req.params as { sessionId: string };
|
|
const success = await ctx.mux.killSession(sessionId);
|
|
return { success };
|
|
});
|
|
|
|
app.post('/api/mux-sessions/reconcile', async () => {
|
|
const result = await ctx.mux.reconcileSessions();
|
|
return result;
|
|
});
|
|
|
|
app.post('/api/mux-sessions/stats/start', async () => {
|
|
ctx.mux.startStatsCollection(STATS_COLLECTION_INTERVAL_MS);
|
|
return { success: true };
|
|
});
|
|
|
|
app.post('/api/mux-sessions/stats/stop', async () => {
|
|
ctx.mux.stopStatsCollection();
|
|
return { success: true };
|
|
});
|
|
}
|