@cartanova/qgrid-cli 2.14.0 → 2.14.1
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/bundle/dist/utils/providers/anthropic/anthropic-dispatcher.js +12 -13
- package/bundle/dist/utils/providers/anthropic/anthropic-quota.js +10 -6
- package/bundle/dist/utils/providers/grok/grok-dispatcher.js +15 -15
- package/bundle/src/utils/providers/anthropic/anthropic-dispatcher.test.ts +31 -4
- package/bundle/src/utils/providers/anthropic/anthropic-dispatcher.ts +14 -14
- package/bundle/src/utils/providers/anthropic/anthropic-quota.test.ts +12 -7
- package/bundle/src/utils/providers/anthropic/anthropic-quota.ts +17 -7
- package/bundle/src/utils/providers/grok/grok-dispatcher.test.ts +23 -7
- package/bundle/src/utils/providers/grok/grok-dispatcher.ts +19 -23
- package/bundle/src/utils/providers/openai/openai-dispatcher.test.ts +2 -2
- package/bundle/web-dist/client/assets/{index-Cj7ZXipM.js → index-jExDfi8j.js} +3 -3
- package/bundle/web-dist/client/assets/{logs-DSuoyKRh.js → logs-ol_IGjcT.js} +1 -1
- package/bundle/web-dist/client/assets/{monit-BwLPgwHG.js → monit-CGTRk2U0.js} +1 -1
- package/bundle/web-dist/client/assets/{routes-_R4-gxLV.js → routes-D9l20OWa.js} +2 -2
- package/bundle/web-dist/client/assets/{settings-ZBCgAZaZ.js → settings-D2zIv0xR.js} +1 -1
- package/bundle/web-dist/client/assets/{show-DFFBtBqe.js → show-DefwCScC.js} +1 -1
- package/bundle/web-dist/client/assets/{tokens-DYSfYz8A.js → tokens-CbmIxMZ9.js} +1 -1
- package/bundle/web-dist/client/assets/{use-oauth-login-flow-CN8nxeAR.js → use-oauth-login-flow-CEufhZcR.js} +1 -1
- package/bundle/web-dist/client/assets/{use-update-token-mutation-B-N8fFUm.js → use-update-token-mutation-E5ey27W6.js} +1 -1
- package/bundle/web-dist/client/index.html +1 -1
- package/bundle/web-dist/server/assets/{routes-CjWxvHAO.js → routes-CCdBJqP_.js} +11 -10
- package/bundle/web-dist/server/entry-server.generated.js +2 -2
- package/package.json +1 -1
- package/skills/qgrid/references/anthropic-claude-code-runtime.md +4 -3
- package/skills/qgrid/references/decision-rationale.md +4 -4
- package/skills/qgrid/references/grok-runtime.md +4 -1
- package/skills/qgrid/references/sonamu-api-web-flow.md +4 -0
- package/skills/qgrid/references/token-auth-quota-lifecycle.md +8 -5
|
@@ -2937,11 +2937,7 @@ var lucideGripVertical = ({ title, titleId, ...props }, ref) => /* @__PURE__ */
|
|
|
2937
2937
|
var ForwardRef = (0, import_react.forwardRef)(lucideGripVertical);
|
|
2938
2938
|
//#endregion
|
|
2939
2939
|
//#region src/components/qgrid/UsageCard.tsx
|
|
2940
|
-
var QUOTA_THRESHOLD_PROVIDERS = /* @__PURE__ */ new Set([
|
|
2941
|
-
"anthropic",
|
|
2942
|
-
"openai",
|
|
2943
|
-
"grok"
|
|
2944
|
-
]);
|
|
2940
|
+
var QUOTA_THRESHOLD_PROVIDERS = /* @__PURE__ */ new Set(["anthropic", "openai"]);
|
|
2945
2941
|
function validateThreshold(raw) {
|
|
2946
2942
|
const trimmed = raw.trim();
|
|
2947
2943
|
if (trimmed === "") return {
|
|
@@ -3149,7 +3145,7 @@ function TokenUsage({ token, theme }) {
|
|
|
3149
3145
|
resetsAt: data.sevenDay.resetsAt,
|
|
3150
3146
|
windowDurationMins: data.sevenDay.windowDurationMins,
|
|
3151
3147
|
theme,
|
|
3152
|
-
threshold: token.provider === "grok" ?
|
|
3148
|
+
threshold: token.provider === "anthropic" || token.provider === "grok" ? 100 : void 0
|
|
3153
3149
|
})
|
|
3154
3150
|
]
|
|
3155
3151
|
});
|
|
@@ -3222,7 +3218,7 @@ function ThresholdControl({ token }) {
|
|
|
3222
3218
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
|
|
3223
3219
|
htmlFor: `threshold-${token.id}`,
|
|
3224
3220
|
className: "text-[10px] uppercase tracking-wider text-sand-500 font-medium",
|
|
3225
|
-
children: "사용률 제한"
|
|
3221
|
+
children: token.provider === "anthropic" ? "5시간 사용률 제한" : "주간 사용률 제한"
|
|
3226
3222
|
}),
|
|
3227
3223
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
3228
3224
|
className: "mt-1 flex items-center gap-2",
|
|
@@ -3254,7 +3250,7 @@ function ThresholdControl({ token }) {
|
|
|
3254
3250
|
}),
|
|
3255
3251
|
validation.ok ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
3256
3252
|
className: "mt-1.5 text-[11px] text-sand-500 leading-snug",
|
|
3257
|
-
children: validation.value === null ? "제한 없음 — 사용률과 무관하게 항상 사용합니다." : "
|
|
3253
|
+
children: validation.value === null ? token.provider === "anthropic" ? "5시간 제한 없음. 주간 사용량 100%에서는 제외합니다." : "제한 없음 — 사용률과 무관하게 항상 사용합니다." : token.provider === "anthropic" ? "5시간 사용률에 적용합니다. 주간은 100%에서만 제외합니다." : "주간 사용률이 임계치에 달하면 해당 토큰을 건너뜁니다."
|
|
3258
3254
|
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
3259
3255
|
className: "mt-1.5 text-[11px] text-red-500",
|
|
3260
3256
|
children: validation.error
|
|
@@ -3495,12 +3491,17 @@ function SortableTokenCard({ token }) {
|
|
|
3495
3491
|
}),
|
|
3496
3492
|
QUOTA_THRESHOLD_PROVIDERS.has(token.provider) && token.quota_threshold !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
3497
3493
|
className: "px-1.5 py-0.5 rounded-full bg-sienna-50 text-[10px] tabular-nums font-medium text-sienna-600",
|
|
3498
|
-
title:
|
|
3494
|
+
title: `${token.provider === "anthropic" ? "5시간" : "주간"} 사용률 ${token.quota_threshold}% 이상이면 이 토큰 제외`,
|
|
3499
3495
|
children: [
|
|
3500
3496
|
"≤ ",
|
|
3501
3497
|
token.quota_threshold,
|
|
3502
3498
|
"%"
|
|
3503
3499
|
]
|
|
3500
|
+
}),
|
|
3501
|
+
token.provider === "grok" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
3502
|
+
className: "px-1.5 py-0.5 rounded-full bg-sienna-50 text-[10px] tabular-nums font-medium text-sienna-600",
|
|
3503
|
+
title: "주간 사용률 100%에서 이 토큰 제외",
|
|
3504
|
+
children: "7d 100%"
|
|
3504
3505
|
})
|
|
3505
3506
|
]
|
|
3506
3507
|
}),
|
|
@@ -3514,7 +3515,7 @@ function SortableTokenCard({ token }) {
|
|
|
3514
3515
|
token.reauth_required && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ReloginButton, { token }),
|
|
3515
3516
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex-1" }),
|
|
3516
3517
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(WeightControl, { token }),
|
|
3517
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThresholdControl, { token })
|
|
3518
|
+
token.provider !== "grok" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThresholdControl, { token })
|
|
3518
3519
|
]
|
|
3519
3520
|
})
|
|
3520
3521
|
]
|
|
@@ -53085,7 +53085,7 @@ function ChatWidget() {
|
|
|
53085
53085
|
}
|
|
53086
53086
|
//#endregion
|
|
53087
53087
|
//#region src/components/Sidebar.tsx
|
|
53088
|
-
var qgridVersion = "2.14.
|
|
53088
|
+
var qgridVersion = "2.14.1";
|
|
53089
53089
|
function Sidebar({ className }) {
|
|
53090
53090
|
const pathname = useRouterState({ select: (s) => s.location.pathname });
|
|
53091
53091
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("aside", {
|
|
@@ -55280,7 +55280,7 @@ function RootComponent() {
|
|
|
55280
55280
|
}
|
|
55281
55281
|
//#endregion
|
|
55282
55282
|
//#region src/routes/index.tsx
|
|
55283
|
-
var $$splitComponentImporter$5 = () => import("./assets/routes-
|
|
55283
|
+
var $$splitComponentImporter$5 = () => import("./assets/routes-CCdBJqP_.js");
|
|
55284
55284
|
var Route$5 = createFileRoute("/")({ component: lazyRouteComponent($$splitComponentImporter$5, "component") });
|
|
55285
55285
|
//#endregion
|
|
55286
55286
|
//#region src/services/sonamu.generated.ts
|
package/package.json
CHANGED
|
@@ -44,9 +44,10 @@ Anthropic tokens live in an in-memory `Map<tokenId, PooledToken>`.
|
|
|
44
44
|
|
|
45
45
|
Quota threshold:
|
|
46
46
|
|
|
47
|
-
- `quota_threshold`
|
|
48
|
-
`seven_day_overage_included.utilization`
|
|
49
|
-
|
|
47
|
+
- `quota_threshold` applies only to `five_hour.utilization`. Shared `seven_day.utilization`
|
|
48
|
+
and the Fable family's `seven_day_overage_included.utilization` exclude tokens only at 100%.
|
|
49
|
+
Weekly exhaustion is checked even without a configured threshold. Keepalive uses the same
|
|
50
|
+
policy, so a 5-hour utilization of 0% and weekly utilization of 92% passes an 80% threshold.
|
|
50
51
|
- A runtime quota-exhausted result invalidates every 60-second usage-cache key used before and
|
|
51
52
|
after a possible OAuth refresh, so the next untargeted request rechecks usage and can select
|
|
52
53
|
another token.
|
|
@@ -174,10 +174,10 @@ Key decisions:
|
|
|
174
174
|
- The token subscriber disables statement/idle timeouts for `LISTEN` and uses reconnect backoff.
|
|
175
175
|
- `quota_threshold` is a routing guardrail, not a load balancer. It prevents an individual token from crossing a configured utilization percentage; it does not equalize traffic.
|
|
176
176
|
- Threshold values are nullable integers from 1 to 100. `0` is not valid; `100` means exclude only at full utilization.
|
|
177
|
-
- Provider criteria differ by quota window: Anthropic
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
`primary.usedPercent
|
|
177
|
+
- Provider criteria differ by quota window: Anthropic applies the configured threshold only to
|
|
178
|
+
`five_hour.utilization`; shared and Fable-specific weekly usage block only at 100%. Grok has
|
|
179
|
+
only weekly usage and blocks at 100% regardless of its stored threshold. OpenAI applies the
|
|
180
|
+
configured threshold to `primary.usedPercent`, currently its weekly window.
|
|
181
181
|
- Threshold gates are by token id, not token name. Names are display/logging labels and can change.
|
|
182
182
|
- Token window keepalive is opt-in at two levels since 2.8.0 (`ea7feb3`): an instance fires only with env `QGRID_TOKEN_WINDOW_KEEPALIVE_ENABLED=true`, and only for tokens with `keepalive_enabled = true`. The runner gate exists because developer instances sharing the production DB fired duplicate pings under the 2.7.6 default-on switch; the per-token flag lets shared or credit-metered accounts stay out. The cost is that upgrades start with zero targets until both are set.
|
|
183
183
|
- Lookup failure is fail-open with logs/metrics. Hard failure happens only when usage was read successfully and the token is over threshold.
|
|
@@ -47,7 +47,10 @@ Refresh starts 300 seconds plus stable 0–60 second per-account jitter before e
|
|
|
47
47
|
|
|
48
48
|
The response is protobuf JSON, which omits zero-valued scalars: a period without measurable usage arrives without `creditUsagePercent`, so qgrid reads the missing field as 0%. Observed on a Free account on 2026-10-21, where the field stayed absent even after a small request. The period is fixed (it existed before the token's first request and did not move after one), so token-window keepalive does not apply to Grok; xAI documents one weekly pool and no short rolling window.
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
Every routing prefetch reads billing, even without a configured threshold. Grok exposes only weekly
|
|
51
|
+
usage: accounts are excluded at 100%, and the stored configurable threshold is not applied.
|
|
52
|
+
Dashboard usage (`QgridFrame.usage`) calls the same prefetch through `refreshUsage` and waits up to
|
|
53
|
+
3 seconds. The 60-second lookup cache bounds the xAI calls.
|
|
51
54
|
|
|
52
55
|
D6 excludes accounts when `/settings.on_demand_enabled` is `true`; `null`, `false`, or absence allows routing. Billing does not carry this field. D7 selects eligible accounts through the shared `SmoothWeightedRoundRobin`, using `tokens.weight`; a valid cache-affinity token remains preferred. `QGRID_GROK_MAX_INFLIGHT_PER_TOKEN` optionally excludes accounts at the cap, while omission leaves Grok uncapped (`grok-quota.ts`, `grok-dispatcher.ts`, `packages/api/src/utils/providers/common/smooth-weighted-round-robin.ts`).
|
|
53
56
|
|
|
@@ -78,6 +78,10 @@ Chat model presets: the model `<select>` lists the served subset of `QgridSuppor
|
|
|
78
78
|
|
|
79
79
|
The monit tab's vitals strip shows per-provider in-flight counts, an in-flight sparkline, token chips with quota gauges (fed by the dispatcher's 60-second rate-limits cache; `resetsAt` arrives as ms epoch), and a 1-hour per-provider request/error/cache-hit stats line polled separately every 30 seconds.
|
|
80
80
|
|
|
81
|
+
Quota controls match provider policy: Anthropic edits its 5-hour threshold and shows a fixed 100%
|
|
82
|
+
weekly cap; OpenAI edits its weekly primary-window threshold. Grok has only a fixed 100% weekly cap
|
|
83
|
+
and no threshold editor. Disabling the Anthropic threshold does not disable weekly exhaustion checks.
|
|
84
|
+
|
|
81
85
|
Current-turn input images render in the detail view under the user prompt from `request_logs.input_images` (subset `A` only, not the list subset). Logs created before that column fall back to the first synthetic `image_generation` step's `tool_args.inputImages`. Keep the prompt itself text-only, redact large base64 in request JSON views, and avoid rendering duplicate input previews for multi-output image turns.
|
|
82
86
|
|
|
83
87
|
## Verification
|
|
@@ -140,9 +140,9 @@ Usage/quota:
|
|
|
140
140
|
|
|
141
141
|
- Usage API is `https://api.anthropic.com/api/oauth/usage`.
|
|
142
142
|
- qgrid caches Anthropic usage by access-token suffix for 60 seconds.
|
|
143
|
-
-
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
- The configured quota threshold applies only to `five_hour.utilization`. The shared
|
|
144
|
+
`seven_day.utilization` and Fable-only `seven_day_overage_included.utilization` block only at
|
|
145
|
+
100%, independently of the configured threshold.
|
|
146
146
|
- Usage lookup failure is fail-open for routing.
|
|
147
147
|
|
|
148
148
|
## OpenAI OAuth And Refresh Flow
|
|
@@ -274,7 +274,10 @@ When a refresh fails in a way that only re-login can fix, qgrid removes the toke
|
|
|
274
274
|
|
|
275
275
|
`quota_threshold` is a routing gate, not a hard external-provider guarantee.
|
|
276
276
|
|
|
277
|
-
- Null
|
|
277
|
+
- Null disables the configurable threshold, but Anthropic and Grok still check weekly exhaustion.
|
|
278
|
+
- Anthropic applies the configured threshold to 5-hour usage and a fixed 100% cap to weekly usage.
|
|
279
|
+
- Grok exposes only weekly usage and uses a fixed 100% cap; its stored threshold is not applied.
|
|
280
|
+
- OpenAI applies the configured threshold to its primary usage window, currently weekly.
|
|
278
281
|
- Lookup failure is fail-open.
|
|
279
282
|
- Individual over-threshold tokens are excluded from selection.
|
|
280
283
|
- OpenAI keeps this exclusion as an in-memory `quota-blocked` runtime state without changing the
|
|
@@ -283,7 +286,7 @@ When a refresh fails in a way that only re-login can fix, qgrid removes the toke
|
|
|
283
286
|
`recovered` once a later quota check falls below the threshold. Metadata generations prevent an
|
|
284
287
|
in-flight lookup from restoring a block after a threshold or lifecycle change. The state is not
|
|
285
288
|
persisted across server restarts.
|
|
286
|
-
- Grok also keeps
|
|
289
|
+
- Grok also keeps weekly-cap and exhaustion blocks in memory. Its exhaustion block is request-class
|
|
287
290
|
scoped, and `/settings.on_demand_enabled = true` independently excludes the entire account
|
|
288
291
|
(`packages/api/src/utils/providers/grok/grok-dispatcher.ts`).
|
|
289
292
|
- If all ready/eligible tokens are over threshold, qgrid throws `QuotaThresholdExceededError`.
|