refactor(plugins): consolidate record guards (#99361)

This commit is contained in:
Dallin Romney
2026-07-02 22:12:53 -07:00
committed by GitHub
parent 0e68c50139
commit de34dfdbe8
22 changed files with 23 additions and 90 deletions

View File

@@ -15,6 +15,7 @@ import {
updateSessionStore,
} from "openclaw/plugin-sdk/session-store-runtime";
import { resolveStateDir } from "openclaw/plugin-sdk/state-paths";
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
const FEISHU_STATE_DIR = "feishu";
const BACKUP_PREFIX = "feishu-state-repair";
@@ -84,10 +85,6 @@ function timestampForPath(now = new Date()): string {
return now.toISOString().replaceAll(":", "-");
}
function isRecord(value: unknown): value is Record<string, unknown> {
return Boolean(value && typeof value === "object" && !Array.isArray(value));
}
function toFeishuSessionEntry(value: unknown): FeishuSessionEntry {
if (!isRecord(value)) {
return {};