|
1 | 1 | import { Box, createCliRenderer, parseColor, type RGBA, Text } from '@opentui/core' |
2 | | -import { installPiConfig, type PiStatus, piStatus, uninstallPiConfig } from '../config-install.ts' |
| 2 | +import { |
| 3 | + installPiConfig, |
| 4 | + installStatus, |
| 5 | + type PiStatus, |
| 6 | + piStatus, |
| 7 | + uninstallPiConfig |
| 8 | +} from '../config-install.ts' |
3 | 9 | import type { |
4 | 10 | Account, |
5 | 11 | AnalyticsSnapshot, |
@@ -1358,6 +1364,11 @@ export async function runTuiDashboard( |
1358 | 1364 | : buildScenario(fixture.name, simulatedNow) |
1359 | 1365 | let rows = orderedRows(analytics.snapshot) |
1360 | 1366 | let pi: PiStatus = live ? await piStatus() : { present: true, routed: true } |
| 1367 | + // Routing is derived from the harness config files, which can change while |
| 1368 | + // this dashboard is open (tokenmaxx install/uninstall from another shell, |
| 1369 | + // first-login auto-enable, daemon heal after an update). options.routing is |
| 1370 | + // only the launch-time snapshot; reload() keeps this current. |
| 1371 | + let routing = options.routing |
1361 | 1372 | const state: ViewState = { |
1362 | 1373 | addConfirm: null, |
1363 | 1374 | alert: options.alert ?? '', |
@@ -1398,7 +1409,7 @@ export async function runTuiDashboard( |
1398 | 1409 | columns, |
1399 | 1410 | now: live ? Date.now() : simulatedNow, |
1400 | 1411 | pi, |
1401 | | - routing: options.routing, |
| 1412 | + routing, |
1402 | 1413 | rows: process.stdout.rows ?? 24, |
1403 | 1414 | switchFlagMs: fixture !== undefined && fixture.timewarp > 0 ? 24 * 60_000 : 120_000, |
1404 | 1415 | theme: currentTheme(), |
@@ -1447,6 +1458,8 @@ export async function runTuiDashboard( |
1447 | 1458 | analytics = await readAnalytics(socketPath) |
1448 | 1459 | rows = orderedRows(analytics.snapshot) |
1449 | 1460 | pi = await piStatus() |
| 1461 | + const status = await installStatus() |
| 1462 | + routing = { anthropic: status.claudeRouted, openai: status.codexRouted } |
1450 | 1463 | clampSelection() |
1451 | 1464 | }) |
1452 | 1465 |
|
@@ -1608,7 +1621,7 @@ export async function runTuiDashboard( |
1608 | 1621 | } |
1609 | 1622 |
|
1610 | 1623 | const toggleRouting = (provider: ProviderId) => { |
1611 | | - finish({ enable: !options.routing[provider], kind: 'routing', provider }) |
| 1624 | + finish({ enable: !routing[provider], kind: 'routing', provider }) |
1612 | 1625 | } |
1613 | 1626 |
|
1614 | 1627 | const adjustSetting = (delta: number) => { |
|
0 commit comments