quotacap 0.0.59 → 0.0.61

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/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // generated by scripts/build-embed.mjs — do not edit
2
- export const VERSION = "0.0.59";
2
+ export const VERSION = "0.0.61";
@@ -1,6 +1,11 @@
1
1
  import React from "react";
2
+ export declare function iconKey(id?: string, title?: string): string;
3
+ /**
4
+ * Provider brand mark: renders the official vector logo for supported AI providers,
5
+ * tinted with `providerTint`. Unknown ids fall back to a styled monogram letter.
6
+ */
2
7
  export declare function ProviderIcon({ id, title, size, }: {
3
- id: string;
8
+ id?: string;
4
9
  title: string;
5
10
  size?: number;
6
11
  }): React.JSX.Element;
@@ -1,23 +1,63 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- /** Brand-mark paths from the signed-off concept. Unknown ids fall back to a letter. */
3
- const PATHS = {
4
- kimi: 'M12 7v5l3 2M12 12m-8.5 0a8.5 8.5 0 1 0 17 0a8.5 8.5 0 1 0-17 0',
5
- claude: "M6 3h8l4 4v14H6zM9 12h6M9 16h6",
6
- grok: "M12 3.5l2.6 5.5 5.9.8-4.3 4.2 1 5.9-5.2-2.8-5.2 2.8 1-5.9L3.5 9.8l5.9-.8z",
7
- codex: "M8 5l10 7-10 7z",
8
- agy: "M12 4l7 7-7 9-7-9z",
9
- muse: "M12 3l1.8 6.2L20 11l-6.2 1.8L12 19l-1.8-6.2L4 11l6.2-1.8z",
2
+ /** Official vector brand marks for supported providers. Unknown ids fall back to a monogram. */
3
+ const LOGO_PATHS = {
4
+ claude: (_jsx("path", { d: "M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z" })),
5
+ codex: (_jsx("path", { d: "M21.55 10.004a5.416 5.416 0 00-.478-4.501c-1.217-2.09-3.662-3.166-6.05-2.66A5.59 5.59 0 0010.831 1C8.39.995 6.224 2.546 5.473 4.838A5.553 5.553 0 001.76 7.496a5.487 5.487 0 00.691 6.5 5.416 5.416 0 00.477 4.502c1.217 2.09 3.662 3.165 6.05 2.66A5.586 5.586 0 0013.168 23c2.443.006 4.61-1.546 5.361-3.84a5.553 5.553 0 003.715-2.66 5.488 5.488 0 00-.693-6.497v.001zm-8.381 11.558a4.199 4.199 0 01-2.675-.954c.034-.018.093-.05.132-.074l4.44-2.53a.71.71 0 00.364-.623v-6.176l1.877 1.069c.02.01.033.029.036.05v5.115c-.003 2.274-1.87 4.118-4.174 4.123zM4.192 17.78a4.059 4.059 0 01-.498-2.763c.032.02.09.055.131.078l4.44 2.53c.225.13.504.13.73 0l5.42-3.088v2.138a.068.068 0 01-.027.057L9.9 19.288c-1.999 1.136-4.552.46-5.707-1.51h-.001zM3.023 8.216A4.15 4.15 0 015.198 6.41l-.002.151v5.06a.711.711 0 00.364.624l5.42 3.087-1.876 1.07a.067.067 0 01-.063.005l-4.489-2.559c-1.995-1.14-2.679-3.658-1.53-5.63h.001zm15.417 3.54l-5.42-3.088L14.896 7.6a.067.067 0 01.063-.006l4.489 2.557c1.998 1.14 2.683 3.662 1.529 5.633a4.163 4.163 0 01-2.174 1.807V12.38a.71.71 0 00-.363-.623zm1.867-2.773a6.04 6.04 0 00-.132-.078l-4.44-2.53a.731.731 0 00-.729 0l-5.42 3.088V7.325a.068.068 0 01.027-.057L14.1 4.713c2-1.137 4.555-.46 5.707 1.513.487.833.664 1.809.499 2.757h.001zm-11.741 3.81l-1.877-1.068a.065.065 0 01-.036-.051V6.559c.001-2.277 1.873-4.122 4.181-4.12.976 0 1.92.338 2.671.954-.034.018-.092.05-.131.073l-4.44 2.53a.71.71 0 00-.365.623l-.003 6.173v.002zm1.02-2.168L12 9.25l2.414 1.375v2.75L12 14.75l-2.415-1.375v-2.75z" })),
6
+ grok: (_jsx("path", { d: "m3.005 8.858 8.783 12.544h3.904L6.908 8.858zM6.905 15.825 3 21.402h3.907l1.951-2.788zM16.585 2l-6.75 9.64 1.953 2.79L20.492 2zM17.292 7.965v13.437h3.2V3.395z" })),
7
+ kimi: (_jsxs(_Fragment, { children: [_jsx("path", { d: "M21.846 0a1.923 1.923 0 1 1 0 3.846H20.15a.226.226 0 0 1-.227-.226V1.923C19.923.861 20.784 0 21.846 0z" }), _jsx("path", { d: "M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 0 0-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 0 1 .205-.023l6.484 4.772a7.677 7.677 0 0 0 3.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 0 1-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z" })] })),
8
+ agy: (_jsx("path", { d: "M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81" })),
9
+ "opencode-go": (_jsx("path", { d: "M16 6H8v12h8V6zm4 16H4V2h16v20z" })),
10
+ muse: (_jsx("path", { d: "M12 3l2.2 6.8L21 12l-6.8 2.2L12 21l-2.2-6.8L3 12l6.8-2.2L12 3z" })),
10
11
  };
11
- function iconKey(id) {
12
- return id.split(":")[0];
12
+ export function iconKey(id, title) {
13
+ if (id) {
14
+ const raw = id.split(":")[0].toLowerCase();
15
+ if (raw === "claude" || raw.includes("claude") || raw.includes("anthropic"))
16
+ return "claude";
17
+ if (raw === "codex" || raw.includes("codex") || raw.includes("openai") || raw.includes("chatgpt"))
18
+ return "codex";
19
+ if (raw === "kimi" || raw.includes("kimi") || raw.includes("moonshot"))
20
+ return "kimi";
21
+ if (raw === "grok" || raw.includes("grok") || raw.includes("xai"))
22
+ return "grok";
23
+ if (raw === "agy" || raw.includes("agy") || raw.includes("gemini") || raw.includes("antigravity"))
24
+ return "agy";
25
+ if (raw === "opencode-go" || raw.includes("opencode"))
26
+ return "opencode-go";
27
+ if (raw === "muse" || raw.includes("muse"))
28
+ return "muse";
29
+ return raw;
30
+ }
31
+ if (title) {
32
+ const lower = title.toLowerCase();
33
+ if (lower.includes("claude") || lower.includes("anthropic"))
34
+ return "claude";
35
+ if (lower.includes("codex") || lower.includes("openai") || lower.includes("chatgpt"))
36
+ return "codex";
37
+ if (lower.includes("kimi") || lower.includes("moonshot"))
38
+ return "kimi";
39
+ if (lower.includes("grok") || lower.includes("xai"))
40
+ return "grok";
41
+ if (lower.includes("gemini") || lower.includes("agy") || lower.includes("antigravity"))
42
+ return "agy";
43
+ if (lower.includes("opencode"))
44
+ return "opencode-go";
45
+ if (lower.includes("muse"))
46
+ return "muse";
47
+ }
48
+ return "";
13
49
  }
14
- export function ProviderIcon({ id, title, size = 17, }) {
15
- const key = iconKey(id);
16
- const d = PATHS[key];
17
- if (!d) {
18
- return _jsx("span", { "aria-hidden": "true", children: title.charAt(0) });
50
+ /**
51
+ * Provider brand mark: renders the official vector logo for supported AI providers,
52
+ * tinted with `providerTint`. Unknown ids fall back to a styled monogram letter.
53
+ */
54
+ export function ProviderIcon({ id, title, size = 18, }) {
55
+ const key = iconKey(id, title);
56
+ const mark = LOGO_PATHS[key];
57
+ if (!mark) {
58
+ return (_jsx("span", { className: "pmono", style: { fontSize: Math.round(size * 0.88) }, "aria-hidden": "true", children: title.trim().charAt(0).toUpperCase() }));
19
59
  }
20
- return (_jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.9", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: key === "kimi" ? (_jsxs(_Fragment, { children: [_jsx("path", { d: "M12 7v5l3 2" }), _jsx("circle", { cx: "12", cy: "12", r: "8.5" })] })) : key === "claude" ? (_jsxs(_Fragment, { children: [_jsx("path", { d: "M6 3h8l4 4v14H6z" }), _jsx("path", { d: "M9 12h6M9 16h6" })] })) : (_jsx("path", { d: d })) }));
60
+ return (_jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "currentColor", fillRule: "evenodd", "aria-hidden": "true", style: { display: "block" }, children: mark }));
21
61
  }
22
62
  export function providerTint(id) {
23
63
  const key = iconKey(id);
@@ -2,6 +2,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
2
2
  import { ageLabel, oldestReadingAt } from "../state.js";
3
3
  import { quotaResetsAt, quotaUsedPct, timeLeft } from "./PaceBar.js";
4
4
  import { clockText } from "../../../src/format/time.js";
5
+ import { rateLimitWaits } from "../../../src/format/rate-limit-wait.js";
5
6
  import { ProviderIcon, providerTint } from "./ProviderIcon.js";
6
7
  /**
7
8
  * Lane membership from server urgency only. Any exclusionReason, an
@@ -56,7 +57,10 @@ function LaneSection({ testId, label, tintClass, laneClass, icon, members, provi
56
57
  const left = resetIso ? timeLeft(resetIso, asOfMs) : null;
57
58
  const usedPct = memberProvider ? quotaUsedPct(memberProvider) : null;
58
59
  const name = memberProvider?.displayName ?? m.provider;
59
- return (_jsxs("div", { className: "rsub", children: [_jsx("span", { className: "sq", style: providerTint(m.provider), "aria-hidden": "true", children: _jsx(ProviderIcon, { id: m.provider, title: name, size: 13 }) }), _jsx("div", { className: "rnm-group", children: _jsx("button", { type: "button", className: "rnm", onClick: () => onSelectProvider?.(m.provider), "aria-label": `View ${name} details`, children: name }) }), _jsx("span", { className: "rnum", children: quota ? (_jsxs(_Fragment, { children: [_jsxs("b", { children: [usedPct, "%"] }), " used", left ? (_jsxs(_Fragment, { children: [" · ", _jsx("b", { children: left }), " left"] })) : null] })) : null })] }, m.provider));
60
+ // A full short window blocks the provider until the last one clears.
61
+ const waits = memberProvider && Number.isFinite(asOfMs) ? rateLimitWaits(memberProvider, new Date(asOfMs)) : [];
62
+ const blocked = waits[waits.length - 1];
63
+ return (_jsxs("div", { className: "rsub", children: [_jsx("span", { className: "sq", style: providerTint(m.provider), "aria-hidden": "true", children: _jsx(ProviderIcon, { id: m.provider, title: name, size: 13 }) }), _jsx("div", { className: "rnm-group", children: _jsx("button", { type: "button", className: "rnm", onClick: () => onSelectProvider?.(m.provider), "aria-label": `View ${name} details`, children: name }) }), _jsx("span", { className: "rnum", children: quota ? (_jsxs(_Fragment, { children: [_jsxs("b", { children: [usedPct, "%"] }), " used", left ? (_jsxs(_Fragment, { children: [" · ", _jsx("b", { children: left }), " left"] })) : null, blocked ? (_jsxs("span", { className: "rwait", "data-testid": `lane-wait-${m.provider}`, children: [_jsx("span", { className: "rwait-sep", children: " · " }), blocked.until ? (_jsxs(_Fragment, { children: ["back ", _jsx("b", { children: blocked.until })] })) : (`${blocked.label} reached`)] })) : null] })) : null })] }, m.provider));
60
64
  }) })] }));
61
65
  }
62
66
  /**