agy-family 0.6.8 → 0.6.10

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agy-family",
3
- "version": "0.6.8",
3
+ "version": "0.6.10",
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",
@@ -71,7 +71,7 @@ import {
71
71
  upsertHostEntry,
72
72
  } from '../src/host.mjs';
73
73
 
74
- const CLI_VERSION = '0.6.8';
74
+ const CLI_VERSION = '0.6.10';
75
75
  const THIS_CLI_PATH = fileURLToPath(import.meta.url);
76
76
  const PACKAGE_ROOT = resolve(dirname(THIS_CLI_PATH), '..', '..', '..');
77
77
 
@@ -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.8',
893
+ clientVersion: '0.6.10',
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.8',
86
+ clientVersion = '0.6.10',
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.8').slice(0, 24),
167
+ version: String(clientVersion || '0.6.10').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.8';
29
+ export const SERVER_VERSION = '0.6.10';
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),
@@ -161,6 +161,35 @@ export function renderDashboardHtml({ boardTitle = 'Antigravity 家庭组' } = {
161
161
  overflow: hidden;
162
162
  text-overflow: ellipsis;
163
163
  }
164
+ .version-pill {
165
+ display: inline-flex;
166
+ align-items: center;
167
+ height: 22px;
168
+ padding: 0 7px;
169
+ border-radius: var(--r-pill);
170
+ background: var(--canvas-soft);
171
+ border: 1px solid var(--hairline);
172
+ font-family: var(--font-mono);
173
+ font-size: 11px;
174
+ font-weight: 500;
175
+ color: var(--body);
176
+ line-height: 1;
177
+ white-space: nowrap;
178
+ flex-shrink: 0;
179
+ cursor: pointer;
180
+ transition: border-color 0.14s ease, color 0.14s ease, background-color 0.14s ease;
181
+ }
182
+ .version-pill:hover {
183
+ border-color: var(--hairline-strong);
184
+ background: var(--surface-card);
185
+ color: var(--ink);
186
+ }
187
+ .sidebar-ver {
188
+ font-size: 11px;
189
+ color: var(--muted);
190
+ text-align: center;
191
+ margin-top: 8px;
192
+ }
164
193
  .sync-pill {
165
194
  display: inline-flex;
166
195
  align-items: center;
@@ -1016,6 +1045,12 @@ export function renderDashboardHtml({ boardTitle = 'Antigravity 家庭组' } = {
1016
1045
  .ntag-warn { background: var(--warn-bg); color: var(--warn); }
1017
1046
  .ntag-over { background: var(--danger-bg); color: var(--danger); }
1018
1047
  .ntag-gray { background: var(--surface-strong); color: var(--ink); }
1048
+ .ntag-ver {
1049
+ background: var(--canvas-soft);
1050
+ color: var(--body);
1051
+ border: 1px solid var(--hairline);
1052
+ font-weight: 500;
1053
+ }
1019
1054
  .ntag-me { background: rgba(245, 78, 0, 0.12); color: var(--primary); }
1020
1055
 
1021
1056
  /* Row 2: Two-Pane Workspace Grid (Left Member Ledger + Right Telemetry Stack) */
@@ -1106,7 +1141,7 @@ export function renderDashboardHtml({ boardTitle = 'Antigravity 家庭组' } = {
1106
1141
  min-height: 0;
1107
1142
  overflow: auto;
1108
1143
  }
1109
- table { width: 100%; min-width: 580px; border-collapse: collapse; }
1144
+ table { width: 100%; min-width: 640px; border-collapse: collapse; }
1110
1145
  thead th {
1111
1146
  position: sticky;
1112
1147
  top: 0;
@@ -1117,7 +1152,7 @@ export function renderDashboardHtml({ boardTitle = 'Antigravity 家庭组' } = {
1117
1152
  font-weight: 600;
1118
1153
  letter-spacing: 0.03em;
1119
1154
  color: var(--muted);
1120
- padding: 8px 7px;
1155
+ padding: 9px 10px;
1121
1156
  border-bottom: 1px solid var(--hairline);
1122
1157
  white-space: nowrap;
1123
1158
  }
@@ -1125,63 +1160,76 @@ export function renderDashboardHtml({ boardTitle = 'Antigravity 家庭组' } = {
1125
1160
  th.sortable:hover { color: var(--ink); }
1126
1161
  th.sortable.active-sort { color: var(--ink); }
1127
1162
  .sort-ind { display: inline-block; margin-left: 3px; font-size: 10px; color: var(--primary); }
1128
- th:first-child, td:first-child { padding-left: 14px; }
1129
- th:last-child, td:last-child { padding-right: 14px; }
1163
+ th:first-child, td:first-child { padding-left: 16px; }
1164
+ th:last-child, td:last-child { padding-right: 16px; padding-left: 18px; }
1130
1165
  th.r, td.r { text-align: right; }
1166
+ th.col-cap { width: 168px; }
1167
+ th.col-share { width: 112px; }
1168
+ th.col-tok { width: 138px; }
1169
+ th.col-model { width: 178px; }
1131
1170
  td {
1132
- padding: 9px 7px;
1171
+ padding: 11px 10px;
1133
1172
  border-bottom: 1px solid var(--hairline-soft);
1134
1173
  vertical-align: middle;
1135
1174
  }
1136
- tr.member-row { cursor: pointer; }
1175
+ tr.member-row { cursor: pointer; transition: background-color 0.12s ease; }
1137
1176
  tr.member-row:hover td { background: var(--canvas-soft); }
1138
1177
  tr.member-row.is-me td { background: var(--me-bg); }
1139
1178
  tr.member-row.is-me td:first-child { box-shadow: inset 2px 0 0 var(--primary); }
1179
+ tr.member-row.is-expanded td {
1180
+ background: var(--canvas-soft);
1181
+ border-bottom-color: transparent;
1182
+ }
1140
1183
  tr.detail-row td {
1141
1184
  background: var(--canvas-soft);
1142
- padding: 12px 16px;
1185
+ padding: 2px 16px 14px;
1143
1186
  border-bottom: 1px solid var(--hairline);
1144
1187
  }
1145
1188
 
1146
- .member-cell { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
1189
+ .member-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
1190
+ .member-info { min-width: 0; flex: 1; }
1147
1191
  .toggle-tri {
1148
- width: 16px;
1149
- height: 16px;
1150
- border-radius: 4px;
1192
+ width: 18px;
1193
+ height: 18px;
1194
+ border-radius: 5px;
1151
1195
  display: inline-grid;
1152
1196
  place-items: center;
1153
1197
  color: var(--muted);
1154
- transition: transform 0.14s ease;
1198
+ transition: transform 0.14s ease, background-color 0.12s ease, color 0.12s ease;
1155
1199
  flex-shrink: 0;
1156
1200
  }
1201
+ tr.member-row:hover .toggle-tri { background: var(--hover); color: var(--ink); }
1157
1202
  .toggle-tri.open { transform: rotate(90deg); color: var(--ink); }
1158
- .member-name-row { display: flex; align-items: center; gap: 4px; flex-wrap: nowrap; }
1159
- .member-name-row .ntag { padding: 1px 6px; font-size: 10.5px; letter-spacing: 0; }
1160
- .member-name { font-weight: 500; font-size: 13.5px; color: var(--ink); }
1203
+ .member-name-row { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; row-gap: 3px; }
1204
+ .member-name-row .ntag { padding: 1px 6px; font-size: 10.5px; letter-spacing: 0; line-height: 1.45; }
1205
+ .member-name { font-weight: 600; font-size: 13.5px; color: var(--ink); margin-right: 1px; }
1161
1206
  .member-sub {
1162
1207
  font-size: 11px;
1163
1208
  color: var(--muted);
1164
1209
  display: flex;
1165
1210
  align-items: center;
1211
+ flex-wrap: wrap;
1166
1212
  gap: 5px;
1167
- margin-top: 1px;
1213
+ row-gap: 2px;
1214
+ margin-top: 3px;
1168
1215
  }
1216
+ .meta-sep { color: var(--muted-soft); user-select: none; }
1169
1217
  .live-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
1170
1218
  .live-dot.on { background: var(--good); }
1171
1219
  .live-dot.off { background: var(--muted-soft); }
1172
1220
 
1173
1221
  /* Quota Progress Bar */
1174
- .meter-box { min-width: 122px; }
1222
+ .meter-box { min-width: 136px; }
1175
1223
  .meter-top {
1176
1224
  display: flex;
1177
1225
  align-items: baseline;
1178
1226
  justify-content: space-between;
1179
1227
  gap: 6px;
1180
1228
  font-size: 11.5px;
1181
- margin-bottom: 4px;
1229
+ margin-bottom: 5px;
1182
1230
  white-space: nowrap;
1183
1231
  }
1184
- .meter-pct { font-weight: 500; color: var(--ink); }
1232
+ .meter-pct { font-weight: 600; color: var(--ink); }
1185
1233
  .meter-pct.warn { color: var(--warn); }
1186
1234
  .meter-pct.over { color: var(--danger); }
1187
1235
  .meter-cap { color: var(--muted); font-size: 11px; }
@@ -1197,33 +1245,102 @@ export function renderDashboardHtml({ boardTitle = 'Antigravity 家庭组' } = {
1197
1245
  .meter-fill.warn { background: var(--warn); }
1198
1246
  .meter-fill.over { background: var(--danger); }
1199
1247
 
1200
- .spend-cell { font-size: 14px; font-weight: 500; color: var(--ink); white-space: nowrap; }
1201
- .sub-cell { font-size: 11px; color: var(--muted); margin-top: 1px; white-space: nowrap; }
1248
+ .spend-cell { font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; }
1249
+ .sub-cell { font-size: 11px; color: var(--muted); margin-top: 2px; white-space: nowrap; }
1202
1250
 
1203
1251
  /* Expanded Row 3-Col Sub-Pane */
1204
1252
  .detail-grid {
1205
1253
  display: grid;
1206
- grid-template-columns: 1fr 1.05fr 1fr;
1207
- gap: 10px;
1254
+ grid-template-columns: repeat(3, minmax(0, 1fr));
1255
+ gap: 12px;
1256
+ align-items: stretch;
1208
1257
  }
1209
1258
  .detail-col {
1210
1259
  background: var(--surface-card);
1211
1260
  border: 1px solid var(--hairline);
1212
1261
  border-radius: var(--r-md);
1213
- padding: 10px 12px;
1262
+ padding: 12px 14px;
1263
+ display: flex;
1264
+ flex-direction: column;
1265
+ gap: 10px;
1266
+ min-width: 0;
1267
+ }
1268
+ .detail-col-head {
1269
+ display: flex;
1270
+ align-items: center;
1271
+ justify-content: space-between;
1272
+ gap: 8px;
1273
+ padding-bottom: 8px;
1274
+ border-bottom: 1px solid var(--hairline-soft);
1214
1275
  }
1215
1276
  .detail-col h4 {
1216
- font-size: 11.5px;
1277
+ font-size: 12px;
1217
1278
  font-weight: 600;
1279
+ color: var(--ink);
1280
+ margin: 0;
1281
+ white-space: nowrap;
1282
+ }
1283
+ .detail-col-meta {
1284
+ font-size: 11px;
1218
1285
  color: var(--muted);
1219
- margin-bottom: 8px;
1286
+ white-space: nowrap;
1287
+ overflow: hidden;
1288
+ text-overflow: ellipsis;
1289
+ }
1290
+ .detail-win-list {
1291
+ display: flex;
1292
+ flex-direction: column;
1293
+ gap: 8px;
1294
+ }
1295
+ .detail-win-head {
1296
+ display: flex;
1297
+ align-items: baseline;
1298
+ justify-content: space-between;
1299
+ gap: 8px;
1300
+ font-size: 11.5px;
1301
+ margin-bottom: 4px;
1302
+ }
1303
+ .detail-kv-grid {
1304
+ margin-top: auto;
1305
+ padding-top: 9px;
1306
+ border-top: 1px solid var(--hairline-soft);
1307
+ display: grid;
1308
+ grid-template-columns: repeat(2, minmax(0, 1fr));
1309
+ gap: 6px;
1310
+ }
1311
+ .detail-kv-tile {
1312
+ background: var(--canvas-soft);
1313
+ border: 1px solid var(--hairline-soft);
1314
+ border-radius: var(--r-sm);
1315
+ padding: 5px 8px;
1316
+ min-width: 0;
1317
+ }
1318
+ .detail-kv-lbl {
1319
+ font-size: 10px;
1320
+ color: var(--muted);
1321
+ line-height: 1.25;
1322
+ margin-bottom: 2px;
1323
+ }
1324
+ .detail-kv-val {
1325
+ font-size: 11px;
1326
+ font-weight: 500;
1327
+ color: var(--ink);
1328
+ white-space: nowrap;
1329
+ overflow: hidden;
1330
+ text-overflow: ellipsis;
1331
+ }
1332
+ .detail-kv-val span {
1333
+ color: var(--muted);
1334
+ font-weight: 400;
1220
1335
  }
1221
1336
  .mini-bars {
1222
1337
  display: flex;
1223
1338
  align-items: flex-end;
1224
- gap: 5px;
1225
- height: 58px;
1226
- padding-bottom: 4px;
1339
+ gap: 6px;
1340
+ flex: 1;
1341
+ min-height: 76px;
1342
+ max-height: 120px;
1343
+ padding: 6px 2px 6px;
1227
1344
  border-bottom: 1px solid var(--hairline-soft);
1228
1345
  }
1229
1346
  .mini-col {
@@ -1231,34 +1348,135 @@ export function renderDashboardHtml({ boardTitle = 'Antigravity 家庭组' } = {
1231
1348
  display: flex;
1232
1349
  flex-direction: column;
1233
1350
  align-items: center;
1234
- gap: 3px;
1351
+ gap: 4px;
1235
1352
  height: 100%;
1236
1353
  justify-content: flex-end;
1237
1354
  }
1238
- .mini-bar { width: 100%; max-width: 14px; min-height: 2px; border-radius: 2px; }
1239
- .mini-lbl { font-size: 10px; color: var(--muted); }
1355
+ .mini-bar { width: 100%; max-width: 18px; min-height: 3px; border-radius: 3px 3px 1px 1px; transition: opacity 0.12s ease; }
1356
+ .mini-col:hover .mini-bar { opacity: 0.82; }
1357
+ .mini-lbl { font-size: 10px; color: var(--muted); line-height: 1; }
1240
1358
  .dev-list {
1241
- margin-top: 7px;
1242
- padding-top: 6px;
1243
- border-top: 1px solid var(--hairline-soft);
1359
+ display: flex;
1360
+ flex-direction: column;
1361
+ gap: 6px;
1362
+ margin-top: auto;
1363
+ }
1364
+ .dev-item {
1365
+ background: var(--canvas-soft);
1366
+ border: 1px solid var(--hairline-soft);
1367
+ border-radius: var(--r-sm);
1368
+ padding: 6px 9px;
1244
1369
  display: flex;
1245
1370
  flex-direction: column;
1246
1371
  gap: 4px;
1372
+ min-width: 0;
1247
1373
  }
1248
- .dev-row {
1374
+ .dev-top, .dev-bot {
1249
1375
  display: flex;
1250
1376
  align-items: center;
1251
1377
  justify-content: space-between;
1252
1378
  gap: 8px;
1379
+ min-width: 0;
1380
+ }
1381
+ .dev-id-grp {
1382
+ display: flex;
1383
+ align-items: center;
1384
+ gap: 5px;
1385
+ min-width: 0;
1386
+ flex-wrap: wrap;
1253
1387
  font-size: 11px;
1254
1388
  color: var(--body);
1255
1389
  }
1256
- .detail-sub-box {
1257
- margin-top: 8px;
1258
- padding-top: 7px;
1390
+ .dev-id-tag { font-weight: 600; color: var(--ink); }
1391
+ .dev-id-grp .ntag { padding: 0 5px; font-size: 10px; line-height: 1.5; }
1392
+ .dev-time { font-size: 10.5px; color: var(--muted); white-space: nowrap; flex-shrink: 0; }
1393
+ .dev-net {
1394
+ font-size: 10.5px;
1395
+ color: var(--muted);
1396
+ min-width: 0;
1397
+ overflow: hidden;
1398
+ text-overflow: ellipsis;
1399
+ white-space: nowrap;
1400
+ }
1401
+ .dev-usage {
1402
+ font-size: 10.5px;
1403
+ color: var(--body);
1404
+ font-weight: 500;
1405
+ white-space: nowrap;
1406
+ flex-shrink: 0;
1407
+ }
1408
+ .detail-model-list {
1409
+ display: flex;
1410
+ flex-direction: column;
1411
+ gap: 8px;
1412
+ }
1413
+ .detail-model-item {
1414
+ display: flex;
1415
+ flex-direction: column;
1416
+ gap: 4px;
1417
+ }
1418
+ .detail-model-head {
1419
+ display: flex;
1420
+ justify-content: space-between;
1421
+ align-items: center;
1422
+ gap: 8px;
1423
+ font-size: 11.5px;
1424
+ }
1425
+ .detail-model-track {
1426
+ width: 100%;
1427
+ height: 4px;
1428
+ border-radius: var(--r-pill);
1429
+ background: var(--surface-strong);
1430
+ overflow: hidden;
1431
+ }
1432
+ .detail-model-fill {
1433
+ height: 100%;
1434
+ border-radius: var(--r-pill);
1435
+ }
1436
+ .detail-audit-box {
1437
+ margin-top: auto;
1438
+ padding: 8px 10px;
1439
+ border-radius: var(--r-sm);
1440
+ background: var(--danger-bg);
1441
+ border: 1px solid color-mix(in srgb, var(--danger) 28%, var(--hairline));
1442
+ }
1443
+ .detail-audit-head {
1444
+ display: flex;
1445
+ align-items: center;
1446
+ justify-content: space-between;
1447
+ gap: 6px;
1448
+ font-size: 11px;
1449
+ font-weight: 600;
1450
+ color: var(--danger);
1451
+ }
1452
+ .detail-audit-head span:first-child {
1453
+ display: inline-flex;
1454
+ align-items: center;
1455
+ gap: 5px;
1456
+ }
1457
+ .detail-audit-time {
1458
+ font-size: 10.5px;
1459
+ font-weight: 400;
1460
+ color: var(--muted);
1461
+ flex-shrink: 0;
1462
+ }
1463
+ .detail-audit-body {
1464
+ margin-top: 4px;
1465
+ font-size: 11px;
1466
+ line-height: 1.48;
1467
+ color: var(--ink);
1468
+ word-break: break-word;
1469
+ }
1470
+ .detail-foot-meta {
1471
+ margin-top: auto;
1472
+ padding-top: 8px;
1259
1473
  border-top: 1px solid var(--hairline-soft);
1474
+ display: flex;
1475
+ align-items: center;
1476
+ justify-content: space-between;
1477
+ gap: 8px;
1260
1478
  font-size: 11px;
1261
- color: var(--body);
1479
+ color: var(--muted);
1262
1480
  }
1263
1481
 
1264
1482
  /* Empty Onboarding Pane inside Left Card */
@@ -1941,6 +2159,7 @@ export function renderDashboardHtml({ boardTitle = 'Antigravity 家庭组' } = {
1941
2159
  .kpi-grid { grid-template-columns: 1fr 1fr; }
1942
2160
  .workspace-grid { grid-template-columns: 1fr; }
1943
2161
  .telemetry-col { grid-template-rows: auto auto; }
2162
+ .detail-grid { grid-template-columns: 1fr; }
1944
2163
  .settings-modal { flex-direction: column; height: 90vh; }
1945
2164
  .settings-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--hairline); padding: 10px 12px; }
1946
2165
  .sidebar-nav { flex-direction: row; overflow-x: auto; }
@@ -1963,6 +2182,7 @@ export function renderDashboardHtml({ boardTitle = 'Antigravity 家庭组' } = {
1963
2182
  <div class="brand-cluster">
1964
2183
  <div class="brand-mark" aria-hidden="true">${FAVICON_SVG}</div>
1965
2184
  <h1 class="brand-title" id="boardTitle">${safeTitle}</h1>
2185
+ <button type="button" class="version-pill mono" id="boardVersionBadge" title="当前版本 v0.6.10 · 点击查看更新方式">v0.6.10</button>
1966
2186
  <span class="sync-pill">
1967
2187
  <span class="sync-dot" id="syncDot"></span>
1968
2188
  <span id="updatedLine">--:--</span>
@@ -2111,10 +2331,10 @@ export function renderDashboardHtml({ boardTitle = 'Antigravity 家庭组' } = {
2111
2331
  <thead>
2112
2332
  <tr id="memberTableHead">
2113
2333
  <th class="sortable" data-sort="active"><span data-i18n="colMember">家庭成员</span><span class="sort-ind"></span></th>
2114
- <th class="sortable" data-sort="cap"><span data-i18n="colCap">分配份额与进度</span><span class="sort-ind"></span></th>
2115
- <th class="r sortable active-sort" data-sort="usd"><span data-i18n="colUsd">使用占比</span><span class="sort-ind">↓</span></th>
2116
- <th class="r sortable" data-sort="tokens"><span data-i18n="colTokens">Tokens / 轮次</span><span class="sort-ind"></span></th>
2117
- <th data-i18n="colMix">主要模型与端</th>
2334
+ <th class="col-cap sortable" data-sort="cap"><span data-i18n="colCap">分配份额与进度</span><span class="sort-ind"></span></th>
2335
+ <th class="col-share r sortable active-sort" data-sort="usd"><span data-i18n="colUsd">使用占比</span><span class="sort-ind">↓</span></th>
2336
+ <th class="col-tok r sortable" data-sort="tokens"><span data-i18n="colTokens">Tokens / 轮次</span><span class="sort-ind"></span></th>
2337
+ <th class="col-model" data-i18n="colMix">主要模型与端</th>
2118
2338
  </tr>
2119
2339
  </thead>
2120
2340
  <tbody id="memberRows"></tbody>
@@ -2158,7 +2378,7 @@ export function renderDashboardHtml({ boardTitle = 'Antigravity 家庭组' } = {
2158
2378
 
2159
2379
  <footer class="foot">
2160
2380
  <span data-i18n="privacyNote">隐私承诺:客户端仅只读扫描本地 SQLite 数值元数据,绝不上传 Prompt、代码、文件路径或 Google 凭据。</span>
2161
- <span class="mono">agy-family v0.6.8 · MIT</span>
2381
+ <span class="mono" id="footerVersion">agy-family v0.6.10 · MIT</span>
2162
2382
  </footer>
2163
2383
  </main>
2164
2384
 
@@ -2191,6 +2411,7 @@ export function renderDashboardHtml({ boardTitle = 'Antigravity 家庭组' } = {
2191
2411
  </div>
2192
2412
  <div>
2193
2413
  <button class="btn btn-sm" id="adminLockBtn" style="width:100%;display:none" data-i18n="lock">锁定退出</button>
2414
+ <div class="sidebar-ver mono" id="adminSidebarVersion">v0.6.10</div>
2194
2415
  </div>
2195
2416
  </aside>
2196
2417
 
@@ -2589,7 +2810,44 @@ let adminMembersCache = [];
2589
2810
  let adminPricingTable = [];
2590
2811
  let adminCustomPricing = {};
2591
2812
  let adminServerVersion = '';
2813
+ let boardServerVersion = '';
2592
2814
  let editingPriceId = '';
2815
+ function compareSemver(a, b) {
2816
+ const pa = String(a || '').replace(/^v/i, '').split('.').map((n) => parseInt(n, 10) || 0);
2817
+ const pb = String(b || '').replace(/^v/i, '').split('.').map((n) => parseInt(n, 10) || 0);
2818
+ const len = Math.max(pa.length, pb.length, 3);
2819
+ for (let i = 0; i < len; i++) {
2820
+ const da = pa[i] || 0;
2821
+ const db = pb[i] || 0;
2822
+ if (da !== db) return da < db ? -1 : 1;
2823
+ }
2824
+ return 0;
2825
+ }
2826
+ function renderClientVersionTag(kind, version, serverVer, opts) {
2827
+ const ver = String(version || '').trim();
2828
+ const kindLabel = kind === 'extension'
2829
+ ? (lang === 'zh' ? '插件' : 'IDE')
2830
+ : kind === 'cli'
2831
+ ? 'CLI'
2832
+ : '';
2833
+ if (!ver) {
2834
+ if (opts && opts.showUnknown) {
2835
+ 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>';
2836
+ }
2837
+ return '';
2838
+ }
2839
+ const refVer = serverVer || boardServerVersion || adminServerVersion || '';
2840
+ const isOutdated = Boolean(refVer && compareSemver(ver, refVer) < 0);
2841
+ const txt = (kindLabel ? kindLabel + ' ' : '') + 'v' + ver + (isOutdated ? (lang === 'zh' ? ' 旧版' : ' old') : '');
2842
+ const tip = isOutdated
2843
+ ? (lang === 'zh'
2844
+ ? '当前 ' + (kindLabel || '客户端') + ' v' + ver + ',服务端已是 v' + refVer + '(可执行 npm i -g agy-family@latest && agy-family hook on 更新)'
2845
+ : 'Running ' + (kindLabel || 'client') + ' v' + ver + '; server is v' + refVer)
2846
+ : (lang === 'zh'
2847
+ ? '当前 ' + (kindLabel || '客户端') + ' 版本 v' + ver + (refVer ? '(已是最新)' : '')
2848
+ : 'Client ' + (kindLabel || '') + ' v' + ver + (refVer ? ' (latest)' : ''));
2849
+ return '<span class="ntag ' + (isOutdated ? 'ntag-warn' : 'ntag-ver') + ' mono" title="' + esc(tip) + '">' + esc(txt) + '</span>';
2850
+ }
2593
2851
  let lastBoardMembers = {};
2594
2852
  let pendingAdminTab = '';
2595
2853
  let currentAdminTab = 'members';
@@ -2750,14 +3008,44 @@ function applyI18n() {
2750
3008
  syncCustomSelects();
2751
3009
  updateRangeTriggerLabel(lastBoardData?.window || null);
2752
3010
  updateAdminHeaderTitle();
3011
+ syncDisplayedVersion(boardServerVersion || adminServerVersion || '0.6.10');
2753
3012
  renderGuideBody();
2754
3013
  }
2755
3014
 
3015
+ function syncDisplayedVersion(ver) {
3016
+ const clean = String(ver || '').replace(/^v/i, '').trim() || '0.6.10';
3017
+ const badge = document.getElementById('boardVersionBadge');
3018
+ if (badge) {
3019
+ badge.textContent = 'v' + clean;
3020
+ badge.title = lang === 'zh'
3021
+ ? '当前版本 v' + clean + ' · 点击查看成员更新方式'
3022
+ : 'Current version v' + clean + ' · Click for upgrade guide';
3023
+ }
3024
+ const foot = document.getElementById('footerVersion');
3025
+ if (foot) foot.textContent = 'agy-family v' + clean + ' · MIT';
3026
+ const sideVer = document.getElementById('adminSidebarVersion');
3027
+ if (sideVer) sideVer.textContent = (lang === 'zh' ? '当前版本 v' : 'Version v') + clean;
3028
+ }
3029
+
2756
3030
  function renderGuideBody() {
2757
3031
  const el = document.getElementById('guideBody');
2758
3032
  if (!el) return;
3033
+ const curVer = String(boardServerVersion || adminServerVersion || '0.6.10').replace(/^v/i, '').trim();
3034
+ const upgradeCmd = 'npm i -g agy-family@latest && agy-family hook on && agy-family sync';
2759
3035
  if (lang === 'zh') {
2760
3036
  el.innerHTML =
3037
+ '<div class="guide-card">' +
3038
+ '<div style="display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap">' +
3039
+ '<strong>当前版本与老成员升级</strong>' +
3040
+ '<span class="ntag ntag-good mono">v' + esc(curVer) + '</span>' +
3041
+ '</div>' +
3042
+ '<div style="color:var(--body);margin-top:6px;line-height:1.6">已加入的成员无需重新填邀请码,运行下方命令即可升级到最新版并刷新 <code>statusLine</code> 协同额度采集:</div>' +
3043
+ '<div style="display:flex;align-items:center;gap:8px;margin-top:8px">' +
3044
+ '<div class="code-block mono" style="flex:1;margin:0">' + esc(upgradeCmd) + '</div>' +
3045
+ '<button type="button" class="btn btn-sm" id="copyUpgradeCmdBtn">复制</button>' +
3046
+ '</div>' +
3047
+ '<div style="color:var(--muted);font-size:11.5px;margin-top:6px">桌面 IDE 扩展(<code>.vsix</code>)可在 <a href="https://github.com/xy-tuoren/agy-family/releases/latest" target="_blank" rel="noopener noreferrer" style="color:var(--primary)">GitHub Releases</a> 下载最新版本覆盖安装。</div>' +
3048
+ '</div>' +
2761
3049
  '<div class="guide-card"><strong>统一 CLI 一行接入(Windows / macOS / Linux · 桌面 IDE 与 agy CLI 通用)</strong>' +
2762
3050
  '<div style="color:var(--body);margin-top:6px;line-height:1.6">复制家庭组管理员发来的 1 行命令在终端执行(需 Node.js ≥ 22.13),即可同时托管本机 <strong>Antigravity 桌面版 IDE + agy CLI</strong>,自动开启后台增量心跳并全局注册 <code>/family</code> 零 Token 指令:</div>' +
2763
3051
  '<div class="code-block mono">npm i -g agy-family &amp;&amp; agy-family join "agyfam://join?d=..." --daemon</div>' +
@@ -2766,6 +3054,18 @@ function renderGuideBody() {
2766
3054
  '<div style="color:var(--body);margin-top:6px;line-height:1.6">仅只读扫描本机对话 SQLite 数值元数据(小时桶 / 模型 / Token 计数),<strong>绝不上传 Prompt、代码、路径或 Google 凭据</strong>;若管理员绑定了家庭组邮箱 <code>SHA-256</code> 指纹,切到个人/工作号期间产生的用量会自动排除免计。</div></div>';
2767
3055
  } else {
2768
3056
  el.innerHTML =
3057
+ '<div class="guide-card">' +
3058
+ '<div style="display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap">' +
3059
+ '<strong>Current Version &amp; Member Upgrade</strong>' +
3060
+ '<span class="ntag ntag-good mono">v' + esc(curVer) + '</span>' +
3061
+ '</div>' +
3062
+ '<div style="color:var(--body);margin-top:6px;line-height:1.6">Existing members keep their credentials and do not need to re-join. Run one line to upgrade and refresh <code>statusLine</code> quota sync:</div>' +
3063
+ '<div style="display:flex;align-items:center;gap:8px;margin-top:8px">' +
3064
+ '<div class="code-block mono" style="flex:1;margin:0">' + esc(upgradeCmd) + '</div>' +
3065
+ '<button type="button" class="btn btn-sm" id="copyUpgradeCmdBtn">Copy</button>' +
3066
+ '</div>' +
3067
+ '<div style="color:var(--muted);font-size:11.5px;margin-top:6px">For the Desktop IDE extension (<code>.vsix</code>), install the latest build from <a href="https://github.com/xy-tuoren/agy-family/releases/latest" target="_blank" rel="noopener noreferrer" style="color:var(--primary)">GitHub Releases</a>.</div>' +
3068
+ '</div>' +
2769
3069
  '<div class="guide-card"><strong>Unified One-Line CLI Setup (Windows / macOS / Linux · Desktop IDE &amp; agy CLI)</strong>' +
2770
3070
  '<div style="color:var(--body);margin-top:6px;line-height:1.6">Run the 1-line command from your family manager (requires Node.js ≥ 22.13) to cover both <strong>Antigravity Desktop IDE and agy CLI</strong>, enable background delta sync, and register <code>/family</code> everywhere:</div>' +
2771
3071
  '<div class="code-block mono">npm i -g agy-family &amp;&amp; agy-family join "agyfam://join?d=..." --daemon</div>' +
@@ -2773,6 +3073,12 @@ function renderGuideBody() {
2773
3073
  '<div class="guide-card"><strong>Privacy &amp; Non-Family Account Auto-Skip</strong>' +
2774
3074
  '<div style="color:var(--body);margin-top:6px;line-height:1.6">Scans only local read-only SQLite numeric stats — never prompts, code, paths, or credentials. When a family email SHA-256 is bound, switching to any other Google account automatically skips non-family usage.</div></div>';
2775
3075
  }
3076
+ document.getElementById('copyUpgradeCmdBtn')?.addEventListener('click', async () => {
3077
+ try {
3078
+ await navigator.clipboard.writeText(upgradeCmd);
3079
+ showToast(lang === 'zh' ? '已复制升级命令' : 'Upgrade command copied');
3080
+ } catch {}
3081
+ });
2776
3082
  }
2777
3083
 
2778
3084
  let hasLoadedBoard = false;
@@ -2999,7 +3305,7 @@ async function fetchBoard(opts) {
2999
3305
  triggerReveal(document.getElementById('modelList'));
3000
3306
  }
3001
3307
  if (expandedMemberId) {
3002
- loadMemberDetail(expandedMemberId);
3308
+ loadMemberDetail(expandedMemberId, { silent });
3003
3309
  }
3004
3310
  } finally {
3005
3311
  if (seq === boardReqSeq && !silent) {
@@ -3168,19 +3474,22 @@ function renderActivityChart(d) {
3168
3474
  svg.onmouseleave = () => tip.classList.remove('show');
3169
3475
  }
3170
3476
 
3171
- async function loadMemberDetail(memberId) {
3477
+ async function loadMemberDetail(memberId, opts) {
3478
+ const silent = Boolean(opts && opts.silent);
3172
3479
  const box = document.getElementById('detail-cell-' + memberId);
3173
3480
  if (!box) return;
3174
3481
  const seq = ++detailReqSeq;
3175
- box.innerHTML =
3176
- '<div class="detail-skel-wrap">' +
3177
- '<div class="detail-skel-head"><span class="inline-spin"></span><span>' + (lang === 'zh' ? '加载成员明细中...' : 'Loading member details...') + '</span></div>' +
3178
- '<div class="detail-grid">' +
3179
- '<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>' +
3180
- '<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>' +
3181
- '<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>' +
3182
- '</div>' +
3183
- '</div>';
3482
+ if (!silent || !box.querySelector('.detail-grid')) {
3483
+ box.innerHTML =
3484
+ '<div class="detail-skel-wrap">' +
3485
+ '<div class="detail-skel-head"><span class="inline-spin"></span><span>' + (lang === 'zh' ? '加载成员明细中...' : 'Loading member details...') + '</span></div>' +
3486
+ '<div class="detail-grid">' +
3487
+ '<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>' +
3488
+ '<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>' +
3489
+ '<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>' +
3490
+ '</div>' +
3491
+ '</div>';
3492
+ }
3184
3493
  const qs = buildBoardQueryParams(false);
3185
3494
  try {
3186
3495
  const res = await fetch('/api/board/member/' + encodeURIComponent(memberId) + '?' + qs.toString(), { headers: viewHeaders(), credentials: 'same-origin' });
@@ -3193,16 +3502,17 @@ async function loadMemberDetail(memberId) {
3193
3502
  const isPoolMode = q.quotaMode === 'pool';
3194
3503
  const quotaPct = q.quotaPct ?? 100;
3195
3504
  const tb = d.tokensBreakdown || {};
3505
+ const curServerVer = d.serverVersion || boardServerVersion || adminServerVersion || '';
3196
3506
 
3197
3507
  const shareWinItem = (lbl, winObj, usedUsd) => {
3198
3508
  const w = winObj || {};
3199
3509
  const st = w.quotaStatus || 'ok';
3200
3510
  const barPct = Math.min(100, Number(w.quotaUsedPct) || 0);
3201
3511
  const rightTxt = isPoolMode
3202
- ? '<strong style="color:var(--ink)">' + (w.quotaUsedPct || 0) + '%</strong> <span style="color:var(--muted)">/ ' + quotaPct + '% (' + fmtUsd(usedUsd) + ')</span>'
3203
- : '<strong style="color:var(--ink)">' + fmtPct(w.sharePct || 0, usedUsd) + '</strong> <span style="color:var(--muted)">/ ' + quotaPct + '% (' + fmtUsd(usedUsd) + ')</span>';
3204
- return '<div style="margin-bottom:7px">' +
3205
- '<div style="display:flex;justify-content:space-between;font-size:11.5px;margin-bottom:3px">' +
3512
+ ? '<strong style="color:var(--ink)">' + (w.quotaUsedPct || 0) + '%</strong> <span style="color:var(--muted)">/ ' + quotaPct + '% · ' + fmtUsd(usedUsd) + '</span>'
3513
+ : '<strong style="color:var(--ink)">' + fmtPct(w.sharePct || 0, usedUsd) + '</strong> <span style="color:var(--muted)">/ ' + quotaPct + '% · ' + fmtUsd(usedUsd) + '</span>';
3514
+ return '<div>' +
3515
+ '<div class="detail-win-head">' +
3206
3516
  '<span style="color:var(--body)">' + esc(lbl) + '</span>' +
3207
3517
  '<span class="mono">' + rightTxt + '</span>' +
3208
3518
  '</div>' +
@@ -3210,23 +3520,26 @@ async function loadMemberDetail(memberId) {
3210
3520
  '</div>';
3211
3521
  };
3212
3522
 
3213
- const costPartsStr = (tb.totalTokens || 0) > 0
3214
- ? (lang === 'zh'
3215
- ? '新输入 ' + fmtTok(tb.inputTokens) + ' (' + fmtUsd(tb.inputUsd) + ') · 输出 ' + fmtTok(tb.outputTokens) + ' (' + fmtUsd(tb.outputUsd) + ') · 缓存 ' + fmtTok(tb.cacheReadTokens) + ' (' + fmtUsd(tb.cacheReadUsd) + ')'
3216
- : 'In ' + fmtTok(tb.inputTokens) + ' (' + fmtUsd(tb.inputUsd) + ') · Out ' + fmtTok(tb.outputTokens) + ' (' + fmtUsd(tb.outputUsd) + ') · Cache ' + fmtTok(tb.cacheReadTokens) + ' (' + fmtUsd(tb.cacheReadUsd) + ')')
3217
- : 'In 0 · Out 0 · Cache 0';
3218
- const thinkLine = (tb.thinkingTokens || 0) > 0
3219
- ? '<div style="color:var(--muted);margin-top:2px">' + (lang === 'zh' ? '思考占比 ' : 'Thinking ') + (tb.thinkingShareOfOutPct || 0) + '% (' + fmtTok(tb.thinkingTokens) + ')</div>'
3220
- : '';
3221
- const cacheBox =
3222
- '<div class="detail-sub-box mono">' +
3223
- '<div style="display:flex;justify-content:space-between;margin-bottom:2px">' +
3224
- '<span>' + (lang === 'zh' ? '缓存命中率' : 'Cache hit') + '</span>' +
3225
- '<strong style="color:var(--good)">' + (tb.cacheHitPct || 0) + '%</strong>' +
3226
- '</div>' +
3227
- '<div style="color:var(--muted);line-height:1.45">' + esc(costPartsStr) + '</div>' +
3228
- thinkLine +
3523
+ const kvTile = (lbl, mainVal, subVal) =>
3524
+ '<div class="detail-kv-tile">' +
3525
+ '<div class="detail-kv-lbl">' + esc(lbl) + '</div>' +
3526
+ '<div class="detail-kv-val mono" title="' + esc(mainVal + (subVal ? ' ' + subVal : '')) + '">' + esc(mainVal) + (subVal ? ' <span>' + esc(subVal) + '</span>' : '') + '</div>' +
3229
3527
  '</div>';
3528
+ const fourthTile = (tb.thinkingTokens || 0) > 0
3529
+ ? kvTile(lang === 'zh' ? '思考占比' : 'Thinking', (tb.thinkingShareOfOutPct || 0) + '%', '(' + fmtTok(tb.thinkingTokens) + ')')
3530
+ : (tb.cacheSavedUsd || 0) > 0
3531
+ ? kvTile(lang === 'zh' ? '缓存省约' : 'Cache saved', fmtUsd(tb.cacheSavedUsd), '')
3532
+ : kvTile(lang === 'zh' ? '对话轮次' : 'Steps', String(d.periodSteps || 0), lang === 'zh' ? '轮' : 'steps');
3533
+ const cacheGrid =
3534
+ '<div class="detail-kv-grid">' +
3535
+ kvTile(lang === 'zh' ? '新输入' : 'Input', fmtTok(tb.inputTokens || 0), '(' + fmtUsd(tb.inputUsd || 0) + ')') +
3536
+ kvTile(lang === 'zh' ? '输出' : 'Output', fmtTok(tb.outputTokens || 0), '(' + fmtUsd(tb.outputUsd || 0) + ')') +
3537
+ kvTile(lang === 'zh' ? '缓存读取' : 'Cache read', fmtTok(tb.cacheReadTokens || 0), '(' + fmtUsd(tb.cacheReadUsd || 0) + ')') +
3538
+ fourthTile +
3539
+ '</div>';
3540
+ const card1Meta = (tb.totalTokens || 0) > 0
3541
+ ? '<span class="detail-col-meta mono" style="color:var(--good)">' + (lang === 'zh' ? '缓存命中 ' : 'Cache ') + (tb.cacheHitPct || 0) + '%</span>'
3542
+ : '';
3230
3543
 
3231
3544
  const mColor = (lastBoardMembers[memberId] && lastBoardMembers[memberId].color) || 'var(--primary)';
3232
3545
  const maxD = Math.max(0.01, ...(d.daily7d || []).map((x) => x.usd));
@@ -3240,53 +3553,91 @@ async function loadMemberDetail(memberId) {
3240
3553
  const devRows = (d.devices || []).length
3241
3554
  ? '<div class="dev-list">' + d.devices.slice(0, 4).map((dev) => {
3242
3555
  const shortId = '#' + String(dev.deviceId || '').slice(-4);
3243
- const plat = dev.platform ? ' · ' + dev.platform : '';
3556
+ const plat = dev.platform || '';
3557
+ const devKind = dev.clientKind || d.lastClientKind || '';
3558
+ const devVer = dev.clientVersion || d.lastClientVersion || '';
3559
+ const devVerBadge = renderClientVersionTag(devKind, devVer, curServerVer);
3244
3560
  const geoTxt = dev.country ? (dev.city ? dev.country + ' · ' + dev.city : dev.country) : '';
3245
- const net = dev.maskedIp
3246
- ? ' · ' + dev.maskedIp + (geoTxt ? ' (' + geoTxt + ')' : '')
3247
- : (geoTxt ? ' · ' + geoTxt : '');
3248
- const usage = (dev.tokens || 0) > 0 ? ' · ' + fmtPct(dev.sharePct || 0, dev.totalUsd) + ' (' + fmtTok(dev.tokens || 0) + ')' : '';
3249
- return '<div class="dev-row mono">' +
3250
- '<span style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap">' + esc(shortId + plat + net + usage) + '</span>' +
3251
- '<span style="color:var(--muted);flex-shrink:0">' + esc(fmtAgo(dev.lastUpdatedAt)) + '</span>' +
3561
+ const netTxt = dev.maskedIp
3562
+ ? dev.maskedIp + (geoTxt ? ' (' + geoTxt + ')' : '')
3563
+ : (geoTxt || (lang === 'zh' ? '本地网络' : 'Local network'));
3564
+ const usageTxt = (dev.tokens || 0) > 0
3565
+ ? fmtPct(dev.sharePct || 0, dev.totalUsd) + ' · ' + fmtTok(dev.tokens || 0)
3566
+ : (lang === 'zh' ? '本窗口无消耗' : 'No usage');
3567
+ return '<div class="dev-item">' +
3568
+ '<div class="dev-top">' +
3569
+ '<div class="dev-id-grp mono"><span class="dev-id-tag">' + esc(shortId) + '</span>' + (plat ? '<span>' + esc(plat) + '</span>' : '') + devVerBadge + '</div>' +
3570
+ '<span class="dev-time mono">' + esc(fmtAgo(dev.lastUpdatedAt)) + '</span>' +
3571
+ '</div>' +
3572
+ '<div class="dev-bot">' +
3573
+ '<span class="dev-net mono" title="' + esc(netTxt) + '">' + esc(netTxt) + '</span>' +
3574
+ '<span class="dev-usage mono">' + esc(usageTxt) + '</span>' +
3575
+ '</div>' +
3252
3576
  '</div>';
3253
3577
  }).join('') + '</div>'
3254
- : '';
3578
+ : '<div class="detail-foot-meta">' + esc(lang === 'zh' ? '暂无已上报设备' : 'No devices reported') + '</div>';
3579
+
3580
+ const srcHeadParts = [];
3581
+ if (d.sources?.desktopUsd > 0 && d.sources?.cliUsd > 0) {
3582
+ srcHeadParts.push('IDE ' + (d.sources?.desktopPct || 0) + '% / CLI ' + (d.sources?.cliPct || 0) + '%');
3583
+ } else if (d.sources?.desktopUsd > 0) {
3584
+ srcHeadParts.push('IDE 100%');
3585
+ } else if (d.sources?.cliUsd > 0) {
3586
+ srcHeadParts.push('CLI 100%');
3587
+ }
3588
+ srcHeadParts.push((d.deviceCount || 0) + (lang === 'zh' ? ' 台设备' : ' dev'));
3589
+ const card2Meta = '<span class="detail-col-meta mono">' + esc(srcHeadParts.join(' · ')) + '</span>';
3255
3590
 
3256
3591
  const estTip = lang === 'zh' ? '未知新模型枚举,按保守参考单价估算' : 'Fallback model pricing';
3257
- const modRows = (d.modelBreakdown || []).length
3258
- ? d.modelBreakdown.slice(0, 5).map((m, i) => {
3592
+ const modList = d.modelBreakdown || [];
3593
+ const modRows = modList.length
3594
+ ? '<div class="detail-model-list">' + modList.slice(0, 5).map((m, i) => {
3259
3595
  const rTip = m.rate ? (lang === 'zh' ? '单价 (每 1M In/Out/Cache):' : 'Rate/1M: ') + fmtRateShort(m.rate) : '';
3260
- return '<div style="display:flex;justify-content:space-between;align-items:center;gap:6px;font-size:11.5px;margin-bottom:5px" title="' + esc(rTip) + '">' +
3261
- '<span class="model-name"><span class="dot" style="width:6px;height:6px;background:' + CURSOR_TIMELINE_COLORS[i % CURSOR_TIMELINE_COLORS.length] + '"></span>' + esc(m.model) + (m.isEstimated ? ' <span class="ntag ntag-gray" title="' + esc(estTip) + '">est</span>' : '') + '</span>' +
3262
- '<span class="mono"><strong style="color:var(--ink)">' + fmtPct(m.sharePct, m.usd) + '</strong> <span style="color:var(--muted)">(' + fmtUsd(m.usd) + ')</span></span>' +
3596
+ const c = CURSOR_TIMELINE_COLORS[i % CURSOR_TIMELINE_COLORS.length];
3597
+ const w = Math.max(3, Math.min(100, Number(m.sharePct) || 0));
3598
+ return '<div class="detail-model-item" title="' + esc(rTip) + '">' +
3599
+ '<div class="detail-model-head">' +
3600
+ '<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>' +
3601
+ '<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>' +
3602
+ '</div>' +
3603
+ '<div class="detail-model-track"><div class="detail-model-fill" style="width:' + w + '%;background:' + c + '"></div></div>' +
3263
3604
  '</div>';
3264
- }).join('')
3265
- : '<div style="font-size:11.5px;color:var(--muted)">' + (lang === 'zh' ? '暂无记录' : 'No usage') + '</div>';
3266
-
3267
- const auditNote = (d.recentIntegrityEvents || []).length
3268
- ? '<div class="detail-sub-box" style="color:var(--danger)">' + esc(d.recentIntegrityEvents[0].summary) + '</div>'
3605
+ }).join('') + '</div>'
3606
+ : '<div style="font-size:11.5px;color:var(--muted)">' + (lang === 'zh' ? '当前窗口暂无模型用量' : 'No model usage in this window') + '</div>';
3607
+ const card3Meta = modList.length
3608
+ ? '<span class="detail-col-meta mono">' + modList.length + (lang === 'zh' ? ' 个模型 · ' : ' models · ') + fmtUsd(d.periodUsd || 0) + '</span>'
3269
3609
  : '';
3270
3610
 
3271
- const verTxt = d.lastClientVersion ? ' · v' + d.lastClientVersion : '';
3272
- const srcSummary = (d.sources?.desktopUsd > 0 || d.sources?.cliUsd > 0)
3273
- ? (lang === 'zh' ? '桌面 ' : 'IDE ') + (d.sources?.desktopPct || 0) + '% / CLI ' + (d.sources?.cliPct || 0) + '% · ' + (d.deviceCount || 0) + (lang === 'zh' ? ' 台设备' : ' dev') + verTxt
3274
- : (d.deviceCount || 0) + (lang === 'zh' ? ' 台设备' : ' dev') + verTxt;
3611
+ const auditEv = (d.recentIntegrityEvents || [])[0] || null;
3612
+ 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>';
3613
+ const card3Bottom = auditEv
3614
+ ? '<div class="detail-audit-box">' +
3615
+ '<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>' +
3616
+ '<div class="detail-audit-body">' + esc(auditEv.summary) + '</div>' +
3617
+ '</div>'
3618
+ : '<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>';
3275
3619
 
3276
3620
  box.innerHTML =
3277
- '<div class="detail-grid agf-reveal">' +
3278
- '<div class="detail-col"><h4>' + (lang === 'zh' ? '多窗口占比与费用构成' : 'Window shares & cost') + '</h4>' +
3279
- shareWinItem(lang === 'zh' ? '今日' : 'Daily', q.today, caps.dailyUsedUsd) +
3280
- shareWinItem(lang === 'zh' ? '近 7 天' : '7 days', q.weekly, caps.weeklyUsedUsd) +
3281
- shareWinItem(lang === 'zh' ? '本周期' : 'Cycle', q.cycle, caps.cycleUsedUsd) +
3282
- cacheBox +
3621
+ '<div class="detail-grid' + (silent ? '' : ' agf-reveal') + '">' +
3622
+ '<div class="detail-col">' +
3623
+ '<div class="detail-col-head"><h4>' + (lang === 'zh' ? '多窗口占比与费用' : 'Window shares & cost') + '</h4>' + card1Meta + '</div>' +
3624
+ '<div class="detail-win-list">' +
3625
+ shareWinItem(lang === 'zh' ? '今日' : 'Daily', q.today, caps.dailyUsedUsd) +
3626
+ shareWinItem(lang === 'zh' ? '近 7 天' : '7 days', q.weekly, caps.weeklyUsedUsd) +
3627
+ shareWinItem(lang === 'zh' ? '本周期' : 'Cycle', q.cycle, caps.cycleUsedUsd) +
3628
+ '</div>' +
3629
+ cacheGrid +
3283
3630
  '</div>' +
3284
- '<div class="detail-col"><h4>' + (lang === 'zh' ? '近 7 天走势与设备' : '7-day trend & devices') + '</h4>' +
3631
+ '<div class="detail-col">' +
3632
+ '<div class="detail-col-head"><h4>' + (lang === 'zh' ? '近 7 天走势与设备' : '7-day trend & devices') + '</h4>' + card2Meta + '</div>' +
3285
3633
  '<div class="mini-bars">' + bars7d + '</div>' +
3286
- '<div style="font-size:11px;color:var(--muted);margin-top:6px" class="mono">' + esc(srcSummary) + '</div>' +
3287
3634
  devRows +
3288
3635
  '</div>' +
3289
- '<div class="detail-col"><h4>' + (lang === 'zh' ? '模型使用占比' : 'Model share') + '</h4>' + modRows + auditNote + '</div>' +
3636
+ '<div class="detail-col">' +
3637
+ '<div class="detail-col-head"><h4>' + (lang === 'zh' ? '模型使用占比' : 'Model share') + '</h4>' + card3Meta + '</div>' +
3638
+ modRows +
3639
+ card3Bottom +
3640
+ '</div>' +
3290
3641
  '</div>';
3291
3642
 
3292
3643
  focusedMemberDetail = d;
@@ -3370,6 +3721,9 @@ function renderMemberRows(d) {
3370
3721
  const isPoolMode = d.summary?.quotaMode === 'pool';
3371
3722
  const isLowSample = Boolean(d.summary?.isLowSampleRelative);
3372
3723
  const memberCount = Number(d.summary?.memberCount) || sorted.length || 1;
3724
+ const prevExpandedHtml = expandedMemberId
3725
+ ? (document.getElementById('detail-cell-' + expandedMemberId)?.innerHTML || '')
3726
+ : '';
3373
3727
 
3374
3728
  tbody.innerHTML = sorted.map((m) => {
3375
3729
  const rawQStatus = m.quotaStatus || 'ok';
@@ -3448,8 +3802,10 @@ function renderMemberRows(d) {
3448
3802
  subParts.push((lang === 'zh' ? '参考 ' : 'ref ') + fmtUsd(m.usedUsd));
3449
3803
 
3450
3804
  const emailHintHtml = m.emailHint
3451
- ? '<span class="mono" style="color:var(--body)">· ' + esc(m.emailHint) + '</span>'
3805
+ ? '<span class="meta-sep">·</span><span class="mono" style="color:var(--body)">' + esc(m.emailHint) + '</span>'
3452
3806
  : '';
3807
+ const curServerVer = d.serverVersion || boardServerVersion || adminServerVersion || '';
3808
+ const clientVerTag = renderClientVersionTag(m.lastClientKind, m.lastClientVersion, curServerVer, { showUnknown: Boolean(m.lastSeenAt) });
3453
3809
  const mqMem = m.subscriptionQuota || null;
3454
3810
  let memQuotaTag = '';
3455
3811
  if (mqMem && mqMem.gemini) {
@@ -3485,16 +3841,15 @@ function renderMemberRows(d) {
3485
3841
  devMetaBits.push(m.deviceCount + (lang === 'zh' ? ' 台设备' : ' dev'));
3486
3842
  }
3487
3843
  const devMetaHtml = devMetaBits.length
3488
- ? '<span class="mono" style="opacity:.86">· ' + esc(devMetaBits.join(' · ')) + '</span>'
3844
+ ? devMetaBits.map((bit) => '<span class="meta-sep">·</span><span class="mono" style="opacity:.88">' + esc(bit) + '</span>').join('')
3489
3845
  : '';
3490
3846
 
3491
- let rowHtml = '<tr class="member-row' + (isMe ? ' is-me' : '') + '" data-member-id="' + esc(m.id) + '">' +
3847
+ let rowHtml = '<tr class="member-row' + (isMe ? ' is-me' : '') + (isExpanded ? ' is-expanded' : '') + '" data-member-id="' + esc(m.id) + '">' +
3492
3848
  '<td><div class="member-cell">' +
3493
3849
  '<span class="toggle-tri' + (isExpanded ? ' open' : '') + '">' + triSvg + '</span>' +
3494
- '<span class="dot" style="background:' + esc(m.color) + '"></span>' +
3495
- '<div>' +
3496
- '<div class="member-name-row"><span class="member-name">' + esc(m.name) + '</span>' + roleTag + meTag + acctTag + memQuotaTag + statusTag + integrityTag + '</div>' +
3497
- '<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>' +
3850
+ '<div class="member-info">' +
3851
+ '<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>' +
3852
+ '<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>' +
3498
3853
  '</div>' +
3499
3854
  '</div></td>' +
3500
3855
  '<td><div class="meter-box"' + (meterTip ? ' title="' + esc(meterTip) + '"' : '') + '>' +
@@ -3510,9 +3865,17 @@ function renderMemberRows(d) {
3510
3865
  }
3511
3866
  return rowHtml;
3512
3867
  }).join('');
3868
+ if (expandedMemberId && prevExpandedHtml) {
3869
+ const newBox = document.getElementById('detail-cell-' + expandedMemberId);
3870
+ if (newBox) newBox.innerHTML = prevExpandedHtml;
3871
+ }
3513
3872
  }
3514
3873
 
3515
3874
  function renderBoard(d) {
3875
+ if (d.serverVersion) {
3876
+ boardServerVersion = d.serverVersion;
3877
+ syncDisplayedVersion(d.serverVersion);
3878
+ }
3516
3879
  const title = d.boardTitle || 'Antigravity 家庭组';
3517
3880
  document.getElementById('boardTitle').textContent = title;
3518
3881
  document.title = title;
@@ -4023,9 +4386,8 @@ async function loadAdmin() {
4023
4386
  const adminEmail = m.email_address || m.email_hint || '';
4024
4387
  const emailInfo = adminEmail ? ' · ' + adminEmail : '';
4025
4388
  const cliVer = m.last_client_version ? String(m.last_client_version) : '';
4026
- const isOutdatedCli = Boolean(cliVer && adminServerVersion && cliVer !== adminServerVersion);
4027
4389
  const verTag = cliVer
4028
- ? ' <span class="ntag ' + (isOutdatedCli ? 'ntag-warn' : 'ntag-gray') + '" title="' + esc(isOutdatedCli ? (lang === 'zh' ? '服务端已是 v' + adminServerVersion + ',成员可执行 npm i -g agy-family@latest 更新' : 'Server is v' + adminServerVersion) : 'Client version') + '">v' + esc(cliVer) + (isOutdatedCli ? (lang === 'zh' ? ' 旧版' : ' old') : '') + '</span>'
4390
+ ? ' ' + renderClientVersionTag(m.last_client_kind, cliVer, adminServerVersion)
4029
4391
  : '';
4030
4392
  const acctAdminTag = m.account_status === 'verified'
4031
4393
  ? ' <span class="ntag ntag-good">' + esc(t('acctVerified')) + '</span>'
@@ -4776,7 +5138,7 @@ function scheduleAutoRefresh() {
4776
5138
  if (autoRefreshSec > 0) {
4777
5139
  autoRefreshTimer = setInterval(() => {
4778
5140
  if (document.hidden) return;
4779
- fetchBoard({ silent: true });
5141
+ fetchBoard({ silent: true }).catch(() => {});
4780
5142
  }, autoRefreshSec * 1000);
4781
5143
  }
4782
5144
  }
@@ -4795,7 +5157,7 @@ document.getElementById('autoRefreshSelect')?.addEventListener('change', (ev) =>
4795
5157
 
4796
5158
  document.addEventListener('visibilitychange', () => {
4797
5159
  if (!document.hidden && autoRefreshSec > 0 && Date.now() - lastBoardFetchedAt >= autoRefreshSec * 1000) {
4798
- fetchBoard({ silent: true });
5160
+ fetchBoard({ silent: true }).catch(() => {});
4799
5161
  }
4800
5162
  });
4801
5163
 
@@ -5177,10 +5539,12 @@ document.getElementById('exportCsvBtn').addEventListener('click', async () => {
5177
5539
  });
5178
5540
  });
5179
5541
 
5180
- document.getElementById('guideBtn').addEventListener('click', () => {
5542
+ function openGuideModal() {
5181
5543
  renderGuideBody();
5182
5544
  document.getElementById('guideOverlay').classList.add('open');
5183
- });
5545
+ }
5546
+ document.getElementById('guideBtn').addEventListener('click', openGuideModal);
5547
+ document.getElementById('boardVersionBadge')?.addEventListener('click', openGuideModal);
5184
5548
  document.getElementById('closeGuide').addEventListener('click', () => {
5185
5549
  document.getElementById('guideOverlay').classList.remove('open');
5186
5550
  });