Delegate gating to a pluggable, possibly-async classifier (e.g. a
moderation model or an external safety API). Streaming calls classify
only once accumulated text since the last call has grown by
evaluateEveryChars (a classifiedUpTo:${channel} cursor in
streamState, per-channel); the object channel classifies every snapshot,
since it is a replaced snapshot rather than append-only text. Input and
result phases have no streamState and therefore always classify — the
result phase is the authoritative gate, so a stream whose tail never
crossed the cadence still gets classified there.
A timeoutMs classify call that does not settle in time THROWS (the
PolicyEngine's evaluator-crash path audits it and fails closed — aborting
in-stream, rethrowing at input/result); fail-open is deliberately not
offered. Omit timeoutMs to let classify run unbounded.
The returned evaluator carries no holdBackChars hint (engine default:
0) — an async classifier has no bounded straddle window to report, unlike
a fixed pattern length. A caller wanting this policy to participate in
zero-leak hold-back must accept buffering the ENTIRE channel until stream
end, and opt in explicitly: { ...classifierPolicy(options), holdBackChars: Infinity }.
Delegate gating to a pluggable, possibly-async classifier (e.g. a moderation model or an external safety API). Streaming calls
classifyonly once accumulated text since the last call has grown byevaluateEveryChars(aclassifiedUpTo:${channel}cursor instreamState, per-channel); the object channel classifies every snapshot, since it is a replaced snapshot rather than append-only text. Input and result phases have nostreamStateand therefore always classify — the result phase is the authoritative gate, so a stream whose tail never crossed the cadence still gets classified there.A
timeoutMsclassify call that does not settle in time THROWS (the PolicyEngine's evaluator-crash path audits it and fails closed — aborting in-stream, rethrowing at input/result); fail-open is deliberately not offered. OmittimeoutMsto letclassifyrun unbounded.The returned evaluator carries no
holdBackCharshint (engine default: 0) — an async classifier has no bounded straddle window to report, unlike a fixed pattern length. A caller wanting this policy to participate in zero-leak hold-back must accept buffering the ENTIRE channel until stream end, and opt in explicitly:{ ...classifierPolicy(options), holdBackChars: Infinity }.