refactor: hide plugin helper internals

This commit is contained in:
Peter Steinberger
2026-05-02 07:04:52 +01:00
parent 9008fa445d
commit dc848c94b8
10 changed files with 13 additions and 13 deletions

View File

@@ -30,7 +30,7 @@ function readRecordMap(value: unknown): Record<string, PluginInstallRecord> | nu
return records;
}
export function extractPluginInstallRecordsFromPersistedInstalledPluginIndex(
function extractPluginInstallRecordsFromPersistedInstalledPluginIndex(
index: unknown,
): Record<string, PluginInstallRecord> | null {
if (!isRecord(index) || !Array.isArray(index.plugins)) {

View File

@@ -28,14 +28,14 @@ function runtimeExtensionsLengthMismatchMessage(params: {
);
}
export function normalizePackageManifestStringList(value: unknown): string[] {
function normalizePackageManifestStringList(value: unknown): string[] {
if (!Array.isArray(value)) {
return [];
}
return value.map((entry) => normalizeOptionalString(entry) ?? "").filter(Boolean);
}
export function resolvePackageRuntimeExtensionEntries(params: {
function resolvePackageRuntimeExtensionEntries(params: {
manifest: PackageManifest | null | undefined;
extensions: readonly string[];
}): RuntimeExtensionsResolution {

View File

@@ -80,6 +80,6 @@ export function resolvePluginControlPlaneFingerprint(
return fingerprintPluginControlPlaneContext(resolvePluginControlPlaneContext(params));
}
export function fingerprintPluginControlPlaneContext(context: PluginControlPlaneContext): string {
function fingerprintPluginControlPlaneContext(context: PluginControlPlaneContext): string {
return hashJson(context);
}

View File

@@ -87,7 +87,7 @@ function freezeOwnerMap(owners: Map<string, string[]>): ReadonlyMap<string, read
);
}
export function buildPluginMetadataOwnerMaps(
function buildPluginMetadataOwnerMaps(
plugins: readonly PluginManifestRecord[],
): PluginMetadataSnapshotOwnerMaps {
const channels = new Map<string, string[]>();

View File

@@ -68,7 +68,7 @@ function sanitizeConfigPatchValue(value: unknown): unknown {
return next;
}
export function mergeConfigPatch<T>(base: T, patch: unknown): T {
function mergeConfigPatch<T>(base: T, patch: unknown): T {
if (!isPlainRecord(base) || !isPlainRecord(patch)) {
return sanitizeConfigPatchValue(patch) as T;
}

View File

@@ -2,10 +2,10 @@ import { normalizeProviderId } from "../agents/provider-id.js";
import { normalizeLowercaseStringOrEmpty } from "../shared/string-coerce.js";
export const ANTHROPIC_SETUP_TOKEN_PREFIX = "sk-ant-oat01-";
export const ANTHROPIC_SETUP_TOKEN_MIN_LENGTH = 80;
export const DEFAULT_TOKEN_PROFILE_NAME = "default";
const ANTHROPIC_SETUP_TOKEN_MIN_LENGTH = 80;
const DEFAULT_TOKEN_PROFILE_NAME = "default";
export function normalizeTokenProfileName(raw: string): string {
function normalizeTokenProfileName(raw: string): string {
const trimmed = raw.trim();
if (!trimmed) {
return DEFAULT_TOKEN_PROFILE_NAME;

View File

@@ -1,7 +1,7 @@
import type { AgentModelListConfig } from "../config/types.js";
import type { OpenClawConfig } from "../config/types.openclaw.js";
export function resolvePrimaryModel(model?: AgentModelListConfig | string): string | undefined {
function resolvePrimaryModel(model?: AgentModelListConfig | string): string | undefined {
if (typeof model === "string") {
return model;
}

View File

@@ -15,7 +15,7 @@ import type {
ProviderPluginWizardSetup,
} from "./types.js";
export const PROVIDER_PLUGIN_CHOICE_PREFIX = "provider-plugin:";
const PROVIDER_PLUGIN_CHOICE_PREFIX = "provider-plugin:";
export type ProviderWizardOption = {
value: string;

View File

@@ -6,7 +6,7 @@ import {
import { logWarn } from "../../logger.js";
import type { PluginRuntime } from "./types.js";
export const RUNTIME_CONFIG_LOAD_WRITE_COMPAT_CODE = "runtime-config-load-write";
const RUNTIME_CONFIG_LOAD_WRITE_COMPAT_CODE = "runtime-config-load-write";
const warnedDeprecatedConfigApis = new Set<string>();

View File

@@ -66,7 +66,7 @@ export function createEmptyUninstallActions(
};
}
export function createEmptyConfigUninstallActions(): Omit<UninstallActions, "directory"> {
function createEmptyConfigUninstallActions(): Omit<UninstallActions, "directory"> {
const { directory: _directory, ...actions } = createEmptyUninstallActions();
return actions;
}