mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-03 04:11:36 +00:00
Channel plugins declare package env triggers in manifests, and ambient environment variables count as "channel configured". A dev gateway (gateway run --dev) inherits the operator's shell, so real channel credentials silently configured channels and could connect development instances to live services (observed with reef and a Telegram-range connection during isolated stress testing). Dev mode now drops presence signals whose only sources are env or manifest-env across activation planning, auto-enable, autostart, health recovery, readiness, reloads, and startup warnings. Explicit channels.<id> config still works, --dev-ambient-channels restores the old behavior, and startup logs the suppressed channel ids once. Non-dev gateways are unchanged.
44 lines
1.5 KiB
TypeScript
44 lines
1.5 KiB
TypeScript
// Detects plugin auto-enable candidates from config and discovery results.
|
|
import type { AmbientEnvTriggerPolicy } from "../channels/config-presence.js";
|
|
import type { PluginDiscoveryResult } from "../plugins/discovery.js";
|
|
import type { PluginManifestRegistry } from "../plugins/manifest-registry.js";
|
|
import {
|
|
resolveConfiguredPluginAutoEnableCandidates,
|
|
resolvePluginAutoEnableReadiness,
|
|
resolvePluginAutoEnableManifestRegistry,
|
|
} from "./plugin-auto-enable.shared.js";
|
|
import type { PluginAutoEnableCandidate } from "./plugin-auto-enable.types.js";
|
|
import type { OpenClawConfig } from "./types.openclaw.js";
|
|
|
|
/** Detects installed plugins that should become enabled from existing config usage. */
|
|
export function detectPluginAutoEnableCandidates(params: {
|
|
config?: OpenClawConfig;
|
|
env?: NodeJS.ProcessEnv;
|
|
manifestRegistry?: PluginManifestRegistry;
|
|
discovery?: PluginDiscoveryResult;
|
|
ambientEnvTriggers?: AmbientEnvTriggerPolicy;
|
|
}): PluginAutoEnableCandidate[] {
|
|
const env = params.env ?? process.env;
|
|
const config = params.config ?? ({} as OpenClawConfig);
|
|
const readiness = resolvePluginAutoEnableReadiness(
|
|
config,
|
|
env,
|
|
params.discovery,
|
|
params.ambientEnvTriggers,
|
|
);
|
|
if (!readiness.mayNeedAutoEnable) {
|
|
return [];
|
|
}
|
|
const registry = resolvePluginAutoEnableManifestRegistry({
|
|
config,
|
|
env,
|
|
manifestRegistry: params.manifestRegistry,
|
|
});
|
|
return resolveConfiguredPluginAutoEnableCandidates({
|
|
config,
|
|
env,
|
|
registry,
|
|
configuredChannelIds: readiness.configuredChannelIds,
|
|
});
|
|
}
|