tuxevil-rotator 4.4.1 → 4.4.2
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 +14 -0
- package/README.md +2 -0
- package/package.json +2 -1
- package/src/web/components/ui.tsx +2 -1
- package/src/web/pages/ModelAccess.tsx +377 -54
- package/src/web/styles/app.css +268 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## [4.4.2] - 2026-11-14
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- **Model access panel**: Rebuild the Models page's Model access panel from the dashboard's shared components and reduce it to one dropdown. The account select sits in the panel header; provider and plan are segmented controls in one row (plans that do not change the provider's rules fold behind "+N"; the plan control is hidden when plans do not matter), and client appears only for providers with client-dependent rules. Checking a model runs as you type, with the verdict inside the field, the reason and plan source on two quiet lines below, an "As of today" link that opens a date picker, and suggestions from the rules and the account's advertised models. Account observations and advertised models are one line of links that open inset details. Rules show model, access state, plans and note, with evidence dates in a tooltip, end dates under the state and the source as an icon link.
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- Preserve a newer plan selection when a previous plan declaration finishes saving, and guard access checks during the save.
|
|
14
|
+
|
|
15
|
+
### Contributors
|
|
16
|
+
|
|
17
|
+
- Thanks to [@CyR1en](https://github.com/CyR1en) for redesigning the Model access panel in [PR #49](https://github.com/tuxevil/tuxevil-rotator/pull/49).
|
|
18
|
+
|
|
5
19
|
## [4.4.1] - 2026-11-09
|
|
6
20
|
|
|
7
21
|
### Fixed
|
package/README.md
CHANGED
|
@@ -55,6 +55,8 @@ Originally built as a multi-account rotator for Google Antigravity. It now gener
|
|
|
55
55
|
|
|
56
56
|
## Current Model Update
|
|
57
57
|
|
|
58
|
+
- **v4.4.2: Model access dashboard**: A redesigned Model access panel with live checks, account evidence, clearer rules and safer plan saving. Thanks to [@CyR1en](https://github.com/CyR1en) for [PR #49](https://github.com/tuxevil/tuxevil-rotator/pull/49). ([Release notes](https://github.com/tuxevil/tuxevil-rotator/releases/tag/v4.4.2))
|
|
59
|
+
|
|
58
60
|
- **v4.4.1: Telemetry reliability**: Prevent failed or timed-out flag telemetry requests from terminating the rotator, and update the development-only minimatch override. ([Release notes](https://github.com/tuxevil/tuxevil-rotator/releases/tag/v4.4.1))
|
|
59
61
|
- **v4.4.0: Benchmark-informed auto routing, provider access, and usage visibility**: Rank eligible models with Artificial Analysis scores and effort-aware, quota-conscious fallbacks; enforce provider/account entitlements; add access diagnostics and aggregated usage-limit views. Includes bounded auto recovery and session continuity, Ollama empty-output handling, and prompt-compression improvements. The Playground now follows the dashboard design system. ([Release notes](https://github.com/tuxevil/tuxevil-rotator/releases/tag/v4.4.0); [PR #46](https://github.com/tuxevil/tuxevil-rotator/pull/46) by [@CyR1en](https://github.com/CyR1en))
|
|
60
62
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tuxevil-rotator",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.2",
|
|
4
4
|
"description": "Multi-provider, multi-account AI proxy rotator with per-model routing, real-time quota tracking, and infringement detection (Google Antigravity, Ollama Cloud)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
"@types/pg": "^8.20.0",
|
|
65
65
|
"c8": "^11.0.0",
|
|
66
66
|
"eslint": "^10.6.0",
|
|
67
|
+
"happy-dom": "^21.0.4",
|
|
67
68
|
"typescript": "^5.7.0",
|
|
68
69
|
"typescript-eslint": "^8.62.1"
|
|
69
70
|
},
|
|
@@ -204,7 +204,7 @@ export function Segmented<T extends string>({
|
|
|
204
204
|
size = "md",
|
|
205
205
|
class: className,
|
|
206
206
|
}: {
|
|
207
|
-
options: Array<{ value: T; label: ComponentChildren; title?: string }>;
|
|
207
|
+
options: Array<{ value: T; label: ComponentChildren; title?: string; disabled?: boolean }>;
|
|
208
208
|
value: T;
|
|
209
209
|
onChange: (value: T) => void;
|
|
210
210
|
label: string;
|
|
@@ -220,6 +220,7 @@ export function Segmented<T extends string>({
|
|
|
220
220
|
class={option.value === value ? "is-active" : undefined}
|
|
221
221
|
aria-pressed={option.value === value}
|
|
222
222
|
title={option.title}
|
|
223
|
+
disabled={option.disabled}
|
|
223
224
|
onClick={() => onChange(option.value)}
|
|
224
225
|
>
|
|
225
226
|
{option.label}
|
|
@@ -1,10 +1,65 @@
|
|
|
1
|
+
// Model access: what each plan is documented to reach, and an explainer for
|
|
2
|
+
// one account, provider and model. Informational only; nothing here routes.
|
|
3
|
+
|
|
1
4
|
import type { JSX } from "preact";
|
|
2
|
-
import { useEffect, useState } from "preact/hooks";
|
|
5
|
+
import { useEffect, useRef, useState } from "preact/hooks";
|
|
3
6
|
import type { AccessReport } from "../../model-access-api.js";
|
|
7
|
+
import type { AccessRule, AccessState } from "../../model-access.js";
|
|
8
|
+
import { formatDateTime, pluralize } from "../lib/format.js";
|
|
9
|
+
import { providerLabel, type Tone } from "../lib/status.js";
|
|
4
10
|
import { api } from "../state/api.js";
|
|
5
11
|
import { query } from "../state/router.js";
|
|
6
12
|
import { masker } from "../state/store.js";
|
|
7
|
-
import {
|
|
13
|
+
import { Icon } from "../components/icons.js";
|
|
14
|
+
import { EmptyState, Panel, SearchInput, Segmented, Spinner } from "../components/ui.js";
|
|
15
|
+
|
|
16
|
+
const PROVIDERS = ["google-antigravity", "openai-codex", "ollama", "opencode-zen"];
|
|
17
|
+
const PLANS = ["free", "plus", "pro-trial", "pro-paid", "ultra", "enterprise"];
|
|
18
|
+
const CLIENTS = ["unknown", "opencode", "other"] as const;
|
|
19
|
+
const CLIENT_LABEL: Record<(typeof CLIENTS)[number], string> = { unknown: "Unknown", opencode: "OpenCode", other: "Other" };
|
|
20
|
+
|
|
21
|
+
const STATE: Record<AccessState, { label: string; tone: Tone }> = {
|
|
22
|
+
allowed: { label: "Allowed", tone: "ok" },
|
|
23
|
+
blocked: { label: "Blocked", tone: "bad" },
|
|
24
|
+
conditional: { label: "Conditional", tone: "warn" },
|
|
25
|
+
unknown: { label: "Unknown", tone: "neutral" },
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const EVIDENCE: Record<AccessRule["evidence"], string> = {
|
|
29
|
+
documented: "Documented",
|
|
30
|
+
"operator-confirmed": "Operator confirmed",
|
|
31
|
+
"operator-pending": "Operator pending",
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const PLAN_SOURCE: Record<NonNullable<AccessReport["planSource"]>, string> = {
|
|
35
|
+
"query-assumption": "Assumed plan",
|
|
36
|
+
"single-provider-account": "Plan from the account tier",
|
|
37
|
+
"provider-declaration": "Plan from the stored declaration",
|
|
38
|
+
unknown: "Plan unknown",
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
function sourceHost(url: string): string {
|
|
42
|
+
try {
|
|
43
|
+
return new URL(url).hostname.replace(/^www\./, "");
|
|
44
|
+
} catch {
|
|
45
|
+
return url;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function planList(plans: string[]): string {
|
|
50
|
+
if (plans.includes("*")) return "Any plan";
|
|
51
|
+
return plans.length <= 3 ? plans.join(", ") : `${plans.slice(0, 2).join(", ")} +${plans.length - 2}`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function StateMark({ state, title }: { state: AccessState; title?: string }): JSX.Element {
|
|
55
|
+
const meta = STATE[state];
|
|
56
|
+
return (
|
|
57
|
+
<span class={`access-state tone-${meta.tone}`} title={title}>
|
|
58
|
+
<span class="access-dot" aria-hidden="true" />
|
|
59
|
+
{meta.label}
|
|
60
|
+
</span>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
8
63
|
|
|
9
64
|
export function ModelAccessPanel(): JSX.Element {
|
|
10
65
|
const [now, setNow] = useState(Date.now());
|
|
@@ -13,76 +68,344 @@ export function ModelAccessPanel(): JSX.Element {
|
|
|
13
68
|
const [accountId, setAccount] = useState(query.value.get("accessAccount") ?? "");
|
|
14
69
|
const [provider, setProvider] = useState("google-antigravity");
|
|
15
70
|
const [plan, setPlan] = useState("");
|
|
16
|
-
const [
|
|
71
|
+
const [morePlans, setMorePlans] = useState(false);
|
|
72
|
+
const [client, setClient] = useState<(typeof CLIENTS)[number]>("unknown");
|
|
17
73
|
const [at, setAt] = useState("");
|
|
74
|
+
const [pickDate, setPickDate] = useState(false);
|
|
18
75
|
const [ruleFilter, setRuleFilter] = useState("");
|
|
19
76
|
const [model, setModel] = useState("gemini-3.8-flash-medium");
|
|
20
|
-
const [decision, setDecision] = useState<AccessReport | null>(null);
|
|
21
|
-
const [
|
|
22
|
-
const
|
|
23
|
-
const [
|
|
24
|
-
const [
|
|
77
|
+
const [decision, setDecision] = useState<{ report: AccessReport; key: string; model: string } | null>(null);
|
|
78
|
+
const [evidence, setEvidence] = useState<"observations" | "catalog" | null>(null);
|
|
79
|
+
const [loadError, setLoadError] = useState("");
|
|
80
|
+
const [checkError, setCheckError] = useState("");
|
|
81
|
+
const [saveError, setSaveError] = useState("");
|
|
82
|
+
const [saving, setSaving] = useState(false);
|
|
83
|
+
const trimmedModel = model.trim();
|
|
84
|
+
const formKey = JSON.stringify([accountId, provider, plan, client, trimmedModel, at]);
|
|
85
|
+
const request = useRef(0);
|
|
86
|
+
const currentForm = useRef(formKey);
|
|
87
|
+
currentForm.current = formKey;
|
|
88
|
+
|
|
25
89
|
useEffect(() => {
|
|
26
90
|
let active = true;
|
|
27
|
-
api.modelAccess().then(value => { if (active) setReport(value); }).catch(() => { if (active)
|
|
91
|
+
api.modelAccess().then(value => { if (active) setReport(value); }).catch(() => { if (active) setLoadError("Access rules could not be loaded."); });
|
|
28
92
|
return () => { active = false; };
|
|
29
93
|
}, []);
|
|
30
|
-
|
|
31
|
-
useEffect(() => { setDecision(null); }, [accountId, provider, plan, client, model, at]);
|
|
94
|
+
|
|
32
95
|
const selected = report?.accounts.find(a => a.id === accountId);
|
|
33
96
|
useEffect(() => {
|
|
34
97
|
if (selected && !selected.providers.includes(provider)) setProvider(selected.providers[0] ?? "google-antigravity");
|
|
35
98
|
}, [selected, provider]);
|
|
99
|
+
|
|
36
100
|
const catalog = selected?.providerCatalogs?.find(c => c.provider === provider);
|
|
37
101
|
const catalogFreshness = catalog?.freshness === "fresh" && catalog.expiresAt !== null && catalog.expiresAt <= now ? "stale" : catalog?.freshness;
|
|
38
102
|
const declaredPlan = selected?.providerPlans.find(p => p.provider === provider);
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
103
|
+
const knownPlan = declaredPlan?.plan || selected?.inferredPlan || "unknown";
|
|
104
|
+
const effectivePlan = plan || knownPlan;
|
|
105
|
+
const allPlans = effectivePlan === "unknown" || !accountId && !plan;
|
|
106
|
+
const ruleSet = report?.rules.filter(r => r.provider === provider) ?? [];
|
|
107
|
+
const providerRules = ruleSet.filter(r => allPlans || r.plans.includes(effectivePlan) || r.plans.includes("*"));
|
|
108
|
+
const rules = providerRules.filter(r => r.modelPrefix.toLowerCase().includes(ruleFilter.toLowerCase()));
|
|
109
|
+
const observations = selected?.observations.filter(o => o.provider === provider) ?? [];
|
|
110
|
+
|
|
111
|
+
// Plans that change this provider's rules come first; the rest fold away.
|
|
112
|
+
const rulePlans = new Set(ruleSet.flatMap(r => r.plans).filter(p => p !== "*"));
|
|
113
|
+
const offeredPlans = PLANS;
|
|
114
|
+
const relevantPlans = offeredPlans.filter(p => rulePlans.has(p) || p === plan);
|
|
115
|
+
// Folding away a single plan saves nothing, so only fold two or more.
|
|
116
|
+
const foldable = offeredPlans.length - relevantPlans.length >= 2;
|
|
117
|
+
const planChoices = morePlans || !foldable ? offeredPlans : relevantPlans;
|
|
118
|
+
const planMatters = rulePlans.size > 0;
|
|
119
|
+
const clientMatters = ruleSet.some(r => r.client);
|
|
120
|
+
|
|
121
|
+
// Suggestions for the model field: rule families and the account's advertised IDs.
|
|
122
|
+
const suggestions = [...new Set([...ruleSet.filter(r => !r.modelPrefix.includes("*")).map(r => r.modelPrefix), ...(catalog?.models ?? [])])].sort();
|
|
123
|
+
|
|
124
|
+
// Explain as the inputs change. The previous answer stays visible, dimmed,
|
|
125
|
+
// until the new one arrives; late responses for older inputs are dropped.
|
|
126
|
+
const ready = Boolean(report) && (!accountId || Boolean(selected?.providers.includes(provider)));
|
|
127
|
+
useEffect(() => {
|
|
128
|
+
if (!ready || saving) return;
|
|
129
|
+
if (!trimmedModel) { request.current++; setDecision(null); setCheckError(""); return; }
|
|
130
|
+
const id = ++request.current;
|
|
131
|
+
const key = formKey;
|
|
132
|
+
const timer = setTimeout(() => {
|
|
133
|
+
const params = new URLSearchParams({ provider, model: trimmedModel, client });
|
|
45
134
|
if (accountId) params.set("accountId", accountId);
|
|
46
135
|
if (plan) params.set("plan", plan);
|
|
47
136
|
if (at) params.set("at", at);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
137
|
+
api.modelAccess(params)
|
|
138
|
+
.then(result => {
|
|
139
|
+
if (id !== request.current) return;
|
|
140
|
+
setReport(result); setDecision({ report: result, key, model: trimmedModel }); setCheckError("");
|
|
141
|
+
})
|
|
142
|
+
.catch(() => {
|
|
143
|
+
if (id !== request.current) return;
|
|
144
|
+
setDecision(null); setCheckError("Access could not be explained for this account, provider and model.");
|
|
145
|
+
});
|
|
146
|
+
}, 250);
|
|
147
|
+
return () => clearTimeout(timer);
|
|
148
|
+
}, [formKey, ready, saving]);
|
|
149
|
+
|
|
53
150
|
const savePlan = async () => {
|
|
54
151
|
if (!accountId || !plan) return;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
152
|
+
const savedForm = formKey;
|
|
153
|
+
request.current++;
|
|
154
|
+
setSaving(true); setSaveError("");
|
|
155
|
+
try {
|
|
156
|
+
const updated = await api.declareProviderPlan(accountId, provider, plan);
|
|
157
|
+
request.current++;
|
|
158
|
+
setReport(updated);
|
|
159
|
+
if (currentForm.current === savedForm) setPlan("");
|
|
160
|
+
}
|
|
161
|
+
catch { setSaveError("The plan could not be saved."); }
|
|
162
|
+
finally { setSaving(false); }
|
|
59
163
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
164
|
+
|
|
165
|
+
let planHint: string;
|
|
166
|
+
if (declaredPlan) planHint = `Stored declaration, expires ${formatDateTime(declaredPlan.expiresAt)}`;
|
|
167
|
+
else if (selected && selected.providers.length > 1) planHint = "Linked providers need separate plan evidence";
|
|
168
|
+
else if (selected && selected.inferredPlan !== "unknown") planHint = "From the account tier";
|
|
169
|
+
else if (selected) planHint = "Pro without billing evidence stays unknown";
|
|
170
|
+
else planHint = "Lists every rule; checks stay unknown without a plan";
|
|
171
|
+
|
|
172
|
+
const result = decision?.report;
|
|
173
|
+
const pending = decision !== null && decision.key !== formKey;
|
|
174
|
+
const catalogState = result?.catalogAvailability;
|
|
175
|
+
const catalogText = !catalogState || catalogState.state === "unknown"
|
|
176
|
+
? null
|
|
177
|
+
: catalogState.expiresAt != null && catalogState.expiresAt <= now
|
|
178
|
+
? "Catalog snapshot expired"
|
|
179
|
+
: catalogState.state === "advertised" ? "In the account catalog" : "Not in the account catalog";
|
|
180
|
+
|
|
181
|
+
const meta = result?.decision
|
|
182
|
+
? [PLAN_SOURCE[result.planSource ?? "unknown"], catalogText, clientMatters ? "Client declared, not verified" : null, "Does not grant access"].filter(Boolean).join(" · ")
|
|
183
|
+
: null;
|
|
184
|
+
|
|
185
|
+
return (
|
|
186
|
+
<Panel
|
|
187
|
+
flush
|
|
188
|
+
id="model-access"
|
|
189
|
+
class="access-panel"
|
|
190
|
+
title="Model access"
|
|
191
|
+
subtitle="Which plans each model is documented for. Informational only."
|
|
192
|
+
actions={
|
|
193
|
+
<label class="access-account">
|
|
194
|
+
<span class="sr-only">Account</span>
|
|
195
|
+
<select class="select" value={accountId} onChange={e => { setAccount(e.currentTarget.value); setPlan(""); setEvidence(null); }}>
|
|
196
|
+
<option value="">No account</option>
|
|
197
|
+
{report?.accounts.map(a => <option key={a.id} value={a.id}>{masker.value.email(a.label)}</option>)}
|
|
198
|
+
</select>
|
|
199
|
+
</label>
|
|
200
|
+
}
|
|
201
|
+
>
|
|
202
|
+
<div class="access-context">
|
|
203
|
+
<Segmented
|
|
204
|
+
label="Provider"
|
|
205
|
+
size="sm"
|
|
206
|
+
value={provider}
|
|
207
|
+
onChange={p => { setProvider(p); setPlan(""); setMorePlans(false); setEvidence(null); }}
|
|
208
|
+
options={PROVIDERS.map(p => {
|
|
209
|
+
const missing = Boolean(selected) && !selected!.providers.includes(p);
|
|
210
|
+
return { value: p, label: providerLabel(p), disabled: missing, title: missing ? "Not connected on this account" : undefined };
|
|
211
|
+
})}
|
|
212
|
+
/>
|
|
213
|
+
{planMatters && (
|
|
214
|
+
<div class="access-context-group">
|
|
215
|
+
<Segmented
|
|
216
|
+
label="Plan"
|
|
217
|
+
size="sm"
|
|
218
|
+
value={plan}
|
|
219
|
+
onChange={setPlan}
|
|
220
|
+
options={[
|
|
221
|
+
{ value: "", label: selected ? <>Account <span class="access-known">{knownPlan}</span></> : "Any", title: planHint },
|
|
222
|
+
...planChoices.map(p => ({ value: p, label: p, title: selected ? "Assume this plan for the check" : undefined })),
|
|
223
|
+
]}
|
|
224
|
+
/>
|
|
225
|
+
{foldable && (
|
|
226
|
+
<button type="button" class="link-button access-quiet-link" aria-expanded={morePlans} onClick={() => setMorePlans(!morePlans)}>
|
|
227
|
+
{morePlans ? "Fewer" : `+${offeredPlans.length - relevantPlans.length}`}
|
|
228
|
+
</button>
|
|
229
|
+
)}
|
|
230
|
+
</div>
|
|
231
|
+
)}
|
|
232
|
+
{clientMatters && (
|
|
233
|
+
<Segmented label="Client" size="sm" value={client} onChange={setClient} options={CLIENTS.map(c => ({ value: c, label: CLIENT_LABEL[c], title: "Declared client, not verified" }))} />
|
|
234
|
+
)}
|
|
235
|
+
</div>
|
|
236
|
+
|
|
237
|
+
<div class="access-check">
|
|
238
|
+
<div class="access-check-head">
|
|
239
|
+
<label class="field-label" for="access-model">Check a model</label>
|
|
240
|
+
{pickDate || at ? (
|
|
241
|
+
<span class="access-date">
|
|
242
|
+
<input class="input input-sm" type="date" aria-label="Policy date" value={at} onInput={e => setAt(e.currentTarget.value)} />
|
|
243
|
+
<button type="button" class="access-icon-button" aria-label="Use today" onClick={() => { setAt(""); setPickDate(false); }}>
|
|
244
|
+
<Icon name="x" size={14} />
|
|
245
|
+
</button>
|
|
246
|
+
</span>
|
|
247
|
+
) : (
|
|
248
|
+
<button type="button" class="link-button access-quiet-link" onClick={() => setPickDate(true)}>As of today</button>
|
|
249
|
+
)}
|
|
250
|
+
</div>
|
|
251
|
+
<div class={`access-probe${pending ? " is-pending" : ""}`}>
|
|
252
|
+
<input
|
|
253
|
+
id="access-model"
|
|
254
|
+
class="input input-lg mono-input"
|
|
255
|
+
value={model}
|
|
256
|
+
onInput={e => setModel(e.currentTarget.value)}
|
|
257
|
+
maxLength={256}
|
|
258
|
+
spellcheck={false}
|
|
259
|
+
autocomplete="off"
|
|
260
|
+
placeholder="Model ID"
|
|
261
|
+
list="access-model-suggestions"
|
|
262
|
+
/>
|
|
263
|
+
<datalist id="access-model-suggestions">
|
|
264
|
+
{suggestions.map(id => <option key={id} value={id} />)}
|
|
265
|
+
</datalist>
|
|
266
|
+
{result?.decision && !checkError && <span class="access-verdict"><StateMark state={result.decision.state} /></span>}
|
|
267
|
+
</div>
|
|
268
|
+
<div class="access-explain" role="status" aria-busy={pending}>
|
|
269
|
+
{checkError || loadError ? (
|
|
270
|
+
<p class="form-error">{checkError || loadError}</p>
|
|
271
|
+
) : result?.decision ? (
|
|
272
|
+
<>
|
|
273
|
+
<p class="access-reason">{result.decision.reason}</p>
|
|
274
|
+
<p class="access-meta">{meta}</p>
|
|
275
|
+
</>
|
|
276
|
+
) : null}
|
|
277
|
+
{accountId && plan && (
|
|
278
|
+
<p class="access-meta">
|
|
279
|
+
<button type="button" class="link-button" disabled={saving} onClick={() => { void savePlan(); }} title="Stores an unverified operator declaration for 30 days">
|
|
280
|
+
{saving ? "Saving…" : `Save ${plan} as this account's ${providerLabel(provider)} plan`}
|
|
281
|
+
</button>
|
|
282
|
+
{saveError && <span class="form-error"> {saveError}</span>}
|
|
283
|
+
</p>
|
|
284
|
+
)}
|
|
285
|
+
</div>
|
|
286
|
+
|
|
287
|
+
{selected && (
|
|
288
|
+
<div class="access-evidence">
|
|
289
|
+
<p class="access-meta">
|
|
290
|
+
{observations.length > 0 ? (
|
|
291
|
+
<button type="button" class="link-button access-quiet-link" aria-expanded={evidence === "observations"} onClick={() => setEvidence(evidence === "observations" ? null : "observations")}>
|
|
292
|
+
{pluralize(observations.length, "recent observation")}
|
|
293
|
+
</button>
|
|
294
|
+
) : (
|
|
295
|
+
<span>No recent observations</span>
|
|
296
|
+
)}
|
|
297
|
+
<span aria-hidden="true"> · </span>
|
|
298
|
+
{catalog && catalog.observedAt != null ? (
|
|
299
|
+
<button type="button" class="link-button access-quiet-link" aria-expanded={evidence === "catalog"} onClick={() => setEvidence(evidence === "catalog" ? null : "catalog")}>
|
|
300
|
+
{pluralize(catalog.models.length, "advertised model")}{catalogFreshness === "fresh" ? "" : `, ${catalogFreshness}`}
|
|
301
|
+
</button>
|
|
302
|
+
) : (
|
|
303
|
+
<span>Advertised models unknown</span>
|
|
304
|
+
)}
|
|
305
|
+
</p>
|
|
306
|
+
{evidence === "observations" && (
|
|
307
|
+
<div class="access-well">
|
|
308
|
+
<table class="table table-compact">
|
|
309
|
+
<thead>
|
|
310
|
+
<tr>
|
|
311
|
+
<th scope="col">Model</th>
|
|
312
|
+
<th scope="col">Result</th>
|
|
313
|
+
<th scope="col" class="num-col">HTTP</th>
|
|
314
|
+
<th scope="col" class="hide-sm">Observed</th>
|
|
315
|
+
</tr>
|
|
316
|
+
</thead>
|
|
317
|
+
<tbody>
|
|
318
|
+
{observations.map(o => (
|
|
319
|
+
<tr key={`${o.provider}/${o.model}/${o.client}`}>
|
|
320
|
+
<th scope="row">
|
|
321
|
+
<span class="model-id">{o.model}</span>
|
|
322
|
+
<div class="cell-sub">{o.client} client</div>
|
|
323
|
+
</th>
|
|
324
|
+
<td>{o.kind === "model-unavailable" ? "Rejected for this account" : o.kind}</td>
|
|
325
|
+
<td class="num num-col">{o.status ?? <span class="muted">—</span>}</td>
|
|
326
|
+
<td class="num hide-sm" title={`Expires ${new Date(o.expiresAt).toISOString()}`}>{formatDateTime(o.observedAt)}</td>
|
|
327
|
+
</tr>
|
|
328
|
+
))}
|
|
329
|
+
</tbody>
|
|
330
|
+
</table>
|
|
331
|
+
</div>
|
|
332
|
+
)}
|
|
333
|
+
{evidence === "catalog" && catalog && (
|
|
334
|
+
<div class="access-well">
|
|
335
|
+
<p class="access-meta">
|
|
336
|
+
{catalog.source} · observed {catalog.observedAt === null ? "unknown" : formatDateTime(catalog.observedAt)} · valid until {catalog.expiresAt === null ? "unknown" : formatDateTime(catalog.expiresAt)}
|
|
337
|
+
</p>
|
|
338
|
+
<div class="tag-row">
|
|
339
|
+
{catalog.models.map(id => (
|
|
340
|
+
<button key={id} type="button" class="tag access-model-tag" title="Check this model" onClick={() => setModel(id)}>{id}</button>
|
|
341
|
+
))}
|
|
342
|
+
</div>
|
|
343
|
+
</div>
|
|
344
|
+
)}
|
|
345
|
+
</div>
|
|
346
|
+
)}
|
|
347
|
+
</div>
|
|
348
|
+
|
|
349
|
+
<div class="toolbar panel-toolbar access-rules-toolbar">
|
|
350
|
+
<h3 class="access-rules-title">
|
|
351
|
+
Rules <span class="num muted">{rules.length}</span>
|
|
352
|
+
</h3>
|
|
353
|
+
<SearchInput value={ruleFilter} onInput={setRuleFilter} placeholder="Filter" label="Filter rules by model" />
|
|
354
|
+
</div>
|
|
355
|
+
|
|
356
|
+
{!report ? (
|
|
357
|
+
loadError ? null : <div class="panel-loading"><Spinner /></div>
|
|
358
|
+
) : rules.length === 0 ? (
|
|
359
|
+
<EmptyState icon="search" title={providerRules.length === 0 ? "No rules for this provider and plan" : "No rules match"}>
|
|
360
|
+
{providerRules.length === 0 ? "Without a rule, checks report access as unknown." : undefined}
|
|
361
|
+
</EmptyState>
|
|
362
|
+
) : (
|
|
363
|
+
<div class="table-scroll">
|
|
364
|
+
<table class="table access-table">
|
|
365
|
+
<thead>
|
|
366
|
+
<tr>
|
|
367
|
+
<th scope="col">Model</th>
|
|
368
|
+
<th scope="col">Access</th>
|
|
369
|
+
<th scope="col" class="hide-sm">Plans</th>
|
|
370
|
+
<th scope="col">Note</th>
|
|
371
|
+
</tr>
|
|
372
|
+
</thead>
|
|
373
|
+
<tbody>
|
|
374
|
+
{rules.map(r => {
|
|
375
|
+
const url = r.source.startsWith("https://");
|
|
376
|
+
return (
|
|
377
|
+
<tr key={r.id}>
|
|
378
|
+
<th scope="row">
|
|
379
|
+
<span class="model-id">{r.modelPrefix}</span>
|
|
380
|
+
{(r.exact || r.client) && (
|
|
381
|
+
<div class="cell-sub">
|
|
382
|
+
{r.exact ? "Exact ID" : `${r.client === "opencode" ? "OpenCode" : r.client} client`}
|
|
383
|
+
</div>
|
|
384
|
+
)}
|
|
385
|
+
</th>
|
|
386
|
+
<td>
|
|
387
|
+
<StateMark state={r.state} title={`${EVIDENCE[r.evidence]} · verified ${r.verifiedAt} · review ${r.reviewAfter}`} />
|
|
388
|
+
{r.validUntil && <div class="cell-sub num">Until {r.validUntil}</div>}
|
|
389
|
+
{r.evidence !== "documented" && <div class="cell-sub">{EVIDENCE[r.evidence]}</div>}
|
|
390
|
+
</td>
|
|
391
|
+
<td class="hide-sm access-plans" title={r.plans.join(", ")}>{planList(r.plans)}</td>
|
|
392
|
+
<td class="access-note">
|
|
393
|
+
{r.note}
|
|
394
|
+
{url ? (
|
|
395
|
+
<a href={r.source} target="_blank" rel="noreferrer" class="access-source" title={r.source} aria-label={`Source: ${sourceHost(r.source)}`}>
|
|
396
|
+
<Icon name="arrowUpRight" size={13} />
|
|
397
|
+
</a>
|
|
398
|
+
) : (
|
|
399
|
+
<div class="cell-sub">{r.source}</div>
|
|
400
|
+
)}
|
|
401
|
+
</td>
|
|
402
|
+
</tr>
|
|
403
|
+
);
|
|
404
|
+
})}
|
|
405
|
+
</tbody>
|
|
406
|
+
</table>
|
|
407
|
+
</div>
|
|
408
|
+
)}
|
|
409
|
+
</Panel>
|
|
410
|
+
);
|
|
88
411
|
}
|
package/src/web/styles/app.css
CHANGED
|
@@ -4572,6 +4572,274 @@ a.hero-metric:hover {
|
|
|
4572
4572
|
}
|
|
4573
4573
|
}
|
|
4574
4574
|
|
|
4575
|
+
/* ── Model access (Models page) ───────────────────────────────────────── */
|
|
4576
|
+
|
|
4577
|
+
.access-account .select {
|
|
4578
|
+
height: 30px;
|
|
4579
|
+
max-width: 220px;
|
|
4580
|
+
font-size: 13px;
|
|
4581
|
+
}
|
|
4582
|
+
|
|
4583
|
+
/* Provider, plan and client: one quiet row the check and the rules share. */
|
|
4584
|
+
.access-context {
|
|
4585
|
+
display: flex;
|
|
4586
|
+
align-items: center;
|
|
4587
|
+
gap: 12px 16px;
|
|
4588
|
+
flex-wrap: wrap;
|
|
4589
|
+
padding: 4px 20px 20px;
|
|
4590
|
+
}
|
|
4591
|
+
|
|
4592
|
+
.access-context > .segmented,
|
|
4593
|
+
.access-context-group > .segmented {
|
|
4594
|
+
max-width: 100%;
|
|
4595
|
+
overflow-x: auto;
|
|
4596
|
+
}
|
|
4597
|
+
|
|
4598
|
+
.access-context-group {
|
|
4599
|
+
display: flex;
|
|
4600
|
+
align-items: center;
|
|
4601
|
+
gap: 8px;
|
|
4602
|
+
min-width: 0;
|
|
4603
|
+
}
|
|
4604
|
+
|
|
4605
|
+
.access-known {
|
|
4606
|
+
margin-left: 4px;
|
|
4607
|
+
color: var(--text-3);
|
|
4608
|
+
font-weight: 500;
|
|
4609
|
+
}
|
|
4610
|
+
|
|
4611
|
+
.segmented button:disabled {
|
|
4612
|
+
color: var(--text-4);
|
|
4613
|
+
cursor: not-allowed;
|
|
4614
|
+
}
|
|
4615
|
+
|
|
4616
|
+
.link-button.access-quiet-link {
|
|
4617
|
+
color: var(--text-3);
|
|
4618
|
+
font-weight: 500;
|
|
4619
|
+
font-size: 12.5px;
|
|
4620
|
+
}
|
|
4621
|
+
|
|
4622
|
+
.link-button.access-quiet-link:hover {
|
|
4623
|
+
color: var(--text);
|
|
4624
|
+
}
|
|
4625
|
+
|
|
4626
|
+
.access-check {
|
|
4627
|
+
display: flex;
|
|
4628
|
+
flex-direction: column;
|
|
4629
|
+
gap: 8px;
|
|
4630
|
+
padding: 20px;
|
|
4631
|
+
border-top: 1px solid var(--border);
|
|
4632
|
+
}
|
|
4633
|
+
|
|
4634
|
+
.access-check-head {
|
|
4635
|
+
display: flex;
|
|
4636
|
+
align-items: center;
|
|
4637
|
+
justify-content: space-between;
|
|
4638
|
+
gap: 12px;
|
|
4639
|
+
min-height: 30px;
|
|
4640
|
+
}
|
|
4641
|
+
|
|
4642
|
+
.access-date {
|
|
4643
|
+
display: inline-flex;
|
|
4644
|
+
align-items: center;
|
|
4645
|
+
gap: 4px;
|
|
4646
|
+
}
|
|
4647
|
+
|
|
4648
|
+
.access-date .input {
|
|
4649
|
+
width: 152px;
|
|
4650
|
+
}
|
|
4651
|
+
|
|
4652
|
+
.access-icon-button {
|
|
4653
|
+
display: inline-flex;
|
|
4654
|
+
align-items: center;
|
|
4655
|
+
justify-content: center;
|
|
4656
|
+
width: 28px;
|
|
4657
|
+
height: 28px;
|
|
4658
|
+
border: 0;
|
|
4659
|
+
border-radius: var(--radius-xs);
|
|
4660
|
+
background: none;
|
|
4661
|
+
color: var(--text-3);
|
|
4662
|
+
cursor: pointer;
|
|
4663
|
+
transition: background-color 0.15s, color 0.15s;
|
|
4664
|
+
}
|
|
4665
|
+
|
|
4666
|
+
.access-icon-button:hover {
|
|
4667
|
+
background: var(--surface-2);
|
|
4668
|
+
color: var(--text);
|
|
4669
|
+
}
|
|
4670
|
+
|
|
4671
|
+
/* The verdict sits inside the field, so the question and answer read as one. */
|
|
4672
|
+
.access-probe {
|
|
4673
|
+
position: relative;
|
|
4674
|
+
}
|
|
4675
|
+
|
|
4676
|
+
.access-probe .input {
|
|
4677
|
+
width: 100%;
|
|
4678
|
+
padding-right: 136px;
|
|
4679
|
+
}
|
|
4680
|
+
|
|
4681
|
+
.mono-input {
|
|
4682
|
+
font-family: var(--mono);
|
|
4683
|
+
font-size: 14px;
|
|
4684
|
+
}
|
|
4685
|
+
|
|
4686
|
+
/* Suggestions appear while typing; the native arrow would read as a select. */
|
|
4687
|
+
.mono-input::-webkit-calendar-picker-indicator {
|
|
4688
|
+
display: none !important;
|
|
4689
|
+
}
|
|
4690
|
+
|
|
4691
|
+
.access-verdict {
|
|
4692
|
+
position: absolute;
|
|
4693
|
+
top: 50%;
|
|
4694
|
+
right: 16px;
|
|
4695
|
+
transform: translateY(-50%);
|
|
4696
|
+
pointer-events: none;
|
|
4697
|
+
transition: opacity 0.15s;
|
|
4698
|
+
}
|
|
4699
|
+
|
|
4700
|
+
.access-explain {
|
|
4701
|
+
display: flex;
|
|
4702
|
+
flex-direction: column;
|
|
4703
|
+
gap: 4px;
|
|
4704
|
+
min-height: 44px;
|
|
4705
|
+
padding-top: 4px;
|
|
4706
|
+
transition: opacity 0.15s;
|
|
4707
|
+
}
|
|
4708
|
+
|
|
4709
|
+
.access-probe.is-pending .access-verdict,
|
|
4710
|
+
.access-probe.is-pending + .access-explain {
|
|
4711
|
+
opacity: 0.5;
|
|
4712
|
+
}
|
|
4713
|
+
|
|
4714
|
+
.access-reason {
|
|
4715
|
+
color: var(--text-2);
|
|
4716
|
+
}
|
|
4717
|
+
|
|
4718
|
+
.access-meta {
|
|
4719
|
+
font-size: 12.5px;
|
|
4720
|
+
color: var(--text-3);
|
|
4721
|
+
}
|
|
4722
|
+
|
|
4723
|
+
.access-state {
|
|
4724
|
+
display: inline-flex;
|
|
4725
|
+
align-items: center;
|
|
4726
|
+
gap: 8px;
|
|
4727
|
+
font-size: 13px;
|
|
4728
|
+
font-weight: 560;
|
|
4729
|
+
color: var(--tone);
|
|
4730
|
+
white-space: nowrap;
|
|
4731
|
+
}
|
|
4732
|
+
|
|
4733
|
+
.access-state.tone-neutral {
|
|
4734
|
+
color: var(--text-2);
|
|
4735
|
+
}
|
|
4736
|
+
|
|
4737
|
+
.access-dot {
|
|
4738
|
+
width: 6px;
|
|
4739
|
+
height: 6px;
|
|
4740
|
+
border-radius: 50%;
|
|
4741
|
+
background: var(--tone);
|
|
4742
|
+
box-shadow: 0 0 0 3px var(--tone-soft);
|
|
4743
|
+
}
|
|
4744
|
+
|
|
4745
|
+
.access-evidence {
|
|
4746
|
+
display: flex;
|
|
4747
|
+
flex-direction: column;
|
|
4748
|
+
gap: 12px;
|
|
4749
|
+
padding-top: 12px;
|
|
4750
|
+
border-top: 1px solid var(--border);
|
|
4751
|
+
}
|
|
4752
|
+
|
|
4753
|
+
.access-well {
|
|
4754
|
+
display: flex;
|
|
4755
|
+
flex-direction: column;
|
|
4756
|
+
gap: 12px;
|
|
4757
|
+
padding: 12px 16px;
|
|
4758
|
+
border-radius: var(--radius);
|
|
4759
|
+
background: var(--surface-2);
|
|
4760
|
+
}
|
|
4761
|
+
|
|
4762
|
+
.access-well .table th,
|
|
4763
|
+
.access-well .table td {
|
|
4764
|
+
border-color: var(--border);
|
|
4765
|
+
}
|
|
4766
|
+
|
|
4767
|
+
.access-model-tag {
|
|
4768
|
+
font-family: var(--mono);
|
|
4769
|
+
cursor: pointer;
|
|
4770
|
+
transition: color 0.15s, border-color 0.15s;
|
|
4771
|
+
}
|
|
4772
|
+
|
|
4773
|
+
.access-model-tag:hover {
|
|
4774
|
+
color: var(--text);
|
|
4775
|
+
border-color: var(--border-strong);
|
|
4776
|
+
}
|
|
4777
|
+
|
|
4778
|
+
.access-rules-toolbar {
|
|
4779
|
+
padding-top: 16px;
|
|
4780
|
+
border-top: 1px solid var(--border);
|
|
4781
|
+
}
|
|
4782
|
+
|
|
4783
|
+
.access-rules-title {
|
|
4784
|
+
display: flex;
|
|
4785
|
+
align-items: baseline;
|
|
4786
|
+
gap: 8px;
|
|
4787
|
+
font-size: 14px;
|
|
4788
|
+
font-weight: 600;
|
|
4789
|
+
color: var(--text);
|
|
4790
|
+
}
|
|
4791
|
+
|
|
4792
|
+
.access-rules-title .num {
|
|
4793
|
+
font-weight: 500;
|
|
4794
|
+
}
|
|
4795
|
+
|
|
4796
|
+
.access-rules-toolbar .search {
|
|
4797
|
+
min-width: 200px;
|
|
4798
|
+
}
|
|
4799
|
+
|
|
4800
|
+
.access-table .model-id {
|
|
4801
|
+
white-space: nowrap;
|
|
4802
|
+
word-break: normal;
|
|
4803
|
+
}
|
|
4804
|
+
|
|
4805
|
+
.access-table tbody th .cell-sub {
|
|
4806
|
+
white-space: nowrap;
|
|
4807
|
+
}
|
|
4808
|
+
|
|
4809
|
+
.access-plans {
|
|
4810
|
+
color: var(--text-3);
|
|
4811
|
+
white-space: nowrap;
|
|
4812
|
+
}
|
|
4813
|
+
|
|
4814
|
+
.access-note {
|
|
4815
|
+
min-width: 240px;
|
|
4816
|
+
color: var(--text-2);
|
|
4817
|
+
}
|
|
4818
|
+
|
|
4819
|
+
.access-source {
|
|
4820
|
+
display: inline-flex;
|
|
4821
|
+
align-items: center;
|
|
4822
|
+
margin-left: 4px;
|
|
4823
|
+
vertical-align: -2px;
|
|
4824
|
+
color: var(--text-3);
|
|
4825
|
+
transition: color 0.15s;
|
|
4826
|
+
}
|
|
4827
|
+
|
|
4828
|
+
.access-source:hover {
|
|
4829
|
+
color: var(--text);
|
|
4830
|
+
}
|
|
4831
|
+
|
|
4832
|
+
@container canvas (max-width: 700px) {
|
|
4833
|
+
.access-probe .input {
|
|
4834
|
+
padding-right: 124px;
|
|
4835
|
+
}
|
|
4836
|
+
|
|
4837
|
+
.access-rules-toolbar .search {
|
|
4838
|
+
min-width: 0;
|
|
4839
|
+
flex: 1;
|
|
4840
|
+
}
|
|
4841
|
+
}
|
|
4842
|
+
|
|
4575
4843
|
/* ── Keys ─────────────────────────────────────────────────────────────── */
|
|
4576
4844
|
|
|
4577
4845
|
.model-groups {
|