Major Changes
-
a94c258: Introduce
@ai-sdk/policy-opa, an Open Policy Agent adapter for the
toolApprovalcallback ongenerateText/streamText/ToolLoopAgent.Everything is exported from the package root. The engine-neutral core is a
PolicyClientinterface,shadow()for safe policy rollout with
fire-and-forget telemetry, andwrapMcpTools()for making approval
configuration total over a discovered tool surface. The OPA layer ships
opaPolicy/optionalOpaPolicy(Rego-as-code authorization),
wasmPolicyClientandhttpPolicyClientbackends (lazy-loaded optional peer
deps),opaCapabilityMiddlewarefor fail-closed model-level tool filtering,
andnormalizeOpaDecisionfor users who call OPA themselves.Sits entirely on top of the public SDK surface, with no changes to
ai,
@ai-sdk/provider, or@ai-sdk/provider-utils. Transitive enforcement
(coarse dispatchers likebash/http.request/ MCP proxies) is handled
inside the user'stoolApprovalby parsing the dispatcher input and routing
to the same Rego rule that gates the direct tool.