feat(panel): add inline CLI statusLine capsule, step speed color toggle, and refined defaults

- Auto-provision native Antigravity CLI `statusLine` (`stack_with_default: false`) in `~/.gemini/antigravity-cli/settings.json` while strictly preserving custom third-party `statusLine.command` scripts, using zero-double-quote Windows commands compatible with Go `syscall.EscapeArg` under `cmd /c`
- Add `cli-statusline.mjs` and `cli-statusline-config.mjs` to render a single-line transparent 24-bit ANSI footer (`? for shortcuts` left, live multi-session & 1..5 capsule metrics centered, deduplicated `mode · model · effort` right) with responsive narrow-terminal fallbacks and `stdin` quota fallback
- Persist `cli-status-snapshot.json` during telemetry builds and self-heal sidecar restarts inside `executeTelemetryAction` error paths when `computeRuntimeCodeVersion()` advances
- Add `enableCliStatusLine` and `showStepSpeedColor` preferences in Settings -> Structure, rename the mount sub-tab/section label in `zh-CN` to `挂载胶囊`, set default `topbarCapsuleSlots` to `['tps', 'ttft', 'context']`, and default `showStepTurnRail` and `showStepSpeedColor` to `false`
- Add unit and end-to-end tests across `backend.test.mjs` and `window-bridge.test.mjs`, and update `README.md` / `README.zh-CN.md`
This commit is contained in:
fish
2026-11-16 14:00:05 +09:00
parent 76669d5cc7
commit cd841b55cf
23 changed files with 2478 additions and 125 deletions
+6 -2
View File
@@ -1,5 +1,6 @@
import fs from 'node:fs';
import path from 'node:path';
import { pathToFileURL } from 'node:url';
import vm from 'node:vm';
import { randomUUID } from 'node:crypto';
import { isDeepStrictEqual } from 'node:util';
@@ -22,6 +23,7 @@ const BACKEND_MODULE_FILES = [
'../backend/settings-schema.mjs',
'../backend/config.mjs',
'../backend/cli-sqlite-reader.mjs',
'../backend/cli-statusline-config.mjs',
'../backend/ls-discovery.mjs',
'../backend/pricing-catalog.mjs',
'../backend/plugin-updater.mjs',
@@ -82,6 +84,8 @@ export function backendHarness({
console:{error:m=>state.errors.push(m)},
cpSync:()=>{},
rmSync:()=>{},
renameSync:()=>{},
unlinkSync:()=>{},
execFile:execFileImpl || ((cmd,args,opts,cb)=>{
const fn = typeof opts === 'function' ? opts : cb;
fn(new Error('execFile not mocked'));
@@ -150,7 +154,7 @@ export function backendHarness({
writeTrajectoryCacheFile:(p,data)=>{
state.saves.push({path:p,data:JSON.parse(JSON.stringify(data))});
},
homedir:()=>'/test-home',dirname:path.dirname,join:path.join,basename:path.basename,fileURLToPath:()=>mainPath,
homedir:()=>'/test-home',dirname:path.dirname,join:path.join,basename:path.basename,delimiter:path.delimiter,pathToFileURL,fileURLToPath:()=>mainPath,
Response:class {constructor(body,options){this.body=body;this.options=options;}},
SidecarApp:class {page(){} api(){} run(){}},
fetch:async(url,options={})=>{
@@ -172,6 +176,6 @@ export function backendHarness({
return {ok:true,json:async()=>data};
},
};
vm.runInNewContext(source+'\n globalThis.api={buildTelemetryPayloadInternal,executeTelemetryAction,computeStepCost,resolveModelInfo,inferFamilyFromProviderOrKey,isArgonModelIdentifier,isCarbonModelIdentifier,getBaseModelLabel,formatUpstreamModelId,PLACEHOLDER_MAP,normalizeQuotaFraction,classifyOfficialBucketWindow,classifyQuotaPoolIdentity,buildOfficialQuotaPools,resolveTimeWindow,sanitizeCatalogPayload,rebuildActiveCatalog,syncCloudCatalog,getCloudStatus,isValidSemver,compareSemver,performPluginUpdate,resolveMigratedGitRemoteUrl,loadSettings,executeSettingsAction,executeModelContextWindowAction,executeResetSettingsAction,executeRebuildCacheAction,clearRuntimeCaches,normalizeTopbarCapsuleSlots,normalizeHoverModules,normalizeOverviewModules,normalizeOverviewMetrics,normalizeStepTableColumns,normalizeStandalonePort,setStandalonePortListener,parseAnnotationPbtxtTitle};',ctx);
vm.runInNewContext(source+'\n globalThis.api={buildTelemetryPayloadInternal,executeTelemetryAction,computeStepCost,resolveModelInfo,inferFamilyFromProviderOrKey,isArgonModelIdentifier,isCarbonModelIdentifier,getBaseModelLabel,formatUpstreamModelId,PLACEHOLDER_MAP,normalizeQuotaFraction,classifyOfficialBucketWindow,classifyQuotaPoolIdentity,buildOfficialQuotaPools,resolveTimeWindow,sanitizeCatalogPayload,rebuildActiveCatalog,syncCloudCatalog,getCloudStatus,isValidSemver,compareSemver,performPluginUpdate,resolveMigratedGitRemoteUrl,loadSettings,executeSettingsAction,executeModelContextWindowAction,executeResetSettingsAction,executeRebuildCacheAction,clearRuntimeCaches,normalizeTopbarCapsuleSlots,normalizeHoverModules,normalizeOverviewModules,normalizeOverviewMetrics,normalizeStepTableColumns,normalizeStandalonePort,setStandalonePortListener,parseAnnotationPbtxtTitle,buildCliStatusSnapshot,buildCliStatusLineCommand,isManagedCliStatusLineCommand,applyCliStatusLineToSettingsObject,cliDisplayWidth,parseCliModelAndEffort,formatCliStatusLineCapsule};',ctx);
return {...ctx.api,state};
}
+431 -6
View File
@@ -967,12 +967,14 @@ test('preferences schema defaults match pre-refactor UI, migrate legacy none slo
assert.equal(def.windowMountMode, 'dual');
assert.equal(def.enableWindowOverlay, true);
assert.equal(def.showTopbarMultiSession, true);
assert.deepEqual([...def.topbarCapsuleSlots], ['context', 'tps', 'quota_auto']);
assert.equal(def.enableCliStatusLine, true);
assert.deepEqual([...def.topbarCapsuleSlots], ['tps', 'ttft', 'context']);
assert.deepEqual([...def.hoverModules], ['metrics', 'context', 'quotas']);
assert.deepEqual([...def.overviewModules], ['metrics', 'context', 'quotas', 'live_tasks']);
assert.deepEqual([...def.overviewMetrics], ['tps', 'ttft', 'avg_tps', 'step_cost']);
assert.equal(def.showStepTurnRail, true);
assert.equal(def.showStepTurnRail, false);
assert.equal(def.showStepAgentBadge, true);
assert.equal(def.showStepSpeedColor, false);
assert.deepEqual([...def.stepTableColumns], ['step', 'model', 'tps', 'ttft', 'tokens_combo', 'cache', 'cost']);
assert.deepEqual({ ...def.modelContextWindows }, {});
@@ -1003,8 +1005,10 @@ test('preferences schema defaults match pre-refactor UI, migrate legacy none slo
hoverModules: ['metrics', 'context'],
overviewModules: ['quotas', 'metrics'],
overviewMetrics: ['avg_tps', 'cache_hit'],
showStepTurnRail: false,
enableCliStatusLine: false,
showStepTurnRail: true,
showStepAgentBadge: false,
showStepSpeedColor: true,
stepTableColumns: ['step', 'time', 'model', 'duration', 'input_tokens', 'output_tokens', 'cost'],
contextLimitOverrideTokens: 128000,
modelContextWindows: { MODEL_PLACEHOLDER_M418: '900K' },
@@ -1017,8 +1021,10 @@ test('preferences schema defaults match pre-refactor UI, migrate legacy none slo
assert.deepEqual([...saveRes.updated.hoverModules], ['metrics', 'context']);
assert.deepEqual([...saveRes.updated.overviewModules], ['quotas', 'metrics']);
assert.deepEqual([...saveRes.updated.overviewMetrics], ['avg_tps', 'cache_hit']);
assert.equal(saveRes.updated.showStepTurnRail, false);
assert.equal(saveRes.updated.enableCliStatusLine, false);
assert.equal(saveRes.updated.showStepTurnRail, true);
assert.equal(saveRes.updated.showStepAgentBadge, false);
assert.equal(saveRes.updated.showStepSpeedColor, true);
assert.equal(saveRes.updated.contextLimitOverrideTokens, undefined);
assert.deepEqual({ ...saveRes.updated.modelContextWindows }, {});
@@ -1046,9 +1052,11 @@ test('preferences schema defaults match pre-refactor UI, migrate legacy none slo
assert.equal(resetRes.ok, true);
assert.equal(resetRes.updated.language, 'zh-CN');
assert.equal(resetRes.updated.themeAccent, 'host');
assert.equal(resetRes.updated.showStepTurnRail, true);
assert.equal(resetRes.updated.enableCliStatusLine, true);
assert.equal(resetRes.updated.showStepTurnRail, false);
assert.equal(resetRes.updated.showStepAgentBadge, true);
assert.deepEqual([...resetRes.updated.topbarCapsuleSlots], ['context', 'tps', 'quota_auto']);
assert.equal(resetRes.updated.showStepSpeedColor, false);
assert.deepEqual([...resetRes.updated.topbarCapsuleSlots], ['tps', 'ttft', 'context']);
});
test('assigns unified rootTurnIndex across interleaved main and subagent steps so multi-agent turn rail never fragments', async () => {
@@ -1760,3 +1768,420 @@ test('Antigravity CLI annotations.pbtxt + SQLite trajectory reader recovers titl
rmSync(tempRoot, { recursive: true, force: true });
}
});
test('provisions Antigravity CLI statusLine safely and renders live capsule from stdin + SQLite + quota snapshot', async (t) => {
const DatabaseSync = getNodeSqliteDatabaseSync();
if (!DatabaseSync) {
t.skip('node:sqlite is unavailable in this Node runtime');
return;
}
const h = backendHarness();
assert.equal(
h.buildCliStatusLineCommand('C:\\Users\\Administrator\\.gemini\\config\\plugins\\usage-monitor\\sidecars\\panel\\cli-statusline.mjs', {
platform: 'win32',
nodeOnPath: true,
}),
'node C:/Users/Administrator/.gemini/config/plugins/usage-monitor/sidecars/panel/cli-statusline.mjs'
);
const winSpaceCmd = h.buildCliStatusLineCommand(
'C:\\Users\\Alice Smith\\.gemini\\config\\plugins\\usage-monitor\\sidecars\\panel\\cli-statusline.mjs',
{
platform: 'win32',
execPath: 'C:\\Program Files\\nodejs\\node.exe',
nodeOnPath: false,
}
);
assert.equal(
winSpaceCmd,
"node --input-type=module -e import('file:///C:/Users/Alice%20Smith/.gemini/config/plugins/usage-monitor/sidecars/panel/cli-statusline.mjs#autorun')"
);
assert.equal(winSpaceCmd.includes('"'), false, 'Windows command must contain zero double quotes so Go syscall.EscapeArg never injects \\"');
assert.equal(h.isManagedCliStatusLineCommand('node C:/path/to/cli-statusline.mjs'), true);
assert.equal(h.isManagedCliStatusLineCommand(winSpaceCmd), true);
assert.equal(h.isManagedCliStatusLineCommand('node "C:/legacy/path/cli-statusline.mjs"'), true);
assert.equal(h.isManagedCliStatusLineCommand('python C:/custom/my-status.py'), false);
// Never overwrites user's third-party statusLine command
const customPreserved = h.applyCliStatusLineToSettingsObject(
{ theme: 'dark', statusLine: { type: 'command', command: 'python ~/my-status.py', enabled: true } },
{ enabled: true, command: 'node "/plugin/cli-statusline.mjs"' }
);
assert.equal(customPreserved.changed, false);
assert.equal(customPreserved.preservedCustom, true);
// Migrates legacy managed stack_with_default: true to single-line inline stack_with_default: false
const migratedStack = h.applyCliStatusLineToSettingsObject(
{
statusLine: {
type: 'command',
command: 'node C:/plugin/cli-statusline.mjs',
enabled: true,
padding: 0,
stack_with_default: true,
},
},
{ enabled: true, command: 'node C:/plugin/cli-statusline.mjs' }
);
assert.equal(migratedStack.changed, true);
assert.equal(migratedStack.object.statusLine.stack_with_default, false);
assert.deepEqual({ ...h.parseCliModelAndEffort('Gemini 4 Hydrogen (Medium)', 'medium') }, {
modelName: 'Gemini 4 Hydrogen',
effort: 'medium',
});
assert.deepEqual({ ...h.parseCliModelAndEffort('Gemini 4 Hydrogen (High)', '') }, {
modelName: 'Gemini 4 Hydrogen',
effort: 'high',
});
// Capsule formatting in NO_COLOR and 24-bit ANSI modes uses transparent background (zero 48;...m SGR)
const plainCapsule = h.formatCliStatusLineCapsule(
{
hasTelemetry: true,
runningCount: 0,
runningSubCount: 0,
ttft: 11.8,
tps: 38.1,
usedPct: 17,
quotas: { activePool: { remainingPct: 57 } },
},
{
slots: ['ttft', 'tps', 'quota_auto', 'context'],
showMultiSession: true,
language: 'zh-CN',
color: false,
}
);
assert.equal(plainCapsule, '● 0 运行中 11.8s | 38.1 t/s | 余 57% | ◎ 17%');
const ansiCapsule = h.formatCliStatusLineCapsule(
{
hasTelemetry: true,
runningCount: 2,
runningSubCount: 1,
ttft: 1.25,
tps: 68.4,
usedPct: 75,
quotas: { activePool: { remainingPct: 22 } },
},
{
slots: ['ttft', 'tps', 'quota_auto', 'context'],
showMultiSession: true,
language: 'zh-CN',
color: true,
}
);
assert.equal(/\x1b\[48;/.test(ansiCapsule), false, 'Emits zero background SGR codes');
assert.equal(/\x1b\]/.test(ansiCapsule), false, 'Contains zero OSC sequences so Bubble Tea width never breaks');
assert.equal(
ansiCapsule.replace(/\x1b\[[0-9;]*m/g, ''),
'● 2 运行中 · 1 子 1.3s | 68.4 t/s | 余 22% | ◎ 75%'
);
// Full 3-column single-line bar with left shortcuts, centered metrics, and right mode/model/effort
const inlineBar120 = h.formatCliStatusLineCapsule(
{
hasTelemetry: true,
runningCount: 2,
runningSubCount: 0,
ttft: 5.6,
tps: 22.0,
usedPct: 2,
quotas: { activePool: { remainingPct: 54 } },
},
{
slots: ['ttft', 'tps', 'quota_auto', 'context'],
showMultiSession: true,
language: 'zh-CN',
color: true,
terminalWidth: 120,
cycleMode: 'auto',
modelDisplayName: 'Gemini 4 Hydrogen (Medium)',
modelEffort: 'medium',
}
);
assert.equal(/\x1b\[48;/.test(inlineBar120), false, 'Inline 3-column bar has zero background SGR');
const plainBar120 = inlineBar120.replace(/\x1b\[[0-9;]*m/g, '');
assert.ok(plainBar120.startsWith('? for shortcuts '), 'Keeps ? for shortcuts on the left');
assert.ok(plainBar120.includes('● 2 运行中 5.6s | 22.0 t/s | 余 54% | ◎ 2%'), 'Centers capsule metrics inline');
assert.ok(plainBar120.endsWith(' auto · Gemini 4 Hydrogen · medium'), 'Renders deduplicated mode · model · effort on the right');
assert.equal(h.cliDisplayWidth(inlineBar120), 119, 'Fits cleanly within terminalWidth - 1 without wrapping');
// Narrow 80-column terminal gracefully compacts without wrapping
const inlineBar80 = h.formatCliStatusLineCapsule(
{
hasTelemetry: true,
runningCount: 2,
runningSubCount: 0,
ttft: 5.6,
tps: 22.0,
usedPct: 2,
quotas: { activePool: { remainingPct: 54 } },
},
{
slots: ['ttft', 'tps', 'quota_auto', 'context'],
showMultiSession: true,
language: 'zh-CN',
color: false,
terminalWidth: 80,
cycleMode: 'auto',
modelDisplayName: 'Gemini 4 Hydrogen (Medium)',
modelEffort: 'medium',
}
);
assert.ok(h.cliDisplayWidth(inlineBar80) <= 79, 'Narrow 80-col bar never overflows terminalWidth - 1');
assert.ok(inlineBar80.includes('5.6s | 22.0 t/s | 余 54% | ◎ 2%'));
// End-to-end filesystem + subprocess verification
const tempRoot = mkdtempSync(fileURLToPath(new URL('./.cli-statusline-', import.meta.url)));
try {
const cliDir = join(tempRoot, 'antigravity-cli');
const convDir = join(cliDir, 'conversations');
const dataDir = join(tempRoot, 'data');
mkdirSync(convDir, { recursive: true });
mkdirSync(dataDir, { recursive: true });
const cliSettingsFile = join(cliDir, 'settings.json');
writeFileSync(
cliSettingsFile,
JSON.stringify({ selectedAuthType: 'oauth', model: 'gemini-3.1-pro-high' }, null, 2),
'utf8'
);
const statusLineScript = fileURLToPath(new URL('../cli-statusline.mjs', import.meta.url));
const installEnv = {
...process.env,
ANTIGRAVITY_GEMINI_DIR: tempRoot,
USAGE_MONITOR_DATA_DIR: dataDir,
USAGE_MONITOR_ALLOW_TEST_CLI_SETTINGS: '1',
};
const installOut = JSON.parse(
execFileSync(process.execPath, [statusLineScript, '--install'], {
env: installEnv,
encoding: 'utf8',
}).trim()
);
assert.equal(installOut.updated, true);
const writtenSettings = JSON.parse(readFileSync(cliSettingsFile, 'utf8'));
assert.equal(writtenSettings.selectedAuthType, 'oauth', 'Existing CLI settings preserved');
assert.equal(writtenSettings.statusLine.type, 'command');
assert.equal(writtenSettings.statusLine.enabled, true);
assert.equal(writtenSettings.statusLine.stack_with_default, false);
assert.ok(writtenSettings.statusLine.command.includes('cli-statusline.mjs'));
// Prepare real SQLite conversation + summaries + quota snapshot + custom user slot order
const cid = '22222222-3333-4444-5555-666666666666';
const sumDb = new DatabaseSync(join(cliDir, 'conversation_summaries.db'));
sumDb.exec(`
CREATE TABLE conversation_summaries (
conversation_id TEXT NOT NULL,
title TEXT,
status TEXT,
parent_conversation_id TEXT,
agent_name TEXT,
not_fully_idle INTEGER,
killed INTEGER,
step_count INTEGER,
last_modified_time TEXT,
app_data_dir TEXT
);
CREATE TABLE conversations_fts (conversation_id TEXT, title TEXT, workspace TEXT, last_modified_time INTEGER, chunk_index INTEGER);
`);
sumDb
.prepare(
`INSERT INTO conversation_summaries
(conversation_id, title, status, parent_conversation_id, agent_name, not_fully_idle, killed, step_count, last_modified_time, app_data_dir)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
)
.run(cid, 'CLI Capsule E2E', 'CASCADE_RUN_STATUS_IDLE', '', '', 0, 0, 2, '2026-11-15 17:00:15+00:00', 'antigravity-cli');
sumDb
.prepare('INSERT INTO conversations_fts (conversation_id, title, workspace, last_modified_time, chunk_index) VALUES (?, ?, ?, ?, ?)')
.run(cid, 'CLI Capsule E2E', 'C:/Work/MyProject', 1794762015, -1);
sumDb.close();
// 10.0s request (1794762001.0s -> 1794762011.0s), 381 outputTokens => 38.1 tok/s, TTFT = 1.8s
const modelUsageBuf = Buffer.concat([
encodeProtoFieldVarint(1, 1425), // MODEL_PLACEHOLDER_M425
encodeProtoFieldVarint(2, 1200), // inputTokens
encodeProtoFieldVarint(3, 381), // outputTokens
encodeProtoFieldVarint(5, 13800), // cacheReadTokens
encodeProtoFieldVarint(6, 24), // API_PROVIDER_GOOGLE_GEMINI
]);
const stepMetaBuf = Buffer.concat([
encodeProtoFieldBytes(1, encodeProtoFieldVarint(1, 1794762001)), // createdAt
encodeProtoFieldBytes(6, encodeProtoFieldVarint(1, 1794762011)), // finishedGeneratingAt (+10.0s)
encodeProtoFieldBytes(7, encodeProtoFieldVarint(1, 1794762011)), // completedAt
encodeProtoFieldBytes(9, modelUsageBuf),
encodeProtoFieldBytes(20, encodeProtoFieldVarint(2, 1)), // stepIndex = 1
]);
const chatModelBuf = Buffer.concat([
encodeProtoFieldVarint(3, 1425),
encodeProtoFieldBytes(4, modelUsageBuf),
encodeProtoFieldBytes(
11,
Buffer.concat([encodeProtoFieldVarint(1, 1), encodeProtoFieldVarint(2, 800000000)]) // TTFT = 1.8s
),
encodeProtoFieldBytes(12, encodeProtoFieldVarint(1, 10)), // streamingDuration = 10s
]);
const genMetaBuf = Buffer.concat([
encodeProtoFieldBytes(2, Buffer.from([1])),
encodeProtoFieldBytes(1, chatModelBuf),
]);
const convDb = new DatabaseSync(join(convDir, `${cid}.db`));
convDb.exec(`
CREATE TABLE steps (idx INTEGER PRIMARY KEY, step_type INTEGER, status INTEGER, metadata BLOB, step_payload BLOB);
CREATE TABLE gen_metadata (idx INTEGER PRIMARY KEY, data BLOB);
`);
convDb.prepare('INSERT INTO steps (idx, step_type, status, metadata) VALUES (?, ?, ?, ?)').run(0, 14, 3, null);
convDb.prepare('INSERT INTO steps (idx, step_type, status, metadata) VALUES (?, ?, ?, ?)').run(1, 15, 3, stepMetaBuf);
convDb.prepare('INSERT INTO gen_metadata (idx, data) VALUES (?, ?)').run(0, genMetaBuf);
convDb.close();
writeFileSync(
join(dataDir, 'settings.json'),
JSON.stringify({
language: 'zh-CN',
showTopbarMultiSession: true,
enableCliStatusLine: true,
topbarCapsuleSlots: ['ttft', 'tps', 'quota_auto', 'context'],
}),
'utf8'
);
writeFileSync(
join(dataDir, 'cli-status-snapshot.json'),
JSON.stringify({
updatedAtMs: Date.now(),
runningCount: 0,
runningSubCount: 0,
hasWaiting: false,
quotas: {
activePool: { poolLabel: 'Gemini', remainingPct: 57 },
pools: [{ poolKey: 'Gemini', poolLabel: 'Gemini', remainingPct: 57 }],
},
}),
'utf8'
);
const stdinPayload = JSON.stringify({
agent_state: 'idle',
cwd: 'C:\\Work\\MyProject',
context_window: { used_percentage: 17, total_input_tokens: 15000, total_output_tokens: 381 },
cost: { total_usd: 0.012 },
});
const capsuleOut = execFileSync(process.execPath, [statusLineScript], {
env: { ...installEnv, NO_COLOR: '1' },
input: stdinPayload,
encoding: 'utf8',
}).trim();
assert.equal(capsuleOut, '● 0 运行中 1.8s | 38.1 t/s | 余 57% | ◎ 17%');
// Full 3-column single-line E2E with terminal_width + cycle_mode + model + native stdin quota fallback
const emptySnapDir = join(tempRoot, 'empty-data');
mkdirSync(emptySnapDir, { recursive: true });
writeFileSync(
join(emptySnapDir, 'settings.json'),
JSON.stringify({
language: 'zh-CN',
showTopbarMultiSession: true,
enableCliStatusLine: true,
topbarCapsuleSlots: ['ttft', 'tps', 'quota_auto', 'context'],
}),
'utf8'
);
const fullLineStdin = JSON.stringify({
agent_state: 'running',
cwd: 'C:\\Work\\MyProject',
terminal_width: 130,
cycle_mode: 'auto',
model: {
id: 'gemini-4-hydrogen-medium',
display_name: 'Gemini 4 Hydrogen (Medium)',
effort: 'medium',
},
quota: {
Gemini: { remaining_fraction: 0.54 },
},
context_window: { used_percentage: 2, total_input_tokens: 15000, total_output_tokens: 381 },
});
const fullLineOut = execFileSync(process.execPath, [statusLineScript], {
env: { ...installEnv, USAGE_MONITOR_DATA_DIR: emptySnapDir },
input: fullLineStdin,
encoding: 'utf8',
}).replace(/\r?\n$/, '');
assert.equal(/\x1b\[48;/.test(fullLineOut), false, 'E2E ANSI output has zero background fill');
const plainFullLine = fullLineOut.replace(/\x1b\[[0-9;]*m/g, '');
assert.ok(plainFullLine.startsWith('? for shortcuts '));
assert.ok(plainFullLine.includes('● 1 运行中 1.8s | 38.1 t/s | 余 54% | ◎ 2%'));
assert.ok(plainFullLine.endsWith(' auto · Gemini 4 Hydrogen · medium'));
assert.equal(h.cliDisplayWidth(fullLineOut), 129);
if (process.platform === 'win32') {
assert.equal(writtenSettings.statusLine.command.includes('"'), false);
const cmdCapsuleOut = execFileSync('cmd.exe', ['/c', writtenSettings.statusLine.command], {
env: { ...installEnv, NO_COLOR: '1' },
input: stdinPayload,
encoding: 'utf8',
}).trim();
assert.equal(cmdCapsuleOut, '● 0 运行中 1.8s | 38.1 t/s | 余 57% | ◎ 17%');
const spaceDir = join(tempRoot, 'Dir With Spaces');
mkdirSync(spaceDir, { recursive: true });
const spaceCmd = h.buildCliStatusLineCommand(statusLineScript, {
platform: 'win32',
nodeOnPath: true,
});
assert.ok(spaceCmd);
const encodedAutorunCmd = `node --input-type=module -e import('${new URL('../cli-statusline.mjs', import.meta.url).href}#autorun')`;
const autorunOut = execFileSync('cmd.exe', ['/c', encodedAutorunCmd], {
cwd: spaceDir,
env: { ...installEnv, NO_COLOR: '1' },
input: stdinPayload,
encoding: 'utf8',
}).trim();
assert.equal(autorunOut, '● 0 运行中 1.8s | 38.1 t/s | 余 57% | ◎ 17%');
}
// Verify real non-test.invalid buildTelemetryPayload writes cli-status-snapshot.json cleanly without throwing
const builderUrl = new URL('../backend/telemetry-builder.mjs', import.meta.url).href;
execFileSync(
process.execPath,
[
'--input-type=module',
'-e',
`const { buildTelemetryPayload } = await import(${JSON.stringify(builderUrl)});
const p = await buildTelemetryPayload(${JSON.stringify(cid)}, false, { range: 'all' });
if (!p || !p.activeConversation) process.exit(2);`,
],
{
env: {
...installEnv,
ANTIGRAVITY_LS_ADDRESS: '127.0.0.1:1',
ANTIGRAVITY_CSRF_TOKEN: 'live-check',
},
encoding: 'utf8',
}
);
const liveWrittenSnap = JSON.parse(readFileSync(join(dataDir, 'cli-status-snapshot.json'), 'utf8'));
assert.equal(liveWrittenSnap.activeConversation.cascadeId, cid);
assert.equal(liveWrittenSnap.activeConversation.latestTokPerSec, 38.1);
assert.ok(Number.isFinite(liveWrittenSnap.updatedAtMs) && liveWrittenSnap.updatedAtMs > 0);
// Verify uninstall removes managed statusLine while keeping other settings intact
const uninstallOut = JSON.parse(
execFileSync(process.execPath, [statusLineScript, '--uninstall'], {
env: installEnv,
encoding: 'utf8',
}).trim()
);
assert.equal(uninstallOut.updated, true);
const afterUninstall = JSON.parse(readFileSync(cliSettingsFile, 'utf8'));
assert.equal(afterUninstall.selectedAuthType, 'oauth');
assert.equal(afterUninstall.statusLine, undefined);
} finally {
rmSync(tempRoot, { recursive: true, force: true });
}
});
+112 -53
View File
@@ -475,9 +475,9 @@ test('Capsule 4-stage responsive hysteresis and backend settings default/overrid
assert.equal(defaultPayload.settings.enableWindowOverlay, true);
assert.equal(defaultPayload.settings.showTopbarMultiSession, true);
assert.deepEqual(Array.from(defaultPayload.settings.topbarCapsuleSlots), [
'context',
'tps',
'quota_auto',
'ttft',
'context',
]);
const disabledEnv = backendHarness({
@@ -784,13 +784,15 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
windowMountMode: 'dual',
enableWindowOverlay: true,
showTopbarMultiSession: true,
topbarCapsuleSlots: ['context', 'tps', 'quota_auto'],
enableCliStatusLine: true,
topbarCapsuleSlots: ['tps', 'ttft', 'context'],
hoverModules: ['metrics', 'context', 'quotas'],
overviewModules: ['metrics', 'context', 'quotas', 'live_tasks'],
overviewMetrics: ['tps', 'ttft', 'avg_tps', 'step_cost'],
stepTableColumns: ['step', 'model', 'tps', 'ttft', 'tokens_combo', 'cache', 'cost'],
showStepTurnRail: true,
showStepTurnRail: false,
showStepAgentBadge: true,
showStepSpeedColor: false,
showUpstreamModel: false,
orchestratorIdMode: 'compact',
weeklyLimitMode: 'official',
@@ -1369,15 +1371,18 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
const multiLabelEl = multiBtn.querySelector('.wm-multi-label');
assert.equal(multiLabelEl.textContent, '2 运行 · 1 子');
// Verify capsule reactive text (50% context, 92.4 t/s without bolt SVG, 余 68%)
// Verify capsule reactive text (default order: 92.4 t/s without bolt SVG, 0.85s TTFT, 50% context)
const defaultCapSlots = capsuleHost.shadowRoot.querySelectorAll('.wm-cap-slot');
const ctxPctEl = capsuleHost.shadowRoot.querySelector('.wm-ctx-pct');
const speedSegEl = capsuleHost.shadowRoot.querySelector('.wm-seg-speed');
const quotaSegEl = capsuleHost.shadowRoot.querySelector('.wm-seg-quota');
assert.equal(ctxPctEl.textContent, '50%');
assert.equal(defaultCapSlots[0].getAttribute('data-metric'), 'tps');
assert.equal(defaultCapSlots[1].getAttribute('data-metric'), 'ttft');
assert.equal(defaultCapSlots[2].getAttribute('data-metric'), 'context');
assert.equal(speedSegEl.children.length, 1, 'Speed segment has no lightning bolt SVG');
assert.equal(speedSegEl.querySelector('.svg-icon'), null);
assert.ok(speedSegEl.children[0].textContent.includes('92.4 t/s'));
assert.equal(quotaSegEl.children[0].textContent, '余 68%');
assert.equal(defaultCapSlots[1].children[0].textContent, '0.85s');
assert.equal(ctxPctEl.textContent, '50%');
// Verify hovering left multi-session button opens .wm-multi-panel with live tasks, subagents, and recent sessions
const multiPanelEl = portalHost.shadowRoot.querySelector('.wm-multi-panel');
@@ -1648,7 +1653,7 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
const thirdNavBtns = thirdNavBar.querySelectorAll('.structure-thirdnav-btn');
assert.deepEqual(
thirdNavBtns.map((btn) => btn.querySelector('.structure-thirdnav-label').textContent),
['挂载与胶囊', '鼠标悬浮窗', '实时监控布局', '调用明细字段'],
['挂载胶囊', '鼠标悬浮窗', '实时监控布局', '调用明细字段'],
'3rd-level menu renders 4 structure sub-tabs'
);
assert.equal(thirdNavBtns[0].classList.contains('is-active'), true, 'First 3rd-level tab active by default');
@@ -1668,10 +1673,10 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
const previewMultiBtn = sec0.querySelector('.wm-multi-btn');
assert.ok(previewCapsuleBar, 'Pane 0 mounts real CapsuleBarWidget preview');
assert.equal(previewCapsuleSlots.length, 5, 'Preview CapsuleBarWidget mounts real 5 capsule slots');
assert.equal(previewCapsuleSlots[0].querySelector('.wm-ctx-pct').textContent, '56%', 'Preview renders simulated context %');
assert.equal(previewCapsuleSlots[1].children[0].textContent, '68.4 t/s', 'Preview renders simulated speed');
assert.equal(previewCapsuleSlots[1].classList.contains('tone-good'), true, 'Preview capsule 68.4 t/s shares tone-good green with cards');
assert.equal(previewCapsuleSlots[2].children[0].textContent, '余 52%', 'Preview renders simulated quota_auto (min of 5h 64% and weekly 52%)');
assert.equal(previewCapsuleSlots[0].children[0].textContent, '68.4 t/s', 'Preview slot 0 renders simulated speed');
assert.equal(previewCapsuleSlots[0].classList.contains('tone-good'), true, 'Preview capsule 68.4 t/s shares tone-good green with cards');
assert.equal(previewCapsuleSlots[1].children[0].textContent, '1.1s', 'Preview slot 1 renders simulated TTFT');
assert.equal(previewCapsuleSlots[2].querySelector('.wm-ctx-pct').textContent, '56%', 'Preview slot 2 renders simulated context %');
const mountSelectEl = sec0.querySelectorAll('.custom-select')[0];
// Toggle windowMountSelect: dual -> composer -> sidebar -> dual (updating both live host & preview bar)
@@ -1703,9 +1708,9 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
assert.equal(mockSettings.enableWindowOverlay, true, 'enableWindowOverlay persisted back to true');
assert.equal(previewCapsuleBar.getAttribute('data-mount-mode'), 'dual');
// Toggle topbar multi-session switch: show -> hide -> show
// Toggle topbar multi-session switch (show -> hide -> show) and CLI bottom capsule switch (on -> off -> on)
const topbarSegBtns = sec0.querySelectorAll('.seg-btn');
assert.equal(topbarSegBtns.length, 2, 'Topbar multi-session toggle has 显示 / 隐藏 buttons');
assert.equal(topbarSegBtns.length, 4, 'Topbar multi-session + CLI bottom capsule toggles render 4 buttons');
topbarSegBtns[1].dispatchEvent({ type: 'click', stopPropagation() {} });
await new Promise((r) => setTimeout(r, 30));
assert.equal(mockSettings.showTopbarMultiSession, false);
@@ -1718,6 +1723,13 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
assert.equal(multiBtn.hasAttribute('hidden'), false, 'Topbar multi-session button restored immediately');
assert.equal(previewMultiBtn.hasAttribute('hidden'), false, 'Preview multi-session button restored immediately');
topbarSegBtns[3].dispatchEvent({ type: 'click', stopPropagation() {} });
await new Promise((r) => setTimeout(r, 30));
assert.equal(mockSettings.enableCliStatusLine, false, 'CLI bottom capsule toggle turns off enableCliStatusLine');
topbarSegBtns[2].dispatchEvent({ type: 'click', stopPropagation() {} });
await new Promise((r) => setTimeout(r, 30));
assert.equal(mockSettings.enableCliStatusLine, true, 'CLI bottom capsule toggle restores enableCliStatusLine');
// Dynamic 1..5 capsule slots via EditableSlotList (+ / - / ↑ / ↓ & mouse drag-and-drop)
const capSlots = capsuleHost.shadowRoot.querySelectorAll('.wm-cap-slot');
const capSeps = capsuleHost.shadowRoot.querySelectorAll('.wm-sep');
@@ -1730,19 +1742,14 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
let capRowSelects = capSlotWrap.querySelectorAll('.custom-select');
assert.equal(capRowSelects.length, 3, 'Default 3 capsule slot rows in EditableSlotList');
// Slot 0 -> Gemini 5h (index 9), Slot 1 -> TTFT (index 2), Slot 2 -> Cost (index 4)
// Slot 0 ('tps') -> Gemini 5h (index 9), Slot 1 stays TTFT, Slot 2 ('context') -> Cost (index 4)
capRowSelects[0].querySelector('.select-trigger').dispatchEvent({ type: 'click', stopPropagation() {} });
capRowSelects[0].querySelectorAll('.select-option')[9].dispatchEvent({ type: 'click', stopPropagation() {} });
await new Promise((r) => setTimeout(r, 30));
assert.equal(capSlots[0].getAttribute('data-metric'), 'gemini_5h');
assert.equal(capSlots[0].children.length, 1, 'Ring SVG detached cleanly when slot leaves context');
assert.equal(capSlots[0].children[0].textContent, '余 44%');
assert.equal(previewCapsuleSlots[0].getAttribute('data-metric'), 'gemini_5h', 'Preview slot 0 mirrors gemini_5h');
assert.equal(previewCapsuleSlots[0].children[0].textContent, '余 64%', 'Preview slot 0 renders simulated gemini_5h');
capRowSelects[1].querySelector('.select-trigger').dispatchEvent({ type: 'click', stopPropagation() {} });
capRowSelects[1].querySelectorAll('.select-option')[2].dispatchEvent({ type: 'click', stopPropagation() {} });
await new Promise((r) => setTimeout(r, 30));
assert.equal(capSlots[1].getAttribute('data-metric'), 'ttft');
assert.equal(capSlots[1].children[0].textContent, '0.85s');
@@ -1750,6 +1757,7 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
capRowSelects[2].querySelectorAll('.select-option')[4].dispatchEvent({ type: 'click', stopPropagation() {} });
await new Promise((r) => setTimeout(r, 30));
assert.equal(capSlots[2].getAttribute('data-metric'), 'cost');
assert.equal(capSlots[2].children.length, 1, 'Ring SVG detached cleanly when slot leaves context');
assert.equal(capSlots[2].children[0].textContent, '$0.040');
assert.deepEqual(mockSettings.topbarCapsuleSlots, ['gemini_5h', 'ttft', 'cost']);
@@ -1822,13 +1830,15 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
assert.equal(capSlotWrap.querySelector('.slot-remove-btn').hasAttribute('disabled'), true, '- button disabled at min 1 slot');
assert.equal(capSeps[0].hasAttribute('hidden'), true, 'All separators hidden when 1 slot');
// Reset Section 0 restores default 3 slots ['context', 'tps', 'quota_auto']
// Reset Section 0 restores default 3 slots ['tps', 'ttft', 'context']
sec0.querySelector('.btn-ghost-sm').dispatchEvent({ type: 'click', stopPropagation() {} });
await new Promise((r) => setTimeout(r, 40));
assert.deepEqual(mockSettings.topbarCapsuleSlots, ['context', 'tps', 'quota_auto']);
assert.equal(capSlots[0].getAttribute('data-metric'), 'context');
assert.equal(capSlots[0].children.length, 2, 'Ring SVG re-attached on Slot 0');
assert.equal(capSlots[0].querySelector('.wm-ctx-pct').textContent, '50%');
assert.deepEqual(mockSettings.topbarCapsuleSlots, ['tps', 'ttft', 'context']);
assert.equal(capSlots[0].getAttribute('data-metric'), 'tps');
assert.equal(capSlots[1].getAttribute('data-metric'), 'ttft');
assert.equal(capSlots[2].getAttribute('data-metric'), 'context');
assert.equal(capSlots[2].children.length, 2, 'Ring SVG re-attached on Slot 2');
assert.equal(capSlots[2].querySelector('.wm-ctx-pct').textContent, '50%');
// Pane 1 (3rd-level tab 'hover'): Hover Popup Modules (0..4) + real hover UI preview
const sec1 = accordionSections[1];
@@ -1920,9 +1930,30 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
assert.equal(sec3.hasAttribute('hidden'), false);
const previewStepTable = sec3.querySelector('.steps-data-table');
assert.ok(previewStepTable, 'Real StepTableWidget mounted in Steps structure preview');
assert.equal(previewStepTable.classList.contains('has-turn-rail'), true, 'Preview step table shows turn rail by default');
assert.equal(previewStepTable.classList.contains('has-turn-rail'), false, 'Preview step table hides turn rail by default');
assert.equal(previewStepTable.children[0].children[0].children.length, 7, 'Preview step table renders 7 default columns');
assert.equal(previewStepTable.children[1].children.length, 4, 'Preview step table renders 4 simulated steps');
const sec3SettingLabels = sec3.querySelectorAll('.form-label').map((el) => el.textContent);
assert.ok(sec3SettingLabels.includes('对话轮次导轨'), 'Turn rail switch rendered in 调用明细字段');
assert.ok(sec3SettingLabels.includes('主/子代理标识'), 'Main/Sub agent badge switch rendered in 调用明细字段');
assert.ok(sec3SettingLabels.includes('输出速度多色分级'), 'Speed multi-color switch rendered in 调用明细字段');
const sec3SegControls = sec3.querySelectorAll('.segmented');
assert.equal(sec3SegControls.length, 3, 'Three independent switches rendered in 调用明细字段');
const getRowSpeedClasses = (tableEl) =>
Array.from(tableEl.children[1].children).map(
(tr) => tr.children[2].querySelector('.cell-value')?.getAttribute('class') || ''
);
assert.equal(
getRowSpeedClasses(previewStepTable).every((cls) => cls === 'cell-value'),
true,
'Preview step table renders monochrome speed cells by default'
);
// Toggle ON 对话轮次导轨 & 输出速度多色分级, and toggle OFF 主/子代理标识
sec3SegControls[0].querySelectorAll('.seg-btn')[0].dispatchEvent({ type: 'click', stopPropagation() {} });
await new Promise((r) => setTimeout(r, 25));
assert.equal(mockSettings.showStepTurnRail, true, 'Turn rail switch updates showStepTurnRail to true');
assert.equal(previewStepTable.classList.contains('has-turn-rail'), true, 'Preview step table activates turn rail immediately');
const previewFirstTd = previewStepTable.children[1].children[0].children[0];
previewFirstTd.onmouseenter?.({ target: previewFirstTd });
const previewTurnTip = sec3.querySelector('.turn-prompt-tip');
@@ -1930,16 +1961,6 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
assert.ok(previewTurnTip.textContent.includes('并发刷新令牌'), 'Preview turn tooltip displays realistic engineering prompt');
previewFirstTd.onmouseleave?.();
const sec3SettingLabels = sec3.querySelectorAll('.form-label').map((el) => el.textContent);
assert.ok(sec3SettingLabels.includes('对话轮次导轨'), 'Turn rail switch rendered in 调用明细字段');
assert.ok(sec3SettingLabels.includes('主/子代理标识'), 'Main/Sub agent badge switch rendered in 调用明细字段');
const sec3SegControls = sec3.querySelectorAll('.segmented');
assert.equal(sec3SegControls.length, 2, 'Two independent switches rendered in 调用明细字段');
// Toggle off 对话轮次导轨 and 主/子代理标识
sec3SegControls[0].querySelectorAll('.seg-btn')[1].dispatchEvent({ type: 'click', stopPropagation() {} });
await new Promise((r) => setTimeout(r, 25));
assert.equal(mockSettings.showStepTurnRail, false, 'Turn rail switch updates showStepTurnRail to false');
assert.equal(previewStepTable.classList.contains('has-turn-rail'), false, 'Preview step table removes turn rail immediately');
sec3SegControls[1].querySelectorAll('.seg-btn')[1].dispatchEvent({ type: 'click', stopPropagation() {} });
await new Promise((r) => setTimeout(r, 25));
assert.equal(mockSettings.showStepAgentBadge, false, 'Agent badge switch updates showStepAgentBadge to false');
@@ -1948,6 +1969,14 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
true,
'Preview step table hides Main/Sub agent badge immediately'
);
sec3SegControls[2].querySelectorAll('.seg-btn')[0].dispatchEvent({ type: 'click', stopPropagation() {} });
await new Promise((r) => setTimeout(r, 25));
assert.equal(mockSettings.showStepSpeedColor, true, 'Speed multi-color switch updates showStepSpeedColor to true');
assert.equal(
getRowSpeedClasses(previewStepTable).some((cls) => /tone-(good|info|warn|danger)/.test(cls)),
true,
'Preview step table enables multi-color speed tones immediately when showStepSpeedColor is true'
);
const stepColWrap = sec3.querySelector('.editable-slot-wrap');
stepColWrap.querySelector('.slot-add-btn').dispatchEvent({ type: 'click', stopPropagation() {} });
@@ -1958,27 +1987,37 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
assert.equal(previewStepTable.children[0].children[0].children.length, 9, 'Preview step table expands to 9 columns live');
pillTabs[2].dispatchEvent({ type: 'click', stopPropagation() {} });
await new Promise((r) => setTimeout(r, 15));
const stepTableWhileRailOff = allPanes[2].querySelector('.data-table');
const stepTableWhileCustomOn = allPanes[2].querySelector('.data-table');
assert.equal(
stepTableWhileRailOff.classList.contains('has-turn-rail'),
false,
'has-turn-rail class removed when showStepTurnRail is false'
);
assert.equal(
Array.from(stepTableWhileRailOff.querySelectorAll('.turn-rail'))
.every((rail) => rail.hasAttribute('hidden')),
stepTableWhileCustomOn.classList.contains('has-turn-rail'),
true,
'No visible turn rail when showStepTurnRail is false'
'has-turn-rail class applied when showStepTurnRail is true'
);
const stepHeaderThs = stepTableWhileRailOff.children[0].children[0].children;
assert.equal(
Array.from(stepTableWhileCustomOn.children[1].children).some((tr) =>
/tone-(good|info|warn|danger)/.test(
tr.children[2].querySelector('.cell-value')?.getAttribute('class') || ''
)
),
true,
'StepsDetailView applies multi-color speed classes when showStepSpeedColor is true'
);
const stepHeaderThs = stepTableWhileCustomOn.children[0].children[0].children;
assert.equal(stepHeaderThs.length, 9, 'StepsDetailView thead dynamically renders 9 columns');
pillTabs[3].dispatchEvent({ type: 'click', stopPropagation() {} });
await new Promise((r) => setTimeout(r, 15));
sec3.querySelector('.btn-ghost-sm').dispatchEvent({ type: 'click', stopPropagation() {} });
await new Promise((r) => setTimeout(r, 40));
assert.equal(mockSettings.stepTableColumns.length, 7);
assert.equal(mockSettings.showStepTurnRail, true, 'Section reset restores showStepTurnRail to true');
assert.equal(mockSettings.showStepTurnRail, false, 'Section reset restores showStepTurnRail to false');
assert.equal(mockSettings.showStepAgentBadge, true, 'Section reset restores showStepAgentBadge to true');
assert.equal(mockSettings.showStepSpeedColor, false, 'Section reset restores showStepSpeedColor to false');
assert.equal(previewStepTable.classList.contains('has-turn-rail'), false, 'Section reset hides turn rail in preview step table');
assert.equal(
getRowSpeedClasses(previewStepTable).every((cls) => cls === 'cell-value'),
true,
'Section reset restores monochrome speed classes in preview step table'
);
// --- 其他 (model format, context limits, cache rebuild, reset) ---
subNavBtns[2].dispatchEvent({ type: 'click', stopPropagation() {} });
@@ -2145,8 +2184,24 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
assert.equal(stepRows[0].children[4].getAttribute('title'), '上下文 37800 · 思考 420 · 正文 265');
assert.equal(stepRows[1].children[4].children[0].textContent, '117.7k / 14.5k / 57');
// Verify minimalist Turn Rail (.has-turn-rail, cap & origin dots) and hover prompt preview tooltip
// Verify minimalist Turn Rail (.has-turn-rail, cap & origin dots) is off by default and activates cleanly when enabled
const stepsDataTable = stepsPane.querySelectorAll('.data-table')[0];
assert.equal(stepsDataTable.classList.contains('has-turn-rail'), false, 'Turn rail off by default after full reset');
assert.equal(
Array.from(stepRows).every(
(tr) => tr.children[2].querySelector('.cell-value')?.getAttribute('class') === 'cell-value'
),
true,
'Speed column monochrome by default after full reset'
);
pillTabs[3].dispatchEvent({ type: 'click', stopPropagation() {} });
subNavBtns[1].dispatchEvent({ type: 'click', stopPropagation() {} });
thirdNavBtns[3].dispatchEvent({ type: 'click', stopPropagation() {} });
await new Promise((r) => setTimeout(r, 15));
sec3SegControls[0].querySelectorAll('.seg-btn')[0].dispatchEvent({ type: 'click', stopPropagation() {} });
await new Promise((r) => setTimeout(r, 25));
pillTabs[2].dispatchEvent({ type: 'click', stopPropagation() {} });
await new Promise((r) => setTimeout(r, 20));
assert.equal(stepsDataTable.classList.contains('has-turn-rail'), true, 'Turn rail active when showStepTurnRail=true');
const row0Rail = stepRows[0].children[0].querySelector('.turn-rail');
const row1Rail = stepRows[1].children[0].querySelector('.turn-rail');
@@ -2583,10 +2638,14 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
]);
assert.equal(delivered, 1);
await new Promise((r) => setTimeout(r, 20));
assert.equal(ctxPctEl.textContent, '25%', 'CDP relay delivered live telemetry without HTTP');
assert.equal(speedSegEl.children[0].textContent, '121 t/s');
assert.equal(quotaSegEl.hasAttribute('hidden'), false, 'Quota slot stays pre-reserved even when quotas=null');
assert.equal(quotaSegEl.children[0].textContent, '余 --%');
assert.equal(
defaultCapSlots[2].querySelector('.wm-ctx-pct').textContent,
'25%',
'CDP relay delivered live telemetry without HTTP'
);
assert.equal(defaultCapSlots[0].children[0].textContent, '121 t/s');
assert.equal(defaultCapSlots[1].hasAttribute('hidden'), false, 'TTFT slot stays pre-reserved even when latestTtftSec is absent');
assert.equal(defaultCapSlots[1].children[0].textContent, '--s');
assert.equal(
hoverLegendGrid.children[0],
firstLegendSlotBefore,