mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 10:30:44 +00:00
refactor: hide plugin helper internals
This commit is contained in:
@@ -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)) {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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[]>();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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>();
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user