/**
 * @module        console/routes/processes
 * @description   进程巡检 REST —— 列出 SPS-ACP 启动的 claude 进程、按 pid 关闭。
 *                只认 daemon state.json 登记的进程,天然排除用户自己的 claude。
 * @layer         console
 */
import { Hono } from 'hono';
import { killSpsProcess, listSpsProcesses } from '../../core/processInspect.js';
export function createProcessesRoute() {
    const app = new Hono();
    app.get('/', (c) => c.json({ data: listSpsProcesses() }));
    app.post('/:pid/kill', (c) => {
        const pid = Number(c.req.param('pid'));
        if (!Number.isInteger(pid) || pid <= 0) {
            return c.json({ type: 'validation', title: 'invalid pid', status: 422 }, 422);
        }
        const r = killSpsProcess(pid);
        return c.json(r, r.ok ? 200 : 409);
    });
    return app;
}
//# sourceMappingURL=processes.js.map