Daniel Salazar bc456982e9 feat(metering): events for an actor's balance and for a refusal a listener can make good (#4643)
* feat(metering): report an actor's balance each time it is worked out

`metering.balance` carries what an actor on a metered plan has left to
spend and the plan it was worked out under. It is emitted when usage
settles and when a credit gate re-reads the balance, so an extension can
act on a low balance without reading it itself.

The balance a settling batch reports now counts the purchased credit
that batch drew, so the credit gate and the exhausted notice follow the
batch that spends the last of it instead of the one after. A batch that
settles right after a credits change still reports the credit as read,
since that read may predate the change.

`MeteringService.isUnmetered` is public, for callers that need to tell a
plan with nothing to run out of from one that has run out.

* feat(metering): let a listener top an actor up at the moment of refusal

`metering.out-of-credits` is emitted, and waited on, when an actor is
about to be refused for lack of credit. A listener that adds credit sets
`refilled`, and the refused work is tried once more instead of failing.

It is asked from the three places a refusal is decided: the credit gate
on routes, the shared credit reservation the AI drivers use, and the
chat driver's own gate. Each tries again once, after the listener
answers, and refuses as before when nothing was added.

* fix(metering): count a flush's write once in a read with no cached base

An increment for a counter with no cached base read the store after its
buffer snapshot with nothing ordering the two, so a flush landing in
between was counted from both, and that store read was then kept as the
base. It now reads the store the way other reads do, starting from the
increment's own snapshot.

A write that has reached the store but is not yet applied to the buffer
looks the same from the buffer as one still on its way. `kv.get` can now
answer with the last fence token a writer applied to a key, and a read
counts such a write's amounts from one side only. A read that sees a
write sent between its snapshots is retried.

A base is laid from a store read only if no write was out when it was
read and none has been sent since.
2026-11-14 12:43:02 -07:00
2026-07-28 14:52:13 -07:00
2026-09-25 21:48:15 -04:00
…
2026-09-25 21:48:15 -04:00

Puter.com, The Personal Cloud Computer: All your files, apps, and games in one place accessible from anywhere at any time.

The Open-Source Internet Computer!

« LIVE DEMO »

Puter.com · App Store · AI Builder · Developers · X

screenshot


Puter

Puter is an advanced, open-source, self-hostable internet computer designed to be feature-rich, fast, and highly extensible.

For Users

Puter's goal is to provide you with every app and feature you need to work, create, and play under one roof. From a simple Notepad and Voice Recorder to Spreadsheet and Camera, Puter wants to be the all-in-one solution for your digital life.

For Developers

Puter provides everything you need to build and publish web apps and games. From AI to Cloud Storage and Database to Serverless Workers, Puter has you covered. Puter also helps you get users! Once you build your app, you can publish it on our App Store to reach and monetize users.


Getting Started

💻 Local Development

git clone https://github.com/HeyPuter/puter
cd puter
npm install
npm start

→ This should launch Puter at http://puter.localhost:4100

To run this checkout with Docker, follow Building from source. Create a local docker-compose.override.yml to select the local build; keeping these settings out of docker-compose.yml avoids conflicts when pulling updates and keeps local configuration out of pull requests.


🚀 Self-Hosting

Linux/macOS

curl -fsSL https://puter.com/selfhost | sh

Windows

irm https://puter.com/selfhost?os=windows | iex

→ For more details, see Self-Hosting Puter.


☁️ Puter.com

Puter is available as a hosted service at puter.com.


Support

Connect with the maintainers and community through these channels:

We are always happy to help you with any questions you may have. Don't hesitate to ask!


License

This repository, including all its contents, sub-projects, modules, and components, is licensed under AGPL-3.0 unless explicitly stated otherwise. Third-party libraries included in this repository may be subject to their own licenses.


Translations

Languages
TypeScript 62.3%
JavaScript 34.9%
CSS 1.6%
HTML 1.1%