mirror of
https://github.com/lWolvesl/antigravity-usage-monitor.git
synced 2026-11-27 01:19:25 +08:00
feat(panel): add worker hot-reload, sticky bridge lease, custom token combos, trimmed model IDs, and adaptive popover width
- Isolate SidecarApp /api/* backend runtime inside a hot-swappable Worker thread (sidecar-worker.mjs) with 3s disk-drift detection and queued request handoff so live plugin updates never drop the host-assigned SidecarApp port - Persist and reuse sticky loopback bridge port/token leases across bridge-daemon and worker reloads, pre-bind the bridge server on boot, allow /api/cache/rebuild on the bridge, and self-heal poisoned CDP fallback states back to HTTP - Add billing-aligned In / Out / Cache (tokens_io_cache) preset with per-segment USD hover breakdown and custom format DSL (tokens_custom + stepTokenComboFormat, e.g. context:new:cache, in:out:cache) - Add 3-way model name format (short / upstream / upstream_compact) stripping gemini-, claude-, and gpt- prefixes while protecting compaction suffixes from ellipsis truncation - Add adaptive content-fit popover width (auto up to viewport bounds on wide step tables) alongside custom fixed width (440-1080 px)
This commit is contained in:
@@ -12,10 +12,15 @@
|
||||
import { resolve } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import {
|
||||
bootBundleVersion,
|
||||
bootWindowBridgeRuntime,
|
||||
setStandalonePortListener,
|
||||
} from './backend/api-actions.mjs';
|
||||
import { loadSettings, normalizeStandalonePort } from './backend/config.mjs';
|
||||
import {
|
||||
computeRuntimeCodeVersion,
|
||||
loadSettings,
|
||||
normalizeStandalonePort,
|
||||
} from './backend/config.mjs';
|
||||
import {
|
||||
createStandaloneWebServer,
|
||||
parseStandaloneCliArgs,
|
||||
@@ -42,6 +47,19 @@ export function startBridgeDaemon() {
|
||||
onRestart: triggerRestart,
|
||||
});
|
||||
|
||||
const driftWatchTimer = setInterval(() => {
|
||||
if (shuttingDown) return;
|
||||
try {
|
||||
const diskVersion = String(computeRuntimeCodeVersion() || '');
|
||||
if (bootBundleVersion && diskVersion && diskVersion !== String(bootBundleVersion)) {
|
||||
triggerRestart();
|
||||
}
|
||||
} catch {
|
||||
// 忽略文件覆盖期间瞬态 stat 异常
|
||||
}
|
||||
}, 3000);
|
||||
driftWatchTimer.unref?.();
|
||||
|
||||
function resolveDesiredStandalonePort(settingsOverride = null) {
|
||||
if (envPinnedPort !== null) {
|
||||
return envPinnedPort;
|
||||
@@ -102,6 +120,7 @@ export function startBridgeDaemon() {
|
||||
async function shutdown({ disposeWindows = false, exitCode = 0 } = {}) {
|
||||
if (shuttingDown) return;
|
||||
shuttingDown = true;
|
||||
clearInterval(driftWatchTimer);
|
||||
setStandalonePortListener(null);
|
||||
const forceTimer = setTimeout(() => {
|
||||
process.exit(exitCode);
|
||||
|
||||
Reference in New Issue
Block a user