mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 10:41:25 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -17,8 +17,12 @@ import { resolveLinkChannelContext } from "./status.link-channel.js";
|
||||
import type { HeartbeatStatus, SessionStatus, StatusSummary } from "./status.types.js";
|
||||
|
||||
const classifyKey = (key: string, entry?: SessionEntry): SessionStatus["kind"] => {
|
||||
if (key === "global") return "global";
|
||||
if (key === "unknown") return "unknown";
|
||||
if (key === "global") {
|
||||
return "global";
|
||||
}
|
||||
if (key === "unknown") {
|
||||
return "unknown";
|
||||
}
|
||||
if (entry?.chatType === "group" || entry?.chatType === "channel") {
|
||||
return "group";
|
||||
}
|
||||
@@ -29,20 +33,36 @@ const classifyKey = (key: string, entry?: SessionEntry): SessionStatus["kind"] =
|
||||
};
|
||||
|
||||
const buildFlags = (entry?: SessionEntry): string[] => {
|
||||
if (!entry) return [];
|
||||
if (!entry) {
|
||||
return [];
|
||||
}
|
||||
const flags: string[] = [];
|
||||
const think = entry?.thinkingLevel;
|
||||
if (typeof think === "string" && think.length > 0) flags.push(`think:${think}`);
|
||||
if (typeof think === "string" && think.length > 0) {
|
||||
flags.push(`think:${think}`);
|
||||
}
|
||||
const verbose = entry?.verboseLevel;
|
||||
if (typeof verbose === "string" && verbose.length > 0) flags.push(`verbose:${verbose}`);
|
||||
if (typeof verbose === "string" && verbose.length > 0) {
|
||||
flags.push(`verbose:${verbose}`);
|
||||
}
|
||||
const reasoning = entry?.reasoningLevel;
|
||||
if (typeof reasoning === "string" && reasoning.length > 0) flags.push(`reasoning:${reasoning}`);
|
||||
if (typeof reasoning === "string" && reasoning.length > 0) {
|
||||
flags.push(`reasoning:${reasoning}`);
|
||||
}
|
||||
const elevated = entry?.elevatedLevel;
|
||||
if (typeof elevated === "string" && elevated.length > 0) flags.push(`elevated:${elevated}`);
|
||||
if (entry?.systemSent) flags.push("system");
|
||||
if (entry?.abortedLastRun) flags.push("aborted");
|
||||
if (typeof elevated === "string" && elevated.length > 0) {
|
||||
flags.push(`elevated:${elevated}`);
|
||||
}
|
||||
if (entry?.systemSent) {
|
||||
flags.push("system");
|
||||
}
|
||||
if (entry?.abortedLastRun) {
|
||||
flags.push("aborted");
|
||||
}
|
||||
const sessionId = entry?.sessionId as unknown;
|
||||
if (typeof sessionId === "string" && sessionId.length > 0) flags.push(`id:${sessionId}`);
|
||||
if (typeof sessionId === "string" && sessionId.length > 0) {
|
||||
flags.push(`id:${sessionId}`);
|
||||
}
|
||||
return flags;
|
||||
};
|
||||
|
||||
@@ -81,7 +101,9 @@ export async function getStatusSummary(): Promise<StatusSummary> {
|
||||
const storeCache = new Map<string, Record<string, SessionEntry | undefined>>();
|
||||
const loadStore = (storePath: string) => {
|
||||
const cached = storeCache.get(storePath);
|
||||
if (cached) return cached;
|
||||
if (cached) {
|
||||
return cached;
|
||||
}
|
||||
const store = loadSessionStore(storePath);
|
||||
storeCache.set(storePath, store);
|
||||
return store;
|
||||
|
||||
Reference in New Issue
Block a user