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:
fish
2026-11-16 16:55:56 +09:00
parent cd841b55cf
commit 3b36ade911
33 changed files with 3124 additions and 381 deletions
+22 -8
View File
@@ -22,6 +22,7 @@ import {
loadSettings,
lsRuntimeEndpoint,
normalizeFullSettings,
normalizeModelDisplayMode,
normalizePluginUpdateMode,
normalizeWindowMountMode,
saveJson,
@@ -38,6 +39,7 @@ import { callLsRpc, getContextModelCatalog } from './ls-rpc.mjs';
import {
performPluginUpdate,
scheduleSidecarRestart,
setSidecarRestartHandler,
syncCloudCatalog,
} from './plugin-updater.mjs';
import { getCloudStatus } from './pricing-catalog.mjs';
@@ -124,19 +126,19 @@ function projectDisplayStep(st) {
stepIndex, createdAtMs, isCompactionStep, modelKey, modelShort, modelLabel,
modelUpstream, responseModel, modelSource, tokPerSec, ttftSec, totalDurationSec,
streamDurationSec, selectedSpeedReason, contextTokens, inputTokens, cacheReadTokens,
outputTokens, thinkingTokens, responseTokens, cacheHitPct, costUsd, agentId,
agentCascadeId, agentLabel, agentBadge, agentRole, agentIndex, isSubagent,
turnIndex, isTurnStart, isLatestTurn, turnPrompt, rootTurnIndex, isRootTurnStart,
isRootLatestTurn, rootTurnPrompt,
outputTokens, thinkingTokens, responseTokens, cacheHitPct, costUsd, inCostUsd,
cacheCostUsd, outCostUsd, agentId, agentCascadeId, agentLabel, agentBadge,
agentRole, agentIndex, isSubagent, turnIndex, isTurnStart, isLatestTurn,
turnPrompt, rootTurnIndex, isRootTurnStart, isRootLatestTurn, rootTurnPrompt,
} = st;
return {
stepIndex, createdAtMs, isCompactionStep, modelKey, modelShort, modelLabel,
modelUpstream, responseModel, modelSource, tokPerSec, ttftSec, totalDurationSec,
streamDurationSec, selectedSpeedReason, contextTokens, inputTokens, cacheReadTokens,
outputTokens, thinkingTokens, responseTokens, cacheHitPct, costUsd, agentId,
agentCascadeId, agentLabel, agentBadge, agentRole, agentIndex, isSubagent,
turnIndex, isTurnStart, isLatestTurn, turnPrompt, rootTurnIndex, isRootTurnStart,
isRootLatestTurn, rootTurnPrompt,
outputTokens, thinkingTokens, responseTokens, cacheHitPct, costUsd, inCostUsd,
cacheCostUsd, outCostUsd, agentId, agentCascadeId, agentLabel, agentBadge,
agentRole, agentIndex, isSubagent, turnIndex, isTurnStart, isLatestTurn,
turnPrompt, rootTurnIndex, isRootTurnStart, isRootLatestTurn, rootTurnPrompt,
};
}
@@ -288,6 +290,14 @@ export function executeSettingsAction(data) {
: 'dual'
: 'sidebar'
: normalizeWindowMountMode(current.windowMountMode, current.enableWindowOverlay);
const nextModelDisplayMode =
payload.modelDisplayMode !== undefined
? normalizeModelDisplayMode(payload.modelDisplayMode)
: typeof payload.showUpstreamModel === 'boolean'
? payload.showUpstreamModel
? 'upstream'
: 'short'
: normalizeModelDisplayMode(current.modelDisplayMode, current.showUpstreamModel);
const updated = normalizeFullSettings({
...current,
...payload,
@@ -300,6 +310,7 @@ export function executeSettingsAction(data) {
payload.weeklyCostBudget,
current.weeklyCostBudget
),
modelDisplayMode: nextModelDisplayMode,
pluginUpdateMode: nextPluginUpdateMode,
windowMountMode: nextWindowMountMode,
});
@@ -528,6 +539,9 @@ export function bootWindowBridgeRuntime({ allowDynamicLs = false, onRestart = nu
const triggerRestart =
typeof onRestart === 'function' ? onRestart : () => scheduleSidecarRestart(150);
if (typeof onRestart === 'function') {
setSidecarRestartHandler(onRestart);
}
if (lsRuntimeEndpoint.baseUrl) {
syncCloudCatalog({ force: false }).catch(() => {});