rollingcap

package
v1.801.384 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package rollingcap installs the ai gate's rolling-window AI-spend cap — the Anthropic-style burst limit that resets continuously (usage older than the window drops out of the trailing sum, so there is no fixed reset boundary).

It composes three co-resident GLOBALS and owns no state of its own:

cloud.TierReader()     — the caller's commerce plan tier   (installed by wireTierReader)
finance.Current()      — the per-org ledger's windowed sum  (installed by wireFinance)
flags.Int(key)         — the admin-editable per-tier caps    (the platform-switch registry)

The two knobs are platform switches, so admin.hanzo.ai renders and edits them live through the existing /v1/admin/flags cockpit — this package adds NO bespoke admin UI. Mounting registers no routes; it only installs the hook. It sits in its own package (not the root cloud package) because it imports apps/flags, and flags imports the root cloud package — the wiring must live above that edge.

It is therefore CO-RESIDENT-ONLY. Both globals it composes are published in the host process, so a rollingcap loaded as its own plugin process reads nil for both, installs nothing, and serves no route — the cap only exists where the ai gate does.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Mount

func Mount(_ cloud.Router, _ cloud.Deps) error

Mount installs the rolling-cap reader. It registers no routes — the platform switches (registered in init) surface in the admin cockpit on their own. No-op when the tier or finance layer is not co-resident (standalone / split deploy): ai's hook stays nil, behavior unchanged. Runs after MountAll's prerequisites — wireTierReader + wireFinance have already installed the globals it reads.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL