forked from elizaOS/eliza
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauto-enable.ts
More file actions
24 lines (22 loc) · 835 Bytes
/
Copy pathauto-enable.ts
File metadata and controls
24 lines (22 loc) · 835 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
/**
* Import-free auto-enable predicate for the browser automation plugin.
*
* The plugin manifest references this module directly, so it only reads config
* and avoids transitive imports of the full browser runtime.
*/
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.browser` is truthy / not explicitly disabled. */
export function shouldEnable(ctx: PluginAutoEnableContext): boolean {
return isFeatureEnabled(ctx.config, "browser");
}