mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 11:00:42 +00:00
fix: reuse plugin snapshot for read-only channels
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { OpenClawConfig } from "../../config/types.openclaw.js";
|
||||
import { isBlockedObjectKey } from "../../infra/prototype-keys.js";
|
||||
import { getCurrentPluginMetadataSnapshot } from "../../plugins/current-plugin-metadata-snapshot.js";
|
||||
import { isInstalledPluginEnabled } from "../../plugins/installed-plugin-index.js";
|
||||
import type { PluginManifestRecord } from "../../plugins/manifest-registry.js";
|
||||
import { loadPluginMetadataSnapshot } from "../../plugins/plugin-metadata-snapshot.js";
|
||||
@@ -64,17 +65,28 @@ export function resolveReadOnlyChannelCommandDefaults(
|
||||
if (!normalizedChannelId || !isSafeManifestChannelId(normalizedChannelId)) {
|
||||
return undefined;
|
||||
}
|
||||
const snapshot = loadPluginMetadataSnapshot({
|
||||
config: options.config,
|
||||
stateDir: options.stateDir,
|
||||
workspaceDir: options.workspaceDir,
|
||||
env: options.env ?? process.env,
|
||||
});
|
||||
for (const record of snapshot.plugins) {
|
||||
const env = options.env ?? process.env;
|
||||
const snapshot =
|
||||
options.stateDir === undefined
|
||||
? getCurrentPluginMetadataSnapshot({
|
||||
config: options.config,
|
||||
env,
|
||||
workspaceDir: options.workspaceDir,
|
||||
})
|
||||
: undefined;
|
||||
const resolvedSnapshot =
|
||||
snapshot ??
|
||||
loadPluginMetadataSnapshot({
|
||||
config: options.config,
|
||||
stateDir: options.stateDir,
|
||||
workspaceDir: options.workspaceDir,
|
||||
env,
|
||||
});
|
||||
for (const record of resolvedSnapshot.plugins) {
|
||||
if (!record.channels.includes(normalizedChannelId)) {
|
||||
continue;
|
||||
}
|
||||
if (!isInstalledPluginEnabled(snapshot.index, record.id, options.config)) {
|
||||
if (!isInstalledPluginEnabled(resolvedSnapshot.index, record.id, options.config)) {
|
||||
continue;
|
||||
}
|
||||
const channelConfigValue = record.channelConfigs
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
listConfiguredChannelIdsForReadOnlyScope,
|
||||
resolveDiscoverableScopedChannelPluginIds,
|
||||
} from "../../plugins/channel-plugin-ids.js";
|
||||
import { getCurrentPluginMetadataSnapshot } from "../../plugins/current-plugin-metadata-snapshot.js";
|
||||
import {
|
||||
channelPluginIdBelongsToManifest,
|
||||
resolveSetupChannelRegistration,
|
||||
@@ -697,12 +698,22 @@ export function resolveReadOnlyChannelPluginsForConfig(
|
||||
): ReadOnlyChannelPluginResolution {
|
||||
const env = options.env ?? process.env;
|
||||
const workspaceDir = resolveReadOnlyWorkspaceDir(cfg, options);
|
||||
const manifestRecords = loadPluginMetadataSnapshot({
|
||||
config: cfg,
|
||||
stateDir: options.stateDir,
|
||||
workspaceDir,
|
||||
env,
|
||||
}).plugins;
|
||||
const metadataSnapshot =
|
||||
options.stateDir === undefined
|
||||
? getCurrentPluginMetadataSnapshot({
|
||||
config: cfg,
|
||||
env,
|
||||
workspaceDir,
|
||||
})
|
||||
: undefined;
|
||||
const manifestRecords =
|
||||
metadataSnapshot?.plugins ??
|
||||
loadPluginMetadataSnapshot({
|
||||
config: cfg,
|
||||
stateDir: options.stateDir,
|
||||
workspaceDir,
|
||||
env,
|
||||
}).plugins;
|
||||
const bundledManifestRecords = listBundledChannelManifestRecords(manifestRecords);
|
||||
const externalManifestRecords = listExternalChannelManifestRecords(manifestRecords);
|
||||
const configuredChannelIds = [
|
||||
|
||||
Reference in New Issue
Block a user