mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 05:54:32 +00:00
refactor(plugins): extract safety and provenance helpers
This commit is contained in:
@@ -4,6 +4,7 @@ import { resolveUserPath } from "../utils.js";
|
||||
import { normalizePluginsConfig, type NormalizedPluginsConfig } from "./config-state.js";
|
||||
import { discoverOpenClawPlugins, type PluginCandidate } from "./discovery.js";
|
||||
import { loadPluginManifest, type PluginManifest } from "./manifest.js";
|
||||
import { safeRealpathSync } from "./path-safety.js";
|
||||
import type { PluginConfigUiHint, PluginDiagnostic, PluginKind, PluginOrigin } from "./types.js";
|
||||
|
||||
type SeenIdEntry = {
|
||||
@@ -19,20 +20,6 @@ const PLUGIN_ORIGIN_RANK: Readonly<Record<PluginOrigin, number>> = {
|
||||
bundled: 3,
|
||||
};
|
||||
|
||||
function safeRealpathSync(rootDir: string, cache: Map<string, string>): string | null {
|
||||
const cached = cache.get(rootDir);
|
||||
if (cached) {
|
||||
return cached;
|
||||
}
|
||||
try {
|
||||
const resolved = fs.realpathSync(rootDir);
|
||||
cache.set(rootDir, resolved);
|
||||
return resolved;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export type PluginManifestRecord = {
|
||||
id: string;
|
||||
name?: string;
|
||||
|
||||
Reference in New Issue
Block a user