Make Codex and Claude Code subscriptions go further: a local model router that gives routine agent work to economical models and keeps your strongest model for the hard parts.
Rust ai-agentsai-gatewayclaude-codecodexcoding-agentcost-optimizationdeepseekllm-gatewayllm-routerlocal-firstmodel-routingrusttask-routingtauri
fix(desktop): restore scrolling in model and routing lists (#36)
澄潭614d2ea6e35d
diff --git a/apps/desktop/src/occami/styles.css b/apps/desktop/src/occami/styles.cssindex 8716246c..15e4e09f 100644--- a/apps/desktop/src/occami/styles.css+++ b/apps/desktop/src/occami/styles.css@@ -12,6 +12,16 @@.hr-ui.occami-root { --titlebar-height:44px; --toolbar-height:calc(44px + 24px * var(--hr-text-scale)); font-family:var(--font-sans); font-size:calc(16px * var(--hr-text-scale)); color:var(--text); background:var(--bg); }.main > div:not([hidden]) { height:100%; min-height:0; }.main > [hidden] { display:none !important; }+/* Keep list viewports below in-flow notices, within the page's remaining height. */+.hr-models-page > .page-content.no-padding,+.routing-page > .page-content.no-padding { display:flex; flex-direction:column; }+.hr-models-page > .page-content.no-padding > *,+.routing-page > .page-content.no-padding > * { flex-shrink:0; }+.hr-models-page > .page-content > .models-feature,+.routing-page > .page-content.no-padding > .split-view { flex:1; min-height:0; }+.hr-models-page .models-feature { min-width:0; }+.routing-page > .page-content.no-padding > .split-view { height:auto; }+.hr-models-page .master-toolbar { flex-shrink:0; }.fatal-recovery { width:100%; height:100%; min-height:100%; background:var(--bg); }.fatal-recovery .btn { margin:0 auto; }.modal-backdrop, .sheet-backdrop { top:0; }diff --git a/apps/desktop/tests/v3/browser/list-scroll.html b/apps/desktop/tests/v3/browser/list-scroll.htmlnew file mode 100644index 00000000..5b884381--- /dev/null+++ b/apps/desktop/tests/v3/browser/list-scroll.html@@ -0,0 +1,3 @@+<!doctype html>+<html lang="en"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>List scroll regression</title></head>+<body><div id="root"></div><script type="module" src="./list-scroll.tsx"></script></body></html>diff --git a/apps/desktop/tests/v3/browser/list-scroll.tsx b/apps/desktop/tests/v3/browser/list-scroll.tsxnew file mode 100644index 00000000..d232a4c4--- /dev/null+++ b/apps/desktop/tests/v3/browser/list-scroll.tsx@@ -0,0 +1,48 @@+// Real product pages with synthetic IPC data; no daemon or provider calls.+import React from 'react';+import { createRoot } from 'react-dom/client';+import { mockIPC } from '@tauri-apps/api/mocks';+import { ModelManagementPage } from '../../../src/product/ModelManagementPage';+import { RoutingPage } from '../../../src/product/RoutingPage';+import { PresentationRoot, parseTextScale } from '../../../src/ui';+import { dailyPlan, mockProductInvoke, readyDesktop, readyManagement } from './product-fixtures';+import '../../../src/occami/styles.css';++const params = new URLSearchParams(location.search);+const page = params.get('page') === 'routing' ? 'routing' : 'models';+const warning = params.get('warning') === 'true';+const count = params.get('empty') === 'true' ? 0 : 40;+const management = structuredClone(readyManagement);+const source = management.sources[0];+source.models = Array.from({ length: count }, (_, i) => ({+ ...source.models[0], model_ref: `scroll-model-${i + 1}`, binding_id: `scroll-binding-${i + 1}`,+ display_name: `Scroll model ${String(i + 1).padStart(2, '0')}`,+}));+management.sources = count ? [source] : [];+const plans = Array.from({ length: count }, (_, i) => ({+ ...dailyPlan, agent_plan_id: `scroll-route-${i + 1}`, model_alias: `scroll-route-${i + 1}`,+ desired: { ...dailyPlan.desired, display_name: `Scroll route ${String(i + 1).padStart(2, '0')}` },+}));+const snapshot = {+ ...readyDesktop, catalog: { plans, drafts: [] },+ catalog_error: warning ? 'SCROLL_FIXTURE_UNAVAILABLE' : null,+ trusted_authority: !warning,+};+mockIPC((command, payload) => command === 'compute_management_snapshot'+ ? management : mockProductInvoke(command, payload as Record<string, any> | undefined, 'ready'));++createRoot(document.getElementById('root')!).render(+ <PresentationRoot language="en" theme="dark" textScale={parseTextScale(params.get('scale'))}>+ <div className="app-window">+ <header className="titlebar" />+ <aside className="sidebar">Scroll regression fixture</aside>+ <main className="main"><div>+ {page === 'models'+ ? <ModelManagementPage language="en" active trustedAuthority={!warning} refreshVersion={0}+ onOperation={() => undefined} onRecoveryRefresh={() => undefined} onChanged={() => undefined} />+ : <RoutingPage language="en" snapshot={snapshot} loading={false} busy={false}+ onRefresh={async () => undefined} onOperation={() => undefined} />}+ </div></main>+ </div>+ </PresentationRoot>,+);diff --git a/apps/desktop/tests/v3/visual/list-scroll-check.mjs b/apps/desktop/tests/v3/visual/list-scroll-check.mjsnew file mode 100644index 00000000..0a38b0f0--- /dev/null+++ b/apps/desktop/tests/v3/visual/list-scroll-check.mjs@@ -0,0 +1,73 @@+// node tests/v3/visual/list-scroll-check.mjs CDP_PORT VITE_URL [EVIDENCE_DIRECTORY]+// Uses real React pages with synthetic IPC; not native Desktop acceptance.+import assert from 'node:assert/strict';+import { mkdirSync, writeFileSync } from 'node:fs';+import { join } from 'node:path';+import { connectPage, navigate, evaluate, waitFor } from './cdp-client.mjs';++const [port, base, evidence] = process.argv.slice(2);+assert(port && base, 'Provide an isolated Chrome CDP port and Vite URL');+if (evidence) mkdirSync(evidence, { recursive: true });+const client = await connectPage(Number(port));+const keepAlive = setInterval(() => {}, 1000);+const results = [];+const measure = `(() => {+ const list = document.querySelector('.master-list');+ const rect = list.getBoundingClientRect();+ const first = list.firstElementChild.getBoundingClientRect();+ const last = list.lastElementChild.getBoundingClientRect();+ return {height:list.clientHeight, content:list.scrollHeight, top:list.scrollTop,+ x:rect.x, y:rect.y, bottom:rect.bottom, first:first.top, lastTop:last.top, lastBottom:last.bottom,+ viewport:innerHeight, toolbar:document.querySelector('.page-toolbar').getBoundingClientRect().bottom};+})()`;+try {+ for (const width of [1280, 780]) for (const scale of [1, 1.5, 2]) {+ for (const page of ['models', 'routing']) for (const warning of [false, true]) {+ const name = `${page}-${width}-${scale}-${warning ? 'warning' : 'ready'}`;+ const started = performance.now();+ try {+ const query = new URLSearchParams({ page, scale: String(scale), warning: String(warning) });+ await navigate(client, `${base}/tests/v3/browser/list-scroll.html?${query}`, { width, height: 800 });+ await waitFor(client, `document.querySelectorAll('.master-list > .list-row').length === 40 && document.querySelector('.hr-ui').dataset.textScale === '${scale}'`);+ const before = await evaluate(client, measure);+ assert(before.height > 62 && before.content > before.height, 'Long list needs a bounded scroll viewport');+ assert(before.bottom <= before.viewport + 1, 'List viewport must fit below notices');+ const wheel = deltaY => client.send('Input.dispatchMouseEvent', {+ type: 'mouseWheel', x: before.x + 100, y: before.y + Math.min(40, before.height / 2), deltaX: 0, deltaY,+ });+ await wheel(100000);+ await waitFor(client, `document.querySelector('.master-list').scrollTop > 0`);+ await waitFor(client, `Math.abs(document.querySelector('.master-list').scrollHeight - document.querySelector('.master-list').clientHeight - document.querySelector('.master-list').scrollTop) < 2`);+ const bottom = await evaluate(client, measure);+ assert(bottom.lastTop >= bottom.y - 1 && bottom.lastBottom <= Math.min(bottom.bottom, bottom.viewport) + 1, 'Entire last row must be visible after wheel');+ assert.equal(bottom.toolbar, before.toolbar, 'Page toolbar must stay fixed');+ if (evidence) {+ const shot = await client.send('Page.captureScreenshot', { format: 'png' });+ writeFileSync(join(evidence, `${name}.png`), Buffer.from(shot.data, 'base64'));+ }+ await wheel(-100000);+ await waitFor(client, `document.querySelector('.master-list').scrollTop === 0`);+ await wheel(100000);+ await waitFor(client, `Math.abs(document.querySelector('.master-list').scrollHeight - document.querySelector('.master-list').clientHeight - document.querySelector('.master-list').scrollTop) < 2`);+ const last = await evaluate(client, `(() => {const r=document.querySelector('.master-list > .list-row:last-child').getBoundingClientRect();return {x:r.x+100,y:r.y+r.height/2};})()`);+ await client.send('Input.dispatchMouseEvent', { type: 'mousePressed', ...last, button: 'left', clickCount: 1 });+ await client.send('Input.dispatchMouseEvent', { type: 'mouseReleased', ...last, button: 'left', clickCount: 1 });+ await waitFor(client, `document.querySelector('.master-list > .list-row:last-child').getAttribute('aria-current') === 'page'`);+ await waitFor(client, page === 'models'+ ? `document.querySelector('.detail-pane h2')?.textContent === 'Scroll model 40'`+ : `[...document.querySelectorAll('.detail-pane input')].some(input => input.value === 'Scroll route 40')`);+ results.push({ name, state: 'green', milliseconds: Math.round(performance.now() - started), before, bottom });+ } catch (error) {+ results.push({ name, state: 'red', error: String(error) });+ }+ }+ }+ const report = { evidence: 'Chromium, real React pages with synthetic IPC; not native Desktop', results };+ if (evidence) writeFileSync(join(evidence, 'results.json'), JSON.stringify(report, null, 2));+ console.log(JSON.stringify(report, null, 2));+ assert.equal(results.length, 24);+ assert.equal(results.filter(result => result.state === 'red').length, 0, 'Every selected scenario must pass');+} finally {+ client.close();+ clearInterval(keepAlive);+}