mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 10:30:44 +00:00
fix: reuse plugin snapshot for agent metadata
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
||||
import { getCurrentPluginMetadataSnapshot } from "../plugins/current-plugin-metadata-snapshot.js";
|
||||
import type { PluginManifestRecord } from "../plugins/manifest-registry.js";
|
||||
import {
|
||||
isWorkspacePluginAllowedByConfig,
|
||||
@@ -118,11 +119,23 @@ export function resolveProviderAuthAliasMap(
|
||||
if (cached) {
|
||||
return cached;
|
||||
}
|
||||
const snapshot = loadPluginMetadataSnapshot({
|
||||
config: params?.config ?? {},
|
||||
workspaceDir: params?.workspaceDir,
|
||||
env,
|
||||
});
|
||||
const config = params?.config ?? {};
|
||||
const snapshot =
|
||||
params?.workspaceDir !== undefined
|
||||
? (getCurrentPluginMetadataSnapshot({
|
||||
config,
|
||||
workspaceDir: params.workspaceDir,
|
||||
env,
|
||||
}) ??
|
||||
loadPluginMetadataSnapshot({
|
||||
config,
|
||||
workspaceDir: params.workspaceDir,
|
||||
env,
|
||||
}))
|
||||
: loadPluginMetadataSnapshot({
|
||||
config,
|
||||
env,
|
||||
});
|
||||
const preferredAliases = new Map<string, ProviderAuthAliasCandidate>();
|
||||
const aliases: Record<string, string> = Object.create(null) as Record<string, string>;
|
||||
for (const plugin of snapshot.plugins) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
resolveEffectivePluginActivationState,
|
||||
resolveMemorySlotDecision,
|
||||
} from "../../plugins/config-policy.js";
|
||||
import { getCurrentPluginMetadataSnapshot } from "../../plugins/current-plugin-metadata-snapshot.js";
|
||||
import { loadPluginMetadataSnapshot } from "../../plugins/plugin-metadata-snapshot.js";
|
||||
import { hasKind } from "../../plugins/slots.js";
|
||||
import { isPathInsideWithRealpath } from "../../security/scan-paths.js";
|
||||
@@ -28,11 +29,18 @@ export function resolvePluginSkillDirs(params: {
|
||||
if (!workspaceDir) {
|
||||
return [];
|
||||
}
|
||||
const metadataSnapshot = loadPluginMetadataSnapshot({
|
||||
workspaceDir,
|
||||
config: params.config ?? {},
|
||||
env: process.env,
|
||||
});
|
||||
const config = params.config ?? {};
|
||||
const metadataSnapshot =
|
||||
getCurrentPluginMetadataSnapshot({
|
||||
config,
|
||||
env: process.env,
|
||||
workspaceDir,
|
||||
}) ??
|
||||
loadPluginMetadataSnapshot({
|
||||
workspaceDir,
|
||||
config,
|
||||
env: process.env,
|
||||
});
|
||||
const registry = metadataSnapshot.manifestRegistry;
|
||||
if (registry.plugins.length === 0) {
|
||||
publishPluginSkills([], {
|
||||
@@ -41,10 +49,10 @@ export function resolvePluginSkillDirs(params: {
|
||||
return [];
|
||||
}
|
||||
const normalizedPlugins = normalizePluginsConfigWithResolver(
|
||||
params.config?.plugins,
|
||||
config.plugins,
|
||||
metadataSnapshot.normalizePluginId,
|
||||
);
|
||||
const acpRuntimeAvailable = isAcpRuntimeSpawnAvailable({ config: params.config });
|
||||
const acpRuntimeAvailable = isAcpRuntimeSpawnAvailable({ config });
|
||||
const memorySlot = normalizedPlugins.slots.memory;
|
||||
let selectedMemoryPluginId: string | null = null;
|
||||
const seen = new Set<string>();
|
||||
@@ -58,7 +66,7 @@ export function resolvePluginSkillDirs(params: {
|
||||
id: record.id,
|
||||
origin: record.origin,
|
||||
config: normalizedPlugins,
|
||||
rootConfig: params.config,
|
||||
rootConfig: config,
|
||||
enabledByDefault: record.enabledByDefault,
|
||||
});
|
||||
if (!activationState.activated) {
|
||||
|
||||
Reference in New Issue
Block a user