rollingcap

package
v1.801.186 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: Apache-2.0 Imports: 9 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:

aiobject.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 clients/flags, and flags imports the root cloud package — the wiring must live above that edge.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Mount

func Mount(_ *zip.App, _ 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