@north-light/cli 0.3.718 → 0.3.719
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/dist/core/rate-limit-scope.d.ts +1 -1
- package/dist/core/rate-limit-scope.js +1 -1
- package/package.json +3 -3
- package/packages/crouter-api/dist/core/rate-limit-scope.js +22 -12
- package/packages/crouter-api/package.json +1 -1
- package/packages/crouter-identity/package.json +1 -1
- package/packages/crouter-plugin/package.json +3 -3
- package/runtime.lock.json +14 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _=Object.defineProperty;var o=(e,t)=>_(e,"name",{value:t,configurable:!0});const h={seven_day_opus:"opus",seven_day_sonnet:"sonnet"},L=new Set(["five_hour","seven_day","seven_day_overage_included","overage"]),v=["opus","sonnet","haiku","fable","mythos"],w=48,A=256;function k(e){if(!e)return;const t=e.toLowerCase();return v.find(r=>t.includes(r))}o(k,"modelCooldownFamily");function b(e){return e?typeof Headers<"u"&&e instanceof Headers?[...e.entries()]:Object.entries(e).filter(t=>typeof t[1]=="string"):[]}o(b,"entries");function C(e){return e.startsWith("anthropic-ratelimit-")||e.startsWith("x-ratelimit-")||e==="retry-after"||e==="retry-after-ms"}o(C,"isRateLimitHeader");function S(e){const t={};for(const[r,i]of b(e)){const n=r.toLowerCase();if(C(n)){if(Object.keys(t).length>=w)break;t[n]=i.slice(0,A)}}return t}o(S,"rateLimitHeaders");function M(e,t,r=Date.now()){const i=S(e),n=i["anthropic-ratelimit-unified-representative-claim"]?.trim()||void 0,u=i["anthropic-ratelimit-unified-status"]?.trim()==="rejected",s=Number(i["anthropic-ratelimit-unified-reset"]),a=u&&Number.isFinite(s)&&s>0&&s*1e3>r?s*1e3:void 0,d=n===void 0?void 0:h[n],c=k(t),f=i["anthropic-ratelimit-unified-7d-status"]?.trim(),l=i["anthropic-ratelimit-unified-5h-status"]?.trim(),p=f!==void 0&&f!=="rejected"&&l!=="rejected",y=n!==void 0&&d===void 0&&!L.has(n),m=d!==void 0?d===c?c:void 0:y&&p?c:void 0;return{scope:u&&m!==void 0?{kind:"model",family:m}:{kind:"account"},...n!==void 0?{claim:n}:{},...a!==void 0?{resetAt:a}:{},headers:i}}o(M,"classifyRateLimit");function x(e){return e.kind==="account"?"account":`model:${e.family}`}o(x,"describeRateLimitScope");export{M as classifyRateLimit,x as describeRateLimitScope,k as modelCooldownFamily,S as rateLimitHeaders};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.719",
|
|
4
4
|
"description": "crtr — agent runtime with memory, plugins, and marketplaces",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -158,8 +158,8 @@
|
|
|
158
158
|
},
|
|
159
159
|
"license": "UNLICENSED",
|
|
160
160
|
"dependencies": {
|
|
161
|
-
"@north-light/identity": "0.3.
|
|
162
|
-
"@north-light/plugin": "0.3.
|
|
161
|
+
"@north-light/identity": "0.3.719",
|
|
162
|
+
"@north-light/plugin": "0.3.719",
|
|
163
163
|
"@earendil-works/chord": "1.5.2",
|
|
164
164
|
"@earendil-works/pi-agent-core": "1.5.2",
|
|
165
165
|
"@earendil-works/pi-ai": "1.5.2",
|
|
@@ -5,24 +5,28 @@
|
|
|
5
5
|
// headers. `-status` is `allowed` | `allowed_warning` | `rejected`;
|
|
6
6
|
// `-representative-claim` names the binding window (`five_hour`, `seven_day`,
|
|
7
7
|
// `seven_day_opus`, `seven_day_sonnet`, `seven_day_overage_included`,
|
|
8
|
-
// `overage`, …); `-reset` is the epoch second it frees up
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
8
|
+
// `overage`, …); `-reset` is the epoch second it frees up; `-5h-status` and
|
|
9
|
+
// `-7d-status` report the account-wide windows on their own. The grammar is
|
|
10
|
+
// read from Claude Code's client, not from published docs, so the classifier
|
|
11
|
+
// fails safe. A rejected response is model-scoped when its claim is a known
|
|
12
|
+
// per-model weekly window matching the requested model's family, or when its
|
|
13
|
+
// claim is not a known account-wide window and the response itself reports the
|
|
14
|
+
// account-wide weekly window as not rejected (a per-model window such as the
|
|
15
|
+
// Fable weekly cap, whatever its claim is called). Anything else — missing
|
|
16
|
+
// status, no account-window evidence, a known window for a different family,
|
|
17
|
+
// models with no family, other providers — cools the whole account.
|
|
14
18
|
const MODEL_CLAIMS = { seven_day_opus: 'opus', seven_day_sonnet: 'sonnet' };
|
|
19
|
+
/** Claims that name an account-wide window: never model-scoped, whatever the per-window statuses say. */
|
|
20
|
+
const ACCOUNT_CLAIMS = new Set(['five_hour', 'seven_day', 'seven_day_overage_included', 'overage']);
|
|
21
|
+
const FAMILIES = ['opus', 'sonnet', 'haiku', 'fable', 'mythos'];
|
|
15
22
|
const MAX_HEADERS = 48;
|
|
16
23
|
const MAX_VALUE = 256;
|
|
17
24
|
/** The cooldown family a model id belongs to, or undefined when only account-wide cooldowns apply to it. */
|
|
18
25
|
export function modelCooldownFamily(modelId) {
|
|
19
26
|
if (!modelId)
|
|
20
27
|
return undefined;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (/sonnet/i.test(modelId))
|
|
24
|
-
return 'sonnet';
|
|
25
|
-
return undefined;
|
|
28
|
+
const id = modelId.toLowerCase();
|
|
29
|
+
return FAMILIES.find((family) => id.includes(family));
|
|
26
30
|
}
|
|
27
31
|
function entries(headers) {
|
|
28
32
|
if (!headers)
|
|
@@ -56,7 +60,13 @@ export function classifyRateLimit(headers, modelId, now = Date.now()) {
|
|
|
56
60
|
const resetAt = rejected && Number.isFinite(resetSeconds) && resetSeconds > 0 && resetSeconds * 1000 > now ? resetSeconds * 1000 : undefined;
|
|
57
61
|
const claimed = claim === undefined ? undefined : MODEL_CLAIMS[claim];
|
|
58
62
|
const family = modelCooldownFamily(modelId);
|
|
59
|
-
|
|
63
|
+
// The response reports the account-wide weekly window and it is not what refused the call (the five-hour window, when reported, neither).
|
|
64
|
+
const weekly = recorded['anthropic-ratelimit-unified-7d-status']?.trim();
|
|
65
|
+
const fiveHour = recorded['anthropic-ratelimit-unified-5h-status']?.trim();
|
|
66
|
+
const accountWindowsOpen = weekly !== undefined && weekly !== 'rejected' && fiveHour !== 'rejected';
|
|
67
|
+
const unknownWindow = claim !== undefined && claimed === undefined && !ACCOUNT_CLAIMS.has(claim);
|
|
68
|
+
const scopedFamily = claimed !== undefined ? (claimed === family ? family : undefined) : unknownWindow && accountWindowsOpen ? family : undefined;
|
|
69
|
+
const scope = rejected && scopedFamily !== undefined ? { kind: 'model', family: scopedFamily } : { kind: 'account' };
|
|
60
70
|
return { scope, ...(claim !== undefined ? { claim } : {}), ...(resetAt !== undefined ? { resetAt } : {}), headers: recorded };
|
|
61
71
|
}
|
|
62
72
|
export function describeRateLimitScope(scope) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/api",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.719",
|
|
4
4
|
"description": "Typed crtrd /v1 API contract — DTOs, route builders, the error contract, the CrtrClient, and the command-plugin manifest format. Zero runtime dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/api/index.js",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/plugin",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.719",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"postpack": "node ../../scripts/pack-minify.mjs postpack packages/crouter-plugin"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@north-light/api": "0.3.
|
|
31
|
-
"@north-light/identity": "0.3.
|
|
30
|
+
"@north-light/api": "0.3.719",
|
|
31
|
+
"@north-light/identity": "0.3.719"
|
|
32
32
|
},
|
|
33
33
|
"license": "UNLICENSED",
|
|
34
34
|
"publishConfig": {
|
package/runtime.lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.719",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@north-light/cli",
|
|
9
|
-
"version": "0.3.
|
|
9
|
+
"version": "0.3.719",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "UNLICENSED",
|
|
12
12
|
"workspaces": [
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"@milkdown/preset-gfm": "^7.22.3",
|
|
29
29
|
"@milkdown/prose": "^7.22.3",
|
|
30
30
|
"@milkdown/utils": "^7.22.3",
|
|
31
|
-
"@north-light/identity": "0.3.
|
|
32
|
-
"@north-light/plugin": "0.3.
|
|
31
|
+
"@north-light/identity": "0.3.719",
|
|
32
|
+
"@north-light/plugin": "0.3.719",
|
|
33
33
|
"cron-parser": "^5.6.0",
|
|
34
34
|
"esbuild": "0.28.2",
|
|
35
35
|
"jose": "^6.2.12",
|
|
@@ -11902,17 +11902,17 @@
|
|
|
11902
11902
|
},
|
|
11903
11903
|
"packages/crouter-api": {
|
|
11904
11904
|
"name": "@north-light/api",
|
|
11905
|
-
"version": "0.3.
|
|
11905
|
+
"version": "0.3.719",
|
|
11906
11906
|
"license": "UNLICENSED"
|
|
11907
11907
|
},
|
|
11908
11908
|
"packages/crouter-env-docker": {
|
|
11909
11909
|
"name": "@north-light/env-docker",
|
|
11910
|
-
"version": "0.3.
|
|
11910
|
+
"version": "0.3.719",
|
|
11911
11911
|
"license": "UNLICENSED"
|
|
11912
11912
|
},
|
|
11913
11913
|
"packages/crouter-identity": {
|
|
11914
11914
|
"name": "@north-light/identity",
|
|
11915
|
-
"version": "0.3.
|
|
11915
|
+
"version": "0.3.719",
|
|
11916
11916
|
"license": "UNLICENSED",
|
|
11917
11917
|
"dependencies": {
|
|
11918
11918
|
"jose": "^6.2.1"
|
|
@@ -11920,21 +11920,21 @@
|
|
|
11920
11920
|
},
|
|
11921
11921
|
"packages/crouter-plugin": {
|
|
11922
11922
|
"name": "@north-light/plugin",
|
|
11923
|
-
"version": "0.3.
|
|
11923
|
+
"version": "0.3.719",
|
|
11924
11924
|
"license": "UNLICENSED",
|
|
11925
11925
|
"dependencies": {
|
|
11926
|
-
"@north-light/api": "0.3.
|
|
11927
|
-
"@north-light/identity": "0.3.
|
|
11926
|
+
"@north-light/api": "0.3.719",
|
|
11927
|
+
"@north-light/identity": "0.3.719"
|
|
11928
11928
|
}
|
|
11929
11929
|
},
|
|
11930
11930
|
"packages/crouter-sdk": {
|
|
11931
11931
|
"name": "@north-light/sdk",
|
|
11932
|
-
"version": "0.3.
|
|
11932
|
+
"version": "0.3.719",
|
|
11933
11933
|
"license": "UNLICENSED",
|
|
11934
11934
|
"dependencies": {
|
|
11935
|
-
"@north-light/api": "0.3.
|
|
11936
|
-
"@north-light/identity": "0.3.
|
|
11937
|
-
"@north-light/plugin": "0.3.
|
|
11935
|
+
"@north-light/api": "0.3.719",
|
|
11936
|
+
"@north-light/identity": "0.3.719",
|
|
11937
|
+
"@north-light/plugin": "0.3.719",
|
|
11938
11938
|
"jose": "^6.2.1"
|
|
11939
11939
|
},
|
|
11940
11940
|
"bin": {
|