CatoandClaude 0474c3a887 paykit 0.7.0: prepaid credit, top-ups, auto top-up and per-key limits (#31)
Pay as you go beside the subscriptions, the way OpenRouter charges:

- ./credits: append-only CreditLedger with idempotency keys and an
  in-memory ledger; balance, FIFO lots and debt; charge refused with 402
  below the app's floor or over a spending key's daily/weekly/monthly
  limit; hold then settle or release; top-up quotes with a fee per rail
  in integer arithmetic; refund eligibility (window, fee kept, rails that
  never refund); expiry of old lots; auto top-up decision with backoff
  and a failure cap; credit events applied idempotently; top-ups through
  any PaymentProvider (OrangeCat: sats, never refundable).
- ./stripe: stripeCredits — top-up Checkout Session (saves the method
  off-session when auto top-up is on), off-session PaymentIntent with an
  Idempotency-Key, refunds, and webhook mapping for
  checkout.session.completed, payment_intent.succeeded/payment_failed
  and charge.refunded. The pass provider ignores top-up sessions.
- ./react: CreditBalance, TopUp, AutoTopUp, CreditActivity; PickerTier
  gains optional rates for a pay-as-you-go tier.

No price, fee or threshold is built in; all are the app's config.


Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

Co-authored-by: Claude <noreply@anthropic.com>
2026-12-03 13:07:29 +01:00

bitbaum kits

The bitbaum packages, in one repository. Each package keeps its own name, version, changelog and history — only the address of the source moved.

Package Version at the move Folder
@bitbaum/accountkit 0.32.1 packages/accountkit
@bitbaum/adminkit new here, 0.1.0 packages/adminkit
@bitbaum/ai-kit 1.31.0 packages/ai-kit
@bitbaum/bip-kit 0.10.0 packages/bip-kit
@bitbaum/chartkit 0.8.0 packages/chartkit
@bitbaum/chatkit 0.45.0 packages/chatkit
@bitbaum/datakit new here, 0.1.0 packages/datakit
@bitbaum/design-tokens 1.7.1 packages/design-tokens
@bitbaum/geo-kit 0.8.0 packages/geo-kit
@bitbaum/langkit new here; first published as 0.2.0 packages/langkit
@bitbaum/limitkit 0.2.1 packages/limitkit
@bitbaum/listkit 0.2.2 packages/listkit
@bitbaum/mail-kit 0.4.0 packages/mail-kit
@bitbaum/paykit 0.3.0 packages/paykit
@bitbaum/searchkit 0.2.3 packages/searchkit
@bitbaum/sitekit 0.7.0 packages/sitekit
@bitbaum/speechkit 1.0.1 packages/speechkit
@bitbaum/threadkit 0.1.2 packages/threadkit
@bitbaum/whenkit 0.3.3 packages/whenkit
@bitbaum/writingkit 0.4.0 packages/writingkit

Working here

pnpm install                 # once, at the root — installs every package
pnpm verify                  # every package's own checks, one after another
pnpm verify:changed          # only packages changed since origin/main, and what depends on them
cd packages/chatkit && pnpm run verify   # one package

Packages that use each other are linked from source (workspace:^), so a change to chatkit is checked against writingkit in the same change. On release, pnpm writes the real version range in.

History: every package's full commit history was carried over (git log packages/<name>); old release tags are prefixed with the package name, e.g. chatkit-v0.45.0.

The browser checks (accountkit, adminkit, chartkit, chatkit, whenkit, writingkit) need Playwright's Chromium: pnpm --dir packages/chartkit exec playwright install chromium-headless-shell chromium.

Checks and releases

  • Every change is a pull request on GitHub (bitbaum/kits; Gitea keeps an automatic copy). The forge merge check (forge/verify) runs the root verify — every package's own checks — on the merge result, then merges.
  • A release is a merged version bump. Raise the package's version (and its CHANGELOG) in the pull request. After the merge, Gitea pushes main on to GitLab.com (a push mirror of its copy), and GitLab's .gitlab-ci.yml + scripts/ci-publish.sh publish every package whose version that push changed, through npm's trusted publishing: no npm login or token anywhere, no command to run, no laptop. GitLab is used for that one job because npm accepts only GitHub Actions (off for the org since 2026-11-15), GitLab.com and CircleCI as publishers. A version already on npm is skipped.
  • By hand, still: scripts/release.sh listkit patch raises the version, checks the package and its dependents, tags listkit-v0.2.3 and pushes the tag to GitHub and GitLab; the tag publishes that one package. Use it to publish a version that a merge did not change (one whose publish failed).
  • Every package is trusted (2026-11-21): all 17 published from GitLab once, which is what keeps a trust for good. Releasing never needs npm.
  • The one case that does: a brand-new package. npm only trusts a package that already exists, and a new trust expires unless it publishes within 2 days. So, once: publish the first version, then scripts/trust-gitlab.sh <folder> (one npm sign-in with the security key; tick "skip for 5 minutes" and several folders go through on one tap), then release with scripts/release.sh within 2 days. npm keeps one trust per package: the script replaces an older (GitHub) entry instead of failing. scripts/release.sh --pending lists versions not on npm yet.
S
Description
The bitbaum packages, in one repository (17 packages, full history).
Readme
10 MiB
0 Stars 2 Watchers 0 Forks
Languages
TypeScript 51.9%
JavaScript 40.1%
CSS 7.5%
HTML 0.3%
Shell 0.2%