2.0阶段2: 配置读写API(GET/PATCH保留注释/PUT整文件/validate干跑)+系统状态+优雅重启(exit+Docker拉起,运行中回合409保护);去掉logo退出登录;config.yml挂载放开:ro

This commit is contained in:
2026-09-01 16:50:00 +08:00
parent 4968241951
commit e9a1331557
10 changed files with 256 additions and 19 deletions
+9
View File
@@ -256,6 +256,14 @@ function getRun(sessionId, create) {
return run;
}
// 正在执行 AI 回合(looping)的会话 id 列表:供重启保护判断。
// 注意只算「回合执行中」;active 但空闲(等用户输入)与 held 都不算,重启无损失。
function activeRuns() {
const out = [];
for (const [id, run] of runs) if (run && run.looping) out.push(id);
return out;
}
function killRunProcs(run) {
for (const proc of run.procs) {
try { process.kill(-proc.pid, 'SIGKILL'); } catch (_) {
@@ -549,6 +557,7 @@ module.exports = {
getDb: () => db,
getBus: () => bus,
getConfig: () => cfg,
activeRuns,
createSession,
postUserMessage,
startExecution,