Skip to content

Commit 1c9a8d9

Browse files
authored
Merge d6b8f46 into 9b97e1e
2 parents 9b97e1e + d6b8f46 commit 1c9a8d9

4 files changed

Lines changed: 21 additions & 15 deletions

File tree

src/plugins/bundled-capability-runtime.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
} from "./bundled-compat.js";
99
import { resolveBundledPluginRepoEntryPath } from "./bundled-plugin-metadata.js";
1010
import { createCapturedPluginRegistration } from "./captured-registration.js";
11-
import { discoverOpenClawPlugins } from "./discovery.js";
11+
import { discoverOpenClawPlugins, type PluginDiscoveryResult } from "./discovery.js";
1212
import type { PluginLoadOptions } from "./loader.js";
1313
import { loadPluginManifestRegistry } from "./manifest-registry.js";
1414
import { unwrapDefaultModuleExport } from "./module-export.js";
@@ -196,6 +196,7 @@ export function loadBundledCapabilityRuntimeRegistry(params: {
196196
pluginIds: readonly string[];
197197
env?: PluginLoadOptions["env"];
198198
pluginSdkResolution?: PluginSdkResolutionPreference;
199+
discovery?: PluginDiscoveryResult;
199200
}) {
200201
const env = params.env ?? process.env;
201202
const pluginIds = new Set(params.pluginIds);
@@ -232,9 +233,7 @@ export function loadBundledCapabilityRuntimeRegistry(params: {
232233
});
233234
};
234235

235-
const discovery = discoverOpenClawPlugins({
236-
env,
237-
});
236+
const discovery = params.discovery ?? discoverOpenClawPlugins({ env });
238237
const manifestRegistry = loadPluginManifestRegistry({
239238
config: buildBundledCapabilityRuntimeConfig(params.pluginIds, env),
240239
env,

src/plugins/bundled-sources.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { normalizeOptionalString } from "../shared/string-coerce.js";
2-
import { discoverOpenClawPlugins } from "./discovery.js";
2+
import { discoverOpenClawPlugins, type PluginDiscoveryResult } from "./discovery.js";
33
import { loadPluginManifest } from "./manifest.js";
44

55
export type BundledPluginSource = {
@@ -38,11 +38,11 @@ export function resolveBundledPluginSources(params: {
3838
workspaceDir?: string;
3939
/** Use an explicit env when bundled roots should resolve independently from process.env. */
4040
env?: NodeJS.ProcessEnv;
41+
discovery?: PluginDiscoveryResult;
4142
}): Map<string, BundledPluginSource> {
42-
const discovery = discoverOpenClawPlugins({
43-
workspaceDir: params.workspaceDir,
44-
env: params.env,
45-
});
43+
const discovery =
44+
params.discovery ??
45+
discoverOpenClawPlugins({ workspaceDir: params.workspaceDir, env: params.env });
4646
const bundled = new Map<string, BundledPluginSource>();
4747

4848
for (const candidate of discovery.candidates) {

src/plugins/channel-catalog-registry.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { PluginInstallRecord } from "../config/types.plugins.js";
2-
import { discoverOpenClawPlugins } from "./discovery.js";
2+
import { discoverOpenClawPlugins, type PluginDiscoveryResult } from "./discovery.js";
33
import { shouldRejectHardlinkedPluginFiles } from "./hardlink-policy.js";
44
import { loadInstalledPluginIndexInstallRecordsSync } from "./installed-plugin-index-record-reader.js";
55
import {
@@ -31,14 +31,18 @@ export function listChannelCatalogEntries(
3131
* Bundled-only callers skip the load to avoid the disk read.
3232
*/
3333
installRecords?: Record<string, PluginInstallRecord>;
34+
discovery?: PluginDiscoveryResult;
3435
} = {},
3536
): PluginChannelCatalogEntry[] {
3637
const installRecords = resolveInstallRecords(params);
37-
return discoverOpenClawPlugins({
38-
workspaceDir: params.workspaceDir,
39-
env: params.env,
40-
...(installRecords && Object.keys(installRecords).length > 0 ? { installRecords } : {}),
41-
}).candidates.flatMap((candidate) => {
38+
const discovery =
39+
params.discovery ??
40+
discoverOpenClawPlugins({
41+
workspaceDir: params.workspaceDir,
42+
env: params.env,
43+
...(installRecords && Object.keys(installRecords).length > 0 ? { installRecords } : {}),
44+
});
45+
return discovery.candidates.flatMap((candidate) => {
4246
if (params.origin && candidate.origin !== params.origin) {
4347
return [];
4448
}

src/plugins/contracts/registry.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { normalizeProviderId } from "../../agents/provider-id.js";
22
import { normalizeLowercaseStringOrEmpty } from "../../shared/string-coerce.js";
33
import { loadBundledCapabilityRuntimeRegistry } from "../bundled-capability-runtime.js";
4+
import { discoverOpenClawPlugins } from "../discovery.js";
45
import { loadPluginManifestRegistry } from "../manifest-registry.js";
56
import { resolveManifestContractPluginIds } from "../plugin-registry.js";
67
import { resolveBundledExplicitProviderContractsFromPublicArtifacts } from "../provider-contract-public-artifacts.js";
@@ -255,12 +256,14 @@ function loadScopedCapabilityRuntimeRegistryEntries<T>(params: {
255256
plugin: BundledCapabilityRuntimeRegistry["plugins"][number],
256257
) => readonly string[];
257258
}): T[] {
259+
const discovery = discoverOpenClawPlugins({});
258260
let lastFailure: Error | undefined;
259261

260262
for (let attempt = 0; attempt < 2; attempt += 1) {
261263
const registry = loadBundledCapabilityRuntimeRegistry({
262264
pluginIds: [params.pluginId],
263265
pluginSdkResolution: "dist",
266+
discovery,
264267
});
265268
const entries = params.loadEntries(registry);
266269
if (entries.length > 0) {

0 commit comments

Comments
 (0)