refactor: dedupe extension record guards

This commit is contained in:
Peter Steinberger
2026-04-07 00:19:16 +01:00
parent 1566a5b3bc
commit d5801c03ed
2 changed files with 2 additions and 8 deletions

View File

@@ -3,6 +3,7 @@ import type {
WebSearchProviderPlugin,
WebSearchProviderToolDefinition,
} from "openclaw/plugin-sdk/provider-web-search";
import { isRecord } from "openclaw/plugin-sdk/text-runtime";
import {
createBraveSchema,
mapBraveLlmContextResults,
@@ -19,10 +20,6 @@ type ConfigTarget = Parameters<
NonNullable<WebSearchProviderPlugin["setConfiguredCredentialValue"]>
>[0];
function isRecord(value: unknown): value is Record<string, unknown> {
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
}
function resolveProviderWebSearchPluginConfig(
config: ConfigInput,
pluginId: string,

View File

@@ -1,6 +1,7 @@
import { existsSync, readFileSync } from "node:fs";
import { homedir } from "node:os";
import { join } from "node:path";
import { isRecord } from "openclaw/plugin-sdk/text-runtime";
type OAuthSettingsFs = {
existsSync: (path: Parameters<typeof existsSync>[0]) => ReturnType<typeof existsSync>;
@@ -27,10 +28,6 @@ type GeminiCliAuthSettings = {
enforcedAuthType?: unknown;
};
function isRecord(value: unknown): value is Record<string, unknown> {
return typeof value === "object" && value !== null;
}
function readString(value: unknown): string | undefined {
return typeof value === "string" && value.trim() ? value.trim() : undefined;
}