Files
plugins/packages/cloudflare-workers-ai/package.json
T
skygunner 214530edad cloudflare-workers-ai: read actual Neurons and keep the quota card toggles
Workers AI usage now reads the day's actual Neurons from Cloudflare's GraphQL analytics, keeps the Used/Left toggle on the quota card, and stops the included free allowance from benching a Paid or unknown plan (`aside`). A 429 with code 3036 gets a Retry-After that runs to the next UTC midnight. Version 0.0.4; dist has 0.0.3, and npm has never had the package.

What was run, at reviewed head 38ddeb132ee6c00698952303fbc4949a84287779:
- `bun test packages/cloudflare-workers-ai` with a sandbox HOME/TMPDIR: 23/23 pass.
- `bun scripts/check.mjs`: ok.
- Merged with origin/main, the whole repo `bun test` with a sandbox HOME: 2900 pass, 3 skip, 0 fail across 245 files.
- Broke code and timing by hand:
  - Removing the `!info.errors?.length` guard turns only the new partial-reply assertion red.
  - A preload that moves Date.now() 700ms forward on every call fails the old (bdc302a) Retry-After test ("26820 vs ~26819"). The new bracketed test passes 3 of 3 under that preload.
- The earlier review at bdc302a covered the rest of the change. That includes nine mutations, each of which turns a test red.

Not tried:
- A real Paid account's billing and inference, as the author says too.
- A fetch call that straddles exactly 00:00:00 UTC. The Retry-After bracket would fail there, but only inside a window a few milliseconds long.
2026-10-28 00:34:58 +08:00

43 lines
961 B
JSON

{
"name": "@magpie-community/opencode-cloudflare-workers-ai-auth",
"version": "0.0.4",
"private": false,
"type": "module",
"main": "./index.mjs",
"description": "Cloudflare Workers AI provider plugin for Magpie with template URL and auto model discovery from models.dev",
"keywords": [
"opencode",
"opencode-plugin",
"magpie",
"cloudflare",
"workers-ai",
"provider",
"template"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/magpie-community/plugins.git",
"directory": "packages/cloudflare-workers-ai"
},
"files": [
"index.mjs",
"src/",
"README.md",
"README.zh-CN.md",
"README.ja.md",
"LICENSE"
],
"scripts": {
"test": "node --test",
"check": "node --check index.mjs && node --test"
},
"engines": {
"node": ">=20"
},
"magpie": {
"maxConcurrency": 3,
"icon": "https://www.cloudflare.com/favicon.ico"
}
}