free-coding-models 0.5.57 → 0.5.59
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/README.md +86 -0
- package/changelog/v0.5.58.md +42 -0
- package/changelog/v0.5.59.md +52 -0
- package/package.json +4 -4
- package/src/core/ping.js +7 -2
- package/src/core/probe-cache.js +515 -0
- package/src/core/provider-quota-fetchers.js +254 -2
- package/src/core/router-daemon.js +81 -4
- package/src/core/utils.js +24 -1
- package/src/tui/app.js +132 -4
- package/src/tui/cli-help.js +3 -0
- package/src/tui/key-handler.js +19 -0
- package/src/tui/render-table.js +50 -2
- package/src/tui/tui-state.js +11 -0
- package/web/dist/assets/{index-BoJ4r2gC.js → index-C_ZdUGrS.js} +2 -2
- package/web/dist/assets/{index-BkK1gdJN.css → index-wI9xrm0w.css} +1 -1
- package/web/dist/index.html +2 -2
- package/web/src/components/router/RouterView.jsx +34 -0
- package/web/src/components/router/RouterView.module.css +53 -0
package/web/dist/index.html
CHANGED
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
49
49
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
50
50
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
|
|
51
|
-
<script type="module" crossorigin src="/assets/index-
|
|
52
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
51
|
+
<script type="module" crossorigin src="/assets/index-C_ZdUGrS.js"></script>
|
|
52
|
+
<link rel="stylesheet" crossorigin href="/assets/index-wI9xrm0w.css">
|
|
53
53
|
</head>
|
|
54
54
|
<body>
|
|
55
55
|
<div id="root"></div>
|
|
@@ -1015,6 +1015,40 @@ export default function RouterView({ onClose, onToast, favorites }) {
|
|
|
1015
1015
|
</div>
|
|
1016
1016
|
)}
|
|
1017
1017
|
|
|
1018
|
+
{/* Passive quota (t2): per-provider live quota from response headers.
|
|
1019
|
+
📖 Updated every /stats poll (5s). See provider-quota-fetchers.js. */}
|
|
1020
|
+
{stats?.quota && Object.keys(stats.quota).length > 0 && (
|
|
1021
|
+
<div className={styles.section} style={{ marginTop: 12 }}>
|
|
1022
|
+
<h3 className={styles.sectionTitle}>
|
|
1023
|
+
📊 Provider Quota
|
|
1024
|
+
<span className={styles.miniPgHint}>live from response headers (no extra requests)</span>
|
|
1025
|
+
</h3>
|
|
1026
|
+
<div className={styles.quotaGrid}>
|
|
1027
|
+
{Object.entries(stats.quota)
|
|
1028
|
+
.sort((a, b) => (a[1]?.percent ?? 100) - (b[1]?.percent ?? 100))
|
|
1029
|
+
.map(([providerKey, snap]) => {
|
|
1030
|
+
const pct = snap?.percent ?? 0
|
|
1031
|
+
const color = pct <= 10 ? '#dc2626' : pct <= 25 ? '#f59e0b' : '#16a34a'
|
|
1032
|
+
const window = snap?.windowType && snap.windowType !== 'unknown' ? snap.windowType : ''
|
|
1033
|
+
const source = snap?.source === 'header' ? '🛰️' : '🔌'
|
|
1034
|
+
return (
|
|
1035
|
+
<div key={providerKey} className={styles.quotaCell} title={`${providerKey}: ${snap?.remaining ?? '?'}/${snap?.limit ?? '?'} (${pct}%) ${window ? `[${window}]` : ''}`}>
|
|
1036
|
+
<span className={styles.quotaSource}>{source}</span>
|
|
1037
|
+
<span className={styles.quotaName}>{providerKey}</span>
|
|
1038
|
+
<div className={styles.quotaBar}>
|
|
1039
|
+
<div
|
|
1040
|
+
className={styles.quotaFill}
|
|
1041
|
+
style={{ width: `${pct}%`, background: color }}
|
|
1042
|
+
/>
|
|
1043
|
+
</div>
|
|
1044
|
+
<span className={styles.quotaPct} style={{ color }}>{pct}%</span>
|
|
1045
|
+
</div>
|
|
1046
|
+
)
|
|
1047
|
+
})}
|
|
1048
|
+
</div>
|
|
1049
|
+
</div>
|
|
1050
|
+
)}
|
|
1051
|
+
|
|
1018
1052
|
{/* Server health (small chip at the bottom for visibility) */}
|
|
1019
1053
|
<div className={styles.section} style={{ marginBottom: 0, marginTop: 16 }}>
|
|
1020
1054
|
<span className={styles.saveStatus}>
|
|
@@ -1124,4 +1124,57 @@
|
|
|
1124
1124
|
.miniPgStopBtn {
|
|
1125
1125
|
background: var(--error, #ff5a5a);
|
|
1126
1126
|
color: #fff;
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
/* ── Passive quota (t2) ───────────────────────────────────────────────── */
|
|
1130
|
+
|
|
1131
|
+
.quotaGrid {
|
|
1132
|
+
display: grid;
|
|
1133
|
+
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
|
|
1134
|
+
gap: 8px;
|
|
1135
|
+
margin-top: 8px;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
.quotaCell {
|
|
1139
|
+
display: grid;
|
|
1140
|
+
grid-template-columns: 18px 1fr auto;
|
|
1141
|
+
align-items: center;
|
|
1142
|
+
gap: 4px 8px;
|
|
1143
|
+
padding: 6px 10px;
|
|
1144
|
+
border-radius: 6px;
|
|
1145
|
+
background: rgba(255, 255, 255, 0.04);
|
|
1146
|
+
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
.quotaSource {
|
|
1150
|
+
font-size: 14px;
|
|
1151
|
+
text-align: center;
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
.quotaName {
|
|
1155
|
+
font-size: 12px;
|
|
1156
|
+
font-weight: 600;
|
|
1157
|
+
opacity: 0.9;
|
|
1158
|
+
text-transform: lowercase;
|
|
1159
|
+
font-family: var(--mono, ui-monospace, SFMono-Regular, monospace);
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
.quotaBar {
|
|
1163
|
+
grid-column: 1 / -1;
|
|
1164
|
+
height: 4px;
|
|
1165
|
+
background: rgba(255, 255, 255, 0.08);
|
|
1166
|
+
border-radius: 2px;
|
|
1167
|
+
overflow: hidden;
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
.quotaFill {
|
|
1171
|
+
height: 100%;
|
|
1172
|
+
transition: width 0.4s ease-out;
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
.quotaPct {
|
|
1176
|
+
font-size: 12px;
|
|
1177
|
+
font-weight: 700;
|
|
1178
|
+
font-variant-numeric: tabular-nums;
|
|
1179
|
+
text-align: right;
|
|
1127
1180
|
}
|