@limitry/cli 1.0.0-rc.6 → 1.0.0-rc.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +98 -0
- package/README.md +4 -4
- package/dist/limitry.mjs +304 -395
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,104 @@
|
|
|
2
2
|
|
|
3
3
|
What changed in the Limitry CLI (`@limitry/cli`). Generated from the source on each release; newest first.
|
|
4
4
|
|
|
5
|
+
## 1.0.0-rc.8 (2026-10-21)
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Limits have `counting`: `fast` answers the instant it decides, and
|
|
10
|
+
`guaranteed` stores every count safely before answering, so the limit
|
|
11
|
+
never goes over, even if a server fails. A `total` balance defaults to
|
|
12
|
+
`guaranteed`, every other window to `fast`. Set it when creating or
|
|
13
|
+
updating a limit (`counting`, `--counting`), or in `limitry.json`.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- - Creating a limit needs only who it is for, the amount and the window:
|
|
18
|
+
`limits.create({ subject: { kind: "user" }, amount: 100, window: "month" })`
|
|
19
|
+
(`limitry limits create --subject '{"kind":"user"}' --amount 100 --window month`).
|
|
20
|
+
`action` defaults to every action (`*`), `unit` to `units`, and `name`
|
|
21
|
+
to the sentence the limit reads as, such as "100 units per user per
|
|
22
|
+
month". If a limit already has that name, the API answers `409`: give
|
|
23
|
+
this one a `name`. `limitry.json` entries still need a `name`.
|
|
24
|
+
- A limit's input names who it is for as `subject: { kind, id }` (was
|
|
25
|
+
`subjectKind` and `subjectId`), the same shape the limit itself has.
|
|
26
|
+
- What a limit counts is fixed once it is created: its subject, action,
|
|
27
|
+
unit, window, `every`, `start` and `rolling`. Changing one answers
|
|
28
|
+
`400 invalid_request`: create a new limit and archive the old one (its
|
|
29
|
+
history stays). Name, amount, fail mode and enabled still change any
|
|
30
|
+
time. `limitry sync` refuses such a change until you rename the entry.
|
|
31
|
+
- A limit says when a check last reached it (`lastCheckedAt`), so you can
|
|
32
|
+
see a limit no check names.
|
|
33
|
+
- One name for each idea, everywhere: the API, both SDKs, the CLI, the MCP
|
|
34
|
+
tools, `limitry.json` and webhooks. Update your code when you upgrade:
|
|
35
|
+
|
|
36
|
+
- `hold()` is `reserve()`: it takes `cost` (was `estimate`), and the block
|
|
37
|
+
gets a `Reservation` (was `Held`; Python `Reservation` and
|
|
38
|
+
`AsyncReservation`), with the same `cost()` and `extend()`.
|
|
39
|
+
- A refusal throws `LimitReached` (was `LimitExceeded`), with `limitId`
|
|
40
|
+
(Python `limit_id`) and `reason` `limit_reached` or
|
|
41
|
+
`too_many_reservations`. When Limitry can't be reached and a limit fails
|
|
42
|
+
closed, you now get a separate `Unavailable` error. "Can't be reached"
|
|
43
|
+
also covers a `402 plan_limit_reached` and a `429` from Limitry's flood
|
|
44
|
+
guard, so each limit's fail mode decides instead of your code getting an
|
|
45
|
+
error.
|
|
46
|
+
- A check's answer lists its limits in `limits` (was `remaining`): read
|
|
47
|
+
`decision.limits[0].remaining`. Every answer that names a limit says
|
|
48
|
+
`limitId`: `reason.limitId`, `limits[].limitId`, `usage.standing`'s
|
|
49
|
+
`limits[].limitId`, and webhook payloads.
|
|
50
|
+
- The refusal code is `limit_reached` (was `limit_exceeded`), and the
|
|
51
|
+
webhook event is `limit.reached` (was `limit.exceeded`): subscribe your
|
|
52
|
+
endpoints to the new name.
|
|
53
|
+
- Usage says `refused` (was `denied`); `usage.subjects` no longer has
|
|
54
|
+
`over` (it is `refused > 0`).
|
|
55
|
+
- Credits: `limits.credits.create()` and `limits.credits.list()` at
|
|
56
|
+
`/v1/limits/{limitId}/credits` (were `limits.grants.*` at `…/grants`),
|
|
57
|
+
ids start `crd_` (were `grt_`), and the approval an agent asks for is
|
|
58
|
+
`limit.credit` (was `limit.grant`).
|
|
59
|
+
- A period that starts on the subject's billing date is
|
|
60
|
+
`start: "billing_date"` (was `"anchor"`), and `subjects.update()` takes
|
|
61
|
+
`billingDate` (was `anchor`); the subject says `billingDate` too.
|
|
62
|
+
- `usage.standing()` and `usage.query()` take one `subject`, written
|
|
63
|
+
`kind:id` (`user:usr_123`), instead of separate kind and id fields
|
|
64
|
+
(`limitry usage standing --subject user:usr_123`).
|
|
65
|
+
- A limit's id starts `lmt_` (was `lim_`); keys still start `lim_test_`
|
|
66
|
+
and `lim_live_`.
|
|
67
|
+
- `limitry sync --preview` (was `--dry-run`), and the API's `preview`
|
|
68
|
+
(was `dryRun`), in what you send and what comes back.
|
|
69
|
+
|
|
70
|
+
### Removed
|
|
71
|
+
|
|
72
|
+
- Limits no longer have `counting` (Fast or Guaranteed), and the CLI no
|
|
73
|
+
longer has `--counting`: every count is now saved before Limitry answers,
|
|
74
|
+
for every limit. Remove `counting` from your code and from
|
|
75
|
+
`limitry.json`; Limitry ignores it.
|
|
76
|
+
|
|
77
|
+
## 1.0.0-rc.7 (2026-10-19)
|
|
78
|
+
|
|
79
|
+
### Added
|
|
80
|
+
|
|
81
|
+
- A refused check's `reason` has a `message`: the refusal in one sentence,
|
|
82
|
+
such as "Refused by AI budget: 3 cents left, resets
|
|
83
|
+
2026-11-01T00:00:00.000Z. Try again in 3600 s." `LimitExceeded` and
|
|
84
|
+
`limitry check` show it as the API writes it, so every client says the
|
|
85
|
+
same. Branch on `allowed` and `reason.code`, never on the message.
|
|
86
|
+
|
|
87
|
+
### Fixed
|
|
88
|
+
|
|
89
|
+
- - `held.cost()` refuses a cost the API can't commit (not a whole number
|
|
90
|
+
from 0 to 1,000,000,000): TypeScript throws `RangeError`, Python raises
|
|
91
|
+
`ValueError`, in your code. Before, the commit failed silently after
|
|
92
|
+
the work and its usage was never counted.
|
|
93
|
+
- TypeScript's `held.extend()` throws the API's error, such as for an
|
|
94
|
+
expired hold, as Python's already did. Both send the `ttlSeconds` you
|
|
95
|
+
give as it is, so `0` is refused rather than read as the default.
|
|
96
|
+
- Python checks, commits and releases now retry exactly as TypeScript's
|
|
97
|
+
do: a network error, `408`, `429` or `5xx`, at most twice, all within
|
|
98
|
+
the check's `timeout` (1.5 s) or 5 s for a settle. `standing()` retries
|
|
99
|
+
too, and reports an error answer that isn't JSON.
|
|
100
|
+
- `limitry check` and `limitry sync` refuse `--workspace` with an API key,
|
|
101
|
+
as every other command does, instead of ignoring it.
|
|
102
|
+
|
|
5
103
|
## 1.0.0-rc.6 (2026-10-19)
|
|
6
104
|
|
|
7
105
|
### Fixed
|
package/README.md
CHANGED
|
@@ -28,15 +28,15 @@ Commands act in **test** unless you say otherwise, so trying things
|
|
|
28
28
|
never touches the limits your customers depend on.
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
|
-
# 100 AI replies a day for each user
|
|
32
|
-
limitry limits create --
|
|
33
|
-
--
|
|
31
|
+
# 100 AI replies a day for each user ("100 replies per user per day for ai-call")
|
|
32
|
+
limitry limits create --subject '{"kind":"user"}' --action ai-call \
|
|
33
|
+
--amount 100 --unit replies --window day
|
|
34
34
|
|
|
35
35
|
# Check a user, as your code would
|
|
36
36
|
limitry check user:usr_123 ai-call
|
|
37
37
|
|
|
38
38
|
# Where a user stands, without counting anything
|
|
39
|
-
limitry usage standing --
|
|
39
|
+
limitry usage standing --subject user:usr_123
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
When a limit is right, copy it to live from the **Limits** page in the
|