-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Expand file tree
/
Copy pathauto-enable.ts
More file actions
24 lines (22 loc) · 924 Bytes
/
auto-enable.ts
File metadata and controls
24 lines (22 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Auto-enable check for @elizaos/plugin-form.
//
// Plugin manifest entry-point — referenced by package.json's
// `elizaos.plugin.autoEnableModule`. Keep this module light: env reads only,
// no service init, no transitive imports of the full plugin runtime. The
// auto-enable engine loads dozens of these per boot.
import type { PluginAutoEnableContext } from "@elizaos/core";
function isFeatureEnabled(
config: PluginAutoEnableContext["config"],
key: string,
): boolean {
const f = (config?.features as Record<string, unknown> | undefined)?.[key];
if (f === true) return true;
if (f && typeof f === "object" && f !== null) {
return (f as Record<string, unknown>).enabled !== false;
}
return false;
}
/** Enable when `config.features.form` is truthy / not explicitly disabled. */
export function shouldEnable(ctx: PluginAutoEnableContext): boolean {
return isFeatureEnabled(ctx.config, "form");
}