Download policies/_lib/profile.mjs from failproofai/fire-runtime-policy-reliability: direct link, hf CLI and curl.
- Browser
- Download file 712 Bytes
-
https://huggingface.co/datasets/failproofai/fire-runtime-policy-reliability/resolve/main/policies/_lib/profile.mjs
- Command line
-
hf download hf://datasets/failproofai/fire-runtime-policy-reliability/policies/_lib/profile.mjs
-
curl -L -o profile.mjs https://huggingface.co/datasets/failproofai/fire-runtime-policy-reliability/resolve/main/policies/_lib/profile.mjs
712 Bytes
| import { readFileSync } from "node:fs"; | |
| let cached; | |
| export function policyProfile() { | |
| if (cached) return cached; | |
| const name = process.env.FAILPROOF_PROFILE; | |
| const path = process.env.FAILPROOF_PROFILE_CONFIG; | |
| if (!name || !path) { | |
| throw new Error("policy profile environment is missing"); | |
| } | |
| const doc = JSON.parse(readFileSync(path, "utf8")); | |
| const values = doc?.profiles?.[name]; | |
| if (!values) throw new Error(`unknown policy profile: ${name}`); | |
| cached = Object.freeze({ name, ...values }); | |
| return cached; | |
| } | |
| export function profileNudgeLimit(key, fallback = 1) { | |
| const value = policyProfile()?.nudge_limits?.[key]; | |
| return Number.isInteger(value) && value >= 0 ? value : fallback; | |
| } | |