agy-family 0.6.7 → 0.6.9
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/package.json +1 -1
- package/packages/cli/bin/agy-family.mjs +1 -1
- package/packages/cli/src/hook.mjs +1 -1
- package/packages/core/src/sync.mjs +2 -2
- package/packages/server-core/src/index.mjs +3 -3
- package/packages/server-core/src/stats.mjs +4 -3
- package/packages/server-core/src/ui.mjs +401 -120
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agy-family",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.9",
|
|
4
4
|
"description": "Zero-privacy-leak transparent usage dashboard, /family slash command, and fair-use budget guardrail for Google One / Antigravity family groups.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -890,7 +890,7 @@ export async function runHeadlessSync({ cfg, fullSync = false, home = homedir(),
|
|
|
890
890
|
const { payload, scan, nextSyncedHashes, nextAccountLedger } = await buildSyncPayload({
|
|
891
891
|
deviceId,
|
|
892
892
|
clientKind: 'cli',
|
|
893
|
-
clientVersion: '0.6.
|
|
893
|
+
clientVersion: '0.6.9',
|
|
894
894
|
home,
|
|
895
895
|
fileCache: cache,
|
|
896
896
|
syncedHashes: prevHashes,
|
|
@@ -83,7 +83,7 @@ export function diffSyncBuckets(buckets, syncedHashes = null, { fullSync = false
|
|
|
83
83
|
export async function buildSyncPayload({
|
|
84
84
|
deviceId,
|
|
85
85
|
clientKind = 'cli',
|
|
86
|
-
clientVersion = '0.6.
|
|
86
|
+
clientVersion = '0.6.9',
|
|
87
87
|
home,
|
|
88
88
|
roots = null,
|
|
89
89
|
sourceFilter = 'all',
|
|
@@ -164,7 +164,7 @@ export async function buildSyncPayload({
|
|
|
164
164
|
deviceId: String(deviceId || deriveAnonymousDeviceId()).slice(0, 32),
|
|
165
165
|
client: {
|
|
166
166
|
kind: clientKind === 'extension' ? 'extension' : 'cli',
|
|
167
|
-
version: String(clientVersion || '0.6.
|
|
167
|
+
version: String(clientVersion || '0.6.9').slice(0, 24),
|
|
168
168
|
...(platformLabel ? { platform: platformLabel } : {}),
|
|
169
169
|
},
|
|
170
170
|
account: {
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
import { FAVICON_SVG, renderDashboardHtml } from './ui.mjs';
|
|
27
27
|
import { dispatchWebhook, sendDedupedAlert, validateWebhookUrl } from './webhooks.mjs';
|
|
28
28
|
|
|
29
|
-
export const SERVER_VERSION = '0.6.
|
|
29
|
+
export const SERVER_VERSION = '0.6.9';
|
|
30
30
|
const MAX_BUCKETS_PER_SYNC = 1000;
|
|
31
31
|
const MAX_DEVICES_PER_MEMBER = 8;
|
|
32
32
|
const MAX_TOKENS_PER_BUCKET = 500_000_000;
|
|
@@ -878,7 +878,7 @@ export function createApp({
|
|
|
878
878
|
? url.searchParams.get('source')
|
|
879
879
|
: 'all';
|
|
880
880
|
const board = await buildBoardPayload(db, { period, from, to, source, envDefaults, now });
|
|
881
|
-
const payload = { ...board, viewer: access.viewer };
|
|
881
|
+
const payload = { ...board, serverVersion: SERVER_VERSION, viewer: access.viewer };
|
|
882
882
|
return jsonRes(payload, 200, {}, { allowCors: settings.boardAccessMode !== 'cli-only' });
|
|
883
883
|
}
|
|
884
884
|
|
|
@@ -930,7 +930,7 @@ export function createApp({
|
|
|
930
930
|
: 'today';
|
|
931
931
|
const detail = await buildMemberDetailPayload(db, memberId, { period, from, to, envDefaults, now });
|
|
932
932
|
if (!detail) return jsonRes({ error: 'Member not found.' }, 404, {}, { allowCors: settings.boardAccessMode !== 'cli-only' });
|
|
933
|
-
return jsonRes(detail, 200, {}, { allowCors: settings.boardAccessMode !== 'cli-only' });
|
|
933
|
+
return jsonRes({ ...detail, serverVersion: SERVER_VERSION }, 200, {}, { allowCors: settings.boardAccessMode !== 'cli-only' });
|
|
934
934
|
}
|
|
935
935
|
|
|
936
936
|
// Member Usage Sync (Bearer member token)
|
|
@@ -1528,7 +1528,7 @@ export async function buildBoardPayload(
|
|
|
1528
1528
|
let knownDeviceRows = [];
|
|
1529
1529
|
try {
|
|
1530
1530
|
knownDeviceRows = await db.all(
|
|
1531
|
-
'SELECT member_id, device_id, platform, last_ip, last_country, last_seen_at FROM member_devices ORDER BY last_seen_at DESC',
|
|
1531
|
+
'SELECT member_id, device_id, platform, client_kind, client_version, last_ip, last_country, last_seen_at FROM member_devices ORDER BY last_seen_at DESC',
|
|
1532
1532
|
);
|
|
1533
1533
|
} catch {
|
|
1534
1534
|
knownDeviceRows = [];
|
|
@@ -1640,8 +1640,8 @@ export async function buildBoardPayload(
|
|
|
1640
1640
|
},
|
|
1641
1641
|
topModels,
|
|
1642
1642
|
lastSeenAt: agg.lastSeenAt,
|
|
1643
|
-
lastClientKind: agg.lastClientKind,
|
|
1644
|
-
lastClientVersion: agg.lastClientVersion,
|
|
1643
|
+
lastClientKind: agg.lastClientKind || latestDev?.client_kind || null,
|
|
1644
|
+
lastClientVersion: agg.lastClientVersion || latestDev?.client_version || null,
|
|
1645
1645
|
online: !isOffline,
|
|
1646
1646
|
accountBound: Boolean(raw.expected_email_hash),
|
|
1647
1647
|
email: formatBoardEmail(raw.email_address, raw.email_hint, maskPublicEmail),
|
|
@@ -2143,6 +2143,7 @@ export async function buildMemberDetailPayload(
|
|
|
2143
2143
|
return {
|
|
2144
2144
|
...d,
|
|
2145
2145
|
platform: meta?.platform || '',
|
|
2146
|
+
clientKind: meta?.client_kind || '',
|
|
2146
2147
|
clientVersion: meta?.client_version || '',
|
|
2147
2148
|
ip: formatBoardIp(meta?.last_ip || '', maskPublicIp),
|
|
2148
2149
|
maskedIp: formatBoardIp(meta?.last_ip || '', maskPublicIp),
|
|
@@ -1016,6 +1016,12 @@ export function renderDashboardHtml({ boardTitle = 'Antigravity 家庭组' } = {
|
|
|
1016
1016
|
.ntag-warn { background: var(--warn-bg); color: var(--warn); }
|
|
1017
1017
|
.ntag-over { background: var(--danger-bg); color: var(--danger); }
|
|
1018
1018
|
.ntag-gray { background: var(--surface-strong); color: var(--ink); }
|
|
1019
|
+
.ntag-ver {
|
|
1020
|
+
background: var(--canvas-soft);
|
|
1021
|
+
color: var(--body);
|
|
1022
|
+
border: 1px solid var(--hairline);
|
|
1023
|
+
font-weight: 500;
|
|
1024
|
+
}
|
|
1019
1025
|
.ntag-me { background: rgba(245, 78, 0, 0.12); color: var(--primary); }
|
|
1020
1026
|
|
|
1021
1027
|
/* Row 2: Two-Pane Workspace Grid (Left Member Ledger + Right Telemetry Stack) */
|
|
@@ -1106,7 +1112,7 @@ export function renderDashboardHtml({ boardTitle = 'Antigravity 家庭组' } = {
|
|
|
1106
1112
|
min-height: 0;
|
|
1107
1113
|
overflow: auto;
|
|
1108
1114
|
}
|
|
1109
|
-
table { width: 100%; min-width:
|
|
1115
|
+
table { width: 100%; min-width: 640px; border-collapse: collapse; }
|
|
1110
1116
|
thead th {
|
|
1111
1117
|
position: sticky;
|
|
1112
1118
|
top: 0;
|
|
@@ -1117,7 +1123,7 @@ export function renderDashboardHtml({ boardTitle = 'Antigravity 家庭组' } = {
|
|
|
1117
1123
|
font-weight: 600;
|
|
1118
1124
|
letter-spacing: 0.03em;
|
|
1119
1125
|
color: var(--muted);
|
|
1120
|
-
padding:
|
|
1126
|
+
padding: 9px 10px;
|
|
1121
1127
|
border-bottom: 1px solid var(--hairline);
|
|
1122
1128
|
white-space: nowrap;
|
|
1123
1129
|
}
|
|
@@ -1125,63 +1131,76 @@ export function renderDashboardHtml({ boardTitle = 'Antigravity 家庭组' } = {
|
|
|
1125
1131
|
th.sortable:hover { color: var(--ink); }
|
|
1126
1132
|
th.sortable.active-sort { color: var(--ink); }
|
|
1127
1133
|
.sort-ind { display: inline-block; margin-left: 3px; font-size: 10px; color: var(--primary); }
|
|
1128
|
-
th:first-child, td:first-child { padding-left:
|
|
1129
|
-
th:last-child, td:last-child { padding-right:
|
|
1134
|
+
th:first-child, td:first-child { padding-left: 16px; }
|
|
1135
|
+
th:last-child, td:last-child { padding-right: 16px; padding-left: 18px; }
|
|
1130
1136
|
th.r, td.r { text-align: right; }
|
|
1137
|
+
th.col-cap { width: 168px; }
|
|
1138
|
+
th.col-share { width: 112px; }
|
|
1139
|
+
th.col-tok { width: 138px; }
|
|
1140
|
+
th.col-model { width: 178px; }
|
|
1131
1141
|
td {
|
|
1132
|
-
padding:
|
|
1142
|
+
padding: 11px 10px;
|
|
1133
1143
|
border-bottom: 1px solid var(--hairline-soft);
|
|
1134
1144
|
vertical-align: middle;
|
|
1135
1145
|
}
|
|
1136
|
-
tr.member-row { cursor: pointer; }
|
|
1146
|
+
tr.member-row { cursor: pointer; transition: background-color 0.12s ease; }
|
|
1137
1147
|
tr.member-row:hover td { background: var(--canvas-soft); }
|
|
1138
1148
|
tr.member-row.is-me td { background: var(--me-bg); }
|
|
1139
1149
|
tr.member-row.is-me td:first-child { box-shadow: inset 2px 0 0 var(--primary); }
|
|
1150
|
+
tr.member-row.is-expanded td {
|
|
1151
|
+
background: var(--canvas-soft);
|
|
1152
|
+
border-bottom-color: transparent;
|
|
1153
|
+
}
|
|
1140
1154
|
tr.detail-row td {
|
|
1141
1155
|
background: var(--canvas-soft);
|
|
1142
|
-
padding:
|
|
1156
|
+
padding: 2px 16px 14px;
|
|
1143
1157
|
border-bottom: 1px solid var(--hairline);
|
|
1144
1158
|
}
|
|
1145
1159
|
|
|
1146
|
-
.member-cell { display: flex; align-items: center; gap: 8px;
|
|
1160
|
+
.member-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
|
|
1161
|
+
.member-info { min-width: 0; flex: 1; }
|
|
1147
1162
|
.toggle-tri {
|
|
1148
|
-
width:
|
|
1149
|
-
height:
|
|
1150
|
-
border-radius:
|
|
1163
|
+
width: 18px;
|
|
1164
|
+
height: 18px;
|
|
1165
|
+
border-radius: 5px;
|
|
1151
1166
|
display: inline-grid;
|
|
1152
1167
|
place-items: center;
|
|
1153
1168
|
color: var(--muted);
|
|
1154
|
-
transition: transform 0.14s ease;
|
|
1169
|
+
transition: transform 0.14s ease, background-color 0.12s ease, color 0.12s ease;
|
|
1155
1170
|
flex-shrink: 0;
|
|
1156
1171
|
}
|
|
1172
|
+
tr.member-row:hover .toggle-tri { background: var(--hover); color: var(--ink); }
|
|
1157
1173
|
.toggle-tri.open { transform: rotate(90deg); color: var(--ink); }
|
|
1158
|
-
.member-name-row { display: flex; align-items: center; gap:
|
|
1159
|
-
.member-name-row .ntag { padding: 1px 6px; font-size: 10.5px; letter-spacing: 0; }
|
|
1160
|
-
.member-name { font-weight:
|
|
1174
|
+
.member-name-row { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; row-gap: 3px; }
|
|
1175
|
+
.member-name-row .ntag { padding: 1px 6px; font-size: 10.5px; letter-spacing: 0; line-height: 1.45; }
|
|
1176
|
+
.member-name { font-weight: 600; font-size: 13.5px; color: var(--ink); margin-right: 1px; }
|
|
1161
1177
|
.member-sub {
|
|
1162
1178
|
font-size: 11px;
|
|
1163
1179
|
color: var(--muted);
|
|
1164
1180
|
display: flex;
|
|
1165
1181
|
align-items: center;
|
|
1182
|
+
flex-wrap: wrap;
|
|
1166
1183
|
gap: 5px;
|
|
1167
|
-
|
|
1184
|
+
row-gap: 2px;
|
|
1185
|
+
margin-top: 3px;
|
|
1168
1186
|
}
|
|
1187
|
+
.meta-sep { color: var(--muted-soft); user-select: none; }
|
|
1169
1188
|
.live-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
|
|
1170
1189
|
.live-dot.on { background: var(--good); }
|
|
1171
1190
|
.live-dot.off { background: var(--muted-soft); }
|
|
1172
1191
|
|
|
1173
1192
|
/* Quota Progress Bar */
|
|
1174
|
-
.meter-box { min-width:
|
|
1193
|
+
.meter-box { min-width: 136px; }
|
|
1175
1194
|
.meter-top {
|
|
1176
1195
|
display: flex;
|
|
1177
1196
|
align-items: baseline;
|
|
1178
1197
|
justify-content: space-between;
|
|
1179
1198
|
gap: 6px;
|
|
1180
1199
|
font-size: 11.5px;
|
|
1181
|
-
margin-bottom:
|
|
1200
|
+
margin-bottom: 5px;
|
|
1182
1201
|
white-space: nowrap;
|
|
1183
1202
|
}
|
|
1184
|
-
.meter-pct { font-weight:
|
|
1203
|
+
.meter-pct { font-weight: 600; color: var(--ink); }
|
|
1185
1204
|
.meter-pct.warn { color: var(--warn); }
|
|
1186
1205
|
.meter-pct.over { color: var(--danger); }
|
|
1187
1206
|
.meter-cap { color: var(--muted); font-size: 11px; }
|
|
@@ -1197,33 +1216,102 @@ export function renderDashboardHtml({ boardTitle = 'Antigravity 家庭组' } = {
|
|
|
1197
1216
|
.meter-fill.warn { background: var(--warn); }
|
|
1198
1217
|
.meter-fill.over { background: var(--danger); }
|
|
1199
1218
|
|
|
1200
|
-
.spend-cell { font-size: 14px; font-weight:
|
|
1201
|
-
.sub-cell { font-size: 11px; color: var(--muted); margin-top:
|
|
1219
|
+
.spend-cell { font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; }
|
|
1220
|
+
.sub-cell { font-size: 11px; color: var(--muted); margin-top: 2px; white-space: nowrap; }
|
|
1202
1221
|
|
|
1203
1222
|
/* Expanded Row 3-Col Sub-Pane */
|
|
1204
1223
|
.detail-grid {
|
|
1205
1224
|
display: grid;
|
|
1206
|
-
grid-template-columns:
|
|
1207
|
-
gap:
|
|
1225
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
1226
|
+
gap: 12px;
|
|
1227
|
+
align-items: stretch;
|
|
1208
1228
|
}
|
|
1209
1229
|
.detail-col {
|
|
1210
1230
|
background: var(--surface-card);
|
|
1211
1231
|
border: 1px solid var(--hairline);
|
|
1212
1232
|
border-radius: var(--r-md);
|
|
1213
|
-
padding:
|
|
1233
|
+
padding: 12px 14px;
|
|
1234
|
+
display: flex;
|
|
1235
|
+
flex-direction: column;
|
|
1236
|
+
gap: 10px;
|
|
1237
|
+
min-width: 0;
|
|
1238
|
+
}
|
|
1239
|
+
.detail-col-head {
|
|
1240
|
+
display: flex;
|
|
1241
|
+
align-items: center;
|
|
1242
|
+
justify-content: space-between;
|
|
1243
|
+
gap: 8px;
|
|
1244
|
+
padding-bottom: 8px;
|
|
1245
|
+
border-bottom: 1px solid var(--hairline-soft);
|
|
1214
1246
|
}
|
|
1215
1247
|
.detail-col h4 {
|
|
1216
|
-
font-size:
|
|
1248
|
+
font-size: 12px;
|
|
1217
1249
|
font-weight: 600;
|
|
1250
|
+
color: var(--ink);
|
|
1251
|
+
margin: 0;
|
|
1252
|
+
white-space: nowrap;
|
|
1253
|
+
}
|
|
1254
|
+
.detail-col-meta {
|
|
1255
|
+
font-size: 11px;
|
|
1218
1256
|
color: var(--muted);
|
|
1219
|
-
|
|
1257
|
+
white-space: nowrap;
|
|
1258
|
+
overflow: hidden;
|
|
1259
|
+
text-overflow: ellipsis;
|
|
1260
|
+
}
|
|
1261
|
+
.detail-win-list {
|
|
1262
|
+
display: flex;
|
|
1263
|
+
flex-direction: column;
|
|
1264
|
+
gap: 8px;
|
|
1265
|
+
}
|
|
1266
|
+
.detail-win-head {
|
|
1267
|
+
display: flex;
|
|
1268
|
+
align-items: baseline;
|
|
1269
|
+
justify-content: space-between;
|
|
1270
|
+
gap: 8px;
|
|
1271
|
+
font-size: 11.5px;
|
|
1272
|
+
margin-bottom: 4px;
|
|
1273
|
+
}
|
|
1274
|
+
.detail-kv-grid {
|
|
1275
|
+
margin-top: auto;
|
|
1276
|
+
padding-top: 9px;
|
|
1277
|
+
border-top: 1px solid var(--hairline-soft);
|
|
1278
|
+
display: grid;
|
|
1279
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
1280
|
+
gap: 6px;
|
|
1281
|
+
}
|
|
1282
|
+
.detail-kv-tile {
|
|
1283
|
+
background: var(--canvas-soft);
|
|
1284
|
+
border: 1px solid var(--hairline-soft);
|
|
1285
|
+
border-radius: var(--r-sm);
|
|
1286
|
+
padding: 5px 8px;
|
|
1287
|
+
min-width: 0;
|
|
1288
|
+
}
|
|
1289
|
+
.detail-kv-lbl {
|
|
1290
|
+
font-size: 10px;
|
|
1291
|
+
color: var(--muted);
|
|
1292
|
+
line-height: 1.25;
|
|
1293
|
+
margin-bottom: 2px;
|
|
1294
|
+
}
|
|
1295
|
+
.detail-kv-val {
|
|
1296
|
+
font-size: 11px;
|
|
1297
|
+
font-weight: 500;
|
|
1298
|
+
color: var(--ink);
|
|
1299
|
+
white-space: nowrap;
|
|
1300
|
+
overflow: hidden;
|
|
1301
|
+
text-overflow: ellipsis;
|
|
1302
|
+
}
|
|
1303
|
+
.detail-kv-val span {
|
|
1304
|
+
color: var(--muted);
|
|
1305
|
+
font-weight: 400;
|
|
1220
1306
|
}
|
|
1221
1307
|
.mini-bars {
|
|
1222
1308
|
display: flex;
|
|
1223
1309
|
align-items: flex-end;
|
|
1224
|
-
gap:
|
|
1225
|
-
|
|
1226
|
-
|
|
1310
|
+
gap: 6px;
|
|
1311
|
+
flex: 1;
|
|
1312
|
+
min-height: 76px;
|
|
1313
|
+
max-height: 120px;
|
|
1314
|
+
padding: 6px 2px 6px;
|
|
1227
1315
|
border-bottom: 1px solid var(--hairline-soft);
|
|
1228
1316
|
}
|
|
1229
1317
|
.mini-col {
|
|
@@ -1231,34 +1319,135 @@ export function renderDashboardHtml({ boardTitle = 'Antigravity 家庭组' } = {
|
|
|
1231
1319
|
display: flex;
|
|
1232
1320
|
flex-direction: column;
|
|
1233
1321
|
align-items: center;
|
|
1234
|
-
gap:
|
|
1322
|
+
gap: 4px;
|
|
1235
1323
|
height: 100%;
|
|
1236
1324
|
justify-content: flex-end;
|
|
1237
1325
|
}
|
|
1238
|
-
.mini-bar { width: 100%; max-width:
|
|
1239
|
-
.mini-
|
|
1326
|
+
.mini-bar { width: 100%; max-width: 18px; min-height: 3px; border-radius: 3px 3px 1px 1px; transition: opacity 0.12s ease; }
|
|
1327
|
+
.mini-col:hover .mini-bar { opacity: 0.82; }
|
|
1328
|
+
.mini-lbl { font-size: 10px; color: var(--muted); line-height: 1; }
|
|
1240
1329
|
.dev-list {
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1330
|
+
display: flex;
|
|
1331
|
+
flex-direction: column;
|
|
1332
|
+
gap: 6px;
|
|
1333
|
+
margin-top: auto;
|
|
1334
|
+
}
|
|
1335
|
+
.dev-item {
|
|
1336
|
+
background: var(--canvas-soft);
|
|
1337
|
+
border: 1px solid var(--hairline-soft);
|
|
1338
|
+
border-radius: var(--r-sm);
|
|
1339
|
+
padding: 6px 9px;
|
|
1244
1340
|
display: flex;
|
|
1245
1341
|
flex-direction: column;
|
|
1246
1342
|
gap: 4px;
|
|
1343
|
+
min-width: 0;
|
|
1247
1344
|
}
|
|
1248
|
-
.dev-
|
|
1345
|
+
.dev-top, .dev-bot {
|
|
1249
1346
|
display: flex;
|
|
1250
1347
|
align-items: center;
|
|
1251
1348
|
justify-content: space-between;
|
|
1252
1349
|
gap: 8px;
|
|
1350
|
+
min-width: 0;
|
|
1351
|
+
}
|
|
1352
|
+
.dev-id-grp {
|
|
1353
|
+
display: flex;
|
|
1354
|
+
align-items: center;
|
|
1355
|
+
gap: 5px;
|
|
1356
|
+
min-width: 0;
|
|
1357
|
+
flex-wrap: wrap;
|
|
1253
1358
|
font-size: 11px;
|
|
1254
1359
|
color: var(--body);
|
|
1255
1360
|
}
|
|
1256
|
-
.
|
|
1257
|
-
|
|
1258
|
-
|
|
1361
|
+
.dev-id-tag { font-weight: 600; color: var(--ink); }
|
|
1362
|
+
.dev-id-grp .ntag { padding: 0 5px; font-size: 10px; line-height: 1.5; }
|
|
1363
|
+
.dev-time { font-size: 10.5px; color: var(--muted); white-space: nowrap; flex-shrink: 0; }
|
|
1364
|
+
.dev-net {
|
|
1365
|
+
font-size: 10.5px;
|
|
1366
|
+
color: var(--muted);
|
|
1367
|
+
min-width: 0;
|
|
1368
|
+
overflow: hidden;
|
|
1369
|
+
text-overflow: ellipsis;
|
|
1370
|
+
white-space: nowrap;
|
|
1371
|
+
}
|
|
1372
|
+
.dev-usage {
|
|
1373
|
+
font-size: 10.5px;
|
|
1374
|
+
color: var(--body);
|
|
1375
|
+
font-weight: 500;
|
|
1376
|
+
white-space: nowrap;
|
|
1377
|
+
flex-shrink: 0;
|
|
1378
|
+
}
|
|
1379
|
+
.detail-model-list {
|
|
1380
|
+
display: flex;
|
|
1381
|
+
flex-direction: column;
|
|
1382
|
+
gap: 8px;
|
|
1383
|
+
}
|
|
1384
|
+
.detail-model-item {
|
|
1385
|
+
display: flex;
|
|
1386
|
+
flex-direction: column;
|
|
1387
|
+
gap: 4px;
|
|
1388
|
+
}
|
|
1389
|
+
.detail-model-head {
|
|
1390
|
+
display: flex;
|
|
1391
|
+
justify-content: space-between;
|
|
1392
|
+
align-items: center;
|
|
1393
|
+
gap: 8px;
|
|
1394
|
+
font-size: 11.5px;
|
|
1395
|
+
}
|
|
1396
|
+
.detail-model-track {
|
|
1397
|
+
width: 100%;
|
|
1398
|
+
height: 4px;
|
|
1399
|
+
border-radius: var(--r-pill);
|
|
1400
|
+
background: var(--surface-strong);
|
|
1401
|
+
overflow: hidden;
|
|
1402
|
+
}
|
|
1403
|
+
.detail-model-fill {
|
|
1404
|
+
height: 100%;
|
|
1405
|
+
border-radius: var(--r-pill);
|
|
1406
|
+
}
|
|
1407
|
+
.detail-audit-box {
|
|
1408
|
+
margin-top: auto;
|
|
1409
|
+
padding: 8px 10px;
|
|
1410
|
+
border-radius: var(--r-sm);
|
|
1411
|
+
background: var(--danger-bg);
|
|
1412
|
+
border: 1px solid color-mix(in srgb, var(--danger) 28%, var(--hairline));
|
|
1413
|
+
}
|
|
1414
|
+
.detail-audit-head {
|
|
1415
|
+
display: flex;
|
|
1416
|
+
align-items: center;
|
|
1417
|
+
justify-content: space-between;
|
|
1418
|
+
gap: 6px;
|
|
1419
|
+
font-size: 11px;
|
|
1420
|
+
font-weight: 600;
|
|
1421
|
+
color: var(--danger);
|
|
1422
|
+
}
|
|
1423
|
+
.detail-audit-head span:first-child {
|
|
1424
|
+
display: inline-flex;
|
|
1425
|
+
align-items: center;
|
|
1426
|
+
gap: 5px;
|
|
1427
|
+
}
|
|
1428
|
+
.detail-audit-time {
|
|
1429
|
+
font-size: 10.5px;
|
|
1430
|
+
font-weight: 400;
|
|
1431
|
+
color: var(--muted);
|
|
1432
|
+
flex-shrink: 0;
|
|
1433
|
+
}
|
|
1434
|
+
.detail-audit-body {
|
|
1435
|
+
margin-top: 4px;
|
|
1436
|
+
font-size: 11px;
|
|
1437
|
+
line-height: 1.48;
|
|
1438
|
+
color: var(--ink);
|
|
1439
|
+
word-break: break-word;
|
|
1440
|
+
}
|
|
1441
|
+
.detail-foot-meta {
|
|
1442
|
+
margin-top: auto;
|
|
1443
|
+
padding-top: 8px;
|
|
1259
1444
|
border-top: 1px solid var(--hairline-soft);
|
|
1445
|
+
display: flex;
|
|
1446
|
+
align-items: center;
|
|
1447
|
+
justify-content: space-between;
|
|
1448
|
+
gap: 8px;
|
|
1260
1449
|
font-size: 11px;
|
|
1261
|
-
color: var(--
|
|
1450
|
+
color: var(--muted);
|
|
1262
1451
|
}
|
|
1263
1452
|
|
|
1264
1453
|
/* Empty Onboarding Pane inside Left Card */
|
|
@@ -1941,6 +2130,7 @@ export function renderDashboardHtml({ boardTitle = 'Antigravity 家庭组' } = {
|
|
|
1941
2130
|
.kpi-grid { grid-template-columns: 1fr 1fr; }
|
|
1942
2131
|
.workspace-grid { grid-template-columns: 1fr; }
|
|
1943
2132
|
.telemetry-col { grid-template-rows: auto auto; }
|
|
2133
|
+
.detail-grid { grid-template-columns: 1fr; }
|
|
1944
2134
|
.settings-modal { flex-direction: column; height: 90vh; }
|
|
1945
2135
|
.settings-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--hairline); padding: 10px 12px; }
|
|
1946
2136
|
.sidebar-nav { flex-direction: row; overflow-x: auto; }
|
|
@@ -1968,6 +2158,7 @@ export function renderDashboardHtml({ boardTitle = 'Antigravity 家庭组' } = {
|
|
|
1968
2158
|
<span id="updatedLine">--:--</span>
|
|
1969
2159
|
<span class="sync-sep" aria-hidden="true">·</span>
|
|
1970
2160
|
<select class="refresh-select" id="autoRefreshSelect" data-compact="true" aria-label="自动刷新间隔" title="自动刷新间隔">
|
|
2161
|
+
<option value="5">5s</option>
|
|
1971
2162
|
<option value="10">10s</option>
|
|
1972
2163
|
<option value="15">15s</option>
|
|
1973
2164
|
<option value="30" selected>30s</option>
|
|
@@ -2110,10 +2301,10 @@ export function renderDashboardHtml({ boardTitle = 'Antigravity 家庭组' } = {
|
|
|
2110
2301
|
<thead>
|
|
2111
2302
|
<tr id="memberTableHead">
|
|
2112
2303
|
<th class="sortable" data-sort="active"><span data-i18n="colMember">家庭成员</span><span class="sort-ind"></span></th>
|
|
2113
|
-
<th class="sortable" data-sort="cap"><span data-i18n="colCap">分配份额与进度</span><span class="sort-ind"></span></th>
|
|
2114
|
-
<th class="r sortable active-sort" data-sort="usd"><span data-i18n="colUsd">使用占比</span><span class="sort-ind">↓</span></th>
|
|
2115
|
-
<th class="r sortable" data-sort="tokens"><span data-i18n="colTokens">Tokens / 轮次</span><span class="sort-ind"></span></th>
|
|
2116
|
-
<th data-i18n="colMix">主要模型与端</th>
|
|
2304
|
+
<th class="col-cap sortable" data-sort="cap"><span data-i18n="colCap">分配份额与进度</span><span class="sort-ind"></span></th>
|
|
2305
|
+
<th class="col-share r sortable active-sort" data-sort="usd"><span data-i18n="colUsd">使用占比</span><span class="sort-ind">↓</span></th>
|
|
2306
|
+
<th class="col-tok r sortable" data-sort="tokens"><span data-i18n="colTokens">Tokens / 轮次</span><span class="sort-ind"></span></th>
|
|
2307
|
+
<th class="col-model" data-i18n="colMix">主要模型与端</th>
|
|
2117
2308
|
</tr>
|
|
2118
2309
|
</thead>
|
|
2119
2310
|
<tbody id="memberRows"></tbody>
|
|
@@ -2157,7 +2348,7 @@ export function renderDashboardHtml({ boardTitle = 'Antigravity 家庭组' } = {
|
|
|
2157
2348
|
|
|
2158
2349
|
<footer class="foot">
|
|
2159
2350
|
<span data-i18n="privacyNote">隐私承诺:客户端仅只读扫描本地 SQLite 数值元数据,绝不上传 Prompt、代码、文件路径或 Google 凭据。</span>
|
|
2160
|
-
<span class="mono">agy-family v0.6.
|
|
2351
|
+
<span class="mono">agy-family v0.6.9 · MIT</span>
|
|
2161
2352
|
</footer>
|
|
2162
2353
|
</main>
|
|
2163
2354
|
|
|
@@ -2588,7 +2779,44 @@ let adminMembersCache = [];
|
|
|
2588
2779
|
let adminPricingTable = [];
|
|
2589
2780
|
let adminCustomPricing = {};
|
|
2590
2781
|
let adminServerVersion = '';
|
|
2782
|
+
let boardServerVersion = '';
|
|
2591
2783
|
let editingPriceId = '';
|
|
2784
|
+
function compareSemver(a, b) {
|
|
2785
|
+
const pa = String(a || '').replace(/^v/i, '').split('.').map((n) => parseInt(n, 10) || 0);
|
|
2786
|
+
const pb = String(b || '').replace(/^v/i, '').split('.').map((n) => parseInt(n, 10) || 0);
|
|
2787
|
+
const len = Math.max(pa.length, pb.length, 3);
|
|
2788
|
+
for (let i = 0; i < len; i++) {
|
|
2789
|
+
const da = pa[i] || 0;
|
|
2790
|
+
const db = pb[i] || 0;
|
|
2791
|
+
if (da !== db) return da < db ? -1 : 1;
|
|
2792
|
+
}
|
|
2793
|
+
return 0;
|
|
2794
|
+
}
|
|
2795
|
+
function renderClientVersionTag(kind, version, serverVer, opts) {
|
|
2796
|
+
const ver = String(version || '').trim();
|
|
2797
|
+
const kindLabel = kind === 'extension'
|
|
2798
|
+
? (lang === 'zh' ? '插件' : 'IDE')
|
|
2799
|
+
: kind === 'cli'
|
|
2800
|
+
? 'CLI'
|
|
2801
|
+
: '';
|
|
2802
|
+
if (!ver) {
|
|
2803
|
+
if (opts && opts.showUnknown) {
|
|
2804
|
+
return '<span class="ntag ntag-ver mono" style="opacity:.72" title="' + esc(lang === 'zh' ? '旧版本客户端尚未上报版本号,建议升级' : 'Version not reported by older client') + '">' + esc((kindLabel ? kindLabel + ' ' : '') + (lang === 'zh' ? '旧版' : 'old')) + '</span>';
|
|
2805
|
+
}
|
|
2806
|
+
return '';
|
|
2807
|
+
}
|
|
2808
|
+
const refVer = serverVer || boardServerVersion || adminServerVersion || '';
|
|
2809
|
+
const isOutdated = Boolean(refVer && compareSemver(ver, refVer) < 0);
|
|
2810
|
+
const txt = (kindLabel ? kindLabel + ' ' : '') + 'v' + ver + (isOutdated ? (lang === 'zh' ? ' 旧版' : ' old') : '');
|
|
2811
|
+
const tip = isOutdated
|
|
2812
|
+
? (lang === 'zh'
|
|
2813
|
+
? '当前 ' + (kindLabel || '客户端') + ' v' + ver + ',服务端已是 v' + refVer + '(可执行 npm i -g agy-family@latest && agy-family hook on 更新)'
|
|
2814
|
+
: 'Running ' + (kindLabel || 'client') + ' v' + ver + '; server is v' + refVer)
|
|
2815
|
+
: (lang === 'zh'
|
|
2816
|
+
? '当前 ' + (kindLabel || '客户端') + ' 版本 v' + ver + (refVer ? '(已是最新)' : '')
|
|
2817
|
+
: 'Client ' + (kindLabel || '') + ' v' + ver + (refVer ? ' (latest)' : ''));
|
|
2818
|
+
return '<span class="ntag ' + (isOutdated ? 'ntag-warn' : 'ntag-ver') + ' mono" title="' + esc(tip) + '">' + esc(txt) + '</span>';
|
|
2819
|
+
}
|
|
2592
2820
|
let lastBoardMembers = {};
|
|
2593
2821
|
let pendingAdminTab = '';
|
|
2594
2822
|
let currentAdminTab = 'members';
|
|
@@ -2998,7 +3226,7 @@ async function fetchBoard(opts) {
|
|
|
2998
3226
|
triggerReveal(document.getElementById('modelList'));
|
|
2999
3227
|
}
|
|
3000
3228
|
if (expandedMemberId) {
|
|
3001
|
-
loadMemberDetail(expandedMemberId);
|
|
3229
|
+
loadMemberDetail(expandedMemberId, { silent });
|
|
3002
3230
|
}
|
|
3003
3231
|
} finally {
|
|
3004
3232
|
if (seq === boardReqSeq && !silent) {
|
|
@@ -3167,19 +3395,22 @@ function renderActivityChart(d) {
|
|
|
3167
3395
|
svg.onmouseleave = () => tip.classList.remove('show');
|
|
3168
3396
|
}
|
|
3169
3397
|
|
|
3170
|
-
async function loadMemberDetail(memberId) {
|
|
3398
|
+
async function loadMemberDetail(memberId, opts) {
|
|
3399
|
+
const silent = Boolean(opts && opts.silent);
|
|
3171
3400
|
const box = document.getElementById('detail-cell-' + memberId);
|
|
3172
3401
|
if (!box) return;
|
|
3173
3402
|
const seq = ++detailReqSeq;
|
|
3174
|
-
box.
|
|
3175
|
-
|
|
3176
|
-
'<div class="detail-skel-
|
|
3177
|
-
|
|
3178
|
-
'<div class="detail-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3403
|
+
if (!silent || !box.querySelector('.detail-grid')) {
|
|
3404
|
+
box.innerHTML =
|
|
3405
|
+
'<div class="detail-skel-wrap">' +
|
|
3406
|
+
'<div class="detail-skel-head"><span class="inline-spin"></span><span>' + (lang === 'zh' ? '加载成员明细中...' : 'Loading member details...') + '</span></div>' +
|
|
3407
|
+
'<div class="detail-grid">' +
|
|
3408
|
+
'<div class="detail-col"><div class="skel" style="width:92px;height:11px;margin-bottom:8px"></div><div class="skel" style="width:100%;height:12px;margin-bottom:6px"></div><div class="skel" style="width:86%;height:12px"></div></div>' +
|
|
3409
|
+
'<div class="detail-col"><div class="skel" style="width:108px;height:11px;margin-bottom:8px"></div><div class="skel" style="width:100%;height:34px"></div></div>' +
|
|
3410
|
+
'<div class="detail-col"><div class="skel" style="width:88px;height:11px;margin-bottom:8px"></div><div class="skel" style="width:100%;height:12px;margin-bottom:6px"></div><div class="skel" style="width:74%;height:12px"></div></div>' +
|
|
3411
|
+
'</div>' +
|
|
3412
|
+
'</div>';
|
|
3413
|
+
}
|
|
3183
3414
|
const qs = buildBoardQueryParams(false);
|
|
3184
3415
|
try {
|
|
3185
3416
|
const res = await fetch('/api/board/member/' + encodeURIComponent(memberId) + '?' + qs.toString(), { headers: viewHeaders(), credentials: 'same-origin' });
|
|
@@ -3192,16 +3423,17 @@ async function loadMemberDetail(memberId) {
|
|
|
3192
3423
|
const isPoolMode = q.quotaMode === 'pool';
|
|
3193
3424
|
const quotaPct = q.quotaPct ?? 100;
|
|
3194
3425
|
const tb = d.tokensBreakdown || {};
|
|
3426
|
+
const curServerVer = d.serverVersion || boardServerVersion || adminServerVersion || '';
|
|
3195
3427
|
|
|
3196
3428
|
const shareWinItem = (lbl, winObj, usedUsd) => {
|
|
3197
3429
|
const w = winObj || {};
|
|
3198
3430
|
const st = w.quotaStatus || 'ok';
|
|
3199
3431
|
const barPct = Math.min(100, Number(w.quotaUsedPct) || 0);
|
|
3200
3432
|
const rightTxt = isPoolMode
|
|
3201
|
-
? '<strong style="color:var(--ink)">' + (w.quotaUsedPct || 0) + '%</strong> <span style="color:var(--muted)">/ ' + quotaPct + '%
|
|
3202
|
-
: '<strong style="color:var(--ink)">' + fmtPct(w.sharePct || 0, usedUsd) + '</strong> <span style="color:var(--muted)">/ ' + quotaPct + '%
|
|
3203
|
-
return '<div
|
|
3204
|
-
'<div
|
|
3433
|
+
? '<strong style="color:var(--ink)">' + (w.quotaUsedPct || 0) + '%</strong> <span style="color:var(--muted)">/ ' + quotaPct + '% · ' + fmtUsd(usedUsd) + '</span>'
|
|
3434
|
+
: '<strong style="color:var(--ink)">' + fmtPct(w.sharePct || 0, usedUsd) + '</strong> <span style="color:var(--muted)">/ ' + quotaPct + '% · ' + fmtUsd(usedUsd) + '</span>';
|
|
3435
|
+
return '<div>' +
|
|
3436
|
+
'<div class="detail-win-head">' +
|
|
3205
3437
|
'<span style="color:var(--body)">' + esc(lbl) + '</span>' +
|
|
3206
3438
|
'<span class="mono">' + rightTxt + '</span>' +
|
|
3207
3439
|
'</div>' +
|
|
@@ -3209,23 +3441,26 @@ async function loadMemberDetail(memberId) {
|
|
|
3209
3441
|
'</div>';
|
|
3210
3442
|
};
|
|
3211
3443
|
|
|
3212
|
-
const
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
const
|
|
3218
|
-
?
|
|
3219
|
-
:
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
'
|
|
3226
|
-
'
|
|
3227
|
-
|
|
3444
|
+
const kvTile = (lbl, mainVal, subVal) =>
|
|
3445
|
+
'<div class="detail-kv-tile">' +
|
|
3446
|
+
'<div class="detail-kv-lbl">' + esc(lbl) + '</div>' +
|
|
3447
|
+
'<div class="detail-kv-val mono" title="' + esc(mainVal + (subVal ? ' ' + subVal : '')) + '">' + esc(mainVal) + (subVal ? ' <span>' + esc(subVal) + '</span>' : '') + '</div>' +
|
|
3448
|
+
'</div>';
|
|
3449
|
+
const fourthTile = (tb.thinkingTokens || 0) > 0
|
|
3450
|
+
? kvTile(lang === 'zh' ? '思考占比' : 'Thinking', (tb.thinkingShareOfOutPct || 0) + '%', '(' + fmtTok(tb.thinkingTokens) + ')')
|
|
3451
|
+
: (tb.cacheSavedUsd || 0) > 0
|
|
3452
|
+
? kvTile(lang === 'zh' ? '缓存省约' : 'Cache saved', fmtUsd(tb.cacheSavedUsd), '')
|
|
3453
|
+
: kvTile(lang === 'zh' ? '对话轮次' : 'Steps', String(d.periodSteps || 0), lang === 'zh' ? '轮' : 'steps');
|
|
3454
|
+
const cacheGrid =
|
|
3455
|
+
'<div class="detail-kv-grid">' +
|
|
3456
|
+
kvTile(lang === 'zh' ? '新输入' : 'Input', fmtTok(tb.inputTokens || 0), '(' + fmtUsd(tb.inputUsd || 0) + ')') +
|
|
3457
|
+
kvTile(lang === 'zh' ? '输出' : 'Output', fmtTok(tb.outputTokens || 0), '(' + fmtUsd(tb.outputUsd || 0) + ')') +
|
|
3458
|
+
kvTile(lang === 'zh' ? '缓存读取' : 'Cache read', fmtTok(tb.cacheReadTokens || 0), '(' + fmtUsd(tb.cacheReadUsd || 0) + ')') +
|
|
3459
|
+
fourthTile +
|
|
3228
3460
|
'</div>';
|
|
3461
|
+
const card1Meta = (tb.totalTokens || 0) > 0
|
|
3462
|
+
? '<span class="detail-col-meta mono" style="color:var(--good)">' + (lang === 'zh' ? '缓存命中 ' : 'Cache ') + (tb.cacheHitPct || 0) + '%</span>'
|
|
3463
|
+
: '';
|
|
3229
3464
|
|
|
3230
3465
|
const mColor = (lastBoardMembers[memberId] && lastBoardMembers[memberId].color) || 'var(--primary)';
|
|
3231
3466
|
const maxD = Math.max(0.01, ...(d.daily7d || []).map((x) => x.usd));
|
|
@@ -3239,53 +3474,91 @@ async function loadMemberDetail(memberId) {
|
|
|
3239
3474
|
const devRows = (d.devices || []).length
|
|
3240
3475
|
? '<div class="dev-list">' + d.devices.slice(0, 4).map((dev) => {
|
|
3241
3476
|
const shortId = '#' + String(dev.deviceId || '').slice(-4);
|
|
3242
|
-
const plat = dev.platform
|
|
3477
|
+
const plat = dev.platform || '';
|
|
3478
|
+
const devKind = dev.clientKind || d.lastClientKind || '';
|
|
3479
|
+
const devVer = dev.clientVersion || d.lastClientVersion || '';
|
|
3480
|
+
const devVerBadge = renderClientVersionTag(devKind, devVer, curServerVer);
|
|
3243
3481
|
const geoTxt = dev.country ? (dev.city ? dev.country + ' · ' + dev.city : dev.country) : '';
|
|
3244
|
-
const
|
|
3245
|
-
?
|
|
3246
|
-
: (geoTxt
|
|
3247
|
-
const
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3482
|
+
const netTxt = dev.maskedIp
|
|
3483
|
+
? dev.maskedIp + (geoTxt ? ' (' + geoTxt + ')' : '')
|
|
3484
|
+
: (geoTxt || (lang === 'zh' ? '本地网络' : 'Local network'));
|
|
3485
|
+
const usageTxt = (dev.tokens || 0) > 0
|
|
3486
|
+
? fmtPct(dev.sharePct || 0, dev.totalUsd) + ' · ' + fmtTok(dev.tokens || 0)
|
|
3487
|
+
: (lang === 'zh' ? '本窗口无消耗' : 'No usage');
|
|
3488
|
+
return '<div class="dev-item">' +
|
|
3489
|
+
'<div class="dev-top">' +
|
|
3490
|
+
'<div class="dev-id-grp mono"><span class="dev-id-tag">' + esc(shortId) + '</span>' + (plat ? '<span>' + esc(plat) + '</span>' : '') + devVerBadge + '</div>' +
|
|
3491
|
+
'<span class="dev-time mono">' + esc(fmtAgo(dev.lastUpdatedAt)) + '</span>' +
|
|
3492
|
+
'</div>' +
|
|
3493
|
+
'<div class="dev-bot">' +
|
|
3494
|
+
'<span class="dev-net mono" title="' + esc(netTxt) + '">' + esc(netTxt) + '</span>' +
|
|
3495
|
+
'<span class="dev-usage mono">' + esc(usageTxt) + '</span>' +
|
|
3496
|
+
'</div>' +
|
|
3251
3497
|
'</div>';
|
|
3252
3498
|
}).join('') + '</div>'
|
|
3253
|
-
: '';
|
|
3499
|
+
: '<div class="detail-foot-meta">' + esc(lang === 'zh' ? '暂无已上报设备' : 'No devices reported') + '</div>';
|
|
3500
|
+
|
|
3501
|
+
const srcHeadParts = [];
|
|
3502
|
+
if (d.sources?.desktopUsd > 0 && d.sources?.cliUsd > 0) {
|
|
3503
|
+
srcHeadParts.push('IDE ' + (d.sources?.desktopPct || 0) + '% / CLI ' + (d.sources?.cliPct || 0) + '%');
|
|
3504
|
+
} else if (d.sources?.desktopUsd > 0) {
|
|
3505
|
+
srcHeadParts.push('IDE 100%');
|
|
3506
|
+
} else if (d.sources?.cliUsd > 0) {
|
|
3507
|
+
srcHeadParts.push('CLI 100%');
|
|
3508
|
+
}
|
|
3509
|
+
srcHeadParts.push((d.deviceCount || 0) + (lang === 'zh' ? ' 台设备' : ' dev'));
|
|
3510
|
+
const card2Meta = '<span class="detail-col-meta mono">' + esc(srcHeadParts.join(' · ')) + '</span>';
|
|
3254
3511
|
|
|
3255
3512
|
const estTip = lang === 'zh' ? '未知新模型枚举,按保守参考单价估算' : 'Fallback model pricing';
|
|
3256
|
-
const
|
|
3257
|
-
|
|
3513
|
+
const modList = d.modelBreakdown || [];
|
|
3514
|
+
const modRows = modList.length
|
|
3515
|
+
? '<div class="detail-model-list">' + modList.slice(0, 5).map((m, i) => {
|
|
3258
3516
|
const rTip = m.rate ? (lang === 'zh' ? '单价 (每 1M In/Out/Cache):' : 'Rate/1M: ') + fmtRateShort(m.rate) : '';
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3517
|
+
const c = CURSOR_TIMELINE_COLORS[i % CURSOR_TIMELINE_COLORS.length];
|
|
3518
|
+
const w = Math.max(3, Math.min(100, Number(m.sharePct) || 0));
|
|
3519
|
+
return '<div class="detail-model-item" title="' + esc(rTip) + '">' +
|
|
3520
|
+
'<div class="detail-model-head">' +
|
|
3521
|
+
'<span class="model-name"><span class="dot" style="width:6px;height:6px;background:' + c + '"></span>' + esc(m.model) + (m.isEstimated ? ' <span class="ntag ntag-gray" title="' + esc(estTip) + '">est</span>' : '') + '</span>' +
|
|
3522
|
+
'<span class="mono" style="white-space:nowrap"><strong style="color:var(--ink)">' + fmtPct(m.sharePct, m.usd) + '</strong> <span style="color:var(--muted)">(' + fmtUsd(m.usd) + ')</span></span>' +
|
|
3523
|
+
'</div>' +
|
|
3524
|
+
'<div class="detail-model-track"><div class="detail-model-fill" style="width:' + w + '%;background:' + c + '"></div></div>' +
|
|
3262
3525
|
'</div>';
|
|
3263
|
-
}).join('')
|
|
3264
|
-
: '<div style="font-size:11.5px;color:var(--muted)">' + (lang === 'zh' ? '
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
? '<div class="detail-sub-box" style="color:var(--danger)">' + esc(d.recentIntegrityEvents[0].summary) + '</div>'
|
|
3526
|
+
}).join('') + '</div>'
|
|
3527
|
+
: '<div style="font-size:11.5px;color:var(--muted)">' + (lang === 'zh' ? '当前窗口暂无模型用量' : 'No model usage in this window') + '</div>';
|
|
3528
|
+
const card3Meta = modList.length
|
|
3529
|
+
? '<span class="detail-col-meta mono">' + modList.length + (lang === 'zh' ? ' 个模型 · ' : ' models · ') + fmtUsd(d.periodUsd || 0) + '</span>'
|
|
3268
3530
|
: '';
|
|
3269
3531
|
|
|
3270
|
-
const
|
|
3271
|
-
const
|
|
3272
|
-
|
|
3273
|
-
|
|
3532
|
+
const auditEv = (d.recentIntegrityEvents || [])[0] || null;
|
|
3533
|
+
const shieldSvg = '<svg width="12" height="12" viewBox="0 0 16 16" fill="none" aria-hidden="true"><path d="M8 1.8L13.2 4V7.8C13.2 11 10.9 13.4 8 14.3C5.1 13.4 2.8 11 2.8 7.8V4L8 1.8Z" stroke="currentColor" stroke-width="1.4" stroke-linejoin="round"/><path d="M8 5.4V8.5M8 10.8H8.01" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>';
|
|
3534
|
+
const card3Bottom = auditEv
|
|
3535
|
+
? '<div class="detail-audit-box">' +
|
|
3536
|
+
'<div class="detail-audit-head"><span>' + shieldSvg + esc(lang === 'zh' ? '高水位审计保护' : 'Integrity guardrail') + '</span><span class="detail-audit-time mono">' + esc(fmtAgo(auditEv.detected_at)) + '</span></div>' +
|
|
3537
|
+
'<div class="detail-audit-body">' + esc(auditEv.summary) + '</div>' +
|
|
3538
|
+
'</div>'
|
|
3539
|
+
: '<div class="detail-foot-meta mono"><span>' + esc(lang === 'zh' ? '本窗口累计' : 'Window total') + '</span><span>' + (d.periodSteps || 0) + (lang === 'zh' ? ' 轮 · ' : ' steps · ') + fmtTok(d.periodTokens || 0) + '</span></div>';
|
|
3274
3540
|
|
|
3275
3541
|
box.innerHTML =
|
|
3276
|
-
'<div class="detail-grid agf-reveal">' +
|
|
3277
|
-
'<div class="detail-col"
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3542
|
+
'<div class="detail-grid' + (silent ? '' : ' agf-reveal') + '">' +
|
|
3543
|
+
'<div class="detail-col">' +
|
|
3544
|
+
'<div class="detail-col-head"><h4>' + (lang === 'zh' ? '多窗口占比与费用' : 'Window shares & cost') + '</h4>' + card1Meta + '</div>' +
|
|
3545
|
+
'<div class="detail-win-list">' +
|
|
3546
|
+
shareWinItem(lang === 'zh' ? '今日' : 'Daily', q.today, caps.dailyUsedUsd) +
|
|
3547
|
+
shareWinItem(lang === 'zh' ? '近 7 天' : '7 days', q.weekly, caps.weeklyUsedUsd) +
|
|
3548
|
+
shareWinItem(lang === 'zh' ? '本周期' : 'Cycle', q.cycle, caps.cycleUsedUsd) +
|
|
3549
|
+
'</div>' +
|
|
3550
|
+
cacheGrid +
|
|
3282
3551
|
'</div>' +
|
|
3283
|
-
'<div class="detail-col"
|
|
3552
|
+
'<div class="detail-col">' +
|
|
3553
|
+
'<div class="detail-col-head"><h4>' + (lang === 'zh' ? '近 7 天走势与设备' : '7-day trend & devices') + '</h4>' + card2Meta + '</div>' +
|
|
3284
3554
|
'<div class="mini-bars">' + bars7d + '</div>' +
|
|
3285
|
-
'<div style="font-size:11px;color:var(--muted);margin-top:6px" class="mono">' + esc(srcSummary) + '</div>' +
|
|
3286
3555
|
devRows +
|
|
3287
3556
|
'</div>' +
|
|
3288
|
-
'<div class="detail-col"
|
|
3557
|
+
'<div class="detail-col">' +
|
|
3558
|
+
'<div class="detail-col-head"><h4>' + (lang === 'zh' ? '模型使用占比' : 'Model share') + '</h4>' + card3Meta + '</div>' +
|
|
3559
|
+
modRows +
|
|
3560
|
+
card3Bottom +
|
|
3561
|
+
'</div>' +
|
|
3289
3562
|
'</div>';
|
|
3290
3563
|
|
|
3291
3564
|
focusedMemberDetail = d;
|
|
@@ -3369,6 +3642,9 @@ function renderMemberRows(d) {
|
|
|
3369
3642
|
const isPoolMode = d.summary?.quotaMode === 'pool';
|
|
3370
3643
|
const isLowSample = Boolean(d.summary?.isLowSampleRelative);
|
|
3371
3644
|
const memberCount = Number(d.summary?.memberCount) || sorted.length || 1;
|
|
3645
|
+
const prevExpandedHtml = expandedMemberId
|
|
3646
|
+
? (document.getElementById('detail-cell-' + expandedMemberId)?.innerHTML || '')
|
|
3647
|
+
: '';
|
|
3372
3648
|
|
|
3373
3649
|
tbody.innerHTML = sorted.map((m) => {
|
|
3374
3650
|
const rawQStatus = m.quotaStatus || 'ok';
|
|
@@ -3447,8 +3723,10 @@ function renderMemberRows(d) {
|
|
|
3447
3723
|
subParts.push((lang === 'zh' ? '参考 ' : 'ref ') + fmtUsd(m.usedUsd));
|
|
3448
3724
|
|
|
3449
3725
|
const emailHintHtml = m.emailHint
|
|
3450
|
-
? '<span class="mono" style="color:var(--body)"
|
|
3726
|
+
? '<span class="meta-sep">·</span><span class="mono" style="color:var(--body)">' + esc(m.emailHint) + '</span>'
|
|
3451
3727
|
: '';
|
|
3728
|
+
const curServerVer = d.serverVersion || boardServerVersion || adminServerVersion || '';
|
|
3729
|
+
const clientVerTag = renderClientVersionTag(m.lastClientKind, m.lastClientVersion, curServerVer, { showUnknown: Boolean(m.lastSeenAt) });
|
|
3452
3730
|
const mqMem = m.subscriptionQuota || null;
|
|
3453
3731
|
let memQuotaTag = '';
|
|
3454
3732
|
if (mqMem && mqMem.gemini) {
|
|
@@ -3484,16 +3762,15 @@ function renderMemberRows(d) {
|
|
|
3484
3762
|
devMetaBits.push(m.deviceCount + (lang === 'zh' ? ' 台设备' : ' dev'));
|
|
3485
3763
|
}
|
|
3486
3764
|
const devMetaHtml = devMetaBits.length
|
|
3487
|
-
? '<span class="mono" style="opacity:.
|
|
3765
|
+
? devMetaBits.map((bit) => '<span class="meta-sep">·</span><span class="mono" style="opacity:.88">' + esc(bit) + '</span>').join('')
|
|
3488
3766
|
: '';
|
|
3489
3767
|
|
|
3490
|
-
let rowHtml = '<tr class="member-row' + (isMe ? ' is-me' : '') + '" data-member-id="' + esc(m.id) + '">' +
|
|
3768
|
+
let rowHtml = '<tr class="member-row' + (isMe ? ' is-me' : '') + (isExpanded ? ' is-expanded' : '') + '" data-member-id="' + esc(m.id) + '">' +
|
|
3491
3769
|
'<td><div class="member-cell">' +
|
|
3492
3770
|
'<span class="toggle-tri' + (isExpanded ? ' open' : '') + '">' + triSvg + '</span>' +
|
|
3493
|
-
'<
|
|
3494
|
-
|
|
3495
|
-
'<div class="member-
|
|
3496
|
-
'<div class="member-sub"><span class="live-dot ' + (m.online ? 'on' : 'off') + '"></span><span>' + esc(m.online ? t('online') : t('offline')) + '</span><span>' + esc(fmtAgo(m.lastSeenAt)) + '</span>' + emailHintHtml + devMetaHtml + '</div>' +
|
|
3771
|
+
'<div class="member-info">' +
|
|
3772
|
+
'<div class="member-name-row"><span class="dot" style="background:' + esc(m.color) + '"></span><span class="member-name">' + esc(m.name) + '</span>' + roleTag + meTag + acctTag + clientVerTag + memQuotaTag + statusTag + integrityTag + '</div>' +
|
|
3773
|
+
'<div class="member-sub"><span class="live-dot ' + (m.online ? 'on' : 'off') + '"></span><span>' + esc(m.online ? t('online') : t('offline')) + ' ' + esc(fmtAgo(m.lastSeenAt)) + '</span>' + emailHintHtml + devMetaHtml + '</div>' +
|
|
3497
3774
|
'</div>' +
|
|
3498
3775
|
'</div></td>' +
|
|
3499
3776
|
'<td><div class="meter-box"' + (meterTip ? ' title="' + esc(meterTip) + '"' : '') + '>' +
|
|
@@ -3509,9 +3786,14 @@ function renderMemberRows(d) {
|
|
|
3509
3786
|
}
|
|
3510
3787
|
return rowHtml;
|
|
3511
3788
|
}).join('');
|
|
3789
|
+
if (expandedMemberId && prevExpandedHtml) {
|
|
3790
|
+
const newBox = document.getElementById('detail-cell-' + expandedMemberId);
|
|
3791
|
+
if (newBox) newBox.innerHTML = prevExpandedHtml;
|
|
3792
|
+
}
|
|
3512
3793
|
}
|
|
3513
3794
|
|
|
3514
3795
|
function renderBoard(d) {
|
|
3796
|
+
if (d.serverVersion) boardServerVersion = d.serverVersion;
|
|
3515
3797
|
const title = d.boardTitle || 'Antigravity 家庭组';
|
|
3516
3798
|
document.getElementById('boardTitle').textContent = title;
|
|
3517
3799
|
document.title = title;
|
|
@@ -4022,9 +4304,8 @@ async function loadAdmin() {
|
|
|
4022
4304
|
const adminEmail = m.email_address || m.email_hint || '';
|
|
4023
4305
|
const emailInfo = adminEmail ? ' · ' + adminEmail : '';
|
|
4024
4306
|
const cliVer = m.last_client_version ? String(m.last_client_version) : '';
|
|
4025
|
-
const isOutdatedCli = Boolean(cliVer && adminServerVersion && cliVer !== adminServerVersion);
|
|
4026
4307
|
const verTag = cliVer
|
|
4027
|
-
? '
|
|
4308
|
+
? ' ' + renderClientVersionTag(m.last_client_kind, cliVer, adminServerVersion)
|
|
4028
4309
|
: '';
|
|
4029
4310
|
const acctAdminTag = m.account_status === 'verified'
|
|
4030
4311
|
? ' <span class="ntag ntag-good">' + esc(t('acctVerified')) + '</span>'
|
|
@@ -4746,7 +5027,7 @@ document.getElementById('agfSelectMenu')?.addEventListener('click', (e) => {
|
|
|
4746
5027
|
window.addEventListener('resize', () => closeCustomSelect(false));
|
|
4747
5028
|
document.getElementById('adminContent')?.addEventListener('scroll', () => closeCustomSelect(false), { passive: true });
|
|
4748
5029
|
|
|
4749
|
-
const ALLOWED_REFRESH_SECS = [0, 10, 15, 30, 60, 300];
|
|
5030
|
+
const ALLOWED_REFRESH_SECS = [0, 5, 10, 15, 30, 60, 300];
|
|
4750
5031
|
let autoRefreshSec = (() => {
|
|
4751
5032
|
const raw = localStorage.getItem('agf_refresh_sec');
|
|
4752
5033
|
if (raw === null || raw === '') return 30;
|
|
@@ -4775,7 +5056,7 @@ function scheduleAutoRefresh() {
|
|
|
4775
5056
|
if (autoRefreshSec > 0) {
|
|
4776
5057
|
autoRefreshTimer = setInterval(() => {
|
|
4777
5058
|
if (document.hidden) return;
|
|
4778
|
-
fetchBoard({ silent: true });
|
|
5059
|
+
fetchBoard({ silent: true }).catch(() => {});
|
|
4779
5060
|
}, autoRefreshSec * 1000);
|
|
4780
5061
|
}
|
|
4781
5062
|
}
|
|
@@ -4794,7 +5075,7 @@ document.getElementById('autoRefreshSelect')?.addEventListener('change', (ev) =>
|
|
|
4794
5075
|
|
|
4795
5076
|
document.addEventListener('visibilitychange', () => {
|
|
4796
5077
|
if (!document.hidden && autoRefreshSec > 0 && Date.now() - lastBoardFetchedAt >= autoRefreshSec * 1000) {
|
|
4797
|
-
fetchBoard({ silent: true });
|
|
5078
|
+
fetchBoard({ silent: true }).catch(() => {});
|
|
4798
5079
|
}
|
|
4799
5080
|
});
|
|
4800
5081
|
|