@lineai/billing-policy-types
v0.1.0
Published
Shared TypeScript types for the Line AI spend-safety gate (gate keys, result shapes, blocked reasons)
Maintainers
Readme
@lineai/billing-policy-types
Shared TypeScript contract for the Line AI spend-safety gate.
This package is types only — no values, no thresholds, no runtime logic.
The gate logic itself, and the per-action configuration map, lives privately
inside service-api (the chokepoint where every launch path converges before
dispatch).
What's here
GateKey— the closed union of gatedservice:actionidentifiers.GateBlockedReason— the closed union of denial reasons (suspended, no-payment-method, insufficient-credit).GateResult— the discriminated union returned by a gate evaluation, with diagnostic fields for UI rendering.GateRequest— optional cost-aware metadata callers can supply.isBlocked— narrowing type guard.
Consumers
service-api— emits theGateResultas a402 Payment Requiredbody when a gated action is denied.@lineai/line-ai— imports the types to render the structured error (toasts, billing prompts) without referencing private threshold values.
Build
pnpm install
pnpm run build