|
1 | 1 | import type { OpenClawConfig } from "../../config/types.openclaw.js"; |
2 | 2 | import { isBlockedObjectKey } from "../../infra/prototype-keys.js"; |
| 3 | +import { getCurrentPluginMetadataSnapshot } from "../../plugins/current-plugin-metadata-snapshot.js"; |
3 | 4 | import { isInstalledPluginEnabled } from "../../plugins/installed-plugin-index.js"; |
4 | 5 | import type { PluginManifestRecord } from "../../plugins/manifest-registry.js"; |
5 | 6 | import { loadPluginMetadataSnapshot } from "../../plugins/plugin-metadata-snapshot.js"; |
@@ -64,17 +65,28 @@ export function resolveReadOnlyChannelCommandDefaults(
|
64 | 65 | if (!normalizedChannelId || !isSafeManifestChannelId(normalizedChannelId)) { |
65 | 66 | return undefined; |
66 | 67 | } |
67 | | -const snapshot = loadPluginMetadataSnapshot({ |
68 | | -config: options.config, |
69 | | -stateDir: options.stateDir, |
70 | | -workspaceDir: options.workspaceDir, |
71 | | -env: options.env ?? process.env, |
72 | | -}); |
73 | | -for (const record of snapshot.plugins) { |
| 68 | +const env = options.env ?? process.env; |
| 69 | +const snapshot = |
| 70 | +options.stateDir === undefined |
| 71 | + ? getCurrentPluginMetadataSnapshot({ |
| 72 | +config: options.config, |
| 73 | + env, |
| 74 | +workspaceDir: options.workspaceDir, |
| 75 | +}) |
| 76 | + : undefined; |
| 77 | +const resolvedSnapshot = |
| 78 | +snapshot ?? |
| 79 | +loadPluginMetadataSnapshot({ |
| 80 | +config: options.config, |
| 81 | +stateDir: options.stateDir, |
| 82 | +workspaceDir: options.workspaceDir, |
| 83 | + env, |
| 84 | +}); |
| 85 | +for (const record of resolvedSnapshot.plugins) { |
74 | 86 | if (!record.channels.includes(normalizedChannelId)) { |
75 | 87 | continue; |
76 | 88 | } |
77 | | -if (!isInstalledPluginEnabled(snapshot.index, record.id, options.config)) { |
| 89 | +if (!isInstalledPluginEnabled(resolvedSnapshot.index, record.id, options.config)) { |
78 | 90 | continue; |
79 | 91 | } |
80 | 92 | const channelConfigValue = record.channelConfigs |
|