@limitry/sdk 1.0.0-rc.5 → 1.0.0-rc.6
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 +10 -1
- package/README.md +4 -1
- package/dist/product/limits.js +17 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,11 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
What changed in the Limitry TypeScript SDK (`@limitry/sdk`). Generated from the source on each release; newest first.
|
|
4
4
|
|
|
5
|
+
## 1.0.0-rc.6 (2026-10-19)
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- `LimitExceeded` says which limit refused, by name, and when to try
|
|
10
|
+
again: "Refused by AI replies per day: 0 replies left, resets
|
|
11
|
+
2026-10-20T00:00:00.000Z. Try again in 60 s." It used to show only the
|
|
12
|
+
limit's id. `error.limit` (`limit` in Python) is still the id.
|
|
13
|
+
|
|
5
14
|
## 1.0.0-rc.5 (2026-10-16)
|
|
6
15
|
|
|
7
16
|
### Changed
|
|
8
17
|
|
|
9
|
-
- The TypeScript SDK's guide is at `/docs/typescript
|
|
18
|
+
- The TypeScript SDK's guide is at `/docs/typescript/`, beside `/docs/python/` and `/docs/cli/`.
|
|
10
19
|
|
|
11
20
|
## 1.0.0-rc.4 (2026-10-16)
|
|
12
21
|
|
package/README.md
CHANGED
|
@@ -91,9 +91,12 @@ idempotency key, so a retried request happens once.
|
|
|
91
91
|
- [Discord](https://limitry.com/discord)
|
|
92
92
|
- [Report a security issue](https://limitry.com/security/)
|
|
93
93
|
|
|
94
|
-
##
|
|
94
|
+
## Contributing
|
|
95
95
|
|
|
96
96
|
This repository is generated from Limitry's source on each
|
|
97
97
|
release, so pull requests are ported there and credited (see
|
|
98
98
|
[CONTRIBUTING.md](https://github.com/limitry/limitry-typescript/blob/main/CONTRIBUTING.md)).
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
99
102
|
Licensed under the Apache License 2.0.
|
package/dist/product/limits.js
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A refusal in the CLI's words, naming the limit rather than its id:
|
|
3
|
+
* "Refused by AI replies per day: 0 replies left, resets …. Try again in
|
|
4
|
+
* 42 s."
|
|
5
|
+
*/
|
|
6
|
+
function refusal(decision) {
|
|
7
|
+
const id = decision?.reason?.limit ?? null;
|
|
8
|
+
const limit = decision?.remaining.find((r) => r.limit === id);
|
|
9
|
+
const retry = decision?.retryAfterSeconds != null
|
|
10
|
+
? ` Try again in ${decision.retryAfterSeconds} s.`
|
|
11
|
+
: "";
|
|
12
|
+
if (!limit)
|
|
13
|
+
return `Refused: limit ${id ?? "(unknown)"} is used up.${retry}`;
|
|
14
|
+
const resets = limit.resetsAt ? `, resets ${limit.resetsAt}` : "";
|
|
15
|
+
return `Refused by ${limit.name}: ${limit.remaining} ${limit.unit} left${resets}.${retry}`;
|
|
16
|
+
}
|
|
1
17
|
/** Not allowed: a limit is used up — or Limitry is unreachable and a limit fails closed. */
|
|
2
18
|
export class LimitExceeded extends Error {
|
|
3
19
|
reason;
|
|
@@ -11,7 +27,7 @@ export class LimitExceeded extends Error {
|
|
|
11
27
|
? "Limitry could not be reached and a limit denies when unreachable"
|
|
12
28
|
: reason === "too_many_reservations"
|
|
13
29
|
? "Too many open reservations for this subject"
|
|
14
|
-
:
|
|
30
|
+
: refusal(decision));
|
|
15
31
|
this.name = "LimitExceeded";
|
|
16
32
|
this.reason = reason;
|
|
17
33
|
this.limit = decision?.reason?.limit ?? null;
|