@orqo/foundationmodels-policy
v2.0.0
Published
Policy engine and PII redaction for Apple Foundation Models TypeScript runtime.
Maintainers
Readme
@orqo/foundationmodels-policy
Policy engine and PII redaction for Apple Foundation Models TypeScript runtime.
Install
pnpm add @orqo/foundationmodels-policyUsage
Policy engine
import { createPolicyEngine } from "@orqo/foundationmodels-policy";
const engine = createPolicyEngine({
denyByDefault: false,
blockedCapabilities: ["files.delete"],
requireApprovalFor: {
risk: ["high", "critical"],
sideEffects: ["chargesMoney", "deletesData"],
},
});
const decision = await engine.check({
action: { capability: "web.search" },
tools: [{ id: "web.search", risk: "low", sideEffects: {} }],
});
if (decision.allowed) {
// proceed
} else if (decision.requiresApproval) {
// pause for human approval
}PII redaction
import { redact } from "@orqo/foundationmodels-policy";
// Masks API keys (sk-...), emails, and CPFs.
const safe = redact("Contact me at [email protected] or use key sk-abc123xyz456");
// "Contact me at [REDACTED] or use key [REDACTED]"Redaction is opt-in. The runtime does not apply it automatically — call redact() before passing sensitive text to respond()/classify() when needed. Configure automatic redaction via createFoundationModels({ security: { redaction: { mode: "auto" } } }) in @orqo/foundationmodels.
This package is a dependency of @orqo/foundationmodels, which re-exports its public API.
Author
Cristiano Aredes — sole author and maintainer.
- GitHub: @cristianoaredes
- X: @CristianoAredes
- LinkedIn: Cristiano Aredes
Part of FoundationModels JS.
License
AGPL-3.0-only — see LICENSE. Copyright © 2026 Cristiano Aredes.
Network clause (AGPL §13): modified versions offered as a network service must provide Corresponding Source to users of that service.
